summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore9076
-rw-r--r--GCC-README.md129
-rw-r--r--boot.manifest (renamed from usr/src/cmd/print/scripts/desktop-print-management)22
-rw-r--r--exception_lists/cstyle10
-rw-r--r--manifest17531
-rw-r--r--usr/src/Makefile13
-rw-r--r--usr/src/Makefile.lint2
-rw-r--r--usr/src/Makefile.master40
-rw-r--r--usr/src/Makefile.master.641
-rw-r--r--usr/src/Targetdirs4
-rw-r--r--usr/src/cmd/Makefile21
-rw-r--r--usr/src/cmd/Makefile.check3
-rw-r--r--usr/src/cmd/availdevs/Makefile2
-rw-r--r--usr/src/cmd/boot/bootadm/bootadm_upgrade.c1
-rw-r--r--usr/src/cmd/cmd-crypto/kmfcfg/Makefile3
-rw-r--r--usr/src/cmd/cmd-crypto/pktool/Makefile2
-rw-r--r--usr/src/cmd/cmd-crypto/tpmadm/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt7
-rw-r--r--usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c22
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/mdnsd/DNSCommon.c2
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/vrrpd/vrrpd.c23
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c32
-rw-r--r--usr/src/cmd/column/Makefile (renamed from usr/src/cmd/lp/cmd/Makefile.msg)24
-rw-r--r--usr/src/cmd/column/THIRDPARTYLICENSE26
-rw-r--r--usr/src/cmd/column/THIRDPARTYLICENSE.descrip1
-rw-r--r--usr/src/cmd/column/column.c335
-rw-r--r--usr/src/cmd/coreadm/coreadm.xml8
-rw-r--r--usr/src/cmd/cron/cron.c142
-rw-r--r--usr/src/cmd/cron/cron.h3
-rw-r--r--usr/src/cmd/cron/crontab.c20
-rw-r--r--usr/src/cmd/date/date.c78
-rw-r--r--usr/src/cmd/devfsadm/Makefile.com1
-rw-r--r--usr/src/cmd/devfsadm/devlink.tab.sh5
-rw-r--r--usr/src/cmd/devfsadm/misc_link.c4
-rw-r--r--usr/src/cmd/dfs.cmds/sharemgr/Makefile.com3
-rw-r--r--usr/src/cmd/dladm/dladm.c134
-rw-r--r--usr/src/cmd/dlmgmtd/dlmgmt_db.c97
-rw-r--r--usr/src/cmd/dlmgmtd/dlmgmt_door.c50
-rw-r--r--usr/src/cmd/dlmgmtd/dlmgmt_impl.h5
-rw-r--r--usr/src/cmd/dlmgmtd/dlmgmt_main.c41
-rw-r--r--usr/src/cmd/dlmgmtd/dlmgmt_util.c16
-rw-r--r--usr/src/cmd/dlmgmtd/svc-dlmgmtd9
-rw-r--r--usr/src/cmd/dlstat/dlstat.c70
-rw-r--r--usr/src/cmd/dtrace/test/cmd/scripts/dtest.pl2
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/Makefile21
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/aggs/tst.subr.d4
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.nonarrow.ksh48
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/json/tst.general.d179
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/json/tst.general.d.out218
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/json/tst.strsize.d51
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/json/tst.strsize.d.out13
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.c61
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.d65
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.d.out11
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/json/usdt.d27
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/llquantize/tst.range.d4
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/mdb/tst.postmort.ksh (renamed from usr/src/cmd/print/conv_fix/Makefile)70
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh97
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/privs/tst.fds.ksh91
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh9
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/privs/tst.getf.ksh98
-rwxr-xr-xusr/src/cmd/dtrace/test/tst/common/privs/tst.procpriv.ksh138
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/privs/tst.providers.ksh126
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d35
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d34
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d66
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out20
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh5
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh5
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh5
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh5
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.include.ksh3
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh106
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out3
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh5
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh (renamed from usr/src/cmd/print/scripts/desktop-print-management-prefs)42
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh4
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh4
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh4
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/ustack/tst.unpriv.c7
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/ustack/tst.unpriv.ksh (renamed from usr/src/cmd/print/scripts/getmodels)61
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/ustack/unpriv_helper.d4
-rw-r--r--usr/src/cmd/flowadm/flowadm.c51
-rw-r--r--usr/src/cmd/flowstat/flowstat.c21
-rw-r--r--usr/src/cmd/fm/fmdump/common/asru.c4
-rw-r--r--usr/src/cmd/fm/fmdump/common/error.c4
-rw-r--r--usr/src/cmd/fm/fmdump/common/fault.c4
-rw-r--r--usr/src/cmd/fm/fmdump/common/fmdump.c25
-rw-r--r--usr/src/cmd/fm/fmdump/common/fmdump.h4
-rw-r--r--usr/src/cmd/fm/fmdump/common/info.c4
-rw-r--r--usr/src/cmd/fm/fmdump/common/nvlrender.c17
-rw-r--r--usr/src/cmd/fm/fmtopo/common/fmtopo.c64
-rw-r--r--usr/src/cmd/fm/modules/common/Makefile1
-rw-r--r--usr/src/cmd/fm/modules/common/disk-lights/Makefile23
-rw-r--r--usr/src/cmd/fm/modules/common/disk-lights/disk-lights.conf17
-rw-r--r--usr/src/cmd/fm/modules/common/disk-lights/disk_lights.c325
-rw-r--r--usr/src/cmd/fm/modules/common/fabric-xlate/Makefile2
-rw-r--r--usr/src/cmd/fs.d/Makefile5
-rw-r--r--usr/src/cmd/fs.d/hyprlofs/Makefile (renamed from usr/src/cmd/lp/lib/Makefile.msg)27
-rw-r--r--usr/src/cmd/fs.d/hyprlofs/hlcfg/Makefile (renamed from usr/src/cmd/lp/filter/postscript/filtdesc/postio.fd)15
-rw-r--r--usr/src/cmd/fs.d/hyprlofs/hlcfg/hlcfg.c244
-rw-r--r--usr/src/cmd/fs.d/hyprlofs/mount/Makefile31
-rw-r--r--usr/src/cmd/fs.d/hyprlofs/mount/mount.c148
-rw-r--r--usr/src/cmd/fs.d/lxproc/Makefile32
-rw-r--r--usr/src/cmd/fs.d/lxproc/mount.c140
-rw-r--r--usr/src/cmd/fs.d/nfs/lib/smfcfg.c20
-rw-r--r--usr/src/cmd/fs.d/nfs/lib/smfcfg.h2
-rw-r--r--usr/src/cmd/fs.d/nfs/mountd/mountd.c8
-rw-r--r--usr/src/cmd/fs.d/nfs/nfsd/nfsd.c8
-rw-r--r--usr/src/cmd/fs.d/nfs/svc/nfs-server4
-rw-r--r--usr/src/cmd/hal/Makefile.hal9
-rw-r--r--usr/src/cmd/halt/halt.c19
-rw-r--r--usr/src/cmd/hwdata/pci.ids1301
-rw-r--r--usr/src/cmd/ibd_upgrade/ibd_delete_link.c2
-rw-r--r--usr/src/cmd/init/init.c40
-rw-r--r--usr/src/cmd/initpkg/mountall.sh5
-rw-r--r--usr/src/cmd/initpkg/shutdown.sh2
-rw-r--r--usr/src/cmd/initpkg/umountall.sh4
-rw-r--r--usr/src/cmd/ipdadm/Makefile54
-rw-r--r--usr/src/cmd/ipdadm/ipdadm.c444
-rw-r--r--usr/src/cmd/ipf/lib/common/load_hash.c12
-rw-r--r--usr/src/cmd/ipf/lib/common/load_hashnode.c12
-rw-r--r--usr/src/cmd/ipf/lib/common/load_pool.c12
-rw-r--r--usr/src/cmd/ipf/lib/common/load_poolnode.c12
-rw-r--r--usr/src/cmd/ipf/tools/Makefile.tools16
-rw-r--r--usr/src/cmd/ipf/tools/ipf.c54
-rw-r--r--usr/src/cmd/ipf/tools/ipfs.c43
-rw-r--r--usr/src/cmd/ipf/tools/ipfstat.c44
-rw-r--r--usr/src/cmd/ipf/tools/ipfzone.c107
-rw-r--r--usr/src/cmd/ipf/tools/ipfzone.h16
-rw-r--r--usr/src/cmd/ipf/tools/ipmon.c43
-rw-r--r--usr/src/cmd/ipf/tools/ipnat.c26
-rw-r--r--usr/src/cmd/ipf/tools/ippool.c95
-rw-r--r--usr/src/cmd/isns/isnsadm/Makefile2
-rw-r--r--usr/src/cmd/isns/isnsd/Makefile2
-rw-r--r--usr/src/cmd/krb5/kadmin/Makefile2
-rw-r--r--usr/src/cmd/latencytop/Makefile.com2
-rw-r--r--usr/src/cmd/localedef/Makefile16
-rw-r--r--usr/src/cmd/lofiadm/main.c31
-rw-r--r--usr/src/cmd/logadm/main.c83
-rw-r--r--usr/src/cmd/logadm/tester25
-rw-r--r--usr/src/cmd/lp/Makefile125
-rw-r--r--usr/src/cmd/lp/Makefile.lp121
-rw-r--r--usr/src/cmd/lp/cmd/Makefile95
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/Makefile104
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/chkopts.c1200
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/default.c79
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/do_align.c677
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/do_fault.c46
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/do_mount.c336
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/do_printer.c781
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/do_pwheel.c199
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/done.c44
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/fromclass.c149
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/ismodel.c40
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/lpadmin.c231
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/lpadmin.h139
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/options.c775
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/output.c146
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/pick_opts.c107
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/rmdest.c127
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/send_message.c88
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/signals.c119
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/startup.c50
-rw-r--r--usr/src/cmd/lp/cmd/lpadmin/usage.c139
-rw-r--r--usr/src/cmd/lp/cmd/lpfilter.c916
-rw-r--r--usr/src/cmd/lp/cmd/lpforms.c1438
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/Makefile139
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/alerts.c349
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/cancel.c62
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/daisyforms.c470
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disena.c129
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disp1.c1177
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disp2.c613
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disp3.c804
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disp4.c529
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disp5.c78
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/dispatch.h107
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disptab.c349
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/dowait.c590
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/exec.c1435
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/faults.c220
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/files.c456
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/flt.c183
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/fncs.c996
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/getkey.c44
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/init.c281
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/log.c220
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/lpfsck.c397
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/lpsched.c441
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/lpsched.h417
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/msgs.c253
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/nodes.h212
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/notify.c215
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/pickfilter.c496
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/ports.c330
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/print-svc167
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/requeue.c271
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/rstatus.c203
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/schedule.c605
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/server.xml136
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/status.c721
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/terminate.c115
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/validate.c1075
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/validate.h80
-rw-r--r--usr/src/cmd/lp/cmd/lpshut.c204
-rw-r--r--usr/src/cmd/lp/cmd/lptest/Makefile71
-rw-r--r--usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE32
-rw-r--r--usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE.descrip1
-rw-r--r--usr/src/cmd/lp/cmd/lptest/lptest.c54
-rw-r--r--usr/src/cmd/lp/cmd/lpusers.c215
-rw-r--r--usr/src/cmd/lp/cmd/scripts/Makefile80
-rw-r--r--usr/src/cmd/lp/cmd/scripts/lpsched134
-rw-r--r--usr/src/cmd/lp/cmd/scripts/lpshut41
-rw-r--r--usr/src/cmd/lp/crontab/lp35
-rw-r--r--usr/src/cmd/lp/filter/Makefile56
-rw-r--r--usr/src/cmd/lp/filter/postscript/Makefile.msg35
-rw-r--r--usr/src/cmd/lp/filter/postscript/README306
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/Makefile64
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/README26
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/comments.h154
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/dev.h75
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/ext.h59
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/gen.h69
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/glob.c50
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/misc.c283
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/path.h42
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/request.c158
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/request.h52
-rw-r--r--usr/src/cmd/lp/filter/postscript/common/tempnam.c55
-rw-r--r--usr/src/cmd/lp/filter/postscript/download/Makefile77
-rw-r--r--usr/src/cmd/lp/filter/postscript/download/README31
-rw-r--r--usr/src/cmd/lp/filter/postscript/download/download.c574
-rw-r--r--usr/src/cmd/lp/filter/postscript/download/download.h57
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/Makefile85
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/README53
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/color.c251
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/dpost.c2826
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/dpost.h196
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/draw.c777
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/pictures.c325
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/ps_include.c204
-rw-r--r--usr/src/cmd/lp/filter/postscript/dpost/ps_include.ps139
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/Makefile62
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/catv.fd34
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/download.fd30
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/dpost.fd39
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/postior.fd29
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/postpages.fd34
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/postprint.fd43
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/postreverse.fd30
-rw-r--r--usr/src/cmd/lp/filter/postscript/filtdesc/pr.fd36
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/Makefile91
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/README139
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/AB122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/AB.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/AI122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/AI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/AR122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/AR.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/AX122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/AX.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/B134
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/B.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/BI130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/BI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CB134
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CB.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CI142
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CO134
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CO.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CW142
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CW.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CX142
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/CX.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/DESC57
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/DESC.big48
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/DESC.small52
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/GR83
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/GR.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/H130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/H.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/HB130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/HB.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/HI130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/HI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/HX130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/HX.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Hb122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Hb.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Hi122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Hi.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Hr122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Hr.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Hx122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Hx.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/I134
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/I.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/KB122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/KB.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/KI122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/KI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/KR122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/KR.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/KX122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/KX.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/LINKFILE51
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/Makefile98
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/NB122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/NB.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/NI122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/NI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/NR122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/NR.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/NX122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/NX.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/PA130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/PA.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/PB130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/PB.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/PI130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/PI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/PX130
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/PX.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/R134
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/R.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/S236
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/S.big228
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/S.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/S.small155
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/S162
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/S1.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/VB126
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/VB.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/VI126
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/VI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/VR126
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/VR.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/VX126
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/VX.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/ZD214
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/ZD.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/ZI122
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/ZI.name1
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/1240
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/1440
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/3440
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/BRACKETS_NOTE58
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Fi26
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Fl26
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/L134
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/L1.map150
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/LH23
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/LH.map871
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Lb34
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Lb.map150
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Makefile62
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/OLD_LH34
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/OLD_LH.map150
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/README47
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Sl126
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/bx34
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ci30
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ff26
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lc58
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lf58
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lh188
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ob30
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rc58
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rf58
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rh179
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/sq34
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/devpost/charlib/~=26
-rw-r--r--usr/src/cmd/lp/filter/postscript/font/makedev.c353
-rw-r--r--usr/src/cmd/lp/filter/postscript/postcomm/postcomm.c717
-rw-r--r--usr/src/cmd/lp/filter/postscript/postcomm/postcomm.h211
-rw-r--r--usr/src/cmd/lp/filter/postscript/postio/Makefile71
-rw-r--r--usr/src/cmd/lp/filter/postscript/postio/README75
-rw-r--r--usr/src/cmd/lp/filter/postscript/postio/ifdef.c967
-rw-r--r--usr/src/cmd/lp/filter/postscript/postio/ifdef.h96
-rw-r--r--usr/src/cmd/lp/filter/postscript/postio/parallel.c386
-rw-r--r--usr/src/cmd/lp/filter/postscript/postio/postio.c1246
-rw-r--r--usr/src/cmd/lp/filter/postscript/postio/postio.h251
-rw-r--r--usr/src/cmd/lp/filter/postscript/postio/slowsend.c161
-rw-r--r--usr/src/cmd/lp/filter/postscript/postprint/Makefile77
-rw-r--r--usr/src/cmd/lp/filter/postscript/postprint/README61
-rw-r--r--usr/src/cmd/lp/filter/postscript/postprint/postprint.c926
-rw-r--r--usr/src/cmd/lp/filter/postscript/postprint/postprint.h78
-rw-r--r--usr/src/cmd/lp/filter/postscript/postreverse/Makefile68
-rw-r--r--usr/src/cmd/lp/filter/postscript/postreverse/README32
-rw-r--r--usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c720
-rw-r--r--usr/src/cmd/lp/filter/postscript/postreverse/postreverse.h83
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/Makefile58
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/README31
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/aps.ps149
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/banner.ps64
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/baseline.ps178
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/color.ps87
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/dpost.ps223
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/draw.ps97
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/fatcourier.ps48
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/forms.ps218
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/postprint.ps437
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/ps.requests36
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/tsol_banner.ps30
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/tsol_separator.ps687
-rw-r--r--usr/src/cmd/lp/filter/postscript/postscript/tsol_trailer.ps29
-rw-r--r--usr/src/cmd/lp/filter/slow.filter115
-rw-r--r--usr/src/cmd/lp/include/access.h69
-rw-r--r--usr/src/cmd/lp/include/class.h74
-rw-r--r--usr/src/cmd/lp/include/filters.h248
-rw-r--r--usr/src/cmd/lp/include/form.h111
-rw-r--r--usr/src/cmd/lp/include/lp.h606
-rw-r--r--usr/src/cmd/lp/include/lp.set.h67
-rw-r--r--usr/src/cmd/lp/include/msgs.h442
-rw-r--r--usr/src/cmd/lp/include/oam.h174
-rw-r--r--usr/src/cmd/lp/include/printers.h215
-rw-r--r--usr/src/cmd/lp/include/requests.h141
-rw-r--r--usr/src/cmd/lp/include/secure.h76
-rw-r--r--usr/src/cmd/lp/include/users.h65
-rw-r--r--usr/src/cmd/lp/lib/access/Makefile67
-rw-r--r--usr/src/cmd/lp/lib/access/allowed.c219
-rw-r--r--usr/src/cmd/lp/lib/access/bang.c238
-rw-r--r--usr/src/cmd/lp/lib/access/change.c220
-rw-r--r--usr/src/cmd/lp/lib/access/dumpaccess.c105
-rw-r--r--usr/src/cmd/lp/lib/access/files.c88
-rw-r--r--usr/src/cmd/lp/lib/access/llib-llpacc58
-rw-r--r--usr/src/cmd/lp/lib/access/loadaccess.c200
-rw-r--r--usr/src/cmd/lp/lib/class/delclass.c89
-rw-r--r--usr/src/cmd/lp/lib/class/freeclass.c61
-rw-r--r--usr/src/cmd/lp/lib/class/getclass.c124
-rw-r--r--usr/src/cmd/lp/lib/class/llib-llpcls44
-rw-r--r--usr/src/cmd/lp/lib/class/putclass.c84
-rw-r--r--usr/src/cmd/lp/lib/filters/Makefile73
-rw-r--r--usr/src/cmd/lp/lib/filters/conv.c494
-rw-r--r--usr/src/cmd/lp/lib/filters/delfilter.c91
-rw-r--r--usr/src/cmd/lp/lib/filters/dumpfilters.c224
-rw-r--r--usr/src/cmd/lp/lib/filters/filtertable.c85
-rw-r--r--usr/src/cmd/lp/lib/filters/freefilter.c134
-rw-r--r--usr/src/cmd/lp/lib/filters/getfilter.c98
-rw-r--r--usr/src/cmd/lp/lib/filters/insfilter.c869
-rw-r--r--usr/src/cmd/lp/lib/filters/llib-llpflt120
-rw-r--r--usr/src/cmd/lp/lib/filters/loadfilters.c271
-rw-r--r--usr/src/cmd/lp/lib/filters/putfilter.c124
-rw-r--r--usr/src/cmd/lp/lib/filters/regex.c164
-rw-r--r--usr/src/cmd/lp/lib/filters/regex.h39
-rw-r--r--usr/src/cmd/lp/lib/filters/search.c54
-rw-r--r--usr/src/cmd/lp/lib/filters/trash.c50
-rw-r--r--usr/src/cmd/lp/lib/forms/Makefile69
-rw-r--r--usr/src/cmd/lp/lib/forms/delform.c114
-rw-r--r--usr/src/cmd/lp/lib/forms/f_head.c92
-rw-r--r--usr/src/cmd/lp/lib/forms/freeform.c64
-rw-r--r--usr/src/cmd/lp/lib/forms/getform.c153
-rw-r--r--usr/src/cmd/lp/lib/forms/llib-llpfrm62
-rw-r--r--usr/src/cmd/lp/lib/forms/putform.c148
-rw-r--r--usr/src/cmd/lp/lib/forms/rdform.c379
-rw-r--r--usr/src/cmd/lp/lib/forms/wrform.c209
-rw-r--r--usr/src/cmd/lp/lib/lp/Makefile106
-rw-r--r--usr/src/cmd/lp/lib/lp/Sys_malloc.c189
-rw-r--r--usr/src/cmd/lp/lib/lp/Syscalls.c425
-rw-r--r--usr/src/cmd/lp/lib/lp/addlist.c92
-rw-r--r--usr/src/cmd/lp/lib/lp/addstring.c74
-rw-r--r--usr/src/cmd/lp/lib/lp/alerts.c513
-rw-r--r--usr/src/cmd/lp/lib/lp/appendlist.c83
-rw-r--r--usr/src/cmd/lp/lib/lp/charset.c69
-rw-r--r--usr/src/cmd/lp/lib/lp/cs_strcmp.c53
-rw-r--r--usr/src/cmd/lp/lib/lp/cs_strncmp.c55
-rw-r--r--usr/src/cmd/lp/lib/lp/dashos.c83
-rw-r--r--usr/src/cmd/lp/lib/lp/dellist.c85
-rw-r--r--usr/src/cmd/lp/lib/lp/dirs.c63
-rw-r--r--usr/src/cmd/lp/lib/lp/duplist.c75
-rw-r--r--usr/src/cmd/lp/lib/lp/files.c332
-rw-r--r--usr/src/cmd/lp/lib/lp/freelist.c56
-rw-r--r--usr/src/cmd/lp/lib/lp/getlist.c209
-rw-r--r--usr/src/cmd/lp/lib/lp/getname.c106
-rw-r--r--usr/src/cmd/lp/lib/lp/getpaths.c161
-rw-r--r--usr/src/cmd/lp/lib/lp/getspooldir.c41
-rw-r--r--usr/src/cmd/lp/lib/lp/isterminfo.c225
-rw-r--r--usr/src/cmd/lp/lib/lp/joinlist.c55
-rw-r--r--usr/src/cmd/lp/lib/lp/lenlist.c50
-rw-r--r--usr/src/cmd/lp/lib/lp/llib-llp173
-rw-r--r--usr/src/cmd/lp/lib/lp/makepath.c113
-rw-r--r--usr/src/cmd/lp/lib/lp/makestr.c108
-rw-r--r--usr/src/cmd/lp/lib/lp/mergelist.c52
-rw-r--r--usr/src/cmd/lp/lib/lp/next.c122
-rw-r--r--usr/src/cmd/lp/lib/lp/printlist.c127
-rw-r--r--usr/src/cmd/lp/lib/lp/sdn.c202
-rw-r--r--usr/src/cmd/lp/lib/lp/searchlist.c111
-rw-r--r--usr/src/cmd/lp/lib/lp/set_charset.c237
-rw-r--r--usr/src/cmd/lp/lib/lp/set_pitch.c210
-rw-r--r--usr/src/cmd/lp/lib/lp/set_size.c428
-rw-r--r--usr/src/cmd/lp/lib/lp/sop.c82
-rw-r--r--usr/src/cmd/lp/lib/lp/sprintlist.c80
-rw-r--r--usr/src/cmd/lp/lib/lp/strip.c58
-rw-r--r--usr/src/cmd/lp/lib/lp/syntax.c172
-rw-r--r--usr/src/cmd/lp/lib/lp/tidbit.c458
-rw-r--r--usr/src/cmd/lp/lib/lp/tx.c151
-rw-r--r--usr/src/cmd/lp/lib/lp/wherelist.c58
-rw-r--r--usr/src/cmd/lp/lib/lp/which.c168
-rw-r--r--usr/src/cmd/lp/lib/msgs/Makefile86
-rw-r--r--usr/src/cmd/lp/lib/msgs/_getmessage.c165
-rw-r--r--usr/src/cmd/lp/lib/msgs/_putmessage.c136
-rw-r--r--usr/src/cmd/lp/lib/msgs/fifo_buffs.c149
-rw-r--r--usr/src/cmd/lp/lib/msgs/getmessage.c60
-rw-r--r--usr/src/cmd/lp/lib/msgs/hslconv.c105
-rw-r--r--usr/src/cmd/lp/lib/msgs/llib-llpmsg116
-rw-r--r--usr/src/cmd/lp/lib/msgs/mclose.c45
-rw-r--r--usr/src/cmd/lp/lib/msgs/mconnect.c204
-rw-r--r--usr/src/cmd/lp/lib/msgs/mcreate.c82
-rw-r--r--usr/src/cmd/lp/lib/msgs/mdestroy.c73
-rw-r--r--usr/src/cmd/lp/lib/msgs/mdisconnect.c141
-rw-r--r--usr/src/cmd/lp/lib/msgs/mgetputm.c186
-rw-r--r--usr/src/cmd/lp/lib/msgs/mlisten.c555
-rw-r--r--usr/src/cmd/lp/lib/msgs/mneeds.c43
-rw-r--r--usr/src/cmd/lp/lib/msgs/mopen.c58
-rw-r--r--usr/src/cmd/lp/lib/msgs/mread.c124
-rw-r--r--usr/src/cmd/lp/lib/msgs/mrecv.c63
-rw-r--r--usr/src/cmd/lp/lib/msgs/msend.c69
-rw-r--r--usr/src/cmd/lp/lib/msgs/msgfmts.c141
-rw-r--r--usr/src/cmd/lp/lib/msgs/mwrite.c209
-rw-r--r--usr/src/cmd/lp/lib/msgs/putmessage.c58
-rw-r--r--usr/src/cmd/lp/lib/msgs/read_fifo.c366
-rw-r--r--usr/src/cmd/lp/lib/msgs/streamio.c172
-rw-r--r--usr/src/cmd/lp/lib/msgs/write_fifo.c91
-rw-r--r--usr/src/cmd/lp/lib/oam/Makefile107
-rw-r--r--usr/src/cmd/lp/lib/oam/agettxt.c61
-rw-r--r--usr/src/cmd/lp/lib/oam/fmtmsg.c248
-rw-r--r--usr/src/cmd/lp/lib/oam/gen-defs63
-rw-r--r--usr/src/cmd/lp/lib/oam/gen-text46
-rw-r--r--usr/src/cmd/lp/lib/oam/llib-llpoam39
-rw-r--r--usr/src/cmd/lp/lib/oam/msg.source981
-rw-r--r--usr/src/cmd/lp/lib/papi/Makefile81
-rw-r--r--usr/src/cmd/lp/lib/papi/job.c1420
-rw-r--r--usr/src/cmd/lp/lib/papi/library.c98
-rw-r--r--usr/src/cmd/lp/lib/papi/lpsched-jobs.c535
-rw-r--r--usr/src/cmd/lp/lib/papi/lpsched-misc.c189
-rw-r--r--usr/src/cmd/lp/lib/papi/lpsched-msgs.c623
-rw-r--r--usr/src/cmd/lp/lib/papi/lpsched-printers.c496
-rw-r--r--usr/src/cmd/lp/lib/papi/mapfile273
-rw-r--r--usr/src/cmd/lp/lib/papi/papi_impl.h148
-rw-r--r--usr/src/cmd/lp/lib/papi/ppd.c164
-rw-r--r--usr/src/cmd/lp/lib/papi/printer.c516
-rw-r--r--usr/src/cmd/lp/lib/papi/service.c303
-rw-r--r--usr/src/cmd/lp/lib/printers/Makefile73
-rw-r--r--usr/src/cmd/lp/lib/printers/chkprinter.c91
-rw-r--r--usr/src/cmd/lp/lib/printers/default.c78
-rw-r--r--usr/src/cmd/lp/lib/printers/delprinter.c156
-rw-r--r--usr/src/cmd/lp/lib/printers/freeprinter.c89
-rw-r--r--usr/src/cmd/lp/lib/printers/getpentry.c170
-rw-r--r--usr/src/cmd/lp/lib/printers/getprinter.c404
-rw-r--r--usr/src/cmd/lp/lib/printers/llib-llpprt99
-rw-r--r--usr/src/cmd/lp/lib/printers/okprinter.c155
-rw-r--r--usr/src/cmd/lp/lib/printers/p_head.c71
-rw-r--r--usr/src/cmd/lp/lib/printers/printwheels.c249
-rw-r--r--usr/src/cmd/lp/lib/printers/putprinter.c794
-rw-r--r--usr/src/cmd/lp/lib/requests/anyrequests.c75
-rw-r--r--usr/src/cmd/lp/lib/requests/freerequest.c81
-rw-r--r--usr/src/cmd/lp/lib/requests/getrequest.c266
-rw-r--r--usr/src/cmd/lp/lib/requests/llib-llpreq59
-rw-r--r--usr/src/cmd/lp/lib/requests/putrequest.c225
-rw-r--r--usr/src/cmd/lp/lib/requests/r_head.c70
-rw-r--r--usr/src/cmd/lp/lib/secure/Makefile64
-rw-r--r--usr/src/cmd/lp/lib/secure/llib-llpsec52
-rw-r--r--usr/src/cmd/lp/lib/secure/secure.c269
-rw-r--r--usr/src/cmd/lp/lib/users/Makefile65
-rw-r--r--usr/src/cmd/lp/lib/users/llib-llpusr59
-rw-r--r--usr/src/cmd/lp/lib/users/loadpri.c254
-rw-r--r--usr/src/cmd/lp/lib/users/storepri.c81
-rw-r--r--usr/src/cmd/lp/lib/users/usermgmt.c148
-rw-r--r--usr/src/cmd/lp/model/Makefile104
-rw-r--r--usr/src/cmd/lp/model/alert.proto81
-rw-r--r--usr/src/cmd/lp/model/drain.output.c100
-rw-r--r--usr/src/cmd/lp/model/lp.cat.c699
-rw-r--r--usr/src/cmd/lp/model/lp.set.c144
-rw-r--r--usr/src/cmd/lp/model/lp.tell.c501
-rw-r--r--usr/src/cmd/lp/model/lp.tsol_separator.c528
-rw-r--r--usr/src/cmd/lp/model/netpr/Makefile113
-rw-r--r--usr/src/cmd/lp/model/netpr/bsd_misc.c278
-rw-r--r--usr/src/cmd/lp/model/netpr/misc.c165
-rw-r--r--usr/src/cmd/lp/model/netpr/net.c377
-rw-r--r--usr/src/cmd/lp/model/netpr/netdebug.h51
-rw-r--r--usr/src/cmd/lp/model/netpr/netpr.c482
-rw-r--r--usr/src/cmd/lp/model/netpr/netpr.h174
-rw-r--r--usr/src/cmd/lp/model/netpr/tcp_misc.c208
-rw-r--r--usr/src/cmd/lp/model/netstandard644
-rw-r--r--usr/src/cmd/lp/model/standard1078
-rw-r--r--usr/src/cmd/lp/model/tsol_netstandard751
-rw-r--r--usr/src/cmd/lp/model/tsol_netstandard_foomatic788
-rw-r--r--usr/src/cmd/lp/model/tsol_standard1162
-rw-r--r--usr/src/cmd/lp/model/tsol_standard_foomatic1190
-rwxr-xr-xusr/src/cmd/lp/model/uri253
-rw-r--r--usr/src/cmd/lvm/metassist/controller/Makefile2
-rw-r--r--usr/src/cmd/lvm/metassist/xml/Makefile2
-rw-r--r--usr/src/cmd/man/src/man.c11
-rw-r--r--usr/src/cmd/mdb/Makefile.common3
-rw-r--r--usr/src/cmd/mdb/Makefile.kmdb.files1
-rw-r--r--usr/src/cmd/mdb/Makefile.libstandctf2
-rw-r--r--usr/src/cmd/mdb/Makefile.mdb1
-rw-r--r--usr/src/cmd/mdb/common/libstandctf/mapfile7
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb.c18
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb.h5
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_cmds.c16
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_ctf.c594
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_ctf.h27
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_help.c18
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_help.h5
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_main.c23
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_modapi.c49
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_modapi.h57
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_module.h2
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_print.c161
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_print.h3
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_proc.c71
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_tab.c29
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_target_impl.h9
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_termio.c2
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_typedef.c738
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_typedef.h (renamed from usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAddPrinterFailedException.java)30
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_whatis.c2
-rw-r--r--usr/src/cmd/mdb/common/modules/conf/mapfile-extern1
-rw-r--r--usr/src/cmd/mdb/common/modules/dtrace/dtrace.c10
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/genunix.c109
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/netstack.c30
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/netstack.h3
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/zone.c67
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/zone.h4
-rw-r--r--usr/src/cmd/mdb/common/modules/libc/libc.c9
-rw-r--r--usr/src/cmd/mdb/common/modules/libumem/libumem.c197
-rw-r--r--usr/src/cmd/mdb/common/modules/libumem/umem.c214
-rw-r--r--usr/src/cmd/mdb/common/modules/mpt_sas/mpt_sas.c6
-rw-r--r--usr/src/cmd/mdb/common/modules/v8/mdb_v8.c4104
-rw-r--r--usr/src/cmd/mdb/common/modules/v8/mdb_v8_cfg.c723
-rw-r--r--usr/src/cmd/mdb/common/modules/v8/v8cfg.h (renamed from usr/src/lib/print/libpapi-common/common/uri.h)65
-rw-r--r--usr/src/cmd/mdb/common/modules/v8/v8dbg.h81
-rw-r--r--usr/src/cmd/mdb/i86pc/modules/unix/unix.c141
-rw-r--r--usr/src/cmd/mdb/intel/amd64/libumem/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/ia32/libpython2.6/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/ia32/libumem/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/ia32/v8/Makefile (renamed from usr/src/cmd/lp/model/Makefile.msg)27
-rw-r--r--usr/src/cmd/mdb/intel/mdb/kvm_isadep.c22
-rw-r--r--usr/src/cmd/mdb/intel/mdb/mdb_amd64util.c56
-rw-r--r--usr/src/cmd/mdb/intel/mdb/mdb_ia32util.c22
-rw-r--r--usr/src/cmd/mdb/intel/mdb/proc_amd64dep.c58
-rw-r--r--usr/src/cmd/mdb/intel/mdb/proc_ia32dep.c22
-rw-r--r--usr/src/cmd/mdb/sparc/v7/libumem/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/libumem/Makefile2
-rw-r--r--usr/src/cmd/mdb/test/README18
-rw-r--r--usr/src/cmd/mdb/test/exit-e/err.cmdbadopt.ksh2
-rw-r--r--usr/src/cmd/mdb/test/exit-e/err.enocmd.ksh2
-rw-r--r--usr/src/cmd/mdb/test/exit-e/tst.output.ksh1
-rw-r--r--usr/src/cmd/mdb/test/exit-e/tst.output.ksh.out1
-rw-r--r--usr/src/cmd/mdb/test/exit-e/tst.simple.ksh1
-rwxr-xr-xusr/src/cmd/mdb/test/mtest.sh235
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badid-leadnum.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badid-leadschar.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badmodel.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-extrabraces.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-neglenarr.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayclose.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-noarraylen.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayopen.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-nobraces.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-noclosebrace.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-nomembers.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-nomemname.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-nomemsemi.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-noopenbrace.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-noquotes.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-repmemname.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-vlaonly.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badstruct-zerolenarr.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.badunion-hasvla.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.extraargs.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.noargs.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.nokeyword.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.nomodel.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.noname.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/err.typeexists.ksh1
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb4
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb.out5
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb4
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb.out6
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.cleanupstruct.ksh22
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb27
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb.out26
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb27
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb.out26
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.dellist.mdb3
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.dellist.mdb.out0
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb1
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb.out0
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.libctype.ksh6
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.libctype.ksh.out4
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.models.ksh11
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.struct.mdb6
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.struct.mdb.out10
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb4
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb.out5
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.structvla.mdb4
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.structvla.mdb.out6
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.union.mdb6
-rw-r--r--usr/src/cmd/mdb/test/typedef/tst.union.mdb.out12
-rw-r--r--usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen6
-rw-r--r--usr/src/cmd/nscd/svc-nscd4
-rw-r--r--usr/src/cmd/passwd/Makefile4
-rw-r--r--usr/src/cmd/passwd/passwd.c10
-rw-r--r--usr/src/cmd/perl/Makefile2
-rw-r--r--usr/src/cmd/perl/contrib/Sun/Solaris/PerlGcc/Makefile.PL9
-rw-r--r--usr/src/cmd/perl/skel/Makefile2
-rw-r--r--usr/src/cmd/print/Makefile106
-rw-r--r--usr/src/cmd/print/Makefile.sp105
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/Makefile110
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/accept.c117
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/cancel.c255
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/common.c678
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/common.h70
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/disable.c163
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/enable.c117
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/in.lpd.c786
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lp.c334
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpc.c561
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpmove.c210
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpq.c134
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpr.c276
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lprm.c101
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpstat.c1444
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/reject.c122
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/rfc1179.xml110
-rw-r--r--usr/src/cmd/print/conv_fix/conv_fix.c149
-rw-r--r--usr/src/cmd/print/lpget/lpget.c174
-rw-r--r--usr/src/cmd/print/lpset/Makefile69
-rw-r--r--usr/src/cmd/print/lpset/lpset.c544
-rw-r--r--usr/src/cmd/print/ppdmgr/Makefile53
-rw-r--r--usr/src/cmd/print/ppdmgr/ppd-cache-update40
-rw-r--r--usr/src/cmd/print/ppdmgr/ppd-cache-update.xml90
-rw-r--r--usr/src/cmd/print/printer-info/printer-info.c196
-rw-r--r--usr/src/cmd/print/printmgr/Makefile87
-rw-r--r--usr/src/cmd/print/printmgr/bin/printmgr.sh38
-rw-r--r--usr/src/cmd/print/printmgr/com/Makefile46
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/Makefile46
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/Makefile46
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/Makefile46
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/BST.java327
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/BSTItem.java109
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/Constants.java75
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/Makefile144
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/help-l10n-comments.txt242
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helpTest.java196
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/extract43
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/parseMain.java811
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/parsehelp.sh83
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/images/appicon.gifbin422 -> 0 bytes
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAboutBox.java117
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAccess.java518
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAddAccessFailedException.java43
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAuthOptions.java423
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmButton.java216
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmButtonScreen.java175
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmCacheMissingPPDException.java43
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmCalls.java158
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDelete.java183
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDialog.java125
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDialogConstraints.java43
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmFindFrame.java221
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmFrame.java133
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmGuiException.java55
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpContent.java52
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpController.java101
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpDetailPanel.java597
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpFrame.java101
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpIndexPanel.java383
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpItem.java92
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpRepository.java294
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpSearchPanel.java451
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmIncompleteFormException.java43
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmInstallPrinter.java2194
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmInstallScreen.java494
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLoad.java275
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLogDisplay.java244
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLogin.java423
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLoginFailedException.java43
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmMessageDialog.java206
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmModifyPrinterFailedException.java40
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmMustBeRemoteServerException.java43
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmNeedPPDCacheException.java44
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmNullSelectedPrinterException.java39
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmOKCancelDialog.java242
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmOther.java232
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmPrinterExistsException.java39
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmResources.java614
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmTextField.java86
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmTop.java1303
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmUserCancelledException.java43
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmUtility.java216
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pm_gen_copyright64
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddAccess.rawhlp97
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddAccessFailed.rawhlp62
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddPrinterFailed.rawhlp68
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/DeletePrinterFailed.rawhlp56
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/HelpOnHelp.rawhlp127
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallLocal.rawhlp171
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallLocalPPD.rawhlp177
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallNetwork.rawhlp176
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallNetworkPPD.rawhlp187
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/LDAPAuthentication.rawhlp132
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/LoginFailed.rawhlp59
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/MainWindow.rawhlp116
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/Modify.rawhlp167
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ModifyFailed.rawhlp62
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ModifyPPD.rawhlp176
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/NISAuthentication.rawhlp97
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/NameService.rawhlp155
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/Overview.rawhlp122
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrintManagerSettings.rawhlp111
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrinterPort.rawhlp67
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrinterType.rawhlp64
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/RemoteServer.rawhlp53
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ShowCommandConsole.rawhlp84
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToAddAccess.rawhlp141
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToConfirmActions.rawhlp66
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToDelete.rawhlp81
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToExit.rawhlp53
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToFindPrinter.rawhlp68
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToInstallLocal.rawhlp176
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToInstallNetwork.rawhlp181
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToModify.rawhlp119
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToSelectName.rawhlp83
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToShowCommand.rawhlp75
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToStart.rawhlp81
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Debug.java314
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterAdd.java552
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterDelete.java197
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterMod.java841
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterNS.c276
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterNS.java626
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterUtil.java557
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterView.java485
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Host.java351
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Makefile126
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/NS.c821
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/NameService.java140
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Printer.java497
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterDebug.java126
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterUtil.java206
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/SysCommand.java245
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Test.java369
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Valid.java395
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmAuthException.java45
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmAuthRhostException.java47
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmCmdFailedException.java45
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmHostNotPingableException.java45
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmInternalErrorException.java47
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmNSNotConfiguredException.java46
-rw-r--r--usr/src/cmd/print/printmgr/com/sun/admin/pm/server/tests/template27
-rw-r--r--usr/src/cmd/print/scripts/Makefile149
-rw-r--r--usr/src/cmd/print/scripts/Makefile.yp58
-rw-r--r--usr/src/cmd/print/scripts/conv_lp102
-rw-r--r--usr/src/cmd/print/scripts/conv_lpd213
-rw-r--r--usr/src/cmd/print/scripts/desktop-print-management-prefs.desktop56
-rw-r--r--usr/src/cmd/print/scripts/desktop-print-management.desktop47
-rw-r--r--usr/src/cmd/print/scripts/getmakes37
-rw-r--r--usr/src/cmd/print/scripts/getppdfile88
-rw-r--r--usr/src/cmd/print/scripts/getppds104
-rw-r--r--usr/src/cmd/print/scripts/lpadmin403
-rw-r--r--usr/src/cmd/print/scripts/manufaliases32
-rw-r--r--usr/src/cmd/print/scripts/ppdfilename2mmp100
-rw-r--r--usr/src/cmd/print/scripts/ppdmgr1765
-rw-r--r--usr/src/cmd/print/scripts/printers.conf31
-rw-r--r--usr/src/cmd/print/selector/Makefile54
-rwxr-xr-xusr/src/cmd/print/selector/desktop-print-management-applet90
-rwxr-xr-xusr/src/cmd/print/selector/print-service298
-rw-r--r--usr/src/cmd/prstat/prsort.c15
-rw-r--r--usr/src/cmd/prstat/prstat.c27
-rw-r--r--usr/src/cmd/prstat/prstat.h2
-rw-r--r--usr/src/cmd/prstat/prutil.c3
-rw-r--r--usr/src/cmd/prtconf/prtconf.c53
-rw-r--r--usr/src/cmd/prtconf/prtconf.h1
-rw-r--r--usr/src/cmd/ps/ucbps.c5
-rw-r--r--usr/src/cmd/psrset/psrset.c64
-rw-r--r--usr/src/cmd/ptools/pargs/pargs.c4
-rw-r--r--usr/src/cmd/ptools/pmap/pmap_common.c5
-rw-r--r--usr/src/cmd/ptools/ptime/ptime.c111
-rw-r--r--usr/src/cmd/rcap/common/utils.c75
-rw-r--r--usr/src/cmd/rcap/common/utils.h2
-rw-r--r--usr/src/cmd/rcap/rcapadm/rcapadm.c16
-rw-r--r--usr/src/cmd/rcap/rcapd/rcapd_collection_zone.c141
-rw-r--r--usr/src/cmd/rcap/rcapd/rcapd_scanner.c3
-rw-r--r--usr/src/cmd/rcap/rcapstat/rcapstat.c7
-rw-r--r--usr/src/cmd/rcm_daemon/Makefile.com4
-rw-r--r--usr/src/cmd/refer/Makefile2
-rw-r--r--usr/src/cmd/savecore/savecore.c17
-rw-r--r--usr/src/cmd/sed/main.c27
-rw-r--r--usr/src/cmd/sgs/elfdump/Makefile.targ2
-rw-r--r--usr/src/cmd/sgs/elfdump/amd64/Makefile2
-rw-r--r--usr/src/cmd/sgs/elfdump/i386/Makefile2
-rw-r--r--usr/src/cmd/sgs/lex/common/main.c48
-rw-r--r--usr/src/cmd/sgs/lex/common/once.h12
-rw-r--r--usr/src/cmd/sgs/libld/common/map_support.c49
-rw-r--r--usr/src/cmd/sgs/lorder/lorder.sh2
-rw-r--r--usr/src/cmd/sgs/rtld/amd64/amd64_elf.c4
-rw-r--r--usr/src/cmd/sgs/rtld/common/audit.c32
-rw-r--r--usr/src/cmd/sgs/rtld/common/dlfcns.c4
-rw-r--r--usr/src/cmd/sgs/rtld/i386/i386_elf.c4
-rw-r--r--usr/src/cmd/sgs/rtld/sparc/sparc_elf.c4
-rw-r--r--usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c4
-rw-r--r--usr/src/cmd/sgs/yacc/common/dextern.h19
-rw-r--r--usr/src/cmd/sgs/yacc/common/y1.c36
-rw-r--r--usr/src/cmd/sgs/yacc/common/y2.c7
-rw-r--r--usr/src/cmd/ssh/Makefile2
-rw-r--r--usr/src/cmd/ssh/include/key.h15
-rw-r--r--usr/src/cmd/ssh/include/servconf.h1
-rw-r--r--usr/src/cmd/ssh/libssh/common/canohost.c35
-rw-r--r--usr/src/cmd/ssh/libssh/common/key.c17
-rw-r--r--usr/src/cmd/ssh/ssh-keygen/ssh-keygen.c277
-rw-r--r--usr/src/cmd/ssh/sshd/auth2-pubkey.c109
-rw-r--r--usr/src/cmd/ssh/sshd/servconf.c9
-rw-r--r--usr/src/cmd/ssh/sshd/sshlogin.c3
-rw-r--r--usr/src/cmd/stat/Makefile11
-rw-r--r--usr/src/cmd/stat/arcstat/Makefile41
-rw-r--r--usr/src/cmd/stat/arcstat/arcstat.pl332
-rw-r--r--usr/src/cmd/stat/vfsstat/Makefile41
-rw-r--r--usr/src/cmd/stat/vfsstat/vfsstat.pl226
-rw-r--r--usr/src/cmd/stat/ziostat/Makefile41
-rwxr-xr-xusr/src/cmd/stat/ziostat/ziostat.pl204
-rw-r--r--usr/src/cmd/svc/configd/Makefile3
-rw-r--r--usr/src/cmd/svc/configd/rc_node.c23
-rw-r--r--usr/src/cmd/svc/milestone/net-routing-setup10
-rw-r--r--usr/src/cmd/svc/milestone/network-location.xml2
-rw-r--r--usr/src/cmd/svc/milestone/single-user.xml2
-rw-r--r--usr/src/cmd/svc/shell/smf_include.sh6
-rw-r--r--usr/src/cmd/svc/startd/fork.c11
-rw-r--r--usr/src/cmd/svc/startd/graph.c26
-rw-r--r--usr/src/cmd/svc/startd/method.c132
-rw-r--r--usr/src/cmd/svc/startd/restarter.c61
-rw-r--r--usr/src/cmd/svc/startd/startd.c130
-rw-r--r--usr/src/cmd/svc/startd/startd.h15
-rw-r--r--usr/src/cmd/svc/startd/utmpx.c21
-rw-r--r--usr/src/cmd/svc/startd/wait.c10
-rw-r--r--usr/src/cmd/svc/svcadm/Makefile7
-rw-r--r--usr/src/cmd/svc/svccfg/Makefile3
-rw-r--r--usr/src/cmd/svc/svccfg/svccfg_libscf.c267
-rw-r--r--usr/src/cmd/svc/svcs/svcs.c53
-rw-r--r--usr/src/cmd/tail/extern.h5
-rw-r--r--usr/src/cmd/tail/forward.c103
-rw-r--r--usr/src/cmd/tail/tests/tailtests.sh338
-rw-r--r--usr/src/cmd/truss/print.c13
-rw-r--r--usr/src/cmd/vi/port/Makefile3
-rw-r--r--usr/src/cmd/vi/port/ex_cmdsub.c2
-rw-r--r--usr/src/cmd/yes/yes.c27
-rw-r--r--usr/src/cmd/zfs/zfs_main.c164
-rw-r--r--usr/src/cmd/zic/africa36
-rw-r--r--usr/src/cmd/zic/antarctica21
-rw-r--r--usr/src/cmd/zic/asia72
-rw-r--r--usr/src/cmd/zic/australasia44
-rw-r--r--usr/src/cmd/zic/backward3
-rw-r--r--usr/src/cmd/zic/europe41
-rw-r--r--usr/src/cmd/zic/northamerica153
-rw-r--r--usr/src/cmd/zic/southamerica55
-rw-r--r--usr/src/cmd/zic/zone.tab.txt22
-rw-r--r--usr/src/cmd/zic/zone_sun.tab5
-rw-r--r--usr/src/cmd/zoneadm/Makefile10
-rw-r--r--usr/src/cmd/zoneadm/zfs.c40
-rw-r--r--usr/src/cmd/zoneadm/zoneadm.c176
-rw-r--r--usr/src/cmd/zoneadm/zones.xml12
-rw-r--r--usr/src/cmd/zoneadmd/Makefile48
-rw-r--r--usr/src/cmd/zoneadmd/Makefile.com68
-rw-r--r--usr/src/cmd/zoneadmd/amd64/Makefile31
-rw-r--r--usr/src/cmd/zoneadmd/i386/Makefile (renamed from usr/src/cmd/lp/filter/postscript/dpost/ps_include.awk)19
-rw-r--r--usr/src/cmd/zoneadmd/mcap.c1090
-rw-r--r--usr/src/cmd/zoneadmd/vplat.c438
-rw-r--r--usr/src/cmd/zoneadmd/zcons.c25
-rw-r--r--usr/src/cmd/zoneadmd/zoneadmd.c478
-rw-r--r--usr/src/cmd/zoneadmd/zoneadmd.h15
-rw-r--r--usr/src/cmd/zonecfg/Makefile2
-rw-r--r--usr/src/cmd/zonecfg/zonecfg.c640
-rw-r--r--usr/src/cmd/zonecfg/zonecfg.h13
-rw-r--r--usr/src/cmd/zonecfg/zonecfg_grammar.y28
-rw-r--r--usr/src/cmd/zonecfg/zonecfg_lex.l29
-rw-r--r--usr/src/cmd/zonestat/zonestatd/Makefile5
-rw-r--r--usr/src/cmd/zonestat/zonestatd/zonestatd.c11
-rw-r--r--usr/src/cmd/zpool/zpool_main.c34
-rw-r--r--usr/src/common/ctf/ctf_create.c187
-rw-r--r--usr/src/common/ctf/ctf_error.c7
-rw-r--r--usr/src/common/ctf/ctf_impl.h10
-rw-r--r--usr/src/common/ctf/ctf_open.c13
-rw-r--r--usr/src/common/util/strtolctype.h4
-rw-r--r--usr/src/common/zfs/zfeature_common.c4
-rw-r--r--usr/src/common/zfs/zfeature_common.h2
-rw-r--r--usr/src/common/zfs/zfs_prop.c19
-rw-r--r--usr/src/common/zfs/zfs_prop.h2
-rw-r--r--usr/src/grub/Makefile6
-rw-r--r--usr/src/grub/Makefile.grub1
-rw-r--r--usr/src/grub/grub-0.97/stage2/Makefile.solaris54
-rw-r--r--usr/src/grub/grub-0.97/stage2/asm.S3
-rw-r--r--usr/src/grub/grub-0.97/stage2/boot.c13
-rw-r--r--usr/src/grub/grub-0.97/stage2/builtins.c481
-rw-r--r--usr/src/grub/grub-0.97/stage2/char_io.c22
-rw-r--r--usr/src/grub/grub-0.97/stage2/cmdline.c23
-rw-r--r--usr/src/grub/grub-0.97/stage2/common.c3
-rw-r--r--usr/src/grub/grub-0.97/stage2/cpu.h7
-rw-r--r--usr/src/grub/grub-0.97/stage2/expand.c465
-rw-r--r--usr/src/grub/grub-0.97/stage2/expand.h31
-rw-r--r--usr/src/grub/grub-0.97/stage2/serial.c71
-rw-r--r--usr/src/grub/grub-0.97/stage2/shared.h4
-rw-r--r--usr/src/grub/grub-0.97/stage2/stage2.c45
-rw-r--r--usr/src/grub/grub-0.97/stage2/term.h8
-rw-r--r--usr/src/head/Makefile2
-rw-r--r--usr/src/head/libzonecfg.h47
-rw-r--r--usr/src/head/resolv_joy.h472
-rw-r--r--usr/src/head/unistd.h3
-rw-r--r--usr/src/head/zdoor.h74
-rw-r--r--usr/src/head/zone.h3
-rw-r--r--usr/src/lib/Makefile35
-rw-r--r--usr/src/lib/Makefile.astmsg4
-rw-r--r--usr/src/lib/brand/Makefile2
-rw-r--r--usr/src/lib/brand/sngl/Makefile51
-rw-r--r--usr/src/lib/brand/sngl/Makefile.sngl (renamed from usr/src/pkg/manifests/SUNWlp-cmds.mf)10
-rw-r--r--usr/src/lib/brand/sngl/sngl_brand/Makefile (renamed from usr/src/cmd/lp/crontab/Makefile)29
-rw-r--r--usr/src/lib/brand/sngl/sngl_brand/Makefile.com76
-rw-r--r--usr/src/lib/brand/sngl/sngl_brand/amd64/Makefile48
-rw-r--r--usr/src/lib/brand/sngl/sngl_brand/common/mapfile-vers (renamed from usr/src/lib/print/mod_ipp/mapfile)12
-rw-r--r--usr/src/lib/brand/sngl/sngl_brand/common/sngl_brand.c429
-rw-r--r--usr/src/lib/brand/sngl/sngl_brand/i386/Makefile46
-rw-r--r--usr/src/lib/brand/sngl/zone/Makefile (renamed from usr/src/cmd/print/lpget/Makefile)53
-rw-r--r--usr/src/lib/brand/sngl/zone/config.xml111
-rw-r--r--usr/src/lib/brand/sngl/zone/platform.xml160
-rw-r--r--usr/src/lib/brand/sngl/zone/sinstall.sh118
-rw-r--r--usr/src/lib/efcode/interpreter/Makefile3
-rw-r--r--usr/src/lib/fm/libldom/Makefile.com2
-rw-r--r--usr/src/lib/fm/topo/libtopo/Makefile.com2
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/libtopo.h2
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/mapfile-vers1
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_hc.h5
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_node.c52
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_xml.c24
-rwxr-xr-xusr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xmlgenksh95
-rw-r--r--usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Makefile (renamed from usr/src/cmd/print/printer-info/Makefile)53
-rw-r--r--usr/src/lib/fm/topo/maps/Makefile3
-rw-r--r--usr/src/lib/fm/topo/maps/Makefile.map9
-rw-r--r--usr/src/lib/fm/topo/maps/common/xmlgen-header-new.xml2
-rw-r--r--usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml13
-rw-r--r--usr/src/lib/fm/topo/modules/common/Makefile2
-rw-r--r--usr/src/lib/fm/topo/modules/common/disk/Makefile5
-rw-r--r--usr/src/lib/fm/topo/modules/common/disk/disk.c47
-rw-r--r--usr/src/lib/fm/topo/modules/common/disk/disk.h12
-rw-r--r--usr/src/lib/fm/topo/modules/common/disk/disk_drivers.h31
-rw-r--r--usr/src/lib/fm/topo/modules/common/disk/disk_mptsas.c120
-rw-r--r--usr/src/lib/fm/topo/modules/common/fac_prov_mptsas/Makefile (renamed from usr/src/cmd/print/scripts/desktop-print-management-applet)16
-rw-r--r--usr/src/lib/fm/topo/modules/common/fac_prov_mptsas/fac_prov_mptsas.c244
-rw-r--r--usr/src/lib/libbe/common/be_list.c3
-rw-r--r--usr/src/lib/libbrand/Makefile.com2
-rw-r--r--usr/src/lib/libbrand/common/libbrand.c25
-rw-r--r--usr/src/lib/libbrand/common/libbrand.h2
-rw-r--r--usr/src/lib/libbrand/common/mapfile-vers2
-rw-r--r--usr/src/lib/libbrand/dtd/brand.dtd.118
-rw-r--r--usr/src/lib/libbsm/common/adt.c102
-rw-r--r--usr/src/lib/libc/amd64/Makefile2
-rw-r--r--usr/src/lib/libc/i386/Makefile.com2
-rw-r--r--usr/src/lib/libc/inc/thr_inlines.h12
-rw-r--r--usr/src/lib/libc/inc/thr_uberdata.h28
-rw-r--r--usr/src/lib/libc/port/gen/getlogin.c79
-rw-r--r--usr/src/lib/libc/port/mapfile-vers5
-rw-r--r--usr/src/lib/libc/port/sys/zone.c5
-rw-r--r--usr/src/lib/libc/port/threads/thr.c4
-rw-r--r--usr/src/lib/libc/port/threads/tmem.c85
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com2
-rw-r--r--usr/src/lib/libc/sparc/crt/_rtld.c9
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com2
-rw-r--r--usr/src/lib/libctf/common/mapfile-vers1
-rw-r--r--usr/src/lib/libdiskmgt/common/disks_private.h1
-rw-r--r--usr/src/lib/libdiskmgt/common/drive.c36
-rw-r--r--usr/src/lib/libdiskmgt/common/findevs.c1
-rw-r--r--usr/src/lib/libdiskmgt/common/libdiskmgt.h181
-rw-r--r--usr/src/lib/libdladm/common/libdladm.h6
-rw-r--r--usr/src/lib/libdladm/common/libdllink.c28
-rw-r--r--usr/src/lib/libdladm/common/libdllink.h6
-rw-r--r--usr/src/lib/libdladm/common/libdlmgmt.c19
-rw-r--r--usr/src/lib/libdladm/common/libdlvnic.c29
-rw-r--r--usr/src/lib/libdladm/common/linkprop.c70
-rw-r--r--usr/src/lib/libdladm/common/mapfile-vers2
-rw-r--r--usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDRecordRegistrar.java20
-rw-r--r--usr/src/lib/libdtrace/Makefile.com2
-rw-r--r--usr/src/lib/libdtrace/common/dt_cc.c11
-rw-r--r--usr/src/lib/libdtrace/common/dt_cg.c2
-rw-r--r--usr/src/lib/libdtrace/common/dt_dof.c22
-rw-r--r--usr/src/lib/libdtrace/common/dt_error.c4
-rw-r--r--usr/src/lib/libdtrace/common/dt_impl.h6
-rw-r--r--usr/src/lib/libdtrace/common/dt_open.c18
-rw-r--r--usr/src/lib/libdtrace/common/dt_options.c74
-rw-r--r--usr/src/lib/libdtrace/common/dt_program.c9
-rw-r--r--usr/src/lib/libdtrace/common/dt_work.c32
-rw-r--r--usr/src/lib/libdtrace/common/dtrace.h1
-rw-r--r--usr/src/lib/libdtrace/common/io.d.in8
-rw-r--r--usr/src/lib/libgrubmgmt/common/libgrub_fs.c5
-rw-r--r--usr/src/lib/libipd/Makefile42
-rw-r--r--usr/src/lib/libipd/Makefile.com36
-rw-r--r--usr/src/lib/libipd/amd64/Makefile19
-rw-r--r--usr/src/lib/libipd/common/libipd.c303
-rw-r--r--usr/src/lib/libipd/common/libipd.h74
-rw-r--r--usr/src/lib/libipd/common/llib-lipd20
-rw-r--r--usr/src/lib/libipd/common/mapfile-vers46
-rw-r--r--usr/src/lib/libipd/i386/Makefile18
-rw-r--r--usr/src/lib/libkmf/ber_der/Makefile.com6
-rw-r--r--usr/src/lib/libkmf/libkmf/Makefile.com3
-rw-r--r--usr/src/lib/libkmf/plugins/kmf_nss/Makefile.com10
-rw-r--r--usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com2
-rw-r--r--usr/src/lib/libkmf/plugins/kmf_pkcs11/Makefile.com3
-rw-r--r--usr/src/lib/libldap5/Makefile.com2
-rw-r--r--usr/src/lib/libldap5/amd64/Makefile2
-rw-r--r--usr/src/lib/libldap5/i386/Makefile2
-rw-r--r--usr/src/lib/libldap5/sparc/Makefile2
-rw-r--r--usr/src/lib/libldap5/sparcv9/Makefile2
-rw-r--r--usr/src/lib/libnisdb/db_mindex3.cc4
-rw-r--r--usr/src/lib/libnisdb/db_table.cc4
-rw-r--r--usr/src/lib/libnisdb/nis_db.cc8
-rw-r--r--usr/src/lib/libnvpair/Makefile.com11
-rw-r--r--usr/src/lib/libnvpair/libnvpair.h2
-rw-r--r--usr/src/lib/libnvpair/mapfile-vers2
-rw-r--r--usr/src/lib/libnvpair/nvpair_json.c400
-rw-r--r--usr/src/lib/libpool/Makefile.com3
-rw-r--r--usr/src/lib/libproc/common/Pzone.c10
-rw-r--r--usr/src/lib/libproject/common/setproject.c20
-rw-r--r--usr/src/lib/libresolv2_joy/Makefile76
-rw-r--r--usr/src/lib/libresolv2_joy/Makefile.com162
-rw-r--r--usr/src/lib/libresolv2_joy/THIRDPARTYLICENSE185
-rw-r--r--usr/src/lib/libresolv2_joy/THIRDPARTYLICENSE.descrip1
-rw-r--r--usr/src/lib/libresolv2_joy/amd64/Makefile (renamed from usr/src/lib/print/libipp-core/i386/Makefile)3
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/daemon.c81
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/ftruncate.c64
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/gettimeofday.c62
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/mktemp.c156
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/putenv.c27
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/readv.c39
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/setenv.c151
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/setitimer.c29
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/strcasecmp.c124
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/strdup.c20
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/strerror.c94
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/strpbrk.c70
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/strsep.c88
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/strtoul.c119
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/utimes.c40
-rw-r--r--usr/src/lib/libresolv2_joy/common/bsd/writev.c89
-rw-r--r--usr/src/lib/libresolv2_joy/common/dst/dst_api.c1048
-rw-r--r--usr/src/lib/libresolv2_joy/common/dst/dst_internal.h155
-rw-r--r--usr/src/lib/libresolv2_joy/common/dst/hmac_link.c491
-rw-r--r--usr/src/lib/libresolv2_joy/common/dst/support.c342
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_cidr_ntop.c263
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_cidr_pton.c277
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_data.c46
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_lnaof.c65
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_makeaddr.c68
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_net_ntop.c279
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_net_pton.c407
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_neta.c89
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_netof.c64
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/inet_network.c106
-rw-r--r--usr/src/lib/libresolv2_joy/common/inet/nsap_addr.c111
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/dns.c154
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/dns_ho.c1143
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/dns_nw.c591
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/dns_p.h52
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/dns_pr.c268
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/dns_sv.c300
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gai_strerror.c105
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gen.c459
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gen_ho.c391
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gen_ng.c174
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gen_nw.c264
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gen_p.h113
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gen_pr.c228
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gen_sv.c229
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getaddrinfo.c1253
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gethostent.c1096
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/gethostent_r.c278
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getnameinfo.c334
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getnetent.c345
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getnetent_r.c234
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getnetgrent.c160
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getnetgrent_r.c219
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getprotoent.c176
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getprotoent_r.c223
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getservent.c179
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/getservent_r.c242
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/hesiod.c505
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/hesiod_p.h48
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irp.c583
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irp_ho.c405
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irp_ng.c253
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irp_nw.c348
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irp_p.h60
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irp_pr.c327
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irp_sv.c346
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irpmarshall.c2301
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irs_data.c254
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irs_data.h63
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/irs_p.h51
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/lcl.c142
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/lcl_ho.c578
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/lcl_ng.c446
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/lcl_nw.c373
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/lcl_p.h51
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/lcl_pr.c294
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/lcl_sv.c432
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/nis.c156
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/nis_p.h47
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/nul_ng.c127
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/pathnames.h52
-rw-r--r--usr/src/lib/libresolv2_joy/common/irs/util.c109
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/assertions.c94
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/base64.c333
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/bitncmp.c68
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ctl_clnt.c620
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ctl_p.c188
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ctl_p.h28
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ctl_srvr.c787
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ev_connects.c369
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ev_files.c277
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ev_streams.c308
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ev_timers.c499
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/ev_waits.c247
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/eventlib.c933
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/eventlib_p.h281
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/heap.c236
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/hex.c119
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/logging.c716
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/logging_p.h61
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/memcluster.c588
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/movefile.c43
-rw-r--r--usr/src/lib/libresolv2_joy/common/isc/tree.c534
-rw-r--r--usr/src/lib/libresolv2_joy/common/llib-lresolv_joy59
-rw-r--r--usr/src/lib/libresolv2_joy/common/mapfile-vers (renamed from usr/src/lib/print/libhttp-core/common/mapfile)49
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_date.c129
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_name.c1153
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_netint.c61
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_newmsg.c273
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_parse.c275
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_print.c1242
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_rdata.c300
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_samedomain.c207
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_sign.c387
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_ttl.c162
-rw-r--r--usr/src/lib/libresolv2_joy/common/nameser/ns_verify.c484
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/herror.c129
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/mtctxres.c135
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_comp.c287
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_data.c322
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_debug.c1252
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_debug.h35
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_findzonecut.c722
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_init.c958
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_mkquery.c386
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_mkupdate.c1163
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_mkupdate.h25
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_private.h22
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_query.c440
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_send.c1120
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_sendsigned.c170
-rw-r--r--usr/src/lib/libresolv2_joy/common/resolv/res_update.c213
-rw-r--r--usr/src/lib/libresolv2_joy/common/sunw/sunw_mtctxres.c126
-rw-r--r--usr/src/lib/libresolv2_joy/common/sunw/sunw_updrec.c249
-rw-r--r--usr/src/lib/libresolv2_joy/common/sunw/sunw_wrappers.c23
-rw-r--r--usr/src/lib/libresolv2_joy/i386/Makefile (renamed from usr/src/lib/print/libhttp-core/i386/Makefile)2
-rw-r--r--usr/src/lib/libresolv2_joy/include/Makefile (renamed from usr/src/cmd/lp/lib/Makefile)46
-rw-r--r--usr/src/lib/libresolv2_joy/include/arpa/port_inet.h41
-rw-r--r--usr/src/lib/libresolv2_joy/include/arpa/port_nameser.h40
-rw-r--r--usr/src/lib/libresolv2_joy/include/conf/sunoptions.h30
-rw-r--r--usr/src/lib/libresolv2_joy/include/config.h75
-rw-r--r--usr/src/lib/libresolv2_joy/include/err.h62
-rw-r--r--usr/src/lib/libresolv2_joy/include/fd_setsize.h10
-rw-r--r--usr/src/lib/libresolv2_joy/include/hesiod.h39
-rw-r--r--usr/src/lib/libresolv2_joy/include/irp.h107
-rw-r--r--usr/src/lib/libresolv2_joy/include/irs.h348
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/assertions.h123
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/ctl.h112
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/dst.h168
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/eventlib.h206
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/heap.h49
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/irpmarshall.h112
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/list.h118
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/logging.h113
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/memcluster.h50
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/misc.h44
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/platform.h42
-rw-r--r--usr/src/lib/libresolv2_joy/include/isc/tree.h59
-rwxr-xr-xusr/src/lib/libresolv2_joy/include/make_os_version34
-rw-r--r--usr/src/lib/libresolv2_joy/include/make_os_version.sh34
-rw-r--r--usr/src/lib/libresolv2_joy/include/port_after.h539
-rw-r--r--usr/src/lib/libresolv2_joy/include/port_before.h201
-rw-r--r--usr/src/lib/libresolv2_joy/include/port_netdb.h188
-rw-r--r--usr/src/lib/libresolv2_joy/include/port_resolv.h42
-rwxr-xr-xusr/src/lib/libresolv2_joy/include/probe_ipv673
-rw-r--r--usr/src/lib/libresolv2_joy/include/probe_ipv6.sh73
-rw-r--r--usr/src/lib/libresolv2_joy/include/res_update.h88
-rw-r--r--usr/src/lib/libresolv2_joy/include/resolv_mt.h47
-rw-r--r--usr/src/lib/libresolv2_joy/include/sunw_port_after.h123
-rw-r--r--usr/src/lib/libresolv2_joy/include/sunw_port_before.h43
-rw-r--r--usr/src/lib/libresolv2_joy/include/sys/bitypes.h37
-rw-r--r--usr/src/lib/libresolv2_joy/include/sys/cdefs.h144
-rw-r--r--usr/src/lib/libresolv2_joy/sparc/Makefile (renamed from usr/src/lib/print/libipp-core/sparc/Makefile)2
-rw-r--r--usr/src/lib/libresolv2_joy/sparcv9/Makefile38
-rw-r--r--usr/src/lib/libscf/inc/libscf.h6
-rw-r--r--usr/src/lib/libshare/Makefile.com2
-rw-r--r--usr/src/lib/libshare/autofs/Makefile.com2
-rw-r--r--usr/src/lib/libshare/nfs/Makefile.com2
-rw-r--r--usr/src/lib/libshare/nfs/libshare_nfs.c14
-rw-r--r--usr/src/lib/libshare/smb/Makefile.com1
-rw-r--r--usr/src/lib/libshare/smbfs/Makefile.com2
-rw-r--r--usr/src/lib/libshell/Makefile1
-rw-r--r--usr/src/lib/libshell/Makefile.doc91
-rw-r--r--usr/src/lib/libshell/common/COMPATIBILITY134
-rw-r--r--usr/src/lib/libshell/common/DESIGN170
-rw-r--r--usr/src/lib/libshell/common/OBSOLETE152
-rw-r--r--usr/src/lib/libshell/common/README232
-rw-r--r--usr/src/lib/libshell/common/RELEASE2204
-rw-r--r--usr/src/lib/libshell/common/TYPES182
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/1.pngbin236 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/10.pngbin284 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/2.pngbin261 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/3.pngbin265 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/4.pngbin260 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/5.pngbin261 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/6.pngbin278 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/7.pngbin253 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/8.pngbin275 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/callouts/9.pngbin284 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/tag_bourne.pngbin130 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/tag_i18n.pngbin124 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/tag_ksh.pngbin122 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/tag_ksh88.pngbin124 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/tag_ksh93.pngbin140 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/tag_l10n.pngbin118 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/images/tag_perf.pngbin127 -> 0 bytes
-rw-r--r--usr/src/lib/libshell/misc/shell_styleguide.docbook1464
-rw-r--r--usr/src/lib/libsldap/Makefile.com2
-rw-r--r--usr/src/lib/libsmartsshd/Makefile48
-rw-r--r--usr/src/lib/libsmartsshd/Makefile.com (renamed from usr/src/cmd/print/printmgr/bin/Makefile)36
-rw-r--r--usr/src/lib/libsmartsshd/amd64/Makefile (renamed from usr/src/cmd/lp/Makefile.lp.msg)13
-rw-r--r--usr/src/lib/libsmartsshd/common/llib-lsmartsshd (renamed from usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpException.java)16
-rw-r--r--usr/src/lib/libsmartsshd/common/mapfile-vers (renamed from usr/src/lib/print/libipp-listener/common/mapfile)19
-rw-r--r--usr/src/lib/libsmartsshd/common/sshd-plugin.c123
-rw-r--r--usr/src/lib/libsmartsshd/i386/Makefile (renamed from usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmtest)9
-rw-r--r--usr/src/lib/libumem/Makefile.com10
-rw-r--r--usr/src/lib/libumem/amd64/umem_genasm.c609
-rw-r--r--usr/src/lib/libumem/common/envvar.c9
-rw-r--r--usr/src/lib/libumem/common/mapfile-vers5
-rw-r--r--usr/src/lib/libumem/common/stub_stand.c29
-rw-r--r--usr/src/lib/libumem/common/umem.c302
-rw-r--r--usr/src/lib/libumem/common/umem_base.h14
-rw-r--r--usr/src/lib/libumem/common/umem_impl.h16
-rw-r--r--usr/src/lib/libumem/i386/umem_genasm.c603
-rw-r--r--usr/src/lib/libumem/sparc/umem_genasm.c (renamed from usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmException.java)30
-rw-r--r--usr/src/lib/libumem_trampoline/Makefile (renamed from usr/src/lib/print/libprint/Makefile)32
-rw-r--r--usr/src/lib/libumem_trampoline/Makefile.com (renamed from usr/src/cmd/print/scripts/desktop-print-management-applet.desktop)38
-rw-r--r--usr/src/lib/libumem_trampoline/amd64/Makefile (renamed from usr/src/lib/print/libhttp-core/sparc/Makefile)7
-rw-r--r--usr/src/lib/libumem_trampoline/common/llib-lumem_trampoline (renamed from usr/src/cmd/lp/lib/lp/lp_errno.c)10
-rw-r--r--usr/src/lib/libumem_trampoline/common/mapfile-vers62
-rw-r--r--usr/src/lib/libumem_trampoline/common/trampoline.c166
-rw-r--r--usr/src/lib/libumem_trampoline/i386/Makefile29
-rw-r--r--usr/src/lib/libumem_trampoline/sparc/Makefile29
-rw-r--r--usr/src/lib/libumem_trampoline/sparcv9/Makefile29
-rw-r--r--usr/src/lib/libvrrpadm/common/libvrrpadm.c23
-rw-r--r--usr/src/lib/libzdoor/Makefile48
-rw-r--r--usr/src/lib/libzdoor/Makefile.com (renamed from usr/src/lib/print/libpapi-common/Makefile.com)36
-rw-r--r--usr/src/lib/libzdoor/amd64/Makefile (renamed from usr/src/cmd/lp/filter/postscript/filtdesc/README)12
-rw-r--r--usr/src/lib/libzdoor/common/llib-lzdoor (renamed from usr/src/cmd/lp/lib/oam/buffers.c)22
-rw-r--r--usr/src/lib/libzdoor/common/mapfile-vers (renamed from usr/src/lib/print/libipp-core/common/mapfile)28
-rw-r--r--usr/src/lib/libzdoor/common/zdoor-int.c324
-rw-r--r--usr/src/lib/libzdoor/common/zdoor-int.h (renamed from usr/src/lib/print/libprint/common/list.h)40
-rw-r--r--usr/src/lib/libzdoor/common/zdoor.c437
-rw-r--r--usr/src/lib/libzdoor/common/zerror.c117
-rw-r--r--usr/src/lib/libzdoor/common/zerror.h (renamed from usr/src/cmd/lp/lib/papi/lpsched-service.c)33
-rw-r--r--usr/src/lib/libzdoor/common/ztree.c344
-rw-r--r--usr/src/lib/libzdoor/common/ztree.h88
-rw-r--r--usr/src/lib/libzdoor/i386/Makefile31
-rw-r--r--usr/src/lib/libzfs/common/libzfs.h4
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c25
-rw-r--r--usr/src/lib/libzfs/common/libzfs_impl.h3
-rw-r--r--usr/src/lib/libzfs/common/libzfs_iter.c16
-rw-r--r--usr/src/lib/libzfs/common/libzfs_pool.c32
-rw-r--r--usr/src/lib/libzfs/common/libzfs_util.c42
-rw-r--r--usr/src/lib/libzfs/common/mapfile-vers3
-rw-r--r--usr/src/lib/libzonecfg/Makefile.com1
-rw-r--r--usr/src/lib/libzonecfg/common/getzoneent.c14
-rw-r--r--usr/src/lib/libzonecfg/common/libzonecfg.c646
-rw-r--r--usr/src/lib/libzonecfg/common/mapfile-vers13
-rw-r--r--usr/src/lib/libzonecfg/dtd/zonecfg.dtd.115
-rw-r--r--usr/src/lib/lvm/libsvm/Makefile.com2
-rw-r--r--usr/src/lib/nsswitch/dns/Makefile.com4
-rw-r--r--usr/src/lib/nsswitch/dns/common/dns_common.c215
-rw-r--r--usr/src/lib/nsswitch/dns/common/dns_common.h4
-rw-r--r--usr/src/lib/nsswitch/dns/common/dns_mt.c155
-rw-r--r--usr/src/lib/nsswitch/dns/common/gethostent.c8
-rw-r--r--usr/src/lib/nsswitch/dns/common/gethostent6.c4
-rw-r--r--usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com4
-rw-r--r--usr/src/lib/policykit/Makefile.policykit7
-rw-r--r--usr/src/lib/print/Makefile94
-rw-r--r--usr/src/lib/print/libhttp-core/Makefile56
-rw-r--r--usr/src/lib/print/libhttp-core/Makefile.com63
-rw-r--r--usr/src/lib/print/libhttp-core/common/LICENSE.txt964
-rw-r--r--usr/src/lib/print/libhttp-core/common/LICENSE.txt.descrip1
-rw-r--r--usr/src/lib/print/libhttp-core/common/debug.h70
-rw-r--r--usr/src/lib/print/libhttp-core/common/http-addr.c371
-rw-r--r--usr/src/lib/print/libhttp-core/common/http-private.h115
-rw-r--r--usr/src/lib/print/libhttp-core/common/http-support.c379
-rw-r--r--usr/src/lib/print/libhttp-core/common/http.c2569
-rw-r--r--usr/src/lib/print/libhttp-core/common/http.h439
-rw-r--r--usr/src/lib/print/libipp-core/Makefile56
-rw-r--r--usr/src/lib/print/libipp-core/Makefile.com59
-rw-r--r--usr/src/lib/print/libipp-core/common/ipp.c136
-rw-r--r--usr/src/lib/print/libipp-core/common/ipp.h348
-rw-r--r--usr/src/lib/print/libipp-core/common/ipp_types.c303
-rw-r--r--usr/src/lib/print/libipp-core/common/read.c666
-rw-r--r--usr/src/lib/print/libipp-core/common/strings.c411
-rw-r--r--usr/src/lib/print/libipp-core/common/write.c415
-rw-r--r--usr/src/lib/print/libipp-listener/Makefile56
-rw-r--r--usr/src/lib/print/libipp-listener/Makefile.com68
-rw-r--r--usr/src/lib/print/libipp-listener/common/cancel-job.c96
-rw-r--r--usr/src/lib/print/libipp-listener/common/common.c309
-rw-r--r--usr/src/lib/print/libipp-listener/common/create-job.c108
-rw-r--r--usr/src/lib/print/libipp-listener/common/cups-accept-jobs.c68
-rw-r--r--usr/src/lib/print/libipp-listener/common/cups-get-classes.c90
-rw-r--r--usr/src/lib/print/libipp-listener/common/cups-get-default.c81
-rw-r--r--usr/src/lib/print/libipp-listener/common/cups-get-printers.c91
-rw-r--r--usr/src/lib/print/libipp-listener/common/cups-move-job.c103
-rw-r--r--usr/src/lib/print/libipp-listener/common/cups-reject-jobs.c68
-rw-r--r--usr/src/lib/print/libipp-listener/common/disable-printer.c77
-rw-r--r--usr/src/lib/print/libipp-listener/common/enable-printer.c68
-rw-r--r--usr/src/lib/print/libipp-listener/common/get-job-attributes.c89
-rw-r--r--usr/src/lib/print/libipp-listener/common/get-jobs.c99
-rw-r--r--usr/src/lib/print/libipp-listener/common/get-printer-attributes.c92
-rw-r--r--usr/src/lib/print/libipp-listener/common/hold-job.c96
-rw-r--r--usr/src/lib/print/libipp-listener/common/ipp-listener.c520
-rw-r--r--usr/src/lib/print/libipp-listener/common/ipp-listener.h70
-rw-r--r--usr/src/lib/print/libipp-listener/common/pause-printer.c68
-rw-r--r--usr/src/lib/print/libipp-listener/common/print-job.c184
-rw-r--r--usr/src/lib/print/libipp-listener/common/purge-jobs.c71
-rw-r--r--usr/src/lib/print/libipp-listener/common/release-job.c95
-rw-r--r--usr/src/lib/print/libipp-listener/common/restart-job.c106
-rw-r--r--usr/src/lib/print/libipp-listener/common/resume-printer.c68
-rw-r--r--usr/src/lib/print/libipp-listener/common/send-document.c143
-rw-r--r--usr/src/lib/print/libipp-listener/common/set-job-attributes.c90
-rw-r--r--usr/src/lib/print/libipp-listener/common/set-printer-attributes.c83
-rw-r--r--usr/src/lib/print/libipp-listener/common/validate-job.c107
-rw-r--r--usr/src/lib/print/libipp-listener/i386/Makefile30
-rw-r--r--usr/src/lib/print/libipp-listener/sparc/Makefile30
-rw-r--r--usr/src/lib/print/libpapi-common/Makefile57
-rw-r--r--usr/src/lib/print/libpapi-common/common/attribute.c1119
-rw-r--r--usr/src/lib/print/libpapi-common/common/common.c135
-rw-r--r--usr/src/lib/print/libpapi-common/common/config-site.h60
-rw-r--r--usr/src/lib/print/libpapi-common/common/config.h159
-rw-r--r--usr/src/lib/print/libpapi-common/common/library.c105
-rw-r--r--usr/src/lib/print/libpapi-common/common/list.c177
-rw-r--r--usr/src/lib/print/libpapi-common/common/mapfile168
-rw-r--r--usr/src/lib/print/libpapi-common/common/misc.c224
-rw-r--r--usr/src/lib/print/libpapi-common/common/papi.h452
-rw-r--r--usr/src/lib/print/libpapi-common/common/status.c133
-rw-r--r--usr/src/lib/print/libpapi-common/common/uri.c300
-rw-r--r--usr/src/lib/print/libpapi-common/i386/Makefile30
-rw-r--r--usr/src/lib/print/libpapi-common/sparc/Makefile30
-rw-r--r--usr/src/lib/print/libpapi-dynamic/Makefile56
-rw-r--r--usr/src/lib/print/libpapi-dynamic/Makefile.com57
-rw-r--r--usr/src/lib/print/libpapi-dynamic/common/job.c457
-rw-r--r--usr/src/lib/print/libpapi-dynamic/common/mapfile279
-rw-r--r--usr/src/lib/print/libpapi-dynamic/common/nss.c532
-rw-r--r--usr/src/lib/print/libpapi-dynamic/common/papi_impl.h97
-rw-r--r--usr/src/lib/print/libpapi-dynamic/common/printer.c513
-rw-r--r--usr/src/lib/print/libpapi-dynamic/common/psm.c95
-rw-r--r--usr/src/lib/print/libpapi-dynamic/common/service.c572
-rw-r--r--usr/src/lib/print/libpapi-dynamic/i386/Makefile30
-rw-r--r--usr/src/lib/print/libpapi-dynamic/sparc/Makefile30
-rw-r--r--usr/src/lib/print/libpapi-ipp/Makefile56
-rw-r--r--usr/src/lib/print/libpapi-ipp/Makefile.com71
-rw-r--r--usr/src/lib/print/libpapi-ipp/common/ipp-support.c631
-rw-r--r--usr/src/lib/print/libpapi-ipp/common/job.c666
-rw-r--r--usr/src/lib/print/libpapi-ipp/common/mapfile292
-rw-r--r--usr/src/lib/print/libpapi-ipp/common/papi_impl.h111
-rw-r--r--usr/src/lib/print/libpapi-ipp/common/printer.c430
-rw-r--r--usr/src/lib/print/libpapi-ipp/common/service.c394
-rw-r--r--usr/src/lib/print/libpapi-ipp/i386/Makefile30
-rw-r--r--usr/src/lib/print/libpapi-ipp/sparc/Makefile30
-rw-r--r--usr/src/lib/print/libpapi-lpd/Makefile56
-rw-r--r--usr/src/lib/print/libpapi-lpd/Makefile.com92
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/job.c312
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/library.c90
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/lpd-cancel.c121
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/lpd-job.c626
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/lpd-misc.c206
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/lpd-port.c823
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/lpd-query.c507
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/mapfile322
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/papi_impl.h111
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/printer.c220
-rw-r--r--usr/src/lib/print/libpapi-lpd/common/service.c299
-rw-r--r--usr/src/lib/print/libpapi-lpd/i386/Makefile31
-rw-r--r--usr/src/lib/print/libpapi-lpd/sparc/Makefile31
-rw-r--r--usr/src/lib/print/libprint/Makefile.com58
-rw-r--r--usr/src/lib/print/libprint/common/list.c189
-rw-r--r--usr/src/lib/print/libprint/common/llib-lprint141
-rw-r--r--usr/src/lib/print/libprint/common/mapfile-vers86
-rw-r--r--usr/src/lib/print/libprint/common/ns.c187
-rw-r--r--usr/src/lib/print/libprint/common/ns.h202
-rw-r--r--usr/src/lib/print/libprint/common/ns_bsd_addr.c571
-rw-r--r--usr/src/lib/print/libprint/common/ns_cmn_kvp.c262
-rw-r--r--usr/src/lib/print/libprint/common/ns_cmn_printer.c157
-rw-r--r--usr/src/lib/print/libprint/common/nss_convert.c207
-rw-r--r--usr/src/lib/print/libprint/common/nss_ldap.c2477
-rw-r--r--usr/src/lib/print/libprint/common/nss_printer.c151
-rw-r--r--usr/src/lib/print/libprint/common/nss_write.c325
-rw-r--r--usr/src/lib/print/libprint/common/sunPrinter.at.conf.txt64
-rw-r--r--usr/src/lib/print/libprint/common/sunPrinter.oc.conf.txt116
-rw-r--r--usr/src/lib/print/libprint/i386/Makefile30
-rw-r--r--usr/src/lib/print/libprint/sparc/Makefile30
-rw-r--r--usr/src/lib/print/mod_ipp/Makefile95
-rw-r--r--usr/src/lib/print/mod_ipp/httpd-standalone-ipp.conf341
-rw-r--r--usr/src/lib/print/mod_ipp/index.html44
-rw-r--r--usr/src/lib/print/mod_ipp/ipp-listener.xml84
-rw-r--r--usr/src/lib/print/mod_ipp/mod_ipp.c552
-rw-r--r--usr/src/lib/pylibbe/Makefile.com3
-rw-r--r--usr/src/lib/pysolaris/Makefile.com1
-rw-r--r--usr/src/lib/pyzfs/Makefile.com1
-rw-r--r--usr/src/man/man1/Makefile1
-rw-r--r--usr/src/man/man1/column.1129
-rw-r--r--usr/src/man/man1/crontab.127
-rw-r--r--usr/src/man/man1/date.16
-rw-r--r--usr/src/man/man1/ld.12
-rw-r--r--usr/src/man/man1/mdb.117
-rw-r--r--usr/src/man/man1/nawk.19
-rw-r--r--usr/src/man/man1/proc.111
-rw-r--r--usr/src/man/man1/ps.16
-rw-r--r--usr/src/man/man1/sed.124
-rw-r--r--usr/src/man/man1/tail.127
-rw-r--r--usr/src/man/man1m/Makefile4
-rw-r--r--usr/src/man/man1m/dladm.1m99
-rw-r--r--usr/src/man/man1m/flowadm.1m52
-rw-r--r--usr/src/man/man1m/ipdadm.1m223
-rw-r--r--usr/src/man/man1m/ipf.1m15
-rw-r--r--usr/src/man/man1m/ipfs.1m31
-rw-r--r--usr/src/man/man1m/ipfstat.1m17
-rw-r--r--usr/src/man/man1m/ipmon.1m18
-rw-r--r--usr/src/man/man1m/ipnat.1m19
-rw-r--r--usr/src/man/man1m/ippool.1m34
-rw-r--r--usr/src/man/man1m/lofiadm.1m8
-rw-r--r--usr/src/man/man1m/mount_tmpfs.1m14
-rw-r--r--usr/src/man/man1m/prstat.1m33
-rw-r--r--usr/src/man/man1m/prtconf.1m12
-rw-r--r--usr/src/man/man1m/psrset.1m13
-rw-r--r--usr/src/man/man1m/reboot.1m3
-rw-r--r--usr/src/man/man1m/svc.startd.1m15
-rw-r--r--usr/src/man/man1m/svccfg.1m9
-rw-r--r--usr/src/man/man1m/zfs.1m59
-rw-r--r--usr/src/man/man1m/zoneadm.1m17
-rw-r--r--usr/src/man/man1m/zonecfg.1m106
-rw-r--r--usr/src/man/man1m/zpool.1m32
-rw-r--r--usr/src/man/man3c/Makefile4
-rw-r--r--usr/src/man/man3c/getline.3c136
-rw-r--r--usr/src/man/man3c/port_associate.3c30
-rw-r--r--usr/src/man/man3malloc/umem_alloc.3malloc13
-rw-r--r--usr/src/man/man3socket/Makefile4
-rw-r--r--usr/src/man/man3socket/getifaddrs.3socket152
-rw-r--r--usr/src/man/man3xnet/Makefile4
-rw-r--r--usr/src/man/man3xnet/htonl.3xnet29
-rw-r--r--usr/src/man/man5/privileges.513
-rw-r--r--usr/src/man/man5/resource_controls.5116
-rw-r--r--usr/src/man/man5/zpool-features.51
-rw-r--r--usr/src/man/man7d/lofi.7d4
-rw-r--r--usr/src/man/man7fs/Makefile3
-rw-r--r--usr/src/man/man7fs/hyprlofs.7fs62
-rw-r--r--usr/src/man/man7fs/lxproc.7fs115
-rw-r--r--usr/src/man/man9e/detach.9e2
-rw-r--r--usr/src/man/man9f/kmem_cache_create.9f2
-rw-r--r--usr/src/man/man9f/net_hook_register.9f31
-rw-r--r--usr/src/man/man9f/net_instance_alloc.9f5
-rw-r--r--usr/src/man/man9f/net_protocol_lookup.9f5
-rw-r--r--usr/src/man/man9f/net_protocol_release.9f7
-rw-r--r--usr/src/man/man9s/hook_t.9s13
-rw-r--r--usr/src/man/man9s/net_instance_t.9s6
-rw-r--r--usr/src/pkg/manifests/SUNWcs.mf28
-rw-r--r--usr/src/pkg/manifests/SUNWippcore.mf29
-rw-r--r--usr/src/pkg/manifests/SUNWippl.mf29
-rw-r--r--usr/src/pkg/manifests/SUNWlpr-cmds.mf28
-rw-r--r--usr/src/pkg/manifests/SUNWps.mf1
-rw-r--r--usr/src/pkg/manifests/consolidation-osnet-osnet-message-files.mf4
-rw-r--r--usr/src/pkg/manifests/developer-build-onbld.mf3
-rw-r--r--usr/src/pkg/manifests/driver-network-bge.mf13
-rw-r--r--usr/src/pkg/manifests/library-print-open-printing-ipp.mf120
-rw-r--r--usr/src/pkg/manifests/library-print-open-printing-lpd.mf46
-rw-r--r--usr/src/pkg/manifests/library-print-open-printing.mf55
-rw-r--r--usr/src/pkg/manifests/print-lp-compatibility-sunos4.mf47
-rw-r--r--usr/src/pkg/manifests/print-lp-filter-postscript-lp-filter.mf63
-rw-r--r--usr/src/pkg/manifests/print-lp-ipp-ipp-listener.mf61
-rw-r--r--usr/src/pkg/manifests/print-lp-ipp-libipp.mf44
-rw-r--r--usr/src/pkg/manifests/print-lp-print-client-commands.mf83
-rw-r--r--usr/src/pkg/manifests/print-lp-print-manager-legacy.mf79
-rw-r--r--usr/src/pkg/manifests/print-lp.mf171
-rw-r--r--usr/src/pkg/manifests/service-file-system-smb.mf1
-rw-r--r--usr/src/pkg/manifests/system-dtrace-tests.mf3
-rw-r--r--usr/src/pkg/manifests/system-trusted.mf14
-rw-r--r--usr/src/pkg/manifests/system-zones-brand-joyent.mf54
-rw-r--r--usr/src/pkg/manifests/text-doctools.mf162
-rw-r--r--usr/src/psm/stand/bootblks/ufs/i386/mboot.S1
-rw-r--r--usr/src/stand/lib/fs/hsfs/hsfsops.c1
-rw-r--r--usr/src/tools/README.tools3
-rw-r--r--usr/src/tools/aw/aw.c23
-rw-r--r--usr/src/tools/cscope-fast/Makefile1
-rw-r--r--usr/src/tools/ctf/Makefile.ctf3
-rw-r--r--usr/src/tools/ctf/common/ctf_headers.h13
-rw-r--r--usr/src/tools/ctf/common/utils.h3
-rw-r--r--usr/src/tools/ctf/cvt/Makefile.com1
-rw-r--r--usr/src/tools/ctf/cvt/ctftools.h13
-rw-r--r--usr/src/tools/ctf/dump/Makefile.com1
-rw-r--r--usr/src/tools/findunref/exception_list.git (renamed from usr/src/cmd/print/scripts/lpsystem)18
-rw-r--r--usr/src/tools/findunref/exception_list.open1
-rw-r--r--usr/src/tools/findunref/exception_list.unknown0
-rw-r--r--usr/src/tools/onbld/Checks/Cddl.py2
-rw-r--r--usr/src/tools/onbld/Checks/CmtBlk.py2
-rw-r--r--usr/src/tools/onbld/Checks/Comments.py2
-rw-r--r--usr/src/tools/onbld/Checks/Copyright.py2
-rw-r--r--usr/src/tools/onbld/Checks/DbLookups.py2
-rw-r--r--usr/src/tools/onbld/Checks/HdrChk.py2
-rw-r--r--usr/src/tools/onbld/Checks/Keywords.py4
-rw-r--r--usr/src/tools/onbld/Checks/Mapfile.py2
-rw-r--r--usr/src/tools/onbld/Checks/__init__.py2
-rw-r--r--usr/src/tools/onbld/Scm/Ignore.py91
-rw-r--r--usr/src/tools/onbld/Scm/Makefile2
-rw-r--r--usr/src/tools/onbld/Scm/__init__.py4
-rw-r--r--usr/src/tools/onbld/hgext/__init__.py4
-rw-r--r--usr/src/tools/onbld/hgext/cdm.py6
-rw-r--r--usr/src/tools/scripts/bldenv.sh4
-rw-r--r--usr/src/tools/scripts/cddlchk.py2
-rw-r--r--usr/src/tools/scripts/copyrightchk.py2
-rw-r--r--usr/src/tools/scripts/git-pbchk.py13
-rw-r--r--usr/src/tools/scripts/hdrchk.py2
-rw-r--r--usr/src/tools/scripts/hg-active.py2
-rw-r--r--usr/src/tools/scripts/mapfilechk.py2
-rw-r--r--usr/src/tools/scripts/nightly.sh9
-rw-r--r--usr/src/tools/scripts/validate_pkg.py2
-rw-r--r--usr/src/tools/scripts/webrev.sh8
-rw-r--r--usr/src/tools/scripts/wsdiff.py2
-rw-r--r--usr/src/tools/scripts/xref.sh15
-rw-r--r--usr/src/ucbhead/Makefile (renamed from usr/src/cmd/lp/filter/postscript/Makefile)56
-rw-r--r--usr/src/ucbhead/sys/file.h4
-rw-r--r--usr/src/uts/Makefile.uts1
-rw-r--r--usr/src/uts/common/Makefile.files14
-rw-r--r--usr/src/uts/common/Makefile.rules39
-rw-r--r--usr/src/uts/common/brand/sngl/sngl_brand.c250
-rw-r--r--usr/src/uts/common/brand/sngl/sngl_brand.h72
-rw-r--r--usr/src/uts/common/conf/param.c12
-rw-r--r--usr/src/uts/common/crypto/api/kcf_random.c4
-rw-r--r--usr/src/uts/common/crypto/core/kcf_sched.c6
-rw-r--r--usr/src/uts/common/disp/cpucaps.c272
-rw-r--r--usr/src/uts/common/disp/disp.c24
-rw-r--r--usr/src/uts/common/disp/fss.c389
-rw-r--r--usr/src/uts/common/disp/thread.c16
-rw-r--r--usr/src/uts/common/dtrace/dtrace.c1007
-rw-r--r--usr/src/uts/common/dtrace/sdt_subr.c55
-rw-r--r--usr/src/uts/common/fs/dev/sdev_subr.c3
-rw-r--r--usr/src/uts/common/fs/dev/sdev_vnops.c18
-rw-r--r--usr/src/uts/common/fs/dev/sdev_zvolops.c141
-rw-r--r--usr/src/uts/common/fs/hyprlofs/hyprlofs_dir.c640
-rw-r--r--usr/src/uts/common/fs/hyprlofs/hyprlofs_subr.c127
-rw-r--r--usr/src/uts/common/fs/hyprlofs/hyprlofs_vfsops.c614
-rw-r--r--usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c1412
-rw-r--r--usr/src/uts/common/fs/lxproc/lxpr_subr.c524
-rw-r--r--usr/src/uts/common/fs/lxproc/lxpr_vfsops.c367
-rw-r--r--usr/src/uts/common/fs/lxproc/lxpr_vnops.c3092
-rw-r--r--usr/src/uts/common/fs/lxproc/lxproc.h275
-rw-r--r--usr/src/uts/common/fs/nfs/nfs3_vnops.c15
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_vnops.c16
-rw-r--r--usr/src/uts/common/fs/nfs/nfs_server.c5
-rw-r--r--usr/src/uts/common/fs/nfs/nfs_vnops.c16
-rw-r--r--usr/src/uts/common/fs/portfs/port_fop.c14
-rw-r--r--usr/src/uts/common/fs/proc/prcontrol.c14
-rw-r--r--usr/src/uts/common/fs/proc/prdata.h5
-rw-r--r--usr/src/uts/common/fs/proc/prvnops.c9
-rw-r--r--usr/src/uts/common/fs/swapfs/swap_subr.c6
-rw-r--r--usr/src/uts/common/fs/tmpfs/tmp_dir.c12
-rw-r--r--usr/src/uts/common/fs/tmpfs/tmp_subr.c34
-rw-r--r--usr/src/uts/common/fs/tmpfs/tmp_vfsops.c229
-rw-r--r--usr/src/uts/common/fs/tmpfs/tmp_vnops.c66
-rw-r--r--usr/src/uts/common/fs/vfs.c26
-rw-r--r--usr/src/uts/common/fs/vnode.c110
-rw-r--r--usr/src/uts/common/fs/zfs/arc.c23
-rw-r--r--usr/src/uts/common/fs/zfs/dbuf.c19
-rw-r--r--usr/src/uts/common/fs/zfs/dmu.c3
-rw-r--r--usr/src/uts/common/fs/zfs/dmu_tx.c4
-rw-r--r--usr/src/uts/common/fs/zfs/dsl_dir.c3
-rw-r--r--usr/src/uts/common/fs/zfs/dsl_pool.c8
-rw-r--r--usr/src/uts/common/fs/zfs/sys/dsl_dir.h7
-rw-r--r--usr/src/uts/common/fs/zfs/sys/vdev_disk.h16
-rw-r--r--usr/src/uts/common/fs/zfs/sys/vdev_impl.h1
-rw-r--r--usr/src/uts/common/fs/zfs/sys/vdev_raidz.h (renamed from usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmMisc.java)40
-rw-r--r--usr/src/uts/common/fs/zfs/sys/zfs_zone.h62
-rw-r--r--usr/src/uts/common/fs/zfs/sys/zio.h6
-rw-r--r--usr/src/uts/common/fs/zfs/txg.c3
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_disk.c274
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_queue.c10
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_raidz.c184
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_ioctl.c59
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_vfsops.c12
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_vnops.c56
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_zone.c1179
-rw-r--r--usr/src/uts/common/fs/zfs/zio.c11
-rw-r--r--usr/src/uts/common/fs/zfs/zio_checksum.c10
-rw-r--r--usr/src/uts/common/fs/zfs/zvol.c64
-rw-r--r--usr/src/uts/common/inet/ip.h12
-rw-r--r--usr/src/uts/common/inet/ip/ip_attr.c112
-rw-r--r--usr/src/uts/common/inet/ip/ip_dce.c123
-rw-r--r--usr/src/uts/common/inet/ip/ip_tunables.c6
-rw-r--r--usr/src/uts/common/inet/ip/ipsecesp.c3
-rw-r--r--usr/src/uts/common/inet/ip_stack.h1
-rw-r--r--usr/src/uts/common/inet/ipd/ipd.c1191
-rw-r--r--usr/src/uts/common/inet/ipd/ipd.conf (renamed from usr/src/cmd/lp/lib/oam/lp_lib_oam.xcl)8
-rw-r--r--usr/src/uts/common/inet/ipf/fil.c35
-rw-r--r--usr/src/uts/common/inet/ipf/ip_fil_solaris.c134
-rw-r--r--usr/src/uts/common/inet/ipf/ip_log.c7
-rw-r--r--usr/src/uts/common/inet/ipf/ipf.conf5
-rw-r--r--usr/src/uts/common/inet/ipf/netinet/ip_fil.h27
-rw-r--r--usr/src/uts/common/inet/ipf/solaris.c87
-rw-r--r--usr/src/uts/common/inet/squeue.c24
-rw-r--r--usr/src/uts/common/inet/tcp/tcp.c6
-rw-r--r--usr/src/uts/common/inet/tcp/tcp_stats.c20
-rw-r--r--usr/src/uts/common/inet/tcp/tcp_time_wait.c90
-rw-r--r--usr/src/uts/common/inet/tcp_stack.h3
-rw-r--r--usr/src/uts/common/io/aggr/aggr_port.c8
-rw-r--r--usr/src/uts/common/io/aggr/aggr_recv.c36
-rw-r--r--usr/src/uts/common/io/bge/bge_chip2.c234
-rw-r--r--usr/src/uts/common/io/bge/bge_hw.h218
-rw-r--r--usr/src/uts/common/io/bge/bge_impl.h14
-rw-r--r--usr/src/uts/common/io/bge/bge_main2.c14
-rw-r--r--usr/src/uts/common/io/bge/bge_mii.c71
-rw-r--r--usr/src/uts/common/io/blkdev/blkdev.c11
-rw-r--r--usr/src/uts/common/io/cmlb.c23
-rw-r--r--usr/src/uts/common/io/dld/dld_drv.c6
-rw-r--r--usr/src/uts/common/io/dls/dls.c16
-rw-r--r--usr/src/uts/common/io/dls/dls_mgmt.c179
-rw-r--r--usr/src/uts/common/io/dls/dls_stat.c172
-rw-r--r--usr/src/uts/common/io/dr_sas/THIRDPARTYLICENSE32
-rw-r--r--usr/src/uts/common/io/dr_sas/THIRDPARTYLICENSE.descrip1
-rw-r--r--usr/src/uts/common/io/dr_sas/dr_sas.c5506
-rw-r--r--usr/src/uts/common/io/dr_sas/dr_sas.conf15
-rw-r--r--usr/src/uts/common/io/dr_sas/dr_sas.h1766
-rw-r--r--usr/src/uts/common/io/dr_sas/dr_sas_list.h212
-rw-r--r--usr/src/uts/common/io/fibre-channel/fca/oce/oce_rx.c3
-rw-r--r--usr/src/uts/common/io/igb/igb_api.c22
-rw-r--r--usr/src/uts/common/io/igb/igb_api.h3
-rw-r--r--usr/src/uts/common/io/igb/igb_defines.h8
-rw-r--r--usr/src/uts/common/io/igb/igb_main.c31
-rw-r--r--usr/src/uts/common/io/igb/igb_nvm.c159
-rw-r--r--usr/src/uts/common/io/igb/igb_nvm.h4
-rw-r--r--usr/src/uts/common/io/ixgbe/ixgbe_main.c11
-rw-r--r--usr/src/uts/common/io/mac/mac.c4
-rw-r--r--usr/src/uts/common/io/mac/mac_client.c31
-rw-r--r--usr/src/uts/common/io/mac/mac_protect.c4
-rw-r--r--usr/src/uts/common/io/mr_sas/mr_sas.conf8
-rw-r--r--usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c248
-rw-r--r--usr/src/uts/common/io/scsi/targets/sd.c91
-rw-r--r--usr/src/uts/common/io/sdcard/impl/sda_mem.c2
-rw-r--r--usr/src/uts/common/io/vnic/vnic_dev.c53
-rw-r--r--usr/src/uts/common/os/bio.c10
-rw-r--r--usr/src/uts/common/os/clock.c6
-rw-r--r--usr/src/uts/common/os/clock_highres.c36
-rw-r--r--usr/src/uts/common/os/contract.c50
-rw-r--r--usr/src/uts/common/os/core.c9
-rw-r--r--usr/src/uts/common/os/cred.c8
-rw-r--r--usr/src/uts/common/os/cyclic.c6
-rw-r--r--usr/src/uts/common/os/devcfg.c8
-rw-r--r--usr/src/uts/common/os/driver_lyr.c45
-rw-r--r--usr/src/uts/common/os/dtrace_subr.c1
-rw-r--r--usr/src/uts/common/os/exit.c15
-rw-r--r--usr/src/uts/common/os/fio.c14
-rw-r--r--usr/src/uts/common/os/kstat_fr.c18
-rw-r--r--usr/src/uts/common/os/logsubr.c4
-rw-r--r--usr/src/uts/common/os/msacct.c64
-rw-r--r--usr/src/uts/common/os/netstack.c33
-rw-r--r--usr/src/uts/common/os/policy.c10
-rw-r--r--usr/src/uts/common/os/priv_defs4
-rw-r--r--usr/src/uts/common/os/vmem.c2
-rw-r--r--usr/src/uts/common/os/zone.c911
-rw-r--r--usr/src/uts/common/sys/Makefile4
-rw-r--r--usr/src/uts/common/sys/aggr_impl.h3
-rw-r--r--usr/src/uts/common/sys/blkdev.h2
-rw-r--r--usr/src/uts/common/sys/buf.h8
-rw-r--r--usr/src/uts/common/sys/cpucaps.h5
-rw-r--r--usr/src/uts/common/sys/cpucaps_impl.h6
-rw-r--r--usr/src/uts/common/sys/cred.h1
-rw-r--r--usr/src/uts/common/sys/ctf_api.h7
-rw-r--r--usr/src/uts/common/sys/dkio.h4
-rw-r--r--usr/src/uts/common/sys/dktp/dadk.h2
-rw-r--r--usr/src/uts/common/sys/dld.h3
-rw-r--r--usr/src/uts/common/sys/dls.h5
-rw-r--r--usr/src/uts/common/sys/dls_impl.h4
-rw-r--r--usr/src/uts/common/sys/dls_mgmt.h2
-rw-r--r--usr/src/uts/common/sys/dtrace.h33
-rw-r--r--usr/src/uts/common/sys/dtrace_impl.h2
-rw-r--r--usr/src/uts/common/sys/fs/hyprlofs.h91
-rw-r--r--usr/src/uts/common/sys/fs/hyprlofs_info.h174
-rw-r--r--usr/src/uts/common/sys/fs/tmp.h39
-rw-r--r--usr/src/uts/common/sys/fss.h7
-rw-r--r--usr/src/uts/common/sys/ipd.h81
-rw-r--r--usr/src/uts/common/sys/mac.h2
-rw-r--r--usr/src/uts/common/sys/mac_client_impl.h2
-rw-r--r--usr/src/uts/common/sys/mac_impl.h3
-rw-r--r--usr/src/uts/common/sys/mman.h2
-rw-r--r--usr/src/uts/common/sys/mntent.h2
-rw-r--r--usr/src/uts/common/sys/policy.h2
-rw-r--r--usr/src/uts/common/sys/port.h7
-rw-r--r--usr/src/uts/common/sys/port_impl.h12
-rw-r--r--usr/src/uts/common/sys/procfs.h4
-rw-r--r--usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_ioctl.h57
-rw-r--r--usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_var.h2
-rw-r--r--usr/src/uts/common/sys/sdt_impl.h8
-rw-r--r--usr/src/uts/common/sys/sunldi_impl.h32
-rw-r--r--usr/src/uts/common/sys/thread.h2
-rw-r--r--usr/src/uts/common/sys/uadmin.h3
-rw-r--r--usr/src/uts/common/sys/vm_usage.h4
-rw-r--r--usr/src/uts/common/sys/zone.h189
-rw-r--r--usr/src/uts/common/syscall/getloadavg.c14
-rw-r--r--usr/src/uts/common/syscall/memcntl.c9
-rw-r--r--usr/src/uts/common/syscall/sysconfig.c24
-rw-r--r--usr/src/uts/common/syscall/tasksys.c4
-rw-r--r--usr/src/uts/common/syscall/uadmin.c7
-rw-r--r--usr/src/uts/common/vm/hat.h2
-rw-r--r--usr/src/uts/common/vm/seg_vn.c12
-rw-r--r--usr/src/uts/common/vm/vm_anon.c11
-rw-r--r--usr/src/uts/common/vm/vm_as.c20
-rw-r--r--usr/src/uts/common/vm/vm_pvn.c28
-rw-r--r--usr/src/uts/common/vm/vm_usage.c198
-rw-r--r--usr/src/uts/i86pc/dboot/dboot_startkern.c41
-rw-r--r--usr/src/uts/i86pc/io/ppm/acpisleep.c24
-rw-r--r--usr/src/uts/i86pc/io/psm/psm_common.c3
-rw-r--r--usr/src/uts/i86pc/os/cpr_impl.c14
-rw-r--r--usr/src/uts/i86pc/os/ibft.c6
-rw-r--r--usr/src/uts/i86pc/os/lgrpplat.c14
-rw-r--r--usr/src/uts/i86pc/sys/acpidev.h3
-rw-r--r--usr/src/uts/i86pc/vm/hat_i86.c44
-rw-r--r--usr/src/uts/intel/Makefile.files16
-rw-r--r--usr/src/uts/intel/Makefile.intel.shared10
-rw-r--r--usr/src/uts/intel/Makefile.rules13
-rw-r--r--usr/src/uts/intel/brand/sngl/sngl_brand_asm.s (renamed from usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDeleteFailedException.java)26
-rw-r--r--usr/src/uts/intel/core_pcbe/Makefile4
-rw-r--r--usr/src/uts/intel/dr_sas/Makefile90
-rw-r--r--usr/src/uts/intel/dtrace/Makefile2
-rw-r--r--usr/src/uts/intel/dtrace/sdt.c17
-rw-r--r--usr/src/uts/intel/hyprlofs/Makefile (renamed from usr/src/cmd/lp/lib/requests/Makefile)69
-rw-r--r--usr/src/uts/intel/io/acpica/changes.txt585
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbcmds.c473
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbdisply.c34
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbexec.c2
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbfileio.c7
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbhistry.c2
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbinput.c14
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbmethod.c2
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbnames.c2
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbstats.c30
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbutils.c9
-rw-r--r--usr/src/uts/intel/io/acpica/debugger/dbxface.c2
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmbuffer.c10
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmnames.c2
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmobject.c2
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmopcode.c75
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmresrc.c15
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c3
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmresrcl2.c700
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c51
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmutils.c52
-rw-r--r--usr/src/uts/intel/io/acpica/disassembler/dmwalk.c5
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dsargs.c12
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dscontrol.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dsfield.c80
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dsinit.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dsmethod.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dsmthdat.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dsobject.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dsutils.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dswexec.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dswload.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dswload2.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dswscope.c2
-rw-r--r--usr/src/uts/intel/io/acpica/dispatcher/dswstate.c2
-rw-r--r--usr/src/uts/intel/io/acpica/events/evevent.c20
-rw-r--r--usr/src/uts/intel/io/acpica/events/evglock.c12
-rw-r--r--usr/src/uts/intel/io/acpica/events/evgpe.c5
-rw-r--r--usr/src/uts/intel/io/acpica/events/evgpeblk.c5
-rw-r--r--usr/src/uts/intel/io/acpica/events/evgpeinit.c5
-rw-r--r--usr/src/uts/intel/io/acpica/events/evgpeutil.c5
-rw-r--r--usr/src/uts/intel/io/acpica/events/evmisc.c186
-rw-r--r--usr/src/uts/intel/io/acpica/events/evregion.c32
-rw-r--r--usr/src/uts/intel/io/acpica/events/evrgnini.c2
-rw-r--r--usr/src/uts/intel/io/acpica/events/evsci.c6
-rw-r--r--usr/src/uts/intel/io/acpica/events/evxface.c686
-rw-r--r--usr/src/uts/intel/io/acpica/events/evxfevnt.c5
-rw-r--r--usr/src/uts/intel/io/acpica/events/evxfgpe.c5
-rw-r--r--usr/src/uts/intel/io/acpica/events/evxfregn.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exconfig.c4
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exconvrt.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/excreate.c30
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exdebug.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exdump.c37
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exfield.c28
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exfldio.c28
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exmisc.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exmutex.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exnames.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exoparg1.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exoparg2.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exoparg3.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exoparg6.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exprep.c29
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exregion.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exresnte.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exresolv.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exresop.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exstore.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exstoren.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exstorob.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exsystem.c2
-rw-r--r--usr/src/uts/intel/io/acpica/executer/exutils.c32
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwacpi.c5
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwesleep.c277
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwgpe.c5
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwpci.c2
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwregs.c16
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwsleep.c395
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwtimer.c4
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwvalid.c4
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwxface.c57
-rw-r--r--usr/src/uts/intel/io/acpica/hardware/hwxfsleep.c478
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsaccess.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsalloc.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsdump.c18
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsdumpdv.c4
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nseval.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsinit.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsload.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsnames.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsobject.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsparse.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nspredef.c47
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsrepair.c167
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsrepair2.c22
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nssearch.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsutils.c4
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nswalk.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsxfeval.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsxfname.c2
-rw-r--r--usr/src/uts/intel/io/acpica/namespace/nsxfobj.c2
-rw-r--r--usr/src/uts/intel/io/acpica/osl.c17
-rw-r--r--usr/src/uts/intel/io/acpica/parser/psargs.c147
-rw-r--r--usr/src/uts/intel/io/acpica/parser/psloop.c2
-rw-r--r--usr/src/uts/intel/io/acpica/parser/psopcode.c13
-rw-r--r--usr/src/uts/intel/io/acpica/parser/psparse.c2
-rw-r--r--usr/src/uts/intel/io/acpica/parser/psscope.c2
-rw-r--r--usr/src/uts/intel/io/acpica/parser/pstree.c9
-rw-r--r--usr/src/uts/intel/io/acpica/parser/psutils.c2
-rw-r--r--usr/src/uts/intel/io/acpica/parser/pswalk.c2
-rw-r--r--usr/src/uts/intel/io/acpica/parser/psxface.c2
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsaddr.c2
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rscalc.c69
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rscreate.c75
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsdump.c158
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsinfo.c61
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsio.c2
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsirq.c34
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rslist.c77
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsmemory.c2
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsmisc.c268
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsserial.c425
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsutils.c61
-rw-r--r--usr/src/uts/intel/io/acpica/resources/rsxface.c58
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbfadt.c54
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbfind.c2
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbinstal.c121
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbutils.c103
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbxface.c2
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbxfroot.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utaddress.c322
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utalloc.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utcache.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utclib.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utcopy.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utdebug.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utdecode.c41
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utdelete.c33
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/uteval.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utglobal.c22
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utids.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utinit.c46
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utlock.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utmath.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utmisc.c40
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utmutex.c11
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utobject.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utosi.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utresrc.c295
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utstate.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/uttrack.c8
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utxface.c54
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utxferror.c2
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utxfmutex.c213
-rw-r--r--usr/src/uts/intel/io/dktp/dcdev/dadk.c48
-rw-r--r--usr/src/uts/intel/io/ipmi/ipmivars.h2
-rw-r--r--usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.c1
-rw-r--r--usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.h1
-rw-r--r--usr/src/uts/intel/io/vmxnet/buildNumber.h12
-rw-r--r--usr/src/uts/intel/io/vmxnet/includeCheck.h159
-rw-r--r--usr/src/uts/intel/io/vmxnet/net.h220
-rw-r--r--usr/src/uts/intel/io/vmxnet/net_sg.h84
-rw-r--r--usr/src/uts/intel/io/vmxnet/vm_basic_types.h1037
-rw-r--r--usr/src/uts/intel/io/vmxnet/vm_device_version.h246
-rw-r--r--usr/src/uts/intel/io/vmxnet/vmnet_def.h91
-rw-r--r--usr/src/uts/intel/io/vmxnet/vmxnet.c2438
-rw-r--r--usr/src/uts/intel/io/vmxnet/vmxnet.conf24
-rw-r--r--usr/src/uts/intel/io/vmxnet/vmxnet2_def.h436
-rw-r--r--usr/src/uts/intel/io/vmxnet/vmxnet_def.h184
-rw-r--r--usr/src/uts/intel/ip/ip.global-objs.debug6410
-rw-r--r--usr/src/uts/intel/ip/ip.global-objs.obj6410
-rw-r--r--usr/src/uts/intel/ipd/Makefile (renamed from usr/src/cmd/lp/filter/postscript/postcomm/Makefile)44
-rw-r--r--usr/src/uts/intel/ipf/ipf.global-objs.debug642
-rw-r--r--usr/src/uts/intel/kdi/kdi_idt.c3
-rw-r--r--usr/src/uts/intel/lxprocfs/Makefile (renamed from usr/src/cmd/lp/lib/class/Makefile)73
-rw-r--r--usr/src/uts/intel/opteron_pcbe/Makefile2
-rw-r--r--usr/src/uts/intel/os/driver_aliases1
-rw-r--r--usr/src/uts/intel/os/name_to_major1
-rw-r--r--usr/src/uts/intel/p123_pcbe/Makefile4
-rw-r--r--usr/src/uts/intel/p4_pcbe/Makefile2
-rw-r--r--usr/src/uts/intel/sngl_brand/Makefile98
-rw-r--r--usr/src/uts/intel/sys/acpi/acapps.h13
-rw-r--r--usr/src/uts/intel/sys/acpi/accommon.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/acconfig.h30
-rw-r--r--usr/src/uts/intel/sys/acpi/acdebug.h12
-rw-r--r--usr/src/uts/intel/sys/acpi/acdisasm.h202
-rw-r--r--usr/src/uts/intel/sys/acpi/acdispat.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/acevents.h21
-rw-r--r--usr/src/uts/intel/sys/acpi/acexcep.h8
-rw-r--r--usr/src/uts/intel/sys/acpi/acglobal.h34
-rw-r--r--usr/src/uts/intel/sys/acpi/achware.h63
-rw-r--r--usr/src/uts/intel/sys/acpi/acinterp.h6
-rw-r--r--usr/src/uts/intel/sys/acpi/aclocal.h56
-rw-r--r--usr/src/uts/intel/sys/acpi/acmacros.h11
-rw-r--r--usr/src/uts/intel/sys/acpi/acnames.h15
-rw-r--r--usr/src/uts/intel/sys/acpi/acnamesp.h5
-rw-r--r--usr/src/uts/intel/sys/acpi/acobject.h13
-rw-r--r--usr/src/uts/intel/sys/acpi/acopcode.h6
-rw-r--r--usr/src/uts/intel/sys/acpi/acoutput.h3
-rw-r--r--usr/src/uts/intel/sys/acpi/acparser.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/acpi.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/acpiosxf.h12
-rw-r--r--usr/src/uts/intel/sys/acpi/acpixf.h201
-rw-r--r--usr/src/uts/intel/sys/acpi/acpredef.h40
-rw-r--r--usr/src/uts/intel/sys/acpi/acresrc.h117
-rw-r--r--usr/src/uts/intel/sys/acpi/acrestyp.h228
-rw-r--r--usr/src/uts/intel/sys/acpi/acstruct.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/actables.h7
-rw-r--r--usr/src/uts/intel/sys/acpi/actbl.h32
-rw-r--r--usr/src/uts/intel/sys/acpi/actbl1.h87
-rw-r--r--usr/src/uts/intel/sys/acpi/actbl2.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/actbl3.h650
-rw-r--r--usr/src/uts/intel/sys/acpi/actypes.h48
-rw-r--r--usr/src/uts/intel/sys/acpi/acutils.h50
-rw-r--r--usr/src/uts/intel/sys/acpi/amlcode.h31
-rw-r--r--usr/src/uts/intel/sys/acpi/amlresrc.h162
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/accygwin.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acefi.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acenv.h26
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acfreebsd.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acgcc.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acintel.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/aclinux.h5
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acmsvc.h24
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acnetbsd.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acos2.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acwin.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acwin64.h2
-rw-r--r--usr/src/uts/intel/sys/x86_archext.h33
-rw-r--r--usr/src/uts/intel/tpm/Makefile2
-rw-r--r--usr/src/uts/intel/vmxnet/Makefile93
-rw-r--r--usr/src/uts/sparc/Makefile.sparc.shared2
-rw-r--r--usr/src/uts/sparc/dtrace/Makefile1
-rw-r--r--usr/src/uts/sparc/dtrace/sdt.c17
-rw-r--r--usr/src/uts/sparc/ip/ip.global-objs.debug642
-rw-r--r--usr/src/uts/sparc/ip/ip.global-objs.obj642
-rw-r--r--usr/src/uts/sun4u/io/pci/pcisch.c5
-rw-r--r--usr/src/uts/sun4v/tpm/Makefile2
2086 files changed, 143420 insertions, 166666 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..11bc3a438f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9076 @@
+*.o
+.make.state
+*.po
+*.so
+*.so.1
+*.a
+*.pyc
+/closed
+/illumos.sh
+/log
+/nightly
+/on-closed-bins-nd.i386.tar.bz2
+/on-closed-bins.i386.tar.bz2
+/packages
+/proto
+.make.state
+.build.tstamp
+usr/src/check-i386.out
+usr/src/cmd/Adm/sun/motd
+usr/src/cmd/Adm/sun/smbpasswd
+usr/src/cmd/abi/appcert/etc/etc.alt
+usr/src/cmd/abi/appcert/etc/etc.scoped
+usr/src/cmd/abi/appcert/etc/etc.tweaks
+usr/src/cmd/abi/appcert/etc/etc.warn
+usr/src/cmd/abi/appcert/scripts/abi_index
+usr/src/cmd/abi/appcert/scripts/appcert
+usr/src/cmd/abi/appcert/scripts/symcheck
+usr/src/cmd/abi/appcert/scripts/symprof
+usr/src/cmd/abi/appcert/scripts/symreport
+usr/src/cmd/abi/appcert/static_prof/i386/static_prof
+usr/src/cmd/abi/apptracecmd/apptrace
+usr/src/cmd/abi/spectrans/spec2map/i386/spec2map
+usr/src/cmd/abi/spectrans/spec2trace/i386/spec2trace
+usr/src/cmd/acct/acct
+usr/src/cmd/acct/acctcms
+usr/src/cmd/acct/acctcom
+usr/src/cmd/acct/acctcon
+usr/src/cmd/acct/acctcon1
+usr/src/cmd/acct/acctcon2
+usr/src/cmd/acct/acctdisk
+usr/src/cmd/acct/acctdusg
+usr/src/cmd/acct/acctmerg
+usr/src/cmd/acct/accton
+usr/src/cmd/acct/acctprc
+usr/src/cmd/acct/acctprc1
+usr/src/cmd/acct/acctprc2
+usr/src/cmd/acct/acctwtmp
+usr/src/cmd/acct/chargefee
+usr/src/cmd/acct/ckpacct
+usr/src/cmd/acct/closewtmp
+usr/src/cmd/acct/dodisk
+usr/src/cmd/acct/fwtmp
+usr/src/cmd/acct/holidays
+usr/src/cmd/acct/lastlogin
+usr/src/cmd/acct/monacct
+usr/src/cmd/acct/nulladm
+usr/src/cmd/acct/prctmp
+usr/src/cmd/acct/prdaily
+usr/src/cmd/acct/prtacct
+usr/src/cmd/acct/remove
+usr/src/cmd/acct/runacct
+usr/src/cmd/acct/shutacct
+usr/src/cmd/acct/startup
+usr/src/cmd/acct/turnacct
+usr/src/cmd/acct/utmp2wtmp
+usr/src/cmd/acct/wtmpfix
+usr/src/cmd/acctadm/acctadm
+usr/src/cmd/acpihpd/THIRDPARTYLICENSE
+usr/src/cmd/acpihpd/i386/acpihpd
+usr/src/cmd/adbgen/i386/adbgen
+usr/src/cmd/adbgen/i386/adbgen1
+usr/src/cmd/adbgen/i386/adbgen3
+usr/src/cmd/adbgen/i386/adbgen4
+usr/src/cmd/addbadsec/addbadsec
+usr/src/cmd/allocate/add_allocatable
+usr/src/cmd/allocate/allocate
+usr/src/cmd/allocate/allscripts.sh
+usr/src/cmd/allocate/audio
+usr/src/cmd/allocate/audio_clean
+usr/src/cmd/allocate/disk_clean
+usr/src/cmd/allocate/dminfo
+usr/src/cmd/allocate/fd0
+usr/src/cmd/allocate/mkdevalloc
+usr/src/cmd/allocate/sr0
+usr/src/cmd/allocate/st0
+obj32
+obj64
+usr/src/cmd/allocate/st1
+usr/src/cmd/allocate/st_clean
+usr/src/cmd/amt/amd64/amt
+usr/src/cmd/amt/amt
+usr/src/cmd/amt/i386/amt
+usr/src/cmd/arch/arch
+usr/src/cmd/asa/asa
+usr/src/cmd/ast/msgcc/msgcc
+usr/src/cmd/ast/msgcc/msgcpp
+usr/src/cmd/ast/msgcc/msgcvt
+usr/src/cmd/ast/msgcc/msggen
+usr/src/cmd/ast/msgcc/msgget
+usr/src/cmd/audio/audioconvert/audioconvert
+usr/src/cmd/audio/audioctl/audioctl
+usr/src/cmd/audio/audioplay/audioplay
+usr/src/cmd/audio/audiorecord/audiorecord
+usr/src/cmd/audio/audiotest/audiotest
+usr/src/cmd/audit/audit
+usr/src/cmd/audit_warn/audit_warn
+usr/src/cmd/auditconfig/auditconfig
+usr/src/cmd/auditd/auditd
+usr/src/cmd/auditrecord/audit_record_attr
+usr/src/cmd/auditrecord/auditrecord
+usr/src/cmd/auditrecord/filter_txt
+usr/src/cmd/auditrecord/mkmsg
+usr/src/cmd/auditreduce/auditreduce
+usr/src/cmd/auditset/svc-auditset
+usr/src/cmd/auditstat/auditstat
+usr/src/cmd/auths/auths
+usr/src/cmd/autopush/autopush
+usr/src/cmd/availdevs/availdevs
+usr/src/cmd/avs/dsbitmap/dsbitmap
+usr/src/cmd/avs/dscfg/dscfg
+usr/src/cmd/avs/dscfg/dscfgadm
+usr/src/cmd/avs/dscfglockd/dscfgcli
+usr/src/cmd/avs/dscfglockd/dscfglockd
+usr/src/cmd/avs/dsstat/dsstat
+usr/src/cmd/avs/dsw/etc/ii
+usr/src/cmd/avs/dsw/etc/ii.cluster
+usr/src/cmd/avs/dsw/iiadm
+usr/src/cmd/avs/dsw/iiboot
+usr/src/cmd/avs/dsw/iicpbmp
+usr/src/cmd/avs/dsw/iicpshd
+usr/src/cmd/avs/errgen/errgen
+usr/src/cmd/avs/ncall/ncalladm
+usr/src/cmd/avs/nsctl/nscadm
+usr/src/cmd/avs/nsctl/nskernd
+usr/src/cmd/avs/rdc/etc/rdc
+usr/src/cmd/avs/rdc/etc/rdc.cluster
+usr/src/cmd/avs/rdc/etc/rdcfinish
+usr/src/cmd/avs/rdc/sndradm
+usr/src/cmd/avs/rdc/sndrboot
+usr/src/cmd/avs/rdc/sndrd
+usr/src/cmd/avs/rdc/sndrsyncd
+usr/src/cmd/avs/sdbc/etc/dscfg_reconfigure.cluster
+usr/src/cmd/avs/sdbc/etc/scm
+usr/src/cmd/avs/sdbc/scmadm
+usr/src/cmd/avs/sdbc/sd_diag
+usr/src/cmd/avs/sdbc/sd_stats
+usr/src/cmd/avs/sv/etc/sv
+usr/src/cmd/avs/sv/etc/sv.cluster
+usr/src/cmd/avs/sv/svadm
+usr/src/cmd/avs/sv/svboot
+usr/src/cmd/avs/svc/nws_ii.xml
+usr/src/cmd/avs/svc/nws_rdc.xml
+usr/src/cmd/avs/svc/nws_rdcsyncd.xml
+usr/src/cmd/avs/svc/nws_scm.xml
+usr/src/cmd/avs/svc/nws_sv.xml
+usr/src/cmd/awk/awk.g.c
+usr/src/cmd/awk/awk.lx.c
+usr/src/cmd/awk/maketab
+usr/src/cmd/awk/nawk
+usr/src/cmd/awk/proctab.c
+usr/src/cmd/awk/y.tab.h
+usr/src/cmd/awk_xpg4/awk.c
+usr/src/cmd/awk_xpg4/awk.xpg4
+usr/src/cmd/awk_xpg4/y.tab.h
+usr/src/cmd/backup/dump/dumpdates
+usr/src/cmd/backup/dump/ufsdump
+usr/src/cmd/backup/lib/getdate.c
+usr/src/cmd/backup/restore/ufsrestore
+usr/src/cmd/banner/banner
+usr/src/cmd/bart/bart
+usr/src/cmd/basename/basename
+usr/src/cmd/basename/basename.xpg4
+usr/src/cmd/bc/bc
+usr/src/cmd/bc/bc.xpg6
+usr/src/cmd/bc/lib.b
+usr/src/cmd/bdiff/bdiff
+usr/src/cmd/beadm/beadm
+usr/src/cmd/bfs/bfs
+usr/src/cmd/biosdev/biosdev
+usr/src/cmd/bnu/bnuconvert
+usr/src/cmd/bnu/bnuconvert.cat
+usr/src/cmd/bnu/ct
+usr/src/cmd/bnu/ct.cat
+usr/src/cmd/bnu/cu
+usr/src/cmd/bnu/cu.cat
+usr/src/cmd/bnu/in.uucpd
+usr/src/cmd/bnu/in.uucpd.cat
+usr/src/cmd/bnu/remote.unknown
+usr/src/cmd/bnu/remote.unknown.cat
+usr/src/cmd/bnu/uucheck
+usr/src/cmd/bnu/uucheck.cat
+usr/src/cmd/bnu/uucico
+usr/src/cmd/bnu/uucico.cat
+usr/src/cmd/bnu/uucleanup
+usr/src/cmd/bnu/uucleanup.cat
+usr/src/cmd/bnu/uucp
+usr/src/cmd/bnu/uucp.cat
+usr/src/cmd/bnu/uudecode
+usr/src/cmd/bnu/uudecode.cat
+usr/src/cmd/bnu/uuencode
+usr/src/cmd/bnu/uuencode.cat
+usr/src/cmd/bnu/uuglist
+usr/src/cmd/bnu/uuglist.cat
+usr/src/cmd/bnu/uuname
+usr/src/cmd/bnu/uuname.cat
+usr/src/cmd/bnu/uusched
+usr/src/cmd/bnu/uusched.cat
+usr/src/cmd/bnu/uustat
+usr/src/cmd/bnu/uustat.cat
+usr/src/cmd/bnu/uux
+usr/src/cmd/bnu/uux.cat
+usr/src/cmd/bnu/uuxqt
+usr/src/cmd/bnu/uuxqt.cat
+usr/src/cmd/boot/bootadm/bootadm
+usr/src/cmd/boot/fiocompress/fiocompress
+usr/src/cmd/boot/installgrub/installgrub
+usr/src/cmd/boot/mbr/mbr
+usr/src/cmd/boot/scripts/boot-archive-update
+usr/src/cmd/boot/scripts/create_diskmap
+usr/src/cmd/boot/scripts/create_ramdisk
+usr/src/cmd/boot/scripts/extract_boot_filelist
+usr/src/cmd/boot/scripts/root_archive
+usr/src/cmd/boot/scripts/update_grub
+usr/src/cmd/boot/symdef/symdef
+usr/src/cmd/busstat/busstat
+usr/src/cmd/cal/cal
+usr/src/cmd/cal/cal.dc
+usr/src/cmd/calendar/calendar
+usr/src/cmd/calendar/calprog
+usr/src/cmd/captoinfo/captoinfo
+usr/src/cmd/cat/cat
+usr/src/cmd/cdrw/cdrw
+usr/src/cmd/cfgadm/cfgadm
+usr/src/cmd/cfgadm/cfgadm.dc
+usr/src/cmd/checkeq/checkeq
+usr/src/cmd/checknr/checknr
+usr/src/cmd/chgrp/chgrp
+usr/src/cmd/chgrp/chgrp.xpg4
+usr/src/cmd/chmod/chmod
+usr/src/cmd/chown/chown
+usr/src/cmd/chown/chown.xpg4
+usr/src/cmd/chroot/chroot
+usr/src/cmd/clear/clear
+usr/src/cmd/clinfo/clinfo
+usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm
+usr/src/cmd/cmd-crypto/decrypt/amd64/decrypt
+usr/src/cmd/cmd-crypto/decrypt/i386/decrypt
+usr/src/cmd/cmd-crypto/digest/amd64/digest
+usr/src/cmd/cmd-crypto/digest/i386/digest
+usr/src/cmd/cmd-crypto/elfsign/elfsign
+usr/src/cmd/cmd-crypto/etc/certs/SUNWObjectCA
+usr/src/cmd/cmd-crypto/kmfcfg/kmfcfg
+usr/src/cmd/cmd-crypto/kmscfg/kmscfg
+usr/src/cmd/cmd-crypto/pktool/pktool
+usr/src/cmd/cmd-crypto/tpmadm/tpmadm
+usr/src/cmd/cmd-inet/etc/datemsk.ndpd
+usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmtd
+usr/src/cmd/cmd-inet/lib/netcfgd/netcfgd
+usr/src/cmd/cmd-inet/lib/nwamd/nwamd
+usr/src/cmd/cmd-inet/sbin/dhcpagent/dhcpagent
+usr/src/cmd/cmd-inet/sbin/dhcpinfo/dhcpinfo
+usr/src/cmd/cmd-inet/sbin/ifparse/ifparse
+usr/src/cmd/cmd-inet/sbin/netstrategy/netstrategy
+usr/src/cmd/cmd-inet/usr.bin/chat/chat
+usr/src/cmd/cmd-inet/usr.bin/dns-sd
+usr/src/cmd/cmd-inet/usr.bin/finger
+usr/src/cmd/cmd-inet/usr.bin/ftp/ftp
+usr/src/cmd/cmd-inet/usr.bin/nc/nc
+usr/src/cmd/cmd-inet/usr.bin/nca/ncab2clf
+usr/src/cmd/cmd-inet/usr.bin/netstat/netstat
+usr/src/cmd/cmd-inet/usr.bin/pppd/pppd
+usr/src/cmd/cmd-inet/usr.bin/pppdump/THIRDPARTYLICENSE
+usr/src/cmd/cmd-inet/usr.bin/pppdump/pppdump
+usr/src/cmd/cmd-inet/usr.bin/pppstats/pppstats
+usr/src/cmd/cmd-inet/usr.bin/rcp
+usr/src/cmd/cmd-inet/usr.bin/rdate
+usr/src/cmd/cmd-inet/usr.bin/rdist/rdist
+usr/src/cmd/cmd-inet/usr.bin/rlogin
+usr/src/cmd/cmd-inet/usr.bin/rsh
+usr/src/cmd/cmd-inet/usr.bin/ruptime
+usr/src/cmd/cmd-inet/usr.bin/rwho
+usr/src/cmd/cmd-inet/usr.bin/talk/talk
+usr/src/cmd/cmd-inet/usr.bin/telnet/telnet
+usr/src/cmd/cmd-inet/usr.bin/tftp/tftp
+usr/src/cmd/cmd-inet/usr.bin/whois
+usr/src/cmd/cmd-inet/usr.lib/bridged/bridged
+usr/src/cmd/cmd-inet/usr.lib/dhcp/dhcpconfig
+usr/src/cmd/cmd-inet/usr.lib/dhcp/dhtadm
+usr/src/cmd/cmd-inet/usr.lib/dhcp/pntadm
+usr/src/cmd/cmd-inet/usr.lib/dsvclockd/dsvclockd
+usr/src/cmd/cmd-inet/usr.lib/ilbd/ilb/ilb_probe
+usr/src/cmd/cmd-inet/usr.lib/ilbd/ilbd
+usr/src/cmd/cmd-inet/usr.lib/in.chargend/in.chargend
+usr/src/cmd/cmd-inet/usr.lib/in.daytimed/in.daytimed
+usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/in.dhcpd
+usr/src/cmd/cmd-inet/usr.lib/in.discardd/in.discardd
+usr/src/cmd/cmd-inet/usr.lib/in.echod/in.echod
+usr/src/cmd/cmd-inet/usr.lib/in.mpathd/in.mpathd
+usr/src/cmd/cmd-inet/usr.lib/in.ndpd/in.ndpd
+usr/src/cmd/cmd-inet/usr.lib/in.ripngd/in.ripngd
+usr/src/cmd/cmd-inet/usr.lib/in.timed/in.timed
+usr/src/cmd/cmd-inet/usr.lib/inetd/inetd
+usr/src/cmd/cmd-inet/usr.lib/inetd/inetd-upgrade
+usr/src/cmd/cmd-inet/usr.lib/mdnsd/mdnsd
+usr/src/cmd/cmd-inet/usr.lib/ncaconfd/ncaconfd
+usr/src/cmd/cmd-inet/usr.lib/pppoe/pppoec
+usr/src/cmd/cmd-inet/usr.lib/pppoe/pppoed
+usr/src/cmd/cmd-inet/usr.lib/slpd/slpd
+usr/src/cmd/cmd-inet/usr.lib/vrrpd/vrrpd
+usr/src/cmd/cmd-inet/usr.lib/wanboot/encr/encr
+usr/src/cmd/cmd-inet/usr.lib/wanboot/hmac/hmac
+usr/src/cmd/cmd-inet/usr.lib/wanboot/ickey/ickey
+usr/src/cmd/cmd-inet/usr.lib/wanboot/keygen/keygen
+usr/src/cmd/cmd-inet/usr.lib/wanboot/keymgmt/keymgmt
+usr/src/cmd/cmd-inet/usr.lib/wanboot/netbootinfo/netbootinfo
+usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/p12split
+usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/wanboot-cgi
+usr/src/cmd/cmd-inet/usr.lib/wpad/wpad
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/SUNWbinfiles.jar
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/SUNWbinfiles.manifest
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/SUNWfiles.jar
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/SUNWfiles.manifest
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/bin/dhcpmgr
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/Bridge.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/BridgeException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/DsymException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/ExistsException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/HostExistsException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/InvalidPathException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/InvalidRsrcException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/NoDefaultsException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/NoEntryException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/NoHostsEntryException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/NoTableException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/NotRunningException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/TableExistsException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/WordexpException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/bridge/com_sun_dhcpmgr_bridge_Bridge.h
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/Console.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/DhcpCliFunction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/DhcpCliOption.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/DhcpCliOptions.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/DhcpCliPrint.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/DhcpCliProgram.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/Format.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/GetOpt.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/GetSubOpt.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/common/Util.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpbatch/DhcpBatch.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpbatch/DhcpCommand.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpbatch/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureBootp.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureDhcp.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureNetwork.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureService$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureService$Action.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureService$ActionDisable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureService$ActionEnable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureService$ActionImpl.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureService$ActionQuery.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureService$ActionReenable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConfigureService.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ConvertDataStore.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/DhcpCfg.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/DhcpCfgFunction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ExportData.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/IPAddressList.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ImportData.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ServerParameter$Action.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ServerParameter$ActionDelete.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ServerParameter$ActionGet.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ServerParameter$ActionGetAll.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ServerParameter$ActionImpl.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ServerParameter$ActionSet.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/ServerParameter.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhcpconfig/UnconfigureDhcp.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/AddEntry.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/CreateTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/DeleteEntry.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/DhtAdm.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/DhtAdmBatch.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/DhtAdmFunction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/DisplayTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/ModifyEntry.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/RemoveTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/dhtadm/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/AddClientEntry.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/CreateNetworkTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/DeleteClientEntry.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/DisplayNetworkTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ListNetworkTables.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ModifyClientEntry.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/PntAdm.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/PntAdmBatch.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/PntAdmFunction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/RemoveNetworkTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/cli/pntadm/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$10.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$11.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$5.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$6$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$6.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$7$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$7.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$8.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$9.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$AddressLoader$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$AddressLoader.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$AddressTableCellRenderer.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$AddressTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$DialogListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView$NetworkListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressView.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$2$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$Address.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$ConfigureStep$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$ConfigureStep$MacroListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$ConfigureStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$ConfirmStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$LeaseStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$NumberStep$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$NumberStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$ReviewStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$ServerStep$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$ServerStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard$WizardTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/AddressWizard.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$DnsStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$LeaseStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$NetTypeStep$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$NetTypeStep$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$NetTypeStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$NetworkStep$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$NetworkStep$NetworkComboBoxEditor.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$NetworkStep$NetworkListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$NetworkStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$NisStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard$ReviewStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigWizard.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigureChoiceDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConfigureRelayDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard$2$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard$ReviewStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard$SaveTablesStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ConvertWizard.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateAddressDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateAddressDialog$MacroListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateAddressDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateMacroDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateMacroDialog$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateMacroDialog$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateMacroDialog$4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateMacroDialog$MacroTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateMacroDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateOptionDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateOptionDialog$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateOptionDialog$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateOptionDialog$4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateOptionDialog$5.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateOptionDialog$6.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateOptionDialog$ClassListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/CreateOptionDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSModule.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSModuleEvent.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSModuleListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSWizard$DSConf.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSWizard$DSConfButton.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSWizard$DSConfList.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSWizard$DatastoreModuleStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSWizard$DatastoreStep$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSWizard$DatastoreStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DSWizard.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DataManager.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteAddressDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteAddressDialog$AddressTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteAddressDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteMacroDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog$4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog$5.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog$NetworkListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteNetworksDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DeleteOptionDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ConversionTransition.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ConvertAction$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ConvertAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$DisableAction$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$DisableAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$EnableAction$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$EnableAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ExportAction$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ExportAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$HowToAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ImportAction$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ImportAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$IndexAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ModifyServiceAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$OverviewAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$RestartAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$ServiceAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$StartAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$StopAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$UnconfigureServiceAction$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$UnconfigureServiceAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet$WizardTransition.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrApplet.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcpmgrDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcptabNameDocument.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DhcptabNameField.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DialogActions.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/DisableServiceDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ErrorTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ErrorTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$ErrorDisplay.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$FileStep$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$FileStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$MacroStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$NetworkStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$OptionStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$OverwritePrompter.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$ReviewStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard$WarningDisplay.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ExportWizard.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ImportWizard$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ImportWizard$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ImportWizard$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ImportWizard$ErrorDisplay.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ImportWizard$LocationStep$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ImportWizard$LocationStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ImportWizard$ReviewStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ImportWizard.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroLoader$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroLoader.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroNameField$MacroNameDocument.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroNameField.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$DialogListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$MacroTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$MacroTreeModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$MacroTreeNode.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView$MacroTreeRootNode.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MacroView.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ModifyAddressesDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ModifyAddressesDialog$MacroListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ModifyAddressesDialog$ServerListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ModifyAddressesDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MultipleOperationDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MultipleOperationDialog$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/MultipleOperationDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionNameField$OptionNameDocument.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionNameField.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$5.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$DialogListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$OptionLoader$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$OptionLoader.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView$OptionTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/OptionView.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/RelayView.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ReleaseAddressDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ReleaseAddressDialog$AddressTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ReleaseAddressDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SUNWModule$PathListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SUNWModule.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SUNWbinfiles/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SUNWbinfiles/SUNWbinfiles.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SUNWfiles/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SUNWfiles/SUNWfiles.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SelectOptionDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SelectOptionDialog$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SelectOptionDialog$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SelectOptionDialog$OptionTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/SelectOptionDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$5.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$6.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$7.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$8.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog$InterfaceTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ServerOptionsDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/UnconfigureDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/UnconfigureDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ViewMacroDialog$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ViewMacroDialog$MacroTableModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/client/ViewMacroDialog.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/ExportController.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/Exporter.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/ImportController.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/Importer.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/common/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/ActionError.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/AsciiOptionValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/BogusOptionValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/BooleanOptionValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcpClientFlagType.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcpClientFlagTypes.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcpClientRecord.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcpConfigOpts.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcpConfigOpts.java
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcpDatastore.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcpResource.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcpdOptions.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/DhcptabRecord.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/ExportHeader.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/IPAddress.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/IPInterface.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/IPOptionValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/IncludeOptionValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/Macro.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/Network.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/NumberOptionValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/NumberValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/OctetOptionValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/Option.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/OptionContext.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/OptionType.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/OptionValue.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/OptionValueFactory.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/OptionsTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/StandardOptions$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/StandardOptions.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/ValidationException.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/Qualifier.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierAnd.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierArray.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierBoolean.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierEnum.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierFQDN.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierIPv4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierIPv6.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierImpl.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierInteger.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierIntegerEnum.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierIntegerRange.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierOr.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierRange.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierString.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierStringEnum.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierType.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/data/qualifier/QualifierTypeImpl.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpMgr.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpMgrImpl.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgr.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpNetMgrImpl.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgr.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcpServiceMgrImpl.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcptabMgr.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/server/DhcptabMgrImpl.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ALIGNMENT.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/AutosizingTable.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ButtonLayout.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ButtonPanel$ButtonAdaptor.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ButtonPanel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ButtonPanelListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/DownButton.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ExtendedCellRenderer.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/FieldLayout$Row.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/FieldLayout.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/FixedSelectionModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/HelpIds.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/HostnameField$HostnameDocument.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/HostnameField.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IPAddressField$IPAddressDocument.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IPAddressField.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IPAddressList$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IPAddressList$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IPAddressList$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IPAddressList$IPAddressListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IPAddressList.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ImageButton.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IntegerField$IntegerDocument.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/IntegerField.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/LeftButton.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ListPair$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ListPair$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ListPair$3.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ListPair$4.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ListPair.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ListPairLayout.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$CreateAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$DeleteAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$DuplicateAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$ExitAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$FindPanel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$PropertiesAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$StatusBar.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$UpdateAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame$ViewSelectionListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MainFrame.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Mnemonic.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/MnemonicAction.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/NextButton.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/NoSpaceField$NoSpaceDocument.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/NoSpaceField.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/OurListModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/PreviousButton.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ProgressManager$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ProgressManager.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ProportionalLayout.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/ResourceStrings.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/RightButton.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/SelectionListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/SortedHeaderRenderer.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/SwingWorker$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/SwingWorker$2.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/SwingWorker.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/TableMap.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/TableSorter$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/TableSorter.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/UpButton.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/VerticalButtonLayout.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/View.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/WizButtonListener.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$1.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$1MyTextArea.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$WizButtonPanel$ButtonAdaptor.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$WizButtonPanel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$WizContentsPanel$ContentsModel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$WizContentsPanel$ContentsRenderer.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$WizContentsPanel$MyList.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$WizContentsPanel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard$WizStepPanel.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/Wizard.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/com/sun/dhcpmgr/ui/WizardStep.class
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/dhcpcli.jar
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/dhcpcommon.jar
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/dhcpmgr.jar
+usr/src/cmd/cmd-inet/usr.sadm/dhcpmgr/dhcpsvc.jar
+usr/src/cmd/cmd-inet/usr.sbin/6to4relay
+usr/src/cmd/cmd-inet/usr.sbin/THIRDPARTYLICENSE.arp
+usr/src/cmd/cmd-inet/usr.sbin/arp
+usr/src/cmd/cmd-inet/usr.sbin/bootconfchk/bootconfchk
+usr/src/cmd/cmd-inet/usr.sbin/dhcpconfig
+usr/src/cmd/cmd-inet/usr.sbin/dhtadm
+usr/src/cmd/cmd-inet/usr.sbin/gettable
+usr/src/cmd/cmd-inet/usr.sbin/hostconfig
+usr/src/cmd/cmd-inet/usr.sbin/htable/htable
+usr/src/cmd/cmd-inet/usr.sbin/htable/y.tab.h
+usr/src/cmd/cmd-inet/usr.sbin/if_mpadm
+usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig
+usr/src/cmd/cmd-inet/usr.sbin/ilbadm/ilbadm
+usr/src/cmd/cmd-inet/usr.sbin/in.comsat
+usr/src/cmd/cmd-inet/usr.sbin/in.fingerd
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/ckconfig
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/ftpaddhost
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/ftpcmd.c
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/ftpconfig
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/ftpcount
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/ftprestart
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/ftpshut
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/ftpwho
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/in.ftpd
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/privatepw
+usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/y.tab.h
+usr/src/cmd/cmd-inet/usr.sbin/in.rarpd
+usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/in.rdisc
+usr/src/cmd/cmd-inet/usr.sbin/in.rexecd
+usr/src/cmd/cmd-inet/usr.sbin/in.rlogind
+usr/src/cmd/cmd-inet/usr.sbin/in.routed/in.routed
+usr/src/cmd/cmd-inet/usr.sbin/in.routed/rtquery
+usr/src/cmd/cmd-inet/usr.sbin/in.rshd
+usr/src/cmd/cmd-inet/usr.sbin/in.rwhod
+usr/src/cmd/cmd-inet/usr.sbin/in.talkd/in.talkd
+usr/src/cmd/cmd-inet/usr.sbin/in.telnetd
+usr/src/cmd/cmd-inet/usr.sbin/in.tftpd
+usr/src/cmd/cmd-inet/usr.sbin/inetadm/inetadm
+usr/src/cmd/cmd-inet/usr.sbin/inetconv/inetconv
+usr/src/cmd/cmd-inet/usr.sbin/ipaddrsel
+usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm
+usr/src/cmd/cmd-inet/usr.sbin/ipmpstat/ipmpstat
+usr/src/cmd/cmd-inet/usr.sbin/ipqosconf/ipqosconf
+usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ikeadm
+usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ikecert
+usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ipsecalgs
+usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ipsecconf
+usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ipseckey
+usr/src/cmd/cmd-inet/usr.sbin/kssl/kssladm/kssladm
+usr/src/cmd/cmd-inet/usr.sbin/kssl/ksslcfg/ksslcfg
+usr/src/cmd/cmd-inet/usr.sbin/ndd
+usr/src/cmd/cmd-inet/usr.sbin/nwamadm/nwamadm
+usr/src/cmd/cmd-inet/usr.sbin/nwamcfg/nwamcfg
+usr/src/cmd/cmd-inet/usr.sbin/nwamcfg/nwamcfg_grammar.tab.c
+usr/src/cmd/cmd-inet/usr.sbin/nwamcfg/nwamcfg_grammar.tab.h
+usr/src/cmd/cmd-inet/usr.sbin/nwamcfg/nwamcfg_lex.c
+usr/src/cmd/cmd-inet/usr.sbin/ping/ping
+usr/src/cmd/cmd-inet/usr.sbin/pntadm
+usr/src/cmd/cmd-inet/usr.sbin/route
+usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm
+usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop
+usr/src/cmd/cmd-inet/usr.sbin/soconfig
+usr/src/cmd/cmd-inet/usr.sbin/sppptun/sppptun
+usr/src/cmd/cmd-inet/usr.sbin/syncinit
+usr/src/cmd/cmd-inet/usr.sbin/syncloop
+usr/src/cmd/cmd-inet/usr.sbin/syncstat
+usr/src/cmd/cmd-inet/usr.sbin/traceroute/traceroute
+usr/src/cmd/cmd-inet/usr.sbin/wanbootutil
+usr/src/cmd/cmd-inet/usr.sbin/wificonfig/wificonfig
+usr/src/cmd/col/col
+usr/src/cmd/compress/compress
+usr/src/cmd/consadm/i386/consadm
+usr/src/cmd/coreadm/coreadm
+usr/src/cmd/cpc/cpustat/cpustat
+usr/src/cmd/cpc/cputrack/amd64/cputrack
+usr/src/cmd/cpc/cputrack/i386/cputrack
+usr/src/cmd/cpio/cpio
+usr/src/cmd/cron/at
+usr/src/cmd/cron/at.xpg4
+usr/src/cmd/cron/atq
+usr/src/cmd/cron/atrm
+usr/src/cmd/cron/att1.c
+usr/src/cmd/cron/att1.h
+usr/src/cmd/cron/att2.c
+usr/src/cmd/cron/batch
+usr/src/cmd/cron/batch.xpg4
+usr/src/cmd/cron/cron
+usr/src/cmd/cron/crontab
+usr/src/cmd/cron/crontab.xpg4
+usr/src/cmd/cron/crontab.xpg6
+usr/src/cmd/crypt/crypt
+usr/src/cmd/csh/i386/csh
+usr/src/cmd/csh/sh.tconst.h
+usr/src/cmd/csplit/csplit
+usr/src/cmd/ctrun/ctrun
+usr/src/cmd/ctstat/ctstat
+usr/src/cmd/ctwatch/ctwatch
+usr/src/cmd/datadm/datadm
+usr/src/cmd/date/date
+usr/src/cmd/date/date.xpg4
+usr/src/cmd/dc/dc
+usr/src/cmd/dc/dc.xpg6
+usr/src/cmd/dd/dd
+usr/src/cmd/deroff/deroff
+usr/src/cmd/devctl/devctl
+usr/src/cmd/devfsadm/i386/devfsadm
+usr/src/cmd/devfsadm/i386/devlink.tab
+usr/src/cmd/devfsadm/plcysubr.c
+usr/src/cmd/devinfo/devinfo
+usr/src/cmd/devmgmt/cmds/devattr
+usr/src/cmd/devmgmt/cmds/devfree
+usr/src/cmd/devmgmt/cmds/devreserv
+usr/src/cmd/devmgmt/cmds/getdev
+usr/src/cmd/devmgmt/cmds/getdgrp
+usr/src/cmd/devmgmt/cmds/getvol
+usr/src/cmd/devmgmt/cmds/listdgrp
+usr/src/cmd/devmgmt/cmds/putdev
+usr/src/cmd/devmgmt/cmds/putdgrp
+usr/src/cmd/devmgmt/mkdtab/mkdtab
+usr/src/cmd/devprop/devprop
+usr/src/cmd/dfs.cmds/dfshares/dfshares
+usr/src/cmd/dfs.cmds/general/unshare
+usr/src/cmd/dfs.cmds/shareall/shareall
+usr/src/cmd/dfs.cmds/sharectl/i386/sharectl
+usr/src/cmd/dfs.cmds/sharectl/i386/shareutil.c
+usr/src/cmd/dfs.cmds/sharemgr/i386/sharemgr
+usr/src/cmd/dfs.cmds/unshareall/unshareall
+usr/src/cmd/diff/diff
+usr/src/cmd/diff/diff.dc
+usr/src/cmd/diff/diffh
+usr/src/cmd/diff3/diff3
+usr/src/cmd/diff3/diff3prog
+usr/src/cmd/diffmk/diffmk
+usr/src/cmd/dircmp/dircmp
+usr/src/cmd/dirname/dirname
+usr/src/cmd/dis/dis
+usr/src/cmd/diskscan/diskscan
+usr/src/cmd/dispadmin/FSSdispadmin
+usr/src/cmd/dispadmin/FXdispadmin
+usr/src/cmd/dispadmin/IAdispadmin
+usr/src/cmd/dispadmin/RTdispadmin
+usr/src/cmd/dispadmin/SDCdispadmin
+usr/src/cmd/dispadmin/TSdispadmin
+usr/src/cmd/dispadmin/dispadmin
+usr/src/cmd/dladm/dladm
+usr/src/cmd/dlmgmtd/dlmgmtd
+usr/src/cmd/dlstat/dlstat
+usr/src/cmd/dmesg/dmesg
+usr/src/cmd/dtrace/amd64/dtrace
+usr/src/cmd/dtrace/demo/applicat.d
+usr/src/cmd/dtrace/demo/badopen.d
+usr/src/cmd/dtrace/demo/begin.d
+usr/src/cmd/dtrace/demo/callout.d
+usr/src/cmd/dtrace/demo/clause.d
+usr/src/cmd/dtrace/demo/clear.d
+usr/src/cmd/dtrace/demo/countdown.d
+usr/src/cmd/dtrace/demo/counter.d
+usr/src/cmd/dtrace/demo/dateprof.d
+usr/src/cmd/dtrace/demo/delay.d
+usr/src/cmd/dtrace/demo/denorm.d
+usr/src/cmd/dtrace/demo/end.d
+usr/src/cmd/dtrace/demo/error.d
+usr/src/cmd/dtrace/demo/errorpath.d
+usr/src/cmd/dtrace/demo/find.d
+usr/src/cmd/dtrace/demo/firebird.d
+usr/src/cmd/dtrace/demo/hello.d
+usr/src/cmd/dtrace/demo/howlong.d
+usr/src/cmd/dtrace/demo/index.html
+usr/src/cmd/dtrace/demo/interp.d
+usr/src/cmd/dtrace/demo/interval.d
+usr/src/cmd/dtrace/demo/intr.d
+usr/src/cmd/dtrace/demo/iocpu.d
+usr/src/cmd/dtrace/demo/iosnoop.d
+usr/src/cmd/dtrace/demo/iothrough.d
+usr/src/cmd/dtrace/demo/iotime.d
+usr/src/cmd/dtrace/demo/ipio.d
+usr/src/cmd/dtrace/demo/ipproto.d
+usr/src/cmd/dtrace/demo/iprb.d
+usr/src/cmd/dtrace/demo/kstat.d
+usr/src/cmd/dtrace/demo/ksyms.d
+usr/src/cmd/dtrace/demo/libc.d
+usr/src/cmd/dtrace/demo/lquantize.d
+usr/src/cmd/dtrace/demo/lwptime.d
+usr/src/cmd/dtrace/demo/mkdemo
+usr/src/cmd/dtrace/demo/normalize.d
+usr/src/cmd/dtrace/demo/nscd.d
+usr/src/cmd/dtrace/demo/pri.d
+usr/src/cmd/dtrace/demo/printa.d
+usr/src/cmd/dtrace/demo/pritime.d
+usr/src/cmd/dtrace/demo/prof.d
+usr/src/cmd/dtrace/demo/profpri.d
+usr/src/cmd/dtrace/demo/progtime.d
+usr/src/cmd/dtrace/demo/putnext.d
+usr/src/cmd/dtrace/demo/qlen.d
+usr/src/cmd/dtrace/demo/qtime.d
+usr/src/cmd/dtrace/demo/renormalize.d
+usr/src/cmd/dtrace/demo/restest.d
+usr/src/cmd/dtrace/demo/ring.d
+usr/src/cmd/dtrace/demo/rtime.d
+usr/src/cmd/dtrace/demo/rwinfo.d
+usr/src/cmd/dtrace/demo/rwtime.d
+usr/src/cmd/dtrace/demo/sig.d
+usr/src/cmd/dtrace/demo/soffice.d
+usr/src/cmd/dtrace/demo/spec.d
+usr/src/cmd/dtrace/demo/specopen.d
+usr/src/cmd/dtrace/demo/ssd.d
+usr/src/cmd/dtrace/demo/syscall.d
+usr/src/cmd/dtrace/demo/tcp1stbyte.d
+usr/src/cmd/dtrace/demo/tcpbytes.d
+usr/src/cmd/dtrace/demo/tcpbytesstat.d
+usr/src/cmd/dtrace/demo/tcpconnlat.d
+usr/src/cmd/dtrace/demo/tcpio.d
+usr/src/cmd/dtrace/demo/tcpioflags.d
+usr/src/cmd/dtrace/demo/tcprst.d
+usr/src/cmd/dtrace/demo/tcpsnoop.d
+usr/src/cmd/dtrace/demo/tcpstate.d
+usr/src/cmd/dtrace/demo/tcptop.d
+usr/src/cmd/dtrace/demo/tick.d
+usr/src/cmd/dtrace/demo/ticktime.d
+usr/src/cmd/dtrace/demo/time.d
+usr/src/cmd/dtrace/demo/tracewrite.d
+usr/src/cmd/dtrace/demo/trunc.d
+usr/src/cmd/dtrace/demo/trussrw.d
+usr/src/cmd/dtrace/demo/udpbytes.d
+usr/src/cmd/dtrace/demo/udpbytesstat.d
+usr/src/cmd/dtrace/demo/udpio.d
+usr/src/cmd/dtrace/demo/udpsnoop.d
+usr/src/cmd/dtrace/demo/udptop.d
+usr/src/cmd/dtrace/demo/userfunc.d
+usr/src/cmd/dtrace/demo/whatfor.d
+usr/src/cmd/dtrace/demo/whatlock.d
+usr/src/cmd/dtrace/demo/where.d
+usr/src/cmd/dtrace/demo/whererun.d
+usr/src/cmd/dtrace/demo/whoexec.d
+usr/src/cmd/dtrace/demo/whofor.d
+usr/src/cmd/dtrace/demo/whoio.d
+usr/src/cmd/dtrace/demo/whopreempt.d
+usr/src/cmd/dtrace/demo/whoqueue.d
+usr/src/cmd/dtrace/demo/whosteal.d
+usr/src/cmd/dtrace/demo/whowrite.d
+usr/src/cmd/dtrace/demo/writes.d
+usr/src/cmd/dtrace/demo/writesbycmd.d
+usr/src/cmd/dtrace/demo/writesbycmdfd.d
+usr/src/cmd/dtrace/demo/writetime.d
+usr/src/cmd/dtrace/demo/writetimeq.d
+usr/src/cmd/dtrace/demo/xioctl.d
+usr/src/cmd/dtrace/demo/xterm.d
+usr/src/cmd/dtrace/demo/xwork.d
+usr/src/cmd/dtrace/i386/dtrace
+usr/src/cmd/dtrace/test/cmd/baddof/baddof
+usr/src/cmd/dtrace/test/cmd/badioctl/badioctl
+usr/src/cmd/dtrace/test/cmd/chkargs/amd64/chkargs
+usr/src/cmd/dtrace/test/cmd/chkargs/i386/chkargs
+usr/src/cmd/dtrace/test/cmd/jdtrace/classes/
+usr/src/cmd/dtrace/test/cmd/jdtrace/jdtrace
+usr/src/cmd/dtrace/test/cmd/jdtrace/lib/
+usr/src/cmd/dtrace/test/tst/common/io/tst.fds.exe
+usr/src/cmd/dtrace/test/tst/common/java_api/classes/
+usr/src/cmd/dtrace/test/tst/common/java_api/test.jar
+usr/src/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.exe
+usr/src/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.exe
+usr/src/cmd/dtrace/test/tst/common/nfs/tst.call.exe
+usr/src/cmd/dtrace/test/tst/common/nfs/tst.call3.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.args1.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.float.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.fork.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.gcc.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.ret1.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.ret2.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.vfork.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.weak1.exe
+usr/src/cmd/dtrace/test/tst/common/pid/tst.weak2.exe
+usr/src/cmd/dtrace/test/tst/common/proc/tst.sigwait.exe
+usr/src/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.exe
+usr/src/cmd/dtrace/test/tst/common/raise/tst.raise1.exe
+usr/src/cmd/dtrace/test/tst/common/raise/tst.raise2.exe
+usr/src/cmd/dtrace/test/tst/common/raise/tst.raise3.exe
+usr/src/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.exe
+usr/src/cmd/dtrace/test/tst/common/stop/tst.stop1.exe
+usr/src/cmd/dtrace/test/tst/common/stop/tst.stop2.exe
+usr/src/cmd/dtrace/test/tst/common/syscall/tst.args.exe
+usr/src/cmd/dtrace/test/tst/common/sysevent/tst.post.exe
+usr/src/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.exe
+usr/src/cmd/dtrace/test/tst/common/usdt/forker.h
+usr/src/cmd/dtrace/test/tst/common/usdt/tst.argmap.exe
+usr/src/cmd/dtrace/test/tst/common/usdt/tst.args.exe
+usr/src/cmd/dtrace/test/tst/common/usdt/tst.forker.exe
+usr/src/cmd/dtrace/test/tst/common/ustack/tst.bigstack.exe
+usr/src/cmd/dtrace/test/tst/common/ustack/tst.spin.exe
+usr/src/cmd/dtrace/test/tst/i386/pid/tst.badinstr.exe
+usr/src/cmd/dtrace/test/tst/i386/pid/tst.branch.exe
+usr/src/cmd/dtrace/test/tst/i386/pid/tst.embedded.exe
+usr/src/cmd/dtrace/test/tst/i386/pid/tst.ret.exe
+usr/src/cmd/dtrace/test/tst/i386/pid/tst.retlist.exe
+usr/src/cmd/dtrace/test/tst/i386/ustack/tst.annotated.exe
+usr/src/cmd/dtrace/test/tst/i386/ustack/tst.circstack.exe
+usr/src/cmd/dtrace/test/tst/i386/ustack/tst.helper.exe
+usr/src/cmd/du/du
+usr/src/cmd/du/du.po.xpg4
+usr/src/cmd/du/du.xpg4
+usr/src/cmd/dumpadm/dumpadm
+usr/src/cmd/dumpcs/dumpcs
+usr/src/cmd/echo/echo
+usr/src/cmd/ed/compile.c.i
+usr/src/cmd/ed/ed
+usr/src/cmd/ed/ed.xpg4
+usr/src/cmd/ed/ed.xpg6
+usr/src/cmd/eeprom/i386/eeprom
+usr/src/cmd/egrep/egrep
+usr/src/cmd/egrep/egrep.c
+usr/src/cmd/eject/eject
+usr/src/cmd/emul64ioctl/emul64ioctl
+usr/src/cmd/enhance/enhance
+usr/src/cmd/env/env
+usr/src/cmd/env/env.xpg4
+usr/src/cmd/eqn/eqn.d/e.c
+usr/src/cmd/eqn/eqn.d/e.def
+usr/src/cmd/eqn/eqn.d/eqn
+usr/src/cmd/eqn/neqn.d/e.c
+usr/src/cmd/eqn/neqn.d/e.def
+usr/src/cmd/eqn/neqn.d/neqn
+usr/src/cmd/expand/expand
+usr/src/cmd/expand/expand_cmd.c
+usr/src/cmd/expand/unexpand
+usr/src/cmd/expr/expr
+usr/src/cmd/expr/expr.xpg4
+usr/src/cmd/expr/expr.xpg6
+usr/src/cmd/exstr/exstr
+usr/src/cmd/factor/factor
+usr/src/cmd/false/false
+usr/src/cmd/fcinfo/fcinfo
+usr/src/cmd/fcoesvc/svc-fcoei
+usr/src/cmd/fcoesvc/svc-fcoet
+usr/src/cmd/fdetach/fdetach
+usr/src/cmd/fdformat/fdformat
+usr/src/cmd/fdisk/fdisk
+usr/src/cmd/fgrep/fgrep
+usr/src/cmd/file/file
+usr/src/cmd/file/file.xpg4
+usr/src/cmd/filebench/amd64/go_filebench
+usr/src/cmd/filebench/amd64/parser_gram.c
+usr/src/cmd/filebench/amd64/parser_gram.h
+usr/src/cmd/filebench/amd64/parser_lex.c
+usr/src/cmd/filebench/fbscript/filebench
+usr/src/cmd/filebench/i386/go_filebench
+usr/src/cmd/filebench/i386/parser_gram.c
+usr/src/cmd/filebench/i386/parser_gram.h
+usr/src/cmd/filebench/i386/parser_lex.c
+usr/src/cmd/filebench/scripts/filebench_compare
+usr/src/cmd/filebench/scripts/fs_flush
+usr/src/cmd/filesync/filesync
+usr/src/cmd/find/find
+usr/src/cmd/find/find.xpg4
+usr/src/cmd/flowadm/flowadm
+usr/src/cmd/flowstat/flowstat
+usr/src/cmd/fm/dicts/AMD.mo
+usr/src/cmd/fm/dicts/DISK.mo
+usr/src/cmd/fm/dicts/FMD.mo
+usr/src/cmd/fm/dicts/FMNOTIFY.mo
+usr/src/cmd/fm/dicts/GMCA.mo
+usr/src/cmd/fm/dicts/INTEL.mo
+usr/src/cmd/fm/dicts/NXGE.mo
+usr/src/cmd/fm/dicts/PCI.mo
+usr/src/cmd/fm/dicts/PCIEX.mo
+usr/src/cmd/fm/dicts/SCA1000.mo
+usr/src/cmd/fm/dicts/SCA500.mo
+usr/src/cmd/fm/dicts/SENSOR.mo
+usr/src/cmd/fm/dicts/SMF.mo
+usr/src/cmd/fm/dicts/STORAGE.mo
+usr/src/cmd/fm/dicts/SUNOS.mo
+usr/src/cmd/fm/dicts/TEST.mo
+usr/src/cmd/fm/dicts/ZFS.mo
+usr/src/cmd/fm/eversholt/eftinfo/i386/eftinfo
+usr/src/cmd/fm/eversholt/eftinfo/i386/y.output
+usr/src/cmd/fm/eversholt/eftinfo/i386/y.tab.c
+usr/src/cmd/fm/eversholt/eftinfo/i386/y.tab.h
+usr/src/cmd/fm/eversholt/esc/i386/esc
+usr/src/cmd/fm/eversholt/esc/i386/y.output
+usr/src/cmd/fm/eversholt/esc/i386/y.tab.c
+usr/src/cmd/fm/eversholt/esc/i386/y.tab.h
+usr/src/cmd/fm/eversholt/files/i386/disk.eft
+usr/src/cmd/fm/eversholt/files/i386/i86pc/amd64.eft
+usr/src/cmd/fm/eversholt/files/i386/i86pc/gcpu.eft
+usr/src/cmd/fm/eversholt/files/i386/i86pc/gcpu_amd.eft
+usr/src/cmd/fm/eversholt/files/i386/i86pc/intel.eft
+usr/src/cmd/fm/eversholt/files/i386/neptune_xaui.eft
+usr/src/cmd/fm/eversholt/files/i386/neptune_xfp.eft
+usr/src/cmd/fm/eversholt/files/i386/pci.eft
+usr/src/cmd/fm/eversholt/files/i386/pciex.eft
+usr/src/cmd/fm/eversholt/files/i386/pciexrc.eft
+usr/src/cmd/fm/eversholt/files/i386/sca1000.eft
+usr/src/cmd/fm/eversholt/files/i386/sca500.eft
+usr/src/cmd/fm/eversholt/files/i386/sensor.eft
+usr/src/cmd/fm/eversholt/files/i386/storage.eft
+usr/src/cmd/fm/fmadm/i386/fmadm
+usr/src/cmd/fm/fmd/common/fmd_error.c
+usr/src/cmd/fm/fmd/common/fmd_rpc_adm.h
+usr/src/cmd/fm/fmd/common/fmd_rpc_api.h
+usr/src/cmd/fm/fmd/i386/fmd
+usr/src/cmd/fm/fmd/i386/fmd_svc_adm.c
+usr/src/cmd/fm/fmd/i386/fmd_svc_api.c
+usr/src/cmd/fm/fmd/i386/fmd_xdr_adm.c
+usr/src/cmd/fm/fmd/i386/fmd_xdr_api.c
+usr/src/cmd/fm/fmdump/i386/fmdump
+usr/src/cmd/fm/fminject/i386/fminject
+usr/src/cmd/fm/fminject/i386/inj_grammar.c
+usr/src/cmd/fm/fminject/i386/inj_grammar.h
+usr/src/cmd/fm/fminject/i386/inj_lex.c
+usr/src/cmd/fm/fmstat/i386/fmstat
+usr/src/cmd/fm/fmtopo/i386/fmtopo
+usr/src/cmd/fm/ipmitopo/i386/ipmitopo
+usr/src/cmd/fm/modules/common/eversholt/y.tab.c
+usr/src/cmd/fm/modules/common/eversholt/y.tab.h
+usr/src/cmd/fm/notify/smtp-notify/i386/process_msg_template.sh
+usr/src/cmd/fm/notify/smtp-notify/i386/smtp-notify
+usr/src/cmd/fm/notify/snmp-notify/i386/snmp-notify
+usr/src/cmd/fm/scripts/buildcode
+usr/src/cmd/fm/scripts/bustcode
+usr/src/cmd/fm/scripts/dictck
+usr/src/cmd/fm/scripts/fmsim
+usr/src/cmd/fmt/fmt
+usr/src/cmd/fmthard/fmthard
+usr/src/cmd/fmtmsg/fmtmsg
+usr/src/cmd/fold/fold
+usr/src/cmd/format/format
+usr/src/cmd/fs.d/autofs/automount
+usr/src/cmd/fs.d/autofs/automountd
+usr/src/cmd/fs.d/autofs/dfshares
+usr/src/cmd/fs.d/autofs/mount
+usr/src/cmd/fs.d/autofs/share
+usr/src/cmd/fs.d/autofs/unshare
+usr/src/cmd/fs.d/autofs/webnfs.h
+usr/src/cmd/fs.d/autofs/webnfs.x
+usr/src/cmd/fs.d/autofs/webnfs_client.c
+usr/src/cmd/fs.d/autofs/webnfs_xdr.c
+usr/src/cmd/fs.d/cachefs/cachefslog/cachefslog
+usr/src/cmd/fs.d/cachefs/cachefspack/cachefspack
+usr/src/cmd/fs.d/cachefs/cachefsstat/cachefsstat
+usr/src/cmd/fs.d/cachefs/cachefswssize/cachefswssize
+usr/src/cmd/fs.d/cachefs/cfsadmin/cfsadmin
+usr/src/cmd/fs.d/cachefs/cfsd/cachefsd
+usr/src/cmd/fs.d/cachefs/cfsd/cachefsd_tbl.i
+usr/src/cmd/fs.d/cachefs/cfsfstype/cfsfstype
+usr/src/cmd/fs.d/cachefs/cfstagchk/cfstagchk
+usr/src/cmd/fs.d/cachefs/common/cachefsd.h
+usr/src/cmd/fs.d/cachefs/common/cachefsd_clnt.c
+usr/src/cmd/fs.d/cachefs/common/cachefsd_xdr.c
+usr/src/cmd/fs.d/cachefs/dfshares/dfshares
+usr/src/cmd/fs.d/cachefs/fsck/fsck
+usr/src/cmd/fs.d/cachefs/mount/mount
+usr/src/cmd/fs.d/cachefs/share/share
+usr/src/cmd/fs.d/cachefs/umount/umount
+usr/src/cmd/fs.d/cachefs/unshare/unshare
+usr/src/cmd/fs.d/clri
+usr/src/cmd/fs.d/ctfs/mount
+usr/src/cmd/fs.d/dev/mount
+usr/src/cmd/fs.d/df
+usr/src/cmd/fs.d/df.po.xpg4
+usr/src/cmd/fs.d/df.xpg4
+usr/src/cmd/fs.d/fd/mount
+usr/src/cmd/fs.d/ff
+usr/src/cmd/fs.d/fs.dfl
+usr/src/cmd/fs.d/fsck
+usr/src/cmd/fs.d/hsfs/labelit/labelit
+usr/src/cmd/fs.d/hsfs/mount/mount
+usr/src/cmd/fs.d/lofs/mount/mount
+usr/src/cmd/fs.d/mntfs/mount
+usr/src/cmd/fs.d/mnttab
+usr/src/cmd/fs.d/mount
+usr/src/cmd/fs.d/nfs/clear_locks/clear_locks
+usr/src/cmd/fs.d/nfs/dfmounts/dfmounts
+usr/src/cmd/fs.d/nfs/dfshares/dfshares
+usr/src/cmd/fs.d/nfs/exportfs/exportfs
+usr/src/cmd/fs.d/nfs/mount/mount
+usr/src/cmd/fs.d/nfs/mount/webnfs.h
+usr/src/cmd/fs.d/nfs/mount/webnfs.x
+usr/src/cmd/fs.d/nfs/mount/webnfs_client.c
+usr/src/cmd/fs.d/nfs/mount/webnfs_xdr.c
+usr/src/cmd/fs.d/nfs/mountd/mountd
+usr/src/cmd/fs.d/nfs/nfs4cbd/nfs4cbd
+usr/src/cmd/fs.d/nfs/nfsd/nfsd
+usr/src/cmd/fs.d/nfs/nfsfind/nfsfind
+usr/src/cmd/fs.d/nfs/nfslog/nfslogd
+usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid
+usr/src/cmd/fs.d/nfs/nfsmapid/nfsmapid_test
+usr/src/cmd/fs.d/nfs/nfsref/nfsref
+usr/src/cmd/fs.d/nfs/nfsstat/nfsstat
+usr/src/cmd/fs.d/nfs/rquotad/rquota_xdr.c
+usr/src/cmd/fs.d/nfs/rquotad/rquotad
+usr/src/cmd/fs.d/nfs/share/sharetab
+usr/src/cmd/fs.d/nfs/showmount/showmount
+usr/src/cmd/fs.d/nfs/statd/statd
+usr/src/cmd/fs.d/nfs/umount/umount
+usr/src/cmd/fs.d/objfs/mount
+usr/src/cmd/fs.d/pcfs/fsck/fsck
+usr/src/cmd/fs.d/pcfs/mkfs/mkfs
+usr/src/cmd/fs.d/pcfs/mount/mount
+usr/src/cmd/fs.d/proc/mount
+usr/src/cmd/fs.d/reparsed/reparsed
+usr/src/cmd/fs.d/sharefs/mount
+usr/src/cmd/fs.d/smbclnt/chacl/chacl
+usr/src/cmd/fs.d/smbclnt/lsacl/lsacl
+usr/src/cmd/fs.d/smbclnt/mount/mount
+usr/src/cmd/fs.d/smbclnt/share/dfshares
+usr/src/cmd/fs.d/smbclnt/share/share
+usr/src/cmd/fs.d/smbclnt/share/unshare
+usr/src/cmd/fs.d/smbclnt/smbiod-svc/smbiod-svc
+usr/src/cmd/fs.d/smbclnt/smbiod/smbiod
+usr/src/cmd/fs.d/smbclnt/smbutil/smbutil
+usr/src/cmd/fs.d/smbclnt/umount/umount
+usr/src/cmd/fs.d/tmpfs/mount
+usr/src/cmd/fs.d/udfs/fsck/fsck
+usr/src/cmd/fs.d/udfs/fsdb/fsdb
+usr/src/cmd/fs.d/udfs/fsdb/lex.yy.c
+usr/src/cmd/fs.d/udfs/fsdb/ud_lib.c
+usr/src/cmd/fs.d/udfs/fsdb/ud_lib.h
+usr/src/cmd/fs.d/udfs/fsdb/y.tab.c
+usr/src/cmd/fs.d/udfs/fsdb/y.tab.h
+usr/src/cmd/fs.d/udfs/labelit/labelit
+usr/src/cmd/fs.d/udfs/labelit/ud_lib.c
+usr/src/cmd/fs.d/udfs/labelit/ud_lib.h
+usr/src/cmd/fs.d/udfs/mkfs/mkfs
+usr/src/cmd/fs.d/udfs/mount/mount
+usr/src/cmd/fs.d/ufs/clri/clri
+usr/src/cmd/fs.d/ufs/df/df
+usr/src/cmd/fs.d/ufs/edquota/edquota
+usr/src/cmd/fs.d/ufs/ff/ff
+usr/src/cmd/fs.d/ufs/fsck/fsck
+usr/src/cmd/fs.d/ufs/fsckall/fsckall
+usr/src/cmd/fs.d/ufs/fsdb/fsdb
+usr/src/cmd/fs.d/ufs/fsirand/fsirand
+usr/src/cmd/fs.d/ufs/fssnap/fssnap
+usr/src/cmd/fs.d/ufs/labelit/labelit
+usr/src/cmd/fs.d/ufs/lockfs/lockfs
+usr/src/cmd/fs.d/ufs/mkfs/mkfs
+usr/src/cmd/fs.d/ufs/mount/mount
+usr/src/cmd/fs.d/ufs/ncheck/ncheck
+usr/src/cmd/fs.d/ufs/newfs/newfs
+usr/src/cmd/fs.d/ufs/quot/quot
+usr/src/cmd/fs.d/ufs/quota/quota
+usr/src/cmd/fs.d/ufs/quota/rquota_xdr.c
+usr/src/cmd/fs.d/ufs/quotacheck/quotacheck
+usr/src/cmd/fs.d/ufs/quotaon/quotaon
+usr/src/cmd/fs.d/ufs/repquota/repquota
+usr/src/cmd/fs.d/ufs/tunefs/tunefs
+usr/src/cmd/fs.d/ufs/volcopy/volcopy
+usr/src/cmd/fs.d/umount
+usr/src/cmd/fs.d/volcopy
+usr/src/cmd/fs.d/zfs/bootinstall/bootinstall
+usr/src/cmd/fstyp/fstyp
+usr/src/cmd/fuser/fuser
+usr/src/cmd/fwflash/i386/fwflash
+usr/src/cmd/gcore/amd64/gcore
+usr/src/cmd/gcore/i386/gcore
+usr/src/cmd/gencat/gencat
+usr/src/cmd/geniconvtbl/i386/geniconvtbl
+usr/src/cmd/geniconvtbl/i386/lex.yy.c
+usr/src/cmd/geniconvtbl/i386/y.output
+usr/src/cmd/geniconvtbl/i386/y.tab.c
+usr/src/cmd/geniconvtbl/i386/y.tab.h
+usr/src/cmd/geniconvtbl/itm_comp.c
+usr/src/cmd/geniconvtbl/native/geniconvtbl
+usr/src/cmd/geniconvtbl/native/lex.yy.c
+usr/src/cmd/geniconvtbl/native/y.output
+usr/src/cmd/geniconvtbl/native/y.tab.c
+usr/src/cmd/geniconvtbl/native/y.tab.h
+usr/src/cmd/geniconvtbl/samples/ISO646%ISO8859-1.bt
+usr/src/cmd/geniconvtbl/samples/ISO8859-1%ISO646.bt
+usr/src/cmd/genmsg/genmsg
+usr/src/cmd/genmsg/genmsg.c
+usr/src/cmd/genmsg/lex.yy.c
+usr/src/cmd/genmsg/y.tab.h
+usr/src/cmd/getconf/getconf
+usr/src/cmd/getconf/getconf.xpg4
+usr/src/cmd/getconf/getconf.xpg6
+usr/src/cmd/getdevpolicy/getdevpolicy
+usr/src/cmd/getent/getent
+usr/src/cmd/getfacl/getfacl
+usr/src/cmd/getmajor/getmajor
+usr/src/cmd/getopt/getopt
+usr/src/cmd/getopt/getoptcvt
+usr/src/cmd/gettext/gettext
+usr/src/cmd/gettxt/gettxt
+usr/src/cmd/grep/grep
+usr/src/cmd/grep_xpg4/grep.xpg4
+usr/src/cmd/groups/groups
+usr/src/cmd/grpck/grpck
+usr/src/cmd/gss/etc/dummy_mech_token.conf
+usr/src/cmd/gss/gsscred/gsscred
+usr/src/cmd/gss/gsscred_clean/gsscred_clean
+usr/src/cmd/gss/gssd/gssd
+usr/src/cmd/gss/gssd/gssd.h
+usr/src/cmd/gss/gssd/gssd.x
+usr/src/cmd/gss/gssd/gssd_clnt.c
+usr/src/cmd/gss/gssd/gssd_svc.c
+usr/src/cmd/gss/gssd/gssd_xdr.c
+usr/src/cmd/gss/gssd/gssdtest
+usr/src/cmd/hal/addons/acpi/hald-addon-acpi
+usr/src/cmd/hal/addons/cpufreq/hald-addon-cpufreq
+usr/src/cmd/hal/addons/network-devices/hald-addon-network-discovery
+usr/src/cmd/hal/addons/storage/hald-addon-storage
+usr/src/cmd/hal/hal.conf
+usr/src/cmd/hal/hald-runner/hald-runner
+usr/src/cmd/hal/hald/hald
+usr/src/cmd/hal/hald/hald_marshal.c
+usr/src/cmd/hal/hald/hald_marshal.h
+usr/src/cmd/hal/probing/acpi/hald-probe-acpi
+usr/src/cmd/hal/probing/network-printer/hald-probe-network-printer
+usr/src/cmd/hal/probing/printer/hald-probe-printer
+usr/src/cmd/hal/probing/storage/hald-probe-storage
+usr/src/cmd/hal/probing/volume/hald-probe-volume
+usr/src/cmd/hal/probing/xkb/hald-probe-xkb
+usr/src/cmd/hal/tools/hal-device
+usr/src/cmd/hal/tools/hal-fdi-validate
+usr/src/cmd/hal/tools/hal-find-by-capability
+usr/src/cmd/hal/tools/hal-find-by-property
+usr/src/cmd/hal/tools/hal-functions
+usr/src/cmd/hal/tools/hal-get-property
+usr/src/cmd/hal/tools/hal-is-caller-privileged
+usr/src/cmd/hal/tools/hal-set-property
+usr/src/cmd/hal/tools/hal-storage-cleanup-all-mountpoints
+usr/src/cmd/hal/tools/hal-storage-cleanup-mountpoint
+usr/src/cmd/hal/tools/hal-storage-closetray
+usr/src/cmd/hal/tools/hal-storage-eject
+usr/src/cmd/hal/tools/hal-storage-mount
+usr/src/cmd/hal/tools/hal-storage-unmount
+usr/src/cmd/hal/tools/hal-storage-zpool-export
+usr/src/cmd/hal/tools/hal-storage-zpool-import
+usr/src/cmd/hal/tools/hal-system-lcd-get-brightness
+usr/src/cmd/hal/tools/hal-system-lcd-set-brightness
+usr/src/cmd/hal/tools/hal-system-power-hibernate
+usr/src/cmd/hal/tools/hal-system-power-reboot
+usr/src/cmd/hal/tools/hal-system-power-shutdown
+usr/src/cmd/hal/tools/hal-system-power-suspend
+usr/src/cmd/hal/tools/lshal
+usr/src/cmd/hal/tools/sunos/hal-system-lcd-get-brightness-sunos
+usr/src/cmd/hal/tools/sunos/hal-system-lcd-set-brightness-sunos
+usr/src/cmd/hal/tools/sunos/hal-system-power-hibernate-sunos
+usr/src/cmd/hal/tools/sunos/hal-system-power-reboot-sunos
+usr/src/cmd/hal/tools/sunos/hal-system-power-shutdown-sunos
+usr/src/cmd/hal/tools/sunos/hal-system-power-suspend-sunos
+usr/src/cmd/halt/halt
+usr/src/cmd/head/head
+usr/src/cmd/hostid/hostid
+usr/src/cmd/hostname/hostname
+usr/src/cmd/hotplug/hotplug
+usr/src/cmd/hotplugd/hotplugd
+usr/src/cmd/hwdata/THIRDPARTYLICENSE.pciids
+usr/src/cmd/ibd_upgrade/ibd_delete_link
+usr/src/cmd/ibd_upgrade/ibd_upgrade
+usr/src/cmd/id/id
+usr/src/cmd/id/id.xpg4
+usr/src/cmd/idmap/idmap/idmap
+usr/src/cmd/idmap/idmapd/idmapd
+usr/src/cmd/infocmp/infocmp
+usr/src/cmd/init/init
+usr/src/cmd/initpkg/dfstab
+usr/src/cmd/initpkg/mountall
+usr/src/cmd/initpkg/rc0
+usr/src/cmd/initpkg/rc1
+usr/src/cmd/initpkg/rc2
+usr/src/cmd/initpkg/rc3
+usr/src/cmd/initpkg/rcS
+usr/src/cmd/initpkg/shutdown
+usr/src/cmd/initpkg/swapadd
+usr/src/cmd/initpkg/umountall
+usr/src/cmd/initpkg/vfstab
+usr/src/cmd/install.d/install.d
+usr/src/cmd/intrd/intrd
+usr/src/cmd/intrstat/amd64/intrstat
+usr/src/cmd/intrstat/i386/intrstat
+usr/src/cmd/ipcrm/ipcrm
+usr/src/cmd/ipcs/ipcs
+usr/src/cmd/ipf/examples/mkfilters
+usr/src/cmd/ipf/svc/svc.ipfd
+usr/src/cmd/ipf/tools/amd64/ipf
+usr/src/cmd/ipf/tools/amd64/ipf.tab.c
+usr/src/cmd/ipf/tools/amd64/ipf.tab.h
+usr/src/cmd/ipf/tools/amd64/ipfs
+usr/src/cmd/ipf/tools/amd64/ipfstat
+usr/src/cmd/ipf/tools/amd64/ipftest
+usr/src/cmd/ipf/tools/amd64/ipmon
+usr/src/cmd/ipf/tools/amd64/ipmon.tab.c
+usr/src/cmd/ipf/tools/amd64/ipmon.tab.h
+usr/src/cmd/ipf/tools/amd64/ipnat
+usr/src/cmd/ipf/tools/amd64/ipnat.tab.c
+usr/src/cmd/ipf/tools/amd64/ipnat.tab.h
+usr/src/cmd/ipf/tools/amd64/ippool
+usr/src/cmd/ipf/tools/amd64/ippool.tab.c
+usr/src/cmd/ipf/tools/amd64/ippool.tab.h
+usr/src/cmd/ipf/tools/i386/ipf
+usr/src/cmd/ipf/tools/i386/ipf.tab.c
+usr/src/cmd/ipf/tools/i386/ipf.tab.h
+usr/src/cmd/ipf/tools/i386/ipfs
+usr/src/cmd/ipf/tools/i386/ipfstat
+usr/src/cmd/ipf/tools/i386/ipftest
+usr/src/cmd/ipf/tools/i386/ipmon
+usr/src/cmd/ipf/tools/i386/ipmon.tab.c
+usr/src/cmd/ipf/tools/i386/ipmon.tab.h
+usr/src/cmd/ipf/tools/i386/ipnat
+usr/src/cmd/ipf/tools/i386/ipnat.tab.c
+usr/src/cmd/ipf/tools/i386/ipnat.tab.h
+usr/src/cmd/ipf/tools/i386/ippool
+usr/src/cmd/ipf/tools/i386/ippool.tab.c
+usr/src/cmd/ipf/tools/i386/ippool.tab.h
+usr/src/cmd/ipf/tools/ipf_l.c
+usr/src/cmd/ipf/tools/ipf_l.h
+usr/src/cmd/ipf/tools/ipf_y.c
+usr/src/cmd/ipf/tools/ipf_y.h
+usr/src/cmd/ipf/tools/ipmon_l.c
+usr/src/cmd/ipf/tools/ipmon_l.h
+usr/src/cmd/ipf/tools/ipmon_y.c
+usr/src/cmd/ipf/tools/ipmon_y.h
+usr/src/cmd/ipf/tools/ipnat_l.c
+usr/src/cmd/ipf/tools/ipnat_l.h
+usr/src/cmd/ipf/tools/ipnat_y.c
+usr/src/cmd/ipf/tools/ipnat_y.h
+usr/src/cmd/ipf/tools/ippool_l.c
+usr/src/cmd/ipf/tools/ippool_l.h
+usr/src/cmd/ipf/tools/ippool_y.c
+usr/src/cmd/ipf/tools/ippool_y.h
+usr/src/cmd/isaexec/isaexec
+usr/src/cmd/isainfo/isainfo
+usr/src/cmd/isalist/isalist
+usr/src/cmd/isalist/optisa
+usr/src/cmd/iscsiadm/iscsiadm
+usr/src/cmd/iscsid/iscsid
+usr/src/cmd/iscsitsvc/iscsi-target
+usr/src/cmd/isns/isnsadm/isnsadm
+usr/src/cmd/isns/isnsd/isns
+usr/src/cmd/isns/isnsd/isns_provider.h
+usr/src/cmd/itadm/itadm
+usr/src/cmd/itutools/itu
+usr/src/cmd/itutools/mkbootmedia
+usr/src/cmd/itutools/pkg2du
+usr/src/cmd/itutools/updatemedia
+usr/src/cmd/kbd/kbd
+usr/src/cmd/keyserv/chkey
+usr/src/cmd/keyserv/domainname
+usr/src/cmd/keyserv/keylogin
+usr/src/cmd/keyserv/keylogout
+usr/src/cmd/keyserv/keyserv
+usr/src/cmd/keyserv/newkey
+usr/src/cmd/killall/killall
+usr/src/cmd/krb5/kadmin/cli/k5srvutil
+usr/src/cmd/krb5/kadmin/cli/kadmin
+usr/src/cmd/krb5/kadmin/cli/kadmin.local
+usr/src/cmd/krb5/kadmin/dbutil/iprop.h
+usr/src/cmd/krb5/kadmin/dbutil/kdb5_util
+usr/src/cmd/krb5/kadmin/kclient/kclient
+usr/src/cmd/krb5/kadmin/kclient/kconf
+usr/src/cmd/krb5/kadmin/kclient/kdyndns
+usr/src/cmd/krb5/kadmin/kclient/ksetpw
+usr/src/cmd/krb5/kadmin/kclient/ksmb
+usr/src/cmd/krb5/kadmin/kdcmgr/kdcmgr
+usr/src/cmd/krb5/kadmin/kdcmgr/klookup
+usr/src/cmd/krb5/kadmin/kpasswd/kpasswd
+usr/src/cmd/krb5/kadmin/ktutil/ktutil
+usr/src/cmd/krb5/kadmin/server/iprop.h
+usr/src/cmd/krb5/kadmin/server/iprop_xdr.c
+usr/src/cmd/krb5/kadmin/server/kadmind
+usr/src/cmd/krb5/kdestroy/kdestroy
+usr/src/cmd/krb5/kinit/kinit
+usr/src/cmd/krb5/klist/klist
+usr/src/cmd/krb5/kproplog/iprop.h
+usr/src/cmd/krb5/kproplog/iprop_xdr.c
+usr/src/cmd/krb5/kproplog/kproplog
+usr/src/cmd/krb5/krb5-config/krb5-config
+usr/src/cmd/krb5/krb5kdc/krb5kdc
+usr/src/cmd/krb5/kwarn/ktkt_warnd
+usr/src/cmd/krb5/kwarn/kwarnd.h
+usr/src/cmd/krb5/kwarn/kwarnd_svc.c
+usr/src/cmd/krb5/kwarn/kwarnd_xdr.c
+usr/src/cmd/krb5/ldap_util/kdb5_ldap_util
+usr/src/cmd/krb5/slave/iprop.h
+usr/src/cmd/krb5/slave/iprop_xdr.c
+usr/src/cmd/krb5/slave/kprop
+usr/src/cmd/krb5/slave/kprop_script
+usr/src/cmd/krb5/slave/kpropd
+usr/src/cmd/ksh/amd64/ksh
+usr/src/cmd/ksh/amd64/ksh93
+usr/src/cmd/ksh/builtins/alias
+usr/src/cmd/ksh/i386/ksh
+usr/src/cmd/ksh/i386/ksh93
+usr/src/cmd/kstat/kstat
+usr/src/cmd/kvmstat/kvmstat
+usr/src/cmd/last/last
+usr/src/cmd/last/wtmpx
+usr/src/cmd/lastcomm/lastcomm
+usr/src/cmd/ldap/i386/idsconfig
+usr/src/cmd/ldap/i386/ldapaddent
+usr/src/cmd/ldap/i386/ldapclient
+usr/src/cmd/ldap/i386/ldapdelete
+usr/src/cmd/ldap/i386/ldaplist
+usr/src/cmd/ldap/i386/ldapmodify
+usr/src/cmd/ldap/i386/ldapmodrdn
+usr/src/cmd/ldap/i386/ldapsearch
+usr/src/cmd/ldapcachemgr/ldap_cachemgr
+usr/src/cmd/lgrpinfo/lgrpinfo
+usr/src/cmd/line/line
+usr/src/cmd/link/link
+usr/src/cmd/link/link.xpg4
+usr/src/cmd/listen/listen
+usr/src/cmd/listen/nlps_server
+usr/src/cmd/lms/lms
+usr/src/cmd/loadkeys/dumpkeys
+usr/src/cmd/loadkeys/loadkeys
+usr/src/cmd/loadkeys/loadkeys.c
+usr/src/cmd/locale/amd64/locale
+usr/src/cmd/locale/i386/locale
+usr/src/cmd/localedef/8859-1.cm
+usr/src/cmd/localedef/8859-11.cm
+usr/src/cmd/localedef/8859-13.cm
+usr/src/cmd/localedef/8859-15.cm
+usr/src/cmd/localedef/8859-2.cm
+usr/src/cmd/localedef/8859-5.cm
+usr/src/cmd/localedef/8859-6.cm
+usr/src/cmd/localedef/8859-7.cm
+usr/src/cmd/localedef/8859-9.cm
+usr/src/cmd/localedef/KOI8-R.cm
+usr/src/cmd/localedef/UTF-8.cm
+usr/src/cmd/localedef/locale/
+usr/src/cmd/localedef/localedef
+usr/src/cmd/localedef/parser.tab.c
+usr/src/cmd/localedef/parser.tab.h
+usr/src/cmd/locator/locator
+usr/src/cmd/lockstat/amd64/lockstat
+usr/src/cmd/lockstat/i386/lockstat
+usr/src/cmd/lofiadm/lofiadm
+usr/src/cmd/logadm/logadm
+usr/src/cmd/logger/logger
+usr/src/cmd/login/login
+usr/src/cmd/login/logindevperm
+usr/src/cmd/logins/logins
+usr/src/cmd/look/look
+usr/src/cmd/ls/amd64/ls
+usr/src/cmd/ls/amd64/ls.xpg4
+usr/src/cmd/ls/amd64/ls.xpg6
+usr/src/cmd/ls/i386/ls
+usr/src/cmd/ls/i386/ls.xpg4
+usr/src/cmd/ls/i386/ls.xpg6
+usr/src/cmd/ls/ls.dc
+usr/src/cmd/luxadm/luxadm
+usr/src/cmd/mach/mach
+usr/src/cmd/machid/machid
+usr/src/cmd/mail/mail
+usr/src/cmd/mailx/mailx
+usr/src/cmd/mailx/mailx.help
+usr/src/cmd/mailx/mailx.help.~
+usr/src/cmd/makekey/makekey
+usr/src/cmd/man/src/apropos
+usr/src/cmd/man/src/catman
+usr/src/cmd/man/src/getNAME
+usr/src/cmd/man/src/makewhatis
+usr/src/cmd/man/src/man
+usr/src/cmd/man/src/util/instant
+usr/src/cmd/man/src/util/instant.src/THIRDPARTYLICENSE
+usr/src/cmd/man/src/util/instant.src/instant
+usr/src/cmd/man/src/util/nsgmls
+usr/src/cmd/man/src/util/nsgmls.src/lib/Makefile.dep
+usr/src/cmd/man/src/util/nsgmls.src/lib/app_inst.cxx
+usr/src/cmd/man/src/util/nsgmls.src/lib/arc_inst.cxx
+usr/src/cmd/man/src/util/nsgmls.src/lib/entmgr_inst.cxx
+usr/src/cmd/man/src/util/nsgmls.src/lib/parser_inst.cxx
+usr/src/cmd/man/src/util/nsgmls.src/lib/xentmgr_inst.cxx
+usr/src/cmd/man/src/util/nsgmls.src/nsgmls/Makefile.dep
+usr/src/cmd/man/src/util/nsgmls.src/nsgmls/nsgmls
+usr/src/cmd/man/src/util/nsgmls.src/nsgmls/nsgmls_inst.cxx
+usr/src/cmd/man/src/util/sgml2roff
+usr/src/cmd/man/src/util/solbookv2/THIRDPARTYLICENSE
+usr/src/cmd/man/src/whatis
+usr/src/cmd/mdb/i86pc/modules/apix/amd64/kmod/
+usr/src/cmd/mdb/i86pc/modules/apix/ia32/kmod/
+usr/src/cmd/mdb/i86pc/modules/pcplusmp/amd64/kmod/
+usr/src/cmd/mdb/i86pc/modules/pcplusmp/ia32/kmod/
+usr/src/cmd/mdb/i86pc/modules/unix/amd64/kmod/
+usr/src/cmd/mdb/i86pc/modules/unix/ia32/kmod/
+usr/src/cmd/mdb/i86pc/modules/uppc/amd64/kmod/
+usr/src/cmd/mdb/i86pc/modules/uppc/ia32/kmod/
+usr/src/cmd/mdb/i86xpv/modules/unix/amd64/kmod/
+usr/src/cmd/mdb/i86xpv/modules/unix/ia32/kmod/
+usr/src/cmd/mdb/i86xpv/modules/xpv_psm/amd64/kmod/
+usr/src/cmd/mdb/i86xpv/modules/xpv_psm/ia32/kmod/
+usr/src/cmd/mdb/i86xpv/modules/xpv_uppc/amd64/kmod/
+usr/src/cmd/mdb/i86xpv/modules/xpv_uppc/ia32/kmod/
+usr/src/cmd/mdb/intel/amd64/arp/kmod/
+usr/src/cmd/mdb/intel/amd64/cpc/kmod/
+usr/src/cmd/mdb/intel/amd64/crypto/kmod/
+usr/src/cmd/mdb/intel/amd64/dof/dof_names.c
+usr/src/cmd/mdb/intel/amd64/dtrace/dof_names.c
+usr/src/cmd/mdb/intel/amd64/emlxs/kmod/
+usr/src/cmd/mdb/intel/amd64/fcip/kmod/
+usr/src/cmd/mdb/intel/amd64/fcp/kmod/
+usr/src/cmd/mdb/intel/amd64/fctl/kmod/
+usr/src/cmd/mdb/intel/amd64/genunix/kmod/
+usr/src/cmd/mdb/intel/amd64/hook/kmod/
+usr/src/cmd/mdb/intel/amd64/idm/kmod/
+usr/src/cmd/mdb/intel/amd64/ii/kmod/
+usr/src/cmd/mdb/intel/amd64/ip/kmod/
+usr/src/cmd/mdb/intel/amd64/ipc/kmod/
+usr/src/cmd/mdb/intel/amd64/ipp/kmod/
+usr/src/cmd/mdb/intel/amd64/kmdb/kmdb_context_off.h
+usr/src/cmd/mdb/intel/amd64/kmdb/kmdb_modlinktest.c
+usr/src/cmd/mdb/intel/amd64/kmdb/kmdb_terminfo.c
+usr/src/cmd/mdb/intel/amd64/kmdb/kmdbmod
+usr/src/cmd/mdb/intel/amd64/kmdb/kmdbmod.core
+usr/src/cmd/mdb/intel/amd64/kmdb/mapfile
+usr/src/cmd/mdb/intel/amd64/kmdb/mapfile.i
+usr/src/cmd/mdb/intel/amd64/kmdb/mdb_grammar.c
+usr/src/cmd/mdb/intel/amd64/kmdb/mdb_grammar.h
+usr/src/cmd/mdb/intel/amd64/kmdb/mdb_lex.c
+usr/src/cmd/mdb/intel/amd64/kmdb/y.output
+usr/src/cmd/mdb/intel/amd64/krtld/kmod/
+usr/src/cmd/mdb/intel/amd64/lofs/kmod/
+usr/src/cmd/mdb/intel/amd64/logindmux/kmod/
+usr/src/cmd/mdb/intel/amd64/mac/kmod/
+usr/src/cmd/mdb/intel/amd64/md/kmod/
+usr/src/cmd/mdb/intel/amd64/mdb/mdb
+usr/src/cmd/mdb/intel/amd64/mdb/mdb_grammar.c
+usr/src/cmd/mdb/intel/amd64/mdb/mdb_grammar.h
+usr/src/cmd/mdb/intel/amd64/mdb/mdb_lex.c
+usr/src/cmd/mdb/intel/amd64/mdb/y.output
+usr/src/cmd/mdb/intel/amd64/mdb_ds/kmod/
+usr/src/cmd/mdb/intel/amd64/mdb_ks/kmod/
+usr/src/cmd/mdb/intel/amd64/mpt_sas/kmod/
+usr/src/cmd/mdb/intel/amd64/mr_sas/kmod/
+usr/src/cmd/mdb/intel/amd64/nca/kmod/
+usr/src/cmd/mdb/intel/amd64/neti/kmod/
+usr/src/cmd/mdb/intel/amd64/nsctl/kmod/
+usr/src/cmd/mdb/intel/amd64/nsmb/kmod/
+usr/src/cmd/mdb/intel/amd64/pmcs/kmod/
+usr/src/cmd/mdb/intel/amd64/ptm/kmod/
+usr/src/cmd/mdb/intel/amd64/qlc/kmod/
+usr/src/cmd/mdb/intel/amd64/random/kmod/
+usr/src/cmd/mdb/intel/amd64/rdc/kmod/
+usr/src/cmd/mdb/intel/amd64/s1394/kmod/
+usr/src/cmd/mdb/intel/amd64/scsi_vhci/kmod/
+usr/src/cmd/mdb/intel/amd64/sctp/kmod/
+usr/src/cmd/mdb/intel/amd64/sd/kmod/
+usr/src/cmd/mdb/intel/amd64/sdbc/kmod/
+usr/src/cmd/mdb/intel/amd64/smbfs/kmod/
+usr/src/cmd/mdb/intel/amd64/smbsrv/kmod/
+usr/src/cmd/mdb/intel/amd64/sockfs/kmod/
+usr/src/cmd/mdb/intel/amd64/specfs/kmod/
+usr/src/cmd/mdb/intel/amd64/sppp/kmod/
+usr/src/cmd/mdb/intel/amd64/srpt/kmod/
+usr/src/cmd/mdb/intel/amd64/stmf/kmod/
+usr/src/cmd/mdb/intel/amd64/stmf_sbd/kmod/
+usr/src/cmd/mdb/intel/amd64/sv/kmod/
+usr/src/cmd/mdb/intel/amd64/ufs/kmod/
+usr/src/cmd/mdb/intel/amd64/uhci/kmod/
+usr/src/cmd/mdb/intel/amd64/usba/kmod/
+usr/src/cmd/mdb/intel/amd64/zfs/kmod/
+usr/src/cmd/mdb/intel/ia32/arp/kmod/
+usr/src/cmd/mdb/intel/ia32/cpc/kmod/
+usr/src/cmd/mdb/intel/ia32/crypto/kmod/
+usr/src/cmd/mdb/intel/ia32/dof/dof_names.c
+usr/src/cmd/mdb/intel/ia32/dtrace/dof_names.c
+usr/src/cmd/mdb/intel/ia32/emlxs/kmod/
+usr/src/cmd/mdb/intel/ia32/fcip/kmod/
+usr/src/cmd/mdb/intel/ia32/fcp/kmod/
+usr/src/cmd/mdb/intel/ia32/fctl/kmod/
+usr/src/cmd/mdb/intel/ia32/genunix/kmod/
+usr/src/cmd/mdb/intel/ia32/hook/kmod/
+usr/src/cmd/mdb/intel/ia32/idm/kmod/
+usr/src/cmd/mdb/intel/ia32/ii/kmod/
+usr/src/cmd/mdb/intel/ia32/ip/kmod/
+usr/src/cmd/mdb/intel/ia32/ipc/kmod/
+usr/src/cmd/mdb/intel/ia32/ipp/kmod/
+usr/src/cmd/mdb/intel/ia32/kmdb/kmdb_context_off.h
+usr/src/cmd/mdb/intel/ia32/kmdb/kmdb_modlinktest.c
+usr/src/cmd/mdb/intel/ia32/kmdb/kmdb_terminfo.c
+usr/src/cmd/mdb/intel/ia32/kmdb/kmdbmod
+usr/src/cmd/mdb/intel/ia32/kmdb/kmdbmod.core
+usr/src/cmd/mdb/intel/ia32/kmdb/mapfile
+usr/src/cmd/mdb/intel/ia32/kmdb/mapfile.i
+usr/src/cmd/mdb/intel/ia32/kmdb/mdb_grammar.c
+usr/src/cmd/mdb/intel/ia32/kmdb/mdb_grammar.h
+usr/src/cmd/mdb/intel/ia32/kmdb/mdb_lex.c
+usr/src/cmd/mdb/intel/ia32/kmdb/y.output
+usr/src/cmd/mdb/intel/ia32/krtld/kmod/
+usr/src/cmd/mdb/intel/ia32/lofs/kmod/
+usr/src/cmd/mdb/intel/ia32/logindmux/kmod/
+usr/src/cmd/mdb/intel/ia32/mac/kmod/
+usr/src/cmd/mdb/intel/ia32/md/kmod/
+usr/src/cmd/mdb/intel/ia32/mdb/mdb
+usr/src/cmd/mdb/intel/ia32/mdb/mdb_grammar.c
+usr/src/cmd/mdb/intel/ia32/mdb/mdb_grammar.h
+usr/src/cmd/mdb/intel/ia32/mdb/mdb_lex.c
+usr/src/cmd/mdb/intel/ia32/mdb/y.output
+usr/src/cmd/mdb/intel/ia32/mdb_ds/kmod/
+usr/src/cmd/mdb/intel/ia32/mdb_ks/kmod/
+usr/src/cmd/mdb/intel/ia32/mpt_sas/kmod/
+usr/src/cmd/mdb/intel/ia32/mr_sas/kmod/
+usr/src/cmd/mdb/intel/ia32/nca/kmod/
+usr/src/cmd/mdb/intel/ia32/neti/kmod/
+usr/src/cmd/mdb/intel/ia32/nsctl/kmod/
+usr/src/cmd/mdb/intel/ia32/nsmb/kmod/
+usr/src/cmd/mdb/intel/ia32/pmcs/kmod/
+usr/src/cmd/mdb/intel/ia32/ptm/kmod/
+usr/src/cmd/mdb/intel/ia32/qlc/kmod/
+usr/src/cmd/mdb/intel/ia32/random/kmod/
+usr/src/cmd/mdb/intel/ia32/rdc/kmod/
+usr/src/cmd/mdb/intel/ia32/s1394/kmod/
+usr/src/cmd/mdb/intel/ia32/scsi_vhci/kmod/
+usr/src/cmd/mdb/intel/ia32/sctp/kmod/
+usr/src/cmd/mdb/intel/ia32/sd/kmod/
+usr/src/cmd/mdb/intel/ia32/sdbc/kmod/
+usr/src/cmd/mdb/intel/ia32/smbfs/kmod/
+usr/src/cmd/mdb/intel/ia32/smbsrv/kmod/
+usr/src/cmd/mdb/intel/ia32/sockfs/kmod/
+usr/src/cmd/mdb/intel/ia32/specfs/kmod/
+usr/src/cmd/mdb/intel/ia32/sppp/kmod/
+usr/src/cmd/mdb/intel/ia32/srpt/kmod/
+usr/src/cmd/mdb/intel/ia32/stmf/kmod/
+usr/src/cmd/mdb/intel/ia32/stmf_sbd/kmod/
+usr/src/cmd/mdb/intel/ia32/sv/kmod/
+usr/src/cmd/mdb/intel/ia32/ufs/kmod/
+usr/src/cmd/mdb/intel/ia32/uhci/kmod/
+usr/src/cmd/mdb/intel/ia32/usba/kmod/
+usr/src/cmd/mdb/intel/ia32/zfs/kmod/
+usr/src/cmd/mdb/intel/modules/amd_opteron/amd64/kmod/
+usr/src/cmd/mdb/intel/modules/amd_opteron/ia32/kmod/
+usr/src/cmd/mdb/intel/modules/generic_cpu/amd64/kmod/
+usr/src/cmd/mdb/intel/modules/generic_cpu/ia32/kmod/
+usr/src/cmd/mdb/intel/modules/sata/amd64/kmod/
+usr/src/cmd/mdb/intel/modules/sata/ia32/kmod/
+usr/src/cmd/mdb/tools/scripts/hdr2map
+usr/src/cmd/mdb/tools/scripts/map2linktest
+usr/src/cmd/mdb/tools/scripts/mdb
+usr/src/cmd/mdb/tools/scripts/mkmodules
+usr/src/cmd/mdb/tools/scripts/tigen
+usr/src/cmd/mdb/tools/setdynflag/i386/setdynflag
+usr/src/cmd/mesg/mesg
+usr/src/cmd/mkdir/mkdir
+usr/src/cmd/mkfifo/mkfifo
+usr/src/cmd/mkfile/mkfile
+usr/src/cmd/mkmsgs/mkmsgs
+usr/src/cmd/mknod/mknod
+usr/src/cmd/mkpwdict/mkpwdict
+usr/src/cmd/mktemp/mktemp
+usr/src/cmd/modload/amd64/add_drv
+usr/src/cmd/modload/amd64/modinfo
+usr/src/cmd/modload/amd64/modload
+usr/src/cmd/modload/amd64/modunload
+usr/src/cmd/modload/amd64/rem_drv
+usr/src/cmd/modload/amd64/update_drv
+usr/src/cmd/modload/i386/add_drv
+usr/src/cmd/modload/i386/modinfo
+usr/src/cmd/modload/i386/modload
+usr/src/cmd/modload/i386/modunload
+usr/src/cmd/modload/i386/rem_drv
+usr/src/cmd/modload/i386/update_drv
+usr/src/cmd/more/more
+usr/src/cmd/mpathadm/mpathadm
+usr/src/cmd/msgfmt/gmsgfmt
+usr/src/cmd/msgfmt/gmsgfmt_rev
+usr/src/cmd/msgfmt/gnu_po.c
+usr/src/cmd/msgfmt/msgfmt
+usr/src/cmd/msgfmt/xgettext
+usr/src/cmd/msgfmt/y.tab.h
+usr/src/cmd/msgid/msgid
+usr/src/cmd/mt/mt
+usr/src/cmd/mv/cp
+usr/src/cmd/mv/ln
+usr/src/cmd/mv/mv
+usr/src/cmd/mv/mv.xpg4
+usr/src/cmd/mvdir/mvdir
+usr/src/cmd/ndmpadm/ndmpadm
+usr/src/cmd/ndmpd/ndmp/ndmp.h
+usr/src/cmd/ndmpd/ndmp/ndmp_xdr.c
+usr/src/cmd/ndmpd/ndmp/ndmp_xdr.h
+usr/src/cmd/ndmpd/ndmpd
+usr/src/cmd/ndmpstat/ndmpstat
+usr/src/cmd/netadm/_pmtab
+usr/src/cmd/netadm/_sactab
+usr/src/cmd/netadm/_sysconfig
+usr/src/cmd/netadm/etc/ttydefs.cleanup
+usr/src/cmd/netadm/iu.ap
+usr/src/cmd/netadm/log
+usr/src/cmd/netadm/ttydefs
+usr/src/cmd/newform/newform
+usr/src/cmd/newgrp/newgrp
+usr/src/cmd/news/news
+usr/src/cmd/newtask/amd64/newtask
+usr/src/cmd/newtask/i386/newtask
+usr/src/cmd/nice/nice
+usr/src/cmd/nice/nice.xpg4
+usr/src/cmd/nl/nl
+usr/src/cmd/nl/nl.xpg4
+usr/src/cmd/nlsadmin/nlsadmin
+usr/src/cmd/nohup/amd64/nohup
+usr/src/cmd/nohup/amd64/nohup.xpg4
+usr/src/cmd/nohup/i386/nohup
+usr/src/cmd/nohup/i386/nohup.xpg4
+usr/src/cmd/nsadmin/.bashrc
+usr/src/cmd/nsadmin/.login
+usr/src/cmd/nsadmin/.profile
+usr/src/cmd/nsadmin/profile
+usr/src/cmd/nscd/nscd
+usr/src/cmd/ntfsprogs/THIRDPARTYLICENSE
+usr/src/cmd/ntfsprogs/mkntfs
+usr/src/cmd/ntfsprogs/ntfscat
+usr/src/cmd/ntfsprogs/ntfsclone
+usr/src/cmd/ntfsprogs/ntfscluster
+usr/src/cmd/ntfsprogs/ntfscmp
+usr/src/cmd/ntfsprogs/ntfscp
+usr/src/cmd/ntfsprogs/ntfsfix
+usr/src/cmd/ntfsprogs/ntfsinfo
+usr/src/cmd/ntfsprogs/ntfslabel
+usr/src/cmd/ntfsprogs/ntfsls
+usr/src/cmd/ntfsprogs/ntfsresize
+usr/src/cmd/ntfsprogs/ntfsundelete
+usr/src/cmd/oamuser/group/groupadd
+usr/src/cmd/oamuser/group/groupdel
+usr/src/cmd/oamuser/group/groupmod
+usr/src/cmd/oamuser/lib/ugdates
+usr/src/cmd/oamuser/user/useradd
+usr/src/cmd/oamuser/user/userdel
+usr/src/cmd/oamuser/user/usermod
+usr/src/cmd/oawk/awk.g.c
+usr/src/cmd/oawk/awk.h
+usr/src/cmd/oawk/awk.lx.c
+usr/src/cmd/oawk/native/
+usr/src/cmd/oawk/oawk
+usr/src/cmd/oawk/proctab.c
+usr/src/cmd/oawk/temp
+usr/src/cmd/oawk/tmptoken.c
+usr/src/cmd/od/od
+usr/src/cmd/pack/pack
+usr/src/cmd/pagesize/pagesize
+usr/src/cmd/parted/THIRDPARTYLICENSE
+usr/src/cmd/parted/parted
+usr/src/cmd/passmgmt/datemsk
+usr/src/cmd/passmgmt/passmgmt
+usr/src/cmd/passwd/passwd
+usr/src/cmd/pathchk/pathchk
+usr/src/cmd/pbind/amd64/pbind
+usr/src/cmd/pbind/i386/pbind
+usr/src/cmd/pcidr/pcidr
+usr/src/cmd/pcitool/i386/pcitool
+usr/src/cmd/perl/5.12/
+usr/src/cmd/pfexec/pfexec
+usr/src/cmd/pfexecd/pfexecd
+usr/src/cmd/pg/pg
+usr/src/cmd/pginfo/pginfo
+usr/src/cmd/pgrep/pgrep
+usr/src/cmd/pgrep/pkill
+usr/src/cmd/pgstat/pgstat
+usr/src/cmd/picl/picld/picld
+usr/src/cmd/picl/plugins/lib/picld_pluginutil/i386/lint.out
+usr/src/cmd/picl/plugins/lib/picld_pluginutil/i386/llib-lpicld_pluginutil.ln
+usr/src/cmd/picl/prtpicl/prtpicl
+usr/src/cmd/platexec/platexec
+usr/src/cmd/plimit/amd64/plimit
+usr/src/cmd/plimit/i386/plimit
+usr/src/cmd/plockstat/amd64/plockstat
+usr/src/cmd/plockstat/i386/plockstat
+usr/src/cmd/policykit/polkit-is-privileged
+usr/src/cmd/pools/pooladm/pooladm
+usr/src/cmd/pools/poolbind/poolbind
+usr/src/cmd/pools/poolcfg/poolcfg
+usr/src/cmd/pools/poolcfg/poolcfg_grammar.c
+usr/src/cmd/pools/poolcfg/poolcfg_grammar.h
+usr/src/cmd/pools/poolcfg/poolcfg_lex.c
+usr/src/cmd/pools/poold/JPool.jar
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/AbstractObjective.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/AbstractStatistic.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/AggregateStatistic.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/ComponentMove.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/ConfigurationException.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/DRM.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/DecisionHistory$1.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/DecisionHistory$ComponentMoveDecision.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/DecisionHistory$Decision.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/DecisionHistory.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/DoubleStatistic.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Expression.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/IllegalOFValueException.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/KExpression.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/KVExpression.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/KVOpExpression.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/LGroupData.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/LocalityObjective.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/LogDRM.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/LongStatistic.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Monitor.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Move.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Objective.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/PSETData.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold$1.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold$logHelper.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold$utility.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Poold.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/PooldException.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/QuantityMove.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/ResourceMonitor.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/ResultTuple.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Solver.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/StaleMonitorException.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/Statistic.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/StatisticEvent.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/StatisticList.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/StatisticListener.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/StatisticOperations.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/SystemMonitor.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/SystemSolver$ScoreMove.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/SystemSolver.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/UnsignedInt64Statistic.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/UtilizationObjective.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/WeightedLoadObjective$Calculation.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/WeightedLoadObjective.class
+usr/src/cmd/pools/poold/com/sun/solaris/domain/pools/WorkloadDependentObjective.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/exception/SuccinctStackTraceFormatter.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/kstat/Kstat.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/kstat/KstatChainUpdateException.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/kstat/KstatCtl.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/kstat/KstatException.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/kstat/KstatReadException.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/kstat/KstatTypeNotSupportedException.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/locality/LocalityDomain.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/locality/LocalityGroup.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/logging/Facility.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/logging/Severity.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/logging/SyslogHandler.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/logging/SysloglikeFormatter$1.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/logging/SysloglikeFormatter.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Component.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Configuration.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Element.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/HRTime.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Pool.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/PoolInternal.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/PoolsException.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Property.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/PropertyWalk.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Resource.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/UnsignedInt64.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/pools/Value.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/timer/RecurringEventTimer.class
+usr/src/cmd/pools/poold/com/sun/solaris/service/timer/SimpleRecurringEventTimer.class
+usr/src/cmd/pools/poold/libjkstat/jkstat.h
+usr/src/cmd/pools/poold/libjlgrp/jlgrp.h
+usr/src/cmd/pools/poold/libjpool/jpool.h
+usr/src/cmd/pools/poold/libjsyslog/jsyslog.h
+usr/src/cmd/pools/poold/poold
+usr/src/cmd/pools/poolstat/poolstat
+usr/src/cmd/power/pmconfig
+usr/src/cmd/power/power.conf
+usr/src/cmd/power/powerd
+usr/src/cmd/power/sys-suspend
+usr/src/cmd/power/sysidpm
+usr/src/cmd/powertop/amd64/powertop
+usr/src/cmd/powertop/i386/powertop
+usr/src/cmd/ppgsz/amd64/ppgsz
+usr/src/cmd/ppgsz/i386/ppgsz
+usr/src/cmd/pr/pr
+usr/src/cmd/pr/pr.dc
+usr/src/cmd/pr/pr.xpg4
+usr/src/cmd/praudit/praudit
+usr/src/cmd/prctl/amd64/prctl
+usr/src/cmd/prctl/i386/prctl
+usr/src/cmd/printf/printf
+usr/src/cmd/priocntl/FSSpriocntl
+usr/src/cmd/priocntl/FXpriocntl
+usr/src/cmd/priocntl/IApriocntl
+usr/src/cmd/priocntl/RTpriocntl
+usr/src/cmd/priocntl/SDCpriocntl
+usr/src/cmd/priocntl/TSpriocntl
+usr/src/cmd/priocntl/priocntl
+usr/src/cmd/profiles/profiles
+usr/src/cmd/projadd/projadd
+usr/src/cmd/projadd/projdel
+usr/src/cmd/projadd/projmod
+usr/src/cmd/projects/projects
+usr/src/cmd/prstat/amd64/prstat
+usr/src/cmd/prstat/i386/prstat
+usr/src/cmd/prtconf/amd64/prtconf
+usr/src/cmd/prtconf/i386/prtconf
+usr/src/cmd/prtdiag/i386/prtdiag
+usr/src/cmd/prtvtoc/prtvtoc
+usr/src/cmd/ps/amd64/ps
+usr/src/cmd/ps/i386/ps
+usr/src/cmd/ps/ps.dc
+usr/src/cmd/psradm/psradm
+usr/src/cmd/psrinfo/psrinfo
+usr/src/cmd/psrset/amd64/psrset
+usr/src/cmd/psrset/i386/psrset
+usr/src/cmd/ptools/pargs/amd64/
+usr/src/cmd/ptools/pargs/i386/
+usr/src/cmd/ptools/pcred/amd64/
+usr/src/cmd/ptools/pcred/i386/
+usr/src/cmd/ptools/pfiles/amd64/
+usr/src/cmd/ptools/pfiles/i386/
+usr/src/cmd/ptools/pflags/amd64/
+usr/src/cmd/ptools/pflags/i386/
+usr/src/cmd/ptools/pldd/amd64/
+usr/src/cmd/ptools/pldd/i386/
+usr/src/cmd/ptools/plgrp/amd64/
+usr/src/cmd/ptools/plgrp/i386/
+usr/src/cmd/ptools/pmadvise/amd64/
+usr/src/cmd/ptools/pmadvise/i386/
+usr/src/cmd/ptools/pmap/amd64/
+usr/src/cmd/ptools/pmap/i386/
+usr/src/cmd/ptools/ppriv/amd64/
+usr/src/cmd/ptools/ppriv/i386/
+usr/src/cmd/ptools/preap/amd64/
+usr/src/cmd/ptools/preap/i386/
+usr/src/cmd/ptools/prun/amd64/
+usr/src/cmd/ptools/prun/i386/
+usr/src/cmd/ptools/psig/amd64/
+usr/src/cmd/ptools/psig/i386/
+usr/src/cmd/ptools/pstack/amd64/
+usr/src/cmd/ptools/pstack/i386/
+usr/src/cmd/ptools/pstop/amd64/
+usr/src/cmd/ptools/pstop/i386/
+usr/src/cmd/ptools/ptime/amd64/
+usr/src/cmd/ptools/ptime/i386/
+usr/src/cmd/ptools/ptree/amd64/
+usr/src/cmd/ptools/ptree/i386/
+usr/src/cmd/ptools/pwait/amd64/
+usr/src/cmd/ptools/pwait/i386/
+usr/src/cmd/ptools/pwdx/amd64/
+usr/src/cmd/ptools/pwdx/i386/
+usr/src/cmd/pwck/pwck
+usr/src/cmd/pwconv/pwconv
+usr/src/cmd/pwd/pwd
+usr/src/cmd/raidctl/raidctl
+usr/src/cmd/ramdiskadm/ramdiskadm
+usr/src/cmd/rcap/rcapadm/rcapadm
+usr/src/cmd/rcap/rcapd/amd64/rcapd
+usr/src/cmd/rcap/rcapd/i386/rcapd
+usr/src/cmd/rcap/rcapstat/rcapstat
+usr/src/cmd/rcm_daemon/i386/rcm_daemon
+usr/src/cmd/rctladm/rctladm
+usr/src/cmd/refer/addbib
+usr/src/cmd/refer/hunt
+usr/src/cmd/refer/indxbib
+usr/src/cmd/refer/inv
+usr/src/cmd/refer/lookbib
+usr/src/cmd/refer/mkey
+usr/src/cmd/refer/refer
+usr/src/cmd/refer/roffbib
+usr/src/cmd/refer/sortbib
+usr/src/cmd/regcmp/regcmp
+usr/src/cmd/renice/renice
+usr/src/cmd/rexd/on
+usr/src/cmd/rexd/rpc.rexd
+usr/src/cmd/rm/rm
+usr/src/cmd/rm/rm.xpg4
+usr/src/cmd/rmdir/rmdir
+usr/src/cmd/rmformat/rmformat
+usr/src/cmd/rmmount/rmmount
+usr/src/cmd/rmt/rmt
+usr/src/cmd/rmvolmgr/rmvolmgr
+usr/src/cmd/roles/roles
+usr/src/cmd/rpcbind/rpc-bind
+usr/src/cmd/rpcbind/rpcbind
+usr/src/cmd/rpcgen/rpcgen
+usr/src/cmd/rpcinfo/rpcinfo
+usr/src/cmd/rpcsvc/rpc.bootparamd/rpc.bootparamd
+usr/src/cmd/rpcsvc/rpc.rstatd
+usr/src/cmd/rpcsvc/rpc.rusersd
+usr/src/cmd/rpcsvc/rpc.rwalld
+usr/src/cmd/rpcsvc/rpc.sprayd
+usr/src/cmd/rpcsvc/rstat.h
+usr/src/cmd/rpcsvc/rstat.x
+usr/src/cmd/rpcsvc/rstat_svc.c
+usr/src/cmd/rpcsvc/rstat_v2.h
+usr/src/cmd/rpcsvc/rstat_v2_svc.c
+usr/src/cmd/rpcsvc/rstat_v2_xdr.c
+usr/src/cmd/rpcsvc/rup
+usr/src/cmd/rpcsvc/rusers
+usr/src/cmd/rpcsvc/rwall
+usr/src/cmd/rpcsvc/rwall.h
+usr/src/cmd/rpcsvc/rwall.x
+usr/src/cmd/rpcsvc/rwall_clnt.c
+usr/src/cmd/rpcsvc/rwall_svc.c
+usr/src/cmd/rpcsvc/spray
+usr/src/cmd/rpcsvc/spray.h
+usr/src/cmd/rpcsvc/spray.x
+usr/src/cmd/rpcsvc/spray_clnt.c
+usr/src/cmd/rpcsvc/spray_svc.c
+usr/src/cmd/rtc/rtc
+usr/src/cmd/runat/runat
+usr/src/cmd/sa/sa1
+usr/src/cmd/sa/sa2
+usr/src/cmd/sa/sadc
+usr/src/cmd/sa/sar
+usr/src/cmd/sa/timex
+usr/src/cmd/saf/pmadm
+usr/src/cmd/saf/sac
+usr/src/cmd/saf/sacadm
+usr/src/cmd/sasinfo/sasinfo
+usr/src/cmd/savecore/amd64/savecore
+usr/src/cmd/savecore/i386/savecore
+usr/src/cmd/sbdadm/sbdadm
+usr/src/cmd/script/script
+usr/src/cmd/scsi/sestopo/i386/sestopo
+usr/src/cmd/scsi/smp/i386/smp
+usr/src/cmd/sdiff/sdiff
+usr/src/cmd/sdpadm/sdpadm
+usr/src/cmd/sed/sed
+usr/src/cmd/sendmail/THIRDPARTYLICENSE
+usr/src/cmd/sendmail/aux/editmap
+usr/src/cmd/sendmail/aux/etrn
+usr/src/cmd/sendmail/aux/mail.local
+usr/src/cmd/sendmail/aux/mailcompat
+usr/src/cmd/sendmail/aux/mailq
+usr/src/cmd/sendmail/aux/mailstats
+usr/src/cmd/sendmail/aux/makemap
+usr/src/cmd/sendmail/aux/mconnect
+usr/src/cmd/sendmail/aux/praliases
+usr/src/cmd/sendmail/aux/smrsh
+usr/src/cmd/sendmail/aux/vacation
+usr/src/cmd/sendmail/cf/cf/sendmail.cf
+usr/src/cmd/sendmail/cf/cf/submit.cf
+usr/src/cmd/sendmail/cf/sendmail.cf
+usr/src/cmd/sendmail/cf/submit.cf
+usr/src/cmd/sendmail/libmilter/i386/lint.out
+usr/src/cmd/sendmail/libmilter/i386/llib-lmilter.ln
+usr/src/cmd/sendmail/src/sendmail
+usr/src/cmd/setfacl/setfacl
+usr/src/cmd/setmnt/setmnt
+usr/src/cmd/setpgrp/setpgrp
+usr/src/cmd/setuname/amd64/setuname
+usr/src/cmd/setuname/i386/setuname
+usr/src/cmd/sgs/0@0/.make.state.i386
+usr/src/cmd/sgs/ar/.make.state.i386
+usr/src/cmd/sgs/ar/amd64/.make.state.i386
+usr/src/cmd/sgs/ar/amd64/ar
+usr/src/cmd/sgs/ar/amd64/msg.c
+usr/src/cmd/sgs/ar/amd64/msg.h
+usr/src/cmd/sgs/ar/i386/.make.state.i386
+usr/src/cmd/sgs/ar/i386/ar
+usr/src/cmd/sgs/ar/i386/ar.xpg4
+usr/src/cmd/sgs/ar/i386/msg.c
+usr/src/cmd/sgs/ar/i386/msg.h
+usr/src/cmd/sgs/crle/.make.state.i386
+usr/src/cmd/sgs/crle/amd64/.make.state.i386
+usr/src/cmd/sgs/crle/amd64/crle
+usr/src/cmd/sgs/crle/amd64/msg.c
+usr/src/cmd/sgs/crle/amd64/msg.h
+usr/src/cmd/sgs/crle/i386/.make.state.i386
+usr/src/cmd/sgs/crle/i386/crle
+usr/src/cmd/sgs/crle/i386/msg.c
+usr/src/cmd/sgs/crle/i386/msg.h
+usr/src/cmd/sgs/dump/.make.state.i386
+usr/src/cmd/sgs/dump/amd64/.make.state.i386
+usr/src/cmd/sgs/dump/amd64/dump
+usr/src/cmd/sgs/dump/i386/.make.state.i386
+usr/src/cmd/sgs/dump/i386/dump
+usr/src/cmd/sgs/elfdump/.make.state.i386
+usr/src/cmd/sgs/elfdump/amd64/.make.state.i386
+usr/src/cmd/sgs/elfdump/amd64/elfdump
+usr/src/cmd/sgs/elfdump/amd64/gen_struct_layout
+usr/src/cmd/sgs/elfdump/amd64/msg.c
+usr/src/cmd/sgs/elfdump/amd64/msg.h
+usr/src/cmd/sgs/elfdump/i386/.make.state.i386
+usr/src/cmd/sgs/elfdump/i386/elfdump
+usr/src/cmd/sgs/elfdump/i386/gen_struct_layout
+usr/src/cmd/sgs/elfdump/i386/msg.c
+usr/src/cmd/sgs/elfdump/i386/msg.h
+usr/src/cmd/sgs/elfedit/.make.state.i386
+usr/src/cmd/sgs/elfedit/amd64/.make.state.i386
+usr/src/cmd/sgs/elfedit/amd64/elfedit
+usr/src/cmd/sgs/elfedit/amd64/msg.c
+usr/src/cmd/sgs/elfedit/amd64/msg.h
+usr/src/cmd/sgs/elfedit/i386/.make.state.i386
+usr/src/cmd/sgs/elfedit/i386/elfedit
+usr/src/cmd/sgs/elfedit/i386/msg.c
+usr/src/cmd/sgs/elfedit/i386/msg.h
+usr/src/cmd/sgs/elfedit/modules/amd64/.make.state.i386
+usr/src/cmd/sgs/elfedit/modules/amd64/cap_msg.c
+usr/src/cmd/sgs/elfedit/modules/amd64/cap_msg.h
+usr/src/cmd/sgs/elfedit/modules/amd64/dyn_msg.c
+usr/src/cmd/sgs/elfedit/modules/amd64/dyn_msg.h
+usr/src/cmd/sgs/elfedit/modules/amd64/ehdr_msg.c
+usr/src/cmd/sgs/elfedit/modules/amd64/ehdr_msg.h
+usr/src/cmd/sgs/elfedit/modules/amd64/phdr_msg.c
+usr/src/cmd/sgs/elfedit/modules/amd64/phdr_msg.h
+usr/src/cmd/sgs/elfedit/modules/amd64/shdr_msg.c
+usr/src/cmd/sgs/elfedit/modules/amd64/shdr_msg.h
+usr/src/cmd/sgs/elfedit/modules/amd64/str_msg.c
+usr/src/cmd/sgs/elfedit/modules/amd64/str_msg.h
+usr/src/cmd/sgs/elfedit/modules/amd64/sym_msg.c
+usr/src/cmd/sgs/elfedit/modules/amd64/sym_msg.h
+usr/src/cmd/sgs/elfedit/modules/amd64/syminfo_msg.c
+usr/src/cmd/sgs/elfedit/modules/amd64/syminfo_msg.h
+usr/src/cmd/sgs/elfedit/modules/i386/.make.state.i386
+usr/src/cmd/sgs/elfedit/modules/i386/cap_msg.c
+usr/src/cmd/sgs/elfedit/modules/i386/cap_msg.h
+usr/src/cmd/sgs/elfedit/modules/i386/dyn_msg.c
+usr/src/cmd/sgs/elfedit/modules/i386/dyn_msg.h
+usr/src/cmd/sgs/elfedit/modules/i386/ehdr_msg.c
+usr/src/cmd/sgs/elfedit/modules/i386/ehdr_msg.h
+usr/src/cmd/sgs/elfedit/modules/i386/phdr_msg.c
+usr/src/cmd/sgs/elfedit/modules/i386/phdr_msg.h
+usr/src/cmd/sgs/elfedit/modules/i386/shdr_msg.c
+usr/src/cmd/sgs/elfedit/modules/i386/shdr_msg.h
+usr/src/cmd/sgs/elfedit/modules/i386/str_msg.c
+usr/src/cmd/sgs/elfedit/modules/i386/str_msg.h
+usr/src/cmd/sgs/elfedit/modules/i386/sym_msg.c
+usr/src/cmd/sgs/elfedit/modules/i386/sym_msg.h
+usr/src/cmd/sgs/elfedit/modules/i386/syminfo_msg.c
+usr/src/cmd/sgs/elfedit/modules/i386/syminfo_msg.h
+usr/src/cmd/sgs/elfwrap/.make.state.i386
+usr/src/cmd/sgs/elfwrap/amd64/.make.state.i386
+usr/src/cmd/sgs/elfwrap/amd64/elfwrap
+usr/src/cmd/sgs/elfwrap/amd64/msg.c
+usr/src/cmd/sgs/elfwrap/amd64/msg.h
+usr/src/cmd/sgs/elfwrap/i386/.make.state.i386
+usr/src/cmd/sgs/elfwrap/i386/elfwrap
+usr/src/cmd/sgs/elfwrap/i386/msg.c
+usr/src/cmd/sgs/elfwrap/i386/msg.h
+usr/src/cmd/sgs/error/i386/error
+usr/src/cmd/sgs/gprof/i386/.make.state.i386
+usr/src/cmd/sgs/gprof/i386/gprof
+usr/src/cmd/sgs/lari/.make.state.i386
+usr/src/cmd/sgs/lari/lari
+usr/src/cmd/sgs/ld/.make.state.i386
+usr/src/cmd/sgs/ld/amd64/.make.state.i386
+usr/src/cmd/sgs/ld/amd64/ld
+usr/src/cmd/sgs/ld/amd64/msg.c
+usr/src/cmd/sgs/ld/amd64/msg.h
+usr/src/cmd/sgs/ld/i386/.make.state.i386
+usr/src/cmd/sgs/ld/i386/ld
+usr/src/cmd/sgs/ld/i386/msg.c
+usr/src/cmd/sgs/ld/i386/msg.h
+usr/src/cmd/sgs/ldd/.make.state.i386
+usr/src/cmd/sgs/ldd/amd64/.make.state.i386
+usr/src/cmd/sgs/ldd/amd64/ldd
+usr/src/cmd/sgs/ldd/amd64/msg.c
+usr/src/cmd/sgs/ldd/amd64/msg.h
+usr/src/cmd/sgs/ldd/i386/.make.state.i386
+usr/src/cmd/sgs/ldd/i386/ldd
+usr/src/cmd/sgs/ldd/i386/msg.c
+usr/src/cmd/sgs/ldd/i386/msg.h
+usr/src/cmd/sgs/lddstub/.make.state.i386
+usr/src/cmd/sgs/lddstub/amd64/.make.state.i386
+usr/src/cmd/sgs/lddstub/amd64/lddstub
+usr/src/cmd/sgs/lddstub/i386/.make.state.i386
+usr/src/cmd/sgs/lddstub/i386/lddstub
+usr/src/cmd/sgs/ldprof/.make.state.i386
+usr/src/cmd/sgs/ldprof/amd64/.make.state.i386
+usr/src/cmd/sgs/ldprof/amd64/msg.c
+usr/src/cmd/sgs/ldprof/amd64/msg.h
+usr/src/cmd/sgs/ldprof/i386/.make.state.i386
+usr/src/cmd/sgs/ldprof/i386/msg.c
+usr/src/cmd/sgs/ldprof/i386/msg.h
+usr/src/cmd/sgs/lex/amd64/llib-ll.ln
+usr/src/cmd/sgs/lex/common/parser.c
+usr/src/cmd/sgs/lex/i386/lex
+usr/src/cmd/sgs/lex/i386/llib-ll.ln
+usr/src/cmd/sgs/libconv/.make.state.i386
+usr/src/cmd/sgs/libconv/amd64/.make.state.i386
+usr/src/cmd/sgs/libconv/amd64/arch_msg.c
+usr/src/cmd/sgs/libconv/amd64/arch_msg.h
+usr/src/cmd/sgs/libconv/amd64/audit_msg.c
+usr/src/cmd/sgs/libconv/amd64/audit_msg.h
+usr/src/cmd/sgs/libconv/amd64/bld_vernote
+usr/src/cmd/sgs/libconv/amd64/c_literal_msg.c
+usr/src/cmd/sgs/libconv/amd64/c_literal_msg.h
+usr/src/cmd/sgs/libconv/amd64/cap_msg.c
+usr/src/cmd/sgs/libconv/amd64/cap_msg.h
+usr/src/cmd/sgs/libconv/amd64/config_msg.c
+usr/src/cmd/sgs/libconv/amd64/config_msg.h
+usr/src/cmd/sgs/libconv/amd64/corenote_msg.c
+usr/src/cmd/sgs/libconv/amd64/corenote_msg.h
+usr/src/cmd/sgs/libconv/amd64/data_msg.c
+usr/src/cmd/sgs/libconv/amd64/data_msg.h
+usr/src/cmd/sgs/libconv/amd64/deftag_msg.c
+usr/src/cmd/sgs/libconv/amd64/deftag_msg.h
+usr/src/cmd/sgs/libconv/amd64/demangle_msg.c
+usr/src/cmd/sgs/libconv/amd64/demangle_msg.h
+usr/src/cmd/sgs/libconv/amd64/dl_msg.c
+usr/src/cmd/sgs/libconv/amd64/dl_msg.h
+usr/src/cmd/sgs/libconv/amd64/dwarf_ehe_msg.c
+usr/src/cmd/sgs/libconv/amd64/dwarf_ehe_msg.h
+usr/src/cmd/sgs/libconv/amd64/dwarf_msg.c
+usr/src/cmd/sgs/libconv/amd64/dwarf_msg.h
+usr/src/cmd/sgs/libconv/amd64/dynamic_msg.c
+usr/src/cmd/sgs/libconv/amd64/dynamic_msg.h
+usr/src/cmd/sgs/libconv/amd64/elf_msg.c
+usr/src/cmd/sgs/libconv/amd64/elf_msg.h
+usr/src/cmd/sgs/libconv/amd64/entry_msg.c
+usr/src/cmd/sgs/libconv/amd64/entry_msg.h
+usr/src/cmd/sgs/libconv/amd64/globals_msg.c
+usr/src/cmd/sgs/libconv/amd64/globals_msg.h
+usr/src/cmd/sgs/libconv/amd64/group_msg.c
+usr/src/cmd/sgs/libconv/amd64/group_msg.h
+usr/src/cmd/sgs/libconv/amd64/lddstub_msg.c
+usr/src/cmd/sgs/libconv/amd64/lddstub_msg.h
+usr/src/cmd/sgs/libconv/amd64/map_msg.c
+usr/src/cmd/sgs/libconv/amd64/map_msg.h
+usr/src/cmd/sgs/libconv/amd64/phdr_msg.c
+usr/src/cmd/sgs/libconv/amd64/phdr_msg.h
+usr/src/cmd/sgs/libconv/amd64/relocate_amd64_msg.c
+usr/src/cmd/sgs/libconv/amd64/relocate_amd64_msg.h
+usr/src/cmd/sgs/libconv/amd64/relocate_i386_msg.c
+usr/src/cmd/sgs/libconv/amd64/relocate_i386_msg.h
+usr/src/cmd/sgs/libconv/amd64/relocate_sparc_msg.c
+usr/src/cmd/sgs/libconv/amd64/relocate_sparc_msg.h
+usr/src/cmd/sgs/libconv/amd64/report_bufsize.h
+usr/src/cmd/sgs/libconv/amd64/sections_msg.c
+usr/src/cmd/sgs/libconv/amd64/sections_msg.h
+usr/src/cmd/sgs/libconv/amd64/segments_msg.c
+usr/src/cmd/sgs/libconv/amd64/segments_msg.h
+usr/src/cmd/sgs/libconv/amd64/symbols_msg.c
+usr/src/cmd/sgs/libconv/amd64/symbols_msg.h
+usr/src/cmd/sgs/libconv/amd64/symbols_sparc_msg.c
+usr/src/cmd/sgs/libconv/amd64/symbols_sparc_msg.h
+usr/src/cmd/sgs/libconv/amd64/syminfo_msg.c
+usr/src/cmd/sgs/libconv/amd64/syminfo_msg.h
+usr/src/cmd/sgs/libconv/amd64/time_msg.c
+usr/src/cmd/sgs/libconv/amd64/time_msg.h
+usr/src/cmd/sgs/libconv/amd64/vernote.s
+usr/src/cmd/sgs/libconv/amd64/version_msg.c
+usr/src/cmd/sgs/libconv/amd64/version_msg.h
+usr/src/cmd/sgs/libconv/i386/.make.state.i386
+usr/src/cmd/sgs/libconv/i386/arch_msg.c
+usr/src/cmd/sgs/libconv/i386/arch_msg.h
+usr/src/cmd/sgs/libconv/i386/audit_msg.c
+usr/src/cmd/sgs/libconv/i386/audit_msg.h
+usr/src/cmd/sgs/libconv/i386/bld_vernote
+usr/src/cmd/sgs/libconv/i386/c_literal_msg.c
+usr/src/cmd/sgs/libconv/i386/c_literal_msg.h
+usr/src/cmd/sgs/libconv/i386/cap_msg.c
+usr/src/cmd/sgs/libconv/i386/cap_msg.h
+usr/src/cmd/sgs/libconv/i386/config_msg.c
+usr/src/cmd/sgs/libconv/i386/config_msg.h
+usr/src/cmd/sgs/libconv/i386/corenote_msg.c
+usr/src/cmd/sgs/libconv/i386/corenote_msg.h
+usr/src/cmd/sgs/libconv/i386/data_msg.c
+usr/src/cmd/sgs/libconv/i386/data_msg.h
+usr/src/cmd/sgs/libconv/i386/deftag_msg.c
+usr/src/cmd/sgs/libconv/i386/deftag_msg.h
+usr/src/cmd/sgs/libconv/i386/demangle_msg.c
+usr/src/cmd/sgs/libconv/i386/demangle_msg.h
+usr/src/cmd/sgs/libconv/i386/dl_msg.c
+usr/src/cmd/sgs/libconv/i386/dl_msg.h
+usr/src/cmd/sgs/libconv/i386/dwarf_ehe_msg.c
+usr/src/cmd/sgs/libconv/i386/dwarf_ehe_msg.h
+usr/src/cmd/sgs/libconv/i386/dwarf_msg.c
+usr/src/cmd/sgs/libconv/i386/dwarf_msg.h
+usr/src/cmd/sgs/libconv/i386/dynamic_msg.c
+usr/src/cmd/sgs/libconv/i386/dynamic_msg.h
+usr/src/cmd/sgs/libconv/i386/elf_msg.c
+usr/src/cmd/sgs/libconv/i386/elf_msg.h
+usr/src/cmd/sgs/libconv/i386/entry_msg.c
+usr/src/cmd/sgs/libconv/i386/entry_msg.h
+usr/src/cmd/sgs/libconv/i386/globals_msg.c
+usr/src/cmd/sgs/libconv/i386/globals_msg.h
+usr/src/cmd/sgs/libconv/i386/group_msg.c
+usr/src/cmd/sgs/libconv/i386/group_msg.h
+usr/src/cmd/sgs/libconv/i386/lddstub_msg.c
+usr/src/cmd/sgs/libconv/i386/lddstub_msg.h
+usr/src/cmd/sgs/libconv/i386/map_msg.c
+usr/src/cmd/sgs/libconv/i386/map_msg.h
+usr/src/cmd/sgs/libconv/i386/phdr_msg.c
+usr/src/cmd/sgs/libconv/i386/phdr_msg.h
+usr/src/cmd/sgs/libconv/i386/relocate_amd64_msg.c
+usr/src/cmd/sgs/libconv/i386/relocate_amd64_msg.h
+usr/src/cmd/sgs/libconv/i386/relocate_i386_msg.c
+usr/src/cmd/sgs/libconv/i386/relocate_i386_msg.h
+usr/src/cmd/sgs/libconv/i386/relocate_sparc_msg.c
+usr/src/cmd/sgs/libconv/i386/relocate_sparc_msg.h
+usr/src/cmd/sgs/libconv/i386/report_bufsize.h
+usr/src/cmd/sgs/libconv/i386/sections_msg.c
+usr/src/cmd/sgs/libconv/i386/sections_msg.h
+usr/src/cmd/sgs/libconv/i386/segments_msg.c
+usr/src/cmd/sgs/libconv/i386/segments_msg.h
+usr/src/cmd/sgs/libconv/i386/symbols_msg.c
+usr/src/cmd/sgs/libconv/i386/symbols_msg.h
+usr/src/cmd/sgs/libconv/i386/symbols_sparc_msg.c
+usr/src/cmd/sgs/libconv/i386/symbols_sparc_msg.h
+usr/src/cmd/sgs/libconv/i386/syminfo_msg.c
+usr/src/cmd/sgs/libconv/i386/syminfo_msg.h
+usr/src/cmd/sgs/libconv/i386/time_msg.c
+usr/src/cmd/sgs/libconv/i386/time_msg.h
+usr/src/cmd/sgs/libconv/i386/vernote.s
+usr/src/cmd/sgs/libconv/i386/version_msg.c
+usr/src/cmd/sgs/libconv/i386/version_msg.h
+usr/src/cmd/sgs/libcrle/.make.state.i386
+usr/src/cmd/sgs/libcrle/amd64/.make.state.i386
+usr/src/cmd/sgs/libcrle/amd64/msg.c
+usr/src/cmd/sgs/libcrle/amd64/msg.h
+usr/src/cmd/sgs/libcrle/i386/.make.state.i386
+usr/src/cmd/sgs/libcrle/i386/msg.c
+usr/src/cmd/sgs/libcrle/i386/msg.h
+usr/src/cmd/sgs/libdl/.make.state.i386
+usr/src/cmd/sgs/libdl/amd64/lint.out
+usr/src/cmd/sgs/libdl/amd64/llib-ldl.ln
+usr/src/cmd/sgs/libdl/i386/lint.out
+usr/src/cmd/sgs/libdl/i386/llib-ldl.ln
+usr/src/cmd/sgs/libelf/.make.state.i386
+usr/src/cmd/sgs/libelf/amd64/.make.state.i386
+usr/src/cmd/sgs/libelf/amd64/lint.out.1
+usr/src/cmd/sgs/libelf/amd64/llib-lelf.ln
+usr/src/cmd/sgs/libelf/amd64/msg.c
+usr/src/cmd/sgs/libelf/amd64/msg.h
+usr/src/cmd/sgs/libelf/amd64/xlate.c
+usr/src/cmd/sgs/libelf/amd64/xlate64.c
+usr/src/cmd/sgs/libelf/i386/.make.state.i386
+usr/src/cmd/sgs/libelf/i386/lint.out.1
+usr/src/cmd/sgs/libelf/i386/llib-lelf.ln
+usr/src/cmd/sgs/libelf/i386/msg.c
+usr/src/cmd/sgs/libelf/i386/msg.h
+usr/src/cmd/sgs/libelf/i386/xlate.c
+usr/src/cmd/sgs/libelf/i386/xlate64.c
+usr/src/cmd/sgs/libld/.make.state.i386
+usr/src/cmd/sgs/libld/amd64/.make.state.i386
+usr/src/cmd/sgs/libld/amd64/libld.so.4
+usr/src/cmd/sgs/libld/amd64/msg.c
+usr/src/cmd/sgs/libld/amd64/msg.h
+usr/src/cmd/sgs/libld/i386/.make.state.i386
+usr/src/cmd/sgs/libld/i386/libld.so.4
+usr/src/cmd/sgs/libld/i386/msg.c
+usr/src/cmd/sgs/libld/i386/msg.h
+usr/src/cmd/sgs/liblddbg/.make.state.i386
+usr/src/cmd/sgs/liblddbg/amd64/.make.state.i386
+usr/src/cmd/sgs/liblddbg/amd64/liblddbg.so.4
+usr/src/cmd/sgs/liblddbg/amd64/msg.c
+usr/src/cmd/sgs/liblddbg/amd64/msg.h
+usr/src/cmd/sgs/liblddbg/i386/.make.state.i386
+usr/src/cmd/sgs/liblddbg/i386/liblddbg.so.4
+usr/src/cmd/sgs/liblddbg/i386/msg.c
+usr/src/cmd/sgs/liblddbg/i386/msg.h
+usr/src/cmd/sgs/libldmake/.make.state.i386
+usr/src/cmd/sgs/libldmake/amd64/.make.state.i386
+usr/src/cmd/sgs/libldmake/i386/.make.state.i386
+usr/src/cmd/sgs/libldstab/.make.state.i386
+usr/src/cmd/sgs/libldstab/amd64/.make.state.i386
+usr/src/cmd/sgs/libldstab/i386/.make.state.i386
+usr/src/cmd/sgs/librtld/.make.state.i386
+usr/src/cmd/sgs/librtld/amd64/.make.state.i386
+usr/src/cmd/sgs/librtld/amd64/msg.c
+usr/src/cmd/sgs/librtld/amd64/msg.h
+usr/src/cmd/sgs/librtld/i386/.make.state.i386
+usr/src/cmd/sgs/librtld/i386/msg.c
+usr/src/cmd/sgs/librtld/i386/msg.h
+usr/src/cmd/sgs/librtld_db/.make.state.i386
+usr/src/cmd/sgs/librtld_db/amd64/.make.state.i386
+usr/src/cmd/sgs/librtld_db/amd64/lint.out.1
+usr/src/cmd/sgs/librtld_db/amd64/llib-lrtld_db.ln
+usr/src/cmd/sgs/librtld_db/amd64/msg.c
+usr/src/cmd/sgs/librtld_db/amd64/msg.h
+usr/src/cmd/sgs/librtld_db/demo/Makefile.com.demo
+usr/src/cmd/sgs/librtld_db/demo/Makefile.targ.demo
+usr/src/cmd/sgs/librtld_db/demo/amd64/Makefile.demo
+usr/src/cmd/sgs/librtld_db/demo/i386/Makefile.demo
+usr/src/cmd/sgs/librtld_db/demo/sparc/Makefile.demo
+usr/src/cmd/sgs/librtld_db/demo/sparcv9/Makefile.demo
+usr/src/cmd/sgs/librtld_db/i386/.make.state.i386
+usr/src/cmd/sgs/librtld_db/i386/lint.out.1
+usr/src/cmd/sgs/librtld_db/i386/llib-lrtld_db.ln
+usr/src/cmd/sgs/librtld_db/i386/msg.c
+usr/src/cmd/sgs/librtld_db/i386/msg.h
+usr/src/cmd/sgs/link_audit/amd64/.make.state.i386
+usr/src/cmd/sgs/link_audit/amd64/perfcnt
+usr/src/cmd/sgs/link_audit/amd64/symbindrep
+usr/src/cmd/sgs/link_audit/i386/.make.state.i386
+usr/src/cmd/sgs/link_audit/i386/dumpbind
+usr/src/cmd/sgs/link_audit/i386/perfcnt
+usr/src/cmd/sgs/link_audit/i386/sotruss
+usr/src/cmd/sgs/link_audit/i386/symbindrep
+usr/src/cmd/sgs/link_audit/i386/whocalls
+usr/src/cmd/sgs/lorder/.make.state.i386
+usr/src/cmd/sgs/lorder/lorder
+usr/src/cmd/sgs/m4/common/m4y.c
+usr/src/cmd/sgs/m4/common/m4y_xpg4.c
+usr/src/cmd/sgs/m4/i386/m4
+usr/src/cmd/sgs/m4/i386/m4.xpg4
+usr/src/cmd/sgs/mcs/.make.state.i386
+usr/src/cmd/sgs/mcs/amd64/.make.state.i386
+usr/src/cmd/sgs/mcs/amd64/mcs
+usr/src/cmd/sgs/mcs/i386/.make.state.i386
+usr/src/cmd/sgs/mcs/i386/mcs
+usr/src/cmd/sgs/messages/.make.state.i386
+usr/src/cmd/sgs/messages/i386/.make.state.i386
+usr/src/cmd/sgs/messages/i386/ar
+usr/src/cmd/sgs/messages/i386/crle
+usr/src/cmd/sgs/messages/i386/elfdump
+usr/src/cmd/sgs/messages/i386/elfedit
+usr/src/cmd/sgs/messages/i386/elfedit_cap
+usr/src/cmd/sgs/messages/i386/elfedit_dyn
+usr/src/cmd/sgs/messages/i386/elfedit_ehdr
+usr/src/cmd/sgs/messages/i386/elfedit_phdr
+usr/src/cmd/sgs/messages/i386/elfedit_shdr
+usr/src/cmd/sgs/messages/i386/elfedit_str
+usr/src/cmd/sgs/messages/i386/elfedit_sym
+usr/src/cmd/sgs/messages/i386/elfedit_syminfo
+usr/src/cmd/sgs/messages/i386/elfwrap
+usr/src/cmd/sgs/messages/i386/lari
+usr/src/cmd/sgs/messages/i386/ld
+usr/src/cmd/sgs/messages/i386/ldd
+usr/src/cmd/sgs/messages/i386/ldprof
+usr/src/cmd/sgs/messages/i386/libcrle
+usr/src/cmd/sgs/messages/i386/libelf
+usr/src/cmd/sgs/messages/i386/libld
+usr/src/cmd/sgs/messages/i386/liblddbg
+usr/src/cmd/sgs/messages/i386/librtld
+usr/src/cmd/sgs/messages/i386/moe
+usr/src/cmd/sgs/messages/i386/pvs
+usr/src/cmd/sgs/messages/i386/rtld
+usr/src/cmd/sgs/moe/.make.state.i386
+usr/src/cmd/sgs/moe/amd64/.make.state.i386
+usr/src/cmd/sgs/moe/amd64/moe
+usr/src/cmd/sgs/moe/amd64/msg.c
+usr/src/cmd/sgs/moe/amd64/msg.h
+usr/src/cmd/sgs/moe/i386/.make.state.i386
+usr/src/cmd/sgs/moe/i386/moe
+usr/src/cmd/sgs/moe/i386/msg.c
+usr/src/cmd/sgs/moe/i386/msg.h
+usr/src/cmd/sgs/nm/amd64/.make.state.i386
+usr/src/cmd/sgs/nm/amd64/nm
+usr/src/cmd/sgs/nm/i386/.make.state.i386
+usr/src/cmd/sgs/nm/i386/nm
+usr/src/cmd/sgs/nm/i386/nm.xpg4
+usr/src/cmd/sgs/prof/i386/.make.state.i386
+usr/src/cmd/sgs/prof/i386/prof
+usr/src/cmd/sgs/proto/
+usr/src/cmd/sgs/pvs/.make.state.i386
+usr/src/cmd/sgs/pvs/amd64/.make.state.i386
+usr/src/cmd/sgs/pvs/amd64/msg.c
+usr/src/cmd/sgs/pvs/amd64/msg.h
+usr/src/cmd/sgs/pvs/amd64/pvs
+usr/src/cmd/sgs/pvs/i386/.make.state.i386
+usr/src/cmd/sgs/pvs/i386/msg.c
+usr/src/cmd/sgs/pvs/i386/msg.h
+usr/src/cmd/sgs/pvs/i386/pvs
+usr/src/cmd/sgs/ranlib/ranlib
+usr/src/cmd/sgs/rtld/.make.state.i386
+usr/src/cmd/sgs/rtld/amd64/.make.state.i386
+usr/src/cmd/sgs/rtld/amd64/msg.c
+usr/src/cmd/sgs/rtld/amd64/msg.h
+usr/src/cmd/sgs/rtld/i386/.make.state.i386
+usr/src/cmd/sgs/rtld/i386/msg.c
+usr/src/cmd/sgs/rtld/i386/msg.h
+usr/src/cmd/sgs/rtld/mdbmod/.make.state.i386
+usr/src/cmd/sgs/rtld/mdbmod/amd64/.make.state.i386
+usr/src/cmd/sgs/rtld/mdbmod/amd64/msg.c
+usr/src/cmd/sgs/rtld/mdbmod/amd64/msg.h
+usr/src/cmd/sgs/rtld/mdbmod/i386/.make.state.i386
+usr/src/cmd/sgs/rtld/mdbmod/i386/msg.c
+usr/src/cmd/sgs/rtld/mdbmod/i386/msg.h
+usr/src/cmd/sgs/size/amd64/.make.state.i386
+usr/src/cmd/sgs/size/amd64/size
+usr/src/cmd/sgs/size/i386/.make.state.i386
+usr/src/cmd/sgs/size/i386/size
+usr/src/cmd/sgs/symorder/symorder
+usr/src/cmd/sgs/tools/i386/.make.state.i386
+usr/src/cmd/sgs/tools/i386/piglatin
+usr/src/cmd/sgs/tools/i386/sgsmsg
+usr/src/cmd/sgs/tsort/i386/tsort
+usr/src/cmd/sgs/unifdef/i386/unifdef
+usr/src/cmd/sgs/yacc/amd64/llib-ly.ln
+usr/src/cmd/sgs/yacc/i386/llib-ly.ln
+usr/src/cmd/sgs/yacc/i386/yacc
+usr/src/cmd/sh/sh
+usr/src/cmd/shcomp/shcomp
+usr/src/cmd/smbios/smbios
+usr/src/cmd/smserverd/rpc.smserverd
+usr/src/cmd/smserverd/smed.h
+usr/src/cmd/smserverd/smed_svc.c
+usr/src/cmd/smserverd/smed_xdr.c
+usr/src/cmd/soelim/soelim
+usr/src/cmd/sort/amd64/sort
+usr/src/cmd/sort/amd64/sort.xpg4
+usr/src/cmd/sort/i386/sort
+usr/src/cmd/sort/i386/sort.xpg4
+usr/src/cmd/spell/compress
+usr/src/cmd/spell/hashcheck
+usr/src/cmd/spell/hashmake
+usr/src/cmd/spell/hashmk1
+usr/src/cmd/spell/hlista
+usr/src/cmd/spell/hlistb
+usr/src/cmd/spell/hstop
+usr/src/cmd/spell/htemp1
+usr/src/cmd/spell/spell
+usr/src/cmd/spell/spellhist
+usr/src/cmd/spell/spellin
+usr/src/cmd/spell/spellin1
+usr/src/cmd/spell/spellprog
+usr/src/cmd/split/split
+usr/src/cmd/sqlite/sqlite
+usr/src/cmd/srchtxt/srchtxt
+usr/src/cmd/srptadm/srptadm
+usr/src/cmd/srptsvc/svc-srpt
+usr/src/cmd/ssh/THIRDPARTYLICENSE
+usr/src/cmd/ssh/libopenbsd-compat/i386/lint.out
+usr/src/cmd/ssh/libopenbsd-compat/i386/llib-lopenbsd-compat.ln
+usr/src/cmd/ssh/libssh/i386/lint.out
+usr/src/cmd/ssh/libssh/i386/llib-lssh.ln
+usr/src/cmd/ssh/scp/scp
+usr/src/cmd/ssh/sftp-server/sftp-server
+usr/src/cmd/ssh/sftp/sftp
+usr/src/cmd/ssh/ssh-add/ssh-add
+usr/src/cmd/ssh/ssh-agent/ssh-agent
+usr/src/cmd/ssh/ssh-http-proxy-connect/ssh-http-proxy-connect
+usr/src/cmd/ssh/ssh-keygen/ssh-keygen
+usr/src/cmd/ssh/ssh-keyscan/ssh-keyscan
+usr/src/cmd/ssh/ssh-keysign/ssh-keysign
+usr/src/cmd/ssh/ssh-socks5-proxy-connect/ssh-socks5-proxy-connect
+usr/src/cmd/ssh/ssh/ssh
+usr/src/cmd/ssh/sshd/sshd
+usr/src/cmd/stat/arcstat/arcstat
+usr/src/cmd/stat/fsstat/fsstat
+usr/src/cmd/stat/iostat/iostat
+usr/src/cmd/stat/mpstat/mpstat
+usr/src/cmd/stat/vfsstat/vfsstat
+usr/src/cmd/stat/vmstat/vmstat
+usr/src/cmd/stat/ziostat/ziostat
+usr/src/cmd/stmfadm/stmfadm
+usr/src/cmd/stmfproxy/aluaadm/aluaadm
+usr/src/cmd/stmfproxy/stmfproxy/svc-stmfproxy
+usr/src/cmd/stmfsvc/svc-stmf
+usr/src/cmd/stmsboot/stmsboot
+usr/src/cmd/stmsboot/stmsboot_util
+usr/src/cmd/streams/log/strace
+usr/src/cmd/streams/log/strclean
+usr/src/cmd/streams/log/strerr
+usr/src/cmd/streams/strcmd/strchg
+usr/src/cmd/streams/strcmd/strconf
+usr/src/cmd/strings/amd64/strings
+usr/src/cmd/strings/i386/strings
+usr/src/cmd/su/embedded_su
+usr/src/cmd/su/su
+usr/src/cmd/su/su.static
+usr/src/cmd/sulogin/sulogin
+usr/src/cmd/sunpc/other/dos2unix
+usr/src/cmd/sunpc/other/unix2dos
+usr/src/cmd/svc/configd/svc.configd
+usr/src/cmd/svc/configd/svc.configd-native
+usr/src/cmd/svc/lsvcrun/lsvcrun
+usr/src/cmd/svc/mfstscan/mfstscan
+usr/src/cmd/svc/milestone/console-login.xml
+usr/src/cmd/svc/profile/check_limited
+usr/src/cmd/svc/profile/check_limited.all
+usr/src/cmd/svc/profile/check_limited.enabled
+usr/src/cmd/svc/profile/check_limited.notcovered
+usr/src/cmd/svc/profile/check_open
+usr/src/cmd/svc/profile/check_open.all
+usr/src/cmd/svc/profile/check_open.enabled
+usr/src/cmd/svc/profile/check_open.notcovered
+usr/src/cmd/svc/seed/common.db
+usr/src/cmd/svc/seed/global.db
+usr/src/cmd/svc/seed/miniroot.db
+usr/src/cmd/svc/seed/nonglobal.db
+usr/src/cmd/svc/servinfo/servinfo
+usr/src/cmd/svc/startd/svc.startd
+usr/src/cmd/svc/svcadm/svcadm
+usr/src/cmd/svc/svccfg/svccfg
+usr/src/cmd/svc/svccfg/svccfg-native
+usr/src/cmd/svc/svccfg/svccfg_grammar.c
+usr/src/cmd/svc/svccfg/svccfg_grammar.h
+usr/src/cmd/svc/svccfg/svccfg_lex.c
+usr/src/cmd/svc/svcprop/svcprop
+usr/src/cmd/svc/svcs/svcs
+usr/src/cmd/svr4pkg/installf/dofinal.i
+usr/src/cmd/svr4pkg/installf/installf
+usr/src/cmd/svr4pkg/installf/installf.i
+usr/src/cmd/svr4pkg/installf/main.i
+usr/src/cmd/svr4pkg/installf/removef.i
+usr/src/cmd/svr4pkg/libinst/copyf.i
+usr/src/cmd/svr4pkg/libinst/cvtpath.i
+usr/src/cmd/svr4pkg/libinst/depchk.i
+usr/src/cmd/svr4pkg/libinst/dockdeps.i
+usr/src/cmd/svr4pkg/libinst/doulimit.i
+usr/src/cmd/svr4pkg/libinst/dryrun.i
+usr/src/cmd/svr4pkg/libinst/echo.i
+usr/src/cmd/svr4pkg/libinst/eptstat.i
+usr/src/cmd/svr4pkg/libinst/finalck.i
+usr/src/cmd/svr4pkg/libinst/findscripts.i
+usr/src/cmd/svr4pkg/libinst/fixpath.i
+usr/src/cmd/svr4pkg/libinst/flex_dev.i
+usr/src/cmd/svr4pkg/libinst/is_local_host.i
+usr/src/cmd/svr4pkg/libinst/isreloc.i
+usr/src/cmd/svr4pkg/libinst/listmgr.i
+usr/src/cmd/svr4pkg/libinst/lockinst.i
+usr/src/cmd/svr4pkg/libinst/log.i
+usr/src/cmd/svr4pkg/libinst/mntinfo.i
+usr/src/cmd/svr4pkg/libinst/nblk.i
+usr/src/cmd/svr4pkg/libinst/ocfile.i
+usr/src/cmd/svr4pkg/libinst/open_package_datastream.i
+usr/src/cmd/svr4pkg/libinst/pathdup.i
+usr/src/cmd/svr4pkg/libinst/pkgdbmerg.i
+usr/src/cmd/svr4pkg/libinst/pkgobjmap.i
+usr/src/cmd/svr4pkg/libinst/pkgops.i
+usr/src/cmd/svr4pkg/libinst/procmap.i
+usr/src/cmd/svr4pkg/libinst/ptext.i
+usr/src/cmd/svr4pkg/libinst/putparam.i
+usr/src/cmd/svr4pkg/libinst/qreason.i
+usr/src/cmd/svr4pkg/libinst/qstrdup.i
+usr/src/cmd/svr4pkg/libinst/scriptvfy.i
+usr/src/cmd/svr4pkg/libinst/setadmin.i
+usr/src/cmd/svr4pkg/libinst/setlist.i
+usr/src/cmd/svr4pkg/libinst/setup_temporary_directory.i
+usr/src/cmd/svr4pkg/libinst/sml.i
+usr/src/cmd/svr4pkg/libinst/srcpath.i
+usr/src/cmd/svr4pkg/libinst/stub.i
+usr/src/cmd/svr4pkg/libinst/unpack_package_from_stream.i
+usr/src/cmd/svr4pkg/pkgadd/check.i
+usr/src/cmd/svr4pkg/pkgadd/main.i
+usr/src/cmd/svr4pkg/pkgadd/pkgadd
+usr/src/cmd/svr4pkg/pkgadd/quit.i
+usr/src/cmd/svr4pkg/pkgadm/addcert.i
+usr/src/cmd/svr4pkg/pkgadm/certs.i
+usr/src/cmd/svr4pkg/pkgadm/listcert.i
+usr/src/cmd/svr4pkg/pkgadm/lock.i
+usr/src/cmd/svr4pkg/pkgadm/main.i
+usr/src/cmd/svr4pkg/pkgadm/pkgadm
+usr/src/cmd/svr4pkg/pkgadm/removecert.i
+usr/src/cmd/svr4pkg/pkgchk/checkmap.i
+usr/src/cmd/svr4pkg/pkgchk/ckentry.i
+usr/src/cmd/svr4pkg/pkgchk/main.i
+usr/src/cmd/svr4pkg/pkgchk/pkgchk
+usr/src/cmd/svr4pkg/pkgcond/main.i
+usr/src/cmd/svr4pkg/pkgcond/pkgcond
+usr/src/cmd/svr4pkg/pkginfo/pkginfo
+usr/src/cmd/svr4pkg/pkginfo/pkginfo.i
+usr/src/cmd/svr4pkg/pkginstall/backup.i
+usr/src/cmd/svr4pkg/pkginstall/check.i
+usr/src/cmd/svr4pkg/pkginstall/cppath.i
+usr/src/cmd/svr4pkg/pkginstall/dockspace.i
+usr/src/cmd/svr4pkg/pkginstall/getinst.i
+usr/src/cmd/svr4pkg/pkginstall/instvol.i
+usr/src/cmd/svr4pkg/pkginstall/main.i
+usr/src/cmd/svr4pkg/pkginstall/merginfo.i
+usr/src/cmd/svr4pkg/pkginstall/pkgenv.i
+usr/src/cmd/svr4pkg/pkginstall/pkginstall
+usr/src/cmd/svr4pkg/pkginstall/pkgvolume.i
+usr/src/cmd/svr4pkg/pkginstall/quit.i
+usr/src/cmd/svr4pkg/pkginstall/reqexec.i
+usr/src/cmd/svr4pkg/pkginstall/sortmap.i
+usr/src/cmd/svr4pkg/pkgmk/main.i
+usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.i
+usr/src/cmd/svr4pkg/pkgmk/pkgmk
+usr/src/cmd/svr4pkg/pkgmk/quit.i
+usr/src/cmd/svr4pkg/pkgmk/splpkgmap.i
+usr/src/cmd/svr4pkg/pkgname/pkgname
+usr/src/cmd/svr4pkg/pkgname/pkgname.i
+usr/src/cmd/svr4pkg/pkgparam/pkgparam
+usr/src/cmd/svr4pkg/pkgparam/pkgparam.i
+usr/src/cmd/svr4pkg/pkgproto/main.i
+usr/src/cmd/svr4pkg/pkgproto/pkgproto
+usr/src/cmd/svr4pkg/pkgremove/check.i
+usr/src/cmd/svr4pkg/pkgremove/delmap.i
+usr/src/cmd/svr4pkg/pkgremove/main.i
+usr/src/cmd/svr4pkg/pkgremove/pkgremove
+usr/src/cmd/svr4pkg/pkgremove/quit.i
+usr/src/cmd/svr4pkg/pkgremove/special.i
+usr/src/cmd/svr4pkg/pkgrm/check.i
+usr/src/cmd/svr4pkg/pkgrm/main.i
+usr/src/cmd/svr4pkg/pkgrm/pkgrm
+usr/src/cmd/svr4pkg/pkgrm/quit.i
+usr/src/cmd/svr4pkg/pkgscripts/cmdexec
+usr/src/cmd/svr4pkg/pkgscripts/cmdexec.i
+usr/src/cmd/svr4pkg/pkgscripts/i.CompCpio
+usr/src/cmd/svr4pkg/pkgscripts/i.awk
+usr/src/cmd/svr4pkg/pkgscripts/i.build
+usr/src/cmd/svr4pkg/pkgscripts/i.preserve
+usr/src/cmd/svr4pkg/pkgscripts/i.sed
+usr/src/cmd/svr4pkg/pkgscripts/r.awk
+usr/src/cmd/svr4pkg/pkgscripts/r.build
+usr/src/cmd/svr4pkg/pkgscripts/r.sed
+usr/src/cmd/svr4pkg/pkgserv/pkgserv
+usr/src/cmd/svr4pkg/pkgserv/pkgserv.i
+usr/src/cmd/svr4pkg/pkgtrans/main.i
+usr/src/cmd/svr4pkg/pkgtrans/pkgtrans
+usr/src/cmd/swap/amd64/swap
+usr/src/cmd/swap/i386/swap
+usr/src/cmd/sync/sync
+usr/src/cmd/sysdef/amd64/sysdef
+usr/src/cmd/sysdef/i386/sysdef
+usr/src/cmd/syseventadm/syseventadm
+usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd
+usr/src/cmd/syseventd/daemons/syseventd/syseventd
+usr/src/cmd/syslogd/i386/authlog
+usr/src/cmd/syslogd/i386/syslog
+usr/src/cmd/syslogd/i386/syslogd
+usr/src/cmd/tabs/tabs
+usr/src/cmd/tail/tail
+usr/src/cmd/tar/tar
+usr/src/cmd/tar/tar.dc
+usr/src/cmd/tbl/tbl
+usr/src/cmd/tcopy/tcopy
+usr/src/cmd/tcpd/THIRDPARTYLICENSE
+usr/src/cmd/tcpd/safe_finger
+usr/src/cmd/tcpd/sunman/
+usr/src/cmd/tcpd/tcpd
+usr/src/cmd/tcpd/tcpdchk
+usr/src/cmd/tcpd/tcpdmatch
+usr/src/cmd/tcpd/try-from
+usr/src/cmd/terminfo/errs
+usr/src/cmd/terminfo/terminfo.src
+usr/src/cmd/th_tools/th_define
+usr/src/cmd/th_tools/th_manage
+usr/src/cmd/th_tools/th_script
+usr/src/cmd/tic/tic
+usr/src/cmd/time/time
+usr/src/cmd/tip/aculog
+usr/src/cmd/tip/tip
+usr/src/cmd/tnf/prex/amd64/prex
+usr/src/cmd/tnf/prex/amd64/prexgram.c
+usr/src/cmd/tnf/prex/amd64/prexlex.c
+usr/src/cmd/tnf/prex/amd64/y.tab.h
+usr/src/cmd/tnf/prex/i386/prex
+usr/src/cmd/tnf/prex/i386/prexgram.c
+usr/src/cmd/tnf/prex/i386/prexlex.c
+usr/src/cmd/tnf/prex/i386/y.tab.h
+usr/src/cmd/tnf/tnfdump/tnfdump
+usr/src/cmd/tnf/tnfxtract/amd64/tnfxtract
+usr/src/cmd/tnf/tnfxtract/i386/tnfxtract
+usr/src/cmd/touch/touch
+usr/src/cmd/tput/tput
+usr/src/cmd/tr/tr
+usr/src/cmd/troff/nroff.d/nroff
+usr/src/cmd/troff/nroff.d/terms.d/tab.2631
+usr/src/cmd/troff/nroff.d/terms.d/tab.2631-c
+usr/src/cmd/troff/nroff.d/terms.d/tab.2631-e
+usr/src/cmd/troff/nroff.d/terms.d/tab.300
+usr/src/cmd/troff/nroff.d/terms.d/tab.300-12
+usr/src/cmd/troff/nroff.d/terms.d/tab.300s
+usr/src/cmd/troff/nroff.d/terms.d/tab.300s-12
+usr/src/cmd/troff/nroff.d/terms.d/tab.37
+usr/src/cmd/troff/nroff.d/terms.d/tab.382
+usr/src/cmd/troff/nroff.d/terms.d/tab.4000a
+usr/src/cmd/troff/nroff.d/terms.d/tab.450
+usr/src/cmd/troff/nroff.d/terms.d/tab.450-12
+usr/src/cmd/troff/nroff.d/terms.d/tab.832
+usr/src/cmd/troff/nroff.d/terms.d/tab.8510
+usr/src/cmd/troff/nroff.d/terms.d/tab.X
+usr/src/cmd/troff/nroff.d/terms.d/tab.lp
+usr/src/cmd/troff/nroff.d/terms.d/tab.tn300
+usr/src/cmd/troff/troff.d/makedev
+usr/src/cmd/troff/troff.d/ta
+usr/src/cmd/troff/troff.d/troff
+usr/src/cmd/true/true
+usr/src/cmd/truss/amd64/truss
+usr/src/cmd/truss/i386/truss
+usr/src/cmd/tsol/atohexlabel/atohexlabel
+usr/src/cmd/tsol/getlabel/getlabel
+usr/src/cmd/tsol/getzonepath/getzonepath
+usr/src/cmd/tsol/hextoalabel/hextoalabel
+usr/src/cmd/tsol/lslabels/lslabels
+usr/src/cmd/tsol/misc/relabel
+usr/src/cmd/tsol/misc/txzonemgr
+usr/src/cmd/tsol/plabel/plabel
+usr/src/cmd/tsol/setlabel/setlabel
+usr/src/cmd/tsol/tnchkdb/tnchkdb
+usr/src/cmd/tsol/tnctl/tnctl
+usr/src/cmd/tsol/tnd/tnd
+usr/src/cmd/tsol/tninfo/tninfo
+usr/src/cmd/tsol/updatehome/updatehome
+usr/src/cmd/tsol/zones/zoneshare
+usr/src/cmd/tsol/zones/zoneunshare
+usr/src/cmd/tty/tty
+usr/src/cmd/ttymon/stty
+usr/src/cmd/ttymon/stty.xpg4
+usr/src/cmd/ttymon/sttydefs
+usr/src/cmd/ttymon/ttyadm
+usr/src/cmd/ttymon/ttymon
+usr/src/cmd/tzreload/tzreload
+usr/src/cmd/uadmin/uadmin
+usr/src/cmd/ucodeadm/ucode_errno.c
+usr/src/cmd/ucodeadm/ucodeadm
+usr/src/cmd/ul/ul
+usr/src/cmd/uname/uname
+usr/src/cmd/units/units
+usr/src/cmd/unlink/unlink
+usr/src/cmd/unpack/unpack
+usr/src/cmd/userattr/userattr
+usr/src/cmd/users/listusers
+usr/src/cmd/utmp_update/utmp_update
+usr/src/cmd/utmpd/utmpd
+usr/src/cmd/valtools/ckdate
+usr/src/cmd/valtools/ckgid
+usr/src/cmd/valtools/ckint
+usr/src/cmd/valtools/ckitem
+usr/src/cmd/valtools/ckkeywd
+usr/src/cmd/valtools/ckpath
+usr/src/cmd/valtools/ckrange
+usr/src/cmd/valtools/ckstr
+usr/src/cmd/valtools/cktime
+usr/src/cmd/valtools/ckuid
+usr/src/cmd/valtools/ckyorn
+usr/src/cmd/valtools/puttext
+usr/src/cmd/vgrind/vfontedpr
+usr/src/cmd/vgrind/vgrind
+usr/src/cmd/vgrind/vgrindefs
+usr/src/cmd/vi/misc/ctags
+usr/src/cmd/vi/misc/ctags.xpg4
+usr/src/cmd/vi/misc/cxref
+usr/src/cmd/vi/misc/fold
+usr/src/cmd/vi/port/ex
+usr/src/cmd/vi/port/ex.xpg4
+usr/src/cmd/vi/port/ex.xpg6
+usr/src/cmd/vi/port/expreserve
+usr/src/cmd/vi/port/exrecover
+usr/src/cmd/volcheck/volcheck
+usr/src/cmd/volrmmount/volrmmount
+usr/src/cmd/vrrpadm/vrrpadm
+usr/src/cmd/vscan/vscanadm/vscanadm
+usr/src/cmd/vscan/vscand/vscand
+usr/src/cmd/vt/vtdaemon
+usr/src/cmd/vt/vtinfo
+usr/src/cmd/vt/vtxlock
+usr/src/cmd/w/amd64/w
+usr/src/cmd/w/i386/w
+usr/src/cmd/w/w.dc
+usr/src/cmd/wall/wall
+usr/src/cmd/which/which
+usr/src/cmd/who/utmpx
+usr/src/cmd/who/who
+usr/src/cmd/who/who.dc
+usr/src/cmd/who/who.xpg4
+usr/src/cmd/whodo/amd64/whodo
+usr/src/cmd/whodo/i386/whodo
+usr/src/cmd/whodo/whodo.dc
+usr/src/cmd/wracct/wracct
+usr/src/cmd/write/write
+usr/src/cmd/write/write.dc
+usr/src/cmd/wusbadm/wusbadm
+usr/src/cmd/xargs/xargs
+usr/src/cmd/xstr/xstr
+usr/src/cmd/xvm/ipagent/ipagent
+usr/src/cmd/yes/yes
+usr/src/cmd/ypcmd/makedbm
+usr/src/cmd/ypcmd/mkalias
+usr/src/cmd/ypcmd/mknetid/mknetid
+usr/src/cmd/ypcmd/multi
+usr/src/cmd/ypcmd/multi.awk
+usr/src/cmd/ypcmd/revnetgroup/revnetgroup
+usr/src/cmd/ypcmd/stdethers
+usr/src/cmd/ypcmd/stdhosts
+usr/src/cmd/ypcmd/udpublickey
+usr/src/cmd/ypcmd/yp
+usr/src/cmd/ypcmd/yp2lscripts/inityp2l
+usr/src/cmd/ypcmd/yp2lscripts/ypmap2src
+usr/src/cmd/ypcmd/ypalias
+usr/src/cmd/ypcmd/ypbind
+usr/src/cmd/ypcmd/ypcat
+usr/src/cmd/ypcmd/ypinit
+usr/src/cmd/ypcmd/ypmatch
+usr/src/cmd/ypcmd/yppasswd/rpc.yppasswdd
+usr/src/cmd/ypcmd/yppoll
+usr/src/cmd/ypcmd/yppush
+usr/src/cmd/ypcmd/ypserv
+usr/src/cmd/ypcmd/ypset
+usr/src/cmd/ypcmd/ypstart
+usr/src/cmd/ypcmd/ypstop
+usr/src/cmd/ypcmd/ypupdated/rpc.ypupdated
+usr/src/cmd/ypcmd/ypupdated/ypupdated_prot.h
+usr/src/cmd/ypcmd/ypwhich
+usr/src/cmd/ypcmd/ypxfr
+usr/src/cmd/ypcmd/ypxfr_1perday
+usr/src/cmd/ypcmd/ypxfr_1perhour
+usr/src/cmd/ypcmd/ypxfr_2perday
+usr/src/cmd/ypcmd/ypxfrd
+usr/src/cmd/ypcmd/ypxfrd.h
+usr/src/cmd/ypcmd/ypxfrd_xdr.c
+usr/src/cmd/yppasswd/yppasswd
+usr/src/cmd/zdb/amd64/zdb
+usr/src/cmd/zdb/i386/zdb
+usr/src/cmd/zdump/zdump
+usr/src/cmd/zfs/zfs
+usr/src/cmd/zic/native/
+usr/src/cmd/zic/tzselect
+usr/src/cmd/zic/zic
+usr/src/cmd/zinject/amd64/zinject
+usr/src/cmd/zinject/i386/zinject
+usr/src/cmd/zlogin/zlogin
+usr/src/cmd/zlook/amd64/zlook
+usr/src/cmd/zlook/i386/zlook
+usr/src/cmd/zoneadm/zoneadm
+usr/src/cmd/zoneadm/zonemon
+usr/src/cmd/zoneadmd/zoneadmd
+usr/src/cmd/zonecfg/zonecfg
+usr/src/cmd/zonecfg/zonecfg_grammar.tab.c
+usr/src/cmd/zonecfg/zonecfg_grammar.tab.h
+usr/src/cmd/zonecfg/zonecfg_lex.c
+usr/src/cmd/zonename/zonename
+usr/src/cmd/zonestat/zonestat/zonestat
+usr/src/cmd/zonestat/zonestatd/zonestatd
+usr/src/cmd/zpool/zpool
+usr/src/cmd/zstreamdump/zstreamdump
+usr/src/cmd/ztest/amd64/ztest
+usr/src/cmd/ztest/i386/ztest
+usr/src/common/mapfiles/gen/amd64_cc_map.noexeglobs
+usr/src/common/mapfiles/gen/amd64_gcc_map.noexeglobs
+usr/src/common/mapfiles/gen/i386_cc_map.noexeglobs
+usr/src/common/mapfiles/gen/i386_gcc_map.noexeglobs
+usr/src/grub/grub-0.97/grub/grub
+usr/src/grub/grub-0.97/stage1/stage1
+usr/src/grub/grub-0.97/stage1/stage1.exec
+usr/src/grub/grub-0.97/stage2/diskless
+usr/src/grub/grub-0.97/stage2/diskless.exec
+usr/src/grub/grub-0.97/stage2/diskless_size.h
+usr/src/grub/grub-0.97/stage2/e2fs_stage1_5
+usr/src/grub/grub-0.97/stage2/e2fs_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/fat_stage1_5
+usr/src/grub/grub-0.97/stage2/fat_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/ffs_stage1_5
+usr/src/grub/grub-0.97/stage2/ffs_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/iso9660_stage1_5
+usr/src/grub/grub-0.97/stage2/iso9660_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/jfs_stage1_5
+usr/src/grub/grub-0.97/stage2/jfs_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/minix_stage1_5
+usr/src/grub/grub-0.97/stage2/minix_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/nbgrub
+usr/src/grub/grub-0.97/stage2/nbloader
+usr/src/grub/grub-0.97/stage2/nbloader.exec
+usr/src/grub/grub-0.97/stage2/pre_stage2
+usr/src/grub/grub-0.97/stage2/pre_stage2.exec
+usr/src/grub/grub-0.97/stage2/pxegrub
+usr/src/grub/grub-0.97/stage2/pxeloader
+usr/src/grub/grub-0.97/stage2/pxeloader.exec
+usr/src/grub/grub-0.97/stage2/reiserfs_stage1_5
+usr/src/grub/grub-0.97/stage2/reiserfs_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/stage2
+usr/src/grub/grub-0.97/stage2/stage2_eltorito
+usr/src/grub/grub-0.97/stage2/stage2_size.h
+usr/src/grub/grub-0.97/stage2/start
+usr/src/grub/grub-0.97/stage2/start.exec
+usr/src/grub/grub-0.97/stage2/start_eltorito
+usr/src/grub/grub-0.97/stage2/start_eltorito.exec
+usr/src/grub/grub-0.97/stage2/ufs2_stage1_5
+usr/src/grub/grub-0.97/stage2/ufs2_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/ufs_stage1_5
+usr/src/grub/grub-0.97/stage2/ufs_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/vstafs_stage1_5
+usr/src/grub/grub-0.97/stage2/vstafs_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/xfs_stage1_5
+usr/src/grub/grub-0.97/stage2/xfs_stage1_5.exec
+usr/src/grub/grub-0.97/stage2/zfs_stage1_5
+usr/src/grub/grub-0.97/stage2/zfs_stage1_5.exec
+usr/src/head/mdiox.h
+usr/src/head/meta_basic.h
+usr/src/head/metacl.h
+usr/src/head/metad.h
+usr/src/head/metamed.h
+usr/src/head/metamhd.h
+usr/src/head/mhdx.h
+usr/src/head/rpcsvc/bootparam_prot.h
+usr/src/head/rpcsvc/mount.h
+usr/src/head/rpcsvc/nfs4_prot.h
+usr/src/head/rpcsvc/nfs_acl.h
+usr/src/head/rpcsvc/nfs_prot.c
+usr/src/head/rpcsvc/nfs_prot.h
+usr/src/head/rpcsvc/nis.h
+usr/src/head/rpcsvc/nlm_prot.h
+usr/src/head/rpcsvc/rex.h
+usr/src/head/rpcsvc/rquota.h
+usr/src/head/rpcsvc/rstat.h
+usr/src/head/rpcsvc/rusers.h
+usr/src/head/rpcsvc/rwall.h
+usr/src/head/rpcsvc/spray.h
+usr/src/head/rpcsvc/ufs_prot.h
+usr/src/install-nd-i386.out
+usr/src/lib/abi/apptrace/common/abienv.i
+usr/src/lib/abi/apptrace/common/apptrace.i
+usr/src/lib/brand/joyent/zone/jattach
+usr/src/lib/brand/joyent/zone/jdetach
+usr/src/lib/brand/joyent/zone/jinstall
+usr/src/lib/brand/joyent/zone/juninstall
+usr/src/lib/brand/joyent/zone/pinstall
+usr/src/lib/brand/joyent/zone/poststate
+usr/src/lib/brand/joyent/zone/prestate
+usr/src/lib/brand/joyent/zone/query
+usr/src/lib/brand/joyent/zone/statechange
+usr/src/lib/brand/kvm/zone/kattach
+usr/src/lib/brand/kvm/zone/kdetach
+usr/src/lib/brand/kvm/zone/kinstall
+usr/src/lib/brand/kvm/zone/kuninstall
+usr/src/lib/brand/kvm/zone/pinstall
+usr/src/lib/brand/kvm/zone/poststate
+usr/src/lib/brand/kvm/zone/prestate
+usr/src/lib/brand/kvm/zone/statechange
+usr/src/lib/brand/shared/brand/amd64/assym.h
+usr/src/lib/brand/shared/brand/i386/assym.h
+usr/src/lib/brand/shared/zone/query
+usr/src/lib/brand/sn1/zone/sn1_boot
+usr/src/lib/brand/solaris10/cmd/s10_isaexec_wrapper
+usr/src/lib/brand/solaris10/cmd/s10_native
+usr/src/lib/brand/solaris10/cmd/s10_net_physical
+usr/src/lib/brand/solaris10/cmd/s10_python_wrapper
+usr/src/lib/brand/solaris10/s10_replacefile/s10_replacefile
+usr/src/lib/brand/solaris10/s10_support/s10_support
+usr/src/lib/brand/solaris10/zone/attach
+usr/src/lib/brand/solaris10/zone/clone
+usr/src/lib/brand/solaris10/zone/detach
+usr/src/lib/brand/solaris10/zone/image_install
+usr/src/lib/brand/solaris10/zone/p2v
+usr/src/lib/brand/solaris10/zone/postattach
+usr/src/lib/brand/solaris10/zone/poststate
+usr/src/lib/brand/solaris10/zone/prestate
+usr/src/lib/brand/solaris10/zone/preuninstall
+usr/src/lib/brand/solaris10/zone/s10_boot
+usr/src/lib/brand/solaris10/zone/uninstall
+usr/src/lib/c_synonyms/amd64/mapfile-vers
+usr/src/lib/c_synonyms/amd64/synonym_list
+usr/src/lib/c_synonyms/i386/mapfile-vers
+usr/src/lib/c_synonyms/i386/synonym_list
+usr/src/lib/cfgadm_plugins/sbd/common/ap_err.c
+usr/src/lib/cfgadm_plugins/sbd/sbdgenerr
+usr/src/lib/fm/libdiagcode/amd64/lint.out
+usr/src/lib/fm/libdiagcode/amd64/llib-ldiagcode.ln
+usr/src/lib/fm/libdiagcode/i386/lint.out
+usr/src/lib/fm/libdiagcode/i386/llib-ldiagcode.ln
+usr/src/lib/fm/libdiskstatus/amd64/lint.out
+usr/src/lib/fm/libdiskstatus/amd64/llib-ldiskstatus.ln
+usr/src/lib/fm/libdiskstatus/i386/lint.out
+usr/src/lib/fm/libdiskstatus/i386/llib-ldiskstatus.ln
+usr/src/lib/fm/libfmd_adm/amd64/fmd_rpc.c
+usr/src/lib/fm/libfmd_adm/amd64/fmd_rpc_adm.h
+usr/src/lib/fm/libfmd_adm/amd64/fmd_rpc_adm.x
+usr/src/lib/fm/libfmd_adm/amd64/fmd_xdr.c
+usr/src/lib/fm/libfmd_adm/amd64/lint.out
+usr/src/lib/fm/libfmd_adm/amd64/llib-lfmd_adm.ln
+usr/src/lib/fm/libfmd_adm/i386/fmd_rpc.c
+usr/src/lib/fm/libfmd_adm/i386/fmd_rpc_adm.h
+usr/src/lib/fm/libfmd_adm/i386/fmd_rpc_adm.x
+usr/src/lib/fm/libfmd_adm/i386/fmd_xdr.c
+usr/src/lib/fm/libfmd_adm/i386/lint.out
+usr/src/lib/fm/libfmd_adm/i386/llib-lfmd_adm.ln
+usr/src/lib/fm/libfmd_agent/amd64/lint.out
+usr/src/lib/fm/libfmd_agent/amd64/llib-lfmd_agent.ln
+usr/src/lib/fm/libfmd_agent/i386/lint.out
+usr/src/lib/fm/libfmd_agent/i386/llib-lfmd_agent.ln
+usr/src/lib/fm/libfmd_log/amd64/lint.out
+usr/src/lib/fm/libfmd_log/amd64/llib-lfmd_log.ln
+usr/src/lib/fm/libfmd_log/i386/lint.out
+usr/src/lib/fm/libfmd_log/i386/llib-lfmd_log.ln
+usr/src/lib/fm/libfmd_msg/amd64/lint.out
+usr/src/lib/fm/libfmd_msg/amd64/llib-lfmd_msg.ln
+usr/src/lib/fm/libfmd_msg/i386/lint.out
+usr/src/lib/fm/libfmd_msg/i386/llib-lfmd_msg.ln
+usr/src/lib/fm/libfmd_snmp/amd64/lint.out
+usr/src/lib/fm/libfmd_snmp/amd64/llib-lfmd_snmp.ln
+usr/src/lib/fm/libfmd_snmp/i386/lint.out
+usr/src/lib/fm/libfmd_snmp/i386/llib-lfmd_snmp.ln
+usr/src/lib/fm/libfmevent/amd64/lint.out
+usr/src/lib/fm/libfmevent/amd64/llib-lfmevent.ln
+usr/src/lib/fm/libfmevent/common/fmev_errstring.c
+usr/src/lib/fm/libfmevent/i386/lint.out
+usr/src/lib/fm/libfmevent/i386/llib-lfmevent.ln
+usr/src/lib/fm/libfmnotify/amd64/lint.out
+usr/src/lib/fm/libfmnotify/amd64/llib-lfmnotify.ln
+usr/src/lib/fm/libfmnotify/i386/lint.out
+usr/src/lib/fm/libfmnotify/i386/llib-lfmnotify.ln
+usr/src/lib/fm/libseslog/amd64/lint.out
+usr/src/lib/fm/libseslog/amd64/llib-lseslog.ln
+usr/src/lib/fm/libseslog/i386/lint.out
+usr/src/lib/fm/libseslog/i386/llib-lseslog.ln
+usr/src/lib/fm/topo/libtopo/amd64/lint.out
+usr/src/lib/fm/topo/libtopo/amd64/llib-ltopo.ln
+usr/src/lib/fm/topo/libtopo/common/topo_error.c
+usr/src/lib/fm/topo/libtopo/common/topo_tables.c
+usr/src/lib/fm/topo/libtopo/i386/lint.out
+usr/src/lib/fm/topo/libtopo/i386/llib-ltopo.ln
+usr/src/lib/fm/topo/maps/SUNW,Netra-X4200-M2/Netra-X4200-M2-disk-hc-topology.xml
+usr/src/lib/fm/topo/maps/SUNW,Sun-Fire-X4200-M2/Sun-Fire-X4200-M2-disk-hc-topology.xml
+usr/src/lib/fm/topo/maps/SUNW,Sun-Fire-X4200-Server/Sun-Fire-X4200-Server-disk-hc-topology.xml
+usr/src/lib/fm/topo/maps/SUNW,Sun-Fire-X4500/Sun-Fire-X4500-disk-hc-topology.xml
+usr/src/lib/fm/topo/maps/SUNW,Sun-Fire-X4540/Sun-Fire-X4540-disk-hc-topology.xml
+usr/src/lib/fm/topo/maps/SUNW,Sun-Fire-X4600-M2/Sun-Fire-X4600-M2-disk-hc-topology.xml
+usr/src/lib/fm/topo/maps/i386/xfp-hc-topology.xml
+usr/src/lib/fm/topo/maps/i86pc/fan-hc-topology.xml
+usr/src/lib/gss_mechs/mech_dh/backend/mech/dhmech_prot.h
+usr/src/lib/gss_mechs/mech_dh/backend/mech/xdr_token.c
+usr/src/lib/gss_mechs/mech_krb5/amd64/kwarnd.h
+usr/src/lib/gss_mechs/mech_krb5/amd64/kwarnd_clnt.c
+usr/src/lib/gss_mechs/mech_krb5/amd64/kwarnd_clnt_stubs.c
+usr/src/lib/gss_mechs/mech_krb5/amd64/kwarnd_handle.c
+usr/src/lib/gss_mechs/mech_krb5/amd64/kwarnd_xdr.c
+usr/src/lib/gss_mechs/mech_krb5/i386/kwarnd.h
+usr/src/lib/gss_mechs/mech_krb5/i386/kwarnd_clnt.c
+usr/src/lib/gss_mechs/mech_krb5/i386/kwarnd_clnt_stubs.c
+usr/src/lib/gss_mechs/mech_krb5/i386/kwarnd_handle.c
+usr/src/lib/gss_mechs/mech_krb5/i386/kwarnd_xdr.c
+usr/src/lib/hal/libhal-storage/amd64/hal-storage.pc
+usr/src/lib/hal/libhal-storage/amd64/libhal-storage.so.1.0.0
+usr/src/lib/hal/libhal-storage/amd64/lint.out
+usr/src/lib/hal/libhal-storage/amd64/llib-lhal-storage.ln
+usr/src/lib/hal/libhal-storage/i386/hal-storage.pc
+usr/src/lib/hal/libhal-storage/i386/libhal-storage.so.1.0.0
+usr/src/lib/hal/libhal-storage/i386/lint.out
+usr/src/lib/hal/libhal-storage/i386/llib-lhal-storage.ln
+usr/src/lib/hal/libhal/amd64/hal.pc
+usr/src/lib/hal/libhal/amd64/libhal.so.1.0.0
+usr/src/lib/hal/libhal/amd64/lint.out
+usr/src/lib/hal/libhal/amd64/llib-lhal.ln
+usr/src/lib/hal/libhal/i386/hal.pc
+usr/src/lib/hal/libhal/i386/libhal.so.1.0.0
+usr/src/lib/hal/libhal/i386/lint.out
+usr/src/lib/hal/libhal/i386/llib-lhal.ln
+usr/src/lib/hbaapi/amd64/lint.out
+usr/src/lib/hbaapi/amd64/llib-lHBAAPI.ln
+usr/src/lib/hbaapi/i386/lint.out
+usr/src/lib/hbaapi/i386/llib-lHBAAPI.ln
+usr/src/lib/krb5/kadm5/clnt/iprop.h
+usr/src/lib/krb5/kdb/iprop.h
+usr/src/lib/krb5/kdb/iprop_xdr.c
+usr/src/lib/libadm/amd64/lint.out
+usr/src/lib/libadm/amd64/llib-ladm.ln
+usr/src/lib/libadm/i386/lint.out
+usr/src/lib/libadm/i386/llib-ladm.ln
+usr/src/lib/libadt_jni/amd64/lint.out
+usr/src/lib/libadt_jni/amd64/llib-ladt_jni.ln
+usr/src/lib/libadt_jni/com/sun/audit/Audit.jar
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_admin_authenticate.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_admin_authenticate.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_filesystem_add.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_filesystem_add.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_filesystem_delete.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_filesystem_delete.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_filesystem_modify.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_filesystem_modify.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_ilb_delete_rule.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_ilb_delete_rule.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_ilb_disable_rule.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_ilb_disable_rule.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_ilb_enable_rule.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_ilb_enable_rule.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_logout.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_logout.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_network_add.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_network_add.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_network_delete.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_network_delete.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_network_modify.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_network_modify.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_printer_add.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_printer_add.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_printer_delete.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_printer_delete.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_printer_modify.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_printer_modify.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_role_login.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_role_login.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_scheduledjob_add.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_scheduledjob_add.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_scheduledjob_delete.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_scheduledjob_delete.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_scheduledjob_modify.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_scheduledjob_modify.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_serialport_add.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_serialport_add.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_serialport_delete.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_serialport_delete.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_serialport_modify.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_serialport_modify.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_uauth.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_uauth.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_usermgr_add.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_usermgr_add.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_usermgr_delete.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_usermgr_delete.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_usermgr_modify.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditEvent_usermgr_modify.java
+usr/src/lib/libadt_jni/com/sun/audit/AuditSession.class
+usr/src/lib/libadt_jni/com/sun/audit/AuditSession.h
+usr/src/lib/libadt_jni/common/adt_jni_event.c
+usr/src/lib/libadt_jni/common/mapfile-vers
+usr/src/lib/libadt_jni/i386/lint.out
+usr/src/lib/libadt_jni/i386/llib-ladt_jni.ln
+usr/src/lib/libadutils/amd64/lint.out
+usr/src/lib/libadutils/amd64/llib-ladutils.ln
+usr/src/lib/libadutils/i386/lint.out
+usr/src/lib/libadutils/i386/llib-ladutils.ln
+usr/src/lib/libaio/amd64/lint.out
+usr/src/lib/libaio/amd64/llib-laio.ln
+usr/src/lib/libaio/i386/lint.out
+usr/src/lib/libaio/i386/llib-laio.ln
+usr/src/lib/libast/amd64/libast.msg
+usr/src/lib/libast/amd64/lint.out
+usr/src/lib/libast/amd64/llib-last.ln
+usr/src/lib/libast/amd64/msgcc.out
+usr/src/lib/libast/amd64/msgs/
+usr/src/lib/libast/i386/libast.msg
+usr/src/lib/libast/i386/lint.out
+usr/src/lib/libast/i386/llib-last.ln
+usr/src/lib/libast/i386/msgcc.out
+usr/src/lib/libast/i386/msgs/
+usr/src/lib/libast/tmpastinclude/
+usr/src/lib/libavl/amd64/lint.out
+usr/src/lib/libavl/amd64/llib-lavl.ln
+usr/src/lib/libavl/i386/lint.out
+usr/src/lib/libavl/i386/llib-lavl.ln
+usr/src/lib/libbe/i386/lint.out
+usr/src/lib/libbe/i386/llib-lbe.ln
+usr/src/lib/libbrand/amd64/lint.out
+usr/src/lib/libbrand/amd64/llib-lbrand.ln
+usr/src/lib/libbrand/i386/lint.out
+usr/src/lib/libbrand/i386/llib-lbrand.ln
+usr/src/lib/libbsdmalloc/amd64/lint.out
+usr/src/lib/libbsdmalloc/amd64/llib-lbsdmalloc.ln
+usr/src/lib/libbsdmalloc/i386/lint.out
+usr/src/lib/libbsdmalloc/i386/llib-lbsdmalloc.ln
+usr/src/lib/libbsm/amd64/lint.out
+usr/src/lib/libbsm/amd64/llib-lbsm.ln
+usr/src/lib/libbsm/audit_uevents.h
+usr/src/lib/libbsm/common/adt_event.h
+usr/src/lib/libbsm/common/adt_xlate.c
+usr/src/lib/libbsm/i386/lint.out
+usr/src/lib/libbsm/i386/llib-lbsm.ln
+usr/src/lib/libc/THIRDPARTYLICENSE
+usr/src/lib/libc/amd64/assym.h
+usr/src/lib/libc/amd64/genassym
+usr/src/lib/libc/amd64/lint.out
+usr/src/lib/libc/amd64/llib-lc.ln
+usr/src/lib/libc/extract-copyright
+usr/src/lib/libc/i386/assym.h
+usr/src/lib/libc/i386/crt/_rtbootld.s
+usr/src/lib/libc/i386/etc/caplib
+usr/src/lib/libc/i386/genassym
+usr/src/lib/libc/i386/lint.out
+usr/src/lib/libc/i386/llib-lc.ln
+usr/src/lib/libc/i386_hwcap1/assym.h
+usr/src/lib/libc/i386_hwcap1/genassym
+usr/src/lib/libc/i386_hwcap2/assym.h
+usr/src/lib/libc/i386_hwcap2/genassym
+usr/src/lib/libc/i386_hwcap3/assym.h
+usr/src/lib/libc/i386_hwcap3/genassym
+usr/src/lib/libc/port/gen/errlst.c
+usr/src/lib/libc/port/gen/new_list.c
+usr/src/lib/libc_db/amd64/lint.out
+usr/src/lib/libc_db/amd64/llib-lc_db.ln
+usr/src/lib/libc_db/i386/lint.out
+usr/src/lib/libc_db/i386/llib-lc_db.ln
+usr/src/lib/libcfgadm/amd64/lint.out
+usr/src/lib/libcfgadm/amd64/llib-lcfgadm.ln
+usr/src/lib/libcfgadm/i386/lint.out
+usr/src/lib/libcfgadm/i386/llib-lcfgadm.ln
+usr/src/lib/libcmd/amd64/libcmd.msg
+usr/src/lib/libcmd/amd64/lint.out
+usr/src/lib/libcmd/amd64/llib-lcmd.ln
+usr/src/lib/libcmd/amd64/msgcc.out
+usr/src/lib/libcmd/amd64/msgs/
+usr/src/lib/libcmd/i386/libcmd.msg
+usr/src/lib/libcmd/i386/lint.out
+usr/src/lib/libcmd/i386/llib-lcmd.ln
+usr/src/lib/libcmd/i386/msgcc.out
+usr/src/lib/libcmd/i386/msgs/
+usr/src/lib/libcmd/tmpastinclude/
+usr/src/lib/libcmdutils/amd64/lint.out
+usr/src/lib/libcmdutils/amd64/llib-lcmdutils.ln
+usr/src/lib/libcmdutils/i386/lint.out
+usr/src/lib/libcmdutils/i386/llib-lcmdutils.ln
+usr/src/lib/libcommputil/amd64/lint.out
+usr/src/lib/libcommputil/amd64/llib-lcommputil.ln
+usr/src/lib/libcommputil/i386/lint.out
+usr/src/lib/libcommputil/i386/llib-lcommputil.ln
+usr/src/lib/libcontract/amd64/lint.out
+usr/src/lib/libcontract/amd64/llib-lcontract.ln
+usr/src/lib/libcontract/i386/lint.out
+usr/src/lib/libcontract/i386/llib-lcontract.ln
+usr/src/lib/libcpc/amd64/lint.out
+usr/src/lib/libcpc/amd64/llib-lcpc.ln
+usr/src/lib/libcpc/i386/lint.out
+usr/src/lib/libcpc/i386/llib-lcpc.ln
+usr/src/lib/libcrypt/amd64/lint.out
+usr/src/lib/libcrypt/amd64/llib-lcrypt.ln
+usr/src/lib/libcrypt/i386/lint.out
+usr/src/lib/libcrypt/i386/llib-lcrypt.ln
+usr/src/lib/libcryptoutil/amd64/lint.out
+usr/src/lib/libcryptoutil/amd64/llib-lcryptoutil.ln
+usr/src/lib/libcryptoutil/i386/lint.out
+usr/src/lib/libcryptoutil/i386/llib-lcryptoutil.ln
+usr/src/lib/libctf/amd64/lint.out
+usr/src/lib/libctf/amd64/llib-lctf.ln
+usr/src/lib/libctf/i386/lint.out
+usr/src/lib/libctf/i386/llib-lctf.ln
+usr/src/lib/libcurses/amd64/lint.out
+usr/src/lib/libcurses/amd64/llib-lcurses.ln
+usr/src/lib/libcurses/i386/lint.out
+usr/src/lib/libcurses/i386/llib-lcurses.ln
+usr/src/lib/libcurses/screen/curses.h
+usr/src/lib/libcurses/screen/keycaps
+usr/src/lib/libcurses/screen/keyname.c
+usr/src/lib/libcurses/screen/term.h
+usr/src/lib/libcurses/screen/termcap.c
+usr/src/lib/libcurses/screen/tifget.c
+usr/src/lib/libcurses/screen/tifnames.c
+usr/src/lib/libcurses/screen/tiget.c
+usr/src/lib/libcurses/screen/tinames.c
+usr/src/lib/libcurses/screen/tmp/
+usr/src/lib/libcurses/screen/tnames.c
+usr/src/lib/libdevice/amd64/lint.out
+usr/src/lib/libdevice/amd64/llib-ldevice.ln
+usr/src/lib/libdevice/i386/lint.out
+usr/src/lib/libdevice/i386/llib-ldevice.ln
+usr/src/lib/libdevid/amd64/lint.out
+usr/src/lib/libdevid/amd64/llib-ldevid.ln
+usr/src/lib/libdevid/i386/lint.out
+usr/src/lib/libdevid/i386/llib-ldevid.ln
+usr/src/lib/libdevinfo/amd64/lint.out
+usr/src/lib/libdevinfo/amd64/llib-ldevinfo.ln
+usr/src/lib/libdevinfo/i386/lint.out
+usr/src/lib/libdevinfo/i386/llib-ldevinfo.ln
+usr/src/lib/libdhcpagent/i386/lint.out
+usr/src/lib/libdhcpagent/i386/llib-ldhcpagent.ln
+usr/src/lib/libdhcpsvc/head/dhcp_svc_confkey.h
+usr/src/lib/libdhcpsvc/modules/files0/i386/ds_SUNWfiles.so.0
+usr/src/lib/libdhcpsvc/private/i386/lint.out
+usr/src/lib/libdhcpsvc/private/i386/llib-ldhcpsvc.ln
+usr/src/lib/libdhcputil/i386/lint.out
+usr/src/lib/libdhcputil/i386/llib-ldhcputil.ln
+usr/src/lib/libdisasm/amd64/lint.out
+usr/src/lib/libdisasm/amd64/llib-ldisasm.ln
+usr/src/lib/libdisasm/i386/lint.out
+usr/src/lib/libdisasm/i386/llib-ldisasm.ln
+usr/src/lib/libdiskmgt/amd64/lint.out
+usr/src/lib/libdiskmgt/amd64/llib-ldiskmgt.ln
+usr/src/lib/libdiskmgt/i386/lint.out
+usr/src/lib/libdiskmgt/i386/llib-ldiskmgt.ln
+usr/src/lib/libdladm/amd64/lint.out
+usr/src/lib/libdladm/amd64/llib-ldladm.ln
+usr/src/lib/libdladm/i386/lint.out
+usr/src/lib/libdladm/i386/llib-ldladm.ln
+usr/src/lib/libdll/amd64/libdll.msg
+usr/src/lib/libdll/amd64/lint.out
+usr/src/lib/libdll/amd64/llib-ldll.ln
+usr/src/lib/libdll/amd64/msgcc.out
+usr/src/lib/libdll/amd64/msgs/
+usr/src/lib/libdll/i386/libdll.msg
+usr/src/lib/libdll/i386/lint.out
+usr/src/lib/libdll/i386/llib-ldll.ln
+usr/src/lib/libdll/i386/msgcc.out
+usr/src/lib/libdll/i386/msgs/
+usr/src/lib/libdll/tmpastinclude/
+usr/src/lib/libdlpi/amd64/lint.out
+usr/src/lib/libdlpi/amd64/llib-ldlpi.ln
+usr/src/lib/libdlpi/i386/lint.out
+usr/src/lib/libdlpi/i386/llib-ldlpi.ln
+usr/src/lib/libdns_sd/amd64/lint.out
+usr/src/lib/libdns_sd/amd64/llib-ldns_sd.ln
+usr/src/lib/libdns_sd/i386/lint.out
+usr/src/lib/libdns_sd/i386/llib-ldns_sd.ln
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleBrowser.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleDNSRecord.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleDNSSD.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleDNSSDException.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleDomainEnum.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleQuery.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleRecordRegistrar.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleRegistration.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleResolver.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/AppleService.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/BaseListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/BrowseListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSRecord.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSD.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSD.java.h
+usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDException.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDRecordRegistrar.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDRegistration.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDService.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/DomainListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/QueryListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/RegisterListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/RegisterRecordListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/ResolveListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/TXTRecord.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/dnssd.jar
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/BrowserApp$1.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/BrowserApp.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/BrowserApp.jar
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/BrowserListModel$BrowserListElem.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/BrowserListModel.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/DomainListModel.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/ListenerThread.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/ServicesBrowserListModel.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/SimpleChat$1.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/SimpleChat.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/SimpleChat.jar
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/SwingBrowseListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/SwingDomainListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/SwingQueryListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/SwingResolveListener.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/TargetListElem.class
+usr/src/lib/libdns_sd/java/com/apple/dnssd/docs/examples/TargetListModel.class
+usr/src/lib/libdoor/amd64/lint.out
+usr/src/lib/libdoor/amd64/llib-ldoor.ln
+usr/src/lib/libdoor/i386/lint.out
+usr/src/lib/libdoor/i386/llib-ldoor.ln
+usr/src/lib/libdscfg/i386/lint.out
+usr/src/lib/libdscfg/i386/llib-ldscfg.ln
+usr/src/lib/libdtrace/amd64/dt_grammar.c
+usr/src/lib/libdtrace/amd64/dt_grammar.h
+usr/src/lib/libdtrace/amd64/dt_lex.c
+usr/src/lib/libdtrace/amd64/lint.out
+usr/src/lib/libdtrace/amd64/llib-ldtrace.ln
+usr/src/lib/libdtrace/amd64/y.output
+usr/src/lib/libdtrace/common/dt_errtags.c
+usr/src/lib/libdtrace/common/dt_names.c
+usr/src/lib/libdtrace/common/errno.d
+usr/src/lib/libdtrace/common/io.d
+usr/src/lib/libdtrace/common/io.sed
+usr/src/lib/libdtrace/common/ip.d
+usr/src/lib/libdtrace/common/ip.sed
+usr/src/lib/libdtrace/common/net.d
+usr/src/lib/libdtrace/common/net.sed
+usr/src/lib/libdtrace/common/procfs.d
+usr/src/lib/libdtrace/common/procfs.sed
+usr/src/lib/libdtrace/common/signal.d
+usr/src/lib/libdtrace/common/sysevent.d
+usr/src/lib/libdtrace/common/sysevent.sed
+usr/src/lib/libdtrace/common/tcp.d
+usr/src/lib/libdtrace/common/tcp.sed
+usr/src/lib/libdtrace/common/udp.d
+usr/src/lib/libdtrace/common/udp.sed
+usr/src/lib/libdtrace/i386/dt_grammar.c
+usr/src/lib/libdtrace/i386/dt_grammar.h
+usr/src/lib/libdtrace/i386/dt_lex.c
+usr/src/lib/libdtrace/i386/lint.out
+usr/src/lib/libdtrace/i386/llib-ldtrace.ln
+usr/src/lib/libdtrace/i386/regs.d
+usr/src/lib/libdtrace/i386/regs.sed
+usr/src/lib/libdtrace/i386/y.output
+usr/src/lib/libdtrace_jni/java/classes/
+usr/src/lib/libdtrace_jni/java/lib/
+usr/src/lib/libdtrace_jni/java/native/
+usr/src/lib/libefi/amd64/lint.out
+usr/src/lib/libefi/amd64/llib-lefi.ln
+usr/src/lib/libefi/i386/lint.out
+usr/src/lib/libefi/i386/llib-lefi.ln
+usr/src/lib/libelfsign/i386/lint.out
+usr/src/lib/libelfsign/i386/llib-lelfsign.ln
+usr/src/lib/libeti/form/amd64/lint.out
+usr/src/lib/libeti/form/amd64/llib-lform.ln
+usr/src/lib/libeti/form/i386/lint.out
+usr/src/lib/libeti/form/i386/llib-lform.ln
+usr/src/lib/libeti/menu/amd64/lint.out
+usr/src/lib/libeti/menu/amd64/llib-lmenu.ln
+usr/src/lib/libeti/menu/i386/lint.out
+usr/src/lib/libeti/menu/i386/llib-lmenu.ln
+usr/src/lib/libeti/panel/amd64/lint.out
+usr/src/lib/libeti/panel/amd64/llib-lpanel.ln
+usr/src/lib/libeti/panel/i386/lint.out
+usr/src/lib/libeti/panel/i386/llib-lpanel.ln
+usr/src/lib/libexacct/amd64/lint.out
+usr/src/lib/libexacct/amd64/llib-lexacct.ln
+usr/src/lib/libexacct/demo/exdump
+usr/src/lib/libexacct/i386/lint.out
+usr/src/lib/libexacct/i386/llib-lexacct.ln
+usr/src/lib/libfcoe/amd64/lint.out
+usr/src/lib/libfcoe/amd64/llib-lfcoe.ln
+usr/src/lib/libfcoe/i386/lint.out
+usr/src/lib/libfcoe/i386/llib-lfcoe.ln
+usr/src/lib/libfdisk/amd64/lint.out
+usr/src/lib/libfdisk/amd64/llib-lfdisk.ln
+usr/src/lib/libfdisk/i386/lint.out
+usr/src/lib/libfdisk/i386/llib-lfdisk.ln
+usr/src/lib/libfru/amd64/pics/
+usr/src/lib/libfru/i386/pics/
+usr/src/lib/libfsmgt/common/nfs_sec.c
+usr/src/lib/libfsmgt/common/replica.c
+usr/src/lib/libfsmgt/common/sharetab.c
+usr/src/lib/libfsmgt/i386/lint.out
+usr/src/lib/libfsmgt/i386/llib-lfsmgt.ln
+usr/src/lib/libfstyp/i386/lint.out
+usr/src/lib/libfstyp/i386/llib-lfstyp.ln
+usr/src/lib/libgen/amd64/lint.out
+usr/src/lib/libgen/amd64/llib-lgen.ln
+usr/src/lib/libgen/i386/lint.out
+usr/src/lib/libgen/i386/llib-lgen.ln
+usr/src/lib/libgrubmgmt/i386/lint.out
+usr/src/lib/libgrubmgmt/i386/llib-lgrubmgmt.ln
+usr/src/lib/libgss/amd64/lint.out
+usr/src/lib/libgss/amd64/llib-lgss.ln
+usr/src/lib/libgss/i386/lint.out
+usr/src/lib/libgss/i386/llib-lgss.ln
+usr/src/lib/libhotplug/amd64/lint.out
+usr/src/lib/libhotplug/amd64/llib-lhotplug.ln
+usr/src/lib/libhotplug/i386/lint.out
+usr/src/lib/libhotplug/i386/llib-lhotplug.ln
+usr/src/lib/libidmap/amd64/idmap_xdr.c
+usr/src/lib/libidmap/amd64/lint.out
+usr/src/lib/libidmap/amd64/llib-lidmap.ln
+usr/src/lib/libidmap/i386/idmap_xdr.c
+usr/src/lib/libidmap/i386/lint.out
+usr/src/lib/libidmap/i386/llib-lidmap.ln
+usr/src/lib/libilb/amd64/lint.out
+usr/src/lib/libilb/amd64/llib-lilb.ln
+usr/src/lib/libilb/i386/lint.out
+usr/src/lib/libilb/i386/llib-lilb.ln
+usr/src/lib/libima/amd64/lint.out
+usr/src/lib/libima/amd64/llib-lima.ln
+usr/src/lib/libima/i386/lint.out
+usr/src/lib/libima/i386/llib-lima.ln
+usr/src/lib/libinetsvc/i386/lint.out
+usr/src/lib/libinetsvc/i386/llib-linetsvc.ln
+usr/src/lib/libinetutil/amd64/lint.out
+usr/src/lib/libinetutil/amd64/llib-linetutil.ln
+usr/src/lib/libinetutil/i386/lint.out
+usr/src/lib/libinetutil/i386/llib-linetutil.ln
+usr/src/lib/libinstzones/common/zones.i
+usr/src/lib/libinstzones/common/zones_args.i
+usr/src/lib/libinstzones/common/zones_exec.i
+usr/src/lib/libinstzones/common/zones_locks.i
+usr/src/lib/libinstzones/common/zones_lofs.i
+usr/src/lib/libinstzones/common/zones_paths.i
+usr/src/lib/libinstzones/common/zones_states.i
+usr/src/lib/libinstzones/common/zones_str.i
+usr/src/lib/libinstzones/common/zones_utils.i
+usr/src/lib/libinstzones/i386/lint.out
+usr/src/lib/libinstzones/i386/llib-linstzones.ln
+usr/src/lib/libintl/amd64/lint.out
+usr/src/lib/libintl/amd64/llib-lintl.ln
+usr/src/lib/libintl/i386/lint.out
+usr/src/lib/libintl/i386/llib-lintl.ln
+usr/src/lib/libipadm/i386/lint.out
+usr/src/lib/libipadm/i386/llib-lipadm.ln
+usr/src/lib/libipmi/amd64/lint.out
+usr/src/lib/libipmi/amd64/llib-lipmi.ln
+usr/src/lib/libipmi/common/ipmi_tables.c
+usr/src/lib/libipmi/i386/lint.out
+usr/src/lib/libipmi/i386/llib-lipmi.ln
+usr/src/lib/libipmp/i386/lint.out
+usr/src/lib/libipmp/i386/llib-lipmp.ln
+usr/src/lib/libipp/amd64/lint.out
+usr/src/lib/libipp/amd64/llib-lipp.ln
+usr/src/lib/libipp/i386/lint.out
+usr/src/lib/libipp/i386/llib-lipp.ln
+usr/src/lib/libipsecutil/amd64/lint.out
+usr/src/lib/libipsecutil/amd64/llib-lipsecutil.ln
+usr/src/lib/libipsecutil/i386/lint.out
+usr/src/lib/libipsecutil/i386/llib-lipsecutil.ln
+usr/src/lib/libiscsit/amd64/lint.out
+usr/src/lib/libiscsit/amd64/llib-liscsit.ln
+usr/src/lib/libiscsit/i386/lint.out
+usr/src/lib/libiscsit/i386/llib-liscsit.ln
+usr/src/lib/libkmf/THIRDPARTYLICENSE
+usr/src/lib/libkmf/ber_der/amd64/lint.out
+usr/src/lib/libkmf/ber_der/amd64/llib-lkmfberder.ln
+usr/src/lib/libkmf/ber_der/i386/lint.out
+usr/src/lib/libkmf/ber_der/i386/llib-lkmfberder.ln
+usr/src/lib/libkmf/libkmf/amd64/lint.out
+usr/src/lib/libkmf/libkmf/amd64/llib-lkmf.ln
+usr/src/lib/libkmf/libkmf/i386/lint.out
+usr/src/lib/libkmf/libkmf/i386/llib-lkmf.ln
+usr/src/lib/libkstat/amd64/lint.out
+usr/src/lib/libkstat/amd64/llib-lkstat.ln
+usr/src/lib/libkstat/i386/lint.out
+usr/src/lib/libkstat/i386/llib-lkstat.ln
+usr/src/lib/libkvm/amd64/lint.out
+usr/src/lib/libkvm/amd64/llib-lkvm.ln
+usr/src/lib/libkvm/i386/lint.out
+usr/src/lib/libkvm/i386/llib-lkvm.ln
+usr/src/lib/libldap4/amd64/libldap.so.4
+usr/src/lib/libldap4/i386/libldap.so.4
+usr/src/lib/libldap5/amd64/libldap.so.5
+usr/src/lib/libldap5/amd64/lint.out
+usr/src/lib/libldap5/amd64/llib-lldap.ln
+usr/src/lib/libldap5/i386/libldap.so.5
+usr/src/lib/libldap5/i386/lint.out
+usr/src/lib/libldap5/i386/llib-lldap.ln
+usr/src/lib/liblgrp/amd64/lint.out
+usr/src/lib/liblgrp/amd64/llib-llgrp.ln
+usr/src/lib/liblgrp/i386/lint.out
+usr/src/lib/liblgrp/i386/llib-llgrp.ln
+usr/src/lib/libmail/amd64/lint.out
+usr/src/lib/libmail/amd64/llib-lmail.ln
+usr/src/lib/libmail/i386/lint.out
+usr/src/lib/libmail/i386/llib-lmail.ln
+usr/src/lib/libmalloc/amd64/lint.out
+usr/src/lib/libmalloc/amd64/llib-lmalloc.ln
+usr/src/lib/libmalloc/i386/lint.out
+usr/src/lib/libmalloc/i386/llib-lmalloc.ln
+usr/src/lib/libmapid/i386/lint.out
+usr/src/lib/libmapid/i386/llib-lmapid.ln
+usr/src/lib/libmapmalloc/amd64/lint.out
+usr/src/lib/libmapmalloc/amd64/llib-lmapmalloc.ln
+usr/src/lib/libmapmalloc/i386/lint.out
+usr/src/lib/libmapmalloc/i386/llib-lmapmalloc.ln
+usr/src/lib/libmd/amd64/lint.out
+usr/src/lib/libmd/amd64/llib-lmd.ln
+usr/src/lib/libmd/amd64/md5_amd64.s
+usr/src/lib/libmd/amd64/sha1-x86_64.s
+usr/src/lib/libmd/amd64/sha256-x86_64.s
+usr/src/lib/libmd/amd64/sha512-x86_64.s
+usr/src/lib/libmd/i386/lint.out
+usr/src/lib/libmd/i386/llib-lmd.ln
+usr/src/lib/libmd5/amd64/lint.out
+usr/src/lib/libmd5/amd64/llib-lmd5.ln
+usr/src/lib/libmd5/i386/lint.out
+usr/src/lib/libmd5/i386/llib-lmd5.ln
+usr/src/lib/libmp/amd64/libmp.so.2
+usr/src/lib/libmp/i386/libmp.so.2
+usr/src/lib/libmtmalloc/amd64/lint.out
+usr/src/lib/libmtmalloc/amd64/llib-lmtmalloc.ln
+usr/src/lib/libmtmalloc/i386/lint.out
+usr/src/lib/libmtmalloc/i386/llib-lmtmalloc.ln
+usr/src/lib/libndmp/amd64/lint.out
+usr/src/lib/libndmp/amd64/llib-lndmp.ln
+usr/src/lib/libndmp/i386/lint.out
+usr/src/lib/libndmp/i386/llib-lndmp.ln
+usr/src/lib/libnisdb/db.h
+usr/src/lib/libnisdb/db_c.h
+usr/src/lib/libnisdb/db_c_xdr.c
+usr/src/lib/libnisdb/db_dictionary.h
+usr/src/lib/libnisdb/db_dictionary_c.h
+usr/src/lib/libnisdb/db_dictionary_c_xdr.c
+usr/src/lib/libnisdb/db_dictlog.h
+usr/src/lib/libnisdb/db_dictlog_c.h
+usr/src/lib/libnisdb/db_dictlog_c_xdr.c
+usr/src/lib/libnisdb/db_entry.h
+usr/src/lib/libnisdb/db_entry_c.h
+usr/src/lib/libnisdb/db_entry_c_xdr.c
+usr/src/lib/libnisdb/db_index.h
+usr/src/lib/libnisdb/db_index_c.h
+usr/src/lib/libnisdb/db_index_c_xdr.c
+usr/src/lib/libnisdb/db_index_entry.h
+usr/src/lib/libnisdb/db_index_entry_c.h
+usr/src/lib/libnisdb/db_index_entry_c_xdr.c
+usr/src/lib/libnisdb/db_item.h
+usr/src/lib/libnisdb/db_item_c.h
+usr/src/lib/libnisdb/db_item_c_xdr.c
+usr/src/lib/libnisdb/db_log.h
+usr/src/lib/libnisdb/db_log_c.h
+usr/src/lib/libnisdb/db_log_c_xdr.c
+usr/src/lib/libnisdb/db_log_entry.h
+usr/src/lib/libnisdb/db_log_entry_c.h
+usr/src/lib/libnisdb/db_log_entry_c_xdr.c
+usr/src/lib/libnisdb/db_mindex.h
+usr/src/lib/libnisdb/db_mindex_c.h
+usr/src/lib/libnisdb/db_mindex_c_xdr.c
+usr/src/lib/libnisdb/db_query.h
+usr/src/lib/libnisdb/db_query_c.h
+usr/src/lib/libnisdb/db_query_c_xdr.c
+usr/src/lib/libnisdb/db_scheme.h
+usr/src/lib/libnisdb/db_scheme_c.h
+usr/src/lib/libnisdb/db_scheme_c_xdr.c
+usr/src/lib/libnisdb/db_table.h
+usr/src/lib/libnisdb/db_table_c.h
+usr/src/lib/libnisdb/db_table_c_xdr.c
+usr/src/lib/libnisdb/db_vers.h
+usr/src/lib/libnisdb/db_vers_c.h
+usr/src/lib/libnisdb/db_vers_c_xdr.c
+usr/src/lib/libnisdb/libnisdb.so.2
+usr/src/lib/libnls/amd64/lint.out
+usr/src/lib/libnls/amd64/llib-lnls.ln
+usr/src/lib/libnls/i386/lint.out
+usr/src/lib/libnls/i386/llib-lnls.ln
+usr/src/lib/libnsctl/i386/lint.out
+usr/src/lib/libnsctl/i386/llib-lnsctl.ln
+usr/src/lib/libnsl/amd64/lint.out
+usr/src/lib/libnsl/amd64/llib-lnsl.ln
+usr/src/lib/libnsl/i386/lint.out
+usr/src/lib/libnsl/i386/llib-lnsl.ln
+usr/src/lib/libnsl/nis/gen/nis_clnt.h
+usr/src/lib/libntfs/THIRDPARTYLICENSE
+usr/src/lib/libntfs/i386/libntfs.so.10
+usr/src/lib/libnvpair/amd64/lint.out
+usr/src/lib/libnvpair/amd64/llib-lnvpair.ln
+usr/src/lib/libnvpair/i386/lint.out
+usr/src/lib/libnvpair/i386/llib-lnvpair.ln
+usr/src/lib/libnwam/i386/lint.out
+usr/src/lib/libnwam/i386/llib-lnwam.ln
+usr/src/lib/libpam/amd64/lint.out
+usr/src/lib/libpam/amd64/llib-lpam.ln
+usr/src/lib/libpam/i386/lint.out
+usr/src/lib/libpam/i386/llib-lpam.ln
+usr/src/lib/libparted/THIRDPARTYLICENSE
+usr/src/lib/libparted/i386/libparted.so.8
+usr/src/lib/libpctx/amd64/lint.out
+usr/src/lib/libpctx/amd64/llib-lpctx.ln
+usr/src/lib/libpctx/i386/lint.out
+usr/src/lib/libpctx/i386/llib-lpctx.ln
+usr/src/lib/libpicl/amd64/lint.out
+usr/src/lib/libpicl/amd64/llib-lpicl.ln
+usr/src/lib/libpicl/i386/lint.out
+usr/src/lib/libpicl/i386/llib-lpicl.ln
+usr/src/lib/libpicltree/i386/lint.out
+usr/src/lib/libpicltree/i386/llib-lpicltree.ln
+usr/src/lib/libpkg/common/canonize.i
+usr/src/lib/libpkg/common/ckparam.i
+usr/src/lib/libpkg/common/ckvolseq.i
+usr/src/lib/libpkg/common/devtype.i
+usr/src/lib/libpkg/common/dstream.i
+usr/src/lib/libpkg/common/fmkdir.i
+usr/src/lib/libpkg/common/gpkglist.i
+usr/src/lib/libpkg/common/gpkgmap.i
+usr/src/lib/libpkg/common/handlelocalfs.i
+usr/src/lib/libpkg/common/isdir.i
+usr/src/lib/libpkg/common/keystore.i
+usr/src/lib/libpkg/common/logerr.i
+usr/src/lib/libpkg/common/mappath.i
+usr/src/lib/libpkg/common/ncgrpw.i
+usr/src/lib/libpkg/common/nhash.i
+usr/src/lib/libpkg/common/p12lib.i
+usr/src/lib/libpkg/common/pkgerr.i
+usr/src/lib/libpkg/common/pkgexecl.i
+usr/src/lib/libpkg/common/pkgexecv.i
+usr/src/lib/libpkg/common/pkgmount.i
+usr/src/lib/libpkg/common/pkgserv.i
+usr/src/lib/libpkg/common/pkgstr.i
+usr/src/lib/libpkg/common/pkgtrans.i
+usr/src/lib/libpkg/common/pkgweb.i
+usr/src/lib/libpkg/common/ppkgmap.i
+usr/src/lib/libpkg/common/progerr.i
+usr/src/lib/libpkg/common/putcfile.i
+usr/src/lib/libpkg/common/rrmdir.i
+usr/src/lib/libpkg/common/runcmd.i
+usr/src/lib/libpkg/common/security.i
+usr/src/lib/libpkg/common/srchcfile.i
+usr/src/lib/libpkg/common/tputcfent.i
+usr/src/lib/libpkg/common/verify.i
+usr/src/lib/libpkg/common/vfpops.i
+usr/src/lib/libpkg/i386/lint.out
+usr/src/lib/libpkg/i386/llib-lpkg.ln
+usr/src/lib/libpool/amd64/lint.out
+usr/src/lib/libpool/amd64/llib-lpool.ln
+usr/src/lib/libpool/i386/lint.out
+usr/src/lib/libpool/i386/llib-lpool.ln
+usr/src/lib/libpp/i386/libpp.msg
+usr/src/lib/libpp/i386/lint.out
+usr/src/lib/libpp/i386/llib-lpp.ln
+usr/src/lib/libpp/i386/msgcc.out
+usr/src/lib/libpp/i386/msgs/
+usr/src/lib/libpp/tmpastinclude/
+usr/src/lib/libproc/amd64/lint.out
+usr/src/lib/libproc/amd64/llib-lproc.ln
+usr/src/lib/libproc/i386/lint.out
+usr/src/lib/libproc/i386/llib-lproc.ln
+usr/src/lib/libproject/amd64/lint.out
+usr/src/lib/libproject/amd64/llib-lproject.ln
+usr/src/lib/libproject/i386/lint.out
+usr/src/lib/libproject/i386/llib-lproject.ln
+usr/src/lib/libpthread/amd64/lint.out
+usr/src/lib/libpthread/amd64/llib-lpthread.ln
+usr/src/lib/libpthread/i386/lint.out
+usr/src/lib/libpthread/i386/llib-lpthread.ln
+usr/src/lib/libraidcfg/amd64/lint.out
+usr/src/lib/libraidcfg/amd64/llib-lraidcfg.ln
+usr/src/lib/libraidcfg/i386/lint.out
+usr/src/lib/libraidcfg/i386/llib-lraidcfg.ln
+usr/src/lib/librcm/amd64/lint.out
+usr/src/lib/librcm/amd64/llib-lrcm.ln
+usr/src/lib/librcm/i386/lint.out
+usr/src/lib/librcm/i386/llib-lrcm.ln
+usr/src/lib/librdc/i386/lint.out
+usr/src/lib/librdc/i386/llib-lrdc.ln
+usr/src/lib/libreparse/amd64/lint.out
+usr/src/lib/libreparse/amd64/llib-lreparse.ln
+usr/src/lib/libreparse/i386/lint.out
+usr/src/lib/libreparse/i386/llib-lreparse.ln
+usr/src/lib/libresolv2/amd64/libresolv.so.2
+usr/src/lib/libresolv2/amd64/lint.out
+usr/src/lib/libresolv2/amd64/llib-lresolv.ln
+usr/src/lib/libresolv2/i386/libresolv.so.2
+usr/src/lib/libresolv2/i386/lint.out
+usr/src/lib/libresolv2/i386/llib-lresolv.ln
+usr/src/lib/libresolv2/include/make_os_version
+usr/src/lib/libresolv2/include/os_version.h
+usr/src/lib/libresolv2/include/port_ipv6.h
+usr/src/lib/libresolv2/include/probe_ipv6
+usr/src/lib/libresolv2_joy/amd64/libresolv_joy.so.2
+usr/src/lib/libresolv2_joy/amd64/lint.out
+usr/src/lib/libresolv2_joy/amd64/llib-lresolv_joy.ln
+usr/src/lib/libresolv2_joy/i386/libresolv_joy.so.2
+usr/src/lib/libresolv2_joy/i386/lint.out
+usr/src/lib/libresolv2_joy/i386/llib-lresolv_joy.ln
+usr/src/lib/libresolv2_joy/include/make_os_version
+usr/src/lib/libresolv2_joy/include/os_version.h
+usr/src/lib/libresolv2_joy/include/port_ipv6.h
+usr/src/lib/libresolv2_joy/include/probe_ipv6
+usr/src/lib/librestart/amd64/lint.out
+usr/src/lib/librestart/amd64/llib-lrestart.ln
+usr/src/lib/librestart/i386/lint.out
+usr/src/lib/librestart/i386/llib-lrestart.ln
+usr/src/lib/librpcsvc/amd64/lint.out
+usr/src/lib/librpcsvc/amd64/llib-lrpcsvc.ln
+usr/src/lib/librpcsvc/common/bootparam_prot_xdr.c
+usr/src/lib/librpcsvc/common/mount_xdr.c
+usr/src/lib/librpcsvc/common/nlm_prot.c
+usr/src/lib/librpcsvc/common/nsm_addr_xdr.c
+usr/src/lib/librpcsvc/common/rpc_sztypes.c
+usr/src/lib/librpcsvc/common/rstat_xdr.c
+usr/src/lib/librpcsvc/common/rusers_xdr.c
+usr/src/lib/librpcsvc/common/sm_inter_xdr.c
+usr/src/lib/librpcsvc/common/spray_xdr.c
+usr/src/lib/librpcsvc/i386/lint.out
+usr/src/lib/librpcsvc/i386/llib-lrpcsvc.ln
+usr/src/lib/librsm/amd64/librsm.so.2
+usr/src/lib/librsm/i386/librsm.so.2
+usr/src/lib/librstp/i386/lint.out
+usr/src/lib/librstp/i386/llib-lrstp.ln
+usr/src/lib/librt/amd64/lint.out
+usr/src/lib/librt/amd64/llib-lrt.ln
+usr/src/lib/librt/i386/lint.out
+usr/src/lib/librt/i386/llib-lrt.ln
+usr/src/lib/libsasl/THIRDPARTYLICENSE
+usr/src/lib/libsasl/amd64/lint.out
+usr/src/lib/libsasl/amd64/llib-lsasl.ln
+usr/src/lib/libsasl/i386/lint.out
+usr/src/lib/libsasl/i386/llib-lsasl.ln
+usr/src/lib/libscf/amd64/lint.out
+usr/src/lib/libscf/amd64/llib-lscf.ln
+usr/src/lib/libscf/i386/lint.out
+usr/src/lib/libscf/i386/llib-lscf.ln
+usr/src/lib/libsched/amd64/lint.out
+usr/src/lib/libsched/amd64/llib-lsched.ln
+usr/src/lib/libsched/i386/lint.out
+usr/src/lib/libsched/i386/llib-lsched.ln
+usr/src/lib/libsctp/amd64/lint.out
+usr/src/lib/libsctp/amd64/llib-lsctp.ln
+usr/src/lib/libsctp/i386/lint.out
+usr/src/lib/libsctp/i386/llib-lsctp.ln
+usr/src/lib/libsec/amd64/acl.output
+usr/src/lib/libsec/amd64/acl.tab.c
+usr/src/lib/libsec/amd64/acl.tab.h
+usr/src/lib/libsec/amd64/acl_lex.c
+usr/src/lib/libsec/amd64/lint.out
+usr/src/lib/libsec/amd64/llib-lsec.ln
+usr/src/lib/libsec/i386/acl.output
+usr/src/lib/libsec/i386/acl.tab.c
+usr/src/lib/libsec/i386/acl.tab.h
+usr/src/lib/libsec/i386/acl_lex.c
+usr/src/lib/libsec/i386/lint.out
+usr/src/lib/libsec/i386/llib-lsec.ln
+usr/src/lib/libsecdb/amd64/lint.out
+usr/src/lib/libsecdb/amd64/llib-lsecdb.ln
+usr/src/lib/libsecdb/auth_attr
+usr/src/lib/libsecdb/exec_attr
+usr/src/lib/libsecdb/i386/lint.out
+usr/src/lib/libsecdb/i386/llib-lsecdb.ln
+usr/src/lib/libsecdb/prof_attr
+usr/src/lib/libsecdb/user_attr
+usr/src/lib/libsendfile/amd64/lint.out
+usr/src/lib/libsendfile/amd64/llib-lsendfile.ln
+usr/src/lib/libsendfile/i386/lint.out
+usr/src/lib/libsendfile/i386/llib-lsendfile.ln
+usr/src/lib/libshare/amd64/lint.out
+usr/src/lib/libshare/amd64/llib-lshare.ln
+usr/src/lib/libshare/i386/lint.out
+usr/src/lib/libshare/i386/llib-lshare.ln
+usr/src/lib/libshell/amd64/libshell.msg
+usr/src/lib/libshell/amd64/lint.out
+usr/src/lib/libshell/amd64/llib-lshell.ln
+usr/src/lib/libshell/amd64/msgcc.out
+usr/src/lib/libshell/amd64/msgs/
+usr/src/lib/libshell/i386/libshell.msg
+usr/src/lib/libshell/i386/lint.out
+usr/src/lib/libshell/i386/llib-lshell.ln
+usr/src/lib/libshell/i386/msgcc.out
+usr/src/lib/libshell/i386/msgs/
+usr/src/lib/libshell/tmpastinclude/
+usr/src/lib/libshell/xsltproc.log
+usr/src/lib/libsip/amd64/lint.out
+usr/src/lib/libsip/amd64/llib-lsip.ln
+usr/src/lib/libsip/i386/lint.out
+usr/src/lib/libsip/i386/llib-lsip.ln
+usr/src/lib/libsldap/amd64/lint.out
+usr/src/lib/libsldap/amd64/llib-lsldap.ln
+usr/src/lib/libsldap/i386/lint.out
+usr/src/lib/libsldap/i386/llib-lsldap.ln
+usr/src/lib/libslp/amd64/lint.out
+usr/src/lib/libslp/amd64/llib-lslp.ln
+usr/src/lib/libslp/classes/
+usr/src/lib/libslp/i386/lint.out
+usr/src/lib/libslp/i386/llib-lslp.ln
+usr/src/lib/libsmartsshd/amd64/lint.out
+usr/src/lib/libsmartsshd/amd64/llib-lsmartsshd.ln
+usr/src/lib/libsmartsshd/i386/lint.out
+usr/src/lib/libsmartsshd/i386/llib-lsmartsshd.ln
+usr/src/lib/libsmbfs/amd64/lint.out
+usr/src/lib/libsmbfs/amd64/llib-lsmbfs.ln
+usr/src/lib/libsmbfs/i386/lint.out
+usr/src/lib/libsmbfs/i386/llib-lsmbfs.ln
+usr/src/lib/libsmbios/amd64/lint.out
+usr/src/lib/libsmbios/amd64/llib-lsmbios.ln
+usr/src/lib/libsmbios/common/smb_tables.c
+usr/src/lib/libsmbios/i386/lint.out
+usr/src/lib/libsmbios/i386/llib-lsmbios.ln
+usr/src/lib/libsmedia/library/amd64/lint.out
+usr/src/lib/libsmedia/library/amd64/llib-lsmedia.ln
+usr/src/lib/libsmedia/library/common/smed.h
+usr/src/lib/libsmedia/library/common/smed_clnt.c
+usr/src/lib/libsmedia/library/common/smed_xdr.c
+usr/src/lib/libsmedia/library/i386/lint.out
+usr/src/lib/libsmedia/library/i386/llib-lsmedia.ln
+usr/src/lib/libsocket/amd64/lint.out
+usr/src/lib/libsocket/amd64/llib-lsocket.ln
+usr/src/lib/libsocket/i386/lint.out
+usr/src/lib/libsocket/i386/llib-lsocket.ln
+usr/src/lib/libsqlite/i386/lemon
+usr/src/lib/libsqlite/i386/lemon-build
+usr/src/lib/libsqlite/i386/lempar.c
+usr/src/lib/libsqlite/i386/lint.out
+usr/src/lib/libsqlite/i386/llib-lsqlite.ln
+usr/src/lib/libsqlite/i386/opcodes.c
+usr/src/lib/libsqlite/i386/opcodes.h
+usr/src/lib/libsqlite/i386/parse.c
+usr/src/lib/libsqlite/i386/parse.h
+usr/src/lib/libsqlite/i386/parse_tmp.c
+usr/src/lib/libsqlite/i386/parse_tmp.h
+usr/src/lib/libsqlite/i386/parse_tmp.out
+usr/src/lib/libsqlite/i386/parse_tmp.y
+usr/src/lib/libsqlite/sqlite.h
+usr/src/lib/libsrpt/amd64/lint.out
+usr/src/lib/libsrpt/amd64/llib-lsrpt.ln
+usr/src/lib/libsrpt/i386/lint.out
+usr/src/lib/libsrpt/i386/llib-lsrpt.ln
+usr/src/lib/libstmf/amd64/lint.out
+usr/src/lib/libstmf/amd64/llib-lstmf.ln
+usr/src/lib/libstmf/i386/lint.out
+usr/src/lib/libstmf/i386/llib-lstmf.ln
+usr/src/lib/libstmfproxy/amd64/lint.out
+usr/src/lib/libstmfproxy/amd64/llib-lstmfproxy.ln
+usr/src/lib/libstmfproxy/i386/lint.out
+usr/src/lib/libstmfproxy/i386/llib-lstmfproxy.ln
+usr/src/lib/libsum/amd64/libsum.msg
+usr/src/lib/libsum/amd64/lint.out
+usr/src/lib/libsum/amd64/llib-lsum.ln
+usr/src/lib/libsum/amd64/msgcc.out
+usr/src/lib/libsum/amd64/msgs/
+usr/src/lib/libsum/i386/libsum.msg
+usr/src/lib/libsum/i386/lint.out
+usr/src/lib/libsum/i386/llib-lsum.ln
+usr/src/lib/libsum/i386/msgcc.out
+usr/src/lib/libsum/i386/msgs/
+usr/src/lib/libsum/tmpastinclude/
+usr/src/lib/libsun_ima/amd64/lint.out
+usr/src/lib/libsun_ima/amd64/llib-lsun_ima.ln
+usr/src/lib/libsun_ima/i386/lint.out
+usr/src/lib/libsun_ima/i386/llib-lsun_ima.ln
+usr/src/lib/libsys/i386/libsys.c
+usr/src/lib/libsysevent/amd64/lint.out
+usr/src/lib/libsysevent/amd64/llib-lsysevent.ln
+usr/src/lib/libsysevent/i386/lint.out
+usr/src/lib/libsysevent/i386/llib-lsysevent.ln
+usr/src/lib/libtecla/amd64/lint.out
+usr/src/lib/libtecla/amd64/llib-ltecla.ln
+usr/src/lib/libtecla/i386/lint.out
+usr/src/lib/libtecla/i386/llib-ltecla.ln
+usr/src/lib/libthread/amd64/lint.out
+usr/src/lib/libthread/amd64/llib-lthread.ln
+usr/src/lib/libthread/i386/lint.out
+usr/src/lib/libthread/i386/llib-lthread.ln
+usr/src/lib/libtsnet/amd64/lint.out
+usr/src/lib/libtsnet/amd64/llib-ltsnet.ln
+usr/src/lib/libtsnet/i386/lint.out
+usr/src/lib/libtsnet/i386/llib-ltsnet.ln
+usr/src/lib/libtsol/amd64/libtsol.so.2
+usr/src/lib/libtsol/amd64/lint.out
+usr/src/lib/libtsol/amd64/llib-ltsol.ln
+usr/src/lib/libtsol/i386/libtsol.so.2
+usr/src/lib/libtsol/i386/lint.out
+usr/src/lib/libtsol/i386/llib-ltsol.ln
+usr/src/lib/libumem/amd64/lint.out
+usr/src/lib/libumem/amd64/llib-lumem.ln
+usr/src/lib/libumem/i386/lint.out
+usr/src/lib/libumem/i386/llib-lumem.ln
+usr/src/lib/libunistat/common/dsw/dsw.dtrnk
+usr/src/lib/libunistat/common/dsw/dsw.edef
+usr/src/lib/libunistat/common/dsw/dsw.msg
+usr/src/lib/libunistat/common/dsw/dsw.trnk
+usr/src/lib/libunistat/common/rdc/rdc.dtrnk
+usr/src/lib/libunistat/common/rdc/rdc.edef
+usr/src/lib/libunistat/common/rdc/rdc.msg
+usr/src/lib/libunistat/common/rdc/rdc.trnk
+usr/src/lib/libunistat/common/sdbc/sdbc.dtrnk
+usr/src/lib/libunistat/common/sdbc/sdbc.edef
+usr/src/lib/libunistat/common/sdbc/sdbc.msg
+usr/src/lib/libunistat/common/sdbc/sdbc.trnk
+usr/src/lib/libunistat/common/solaris/solaris.dtrnk
+usr/src/lib/libunistat/common/solaris/solaris.edef
+usr/src/lib/libunistat/common/solaris/solaris.msg
+usr/src/lib/libunistat/common/solaris/solaris.trnk
+usr/src/lib/libunistat/common/spcs/spcs.dtrnk
+usr/src/lib/libunistat/common/spcs/spcs.edef
+usr/src/lib/libunistat/common/spcs/spcs.msg
+usr/src/lib/libunistat/common/spcs/spcs.trnk
+usr/src/lib/libunistat/common/sv/sv.dtrnk
+usr/src/lib/libunistat/common/sv/sv.edef
+usr/src/lib/libunistat/common/sv/sv.msg
+usr/src/lib/libunistat/common/sv/sv.trnk
+usr/src/lib/libunistat/i386/lint.out
+usr/src/lib/libunistat/i386/llib-lunistat.ln
+usr/src/lib/libunistat/i386/spcs_dtrinkets.h
+usr/src/lib/libunistat/i386/spcs_errors.h
+usr/src/lib/libunistat/i386/spcs_etext.h
+usr/src/lib/libunistat/i386/spcs_etrinkets.h
+usr/src/lib/libuuid/amd64/lint.out
+usr/src/lib/libuuid/amd64/llib-luuid.ln
+usr/src/lib/libuuid/i386/lint.out
+usr/src/lib/libuuid/i386/llib-luuid.ln
+usr/src/lib/libuutil/amd64/lint.out
+usr/src/lib/libuutil/amd64/llib-luutil.ln
+usr/src/lib/libuutil/i386/lint.out
+usr/src/lib/libuutil/i386/llib-luutil.ln
+usr/src/lib/libuutil/native/sys/
+usr/src/lib/libvolmgt/amd64/lint.out
+usr/src/lib/libvolmgt/amd64/llib-lvolmgt.ln
+usr/src/lib/libvolmgt/i386/lint.out
+usr/src/lib/libvolmgt/i386/llib-lvolmgt.ln
+usr/src/lib/libvrrpadm/amd64/lint.out
+usr/src/lib/libvrrpadm/amd64/llib-lvrrpadm.ln
+usr/src/lib/libvrrpadm/i386/lint.out
+usr/src/lib/libvrrpadm/i386/llib-lvrrpadm.ln
+usr/src/lib/libvscan/i386/lint.out
+usr/src/lib/libvscan/i386/llib-lvscan.ln
+usr/src/lib/libwanboot/i386/lint.out
+usr/src/lib/libwanboot/i386/llib-lwanboot.ln
+usr/src/lib/libwanbootutil/common/key_xdr.c
+usr/src/lib/libwanbootutil/common/key_xdr.h
+usr/src/lib/libwanbootutil/i386/lint.out
+usr/src/lib/libwanbootutil/i386/llib-lwanbootutil.ln
+usr/src/lib/libwrap/THIRDPARTYLICENSE
+usr/src/lib/libwrap/i386/libwrap.so.1.0
+usr/src/lib/libwrap/i386/lint.out
+usr/src/lib/libwrap/i386/llib-lwrap.ln
+usr/src/lib/libxcurses/h/term.h
+usr/src/lib/libxcurses/src/libc/xcurses/boolcode.c
+usr/src/lib/libxcurses/src/libc/xcurses/boolfnam.c
+usr/src/lib/libxcurses/src/libc/xcurses/boolname.c
+usr/src/lib/libxcurses/src/libc/xcurses/keyindex.c
+usr/src/lib/libxcurses/src/libc/xcurses/numcode.c
+usr/src/lib/libxcurses/src/libc/xcurses/numfnam.c
+usr/src/lib/libxcurses/src/libc/xcurses/numname.c
+usr/src/lib/libxcurses/src/libc/xcurses/strcode.c
+usr/src/lib/libxcurses/src/libc/xcurses/strfnam.c
+usr/src/lib/libxcurses/src/libc/xcurses/strname.c
+usr/src/lib/libxcurses2/amd64/libcurses.so.2
+usr/src/lib/libxcurses2/amd64/lint.out
+usr/src/lib/libxcurses2/amd64/llib-lcurses.ln
+usr/src/lib/libxcurses2/h/term.h
+usr/src/lib/libxcurses2/i386/libcurses.so.2
+usr/src/lib/libxcurses2/i386/lint.out
+usr/src/lib/libxcurses2/i386/llib-lcurses.ln
+usr/src/lib/libxcurses2/src/libc/xcurses/boolcode.c
+usr/src/lib/libxcurses2/src/libc/xcurses/boolfnam.c
+usr/src/lib/libxcurses2/src/libc/xcurses/boolname.c
+usr/src/lib/libxcurses2/src/libc/xcurses/keyindex.c
+usr/src/lib/libxcurses2/src/libc/xcurses/numcode.c
+usr/src/lib/libxcurses2/src/libc/xcurses/numfnam.c
+usr/src/lib/libxcurses2/src/libc/xcurses/numname.c
+usr/src/lib/libxcurses2/src/libc/xcurses/strcode.c
+usr/src/lib/libxcurses2/src/libc/xcurses/strfnam.c
+usr/src/lib/libxcurses2/src/libc/xcurses/strname.c
+usr/src/lib/libxnet/amd64/lint.out
+usr/src/lib/libxnet/amd64/llib-lxnet.ln
+usr/src/lib/libxnet/i386/lint.out
+usr/src/lib/libxnet/i386/llib-lxnet.ln
+usr/src/lib/libzdoor/amd64/lint.out
+usr/src/lib/libzdoor/amd64/llib-lzdoor.ln
+usr/src/lib/libzdoor/i386/lint.out
+usr/src/lib/libzdoor/i386/llib-lzdoor.ln
+usr/src/lib/libzfs/amd64/lint.out
+usr/src/lib/libzfs/amd64/llib-lzfs.ln
+usr/src/lib/libzfs/i386/lint.out
+usr/src/lib/libzfs/i386/llib-lzfs.ln
+usr/src/lib/libzfs_jni/amd64/lint.out
+usr/src/lib/libzfs_jni/amd64/llib-lzfs_jni.ln
+usr/src/lib/libzfs_jni/i386/lint.out
+usr/src/lib/libzfs_jni/i386/llib-lzfs_jni.ln
+usr/src/lib/libzonecfg/amd64/lint.out
+usr/src/lib/libzonecfg/amd64/llib-lzonecfg.ln
+usr/src/lib/libzonecfg/i386/lint.out
+usr/src/lib/libzonecfg/i386/llib-lzonecfg.ln
+usr/src/lib/libzoneinfo/i386/lint.out
+usr/src/lib/libzoneinfo/i386/llib-lzoneinfo.ln
+usr/src/lib/libzonestat/amd64/lint.out
+usr/src/lib/libzonestat/amd64/llib-lzonestat.ln
+usr/src/lib/libzonestat/i386/lint.out
+usr/src/lib/libzonestat/i386/llib-lzonestat.ln
+usr/src/lib/libzpool/amd64/lint.out
+usr/src/lib/libzpool/amd64/llib-lzpool.ln
+usr/src/lib/libzpool/i386/lint.out
+usr/src/lib/libzpool/i386/llib-lzpool.ln
+usr/src/lib/mpapi/libmpapi/amd64/lint.out
+usr/src/lib/mpapi/libmpapi/amd64/llib-lMPAPI.ln
+usr/src/lib/mpapi/libmpapi/i386/lint.out
+usr/src/lib/mpapi/libmpapi/i386/llib-lMPAPI.ln
+usr/src/lib/nametoaddr/straddr/amd64/straddr.so.2
+usr/src/lib/nametoaddr/straddr/i386/straddr.so.2
+usr/src/lib/passwdutil/amd64/lint.out
+usr/src/lib/passwdutil/amd64/llib-lpasswdutil.ln
+usr/src/lib/passwdutil/i386/lint.out
+usr/src/lib/passwdutil/i386/llib-lpasswdutil.ln
+usr/src/lib/pkcs11/libkcfd/i386/lint.out
+usr/src/lib/pkcs11/libkcfd/i386/llib-lkcfd.ln
+usr/src/lib/pkcs11/libpkcs11/amd64/lint.out
+usr/src/lib/pkcs11/libpkcs11/amd64/llib-lpkcs11.ln
+usr/src/lib/pkcs11/libpkcs11/i386/lint.out
+usr/src/lib/pkcs11/libpkcs11/i386/llib-lpkcs11.ln
+usr/src/lib/pkcs11/libsoftcrypto/amd64/arcfour-x86_64.s
+usr/src/lib/pkcs11/libsoftcrypto/amd64/lint.out
+usr/src/lib/pkcs11/libsoftcrypto/amd64/llib-lsoftcrypto.ln
+usr/src/lib/pkcs11/libsoftcrypto/i386/lint.out
+usr/src/lib/pkcs11/libsoftcrypto/i386/llib-lsoftcrypto.ln
+usr/src/lib/policykit/libpolkit/i386/libpolkit.so.0.0.0
+usr/src/lib/policykit/libpolkit/i386/lint.out
+usr/src/lib/policykit/libpolkit/i386/llib-lpolkit.ln
+usr/src/lib/policykit/libpolkit/i386/polkit.pc
+usr/src/lib/sasl_plugins/gssapi/THIRDPARTYLICENSE
+usr/src/lib/scsi/libscsi/amd64/lint.out
+usr/src/lib/scsi/libscsi/amd64/llib-lscsi.ln
+usr/src/lib/scsi/libscsi/common/scsi_errno.c
+usr/src/lib/scsi/libscsi/i386/lint.out
+usr/src/lib/scsi/libscsi/i386/llib-lscsi.ln
+usr/src/lib/scsi/libses/amd64/lint.out
+usr/src/lib/scsi/libses/amd64/llib-lses.ln
+usr/src/lib/scsi/libses/common/ses_errno.c
+usr/src/lib/scsi/libses/i386/lint.out
+usr/src/lib/scsi/libses/i386/llib-lses.ln
+usr/src/lib/scsi/libsmp/amd64/lint.out
+usr/src/lib/scsi/libsmp/amd64/llib-lsmp.ln
+usr/src/lib/scsi/libsmp/common/smp_errno.c
+usr/src/lib/scsi/libsmp/i386/lint.out
+usr/src/lib/scsi/libsmp/i386/llib-lsmp.ln
+usr/src/lib/scsi/plugins/ses/libses/common/libses_elemtype.c
+usr/src/lib/smbsrv/libmlrpc/amd64/lint.out
+usr/src/lib/smbsrv/libmlrpc/amd64/llib-lmlrpc.ln
+usr/src/lib/smbsrv/libmlrpc/amd64/rpcpdu_ndr.c
+usr/src/lib/smbsrv/libmlrpc/i386/lint.out
+usr/src/lib/smbsrv/libmlrpc/i386/llib-lmlrpc.ln
+usr/src/lib/smbsrv/libmlrpc/i386/rpcpdu_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/dssetup_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/eventlog_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/lint.out
+usr/src/lib/smbsrv/libmlsvc/amd64/llib-lmlsvc.ln
+usr/src/lib/smbsrv/libmlsvc/amd64/lsarpc_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/msgsvc_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/netdfs_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/netlogon_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/samrpc_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/spoolss_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/srvsvc_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/svcctl_ndr.c
+usr/src/lib/smbsrv/libmlsvc/amd64/winreg_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/dssetup_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/eventlog_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/lint.out
+usr/src/lib/smbsrv/libmlsvc/i386/llib-lmlsvc.ln
+usr/src/lib/smbsrv/libmlsvc/i386/lsarpc_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/msgsvc_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/netdfs_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/netlogon_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/samrpc_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/spoolss_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/srvsvc_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/svcctl_ndr.c
+usr/src/lib/smbsrv/libmlsvc/i386/winreg_ndr.c
+usr/src/lib/smbsrv/libsmb/amd64/lint.out
+usr/src/lib/smbsrv/libsmb/amd64/llib-lsmb.ln
+usr/src/lib/smbsrv/libsmb/common/smb_status_tbl.h
+usr/src/lib/smbsrv/libsmb/i386/lint.out
+usr/src/lib/smbsrv/libsmb/i386/llib-lsmb.ln
+usr/src/lib/smbsrv/libsmbns/amd64/lint.out
+usr/src/lib/smbsrv/libsmbns/amd64/llib-lsmbns.ln
+usr/src/lib/smbsrv/libsmbns/i386/lint.out
+usr/src/lib/smbsrv/libsmbns/i386/llib-lsmbns.ln
+usr/src/lib/smbsrv/libsmbrdr/amd64/lint.out
+usr/src/lib/smbsrv/libsmbrdr/amd64/llib-lsmbrdr.ln
+usr/src/lib/smbsrv/libsmbrdr/i386/lint.out
+usr/src/lib/smbsrv/libsmbrdr/i386/llib-lsmbrdr.ln
+usr/src/lib/smbsrv/libsmbrp/amd64/lint.out
+usr/src/lib/smbsrv/libsmbrp/amd64/llib-lreparse_smb.ln
+usr/src/lib/smbsrv/libsmbrp/i386/lint.out
+usr/src/lib/smbsrv/libsmbrp/i386/llib-lreparse_smb.ln
+usr/src/lib/smhba/amd64/lint.out
+usr/src/lib/smhba/amd64/llib-lSMHBAAPI.ln
+usr/src/lib/smhba/i386/lint.out
+usr/src/lib/smhba/i386/llib-lSMHBAAPI.ln
+usr/src/lib/udapl/libdat/amd64/lint.out
+usr/src/lib/udapl/libdat/amd64/llib-ldat.ln
+usr/src/lib/udapl/libdat/i386/lint.out
+usr/src/lib/udapl/libdat/i386/llib-ldat.ln
+usr/src/man/man1/batch.1
+usr/src/man/man1/bg.1
+usr/src/man/man1/case.1
+usr/src/man/man1/chdir.1
+usr/src/man/man1/checkeq.1
+usr/src/man/man1/continue.1
+usr/src/man/man1/decrypt.1
+usr/src/man/man1/dirname.1
+usr/src/man/man1/dirs.1
+usr/src/man/man1/disable.1
+usr/src/man/man1/dumpkeys.1
+usr/src/man/man1/edit.1
+usr/src/man/man1/errange.1
+usr/src/man/man1/errdate.1
+usr/src/man/man1/errgid.1
+usr/src/man/man1/errint.1
+usr/src/man/man1/erritem.1
+usr/src/man/man1/errpath.1
+usr/src/man/man1/errstr.1
+usr/src/man/man1/errtime.1
+usr/src/man/man1/erruid.1
+usr/src/man/man1/erryorn.1
+usr/src/man/man1/eval.1
+usr/src/man/man1/export.1
+usr/src/man/man1/false.1
+usr/src/man/man1/fc.1
+usr/src/man/man1/fg.1
+usr/src/man/man1/for.1
+usr/src/man/man1/foreach.1
+usr/src/man/man1/function.1
+usr/src/man/man1/goto.1
+usr/src/man/man1/hashcheck.1
+usr/src/man/man1/hashmake.1
+usr/src/man/man1/hashstat.1
+usr/src/man/man1/helpdate.1
+usr/src/man/man1/helpgid.1
+usr/src/man/man1/helpint.1
+usr/src/man/man1/helpitem.1
+usr/src/man/man1/helppath.1
+usr/src/man/man1/helprange.1
+usr/src/man/man1/helpstr.1
+usr/src/man/man1/helptime.1
+usr/src/man/man1/helpuid.1
+usr/src/man/man1/helpyorn.1
+usr/src/man/man1/hist.1
+usr/src/man/man1/i286.1
+usr/src/man/man1/i386.1
+usr/src/man/man1/i486.1
+usr/src/man/man1/i860.1
+usr/src/man/man1/iAPX286.1
+usr/src/man/man1/if.1
+usr/src/man/man1/intro.1
+usr/src/man/man1/jsh.1
+usr/src/man/man1/ksh.1
+usr/src/man/man1/ldapadd.1
+usr/src/man/man1/neqn.1
+usr/src/man/man1/notify.1
+usr/src/man/man1/onintr.1
+usr/src/man/man1/page.1
+usr/src/man/man1/pcat.1
+usr/src/man/man1/pcred.1
+usr/src/man/man1/pdp11.1
+usr/src/man/man1/pfcsh.1
+usr/src/man/man1/pfiles.1
+usr/src/man/man1/pfksh.1
+usr/src/man/man1/pflags.1
+usr/src/man/man1/pfsh.1
+usr/src/man/man1/pkill.1
+usr/src/man/man1/pldd.1
+usr/src/man/man1/popd.1
+usr/src/man/man1/prun.1
+usr/src/man/man1/psig.1
+usr/src/man/man1/pstack.1
+usr/src/man/man1/pstop.1
+usr/src/man/man1/ptime.1
+usr/src/man/man1/pushd.1
+usr/src/man/man1/pwait.1
+usr/src/man/man1/pwdx.1
+usr/src/man/man1/red.1
+usr/src/man/man1/rehash.1
+usr/src/man/man1/remote_shell.1
+usr/src/man/man1/remsh.1
+usr/src/man/man1/repeat.1
+usr/src/man/man1/return.1
+usr/src/man/man1/rksh.1
+usr/src/man/man1/rksh93.1
+usr/src/man/man1/rmail.1
+usr/src/man/man1/rmdir.1
+usr/src/man/man1/rmumount.1
+usr/src/man/man1/select.1
+usr/src/man/man1/setenv.1
+usr/src/man/man1/settime.1
+usr/src/man/man1/sh.1
+usr/src/man/man1/snca.1
+usr/src/man/man1/source.1
+usr/src/man/man1/sparc.1
+usr/src/man/man1/spellin.1
+usr/src/man/man1/stop.1
+usr/src/man/man1/strconf.1
+usr/src/man/man1/sun.1
+usr/src/man/man1/switch.1
+usr/src/man/man1/t300.1
+usr/src/man/man1/t300s.1
+usr/src/man/man1/t4014.1
+usr/src/man/man1/t450.1
+usr/src/man/man1/tek.1
+usr/src/man/man1/u370.1
+usr/src/man/man1/u3b.1
+usr/src/man/man1/u3b15.1
+usr/src/man/man1/u3b2.1
+usr/src/man/man1/u3b5.1
+usr/src/man/man1/ulimit.1
+usr/src/man/man1/unalias.1
+usr/src/man/man1/uncompress.1
+usr/src/man/man1/unexpand.1
+usr/src/man/man1/unhash.1
+usr/src/man/man1/unlimit.1
+usr/src/man/man1/unpack.1
+usr/src/man/man1/unset.1
+usr/src/man/man1/unsetenv.1
+usr/src/man/man1/until.1
+usr/src/man/man1/valdate.1
+usr/src/man/man1/valgid.1
+usr/src/man/man1/valint.1
+usr/src/man/man1/valpath.1
+usr/src/man/man1/valrange.1
+usr/src/man/man1/valstr.1
+usr/src/man/man1/valtime.1
+usr/src/man/man1/valuid.1
+usr/src/man/man1/valyorn.1
+usr/src/man/man1/vax.1
+usr/src/man/man1/vedit.1
+usr/src/man/man1/ver.1
+usr/src/man/man1/whence.1
+usr/src/man/man1/while.1
+usr/src/man/man1/zcat.1
+usr/src/man/man1b/Mail.1b
+usr/src/man/man1b/fasthalt.1b
+usr/src/man/man1b/reset.1b
+usr/src/man/man1c/uudecode.1c
+usr/src/man/man1c/uulog.1c
+usr/src/man/man1c/uuname.1c
+usr/src/man/man1c/uupick.1c
+usr/src/man/man1m/acctcon1.1m
+usr/src/man/man1m/acctcon2.1m
+usr/src/man/man1m/acctdisk.1m
+usr/src/man/man1m/acctdusg.1m
+usr/src/man/man1m/accton.1m
+usr/src/man/man1m/acctprc1.1m
+usr/src/man/man1m/acctprc2.1m
+usr/src/man/man1m/acctwtmp.1m
+usr/src/man/man1m/bootparamd.1m
+usr/src/man/man1m/chargefee.1m
+usr/src/man/man1m/ckpacct.1m
+usr/src/man/man1m/closewtmp.1m
+usr/src/man/man1m/comsat.1m
+usr/src/man/man1m/dcopy.1m
+usr/src/man/man1m/devfsadmd.1m
+usr/src/man/man1m/dodisk.1m
+usr/src/man/man1m/fcadm.1m
+usr/src/man/man1m/fingerd.1m
+usr/src/man/man1m/ftpd.1m
+usr/src/man/man1m/grpck.1m
+usr/src/man/man1m/hal-find-by-capability.1m
+usr/src/man/man1m/hal-find-by-property.1m
+usr/src/man/man1m/hal-set-property.1m
+usr/src/man/man1m/intro.1m
+usr/src/man/man1m/kadmin.local.1m
+usr/src/man/man1m/lastlogin.1m
+usr/src/man/man1m/metadetach.1m
+usr/src/man/man1m/metaonline.1m
+usr/src/man/man1m/monacct.1m
+usr/src/man/man1m/nulladm.1m
+usr/src/man/man1m/poweroff.1m
+usr/src/man/man1m/prctmp.1m
+usr/src/man/man1m/prdaily.1m
+usr/src/man/man1m/prtacct.1m
+usr/src/man/man1m/quotaoff.1m
+usr/src/man/man1m/rarpd.1m
+usr/src/man/man1m/rdisc.1m
+usr/src/man/man1m/reject.1m
+usr/src/man/man1m/restricted_shell.1m
+usr/src/man/man1m/rexd.1m
+usr/src/man/man1m/rexecd.1m
+usr/src/man/man1m/rlogind.1m
+usr/src/man/man1m/routed.1m
+usr/src/man/man1m/rshd.1m
+usr/src/man/man1m/rstatd.1m
+usr/src/man/man1m/rusersd.1m
+usr/src/man/man1m/rwalld.1m
+usr/src/man/man1m/rwhod.1m
+usr/src/man/man1m/sa1.1m
+usr/src/man/man1m/sa2.1m
+usr/src/man/man1m/sadc.1m
+usr/src/man/man1m/shutacct.1m
+usr/src/man/man1m/sprayd.1m
+usr/src/man/man1m/startup.1m
+usr/src/man/man1m/talkd.1m
+usr/src/man/man1m/telinit.1m
+usr/src/man/man1m/telnetd.1m
+usr/src/man/man1m/tftpd.1m
+usr/src/man/man1m/turnacct.1m
+usr/src/man/man1m/umount.1m
+usr/src/man/man1m/umount_smbfs.1m
+usr/src/man/man1m/umountall.1m
+usr/src/man/man1m/unlink.1m
+usr/src/man/man1m/unshareall.1m
+usr/src/man/man1m/utmp2wtmp.1m
+usr/src/man/man1m/uucpd.1m
+usr/src/man/man1m/uutry.1m
+usr/src/man/man1m/wtmpfix.1m
+usr/src/man/man1m/yppasswdd.1m
+usr/src/man/man1m/ypstop.1m
+usr/src/man/man1m/ypupdated.1m
+usr/src/man/man1m/ypxfr_1perday.1m
+usr/src/man/man1m/ypxfr_1perhour.1m
+usr/src/man/man1m/ypxfr_2perday.1m
+usr/src/man/man1m/ypxfrd.1m
+usr/src/man/man2/_Exit.2
+usr/src/man/man2/_exit.2
+usr/src/man/man2/_lwp_cond_broadcast.2
+usr/src/man/man2/_lwp_cond_reltimedwait.2
+usr/src/man/man2/_lwp_cond_timedwait.2
+usr/src/man/man2/_lwp_continue.2
+usr/src/man/man2/_lwp_mutex_trylock.2
+usr/src/man/man2/_lwp_mutex_unlock.2
+usr/src/man/man2/_lwp_sema_init.2
+usr/src/man/man2/_lwp_sema_post.2
+usr/src/man/man2/_lwp_sema_trywait.2
+usr/src/man/man2/execl.2
+usr/src/man/man2/execle.2
+usr/src/man/man2/execlp.2
+usr/src/man/man2/execv.2
+usr/src/man/man2/execve.2
+usr/src/man/man2/execvp.2
+usr/src/man/man2/faccessat.2
+usr/src/man/man2/facl.2
+usr/src/man/man2/fchdir.2
+usr/src/man/man2/fchmod.2
+usr/src/man/man2/fchown.2
+usr/src/man/man2/fchownat.2
+usr/src/man/man2/fchroot.2
+usr/src/man/man2/fgetlabel.2
+usr/src/man/man2/fork1.2
+usr/src/man/man2/forkall.2
+usr/src/man/man2/forkallx.2
+usr/src/man/man2/forkx.2
+usr/src/man/man2/fstat.2
+usr/src/man/man2/fstatat.2
+usr/src/man/man2/fstatvfs.2
+usr/src/man/man2/futimesat.2
+usr/src/man/man2/getaudit_addr.2
+usr/src/man/man2/getegid.2
+usr/src/man/man2/geteuid.2
+usr/src/man/man2/getgid.2
+usr/src/man/man2/getpgid.2
+usr/src/man/man2/getpgrp.2
+usr/src/man/man2/getpmsg.2
+usr/src/man/man2/getppid.2
+usr/src/man/man2/getprojid.2
+usr/src/man/man2/getrctl.2
+usr/src/man/man2/gettaskid.2
+usr/src/man/man2/intro.2
+usr/src/man/man2/lchown.2
+usr/src/man/man2/lstat.2
+usr/src/man/man2/openat.2
+usr/src/man/man2/pathconf.2
+usr/src/man/man2/pread.2
+usr/src/man/man2/pset_assign.2
+usr/src/man/man2/pset_destroy.2
+usr/src/man/man2/pset_getattr.2
+usr/src/man/man2/putacct.2
+usr/src/man/man2/putpmsg.2
+usr/src/man/man2/pwrite.2
+usr/src/man/man2/readv.2
+usr/src/man/man2/renameat.2
+usr/src/man/man2/sbrk.2
+usr/src/man/man2/semtimedop.2
+usr/src/man/man2/setaudit.2
+usr/src/man/man2/setaudit_addr.2
+usr/src/man/man2/setauid.2
+usr/src/man/man2/setcontext.2
+usr/src/man/man2/setegid.2
+usr/src/man/man2/seteuid.2
+usr/src/man/man2/setgid.2
+usr/src/man/man2/setgroups.2
+usr/src/man/man2/setitimer.2
+usr/src/man/man2/setpflags.2
+usr/src/man/man2/setppriv.2
+usr/src/man/man2/setrlimit.2
+usr/src/man/man2/setustack.2
+usr/src/man/man2/shmat.2
+usr/src/man/man2/shmdt.2
+usr/src/man/man2/sigsendset.2
+usr/src/man/man2/umount2.2
+usr/src/man/man2/unlinkat.2
+usr/src/man/man2/vforkx.2
+usr/src/man/man2/wracct.2
+usr/src/man/man2/writev.2
+usr/src/man/man3/intro.3
+usr/src/man/man3bsm/au_close.3bsm
+usr/src/man/man3bsm/au_to_arg.3bsm
+usr/src/man/man3bsm/au_to_arg32.3bsm
+usr/src/man/man3bsm/au_to_arg64.3bsm
+usr/src/man/man3bsm/au_to_attr.3bsm
+usr/src/man/man3bsm/au_to_cmd.3bsm
+usr/src/man/man3bsm/au_to_data.3bsm
+usr/src/man/man3bsm/au_to_groups.3bsm
+usr/src/man/man3bsm/au_to_in_addr.3bsm
+usr/src/man/man3bsm/au_to_ipc.3bsm
+usr/src/man/man3bsm/au_to_iport.3bsm
+usr/src/man/man3bsm/au_to_me.3bsm
+usr/src/man/man3bsm/au_to_newgroups.3bsm
+usr/src/man/man3bsm/au_to_opaque.3bsm
+usr/src/man/man3bsm/au_to_path.3bsm
+usr/src/man/man3bsm/au_to_process.3bsm
+usr/src/man/man3bsm/au_to_process_ex.3bsm
+usr/src/man/man3bsm/au_to_return.3bsm
+usr/src/man/man3bsm/au_to_return32.3bsm
+usr/src/man/man3bsm/au_to_return64.3bsm
+usr/src/man/man3bsm/au_to_socket.3bsm
+usr/src/man/man3bsm/au_to_subject.3bsm
+usr/src/man/man3bsm/au_to_subject_ex.3bsm
+usr/src/man/man3bsm/au_to_text.3bsm
+usr/src/man/man3bsm/au_write.3bsm
+usr/src/man/man3bsm/endac.3bsm
+usr/src/man/man3bsm/endauclass.3bsm
+usr/src/man/man3bsm/endauevent.3bsm
+usr/src/man/man3bsm/endauuser.3bsm
+usr/src/man/man3bsm/endddent.3bsm
+usr/src/man/man3bsm/getacdir.3bsm
+usr/src/man/man3bsm/getacflg.3bsm
+usr/src/man/man3bsm/getacmin.3bsm
+usr/src/man/man3bsm/getacna.3bsm
+usr/src/man/man3bsm/getauclassent_r.3bsm
+usr/src/man/man3bsm/getauclassnam.3bsm
+usr/src/man/man3bsm/getauclassnam_r.3bsm
+usr/src/man/man3bsm/getauditflagsbin.3bsm
+usr/src/man/man3bsm/getauditflagschar.3bsm
+usr/src/man/man3bsm/getauevent_r.3bsm
+usr/src/man/man3bsm/getauevnam.3bsm
+usr/src/man/man3bsm/getauevnam_r.3bsm
+usr/src/man/man3bsm/getauevnonam.3bsm
+usr/src/man/man3bsm/getauevnum.3bsm
+usr/src/man/man3bsm/getauevnum_r.3bsm
+usr/src/man/man3bsm/getauuserent.3bsm
+usr/src/man/man3bsm/getauuserent_r.3bsm
+usr/src/man/man3bsm/getauusernam_r.3bsm
+usr/src/man/man3bsm/getddnam.3bsm
+usr/src/man/man3bsm/setac.3bsm
+usr/src/man/man3bsm/setauclass.3bsm
+usr/src/man/man3bsm/setauevent.3bsm
+usr/src/man/man3bsm/setauuser.3bsm
+usr/src/man/man3bsm/setddent.3bsm
+usr/src/man/man3bsm/setddfile.3bsm
+usr/src/man/man3c/FD_CLR.3c
+usr/src/man/man3c/FD_ISSET.3c
+usr/src/man/man3c/FD_SET.3c
+usr/src/man/man3c/FD_ZERO.3c
+usr/src/man/man3c/__flbf.3c
+usr/src/man/man3c/__fpending.3c
+usr/src/man/man3c/__fpurge.3c
+usr/src/man/man3c/__freadable.3c
+usr/src/man/man3c/__freading.3c
+usr/src/man/man3c/__fsetlocking.3c
+usr/src/man/man3c/__fwritable.3c
+usr/src/man/man3c/__fwriting.3c
+usr/src/man/man3c/_edata.3c
+usr/src/man/man3c/_end.3c
+usr/src/man/man3c/_etext.3c
+usr/src/man/man3c/_exithandle.3c
+usr/src/man/man3c/_flushlbf.3c
+usr/src/man/man3c/_setjmp.3c
+usr/src/man/man3c/addrtosymstr.3c
+usr/src/man/man3c/aiowrite.3c
+usr/src/man/man3c/alloca.3c
+usr/src/man/man3c/alphasort.3c
+usr/src/man/man3c/ascftime.3c
+usr/src/man/man3c/asctime.3c
+usr/src/man/man3c/asctime_r.3c
+usr/src/man/man3c/asprintf.3c
+usr/src/man/man3c/atof.3c
+usr/src/man/man3c/atoi.3c
+usr/src/man/man3c/atol.3c
+usr/src/man/man3c/atoll.3c
+usr/src/man/man3c/atomic_add_16.3c
+usr/src/man/man3c/atomic_add_16_nv.3c
+usr/src/man/man3c/atomic_add_32.3c
+usr/src/man/man3c/atomic_add_32_nv.3c
+usr/src/man/man3c/atomic_add_64.3c
+usr/src/man/man3c/atomic_add_64_nv.3c
+usr/src/man/man3c/atomic_add_8.3c
+usr/src/man/man3c/atomic_add_8_nv.3c
+usr/src/man/man3c/atomic_add_char.3c
+usr/src/man/man3c/atomic_add_char_nv.3c
+usr/src/man/man3c/atomic_add_int.3c
+usr/src/man/man3c/atomic_add_int_nv.3c
+usr/src/man/man3c/atomic_add_long.3c
+usr/src/man/man3c/atomic_add_long_nv.3c
+usr/src/man/man3c/atomic_add_ptr.3c
+usr/src/man/man3c/atomic_add_ptr_nv.3c
+usr/src/man/man3c/atomic_add_short.3c
+usr/src/man/man3c/atomic_add_short_nv.3c
+usr/src/man/man3c/atomic_and_16.3c
+usr/src/man/man3c/atomic_and_16_nv.3c
+usr/src/man/man3c/atomic_and_32.3c
+usr/src/man/man3c/atomic_and_32_nv.3c
+usr/src/man/man3c/atomic_and_64.3c
+usr/src/man/man3c/atomic_and_64_nv.3c
+usr/src/man/man3c/atomic_and_8.3c
+usr/src/man/man3c/atomic_and_8_nv.3c
+usr/src/man/man3c/atomic_and_uchar.3c
+usr/src/man/man3c/atomic_and_uchar_nv.3c
+usr/src/man/man3c/atomic_and_uint.3c
+usr/src/man/man3c/atomic_and_uint_nv.3c
+usr/src/man/man3c/atomic_and_ulong.3c
+usr/src/man/man3c/atomic_and_ulong_nv.3c
+usr/src/man/man3c/atomic_and_ushort.3c
+usr/src/man/man3c/atomic_and_ushort_nv.3c
+usr/src/man/man3c/atomic_cas_16.3c
+usr/src/man/man3c/atomic_cas_32.3c
+usr/src/man/man3c/atomic_cas_64.3c
+usr/src/man/man3c/atomic_cas_8.3c
+usr/src/man/man3c/atomic_cas_ptr.3c
+usr/src/man/man3c/atomic_cas_uchar.3c
+usr/src/man/man3c/atomic_cas_uint.3c
+usr/src/man/man3c/atomic_cas_ulong.3c
+usr/src/man/man3c/atomic_cas_ushort.3c
+usr/src/man/man3c/atomic_clear_long_excl.3c
+usr/src/man/man3c/atomic_dec_16.3c
+usr/src/man/man3c/atomic_dec_16_nv.3c
+usr/src/man/man3c/atomic_dec_32.3c
+usr/src/man/man3c/atomic_dec_32_nv.3c
+usr/src/man/man3c/atomic_dec_64.3c
+usr/src/man/man3c/atomic_dec_64_nv.3c
+usr/src/man/man3c/atomic_dec_8.3c
+usr/src/man/man3c/atomic_dec_8_nv.3c
+usr/src/man/man3c/atomic_dec_ptr.3c
+usr/src/man/man3c/atomic_dec_ptr_nv.3c
+usr/src/man/man3c/atomic_dec_uchar.3c
+usr/src/man/man3c/atomic_dec_uchar_nv.3c
+usr/src/man/man3c/atomic_dec_uint.3c
+usr/src/man/man3c/atomic_dec_uint_nv.3c
+usr/src/man/man3c/atomic_dec_ulong.3c
+usr/src/man/man3c/atomic_dec_ulong_nv.3c
+usr/src/man/man3c/atomic_dec_ushort.3c
+usr/src/man/man3c/atomic_dec_ushort_nv.3c
+usr/src/man/man3c/atomic_inc_16.3c
+usr/src/man/man3c/atomic_inc_16_nv.3c
+usr/src/man/man3c/atomic_inc_32.3c
+usr/src/man/man3c/atomic_inc_32_nv.3c
+usr/src/man/man3c/atomic_inc_64.3c
+usr/src/man/man3c/atomic_inc_64_nv.3c
+usr/src/man/man3c/atomic_inc_8.3c
+usr/src/man/man3c/atomic_inc_8_nv.3c
+usr/src/man/man3c/atomic_inc_ptr.3c
+usr/src/man/man3c/atomic_inc_ptr_nv.3c
+usr/src/man/man3c/atomic_inc_uchar.3c
+usr/src/man/man3c/atomic_inc_uchar_nv.3c
+usr/src/man/man3c/atomic_inc_uint.3c
+usr/src/man/man3c/atomic_inc_uint_nv.3c
+usr/src/man/man3c/atomic_inc_ulong.3c
+usr/src/man/man3c/atomic_inc_ulong_nv.3c
+usr/src/man/man3c/atomic_inc_ushort.3c
+usr/src/man/man3c/atomic_inc_ushort_nv.3c
+usr/src/man/man3c/atomic_or_16.3c
+usr/src/man/man3c/atomic_or_16_nv.3c
+usr/src/man/man3c/atomic_or_32.3c
+usr/src/man/man3c/atomic_or_32_nv.3c
+usr/src/man/man3c/atomic_or_64.3c
+usr/src/man/man3c/atomic_or_64_nv.3c
+usr/src/man/man3c/atomic_or_8.3c
+usr/src/man/man3c/atomic_or_8_nv.3c
+usr/src/man/man3c/atomic_or_uchar.3c
+usr/src/man/man3c/atomic_or_uchar_nv.3c
+usr/src/man/man3c/atomic_or_uint.3c
+usr/src/man/man3c/atomic_or_uint_nv.3c
+usr/src/man/man3c/atomic_or_ulong.3c
+usr/src/man/man3c/atomic_or_ulong_nv.3c
+usr/src/man/man3c/atomic_or_ushort.3c
+usr/src/man/man3c/atomic_or_ushort_nv.3c
+usr/src/man/man3c/atomic_set_long_excl.3c
+usr/src/man/man3c/atomic_swap_16.3c
+usr/src/man/man3c/atomic_swap_32.3c
+usr/src/man/man3c/atomic_swap_64.3c
+usr/src/man/man3c/atomic_swap_8.3c
+usr/src/man/man3c/atomic_swap_ptr.3c
+usr/src/man/man3c/atomic_swap_uchar.3c
+usr/src/man/man3c/atomic_swap_uint.3c
+usr/src/man/man3c/atomic_swap_ulong.3c
+usr/src/man/man3c/atomic_swap_ushort.3c
+usr/src/man/man3c/backtrace.3c
+usr/src/man/man3c/backtrace_symbols.3c
+usr/src/man/man3c/backtrace_symbols_fd.3c
+usr/src/man/man3c/bcmp.3c
+usr/src/man/man3c/bcopy.3c
+usr/src/man/man3c/bind_textdomain_codeset.3c
+usr/src/man/man3c/bindtextdomain.3c
+usr/src/man/man3c/bzero.3c
+usr/src/man/man3c/calloc.3c
+usr/src/man/man3c/catclose.3c
+usr/src/man/man3c/cfgetospeed.3c
+usr/src/man/man3c/cfsetospeed.3c
+usr/src/man/man3c/cftime.3c
+usr/src/man/man3c/clearerr.3c
+usr/src/man/man3c/clock_getres.3c
+usr/src/man/man3c/clock_gettime.3c
+usr/src/man/man3c/closelog.3c
+usr/src/man/man3c/cond_broadcast.3c
+usr/src/man/man3c/cond_destroy.3c
+usr/src/man/man3c/cond_reltimedwait.3c
+usr/src/man/man3c/cond_signal.3c
+usr/src/man/man3c/cond_timedwait.3c
+usr/src/man/man3c/cond_wait.3c
+usr/src/man/man3c/csetcol.3c
+usr/src/man/man3c/csetlen.3c
+usr/src/man/man3c/csetno.3c
+usr/src/man/man3c/ctermid_r.3c
+usr/src/man/man3c/ctime_r.3c
+usr/src/man/man3c/dbm_clearerr.3c
+usr/src/man/man3c/dbm_close.3c
+usr/src/man/man3c/dbm_delete.3c
+usr/src/man/man3c/dbm_error.3c
+usr/src/man/man3c/dbm_fetch.3c
+usr/src/man/man3c/dbm_firstkey.3c
+usr/src/man/man3c/dbm_nextkey.3c
+usr/src/man/man3c/dbm_open.3c
+usr/src/man/man3c/dbm_store.3c
+usr/src/man/man3c/dcgettext.3c
+usr/src/man/man3c/dcngettext.3c
+usr/src/man/man3c/decimal_to_double.3c
+usr/src/man/man3c/decimal_to_extended.3c
+usr/src/man/man3c/decimal_to_quadruple.3c
+usr/src/man/man3c/decimal_to_single.3c
+usr/src/man/man3c/dgettext.3c
+usr/src/man/man3c/dladdr1.3c
+usr/src/man/man3c/dlmopen.3c
+usr/src/man/man3c/dngettext.3c
+usr/src/man/man3c/door_setparam.3c
+usr/src/man/man3c/door_unbind.3c
+usr/src/man/man3c/double_to_decimal.3c
+usr/src/man/man3c/edata.3c
+usr/src/man/man3c/endgrent.3c
+usr/src/man/man3c/endnetgrent.3c
+usr/src/man/man3c/endpwent.3c
+usr/src/man/man3c/endspent.3c
+usr/src/man/man3c/endusershell.3c
+usr/src/man/man3c/endutent.3c
+usr/src/man/man3c/endutxent.3c
+usr/src/man/man3c/erand48.3c
+usr/src/man/man3c/errno.3c
+usr/src/man/man3c/errx.3c
+usr/src/man/man3c/etext.3c
+usr/src/man/man3c/euccol.3c
+usr/src/man/man3c/eucscol.3c
+usr/src/man/man3c/extended_to_decimal.3c
+usr/src/man/man3c/fconvert.3c
+usr/src/man/man3c/fcvt.3c
+usr/src/man/man3c/fdopendir.3c
+usr/src/man/man3c/fdwalk.3c
+usr/src/man/man3c/feof.3c
+usr/src/man/man3c/fgetgrent.3c
+usr/src/man/man3c/fgetgrent_r.3c
+usr/src/man/man3c/fgetpwent.3c
+usr/src/man/man3c/fgetpwent_r.3c
+usr/src/man/man3c/fgets.3c
+usr/src/man/man3c/fgetspent.3c
+usr/src/man/man3c/fgetspent_r.3c
+usr/src/man/man3c/fgetws.3c
+usr/src/man/man3c/file_to_decimal.3c
+usr/src/man/man3c/fileno.3c
+usr/src/man/man3c/finite.3c
+usr/src/man/man3c/fpclass.3c
+usr/src/man/man3c/fpgetmask.3c
+usr/src/man/man3c/fpgetsticky.3c
+usr/src/man/man3c/fprintf.3c
+usr/src/man/man3c/fpsetmask.3c
+usr/src/man/man3c/fpsetround.3c
+usr/src/man/man3c/fpsetsticky.3c
+usr/src/man/man3c/fputs.3c
+usr/src/man/man3c/free.3c
+usr/src/man/man3c/fscanf.3c
+usr/src/man/man3c/fseeko.3c
+usr/src/man/man3c/fsetattr.3c
+usr/src/man/man3c/ftello.3c
+usr/src/man/man3c/ftruncate.3c
+usr/src/man/man3c/ftrylockfile.3c
+usr/src/man/man3c/func_to_decimal.3c
+usr/src/man/man3c/funlockfile.3c
+usr/src/man/man3c/gconvert.3c
+usr/src/man/man3c/gcvt.3c
+usr/src/man/man3c/getattrat.3c
+usr/src/man/man3c/getc.3c
+usr/src/man/man3c/getc_unlocked.3c
+usr/src/man/man3c/getchar.3c
+usr/src/man/man3c/getchar_unlocked.3c
+usr/src/man/man3c/getextmntent.3c
+usr/src/man/man3c/getgrent.3c
+usr/src/man/man3c/getgrent_r.3c
+usr/src/man/man3c/getgrgid.3c
+usr/src/man/man3c/getgrgid_r.3c
+usr/src/man/man3c/getgrnam_r.3c
+usr/src/man/man3c/gethomelgroup.3c
+usr/src/man/man3c/gethrvtime.3c
+usr/src/man/man3c/getlogin_r.3c
+usr/src/man/man3c/getmntany.3c
+usr/src/man/man3c/getnetgrent_r.3c
+usr/src/man/man3c/getpassphrase.3c
+usr/src/man/man3c/getpwent.3c
+usr/src/man/man3c/getpwent_r.3c
+usr/src/man/man3c/getpwnam_r.3c
+usr/src/man/man3c/getpwuid.3c
+usr/src/man/man3c/getpwuid_r.3c
+usr/src/man/man3c/getspent.3c
+usr/src/man/man3c/getspent_r.3c
+usr/src/man/man3c/getspnam_r.3c
+usr/src/man/man3c/getutid.3c
+usr/src/man/man3c/getutline.3c
+usr/src/man/man3c/getutmp.3c
+usr/src/man/man3c/getutmpx.3c
+usr/src/man/man3c/getutxid.3c
+usr/src/man/man3c/getutxline.3c
+usr/src/man/man3c/getvfsany.3c
+usr/src/man/man3c/getvfsfile.3c
+usr/src/man/man3c/getvfsspec.3c
+usr/src/man/man3c/getw.3c
+usr/src/man/man3c/getzoneidbyname.3c
+usr/src/man/man3c/getzonenamebyid.3c
+usr/src/man/man3c/globfree.3c
+usr/src/man/man3c/gmtime.3c
+usr/src/man/man3c/gmtime_r.3c
+usr/src/man/man3c/gsignal.3c
+usr/src/man/man3c/hasmntopt.3c
+usr/src/man/man3c/hcreate.3c
+usr/src/man/man3c/hdestroy.3c
+usr/src/man/man3c/initstate.3c
+usr/src/man/man3c/innetgr.3c
+usr/src/man/man3c/isalnum.3c
+usr/src/man/man3c/isalpha.3c
+usr/src/man/man3c/isascii.3c
+usr/src/man/man3c/isblank.3c
+usr/src/man/man3c/iscntrl.3c
+usr/src/man/man3c/isdigit.3c
+usr/src/man/man3c/isenglish.3c
+usr/src/man/man3c/isgraph.3c
+usr/src/man/man3c/isideogram.3c
+usr/src/man/man3c/islower.3c
+usr/src/man/man3c/isnanf.3c
+usr/src/man/man3c/isnumber.3c
+usr/src/man/man3c/isphonogram.3c
+usr/src/man/man3c/isprint.3c
+usr/src/man/man3c/ispunct.3c
+usr/src/man/man3c/isspace.3c
+usr/src/man/man3c/isspecial.3c
+usr/src/man/man3c/isupper.3c
+usr/src/man/man3c/iswalnum.3c
+usr/src/man/man3c/iswascii.3c
+usr/src/man/man3c/iswblank.3c
+usr/src/man/man3c/iswcntrl.3c
+usr/src/man/man3c/iswdigit.3c
+usr/src/man/man3c/iswgraph.3c
+usr/src/man/man3c/iswlower.3c
+usr/src/man/man3c/iswprint.3c
+usr/src/man/man3c/iswpunct.3c
+usr/src/man/man3c/iswspace.3c
+usr/src/man/man3c/iswupper.3c
+usr/src/man/man3c/iswxdigit.3c
+usr/src/man/man3c/isxdigit.3c
+usr/src/man/man3c/jrand48.3c
+usr/src/man/man3c/l64a.3c
+usr/src/man/man3c/labs.3c
+usr/src/man/man3c/lcong48.3c
+usr/src/man/man3c/ldiv.3c
+usr/src/man/man3c/lfind.3c
+usr/src/man/man3c/llabs.3c
+usr/src/man/man3c/lldiv.3c
+usr/src/man/man3c/lltostr.3c
+usr/src/man/man3c/localtime.3c
+usr/src/man/man3c/localtime_r.3c
+usr/src/man/man3c/longjmp.3c
+usr/src/man/man3c/lrand48.3c
+usr/src/man/man3c/major.3c
+usr/src/man/man3c/memalign.3c
+usr/src/man/man3c/membar_consumer.3c
+usr/src/man/man3c/membar_enter.3c
+usr/src/man/man3c/membar_exit.3c
+usr/src/man/man3c/membar_producer.3c
+usr/src/man/man3c/memccpy.3c
+usr/src/man/man3c/memchr.3c
+usr/src/man/man3c/memcmp.3c
+usr/src/man/man3c/memcpy.3c
+usr/src/man/man3c/memmove.3c
+usr/src/man/man3c/memset.3c
+usr/src/man/man3c/minor.3c
+usr/src/man/man3c/mkdtemp.3c
+usr/src/man/man3c/mkstemps.3c
+usr/src/man/man3c/mq_reltimedreceive_np.3c
+usr/src/man/man3c/mq_reltimedsend_np.3c
+usr/src/man/man3c/mq_timedreceive.3c
+usr/src/man/man3c/mq_timedsend.3c
+usr/src/man/man3c/mrand48.3c
+usr/src/man/man3c/munlock.3c
+usr/src/man/man3c/munlockall.3c
+usr/src/man/man3c/mutex_consistent.3c
+usr/src/man/man3c/mutex_destroy.3c
+usr/src/man/man3c/mutex_lock.3c
+usr/src/man/man3c/mutex_trylock.3c
+usr/src/man/man3c/mutex_unlock.3c
+usr/src/man/man3c/nftw.3c
+usr/src/man/man3c/ngettext.3c
+usr/src/man/man3c/nrand48.3c
+usr/src/man/man3c/openlog.3c
+usr/src/man/man3c/pclose.3c
+usr/src/man/man3c/port_dissociate.3c
+usr/src/man/man3c/port_getn.3c
+usr/src/man/man3c/port_sendn.3c
+usr/src/man/man3c/posix_spawn_file_actions_addopen.3c
+usr/src/man/man3c/posix_spawn_file_actions_init.3c
+usr/src/man/man3c/posix_spawnattr_init.3c
+usr/src/man/man3c/posix_spawnattr_setflags.3c
+usr/src/man/man3c/posix_spawnattr_setpgroup.3c
+usr/src/man/man3c/posix_spawnattr_setschedparam.3c
+usr/src/man/man3c/posix_spawnattr_setschedpolicy.3c
+usr/src/man/man3c/posix_spawnattr_setsigdefault.3c
+usr/src/man/man3c/posix_spawnattr_setsigignore_np.3c
+usr/src/man/man3c/posix_spawnattr_setsigmask.3c
+usr/src/man/man3c/posix_spawnp.3c
+usr/src/man/man3c/printstack.3c
+usr/src/man/man3c/priv_allocset.3c
+usr/src/man/man3c/priv_basicset.3c
+usr/src/man/man3c/priv_copyset.3c
+usr/src/man/man3c/priv_delset.3c
+usr/src/man/man3c/priv_emptyset.3c
+usr/src/man/man3c/priv_fillset.3c
+usr/src/man/man3c/priv_freeset.3c
+usr/src/man/man3c/priv_getbyname.3c
+usr/src/man/man3c/priv_getbynum.3c
+usr/src/man/man3c/priv_getsetbyname.3c
+usr/src/man/man3c/priv_getsetbynum.3c
+usr/src/man/man3c/priv_gettext.3c
+usr/src/man/man3c/priv_ineffect.3c
+usr/src/man/man3c/priv_intersect.3c
+usr/src/man/man3c/priv_inverse.3c
+usr/src/man/man3c/priv_isemptyset.3c
+usr/src/man/man3c/priv_isequalset.3c
+usr/src/man/man3c/priv_isfullset.3c
+usr/src/man/man3c/priv_ismember.3c
+usr/src/man/man3c/priv_issubset.3c
+usr/src/man/man3c/priv_set_to_str.3c
+usr/src/man/man3c/priv_union.3c
+usr/src/man/man3c/pselect.3c
+usr/src/man/man3c/psiginfo.3c
+usr/src/man/man3c/pthread_attr_destroy.3c
+usr/src/man/man3c/pthread_attr_setdetachstate.3c
+usr/src/man/man3c/pthread_attr_setguardsize.3c
+usr/src/man/man3c/pthread_attr_setinheritsched.3c
+usr/src/man/man3c/pthread_attr_setschedparam.3c
+usr/src/man/man3c/pthread_attr_setschedpolicy.3c
+usr/src/man/man3c/pthread_attr_setscope.3c
+usr/src/man/man3c/pthread_attr_setstack.3c
+usr/src/man/man3c/pthread_attr_setstackaddr.3c
+usr/src/man/man3c/pthread_attr_setstacksize.3c
+usr/src/man/man3c/pthread_barrier_init.3c
+usr/src/man/man3c/pthread_barrierattr_init.3c
+usr/src/man/man3c/pthread_barrierattr_setpshared.3c
+usr/src/man/man3c/pthread_cond_broadcast.3c
+usr/src/man/man3c/pthread_cond_destroy.3c
+usr/src/man/man3c/pthread_cond_reltimedwait_np.3c
+usr/src/man/man3c/pthread_cond_timedwait.3c
+usr/src/man/man3c/pthread_condattr_destroy.3c
+usr/src/man/man3c/pthread_condattr_setclock.3c
+usr/src/man/man3c/pthread_condattr_setpshared.3c
+usr/src/man/man3c/pthread_key_create_once_np.3c
+usr/src/man/man3c/pthread_mutex_destroy.3c
+usr/src/man/man3c/pthread_mutex_reltimedlock_np.3c
+usr/src/man/man3c/pthread_mutex_setprioceiling.3c
+usr/src/man/man3c/pthread_mutex_trylock.3c
+usr/src/man/man3c/pthread_mutex_unlock.3c
+usr/src/man/man3c/pthread_mutexattr_destroy.3c
+usr/src/man/man3c/pthread_mutexattr_setprioceiling.3c
+usr/src/man/man3c/pthread_mutexattr_setprotocol.3c
+usr/src/man/man3c/pthread_mutexattr_setpshared.3c
+usr/src/man/man3c/pthread_mutexattr_settype.3c
+usr/src/man/man3c/pthread_rwlock_destroy.3c
+usr/src/man/man3c/pthread_rwlock_reltimedrdlock_np.3c
+usr/src/man/man3c/pthread_rwlock_reltimedwrlock_np.3c
+usr/src/man/man3c/pthread_rwlock_tryrdlock.3c
+usr/src/man/man3c/pthread_rwlock_trywrlock.3c
+usr/src/man/man3c/pthread_rwlockattr_destroy.3c
+usr/src/man/man3c/pthread_rwlockattr_setpshared.3c
+usr/src/man/man3c/pthread_setconcurrency.3c
+usr/src/man/man3c/pthread_setschedparam.3c
+usr/src/man/man3c/pthread_setspecific.3c
+usr/src/man/man3c/pthread_spin_init.3c
+usr/src/man/man3c/pthread_spin_trylock.3c
+usr/src/man/man3c/putc.3c
+usr/src/man/man3c/putc_unlocked.3c
+usr/src/man/man3c/putchar.3c
+usr/src/man/man3c/putchar_unlocked.3c
+usr/src/man/man3c/putmntent.3c
+usr/src/man/man3c/pututline.3c
+usr/src/man/man3c/pututxline.3c
+usr/src/man/man3c/putw.3c
+usr/src/man/man3c/putwc.3c
+usr/src/man/man3c/putwchar.3c
+usr/src/man/man3c/qeconvert.3c
+usr/src/man/man3c/qfconvert.3c
+usr/src/man/man3c/qgconvert.3c
+usr/src/man/man3c/quadruple_to_decimal.3c
+usr/src/man/man3c/rand_r.3c
+usr/src/man/man3c/rctlblk_get_enforced_value.3c
+usr/src/man/man3c/rctlblk_get_firing_time.3c
+usr/src/man/man3c/rctlblk_get_global_action.3c
+usr/src/man/man3c/rctlblk_get_global_flags.3c
+usr/src/man/man3c/rctlblk_get_local_action.3c
+usr/src/man/man3c/rctlblk_get_local_flags.3c
+usr/src/man/man3c/rctlblk_get_privilege.3c
+usr/src/man/man3c/rctlblk_get_recipient_pid.3c
+usr/src/man/man3c/rctlblk_get_value.3c
+usr/src/man/man3c/rctlblk_set_local_action.3c
+usr/src/man/man3c/rctlblk_set_local_flags.3c
+usr/src/man/man3c/rctlblk_set_privilege.3c
+usr/src/man/man3c/rctlblk_set_recipient_pid.3c
+usr/src/man/man3c/rctlblk_size.3c
+usr/src/man/man3c/re_exec.3c
+usr/src/man/man3c/readdir_r.3c
+usr/src/man/man3c/realloc.3c
+usr/src/man/man3c/regerror.3c
+usr/src/man/man3c/regex.3c
+usr/src/man/man3c/regexec.3c
+usr/src/man/man3c/regfree.3c
+usr/src/man/man3c/remque.3c
+usr/src/man/man3c/resetmnttab.3c
+usr/src/man/man3c/rindex.3c
+usr/src/man/man3c/rw_rdlock.3c
+usr/src/man/man3c/rw_tryrdlock.3c
+usr/src/man/man3c/rw_trywrlock.3c
+usr/src/man/man3c/rw_unlock.3c
+usr/src/man/man3c/rw_wrlock.3c
+usr/src/man/man3c/rwlock_destroy.3c
+usr/src/man/man3c/rwlock_init.3c
+usr/src/man/man3c/sched_get_priority_min.3c
+usr/src/man/man3c/schedctl_exit.3c
+usr/src/man/man3c/schedctl_lookup.3c
+usr/src/man/man3c/schedctl_start.3c
+usr/src/man/man3c/schedctl_stop.3c
+usr/src/man/man3c/seconvert.3c
+usr/src/man/man3c/seed48.3c
+usr/src/man/man3c/sem_reltimedwait_np.3c
+usr/src/man/man3c/sem_trywait.3c
+usr/src/man/man3c/sema_destroy.3c
+usr/src/man/man3c/sema_init.3c
+usr/src/man/man3c/sema_post.3c
+usr/src/man/man3c/sema_trywait.3c
+usr/src/man/man3c/sema_wait.3c
+usr/src/man/man3c/setattrat.3c
+usr/src/man/man3c/setgrent.3c
+usr/src/man/man3c/sethostname.3c
+usr/src/man/man3c/setlinebuf.3c
+usr/src/man/man3c/setlogmask.3c
+usr/src/man/man3c/setnetgrent.3c
+usr/src/man/man3c/setpriority.3c
+usr/src/man/man3c/setpwent.3c
+usr/src/man/man3c/setspent.3c
+usr/src/man/man3c/setstate.3c
+usr/src/man/man3c/settimeofday.3c
+usr/src/man/man3c/setusershell.3c
+usr/src/man/man3c/setutent.3c
+usr/src/man/man3c/setutxent.3c
+usr/src/man/man3c/setvbuf.3c
+usr/src/man/man3c/sfconvert.3c
+usr/src/man/man3c/sgconvert.3c
+usr/src/man/man3c/sig2str.3c
+usr/src/man/man3c/sigaddset.3c
+usr/src/man/man3c/sigdelset.3c
+usr/src/man/man3c/sigemptyset.3c
+usr/src/man/man3c/sigfillset.3c
+usr/src/man/man3c/sighold.3c
+usr/src/man/man3c/sigignore.3c
+usr/src/man/man3c/sigismember.3c
+usr/src/man/man3c/siglongjmp.3c
+usr/src/man/man3c/sigpause.3c
+usr/src/man/man3c/sigrelse.3c
+usr/src/man/man3c/sigset.3c
+usr/src/man/man3c/sigsetjmp.3c
+usr/src/man/man3c/sigtimedwait.3c
+usr/src/man/man3c/single_to_decimal.3c
+usr/src/man/man3c/snprintf.3c
+usr/src/man/man3c/sprintf.3c
+usr/src/man/man3c/srand.3c
+usr/src/man/man3c/srand48.3c
+usr/src/man/man3c/srandom.3c
+usr/src/man/man3c/sscanf.3c
+usr/src/man/man3c/strcasecmp.3c
+usr/src/man/man3c/strcat.3c
+usr/src/man/man3c/strchr.3c
+usr/src/man/man3c/strcmp.3c
+usr/src/man/man3c/strcpy.3c
+usr/src/man/man3c/strcspn.3c
+usr/src/man/man3c/strdup.3c
+usr/src/man/man3c/strerror_r.3c
+usr/src/man/man3c/strlcat.3c
+usr/src/man/man3c/strlcpy.3c
+usr/src/man/man3c/strlen.3c
+usr/src/man/man3c/strncasecmp.3c
+usr/src/man/man3c/strncat.3c
+usr/src/man/man3c/strncmp.3c
+usr/src/man/man3c/strncpy.3c
+usr/src/man/man3c/strnlen.3c
+usr/src/man/man3c/strpbrk.3c
+usr/src/man/man3c/strrchr.3c
+usr/src/man/man3c/strsep.3c
+usr/src/man/man3c/strspn.3c
+usr/src/man/man3c/strstr.3c
+usr/src/man/man3c/strtof.3c
+usr/src/man/man3c/strtok.3c
+usr/src/man/man3c/strtok_r.3c
+usr/src/man/man3c/strtold.3c
+usr/src/man/man3c/strtoll.3c
+usr/src/man/man3c/strtoull.3c
+usr/src/man/man3c/strtoumax.3c
+usr/src/man/man3c/swapcontext.3c
+usr/src/man/man3c/swprintf.3c
+usr/src/man/man3c/swscanf.3c
+usr/src/man/man3c/tdelete.3c
+usr/src/man/man3c/tempnam.3c
+usr/src/man/man3c/textdomain.3c
+usr/src/man/man3c/tfind.3c
+usr/src/man/man3c/thr_continue.3c
+usr/src/man/man3c/thr_getspecific.3c
+usr/src/man/man3c/thr_keycreate_once.3c
+usr/src/man/man3c/thr_setconcurrency.3c
+usr/src/man/man3c/thr_setprio.3c
+usr/src/man/man3c/thr_setspecific.3c
+usr/src/man/man3c/timer_getoverrun.3c
+usr/src/man/man3c/timer_gettime.3c
+usr/src/man/man3c/timerclear.3c
+usr/src/man/man3c/timercmp.3c
+usr/src/man/man3c/timerisset.3c
+usr/src/man/man3c/timersub.3c
+usr/src/man/man3c/tmpnam_r.3c
+usr/src/man/man3c/ttyname_r.3c
+usr/src/man/man3c/twalk.3c
+usr/src/man/man3c/tzset.3c
+usr/src/man/man3c/uconv_u16tou8.3c
+usr/src/man/man3c/uconv_u32tou16.3c
+usr/src/man/man3c/uconv_u32tou8.3c
+usr/src/man/man3c/uconv_u8tou16.3c
+usr/src/man/man3c/uconv_u8tou32.3c
+usr/src/man/man3c/ucred_free.3c
+usr/src/man/man3c/ucred_getegid.3c
+usr/src/man/man3c/ucred_geteuid.3c
+usr/src/man/man3c/ucred_getgroups.3c
+usr/src/man/man3c/ucred_getlabel.3c
+usr/src/man/man3c/ucred_getpflags.3c
+usr/src/man/man3c/ucred_getpid.3c
+usr/src/man/man3c/ucred_getprivset.3c
+usr/src/man/man3c/ucred_getprojid.3c
+usr/src/man/man3c/ucred_getrgid.3c
+usr/src/man/man3c/ucred_getruid.3c
+usr/src/man/man3c/ucred_getsgid.3c
+usr/src/man/man3c/ucred_getsuid.3c
+usr/src/man/man3c/ucred_getzoneid.3c
+usr/src/man/man3c/ucred_size.3c
+usr/src/man/man3c/ulckpwdf.3c
+usr/src/man/man3c/ulltostr.3c
+usr/src/man/man3c/unordered.3c
+usr/src/man/man3c/updwtmp.3c
+usr/src/man/man3c/updwtmpx.3c
+usr/src/man/man3c/utmpname.3c
+usr/src/man/man3c/utmpxname.3c
+usr/src/man/man3c/valloc.3c
+usr/src/man/man3c/vasprintf.3c
+usr/src/man/man3c/verr.3c
+usr/src/man/man3c/verrx.3c
+usr/src/man/man3c/vfprintf.3c
+usr/src/man/man3c/vfscanf.3c
+usr/src/man/man3c/vfwscanf.3c
+usr/src/man/man3c/vscanf.3c
+usr/src/man/man3c/vsnprintf.3c
+usr/src/man/man3c/vsprintf.3c
+usr/src/man/man3c/vsscanf.3c
+usr/src/man/man3c/vswprintf.3c
+usr/src/man/man3c/vswscanf.3c
+usr/src/man/man3c/vwarn.3c
+usr/src/man/man3c/vwarnx.3c
+usr/src/man/man3c/vwprintf.3c
+usr/src/man/man3c/vwscanf.3c
+usr/src/man/man3c/wait4.3c
+usr/src/man/man3c/warn.3c
+usr/src/man/man3c/warnx.3c
+usr/src/man/man3c/watof.3c
+usr/src/man/man3c/watoi.3c
+usr/src/man/man3c/watol.3c
+usr/src/man/man3c/watoll.3c
+usr/src/man/man3c/wcscat.3c
+usr/src/man/man3c/wcschr.3c
+usr/src/man/man3c/wcscmp.3c
+usr/src/man/man3c/wcscpy.3c
+usr/src/man/man3c/wcscspn.3c
+usr/src/man/man3c/wcsetno.3c
+usr/src/man/man3c/wcslen.3c
+usr/src/man/man3c/wcsncat.3c
+usr/src/man/man3c/wcsncmp.3c
+usr/src/man/man3c/wcsncpy.3c
+usr/src/man/man3c/wcspbrk.3c
+usr/src/man/man3c/wcsrchr.3c
+usr/src/man/man3c/wcsspn.3c
+usr/src/man/man3c/wcstof.3c
+usr/src/man/man3c/wcstok.3c
+usr/src/man/man3c/wcstold.3c
+usr/src/man/man3c/wcstoll.3c
+usr/src/man/man3c/wcstoull.3c
+usr/src/man/man3c/wcstoumax.3c
+usr/src/man/man3c/wcswcs.3c
+usr/src/man/man3c/windex.3c
+usr/src/man/man3c/wordfree.3c
+usr/src/man/man3c/wprintf.3c
+usr/src/man/man3c/wrindex.3c
+usr/src/man/man3c/wscanf.3c
+usr/src/man/man3c/wscasecmp.3c
+usr/src/man/man3c/wscat.3c
+usr/src/man/man3c/wschr.3c
+usr/src/man/man3c/wscmp.3c
+usr/src/man/man3c/wscol.3c
+usr/src/man/man3c/wscoll.3c
+usr/src/man/man3c/wscpy.3c
+usr/src/man/man3c/wscspn.3c
+usr/src/man/man3c/wsdup.3c
+usr/src/man/man3c/wslen.3c
+usr/src/man/man3c/wsncasecmp.3c
+usr/src/man/man3c/wsncat.3c
+usr/src/man/man3c/wsncmp.3c
+usr/src/man/man3c/wsncpy.3c
+usr/src/man/man3c/wspbrk.3c
+usr/src/man/man3c/wsrchr.3c
+usr/src/man/man3c/wsspn.3c
+usr/src/man/man3c/wstod.3c
+usr/src/man/man3c/wstok.3c
+usr/src/man/man3c/wstol.3c
+usr/src/man/man3c/wstostr.3c
+usr/src/man/man3c/wsxfrm.3c
+usr/src/man/man3c_db/td_event_addset.3c_db
+usr/src/man/man3c_db/td_event_delset.3c_db
+usr/src/man/man3c_db/td_event_emptyset.3c_db
+usr/src/man/man3c_db/td_event_fillset.3c_db
+usr/src/man/man3c_db/td_eventisempty.3c_db
+usr/src/man/man3c_db/td_eventismember.3c_db
+usr/src/man/man3c_db/td_sync_get_stats.3c_db
+usr/src/man/man3c_db/td_sync_setstate.3c_db
+usr/src/man/man3c_db/td_sync_waiters.3c_db
+usr/src/man/man3c_db/td_ta_clear_event.3c_db
+usr/src/man/man3c_db/td_ta_delete.3c_db
+usr/src/man/man3c_db/td_ta_event_getmsg.3c_db
+usr/src/man/man3c_db/td_ta_get_ph.3c_db
+usr/src/man/man3c_db/td_ta_get_stats.3c_db
+usr/src/man/man3c_db/td_ta_map_lwp2thr.3c_db
+usr/src/man/man3c_db/td_ta_reset_stats.3c_db
+usr/src/man/man3c_db/td_ta_set_event.3c_db
+usr/src/man/man3c_db/td_ta_sync_tracking_enable.3c_db
+usr/src/man/man3c_db/td_ta_thr_iter.3c_db
+usr/src/man/man3c_db/td_ta_tsd_iter.3c_db
+usr/src/man/man3c_db/td_thr_clear_event.3c_db
+usr/src/man/man3c_db/td_thr_dbresume.3c_db
+usr/src/man/man3c_db/td_thr_event_enable.3c_db
+usr/src/man/man3c_db/td_thr_event_getmsg.3c_db
+usr/src/man/man3c_db/td_thr_getfpregs.3c_db
+usr/src/man/man3c_db/td_thr_getxregs.3c_db
+usr/src/man/man3c_db/td_thr_getxregsize.3c_db
+usr/src/man/man3c_db/td_thr_set_event.3c_db
+usr/src/man/man3c_db/td_thr_setfpregs.3c_db
+usr/src/man/man3c_db/td_thr_setgregs.3c_db
+usr/src/man/man3c_db/td_thr_setxregs.3c_db
+usr/src/man/man3c_db/td_thr_sigsetmask.3c_db
+usr/src/man/man3cfgadm/config_ap_id_cmp.3cfgadm
+usr/src/man/man3cfgadm/config_change_state.3cfgadm
+usr/src/man/man3cfgadm/config_list.3cfgadm
+usr/src/man/man3cfgadm/config_list_ext.3cfgadm
+usr/src/man/man3cfgadm/config_private_func.3cfgadm
+usr/src/man/man3cfgadm/config_stat.3cfgadm
+usr/src/man/man3cfgadm/config_strerror.3cfgadm
+usr/src/man/man3cfgadm/config_test.3cfgadm
+usr/src/man/man3cfgadm/config_unload_libs.3cfgadm
+usr/src/man/man3commputil/sdp_add_attribute.3commputil
+usr/src/man/man3commputil/sdp_add_bandwidth.3commputil
+usr/src/man/man3commputil/sdp_add_connection.3commputil
+usr/src/man/man3commputil/sdp_add_email.3commputil
+usr/src/man/man3commputil/sdp_add_information.3commputil
+usr/src/man/man3commputil/sdp_add_key.3commputil
+usr/src/man/man3commputil/sdp_add_media.3commputil
+usr/src/man/man3commputil/sdp_add_name.3commputil
+usr/src/man/man3commputil/sdp_add_phone.3commputil
+usr/src/man/man3commputil/sdp_add_repeat.3commputil
+usr/src/man/man3commputil/sdp_add_time.3commputil
+usr/src/man/man3commputil/sdp_add_uri.3commputil
+usr/src/man/man3commputil/sdp_add_zone.3commputil
+usr/src/man/man3commputil/sdp_delete_all_media_field.3commputil
+usr/src/man/man3commputil/sdp_delete_attribute.3commputil
+usr/src/man/man3commputil/sdp_free_session.3commputil
+usr/src/man/man3contract/ct_ctl_abandon.3contract
+usr/src/man/man3contract/ct_ctl_ack.3contract
+usr/src/man/man3contract/ct_ctl_nack.3contract
+usr/src/man/man3contract/ct_ctl_newct.3contract
+usr/src/man/man3contract/ct_ctl_qack.3contract
+usr/src/man/man3contract/ct_dev_status_get_aset.3contract
+usr/src/man/man3contract/ct_dev_status_get_minor.3contract
+usr/src/man/man3contract/ct_dev_status_get_noneg.3contract
+usr/src/man/man3contract/ct_dev_tmpl_clear_noneg.3contract
+usr/src/man/man3contract/ct_dev_tmpl_get_aset.3contract
+usr/src/man/man3contract/ct_dev_tmpl_get_minor.3contract
+usr/src/man/man3contract/ct_dev_tmpl_get_noneg.3contract
+usr/src/man/man3contract/ct_dev_tmpl_set_minor.3contract
+usr/src/man/man3contract/ct_dev_tmpl_set_noneg.3contract
+usr/src/man/man3contract/ct_event_free.3contract
+usr/src/man/man3contract/ct_event_get_ctid.3contract
+usr/src/man/man3contract/ct_event_get_evid.3contract
+usr/src/man/man3contract/ct_event_get_flags.3contract
+usr/src/man/man3contract/ct_event_get_nevid.3contract
+usr/src/man/man3contract/ct_event_get_newct.3contract
+usr/src/man/man3contract/ct_event_get_type.3contract
+usr/src/man/man3contract/ct_event_read_critical.3contract
+usr/src/man/man3contract/ct_event_reliable.3contract
+usr/src/man/man3contract/ct_event_reset.3contract
+usr/src/man/man3contract/ct_pr_event_get_exitstatus.3contract
+usr/src/man/man3contract/ct_pr_event_get_gcorefile.3contract
+usr/src/man/man3contract/ct_pr_event_get_pcorefile.3contract
+usr/src/man/man3contract/ct_pr_event_get_ppid.3contract
+usr/src/man/man3contract/ct_pr_event_get_sender.3contract
+usr/src/man/man3contract/ct_pr_event_get_senderct.3contract
+usr/src/man/man3contract/ct_pr_event_get_signal.3contract
+usr/src/man/man3contract/ct_pr_event_get_zcorefile.3contract
+usr/src/man/man3contract/ct_pr_status_get_contracts.3contract
+usr/src/man/man3contract/ct_pr_status_get_fatal.3contract
+usr/src/man/man3contract/ct_pr_status_get_members.3contract
+usr/src/man/man3contract/ct_pr_status_get_svc_aux.3contract
+usr/src/man/man3contract/ct_pr_status_get_svc_creator.3contract
+usr/src/man/man3contract/ct_pr_status_get_svc_ctid.3contract
+usr/src/man/man3contract/ct_pr_status_get_svc_fmri.3contract
+usr/src/man/man3contract/ct_pr_tmpl_get_fatal.3contract
+usr/src/man/man3contract/ct_pr_tmpl_get_param.3contract
+usr/src/man/man3contract/ct_pr_tmpl_get_svc_aux.3contract
+usr/src/man/man3contract/ct_pr_tmpl_get_svc_fmri.3contract
+usr/src/man/man3contract/ct_pr_tmpl_get_transfer.3contract
+usr/src/man/man3contract/ct_pr_tmpl_set_fatal.3contract
+usr/src/man/man3contract/ct_pr_tmpl_set_param.3contract
+usr/src/man/man3contract/ct_pr_tmpl_set_svc_aux.3contract
+usr/src/man/man3contract/ct_pr_tmpl_set_svc_fmri.3contract
+usr/src/man/man3contract/ct_status_free.3contract
+usr/src/man/man3contract/ct_status_get_cookie.3contract
+usr/src/man/man3contract/ct_status_get_critical.3contract
+usr/src/man/man3contract/ct_status_get_holder.3contract
+usr/src/man/man3contract/ct_status_get_id.3contract
+usr/src/man/man3contract/ct_status_get_informative.3contract
+usr/src/man/man3contract/ct_status_get_nevents.3contract
+usr/src/man/man3contract/ct_status_get_nevid.3contract
+usr/src/man/man3contract/ct_status_get_ntime.3contract
+usr/src/man/man3contract/ct_status_get_qtime.3contract
+usr/src/man/man3contract/ct_status_get_state.3contract
+usr/src/man/man3contract/ct_status_get_type.3contract
+usr/src/man/man3contract/ct_status_get_zoneid.3contract
+usr/src/man/man3contract/ct_tmpl_clear.3contract
+usr/src/man/man3contract/ct_tmpl_create.3contract
+usr/src/man/man3contract/ct_tmpl_get_cookie.3contract
+usr/src/man/man3contract/ct_tmpl_get_critical.3contract
+usr/src/man/man3contract/ct_tmpl_get_informative.3contract
+usr/src/man/man3contract/ct_tmpl_set_cookie.3contract
+usr/src/man/man3contract/ct_tmpl_set_critical.3contract
+usr/src/man/man3contract/ct_tmpl_set_informative.3contract
+usr/src/man/man3cpc/cpc_bind_cpu.3cpc
+usr/src/man/man3cpc/cpc_bind_pctx.3cpc
+usr/src/man/man3cpc/cpc_buf_add.3cpc
+usr/src/man/man3cpc/cpc_buf_copy.3cpc
+usr/src/man/man3cpc/cpc_buf_destroy.3cpc
+usr/src/man/man3cpc/cpc_buf_get.3cpc
+usr/src/man/man3cpc/cpc_buf_hrtime.3cpc
+usr/src/man/man3cpc/cpc_buf_set.3cpc
+usr/src/man/man3cpc/cpc_buf_sub.3cpc
+usr/src/man/man3cpc/cpc_buf_tick.3cpc
+usr/src/man/man3cpc/cpc_buf_zero.3cpc
+usr/src/man/man3cpc/cpc_caps.3cpc
+usr/src/man/man3cpc/cpc_cciname.3cpc
+usr/src/man/man3cpc/cpc_close.3cpc
+usr/src/man/man3cpc/cpc_count_sys_events.3cpc
+usr/src/man/man3cpc/cpc_cpuref.3cpc
+usr/src/man/man3cpc/cpc_disable.3cpc
+usr/src/man/man3cpc/cpc_event_accum.3cpc
+usr/src/man/man3cpc/cpc_eventtostr.3cpc
+usr/src/man/man3cpc/cpc_getcciname.3cpc
+usr/src/man/man3cpc/cpc_getcpuref.3cpc
+usr/src/man/man3cpc/cpc_getnpic.3cpc
+usr/src/man/man3cpc/cpc_getusage.3cpc
+usr/src/man/man3cpc/cpc_pctx_invalidate.3cpc
+usr/src/man/man3cpc/cpc_pctx_rele.3cpc
+usr/src/man/man3cpc/cpc_pctx_take_sample.3cpc
+usr/src/man/man3cpc/cpc_rele.3cpc
+usr/src/man/man3cpc/cpc_request_preset.3cpc
+usr/src/man/man3cpc/cpc_set_add_request.3cpc
+usr/src/man/man3cpc/cpc_set_destroy.3cpc
+usr/src/man/man3cpc/cpc_set_restart.3cpc
+usr/src/man/man3cpc/cpc_set_sample.3cpc
+usr/src/man/man3cpc/cpc_shared_bind_event.3cpc
+usr/src/man/man3cpc/cpc_shared_close.3cpc
+usr/src/man/man3cpc/cpc_shared_rele.3cpc
+usr/src/man/man3cpc/cpc_shared_take_sample.3cpc
+usr/src/man/man3cpc/cpc_take_sample.3cpc
+usr/src/man/man3cpc/cpc_unbind.3cpc
+usr/src/man/man3cpc/cpc_walk_attrs.3cpc
+usr/src/man/man3cpc/cpc_walk_events_all.3cpc
+usr/src/man/man3cpc/cpc_walk_events_pic.3cpc
+usr/src/man/man3cpc/cpc_walk_generic_events_all.3cpc
+usr/src/man/man3cpc/cpc_walk_generic_events_pic.3cpc
+usr/src/man/man3cpc/cpc_walk_names.3cpc
+usr/src/man/man3cpc/cpc_walk_requests.3cpc
+usr/src/man/man3cpc/pctx_create.3cpc
+usr/src/man/man3cpc/pctx_release.3cpc
+usr/src/man/man3cpc/pctx_run.3cpc
+usr/src/man/man3curses/addch.3curses
+usr/src/man/man3curses/addchnstr.3curses
+usr/src/man/man3curses/addchstr.3curses
+usr/src/man/man3curses/addnstr.3curses
+usr/src/man/man3curses/addnwstr.3curses
+usr/src/man/man3curses/addstr.3curses
+usr/src/man/man3curses/addwch.3curses
+usr/src/man/man3curses/addwchnstr.3curses
+usr/src/man/man3curses/addwchstr.3curses
+usr/src/man/man3curses/addwstr.3curses
+usr/src/man/man3curses/adjcurspos.3curses
+usr/src/man/man3curses/attroff.3curses
+usr/src/man/man3curses/attron.3curses
+usr/src/man/man3curses/attrset.3curses
+usr/src/man/man3curses/baudrate.3curses
+usr/src/man/man3curses/beep.3curses
+usr/src/man/man3curses/bkgd.3curses
+usr/src/man/man3curses/bkgdset.3curses
+usr/src/man/man3curses/border.3curses
+usr/src/man/man3curses/bottom_panel.3curses
+usr/src/man/man3curses/box.3curses
+usr/src/man/man3curses/can_change_color.3curses
+usr/src/man/man3curses/cbreak.3curses
+usr/src/man/man3curses/clear.3curses
+usr/src/man/man3curses/clearok.3curses
+usr/src/man/man3curses/clrtobot.3curses
+usr/src/man/man3curses/clrtoeol.3curses
+usr/src/man/man3curses/color_content.3curses
+usr/src/man/man3curses/copywin.3curses
+usr/src/man/man3curses/current_field.3curses
+usr/src/man/man3curses/current_item.3curses
+usr/src/man/man3curses/curs_set.3curses
+usr/src/man/man3curses/data_ahead.3curses
+usr/src/man/man3curses/data_behind.3curses
+usr/src/man/man3curses/def_prog_mode.3curses
+usr/src/man/man3curses/def_shell_mode.3curses
+usr/src/man/man3curses/del_curterm.3curses
+usr/src/man/man3curses/del_panel.3curses
+usr/src/man/man3curses/delay_output.3curses
+usr/src/man/man3curses/delch.3curses
+usr/src/man/man3curses/deleteln.3curses
+usr/src/man/man3curses/delscreen.3curses
+usr/src/man/man3curses/delwin.3curses
+usr/src/man/man3curses/derwin.3curses
+usr/src/man/man3curses/doupdate.3curses
+usr/src/man/man3curses/dup_field.3curses
+usr/src/man/man3curses/dupwin.3curses
+usr/src/man/man3curses/dynamic_field_info.3curses
+usr/src/man/man3curses/echo.3curses
+usr/src/man/man3curses/echochar.3curses
+usr/src/man/man3curses/echowchar.3curses
+usr/src/man/man3curses/endwin.3curses
+usr/src/man/man3curses/erase.3curses
+usr/src/man/man3curses/erasechar.3curses
+usr/src/man/man3curses/field_arg.3curses
+usr/src/man/man3curses/field_back.3curses
+usr/src/man/man3curses/field_buffer.3curses
+usr/src/man/man3curses/field_count.3curses
+usr/src/man/man3curses/field_fore.3curses
+usr/src/man/man3curses/field_index.3curses
+usr/src/man/man3curses/field_info.3curses
+usr/src/man/man3curses/field_init.3curses
+usr/src/man/man3curses/field_just.3curses
+usr/src/man/man3curses/field_opts.3curses
+usr/src/man/man3curses/field_opts_off.3curses
+usr/src/man/man3curses/field_opts_on.3curses
+usr/src/man/man3curses/field_pad.3curses
+usr/src/man/man3curses/field_status.3curses
+usr/src/man/man3curses/field_term.3curses
+usr/src/man/man3curses/field_type.3curses
+usr/src/man/man3curses/field_userptr.3curses
+usr/src/man/man3curses/filter.3curses
+usr/src/man/man3curses/flash.3curses
+usr/src/man/man3curses/flushinp.3curses
+usr/src/man/man3curses/form_fields.3curses
+usr/src/man/man3curses/form_init.3curses
+usr/src/man/man3curses/form_opts_off.3curses
+usr/src/man/man3curses/form_opts_on.3curses
+usr/src/man/man3curses/form_sub.3curses
+usr/src/man/man3curses/form_term.3curses
+usr/src/man/man3curses/free_field.3curses
+usr/src/man/man3curses/free_fieldtype.3curses
+usr/src/man/man3curses/free_form.3curses
+usr/src/man/man3curses/free_item.3curses
+usr/src/man/man3curses/free_menu.3curses
+usr/src/man/man3curses/getbegyx.3curses
+usr/src/man/man3curses/getch.3curses
+usr/src/man/man3curses/getmaxyx.3curses
+usr/src/man/man3curses/getnwstr.3curses
+usr/src/man/man3curses/getparyx.3curses
+usr/src/man/man3curses/getstr.3curses
+usr/src/man/man3curses/getsyx.3curses
+usr/src/man/man3curses/getwch.3curses
+usr/src/man/man3curses/getwin.3curses
+usr/src/man/man3curses/getwstr.3curses
+usr/src/man/man3curses/getyx.3curses
+usr/src/man/man3curses/halfdelay.3curses
+usr/src/man/man3curses/has_colors.3curses
+usr/src/man/man3curses/has_ic.3curses
+usr/src/man/man3curses/has_il.3curses
+usr/src/man/man3curses/hide_panel.3curses
+usr/src/man/man3curses/idcok.3curses
+usr/src/man/man3curses/idlok.3curses
+usr/src/man/man3curses/immedok.3curses
+usr/src/man/man3curses/inch.3curses
+usr/src/man/man3curses/inchnstr.3curses
+usr/src/man/man3curses/inchstr.3curses
+usr/src/man/man3curses/init_color.3curses
+usr/src/man/man3curses/init_pair.3curses
+usr/src/man/man3curses/initscr.3curses
+usr/src/man/man3curses/innstr.3curses
+usr/src/man/man3curses/innwstr.3curses
+usr/src/man/man3curses/insch.3curses
+usr/src/man/man3curses/insdelln.3curses
+usr/src/man/man3curses/insertln.3curses
+usr/src/man/man3curses/insnstr.3curses
+usr/src/man/man3curses/insnwstr.3curses
+usr/src/man/man3curses/insstr.3curses
+usr/src/man/man3curses/instr.3curses
+usr/src/man/man3curses/inswch.3curses
+usr/src/man/man3curses/inswstr.3curses
+usr/src/man/man3curses/intrflush.3curses
+usr/src/man/man3curses/inwch.3curses
+usr/src/man/man3curses/inwchnstr.3curses
+usr/src/man/man3curses/inwchstr.3curses
+usr/src/man/man3curses/inwstr.3curses
+usr/src/man/man3curses/is_linetouched.3curses
+usr/src/man/man3curses/is_wintouched.3curses
+usr/src/man/man3curses/isendwin.3curses
+usr/src/man/man3curses/item_count.3curses
+usr/src/man/man3curses/item_description.3curses
+usr/src/man/man3curses/item_index.3curses
+usr/src/man/man3curses/item_init.3curses
+usr/src/man/man3curses/item_name.3curses
+usr/src/man/man3curses/item_opts.3curses
+usr/src/man/man3curses/item_opts_off.3curses
+usr/src/man/man3curses/item_opts_on.3curses
+usr/src/man/man3curses/item_term.3curses
+usr/src/man/man3curses/item_userptr.3curses
+usr/src/man/man3curses/item_value.3curses
+usr/src/man/man3curses/item_visible.3curses
+usr/src/man/man3curses/keyname.3curses
+usr/src/man/man3curses/keypad.3curses
+usr/src/man/man3curses/killchar.3curses
+usr/src/man/man3curses/leaveok.3curses
+usr/src/man/man3curses/link_field.3curses
+usr/src/man/man3curses/link_fieldtype.3curses
+usr/src/man/man3curses/longname.3curses
+usr/src/man/man3curses/menu_back.3curses
+usr/src/man/man3curses/menu_fore.3curses
+usr/src/man/man3curses/menu_grey.3curses
+usr/src/man/man3curses/menu_init.3curses
+usr/src/man/man3curses/menu_opts_off.3curses
+usr/src/man/man3curses/menu_opts_on.3curses
+usr/src/man/man3curses/menu_pad.3curses
+usr/src/man/man3curses/menu_sub.3curses
+usr/src/man/man3curses/menu_term.3curses
+usr/src/man/man3curses/meta.3curses
+usr/src/man/man3curses/move.3curses
+usr/src/man/man3curses/move_field.3curses
+usr/src/man/man3curses/move_panel.3curses
+usr/src/man/man3curses/movenextch.3curses
+usr/src/man/man3curses/moveprevch.3curses
+usr/src/man/man3curses/mvaddch.3curses
+usr/src/man/man3curses/mvaddchnstr.3curses
+usr/src/man/man3curses/mvaddchstr.3curses
+usr/src/man/man3curses/mvaddnstr.3curses
+usr/src/man/man3curses/mvaddnwstr.3curses
+usr/src/man/man3curses/mvaddstr.3curses
+usr/src/man/man3curses/mvaddwch.3curses
+usr/src/man/man3curses/mvaddwchnstr.3curses
+usr/src/man/man3curses/mvaddwchstr.3curses
+usr/src/man/man3curses/mvaddwstr.3curses
+usr/src/man/man3curses/mvcur.3curses
+usr/src/man/man3curses/mvdelch.3curses
+usr/src/man/man3curses/mvderwin.3curses
+usr/src/man/man3curses/mvgetch.3curses
+usr/src/man/man3curses/mvgetnwstr.3curses
+usr/src/man/man3curses/mvgetstr.3curses
+usr/src/man/man3curses/mvgetwch.3curses
+usr/src/man/man3curses/mvgetwstr.3curses
+usr/src/man/man3curses/mvinch.3curses
+usr/src/man/man3curses/mvinchnstr.3curses
+usr/src/man/man3curses/mvinchstr.3curses
+usr/src/man/man3curses/mvinnstr.3curses
+usr/src/man/man3curses/mvinnwstr.3curses
+usr/src/man/man3curses/mvinsch.3curses
+usr/src/man/man3curses/mvinsnstr.3curses
+usr/src/man/man3curses/mvinsnwstr.3curses
+usr/src/man/man3curses/mvinsstr.3curses
+usr/src/man/man3curses/mvinstr.3curses
+usr/src/man/man3curses/mvinswch.3curses
+usr/src/man/man3curses/mvinswstr.3curses
+usr/src/man/man3curses/mvinwch.3curses
+usr/src/man/man3curses/mvinwchnstr.3curses
+usr/src/man/man3curses/mvinwchstr.3curses
+usr/src/man/man3curses/mvinwstr.3curses
+usr/src/man/man3curses/mvprintw.3curses
+usr/src/man/man3curses/mvscanw.3curses
+usr/src/man/man3curses/mvwaddch.3curses
+usr/src/man/man3curses/mvwaddchnstr.3curses
+usr/src/man/man3curses/mvwaddchstr.3curses
+usr/src/man/man3curses/mvwaddnstr.3curses
+usr/src/man/man3curses/mvwaddnwstr.3curses
+usr/src/man/man3curses/mvwaddstr.3curses
+usr/src/man/man3curses/mvwaddwch.3curses
+usr/src/man/man3curses/mvwaddwchnstr.3curses
+usr/src/man/man3curses/mvwaddwchstr.3curses
+usr/src/man/man3curses/mvwaddwstr.3curses
+usr/src/man/man3curses/mvwdelch.3curses
+usr/src/man/man3curses/mvwgetch.3curses
+usr/src/man/man3curses/mvwgetnwstr.3curses
+usr/src/man/man3curses/mvwgetstr.3curses
+usr/src/man/man3curses/mvwgetwch.3curses
+usr/src/man/man3curses/mvwgetwstr.3curses
+usr/src/man/man3curses/mvwin.3curses
+usr/src/man/man3curses/mvwinch.3curses
+usr/src/man/man3curses/mvwinchnstr.3curses
+usr/src/man/man3curses/mvwinchstr.3curses
+usr/src/man/man3curses/mvwinnstr.3curses
+usr/src/man/man3curses/mvwinnwstr.3curses
+usr/src/man/man3curses/mvwinsch.3curses
+usr/src/man/man3curses/mvwinsnstr.3curses
+usr/src/man/man3curses/mvwinsnwstr.3curses
+usr/src/man/man3curses/mvwinsstr.3curses
+usr/src/man/man3curses/mvwinstr.3curses
+usr/src/man/man3curses/mvwinswch.3curses
+usr/src/man/man3curses/mvwinswstr.3curses
+usr/src/man/man3curses/mvwinwch.3curses
+usr/src/man/man3curses/mvwinwchnstr.3curses
+usr/src/man/man3curses/mvwinwchstr.3curses
+usr/src/man/man3curses/mvwinwstr.3curses
+usr/src/man/man3curses/mvwprintw.3curses
+usr/src/man/man3curses/mvwscanw.3curses
+usr/src/man/man3curses/napms.3curses
+usr/src/man/man3curses/new_field.3curses
+usr/src/man/man3curses/new_fieldtype.3curses
+usr/src/man/man3curses/new_form.3curses
+usr/src/man/man3curses/new_item.3curses
+usr/src/man/man3curses/new_menu.3curses
+usr/src/man/man3curses/new_page.3curses
+usr/src/man/man3curses/new_panel.3curses
+usr/src/man/man3curses/newpad.3curses
+usr/src/man/man3curses/newterm.3curses
+usr/src/man/man3curses/newwin.3curses
+usr/src/man/man3curses/nl.3curses
+usr/src/man/man3curses/nocbreak.3curses
+usr/src/man/man3curses/nodelay.3curses
+usr/src/man/man3curses/noecho.3curses
+usr/src/man/man3curses/nonl.3curses
+usr/src/man/man3curses/noqiflush.3curses
+usr/src/man/man3curses/noraw.3curses
+usr/src/man/man3curses/notimeout.3curses
+usr/src/man/man3curses/overlay.3curses
+usr/src/man/man3curses/overwrite.3curses
+usr/src/man/man3curses/pair_content.3curses
+usr/src/man/man3curses/panel_below.3curses
+usr/src/man/man3curses/panel_hidden.3curses
+usr/src/man/man3curses/pechochar.3curses
+usr/src/man/man3curses/pechowchar.3curses
+usr/src/man/man3curses/pnoutrefresh.3curses
+usr/src/man/man3curses/pos_form_cursor.3curses
+usr/src/man/man3curses/pos_menu_cursor.3curses
+usr/src/man/man3curses/post_form.3curses
+usr/src/man/man3curses/post_menu.3curses
+usr/src/man/man3curses/prefresh.3curses
+usr/src/man/man3curses/printw.3curses
+usr/src/man/man3curses/putp.3curses
+usr/src/man/man3curses/putwin.3curses
+usr/src/man/man3curses/qiflush.3curses
+usr/src/man/man3curses/raw.3curses
+usr/src/man/man3curses/redrawwin.3curses
+usr/src/man/man3curses/refresh.3curses
+usr/src/man/man3curses/replace_panel.3curses
+usr/src/man/man3curses/reset_prog_mode.3curses
+usr/src/man/man3curses/reset_shell_mode.3curses
+usr/src/man/man3curses/resetty.3curses
+usr/src/man/man3curses/restartterm.3curses
+usr/src/man/man3curses/ripoffline.3curses
+usr/src/man/man3curses/savetty.3curses
+usr/src/man/man3curses/scale_form.3curses
+usr/src/man/man3curses/scale_menu.3curses
+usr/src/man/man3curses/scanw.3curses
+usr/src/man/man3curses/scr_dump.3curses
+usr/src/man/man3curses/scr_init.3curses
+usr/src/man/man3curses/scr_restore.3curses
+usr/src/man/man3curses/scr_set.3curses
+usr/src/man/man3curses/scrl.3curses
+usr/src/man/man3curses/scroll.3curses
+usr/src/man/man3curses/scrollok.3curses
+usr/src/man/man3curses/set_current_field.3curses
+usr/src/man/man3curses/set_current_item.3curses
+usr/src/man/man3curses/set_curterm.3curses
+usr/src/man/man3curses/set_field_back.3curses
+usr/src/man/man3curses/set_field_buffer.3curses
+usr/src/man/man3curses/set_field_fore.3curses
+usr/src/man/man3curses/set_field_init.3curses
+usr/src/man/man3curses/set_field_just.3curses
+usr/src/man/man3curses/set_field_opts.3curses
+usr/src/man/man3curses/set_field_pad.3curses
+usr/src/man/man3curses/set_field_status.3curses
+usr/src/man/man3curses/set_field_term.3curses
+usr/src/man/man3curses/set_field_type.3curses
+usr/src/man/man3curses/set_field_userptr.3curses
+usr/src/man/man3curses/set_fieldtype_arg.3curses
+usr/src/man/man3curses/set_fieldtype_choice.3curses
+usr/src/man/man3curses/set_form_fields.3curses
+usr/src/man/man3curses/set_form_init.3curses
+usr/src/man/man3curses/set_form_opts.3curses
+usr/src/man/man3curses/set_form_page.3curses
+usr/src/man/man3curses/set_form_sub.3curses
+usr/src/man/man3curses/set_form_term.3curses
+usr/src/man/man3curses/set_form_userptr.3curses
+usr/src/man/man3curses/set_form_win.3curses
+usr/src/man/man3curses/set_item_init.3curses
+usr/src/man/man3curses/set_item_opts.3curses
+usr/src/man/man3curses/set_item_term.3curses
+usr/src/man/man3curses/set_item_userptr.3curses
+usr/src/man/man3curses/set_item_value.3curses
+usr/src/man/man3curses/set_max_field.3curses
+usr/src/man/man3curses/set_menu_back.3curses
+usr/src/man/man3curses/set_menu_fore.3curses
+usr/src/man/man3curses/set_menu_format.3curses
+usr/src/man/man3curses/set_menu_grey.3curses
+usr/src/man/man3curses/set_menu_init.3curses
+usr/src/man/man3curses/set_menu_items.3curses
+usr/src/man/man3curses/set_menu_mark.3curses
+usr/src/man/man3curses/set_menu_opts.3curses
+usr/src/man/man3curses/set_menu_pad.3curses
+usr/src/man/man3curses/set_menu_pattern.3curses
+usr/src/man/man3curses/set_menu_sub.3curses
+usr/src/man/man3curses/set_menu_term.3curses
+usr/src/man/man3curses/set_menu_userptr.3curses
+usr/src/man/man3curses/set_menu_win.3curses
+usr/src/man/man3curses/set_new_page.3curses
+usr/src/man/man3curses/set_panel_userptr.3curses
+usr/src/man/man3curses/set_term.3curses
+usr/src/man/man3curses/set_top_row.3curses
+usr/src/man/man3curses/setscrreg.3curses
+usr/src/man/man3curses/setsyx.3curses
+usr/src/man/man3curses/setterm.3curses
+usr/src/man/man3curses/setupterm.3curses
+usr/src/man/man3curses/show_panel.3curses
+usr/src/man/man3curses/slk_attroff.3curses
+usr/src/man/man3curses/slk_attron.3curses
+usr/src/man/man3curses/slk_attrset.3curses
+usr/src/man/man3curses/slk_clear.3curses
+usr/src/man/man3curses/slk_init.3curses
+usr/src/man/man3curses/slk_label.3curses
+usr/src/man/man3curses/slk_noutrefresh.3curses
+usr/src/man/man3curses/slk_refresh.3curses
+usr/src/man/man3curses/slk_restore.3curses
+usr/src/man/man3curses/slk_set.3curses
+usr/src/man/man3curses/slk_touch.3curses
+usr/src/man/man3curses/standend.3curses
+usr/src/man/man3curses/standout.3curses
+usr/src/man/man3curses/start_color.3curses
+usr/src/man/man3curses/subpad.3curses
+usr/src/man/man3curses/subwin.3curses
+usr/src/man/man3curses/syncok.3curses
+usr/src/man/man3curses/termattrs.3curses
+usr/src/man/man3curses/termname.3curses
+usr/src/man/man3curses/tgetent.3curses
+usr/src/man/man3curses/tgetflag.3curses
+usr/src/man/man3curses/tgetnum.3curses
+usr/src/man/man3curses/tgetstr.3curses
+usr/src/man/man3curses/tgoto.3curses
+usr/src/man/man3curses/tigetflag.3curses
+usr/src/man/man3curses/tigetnum.3curses
+usr/src/man/man3curses/tigetstr.3curses
+usr/src/man/man3curses/timeout.3curses
+usr/src/man/man3curses/top_panel.3curses
+usr/src/man/man3curses/top_row.3curses
+usr/src/man/man3curses/touchline.3curses
+usr/src/man/man3curses/touchwin.3curses
+usr/src/man/man3curses/tparm.3curses
+usr/src/man/man3curses/tputs.3curses
+usr/src/man/man3curses/typeahead.3curses
+usr/src/man/man3curses/unctrl.3curses
+usr/src/man/man3curses/ungetch.3curses
+usr/src/man/man3curses/ungetwch.3curses
+usr/src/man/man3curses/unpost_form.3curses
+usr/src/man/man3curses/unpost_menu.3curses
+usr/src/man/man3curses/untouchwin.3curses
+usr/src/man/man3curses/update_panels.3curses
+usr/src/man/man3curses/use_env.3curses
+usr/src/man/man3curses/vidattr.3curses
+usr/src/man/man3curses/vidputs.3curses
+usr/src/man/man3curses/vwprintw.3curses
+usr/src/man/man3curses/vwscanw.3curses
+usr/src/man/man3curses/waddch.3curses
+usr/src/man/man3curses/waddchnstr.3curses
+usr/src/man/man3curses/waddchstr.3curses
+usr/src/man/man3curses/waddnstr.3curses
+usr/src/man/man3curses/waddnwstr.3curses
+usr/src/man/man3curses/waddstr.3curses
+usr/src/man/man3curses/waddwch.3curses
+usr/src/man/man3curses/waddwchnstr.3curses
+usr/src/man/man3curses/waddwchstr.3curses
+usr/src/man/man3curses/waddwstr.3curses
+usr/src/man/man3curses/wadjcurspos.3curses
+usr/src/man/man3curses/wattroff.3curses
+usr/src/man/man3curses/wattron.3curses
+usr/src/man/man3curses/wattrset.3curses
+usr/src/man/man3curses/wbkgd.3curses
+usr/src/man/man3curses/wbkgdset.3curses
+usr/src/man/man3curses/wborder.3curses
+usr/src/man/man3curses/wclear.3curses
+usr/src/man/man3curses/wclrtobot.3curses
+usr/src/man/man3curses/wclrtoeol.3curses
+usr/src/man/man3curses/wcursyncup.3curses
+usr/src/man/man3curses/wdelch.3curses
+usr/src/man/man3curses/wdeleteln.3curses
+usr/src/man/man3curses/wechochar.3curses
+usr/src/man/man3curses/wechowchar.3curses
+usr/src/man/man3curses/werase.3curses
+usr/src/man/man3curses/wgetch.3curses
+usr/src/man/man3curses/wgetnstr.3curses
+usr/src/man/man3curses/wgetnwstr.3curses
+usr/src/man/man3curses/wgetstr.3curses
+usr/src/man/man3curses/wgetwch.3curses
+usr/src/man/man3curses/wgetwstr.3curses
+usr/src/man/man3curses/whline.3curses
+usr/src/man/man3curses/winch.3curses
+usr/src/man/man3curses/winchnstr.3curses
+usr/src/man/man3curses/winchstr.3curses
+usr/src/man/man3curses/winnstr.3curses
+usr/src/man/man3curses/winnwstr.3curses
+usr/src/man/man3curses/winsch.3curses
+usr/src/man/man3curses/winsdelln.3curses
+usr/src/man/man3curses/winsertln.3curses
+usr/src/man/man3curses/winsnstr.3curses
+usr/src/man/man3curses/winsnwstr.3curses
+usr/src/man/man3curses/winsstr.3curses
+usr/src/man/man3curses/winstr.3curses
+usr/src/man/man3curses/winswch.3curses
+usr/src/man/man3curses/winswstr.3curses
+usr/src/man/man3curses/winwch.3curses
+usr/src/man/man3curses/winwchnstr.3curses
+usr/src/man/man3curses/winwchstr.3curses
+usr/src/man/man3curses/winwstr.3curses
+usr/src/man/man3curses/wmove.3curses
+usr/src/man/man3curses/wmovenextch.3curses
+usr/src/man/man3curses/wmoveprevch.3curses
+usr/src/man/man3curses/wnoutrefresh.3curses
+usr/src/man/man3curses/wprintw.3curses
+usr/src/man/man3curses/wredrawln.3curses
+usr/src/man/man3curses/wrefresh.3curses
+usr/src/man/man3curses/wscanw.3curses
+usr/src/man/man3curses/wscrl.3curses
+usr/src/man/man3curses/wsetscrreg.3curses
+usr/src/man/man3curses/wstandend.3curses
+usr/src/man/man3curses/wstandout.3curses
+usr/src/man/man3curses/wsyncdown.3curses
+usr/src/man/man3curses/wsyncup.3curses
+usr/src/man/man3curses/wtimeout.3curses
+usr/src/man/man3curses/wtouchln.3curses
+usr/src/man/man3curses/wvline.3curses
+usr/src/man/man3devid/devid_compare.3devid
+usr/src/man/man3devid/devid_deviceid_to_nmlist.3devid
+usr/src/man/man3devid/devid_free.3devid
+usr/src/man/man3devid/devid_free_nmlist.3devid
+usr/src/man/man3devid/devid_get_minor_name.3devid
+usr/src/man/man3devid/devid_sizeof.3devid
+usr/src/man/man3devid/devid_str_decode.3devid
+usr/src/man/man3devid/devid_str_encode.3devid
+usr/src/man/man3devid/devid_str_free.3devid
+usr/src/man/man3devid/devid_valid.3devid
+usr/src/man/man3devinfo/di_bus_addr.3devinfo
+usr/src/man/man3devinfo/di_compatible_names.3devinfo
+usr/src/man/man3devinfo/di_devfs_minor_path.3devinfo
+usr/src/man/man3devinfo/di_devfs_path_free.3devinfo
+usr/src/man/man3devinfo/di_devid.3devinfo
+usr/src/man/man3devinfo/di_devlink_content.3devinfo
+usr/src/man/man3devinfo/di_devlink_fini.3devinfo
+usr/src/man/man3devinfo/di_devlink_free.3devinfo
+usr/src/man/man3devinfo/di_devlink_type.3devinfo
+usr/src/man/man3devinfo/di_driver_major.3devinfo
+usr/src/man/man3devinfo/di_driver_name.3devinfo
+usr/src/man/man3devinfo/di_driver_ops.3devinfo
+usr/src/man/man3devinfo/di_drv_first_node.3devinfo
+usr/src/man/man3devinfo/di_drv_next_node.3devinfo
+usr/src/man/man3devinfo/di_fini.3devinfo
+usr/src/man/man3devinfo/di_instance.3devinfo
+usr/src/man/man3devinfo/di_link_next_by_lnode.3devinfo
+usr/src/man/man3devinfo/di_link_private_get.3devinfo
+usr/src/man/man3devinfo/di_link_private_set.3devinfo
+usr/src/man/man3devinfo/di_link_to_lnode.3devinfo
+usr/src/man/man3devinfo/di_lnode_devinfo.3devinfo
+usr/src/man/man3devinfo/di_lnode_devt.3devinfo
+usr/src/man/man3devinfo/di_lnode_private_get.3devinfo
+usr/src/man/man3devinfo/di_lnode_private_set.3devinfo
+usr/src/man/man3devinfo/di_minor_name.3devinfo
+usr/src/man/man3devinfo/di_minor_nodetype.3devinfo
+usr/src/man/man3devinfo/di_minor_private_get.3devinfo
+usr/src/man/man3devinfo/di_minor_private_set.3devinfo
+usr/src/man/man3devinfo/di_minor_spectype.3devinfo
+usr/src/man/man3devinfo/di_node_name.3devinfo
+usr/src/man/man3devinfo/di_node_private_get.3devinfo
+usr/src/man/man3devinfo/di_nodeid.3devinfo
+usr/src/man/man3devinfo/di_parent_node.3devinfo
+usr/src/man/man3devinfo/di_path_client_devfs_path.3devinfo
+usr/src/man/man3devinfo/di_path_client_node.3devinfo
+usr/src/man/man3devinfo/di_path_devfs_path.3devinfo
+usr/src/man/man3devinfo/di_path_instance.3devinfo
+usr/src/man/man3devinfo/di_path_node_name.3devinfo
+usr/src/man/man3devinfo/di_path_phci_next_path.3devinfo
+usr/src/man/man3devinfo/di_path_phci_node.3devinfo
+usr/src/man/man3devinfo/di_path_private_get.3devinfo
+usr/src/man/man3devinfo/di_path_private_set.3devinfo
+usr/src/man/man3devinfo/di_path_prop_int64s.3devinfo
+usr/src/man/man3devinfo/di_path_prop_ints.3devinfo
+usr/src/man/man3devinfo/di_path_prop_lookup_int64s.3devinfo
+usr/src/man/man3devinfo/di_path_prop_lookup_ints.3devinfo
+usr/src/man/man3devinfo/di_path_prop_lookup_strings.3devinfo
+usr/src/man/man3devinfo/di_path_prop_name.3devinfo
+usr/src/man/man3devinfo/di_path_prop_strings.3devinfo
+usr/src/man/man3devinfo/di_path_prop_type.3devinfo
+usr/src/man/man3devinfo/di_path_state.3devinfo
+usr/src/man/man3devinfo/di_prom_fini.3devinfo
+usr/src/man/man3devinfo/di_prom_prop_lookup_ints.3devinfo
+usr/src/man/man3devinfo/di_prom_prop_lookup_strings.3devinfo
+usr/src/man/man3devinfo/di_prom_prop_name.3devinfo
+usr/src/man/man3devinfo/di_prom_prop_next.3devinfo
+usr/src/man/man3devinfo/di_prop_devt.3devinfo
+usr/src/man/man3devinfo/di_prop_int64.3devinfo
+usr/src/man/man3devinfo/di_prop_ints.3devinfo
+usr/src/man/man3devinfo/di_prop_lookup_int64.3devinfo
+usr/src/man/man3devinfo/di_prop_lookup_ints.3devinfo
+usr/src/man/man3devinfo/di_prop_lookup_strings.3devinfo
+usr/src/man/man3devinfo/di_prop_name.3devinfo
+usr/src/man/man3devinfo/di_prop_strings.3devinfo
+usr/src/man/man3devinfo/di_prop_type.3devinfo
+usr/src/man/man3devinfo/di_sibling_node.3devinfo
+usr/src/man/man3dlpi/dlpi_disabmulti.3dlpi
+usr/src/man/man3dlpi/dlpi_promiscoff.3dlpi
+usr/src/man/man3dns_sd/DNSServiceAddRecord.3dns_sd
+usr/src/man/man3dns_sd/DNSServiceRegisterRecord.3dns_sd
+usr/src/man/man3dns_sd/DNSServiceRemoveRecord.3dns_sd
+usr/src/man/man3dns_sd/DNSServiceUpdateRecord.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordContainsKey.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordDeallocate.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordGetBytesPtr.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordGetCount.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordGetItemAtIndex.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordGetLength.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordGetValuePtr.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordRemoveValue.3dns_sd
+usr/src/man/man3dns_sd/TXTRecordSetValue.3dns_sd
+usr/src/man/man3elf/elf32_newehdr.3elf
+usr/src/man/man3elf/elf32_newphdr.3elf
+usr/src/man/man3elf/elf32_xlatetom.3elf
+usr/src/man/man3elf/elf64_checksum.3elf
+usr/src/man/man3elf/elf64_fsize.3elf
+usr/src/man/man3elf/elf64_getehdr.3elf
+usr/src/man/man3elf/elf64_getphdr.3elf
+usr/src/man/man3elf/elf64_getshdr.3elf
+usr/src/man/man3elf/elf64_newehdr.3elf
+usr/src/man/man3elf/elf64_newphdr.3elf
+usr/src/man/man3elf/elf64_xlatetof.3elf
+usr/src/man/man3elf/elf64_xlatetom.3elf
+usr/src/man/man3elf/elf_end.3elf
+usr/src/man/man3elf/elf_errno.3elf
+usr/src/man/man3elf/elf_flagehdr.3elf
+usr/src/man/man3elf/elf_flagelf.3elf
+usr/src/man/man3elf/elf_flagphdr.3elf
+usr/src/man/man3elf/elf_flagscn.3elf
+usr/src/man/man3elf/elf_flagshdr.3elf
+usr/src/man/man3elf/elf_getphdrnum.3elf
+usr/src/man/man3elf/elf_getphnum.3elf
+usr/src/man/man3elf/elf_getshdrnum.3elf
+usr/src/man/man3elf/elf_getshdrstrndx.3elf
+usr/src/man/man3elf/elf_getshnum.3elf
+usr/src/man/man3elf/elf_getshstrndx.3elf
+usr/src/man/man3elf/elf_memory.3elf
+usr/src/man/man3elf/elf_ndxscn.3elf
+usr/src/man/man3elf/elf_newdata.3elf
+usr/src/man/man3elf/elf_newscn.3elf
+usr/src/man/man3elf/elf_next.3elf
+usr/src/man/man3elf/elf_nextscn.3elf
+usr/src/man/man3elf/elf_rand.3elf
+usr/src/man/man3elf/elf_rawdata.3elf
+usr/src/man/man3elf/gelf_checksum.3elf
+usr/src/man/man3elf/gelf_fsize.3elf
+usr/src/man/man3elf/gelf_getcap.3elf
+usr/src/man/man3elf/gelf_getclass.3elf
+usr/src/man/man3elf/gelf_getdyn.3elf
+usr/src/man/man3elf/gelf_getehdr.3elf
+usr/src/man/man3elf/gelf_getmove.3elf
+usr/src/man/man3elf/gelf_getphdr.3elf
+usr/src/man/man3elf/gelf_getrel.3elf
+usr/src/man/man3elf/gelf_getrela.3elf
+usr/src/man/man3elf/gelf_getshdr.3elf
+usr/src/man/man3elf/gelf_getsym.3elf
+usr/src/man/man3elf/gelf_getsyminfo.3elf
+usr/src/man/man3elf/gelf_getsymshndx.3elf
+usr/src/man/man3elf/gelf_newehdr.3elf
+usr/src/man/man3elf/gelf_newphdr.3elf
+usr/src/man/man3elf/gelf_update_cap.3elf
+usr/src/man/man3elf/gelf_update_dyn.3elf
+usr/src/man/man3elf/gelf_update_ehdr.3elf
+usr/src/man/man3elf/gelf_update_getmove.3elf
+usr/src/man/man3elf/gelf_update_move.3elf
+usr/src/man/man3elf/gelf_update_phdr.3elf
+usr/src/man/man3elf/gelf_update_rel.3elf
+usr/src/man/man3elf/gelf_update_rela.3elf
+usr/src/man/man3elf/gelf_update_shdr.3elf
+usr/src/man/man3elf/gelf_update_sym.3elf
+usr/src/man/man3elf/gelf_update_syminfo.3elf
+usr/src/man/man3elf/gelf_update_symshndx.3elf
+usr/src/man/man3elf/gelf_xlatetof.3elf
+usr/src/man/man3elf/gelf_xlatetom.3elf
+usr/src/man/man3exacct/ea_alloc.3exacct
+usr/src/man/man3exacct/ea_attach_to_group.3exacct
+usr/src/man/man3exacct/ea_attach_to_object.3exacct
+usr/src/man/man3exacct/ea_close.3exacct
+usr/src/man/man3exacct/ea_copy_object.3exacct
+usr/src/man/man3exacct/ea_copy_object_tree.3exacct
+usr/src/man/man3exacct/ea_free.3exacct
+usr/src/man/man3exacct/ea_free_item.3exacct
+usr/src/man/man3exacct/ea_free_object.3exacct
+usr/src/man/man3exacct/ea_get_creator.3exacct
+usr/src/man/man3exacct/ea_get_hostname.3exacct
+usr/src/man/man3exacct/ea_get_object.3exacct
+usr/src/man/man3exacct/ea_get_object_tree.3exacct
+usr/src/man/man3exacct/ea_match_object_catalog.3exacct
+usr/src/man/man3exacct/ea_next_object.3exacct
+usr/src/man/man3exacct/ea_previous_object.3exacct
+usr/src/man/man3exacct/ea_set_group.3exacct
+usr/src/man/man3exacct/ea_strdup.3exacct
+usr/src/man/man3exacct/ea_strfree.3exacct
+usr/src/man/man3exacct/ea_unpack_object.3exacct
+usr/src/man/man3exacct/ea_write_object.3exacct
+usr/src/man/man3ext/DES_FAILED.3ext
+usr/src/man/man3ext/MD4Final.3ext
+usr/src/man/man3ext/MD4Init.3ext
+usr/src/man/man3ext/MD4Update.3ext
+usr/src/man/man3ext/MD5Final.3ext
+usr/src/man/man3ext/MD5Init.3ext
+usr/src/man/man3ext/MD5Update.3ext
+usr/src/man/man3ext/SHA1Final.3ext
+usr/src/man/man3ext/SHA1Init.3ext
+usr/src/man/man3ext/SHA1Update.3ext
+usr/src/man/man3ext/SHA256Final.3ext
+usr/src/man/man3ext/SHA256Init.3ext
+usr/src/man/man3ext/SHA256Update.3ext
+usr/src/man/man3ext/SHA2Final.3ext
+usr/src/man/man3ext/SHA2Init.3ext
+usr/src/man/man3ext/SHA2Update.3ext
+usr/src/man/man3ext/SHA384Final.3ext
+usr/src/man/man3ext/SHA384Init.3ext
+usr/src/man/man3ext/SHA384Update.3ext
+usr/src/man/man3ext/SHA512Final.3ext
+usr/src/man/man3ext/SHA512Init.3ext
+usr/src/man/man3ext/SHA512Update.3ext
+usr/src/man/man3ext/SUNW_C_KeyToObject.3ext
+usr/src/man/man3ext/_NOTE.3ext
+usr/src/man/man3ext/auto_ef_file.3ext
+usr/src/man/man3ext/auto_ef_free.3ext
+usr/src/man/man3ext/auto_ef_get_encoding.3ext
+usr/src/man/man3ext/auto_ef_get_score.3ext
+usr/src/man/man3ext/auto_ef_str.3ext
+usr/src/man/man3ext/cbc_crypt.3ext
+usr/src/man/man3ext/cplus_demangle.3ext
+usr/src/man/man3ext/crypt_close.3ext
+usr/src/man/man3ext/des_crypt.3ext
+usr/src/man/man3ext/des_encrypt.3ext
+usr/src/man/man3ext/des_setkey.3ext
+usr/src/man/man3ext/des_setparity.3ext
+usr/src/man/man3ext/efi_alloc_and_read.3ext
+usr/src/man/man3ext/efi_free.3ext
+usr/src/man/man3ext/efi_use_whole_disk.3ext
+usr/src/man/man3ext/efi_write.3ext
+usr/src/man/man3ext/encrypt.3ext
+usr/src/man/man3ext/la_activity.3ext
+usr/src/man/man3ext/la_amd64_pltenter.3ext
+usr/src/man/man3ext/la_i86_pltenter.3ext
+usr/src/man/man3ext/la_objfilter.3ext
+usr/src/man/man3ext/la_objopen.3ext
+usr/src/man/man3ext/la_objsearch.3ext
+usr/src/man/man3ext/la_pltexit.3ext
+usr/src/man/man3ext/la_pltexit64.3ext
+usr/src/man/man3ext/la_preinit.3ext
+usr/src/man/man3ext/la_sparcv8_pltenter.3ext
+usr/src/man/man3ext/la_sparcv9_pltenter.3ext
+usr/src/man/man3ext/la_symbind32.3ext
+usr/src/man/man3ext/la_symbind64.3ext
+usr/src/man/man3ext/la_version.3ext
+usr/src/man/man3ext/ld_atexit.3ext
+usr/src/man/man3ext/ld_atexit64.3ext
+usr/src/man/man3ext/ld_file.3ext
+usr/src/man/man3ext/ld_file64.3ext
+usr/src/man/man3ext/ld_input_done.3ext
+usr/src/man/man3ext/ld_input_section.3ext
+usr/src/man/man3ext/ld_input_section64.3ext
+usr/src/man/man3ext/ld_open.3ext
+usr/src/man/man3ext/ld_open64.3ext
+usr/src/man/man3ext/ld_section.3ext
+usr/src/man/man3ext/ld_section64.3ext
+usr/src/man/man3ext/ld_start.3ext
+usr/src/man/man3ext/ld_start64.3ext
+usr/src/man/man3ext/ld_version.3ext
+usr/src/man/man3ext/md5_calc.3ext
+usr/src/man/man3ext/rd_delete.3ext
+usr/src/man/man3ext/rd_errstr.3ext
+usr/src/man/man3ext/rd_event_addr.3ext
+usr/src/man/man3ext/rd_event_enable.3ext
+usr/src/man/man3ext/rd_event_getmsg.3ext
+usr/src/man/man3ext/rd_init.3ext
+usr/src/man/man3ext/rd_loadobj_iter.3ext
+usr/src/man/man3ext/rd_log.3ext
+usr/src/man/man3ext/rd_new.3ext
+usr/src/man/man3ext/rd_objpad_enable.3ext
+usr/src/man/man3ext/rd_plt_resolution.3ext
+usr/src/man/man3ext/rd_reset.3ext
+usr/src/man/man3ext/run_crypt.3ext
+usr/src/man/man3ext/run_setkey.3ext
+usr/src/man/man3ext/setkey.3ext
+usr/src/man/man3ext/tsalarm_set.3ext
+usr/src/man/man3ext/write_vtoc.3ext
+usr/src/man/man3fstyp/fstyp_fini.3fstyp
+usr/src/man/man3fstyp/fstyp_mod_dump.3fstyp
+usr/src/man/man3fstyp/fstyp_mod_fini.3fstyp
+usr/src/man/man3fstyp/fstyp_mod_get_attr.3fstyp
+usr/src/man/man3fstyp/fstyp_mod_ident.3fstyp
+usr/src/man/man3gen/advance.3gen
+usr/src/man/man3gen/compile.3gen
+usr/src/man/man3gen/p2close.3gen
+usr/src/man/man3gen/rmdirp.3gen
+usr/src/man/man3gen/step.3gen
+usr/src/man/man3gen/str.3gen
+usr/src/man/man3gen/strcadd.3gen
+usr/src/man/man3gen/streadd.3gen
+usr/src/man/man3gen/strecpy.3gen
+usr/src/man/man3gen/strrspn.3gen
+usr/src/man/man3gen/strtrns.3gen
+usr/src/man/man3head/acct.3head
+usr/src/man/man3head/aio.3head
+usr/src/man/man3head/ar.3head
+usr/src/man/man3head/archives.3head
+usr/src/man/man3head/assert.3head
+usr/src/man/man3head/complex.3head
+usr/src/man/man3head/cpio.3head
+usr/src/man/man3head/dirent.3head
+usr/src/man/man3head/errno.3head
+usr/src/man/man3head/fcntl.3head
+usr/src/man/man3head/fenv.3head
+usr/src/man/man3head/float.3head
+usr/src/man/man3head/floatingpoint.3head
+usr/src/man/man3head/fmtmsg.3head
+usr/src/man/man3head/fnmatch.3head
+usr/src/man/man3head/ftw.3head
+usr/src/man/man3head/glob.3head
+usr/src/man/man3head/grp.3head
+usr/src/man/man3head/iconv.3head
+usr/src/man/man3head/if.3head
+usr/src/man/man3head/in.3head
+usr/src/man/man3head/inet.3head
+usr/src/man/man3head/inttypes.3head
+usr/src/man/man3head/ipc.3head
+usr/src/man/man3head/iso646.3head
+usr/src/man/man3head/langinfo.3head
+usr/src/man/man3head/libgen.3head
+usr/src/man/man3head/libintl.3head
+usr/src/man/man3head/limits.3head
+usr/src/man/man3head/locale.3head
+usr/src/man/man3head/math.3head
+usr/src/man/man3head/mman.3head
+usr/src/man/man3head/monetary.3head
+usr/src/man/man3head/mqueue.3head
+usr/src/man/man3head/msg.3head
+usr/src/man/man3head/ndbm.3head
+usr/src/man/man3head/netdb.3head
+usr/src/man/man3head/nl_types.3head
+usr/src/man/man3head/poll.3head
+usr/src/man/man3head/pthread.3head
+usr/src/man/man3head/pwd.3head
+usr/src/man/man3head/regex.3head
+usr/src/man/man3head/resource.3head
+usr/src/man/man3head/sched.3head
+usr/src/man/man3head/search.3head
+usr/src/man/man3head/select.3head
+usr/src/man/man3head/sem.3head
+usr/src/man/man3head/semaphore.3head
+usr/src/man/man3head/setjmp.3head
+usr/src/man/man3head/shm.3head
+usr/src/man/man3head/siginfo.3head
+usr/src/man/man3head/signal.3head
+usr/src/man/man3head/socket.3head
+usr/src/man/man3head/spawn.3head
+usr/src/man/man3head/stat.3head
+usr/src/man/man3head/statvfs.3head
+usr/src/man/man3head/stdbool.3head
+usr/src/man/man3head/stddef.3head
+usr/src/man/man3head/stdint.3head
+usr/src/man/man3head/stdio.3head
+usr/src/man/man3head/stdlib.3head
+usr/src/man/man3head/string.3head
+usr/src/man/man3head/strings.3head
+usr/src/man/man3head/stropts.3head
+usr/src/man/man3head/syslog.3head
+usr/src/man/man3head/tar.3head
+usr/src/man/man3head/tcp.3head
+usr/src/man/man3head/termios.3head
+usr/src/man/man3head/tgmath.3head
+usr/src/man/man3head/time.3head
+usr/src/man/man3head/timeb.3head
+usr/src/man/man3head/times.3head
+usr/src/man/man3head/types.3head
+usr/src/man/man3head/types32.3head
+usr/src/man/man3head/ucontext.3head
+usr/src/man/man3head/uio.3head
+usr/src/man/man3head/ulimit.3head
+usr/src/man/man3head/un.3head
+usr/src/man/man3head/unistd.3head
+usr/src/man/man3head/utime.3head
+usr/src/man/man3head/utmpx.3head
+usr/src/man/man3head/utsname.3head
+usr/src/man/man3head/values.3head
+usr/src/man/man3head/wait.3head
+usr/src/man/man3head/wchar.3head
+usr/src/man/man3head/wctype.3head
+usr/src/man/man3head/wordexp.3head
+usr/src/man/man3iscsit/it_config_commit.3iscsit
+usr/src/man/man3iscsit/it_config_free.3iscsit
+usr/src/man/man3iscsit/it_config_setprop.3iscsit
+usr/src/man/man3iscsit/it_ini_delete.3iscsit
+usr/src/man/man3iscsit/it_ini_free.3iscsit
+usr/src/man/man3iscsit/it_ini_setprop.3iscsit
+usr/src/man/man3iscsit/it_portal_delete.3iscsit
+usr/src/man/man3iscsit/it_tgt_delete.3iscsit
+usr/src/man/man3iscsit/it_tgt_free.3iscsit
+usr/src/man/man3iscsit/it_tgt_setprop.3iscsit
+usr/src/man/man3iscsit/it_tpg_delete.3iscsit
+usr/src/man/man3iscsit/it_tpg_free.3iscsit
+usr/src/man/man3iscsit/it_tpgt_create.3iscsit
+usr/src/man/man3iscsit/it_tpgt_delete.3iscsit
+usr/src/man/man3iscsit/it_tpgt_free.3iscsit
+usr/src/man/man3kstat/kstat_close.3kstat
+usr/src/man/man3kstat/kstat_data_lookup.3kstat
+usr/src/man/man3kstat/kstat_write.3kstat
+usr/src/man/man3kvm/kvm_close.3kvm
+usr/src/man/man3kvm/kvm_getcmd.3kvm
+usr/src/man/man3kvm/kvm_getproc.3kvm
+usr/src/man/man3kvm/kvm_kwrite.3kvm
+usr/src/man/man3kvm/kvm_setproc.3kvm
+usr/src/man/man3kvm/kvm_uread.3kvm
+usr/src/man/man3kvm/kvm_uwrite.3kvm
+usr/src/man/man3kvm/kvm_write.3kvm
+usr/src/man/man3ldap/ber_alloc.3ldap
+usr/src/man/man3ldap/ber_alloc_t.3ldap
+usr/src/man/man3ldap/ber_bvdup.3ldap
+usr/src/man/man3ldap/ber_bvecfree.3ldap
+usr/src/man/man3ldap/ber_bvfree.3ldap
+usr/src/man/man3ldap/ber_first_element.3ldap
+usr/src/man/man3ldap/ber_flatten.3ldap
+usr/src/man/man3ldap/ber_free.3ldap
+usr/src/man/man3ldap/ber_get_bitstring.3ldap
+usr/src/man/man3ldap/ber_get_boolean.3ldap
+usr/src/man/man3ldap/ber_get_int.3ldap
+usr/src/man/man3ldap/ber_get_next.3ldap
+usr/src/man/man3ldap/ber_get_null.3ldap
+usr/src/man/man3ldap/ber_get_stringa.3ldap
+usr/src/man/man3ldap/ber_get_stringal.3ldap
+usr/src/man/man3ldap/ber_get_stringb.3ldap
+usr/src/man/man3ldap/ber_init.3ldap
+usr/src/man/man3ldap/ber_next_element.3ldap
+usr/src/man/man3ldap/ber_peek_tag.3ldap
+usr/src/man/man3ldap/ber_printf.3ldap
+usr/src/man/man3ldap/ber_put_bitstring.3ldap
+usr/src/man/man3ldap/ber_put_boolean.3ldap
+usr/src/man/man3ldap/ber_put_int.3ldap
+usr/src/man/man3ldap/ber_put_null.3ldap
+usr/src/man/man3ldap/ber_put_ostring.3ldap
+usr/src/man/man3ldap/ber_put_seq.3ldap
+usr/src/man/man3ldap/ber_put_set.3ldap
+usr/src/man/man3ldap/ber_put_string.3ldap
+usr/src/man/man3ldap/ber_scanf.3ldap
+usr/src/man/man3ldap/ber_skip_tag.3ldap
+usr/src/man/man3ldap/ber_start_seq.3ldap
+usr/src/man/man3ldap/ber_start_set.3ldap
+usr/src/man/man3ldap/ldap_8859_to_t61.3ldap
+usr/src/man/man3ldap/ldap_add_ext.3ldap
+usr/src/man/man3ldap/ldap_add_ext_s.3ldap
+usr/src/man/man3ldap/ldap_add_s.3ldap
+usr/src/man/man3ldap/ldap_bind_s.3ldap
+usr/src/man/man3ldap/ldap_build_filter.3ldap
+usr/src/man/man3ldap/ldap_compare_ext.3ldap
+usr/src/man/man3ldap/ldap_compare_ext_s.3ldap
+usr/src/man/man3ldap/ldap_compare_s.3ldap
+usr/src/man/man3ldap/ldap_controls_free.3ldap
+usr/src/man/man3ldap/ldap_count_entries.3ldap
+usr/src/man/man3ldap/ldap_count_messages.3ldap
+usr/src/man/man3ldap/ldap_count_references.3ldap
+usr/src/man/man3ldap/ldap_count_values.3ldap
+usr/src/man/man3ldap/ldap_count_values_len.3ldap
+usr/src/man/man3ldap/ldap_delete_ext.3ldap
+usr/src/man/man3ldap/ldap_delete_ext_s.3ldap
+usr/src/man/man3ldap/ldap_delete_s.3ldap
+usr/src/man/man3ldap/ldap_dn2ufn.3ldap
+usr/src/man/man3ldap/ldap_dn_to_url.3ldap
+usr/src/man/man3ldap/ldap_dns_to_dn.3ldap
+usr/src/man/man3ldap/ldap_dns_to_url.3ldap
+usr/src/man/man3ldap/ldap_enable_translation.3ldap
+usr/src/man/man3ldap/ldap_entry2html.3ldap
+usr/src/man/man3ldap/ldap_entry2html_search.3ldap
+usr/src/man/man3ldap/ldap_entry2text_search.3ldap
+usr/src/man/man3ldap/ldap_err2string.3ldap
+usr/src/man/man3ldap/ldap_explode_dn.3ldap
+usr/src/man/man3ldap/ldap_explode_dns.3ldap
+usr/src/man/man3ldap/ldap_first_disptmpl.3ldap
+usr/src/man/man3ldap/ldap_first_reference.3ldap
+usr/src/man/man3ldap/ldap_first_searchobj.3ldap
+usr/src/man/man3ldap/ldap_first_tmplcol.3ldap
+usr/src/man/man3ldap/ldap_first_tmplrow.3ldap
+usr/src/man/man3ldap/ldap_free_friendlymap.3ldap
+usr/src/man/man3ldap/ldap_free_searchprefs.3ldap
+usr/src/man/man3ldap/ldap_free_templates.3ldap
+usr/src/man/man3ldap/ldap_free_urldesc.3ldap
+usr/src/man/man3ldap/ldap_friendly_name.3ldap
+usr/src/man/man3ldap/ldap_get_lang_values_len.3ldap
+usr/src/man/man3ldap/ldap_get_values_len.3ldap
+usr/src/man/man3ldap/ldap_getfilter_free.3ldap
+usr/src/man/man3ldap/ldap_getfirstfilter.3ldap
+usr/src/man/man3ldap/ldap_getnextfilter.3ldap
+usr/src/man/man3ldap/ldap_init.3ldap
+usr/src/man/man3ldap/ldap_init_getfilter.3ldap
+usr/src/man/man3ldap/ldap_init_getfilter_buf.3ldap
+usr/src/man/man3ldap/ldap_init_searchprefs.3ldap
+usr/src/man/man3ldap/ldap_init_searchprefs_buf.3ldap
+usr/src/man/man3ldap/ldap_init_templates.3ldap
+usr/src/man/man3ldap/ldap_init_templates_buf.3ldap
+usr/src/man/man3ldap/ldap_is_dns_dn.3ldap
+usr/src/man/man3ldap/ldap_is_ldap_url.3ldap
+usr/src/man/man3ldap/ldap_memcache_destroy.3ldap
+usr/src/man/man3ldap/ldap_memcache_flush.3ldap
+usr/src/man/man3ldap/ldap_memcache_get.3ldap
+usr/src/man/man3ldap/ldap_memcache_init.3ldap
+usr/src/man/man3ldap/ldap_memcache_set.3ldap
+usr/src/man/man3ldap/ldap_memcache_update.3ldap
+usr/src/man/man3ldap/ldap_modify_ext.3ldap
+usr/src/man/man3ldap/ldap_modify_ext_s.3ldap
+usr/src/man/man3ldap/ldap_modify_s.3ldap
+usr/src/man/man3ldap/ldap_modrdn2.3ldap
+usr/src/man/man3ldap/ldap_modrdn2_s.3ldap
+usr/src/man/man3ldap/ldap_modrdn_s.3ldap
+usr/src/man/man3ldap/ldap_mods_free.3ldap
+usr/src/man/man3ldap/ldap_msgfree.3ldap
+usr/src/man/man3ldap/ldap_msgtype.3ldap
+usr/src/man/man3ldap/ldap_name2template.3ldap
+usr/src/man/man3ldap/ldap_next_attribute.3ldap
+usr/src/man/man3ldap/ldap_next_disptmpl.3ldap
+usr/src/man/man3ldap/ldap_next_entry.3ldap
+usr/src/man/man3ldap/ldap_next_message.3ldap
+usr/src/man/man3ldap/ldap_next_reference.3ldap
+usr/src/man/man3ldap/ldap_next_searchobj.3ldap
+usr/src/man/man3ldap/ldap_next_tmplcol.3ldap
+usr/src/man/man3ldap/ldap_next_tmplrow.3ldap
+usr/src/man/man3ldap/ldap_oc2template.3ldap
+usr/src/man/man3ldap/ldap_parse_extended_result.3ldap
+usr/src/man/man3ldap/ldap_parse_sasl_bind_result.3ldap
+usr/src/man/man3ldap/ldap_perror.3ldap
+usr/src/man/man3ldap/ldap_rename.3ldap
+usr/src/man/man3ldap/ldap_rename_s.3ldap
+usr/src/man/man3ldap/ldap_result2error.3ldap
+usr/src/man/man3ldap/ldap_sasl_bind.3ldap
+usr/src/man/man3ldap/ldap_sasl_bind_s.3ldap
+usr/src/man/man3ldap/ldap_sasl_interactive_bind_s.3ldap
+usr/src/man/man3ldap/ldap_search_ext.3ldap
+usr/src/man/man3ldap/ldap_search_ext_s.3ldap
+usr/src/man/man3ldap/ldap_search_s.3ldap
+usr/src/man/man3ldap/ldap_search_st.3ldap
+usr/src/man/man3ldap/ldap_set_option.3ldap
+usr/src/man/man3ldap/ldap_set_rebind_proc.3ldap
+usr/src/man/man3ldap/ldap_set_string_translators.3ldap
+usr/src/man/man3ldap/ldap_setfilteraffixes.3ldap
+usr/src/man/man3ldap/ldap_simple_bind.3ldap
+usr/src/man/man3ldap/ldap_simple_bind_s.3ldap
+usr/src/man/man3ldap/ldap_sort_entries.3ldap
+usr/src/man/man3ldap/ldap_sort_strcasecmp.3ldap
+usr/src/man/man3ldap/ldap_sort_values.3ldap
+usr/src/man/man3ldap/ldap_t61_to_8859.3ldap
+usr/src/man/man3ldap/ldap_tmplattrs.3ldap
+usr/src/man/man3ldap/ldap_translate_from_t61.3ldap
+usr/src/man/man3ldap/ldap_translate_to_t61.3ldap
+usr/src/man/man3ldap/ldap_ufn_search_c.3ldap
+usr/src/man/man3ldap/ldap_ufn_search_ct.3ldap
+usr/src/man/man3ldap/ldap_ufn_search_s.3ldap
+usr/src/man/man3ldap/ldap_ufn_setfilter.3ldap
+usr/src/man/man3ldap/ldap_ufn_setprefix.3ldap
+usr/src/man/man3ldap/ldap_ufn_timeout.3ldap
+usr/src/man/man3ldap/ldap_unbind.3ldap
+usr/src/man/man3ldap/ldap_unbind_ext.3ldap
+usr/src/man/man3ldap/ldap_unbind_s.3ldap
+usr/src/man/man3ldap/ldap_url_parse.3ldap
+usr/src/man/man3ldap/ldap_url_parse_nodn.3ldap
+usr/src/man/man3ldap/ldap_url_search.3ldap
+usr/src/man/man3ldap/ldap_url_search_s.3ldap
+usr/src/man/man3ldap/ldap_url_search_st.3ldap
+usr/src/man/man3ldap/ldap_vals2html.3ldap
+usr/src/man/man3ldap/ldap_vals2text.3ldap
+usr/src/man/man3ldap/ldap_value_free.3ldap
+usr/src/man/man3ldap/ldap_value_free_len.3ldap
+usr/src/man/man3lgrp/lgrp_affinity_set.3lgrp
+usr/src/man/man3lgrp/lgrp_latency_cookie.3lgrp
+usr/src/man/man3lib/SMHBA_GetAdapterAttributes.3lib
+usr/src/man/man3lib/SMHBA_GetAdapterPortAttributes.3lib
+usr/src/man/man3lib/SMHBA_GetBindingCapability.3lib
+usr/src/man/man3lib/SMHBA_GetBindingSupport.3lib
+usr/src/man/man3lib/SMHBA_GetDiscoveredPortAttributes.3lib
+usr/src/man/man3lib/SMHBA_GetFCPhyAttributes.3lib
+usr/src/man/man3lib/SMHBA_GetLUNStatistics.3lib
+usr/src/man/man3lib/SMHBA_GetNumberofPorts.3lib
+usr/src/man/man3lib/SMHBA_GetPersistentBinding.3lib
+usr/src/man/man3lib/SMHBA_GetPhyStatistics.3lib
+usr/src/man/man3lib/SMHBA_GetPortAttributesByWWN.3lib
+usr/src/man/man3lib/SMHBA_GetPortType.3lib
+usr/src/man/man3lib/SMHBA_GetProtocolStatistics.3lib
+usr/src/man/man3lib/SMHBA_GetSASPhyAttributes.3lib
+usr/src/man/man3lib/SMHBA_GetTargetMapping.3lib
+usr/src/man/man3lib/SMHBA_GetVendorLibraryAttributes.3lib
+usr/src/man/man3lib/SMHBA_GetVersion.3lib
+usr/src/man/man3lib/SMHBA_GetWrapperLibraryAttributes.3lib
+usr/src/man/man3lib/SMHBA_RegisterForAdapterAddEvents.3lib
+usr/src/man/man3lib/SMHBA_RegisterForAdapterEvents.3lib
+usr/src/man/man3lib/SMHBA_RegisterForAdapterPhyStatEvents.3lib
+usr/src/man/man3lib/SMHBA_RegisterForAdapterPortEvents.3lib
+usr/src/man/man3lib/SMHBA_RegisterForAdapterPortStatEvents.3lib
+usr/src/man/man3lib/SMHBA_RegisterForTargetEvents.3lib
+usr/src/man/man3lib/SMHBA_RegisterLibrary.3lib
+usr/src/man/man3lib/SMHBA_RemoveAllPersistentBindings.3lib
+usr/src/man/man3lib/SMHBA_RemovePersistentBinding.3lib
+usr/src/man/man3lib/SMHBA_ScsiInquiry.3lib
+usr/src/man/man3lib/SMHBA_ScsiReadCapacity.3lib
+usr/src/man/man3lib/SMHBA_ScsiReportLuns.3lib
+usr/src/man/man3lib/SMHBA_SendECHO.3lib
+usr/src/man/man3lib/SMHBA_SendSMPPassThru.3lib
+usr/src/man/man3lib/SMHBA_SendTEST.3lib
+usr/src/man/man3lib/SMHBA_SetBindingSupport.3lib
+usr/src/man/man3lib/SMHBA_SetPersistentBinding.3lib
+usr/src/man/man3lib/libmpapi.3lib
+usr/src/man/man3lib/libposix4.3lib
+usr/src/man/man3lib/libsmhbaapi.3lib
+usr/src/man/man3lib/libtermcap.3lib
+usr/src/man/man3lib/libtermlib.3lib
+usr/src/man/man3mail/mailunlock.3mail
+usr/src/man/man3mail/touchlock.3mail
+usr/src/man/man3malloc/calloc.3malloc
+usr/src/man/man3malloc/free.3malloc
+usr/src/man/man3malloc/mallinfo.3malloc
+usr/src/man/man3malloc/mallocctl.3malloc
+usr/src/man/man3malloc/mallopt.3malloc
+usr/src/man/man3malloc/memalign.3malloc
+usr/src/man/man3malloc/realloc.3malloc
+usr/src/man/man3malloc/umem_cache_alloc.3malloc
+usr/src/man/man3malloc/umem_cache_destroy.3malloc
+usr/src/man/man3malloc/umem_cache_free.3malloc
+usr/src/man/man3malloc/umem_free.3malloc
+usr/src/man/man3malloc/umem_nofail_callback.3malloc
+usr/src/man/man3malloc/umem_zalloc.3malloc
+usr/src/man/man3malloc/valloc.3malloc
+usr/src/man/man3mp/mp_gcd.3mp
+usr/src/man/man3mp/mp_itom.3mp
+usr/src/man/man3mp/mp_madd.3mp
+usr/src/man/man3mp/mp_mcmp.3mp
+usr/src/man/man3mp/mp_mdiv.3mp
+usr/src/man/man3mp/mp_mfree.3mp
+usr/src/man/man3mp/mp_min.3mp
+usr/src/man/man3mp/mp_mout.3mp
+usr/src/man/man3mp/mp_msqrt.3mp
+usr/src/man/man3mp/mp_msub.3mp
+usr/src/man/man3mp/mp_mtox.3mp
+usr/src/man/man3mp/mp_mult.3mp
+usr/src/man/man3mp/mp_pow.3mp
+usr/src/man/man3mp/mp_rpow.3mp
+usr/src/man/man3mp/mp_sdiv.3mp
+usr/src/man/man3mp/mp_xtom.3mp
+usr/src/man/man3nsl/auth_destroy.3nsl
+usr/src/man/man3nsl/authdes_create.3nsl
+usr/src/man/man3nsl/authdes_getucred.3nsl
+usr/src/man/man3nsl/authdes_seccreate.3nsl
+usr/src/man/man3nsl/authnone_create.3nsl
+usr/src/man/man3nsl/authsys_create.3nsl
+usr/src/man/man3nsl/authsys_create_default.3nsl
+usr/src/man/man3nsl/authunix_create.3nsl
+usr/src/man/man3nsl/authunix_create_default.3nsl
+usr/src/man/man3nsl/callrpc.3nsl
+usr/src/man/man3nsl/clnt_broadcast.3nsl
+usr/src/man/man3nsl/clnt_call.3nsl
+usr/src/man/man3nsl/clnt_control.3nsl
+usr/src/man/man3nsl/clnt_create.3nsl
+usr/src/man/man3nsl/clnt_create_timed.3nsl
+usr/src/man/man3nsl/clnt_create_vers.3nsl
+usr/src/man/man3nsl/clnt_create_vers_timed.3nsl
+usr/src/man/man3nsl/clnt_destroy.3nsl
+usr/src/man/man3nsl/clnt_dg_create.3nsl
+usr/src/man/man3nsl/clnt_door_create.3nsl
+usr/src/man/man3nsl/clnt_freeres.3nsl
+usr/src/man/man3nsl/clnt_geterr.3nsl
+usr/src/man/man3nsl/clnt_pcreateerror.3nsl
+usr/src/man/man3nsl/clnt_perrno.3nsl
+usr/src/man/man3nsl/clnt_perror.3nsl
+usr/src/man/man3nsl/clnt_raw_create.3nsl
+usr/src/man/man3nsl/clnt_send.3nsl
+usr/src/man/man3nsl/clnt_spcreateerror.3nsl
+usr/src/man/man3nsl/clnt_sperrno.3nsl
+usr/src/man/man3nsl/clnt_sperror.3nsl
+usr/src/man/man3nsl/clnt_tli_create.3nsl
+usr/src/man/man3nsl/clnt_tp_create.3nsl
+usr/src/man/man3nsl/clnt_tp_create_timed.3nsl
+usr/src/man/man3nsl/clnt_vc_create.3nsl
+usr/src/man/man3nsl/clntraw_create.3nsl
+usr/src/man/man3nsl/clnttcp_create.3nsl
+usr/src/man/man3nsl/clntudp_bufcreate.3nsl
+usr/src/man/man3nsl/clntudp_create.3nsl
+usr/src/man/man3nsl/endhostent.3nsl
+usr/src/man/man3nsl/endnetconfig.3nsl
+usr/src/man/man3nsl/endnetpath.3nsl
+usr/src/man/man3nsl/endrpcent.3nsl
+usr/src/man/man3nsl/freeipsecalgent.3nsl
+usr/src/man/man3nsl/freenetconfigent.3nsl
+usr/src/man/man3nsl/get_myaddress.3nsl
+usr/src/man/man3nsl/gethostbyaddr.3nsl
+usr/src/man/man3nsl/gethostbyaddr_r.3nsl
+usr/src/man/man3nsl/gethostbyname_r.3nsl
+usr/src/man/man3nsl/gethostent.3nsl
+usr/src/man/man3nsl/gethostent_r.3nsl
+usr/src/man/man3nsl/getipsecalgbynum.3nsl
+usr/src/man/man3nsl/getipsecprotobynum.3nsl
+usr/src/man/man3nsl/getnetconfigent.3nsl
+usr/src/man/man3nsl/getnetname.3nsl
+usr/src/man/man3nsl/getrpcbyname_r.3nsl
+usr/src/man/man3nsl/getrpcbynumber.3nsl
+usr/src/man/man3nsl/getrpcbynumber_r.3nsl
+usr/src/man/man3nsl/getrpcent.3nsl
+usr/src/man/man3nsl/getrpcent_r.3nsl
+usr/src/man/man3nsl/getrpcport.3nsl
+usr/src/man/man3nsl/getsecretkey.3nsl
+usr/src/man/man3nsl/host2netname.3nsl
+usr/src/man/man3nsl/key_decryptsession.3nsl
+usr/src/man/man3nsl/key_encryptsession.3nsl
+usr/src/man/man3nsl/key_gendes.3nsl
+usr/src/man/man3nsl/key_secretkey_is_set.3nsl
+usr/src/man/man3nsl/key_setsecret.3nsl
+usr/src/man/man3nsl/nc_perror.3nsl
+usr/src/man/man3nsl/nc_sperror.3nsl
+usr/src/man/man3nsl/netdir_free.3nsl
+usr/src/man/man3nsl/netdir_getbyaddr.3nsl
+usr/src/man/man3nsl/netdir_getbyname.3nsl
+usr/src/man/man3nsl/netdir_mergeaddr.3nsl
+usr/src/man/man3nsl/netdir_options.3nsl
+usr/src/man/man3nsl/netdir_perror.3nsl
+usr/src/man/man3nsl/netdir_sperror.3nsl
+usr/src/man/man3nsl/netname2host.3nsl
+usr/src/man/man3nsl/netname2user.3nsl
+usr/src/man/man3nsl/pmap_getmaps.3nsl
+usr/src/man/man3nsl/pmap_getport.3nsl
+usr/src/man/man3nsl/pmap_rmtcall.3nsl
+usr/src/man/man3nsl/pmap_set.3nsl
+usr/src/man/man3nsl/pmap_unset.3nsl
+usr/src/man/man3nsl/publickey.3nsl
+usr/src/man/man3nsl/registerrpc.3nsl
+usr/src/man/man3nsl/rpc_broadcast.3nsl
+usr/src/man/man3nsl/rpc_broadcast_exp.3nsl
+usr/src/man/man3nsl/rpc_call.3nsl
+usr/src/man/man3nsl/rpc_createerr.3nsl
+usr/src/man/man3nsl/rpc_gss_get_mech_info.3nsl
+usr/src/man/man3nsl/rpc_gss_get_versions.3nsl
+usr/src/man/man3nsl/rpc_gss_is_installed.3nsl
+usr/src/man/man3nsl/rpc_gss_qop_to_num.3nsl
+usr/src/man/man3nsl/rpc_gss_svc_max_data_length.3nsl
+usr/src/man/man3nsl/rpc_reg.3nsl
+usr/src/man/man3nsl/rpcb_getaddr.3nsl
+usr/src/man/man3nsl/rpcb_getmaps.3nsl
+usr/src/man/man3nsl/rpcb_gettime.3nsl
+usr/src/man/man3nsl/rpcb_rmtcall.3nsl
+usr/src/man/man3nsl/rpcb_set.3nsl
+usr/src/man/man3nsl/rpcb_unset.3nsl
+usr/src/man/man3nsl/sethostent.3nsl
+usr/src/man/man3nsl/setnetconfig.3nsl
+usr/src/man/man3nsl/setnetpath.3nsl
+usr/src/man/man3nsl/setrpcent.3nsl
+usr/src/man/man3nsl/svc_add_input.3nsl
+usr/src/man/man3nsl/svc_auth_reg.3nsl
+usr/src/man/man3nsl/svc_control.3nsl
+usr/src/man/man3nsl/svc_create.3nsl
+usr/src/man/man3nsl/svc_destroy.3nsl
+usr/src/man/man3nsl/svc_dg_create.3nsl
+usr/src/man/man3nsl/svc_dg_enablecache.3nsl
+usr/src/man/man3nsl/svc_done.3nsl
+usr/src/man/man3nsl/svc_door_create.3nsl
+usr/src/man/man3nsl/svc_exit.3nsl
+usr/src/man/man3nsl/svc_fd_create.3nsl
+usr/src/man/man3nsl/svc_fd_negotiate_ucred.3nsl
+usr/src/man/man3nsl/svc_fds.3nsl
+usr/src/man/man3nsl/svc_fdset.3nsl
+usr/src/man/man3nsl/svc_freeargs.3nsl
+usr/src/man/man3nsl/svc_getargs.3nsl
+usr/src/man/man3nsl/svc_getcaller.3nsl
+usr/src/man/man3nsl/svc_getcallerucred.3nsl
+usr/src/man/man3nsl/svc_getreq.3nsl
+usr/src/man/man3nsl/svc_getreq_common.3nsl
+usr/src/man/man3nsl/svc_getreq_poll.3nsl
+usr/src/man/man3nsl/svc_getreqset.3nsl
+usr/src/man/man3nsl/svc_getrpccaller.3nsl
+usr/src/man/man3nsl/svc_max_pollfd.3nsl
+usr/src/man/man3nsl/svc_pollfd.3nsl
+usr/src/man/man3nsl/svc_raw_create.3nsl
+usr/src/man/man3nsl/svc_reg.3nsl
+usr/src/man/man3nsl/svc_register.3nsl
+usr/src/man/man3nsl/svc_remove_input.3nsl
+usr/src/man/man3nsl/svc_run.3nsl
+usr/src/man/man3nsl/svc_sendreply.3nsl
+usr/src/man/man3nsl/svc_tli_create.3nsl
+usr/src/man/man3nsl/svc_tp_create.3nsl
+usr/src/man/man3nsl/svc_unreg.3nsl
+usr/src/man/man3nsl/svc_unregister.3nsl
+usr/src/man/man3nsl/svc_vc_create.3nsl
+usr/src/man/man3nsl/svcerr_auth.3nsl
+usr/src/man/man3nsl/svcerr_decode.3nsl
+usr/src/man/man3nsl/svcerr_noproc.3nsl
+usr/src/man/man3nsl/svcerr_noprog.3nsl
+usr/src/man/man3nsl/svcerr_progvers.3nsl
+usr/src/man/man3nsl/svcerr_systemerr.3nsl
+usr/src/man/man3nsl/svcerr_weakauth.3nsl
+usr/src/man/man3nsl/svcfd_create.3nsl
+usr/src/man/man3nsl/svcraw_create.3nsl
+usr/src/man/man3nsl/svctcp_create.3nsl
+usr/src/man/man3nsl/svcudp_bufcreate.3nsl
+usr/src/man/man3nsl/svcudp_create.3nsl
+usr/src/man/man3nsl/taddr2uaddr.3nsl
+usr/src/man/man3nsl/uaddr2taddr.3nsl
+usr/src/man/man3nsl/undial.3nsl
+usr/src/man/man3nsl/user2netname.3nsl
+usr/src/man/man3nsl/xdr_accepted_reply.3nsl
+usr/src/man/man3nsl/xdr_array.3nsl
+usr/src/man/man3nsl/xdr_authsys_parms.3nsl
+usr/src/man/man3nsl/xdr_authunix_parms.3nsl
+usr/src/man/man3nsl/xdr_bool.3nsl
+usr/src/man/man3nsl/xdr_bytes.3nsl
+usr/src/man/man3nsl/xdr_callhdr.3nsl
+usr/src/man/man3nsl/xdr_callmsg.3nsl
+usr/src/man/man3nsl/xdr_char.3nsl
+usr/src/man/man3nsl/xdr_control.3nsl
+usr/src/man/man3nsl/xdr_destroy.3nsl
+usr/src/man/man3nsl/xdr_double.3nsl
+usr/src/man/man3nsl/xdr_enum.3nsl
+usr/src/man/man3nsl/xdr_float.3nsl
+usr/src/man/man3nsl/xdr_free.3nsl
+usr/src/man/man3nsl/xdr_getpos.3nsl
+usr/src/man/man3nsl/xdr_hyper.3nsl
+usr/src/man/man3nsl/xdr_inline.3nsl
+usr/src/man/man3nsl/xdr_int.3nsl
+usr/src/man/man3nsl/xdr_long.3nsl
+usr/src/man/man3nsl/xdr_longlong_t.3nsl
+usr/src/man/man3nsl/xdr_opaque.3nsl
+usr/src/man/man3nsl/xdr_opaque_auth.3nsl
+usr/src/man/man3nsl/xdr_pointer.3nsl
+usr/src/man/man3nsl/xdr_quadruple.3nsl
+usr/src/man/man3nsl/xdr_reference.3nsl
+usr/src/man/man3nsl/xdr_rejected_reply.3nsl
+usr/src/man/man3nsl/xdr_replymsg.3nsl
+usr/src/man/man3nsl/xdr_setpos.3nsl
+usr/src/man/man3nsl/xdr_short.3nsl
+usr/src/man/man3nsl/xdr_sizeof.3nsl
+usr/src/man/man3nsl/xdr_string.3nsl
+usr/src/man/man3nsl/xdr_u_char.3nsl
+usr/src/man/man3nsl/xdr_u_hyper.3nsl
+usr/src/man/man3nsl/xdr_u_int.3nsl
+usr/src/man/man3nsl/xdr_u_long.3nsl
+usr/src/man/man3nsl/xdr_u_longlong_t.3nsl
+usr/src/man/man3nsl/xdr_u_short.3nsl
+usr/src/man/man3nsl/xdr_union.3nsl
+usr/src/man/man3nsl/xdr_vector.3nsl
+usr/src/man/man3nsl/xdr_void.3nsl
+usr/src/man/man3nsl/xdr_wrapstring.3nsl
+usr/src/man/man3nsl/xdrmem_create.3nsl
+usr/src/man/man3nsl/xdrrec_create.3nsl
+usr/src/man/man3nsl/xdrrec_endofrecord.3nsl
+usr/src/man/man3nsl/xdrrec_eof.3nsl
+usr/src/man/man3nsl/xdrrec_readbytes.3nsl
+usr/src/man/man3nsl/xdrrec_skiprecord.3nsl
+usr/src/man/man3nsl/xdrstdio_create.3nsl
+usr/src/man/man3nsl/xprt_register.3nsl
+usr/src/man/man3nsl/xprt_unregister.3nsl
+usr/src/man/man3nsl/yp_all.3nsl
+usr/src/man/man3nsl/yp_bind.3nsl
+usr/src/man/man3nsl/yp_first.3nsl
+usr/src/man/man3nsl/yp_get_default_domain.3nsl
+usr/src/man/man3nsl/yp_master.3nsl
+usr/src/man/man3nsl/yp_match.3nsl
+usr/src/man/man3nsl/yp_next.3nsl
+usr/src/man/man3nsl/yp_order.3nsl
+usr/src/man/man3nsl/yp_unbind.3nsl
+usr/src/man/man3nsl/yperr_string.3nsl
+usr/src/man/man3nsl/ypprot_err.3nsl
+usr/src/man/man3nvpair/nv_alloc_fini.3nvpair
+usr/src/man/man3nvpair/nv_alloc_init.3nvpair
+usr/src/man/man3nvpair/nv_alloc_reset.3nvpair
+usr/src/man/man3nvpair/nvlist_add_boolean_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_boolean_value.3nvpair
+usr/src/man/man3nvpair/nvlist_add_byte.3nvpair
+usr/src/man/man3nvpair/nvlist_add_byte_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_double.3nvpair
+usr/src/man/man3nvpair/nvlist_add_int16.3nvpair
+usr/src/man/man3nvpair/nvlist_add_int16_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_int32.3nvpair
+usr/src/man/man3nvpair/nvlist_add_int32_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_int64.3nvpair
+usr/src/man/man3nvpair/nvlist_add_int64_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_int8.3nvpair
+usr/src/man/man3nvpair/nvlist_add_int8_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_nvlist.3nvpair
+usr/src/man/man3nvpair/nvlist_add_nvlist_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_nvpair.3nvpair
+usr/src/man/man3nvpair/nvlist_add_string.3nvpair
+usr/src/man/man3nvpair/nvlist_add_string_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_uint16.3nvpair
+usr/src/man/man3nvpair/nvlist_add_uint16_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_uint32.3nvpair
+usr/src/man/man3nvpair/nvlist_add_uint32_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_uint64.3nvpair
+usr/src/man/man3nvpair/nvlist_add_uint64_array.3nvpair
+usr/src/man/man3nvpair/nvlist_add_uint8.3nvpair
+usr/src/man/man3nvpair/nvlist_add_uint8_array.3nvpair
+usr/src/man/man3nvpair/nvlist_dup.3nvpair
+usr/src/man/man3nvpair/nvlist_exists.3nvpair
+usr/src/man/man3nvpair/nvlist_free.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_boolean_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_boolean_value.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_byte.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_byte_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_double.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_int16.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_int16_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_int32.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_int32_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_int64.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_int64_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_int8.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_int8_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_nv_alloc.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_nvlist.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_nvlist_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_pairs.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_string.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_string_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_uint16.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_uint16_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_uint32.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_uint32_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_uint64.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_uint64_array.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_uint8.3nvpair
+usr/src/man/man3nvpair/nvlist_lookup_uint8_array.3nvpair
+usr/src/man/man3nvpair/nvlist_merge.3nvpair
+usr/src/man/man3nvpair/nvlist_pack.3nvpair
+usr/src/man/man3nvpair/nvlist_remove_all.3nvpair
+usr/src/man/man3nvpair/nvlist_size.3nvpair
+usr/src/man/man3nvpair/nvlist_unpack.3nvpair
+usr/src/man/man3nvpair/nvlist_xalloc.3nvpair
+usr/src/man/man3nvpair/nvlist_xdup.3nvpair
+usr/src/man/man3nvpair/nvlist_xpack.3nvpair
+usr/src/man/man3nvpair/nvlist_xunpack.3nvpair
+usr/src/man/man3nvpair/nvpair_name.3nvpair
+usr/src/man/man3nvpair/nvpair_type.3nvpair
+usr/src/man/man3nvpair/nvpair_value_boolean_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_boolean_value.3nvpair
+usr/src/man/man3nvpair/nvpair_value_byte_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_double.3nvpair
+usr/src/man/man3nvpair/nvpair_value_int16.3nvpair
+usr/src/man/man3nvpair/nvpair_value_int16_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_int32.3nvpair
+usr/src/man/man3nvpair/nvpair_value_int32_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_int64.3nvpair
+usr/src/man/man3nvpair/nvpair_value_int64_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_int8.3nvpair
+usr/src/man/man3nvpair/nvpair_value_int8_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_nvlist.3nvpair
+usr/src/man/man3nvpair/nvpair_value_nvlist_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_string.3nvpair
+usr/src/man/man3nvpair/nvpair_value_string_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_uint16.3nvpair
+usr/src/man/man3nvpair/nvpair_value_uint16_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_uint32.3nvpair
+usr/src/man/man3nvpair/nvpair_value_uint32_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_uint64.3nvpair
+usr/src/man/man3nvpair/nvpair_value_uint64_array.3nvpair
+usr/src/man/man3nvpair/nvpair_value_uint8.3nvpair
+usr/src/man/man3nvpair/nvpair_value_uint8_array.3nvpair
+usr/src/man/man3pam/pam_close_session.3pam
+usr/src/man/man3pam/pam_end.3pam
+usr/src/man/man3pam/pam_get_data.3pam
+usr/src/man/man3pam/pam_get_item.3pam
+usr/src/man/man3pam/pam_sm_close_session.3pam
+usr/src/man/man3papi/papiAttributeListAddBoolean.3papi
+usr/src/man/man3papi/papiAttributeListAddCollection.3papi
+usr/src/man/man3papi/papiAttributeListAddDatetime.3papi
+usr/src/man/man3papi/papiAttributeListAddInteger.3papi
+usr/src/man/man3papi/papiAttributeListAddMetadata.3papi
+usr/src/man/man3papi/papiAttributeListAddRange.3papi
+usr/src/man/man3papi/papiAttributeListAddResolution.3papi
+usr/src/man/man3papi/papiAttributeListAddString.3papi
+usr/src/man/man3papi/papiAttributeListDelete.3papi
+usr/src/man/man3papi/papiAttributeListFind.3papi
+usr/src/man/man3papi/papiAttributeListFree.3papi
+usr/src/man/man3papi/papiAttributeListFromString.3papi
+usr/src/man/man3papi/papiAttributeListGetBoolean.3papi
+usr/src/man/man3papi/papiAttributeListGetCollection.3papi
+usr/src/man/man3papi/papiAttributeListGetDatetime.3papi
+usr/src/man/man3papi/papiAttributeListGetInteger.3papi
+usr/src/man/man3papi/papiAttributeListGetMetadata.3papi
+usr/src/man/man3papi/papiAttributeListGetNext.3papi
+usr/src/man/man3papi/papiAttributeListGetRange.3papi
+usr/src/man/man3papi/papiAttributeListGetResolution.3papi
+usr/src/man/man3papi/papiAttributeListGetString.3papi
+usr/src/man/man3papi/papiAttributeListGetValue.3papi
+usr/src/man/man3papi/papiAttributeListToString.3papi
+usr/src/man/man3papi/papiJobCancel.3papi
+usr/src/man/man3papi/papiJobFree.3papi
+usr/src/man/man3papi/papiJobGetAttributeList.3papi
+usr/src/man/man3papi/papiJobGetId.3papi
+usr/src/man/man3papi/papiJobGetJobTicket.3papi
+usr/src/man/man3papi/papiJobGetPrinterName.3papi
+usr/src/man/man3papi/papiJobHold.3papi
+usr/src/man/man3papi/papiJobListFree.3papi
+usr/src/man/man3papi/papiJobModify.3papi
+usr/src/man/man3papi/papiJobMove.3papi
+usr/src/man/man3papi/papiJobPromote.3papi
+usr/src/man/man3papi/papiJobQuery.3papi
+usr/src/man/man3papi/papiJobRelease.3papi
+usr/src/man/man3papi/papiJobRestart.3papi
+usr/src/man/man3papi/papiJobStreamClose.3papi
+usr/src/man/man3papi/papiJobStreamOpen.3papi
+usr/src/man/man3papi/papiJobStreamWrite.3papi
+usr/src/man/man3papi/papiJobSubmitByReference.3papi
+usr/src/man/man3papi/papiJobValidate.3papi
+usr/src/man/man3papi/papiLibrarySupportedCalls.3papi
+usr/src/man/man3papi/papiPrinterAdd.3papi
+usr/src/man/man3papi/papiPrinterDisable.3papi
+usr/src/man/man3papi/papiPrinterEnable.3papi
+usr/src/man/man3papi/papiPrinterFree.3papi
+usr/src/man/man3papi/papiPrinterGetAttributeList.3papi
+usr/src/man/man3papi/papiPrinterListFree.3papi
+usr/src/man/man3papi/papiPrinterListJobs.3papi
+usr/src/man/man3papi/papiPrinterModify.3papi
+usr/src/man/man3papi/papiPrinterPause.3papi
+usr/src/man/man3papi/papiPrinterPurgeJobs.3papi
+usr/src/man/man3papi/papiPrinterQuery.3papi
+usr/src/man/man3papi/papiPrinterRemove.3papi
+usr/src/man/man3papi/papiPrinterResume.3papi
+usr/src/man/man3papi/papiServiceDestroy.3papi
+usr/src/man/man3papi/papiServiceGetAppData.3papi
+usr/src/man/man3papi/papiServiceGetAttributeList.3papi
+usr/src/man/man3papi/papiServiceGetEncryption.3papi
+usr/src/man/man3papi/papiServiceGetPassword.3papi
+usr/src/man/man3papi/papiServiceGetServiceName.3papi
+usr/src/man/man3papi/papiServiceGetStatusMessage.3papi
+usr/src/man/man3papi/papiServiceGetUserName.3papi
+usr/src/man/man3papi/papiServiceSetAppData.3papi
+usr/src/man/man3papi/papiServiceSetAuthCB.3papi
+usr/src/man/man3papi/papiServiceSetEncryption.3papi
+usr/src/man/man3papi/papiServiceSetPassword.3papi
+usr/src/man/man3papi/papiServiceSetUserName.3papi
+usr/src/man/man3picl/picl_get_next_by_col.3picl
+usr/src/man/man3picl/picl_get_next_prop.3picl
+usr/src/man/man3picl/picl_get_propval_by_name.3picl
+usr/src/man/man3picl/picl_set_propval_by_name.3picl
+usr/src/man/man3picltree/ptree_add_row_to_table.3picltree
+usr/src/man/man3picltree/ptree_delete_node.3picltree
+usr/src/man/man3picltree/ptree_delete_prop.3picltree
+usr/src/man/man3picltree/ptree_destroy_node.3picltree
+usr/src/man/man3picltree/ptree_destroy_prop.3picltree
+usr/src/man/man3picltree/ptree_get_next_by_col.3picltree
+usr/src/man/man3picltree/ptree_get_next_prop.3picltree
+usr/src/man/man3picltree/ptree_get_propval_by_name.3picltree
+usr/src/man/man3picltree/ptree_update_propval_by_name.3picltree
+usr/src/man/man3pool/pool_conf_close.3pool
+usr/src/man/man3pool/pool_conf_commit.3pool
+usr/src/man/man3pool/pool_conf_export.3pool
+usr/src/man/man3pool/pool_conf_free.3pool
+usr/src/man/man3pool/pool_conf_info.3pool
+usr/src/man/man3pool/pool_conf_location.3pool
+usr/src/man/man3pool/pool_conf_open.3pool
+usr/src/man/man3pool/pool_conf_remove.3pool
+usr/src/man/man3pool/pool_conf_rollback.3pool
+usr/src/man/man3pool/pool_conf_status.3pool
+usr/src/man/man3pool/pool_conf_to_elem.3pool
+usr/src/man/man3pool/pool_conf_update.3pool
+usr/src/man/man3pool/pool_conf_validate.3pool
+usr/src/man/man3pool/pool_create.3pool
+usr/src/man/man3pool/pool_destroy.3pool
+usr/src/man/man3pool/pool_dissociate.3pool
+usr/src/man/man3pool/pool_get_owning_resource.3pool
+usr/src/man/man3pool/pool_get_resource.3pool
+usr/src/man/man3pool/pool_get_resource_binding.3pool
+usr/src/man/man3pool/pool_get_status.3pool
+usr/src/man/man3pool/pool_info.3pool
+usr/src/man/man3pool/pool_put_property.3pool
+usr/src/man/man3pool/pool_query_components.3pool
+usr/src/man/man3pool/pool_query_pool_resources.3pool
+usr/src/man/man3pool/pool_query_pools.3pool
+usr/src/man/man3pool/pool_query_resource_components.3pool
+usr/src/man/man3pool/pool_query_resources.3pool
+usr/src/man/man3pool/pool_resource_destroy.3pool
+usr/src/man/man3pool/pool_resource_info.3pool
+usr/src/man/man3pool/pool_resource_to_elem.3pool
+usr/src/man/man3pool/pool_resource_transfer.3pool
+usr/src/man/man3pool/pool_resource_type_list.3pool
+usr/src/man/man3pool/pool_resource_xtransfer.3pool
+usr/src/man/man3pool/pool_rm_property.3pool
+usr/src/man/man3pool/pool_set_binding.3pool
+usr/src/man/man3pool/pool_set_status.3pool
+usr/src/man/man3pool/pool_static_location.3pool
+usr/src/man/man3pool/pool_strerror.3pool
+usr/src/man/man3pool/pool_to_elem.3pool
+usr/src/man/man3pool/pool_value_free.3pool
+usr/src/man/man3pool/pool_value_get_bool.3pool
+usr/src/man/man3pool/pool_value_get_double.3pool
+usr/src/man/man3pool/pool_value_get_int64.3pool
+usr/src/man/man3pool/pool_value_get_name.3pool
+usr/src/man/man3pool/pool_value_get_string.3pool
+usr/src/man/man3pool/pool_value_get_type.3pool
+usr/src/man/man3pool/pool_value_get_uint64.3pool
+usr/src/man/man3pool/pool_value_set_bool.3pool
+usr/src/man/man3pool/pool_value_set_double.3pool
+usr/src/man/man3pool/pool_value_set_int64.3pool
+usr/src/man/man3pool/pool_value_set_name.3pool
+usr/src/man/man3pool/pool_value_set_string.3pool
+usr/src/man/man3pool/pool_value_set_uint64.3pool
+usr/src/man/man3pool/pool_version.3pool
+usr/src/man/man3pool/pool_walk_pools.3pool
+usr/src/man/man3pool/pool_walk_properties.3pool
+usr/src/man/man3pool/pool_walk_resources.3pool
+usr/src/man/man3proc/ps_kill.3proc
+usr/src/man/man3proc/ps_lcontinue.3proc
+usr/src/man/man3proc/ps_lgetfpregs.3proc
+usr/src/man/man3proc/ps_lgetxregs.3proc
+usr/src/man/man3proc/ps_lgetxregsize.3proc
+usr/src/man/man3proc/ps_lrolltoaddr.3proc
+usr/src/man/man3proc/ps_lsetfpregs.3proc
+usr/src/man/man3proc/ps_lsetregs.3proc
+usr/src/man/man3proc/ps_lsetxregs.3proc
+usr/src/man/man3proc/ps_lstop.3proc
+usr/src/man/man3proc/ps_pcontinue.3proc
+usr/src/man/man3proc/ps_pdread.3proc
+usr/src/man/man3proc/ps_pdwrite.3proc
+usr/src/man/man3proc/ps_pglobal_sym.3proc
+usr/src/man/man3proc/ps_ptread.3proc
+usr/src/man/man3proc/ps_ptwrite.3proc
+usr/src/man/man3proc/ps_pwrite.3proc
+usr/src/man/man3project/endprojent.3project
+usr/src/man/man3project/fgetprojent.3project
+usr/src/man/man3project/getdefaultproj.3project
+usr/src/man/man3project/getprojbyid.3project
+usr/src/man/man3project/getprojbyname.3project
+usr/src/man/man3project/getprojidbyname.3project
+usr/src/man/man3project/inproj.3project
+usr/src/man/man3project/setprojent.3project
+usr/src/man/man3resolv/dn_comp.3resolv
+usr/src/man/man3resolv/dn_expand.3resolv
+usr/src/man/man3resolv/fp_resstat.3resolv
+usr/src/man/man3resolv/herror.3resolv
+usr/src/man/man3resolv/hstrerror.3resolv
+usr/src/man/man3resolv/res_getservers.3resolv
+usr/src/man/man3resolv/res_hostalias.3resolv
+usr/src/man/man3resolv/res_init.3resolv
+usr/src/man/man3resolv/res_mkquery.3resolv
+usr/src/man/man3resolv/res_nclose.3resolv
+usr/src/man/man3resolv/res_ndestroy.3resolv
+usr/src/man/man3resolv/res_ninit.3resolv
+usr/src/man/man3resolv/res_nmkquery.3resolv
+usr/src/man/man3resolv/res_nquery.3resolv
+usr/src/man/man3resolv/res_nquerydomain.3resolv
+usr/src/man/man3resolv/res_nsearch.3resolv
+usr/src/man/man3resolv/res_nsend.3resolv
+usr/src/man/man3resolv/res_nsendsigned.3resolv
+usr/src/man/man3resolv/res_query.3resolv
+usr/src/man/man3resolv/res_search.3resolv
+usr/src/man/man3resolv/res_send.3resolv
+usr/src/man/man3resolv/res_setservers.3resolv
+usr/src/man/man3rpc/havedisk.3rpc
+usr/src/man/man3rpc/rnusers.3rpc
+usr/src/man/man3rsm/rsm_free_interconnect_topology.3rsm
+usr/src/man/man3rsm/rsm_free_localmemory_handle.3rsm
+usr/src/man/man3rsm/rsm_get_controller_attr.3rsm
+usr/src/man/man3rsm/rsm_intr_signal_wait.3rsm
+usr/src/man/man3rsm/rsm_memseg_export_destroy.3rsm
+usr/src/man/man3rsm/rsm_memseg_export_rebind.3rsm
+usr/src/man/man3rsm/rsm_memseg_export_republish.3rsm
+usr/src/man/man3rsm/rsm_memseg_export_unpublish.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_close_barrier.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_destroy_barrier.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_disconnect.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_get16.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_get32.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_get64.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_get8.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_get_mode.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_getv.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_order_barrier.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_put16.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_put32.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_put64.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_put8.3rsm
+usr/src/man/man3rsm/rsm_memseg_import_unmap.3rsm
+usr/src/man/man3rsm/rsm_memseg_release_pollfd.3rsm
+usr/src/man/man3rsm/rsm_release_controller.3rsm
+usr/src/man/man3sasl/prop_clear.3sasl
+usr/src/man/man3sasl/prop_dispose.3sasl
+usr/src/man/man3sasl/prop_dup.3sasl
+usr/src/man/man3sasl/prop_erase.3sasl
+usr/src/man/man3sasl/prop_format.3sasl
+usr/src/man/man3sasl/prop_get.3sasl
+usr/src/man/man3sasl/prop_getnames.3sasl
+usr/src/man/man3sasl/prop_new.3sasl
+usr/src/man/man3sasl/prop_request.3sasl
+usr/src/man/man3sasl/prop_set.3sasl
+usr/src/man/man3sasl/prop_setvals.3sasl
+usr/src/man/man3sasl/sasl_encodev.3sasl
+usr/src/man/man3scf/scf_count_ranges_destroy.3scf
+usr/src/man/man3scf/scf_entry_add_value.3scf
+usr/src/man/man3scf/scf_entry_destroy.3scf
+usr/src/man/man3scf/scf_entry_destroy_children.3scf
+usr/src/man/man3scf/scf_entry_handle.3scf
+usr/src/man/man3scf/scf_entry_reset.3scf
+usr/src/man/man3scf/scf_handle_bind.3scf
+usr/src/man/man3scf/scf_handle_decorate.3scf
+usr/src/man/man3scf/scf_handle_destroy.3scf
+usr/src/man/man3scf/scf_handle_get_scope.3scf
+usr/src/man/man3scf/scf_handle_unbind.3scf
+usr/src/man/man3scf/scf_instance_add_pg.3scf
+usr/src/man/man3scf/scf_instance_delete.3scf
+usr/src/man/man3scf/scf_instance_destroy.3scf
+usr/src/man/man3scf/scf_instance_get_name.3scf
+usr/src/man/man3scf/scf_instance_get_parent.3scf
+usr/src/man/man3scf/scf_instance_get_pg.3scf
+usr/src/man/man3scf/scf_instance_get_pg_composed.3scf
+usr/src/man/man3scf/scf_instance_get_snapshot.3scf
+usr/src/man/man3scf/scf_instance_handle.3scf
+usr/src/man/man3scf/scf_instance_to_fmri.3scf
+usr/src/man/man3scf/scf_int_ranges_destroy.3scf
+usr/src/man/man3scf/scf_iter_destroy.3scf
+usr/src/man/man3scf/scf_iter_handle.3scf
+usr/src/man/man3scf/scf_iter_handle_scopes.3scf
+usr/src/man/man3scf/scf_iter_instance_pgs.3scf
+usr/src/man/man3scf/scf_iter_instance_pgs_composed.3scf
+usr/src/man/man3scf/scf_iter_instance_pgs_typed.3scf
+usr/src/man/man3scf/scf_iter_instance_pgs_typed_composed.3scf
+usr/src/man/man3scf/scf_iter_instance_snapshots.3scf
+usr/src/man/man3scf/scf_iter_next_instance.3scf
+usr/src/man/man3scf/scf_iter_next_pg.3scf
+usr/src/man/man3scf/scf_iter_next_property.3scf
+usr/src/man/man3scf/scf_iter_next_scope.3scf
+usr/src/man/man3scf/scf_iter_next_service.3scf
+usr/src/man/man3scf/scf_iter_next_snapshot.3scf
+usr/src/man/man3scf/scf_iter_next_value.3scf
+usr/src/man/man3scf/scf_iter_pg_properties.3scf
+usr/src/man/man3scf/scf_iter_property_values.3scf
+usr/src/man/man3scf/scf_iter_reset.3scf
+usr/src/man/man3scf/scf_iter_scope_services.3scf
+usr/src/man/man3scf/scf_iter_service_instances.3scf
+usr/src/man/man3scf/scf_iter_service_pgs.3scf
+usr/src/man/man3scf/scf_iter_service_pgs_typed.3scf
+usr/src/man/man3scf/scf_iter_snaplevel_pgs.3scf
+usr/src/man/man3scf/scf_iter_snaplevel_pgs_typed.3scf
+usr/src/man/man3scf/scf_myname.3scf
+usr/src/man/man3scf/scf_pg_delete.3scf
+usr/src/man/man3scf/scf_pg_destroy.3scf
+usr/src/man/man3scf/scf_pg_get_flags.3scf
+usr/src/man/man3scf/scf_pg_get_name.3scf
+usr/src/man/man3scf/scf_pg_get_parent_instance.3scf
+usr/src/man/man3scf/scf_pg_get_parent_service.3scf
+usr/src/man/man3scf/scf_pg_get_parent_snaplevel.3scf
+usr/src/man/man3scf/scf_pg_get_property.3scf
+usr/src/man/man3scf/scf_pg_get_type.3scf
+usr/src/man/man3scf/scf_pg_get_underlying_pg.3scf
+usr/src/man/man3scf/scf_pg_handle.3scf
+usr/src/man/man3scf/scf_pg_to_fmri.3scf
+usr/src/man/man3scf/scf_pg_update.3scf
+usr/src/man/man3scf/scf_property_destroy.3scf
+usr/src/man/man3scf/scf_property_get_name.3scf
+usr/src/man/man3scf/scf_property_get_value.3scf
+usr/src/man/man3scf/scf_property_handle.3scf
+usr/src/man/man3scf/scf_property_is_type.3scf
+usr/src/man/man3scf/scf_property_to_fmri.3scf
+usr/src/man/man3scf/scf_property_type.3scf
+usr/src/man/man3scf/scf_scope_add_service.3scf
+usr/src/man/man3scf/scf_scope_destroy.3scf
+usr/src/man/man3scf/scf_scope_get_name.3scf
+usr/src/man/man3scf/scf_scope_get_service.3scf
+usr/src/man/man3scf/scf_scope_handle.3scf
+usr/src/man/man3scf/scf_scope_to_fmri.3scf
+usr/src/man/man3scf/scf_service_add_instance.3scf
+usr/src/man/man3scf/scf_service_add_pg.3scf
+usr/src/man/man3scf/scf_service_delete.3scf
+usr/src/man/man3scf/scf_service_destroy.3scf
+usr/src/man/man3scf/scf_service_get_instance.3scf
+usr/src/man/man3scf/scf_service_get_name.3scf
+usr/src/man/man3scf/scf_service_get_parent.3scf
+usr/src/man/man3scf/scf_service_get_pg.3scf
+usr/src/man/man3scf/scf_service_handle.3scf
+usr/src/man/man3scf/scf_service_to_fmri.3scf
+usr/src/man/man3scf/scf_simple_app_props_free.3scf
+usr/src/man/man3scf/scf_simple_app_props_get.3scf
+usr/src/man/man3scf/scf_simple_app_props_next.3scf
+usr/src/man/man3scf/scf_simple_app_props_search.3scf
+usr/src/man/man3scf/scf_simple_prop_free.3scf
+usr/src/man/man3scf/scf_simple_prop_name.3scf
+usr/src/man/man3scf/scf_simple_prop_next_astring.3scf
+usr/src/man/man3scf/scf_simple_prop_next_boolean.3scf
+usr/src/man/man3scf/scf_simple_prop_next_count.3scf
+usr/src/man/man3scf/scf_simple_prop_next_integer.3scf
+usr/src/man/man3scf/scf_simple_prop_next_opaque.3scf
+usr/src/man/man3scf/scf_simple_prop_next_reset.3scf
+usr/src/man/man3scf/scf_simple_prop_next_time.3scf
+usr/src/man/man3scf/scf_simple_prop_next_ustring.3scf
+usr/src/man/man3scf/scf_simple_prop_numvalues.3scf
+usr/src/man/man3scf/scf_simple_prop_pgname.3scf
+usr/src/man/man3scf/scf_simple_prop_type.3scf
+usr/src/man/man3scf/scf_snaplevel_destroy.3scf
+usr/src/man/man3scf/scf_snaplevel_get_instance_name.3scf
+usr/src/man/man3scf/scf_snaplevel_get_next_snaplevel.3scf
+usr/src/man/man3scf/scf_snaplevel_get_parent.3scf
+usr/src/man/man3scf/scf_snaplevel_get_pg.3scf
+usr/src/man/man3scf/scf_snaplevel_get_scope_name.3scf
+usr/src/man/man3scf/scf_snaplevel_get_service_name.3scf
+usr/src/man/man3scf/scf_snaplevel_handle.3scf
+usr/src/man/man3scf/scf_snapshot_destroy.3scf
+usr/src/man/man3scf/scf_snapshot_get_base_snaplevel.3scf
+usr/src/man/man3scf/scf_snapshot_get_name.3scf
+usr/src/man/man3scf/scf_snapshot_get_parent.3scf
+usr/src/man/man3scf/scf_snapshot_handle.3scf
+usr/src/man/man3scf/scf_snapshot_update.3scf
+usr/src/man/man3scf/scf_strerror.3scf
+usr/src/man/man3scf/scf_string_to_type.3scf
+usr/src/man/man3scf/scf_tmpl_error_pg.3scf
+usr/src/man/man3scf/scf_tmpl_error_pg_tmpl.3scf
+usr/src/man/man3scf/scf_tmpl_error_prop.3scf
+usr/src/man/man3scf/scf_tmpl_error_prop_tmpl.3scf
+usr/src/man/man3scf/scf_tmpl_error_source_fmri.3scf
+usr/src/man/man3scf/scf_tmpl_error_type.3scf
+usr/src/man/man3scf/scf_tmpl_error_value.3scf
+usr/src/man/man3scf/scf_tmpl_errors_destroy.3scf
+usr/src/man/man3scf/scf_tmpl_get_by_pg.3scf
+usr/src/man/man3scf/scf_tmpl_get_by_pg_name.3scf
+usr/src/man/man3scf/scf_tmpl_get_by_prop.3scf
+usr/src/man/man3scf/scf_tmpl_iter_pgs.3scf
+usr/src/man/man3scf/scf_tmpl_iter_props.3scf
+usr/src/man/man3scf/scf_tmpl_next_error.3scf
+usr/src/man/man3scf/scf_tmpl_pg_common_name.3scf
+usr/src/man/man3scf/scf_tmpl_pg_description.3scf
+usr/src/man/man3scf/scf_tmpl_pg_destroy.3scf
+usr/src/man/man3scf/scf_tmpl_pg_required.3scf
+usr/src/man/man3scf/scf_tmpl_pg_reset.3scf
+usr/src/man/man3scf/scf_tmpl_pg_target.3scf
+usr/src/man/man3scf/scf_tmpl_pg_type.3scf
+usr/src/man/man3scf/scf_tmpl_prop_cardinality.3scf
+usr/src/man/man3scf/scf_tmpl_prop_common_name.3scf
+usr/src/man/man3scf/scf_tmpl_prop_description.3scf
+usr/src/man/man3scf/scf_tmpl_prop_destroy.3scf
+usr/src/man/man3scf/scf_tmpl_prop_internal_seps.3scf
+usr/src/man/man3scf/scf_tmpl_prop_required.3scf
+usr/src/man/man3scf/scf_tmpl_prop_reset.3scf
+usr/src/man/man3scf/scf_tmpl_prop_type.3scf
+usr/src/man/man3scf/scf_tmpl_prop_units.3scf
+usr/src/man/man3scf/scf_tmpl_prop_visibility.3scf
+usr/src/man/man3scf/scf_tmpl_reset_errors.3scf
+usr/src/man/man3scf/scf_tmpl_strerror.3scf
+usr/src/man/man3scf/scf_tmpl_value_common_name.3scf
+usr/src/man/man3scf/scf_tmpl_value_count_range_choices.3scf
+usr/src/man/man3scf/scf_tmpl_value_count_range_constraints.3scf
+usr/src/man/man3scf/scf_tmpl_value_description.3scf
+usr/src/man/man3scf/scf_tmpl_value_in_constraint.3scf
+usr/src/man/man3scf/scf_tmpl_value_int_range_choices.3scf
+usr/src/man/man3scf/scf_tmpl_value_int_range_constraints.3scf
+usr/src/man/man3scf/scf_tmpl_value_name_choices.3scf
+usr/src/man/man3scf/scf_tmpl_value_name_constraints.3scf
+usr/src/man/man3scf/scf_tmpl_visibility_to_string.3scf
+usr/src/man/man3scf/scf_transaction_commit.3scf
+usr/src/man/man3scf/scf_transaction_destroy.3scf
+usr/src/man/man3scf/scf_transaction_destroy_children.3scf
+usr/src/man/man3scf/scf_transaction_handle.3scf
+usr/src/man/man3scf/scf_transaction_property_change.3scf
+usr/src/man/man3scf/scf_transaction_property_change_type.3scf
+usr/src/man/man3scf/scf_transaction_property_delete.3scf
+usr/src/man/man3scf/scf_transaction_property_new.3scf
+usr/src/man/man3scf/scf_transaction_reset.3scf
+usr/src/man/man3scf/scf_transaction_reset_all.3scf
+usr/src/man/man3scf/scf_transaction_start.3scf
+usr/src/man/man3scf/scf_type_base_type.3scf
+usr/src/man/man3scf/scf_type_to_string.3scf
+usr/src/man/man3scf/scf_value_base_type.3scf
+usr/src/man/man3scf/scf_value_destroy.3scf
+usr/src/man/man3scf/scf_value_get_as_string.3scf
+usr/src/man/man3scf/scf_value_get_as_string_typed.3scf
+usr/src/man/man3scf/scf_value_get_astring.3scf
+usr/src/man/man3scf/scf_value_get_boolean.3scf
+usr/src/man/man3scf/scf_value_get_count.3scf
+usr/src/man/man3scf/scf_value_get_integer.3scf
+usr/src/man/man3scf/scf_value_get_opaque.3scf
+usr/src/man/man3scf/scf_value_get_time.3scf
+usr/src/man/man3scf/scf_value_get_ustring.3scf
+usr/src/man/man3scf/scf_value_handle.3scf
+usr/src/man/man3scf/scf_value_is_type.3scf
+usr/src/man/man3scf/scf_value_reset.3scf
+usr/src/man/man3scf/scf_value_set_astring.3scf
+usr/src/man/man3scf/scf_value_set_boolean.3scf
+usr/src/man/man3scf/scf_value_set_count.3scf
+usr/src/man/man3scf/scf_value_set_from_string.3scf
+usr/src/man/man3scf/scf_value_set_integer.3scf
+usr/src/man/man3scf/scf_value_set_opaque.3scf
+usr/src/man/man3scf/scf_value_set_time.3scf
+usr/src/man/man3scf/scf_value_set_ustring.3scf
+usr/src/man/man3scf/scf_value_type.3scf
+usr/src/man/man3scf/scf_values_destroy.3scf
+usr/src/man/man3scf/smf_degrade_instance.3scf
+usr/src/man/man3scf/smf_disable_instance.3scf
+usr/src/man/man3scf/smf_get_state.3scf
+usr/src/man/man3scf/smf_maintain_instance.3scf
+usr/src/man/man3scf/smf_refresh_instance.3scf
+usr/src/man/man3scf/smf_restart_instance.3scf
+usr/src/man/man3scf/smf_restore_instance.3scf
+usr/src/man/man3sec/acl_fromtext.3sec
+usr/src/man/man3sec/acl_set.3sec
+usr/src/man/man3sec/aclfrommode.3sec
+usr/src/man/man3sec/aclfromtext.3sec
+usr/src/man/man3sec/facl_get.3sec
+usr/src/man/man3sec/facl_set.3sec
+usr/src/man/man3secdb/chkauthattr.3secdb
+usr/src/man/man3secdb/endauthattr.3secdb
+usr/src/man/man3secdb/endexecattr.3secdb
+usr/src/man/man3secdb/endprofattr.3secdb
+usr/src/man/man3secdb/enduserattr.3secdb
+usr/src/man/man3secdb/fgetuserattr.3secdb
+usr/src/man/man3secdb/free_authattr.3secdb
+usr/src/man/man3secdb/free_execattr.3secdb
+usr/src/man/man3secdb/free_profattr.3secdb
+usr/src/man/man3secdb/free_proflist.3secdb
+usr/src/man/man3secdb/free_userattr.3secdb
+usr/src/man/man3secdb/getauthnam.3secdb
+usr/src/man/man3secdb/getexecprof.3secdb
+usr/src/man/man3secdb/getexecuser.3secdb
+usr/src/man/man3secdb/getproflist.3secdb
+usr/src/man/man3secdb/getprofnam.3secdb
+usr/src/man/man3secdb/getusernam.3secdb
+usr/src/man/man3secdb/getuseruid.3secdb
+usr/src/man/man3secdb/match_execattr.3secdb
+usr/src/man/man3secdb/setauthattr.3secdb
+usr/src/man/man3secdb/setexecattr.3secdb
+usr/src/man/man3secdb/setprofattr.3secdb
+usr/src/man/man3secdb/setuserattr.3secdb
+usr/src/man/man3sip/sip_add_accept.3sip
+usr/src/man/man3sip/sip_add_accept_enc.3sip
+usr/src/man/man3sip/sip_add_accept_lang.3sip
+usr/src/man/man3sip/sip_add_alert_info.3sip
+usr/src/man/man3sip/sip_add_allow.3sip
+usr/src/man/man3sip/sip_add_allow_events.3sip
+usr/src/man/man3sip/sip_add_authen_info.3sip
+usr/src/man/man3sip/sip_add_author.3sip
+usr/src/man/man3sip/sip_add_call_info.3sip
+usr/src/man/man3sip/sip_add_callid.3sip
+usr/src/man/man3sip/sip_add_contact.3sip
+usr/src/man/man3sip/sip_add_content.3sip
+usr/src/man/man3sip/sip_add_content_disp.3sip
+usr/src/man/man3sip/sip_add_content_enc.3sip
+usr/src/man/man3sip/sip_add_content_lang.3sip
+usr/src/man/man3sip/sip_add_content_type.3sip
+usr/src/man/man3sip/sip_add_cseq.3sip
+usr/src/man/man3sip/sip_add_date.3sip
+usr/src/man/man3sip/sip_add_error_info.3sip
+usr/src/man/man3sip/sip_add_event.3sip
+usr/src/man/man3sip/sip_add_expires.3sip
+usr/src/man/man3sip/sip_add_in_reply_to.3sip
+usr/src/man/man3sip/sip_add_maxforward.3sip
+usr/src/man/man3sip/sip_add_mime_version.3sip
+usr/src/man/man3sip/sip_add_min_expires.3sip
+usr/src/man/man3sip/sip_add_org.3sip
+usr/src/man/man3sip/sip_add_passertedid.3sip
+usr/src/man/man3sip/sip_add_ppreferredid.3sip
+usr/src/man/man3sip/sip_add_priority.3sip
+usr/src/man/man3sip/sip_add_privacy.3sip
+usr/src/man/man3sip/sip_add_proxy_authen.3sip
+usr/src/man/man3sip/sip_add_proxy_author.3sip
+usr/src/man/man3sip/sip_add_proxy_require.3sip
+usr/src/man/man3sip/sip_add_rack.3sip
+usr/src/man/man3sip/sip_add_record_route.3sip
+usr/src/man/man3sip/sip_add_reply_to.3sip
+usr/src/man/man3sip/sip_add_require.3sip
+usr/src/man/man3sip/sip_add_response_line.3sip
+usr/src/man/man3sip/sip_add_retry_after.3sip
+usr/src/man/man3sip/sip_add_route.3sip
+usr/src/man/man3sip/sip_add_rseq.3sip
+usr/src/man/man3sip/sip_add_server.3sip
+usr/src/man/man3sip/sip_add_subject.3sip
+usr/src/man/man3sip/sip_add_substate.3sip
+usr/src/man/man3sip/sip_add_supported.3sip
+usr/src/man/man3sip/sip_add_to.3sip
+usr/src/man/man3sip/sip_add_tstamp.3sip
+usr/src/man/man3sip/sip_add_unsupported.3sip
+usr/src/man/man3sip/sip_add_user_agent.3sip
+usr/src/man/man3sip/sip_add_via.3sip
+usr/src/man/man3sip/sip_add_warning.3sip
+usr/src/man/man3sip/sip_add_www_authen.3sip
+usr/src/man/man3sip/sip_clear_stale_data.3sip
+usr/src/man/man3sip/sip_conn_destroyed.3sip
+usr/src/man/man3sip/sip_copy_all_headers.3sip
+usr/src/man/man3sip/sip_copy_header.3sip
+usr/src/man/man3sip/sip_copy_header_by_name.3sip
+usr/src/man/man3sip/sip_create_dialog_req_nocontact.3sip
+usr/src/man/man3sip/sip_delete_header.3sip
+usr/src/man/man3sip/sip_delete_header_by_name.3sip
+usr/src/man/man3sip/sip_delete_value.3sip
+usr/src/man/man3sip/sip_disable_counters.3sip
+usr/src/man/man3sip/sip_disable_dialog_logging.3sip
+usr/src/man/man3sip/sip_disable_trans_logging.3sip
+usr/src/man/man3sip/sip_enable_dialog_logging.3sip
+usr/src/man/man3sip/sip_free_msg.3sip
+usr/src/man/man3sip/sip_free_parsed_uri.3sip
+usr/src/man/man3sip/sip_get_accept_enc.3sip
+usr/src/man/man3sip/sip_get_accept_lang.3sip
+usr/src/man/man3sip/sip_get_accept_sub_type.3sip
+usr/src/man/man3sip/sip_get_accept_type.3sip
+usr/src/man/man3sip/sip_get_alert_info_uri.3sip
+usr/src/man/man3sip/sip_get_allow_events.3sip
+usr/src/man/man3sip/sip_get_allow_method.3sip
+usr/src/man/man3sip/sip_get_authen_info.3sip
+usr/src/man/man3sip/sip_get_author_param.3sip
+usr/src/man/man3sip/sip_get_author_scheme.3sip
+usr/src/man/man3sip/sip_get_branchid.3sip
+usr/src/man/man3sip/sip_get_call_info_uri.3sip
+usr/src/man/man3sip/sip_get_callid.3sip
+usr/src/man/man3sip/sip_get_callseq_method.3sip
+usr/src/man/man3sip/sip_get_callseq_num.3sip
+usr/src/man/man3sip/sip_get_contact_uri_str.3sip
+usr/src/man/man3sip/sip_get_content.3sip
+usr/src/man/man3sip/sip_get_content_disp.3sip
+usr/src/man/man3sip/sip_get_content_enc.3sip
+usr/src/man/man3sip/sip_get_content_lang.3sip
+usr/src/man/man3sip/sip_get_content_length.3sip
+usr/src/man/man3sip/sip_get_content_sub_type.3sip
+usr/src/man/man3sip/sip_get_content_type.3sip
+usr/src/man/man3sip/sip_get_counter_value.3sip
+usr/src/man/man3sip/sip_get_date_day.3sip
+usr/src/man/man3sip/sip_get_date_month.3sip
+usr/src/man/man3sip/sip_get_date_time.3sip
+usr/src/man/man3sip/sip_get_date_timezone.3sip
+usr/src/man/man3sip/sip_get_date_wkday.3sip
+usr/src/man/man3sip/sip_get_date_year.3sip
+usr/src/man/man3sip/sip_get_dialog_callid.3sip
+usr/src/man/man3sip/sip_get_dialog_local_contact_uri.3sip
+usr/src/man/man3sip/sip_get_dialog_local_cseq.3sip
+usr/src/man/man3sip/sip_get_dialog_local_tag.3sip
+usr/src/man/man3sip/sip_get_dialog_local_uri.3sip
+usr/src/man/man3sip/sip_get_dialog_method.3sip
+usr/src/man/man3sip/sip_get_dialog_msgcnt.3sip
+usr/src/man/man3sip/sip_get_dialog_remote_cseq.3sip
+usr/src/man/man3sip/sip_get_dialog_remote_tag.3sip
+usr/src/man/man3sip/sip_get_dialog_remote_target_uri.3sip
+usr/src/man/man3sip/sip_get_dialog_remote_uri.3sip
+usr/src/man/man3sip/sip_get_dialog_route_set.3sip
+usr/src/man/man3sip/sip_get_dialog_type.3sip
+usr/src/man/man3sip/sip_get_error_info_uri.3sip
+usr/src/man/man3sip/sip_get_event.3sip
+usr/src/man/man3sip/sip_get_expires.3sip
+usr/src/man/man3sip/sip_get_from_display_name.3sip
+usr/src/man/man3sip/sip_get_from_tag.3sip
+usr/src/man/man3sip/sip_get_from_uri_str.3sip
+usr/src/man/man3sip/sip_get_in_reply_to.3sip
+usr/src/man/man3sip/sip_get_maxforward.3sip
+usr/src/man/man3sip/sip_get_mime_version.3sip
+usr/src/man/man3sip/sip_get_min_expires.3sip
+usr/src/man/man3sip/sip_get_next_value.3sip
+usr/src/man/man3sip/sip_get_org.3sip
+usr/src/man/man3sip/sip_get_params.3sip
+usr/src/man/man3sip/sip_get_passertedid_display_name.3sip
+usr/src/man/man3sip/sip_get_passertedid_uri_str.3sip
+usr/src/man/man3sip/sip_get_ppreferredid_display_name.3sip
+usr/src/man/man3sip/sip_get_ppreferredid_uri_str.3sip
+usr/src/man/man3sip/sip_get_priority.3sip
+usr/src/man/man3sip/sip_get_priv_value.3sip
+usr/src/man/man3sip/sip_get_proxy_authen_param.3sip
+usr/src/man/man3sip/sip_get_proxy_authen_scheme.3sip
+usr/src/man/man3sip/sip_get_proxy_author_param.3sip
+usr/src/man/man3sip/sip_get_proxy_author_scheme.3sip
+usr/src/man/man3sip/sip_get_proxy_require.3sip
+usr/src/man/man3sip/sip_get_rack_cseq_num.3sip
+usr/src/man/man3sip/sip_get_rack_method.3sip
+usr/src/man/man3sip/sip_get_rack_resp_num.3sip
+usr/src/man/man3sip/sip_get_replyto_display_name.3sip
+usr/src/man/man3sip/sip_get_replyto_uri_str.3sip
+usr/src/man/man3sip/sip_get_require.3sip
+usr/src/man/man3sip/sip_get_response_code.3sip
+usr/src/man/man3sip/sip_get_response_phrase.3sip
+usr/src/man/man3sip/sip_get_retry_after_cmts.3sip
+usr/src/man/man3sip/sip_get_retry_after_time.3sip
+usr/src/man/man3sip/sip_get_route_display_name.3sip
+usr/src/man/man3sip/sip_get_route_uri_str.3sip
+usr/src/man/man3sip/sip_get_rseq.3sip
+usr/src/man/man3sip/sip_get_rseq_resp_num.3sip
+usr/src/man/man3sip/sip_get_server.3sip
+usr/src/man/man3sip/sip_get_sip_version.3sip
+usr/src/man/man3sip/sip_get_subject.3sip
+usr/src/man/man3sip/sip_get_substate.3sip
+usr/src/man/man3sip/sip_get_supported.3sip
+usr/src/man/man3sip/sip_get_to_display_name.3sip
+usr/src/man/man3sip/sip_get_to_tag.3sip
+usr/src/man/man3sip/sip_get_to_uri_str.3sip
+usr/src/man/man3sip/sip_get_trans_branchid.3sip
+usr/src/man/man3sip/sip_get_trans_conn_obj.3sip
+usr/src/man/man3sip/sip_get_trans_orig_msg.3sip
+usr/src/man/man3sip/sip_get_trans_resp_msg.3sip
+usr/src/man/man3sip/sip_get_trans_state.3sip
+usr/src/man/man3sip/sip_get_tstamp_delay.3sip
+usr/src/man/man3sip/sip_get_tstamp_value.3sip
+usr/src/man/man3sip/sip_get_unsupported.3sip
+usr/src/man/man3sip/sip_get_uri_errflags.3sip
+usr/src/man/man3sip/sip_get_uri_headers.3sip
+usr/src/man/man3sip/sip_get_uri_host.3sip
+usr/src/man/man3sip/sip_get_uri_opaque.3sip
+usr/src/man/man3sip/sip_get_uri_params.3sip
+usr/src/man/man3sip/sip_get_uri_password.3sip
+usr/src/man/man3sip/sip_get_uri_path.3sip
+usr/src/man/man3sip/sip_get_uri_port.3sip
+usr/src/man/man3sip/sip_get_uri_query.3sip
+usr/src/man/man3sip/sip_get_uri_regname.3sip
+usr/src/man/man3sip/sip_get_uri_scheme.3sip
+usr/src/man/man3sip/sip_get_uri_user.3sip
+usr/src/man/man3sip/sip_get_user_agent.3sip
+usr/src/man/man3sip/sip_get_via_sent_by_host.3sip
+usr/src/man/man3sip/sip_get_via_sent_by_port.3sip
+usr/src/man/man3sip/sip_get_via_sent_protocol_name.3sip
+usr/src/man/man3sip/sip_get_via_sent_protocol_version.3sip
+usr/src/man/man3sip/sip_get_via_sent_transport.3sip
+usr/src/man/man3sip/sip_get_warning_agent.3sip
+usr/src/man/man3sip/sip_get_warning_code.3sip
+usr/src/man/man3sip/sip_get_warning_text.3sip
+usr/src/man/man3sip/sip_get_www_authen_param.3sip
+usr/src/man/man3sip/sip_get_www_authen_scheme.3sip
+usr/src/man/man3sip/sip_hdr_to_str.3sip
+usr/src/man/man3sip/sip_is_dialog_secure.3sip
+usr/src/man/man3sip/sip_is_param_present.3sip
+usr/src/man/man3sip/sip_is_uri_teluser.3sip
+usr/src/man/man3sip/sip_message_is_response.3sip
+usr/src/man/man3sip/sip_release_dialog.3sip
+usr/src/man/man3sip/sip_release_trans.3sip
+usr/src/man/man3sip/sip_reqline_to_str.3sip
+usr/src/man/man3sip/sip_respline_to_str.3sip
+usr/src/man/man3sip/sip_sent_by_to_str.3sip
+usr/src/man/man3sip/sip_unregister_all_sent_by.3sip
+usr/src/man/man3sip/sip_unregister_sent_by.3sip
+usr/src/man/man3sip/sip_uri_errflags_to_str.3sip
+usr/src/man/man3socket/endnetent.3socket
+usr/src/man/man3socket/endprotoent.3socket
+usr/src/man/man3socket/endservent.3socket
+usr/src/man/man3socket/ether_aton.3socket
+usr/src/man/man3socket/ether_hostton.3socket
+usr/src/man/man3socket/ether_line.3socket
+usr/src/man/man3socket/ether_ntoa.3socket
+usr/src/man/man3socket/ether_ntohost.3socket
+usr/src/man/man3socket/freeaddrinfo.3socket
+usr/src/man/man3socket/freehostent.3socket
+usr/src/man/man3socket/gai_strerror.3socket
+usr/src/man/man3socket/getipnodebyaddr.3socket
+usr/src/man/man3socket/getipv4sourcefilter.3socket
+usr/src/man/man3socket/getnameinfo.3socket
+usr/src/man/man3socket/getnetbyaddr.3socket
+usr/src/man/man3socket/getnetbyaddr_r.3socket
+usr/src/man/man3socket/getnetbyname_r.3socket
+usr/src/man/man3socket/getnetent.3socket
+usr/src/man/man3socket/getnetent_r.3socket
+usr/src/man/man3socket/getprotobyname_r.3socket
+usr/src/man/man3socket/getprotobynumber.3socket
+usr/src/man/man3socket/getprotobynumber_r.3socket
+usr/src/man/man3socket/getprotoent.3socket
+usr/src/man/man3socket/getprotoent_r.3socket
+usr/src/man/man3socket/getservbyname_r.3socket
+usr/src/man/man3socket/getservbyport.3socket
+usr/src/man/man3socket/getservbyport_r.3socket
+usr/src/man/man3socket/getservent.3socket
+usr/src/man/man3socket/getservent_r.3socket
+usr/src/man/man3socket/htonl.3socket
+usr/src/man/man3socket/htonll.3socket
+usr/src/man/man3socket/htons.3socket
+usr/src/man/man3socket/if_freenameindex.3socket
+usr/src/man/man3socket/if_indextoname.3socket
+usr/src/man/man3socket/if_nameindex.3socket
+usr/src/man/man3socket/inet6.3socket
+usr/src/man/man3socket/inet6_opt_append.3socket
+usr/src/man/man3socket/inet6_opt_find.3socket
+usr/src/man/man3socket/inet6_opt_finish.3socket
+usr/src/man/man3socket/inet6_opt_get_val.3socket
+usr/src/man/man3socket/inet6_opt_init.3socket
+usr/src/man/man3socket/inet6_opt_next.3socket
+usr/src/man/man3socket/inet6_opt_set_val.3socket
+usr/src/man/man3socket/inet6_rth_add.3socket
+usr/src/man/man3socket/inet6_rth_getaddr.3socket
+usr/src/man/man3socket/inet6_rth_init.3socket
+usr/src/man/man3socket/inet6_rth_reverse.3socket
+usr/src/man/man3socket/inet6_rth_segments.3socket
+usr/src/man/man3socket/inet6_rth_space.3socket
+usr/src/man/man3socket/inet_addr.3socket
+usr/src/man/man3socket/inet_aton.3socket
+usr/src/man/man3socket/inet_lnaof.3socket
+usr/src/man/man3socket/inet_makeaddr.3socket
+usr/src/man/man3socket/inet_netof.3socket
+usr/src/man/man3socket/inet_network.3socket
+usr/src/man/man3socket/inet_ntoa.3socket
+usr/src/man/man3socket/inet_ntop.3socket
+usr/src/man/man3socket/inet_pton.3socket
+usr/src/man/man3socket/ntohl.3socket
+usr/src/man/man3socket/ntohll.3socket
+usr/src/man/man3socket/ntohs.3socket
+usr/src/man/man3socket/rcmd_af.3socket
+usr/src/man/man3socket/recvfrom.3socket
+usr/src/man/man3socket/recvmsg.3socket
+usr/src/man/man3socket/rexec_af.3socket
+usr/src/man/man3socket/rresvport.3socket
+usr/src/man/man3socket/rresvport_af.3socket
+usr/src/man/man3socket/ruserok.3socket
+usr/src/man/man3socket/sctp_freeladdrs.3socket
+usr/src/man/man3socket/sctp_freepaddrs.3socket
+usr/src/man/man3socket/sendmsg.3socket
+usr/src/man/man3socket/sendto.3socket
+usr/src/man/man3socket/setipv4sourcefilter.3socket
+usr/src/man/man3socket/setnetent.3socket
+usr/src/man/man3socket/setprotoent.3socket
+usr/src/man/man3socket/setservent.3socket
+usr/src/man/man3socket/setsockopt.3socket
+usr/src/man/man3socket/setsourcefilter.3socket
+usr/src/man/man3stmf/stmfGetLuProp.3stmf
+usr/src/man/man3stmf/stmfModifyLuByFname.3stmf
+usr/src/man/man3sysevent/sysevent_get_pid.3sysevent
+usr/src/man/man3sysevent/sysevent_get_pub_name.3sysevent
+usr/src/man/man3sysevent/sysevent_get_seq.3sysevent
+usr/src/man/man3sysevent/sysevent_get_size.3sysevent
+usr/src/man/man3sysevent/sysevent_get_subclass_name.3sysevent
+usr/src/man/man3sysevent/sysevent_get_time.3sysevent
+usr/src/man/man3sysevent/sysevent_unbind_handle.3sysevent
+usr/src/man/man3sysevent/sysevent_unsubscribe_event.3sysevent
+usr/src/man/man3tecla/cfc_file_start.3tecla
+usr/src/man/man3tecla/cfc_literal_escapes.3tecla
+usr/src/man/man3tecla/cfc_set_check_fn.3tecla
+usr/src/man/man3tecla/cpl_add_completion.3tecla
+usr/src/man/man3tecla/cpl_check_exe.3tecla
+usr/src/man/man3tecla/cpl_file_completions.3tecla
+usr/src/man/man3tecla/cpl_last_error.3tecla
+usr/src/man/man3tecla/cpl_list_completions.3tecla
+usr/src/man/man3tecla/cpl_recall_matches.3tecla
+usr/src/man/man3tecla/cpl_record_error.3tecla
+usr/src/man/man3tecla/del_CplFileConf.3tecla
+usr/src/man/man3tecla/del_ExpandFile.3tecla
+usr/src/man/man3tecla/del_GetLine.3tecla
+usr/src/man/man3tecla/del_PathCache.3tecla
+usr/src/man/man3tecla/del_PcaPathConf.3tecla
+usr/src/man/man3tecla/del_WordCompletion.3tecla
+usr/src/man/man3tecla/ef_last_error.3tecla
+usr/src/man/man3tecla/ef_list_expansions.3tecla
+usr/src/man/man3tecla/gl_abandon_line.3tecla
+usr/src/man/man3tecla/gl_append_history.3tecla
+usr/src/man/man3tecla/gl_automatic_history.3tecla
+usr/src/man/man3tecla/gl_bind_keyseq.3tecla
+usr/src/man/man3tecla/gl_catch_blocked.3tecla
+usr/src/man/man3tecla/gl_change_terminal.3tecla
+usr/src/man/man3tecla/gl_clear_history.3tecla
+usr/src/man/man3tecla/gl_completion_action.3tecla
+usr/src/man/man3tecla/gl_configure_getline.3tecla
+usr/src/man/man3tecla/gl_customize_completion.3tecla
+usr/src/man/man3tecla/gl_display_text.3tecla
+usr/src/man/man3tecla/gl_echo_mode.3tecla
+usr/src/man/man3tecla/gl_erase_terminal.3tecla
+usr/src/man/man3tecla/gl_error_message.3tecla
+usr/src/man/man3tecla/gl_group_history.3tecla
+usr/src/man/man3tecla/gl_handle_signal.3tecla
+usr/src/man/man3tecla/gl_ignore_signal.3tecla
+usr/src/man/man3tecla/gl_inactivity_timeout.3tecla
+usr/src/man/man3tecla/gl_last_signal.3tecla
+usr/src/man/man3tecla/gl_limit_history.3tecla
+usr/src/man/man3tecla/gl_list_signals.3tecla
+usr/src/man/man3tecla/gl_load_history.3tecla
+usr/src/man/man3tecla/gl_lookup_history.3tecla
+usr/src/man/man3tecla/gl_normal_io.3tecla
+usr/src/man/man3tecla/gl_pending_io.3tecla
+usr/src/man/man3tecla/gl_prompt_style.3tecla
+usr/src/man/man3tecla/gl_query_char.3tecla
+usr/src/man/man3tecla/gl_range_of_history.3tecla
+usr/src/man/man3tecla/gl_raw_io.3tecla
+usr/src/man/man3tecla/gl_read_char.3tecla
+usr/src/man/man3tecla/gl_register_action.3tecla
+usr/src/man/man3tecla/gl_replace_prompt.3tecla
+usr/src/man/man3tecla/gl_resize_history.3tecla
+usr/src/man/man3tecla/gl_return_status.3tecla
+usr/src/man/man3tecla/gl_save_history.3tecla
+usr/src/man/man3tecla/gl_set_term_size.3tecla
+usr/src/man/man3tecla/gl_show_history.3tecla
+usr/src/man/man3tecla/gl_size_of_history.3tecla
+usr/src/man/man3tecla/gl_state_of_history.3tecla
+usr/src/man/man3tecla/gl_terminal_size.3tecla
+usr/src/man/man3tecla/gl_toggle_history.3tecla
+usr/src/man/man3tecla/gl_trap_signal.3tecla
+usr/src/man/man3tecla/gl_tty_signals.3tecla
+usr/src/man/man3tecla/gl_watch_fd.3tecla
+usr/src/man/man3tecla/new_CplFileConf.3tecla
+usr/src/man/man3tecla/new_ExpandFile.3tecla
+usr/src/man/man3tecla/new_GetLine.3tecla
+usr/src/man/man3tecla/new_PathCache.3tecla
+usr/src/man/man3tecla/new_PcaPathConf.3tecla
+usr/src/man/man3tecla/new_WordCompletion.3tecla
+usr/src/man/man3tecla/pca_last_error.3tecla
+usr/src/man/man3tecla/pca_path_completions.3tecla
+usr/src/man/man3tecla/pca_scan_path.3tecla
+usr/src/man/man3tecla/pca_set_check_fn.3tecla
+usr/src/man/man3tecla/ppc_file_start.3tecla
+usr/src/man/man3tecla/ppc_literal_escapes.3tecla
+usr/src/man/man3tnf/TNF_DEBUG.3tnf
+usr/src/man/man3tnf/TNF_DEFINE_RECORD_1.3tnf
+usr/src/man/man3tnf/TNF_DEFINE_RECORD_2.3tnf
+usr/src/man/man3tnf/TNF_DEFINE_RECORD_3.3tnf
+usr/src/man/man3tnf/TNF_DEFINE_RECORD_4.3tnf
+usr/src/man/man3tnf/TNF_DEFINE_RECORD_5.3tnf
+usr/src/man/man3tnf/TNF_PROBE_0.3tnf
+usr/src/man/man3tnf/TNF_PROBE_0_DEBUG.3tnf
+usr/src/man/man3tnf/TNF_PROBE_1.3tnf
+usr/src/man/man3tnf/TNF_PROBE_1_DEBUG.3tnf
+usr/src/man/man3tnf/TNF_PROBE_2.3tnf
+usr/src/man/man3tnf/TNF_PROBE_2_DEBUG.3tnf
+usr/src/man/man3tnf/TNF_PROBE_3.3tnf
+usr/src/man/man3tnf/TNF_PROBE_3_DEBUG.3tnf
+usr/src/man/man3tnf/TNF_PROBE_4.3tnf
+usr/src/man/man3tnf/TNF_PROBE_4_DEBUG.3tnf
+usr/src/man/man3tnf/TNF_PROBE_5.3tnf
+usr/src/man/man3tnf/TNF_PROBE_5_DEBUG.3tnf
+usr/src/man/man3tnf/tnf_process_enable.3tnf
+usr/src/man/man3tnf/tnf_thread_disable.3tnf
+usr/src/man/man3tnf/tnf_thread_enable.3tnf
+usr/src/man/man3tnf/tnfctl_buffer_dealloc.3tnf
+usr/src/man/man3tnf/tnfctl_check_libs.3tnf
+usr/src/man/man3tnf/tnfctl_continue.3tnf
+usr/src/man/man3tnf/tnfctl_exec_open.3tnf
+usr/src/man/man3tnf/tnfctl_filter_list_add.3tnf
+usr/src/man/man3tnf/tnfctl_filter_list_delete.3tnf
+usr/src/man/man3tnf/tnfctl_filter_list_get.3tnf
+usr/src/man/man3tnf/tnfctl_filter_state_set.3tnf
+usr/src/man/man3tnf/tnfctl_probe_apply_ids.3tnf
+usr/src/man/man3tnf/tnfctl_probe_connect.3tnf
+usr/src/man/man3tnf/tnfctl_probe_disable.3tnf
+usr/src/man/man3tnf/tnfctl_probe_disconnect_all.3tnf
+usr/src/man/man3tnf/tnfctl_probe_enable.3tnf
+usr/src/man/man3tnf/tnfctl_probe_trace.3tnf
+usr/src/man/man3tnf/tnfctl_probe_untrace.3tnf
+usr/src/man/man3tsol/Xbcleartos.3tsol
+usr/src/man/man3tsol/Xbsltos.3tsol
+usr/src/man/man3tsol/bcleartoh.3tsol
+usr/src/man/man3tsol/bcleartoh_r.3tsol
+usr/src/man/man3tsol/bcleartos.3tsol
+usr/src/man/man3tsol/bldominates.3tsol
+usr/src/man/man3tsol/blequal.3tsol
+usr/src/man/man3tsol/blinrange.3tsol
+usr/src/man/man3tsol/blmaximum.3tsol
+usr/src/man/man3tsol/blminimum.3tsol
+usr/src/man/man3tsol/blstrictdom.3tsol
+usr/src/man/man3tsol/bltocolor_r.3tsol
+usr/src/man/man3tsol/bsltoh.3tsol
+usr/src/man/man3tsol/bsltoh_r.3tsol
+usr/src/man/man3tsol/bsltos.3tsol
+usr/src/man/man3tsol/getzoneidbylabel.3tsol
+usr/src/man/man3tsol/getzonelabelbyname.3tsol
+usr/src/man/man3tsol/getzonerootbylabel.3tsol
+usr/src/man/man3tsol/getzonerootbyname.3tsol
+usr/src/man/man3tsol/h_alloc.3tsol
+usr/src/man/man3tsol/h_free.3tsol
+usr/src/man/man3tsol/htobclear.3tsol
+usr/src/man/man3tsol/htobsl.3tsol
+usr/src/man/man3tsol/m_label_alloc.3tsol
+usr/src/man/man3tsol/m_label_dup.3tsol
+usr/src/man/man3tsol/m_label_free.3tsol
+usr/src/man/man3tsol/sbcleartos.3tsol
+usr/src/man/man3tsol/sbsltos.3tsol
+usr/src/man/man3tsol/stobclear.3tsol
+usr/src/man/man3tsol/stobsl.3tsol
+usr/src/man/man3uuid/uuid_compare.3uuid
+usr/src/man/man3uuid/uuid_copy.3uuid
+usr/src/man/man3uuid/uuid_generate.3uuid
+usr/src/man/man3uuid/uuid_generate_random.3uuid
+usr/src/man/man3uuid/uuid_generate_time.3uuid
+usr/src/man/man3uuid/uuid_is_null.3uuid
+usr/src/man/man3uuid/uuid_parse.3uuid
+usr/src/man/man3uuid/uuid_time.3uuid
+usr/src/man/man3uuid/uuid_unparse.3uuid
+usr/src/man/man3volmgt/media_setattr.3volmgt
+usr/src/man/man3volmgt/volmgt_symdev.3volmgt
+usr/src/man/man3xcurses/COLORS.3xcurses
+usr/src/man/man3xcurses/COLOR_PAIR.3xcurses
+usr/src/man/man3xcurses/COLOR_PAIRS.3xcurses
+usr/src/man/man3xcurses/PAIR_NUMBER.3xcurses
+usr/src/man/man3xcurses/add_wchstr.3xcurses
+usr/src/man/man3xcurses/addchnstr.3xcurses
+usr/src/man/man3xcurses/addstr.3xcurses
+usr/src/man/man3xcurses/addwstr.3xcurses
+usr/src/man/man3xcurses/attr_off.3xcurses
+usr/src/man/man3xcurses/attr_on.3xcurses
+usr/src/man/man3xcurses/attr_set.3xcurses
+usr/src/man/man3xcurses/attron.3xcurses
+usr/src/man/man3xcurses/attrset.3xcurses
+usr/src/man/man3xcurses/bkgdset.3xcurses
+usr/src/man/man3xcurses/bkgrndset.3xcurses
+usr/src/man/man3xcurses/box.3xcurses
+usr/src/man/man3xcurses/box_set.3xcurses
+usr/src/man/man3xcurses/color_content.3xcurses
+usr/src/man/man3xcurses/color_set.3xcurses
+usr/src/man/man3xcurses/def_shell_mode.3xcurses
+usr/src/man/man3xcurses/erase.3xcurses
+usr/src/man/man3xcurses/erasewchar.3xcurses
+usr/src/man/man3xcurses/flash.3xcurses
+usr/src/man/man3xcurses/get_wstr.3xcurses
+usr/src/man/man3xcurses/getbkgd.3xcurses
+usr/src/man/man3xcurses/getbkgrnd.3xcurses
+usr/src/man/man3xcurses/getmaxyx.3xcurses
+usr/src/man/man3xcurses/getparyx.3xcurses
+usr/src/man/man3xcurses/getstr.3xcurses
+usr/src/man/man3xcurses/getyx.3xcurses
+usr/src/man/man3xcurses/has_colors.3xcurses
+usr/src/man/man3xcurses/has_il.3xcurses
+usr/src/man/man3xcurses/idlok.3xcurses
+usr/src/man/man3xcurses/in_wchstr.3xcurses
+usr/src/man/man3xcurses/inchstr.3xcurses
+usr/src/man/man3xcurses/init_color.3xcurses
+usr/src/man/man3xcurses/init_pair.3xcurses
+usr/src/man/man3xcurses/ins_wstr.3xcurses
+usr/src/man/man3xcurses/insstr.3xcurses
+usr/src/man/man3xcurses/instr.3xcurses
+usr/src/man/man3xcurses/inwstr.3xcurses
+usr/src/man/man3xcurses/is_wintouched.3xcurses
+usr/src/man/man3xcurses/isendwin.3xcurses
+usr/src/man/man3xcurses/key_name.3xcurses
+usr/src/man/man3xcurses/killchar.3xcurses
+usr/src/man/man3xcurses/killwchar.3xcurses
+usr/src/man/man3xcurses/leaveok.3xcurses
+usr/src/man/man3xcurses/mvadd_wch.3xcurses
+usr/src/man/man3xcurses/mvadd_wchnstr.3xcurses
+usr/src/man/man3xcurses/mvadd_wchstr.3xcurses
+usr/src/man/man3xcurses/mvaddch.3xcurses
+usr/src/man/man3xcurses/mvaddchnstr.3xcurses
+usr/src/man/man3xcurses/mvaddchstr.3xcurses
+usr/src/man/man3xcurses/mvaddnstr.3xcurses
+usr/src/man/man3xcurses/mvaddnwstr.3xcurses
+usr/src/man/man3xcurses/mvaddstr.3xcurses
+usr/src/man/man3xcurses/mvaddwstr.3xcurses
+usr/src/man/man3xcurses/mvchgat.3xcurses
+usr/src/man/man3xcurses/mvdelch.3xcurses
+usr/src/man/man3xcurses/mvget_wch.3xcurses
+usr/src/man/man3xcurses/mvget_wstr.3xcurses
+usr/src/man/man3xcurses/mvgetch.3xcurses
+usr/src/man/man3xcurses/mvgetn_wstr.3xcurses
+usr/src/man/man3xcurses/mvgetnstr.3xcurses
+usr/src/man/man3xcurses/mvgetstr.3xcurses
+usr/src/man/man3xcurses/mvhline.3xcurses
+usr/src/man/man3xcurses/mvhline_set.3xcurses
+usr/src/man/man3xcurses/mvin_wch.3xcurses
+usr/src/man/man3xcurses/mvin_wchnstr.3xcurses
+usr/src/man/man3xcurses/mvin_wchstr.3xcurses
+usr/src/man/man3xcurses/mvinch.3xcurses
+usr/src/man/man3xcurses/mvinchnstr.3xcurses
+usr/src/man/man3xcurses/mvinchstr.3xcurses
+usr/src/man/man3xcurses/mvinnstr.3xcurses
+usr/src/man/man3xcurses/mvinnwstr.3xcurses
+usr/src/man/man3xcurses/mvins_nwstr.3xcurses
+usr/src/man/man3xcurses/mvins_wch.3xcurses
+usr/src/man/man3xcurses/mvins_wstr.3xcurses
+usr/src/man/man3xcurses/mvinsch.3xcurses
+usr/src/man/man3xcurses/mvinsnstr.3xcurses
+usr/src/man/man3xcurses/mvinsstr.3xcurses
+usr/src/man/man3xcurses/mvinstr.3xcurses
+usr/src/man/man3xcurses/mvinwstr.3xcurses
+usr/src/man/man3xcurses/mvvline.3xcurses
+usr/src/man/man3xcurses/mvvline_set.3xcurses
+usr/src/man/man3xcurses/mvwadd_wch.3xcurses
+usr/src/man/man3xcurses/mvwadd_wchnstr.3xcurses
+usr/src/man/man3xcurses/mvwadd_wchstr.3xcurses
+usr/src/man/man3xcurses/mvwaddch.3xcurses
+usr/src/man/man3xcurses/mvwaddchnstr.3xcurses
+usr/src/man/man3xcurses/mvwaddchstr.3xcurses
+usr/src/man/man3xcurses/mvwaddnstr.3xcurses
+usr/src/man/man3xcurses/mvwaddnwstr.3xcurses
+usr/src/man/man3xcurses/mvwaddstr.3xcurses
+usr/src/man/man3xcurses/mvwaddwstr.3xcurses
+usr/src/man/man3xcurses/mvwchgat.3xcurses
+usr/src/man/man3xcurses/mvwdelch.3xcurses
+usr/src/man/man3xcurses/mvwget_wch.3xcurses
+usr/src/man/man3xcurses/mvwget_wstr.3xcurses
+usr/src/man/man3xcurses/mvwgetch.3xcurses
+usr/src/man/man3xcurses/mvwgetn_wstr.3xcurses
+usr/src/man/man3xcurses/mvwgetnstr.3xcurses
+usr/src/man/man3xcurses/mvwgetstr.3xcurses
+usr/src/man/man3xcurses/mvwhline.3xcurses
+usr/src/man/man3xcurses/mvwhline_set.3xcurses
+usr/src/man/man3xcurses/mvwin_wch.3xcurses
+usr/src/man/man3xcurses/mvwin_wchnstr.3xcurses
+usr/src/man/man3xcurses/mvwin_wchstr.3xcurses
+usr/src/man/man3xcurses/mvwinch.3xcurses
+usr/src/man/man3xcurses/mvwinchnstr.3xcurses
+usr/src/man/man3xcurses/mvwinchstr.3xcurses
+usr/src/man/man3xcurses/mvwinnstr.3xcurses
+usr/src/man/man3xcurses/mvwinnwstr.3xcurses
+usr/src/man/man3xcurses/mvwins_nwstr.3xcurses
+usr/src/man/man3xcurses/mvwins_wch.3xcurses
+usr/src/man/man3xcurses/mvwins_wstr.3xcurses
+usr/src/man/man3xcurses/mvwinsch.3xcurses
+usr/src/man/man3xcurses/mvwinsnstr.3xcurses
+usr/src/man/man3xcurses/mvwinsstr.3xcurses
+usr/src/man/man3xcurses/mvwinstr.3xcurses
+usr/src/man/man3xcurses/mvwinwstr.3xcurses
+usr/src/man/man3xcurses/mvwprintw.3xcurses
+usr/src/man/man3xcurses/mvwscanw.3xcurses
+usr/src/man/man3xcurses/mvwvline.3xcurses
+usr/src/man/man3xcurses/mvwvline_set.3xcurses
+usr/src/man/man3xcurses/newterm.3xcurses
+usr/src/man/man3xcurses/newwin.3xcurses
+usr/src/man/man3xcurses/nocbreak.3xcurses
+usr/src/man/man3xcurses/noecho.3xcurses
+usr/src/man/man3xcurses/nonl.3xcurses
+usr/src/man/man3xcurses/noraw.3xcurses
+usr/src/man/man3xcurses/overwrite.3xcurses
+usr/src/man/man3xcurses/pair_content.3xcurses
+usr/src/man/man3xcurses/pecho_wchar.3xcurses
+usr/src/man/man3xcurses/pnoutrefresh.3xcurses
+usr/src/man/man3xcurses/prefresh.3xcurses
+usr/src/man/man3xcurses/printw.3xcurses
+usr/src/man/man3xcurses/putwin.3xcurses
+usr/src/man/man3xcurses/qiflush.3xcurses
+usr/src/man/man3xcurses/raw.3xcurses
+usr/src/man/man3xcurses/refresh.3xcurses
+usr/src/man/man3xcurses/reset_prog_mode.3xcurses
+usr/src/man/man3xcurses/reset_shell_mode.3xcurses
+usr/src/man/man3xcurses/restartterm.3xcurses
+usr/src/man/man3xcurses/savetty.3xcurses
+usr/src/man/man3xcurses/scanw.3xcurses
+usr/src/man/man3xcurses/scr_init.3xcurses
+usr/src/man/man3xcurses/scr_restore.3xcurses
+usr/src/man/man3xcurses/scr_set.3xcurses
+usr/src/man/man3xcurses/scroll.3xcurses
+usr/src/man/man3xcurses/scrollok.3xcurses
+usr/src/man/man3xcurses/set_curterm.3xcurses
+usr/src/man/man3xcurses/setscrreg.3xcurses
+usr/src/man/man3xcurses/setupterm.3xcurses
+usr/src/man/man3xcurses/slk_attr_off.3xcurses
+usr/src/man/man3xcurses/slk_attr_on.3xcurses
+usr/src/man/man3xcurses/slk_attr_set.3xcurses
+usr/src/man/man3xcurses/slk_attron.3xcurses
+usr/src/man/man3xcurses/slk_attrset.3xcurses
+usr/src/man/man3xcurses/slk_clear.3xcurses
+usr/src/man/man3xcurses/slk_color.3xcurses
+usr/src/man/man3xcurses/slk_init.3xcurses
+usr/src/man/man3xcurses/slk_label.3xcurses
+usr/src/man/man3xcurses/slk_noutrefresh.3xcurses
+usr/src/man/man3xcurses/slk_refresh.3xcurses
+usr/src/man/man3xcurses/slk_restore.3xcurses
+usr/src/man/man3xcurses/slk_set.3xcurses
+usr/src/man/man3xcurses/slk_touch.3xcurses
+usr/src/man/man3xcurses/slk_wset.3xcurses
+usr/src/man/man3xcurses/standout.3xcurses
+usr/src/man/man3xcurses/start_color.3xcurses
+usr/src/man/man3xcurses/subpad.3xcurses
+usr/src/man/man3xcurses/subwin.3xcurses
+usr/src/man/man3xcurses/term_attrs.3xcurses
+usr/src/man/man3xcurses/tgetflag.3xcurses
+usr/src/man/man3xcurses/tgetnum.3xcurses
+usr/src/man/man3xcurses/tgetstr.3xcurses
+usr/src/man/man3xcurses/tgoto.3xcurses
+usr/src/man/man3xcurses/tigetnum.3xcurses
+usr/src/man/man3xcurses/tigetstr.3xcurses
+usr/src/man/man3xcurses/timeout.3xcurses
+usr/src/man/man3xcurses/touchline.3xcurses
+usr/src/man/man3xcurses/touchwin.3xcurses
+usr/src/man/man3xcurses/tparm.3xcurses
+usr/src/man/man3xcurses/tputs.3xcurses
+usr/src/man/man3xcurses/unget_wch.3xcurses
+usr/src/man/man3xcurses/untouchwin.3xcurses
+usr/src/man/man3xcurses/vid_attr.3xcurses
+usr/src/man/man3xcurses/vid_puts.3xcurses
+usr/src/man/man3xcurses/vidputs.3xcurses
+usr/src/man/man3xcurses/vline.3xcurses
+usr/src/man/man3xcurses/vline_set.3xcurses
+usr/src/man/man3xcurses/wadd_wch.3xcurses
+usr/src/man/man3xcurses/wadd_wchnstr.3xcurses
+usr/src/man/man3xcurses/wadd_wchstr.3xcurses
+usr/src/man/man3xcurses/waddch.3xcurses
+usr/src/man/man3xcurses/waddchnstr.3xcurses
+usr/src/man/man3xcurses/waddchstr.3xcurses
+usr/src/man/man3xcurses/waddnstr.3xcurses
+usr/src/man/man3xcurses/waddnwstr.3xcurses
+usr/src/man/man3xcurses/waddstr.3xcurses
+usr/src/man/man3xcurses/waddwstr.3xcurses
+usr/src/man/man3xcurses/wattr_get.3xcurses
+usr/src/man/man3xcurses/wattr_off.3xcurses
+usr/src/man/man3xcurses/wattr_on.3xcurses
+usr/src/man/man3xcurses/wattr_set.3xcurses
+usr/src/man/man3xcurses/wattroff.3xcurses
+usr/src/man/man3xcurses/wattron.3xcurses
+usr/src/man/man3xcurses/wattrset.3xcurses
+usr/src/man/man3xcurses/wbkgd.3xcurses
+usr/src/man/man3xcurses/wbkgdset.3xcurses
+usr/src/man/man3xcurses/wbkgrnd.3xcurses
+usr/src/man/man3xcurses/wbkgrndset.3xcurses
+usr/src/man/man3xcurses/wborder.3xcurses
+usr/src/man/man3xcurses/wborder_set.3xcurses
+usr/src/man/man3xcurses/wchgat.3xcurses
+usr/src/man/man3xcurses/wclear.3xcurses
+usr/src/man/man3xcurses/wclrtobot.3xcurses
+usr/src/man/man3xcurses/wclrtoeol.3xcurses
+usr/src/man/man3xcurses/wcolor_set.3xcurses
+usr/src/man/man3xcurses/wcursyncup.3xcurses
+usr/src/man/man3xcurses/wdelch.3xcurses
+usr/src/man/man3xcurses/wdeleteln.3xcurses
+usr/src/man/man3xcurses/wecho_wchar.3xcurses
+usr/src/man/man3xcurses/wechochar.3xcurses
+usr/src/man/man3xcurses/werase.3xcurses
+usr/src/man/man3xcurses/wget_wch.3xcurses
+usr/src/man/man3xcurses/wget_wstr.3xcurses
+usr/src/man/man3xcurses/wgetbkgrnd.3xcurses
+usr/src/man/man3xcurses/wgetch.3xcurses
+usr/src/man/man3xcurses/wgetn_wstr.3xcurses
+usr/src/man/man3xcurses/wgetnstr.3xcurses
+usr/src/man/man3xcurses/wgetstr.3xcurses
+usr/src/man/man3xcurses/whline.3xcurses
+usr/src/man/man3xcurses/whline_set.3xcurses
+usr/src/man/man3xcurses/win_wch.3xcurses
+usr/src/man/man3xcurses/win_wchnstr.3xcurses
+usr/src/man/man3xcurses/win_wchstr.3xcurses
+usr/src/man/man3xcurses/winch.3xcurses
+usr/src/man/man3xcurses/winchnstr.3xcurses
+usr/src/man/man3xcurses/winchstr.3xcurses
+usr/src/man/man3xcurses/winnstr.3xcurses
+usr/src/man/man3xcurses/winnwstr.3xcurses
+usr/src/man/man3xcurses/wins_nwstr.3xcurses
+usr/src/man/man3xcurses/wins_wch.3xcurses
+usr/src/man/man3xcurses/wins_wstr.3xcurses
+usr/src/man/man3xcurses/winsch.3xcurses
+usr/src/man/man3xcurses/winsdelln.3xcurses
+usr/src/man/man3xcurses/winsertln.3xcurses
+usr/src/man/man3xcurses/winsnstr.3xcurses
+usr/src/man/man3xcurses/winsstr.3xcurses
+usr/src/man/man3xcurses/winstr.3xcurses
+usr/src/man/man3xcurses/winwstr.3xcurses
+usr/src/man/man3xcurses/wmove.3xcurses
+usr/src/man/man3xcurses/wnoutrefresh.3xcurses
+usr/src/man/man3xcurses/wprintw.3xcurses
+usr/src/man/man3xcurses/wredrawln.3xcurses
+usr/src/man/man3xcurses/wrefresh.3xcurses
+usr/src/man/man3xcurses/wscanw.3xcurses
+usr/src/man/man3xcurses/wscrl.3xcurses
+usr/src/man/man3xcurses/wsetscrreg.3xcurses
+usr/src/man/man3xcurses/wstandend.3xcurses
+usr/src/man/man3xcurses/wstandout.3xcurses
+usr/src/man/man3xcurses/wsyncdown.3xcurses
+usr/src/man/man3xcurses/wsyncup.3xcurses
+usr/src/man/man3xcurses/wtimeout.3xcurses
+usr/src/man/man3xcurses/wtouchln.3xcurses
+usr/src/man/man3xcurses/wvline.3xcurses
+usr/src/man/man3xcurses/wvline_set.3xcurses
+usr/src/man/man3xnet/getaddrinfo.3xnet
+usr/src/man/man3xnet/gethostbyaddr.3xnet
+usr/src/man/man3xnet/gethostbyname.3xnet
+usr/src/man/man3xnet/gethostent.3xnet
+usr/src/man/man3xnet/getnetbyaddr.3xnet
+usr/src/man/man3xnet/getnetbyname.3xnet
+usr/src/man/man3xnet/getnetent.3xnet
+usr/src/man/man3xnet/getprotobyname.3xnet
+usr/src/man/man3xnet/getprotobynumber.3xnet
+usr/src/man/man3xnet/getprotoent.3xnet
+usr/src/man/man3xnet/getservbyname.3xnet
+usr/src/man/man3xnet/getservbyport.3xnet
+usr/src/man/man3xnet/getservent.3xnet
+usr/src/man/man3xnet/htons.3xnet
+usr/src/man/man3xnet/if_freenameindex.3xnet
+usr/src/man/man3xnet/if_indextoname.3xnet
+usr/src/man/man3xnet/if_nameindex.3xnet
+usr/src/man/man3xnet/inet_lnaof.3xnet
+usr/src/man/man3xnet/inet_makeaddr.3xnet
+usr/src/man/man3xnet/inet_netof.3xnet
+usr/src/man/man3xnet/inet_network.3xnet
+usr/src/man/man3xnet/inet_ntoa.3xnet
+usr/src/man/man3xnet/inet_pton.3xnet
+usr/src/man/man3xnet/ntohl.3xnet
+usr/src/man/man3xnet/ntohs.3xnet
+usr/src/man/man3xnet/sethostent.3xnet
+usr/src/man/man3xnet/setnetent.3xnet
+usr/src/man/man3xnet/setprotoent.3xnet
+usr/src/man/man3xnet/setservent.3xnet
+usr/src/man/man4/addresses.4
+usr/src/man/man4/devid_cache.4
+usr/src/man/man4/devname_cache.4
+usr/src/man/man4/dir.4
+usr/src/man/man4/dumpdates.4
+usr/src/man/man4/fbtab.4
+usr/src/man/man4/forward.4
+usr/src/man/man4/fs.4
+usr/src/man/man4/intro.4
+usr/src/man/man4/isa.4
+usr/src/man/man4/md.cf.4
+usr/src/man/man4/mdi_ib_cache.4
+usr/src/man/man4/mdi_scsi_vhci_cache.4
+usr/src/man/man4/pci_unitaddr_persistent.4
+usr/src/man/man4/pcie.4
+usr/src/man/man4/qop.4
+usr/src/man/man4/rhosts.4
+usr/src/man/man4/sendmail.cf.4
+usr/src/man/man4/snapshot_cache.4
+usr/src/man/man4/submit.cf.4
+usr/src/man/man4/volume-defaults.4
+usr/src/man/man4/wtmp.4
+usr/src/man/man4/wtmpx.4
+usr/src/man/man5/ANSI.5
+usr/src/man/man5/C++.5
+usr/src/man/man5/C.5
+usr/src/man/man5/CSI.5
+usr/src/man/man5/ISO.5
+usr/src/man/man5/MT-Level.5
+usr/src/man/man5/POSIX.1.5
+usr/src/man/man5/POSIX.2.5
+usr/src/man/man5/POSIX.5
+usr/src/man/man5/RBAC.5
+usr/src/man/man5/SUS.5
+usr/src/man/man5/SUSv2.5
+usr/src/man/man5/SUSv3.5
+usr/src/man/man5/SVID.5
+usr/src/man/man5/SVID3.5
+usr/src/man/man5/XNS.5
+usr/src/man/man5/XNS4.5
+usr/src/man/man5/XNS5.5
+usr/src/man/man5/XPG.5
+usr/src/man/man5/XPG3.5
+usr/src/man/man5/XPG4.5
+usr/src/man/man5/XPG4v2.5
+usr/src/man/man5/advance.5
+usr/src/man/man5/architecture.5
+usr/src/man/man5/availability.5
+usr/src/man/man5/compile.5
+usr/src/man/man5/intro.5
+usr/src/man/man5/pthreads.5
+usr/src/man/man5/stability.5
+usr/src/man/man5/standard.5
+usr/src/man/man5/step.5
+usr/src/man/man5/teclarc.5
+usr/src/man/man7/intro.7
+usr/src/man/man7d/1394.7d
+usr/src/man/man7d/allkmem.7d
+usr/src/man/man7d/bscbus.7d
+usr/src/man/man7d/fdc.7d
+usr/src/man/man7d/firewire.7d
+usr/src/man/man7d/hwa1480_fw.7d
+usr/src/man/man7d/i2bsc.7d
+usr/src/man/man7d/kmem.7d
+usr/src/man/man7d/lo0.7d
+usr/src/man/man7d/ticots.7d
+usr/src/man/man7d/ticotsord.7d
+usr/src/man/man7d/urandom.7d
+usr/src/man/man7d/usb.7d
+usr/src/man/man7d/uwb.7d
+usr/src/man/man7m/vuid2ps2.7m
+usr/src/man/man7m/vuid3ps2.7m
+usr/src/man/man7m/vuidm3p.7m
+usr/src/man/man7m/vuidm4p.7m
+usr/src/man/man7m/vuidm5p.7m
+usr/src/man/man7p/AH.7p
+usr/src/man/man7p/ARP.7p
+usr/src/man/man7p/ESP.7p
+usr/src/man/man7p/ICMP.7p
+usr/src/man/man7p/IP.7p
+usr/src/man/man7p/RARP.7p
+usr/src/man/man7p/SCTP.7p
+usr/src/man/man7p/TCP.7p
+usr/src/man/man7p/UDP.7p
+usr/src/man/man7p/if.7p
+usr/src/man/man9/Intro.9
+usr/src/man/man9/intro.9
+usr/src/man/man9e/_info.9e
+usr/src/man/man9e/_init.9e
+usr/src/man/man9e/gldm_get_stats.9e
+usr/src/man/man9e/gldm_intr.9e
+usr/src/man/man9e/gldm_ioctl.9e
+usr/src/man/man9e/gldm_reset.9e
+usr/src/man/man9e/gldm_send.9e
+usr/src/man/man9e/gldm_set_mac_addr.9e
+usr/src/man/man9e/gldm_set_multicast.9e
+usr/src/man/man9e/gldm_set_promiscuous.9e
+usr/src/man/man9e/gldm_start.9e
+usr/src/man/man9e/gldm_stop.9e
+usr/src/man/man9e/intro.9e
+usr/src/man/man9e/tran_destroy_pkt.9e
+usr/src/man/man9e/tran_pkt_constructor.9e
+usr/src/man/man9e/tran_pkt_destructor.9e
+usr/src/man/man9e/tran_setcap.9e
+usr/src/man/man9e/tran_teardown_pkt.9e
+usr/src/man/man9e/tran_unquiesce.9e
+usr/src/man/man9f/SIZEOF_PTR.9f
+usr/src/man/man9f/SIZEOF_STRUCT.9f
+usr/src/man/man9f/STRUCT_BUF.9f
+usr/src/man/man9f/STRUCT_FADDR.9f
+usr/src/man/man9f/STRUCT_FGET.9f
+usr/src/man/man9f/STRUCT_FGETP.9f
+usr/src/man/man9f/STRUCT_FSET.9f
+usr/src/man/man9f/STRUCT_FSETP.9f
+usr/src/man/man9f/STRUCT_HANDLE.9f
+usr/src/man/man9f/STRUCT_INIT.9f
+usr/src/man/man9f/STRUCT_SET_HANDLE.9f
+usr/src/man/man9f/STRUCT_SIZE.9f
+usr/src/man/man9f/assert.9f
+usr/src/man/man9f/atomic_add_16.9f
+usr/src/man/man9f/atomic_add_16_nv.9f
+usr/src/man/man9f/atomic_add_32.9f
+usr/src/man/man9f/atomic_add_32_nv.9f
+usr/src/man/man9f/atomic_add_64.9f
+usr/src/man/man9f/atomic_add_64_nv.9f
+usr/src/man/man9f/atomic_add_8.9f
+usr/src/man/man9f/atomic_add_8_nv.9f
+usr/src/man/man9f/atomic_add_char.9f
+usr/src/man/man9f/atomic_add_char_nv.9f
+usr/src/man/man9f/atomic_add_int.9f
+usr/src/man/man9f/atomic_add_int_nv.9f
+usr/src/man/man9f/atomic_add_long.9f
+usr/src/man/man9f/atomic_add_long_nv.9f
+usr/src/man/man9f/atomic_add_ptr.9f
+usr/src/man/man9f/atomic_add_ptr_nv.9f
+usr/src/man/man9f/atomic_add_short.9f
+usr/src/man/man9f/atomic_add_short_nv.9f
+usr/src/man/man9f/atomic_and_16.9f
+usr/src/man/man9f/atomic_and_16_nv.9f
+usr/src/man/man9f/atomic_and_32.9f
+usr/src/man/man9f/atomic_and_32_nv.9f
+usr/src/man/man9f/atomic_and_64.9f
+usr/src/man/man9f/atomic_and_64_nv.9f
+usr/src/man/man9f/atomic_and_8.9f
+usr/src/man/man9f/atomic_and_8_nv.9f
+usr/src/man/man9f/atomic_and_uchar.9f
+usr/src/man/man9f/atomic_and_uchar_nv.9f
+usr/src/man/man9f/atomic_and_uint.9f
+usr/src/man/man9f/atomic_and_uint_nv.9f
+usr/src/man/man9f/atomic_and_ulong.9f
+usr/src/man/man9f/atomic_and_ulong_nv.9f
+usr/src/man/man9f/atomic_and_ushort.9f
+usr/src/man/man9f/atomic_and_ushort_nv.9f
+usr/src/man/man9f/atomic_cas_16.9f
+usr/src/man/man9f/atomic_cas_32.9f
+usr/src/man/man9f/atomic_cas_64.9f
+usr/src/man/man9f/atomic_cas_8.9f
+usr/src/man/man9f/atomic_cas_ptr.9f
+usr/src/man/man9f/atomic_cas_uchar.9f
+usr/src/man/man9f/atomic_cas_uint.9f
+usr/src/man/man9f/atomic_cas_ulong.9f
+usr/src/man/man9f/atomic_cas_ushort.9f
+usr/src/man/man9f/atomic_clear_long_excl.9f
+usr/src/man/man9f/atomic_dec_16.9f
+usr/src/man/man9f/atomic_dec_16_nv.9f
+usr/src/man/man9f/atomic_dec_32.9f
+usr/src/man/man9f/atomic_dec_32_nv.9f
+usr/src/man/man9f/atomic_dec_64.9f
+usr/src/man/man9f/atomic_dec_64_nv.9f
+usr/src/man/man9f/atomic_dec_8.9f
+usr/src/man/man9f/atomic_dec_8_nv.9f
+usr/src/man/man9f/atomic_dec_ptr.9f
+usr/src/man/man9f/atomic_dec_ptr_nv.9f
+usr/src/man/man9f/atomic_dec_uchar.9f
+usr/src/man/man9f/atomic_dec_uchar_nv.9f
+usr/src/man/man9f/atomic_dec_uint.9f
+usr/src/man/man9f/atomic_dec_uint_nv.9f
+usr/src/man/man9f/atomic_dec_ulong.9f
+usr/src/man/man9f/atomic_dec_ulong_nv.9f
+usr/src/man/man9f/atomic_dec_ushort.9f
+usr/src/man/man9f/atomic_dec_ushort_nv.9f
+usr/src/man/man9f/atomic_inc_16.9f
+usr/src/man/man9f/atomic_inc_16_nv.9f
+usr/src/man/man9f/atomic_inc_32.9f
+usr/src/man/man9f/atomic_inc_32_nv.9f
+usr/src/man/man9f/atomic_inc_64.9f
+usr/src/man/man9f/atomic_inc_64_nv.9f
+usr/src/man/man9f/atomic_inc_8.9f
+usr/src/man/man9f/atomic_inc_8_nv.9f
+usr/src/man/man9f/atomic_inc_ptr.9f
+usr/src/man/man9f/atomic_inc_ptr_nv.9f
+usr/src/man/man9f/atomic_inc_uchar.9f
+usr/src/man/man9f/atomic_inc_uchar_nv.9f
+usr/src/man/man9f/atomic_inc_uint.9f
+usr/src/man/man9f/atomic_inc_uint_nv.9f
+usr/src/man/man9f/atomic_inc_ulong.9f
+usr/src/man/man9f/atomic_inc_ulong_nv.9f
+usr/src/man/man9f/atomic_inc_ushort.9f
+usr/src/man/man9f/atomic_inc_ushort_nv.9f
+usr/src/man/man9f/atomic_or_16.9f
+usr/src/man/man9f/atomic_or_16_nv.9f
+usr/src/man/man9f/atomic_or_32.9f
+usr/src/man/man9f/atomic_or_32_nv.9f
+usr/src/man/man9f/atomic_or_64.9f
+usr/src/man/man9f/atomic_or_64_nv.9f
+usr/src/man/man9f/atomic_or_8.9f
+usr/src/man/man9f/atomic_or_8_nv.9f
+usr/src/man/man9f/atomic_or_uchar.9f
+usr/src/man/man9f/atomic_or_uchar_nv.9f
+usr/src/man/man9f/atomic_or_uint.9f
+usr/src/man/man9f/atomic_or_uint_nv.9f
+usr/src/man/man9f/atomic_or_ulong.9f
+usr/src/man/man9f/atomic_or_ulong_nv.9f
+usr/src/man/man9f/atomic_or_ushort.9f
+usr/src/man/man9f/atomic_or_ushort_nv.9f
+usr/src/man/man9f/atomic_set_long_excl.9f
+usr/src/man/man9f/atomic_swap_16.9f
+usr/src/man/man9f/atomic_swap_32.9f
+usr/src/man/man9f/atomic_swap_64.9f
+usr/src/man/man9f/atomic_swap_8.9f
+usr/src/man/man9f/atomic_swap_ptr.9f
+usr/src/man/man9f/atomic_swap_uchar.9f
+usr/src/man/man9f/atomic_swap_uint.9f
+usr/src/man/man9f/atomic_swap_ulong.9f
+usr/src/man/man9f/atomic_swap_ushort.9f
+usr/src/man/man9f/crgetgid.9f
+usr/src/man/man9f/crgetgroups.9f
+usr/src/man/man9f/crgetngroups.9f
+usr/src/man/man9f/crgetrgid.9f
+usr/src/man/man9f/crgetruid.9f
+usr/src/man/man9f/crgetsgid.9f
+usr/src/man/man9f/crgetsuid.9f
+usr/src/man/man9f/crgetuid.9f
+usr/src/man/man9f/crgetzoneid.9f
+usr/src/man/man9f/csx_Get16.9f
+usr/src/man/man9f/csx_Get32.9f
+usr/src/man/man9f/csx_Get64.9f
+usr/src/man/man9f/csx_GetEventMask.9f
+usr/src/man/man9f/csx_GetNextClient.9f
+usr/src/man/man9f/csx_GetNextTuple.9f
+usr/src/man/man9f/csx_Parse_CISTPL_DEVICE_A.9f
+usr/src/man/man9f/csx_Parse_CISTPL_DEVICE_OA.9f
+usr/src/man/man9f/csx_Parse_CISTPL_DEVICE_OC.9f
+usr/src/man/man9f/csx_Parse_CISTPL_JEDEC_A.9f
+usr/src/man/man9f/csx_Parse_CISTPL_LONGLINK_C.9f
+usr/src/man/man9f/csx_Put16.9f
+usr/src/man/man9f/csx_Put32.9f
+usr/src/man/man9f/csx_Put64.9f
+usr/src/man/man9f/csx_ReleaseIO.9f
+usr/src/man/man9f/csx_ReleaseIRQ.9f
+usr/src/man/man9f/csx_ReleaseSocketMask.9f
+usr/src/man/man9f/csx_ReleaseWindow.9f
+usr/src/man/man9f/csx_RemoveDeviceNode.9f
+usr/src/man/man9f/csx_RepGet16.9f
+usr/src/man/man9f/csx_RepGet32.9f
+usr/src/man/man9f/csx_RepGet64.9f
+usr/src/man/man9f/csx_RepPut16.9f
+usr/src/man/man9f/csx_RepPut32.9f
+usr/src/man/man9f/csx_RepPut64.9f
+usr/src/man/man9f/cv_broadcast.9f
+usr/src/man/man9f/cv_destroy.9f
+usr/src/man/man9f/cv_init.9f
+usr/src/man/man9f/cv_reltimedwait.9f
+usr/src/man/man9f/cv_reltimedwait_sig.9f
+usr/src/man/man9f/cv_signal.9f
+usr/src/man/man9f/cv_timedwait.9f
+usr/src/man/man9f/cv_timedwait_sig.9f
+usr/src/man/man9f/cv_wait.9f
+usr/src/man/man9f/cv_wait_sig.9f
+usr/src/man/man9f/ddi_btopr.9f
+usr/src/man/man9f/ddi_cb_unregister.9f
+usr/src/man/man9f/ddi_check_dma_handle.9f
+usr/src/man/man9f/ddi_devid_free.9f
+usr/src/man/man9f/ddi_devid_get.9f
+usr/src/man/man9f/ddi_devid_init.9f
+usr/src/man/man9f/ddi_devid_register.9f
+usr/src/man/man9f/ddi_devid_sizeof.9f
+usr/src/man/man9f/ddi_devid_str_decode.9f
+usr/src/man/man9f/ddi_devid_str_encode.9f
+usr/src/man/man9f/ddi_devid_str_free.9f
+usr/src/man/man9f/ddi_devid_unregister.9f
+usr/src/man/man9f/ddi_devid_valid.9f
+usr/src/man/man9f/ddi_devmap_segmap.9f
+usr/src/man/man9f/ddi_dmae_1stparty.9f
+usr/src/man/man9f/ddi_dmae_alloc.9f
+usr/src/man/man9f/ddi_dmae_disable.9f
+usr/src/man/man9f/ddi_dmae_enable.9f
+usr/src/man/man9f/ddi_dmae_getattr.9f
+usr/src/man/man9f/ddi_dmae_getcnt.9f
+usr/src/man/man9f/ddi_dmae_getlim.9f
+usr/src/man/man9f/ddi_dmae_prog.9f
+usr/src/man/man9f/ddi_dmae_release.9f
+usr/src/man/man9f/ddi_dmae_stop.9f
+usr/src/man/man9f/ddi_exit_critical.9f
+usr/src/man/man9f/ddi_fls.9f
+usr/src/man/man9f/ddi_fm_capable.9f
+usr/src/man/man9f/ddi_fm_dma_err_clear.9f
+usr/src/man/man9f/ddi_fm_dma_err_get.9f
+usr/src/man/man9f/ddi_fm_fini.9f
+usr/src/man/man9f/ddi_fm_handler_unregister.9f
+usr/src/man/man9f/ddi_get16.9f
+usr/src/man/man9f/ddi_get32.9f
+usr/src/man/man9f/ddi_get64.9f
+usr/src/man/man9f/ddi_get_iblock_cookie.9f
+usr/src/man/man9f/ddi_get_lbolt64.9f
+usr/src/man/man9f/ddi_get_name.9f
+usr/src/man/man9f/ddi_get_soft_iblock_cookie.9f
+usr/src/man/man9f/ddi_get_soft_state.9f
+usr/src/man/man9f/ddi_getb.9f
+usr/src/man/man9f/ddi_getl.9f
+usr/src/man/man9f/ddi_getll.9f
+usr/src/man/man9f/ddi_getlongprop.9f
+usr/src/man/man9f/ddi_getlongprop_buf.9f
+usr/src/man/man9f/ddi_getprop.9f
+usr/src/man/man9f/ddi_getproplen.9f
+usr/src/man/man9f/ddi_getw.9f
+usr/src/man/man9f/ddi_intr_block_disable.9f
+usr/src/man/man9f/ddi_intr_block_enable.9f
+usr/src/man/man9f/ddi_intr_clr_mask.9f
+usr/src/man/man9f/ddi_intr_disable.9f
+usr/src/man/man9f/ddi_intr_free.9f
+usr/src/man/man9f/ddi_intr_get_navail.9f
+usr/src/man/man9f/ddi_intr_get_softint_pri.9f
+usr/src/man/man9f/ddi_intr_remove_handler.9f
+usr/src/man/man9f/ddi_intr_remove_softint.9f
+usr/src/man/man9f/ddi_intr_set_cap.9f
+usr/src/man/man9f/ddi_intr_set_pri.9f
+usr/src/man/man9f/ddi_intr_set_softint_pri.9f
+usr/src/man/man9f/ddi_intr_trigger_softint.9f
+usr/src/man/man9f/ddi_io_get16.9f
+usr/src/man/man9f/ddi_io_get32.9f
+usr/src/man/man9f/ddi_io_getb.9f
+usr/src/man/man9f/ddi_io_getl.9f
+usr/src/man/man9f/ddi_io_getw.9f
+usr/src/man/man9f/ddi_io_put16.9f
+usr/src/man/man9f/ddi_io_put32.9f
+usr/src/man/man9f/ddi_io_putb.9f
+usr/src/man/man9f/ddi_io_putl.9f
+usr/src/man/man9f/ddi_io_putw.9f
+usr/src/man/man9f/ddi_io_rep_get16.9f
+usr/src/man/man9f/ddi_io_rep_get32.9f
+usr/src/man/man9f/ddi_io_rep_getb.9f
+usr/src/man/man9f/ddi_io_rep_getl.9f
+usr/src/man/man9f/ddi_io_rep_getw.9f
+usr/src/man/man9f/ddi_io_rep_put16.9f
+usr/src/man/man9f/ddi_io_rep_put32.9f
+usr/src/man/man9f/ddi_io_rep_putb.9f
+usr/src/man/man9f/ddi_io_rep_putl.9f
+usr/src/man/man9f/ddi_io_rep_putw.9f
+usr/src/man/man9f/ddi_iopb_free.9f
+usr/src/man/man9f/ddi_mem_free.9f
+usr/src/man/man9f/ddi_mem_get16.9f
+usr/src/man/man9f/ddi_mem_get32.9f
+usr/src/man/man9f/ddi_mem_get64.9f
+usr/src/man/man9f/ddi_mem_getb.9f
+usr/src/man/man9f/ddi_mem_getl.9f
+usr/src/man/man9f/ddi_mem_getll.9f
+usr/src/man/man9f/ddi_mem_getw.9f
+usr/src/man/man9f/ddi_mem_put16.9f
+usr/src/man/man9f/ddi_mem_put32.9f
+usr/src/man/man9f/ddi_mem_put64.9f
+usr/src/man/man9f/ddi_mem_putb.9f
+usr/src/man/man9f/ddi_mem_putl.9f
+usr/src/man/man9f/ddi_mem_putll.9f
+usr/src/man/man9f/ddi_mem_putw.9f
+usr/src/man/man9f/ddi_mem_rep_get16.9f
+usr/src/man/man9f/ddi_mem_rep_get32.9f
+usr/src/man/man9f/ddi_mem_rep_get64.9f
+usr/src/man/man9f/ddi_mem_rep_getb.9f
+usr/src/man/man9f/ddi_mem_rep_getl.9f
+usr/src/man/man9f/ddi_mem_rep_getll.9f
+usr/src/man/man9f/ddi_mem_rep_getw.9f
+usr/src/man/man9f/ddi_mem_rep_put16.9f
+usr/src/man/man9f/ddi_mem_rep_put32.9f
+usr/src/man/man9f/ddi_mem_rep_put64.9f
+usr/src/man/man9f/ddi_mem_rep_putb.9f
+usr/src/man/man9f/ddi_mem_rep_putl.9f
+usr/src/man/man9f/ddi_mem_rep_putll.9f
+usr/src/man/man9f/ddi_mem_rep_putw.9f
+usr/src/man/man9f/ddi_modclose.9f
+usr/src/man/man9f/ddi_modsym.9f
+usr/src/man/man9f/ddi_peek16.9f
+usr/src/man/man9f/ddi_peek32.9f
+usr/src/man/man9f/ddi_peek64.9f
+usr/src/man/man9f/ddi_peek8.9f
+usr/src/man/man9f/ddi_peekc.9f
+usr/src/man/man9f/ddi_peekd.9f
+usr/src/man/man9f/ddi_peekl.9f
+usr/src/man/man9f/ddi_peeks.9f
+usr/src/man/man9f/ddi_poke16.9f
+usr/src/man/man9f/ddi_poke32.9f
+usr/src/man/man9f/ddi_poke64.9f
+usr/src/man/man9f/ddi_poke8.9f
+usr/src/man/man9f/ddi_pokec.9f
+usr/src/man/man9f/ddi_poked.9f
+usr/src/man/man9f/ddi_pokel.9f
+usr/src/man/man9f/ddi_pokes.9f
+usr/src/man/man9f/ddi_prop_free.9f
+usr/src/man/man9f/ddi_prop_get_int64.9f
+usr/src/man/man9f/ddi_prop_lookup_byte_array.9f
+usr/src/man/man9f/ddi_prop_lookup_int64_array.9f
+usr/src/man/man9f/ddi_prop_lookup_int_array.9f
+usr/src/man/man9f/ddi_prop_lookup_string.9f
+usr/src/man/man9f/ddi_prop_lookup_string_array.9f
+usr/src/man/man9f/ddi_prop_modify.9f
+usr/src/man/man9f/ddi_prop_remove.9f
+usr/src/man/man9f/ddi_prop_remove_all.9f
+usr/src/man/man9f/ddi_prop_undefine.9f
+usr/src/man/man9f/ddi_prop_update_byte_array.9f
+usr/src/man/man9f/ddi_prop_update_int.9f
+usr/src/man/man9f/ddi_prop_update_int64.9f
+usr/src/man/man9f/ddi_prop_update_int64_array.9f
+usr/src/man/man9f/ddi_prop_update_int_array.9f
+usr/src/man/man9f/ddi_prop_update_string.9f
+usr/src/man/man9f/ddi_prop_update_string_array.9f
+usr/src/man/man9f/ddi_ptob.9f
+usr/src/man/man9f/ddi_put16.9f
+usr/src/man/man9f/ddi_put32.9f
+usr/src/man/man9f/ddi_put64.9f
+usr/src/man/man9f/ddi_putb.9f
+usr/src/man/man9f/ddi_putl.9f
+usr/src/man/man9f/ddi_putll.9f
+usr/src/man/man9f/ddi_putw.9f
+usr/src/man/man9f/ddi_remove_intr.9f
+usr/src/man/man9f/ddi_remove_softintr.9f
+usr/src/man/man9f/ddi_rep_get16.9f
+usr/src/man/man9f/ddi_rep_get32.9f
+usr/src/man/man9f/ddi_rep_get64.9f
+usr/src/man/man9f/ddi_rep_getb.9f
+usr/src/man/man9f/ddi_rep_getl.9f
+usr/src/man/man9f/ddi_rep_getll.9f
+usr/src/man/man9f/ddi_rep_getw.9f
+usr/src/man/man9f/ddi_rep_put16.9f
+usr/src/man/man9f/ddi_rep_put32.9f
+usr/src/man/man9f/ddi_rep_put64.9f
+usr/src/man/man9f/ddi_rep_putb.9f
+usr/src/man/man9f/ddi_rep_putl.9f
+usr/src/man/man9f/ddi_rep_putll.9f
+usr/src/man/man9f/ddi_rep_putw.9f
+usr/src/man/man9f/ddi_segmap_setup.9f
+usr/src/man/man9f/ddi_set_driver_private.9f
+usr/src/man/man9f/ddi_soft_state_fini.9f
+usr/src/man/man9f/ddi_soft_state_free.9f
+usr/src/man/man9f/ddi_soft_state_init.9f
+usr/src/man/man9f/ddi_soft_state_zalloc.9f
+usr/src/man/man9f/ddi_strdup.9f
+usr/src/man/man9f/ddi_strtoull.9f
+usr/src/man/man9f/ddi_taskq_create.9f
+usr/src/man/man9f/ddi_taskq_destroy.9f
+usr/src/man/man9f/ddi_taskq_dispatch.9f
+usr/src/man/man9f/ddi_taskq_resume.9f
+usr/src/man/man9f/ddi_taskq_suspend.9f
+usr/src/man/man9f/ddi_taskq_wait.9f
+usr/src/man/man9f/ddi_trigger_softintr.9f
+usr/src/man/man9f/ddi_umem_free.9f
+usr/src/man/man9f/ddi_umem_unlock.9f
+usr/src/man/man9f/ddi_unmap_regs.9f
+usr/src/man/man9f/desballoc.9f
+usr/src/man/man9f/devmap_load.9f
+usr/src/man/man9f/devmap_umem_setup.9f
+usr/src/man/man9f/dlerrorack.9f
+usr/src/man/man9f/dlokack.9f
+usr/src/man/man9f/dlphysaddrack.9f
+usr/src/man/man9f/dluderrorind.9f
+usr/src/man/man9f/free_pktiopb.9f
+usr/src/man/man9f/gld_intr.9f
+usr/src/man/man9f/gld_mac_alloc.9f
+usr/src/man/man9f/gld_mac_free.9f
+usr/src/man/man9f/gld_recv.9f
+usr/src/man/man9f/gld_register.9f
+usr/src/man/man9f/gld_sched.9f
+usr/src/man/man9f/gld_unregister.9f
+usr/src/man/man9f/id32_free.9f
+usr/src/man/man9f/id32_lookup.9f
+usr/src/man/man9f/inl.9f
+usr/src/man/man9f/intro.9f
+usr/src/man/man9f/inw.9f
+usr/src/man/man9f/kmem_cache_alloc.9f
+usr/src/man/man9f/kmem_cache_destroy.9f
+usr/src/man/man9f/kmem_cache_free.9f
+usr/src/man/man9f/kmem_cache_set_move.9f
+usr/src/man/man9f/kmem_free.9f
+usr/src/man/man9f/kmem_zalloc.9f
+usr/src/man/man9f/kstat_named_setstr.9f
+usr/src/man/man9f/kstat_runq_back_to_waitq.9f
+usr/src/man/man9f/kstat_runq_enter.9f
+usr/src/man/man9f/kstat_runq_exit.9f
+usr/src/man/man9f/kstat_waitq_enter.9f
+usr/src/man/man9f/kstat_waitq_exit.9f
+usr/src/man/man9f/kstat_waitq_to_runq.9f
+usr/src/man/man9f/ldi_awrite.9f
+usr/src/man/man9f/ldi_close.9f
+usr/src/man/man9f/ldi_get_devid.9f
+usr/src/man/man9f/ldi_get_minor_name.9f
+usr/src/man/man9f/ldi_get_otyp.9f
+usr/src/man/man9f/ldi_getmsg.9f
+usr/src/man/man9f/ldi_ident_from_dip.9f
+usr/src/man/man9f/ldi_ident_from_stream.9f
+usr/src/man/man9f/ldi_ident_release.9f
+usr/src/man/man9f/ldi_open_by_devid.9f
+usr/src/man/man9f/ldi_open_by_name.9f
+usr/src/man/man9f/ldi_prop_get_int64.9f
+usr/src/man/man9f/ldi_prop_lookup_byte_array.9f
+usr/src/man/man9f/ldi_prop_lookup_int64_array.9f
+usr/src/man/man9f/ldi_prop_lookup_string.9f
+usr/src/man/man9f/ldi_prop_lookup_string_array.9f
+usr/src/man/man9f/ldi_write.9f
+usr/src/man/man9f/list_destroy.9f
+usr/src/man/man9f/list_head.9f
+usr/src/man/man9f/list_insert_after.9f
+usr/src/man/man9f/list_insert_before.9f
+usr/src/man/man9f/list_insert_head.9f
+usr/src/man/man9f/list_insert_tail.9f
+usr/src/man/man9f/list_is_empty.9f
+usr/src/man/man9f/list_link_active.9f
+usr/src/man/man9f/list_link_init.9f
+usr/src/man/man9f/list_link_replace.9f
+usr/src/man/man9f/list_move_tail.9f
+usr/src/man/man9f/list_next.9f
+usr/src/man/man9f/list_prev.9f
+usr/src/man/man9f/list_remove.9f
+usr/src/man/man9f/list_remove_head.9f
+usr/src/man/man9f/list_remove_tail.9f
+usr/src/man/man9f/list_tail.9f
+usr/src/man/man9f/makecom_g0.9f
+usr/src/man/man9f/makecom_g0_s.9f
+usr/src/man/man9f/makecom_g1.9f
+usr/src/man/man9f/makecom_g5.9f
+usr/src/man/man9f/membar_consumer.9f
+usr/src/man/man9f/membar_enter.9f
+usr/src/man/man9f/membar_exit.9f
+usr/src/man/man9f/membar_producer.9f
+usr/src/man/man9f/memcmp.9f
+usr/src/man/man9f/memcpy.9f
+usr/src/man/man9f/memmove.9f
+usr/src/man/man9f/memset.9f
+usr/src/man/man9f/minphys.9f
+usr/src/man/man9f/mod_info.9f
+usr/src/man/man9f/mod_modname.9f
+usr/src/man/man9f/mod_remove.9f
+usr/src/man/man9f/mutex_destroy.9f
+usr/src/man/man9f/mutex_enter.9f
+usr/src/man/man9f/mutex_exit.9f
+usr/src/man/man9f/mutex_init.9f
+usr/src/man/man9f/mutex_owned.9f
+usr/src/man/man9f/mutex_tryenter.9f
+usr/src/man/man9f/net_event_notify_unregister.9f
+usr/src/man/man9f/net_instance_notify_unregister.9f
+usr/src/man/man9f/net_instance_protocol_unregister.9f
+usr/src/man/man9f/numtos.9f
+usr/src/man/man9f/nv_alloc_fini.9f
+usr/src/man/man9f/nv_alloc_init.9f
+usr/src/man/man9f/nvlist_add_boolean_array.9f
+usr/src/man/man9f/nvlist_add_boolean_value.9f
+usr/src/man/man9f/nvlist_add_byte.9f
+usr/src/man/man9f/nvlist_add_byte_array.9f
+usr/src/man/man9f/nvlist_add_int16.9f
+usr/src/man/man9f/nvlist_add_int16_array.9f
+usr/src/man/man9f/nvlist_add_int32.9f
+usr/src/man/man9f/nvlist_add_int32_array.9f
+usr/src/man/man9f/nvlist_add_int64.9f
+usr/src/man/man9f/nvlist_add_int64_array.9f
+usr/src/man/man9f/nvlist_add_int8.9f
+usr/src/man/man9f/nvlist_add_int8_array.9f
+usr/src/man/man9f/nvlist_add_nvlist.9f
+usr/src/man/man9f/nvlist_add_nvlist_array.9f
+usr/src/man/man9f/nvlist_add_nvpair.9f
+usr/src/man/man9f/nvlist_add_string.9f
+usr/src/man/man9f/nvlist_add_string_array.9f
+usr/src/man/man9f/nvlist_add_uint16.9f
+usr/src/man/man9f/nvlist_add_uint16_array.9f
+usr/src/man/man9f/nvlist_add_uint32.9f
+usr/src/man/man9f/nvlist_add_uint32_array.9f
+usr/src/man/man9f/nvlist_add_uint64.9f
+usr/src/man/man9f/nvlist_add_uint64_array.9f
+usr/src/man/man9f/nvlist_add_uint8.9f
+usr/src/man/man9f/nvlist_add_uint8_array.9f
+usr/src/man/man9f/nvlist_dup.9f
+usr/src/man/man9f/nvlist_exists.9f
+usr/src/man/man9f/nvlist_free.9f
+usr/src/man/man9f/nvlist_lookup_boolean_array.9f
+usr/src/man/man9f/nvlist_lookup_boolean_value.9f
+usr/src/man/man9f/nvlist_lookup_byte.9f
+usr/src/man/man9f/nvlist_lookup_byte_array.9f
+usr/src/man/man9f/nvlist_lookup_int16.9f
+usr/src/man/man9f/nvlist_lookup_int16_array.9f
+usr/src/man/man9f/nvlist_lookup_int32.9f
+usr/src/man/man9f/nvlist_lookup_int32_array.9f
+usr/src/man/man9f/nvlist_lookup_int64.9f
+usr/src/man/man9f/nvlist_lookup_int64_array.9f
+usr/src/man/man9f/nvlist_lookup_int8.9f
+usr/src/man/man9f/nvlist_lookup_int8_array.9f
+usr/src/man/man9f/nvlist_lookup_nvlist.9f
+usr/src/man/man9f/nvlist_lookup_nvlist_array.9f
+usr/src/man/man9f/nvlist_lookup_pairs.9f
+usr/src/man/man9f/nvlist_lookup_string.9f
+usr/src/man/man9f/nvlist_lookup_string_array.9f
+usr/src/man/man9f/nvlist_lookup_uint16.9f
+usr/src/man/man9f/nvlist_lookup_uint16_array.9f
+usr/src/man/man9f/nvlist_lookup_uint32.9f
+usr/src/man/man9f/nvlist_lookup_uint32_array.9f
+usr/src/man/man9f/nvlist_lookup_uint64.9f
+usr/src/man/man9f/nvlist_lookup_uint64_array.9f
+usr/src/man/man9f/nvlist_lookup_uint8.9f
+usr/src/man/man9f/nvlist_lookup_uint8_array.9f
+usr/src/man/man9f/nvlist_merge.9f
+usr/src/man/man9f/nvlist_pack.9f
+usr/src/man/man9f/nvlist_remove_all.9f
+usr/src/man/man9f/nvlist_size.9f
+usr/src/man/man9f/nvlist_t.9f
+usr/src/man/man9f/nvlist_unpack.9f
+usr/src/man/man9f/nvlist_xalloc.9f
+usr/src/man/man9f/nvlist_xdup.9f
+usr/src/man/man9f/nvlist_xpack.9f
+usr/src/man/man9f/nvlist_xunpack.9f
+usr/src/man/man9f/nvpair_name.9f
+usr/src/man/man9f/nvpair_type.9f
+usr/src/man/man9f/nvpair_value_boolean_array.9f
+usr/src/man/man9f/nvpair_value_byte_array.9f
+usr/src/man/man9f/nvpair_value_int16.9f
+usr/src/man/man9f/nvpair_value_int16_array.9f
+usr/src/man/man9f/nvpair_value_int32.9f
+usr/src/man/man9f/nvpair_value_int32_array.9f
+usr/src/man/man9f/nvpair_value_int64.9f
+usr/src/man/man9f/nvpair_value_int64_array.9f
+usr/src/man/man9f/nvpair_value_int8.9f
+usr/src/man/man9f/nvpair_value_int8_array.9f
+usr/src/man/man9f/nvpair_value_nvlist.9f
+usr/src/man/man9f/nvpair_value_nvlist_array.9f
+usr/src/man/man9f/nvpair_value_string.9f
+usr/src/man/man9f/nvpair_value_string_array.9f
+usr/src/man/man9f/nvpair_value_uint16.9f
+usr/src/man/man9f/nvpair_value_uint16_array.9f
+usr/src/man/man9f/nvpair_value_uint32.9f
+usr/src/man/man9f/nvpair_value_uint32_array.9f
+usr/src/man/man9f/nvpair_value_uint64.9f
+usr/src/man/man9f/nvpair_value_uint64_array.9f
+usr/src/man/man9f/nvpair_value_uint8.9f
+usr/src/man/man9f/nvpair_value_uint8_array.9f
+usr/src/man/man9f/otherq.9f
+usr/src/man/man9f/outl.9f
+usr/src/man/man9f/outw.9f
+usr/src/man/man9f/pci_config_get16.9f
+usr/src/man/man9f/pci_config_get32.9f
+usr/src/man/man9f/pci_config_get64.9f
+usr/src/man/man9f/pci_config_getb.9f
+usr/src/man/man9f/pci_config_getl.9f
+usr/src/man/man9f/pci_config_getll.9f
+usr/src/man/man9f/pci_config_getw.9f
+usr/src/man/man9f/pci_config_put16.9f
+usr/src/man/man9f/pci_config_put32.9f
+usr/src/man/man9f/pci_config_put64.9f
+usr/src/man/man9f/pci_config_put8.9f
+usr/src/man/man9f/pci_config_putb.9f
+usr/src/man/man9f/pci_config_putl.9f
+usr/src/man/man9f/pci_config_putll.9f
+usr/src/man/man9f/pci_config_putw.9f
+usr/src/man/man9f/pci_config_teardown.9f
+usr/src/man/man9f/pci_ereport_post.9f
+usr/src/man/man9f/pci_ereport_teardown.9f
+usr/src/man/man9f/pci_restore_config_regs.9f
+usr/src/man/man9f/pm_idle_component.9f
+usr/src/man/man9f/pm_lower_power.9f
+usr/src/man/man9f/priv_policy_choice.9f
+usr/src/man/man9f/priv_policy_only.9f
+usr/src/man/man9f/proc_ref.9f
+usr/src/man/man9f/proc_unref.9f
+usr/src/man/man9f/qprocsoff.9f
+usr/src/man/man9f/qwait_sig.9f
+usr/src/man/man9f/rd.9f
+usr/src/man/man9f/repinsb.9f
+usr/src/man/man9f/repinsd.9f
+usr/src/man/man9f/repinsw.9f
+usr/src/man/man9f/repoutsb.9f
+usr/src/man/man9f/repoutsd.9f
+usr/src/man/man9f/repoutsw.9f
+usr/src/man/man9f/rmallocmap_wait.9f
+usr/src/man/man9f/rmfreemap.9f
+usr/src/man/man9f/rw_destroy.9f
+usr/src/man/man9f/rw_downgrade.9f
+usr/src/man/man9f/rw_enter.9f
+usr/src/man/man9f/rw_exit.9f
+usr/src/man/man9f/rw_init.9f
+usr/src/man/man9f/rw_read_locked.9f
+usr/src/man/man9f/rw_tryenter.9f
+usr/src/man/man9f/rw_tryupgrade.9f
+usr/src/man/man9f/samestr.9f
+usr/src/man/man9f/scsi_dmafree.9f
+usr/src/man/man9f/scsi_dname.9f
+usr/src/man/man9f/scsi_hba_attach.9f
+usr/src/man/man9f/scsi_hba_detach.9f
+usr/src/man/man9f/scsi_hba_fini.9f
+usr/src/man/man9f/scsi_hba_pkt_free.9f
+usr/src/man/man9f/scsi_hba_tran_free.9f
+usr/src/man/man9f/scsi_ifsetcap.9f
+usr/src/man/man9f/scsi_mname.9f
+usr/src/man/man9f/scsi_pktfree.9f
+usr/src/man/man9f/scsi_resalloc.9f
+usr/src/man/man9f/scsi_resfree.9f
+usr/src/man/man9f/scsi_rname.9f
+usr/src/man/man9f/scsi_sense_asc.9f
+usr/src/man/man9f/scsi_sense_ascq.9f
+usr/src/man/man9f/scsi_sense_cmdspecific_uint64.9f
+usr/src/man/man9f/scsi_sense_info_uint64.9f
+usr/src/man/man9f/scsi_sname.9f
+usr/src/man/man9f/scsi_unslave.9f
+usr/src/man/man9f/sema_destroy.9f
+usr/src/man/man9f/sema_init.9f
+usr/src/man/man9f/sema_p.9f
+usr/src/man/man9f/sema_p_sig.9f
+usr/src/man/man9f/sema_tryp.9f
+usr/src/man/man9f/sema_v.9f
+usr/src/man/man9f/strcasecmp.9f
+usr/src/man/man9f/strchr.9f
+usr/src/man/man9f/strcmp.9f
+usr/src/man/man9f/strcpy.9f
+usr/src/man/man9f/strdup.9f
+usr/src/man/man9f/strfree.9f
+usr/src/man/man9f/strlcat.9f
+usr/src/man/man9f/strlcpy.9f
+usr/src/man/man9f/strlen.9f
+usr/src/man/man9f/strncasecmp.9f
+usr/src/man/man9f/strncat.9f
+usr/src/man/man9f/strncmp.9f
+usr/src/man/man9f/strncpy.9f
+usr/src/man/man9f/strnlen.9f
+usr/src/man/man9f/strrchr.9f
+usr/src/man/man9f/strspn.9f
+usr/src/man/man9f/taskq_suspended.9f
+usr/src/man/man9f/uconv_u16tou8.9f
+usr/src/man/man9f/uconv_u32tou16.9f
+usr/src/man/man9f/uconv_u32tou8.9f
+usr/src/man/man9f/uconv_u8tou16.9f
+usr/src/man/man9f/uconv_u8tou32.9f
+usr/src/man/man9f/unfreezestr.9f
+usr/src/man/man9f/usb_alloc_bulk_req.9f
+usr/src/man/man9f/usb_alloc_ctrl_req.9f
+usr/src/man/man9f/usb_alloc_intr_req.9f
+usr/src/man/man9f/usb_alloc_isoc_req.9f
+usr/src/man/man9f/usb_client_detach.9f
+usr/src/man/man9f/usb_free_bulk_req.9f
+usr/src/man/man9f/usb_free_ctrl_req.9f
+usr/src/man/man9f/usb_free_descr_tree.9f
+usr/src/man/man9f/usb_free_dev_data.9f
+usr/src/man/man9f/usb_free_intr_req.9f
+usr/src/man/man9f/usb_free_isoc_req.9f
+usr/src/man/man9f/usb_get_if_number.9f
+usr/src/man/man9f/usb_owns_device.9f
+usr/src/man/man9f/usb_pipe_ctrl_xfer_wait.9f
+usr/src/man/man9f/usb_pipe_get_private.9f
+usr/src/man/man9f/usb_pipe_stop_intr_polling.9f
+usr/src/man/man9f/usb_pipe_stop_isoc_polling.9f
+usr/src/man/man9f/usb_print_descr_tree.9f
+usr/src/man/man9f/usb_set_alt_if.9f
+usr/src/man/man9f/usb_set_cfg.9f
+usr/src/man/man9f/usb_unregister_hotplug_cbs.9f
+usr/src/man/man9f/va_copy.9f
+usr/src/man/man9f/va_end.9f
+usr/src/man/man9f/va_start.9f
+usr/src/man/man9f/vcmn_err.9f
+usr/src/man/man9f/wr.9f
+usr/src/man/man9f/zcmn_err.9f
+usr/src/man/man9p/Nblock.9p
+usr/src/man/man9p/blksize.9p
+usr/src/man/man9p/ddi-no-autodetach.9p
+usr/src/man/man9p/device-blksize.9p
+usr/src/man/man9p/device-nblocks.9p
+usr/src/man/man9p/inquiry-product-id.9p
+usr/src/man/man9p/inquiry-revision-id.9p
+usr/src/man/man9p/inquiry-serial-no.9p
+usr/src/man/man9p/inquiry-vendor-id.9p
+usr/src/man/man9s/dblk.9s
+usr/src/man/man9s/ddi_dma_lim.9s
+usr/src/man/man9s/intro.9s
+usr/src/man/man9s/mblk.9s
+usr/src/msg/magic
+usr/src/msg/mailx.help
+usr/src/msg/more.help
+usr/src/msg/priv_names
+usr/src/pkg/license-list
+usr/src/pkg/packages.i386/
+usr/src/psm/stand/bootblks/ufs/i386/installboot
+usr/src/psm/stand/bootblks/ufs/i386/mboot
+usr/src/psm/stand/bootblks/ufs/i386/mboot.exec
+usr/src/tools/aw/aw
+usr/src/tools/codereview/codereview
+usr/src/tools/codesign/findcrypto
+usr/src/tools/codesign/signit
+usr/src/tools/codesign/signproto
+usr/src/tools/cscope-fast/cscope-fast
+usr/src/tools/ctf/cvt/i386/ctfconvert
+usr/src/tools/ctf/cvt/i386/ctfmerge
+usr/src/tools/ctf/dump/i386/ctfdump
+usr/src/tools/ctf/scripts/ctfcvtptbl
+usr/src/tools/ctf/scripts/ctffindmod
+usr/src/tools/ctf/stabs/i386/ctfstabs
+usr/src/tools/cw/cw
+usr/src/tools/elfextract/elfextract
+usr/src/tools/elfsign/elfsign
+usr/src/tools/elfsign/elfsigncmp
+usr/src/tools/env/developer
+usr/src/tools/env/gatekeeper
+usr/src/tools/env/illumos
+usr/src/tools/findunref/exception_list
+usr/src/tools/findunref/findunref
+usr/src/tools/gk/cshrc
+usr/src/tools/gk/gen_make.machines
+usr/src/tools/gk/login
+usr/src/tools/install-i386.out
+usr/src/tools/install.bin/install.bin
+usr/src/tools/lintdump/lintdump
+usr/src/tools/mbh_patch/mbh_patch
+usr/src/tools/ndrgen/ndrgen
+usr/src/tools/ndrgen/ndrgen1
+usr/src/tools/ndrgen/y.tab.c
+usr/src/tools/ndrgen/y.tab.h
+usr/src/tools/pmodes/pmodes
+usr/src/tools/proto/
+usr/src/tools/protocmp/protocmp
+usr/src/tools/protolist/protolist
+usr/src/tools/scripts/Install
+usr/src/tools/scripts/bindrop
+usr/src/tools/scripts/bldenv
+usr/src/tools/scripts/bldenv.1
+usr/src/tools/scripts/bringovercheck
+usr/src/tools/scripts/build_cscope
+usr/src/tools/scripts/cddlchk
+usr/src/tools/scripts/check_rtime
+usr/src/tools/scripts/checkpaths
+usr/src/tools/scripts/checkproto
+usr/src/tools/scripts/copyrightchk
+usr/src/tools/scripts/cryptodrop
+usr/src/tools/scripts/cstyle
+usr/src/tools/scripts/elfcmp
+usr/src/tools/scripts/find_elf
+usr/src/tools/scripts/flg.flp
+usr/src/tools/scripts/genoffsets
+usr/src/tools/scripts/git-active
+usr/src/tools/scripts/hdrchk
+usr/src/tools/scripts/hg-active
+usr/src/tools/scripts/hgsetup
+usr/src/tools/scripts/interface_check
+usr/src/tools/scripts/interface_cmp
+usr/src/tools/scripts/jstyle
+usr/src/tools/scripts/mapfilechk
+usr/src/tools/scripts/mkreadme_osol
+usr/src/tools/scripts/mktpl
+usr/src/tools/scripts/nightly
+usr/src/tools/scripts/onu
+usr/src/tools/scripts/protocmp.terse
+usr/src/tools/scripts/sccscheck
+usr/src/tools/scripts/validate_flg
+usr/src/tools/scripts/validate_paths
+usr/src/tools/scripts/validate_pkg
+usr/src/tools/scripts/wdiff
+usr/src/tools/scripts/webrev
+usr/src/tools/scripts/which_scm
+usr/src/tools/scripts/ws
+usr/src/tools/scripts/wsdiff
+usr/src/tools/scripts/xref
+usr/src/ucbcmd/basename/basename
+usr/src/ucbcmd/biff/biff
+usr/src/ucbcmd/chown/chown
+usr/src/ucbcmd/df/df
+usr/src/ucbcmd/du/du
+usr/src/ucbcmd/echo/echo
+usr/src/ucbcmd/expr/expr
+usr/src/ucbcmd/fastboot/fastboot
+usr/src/ucbcmd/fasthalt/fasthalt
+usr/src/ucbcmd/file/file
+usr/src/ucbcmd/from/from
+usr/src/ucbcmd/groups/groups
+usr/src/ucbcmd/install.d/installcmd
+usr/src/ucbcmd/ln/ln
+usr/src/ucbcmd/ls/ls
+usr/src/ucbcmd/mkstr/mkstr
+usr/src/ucbcmd/printenv/printenv
+usr/src/ucbcmd/rusage/rusage
+usr/src/ucbcmd/sed/sed
+usr/src/ucbcmd/shutdown/shutdown
+usr/src/ucbcmd/stty/stty
+usr/src/ucbcmd/sum/sum
+usr/src/ucbcmd/test/test
+usr/src/ucbcmd/touch/touch
+usr/src/ucbcmd/tr/tr
+usr/src/ucbcmd/tset/tset
+usr/src/ucbcmd/users/users
+usr/src/ucbcmd/vipw/vipw
+usr/src/ucbcmd/whereis/whereis
+usr/src/ucbcmd/whoami/whoami
+usr/src/uts/common/avs/ns/rdc/rdc_prot.h
+usr/src/uts/common/gssapi/gssd_prot.c
+usr/src/uts/common/gssapi/gssd_prot.h
+usr/src/uts/common/gssapi/gssd_xdr.c
+usr/src/uts/common/idmap/idmap_xdr.c
+usr/src/uts/common/io/fibre-channel/fca/qlc/ql_fw_table.c
+usr/src/uts/common/io/lvm/md/meta_basic_xdr.c
+usr/src/uts/common/io/lvm/md/metamed_xdr.c
+usr/src/uts/common/io/usb/clients/hwa1480_fw/i1480/hwa1480_fw
+usr/src/uts/common/os/priv_const.c
+usr/src/uts/common/rpc/key_prot.h
+usr/src/uts/common/rpc/pmap_prot.h
+usr/src/uts/common/rpc/rpc_sztypes.h
+usr/src/uts/common/rpc/rpcb_prot.h
+usr/src/uts/common/rpcsvc/autofs_prot.h
+usr/src/uts/common/rpcsvc/idmap_prot.h
+usr/src/uts/common/rpcsvc/nsm_addr.h
+usr/src/uts/common/rpcsvc/sm_inter.h
+usr/src/uts/common/sys/lvm/md_basic.h
+usr/src/uts/common/sys/lvm/md_mdiox.h
+usr/src/uts/common/sys/lvm/md_mhdx.h
+usr/src/uts/common/sys/lvm/mdmed.h
+usr/src/uts/common/sys/lvm/mdmn_commd.h
+usr/src/uts/common/sys/priv_const.h
+usr/src/uts/common/sys/priv_names.h
+usr/src/uts/common/sys/usb/usbdevs.h
+usr/src/uts/i86pc/cpu/scripts/ao_gendisp
+usr/src/uts/i86pc/io/acpi/drmach_acpi/drmach_err.c
+usr/src/uts/i86pc/io/acpi/drmach_acpi/sbdgenerr
+usr/src/uts/i86pc/io/dr/dr_err.c
+usr/src/uts/i86pc/io/dr/sbdgenerr
+usr/src/uts/i86pc/unix/multiboot
+usr/src/uts/intel/arcfour/arcfour-x86_64.s
+usr/src/uts/intel/genunix/debug32/
+usr/src/uts/intel/genunix/debug64/
+usr/src/uts/intel/ip/ip.symbols.obj64.diff
+usr/src/uts/intel/ip/ip.symbols.obj64.tmp
+usr/src/uts/intel/ip/ip.symbols.obj64.tmp.new
+usr/src/uts/intel/md5/md5_amd64.s
+usr/src/uts/intel/mwlfw/mw88W8363fw
+usr/src/uts/intel/mwlfw/mwlboot
+usr/src/uts/intel/os/priv_names
+usr/src/uts/intel/sha1/sha1-x86_64.s
+usr/src/uts/intel/sha2/sha256-x86_64.s
+usr/src/uts/intel/sha2/sha512-x86_64.s
+usr/src/uts/intel/sockfs/nl7ctokgen.h
+usr/src/uts/intel/uathfw/uathbin
diff --git a/GCC-README.md b/GCC-README.md
new file mode 100644
index 0000000000..012284aef7
--- /dev/null
+++ b/GCC-README.md
@@ -0,0 +1,129 @@
+
+# Illumos GCC 4
+
+## Intro
+
+This is a work in progress that may or may not work (or work well) at any
+given time. If you encounter problems you think are likely my fault, send me
+email describing them in detail.
+
+This has booted to login and done fairly basic work on 32bit and 64bit x86 in
+qemu, VirtualBox (32bit), and a random whitebox Athlon 64. And on a Sun-Fire
+V250 on sun4u. It has been tried nowhere else.
+
+## What you need
+
+### Patched GCC 4.4.4
+
+This is the GCC available at http://github.com/richlowe/gcc on the il-4_4_4
+branch. It is patched in numerous ways, a stock GCC will most certainly not
+work.
+
+I've made binary tarballs available, they assume a `--prefix` of
+`/opt/gcc/4.4.4` (unpack them from `/opt`)
+
+i386: http://richlowe.openindiana.org/~richlowe/il-gcc-444-i386.tar.bz2
+sparc: http://richlowe.openindiana.org/~richlowe/il-gcc-444-sparc.tar.bz2
+
+### Further patch GCC
+
+Unfortunately, we need to bake appropriate runpaths for libstdc++ and libgcc_s
+into the GCC spec, at least at present, so you need to further patch GCC to
+reflect the location in which you're going to install it.
+
+Choose a prefix in which to install GCC (the one you'll give to `configure
+--prefix`), I'm using /opt/gcc/4.4.4.
+
+Now, look at revision a1583073 (`git show a1583073`). In every place that
+changeset added a /usr/sfw/lib path, adding a matching path based on your
+prefix _before_ the SFW path (you need your libcc_s to be found first).
+
+I'm hoping to find a way to avoid doing this, but at present haven't come up
+with one that works in every case.
+
+### Build GCC
+
+I've been using a script to make this easier on myself
+
+```bash
+#!/bin/ksh -e
+VER=$1
+
+if [[ -z $VER ]]; then
+ print -u2 "Usage: build.sh <Version>"
+ exit 2
+fi
+
+export PATH="/opt/dejagnu/bin:/opt/SUNWspro/bin:"
+PATH="$PATH:/usr/gnu/bin:/usr/sfw/bin"
+PATH="$PATH:/usr/bin:/usr/ccs/bin"
+
+export CC=/usr/sfw/bin/gcc
+export CFLAGS="-g -O2"
+
+AS_OPTIONS=""
+if [[ $(mach) == "sparc" ]]; then
+ CFLAGS="$CFLAGS -fkeep-inline-functions"
+ AS_OPTIONS="--without-gnu-as --with-as=/usr/ccs/bin/as"
+else
+ AS_OPTIONS="--with-gnu-as --with-as=/usr/sfw/bin/as"
+fi
+
+export STAGE1_CFLAGS=$CFLAGS
+export CFLAGS_FOR_TARGET=$CFLAGS
+
+GMSGFMT=/usr/gnu/bin/msgfmt \
+../../configure --prefix=/opt/gcc/$VER $AS_OPTIONS \
+ --with-ld=/usr/bin/ld \
+ --without-gnu-ld \
+ --enable-languages="c,c++,objc" \
+ --enable-shared \
+ --with-mpfr-include=/usr/include/mpfr \
+ --with-gmp-include=/usr/include/gmp
+
+gmake -j8 CFLAGS="$CFLAGS" STAGE1_CFLAGS="$CFLAGS" \
+ CFLAGS_FOR_TARGET="$CFLAGS" bootstrap
+```
+
+Then:
+
+```bash
+mkdir -p builds/il-444 && cd builds/il-444
+../../build.sh 4.4.4
+```
+
+If you wish to run the tests, you'll need to install expect, then build and
+install dejagnu and run 'gmake check-gcc'. It's most useful to compare the
+test results of an unpatched build and a patch build at the same GCC revision
+(the gcc-4.4.4 tag, v. the il-4_4_4 branch for instance).
+
+## Build Illumos
+
+As part of this, I've (at least temporarily) adjusted the build infrastruture
+to support building with either version of GCC as either shadow or primary
+compiler. This adds a little complication to building with GCC4
+
+In addition to your normal settings in your env file you should add
+
+```bash
+source ./illumos.sh # Source your normal environment file
+export GCC_ROOT=/opt/gcc/4.4.4; # Where to find GCC4.x
+export CW_GCC_DIR=${GCC_ROOT}/bin; # A temporary hack to allow bootstrap of cw(1)
+export __GNUC=""; # Use GCC as the primary compiler
+export __GNUC4=""; # Use GCC4 specific flags
+```
+
+This should be sufficient to have GCC 4 used as the primary throughout the
+build (check nightly.log, and/or run `mcs -p foo.o` to check individual
+objects.
+
+## Illumos Live is really helpful
+
+A good and convenient way to test stuff is to use Joyent's illumos-live
+(http://github.com/joyent/illumos-live). My fork contains some additional
+changes to make it mildly more convenient if you don't have netbooting
+infrastructure.
+
+Just make sure that the projects/illumos tree is a clone of this branch, edit
+the generated illumos.sh env file as in "Build Illumos" above, and build it
+following their directions.
diff --git a/usr/src/cmd/print/scripts/desktop-print-management b/boot.manifest
index 2cc915be36..8f7c05f3a8 100644
--- a/usr/src/cmd/print/scripts/desktop-print-management
+++ b/boot.manifest
@@ -1,4 +1,3 @@
-#!/bin/sh
#
# CDDL HEADER START
#
@@ -19,16 +18,17 @@
#
# CDDL HEADER END
#
-
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
-
-# This interface launches an available print management tool capable of
-# configuration management of the LP print service.
+# This lists the boot-package files that illumos-joyent delivers as part of
+# a build. These are not part of the platform image but rather the bootable
+# image itself.
#
-exec /usr/bin/ospm-pm
-exec /bin/gksu /usr/sbin/printmgr
-/bin/zenity --error --test "unable to locate a desktop print management tool"
-exit 0
+d boot 0755 root sys
+d boot/grub 0755 root sys
+d boot/grub/bin 0755 root sys
+f boot/grub/bin/grub 0755 root sys
+f boot/grub/fat_stage1_5 0644 root sys
+f boot/grub/stage1 0644 root sys
+f boot/grub/stage2 0644 root sys
diff --git a/exception_lists/cstyle b/exception_lists/cstyle
index 57833c2407..9d8a350096 100644
--- a/exception_lists/cstyle
+++ b/exception_lists/cstyle
@@ -819,6 +819,16 @@ usr/src/uts/intel/io/acpica/utilities/utstate.c
usr/src/uts/intel/io/acpica/utilities/uttrack.c
usr/src/uts/intel/io/acpica/utilities/utxface.c
usr/src/uts/intel/io/acpica/utilities/utxferror.c
+usr/src/uts/intel/io/vmxnet/buildNumber.h
+usr/src/uts/intel/io/vmxnet/includeCheck.h
+usr/src/uts/intel/io/vmxnet/net.h
+usr/src/uts/intel/io/vmxnet/net_sg.h
+usr/src/uts/intel/io/vmxnet/vm_basic_types.h
+usr/src/uts/intel/io/vmxnet/vm_device_version.h
+usr/src/uts/intel/io/vmxnet/vmnet_def.h
+usr/src/uts/intel/io/vmxnet/vmxnet.c
+usr/src/uts/intel/io/vmxnet/vmxnet2_def.h
+usr/src/uts/intel/io/vmxnet/vmxnet_def.h
usr/src/uts/intel/sys/acpi/acapps.h
usr/src/uts/intel/sys/acpi/accommon.h
usr/src/uts/intel/sys/acpi/acconfig.h
diff --git a/manifest b/manifest
new file mode 100644
index 0000000000..449d12b53b
--- /dev/null
+++ b/manifest
@@ -0,0 +1,17531 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
+#
+# This lists all the files that illumos-joyent delivers as part of a build.
+#
+s bin=usr/bin
+d boot 0755 root sys
+d boot/acpi 0755 root sys
+d boot/acpi/tables 0755 root sys
+d boot/solaris 0755 root sys
+f boot/solaris/bootenv.rc 0644 root root
+d boot/solaris/devicedb 0755 root sys
+f boot/solaris/devicedb/master 0644 root sys
+d dev 0755 root sys
+s dev/allkmem=../devices/pseudo/mm@0:allkmem
+s dev/arp=../devices/pseudo/arp@0:arp
+s dev/bl=../devices/pseudo/bl@0:bl
+s dev/bpf=../devices/pseudo/bpf@0:bpf
+s dev/bridgectl=../devices/pseudo/clone@0:bridge
+s dev/conslog=../devices/pseudo/log@0:conslog
+s dev/console=../devices/pseudo/cn@0:console
+d dev/cpu 0755 root root
+d dev/cpu/self 0755 root root
+s dev/cpu/self/cpuid=../../../devices/pseudo/cpuid@0:self
+s dev/crypto=../devices/pseudo/crypto@0:crypto
+s dev/cryptoadm=../devices/pseudo/cryptoadm@0:cryptoadm
+s dev/dld=../devices/pseudo/dld@0:ctl
+d dev/dtrace 0755 root root
+d dev/dtrace/provider 0755 root root
+s dev/dtrace/provider/dcpc=../../../devices/pseudo/dcpc@0:dcpc
+s dev/dtrace/provider/fasttrap=../../../devices/pseudo/fasttrap@0:fasttrap
+s dev/dtrace/provider/fbt=../../../devices/pseudo/fbt@0:fbt
+s dev/dtrace/provider/lockstat=../../../devices/pseudo/lockstat@0:lockstat
+s dev/dtrace/provider/profile=../../../devices/pseudo/profile@0:profile
+s dev/dtrace/provider/sdt=../../../devices/pseudo/sdt@0:sdt
+s dev/dtrace/provider/systrace=../../../devices/pseudo/systrace@0:systrace
+s dev/dump=../devices/pseudo/dump@0:dump
+d dev/fd 0555 root root
+s dev/fm=../devices/pseudo/fm@0:fm
+s dev/fssnapctl=../devices/pseudo/fssnap@0:ctl
+s dev/icmp6=../devices/pseudo/icmp6@0:icmp6
+s dev/icmp=../devices/pseudo/icmp@0:icmp
+s dev/igb=../devices/pseudo/clone@0:igb
+s dev/ip6=../devices/pseudo/ip6@0:ip6
+s dev/ip=../devices/pseudo/ip@0:ip
+s dev/ipauth=../devices/pseudo/ipf@0:ipauth
+s dev/ipf=../devices/pseudo/ipf@0:ipf
+s dev/ipl=../devices/pseudo/ipf@0:ipf
+s dev/iplookup=../devices/pseudo/ipf@0:iplookup
+s dev/ipmpstub=../devices/pseudo/dlpistub@0:ipmpstub
+s dev/ipnat=../devices/pseudo/ipf@0:ipnat
+s dev/ipscan=../devices/pseudo/ipf@0:ipscan
+s dev/ipsecah=../devices/pseudo/ipsecah@0:ipsecah
+s dev/ipsecesp=../devices/pseudo/ipsecesp@0:ipsecesp
+s dev/ipstate=../devices/pseudo/ipf@0:ipstate
+s dev/ipsync=../devices/pseudo/ipf@0:ipsync
+s dev/kbd=../devices/pseudo/conskbd@0:kbd
+s dev/keysock=../devices/pseudo/keysock@0:keysock
+s dev/kmdb=../devices/pseudo/kmdb@0:kmdb
+s dev/kmem=../devices/pseudo/mm@0:kmem
+s dev/kssl=../devices/pseudo/kssl@0:kssl
+s dev/kstat=../devices/pseudo/kstat@0:kstat
+s dev/ksyms=../devices/pseudo/ksyms@0:ksyms
+s dev/llc1=../devices/pseudo/clone@0:llc1
+s dev/lo0=../devices/pseudo/ipnet@0:lo0
+s dev/lockstat=../devices/pseudo/lockstat@0:lockstat
+s dev/lofictl=../devices/pseudo/lofi@0:ctl
+s dev/log=../devices/pseudo/log@0:log
+s dev/logindmux=../devices/pseudo/clone@0:logindmux
+s dev/mem=../devices/pseudo/mm@0:mem
+s dev/mouse=../devices/pseudo/consms@0:mouse
+s dev/msglog=../devices/pseudo/sysmsg@0:msglog
+s dev/nsmb=../devices/pseudo/nsmb@0:nsmb
+s dev/null=../devices/pseudo/mm@0:null
+s dev/openprom=../devices/pseudo/openeepr@0:openprom
+s dev/physmem=../devices/pseudo/physmem@0:physmem
+s dev/pm=../devices/pseudo/pm@0:pm
+s dev/poll=../devices/pseudo/poll@0:poll
+s dev/pool=../devices/pseudo/pool@0:pool
+s dev/poolctl=../devices/pseudo/pool@0:poolctl
+s dev/power_button=../devices/pseudo/power@0:power_button
+s dev/ppm=../devices/pseudo/ppm@0:ppm
+s dev/ptmajor=../devices/pseudo/ptm@0:ptmajor
+s dev/ptmx=../devices/pseudo/clone@0:ptm
+s dev/ptyp0=../devices/pseudo/ptc@0:ptyp0
+s dev/ptyp1=../devices/pseudo/ptc@0:ptyp1
+s dev/ptyp2=../devices/pseudo/ptc@0:ptyp2
+s dev/ptyp3=../devices/pseudo/ptc@0:ptyp3
+s dev/ptyp4=../devices/pseudo/ptc@0:ptyp4
+s dev/ptyp5=../devices/pseudo/ptc@0:ptyp5
+s dev/ptyp6=../devices/pseudo/ptc@0:ptyp6
+s dev/ptyp7=../devices/pseudo/ptc@0:ptyp7
+s dev/ptyp8=../devices/pseudo/ptc@0:ptyp8
+s dev/ptyp9=../devices/pseudo/ptc@0:ptyp9
+s dev/ptypa=../devices/pseudo/ptc@0:ptypa
+s dev/ptypb=../devices/pseudo/ptc@0:ptypb
+s dev/ptypc=../devices/pseudo/ptc@0:ptypc
+s dev/ptypd=../devices/pseudo/ptc@0:ptypd
+s dev/ptype=../devices/pseudo/ptc@0:ptype
+s dev/ptypf=../devices/pseudo/ptc@0:ptypf
+s dev/ptyq0=../devices/pseudo/ptc@0:ptyq0
+s dev/ptyq1=../devices/pseudo/ptc@0:ptyq1
+s dev/ptyq2=../devices/pseudo/ptc@0:ptyq2
+s dev/ptyq3=../devices/pseudo/ptc@0:ptyq3
+s dev/ptyq4=../devices/pseudo/ptc@0:ptyq4
+s dev/ptyq5=../devices/pseudo/ptc@0:ptyq5
+s dev/ptyq6=../devices/pseudo/ptc@0:ptyq6
+s dev/ptyq7=../devices/pseudo/ptc@0:ptyq7
+s dev/ptyq8=../devices/pseudo/ptc@0:ptyq8
+s dev/ptyq9=../devices/pseudo/ptc@0:ptyq9
+s dev/ptyqa=../devices/pseudo/ptc@0:ptyqa
+s dev/ptyqb=../devices/pseudo/ptc@0:ptyqb
+s dev/ptyqc=../devices/pseudo/ptc@0:ptyqc
+s dev/ptyqd=../devices/pseudo/ptc@0:ptyqd
+s dev/ptyqe=../devices/pseudo/ptc@0:ptyqe
+s dev/ptyqf=../devices/pseudo/ptc@0:ptyqf
+s dev/ptyr0=../devices/pseudo/ptc@0:ptyr0
+s dev/ptyr1=../devices/pseudo/ptc@0:ptyr1
+s dev/ptyr2=../devices/pseudo/ptc@0:ptyr2
+s dev/ptyr3=../devices/pseudo/ptc@0:ptyr3
+s dev/ptyr4=../devices/pseudo/ptc@0:ptyr4
+s dev/ptyr5=../devices/pseudo/ptc@0:ptyr5
+s dev/ptyr6=../devices/pseudo/ptc@0:ptyr6
+s dev/ptyr7=../devices/pseudo/ptc@0:ptyr7
+s dev/ptyr8=../devices/pseudo/ptc@0:ptyr8
+s dev/ptyr9=../devices/pseudo/ptc@0:ptyr9
+s dev/ptyra=../devices/pseudo/ptc@0:ptyra
+s dev/ptyrb=../devices/pseudo/ptc@0:ptyrb
+s dev/ptyrc=../devices/pseudo/ptc@0:ptyrc
+s dev/ptyrd=../devices/pseudo/ptc@0:ptyrd
+s dev/ptyre=../devices/pseudo/ptc@0:ptyre
+s dev/ptyrf=../devices/pseudo/ptc@0:ptyrf
+s dev/ramdiskctl=../devices/pseudo/ramdisk@1024:ctl
+s dev/random=../devices/pseudo/random@0:random
+s dev/rawip6=../devices/pseudo/icmp6@0:icmp6
+s dev/rawip=../devices/pseudo/icmp@0:icmp
+s dev/rts=../devices/pseudo/rts@0:rts
+d dev/sad 0755 root root
+s dev/sad/admin=../../devices/pseudo/sad@0:admin
+s dev/sad/user=../../devices/pseudo/sad@0:user
+s dev/sdp=../devices/pseudo/sdp@0:sdp
+s dev/smbios=../devices/pseudo/smbios@0:smbios
+s dev/spdsock=../devices/pseudo/spdsock@0:spdsock
+s dev/sppp=../devices/pseudo/clone@0:sppp
+s dev/sppptun=../devices/pseudo/clone@0:sppptun
+s dev/srn=../devices/pseudo/srn@0:srn
+s dev/stderr=fd/2
+s dev/stdin=fd/0
+s dev/stdout=fd/1
+s dev/syscon=../devices/pseudo/cn@0:syscon
+s dev/sysevent=../devices/pseudo/sysevent@0:sysevent
+s dev/sysmsg=../devices/pseudo/sysmsg@0:sysmsg
+s dev/systty=../devices/pseudo/cn@0:systty
+s dev/tcp6=../devices/pseudo/tcp6@0:tcp6
+s dev/tcp=../devices/pseudo/tcp@0:tcp
+s dev/ticlts=../devices/pseudo/tl@0:ticlts
+s dev/ticots=../devices/pseudo/tl@0:ticots
+s dev/ticotsord=../devices/pseudo/tl@0:ticotsord
+s dev/tty=../devices/pseudo/sy@0:tty
+s dev/ttyp0=../devices/pseudo/ptsl@0:ttyp0
+s dev/ttyp1=../devices/pseudo/ptsl@0:ttyp1
+s dev/ttyp2=../devices/pseudo/ptsl@0:ttyp2
+s dev/ttyp3=../devices/pseudo/ptsl@0:ttyp3
+s dev/ttyp4=../devices/pseudo/ptsl@0:ttyp4
+s dev/ttyp5=../devices/pseudo/ptsl@0:ttyp5
+s dev/ttyp6=../devices/pseudo/ptsl@0:ttyp6
+s dev/ttyp7=../devices/pseudo/ptsl@0:ttyp7
+s dev/ttyp8=../devices/pseudo/ptsl@0:ttyp8
+s dev/ttyp9=../devices/pseudo/ptsl@0:ttyp9
+s dev/ttypa=../devices/pseudo/ptsl@0:ttypa
+s dev/ttypb=../devices/pseudo/ptsl@0:ttypb
+s dev/ttypc=../devices/pseudo/ptsl@0:ttypc
+s dev/ttypd=../devices/pseudo/ptsl@0:ttypd
+s dev/ttype=../devices/pseudo/ptsl@0:ttype
+s dev/ttypf=../devices/pseudo/ptsl@0:ttypf
+s dev/ttyq0=../devices/pseudo/ptsl@0:ttyq0
+s dev/ttyq1=../devices/pseudo/ptsl@0:ttyq1
+s dev/ttyq2=../devices/pseudo/ptsl@0:ttyq2
+s dev/ttyq3=../devices/pseudo/ptsl@0:ttyq3
+s dev/ttyq4=../devices/pseudo/ptsl@0:ttyq4
+s dev/ttyq5=../devices/pseudo/ptsl@0:ttyq5
+s dev/ttyq6=../devices/pseudo/ptsl@0:ttyq6
+s dev/ttyq7=../devices/pseudo/ptsl@0:ttyq7
+s dev/ttyq8=../devices/pseudo/ptsl@0:ttyq8
+s dev/ttyq9=../devices/pseudo/ptsl@0:ttyq9
+s dev/ttyqa=../devices/pseudo/ptsl@0:ttyqa
+s dev/ttyqb=../devices/pseudo/ptsl@0:ttyqb
+s dev/ttyqc=../devices/pseudo/ptsl@0:ttyqc
+s dev/ttyqd=../devices/pseudo/ptsl@0:ttyqd
+s dev/ttyqe=../devices/pseudo/ptsl@0:ttyqe
+s dev/ttyqf=../devices/pseudo/ptsl@0:ttyqf
+s dev/ttyr0=../devices/pseudo/ptsl@0:ttyr0
+s dev/ttyr1=../devices/pseudo/ptsl@0:ttyr1
+s dev/ttyr2=../devices/pseudo/ptsl@0:ttyr2
+s dev/ttyr3=../devices/pseudo/ptsl@0:ttyr3
+s dev/ttyr4=../devices/pseudo/ptsl@0:ttyr4
+s dev/ttyr5=../devices/pseudo/ptsl@0:ttyr5
+s dev/ttyr6=../devices/pseudo/ptsl@0:ttyr6
+s dev/ttyr7=../devices/pseudo/ptsl@0:ttyr7
+s dev/ttyr8=../devices/pseudo/ptsl@0:ttyr8
+s dev/ttyr9=../devices/pseudo/ptsl@0:ttyr9
+s dev/ttyra=../devices/pseudo/ptsl@0:ttyra
+s dev/ttyrb=../devices/pseudo/ptsl@0:ttyrb
+s dev/ttyrc=../devices/pseudo/ptsl@0:ttyrc
+s dev/ttyrd=../devices/pseudo/ptsl@0:ttyrd
+s dev/ttyre=../devices/pseudo/ptsl@0:ttyre
+s dev/ttyrf=../devices/pseudo/ptsl@0:ttyrf
+s dev/ucode=../devices/pseudo/ucode@0:ucode
+s dev/udp6=../devices/pseudo/udp6@0:udp6
+s dev/udp=../devices/pseudo/udp@0:udp
+s dev/urandom=../devices/pseudo/random@0:urandom
+s dev/vni=../devices/pseudo/dlpistub@0:vni
+s dev/winlock=../devices/pseudo/winlock@0:winlock
+s dev/wscons=../devices/pseudo/wc@0:wscons
+s dev/zero=../devices/pseudo/mm@0:zero
+s dev/zfs=../devices/pseudo/zfs@0:zfs
+d devices 0755 root sys
+d etc 0755 root sys
+f etc/.login 0644 root sys
+s etc/.syslog_door=../var/run/syslog_door
+s etc/TIMEZONE=default/init
+d etc/acct 0755 adm adm
+f etc/acct/holidays 0644 root bin
+d etc/amd64 0755 root sys
+f etc/auto_home 0644 root bin
+f etc/auto_master 0644 root bin
+f etc/bootrc 0755 root sys
+d etc/brand 0755 root sys
+d etc/certs 0755 root sys
+d etc/cron.d 0755 root sys
+f etc/cron.d/.proto 0744 root sys
+f etc/cron.d/at.deny 0644 root sys
+f etc/cron.d/cron.deny 0644 root sys
+f etc/cron.d/queuedefs 0644 root sys
+d etc/crypto 0755 root sys
+d etc/crypto/certs 0755 root sys
+d etc/crypto/crls 0755 root sys
+f etc/crypto/kcf.conf 0644 root sys
+f etc/crypto/kmf.conf 0644 root sys
+f etc/dacf.conf 0644 root sys
+d etc/dat 0755 root sys
+f etc/dat/dat.conf 0644 root sys
+f etc/datemsk 0444 root sys
+d etc/default 0755 root sys
+f etc/default/autofs 0644 root sys
+f etc/default/cron 0644 root sys
+f etc/default/devfsadm 0644 root sys
+f etc/default/dhcpagent 0644 root sys
+f etc/default/fs 0644 root sys
+f etc/default/ftp 0644 root sys
+f etc/default/inetinit 0644 root sys
+f etc/default/ipsec 0644 root sys
+f etc/default/keyserv 0644 root sys
+f etc/default/mpathd 0644 root sys
+f etc/default/nfs 0644 root sys
+f etc/default/nfslogd 0644 root sys
+f etc/default/nss 0644 root sys
+f etc/default/power 0644 root sys
+f etc/default/su 0644 root sys
+f etc/default/syslogd 0644 root sys
+f etc/default/tar 0644 root sys
+f etc/default/telnetd 0644 root sys
+f etc/default/utmpd 0644 root sys
+d etc/dev 0755 root sys
+f etc/device.tab 0444 root root
+d etc/devices 0755 root sys
+d etc/devices/dli 0755 root root
+f etc/devlink.tab 0644 root sys
+d etc/dfs 0755 root sys
+f etc/dfs/dfstab 0644 root sys
+f etc/dfs/fstypes 0644 root root
+f etc/dfs/sharetab 0444 root root
+f etc/dgroup.tab 0444 root sys
+d etc/dhcp 0755 root sys
+f etc/dhcp/inittab 0644 root sys
+f etc/dhcp/inittab6 0644 root sys
+d etc/dladm 0755 dladm netadm
+f etc/dladm/datalink.conf 0644 dladm sys
+f etc/dladm/flowadm.conf 0644 dladm netadm
+f etc/dladm/flowprop.conf 0644 dladm netadm
+f etc/dladm/secobj.conf 0660 dladm netadm
+f etc/dumpdates 0664 root sys
+d etc/fm 0755 root sys
+d etc/fm/fmd 0755 root sys
+f etc/format.dat 0644 root sys
+d etc/fs 0755 root sys
+d etc/fs/dev 0755 root sys
+f etc/fs/dev/mount 0555 root bin
+d etc/fs/hsfs 0755 root sys
+f etc/fs/hsfs/mount 0555 root bin
+d etc/fs/nfs 0755 root sys
+f etc/fs/nfs/mount 0555 root bin
+d etc/fs/ufs 0755 root sys
+f etc/fs/ufs/mount 0555 root bin
+d etc/fs/zfs 0755 root sys
+s etc/fs/zfs/mount=../../../sbin/zfs
+s etc/fs/zfs/umount=../../../sbin/zfs
+d etc/gss 0755 root sys
+f etc/gss/gsscred.conf 0644 root sys
+f etc/gss/mech 0644 root sys
+f etc/gss/qop 0644 root sys
+f etc/hba.conf 0644 root bin
+s etc/hosts=inet/hosts
+f etc/ima.conf 0644 root bin
+d etc/inet 0755 root sys
+f etc/inet/datemsk.ndpd 0444 root sys
+f etc/inet/hosts 0644 root sys
+d etc/inet/ike 0755 root sys
+f etc/inet/ike/config.sample 0444 root sys
+d etc/inet/ike/crls 0755 root sys
+d etc/inet/ike/publickeys 0755 root sys
+f etc/inet/inetd.conf 0644 root sys
+f etc/inet/ipaddrsel.conf 0644 root sys
+s etc/inet/ipnodes=hosts
+f etc/inet/ipsecalgs 0644 root sys
+f etc/inet/ipsecinit.sample 0444 root sys
+f etc/inet/netmasks 0644 root sys
+f etc/inet/networks 0644 root sys
+f etc/inet/protocols 0644 root sys
+d etc/inet/secret 0700 root sys
+f etc/inet/secret/ike.preshared 0600 root sys
+d etc/inet/secret/ike.privatekeys 0700 root sys
+f etc/inet/secret/ipseckeys.sample 0600 root sys
+f etc/inet/services 0644 root sys
+f etc/inet/slp.conf.example 0644 root sys
+s etc/inetd.conf=inet/inetd.conf
+d etc/init.d 0755 root sys
+f etc/init.d/PRESERVE 0744 root sys
+f etc/init.d/README 0644 root sys
+f etc/init.d/acct 0744 root sys
+f etc/init.d/devlinks 0744 root sys
+f etc/init.d/dhcp 0744 root sys
+f etc/init.d/dodatadm.udaplt 0744 root sys
+f etc/init.d/drvconfig 0744 root sys
+f etc/init.d/ldap.client 0744 root sys
+f etc/init.d/nfs.server 0744 root sys
+f etc/init.d/nscd 0744 root sys
+f etc/init.d/pppd 0744 root sys
+f etc/init.d/sendmail 0744 root sys
+f etc/init.d/slpd 0744 root sys
+f etc/init.d/sysetup 0744 root sys
+f etc/init.d/ufs_quota 0744 root sys
+f etc/ioctl.syscon 0644 root sys
+d etc/ipadm 0755 netadm netadm
+f etc/ipadm/ipadm.conf 0644 netadm netadm
+d etc/ipf 0755 root sys
+f etc/ipf/ipf.conf 0644 root sys
+f etc/iu.ap 0644 root sys
+d etc/krb5 0755 root sys
+f etc/krb5/krb5.conf 0644 root sys
+f etc/krb5/warn.conf 0644 root sys
+f etc/ksh.kshrc 0644 root sys
+s etc/log=../var/adm/log
+d etc/logadm.d 0755 root sys
+f etc/logadm.d/fmd.logadm.conf 0444 root sys
+f etc/logindevperm 0644 root sys
+f etc/mach 0644 root sys
+f etc/magic 0444 root bin
+f etc/mailcap 0644 root bin
+d etc/mail 0755 root sys
+f etc/mail/aliases 0644 root mail
+d etc/mail/cf 0755 root mail
+f etc/mail/helpfile 0644 root mail
+f etc/mail/local-host-names 0644 root mail
+f etc/mail/Mail.rc 0644 root mail
+f etc/mail/mailx.rc 0644 root mail
+s etc/mail/main.cf=sendmail.cf
+f etc/mail/sendmail.cf 0444 root mail
+s etc/mail/sendmail.hf=helpfile
+f etc/mail/submit.cf 0444 root mail
+s etc/mail/subsidiary.cf=sendmail.cf
+f etc/mail/trusted-users 0644 root mail
+f etc/mime.types 0644 root bin
+f etc/mnttab 0444 root root
+f etc/mpapi.conf 0644 root bin
+f etc/name_to_sysnum 0644 root sys
+d etc/net 0755 root sys
+d etc/net/ticlts 0755 root sys
+f etc/net/ticlts/hosts 0644 root sys
+f etc/net/ticlts/services 0644 root sys
+d etc/net/ticots 0755 root sys
+f etc/net/ticots/hosts 0644 root sys
+f etc/net/ticots/services 0644 root sys
+d etc/net/ticotsord 0755 root sys
+f etc/net/ticotsord/hosts 0644 root sys
+f etc/net/ticotsord/services 0644 root sys
+f etc/netconfig 0644 root sys
+s etc/netmasks=inet/netmasks
+s etc/networks=inet/networks
+d etc/nfs 0755 root sys
+f etc/nfs/nfslog.conf 0644 root sys
+f etc/nfssec.conf 0644 root sys
+f etc/nscd.conf 0644 root sys
+f etc/nsswitch.ad 0644 root sys
+f etc/nsswitch.dns 0644 root sys
+f etc/nsswitch.files 0644 root sys
+f etc/nsswitch.ldap 0644 root sys
+f etc/nsswitch.nis 0644 root sys
+d etc/opt 0755 root sys
+f etc/pam.conf 0644 root sys
+f etc/power.conf 0644 root sys
+d etc/ppp 0755 root sys
+f etc/ppp/chap-secrets 0600 root sys
+f etc/ppp/myisp-chat.tmpl 0644 root sys
+f etc/ppp/options.tmpl 0644 root sys
+f etc/ppp/options.ttya.tmpl 0644 root sys
+f etc/ppp/pap-secrets 0600 root sys
+d etc/ppp/peers 0755 root sys
+f etc/ppp/peers/myisp.tmpl 0644 root sys
+d etc/ppp/plugins 0755 root sys
+f etc/profile 0644 root sys
+f etc/project 0644 root sys
+s etc/protocols=inet/protocols
+f etc/publickey 0644 root bin
+d etc/rc0.d 0755 root sys
+h etc/rc0.d/K50pppd=etc/init.d/pppd
+d etc/rc1.d 0755 root sys
+h etc/rc1.d/K50pppd=etc/init.d/pppd
+d etc/rc2.d 0755 root sys
+f etc/rc2.d/README 0644 root sys
+f etc/rc2.d/S20sysetup 0744 root sys
+h etc/rc2.d/S47pppd=etc/init.d/pppd
+f etc/rc2.d/S81dodatadm.udaplt 0744 root sys
+f etc/rc2.d/S89PRESERVE 0744 root sys
+d etc/rc3.d 0755 root sys
+f etc/rc3.d/README 0644 root sys
+d etc/rcS.d 0755 root sys
+f etc/rcS.d/README 0644 root sys
+d etc/rcm 0755 root sys
+d etc/rcm/scripts 0755 root sys
+f etc/remote 0644 root bin
+f etc/rpc 0644 root sys
+d etc/rpcsec 0755 root sys
+d etc/saf 0755 root bin
+f etc/saf/_sactab 0644 root sys
+f etc/saf/_sysconfig 0644 root sys
+d etc/saf/zsmon 0755 root sys
+d etc/sasl 0755 root sys
+f etc/sdp.conf 0644 root sys
+d etc/security 0755 root sys
+d etc/security/audit 0755 root sys
+d etc/security/audit/localhost 0755 root sys
+s etc/security/audit/localhost/files=../../../../var/audit
+f etc/security/audit_class 0644 root sys
+f etc/security/audit_event 0644 root sys
+f etc/security/audit_warn 0740 root sys
+f etc/security/auth_attr 0644 root sys
+d etc/security/auth_attr.d 0755 root sys
+f etc/security/auth_attr.d/SUNWcs 0644 root sys
+f etc/security/crypt.conf 0644 root sys
+d etc/security/dev 0755 root sys
+f etc/security/dev/audio 0400 root bin
+f etc/security/dev/fd0 0400 root bin
+f etc/security/dev/sr0 0400 root bin
+f etc/security/dev/st0 0400 root bin
+f etc/security/dev/st1 0400 root bin
+f etc/security/device_policy 0644 root sys
+f etc/security/exec_attr 0644 root sys
+d etc/security/exec_attr.d 0755 root sys
+f etc/security/exec_attr.d/SUNWcs 0644 root sys
+f etc/security/extra_privs 0644 root sys
+f etc/security/kmfpolicy.xml 0644 root bin
+d etc/security/lib 0755 root sys
+f etc/security/lib/audio_clean 0555 root sys
+f etc/security/lib/fd_clean 0555 root sys
+f etc/security/lib/sr_clean 0555 root sys
+f etc/security/lib/st_clean 0555 root sys
+f etc/security/policy.conf 0644 root sys
+f etc/security/priv_names 0644 root sys
+f etc/security/prof_attr 0644 root sys
+d etc/security/prof_attr.d 0755 root sys
+f etc/security/prof_attr.d/SUNWcs 0644 root sys
+s etc/services=inet/services
+d etc/skel 0755 root sys
+f etc/skel/.profile 0644 root other
+f etc/skel/local.cshrc 0644 root sys
+f etc/skel/local.login 0644 root sys
+f etc/skel/local.profile 0644 root sys
+d etc/sock2path.d 0755 root sys
+f etc/sock2path.d/driver%2Fnetwork%2Fbpf 0644 root sys
+f etc/sock2path.d/driver%2Fnetwork%2Fsdp 0644 root sys
+f etc/sock2path.d/system%2Fkernel 0644 root sys
+d etc/ssh 0755 root sys
+f etc/ssh/moduli 0644 root sys
+f etc/ssh/ssh_config 0644 root sys
+s etc/sulogin=../sbin/sulogin
+d etc/svc 0755 root sys
+d etc/svc/volatile 0755 root sys
+d etc/sysconfig 0755 root root
+d etc/sysevent 0755 root sys
+d etc/sysevent/config 0755 root sys
+d etc/sysevent/devfsadm_event_channel 0755 root root
+f etc/syslog.conf 0644 root sys
+s etc/syslog.pid=../var/run/syslog.pid
+s etc/termcap=../usr/share/lib/termcap
+d etc/tm 0755 root sys
+f etc/ttydefs 0644 root sys
+f etc/ttysrch 0644 root sys
+d etc/usb 0755 root sys
+f etc/usb/config_map.conf 0644 root sys
+d etc/user_attr.d 0755 root sys
+f etc/user_attr.d/SUNWcs 0644 root sys
+s etc/utmpx=../var/adm/utmpx
+s etc/wtmpx=../var/adm/wtmpx
+d etc/xdg 0755 root sys
+d etc/xdg/autostart 0755 root sys
+d etc/zfs 0755 root sys
+d etc/zones 0755 root sys
+f etc/zones/SUNWblank.xml 0444 root bin
+f etc/zones/index 0644 root sys
+s etc/zprofile=profile
+d kernel 0755 root sys
+d kernel/amd64 0755 root sys
+f kernel/amd64/genunix 0755 root sys
+d kernel/crypto 0755 root sys
+f kernel/crypto/aes 0755 root sys
+d kernel/crypto/amd64 0755 root sys
+f kernel/crypto/amd64/aes 0755 root sys
+f kernel/crypto/amd64/arcfour 0755 root sys
+f kernel/crypto/amd64/blowfish 0755 root sys
+f kernel/crypto/amd64/des 0755 root sys
+s kernel/crypto/amd64/dprov=../../../kernel/drv/amd64/dprov
+f kernel/crypto/amd64/ecc 0755 root sys
+f kernel/crypto/amd64/md4 0755 root sys
+f kernel/crypto/amd64/md5 0755 root sys
+f kernel/crypto/amd64/rsa 0755 root sys
+f kernel/crypto/amd64/sha1 0755 root sys
+f kernel/crypto/amd64/sha2 0755 root sys
+f kernel/crypto/amd64/swrand 0755 root sys
+d kernel/dacf 0755 root sys
+d kernel/dacf/amd64 0755 root sys
+f kernel/dacf/amd64/net_dacf 0755 root sys
+f kernel/dacf/net_dacf 0755 root sys
+d kernel/drv 0755 root sys
+f kernel/drv/aac.conf 0644 root sys
+f kernel/drv/acpi_drv.conf 0644 root sys
+f kernel/drv/adpu320.conf 0644 root sys
+f kernel/drv/aggr.conf 0644 root sys
+d kernel/drv/amd64 0755 root sys
+f kernel/drv/amd64/aac 0755 root sys
+f kernel/drv/amd64/acpi_drv 0755 root sys
+f kernel/drv/amd64/adpu320 0755 root sys
+f kernel/drv/amd64/afe 0755 root sys
+f kernel/drv/amd64/aggr 0755 root sys
+f kernel/drv/amd64/ahci 0755 root sys
+f kernel/drv/amd64/amd8111s 0755 root sys
+f kernel/drv/amd64/amr 0755 root sys
+f kernel/drv/amd64/arcmsr 0755 root sys
+f kernel/drv/amd64/arp 0755 root sys
+f kernel/drv/amd64/asy 0755 root sys
+f kernel/drv/amd64/ata 0755 root sys
+f kernel/drv/amd64/atge 0755 root sys
+f kernel/drv/amd64/bcm_sata 0755 root sys
+f kernel/drv/amd64/bfe 0755 root sys
+f kernel/drv/amd64/bge 0755 root sys
+f kernel/drv/amd64/blkdev 0755 root sys
+f kernel/drv/amd64/bnxe 0755 root sys
+f kernel/drv/amd64/bridge 0755 root sys
+f kernel/drv/amd64/chxge 0755 root sys
+f kernel/drv/amd64/clone 0755 root sys
+f kernel/drv/amd64/cmdk 0755 root sys
+f kernel/drv/amd64/cn 0755 root sys
+f kernel/drv/amd64/conskbd 0755 root sys
+f kernel/drv/amd64/consms 0755 root sys
+f kernel/drv/amd64/cpuid 0755 root sys
+f kernel/drv/amd64/cpunex 0755 root sys
+f kernel/drv/amd64/crypto 0755 root sys
+f kernel/drv/amd64/cryptoadm 0755 root sys
+f kernel/drv/amd64/dcpc 0755 root sys
+f kernel/drv/amd64/devinfo 0755 root sys
+f kernel/drv/amd64/dld 0755 root sys
+f kernel/drv/amd64/dlpistub 0755 root sys
+f kernel/drv/amd64/dmfe 0755 root sys
+f kernel/drv/amd64/dnet 0755 root sys
+f kernel/drv/amd64/dprov 0755 root sys
+f kernel/drv/amd64/dr_sas 0755 root sys
+f kernel/drv/amd64/dtrace 0755 root sys
+f kernel/drv/amd64/e1000g 0755 root sys
+f kernel/drv/amd64/ehci 0755 root sys
+f kernel/drv/amd64/eibnx 0755 root sys
+f kernel/drv/amd64/fasttrap 0755 root sys
+f kernel/drv/amd64/fbt 0755 root sys
+f kernel/drv/amd64/fp 0755 root sys
+f kernel/drv/amd64/heci 0755 root sys
+f kernel/drv/amd64/hid 0755 root sys
+f kernel/drv/amd64/hubd 0755 root sys
+f kernel/drv/amd64/hwahc 0755 root sys
+f kernel/drv/amd64/hwarc 0755 root sys
+f kernel/drv/amd64/hxge 0755 root sys
+f kernel/drv/amd64/i8042 0755 root sys
+f kernel/drv/amd64/icmp 0755 root sys
+f kernel/drv/amd64/icmp6 0755 root sys
+f kernel/drv/amd64/igb 0755 root sys
+f kernel/drv/amd64/intel_nb5000 0755 root sys
+f kernel/drv/amd64/intel_nhm 0755 root sys
+f kernel/drv/amd64/intel_nhmex 0755 root sys
+f kernel/drv/amd64/ip 0755 root sys
+f kernel/drv/amd64/ip6 0755 root sys
+f kernel/drv/amd64/ipd 0755 root sys
+f kernel/drv/amd64/ipnet 0755 root sys
+f kernel/drv/amd64/ippctl 0755 root sys
+f kernel/drv/amd64/iprb 0755 root sys
+f kernel/drv/amd64/ipsecah 0755 root sys
+f kernel/drv/amd64/ipsecesp 0755 root sys
+f kernel/drv/amd64/iptun 0755 root sys
+f kernel/drv/amd64/iscsi 0755 root sys
+f kernel/drv/amd64/iscsit 0755 root sys
+f kernel/drv/amd64/iwscn 0755 root sys
+f kernel/drv/amd64/ixgb 0755 root sys
+f kernel/drv/amd64/ixgbe 0755 root sys
+f kernel/drv/amd64/kb8042 0755 root sys
+f kernel/drv/amd64/keysock 0755 root sys
+f kernel/drv/amd64/kmdb 0755 root sys
+f kernel/drv/amd64/kssl 0755 root sys
+f kernel/drv/amd64/llc1 0755 root sys
+f kernel/drv/amd64/lockstat 0755 root sys
+f kernel/drv/amd64/lofi 0755 root sys
+f kernel/drv/amd64/log 0755 root sys
+f kernel/drv/amd64/lsimega 0755 root sys
+f kernel/drv/amd64/marvell88sx 0755 root sys
+f kernel/drv/amd64/mega_sas 0755 root sys
+f kernel/drv/amd64/mm 0755 root sys
+f kernel/drv/amd64/mpt 0755 root sys
+f kernel/drv/amd64/mpt_sas 0755 root sys
+f kernel/drv/amd64/mr_sas 0755 root sys
+f kernel/drv/amd64/myri10ge 0755 root sys
+f kernel/drv/amd64/nge 0755 root sys
+f kernel/drv/amd64/ntxn 0755 root sys
+f kernel/drv/amd64/nulldriver 0755 root sys
+f kernel/drv/amd64/nv_sata 0755 root sys
+f kernel/drv/amd64/nxge 0755 root sys
+f kernel/drv/amd64/oce 0755 root sys
+f kernel/drv/amd64/ohci 0755 root sys
+f kernel/drv/amd64/openeepr 0755 root sys
+f kernel/drv/amd64/options 0755 root sys
+f kernel/drv/amd64/pcata 0755 root sys
+f kernel/drv/amd64/pci_pci 0755 root sys
+f kernel/drv/amd64/pcieb 0755 root sys
+f kernel/drv/amd64/pcser 0755 root sys
+f kernel/drv/amd64/physmem 0755 root sys
+f kernel/drv/amd64/pmcs 0755 root sys
+f kernel/drv/amd64/poll 0755 root sys
+f kernel/drv/amd64/power 0755 root sys
+f kernel/drv/amd64/profile 0755 root sys
+f kernel/drv/amd64/pseudo 0755 root sys
+f kernel/drv/amd64/ptc 0755 root sys
+f kernel/drv/amd64/ptsl 0755 root sys
+f kernel/drv/amd64/qlc 0755 root sys
+f kernel/drv/amd64/qlge 0755 root sys
+f kernel/drv/amd64/ramdisk 0755 root sys
+f kernel/drv/amd64/random 0755 root sys
+f kernel/drv/amd64/rge 0755 root sys
+f kernel/drv/amd64/rtls 0755 root sys
+f kernel/drv/amd64/rts 0755 root sys
+f kernel/drv/amd64/sad 0755 root sys
+f kernel/drv/amd64/scsa2usb 0755 root sys
+f kernel/drv/amd64/scsi_vhci 0755 root sys
+f kernel/drv/amd64/sd 0755 root sys
+f kernel/drv/amd64/sdhost 0755 root sys
+f kernel/drv/amd64/sdt 0755 root sys
+f kernel/drv/amd64/ses 0755 root sys
+f kernel/drv/amd64/sfe 0755 root sys
+f kernel/drv/amd64/sgen 0755 root sys
+f kernel/drv/amd64/si3124 0755 root sys
+f kernel/drv/amd64/simnet 0755 root sys
+f kernel/drv/amd64/smbios 0755 root sys
+f kernel/drv/amd64/softmac 0755 root sys
+f kernel/drv/amd64/spdsock 0755 root sys
+f kernel/drv/amd64/srn 0755 root sys
+f kernel/drv/amd64/st 0755 root sys
+f kernel/drv/amd64/stmf 0755 root sys
+f kernel/drv/amd64/stmf_sbd 0755 root sys
+f kernel/drv/amd64/sy 0755 root sys
+f kernel/drv/amd64/sysevent 0755 root sys
+f kernel/drv/amd64/sysmsg 0755 root sys
+f kernel/drv/amd64/systrace 0755 root sys
+f kernel/drv/amd64/tcp 0755 root sys
+f kernel/drv/amd64/tcp6 0755 root sys
+f kernel/drv/amd64/tl 0755 root sys
+f kernel/drv/amd64/tzmon 0755 root sys
+f kernel/drv/amd64/ucode 0755 root sys
+f kernel/drv/amd64/udp 0755 root sys
+f kernel/drv/amd64/udp6 0755 root sys
+f kernel/drv/amd64/ugen 0755 root sys
+f kernel/drv/amd64/uhci 0755 root sys
+f kernel/drv/amd64/usb_mid 0755 root sys
+f kernel/drv/amd64/usbecm 0755 root sys
+f kernel/drv/amd64/usbftdi 0755 root sys
+f kernel/drv/amd64/usbsacm 0755 root sys
+f kernel/drv/amd64/usbser_edge 0755 root sys
+f kernel/drv/amd64/usbskel 0755 root sys
+f kernel/drv/amd64/usbsksp 0755 root sys
+f kernel/drv/amd64/usbsprl 0755 root sys
+f kernel/drv/amd64/vgatext 0755 root sys
+f kernel/drv/amd64/vmxnet 0755 root sys
+f kernel/drv/amd64/vnic 0755 root sys
+f kernel/drv/amd64/vr 0755 root sys
+f kernel/drv/amd64/vscan 0755 root sys
+f kernel/drv/amd64/wc 0755 root sys
+f kernel/drv/amd64/xge 0755 root sys
+f kernel/drv/amd64/yge 0755 root sys
+f kernel/drv/amd64/zfs 0755 root sys
+f kernel/drv/amr.conf 0644 root sys
+f kernel/drv/arcmsr.conf 0644 root sys
+f kernel/drv/arp.conf 0644 root sys
+f kernel/drv/asy.conf 0644 root sys
+f kernel/drv/ata.conf 0644 root sys
+f kernel/drv/bge.conf 0644 root sys
+f kernel/drv/bl.conf 0644 root sys
+f kernel/drv/bnx.conf 0644 root sys
+f kernel/drv/bnxe.conf 0644 root sys
+f kernel/drv/bridge.conf 0644 root sys
+f kernel/drv/clone.conf 0644 root sys
+f kernel/drv/cmdk.conf 0644 root sys
+f kernel/drv/cn.conf 0644 root sys
+f kernel/drv/conskbd.conf 0644 root sys
+f kernel/drv/consms.conf 0644 root sys
+f kernel/drv/cpuid.conf 0644 root sys
+f kernel/drv/crypto.conf 0644 root sys
+f kernel/drv/cryptoadm.conf 0644 root sys
+f kernel/drv/dcpc.conf 0644 root sys
+f kernel/drv/devinfo.conf 0644 root sys
+f kernel/drv/dld.conf 0644 root sys
+f kernel/drv/dlpistub.conf 0644 root sys
+f kernel/drv/dprov.conf 0644 root sys
+f kernel/drv/dr_sas.conf 0644 root sys
+f kernel/drv/dtrace.conf 0644 root sys
+f kernel/drv/e1000g.conf 0644 root sys
+f kernel/drv/ehci.conf 0644 root sys
+f kernel/drv/eibnx.conf 0644 root sys
+f kernel/drv/fasttrap.conf 0644 root sys
+f kernel/drv/fbt.conf 0644 root sys
+f kernel/drv/fp.conf 0644 root sys
+f kernel/drv/hxge.conf 0644 root sys
+f kernel/drv/icmp.conf 0644 root sys
+f kernel/drv/icmp6.conf 0644 root sys
+f kernel/drv/igb.conf 0644 root sys
+f kernel/drv/intel_nb5000.conf 0644 root sys
+f kernel/drv/intel_nhm.conf 0644 root sys
+f kernel/drv/intel_nhmex.conf 0644 root sys
+f kernel/drv/ip.conf 0644 root sys
+f kernel/drv/ip6.conf 0644 root sys
+f kernel/drv/ipd.conf 0644 root sys
+f kernel/drv/ipnet.conf 0644 root sys
+f kernel/drv/ippctl.conf 0644 root sys
+f kernel/drv/ipsecah.conf 0644 root sys
+f kernel/drv/ipsecesp.conf 0644 root sys
+f kernel/drv/iptun.conf 0644 root sys
+f kernel/drv/iscsi.conf 0644 root sys
+f kernel/drv/iscsit.conf 0644 root sys
+f kernel/drv/iwscn.conf 0644 root sys
+f kernel/drv/ixgbe.conf 0644 root sys
+f kernel/drv/keysock.conf 0644 root sys
+f kernel/drv/kmdb.conf 0644 root sys
+f kernel/drv/kssl.conf 0644 root sys
+f kernel/drv/llc1.conf 0644 root sys
+f kernel/drv/lockstat.conf 0644 root sys
+f kernel/drv/lofi.conf 0644 root sys
+f kernel/drv/log.conf 0644 root sys
+f kernel/drv/lsimega.conf 0644 root sys
+f kernel/drv/mega_sas.conf 0644 root sys
+f kernel/drv/mm.conf 0644 root sys
+f kernel/drv/mpt.conf 0644 root sys
+f kernel/drv/mpt_sas.conf 0644 root sys
+f kernel/drv/mr_sas.conf 0644 root sys
+f kernel/drv/nge.conf 0644 root sys
+f kernel/drv/ntxn.conf 0644 root sys
+f kernel/drv/nv_sata.conf 0644 root sys
+f kernel/drv/nxge.conf 0644 root sys
+f kernel/drv/ohci.conf 0644 root sys
+f kernel/drv/openeepr.conf 0644 root sys
+f kernel/drv/options.conf 0644 root sys
+f kernel/drv/pcieb.conf 0644 root sys
+f kernel/drv/physmem.conf 0644 root sys
+f kernel/drv/pmcs.conf 0644 root sys
+f kernel/drv/poll.conf 0644 root sys
+f kernel/drv/power.conf 0644 root sys
+f kernel/drv/profile.conf 0644 root sys
+f kernel/drv/pseudo.conf 0644 root sys
+f kernel/drv/ptc.conf 0644 root sys
+f kernel/drv/ptsl.conf 0644 root sys
+f kernel/drv/qlc.conf 0644 root sys
+f kernel/drv/ramdisk.conf 0644 root sys
+f kernel/drv/random.conf 0644 root sys
+f kernel/drv/sad.conf 0644 root sys
+f kernel/drv/scsa2usb.conf 0644 root sys
+f kernel/drv/scsi_vhci.conf 0644 root sys
+f kernel/drv/sd.conf 0644 root sys
+f kernel/drv/sdt.conf 0644 root sys
+f kernel/drv/ses.conf 0644 root sys
+f kernel/drv/sgen.conf 0644 root sys
+f kernel/drv/simnet.conf 0644 root sys
+f kernel/drv/smbios.conf 0644 root sys
+f kernel/drv/smp.conf 0644 root sys
+f kernel/drv/softmac.conf 0644 root sys
+f kernel/drv/spdsock.conf 0644 root sys
+f kernel/drv/srn.conf 0644 root sys
+f kernel/drv/st.conf 0644 root sys
+f kernel/drv/stmf.conf 0644 root sys
+f kernel/drv/stmf_sbd.conf 0644 root sys
+f kernel/drv/sy.conf 0644 root sys
+f kernel/drv/sysevent.conf 0644 root sys
+f kernel/drv/sysmsg.conf 0644 root sys
+f kernel/drv/systrace.conf 0644 root sys
+f kernel/drv/tcp.conf 0644 root sys
+f kernel/drv/tcp6.conf 0644 root sys
+f kernel/drv/tl.conf 0644 root sys
+f kernel/drv/tzmon.conf 0644 root sys
+f kernel/drv/ucode.conf 0644 root sys
+f kernel/drv/udp.conf 0644 root sys
+f kernel/drv/udp6.conf 0644 root sys
+f kernel/drv/uhci.conf 0644 root sys
+f kernel/drv/usbftdi.conf 0644 root sys
+f kernel/drv/usbser_edge.conf 0644 root sys
+f kernel/drv/usbskel.conf 0644 root sys
+f kernel/drv/vmxnet.conf 0644 root sys
+f kernel/drv/vnic.conf 0644 root sys
+f kernel/drv/vscan.conf 0644 root sys
+f kernel/drv/wc.conf 0644 root sys
+f kernel/drv/zfs.conf 0644 root sys
+d kernel/dtrace 0755 root sys
+d kernel/dtrace/amd64 0755 root sys
+f kernel/dtrace/amd64/dcpc 0755 root sys
+f kernel/dtrace/amd64/fasttrap 0755 root sys
+f kernel/dtrace/amd64/fbt 0755 root sys
+f kernel/dtrace/amd64/lockstat 0755 root sys
+f kernel/dtrace/amd64/profile 0755 root sys
+f kernel/dtrace/amd64/sdt 0755 root sys
+f kernel/dtrace/amd64/systrace 0755 root sys
+d kernel/exec 0755 root sys
+d kernel/exec/amd64 0755 root sys
+f kernel/exec/amd64/elfexec 0755 root sys
+f kernel/exec/amd64/intpexec 0755 root sys
+d kernel/fs 0755 root sys
+d kernel/fs/amd64 0755 root sys
+f kernel/fs/amd64/autofs 0755 root sys
+f kernel/fs/amd64/ctfs 0755 root sys
+f kernel/fs/amd64/dcfs 0755 root sys
+f kernel/fs/amd64/dev 0755 root sys
+f kernel/fs/amd64/devfs 0755 root sys
+f kernel/fs/amd64/fifofs 0755 root sys
+f kernel/fs/amd64/hsfs 0755 root sys
+f kernel/fs/amd64/hyprlofs 0755 root sys
+f kernel/fs/amd64/lofs 0755 root sys
+f kernel/fs/amd64/lxprocfs 0755 root sys
+f kernel/fs/amd64/mntfs 0755 root sys
+f kernel/fs/amd64/namefs 0755 root sys
+f kernel/fs/amd64/nfs 0755 root sys
+f kernel/fs/amd64/objfs 0755 root sys
+f kernel/fs/amd64/procfs 0755 root sys
+f kernel/fs/amd64/sharefs 0755 root sys
+f kernel/fs/amd64/sockfs 0755 root sys
+f kernel/fs/amd64/specfs 0755 root sys
+f kernel/fs/amd64/tmpfs 0755 root sys
+f kernel/fs/amd64/ufs 0755 root sys
+f kernel/fs/amd64/zfs 0755 root sys
+d kernel/ipp 0755 root sys
+d kernel/ipp/amd64 0755 root sys
+f kernel/ipp/amd64/dlcosmk 0755 root sys
+f kernel/ipp/amd64/dscpmk 0755 root sys
+f kernel/ipp/amd64/flowacct 0755 root sys
+f kernel/ipp/amd64/ipgpc 0755 root sys
+f kernel/ipp/amd64/tokenmt 0755 root sys
+f kernel/ipp/amd64/tswtclmt 0755 root sys
+d kernel/kiconv 0755 root sys
+d kernel/kiconv/amd64 0755 root sys
+f kernel/kiconv/amd64/kiconv_emea 0755 root sys
+f kernel/kiconv/amd64/kiconv_ja 0755 root sys
+f kernel/kiconv/amd64/kiconv_ko 0755 root sys
+f kernel/kiconv/amd64/kiconv_sc 0755 root sys
+f kernel/kiconv/amd64/kiconv_tc 0755 root sys
+d kernel/kmdb 0755 root sys
+d kernel/kmdb/amd64 0755 root sys
+f kernel/kmdb/amd64/arp 0555 root sys
+f kernel/kmdb/amd64/cpc 0555 root sys
+f kernel/kmdb/amd64/cpu.generic 0555 root sys
+f kernel/kmdb/amd64/cpu_ms.AuthenticAMD.15 0555 root sys
+f kernel/kmdb/amd64/crypto 0555 root sys
+f kernel/kmdb/amd64/emlxs 0555 root sys
+f kernel/kmdb/amd64/fctl 0555 root sys
+f kernel/kmdb/amd64/genunix 0555 root sys
+f kernel/kmdb/amd64/hook 0555 root sys
+f kernel/kmdb/amd64/idm 0555 root sys
+f kernel/kmdb/amd64/ii 0555 root sys
+f kernel/kmdb/amd64/ip 0555 root sys
+f kernel/kmdb/amd64/ipc 0555 root sys
+f kernel/kmdb/amd64/ipp 0555 root sys
+f kernel/kmdb/amd64/krtld 0555 root sys
+f kernel/kmdb/amd64/lofs 0555 root sys
+f kernel/kmdb/amd64/logindmux 0555 root sys
+f kernel/kmdb/amd64/mac 0555 root sys
+f kernel/kmdb/amd64/mdb_ds 0555 root sys
+f kernel/kmdb/amd64/mpt 0555 root sys
+f kernel/kmdb/amd64/mpt_sas 0555 root sys
+f kernel/kmdb/amd64/mr_sas 0555 root sys
+f kernel/kmdb/amd64/nca 0555 root sys
+f kernel/kmdb/amd64/neti 0555 root sys
+f kernel/kmdb/amd64/nfs 0555 root sys
+f kernel/kmdb/amd64/nsctl 0555 root sys
+f kernel/kmdb/amd64/ptm 0555 root sys
+f kernel/kmdb/amd64/qlc 0555 root sys
+f kernel/kmdb/amd64/random 0555 root sys
+f kernel/kmdb/amd64/rdc 0555 root sys
+f kernel/kmdb/amd64/s1394 0555 root sys
+f kernel/kmdb/amd64/sata 0555 root sys
+f kernel/kmdb/amd64/scsi_vhci 0555 root sys
+f kernel/kmdb/amd64/sctp 0555 root sys
+f kernel/kmdb/amd64/sd 0555 root sys
+f kernel/kmdb/amd64/sdbc 0555 root sys
+f kernel/kmdb/amd64/sockfs 0555 root sys
+f kernel/kmdb/amd64/specfs 0555 root sys
+f kernel/kmdb/amd64/sppp 0555 root sys
+f kernel/kmdb/amd64/srpt 0555 root sys
+f kernel/kmdb/amd64/stmf 0555 root sys
+f kernel/kmdb/amd64/stmf_sbd 0555 root sys
+f kernel/kmdb/amd64/sv 0555 root sys
+f kernel/kmdb/amd64/ufs 0555 root sys
+f kernel/kmdb/amd64/uhci 0555 root sys
+f kernel/kmdb/amd64/usba 0555 root sys
+f kernel/kmdb/amd64/zfs 0555 root sys
+d kernel/mac 0755 root sys
+d kernel/mac/amd64 0755 root sys
+f kernel/mac/amd64/mac_6to4 0755 root sys
+f kernel/mac/amd64/mac_ether 0755 root sys
+f kernel/mac/amd64/mac_ib 0755 root sys
+f kernel/mac/amd64/mac_ipv4 0755 root sys
+f kernel/mac/amd64/mac_ipv6 0755 root sys
+f kernel/mac/amd64/mac_wifi 0755 root sys
+d kernel/misc 0755 root sys
+d kernel/misc/amd64 0755 root sys
+f kernel/misc/amd64/ac97 0755 root sys
+f kernel/misc/amd64/acpica 0755 root sys
+f kernel/misc/amd64/agpmaster 0755 root sys
+f kernel/misc/amd64/bignum 0755 root sys
+f kernel/misc/amd64/bootdev 0755 root sys
+f kernel/misc/amd64/busra 0755 root sys
+f kernel/misc/amd64/cmlb 0755 root sys
+f kernel/misc/amd64/consconfig 0755 root sys
+f kernel/misc/amd64/ctf 0755 root sys
+f kernel/misc/amd64/dadk 0755 root sys
+f kernel/misc/amd64/dcopy 0755 root sys
+s kernel/misc/amd64/des=../../../kernel/crypto/amd64/des
+f kernel/misc/amd64/dls 0755 root sys
+f kernel/misc/amd64/drm 0755 root sys
+f kernel/misc/amd64/fctl 0755 root sys
+f kernel/misc/amd64/fssnap_if 0755 root sys
+f kernel/misc/amd64/gda 0755 root sys
+f kernel/misc/amd64/gld 0755 root sys
+f kernel/misc/amd64/hidparser 0755 root sys
+f kernel/misc/amd64/hook 0755 root sys
+f kernel/misc/amd64/hpcsvc 0755 root sys
+f kernel/misc/amd64/hwa1480_fw 0755 root sys
+f kernel/misc/amd64/idm 0755 root sys
+f kernel/misc/amd64/idmap 0755 root sys
+f kernel/misc/amd64/iommulib 0755 root sys
+f kernel/misc/amd64/ipc 0755 root sys
+f kernel/misc/amd64/kbtrans 0755 root sys
+f kernel/misc/amd64/kcf 0755 root sys
+f kernel/misc/amd64/kgssapi 0755 root sys
+f kernel/misc/amd64/klmmod 0755 root sys
+f kernel/misc/amd64/klmops 0755 root sys
+f kernel/misc/amd64/kmdbmod 0755 root sys
+f kernel/misc/amd64/ksocket 0755 root sys
+f kernel/misc/amd64/mac 0755 root sys
+f kernel/misc/amd64/md5 0755 root sys
+f kernel/misc/amd64/mii 0755 root sys
+f kernel/misc/amd64/mwlfw 0755 root sys
+f kernel/misc/amd64/net80211 0755 root sys
+f kernel/misc/amd64/neti 0755 root sys
+f kernel/misc/amd64/nfs_dlboot 0755 root sys
+f kernel/misc/amd64/nfssrv 0755 root sys
+f kernel/misc/amd64/pci_autoconfig 0755 root sys
+f kernel/misc/amd64/pcicfg 0755 root sys
+f kernel/misc/amd64/pcie 0755 root sys
+f kernel/misc/amd64/pcihp 0755 root sys
+f kernel/misc/amd64/pcmcia 0755 root sys
+f kernel/misc/amd64/rpcsec 0755 root sys
+f kernel/misc/amd64/rpcsec_gss 0755 root sys
+f kernel/misc/amd64/rsmops 0755 root sys
+f kernel/misc/amd64/s1394 0755 root sys
+f kernel/misc/amd64/sata 0755 root sys
+f kernel/misc/amd64/sbp2 0755 root sys
+f kernel/misc/amd64/scsi 0755 root sys
+f kernel/misc/amd64/sda 0755 root sys
+f kernel/misc/amd64/sha1 0755 root sys
+f kernel/misc/amd64/sha2 0755 root sys
+f kernel/misc/amd64/strategy 0755 root sys
+f kernel/misc/amd64/strplumb 0755 root sys
+f kernel/misc/amd64/tem 0755 root sys
+f kernel/misc/amd64/tlimod 0755 root sys
+f kernel/misc/amd64/usba 0755 root sys
+f kernel/misc/amd64/usba10 0755 root sys
+f kernel/misc/amd64/usbs49_fw 0755 root sys
+f kernel/misc/amd64/usbser 0755 root sys
+d kernel/misc/kgss 0755 root sys
+d kernel/misc/kgss/amd64 0755 root sys
+f kernel/misc/kgss/amd64/kmech_krb5 0755 root sys
+d kernel/misc/pmcs 0755 root sys
+d kernel/misc/pmcs/amd64 0755 root sys
+f kernel/misc/pmcs/amd64/pmcs8001fw 0755 root sys
+d kernel/misc/qlc 0755 root sys
+d kernel/misc/qlc/amd64 0755 root sys
+f kernel/misc/qlc/amd64/qlc_fw_2200 0755 root sys
+f kernel/misc/qlc/amd64/qlc_fw_2300 0755 root sys
+f kernel/misc/qlc/amd64/qlc_fw_2400 0755 root sys
+f kernel/misc/qlc/amd64/qlc_fw_2500 0755 root sys
+f kernel/misc/qlc/amd64/qlc_fw_6322 0755 root sys
+f kernel/misc/qlc/amd64/qlc_fw_8100 0755 root sys
+d kernel/misc/scsi_vhci 0755 root sys
+d kernel/misc/scsi_vhci/amd64 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_asym_emc 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_asym_lsi 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_asym_sun 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_sym 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_sym_emc 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_sym_hds 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_tape 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_tpgs 0755 root sys
+f kernel/misc/scsi_vhci/amd64/scsi_vhci_f_tpgs_tape 0755 root sys
+d kernel/sched 0755 root sys
+d kernel/sched/amd64 0755 root sys
+f kernel/sched/amd64/SDC 0755 root sys
+f kernel/sched/amd64/TS 0755 root sys
+f kernel/sched/amd64/TS_DPTBL 0755 root sys
+d kernel/socketmod 0755 root sys
+d kernel/socketmod/amd64 0755 root sys
+h kernel/socketmod/amd64/icmp=kernel/drv/amd64/icmp
+f kernel/socketmod/amd64/ksslf 0755 root sys
+f kernel/socketmod/amd64/rts 0755 root sys
+f kernel/socketmod/amd64/sockrds 0755 root sys
+f kernel/socketmod/amd64/socksctp 0755 root sys
+f kernel/socketmod/amd64/socksdp 0755 root sys
+h kernel/socketmod/amd64/tcp=kernel/drv/amd64/tcp
+f kernel/socketmod/amd64/trill 0755 root sys
+h kernel/socketmod/amd64/udp=kernel/drv/amd64/udp
+d kernel/strmod 0755 root sys
+d kernel/strmod/amd64 0755 root sys
+f kernel/strmod/amd64/arp 0755 root sys
+f kernel/strmod/amd64/bufmod 0755 root sys
+f kernel/strmod/amd64/connld 0755 root sys
+f kernel/strmod/amd64/dedump 0755 root sys
+f kernel/strmod/amd64/drcompat 0755 root sys
+h kernel/strmod/amd64/icmp=kernel/drv/amd64/icmp
+f kernel/strmod/amd64/ip 0755 root sys
+f kernel/strmod/amd64/ipsecah 0755 root sys
+f kernel/strmod/amd64/ipsecesp 0755 root sys
+f kernel/strmod/amd64/keysock 0755 root sys
+f kernel/strmod/amd64/ldterm 0755 root sys
+f kernel/strmod/amd64/nca 0755 root sys
+f kernel/strmod/amd64/pckt 0755 root sys
+f kernel/strmod/amd64/pfmod 0755 root sys
+f kernel/strmod/amd64/pipemod 0755 root sys
+f kernel/strmod/amd64/ptem 0755 root sys
+f kernel/strmod/amd64/redirmod 0755 root sys
+f kernel/strmod/amd64/rpcmod 0755 root sys
+f kernel/strmod/amd64/sdpib 0755 root sys
+h kernel/strmod/amd64/tcp=kernel/drv/amd64/tcp
+f kernel/strmod/amd64/timod 0755 root sys
+f kernel/strmod/amd64/tirdwr 0755 root sys
+f kernel/strmod/amd64/ttcompat 0755 root sys
+h kernel/strmod/amd64/udp=kernel/drv/amd64/udp
+f kernel/strmod/amd64/usb_ah 0755 root sys
+f kernel/strmod/amd64/usbkbm 0755 root sys
+f kernel/strmod/amd64/usbms 0755 root sys
+f kernel/strmod/amd64/usbwcm 0755 root sys
+f kernel/strmod/amd64/vuid2ps2 0755 root sys
+f kernel/strmod/amd64/vuid3ps2 0755 root sys
+f kernel/strmod/amd64/vuidm3p 0755 root sys
+f kernel/strmod/amd64/vuidm4p 0755 root sys
+f kernel/strmod/amd64/vuidm5p 0755 root sys
+d kernel/sys 0755 root sys
+d kernel/sys/amd64 0755 root sys
+f kernel/sys/amd64/autofs 0755 root sys
+f kernel/sys/amd64/c2audit 0755 root sys
+f kernel/sys/amd64/doorfs 0755 root sys
+f kernel/sys/amd64/inst_sync 0755 root sys
+f kernel/sys/amd64/kaio 0755 root sys
+f kernel/sys/amd64/msgsys 0755 root sys
+f kernel/sys/amd64/nfs 0755 root sys
+f kernel/sys/amd64/pipe 0755 root sys
+f kernel/sys/amd64/portfs 0755 root sys
+f kernel/sys/amd64/pset 0755 root sys
+f kernel/sys/amd64/rpcmod 0755 root sys
+f kernel/sys/amd64/semsys 0755 root sys
+f kernel/sys/amd64/shmsys 0755 root sys
+d lib 0755 root bin
+s lib/32=.
+s lib/64=amd64
+d lib/amd64 0755 root bin
+f lib/amd64/c_synonyms.so.1 0755 root bin
+f lib/amd64/ld.so.1 0755 root bin
+f lib/amd64/libMPAPI.so.1 0755 root bin
+s lib/amd64/libMPAPI.so=libMPAPI.so.1
+f lib/amd64/libadm.so.1 0755 root bin
+s lib/amd64/libadm.so=libadm.so.1
+f lib/amd64/libaio.so.1 0755 root bin
+s lib/amd64/libaio.so=libaio.so.1
+f lib/amd64/libavl.so.1 0755 root bin
+s lib/amd64/libavl.so=libavl.so.1
+f lib/amd64/libbsm.so.1 0755 root bin
+s lib/amd64/libbsm.so=libbsm.so.1
+f lib/amd64/libc.so.1 0755 root bin
+s lib/amd64/libc.so=libc.so.1
+f lib/amd64/libc_db.so.1 0755 root bin
+s lib/amd64/libc_db.so=libc_db.so.1
+f lib/amd64/libcmdutils.so.1 0755 root bin
+s lib/amd64/libcmdutils.so=libcmdutils.so.1
+f lib/amd64/libcontract.so.1 0755 root bin
+s lib/amd64/libcontract.so=libcontract.so.1
+f lib/amd64/libcryptoutil.so.1 0755 root bin
+s lib/amd64/libcryptoutil.so=libcryptoutil.so.1
+f lib/amd64/libctf.so.1 0755 root bin
+s lib/amd64/libctf.so=libctf.so.1
+f lib/amd64/libcurses.so.1 0755 root bin
+s lib/amd64/libcurses.so=libcurses.so.1
+f lib/amd64/libdevice.so.1 0755 root bin
+s lib/amd64/libdevice.so=libdevice.so.1
+f lib/amd64/libdevid.so.1 0755 root bin
+s lib/amd64/libdevid.so=libdevid.so.1
+f lib/amd64/libdevinfo.so.1 0755 root bin
+s lib/amd64/libdevinfo.so=libdevinfo.so.1
+f lib/amd64/libdl.so.1 0755 root bin
+s lib/amd64/libdl.so=libdl.so.1
+f lib/amd64/libdladm.so.1 0755 root bin
+s lib/amd64/libdladm.so=libdladm.so.1
+f lib/amd64/libdlpi.so.1 0755 root bin
+s lib/amd64/libdlpi.so=libdlpi.so.1
+f lib/amd64/libdoor.so.1 0755 root bin
+s lib/amd64/libdoor.so=libdoor.so.1
+f lib/amd64/libefi.so.1 0755 root bin
+s lib/amd64/libefi.so=libefi.so.1
+f lib/amd64/libelf.so.1 0755 root bin
+s lib/amd64/libelf.so=libelf.so.1
+f lib/amd64/libfdisk.so.1 0755 root bin
+s lib/amd64/libfdisk.so=libfdisk.so.1
+f lib/amd64/libgen.so.1 0755 root bin
+s lib/amd64/libgen.so=libgen.so.1
+f lib/amd64/libinetutil.so.1 0755 root bin
+s lib/amd64/libinetutil.so=libinetutil.so.1
+f lib/amd64/libintl.so.1 0755 root bin
+s lib/amd64/libintl.so=libintl.so.1
+f lib/amd64/libkmf.so.1 0755 root bin
+s lib/amd64/libkmf.so=libkmf.so.1
+f lib/amd64/libkmfberder.so.1 0755 root bin
+s lib/amd64/libkmfberder.so=libkmfberder.so.1
+f lib/amd64/libkstat.so.1 0755 root bin
+s lib/amd64/libkstat.so=libkstat.so.1
+f lib/amd64/libld.so.4 0755 root bin
+f lib/amd64/liblddbg.so.4 0755 root bin
+f lib/amd64/libmd.so.1 0755 root bin
+s lib/amd64/libmd.so=libmd.so.1
+f lib/amd64/libmd5.so.1 0755 root bin
+s lib/amd64/libmd5.so=libmd5.so.1
+f lib/amd64/libmp.so.2 0755 root bin
+s lib/amd64/libmp.so=libmp.so.2
+f lib/amd64/libmpscsi_vhci.so.1 0755 root bin
+s lib/amd64/libmpscsi_vhci.so=libmpscsi_vhci.so.1
+f lib/amd64/libnsl.so.1 0755 root bin
+s lib/amd64/libnsl.so=libnsl.so.1
+f lib/amd64/libnvpair.so.1 0755 root bin
+s lib/amd64/libnvpair.so=libnvpair.so.1
+f lib/amd64/libpam.so.1 0755 root bin
+s lib/amd64/libpam.so=libpam.so.1
+s lib/amd64/libposix4.so.1=librt.so.1
+s lib/amd64/libposix4.so=libposix4.so.1
+f lib/amd64/libproc.so.1 0755 root bin
+s lib/amd64/libproc.so=libproc.so.1
+f lib/amd64/libpthread.so.1 0755 root bin
+s lib/amd64/libpthread.so=libpthread.so.1
+f lib/amd64/librcm.so.1 0755 root bin
+s lib/amd64/librcm.so=librcm.so.1
+f lib/amd64/libresolv.so.2 0755 root bin
+s lib/amd64/libresolv.so=libresolv.so.2
+f lib/amd64/libresolv_joy.so.2 0755 root bin
+f lib/amd64/librestart.so.1 0755 root bin
+s lib/amd64/librestart.so=librestart.so.1
+f lib/amd64/librpcsvc.so.1 0755 root bin
+s lib/amd64/librpcsvc.so=librpcsvc.so.1
+f lib/amd64/librt.so.1 0755 root bin
+s lib/amd64/librt.so=librt.so.1
+f lib/amd64/librtld.so.1 0755 root bin
+f lib/amd64/librtld_db.so.1 0755 root bin
+s lib/amd64/librtld_db.so=librtld_db.so.1
+f lib/amd64/libscf.so.1 0755 root bin
+s lib/amd64/libscf.so=libscf.so.1
+f lib/amd64/libsec.so.1 0755 root bin
+s lib/amd64/libsec.so=libsec.so.1
+f lib/amd64/libsecdb.so.1 0755 root bin
+s lib/amd64/libsecdb.so=libsecdb.so.1
+f lib/amd64/libsendfile.so.1 0755 root bin
+s lib/amd64/libsendfile.so=libsendfile.so.1
+f lib/amd64/libsmartsshd.so.1 0755 root bin
+s lib/amd64/libsmartsshd.so=libsmartsshd.so.1
+f lib/amd64/libsocket.so.1 0755 root bin
+s lib/amd64/libsocket.so=libsocket.so.1
+f lib/amd64/libsysevent.so.1 0755 root bin
+s lib/amd64/libsysevent.so=libsysevent.so.1
+f lib/amd64/libtermcap.so.1 0755 root bin
+s lib/amd64/libtermcap.so=libtermcap.so.1
+s lib/amd64/libtermlib.so.1=libcurses.so.1
+s lib/amd64/libtermlib.so=libtermlib.so.1
+f lib/amd64/libthread.so.1 0755 root bin
+s lib/amd64/libthread.so=libthread.so.1
+s lib/amd64/libthread_db.so.1=libc_db.so.1
+s lib/amd64/libthread_db.so=libc_db.so.1
+f lib/amd64/libtsnet.so.1 0755 root bin
+s lib/amd64/libtsnet.so=libtsnet.so.1
+f lib/amd64/libtsol.so.2 0755 root bin
+s lib/amd64/libtsol.so=libtsol.so.2
+f lib/amd64/libumem.so.1 0755 root bin
+s lib/amd64/libumem.so=libumem.so.1
+f lib/amd64/libumem_trampoline.so.1 0755 root bin
+s lib/amd64/libumem_trampoline.so=libumem_trampoline.so.1
+f lib/amd64/libuuid.so.1 0755 root bin
+s lib/amd64/libuuid.so=libuuid.so.1
+f lib/amd64/libuutil.so.1 0755 root bin
+s lib/amd64/libuutil.so=libuutil.so.1
+f lib/amd64/libw.so.1 0755 root bin
+s lib/amd64/libw.so=libw.so.1
+f lib/amd64/libxnet.so.1 0755 root bin
+s lib/amd64/libxnet.so=libxnet.so.1
+f lib/amd64/libzdoor.so.1 0755 root bin
+s lib/amd64/libzdoor.so=libzdoor.so.1
+f lib/amd64/libzfs.so.1 0755 root bin
+s lib/amd64/libzfs.so=libzfs.so.1
+s lib/amd64/libzfs_core.so=../usr/lib/amd64/libzfs_core.so
+s lib/amd64/libzfs_core.so.1=../usr/lib/amd64/libzfs_core.so.1
+f lib/amd64/nss_compat.so.1 0755 root bin
+f lib/amd64/nss_dns.so.1 0755 root bin
+f lib/amd64/nss_files.so.1 0755 root bin
+f lib/amd64/nss_nis.so.1 0755 root bin
+f lib/amd64/nss_user.so.1 0755 root bin
+f lib/c_synonyms.so.1 0755 root bin
+d lib/crypto 0755 root bin
+s lib/crypto/32=.
+s lib/crypto/64=amd64
+d lib/crypto/amd64 0755 root bin
+f lib/crypto/amd64/kmf_mapper_cn.so.1 0755 root bin
+f lib/crypto/amd64/kmf_nss.so.1 0755 root bin
+f lib/crypto/amd64/kmf_openssl.so.1 0755 root bin
+f lib/crypto/amd64/kmf_pkcs11.so.1 0755 root bin
+f lib/crypto/kmf_mapper_cn.so.1 0755 root bin
+f lib/crypto/kmf_nss.so.1 0755 root bin
+f lib/crypto/kmf_openssl.so.1 0755 root bin
+f lib/crypto/kmf_pkcs11.so.1 0755 root bin
+d lib/fm 0755 root bin
+d lib/fm/amd64 0755 root bin
+f lib/fm/amd64/libfmevent.so.1 0755 root bin
+s lib/fm/amd64/libfmevent.so=libfmevent.so.1
+f lib/fm/libfmevent.so.1 0755 root bin
+s lib/fm/libfmevent.so=libfmevent.so.1
+d lib/fs 0755 root sys
+d lib/fs/dev 0755 root sys
+h lib/fs/dev/mount=etc/fs/dev/mount
+d lib/fs/hsfs 0755 root sys
+h lib/fs/hsfs/mount=etc/fs/hsfs/mount
+d lib/fs/nfs 0755 root sys
+h lib/fs/nfs/mount=etc/fs/nfs/mount
+d lib/fs/ufs 0755 root sys
+h lib/fs/ufs/mount=etc/fs/ufs/mount
+d lib/fs/zfs 0755 root sys
+h lib/fs/zfs/mount=etc/fs/zfs/mount
+h lib/fs/zfs/umount=etc/fs/zfs/umount
+d lib/inet 0755 root bin
+f lib/inet/in.mpathd 0555 root bin
+f lib/inet/ipmgmtd 0555 root bin
+f lib/inet/netcfgd 0555 root bin
+f lib/inet/nwamd 0555 root bin
+f lib/ld.so.1 0755 root bin
+f lib/libMPAPI.so.1 0755 root bin
+s lib/libMPAPI.so=libMPAPI.so.1
+f lib/libadm.so.1 0755 root bin
+s lib/libadm.so=libadm.so.1
+f lib/libaio.so.1 0755 root bin
+s lib/libaio.so=libaio.so.1
+f lib/libavl.so.1 0755 root bin
+s lib/libavl.so=libavl.so.1
+f lib/libbsm.so.1 0755 root bin
+s lib/libbsm.so=libbsm.so.1
+f lib/libc.so.1 0755 root bin
+s lib/libc.so=libc.so.1
+f lib/libc_db.so.1 0755 root bin
+s lib/libc_db.so=libc_db.so.1
+f lib/libcmdutils.so.1 0755 root bin
+s lib/libcmdutils.so=libcmdutils.so.1
+f lib/libcontract.so.1 0755 root bin
+s lib/libcontract.so=libcontract.so.1
+f lib/libcryptoutil.so.1 0755 root bin
+s lib/libcryptoutil.so=libcryptoutil.so.1
+f lib/libctf.so.1 0755 root bin
+s lib/libctf.so=libctf.so.1
+f lib/libcurses.so.1 0755 root bin
+s lib/libcurses.so=libcurses.so.1
+f lib/libdevice.so.1 0755 root bin
+s lib/libdevice.so=libdevice.so.1
+f lib/libdevid.so.1 0755 root bin
+s lib/libdevid.so=libdevid.so.1
+f lib/libdevinfo.so.1 0755 root bin
+s lib/libdevinfo.so=libdevinfo.so.1
+f lib/libdhcpagent.so.1 0755 root bin
+s lib/libdhcpagent.so=libdhcpagent.so.1
+f lib/libdhcputil.so.1 0755 root bin
+s lib/libdhcputil.so=libdhcputil.so.1
+f lib/libdl.so.1 0755 root bin
+s lib/libdl.so=libdl.so.1
+f lib/libdladm.so.1 0755 root bin
+s lib/libdladm.so=libdladm.so.1
+f lib/libdlpi.so.1 0755 root bin
+s lib/libdlpi.so=libdlpi.so.1
+f lib/libdoor.so.1 0755 root bin
+s lib/libdoor.so=libdoor.so.1
+f lib/libefi.so.1 0755 root bin
+s lib/libefi.so=libefi.so.1
+f lib/libelf.so.1 0755 root bin
+s lib/libelf.so=libelf.so.1
+f lib/libelfsign.so.1 0755 root bin
+s lib/libelfsign.so=libelfsign.so.1
+f lib/libfdisk.so.1 0755 root bin
+s lib/libfdisk.so=libfdisk.so.1
+f lib/libgen.so.1 0755 root bin
+s lib/libgen.so=libgen.so.1
+f lib/libgrubmgmt.so.1 0755 root bin
+s lib/libgrubmgmt.so=libgrubmgmt.so.1
+f lib/libinetutil.so.1 0755 root bin
+s lib/libinetutil.so=libinetutil.so.1
+f lib/libintl.so.1 0755 root bin
+s lib/libintl.so=libintl.so.1
+f lib/libipadm.so.1 0755 root bin
+s lib/libipadm.so=libipadm.so.1
+f lib/libipmp.so.1 0755 root bin
+s lib/libipmp.so=libipmp.so.1
+f lib/libkcfd.so.1 0755 root bin
+s lib/libkcfd.so=libkcfd.so.1
+f lib/libkmf.so.1 0755 root bin
+s lib/libkmf.so=libkmf.so.1
+f lib/libkmfberder.so.1 0755 root bin
+s lib/libkmfberder.so=libkmfberder.so.1
+f lib/libkstat.so.1 0755 root bin
+s lib/libkstat.so=libkstat.so.1
+f lib/libld.so.4 0755 root bin
+f lib/liblddbg.so.4 0755 root bin
+f lib/libmd.so.1 0755 root bin
+s lib/libmd.so=libmd.so.1
+f lib/libmd5.so.1 0755 root bin
+s lib/libmd5.so=libmd5.so.1
+f lib/libmp.so.1 0755 root bin
+f lib/libmp.so.2 0755 root bin
+s lib/libmp.so=libmp.so.2
+f lib/libmpscsi_vhci.so.1 0755 root bin
+s lib/libmpscsi_vhci.so=libmpscsi_vhci.so.1
+f lib/libnsl.so.1 0755 root bin
+s lib/libnsl.so=libnsl.so.1
+f lib/libnvpair.so.1 0755 root bin
+s lib/libnvpair.so=libnvpair.so.1
+f lib/libnwam.so.1 0755 root bin
+s lib/libnwam.so=libnwam.so.1
+f lib/libpam.so.1 0755 root bin
+s lib/libpam.so=libpam.so.1
+s lib/libposix4.so.1=librt.so.1
+s lib/libposix4.so=libposix4.so.1
+f lib/libproc.so.1 0755 root bin
+s lib/libproc.so=libproc.so.1
+f lib/libpthread.so.1 0755 root bin
+s lib/libpthread.so=libpthread.so.1
+f lib/librcm.so.1 0755 root bin
+s lib/librcm.so=librcm.so.1
+f lib/libresolv.so.1 0755 root bin
+f lib/libresolv.so.2 0755 root bin
+s lib/libresolv.so=libresolv.so.2
+f lib/libresolv_joy.so.2 0755 root bin
+f lib/librestart.so.1 0755 root bin
+s lib/librestart.so=librestart.so.1
+f lib/librpcsvc.so.1 0755 root bin
+s lib/librpcsvc.so=librpcsvc.so.1
+f lib/librt.so.1 0755 root bin
+s lib/librt.so=librt.so.1
+f lib/librtld.so.1 0755 root bin
+f lib/librtld_db.so.1 0755 root bin
+s lib/librtld_db.so=librtld_db.so.1
+f lib/libscf.so.1 0755 root bin
+s lib/libscf.so=libscf.so.1
+f lib/libsec.so.1 0755 root bin
+s lib/libsec.so=libsec.so.1
+f lib/libsecdb.so.1 0755 root bin
+s lib/libsecdb.so=libsecdb.so.1
+f lib/libsendfile.so.1 0755 root bin
+s lib/libsendfile.so=libsendfile.so.1
+f lib/libsmartsshd.so.1 0755 root bin
+s lib/libsmartsshd.so=libsmartsshd.so.1
+f lib/libsocket.so.1 0755 root bin
+s lib/libsocket.so=libsocket.so.1
+f lib/libsysevent.so.1 0755 root bin
+s lib/libsysevent.so=libsysevent.so.1
+f lib/libtermcap.so.1 0755 root bin
+s lib/libtermcap.so=libtermcap.so.1
+s lib/libtermlib.so.1=libcurses.so.1
+s lib/libtermlib.so=libtermlib.so.1
+f lib/libthread.so.1 0755 root bin
+s lib/libthread.so=libthread.so.1
+s lib/libthread_db.so.1=libc_db.so.1
+s lib/libthread_db.so=libc_db.so.1
+f lib/libtsnet.so.1 0755 root bin
+s lib/libtsnet.so=libtsnet.so.1
+f lib/libtsol.so.2 0755 root bin
+s lib/libtsol.so=libtsol.so.2
+f lib/libumem.so.1 0755 root bin
+s lib/libumem.so=libumem.so.1
+f lib/libumem_trampoline.so.1 0755 root bin
+s lib/libumem_trampoline.so=libumem_trampoline.so.1
+f lib/libuuid.so.1 0755 root bin
+s lib/libuuid.so=libuuid.so.1
+f lib/libuutil.so.1 0755 root bin
+s lib/libuutil.so=libuutil.so.1
+f lib/libw.so.1 0755 root bin
+s lib/libw.so=libw.so.1
+f lib/libxnet.so.1 0755 root bin
+s lib/libxnet.so=libxnet.so.1
+f lib/libzdoor.so.1 0755 root bin
+s lib/libzdoor.so=libzdoor.so.1
+f lib/libzfs.so.1 0755 root bin
+s lib/libzfs.so=libzfs.so.1
+s lib/libzfs_core.so=../usr/lib/libzfs_core.so
+s lib/libzfs_core.so.1=../usr/lib/libzfs_core.so
+d lib/mpxio 0755 root bin
+f lib/mpxio/stmsboot_util 0555 root bin
+f lib/nss_compat.so.1 0755 root bin
+f lib/nss_dns.so.1 0755 root bin
+f lib/nss_files.so.1 0755 root bin
+f lib/nss_nis.so.1 0755 root bin
+f lib/nss_user.so.1 0755 root bin
+d lib/secure 0755 root bin
+s lib/secure/32=.
+s lib/secure/64=amd64
+d lib/secure/amd64 0755 root bin
+d lib/svc 0755 root bin
+d lib/svc/bin 0755 root bin
+f lib/svc/bin/lsvcrun 0555 root sys
+f lib/svc/bin/mfstscan 0555 root sys
+f lib/svc/bin/restore_repository 0555 root sys
+f lib/svc/bin/sqlite 0555 root sys
+f lib/svc/bin/svc.configd 0555 root sys
+f lib/svc/bin/svc.ipfd 0555 root sys
+f lib/svc/bin/svc.startd 0555 root sys
+d lib/svc/capture 0755 root bin
+d lib/svc/manifest 0755 root sys
+d lib/svc/manifest/application 0755 root sys
+d lib/svc/manifest/application/security 0755 root sys
+d lib/svc/manifest/device 0755 root sys
+d lib/svc/manifest/milestone 0755 root sys
+f lib/svc/manifest/milestone/multi-user-server.xml 0444 root sys
+f lib/svc/manifest/milestone/multi-user.xml 0444 root sys
+f lib/svc/manifest/milestone/name-services.xml 0444 root sys
+f lib/svc/manifest/milestone/network.xml 0444 root sys
+f lib/svc/manifest/milestone/single-user.xml 0444 root sys
+f lib/svc/manifest/milestone/sysconfig.xml 0444 root sys
+d lib/svc/manifest/network 0755 root sys
+f lib/svc/manifest/network/bridge.xml 0444 root sys
+f lib/svc/manifest/network/dlmgmt.xml 0444 root sys
+d lib/svc/manifest/network/dns 0755 root sys
+f lib/svc/manifest/network/dns/client.xml 0444 root sys
+f lib/svc/manifest/network/dns/install.xml 0444 root sys
+f lib/svc/manifest/network/dns/multicast.xml 0444 root sys
+f lib/svc/manifest/network/ibd-post-upgrade.xml 0444 root sys
+f lib/svc/manifest/network/inetd-upgrade.xml 0444 root sys
+f lib/svc/manifest/network/inetd.xml 0444 root sys
+d lib/svc/manifest/network/ipsec 0755 root sys
+f lib/svc/manifest/network/ipsec/ike.xml 0444 root sys
+f lib/svc/manifest/network/ipsec/ipsecalgs.xml 0444 root sys
+f lib/svc/manifest/network/ipsec/manual-key.xml 0444 root sys
+f lib/svc/manifest/network/ipsec/policy.xml 0444 root sys
+d lib/svc/manifest/network/iscsi 0755 root sys
+f lib/svc/manifest/network/iscsi/iscsi-initiator.xml 0444 root sys
+f lib/svc/manifest/network/iscsi/iscsi-target.xml 0444 root sys
+f lib/svc/manifest/network/isns_server.xml 0444 root sys
+d lib/svc/manifest/network/ldap 0755 root sys
+f lib/svc/manifest/network/ldap/client.xml 0444 root sys
+f lib/svc/manifest/network/lms.xml 0444 root sys
+d lib/svc/manifest/network/loadbalancer 0755 root sys
+f lib/svc/manifest/network/loadbalancer/ilbd.xml 0444 root sys
+f lib/svc/manifest/network/login.xml 0444 root sys
+f lib/svc/manifest/network/network-initial.xml 0444 root sys
+f lib/svc/manifest/network/network-install.xml 0444 root sys
+f lib/svc/manifest/network/network-ipmgmt.xml 0444 root sys
+f lib/svc/manifest/network/network-ipqos.xml 0444 root sys
+f lib/svc/manifest/network/network-iptun.xml 0444 root sys
+f lib/svc/manifest/network/network-location.xml 0444 root sys
+f lib/svc/manifest/network/network-loopback.xml 0444 root sys
+f lib/svc/manifest/network/network-netmask.xml 0444 root sys
+f lib/svc/manifest/network/network-routing-setup.xml 0444 root sys
+f lib/svc/manifest/network/network-service.xml 0444 root sys
+f lib/svc/manifest/network/npiv_config.xml 0444 root sys
+f lib/svc/manifest/network/rarp.xml 0444 root sys
+f lib/svc/manifest/network/rexec.xml 0444 root sys
+d lib/svc/manifest/network/routing 0755 root sys
+f lib/svc/manifest/network/routing/legacy-routing.xml 0444 root sys
+f lib/svc/manifest/network/routing/ndp.xml 0444 root sys
+f lib/svc/manifest/network/routing/rdisc.xml 0444 root sys
+f lib/svc/manifest/network/routing/ripng.xml 0444 root sys
+f lib/svc/manifest/network/routing/route.xml 0444 root sys
+d lib/svc/manifest/network/rpc 0755 root sys
+f lib/svc/manifest/network/rpc/bind.xml 0444 root sys
+d lib/svc/manifest/network/security 0755 root sys
+f lib/svc/manifest/network/sendmail-client.xml 0444 root sys
+d lib/svc/manifest/network/shares 0755 root sys
+f lib/svc/manifest/network/shares/group.xml 0444 root sys
+f lib/svc/manifest/network/shares/reparsed.xml 0444 root sys
+f lib/svc/manifest/network/shell.xml 0444 root sys
+f lib/svc/manifest/network/slp.xml 0444 root sys
+d lib/svc/manifest/network/smb 0755 root sys
+f lib/svc/manifest/network/smb/client.xml 0444 root sys
+f lib/svc/manifest/network/smb/server.xml 0444 root sys
+f lib/svc/manifest/network/smtp-sendmail.xml 0444 root sys
+f lib/svc/manifest/network/ssh.xml 0444 root sys
+f lib/svc/manifest/network/time.xml 0444 root sys
+f lib/svc/manifest/network/vrrp.xml 0444 root sys
+d lib/svc/manifest/platform 0755 root sys
+d lib/svc/manifest/platform/i86pc 0755 root sys
+f lib/svc/manifest/platform/i86pc/acpihpd.xml 0444 root sys
+d lib/svc/manifest/platform/sun4u 0755 root sys
+d lib/svc/manifest/platform/sun4v 0755 root sys
+d lib/svc/manifest/site 0755 root sys
+d lib/svc/manifest/system 0755 root sys
+f lib/svc/manifest/system/auditset.xml 0444 root sys
+f lib/svc/manifest/system/boot-archive-update.xml 0444 root sys
+f lib/svc/manifest/system/boot-archive.xml 0444 root sys
+f lib/svc/manifest/system/boot-config.xml 0444 root sys
+f lib/svc/manifest/system/consadm.xml 0444 root sys
+f lib/svc/manifest/system/cron.xml 0444 root sys
+f lib/svc/manifest/system/cryptosvc.xml 0444 root sys
+d lib/svc/manifest/system/device 0755 root sys
+f lib/svc/manifest/system/device/allocate.xml 0444 root sys
+f lib/svc/manifest/system/device/devices-local.xml 0444 root sys
+f lib/svc/manifest/system/device/mpxio-upgrade.xml 0444 root sys
+f lib/svc/manifest/system/dumpadm.xml 0444 root sys
+f lib/svc/manifest/system/early-manifest-import.xml 0444 root sys
+f lib/svc/manifest/system/extended-accounting.xml 0444 root sys
+d lib/svc/manifest/system/filesystem 0755 root sys
+f lib/svc/manifest/system/filesystem/autofs.xml 0444 root sys
+f lib/svc/manifest/system/filesystem/local-fs.xml 0444 root sys
+f lib/svc/manifest/system/filesystem/root-fs.xml 0444 root sys
+f lib/svc/manifest/system/filesystem/usr-fs.xml 0444 root sys
+f lib/svc/manifest/system/filesystem/vscan.xml 0444 root sys
+f lib/svc/manifest/system/fmd.xml 0444 root sys
+f lib/svc/manifest/system/hostid.xml 0444 root sys
+f lib/svc/manifest/system/hotplug.xml 0444 root sys
+d lib/svc/manifest/system/ibsrp 0755 root sys
+f lib/svc/manifest/system/ibsrp/target.xml 0444 root sys
+f lib/svc/manifest/system/identity.xml 0444 root sys
+f lib/svc/manifest/system/idmap.xml 0444 root sys
+f lib/svc/manifest/system/intrd.xml 0444 root sys
+f lib/svc/manifest/system/keymap.xml 0444 root sys
+f lib/svc/manifest/system/labeld.xml 0444 root sys
+f lib/svc/manifest/system/logadm-upgrade.xml 0444 root sys
+f lib/svc/manifest/system/manifest-import.xml 0444 root sys
+f lib/svc/manifest/system/name-service-cache.xml 0444 root sys
+f lib/svc/manifest/system/ndmp.xml 0444 root sys
+f lib/svc/manifest/system/nws_ii.xml 0444 root sys
+f lib/svc/manifest/system/nws_rdc.xml 0444 root sys
+f lib/svc/manifest/system/nws_rdcsyncd.xml 0444 root sys
+f lib/svc/manifest/system/nws_scm.xml 0444 root sys
+f lib/svc/manifest/system/nws_sv.xml 0444 root sys
+f lib/svc/manifest/system/pfexecd.xml 0444 root sys
+f lib/svc/manifest/system/picl.xml 0444 root sys
+f lib/svc/manifest/system/poold.xml 0444 root sys
+f lib/svc/manifest/system/pools.xml 0444 root sys
+f lib/svc/manifest/system/power.xml 0444 root sys
+f lib/svc/manifest/system/rbac.xml 0444 root sys
+f lib/svc/manifest/system/rcap.xml 0444 root sys
+f lib/svc/manifest/system/resource-mgmt.xml 0444 root sys
+f lib/svc/manifest/system/rmtmpfiles.xml 0444 root sys
+f lib/svc/manifest/system/sac.xml 0444 root sys
+f lib/svc/manifest/system/sar.xml 0444 root sys
+f lib/svc/manifest/system/scheduler.xml 0444 root sys
+d lib/svc/manifest/system/security 0755 root sys
+f lib/svc/manifest/system/stmf.xml 0444 root sys
+d lib/svc/manifest/system/svc 0755 root sys
+f lib/svc/manifest/system/svc/global.xml 0444 root sys
+f lib/svc/manifest/system/svc/restarter.xml 0444 root sys
+f lib/svc/manifest/system/sysevent.xml 0444 root sys
+f lib/svc/manifest/system/system-log.xml 0444 root sys
+f lib/svc/manifest/system/utmp.xml 0444 root sys
+f lib/svc/manifest/system/vtdaemon.xml 0444 root sys
+f lib/svc/manifest/system/zones.xml 0444 root sys
+d lib/svc/method 0755 root bin
+f lib/svc/method/boot-archive 0555 root bin
+f lib/svc/method/boot-archive-update 0555 root bin
+f lib/svc/method/devices-audio 0555 root bin
+f lib/svc/method/devices-local 0555 root bin
+f lib/svc/method/dns-install 0555 root bin
+f lib/svc/method/fc-fabric 0555 root sys
+f lib/svc/method/fs-local 0555 root bin
+f lib/svc/method/fs-minimal 0555 root bin
+f lib/svc/method/ibd-post-upgrade 0555 root sys
+f lib/svc/method/identity-domain 0555 root bin
+f lib/svc/method/inetd-upgrade 0555 root bin
+f lib/svc/method/iscsi-initiator 0555 root sys
+f lib/svc/method/iscsi-target 0555 root sys
+f lib/svc/method/iscsid 0555 root sys
+f lib/svc/method/keymap 0555 root bin
+f lib/svc/method/ldap-client 0555 root bin
+f lib/svc/method/logadm-upgrade 0555 root bin
+f lib/svc/method/mpxio-upgrade 0555 root bin
+f lib/svc/method/net-init 0555 root bin
+f lib/svc/method/net-install 0555 root bin
+f lib/svc/method/net-ipmgmt 0555 root bin
+f lib/svc/method/net-ipqos 0555 root bin
+f lib/svc/method/net-iptun 0555 root bin
+f lib/svc/method/net-loc 0555 root bin
+f lib/svc/method/net-loopback 0555 root bin
+f lib/svc/method/net-netmask 0555 root bin
+f lib/svc/method/net-routing-setup 0555 root bin
+f lib/svc/method/net-svc 0555 root bin
+f lib/svc/method/nfs-client 0555 root bin
+f lib/svc/method/nfs-server 0555 root sys
+f lib/svc/method/nlockmgr 0555 root bin
+f lib/svc/method/npivconfig 0555 root sys
+f lib/svc/method/rmtmpfiles 0555 root bin
+f lib/svc/method/rpc-bind 0555 root bin
+f lib/svc/method/sendmail-client 0555 root sys
+f lib/svc/method/slp 0555 root sys
+f lib/svc/method/smb-client 0555 root sys
+f lib/svc/method/smtp-sendmail 0555 root sys
+f lib/svc/method/svc-acpihpd 0555 root sys
+f lib/svc/method/svc-allocate 0555 root bin
+f lib/svc/method/svc-auditd 0555 root bin
+f lib/svc/method/svc-auditset 0555 root bin
+f lib/svc/method/svc-autofs 0555 root bin
+f lib/svc/method/svc-boot-config 0555 root bin
+f lib/svc/method/svc-consadm 0555 root bin
+f lib/svc/method/svc-cron 0555 root bin
+f lib/svc/method/svc-dlmgmtd 0555 root bin
+f lib/svc/method/svc-dumpadm 0555 root sys
+f lib/svc/method/svc-fcoei 0555 root sys
+f lib/svc/method/svc-fcoet 0555 root sys
+f lib/svc/method/svc-forwarding 0555 root bin
+f lib/svc/method/svc-ftp 0555 root sys
+f lib/svc/method/svc-hostid 0555 root bin
+f lib/svc/method/svc-hotplug 0555 root bin
+f lib/svc/method/svc-ii 0744 root sys
+f lib/svc/method/svc-intrd 0555 root sys
+f lib/svc/method/svc-labeld 0555 root sys
+f lib/svc/method/svc-legacy-routing 0555 root bin
+f lib/svc/method/svc-lms 0555 root sys
+f lib/svc/method/svc-ndmp 0555 root sys
+f lib/svc/method/svc-ndp 0555 root bin
+f lib/svc/method/svc-nscd 0555 root bin
+f lib/svc/method/svc-poold 0555 root sys
+f lib/svc/method/svc-pools 0555 root sys
+f lib/svc/method/svc-power 0555 root sys
+f lib/svc/method/svc-rbac 0555 root bin
+f lib/svc/method/svc-rdc 0744 root sys
+f lib/svc/method/svc-rdcsyncd 0744 root sys
+f lib/svc/method/svc-rdisc 0555 root bin
+f lib/svc/method/svc-resource-mgmt 0555 root sys
+f lib/svc/method/svc-ripng 0555 root bin
+f lib/svc/method/svc-route 0555 root bin
+f lib/svc/method/svc-scheduler 0555 root sys
+f lib/svc/method/svc-scm 0744 root sys
+f lib/svc/method/svc-sockfilter 0555 root bin
+f lib/svc/method/svc-srpt 0555 root sys
+f lib/svc/method/svc-stmf 0555 root sys
+f lib/svc/method/svc-sv 0744 root sys
+f lib/svc/method/svc-syseventd 0555 root sys
+f lib/svc/method/svc-tnd 0555 root sys
+f lib/svc/method/svc-utmpd 0555 root bin
+f lib/svc/method/svc-vrrp 0555 root sys
+f lib/svc/method/svc-wusb 0555 root sys
+f lib/svc/method/svc-zones 0555 root sys
+f lib/svc/method/system-log 0555 root bin
+f lib/svc/method/vtdaemon 0555 root bin
+f lib/svc/method/yp 0555 root bin
+d lib/svc/monitor 0755 root bin
+d lib/svc/share 0755 root bin
+f lib/svc/share/README 0444 root bin
+f lib/svc/share/fs_include.sh 0444 root bin
+f lib/svc/share/ipf_include.sh 0444 root bin
+f lib/svc/share/mfsthistory 0444 root bin
+f lib/svc/share/net_include.sh 0444 root bin
+f lib/svc/share/routing_include.sh 0444 root bin
+f lib/svc/share/sendmail_include.sh 0444 root sys
+f lib/svc/share/smf_include.sh 0444 root bin
+d mnt 0755 root sys
+d opt 0755 root sys
+d platform 0755 root sys
+d platform/i86pc 0755 root sys
+d platform/i86pc/amd64 0755 root sys
+d platform/i86pc/kernel 0755 root sys
+d platform/i86pc/kernel/amd64 0755 root sys
+f platform/i86pc/kernel/amd64/unix 0755 root sys
+d platform/i86pc/kernel/cpu 0755 root sys
+d platform/i86pc/kernel/cpu/amd64 0755 root sys
+f platform/i86pc/kernel/cpu/amd64/cpu.generic 0755 root sys
+f platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD 0755 root sys
+f platform/i86pc/kernel/cpu/amd64/cpu_ms.AuthenticAMD.15 0755 root sys
+f platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel 0755 root sys
+f platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel.6.46 0755 root sys
+f platform/i86pc/kernel/cpu/amd64/cpu_ms.GenuineIntel.6.47 0755 root sys
+f platform/i86pc/kernel/cpu/cpu.generic 0755 root sys
+f platform/i86pc/kernel/cpu/cpu_ms.AuthenticAMD 0755 root sys
+f platform/i86pc/kernel/cpu/cpu_ms.AuthenticAMD.15 0755 root sys
+f platform/i86pc/kernel/cpu/cpu_ms.GenuineIntel 0755 root sys
+f platform/i86pc/kernel/cpu/cpu_ms.GenuineIntel.6.46 0755 root sys
+f platform/i86pc/kernel/cpu/cpu_ms.GenuineIntel.6.47 0755 root sys
+d platform/i86pc/kernel/dacf 0755 root sys
+d platform/i86pc/kernel/dacf/amd64 0755 root sys
+f platform/i86pc/kernel/dacf/amd64/consconfig_dacf 0755 root sys
+f platform/i86pc/kernel/dacf/consconfig_dacf 0755 root sys
+d platform/i86pc/kernel/drv 0755 root sys
+f platform/i86pc/kernel/drv/acpippm.conf 0644 root sys
+d platform/i86pc/kernel/drv/amd64 0755 root sys
+f platform/i86pc/kernel/drv/amd64/acpinex 0755 root sys
+f platform/i86pc/kernel/drv/amd64/acpippm 0755 root sys
+f platform/i86pc/kernel/drv/amd64/amd_iommu 0755 root sys
+f platform/i86pc/kernel/drv/amd64/cpc 0755 root sys
+f platform/i86pc/kernel/drv/amd64/cpudrv 0755 root sys
+f platform/i86pc/kernel/drv/amd64/dr 0755 root sys
+f platform/i86pc/kernel/drv/amd64/fipe 0755 root sys
+f platform/i86pc/kernel/drv/amd64/ioat 0755 root sys
+f platform/i86pc/kernel/drv/amd64/isa 0755 root sys
+f platform/i86pc/kernel/drv/amd64/npe 0755 root sys
+f platform/i86pc/kernel/drv/amd64/pci 0755 root sys
+f platform/i86pc/kernel/drv/amd64/pci-ide 0755 root sys
+f platform/i86pc/kernel/drv/amd64/pit_beep 0755 root sys
+f platform/i86pc/kernel/drv/amd64/ppm 0755 root sys
+f platform/i86pc/kernel/drv/amd64/rootnex 0755 root sys
+f platform/i86pc/kernel/drv/amd64/xsvc 0755 root sys
+f platform/i86pc/kernel/drv/amd_iommu.conf 0644 root sys
+f platform/i86pc/kernel/drv/cpc.conf 0644 root sys
+f platform/i86pc/kernel/drv/dr.conf 0644 root sys
+f platform/i86pc/kernel/drv/fipe.conf 0644 root sys
+f platform/i86pc/kernel/drv/ioat.conf 0644 root sys
+f platform/i86pc/kernel/drv/pci-ide.conf 0644 root sys
+f platform/i86pc/kernel/drv/pit_beep.conf 0644 root sys
+f platform/i86pc/kernel/drv/ppm.conf 0644 root sys
+f platform/i86pc/kernel/drv/rootnex.conf 0644 root sys
+f platform/i86pc/kernel/drv/xsvc.conf 0644 root sys
+d platform/i86pc/kernel/kmdb 0755 root sys
+d platform/i86pc/kernel/kmdb/amd64 0755 root sys
+f platform/i86pc/kernel/kmdb/amd64/apix 0555 root sys
+f platform/i86pc/kernel/kmdb/amd64/pcplusmp 0555 root sys
+f platform/i86pc/kernel/kmdb/amd64/unix 0555 root sys
+f platform/i86pc/kernel/kmdb/amd64/uppc 0555 root sys
+d platform/i86pc/kernel/mach 0755 root sys
+d platform/i86pc/kernel/mach/amd64 0755 root sys
+f platform/i86pc/kernel/mach/amd64/apix 0755 root sys
+f platform/i86pc/kernel/mach/amd64/pcplusmp 0755 root sys
+f platform/i86pc/kernel/mach/amd64/uppc 0755 root sys
+d platform/i86pc/kernel/misc 0755 root sys
+d platform/i86pc/kernel/misc/amd64 0755 root sys
+f platform/i86pc/kernel/misc/amd64/acpidev 0755 root sys
+f platform/i86pc/kernel/misc/amd64/cpr 0755 root sys
+f platform/i86pc/kernel/misc/amd64/drmach_acpi 0755 root sys
+d platform/i86pc/kernel/pcbe 0755 root sys
+d platform/i86pc/kernel/pcbe/amd64 0755 root sys
+f platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.15 0755 root sys
+f platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.5 0755 root sys
+f platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6 0755 root sys
+f platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.15 0755 root sys
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.23=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.26=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.28=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.29=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.30=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.31=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.37=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.44=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.45=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.46=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.47=pcbe.GenuineIntel.6.15
+s platform/i86pc/kernel/pcbe/amd64/pcbe.GenuineIntel.6.58=pcbe.GenuineIntel.6.15
+d platform/i86pc/kernel/sys 0755 root sys
+d platform/i86pc/kernel/sys/amd64 0755 root sys
+f platform/i86pc/kernel/sys/amd64/cpc 0755 root sys
+f platform/i86pc/multiboot 0755 root sys
+d platform/i86pc/ucode 0755 root sys
+f platform/i86pc/ucode/amd-ucode.bin 0444 root sys
+f platform/i86pc/ucode/intel-ucode.txt 0444 root sys
+d proc 0755 root root
+d sbin 0755 root sys
+f sbin/autopush 0555 root bin
+f sbin/biosdev 0555 root bin
+f sbin/bootadm 0555 root bin
+f sbin/cryptoadm 0555 root bin
+f sbin/devprop 0555 root bin
+f sbin/dhcpagent 0555 root bin
+f sbin/dhcpinfo 0555 root bin
+f sbin/dladm 0555 root bin
+f sbin/dlmgmtd 0555 root bin
+f sbin/dlstat 0555 root bin
+f sbin/fdisk 0555 root bin
+f sbin/flowadm 0555 root bin
+f sbin/flowstat 0555 root bin
+f sbin/hostconfig 0555 root bin
+f sbin/ibd_delete_link 0555 root bin
+f sbin/ibd_upgrade 0555 root bin
+f sbin/ifconfig 0555 root bin
+f sbin/ifparse 0555 root bin
+s sbin/in.mpathd=../lib/inet/in.mpathd
+f sbin/init 0555 root sys
+f sbin/installgrub 0555 root sys
+f sbin/ipadm 0555 root bin
+f sbin/ipmpstat 0555 root bin
+s sbin/jsh=../usr/bin/ksh93
+f sbin/mount 0555 root bin
+f sbin/mountall 0555 root sys
+f sbin/netstrategy 0555 root bin
+s sbin/pfsh=../usr/bin/pfexec
+f sbin/rc0 0744 root sys
+f sbin/rc1 0744 root sys
+f sbin/rc2 0744 root sys
+f sbin/rc3 0744 root sys
+h sbin/rc5=sbin/rc0
+h sbin/rc6=sbin/rc0
+f sbin/rcS 0744 root sys
+f sbin/route 0555 root bin
+f sbin/routeadm 0555 root bin
+s sbin/sh=../usr/bin/i86/ksh93
+f sbin/soconfig 0555 root bin
+f sbin/su.static 0555 root sys
+s sbin/su=../usr/bin/su
+f sbin/sulogin 0555 root bin
+f sbin/svcadm 0555 root bin
+f sbin/swapadd 0744 root sys
+f sbin/sync 0555 root bin
+f sbin/tzreload 0555 root bin
+f sbin/uadmin 0555 root sys
+f sbin/umount 0555 root bin
+f sbin/umountall 0555 root sys
+f sbin/uname 0555 root bin
+f sbin/wusbadm 0555 root bin
+f sbin/zfs 0555 root bin
+f sbin/zonename 0555 root bin
+f sbin/zpool 0555 root bin
+d system 0755 root root
+d system/contract 0555 root root
+d system/object 0555 root root
+d tmp 1777 root root
+d usr 0755 root sys
+s usr/adm=../var/adm
+d usr/bin 0755 root bin
+h usr/bin/[=usr/bin/alias
+f usr/bin/addbadsec 0555 root bin
+f usr/bin/alias 0555 root bin
+d usr/bin/amd64 0755 root bin
+f usr/bin/amd64/amt 0555 root bin
+f usr/bin/amd64/cputrack 0555 root bin
+f usr/bin/amd64/crle 0555 root bin
+h usr/bin/amd64/decrypt=usr/bin/amd64/encrypt
+h usr/bin/amd64/digest=usr/bin/amd64/mac
+f usr/bin/amd64/elfdump 0555 root bin
+f usr/bin/amd64/elfedit 0555 root bin
+f usr/bin/amd64/elfwrap 0555 root bin
+f usr/bin/amd64/encrypt 0555 root bin
+f usr/bin/amd64/gcore 0555 root bin
+f usr/bin/amd64/ksh93 0555 root bin
+h usr/bin/amd64/ksh=usr/bin/amd64/ksh93
+f usr/bin/amd64/ld 0755 root bin
+f usr/bin/amd64/ldd 0555 root bin
+f usr/bin/amd64/ls 0555 root bin
+f usr/bin/amd64/mac 0555 root bin
+f usr/bin/amd64/mcs 0555 root bin
+f usr/bin/amd64/mdb 0555 root bin
+f usr/bin/amd64/moe 0555 root bin
+f usr/bin/amd64/newtask 4555 root sys
+f usr/bin/amd64/nohup 0555 root bin
+f usr/bin/amd64/pargs 0555 root bin
+f usr/bin/amd64/pcred 0555 root bin
+f usr/bin/amd64/pfiles 0555 root bin
+f usr/bin/amd64/pflags 0555 root bin
+f usr/bin/amd64/pldd 0555 root bin
+f usr/bin/amd64/plgrp 0555 root bin
+f usr/bin/amd64/plimit 0555 root bin
+f usr/bin/amd64/pmadvise 0555 root bin
+f usr/bin/amd64/pmap 0555 root bin
+f usr/bin/amd64/ppgsz 0555 root bin
+f usr/bin/amd64/ppriv 0555 root bin
+f usr/bin/amd64/prctl 0555 root bin
+f usr/bin/amd64/preap 0555 root bin
+f usr/bin/amd64/prstat 0555 root bin
+f usr/bin/amd64/prun 0555 root bin
+f usr/bin/amd64/ps 0555 root bin
+f usr/bin/amd64/psig 0555 root bin
+f usr/bin/amd64/pstack 0555 root bin
+f usr/bin/amd64/pstop 0555 root bin
+f usr/bin/amd64/ptime 0555 root bin
+f usr/bin/amd64/ptree 0555 root bin
+f usr/bin/amd64/pvs 0555 root bin
+f usr/bin/amd64/pwait 0555 root bin
+f usr/bin/amd64/pwdx 0555 root bin
+h usr/bin/amd64/rksh93=usr/bin/amd64/ksh93
+h usr/bin/amd64/rksh=usr/bin/amd64/ksh93
+f usr/bin/amd64/savecore 0555 root bin
+f usr/bin/amd64/setuname 0555 root bin
+f usr/bin/amd64/sort 0555 root bin
+f usr/bin/amd64/strings 0555 root bin
+f usr/bin/amd64/truss 0555 root bin
+h usr/bin/amd64/uptime=usr/bin/amd64/w
+f usr/bin/amd64/w 4555 root bin
+f usr/bin/amt 0555 root bin
+h usr/bin/apropos=usr/bin/man
+f usr/bin/ar 0555 root bin
+f usr/bin/arch 0555 root bin
+f usr/bin/arcstat 0555 root bin
+f usr/bin/asa 0555 root bin
+f usr/bin/at 4755 root sys
+f usr/bin/atq 4755 root sys
+f usr/bin/atrm 4755 root sys
+f usr/bin/auths 0555 root bin
+h usr/bin/awk=usr/bin/nawk
+f usr/bin/banner 0555 root bin
+f usr/bin/bart 0555 root bin
+f usr/bin/basename 0555 root bin
+f usr/bin/batch 0555 root bin
+f usr/bin/bc 0555 root bin
+f usr/bin/bdiff 0755 root bin
+f usr/bin/bfs 0555 root bin
+h usr/bin/bg=usr/bin/alias
+f usr/bin/busstat 0555 root bin
+f usr/bin/cal 0555 root bin
+f usr/bin/calendar 0555 root bin
+f usr/bin/captoinfo 0555 root bin
+f usr/bin/cat 0555 root bin
+h usr/bin/catman=usr/bin/man
+h usr/bin/cd=usr/bin/alias
+f usr/bin/checkeq 0555 root bin
+f usr/bin/checknr 0555 root bin
+f usr/bin/chgrp 0555 root bin
+f usr/bin/chkey 4555 root sys
+f usr/bin/chmod 0555 root bin
+f usr/bin/chown 0555 root bin
+f usr/bin/ckdate 0555 root bin
+f usr/bin/ckgid 0555 root bin
+f usr/bin/ckint 0555 root bin
+f usr/bin/ckitem 0555 root bin
+f usr/bin/ckkeywd 0555 root bin
+f usr/bin/ckpath 0555 root bin
+f usr/bin/ckrange 0555 root bin
+f usr/bin/ckstr 0555 root bin
+h usr/bin/cksum=usr/bin/alias
+f usr/bin/cktime 0555 root bin
+f usr/bin/ckuid 0555 root bin
+f usr/bin/ckyorn 0555 root bin
+f usr/bin/clear 0555 root bin
+h usr/bin/cmp=usr/bin/alias
+f usr/bin/col 0555 root bin
+f usr/bin/column 0555 root bin
+h usr/bin/comm=usr/bin/alias
+h usr/bin/command=usr/bin/alias
+f usr/bin/compress 0555 root bin
+f usr/bin/coreadm 0555 root bin
+f usr/bin/cp 0555 root bin
+f usr/bin/cpio 0555 root bin
+h usr/bin/cputrack=usr/lib/isaexec
+f usr/bin/crle 0555 root bin
+f usr/bin/crontab 4555 root bin
+f usr/bin/crypt 0555 root bin
+f usr/bin/csh 0555 root bin
+f usr/bin/csplit 0555 root bin
+f usr/bin/ctags 0555 root bin
+f usr/bin/ctrun 0555 root bin
+f usr/bin/ctstat 0555 root bin
+f usr/bin/ctwatch 0555 root bin
+h usr/bin/cut=usr/bin/alias
+f usr/bin/date 0555 root bin
+f usr/bin/dc 0555 root bin
+f usr/bin/dd 0555 root bin
+h usr/bin/decrypt=usr/lib/isaexec
+f usr/bin/deroff 0555 root bin
+f usr/bin/devattr 0555 root bin
+f usr/bin/devfree 0555 root bin
+f usr/bin/devreserv 0555 root bin
+s usr/bin/df=../sbin/df
+f usr/bin/diff 0555 root bin
+f usr/bin/diff3 0555 root bin
+f usr/bin/diffmk 0555 root bin
+h usr/bin/digest=usr/lib/isaexec
+f usr/bin/dircmp 0555 root bin
+f usr/bin/dirname 0555 root bin
+f usr/bin/dis 0555 root bin
+f usr/bin/diskscan 0555 root bin
+h usr/bin/dispgid=usr/bin/ckgid
+h usr/bin/dispuid=usr/bin/ckuid
+s usr/bin/dmesg=../sbin/dmesg
+f usr/bin/dns-sd 0555 root bin
+f usr/bin/domainname 0555 root bin
+f usr/bin/dos2unix 0555 root bin
+f usr/bin/du 0555 root bin
+f usr/bin/dump 0555 root bin
+f usr/bin/dumpcs 0555 root bin
+f usr/bin/dumpkeys 0555 root bin
+f usr/bin/echo 0555 root bin
+f usr/bin/ed 0555 root bin
+f usr/bin/edit 0555 root bin
+f usr/bin/egrep 0555 root bin
+f usr/bin/eject 0555 root bin
+h usr/bin/elfdump=usr/lib/isaexec
+f usr/bin/elfedit 0555 root bin
+f usr/bin/elfsign 0555 root bin
+f usr/bin/elfwrap 0555 root bin
+h usr/bin/encrypt=usr/lib/isaexec
+f usr/bin/enhance 0555 root bin
+f usr/bin/env 0555 root bin
+f usr/bin/eqn 0555 root bin
+f usr/bin/expand 0555 root bin
+f usr/bin/expr 0555 root bin
+f usr/bin/exstr 0555 root bin
+f usr/bin/factor 0555 root bin
+f usr/bin/false 0555 root bin
+h usr/bin/fc=usr/bin/alias
+f usr/bin/fdetach 0555 root bin
+f usr/bin/fdformat 4555 root bin
+h usr/bin/fg=usr/bin/alias
+f usr/bin/fgrep 0555 root bin
+f usr/bin/file 0555 root bin
+f usr/bin/filesync 0555 root bin
+f usr/bin/find 0555 root bin
+f usr/bin/fmt 0555 root bin
+f usr/bin/fmtmsg 0555 root bin
+f usr/bin/fold 0555 root bin
+f usr/bin/fsstat 0555 root bin
+f usr/bin/ftp 0555 root bin
+h usr/bin/gcore=usr/lib/isaexec
+f usr/bin/gencat 0555 root bin
+f usr/bin/geniconvtbl 0555 root bin
+f usr/bin/genmsg 0555 root bin
+f usr/bin/getconf 0555 root bin
+f usr/bin/getdev 0555 root bin
+f usr/bin/getdgrp 0555 root bin
+f usr/bin/getent 0555 root bin
+f usr/bin/getfacl 0555 root bin
+f usr/bin/getopt 0555 root bin
+h usr/bin/getopts=usr/bin/alias
+f usr/bin/gettext 0555 root bin
+f usr/bin/gettxt 0555 root bin
+f usr/bin/getvol 0555 root bin
+f usr/bin/grep 0555 root bin
+f usr/bin/groups 0555 root bin
+h usr/bin/hash=usr/bin/alias
+f usr/bin/head 0555 root bin
+f usr/bin/hostid 0555 root bin
+f usr/bin/hostname 0555 root bin
+h usr/bin/i286=usr/bin/sun
+h usr/bin/i386=usr/bin/sun
+h usr/bin/i486=usr/bin/sun
+d usr/bin/i86 0755 root bin
+f usr/bin/i86/amt 0555 root bin
+f usr/bin/i86/cputrack 0555 root bin
+h usr/bin/i86/decrypt=usr/bin/i86/encrypt
+h usr/bin/i86/digest=usr/bin/i86/mac
+f usr/bin/i86/elfdump 0555 root bin
+f usr/bin/i86/encrypt 0555 root bin
+f usr/bin/i86/gcore 0555 root bin
+f usr/bin/i86/ksh93 0555 root bin
+h usr/bin/i86/ksh=usr/bin/i86/ksh93
+f usr/bin/i86/mac 0555 root bin
+f usr/bin/i86/mdb 0555 root bin
+f usr/bin/i86/newtask 4555 root sys
+f usr/bin/i86/nohup 0555 root bin
+f usr/bin/i86/pargs 0555 root bin
+f usr/bin/i86/pcred 0555 root bin
+f usr/bin/i86/pfiles 0555 root bin
+f usr/bin/i86/pflags 0555 root bin
+f usr/bin/i86/pldd 0555 root bin
+f usr/bin/i86/plgrp 0555 root bin
+f usr/bin/i86/plimit 0555 root bin
+f usr/bin/i86/pmadvise 0555 root bin
+f usr/bin/i86/pmap 0555 root bin
+f usr/bin/i86/ppgsz 0555 root bin
+f usr/bin/i86/ppriv 0555 root bin
+f usr/bin/i86/prctl 0555 root bin
+f usr/bin/i86/preap 0555 root bin
+f usr/bin/i86/prstat 0555 root bin
+f usr/bin/i86/prun 0555 root bin
+f usr/bin/i86/ps 0555 root bin
+f usr/bin/i86/psig 0555 root bin
+f usr/bin/i86/pstack 0555 root bin
+f usr/bin/i86/pstop 0555 root bin
+f usr/bin/i86/ptime 0555 root bin
+f usr/bin/i86/ptree 0555 root bin
+f usr/bin/i86/pwait 0555 root bin
+f usr/bin/i86/pwdx 0555 root bin
+h usr/bin/i86/rksh93=usr/bin/i86/ksh93
+h usr/bin/i86/rksh=usr/bin/i86/ksh93
+f usr/bin/i86/savecore 0555 root bin
+f usr/bin/i86/setuname 0555 root bin
+f usr/bin/i86/sort 0555 root bin
+f usr/bin/i86/strings 0555 root bin
+f usr/bin/i86/truss 0555 root bin
+h usr/bin/i86/uptime=usr/bin/i86/w
+f usr/bin/i86/w 4555 root bin
+h usr/bin/i86pc=usr/bin/sun
+f usr/bin/iconv 0555 root bin
+f usr/bin/id 0555 root bin
+f usr/bin/infocmp 0555 root bin
+f usr/bin/ipcs 0555 root bin
+f usr/bin/ipcrm 0555 root bin
+f usr/bin/iostat 0555 root bin
+f usr/bin/isainfo 0555 root bin
+f usr/bin/isalist 0555 root bin
+h usr/bin/jobs=usr/bin/alias
+h usr/bin/join=usr/bin/alias
+s usr/bin/jsh=ksh93
+f usr/bin/kbd 0555 root bin
+f usr/bin/kdestroy 0555 root bin
+f usr/bin/keylogin 0555 root bin
+f usr/bin/keylogout 0555 root bin
+h usr/bin/kill=usr/bin/alias
+f usr/bin/kinit 0555 root bin
+f usr/bin/klist 0555 root bin
+f usr/bin/kmfcfg 0555 root bin
+f usr/bin/kpasswd 0555 root bin
+f usr/bin/krb5-config 0555 root bin
+h usr/bin/ksh93=usr/lib/isaexec
+h usr/bin/ksh=usr/lib/isaexec
+f usr/bin/kstat 0555 root bin
+f usr/bin/ktutil 0555 root bin
+f usr/bin/kvmstat 0555 root bin
+f usr/bin/last 0555 root bin
+f usr/bin/lastcomm 0555 root bin
+f usr/bin/ld 0755 root bin
+f usr/bin/ldapadd 0555 root bin
+f usr/bin/ldapdelete 0555 root bin
+f usr/bin/ldaplist 0555 root bin
+h usr/bin/ldapmodify=usr/bin/ldapadd
+f usr/bin/ldapmodrdn 0555 root bin
+f usr/bin/ldapsearch 0555 root bin
+f usr/bin/ldd 0555 root bin
+f usr/bin/lgrpinfo 0555 root bin
+f usr/bin/line 0555 root bin
+f usr/bin/listdgrp 0555 root bin
+f usr/bin/listusers 0555 root bin
+h usr/bin/ln=usr/bin/cp
+f usr/bin/loadkeys 0555 root bin
+f usr/bin/locale 0555 root bin
+f usr/bin/logger 0555 root bin
+f usr/bin/login 4555 root bin
+f usr/bin/logins 0750 root bin
+h usr/bin/logname=usr/bin/alias
+f usr/bin/look 0755 root bin
+f usr/bin/lorder 0555 root bin
+# We want ls to be the 32bit binary (not a link to isaexec) so we don't blow
+# out memory sorting entries - we just die if we need too much memory. This
+# also matches the setup on a stock solaris box.
+f usr/bin/ls 0555 root bin
+f usr/bin/m4 0555 root bin
+f usr/bin/m68k 0555 root bin
+h usr/bin/mac=usr/lib/isaexec
+f usr/bin/mach 0555 root bin
+f usr/bin/mail 2511 root mail
+f usr/bin/mailx 2511 root mail
+f usr/bin/makedev 0555 root bin
+f usr/bin/man 0555 root bin
+f usr/bin/mcs 0555 root bin
+h usr/bin/mdb=usr/lib/isaexec
+f usr/bin/mesg 0555 root bin
+f usr/bin/mkdir 0555 root bin
+f usr/bin/mkfifo 0555 root bin
+f usr/bin/mkmsgs 0555 root root
+f usr/bin/mkpwdict 0555 root bin
+f usr/bin/mktemp 0555 root bin
+f usr/bin/moe 0555 root bin
+f usr/bin/more 0555 root bin
+f usr/bin/mpstat 0555 root bin
+f usr/bin/msgfmt 0555 root bin
+f usr/bin/mt 0555 root bin
+h usr/bin/mv=usr/bin/cp
+f usr/bin/nawk 0555 root bin
+f usr/bin/nc 0555 root bin
+f usr/bin/neqn 0555 root bin
+f usr/bin/netstat 0555 root bin
+f usr/bin/newform 0555 root bin
+f usr/bin/newgrp 4755 root sys
+f usr/bin/news 0555 root bin
+h usr/bin/newtask=usr/lib/isaexec
+f usr/bin/nfsstat 0555 root bin
+f usr/bin/nice 0555 root bin
+f usr/bin/nl 0555 root bin
+f usr/bin/nm 0555 root bin
+h usr/bin/nohup=usr/lib/isaexec
+f usr/bin/nroff 0555 root bin
+f usr/bin/od 0555 root bin
+f usr/bin/on 0555 root bin
+f usr/bin/optisa 0555 root bin
+f usr/bin/pack 0555 root bin
+h usr/bin/page=usr/bin/more
+f usr/bin/pagesize 0555 root bin
+h usr/bin/pargs=usr/lib/isaexec
+f usr/bin/passwd 6555 root sys
+h usr/bin/paste=usr/bin/alias
+f usr/bin/pathchk 0555 root bin
+f usr/bin/pax 0555 root bin
+s usr/bin/pcat=unpack
+h usr/bin/pcred=usr/lib/isaexec
+s usr/bin/perl=/opt/local/bin/perl
+h usr/bin/pfbash=usr/bin/pfexec
+h usr/bin/pfcsh=usr/bin/pfexec
+f usr/bin/pfexec 0555 root bin
+h usr/bin/pfiles=usr/lib/isaexec
+h usr/bin/pfksh93=usr/bin/pfexec
+h usr/bin/pfksh=usr/bin/pfexec
+h usr/bin/pflags=usr/lib/isaexec
+h usr/bin/pfrksh93=usr/bin/pfexec
+h usr/bin/pfrksh=usr/bin/pfexec
+h usr/bin/pfsh=usr/bin/pfexec
+h usr/bin/pftcsh=usr/bin/pfexec
+h usr/bin/pfzsh=usr/bin/pfexec
+f usr/bin/pg 0555 root bin
+f usr/bin/pginfo 0555 root bin
+f usr/bin/pgrep 0555 root bin
+f usr/bin/pgstat 0555 root bin
+f usr/bin/pkgtrans 0555 root bin
+h usr/bin/pkill=usr/bin/pgrep
+f usr/bin/pktool 0555 root bin
+h usr/bin/pldd=usr/lib/isaexec
+h usr/bin/plgrp=usr/lib/isaexec
+h usr/bin/plimit=usr/lib/isaexec
+h usr/bin/pmadvise=usr/lib/isaexec
+h usr/bin/pmap=usr/lib/isaexec
+f usr/bin/poolstat 0555 root bin
+h usr/bin/ppgsz=usr/lib/isaexec
+h usr/bin/ppriv=usr/lib/isaexec
+f usr/bin/pr 0555 root bin
+h usr/bin/prctl=usr/lib/isaexec
+h usr/bin/preap=usr/lib/isaexec
+h usr/bin/print=usr/bin/alias
+f usr/bin/printf 0555 root bin
+f usr/bin/priocntl 0555 root bin
+f usr/bin/profiles 0555 root bin
+f usr/bin/projects 0555 root bin
+h usr/bin/prstat=usr/lib/isaexec
+h usr/bin/prun=usr/lib/isaexec
+h usr/bin/ps=usr/lib/isaexec
+h usr/bin/psig=usr/lib/isaexec
+h usr/bin/pstack=usr/lib/isaexec
+h usr/bin/pstop=usr/lib/isaexec
+h usr/bin/ptime=usr/lib/isaexec
+h usr/bin/ptree=usr/lib/isaexec
+f usr/bin/putdev 0555 root bin
+f usr/bin/putdgrp 0555 root bin
+f usr/bin/pvs 0555 root bin
+h usr/bin/pwait=usr/lib/isaexec
+s usr/bin/pwconv=../sbin/pwconv
+f usr/bin/pwd 0555 root bin
+h usr/bin/pwdx=usr/lib/isaexec
+f usr/bin/rcapstat 0555 root bin
+f usr/bin/rcp 4555 root bin
+f usr/bin/rdate 0555 root bin
+f usr/bin/rdist 4555 root bin
+h usr/bin/read=usr/bin/alias
+f usr/bin/red 0555 root bin
+f usr/bin/refer 0555 root bin
+f usr/bin/regcmp 0555 root bin
+s usr/bin/remsh=rsh
+f usr/bin/renice 0555 root bin
+h usr/bin/rev=usr/bin/alias
+h usr/bin/rksh93=usr/lib/isaexec
+h usr/bin/rksh=usr/lib/isaexec
+f usr/bin/rlogin 4555 root bin
+f usr/bin/rm 0555 root bin
+s usr/bin/rmail=mail
+f usr/bin/rmdir 0555 root bin
+f usr/bin/rmformat 0555 root bin
+f usr/bin/roles 0555 root bin
+f usr/bin/rpcinfo 0555 root bin
+f usr/bin/rsh 4555 root bin
+f usr/bin/runat 0555 root bin
+f usr/bin/rup 0555 root bin
+f usr/bin/ruptime 0555 root bin
+f usr/bin/rusers 0555 root bin
+h usr/bin/savecore=usr/lib/isaexec
+f usr/bin/scp 0555 root bin
+f usr/bin/script 0555 root bin
+f usr/bin/sdiff 0555 root bin
+f usr/bin/sed 0555 root bin
+f usr/bin/setfacl 0555 root bin
+f usr/bin/setpgrp 0555 root sys
+h usr/bin/settime=usr/bin/touch
+h usr/bin/setuname=usr/lib/isaexec
+f usr/bin/sftp 0555 root bin
+s usr/bin/sh=ksh93
+f usr/bin/shcomp 0555 root bin
+f usr/bin/size 0555 root bin
+h usr/bin/sleep=usr/bin/alias
+f usr/bin/smbutil 0555 root bin
+f usr/bin/soelim 0555 root bin
+h usr/bin/sort=usr/lib/isaexec
+f usr/bin/sotruss 0755 root bin
+h usr/bin/sparc=usr/bin/sun
+f usr/bin/spell 0555 root bin
+f usr/bin/split 0555 root bin
+f usr/bin/srchtxt 0555 root bin
+f usr/bin/ssh 0555 root bin
+f usr/bin/ssh-add 0555 root bin
+f usr/bin/ssh-agent 0555 root bin
+f usr/bin/ssh-keygen 0555 root bin
+f usr/bin/ssh-keyscan 0555 root bin
+s usr/bin/strace=../sbin/strace
+f usr/bin/strchg 0555 root root
+s usr/bin/strclean=../sbin/strclean
+f usr/bin/strconf 0555 root root
+s usr/bin/strerr=../sbin/strerr
+h usr/bin/strings=usr/lib/isaexec
+f usr/bin/strip 0555 root bin
+f usr/bin/stty 0555 root bin
+f usr/bin/su 4555 root sys
+h usr/bin/sum=usr/bin/alias
+f usr/bin/sun 0555 root bin
+h usr/bin/sun2=usr/bin/sun
+h usr/bin/sun3=usr/bin/sun
+h usr/bin/sun3x=usr/bin/sun
+h usr/bin/sun4=usr/bin/sun
+h usr/bin/sun4c=usr/bin/sun
+h usr/bin/sun4d=usr/bin/sun
+h usr/bin/sun4e=usr/bin/sun
+h usr/bin/sun4m=usr/bin/sun
+f usr/bin/svcprop 0555 root bin
+f usr/bin/svcs 0555 root bin
+s usr/bin/sync=../../sbin/sync
+f usr/bin/ta 0555 root bin
+f usr/bin/tabs 0555 root bin
+f usr/bin/tail 0555 root bin
+s usr/bin/tar=../sbin/tar
+f usr/bin/tbl 0555 root bin
+f usr/bin/tcopy 0555 root bin
+h usr/bin/tee=usr/bin/alias
+f usr/bin/telnet 0555 root bin
+h usr/bin/test=usr/bin/alias
+f usr/bin/tic 0555 root bin
+f usr/bin/time 0555 root bin
+f usr/bin/timex 0555 root bin
+f usr/bin/tip 4511 uucp bin
+f usr/bin/touch 0555 root bin
+f usr/bin/tput 0555 root bin
+f usr/bin/tr 0555 root bin
+f usr/bin/troff 0555 root bin
+f usr/bin/true 0555 root bin
+h usr/bin/truss=usr/lib/isaexec
+f usr/bin/tsort 0555 root bin
+f usr/bin/tty 0555 root bin
+h usr/bin/type=usr/bin/alias
+f usr/bin/tzselect 0555 root bin
+f usr/bin/ul 0555 root bin
+h usr/bin/ulimit=usr/bin/alias
+h usr/bin/umask=usr/bin/alias
+h usr/bin/unalias=usr/bin/alias
+s usr/bin/uname=../../sbin/uname
+f usr/bin/uncompress 0555 root bin
+f usr/bin/unexpand 0555 root bin
+h usr/bin/uniq=usr/bin/alias
+f usr/bin/units 0555 root bin
+f usr/bin/unix2dos 0555 root bin
+f usr/bin/unpack 0555 root bin
+h usr/bin/uptime=usr/lib/isaexec
+f usr/bin/userattr 0555 root bin
+f usr/bin/uudecode 0555 root uucp
+f usr/bin/uuencode 0555 root uucp
+h usr/bin/vedit=usr/bin/edit
+f usr/bin/vfsstat 0555 root bin
+f usr/bin/vgrind 0555 root bin
+f usr/bin/vmstat 0555 root bin
+h usr/bin/w=usr/lib/isaexec
+h usr/bin/wait=usr/bin/alias
+h usr/bin/wc=usr/bin/alias
+h usr/bin/whatis=usr/bin/man
+f usr/bin/which 0555 root bin
+f usr/bin/who 0555 root bin
+f usr/bin/whocalls 0755 root bin
+f usr/bin/whois 0555 root bin
+f usr/bin/wracct 0555 root bin
+f usr/bin/write 2555 root tty
+s usr/bin/wtf=man
+f usr/bin/xargs 0555 root bin
+f usr/bin/xgettext 0555 root bin
+f usr/bin/xstr 0555 root bin
+f usr/bin/yes 0555 root bin
+f usr/bin/ypcat 0555 root other
+f usr/bin/ypmatch 0555 root other
+f usr/bin/yppasswd 0555 root bin
+f usr/bin/ypwhich 0555 root other
+f usr/bin/zcat 0555 root bin
+f usr/bin/ziostat 0555 root bin
+s usr/bin/zonename=../../sbin/zonename
+d usr/ccs 0755 root bin
+d usr/ccs/bin 0755 root bin
+d usr/ccs/bin/amd64 0755 root bin
+s usr/ccs/bin/amd64/ld=../../../bin/amd64/ld
+s usr/ccs/bin/ar=../../bin/ar
+s usr/ccs/bin/ld=../../bin/ld
+s usr/ccs/bin/m4=../../bin/m4
+s usr/ccs/bin/regcmp=../../bin/regcmp
+d usr/ccs/lib 0755 root bin
+d usr/ccs/lib/amd64 0755 root bin
+s usr/ccs/lib/amd64/libcurses.so.1=../../../../lib/amd64/libcurses.so.1
+s usr/ccs/lib/amd64/libform.so.1=../../../lib/amd64/libform.so.1
+s usr/ccs/lib/amd64/libgen.so.1=../../../../lib/amd64/libgen.so.1
+s usr/ccs/lib/amd64/libl.so.1=../../../lib/amd64/libl.so.1
+s usr/ccs/lib/amd64/libmalloc.so.1=../../../lib/amd64/libmalloc.so.1
+s usr/ccs/lib/amd64/libmenu.so.1=../../../lib/amd64/libmenu.so.1
+s usr/ccs/lib/amd64/libpanel.so.1=../../../lib/amd64/libpanel.so.1
+s usr/ccs/lib/amd64/libtermcap.so.1=../../../../lib/amd64/libtermcap.so.1
+s usr/ccs/lib/amd64/libtermlib.so.1=../../../../lib/amd64/libcurses.so.1
+s usr/ccs/lib/amd64/liby.so.1=../../../lib/amd64/liby.so.1
+s usr/ccs/lib/libcurses.so.1=../../../lib/libcurses.so.1
+s usr/ccs/lib/libform.so.1=../../lib/libform.so.1
+s usr/ccs/lib/libgen.so.1=../../../lib/libgen.so.1
+s usr/ccs/lib/libl.so.1=../../lib/libl.so.1
+s usr/ccs/lib/libmalloc.so.1=../../lib/libmalloc.so.1
+s usr/ccs/lib/libmenu.so.1=../../lib/libmenu.so.1
+s usr/ccs/lib/libpanel.so.1=../../lib/libpanel.so.1
+s usr/ccs/lib/libtermcap.so.1=../../../lib/libtermcap.so.1
+s usr/ccs/lib/libtermlib.so.1=../../../lib/libcurses.so.1
+s usr/ccs/lib/liby.so.1=../../lib/liby.so.1
+s usr/ccs/lib/link_audit=../../lib/link_audit
+s usr/dict=share/lib/dict
+d usr/gnu 0755 root bin
+d usr/gnu/bin 0755 root bin
+d usr/gnu/lib 0755 root bin
+d usr/gnu/share 0755 root sys
+d usr/gnu/share/man 0755 root bin
+d usr/gnu/share/man/man1 0755 root bin
+d usr/gnu/share/man/man3 0755 root bin
+d usr/gnu/share/man/man5 0755 root bin
+d usr/gnu/share/man/man7 0755 root bin
+d usr/include 0755 root bin
+f usr/include/aclutils.h 0644 root bin
+f usr/include/aio.h 0644 root bin
+f usr/include/alloca.h 0644 root bin
+d usr/include/amd64 0755 root bin
+d usr/include/amd64/sys 0755 root bin
+f usr/include/amd64/sys/kdi_regs.h 0644 root bin
+f usr/include/amd64/sys/privmregs.h 0644 root bin
+f usr/include/amd64/sys/privregs.h 0644 root bin
+f usr/include/apptrace.h 0644 root bin
+f usr/include/apptrace_impl.h 0644 root bin
+f usr/include/ar.h 0644 root bin
+f usr/include/archives.h 0644 root bin
+d usr/include/arpa 0755 root bin
+f usr/include/arpa/ftp.h 0644 root bin
+f usr/include/arpa/inet.h 0644 root bin
+f usr/include/arpa/nameser.h 0644 root bin
+f usr/include/arpa/nameser_compat.h 0644 root bin
+f usr/include/arpa/telnet.h 0644 root bin
+f usr/include/arpa/tftp.h 0644 root bin
+d usr/include/asm 0755 root bin
+f usr/include/asm/atomic.h 0644 root bin
+f usr/include/asm/bitmap.h 0644 root bin
+f usr/include/asm/byteorder.h 0644 root bin
+f usr/include/asm/clock.h 0644 root bin
+f usr/include/asm/cpu.h 0644 root bin
+f usr/include/asm/cpuvar.h 0644 root bin
+f usr/include/asm/htable.h 0644 root bin
+f usr/include/asm/mmu.h 0644 root bin
+f usr/include/asm/sunddi.h 0644 root bin
+f usr/include/asm/thread.h 0644 root bin
+f usr/include/assert.h 0644 root bin
+d usr/include/ast 0755 root bin
+f usr/include/ast/align.h 0644 root bin
+f usr/include/ast/ast.h 0644 root bin
+f usr/include/ast/ast_botch.h 0644 root bin
+f usr/include/ast/ast_ccode.h 0644 root bin
+f usr/include/ast/ast_common.h 0644 root bin
+f usr/include/ast/ast_dir.h 0644 root bin
+f usr/include/ast/ast_dirent.h 0644 root bin
+f usr/include/ast/ast_fcntl.h 0644 root bin
+f usr/include/ast/ast_float.h 0644 root bin
+f usr/include/ast/ast_fs.h 0644 root bin
+f usr/include/ast/ast_getopt.h 0644 root bin
+f usr/include/ast/ast_iconv.h 0644 root bin
+f usr/include/ast/ast_lib.h 0644 root bin
+f usr/include/ast/ast_limits.h 0644 root bin
+f usr/include/ast/ast_map.h 0644 root bin
+f usr/include/ast/ast_mmap.h 0644 root bin
+f usr/include/ast/ast_mode.h 0644 root bin
+f usr/include/ast/ast_namval.h 0644 root bin
+f usr/include/ast/ast_ndbm.h 0644 root bin
+f usr/include/ast/ast_nl_types.h 0644 root bin
+f usr/include/ast/ast_param.h 0644 root bin
+f usr/include/ast/ast_standards.h 0644 root bin
+f usr/include/ast/ast_std.h 0644 root bin
+f usr/include/ast/ast_stdio.h 0644 root bin
+f usr/include/ast/ast_sys.h 0644 root bin
+f usr/include/ast/ast_time.h 0644 root bin
+f usr/include/ast/ast_tty.h 0644 root bin
+f usr/include/ast/ast_version.h 0644 root bin
+f usr/include/ast/ast_vfork.h 0644 root bin
+f usr/include/ast/ast_wait.h 0644 root bin
+f usr/include/ast/ast_wchar.h 0644 root bin
+f usr/include/ast/ast_windows.h 0644 root bin
+f usr/include/ast/bytesex.h 0644 root bin
+f usr/include/ast/ccode.h 0644 root bin
+f usr/include/ast/cdt.h 0644 root bin
+f usr/include/ast/cmd.h 0644 root bin
+f usr/include/ast/cmdext.h 0644 root bin
+f usr/include/ast/debug.h 0644 root bin
+f usr/include/ast/dirent.h 0644 root bin
+f usr/include/ast/dlldefs.h 0644 root bin
+f usr/include/ast/dt.h 0644 root bin
+f usr/include/ast/endian.h 0644 root bin
+f usr/include/ast/error.h 0644 root bin
+f usr/include/ast/find.h 0644 root bin
+f usr/include/ast/fnmatch.h 0644 root bin
+f usr/include/ast/fnv.h 0644 root bin
+f usr/include/ast/fs3d.h 0644 root bin
+f usr/include/ast/fts.h 0644 root bin
+f usr/include/ast/ftw.h 0644 root bin
+f usr/include/ast/ftwalk.h 0644 root bin
+f usr/include/ast/getopt.h 0644 root bin
+f usr/include/ast/glob.h 0644 root bin
+f usr/include/ast/hash.h 0644 root bin
+f usr/include/ast/hashkey.h 0644 root bin
+f usr/include/ast/hashpart.h 0644 root bin
+f usr/include/ast/history.h 0644 root bin
+f usr/include/ast/iconv.h 0644 root bin
+f usr/include/ast/ip6.h 0644 root bin
+f usr/include/ast/lc.h 0644 root bin
+f usr/include/ast/ls.h 0644 root bin
+f usr/include/ast/magic.h 0644 root bin
+f usr/include/ast/magicid.h 0644 root bin
+f usr/include/ast/mc.h 0644 root bin
+f usr/include/ast/mime.h 0644 root bin
+f usr/include/ast/mnt.h 0644 root bin
+f usr/include/ast/modecanon.h 0644 root bin
+f usr/include/ast/modex.h 0644 root bin
+f usr/include/ast/namval.h 0644 root bin
+f usr/include/ast/nl_types.h 0644 root bin
+f usr/include/ast/nval.h 0644 root bin
+f usr/include/ast/option.h 0644 root bin
+f usr/include/ast/pp.h 0644 root bin
+f usr/include/ast/ppkey.h 0644 root bin
+f usr/include/ast/preroot.h 0644 root bin
+f usr/include/ast/proc.h 0644 root bin
+f usr/include/ast/prototyped.h 0644 root bin
+f usr/include/ast/re_comp.h 0644 root bin
+f usr/include/ast/recfmt.h 0644 root bin
+f usr/include/ast/regex.h 0644 root bin
+f usr/include/ast/regexp.h 0644 root bin
+f usr/include/ast/sfdisc.h 0644 root bin
+f usr/include/ast/sfio.h 0644 root bin
+f usr/include/ast/sfio_s.h 0644 root bin
+f usr/include/ast/sfio_t.h 0644 root bin
+f usr/include/ast/shcmd.h 0644 root bin
+f usr/include/ast/shell.h 0644 root bin
+f usr/include/ast/sig.h 0644 root bin
+f usr/include/ast/stack.h 0644 root bin
+f usr/include/ast/stak.h 0644 root bin
+f usr/include/ast/stdio.h 0644 root bin
+f usr/include/ast/stk.h 0644 root bin
+f usr/include/ast/sum.h 0644 root bin
+f usr/include/ast/swap.h 0644 root bin
+f usr/include/ast/tar.h 0644 root bin
+f usr/include/ast/times.h 0644 root bin
+f usr/include/ast/tm.h 0644 root bin
+f usr/include/ast/tmx.h 0644 root bin
+f usr/include/ast/tok.h 0644 root bin
+f usr/include/ast/tv.h 0644 root bin
+f usr/include/ast/usage.h 0644 root bin
+f usr/include/ast/vdb.h 0644 root bin
+f usr/include/ast/vecargs.h 0644 root bin
+f usr/include/ast/vmalloc.h 0644 root bin
+f usr/include/ast/wait.h 0644 root bin
+f usr/include/ast/wchar.h 0644 root bin
+f usr/include/ast/wordexp.h 0644 root bin
+f usr/include/atomic.h 0644 root bin
+f usr/include/attr.h 0644 root bin
+d usr/include/audio 0755 root bin
+f usr/include/audio/au.h 0644 root bin
+f usr/include/auth_attr.h 0644 root bin
+f usr/include/auth_list.h 0644 root bin
+f usr/include/boot_http.h 0644 root bin
+f usr/include/bootinfo.h 0644 root bin
+f usr/include/bootlog.h 0644 root bin
+d usr/include/bsm 0755 root bin
+f usr/include/bsm/adt.h 0644 root bin
+f usr/include/bsm/adt_event.h 0644 root bin
+f usr/include/bsm/audit.h 0644 root bin
+f usr/include/bsm/audit_door_infc.h 0644 root bin
+f usr/include/bsm/audit_kernel.h 0644 root bin
+f usr/include/bsm/audit_kevents.h 0644 root bin
+f usr/include/bsm/audit_private.h 0644 root bin
+f usr/include/bsm/audit_record.h 0644 root bin
+f usr/include/bsm/audit_uevents.h 0644 root bin
+f usr/include/bsm/devalloc.h 0644 root bin
+f usr/include/bsm/devices.h 0644 root bin
+f usr/include/bsm/libbsm.h 0644 root bin
+f usr/include/config_admin.h 0644 root bin
+f usr/include/cpio.h 0644 root bin
+f usr/include/crypt.h 0644 root bin
+f usr/include/cryptoutil.h 0644 root bin
+f usr/include/ctype.h 0644 root bin
+f usr/include/curses.h 0644 root bin
+d usr/include/dat 0755 root bin
+f usr/include/dat/dat.h 0644 root bin
+f usr/include/dat/dat_error.h 0644 root bin
+f usr/include/dat/dat_platform_specific.h 0644 root bin
+f usr/include/dat/dat_redirection.h 0644 root bin
+f usr/include/dat/dat_registry.h 0644 root bin
+f usr/include/dat/dat_vendor_specific.h 0644 root bin
+f usr/include/dat/udat.h 0644 root bin
+f usr/include/dat/udat_config.h 0644 root bin
+f usr/include/dat/udat_redirection.h 0644 root bin
+f usr/include/dat/udat_vendor_specific.h 0644 root bin
+f usr/include/deflt.h 0644 root bin
+d usr/include/des 0755 root bin
+f usr/include/des/des.h 0644 root bin
+f usr/include/des/desdata.h 0644 root bin
+f usr/include/des/softdes.h 0644 root bin
+f usr/include/device_info.h 0644 root bin
+f usr/include/devid.h 0644 root bin
+f usr/include/devmgmt.h 0644 root bin
+f usr/include/devpoll.h 0644 root bin
+f usr/include/dhcp_hostconf.h 0644 root bin
+f usr/include/dhcp_impl.h 0644 root bin
+f usr/include/dhcp_inittab.h 0644 root bin
+f usr/include/dhcp_stable.h 0644 root bin
+f usr/include/dhcp_svc_confkey.h 0644 root bin
+f usr/include/dhcp_svc_confopt.h 0644 root bin
+f usr/include/dhcp_svc_private.h 0644 root bin
+f usr/include/dhcp_svc_public.h 0644 root bin
+f usr/include/dhcp_symbol.h 0644 root bin
+f usr/include/dhcp_symbol_common.h 0644 root bin
+f usr/include/dhcpagent_ipc.h 0644 root bin
+f usr/include/dhcpagent_util.h 0644 root bin
+f usr/include/dhcpmsg.h 0644 root bin
+f usr/include/dial.h 0644 root bin
+f usr/include/directory.h 0644 root bin
+f usr/include/dirent.h 0644 root bin
+f usr/include/dlfcn.h 0644 root bin
+f usr/include/dns_sd.h 0644 root bin
+f usr/include/door.h 0644 root bin
+f usr/include/dtrace.h 0644 root bin
+f usr/include/elf.h 0644 root bin
+f usr/include/err.h 0644 root bin
+f usr/include/errfp.h 0644 root bin
+f usr/include/errno.h 0644 root bin
+f usr/include/eti.h 0644 root bin
+f usr/include/euc.h 0644 root bin
+f usr/include/exacct.h 0644 root bin
+f usr/include/exacct_impl.h 0644 root bin
+f usr/include/exec_attr.h 0644 root bin
+f usr/include/execinfo.h 0644 root bin
+f usr/include/fatal.h 0644 root bin
+f usr/include/fcntl.h 0644 root bin
+f usr/include/float.h 0644 root bin
+d usr/include/fm 0755 root bin
+f usr/include/fm/diagcode.h 0644 root bin
+f usr/include/fm/fmd_adm.h 0644 root bin
+f usr/include/fm/fmd_agent.h 0644 root bin
+f usr/include/fm/fmd_api.h 0644 root bin
+f usr/include/fm/fmd_fmri.h 0644 root bin
+f usr/include/fm/fmd_log.h 0644 root bin
+f usr/include/fm/fmd_msg.h 0644 root bin
+f usr/include/fm/fmd_snmp.h 0644 root bin
+f usr/include/fm/libdiskstatus.h 0644 root bin
+f usr/include/fm/libfmevent.h 0644 root bin
+f usr/include/fm/libfmevent_ruleset.h 0644 root bin
+f usr/include/fm/libseslog.h 0644 root bin
+f usr/include/fm/libtopo.h 0644 root bin
+f usr/include/fm/topo_hc.h 0644 root bin
+f usr/include/fm/topo_list.h 0644 root bin
+f usr/include/fm/topo_method.h 0644 root bin
+f usr/include/fm/topo_mod.h 0644 root bin
+f usr/include/fmtmsg.h 0644 root bin
+f usr/include/fnmatch.h 0644 root bin
+f usr/include/form.h 0644 root bin
+f usr/include/ftw.h 0644 root bin
+d usr/include/fwflash 0755 root bin
+f usr/include/fwflash/fwflash.h 0644 root bin
+f usr/include/gelf.h 0644 root bin
+f usr/include/getopt.h 0644 root bin
+f usr/include/getwidth.h 0644 root bin
+f usr/include/getxby_door.h 0644 root bin
+f usr/include/glob.h 0644 root bin
+f usr/include/grp.h 0644 root bin
+d usr/include/gssapi 0755 root bin
+f usr/include/gssapi/gssapi.h 0644 root bin
+f usr/include/gssapi/gssapi_ext.h 0644 root bin
+f usr/include/hbaapi.h 0644 root bin
+d usr/include/ia32 0755 root bin
+d usr/include/ia32/sys 0755 root bin
+f usr/include/ia32/sys/asm_linkage.h 0644 root bin
+f usr/include/ia32/sys/kdi_regs.h 0644 root bin
+f usr/include/ia32/sys/machtypes.h 0644 root bin
+f usr/include/ia32/sys/privmregs.h 0644 root bin
+f usr/include/ia32/sys/privregs.h 0644 root bin
+f usr/include/ia32/sys/psw.h 0644 root bin
+f usr/include/ia32/sys/pte.h 0644 root bin
+f usr/include/ia32/sys/reg.h 0644 root bin
+f usr/include/ia32/sys/stack.h 0644 root bin
+f usr/include/ia32/sys/trap.h 0644 root bin
+f usr/include/ia32/sys/traptrace.h 0644 root bin
+f usr/include/iconv.h 0644 root bin
+f usr/include/idmap.h 0644 root bin
+f usr/include/ieeefp.h 0644 root bin
+f usr/include/ifaddrs.h 0644 root bin
+f usr/include/ikedoor.h 0644 root bin
+f usr/include/ima.h 0644 root bin
+d usr/include/inet 0755 root bin
+f usr/include/inet/arp.h 0644 root bin
+f usr/include/inet/common.h 0644 root bin
+f usr/include/inet/ip.h 0644 root bin
+f usr/include/inet/ip2mac.h 0644 root bin
+f usr/include/inet/ip2mac_impl.h 0644 root bin
+f usr/include/inet/ip6.h 0644 root bin
+f usr/include/inet/ip6_asp.h 0644 root bin
+f usr/include/inet/ip_arp.h 0644 root bin
+f usr/include/inet/ip_ftable.h 0644 root bin
+f usr/include/inet/ip_if.h 0644 root bin
+f usr/include/inet/ip_impl.h 0644 root bin
+f usr/include/inet/ip_ire.h 0644 root bin
+f usr/include/inet/ip_multi.h 0644 root bin
+f usr/include/inet/ip_ndp.h 0644 root bin
+f usr/include/inet/ip_netinfo.h 0644 root bin
+f usr/include/inet/ip_rts.h 0644 root bin
+f usr/include/inet/ip_stack.h 0644 root bin
+f usr/include/inet/ipclassifier.h 0644 root bin
+f usr/include/inet/ipdrop.h 0644 root bin
+f usr/include/inet/ipnet.h 0644 root bin
+f usr/include/inet/ipp_common.h 0644 root bin
+f usr/include/inet/ipsec_impl.h 0644 root bin
+f usr/include/inet/ipsec_info.h 0644 root bin
+f usr/include/inet/ipsecah.h 0644 root bin
+f usr/include/inet/ipsecesp.h 0644 root bin
+f usr/include/inet/iptun.h 0644 root bin
+f usr/include/inet/keysock.h 0644 root bin
+d usr/include/inet/kssl 0755 root bin
+f usr/include/inet/kssl/kssl.h 0644 root bin
+f usr/include/inet/kssl/ksslapi.h 0644 root bin
+f usr/include/inet/kssl/ksslimpl.h 0644 root bin
+f usr/include/inet/kssl/ksslproto.h 0644 root bin
+f usr/include/inet/led.h 0644 root bin
+f usr/include/inet/mi.h 0644 root bin
+f usr/include/inet/mib2.h 0644 root bin
+d usr/include/inet/nca 0755 root bin
+f usr/include/inet/nca/nca.h 0644 root bin
+f usr/include/inet/nca/ncadoorhdr.h 0644 root bin
+f usr/include/inet/nca/ncaio.h 0644 root bin
+f usr/include/inet/nca/ncakmem.h 0644 root bin
+f usr/include/inet/nca/ncalogd.h 0644 root bin
+f usr/include/inet/nca/ncandd.h 0644 root bin
+f usr/include/inet/nd.h 0644 root bin
+f usr/include/inet/optcom.h 0644 root bin
+f usr/include/inet/rawip_impl.h 0644 root bin
+f usr/include/inet/sadb.h 0644 root bin
+f usr/include/inet/sctp_itf.h 0644 root bin
+f usr/include/inet/snmpcom.h 0644 root bin
+f usr/include/inet/tcp.h 0644 root bin
+f usr/include/inet/tcp_impl.h 0644 root bin
+f usr/include/inet/tcp_sack.h 0644 root bin
+f usr/include/inet/tcp_stack.h 0644 root bin
+f usr/include/inet/tcp_stats.h 0644 root bin
+f usr/include/inet/tunables.h 0644 root bin
+f usr/include/inet/udp_impl.h 0644 root bin
+f usr/include/inet/wifi_ioctl.h 0644 root bin
+f usr/include/inetsvc.h 0644 root bin
+f usr/include/instzones_api.h 0644 root bin
+f usr/include/inttypes.h 0644 root bin
+f usr/include/ipadm_ipmgmt.h 0644 root bin
+f usr/include/ipadm_ndpd.h 0644 root bin
+f usr/include/ipmp.h 0644 root bin
+f usr/include/ipmp_admin.h 0644 root bin
+f usr/include/ipmp_mpathd.h 0644 root bin
+f usr/include/ipmp_query.h 0644 root bin
+f usr/include/ipmp_query_impl.h 0644 root bin
+d usr/include/ipp 0755 root bin
+d usr/include/ipp/dlcosmk 0755 root bin
+f usr/include/ipp/dlcosmk/dlcosmk.h 0644 root bin
+d usr/include/ipp/dscpmk 0755 root bin
+f usr/include/ipp/dscpmk/dscpmk.h 0644 root bin
+d usr/include/ipp/flowacct 0755 root bin
+f usr/include/ipp/flowacct/flowacct.h 0644 root bin
+d usr/include/ipp/ipgpc 0755 root bin
+f usr/include/ipp/ipgpc/ipgpc.h 0644 root bin
+f usr/include/ipp/ipp.h 0644 root bin
+f usr/include/ipp/ipp_config.h 0644 root bin
+f usr/include/ipp/ipp_impl.h 0644 root bin
+f usr/include/ipp/ippctl.h 0644 root bin
+d usr/include/ipp/meters 0755 root bin
+f usr/include/ipp/meters/meter.h 0644 root bin
+f usr/include/ipsec_util.h 0644 root bin
+d usr/include/iso 0755 root bin
+s usr/include/iso/assert_iso.h=../assert.h
+f usr/include/iso/ctype_c99.h 0644 root bin
+f usr/include/iso/ctype_iso.h 0644 root bin
+s usr/include/iso/errno_iso.h=../errno.h
+s usr/include/iso/float_iso.h=../float.h
+s usr/include/iso/iso646_iso.h=../iso646.h
+f usr/include/iso/limits_iso.h 0644 root bin
+f usr/include/iso/locale_iso.h 0644 root bin
+f usr/include/iso/setjmp_iso.h 0644 root bin
+f usr/include/iso/signal_iso.h 0644 root bin
+f usr/include/iso/stdarg_c99.h 0644 root bin
+f usr/include/iso/stdarg_iso.h 0644 root bin
+f usr/include/iso/stddef_iso.h 0644 root bin
+f usr/include/iso/stdio_c99.h 0644 root bin
+f usr/include/iso/stdio_iso.h 0644 root bin
+f usr/include/iso/stdlib_c99.h 0644 root bin
+f usr/include/iso/stdlib_iso.h 0644 root bin
+f usr/include/iso/string_iso.h 0644 root bin
+f usr/include/iso/time_iso.h 0644 root bin
+f usr/include/iso/wchar_c99.h 0644 root bin
+f usr/include/iso/wchar_iso.h 0644 root bin
+f usr/include/iso/wctype_c99.h 0644 root bin
+f usr/include/iso/wctype_iso.h 0644 root bin
+f usr/include/iso646.h 0644 root bin
+d usr/include/kerberosv5 0755 root bin
+f usr/include/kerberosv5/com_err.h 0644 root bin
+f usr/include/kerberosv5/krb5.h 0644 root bin
+f usr/include/kerberosv5/mit-sipb-copyright.h 0644 root bin
+f usr/include/kerberosv5/mit_copyright.h 0644 root bin
+f usr/include/klpd.h 0644 root bin
+f usr/include/kmfapi.h 0644 root bin
+f usr/include/kmftypes.h 0644 root bin
+f usr/include/kstat.h 0644 root bin
+f usr/include/kvm.h 0644 root bin
+f usr/include/langinfo.h 0644 root bin
+f usr/include/lastlog.h 0644 root bin
+f usr/include/lber.h 0644 root bin
+f usr/include/ldap.h 0644 root bin
+f usr/include/libbe.h 0644 root bin
+f usr/include/libbe_priv.h 0644 root bin
+f usr/include/libbrand.h 0644 root bin
+f usr/include/libcmdutils.h 0644 root bin
+f usr/include/libcontract.h 0644 root bin
+f usr/include/libcontract_priv.h 0644 root bin
+f usr/include/libcpc.h 0644 root bin
+f usr/include/libctf.h 0644 root bin
+f usr/include/libdevice.h 0644 root bin
+f usr/include/libdevinfo.h 0644 root bin
+f usr/include/libdisasm.h 0644 root bin
+f usr/include/libdiskmgt.h 0644 root bin
+f usr/include/libdladm.h 0644 root bin
+f usr/include/libdladm_impl.h 0644 root bin
+f usr/include/libdlaggr.h 0644 root bin
+f usr/include/libdlbridge.h 0644 root bin
+f usr/include/libdlether.h 0644 root bin
+f usr/include/libdlflow.h 0644 root bin
+f usr/include/libdlflow_impl.h 0644 root bin
+f usr/include/libdlib.h 0644 root bin
+f usr/include/libdliptun.h 0644 root bin
+f usr/include/libdllink.h 0644 root bin
+f usr/include/libdlmgmt.h 0644 root bin
+f usr/include/libdlpi.h 0644 root bin
+f usr/include/libdlsim.h 0644 root bin
+f usr/include/libdlstat.h 0644 root bin
+f usr/include/libdlvlan.h 0644 root bin
+f usr/include/libdlvnic.h 0644 root bin
+f usr/include/libdlwlan.h 0644 root bin
+f usr/include/libdlwlan_impl.h 0644 root bin
+f usr/include/libelf.h 0644 root bin
+f usr/include/libelfsign.h 0644 root bin
+f usr/include/libfcoe.h 0644 root bin
+f usr/include/libfdisk.h 0644 root bin
+f usr/include/libfstyp.h 0644 root bin
+f usr/include/libfstyp_module.h 0644 root bin
+f usr/include/libgen.h 0644 root bin
+f usr/include/libgrubmgmt.h 0644 root bin
+f usr/include/libilb.h 0644 root bin
+f usr/include/libinetutil.h 0644 root bin
+f usr/include/libintl.h 0644 root bin
+f usr/include/libipadm.h 0644 root bin
+f usr/include/libipd.h 0644 root bin
+f usr/include/libipmi.h 0644 root bin
+f usr/include/libipp.h 0644 root bin
+f usr/include/libiscsit.h 0644 root bin
+f usr/include/libmail.h 0644 root bin
+d usr/include/libmilter 0755 root bin
+f usr/include/libmilter/README 0644 root bin
+f usr/include/libmilter/mfapi.h 0644 root bin
+f usr/include/libmilter/mfdef.h 0644 root bin
+f usr/include/libndmp.h 0644 root bin
+f usr/include/libnvpair.h 0644 root bin
+f usr/include/libnwam.h 0644 root bin
+f usr/include/libnwam_priv.h 0644 root bin
+f usr/include/libpctx.h 0644 root bin
+f usr/include/libproc.h 0644 root bin
+f usr/include/librcm.h 0644 root bin
+f usr/include/librcm_event.h 0644 root bin
+f usr/include/librcm_impl.h 0644 root bin
+f usr/include/librestart.h 0644 root bin
+f usr/include/librestart_priv.h 0644 root bin
+f usr/include/libscf.h 0644 root bin
+f usr/include/libscf_priv.h 0644 root bin
+f usr/include/libshare.h 0644 root bin
+f usr/include/libshare_impl.h 0644 root bin
+f usr/include/libsocket_priv.h 0644 root bin
+f usr/include/libsrpt.h 0644 root bin
+f usr/include/libstmf.h 0644 root bin
+f usr/include/libstmfproxy.h 0644 root bin
+f usr/include/libsun_ima.h 0644 root bin
+f usr/include/libsysevent.h 0644 root bin
+f usr/include/libsysevent_impl.h 0644 root bin
+f usr/include/libtecla.h 0644 root bin
+f usr/include/libuutil.h 0644 root bin
+f usr/include/libuutil_impl.h 0644 root bin
+f usr/include/libvrrpadm.h 0644 root bin
+f usr/include/libvscan.h 0644 root bin
+f usr/include/libw.h 0644 root bin
+f usr/include/libzfs.h 0644 root bin
+f usr/include/libzfs_core.h 0644 root bin
+f usr/include/libzfs_jni_dataset.h 0644 root bin
+f usr/include/libzfs_jni_disk.h 0644 root bin
+f usr/include/libzfs_jni_diskmgt.h 0644 root bin
+f usr/include/libzfs_jni_ipool.h 0644 root bin
+f usr/include/libzfs_jni_main.h 0644 root bin
+f usr/include/libzfs_jni_pool.h 0644 root bin
+f usr/include/libzfs_jni_property.h 0644 root bin
+f usr/include/libzfs_jni_util.h 0644 root bin
+f usr/include/libzonecfg.h 0644 root bin
+f usr/include/libzoneinfo.h 0644 root bin
+f usr/include/limits.h 0644 root bin
+f usr/include/linenum.h 0644 root bin
+f usr/include/link.h 0644 root bin
+f usr/include/listen.h 0644 root bin
+f usr/include/locale.h 0644 root bin
+f usr/include/macros.h 0644 root bin
+f usr/include/maillock.h 0644 root bin
+f usr/include/malloc.h 0644 root bin
+f usr/include/md4.h 0644 root bin
+f usr/include/md5.h 0644 root bin
+f usr/include/mdiox.h 0644 root bin
+f usr/include/mdmn_changelog.h 0644 root bin
+f usr/include/memory.h 0644 root bin
+f usr/include/menu.h 0644 root bin
+f usr/include/mhdx.h 0644 root bin
+f usr/include/mon.h 0644 root bin
+f usr/include/monetary.h 0644 root bin
+f usr/include/mp.h 0644 root bin
+f usr/include/mpapi-sun.h 0644 root bin
+f usr/include/mpapi.h 0644 root bin
+f usr/include/mqueue.h 0644 root bin
+f usr/include/mtmalloc.h 0644 root bin
+f usr/include/nan.h 0644 root bin
+f usr/include/ndbm.h 0644 root bin
+f usr/include/ndpd.h 0644 root bin
+d usr/include/net 0755 root bin
+f usr/include/net/af.h 0644 root bin
+f usr/include/net/bpf.h 0644 root bin
+f usr/include/net/bpfdesc.h 0644 root bin
+f usr/include/net/bridge.h 0644 root bin
+f usr/include/net/bridge_impl.h 0644 root bin
+f usr/include/net/dlt.h 0644 root bin
+f usr/include/net/if.h 0644 root bin
+f usr/include/net/if_arp.h 0644 root bin
+f usr/include/net/if_dl.h 0644 root bin
+f usr/include/net/if_types.h 0644 root bin
+f usr/include/net/pfkeyv2.h 0644 root bin
+f usr/include/net/pfpolicy.h 0644 root bin
+f usr/include/net/ppp-comp.h 0644 root bin
+f usr/include/net/ppp_defs.h 0644 root bin
+f usr/include/net/pppio.h 0644 root bin
+f usr/include/net/pppoe.h 0644 root bin
+f usr/include/net/radix.h 0644 root bin
+f usr/include/net/route.h 0644 root bin
+f usr/include/net/simnet.h 0644 root bin
+f usr/include/net/sppptun.h 0644 root bin
+f usr/include/net/trill.h 0644 root bin
+f usr/include/net/vjcompress.h 0644 root bin
+f usr/include/net/wpa.h 0644 root bin
+f usr/include/netboot_paths.h 0644 root bin
+f usr/include/netconfig.h 0644 root bin
+f usr/include/netdb.h 0644 root bin
+f usr/include/netdir.h 0644 root bin
+d usr/include/netinet 0755 root bin
+f usr/include/netinet/arp.h 0644 root bin
+f usr/include/netinet/dhcp.h 0644 root bin
+f usr/include/netinet/dhcp6.h 0644 root bin
+f usr/include/netinet/icmp6.h 0644 root bin
+f usr/include/netinet/icmp_var.h 0644 root bin
+f usr/include/netinet/if_ether.h 0644 root bin
+f usr/include/netinet/igmp.h 0644 root bin
+f usr/include/netinet/igmp_var.h 0644 root bin
+f usr/include/netinet/in.h 0644 root bin
+f usr/include/netinet/in_pcb.h 0644 root bin
+f usr/include/netinet/in_systm.h 0644 root bin
+f usr/include/netinet/in_var.h 0644 root bin
+f usr/include/netinet/inetutil.h 0644 root bin
+f usr/include/netinet/ip.h 0644 root bin
+f usr/include/netinet/ip6.h 0644 root bin
+f usr/include/netinet/ip_auth.h 0644 root bin
+f usr/include/netinet/ip_compat.h 0644 root bin
+f usr/include/netinet/ip_fil.h 0644 root bin
+f usr/include/netinet/ip_frag.h 0644 root bin
+f usr/include/netinet/ip_htable.h 0644 root bin
+f usr/include/netinet/ip_icmp.h 0644 root bin
+f usr/include/netinet/ip_lookup.h 0644 root bin
+f usr/include/netinet/ip_mroute.h 0644 root bin
+f usr/include/netinet/ip_nat.h 0644 root bin
+f usr/include/netinet/ip_pool.h 0644 root bin
+f usr/include/netinet/ip_proxy.h 0644 root bin
+f usr/include/netinet/ip_state.h 0644 root bin
+f usr/include/netinet/ip_var.h 0644 root bin
+f usr/include/netinet/ipf_stack.h 0644 root bin
+f usr/include/netinet/ipl.h 0644 root bin
+f usr/include/netinet/pim.h 0644 root bin
+f usr/include/netinet/sctp.h 0644 root bin
+f usr/include/netinet/tcp.h 0644 root bin
+f usr/include/netinet/tcp_debug.h 0644 root bin
+f usr/include/netinet/tcp_fsm.h 0644 root bin
+f usr/include/netinet/tcp_seq.h 0644 root bin
+f usr/include/netinet/tcp_timer.h 0644 root bin
+f usr/include/netinet/tcp_var.h 0644 root bin
+f usr/include/netinet/tcpip.h 0644 root bin
+f usr/include/netinet/udp.h 0644 root bin
+f usr/include/netinet/udp_var.h 0644 root bin
+f usr/include/netinet/vrrp.h 0644 root bin
+d usr/include/netpacket 0755 root bin
+f usr/include/netpacket/packet.h 0644 root bin
+d usr/include/netsmb 0755 root bin
+f usr/include/netsmb/smbfs_acl.h 0644 root bin
+f usr/include/netsmb/smbfs_api.h 0644 root bin
+d usr/include/nfs 0755 root bin
+f usr/include/nfs/auth.h 0644 root bin
+f usr/include/nfs/export.h 0644 root bin
+f usr/include/nfs/lm.h 0644 root bin
+f usr/include/nfs/mapid.h 0644 root bin
+f usr/include/nfs/mount.h 0644 root bin
+f usr/include/nfs/nfs.h 0644 root bin
+f usr/include/nfs/nfs4.h 0644 root bin
+f usr/include/nfs/nfs4_attr.h 0644 root bin
+f usr/include/nfs/nfs4_clnt.h 0644 root bin
+f usr/include/nfs/nfs4_db_impl.h 0644 root bin
+f usr/include/nfs/nfs4_idmap_impl.h 0644 root bin
+f usr/include/nfs/nfs4_kprot.h 0644 root bin
+f usr/include/nfs/nfs_acl.h 0644 root bin
+f usr/include/nfs/nfs_clnt.h 0644 root bin
+f usr/include/nfs/nfs_cmd.h 0644 root bin
+f usr/include/nfs/nfs_log.h 0644 root bin
+f usr/include/nfs/nfs_sec.h 0644 root bin
+f usr/include/nfs/nfsid_map.h 0644 root bin
+f usr/include/nfs/nfssys.h 0644 root bin
+f usr/include/nfs/rnode.h 0644 root bin
+f usr/include/nfs/rnode4.h 0644 root bin
+f usr/include/nl_types.h 0644 root bin
+f usr/include/nlist.h 0644 root bin
+f usr/include/note.h 0644 root bin
+f usr/include/nsctl.h 0644 root bin
+f usr/include/nss.h 0644 root bin
+f usr/include/nss_common.h 0644 root bin
+f usr/include/nss_dbdefs.h 0644 root bin
+f usr/include/nss_netdir.h 0644 root bin
+f usr/include/nsswitch.h 0644 root bin
+f usr/include/nvfru.h 0644 root bin
+f usr/include/ofmt.h 0644 root bin
+f usr/include/p12access.h 0644 root bin
+f usr/include/p12aux.h 0644 root bin
+f usr/include/p12err.h 0644 root bin
+f usr/include/panel.h 0644 root bin
+f usr/include/parseURL.h 0644 root bin
+d usr/include/parted 0755 root bin
+f usr/include/parted/constraint.h 0644 root bin
+f usr/include/parted/crc32.h 0644 root bin
+f usr/include/parted/debug.h 0644 root bin
+f usr/include/parted/device.h 0644 root bin
+f usr/include/parted/disk.h 0644 root bin
+f usr/include/parted/endian.h 0644 root bin
+f usr/include/parted/exception.h 0644 root bin
+f usr/include/parted/filesys.h 0644 root bin
+f usr/include/parted/geom.h 0644 root bin
+f usr/include/parted/natmath.h 0644 root bin
+f usr/include/parted/parted.h 0644 root bin
+f usr/include/parted/solaris.h 0644 root bin
+f usr/include/parted/timer.h 0644 root bin
+f usr/include/parted/unit.h 0644 root bin
+f usr/include/passwdutil.h 0644 root bin
+f usr/include/pcsample.h 0644 root bin
+f usr/include/pfmt.h 0644 root bin
+f usr/include/picl.h 0644 root bin
+f usr/include/picltree.h 0644 root bin
+f usr/include/pkgdev.h 0644 root bin
+f usr/include/pkginfo.h 0644 root bin
+f usr/include/pkglocs.h 0644 root bin
+f usr/include/pkgstrct.h 0644 root bin
+f usr/include/pkgtrans.h 0644 root bin
+f usr/include/poll.h 0644 root bin
+f usr/include/pool.h 0644 root bin
+f usr/include/port.h 0644 root bin
+f usr/include/priv.h 0644 root bin
+f usr/include/priv_utils.h 0644 root bin
+f usr/include/proc_service.h 0644 root bin
+f usr/include/procfs.h 0644 root bin
+f usr/include/prof.h 0644 root bin
+f usr/include/prof_attr.h 0644 root bin
+f usr/include/project.h 0644 root bin
+d usr/include/protocols 0755 root bin
+f usr/include/protocols/dumprestore.h 0644 root bin
+f usr/include/protocols/ripngd.h 0644 root bin
+f usr/include/protocols/routed.h 0644 root bin
+f usr/include/protocols/rwhod.h 0644 root bin
+f usr/include/protocols/timed.h 0644 root bin
+f usr/include/pthread.h 0644 root bin
+f usr/include/pw.h 0644 root bin
+f usr/include/pwd.h 0644 root bin
+f usr/include/raidcfg.h 0644 root bin
+f usr/include/raidcfg_spi.h 0644 root bin
+f usr/include/rcm_module.h 0644 root bin
+f usr/include/rctl.h 0644 root bin
+f usr/include/re_comp.h 0644 root bin
+f usr/include/regex.h 0644 root bin
+f usr/include/regexp.h 0644 root bin
+f usr/include/regexpr.h 0644 root bin
+f usr/include/resolv.h 0644 root bin
+f usr/include/rje.h 0644 root bin
+f usr/include/rp_plugin.h 0644 root bin
+d usr/include/rpc 0755 root bin
+f usr/include/rpc/auth.h 0644 root bin
+f usr/include/rpc/auth_des.h 0644 root bin
+f usr/include/rpc/auth_sys.h 0644 root bin
+f usr/include/rpc/auth_unix.h 0644 root bin
+f usr/include/rpc/bootparam.h 0644 root bin
+f usr/include/rpc/clnt.h 0644 root bin
+f usr/include/rpc/clnt_soc.h 0644 root bin
+f usr/include/rpc/clnt_stat.h 0644 root bin
+f usr/include/rpc/des_crypt.h 0644 root bin
+f usr/include/rpc/key_prot.h 0644 root bin
+f usr/include/rpc/nettype.h 0644 root bin
+f usr/include/rpc/pmap_clnt.h 0644 root bin
+f usr/include/rpc/pmap_prot.h 0644 root bin
+f usr/include/rpc/pmap_prot.x 0644 root bin
+f usr/include/rpc/pmap_rmt.h 0644 root bin
+f usr/include/rpc/raw.h 0644 root bin
+f usr/include/rpc/rpc.h 0644 root bin
+f usr/include/rpc/rpc_com.h 0644 root bin
+f usr/include/rpc/rpc_msg.h 0644 root bin
+f usr/include/rpc/rpc_rdma.h 0644 root bin
+f usr/include/rpc/rpc_sztypes.h 0644 root bin
+f usr/include/rpc/rpcb_clnt.h 0644 root bin
+f usr/include/rpc/rpcb_prot.h 0644 root bin
+f usr/include/rpc/rpcb_prot.x 0644 root bin
+f usr/include/rpc/rpcent.h 0644 root bin
+f usr/include/rpc/rpcsec_gss.h 0644 root bin
+f usr/include/rpc/rpcsys.h 0644 root bin
+f usr/include/rpc/svc.h 0644 root bin
+f usr/include/rpc/svc_auth.h 0644 root bin
+f usr/include/rpc/svc_mt.h 0644 root bin
+f usr/include/rpc/svc_soc.h 0644 root bin
+f usr/include/rpc/types.h 0644 root bin
+f usr/include/rpc/xdr.h 0644 root bin
+d usr/include/rpcsvc 0755 root bin
+f usr/include/rpcsvc/autofs_prot.h 0644 root bin
+f usr/include/rpcsvc/autofs_prot.x 0644 root bin
+f usr/include/rpcsvc/bootparam.h 0644 root bin
+f usr/include/rpcsvc/bootparam_prot.h 0644 root bin
+f usr/include/rpcsvc/bootparam_prot.x 0644 root bin
+f usr/include/rpcsvc/daemon_utils.h 0644 root bin
+f usr/include/rpcsvc/dbm.h 0644 root bin
+f usr/include/rpcsvc/idmap_prot.h 0644 root bin
+f usr/include/rpcsvc/idmap_prot.x 0644 root bin
+f usr/include/rpcsvc/key_prot.x 0644 root bin
+f usr/include/rpcsvc/mount.h 0644 root bin
+f usr/include/rpcsvc/mount.x 0644 root bin
+f usr/include/rpcsvc/nfs4_prot.h 0644 root bin
+f usr/include/rpcsvc/nfs4_prot.x 0644 root bin
+f usr/include/rpcsvc/nfs_acl.h 0644 root bin
+f usr/include/rpcsvc/nfs_acl.x 0644 root bin
+f usr/include/rpcsvc/nfs_prot.h 0644 root bin
+f usr/include/rpcsvc/nfs_prot.x 0644 root bin
+f usr/include/rpcsvc/nis.h 0644 root bin
+f usr/include/rpcsvc/nis.x 0644 root bin
+f usr/include/rpcsvc/nis_db.h 0644 root bin
+f usr/include/rpcsvc/nis_object.x 0644 root bin
+f usr/include/rpcsvc/nislib.h 0644 root bin
+f usr/include/rpcsvc/nlm_prot.h 0644 root bin
+f usr/include/rpcsvc/nlm_prot.x 0644 root bin
+f usr/include/rpcsvc/nsm_addr.h 0644 root bin
+f usr/include/rpcsvc/nsm_addr.x 0644 root bin
+f usr/include/rpcsvc/rex.h 0644 root bin
+f usr/include/rpcsvc/rex.x 0644 root bin
+f usr/include/rpcsvc/rpc_sztypes.h 0644 root bin
+f usr/include/rpcsvc/rpc_sztypes.x 0644 root bin
+f usr/include/rpcsvc/rquota.h 0644 root bin
+f usr/include/rpcsvc/rquota.x 0644 root bin
+f usr/include/rpcsvc/rstat.h 0644 root bin
+f usr/include/rpcsvc/rstat.x 0644 root bin
+f usr/include/rpcsvc/rusers.h 0644 root bin
+f usr/include/rpcsvc/rusers.x 0644 root bin
+f usr/include/rpcsvc/rwall.h 0644 root bin
+f usr/include/rpcsvc/rwall.x 0644 root bin
+f usr/include/rpcsvc/sm_inter.h 0644 root bin
+f usr/include/rpcsvc/sm_inter.x 0644 root bin
+f usr/include/rpcsvc/spray.h 0644 root bin
+f usr/include/rpcsvc/spray.x 0644 root bin
+f usr/include/rpcsvc/svc_dg_priv.h 0644 root bin
+f usr/include/rpcsvc/ufs_prot.h 0644 root bin
+f usr/include/rpcsvc/ufs_prot.x 0644 root bin
+f usr/include/rpcsvc/yp.x 0644 root bin
+f usr/include/rpcsvc/yp_prot.h 0644 root bin
+f usr/include/rpcsvc/ypclnt.h 0644 root bin
+f usr/include/rpcsvc/yppasswd.h 0644 root bin
+f usr/include/rpcsvc/ypupd.h 0644 root bin
+f usr/include/rsmapi.h 0644 root bin
+f usr/include/rtld_db.h 0644 root bin
+f usr/include/s_string.h 0644 root bin
+f usr/include/sac.h 0644 root bin
+d usr/include/sasl 0755 root bin
+f usr/include/sasl/prop.h 0644 root bin
+f usr/include/sasl/sasl.h 0644 root bin
+f usr/include/sasl/saslplug.h 0644 root bin
+f usr/include/sasl/saslutil.h 0644 root bin
+f usr/include/scfutil.h 0644 root bin
+f usr/include/sched.h 0644 root bin
+f usr/include/schedctl.h 0644 root bin
+d usr/include/scsi 0755 root bin
+f usr/include/scsi/libscsi.h 0644 root bin
+f usr/include/scsi/libses.h 0644 root bin
+f usr/include/scsi/libses_plugin.h 0644 root bin
+f usr/include/scsi/libsmp.h 0644 root bin
+f usr/include/scsi/libsmp_plugin.h 0644 root bin
+d usr/include/scsi/plugins 0755 root bin
+d usr/include/scsi/plugins/ses 0755 root bin
+d usr/include/scsi/plugins/ses/framework 0755 root bin
+f usr/include/scsi/plugins/ses/framework/libses.h 0644 root bin
+f usr/include/scsi/plugins/ses/framework/ses2.h 0644 root bin
+f usr/include/scsi/plugins/ses/framework/ses2_impl.h 0644 root bin
+d usr/include/scsi/plugins/ses/vendor 0755 root bin
+f usr/include/scsi/plugins/ses/vendor/sun.h 0644 root bin
+f usr/include/scsi/plugins/ses/vendor/sun_impl.h 0644 root bin
+d usr/include/scsi/plugins/smp 0755 root bin
+d usr/include/scsi/plugins/smp/engine 0755 root bin
+d usr/include/scsi/plugins/smp/framework 0755 root bin
+f usr/include/sdp.h 0644 root bin
+f usr/include/sdssc.h 0644 root bin
+f usr/include/search.h 0644 root bin
+f usr/include/secdb.h 0644 root bin
+d usr/include/security 0755 root bin
+f usr/include/security/auditd.h 0644 root bin
+f usr/include/security/cryptoki.h 0644 root bin
+f usr/include/security/pam_appl.h 0644 root bin
+f usr/include/security/pam_impl.h 0644 root bin
+f usr/include/security/pam_modules.h 0644 root bin
+f usr/include/security/pkcs11.h 0644 root bin
+f usr/include/security/pkcs11f.h 0644 root bin
+f usr/include/security/pkcs11t.h 0644 root bin
+f usr/include/semaphore.h 0644 root bin
+f usr/include/setjmp.h 0644 root bin
+f usr/include/sgtty.h 0644 root bin
+f usr/include/sha1.h 0644 root bin
+f usr/include/sha2.h 0644 root bin
+f usr/include/shadow.h 0644 root bin
+d usr/include/sharefs 0755 root bin
+f usr/include/sharefs/share.h 0644 root bin
+f usr/include/sharefs/sharefs.h 0644 root bin
+f usr/include/sharefs/sharetab.h 0644 root bin
+f usr/include/siginfo.h 0644 root bin
+f usr/include/signal.h 0644 root bin
+f usr/include/sip.h 0644 root bin
+f usr/include/slp.h 0644 root bin
+d usr/include/smb 0755 root bin
+f usr/include/smb/doserror.h 0644 root bin
+f usr/include/smb/lmerr.h 0644 root bin
+f usr/include/smb/nterror.h 0644 root bin
+f usr/include/smb/ntstatus.h 0644 root bin
+f usr/include/smbios.h 0644 root bin
+d usr/include/smbsrv 0755 root bin
+f usr/include/smbsrv/alloc.h 0644 root bin
+f usr/include/smbsrv/cp_unicode.h 0644 root bin
+f usr/include/smbsrv/cp_usascii.h 0644 root bin
+f usr/include/smbsrv/hash_table.h 0644 root bin
+f usr/include/smbsrv/libmlrpc.h 0644 root bin
+f usr/include/smbsrv/libmlsvc.h 0644 root bin
+f usr/include/smbsrv/libsmb.h 0644 root bin
+f usr/include/smbsrv/libsmbns.h 0644 root bin
+f usr/include/smbsrv/mac_cifs.h 0644 root bin
+f usr/include/smbsrv/mailslot.h 0644 root bin
+f usr/include/smbsrv/mbuf.h 0644 root bin
+f usr/include/smbsrv/msgbuf.h 0644 root bin
+d usr/include/smbsrv/ndl 0755 root bin
+f usr/include/smbsrv/ndl/dssetup.ndl 0644 root bin
+f usr/include/smbsrv/ndl/eventlog.ndl 0644 root bin
+f usr/include/smbsrv/ndl/llsrpc.ndl 0644 root bin
+f usr/include/smbsrv/ndl/lsarpc.ndl 0644 root bin
+f usr/include/smbsrv/ndl/msgsvc.ndl 0644 root bin
+f usr/include/smbsrv/ndl/ndrtypes.ndl 0644 root bin
+f usr/include/smbsrv/ndl/netdfs.ndl 0644 root bin
+f usr/include/smbsrv/ndl/netlogon.ndl 0644 root bin
+f usr/include/smbsrv/ndl/rpcpdu.ndl 0644 root bin
+f usr/include/smbsrv/ndl/samrpc.ndl 0644 root bin
+f usr/include/smbsrv/ndl/security.ndl 0644 root bin
+f usr/include/smbsrv/ndl/spoolss.ndl 0644 root bin
+f usr/include/smbsrv/ndl/srvsvc.ndl 0644 root bin
+f usr/include/smbsrv/ndl/svcctl.ndl 0644 root bin
+f usr/include/smbsrv/ndl/winreg.ndl 0644 root bin
+f usr/include/smbsrv/ndr.h 0644 root bin
+f usr/include/smbsrv/netbios.h 0644 root bin
+f usr/include/smbsrv/netrauth.h 0644 root bin
+f usr/include/smbsrv/nmpipes.h 0644 root bin
+f usr/include/smbsrv/ntaccess.h 0644 root bin
+f usr/include/smbsrv/ntifs.h 0644 root bin
+f usr/include/smbsrv/ntlocale.h 0644 root bin
+f usr/include/smbsrv/smb.h 0644 root bin
+f usr/include/smbsrv/smb_dfs.h 0644 root bin
+f usr/include/smbsrv/smb_door.h 0644 root bin
+f usr/include/smbsrv/smb_fsops.h 0644 root bin
+f usr/include/smbsrv/smb_idmap.h 0644 root bin
+f usr/include/smbsrv/smb_inet.h 0644 root bin
+f usr/include/smbsrv/smb_ioctl.h 0644 root bin
+f usr/include/smbsrv/smb_kproto.h 0644 root bin
+f usr/include/smbsrv/smb_kstat.h 0644 root bin
+f usr/include/smbsrv/smb_ktypes.h 0644 root bin
+f usr/include/smbsrv/smb_privilege.h 0644 root bin
+f usr/include/smbsrv/smb_share.h 0644 root bin
+f usr/include/smbsrv/smb_sid.h 0644 root bin
+f usr/include/smbsrv/smb_token.h 0644 root bin
+f usr/include/smbsrv/smb_vops.h 0644 root bin
+f usr/include/smbsrv/smb_xdr.h 0644 root bin
+f usr/include/smbsrv/smbinfo.h 0644 root bin
+f usr/include/smbsrv/string.h 0644 root bin
+f usr/include/smbsrv/svrapi.h 0644 root bin
+f usr/include/smbsrv/winioctl.h 0644 root bin
+f usr/include/smbsrv/winsvc.h 0644 root bin
+f usr/include/smbsrv/wintypes.h 0644 root bin
+f usr/include/smhbaapi.h 0644 root bin
+f usr/include/spawn.h 0644 root bin
+d usr/include/sqlite 0755 root bin
+f usr/include/sqlite/sqlite-misc.h 0644 root bin
+f usr/include/sqlite/sqlite.h 0644 root bin
+f usr/include/stack_unwind.h 0644 root bin
+f usr/include/stdarg.h 0644 root bin
+f usr/include/stdbool.h 0644 root bin
+f usr/include/stddef.h 0644 root bin
+f usr/include/stdint.h 0644 root bin
+f usr/include/stdio.h 0644 root bin
+f usr/include/stdio_ext.h 0644 root bin
+f usr/include/stdio_impl.h 0644 root bin
+f usr/include/stdio_tag.h 0644 root bin
+f usr/include/stdlib.h 0644 root bin
+f usr/include/storclass.h 0644 root bin
+f usr/include/stp_bpdu.h 0644 root bin
+f usr/include/stp_in.h 0644 root bin
+f usr/include/stp_vectors.h 0644 root bin
+f usr/include/string.h 0644 root bin
+f usr/include/strings.h 0644 root bin
+f usr/include/stropts.h 0644 root bin
+f usr/include/syms.h 0644 root bin
+f usr/include/synch.h 0644 root bin
+d usr/include/sys 0755 root bin
+d usr/include/sys/1394 0755 root bin
+f usr/include/sys/1394/cmd1394.h 0644 root bin
+f usr/include/sys/1394/id1394.h 0644 root bin
+f usr/include/sys/1394/ieee1212.h 0644 root bin
+f usr/include/sys/1394/ieee1394.h 0644 root bin
+f usr/include/sys/1394/ixl1394.h 0644 root bin
+f usr/include/sys/1394/s1394_impl.h 0644 root bin
+f usr/include/sys/1394/t1394.h 0644 root bin
+f usr/include/sys/acct.h 0644 root bin
+f usr/include/sys/acctctl.h 0644 root bin
+f usr/include/sys/acl.h 0644 root bin
+f usr/include/sys/acl_impl.h 0644 root bin
+f usr/include/sys/acpi_drv.h 0644 root bin
+f usr/include/sys/aggr.h 0644 root bin
+f usr/include/sys/aggr_impl.h 0644 root bin
+d usr/include/sys/agp 0755 root bin
+f usr/include/sys/agp/agpamd64gart_io.h 0644 root bin
+f usr/include/sys/agp/agpdefs.h 0644 root bin
+f usr/include/sys/agp/agpgart_impl.h 0644 root bin
+f usr/include/sys/agp/agpmaster_io.h 0644 root bin
+f usr/include/sys/agp/agptarget_io.h 0644 root bin
+f usr/include/sys/agpgart.h 0644 root bin
+f usr/include/sys/aio.h 0644 root bin
+f usr/include/sys/aio_impl.h 0644 root bin
+f usr/include/sys/aio_req.h 0644 root bin
+f usr/include/sys/aiocb.h 0644 root bin
+f usr/include/sys/archsystm.h 0644 root bin
+f usr/include/sys/ascii.h 0644 root bin
+f usr/include/sys/asm_linkage.h 0644 root bin
+f usr/include/sys/asy.h 0644 root bin
+f usr/include/sys/asynch.h 0644 root bin
+f usr/include/sys/atomic.h 0644 root bin
+f usr/include/sys/attr.h 0644 root bin
+d usr/include/sys/audio 0755 root bin
+f usr/include/sys/audio.h 0644 root bin
+f usr/include/sys/audio/ac97.h 0644 root bin
+f usr/include/sys/audio/audio_common.h 0644 root bin
+f usr/include/sys/audio/audio_driver.h 0644 root bin
+f usr/include/sys/audio/audio_oss.h 0644 root bin
+f usr/include/sys/audio/g711.h 0644 root bin
+f usr/include/sys/audioio.h 0644 root bin
+f usr/include/sys/autoconf.h 0644 root bin
+f usr/include/sys/auxv.h 0644 root bin
+f usr/include/sys/auxv_386.h 0644 root bin
+f usr/include/sys/auxv_SPARC.h 0644 root bin
+d usr/include/sys/av 0755 root bin
+f usr/include/sys/av/iec61883.h 0644 root bin
+f usr/include/sys/avintr.h 0644 root bin
+f usr/include/sys/avl.h 0644 root bin
+f usr/include/sys/avl_impl.h 0644 root bin
+f usr/include/sys/bitmap.h 0644 root bin
+f usr/include/sys/bitset.h 0644 root bin
+f usr/include/sys/bl.h 0644 root bin
+f usr/include/sys/blkdev.h 0644 root bin
+f usr/include/sys/bofi.h 0644 root bin
+f usr/include/sys/bofi_impl.h 0644 root bin
+f usr/include/sys/bootconf.h 0644 root bin
+f usr/include/sys/bootregs.h 0644 root bin
+f usr/include/sys/bootstat.h 0644 root bin
+f usr/include/sys/bootsvcs.h 0644 root bin
+f usr/include/sys/bpp_io.h 0644 root bin
+f usr/include/sys/brand.h 0644 root bin
+f usr/include/sys/buf.h 0644 root bin
+f usr/include/sys/bufmod.h 0644 root bin
+f usr/include/sys/bustypes.h 0644 root bin
+f usr/include/sys/byteorder.h 0644 root bin
+f usr/include/sys/callb.h 0644 root bin
+f usr/include/sys/callo.h 0644 root bin
+f usr/include/sys/cap_util.h 0644 root bin
+f usr/include/sys/ccompile.h 0644 root bin
+f usr/include/sys/cdio.h 0644 root bin
+f usr/include/sys/cis.h 0644 root bin
+f usr/include/sys/cis_handlers.h 0644 root bin
+f usr/include/sys/cis_protos.h 0644 root bin
+f usr/include/sys/cladm.h 0644 root bin
+f usr/include/sys/class.h 0644 root bin
+f usr/include/sys/clconf.h 0644 root bin
+f usr/include/sys/clock_impl.h 0644 root bin
+f usr/include/sys/cmlb.h 0644 root bin
+f usr/include/sys/cmn_err.h 0644 root bin
+f usr/include/sys/compress.h 0644 root bin
+f usr/include/sys/condvar.h 0644 root bin
+f usr/include/sys/condvar_impl.h 0644 root bin
+f usr/include/sys/conf.h 0644 root bin
+f usr/include/sys/consdev.h 0644 root bin
+f usr/include/sys/console.h 0644 root bin
+f usr/include/sys/consplat.h 0644 root bin
+d usr/include/sys/contract 0755 root bin
+f usr/include/sys/contract.h 0644 root bin
+f usr/include/sys/contract/device.h 0644 root bin
+f usr/include/sys/contract/device_impl.h 0644 root bin
+f usr/include/sys/contract/process.h 0644 root bin
+f usr/include/sys/contract/process_impl.h 0644 root bin
+f usr/include/sys/contract_impl.h 0644 root bin
+f usr/include/sys/controlregs.h 0644 root bin
+f usr/include/sys/copyops.h 0644 root bin
+f usr/include/sys/core.h 0644 root bin
+f usr/include/sys/corectl.h 0644 root bin
+f usr/include/sys/cpc_impl.h 0644 root bin
+f usr/include/sys/cpc_pcbe.h 0644 root bin
+f usr/include/sys/cpr.h 0644 root bin
+f usr/include/sys/cpu.h 0644 root bin
+f usr/include/sys/cpucaps.h 0644 root bin
+f usr/include/sys/cpucaps_impl.h 0644 root bin
+f usr/include/sys/cpupart.h 0644 root bin
+f usr/include/sys/cpuvar.h 0644 root bin
+f usr/include/sys/crc32.h 0644 root bin
+f usr/include/sys/cred.h 0644 root bin
+f usr/include/sys/cred_impl.h 0644 root bin
+f usr/include/sys/crtctl.h 0644 root bin
+f usr/include/sys/cryptmod.h 0644 root bin
+d usr/include/sys/crypto 0755 root bin
+f usr/include/sys/crypto/api.h 0644 root bin
+f usr/include/sys/crypto/common.h 0644 root bin
+f usr/include/sys/crypto/elfsign.h 0644 root bin
+f usr/include/sys/crypto/impl.h 0644 root bin
+f usr/include/sys/crypto/ioctl.h 0644 root bin
+f usr/include/sys/crypto/ioctladmin.h 0644 root bin
+f usr/include/sys/crypto/ops_impl.h 0644 root bin
+f usr/include/sys/crypto/sched_impl.h 0644 root bin
+f usr/include/sys/crypto/spi.h 0644 root bin
+f usr/include/sys/cs.h 0644 root bin
+f usr/include/sys/cs_priv.h 0644 root bin
+f usr/include/sys/cs_strings.h 0644 root bin
+f usr/include/sys/cs_stubs.h 0644 root bin
+f usr/include/sys/cs_types.h 0644 root bin
+f usr/include/sys/csiioctl.h 0644 root bin
+f usr/include/sys/ctf.h 0644 root bin
+f usr/include/sys/ctf_api.h 0644 root bin
+f usr/include/sys/ctfs.h 0644 root bin
+f usr/include/sys/ctfs_impl.h 0644 root bin
+f usr/include/sys/ctype.h 0644 root bin
+f usr/include/sys/cyclic.h 0644 root bin
+f usr/include/sys/cyclic_impl.h 0644 root bin
+f usr/include/sys/dacf.h 0644 root bin
+f usr/include/sys/dacf_impl.h 0644 root bin
+f usr/include/sys/damap.h 0644 root bin
+f usr/include/sys/damap_impl.h 0644 root bin
+f usr/include/sys/dc_ki.h 0644 root bin
+d usr/include/sys/dcam 0755 root bin
+f usr/include/sys/dcam/dcam1394_io.h 0644 root bin
+f usr/include/sys/ddi.h 0644 root bin
+f usr/include/sys/ddi_hp.h 0644 root bin
+f usr/include/sys/ddi_hp_impl.h 0644 root bin
+f usr/include/sys/ddi_impldefs.h 0644 root bin
+f usr/include/sys/ddi_implfuncs.h 0644 root bin
+f usr/include/sys/ddi_intr.h 0644 root bin
+f usr/include/sys/ddi_intr_impl.h 0644 root bin
+f usr/include/sys/ddi_isa.h 0644 root bin
+f usr/include/sys/ddi_obsolete.h 0644 root bin
+f usr/include/sys/ddi_timer.h 0644 root bin
+f usr/include/sys/ddidevmap.h 0644 root bin
+f usr/include/sys/ddidmareq.h 0644 root bin
+f usr/include/sys/ddifm.h 0644 root bin
+f usr/include/sys/ddifm_impl.h 0644 root bin
+f usr/include/sys/ddimapreq.h 0644 root bin
+f usr/include/sys/ddipropdefs.h 0644 root bin
+f usr/include/sys/dditypes.h 0644 root bin
+f usr/include/sys/debug.h 0644 root bin
+f usr/include/sys/debugreg.h 0644 root bin
+f usr/include/sys/des.h 0644 root bin
+f usr/include/sys/devcache.h 0644 root bin
+f usr/include/sys/devcache_impl.h 0644 root bin
+f usr/include/sys/devctl.h 0644 root bin
+f usr/include/sys/devfm.h 0644 root bin
+f usr/include/sys/devid_cache.h 0644 root bin
+f usr/include/sys/devinfo_impl.h 0644 root bin
+f usr/include/sys/devops.h 0644 root bin
+f usr/include/sys/devpolicy.h 0644 root bin
+f usr/include/sys/devpoll.h 0644 root bin
+f usr/include/sys/dirent.h 0644 root bin
+f usr/include/sys/disp.h 0644 root bin
+f usr/include/sys/dkbad.h 0644 root bin
+f usr/include/sys/dkio.h 0644 root bin
+f usr/include/sys/dklabel.h 0644 root bin
+d usr/include/sys/dktp 0755 root bin
+f usr/include/sys/dktp/altsctr.h 0644 root bin
+f usr/include/sys/dktp/bbh.h 0644 root bin
+f usr/include/sys/dktp/cm.h 0644 root bin
+f usr/include/sys/dktp/cmdev.h 0644 root bin
+f usr/include/sys/dktp/cmdk.h 0644 root bin
+f usr/include/sys/dktp/cmpkt.h 0644 root bin
+f usr/include/sys/dktp/controller.h 0644 root bin
+f usr/include/sys/dktp/dadev.h 0644 root bin
+f usr/include/sys/dktp/dadk.h 0644 root bin
+f usr/include/sys/dktp/dadkio.h 0644 root bin
+f usr/include/sys/dktp/fctypes.h 0644 root bin
+f usr/include/sys/dktp/fdisk.h 0644 root bin
+f usr/include/sys/dktp/flowctrl.h 0644 root bin
+f usr/include/sys/dktp/gda.h 0644 root bin
+f usr/include/sys/dktp/quetypes.h 0644 root bin
+f usr/include/sys/dktp/queue.h 0644 root bin
+f usr/include/sys/dktp/tgcom.h 0644 root bin
+f usr/include/sys/dktp/tgdk.h 0644 root bin
+f usr/include/sys/dl.h 0644 root bin
+f usr/include/sys/dld.h 0644 root bin
+f usr/include/sys/dld_impl.h 0644 root bin
+f usr/include/sys/dld_ioc.h 0644 root bin
+f usr/include/sys/dlpi.h 0644 root bin
+f usr/include/sys/dls.h 0644 root bin
+f usr/include/sys/dls_impl.h 0644 root bin
+f usr/include/sys/dls_mgmt.h 0644 root bin
+f usr/include/sys/dma_engine.h 0644 root bin
+f usr/include/sys/dma_i8237A.h 0644 root bin
+f usr/include/sys/dnlc.h 0644 root bin
+f usr/include/sys/door.h 0644 root bin
+f usr/include/sys/door_data.h 0644 root bin
+f usr/include/sys/door_impl.h 0644 root bin
+f usr/include/sys/dtrace.h 0644 root bin
+f usr/include/sys/dtrace_impl.h 0644 root bin
+f usr/include/sys/dumpadm.h 0644 root bin
+f usr/include/sys/dumphdr.h 0644 root bin
+f usr/include/sys/ecppio.h 0644 root bin
+f usr/include/sys/ecppreg.h 0644 root bin
+f usr/include/sys/ecppsys.h 0644 root bin
+f usr/include/sys/ecppvar.h 0644 root bin
+f usr/include/sys/efi_partition.h 0644 root bin
+f usr/include/sys/elf.h 0644 root bin
+f usr/include/sys/elf_386.h 0644 root bin
+f usr/include/sys/elf_SPARC.h 0644 root bin
+f usr/include/sys/elf_amd64.h 0644 root bin
+f usr/include/sys/elf_notes.h 0644 root bin
+f usr/include/sys/elftypes.h 0644 root bin
+f usr/include/sys/emul64.h 0644 root bin
+f usr/include/sys/emul64cmd.h 0644 root bin
+f usr/include/sys/emul64var.h 0644 root bin
+f usr/include/sys/epm.h 0644 root bin
+f usr/include/sys/errno.h 0644 root bin
+f usr/include/sys/errorq.h 0644 root bin
+f usr/include/sys/errorq_impl.h 0644 root bin
+f usr/include/sys/esunddi.h 0644 root bin
+f usr/include/sys/ethernet.h 0644 root bin
+f usr/include/sys/euc.h 0644 root bin
+f usr/include/sys/eucioctl.h 0644 root bin
+f usr/include/sys/exacct.h 0644 root bin
+f usr/include/sys/exacct_catalog.h 0644 root bin
+f usr/include/sys/exacct_impl.h 0644 root bin
+f usr/include/sys/exec.h 0644 root bin
+f usr/include/sys/exechdr.h 0644 root bin
+f usr/include/sys/extdirent.h 0644 root bin
+f usr/include/sys/fasttrap.h 0644 root bin
+f usr/include/sys/fasttrap_impl.h 0644 root bin
+f usr/include/sys/fasttrap_isa.h 0644 root bin
+f usr/include/sys/fault.h 0644 root bin
+f usr/include/sys/fbio.h 0644 root bin
+f usr/include/sys/fbuf.h 0644 root bin
+d usr/include/sys/fc4 0755 root bin
+f usr/include/sys/fc4/fc.h 0644 root bin
+f usr/include/sys/fc4/fc_transport.h 0644 root bin
+f usr/include/sys/fc4/fcal.h 0644 root bin
+f usr/include/sys/fc4/fcal_linkapp.h 0644 root bin
+f usr/include/sys/fc4/fcal_transport.h 0644 root bin
+f usr/include/sys/fc4/fcio.h 0644 root bin
+f usr/include/sys/fc4/fcp.h 0644 root bin
+f usr/include/sys/fc4/linkapp.h 0644 root bin
+f usr/include/sys/fcntl.h 0644 root bin
+f usr/include/sys/fct.h 0644 root bin
+f usr/include/sys/fct_defines.h 0644 root bin
+f usr/include/sys/fctio.h 0644 root bin
+f usr/include/sys/fd_debug.h 0644 root bin
+f usr/include/sys/fdbuffer.h 0644 root bin
+f usr/include/sys/fdc.h 0644 root bin
+f usr/include/sys/fdio.h 0644 root bin
+f usr/include/sys/fdmedia.h 0644 root bin
+f usr/include/sys/feature_tests.h 0644 root bin
+f usr/include/sys/fem.h 0644 root bin
+d usr/include/sys/fibre-channel 0755 root bin
+f usr/include/sys/fibre-channel/fc.h 0644 root bin
+f usr/include/sys/fibre-channel/fc_appif.h 0644 root bin
+f usr/include/sys/fibre-channel/fc_types.h 0644 root bin
+f usr/include/sys/fibre-channel/fcio.h 0644 root bin
+d usr/include/sys/fibre-channel/impl 0755 root bin
+f usr/include/sys/fibre-channel/impl/fc_error.h 0644 root bin
+f usr/include/sys/fibre-channel/impl/fcph.h 0644 root bin
+d usr/include/sys/fibre-channel/ulp 0755 root bin
+f usr/include/sys/fibre-channel/ulp/fcp_util.h 0644 root bin
+f usr/include/sys/fibre-channel/ulp/fcsm.h 0644 root bin
+f usr/include/sys/file.h 0644 root bin
+f usr/include/sys/filio.h 0644 root bin
+f usr/include/sys/flock.h 0644 root bin
+f usr/include/sys/flock_impl.h 0644 root bin
+d usr/include/sys/fm 0755 root bin
+d usr/include/sys/fm/cpu 0755 root bin
+d usr/include/sys/fm/fs 0755 root bin
+f usr/include/sys/fm/fs/zfs.h 0644 root bin
+d usr/include/sys/fm/io 0755 root bin
+f usr/include/sys/fm/io/ddi.h 0644 root bin
+f usr/include/sys/fm/io/disk.h 0644 root bin
+f usr/include/sys/fm/io/opl_mc_fm.h 0644 root bin
+f usr/include/sys/fm/io/pci.h 0644 root bin
+f usr/include/sys/fm/io/scsi.h 0644 root bin
+f usr/include/sys/fm/io/sun4upci.h 0644 root bin
+f usr/include/sys/fm/protocol.h 0644 root bin
+f usr/include/sys/fm/util.h 0644 root bin
+f usr/include/sys/fork.h 0644 root bin
+f usr/include/sys/fp.h 0644 root bin
+f usr/include/sys/frame.h 0644 root bin
+d usr/include/sys/fs 0755 root bin
+f usr/include/sys/fs/autofs.h 0644 root bin
+f usr/include/sys/fs/cachefs_dir.h 0644 root bin
+f usr/include/sys/fs/cachefs_dlog.h 0644 root bin
+f usr/include/sys/fs/cachefs_filegrp.h 0644 root bin
+f usr/include/sys/fs/cachefs_fs.h 0644 root bin
+f usr/include/sys/fs/cachefs_fscache.h 0644 root bin
+f usr/include/sys/fs/cachefs_ioctl.h 0644 root bin
+f usr/include/sys/fs/cachefs_log.h 0644 root bin
+f usr/include/sys/fs/decomp.h 0644 root bin
+f usr/include/sys/fs/dv_node.h 0644 root bin
+f usr/include/sys/fs/fifonode.h 0644 root bin
+f usr/include/sys/fs/hsfs_isospec.h 0644 root bin
+f usr/include/sys/fs/hsfs_node.h 0644 root bin
+f usr/include/sys/fs/hsfs_rrip.h 0644 root bin
+f usr/include/sys/fs/hsfs_spec.h 0644 root bin
+f usr/include/sys/fs/hsfs_susp.h 0644 root bin
+f usr/include/sys/fs/hyprlofs.h 0644 root bin
+f usr/include/sys/fs/hyprlofs_info.h 0644 root bin
+f usr/include/sys/fs/lofs_info.h 0644 root bin
+f usr/include/sys/fs/lofs_node.h 0644 root bin
+f usr/include/sys/fs/mntdata.h 0644 root bin
+f usr/include/sys/fs/namenode.h 0644 root bin
+f usr/include/sys/fs/pc_dir.h 0644 root bin
+f usr/include/sys/fs/pc_fs.h 0644 root bin
+f usr/include/sys/fs/pc_label.h 0644 root bin
+f usr/include/sys/fs/pc_node.h 0644 root bin
+f usr/include/sys/fs/pxfs_ki.h 0644 root bin
+f usr/include/sys/fs/sdev_impl.h 0644 root bin
+f usr/include/sys/fs/snode.h 0644 root bin
+f usr/include/sys/fs/swapnode.h 0644 root bin
+f usr/include/sys/fs/tmp.h 0644 root bin
+f usr/include/sys/fs/tmpnode.h 0644 root bin
+f usr/include/sys/fs/udf_inode.h 0644 root bin
+f usr/include/sys/fs/udf_volume.h 0644 root bin
+f usr/include/sys/fs/ufs_acl.h 0644 root bin
+f usr/include/sys/fs/ufs_bio.h 0644 root bin
+f usr/include/sys/fs/ufs_filio.h 0644 root bin
+f usr/include/sys/fs/ufs_fs.h 0644 root bin
+f usr/include/sys/fs/ufs_fsdir.h 0644 root bin
+f usr/include/sys/fs/ufs_inode.h 0644 root bin
+f usr/include/sys/fs/ufs_lockfs.h 0644 root bin
+f usr/include/sys/fs/ufs_log.h 0644 root bin
+f usr/include/sys/fs/ufs_mount.h 0644 root bin
+f usr/include/sys/fs/ufs_panic.h 0644 root bin
+f usr/include/sys/fs/ufs_prot.h 0644 root bin
+f usr/include/sys/fs/ufs_quota.h 0644 root bin
+f usr/include/sys/fs/ufs_snap.h 0644 root bin
+f usr/include/sys/fs/ufs_trans.h 0644 root bin
+f usr/include/sys/fs/zfs.h 0644 root bin
+f usr/include/sys/fs/zut.h 0644 root bin
+f usr/include/sys/fs_reparse.h 0644 root bin
+f usr/include/sys/fs_subr.h 0644 root bin
+f usr/include/sys/fsid.h 0644 root bin
+f usr/include/sys/fss.h 0644 root bin
+f usr/include/sys/fssnap.h 0644 root bin
+f usr/include/sys/fssnap_if.h 0644 root bin
+f usr/include/sys/fsspriocntl.h 0644 root bin
+f usr/include/sys/fstyp.h 0644 root bin
+f usr/include/sys/ftrace.h 0644 root bin
+f usr/include/sys/fx.h 0644 root bin
+f usr/include/sys/fxpriocntl.h 0644 root bin
+f usr/include/sys/gfs.h 0644 root bin
+f usr/include/sys/gld.h 0644 root bin
+f usr/include/sys/gldpriv.h 0644 root bin
+f usr/include/sys/group.h 0644 root bin
+f usr/include/sys/hdio.h 0644 root bin
+f usr/include/sys/hook.h 0644 root bin
+f usr/include/sys/hook_event.h 0644 root bin
+f usr/include/sys/hook_impl.h 0644 root bin
+d usr/include/sys/hotplug 0755 root bin
+f usr/include/sys/hotplug/hpcsvc.h 0644 root bin
+f usr/include/sys/hotplug/hpctrl.h 0644 root bin
+d usr/include/sys/hotplug/pci 0755 root bin
+f usr/include/sys/hotplug/pci/pcicfg.h 0644 root bin
+f usr/include/sys/hotplug/pci/pcihp.h 0644 root bin
+f usr/include/sys/hwconf.h 0644 root bin
+f usr/include/sys/hypervisor.h 0644 root bin
+f usr/include/sys/i8272A.h 0644 root bin
+f usr/include/sys/ia.h 0644 root bin
+f usr/include/sys/iapriocntl.h 0644 root bin
+d usr/include/sys/ib 0755 root bin
+d usr/include/sys/ib/adapters 0755 root bin
+d usr/include/sys/ib/adapters/hermon 0755 root bin
+f usr/include/sys/ib/adapters/hermon/hermon_ioctl.h 0644 root bin
+f usr/include/sys/ib/adapters/mlnx_umap.h 0644 root bin
+d usr/include/sys/ib/adapters/tavor 0755 root bin
+f usr/include/sys/ib/adapters/tavor/tavor_ioctl.h 0644 root bin
+d usr/include/sys/ib/clients 0755 root bin
+d usr/include/sys/ib/clients/ibd 0755 root bin
+f usr/include/sys/ib/clients/ibd/ibd.h 0644 root bin
+d usr/include/sys/ib/clients/of 0755 root bin
+f usr/include/sys/ib/clients/of/ofa_solaris.h 0644 root bin
+f usr/include/sys/ib/clients/of/ofed_kernel.h 0644 root bin
+d usr/include/sys/ib/clients/of/rdma 0755 root bin
+f usr/include/sys/ib/clients/of/rdma/ib_addr.h 0644 root bin
+f usr/include/sys/ib/clients/of/rdma/ib_user_mad.h 0644 root bin
+f usr/include/sys/ib/clients/of/rdma/ib_user_sa.h 0644 root bin
+f usr/include/sys/ib/clients/of/rdma/ib_user_verbs.h 0644 root bin
+f usr/include/sys/ib/clients/of/rdma/ib_verbs.h 0644 root bin
+f usr/include/sys/ib/clients/of/rdma/rdma_cm.h 0644 root bin
+f usr/include/sys/ib/clients/of/rdma/rdma_user_cm.h 0644 root bin
+d usr/include/sys/ib/clients/of/sol_ofs 0755 root bin
+f usr/include/sys/ib/clients/of/sol_ofs/sol_cma.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_ofs/sol_ib_cma.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_ofs/sol_kverb_impl.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_ofs/sol_ofs_common.h 0644 root bin
+d usr/include/sys/ib/clients/of/sol_ucma 0755 root bin
+f usr/include/sys/ib/clients/of/sol_ucma/sol_rdma_user_cm.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_ucma/sol_ucma.h 0644 root bin
+d usr/include/sys/ib/clients/of/sol_umad 0755 root bin
+f usr/include/sys/ib/clients/of/sol_umad/sol_umad.h 0644 root bin
+d usr/include/sys/ib/clients/of/sol_uverbs 0755 root bin
+f usr/include/sys/ib/clients/of/sol_uverbs/sol_uverbs.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_uverbs/sol_uverbs2ucma.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_uverbs/sol_uverbs_comp.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_uverbs/sol_uverbs_event.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_uverbs/sol_uverbs_hca.h 0644 root bin
+f usr/include/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h 0644 root bin
+f usr/include/sys/ib/ib_pkt_hdrs.h 0644 root bin
+f usr/include/sys/ib/ib_types.h 0644 root bin
+d usr/include/sys/ib/ibnex 0755 root bin
+f usr/include/sys/ib/ibnex/ibnex_devctl.h 0644 root bin
+d usr/include/sys/ib/ibtl 0755 root bin
+f usr/include/sys/ib/ibtl/ibci.h 0644 root bin
+f usr/include/sys/ib/ibtl/ibti.h 0644 root bin
+f usr/include/sys/ib/ibtl/ibti_cm.h 0644 root bin
+f usr/include/sys/ib/ibtl/ibti_common.h 0644 root bin
+f usr/include/sys/ib/ibtl/ibtl_ci_types.h 0644 root bin
+f usr/include/sys/ib/ibtl/ibtl_status.h 0644 root bin
+f usr/include/sys/ib/ibtl/ibtl_types.h 0644 root bin
+f usr/include/sys/ib/ibtl/ibvti.h 0644 root bin
+d usr/include/sys/ib/ibtl/impl 0755 root bin
+f usr/include/sys/ib/ibtl/impl/ibtl_util.h 0644 root bin
+d usr/include/sys/ib/mgt 0755 root bin
+f usr/include/sys/ib/mgt/ib_dm_attr.h 0644 root bin
+f usr/include/sys/ib/mgt/ib_mad.h 0644 root bin
+d usr/include/sys/ib/mgt/ibmf 0755 root bin
+f usr/include/sys/ib/mgt/ibmf/ibmf.h 0644 root bin
+f usr/include/sys/ib/mgt/ibmf/ibmf_msg.h 0644 root bin
+f usr/include/sys/ib/mgt/ibmf/ibmf_saa.h 0644 root bin
+f usr/include/sys/ib/mgt/ibmf/ibmf_utils.h 0644 root bin
+f usr/include/sys/ib/mgt/sa_recs.h 0644 root bin
+f usr/include/sys/ib/mgt/sm_attr.h 0644 root bin
+f usr/include/sys/ibpart.h 0644 root bin
+f usr/include/sys/id32.h 0644 root bin
+f usr/include/sys/id_space.h 0644 root bin
+d usr/include/sys/idm 0755 root bin
+f usr/include/sys/idm/idm.h 0644 root bin
+f usr/include/sys/idm/idm_conn_sm.h 0644 root bin
+f usr/include/sys/idm/idm_impl.h 0644 root bin
+f usr/include/sys/idm/idm_so.h 0644 root bin
+f usr/include/sys/idm/idm_text.h 0644 root bin
+f usr/include/sys/idm/idm_transport.h 0644 root bin
+f usr/include/sys/idmap.h 0644 root bin
+f usr/include/sys/inline.h 0644 root bin
+f usr/include/sys/instance.h 0644 root bin
+f usr/include/sys/int_const.h 0644 root bin
+f usr/include/sys/int_fmtio.h 0644 root bin
+f usr/include/sys/int_limits.h 0644 root bin
+f usr/include/sys/int_types.h 0644 root bin
+f usr/include/sys/inttypes.h 0644 root bin
+f usr/include/sys/ioccom.h 0644 root bin
+f usr/include/sys/ioctl.h 0644 root bin
+f usr/include/sys/iommulib.h 0644 root bin
+f usr/include/sys/ipc.h 0644 root bin
+f usr/include/sys/ipc_impl.h 0644 root bin
+f usr/include/sys/ipc_rctl.h 0644 root bin
+f usr/include/sys/ipmi.h 0644 root bin
+f usr/include/sys/isa_defs.h 0644 root bin
+f usr/include/sys/iscsi_authclient.h 0644 root bin
+f usr/include/sys/iscsi_authclientglue.h 0644 root bin
+f usr/include/sys/iscsi_protocol.h 0644 root bin
+d usr/include/sys/iscsit 0755 root bin
+f usr/include/sys/iscsit/chap.h 0644 root bin
+f usr/include/sys/iscsit/iscsi_if.h 0644 root bin
+f usr/include/sys/iscsit/iscsit_common.h 0644 root bin
+f usr/include/sys/iscsit/isns_protocol.h 0644 root bin
+f usr/include/sys/iscsit/radius_packet.h 0644 root bin
+f usr/include/sys/iscsit/radius_protocol.h 0644 root bin
+d usr/include/sys/iso 0755 root bin
+f usr/include/sys/iso/signal_iso.h 0644 root bin
+f usr/include/sys/jioctl.h 0644 root bin
+f usr/include/sys/kbd.h 0644 root bin
+f usr/include/sys/kbdreg.h 0644 root bin
+f usr/include/sys/kbio.h 0644 root bin
+f usr/include/sys/kcpc.h 0644 root bin
+f usr/include/sys/kd.h 0644 root bin
+f usr/include/sys/kdi.h 0644 root bin
+f usr/include/sys/kdi_impl.h 0644 root bin
+f usr/include/sys/kdi_machimpl.h 0644 root bin
+f usr/include/sys/kdi_regs.h 0644 root bin
+f usr/include/sys/kiconv.h 0644 root bin
+f usr/include/sys/kiconv_big5_utf8.h 0644 root bin
+f usr/include/sys/kiconv_cck_common.h 0644 root bin
+f usr/include/sys/kiconv_cp950hkscs_utf8.h 0644 root bin
+f usr/include/sys/kiconv_emea1.h 0644 root bin
+f usr/include/sys/kiconv_emea2.h 0644 root bin
+f usr/include/sys/kiconv_euckr_utf8.h 0644 root bin
+f usr/include/sys/kiconv_euctw_utf8.h 0644 root bin
+f usr/include/sys/kiconv_gb18030_utf8.h 0644 root bin
+f usr/include/sys/kiconv_gb2312_utf8.h 0644 root bin
+f usr/include/sys/kiconv_hkscs_utf8.h 0644 root bin
+f usr/include/sys/kiconv_ja.h 0644 root bin
+f usr/include/sys/kiconv_ja_jis_to_unicode.h 0644 root bin
+f usr/include/sys/kiconv_ja_unicode_to_jis.h 0644 root bin
+f usr/include/sys/kiconv_ko.h 0644 root bin
+f usr/include/sys/kiconv_latin1.h 0644 root bin
+f usr/include/sys/kiconv_sc.h 0644 root bin
+f usr/include/sys/kiconv_tc.h 0644 root bin
+f usr/include/sys/kiconv_uhc_utf8.h 0644 root bin
+f usr/include/sys/kiconv_utf8_big5.h 0644 root bin
+f usr/include/sys/kiconv_utf8_cp950hkscs.h 0644 root bin
+f usr/include/sys/kiconv_utf8_euckr.h 0644 root bin
+f usr/include/sys/kiconv_utf8_euctw.h 0644 root bin
+f usr/include/sys/kiconv_utf8_gb18030.h 0644 root bin
+f usr/include/sys/kiconv_utf8_gb2312.h 0644 root bin
+f usr/include/sys/kiconv_utf8_hkscs.h 0644 root bin
+f usr/include/sys/kiconv_utf8_uhc.h 0644 root bin
+f usr/include/sys/kidmap.h 0644 root bin
+f usr/include/sys/klpd.h 0644 root bin
+f usr/include/sys/klwp.h 0644 root bin
+f usr/include/sys/kmdb.h 0644 root bin
+f usr/include/sys/kmem.h 0644 root bin
+f usr/include/sys/kmem_impl.h 0644 root bin
+f usr/include/sys/kobj.h 0644 root bin
+f usr/include/sys/kobj_impl.h 0644 root bin
+f usr/include/sys/ksocket.h 0644 root bin
+f usr/include/sys/kstat.h 0644 root bin
+f usr/include/sys/kstr.h 0644 root bin
+f usr/include/sys/ksyms.h 0644 root bin
+f usr/include/sys/ksynch.h 0644 root bin
+f usr/include/sys/lc_core.h 0644 root bin
+f usr/include/sys/ldterm.h 0644 root bin
+f usr/include/sys/lgrp.h 0644 root bin
+f usr/include/sys/lgrp_user.h 0644 root bin
+f usr/include/sys/libc_kernel.h 0644 root bin
+f usr/include/sys/libdevid.h 0644 root bin
+f usr/include/sys/link.h 0644 root bin
+f usr/include/sys/list.h 0644 root bin
+f usr/include/sys/list_impl.h 0644 root bin
+f usr/include/sys/llc1.h 0644 root bin
+f usr/include/sys/loadavg.h 0644 root bin
+f usr/include/sys/localedef.h 0644 root bin
+f usr/include/sys/lock.h 0644 root bin
+f usr/include/sys/lockfs.h 0644 root bin
+f usr/include/sys/lockstat.h 0644 root bin
+f usr/include/sys/lofi.h 0644 root bin
+f usr/include/sys/log.h 0644 root bin
+f usr/include/sys/logindmux.h 0644 root bin
+f usr/include/sys/logindmux_impl.h 0644 root bin
+f usr/include/sys/lpif.h 0644 root bin
+d usr/include/sys/lvm 0755 root bin
+f usr/include/sys/lvm/md_basic.h 0644 root bin
+f usr/include/sys/lvm/md_convert.h 0644 root bin
+f usr/include/sys/lvm/md_crc.h 0644 root bin
+f usr/include/sys/lvm/md_hotspares.h 0644 root bin
+f usr/include/sys/lvm/md_mddb.h 0644 root bin
+f usr/include/sys/lvm/md_mdiox.h 0644 root bin
+f usr/include/sys/lvm/md_mhdx.h 0644 root bin
+f usr/include/sys/lvm/md_mirror.h 0644 root bin
+f usr/include/sys/lvm/md_mirror_shared.h 0644 root bin
+f usr/include/sys/lvm/md_names.h 0644 root bin
+f usr/include/sys/lvm/md_notify.h 0644 root bin
+f usr/include/sys/lvm/md_raid.h 0644 root bin
+f usr/include/sys/lvm/md_rename.h 0644 root bin
+f usr/include/sys/lvm/md_sp.h 0644 root bin
+f usr/include/sys/lvm/md_stripe.h 0644 root bin
+f usr/include/sys/lvm/md_trans.h 0644 root bin
+f usr/include/sys/lvm/mdio.h 0644 root bin
+f usr/include/sys/lvm/mdmed.h 0644 root bin
+f usr/include/sys/lvm/mdmn_commd.h 0644 root bin
+f usr/include/sys/lvm/mdvar.h 0644 root bin
+f usr/include/sys/lwp.h 0644 root bin
+f usr/include/sys/lwp_timer_impl.h 0644 root bin
+f usr/include/sys/lwp_upimutex_impl.h 0644 root bin
+f usr/include/sys/mac.h 0644 root bin
+f usr/include/sys/mac_client.h 0644 root bin
+f usr/include/sys/mac_client_impl.h 0644 root bin
+f usr/include/sys/mac_ether.h 0644 root bin
+f usr/include/sys/mac_flow.h 0644 root bin
+f usr/include/sys/mac_flow_impl.h 0644 root bin
+f usr/include/sys/mac_impl.h 0644 root bin
+f usr/include/sys/mac_provider.h 0644 root bin
+f usr/include/sys/mac_soft_ring.h 0644 root bin
+f usr/include/sys/mac_stat.h 0644 root bin
+f usr/include/sys/machelf.h 0644 root bin
+f usr/include/sys/machlock.h 0644 root bin
+f usr/include/sys/machsig.h 0644 root bin
+f usr/include/sys/machtypes.h 0644 root bin
+f usr/include/sys/map.h 0644 root bin
+f usr/include/sys/mc.h 0644 root bin
+f usr/include/sys/mc_amd.h 0644 root bin
+f usr/include/sys/mc_intel.h 0644 root bin
+f usr/include/sys/mca_amd.h 0644 root bin
+f usr/include/sys/mca_x86.h 0644 root bin
+f usr/include/sys/md4.h 0644 root bin
+f usr/include/sys/md5.h 0644 root bin
+f usr/include/sys/md5_consts.h 0644 root bin
+f usr/include/sys/mdb_modapi.h 0644 root bin
+f usr/include/sys/mdi_impldefs.h 0644 root bin
+f usr/include/sys/mem.h 0644 root bin
+f usr/include/sys/mem_config.h 0644 root bin
+f usr/include/sys/memlist.h 0644 root bin
+f usr/include/sys/mhd.h 0644 root bin
+f usr/include/sys/mii.h 0644 root bin
+f usr/include/sys/miiregs.h 0644 root bin
+f usr/include/sys/mixer.h 0644 root bin
+f usr/include/sys/mkdev.h 0644 root bin
+f usr/include/sys/mman.h 0644 root bin
+f usr/include/sys/mmapobj.h 0644 root bin
+f usr/include/sys/mntent.h 0644 root bin
+f usr/include/sys/mntio.h 0644 root bin
+f usr/include/sys/mnttab.h 0644 root bin
+f usr/include/sys/modctl.h 0644 root bin
+f usr/include/sys/mode.h 0644 root bin
+f usr/include/sys/model.h 0644 root bin
+f usr/include/sys/modhash.h 0644 root bin
+f usr/include/sys/modhash_impl.h 0644 root bin
+f usr/include/sys/mount.h 0644 root bin
+f usr/include/sys/mouse.h 0644 root bin
+f usr/include/sys/msacct.h 0644 root bin
+f usr/include/sys/msg.h 0644 root bin
+f usr/include/sys/msg_impl.h 0644 root bin
+f usr/include/sys/msio.h 0644 root bin
+f usr/include/sys/msreg.h 0644 root bin
+f usr/include/sys/mtio.h 0644 root bin
+f usr/include/sys/multidata.h 0644 root bin
+f usr/include/sys/multidata_impl.h 0644 root bin
+f usr/include/sys/mutex.h 0644 root bin
+f usr/include/sys/mutex_impl.h 0644 root bin
+f usr/include/sys/nbmlock.h 0644 root bin
+d usr/include/sys/ncall 0755 root bin
+f usr/include/sys/ncall/ncall.h 0644 root bin
+f usr/include/sys/ncall/ncall_module.h 0644 root bin
+f usr/include/sys/ndi_impldefs.h 0644 root bin
+f usr/include/sys/ndifm.h 0644 root bin
+f usr/include/sys/net80211.h 0644 root bin
+f usr/include/sys/net80211_crypto.h 0644 root bin
+f usr/include/sys/net80211_ht.h 0644 root bin
+f usr/include/sys/net80211_proto.h 0644 root bin
+f usr/include/sys/netconfig.h 0644 root bin
+f usr/include/sys/neti.h 0644 root bin
+f usr/include/sys/netstack.h 0644 root bin
+f usr/include/sys/nexusdefs.h 0644 root bin
+f usr/include/sys/note.h 0644 root bin
+f usr/include/sys/nsc_ddi.h 0644 root bin
+f usr/include/sys/nsc_thread.h 0644 root bin
+d usr/include/sys/nsctl 0755 root bin
+f usr/include/sys/nsctl/cfg.h 0644 root bin
+f usr/include/sys/nsctl/cfg_cluster.h 0644 root bin
+f usr/include/sys/nsctl/cfg_impl.h 0644 root bin
+f usr/include/sys/nsctl/cfg_lockd.h 0644 root bin
+f usr/include/sys/nsctl/contract.h 0644 root bin
+f usr/include/sys/nsctl/dsw.h 0644 root bin
+f usr/include/sys/nsctl/dsw_dev.h 0644 root bin
+f usr/include/sys/nsctl/librdc.h 0644 root bin
+f usr/include/sys/nsctl/model.h 0644 root bin
+f usr/include/sys/nsctl/ncall_inter.h 0644 root bin
+f usr/include/sys/nsctl/nsc_dev.h 0644 root bin
+f usr/include/sys/nsctl/nsc_disk.h 0644 root bin
+f usr/include/sys/nsctl/nsc_gen.h 0644 root bin
+f usr/include/sys/nsctl/nsc_hash.h 0644 root bin
+f usr/include/sys/nsctl/nsc_ioctl.h 0644 root bin
+f usr/include/sys/nsctl/nsc_mem.h 0644 root bin
+f usr/include/sys/nsctl/nsc_power.h 0644 root bin
+f usr/include/sys/nsctl/nsc_rmspin.h 0644 root bin
+f usr/include/sys/nsctl/nsctl.h 0644 root bin
+f usr/include/sys/nsctl/nsctl_inter.h 0644 root bin
+f usr/include/sys/nsctl/nsvers.h 0644 root bin
+f usr/include/sys/nsctl/rdc.h 0644 root bin
+f usr/include/sys/nsctl/rdc_bitmap.h 0644 root bin
+f usr/include/sys/nsctl/rdc_diskq.h 0644 root bin
+f usr/include/sys/nsctl/rdc_io.h 0644 root bin
+f usr/include/sys/nsctl/rdc_ioctl.h 0644 root bin
+f usr/include/sys/nsctl/rdc_prot.h 0644 root bin
+f usr/include/sys/nsctl/rdcerr.h 0644 root bin
+f usr/include/sys/nsctl/rdcrules.h 0644 root bin
+f usr/include/sys/nsctl/safestore.h 0644 root bin
+f usr/include/sys/nsctl/sd_bcache.h 0644 root bin
+f usr/include/sys/nsctl/sd_cache.h 0644 root bin
+f usr/include/sys/nsctl/sd_conf.h 0644 root bin
+f usr/include/sys/nsctl/sd_hash.h 0644 root bin
+f usr/include/sys/nsctl/sd_pcu.h 0644 root bin
+f usr/include/sys/nsctl/sd_trace.h 0644 root bin
+f usr/include/sys/nsctl/sdbc_ioctl.h 0644 root bin
+f usr/include/sys/nsctl/sv.h 0644 root bin
+f usr/include/sys/nsctl/sv_efi.h 0644 root bin
+f usr/include/sys/nsctl/sv_impl.h 0644 root bin
+f usr/include/sys/nskernd.h 0644 root bin
+f usr/include/sys/nvpair.h 0644 root bin
+f usr/include/sys/nvpair_impl.h 0644 root bin
+f usr/include/sys/objfs.h 0644 root bin
+f usr/include/sys/objfs_impl.h 0644 root bin
+f usr/include/sys/obpdefs.h 0644 root bin
+f usr/include/sys/old_procfs.h 0644 root bin
+f usr/include/sys/ontrap.h 0644 root bin
+f usr/include/sys/open.h 0644 root bin
+f usr/include/sys/openpromio.h 0644 root bin
+f usr/include/sys/panic.h 0644 root bin
+f usr/include/sys/param.h 0644 root bin
+f usr/include/sys/pathconf.h 0644 root bin
+f usr/include/sys/pathname.h 0644 root bin
+f usr/include/sys/pattr.h 0644 root bin
+f usr/include/sys/pbio.h 0644 root bin
+f usr/include/sys/pcb.h 0644 root bin
+f usr/include/sys/pccard.h 0644 root bin
+f usr/include/sys/pci.h 0644 root bin
+f usr/include/sys/pci_impl.h 0644 root bin
+f usr/include/sys/pci_tools.h 0644 root bin
+f usr/include/sys/pcic_reg.h 0644 root bin
+f usr/include/sys/pcic_var.h 0644 root bin
+f usr/include/sys/pcie.h 0644 root bin
+d usr/include/sys/pcmcia 0755 root bin
+f usr/include/sys/pcmcia.h 0644 root bin
+f usr/include/sys/pcmcia/pcata.h 0644 root bin
+f usr/include/sys/pcmcia/pcser_conf.h 0644 root bin
+f usr/include/sys/pcmcia/pcser_io.h 0644 root bin
+f usr/include/sys/pcmcia/pcser_manuspec.h 0644 root bin
+f usr/include/sys/pcmcia/pcser_reg.h 0644 root bin
+f usr/include/sys/pcmcia/pcser_var.h 0644 root bin
+f usr/include/sys/pctypes.h 0644 root bin
+f usr/include/sys/pfmod.h 0644 root bin
+f usr/include/sys/pg.h 0644 root bin
+f usr/include/sys/pghw.h 0644 root bin
+f usr/include/sys/physmem.h 0644 root bin
+f usr/include/sys/pic.h 0644 root bin
+f usr/include/sys/pit.h 0644 root bin
+f usr/include/sys/pkp_hash.h 0644 root bin
+f usr/include/sys/pm.h 0644 root bin
+f usr/include/sys/pmem.h 0644 root bin
+f usr/include/sys/policy.h 0644 root bin
+f usr/include/sys/poll.h 0644 root bin
+f usr/include/sys/poll_impl.h 0644 root bin
+f usr/include/sys/pool.h 0644 root bin
+f usr/include/sys/pool_impl.h 0644 root bin
+f usr/include/sys/pool_pset.h 0644 root bin
+f usr/include/sys/port.h 0644 root bin
+f usr/include/sys/port_impl.h 0644 root bin
+f usr/include/sys/port_kernel.h 0644 root bin
+f usr/include/sys/portif.h 0644 root bin
+f usr/include/sys/ppmio.h 0644 root bin
+f usr/include/sys/pppt_ic_if.h 0644 root bin
+f usr/include/sys/pppt_ioctl.h 0644 root bin
+f usr/include/sys/priocntl.h 0644 root bin
+f usr/include/sys/priv.h 0644 root bin
+f usr/include/sys/priv_const.h 0644 root bin
+f usr/include/sys/priv_impl.h 0644 root bin
+f usr/include/sys/priv_names.h 0644 root bin
+f usr/include/sys/privmregs.h 0644 root bin
+f usr/include/sys/privregs.h 0644 root bin
+f usr/include/sys/prnio.h 0644 root bin
+d usr/include/sys/proc 0755 root bin
+f usr/include/sys/proc.h 0644 root bin
+f usr/include/sys/proc/prdata.h 0644 root bin
+f usr/include/sys/processor.h 0644 root bin
+f usr/include/sys/procfs.h 0644 root bin
+f usr/include/sys/procfs_isa.h 0644 root bin
+f usr/include/sys/procset.h 0644 root bin
+f usr/include/sys/project.h 0644 root bin
+f usr/include/sys/prom_emul.h 0644 root bin
+f usr/include/sys/prom_isa.h 0644 root bin
+f usr/include/sys/prom_plat.h 0644 root bin
+f usr/include/sys/promif.h 0644 root bin
+f usr/include/sys/promimpl.h 0644 root bin
+f usr/include/sys/protosw.h 0644 root bin
+f usr/include/sys/prsystm.h 0644 root bin
+f usr/include/sys/pset.h 0644 root bin
+f usr/include/sys/pshot.h 0644 root bin
+f usr/include/sys/psw.h 0644 root bin
+f usr/include/sys/pte.h 0644 root bin
+f usr/include/sys/ptem.h 0644 root bin
+f usr/include/sys/ptms.h 0644 root bin
+f usr/include/sys/ptyvar.h 0644 root bin
+f usr/include/sys/queue.h 0644 root bin
+f usr/include/sys/raidioctl.h 0644 root bin
+f usr/include/sys/ramdisk.h 0644 root bin
+f usr/include/sys/random.h 0644 root bin
+f usr/include/sys/rctl.h 0644 root bin
+f usr/include/sys/rctl_impl.h 0644 root bin
+f usr/include/sys/rds.h 0644 root bin
+f usr/include/sys/reboot.h 0644 root bin
+f usr/include/sys/refstr.h 0644 root bin
+f usr/include/sys/refstr_impl.h 0644 root bin
+f usr/include/sys/reg.h 0644 root bin
+f usr/include/sys/regset.h 0644 root bin
+f usr/include/sys/resource.h 0644 root bin
+f usr/include/sys/rlioctl.h 0644 root bin
+d usr/include/sys/rsm 0755 root bin
+f usr/include/sys/rsm/rsm.h 0644 root bin
+f usr/include/sys/rsm/rsm_common.h 0644 root bin
+f usr/include/sys/rsm/rsmapi_common.h 0644 root bin
+f usr/include/sys/rsm/rsmka_path_int.h 0644 root bin
+f usr/include/sys/rsm/rsmndi.h 0644 root bin
+f usr/include/sys/rsm/rsmpi.h 0644 root bin
+f usr/include/sys/rsm/rsmpi_driver.h 0644 root bin
+f usr/include/sys/rt.h 0644 root bin
+f usr/include/sys/rtc.h 0644 root bin
+f usr/include/sys/rtpriocntl.h 0644 root bin
+f usr/include/sys/rwlock.h 0644 root bin
+f usr/include/sys/rwlock_impl.h 0644 root bin
+f usr/include/sys/rwstlock.h 0644 root bin
+f usr/include/sys/sad.h 0644 root bin
+d usr/include/sys/sata 0755 root bin
+f usr/include/sys/sata/sata_cfgadm.h 0644 root bin
+f usr/include/sys/sata/sata_defs.h 0644 root bin
+f usr/include/sys/sata/sata_hba.h 0644 root bin
+f usr/include/sys/schedctl.h 0644 root bin
+d usr/include/sys/scsi 0755 root bin
+d usr/include/sys/scsi/adapters 0755 root bin
+f usr/include/sys/scsi/adapters/iscsi_door.h 0644 root bin
+f usr/include/sys/scsi/adapters/iscsi_if.h 0644 root bin
+f usr/include/sys/scsi/adapters/mpapi_impl.h 0644 root bin
+f usr/include/sys/scsi/adapters/mpapi_scsi_vhci.h 0644 root bin
+f usr/include/sys/scsi/adapters/scsi_vhci.h 0644 root bin
+d usr/include/sys/scsi/conf 0755 root bin
+f usr/include/sys/scsi/conf/autoconf.h 0644 root bin
+f usr/include/sys/scsi/conf/device.h 0644 root bin
+d usr/include/sys/scsi/generic 0755 root bin
+f usr/include/sys/scsi/generic/commands.h 0644 root bin
+f usr/include/sys/scsi/generic/dad_mode.h 0644 root bin
+f usr/include/sys/scsi/generic/inquiry.h 0644 root bin
+f usr/include/sys/scsi/generic/message.h 0644 root bin
+f usr/include/sys/scsi/generic/mode.h 0644 root bin
+f usr/include/sys/scsi/generic/persist.h 0644 root bin
+f usr/include/sys/scsi/generic/sense.h 0644 root bin
+f usr/include/sys/scsi/generic/sff_frames.h 0644 root bin
+f usr/include/sys/scsi/generic/smp_frames.h 0644 root bin
+f usr/include/sys/scsi/generic/status.h 0644 root bin
+d usr/include/sys/scsi/impl 0755 root bin
+f usr/include/sys/scsi/impl/commands.h 0644 root bin
+f usr/include/sys/scsi/impl/inquiry.h 0644 root bin
+f usr/include/sys/scsi/impl/mode.h 0644 root bin
+f usr/include/sys/scsi/impl/scsi_reset_notify.h 0644 root bin
+f usr/include/sys/scsi/impl/scsi_sas.h 0644 root bin
+f usr/include/sys/scsi/impl/sense.h 0644 root bin
+f usr/include/sys/scsi/impl/services.h 0644 root bin
+f usr/include/sys/scsi/impl/smp_transport.h 0644 root bin
+f usr/include/sys/scsi/impl/spc3_types.h 0644 root bin
+f usr/include/sys/scsi/impl/status.h 0644 root bin
+f usr/include/sys/scsi/impl/transport.h 0644 root bin
+f usr/include/sys/scsi/impl/types.h 0644 root bin
+f usr/include/sys/scsi/impl/uscsi.h 0644 root bin
+f usr/include/sys/scsi/impl/usmp.h 0644 root bin
+f usr/include/sys/scsi/scsi.h 0644 root bin
+f usr/include/sys/scsi/scsi_address.h 0644 root bin
+f usr/include/sys/scsi/scsi_ctl.h 0644 root bin
+f usr/include/sys/scsi/scsi_fm.h 0644 root bin
+f usr/include/sys/scsi/scsi_params.h 0644 root bin
+f usr/include/sys/scsi/scsi_pkt.h 0644 root bin
+f usr/include/sys/scsi/scsi_resource.h 0644 root bin
+f usr/include/sys/scsi/scsi_types.h 0644 root bin
+f usr/include/sys/scsi/scsi_watch.h 0644 root bin
+d usr/include/sys/scsi/targets 0755 root bin
+f usr/include/sys/scsi/targets/sddef.h 0644 root bin
+f usr/include/sys/scsi/targets/ses.h 0644 root bin
+f usr/include/sys/scsi/targets/sesio.h 0644 root bin
+f usr/include/sys/scsi/targets/sgendef.h 0644 root bin
+f usr/include/sys/scsi/targets/smp.h 0644 root bin
+f usr/include/sys/scsi/targets/stdef.h 0644 root bin
+d usr/include/sys/sdcard 0755 root bin
+f usr/include/sys/sdcard/sda.h 0644 root bin
+f usr/include/sys/sdcard/sda_impl.h 0644 root bin
+f usr/include/sys/sdcard/sda_ioctl.h 0644 root bin
+f usr/include/sys/sdt.h 0644 root bin
+f usr/include/sys/segment.h 0644 root bin
+f usr/include/sys/segments.h 0644 root bin
+f usr/include/sys/select.h 0644 root bin
+f usr/include/sys/sem.h 0644 root bin
+f usr/include/sys/sem_impl.h 0644 root bin
+f usr/include/sys/sema_impl.h 0644 root bin
+f usr/include/sys/semaphore.h 0644 root bin
+f usr/include/sys/sendfile.h 0644 root bin
+f usr/include/sys/ser_sync.h 0644 root bin
+f usr/include/sys/serializer.h 0644 root bin
+f usr/include/sys/session.h 0644 root bin
+f usr/include/sys/sha1.h 0644 root bin
+f usr/include/sys/sha1_consts.h 0644 root bin
+f usr/include/sys/sha2.h 0644 root bin
+f usr/include/sys/sha2_consts.h 0644 root bin
+f usr/include/sys/share.h 0644 root bin
+f usr/include/sys/shm.h 0644 root bin
+f usr/include/sys/shm_impl.h 0644 root bin
+f usr/include/sys/sid.h 0644 root bin
+f usr/include/sys/siginfo.h 0644 root bin
+f usr/include/sys/signal.h 0644 root bin
+f usr/include/sys/sleepq.h 0644 root bin
+f usr/include/sys/smbios.h 0644 root bin
+f usr/include/sys/smbios_impl.h 0644 root bin
+f usr/include/sys/smedia.h 0644 root bin
+f usr/include/sys/sobject.h 0644 root bin
+f usr/include/sys/socket.h 0644 root bin
+f usr/include/sys/socket_impl.h 0644 root bin
+f usr/include/sys/socket_proto.h 0644 root bin
+f usr/include/sys/socketvar.h 0644 root bin
+f usr/include/sys/sockfilter.h 0644 root bin
+f usr/include/sys/sockio.h 0644 root bin
+f usr/include/sys/soundcard.h 0644 root bin
+f usr/include/sys/spl.h 0644 root bin
+f usr/include/sys/squeue.h 0644 root bin
+f usr/include/sys/squeue_impl.h 0644 root bin
+f usr/include/sys/srn.h 0644 root bin
+f usr/include/sys/sservice.h 0644 root bin
+f usr/include/sys/stack.h 0644 root bin
+f usr/include/sys/stat.h 0644 root bin
+f usr/include/sys/stat_impl.h 0644 root bin
+f usr/include/sys/statfs.h 0644 root bin
+f usr/include/sys/statvfs.h 0644 root bin
+f usr/include/sys/stdbool.h 0644 root bin
+f usr/include/sys/stdint.h 0644 root bin
+f usr/include/sys/stermio.h 0644 root bin
+f usr/include/sys/stmf.h 0644 root bin
+f usr/include/sys/stmf_defines.h 0644 root bin
+f usr/include/sys/stmf_ioctl.h 0644 root bin
+f usr/include/sys/stmf_sbd_ioctl.h 0644 root bin
+f usr/include/sys/stream.h 0644 root bin
+f usr/include/sys/strft.h 0644 root bin
+f usr/include/sys/strlog.h 0644 root bin
+f usr/include/sys/strmdep.h 0644 root bin
+f usr/include/sys/stropts.h 0644 root bin
+f usr/include/sys/strredir.h 0644 root bin
+f usr/include/sys/strstat.h 0644 root bin
+f usr/include/sys/strsubr.h 0644 root bin
+f usr/include/sys/strsun.h 0644 root bin
+f usr/include/sys/strtty.h 0644 root bin
+f usr/include/sys/sunddi.h 0644 root bin
+f usr/include/sys/sunldi.h 0644 root bin
+f usr/include/sys/sunldi_impl.h 0644 root bin
+f usr/include/sys/sunmdi.h 0644 root bin
+f usr/include/sys/sunndi.h 0644 root bin
+f usr/include/sys/sunos_dhcp_class.h 0644 root bin
+f usr/include/sys/sunpm.h 0644 root bin
+f usr/include/sys/suntpi.h 0644 root bin
+f usr/include/sys/suntty.h 0644 root bin
+f usr/include/sys/swap.h 0644 root bin
+f usr/include/sys/synch.h 0644 root bin
+f usr/include/sys/synch32.h 0644 root bin
+f usr/include/sys/syscall.h 0644 root bin
+f usr/include/sys/sysconf.h 0644 root bin
+f usr/include/sys/sysconfig.h 0644 root bin
+f usr/include/sys/sysconfig_impl.h 0644 root bin
+f usr/include/sys/sysdc.h 0644 root bin
+f usr/include/sys/sysdc_impl.h 0644 root bin
+d usr/include/sys/sysevent 0755 root bin
+f usr/include/sys/sysevent.h 0644 root bin
+f usr/include/sys/sysevent/ap_driver.h 0644 root bin
+f usr/include/sys/sysevent/dev.h 0644 root bin
+f usr/include/sys/sysevent/domain.h 0644 root bin
+f usr/include/sys/sysevent/dr.h 0644 root bin
+f usr/include/sys/sysevent/env.h 0644 root bin
+f usr/include/sys/sysevent/eventdefs.h 0644 root bin
+f usr/include/sys/sysevent/ipmp.h 0644 root bin
+f usr/include/sys/sysevent/pwrctl.h 0644 root bin
+f usr/include/sys/sysevent/svm.h 0644 root bin
+f usr/include/sys/sysevent/vrrp.h 0644 root bin
+f usr/include/sys/sysevent_impl.h 0644 root bin
+f usr/include/sys/sysi86.h 0644 root bin
+f usr/include/sys/sysinfo.h 0644 root bin
+f usr/include/sys/syslog.h 0644 root bin
+f usr/include/sys/sysmacros.h 0644 root bin
+f usr/include/sys/sysmsg_impl.h 0644 root bin
+f usr/include/sys/systeminfo.h 0644 root bin
+f usr/include/sys/systm.h 0644 root bin
+f usr/include/sys/t_kuser.h 0644 root bin
+f usr/include/sys/t_lock.h 0644 root bin
+f usr/include/sys/task.h 0644 root bin
+f usr/include/sys/taskq.h 0644 root bin
+f usr/include/sys/taskq_impl.h 0644 root bin
+f usr/include/sys/telioctl.h 0644 root bin
+f usr/include/sys/termio.h 0644 root bin
+f usr/include/sys/termios.h 0644 root bin
+f usr/include/sys/termiox.h 0644 root bin
+f usr/include/sys/thread.h 0644 root bin
+f usr/include/sys/ticlts.h 0644 root bin
+f usr/include/sys/ticots.h 0644 root bin
+f usr/include/sys/ticotsord.h 0644 root bin
+f usr/include/sys/tihdr.h 0644 root bin
+f usr/include/sys/time.h 0644 root bin
+f usr/include/sys/time_impl.h 0644 root bin
+f usr/include/sys/time_std_impl.h 0644 root bin
+f usr/include/sys/timeb.h 0644 root bin
+f usr/include/sys/timer.h 0644 root bin
+f usr/include/sys/times.h 0644 root bin
+f usr/include/sys/timex.h 0644 root bin
+f usr/include/sys/timod.h 0644 root bin
+f usr/include/sys/tirdwr.h 0644 root bin
+f usr/include/sys/tiuser.h 0644 root bin
+f usr/include/sys/tl.h 0644 root bin
+f usr/include/sys/tnf.h 0644 root bin
+f usr/include/sys/tnf_com.h 0644 root bin
+f usr/include/sys/tnf_probe.h 0644 root bin
+f usr/include/sys/tnf_writer.h 0644 root bin
+f usr/include/sys/todio.h 0644 root bin
+f usr/include/sys/tpicommon.h 0644 root bin
+f usr/include/sys/trap.h 0644 root bin
+f usr/include/sys/traptrace.h 0644 root bin
+f usr/include/sys/ts.h 0644 root bin
+d usr/include/sys/tsol 0755 root bin
+f usr/include/sys/tsol/label.h 0644 root bin
+f usr/include/sys/tsol/label_macro.h 0644 root bin
+f usr/include/sys/tsol/priv.h 0644 root bin
+f usr/include/sys/tsol/tndb.h 0644 root bin
+f usr/include/sys/tsol/tsyscall.h 0644 root bin
+f usr/include/sys/tspriocntl.h 0644 root bin
+f usr/include/sys/tss.h 0644 root bin
+f usr/include/sys/ttcompat.h 0644 root bin
+f usr/include/sys/ttold.h 0644 root bin
+f usr/include/sys/tty.h 0644 root bin
+f usr/include/sys/ttychars.h 0644 root bin
+f usr/include/sys/ttydev.h 0644 root bin
+f usr/include/sys/tuneable.h 0644 root bin
+f usr/include/sys/turnstile.h 0644 root bin
+f usr/include/sys/types.h 0644 root bin
+f usr/include/sys/types32.h 0644 root bin
+f usr/include/sys/tzfile.h 0644 root bin
+f usr/include/sys/u8_textprep.h 0644 root bin
+f usr/include/sys/u8_textprep_data.h 0644 root bin
+f usr/include/sys/uadmin.h 0644 root bin
+f usr/include/sys/ucode.h 0644 root bin
+f usr/include/sys/ucontext.h 0644 root bin
+f usr/include/sys/ucred.h 0644 root bin
+f usr/include/sys/uio.h 0644 root bin
+f usr/include/sys/ulimit.h 0644 root bin
+f usr/include/sys/un.h 0644 root bin
+d usr/include/sys/unistat 0755 root bin
+f usr/include/sys/unistat/spcs_dtrinkets.h 0644 root bin
+f usr/include/sys/unistat/spcs_errors.h 0644 root bin
+f usr/include/sys/unistat/spcs_etext.h 0644 root bin
+f usr/include/sys/unistat/spcs_etrinkets.h 0644 root bin
+f usr/include/sys/unistat/spcs_s.h 0644 root bin
+f usr/include/sys/unistat/spcs_s_impl.h 0644 root bin
+f usr/include/sys/unistat/spcs_s_k.h 0644 root bin
+f usr/include/sys/unistat/spcs_s_u.h 0644 root bin
+f usr/include/sys/unistd.h 0644 root bin
+d usr/include/sys/usb 0755 root bin
+d usr/include/sys/usb/clients 0755 root bin
+d usr/include/sys/usb/clients/audio 0755 root bin
+f usr/include/sys/usb/clients/audio/usb_audio.h 0644 root bin
+d usr/include/sys/usb/clients/hid 0755 root bin
+f usr/include/sys/usb/clients/hid/hid.h 0644 root bin
+d usr/include/sys/usb/clients/hwarc 0755 root bin
+f usr/include/sys/usb/clients/hwarc/hwarc.h 0644 root bin
+d usr/include/sys/usb/clients/mass_storage 0755 root bin
+f usr/include/sys/usb/clients/mass_storage/usb_bulkonly.h 0644 root bin
+f usr/include/sys/usb/clients/mass_storage/usb_cbi.h 0644 root bin
+d usr/include/sys/usb/clients/printer 0755 root bin
+f usr/include/sys/usb/clients/printer/usb_printer.h 0644 root bin
+d usr/include/sys/usb/clients/ugen 0755 root bin
+f usr/include/sys/usb/clients/ugen/usb_ugen.h 0644 root bin
+d usr/include/sys/usb/clients/usbcdc 0755 root bin
+f usr/include/sys/usb/clients/usbcdc/usb_cdc.h 0644 root bin
+d usr/include/sys/usb/clients/usbinput 0755 root bin
+d usr/include/sys/usb/clients/usbinput/usbwcm 0755 root bin
+f usr/include/sys/usb/clients/usbinput/usbwcm/usbwcm.h 0644 root bin
+d usr/include/sys/usb/clients/video 0755 root bin
+d usr/include/sys/usb/clients/video/usbvc 0755 root bin
+f usr/include/sys/usb/clients/video/usbvc/usbvc.h 0644 root bin
+d usr/include/sys/usb/hubd 0755 root bin
+f usr/include/sys/usb/hubd/hub.h 0644 root bin
+f usr/include/sys/usb/hubd/hubd_impl.h 0644 root bin
+f usr/include/sys/usb/usba.h 0644 root bin
+f usr/include/sys/usb/usbai.h 0644 root bin
+f usr/include/sys/usb/usbdevs.h 0644 root bin
+f usr/include/sys/user.h 0644 root bin
+f usr/include/sys/ustat.h 0644 root bin
+f usr/include/sys/utime.h 0644 root bin
+f usr/include/sys/utrap.h 0644 root bin
+f usr/include/sys/utsname.h 0644 root bin
+f usr/include/sys/utssys.h 0644 root bin
+f usr/include/sys/uuid.h 0644 root bin
+d usr/include/sys/uwb 0755 root bin
+f usr/include/sys/uwb/uwb.h 0644 root bin
+d usr/include/sys/uwb/uwba 0755 root bin
+f usr/include/sys/uwb/uwba/uwba.h 0644 root bin
+f usr/include/sys/uwb/uwbai.h 0644 root bin
+f usr/include/sys/va_impl.h 0644 root bin
+f usr/include/sys/va_list.h 0644 root bin
+f usr/include/sys/var.h 0644 root bin
+f usr/include/sys/varargs.h 0644 root bin
+f usr/include/sys/vfs.h 0644 root bin
+f usr/include/sys/vfs_opreg.h 0644 root bin
+f usr/include/sys/vfstab.h 0644 root bin
+f usr/include/sys/vgareg.h 0644 root bin
+f usr/include/sys/videodev2.h 0644 root bin
+f usr/include/sys/visual_io.h 0644 root bin
+f usr/include/sys/vlan.h 0644 root bin
+f usr/include/sys/vm.h 0644 root bin
+f usr/include/sys/vm_usage.h 0644 root bin
+f usr/include/sys/vmem.h 0644 root bin
+f usr/include/sys/vmem_impl.h 0644 root bin
+f usr/include/sys/vmem_impl_user.h 0644 root bin
+f usr/include/sys/vmparam.h 0644 root bin
+f usr/include/sys/vmsystm.h 0644 root bin
+f usr/include/sys/vnic.h 0644 root bin
+f usr/include/sys/vnic_impl.h 0644 root bin
+f usr/include/sys/vnode.h 0644 root bin
+f usr/include/sys/vscan.h 0644 root bin
+f usr/include/sys/vt.h 0644 root bin
+f usr/include/sys/vtdaemon.h 0644 root bin
+f usr/include/sys/vtoc.h 0644 root bin
+f usr/include/sys/vtrace.h 0644 root bin
+f usr/include/sys/vuid_event.h 0644 root bin
+f usr/include/sys/vuid_queue.h 0644 root bin
+f usr/include/sys/vuid_state.h 0644 root bin
+f usr/include/sys/vuid_store.h 0644 root bin
+f usr/include/sys/vuid_wheel.h 0644 root bin
+f usr/include/sys/wait.h 0644 root bin
+f usr/include/sys/waitq.h 0644 root bin
+f usr/include/sys/wanboot_impl.h 0644 root bin
+f usr/include/sys/watchpoint.h 0644 root bin
+f usr/include/sys/winlockio.h 0644 root bin
+f usr/include/sys/x86_archext.h 0644 root bin
+f usr/include/sys/xen_errno.h 0644 root bin
+f usr/include/sys/xti_inet.h 0644 root bin
+f usr/include/sys/xti_osi.h 0644 root bin
+f usr/include/sys/xti_xtiopt.h 0644 root bin
+f usr/include/sys/zcons.h 0644 root bin
+f usr/include/sys/zmod.h 0644 root bin
+f usr/include/sys/zone.h 0644 root bin
+f usr/include/sysexits.h 0644 root bin
+f usr/include/syslog.h 0644 root bin
+f usr/include/tar.h 0644 root bin
+f usr/include/tcpd.h 0644 root bin
+f usr/include/term.h 0644 root bin
+f usr/include/termio.h 0644 root bin
+f usr/include/termios.h 0644 root bin
+f usr/include/thread.h 0644 root bin
+f usr/include/thread_db.h 0644 root bin
+f usr/include/time.h 0644 root bin
+f usr/include/tiuser.h 0644 root bin
+d usr/include/tnf 0755 root bin
+f usr/include/tnf/com.h 0644 root bin
+f usr/include/tnf/probe.h 0644 root bin
+f usr/include/tnf/tnf.h 0644 root bin
+f usr/include/tnf/tnfctl.h 0644 root bin
+f usr/include/tnf/writer.h 0644 root bin
+d usr/include/tsol 0755 root bin
+f usr/include/tsol/label.h 0644 root bin
+f usr/include/tzfile.h 0644 root bin
+f usr/include/ucontext.h 0644 root bin
+f usr/include/ucred.h 0644 root bin
+f usr/include/uid_stp.h 0644 root bin
+f usr/include/ulimit.h 0644 root bin
+f usr/include/umem.h 0644 root bin
+f usr/include/umem_impl.h 0644 root bin
+f usr/include/unctrl.h 0644 root bin
+f usr/include/unistd.h 0644 root bin
+f usr/include/user_attr.h 0644 root bin
+f usr/include/userdefs.h 0644 root bin
+f usr/include/ustat.h 0644 root bin
+f usr/include/utility.h 0644 root bin
+f usr/include/utime.h 0644 root bin
+f usr/include/utmp.h 0644 root bin
+f usr/include/utmpx.h 0644 root bin
+d usr/include/uuid 0755 root bin
+f usr/include/uuid/uuid.h 0644 root bin
+f usr/include/valtools.h 0644 root bin
+f usr/include/values.h 0644 root bin
+f usr/include/varargs.h 0644 root bin
+d usr/include/vm 0755 root bin
+f usr/include/vm/anon.h 0644 root bin
+f usr/include/vm/as.h 0644 root bin
+f usr/include/vm/faultcode.h 0644 root bin
+f usr/include/vm/hat.h 0644 root bin
+f usr/include/vm/kpm.h 0644 root bin
+f usr/include/vm/page.h 0644 root bin
+f usr/include/vm/pvn.h 0644 root bin
+f usr/include/vm/rm.h 0644 root bin
+f usr/include/vm/seg.h 0644 root bin
+f usr/include/vm/seg_dev.h 0644 root bin
+f usr/include/vm/seg_enum.h 0644 root bin
+f usr/include/vm/seg_kmem.h 0644 root bin
+f usr/include/vm/seg_kp.h 0644 root bin
+f usr/include/vm/seg_kpm.h 0644 root bin
+f usr/include/vm/seg_map.h 0644 root bin
+f usr/include/vm/seg_spt.h 0644 root bin
+f usr/include/vm/seg_vn.h 0644 root bin
+f usr/include/vm/vpage.h 0644 root bin
+f usr/include/vm/vpm.h 0644 root bin
+f usr/include/volmgt.h 0644 root bin
+f usr/include/wait.h 0644 root bin
+d usr/include/wanboot 0755 root bin
+f usr/include/wanboot/key_util.h 0644 root bin
+f usr/include/wanboot/key_xdr.h 0644 root bin
+f usr/include/wanboot/wbio.h 0644 root bin
+f usr/include/wanboot_conf.h 0644 root bin
+f usr/include/wanbootutil.h 0644 root bin
+f usr/include/wchar.h 0644 root bin
+f usr/include/wchar_impl.h 0644 root bin
+f usr/include/wctype.h 0644 root bin
+f usr/include/widec.h 0644 root bin
+f usr/include/wordexp.h 0644 root bin
+f usr/include/xti.h 0644 root bin
+f usr/include/xti_inet.h 0644 root bin
+f usr/include/zdoor.h 0644 root bin
+f usr/include/zone.h 0644 root bin
+d usr/kernel 0755 root sys
+d usr/kernel/brand 0755 root sys
+d usr/kernel/brand/amd64 0755 root sys
+f usr/kernel/brand/amd64/sngl_brand 0755 root sys
+d usr/kernel/drv 0755 root sys
+d usr/kernel/drv/amd64 0755 root sys
+f usr/kernel/drv/amd64/bpf 0755 root sys
+f usr/kernel/drv/amd64/dump 0755 root sys
+f usr/kernel/drv/amd64/fssnap 0755 root sys
+f usr/kernel/drv/amd64/ipf 0755 root sys
+f usr/kernel/drv/amd64/ipmi 0755 root sys
+f usr/kernel/drv/amd64/kstat 0755 root sys
+f usr/kernel/drv/amd64/ksyms 0755 root sys
+f usr/kernel/drv/amd64/logindmux 0755 root sys
+f usr/kernel/drv/amd64/nsmb 0755 root sys
+f usr/kernel/drv/amd64/pm 0755 root sys
+f usr/kernel/drv/amd64/pool 0755 root sys
+f usr/kernel/drv/amd64/ptm 0755 root sys
+f usr/kernel/drv/amd64/pts 0755 root sys
+f usr/kernel/drv/amd64/smbsrv 0755 root sys
+f usr/kernel/drv/amd64/sppp 0755 root sys
+f usr/kernel/drv/amd64/sppptun 0755 root sys
+f usr/kernel/drv/amd64/zcons 0755 root sys
+f usr/kernel/drv/bpf.conf 0644 root sys
+f usr/kernel/drv/dump.conf 0644 root sys
+f usr/kernel/drv/fssnap.conf 0644 root sys
+f usr/kernel/drv/ipf.conf 0644 root sys
+f usr/kernel/drv/ipmi.conf 0644 root sys
+f usr/kernel/drv/kstat.conf 0644 root sys
+f usr/kernel/drv/ksyms.conf 0644 root sys
+f usr/kernel/drv/logindmux.conf 0644 root sys
+f usr/kernel/drv/nsmb.conf 0644 root sys
+f usr/kernel/drv/pm.conf 0644 root sys
+f usr/kernel/drv/pool.conf 0644 root sys
+f usr/kernel/drv/ptm.conf 0644 root sys
+f usr/kernel/drv/pts.conf 0644 root sys
+f usr/kernel/drv/smbsrv.conf 0644 root sys
+f usr/kernel/drv/sppp.conf 0644 root sys
+f usr/kernel/drv/sppptun.conf 0644 root sys
+d usr/kernel/fs 0755 root sys
+d usr/kernel/fs/amd64 0755 root sys
+f usr/kernel/fs/amd64/fdfs 0755 root sys
+f usr/kernel/fs/amd64/pcfs 0755 root sys
+f usr/kernel/fs/amd64/smbfs 0755 root sys
+d usr/kernel/kmdb 0755 root sys
+d usr/kernel/kmdb/amd64 0755 root sys
+f usr/kernel/kmdb/amd64/smbfs 0555 root sys
+f usr/kernel/kmdb/amd64/smbsrv 0555 root sys
+d usr/kernel/sched 0755 root sys
+d usr/kernel/sched/amd64 0755 root sys
+f usr/kernel/sched/amd64/FSS 0755 root sys
+f usr/kernel/sched/amd64/FX 0755 root sys
+f usr/kernel/sched/amd64/FX_DPTBL 0755 root sys
+f usr/kernel/sched/amd64/RT 0755 root sys
+f usr/kernel/sched/amd64/RT_DPTBL 0755 root sys
+d usr/kernel/socketmod 0755 root sys
+d usr/kernel/socketmod/amd64 0755 root sys
+f usr/kernel/socketmod/amd64/sockpfp 0755 root sys
+f usr/kernel/socketmod/sockpfp 0755 root sys
+d usr/kernel/sys 0755 root sys
+d usr/kernel/sys/amd64 0755 root sys
+f usr/kernel/sys/amd64/acctctl 0755 root sys
+f usr/kernel/sys/amd64/exacctsys 0755 root sys
+f usr/kernel/sys/amd64/sysacct 0755 root sys
+d usr/kvm 0755 root bin
+f usr/kvm/README 0644 root sys
+d usr/lib 0755 root bin
+f usr/lib/0@0.so.1 0755 root bin
+s usr/lib/32=.
+s usr/lib/64=amd64
+d usr/lib/abi 0755 root bin
+d usr/lib/abi/amd64 0755 root bin
+f usr/lib/abi/amd64/apptrace.so.1 0755 root bin
+d usr/lib/abi/appcert 0755 root bin
+f usr/lib/abi/appcert/AppcertUtil.pm 0555 root bin
+f usr/lib/abi/appcert/abi_index 0555 root bin
+f usr/lib/abi/appcert/etc.alt 0444 root bin
+f usr/lib/abi/appcert/etc.scoped 0444 root bin
+f usr/lib/abi/appcert/etc.tweaks 0444 root bin
+f usr/lib/abi/appcert/etc.warn 0444 root bin
+f usr/lib/abi/appcert/static_prof 0555 root bin
+f usr/lib/abi/appcert/symcheck 0555 root bin
+f usr/lib/abi/appcert/symprof 0555 root bin
+f usr/lib/abi/appcert/symreport 0555 root bin
+f usr/lib/abi/apptrace.so.1 0755 root bin
+f usr/lib/abi/spec2map 0755 root bin
+f usr/lib/abi/spec2trace 0755 root bin
+d usr/lib/acct 0755 root bin
+f usr/lib/acct/acctcms 0555 root bin
+f usr/lib/acct/acctcon 0555 root bin
+f usr/lib/acct/acctcon1 0555 root bin
+f usr/lib/acct/acctcon2 0555 root bin
+f usr/lib/acct/acctdisk 0555 root bin
+f usr/lib/acct/acctdusg 0555 root bin
+f usr/lib/acct/acctmerg 0555 root bin
+f usr/lib/acct/accton 4755 root bin
+f usr/lib/acct/acctprc 0555 root bin
+f usr/lib/acct/acctprc1 0555 root bin
+f usr/lib/acct/acctprc2 0555 root bin
+f usr/lib/acct/acctwtmp 0555 root bin
+f usr/lib/acct/chargefee 0555 root bin
+f usr/lib/acct/ckpacct 0555 root bin
+f usr/lib/acct/closewtmp 0555 root bin
+f usr/lib/acct/dodisk 0555 root bin
+f usr/lib/acct/fwtmp 0555 root bin
+f usr/lib/acct/lastlogin 0555 root bin
+f usr/lib/acct/monacct 0555 root bin
+f usr/lib/acct/nulladm 0555 root bin
+f usr/lib/acct/prctmp 0555 root bin
+f usr/lib/acct/prdaily 0555 root bin
+f usr/lib/acct/prtacct 0555 root bin
+f usr/lib/acct/ptecms.awk 0555 root bin
+f usr/lib/acct/ptelus.awk 0555 root bin
+f usr/lib/acct/remove 0555 root bin
+f usr/lib/acct/runacct 0555 root bin
+f usr/lib/acct/shutacct 0555 root bin
+f usr/lib/acct/startup 0555 root bin
+f usr/lib/acct/turnacct 0555 root bin
+f usr/lib/acct/utmp2wtmp 0555 root bin
+f usr/lib/acct/wtmpfix 0555 root bin
+d usr/lib/adb 0755 root sys
+f usr/lib/adb/adbgen 0755 root sys
+f usr/lib/adb/adbgen1 0755 root sys
+f usr/lib/adb/adbgen3 0755 root sys
+f usr/lib/adb/adbgen4 0755 root sys
+f usr/lib/adb/adbsub.o 0644 root sys
+d usr/lib/adb/amd64 0755 root sys
+f usr/lib/adb/amd64/adbsub.o 0644 root sys
+d usr/lib/amd64 0755 root bin
+f usr/lib/amd64/0@0.so.1 0755 root bin
+f usr/lib/amd64/crt1.o 0644 root bin
+f usr/lib/amd64/crti.o 0644 root bin
+f usr/lib/amd64/crtn.o 0644 root bin
+f usr/lib/amd64/gcrt1.o 0644 root bin
+d usr/lib/amd64/gss 0755 root bin
+f usr/lib/amd64/gss/dh1024-0.so.1 0755 root bin
+s usr/lib/amd64/gss/dh1024-0.so=dh1024-0.so.1
+f usr/lib/amd64/gss/dh640-0.so.1 0755 root bin
+s usr/lib/amd64/gss/dh640-0.so=dh640-0.so.1
+s usr/lib/amd64/gss/libmech_krb5.so=mech_krb5.so.1
+f usr/lib/amd64/gss/mech_dh.so.1 0755 root bin
+s usr/lib/amd64/gss/mech_dh.so=mech_dh.so.1
+f usr/lib/amd64/gss/mech_krb5.so.1 0755 root bin
+s usr/lib/amd64/gss/mech_krb5.so=mech_krb5.so.1
+f usr/lib/amd64/gss/mech_spnego.so.1 0755 root bin
+s usr/lib/amd64/ld.so.1=../../../lib/amd64/ld.so.1
+f usr/lib/amd64/lddstub 0555 root bin
+f usr/lib/amd64/libHBAAPI.so.1 0755 root bin
+s usr/lib/amd64/libHBAAPI.so=libHBAAPI.so.1
+s usr/lib/amd64/libMPAPI.so=../../../lib/amd64/libMPAPI.so.1
+s usr/lib/amd64/libMPAPI.so.1=../../../lib/amd64/libMPAPI.so.1
+f usr/lib/amd64/libSMHBAAPI.so.1 0755 root bin
+s usr/lib/amd64/libSMHBAAPI.so=libSMHBAAPI.so.1
+s usr/lib/amd64/libadm.so.1=../../../lib/amd64/libadm.so.1
+s usr/lib/amd64/libadm.so=../../../lib/amd64/libadm.so.1
+f usr/lib/amd64/libadt_jni.so.1 0755 root bin
+s usr/lib/amd64/libadt_jni.so=libadt_jni.so.1
+f usr/lib/amd64/libadutils.so.1 0755 root bin
+s usr/lib/amd64/libadutils.so=libadutils.so.1
+s usr/lib/amd64/libaio.so.1=../../../lib/amd64/libaio.so.1
+s usr/lib/amd64/libaio.so=../../../lib/amd64/libaio.so.1
+f usr/lib/amd64/libast.so.1 0755 root bin
+s usr/lib/amd64/libast.so=libast.so.1
+s usr/lib/amd64/libavl.so.1=../../../lib/amd64/libavl.so.1
+s usr/lib/amd64/libavl.so=../../../lib/amd64/libavl.so.1
+f usr/lib/amd64/libbrand.so.1 0755 root bin
+s usr/lib/amd64/libbrand.so=libbrand.so.1
+f usr/lib/amd64/libbsdmalloc.so.1 0755 root bin
+s usr/lib/amd64/libbsdmalloc.so=libbsdmalloc.so.1
+s usr/lib/amd64/libbsm.so.1=../../../lib/amd64/libbsm.so.1
+s usr/lib/amd64/libbsm.so=../../../lib/amd64/libbsm.so.1
+s usr/lib/amd64/libc.so.1=../../../lib/amd64/libc.so.1
+s usr/lib/amd64/libc.so=../../../lib/amd64/libc.so.1
+s usr/lib/amd64/libc_db.so.1=../../../lib/amd64/libc_db.so.1
+s usr/lib/amd64/libc_db.so=../../../lib/amd64/libc_db.so.1
+f usr/lib/amd64/libcfgadm.so.1 0755 root bin
+s usr/lib/amd64/libcfgadm.so=libcfgadm.so.1
+f usr/lib/amd64/libcmd.so.1 0755 root bin
+s usr/lib/amd64/libcmd.so=libcmd.so.1
+s usr/lib/amd64/libcmdutils.so.1=../../../lib/amd64/libcmdutils.so.1
+s usr/lib/amd64/libcmdutils.so=../../../lib/amd64/libcmdutils.so.1
+f usr/lib/amd64/libcommputil.so.1 0755 root bin
+s usr/lib/amd64/libcommputil.so=libcommputil.so.1
+s usr/lib/amd64/libcontract.so.1=../../../lib/amd64/libcontract.so.1
+s usr/lib/amd64/libcontract.so=../../../lib/amd64/libcontract.so.1
+f usr/lib/amd64/libcpc.so.1 0755 root bin
+s usr/lib/amd64/libcpc.so=libcpc.so.1
+f usr/lib/amd64/libcrle.so.1 0755 root bin
+f usr/lib/amd64/libcrypt.so.1 0755 root bin
+s usr/lib/amd64/libcrypt.so=libcrypt.so.1
+s usr/lib/amd64/libcrypt_d.so.1=libcrypt.so.1
+s usr/lib/amd64/libcrypt_d.so=libcrypt.so
+s usr/lib/amd64/libcrypt_i.so.1=libcrypt.so.1
+s usr/lib/amd64/libcrypt_i.so=libcrypt.so
+s usr/lib/amd64/libcryptoutil.so=../../../lib/amd64/libcryptoutil.so.1
+s usr/lib/amd64/libcryptoutil.so.1=../../../lib/amd64/libcryptoutil.so.1
+s usr/lib/amd64/libctf.so.1=../../../lib/amd64/libctf.so.1
+s usr/lib/amd64/libctf.so=../../../lib/amd64/libctf.so.1
+s usr/lib/amd64/libcurses.so.1=../../../lib/amd64/libcurses.so.1
+s usr/lib/amd64/libcurses.so=../../../lib/amd64/libcurses.so.1
+f usr/lib/amd64/libdat.so.1 0755 root bin
+s usr/lib/amd64/libdat.so=libdat.so.1
+s usr/lib/amd64/libdevice.so.1=../../../lib/amd64/libdevice.so.1
+s usr/lib/amd64/libdevice.so=../../../lib/amd64/libdevice.so.1
+s usr/lib/amd64/libdevid.so.1=../../../lib/amd64/libdevid.so.1
+s usr/lib/amd64/libdevid.so=../../../lib/amd64/libdevid.so.1
+s usr/lib/amd64/libdevinfo.so.1=../../../lib/amd64/libdevinfo.so.1
+s usr/lib/amd64/libdevinfo.so=../../../lib/amd64/libdevinfo.so.1
+f usr/lib/amd64/libdisasm.so.1 0755 root bin
+s usr/lib/amd64/libdisasm.so=libdisasm.so.1
+f usr/lib/amd64/libdiskmgt.so.1 0755 root bin
+s usr/lib/amd64/libdiskmgt.so=libdiskmgt.so.1
+s usr/lib/amd64/libdl.so.1=../../../lib/amd64/libdl.so.1
+s usr/lib/amd64/libdl.so=../../../lib/amd64/libdl.so.1
+s usr/lib/amd64/libdladm.so=../../../lib/amd64/libdladm.so.1
+s usr/lib/amd64/libdladm.so.1=../../../lib/amd64/libdladm.so.1
+f usr/lib/amd64/libdll.so.1 0755 root bin
+s usr/lib/amd64/libdll.so=libdll.so.1
+s usr/lib/amd64/libdlpi.so.1=../../../lib/amd64/libdlpi.so.1
+s usr/lib/amd64/libdlpi.so=../../../lib/amd64/libdlpi.so.1
+f usr/lib/amd64/libdns_sd.so.1 0755 root bin
+s usr/lib/amd64/libdns_sd.so=libdns_sd.so.1
+s usr/lib/amd64/libdoor.so.1=../../../lib/amd64/libdoor.so.1
+s usr/lib/amd64/libdoor.so=../../../lib/amd64/libdoor.so.1
+f usr/lib/amd64/libdtrace.so.1 0755 root bin
+s usr/lib/amd64/libdtrace.so=libdtrace.so.1
+f usr/lib/amd64/libdtrace_jni.so.1 0755 root bin
+s usr/lib/amd64/libdtrace_jni.so=libdtrace_jni.so.1
+s usr/lib/amd64/libefi.so.1=../../../lib/amd64/libefi.so.1
+s usr/lib/amd64/libefi.so=../../../lib/amd64/libefi.so.1
+s usr/lib/amd64/libelf.so.1=../../../lib/amd64/libelf.so.1
+s usr/lib/amd64/libelf.so=../../../lib/amd64/libelf.so.1
+f usr/lib/amd64/libexacct.so.1 0755 root bin
+s usr/lib/amd64/libexacct.so=libexacct.so.1
+f usr/lib/amd64/libfcoe.so.1 0755 root bin
+s usr/lib/amd64/libfcoe.so=libfcoe.so.1
+s usr/lib/amd64/libfdisk.so.1=../../../lib/amd64/libfdisk.so.1
+s usr/lib/amd64/libfdisk.so=../../../lib/amd64/libfdisk.so.1
+f usr/lib/amd64/libform.so.1 0755 root bin
+s usr/lib/amd64/libform.so=libform.so.1
+f usr/lib/amd64/libfru.so.1 0755 root bin
+s usr/lib/amd64/libfru.so=libfru.so.1
+f usr/lib/amd64/libfruraw.so.1 0755 root bin
+s usr/lib/amd64/libfruraw.so=libfruraw.so.1
+f usr/lib/amd64/libfrureg.so.1 0755 root bin
+s usr/lib/amd64/libfrureg.so=libfrureg.so.1
+f usr/lib/amd64/libfruutils.so.1 0755 root bin
+s usr/lib/amd64/libfruutils.so=libfruutils.so.1
+s usr/lib/amd64/libgen.so.1=../../../lib/amd64/libgen.so.1
+s usr/lib/amd64/libgen.so=../../../lib/amd64/libgen.so.1
+f usr/lib/amd64/libgss.so.1 0755 root bin
+s usr/lib/amd64/libgss.so=libgss.so.1
+f usr/lib/amd64/libhotplug.so.1 0755 root bin
+s usr/lib/amd64/libhotplug.so=libhotplug.so.1
+f usr/lib/amd64/libidmap.so.1 0755 root bin
+s usr/lib/amd64/libidmap.so=libidmap.so.1
+f usr/lib/amd64/libike.so.1 0755 root bin
+s usr/lib/amd64/libike.so=libike.so.1
+f usr/lib/amd64/libilb.so.1 0755 root bin
+s usr/lib/amd64/libilb.so=libilb.so.1
+f usr/lib/amd64/libima.so.1 0755 root bin
+s usr/lib/amd64/libima.so=libima.so.1
+s usr/lib/amd64/libinetutil.so.1=../../../lib/amd64/libinetutil.so.1
+s usr/lib/amd64/libinetutil.so=../../../lib/amd64/libinetutil.so.1
+s usr/lib/amd64/libintl.so.1=../../../lib/amd64/libintl.so.1
+s usr/lib/amd64/libintl.so=../../../lib/amd64/libintl.so.1
+f usr/lib/amd64/libipd.so.1 0755 root bin
+s usr/lib/amd64/libipd.so=libipd.so.1
+f usr/lib/amd64/libipmi.so.1 0755 root bin
+s usr/lib/amd64/libipmi.so=libipmi.so.1
+f usr/lib/amd64/libipp.so.1 0755 root bin
+s usr/lib/amd64/libipp.so=libipp.so.1
+f usr/lib/amd64/libipsecutil.so.1 0755 root bin
+s usr/lib/amd64/libipsecutil.so=libipsecutil.so.1
+f usr/lib/amd64/libiscsit.so.1 0755 root bin
+s usr/lib/amd64/libiscsit.so=libiscsit.so.1
+f usr/lib/amd64/libjdns_sd.so.1 0755 root bin
+s usr/lib/amd64/libjdns_sd.so=libjdns_sd.so.1
+s usr/lib/amd64/libkmfberder.so=../../../lib/amd64/libkmfberder.so.1
+s usr/lib/amd64/libkmfberder.so.1=../../../lib/amd64/libkmfberder.so.1
+f usr/lib/amd64/libkrb5.so.1 0755 root bin
+s usr/lib/amd64/libkrb5.so=libkrb5.so.1
+s usr/lib/amd64/libkstat.so.1=../../../lib/amd64/libkstat.so.1
+s usr/lib/amd64/libkstat.so=../../../lib/amd64/libkstat.so.1
+f usr/lib/amd64/libkvm.so.1 0755 root bin
+s usr/lib/amd64/libkvm.so=libkvm.so.1
+f usr/lib/amd64/libl.so.1 0755 root bin
+s usr/lib/amd64/libl.so=libl.so.1
+f usr/lib/amd64/libldap.so.5 0755 root bin
+s usr/lib/amd64/libldap.so=libldap.so.5
+s usr/lib/amd64/liblddbg.so.4=../../../lib/amd64/liblddbg.so.4
+f usr/lib/amd64/libldstab.so.1 0755 root bin
+f usr/lib/amd64/liblgrp.so.1 0755 root bin
+s usr/lib/amd64/liblgrp.so=liblgrp.so.1
+f usr/lib/amd64/liblm.so.1 0755 root bin
+s usr/lib/amd64/liblm.so=liblm.so.1
+f usr/lib/amd64/libmail.so.1 0755 root bin
+s usr/lib/amd64/libmail.so=libmail.so.1
+f usr/lib/amd64/libmalloc.so.1 0755 root bin
+s usr/lib/amd64/libmalloc.so=libmalloc.so.1
+f usr/lib/amd64/libmapmalloc.so.1 0755 root bin
+s usr/lib/amd64/libmapmalloc.so=libmapmalloc.so.1
+s usr/lib/amd64/libmd.so.1=../../../lib/amd64/libmd.so.1
+s usr/lib/amd64/libmd.so=../../../lib/amd64/libmd.so.1
+s usr/lib/amd64/libmd5.so.1=../../../lib/amd64/libmd5.so.1
+s usr/lib/amd64/libmd5.so=../../../lib/amd64/libmd5.so.1
+s usr/lib/amd64/libmech_krb5.so=gss/mech_krb5.so
+f usr/lib/amd64/libmenu.so.1 0755 root bin
+s usr/lib/amd64/libmenu.so=libmenu.so.1
+s usr/lib/amd64/libmp.so.2=../../../lib/amd64/libmp.so.2
+s usr/lib/amd64/libmp.so=../../../lib/amd64/libmp.so.2
+s usr/lib/amd64/libmpscsi_vhci.so=../../../lib/amd64/libmpscsi_vhci.so.1
+s usr/lib/amd64/libmpscsi_vhci.so.1=../../../lib/amd64/libmpscsi_vhci.so.1
+f usr/lib/amd64/libmtmalloc.so.1 0755 root bin
+s usr/lib/amd64/libmtmalloc.so=libmtmalloc.so.1
+f usr/lib/amd64/libndmp.so.1 0755 root bin
+s usr/lib/amd64/libndmp.so=libndmp.so.1
+f usr/lib/amd64/libnls.so.1 0755 root bin
+s usr/lib/amd64/libnls.so=libnls.so.1
+s usr/lib/amd64/libnsl.so.1=../../../lib/amd64/libnsl.so.1
+s usr/lib/amd64/libnsl.so=../../../lib/amd64/libnsl.so.1
+f usr/lib/amd64/libnvfru.so.1 0755 root bin
+s usr/lib/amd64/libnvfru.so=libnvfru.so.1
+s usr/lib/amd64/libnvpair.so.1=../../../lib/amd64/libnvpair.so.1
+s usr/lib/amd64/libnvpair.so=../../../lib/amd64/libnvpair.so.1
+s usr/lib/amd64/libpam.so.1=../../../lib/amd64/libpam.so.1
+s usr/lib/amd64/libpam.so=../../../lib/amd64/libpam.so.1
+f usr/lib/amd64/libpanel.so.1 0755 root bin
+s usr/lib/amd64/libpanel.so=libpanel.so.1
+f usr/lib/amd64/libpcidb.so.1 0755 root bin
+f usr/lib/amd64/libpctx.so.1 0755 root bin
+s usr/lib/amd64/libpctx.so=libpctx.so.1
+f usr/lib/amd64/libpicl.so.1 0755 root bin
+s usr/lib/amd64/libpicl.so=libpicl.so.1
+f usr/lib/amd64/libpkcs11.so.1 0755 root bin
+s usr/lib/amd64/libpkcs11.so=libpkcs11.so.1
+f usr/lib/amd64/libpool.so.1 0755 root bin
+s usr/lib/amd64/libpool.so=libpool.so.1
+s usr/lib/amd64/libposix4.so.1=../../../lib/amd64/librt.so.1
+s usr/lib/amd64/libposix4.so=../../../lib/amd64/librt.so.1
+s usr/lib/amd64/libproc.so.1=../../../lib/amd64/libproc.so.1
+s usr/lib/amd64/libproc.so=../../../lib/amd64/libproc.so.1
+f usr/lib/amd64/libproject.so.1 0755 root bin
+s usr/lib/amd64/libproject.so=libproject.so.1
+s usr/lib/amd64/libpthread.so.1=../../../lib/amd64/libpthread.so.1
+s usr/lib/amd64/libpthread.so=../../../lib/amd64/libpthread.so.1
+f usr/lib/amd64/libraidcfg.so.1 0755 root bin
+s usr/lib/amd64/libraidcfg.so=libraidcfg.so.1
+s usr/lib/amd64/librcm.so.1=../../../lib/amd64/librcm.so.1
+s usr/lib/amd64/librcm.so=../../../lib/amd64/librcm.so.1
+f usr/lib/amd64/libreparse.so.1 0755 root bin
+s usr/lib/amd64/libreparse.so=libreparse.so.1
+s usr/lib/amd64/libresolv.so.2=../../../lib/amd64/libresolv.so.2
+s usr/lib/amd64/libresolv.so=../../../lib/amd64/libresolv.so.2
+s usr/lib/amd64/libresolv_joy.so.2=../../../lib/amd64/libresolv_joy.so.2
+s usr/lib/amd64/librestart.so.1=../../../lib/amd64/librestart.so.1
+s usr/lib/amd64/librestart.so=../../../lib/amd64/librestart.so.1
+s usr/lib/amd64/librpcsvc.so.1=../../../lib/amd64/librpcsvc.so.1
+s usr/lib/amd64/librpcsvc.so=../../../lib/amd64/librpcsvc.so.1
+f usr/lib/amd64/librsm.so.2 0755 root bin
+s usr/lib/amd64/librsm.so=librsm.so.2
+s usr/lib/amd64/librt.so.1=../../../lib/amd64/librt.so.1
+s usr/lib/amd64/librt.so=../../../lib/amd64/librt.so.1
+s usr/lib/amd64/librtld.so.1=../../../lib/amd64/librtld.so.1
+s usr/lib/amd64/librtld_db.so.1=../../../lib/amd64/librtld_db.so.1
+s usr/lib/amd64/librtld_db.so=../../../lib/amd64/librtld_db.so.1
+f usr/lib/amd64/libsasl.so.1 0755 root bin
+s usr/lib/amd64/libsasl.so=libsasl.so.1
+f usr/lib/amd64/libsaveargs.so.1 0755 root bin
+s usr/lib/amd64/libsaveargs.so=libsaveargs.so.1
+s usr/lib/amd64/libscf.so.1=../../../lib/amd64/libscf.so.1
+s usr/lib/amd64/libscf.so=../../../lib/amd64/libscf.so.1
+f usr/lib/amd64/libsched.so.1 0755 root bin
+s usr/lib/amd64/libsched.so=libsched.so.1
+f usr/lib/amd64/libsctp.so.1 0755 root bin
+s usr/lib/amd64/libsctp.so=libsctp.so.1
+s usr/lib/amd64/libsec.so.1=../../../lib/amd64/libsec.so.1
+s usr/lib/amd64/libsec.so=../../../lib/amd64/libsec.so.1
+s usr/lib/amd64/libsecdb.so.1=../../../lib/amd64/libsecdb.so.1
+s usr/lib/amd64/libsecdb.so=../../../lib/amd64/libsecdb.so.1
+s usr/lib/amd64/libsendfile.so.1=../../../lib/amd64/libsendfile.so.1
+s usr/lib/amd64/libsendfile.so=../../../lib/amd64/libsendfile.so.1
+f usr/lib/amd64/libshare.so.1 0755 root bin
+s usr/lib/amd64/libshare.so=libshare.so.1
+f usr/lib/amd64/libshell.so.1 0755 root bin
+s usr/lib/amd64/libshell.so=libshell.so.1
+f usr/lib/amd64/libsip.so.1 0755 root bin
+s usr/lib/amd64/libsip.so=libsip.so.1
+f usr/lib/amd64/libsldap.so.1 0755 root bin
+s usr/lib/amd64/libsldap.so=libsldap.so.1
+f usr/lib/amd64/libslp.so.1 0755 root bin
+s usr/lib/amd64/libslp.so=libslp.so.1
+s usr/lib/amd64/libsmartsshd.so.1=../../../lib/amd64/libsmartsshd.so.1
+s usr/lib/amd64/libsmartsshd.so=../../../lib/amd64/libsmartsshd.so.1
+f usr/lib/amd64/libsmbfs.so.1 0755 root bin
+s usr/lib/amd64/libsmbfs.so=libsmbfs.so.1
+f usr/lib/amd64/libsmbios.so.1 0755 root bin
+s usr/lib/amd64/libsmbios.so=libsmbios.so.1
+f usr/lib/amd64/libsmedia.so.1 0755 root bin
+s usr/lib/amd64/libsmedia.so=libsmedia.so.1
+s usr/lib/amd64/libsocket.so.1=../../../lib/amd64/libsocket.so.1
+s usr/lib/amd64/libsocket.so=../../../lib/amd64/libsocket.so.1
+f usr/lib/amd64/libsoftcrypto.so.1 0755 root bin
+s usr/lib/amd64/libsoftcrypto.so=libsoftcrypto.so.1
+f usr/lib/amd64/libsrpt.so.1 0755 root bin
+s usr/lib/amd64/libsrpt.so=libsrpt.so.1
+f usr/lib/amd64/libstanddisasm.so 0644 root bin
+f usr/lib/amd64/libstmf.so.1 0755 root bin
+s usr/lib/amd64/libstmf.so=libstmf.so.1
+f usr/lib/amd64/libstmfproxy.so.1 0755 root bin
+s usr/lib/amd64/libstmfproxy.so=libstmfproxy.so.1
+f usr/lib/amd64/libsum.so.1 0755 root bin
+s usr/lib/amd64/libsum.so=libsum.so.1
+f usr/lib/amd64/libsun_fc.so.1 0755 root bin
+s usr/lib/amd64/libsun_fc.so=libsun_fc.so.1
+f usr/lib/amd64/libsun_ima.so.1 0755 root bin
+s usr/lib/amd64/libsun_ima.so=libsun_ima.so.1
+f usr/lib/amd64/libsun_sas.so.1 0755 root bin
+s usr/lib/amd64/libsun_sas.so=libsun_sas.so.1
+s usr/lib/amd64/libsysevent.so.1=../../../lib/amd64/libsysevent.so.1
+s usr/lib/amd64/libsysevent.so=../../../lib/amd64/libsysevent.so.1
+f usr/lib/amd64/libtecla.so.1 0755 root bin
+s usr/lib/amd64/libtecla.so=libtecla.so.1
+s usr/lib/amd64/libtermcap.so.1=../../../lib/amd64/libtermcap.so.1
+s usr/lib/amd64/libtermcap.so=../../../lib/amd64/libtermcap.so.1
+s usr/lib/amd64/libtermlib.so.1=../../../lib/amd64/libcurses.so.1
+s usr/lib/amd64/libtermlib.so=../../../lib/amd64/libcurses.so.1
+s usr/lib/amd64/libthread.so.1=../../../lib/amd64/libthread.so.1
+s usr/lib/amd64/libthread.so=../../../lib/amd64/libthread.so.1
+s usr/lib/amd64/libthread_db.so.1=../../../lib/amd64/libc_db.so.1
+s usr/lib/amd64/libthread_db.so=../../../lib/amd64/libc_db.so.1
+f usr/lib/amd64/libtnfctl.so.1 0755 root bin
+s usr/lib/amd64/libtnfctl.so=libtnfctl.so.1
+f usr/lib/amd64/libtnfprobe.so.1 0755 root bin
+s usr/lib/amd64/libtnfprobe.so=libtnfprobe.so.1
+s usr/lib/amd64/libtsnet.so=../../../lib/amd64/libtsnet.so.1
+s usr/lib/amd64/libtsnet.so.1=../../../lib/amd64/libtsnet.so.1
+s usr/lib/amd64/libtsol.so=../../../lib/amd64/libtsol.so.2
+s usr/lib/amd64/libtsol.so.2=../../../lib/amd64/libtsol.so.2
+s usr/lib/amd64/libumem.so.1=../../../lib/amd64/libumem.so.1
+s usr/lib/amd64/libumem.so=../../../lib/amd64/libumem.so.1
+s usr/lib/amd64/libumem_trampoline.so.1=../../../lib/amd64/libumem_trampoline.so.1
+s usr/lib/amd64/libumem_trampoline.so=../../../lib/amd64/libumem_trampoline.so.1
+s usr/lib/amd64/libuuid.so.1=../../../lib/amd64/libuuid.so.1
+s usr/lib/amd64/libuuid.so=../../../lib/amd64/libuuid.so.1
+s usr/lib/amd64/libuutil.so.1=../../../lib/amd64/libuutil.so.1
+s usr/lib/amd64/libuutil.so=../../../lib/amd64/libuutil.so.1
+f usr/lib/amd64/libvolmgt.so.1 0755 root bin
+s usr/lib/amd64/libvolmgt.so=libvolmgt.so.1
+f usr/lib/amd64/libvrrpadm.so.1 0755 root bin
+s usr/lib/amd64/libvrrpadm.so=libvrrpadm.so.1
+s usr/lib/amd64/libw.so.1=../../../lib/amd64/libw.so.1
+s usr/lib/amd64/libw.so=../../../lib/amd64/libw.so.1
+s usr/lib/amd64/libxnet.so.1=../../../lib/amd64/libxnet.so.1
+s usr/lib/amd64/libxnet.so=../../../lib/amd64/libxnet.so.1
+f usr/lib/amd64/liby.so.1 0755 root bin
+s usr/lib/amd64/liby.so=liby.so.1
+s usr/lib/amd64/libzdoor.so.1=../../../lib/amd64/libzdoor.so.1
+s usr/lib/amd64/libzdoor.so=../../../lib/amd64/libzdoor.so.1
+s usr/lib/amd64/libzfs.so.1=../../../lib/amd64/libzfs.so.1
+s usr/lib/amd64/libzfs.so=../../../lib/amd64/libzfs.so.1
+s usr/lib/amd64/libzfs_core.so=libzfs_core.so.1
+f usr/lib/amd64/libzfs_core.so.1 755 root bin
+f usr/lib/amd64/libzfs_jni.so.1 0755 root bin
+s usr/lib/amd64/libzfs_jni.so=libzfs_jni.so.1
+f usr/lib/amd64/libzonecfg.so.1 0755 root bin
+s usr/lib/amd64/libzonecfg.so=libzonecfg.so.1
+f usr/lib/amd64/libzpool.so.1 0755 root bin
+s usr/lib/amd64/libzpool.so=libzpool.so.1
+f usr/lib/amd64/madv.so.1 0755 root bin
+f usr/lib/amd64/mpss.so.1 0755 root bin
+f usr/lib/amd64/ncad_addr.so.1 0755 root bin
+s usr/lib/amd64/ncad_addr.so=ncad_addr.so.1
+f usr/lib/amd64/nss_ad.so.1 0755 root bin
+s usr/lib/amd64/nss_compat.so.1=../../../lib/amd64/nss_compat.so.1
+s usr/lib/amd64/nss_dns.so.1=../../../lib/amd64/nss_dns.so.1
+s usr/lib/amd64/nss_files.so.1=../../../lib/amd64/nss_files.so.1
+f usr/lib/amd64/nss_ldap.so.1 0755 root bin
+f usr/lib/amd64/nss_mdns.so.1 0755 root bin
+s usr/lib/amd64/nss_nis.so.1=../../../lib/amd64/nss_nis.so.1
+s usr/lib/amd64/nss_user.so.1=../../../lib/amd64/nss_user.so.1
+f usr/lib/amd64/passwdutil.so.1 0755 root bin
+d usr/lib/amd64/pkgconfig 0755 root other
+f usr/lib/amd64/rpcsec.so.1 0755 root bin
+s usr/lib/amd64/rpcsec.so=rpcsec.so.1
+f usr/lib/amd64/sngl_brand.so.1 0755 root bin
+f usr/lib/amd64/straddr.so.2 0755 root bin
+s usr/lib/amd64/straddr.so=straddr.so.2
+f usr/lib/amd64/udapl_tavor.so.1 0755 root bin
+f usr/lib/amd64/values-Xa.o 0644 root bin
+f usr/lib/amd64/values-Xc.o 0644 root bin
+f usr/lib/amd64/values-Xs.o 0644 root bin
+f usr/lib/amd64/values-Xt.o 0644 root bin
+f usr/lib/amd64/values-xpg4.o 0644 root bin
+f usr/lib/amd64/values-xpg6.o 0644 root bin
+f usr/lib/amd64/watchmalloc.so.1 0755 root bin
+d usr/lib/audit 0755 root bin
+f usr/lib/audit/audit_record_attr 0444 root bin
+d usr/lib/autofs 0755 root sys
+f usr/lib/autofs/automountd 0555 root bin
+d usr/lib/brand 0755 root bin
+d usr/lib/brand/shared 0755 root sys
+f usr/lib/brand/shared/common.ksh 0444 root bin
+f usr/lib/brand/shared/query 0755 root bin
+f usr/lib/brand/shared/uninstall.ksh 0444 root bin
+d usr/lib/brand/sngl 0755 root bin
+f usr/lib/brand/sngl/config.xml 0444 root bin
+f usr/lib/brand/sngl/ld.sys.config 0444 root bin
+f usr/lib/brand/sngl/ld.sys64.config 0444 root bin
+f usr/lib/brand/sngl/platform.xml 0444 root bin
+f usr/lib/brand/sngl/sinstall 0755 root bin
+f usr/lib/bridged 0555 root bin
+f usr/lib/calprog 0555 root bin
+d usr/lib/cfgadm 0755 root bin
+d usr/lib/cfgadm/amd64 0755 root bin
+f usr/lib/cfgadm/amd64/fp.so.1 0755 root bin
+s usr/lib/cfgadm/amd64/fp.so=fp.so.1
+f usr/lib/cfgadm/amd64/ib.so.1 0755 root bin
+s usr/lib/cfgadm/amd64/ib.so=ib.so.1
+f usr/lib/cfgadm/amd64/pci.so.1 0755 root bin
+s usr/lib/cfgadm/amd64/pci.so=pci.so.1
+f usr/lib/cfgadm/amd64/sata.so.1 0755 root bin
+s usr/lib/cfgadm/amd64/sata.so=sata.so.1
+f usr/lib/cfgadm/amd64/scsi.so.1 0755 root bin
+s usr/lib/cfgadm/amd64/scsi.so=scsi.so.1
+f usr/lib/cfgadm/amd64/shp.so.1 0755 root bin
+s usr/lib/cfgadm/amd64/shp.so=shp.so.1
+f usr/lib/cfgadm/amd64/usb.so.1 0755 root bin
+s usr/lib/cfgadm/amd64/usb.so=usb.so.1
+f usr/lib/cfgadm/fp.so.1 0755 root bin
+s usr/lib/cfgadm/fp.so=fp.so.1
+f usr/lib/cfgadm/ib.so.1 0755 root bin
+s usr/lib/cfgadm/ib.so=ib.so.1
+f usr/lib/cfgadm/pci.so.1 0755 root bin
+s usr/lib/cfgadm/pci.so=pci.so.1
+f usr/lib/cfgadm/sata.so.1 0755 root bin
+s usr/lib/cfgadm/sata.so=sata.so.1
+f usr/lib/cfgadm/scsi.so.1 0755 root bin
+s usr/lib/cfgadm/scsi.so=scsi.so.1
+f usr/lib/cfgadm/shp.so.1 0755 root bin
+s usr/lib/cfgadm/shp.so=shp.so.1
+f usr/lib/cfgadm/usb.so.1 0755 root bin
+s usr/lib/cfgadm/usb.so=usb.so.1
+d usr/lib/class 0755 root bin
+d usr/lib/class/FSS 0755 root bin
+f usr/lib/class/FSS/FSSdispadmin 0555 root bin
+f usr/lib/class/FSS/FSSpriocntl 0555 root bin
+d usr/lib/class/FX 0755 root bin
+f usr/lib/class/FX/FXdispadmin 0555 root bin
+f usr/lib/class/FX/FXpriocntl 0555 root bin
+d usr/lib/class/IA 0755 root bin
+f usr/lib/class/IA/IAdispadmin 0555 root bin
+f usr/lib/class/IA/IApriocntl 0555 root bin
+d usr/lib/class/RT 0755 root bin
+f usr/lib/class/RT/RTdispadmin 0555 root bin
+f usr/lib/class/RT/RTpriocntl 0555 root bin
+d usr/lib/class/SDC 0755 root bin
+f usr/lib/class/SDC/SDCdispadmin 0555 root bin
+f usr/lib/class/SDC/SDCpriocntl 0555 root bin
+d usr/lib/class/TS 0755 root bin
+f usr/lib/class/TS/TSdispadmin 0555 root bin
+f usr/lib/class/TS/TSpriocntl 0555 root bin
+s usr/lib/cron=../../etc/cron.d
+f usr/lib/crt1.o 0644 root bin
+f usr/lib/crti.o 0644 root bin
+f usr/lib/crtn.o 0644 root bin
+d usr/lib/crypto 0755 root bin
+f usr/lib/cryptpass 0555 root bin
+d usr/lib/devfsadm 0755 root sys
+s usr/lib/devfsadm/devfsadmd=../../sbin/devfsadm
+d usr/lib/devfsadm/linkmod 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_audio_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_cfg_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_dcam1394_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_disk_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_dtrace_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_fssnap_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_ieee1394_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_lofi_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_misc_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_misc_link_i386.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_port_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_ramdisk_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_sgen_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_smp_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_tape_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_usb_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_vscan_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_xen_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_zfs_link.so 0755 root sys
+f usr/lib/devfsadm/linkmod/SUNW_zut_link.so 0755 root sys
+f usr/lib/diff3prog 0555 root bin
+f usr/lib/diffh 0555 root bin
+f usr/lib/dscfglockd 0555 root bin
+d usr/lib/dtrace 0755 root bin
+d usr/lib/dtrace/64 0755 root bin
+f usr/lib/dtrace/64/libdtrace_forceload.so 0644 root bin
+f usr/lib/dtrace/64/drti.o 0644 root bin
+f usr/lib/dtrace/libdtrace_forceload.so 0644 root bin
+f usr/lib/dtrace/drti.o 0644 root bin
+f usr/lib/dtrace/errno.d 0644 root bin
+f usr/lib/dtrace/fc.d 0644 root bin
+f usr/lib/dtrace/io.d 0644 root bin
+f usr/lib/dtrace/ip.d 0644 root bin
+f usr/lib/dtrace/iscsit.d 0644 root bin
+f usr/lib/dtrace/net.d 0644 root bin
+f usr/lib/dtrace/nfs.d 0644 root bin
+f usr/lib/dtrace/procfs.d 0644 root bin
+f usr/lib/dtrace/regs.d 0644 root bin
+f usr/lib/dtrace/sched.d 0644 root bin
+f usr/lib/dtrace/scsi.d 0644 root bin
+f usr/lib/dtrace/signal.d 0644 root bin
+f usr/lib/dtrace/srp.d 0644 root bin
+f usr/lib/dtrace/sysevent.d 0644 root bin
+f usr/lib/dtrace/tcp.d 0644 root bin
+f usr/lib/dtrace/udp.d 0644 root bin
+f usr/lib/dtrace/unistd.d 0644 root bin
+d usr/lib/elfedit 0755 root bin
+s usr/lib/elfedit/32=.
+s usr/lib/elfedit/64=amd64
+d usr/lib/elfedit/amd64 0755 root bin
+f usr/lib/elfedit/amd64/cap.so 0755 root bin
+f usr/lib/elfedit/amd64/dyn.so 0755 root bin
+f usr/lib/elfedit/amd64/ehdr.so 0755 root bin
+f usr/lib/elfedit/amd64/phdr.so 0755 root bin
+f usr/lib/elfedit/amd64/shdr.so 0755 root bin
+f usr/lib/elfedit/amd64/str.so 0755 root bin
+f usr/lib/elfedit/amd64/sym.so 0755 root bin
+f usr/lib/elfedit/amd64/syminfo.so 0755 root bin
+f usr/lib/elfedit/cap.so 0755 root bin
+f usr/lib/elfedit/dyn.so 0755 root bin
+f usr/lib/elfedit/ehdr.so 0755 root bin
+f usr/lib/elfedit/phdr.so 0755 root bin
+f usr/lib/elfedit/shdr.so 0755 root bin
+f usr/lib/elfedit/str.so 0755 root bin
+f usr/lib/elfedit/sym.so 0755 root bin
+f usr/lib/elfedit/syminfo.so 0755 root bin
+s usr/lib/embedded_su=../bin/su
+f usr/lib/expreserve 0555 root bin
+f usr/lib/exrecover 0555 root bin
+f usr/lib/extendedFILE.so.1 0755 root bin
+d usr/lib/fm 0755 root bin
+d usr/lib/fm/amd64 0755 root bin
+f usr/lib/fm/amd64/libdiagcode.so.1 0755 root bin
+s usr/lib/fm/amd64/libdiagcode.so=libdiagcode.so.1
+f usr/lib/fm/amd64/libdiskstatus.so.1 0755 root bin
+s usr/lib/fm/amd64/libdiskstatus.so=libdiskstatus.so.1
+f usr/lib/fm/amd64/libfmd_adm.so.1 0755 root bin
+s usr/lib/fm/amd64/libfmd_adm.so=libfmd_adm.so.1
+f usr/lib/fm/amd64/libfmd_agent.so.1 0755 root bin
+s usr/lib/fm/amd64/libfmd_agent.so=libfmd_agent.so.1
+f usr/lib/fm/amd64/libfmd_log.so.1 0755 root bin
+s usr/lib/fm/amd64/libfmd_log.so=libfmd_log.so.1
+f usr/lib/fm/amd64/libfmd_msg.so.1 0755 root bin
+s usr/lib/fm/amd64/libfmd_msg.so=libfmd_msg.so.1
+s usr/lib/fm/amd64/libfmevent.so.1=../../../../lib/fm/amd64/libfmevent.so.1
+s usr/lib/fm/amd64/libfmevent.so=../../../../lib/fm/amd64/libfmevent.so.1
+f usr/lib/fm/amd64/libfmnotify.so.1 0755 root bin
+s usr/lib/fm/amd64/libfmnotify.so=libfmnotify.so.1
+f usr/lib/fm/amd64/libseslog.so.1 0755 root bin
+s usr/lib/fm/amd64/libseslog.so=libseslog.so.1
+f usr/lib/fm/amd64/libtopo.so.1 0755 root bin
+s usr/lib/fm/amd64/libtopo.so=libtopo.so.1
+f usr/lib/fm/buildcode 0555 root bin
+f usr/lib/fm/bustcode 0555 root bin
+d usr/lib/fm/dict 0755 root bin
+f usr/lib/fm/dict/AMD.dict 0444 root bin
+f usr/lib/fm/dict/DISK.dict 0444 root bin
+f usr/lib/fm/dict/FMD.dict 0444 root bin
+f usr/lib/fm/dict/FMNOTIFY.dict 0444 root bin
+f usr/lib/fm/dict/GMCA.dict 0444 root bin
+f usr/lib/fm/dict/INTEL.dict 0444 root bin
+f usr/lib/fm/dict/NXGE.dict 0444 root bin
+f usr/lib/fm/dict/PCI.dict 0444 root bin
+f usr/lib/fm/dict/PCIEX.dict 0444 root bin
+f usr/lib/fm/dict/SCA1000.dict 0444 root bin
+f usr/lib/fm/dict/SCA500.dict 0444 root bin
+f usr/lib/fm/dict/SENSOR.dict 0444 root bin
+f usr/lib/fm/dict/SMF.dict 0444 root bin
+f usr/lib/fm/dict/STORAGE.dict 0444 root bin
+f usr/lib/fm/dict/SUNOS.dict 0444 root bin
+f usr/lib/fm/dict/TEST.dict 0444 root bin
+f usr/lib/fm/dict/ZFS.dict 0444 root bin
+f usr/lib/fm/dictck 0555 root bin
+d usr/lib/fm/eft 0755 root bin
+f usr/lib/fm/eft/disk.eft 0444 root bin
+f usr/lib/fm/eft/neptune_xaui.eft 0444 root bin
+f usr/lib/fm/eft/neptune_xfp.eft 0444 root bin
+f usr/lib/fm/eft/pci.eft 0444 root bin
+f usr/lib/fm/eft/pciex.eft 0444 root bin
+f usr/lib/fm/eft/pciexrc.eft 0444 root bin
+f usr/lib/fm/eft/sca1000.eft 0444 root bin
+f usr/lib/fm/eft/sca500.eft 0444 root bin
+f usr/lib/fm/eft/sensor.eft 0444 root bin
+f usr/lib/fm/eft/storage.eft 0444 root bin
+f usr/lib/fm/eftinfo 0555 root bin
+f usr/lib/fm/esc 0555 root bin
+d usr/lib/fm/fmd 0755 root bin
+f usr/lib/fm/fmd/fmd 0555 root bin
+f usr/lib/fm/fmd/fminject 0555 root bin
+f usr/lib/fm/fmd/fmsim 0555 root bin
+f usr/lib/fm/fmd/fmtopo 0555 root bin
+f usr/lib/fm/fmd/ipmitopo 0555 root bin
+d usr/lib/fm/fmd/plugins 0755 root bin
+f usr/lib/fm/fmd/plugins/cpumem-retire.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/cpumem-retire.so 0555 root bin
+f usr/lib/fm/fmd/plugins/disk-lights.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/disk-lights.so 0555 root bin
+f usr/lib/fm/fmd/plugins/disk-monitor.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/disk-monitor.so 0555 root bin
+f usr/lib/fm/fmd/plugins/disk-transport.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/disk-transport.so 0555 root bin
+f usr/lib/fm/fmd/plugins/eft.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/eft.so 0555 root bin
+f usr/lib/fm/fmd/plugins/ext-event-transport.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/ext-event-transport.so 0555 root bin
+f usr/lib/fm/fmd/plugins/fabric-xlate.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/fabric-xlate.so 0555 root bin
+f usr/lib/fm/fmd/plugins/fdd-msg.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/fdd-msg.so 0555 root bin
+f usr/lib/fm/fmd/plugins/io-retire.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/io-retire.so 0555 root bin
+f usr/lib/fm/fmd/plugins/ip-transport.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/ip-transport.so 0555 root bin
+f usr/lib/fm/fmd/plugins/sensor-transport.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/sensor-transport.so 0555 root bin
+f usr/lib/fm/fmd/plugins/ses-log-transport.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/ses-log-transport.so 0555 root bin
+f usr/lib/fm/fmd/plugins/software-diagnosis.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/software-diagnosis.so 0555 root bin
+f usr/lib/fm/fmd/plugins/software-response.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/software-response.so 0555 root bin
+f usr/lib/fm/fmd/plugins/sp-monitor.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/sp-monitor.so 0555 root bin
+f usr/lib/fm/fmd/plugins/syslog-msgs.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/syslog-msgs.so 0555 root bin
+f usr/lib/fm/fmd/plugins/zfs-diagnosis.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/zfs-diagnosis.so 0555 root bin
+f usr/lib/fm/fmd/plugins/zfs-retire.conf 0644 root bin
+f usr/lib/fm/fmd/plugins/zfs-retire.so 0555 root bin
+d usr/lib/fm/fmd/schemes 0755 root bin
+d usr/lib/fm/fmd/schemes/amd64 0755 root bin
+f usr/lib/fm/fmd/schemes/amd64/cpu.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/dev.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/fmd.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/hc.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/legacy-hc.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/mem.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/mod.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/pkg.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/svc.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/sw.so 0555 root bin
+f usr/lib/fm/fmd/schemes/amd64/zfs.so 0555 root bin
+f usr/lib/fm/fmd/schemes/cpu.so 0555 root bin
+f usr/lib/fm/fmd/schemes/dev.so 0555 root bin
+f usr/lib/fm/fmd/schemes/fmd.so 0555 root bin
+f usr/lib/fm/fmd/schemes/hc.so 0555 root bin
+f usr/lib/fm/fmd/schemes/legacy-hc.so 0555 root bin
+f usr/lib/fm/fmd/schemes/mem.so 0555 root bin
+f usr/lib/fm/fmd/schemes/mod.so 0555 root bin
+f usr/lib/fm/fmd/schemes/pkg.so 0555 root bin
+f usr/lib/fm/fmd/schemes/svc.so 0555 root bin
+f usr/lib/fm/fmd/schemes/sw.so 0555 root bin
+f usr/lib/fm/fmd/schemes/zfs.so 0555 root bin
+f usr/lib/fm/libdiagcode.so.1 0755 root bin
+s usr/lib/fm/libdiagcode.so=libdiagcode.so.1
+f usr/lib/fm/libdiskstatus.so.1 0755 root bin
+s usr/lib/fm/libdiskstatus.so=libdiskstatus.so.1
+f usr/lib/fm/libfmd_adm.so.1 0755 root bin
+s usr/lib/fm/libfmd_adm.so=libfmd_adm.so.1
+f usr/lib/fm/libfmd_agent.so.1 0755 root bin
+s usr/lib/fm/libfmd_agent.so=libfmd_agent.so.1
+f usr/lib/fm/libfmd_log.so.1 0755 root bin
+s usr/lib/fm/libfmd_log.so=libfmd_log.so.1
+f usr/lib/fm/libfmd_msg.so.1 0755 root bin
+s usr/lib/fm/libfmd_msg.so=libfmd_msg.so.1
+s usr/lib/fm/libfmevent.so.1=../../../lib/fm/libfmevent.so.1
+s usr/lib/fm/libfmevent.so=../../../lib/fm/libfmevent.so.1
+f usr/lib/fm/libfmnotify.so.1 0755 root bin
+s usr/lib/fm/libfmnotify.so=libfmnotify.so.1
+f usr/lib/fm/libseslog.so.1 0755 root bin
+s usr/lib/fm/libseslog.so=libseslog.so.1
+f usr/lib/fm/libtopo.so.1 0755 root bin
+s usr/lib/fm/libtopo.so=libtopo.so.1
+d usr/lib/fm/notify 0755 root bin
+f usr/lib/fm/notify/process_msg_template.sh 0555 root bin
+f usr/lib/fm/notify/smtp-notify 0555 root bin
+d usr/lib/fm/topo 0755 root bin
+d usr/lib/fm/topo/maps 0755 root bin
+f usr/lib/fm/topo/maps/xfp-hc-topology.xml 0444 root bin
+d usr/lib/fm/topo/plugins 0755 root bin
+f usr/lib/fm/topo/plugins/disk.so 0555 root bin
+f usr/lib/fm/topo/plugins/fac_prov_ipmi.so 0555 root bin
+f usr/lib/fm/topo/plugins/fac_prov_mptsas.so 0555 root bin
+f usr/lib/fm/topo/plugins/ipmi.so 0555 root bin
+f usr/lib/fm/topo/plugins/ses.so 0555 root bin
+f usr/lib/fm/topo/plugins/xfp.so 0555 root bin
+d usr/lib/fs 0755 root sys
+d usr/lib/fs/autofs 0755 root sys
+d usr/lib/fs/autofs/amd64 0755 root sys
+f usr/lib/fs/autofs/amd64/libshare_autofs.so.1 0755 root bin
+s usr/lib/fs/autofs/amd64/libshare_autofs.so=libshare_autofs.so.1
+f usr/lib/fs/autofs/automount 0555 root bin
+f usr/lib/fs/autofs/dfshares 0555 root bin
+f usr/lib/fs/autofs/libshare_autofs.so.1 0755 root bin
+s usr/lib/fs/autofs/libshare_autofs.so=libshare_autofs.so.1
+f usr/lib/fs/autofs/mount 0555 root bin
+f usr/lib/fs/autofs/share 0555 root bin
+f usr/lib/fs/autofs/unshare 0555 root bin
+d usr/lib/fs/ctfs 0755 root sys
+f usr/lib/fs/ctfs/mount 0555 root bin
+d usr/lib/fs/dev 0755 root sys
+s usr/lib/fs/dev/mount=../../../../etc/fs/dev/mount
+d usr/lib/fs/fd 0755 root sys
+f usr/lib/fs/fd/mount 0555 root bin
+d usr/lib/fs/hsfs 0755 root sys
+f usr/lib/fs/hsfs/fstyp.so.1 0555 root bin
+h usr/lib/fs/hsfs/fstyp=usr/sbin/fstyp
+f usr/lib/fs/hsfs/labelit 0555 root bin
+s usr/lib/fs/hsfs/mount=../../../../etc/fs/hsfs/mount
+d usr/lib/fs/hyprlofs 0755 root sys
+f usr/lib/fs/hyprlofs/hlcfg 0555 root bin
+f usr/lib/fs/hyprlofs/mount 0555 root bin
+d usr/lib/fs/lofs 0755 root sys
+f usr/lib/fs/lofs/mount 0555 root bin
+d usr/lib/fs/lxproc 0755 root sys
+f usr/lib/fs/lxproc/mount 0555 root bin
+d usr/lib/fs/mntfs 0755 root sys
+f usr/lib/fs/mntfs/mount 0555 root bin
+d usr/lib/fs/nfs 0755 root sys
+d usr/lib/fs/nfs/amd64 0755 root sys
+f usr/lib/fs/nfs/amd64/libshare_nfs.so.1 0755 root sys
+s usr/lib/fs/nfs/amd64/libshare_nfs.so=libshare_nfs.so.1
+f usr/lib/fs/nfs/dfmounts 0555 root bin
+h usr/lib/fs/nfs/dfshares=usr/lib/fs/nfs/dfmounts
+f usr/lib/fs/nfs/libshare_nfs.so.1 0755 root sys
+s usr/lib/fs/nfs/libshare_nfs.so=libshare_nfs.so.1
+s usr/lib/fs/nfs/mount=../../../../etc/fs/nfs/mount
+f usr/lib/fs/nfs/nfsfind 0555 root sys
+f usr/lib/fs/nfs/showmount 0555 root bin
+f usr/lib/fs/nfs/umount 0555 root bin
+d usr/lib/fs/objfs 0755 root sys
+f usr/lib/fs/objfs/mount 0555 root bin
+d usr/lib/fs/pcfs 0755 root sys
+f usr/lib/fs/pcfs/fsck 0555 root bin
+f usr/lib/fs/pcfs/fstyp.so.1 0555 root bin
+h usr/lib/fs/pcfs/fstyp=usr/sbin/fstyp
+f usr/lib/fs/pcfs/mkfs 0555 root bin
+f usr/lib/fs/pcfs/mount 0555 root bin
+d usr/lib/fs/proc 0755 root sys
+f usr/lib/fs/proc/mount 0555 root bin
+d usr/lib/fs/sharefs 0755 root sys
+f usr/lib/fs/sharefs/mount 0555 root bin
+d usr/lib/fs/smb 0755 root sys
+d usr/lib/fs/smb/amd64 0755 root sys
+f usr/lib/fs/smb/amd64/libshare_smb.so.1 0755 root sys
+f usr/lib/fs/smb/libshare_smb.so.1 0755 root sys
+d usr/lib/fs/smbfs 0755 root sys
+d usr/lib/fs/smbfs/amd64 0755 root sys
+f usr/lib/fs/smbfs/amd64/libshare_smbfs.so.1 0755 root sys
+s usr/lib/fs/smbfs/amd64/libshare_smbfs.so=libshare_smbfs.so.1
+f usr/lib/fs/smbfs/dfshares 0555 root bin
+f usr/lib/fs/smbfs/libshare_smbfs.so.1 0755 root sys
+s usr/lib/fs/smbfs/libshare_smbfs.so=libshare_smbfs.so.1
+f usr/lib/fs/smbfs/mount 0555 root bin
+f usr/lib/fs/smbfs/share 0555 root bin
+f usr/lib/fs/smbfs/umount 0555 root bin
+f usr/lib/fs/smbfs/unshare 0555 root bin
+d usr/lib/fs/tmpfs 0755 root sys
+f usr/lib/fs/tmpfs/mount 0555 root bin
+d usr/lib/fs/ufs 0755 root sys
+f usr/lib/fs/ufs/clri 0555 root bin
+f usr/lib/fs/ufs/dcopy 0555 root bin
+f usr/lib/fs/ufs/df 0555 root bin
+f usr/lib/fs/ufs/edquota 0555 root bin
+f usr/lib/fs/ufs/ff 0555 root bin
+f usr/lib/fs/ufs/fsck 0555 root bin
+f usr/lib/fs/ufs/fsckall 0555 root bin
+f usr/lib/fs/ufs/fsdb 0555 root bin
+f usr/lib/fs/ufs/fsirand 0555 root bin
+f usr/lib/fs/ufs/fssnap 0555 root bin
+f usr/lib/fs/ufs/fstyp.so.1 0555 root bin
+h usr/lib/fs/ufs/fstyp=usr/sbin/fstyp
+f usr/lib/fs/ufs/labelit 0555 root bin
+f usr/lib/fs/ufs/lockfs 0555 root bin
+f usr/lib/fs/ufs/mboot 0444 root sys
+f usr/lib/fs/ufs/mkfs 0555 root bin
+s usr/lib/fs/ufs/mount=../../../../etc/fs/ufs/mount
+f usr/lib/fs/ufs/ncheck 0555 root bin
+f usr/lib/fs/ufs/newfs 0555 root bin
+f usr/lib/fs/ufs/quot 0555 root bin
+f usr/lib/fs/ufs/quota 4555 root bin
+f usr/lib/fs/ufs/quotacheck 0555 root bin
+f usr/lib/fs/ufs/quotaoff 0555 root bin
+f usr/lib/fs/ufs/quotaon 0555 root bin
+f usr/lib/fs/ufs/repquota 0555 root bin
+f usr/lib/fs/ufs/tunefs 0555 root bin
+f usr/lib/fs/ufs/ufsdump 4555 root bin
+f usr/lib/fs/ufs/ufsrestore 4555 root bin
+f usr/lib/fs/ufs/volcopy 0555 root bin
+d usr/lib/fs/zfs 0755 root sys
+f usr/lib/fs/zfs/bootinstall 0555 root bin
+f usr/lib/fs/zfs/fstyp.so.1 0555 root bin
+h usr/lib/fs/zfs/fstyp=usr/sbin/fstyp
+s usr/lib/fs/zfs/mount=../../../../sbin/zfs
+s usr/lib/fs/zfs/umount=../../../../sbin/zfs
+d usr/lib/fwflash 0755 root bin
+d usr/lib/fwflash/identify 0755 root bin
+f usr/lib/fwflash/identify/hermon.so 0755 root bin
+f usr/lib/fwflash/identify/sd.so 0755 root bin
+f usr/lib/fwflash/identify/ses.so 0755 root bin
+s usr/lib/fwflash/identify/sgen.so=ses.so
+f usr/lib/fwflash/identify/tavor.so 0755 root bin
+d usr/lib/fwflash/verify 0755 root bin
+f usr/lib/fwflash/verify/hermon-MELLANOX.so 0755 root bin
+f usr/lib/fwflash/verify/sd-GENERIC.so 0755 root bin
+s usr/lib/fwflash/verify/ses-LSILOGIC.so=ses-SUN.so
+f usr/lib/fwflash/verify/ses-SUN.so 0755 root bin
+s usr/lib/fwflash/verify/sgen-LSILOGIC.so=ses-SUN.so
+s usr/lib/fwflash/verify/sgen-SUN.so=ses-SUN.so
+f usr/lib/fwflash/verify/tavor-MELLANOX.so 0755 root bin
+f usr/lib/gcrt1.o 0644 root bin
+f usr/lib/getNAME 0555 root bin
+f usr/lib/getoptcvt 0555 root bin
+f usr/lib/gmsgfmt 0555 root bin
+d usr/lib/gss 0755 root bin
+f usr/lib/gss/dh1024-0.so.1 0755 root bin
+s usr/lib/gss/dh1024-0.so=dh1024-0.so.1
+f usr/lib/gss/dh640-0.so.1 0755 root bin
+s usr/lib/gss/dh640-0.so=dh640-0.so.1
+f usr/lib/gss/gsscred_clean 0744 root sys
+f usr/lib/gss/gssd 0555 root bin
+s usr/lib/gss/libmech_krb5.so=mech_krb5.so.1
+f usr/lib/gss/mech_dh.so.1 0755 root bin
+s usr/lib/gss/mech_dh.so=mech_dh.so.1
+f usr/lib/gss/mech_krb5.so.1 0755 root bin
+s usr/lib/gss/mech_krb5.so=mech_krb5.so.1
+f usr/lib/gss/mech_spnego.so.1 0755 root bin
+d usr/lib/help 0755 root bin
+d usr/lib/help/auths 0755 root bin
+d usr/lib/help/auths/locale 0755 root bin
+f usr/lib/help/auths/locale/AllSolAuthsHeader.html 0444 root bin
+f usr/lib/help/auths/locale/AuditHeader.html 0444 root bin
+f usr/lib/help/auths/locale/AuthJobsAdmin.html 0444 root bin
+f usr/lib/help/auths/locale/AuthJobsUser.html 0444 root bin
+f usr/lib/help/auths/locale/AuthProfmgrAssign.html 0444 root bin
+f usr/lib/help/auths/locale/AuthProfmgrDelegate.html 0444 root bin
+f usr/lib/help/auths/locale/AuthProfmgrExecattrWrite.html 0444 root bin
+f usr/lib/help/auths/locale/AuthProfmgrRead.html 0444 root bin
+f usr/lib/help/auths/locale/AuthProfmgrWrite.html 0444 root bin
+f usr/lib/help/auths/locale/AuthReadNDMP.html 0444 root bin
+f usr/lib/help/auths/locale/AuthReadSMB.html 0444 root bin
+f usr/lib/help/auths/locale/AuthRoleAssign.html 0444 root bin
+f usr/lib/help/auths/locale/AuthRoleDelegate.html 0444 root bin
+f usr/lib/help/auths/locale/AuthRoleWrite.html 0444 root bin
+f usr/lib/help/auths/locale/BindStates.html 0444 root bin
+d usr/lib/help/auths/locale/C 0755 root bin
+f usr/lib/help/auths/locale/C/AllSolAuthsHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuditHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthJobsAdmin.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthJobsUser.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthProfmgrAssign.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthProfmgrDelegate.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthProfmgrExecattrWrite.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthProfmgrRead.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthProfmgrWrite.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthReadNDMP.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthReadSMB.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthRoleAssign.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthRoleDelegate.html 0444 root bin
+f usr/lib/help/auths/locale/C/AuthRoleWrite.html 0444 root bin
+f usr/lib/help/auths/locale/C/BindStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/DevAllocHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/DevAllocate.html 0444 root bin
+f usr/lib/help/auths/locale/C/DevCDRW.html 0444 root bin
+f usr/lib/help/auths/locale/C/DevConfig.html 0444 root bin
+f usr/lib/help/auths/locale/C/DevGrant.html 0444 root bin
+f usr/lib/help/auths/locale/C/DevRevoke.html 0444 root bin
+f usr/lib/help/auths/locale/C/DhcpmgrHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/DhcpmgrWrite.html 0444 root bin
+f usr/lib/help/auths/locale/C/FileChown.html 0444 root bin
+f usr/lib/help/auths/locale/C/FileHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/FileOwner.html 0444 root bin
+f usr/lib/help/auths/locale/C/HotplugHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/HotplugModify.html 0444 root bin
+f usr/lib/help/auths/locale/C/IdmapRules.html 0444 root bin
+f usr/lib/help/auths/locale/C/JobHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/JobsGrant.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelFileDowngrade.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelFileUpgrade.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelPrint.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelRange.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelServer.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelWinDowngrade.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelWinNoView.html 0444 root bin
+f usr/lib/help/auths/locale/C/LabelWinUpgrade.html 0444 root bin
+f usr/lib/help/auths/locale/C/LinkSecurity.html 0444 root bin
+f usr/lib/help/auths/locale/C/LoginEnable.html 0444 root bin
+f usr/lib/help/auths/locale/C/LoginHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/LoginRemote.html 0444 root bin
+f usr/lib/help/auths/locale/C/MailHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/MailQueue.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkAutoconfRead.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkAutoconfSelect.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkAutoconfWlan.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkAutoconfWrite.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkILBconf.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkILBenable.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkInterfaceConfig.html 0444 root bin
+f usr/lib/help/auths/locale/C/NetworkVRRP.html 0444 root bin
+f usr/lib/help/auths/locale/C/PriAdmin.html 0444 root bin
+f usr/lib/help/auths/locale/C/PrintAdmin.html 0444 root bin
+f usr/lib/help/auths/locale/C/PrintCancel.html 0444 root bin
+f usr/lib/help/auths/locale/C/PrintHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/PrintList.html 0444 root bin
+f usr/lib/help/auths/locale/C/PrintNoBanner.html 0444 root bin
+f usr/lib/help/auths/locale/C/PrintPs.html 0444 root bin
+f usr/lib/help/auths/locale/C/PrintUnlabeled.html 0444 root bin
+f usr/lib/help/auths/locale/C/ProfmgrHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/RoleHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfAllocate.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfAutofsStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfCoreadmStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfCronStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfExAcctFlowStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfExAcctNetStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfExAcctProcessStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfExAcctTaskStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfILBStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfIPsecStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfIdmapStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfInetdStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfLocationStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfMDNSStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfManageAudit.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfManageHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfManageHotplug.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfManageZFSSnap.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfModifyAppl.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfModifyDepend.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfModifyFramework.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfModifyHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfModifyMethod.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfNADDStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfNDMPStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfNWAMStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfNscdStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfPowerStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfReparseStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfRoutingStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfSMBFSStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfSMBStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfSendmailStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfSshStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfSyslogStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfVRRPStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueAudit.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueCoreadm.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueExAcctFlow.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueExAcctNet.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueExAcctProcess.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueExAcctTask.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueFirewall.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueIPsec.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueIdmap.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueInetd.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueMDNS.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueNADD.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueNDMP.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueNWAM.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueRouting.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueSMB.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueVscan.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfValueVt.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfVscanStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfVtStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SmfWpaStates.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysCpuPowerMgmt.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysDate.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysMaintenance.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysPowerMgmtBrightness.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysPowerMgmtHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysPowerMgmtSuspend.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysPowerMgmtSuspendtoDisk.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysPowerMgmtSuspendtoRAM.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysShutdown.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysSyseventRead.html 0444 root bin
+f usr/lib/help/auths/locale/C/SysSyseventWrite.html 0444 root bin
+f usr/lib/help/auths/locale/C/TNDaemon.html 0444 root bin
+f usr/lib/help/auths/locale/C/TNctl.html 0444 root bin
+f usr/lib/help/auths/locale/C/ValueTND.html 0444 root bin
+f usr/lib/help/auths/locale/C/WifiConfig.html 0444 root bin
+f usr/lib/help/auths/locale/C/WifiWep.html 0444 root bin
+f usr/lib/help/auths/locale/C/ZoneCloneFrom.html 0444 root bin
+f usr/lib/help/auths/locale/C/ZoneHeader.html 0444 root bin
+f usr/lib/help/auths/locale/C/ZoneLogin.html 0444 root bin
+f usr/lib/help/auths/locale/C/ZoneManage.html 0444 root bin
+f usr/lib/help/auths/locale/DevAllocHeader.html 0444 root bin
+f usr/lib/help/auths/locale/DevAllocate.html 0444 root bin
+f usr/lib/help/auths/locale/DevCDRW.html 0444 root bin
+f usr/lib/help/auths/locale/DevConfig.html 0444 root bin
+f usr/lib/help/auths/locale/DevGrant.html 0444 root bin
+f usr/lib/help/auths/locale/DevRevoke.html 0444 root bin
+f usr/lib/help/auths/locale/DhcpmgrHeader.html 0444 root bin
+f usr/lib/help/auths/locale/DhcpmgrWrite.html 0444 root bin
+f usr/lib/help/auths/locale/FileChown.html 0444 root bin
+f usr/lib/help/auths/locale/FileHeader.html 0444 root bin
+f usr/lib/help/auths/locale/FileOwner.html 0444 root bin
+f usr/lib/help/auths/locale/HotplugHeader.html 0444 root bin
+f usr/lib/help/auths/locale/HotplugModify.html 0444 root bin
+f usr/lib/help/auths/locale/IdmapRules.html 0444 root bin
+f usr/lib/help/auths/locale/JobHeader.html 0444 root bin
+f usr/lib/help/auths/locale/JobsGrant.html 0444 root bin
+f usr/lib/help/auths/locale/LabelFileDowngrade.html 0444 root bin
+f usr/lib/help/auths/locale/LabelFileUpgrade.html 0444 root bin
+f usr/lib/help/auths/locale/LabelHeader.html 0444 root bin
+f usr/lib/help/auths/locale/LabelPrint.html 0444 root bin
+f usr/lib/help/auths/locale/LabelRange.html 0444 root bin
+f usr/lib/help/auths/locale/LabelServer.html 0444 root bin
+f usr/lib/help/auths/locale/LabelWinDowngrade.html 0444 root bin
+f usr/lib/help/auths/locale/LabelWinNoView.html 0444 root bin
+f usr/lib/help/auths/locale/LabelWinUpgrade.html 0444 root bin
+f usr/lib/help/auths/locale/LinkSecurity.html 0444 root bin
+f usr/lib/help/auths/locale/LoginEnable.html 0444 root bin
+f usr/lib/help/auths/locale/LoginHeader.html 0444 root bin
+f usr/lib/help/auths/locale/LoginRemote.html 0444 root bin
+f usr/lib/help/auths/locale/MailHeader.html 0444 root bin
+f usr/lib/help/auths/locale/MailQueue.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkAutoconfRead.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkAutoconfSelect.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkAutoconfWlan.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkAutoconfWrite.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkHeader.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkILBconf.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkILBenable.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkInterfaceConfig.html 0444 root bin
+f usr/lib/help/auths/locale/NetworkVRRP.html 0444 root bin
+f usr/lib/help/auths/locale/PriAdmin.html 0444 root bin
+f usr/lib/help/auths/locale/PrintAdmin.html 0444 root bin
+f usr/lib/help/auths/locale/PrintCancel.html 0444 root bin
+f usr/lib/help/auths/locale/PrintHeader.html 0444 root bin
+f usr/lib/help/auths/locale/PrintList.html 0444 root bin
+f usr/lib/help/auths/locale/PrintNoBanner.html 0444 root bin
+f usr/lib/help/auths/locale/PrintPs.html 0444 root bin
+f usr/lib/help/auths/locale/PrintUnlabeled.html 0444 root bin
+f usr/lib/help/auths/locale/ProfmgrHeader.html 0444 root bin
+f usr/lib/help/auths/locale/RoleHeader.html 0444 root bin
+f usr/lib/help/auths/locale/SmfAllocate.html 0444 root bin
+f usr/lib/help/auths/locale/SmfAutofsStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfCoreadmStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfCronStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfExAcctFlowStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfExAcctNetStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfExAcctProcessStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfExAcctTaskStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfHeader.html 0444 root bin
+f usr/lib/help/auths/locale/SmfILBStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfIPsecStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfIdmapStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfInetdStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfLocationStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfMDNSStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfManageAudit.html 0444 root bin
+f usr/lib/help/auths/locale/SmfManageHeader.html 0444 root bin
+f usr/lib/help/auths/locale/SmfManageHotplug.html 0444 root bin
+f usr/lib/help/auths/locale/SmfManageZFSSnap.html 0444 root bin
+f usr/lib/help/auths/locale/SmfModifyAppl.html 0444 root bin
+f usr/lib/help/auths/locale/SmfModifyDepend.html 0444 root bin
+f usr/lib/help/auths/locale/SmfModifyFramework.html 0444 root bin
+f usr/lib/help/auths/locale/SmfModifyHeader.html 0444 root bin
+f usr/lib/help/auths/locale/SmfModifyMethod.html 0444 root bin
+f usr/lib/help/auths/locale/SmfNADDStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfNDMPStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfNWAMStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfNscdStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfPowerStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfReparseStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfRoutingStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfSMBFSStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfSMBStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfSendmailStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfSshStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfSyslogStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfVRRPStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueAudit.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueCoreadm.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueExAcctFlow.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueExAcctNet.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueExAcctProcess.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueExAcctTask.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueFirewall.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueHeader.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueIPsec.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueIdmap.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueInetd.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueMDNS.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueNADD.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueNDMP.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueNWAM.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueRouting.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueSMB.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueVscan.html 0444 root bin
+f usr/lib/help/auths/locale/SmfValueVt.html 0444 root bin
+f usr/lib/help/auths/locale/SmfVscanStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfVtStates.html 0444 root bin
+f usr/lib/help/auths/locale/SmfWpaStates.html 0444 root bin
+f usr/lib/help/auths/locale/SysCpuPowerMgmt.html 0444 root bin
+f usr/lib/help/auths/locale/SysDate.html 0444 root bin
+f usr/lib/help/auths/locale/SysHeader.html 0444 root bin
+f usr/lib/help/auths/locale/SysMaintenance.html 0444 root bin
+f usr/lib/help/auths/locale/SysPowerMgmtBrightness.html 0444 root bin
+f usr/lib/help/auths/locale/SysPowerMgmtHeader.html 0444 root bin
+f usr/lib/help/auths/locale/SysPowerMgmtSuspend.html 0444 root bin
+f usr/lib/help/auths/locale/SysPowerMgmtSuspendtoDisk.html 0444 root bin
+f usr/lib/help/auths/locale/SysPowerMgmtSuspendtoRAM.html 0444 root bin
+f usr/lib/help/auths/locale/SysShutdown.html 0444 root bin
+f usr/lib/help/auths/locale/SysSyseventRead.html 0444 root bin
+f usr/lib/help/auths/locale/SysSyseventWrite.html 0444 root bin
+f usr/lib/help/auths/locale/TNDaemon.html 0444 root bin
+f usr/lib/help/auths/locale/TNctl.html 0444 root bin
+f usr/lib/help/auths/locale/ValueTND.html 0444 root bin
+f usr/lib/help/auths/locale/WifiConfig.html 0444 root bin
+f usr/lib/help/auths/locale/WifiWep.html 0444 root bin
+f usr/lib/help/auths/locale/ZoneCloneFrom.html 0444 root bin
+f usr/lib/help/auths/locale/ZoneHeader.html 0444 root bin
+f usr/lib/help/auths/locale/ZoneLogin.html 0444 root bin
+f usr/lib/help/auths/locale/ZoneManage.html 0444 root bin
+d usr/lib/help/profiles 0755 root bin
+d usr/lib/help/profiles/locale 0755 root bin
+d usr/lib/help/profiles/locale/C 0755 root bin
+f usr/lib/help/profiles/locale/C/RtAcctadm.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtAll.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtAuditCfg.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtAuditCtrl.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtAuditReview.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtCPUPowerManagement.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtConsUser.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtContractObserver.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtCronMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtCryptoMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtDHCPMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtDatAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtDefault.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtDeviceMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtDeviceSecurity.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtExAcctFlow.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtExAcctNet.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtExAcctProcess.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtExAcctTask.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtFTPMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtFileSysMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtFileSysSecurity.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtHotplugMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtIPFilterMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtIdmapMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtIdmapNameRulesMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtInetdMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtInfoSec.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtKerberosClntMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtKerberosSrvrMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtLogMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtMailMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtMaintAndRepair.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtMediaBkup.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtMediaCtlg.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtMediaRestore.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNDMPMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNameServiceAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNameServiceSecure.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetAutoconfAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetAutoconfUser.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetILB.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetIPsec.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetLinkSecure.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetObservability.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetSecure.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetVRRP.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetWifiMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtNetWifiSecure.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtObAccessMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtObjectLabelMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtOperator.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtOutsideAccred.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtPriAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtPrntAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtProcManagement.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtReparseMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtReservedProfile.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtRightsDelegate.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSMBFSMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSMBMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSoftwareInstall.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSysAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSysEvMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSysPowerMgmt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSysPowerMgmtBrightness.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSysPowerMgmtSuspend.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSysPowerMgmtSuspendtoDisk.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtSysPowerMgmtSuspendtoRAM.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtUserMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtUserSecurity.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtVscanMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtZFSFileSysMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtZFSStorageMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtZoneMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/C/RtZoneSecurity.html 0444 root bin
+f usr/lib/help/profiles/locale/RtAcctadm.html 0444 root bin
+f usr/lib/help/profiles/locale/RtAll.html 0444 root bin
+f usr/lib/help/profiles/locale/RtAuditCfg.html 0444 root bin
+f usr/lib/help/profiles/locale/RtAuditCtrl.html 0444 root bin
+f usr/lib/help/profiles/locale/RtAuditReview.html 0444 root bin
+f usr/lib/help/profiles/locale/RtCPUPowerManagement.html 0444 root bin
+f usr/lib/help/profiles/locale/RtConsUser.html 0444 root bin
+f usr/lib/help/profiles/locale/RtContractObserver.html 0444 root bin
+f usr/lib/help/profiles/locale/RtCronMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtCryptoMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtDHCPMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtDatAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/RtDefault.html 0444 root bin
+f usr/lib/help/profiles/locale/RtDeviceMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtDeviceSecurity.html 0444 root bin
+f usr/lib/help/profiles/locale/RtExAcctFlow.html 0444 root bin
+f usr/lib/help/profiles/locale/RtExAcctNet.html 0444 root bin
+f usr/lib/help/profiles/locale/RtExAcctProcess.html 0444 root bin
+f usr/lib/help/profiles/locale/RtExAcctTask.html 0444 root bin
+f usr/lib/help/profiles/locale/RtFTPMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtFileSysMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtFileSysSecurity.html 0444 root bin
+f usr/lib/help/profiles/locale/RtHotplugMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtIPFilterMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtIdmapMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtIdmapNameRulesMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtInetdMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtInfoSec.html 0444 root bin
+f usr/lib/help/profiles/locale/RtKerberosClntMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtKerberosSrvrMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtLogMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtMailMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtMaintAndRepair.html 0444 root bin
+f usr/lib/help/profiles/locale/RtMediaBkup.html 0444 root bin
+f usr/lib/help/profiles/locale/RtMediaCtlg.html 0444 root bin
+f usr/lib/help/profiles/locale/RtMediaRestore.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNDMPMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNameServiceAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNameServiceSecure.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetAutoconfAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetAutoconfUser.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetILB.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetIPsec.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetLinkSecure.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetObservability.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetSecure.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetVRRP.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetWifiMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtNetWifiSecure.html 0444 root bin
+f usr/lib/help/profiles/locale/RtObAccessMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtObjectLabelMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtOperator.html 0444 root bin
+f usr/lib/help/profiles/locale/RtOutsideAccred.html 0444 root bin
+f usr/lib/help/profiles/locale/RtPriAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/RtPrntAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/RtProcManagement.html 0444 root bin
+f usr/lib/help/profiles/locale/RtReparseMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtReservedProfile.html 0444 root bin
+f usr/lib/help/profiles/locale/RtRightsDelegate.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSMBFSMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSMBMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSoftwareInstall.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSysAdmin.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSysEvMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSysPowerMgmt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSysPowerMgmtBrightness.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSysPowerMgmtSuspend.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSysPowerMgmtSuspendtoDisk.html 0444 root bin
+f usr/lib/help/profiles/locale/RtSysPowerMgmtSuspendtoRAM.html 0444 root bin
+f usr/lib/help/profiles/locale/RtUserMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtUserSecurity.html 0444 root bin
+f usr/lib/help/profiles/locale/RtVscanMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtZFSFileSysMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtZFSStorageMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtZoneMngmnt.html 0444 root bin
+f usr/lib/help/profiles/locale/RtZoneSecurity.html 0444 root bin
+f usr/lib/hotplugd 0555 root bin
+f usr/lib/idmapd 0555 root bin
+d usr/lib/inet 0755 root bin
+d usr/lib/inet/amd64 0755 root bin
+f usr/lib/inet/amd64/in.iked 0555 root bin
+f usr/lib/inet/certdb 0555 root bin
+f usr/lib/inet/certlocal 0555 root bin
+f usr/lib/inet/certrldb 0555 root bin
+d usr/lib/inet/dhcp 0755 root bin
+d usr/lib/inet/dhcp/nsu 0755 root bin
+f usr/lib/inet/dhcp/nsu/rfc2136.so.1 0755 root bin
+d usr/lib/inet/dhcp/svc 0755 root bin
+f usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so.1 0755 root bin
+s usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so=ds_SUNWbinfiles.so.1
+f usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.0 0755 root bin
+f usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.1 0755 root bin
+s usr/lib/inet/dhcp/svc/ds_SUNWfiles.so=ds_SUNWfiles.so.1
+f usr/lib/inet/dsvclockd 0555 root bin
+d usr/lib/inet/i86 0755 root bin
+f usr/lib/inet/i86/in.iked 0555 root bin
+d usr/lib/inet/ilb 0755 root bin
+f usr/lib/inet/ilb/ilb_probe 0555 root bin
+f usr/lib/inet/ilbd 0555 root bin
+f usr/lib/inet/in.chargend 0555 root bin
+f usr/lib/inet/in.daytimed 0555 root bin
+f usr/lib/inet/in.dhcpd 0555 root bin
+f usr/lib/inet/in.discardd 0555 root bin
+f usr/lib/inet/in.echod 0555 root bin
+h usr/lib/inet/in.iked=usr/lib/isaexec
+s usr/lib/inet/in.mpathd=../../../lib/inet/in.mpathd
+f usr/lib/inet/in.ndpd 0555 root bin
+f usr/lib/inet/in.ripngd 0555 root bin
+f usr/lib/inet/in.timed 0555 root bin
+f usr/lib/inet/inetd 0555 root bin
+f usr/lib/inet/mdnsd 0555 root bin
+f usr/lib/inet/ncaconfd 0555 root bin
+d usr/lib/inet/ppp 0755 root bin
+f usr/lib/inet/ppp/minconn.so 0544 root bin
+f usr/lib/inet/ppp/passprompt.so 0544 root bin
+f usr/lib/inet/ppp/pppoe.so 0544 root bin
+f usr/lib/inet/pppoec 0555 root bin
+f usr/lib/inet/pppoed 0555 root bin
+f usr/lib/inet/slpd 0555 root bin
+f usr/lib/inet/vrrpd 0555 root bin
+f usr/lib/inet/wpad 0555 root bin
+f usr/lib/intrd 0555 root bin
+d usr/lib/ipf 0755 root bin
+f usr/lib/ipf/IPFILTER.LICENCE 0644 root bin
+d usr/lib/ipf/amd64 0755 root sys
+f usr/lib/ipf/amd64/ipftest 0555 root bin
+d usr/lib/ipf/i86 0755 root sys
+f usr/lib/ipf/i86/ipftest 0555 root bin
+h usr/lib/ipf/ipftest=usr/lib/isaexec
+d usr/lib/ipqosconf 0755 root bin
+f usr/lib/ipqosconf/dlcosmk.types 0444 root bin
+f usr/lib/ipqosconf/dscpmk.types 0444 root bin
+f usr/lib/ipqosconf/flowacct.types 0444 root bin
+f usr/lib/ipqosconf/ipgpc.types 0444 root bin
+f usr/lib/ipqosconf/tokenmt.types 0444 root bin
+f usr/lib/ipqosconf/tswtclmt.types 0444 root bin
+f usr/lib/isaexec 0555 root bin
+d usr/lib/krb5 0755 root bin
+f usr/lib/krb5/README.db2 0444 root bin
+d usr/lib/krb5/amd64 0755 root bin
+f usr/lib/krb5/amd64/libkadm5clnt.so.1 0755 root bin
+s usr/lib/krb5/amd64/libkadm5clnt.so=libkadm5clnt.so.1
+f usr/lib/krb5/db2.so.1 0755 root bin
+s usr/lib/krb5/db2.so=db2.so.1
+f usr/lib/krb5/kadmind 0500 root bin
+f usr/lib/krb5/kconf 0555 root bin
+f usr/lib/krb5/kdyndns 0555 root bin
+f usr/lib/krb5/kldap.so.1 0755 root bin
+s usr/lib/krb5/kldap.so=kldap.so.1
+f usr/lib/krb5/klookup 0555 root bin
+f usr/lib/krb5/kprop 0555 root bin
+f usr/lib/krb5/kprop_script 0555 root bin
+f usr/lib/krb5/kpropd 0555 root bin
+f usr/lib/krb5/krb5kdc 0500 root bin
+f usr/lib/krb5/ksetpw 0555 root bin
+f usr/lib/krb5/ksmb 0555 root bin
+f usr/lib/krb5/ktkt_warnd 0555 root bin
+f usr/lib/krb5/libdb2.so.1 0755 root bin
+s usr/lib/krb5/libdb2.so=libdb2.so.1
+f usr/lib/krb5/libdyn.so.1 0755 root bin
+s usr/lib/krb5/libdyn.so=libdyn.so.1
+f usr/lib/krb5/libkadm5clnt.so.1 0755 root bin
+s usr/lib/krb5/libkadm5clnt.so=libkadm5clnt.so.1
+f usr/lib/krb5/libkadm5srv.so.1 0755 root bin
+s usr/lib/krb5/libkadm5srv.so=libkadm5srv.so.1
+f usr/lib/krb5/libkdb.so.1 0755 root bin
+s usr/lib/krb5/libkdb.so=libkdb.so.1
+f usr/lib/krb5/libkdb_ldap.so.1 0755 root bin
+s usr/lib/krb5/libkdb_ldap.so=libkdb_ldap.so.1
+f usr/lib/krb5/libss.so.1 0755 root bin
+s usr/lib/krb5/libss.so=libss.so.1
+d usr/lib/krb5/plugins 0755 root bin
+d usr/lib/krb5/plugins/preauth 0755 root bin
+f usr/lib/krb5/plugins/preauth/pkinit.so.1 0755 root bin
+s usr/lib/krb5/plugins/preauth/pkinit.so=pkinit.so.1
+f usr/lib/kssladm 0555 root bin
+f usr/lib/labeld 0555 root bin
+d usr/lib/ld 0755 root bin
+s usr/lib/ld.so.1=../../lib/ld.so.1
+d usr/lib/ld/amd64 0755 root bin
+s usr/lib/ld/amd64/map.above4G=../map.above4G
+s usr/lib/ld/amd64/map.below4G=../map.below4G
+s usr/lib/ld/amd64/map.default=../map.default
+f usr/lib/ld/map.above4G 0444 root bin
+f usr/lib/ld/map.below4G 0444 root bin
+f usr/lib/ld/map.bssalign 0444 root bin
+f usr/lib/ld/map.default 0444 root bin
+f usr/lib/ld/map.execdata 0444 root bin
+f usr/lib/ld/map.filter 0444 root bin
+f usr/lib/ld/map.noexbss 0444 root bin
+f usr/lib/ld/map.noexdata 0444 root bin
+f usr/lib/ld/map.noexstk 0444 root bin
+f usr/lib/ld/map.pagealign 0444 root bin
+d usr/lib/ldap 0755 root bin
+f usr/lib/ldap/idsconfig 0555 root bin
+f usr/lib/ldap/ldap_cachemgr 0555 root bin
+f usr/lib/lddstub 0555 root bin
+f usr/lib/lib.b 0444 root bin
+f usr/lib/libHBAAPI.so.1 0755 root bin
+s usr/lib/libHBAAPI.so=libHBAAPI.so.1
+s usr/lib/libMPAPI.so=../../lib/libMPAPI.so.1
+s usr/lib/libMPAPI.so.1=../../lib/libMPAPI.so.1
+f usr/lib/libSMHBAAPI.so.1 0755 root bin
+s usr/lib/libSMHBAAPI.so=libSMHBAAPI.so.1
+s usr/lib/libadm.so.1=../../lib/libadm.so.1
+s usr/lib/libadm.so=../../lib/libadm.so.1
+f usr/lib/libadt_jni.so.1 0755 root bin
+s usr/lib/libadt_jni.so=libadt_jni.so.1
+f usr/lib/libadutils.so.1 0755 root bin
+s usr/lib/libadutils.so=libadutils.so.1
+s usr/lib/libaio.so.1=../../lib/libaio.so.1
+s usr/lib/libaio.so=../../lib/libaio.so.1
+f usr/lib/libast.so.1 0755 root bin
+s usr/lib/libast.so=libast.so.1
+s usr/lib/libavl.so.1=../../lib/libavl.so.1
+s usr/lib/libavl.so=../../lib/libavl.so.1
+f usr/lib/libbe.so.1 0755 root bin
+s usr/lib/libbe.so=libbe.so.1
+f usr/lib/libbrand.so.1 0755 root bin
+s usr/lib/libbrand.so=libbrand.so.1
+f usr/lib/libbsdmalloc.so.1 0755 root bin
+s usr/lib/libbsdmalloc.so=libbsdmalloc.so.1
+s usr/lib/libbsm.so.1=../../lib/libbsm.so.1
+s usr/lib/libbsm.so=../../lib/libbsm.so.1
+d usr/lib/libc 0755 root bin
+s usr/lib/libc.so.1=../../lib/libc.so.1
+s usr/lib/libc.so=../../lib/libc.so.1
+f usr/lib/libc/libc_hwcap1.so.1 0755 root bin
+f usr/lib/libc/libc_hwcap2.so.1 0755 root bin
+f usr/lib/libc/libc_hwcap3.so.1 0755 root bin
+s usr/lib/libc_db.so.1=../../lib/libc_db.so.1
+s usr/lib/libc_db.so=../../lib/libc_db.so.1
+f usr/lib/libcfgadm.so.1 0755 root bin
+s usr/lib/libcfgadm.so=libcfgadm.so.1
+f usr/lib/libcmd.so.1 0755 root bin
+s usr/lib/libcmd.so=libcmd.so.1
+s usr/lib/libcmdutils.so.1=../../lib/libcmdutils.so.1
+s usr/lib/libcmdutils.so=../../lib/libcmdutils.so.1
+f usr/lib/libcommputil.so.1 0755 root bin
+s usr/lib/libcommputil.so=libcommputil.so.1
+s usr/lib/libcontract.so.1=../../lib/libcontract.so.1
+s usr/lib/libcontract.so=../../lib/libcontract.so.1
+f usr/lib/libcpc.so.1 0755 root bin
+s usr/lib/libcpc.so=libcpc.so.1
+f usr/lib/libcrle.so.1 0755 root bin
+f usr/lib/libcrypt.so.1 0755 root bin
+s usr/lib/libcrypt.so=libcrypt.so.1
+s usr/lib/libcrypt_d.so.1=libcrypt.so.1
+s usr/lib/libcrypt_d.so=libcrypt.so
+s usr/lib/libcrypt_i.so.1=libcrypt.so.1
+s usr/lib/libcrypt_i.so=libcrypt.so
+s usr/lib/libcryptoutil.so=../../lib/libcryptoutil.so.1
+s usr/lib/libcryptoutil.so.1=../../lib/libcryptoutil.so.1
+s usr/lib/libctf.so.1=../../lib/libctf.so.1
+s usr/lib/libctf.so=../../lib/libctf.so.1
+s usr/lib/libcurses.so.1=../../lib/libcurses.so.1
+s usr/lib/libcurses.so=../../lib/libcurses.so.1
+f usr/lib/libdat.so.1 0755 root bin
+s usr/lib/libdat.so=libdat.so.1
+s usr/lib/libdevice.so.1=../../lib/libdevice.so.1
+s usr/lib/libdevice.so=../../lib/libdevice.so.1
+s usr/lib/libdevid.so.1=../../lib/libdevid.so.1
+s usr/lib/libdevid.so=../../lib/libdevid.so.1
+s usr/lib/libdevinfo.so.1=../../lib/libdevinfo.so.1
+s usr/lib/libdevinfo.so=../../lib/libdevinfo.so.1
+s usr/lib/libdhcpagent.so.1=../../lib/libdhcpagent.so.1
+s usr/lib/libdhcpagent.so=../../lib/libdhcpagent.so.1
+f usr/lib/libdhcpsvc.so.1 0755 root bin
+s usr/lib/libdhcpsvc.so=libdhcpsvc.so.1
+s usr/lib/libdhcputil.so.1=../../lib/libdhcputil.so.1
+s usr/lib/libdhcputil.so=../../lib/libdhcputil.so.1
+f usr/lib/libdisasm.so.1 0755 root bin
+s usr/lib/libdisasm.so=libdisasm.so.1
+f usr/lib/libdiskmgt.so.1 0755 root bin
+s usr/lib/libdiskmgt.so=libdiskmgt.so.1
+s usr/lib/libdl.so.1=../../lib/libdl.so.1
+s usr/lib/libdl.so=../../lib/libdl.so.1
+s usr/lib/libdladm.so=../../lib/libdladm.so.1
+s usr/lib/libdladm.so.1=../../lib/libdladm.so.1
+f usr/lib/libdll.so.1 0755 root bin
+s usr/lib/libdll.so=libdll.so.1
+s usr/lib/libdlpi.so.1=../../lib/libdlpi.so.1
+s usr/lib/libdlpi.so=../../lib/libdlpi.so.1
+f usr/lib/libdns_sd.so.1 0755 root bin
+s usr/lib/libdns_sd.so=libdns_sd.so.1
+s usr/lib/libdoor.so.1=../../lib/libdoor.so.1
+s usr/lib/libdoor.so=../../lib/libdoor.so.1
+f usr/lib/libdscfg.so.1 0755 root bin
+s usr/lib/libdscfg.so=libdscfg.so.1
+f usr/lib/libdtrace.so.1 0755 root bin
+s usr/lib/libdtrace.so=libdtrace.so.1
+f usr/lib/libdtrace_jni.so.1 0755 root bin
+s usr/lib/libdtrace_jni.so=libdtrace_jni.so.1
+s usr/lib/libefi.so.1=../../lib/libefi.so.1
+s usr/lib/libefi.so=../../lib/libefi.so.1
+s usr/lib/libelf.so.1=../../lib/libelf.so.1
+s usr/lib/libelf.so=../../lib/libelf.so.1
+s usr/lib/libelfsign.so=../../lib/libelfsign.so.1
+s usr/lib/libelfsign.so.1=../../lib/libelfsign.so.1
+f usr/lib/libexacct.so.1 0755 root bin
+s usr/lib/libexacct.so=libexacct.so.1
+f usr/lib/libfcoe.so.1 0755 root bin
+s usr/lib/libfcoe.so=libfcoe.so.1
+s usr/lib/libfdisk.so.1=../../lib/libfdisk.so.1
+s usr/lib/libfdisk.so=../../lib/libfdisk.so.1
+f usr/lib/libform.so.1 0755 root bin
+s usr/lib/libform.so=libform.so.1
+f usr/lib/libfru.so.1 0755 root bin
+s usr/lib/libfru.so=libfru.so.1
+f usr/lib/libfruraw.so.1 0755 root bin
+s usr/lib/libfruraw.so=libfruraw.so.1
+f usr/lib/libfrureg.so.1 0755 root bin
+s usr/lib/libfrureg.so=libfrureg.so.1
+f usr/lib/libfruutils.so.1 0755 root bin
+s usr/lib/libfruutils.so=libfruutils.so.1
+f usr/lib/libfsmgt.so.1 0755 root bin
+s usr/lib/libfsmgt.so=libfsmgt.so.1
+f usr/lib/libfstyp.so.1 0755 root bin
+s usr/lib/libfstyp.so=libfstyp.so.1
+s usr/lib/libgen.so.1=../../lib/libgen.so.1
+s usr/lib/libgen.so=../../lib/libgen.so.1
+s usr/lib/libgrubmgmt.so=../../lib/libgrubmgmt.so.1
+s usr/lib/libgrubmgmt.so.1=../../lib/libgrubmgmt.so.1
+f usr/lib/libgss.so.1 0755 root bin
+s usr/lib/libgss.so=libgss.so.1
+f usr/lib/libhotplug.so.1 0755 root bin
+s usr/lib/libhotplug.so=libhotplug.so.1
+f usr/lib/libidmap.so.1 0755 root bin
+s usr/lib/libidmap.so=libidmap.so.1
+f usr/lib/libike.so.1 0755 root bin
+s usr/lib/libike.so=libike.so.1
+f usr/lib/libilb.so.1 0755 root bin
+s usr/lib/libilb.so=libilb.so.1
+f usr/lib/libima.so.1 0755 root bin
+s usr/lib/libima.so=libima.so.1
+f usr/lib/libinetsvc.so.1 0755 root bin
+s usr/lib/libinetsvc.so=libinetsvc.so.1
+s usr/lib/libinetutil.so.1=../../lib/libinetutil.so.1
+s usr/lib/libinetutil.so=../../lib/libinetutil.so.1
+f usr/lib/libinstzones.so.1 0755 root bin
+s usr/lib/libinstzones.so=libinstzones.so.1
+s usr/lib/libintl.so.1=../../lib/libintl.so.1
+s usr/lib/libintl.so=../../lib/libintl.so.1
+s usr/lib/libipadm.so=../../lib/libipadm.so.1
+s usr/lib/libipadm.so.1=../../lib/libipadm.so.1
+f usr/lib/libipd.so.1 0755 root bin
+s usr/lib/libipd.so=libipd.so.1
+f usr/lib/libipmi.so.1 0755 root bin
+s usr/lib/libipmi.so=libipmi.so.1
+s usr/lib/libipmp.so=../../lib/libipmp.so.1
+s usr/lib/libipmp.so.1=../../lib/libipmp.so.1
+f usr/lib/libipp.so.1 0755 root bin
+s usr/lib/libipp.so=libipp.so.1
+f usr/lib/libipsecutil.so.1 0755 root bin
+s usr/lib/libipsecutil.so=libipsecutil.so.1
+f usr/lib/libiscsit.so.1 0755 root bin
+s usr/lib/libiscsit.so=libiscsit.so.1
+f usr/lib/libjdns_sd.so.1 0755 root bin
+s usr/lib/libjdns_sd.so=libjdns_sd.so.1
+s usr/lib/libkcfd.so=../../lib/libkcfd.so.1
+s usr/lib/libkcfd.so.1=../../lib/libkcfd.so.1
+s usr/lib/libkmf.so=../../lib/libkmf.so.1
+s usr/lib/libkmf.so.1=../../lib/libkmf.so.1
+s usr/lib/libkmfberder.so=../../lib/libkmfberder.so.1
+s usr/lib/libkmfberder.so.1=../../lib/libkmfberder.so.1
+f usr/lib/libkrb5.so.1 0755 root bin
+s usr/lib/libkrb5.so=libkrb5.so.1
+s usr/lib/libkstat.so.1=../../lib/libkstat.so.1
+s usr/lib/libkstat.so=../../lib/libkstat.so.1
+f usr/lib/libkvm.so.1 0755 root bin
+s usr/lib/libkvm.so=libkvm.so.1
+f usr/lib/libl.so.1 0755 root bin
+s usr/lib/libl.so=libl.so.1
+f usr/lib/libldap.so.5 0755 root bin
+s usr/lib/libldap.so=libldap.so.5
+s usr/lib/liblddbg.so.4=../../lib/liblddbg.so.4
+f usr/lib/libldstab.so.1 0755 root bin
+f usr/lib/liblgrp.so.1 0755 root bin
+s usr/lib/liblgrp.so=liblgrp.so.1
+f usr/lib/liblm.so.1 0755 root bin
+s usr/lib/liblm.so=liblm.so.1
+f usr/lib/libmail.so.1 0755 root bin
+s usr/lib/libmail.so=libmail.so.1
+f usr/lib/libmalloc.so.1 0755 root bin
+s usr/lib/libmalloc.so=libmalloc.so.1
+f usr/lib/libmapmalloc.so.1 0755 root bin
+s usr/lib/libmapmalloc.so=libmapmalloc.so.1
+s usr/lib/libmd.so.1=../../lib/libmd.so.1
+s usr/lib/libmd.so=../../lib/libmd.so.1
+s usr/lib/libmd5.so.1=../../lib/libmd5.so.1
+s usr/lib/libmd5.so=../../lib/libmd5.so.1
+s usr/lib/libmech_krb5.so=gss/mech_krb5.so
+f usr/lib/libmenu.so.1 0755 root bin
+s usr/lib/libmenu.so=libmenu.so.1
+f usr/lib/libmilter.so.1 0755 root bin
+s usr/lib/libmilter.so=libmilter.so.1
+s usr/lib/libmp.so.1=../../lib/libmp.so.1
+s usr/lib/libmp.so.2=../../lib/libmp.so.2
+s usr/lib/libmp.so=../../lib/libmp.so.2
+s usr/lib/libmpscsi_vhci.so=../../lib/libmpscsi_vhci.so.1
+s usr/lib/libmpscsi_vhci.so.1=../../lib/libmpscsi_vhci.so.1
+f usr/lib/libmtmalloc.so.1 0755 root bin
+s usr/lib/libmtmalloc.so=libmtmalloc.so.1
+f usr/lib/libndmp.so.1 0755 root bin
+s usr/lib/libndmp.so=libndmp.so.1
+f usr/lib/libnisdb.so.2 0755 root bin
+s usr/lib/libnisdb.so=libnisdb.so.2
+f usr/lib/libnls.so.1 0755 root bin
+s usr/lib/libnls.so=libnls.so.1
+f usr/lib/libnsctl.so.1 0755 root bin
+s usr/lib/libnsctl.so=libnsctl.so.1
+s usr/lib/libnsl.so.1=../../lib/libnsl.so.1
+s usr/lib/libnsl.so=../../lib/libnsl.so.1
+f usr/lib/libntfs.so.10 0755 root bin
+s usr/lib/libntfs.so=libntfs.so.10
+f usr/lib/libnvfru.so.1 0755 root bin
+s usr/lib/libnvfru.so=libnvfru.so.1
+s usr/lib/libnvpair.so.1=../../lib/libnvpair.so.1
+s usr/lib/libnvpair.so=../../lib/libnvpair.so.1
+s usr/lib/libnwam.so=../../lib/libnwam.so.1
+s usr/lib/libnwam.so.1=../../lib/libnwam.so.1
+d usr/lib/libp 0755 root bin
+s usr/lib/libp/32=.
+s usr/lib/libp/64=amd64
+d usr/lib/libp/amd64 0755 root bin
+s usr/lib/libp/amd64/libc.so.1=../../../../lib/amd64/libc.so.1
+s usr/lib/libp/libc.so.1=../../../lib/libc.so.1
+s usr/lib/libpam.so.1=../../lib/libpam.so.1
+s usr/lib/libpam.so=../../lib/libpam.so.1
+f usr/lib/libpanel.so.1 0755 root bin
+s usr/lib/libpanel.so=libpanel.so.1
+f usr/lib/libparted.so.8 0755 root bin
+s usr/lib/libparted.so=libparted.so.8
+f usr/lib/libpcidb.so.1 0755 root bin
+f usr/lib/libpctx.so.1 0755 root bin
+s usr/lib/libpctx.so=libpctx.so.1
+f usr/lib/libpicl.so.1 0755 root bin
+s usr/lib/libpicl.so=libpicl.so.1
+f usr/lib/libpicld_pluginutil.so.1 0755 root bin
+s usr/lib/libpicld_pluginutil.so=libpicld_pluginutil.so.1
+f usr/lib/libpicltree.so.1 0755 root bin
+s usr/lib/libpicltree.so=libpicltree.so.1
+f usr/lib/libpkcs11.so.1 0755 root bin
+s usr/lib/libpkcs11.so=libpkcs11.so.1
+f usr/lib/libpkg.so.1 0755 root bin
+s usr/lib/libpkg.so=libpkg.so.1
+f usr/lib/libpool.so.1 0755 root bin
+s usr/lib/libpool.so=libpool.so.1
+s usr/lib/libposix4.so.1=../../lib/librt.so.1
+s usr/lib/libposix4.so=../../lib/librt.so.1
+f usr/lib/libpp.so.1 0755 root bin
+s usr/lib/libpp.so=libpp.so.1
+s usr/lib/libproc.so.1=../../lib/libproc.so.1
+s usr/lib/libproc.so=../../lib/libproc.so.1
+f usr/lib/libproject.so.1 0755 root bin
+s usr/lib/libproject.so=libproject.so.1
+s usr/lib/libpthread.so.1=../../lib/libpthread.so.1
+s usr/lib/libpthread.so=../../lib/libpthread.so.1
+f usr/lib/libraidcfg.so.1 0755 root bin
+s usr/lib/libraidcfg.so=libraidcfg.so.1
+s usr/lib/librcm.so.1=../../lib/librcm.so.1
+s usr/lib/librcm.so=../../lib/librcm.so.1
+f usr/lib/librdc.so.1 0755 root bin
+s usr/lib/librdc.so=librdc.so.1
+f usr/lib/libreparse.so.1 0755 root bin
+s usr/lib/libreparse.so=libreparse.so.1
+s usr/lib/libresolv.so.1=../../lib/libresolv.so.1
+s usr/lib/libresolv.so.2=../../lib/libresolv.so.2
+s usr/lib/libresolv.so=../../lib/libresolv.so.2
+s usr/lib/libresolv_joy.so.2=../../lib/libresolv_joy.so.2
+s usr/lib/librestart.so.1=../../lib/librestart.so.1
+s usr/lib/librestart.so=../../lib/librestart.so.1
+s usr/lib/librpcsvc.so.1=../../lib/librpcsvc.so.1
+s usr/lib/librpcsvc.so=../../lib/librpcsvc.so.1
+f usr/lib/librsm.so.2 0755 root bin
+s usr/lib/librsm.so=librsm.so.2
+f usr/lib/librstp.so.1 0755 root bin
+s usr/lib/librstp.so=librstp.so.1
+s usr/lib/librt.so.1=../../lib/librt.so.1
+s usr/lib/librt.so=../../lib/librt.so.1
+s usr/lib/librtld.so.1=../../lib/librtld.so.1
+s usr/lib/librtld_db.so.1=../../lib/librtld_db.so.1
+s usr/lib/librtld_db.so=../../lib/librtld_db.so.1
+f usr/lib/libsasl.so.1 0755 root bin
+s usr/lib/libsasl.so=libsasl.so.1
+s usr/lib/libscf.so.1=../../lib/libscf.so.1
+s usr/lib/libscf.so=../../lib/libscf.so.1
+f usr/lib/libsched.so.1 0755 root bin
+s usr/lib/libsched.so=libsched.so.1
+f usr/lib/libsctp.so.1 0755 root bin
+s usr/lib/libsctp.so=libsctp.so.1
+s usr/lib/libsec.so.1=../../lib/libsec.so.1
+s usr/lib/libsec.so=../../lib/libsec.so.1
+s usr/lib/libsecdb.so.1=../../lib/libsecdb.so.1
+s usr/lib/libsecdb.so=../../lib/libsecdb.so.1
+s usr/lib/libsendfile.so.1=../../lib/libsendfile.so.1
+s usr/lib/libsendfile.so=../../lib/libsendfile.so.1
+f usr/lib/libshare.so.1 0755 root bin
+s usr/lib/libshare.so=libshare.so.1
+f usr/lib/libshell.so.1 0755 root bin
+s usr/lib/libshell.so=libshell.so.1
+f usr/lib/libsip.so.1 0755 root bin
+s usr/lib/libsip.so=libsip.so.1
+f usr/lib/libsldap.so.1 0755 root bin
+s usr/lib/libsldap.so=libsldap.so.1
+f usr/lib/libslp.so.1 0755 root bin
+s usr/lib/libslp.so=libslp.so.1
+s usr/lib/libsmartsshd.so.1=../../lib/libsmartsshd.so.1
+s usr/lib/libsmartsshd.so=../../lib/libsmartsshd.so.1
+f usr/lib/libsmbfs.so.1 0755 root bin
+s usr/lib/libsmbfs.so=libsmbfs.so.1
+f usr/lib/libsmbios.so.1 0755 root bin
+s usr/lib/libsmbios.so=libsmbios.so.1
+f usr/lib/libsmedia.so.1 0755 root bin
+s usr/lib/libsmedia.so=libsmedia.so.1
+s usr/lib/libsocket.so.1=../../lib/libsocket.so.1
+s usr/lib/libsocket.so=../../lib/libsocket.so.1
+f usr/lib/libsoftcrypto.so.1 0755 root bin
+s usr/lib/libsoftcrypto.so=libsoftcrypto.so.1
+f usr/lib/libsqlite-native.o 0644 root bin
+f usr/lib/libsqlite.o 0644 root bin
+f usr/lib/libsrpt.so.1 0755 root bin
+s usr/lib/libsrpt.so=libsrpt.so.1
+f usr/lib/libstanddisasm.so 0644 root bin
+f usr/lib/libstmf.so.1 0755 root bin
+s usr/lib/libstmf.so=libstmf.so.1
+f usr/lib/libstmfproxy.so.1 0755 root bin
+s usr/lib/libstmfproxy.so=libstmfproxy.so.1
+f usr/lib/libsum.so.1 0755 root bin
+s usr/lib/libsum.so=libsum.so.1
+f usr/lib/libsun_fc.so.1 0755 root bin
+s usr/lib/libsun_fc.so=libsun_fc.so.1
+f usr/lib/libsun_ima.so.1 0755 root bin
+s usr/lib/libsun_ima.so=libsun_ima.so.1
+f usr/lib/libsun_sas.so.1 0755 root bin
+s usr/lib/libsun_sas.so=libsun_sas.so.1
+f usr/lib/libsys.so.1 0755 root bin
+s usr/lib/libsys.so=libsys.so.1
+s usr/lib/libsysevent.so.1=../../lib/libsysevent.so.1
+s usr/lib/libsysevent.so=../../lib/libsysevent.so.1
+f usr/lib/libtecla.so.1 0755 root bin
+s usr/lib/libtecla.so=libtecla.so.1
+s usr/lib/libtermcap.so.1=../../lib/libtermcap.so.1
+s usr/lib/libtermcap.so=../../lib/libtermcap.so.1
+s usr/lib/libtermlib.so.1=../../lib/libcurses.so.1
+s usr/lib/libtermlib.so=../../lib/libcurses.so.1
+s usr/lib/libthread.so.1=../../lib/libthread.so.1
+s usr/lib/libthread.so=../../lib/libthread.so.1
+s usr/lib/libthread_db.so.1=../../lib/libc_db.so.1
+s usr/lib/libthread_db.so=../../lib/libc_db.so.1
+f usr/lib/libtnf.so.1 0755 root bin
+s usr/lib/libtnf.so=libtnf.so.1
+f usr/lib/libtnfctl.so.1 0755 root bin
+s usr/lib/libtnfctl.so=libtnfctl.so.1
+f usr/lib/libtnfprobe.so.1 0755 root bin
+s usr/lib/libtnfprobe.so=libtnfprobe.so.1
+s usr/lib/libtsnet.so=../../lib/libtsnet.so.1
+s usr/lib/libtsnet.so.1=../../lib/libtsnet.so.1
+s usr/lib/libtsol.so=../../lib/libtsol.so.2
+s usr/lib/libtsol.so.2=../../lib/libtsol.so.2
+s usr/lib/libumem.so.1=../../lib/libumem.so.1
+s usr/lib/libumem.so=../../lib/libumem.so.1
+s usr/lib/libumem_trampoline.so.1=../../lib/libumem_trampoline.so.1
+s usr/lib/libumem_trampoline.so=../../lib/libumem_trampoline.so.1
+f usr/lib/libunistat.so.1 0755 root bin
+s usr/lib/libunistat.so=libunistat.so.1
+s usr/lib/libuuid.so.1=../../lib/libuuid.so.1
+s usr/lib/libuuid.so=../../lib/libuuid.so.1
+s usr/lib/libuutil.so.1=../../lib/libuutil.so.1
+s usr/lib/libuutil.so=../../lib/libuutil.so.1
+f usr/lib/libvolmgt.so.1 0755 root bin
+s usr/lib/libvolmgt.so=libvolmgt.so.1
+f usr/lib/libvrrpadm.so.1 0755 root bin
+s usr/lib/libvrrpadm.so=libvrrpadm.so.1
+s usr/lib/libw.so.1=../../lib/libw.so.1
+s usr/lib/libw.so=../../lib/libw.so.1
+f usr/lib/libwanboot.so.1 0755 root bin
+s usr/lib/libwanboot.so=../../lib/libwanboot.so.1
+f usr/lib/libwrap.so.1.0 0755 root bin
+s usr/lib/libwrap.so.1=libwrap.so.1.0
+s usr/lib/libwrap.so=libwrap.so.1.0
+s usr/lib/libxnet.so.1=../../lib/libxnet.so.1
+s usr/lib/libxnet.so=../../lib/libxnet.so.1
+f usr/lib/liby.so.1 0755 root bin
+s usr/lib/liby.so=liby.so.1
+s usr/lib/libzdoor.so.1=../../lib/libzdoor.so.1
+s usr/lib/libzdoor.so=../../lib/libzdoor.so.1
+s usr/lib/libzfs.so.1=../../lib/libzfs.so.1
+s usr/lib/libzfs.so=../../lib/libzfs.so.1
+s usr/lib/libzfs_core.so=libzfs_core.so.1
+f usr/lib/libzfs_core.so.1 755 root bin
+f usr/lib/libzfs_jni.so.1 0755 root bin
+s usr/lib/libzfs_jni.so=libzfs_jni.so.1
+f usr/lib/libzonecfg.so.1 0755 root bin
+s usr/lib/libzonecfg.so=libzonecfg.so.1
+f usr/lib/libzoneinfo.so.1 0755 root bin
+s usr/lib/libzoneinfo.so=libzoneinfo.so.1
+f usr/lib/libzpool.so.1 0755 root bin
+s usr/lib/libzpool.so=libzpool.so.1
+d usr/lib/link_audit 0755 root bin
+s usr/lib/link_audit/32=.
+s usr/lib/link_audit/64=amd64
+d usr/lib/link_audit/amd64 0755 root bin
+f usr/lib/link_audit/amd64/ldprof.so.1 0755 root bin
+f usr/lib/link_audit/amd64/truss.so.1 0755 root bin
+f usr/lib/link_audit/amd64/who.so.1 0755 root bin
+f usr/lib/link_audit/ldprof.so.1 0755 root bin
+f usr/lib/link_audit/truss.so.1 0755 root bin
+f usr/lib/link_audit/who.so.1 0755 root bin
+f usr/lib/lms 0555 root bin
+d usr/lib/locale 0755 root bin
+d usr/lib/locale/af_ZA.UTF-8 0755 root bin
+d usr/lib/locale/af_ZA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/af_ZA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/af_ZA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/af_ZA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/af_ZA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/af_ZA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/af_ZA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/af_ZA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/af_ZA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/af_ZA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/af_ZA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/af_ZA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_AE.UTF-8 0755 root bin
+d usr/lib/locale/ar_AE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_AE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_AE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_AE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_AE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_AE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_AE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_AE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_AE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_AE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_AE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_AE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_BH.UTF-8 0755 root bin
+d usr/lib/locale/ar_BH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_BH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_BH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_BH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_BH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_BH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_BH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_BH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_BH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_BH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_BH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_BH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_DZ.UTF-8 0755 root bin
+d usr/lib/locale/ar_DZ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_DZ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_DZ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_DZ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_DZ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_DZ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_DZ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_DZ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_DZ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_DZ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_DZ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_DZ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_EG.UTF-8 0755 root bin
+d usr/lib/locale/ar_EG.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_EG.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_EG.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_EG.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_EG.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_EG.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_EG.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_EG.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_EG.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_EG.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_EG.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_EG.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_IQ.UTF-8 0755 root bin
+d usr/lib/locale/ar_IQ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_IQ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_IQ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_IQ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_IQ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_IQ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_IQ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_IQ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_IQ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_IQ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_IQ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_IQ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_JO.UTF-8 0755 root bin
+d usr/lib/locale/ar_JO.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_JO.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_JO.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_JO.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_JO.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_JO.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_JO.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_JO.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_JO.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_JO.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_JO.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_JO.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_KW.UTF-8 0755 root bin
+d usr/lib/locale/ar_KW.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_KW.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_KW.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_KW.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_KW.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_KW.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_KW.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_KW.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_KW.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_KW.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_KW.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_KW.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LB.UTF-8 0755 root bin
+d usr/lib/locale/ar_LB.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_LB.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LB.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_LB.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LB.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_LB.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LB.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_LB.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LB.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_LB.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LB.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_LB.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LY.UTF-8 0755 root bin
+d usr/lib/locale/ar_LY.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_LY.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LY.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_LY.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LY.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_LY.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LY.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_LY.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LY.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_LY.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_LY.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_LY.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_MA.UTF-8 0755 root bin
+d usr/lib/locale/ar_MA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_MA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_MA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_MA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_MA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_MA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_MA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_MA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_MA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_MA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_MA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_MA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_OM.UTF-8 0755 root bin
+d usr/lib/locale/ar_OM.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_OM.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_OM.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_OM.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_OM.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_OM.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_OM.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_OM.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_OM.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_OM.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_OM.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_OM.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_QA.UTF-8 0755 root bin
+d usr/lib/locale/ar_QA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_QA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_QA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_QA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_QA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_QA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_QA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_QA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_QA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_QA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_QA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_QA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_SA.UTF-8 0755 root bin
+d usr/lib/locale/ar_SA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_SA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_SA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_SA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_SA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_SA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_SA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_SA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_SA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_SA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_SA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_SA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_TN.UTF-8 0755 root bin
+d usr/lib/locale/ar_TN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_TN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_TN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_TN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_TN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_TN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_TN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_TN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_TN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_TN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_TN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_TN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_YE.UTF-8 0755 root bin
+d usr/lib/locale/ar_YE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ar_YE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_YE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ar_YE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_YE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ar_YE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_YE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ar_YE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_YE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ar_YE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ar_YE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ar_YE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/as_IN.UTF-8 0755 root bin
+d usr/lib/locale/as_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/as_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/as_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/as_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/as_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/as_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/as_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/as_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/as_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/as_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/as_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/as_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/az_AZ.UTF-8 0755 root bin
+d usr/lib/locale/az_AZ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/az_AZ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/az_AZ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/az_AZ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/az_AZ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/az_AZ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/az_AZ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/az_AZ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/az_AZ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/az_AZ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/az_AZ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/az_AZ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/be_BY.UTF-8 0755 root bin
+d usr/lib/locale/be_BY.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/be_BY.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/be_BY.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/be_BY.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/be_BY.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/be_BY.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/be_BY.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/be_BY.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/be_BY.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/be_BY.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/be_BY.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/be_BY.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.ISO8859-5 0755 root bin
+d usr/lib/locale/bg_BG.ISO8859-5/LC_COLLATE 0755 root bin
+f usr/lib/locale/bg_BG.ISO8859-5/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.ISO8859-5/LC_CTYPE 0755 root bin
+f usr/lib/locale/bg_BG.ISO8859-5/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.ISO8859-5/LC_MESSAGES 0755 root bin
+f usr/lib/locale/bg_BG.ISO8859-5/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.ISO8859-5/LC_MONETARY 0755 root bin
+f usr/lib/locale/bg_BG.ISO8859-5/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.ISO8859-5/LC_NUMERIC 0755 root bin
+f usr/lib/locale/bg_BG.ISO8859-5/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.ISO8859-5/LC_TIME 0755 root bin
+f usr/lib/locale/bg_BG.ISO8859-5/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.UTF-8 0755 root bin
+d usr/lib/locale/bg_BG.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/bg_BG.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/bg_BG.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/bg_BG.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/bg_BG.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/bg_BG.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/bg_BG.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/bg_BG.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_BD.UTF-8 0755 root bin
+d usr/lib/locale/bn_BD.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/bn_BD.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_BD.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/bn_BD.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_BD.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/bn_BD.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_BD.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/bn_BD.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_BD.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/bn_BD.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_BD.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/bn_BD.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_IN.UTF-8 0755 root bin
+d usr/lib/locale/bn_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/bn_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/bn_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/bn_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/bn_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/bn_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/bn_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/bn_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_CN.UTF-8 0755 root bin
+d usr/lib/locale/bo_CN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/bo_CN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_CN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/bo_CN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_CN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/bo_CN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_CN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/bo_CN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_CN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/bo_CN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_CN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/bo_CN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_IN.UTF-8 0755 root bin
+d usr/lib/locale/bo_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/bo_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/bo_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/bo_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/bo_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/bo_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/bo_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/bo_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/bs_BA.UTF-8 0755 root bin
+d usr/lib/locale/bs_BA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/bs_BA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/bs_BA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/bs_BA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/bs_BA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/bs_BA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/bs_BA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/bs_BA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/bs_BA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/bs_BA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/bs_BA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/bs_BA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/C 0755 root bin
+d usr/lib/locale/C/LC_COLLATE 0755 root bin
+d usr/lib/locale/C/LC_CTYPE 0755 root bin
+d usr/lib/locale/C/LC_MESSAGES 0755 root bin
+d usr/lib/locale/C/LC_MONETARY 0755 root bin
+d usr/lib/locale/C/LC_NUMERIC 0755 root bin
+d usr/lib/locale/C/LC_TIME 0755 root bin
+f usr/lib/locale/C/LC_TIME/SUNW_OST_OSCMD.po 0644 root bin
+d usr/lib/locale/ca_ES.ISO8859-15 0755 root bin
+d usr/lib/locale/ca_ES.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/ca_ES.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/ca_ES.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ca_ES.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/ca_ES.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ca_ES.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/ca_ES.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.UTF-8 0755 root bin
+d usr/lib/locale/ca_ES.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ca_ES.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ca_ES.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ca_ES.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ca_ES.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ca_ES.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ca_ES.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ca_ES.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.ISO8859-2 0755 root bin
+d usr/lib/locale/cs_CZ.ISO8859-2/LC_COLLATE 0755 root bin
+f usr/lib/locale/cs_CZ.ISO8859-2/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.ISO8859-2/LC_CTYPE 0755 root bin
+f usr/lib/locale/cs_CZ.ISO8859-2/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.ISO8859-2/LC_MESSAGES 0755 root bin
+f usr/lib/locale/cs_CZ.ISO8859-2/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.ISO8859-2/LC_MONETARY 0755 root bin
+f usr/lib/locale/cs_CZ.ISO8859-2/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.ISO8859-2/LC_NUMERIC 0755 root bin
+f usr/lib/locale/cs_CZ.ISO8859-2/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.ISO8859-2/LC_TIME 0755 root bin
+f usr/lib/locale/cs_CZ.ISO8859-2/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.UTF-8 0755 root bin
+d usr/lib/locale/cs_CZ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/cs_CZ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/cs_CZ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/cs_CZ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/cs_CZ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/cs_CZ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/cs_CZ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/cs_CZ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-1 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-15 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/da_DK.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.UTF-8 0755 root bin
+d usr/lib/locale/da_DK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/da_DK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/da_DK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/da_DK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/da_DK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/da_DK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/da_DK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/da_DK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.ISO8859-15 0755 root bin
+d usr/lib/locale/de_AT.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_AT.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_AT.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_AT.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_AT.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_AT.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/de_AT.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.UTF-8 0755 root bin
+d usr/lib/locale/de_AT.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_AT.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_AT.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_AT.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_AT.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_AT.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_AT.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/de_AT.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_BE.UTF-8 0755 root bin
+d usr/lib/locale/de_BE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_BE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_BE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_BE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_BE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_BE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_BE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_BE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_BE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_BE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_BE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/de_BE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.ISO8859-1 0755 root bin
+d usr/lib/locale/de_CH.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_CH.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_CH.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_CH.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_CH.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_CH.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/de_CH.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.UTF-8 0755 root bin
+d usr/lib/locale/de_CH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_CH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_CH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_CH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_CH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_CH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_CH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/de_CH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-1 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-1/LC_COLLATE 0755 root bin
+h usr/lib/locale/de_DE.ISO8859-1/LC_COLLATE/LCL_DATA=usr/lib/locale/de_CH.ISO8859-1/LC_COLLATE/LCL_DATA
+d usr/lib/locale/de_DE.ISO8859-1/LC_CTYPE 0755 root bin
+h usr/lib/locale/de_DE.ISO8859-1/LC_CTYPE/LCL_DATA=usr/lib/locale/da_DK.ISO8859-1/LC_CTYPE/LCL_DATA
+d usr/lib/locale/de_DE.ISO8859-1/LC_MESSAGES 0755 root bin
+h usr/lib/locale/de_DE.ISO8859-1/LC_MESSAGES/LCL_DATA=usr/lib/locale/de_AT.ISO8859-15/LC_MESSAGES/LCL_DATA
+d usr/lib/locale/de_DE.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-15 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/de_DE.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.UTF-8 0755 root bin
+d usr/lib/locale/de_DE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_DE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_DE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_DE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_DE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_DE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_DE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/de_DE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LI.UTF-8 0755 root bin
+d usr/lib/locale/de_LI.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_LI.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LI.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_LI.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LI.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_LI.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LI.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_LI.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LI.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_LI.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LI.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/de_LI.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LU.UTF-8 0755 root bin
+d usr/lib/locale/de_LU.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/de_LU.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LU.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/de_LU.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LU.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/de_LU.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LU.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/de_LU.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LU.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/de_LU.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/de_LU.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/de_LU.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/el_CY.UTF-8 0755 root bin
+d usr/lib/locale/el_CY.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/el_CY.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/el_CY.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/el_CY.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/el_CY.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/el_CY.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/el_CY.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/el_CY.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/el_CY.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/el_CY.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/el_CY.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/el_CY.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.ISO8859-7 0755 root bin
+d usr/lib/locale/el_GR.ISO8859-7/LC_COLLATE 0755 root bin
+f usr/lib/locale/el_GR.ISO8859-7/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.ISO8859-7/LC_CTYPE 0755 root bin
+f usr/lib/locale/el_GR.ISO8859-7/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.ISO8859-7/LC_MESSAGES 0755 root bin
+f usr/lib/locale/el_GR.ISO8859-7/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.ISO8859-7/LC_MONETARY 0755 root bin
+f usr/lib/locale/el_GR.ISO8859-7/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.ISO8859-7/LC_NUMERIC 0755 root bin
+f usr/lib/locale/el_GR.ISO8859-7/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.ISO8859-7/LC_TIME 0755 root bin
+f usr/lib/locale/el_GR.ISO8859-7/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.UTF-8 0755 root bin
+d usr/lib/locale/el_GR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/el_GR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/el_GR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/el_GR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/el_GR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/el_GR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/el_GR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/el_GR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.ISO8859-1 0755 root bin
+d usr/lib/locale/en_AU.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_AU.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_AU.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_AU.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_AU.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_AU.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/en_AU.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.UTF-8 0755 root bin
+d usr/lib/locale/en_AU.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_AU.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_AU.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_AU.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_AU.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_AU.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_AU.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_AU.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BW.UTF-8 0755 root bin
+d usr/lib/locale/en_BW.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_BW.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BW.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_BW.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BW.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_BW.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BW.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_BW.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BW.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_BW.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BW.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_BW.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BZ.UTF-8 0755 root bin
+d usr/lib/locale/en_BZ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_BZ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BZ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_BZ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BZ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_BZ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BZ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_BZ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BZ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_BZ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_BZ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_BZ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.ISO8859-1 0755 root bin
+d usr/lib/locale/en_CA.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_CA.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_CA.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_CA.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_CA.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_CA.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/en_CA.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.UTF-8 0755 root bin
+d usr/lib/locale/en_CA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_CA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_CA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_CA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_CA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_CA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_CA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_CA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-1 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-15 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/en_GB.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.UTF-8 0755 root bin
+d usr/lib/locale/en_GB.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_GB.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_GB.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_GB.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_GB.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_GB.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_GB.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_GB.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_HK.UTF-8 0755 root bin
+d usr/lib/locale/en_HK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_HK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_HK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_HK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_HK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_HK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_HK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_HK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_HK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_HK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_HK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_HK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.ISO8859-15 0755 root bin
+d usr/lib/locale/en_IE.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_IE.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_IE.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_IE.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_IE.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_IE.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/en_IE.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.UTF-8 0755 root bin
+d usr/lib/locale/en_IE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_IE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_IE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_IE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_IE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_IE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_IE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IN.UTF-8 0755 root bin
+d usr/lib/locale/en_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_JM.UTF-8 0755 root bin
+d usr/lib/locale/en_JM.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_JM.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_JM.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_JM.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_JM.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_JM.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_JM.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_JM.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_JM.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_JM.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_JM.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_JM.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MH.UTF-8 0755 root bin
+d usr/lib/locale/en_MH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_MH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_MH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_MH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_MH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_MH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_MH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MT.UTF-8 0755 root bin
+d usr/lib/locale/en_MT.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_MT.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MT.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_MT.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MT.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_MT.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MT.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_MT.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MT.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_MT.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_MT.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_MT.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NA.UTF-8 0755 root bin
+d usr/lib/locale/en_NA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_NA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_NA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_NA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_NA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_NA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_NA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.ISO8859-1 0755 root bin
+d usr/lib/locale/en_NZ.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_NZ.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_NZ.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_NZ.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_NZ.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_NZ.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/en_NZ.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.UTF-8 0755 root bin
+d usr/lib/locale/en_NZ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_NZ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_NZ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_NZ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_NZ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_NZ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_NZ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_NZ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PH.UTF-8 0755 root bin
+d usr/lib/locale/en_PH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_PH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_PH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_PH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_PH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_PH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_PH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PK.UTF-8 0755 root bin
+d usr/lib/locale/en_PK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_PK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_PK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_PK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_PK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_PK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_PK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_PK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_SG.UTF-8 0755 root bin
+d usr/lib/locale/en_SG.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_SG.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_SG.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_SG.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_SG.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_SG.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_SG.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_SG.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_SG.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_SG.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_SG.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_SG.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_TT.UTF-8 0755 root bin
+d usr/lib/locale/en_TT.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_TT.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_TT.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_TT.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_TT.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_TT.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_TT.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_TT.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_TT.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_TT.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_TT.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_TT.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-1 0755 root bin
+d usr/lib/locale/en_US.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_US.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_US.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_US.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_US.ISO8859-1/LC_MONETARY/LCL_DATA 0444 root bin
+d usr/lib/locale/en_US.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_US.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/en_US.ISO8859-1/LC_TIME/LCL_DATA 0444 root bin
+d usr/lib/locale/en_US.ISO8859-15 0755 root bin
+d usr/lib/locale/en_US.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_US.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_US.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_US.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_US.ISO8859-15/LC_MONETARY/LCL_DATA 0444 root bin
+d usr/lib/locale/en_US.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_US.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/en_US.ISO8859-15/LC_TIME/LCL_DATA 0444 root bin
+d usr/lib/locale/en_US.UTF-8 0755 root bin
+d usr/lib/locale/en_US.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_US.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_US.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_US.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_US.UTF-8/LC_MONETARY/LCL_DATA 0444 root bin
+d usr/lib/locale/en_US.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_US.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_US.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_US.UTF-8/LC_TIME/LCL_DATA 0444 root bin
+d usr/lib/locale/en_ZA.UTF-8 0755 root bin
+d usr/lib/locale/en_ZA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_ZA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_ZA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_ZA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_ZA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_ZA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_ZA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZW.UTF-8 0755 root bin
+d usr/lib/locale/en_ZW.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/en_ZW.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZW.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/en_ZW.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZW.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/en_ZW.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZW.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/en_ZW.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZW.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/en_ZW.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/en_ZW.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/en_ZW.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.ISO8859-1 0755 root bin
+d usr/lib/locale/es_AR.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_AR.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_AR.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_AR.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_AR.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_AR.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_AR.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.UTF-8 0755 root bin
+d usr/lib/locale/es_AR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_AR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_AR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_AR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_AR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_AR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_AR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_AR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.ISO8859-1 0755 root bin
+d usr/lib/locale/es_BO.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_BO.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_BO.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_BO.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_BO.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_BO.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_BO.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.UTF-8 0755 root bin
+d usr/lib/locale/es_BO.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_BO.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_BO.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_BO.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_BO.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_BO.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_BO.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_BO.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.ISO8859-1 0755 root bin
+d usr/lib/locale/es_CL.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_CL.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_CL.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_CL.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_CL.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_CL.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_CL.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.UTF-8 0755 root bin
+d usr/lib/locale/es_CL.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_CL.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_CL.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_CL.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_CL.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_CL.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CL.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_CL.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.ISO8859-1 0755 root bin
+d usr/lib/locale/es_CO.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_CO.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_CO.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_CO.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_CO.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_CO.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_CO.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.UTF-8 0755 root bin
+d usr/lib/locale/es_CO.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_CO.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_CO.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_CO.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_CO.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_CO.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CO.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_CO.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CR.UTF-8 0755 root bin
+d usr/lib/locale/es_CR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_CR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_CR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_CR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_CR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_CR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_CR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_CR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_DO.UTF-8 0755 root bin
+d usr/lib/locale/es_DO.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_DO.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_DO.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_DO.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_DO.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_DO.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_DO.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_DO.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_DO.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_DO.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_DO.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_DO.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.ISO8859-1 0755 root bin
+d usr/lib/locale/es_EC.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_EC.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_EC.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_EC.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_EC.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_EC.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_EC.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.UTF-8 0755 root bin
+d usr/lib/locale/es_EC.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_EC.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_EC.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_EC.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_EC.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_EC.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_EC.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_EC.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-1 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-1/LC_CTYPE 0755 root bin
+h usr/lib/locale/es_ES.ISO8859-1/LC_CTYPE/LCL_DATA=usr/lib/locale/da_DK.ISO8859-1/LC_CTYPE/LCL_DATA
+d usr/lib/locale/es_ES.ISO8859-1/LC_MESSAGES 0755 root bin
+h usr/lib/locale/es_ES.ISO8859-1/LC_MESSAGES/LCL_DATA=usr/lib/locale/es_AR.ISO8859-1/LC_MESSAGES/LCL_DATA
+d usr/lib/locale/es_ES.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-15 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/es_ES.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.UTF-8 0755 root bin
+d usr/lib/locale/es_ES.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_ES.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_ES.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_ES.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_ES.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_ES.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_ES.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_ES.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GQ.UTF-8 0755 root bin
+d usr/lib/locale/es_GQ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_GQ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GQ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_GQ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GQ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_GQ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GQ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_GQ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GQ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_GQ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GQ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_GQ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.ISO8859-1 0755 root bin
+d usr/lib/locale/es_GT.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_GT.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_GT.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_GT.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_GT.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_GT.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_GT.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.UTF-8 0755 root bin
+d usr/lib/locale/es_GT.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_GT.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_GT.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_GT.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_GT.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_GT.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_GT.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_GT.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_HN.UTF-8 0755 root bin
+d usr/lib/locale/es_HN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_HN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_HN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_HN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_HN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_HN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_HN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_HN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_HN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_HN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_HN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_HN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.ISO8859-1 0755 root bin
+d usr/lib/locale/es_MX.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_MX.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_MX.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_MX.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_MX.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_MX.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_MX.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.UTF-8 0755 root bin
+d usr/lib/locale/es_MX.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_MX.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_MX.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_MX.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_MX.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_MX.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_MX.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_MX.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.ISO8859-1 0755 root bin
+d usr/lib/locale/es_NI.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_NI.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_NI.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_NI.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_NI.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_NI.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_NI.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.UTF-8 0755 root bin
+d usr/lib/locale/es_NI.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_NI.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_NI.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_NI.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_NI.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_NI.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_NI.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_NI.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.ISO8859-1 0755 root bin
+d usr/lib/locale/es_PA.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_PA.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_PA.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_PA.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_PA.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_PA.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_PA.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.UTF-8 0755 root bin
+d usr/lib/locale/es_PA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_PA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_PA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_PA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_PA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_PA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_PA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.ISO8859-1 0755 root bin
+d usr/lib/locale/es_PE.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_PE.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_PE.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_PE.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_PE.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_PE.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_PE.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.UTF-8 0755 root bin
+d usr/lib/locale/es_PE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_PE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_PE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_PE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_PE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_PE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_PE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PR.UTF-8 0755 root bin
+d usr/lib/locale/es_PR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_PR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_PR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_PR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_PR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_PR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_PR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PY.UTF-8 0755 root bin
+d usr/lib/locale/es_PY.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_PY.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PY.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_PY.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PY.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_PY.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PY.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_PY.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PY.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_PY.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_PY.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_PY.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.ISO8859-1 0755 root bin
+d usr/lib/locale/es_SV.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_SV.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_SV.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_SV.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_SV.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_SV.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_SV.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.UTF-8 0755 root bin
+d usr/lib/locale/es_SV.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_SV.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_SV.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_SV.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_SV.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_SV.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_SV.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_SV.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_US.UTF-8 0755 root bin
+d usr/lib/locale/es_US.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_US.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_US.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_US.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_US.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_US.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_US.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_US.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_US.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_US.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_US.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_US.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.ISO8859-1 0755 root bin
+d usr/lib/locale/es_UY.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_UY.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_UY.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_UY.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_UY.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_UY.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_UY.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.UTF-8 0755 root bin
+d usr/lib/locale/es_UY.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_UY.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_UY.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_UY.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_UY.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_UY.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_UY.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_UY.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.ISO8859-1 0755 root bin
+d usr/lib/locale/es_VE.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_VE.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_VE.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_VE.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_VE.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_VE.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/es_VE.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.UTF-8 0755 root bin
+d usr/lib/locale/es_VE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/es_VE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/es_VE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/es_VE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/es_VE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/es_VE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/es_VE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/es_VE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/et_EE.UTF-8 0755 root bin
+d usr/lib/locale/et_EE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/et_EE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/et_EE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/et_EE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/et_EE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/et_EE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/et_EE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/et_EE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/et_EE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/et_EE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/et_EE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/et_EE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.ISO8859-15 0755 root bin
+d usr/lib/locale/fi_FI.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/fi_FI.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/fi_FI.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fi_FI.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/fi_FI.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fi_FI.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/fi_FI.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.UTF-8 0755 root bin
+d usr/lib/locale/fi_FI.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fi_FI.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fi_FI.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fi_FI.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fi_FI.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fi_FI.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fi_FI.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fi_FI.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fil_PH.UTF-8 0755 root bin
+d usr/lib/locale/fil_PH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fil_PH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fil_PH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fil_PH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fil_PH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fil_PH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fil_PH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fil_PH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fil_PH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fil_PH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fil_PH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fil_PH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.ISO8859-15 0755 root bin
+d usr/lib/locale/fr_BE.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_BE.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_BE.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_BE.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_BE.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_BE.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/fr_BE.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.UTF-8 0755 root bin
+d usr/lib/locale/fr_BE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_BE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_BE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_BE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_BE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_BE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_BE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_BE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.ISO8859-1 0755 root bin
+d usr/lib/locale/fr_CA.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_CA.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_CA.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_CA.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_CA.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_CA.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/fr_CA.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.UTF-8 0755 root bin
+d usr/lib/locale/fr_CA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_CA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_CA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_CA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_CA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_CA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_CA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CF.UTF-8 0755 root bin
+d usr/lib/locale/fr_CF.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_CF.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CF.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_CF.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CF.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_CF.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CF.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_CF.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CF.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_CF.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CF.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_CF.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.ISO8859-1 0755 root bin
+d usr/lib/locale/fr_CH.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_CH.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_CH.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_CH.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_CH.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_CH.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/fr_CH.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.UTF-8 0755 root bin
+d usr/lib/locale/fr_CH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_CH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_CH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_CH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_CH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_CH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_CH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_CH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-1 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-1/LC_COLLATE 0755 root bin
+h usr/lib/locale/fr_FR.ISO8859-1/LC_COLLATE/LCL_DATA=usr/lib/locale/fr_CH.ISO8859-1/LC_COLLATE/LCL_DATA
+d usr/lib/locale/fr_FR.ISO8859-1/LC_CTYPE 0755 root bin
+h usr/lib/locale/fr_FR.ISO8859-1/LC_CTYPE/LCL_DATA=usr/lib/locale/da_DK.ISO8859-1/LC_CTYPE/LCL_DATA
+d usr/lib/locale/fr_FR.ISO8859-1/LC_MESSAGES 0755 root bin
+h usr/lib/locale/fr_FR.ISO8859-1/LC_MESSAGES/LCL_DATA=usr/lib/locale/fr_BE.ISO8859-15/LC_MESSAGES/LCL_DATA
+d usr/lib/locale/fr_FR.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_FR.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-1/LC_NUMERIC 0755 root bin
+h usr/lib/locale/fr_FR.ISO8859-1/LC_NUMERIC/LCL_DATA=usr/lib/locale/bg_BG.ISO8859-5/LC_NUMERIC/LCL_DATA
+d usr/lib/locale/fr_FR.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/fr_FR.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-15 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_FR.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_FR.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_FR.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_FR.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_FR.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/fr_FR.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.UTF-8 0755 root bin
+d usr/lib/locale/fr_FR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_FR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_FR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_FR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_FR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_FR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_FR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_FR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_GN.UTF-8 0755 root bin
+d usr/lib/locale/fr_GN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_GN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_GN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_GN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_GN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_GN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_GN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_GN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_GN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_GN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_GN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_GN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_LU.UTF-8 0755 root bin
+d usr/lib/locale/fr_LU.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_LU.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_LU.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_LU.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_LU.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_LU.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_LU.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_LU.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_LU.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_LU.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_LU.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_LU.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MC.UTF-8 0755 root bin
+d usr/lib/locale/fr_MC.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_MC.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MC.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_MC.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MC.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_MC.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MC.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_MC.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MC.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_MC.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MC.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_MC.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MG.UTF-8 0755 root bin
+d usr/lib/locale/fr_MG.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_MG.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MG.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_MG.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MG.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_MG.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MG.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_MG.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MG.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_MG.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_MG.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_MG.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_ML.UTF-8 0755 root bin
+d usr/lib/locale/fr_ML.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_ML.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_ML.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_ML.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_ML.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_ML.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_ML.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_ML.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_ML.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_ML.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_ML.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_ML.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_NE.UTF-8 0755 root bin
+d usr/lib/locale/fr_NE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_NE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_NE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_NE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_NE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_NE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_NE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_NE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_NE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_NE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_NE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_NE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_SN.UTF-8 0755 root bin
+d usr/lib/locale/fr_SN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/fr_SN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_SN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/fr_SN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_SN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/fr_SN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_SN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/fr_SN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_SN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/fr_SN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/fr_SN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/fr_SN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ga_IE.UTF-8 0755 root bin
+d usr/lib/locale/ga_IE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ga_IE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ga_IE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ga_IE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ga_IE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ga_IE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ga_IE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ga_IE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ga_IE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ga_IE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ga_IE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ga_IE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/gu_IN.UTF-8 0755 root bin
+d usr/lib/locale/gu_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/gu_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/gu_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/gu_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/gu_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/gu_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/gu_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/gu_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/gu_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/gu_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/gu_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/gu_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/he_IL.UTF-8 0755 root bin
+d usr/lib/locale/he_IL.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/he_IL.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/he_IL.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/he_IL.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/he_IL.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/he_IL.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/he_IL.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/he_IL.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/he_IL.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/he_IL.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/he_IL.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/he_IL.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/hi_IN.UTF-8 0755 root bin
+d usr/lib/locale/hi_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/hi_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/hi_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/hi_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/hi_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/hi_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/hi_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/hi_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/hi_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/hi_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/hi_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/hi_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.ISO8859-2 0755 root bin
+d usr/lib/locale/hr_HR.ISO8859-2/LC_COLLATE 0755 root bin
+f usr/lib/locale/hr_HR.ISO8859-2/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.ISO8859-2/LC_CTYPE 0755 root bin
+f usr/lib/locale/hr_HR.ISO8859-2/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.ISO8859-2/LC_MESSAGES 0755 root bin
+f usr/lib/locale/hr_HR.ISO8859-2/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.ISO8859-2/LC_MONETARY 0755 root bin
+f usr/lib/locale/hr_HR.ISO8859-2/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.ISO8859-2/LC_NUMERIC 0755 root bin
+f usr/lib/locale/hr_HR.ISO8859-2/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.ISO8859-2/LC_TIME 0755 root bin
+f usr/lib/locale/hr_HR.ISO8859-2/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.UTF-8 0755 root bin
+d usr/lib/locale/hr_HR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/hr_HR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/hr_HR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/hr_HR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/hr_HR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/hr_HR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/hr_HR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/hr_HR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.ISO8859-2 0755 root bin
+d usr/lib/locale/hu_HU.ISO8859-2/LC_COLLATE 0755 root bin
+f usr/lib/locale/hu_HU.ISO8859-2/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.ISO8859-2/LC_CTYPE 0755 root bin
+f usr/lib/locale/hu_HU.ISO8859-2/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.ISO8859-2/LC_MESSAGES 0755 root bin
+f usr/lib/locale/hu_HU.ISO8859-2/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.ISO8859-2/LC_MONETARY 0755 root bin
+f usr/lib/locale/hu_HU.ISO8859-2/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.ISO8859-2/LC_NUMERIC 0755 root bin
+f usr/lib/locale/hu_HU.ISO8859-2/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.ISO8859-2/LC_TIME 0755 root bin
+f usr/lib/locale/hu_HU.ISO8859-2/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.UTF-8 0755 root bin
+d usr/lib/locale/hu_HU.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/hu_HU.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/hu_HU.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/hu_HU.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/hu_HU.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/hu_HU.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/hu_HU.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/hu_HU.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/hy_AM.UTF-8 0755 root bin
+d usr/lib/locale/hy_AM.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/hy_AM.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/hy_AM.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/hy_AM.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/hy_AM.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/hy_AM.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/hy_AM.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/hy_AM.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/hy_AM.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/hy_AM.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/hy_AM.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/hy_AM.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/id_ID.UTF-8 0755 root bin
+d usr/lib/locale/id_ID.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/id_ID.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/id_ID.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/id_ID.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/id_ID.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/id_ID.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/id_ID.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/id_ID.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/id_ID.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/id_ID.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/id_ID.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/id_ID.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ii_CN.UTF-8 0755 root bin
+d usr/lib/locale/ii_CN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ii_CN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ii_CN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ii_CN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ii_CN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ii_CN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ii_CN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ii_CN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ii_CN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ii_CN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ii_CN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ii_CN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.ISO8859-1 0755 root bin
+d usr/lib/locale/is_IS.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/is_IS.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/is_IS.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/is_IS.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/is_IS.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/is_IS.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/is_IS.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.UTF-8 0755 root bin
+d usr/lib/locale/is_IS.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/is_IS.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/is_IS.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/is_IS.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/is_IS.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/is_IS.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/is_IS.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/is_IS.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.ISO8859-1 0755 root bin
+d usr/lib/locale/it_CH.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/it_CH.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/it_CH.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/it_CH.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/it_CH.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/it_CH.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/it_CH.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.UTF-8 0755 root bin
+d usr/lib/locale/it_CH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/it_CH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/it_CH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/it_CH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/it_CH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/it_CH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/it_CH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/it_CH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-1 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-1/LC_CTYPE 0755 root bin
+h usr/lib/locale/it_IT.ISO8859-1/LC_CTYPE/LCL_DATA=usr/lib/locale/da_DK.ISO8859-1/LC_CTYPE/LCL_DATA
+d usr/lib/locale/it_IT.ISO8859-1/LC_MESSAGES 0755 root bin
+h usr/lib/locale/it_IT.ISO8859-1/LC_MESSAGES/LCL_DATA=usr/lib/locale/it_CH.ISO8859-1/LC_MESSAGES/LCL_DATA
+d usr/lib/locale/it_IT.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-15 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/it_IT.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.UTF-8 0755 root bin
+d usr/lib/locale/it_IT.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/it_IT.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/it_IT.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/it_IT.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/it_IT.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/it_IT.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/it_IT.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/it_IT.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ja_JP.UTF-8 0755 root bin
+d usr/lib/locale/ja_JP.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ja_JP.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ja_JP.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ja_JP.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ja_JP.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ja_JP.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ja_JP.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ja_JP.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ja_JP.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ja_JP.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ja_JP.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ja_JP.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ka_GE.UTF-8 0755 root bin
+d usr/lib/locale/ka_GE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ka_GE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ka_GE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ka_GE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ka_GE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ka_GE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ka_GE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ka_GE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ka_GE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ka_GE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ka_GE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ka_GE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/kk_KZ.UTF-8 0755 root bin
+d usr/lib/locale/kk_KZ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/kk_KZ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/kk_KZ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/kk_KZ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/kk_KZ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/kk_KZ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/kk_KZ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/kk_KZ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/kk_KZ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/kk_KZ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/kk_KZ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/kk_KZ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/km_KH.UTF-8 0755 root bin
+d usr/lib/locale/km_KH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/km_KH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/km_KH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/km_KH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/km_KH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/km_KH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/km_KH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/km_KH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/km_KH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/km_KH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/km_KH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/km_KH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/kn_IN.UTF-8 0755 root bin
+d usr/lib/locale/kn_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/kn_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/kn_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/kn_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/kn_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/kn_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/kn_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/kn_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/kn_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/kn_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/kn_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/kn_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ko_KR.UTF-8 0755 root bin
+d usr/lib/locale/ko_KR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ko_KR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ko_KR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ko_KR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ko_KR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ko_KR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ko_KR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ko_KR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ko_KR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ko_KR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ko_KR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ko_KR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/kok_IN.UTF-8 0755 root bin
+d usr/lib/locale/kok_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/kok_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/kok_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/kok_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/kok_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/kok_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/kok_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/kok_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/kok_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/kok_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/kok_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/kok_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.ISO8859-13 0755 root bin
+d usr/lib/locale/lt_LT.ISO8859-13/LC_COLLATE 0755 root bin
+f usr/lib/locale/lt_LT.ISO8859-13/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.ISO8859-13/LC_CTYPE 0755 root bin
+f usr/lib/locale/lt_LT.ISO8859-13/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.ISO8859-13/LC_MESSAGES 0755 root bin
+f usr/lib/locale/lt_LT.ISO8859-13/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.ISO8859-13/LC_MONETARY 0755 root bin
+f usr/lib/locale/lt_LT.ISO8859-13/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.ISO8859-13/LC_NUMERIC 0755 root bin
+f usr/lib/locale/lt_LT.ISO8859-13/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.ISO8859-13/LC_TIME 0755 root bin
+f usr/lib/locale/lt_LT.ISO8859-13/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.UTF-8 0755 root bin
+d usr/lib/locale/lt_LT.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/lt_LT.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/lt_LT.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/lt_LT.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/lt_LT.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/lt_LT.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/lt_LT.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/lt_LT.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.ISO8859-13 0755 root bin
+d usr/lib/locale/lv_LV.ISO8859-13/LC_COLLATE 0755 root bin
+f usr/lib/locale/lv_LV.ISO8859-13/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.ISO8859-13/LC_CTYPE 0755 root bin
+f usr/lib/locale/lv_LV.ISO8859-13/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.ISO8859-13/LC_MESSAGES 0755 root bin
+f usr/lib/locale/lv_LV.ISO8859-13/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.ISO8859-13/LC_MONETARY 0755 root bin
+f usr/lib/locale/lv_LV.ISO8859-13/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.ISO8859-13/LC_NUMERIC 0755 root bin
+f usr/lib/locale/lv_LV.ISO8859-13/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.ISO8859-13/LC_TIME 0755 root bin
+f usr/lib/locale/lv_LV.ISO8859-13/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.UTF-8 0755 root bin
+d usr/lib/locale/lv_LV.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/lv_LV.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/lv_LV.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/lv_LV.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/lv_LV.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/lv_LV.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/lv_LV.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/lv_LV.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.ISO8859-5 0755 root bin
+d usr/lib/locale/mk_MK.ISO8859-5/LC_COLLATE 0755 root bin
+f usr/lib/locale/mk_MK.ISO8859-5/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.ISO8859-5/LC_CTYPE 0755 root bin
+f usr/lib/locale/mk_MK.ISO8859-5/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.ISO8859-5/LC_MESSAGES 0755 root bin
+f usr/lib/locale/mk_MK.ISO8859-5/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.ISO8859-5/LC_MONETARY 0755 root bin
+f usr/lib/locale/mk_MK.ISO8859-5/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.ISO8859-5/LC_NUMERIC 0755 root bin
+f usr/lib/locale/mk_MK.ISO8859-5/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.ISO8859-5/LC_TIME 0755 root bin
+f usr/lib/locale/mk_MK.ISO8859-5/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.UTF-8 0755 root bin
+d usr/lib/locale/mk_MK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/mk_MK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/mk_MK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/mk_MK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/mk_MK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/mk_MK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/mk_MK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/mk_MK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ml_IN.UTF-8 0755 root bin
+d usr/lib/locale/ml_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ml_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ml_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ml_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ml_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ml_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ml_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ml_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ml_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ml_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ml_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ml_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_CN.UTF-8 0755 root bin
+d usr/lib/locale/mn_CN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/mn_CN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_CN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/mn_CN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_CN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/mn_CN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_CN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/mn_CN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_CN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/mn_CN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_CN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/mn_CN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_MN.UTF-8 0755 root bin
+d usr/lib/locale/mn_MN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/mn_MN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_MN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/mn_MN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_MN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/mn_MN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_MN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/mn_MN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_MN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/mn_MN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/mn_MN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/mn_MN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/mr_IN.UTF-8 0755 root bin
+d usr/lib/locale/mr_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/mr_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/mr_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/mr_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/mr_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/mr_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/mr_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/mr_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/mr_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/mr_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/mr_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/mr_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ms_MY.UTF-8 0755 root bin
+d usr/lib/locale/ms_MY.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ms_MY.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ms_MY.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ms_MY.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ms_MY.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ms_MY.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ms_MY.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ms_MY.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ms_MY.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ms_MY.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ms_MY.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ms_MY.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/mt_MT.UTF-8 0755 root bin
+d usr/lib/locale/mt_MT.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/mt_MT.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/mt_MT.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/mt_MT.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/mt_MT.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/mt_MT.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/mt_MT.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/mt_MT.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/mt_MT.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/mt_MT.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/mt_MT.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/mt_MT.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/nb_NO.UTF-8 0755 root bin
+d usr/lib/locale/nb_NO.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/nb_NO.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/nb_NO.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/nb_NO.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/nb_NO.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/nb_NO.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/nb_NO.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/nb_NO.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/nb_NO.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/nb_NO.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/nb_NO.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/nb_NO.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_IN.UTF-8 0755 root bin
+d usr/lib/locale/ne_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ne_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ne_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ne_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ne_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ne_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ne_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_NP.UTF-8 0755 root bin
+d usr/lib/locale/ne_NP.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ne_NP.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_NP.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ne_NP.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_NP.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ne_NP.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_NP.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ne_NP.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_NP.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ne_NP.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ne_NP.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ne_NP.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.ISO8859-15 0755 root bin
+d usr/lib/locale/nl_BE.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/nl_BE.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/nl_BE.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/nl_BE.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/nl_BE.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/nl_BE.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/nl_BE.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.UTF-8 0755 root bin
+d usr/lib/locale/nl_BE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/nl_BE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/nl_BE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/nl_BE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/nl_BE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/nl_BE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_BE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/nl_BE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.ISO8859-15 0755 root bin
+d usr/lib/locale/nl_NL.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/nl_NL.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/nl_NL.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/nl_NL.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/nl_NL.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/nl_NL.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/nl_NL.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.UTF-8 0755 root bin
+d usr/lib/locale/nl_NL.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/nl_NL.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/nl_NL.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/nl_NL.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/nl_NL.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/nl_NL.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/nl_NL.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/nl_NL.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/nn_NO.UTF-8 0755 root bin
+d usr/lib/locale/nn_NO.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/nn_NO.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/nn_NO.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/nn_NO.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/nn_NO.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/nn_NO.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/nn_NO.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/nn_NO.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/nn_NO.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/nn_NO.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/nn_NO.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/nn_NO.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/or_IN.UTF-8 0755 root bin
+d usr/lib/locale/or_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/or_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/or_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/or_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/or_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/or_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/or_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/or_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/or_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/or_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/or_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/or_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_IN.UTF-8 0755 root bin
+d usr/lib/locale/pa_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/pa_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/pa_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pa_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/pa_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pa_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/pa_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_PK.UTF-8 0755 root bin
+d usr/lib/locale/pa_PK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/pa_PK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_PK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/pa_PK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_PK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pa_PK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_PK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/pa_PK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_PK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pa_PK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pa_PK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/pa_PK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.ISO8859-2 0755 root bin
+d usr/lib/locale/pl_PL.ISO8859-2/LC_COLLATE 0755 root bin
+f usr/lib/locale/pl_PL.ISO8859-2/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.ISO8859-2/LC_CTYPE 0755 root bin
+f usr/lib/locale/pl_PL.ISO8859-2/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.ISO8859-2/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pl_PL.ISO8859-2/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.ISO8859-2/LC_MONETARY 0755 root bin
+f usr/lib/locale/pl_PL.ISO8859-2/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.ISO8859-2/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pl_PL.ISO8859-2/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.ISO8859-2/LC_TIME 0755 root bin
+f usr/lib/locale/pl_PL.ISO8859-2/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.UTF-8 0755 root bin
+d usr/lib/locale/pl_PL.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/pl_PL.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/pl_PL.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pl_PL.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/pl_PL.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pl_PL.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pl_PL.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/pl_PL.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+s usr/lib/locale/POSIX=C
+d usr/lib/locale/pt_BR.UTF-8 0755 root bin
+d usr/lib/locale/pt_BR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/pt_BR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_BR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/pt_BR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_BR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pt_BR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_BR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/pt_BR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_BR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pt_BR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_BR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/pt_BR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_GW.UTF-8 0755 root bin
+d usr/lib/locale/pt_GW.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/pt_GW.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_GW.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/pt_GW.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_GW.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pt_GW.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_GW.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/pt_GW.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_GW.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pt_GW.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_GW.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/pt_GW.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_MZ.UTF-8 0755 root bin
+d usr/lib/locale/pt_MZ.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/pt_MZ.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_MZ.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/pt_MZ.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_MZ.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pt_MZ.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_MZ.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/pt_MZ.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_MZ.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pt_MZ.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_MZ.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/pt_MZ.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.ISO8859-15 0755 root bin
+d usr/lib/locale/pt_PT.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/pt_PT.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/pt_PT.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pt_PT.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/pt_PT.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pt_PT.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/pt_PT.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.UTF-8 0755 root bin
+d usr/lib/locale/pt_PT.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/pt_PT.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/pt_PT.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/pt_PT.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/pt_PT.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/pt_PT.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/pt_PT.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/pt_PT.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_MD.UTF-8 0755 root bin
+d usr/lib/locale/ro_MD.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ro_MD.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_MD.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ro_MD.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_MD.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ro_MD.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_MD.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ro_MD.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_MD.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ro_MD.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_MD.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ro_MD.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_RO.UTF-8 0755 root bin
+d usr/lib/locale/ro_RO.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ro_RO.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_RO.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ro_RO.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_RO.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ro_RO.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_RO.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ro_RO.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_RO.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ro_RO.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ro_RO.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ro_RO.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_MD.UTF-8 0755 root bin
+d usr/lib/locale/ru_MD.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ru_MD.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_MD.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ru_MD.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_MD.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ru_MD.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_MD.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ru_MD.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_MD.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ru_MD.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_MD.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ru_MD.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.ISO8859-5 0755 root bin
+d usr/lib/locale/ru_RU.ISO8859-5/LC_COLLATE 0755 root bin
+f usr/lib/locale/ru_RU.ISO8859-5/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.ISO8859-5/LC_CTYPE 0755 root bin
+f usr/lib/locale/ru_RU.ISO8859-5/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.ISO8859-5/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ru_RU.ISO8859-5/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.ISO8859-5/LC_MONETARY 0755 root bin
+f usr/lib/locale/ru_RU.ISO8859-5/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.ISO8859-5/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ru_RU.ISO8859-5/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.ISO8859-5/LC_TIME 0755 root bin
+f usr/lib/locale/ru_RU.ISO8859-5/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.KOI8-R 0755 root bin
+d usr/lib/locale/ru_RU.KOI8-R/LC_COLLATE 0755 root bin
+f usr/lib/locale/ru_RU.KOI8-R/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.KOI8-R/LC_CTYPE 0755 root bin
+f usr/lib/locale/ru_RU.KOI8-R/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.KOI8-R/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ru_RU.KOI8-R/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.KOI8-R/LC_MONETARY 0755 root bin
+f usr/lib/locale/ru_RU.KOI8-R/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.KOI8-R/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ru_RU.KOI8-R/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.KOI8-R/LC_TIME 0755 root bin
+f usr/lib/locale/ru_RU.KOI8-R/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.UTF-8 0755 root bin
+d usr/lib/locale/ru_RU.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ru_RU.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ru_RU.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ru_RU.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ru_RU.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ru_RU.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_RU.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ru_RU.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_UA.UTF-8 0755 root bin
+d usr/lib/locale/ru_UA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ru_UA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_UA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ru_UA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_UA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ru_UA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_UA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ru_UA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_UA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ru_UA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ru_UA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ru_UA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sa_IN.UTF-8 0755 root bin
+d usr/lib/locale/sa_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sa_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sa_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sa_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sa_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sa_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sa_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sa_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sa_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sa_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sa_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sa_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/si_LK.UTF-8 0755 root bin
+d usr/lib/locale/si_LK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/si_LK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/si_LK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/si_LK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/si_LK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/si_LK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/si_LK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/si_LK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/si_LK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/si_LK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/si_LK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/si_LK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sk_SK.UTF-8 0755 root bin
+d usr/lib/locale/sk_SK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sk_SK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sk_SK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sk_SK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sk_SK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sk_SK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sk_SK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sk_SK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sk_SK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sk_SK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sk_SK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sk_SK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sl_SI.UTF-8 0755 root bin
+d usr/lib/locale/sl_SI.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sl_SI.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sl_SI.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sl_SI.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sl_SI.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sl_SI.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sl_SI.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sl_SI.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sl_SI.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sl_SI.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sl_SI.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sl_SI.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.ISO8859-2 0755 root bin
+d usr/lib/locale/sq_AL.ISO8859-2/LC_COLLATE 0755 root bin
+f usr/lib/locale/sq_AL.ISO8859-2/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.ISO8859-2/LC_CTYPE 0755 root bin
+f usr/lib/locale/sq_AL.ISO8859-2/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.ISO8859-2/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sq_AL.ISO8859-2/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.ISO8859-2/LC_MONETARY 0755 root bin
+f usr/lib/locale/sq_AL.ISO8859-2/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.ISO8859-2/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sq_AL.ISO8859-2/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.ISO8859-2/LC_TIME 0755 root bin
+f usr/lib/locale/sq_AL.ISO8859-2/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.UTF-8 0755 root bin
+d usr/lib/locale/sq_AL.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sq_AL.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sq_AL.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sq_AL.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sq_AL.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sq_AL.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sq_AL.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sq_AL.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_BA.UTF-8 0755 root bin
+d usr/lib/locale/sr_BA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sr_BA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_BA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sr_BA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_BA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sr_BA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_BA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sr_BA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_BA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sr_BA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_BA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sr_BA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_ME.UTF-8 0755 root bin
+d usr/lib/locale/sr_ME.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sr_ME.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_ME.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sr_ME.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_ME.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sr_ME.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_ME.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sr_ME.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_ME.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sr_ME.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_ME.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sr_ME.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_RS.UTF-8 0755 root bin
+d usr/lib/locale/sr_RS.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sr_RS.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_RS.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sr_RS.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_RS.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sr_RS.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_RS.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sr_RS.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_RS.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sr_RS.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sr_RS.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sr_RS.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.ISO8859-15 0755 root bin
+d usr/lib/locale/sv_FI.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/sv_FI.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/sv_FI.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sv_FI.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/sv_FI.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sv_FI.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/sv_FI.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.UTF-8 0755 root bin
+d usr/lib/locale/sv_FI.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sv_FI.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sv_FI.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sv_FI.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sv_FI.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sv_FI.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_FI.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sv_FI.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-1 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-1/LC_COLLATE 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-1/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-1/LC_CTYPE 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-1/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-1/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-1/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-1/LC_MONETARY 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-1/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-1/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-1/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-1/LC_TIME 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-1/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-15 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-15/LC_COLLATE 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-15/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-15/LC_CTYPE 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-15/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-15/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-15/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-15/LC_MONETARY 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-15/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-15/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-15/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.ISO8859-15/LC_TIME 0755 root bin
+f usr/lib/locale/sv_SE.ISO8859-15/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.UTF-8 0755 root bin
+d usr/lib/locale/sv_SE.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/sv_SE.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/sv_SE.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/sv_SE.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/sv_SE.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/sv_SE.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/sv_SE.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/sv_SE.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_IN.UTF-8 0755 root bin
+d usr/lib/locale/ta_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ta_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ta_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ta_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ta_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ta_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ta_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_LK.UTF-8 0755 root bin
+d usr/lib/locale/ta_LK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ta_LK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_LK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ta_LK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_LK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ta_LK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_LK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ta_LK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_LK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ta_LK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ta_LK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ta_LK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/te_IN.UTF-8 0755 root bin
+d usr/lib/locale/te_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/te_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/te_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/te_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/te_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/te_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/te_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/te_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/te_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/te_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/te_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/te_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.ISO8859-11 0755 root bin
+d usr/lib/locale/th_TH.ISO8859-11/LC_COLLATE 0755 root bin
+f usr/lib/locale/th_TH.ISO8859-11/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.ISO8859-11/LC_CTYPE 0755 root bin
+f usr/lib/locale/th_TH.ISO8859-11/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.ISO8859-11/LC_MESSAGES 0755 root bin
+f usr/lib/locale/th_TH.ISO8859-11/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.ISO8859-11/LC_MONETARY 0755 root bin
+f usr/lib/locale/th_TH.ISO8859-11/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.ISO8859-11/LC_NUMERIC 0755 root bin
+f usr/lib/locale/th_TH.ISO8859-11/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.ISO8859-11/LC_TIME 0755 root bin
+f usr/lib/locale/th_TH.ISO8859-11/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.UTF-8 0755 root bin
+d usr/lib/locale/th_TH.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/th_TH.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/th_TH.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/th_TH.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/th_TH.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/th_TH.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/th_TH.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/th_TH.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.ISO8859-9 0755 root bin
+d usr/lib/locale/tr_TR.ISO8859-9/LC_COLLATE 0755 root bin
+f usr/lib/locale/tr_TR.ISO8859-9/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.ISO8859-9/LC_CTYPE 0755 root bin
+f usr/lib/locale/tr_TR.ISO8859-9/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.ISO8859-9/LC_MESSAGES 0755 root bin
+f usr/lib/locale/tr_TR.ISO8859-9/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.ISO8859-9/LC_MONETARY 0755 root bin
+f usr/lib/locale/tr_TR.ISO8859-9/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.ISO8859-9/LC_NUMERIC 0755 root bin
+f usr/lib/locale/tr_TR.ISO8859-9/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.ISO8859-9/LC_TIME 0755 root bin
+f usr/lib/locale/tr_TR.ISO8859-9/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.UTF-8 0755 root bin
+d usr/lib/locale/tr_TR.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/tr_TR.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/tr_TR.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/tr_TR.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/tr_TR.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/tr_TR.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/tr_TR.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/tr_TR.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ug_CN.UTF-8 0755 root bin
+d usr/lib/locale/ug_CN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ug_CN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ug_CN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ug_CN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ug_CN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ug_CN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ug_CN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ug_CN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ug_CN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ug_CN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ug_CN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ug_CN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/uk_UA.UTF-8 0755 root bin
+d usr/lib/locale/uk_UA.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/uk_UA.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/uk_UA.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/uk_UA.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/uk_UA.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/uk_UA.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/uk_UA.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/uk_UA.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/uk_UA.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/uk_UA.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/uk_UA.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/uk_UA.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_IN.UTF-8 0755 root bin
+d usr/lib/locale/ur_IN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ur_IN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_IN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ur_IN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_IN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ur_IN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_IN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ur_IN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_IN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ur_IN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_IN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ur_IN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_PK.UTF-8 0755 root bin
+d usr/lib/locale/ur_PK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/ur_PK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_PK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/ur_PK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_PK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/ur_PK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_PK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/ur_PK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_PK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/ur_PK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/ur_PK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/ur_PK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/vi_VN.UTF-8 0755 root bin
+d usr/lib/locale/vi_VN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/vi_VN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/vi_VN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/vi_VN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/vi_VN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/vi_VN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/vi_VN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/vi_VN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/vi_VN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/vi_VN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/vi_VN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/vi_VN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_CN.UTF-8 0755 root bin
+d usr/lib/locale/zh_CN.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/zh_CN.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_CN.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/zh_CN.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_CN.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/zh_CN.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_CN.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/zh_CN.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_CN.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/zh_CN.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_CN.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/zh_CN.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_HK.UTF-8 0755 root bin
+d usr/lib/locale/zh_HK.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/zh_HK.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_HK.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/zh_HK.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_HK.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/zh_HK.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_HK.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/zh_HK.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_HK.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/zh_HK.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_HK.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/zh_HK.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_MO.UTF-8 0755 root bin
+d usr/lib/locale/zh_MO.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/zh_MO.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_MO.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/zh_MO.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_MO.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/zh_MO.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_MO.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/zh_MO.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_MO.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/zh_MO.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_MO.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/zh_MO.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_SG.UTF-8 0755 root bin
+d usr/lib/locale/zh_SG.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/zh_SG.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_SG.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/zh_SG.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_SG.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/zh_SG.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_SG.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/zh_SG.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_SG.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/zh_SG.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_SG.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/zh_SG.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_TW.UTF-8 0755 root bin
+d usr/lib/locale/zh_TW.UTF-8/LC_COLLATE 0755 root bin
+f usr/lib/locale/zh_TW.UTF-8/LC_COLLATE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_TW.UTF-8/LC_CTYPE 0755 root bin
+f usr/lib/locale/zh_TW.UTF-8/LC_CTYPE/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_TW.UTF-8/LC_MESSAGES 0755 root bin
+f usr/lib/locale/zh_TW.UTF-8/LC_MESSAGES/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_TW.UTF-8/LC_MONETARY 0755 root bin
+f usr/lib/locale/zh_TW.UTF-8/LC_MONETARY/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_TW.UTF-8/LC_NUMERIC 0755 root bin
+f usr/lib/locale/zh_TW.UTF-8/LC_NUMERIC/LCL_DATA 0755 root bin
+d usr/lib/locale/zh_TW.UTF-8/LC_TIME 0755 root bin
+f usr/lib/locale/zh_TW.UTF-8/LC_TIME/LCL_DATA 0755 root bin
+d usr/lib/localedef 0755 root bin
+d usr/lib/localedef/src 0755 root bin
+f usr/lib/lslabels 0555 root bin
+d usr/lib/lwp 0755 root bin
+s usr/lib/lwp/32=.
+s usr/lib/lwp/64=amd64
+d usr/lib/lwp/amd64 0755 root bin
+s usr/lib/lwp/amd64/libthread.so.1=../../amd64/libthread.so.1
+s usr/lib/lwp/amd64/libthread_db.so.1=../../amd64/libthread_db.so.1
+s usr/lib/lwp/libthread.so.1=../libthread.so.1
+s usr/lib/lwp/libthread_db.so.1=../libthread_db.so.1
+f usr/lib/madv.so.1 0755 root bin
+f usr/lib/mail.local 0555 root bin
+f usr/lib/makekey 0555 root bin
+f usr/lib/makewhatis 0555 root bin
+d usr/lib/mdb 0755 root sys
+d usr/lib/mdb/kvm 0755 root sys
+d usr/lib/mdb/kvm/amd64 0755 root sys
+f usr/lib/mdb/kvm/amd64/arp.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/cpc.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/cpu.generic.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/cpu_ms.AuthenticAMD.15.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/crypto.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/dtrace.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/emlxs.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/fcip.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/fcp.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/fctl.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/genunix.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/hook.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/idm.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/ii.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/ip.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/ipc.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/ipp.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/krtld.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/lofs.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/logindmux.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/mac.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/md.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/mdb_kb.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/mdb_ks.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/mpt.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/mpt_sas.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/mr_sas.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/nca.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/neti.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/nfs.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/nsctl.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/nsmb.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/pmcs.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/ptm.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/qlc.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/random.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/rdc.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/s1394.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/sata.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/scsi_vhci.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/sctp.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/sd.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/sdbc.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/smbfs.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/smbsrv.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/sockfs.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/specfs.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/sppp.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/srpt.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/stmf.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/stmf_sbd.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/sv.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/ufs.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/uhci.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/usba.so 0555 root sys
+f usr/lib/mdb/kvm/amd64/zfs.so 0555 root sys
+f usr/lib/mdb/kvm/arp.so 0555 root sys
+f usr/lib/mdb/kvm/cpc.so 0555 root sys
+f usr/lib/mdb/kvm/cpu.generic.so 0555 root sys
+f usr/lib/mdb/kvm/cpu_ms.AuthenticAMD.15.so 0555 root sys
+f usr/lib/mdb/kvm/crypto.so 0555 root sys
+f usr/lib/mdb/kvm/dtrace.so 0555 root sys
+f usr/lib/mdb/kvm/emlxs.so 0555 root sys
+f usr/lib/mdb/kvm/fcip.so 0555 root sys
+f usr/lib/mdb/kvm/fcp.so 0555 root sys
+f usr/lib/mdb/kvm/fctl.so 0555 root sys
+f usr/lib/mdb/kvm/genunix.so 0555 root sys
+f usr/lib/mdb/kvm/hook.so 0555 root sys
+f usr/lib/mdb/kvm/idm.so 0555 root sys
+f usr/lib/mdb/kvm/ii.so 0555 root sys
+f usr/lib/mdb/kvm/ip.so 0555 root sys
+f usr/lib/mdb/kvm/ipc.so 0555 root sys
+f usr/lib/mdb/kvm/ipp.so 0555 root sys
+f usr/lib/mdb/kvm/krtld.so 0555 root sys
+f usr/lib/mdb/kvm/lofs.so 0555 root sys
+f usr/lib/mdb/kvm/logindmux.so 0555 root sys
+f usr/lib/mdb/kvm/mac.so 0555 root sys
+f usr/lib/mdb/kvm/md.so 0555 root sys
+f usr/lib/mdb/kvm/mdb_kb.so 0555 root sys
+f usr/lib/mdb/kvm/mdb_ks.so 0555 root sys
+f usr/lib/mdb/kvm/mpt.so 0555 root sys
+f usr/lib/mdb/kvm/mpt_sas.so 0555 root sys
+f usr/lib/mdb/kvm/mr_sas.so 0555 root sys
+f usr/lib/mdb/kvm/nca.so 0555 root sys
+f usr/lib/mdb/kvm/neti.so 0555 root sys
+f usr/lib/mdb/kvm/nfs.so 0555 root sys
+f usr/lib/mdb/kvm/nsctl.so 0555 root sys
+f usr/lib/mdb/kvm/nsmb.so 0555 root sys
+f usr/lib/mdb/kvm/pmcs.so 0555 root sys
+f usr/lib/mdb/kvm/ptm.so 0555 root sys
+f usr/lib/mdb/kvm/qlc.so 0555 root sys
+f usr/lib/mdb/kvm/random.so 0555 root sys
+f usr/lib/mdb/kvm/rdc.so 0555 root sys
+f usr/lib/mdb/kvm/s1394.so 0555 root sys
+f usr/lib/mdb/kvm/sata.so 0555 root sys
+f usr/lib/mdb/kvm/scsi_vhci.so 0555 root sys
+f usr/lib/mdb/kvm/sctp.so 0555 root sys
+f usr/lib/mdb/kvm/sd.so 0555 root sys
+f usr/lib/mdb/kvm/sdbc.so 0555 root sys
+f usr/lib/mdb/kvm/smbfs.so 0555 root sys
+f usr/lib/mdb/kvm/smbsrv.so 0555 root sys
+f usr/lib/mdb/kvm/sockfs.so 0555 root sys
+f usr/lib/mdb/kvm/specfs.so 0555 root sys
+f usr/lib/mdb/kvm/sppp.so 0555 root sys
+f usr/lib/mdb/kvm/srpt.so 0555 root sys
+f usr/lib/mdb/kvm/stmf.so 0555 root sys
+f usr/lib/mdb/kvm/stmf_sbd.so 0555 root sys
+f usr/lib/mdb/kvm/sv.so 0555 root sys
+f usr/lib/mdb/kvm/ufs.so 0555 root sys
+f usr/lib/mdb/kvm/uhci.so 0555 root sys
+f usr/lib/mdb/kvm/usba.so 0555 root sys
+f usr/lib/mdb/kvm/zfs.so 0555 root sys
+d usr/lib/mdb/proc 0755 root sys
+d usr/lib/mdb/proc/amd64 0755 root sys
+f usr/lib/mdb/proc/amd64/ld.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libavl.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libc.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libcmdutils.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libnvpair.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libproc.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libpython2.6.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libsysevent.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libtopo.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libumem.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libuutil.so 0555 root sys
+f usr/lib/mdb/proc/amd64/libzpool.so 0555 root sys
+f usr/lib/mdb/proc/amd64/mdb_ds.so 0555 root sys
+f usr/lib/mdb/proc/amd64/mdb_test.so 0555 root sys
+f usr/lib/mdb/proc/eft.so 0555 root sys
+f usr/lib/mdb/proc/fmd.so 0555 root sys
+f usr/lib/mdb/proc/ld.so 0555 root sys
+f usr/lib/mdb/proc/libavl.so 0555 root sys
+f usr/lib/mdb/proc/libc.so 0555 root sys
+f usr/lib/mdb/proc/libcmdutils.so 0555 root sys
+f usr/lib/mdb/proc/libnvpair.so 0555 root sys
+f usr/lib/mdb/proc/libproc.so 0555 root sys
+f usr/lib/mdb/proc/libpython2.6.so 0555 root sys
+f usr/lib/mdb/proc/libsysevent.so 0555 root sys
+f usr/lib/mdb/proc/libtopo.so 0555 root sys
+f usr/lib/mdb/proc/libumem.so 0555 root sys
+f usr/lib/mdb/proc/libuutil.so 0555 root sys
+f usr/lib/mdb/proc/libzpool.so 0555 root sys
+f usr/lib/mdb/proc/mdb_ds.so 0555 root sys
+f usr/lib/mdb/proc/mdb_test.so 0555 root sys
+f usr/lib/mdb/proc/svc.configd.so 0555 root sys
+f usr/lib/mdb/proc/svc.startd.so 0555 root sys
+f usr/lib/mdb/proc/v8.so 0555 root sys
+d usr/lib/mdb/raw 0755 root sys
+d usr/lib/mdb/raw/amd64 0755 root sys
+f usr/lib/mdb/raw/amd64/dof.so 0555 root sys
+f usr/lib/mdb/raw/dof.so 0555 root sys
+f usr/lib/more.help 0644 root bin
+f usr/lib/mpss.so.1 0755 root bin
+f usr/lib/ncad_addr.so.1 0755 root bin
+s usr/lib/ncad_addr.so=ncad_addr.so.1
+f usr/lib/ncalladm 0555 root bin
+d usr/lib/ndmp 0755 root bin
+f usr/lib/ndmp/ndmpd 0555 root bin
+d usr/lib/netsvc 0755 root sys
+d usr/lib/netsvc/nis 0755 root sys
+d usr/lib/netsvc/rstat 0755 root sys
+f usr/lib/netsvc/rstat/rpc.rstatd 0555 root sys
+d usr/lib/netsvc/rusers 0755 root sys
+f usr/lib/netsvc/rusers/rpc.rusersd 0555 root sys
+d usr/lib/netsvc/rwall 0755 root sys
+f usr/lib/netsvc/rwall/rpc.rwalld 0555 root sys
+d usr/lib/netsvc/spray 0755 root sys
+f usr/lib/netsvc/spray/rpc.sprayd 0555 root sys
+d usr/lib/netsvc/yp 0755 root bin
+f usr/lib/netsvc/yp/inityp2l 0555 root sys
+f usr/lib/netsvc/yp/mkalias 0555 root sys
+f usr/lib/netsvc/yp/multi 0555 root sys
+f usr/lib/netsvc/yp/multi.awk 0555 root sys
+f usr/lib/netsvc/yp/rpc.yppasswdd 0555 root sys
+f usr/lib/netsvc/yp/rpc.ypupdated 0555 root sys
+f usr/lib/netsvc/yp/stdethers 0555 root sys
+f usr/lib/netsvc/yp/stdhosts 0555 root sys
+f usr/lib/netsvc/yp/udpublickey 0555 root sys
+f usr/lib/netsvc/yp/ypbind 0555 root bin
+f usr/lib/netsvc/yp/ypmap2src 0555 root sys
+f usr/lib/netsvc/yp/yppush 0555 root sys
+f usr/lib/netsvc/yp/ypserv 0555 root sys
+f usr/lib/netsvc/yp/ypstart 0555 root bin
+f usr/lib/netsvc/yp/ypstop 0555 root bin
+f usr/lib/netsvc/yp/ypxfr 0555 root bin
+f usr/lib/netsvc/yp/ypxfr_1perday 0555 root sys
+f usr/lib/netsvc/yp/ypxfr_1perhour 0555 root sys
+f usr/lib/netsvc/yp/ypxfr_2perday 0555 root sys
+f usr/lib/netsvc/yp/ypxfrd 0555 root sys
+f usr/lib/newsyslog 0555 root sys
+d usr/lib/nfs 0755 root sys
+f usr/lib/nfs/libmapid.so.1 0755 root bin
+s usr/lib/nfs/libmapid.so=libmapid.so.1
+f usr/lib/nfs/lockd 0555 root bin
+f usr/lib/nfs/mountd 0555 root bin
+f usr/lib/nfs/nfs4cbd 0555 root bin
+f usr/lib/nfs/nfsd 0555 root bin
+f usr/lib/nfs/nfslogd 0555 root bin
+f usr/lib/nfs/nfsmapid 0555 root bin
+f usr/lib/nfs/rquotad 0555 root bin
+f usr/lib/nfs/statd 0555 root bin
+f usr/lib/nskernd 0555 root bin
+f usr/lib/nss_ad.so.1 0755 root bin
+s usr/lib/nss_compat.so.1=../../lib/nss_compat.so.1
+s usr/lib/nss_dns.so.1=../../lib/nss_dns.so.1
+s usr/lib/nss_files.so.1=../../lib/nss_files.so.1
+f usr/lib/nss_ldap.so.1 0755 root bin
+f usr/lib/nss_mdns.so.1 0755 root bin
+s usr/lib/nss_nis.so.1=../../lib/nss_nis.so.1
+s usr/lib/nss_user.so.1=../../lib/nss_user.so.1
+f usr/lib/passmgmt 0555 root sys
+f usr/lib/passwdutil.so.1 0755 root bin
+d usr/lib/pci 0755 root bin
+f usr/lib/pci/pcidr 0555 root bin
+f usr/lib/pci/pcidr_plugin.so 0755 root bin
+f usr/lib/pfexecd 0555 root bin
+d usr/lib/picl 0755 root sys
+f usr/lib/picl/picld 0555 root sys
+d usr/lib/picl/plugins 0755 root sys
+f usr/lib/picl/plugins/fru_container.conf 0644 root sys
+f usr/lib/picl/plugins/libpicldevtree.so.1 0755 root sys
+s usr/lib/picl/plugins/libpicldevtree.so=libpicldevtree.so.1
+f usr/lib/picl/plugins/libpiclevent.so.1 0755 root sys
+s usr/lib/picl/plugins/libpiclevent.so=libpiclevent.so.1
+f usr/lib/picl/plugins/libpiclfrutree.so.1 0755 root sys
+s usr/lib/picl/plugins/libpiclfrutree.so=libpiclfrutree.so.1
+f usr/lib/picl/plugins/libpiclmemcfg.so.1 0755 root sys
+s usr/lib/picl/plugins/libpiclmemcfg.so=libpiclmemcfg.so.1
+d usr/lib/pkgconfig 0755 root bin
+f usr/lib/platexec 0555 root bin
+d usr/lib/pool 0755 root bin
+f usr/lib/pool/libjkstat.so.1 0755 root bin
+s usr/lib/pool/libjkstat.so=libjkstat.so.1
+f usr/lib/pool/libjlgrp.so.1 0755 root bin
+s usr/lib/pool/libjlgrp.so=libjlgrp.so.1
+f usr/lib/pool/libjpool.so.1 0755 root bin
+s usr/lib/pool/libjpool.so=libjpool.so.1
+f usr/lib/pool/libjsyslog.so.1 0755 root bin
+s usr/lib/pool/libjsyslog.so=libjsyslog.so.1
+f usr/lib/pool/poold 0555 root bin
+f usr/lib/pool/poold.properties 0444 root bin
+d usr/lib/power 0755 root bin
+f usr/lib/power/powerd 0555 root bin
+d usr/lib/raidcfg 0755 root bin
+d usr/lib/raidcfg/amd64 0755 root bin
+f usr/lib/raidcfg/amd64/mpt.so.1 0755 root bin
+f usr/lib/raidcfg/mpt.so.1 0755 root bin
+d usr/lib/rcap 0755 root bin
+d usr/lib/rcap/amd64 0755 root bin
+f usr/lib/rcap/amd64/rcapd 0555 root bin
+d usr/lib/rcap/i86 0755 root bin
+f usr/lib/rcap/i86/rcapd 0555 root bin
+h usr/lib/rcap/rcapd=usr/lib/isaexec
+d usr/lib/rcm 0755 root bin
+d usr/lib/rcm/modules 0755 root bin
+f usr/lib/rcm/modules/SUNW_aggr_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_bridge_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_cluster_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_dump_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_filesys_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_ibpart_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_ip_anon_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_ip_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_mpxio_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_network_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_pool_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_swap_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_vlan_rcm.so 0555 root bin
+f usr/lib/rcm/modules/SUNW_vnic_rcm.so 0555 root bin
+f usr/lib/rcm/rcm_daemon 0555 root bin
+d usr/lib/rcm/scripts 0755 root bin
+f usr/lib/rcm/scripts/SUNW,ibsdpu.sh 0555 root bin
+f usr/lib/rcm/scripts/SUNW,rdsv3u.sh 0555 root bin
+d usr/lib/refer 0755 root bin
+f usr/lib/refer/hunt 0555 root bin
+f usr/lib/refer/inv 0555 root bin
+f usr/lib/refer/mkey 0555 root bin
+d usr/lib/refer/papers 0755 root bin
+f usr/lib/refer/papers/Rbstjissue 0644 root bin
+f usr/lib/refer/papers/Rv7man 0644 root bin
+f usr/lib/refer/papers/runinv 0755 root bin
+d usr/lib/reparse 0755 root bin
+d usr/lib/reparse/amd64 0755 root bin
+f usr/lib/reparse/amd64/libnfs_basic.so.1 0755 root bin
+s usr/lib/reparse/amd64/libnfs_basic.so=libnfs_basic.so.1
+f usr/lib/reparse/amd64/libreparse_smb.so.1 0755 root bin
+s usr/lib/reparse/amd64/libreparse_smb.so=libreparse_smb.so.1
+f usr/lib/reparse/libnfs_basic.so.1 0755 root bin
+s usr/lib/reparse/libnfs_basic.so=libnfs_basic.so.1
+f usr/lib/reparse/libreparse_smb.so.1 0755 root bin
+s usr/lib/reparse/libreparse_smb.so=libreparse_smb.so.1
+f usr/lib/reparse/reparsed 0555 root sys
+f usr/lib/rpcsec.so.1 0755 root bin
+s usr/lib/rpcsec.so=rpcsec.so.1
+s usr/lib/rsh=../bin/ksh93
+d usr/lib/sa 0755 root bin
+f usr/lib/sa/sa1 0555 root bin
+f usr/lib/sa/sa2 0555 root bin
+f usr/lib/sa/sadc 0555 root bin
+d usr/lib/saf 0755 root bin
+f usr/lib/saf/listen 0755 root sys
+f usr/lib/saf/nlps_server 0755 root sys
+f usr/lib/saf/sac 0555 root sys
+f usr/lib/saf/ttymon 0555 root sys
+d usr/lib/sasl 0755 root bin
+d usr/lib/sasl/amd64 0755 root bin
+f usr/lib/sasl/amd64/crammd5.so.1 0755 root bin
+f usr/lib/sasl/amd64/digestmd5.so.1 0755 root bin
+f usr/lib/sasl/amd64/gssapi.so.1 0755 root bin
+f usr/lib/sasl/amd64/plain.so.1 0755 root bin
+f usr/lib/sasl/crammd5.so.1 0755 root bin
+f usr/lib/sasl/digestmd5.so.1 0755 root bin
+f usr/lib/sasl/gssapi.so.1 0755 root bin
+f usr/lib/sasl/plain.so.1 0755 root bin
+d usr/lib/scsi 0755 root bin
+d usr/lib/scsi/amd64 0755 root bin
+f usr/lib/scsi/amd64/libscsi.so.1 0755 root bin
+s usr/lib/scsi/amd64/libscsi.so=libscsi.so.1
+f usr/lib/scsi/amd64/libses.so.1 0755 root bin
+s usr/lib/scsi/amd64/libses.so=libses.so.1
+f usr/lib/scsi/amd64/libsmp.so.1 0755 root bin
+s usr/lib/scsi/amd64/libsmp.so=libsmp.so.1
+f usr/lib/scsi/libscsi.so.1 0755 root bin
+s usr/lib/scsi/libscsi.so=libscsi.so.1
+f usr/lib/scsi/libses.so.1 0755 root bin
+s usr/lib/scsi/libses.so=libses.so.1
+f usr/lib/scsi/libsmp.so.1 0755 root bin
+s usr/lib/scsi/libsmp.so=libsmp.so.1
+d usr/lib/scsi/plugins 0755 root bin
+d usr/lib/scsi/plugins/scsi 0755 root bin
+d usr/lib/scsi/plugins/scsi/engines 0755 root bin
+d usr/lib/scsi/plugins/scsi/engines/amd64 0755 root bin
+f usr/lib/scsi/plugins/scsi/engines/amd64/uscsi.so 0755 root bin
+f usr/lib/scsi/plugins/scsi/engines/uscsi.so 0755 root bin
+d usr/lib/scsi/plugins/ses 0755 root bin
+d usr/lib/scsi/plugins/ses/framework 0755 root bin
+d usr/lib/scsi/plugins/ses/framework/amd64 0755 root bin
+f usr/lib/scsi/plugins/ses/framework/amd64/libses.so 0755 root bin
+f usr/lib/scsi/plugins/ses/framework/amd64/ses2.so 0755 root bin
+f usr/lib/scsi/plugins/ses/framework/libses.so 0755 root bin
+f usr/lib/scsi/plugins/ses/framework/ses2.so 0755 root bin
+d usr/lib/scsi/plugins/ses/vendor 0755 root bin
+f usr/lib/scsi/plugins/ses/vendor/LSILOGIC-SASX28-A.0.so 0755 root bin
+s usr/lib/scsi/plugins/ses/vendor/LSILOGIC-SASX28-A.1.so=LSILOGIC-SASX28-A.0.so
+s usr/lib/scsi/plugins/ses/vendor/SUN-Storage-J4200.so=SUN-Storage-J4400.so
+f usr/lib/scsi/plugins/ses/vendor/SUN-Storage-J4400.so 0755 root bin
+f usr/lib/scsi/plugins/ses/vendor/SUN-Storage-J4500.so 0755 root bin
+f usr/lib/scsi/plugins/ses/vendor/SUN.so 0755 root bin
+d usr/lib/scsi/plugins/ses/vendor/amd64 0755 root bin
+f usr/lib/scsi/plugins/ses/vendor/amd64/LSILOGIC-SASX28-A.0.so 0755 root bin
+s usr/lib/scsi/plugins/ses/vendor/amd64/LSILOGIC-SASX28-A.1.so=LSILOGIC-SASX28-A.0.so
+s usr/lib/scsi/plugins/ses/vendor/amd64/SUN-Storage-J4200.so=SUN-Storage-J4400.so
+f usr/lib/scsi/plugins/ses/vendor/amd64/SUN-Storage-J4400.so 0755 root bin
+f usr/lib/scsi/plugins/ses/vendor/amd64/SUN-Storage-J4500.so 0755 root bin
+f usr/lib/scsi/plugins/ses/vendor/amd64/SUN.so 0755 root bin
+d usr/lib/scsi/plugins/smp 0755 root bin
+d usr/lib/scsi/plugins/smp/engine 0755 root bin
+d usr/lib/scsi/plugins/smp/engine/amd64 0755 root bin
+f usr/lib/scsi/plugins/smp/engine/amd64/usmp.so 0755 root bin
+f usr/lib/scsi/plugins/smp/engine/usmp.so 0755 root bin
+d usr/lib/scsi/plugins/smp/framework 0755 root bin
+d usr/lib/scsi/plugins/smp/framework/amd64 0755 root bin
+f usr/lib/scsi/plugins/smp/framework/amd64/sas2.so 0755 root bin
+f usr/lib/scsi/plugins/smp/framework/sas2.so 0755 root bin
+f usr/lib/scsi/sestopo 0555 root bin
+f usr/lib/scsi/smp 0555 root bin
+d usr/lib/secure 0755 root bin
+s usr/lib/secure/32=.
+s usr/lib/secure/64=amd64
+d usr/lib/secure/amd64 0755 root bin
+d usr/lib/security 0755 root bin
+s usr/lib/security/64=amd64
+d usr/lib/security/amd64 0755 root bin
+f usr/lib/security/amd64/crypt_bsdbf.so.1 0755 root bin
+s usr/lib/security/amd64/crypt_bsdbf.so=crypt_bsdbf.so.1
+f usr/lib/security/amd64/crypt_bsdmd5.so.1 0755 root bin
+s usr/lib/security/amd64/crypt_bsdmd5.so=crypt_bsdmd5.so.1
+f usr/lib/security/amd64/crypt_sha256.so.1 0755 root bin
+s usr/lib/security/amd64/crypt_sha256.so=crypt_sha256.so.1
+f usr/lib/security/amd64/crypt_sha512.so.1 0755 root bin
+s usr/lib/security/amd64/crypt_sha512.so=crypt_sha512.so.1
+f usr/lib/security/amd64/crypt_sunmd5.so.1 0755 root bin
+s usr/lib/security/amd64/crypt_sunmd5.so=crypt_sunmd5.so.1
+f usr/lib/security/amd64/pam_allow.so.1 0755 root bin
+s usr/lib/security/amd64/pam_allow.so=pam_allow.so.1
+f usr/lib/security/amd64/pam_authtok_check.so.1 0755 root bin
+s usr/lib/security/amd64/pam_authtok_check.so=pam_authtok_check.so.1
+f usr/lib/security/amd64/pam_authtok_get.so.1 0755 root bin
+s usr/lib/security/amd64/pam_authtok_get.so=pam_authtok_get.so.1
+f usr/lib/security/amd64/pam_authtok_store.so.1 0755 root bin
+s usr/lib/security/amd64/pam_authtok_store.so=pam_authtok_store.so.1
+f usr/lib/security/amd64/pam_deny.so.1 0755 root bin
+s usr/lib/security/amd64/pam_deny.so=pam_deny.so.1
+f usr/lib/security/amd64/pam_dhkeys.so.1 0755 root bin
+s usr/lib/security/amd64/pam_dhkeys.so=pam_dhkeys.so.1
+f usr/lib/security/amd64/pam_dial_auth.so.1 0755 root bin
+s usr/lib/security/amd64/pam_dial_auth.so=pam_dial_auth.so.1
+f usr/lib/security/amd64/pam_krb5.so.1 0755 root bin
+s usr/lib/security/amd64/pam_krb5.so=pam_krb5.so.1
+f usr/lib/security/amd64/pam_krb5_migrate.so.1 0755 root bin
+s usr/lib/security/amd64/pam_krb5_migrate.so=pam_krb5_migrate.so.1
+f usr/lib/security/amd64/pam_ldap.so.1 0755 root bin
+s usr/lib/security/amd64/pam_ldap.so=pam_ldap.so.1
+f usr/lib/security/amd64/pam_list.so.1 0755 root bin
+s usr/lib/security/amd64/pam_list.so=pam_list.so.1
+f usr/lib/security/amd64/pam_passwd_auth.so.1 0755 root bin
+s usr/lib/security/amd64/pam_passwd_auth.so=pam_passwd_auth.so.1
+f usr/lib/security/amd64/pam_rhosts_auth.so.1 0755 root bin
+s usr/lib/security/amd64/pam_rhosts_auth.so=pam_rhosts_auth.so.1
+f usr/lib/security/amd64/pam_roles.so.1 0755 root bin
+s usr/lib/security/amd64/pam_roles.so=pam_roles.so.1
+f usr/lib/security/amd64/pam_sample.so.1 0755 root bin
+s usr/lib/security/amd64/pam_sample.so=pam_sample.so.1
+f usr/lib/security/amd64/pam_smbfs_login.so.1 0755 root bin
+s usr/lib/security/amd64/pam_smbfs_login.so=pam_smbfs_login.so.1
+f usr/lib/security/amd64/pam_unix_account.so.1 0755 root bin
+s usr/lib/security/amd64/pam_unix_account.so=pam_unix_account.so.1
+f usr/lib/security/amd64/pam_unix_auth.so.1 0755 root bin
+s usr/lib/security/amd64/pam_unix_auth.so=pam_unix_auth.so.1
+f usr/lib/security/amd64/pam_unix_cred.so.1 0755 root bin
+s usr/lib/security/amd64/pam_unix_cred.so=pam_unix_cred.so.1
+f usr/lib/security/amd64/pam_unix_session.so.1 0755 root bin
+s usr/lib/security/amd64/pam_unix_session.so=pam_unix_session.so.1
+f usr/lib/security/amd64/pkcs11_kernel.so.1 0755 root bin
+s usr/lib/security/amd64/pkcs11_kernel.so=pkcs11_kernel.so.1
+f usr/lib/security/amd64/pkcs11_softtoken.so.1 0755 root bin
+s usr/lib/security/amd64/pkcs11_softtoken.so=pkcs11_softtoken.so.1
+f usr/lib/security/audit_binfile.so.1 0755 root bin
+s usr/lib/security/audit_binfile.so=audit_binfile.so.1
+f usr/lib/security/audit_remote.so.1 0755 root bin
+s usr/lib/security/audit_remote.so=audit_remote.so.1
+f usr/lib/security/audit_syslog.so.1 0755 root bin
+s usr/lib/security/audit_syslog.so=audit_syslog.so.1
+f usr/lib/security/crypt_bsdbf.so.1 0755 root bin
+s usr/lib/security/crypt_bsdbf.so=crypt_bsdbf.so.1
+f usr/lib/security/crypt_bsdmd5.so.1 0755 root bin
+s usr/lib/security/crypt_bsdmd5.so=crypt_bsdmd5.so.1
+f usr/lib/security/crypt_sha256.so.1 0755 root bin
+s usr/lib/security/crypt_sha256.so=crypt_sha256.so.1
+f usr/lib/security/crypt_sha512.so.1 0755 root bin
+s usr/lib/security/crypt_sha512.so=crypt_sha512.so.1
+f usr/lib/security/crypt_sunmd5.so.1 0755 root bin
+s usr/lib/security/crypt_sunmd5.so=crypt_sunmd5.so.1
+f usr/lib/security/pam_allow.so.1 0755 root bin
+s usr/lib/security/pam_allow.so=pam_allow.so.1
+f usr/lib/security/pam_authtok_check.so.1 0755 root bin
+s usr/lib/security/pam_authtok_check.so=pam_authtok_check.so.1
+f usr/lib/security/pam_authtok_get.so.1 0755 root bin
+s usr/lib/security/pam_authtok_get.so=pam_authtok_get.so.1
+f usr/lib/security/pam_authtok_store.so.1 0755 root bin
+s usr/lib/security/pam_authtok_store.so=pam_authtok_store.so.1
+f usr/lib/security/pam_deny.so.1 0755 root bin
+s usr/lib/security/pam_deny.so=pam_deny.so.1
+f usr/lib/security/pam_dhkeys.so.1 0755 root bin
+s usr/lib/security/pam_dhkeys.so=pam_dhkeys.so.1
+f usr/lib/security/pam_dial_auth.so.1 0755 root bin
+s usr/lib/security/pam_dial_auth.so=pam_dial_auth.so.1
+f usr/lib/security/pam_krb5.so.1 0755 root bin
+s usr/lib/security/pam_krb5.so=pam_krb5.so.1
+f usr/lib/security/pam_krb5_first 0444 root bin
+f usr/lib/security/pam_krb5_migrate.so.1 0755 root bin
+s usr/lib/security/pam_krb5_migrate.so=pam_krb5_migrate.so.1
+f usr/lib/security/pam_krb5_only 0444 root bin
+f usr/lib/security/pam_krb5_optional 0444 root bin
+f usr/lib/security/pam_ldap.so.1 0755 root bin
+s usr/lib/security/pam_ldap.so=pam_ldap.so.1
+f usr/lib/security/pam_list.so.1 0755 root bin
+s usr/lib/security/pam_list.so=pam_list.so.1
+f usr/lib/security/pam_passwd_auth.so.1 0755 root bin
+s usr/lib/security/pam_passwd_auth.so=pam_passwd_auth.so.1
+f usr/lib/security/pam_rhosts_auth.so.1 0755 root bin
+s usr/lib/security/pam_rhosts_auth.so=pam_rhosts_auth.so.1
+f usr/lib/security/pam_roles.so.1 0755 root bin
+s usr/lib/security/pam_roles.so=pam_roles.so.1
+f usr/lib/security/pam_sample.so.1 0755 root bin
+s usr/lib/security/pam_sample.so=pam_sample.so.1
+f usr/lib/security/pam_smb_passwd.so.1 0755 root bin
+s usr/lib/security/pam_smb_passwd.so=pam_smb_passwd.so.1
+f usr/lib/security/pam_smbfs_login.so.1 0755 root bin
+s usr/lib/security/pam_smbfs_login.so=pam_smbfs_login.so.1
+f usr/lib/security/pam_unix_account.so.1 0755 root bin
+s usr/lib/security/pam_unix_account.so=pam_unix_account.so.1
+f usr/lib/security/pam_unix_auth.so.1 0755 root bin
+s usr/lib/security/pam_unix_auth.so=pam_unix_auth.so.1
+f usr/lib/security/pam_unix_cred.so.1 0755 root bin
+s usr/lib/security/pam_unix_cred.so=pam_unix_cred.so.1
+f usr/lib/security/pam_unix_session.so.1 0755 root bin
+s usr/lib/security/pam_unix_session.so=pam_unix_session.so.1
+f usr/lib/security/pkcs11_kernel.so.1 0755 root bin
+s usr/lib/security/pkcs11_kernel.so=pkcs11_kernel.so.1
+f usr/lib/security/pkcs11_softtoken.so.1 0755 root bin
+s usr/lib/security/pkcs11_softtoken.so=pkcs11_softtoken.so.1
+f usr/lib/sendmail 2555 root smmsp
+f usr/lib/servinfo 0555 root bin
+f usr/lib/set_keyboard_layout 0555 root bin
+d usr/lib/smbfs 0755 root bin
+f usr/lib/smbfs/smbiod 0555 root bin
+f usr/lib/smbfs/smbiod-svc 0555 root bin
+d usr/lib/smbsrv 0755 root bin
+d usr/lib/smbsrv/amd64 0755 root bin
+f usr/lib/smbsrv/amd64/libmlrpc.so.1 0755 root bin
+s usr/lib/smbsrv/amd64/libmlrpc.so=libmlrpc.so.1
+f usr/lib/smbsrv/amd64/libmlsvc.so.1 0755 root bin
+s usr/lib/smbsrv/amd64/libmlsvc.so=libmlsvc.so.1
+f usr/lib/smbsrv/amd64/libsmb.so.1 0755 root bin
+s usr/lib/smbsrv/amd64/libsmb.so=libsmb.so.1
+f usr/lib/smbsrv/amd64/libsmbns.so.1 0755 root bin
+s usr/lib/smbsrv/amd64/libsmbns.so=libsmbns.so.1
+d usr/lib/smbsrv/dtrace 0755 root bin
+f usr/lib/smbsrv/libmlrpc.so.1 0755 root bin
+s usr/lib/smbsrv/libmlrpc.so=libmlrpc.so.1
+f usr/lib/smbsrv/libmlsvc.so.1 0755 root bin
+s usr/lib/smbsrv/libmlsvc.so=libmlsvc.so.1
+f usr/lib/smbsrv/libsmb.so.1 0755 root bin
+s usr/lib/smbsrv/libsmb.so=libsmb.so.1
+f usr/lib/smbsrv/libsmbns.so.1 0755 root bin
+s usr/lib/smbsrv/libsmbns.so=libsmbns.so.1
+f usr/lib/smbsrv/libsqlite.so.1 0755 root bin
+s usr/lib/smbsrv/libsqlite.so=libsqlite.so.1
+f usr/lib/smbsrv/smbd 0755 root bin
+d usr/lib/smedia 0755 root bin
+d usr/lib/smedia/amd64 0755 root bin
+f usr/lib/smedia/amd64/sm_blkdev.so.1 0555 root bin
+f usr/lib/smedia/amd64/sm_fd.so.1 0555 root bin
+f usr/lib/smedia/amd64/sm_pcata.so.1 0555 root bin
+f usr/lib/smedia/amd64/sm_scsi.so.1 0555 root bin
+f usr/lib/smedia/rpc.smserverd 0555 root bin
+f usr/lib/smedia/sm_blkdev.so.1 0555 root bin
+f usr/lib/smedia/sm_fd.so.1 0555 root bin
+f usr/lib/smedia/sm_pcata.so.1 0555 root bin
+f usr/lib/smedia/sm_scsi.so.1 0555 root bin
+f usr/lib/smrsh 0555 root bin
+f usr/lib/sndrd 0555 root bin
+f usr/lib/sndrsyncd 0555 root bin
+f usr/lib/sngl_brand.so.1 0755 root bin
+d usr/lib/snmp 0755 root bin
+d usr/lib/spell 0755 root bin
+f usr/lib/spell/compress 0555 root bin
+f usr/lib/spell/hashcheck 0555 root bin
+f usr/lib/spell/hashmake 0555 root bin
+f usr/lib/spell/hlista 0644 root bin
+f usr/lib/spell/hlistb 0644 root bin
+f usr/lib/spell/hstop 0644 root bin
+f usr/lib/spell/spellin 0555 root bin
+f usr/lib/spell/spellprog 0555 root bin
+d usr/lib/ssh 0755 root bin
+f usr/lib/ssh/sftp-server 0555 root bin
+f usr/lib/ssh/ssh-askpass 0555 root bin
+f usr/lib/ssh/ssh-http-proxy-connect 0555 root bin
+f usr/lib/ssh/ssh-keysign 4555 root bin
+f usr/lib/ssh/ssh-socks5-proxy-connect 0555 root bin
+f usr/lib/ssh/sshd 0555 root bin
+f usr/lib/straddr.so.2 0755 root bin
+s usr/lib/straddr.so=straddr.so.2
+s usr/lib/sunw,rcp=../bin/rcp
+d usr/lib/sysevent 0755 root bin
+d usr/lib/sysevent/modules 0755 root bin
+f usr/lib/sysevent/modules/datalink_mod.so 0755 root bin
+f usr/lib/sysevent/modules/devfsadmd_mod.so 0755 root bin
+f usr/lib/sysevent/modules/picl_slm.so 0755 root bin
+f usr/lib/sysevent/modules/sysevent_conf_mod.so 0755 root bin
+f usr/lib/sysevent/modules/sysevent_reg_mod.so 0755 root bin
+f usr/lib/sysevent/modules/zfs_mod.so 0755 root bin
+f usr/lib/sysevent/syseventconfd 0555 root bin
+f usr/lib/sysevent/syseventd 0555 root bin
+s usr/lib/tabset=../share/lib/tabset
+f usr/lib/th_script 0555 root bin
+s usr/lib/tmac=../share/lib/tmac
+f usr/lib/udapl_tavor.so.1 0755 root bin
+f usr/lib/utmp_update 4555 root bin
+f usr/lib/utmpd 0555 root bin
+f usr/lib/values-Xa.o 0644 root bin
+f usr/lib/values-Xc.o 0644 root bin
+f usr/lib/values-Xs.o 0644 root bin
+f usr/lib/values-Xt.o 0644 root bin
+f usr/lib/values-xpg4.o 0644 root bin
+f usr/lib/values-xpg6.o 0644 root bin
+f usr/lib/vfontedpr 0555 root bin
+f usr/lib/vgrindefs 0444 root bin
+d usr/lib/vscan 0755 root bin
+f usr/lib/vscan/libvscan.so.1 0755 root bin
+s usr/lib/vscan/libvscan.so=libvscan.so.1
+f usr/lib/vscan/vscand 0555 root bin
+f usr/lib/vtdaemon 0555 root bin
+f usr/lib/vtinfo 0555 root bin
+f usr/lib/vtxlock 0555 root bin
+f usr/lib/watchmalloc.so.1 0755 root bin
+s usr/lib/wusbd=../../sbin/wusbadm
+d usr/lib/zfs 0755 root bin
+f usr/lib/zfs/availdevs 0555 root bin
+d usr/lib/zones 0755 root bin
+d usr/lib/zones/amd64 0755 root bin
+f usr/lib/zones/amd64/zoneadmd 0555 root bin
+d usr/lib/zones/i86 0755 root bin
+f usr/lib/zones/i86/zoneadmd 0555 root bin
+h usr/lib/zones/zoneadmd=usr/lib/isaexec
+f usr/lib/zones/zoneshare 0555 root bin
+f usr/lib/zones/zoneunshare 0555 root bin
+d usr/libexec 07555 root bin
+d usr/local 0755 root root
+s usr/mail=../var/mail
+s usr/man=share/man
+d usr/net 0755 root sys
+d usr/net/nls 0755 root sys
+s usr/net/nls/listen=../../lib/saf/listen
+s usr/net/nls/nlps_server=../../lib/saf/nlps_server
+d usr/net/servers 0755 root sys
+s usr/news=../var/news
+d usr/perl5 0755 root bin
+d usr/perl5/5.12 0755 root bin
+d usr/perl5/5.12/bin 0755 root bin
+f usr/perl5/5.12/bin/perlgcc 0555 root bin
+d usr/perl5/5.12/lib 0755 root bin
+d usr/perl5/5.12/lib/Sun 0755 root bin
+d usr/perl5/5.12/lib/Sun/Solaris 0755 root bin
+d usr/perl5/5.12/lib/Sun/Solaris/BSM 0755 root bin
+f usr/perl5/5.12/lib/Sun/Solaris/BSM/_BSMparse.pm 0444 root bin
+d usr/perl5/5.12/lib/Sun/Solaris/PerlGcc 0755 root bin
+f usr/perl5/5.12/lib/Sun/Solaris/PerlGcc/Config.pm 0444 root bin
+f usr/perl5/5.12/lib/Sun/Solaris/Pg.pm 0444 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/Sun 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Exacct 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Exacct.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Exacct/Catalog.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Exacct/File.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Exacct/Object.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Intrs.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Kstat.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Lgrp.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Privilege.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Project.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Task.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Ucred.pm 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/Sun/Solaris/Utils.pm 0444 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/BSM 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/BSM/_BSMparse 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/Catalog 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/Catalog/Catalog.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/Catalog/Catalog.so 0555 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/Exacct.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/Exacct.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/File 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/File/File.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/File/File.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/Object 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/Object/Object.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Exacct/Object/Object.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Intrs 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Intrs/Intrs.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Intrs/Intrs.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Kstat 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Kstat/Kstat.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Kstat/Kstat.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Lgrp 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Lgrp/Lgrp.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Lgrp/Lgrp.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/PerlGcc 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Pg 0755 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Privilege 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Privilege/Privilege.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Privilege/Privilege.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Project 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Project/Project.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Project/Project.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Task 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Task/Task.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Task/Task.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Ucred 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Ucred/Ucred.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Ucred/Ucred.so 0555 root bin
+d usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Utils 0755 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Utils/Utils.bs 0444 root bin
+f usr/perl5/5.12/lib/i86pc-solaris-64int/auto/Sun/Solaris/Utils/Utils.so 0555 root bin
+
+d usr/platform 0755 root sys
+d usr/platform/i86pc 0755 root sys
+d usr/platform/i86pc/lib 0755 root sys
+d usr/platform/i86pc/lib/fm 0755 root sys
+d usr/platform/i86pc/lib/fm/eft 0755 root sys
+f usr/platform/i86pc/lib/fm/eft/amd64.eft 0444 root sys
+f usr/platform/i86pc/lib/fm/eft/gcpu_amd.eft 0444 root sys
+f usr/platform/i86pc/lib/fm/eft/gcpu.eft 0444 root sys
+f usr/platform/i86pc/lib/fm/eft/intel.eft 0444 root sys
+d usr/platform/i86pc/lib/fm/topo 0755 root sys
+d usr/platform/i86pc/lib/fm/topo/maps 0755 root sys
+f usr/platform/i86pc/lib/fm/topo/maps/chassis-hc-topology.xml 0444 root sys
+f usr/platform/i86pc/lib/fm/topo/maps/chip-hc-topology.xml 0444 root sys
+f usr/platform/i86pc/lib/fm/topo/maps/fan-hc-topology.xml 0444 root sys
+f usr/platform/i86pc/lib/fm/topo/maps/i86pc-hc-topology.xml 0444 root sys
+f usr/platform/i86pc/lib/fm/topo/maps/i86pc-legacy-hc-topology.xml 0444 root sys
+f usr/platform/i86pc/lib/fm/topo/maps/psu-hc-topology.xml 0444 root sys
+f usr/platform/i86pc/lib/fm/topo/maps/Joyent-Compute-Platform-1101-disk-hc-topology.xml 0444 root sys
+d usr/platform/i86pc/lib/fm/topo/plugins 0755 root sys
+f usr/platform/i86pc/lib/fm/topo/plugins/chip.so 0555 root sys
+f usr/platform/i86pc/lib/fm/topo/plugins/hostbridge.so 0555 root sys
+f usr/platform/i86pc/lib/fm/topo/plugins/pcibus.so 0555 root sys
+f usr/platform/i86pc/lib/fm/topo/plugins/x86pi.so 0555 root sys
+d usr/platform/i86pc/lib/mdb 0755 root sys
+d usr/platform/i86pc/lib/mdb/kvm 0755 root sys
+d usr/platform/i86pc/lib/mdb/kvm/amd64 0755 root sys
+f usr/platform/i86pc/lib/mdb/kvm/amd64/apix.so 0555 root sys
+f usr/platform/i86pc/lib/mdb/kvm/amd64/pcplusmp.so 0555 root sys
+f usr/platform/i86pc/lib/mdb/kvm/amd64/unix.so 0555 root sys
+f usr/platform/i86pc/lib/mdb/kvm/amd64/uppc.so 0555 root sys
+s usr/preserve=../var/preserve
+d usr/proc 0755 root bin
+d usr/proc/bin 0755 root bin
+s usr/proc/bin/pcred=../../bin/pcred
+s usr/proc/bin/pfiles=../../bin/pfiles
+s usr/proc/bin/pflags=../../bin/pflags
+s usr/proc/bin/pldd=../../bin/pldd
+s usr/proc/bin/pmap=../../bin/pmap
+s usr/proc/bin/prun=../../bin/prun
+s usr/proc/bin/psig=../../bin/psig
+s usr/proc/bin/pstack=../../bin/pstack
+s usr/proc/bin/pstop=../../bin/pstop
+s usr/proc/bin/ptime=../../bin/ptime
+s usr/proc/bin/ptree=../../bin/ptree
+s usr/proc/bin/pwait=../../bin/pwait
+s usr/proc/bin/pwdx=../../bin/pwdx
+s usr/pub=share/lib/pub
+d usr/sadm 0755 root bin
+d usr/sadm/bin 0755 root bin
+h usr/sadm/bin/dispgid=usr/bin/ckgid
+h usr/sadm/bin/dispuid=usr/bin/ckuid
+h usr/sadm/bin/errange=usr/bin/ckrange
+h usr/sadm/bin/errdate=usr/bin/ckdate
+h usr/sadm/bin/errgid=usr/bin/ckgid
+h usr/sadm/bin/errint=usr/bin/ckint
+h usr/sadm/bin/erritem=usr/bin/ckitem
+h usr/sadm/bin/errpath=usr/bin/ckpath
+h usr/sadm/bin/errstr=usr/bin/ckstr
+h usr/sadm/bin/errtime=usr/bin/cktime
+h usr/sadm/bin/erruid=usr/bin/ckuid
+h usr/sadm/bin/erryorn=usr/bin/ckyorn
+h usr/sadm/bin/helpdate=usr/bin/ckdate
+h usr/sadm/bin/helpgid=usr/bin/ckgid
+h usr/sadm/bin/helpint=usr/bin/ckint
+h usr/sadm/bin/helpitem=usr/bin/ckitem
+h usr/sadm/bin/helppath=usr/bin/ckpath
+h usr/sadm/bin/helprange=usr/bin/ckrange
+h usr/sadm/bin/helpstr=usr/bin/ckstr
+h usr/sadm/bin/helptime=usr/bin/cktime
+h usr/sadm/bin/helpuid=usr/bin/ckuid
+h usr/sadm/bin/helpyorn=usr/bin/ckyorn
+f usr/sadm/bin/puttext 0555 root bin
+h usr/sadm/bin/valdate=usr/bin/ckdate
+h usr/sadm/bin/valgid=usr/bin/ckgid
+h usr/sadm/bin/valint=usr/bin/ckint
+h usr/sadm/bin/valpath=usr/bin/ckpath
+h usr/sadm/bin/valrange=usr/bin/ckrange
+h usr/sadm/bin/valstr=usr/bin/ckstr
+h usr/sadm/bin/valtime=usr/bin/cktime
+h usr/sadm/bin/valuid=usr/bin/ckuid
+h usr/sadm/bin/valyorn=usr/bin/ckyorn
+d usr/sadm/install 0755 root bin
+d usr/sadm/install/scripts 0755 root bin
+f usr/sadm/install/scripts/i.ipsecalgs 0555 root sys
+f usr/sadm/install/scripts/i.kcfconf 0555 root sys
+f usr/sadm/install/scripts/i.kmfconf 0555 root sys
+f usr/sadm/install/scripts/i.manifest 0555 root sys
+f usr/sadm/install/scripts/i.pkcs11conf 0555 root sys
+f usr/sadm/install/scripts/i.rbac 0555 root sys
+f usr/sadm/install/scripts/r.ipsecalgs 0555 root sys
+f usr/sadm/install/scripts/r.kcfconf 0555 root sys
+f usr/sadm/install/scripts/r.kmfconf 0555 root sys
+f usr/sadm/install/scripts/r.manifest 0555 root sys
+f usr/sadm/install/scripts/r.pkcs11conf 0555 root sys
+f usr/sadm/install/scripts/r.rbac 0555 root sys
+d usr/sadm/sysadm 0755 root bin
+d usr/sadm/sysadm/add-ons 0755 root bin
+d usr/sadm/sysadm/bin 0755 root bin
+f usr/sadm/ugdates 0444 root bin
+d usr/sbin 0755 root bin
+f usr/sbin/6to4relay 0555 root bin
+f usr/sbin/acctadm 0555 root bin
+h usr/sbin/add_drv=usr/lib/isaexec
+f usr/sbin/allocate 4555 root bin
+d usr/sbin/amd64 0755 root bin
+f usr/sbin/amd64/add_drv 0555 root sys
+f usr/sbin/amd64/dtrace 0555 root bin
+f usr/sbin/amd64/intrstat 0555 root bin
+f usr/sbin/amd64/ipf 0555 root bin
+f usr/sbin/amd64/ipfs 0555 root bin
+f usr/sbin/amd64/ipfstat 0555 root bin
+f usr/sbin/amd64/ipmon 0555 root bin
+f usr/sbin/amd64/ipnat 0555 root bin
+f usr/sbin/amd64/ippool 0555 root bin
+f usr/sbin/amd64/lockstat 0555 root bin
+f usr/sbin/amd64/modinfo 0555 root sys
+f usr/sbin/amd64/modload 0555 root sys
+f usr/sbin/amd64/modunload 0555 root sys
+f usr/sbin/amd64/pbind 0555 root sys
+f usr/sbin/amd64/plockstat 0555 root bin
+f usr/sbin/amd64/prtconf 2555 root sys
+f usr/sbin/amd64/psrset 0555 root sys
+f usr/sbin/amd64/rem_drv 0555 root sys
+f usr/sbin/amd64/swap 2555 root sys
+f usr/sbin/amd64/sysdef 2555 root sys
+f usr/sbin/amd64/update_drv 0555 root sys
+f usr/sbin/amd64/whodo 4555 root bin
+f usr/sbin/amd64/zdb 0555 root bin
+f usr/sbin/arp 0555 root bin
+f usr/sbin/audit 0555 root bin
+f usr/sbin/auditconfig 0555 root bin
+f usr/sbin/auditd 0555 root bin
+f usr/sbin/auditrecord 0555 root bin
+f usr/sbin/auditreduce 0555 root bin
+f usr/sbin/auditstat 0555 root bin
+h usr/sbin/audlinks=usr/sbin/devfsadm
+s usr/sbin/automount=../lib/fs/autofs/automount
+s usr/sbin/autopush=../../sbin/autopush
+f usr/sbin/cfgadm 0555 root bin
+f usr/sbin/check-hostname 0555 root mail
+f usr/sbin/check-permissions 0555 root mail
+f usr/sbin/chk_encodings 0555 root sys
+f usr/sbin/chroot 0555 root bin
+f usr/sbin/clear_locks 0555 root bin
+f usr/sbin/clinfo 0555 root bin
+f usr/sbin/clri 0555 root bin
+f usr/sbin/consadm 0555 root sys
+f usr/sbin/consadmd 0555 root sys
+f usr/sbin/cpustat 0555 root bin
+f usr/sbin/cron 0555 root sys
+s usr/sbin/cryptoadm=../../sbin/cryptoadm
+s usr/sbin/dcopy=clri
+h usr/sbin/deallocate=usr/sbin/allocate
+f usr/sbin/devfsadm 0755 root sys
+f usr/sbin/devinfo 0555 root bin
+h usr/sbin/devlinks=usr/sbin/devfsadm
+s usr/sbin/devnm=df
+f usr/sbin/df 0555 root bin
+f usr/sbin/dfmounts 0555 root bin
+h usr/sbin/dfshares=usr/sbin/dfmounts
+h usr/sbin/disks=usr/sbin/devfsadm
+f usr/sbin/dispadmin 0555 root bin
+s usr/sbin/dladm=../../sbin/dladm
+s usr/sbin/dlstat=../../sbin/dlstat
+f usr/sbin/dmesg 0555 root bin
+f usr/sbin/dminfo 0555 root bin
+h usr/sbin/drvconfig=usr/sbin/devfsadm
+h usr/sbin/dtrace=usr/lib/isaexec
+f usr/sbin/dumpadm 0555 root bin
+f usr/sbin/editmap 0555 root bin
+s usr/sbin/edquota=../lib/fs/ufs/edquota
+f usr/sbin/eeprom 2555 root sys
+f usr/sbin/etrn 0555 root bin
+f usr/sbin/exportfs 0555 root bin
+f usr/sbin/fcadm 0555 root bin
+h usr/sbin/fcinfo=usr/sbin/fcadm
+s usr/sbin/fdisk=../../sbin/fdisk
+f usr/sbin/ff 0555 root bin
+s usr/sbin/fiocompress=../../sbin/fiocompress
+s usr/sbin/flowadm=../../sbin/flowadm
+s usr/sbin/flowstat=../../sbin/flowstat
+f usr/sbin/fmadm 0555 root bin
+f usr/sbin/fmdump 0555 root bin
+f usr/sbin/fmstat 0555 root bin
+f usr/sbin/fmthard 0555 root sys
+f usr/sbin/format 0555 root bin
+f usr/sbin/fsck 0555 root bin
+s usr/sbin/fsdb=clri
+s usr/sbin/fsirand=../lib/fs/ufs/fsirand
+s usr/sbin/fssnap=clri
+f usr/sbin/fstyp 0555 root sys
+f usr/sbin/ftpaddhost 0555 root bin
+f usr/sbin/ftpconfig 0555 root bin
+f usr/sbin/ftpcount 0555 root bin
+f usr/sbin/ftprestart 0555 root bin
+f usr/sbin/ftpshut 0555 root bin
+h usr/sbin/ftpwho=usr/sbin/ftpcount
+f usr/sbin/fuser 0555 root bin
+f usr/sbin/fwflash 0555 root bin
+f usr/sbin/getdevpolicy 0555 root sys
+f usr/sbin/getmajor 0755 root sys
+f usr/sbin/gettable 0555 root bin
+f usr/sbin/groupadd 0555 root sys
+f usr/sbin/groupdel 0555 root sys
+f usr/sbin/groupmod 0555 root sys
+f usr/sbin/grpck 0555 root bin
+f usr/sbin/grub 0555 root bin
+f usr/sbin/gsscred 0555 root sys
+f usr/sbin/halt 0755 root bin
+s usr/sbin/hostconfig=../../sbin/hostconfig
+f usr/sbin/hotplug 0555 root bin
+f usr/sbin/htable 0555 root bin
+d usr/sbin/i86 0755 root bin
+f usr/sbin/i86/add_drv 0555 root sys
+f usr/sbin/i86/dtrace 0555 root bin
+f usr/sbin/i86/intrstat 0555 root bin
+f usr/sbin/i86/ipf 0555 root bin
+f usr/sbin/i86/ipfs 0555 root bin
+f usr/sbin/i86/ipfstat 0555 root bin
+f usr/sbin/i86/ipmon 0555 root bin
+f usr/sbin/i86/ipnat 0555 root bin
+f usr/sbin/i86/ippool 0555 root bin
+f usr/sbin/i86/lockstat 0555 root bin
+f usr/sbin/i86/modinfo 0555 root sys
+f usr/sbin/i86/modload 0555 root sys
+f usr/sbin/i86/modunload 0555 root sys
+f usr/sbin/i86/pbind 0555 root sys
+f usr/sbin/i86/plockstat 0555 root bin
+f usr/sbin/i86/prtconf 2555 root sys
+f usr/sbin/i86/psrset 0555 root sys
+f usr/sbin/i86/rem_drv 0555 root sys
+f usr/sbin/i86/swap 2555 root sys
+f usr/sbin/i86/sysdef 2555 root sys
+f usr/sbin/i86/update_drv 0555 root sys
+f usr/sbin/i86/whodo 4555 root bin
+f usr/sbin/i86/zdb 0555 root bin
+f usr/sbin/idmap 0555 root bin
+f usr/sbin/if_mpadm 0555 root bin
+s usr/sbin/ifconfig=../../sbin/ifconfig
+f usr/sbin/ikeadm 0555 root bin
+f usr/sbin/ikecert 0555 root bin
+f usr/sbin/ilbadm 0555 root bin
+f usr/sbin/in.comsat 0555 root bin
+f usr/sbin/in.fingerd 0555 root bin
+f usr/sbin/in.ftpd 0555 root bin
+f usr/sbin/in.rdisc 0555 root bin
+f usr/sbin/in.rexecd 0555 root bin
+f usr/sbin/in.rlogind 0555 root bin
+f usr/sbin/in.routed 0555 root bin
+f usr/sbin/in.rshd 0555 root bin
+f usr/sbin/in.rwhod 0555 root bin
+f usr/sbin/in.talkd 0555 root bin
+f usr/sbin/in.telnetd 0555 root bin
+f usr/sbin/in.tftpd 0555 root bin
+f usr/sbin/inetadm 0555 root bin
+f usr/sbin/inetconv 0555 root bin
+s usr/sbin/inetd=../lib/inet/inetd
+s usr/sbin/init=../../sbin/init
+f usr/sbin/install 0555 root bin
+f usr/sbin/installboot 0555 root sys
+s usr/sbin/installgrub=../../sbin/installgrub
+h usr/sbin/intrstat=usr/lib/isaexec
+f usr/sbin/ipaddrsel 0555 root bin
+s usr/sbin/ipadm=../../sbin/ipadm
+f usr/sbin/ipdadm 0555 root bin
+h usr/sbin/ipf=usr/lib/isaexec
+h usr/sbin/ipfs=usr/lib/isaexec
+h usr/sbin/ipfstat=usr/lib/isaexec
+h usr/sbin/ipmon=usr/lib/isaexec
+s usr/sbin/ipmpstat=../../sbin/ipmpstat
+h usr/sbin/ipnat=usr/lib/isaexec
+h usr/sbin/ippool=usr/lib/isaexec
+f usr/sbin/ipsecalgs 0555 root bin
+f usr/sbin/ipsecconf 0555 root bin
+f usr/sbin/ipseckey 0555 root bin
+f usr/sbin/iscsiadm 0555 root bin
+f usr/sbin/itadm 0555 root bin
+f usr/sbin/keyserv 0555 root sys
+f usr/sbin/killall 0555 root bin
+f usr/sbin/ksslcfg 0555 root bin
+s usr/sbin/labelit=clri
+f usr/sbin/ldapaddent 0555 root bin
+f usr/sbin/ldapclient 0555 root bin
+f usr/sbin/link 0555 root bin
+h usr/sbin/list_devices=usr/sbin/allocate
+f usr/sbin/locator 0555 root bin
+s usr/sbin/lockfs=../lib/fs/ufs/lockfs
+h usr/sbin/lockstat=usr/lib/isaexec
+f usr/sbin/lofiadm 0555 root bin
+f usr/sbin/logadm 0555 root bin
+f usr/sbin/makedbm 0555 root bin
+f usr/sbin/makemap 0555 root bin
+f usr/sbin/mkdevalloc 0555 root bin
+h usr/sbin/mkdevmaps=usr/sbin/mkdevalloc
+f usr/sbin/mkfile 0555 root bin
+s usr/sbin/mkfs=clri
+f usr/sbin/mknod 0555 root bin
+h usr/sbin/modinfo=usr/lib/isaexec
+h usr/sbin/modload=usr/lib/isaexec
+h usr/sbin/modunload=usr/lib/isaexec
+s usr/sbin/mount=../../sbin/mount
+f usr/sbin/mountall 0555 root sys
+f usr/sbin/mpathadm 0555 root bin
+f usr/sbin/msgid 0555 root bin
+f usr/sbin/mvdir 0555 root bin
+s usr/sbin/ncheck=ff
+f usr/sbin/ndd 0555 root bin
+s usr/sbin/newaliases=../lib/sendmail
+s usr/sbin/newfs=../lib/fs/ufs/newfs
+f usr/sbin/newkey 0555 root sys
+f usr/sbin/nfsref 0555 root bin
+f usr/sbin/nlsadmin 0755 root adm
+f usr/sbin/nscd 0555 root bin
+f usr/sbin/nwamadm 0555 root bin
+f usr/sbin/nwamcfg 0555 root bin
+h usr/sbin/pbind=usr/lib/isaexec
+f usr/sbin/pcitool 0555 root bin
+f usr/sbin/ping 4555 root bin
+h usr/sbin/plockstat=usr/lib/isaexec
+f usr/sbin/pmadm 0555 root sys
+f usr/sbin/pmconfig 4555 root bin
+f usr/sbin/pooladm 0555 root bin
+f usr/sbin/poolbind 0555 root bin
+f usr/sbin/poolcfg 0555 root bin
+h usr/sbin/ports=usr/sbin/devfsadm
+h usr/sbin/poweroff=usr/sbin/halt
+f usr/sbin/praudit 0555 root bin
+f usr/sbin/privatepw 0555 root bin
+f usr/sbin/projadd 0555 root sys
+f usr/sbin/projdel 0555 root sys
+f usr/sbin/projmod 0555 root sys
+h usr/sbin/prtconf=usr/lib/isaexec
+f usr/sbin/prtdiag 2755 root sys
+f usr/sbin/prtpicl 0755 root bin
+f usr/sbin/prtvtoc 0555 root sys
+f usr/sbin/psradm 0555 root sys
+f usr/sbin/psrinfo 0555 root sys
+h usr/sbin/psrset=usr/lib/isaexec
+f usr/sbin/pwck 0555 root bin
+f usr/sbin/pwconv 0555 root sys
+s usr/sbin/quot=../lib/fs/ufs/quot
+s usr/sbin/quota=../lib/fs/ufs/quota
+s usr/sbin/quotacheck=../lib/fs/ufs/quotacheck
+s usr/sbin/quotaoff=../lib/fs/ufs/quotaoff
+s usr/sbin/quotaon=../lib/fs/ufs/quotaon
+f usr/sbin/raidctl 0555 root bin
+f usr/sbin/ramdiskadm 0555 root bin
+f usr/sbin/rcapadm 0555 root bin
+f usr/sbin/rctladm 0555 root bin
+h usr/sbin/reboot=usr/sbin/halt
+h usr/sbin/rem_drv=usr/lib/isaexec
+s usr/sbin/repquota=../lib/fs/ufs/repquota
+f usr/sbin/rmt 0555 root bin
+f usr/sbin/roleadd 0555 root sys
+f usr/sbin/roledel 0555 root sys
+f usr/sbin/rolemod 0555 root sys
+s usr/sbin/route=../../sbin/route
+s usr/sbin/routeadm=../../sbin/routeadm
+f usr/sbin/rpc.rexd 0555 root bin
+f usr/sbin/rpcbind 0555 root bin
+f usr/sbin/rtc 0555 root bin
+f usr/sbin/rtquery 0555 root bin
+f usr/sbin/rwall 0555 root bin
+f usr/sbin/sacadm 4755 root sys
+f usr/sbin/safe_finger 0555 root bin
+f usr/sbin/sbdadm 0555 root bin
+s usr/sbin/sendmail=../lib/sendmail
+f usr/sbin/setmnt 0555 root bin
+h usr/sbin/share=usr/sbin/sharemgr
+f usr/sbin/shareall 0555 root bin
+f usr/sbin/sharectl 0555 root bin
+f usr/sbin/sharemgr 0555 root bin
+s usr/sbin/showmount=../lib/fs/nfs/showmount
+f usr/sbin/shutdown 0755 root sys
+f usr/sbin/smbadm 0555 root bin
+f usr/sbin/smbios 0555 root bin
+f usr/sbin/smbstat 0555 root bin
+f usr/sbin/snoop 0555 root bin
+f usr/sbin/sppptun 0555 root bin
+f usr/sbin/spray 0555 root bin
+f usr/sbin/stmfadm 0555 root bin
+f usr/sbin/stmsboot 0555 root bin
+f usr/sbin/strace 0555 root sys
+f usr/sbin/strclean 0555 root sys
+f usr/sbin/strerr 0555 root sys
+f usr/sbin/sttydefs 0755 root sys
+s usr/sbin/svcadm=../../sbin/svcadm
+f usr/sbin/svccfg 0555 root bin
+h usr/sbin/swap=usr/lib/isaexec
+s usr/sbin/sync=../../sbin/sync
+f usr/sbin/syncinit 0555 root bin
+f usr/sbin/syncloop 0555 root bin
+f usr/sbin/syncstat 0555 root bin
+h usr/sbin/sysdef=usr/lib/isaexec
+f usr/sbin/syseventadm 0555 root sys
+f usr/sbin/sysidpm 0755 root sys
+f usr/sbin/syslogd 0555 root sys
+h usr/sbin/tapes=usr/sbin/devfsadm
+f usr/sbin/tar 0555 root bin
+f usr/sbin/tcpd 0555 root bin
+f usr/sbin/tcpdchk 0555 root bin
+f usr/sbin/tcpdmatch 0555 root bin
+f usr/sbin/traceroute 4555 root bin
+h usr/sbin/trapstat=usr/lib/platexec
+f usr/sbin/try-from 0555 root bin
+f usr/sbin/ttyadm 0755 root sys
+s usr/sbin/tunefs=../lib/fs/ufs/tunefs
+s usr/sbin/tzreload=../../sbin/tzreload
+s usr/sbin/uadmin=../../sbin/uadmin
+f usr/sbin/ucodeadm 0555 root bin
+s usr/sbin/ufsdump=../lib/fs/ufs/ufsdump
+s usr/sbin/ufsrestore=../lib/fs/ufs/ufsrestore
+s usr/sbin/umount=../../sbin/umount
+f usr/sbin/umountall 0555 root sys
+f usr/sbin/unlink 0555 root bin
+h usr/sbin/unshare=usr/sbin/sharemgr
+f usr/sbin/unshareall 0555 root bin
+h usr/sbin/update_drv=usr/lib/isaexec
+h usr/sbin/useradd=usr/sbin/roleadd
+h usr/sbin/userdel=usr/sbin/roledel
+h usr/sbin/usermod=usr/sbin/rolemod
+f usr/sbin/volcopy 0555 root bin
+f usr/sbin/vrrpadm 0555 root bin
+f usr/sbin/wall 2555 root tty
+h usr/sbin/whodo=usr/lib/isaexec
+s usr/sbin/wusbadm=../../sbin/wusbadm
+f usr/sbin/ypalias 0555 root bin
+f usr/sbin/ypinit 0555 root bin
+f usr/sbin/yppoll 0555 root bin
+f usr/sbin/ypset 0555 root bin
+h usr/sbin/zdb=usr/lib/isaexec
+f usr/sbin/zdump 0555 root bin
+s usr/sbin/zfs=../../sbin/zfs
+f usr/sbin/zic 0555 root bin
+f usr/sbin/zlogin 0555 root bin
+f usr/sbin/zoneadm 0555 root bin
+f usr/sbin/zonecfg 0555 root bin
+s usr/sbin/zpool=../../sbin/zpool
+f usr/sbin/zstreamdump 0555 root bin
+d usr/sfw 0755 root bin
+d usr/sfw/bin 0755 root bin
+d usr/sfw/bin/amd64 0755 root bin
+s usr/sfw/man=share/man
+d usr/sfw/share 0755 root bin
+d usr/share 0755 root sys
+d usr/share/hwdata 0755 root sys
+f usr/share/hwdata/pci.ids 0444 root bin
+d usr/share/lib 0755 root sys
+d usr/share/lib/dict 0755 root bin
+f usr/share/lib/dict/words 0444 root bin
+d usr/share/lib/idn 0755 root sys
+d usr/share/lib/java 0755 root sys
+d usr/share/lib/keytables 0755 root bin
+d usr/share/lib/keytables/type_6 0755 root bin
+f usr/share/lib/keytables/type_6/albania 0444 root bin
+f usr/share/lib/keytables/type_6/arabia 0444 root bin
+f usr/share/lib/keytables/type_6/belarus 0444 root bin
+f usr/share/lib/keytables/type_6/belgium 0444 root bin
+f usr/share/lib/keytables/type_6/brazil 0444 root bin
+f usr/share/lib/keytables/type_6/bulgaria 0444 root bin
+f usr/share/lib/keytables/type_6/canadian_bilingual 0444 root bin
+f usr/share/lib/keytables/type_6/canadian_french 0444 root bin
+f usr/share/lib/keytables/type_6/croatia 0444 root bin
+f usr/share/lib/keytables/type_6/czech 0444 root bin
+f usr/share/lib/keytables/type_6/denmark 0444 root bin
+f usr/share/lib/keytables/type_6/dvorak 0444 root bin
+f usr/share/lib/keytables/type_6/estonia 0444 root bin
+f usr/share/lib/keytables/type_6/finnish 0444 root bin
+f usr/share/lib/keytables/type_6/france 0444 root bin
+f usr/share/lib/keytables/type_6/germany 0444 root bin
+f usr/share/lib/keytables/type_6/greece 0444 root bin
+f usr/share/lib/keytables/type_6/hungary 0444 root bin
+f usr/share/lib/keytables/type_6/iceland 0444 root bin
+f usr/share/lib/keytables/type_6/italy 0444 root bin
+f usr/share/lib/keytables/type_6/japan 0444 root bin
+f usr/share/lib/keytables/type_6/kbd_layouts 0444 root bin
+f usr/share/lib/keytables/type_6/korea 0444 root bin
+f usr/share/lib/keytables/type_6/latinamerica 0444 root bin
+f usr/share/lib/keytables/type_6/latvia 0444 root bin
+h usr/share/lib/keytables/type_6/layout_00=usr/share/lib/keytables/type_6/us
+h usr/share/lib/keytables/type_6/layout_01=usr/share/lib/keytables/type_6/arabia
+h usr/share/lib/keytables/type_6/layout_02=usr/share/lib/keytables/type_6/belgium
+h usr/share/lib/keytables/type_6/layout_03=usr/share/lib/keytables/type_6/canadian_bilingual
+h usr/share/lib/keytables/type_6/layout_04=usr/share/lib/keytables/type_6/canadian_french
+h usr/share/lib/keytables/type_6/layout_05=usr/share/lib/keytables/type_6/czech
+h usr/share/lib/keytables/type_6/layout_06=usr/share/lib/keytables/type_6/denmark
+h usr/share/lib/keytables/type_6/layout_07=usr/share/lib/keytables/type_6/finnish
+h usr/share/lib/keytables/type_6/layout_08=usr/share/lib/keytables/type_6/france
+h usr/share/lib/keytables/type_6/layout_09=usr/share/lib/keytables/type_6/germany
+h usr/share/lib/keytables/type_6/layout_0a=usr/share/lib/keytables/type_6/greece
+h usr/share/lib/keytables/type_6/layout_0c=usr/share/lib/keytables/type_6/hungary
+h usr/share/lib/keytables/type_6/layout_0e=usr/share/lib/keytables/type_6/italy
+h usr/share/lib/keytables/type_6/layout_0f=usr/share/lib/keytables/type_6/japan
+h usr/share/lib/keytables/type_6/layout_100=usr/share/lib/keytables/type_6/slovenia
+h usr/share/lib/keytables/type_6/layout_101=usr/share/lib/keytables/type_6/serbiaandmontenegro
+h usr/share/lib/keytables/type_6/layout_102=usr/share/lib/keytables/type_6/iceland
+h usr/share/lib/keytables/type_6/layout_103=usr/share/lib/keytables/type_6/croatia
+h usr/share/lib/keytables/type_6/layout_104=usr/share/lib/keytables/type_6/bulgaria
+h usr/share/lib/keytables/type_6/layout_105=usr/share/lib/keytables/type_6/belarus
+h usr/share/lib/keytables/type_6/layout_106=usr/share/lib/keytables/type_6/maltaus
+h usr/share/lib/keytables/type_6/layout_107=usr/share/lib/keytables/type_6/maltauk
+h usr/share/lib/keytables/type_6/layout_108=usr/share/lib/keytables/type_6/albania
+h usr/share/lib/keytables/type_6/layout_109=usr/share/lib/keytables/type_6/lithuania
+h usr/share/lib/keytables/type_6/layout_10=usr/share/lib/keytables/type_6/korea
+h usr/share/lib/keytables/type_6/layout_10a=usr/share/lib/keytables/type_6/latvia
+h usr/share/lib/keytables/type_6/layout_10b=usr/share/lib/keytables/type_6/macedonia
+h usr/share/lib/keytables/type_6/layout_10f=usr/share/lib/keytables/type_6/japan
+h usr/share/lib/keytables/type_6/layout_110=usr/share/lib/keytables/type_6/brazil
+h usr/share/lib/keytables/type_6/layout_111=usr/share/lib/keytables/type_6/dvorak
+h usr/share/lib/keytables/type_6/layout_112=usr/share/lib/keytables/type_6/estonia
+h usr/share/lib/keytables/type_6/layout_113=usr/share/lib/keytables/type_6/romania
+h usr/share/lib/keytables/type_6/layout_11=usr/share/lib/keytables/type_6/latinamerica
+h usr/share/lib/keytables/type_6/layout_12=usr/share/lib/keytables/type_6/netherlands
+h usr/share/lib/keytables/type_6/layout_13=usr/share/lib/keytables/type_6/norway
+h usr/share/lib/keytables/type_6/layout_15=usr/share/lib/keytables/type_6/poland
+h usr/share/lib/keytables/type_6/layout_16=usr/share/lib/keytables/type_6/portugal
+h usr/share/lib/keytables/type_6/layout_17=usr/share/lib/keytables/type_6/russia
+h usr/share/lib/keytables/type_6/layout_18=usr/share/lib/keytables/type_6/slovakia
+h usr/share/lib/keytables/type_6/layout_19=usr/share/lib/keytables/type_6/spain
+h usr/share/lib/keytables/type_6/layout_1a=usr/share/lib/keytables/type_6/sweden
+h usr/share/lib/keytables/type_6/layout_1b=usr/share/lib/keytables/type_6/swiss_french
+h usr/share/lib/keytables/type_6/layout_1c=usr/share/lib/keytables/type_6/swiss_german
+h usr/share/lib/keytables/type_6/layout_1e=usr/share/lib/keytables/type_6/traditional_chinese
+h usr/share/lib/keytables/type_6/layout_1f=usr/share/lib/keytables/type_6/turkeyq
+h usr/share/lib/keytables/type_6/layout_20=usr/share/lib/keytables/type_6/uk
+h usr/share/lib/keytables/type_6/layout_21=usr/share/lib/keytables/type_6/us
+h usr/share/lib/keytables/type_6/layout_23=usr/share/lib/keytables/type_6/turkeyf
+f usr/share/lib/keytables/type_6/lithuania 0444 root bin
+f usr/share/lib/keytables/type_6/macedonia 0444 root bin
+f usr/share/lib/keytables/type_6/maltauk 0444 root bin
+f usr/share/lib/keytables/type_6/maltaus 0444 root bin
+f usr/share/lib/keytables/type_6/netherlands 0444 root bin
+f usr/share/lib/keytables/type_6/norway 0444 root bin
+f usr/share/lib/keytables/type_6/poland 0444 root bin
+f usr/share/lib/keytables/type_6/portugal 0444 root bin
+f usr/share/lib/keytables/type_6/reset 0444 root bin
+f usr/share/lib/keytables/type_6/romania 0444 root bin
+f usr/share/lib/keytables/type_6/russia 0444 root bin
+f usr/share/lib/keytables/type_6/serbiaandmontenegro 0444 root bin
+f usr/share/lib/keytables/type_6/slovakia 0444 root bin
+f usr/share/lib/keytables/type_6/slovenia 0444 root bin
+f usr/share/lib/keytables/type_6/spain 0444 root bin
+f usr/share/lib/keytables/type_6/sweden 0444 root bin
+f usr/share/lib/keytables/type_6/swiss_french 0444 root bin
+f usr/share/lib/keytables/type_6/swiss_german 0444 root bin
+f usr/share/lib/keytables/type_6/traditional_chinese 0444 root bin
+f usr/share/lib/keytables/type_6/turkeyf 0444 root bin
+f usr/share/lib/keytables/type_6/turkeyq 0444 root bin
+f usr/share/lib/keytables/type_6/uk 0444 root bin
+f usr/share/lib/keytables/type_6/us 0444 root bin
+d usr/share/lib/mailx 0755 root bin
+d usr/share/lib/nterm 0755 root bin
+f usr/share/lib/nterm/tab.2631 0644 root bin
+f usr/share/lib/nterm/tab.2631-c 0644 root bin
+f usr/share/lib/nterm/tab.2631-e 0644 root bin
+f usr/share/lib/nterm/tab.300 0644 root bin
+f usr/share/lib/nterm/tab.300-12 0644 root bin
+f usr/share/lib/nterm/tab.300S 0644 root bin
+f usr/share/lib/nterm/tab.300S-12 0644 root bin
+f usr/share/lib/nterm/tab.300s 0644 root bin
+f usr/share/lib/nterm/tab.300s-12 0644 root bin
+f usr/share/lib/nterm/tab.37 0644 root bin
+f usr/share/lib/nterm/tab.382 0644 root bin
+f usr/share/lib/nterm/tab.4000A 0644 root bin
+f usr/share/lib/nterm/tab.4000a 0644 root bin
+f usr/share/lib/nterm/tab.450 0644 root bin
+f usr/share/lib/nterm/tab.450-12 0644 root bin
+f usr/share/lib/nterm/tab.832 0644 root bin
+f usr/share/lib/nterm/tab.8510 0644 root bin
+f usr/share/lib/nterm/tab.X 0644 root bin
+f usr/share/lib/nterm/tab.lp 0644 root bin
+f usr/share/lib/nterm/tab.tn300 0644 root bin
+d usr/share/lib/pub 0755 root bin
+f usr/share/lib/pub/ascii 0644 root bin
+f usr/share/lib/pub/eqnchar 0644 root bin
+f usr/share/lib/pub/greek 0644 root bin
+f usr/share/lib/pub/iso 0644 root bin
+d usr/share/lib/sgml 0755 root bin
+d usr/share/lib/tabset 0755 root bin
+f usr/share/lib/tabset/3101 0644 root bin
+f usr/share/lib/tabset/beehive 0644 root bin
+f usr/share/lib/tabset/hds 0644 root bin
+f usr/share/lib/tabset/hds3 0644 root bin
+f usr/share/lib/tabset/std 0644 root bin
+f usr/share/lib/tabset/stdcrt 0644 root bin
+f usr/share/lib/tabset/teleray 0644 root bin
+f usr/share/lib/tabset/vt100 0644 root bin
+f usr/share/lib/tabset/wyse-adds 0644 root bin
+f usr/share/lib/tabset/xerox1720 0644 root bin
+f usr/share/lib/termcap 0644 root bin
+d usr/share/lib/terminfo 0755 root bin
+d usr/share/lib/terminfo/3 0755 root bin
+f usr/share/lib/terminfo/3/386at 0644 root bin
+d usr/share/lib/terminfo/A 0755 root bin
+d usr/share/lib/terminfo/a 0755 root bin
+f usr/share/lib/terminfo/a/ansi 0644 root bin
+f usr/share/lib/terminfo/a/ansi+arrows 0644 root bin
+f usr/share/lib/terminfo/a/at386 0644 root bin
+d usr/share/lib/terminfo/s 0755 root bin
+f usr/share/lib/terminfo/s/screen 0644 root bin
+f usr/share/lib/terminfo/s/screen-w 0644 root bin
+f usr/share/lib/terminfo/s/screen-256color 0644 root bin
+f usr/share/lib/terminfo/s/sun 0644 root bin
+f usr/share/lib/terminfo/s/sun-color 0644 root bin
+d usr/share/lib/terminfo/u 0755 root bin
+f usr/share/lib/terminfo/u/unknown 0644 root bin
+d usr/share/lib/terminfo/v 0755 root bin
+f usr/share/lib/terminfo/v/vt100 0644 root bin
+f usr/share/lib/terminfo/v/vt220 0644 root bin
+d usr/share/lib/terminfo/x 0755 root bin
+f usr/share/lib/terminfo/x/xterm 0644 root bin
+f usr/share/lib/terminfo/x/xterm-256color 0644 root bin
+f usr/share/lib/terminfo/x/xterm-color 0644 root bin
+f usr/share/lib/terminfo/x/xtermc 0644 root bin
+f usr/share/lib/terminfo/x/xtermm 0644 root bin
+f usr/share/lib/terminfo/x/xterms 0644 root bin
+d usr/share/lib/tmac 0755 root bin
+f usr/share/lib/tmac/acm.me 0644 root bin
+f usr/share/lib/tmac/an 0644 root bin
+f usr/share/lib/tmac/ansun 0644 root bin
+f usr/share/lib/tmac/ansun.tbl 0644 root bin
+f usr/share/lib/tmac/bib 0644 root bin
+f usr/share/lib/tmac/chars.me 0644 root bin
+f usr/share/lib/tmac/deltext.me 0644 root bin
+f usr/share/lib/tmac/e 0644 root bin
+f usr/share/lib/tmac/eqn.me 0644 root bin
+f usr/share/lib/tmac/float.me 0644 root bin
+f usr/share/lib/tmac/footnote.me 0644 root bin
+f usr/share/lib/tmac/index.me 0644 root bin
+f usr/share/lib/tmac/local.me 0644 root bin
+f usr/share/lib/tmac/m 0644 root bin
+f usr/share/lib/tmac/mmn 0644 root bin
+f usr/share/lib/tmac/mmt 0644 root bin
+f usr/share/lib/tmac/ms.acc 0644 root bin
+f usr/share/lib/tmac/ms.cov 0644 root bin
+f usr/share/lib/tmac/ms.eqn 0644 root bin
+f usr/share/lib/tmac/ms.ref 0644 root bin
+f usr/share/lib/tmac/ms.tbl 0644 root bin
+f usr/share/lib/tmac/ms.ths 0644 root bin
+f usr/share/lib/tmac/ms.toc 0644 root bin
+f usr/share/lib/tmac/null.me 0644 root bin
+f usr/share/lib/tmac/refer.me 0644 root bin
+f usr/share/lib/tmac/s 0644 root bin
+f usr/share/lib/tmac/sh.me 0644 root bin
+f usr/share/lib/tmac/tbl.me 0644 root bin
+f usr/share/lib/tmac/thesis.me 0644 root bin
+f usr/share/lib/tmac/tmac.bib 0644 root bin
+f usr/share/lib/tmac/tmac.vgrind 0644 root bin
+f usr/share/lib/tmac/tz.map 0644 root bin
+f usr/share/lib/tmac/v 0644 root bin
+f usr/share/lib/tmac/vgrind 0644 root bin
+f usr/share/lib/unittab 0444 root bin
+d usr/share/lib/xml 0755 root sys
+d usr/share/lib/xml/dtd 0755 root sys
+f usr/share/lib/xml/dtd/adt_record.dtd.1 0444 root bin
+f usr/share/lib/xml/dtd/brand.dtd.1 0644 root bin
+f usr/share/lib/xml/dtd/kmfpolicy.dtd 0444 root bin
+f usr/share/lib/xml/dtd/rm_pool.dtd.1 0444 root bin
+f usr/share/lib/xml/dtd/service_bundle.dtd.1 0444 root sys
+f usr/share/lib/xml/dtd/topology.dtd.1 0444 root bin
+f usr/share/lib/xml/dtd/zone_platform.dtd.1 0644 root bin
+f usr/share/lib/xml/dtd/zonecfg.dtd.1 0444 root bin
+d usr/share/lib/xml/style 0755 root sys
+f usr/share/lib/xml/style/adt_record.xsl.1 0444 root bin
+d usr/share/lib/zoneinfo 0755 root bin
+d usr/share/lib/zoneinfo/Africa 0755 root bin
+f usr/share/lib/zoneinfo/Africa/Abidjan 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Accra 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Addis_Ababa 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Algiers 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Asmara 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Asmera 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Bamako 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Bangui 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Banjul 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Bissau 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Blantyre 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Brazzaville 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Bujumbura 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Cairo 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Casablanca 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Ceuta 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Conakry 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Dakar 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Dar_es_Salaam 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Djibouti 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Douala 0644 root bin
+f usr/share/lib/zoneinfo/Africa/El_Aaiun 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Freetown 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Gaborone 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Harare 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Johannesburg 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Kampala 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Khartoum 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Kigali 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Kinshasa 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Lagos 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Libreville 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Lome 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Luanda 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Lubumbashi 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Lusaka 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Malabo 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Maputo 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Maseru 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Mbabane 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Mogadishu 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Monrovia 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Nairobi 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Ndjamena 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Niamey 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Nouakchott 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Ouagadougou 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Porto-Novo 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Sao_Tome 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Timbuktu 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Tripoli 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Tunis 0644 root bin
+f usr/share/lib/zoneinfo/Africa/Windhoek 0644 root bin
+d usr/share/lib/zoneinfo/America 0755 root bin
+h usr/share/lib/zoneinfo/America/Adak=usr/share/lib/zoneinfo/US/Aleutian
+f usr/share/lib/zoneinfo/America/Anchorage 0644 root bin
+f usr/share/lib/zoneinfo/America/Anguilla 0644 root bin
+f usr/share/lib/zoneinfo/America/Antigua 0644 root bin
+f usr/share/lib/zoneinfo/America/Araguaina 0644 root bin
+d usr/share/lib/zoneinfo/America/Argentina 0755 root bin
+f usr/share/lib/zoneinfo/America/Argentina/Buenos_Aires 0644 root bin
+h usr/share/lib/zoneinfo/America/Argentina/Catamarca=usr/share/lib/zoneinfo/America/Catamarca
+h usr/share/lib/zoneinfo/America/Argentina/ComodRivadavia=usr/share/lib/zoneinfo/America/Catamarca
+h usr/share/lib/zoneinfo/America/Argentina/Cordoba=usr/share/lib/zoneinfo/America/Cordoba
+f usr/share/lib/zoneinfo/America/Argentina/Jujuy 0644 root bin
+f usr/share/lib/zoneinfo/America/Argentina/La_Rioja 0644 root bin
+f usr/share/lib/zoneinfo/America/Argentina/Mendoza 0644 root bin
+f usr/share/lib/zoneinfo/America/Argentina/Rio_Gallegos 0644 root bin
+f usr/share/lib/zoneinfo/America/Argentina/Salta 0644 root bin
+f usr/share/lib/zoneinfo/America/Argentina/San_Juan 0644 root bin
+f usr/share/lib/zoneinfo/America/Argentina/San_Luis 0644 root bin
+f usr/share/lib/zoneinfo/America/Argentina/Tucuman 0644 root bin
+f usr/share/lib/zoneinfo/America/Argentina/Ushuaia 0644 root bin
+f usr/share/lib/zoneinfo/America/Aruba 0644 root bin
+f usr/share/lib/zoneinfo/America/Asuncion 0644 root bin
+f usr/share/lib/zoneinfo/America/Atikokan 0644 root bin
+h usr/share/lib/zoneinfo/America/Atka=usr/share/lib/zoneinfo/US/Aleutian
+f usr/share/lib/zoneinfo/America/Bahia 0644 root bin
+f usr/share/lib/zoneinfo/America/Bahia_Banderas 0644 root bin
+f usr/share/lib/zoneinfo/America/Barbados 0644 root bin
+f usr/share/lib/zoneinfo/America/Belem 0644 root bin
+f usr/share/lib/zoneinfo/America/Belize 0644 root bin
+f usr/share/lib/zoneinfo/America/Blanc-Sablon 0644 root bin
+f usr/share/lib/zoneinfo/America/Boa_Vista 0644 root bin
+f usr/share/lib/zoneinfo/America/Bogota 0644 root bin
+f usr/share/lib/zoneinfo/America/Boise 0644 root bin
+f usr/share/lib/zoneinfo/America/Buenos_Aires 0644 root bin
+f usr/share/lib/zoneinfo/America/Cambridge_Bay 0644 root bin
+f usr/share/lib/zoneinfo/America/Campo_Grande 0644 root bin
+f usr/share/lib/zoneinfo/America/Cancun 0644 root bin
+f usr/share/lib/zoneinfo/America/Caracas 0644 root bin
+f usr/share/lib/zoneinfo/America/Catamarca 0644 root bin
+f usr/share/lib/zoneinfo/America/Cayenne 0644 root bin
+f usr/share/lib/zoneinfo/America/Cayman 0644 root bin
+f usr/share/lib/zoneinfo/America/Chicago 0644 root bin
+f usr/share/lib/zoneinfo/America/Chihuahua 0644 root bin
+f usr/share/lib/zoneinfo/America/Coral_Harbour 0644 root bin
+f usr/share/lib/zoneinfo/America/Cordoba 0644 root bin
+f usr/share/lib/zoneinfo/America/Costa_Rica 0644 root bin
+f usr/share/lib/zoneinfo/America/Cuiaba 0644 root bin
+f usr/share/lib/zoneinfo/America/Curacao 0644 root bin
+f usr/share/lib/zoneinfo/America/Danmarkshavn 0644 root bin
+f usr/share/lib/zoneinfo/America/Dawson 0644 root bin
+f usr/share/lib/zoneinfo/America/Dawson_Creek 0644 root bin
+h usr/share/lib/zoneinfo/America/Denver=usr/share/lib/zoneinfo/US/Mountain
+f usr/share/lib/zoneinfo/America/Detroit 0644 root bin
+f usr/share/lib/zoneinfo/America/Dominica 0644 root bin
+f usr/share/lib/zoneinfo/America/Edmonton 0644 root bin
+f usr/share/lib/zoneinfo/America/Eirunepe 0644 root bin
+f usr/share/lib/zoneinfo/America/El_Salvador 0644 root bin
+h usr/share/lib/zoneinfo/America/Ensenada=usr/share/lib/zoneinfo/America/Tijuana
+h usr/share/lib/zoneinfo/America/Fort_Wayne=usr/share/lib/zoneinfo/US/East-Indiana
+f usr/share/lib/zoneinfo/America/Fortaleza 0644 root bin
+f usr/share/lib/zoneinfo/America/Glace_Bay 0644 root bin
+f usr/share/lib/zoneinfo/America/Godthab 0644 root bin
+f usr/share/lib/zoneinfo/America/Goose_Bay 0644 root bin
+f usr/share/lib/zoneinfo/America/Grand_Turk 0644 root bin
+f usr/share/lib/zoneinfo/America/Grenada 0644 root bin
+f usr/share/lib/zoneinfo/America/Guadeloupe 0644 root bin
+f usr/share/lib/zoneinfo/America/Guatemala 0644 root bin
+f usr/share/lib/zoneinfo/America/Guayaquil 0644 root bin
+f usr/share/lib/zoneinfo/America/Guyana 0644 root bin
+f usr/share/lib/zoneinfo/America/Halifax 0644 root bin
+f usr/share/lib/zoneinfo/America/Havana 0644 root bin
+f usr/share/lib/zoneinfo/America/Hermosillo 0644 root bin
+d usr/share/lib/zoneinfo/America/Indiana 0755 root bin
+h usr/share/lib/zoneinfo/America/Indiana/Indianapolis=usr/share/lib/zoneinfo/US/East-Indiana
+h usr/share/lib/zoneinfo/America/Indiana/Knox=usr/share/lib/zoneinfo/America/Knox_IN
+f usr/share/lib/zoneinfo/America/Indiana/Marengo 0644 root bin
+f usr/share/lib/zoneinfo/America/Indiana/Petersburg 0644 root bin
+f usr/share/lib/zoneinfo/America/Indiana/Tell_City 0644 root bin
+f usr/share/lib/zoneinfo/America/Indiana/Vevay 0644 root bin
+f usr/share/lib/zoneinfo/America/Indiana/Vincennes 0644 root bin
+f usr/share/lib/zoneinfo/America/Indiana/Winamac 0644 root bin
+h usr/share/lib/zoneinfo/America/Indianapolis=usr/share/lib/zoneinfo/US/East-Indiana
+f usr/share/lib/zoneinfo/America/Inuvik 0644 root bin
+f usr/share/lib/zoneinfo/America/Iqaluit 0644 root bin
+f usr/share/lib/zoneinfo/America/Jamaica 0644 root bin
+f usr/share/lib/zoneinfo/America/Jujuy 0644 root bin
+f usr/share/lib/zoneinfo/America/Juneau 0644 root bin
+d usr/share/lib/zoneinfo/America/Kentucky 0755 root bin
+f usr/share/lib/zoneinfo/America/Kentucky/Louisville 0644 root bin
+f usr/share/lib/zoneinfo/America/Kentucky/Monticello 0644 root bin
+f usr/share/lib/zoneinfo/America/Knox_IN 0644 root bin
+f usr/share/lib/zoneinfo/America/La_Paz 0644 root bin
+f usr/share/lib/zoneinfo/America/Lima 0644 root bin
+h usr/share/lib/zoneinfo/America/Los_Angeles=usr/share/lib/zoneinfo/US/Pacific
+f usr/share/lib/zoneinfo/America/Louisville 0644 root bin
+f usr/share/lib/zoneinfo/America/Maceio 0644 root bin
+f usr/share/lib/zoneinfo/America/Managua 0644 root bin
+f usr/share/lib/zoneinfo/America/Manaus 0644 root bin
+h usr/share/lib/zoneinfo/America/Marigot=usr/share/lib/zoneinfo/America/Guadeloupe
+f usr/share/lib/zoneinfo/America/Martinique 0644 root bin
+f usr/share/lib/zoneinfo/America/Matamoros 0644 root bin
+f usr/share/lib/zoneinfo/America/Mazatlan 0644 root bin
+f usr/share/lib/zoneinfo/America/Mendoza 0644 root bin
+f usr/share/lib/zoneinfo/America/Menominee 0644 root bin
+f usr/share/lib/zoneinfo/America/Merida 0644 root bin
+f usr/share/lib/zoneinfo/America/Mexico_City 0644 root bin
+f usr/share/lib/zoneinfo/America/Miquelon 0644 root bin
+f usr/share/lib/zoneinfo/America/Moncton 0644 root bin
+f usr/share/lib/zoneinfo/America/Monterrey 0644 root bin
+f usr/share/lib/zoneinfo/America/Montevideo 0644 root bin
+f usr/share/lib/zoneinfo/America/Montreal 0644 root bin
+f usr/share/lib/zoneinfo/America/Montserrat 0644 root bin
+f usr/share/lib/zoneinfo/America/Nassau 0644 root bin
+f usr/share/lib/zoneinfo/America/New_York 0644 root bin
+f usr/share/lib/zoneinfo/America/Nipigon 0644 root bin
+f usr/share/lib/zoneinfo/America/Nome 0644 root bin
+f usr/share/lib/zoneinfo/America/Noronha 0644 root bin
+d usr/share/lib/zoneinfo/America/North_Dakota 0755 root bin
+f usr/share/lib/zoneinfo/America/North_Dakota/Center 0644 root bin
+f usr/share/lib/zoneinfo/America/North_Dakota/New_Salem 0644 root bin
+f usr/share/lib/zoneinfo/America/Ojinaga 0644 root bin
+f usr/share/lib/zoneinfo/America/Panama 0644 root bin
+f usr/share/lib/zoneinfo/America/Pangnirtung 0644 root bin
+f usr/share/lib/zoneinfo/America/Paramaribo 0644 root bin
+f usr/share/lib/zoneinfo/America/Phoenix 0644 root bin
+f usr/share/lib/zoneinfo/America/Port-au-Prince 0644 root bin
+f usr/share/lib/zoneinfo/America/Port_of_Spain 0644 root bin
+h usr/share/lib/zoneinfo/America/Porto_Acre=usr/share/lib/zoneinfo/Brazil/Acre
+f usr/share/lib/zoneinfo/America/Porto_Velho 0644 root bin
+f usr/share/lib/zoneinfo/America/Puerto_Rico 0644 root bin
+f usr/share/lib/zoneinfo/America/Rainy_River 0644 root bin
+f usr/share/lib/zoneinfo/America/Rankin_Inlet 0644 root bin
+f usr/share/lib/zoneinfo/America/Recife 0644 root bin
+h usr/share/lib/zoneinfo/America/Regina=usr/share/lib/zoneinfo/Canada/Saskatchewan
+f usr/share/lib/zoneinfo/America/Resolute 0644 root bin
+h usr/share/lib/zoneinfo/America/Rio_Branco=usr/share/lib/zoneinfo/Brazil/Acre
+h usr/share/lib/zoneinfo/America/Rosario=usr/share/lib/zoneinfo/America/Cordoba
+f usr/share/lib/zoneinfo/America/Santa_Isabel 0644 root bin
+f usr/share/lib/zoneinfo/America/Santarem 0644 root bin
+f usr/share/lib/zoneinfo/America/Santiago 0644 root bin
+f usr/share/lib/zoneinfo/America/Santo_Domingo 0644 root bin
+f usr/share/lib/zoneinfo/America/Sao_Paulo 0644 root bin
+f usr/share/lib/zoneinfo/America/Scoresbysund 0644 root bin
+h usr/share/lib/zoneinfo/America/Shiprock=usr/share/lib/zoneinfo/US/Mountain
+h usr/share/lib/zoneinfo/America/St_Barthelemy=usr/share/lib/zoneinfo/America/Guadeloupe
+f usr/share/lib/zoneinfo/America/St_Johns 0644 root bin
+f usr/share/lib/zoneinfo/America/St_Kitts 0644 root bin
+f usr/share/lib/zoneinfo/America/St_Lucia 0644 root bin
+f usr/share/lib/zoneinfo/America/St_Thomas 0644 root bin
+f usr/share/lib/zoneinfo/America/St_Vincent 0644 root bin
+f usr/share/lib/zoneinfo/America/Swift_Current 0644 root bin
+f usr/share/lib/zoneinfo/America/Tegucigalpa 0644 root bin
+f usr/share/lib/zoneinfo/America/Thule 0644 root bin
+f usr/share/lib/zoneinfo/America/Thunder_Bay 0644 root bin
+f usr/share/lib/zoneinfo/America/Tijuana 0644 root bin
+f usr/share/lib/zoneinfo/America/Toronto 0644 root bin
+f usr/share/lib/zoneinfo/America/Tortola 0644 root bin
+f usr/share/lib/zoneinfo/America/Vancouver 0644 root bin
+f usr/share/lib/zoneinfo/America/Virgin 0644 root bin
+f usr/share/lib/zoneinfo/America/Whitehorse 0644 root bin
+f usr/share/lib/zoneinfo/America/Winnipeg 0644 root bin
+f usr/share/lib/zoneinfo/America/Yakutat 0644 root bin
+f usr/share/lib/zoneinfo/America/Yellowknife 0644 root bin
+d usr/share/lib/zoneinfo/Antarctica 0755 root bin
+f usr/share/lib/zoneinfo/Antarctica/Casey 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/Davis 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/DumontDUrville 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/Macquarie 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/Mawson 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/McMurdo 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/Palmer 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/Rothera 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/South_Pole 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/Syowa 0644 root bin
+f usr/share/lib/zoneinfo/Antarctica/Vostok 0644 root bin
+d usr/share/lib/zoneinfo/Arctic 0755 root bin
+h usr/share/lib/zoneinfo/Arctic/Longyearbyen=usr/share/lib/zoneinfo/Europe/Oslo
+d usr/share/lib/zoneinfo/Asia 0755 root bin
+f usr/share/lib/zoneinfo/Asia/Aden 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Almaty 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Amman 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Anadyr 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Aqtau 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Aqtobe 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Ashgabat 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Ashkhabad 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Baghdad 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Bahrain 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Baku 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Bangkok 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Beirut 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Bishkek 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Brunei 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Calcutta 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Choibalsan 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Chongqing 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Chungking 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Colombo 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Dacca 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Damascus 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Dhaka 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Dili 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Dubai 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Dushanbe 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Gaza 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Harbin 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Ho_Chi_Minh 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Hong_Kong 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Hovd 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Irkutsk 0644 root bin
+h usr/share/lib/zoneinfo/Asia/Istanbul=usr/share/lib/zoneinfo/Turkey
+f usr/share/lib/zoneinfo/Asia/Jakarta 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Jayapura 0644 root bin
+h usr/share/lib/zoneinfo/Asia/Jerusalem=usr/share/lib/zoneinfo/Israel
+f usr/share/lib/zoneinfo/Asia/Kabul 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Kamchatka 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Karachi 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Kashgar 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Kathmandu 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Katmandu 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Kolkata 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Krasnoyarsk 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Kuala_Lumpur 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Kuching 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Kuwait 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Macao 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Macau 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Magadan 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Makassar 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Manila 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Muscat 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Nicosia 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Novokuznetsk 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Novosibirsk 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Omsk 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Oral 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Phnom_Penh 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Pontianak 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Pyongyang 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Qatar 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Qyzylorda 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Rangoon 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Riyadh 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Riyadh87 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Riyadh88 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Riyadh89 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Saigon 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Sakhalin 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Samarkand 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Seoul 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Shanghai 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Singapore 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Taipei 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Tashkent 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Tbilisi 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Tehran 0644 root bin
+h usr/share/lib/zoneinfo/Asia/Tel_Aviv=usr/share/lib/zoneinfo/Israel
+f usr/share/lib/zoneinfo/Asia/Thimbu 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Thimphu 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Tokyo 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Ujung_Pandang 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Ulaanbaatar 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Ulan_Bator 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Urumqi 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Vientiane 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Vladivostok 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Yakutsk 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Yekaterinburg 0644 root bin
+f usr/share/lib/zoneinfo/Asia/Yerevan 0644 root bin
+d usr/share/lib/zoneinfo/Atlantic 0755 root bin
+f usr/share/lib/zoneinfo/Atlantic/Azores 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/Bermuda 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/Canary 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/Cape_Verde 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/Faeroe 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/Faroe 0644 root bin
+h usr/share/lib/zoneinfo/Atlantic/Jan_Mayen=usr/share/lib/zoneinfo/Europe/Oslo
+f usr/share/lib/zoneinfo/Atlantic/Madeira 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/Reykjavik 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/South_Georgia 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/St_Helena 0644 root bin
+f usr/share/lib/zoneinfo/Atlantic/Stanley 0644 root bin
+d usr/share/lib/zoneinfo/Australia 0755 root bin
+f usr/share/lib/zoneinfo/Australia/ACT 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Adelaide 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Brisbane 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Broken_Hill 0644 root bin
+h usr/share/lib/zoneinfo/Australia/Canberra=usr/share/lib/zoneinfo/Australia/ACT
+f usr/share/lib/zoneinfo/Australia/Currie 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Darwin 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Eucla 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Hobart 0644 root bin
+f usr/share/lib/zoneinfo/Australia/LHI 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Lindeman 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Lord_Howe 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Melbourne 0644 root bin
+h usr/share/lib/zoneinfo/Australia/NSW=usr/share/lib/zoneinfo/Australia/ACT
+f usr/share/lib/zoneinfo/Australia/North 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Perth 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Queensland 0644 root bin
+f usr/share/lib/zoneinfo/Australia/South 0644 root bin
+h usr/share/lib/zoneinfo/Australia/Sydney=usr/share/lib/zoneinfo/Australia/ACT
+f usr/share/lib/zoneinfo/Australia/Tasmania 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Victoria 0644 root bin
+f usr/share/lib/zoneinfo/Australia/West 0644 root bin
+f usr/share/lib/zoneinfo/Australia/Yancowinna 0644 root bin
+d usr/share/lib/zoneinfo/Brazil 0755 root bin
+f usr/share/lib/zoneinfo/Brazil/Acre 0644 root bin
+f usr/share/lib/zoneinfo/Brazil/DeNoronha 0644 root bin
+f usr/share/lib/zoneinfo/Brazil/East 0644 root bin
+f usr/share/lib/zoneinfo/Brazil/West 0644 root bin
+f usr/share/lib/zoneinfo/CET 0644 root bin
+f usr/share/lib/zoneinfo/CST6CDT 0644 root bin
+d usr/share/lib/zoneinfo/Canada 0755 root bin
+f usr/share/lib/zoneinfo/Canada/Atlantic 0644 root bin
+f usr/share/lib/zoneinfo/Canada/Central 0644 root bin
+h usr/share/lib/zoneinfo/Canada/East-Saskatchewan=usr/share/lib/zoneinfo/Canada/Saskatchewan
+f usr/share/lib/zoneinfo/Canada/Eastern 0644 root bin
+f usr/share/lib/zoneinfo/Canada/Mountain 0644 root bin
+f usr/share/lib/zoneinfo/Canada/Newfoundland 0644 root bin
+f usr/share/lib/zoneinfo/Canada/Pacific 0644 root bin
+f usr/share/lib/zoneinfo/Canada/Saskatchewan 0644 root bin
+f usr/share/lib/zoneinfo/Canada/Yukon 0644 root bin
+d usr/share/lib/zoneinfo/Chile 0755 root bin
+f usr/share/lib/zoneinfo/Chile/Continental 0644 root bin
+f usr/share/lib/zoneinfo/Chile/EasterIsland 0644 root bin
+f usr/share/lib/zoneinfo/Cuba 0644 root bin
+f usr/share/lib/zoneinfo/EET 0644 root bin
+f usr/share/lib/zoneinfo/EST 0644 root bin
+f usr/share/lib/zoneinfo/EST5EDT 0644 root bin
+f usr/share/lib/zoneinfo/Egypt 0644 root bin
+f usr/share/lib/zoneinfo/Eire 0644 root bin
+d usr/share/lib/zoneinfo/Etc 0755 root bin
+h usr/share/lib/zoneinfo/Etc/GMT+0=usr/share/lib/zoneinfo/GMT
+f usr/share/lib/zoneinfo/Etc/GMT+1 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+10 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+11 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+12 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+2 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+3 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+4 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+5 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+6 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+7 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+8 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT+9 0644 root bin
+h usr/share/lib/zoneinfo/Etc/GMT-0=usr/share/lib/zoneinfo/GMT
+f usr/share/lib/zoneinfo/Etc/GMT-1 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-10 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-11 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-12 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-13 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-14 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-2 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-3 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-4 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-5 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-6 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-7 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-8 0644 root bin
+f usr/share/lib/zoneinfo/Etc/GMT-9 0644 root bin
+h usr/share/lib/zoneinfo/Etc/GMT0=usr/share/lib/zoneinfo/GMT
+h usr/share/lib/zoneinfo/Etc/GMT=usr/share/lib/zoneinfo/GMT
+h usr/share/lib/zoneinfo/Etc/Greenwich=usr/share/lib/zoneinfo/GMT
+f usr/share/lib/zoneinfo/Etc/UCT 0644 root bin
+h usr/share/lib/zoneinfo/Etc/UTC=usr/share/lib/zoneinfo/UTC
+h usr/share/lib/zoneinfo/Etc/Universal=usr/share/lib/zoneinfo/UTC
+h usr/share/lib/zoneinfo/Etc/Zulu=usr/share/lib/zoneinfo/UTC
+d usr/share/lib/zoneinfo/Europe 0755 root bin
+f usr/share/lib/zoneinfo/Europe/Amsterdam 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Andorra 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Athens 0644 root bin
+h usr/share/lib/zoneinfo/Europe/Belfast=usr/share/lib/zoneinfo/GB
+f usr/share/lib/zoneinfo/Europe/Belgrade 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Berlin 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Bratislava 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Brussels 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Bucharest 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Budapest 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Chisinau 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Copenhagen 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Dublin 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Gibraltar 0644 root bin
+h usr/share/lib/zoneinfo/Europe/Guernsey=usr/share/lib/zoneinfo/GB
+f usr/share/lib/zoneinfo/Europe/Helsinki 0644 root bin
+h usr/share/lib/zoneinfo/Europe/Isle_of_Man=usr/share/lib/zoneinfo/GB
+h usr/share/lib/zoneinfo/Europe/Istanbul=usr/share/lib/zoneinfo/Turkey
+h usr/share/lib/zoneinfo/Europe/Jersey=usr/share/lib/zoneinfo/GB
+f usr/share/lib/zoneinfo/Europe/Kaliningrad 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Kiev 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Lisbon 0644 root bin
+h usr/share/lib/zoneinfo/Europe/Ljubljana=usr/share/lib/zoneinfo/Europe/Belgrade
+h usr/share/lib/zoneinfo/Europe/London=usr/share/lib/zoneinfo/GB
+f usr/share/lib/zoneinfo/Europe/Luxembourg 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Madrid 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Malta 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Mariehamn 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Minsk 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Monaco 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Moscow 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Nicosia 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Oslo 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Paris 0644 root bin
+h usr/share/lib/zoneinfo/Europe/Podgorica=usr/share/lib/zoneinfo/Europe/Belgrade
+f usr/share/lib/zoneinfo/Europe/Prague 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Riga 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Rome 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Samara 0644 root bin
+h usr/share/lib/zoneinfo/Europe/San_Marino=usr/share/lib/zoneinfo/Europe/Rome
+h usr/share/lib/zoneinfo/Europe/Sarajevo=usr/share/lib/zoneinfo/Europe/Belgrade
+f usr/share/lib/zoneinfo/Europe/Simferopol 0644 root bin
+h usr/share/lib/zoneinfo/Europe/Skopje=usr/share/lib/zoneinfo/Europe/Belgrade
+f usr/share/lib/zoneinfo/Europe/Sofia 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Stockholm 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Tallinn 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Tirane 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Tiraspol 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Uzhgorod 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Vaduz 0644 root bin
+h usr/share/lib/zoneinfo/Europe/Vatican=usr/share/lib/zoneinfo/Europe/Rome
+f usr/share/lib/zoneinfo/Europe/Vienna 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Vilnius 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Volgograd 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Warsaw 0644 root bin
+h usr/share/lib/zoneinfo/Europe/Zagreb=usr/share/lib/zoneinfo/Europe/Belgrade
+f usr/share/lib/zoneinfo/Europe/Zaporozhye 0644 root bin
+f usr/share/lib/zoneinfo/Europe/Zurich 0644 root bin
+f usr/share/lib/zoneinfo/Factory 0644 root bin
+f usr/share/lib/zoneinfo/GB 0644 root bin
+h usr/share/lib/zoneinfo/GB-Eire=usr/share/lib/zoneinfo/GB
+f usr/share/lib/zoneinfo/GMT 0644 root bin
+h usr/share/lib/zoneinfo/GMT+0=usr/share/lib/zoneinfo/GMT
+h usr/share/lib/zoneinfo/GMT-0=usr/share/lib/zoneinfo/GMT
+h usr/share/lib/zoneinfo/GMT0=usr/share/lib/zoneinfo/GMT
+h usr/share/lib/zoneinfo/Greenwich=usr/share/lib/zoneinfo/GMT
+f usr/share/lib/zoneinfo/HST 0644 root bin
+f usr/share/lib/zoneinfo/Hongkong 0644 root bin
+f usr/share/lib/zoneinfo/Iceland 0644 root bin
+d usr/share/lib/zoneinfo/Indian 0755 root bin
+f usr/share/lib/zoneinfo/Indian/Antananarivo 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Chagos 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Christmas 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Cocos 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Comoro 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Kerguelen 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Mahe 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Maldives 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Mauritius 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Mayotte 0644 root bin
+f usr/share/lib/zoneinfo/Indian/Reunion 0644 root bin
+f usr/share/lib/zoneinfo/Iran 0644 root bin
+f usr/share/lib/zoneinfo/Israel 0644 root bin
+f usr/share/lib/zoneinfo/Jamaica 0644 root bin
+f usr/share/lib/zoneinfo/Japan 0644 root bin
+f usr/share/lib/zoneinfo/Kwajalein 0644 root bin
+f usr/share/lib/zoneinfo/Libya 0644 root bin
+f usr/share/lib/zoneinfo/MET 0644 root bin
+f usr/share/lib/zoneinfo/MST 0644 root bin
+f usr/share/lib/zoneinfo/MST7MDT 0644 root bin
+d usr/share/lib/zoneinfo/Mexico 0755 root bin
+h usr/share/lib/zoneinfo/Mexico/BajaNorte=usr/share/lib/zoneinfo/America/Tijuana
+f usr/share/lib/zoneinfo/Mexico/BajaSur 0644 root bin
+f usr/share/lib/zoneinfo/Mexico/General 0644 root bin
+d usr/share/lib/zoneinfo/Mideast 0755 root bin
+f usr/share/lib/zoneinfo/Mideast/Riyadh87 0644 root bin
+f usr/share/lib/zoneinfo/Mideast/Riyadh88 0644 root bin
+f usr/share/lib/zoneinfo/Mideast/Riyadh89 0644 root bin
+f usr/share/lib/zoneinfo/NZ 0644 root bin
+f usr/share/lib/zoneinfo/NZ-CHAT 0644 root bin
+h usr/share/lib/zoneinfo/Navajo=usr/share/lib/zoneinfo/US/Mountain
+f usr/share/lib/zoneinfo/PRC 0644 root bin
+f usr/share/lib/zoneinfo/PST8PDT 0644 root bin
+d usr/share/lib/zoneinfo/Pacific 0755 root bin
+f usr/share/lib/zoneinfo/Pacific/Apia 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Auckland 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Chatham 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Chuuk 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Easter 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Efate 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Enderbury 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Fakaofo 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Fiji 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Funafuti 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Galapagos 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Gambier 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Guadalcanal 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Guam 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Honolulu 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Johnston 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Kiritimati 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Kosrae 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Kwajalein 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Majuro 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Marquesas 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Midway 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Nauru 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Niue 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Norfolk 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Noumea 0644 root bin
+h usr/share/lib/zoneinfo/Pacific/Pago_Pago=usr/share/lib/zoneinfo/US/Samoa
+f usr/share/lib/zoneinfo/Pacific/Palau 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Pitcairn 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Pohnpei 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Ponape 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Port_Moresby 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Rarotonga 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Saipan 0644 root bin
+h usr/share/lib/zoneinfo/Pacific/Samoa=usr/share/lib/zoneinfo/US/Samoa
+f usr/share/lib/zoneinfo/Pacific/Tahiti 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Tarawa 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Tongatapu 0644 root bin
+h usr/share/lib/zoneinfo/Pacific/Truk=usr/share/lib/zoneinfo/Pacific/Chuuk
+f usr/share/lib/zoneinfo/Pacific/Wake 0644 root bin
+f usr/share/lib/zoneinfo/Pacific/Wallis 0644 root bin
+h usr/share/lib/zoneinfo/Pacific/Yap=usr/share/lib/zoneinfo/Pacific/Chuuk
+f usr/share/lib/zoneinfo/Poland 0644 root bin
+f usr/share/lib/zoneinfo/Portugal 0644 root bin
+f usr/share/lib/zoneinfo/ROK 0644 root bin
+f usr/share/lib/zoneinfo/Singapore 0644 root bin
+f usr/share/lib/zoneinfo/Turkey 0644 root bin
+f usr/share/lib/zoneinfo/UCT 0644 root bin
+d usr/share/lib/zoneinfo/US 0755 root bin
+f usr/share/lib/zoneinfo/US/Alaska 0644 root bin
+f usr/share/lib/zoneinfo/US/Aleutian 0644 root bin
+f usr/share/lib/zoneinfo/US/Arizona 0644 root bin
+f usr/share/lib/zoneinfo/US/Central 0644 root bin
+f usr/share/lib/zoneinfo/US/East-Indiana 0644 root bin
+f usr/share/lib/zoneinfo/US/Eastern 0644 root bin
+f usr/share/lib/zoneinfo/US/Hawaii 0644 root bin
+h usr/share/lib/zoneinfo/US/Indiana-Starke=usr/share/lib/zoneinfo/America/Knox_IN
+f usr/share/lib/zoneinfo/US/Michigan 0644 root bin
+f usr/share/lib/zoneinfo/US/Mountain 0644 root bin
+f usr/share/lib/zoneinfo/US/Pacific 0644 root bin
+h usr/share/lib/zoneinfo/US/Pacific-New=usr/share/lib/zoneinfo/US/Pacific
+f usr/share/lib/zoneinfo/US/Samoa 0644 root bin
+f usr/share/lib/zoneinfo/UTC 0644 root bin
+h usr/share/lib/zoneinfo/Universal=usr/share/lib/zoneinfo/UTC
+f usr/share/lib/zoneinfo/W-SU 0644 root bin
+f usr/share/lib/zoneinfo/WET 0644 root bin
+h usr/share/lib/zoneinfo/Zulu=usr/share/lib/zoneinfo/UTC
+s usr/share/lib/zoneinfo/posixrules=US/Eastern
+d usr/share/lib/zoneinfo/src 0755 root bin
+f usr/share/lib/zoneinfo/src/README 0644 root bin
+f usr/share/lib/zoneinfo/src/africa 0644 root bin
+f usr/share/lib/zoneinfo/src/antarctica 0644 root bin
+f usr/share/lib/zoneinfo/src/asia 0644 root bin
+f usr/share/lib/zoneinfo/src/australasia 0644 root bin
+f usr/share/lib/zoneinfo/src/backward 0644 root bin
+f usr/share/lib/zoneinfo/src/etcetera 0644 root bin
+f usr/share/lib/zoneinfo/src/europe 0644 root bin
+f usr/share/lib/zoneinfo/src/factory 0644 root bin
+f usr/share/lib/zoneinfo/src/northamerica 0644 root bin
+f usr/share/lib/zoneinfo/src/pacificnew 0644 root bin
+f usr/share/lib/zoneinfo/src/solar87 0644 root bin
+f usr/share/lib/zoneinfo/src/solar88 0644 root bin
+f usr/share/lib/zoneinfo/src/solar89 0644 root bin
+f usr/share/lib/zoneinfo/src/southamerica 0644 root bin
+f usr/share/lib/zoneinfo/src/systemv 0644 root bin
+d usr/share/lib/zoneinfo/tab 0755 root bin
+f usr/share/lib/zoneinfo/tab/continent.tab 0644 root bin
+f usr/share/lib/zoneinfo/tab/country.tab 0644 root bin
+f usr/share/lib/zoneinfo/tab/zone_sun.tab 0644 root bin
+d usr/share/locale 0755 root other
+d usr/share/locale/C 0755 root bin
+d usr/share/locale/C/LC_MESSAGES 0755 root bin
+d usr/share/man 0755 root bin
+d usr/share/man/cat1 0755 root bin
+d usr/share/man/cat1m 0755 root bin
+d usr/share/man/cat5 0755 root bin
+d usr/share/man/man1 0755 root bin
+f usr/share/man/man1/alias.1 0444 root bin
+f usr/share/man/man1/allocate.1 0444 root bin
+f usr/share/man/man1/amt.1 0444 root bin
+f usr/share/man/man1/apropos.1 0444 root bin
+f usr/share/man/man1/ar.1 0444 root bin
+f usr/share/man/man1/arch.1 0444 root bin
+f usr/share/man/man1/asa.1 0444 root bin
+f usr/share/man/man1/at.1 0444 root bin
+f usr/share/man/man1/atq.1 0444 root bin
+f usr/share/man/man1/atrm.1 0444 root bin
+f usr/share/man/man1/auths.1 0444 root bin
+s usr/share/man/man1/awk.1=nawk.1
+f usr/share/man/man1/banner.1 0444 root bin
+f usr/share/man/man1/basename.1 0444 root bin
+f usr/share/man/man1/batch.1 0444 root bin
+f usr/share/man/man1/bc.1 0444 root bin
+f usr/share/man/man1/bdiff.1 0444 root bin
+f usr/share/man/man1/bfs.1 0444 root bin
+f usr/share/man/man1/bg.1 0444 root bin
+f usr/share/man/man1/cal.1 0444 root bin
+f usr/share/man/man1/calendar.1 0444 root bin
+f usr/share/man/man1/cat.1 0444 root bin
+f usr/share/man/man1/cd.1 0444 root bin
+f usr/share/man/man1/checkeq.1 0444 root bin
+f usr/share/man/man1/checknr.1 0444 root bin
+f usr/share/man/man1/chgrp.1 0444 root bin
+f usr/share/man/man1/chkey.1 0444 root bin
+f usr/share/man/man1/chmod.1 0444 root bin
+f usr/share/man/man1/chown.1 0444 root bin
+f usr/share/man/man1/ckdate.1 0444 root bin
+f usr/share/man/man1/ckgid.1 0444 root bin
+f usr/share/man/man1/ckint.1 0444 root bin
+f usr/share/man/man1/ckitem.1 0444 root bin
+f usr/share/man/man1/ckkeywd.1 0444 root bin
+f usr/share/man/man1/ckpath.1 0444 root bin
+f usr/share/man/man1/ckrange.1 0444 root bin
+f usr/share/man/man1/ckstr.1 0444 root bin
+f usr/share/man/man1/cksum.1 0444 root bin
+f usr/share/man/man1/cktime.1 0444 root bin
+f usr/share/man/man1/ckuid.1 0444 root bin
+f usr/share/man/man1/ckyorn.1 0444 root bin
+f usr/share/man/man1/clear.1 0444 root bin
+f usr/share/man/man1/cmp.1 0444 root bin
+f usr/share/man/man1/col.1 0444 root bin
+f usr/share/man/man1/column.1 0444 root bin
+f usr/share/man/man1/comm.1 0444 root bin
+f usr/share/man/man1/command.1 0444 root bin
+f usr/share/man/man1/compress.1 0444 root bin
+f usr/share/man/man1/cp.1 0444 root bin
+f usr/share/man/man1/cpio.1 0444 root bin
+f usr/share/man/man1/cputrack.1 0444 root bin
+f usr/share/man/man1/crle.1 0444 root bin
+f usr/share/man/man1/crontab.1 0444 root bin
+f usr/share/man/man1/crypt.1 0444 root bin
+f usr/share/man/man1/csh.1 0444 root bin
+f usr/share/man/man1/csplit.1 0444 root bin
+f usr/share/man/man1/ctags.1 0444 root bin
+f usr/share/man/man1/ctrun.1 0444 root bin
+f usr/share/man/man1/ctstat.1 0444 root bin
+f usr/share/man/man1/ctwatch.1 0444 root bin
+f usr/share/man/man1/cut.1 0444 root bin
+f usr/share/man/man1/date.1 0444 root bin
+f usr/share/man/man1/dc.1 0444 root bin
+f usr/share/man/man1/deallocate.1 0444 root bin
+f usr/share/man/man1/decrypt.1 0444 root bin
+f usr/share/man/man1/deroff.1 0444 root bin
+f usr/share/man/man1/dhcpinfo.1 0444 root bin
+f usr/share/man/man1/diff.1 0444 root bin
+f usr/share/man/man1/diff3.1 0444 root bin
+f usr/share/man/man1/diffmk.1 0444 root bin
+f usr/share/man/man1/digest.1 0444 root bin
+f usr/share/man/man1/dircmp.1 0444 root bin
+f usr/share/man/man1/dirname.1 0444 root bin
+f usr/share/man/man1/dis.1 0444 root bin
+f usr/share/man/man1/dispgid.1 0444 root bin
+f usr/share/man/man1/dispuid.1 0444 root bin
+f usr/share/man/man1/dos2unix.1 0444 root bin
+f usr/share/man/man1/du.1 0444 root bin
+f usr/share/man/man1/dump.1 0444 root bin
+f usr/share/man/man1/dumpcs.1 0444 root bin
+f usr/share/man/man1/dumpkeys.1 0444 root bin
+f usr/share/man/man1/echo.1 0444 root bin
+f usr/share/man/man1/ed.1 0444 root bin
+f usr/share/man/man1/edit.1 0444 root bin
+f usr/share/man/man1/egrep.1 0444 root bin
+f usr/share/man/man1/eject.1 0444 root bin
+f usr/share/man/man1/elfdump.1 0444 root bin
+f usr/share/man/man1/elfedit.1 0444 root bin
+f usr/share/man/man1/elfsign.1 0444 root bin
+f usr/share/man/man1/elfwrap.1 0444 root bin
+f usr/share/man/man1/encrypt.1 0444 root bin
+f usr/share/man/man1/enhance.1 0444 root bin
+f usr/share/man/man1/env.1 0444 root bin
+f usr/share/man/man1/eqn.1 0444 root bin
+f usr/share/man/man1/errange.1 044 root bin
+f usr/share/man/man1/errdate.1 044 root bin
+f usr/share/man/man1/errgid.1 044 root bin
+f usr/share/man/man1/errint.1 044 root bin
+f usr/share/man/man1/erritem.1 044 root bin
+f usr/share/man/man1/errpath.1 044 root bin
+f usr/share/man/man1/errstr.1 044 root bin
+f usr/share/man/man1/errtime.1 044 root bin
+f usr/share/man/man1/erruid.1 044 root bin
+f usr/share/man/man1/erryorn.1 044 root bin
+f usr/share/man/man1/expand.1 0444 root bin
+f usr/share/man/man1/expr.1 0444 root bin
+f usr/share/man/man1/exstr.1 0444 root bin
+f usr/share/man/man1/factor.1 0444 root bin
+f usr/share/man/man1/false.1 0444 root bin
+f usr/share/man/man1/fc.1 0444 root bin
+f usr/share/man/man1/fdformat.1 0444 root bin
+f usr/share/man/man1/fg.1 0444 root bin
+f usr/share/man/man1/fgrep.1 0444 root bin
+f usr/share/man/man1/file.1 0444 root bin
+f usr/share/man/man1/filesync.1 0444 root bin
+f usr/share/man/man1/find.1 0444 root bin
+f usr/share/man/man1/fmt.1 0444 root bin
+f usr/share/man/man1/fmtmsg.1 0444 root bin
+f usr/share/man/man1/fold.1 0444 root bin
+f usr/share/man/man1/ftp.1 0444 root bin
+f usr/share/man/man1/ftpcount.1 0444 root bin
+f usr/share/man/man1/ftpwho.1 0444 root bin
+f usr/share/man/man1/gcore.1 0444 root bin
+f usr/share/man/man1/gencat.1 0444 root bin
+f usr/share/man/man1/genmsg.1 0444 root bin
+f usr/share/man/man1/getconf.1 0444 root bin
+f usr/share/man/man1/getfacl.1 0444 root bin
+f usr/share/man/man1/getopt.1 0444 root bin
+f usr/share/man/man1/getopts.1 0444 root bin
+f usr/share/man/man1/gettext.1 0444 root bin
+f usr/share/man/man1/gettxt.1 0444 root bin
+f usr/share/man/man1/grep.1 0444 root bin
+f usr/share/man/man1/groups.1 0444 root bin
+f usr/share/man/man1/hash.1 0444 root bin
+f usr/share/man/man1/head.1 0444 root bin
+f usr/share/man/man1/helpdate.1 044 root bin
+f usr/share/man/man1/helpgid.1 044 root bin
+f usr/share/man/man1/helpint.1 044 root bin
+f usr/share/man/man1/helpitem.1 044 root bin
+f usr/share/man/man1/helppath.1 044 root bin
+f usr/share/man/man1/helprange.1 044 root bin
+f usr/share/man/man1/helpstr.1 044 root bin
+f usr/share/man/man1/helptime.1 044 root bin
+f usr/share/man/man1/helpuid.1 044 root bin
+f usr/share/man/man1/helpyorn.1 044 root bin
+f usr/share/man/man1/history.1 0444 root bin
+f usr/share/man/man1/hostid.1 0444 root bin
+f usr/share/man/man1/hostname.1 0444 root bin
+f usr/share/man/man1/i286.1 0444 root bin
+f usr/share/man/man1/i386.1 0444 root bin
+f usr/share/man/man1/i486.1 0444 root bin
+f usr/share/man/man1/iconv.1 0444 root bin
+f usr/share/man/man1/ipcrm.1 0444 root bin
+f usr/share/man/man1/ipcs.1 0444 root bin
+f usr/share/man/man1/isainfo.1 0444 root bin
+f usr/share/man/man1/isalist.1 0444 root bin
+f usr/share/man/man1/jobs.1 0444 root bin
+f usr/share/man/man1/join.1 0444 root bin
+f usr/share/man/man1/jsh.1 0444 root bin
+f usr/share/man/man1/kbd.1 0444 root bin
+f usr/share/man/man1/kdestroy.1 0444 root bin
+f usr/share/man/man1/keylogin.1 0444 root bin
+f usr/share/man/man1/keylogout.1 0444 root bin
+f usr/share/man/man1/kill.1 0444 root bin
+f usr/share/man/man1/kinit.1 0444 root bin
+f usr/share/man/man1/klist.1 0444 root bin
+f usr/share/man/man1/kmdb.1 0444 root bin
+f usr/share/man/man1/kmfcfg.1 0444 root bin
+f usr/share/man/man1/kpasswd.1 0444 root bin
+f usr/share/man/man1/krb5-config.1 0444 root bin
+s usr/share/man/man1/ksh.1=ksh93.1
+f usr/share/man/man1/ksh93.1 0444 root bin
+f usr/share/man/man1/ktutil.1 0444 root bin
+f usr/share/man/man1/last.1 0444 root bin
+f usr/share/man/man1/lastcomm.1 0444 root bin
+f usr/share/man/man1/ld.1 0444 root bin
+f usr/share/man/man1/ld.so.1.1 0444 root bin
+f usr/share/man/man1/ldapadd.1 0444 root bin
+f usr/share/man/man1/ldapdelete.1 0444 root bin
+f usr/share/man/man1/ldaplist.1 0444 root bin
+f usr/share/man/man1/ldapmodify.1 0444 root bin
+f usr/share/man/man1/ldapmodrdn.1 0444 root bin
+f usr/share/man/man1/ldapsearch.1 0444 root bin
+f usr/share/man/man1/ldd.1 0444 root bin
+f usr/share/man/man1/lgrpinfo.1 0444 root bin
+f usr/share/man/man1/limit.1 0444 root bin
+f usr/share/man/man1/line.1 0444 root bin
+f usr/share/man/man1/list_devices.1 0444 root bin
+f usr/share/man/man1/listusers.1 0444 root bin
+f usr/share/man/man1/ln.1 0444 root bin
+f usr/share/man/man1/loadkeys.1 0444 root bin
+f usr/share/man/man1/locale.1 0444 root bin
+f usr/share/man/man1/localedef.1 0444 root bin
+f usr/share/man/man1/logger.1 0444 root bin
+f usr/share/man/man1/login.1 0444 root bin
+f usr/share/man/man1/logname.1 0444 root bin
+f usr/share/man/man1/look.1 0444 root bin
+f usr/share/man/man1/lorder.1 0444 root bin
+f usr/share/man/man1/ls.1 0444 root bin
+f usr/share/man/man1/m4.1 0444 root bin
+f usr/share/man/man1/mac.1 0444 root bin
+f usr/share/man/man1/mach.1 0444 root bin
+f usr/share/man/man1/machid.1 0444 root bin
+f usr/share/man/man1/mail.1 0444 root bin
+f usr/share/man/man1/mailx.1 0444 root bin
+f usr/share/man/man1/man.1 0444 root bin
+f usr/share/man/man1/mdb.1 0444 root bin
+f usr/share/man/man1/mcs.1 0444 root bin
+f usr/share/man/man1/mesg.1 0444 root bin
+f usr/share/man/man1/mkdir.1 0444 root bin
+f usr/share/man/man1/mkmsgs.1 0444 root bin
+f usr/share/man/man1/mktemp.1 0444 root bin
+f usr/share/man/man1/moe.1 0444 root bin
+f usr/share/man/man1/more.1 0444 root bin
+f usr/share/man/man1/mpss.so.1.1 0444 root bin
+f usr/share/man/man1/msgfmt.1 0444 root bin
+f usr/share/man/man1/mt.1 0444 root bin
+f usr/share/man/man1/mv.1 0444 root bin
+f usr/share/man/man1/nawk.1 0444 root bin
+f usr/share/man/man1/nc.1 0444 root bin
+f usr/share/man/man1/neqn.1 0444 root bin
+f usr/share/man/man1/newform.1 0444 root bin
+f usr/share/man/man1/newgrp.1 0444 root bin
+f usr/share/man/man1/news.1 0444 root bin
+f usr/share/man/man1/newtask.1 0444 root bin
+f usr/share/man/man1/nice.1 0444 root bin
+f usr/share/man/man1/nl.1 0444 root bin
+f usr/share/man/man1/nm.1 0444 root bin
+f usr/share/man/man1/nohup.1 0444 root bin
+f usr/share/man/man1/nroff.1 0444 root bin
+f usr/share/man/man1/od.1 0444 root bin
+f usr/share/man/man1/on.1 0444 root bin
+f usr/share/man/man1/optisa.1 0444 root bin
+f usr/share/man/man1/pack.1 0444 root bin
+f usr/share/man/man1/page.1 0444 root bin
+f usr/share/man/man1/pagesize.1 0444 root bin
+f usr/share/man/man1/pargs.1 0444 root bin
+f usr/share/man/man1/passwd.1 0444 root bin
+f usr/share/man/man1/paste.1 0444 root bin
+f usr/share/man/man1/pathchk.1 0444 root bin
+f usr/share/man/man1/pax.1 0444 root bin
+f usr/share/man/man1/pcat.1 0444 root bin
+f usr/share/man/man1/pcred.1 0444 root bin
+f usr/share/man/man1/pfcsh.1 0444 root bin
+f usr/share/man/man1/pfexec.1 0444 root bin
+f usr/share/man/man1/pfiles.1 0444 root bin
+f usr/share/man/man1/pfksh.1 0444 root bin
+f usr/share/man/man1/pflags.1 0444 root bin
+f usr/share/man/man1/pfsh.1 0444 root bin
+f usr/share/man/man1/pg.1 0444 root bin
+f usr/share/man/man1/pgrep.1 0444 root bin
+f usr/share/man/man1/pkgtrans.1 0444 root bin
+f usr/share/man/man1/pkill.1 0444 root bin
+f usr/share/man/man1/pktool.1 0444 root bin
+f usr/share/man/man1/pldd.1 0444 root bin
+f usr/share/man/man1/plgrp.1 0444 root bin
+f usr/share/man/man1/plimit.1 0444 root bin
+f usr/share/man/man1/pmadvise.1 0444 root bin
+f usr/share/man/man1/pmap.1 0444 root bin
+f usr/share/man/man1/ppgsz.1 0444 root bin
+f usr/share/man/man1/ppriv.1 0444 root bin
+f usr/share/man/man1/pr.1 0444 root bin
+f usr/share/man/man1/prctl.1 0444 root bin
+f usr/share/man/man1/preap.1 0444 root bin
+f usr/share/man/man1/print.1 0444 root bin
+f usr/share/man/man1/printf.1 0444 root bin
+f usr/share/man/man1/priocntl.1 0444 root bin
+f usr/share/man/man1/proc.1 0444 root bin
+f usr/share/man/man1/profiles.1 0444 root bin
+f usr/share/man/man1/projects.1 0444 root bin
+f usr/share/man/man1/prun.1 0444 root bin
+f usr/share/man/man1/ps.1 0444 root bin
+f usr/share/man/man1/psig.1 0444 root bin
+f usr/share/man/man1/pstack.1 0444 root bin
+f usr/share/man/man1/pstop.1 0444 root bin
+f usr/share/man/man1/ptime.1 0444 root bin
+f usr/share/man/man1/ptree.1 0444 root bin
+f usr/share/man/man1/pvs.1 0444 root bin
+f usr/share/man/man1/pwait.1 0444 root bin
+f usr/share/man/man1/pwd.1 0444 root bin
+f usr/share/man/man1/pwdx.1 0444 root bin
+f usr/share/man/man1/rcapstat.1 0444 root bin
+f usr/share/man/man1/rcp.1 0444 root bin
+f usr/share/man/man1/rdist.1 0444 root bin
+f usr/share/man/man1/read.1 0444 root bin
+f usr/share/man/man1/red.1 0444 root bin
+f usr/share/man/man1/refer.1 0444 root bin
+f usr/share/man/man1/regcmp.1 0444 root bin
+f usr/share/man/man1/remsh.1 0444 root bin
+f usr/share/man/man1/renice.1 0444 root bin
+f usr/share/man/man1/rev.1 0444 root bin
+f usr/share/man/man1/rksh.1 0444 root bin
+f usr/share/man/man1/rksh93.1 0444 root bin
+f usr/share/man/man1/rlogin.1 0444 root bin
+f usr/share/man/man1/rm.1 0444 root bin
+f usr/share/man/man1/rmail.1 0444 root bin
+f usr/share/man/man1/rmdir.1 0444 root bin
+f usr/share/man/man1/rmformat.1 044 root bin
+f usr/share/man/man1/roles.1 0444 root bin
+f usr/share/man/man1/rsh.1 0444 root bin
+f usr/share/man/man1/runat.1 0444 root bin
+f usr/share/man/man1/rup.1 0444 root bin
+f usr/share/man/man1/ruptime.1 0444 root bin
+f usr/share/man/man1/rusers.1 0444 root bin
+f usr/share/man/man1/scp.1 0444 root bin
+f usr/share/man/man1/script.1 0444 root bin
+f usr/share/man/man1/sdiff.1 0444 root bin
+f usr/share/man/man1/sed.1 0444 root bin
+f usr/share/man/man1/setfacl.1 0444 root bin
+f usr/share/man/man1/setpgrp.1 0444 root bin
+f usr/share/man/man1/settime.1 0444 root bin
+f usr/share/man/man1/sftp.1 0444 root bin
+s usr/share/man/man1/sh.1=ksh93.1
+f usr/share/man/man1/shcomp.1 0444 root bin
+f usr/share/man/man1/size.1 044 root bin
+f usr/share/man/man1/sleep.1 0444 root bin
+f usr/share/man/man1/smbutil.1 0444 root bin
+f usr/share/man/man1/soelim.1 0444 root bin
+f usr/share/man/man1/sort.1 0444 root bin
+f usr/share/man/man1/sotruss.1 0444 root bin
+f usr/share/man/man1/sparc.1 0444 root bin
+f usr/share/man/man1/spell.1 0444 root bin
+f usr/share/man/man1/split.1 0444 root bin
+f usr/share/man/man1/srchtxt.1 0444 root bin
+f usr/share/man/man1/ssh-add.1 0444 root bin
+f usr/share/man/man1/ssh-agent.1 0444 root bin
+f usr/share/man/man1/ssh-keygen.1 0444 root bin
+f usr/share/man/man1/ssh-keyscan.1 0444 root bin
+f usr/share/man/man1/ssh.1 0444 root bin
+f usr/share/man/man1/strchg.1 0444 root bin
+f usr/share/man/man1/strconf.1 0444 root bin
+f usr/share/man/man1/strings.1 0444 root bin
+f usr/share/man/man1/strip.1 044 root bin
+f usr/share/man/man1/stty.1 0444 root bin
+f usr/share/man/man1/sum.1 0444 root bin
+f usr/share/man/man1/sun.1 0444 root bin
+f usr/share/man/man1/svcprop.1 0444 root bin
+f usr/share/man/man1/svcs.1 0444 root bin
+f usr/share/man/man1/tabs.1 0444 root bin
+f usr/share/man/man1/tail.1 0444 root bin
+f usr/share/man/man1/tar.1 0444 root bin
+f usr/share/man/man1/tbl.1 0444 root bin
+f usr/share/man/man1/tcopy.1 0444 root bin
+f usr/share/man/man1/tee.1 0444 root bin
+f usr/share/man/man1/telnet.1 0444 root bin
+f usr/share/man/man1/test.1 0444 root bin
+f usr/share/man/man1/time.1 0444 root bin
+f usr/share/man/man1/timex.1 044 root bin
+f usr/share/man/man1/tip.1 0444 root bin
+f usr/share/man/man1/touch.1 0444 root bin
+f usr/share/man/man1/tput.1 0444 root bin
+f usr/share/man/man1/tr.1 0444 root bin
+f usr/share/man/man1/troff.1 0444 root bin
+f usr/share/man/man1/true.1 0444 root bin
+f usr/share/man/man1/truss.1 0444 root bin
+f usr/share/man/man1/tsort.1 0444 root bin
+f usr/share/man/man1/tty.1 0444 root bin
+f usr/share/man/man1/type.1 0444 root bin
+f usr/share/man/man1/ul.1 0444 root bin
+f usr/share/man/man1/ulimit.1 0444 root bin
+f usr/share/man/man1/umask.1 0444 root bin
+f usr/share/man/man1/unalias.1 0444 root bin
+f usr/share/man/man1/uname.1 0444 root bin
+f usr/share/man/man1/uncompress.1 0444 root bin
+f usr/share/man/man1/unexpand.1 0444 root bin
+f usr/share/man/man1/uniq.1 0444 root bin
+f usr/share/man/man1/units.1 0444 root bin
+f usr/share/man/man1/unix2dos.1 0444 root bin
+f usr/share/man/man1/unpack.1 0444 root bin
+f usr/share/man/man1/uptime.1 0444 root bin
+f usr/share/man/man1/valdate.1 044 root bin
+f usr/share/man/man1/valgid.1 044 root bin
+f usr/share/man/man1/valint.1 044 root bin
+f usr/share/man/man1/valpath.1 044 root bin
+f usr/share/man/man1/valrange.1 044 root bin
+f usr/share/man/man1/valstr.1 044 root bin
+f usr/share/man/man1/valtime.1 044 root bin
+f usr/share/man/man1/valuid.1 044 root bin
+f usr/share/man/man1/valyorn.1 044 root bin
+f usr/share/man/man1/vedit.1 0444 root bin
+f usr/share/man/man1/vgrind.1 0444 root bin
+f usr/share/man/man1/w.1 0444 root bin
+f usr/share/man/man1/wait.1 0444 root bin
+f usr/share/man/man1/wc.1 0444 root bin
+f usr/share/man/man1/whatis.1 0444 root bin
+f usr/share/man/man1/which.1 0444 root bin
+f usr/share/man/man1/who.1 0444 root bin
+f usr/share/man/man1/whocalls.1 0444 root bin
+f usr/share/man/man1/whois.1 0444 root bin
+f usr/share/man/man1/write.1 0444 root bin
+f usr/share/man/man1/xargs.1 0444 root bin
+f usr/share/man/man1/xgettext.1 0444 root bin
+f usr/share/man/man1/xstr.1 0444 root bin
+f usr/share/man/man1/yes.1 0444 root bin
+f usr/share/man/man1/ypcat.1 0444 root bin
+f usr/share/man/man1/ypmatch.1 0444 root bin
+f usr/share/man/man1/yppasswd.1 0444 root bin
+f usr/share/man/man1/ypwhich.1 0444 root bin
+f usr/share/man/man1/zcat.1 0444 root bin
+f usr/share/man/man1/zlogin.1 0444 root bin
+f usr/share/man/man1/zonename.1 0444 root bin
+d usr/share/man/man1b 0755 root bin
+f usr/share/man/man1b/ps.1b 044 root bin
+d usr/share/man/man1c 0755 root bin
+f usr/share/man/man1c/uudecode.1c 044 root bin
+f usr/share/man/man1c/uuencode.1c 044 root bin
+d usr/share/man/man1m 0755 root bin
+f usr/share/man/man1m/6to4relay.1m 0444 root bin
+f usr/share/man/man1m/acctadm.1m 0444 root bin
+f usr/share/man/man1m/add_drv.1m 0444 root bin
+f usr/share/man/man1m/addbadsec.1m 0444 root bin
+f usr/share/man/man1m/arp.1m 0444 root bin
+f usr/share/man/man1m/audit.1m 0444 root bin
+f usr/share/man/man1m/auditconfig.1m 0444 root bin
+f usr/share/man/man1m/auditd.1m 0444 root bin
+f usr/share/man/man1m/auditrecord.1m 0444 root bin
+f usr/share/man/man1m/auditreduce.1m 0444 root bin
+f usr/share/man/man1m/auditstat.1m 0444 root bin
+f usr/share/man/man1m/automount.1m 0444 root bin
+f usr/share/man/man1m/autopush.1m 0444 root bin
+f usr/share/man/man1m/bart.1m 0444 root bin
+f usr/share/man/man1m/bootadm.1m 0444 root bin
+f usr/share/man/man1m/busstat.1m 0444 root bin
+f usr/share/man/man1m/captoinfo.1m 0444 root bin
+f usr/share/man/man1m/catman.1m 0444 root bin
+f usr/share/man/man1m/cfgadm.1m 0444 root bin
+f usr/share/man/man1m/check-hostname.1m 0444 root bin
+f usr/share/man/man1m/check-permissions.1m 0444 root bin
+f usr/share/man/man1m/chroot.1m 0444 root bin
+f usr/share/man/man1m/clear_locks.1m 0444 root bin
+f usr/share/man/man1m/clinfo.1m 0444 root bin
+f usr/share/man/man1m/clri.1m 0444 root bin
+f usr/share/man/man1m/consadm.1m 0444 root bin
+f usr/share/man/man1m/coreadm.1m 0444 root bin
+f usr/share/man/man1m/cpustat.1m 0444 root bin
+f usr/share/man/man1m/cron.1m 0444 root bin
+f usr/share/man/man1m/cryptoadm.1m 0444 root bin
+f usr/share/man/man1m/dcopy.1m 0444 root bin
+f usr/share/man/man1m/dd.1m 0444 root bin
+f usr/share/man/man1m/devattr.1m 0444 root bin
+f usr/share/man/man1m/devfree.1m 0444 root bin
+f usr/share/man/man1m/devfsadm.1m 0444 root bin
+f usr/share/man/man1m/devinfo.1m 0444 root bin
+f usr/share/man/man1m/devlinks.1m 0444 root bin
+f usr/share/man/man1m/devnm.1m 0444 root bin
+f usr/share/man/man1m/devprop.1m 0444 root bin
+f usr/share/man/man1m/devreserv.1m 0444 root bin
+f usr/share/man/man1m/df.1m 0444 root bin
+f usr/share/man/man1m/dfmounts.1m 0444 root bin
+f usr/share/man/man1m/dfshares.1m 0444 root bin
+f usr/share/man/man1m/dhcpagent.1m 0444 root bin
+f usr/share/man/man1m/disks.1m 0444 root bin
+f usr/share/man/man1m/diskscan.1m 0444 root bin
+f usr/share/man/man1m/dispadmin.1m 0444 root bin
+f usr/share/man/man1m/dladm.1m 0444 root bin
+f usr/share/man/man1m/dlmgmtd.1m 0444 root bin
+f usr/share/man/man1m/dmesg.1m 0444 root bin
+f usr/share/man/man1m/dminfo.1m 0444 root bin
+f usr/share/man/man1m/dns-sd.1m 0444 root bin
+f usr/share/man/man1m/domainname.1m 0444 root bin
+f usr/share/man/man1m/drvconfig.1m 0444 root bin
+f usr/share/man/man1m/dtrace.1m 0444 root bin
+f usr/share/man/man1m/dumpadm.1m 0444 root bin
+f usr/share/man/man1m/editmap.1m 0444 root bin
+f usr/share/man/man1m/edquota.1m 0444 root bin
+f usr/share/man/man1m/eeprom.1m 0444 root bin
+f usr/share/man/man1m/etrn.1m 0444 root bin
+f usr/share/man/man1m/fcadm.1m 0444 root bin
+f usr/share/man/man1m/fcinfo.1m 0444 root bin
+f usr/share/man/man1m/fdetach.1m 0444 root bin
+f usr/share/man/man1m/fdisk.1m 0444 root bin
+f usr/share/man/man1m/ff.1m 0444 root bin
+f usr/share/man/man1m/fiocompress.1m 0444 root bin
+f usr/share/man/man1m/flowadm.1m 0444 root bin
+f usr/share/man/man1m/fmadm.1m 0444 root bin
+f usr/share/man/man1m/fmdump.1m 0444 root bin
+f usr/share/man/man1m/fmstat.1m 0444 root bin
+f usr/share/man/man1m/fmthard.1m 0444 root bin
+f usr/share/man/man1m/format.1m 0444 root bin
+f usr/share/man/man1m/fsck.1m 0444 root bin
+f usr/share/man/man1m/fsdb.1m 0444 root bin
+f usr/share/man/man1m/fsirand.1m 0444 root bin
+f usr/share/man/man1m/fssnap.1m 0444 root bin
+f usr/share/man/man1m/fsstat.1m 0444 root bin
+f usr/share/man/man1m/fstyp.1m 0444 root bin
+f usr/share/man/man1m/ftpaddhost.1m 0444 root bin
+f usr/share/man/man1m/ftpconfig.1m 0444 root bin
+f usr/share/man/man1m/ftprestart.1m 0444 root bin
+f usr/share/man/man1m/ftpshut.1m 0444 root bin
+f usr/share/man/man1m/fuser.1m 0444 root bin
+f usr/share/man/man1m/fwflash.1m 0444 root bin
+f usr/share/man/man1m/getdev.1m 0444 root bin
+f usr/share/man/man1m/getdevpolicy.1m 0444 root bin
+f usr/share/man/man1m/getdgrp.1m 0444 root bin
+f usr/share/man/man1m/getent.1m 0444 root bin
+f usr/share/man/man1m/gettable.1m 0444 root bin
+f usr/share/man/man1m/getvol.1m 0444 root bin
+f usr/share/man/man1m/groupadd.1m 0444 root bin
+f usr/share/man/man1m/groupdel.1m 0444 root bin
+f usr/share/man/man1m/groupmod.1m 0444 root bin
+f usr/share/man/man1m/grpck.1m 0444 root bin
+f usr/share/man/man1m/gsscred.1m 0444 root bin
+f usr/share/man/man1m/halt.1m 0444 root bin
+f usr/share/man/man1m/hostconfig.1m 0444 root bin
+f usr/share/man/man1m/htable.1m 0444 root bin
+f usr/share/man/man1m/id.1m 0444 root bin
+f usr/share/man/man1m/idmap.1m 0444 root bin
+f usr/share/man/man1m/if_mpadm.1m 0444 root bin
+f usr/share/man/man1m/ifconfig.1m 0444 root bin
+f usr/share/man/man1m/ifparse.1m 0444 root bin
+f usr/share/man/man1m/ikeadm.1m 0444 root bin
+f usr/share/man/man1m/ikecert.1m 0444 root bin
+f usr/share/man/man1m/in.mpathd.1m 0444 root bin
+f usr/share/man/man1m/in.rdisc.1m 0444 root bin
+f usr/share/man/man1m/in.routed.1m 0444 root bin
+f usr/share/man/man1m/inetadm.1m 0444 root bin
+f usr/share/man/man1m/inetconv.1m 0444 root bin
+f usr/share/man/man1m/inetd.1m 0444 root bin
+f usr/share/man/man1m/infocmp.1m 0444 root bin
+f usr/share/man/man1m/init.1m 0444 root bin
+f usr/share/man/man1m/install.1m 0444 root bin
+f usr/share/man/man1m/installgrub.1m 0444 root bin
+f usr/share/man/man1m/intrstat.1m 0444 root bin
+f usr/share/man/man1m/iostat.1m 0444 root bin
+f usr/share/man/man1m/ipaddrsel.1m 0444 root bin
+f usr/share/man/man1m/ipadm.1m 0444 root bin
+f usr/share/man/man1m/ipdadm.1m 0444 root bin
+f usr/share/man/man1m/ipf.1m 0444 root bin
+f usr/share/man/man1m/ipfs.1m 0444 root bin
+f usr/share/man/man1m/ipfstat.1m 0444 root bin
+f usr/share/man/man1m/ipmon.1m 0444 root bin
+f usr/share/man/man1m/ipmpstat.1m 0444 root bin
+f usr/share/man/man1m/ipnat.1m 0444 root bin
+f usr/share/man/man1m/ippool.1m 0444 root bin
+f usr/share/man/man1m/ipsecalgs.1m 0444 root bin
+f usr/share/man/man1m/ipsecconf.1m 0444 root bin
+f usr/share/man/man1m/ipseckey.1m 0444 root bin
+f usr/share/man/man1m/iscsiadm.1m 0444 root bin
+f usr/share/man/man1m/itadm.1m 0444 root bin
+f usr/share/man/man1m/keyserv.1m 0444 root bin
+f usr/share/man/man1m/killall.1m 0444 root bin
+f usr/share/man/man1m/ksslcfg.1m 0444 root bin
+f usr/share/man/man1m/kstat.1m 0444 root bin
+f usr/share/man/man1m/labelit.1m 0444 root bin
+f usr/share/man/man1m/ldap_cachemgr.1m 0444 root bin
+f usr/share/man/man1m/ldapaddent.1m 0444 root bin
+f usr/share/man/man1m/ldapclient.1m 0444 root bin
+f usr/share/man/man1m/link.1m 0444 root bin
+f usr/share/man/man1m/listdgrp.1m 0444 root bin
+f usr/share/man/man1m/locator.1m 0444 root bin
+f usr/share/man/man1m/lockfs.1m 0444 root bin
+f usr/share/man/man1m/lockstat.1m 0444 root bin
+f usr/share/man/man1m/lofiadm.1m 0444 root bin
+f usr/share/man/man1m/logadm.1m 0444 root bin
+f usr/share/man/man1m/logins.1m 0444 root bin
+f usr/share/man/man1m/makedbm.1m 0444 root bin
+f usr/share/man/man1m/makemap.1m 0444 root bin
+f usr/share/man/man1m/mkdevalloc.1m 0444 root bin
+f usr/share/man/man1m/mkdevmaps.1m 0444 root bin
+f usr/share/man/man1m/mkfifo.1m 0444 root bin
+f usr/share/man/man1m/mkfile.1m 0444 root bin
+f usr/share/man/man1m/mkfs_pcfs.1m 0444 root bin
+f usr/share/man/man1m/mkfs_ufs.1m 0444 root bin
+f usr/share/man/man1m/mkfs_udfs.1m 0444 root bin
+f usr/share/man/man1m/mkfs.1m 0444 root bin
+f usr/share/man/man1m/mknod.1m 0444 root bin
+f usr/share/man/man1m/mkpwdict.1m 0444 root bin
+f usr/share/man/man1m/modinfo.1m 0444 root bin
+f usr/share/man/man1m/modload.1m 0444 root bin
+f usr/share/man/man1m/modunload.1m 0444 root bin
+f usr/share/man/man1m/mount_hsfs.1m 0444 root bin
+f usr/share/man/man1m/mount_nfs.1m 0444 root bin
+f usr/share/man/man1m/mount_pcfs.1m 0444 root bin
+f usr/share/man/man1m/mount_smbfs.1m 0444 root bin
+f usr/share/man/man1m/mount_tmpfs.1m 0444 root bin
+f usr/share/man/man1m/mount_udfs.1m 0444 root bin
+f usr/share/man/man1m/mount_ufs.1m 0444 root bin
+f usr/share/man/man1m/mount.1m 0444 root bin
+f usr/share/man/man1m/mountall.1m 0444 root bin
+f usr/share/man/man1m/mpathadm.1m 0444 root bin
+f usr/share/man/man1m/mpstat.1m 0444 root bin
+f usr/share/man/man1m/msgid.1m 0444 root bin
+f usr/share/man/man1m/mvdir.1m 0444 root bin
+f usr/share/man/man1m/ncheck.1m 0444 root bin
+f usr/share/man/man1m/ndd.1m 0444 root bin
+f usr/share/man/man1m/netstat.1m 0444 root bin
+f usr/share/man/man1m/netstrategy.1m 0444 root bin
+f usr/share/man/man1m/newaliases.1m 0444 root bin
+f usr/share/man/man1m/newfs.1m 0444 root bin
+f usr/share/man/man1m/newkey.1m 0444 root bin
+f usr/share/man/man1m/nfsstat.1m 0444 root bin
+f usr/share/man/man1m/nlsadmin.1m 0444 root bin
+f usr/share/man/man1m/nscd.1m 0444 root bin
+f usr/share/man/man1m/pbind.1m 0444 root bin
+f usr/share/man/man1m/ping.1m 0444 root bin
+f usr/share/man/man1m/plockstat.1m 0444 root bin
+f usr/share/man/man1m/pmadm.1m 0444 root bin
+f usr/share/man/man1m/pmconfig.1m 0444 root bin
+f usr/share/man/man1m/pooladm.1m 0444 root bin
+f usr/share/man/man1m/poolbind.1m 0444 root bin
+f usr/share/man/man1m/poolcfg.1m 0444 root bin
+f usr/share/man/man1m/poolstat.1m 0444 root bin
+f usr/share/man/man1m/ports.1m 0444 root bin
+f usr/share/man/man1m/poweroff.1m 0444 root bin
+f usr/share/man/man1m/praudit.1m 0444 root bin
+f usr/share/man/man1m/projadd.1m 0444 root bin
+f usr/share/man/man1m/projdel.1m 0444 root bin
+f usr/share/man/man1m/projmod.1m 0444 root bin
+f usr/share/man/man1m/prstat.1m 0444 root bin
+f usr/share/man/man1m/prtconf.1m 0444 root bin
+f usr/share/man/man1m/prtdiag.1m 0444 root bin
+f usr/share/man/man1m/prtpicl.1m 0444 root bin
+f usr/share/man/man1m/prtvtoc.1m 0444 root bin
+f usr/share/man/man1m/psradm.1m 0444 root bin
+f usr/share/man/man1m/psrinfo.1m 0444 root bin
+f usr/share/man/man1m/psrset.1m 0444 root bin
+f usr/share/man/man1m/putdev.1m 0444 root bin
+f usr/share/man/man1m/putdgrp.1m 0444 root bin
+f usr/share/man/man1m/pwck.1m 0444 root bin
+f usr/share/man/man1m/pwconv.1m 0444 root bin
+f usr/share/man/man1m/quot.1m 0444 root bin
+f usr/share/man/man1m/quota.1m 0444 root bin
+f usr/share/man/man1m/quotacheck.1m 0444 root bin
+f usr/share/man/man1m/quotaoff.1m 0444 root bin
+f usr/share/man/man1m/quotaon.1m 0444 root bin
+f usr/share/man/man1m/raidctl.1m 0444 root bin
+f usr/share/man/man1m/ramdiskadm.1m 0444 root bin
+f usr/share/man/man1m/rcapadm.1m 0444 root bin
+f usr/share/man/man1m/rctladm.1m 0444 root bin
+f usr/share/man/man1m/rdate.1m 0444 root bin
+f usr/share/man/man1m/reboot.1m 0444 root bin
+f usr/share/man/man1m/rem_drv.1m 0444 root bin
+f usr/share/man/man1m/repquota.1m 0444 root bin
+f usr/share/man/man1m/rmt.1m 0444 root bin
+f usr/share/man/man1m/roleadd.1m 0444 root bin
+f usr/share/man/man1m/roledel.1m 0444 root bin
+f usr/share/man/man1m/rolemod.1m 0444 root bin
+f usr/share/man/man1m/route.1m 0444 root bin
+f usr/share/man/man1m/routeadm.1m 0444 root bin
+f usr/share/man/man1m/rpc.rexd.1m 0444 root bin
+f usr/share/man/man1m/rpcbind.1m 0444 root bin
+f usr/share/man/man1m/rpcinfo.1m 0444 root bin
+f usr/share/man/man1m/rsh.1m 0444 root bin
+f usr/share/man/man1m/rtc.1m 0444 root bin
+f usr/share/man/man1m/rtquery.1m 0444 root bin
+f usr/share/man/man1m/rwall.1m 0444 root bin
+f usr/share/man/man1m/sacadm.1m 0444 root bin
+f usr/share/man/man1m/savecore.1m 0444 root bin
+f usr/share/man/man1m/sbdadm.1m 0444 root bin
+f usr/share/man/man1m/sendmail.1m 0444 root bin
+f usr/share/man/man1m/setuname.1m 0444 root bin
+f usr/share/man/man1m/share.1m 0444 root bin
+f usr/share/man/man1m/shareall.1m 0444 root bin
+f usr/share/man/man1m/sharectl.1m 0444 root bin
+f usr/share/man/man1m/sharemgr.1m 0444 root bin
+f usr/share/man/man1m/share_nfs.1m 0444 root bin
+f usr/share/man/man1m/showmount.1m 0444 root bin
+f usr/share/man/man1m/shutdown.1m 0444 root bin
+f usr/share/man/man1m/smbadm.1m 0444 root bin
+f usr/share/man/man1m/smbios.1m 0444 root bin
+f usr/share/man/man1m/smbstat.1m 0444 root bin
+f usr/share/man/man1m/snoop.1m 0444 root bin
+f usr/share/man/man1m/soconfig.1m 0444 root bin
+f usr/share/man/man1m/spray.1m 0444 root bin
+f usr/share/man/man1m/sppptun.1m 0444 root bin
+f usr/share/man/man1m/sshd.1m 0444 root bin
+f usr/share/man/man1m/stmfadm.1m 0444 root bin
+f usr/share/man/man1m/stmsboot.1m 0444 root bin
+f usr/share/man/man1m/strace.1m 0444 root bin
+f usr/share/man/man1m/strclean.1m 0444 root bin
+f usr/share/man/man1m/strerr.1m 0444 root bin
+f usr/share/man/man1m/sttydefs.1m 0444 root bin
+f usr/share/man/man1m/su.1m 0444 root bin
+f usr/share/man/man1m/sulogin.1m 0444 root bin
+f usr/share/man/man1m/svc.startd.1m 044 root bin
+f usr/share/man/man1m/svcadm.1m 0444 root bin
+f usr/share/man/man1m/svccfg.1m 0444 root bin
+f usr/share/man/man1m/swap.1m 0444 root bin
+f usr/share/man/man1m/sync.1m 0444 root bin
+f usr/share/man/man1m/syncinit.1m 0444 root bin
+f usr/share/man/man1m/syncloop.1m 0444 root bin
+f usr/share/man/man1m/syncstat.1m 0444 root bin
+f usr/share/man/man1m/sysdef.1m 0444 root bin
+f usr/share/man/man1m/syseventadm.1m 0444 root bin
+f usr/share/man/man1m/syslogd.1m 0444 root bin
+f usr/share/man/man1m/tapes.1m 0444 root bin
+f usr/share/man/man1m/tcpd.1m 0444 root bin
+f usr/share/man/man1m/tcpdchk.1m 0444 root bin
+f usr/share/man/man1m/tcpdmatch.1m 0444 root bin
+f usr/share/man/man1m/tic.1m 0444 root bin
+f usr/share/man/man1m/traceroute.1m 0444 root bin
+f usr/share/man/man1m/trapstat.1m 0444 root bin
+f usr/share/man/man1m/ttyadm.1m 0444 root bin
+f usr/share/man/man1m/tunefs.1m 0444 root bin
+f usr/share/man/man1m/tzselect.1m 0444 root bin
+f usr/share/man/man1m/uadmin.1m 0444 root bin
+f usr/share/man/man1m/ucodeadm.1m 0444 root bin
+f usr/share/man/man1m/ufsdump.1m 0444 root bin
+f usr/share/man/man1m/ufsrestore.1m 0444 root bin
+f usr/share/man/man1m/umount.1m 0444 root bin
+f usr/share/man/man1m/umountall.1m 0444 root bin
+f usr/share/man/man1m/unlink.1m 0444 root bin
+f usr/share/man/man1m/unshare.1m 0444 root bin
+f usr/share/man/man1m/unshareall.1m 0444 root bin
+f usr/share/man/man1m/unshare_nfs.1m 0444 root bin
+f usr/share/man/man1m/update_drv.1m 0444 root bin
+f usr/share/man/man1m/useradd.1m 0444 root bin
+f usr/share/man/man1m/userdel.1m 0444 root bin
+f usr/share/man/man1m/usermod.1m 0444 root bin
+f usr/share/man/man1m/vmstat.1m 0444 root bin
+f usr/share/man/man1m/volcopy.1m 0444 root bin
+f usr/share/man/man1m/wall.1m 0444 root bin
+f usr/share/man/man1m/whodo.1m 0444 root bin
+f usr/share/man/man1m/wracct.1m 0444 root bin
+f usr/share/man/man1m/wusbadm.1m 0444 root bin
+f usr/share/man/man1m/ypinit.1m 0444 root bin
+f usr/share/man/man1m/yppoll.1m 0444 root bin
+f usr/share/man/man1m/ypset.1m 0444 root bin
+f usr/share/man/man1m/zdb.1m 0444 root bin
+f usr/share/man/man1m/zdump.1m 0444 root bin
+f usr/share/man/man1m/zfs.1m 0444 root bin
+f usr/share/man/man1m/zic.1m 0444 root bin
+f usr/share/man/man1m/zoneadm.1m 0444 root bin
+f usr/share/man/man1m/zonecfg.1m 0444 root bin
+f usr/share/man/man1m/zpool.1m 0444 root bin
+f usr/share/man/man1m/zstreamdump.1m 0444 root bin
+d usr/share/man/man2 0755 root bin
+f usr/share/man/man2/Intro.2 0444 root bin
+f usr/share/man/man2/_exit.2 0444 root bin
+f usr/share/man/man2/_Exit.2 0444 root bin
+f usr/share/man/man2/_lwp_cond_broadcast.2 0444 root bin
+f usr/share/man/man2/_lwp_cond_reltimedwait.2 0444 root bin
+f usr/share/man/man2/_lwp_cond_timedwait.2 0444 root bin
+f usr/share/man/man2/_lwp_continue.2 0444 root bin
+f usr/share/man/man2/_lwp_mutex_trylock.2 0444 root bin
+f usr/share/man/man2/_lwp_mutex_unlock.2 0444 root bin
+f usr/share/man/man2/_lwp_sema_init.2 0444 root bin
+f usr/share/man/man2/_lwp_sema_post.2 0444 root bin
+f usr/share/man/man2/_lwp_sema_trywait.2 0444 root bin
+f usr/share/man/man2/_lwp_cond_signal.2 0444 root bin
+f usr/share/man/man2/_lwp_cond_wait.2 0444 root bin
+f usr/share/man/man2/_lwp_info.2 0444 root bin
+f usr/share/man/man2/_lwp_kill.2 0444 root bin
+f usr/share/man/man2/_lwp_mutex_lock.2 0444 root bin
+f usr/share/man/man2/_lwp_self.2 0444 root bin
+f usr/share/man/man2/_lwp_sema_wait.2 0444 root bin
+f usr/share/man/man2/_lwp_suspend.2 0444 root bin
+f usr/share/man/man2/access.2 0444 root bin
+f usr/share/man/man2/acct.2 0444 root bin
+f usr/share/man/man2/acl.2 0444 root bin
+f usr/share/man/man2/adjtime.2 0444 root bin
+f usr/share/man/man2/alarm.2 0444 root bin
+f usr/share/man/man2/audit.2 0444 root bin
+f usr/share/man/man2/auditon.2 0444 root bin
+f usr/share/man/man2/brk.2 0444 root bin
+f usr/share/man/man2/chdir.2 0444 root bin
+f usr/share/man/man2/chmod.2 0444 root bin
+f usr/share/man/man2/chown.2 0444 root bin
+f usr/share/man/man2/chroot.2 0444 root bin
+f usr/share/man/man2/close.2 0444 root bin
+f usr/share/man/man2/creat.2 0444 root bin
+f usr/share/man/man2/dup.2 0444 root bin
+f usr/share/man/man2/exec.2 0444 root bin
+f usr/share/man/man2/execl.2 0444 root bin
+f usr/share/man/man2/execle.2 0444 root bin
+f usr/share/man/man2/execlp.2 0444 root bin
+f usr/share/man/man2/execv.2 0444 root bin
+f usr/share/man/man2/execve.2 0444 root bin
+f usr/share/man/man2/execvp.2 0444 root bin
+f usr/share/man/man2/exit.2 0444 root bin
+f usr/share/man/man2/faccessat.2 0444 root bin
+f usr/share/man/man2/facl.2 0444 root bin
+f usr/share/man/man2/fchdir.2 0444 root bin
+f usr/share/man/man2/fchmod.2 0444 root bin
+f usr/share/man/man2/fchown.2 0444 root bin
+f usr/share/man/man2/fchownat.2 0444 root bin
+f usr/share/man/man2/fchroot.2 0444 root bin
+f usr/share/man/man2/fcntl.2 0444 root bin
+f usr/share/man/man2/fork.2 0444 root bin
+f usr/share/man/man2/fork1.2 0444 root bin
+f usr/share/man/man2/forkall.2 0444 root bin
+f usr/share/man/man2/forkallx.2 0444 root bin
+f usr/share/man/man2/forkx.2 0444 root bin
+f usr/share/man/man2/fpathconf.2 0444 root bin
+f usr/share/man/man2/fstat.2 0444 root bin
+f usr/share/man/man2/fstatat.2 0444 root bin
+f usr/share/man/man2/fstatvfs.2 0444 root bin
+f usr/share/man/man2/futimesat.2 0444 root bin
+f usr/share/man/man2/getacct.2 0444 root bin
+f usr/share/man/man2/getaudit_addr.2 0444 root bin
+f usr/share/man/man2/getaudit.2 0444 root bin
+f usr/share/man/man2/getauid.2 0444 root bin
+f usr/share/man/man2/getcontext.2 0444 root bin
+f usr/share/man/man2/getdents.2 0444 root bin
+f usr/share/man/man2/getegid.2 0444 root bin
+f usr/share/man/man2/geteuid.2 0444 root bin
+f usr/share/man/man2/getgid.2 0444 root bin
+f usr/share/man/man2/getgroups.2 0444 root bin
+f usr/share/man/man2/getisax.2 0444 root bin
+f usr/share/man/man2/getitimer.2 0444 root bin
+f usr/share/man/man2/getmsg.2 0444 root bin
+f usr/share/man/man2/getpflags.2 0444 root bin
+f usr/share/man/man2/getpgid.2 0444 root bin
+f usr/share/man/man2/getpgrp.2 0444 root bin
+f usr/share/man/man2/getpid.2 0444 root bin
+f usr/share/man/man2/getpmsg.2 0444 root bin
+f usr/share/man/man2/getppid.2 0444 root bin
+f usr/share/man/man2/getppriv.2 0444 root bin
+f usr/share/man/man2/getprojid.2 0444 root bin
+f usr/share/man/man2/getrctl.2 0444 root bin
+f usr/share/man/man2/getrlimit.2 0444 root bin
+f usr/share/man/man2/getsid.2 0444 root bin
+f usr/share/man/man2/gettaskid.2 0444 root bin
+f usr/share/man/man2/getuid.2 0444 root bin
+f usr/share/man/man2/getustack.2 0444 root bin
+f usr/share/man/man2/intro.2 0444 root bin
+f usr/share/man/man2/ioctl.2 0444 root bin
+f usr/share/man/man2/issetugid.2 0444 root bin
+f usr/share/man/man2/kill.2 0444 root bin
+f usr/share/man/man2/lchown.2 0444 root bin
+f usr/share/man/man2/link.2 0444 root bin
+f usr/share/man/man2/llseek.2 0444 root bin
+f usr/share/man/man2/lseek.2 0444 root bin
+f usr/share/man/man2/lstat.2 0444 root bin
+f usr/share/man/man2/memcntl.2 0444 root bin
+f usr/share/man/man2/meminfo.2 0444 root bin
+f usr/share/man/man2/mincore.2 0444 root bin
+f usr/share/man/man2/mkdir.2 0444 root bin
+f usr/share/man/man2/mknod.2 0444 root bin
+f usr/share/man/man2/mmap.2 0444 root bin
+f usr/share/man/man2/mmapobj.2 0444 root bin
+f usr/share/man/man2/mount.2 0444 root bin
+f usr/share/man/man2/mprotect.2 0444 root bin
+f usr/share/man/man2/msgctl.2 0444 root bin
+f usr/share/man/man2/msgget.2 0444 root bin
+f usr/share/man/man2/msgids.2 0444 root bin
+f usr/share/man/man2/msgrcv.2 0444 root bin
+f usr/share/man/man2/msgsnap.2 0444 root bin
+f usr/share/man/man2/msgsnd.2 0444 root bin
+f usr/share/man/man2/munmap.2 0444 root bin
+f usr/share/man/man2/nice.2 0444 root bin
+f usr/share/man/man2/ntp_adjtime.2 0444 root bin
+f usr/share/man/man2/ntp_gettime.2 0444 root bin
+f usr/share/man/man2/open.2 0444 root bin
+f usr/share/man/man2/openat.2 0444 root bin
+f usr/share/man/man2/p_online.2 0444 root bin
+f usr/share/man/man2/pathconf.2 0444 root bin
+f usr/share/man/man2/pause.2 0444 root bin
+f usr/share/man/man2/pcsample.2 0444 root bin
+f usr/share/man/man2/pipe.2 0444 root bin
+f usr/share/man/man2/poll.2 0444 root bin
+f usr/share/man/man2/pread.2 0444 root bin
+f usr/share/man/man2/priocntl.2 0444 root bin
+f usr/share/man/man2/priocntlset.2 0444 root bin
+f usr/share/man/man2/processor_bind.2 0444 root bin
+f usr/share/man/man2/processor_info.2 0444 root bin
+f usr/share/man/man2/profil.2 0444 root bin
+f usr/share/man/man2/pset_assign.2 0444 root bin
+f usr/share/man/man2/pset_bind.2 0444 root bin
+f usr/share/man/man2/pset_create.2 0444 root bin
+f usr/share/man/man2/pset_destroy.2 0444 root bin
+f usr/share/man/man2/pset_getattr.2 0444 root bin
+f usr/share/man/man2/pset_info.2 0444 root bin
+f usr/share/man/man2/pset_list.2 0444 root bin
+f usr/share/man/man2/pset_setattr.2 0444 root bin
+f usr/share/man/man2/putacct.2 0444 root bin
+f usr/share/man/man2/putmsg.2 0444 root bin
+f usr/share/man/man2/putpmsg.2 0444 root bin
+f usr/share/man/man2/pwrite.2 0444 root bin
+f usr/share/man/man2/read.2 0444 root bin
+f usr/share/man/man2/readlink.2 0444 root bin
+f usr/share/man/man2/readv.2 0444 root bin
+f usr/share/man/man2/rename.2 0444 root bin
+f usr/share/man/man2/renameat.2 0444 root bin
+f usr/share/man/man2/resolvepath.2 0444 root bin
+f usr/share/man/man2/rmdir.2 0444 root bin
+f usr/share/man/man2/sbrk.2 0444 root bin
+f usr/share/man/man2/semctl.2 0444 root bin
+f usr/share/man/man2/semget.2 0444 root bin
+f usr/share/man/man2/semids.2 0444 root bin
+f usr/share/man/man2/semop.2 0444 root bin
+f usr/share/man/man2/semtimedop.2 0444 root bin
+f usr/share/man/man2/setaudit_addr.2 0444 root bin
+f usr/share/man/man2/setaudit.2 0444 root bin
+f usr/share/man/man2/setauid.2 0444 root bin
+f usr/share/man/man2/setcontext.2 0444 root bin
+f usr/share/man/man2/setegid.2 0444 root bin
+f usr/share/man/man2/seteuid.2 0444 root bin
+f usr/share/man/man2/setgid.2 0444 root bin
+f usr/share/man/man2/setgroups.2 0444 root bin
+f usr/share/man/man2/setitimer.2 0444 root bin
+f usr/share/man/man2/setpflags.2 0444 root bin
+f usr/share/man/man2/setpgid.2 0444 root bin
+f usr/share/man/man2/setpgrp.2 0444 root bin
+f usr/share/man/man2/setppriv.2 0444 root bin
+f usr/share/man/man2/setrctl.2 0444 root bin
+f usr/share/man/man2/setregid.2 0444 root bin
+f usr/share/man/man2/setreuid.2 0444 root bin
+f usr/share/man/man2/setrlimit.2 0444 root bin
+f usr/share/man/man2/setsid.2 0444 root bin
+f usr/share/man/man2/settaskid.2 0444 root bin
+f usr/share/man/man2/setuid.2 0444 root bin
+f usr/share/man/man2/setustack.2 0444 root bin
+f usr/share/man/man2/shmat.2 0444 root bin
+f usr/share/man/man2/shmctl.2 0444 root bin
+f usr/share/man/man2/shmdt.2 0444 root bin
+f usr/share/man/man2/shmget.2 0444 root bin
+f usr/share/man/man2/shmids.2 0444 root bin
+f usr/share/man/man2/shmop.2 0444 root bin
+f usr/share/man/man2/sigaction.2 0444 root bin
+f usr/share/man/man2/sigaltstack.2 0444 root bin
+f usr/share/man/man2/sigpending.2 0444 root bin
+f usr/share/man/man2/sigprocmask.2 0444 root bin
+f usr/share/man/man2/sigsend.2 0444 root bin
+f usr/share/man/man2/sigsendset.2 0444 root bin
+f usr/share/man/man2/sigsuspend.2 0444 root bin
+f usr/share/man/man2/sigwait.2 0444 root bin
+f usr/share/man/man2/stat.2 0444 root bin
+f usr/share/man/man2/statvfs.2 0444 root bin
+f usr/share/man/man2/stime.2 0444 root bin
+f usr/share/man/man2/swapctl.2 0444 root bin
+f usr/share/man/man2/symlink.2 0444 root bin
+f usr/share/man/man2/sync.2 0444 root bin
+f usr/share/man/man2/sysfs.2 0444 root bin
+f usr/share/man/man2/sysinfo.2 0444 root bin
+f usr/share/man/man2/time.2 0444 root bin
+f usr/share/man/man2/times.2 0444 root bin
+f usr/share/man/man2/uadmin.2 0444 root bin
+f usr/share/man/man2/ulimit.2 0444 root bin
+f usr/share/man/man2/umask.2 0444 root bin
+f usr/share/man/man2/umount.2 0444 root bin
+f usr/share/man/man2/umount2.2 0444 root bin
+f usr/share/man/man2/uname.2 0444 root bin
+f usr/share/man/man2/unlink.2 0444 root bin
+f usr/share/man/man2/unlinkat.2 0444 root bin
+f usr/share/man/man2/ustat.2 0444 root bin
+f usr/share/man/man2/utime.2 0444 root bin
+f usr/share/man/man2/utimes.2 0444 root bin
+f usr/share/man/man2/uucopy.2 0444 root bin
+f usr/share/man/man2/vfork.2 0444 root bin
+f usr/share/man/man2/vforkx.2 0444 root bin
+f usr/share/man/man2/vhangup.2 0444 root bin
+f usr/share/man/man2/waitid.2 0444 root bin
+f usr/share/man/man2/wracct.2 0444 root bin
+f usr/share/man/man2/write.2 0444 root bin
+f usr/share/man/man2/writev.2 0444 root bin
+f usr/share/man/man2/yield.2 0444 root bin
+d usr/share/man/man3 0755 root bin
+f usr/share/man/man3/Intro.3 0444 root bin
+d usr/share/man/man3bsm 0755 root bin
+f usr/share/man/man3bsm/au_open.3bsm 0444 root bin
+f usr/share/man/man3bsm/au_preselect.3bsm 0444 root bin
+f usr/share/man/man3bsm/au_to.3bsm 0444 root bin
+f usr/share/man/man3bsm/au_user_mask.3bsm 0444 root bin
+f usr/share/man/man3bsm/getacinfo.3bsm 0444 root bin
+f usr/share/man/man3bsm/getauclassent.3bsm 0444 root bin
+f usr/share/man/man3bsm/getauditflags.3bsm 0444 root bin
+f usr/share/man/man3bsm/getauevent.3bsm 0444 root bin
+f usr/share/man/man3bsm/getauusernam.3bsm 0444 root bin
+f usr/share/man/man3bsm/getddent.3bsm 0444 root bin
+f usr/share/man/man3bsm/getfauditflags.3bsm 0444 root bin
+d usr/share/man/man3c 0755 root bin
+f usr/share/man/man3c/FD_CLR.3c 0444 root bin
+f usr/share/man/man3c/FD_ISSET.3c 0444 root bin
+f usr/share/man/man3c/FD_SET.3c 0444 root bin
+f usr/share/man/man3c/FD_ZERO.3c 0444 root bin
+f usr/share/man/man3c/__fbufsize.3c 0444 root bin
+f usr/share/man/man3c/__flbf.3c 0444 root bin
+f usr/share/man/man3c/__fpending.3c 0444 root bin
+f usr/share/man/man3c/__fpurge.3c 0444 root bin
+f usr/share/man/man3c/__freadable.3c 0444 root bin
+f usr/share/man/man3c/__freading.3c 0444 root bin
+f usr/share/man/man3c/__fsetlocking.3c 0444 root bin
+f usr/share/man/man3c/__fwritable.3c 0444 root bin
+f usr/share/man/man3c/__fwriting.3c 0444 root bin
+f usr/share/man/man3c/_edata.3c 0444 root bin
+f usr/share/man/man3c/_end.3c 0444 root bin
+f usr/share/man/man3c/_etext.3c 0444 root bin
+f usr/share/man/man3c/_exithandle.3c 0444 root bin
+f usr/share/man/man3c/_flushlbf.3c 0444 root bin
+f usr/share/man/man3c/_longjmp.3c 0444 root bin
+f usr/share/man/man3c/_setjmp.3c 0444 root bin
+f usr/share/man/man3c/_stack_grow.3c 0444 root bin
+f usr/share/man/man3c/a64l.3c 0444 root bin
+f usr/share/man/man3c/abort.3c 0444 root bin
+f usr/share/man/man3c/abs.3c 0444 root bin
+f usr/share/man/man3c/addrtosymstr.3c 0444 root bin
+f usr/share/man/man3c/addsev.3c 0444 root bin
+f usr/share/man/man3c/addseverity.3c 0444 root bin
+f usr/share/man/man3c/aio_cancel.3c 0444 root bin
+f usr/share/man/man3c/aio_error.3c 0444 root bin
+f usr/share/man/man3c/aio_fsync.3c 0444 root bin
+f usr/share/man/man3c/aio_read.3c 0444 root bin
+f usr/share/man/man3c/aio_return.3c 0444 root bin
+f usr/share/man/man3c/aio_suspend.3c 0444 root bin
+f usr/share/man/man3c/aio_waitn.3c 0444 root bin
+f usr/share/man/man3c/aio_write.3c 0444 root bin
+f usr/share/man/man3c/aiocancel.3c 0444 root bin
+f usr/share/man/man3c/aioread.3c 0444 root bin
+f usr/share/man/man3c/aiowait.3c 0444 root bin
+f usr/share/man/man3c/aiowrite.3c 0444 root bin
+f usr/share/man/man3c/alloca.3c 0444 root bin
+f usr/share/man/man3c/alphasort.3c 0444 root bin
+f usr/share/man/man3c/ascftime.3c 0444 root bin
+f usr/share/man/man3c/asctime.3c 0444 root bin
+f usr/share/man/man3c/asctime_r.3c 0444 root bin
+f usr/share/man/man3c/asprintf.3c 0444 root bin
+f usr/share/man/man3c/assert.3c 0444 root bin
+f usr/share/man/man3c/atexit.3c 0444 root bin
+f usr/share/man/man3c/atof.3c 0444 root bin
+f usr/share/man/man3c/atoi.3c 0444 root bin
+f usr/share/man/man3c/atol.3c 0444 root bin
+f usr/share/man/man3c/atoll.3c 0444 root bin
+f usr/share/man/man3c/atomic_add.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_16.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_16_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_32.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_32_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_64.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_64_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_8.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_8_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_char.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_char_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_int.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_int_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_long.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_long_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_ptr.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_ptr_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_short.3c 0444 root bin
+f usr/share/man/man3c/atomic_add_short_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_and.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_16.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_16_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_32.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_32_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_64.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_64_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_8.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_8_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_uchar.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_uchar_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_uint.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_uint_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_ulong.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_ulong_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_ushort.3c 0444 root bin
+f usr/share/man/man3c/atomic_and_ushort_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_bits.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_16.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_32.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_64.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_8.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_ptr.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_uchar.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_uint.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_ulong.3c 0444 root bin
+f usr/share/man/man3c/atomic_cas_ushort.3c 0444 root bin
+f usr/share/man/man3c/atomic_clear_long_excl.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_16.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_16_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_32.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_32_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_64.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_64_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_8.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_8_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_ptr.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_ptr_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_uchar.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_uchar_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_uint.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_uint_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_ulong.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_ulong_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_ushort.3c 0444 root bin
+f usr/share/man/man3c/atomic_dec_ushort_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_16.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_16_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_32.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_32_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_64.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_64_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_8.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_8_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_ptr.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_ptr_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_uchar.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_uchar_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_uint.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_uint_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_ulong.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_ulong_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_ushort.3c 0444 root bin
+f usr/share/man/man3c/atomic_inc_ushort_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_ops.3c 0444 root bin
+f usr/share/man/man3c/atomic_or.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_16.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_16_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_32.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_32_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_64.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_64_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_8.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_8_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_uchar.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_uchar_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_uint.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_uint_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_ulong.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_ulong_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_ushort.3c 0444 root bin
+f usr/share/man/man3c/atomic_or_ushort_nv.3c 0444 root bin
+f usr/share/man/man3c/atomic_set_long_excl.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_16.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_32.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_64.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_8.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_ptr.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_uchar.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_uint.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_ulong.3c 0444 root bin
+f usr/share/man/man3c/atomic_swap_ushort.3c 0444 root bin
+f usr/share/man/man3c/attropen.3c 0444 root bin
+f usr/share/man/man3c/backtrace.3c 0444 root bin
+f usr/share/man/man3c/backtrace_symbols.3c 0444 root bin
+f usr/share/man/man3c/backtrace_symbols_fd.3c 0444 root bin
+f usr/share/man/man3c/basename.3c 0444 root bin
+f usr/share/man/man3c/bcmp.3c 0444 root bin
+f usr/share/man/man3c/bcopy.3c 0444 root bin
+f usr/share/man/man3c/bind_textdomain_codeset.3c 0444 root bin
+f usr/share/man/man3c/bindtextdomain.3c 0444 root bin
+f usr/share/man/man3c/bsd_signal.3c 0444 root bin
+f usr/share/man/man3c/bsearch.3c 0444 root bin
+f usr/share/man/man3c/bstring.3c 0444 root bin
+f usr/share/man/man3c/btowc.3c 0444 root bin
+f usr/share/man/man3c/bzero.3c 0444 root bin
+f usr/share/man/man3c/calloc.3c 0444 root bin
+f usr/share/man/man3c/catclose.3c 0444 root bin
+f usr/share/man/man3c/catgets.3c 0444 root bin
+f usr/share/man/man3c/catopen.3c 0444 root bin
+f usr/share/man/man3c/cfgetispeed.3c 0444 root bin
+f usr/share/man/man3c/cfgetospeed.3c 0444 root bin
+f usr/share/man/man3c/cfsetispeed.3c 0444 root bin
+f usr/share/man/man3c/cfsetospeed.3c 0444 root bin
+f usr/share/man/man3c/cftime.3c 0444 root bin
+f usr/share/man/man3c/clearerr.3c 0444 root bin
+f usr/share/man/man3c/clock.3c 0444 root bin
+f usr/share/man/man3c/clock_getres.3c 0444 root bin
+f usr/share/man/man3c/clock_gettime.3c 0444 root bin
+f usr/share/man/man3c/clock_nanosleep.3c 0444 root bin
+f usr/share/man/man3c/clock_settime.3c 0444 root bin
+f usr/share/man/man3c/closedir.3c 0444 root bin
+f usr/share/man/man3c/closefrom.3c 0444 root bin
+f usr/share/man/man3c/closelog.3c 0444 root bin
+f usr/share/man/man3c/cond_broadcast.3c 0444 root bin
+f usr/share/man/man3c/cond_destroy.3c 0444 root bin
+f usr/share/man/man3c/cond_init.3c 0444 root bin
+f usr/share/man/man3c/cond_reltimedwait.3c 0444 root bin
+f usr/share/man/man3c/cond_signal.3c 0444 root bin
+f usr/share/man/man3c/cond_timedwait.3c 0444 root bin
+f usr/share/man/man3c/cond_wait.3c 0444 root bin
+f usr/share/man/man3c/confstr.3c 0444 root bin
+f usr/share/man/man3c/crypt.3c 0444 root bin
+f usr/share/man/man3c/crypt_genhash_impl.3c 0444 root bin
+f usr/share/man/man3c/crypt_gensalt.3c 0444 root bin
+f usr/share/man/man3c/crypt_gensalt_impl.3c 0444 root bin
+f usr/share/man/man3c/cset.3c 0444 root bin
+f usr/share/man/man3c/csetcol.3c 0444 root bin
+f usr/share/man/man3c/csetlen.3c 0444 root bin
+f usr/share/man/man3c/csetno.3c 0444 root bin
+f usr/share/man/man3c/ctermid.3c 0444 root bin
+f usr/share/man/man3c/ctermid_r.3c 0444 root bin
+f usr/share/man/man3c/ctime.3c 0444 root bin
+f usr/share/man/man3c/ctime_r.3c 0444 root bin
+f usr/share/man/man3c/ctype.3c 0444 root bin
+f usr/share/man/man3c/cuserid.3c 0444 root bin
+f usr/share/man/man3c/daemon.3c 0444 root bin
+f usr/share/man/man3c/dbm_clearerr.3c 0444 root bin
+f usr/share/man/man3c/dbm_close.3c 0444 root bin
+f usr/share/man/man3c/dbm_delete.3c 0444 root bin
+f usr/share/man/man3c/dbm_error.3c 0444 root bin
+f usr/share/man/man3c/dbm_fetch.3c 0444 root bin
+f usr/share/man/man3c/dbm_firstkey.3c 0444 root bin
+f usr/share/man/man3c/dbm_nextkey.3c 0444 root bin
+f usr/share/man/man3c/dbm_open.3c 0444 root bin
+f usr/share/man/man3c/dbm_store.3c 0444 root bin
+f usr/share/man/man3c/dcgettext.3c 0444 root bin
+f usr/share/man/man3c/dcngettext.3c 0444 root bin
+f usr/share/man/man3c/decimal_to_double.3c 0444 root bin
+f usr/share/man/man3c/decimal_to_extended.3c 0444 root bin
+f usr/share/man/man3c/decimal_to_floating.3c 0444 root bin
+f usr/share/man/man3c/decimal_to_quadruple.3c 0444 root bin
+f usr/share/man/man3c/decimal_to_single.3c 0444 root bin
+f usr/share/man/man3c/dgettext.3c 0444 root bin
+f usr/share/man/man3c/difftime.3c 0444 root bin
+f usr/share/man/man3c/directio.3c 0444 root bin
+f usr/share/man/man3c/dirfd.3c 0444 root bin
+f usr/share/man/man3c/dirname.3c 0444 root bin
+f usr/share/man/man3c/div.3c 0444 root bin
+f usr/share/man/man3c/dladdr.3c 0444 root bin
+f usr/share/man/man3c/dladdr1.3c 0444 root bin
+f usr/share/man/man3c/dlclose.3c 0444 root bin
+f usr/share/man/man3c/dldump.3c 0444 root bin
+f usr/share/man/man3c/dlerror.3c 0444 root bin
+f usr/share/man/man3c/dlinfo.3c 0444 root bin
+f usr/share/man/man3c/dlmopen.3c 0444 root bin
+f usr/share/man/man3c/dlopen.3c 0444 root bin
+f usr/share/man/man3c/dlsym.3c 0444 root bin
+f usr/share/man/man3c/dngettext.3c 0444 root bin
+f usr/share/man/man3c/door_bind.3c 0444 root bin
+f usr/share/man/man3c/door_call.3c 0444 root bin
+f usr/share/man/man3c/door_create.3c 0444 root bin
+f usr/share/man/man3c/door_cred.3c 0444 root bin
+f usr/share/man/man3c/door_getparam.3c 0444 root bin
+f usr/share/man/man3c/door_info.3c 0444 root bin
+f usr/share/man/man3c/door_return.3c 0444 root bin
+f usr/share/man/man3c/door_revoke.3c 0444 root bin
+f usr/share/man/man3c/door_server_create.3c 0444 root bin
+f usr/share/man/man3c/door_setparam.3c 0444 root bin
+f usr/share/man/man3c/door_ucred.3c 0444 root bin
+f usr/share/man/man3c/door_unbind.3c 0444 root bin
+f usr/share/man/man3c/double_to_decimal.3c 0444 root bin
+f usr/share/man/man3c/drand48.3c 0444 root bin
+f usr/share/man/man3c/dup2.3c 0444 root bin
+f usr/share/man/man3c/econvert.3c 0444 root bin
+f usr/share/man/man3c/ecvt.3c 0444 root bin
+f usr/share/man/man3c/edata.3c 0444 root bin
+f usr/share/man/man3c/enable_extended_FILE_stdio.3c 0444 root bin
+f usr/share/man/man3c/encrypt.3c 0444 root bin
+f usr/share/man/man3c/end.3c 0444 root bin
+f usr/share/man/man3c/endgrent.3c 0444 root bin
+f usr/share/man/man3c/endnetgrent.3c 0444 root bin
+f usr/share/man/man3c/endpwent.3c 0444 root bin
+f usr/share/man/man3c/endspent.3c 0444 root bin
+f usr/share/man/man3c/endusershell.3c 0444 root bin
+f usr/share/man/man3c/endutent.3c 0444 root bin
+f usr/share/man/man3c/endutxent.3c 0444 root bin
+f usr/share/man/man3c/erand48.3c 0444 root bin
+f usr/share/man/man3c/err.3c 0444 root bin
+f usr/share/man/man3c/errno.3c 0444 root bin
+f usr/share/man/man3c/errx.3c 0444 root bin
+f usr/share/man/man3c/etext.3c 0444 root bin
+f usr/share/man/man3c/euccol.3c 0444 root bin
+f usr/share/man/man3c/euclen.3c 0444 root bin
+f usr/share/man/man3c/eucscol.3c 0444 root bin
+f usr/share/man/man3c/exit.3c 0444 root bin
+f usr/share/man/man3c/extended_to_decimal.3c 0444 root bin
+f usr/share/man/man3c/fattach.3c 0444 root bin
+f usr/share/man/man3c/fclose.3c 0444 root bin
+f usr/share/man/man3c/fconvert.3c 0444 root bin
+f usr/share/man/man3c/fcvt.3c 0444 root bin
+f usr/share/man/man3c/fdatasync.3c 0444 root bin
+f usr/share/man/man3c/fdetach.3c 0444 root bin
+f usr/share/man/man3c/fdopen.3c 0444 root bin
+f usr/share/man/man3c/fdopendir.3c 0444 root bin
+f usr/share/man/man3c/fdwalk.3c 0444 root bin
+f usr/share/man/man3c/feof.3c 0444 root bin
+f usr/share/man/man3c/ferror.3c 0444 root bin
+f usr/share/man/man3c/fflush.3c 0444 root bin
+f usr/share/man/man3c/ffs.3c 0444 root bin
+f usr/share/man/man3c/fgetattr.3c 0444 root bin
+f usr/share/man/man3c/fgetc.3c 0444 root bin
+f usr/share/man/man3c/fgetgrent.3c 0444 root bin
+f usr/share/man/man3c/fgetgrent_r.3c 0444 root bin
+f usr/share/man/man3c/fgetpos.3c 0444 root bin
+f usr/share/man/man3c/fgetpwent.3c 0444 root bin
+f usr/share/man/man3c/fgetpwent_r.3c 0444 root bin
+f usr/share/man/man3c/fgets.3c 0444 root bin
+f usr/share/man/man3c/fgetspent.3c 0444 root bin
+f usr/share/man/man3c/fgetspent_r.3c 0444 root bin
+f usr/share/man/man3c/fgetwc.3c 0444 root bin
+f usr/share/man/man3c/fgetws.3c 0444 root bin
+f usr/share/man/man3c/file_to_decimal.3c 0444 root bin
+f usr/share/man/man3c/fileno.3c 0444 root bin
+f usr/share/man/man3c/finite.3c 0444 root bin
+f usr/share/man/man3c/floating_to_decimal.3c 0444 root bin
+f usr/share/man/man3c/flockfile.3c 0444 root bin
+f usr/share/man/man3c/fmtmsg.3c 0444 root bin
+f usr/share/man/man3c/fnmatch.3c 0444 root bin
+f usr/share/man/man3c/fopen.3c 0444 root bin
+f usr/share/man/man3c/fpclass.3c 0444 root bin
+f usr/share/man/man3c/fpgetmask.3c 0444 root bin
+f usr/share/man/man3c/fpgetround.3c 0444 root bin
+f usr/share/man/man3c/fpgetsticky.3c 0444 root bin
+f usr/share/man/man3c/fprintf.3c 0444 root bin
+f usr/share/man/man3c/fpsetmask.3c 0444 root bin
+f usr/share/man/man3c/fpsetround.3c 0444 root bin
+f usr/share/man/man3c/fpsetsticky.3c 0444 root bin
+f usr/share/man/man3c/fputc.3c 0444 root bin
+f usr/share/man/man3c/fputs.3c 0444 root bin
+f usr/share/man/man3c/fputwc.3c 0444 root bin
+f usr/share/man/man3c/fputws.3c 0444 root bin
+f usr/share/man/man3c/fread.3c 0444 root bin
+f usr/share/man/man3c/free.3c 0444 root bin
+f usr/share/man/man3c/freopen.3c 0444 root bin
+f usr/share/man/man3c/fscanf.3c 0444 root bin
+f usr/share/man/man3c/fseek.3c 0444 root bin
+f usr/share/man/man3c/fseeko.3c 0444 root bin
+f usr/share/man/man3c/fsetattr.3c 0444 root bin
+f usr/share/man/man3c/fsetpos.3c 0444 root bin
+f usr/share/man/man3c/fsync.3c 0444 root bin
+f usr/share/man/man3c/ftell.3c 0444 root bin
+f usr/share/man/man3c/ftello.3c 0444 root bin
+f usr/share/man/man3c/ftime.3c 0444 root bin
+f usr/share/man/man3c/ftok.3c 0444 root bin
+f usr/share/man/man3c/ftruncate.3c 0444 root bin
+f usr/share/man/man3c/ftrylockfile.3c 0444 root bin
+f usr/share/man/man3c/ftw.3c 0444 root bin
+f usr/share/man/man3c/func_to_decimal.3c 0444 root bin
+f usr/share/man/man3c/funlockfile.3c 0444 root bin
+f usr/share/man/man3c/fwide.3c 0444 root bin
+f usr/share/man/man3c/fwprintf.3c 0444 root bin
+f usr/share/man/man3c/fwrite.3c 0444 root bin
+f usr/share/man/man3c/fwscanf.3c 0444 root bin
+f usr/share/man/man3c/gconvert.3c 0444 root bin
+f usr/share/man/man3c/gcvt.3c 0444 root bin
+f usr/share/man/man3c/getattrat.3c 0444 root bin
+f usr/share/man/man3c/getc.3c 0444 root bin
+f usr/share/man/man3c/getc_unlocked.3c 0444 root bin
+f usr/share/man/man3c/getchar.3c 0444 root bin
+f usr/share/man/man3c/getchar_unlocked.3c 0444 root bin
+f usr/share/man/man3c/getcpuid.3c 0444 root bin
+f usr/share/man/man3c/getcwd.3c 0444 root bin
+f usr/share/man/man3c/getdate.3c 0444 root bin
+f usr/share/man/man3c/getdelim.3c 0444 root bin
+f usr/share/man/man3c/getdtablesize.3c 0444 root bin
+f usr/share/man/man3c/getenv.3c 0444 root bin
+f usr/share/man/man3c/getexecname.3c 0444 root bin
+f usr/share/man/man3c/getextmntent.3c 0444 root bin
+f usr/share/man/man3c/getgrent.3c 0444 root bin
+f usr/share/man/man3c/getgrent_r.3c 0444 root bin
+f usr/share/man/man3c/getgrgid.3c 0444 root bin
+f usr/share/man/man3c/getgrgid_r.3c 0444 root bin
+f usr/share/man/man3c/getgrnam.3c 0444 root bin
+f usr/share/man/man3c/getgrnam_r.3c 0444 root bin
+f usr/share/man/man3c/gethomelgroup.3c 0444 root bin
+f usr/share/man/man3c/gethostid.3c 0444 root bin
+f usr/share/man/man3c/gethostname.3c 0444 root bin
+f usr/share/man/man3c/gethrtime.3c 0444 root bin
+f usr/share/man/man3c/gethrvtime.3c 0444 root bin
+f usr/share/man/man3c/getline.3c 0444 root bin
+f usr/share/man/man3c/getloadavg.3c 0444 root bin
+f usr/share/man/man3c/getlogin.3c 0444 root bin
+f usr/share/man/man3c/getlogin_r.3c 0444 root bin
+f usr/share/man/man3c/getmntany.3c 0444 root bin
+f usr/share/man/man3c/getmntent.3c 0444 root bin
+f usr/share/man/man3c/getnetgrent.3c 0444 root bin
+f usr/share/man/man3c/getnetgrent_r.3c 0444 root bin
+f usr/share/man/man3c/getopt.3c 0444 root bin
+f usr/share/man/man3c/getpagesize.3c 0444 root bin
+f usr/share/man/man3c/getpagesizes.3c 0444 root bin
+f usr/share/man/man3c/getpass.3c 0444 root bin
+f usr/share/man/man3c/getpassphrase.3c 0444 root bin
+f usr/share/man/man3c/getpeerucred.3c 0444 root bin
+f usr/share/man/man3c/getpriority.3c 0444 root bin
+f usr/share/man/man3c/getpw.3c 0444 root bin
+f usr/share/man/man3c/getpwent.3c 0444 root bin
+f usr/share/man/man3c/getpwent_r.3c 0444 root bin
+f usr/share/man/man3c/getpwnam.3c 0444 root bin
+f usr/share/man/man3c/getpwnam_r.3c 0444 root bin
+f usr/share/man/man3c/getpwuid.3c 0444 root bin
+f usr/share/man/man3c/getpwuid_r.3c 0444 root bin
+f usr/share/man/man3c/getrusage.3c 0444 root bin
+f usr/share/man/man3c/gets.3c 0444 root bin
+f usr/share/man/man3c/getspent.3c 0444 root bin
+f usr/share/man/man3c/getspent_r.3c 0444 root bin
+f usr/share/man/man3c/getspnam.3c 0444 root bin
+f usr/share/man/man3c/getspnam_r.3c 0444 root bin
+f usr/share/man/man3c/getsubopt.3c 0444 root bin
+f usr/share/man/man3c/gettext.3c 0444 root bin
+f usr/share/man/man3c/gettimeofday.3c 0444 root bin
+f usr/share/man/man3c/gettxt.3c 0444 root bin
+f usr/share/man/man3c/getusershell.3c 0444 root bin
+f usr/share/man/man3c/getutent.3c 0444 root bin
+f usr/share/man/man3c/getutid.3c 0444 root bin
+f usr/share/man/man3c/getutline.3c 0444 root bin
+f usr/share/man/man3c/getutmp.3c 0444 root bin
+f usr/share/man/man3c/getutmpx.3c 0444 root bin
+f usr/share/man/man3c/getutxent.3c 0444 root bin
+f usr/share/man/man3c/getutxid.3c 0444 root bin
+f usr/share/man/man3c/getutxline.3c 0444 root bin
+f usr/share/man/man3c/getvfsany.3c 0444 root bin
+f usr/share/man/man3c/getvfsent.3c 0444 root bin
+f usr/share/man/man3c/getvfsfile.3c 0444 root bin
+f usr/share/man/man3c/getvfsspec.3c 0444 root bin
+f usr/share/man/man3c/getw.3c 0444 root bin
+f usr/share/man/man3c/getwc.3c 0444 root bin
+f usr/share/man/man3c/getwchar.3c 0444 root bin
+f usr/share/man/man3c/getwd.3c 0444 root bin
+f usr/share/man/man3c/getwidth.3c 0444 root bin
+f usr/share/man/man3c/getws.3c 0444 root bin
+f usr/share/man/man3c/getzoneid.3c 0444 root bin
+f usr/share/man/man3c/getzoneidbyname.3c 0444 root bin
+f usr/share/man/man3c/getzonenamebyid.3c 0444 root bin
+f usr/share/man/man3c/glob.3c 0444 root bin
+f usr/share/man/man3c/globfree.3c 0444 root bin
+f usr/share/man/man3c/gmtime.3c 0444 root bin
+f usr/share/man/man3c/gmtime_r.3c 0444 root bin
+f usr/share/man/man3c/grantpt.3c 0444 root bin
+f usr/share/man/man3c/gsignal.3c 0444 root bin
+f usr/share/man/man3c/hasmntopt.3c 0444 root bin
+f usr/share/man/man3c/hcreate.3c 0444 root bin
+f usr/share/man/man3c/hdestroy.3c 0444 root bin
+f usr/share/man/man3c/hsearch.3c 0444 root bin
+f usr/share/man/man3c/iconv.3c 0444 root bin
+f usr/share/man/man3c/iconv_close.3c 0444 root bin
+f usr/share/man/man3c/iconv_open.3c 0444 root bin
+f usr/share/man/man3c/imaxabs.3c 0444 root bin
+f usr/share/man/man3c/imaxdiv.3c 0444 root bin
+f usr/share/man/man3c/index.3c 0444 root bin
+f usr/share/man/man3c/initgroups.3c 0444 root bin
+f usr/share/man/man3c/initstate.3c 0444 root bin
+f usr/share/man/man3c/innetgr.3c 0444 root bin
+f usr/share/man/man3c/insque.3c 0444 root bin
+f usr/share/man/man3c/is_system_labeled.3c 0444 root bin
+f usr/share/man/man3c/isaexec.3c 0444 root bin
+f usr/share/man/man3c/isalnum.3c 0444 root bin
+f usr/share/man/man3c/isalpha.3c 0444 root bin
+f usr/share/man/man3c/isascii.3c 0444 root bin
+f usr/share/man/man3c/isastream.3c 0444 root bin
+f usr/share/man/man3c/isatty.3c 0444 root bin
+f usr/share/man/man3c/isblank.3c 0444 root bin
+f usr/share/man/man3c/iscntrl.3c 0444 root bin
+f usr/share/man/man3c/isdigit.3c 0444 root bin
+f usr/share/man/man3c/isenglish.3c 0444 root bin
+f usr/share/man/man3c/isgraph.3c 0444 root bin
+f usr/share/man/man3c/isideogram.3c 0444 root bin
+f usr/share/man/man3c/islower.3c 0444 root bin
+f usr/share/man/man3c/isnand.3c 0444 root bin
+f usr/share/man/man3c/isnanf.3c 0444 root bin
+f usr/share/man/man3c/isnumber.3c 0444 root bin
+f usr/share/man/man3c/isphonogram.3c 0444 root bin
+f usr/share/man/man3c/isprint.3c 0444 root bin
+f usr/share/man/man3c/ispunct.3c 0444 root bin
+f usr/share/man/man3c/isspace.3c 0444 root bin
+f usr/share/man/man3c/isspecial.3c 0444 root bin
+f usr/share/man/man3c/isupper.3c 0444 root bin
+f usr/share/man/man3c/iswalnum.3c 0444 root bin
+f usr/share/man/man3c/iswalpha.3c 0444 root bin
+f usr/share/man/man3c/iswascii.3c 0444 root bin
+f usr/share/man/man3c/iswblank.3c 0444 root bin
+f usr/share/man/man3c/iswcntrl.3c 0444 root bin
+f usr/share/man/man3c/iswctype.3c 0444 root bin
+f usr/share/man/man3c/iswdigit.3c 0444 root bin
+f usr/share/man/man3c/iswgraph.3c 0444 root bin
+f usr/share/man/man3c/iswlower.3c 0444 root bin
+f usr/share/man/man3c/iswprint.3c 0444 root bin
+f usr/share/man/man3c/iswpunct.3c 0444 root bin
+f usr/share/man/man3c/iswspace.3c 0444 root bin
+f usr/share/man/man3c/iswupper.3c 0444 root bin
+f usr/share/man/man3c/iswxdigit.3c 0444 root bin
+f usr/share/man/man3c/isxdigit.3c 0444 root bin
+f usr/share/man/man3c/jrand48.3c 0444 root bin
+f usr/share/man/man3c/killpg.3c 0444 root bin
+f usr/share/man/man3c/l64a.3c 0444 root bin
+f usr/share/man/man3c/labs.3c 0444 root bin
+f usr/share/man/man3c/lckpwdf.3c 0444 root bin
+f usr/share/man/man3c/lcong48.3c 0444 root bin
+f usr/share/man/man3c/ldiv.3c 0444 root bin
+f usr/share/man/man3c/lfind.3c 0444 root bin
+f usr/share/man/man3c/lfmt.3c 0444 root bin
+f usr/share/man/man3c/lio_listio.3c 0444 root bin
+f usr/share/man/man3c/llabs.3c 0444 root bin
+f usr/share/man/man3c/lldiv.3c 0444 root bin
+f usr/share/man/man3c/lltostr.3c 0444 root bin
+f usr/share/man/man3c/localeconv.3c 0444 root bin
+f usr/share/man/man3c/localtime.3c 0444 root bin
+f usr/share/man/man3c/localtime_r.3c 0444 root bin
+f usr/share/man/man3c/lockf.3c 0444 root bin
+f usr/share/man/man3c/longjmp.3c 0444 root bin
+f usr/share/man/man3c/lrand48.3c 0444 root bin
+f usr/share/man/man3c/lsearch.3c 0444 root bin
+f usr/share/man/man3c/madvise.3c 0444 root bin
+f usr/share/man/man3c/major.3c 0444 root bin
+f usr/share/man/man3c/makecontext.3c 0444 root bin
+f usr/share/man/man3c/makedev.3c 0444 root bin
+f usr/share/man/man3c/malloc.3c 0444 root bin
+f usr/share/man/man3c/mblen.3c 0444 root bin
+f usr/share/man/man3c/mbrlen.3c 0444 root bin
+f usr/share/man/man3c/mbrtowc.3c 0444 root bin
+f usr/share/man/man3c/mbsinit.3c 0444 root bin
+f usr/share/man/man3c/mbsrtowcs.3c 0444 root bin
+f usr/share/man/man3c/mbtowc.3c 0444 root bin
+f usr/share/man/man3c/memalign.3c 0444 root bin
+f usr/share/man/man3c/membar_consumer.3c 0444 root bin
+f usr/share/man/man3c/membar_enter.3c 0444 root bin
+f usr/share/man/man3c/membar_exit.3c 0444 root bin
+f usr/share/man/man3c/membar_ops.3c 0444 root bin
+f usr/share/man/man3c/membar_producer.3c 0444 root bin
+f usr/share/man/man3c/memccpy.3c 0444 root bin
+f usr/share/man/man3c/memchr.3c 0444 root bin
+f usr/share/man/man3c/memcmp.3c 0444 root bin
+f usr/share/man/man3c/memcpy.3c 0444 root bin
+f usr/share/man/man3c/memmove.3c 0444 root bin
+f usr/share/man/man3c/memory.3c 0444 root bin
+f usr/share/man/man3c/memset.3c 0444 root bin
+f usr/share/man/man3c/minor.3c 0444 root bin
+f usr/share/man/man3c/mkdtemp.3c 0444 root bin
+f usr/share/man/man3c/mkfifo.3c 0444 root bin
+f usr/share/man/man3c/mkstemp.3c 0444 root bin
+f usr/share/man/man3c/mkstemps.3c 0444 root bin
+f usr/share/man/man3c/mktemp.3c 0444 root bin
+f usr/share/man/man3c/mktime.3c 0444 root bin
+f usr/share/man/man3c/mlock.3c 0444 root bin
+f usr/share/man/man3c/mlockall.3c 0444 root bin
+f usr/share/man/man3c/monitor.3c 0444 root bin
+f usr/share/man/man3c/mq_close.3c 0444 root bin
+f usr/share/man/man3c/mq_getattr.3c 0444 root bin
+f usr/share/man/man3c/mq_notify.3c 0444 root bin
+f usr/share/man/man3c/mq_open.3c 0444 root bin
+f usr/share/man/man3c/mq_receive.3c 0444 root bin
+f usr/share/man/man3c/mq_reltimedreceive_np.3c 0444 root bin
+f usr/share/man/man3c/mq_reltimedsend_np.3c 0444 root bin
+f usr/share/man/man3c/mq_send.3c 0444 root bin
+f usr/share/man/man3c/mq_setattr.3c 0444 root bin
+f usr/share/man/man3c/mq_timedreceive.3c 0444 root bin
+f usr/share/man/man3c/mq_timedsend.3c 0444 root bin
+f usr/share/man/man3c/mq_unlink.3c 0444 root bin
+f usr/share/man/man3c/mrand48.3c 0444 root bin
+f usr/share/man/man3c/msync.3c 0444 root bin
+f usr/share/man/man3c/munlock.3c 0444 root bin
+f usr/share/man/man3c/munlockall.3c 0444 root bin
+f usr/share/man/man3c/mutex_consistent.3c 0444 root bin
+f usr/share/man/man3c/mutex_destroy.3c 0444 root bin
+f usr/share/man/man3c/mutex_init.3c 0444 root bin
+f usr/share/man/man3c/mutex_lock.3c 0444 root bin
+f usr/share/man/man3c/mutex_trylock.3c 0444 root bin
+f usr/share/man/man3c/mutex_unlock.3c 0444 root bin
+f usr/share/man/man3c/nanosleep.3c 0444 root bin
+f usr/share/man/man3c/ndbm.3c 0444 root bin
+f usr/share/man/man3c/nftw.3c 0444 root bin
+f usr/share/man/man3c/ngettext.3c 0444 root bin
+f usr/share/man/man3c/nl_langinfo.3c 0444 root bin
+f usr/share/man/man3c/nrand48.3c 0444 root bin
+f usr/share/man/man3c/offsetof.3c 0444 root bin
+f usr/share/man/man3c/opendir.3c 0444 root bin
+f usr/share/man/man3c/openlog.3c 0444 root bin
+f usr/share/man/man3c/pclose.3c 0444 root bin
+f usr/share/man/man3c/perror.3c 0444 root bin
+f usr/share/man/man3c/pfmt.3c 0444 root bin
+f usr/share/man/man3c/plock.3c 0444 root bin
+f usr/share/man/man3c/popen.3c 0444 root bin
+f usr/share/man/man3c/port_alert.3c 0444 root bin
+f usr/share/man/man3c/port_associate.3c 0444 root bin
+f usr/share/man/man3c/port_create.3c 0444 root bin
+f usr/share/man/man3c/port_dissociate.3c 0444 root bin
+f usr/share/man/man3c/port_get.3c 0444 root bin
+f usr/share/man/man3c/port_getn.3c 0444 root bin
+f usr/share/man/man3c/port_send.3c 0444 root bin
+f usr/share/man/man3c/port_sendn.3c 0444 root bin
+f usr/share/man/man3c/posix_fadvise.3c 0444 root bin
+f usr/share/man/man3c/posix_fallocate.3c 0444 root bin
+f usr/share/man/man3c/posix_madvise.3c 0444 root bin
+f usr/share/man/man3c/posix_memalign.3c 0444 root bin
+f usr/share/man/man3c/posix_openpt.3c 0444 root bin
+f usr/share/man/man3c/posix_spawn.3c 0444 root bin
+f usr/share/man/man3c/posix_spawn_file_actions_addclose.3c 0444 root bin
+f usr/share/man/man3c/posix_spawn_file_actions_addclosefrom_np.3c 0444 root bin
+f usr/share/man/man3c/posix_spawn_file_actions_adddup2.3c 0444 root bin
+f usr/share/man/man3c/posix_spawn_file_actions_addopen.3c 0444 root bin
+f usr/share/man/man3c/posix_spawn_file_actions_destroy.3c 0444 root bin
+f usr/share/man/man3c/posix_spawn_file_actions_init.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_destroy.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_getflags.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_getpgroup.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_getschedparam.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_getschedpolicy.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_getsigdefault.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_getsigignore_np.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_getsigmask.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_init.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_setflags.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_setpgroup.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_setschedparam.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_setschedpolicy.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_setsigdefault.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_setsigignore_np.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnattr_setsigmask.3c 0444 root bin
+f usr/share/man/man3c/posix_spawnp.3c 0444 root bin
+f usr/share/man/man3c/printf.3c 0444 root bin
+f usr/share/man/man3c/printstack.3c 0444 root bin
+f usr/share/man/man3c/priv_addset.3c 0444 root bin
+f usr/share/man/man3c/priv_allocset.3c 0444 root bin
+f usr/share/man/man3c/priv_basicset.3c 0444 root bin
+f usr/share/man/man3c/priv_copyset.3c 0444 root bin
+f usr/share/man/man3c/priv_delset.3c 0444 root bin
+f usr/share/man/man3c/priv_emptyset.3c 0444 root bin
+f usr/share/man/man3c/priv_fillset.3c 0444 root bin
+f usr/share/man/man3c/priv_freeset.3c 0444 root bin
+f usr/share/man/man3c/priv_getbyname.3c 0444 root bin
+f usr/share/man/man3c/priv_getbynum.3c 0444 root bin
+f usr/share/man/man3c/priv_getsetbyname.3c 0444 root bin
+f usr/share/man/man3c/priv_getsetbynum.3c 0444 root bin
+f usr/share/man/man3c/priv_gettext.3c 0444 root bin
+f usr/share/man/man3c/priv_ineffect.3c 0444 root bin
+f usr/share/man/man3c/priv_intersect.3c 0444 root bin
+f usr/share/man/man3c/priv_inverse.3c 0444 root bin
+f usr/share/man/man3c/priv_isemptyset.3c 0444 root bin
+f usr/share/man/man3c/priv_isequalset.3c 0444 root bin
+f usr/share/man/man3c/priv_isfullset.3c 0444 root bin
+f usr/share/man/man3c/priv_ismember.3c 0444 root bin
+f usr/share/man/man3c/priv_issubset.3c 0444 root bin
+f usr/share/man/man3c/priv_set.3c 0444 root bin
+f usr/share/man/man3c/priv_set_to_str.3c 0444 root bin
+f usr/share/man/man3c/priv_str_to_set.3c 0444 root bin
+f usr/share/man/man3c/priv_union.3c 0444 root bin
+f usr/share/man/man3c/pselect.3c 0444 root bin
+f usr/share/man/man3c/pset_getloadavg.3c 0444 root bin
+f usr/share/man/man3c/psiginfo.3c 0444 root bin
+f usr/share/man/man3c/psignal.3c 0444 root bin
+f usr/share/man/man3c/pthread_atfork.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getdetachstate.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getguardsize.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getinheritsched.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getschedparam.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getschedpolicy.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getscope.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getstack.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getstackaddr.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_getstacksize.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setdetachstate.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setguardsize.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setinheritsched.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setschedparam.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setschedpolicy.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setscope.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setstack.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setstackaddr.3c 0444 root bin
+f usr/share/man/man3c/pthread_attr_setstacksize.3c 0444 root bin
+f usr/share/man/man3c/pthread_barrier_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_barrier_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_barrier_wait.3c 0444 root bin
+f usr/share/man/man3c/pthread_barrierattr_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_barrierattr_getpshared.3c 0444 root bin
+f usr/share/man/man3c/pthread_barrierattr_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_barrierattr_setpshared.3c 0444 root bin
+f usr/share/man/man3c/pthread_cancel.3c 0444 root bin
+f usr/share/man/man3c/pthread_cleanup_pop.3c 0444 root bin
+f usr/share/man/man3c/pthread_cleanup_push.3c 0444 root bin
+f usr/share/man/man3c/pthread_cond_broadcast.3c 0444 root bin
+f usr/share/man/man3c/pthread_cond_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_cond_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_cond_reltimedwait_np.3c 0444 root bin
+f usr/share/man/man3c/pthread_cond_signal.3c 0444 root bin
+f usr/share/man/man3c/pthread_cond_timedwait.3c 0444 root bin
+f usr/share/man/man3c/pthread_cond_wait.3c 0444 root bin
+f usr/share/man/man3c/pthread_condattr_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_condattr_getclock.3c 0444 root bin
+f usr/share/man/man3c/pthread_condattr_getpshared.3c 0444 root bin
+f usr/share/man/man3c/pthread_condattr_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_condattr_setclock.3c 0444 root bin
+f usr/share/man/man3c/pthread_condattr_setpshared.3c 0444 root bin
+f usr/share/man/man3c/pthread_create.3c 0444 root bin
+f usr/share/man/man3c/pthread_detach.3c 0444 root bin
+f usr/share/man/man3c/pthread_equal.3c 0444 root bin
+f usr/share/man/man3c/pthread_exit.3c 0444 root bin
+f usr/share/man/man3c/pthread_getconcurrency.3c 0444 root bin
+f usr/share/man/man3c/pthread_getschedparam.3c 0444 root bin
+f usr/share/man/man3c/pthread_getspecific.3c 0444 root bin
+f usr/share/man/man3c/pthread_join.3c 0444 root bin
+f usr/share/man/man3c/pthread_key_create.3c 0444 root bin
+f usr/share/man/man3c/pthread_key_create_once_np.3c 0444 root bin
+f usr/share/man/man3c/pthread_key_delete.3c 0444 root bin
+f usr/share/man/man3c/pthread_kill.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_getprioceiling.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_lock.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_reltimedlock_np.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_setprioceiling.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_timedlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_trylock.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutex_unlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_getprioceiling.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_getprotocol.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_getpshared.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_gettype.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_setprioceiling.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_setprotocol.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_setpshared.3c 0444 root bin
+f usr/share/man/man3c/pthread_mutexattr_settype.3c 0444 root bin
+f usr/share/man/man3c/pthread_once.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_rdlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_reltimedrdlock_np.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_reltimedwrlock_np.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_timedrdlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_timedwrlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_tryrdlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_trywrlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_unlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlock_wrlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlockattr_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlockattr_getpshared.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlockattr_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_rwlockattr_setpshared.3c 0444 root bin
+f usr/share/man/man3c/pthread_self.3c 0444 root bin
+f usr/share/man/man3c/pthread_setcancelstate.3c 0444 root bin
+f usr/share/man/man3c/pthread_setcanceltype.3c 0444 root bin
+f usr/share/man/man3c/pthread_setconcurrency.3c 0444 root bin
+f usr/share/man/man3c/pthread_setschedparam.3c 0444 root bin
+f usr/share/man/man3c/pthread_setschedprio.3c 0444 root bin
+f usr/share/man/man3c/pthread_setspecific.3c 0444 root bin
+f usr/share/man/man3c/pthread_sigmask.3c 0444 root bin
+f usr/share/man/man3c/pthread_spin_destroy.3c 0444 root bin
+f usr/share/man/man3c/pthread_spin_init.3c 0444 root bin
+f usr/share/man/man3c/pthread_spin_lock.3c 0444 root bin
+f usr/share/man/man3c/pthread_spin_trylock.3c 0444 root bin
+f usr/share/man/man3c/pthread_spin_unlock.3c 0444 root bin
+f usr/share/man/man3c/pthread_testcancel.3c 0444 root bin
+f usr/share/man/man3c/ptrace.3c 0444 root bin
+f usr/share/man/man3c/ptsname.3c 0444 root bin
+f usr/share/man/man3c/putc.3c 0444 root bin
+f usr/share/man/man3c/putc_unlocked.3c 0444 root bin
+f usr/share/man/man3c/putchar.3c 0444 root bin
+f usr/share/man/man3c/putchar_unlocked.3c 0444 root bin
+f usr/share/man/man3c/putenv.3c 0444 root bin
+f usr/share/man/man3c/putmntent.3c 0444 root bin
+f usr/share/man/man3c/putpwent.3c 0444 root bin
+f usr/share/man/man3c/puts.3c 0444 root bin
+f usr/share/man/man3c/putspent.3c 0444 root bin
+f usr/share/man/man3c/pututline.3c 0444 root bin
+f usr/share/man/man3c/pututxline.3c 0444 root bin
+f usr/share/man/man3c/putw.3c 0444 root bin
+f usr/share/man/man3c/putwc.3c 0444 root bin
+f usr/share/man/man3c/putwchar.3c 0444 root bin
+f usr/share/man/man3c/putws.3c 0444 root bin
+f usr/share/man/man3c/qeconvert.3c 0444 root bin
+f usr/share/man/man3c/qfconvert.3c 0444 root bin
+f usr/share/man/man3c/qgconvert.3c 0444 root bin
+f usr/share/man/man3c/qsort.3c 0444 root bin
+f usr/share/man/man3c/quadruple_to_decimal.3c 0444 root bin
+f usr/share/man/man3c/raise.3c 0444 root bin
+f usr/share/man/man3c/rand.3c 0444 root bin
+f usr/share/man/man3c/rand_r.3c 0444 root bin
+f usr/share/man/man3c/random.3c 0444 root bin
+f usr/share/man/man3c/rctl_walk.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_enforced_value.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_firing_time.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_global_action.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_global_flags.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_local_action.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_local_flags.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_privilege.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_recipient_pid.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_get_value.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_set_local_action.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_set_local_flags.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_set_privilege.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_set_recipient_pid.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_set_value.3c 0444 root bin
+f usr/share/man/man3c/rctlblk_size.3c 0444 root bin
+f usr/share/man/man3c/re_comp.3c 0444 root bin
+f usr/share/man/man3c/re_exec.3c 0444 root bin
+f usr/share/man/man3c/readdir.3c 0444 root bin
+f usr/share/man/man3c/readdir_r.3c 0444 root bin
+f usr/share/man/man3c/realloc.3c 0444 root bin
+f usr/share/man/man3c/realpath.3c 0444 root bin
+f usr/share/man/man3c/reboot.3c 0444 root bin
+f usr/share/man/man3c/regcmp.3c 0444 root bin
+f usr/share/man/man3c/regcomp.3c 0444 root bin
+f usr/share/man/man3c/regerror.3c 0444 root bin
+f usr/share/man/man3c/regex.3c 0444 root bin
+f usr/share/man/man3c/regexec.3c 0444 root bin
+f usr/share/man/man3c/regfree.3c 0444 root bin
+f usr/share/man/man3c/remove.3c 0444 root bin
+f usr/share/man/man3c/remque.3c 0444 root bin
+f usr/share/man/man3c/resetmnttab.3c 0444 root bin
+f usr/share/man/man3c/rewind.3c 0444 root bin
+f usr/share/man/man3c/rewinddir.3c 0444 root bin
+f usr/share/man/man3c/rindex.3c 0444 root bin
+f usr/share/man/man3c/rw_rdlock.3c 0444 root bin
+f usr/share/man/man3c/rw_tryrdlock.3c 0444 root bin
+f usr/share/man/man3c/rw_trywrlock.3c 0444 root bin
+f usr/share/man/man3c/rw_unlock.3c 0444 root bin
+f usr/share/man/man3c/rw_wrlock.3c 0444 root bin
+f usr/share/man/man3c/rwlock.3c 0444 root bin
+f usr/share/man/man3c/rwlock_destroy.3c 0444 root bin
+f usr/share/man/man3c/rwlock_init.3c 0444 root bin
+f usr/share/man/man3c/scandir.3c 0444 root bin
+f usr/share/man/man3c/scanf.3c 0444 root bin
+f usr/share/man/man3c/sched_get_priority_max.3c 0444 root bin
+f usr/share/man/man3c/sched_get_priority_min.3c 0444 root bin
+f usr/share/man/man3c/sched_getparam.3c 0444 root bin
+f usr/share/man/man3c/sched_getscheduler.3c 0444 root bin
+f usr/share/man/man3c/sched_rr_get_interval.3c 0444 root bin
+f usr/share/man/man3c/sched_setparam.3c 0444 root bin
+f usr/share/man/man3c/sched_setscheduler.3c 0444 root bin
+f usr/share/man/man3c/sched_yield.3c 0444 root bin
+f usr/share/man/man3c/schedctl_exit.3c 0444 root bin
+f usr/share/man/man3c/schedctl_init.3c 0444 root bin
+f usr/share/man/man3c/schedctl_lookup.3c 0444 root bin
+f usr/share/man/man3c/schedctl_start.3c 0444 root bin
+f usr/share/man/man3c/schedctl_stop.3c 0444 root bin
+f usr/share/man/man3c/seconvert.3c 0444 root bin
+f usr/share/man/man3c/seed48.3c 0444 root bin
+f usr/share/man/man3c/seekdir.3c 0444 root bin
+f usr/share/man/man3c/select.3c 0444 root bin
+f usr/share/man/man3c/sem_close.3c 0444 root bin
+f usr/share/man/man3c/sem_destroy.3c 0444 root bin
+f usr/share/man/man3c/sem_getvalue.3c 0444 root bin
+f usr/share/man/man3c/sem_init.3c 0444 root bin
+f usr/share/man/man3c/sem_open.3c 0444 root bin
+f usr/share/man/man3c/sem_post.3c 0444 root bin
+f usr/share/man/man3c/sem_reltimedwait_np.3c 0444 root bin
+f usr/share/man/man3c/sem_timedwait.3c 0444 root bin
+f usr/share/man/man3c/sem_trywait.3c 0444 root bin
+f usr/share/man/man3c/sem_unlink.3c 0444 root bin
+f usr/share/man/man3c/sem_wait.3c 0444 root bin
+f usr/share/man/man3c/sema_destroy.3c 0444 root bin
+f usr/share/man/man3c/sema_init.3c 0444 root bin
+f usr/share/man/man3c/sema_post.3c 0444 root bin
+f usr/share/man/man3c/sema_trywait.3c 0444 root bin
+f usr/share/man/man3c/sema_wait.3c 0444 root bin
+f usr/share/man/man3c/semaphore.3c 0444 root bin
+f usr/share/man/man3c/setattrat.3c 0444 root bin
+f usr/share/man/man3c/setbuf.3c 0444 root bin
+f usr/share/man/man3c/setbuffer.3c 0444 root bin
+f usr/share/man/man3c/setcat.3c 0444 root bin
+f usr/share/man/man3c/setenv.3c 0444 root bin
+f usr/share/man/man3c/setgrent.3c 0444 root bin
+f usr/share/man/man3c/sethostname.3c 0444 root bin
+f usr/share/man/man3c/setjmp.3c 0444 root bin
+f usr/share/man/man3c/setkey.3c 0444 root bin
+f usr/share/man/man3c/setlabel.3c 0444 root bin
+f usr/share/man/man3c/setlinebuf.3c 0444 root bin
+f usr/share/man/man3c/setlocale.3c 0444 root bin
+f usr/share/man/man3c/setlogmask.3c 0444 root bin
+f usr/share/man/man3c/setnetgrent.3c 0444 root bin
+f usr/share/man/man3c/setpriority.3c 0444 root bin
+f usr/share/man/man3c/setpwent.3c 0444 root bin
+f usr/share/man/man3c/setspent.3c 0444 root bin
+f usr/share/man/man3c/setstate.3c 0444 root bin
+f usr/share/man/man3c/settimeofday.3c 0444 root bin
+f usr/share/man/man3c/setusershell.3c 0444 root bin
+f usr/share/man/man3c/setutent.3c 0444 root bin
+f usr/share/man/man3c/setutxent.3c 0444 root bin
+f usr/share/man/man3c/setvbuf.3c 0444 root bin
+f usr/share/man/man3c/sfconvert.3c 0444 root bin
+f usr/share/man/man3c/sgconvert.3c 0444 root bin
+f usr/share/man/man3c/shm_open.3c 0444 root bin
+f usr/share/man/man3c/shm_unlink.3c 0444 root bin
+f usr/share/man/man3c/sig2str.3c 0444 root bin
+f usr/share/man/man3c/sigaddset.3c 0444 root bin
+f usr/share/man/man3c/sigdelset.3c 0444 root bin
+f usr/share/man/man3c/sigemptyset.3c 0444 root bin
+f usr/share/man/man3c/sigfillset.3c 0444 root bin
+f usr/share/man/man3c/sigfpe.3c 0444 root bin
+f usr/share/man/man3c/sighold.3c 0444 root bin
+f usr/share/man/man3c/sigignore.3c 0444 root bin
+f usr/share/man/man3c/siginterrupt.3c 0444 root bin
+f usr/share/man/man3c/sigismember.3c 0444 root bin
+f usr/share/man/man3c/siglongjmp.3c 0444 root bin
+f usr/share/man/man3c/signal.3c 0444 root bin
+f usr/share/man/man3c/sigpause.3c 0444 root bin
+f usr/share/man/man3c/sigqueue.3c 0444 root bin
+f usr/share/man/man3c/sigrelse.3c 0444 root bin
+f usr/share/man/man3c/sigset.3c 0444 root bin
+f usr/share/man/man3c/sigsetjmp.3c 0444 root bin
+f usr/share/man/man3c/sigsetops.3c 0444 root bin
+f usr/share/man/man3c/sigstack.3c 0444 root bin
+f usr/share/man/man3c/sigtimedwait.3c 0444 root bin
+f usr/share/man/man3c/sigwaitinfo.3c 0444 root bin
+f usr/share/man/man3c/single_to_decimal.3c 0444 root bin
+f usr/share/man/man3c/sleep.3c 0444 root bin
+f usr/share/man/man3c/snprintf.3c 0444 root bin
+f usr/share/man/man3c/sprintf.3c 0444 root bin
+f usr/share/man/man3c/srand.3c 0444 root bin
+f usr/share/man/man3c/srand48.3c 0444 root bin
+f usr/share/man/man3c/srandom.3c 0444 root bin
+f usr/share/man/man3c/sscanf.3c 0444 root bin
+f usr/share/man/man3c/ssignal.3c 0444 root bin
+f usr/share/man/man3c/stack_getbounds.3c 0444 root bin
+f usr/share/man/man3c/stack_inbounds.3c 0444 root bin
+f usr/share/man/man3c/stack_setbounds.3c 0444 root bin
+f usr/share/man/man3c/stack_violation.3c 0444 root bin
+f usr/share/man/man3c/stdio.3c 0444 root bin
+f usr/share/man/man3c/str2sig.3c 0444 root bin
+f usr/share/man/man3c/strcasecmp.3c 0444 root bin
+f usr/share/man/man3c/strcat.3c 0444 root bin
+f usr/share/man/man3c/strchr.3c 0444 root bin
+f usr/share/man/man3c/strcmp.3c 0444 root bin
+f usr/share/man/man3c/strcoll.3c 0444 root bin
+f usr/share/man/man3c/strcpy.3c 0444 root bin
+f usr/share/man/man3c/strcspn.3c 0444 root bin
+f usr/share/man/man3c/strdup.3c 0444 root bin
+f usr/share/man/man3c/strerror.3c 0444 root bin
+f usr/share/man/man3c/strerror_r.3c 0444 root bin
+f usr/share/man/man3c/strftime.3c 0444 root bin
+f usr/share/man/man3c/string.3c 0444 root bin
+f usr/share/man/man3c/string_to_decimal.3c 0444 root bin
+f usr/share/man/man3c/strlcat.3c 0444 root bin
+f usr/share/man/man3c/strlcpy.3c 0444 root bin
+f usr/share/man/man3c/strlen.3c 0444 root bin
+f usr/share/man/man3c/strncasecmp.3c 0444 root bin
+f usr/share/man/man3c/strncat.3c 0444 root bin
+f usr/share/man/man3c/strncmp.3c 0444 root bin
+f usr/share/man/man3c/strncpy.3c 0444 root bin
+f usr/share/man/man3c/strnlen.3c 0444 root bin
+f usr/share/man/man3c/strpbrk.3c 0444 root bin
+f usr/share/man/man3c/strptime.3c 0444 root bin
+f usr/share/man/man3c/strrchr.3c 0444 root bin
+f usr/share/man/man3c/strsep.3c 0444 root bin
+f usr/share/man/man3c/strsignal.3c 0444 root bin
+f usr/share/man/man3c/strspn.3c 0444 root bin
+f usr/share/man/man3c/strstr.3c 0444 root bin
+f usr/share/man/man3c/strtod.3c 0444 root bin
+f usr/share/man/man3c/strtof.3c 0444 root bin
+f usr/share/man/man3c/strtoimax.3c 0444 root bin
+f usr/share/man/man3c/strtok.3c 0444 root bin
+f usr/share/man/man3c/strtok_r.3c 0444 root bin
+f usr/share/man/man3c/strtol.3c 0444 root bin
+f usr/share/man/man3c/strtold.3c 0444 root bin
+f usr/share/man/man3c/strtoll.3c 0444 root bin
+f usr/share/man/man3c/strtoul.3c 0444 root bin
+f usr/share/man/man3c/strtoull.3c 0444 root bin
+f usr/share/man/man3c/strtoumax.3c 0444 root bin
+f usr/share/man/man3c/strtows.3c 0444 root bin
+f usr/share/man/man3c/strxfrm.3c 0444 root bin
+f usr/share/man/man3c/swab.3c 0444 root bin
+f usr/share/man/man3c/swapcontext.3c 0444 root bin
+f usr/share/man/man3c/swprintf.3c 0444 root bin
+f usr/share/man/man3c/swscanf.3c 0444 root bin
+f usr/share/man/man3c/sync_instruction_memory.3c 0444 root bin
+f usr/share/man/man3c/sysconf.3c 0444 root bin
+f usr/share/man/man3c/syslog.3c 0444 root bin
+f usr/share/man/man3c/system.3c 0444 root bin
+f usr/share/man/man3c/tcdrain.3c 0444 root bin
+f usr/share/man/man3c/tcflow.3c 0444 root bin
+f usr/share/man/man3c/tcflush.3c 0444 root bin
+f usr/share/man/man3c/tcgetattr.3c 0444 root bin
+f usr/share/man/man3c/tcgetpgrp.3c 0444 root bin
+f usr/share/man/man3c/tcgetsid.3c 0444 root bin
+f usr/share/man/man3c/tcsendbreak.3c 0444 root bin
+f usr/share/man/man3c/tcsetattr.3c 0444 root bin
+f usr/share/man/man3c/tcsetpgrp.3c 0444 root bin
+f usr/share/man/man3c/tdelete.3c 0444 root bin
+f usr/share/man/man3c/tell.3c 0444 root bin
+f usr/share/man/man3c/telldir.3c 0444 root bin
+f usr/share/man/man3c/tempnam.3c 0444 root bin
+f usr/share/man/man3c/termios.3c 0444 root bin
+f usr/share/man/man3c/textdomain.3c 0444 root bin
+f usr/share/man/man3c/tfind.3c 0444 root bin
+f usr/share/man/man3c/thr_continue.3c 0444 root bin
+f usr/share/man/man3c/thr_create.3c 0444 root bin
+f usr/share/man/man3c/thr_exit.3c 0444 root bin
+f usr/share/man/man3c/thr_getconcurrency.3c 0444 root bin
+f usr/share/man/man3c/thr_getprio.3c 0444 root bin
+f usr/share/man/man3c/thr_getspecific.3c 0444 root bin
+f usr/share/man/man3c/thr_join.3c 0444 root bin
+f usr/share/man/man3c/thr_keycreate.3c 0444 root bin
+f usr/share/man/man3c/thr_keycreate_once.3c 0444 root bin
+f usr/share/man/man3c/thr_kill.3c 0444 root bin
+f usr/share/man/man3c/thr_main.3c 0444 root bin
+f usr/share/man/man3c/thr_min_stack.3c 0444 root bin
+f usr/share/man/man3c/thr_self.3c 0444 root bin
+f usr/share/man/man3c/thr_setconcurrency.3c 0444 root bin
+f usr/share/man/man3c/thr_setprio.3c 0444 root bin
+f usr/share/man/man3c/thr_setspecific.3c 0444 root bin
+f usr/share/man/man3c/thr_sigsetmask.3c 0444 root bin
+f usr/share/man/man3c/thr_stksegment.3c 0444 root bin
+f usr/share/man/man3c/thr_suspend.3c 0444 root bin
+f usr/share/man/man3c/thr_yield.3c 0444 root bin
+f usr/share/man/man3c/timer_create.3c 0444 root bin
+f usr/share/man/man3c/timer_delete.3c 0444 root bin
+f usr/share/man/man3c/timer_getoverrun.3c 0444 root bin
+f usr/share/man/man3c/timer_gettime.3c 0444 root bin
+f usr/share/man/man3c/timer_settime.3c 0444 root bin
+f usr/share/man/man3c/timeradd.3c 0444 root bin
+f usr/share/man/man3c/timerclear.3c 0444 root bin
+f usr/share/man/man3c/timercmp.3c 0444 root bin
+f usr/share/man/man3c/timerisset.3c 0444 root bin
+f usr/share/man/man3c/timersub.3c 0444 root bin
+f usr/share/man/man3c/tmpfile.3c 0444 root bin
+f usr/share/man/man3c/tmpnam.3c 0444 root bin
+f usr/share/man/man3c/tmpnam_r.3c 0444 root bin
+f usr/share/man/man3c/toascii.3c 0444 root bin
+f usr/share/man/man3c/tolower.3c 0444 root bin
+f usr/share/man/man3c/toupper.3c 0444 root bin
+f usr/share/man/man3c/truncate.3c 0444 root bin
+f usr/share/man/man3c/tsearch.3c 0444 root bin
+f usr/share/man/man3c/ttyname.3c 0444 root bin
+f usr/share/man/man3c/ttyname_r.3c 0444 root bin
+f usr/share/man/man3c/ttyslot.3c 0444 root bin
+f usr/share/man/man3c/twalk.3c 0444 root bin
+f usr/share/man/man3c/tzset.3c 0444 root bin
+f usr/share/man/man3c/u8_strcmp.3c 0444 root bin
+f usr/share/man/man3c/u8_textprep_str.3c 0444 root bin
+f usr/share/man/man3c/u8_validate.3c 0444 root bin
+f usr/share/man/man3c/ualarm.3c 0444 root bin
+f usr/share/man/man3c/uconv_u16tou32.3c 0444 root bin
+f usr/share/man/man3c/uconv_u16tou8.3c 0444 root bin
+f usr/share/man/man3c/uconv_u32tou16.3c 0444 root bin
+f usr/share/man/man3c/uconv_u32tou8.3c 0444 root bin
+f usr/share/man/man3c/uconv_u8tou16.3c 0444 root bin
+f usr/share/man/man3c/uconv_u8tou32.3c 0444 root bin
+f usr/share/man/man3c/ucred_free.3c 0444 root bin
+f usr/share/man/man3c/ucred_get.3c 0444 root bin
+f usr/share/man/man3c/ucred_getegid.3c 0444 root bin
+f usr/share/man/man3c/ucred_geteuid.3c 0444 root bin
+f usr/share/man/man3c/ucred_getgroups.3c 0444 root bin
+f usr/share/man/man3c/ucred_getlabel.3c 0444 root bin
+f usr/share/man/man3c/ucred_getpflags.3c 0444 root bin
+f usr/share/man/man3c/ucred_getpid.3c 0444 root bin
+f usr/share/man/man3c/ucred_getprivset.3c 0444 root bin
+f usr/share/man/man3c/ucred_getprojid.3c 0444 root bin
+f usr/share/man/man3c/ucred_getrgid.3c 0444 root bin
+f usr/share/man/man3c/ucred_getruid.3c 0444 root bin
+f usr/share/man/man3c/ucred_getsgid.3c 0444 root bin
+f usr/share/man/man3c/ucred_getsuid.3c 0444 root bin
+f usr/share/man/man3c/ucred_getzoneid.3c 0444 root bin
+f usr/share/man/man3c/ucred_size.3c 0444 root bin
+f usr/share/man/man3c/ulckpwdf.3c 0444 root bin
+f usr/share/man/man3c/ulltostr.3c 0444 root bin
+f usr/share/man/man3c/ungetc.3c 0444 root bin
+f usr/share/man/man3c/ungetwc.3c 0444 root bin
+f usr/share/man/man3c/unlockpt.3c 0444 root bin
+f usr/share/man/man3c/unordered.3c 0444 root bin
+f usr/share/man/man3c/unsetenv.3c 0444 root bin
+f usr/share/man/man3c/updwtmp.3c 0444 root bin
+f usr/share/man/man3c/updwtmpx.3c 0444 root bin
+f usr/share/man/man3c/usleep.3c 0444 root bin
+f usr/share/man/man3c/utmpname.3c 0444 root bin
+f usr/share/man/man3c/utmpxname.3c 0444 root bin
+f usr/share/man/man3c/valloc.3c 0444 root bin
+f usr/share/man/man3c/vasprintf.3c 0444 root bin
+f usr/share/man/man3c/verr.3c 0444 root bin
+f usr/share/man/man3c/verrx.3c 0444 root bin
+f usr/share/man/man3c/vfprintf.3c 0444 root bin
+f usr/share/man/man3c/vfscanf.3c 0444 root bin
+f usr/share/man/man3c/vfwprintf.3c 0444 root bin
+f usr/share/man/man3c/vfwscanf.3c 0444 root bin
+f usr/share/man/man3c/vlfmt.3c 0444 root bin
+f usr/share/man/man3c/vpfmt.3c 0444 root bin
+f usr/share/man/man3c/vprintf.3c 0444 root bin
+f usr/share/man/man3c/vscanf.3c 0444 root bin
+f usr/share/man/man3c/vsnprintf.3c 0444 root bin
+f usr/share/man/man3c/vsprintf.3c 0444 root bin
+f usr/share/man/man3c/vsscanf.3c 0444 root bin
+f usr/share/man/man3c/vswprintf.3c 0444 root bin
+f usr/share/man/man3c/vswscanf.3c 0444 root bin
+f usr/share/man/man3c/vsyslog.3c 0444 root bin
+f usr/share/man/man3c/vwarn.3c 0444 root bin
+f usr/share/man/man3c/vwarnx.3c 0444 root bin
+f usr/share/man/man3c/vwprintf.3c 0444 root bin
+f usr/share/man/man3c/vwscanf.3c 0444 root bin
+f usr/share/man/man3c/wait.3c 0444 root bin
+f usr/share/man/man3c/wait3.3c 0444 root bin
+f usr/share/man/man3c/wait4.3c 0444 root bin
+f usr/share/man/man3c/waitpid.3c 0444 root bin
+f usr/share/man/man3c/walkcontext.3c 0444 root bin
+f usr/share/man/man3c/warn.3c 0444 root bin
+f usr/share/man/man3c/warnx.3c 0444 root bin
+f usr/share/man/man3c/watof.3c 0444 root bin
+f usr/share/man/man3c/watoi.3c 0444 root bin
+f usr/share/man/man3c/watol.3c 0444 root bin
+f usr/share/man/man3c/watoll.3c 0444 root bin
+f usr/share/man/man3c/wcrtomb.3c 0444 root bin
+f usr/share/man/man3c/wcscat.3c 0444 root bin
+f usr/share/man/man3c/wcschr.3c 0444 root bin
+f usr/share/man/man3c/wcscmp.3c 0444 root bin
+f usr/share/man/man3c/wcscoll.3c 0444 root bin
+f usr/share/man/man3c/wcscpy.3c 0444 root bin
+f usr/share/man/man3c/wcscspn.3c 0444 root bin
+f usr/share/man/man3c/wcsetno.3c 0444 root bin
+f usr/share/man/man3c/wcsftime.3c 0444 root bin
+f usr/share/man/man3c/wcslen.3c 0444 root bin
+f usr/share/man/man3c/wcsncat.3c 0444 root bin
+f usr/share/man/man3c/wcsncmp.3c 0444 root bin
+f usr/share/man/man3c/wcsncpy.3c 0444 root bin
+f usr/share/man/man3c/wcspbrk.3c 0444 root bin
+f usr/share/man/man3c/wcsrchr.3c 0444 root bin
+f usr/share/man/man3c/wcsrtombs.3c 0444 root bin
+f usr/share/man/man3c/wcsspn.3c 0444 root bin
+f usr/share/man/man3c/wcsstr.3c 0444 root bin
+f usr/share/man/man3c/wcstod.3c 0444 root bin
+f usr/share/man/man3c/wcstof.3c 0444 root bin
+f usr/share/man/man3c/wcstoimax.3c 0444 root bin
+f usr/share/man/man3c/wcstok.3c 0444 root bin
+f usr/share/man/man3c/wcstol.3c 0444 root bin
+f usr/share/man/man3c/wcstold.3c 0444 root bin
+f usr/share/man/man3c/wcstoll.3c 0444 root bin
+f usr/share/man/man3c/wcstoul.3c 0444 root bin
+f usr/share/man/man3c/wcstoull.3c 0444 root bin
+f usr/share/man/man3c/wcstoumax.3c 0444 root bin
+f usr/share/man/man3c/wcstring.3c 0444 root bin
+f usr/share/man/man3c/wcswcs.3c 0444 root bin
+f usr/share/man/man3c/wcswidth.3c 0444 root bin
+f usr/share/man/man3c/wcsxfrm.3c 0444 root bin
+f usr/share/man/man3c/wctob.3c 0444 root bin
+f usr/share/man/man3c/wctomb.3c 0444 root bin
+f usr/share/man/man3c/wctype.3c 0444 root bin
+f usr/share/man/man3c/wcwidth.3c 0444 root bin
+f usr/share/man/man3c/windex.3c 0444 root bin
+f usr/share/man/man3c/wmemchr.3c 0444 root bin
+f usr/share/man/man3c/wmemcmp.3c 0444 root bin
+f usr/share/man/man3c/wmemcpy.3c 0444 root bin
+f usr/share/man/man3c/wmemmove.3c 0444 root bin
+f usr/share/man/man3c/wmemset.3c 0444 root bin
+f usr/share/man/man3c/wordexp.3c 0444 root bin
+f usr/share/man/man3c/wordfree.3c 0444 root bin
+f usr/share/man/man3c/wprintf.3c 0444 root bin
+f usr/share/man/man3c/wrindex.3c 0444 root bin
+f usr/share/man/man3c/wscanf.3c 0444 root bin
+f usr/share/man/man3c/wscasecmp.3c 0444 root bin
+f usr/share/man/man3c/wscat.3c 0444 root bin
+f usr/share/man/man3c/wschr.3c 0444 root bin
+f usr/share/man/man3c/wscmp.3c 0444 root bin
+f usr/share/man/man3c/wscol.3c 0444 root bin
+f usr/share/man/man3c/wscoll.3c 0444 root bin
+f usr/share/man/man3c/wscpy.3c 0444 root bin
+f usr/share/man/man3c/wscspn.3c 0444 root bin
+f usr/share/man/man3c/wsdup.3c 0444 root bin
+f usr/share/man/man3c/wslen.3c 0444 root bin
+f usr/share/man/man3c/wsncasecmp.3c 0444 root bin
+f usr/share/man/man3c/wsncat.3c 0444 root bin
+f usr/share/man/man3c/wsncmp.3c 0444 root bin
+f usr/share/man/man3c/wsncpy.3c 0444 root bin
+f usr/share/man/man3c/wspbrk.3c 0444 root bin
+f usr/share/man/man3c/wsprintf.3c 0444 root bin
+f usr/share/man/man3c/wsrchr.3c 0444 root bin
+f usr/share/man/man3c/wsscanf.3c 0444 root bin
+f usr/share/man/man3c/wsspn.3c 0444 root bin
+f usr/share/man/man3c/wstod.3c 0444 root bin
+f usr/share/man/man3c/wstok.3c 0444 root bin
+f usr/share/man/man3c/wstol.3c 0444 root bin
+f usr/share/man/man3c/wstostr.3c 0444 root bin
+f usr/share/man/man3c/wstring.3c 0444 root bin
+f usr/share/man/man3c/wsxfrm.3c 0444 root bin
+d usr/share/man/man3c_db 0755 root bin
+f usr/share/man/man3c_db/td_init.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_log.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_sync_get_info.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_ta_enable_stats.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_ta_event_addr.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_ta_get_nthreads.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_ta_map_addr2sync.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_ta_map_id2thr.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_ta_new.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_ta_setconcurrency.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_ta_sync_iter.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_dbsuspend.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_get_info.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_getgregs.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_lockowner.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_setprio.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_setsigpending.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_sleepinfo.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_tsd.3c_db 0444 root bin
+f usr/share/man/man3c_db/td_thr_validate.3c_db 0444 root bin
+d usr/share/man/man3cfgadm 0755 root bin
+f usr/share/man/man3cfgadm/config_admin.3cfgadm 0444 root bin
+d usr/share/man/man3commputil 0755 root bin
+f usr/share/man/man3commputil/sdp_add_origin.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_clone_session.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_delete_all_field.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_delete_media.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_find_attribute.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_find_media.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_find_media_rtpmap.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_new_session.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_parse.3commputil 0444 root bin
+f usr/share/man/man3commputil/sdp_session_to_str.3commputil 0444 root bin
+d usr/share/man/man3contract 0755 root bin
+f usr/share/man/man3contract/ct_ctl_abandon.3contract 0444 root bin
+f usr/share/man/man3contract/ct_ctl_ack.3contract 0444 root bin
+f usr/share/man/man3contract/ct_ctl_adopt.3contract 0444 root bin
+f usr/share/man/man3contract/ct_ctl_nack.3contract 0444 root bin
+f usr/share/man/man3contract/ct_ctl_newct.3contract 0444 root bin
+f usr/share/man/man3contract/ct_ctl_qack.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_status_get_aset.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_status_get_dev_state.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_status_get_minor.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_status_get_noneg.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_tmpl_clear_noneg.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_tmpl_get_aset.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_tmpl_get_minor.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_tmpl_get_noneg.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_tmpl_set_aset.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_tmpl_set_minor.3contract 0444 root bin
+f usr/share/man/man3contract/ct_dev_tmpl_set_noneg.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_free.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_get_ctid.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_get_evid.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_get_flags.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_get_nevid.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_get_newct.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_get_type.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_read.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_read_critical.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_reliable.3contract 0444 root bin
+f usr/share/man/man3contract/ct_event_reset.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_exitstatus.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_gcorefile.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_pcorefile.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_pid.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_ppid.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_sender.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_senderct.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_signal.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_event_get_zcorefile.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_status_get_contracts.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_status_get_fatal.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_status_get_members.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_status_get_param.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_status_get_svc_aux.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_status_get_svc_creator.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_status_get_svc_ctid.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_status_get_svc_fmri.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_get_fatal.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_get_param.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_get_svc_aux.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_get_svc_fmri.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_get_transfer.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_set_fatal.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_set_param.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_set_svc_aux.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_set_svc_fmri.3contract 0444 root bin
+f usr/share/man/man3contract/ct_pr_tmpl_set_transfer.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_free.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_cookie.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_critical.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_holder.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_id.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_informative.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_nevents.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_nevid.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_ntime.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_qtime.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_state.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_type.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_get_zoneid.3contract 0444 root bin
+f usr/share/man/man3contract/ct_status_read.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_activate.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_clear.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_create.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_get_cookie.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_get_critical.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_get_informative.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_set_cookie.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_set_critical.3contract 0444 root bin
+f usr/share/man/man3contract/ct_tmpl_set_informative.3contract 0444 root bin
+d usr/share/man/man3cpc 0755 root bin
+f usr/share/man/man3cpc/cpc.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_access.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_bind_curlwp.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_bind_event.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_buf_create.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_count_usr_events.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_enable.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_event.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_event_diff.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_getcpuver.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_npic.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_open.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_pctx_bind_event.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_set_create.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_seterrfn.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_seterrhndlr.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_shared_open.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_strtoevent.3cpc 0444 root bin
+f usr/share/man/man3cpc/cpc_version.3cpc 0444 root bin
+f usr/share/man/man3cpc/generic_events.3cpc 0444 root bin
+f usr/share/man/man3cpc/pctx_capture.3cpc 0444 root bin
+f usr/share/man/man3cpc/pctx_set_events.3cpc 0444 root bin
+d usr/share/man/man3curses 0755 root bin
+f usr/share/man/man3curses/addch.3curses 0444 root bin
+f usr/share/man/man3curses/addchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/addchstr.3curses 0444 root bin
+f usr/share/man/man3curses/addnstr.3curses 0444 root bin
+f usr/share/man/man3curses/addnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/addstr.3curses 0444 root bin
+f usr/share/man/man3curses/addwch.3curses 0444 root bin
+f usr/share/man/man3curses/addwchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/addwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/addwstr.3curses 0444 root bin
+f usr/share/man/man3curses/adjcurspos.3curses 0444 root bin
+f usr/share/man/man3curses/attroff.3curses 0444 root bin
+f usr/share/man/man3curses/attron.3curses 0444 root bin
+f usr/share/man/man3curses/attrset.3curses 0444 root bin
+f usr/share/man/man3curses/baudrate.3curses 0444 root bin
+f usr/share/man/man3curses/beep.3curses 0444 root bin
+f usr/share/man/man3curses/bkgd.3curses 0444 root bin
+f usr/share/man/man3curses/bkgdset.3curses 0444 root bin
+f usr/share/man/man3curses/border.3curses 0444 root bin
+f usr/share/man/man3curses/bottom_panel.3curses 0444 root bin
+f usr/share/man/man3curses/box.3curses 0444 root bin
+f usr/share/man/man3curses/can_change_color.3curses 0444 root bin
+f usr/share/man/man3curses/cbreak.3curses 0444 root bin
+f usr/share/man/man3curses/clear.3curses 0444 root bin
+f usr/share/man/man3curses/clearok.3curses 0444 root bin
+f usr/share/man/man3curses/clrtobot.3curses 0444 root bin
+f usr/share/man/man3curses/clrtoeol.3curses 0444 root bin
+f usr/share/man/man3curses/color_content.3curses 0444 root bin
+f usr/share/man/man3curses/copywin.3curses 0444 root bin
+f usr/share/man/man3curses/current_field.3curses 0444 root bin
+f usr/share/man/man3curses/current_item.3curses 0444 root bin
+f usr/share/man/man3curses/curs_addch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_addchstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_addstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_addwch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_addwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_addwstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_alecompat.3curses 0444 root bin
+f usr/share/man/man3curses/curs_attr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_beep.3curses 0444 root bin
+f usr/share/man/man3curses/curs_bkgd.3curses 0444 root bin
+f usr/share/man/man3curses/curs_border.3curses 0444 root bin
+f usr/share/man/man3curses/curs_clear.3curses 0444 root bin
+f usr/share/man/man3curses/curs_color.3curses 0444 root bin
+f usr/share/man/man3curses/curs_delch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_deleteln.3curses 0444 root bin
+f usr/share/man/man3curses/curs_getch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_getstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_getwch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_getwstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_getyx.3curses 0444 root bin
+f usr/share/man/man3curses/curs_inch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_inchstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_initscr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_inopts.3curses 0444 root bin
+f usr/share/man/man3curses/curs_insch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_insstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_instr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_inswch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_inswstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_inwch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_inwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_inwstr.3curses 0444 root bin
+f usr/share/man/man3curses/curs_kernel.3curses 0444 root bin
+f usr/share/man/man3curses/curs_move.3curses 0444 root bin
+f usr/share/man/man3curses/curs_outopts.3curses 0444 root bin
+f usr/share/man/man3curses/curs_overlay.3curses 0444 root bin
+f usr/share/man/man3curses/curs_pad.3curses 0444 root bin
+f usr/share/man/man3curses/curs_printw.3curses 0444 root bin
+f usr/share/man/man3curses/curs_refresh.3curses 0444 root bin
+f usr/share/man/man3curses/curs_scanw.3curses 0444 root bin
+f usr/share/man/man3curses/curs_scr_dump.3curses 0444 root bin
+f usr/share/man/man3curses/curs_scroll.3curses 0444 root bin
+f usr/share/man/man3curses/curs_set.3curses 0444 root bin
+f usr/share/man/man3curses/curs_slk.3curses 0444 root bin
+f usr/share/man/man3curses/curs_termattrs.3curses 0444 root bin
+f usr/share/man/man3curses/curs_termcap.3curses 0444 root bin
+f usr/share/man/man3curses/curs_terminfo.3curses 0444 root bin
+f usr/share/man/man3curses/curs_touch.3curses 0444 root bin
+f usr/share/man/man3curses/curs_util.3curses 0444 root bin
+f usr/share/man/man3curses/curs_window.3curses 0444 root bin
+f usr/share/man/man3curses/curses.3curses 0444 root bin
+f usr/share/man/man3curses/data_ahead.3curses 0444 root bin
+f usr/share/man/man3curses/data_behind.3curses 0444 root bin
+f usr/share/man/man3curses/def_prog_mode.3curses 0444 root bin
+f usr/share/man/man3curses/def_shell_mode.3curses 0444 root bin
+f usr/share/man/man3curses/del_curterm.3curses 0444 root bin
+f usr/share/man/man3curses/del_panel.3curses 0444 root bin
+f usr/share/man/man3curses/delay_output.3curses 0444 root bin
+f usr/share/man/man3curses/delch.3curses 0444 root bin
+f usr/share/man/man3curses/deleteln.3curses 0444 root bin
+f usr/share/man/man3curses/delscreen.3curses 0444 root bin
+f usr/share/man/man3curses/delwin.3curses 0444 root bin
+f usr/share/man/man3curses/derwin.3curses 0444 root bin
+f usr/share/man/man3curses/doupdate.3curses 0444 root bin
+f usr/share/man/man3curses/dup_field.3curses 0444 root bin
+f usr/share/man/man3curses/dupwin.3curses 0444 root bin
+f usr/share/man/man3curses/dynamic_field_info.3curses 0444 root bin
+f usr/share/man/man3curses/echo.3curses 0444 root bin
+f usr/share/man/man3curses/echochar.3curses 0444 root bin
+f usr/share/man/man3curses/echowchar.3curses 0444 root bin
+f usr/share/man/man3curses/endwin.3curses 0444 root bin
+f usr/share/man/man3curses/erase.3curses 0444 root bin
+f usr/share/man/man3curses/erasechar.3curses 0444 root bin
+f usr/share/man/man3curses/field_arg.3curses 0444 root bin
+f usr/share/man/man3curses/field_back.3curses 0444 root bin
+f usr/share/man/man3curses/field_buffer.3curses 0444 root bin
+f usr/share/man/man3curses/field_count.3curses 0444 root bin
+f usr/share/man/man3curses/field_fore.3curses 0444 root bin
+f usr/share/man/man3curses/field_index.3curses 0444 root bin
+f usr/share/man/man3curses/field_info.3curses 0444 root bin
+f usr/share/man/man3curses/field_init.3curses 0444 root bin
+f usr/share/man/man3curses/field_just.3curses 0444 root bin
+f usr/share/man/man3curses/field_opts_off.3curses 0444 root bin
+f usr/share/man/man3curses/field_opts_on.3curses 0444 root bin
+f usr/share/man/man3curses/field_opts.3curses 0444 root bin
+f usr/share/man/man3curses/field_pad.3curses 0444 root bin
+f usr/share/man/man3curses/field_status.3curses 0444 root bin
+f usr/share/man/man3curses/field_term.3curses 0444 root bin
+f usr/share/man/man3curses/field_type.3curses 0444 root bin
+f usr/share/man/man3curses/field_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/filter.3curses 0444 root bin
+f usr/share/man/man3curses/flash.3curses 0444 root bin
+f usr/share/man/man3curses/flushinp.3curses 0444 root bin
+f usr/share/man/man3curses/form_cursor.3curses 0444 root bin
+f usr/share/man/man3curses/form_data.3curses 0444 root bin
+f usr/share/man/man3curses/form_driver.3curses 0444 root bin
+f usr/share/man/man3curses/form_field_attributes.3curses 0444 root bin
+f usr/share/man/man3curses/form_field_buffer.3curses 0444 root bin
+f usr/share/man/man3curses/form_field_info.3curses 0444 root bin
+f usr/share/man/man3curses/form_field_just.3curses 0444 root bin
+f usr/share/man/man3curses/form_field_new.3curses 0444 root bin
+f usr/share/man/man3curses/form_field_opts.3curses 0444 root bin
+f usr/share/man/man3curses/form_field_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/form_field_validation.3curses 0444 root bin
+f usr/share/man/man3curses/form_field.3curses 0444 root bin
+f usr/share/man/man3curses/form_fields.3curses 0444 root bin
+f usr/share/man/man3curses/form_fieldtype.3curses 0444 root bin
+f usr/share/man/man3curses/form_hook.3curses 0444 root bin
+f usr/share/man/man3curses/form_init.3curses 0444 root bin
+f usr/share/man/man3curses/form_new_page.3curses 0444 root bin
+f usr/share/man/man3curses/form_new.3curses 0444 root bin
+f usr/share/man/man3curses/form_opts_off.3curses 0444 root bin
+f usr/share/man/man3curses/form_opts_on.3curses 0444 root bin
+f usr/share/man/man3curses/form_opts.3curses 0444 root bin
+f usr/share/man/man3curses/form_page.3curses 0444 root bin
+f usr/share/man/man3curses/form_post.3curses 0444 root bin
+f usr/share/man/man3curses/form_sub.3curses 0444 root bin
+f usr/share/man/man3curses/form_term.3curses 0444 root bin
+f usr/share/man/man3curses/form_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/form_win.3curses 0444 root bin
+f usr/share/man/man3curses/forms.3curses 0444 root bin
+f usr/share/man/man3curses/free_field.3curses 0444 root bin
+f usr/share/man/man3curses/free_fieldtype.3curses 0444 root bin
+f usr/share/man/man3curses/free_form.3curses 0444 root bin
+f usr/share/man/man3curses/free_item.3curses 0444 root bin
+f usr/share/man/man3curses/free_menu.3curses 0444 root bin
+f usr/share/man/man3curses/getbegyx.3curses 0444 root bin
+f usr/share/man/man3curses/getch.3curses 0444 root bin
+f usr/share/man/man3curses/getmaxyx.3curses 0444 root bin
+f usr/share/man/man3curses/getnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/getparyx.3curses 0444 root bin
+f usr/share/man/man3curses/getstr.3curses 0444 root bin
+f usr/share/man/man3curses/getsyx.3curses 0444 root bin
+f usr/share/man/man3curses/getwch.3curses 0444 root bin
+f usr/share/man/man3curses/getwin.3curses 0444 root bin
+f usr/share/man/man3curses/getwstr.3curses 0444 root bin
+f usr/share/man/man3curses/getyx.3curses 0444 root bin
+f usr/share/man/man3curses/halfdelay.3curses 0444 root bin
+f usr/share/man/man3curses/has_colors.3curses 0444 root bin
+f usr/share/man/man3curses/has_ic.3curses 0444 root bin
+f usr/share/man/man3curses/has_il.3curses 0444 root bin
+f usr/share/man/man3curses/hide_panel.3curses 0444 root bin
+f usr/share/man/man3curses/idcok.3curses 0444 root bin
+f usr/share/man/man3curses/idlok.3curses 0444 root bin
+f usr/share/man/man3curses/immedok.3curses 0444 root bin
+f usr/share/man/man3curses/inch.3curses 0444 root bin
+f usr/share/man/man3curses/inchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/inchstr.3curses 0444 root bin
+f usr/share/man/man3curses/init_color.3curses 0444 root bin
+f usr/share/man/man3curses/init_pair.3curses 0444 root bin
+f usr/share/man/man3curses/initscr.3curses 0444 root bin
+f usr/share/man/man3curses/innstr.3curses 0444 root bin
+f usr/share/man/man3curses/innwstr.3curses 0444 root bin
+f usr/share/man/man3curses/insch.3curses 0444 root bin
+f usr/share/man/man3curses/insdelln.3curses 0444 root bin
+f usr/share/man/man3curses/insertln.3curses 0444 root bin
+f usr/share/man/man3curses/insnstr.3curses 0444 root bin
+f usr/share/man/man3curses/insnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/insstr.3curses 0444 root bin
+f usr/share/man/man3curses/instr.3curses 0444 root bin
+f usr/share/man/man3curses/inswch.3curses 0444 root bin
+f usr/share/man/man3curses/inswstr.3curses 0444 root bin
+f usr/share/man/man3curses/intrflush.3curses 0444 root bin
+f usr/share/man/man3curses/inwch.3curses 0444 root bin
+f usr/share/man/man3curses/inwchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/inwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/inwstr.3curses 0444 root bin
+f usr/share/man/man3curses/is_linetouched.3curses 0444 root bin
+f usr/share/man/man3curses/is_wintouched.3curses 0444 root bin
+f usr/share/man/man3curses/isendwin.3curses 0444 root bin
+f usr/share/man/man3curses/item_count.3curses 0444 root bin
+f usr/share/man/man3curses/item_description.3curses 0444 root bin
+f usr/share/man/man3curses/item_index.3curses 0444 root bin
+f usr/share/man/man3curses/item_init.3curses 0444 root bin
+f usr/share/man/man3curses/item_name.3curses 0444 root bin
+f usr/share/man/man3curses/item_opts_off.3curses 0444 root bin
+f usr/share/man/man3curses/item_opts_on.3curses 0444 root bin
+f usr/share/man/man3curses/item_opts.3curses 0444 root bin
+f usr/share/man/man3curses/item_term.3curses 0444 root bin
+f usr/share/man/man3curses/item_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/item_value.3curses 0444 root bin
+f usr/share/man/man3curses/item_visible.3curses 0444 root bin
+f usr/share/man/man3curses/keyname.3curses 0444 root bin
+f usr/share/man/man3curses/keypad.3curses 0444 root bin
+f usr/share/man/man3curses/killchar.3curses 0444 root bin
+f usr/share/man/man3curses/leaveok.3curses 0444 root bin
+f usr/share/man/man3curses/link_field.3curses 0444 root bin
+f usr/share/man/man3curses/link_fieldtype.3curses 0444 root bin
+f usr/share/man/man3curses/longname.3curses 0444 root bin
+f usr/share/man/man3curses/menu_attributes.3curses 0444 root bin
+f usr/share/man/man3curses/menu_back.3curses 0444 root bin
+f usr/share/man/man3curses/menu_cursor.3curses 0444 root bin
+f usr/share/man/man3curses/menu_driver.3curses 0444 root bin
+f usr/share/man/man3curses/menu_fore.3curses 0444 root bin
+f usr/share/man/man3curses/menu_format.3curses 0444 root bin
+f usr/share/man/man3curses/menu_grey.3curses 0444 root bin
+f usr/share/man/man3curses/menu_hook.3curses 0444 root bin
+f usr/share/man/man3curses/menu_init.3curses 0444 root bin
+f usr/share/man/man3curses/menu_item_current.3curses 0444 root bin
+f usr/share/man/man3curses/menu_item_name.3curses 0444 root bin
+f usr/share/man/man3curses/menu_item_new.3curses 0444 root bin
+f usr/share/man/man3curses/menu_item_opts.3curses 0444 root bin
+f usr/share/man/man3curses/menu_item_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/menu_item_value.3curses 0444 root bin
+f usr/share/man/man3curses/menu_item_visible.3curses 0444 root bin
+f usr/share/man/man3curses/menu_items.3curses 0444 root bin
+f usr/share/man/man3curses/menu_mark.3curses 0444 root bin
+f usr/share/man/man3curses/menu_new.3curses 0444 root bin
+f usr/share/man/man3curses/menu_opts_off.3curses 0444 root bin
+f usr/share/man/man3curses/menu_opts_on.3curses 0444 root bin
+f usr/share/man/man3curses/menu_opts.3curses 0444 root bin
+f usr/share/man/man3curses/menu_pad.3curses 0444 root bin
+f usr/share/man/man3curses/menu_pattern.3curses 0444 root bin
+f usr/share/man/man3curses/menu_post.3curses 0444 root bin
+f usr/share/man/man3curses/menu_sub.3curses 0444 root bin
+f usr/share/man/man3curses/menu_term.3curses 0444 root bin
+f usr/share/man/man3curses/menu_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/menu_win.3curses 0444 root bin
+f usr/share/man/man3curses/menus.3curses 0444 root bin
+f usr/share/man/man3curses/meta.3curses 0444 root bin
+f usr/share/man/man3curses/move_field.3curses 0444 root bin
+f usr/share/man/man3curses/move_panel.3curses 0444 root bin
+f usr/share/man/man3curses/move.3curses 0444 root bin
+f usr/share/man/man3curses/movenextch.3curses 0444 root bin
+f usr/share/man/man3curses/moveprevch.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddch.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddchstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddwch.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddwchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvaddwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvcur.3curses 0444 root bin
+f usr/share/man/man3curses/mvdelch.3curses 0444 root bin
+f usr/share/man/man3curses/mvderwin.3curses 0444 root bin
+f usr/share/man/man3curses/mvgetch.3curses 0444 root bin
+f usr/share/man/man3curses/mvgetnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvgetstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvgetwch.3curses 0444 root bin
+f usr/share/man/man3curses/mvgetwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinch.3curses 0444 root bin
+f usr/share/man/man3curses/mvinchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinchstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinsch.3curses 0444 root bin
+f usr/share/man/man3curses/mvinsnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinsnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinsstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinswch.3curses 0444 root bin
+f usr/share/man/man3curses/mvinswstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinwch.3curses 0444 root bin
+f usr/share/man/man3curses/mvinwchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvinwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvprintw.3curses 0444 root bin
+f usr/share/man/man3curses/mvscanw.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddchstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddwch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddwchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwaddwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwdelch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwgetch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwgetnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwgetstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwgetwch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwgetwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwin.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinchstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinsch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinsnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinsnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinsstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinswch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinswstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinwch.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinwchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwinwstr.3curses 0444 root bin
+f usr/share/man/man3curses/mvwprintw.3curses 0444 root bin
+f usr/share/man/man3curses/mvwscanw.3curses 0444 root bin
+f usr/share/man/man3curses/napms.3curses 0444 root bin
+f usr/share/man/man3curses/new_field.3curses 0444 root bin
+f usr/share/man/man3curses/new_fieldtype.3curses 0444 root bin
+f usr/share/man/man3curses/new_form.3curses 0444 root bin
+f usr/share/man/man3curses/new_item.3curses 0444 root bin
+f usr/share/man/man3curses/new_menu.3curses 0444 root bin
+f usr/share/man/man3curses/new_page.3curses 0444 root bin
+f usr/share/man/man3curses/new_panel.3curses 0444 root bin
+f usr/share/man/man3curses/newpad.3curses 0444 root bin
+f usr/share/man/man3curses/newterm.3curses 0444 root bin
+f usr/share/man/man3curses/newwin.3curses 0444 root bin
+f usr/share/man/man3curses/nl.3curses 0444 root bin
+f usr/share/man/man3curses/nocbreak.3curses 0444 root bin
+f usr/share/man/man3curses/nodelay.3curses 0444 root bin
+f usr/share/man/man3curses/noecho.3curses 0444 root bin
+f usr/share/man/man3curses/nonl.3curses 0444 root bin
+f usr/share/man/man3curses/noqiflush.3curses 0444 root bin
+f usr/share/man/man3curses/noraw.3curses 0444 root bin
+f usr/share/man/man3curses/notimeout.3curses 0444 root bin
+f usr/share/man/man3curses/overlay.3curses 0444 root bin
+f usr/share/man/man3curses/overwrite.3curses 0444 root bin
+f usr/share/man/man3curses/pair_content.3curses 0444 root bin
+f usr/share/man/man3curses/panel_above.3curses 0444 root bin
+f usr/share/man/man3curses/panel_below.3curses 0444 root bin
+f usr/share/man/man3curses/panel_hidden.3curses 0444 root bin
+f usr/share/man/man3curses/panel_move.3curses 0444 root bin
+f usr/share/man/man3curses/panel_new.3curses 0444 root bin
+f usr/share/man/man3curses/panel_show.3curses 0444 root bin
+f usr/share/man/man3curses/panel_top.3curses 0444 root bin
+f usr/share/man/man3curses/panel_update.3curses 0444 root bin
+f usr/share/man/man3curses/panel_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/panel_window.3curses 0444 root bin
+f usr/share/man/man3curses/panels.3curses 0444 root bin
+f usr/share/man/man3curses/pechochar.3curses 0444 root bin
+f usr/share/man/man3curses/pechowchar.3curses 0444 root bin
+f usr/share/man/man3curses/pnoutrefresh.3curses 0444 root bin
+f usr/share/man/man3curses/pos_form_cursor.3curses 0444 root bin
+f usr/share/man/man3curses/pos_menu_cursor.3curses 0444 root bin
+f usr/share/man/man3curses/post_form.3curses 0444 root bin
+f usr/share/man/man3curses/post_menu.3curses 0444 root bin
+f usr/share/man/man3curses/prefresh.3curses 0444 root bin
+f usr/share/man/man3curses/printw.3curses 0444 root bin
+f usr/share/man/man3curses/putp.3curses 0444 root bin
+f usr/share/man/man3curses/putwin.3curses 0444 root bin
+f usr/share/man/man3curses/qiflush.3curses 0444 root bin
+f usr/share/man/man3curses/raw.3curses 0444 root bin
+f usr/share/man/man3curses/redrawwin.3curses 0444 root bin
+f usr/share/man/man3curses/refresh.3curses 0444 root bin
+f usr/share/man/man3curses/replace_panel.3curses 0444 root bin
+f usr/share/man/man3curses/reset_prog_mode.3curses 0444 root bin
+f usr/share/man/man3curses/reset_shell_mode.3curses 0444 root bin
+f usr/share/man/man3curses/resetty.3curses 0444 root bin
+f usr/share/man/man3curses/restartterm.3curses 0444 root bin
+f usr/share/man/man3curses/ripoffline.3curses 0444 root bin
+f usr/share/man/man3curses/savetty.3curses 0444 root bin
+f usr/share/man/man3curses/scale_form.3curses 0444 root bin
+f usr/share/man/man3curses/scale_menu.3curses 0444 root bin
+f usr/share/man/man3curses/scanw.3curses 0444 root bin
+f usr/share/man/man3curses/scr_dump.3curses 0444 root bin
+f usr/share/man/man3curses/scr_init.3curses 0444 root bin
+f usr/share/man/man3curses/scr_restore.3curses 0444 root bin
+f usr/share/man/man3curses/scr_set.3curses 0444 root bin
+f usr/share/man/man3curses/scrl.3curses 0444 root bin
+f usr/share/man/man3curses/scroll.3curses 0444 root bin
+f usr/share/man/man3curses/scrollok.3curses 0444 root bin
+f usr/share/man/man3curses/set_current_field.3curses 0444 root bin
+f usr/share/man/man3curses/set_current_item.3curses 0444 root bin
+f usr/share/man/man3curses/set_curterm.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_back.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_buffer.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_fore.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_init.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_just.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_opts.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_pad.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_status.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_term.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_type.3curses 0444 root bin
+f usr/share/man/man3curses/set_field_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/set_fieldtype_arg.3curses 0444 root bin
+f usr/share/man/man3curses/set_fieldtype_choice.3curses 0444 root bin
+f usr/share/man/man3curses/set_form_fields.3curses 0444 root bin
+f usr/share/man/man3curses/set_form_init.3curses 0444 root bin
+f usr/share/man/man3curses/set_form_opts.3curses 0444 root bin
+f usr/share/man/man3curses/set_form_page.3curses 0444 root bin
+f usr/share/man/man3curses/set_form_sub.3curses 0444 root bin
+f usr/share/man/man3curses/set_form_term.3curses 0444 root bin
+f usr/share/man/man3curses/set_form_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/set_form_win.3curses 0444 root bin
+f usr/share/man/man3curses/set_item_init.3curses 0444 root bin
+f usr/share/man/man3curses/set_item_opts.3curses 0444 root bin
+f usr/share/man/man3curses/set_item_term.3curses 0444 root bin
+f usr/share/man/man3curses/set_item_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/set_item_value.3curses 0444 root bin
+f usr/share/man/man3curses/set_max_field.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_back.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_fore.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_format.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_grey.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_init.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_items.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_mark.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_opts.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_pad.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_pattern.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_sub.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_term.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/set_menu_win.3curses 0444 root bin
+f usr/share/man/man3curses/set_new_page.3curses 0444 root bin
+f usr/share/man/man3curses/set_panel_userptr.3curses 0444 root bin
+f usr/share/man/man3curses/set_term.3curses 0444 root bin
+f usr/share/man/man3curses/set_top_row.3curses 0444 root bin
+f usr/share/man/man3curses/setscrreg.3curses 0444 root bin
+f usr/share/man/man3curses/setsyx.3curses 0444 root bin
+f usr/share/man/man3curses/setterm.3curses 0444 root bin
+f usr/share/man/man3curses/setupterm.3curses 0444 root bin
+f usr/share/man/man3curses/show_panel.3curses 0444 root bin
+f usr/share/man/man3curses/slk_attroff.3curses 0444 root bin
+f usr/share/man/man3curses/slk_attron.3curses 0444 root bin
+f usr/share/man/man3curses/slk_attrset.3curses 0444 root bin
+f usr/share/man/man3curses/slk_clear.3curses 0444 root bin
+f usr/share/man/man3curses/slk_init.3curses 0444 root bin
+f usr/share/man/man3curses/slk_label.3curses 0444 root bin
+f usr/share/man/man3curses/slk_noutrefresh.3curses 0444 root bin
+f usr/share/man/man3curses/slk_refresh.3curses 0444 root bin
+f usr/share/man/man3curses/slk_restore.3curses 0444 root bin
+f usr/share/man/man3curses/slk_set.3curses 0444 root bin
+f usr/share/man/man3curses/slk_touch.3curses 0444 root bin
+f usr/share/man/man3curses/standend.3curses 0444 root bin
+f usr/share/man/man3curses/standout.3curses 0444 root bin
+f usr/share/man/man3curses/start_color.3curses 0444 root bin
+f usr/share/man/man3curses/subpad.3curses 0444 root bin
+f usr/share/man/man3curses/subwin.3curses 0444 root bin
+f usr/share/man/man3curses/syncok.3curses 0444 root bin
+f usr/share/man/man3curses/termattrs.3curses 0444 root bin
+f usr/share/man/man3curses/termname.3curses 0444 root bin
+f usr/share/man/man3curses/tgetent.3curses 0444 root bin
+f usr/share/man/man3curses/tgetflag.3curses 0444 root bin
+f usr/share/man/man3curses/tgetnum.3curses 0444 root bin
+f usr/share/man/man3curses/tgetstr.3curses 0444 root bin
+f usr/share/man/man3curses/tgoto.3curses 0444 root bin
+f usr/share/man/man3curses/tigetflag.3curses 0444 root bin
+f usr/share/man/man3curses/tigetnum.3curses 0444 root bin
+f usr/share/man/man3curses/tigetstr.3curses 0444 root bin
+f usr/share/man/man3curses/timeout.3curses 0444 root bin
+f usr/share/man/man3curses/top_panel.3curses 0444 root bin
+f usr/share/man/man3curses/top_row.3curses 0444 root bin
+f usr/share/man/man3curses/touchline.3curses 0444 root bin
+f usr/share/man/man3curses/touchwin.3curses 0444 root bin
+f usr/share/man/man3curses/tparm.3curses 0444 root bin
+f usr/share/man/man3curses/tputs.3curses 0444 root bin
+f usr/share/man/man3curses/typeahead.3curses 0444 root bin
+f usr/share/man/man3curses/unctrl.3curses 0444 root bin
+f usr/share/man/man3curses/ungetch.3curses 0444 root bin
+f usr/share/man/man3curses/ungetwch.3curses 0444 root bin
+f usr/share/man/man3curses/unpost_form.3curses 0444 root bin
+f usr/share/man/man3curses/unpost_menu.3curses 0444 root bin
+f usr/share/man/man3curses/untouchwin.3curses 0444 root bin
+f usr/share/man/man3curses/update_panels.3curses 0444 root bin
+f usr/share/man/man3curses/use_env.3curses 0444 root bin
+f usr/share/man/man3curses/vidattr.3curses 0444 root bin
+f usr/share/man/man3curses/vidputs.3curses 0444 root bin
+f usr/share/man/man3curses/vwprintw.3curses 0444 root bin
+f usr/share/man/man3curses/vwscanw.3curses 0444 root bin
+f usr/share/man/man3curses/waddch.3curses 0444 root bin
+f usr/share/man/man3curses/waddchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/waddchstr.3curses 0444 root bin
+f usr/share/man/man3curses/waddnstr.3curses 0444 root bin
+f usr/share/man/man3curses/waddnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/waddstr.3curses 0444 root bin
+f usr/share/man/man3curses/waddwch.3curses 0444 root bin
+f usr/share/man/man3curses/waddwchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/waddwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/waddwstr.3curses 0444 root bin
+f usr/share/man/man3curses/wadjcurspos.3curses 0444 root bin
+f usr/share/man/man3curses/wattroff.3curses 0444 root bin
+f usr/share/man/man3curses/wattron.3curses 0444 root bin
+f usr/share/man/man3curses/wattrset.3curses 0444 root bin
+f usr/share/man/man3curses/wbkgd.3curses 0444 root bin
+f usr/share/man/man3curses/wbkgdset.3curses 0444 root bin
+f usr/share/man/man3curses/wborder.3curses 0444 root bin
+f usr/share/man/man3curses/wclear.3curses 0444 root bin
+f usr/share/man/man3curses/wclrtobot.3curses 0444 root bin
+f usr/share/man/man3curses/wclrtoeol.3curses 0444 root bin
+f usr/share/man/man3curses/wcursyncup.3curses 0444 root bin
+f usr/share/man/man3curses/wdelch.3curses 0444 root bin
+f usr/share/man/man3curses/wdeleteln.3curses 0444 root bin
+f usr/share/man/man3curses/wechochar.3curses 0444 root bin
+f usr/share/man/man3curses/wechowchar.3curses 0444 root bin
+f usr/share/man/man3curses/werase.3curses 0444 root bin
+f usr/share/man/man3curses/wgetch.3curses 0444 root bin
+f usr/share/man/man3curses/wgetnstr.3curses 0444 root bin
+f usr/share/man/man3curses/wgetnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/wgetstr.3curses 0444 root bin
+f usr/share/man/man3curses/wgetwch.3curses 0444 root bin
+f usr/share/man/man3curses/wgetwstr.3curses 0444 root bin
+f usr/share/man/man3curses/whline.3curses 0444 root bin
+f usr/share/man/man3curses/winch.3curses 0444 root bin
+f usr/share/man/man3curses/winchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/winchstr.3curses 0444 root bin
+f usr/share/man/man3curses/winnstr.3curses 0444 root bin
+f usr/share/man/man3curses/winnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/winsch.3curses 0444 root bin
+f usr/share/man/man3curses/winsdelln.3curses 0444 root bin
+f usr/share/man/man3curses/winsertln.3curses 0444 root bin
+f usr/share/man/man3curses/winsnstr.3curses 0444 root bin
+f usr/share/man/man3curses/winsnwstr.3curses 0444 root bin
+f usr/share/man/man3curses/winsstr.3curses 0444 root bin
+f usr/share/man/man3curses/winstr.3curses 0444 root bin
+f usr/share/man/man3curses/winswch.3curses 0444 root bin
+f usr/share/man/man3curses/winswstr.3curses 0444 root bin
+f usr/share/man/man3curses/winwch.3curses 0444 root bin
+f usr/share/man/man3curses/winwchnstr.3curses 0444 root bin
+f usr/share/man/man3curses/winwchstr.3curses 0444 root bin
+f usr/share/man/man3curses/winwstr.3curses 0444 root bin
+f usr/share/man/man3curses/wmove.3curses 0444 root bin
+f usr/share/man/man3curses/wmovenextch.3curses 0444 root bin
+f usr/share/man/man3curses/wmoveprevch.3curses 0444 root bin
+f usr/share/man/man3curses/wnoutrefresh.3curses 0444 root bin
+f usr/share/man/man3curses/wprintw.3curses 0444 root bin
+f usr/share/man/man3curses/wredrawln.3curses 0444 root bin
+f usr/share/man/man3curses/wrefresh.3curses 0444 root bin
+f usr/share/man/man3curses/wscanw.3curses 0444 root bin
+f usr/share/man/man3curses/wscrl.3curses 0444 root bin
+f usr/share/man/man3curses/wsetscrreg.3curses 0444 root bin
+f usr/share/man/man3curses/wstandend.3curses 0444 root bin
+f usr/share/man/man3curses/wstandout.3curses 0444 root bin
+f usr/share/man/man3curses/wsyncdown.3curses 0444 root bin
+f usr/share/man/man3curses/wsyncup.3curses 0444 root bin
+f usr/share/man/man3curses/wtimeout.3curses 0444 root bin
+f usr/share/man/man3curses/wtouchln.3curses 0444 root bin
+f usr/share/man/man3curses/wvline.3curses 0444 root bin
+d usr/share/man/man3dat 0755 root bin
+f usr/share/man/man3dat/dat_cno_create.3dat 0444 root bin
+f usr/share/man/man3dat/dat_cno_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_cno_modify_agent.3dat 0444 root bin
+f usr/share/man/man3dat/dat_cno_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_cno_wait.3dat 0444 root bin
+f usr/share/man/man3dat/dat_cr_accept.3dat 0444 root bin
+f usr/share/man/man3dat/dat_cr_handoff.3dat 0444 root bin
+f usr/share/man/man3dat/dat_cr_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_cr_reject.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_connect.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_create.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_create_with_srq.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_disconnect.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_dup_connect.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_get_status.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_modify.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_post_rdma_read.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_post_rdma_write.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_post_recv.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_post_send.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_recv_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_reset.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ep_set_watermark.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_clear_unwaitable.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_dequeue.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_disable.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_enable.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_modify_cno.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_post_se.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_resize.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_set_unwaitable.3dat 0444 root bin
+f usr/share/man/man3dat/dat_evd_wait.3dat 0444 root bin
+f usr/share/man/man3dat/dat_get_consumer_context.3dat 0444 root bin
+f usr/share/man/man3dat/dat_get_handle_type.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ia_close.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ia_open.3dat 0444 root bin
+f usr/share/man/man3dat/dat_ia_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_lmr_create.3dat 0444 root bin
+f usr/share/man/man3dat/dat_lmr_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_lmr_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_lmr_sync_rdma_read.3dat 0444 root bin
+f usr/share/man/man3dat/dat_lmr_sync_rdma_write.3dat 0444 root bin
+f usr/share/man/man3dat/dat_provider_fini.3dat 0444 root bin
+f usr/share/man/man3dat/dat_provider_init.3dat 0444 root bin
+f usr/share/man/man3dat/dat_psp_create.3dat 0444 root bin
+f usr/share/man/man3dat/dat_psp_create_any.3dat 0444 root bin
+f usr/share/man/man3dat/dat_psp_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_psp_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_pz_create.3dat 0444 root bin
+f usr/share/man/man3dat/dat_pz_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_pz_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_registry_add_provider.3dat 0444 root bin
+f usr/share/man/man3dat/dat_registry_list_providers.3dat 0444 root bin
+f usr/share/man/man3dat/dat_registry_remove_provider.3dat 0444 root bin
+f usr/share/man/man3dat/dat_rmr_bind.3dat 0444 root bin
+f usr/share/man/man3dat/dat_rmr_create.3dat 0444 root bin
+f usr/share/man/man3dat/dat_rmr_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_rmr_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_rsp_create.3dat 0444 root bin
+f usr/share/man/man3dat/dat_rsp_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_rsp_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_set_consumer_context.3dat 0444 root bin
+f usr/share/man/man3dat/dat_srq_create.3dat 0444 root bin
+f usr/share/man/man3dat/dat_srq_free.3dat 0444 root bin
+f usr/share/man/man3dat/dat_srq_post_recv.3dat 0444 root bin
+f usr/share/man/man3dat/dat_srq_query.3dat 0444 root bin
+f usr/share/man/man3dat/dat_srq_resize.3dat 0444 root bin
+f usr/share/man/man3dat/dat_srq_set_lw.3dat 0444 root bin
+f usr/share/man/man3dat/dat_strerror.3dat 0444 root bin
+d usr/share/man/man3devid 0755 root bin
+f usr/share/man/man3devid/devid_get.3devid 0444 root bin
+d usr/share/man/man3devinfo 0755 root bin
+f usr/share/man/man3devinfo/di_binding_name.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_child_node.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_devfs_path.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_devlink_dup.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_devlink_init.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_devlink_path.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_devlink_walk.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_init.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_link_next_by_node.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_link_spectype.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_lnode_name.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_lnode_next.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_minor_devt.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_minor_next.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_node_private_set.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_path_bus_addr.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_path_client_next_path.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_path_prop_bytes.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_path_prop_lookup_bytes.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_path_prop_next.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_prom_init.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_prom_prop_data.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_prom_prop_lookup_bytes.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_prop_bytes.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_prop_lookup_bytes.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_prop_next.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_walk_link.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_walk_lnode.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_walk_minor.3devinfo 0444 root bin
+f usr/share/man/man3devinfo/di_walk_node.3devinfo 0444 root bin
+d usr/share/man/man3dlpi 0755 root bin
+f usr/share/man/man3dlpi/dlpi_arptype.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_bind.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_close.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_disabnotify.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_enabmulti.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_enabnotify.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_fd.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_get_physaddr.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_iftype.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_info.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_linkname.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_mactype.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_open.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_promiscon.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_recv.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_send.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_set_physaddr.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_set_timeout.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_strerror.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_unbind.3dlpi 0444 root bin
+f usr/share/man/man3dlpi/dlpi_walk.3dlpi 0444 root bin
+d usr/share/man/man3dns_sd 0755 root bin
+f usr/share/man/man3dns_sd/DNSServiceBrowse.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceConstructFullName.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceCreateConnection.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceEnumerateDomains.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceProcessResult.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceQueryRecord.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceReconfirmRecord.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceRefDeallocate.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceRefSockFD.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceRegister.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/DNSServiceResolve.3dns_sd 0444 root bin
+f usr/share/man/man3dns_sd/TXTRecordCreate.3dns_sd 0444 root bin
+d usr/share/man/man3elf 0755 root bin
+f usr/share/man/man3elf/elf.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_checksum.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_fsize.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_getehdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_getphdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_getshdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_newehdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_newphdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_xlatetof.3elf 0444 root bin
+f usr/share/man/man3elf/elf32_xlatetom.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_checksum.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_fsize.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_getehdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_getphdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_getshdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_newehdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_newphdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_xlatetof.3elf 0444 root bin
+f usr/share/man/man3elf/elf64_xlatetom.3elf 0444 root bin
+f usr/share/man/man3elf/elf_begin.3elf 0444 root bin
+f usr/share/man/man3elf/elf_cntl.3elf 0444 root bin
+f usr/share/man/man3elf/elf_end.3elf 0444 root bin
+f usr/share/man/man3elf/elf_errmsg.3elf 0444 root bin
+f usr/share/man/man3elf/elf_errno.3elf 0444 root bin
+f usr/share/man/man3elf/elf_fill.3elf 0444 root bin
+f usr/share/man/man3elf/elf_flagdata.3elf 0444 root bin
+f usr/share/man/man3elf/elf_flagehdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf_flagelf.3elf 0444 root bin
+f usr/share/man/man3elf/elf_flagphdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf_flagscn.3elf 0444 root bin
+f usr/share/man/man3elf/elf_flagshdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getarhdr.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getarsym.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getbase.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getdata.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getident.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getphdrnum.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getphnum.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getscn.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getshdrnum.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getshdrstrndx.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getshnum.3elf 0444 root bin
+f usr/share/man/man3elf/elf_getshstrndx.3elf 0444 root bin
+f usr/share/man/man3elf/elf_hash.3elf 0444 root bin
+f usr/share/man/man3elf/elf_kind.3elf 0444 root bin
+f usr/share/man/man3elf/elf_memory.3elf 0444 root bin
+f usr/share/man/man3elf/elf_ndxscn.3elf 0444 root bin
+f usr/share/man/man3elf/elf_newdata.3elf 0444 root bin
+f usr/share/man/man3elf/elf_newscn.3elf 0444 root bin
+f usr/share/man/man3elf/elf_next.3elf 0444 root bin
+f usr/share/man/man3elf/elf_nextscn.3elf 0444 root bin
+f usr/share/man/man3elf/elf_rand.3elf 0444 root bin
+f usr/share/man/man3elf/elf_rawdata.3elf 0444 root bin
+f usr/share/man/man3elf/elf_rawfile.3elf 0444 root bin
+f usr/share/man/man3elf/elf_strptr.3elf 0444 root bin
+f usr/share/man/man3elf/elf_update.3elf 0444 root bin
+f usr/share/man/man3elf/elf_version.3elf 0444 root bin
+f usr/share/man/man3elf/gelf.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_checksum.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_fsize.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getcap.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getclass.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getdyn.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getehdr.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getmove.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getphdr.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getrel.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getrela.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getshdr.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getsym.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getsyminfo.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_getsymshndx.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_newehdr.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_newphdr.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_cap.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_dyn.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_ehdr.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_getmove.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_move.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_phdr.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_rel.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_rela.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_shdr.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_sym.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_syminfo.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_update_symshndx.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_xlatetof.3elf 0444 root bin
+f usr/share/man/man3elf/gelf_xlatetom.3elf 0444 root bin
+f usr/share/man/man3elf/nlist.3elf 0444 root bin
+d usr/share/man/man3exacct 0755 root bin
+f usr/share/man/man3exacct/ea_error.3exacct 0444 root bin
+f usr/share/man/man3exacct/ea_open.3exacct 0444 root bin
+f usr/share/man/man3exacct/ea_pack_object.3exacct 0444 root bin
+f usr/share/man/man3exacct/ea_set_item.3exacct 0444 root bin
+d usr/share/man/man3ext 0755 root bin
+f usr/share/man/man3ext/NOTE.3ext 0444 root bin
+f usr/share/man/man3ext/SUNW_C_GetMechSession.3ext 0444 root bin
+f usr/share/man/man3ext/auto_ef.3ext 0444 root bin
+f usr/share/man/man3ext/crypt.3ext 0444 root bin
+f usr/share/man/man3ext/demangle.3ext 0444 root bin
+f usr/share/man/man3ext/ecb_crypt.3ext 0444 root bin
+f usr/share/man/man3ext/efi_alloc_and_init.3ext 0444 root bin
+f usr/share/man/man3ext/ld_support.3ext 0444 root bin
+f usr/share/man/man3ext/md4.3ext 0444 root bin
+f usr/share/man/man3ext/md5.3ext 0444 root bin
+f usr/share/man/man3ext/read_vtoc.3ext 0444 root bin
+f usr/share/man/man3ext/rtld_audit.3ext 0444 root bin
+f usr/share/man/man3ext/rtld_db.3ext 0444 root bin
+f usr/share/man/man3ext/sendfile.3ext 0444 root bin
+f usr/share/man/man3ext/sendfilev.3ext 0444 root bin
+f usr/share/man/man3ext/sha1.3ext 0444 root bin
+f usr/share/man/man3ext/sha2.3ext 0444 root bin
+f usr/share/man/man3ext/stdarg.3ext 0444 root bin
+f usr/share/man/man3ext/tsalarm_get.3ext 0444 root bin
+f usr/share/man/man3ext/varargs.3ext 0444 root bin
+d usr/share/man/man3fcoe 0755 root bin
+f usr/share/man/man3fcoe/FCOE_CreatePort.3fcoe 0444 root bin
+f usr/share/man/man3fcoe/FCOE_DeletePort.3fcoe 0444 root bin
+f usr/share/man/man3fcoe/FCOE_GetPortList.3fcoe 0444 root bin
+d usr/share/man/man3fstyp 0755 root bin
+f usr/share/man/man3fstyp/fstyp_get_attr.3fstyp 0444 root bin
+f usr/share/man/man3fstyp/fstyp_ident.3fstyp 0444 root bin
+f usr/share/man/man3fstyp/fstyp_init.3fstyp 0444 root bin
+f usr/share/man/man3fstyp/fstyp_mod_init.3fstyp 0444 root bin
+f usr/share/man/man3fstyp/fstyp_strerror.3fstyp 0444 root bin
+d usr/share/man/man3gen 0755 root bin
+f usr/share/man/man3gen/bgets.3gen 0444 root bin
+f usr/share/man/man3gen/bufsplit.3gen 0444 root bin
+f usr/share/man/man3gen/copylist.3gen 0444 root bin
+f usr/share/man/man3gen/gmatch.3gen 0444 root bin
+f usr/share/man/man3gen/isencrypt.3gen 0444 root bin
+f usr/share/man/man3gen/mkdirp.3gen 0444 root bin
+f usr/share/man/man3gen/p2open.3gen 0444 root bin
+f usr/share/man/man3gen/pathfind.3gen 0444 root bin
+f usr/share/man/man3gen/regexpr.3gen 0444 root bin
+f usr/share/man/man3gen/strccpy.3gen 0444 root bin
+f usr/share/man/man3gen/strfind.3gen 0444 root bin
+d usr/share/man/man3gss 0755 root bin
+f usr/share/man/man3gss/gss_accept_sec_context.3gss 0444 root bin
+f usr/share/man/man3gss/gss_acquire_cred.3gss 0444 root bin
+f usr/share/man/man3gss/gss_add_cred.3gss 0444 root bin
+f usr/share/man/man3gss/gss_add_oid_set_member.3gss 0444 root bin
+f usr/share/man/man3gss/gss_canonicalize_name.3gss 0444 root bin
+f usr/share/man/man3gss/gss_compare_name.3gss 0444 root bin
+f usr/share/man/man3gss/gss_context_time.3gss 0444 root bin
+f usr/share/man/man3gss/gss_create_empty_oid_set.3gss 0444 root bin
+f usr/share/man/man3gss/gss_delete_sec_context.3gss 0444 root bin
+f usr/share/man/man3gss/gss_display_name.3gss 0444 root bin
+f usr/share/man/man3gss/gss_display_status.3gss 0444 root bin
+f usr/share/man/man3gss/gss_duplicate_name.3gss 0444 root bin
+f usr/share/man/man3gss/gss_export_name.3gss 0444 root bin
+f usr/share/man/man3gss/gss_export_sec_context.3gss 0444 root bin
+f usr/share/man/man3gss/gss_get_mic.3gss 0444 root bin
+f usr/share/man/man3gss/gss_import_name.3gss 0444 root bin
+f usr/share/man/man3gss/gss_import_sec_context.3gss 0444 root bin
+f usr/share/man/man3gss/gss_indicate_mechs.3gss 0444 root bin
+f usr/share/man/man3gss/gss_init_sec_context.3gss 0444 root bin
+f usr/share/man/man3gss/gss_inquire_context.3gss 0444 root bin
+f usr/share/man/man3gss/gss_inquire_cred.3gss 0444 root bin
+f usr/share/man/man3gss/gss_inquire_cred_by_mech.3gss 0444 root bin
+f usr/share/man/man3gss/gss_inquire_mechs_for_name.3gss 0444 root bin
+f usr/share/man/man3gss/gss_inquire_names_for_mech.3gss 0444 root bin
+f usr/share/man/man3gss/gss_oid_to_str.3gss 0444 root bin
+f usr/share/man/man3gss/gss_process_context_token.3gss 0444 root bin
+f usr/share/man/man3gss/gss_release_buffer.3gss 0444 root bin
+f usr/share/man/man3gss/gss_release_cred.3gss 0444 root bin
+f usr/share/man/man3gss/gss_release_name.3gss 0444 root bin
+f usr/share/man/man3gss/gss_release_oid.3gss 0444 root bin
+f usr/share/man/man3gss/gss_release_oid_set.3gss 0444 root bin
+f usr/share/man/man3gss/gss_store_cred.3gss 0444 root bin
+f usr/share/man/man3gss/gss_str_to_oid.3gss 0444 root bin
+f usr/share/man/man3gss/gss_test_oid_set_member.3gss 0444 root bin
+f usr/share/man/man3gss/gss_unwrap.3gss 0444 root bin
+f usr/share/man/man3gss/gss_verify_mic.3gss 0444 root bin
+f usr/share/man/man3gss/gss_wrap.3gss 0444 root bin
+f usr/share/man/man3gss/gss_wrap_size_limit.3gss 0444 root bin
+d usr/share/man/man3head 0755 root bin
+f usr/share/man/man3head/acct.h.3head 0444 root bin
+f usr/share/man/man3head/aio.h.3head 0444 root bin
+f usr/share/man/man3head/ar.h.3head 0444 root bin
+f usr/share/man/man3head/archives.h.3head 0444 root bin
+f usr/share/man/man3head/assert.h.3head 0444 root bin
+f usr/share/man/man3head/complex.h.3head 0444 root bin
+f usr/share/man/man3head/cpio.h.3head 0444 root bin
+f usr/share/man/man3head/dirent.h.3head 0444 root bin
+f usr/share/man/man3head/errno.h.3head 0444 root bin
+f usr/share/man/man3head/fcntl.h.3head 0444 root bin
+f usr/share/man/man3head/fenv.h.3head 0444 root bin
+f usr/share/man/man3head/float.h.3head 0444 root bin
+f usr/share/man/man3head/floatingpoint.h.3head 0444 root bin
+f usr/share/man/man3head/fmtmsg.h.3head 0444 root bin
+f usr/share/man/man3head/fnmatch.h.3head 0444 root bin
+f usr/share/man/man3head/ftw.h.3head 0444 root bin
+f usr/share/man/man3head/glob.h.3head 0444 root bin
+f usr/share/man/man3head/grp.h.3head 0444 root bin
+f usr/share/man/man3head/iconv.h.3head 0444 root bin
+f usr/share/man/man3head/if.h.3head 0444 root bin
+f usr/share/man/man3head/in.h.3head 0444 root bin
+f usr/share/man/man3head/inet.h.3head 0444 root bin
+f usr/share/man/man3head/inttypes.h.3head 0444 root bin
+f usr/share/man/man3head/ipc.h.3head 0444 root bin
+f usr/share/man/man3head/iso646.h.3head 0444 root bin
+f usr/share/man/man3head/langinfo.h.3head 0444 root bin
+f usr/share/man/man3head/libgen.h.3head 0444 root bin
+f usr/share/man/man3head/libintl.h.3head 0444 root bin
+f usr/share/man/man3head/limits.h.3head 0444 root bin
+f usr/share/man/man3head/locale.h.3head 0444 root bin
+f usr/share/man/man3head/math.h.3head 0444 root bin
+f usr/share/man/man3head/mman.h.3head 0444 root bin
+f usr/share/man/man3head/monetary.h.3head 0444 root bin
+f usr/share/man/man3head/mqueue.h.3head 0444 root bin
+f usr/share/man/man3head/msg.h.3head 0444 root bin
+f usr/share/man/man3head/ndbm.h.3head 0444 root bin
+f usr/share/man/man3head/netdb.h.3head 0444 root bin
+f usr/share/man/man3head/nl_types.h.3head 0444 root bin
+f usr/share/man/man3head/poll.h.3head 0444 root bin
+f usr/share/man/man3head/pthread.h.3head 0444 root bin
+f usr/share/man/man3head/pwd.h.3head 0444 root bin
+f usr/share/man/man3head/regex.h.3head 0444 root bin
+f usr/share/man/man3head/resource.h.3head 0444 root bin
+f usr/share/man/man3head/sched.h.3head 0444 root bin
+f usr/share/man/man3head/search.h.3head 0444 root bin
+f usr/share/man/man3head/select.h.3head 0444 root bin
+f usr/share/man/man3head/sem.h.3head 0444 root bin
+f usr/share/man/man3head/semaphore.h.3head 0444 root bin
+f usr/share/man/man3head/setjmp.h.3head 0444 root bin
+f usr/share/man/man3head/shm.h.3head 0444 root bin
+f usr/share/man/man3head/siginfo.h.3head 0444 root bin
+f usr/share/man/man3head/signal.h.3head 0444 root bin
+f usr/share/man/man3head/socket.h.3head 0444 root bin
+f usr/share/man/man3head/spawn.h.3head 0444 root bin
+f usr/share/man/man3head/stat.h.3head 0444 root bin
+f usr/share/man/man3head/statvfs.h.3head 0444 root bin
+f usr/share/man/man3head/stdbool.h.3head 0444 root bin
+f usr/share/man/man3head/stddef.h.3head 0444 root bin
+f usr/share/man/man3head/stdint.h.3head 0444 root bin
+f usr/share/man/man3head/stdio.h.3head 0444 root bin
+f usr/share/man/man3head/stdlib.h.3head 0444 root bin
+f usr/share/man/man3head/string.h.3head 0444 root bin
+f usr/share/man/man3head/strings.h.3head 0444 root bin
+f usr/share/man/man3head/stropts.h.3head 0444 root bin
+f usr/share/man/man3head/syslog.h.3head 0444 root bin
+f usr/share/man/man3head/tar.h.3head 0444 root bin
+f usr/share/man/man3head/tcp.h.3head 0444 root bin
+f usr/share/man/man3head/termios.h.3head 0444 root bin
+f usr/share/man/man3head/tgmath.h.3head 0444 root bin
+f usr/share/man/man3head/time.h.3head 0444 root bin
+f usr/share/man/man3head/timeb.h.3head 0444 root bin
+f usr/share/man/man3head/times.h.3head 0444 root bin
+f usr/share/man/man3head/types.h.3head 0444 root bin
+f usr/share/man/man3head/types32.h.3head 0444 root bin
+f usr/share/man/man3head/ucontext.h.3head 0444 root bin
+f usr/share/man/man3head/uio.h.3head 0444 root bin
+f usr/share/man/man3head/ulimit.h.3head 0444 root bin
+f usr/share/man/man3head/un.h.3head 0444 root bin
+f usr/share/man/man3head/unistd.h.3head 0444 root bin
+f usr/share/man/man3head/utime.h.3head 0444 root bin
+f usr/share/man/man3head/utmpx.h.3head 0444 root bin
+f usr/share/man/man3head/utsname.h.3head 0444 root bin
+f usr/share/man/man3head/values.h.3head 0444 root bin
+f usr/share/man/man3head/wait.h.3head 0444 root bin
+f usr/share/man/man3head/wchar.h.3head 0444 root bin
+f usr/share/man/man3head/wctype.h.3head 0444 root bin
+f usr/share/man/man3head/wordexp.h.3head 0444 root bin
+d usr/share/man/man3kstat 0755 root bin
+f usr/share/man/man3kstat/kstat.3kstat 0444 root bin
+f usr/share/man/man3kstat/kstat_chain_update.3kstat 0444 root bin
+f usr/share/man/man3kstat/kstat_lookup.3kstat 0444 root bin
+f usr/share/man/man3kstat/kstat_open.3kstat 0444 root bin
+f usr/share/man/man3kstat/kstat_read.3kstat 0444 root bin
+d usr/share/man/man3kvm 0755 root bin
+f usr/share/man/man3kvm/kvm_getu.3kvm 0444 root bin
+f usr/share/man/man3kvm/kvm_kread.3kvm 0444 root bin
+f usr/share/man/man3kvm/kvm_nextproc.3kvm 0444 root bin
+f usr/share/man/man3kvm/kvm_nlist.3kvm 0444 root bin
+f usr/share/man/man3kvm/kvm_open.3kvm 0444 root bin
+f usr/share/man/man3kvm/kvm_read.3kvm 0444 root bin
+d usr/share/man/man3ldap 0755 root bin
+f usr/share/man/man3ldap/ber_decode.3ldap 0444 root bin
+f usr/share/man/man3ldap/ber_encode.3ldap 0444 root bin
+f usr/share/man/man3ldap/cldap_close.3ldap 0444 root bin
+f usr/share/man/man3ldap/cldap_open.3ldap 0444 root bin
+f usr/share/man/man3ldap/cldap_search_s.3ldap 0444 root bin
+f usr/share/man/man3ldap/cldap_setretryinfo.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_abandon.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_add.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_ber_free.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_bind.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_charset.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_compare.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_control_free.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_delete.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_disptmpl.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_entry2text.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_error.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_first_attribute.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_first_entry.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_first_message.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_friendly.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_get_dn.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_get_entry_controls.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_get_lang_values.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_get_option.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_get_values.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_getfilter.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_memcache.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_memfree.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_modify.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_modrdn.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_open.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_parse_result.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_result.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_search.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_searchprefs.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_sort.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_ufn.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_url.3ldap 0444 root bin
+f usr/share/man/man3ldap/ldap_version.3ldap 0444 root bin
+d usr/share/man/man3lgrp 0755 root bin
+f usr/share/man/man3lgrp/lgrp_affinity_get.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_children.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_cookie_stale.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_cpus.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_fini.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_home.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_init.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_latency.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_mem_size.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_nlgrps.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_parents.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_resources.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_root.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_version.3lgrp 0444 root bin
+f usr/share/man/man3lgrp/lgrp_view.3lgrp 0444 root bin
+d usr/share/man/man3lib 0755 root bin
+f usr/share/man/man3lib/libMPAPI.3lib 0444 root bin
+f usr/share/man/man3lib/libSMHBAAPI.3lib 0444 root bin
+f usr/share/man/man3lib/libadm.3lib 0444 root bin
+f usr/share/man/man3lib/libaio.3lib 0444 root bin
+f usr/share/man/man3lib/libbsdmalloc.3lib 0444 root bin
+f usr/share/man/man3lib/libbsm.3lib 0444 root bin
+f usr/share/man/man3lib/libc.3lib 0444 root bin
+f usr/share/man/man3lib/libc_db.3lib 0444 root bin
+f usr/share/man/man3lib/libcfgadm.3lib 0444 root bin
+f usr/share/man/man3lib/libcommputil.3lib 0444 root bin
+f usr/share/man/man3lib/libcontract.3lib 0444 root bin
+f usr/share/man/man3lib/libcpc.3lib 0444 root bin
+f usr/share/man/man3lib/libcrypt.3lib 0444 root bin
+f usr/share/man/man3lib/libcurses.3lib 0444 root bin
+f usr/share/man/man3lib/libdat.3lib 0444 root bin
+f usr/share/man/man3lib/libdevid.3lib 0444 root bin
+f usr/share/man/man3lib/libdevinfo.3lib 0444 root bin
+f usr/share/man/man3lib/libdl.3lib 0444 root bin
+f usr/share/man/man3lib/libdlpi.3lib 0444 root bin
+f usr/share/man/man3lib/libdns_sd.3lib 0444 root bin
+f usr/share/man/man3lib/libdoor.3lib 0444 root bin
+f usr/share/man/man3lib/libdtrace.3lib 0444 root bin
+f usr/share/man/man3lib/libefi.3lib 0444 root bin
+f usr/share/man/man3lib/libelf.3lib 0444 root bin
+f usr/share/man/man3lib/libexacct.3lib 0444 root bin
+f usr/share/man/man3lib/libfcoe.3lib 0444 root bin
+f usr/share/man/man3lib/libform.3lib 0444 root bin
+f usr/share/man/man3lib/libfstyp.3lib 0444 root bin
+f usr/share/man/man3lib/libgen.3lib 0444 root bin
+f usr/share/man/man3lib/libgss.3lib 0444 root bin
+f usr/share/man/man3lib/libintl.3lib 0444 root bin
+f usr/share/man/man3lib/libiscsit.3lib 0444 root bin
+f usr/share/man/man3lib/libkmf.3lib 0444 root bin
+f usr/share/man/man3lib/libkrb5.3lib 0444 root bin
+f usr/share/man/man3lib/libkstat.3lib 0444 root bin
+f usr/share/man/man3lib/libkvm.3lib 0444 root bin
+f usr/share/man/man3lib/libl.3lib 0444 root bin
+f usr/share/man/man3lib/liblgrp.3lib 0444 root bin
+f usr/share/man/man3lib/libmail.3lib 0444 root bin
+f usr/share/man/man3lib/libmalloc.3lib 0444 root bin
+f usr/share/man/man3lib/libmapmalloc.3lib 0444 root bin
+f usr/share/man/man3lib/libmd.3lib 0444 root bin
+f usr/share/man/man3lib/libmd5.3lib 0444 root bin
+f usr/share/man/man3lib/libmenu.3lib 0444 root bin
+f usr/share/man/man3lib/libmp.3lib 0444 root bin
+f usr/share/man/man3lib/libmtmalloc.3lib 0444 root bin
+f usr/share/man/man3lib/libnls.3lib 0444 root bin
+f usr/share/man/man3lib/libnsl.3lib 0444 root bin
+f usr/share/man/man3lib/libnvpair.3lib 0444 root bin
+f usr/share/man/man3lib/libpam.3lib 0444 root bin
+f usr/share/man/man3lib/libpanel.3lib 0444 root bin
+f usr/share/man/man3lib/libpctx.3lib 0444 root bin
+f usr/share/man/man3lib/libpicl.3lib 0444 root bin
+f usr/share/man/man3lib/libpicltree.3lib 0444 root bin
+f usr/share/man/man3lib/libpkcs11.3lib 0444 root bin
+f usr/share/man/man3lib/libpool.3lib 0444 root bin
+f usr/share/man/man3lib/libproject.3lib 0444 root bin
+f usr/share/man/man3lib/libpthread.3lib 0444 root bin
+f usr/share/man/man3lib/libresolv.3lib 0444 root bin
+f usr/share/man/man3lib/librpcsvc.3lib 0444 root bin
+f usr/share/man/man3lib/librsm.3lib 0444 root bin
+f usr/share/man/man3lib/librt.3lib 0444 root bin
+f usr/share/man/man3lib/librtld_db.3lib 0444 root bin
+f usr/share/man/man3lib/libsasl.3lib 0444 root bin
+f usr/share/man/man3lib/libscf.3lib 0444 root bin
+f usr/share/man/man3lib/libsctp.3lib 0444 root bin
+f usr/share/man/man3lib/libsec.3lib 0444 root bin
+f usr/share/man/man3lib/libsecdb.3lib 0444 root bin
+f usr/share/man/man3lib/libsendfile.3lib 0444 root bin
+f usr/share/man/man3lib/libsip.3lib 0444 root bin
+f usr/share/man/man3lib/libslp.3lib 0444 root bin
+f usr/share/man/man3lib/libsocket.3lib 0444 root bin
+f usr/share/man/man3lib/libstmf.3lib 0444 root bin
+f usr/share/man/man3lib/libsys.3lib 0444 root bin
+f usr/share/man/man3lib/libsysevent.3lib 0444 root bin
+f usr/share/man/man3lib/libtecla.3lib 0444 root bin
+f usr/share/man/man3lib/libthread.3lib 0444 root bin
+f usr/share/man/man3lib/libtnfctl.3lib 0444 root bin
+f usr/share/man/man3lib/libtsalarm.3lib 0444 root bin
+f usr/share/man/man3lib/libumem.3lib 0444 root bin
+f usr/share/man/man3lib/libuuid.3lib 0444 root bin
+f usr/share/man/man3lib/libvolmgt.3lib 0444 root bin
+f usr/share/man/man3lib/libw.3lib 0444 root bin
+f usr/share/man/man3lib/libxnet.3lib 0444 root bin
+f usr/share/man/man3lib/liby.3lib 0444 root bin
+d usr/share/man/man3libucb 0755 root bin
+f usr/share/man/man3libucb/libcurses.3libucb 0444 root bin
+f usr/share/man/man3libucb/libdbm.3libucb 0444 root bin
+f usr/share/man/man3libucb/librpcsoc.3libucb 0444 root bin
+f usr/share/man/man3libucb/libtermcap.3libucb 0444 root bin
+f usr/share/man/man3libucb/libucb.3libucb 0444 root bin
+d usr/share/man/man3malloc 0755 root bin
+f usr/share/man/man3malloc/bsdmalloc.3malloc 0444 root bin
+f usr/share/man/man3malloc/malloc.3malloc 0444 root bin
+f usr/share/man/man3malloc/mapmalloc.3malloc 0444 root bin
+f usr/share/man/man3malloc/mtmalloc.3malloc 0444 root bin
+f usr/share/man/man3malloc/umem_alloc.3malloc 0444 root bin
+f usr/share/man/man3malloc/umem_cache_create.3malloc 0444 root bin
+f usr/share/man/man3malloc/umem_debug.3malloc 0444 root bin
+f usr/share/man/man3malloc/watchmalloc.3malloc 0444 root bin
+d usr/share/man/man3mp 0755 root bin
+f usr/share/man/man3mp/mp.3mp 0444 root bin
+d usr/share/man/man3mpapi 0755 root bin
+f usr/share/man/man3mpapi/MP_AssignLogicalUnitToTPG.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_CancelOverridePath.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_CompareOIDs.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_DeregisterForObjectPropertyChanges.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_DeregisterForObjectVisibilityChanges.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_DeregisterPlugin.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_DisableAutoFailback.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_DisableAutoProbing.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_DisablePath.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_EnableAutoFailback.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_EnableAutoProbing.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_EnablePath.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_FreeOidList.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetAssociatedPathOidList.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetAssociatedPluginOid.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetAssociatedTPGOidList.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetDeviceProductOidList.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetDeviceProductProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetInitiatorPortOidList.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetInitiatorPortProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetLibraryProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetMPLogicalUnitProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetMPLuOidListFromTPG.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetMultipathLus.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetObjectType.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetPathLogicalUnitProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetPluginOidList.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetPluginProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetProprietaryLoadBalanceOidList.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetProprietaryLoadBalanceProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetTargetPortGroupProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetTargetPortOidList.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_GetTargetPortProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_RegisterForObjectPropertyChanges.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_RegisterForObjectVisibilityChanges.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_RegisterPlugin.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_SetFailbackPollingRate.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_SetLogicalUnitLoadBalanceType.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_SetOverridePath.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_SetPathWeight.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_SetPluginLoadBalanceType.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_SetProbingPollingRate.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_SetProprietaryProperties.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/MP_SetTPGAccess.3mpapi 0444 root bin
+f usr/share/man/man3mpapi/Sun_MP_SendScsiCmd.3mpapi 0444 root bin
+d usr/share/man/man3nsl 0755 root bin
+f usr/share/man/man3nsl/dial.3nsl 0444 root bin
+f usr/share/man/man3nsl/doconfig.3nsl 0444 root bin
+f usr/share/man/man3nsl/gethostbyname.3nsl 0444 root bin
+f usr/share/man/man3nsl/getipsecalgbyname.3nsl 0444 root bin
+f usr/share/man/man3nsl/getipsecprotobyname.3nsl 0444 root bin
+f usr/share/man/man3nsl/getnetconfig.3nsl 0444 root bin
+f usr/share/man/man3nsl/getnetpath.3nsl 0444 root bin
+f usr/share/man/man3nsl/getpublickey.3nsl 0444 root bin
+f usr/share/man/man3nsl/getrpcbyname.3nsl 0444 root bin
+f usr/share/man/man3nsl/netdir.3nsl 0444 root bin
+f usr/share/man/man3nsl/nlsgetcall.3nsl 0444 root bin
+f usr/share/man/man3nsl/nlsprovider.3nsl 0444 root bin
+f usr/share/man/man3nsl/nlsrequest.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_clnt_auth.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_clnt_calls.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_clnt_create.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_control.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_get_error.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_get_mechanisms.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_get_principal_name.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_getcred.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_max_data_length.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_mech_to_oid.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_seccreate.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_set_callback.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_set_defaults.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_gss_set_svc_name.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_soc.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_svc_calls.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_svc_create.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_svc_err.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_svc_input.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_svc_reg.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpc_xdr.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpcbind.3nsl 0444 root bin
+f usr/share/man/man3nsl/rpcsec_gss.3nsl 0444 root bin
+f usr/share/man/man3nsl/secure_rpc.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_accept.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_alloc.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_bind.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_close.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_connect.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_errno.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_error.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_free.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_getinfo.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_getprotaddr.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_getstate.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_listen.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_look.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_open.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_optmgmt.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcv.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcvconnect.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcvdis.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcvrel.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcvreldata.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcvudata.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcvuderr.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcvv.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_rcvvudata.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_snd.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_snddis.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_sndrel.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_sndreldata.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_sndudata.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_sndv.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_sndvudata.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_strerror.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_sync.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_sysconf.3nsl 0444 root bin
+f usr/share/man/man3nsl/t_unbind.3nsl 0444 root bin
+f usr/share/man/man3nsl/xdr.3nsl 0444 root bin
+f usr/share/man/man3nsl/xdr_admin.3nsl 0444 root bin
+f usr/share/man/man3nsl/xdr_complex.3nsl 0444 root bin
+f usr/share/man/man3nsl/xdr_create.3nsl 0444 root bin
+f usr/share/man/man3nsl/xdr_simple.3nsl 0444 root bin
+f usr/share/man/man3nsl/yp_update.3nsl 0444 root bin
+f usr/share/man/man3nsl/ypclnt.3nsl 0444 root bin
+d usr/share/man/man3nvpair 0755 root bin
+f usr/share/man/man3nvpair/nvlist_add_boolean.3nvpair 0444 root bin
+f usr/share/man/man3nvpair/nvlist_alloc.3nvpair 0444 root bin
+f usr/share/man/man3nvpair/nvlist_lookup_boolean.3nvpair 0444 root bin
+f usr/share/man/man3nvpair/nvlist_lookup_nvpair.3nvpair 0444 root bin
+f usr/share/man/man3nvpair/nvlist_next_nvpair.3nvpair 0444 root bin
+f usr/share/man/man3nvpair/nvlist_remove.3nvpair 0444 root bin
+f usr/share/man/man3nvpair/nvpair_value_byte.3nvpair 0444 root bin
+d usr/share/man/man3pam 0755 root bin
+f usr/share/man/man3pam/pam.3pam 0444 root bin
+f usr/share/man/man3pam/pam_acct_mgmt.3pam 0444 root bin
+f usr/share/man/man3pam/pam_authenticate.3pam 0444 root bin
+f usr/share/man/man3pam/pam_chauthtok.3pam 0444 root bin
+f usr/share/man/man3pam/pam_get_user.3pam 0444 root bin
+f usr/share/man/man3pam/pam_getenv.3pam 0444 root bin
+f usr/share/man/man3pam/pam_getenvlist.3pam 0444 root bin
+f usr/share/man/man3pam/pam_open_session.3pam 0444 root bin
+f usr/share/man/man3pam/pam_putenv.3pam 0444 root bin
+f usr/share/man/man3pam/pam_set_data.3pam 0444 root bin
+f usr/share/man/man3pam/pam_set_item.3pam 0444 root bin
+f usr/share/man/man3pam/pam_setcred.3pam 0444 root bin
+f usr/share/man/man3pam/pam_sm.3pam 0444 root bin
+f usr/share/man/man3pam/pam_sm_acct_mgmt.3pam 0444 root bin
+f usr/share/man/man3pam/pam_sm_authenticate.3pam 0444 root bin
+f usr/share/man/man3pam/pam_sm_chauthtok.3pam 0444 root bin
+f usr/share/man/man3pam/pam_sm_open_session.3pam 0444 root bin
+f usr/share/man/man3pam/pam_sm_setcred.3pam 0444 root bin
+f usr/share/man/man3pam/pam_start.3pam 0444 root bin
+f usr/share/man/man3pam/pam_strerror.3pam 0444 root bin
+d usr/share/man/man3papi 0755 root bin
+f usr/share/man/man3papi/papiAttributeListAddValue.3papi 0444 root bin
+f usr/share/man/man3papi/papiJobSubmit.3papi 0444 root bin
+f usr/share/man/man3papi/papiLibrarySupportedCall.3papi 0444 root bin
+f usr/share/man/man3papi/papiPrintersList.3papi 0444 root bin
+f usr/share/man/man3papi/papiServiceCreate.3papi 0444 root bin
+f usr/share/man/man3papi/papiStatusString.3papi 0444 root bin
+d usr/share/man/man3perl 0755 root bin
+f usr/share/man/man3perl/Exacct.3perl 0444 root bin
+f usr/share/man/man3perl/Exacct::Catalog.3perl 0444 root bin
+f usr/share/man/man3perl/Exacct::File.3perl 0444 root bin
+f usr/share/man/man3perl/Exacct::Object.3perl 0444 root bin
+f usr/share/man/man3perl/Exacct::Object::Group.3perl 0444 root bin
+f usr/share/man/man3perl/Exacct::Object::Item.3perl 0444 root bin
+f usr/share/man/man3perl/Kstat.3perl 0444 root bin
+f usr/share/man/man3perl/Lgrp.3perl 0444 root bin
+f usr/share/man/man3perl/Privilege.3perl 0444 root bin
+f usr/share/man/man3perl/Project.3perl 0444 root bin
+f usr/share/man/man3perl/Task.3perl 0444 root bin
+f usr/share/man/man3perl/Ucred.3perl 0444 root bin
+d usr/share/man/man3picl 0755 root bin
+f usr/share/man/man3picl/libpicl.3picl 0444 root bin
+f usr/share/man/man3picl/picl_find_node.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_first_prop.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_frutree_parent.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_next_by_row.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_node_by_path.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_prop_by_name.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_propinfo.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_propinfo_by_name.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_propval.3picl 0444 root bin
+f usr/share/man/man3picl/picl_get_root.3picl 0444 root bin
+f usr/share/man/man3picl/picl_initialize.3picl 0444 root bin
+f usr/share/man/man3picl/picl_set_propval.3picl 0444 root bin
+f usr/share/man/man3picl/picl_shutdown.3picl 0444 root bin
+f usr/share/man/man3picl/picl_strerror.3picl 0444 root bin
+f usr/share/man/man3picl/picl_wait.3picl 0444 root bin
+f usr/share/man/man3picl/picl_walk_tree_by_class.3picl 0444 root bin
+d usr/share/man/man3picltree 0755 root bin
+f usr/share/man/man3picltree/libpicltree.3picltree 0444 root bin
+f usr/share/man/man3picltree/picld_log.3picltree 0444 root bin
+f usr/share/man/man3picltree/picld_plugin_register.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_add_node.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_add_prop.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_create_and_add_node.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_create_and_add_prop.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_create_node.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_create_prop.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_create_table.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_find_node.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_first_prop.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_frutree_parent.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_next_by_row.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_node_by_path.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_prop_by_name.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_propinfo.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_propinfo_by_name.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_propval.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_get_root.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_init_propinfo.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_post_event.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_register_handler.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_unregister_handler.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_update_propval.3picltree 0444 root bin
+f usr/share/man/man3picltree/ptree_walk_tree_by_class.3picltree 0444 root bin
+d usr/share/man/man3pool 0755 root bin
+f usr/share/man/man3pool/pool_associate.3pool 0444 root bin
+f usr/share/man/man3pool/pool_component_info.3pool 0444 root bin
+f usr/share/man/man3pool/pool_component_to_elem.3pool 0444 root bin
+f usr/share/man/man3pool/pool_conf_alloc.3pool 0444 root bin
+f usr/share/man/man3pool/pool_dynamic_location.3pool 0444 root bin
+f usr/share/man/man3pool/pool_error.3pool 0444 root bin
+f usr/share/man/man3pool/pool_get_binding.3pool 0444 root bin
+f usr/share/man/man3pool/pool_get_pool.3pool 0444 root bin
+f usr/share/man/man3pool/pool_get_property.3pool 0444 root bin
+f usr/share/man/man3pool/pool_resource_create.3pool 0444 root bin
+f usr/share/man/man3pool/pool_value_alloc.3pool 0444 root bin
+f usr/share/man/man3pool/pool_walk_components.3pool 0444 root bin
+d usr/share/man/man3proc 0755 root bin
+f usr/share/man/man3proc/proc_service.3proc 0444 root bin
+f usr/share/man/man3proc/ps_lgetregs.3proc 0444 root bin
+f usr/share/man/man3proc/ps_pglobal_lookup.3proc 0444 root bin
+f usr/share/man/man3proc/ps_pread.3proc 0444 root bin
+f usr/share/man/man3proc/ps_pstop.3proc 0444 root bin
+d usr/share/man/man3project 0755 root bin
+f usr/share/man/man3project/getprojent.3project 0444 root bin
+f usr/share/man/man3project/project_walk.3project 0444 root bin
+f usr/share/man/man3project/setproject.3project 0444 root bin
+d usr/share/man/man3resolv 0755 root bin
+f usr/share/man/man3resolv/dn_comp.3resolv 0444 root bin
+f usr/share/man/man3resolv/dn_expand.3resolv 0444 root bin
+f usr/share/man/man3resolv/fp_resstat.3resolv 0444 root bin
+f usr/share/man/man3resolv/herror.3resolv 0444 root bin
+f usr/share/man/man3resolv/hstrerror.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_getservers.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_hostalias.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_init.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_mkquery.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_nclose.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_ndestroy.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_ninit.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_nmkquery.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_nquery.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_nquerydomain.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_nsearch.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_nsend.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_nsendsigned.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_query.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_search.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_send.3resolv 0444 root bin
+f usr/share/man/man3resolv/res_setservers.3resolv 0444 root bin
+f usr/share/man/man3resolv/resolver.3resolv 0444 root bin
+d usr/share/man/man3rpc 0755 root bin
+f usr/share/man/man3rpc/rstat.3rpc 0444 root bin
+f usr/share/man/man3rpc/rusers.3rpc 0444 root bin
+f usr/share/man/man3rpc/rwall.3rpc 0444 root bin
+d usr/share/man/man3rsm 0755 root bin
+f usr/share/man/man3rsm/rsm_create_localmemory_handle.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_get_controller.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_get_interconnect_topology.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_get_segmentid_range.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_intr_signal_post.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_intr_signal_wait_pollfd.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_export_create.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_export_publish.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_get_pollfd.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_import_connect.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_import_get.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_import_init_barrier.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_import_map.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_import_open_barrier.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_import_put.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_import_putv.3rsm 0444 root bin
+f usr/share/man/man3rsm/rsm_memseg_import_set_mode.3rsm 0444 root bin
+d usr/share/man/man3sasl 0755 root bin
+f usr/share/man/man3sasl/sasl_authorize_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_auxprop.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_auxprop_add_plugin.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_auxprop_getctx.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_auxprop_request.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_canon_user_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_canonuser_add_plugin.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_chalprompt_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_checkapop.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_checkpass.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_client_add_plugin.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_client_init.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_client_new.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_client_plug_init_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_client_start.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_client_step.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_decode.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_decode64.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_dispose.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_done.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_encode.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_encode64.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_erasebuffer.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_errdetail.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_errors.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_errstring.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_getcallback_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_getopt_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_getpath_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_getprop.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_getrealm_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_getsecret_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_getsimple_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_global_listmech.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_idle.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_listmech.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_log_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_server_add_plugin.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_server_init.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_server_new.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_server_plug_init_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_server_start.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_server_step.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_server_userdb_checkpass_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_server_userdb_setpass_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_set_alloc.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_set_mutex.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_seterror.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_setpass.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_setprop.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_utf8verify.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_verifyfile_t.3sasl 0444 root bin
+f usr/share/man/man3sasl/sasl_version.3sasl 0444 root bin
+d usr/share/man/man3scf 0755 root bin
+f usr/share/man/man3scf/scf_entry_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_error.3scf 0444 root bin
+f usr/share/man/man3scf/scf_handle_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_handle_decode_fmri.3scf 0444 root bin
+f usr/share/man/man3scf/scf_instance_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_iter_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_limit.3scf 0444 root bin
+f usr/share/man/man3scf/scf_pg_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_property_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_scope_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_service_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_simple_prop_get.3scf 0444 root bin
+f usr/share/man/man3scf/scf_simple_walk_instances.3scf 0444 root bin
+f usr/share/man/man3scf/scf_snaplevel_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_snapshot_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_tmpl_pg_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_tmpl_pg_name.3scf 0444 root bin
+f usr/share/man/man3scf/scf_tmpl_prop_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_tmpl_prop_name.3scf 0444 root bin
+f usr/share/man/man3scf/scf_tmpl_validate_fmri.3scf 0444 root bin
+f usr/share/man/man3scf/scf_transaction_create.3scf 0444 root bin
+f usr/share/man/man3scf/scf_value_create.3scf 0444 root bin
+f usr/share/man/man3scf/smf_enable_instance.3scf 0444 root bin
+d usr/share/man/man3sec 0755 root bin
+f usr/share/man/man3sec/acl_check.3sec 0444 root bin
+f usr/share/man/man3sec/acl_free.3sec 0444 root bin
+f usr/share/man/man3sec/acl_get.3sec 0444 root bin
+f usr/share/man/man3sec/acl_strip.3sec 0444 root bin
+f usr/share/man/man3sec/acl_totext.3sec 0444 root bin
+f usr/share/man/man3sec/acl_trivial.3sec 0444 root bin
+f usr/share/man/man3sec/aclcheck.3sec 0444 root bin
+f usr/share/man/man3sec/aclsort.3sec 0444 root bin
+f usr/share/man/man3sec/acltomode.3sec 0444 root bin
+f usr/share/man/man3sec/acltotext.3sec 0444 root bin
+d usr/share/man/man3secdb 0755 root bin
+f usr/share/man/man3secdb/getauthattr.3secdb 0444 root bin
+f usr/share/man/man3secdb/getexecattr.3secdb 0444 root bin
+f usr/share/man/man3secdb/getprofattr.3secdb 0444 root bin
+f usr/share/man/man3secdb/getuserattr.3secdb 0444 root bin
+f usr/share/man/man3secdb/kva_match.3secdb 0444 root bin
+d usr/share/man/man3sip 0755 root bin
+f usr/share/man/man3sip/sip_add_branchid_to_via.3sip 0444 root bin
+f usr/share/man/man3sip/sip_add_from.3sip 0444 root bin
+f usr/share/man/man3sip/sip_add_header.3sip 0444 root bin
+f usr/share/man/man3sip/sip_add_param.3sip 0444 root bin
+f usr/share/man/man3sip/sip_add_request_line.3sip 0444 root bin
+f usr/share/man/man3sip/sip_branchid.3sip 0444 root bin
+f usr/share/man/man3sip/sip_clone_msg.3sip 0444 root bin
+f usr/share/man/man3sip/sip_copy_start_line.3sip 0444 root bin
+f usr/share/man/man3sip/sip_create_OKack.3sip 0444 root bin
+f usr/share/man/man3sip/sip_create_dialog_req.3sip 0444 root bin
+f usr/share/man/man3sip/sip_create_response.3sip 0444 root bin
+f usr/share/man/man3sip/sip_delete_dialog.3sip 0444 root bin
+f usr/share/man/man3sip/sip_delete_start_line.3sip 0444 root bin
+f usr/share/man/man3sip/sip_enable_counters.3sip 0444 root bin
+f usr/share/man/man3sip/sip_enable_trans_logging.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_contact_display_name.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_cseq.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_dialog_state.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_header.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_header_value.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_msg_len.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_num_via.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_param_value.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_request_method.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_request_uri_str.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_resp_desc.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_trans.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_trans_method.3sip 0444 root bin
+f usr/share/man/man3sip/sip_get_uri_parsed.3sip 0444 root bin
+f usr/share/man/man3sip/sip_guid.3sip 0444 root bin
+f usr/share/man/man3sip/sip_hold_dialog.3sip 0444 root bin
+f usr/share/man/man3sip/sip_hold_msg.3sip 0444 root bin
+f usr/share/man/man3sip/sip_hold_trans.3sip 0444 root bin
+f usr/share/man/man3sip/sip_init_conn_object.3sip 0444 root bin
+f usr/share/man/man3sip/sip_is_sip_uri.3sip 0444 root bin
+f usr/share/man/man3sip/sip_msg_is_request.3sip 0444 root bin
+f usr/share/man/man3sip/sip_msg_to_str.3sip 0444 root bin
+f usr/share/man/man3sip/sip_new_msg.3sip 0444 root bin
+f usr/share/man/man3sip/sip_parse_uri.3sip 0444 root bin
+f usr/share/man/man3sip/sip_process_new_packet.3sip 0444 root bin
+f usr/share/man/man3sip/sip_register_sent_by.3sip 0444 root bin
+f usr/share/man/man3sip/sip_sendmsg.3sip 0444 root bin
+f usr/share/man/man3sip/sip_stack_init.3sip 0444 root bin
+d usr/share/man/man3slp 0755 root bin
+f usr/share/man/man3slp/SLPClose.3slp 0444 root bin
+f usr/share/man/man3slp/SLPDelAttrs.3slp 0444 root bin
+f usr/share/man/man3slp/SLPDereg.3slp 0444 root bin
+f usr/share/man/man3slp/SLPEscape.3slp 0444 root bin
+f usr/share/man/man3slp/SLPFindAttrs.3slp 0444 root bin
+f usr/share/man/man3slp/SLPFindScopes.3slp 0444 root bin
+f usr/share/man/man3slp/SLPFindSrvTypes.3slp 0444 root bin
+f usr/share/man/man3slp/SLPFindSrvs.3slp 0444 root bin
+f usr/share/man/man3slp/SLPFree.3slp 0444 root bin
+f usr/share/man/man3slp/SLPGetProperty.3slp 0444 root bin
+f usr/share/man/man3slp/SLPGetRefreshInterval.3slp 0444 root bin
+f usr/share/man/man3slp/SLPOpen.3slp 0444 root bin
+f usr/share/man/man3slp/SLPParseSrvURL.3slp 0444 root bin
+f usr/share/man/man3slp/SLPReg.3slp 0444 root bin
+f usr/share/man/man3slp/SLPSetProperty.3slp 0444 root bin
+f usr/share/man/man3slp/SLPUnescape.3slp 0444 root bin
+f usr/share/man/man3slp/slp_api.3slp 0444 root bin
+f usr/share/man/man3slp/slp_strerror.3slp 0444 root bin
+d usr/share/man/man3socket 0755 root bin
+f usr/share/man/man3socket/accept.3socket 0444 root bin
+f usr/share/man/man3socket/bind.3socket 0444 root bin
+f usr/share/man/man3socket/byteorder.3socket 0444 root bin
+f usr/share/man/man3socket/connect.3socket 0444 root bin
+f usr/share/man/man3socket/ethers.3socket 0444 root bin
+f usr/share/man/man3socket/freeifaddrs.3socket 0444 root bin
+f usr/share/man/man3socket/getaddrinfo.3socket 0444 root bin
+f usr/share/man/man3socket/getifaddrs.3socket 0444 root bin
+f usr/share/man/man3socket/getipnodebyname.3socket 0444 root bin
+f usr/share/man/man3socket/getnetbyname.3socket 0444 root bin
+f usr/share/man/man3socket/getpeername.3socket 0444 root bin
+f usr/share/man/man3socket/getprotobyname.3socket 0444 root bin
+f usr/share/man/man3socket/getservbyname.3socket 0444 root bin
+f usr/share/man/man3socket/getsockname.3socket 0444 root bin
+f usr/share/man/man3socket/getsockopt.3socket 0444 root bin
+f usr/share/man/man3socket/getsourcefilter.3socket 0444 root bin
+f usr/share/man/man3socket/icmp6_filter.3socket 0444 root bin
+f usr/share/man/man3socket/if_nametoindex.3socket 0444 root bin
+f usr/share/man/man3socket/inet.3socket 0444 root bin
+f usr/share/man/man3socket/inet6_opt.3socket 0444 root bin
+f usr/share/man/man3socket/inet6_rth.3socket 0444 root bin
+f usr/share/man/man3socket/inet_aton.3socket 0444 root bin
+f usr/share/man/man3socket/inet_ntoa.3socket 0444 root bin
+f usr/share/man/man3socket/listen.3socket 0444 root bin
+f usr/share/man/man3socket/rcmd.3socket 0444 root bin
+f usr/share/man/man3socket/recv.3socket 0444 root bin
+f usr/share/man/man3socket/rexec.3socket 0444 root bin
+f usr/share/man/man3socket/sctp_bindx.3socket 0444 root bin
+f usr/share/man/man3socket/sctp_getladdrs.3socket 0444 root bin
+f usr/share/man/man3socket/sctp_getpaddrs.3socket 0444 root bin
+f usr/share/man/man3socket/sctp_opt_info.3socket 0444 root bin
+f usr/share/man/man3socket/sctp_peeloff.3socket 0444 root bin
+f usr/share/man/man3socket/sctp_recvmsg.3socket 0444 root bin
+f usr/share/man/man3socket/sctp_send.3socket 0444 root bin
+f usr/share/man/man3socket/sctp_sendmsg.3socket 0444 root bin
+f usr/share/man/man3socket/send.3socket 0444 root bin
+f usr/share/man/man3socket/shutdown.3socket 0444 root bin
+f usr/share/man/man3socket/socket.3socket 0444 root bin
+f usr/share/man/man3socket/socketpair.3socket 0444 root bin
+f usr/share/man/man3socket/spray.3socket 0444 root bin
+d usr/share/man/man3stmf 0755 root bin
+f usr/share/man/man3stmf/stmfAddToHostGroup.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfAddToTargetGroup.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfAddViewEntry.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfClearProviderData.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfCreateHostGroup.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfCreateLu.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfCreateLuResource.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfCreateTargetGroup.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfDeleteHostGroup.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfDeleteLu.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfDeleteTargetGroup.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfDevidFromIscsiName.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfDevidFromWwn.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfFreeLuResource.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfFreeMemory.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetHostGroupList.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetHostGroupMembers.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetLogicalUnitList.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetLogicalUnitProperties.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetLuResource.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetPersistMethod.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetProviderData.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetProviderDataProt.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetState.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetTargetGroupList.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetTargetGroupMembers.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetTargetList.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetTargetProperties.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfGetViewEntryList.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfModifyLu.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfOfflineLogicalUnit.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfOfflineTarget.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfOnlineLogicalUnit.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfOnlineTarget.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfRemoveFromHostGroup.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfRemoveFromTargetGroup.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfRemoveViewEntry.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfSetLuProp.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfSetPersistMethod.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfSetProviderData.3stmf 0444 root bin
+f usr/share/man/man3stmf/stmfSetProviderDataProt.3stmf 0444 root bin
+d usr/share/man/man3sysevent 0755 root bin
+f usr/share/man/man3sysevent/sysevent_bind_handle.3sysevent 0444 root bin
+f usr/share/man/man3sysevent/sysevent_free.3sysevent 0444 root bin
+f usr/share/man/man3sysevent/sysevent_get_attr_list.3sysevent 0444 root bin
+f usr/share/man/man3sysevent/sysevent_get_class_name.3sysevent 0444 root bin
+f usr/share/man/man3sysevent/sysevent_get_vendor_name.3sysevent 0444 root bin
+f usr/share/man/man3sysevent/sysevent_post_event.3sysevent 0444 root bin
+f usr/share/man/man3sysevent/sysevent_subscribe_event.3sysevent 0444 root bin
+d usr/share/man/man3tecla 0755 root bin
+f usr/share/man/man3tecla/cpl_complete_word.3tecla 0444 root bin
+f usr/share/man/man3tecla/ef_expand_file.3tecla 0444 root bin
+f usr/share/man/man3tecla/gl_get_line.3tecla 0444 root bin
+f usr/share/man/man3tecla/gl_io_mode.3tecla 0444 root bin
+f usr/share/man/man3tecla/libtecla_version.3tecla 0444 root bin
+f usr/share/man/man3tecla/pca_lookup_file.3tecla 0444 root bin
+d usr/share/man/man3tnf 0755 root bin
+f usr/share/man/man3tnf/TNF_DECLARE_RECORD.3tnf 0444 root bin
+f usr/share/man/man3tnf/TNF_PROBE.3tnf 0444 root bin
+f usr/share/man/man3tnf/libtnfctl.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnf_process_disable.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_buffer_alloc.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_close.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_indirect_open.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_internal_open.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_kernel_open.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_pid_open.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_probe_apply.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_probe_state_get.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_register_funcs.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_strerror.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_trace_attrs_get.3tnf 0444 root bin
+f usr/share/man/man3tnf/tnfctl_trace_state_set.3tnf 0444 root bin
+f usr/share/man/man3tnf/tracing.3tnf 0444 root bin
+d usr/share/man/man3ucb 0755 root bin
+f usr/share/man/man3ucb/dbm.3ucb 0444 root bin
+f usr/share/man/man3ucb/flock.3ucb 0444 root bin
+f usr/share/man/man3ucb/fopen.3ucb 0444 root bin
+f usr/share/man/man3ucb/gettimeofday.3ucb 0444 root bin
+f usr/share/man/man3ucb/mctl.3ucb 0444 root bin
+f usr/share/man/man3ucb/nice.3ucb 0444 root bin
+f usr/share/man/man3ucb/nlist.3ucb 0444 root bin
+f usr/share/man/man3ucb/printf.3ucb 0444 root bin
+f usr/share/man/man3ucb/psignal.3ucb 0444 root bin
+f usr/share/man/man3ucb/rand.3ucb 0444 root bin
+f usr/share/man/man3ucb/readdir.3ucb 0444 root bin
+f usr/share/man/man3ucb/scandir.3ucb 0444 root bin
+f usr/share/man/man3ucb/setjmp.3ucb 0444 root bin
+f usr/share/man/man3ucb/sigblock.3ucb 0444 root bin
+f usr/share/man/man3ucb/siginterrupt.3ucb 0444 root bin
+f usr/share/man/man3ucb/signal.3ucb 0444 root bin
+f usr/share/man/man3ucb/sigstack.3ucb 0444 root bin
+f usr/share/man/man3ucb/sigvec.3ucb 0444 root bin
+f usr/share/man/man3ucb/sleep.3ucb 0444 root bin
+f usr/share/man/man3ucb/syscall.3ucb 0444 root bin
+f usr/share/man/man3ucb/times.3ucb 0444 root bin
+f usr/share/man/man3ucb/wait.3ucb 0444 root bin
+d usr/share/man/man3uuid 0755 root bin
+f usr/share/man/man3uuid/uuid_clear.3uuid 0444 root bin
+d usr/share/man/man3volmgt 0755 root bin
+f usr/share/man/man3volmgt/media_findname.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/media_getattr.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/media_getid.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_acquire.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_check.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_feature_enabled.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_inuse.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_ownspath.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_release.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_root.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_running.3volmgt 0444 root bin
+f usr/share/man/man3volmgt/volmgt_symname.3volmgt 0444 root bin
+d usr/share/man/man3x11 0755 root bin
+d usr/share/man/man3xau 0755 root bin
+d usr/share/man/man3xaw 0755 root bin
+d usr/share/man/man3xcurses 0755 root bin
+f usr/share/man/man3xcurses/COLS.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/LINES.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/add_wch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/add_wchnstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/addch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/addchstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/addnstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/addnwstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/attr_get.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/attroff.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/baudrate.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/beep.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/bkgd.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/bkgrnd.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/border.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/border_set.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/can_change_color.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/cbreak.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/chgat.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/clear.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/clearok.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/clrtobot.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/clrtoeol.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/copywin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/cur_term.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/curs_set.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/curscr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/curses.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/def_prog_mode.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/del_curterm.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/delay_output.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/delch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/deleteln.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/delscreen.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/delwin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/derwin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/doupdate.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/dupwin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/echo.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/echo_wchar.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/echochar.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/endwin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/erasechar.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/filter.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/flushinp.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/get_wch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/getbegyx.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/getcchar.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/getch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/getn_wstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/getnstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/getwin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/halfdelay.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/has_ic.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/hline.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/hline_set.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/idcok.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/immedok.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/in_wch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/in_wchnstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/inch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/inchnstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/initscr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/innstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/innwstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/ins_nwstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/ins_wch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/insch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/insdelln.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/insertln.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/insnstr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/intrflush.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/is_linetouched.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/keyname.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/keypad.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/libcurses.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/longname.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/meta.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/move.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/mvcur.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/mvderwin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/mvprintw.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/mvscanw.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/mvwin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/napms.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/newpad.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/nl.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/nodelay.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/noqiflush.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/notimeout.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/overlay.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/pechochar.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/putp.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/redrawwin.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/resetty.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/ripoffline.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/scr_dump.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/scrl.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/set_term.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/setcchar.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/slk_attroff.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/standend.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/stdscr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/syncok.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/termattrs.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/termname.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/tgetent.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/tigetflag.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/typeahead.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/unctrl.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/ungetch.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/use_env.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/vidattr.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/vw_printw.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/vw_scanw.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/vwprintw.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/vwscanw.3xcurses 0444 root bin
+f usr/share/man/man3xcurses/wunctrl.3xcurses 0444 root bin
+d usr/share/man/man3xext 0755 root bin
+d usr/share/man/man3xmu 0755 root bin
+d usr/share/man/man3xnet 0755 root bin
+f usr/share/man/man3xnet/accept.3xnet 0444 root bin
+f usr/share/man/man3xnet/bind.3xnet 0444 root bin
+f usr/share/man/man3xnet/connect.3xnet 0444 root bin
+f usr/share/man/man3xnet/endhostent.3xnet 0444 root bin
+f usr/share/man/man3xnet/endnetent.3xnet 0444 root bin
+f usr/share/man/man3xnet/endprotoent.3xnet 0444 root bin
+f usr/share/man/man3xnet/endservent.3xnet 0444 root bin
+f usr/share/man/man3xnet/freeaddrinfo.3xnet 0444 root bin
+f usr/share/man/man3xnet/gai_strerror.3xnet 0444 root bin
+f usr/share/man/man3xnet/getaddrinfo.3xnet 0444 root bin
+f usr/share/man/man3xnet/gethostbyaddr.3xnet 0444 root bin
+f usr/share/man/man3xnet/gethostbyname.3xnet 0444 root bin
+f usr/share/man/man3xnet/gethostent.3xnet 0444 root bin
+f usr/share/man/man3xnet/gethostname.3xnet 0444 root bin
+f usr/share/man/man3xnet/getnameinfo.3xnet 0444 root bin
+f usr/share/man/man3xnet/getnetbyaddr.3xnet 0444 root bin
+f usr/share/man/man3xnet/getnetbyname.3xnet 0444 root bin
+f usr/share/man/man3xnet/getnetent.3xnet 0444 root bin
+f usr/share/man/man3xnet/getpeername.3xnet 0444 root bin
+f usr/share/man/man3xnet/getprotobyname.3xnet 0444 root bin
+f usr/share/man/man3xnet/getprotobynumber.3xnet 0444 root bin
+f usr/share/man/man3xnet/getprotoent.3xnet 0444 root bin
+f usr/share/man/man3xnet/getservbyname.3xnet 0444 root bin
+f usr/share/man/man3xnet/getservbyport.3xnet 0444 root bin
+f usr/share/man/man3xnet/getservent.3xnet 0444 root bin
+f usr/share/man/man3xnet/getsockname.3xnet 0444 root bin
+f usr/share/man/man3xnet/getsockopt.3xnet 0444 root bin
+f usr/share/man/man3xnet/htonl.3xnet 0444 root bin
+f usr/share/man/man3xnet/htonll.3xnet 0444 root bin
+f usr/share/man/man3xnet/htons.3xnet 0444 root bin
+f usr/share/man/man3xnet/if_freenameindex.3xnet 0444 root bin
+f usr/share/man/man3xnet/if_indextoname.3xnet 0444 root bin
+f usr/share/man/man3xnet/if_nameindex.3xnet 0444 root bin
+f usr/share/man/man3xnet/if_nametoindex.3xnet 0444 root bin
+f usr/share/man/man3xnet/inet_addr.3xnet 0444 root bin
+f usr/share/man/man3xnet/inet_lnaof.3xnet 0444 root bin
+f usr/share/man/man3xnet/inet_makeaddr.3xnet 0444 root bin
+f usr/share/man/man3xnet/inet_netof.3xnet 0444 root bin
+f usr/share/man/man3xnet/inet_network.3xnet 0444 root bin
+f usr/share/man/man3xnet/inet_ntoa.3xnet 0444 root bin
+f usr/share/man/man3xnet/inet_ntop.3xnet 0444 root bin
+f usr/share/man/man3xnet/inet_pton.3xnet 0444 root bin
+f usr/share/man/man3xnet/listen.3xnet 0444 root bin
+f usr/share/man/man3xnet/ntohl.3xnet 0444 root bin
+f usr/share/man/man3xnet/ntohll.3xnet 0444 root bin
+f usr/share/man/man3xnet/ntohs.3xnet 0444 root bin
+f usr/share/man/man3xnet/recv.3xnet 0444 root bin
+f usr/share/man/man3xnet/recvfrom.3xnet 0444 root bin
+f usr/share/man/man3xnet/recvmsg.3xnet 0444 root bin
+f usr/share/man/man3xnet/send.3xnet 0444 root bin
+f usr/share/man/man3xnet/sendmsg.3xnet 0444 root bin
+f usr/share/man/man3xnet/sendto.3xnet 0444 root bin
+f usr/share/man/man3xnet/sethostent.3xnet 0444 root bin
+f usr/share/man/man3xnet/setnetent.3xnet 0444 root bin
+f usr/share/man/man3xnet/setprotoent.3xnet 0444 root bin
+f usr/share/man/man3xnet/setservent.3xnet 0444 root bin
+f usr/share/man/man3xnet/setsockopt.3xnet 0444 root bin
+f usr/share/man/man3xnet/shutdown.3xnet 0444 root bin
+f usr/share/man/man3xnet/sockatmark.3xnet 0444 root bin
+f usr/share/man/man3xnet/socket.3xnet 0444 root bin
+f usr/share/man/man3xnet/socketpair.3xnet 0444 root bin
+d usr/share/man/man4 0755 root bin
+f usr/share/man/man4/Intro.4 0444 root bin
+f usr/share/man/man4/NISLDAPmapping.4 0444 root bin
+f usr/share/man/man4/TIMEZONE.4 0444 root bin
+f usr/share/man/man4/a.out.4 0444 root bin
+f usr/share/man/man4/admin.4 0444 root bin
+f usr/share/man/man4/alias.4 0444 root bin
+f usr/share/man/man4/au.4 0444 root bin
+f usr/share/man/man4/audit.log.4 0444 root bin
+f usr/share/man/man4/audit_class.4 0444 root bin
+f usr/share/man/man4/audit_control.4 0444 root bin
+f usr/share/man/man4/audit_event.4 0444 root bin
+f usr/share/man/man4/audit_user.4 0444 root bin
+f usr/share/man/man4/auth_attr.4 0444 root bin
+f usr/share/man/man4/autofs.4 0444 root bin
+f usr/share/man/man4/bart_manifest.4 0444 root bin
+f usr/share/man/man4/bart_rules.4 0444 root bin
+f usr/share/man/man4/bootparams.4 0444 root bin
+f usr/share/man/man4/cardbus.4 0444 root bin
+f usr/share/man/man4/compver.4 0444 root bin
+f usr/share/man/man4/contents.4 0444 root bin
+f usr/share/man/man4/contract.4 0444 root bin
+f usr/share/man/man4/copyright.4 0444 root bin
+f usr/share/man/man4/core.4 0444 root bin
+f usr/share/man/man4/crypt.conf.4 0444 root bin
+f usr/share/man/man4/crypto_certs.4 0444 root bin
+f usr/share/man/man4/d_passwd.4 0444 root bin
+f usr/share/man/man4/dacf.conf.4 0444 root bin
+f usr/share/man/man4/dat.conf.4 0444 root bin
+f usr/share/man/man4/default_fs.4 0444 root bin
+f usr/share/man/man4/defaultdomain.4 0444 root bin
+f usr/share/man/man4/defaultrouter.4 0444 root bin
+f usr/share/man/man4/depend.4 0444 root bin
+f usr/share/man/man4/device_allocate.4 0444 root bin
+f usr/share/man/man4/device_contract.4 0444 root bin
+f usr/share/man/man4/device_maps.4 0444 root bin
+f usr/share/man/man4/devices.4 0444 root bin
+f usr/share/man/man4/dfstab.4 0444 root bin
+f usr/share/man/man4/dhcp_inittab.4 0444 root bin
+f usr/share/man/man4/dhcp_network.4 0444 root bin
+f usr/share/man/man4/dhcpsvc.conf.4 0444 root bin
+f usr/share/man/man4/dhcptab.4 0444 root bin
+f usr/share/man/man4/dialups.4 0444 root bin
+f usr/share/man/man4/dir_ufs.4 0444 root bin
+f usr/share/man/man4/driver.conf.4 0444 root bin
+f usr/share/man/man4/ds.log.4 0444 root bin
+f usr/share/man/man4/ethers.4 0444 root bin
+f usr/share/man/man4/exec_attr.4 0444 root bin
+f usr/share/man/man4/fdi.4 0444 root bin
+f usr/share/man/man4/format.dat.4 0444 root bin
+f usr/share/man/man4/fspec.4 0444 root bin
+f usr/share/man/man4/fstypes.4 0444 root bin
+f usr/share/man/man4/ftp.4 0444 root bin
+f usr/share/man/man4/ftpaccess.4 0444 root bin
+f usr/share/man/man4/ftpconversions.4 0444 root bin
+f usr/share/man/man4/ftpgroups.4 0444 root bin
+f usr/share/man/man4/ftphosts.4 0444 root bin
+f usr/share/man/man4/ftpservers.4 0444 root bin
+f usr/share/man/man4/ftpusers.4 0444 root bin
+f usr/share/man/man4/fx_dptbl.4 0444 root bin
+f usr/share/man/man4/gateways.4 0444 root bin
+f usr/share/man/man4/group.4 0444 root bin
+f usr/share/man/man4/gsscred.conf.4 0444 root bin
+f usr/share/man/man4/hba.conf.4 0444 root bin
+f usr/share/man/man4/holidays.4 0444 root bin
+f usr/share/man/man4/hosts.4 0444 root bin
+f usr/share/man/man4/hosts.equiv.4 0444 root bin
+f usr/share/man/man4/ib.4 0444 root bin
+f usr/share/man/man4/ike.config.4 0444 root bin
+f usr/share/man/man4/ike.preshared.4 0444 root bin
+f usr/share/man/man4/inet_type.4 0444 root bin
+f usr/share/man/man4/inetd.conf.4 0444 root bin
+f usr/share/man/man4/init.d.4 0444 root bin
+f usr/share/man/man4/inittab.4 0444 root bin
+f usr/share/man/man4/ipaddrsel.conf.4 0444 root bin
+f usr/share/man/man4/ipnodes.4 0444 root bin
+f usr/share/man/man4/issue.4 0444 root bin
+f usr/share/man/man4/kadm5.acl.4 0444 root bin
+f usr/share/man/man4/kdc.conf.4 0444 root bin
+f usr/share/man/man4/keytables.4 0444 root bin
+f usr/share/man/man4/krb5.conf.4 0444 root bin
+f usr/share/man/man4/ldapfilter.conf.4 0444 root bin
+f usr/share/man/man4/ldapsearchprefs.conf.4 0444 root bin
+f usr/share/man/man4/ldaptemplates.conf.4 0444 root bin
+f usr/share/man/man4/logadm.conf.4 0444 root bin
+f usr/share/man/man4/logindevperm.4 0444 root bin
+f usr/share/man/man4/loginlog.4 0444 root bin
+f usr/share/man/man4/magic.4 0444 root bin
+f usr/share/man/man4/md.tab.4 0444 root bin
+f usr/share/man/man4/mddb.cf.4 0444 root bin
+f usr/share/man/man4/mech.4 0444 root bin
+f usr/share/man/man4/meddb.4 0444 root bin
+f usr/share/man/man4/mnttab.4 0444 root bin
+f usr/share/man/man4/mod_ipp.4 0444 root bin
+f usr/share/man/man4/mpapi.conf.4 0444 root bin
+f usr/share/man/man4/nca.if.4 0444 root bin
+f usr/share/man/man4/ncad_addr.4 0444 root bin
+f usr/share/man/man4/ncakmod.conf.4 0444 root bin
+f usr/share/man/man4/ncalogd.conf.4 0444 root bin
+f usr/share/man/man4/ncaport.conf.4 0444 root bin
+f usr/share/man/man4/ndmp.4 0444 root bin
+f usr/share/man/man4/ndpd.conf.4 0444 root bin
+f usr/share/man/man4/netconfig.4 0444 root bin
+f usr/share/man/man4/netgroup.4 0444 root bin
+f usr/share/man/man4/netid.4 0444 root bin
+f usr/share/man/man4/netmasks.4 0444 root bin
+f usr/share/man/man4/netrc.4 0444 root bin
+f usr/share/man/man4/networks.4 0444 root bin
+f usr/share/man/man4/nfs.4 0444 root bin
+f usr/share/man/man4/nfslog.conf.4 0444 root bin
+f usr/share/man/man4/nfssec.conf.4 0444 root bin
+f usr/share/man/man4/nodename.4 0444 root bin
+f usr/share/man/man4/nologin.4 0444 root bin
+f usr/share/man/man4/note.4 0444 root bin
+f usr/share/man/man4/notrouter.4 0444 root bin
+f usr/share/man/man4/nscd.conf.4 0444 root bin
+f usr/share/man/man4/nsmbrc.4 0444 root bin
+f usr/share/man/man4/nss.4 0444 root bin
+f usr/share/man/man4/nsswitch.conf.4 0444 root bin
+f usr/share/man/man4/packingrules.4 0444 root bin
+f usr/share/man/man4/pam.conf.4 0444 root bin
+f usr/share/man/man4/passwd.4 0444 root bin
+f usr/share/man/man4/path_to_inst.4 0444 root bin
+f usr/share/man/man4/pci.4 0444 root bin
+f usr/share/man/man4/phones.4 0444 root bin
+f usr/share/man/man4/pkginfo.4 0444 root bin
+f usr/share/man/man4/pkgmap.4 0444 root bin
+f usr/share/man/man4/policy.conf.4 0444 root bin
+f usr/share/man/man4/power.conf.4 0444 root bin
+f usr/share/man/man4/printers.4 0444 root bin
+f usr/share/man/man4/printers.conf.4 0444 root bin
+f usr/share/man/man4/priv_names.4 0444 root bin
+f usr/share/man/man4/proc.4 0444 root bin
+f usr/share/man/man4/process.4 0444 root bin
+f usr/share/man/man4/prof_attr.4 0444 root bin
+f usr/share/man/man4/profile.4 0444 root bin
+f usr/share/man/man4/project.4 0444 root bin
+f usr/share/man/man4/protocols.4 0444 root bin
+f usr/share/man/man4/prototype.4 0444 root bin
+f usr/share/man/man4/pseudo.4 0444 root bin
+f usr/share/man/man4/publickey.4 0444 root bin
+f usr/share/man/man4/queuedefs.4 0444 root bin
+f usr/share/man/man4/rcmscript.4 0444 root bin
+f usr/share/man/man4/rdc.cf.4 0444 root bin
+f usr/share/man/man4/remote.4 0444 root bin
+f usr/share/man/man4/resolv.conf.4 0444 root bin
+f usr/share/man/man4/rmtab.4 0444 root bin
+f usr/share/man/man4/rpc.4 0444 root bin
+f usr/share/man/man4/rt_dptbl.4 0444 root bin
+f usr/share/man/man4/sasl_appname.conf.4 0444 root bin
+f usr/share/man/man4/scsi.4 0444 root bin
+f usr/share/man/man4/securenets.4 0444 root bin
+f usr/share/man/man4/sel_config.4 0444 root bin
+f usr/share/man/man4/sendmail.4 0444 root bin
+f usr/share/man/man4/service_bundle.4 0444 root bin
+f usr/share/man/man4/service_provider.conf.4 0444 root bin
+f usr/share/man/man4/services.4 0444 root bin
+f usr/share/man/man4/shadow.4 0444 root bin
+f usr/share/man/man4/sharetab.4 0444 root bin
+f usr/share/man/man4/shells.4 0444 root bin
+f usr/share/man/man4/slp.conf.4 0444 root bin
+f usr/share/man/man4/slpd.reg.4 0444 root bin
+f usr/share/man/man4/smb.4 0444 root bin
+f usr/share/man/man4/smbautohome.4 0444 root bin
+f usr/share/man/man4/smhba.conf.4 0444 root bin
+f usr/share/man/man4/sndr.4 0444 root bin
+f usr/share/man/man4/sock2path.4 0444 root bin
+f usr/share/man/man4/space.4 0444 root bin
+f usr/share/man/man4/ssh_config.4 0444 root bin
+f usr/share/man/man4/sshd_config.4 0444 root bin
+f usr/share/man/man4/sulog.4 0444 root bin
+f usr/share/man/man4/sysbus.4 0444 root bin
+f usr/share/man/man4/syslog.conf.4 0444 root bin
+f usr/share/man/man4/system.4 0444 root bin
+f usr/share/man/man4/term.4 0444 root bin
+f usr/share/man/man4/terminfo.4 0444 root bin
+f usr/share/man/man4/timezone.4 0444 root bin
+f usr/share/man/man4/tnf_kernel_probes.4 0444 root bin
+f usr/share/man/man4/ts_dptbl.4 0444 root bin
+f usr/share/man/man4/ttydefs.4 0444 root bin
+f usr/share/man/man4/ttysrch.4 0444 root bin
+f usr/share/man/man4/ufsdump.4 0444 root bin
+f usr/share/man/man4/updaters.4 0444 root bin
+f usr/share/man/man4/user_attr.4 0444 root bin
+f usr/share/man/man4/utmp.4 0444 root bin
+f usr/share/man/man4/utmpx.4 0444 root bin
+f usr/share/man/man4/vfstab.4 0444 root bin
+f usr/share/man/man4/volume-config.4 0444 root bin
+f usr/share/man/man4/volume-request.4 0444 root bin
+f usr/share/man/man4/warn.conf.4 0444 root bin
+f usr/share/man/man4/xferlog.4 0444 root bin
+f usr/share/man/man4/ypfiles.4 0444 root bin
+f usr/share/man/man4/yppasswdd.4 0444 root bin
+f usr/share/man/man4/ypserv.4 0444 root bin
+f usr/share/man/man4/zoneinfo.4 0444 root bin
+d usr/share/man/man4b 0755 root bin
+d usr/share/man/man5 0755 root bin
+f usr/share/man/man5/Intro.5 0444 root bin
+f usr/share/man/man5/acl.5 0444 root bin
+f usr/share/man/man5/ad.5 0444 root bin
+f usr/share/man/man5/ascii.5 0444 root bin
+f usr/share/man/man5/attributes.5 0444 root bin
+f usr/share/man/man5/audit_binfile.5 0444 root bin
+f usr/share/man/man5/audit_remote.5 0444 root bin
+f usr/share/man/man5/audit_syslog.5 0444 root bin
+f usr/share/man/man5/brands.5 0444 root bin
+f usr/share/man/man5/cancellation.5 0444 root bin
+f usr/share/man/man5/charmap.5 0444 root bin
+f usr/share/man/man5/condition.5 0444 root bin
+f usr/share/man/man5/crypt_bsdbf.5 0444 root bin
+f usr/share/man/man5/crypt_bsdmd5.5 0444 root bin
+f usr/share/man/man5/crypt_sha256.5 0444 root bin
+f usr/share/man/man5/crypt_sha512.5 0444 root bin
+f usr/share/man/man5/crypt_sunmd5.5 0444 root bin
+f usr/share/man/man5/crypt_unix.5 0444 root bin
+f usr/share/man/man5/device_clean.5 0444 root bin
+f usr/share/man/man5/dhcp.5 0444 root bin
+f usr/share/man/man5/dhcp_modules.5 0444 root bin
+f usr/share/man/man5/environ.5 0444 root bin
+f usr/share/man/man5/eqnchar.5 0444 root bin
+f usr/share/man/man5/extendedFILE.5 0444 root bin
+f usr/share/man/man5/filesystem.5 0444 root bin
+f usr/share/man/man5/fnmatch.5 0444 root bin
+f usr/share/man/man5/formats.5 0444 root bin
+f usr/share/man/man5/fsattr.5 0444 root bin
+f usr/share/man/man5/grub.5 0444 root bin
+f usr/share/man/man5/gss_auth_rules.5 0444 root bin
+f usr/share/man/man5/iconv.5 0444 root bin
+f usr/share/man/man5/iconv_unicode.5 0444 root bin
+f usr/share/man/man5/ieee802.11.5 0444 root bin
+f usr/share/man/man5/ipfilter.5 0444 root bin
+f usr/share/man/man5/isalist.5 0444 root bin
+f usr/share/man/man5/kerberos.5 0444 root bin
+f usr/share/man/man5/krb5_auth_rules.5 0444 root bin
+f usr/share/man/man5/krb5envvar.5 0444 root bin
+f usr/share/man/man5/largefile.5 0444 root bin
+f usr/share/man/man5/lf64.5 0444 root bin
+f usr/share/man/man5/lfcompile.5 0444 root bin
+f usr/share/man/man5/lfcompile64.5 0444 root bin
+f usr/share/man/man5/locale.5 0444 root bin
+f usr/share/man/man5/man.5 0444 root bin
+f usr/share/man/man5/mansun.5 0444 root bin
+f usr/share/man/man5/me.5 0444 root bin
+f usr/share/man/man5/mech_spnego.5 0444 root bin
+f usr/share/man/man5/mm.5 0444 root bin
+f usr/share/man/man5/ms.5 0444 root bin
+f usr/share/man/man5/mutex.5 0444 root bin
+f usr/share/man/man5/nfssec.5 0444 root bin
+f usr/share/man/man5/pam_allow.5 0444 root bin
+f usr/share/man/man5/pam_authtok_check.5 0444 root bin
+f usr/share/man/man5/pam_authtok_get.5 0444 root bin
+f usr/share/man/man5/pam_authtok_store.5 0444 root bin
+f usr/share/man/man5/pam_deny.5 0444 root bin
+f usr/share/man/man5/pam_dhkeys.5 0444 root bin
+f usr/share/man/man5/pam_dial_auth.5 0444 root bin
+f usr/share/man/man5/pam_krb5.5 0444 root bin
+f usr/share/man/man5/pam_krb5_migrate.5 0444 root bin
+f usr/share/man/man5/pam_ldap.5 0444 root bin
+f usr/share/man/man5/pam_list.5 0444 root bin
+f usr/share/man/man5/pam_passwd_auth.5 0444 root bin
+f usr/share/man/man5/pam_rhosts_auth.5 0444 root bin
+f usr/share/man/man5/pam_roles.5 0444 root bin
+f usr/share/man/man5/pam_sample.5 0444 root bin
+f usr/share/man/man5/pam_smb_passwd.5 0444 root bin
+f usr/share/man/man5/pam_smbfs_login.5 0444 root bin
+f usr/share/man/man5/pam_unix_account.5 0444 root bin
+f usr/share/man/man5/pam_unix_auth.5 0444 root bin
+f usr/share/man/man5/pam_unix_cred.5 0444 root bin
+f usr/share/man/man5/pam_unix_session.5 0444 root bin
+f usr/share/man/man5/pkcs11_kernel.5 0444 root bin
+f usr/share/man/man5/pkcs11_softtoken.5 0444 root bin
+f usr/share/man/man5/privileges.5 0444 root bin
+f usr/share/man/man5/prof.5 0444 root bin
+f usr/share/man/man5/rbac.5 0444 root bin
+f usr/share/man/man5/regex.5 0444 root bin
+f usr/share/man/man5/regexp.5 0444 root bin
+f usr/share/man/man5/resource_controls.5 0444 root bin
+f usr/share/man/man5/smf.5 0444 root bin
+f usr/share/man/man5/smf_bootstrap.5 0444 root bin
+f usr/share/man/man5/smf_method.5 0444 root bin
+f usr/share/man/man5/smf_restarter.5 0444 root bin
+f usr/share/man/man5/smf_security.5 0444 root bin
+f usr/share/man/man5/smf_template.5 0444 root bin
+f usr/share/man/man5/standards.5 0444 root bin
+f usr/share/man/man5/sticky.5 0444 root bin
+f usr/share/man/man5/tecla.5 0444 root bin
+f usr/share/man/man5/term.5 0444 root bin
+f usr/share/man/man5/threads.5 0444 root bin
+f usr/share/man/man5/vgrindefs.5 0444 root bin
+f usr/share/man/man5/zones.5 0444 root bin
+f usr/share/man/man5/zpool-features.5 0444 root bin
+d usr/share/man/man7 0755 root bin
+f usr/share/man/man7/FSS.7 0444 root bin
+d usr/share/man/man7d 0755 root bin
+f usr/share/man/man7d/aac.7d 0444 root bin
+f usr/share/man/man7d/afe.7d 0444 root bin
+f usr/share/man/man7d/ahci.7d 0444 root bin
+f usr/share/man/man7d/amd8111s.7d 0444 root bin
+f usr/share/man/man7d/amr.7d 0444 root bin
+f usr/share/man/man7d/arcmsr.7d 0444 root bin
+f usr/share/man/man7d/asy.7d 0444 root bin
+f usr/share/man/man7d/ata.7d 0444 root bin
+f usr/share/man/man7d/atge.7d 0444 root bin
+f usr/share/man/man7d/bcm_sata.7d 0444 root bin
+f usr/share/man/man7d/bfe.7d 0444 root bin
+f usr/share/man/man7d/bge.7d 0444 root bin
+f usr/share/man/man7d/chxge.7d 0444 root bin
+f usr/share/man/man7d/cmdk.7d 0444 root bin
+f usr/share/man/man7d/devinfo.7d 0444 root bin
+f usr/share/man/man7d/dmfe.7d 0444 root bin
+f usr/share/man/man7d/dnet.7d 0444 root bin
+f usr/share/man/man7d/dtrace.7d 0444 root bin
+f usr/share/man/man7d/ehci.7d 0444 root bin
+f usr/share/man/man7d/fasttrap.7d 0444 root bin
+f usr/share/man/man7d/fbt.7d 0444 root bin
+f usr/share/man/man7d/fctl.7d 0444 root bin
+f usr/share/man/man7d/fp.7d 0444 root bin
+f usr/share/man/man7d/heci.7d 0444 root bin
+f usr/share/man/man7d/hid.7d 0444 root bin
+f usr/share/man/man7d/hubd.7d 0444 root bin
+f usr/share/man/man7d/hwahc.7d 0444 root bin
+f usr/share/man/man7d/hwarc.7d 0444 root bin
+f usr/share/man/man7d/hxge.7d 0444 root bin
+f usr/share/man/man7d/igb.7d 0444 root bin
+f usr/share/man/man7d/ipmi.7d 0444 root bin
+f usr/share/man/man7d/ipnet.7d 0444 root bin
+f usr/share/man/man7d/iscsi.7d 0444 root bin
+f usr/share/man/man7d/ixgbe.7d 0444 root bin
+f usr/share/man/man7d/kmdb.7d 0444 root bin
+f usr/share/man/man7d/ksyms.7d 0444 root bin
+f usr/share/man/man7d/llc1.7d 0444 root bin
+f usr/share/man/man7d/lockstat.7d 0444 root bin
+f usr/share/man/man7d/lofi.7d 0444 root bin
+f usr/share/man/man7d/log.7d 0444 root bin
+f usr/share/man/man7d/mega_sas.7d 0444 root bin
+f usr/share/man/man7d/mpt_sas.7d 0444 root bin
+f usr/share/man/man7d/mr_sas.7d 0444 root bin
+f usr/share/man/man7d/ntxn.7d 0444 root bin
+f usr/share/man/man7d/nulldriver.7d 0444 root bin
+f usr/share/man/man7d/nv_sata.7d 0444 root bin
+f usr/share/man/man7d/nxge.7d 0444 root bin
+f usr/share/man/man7d/ohci.7d 0444 root bin
+f usr/share/man/man7d/pcata.7d 0444 root bin
+f usr/share/man/man7d/physmem.7d 0444 root bin
+f usr/share/man/man7d/pm.7d 0444 root bin
+f usr/share/man/man7d/poll.7d 0444 root bin
+f usr/share/man/man7d/profile.7d 0444 root bin
+f usr/share/man/man7d/ptm.7d 0444 root bin
+f usr/share/man/man7d/pts.7d 0444 root bin
+f usr/share/man/man7d/qlc.7d 0444 root bin
+f usr/share/man/man7d/ramdisk.7d 0444 root bin
+f usr/share/man/man7d/random.7d 0444 root bin
+f usr/share/man/man7d/rge.7d 0444 root bin
+f usr/share/man/man7d/sad.7d 0444 root bin
+f usr/share/man/man7d/scsa2usb.7d 0444 root bin
+f usr/share/man/man7d/sd.7d 0444 root bin
+f usr/share/man/man7d/sdt.7d 0444 root bin
+f usr/share/man/man7d/ses.7d 0444 root bin
+f usr/share/man/man7d/sfe.7d 0444 root bin
+f usr/share/man/man7d/sgen.7d 0444 root bin
+f usr/share/man/man7d/si3124.7d 0444 root bin
+f usr/share/man/man7d/smbios.7d 0444 root bin
+f usr/share/man/man7d/st.7d 0444 root bin
+f usr/share/man/man7d/sysmsg.7d 0444 root bin
+f usr/share/man/man7d/systrace.7d 0444 root bin
+f usr/share/man/man7d/tzmon.7d 0444 root bin
+f usr/share/man/man7d/ugen.7d 0444 root bin
+f usr/share/man/man7d/uhci.7d 0444 root bin
+f usr/share/man/man7d/usb_mid.7d 0444 root bin
+f usr/share/man/man7d/usbftdi.7d 0444 root bin
+f usr/share/man/man7d/usbsacm.7d 0444 root bin
+f usr/share/man/man7d/usbsksp.7d 0444 root bin
+f usr/share/man/man7d/usbsprl.7d 0444 root bin
+f usr/share/man/man7d/vr.7d 0444 root bin
+f usr/share/man/man7d/xge.7d 0444 root bin
+f usr/share/man/man7d/yge.7d 0444 root bin
+f usr/share/man/man7d/zcons.7d 0444 root bin
+d usr/share/man/man7fs 0755 root bin
+f usr/share/man/man7fs/ctfs.7fs 0444 root bin
+f usr/share/man/man7fs/dcfs.7fs 0444 root bin
+f usr/share/man/man7fs/dev.7fs 0444 root bin
+f usr/share/man/man7fs/devfs.7fs 0444 root bin
+f usr/share/man/man7fs/hsfs.7fs 0444 root bin
+f usr/share/man/man7fs/hyprlofs.7fs 0444 root bin
+f usr/share/man/man7fs/lofs.7fs 0444 root bin
+f usr/share/man/man7fs/lxproc.7fs 0444 root bin
+f usr/share/man/man7fs/objfs.7fs 0444 root bin
+f usr/share/man/man7fs/pcfs.7fs 0444 root bin
+f usr/share/man/man7fs/sharefs.7fs 0444 root bin
+f usr/share/man/man7fs/smbfs.7fs 0444 root bin
+f usr/share/man/man7fs/tmpfs.7fs 0444 root bin
+f usr/share/man/man7fs/udfs.7fs 0444 root bin
+f usr/share/man/man7fs/ufs.7fs 0444 root bin
+d usr/share/man/man9 0755 root bin
+f usr/share/man/man9/Intro.9 0444 root bin
+f usr/share/man/man9/intro.9 0444 root bin
+d usr/share/man/man9e 0755 root bin
+f usr/share/man/man9e/Intro.9e 0444 root bin
+f usr/share/man/man9e/_fini.9e 0444 root bin
+f usr/share/man/man9e/_info.9e 0444 root bin
+f usr/share/man/man9e/_init.9e 0444 root bin
+f usr/share/man/man9e/aread.9e 0444 root bin
+f usr/share/man/man9e/attach.9e 0444 root bin
+f usr/share/man/man9e/awrite.9e 0444 root bin
+f usr/share/man/man9e/chpoll.9e 0444 root bin
+f usr/share/man/man9e/close.9e 0444 root bin
+f usr/share/man/man9e/csx_event_handler.9e 0444 root bin
+f usr/share/man/man9e/detach.9e 0444 root bin
+f usr/share/man/man9e/devmap.9e 0444 root bin
+f usr/share/man/man9e/devmap_access.9e 0444 root bin
+f usr/share/man/man9e/devmap_contextmgt.9e 0444 root bin
+f usr/share/man/man9e/devmap_dup.9e 0444 root bin
+f usr/share/man/man9e/devmap_map.9e 0444 root bin
+f usr/share/man/man9e/devmap_unmap.9e 0444 root bin
+f usr/share/man/man9e/dump.9e 0444 root bin
+f usr/share/man/man9e/getinfo.9e 0444 root bin
+f usr/share/man/man9e/gld.9e 0444 root bin
+f usr/share/man/man9e/gldm_get_stats.9e 0444 root bin
+f usr/share/man/man9e/gldm_intr.9e 0444 root bin
+f usr/share/man/man9e/gldm_ioctl.9e 0444 root bin
+f usr/share/man/man9e/gldm_reset.9e 0444 root bin
+f usr/share/man/man9e/gldm_send.9e 0444 root bin
+f usr/share/man/man9e/gldm_set_mac_addr.9e 0444 root bin
+f usr/share/man/man9e/gldm_set_multicast.9e 0444 root bin
+f usr/share/man/man9e/gldm_set_promiscuous.9e 0444 root bin
+f usr/share/man/man9e/gldm_start.9e 0444 root bin
+f usr/share/man/man9e/gldm_stop.9e 0444 root bin
+f usr/share/man/man9e/identify.9e 0444 root bin
+f usr/share/man/man9e/intro.9e 0444 root bin
+f usr/share/man/man9e/ioctl.9e 0444 root bin
+f usr/share/man/man9e/ks_snapshot.9e 0444 root bin
+f usr/share/man/man9e/ks_update.9e 0444 root bin
+f usr/share/man/man9e/mmap.9e 0444 root bin
+f usr/share/man/man9e/open.9e 0444 root bin
+f usr/share/man/man9e/power.9e 0444 root bin
+f usr/share/man/man9e/print.9e 0444 root bin
+f usr/share/man/man9e/probe.9e 0444 root bin
+f usr/share/man/man9e/prop_op.9e 0444 root bin
+f usr/share/man/man9e/put.9e 0444 root bin
+f usr/share/man/man9e/quiesce.9e 0444 root bin
+f usr/share/man/man9e/read.9e 0444 root bin
+f usr/share/man/man9e/segmap.9e 0444 root bin
+f usr/share/man/man9e/srv.9e 0444 root bin
+f usr/share/man/man9e/strategy.9e 0444 root bin
+f usr/share/man/man9e/tran_abort.9e 0444 root bin
+f usr/share/man/man9e/tran_bus_reset.9e 0444 root bin
+f usr/share/man/man9e/tran_destroy_pkt.9e 0444 root bin
+f usr/share/man/man9e/tran_dmafree.9e 0444 root bin
+f usr/share/man/man9e/tran_getcap.9e 0444 root bin
+f usr/share/man/man9e/tran_init_pkt.9e 0444 root bin
+f usr/share/man/man9e/tran_pkt_constructor.9e 0444 root bin
+f usr/share/man/man9e/tran_pkt_destructor.9e 0444 root bin
+f usr/share/man/man9e/tran_quiesce.9e 0444 root bin
+f usr/share/man/man9e/tran_reset.9e 0444 root bin
+f usr/share/man/man9e/tran_reset_notify.9e 0444 root bin
+f usr/share/man/man9e/tran_setcap.9e 0444 root bin
+f usr/share/man/man9e/tran_setup_pkt.9e 0444 root bin
+f usr/share/man/man9e/tran_start.9e 0444 root bin
+f usr/share/man/man9e/tran_sync_pkt.9e 0444 root bin
+f usr/share/man/man9e/tran_teardown_pkt.9e 0444 root bin
+f usr/share/man/man9e/tran_tgt_free.9e 0444 root bin
+f usr/share/man/man9e/tran_tgt_init.9e 0444 root bin
+f usr/share/man/man9e/tran_tgt_probe.9e 0444 root bin
+f usr/share/man/man9e/tran_unquiesce.9e 0444 root bin
+f usr/share/man/man9e/write.9e 0444 root bin
+d usr/share/man/man9f 0755 root bin
+f usr/share/man/man9f/ASSERT.9f 0444 root bin
+f usr/share/man/man9f/Intro.9f 0444 root bin
+f usr/share/man/man9f/OTHERQ.9f 0444 root bin
+f usr/share/man/man9f/RD.9f 0444 root bin
+f usr/share/man/man9f/SAMESTR.9f 0444 root bin
+f usr/share/man/man9f/SIZEOF_PTR.9f 0444 root bin
+f usr/share/man/man9f/SIZEOF_STRUCT.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_BUF.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_DECL.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_FADDR.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_FGET.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_FGETP.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_FSET.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_FSETP.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_HANDLE.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_INIT.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_SET_HANDLE.9f 0444 root bin
+f usr/share/man/man9f/STRUCT_SIZE.9f 0444 root bin
+f usr/share/man/man9f/WR.9f 0444 root bin
+f usr/share/man/man9f/adjmsg.9f 0444 root bin
+f usr/share/man/man9f/allocb.9f 0444 root bin
+f usr/share/man/man9f/assert.9f 0444 root bin
+f usr/share/man/man9f/atomic_add.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_16.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_16_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_32.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_32_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_64.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_64_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_8.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_8_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_char.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_char_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_int.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_int_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_long.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_long_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_ptr.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_ptr_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_short.9f 0444 root bin
+f usr/share/man/man9f/atomic_add_short_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_and.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_16.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_16_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_32.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_32_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_64.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_64_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_8.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_8_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_uchar.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_uchar_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_uint.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_uint_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_ulong.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_ulong_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_ushort.9f 0444 root bin
+f usr/share/man/man9f/atomic_and_ushort_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_bits.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_16.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_32.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_64.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_8.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_ptr.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_uchar.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_uint.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_ulong.9f 0444 root bin
+f usr/share/man/man9f/atomic_cas_ushort.9f 0444 root bin
+f usr/share/man/man9f/atomic_clear_long_excl.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_16.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_16_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_32.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_32_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_64.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_64_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_8.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_8_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_ptr.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_ptr_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_uchar.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_uchar_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_uint.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_uint_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_ulong.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_ulong_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_ushort.9f 0444 root bin
+f usr/share/man/man9f/atomic_dec_ushort_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_16.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_16_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_32.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_32_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_64.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_64_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_8.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_8_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_ptr.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_ptr_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_uchar.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_uchar_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_uint.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_uint_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_ulong.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_ulong_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_ushort.9f 0444 root bin
+f usr/share/man/man9f/atomic_inc_ushort_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_ops.9f 0444 root bin
+f usr/share/man/man9f/atomic_or.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_16.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_16_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_32.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_32_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_64.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_64_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_8.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_8_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_uchar.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_uchar_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_uint.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_uint_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_ulong.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_ulong_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_ushort.9f 0444 root bin
+f usr/share/man/man9f/atomic_or_ushort_nv.9f 0444 root bin
+f usr/share/man/man9f/atomic_set_long_excl.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_16.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_32.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_64.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_8.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_ptr.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_uchar.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_uint.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_ulong.9f 0444 root bin
+f usr/share/man/man9f/atomic_swap_ushort.9f 0444 root bin
+f usr/share/man/man9f/backq.9f 0444 root bin
+f usr/share/man/man9f/bcanput.9f 0444 root bin
+f usr/share/man/man9f/bcmp.9f 0444 root bin
+f usr/share/man/man9f/bcopy.9f 0444 root bin
+f usr/share/man/man9f/bioclone.9f 0444 root bin
+f usr/share/man/man9f/biodone.9f 0444 root bin
+f usr/share/man/man9f/bioerror.9f 0444 root bin
+f usr/share/man/man9f/biofini.9f 0444 root bin
+f usr/share/man/man9f/bioinit.9f 0444 root bin
+f usr/share/man/man9f/biomodified.9f 0444 root bin
+f usr/share/man/man9f/bioreset.9f 0444 root bin
+f usr/share/man/man9f/biosize.9f 0444 root bin
+f usr/share/man/man9f/biowait.9f 0444 root bin
+f usr/share/man/man9f/bp_copyin.9f 0444 root bin
+f usr/share/man/man9f/bp_copyout.9f 0444 root bin
+f usr/share/man/man9f/bp_mapin.9f 0444 root bin
+f usr/share/man/man9f/bp_mapout.9f 0444 root bin
+f usr/share/man/man9f/btop.9f 0444 root bin
+f usr/share/man/man9f/btopr.9f 0444 root bin
+f usr/share/man/man9f/bufcall.9f 0444 root bin
+f usr/share/man/man9f/bzero.9f 0444 root bin
+f usr/share/man/man9f/canput.9f 0444 root bin
+f usr/share/man/man9f/clrbuf.9f 0444 root bin
+f usr/share/man/man9f/cmn_err.9f 0444 root bin
+f usr/share/man/man9f/condvar.9f 0444 root bin
+f usr/share/man/man9f/copyb.9f 0444 root bin
+f usr/share/man/man9f/copyin.9f 0444 root bin
+f usr/share/man/man9f/copymsg.9f 0444 root bin
+f usr/share/man/man9f/copyout.9f 0444 root bin
+f usr/share/man/man9f/crgetgid.9f 0444 root bin
+f usr/share/man/man9f/crgetgroups.9f 0444 root bin
+f usr/share/man/man9f/crgetngroups.9f 0444 root bin
+f usr/share/man/man9f/crgetrgid.9f 0444 root bin
+f usr/share/man/man9f/crgetruid.9f 0444 root bin
+f usr/share/man/man9f/crgetsgid.9f 0444 root bin
+f usr/share/man/man9f/crgetsuid.9f 0444 root bin
+f usr/share/man/man9f/crgetuid.9f 0444 root bin
+f usr/share/man/man9f/crgetzoneid.9f 0444 root bin
+f usr/share/man/man9f/csx_AccessConfigurationRegister.9f 0444 root bin
+f usr/share/man/man9f/csx_CS_DDI_Info.9f 0444 root bin
+f usr/share/man/man9f/csx_ConvertSize.9f 0444 root bin
+f usr/share/man/man9f/csx_ConvertSpeed.9f 0444 root bin
+f usr/share/man/man9f/csx_DeregisterClient.9f 0444 root bin
+f usr/share/man/man9f/csx_DupHandle.9f 0444 root bin
+f usr/share/man/man9f/csx_Error2Text.9f 0444 root bin
+f usr/share/man/man9f/csx_Event2Text.9f 0444 root bin
+f usr/share/man/man9f/csx_FreeHandle.9f 0444 root bin
+f usr/share/man/man9f/csx_Get16.9f 0444 root bin
+f usr/share/man/man9f/csx_Get32.9f 0444 root bin
+f usr/share/man/man9f/csx_Get64.9f 0444 root bin
+f usr/share/man/man9f/csx_Get8.9f 0444 root bin
+f usr/share/man/man9f/csx_GetEventMask.9f 0444 root bin
+f usr/share/man/man9f/csx_GetFirstClient.9f 0444 root bin
+f usr/share/man/man9f/csx_GetFirstTuple.9f 0444 root bin
+f usr/share/man/man9f/csx_GetHandleOffset.9f 0444 root bin
+f usr/share/man/man9f/csx_GetMappedAddr.9f 0444 root bin
+f usr/share/man/man9f/csx_GetNextClient.9f 0444 root bin
+f usr/share/man/man9f/csx_GetNextTuple.9f 0444 root bin
+f usr/share/man/man9f/csx_GetStatus.9f 0444 root bin
+f usr/share/man/man9f/csx_GetTupleData.9f 0444 root bin
+f usr/share/man/man9f/csx_MakeDeviceNode.9f 0444 root bin
+f usr/share/man/man9f/csx_MapLogSocket.9f 0444 root bin
+f usr/share/man/man9f/csx_MapMemPage.9f 0444 root bin
+f usr/share/man/man9f/csx_ModifyConfiguration.9f 0444 root bin
+f usr/share/man/man9f/csx_ModifyWindow.9f 0444 root bin
+f usr/share/man/man9f/csx_ParseTuple.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_BATTERY.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_BYTEORDER.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_CFTABLE_ENTRY.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_CONFIG.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_DATE.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_DEVICE.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_DEVICEGEO.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_DEVICEGEO_A.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_DEVICE_A.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_DEVICE_OA.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_DEVICE_OC.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_FORMAT.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_FUNCE.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_FUNCID.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_GEOMETRY.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_JEDEC_A.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_JEDEC_C.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_LINKTARGET.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_LONGLINK_A.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_LONGLINK_C.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_LONGLINK_MFC.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_MANFID.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_ORG.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_SPCL.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_SWIL.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_VERS_1.9f 0444 root bin
+f usr/share/man/man9f/csx_Parse_CISTPL_VERS_2.9f 0444 root bin
+f usr/share/man/man9f/csx_Put16.9f 0444 root bin
+f usr/share/man/man9f/csx_Put32.9f 0444 root bin
+f usr/share/man/man9f/csx_Put64.9f 0444 root bin
+f usr/share/man/man9f/csx_Put8.9f 0444 root bin
+f usr/share/man/man9f/csx_RegisterClient.9f 0444 root bin
+f usr/share/man/man9f/csx_ReleaseConfiguration.9f 0444 root bin
+f usr/share/man/man9f/csx_ReleaseIO.9f 0444 root bin
+f usr/share/man/man9f/csx_ReleaseIRQ.9f 0444 root bin
+f usr/share/man/man9f/csx_ReleaseSocketMask.9f 0444 root bin
+f usr/share/man/man9f/csx_ReleaseWindow.9f 0444 root bin
+f usr/share/man/man9f/csx_RemoveDeviceNode.9f 0444 root bin
+f usr/share/man/man9f/csx_RepGet16.9f 0444 root bin
+f usr/share/man/man9f/csx_RepGet32.9f 0444 root bin
+f usr/share/man/man9f/csx_RepGet64.9f 0444 root bin
+f usr/share/man/man9f/csx_RepGet8.9f 0444 root bin
+f usr/share/man/man9f/csx_RepPut16.9f 0444 root bin
+f usr/share/man/man9f/csx_RepPut32.9f 0444 root bin
+f usr/share/man/man9f/csx_RepPut64.9f 0444 root bin
+f usr/share/man/man9f/csx_RepPut8.9f 0444 root bin
+f usr/share/man/man9f/csx_RequestConfiguration.9f 0444 root bin
+f usr/share/man/man9f/csx_RequestIO.9f 0444 root bin
+f usr/share/man/man9f/csx_RequestIRQ.9f 0444 root bin
+f usr/share/man/man9f/csx_RequestSocketMask.9f 0444 root bin
+f usr/share/man/man9f/csx_RequestWindow.9f 0444 root bin
+f usr/share/man/man9f/csx_ResetFunction.9f 0444 root bin
+f usr/share/man/man9f/csx_SetEventMask.9f 0444 root bin
+f usr/share/man/man9f/csx_SetHandleOffset.9f 0444 root bin
+f usr/share/man/man9f/csx_ValidateCIS.9f 0444 root bin
+f usr/share/man/man9f/cv_broadcast.9f 0444 root bin
+f usr/share/man/man9f/cv_destroy.9f 0444 root bin
+f usr/share/man/man9f/cv_init.9f 0444 root bin
+f usr/share/man/man9f/cv_reltimedwait.9f 0444 root bin
+f usr/share/man/man9f/cv_reltimedwait_sig.9f 0444 root bin
+f usr/share/man/man9f/cv_signal.9f 0444 root bin
+f usr/share/man/man9f/cv_timedwait.9f 0444 root bin
+f usr/share/man/man9f/cv_timedwait_sig.9f 0444 root bin
+f usr/share/man/man9f/cv_wait.9f 0444 root bin
+f usr/share/man/man9f/cv_wait_sig.9f 0444 root bin
+f usr/share/man/man9f/datamsg.9f 0444 root bin
+f usr/share/man/man9f/ddi_add_event_handler.9f 0444 root bin
+f usr/share/man/man9f/ddi_add_intr.9f 0444 root bin
+f usr/share/man/man9f/ddi_add_softintr.9f 0444 root bin
+f usr/share/man/man9f/ddi_binding_name.9f 0444 root bin
+f usr/share/man/man9f/ddi_btop.9f 0444 root bin
+f usr/share/man/man9f/ddi_btopr.9f 0444 root bin
+f usr/share/man/man9f/ddi_can_receive_sig.9f 0444 root bin
+f usr/share/man/man9f/ddi_cb_register.9f 0444 root bin
+f usr/share/man/man9f/ddi_cb_unregister.9f 0444 root bin
+f usr/share/man/man9f/ddi_check_acc_handle.9f 0444 root bin
+f usr/share/man/man9f/ddi_check_dma_handle.9f 0444 root bin
+f usr/share/man/man9f/ddi_copyin.9f 0444 root bin
+f usr/share/man/man9f/ddi_copyout.9f 0444 root bin
+f usr/share/man/man9f/ddi_create_minor_node.9f 0444 root bin
+f usr/share/man/man9f/ddi_cred.9f 0444 root bin
+f usr/share/man/man9f/ddi_dev_is_needed.9f 0444 root bin
+f usr/share/man/man9f/ddi_dev_is_sid.9f 0444 root bin
+f usr/share/man/man9f/ddi_dev_nintrs.9f 0444 root bin
+f usr/share/man/man9f/ddi_dev_nregs.9f 0444 root bin
+f usr/share/man/man9f/ddi_dev_regsize.9f 0444 root bin
+f usr/share/man/man9f/ddi_dev_report_fault.9f 0444 root bin
+f usr/share/man/man9f/ddi_device_copy.9f 0444 root bin
+f usr/share/man/man9f/ddi_device_zero.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_compare.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_free.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_get.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_init.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_register.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_sizeof.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_str_decode.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_str_encode.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_str_free.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_unregister.9f 0444 root bin
+f usr/share/man/man9f/ddi_devid_valid.9f 0444 root bin
+f usr/share/man/man9f/ddi_devmap_segmap.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_addr_bind_handle.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_alloc_handle.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_buf_bind_handle.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_burstsizes.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_free_handle.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_getwin.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_mem_alloc.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_mem_free.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_nextcookie.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_numwin.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_set_sbus64.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_sync.9f 0444 root bin
+f usr/share/man/man9f/ddi_dma_unbind_handle.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_1stparty.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_alloc.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_disable.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_enable.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_getattr.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_getcnt.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_getlim.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_prog.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_release.9f 0444 root bin
+f usr/share/man/man9f/ddi_dmae_stop.9f 0444 root bin
+f usr/share/man/man9f/ddi_driver_major.9f 0444 root bin
+f usr/share/man/man9f/ddi_driver_name.9f 0444 root bin
+f usr/share/man/man9f/ddi_enter_critical.9f 0444 root bin
+f usr/share/man/man9f/ddi_exit_critical.9f 0444 root bin
+f usr/share/man/man9f/ddi_ffs.9f 0444 root bin
+f usr/share/man/man9f/ddi_fls.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_acc_err_clear.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_acc_err_get.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_capable.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_dma_err_clear.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_dma_err_get.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_ereport_post.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_fini.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_handler_register.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_handler_unregister.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_init.9f 0444 root bin
+f usr/share/man/man9f/ddi_fm_service_impact.9f 0444 root bin
+f usr/share/man/man9f/ddi_get16.9f 0444 root bin
+f usr/share/man/man9f/ddi_get32.9f 0444 root bin
+f usr/share/man/man9f/ddi_get64.9f 0444 root bin
+f usr/share/man/man9f/ddi_get8.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_cred.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_devstate.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_driver_private.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_eventcookie.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_iblock_cookie.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_instance.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_kt_did.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_lbolt.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_lbolt64.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_name.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_parent.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_pid.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_soft_iblock_cookie.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_soft_state.9f 0444 root bin
+f usr/share/man/man9f/ddi_get_time.9f 0444 root bin
+f usr/share/man/man9f/ddi_getb.9f 0444 root bin
+f usr/share/man/man9f/ddi_getiminor.9f 0444 root bin
+f usr/share/man/man9f/ddi_getl.9f 0444 root bin
+f usr/share/man/man9f/ddi_getll.9f 0444 root bin
+f usr/share/man/man9f/ddi_getlongprop.9f 0444 root bin
+f usr/share/man/man9f/ddi_getlongprop_buf.9f 0444 root bin
+f usr/share/man/man9f/ddi_getprop.9f 0444 root bin
+f usr/share/man/man9f/ddi_getproplen.9f 0444 root bin
+f usr/share/man/man9f/ddi_getw.9f 0444 root bin
+f usr/share/man/man9f/ddi_in_panic.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_add_handler.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_add_softint.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_alloc.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_block_disable.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_block_enable.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_clr_mask.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_disable.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_dup_handler.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_enable.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_free.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_get_cap.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_get_hilevel_pri.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_get_navail.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_get_nintrs.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_get_pending.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_get_pri.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_get_softint_pri.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_get_supported_types.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_hilevel.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_remove_handler.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_remove_softint.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_set_cap.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_set_mask.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_set_nreq.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_set_pri.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_set_softint_pri.9f 0444 root bin
+f usr/share/man/man9f/ddi_intr_trigger_softint.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_get16.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_get32.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_get8.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_getb.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_getl.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_getw.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_put16.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_put32.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_put8.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_putb.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_putl.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_putw.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_get16.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_get32.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_get8.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_getb.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_getl.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_getw.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_put16.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_put32.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_put8.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_putb.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_putl.9f 0444 root bin
+f usr/share/man/man9f/ddi_io_rep_putw.9f 0444 root bin
+f usr/share/man/man9f/ddi_iomin.9f 0444 root bin
+f usr/share/man/man9f/ddi_log_sysevent.9f 0444 root bin
+f usr/share/man/man9f/ddi_map_regs.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_get16.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_get32.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_get64.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_get8.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_getb.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_getl.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_getll.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_getw.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_put16.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_put32.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_put64.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_put8.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_putb.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_putl.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_putll.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_putw.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_get16.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_get32.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_get64.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_get8.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_getb.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_getl.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_getll.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_getw.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_put16.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_put32.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_put64.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_put8.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_putb.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_putl.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_putll.9f 0444 root bin
+f usr/share/man/man9f/ddi_mem_rep_putw.9f 0444 root bin
+f usr/share/man/man9f/ddi_mmap_get_model.9f 0444 root bin
+f usr/share/man/man9f/ddi_modclose.9f 0444 root bin
+f usr/share/man/man9f/ddi_model_convert_from.9f 0444 root bin
+f usr/share/man/man9f/ddi_modopen.9f 0444 root bin
+f usr/share/man/man9f/ddi_modsym.9f 0444 root bin
+f usr/share/man/man9f/ddi_no_info.9f 0444 root bin
+f usr/share/man/man9f/ddi_node_name.9f 0444 root bin
+f usr/share/man/man9f/ddi_peek.9f 0444 root bin
+f usr/share/man/man9f/ddi_peek16.9f 0444 root bin
+f usr/share/man/man9f/ddi_peek32.9f 0444 root bin
+f usr/share/man/man9f/ddi_peek64.9f 0444 root bin
+f usr/share/man/man9f/ddi_peek8.9f 0444 root bin
+f usr/share/man/man9f/ddi_peekc.9f 0444 root bin
+f usr/share/man/man9f/ddi_peekd.9f 0444 root bin
+f usr/share/man/man9f/ddi_peekl.9f 0444 root bin
+f usr/share/man/man9f/ddi_peeks.9f 0444 root bin
+f usr/share/man/man9f/ddi_periodic_add.9f 0444 root bin
+f usr/share/man/man9f/ddi_periodic_delete.9f 0444 root bin
+f usr/share/man/man9f/ddi_poke.9f 0444 root bin
+f usr/share/man/man9f/ddi_poke16.9f 0444 root bin
+f usr/share/man/man9f/ddi_poke32.9f 0444 root bin
+f usr/share/man/man9f/ddi_poke64.9f 0444 root bin
+f usr/share/man/man9f/ddi_poke8.9f 0444 root bin
+f usr/share/man/man9f/ddi_pokec.9f 0444 root bin
+f usr/share/man/man9f/ddi_poked.9f 0444 root bin
+f usr/share/man/man9f/ddi_pokel.9f 0444 root bin
+f usr/share/man/man9f/ddi_pokes.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_create.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_exists.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_free.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_get_int.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_get_int64.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_lookup.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_lookup_byte_array.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_lookup_int64_array.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_lookup_int_array.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_lookup_string.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_lookup_string_array.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_modify.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_op.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_remove.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_remove_all.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_undefine.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_update.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_update_byte_array.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_update_int.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_update_int64.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_update_int64_array.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_update_int_array.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_update_string.9f 0444 root bin
+f usr/share/man/man9f/ddi_prop_update_string_array.9f 0444 root bin
+f usr/share/man/man9f/ddi_ptob.9f 0444 root bin
+f usr/share/man/man9f/ddi_put16.9f 0444 root bin
+f usr/share/man/man9f/ddi_put32.9f 0444 root bin
+f usr/share/man/man9f/ddi_put64.9f 0444 root bin
+f usr/share/man/man9f/ddi_put8.9f 0444 root bin
+f usr/share/man/man9f/ddi_putb.9f 0444 root bin
+f usr/share/man/man9f/ddi_putl.9f 0444 root bin
+f usr/share/man/man9f/ddi_putll.9f 0444 root bin
+f usr/share/man/man9f/ddi_putw.9f 0444 root bin
+f usr/share/man/man9f/ddi_regs_map_free.9f 0444 root bin
+f usr/share/man/man9f/ddi_regs_map_setup.9f 0444 root bin
+f usr/share/man/man9f/ddi_remove_event_handler.9f 0444 root bin
+f usr/share/man/man9f/ddi_remove_intr.9f 0444 root bin
+f usr/share/man/man9f/ddi_remove_minor_node.9f 0444 root bin
+f usr/share/man/man9f/ddi_remove_softintr.9f 0444 root bin
+f usr/share/man/man9f/ddi_removing_power.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_get16.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_get32.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_get64.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_get8.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_getb.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_getl.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_getll.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_getw.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_put16.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_put32.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_put64.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_put8.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_putb.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_putl.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_putll.9f 0444 root bin
+f usr/share/man/man9f/ddi_rep_putw.9f 0444 root bin
+f usr/share/man/man9f/ddi_report_dev.9f 0444 root bin
+f usr/share/man/man9f/ddi_root_node.9f 0444 root bin
+f usr/share/man/man9f/ddi_segmap.9f 0444 root bin
+f usr/share/man/man9f/ddi_segmap_setup.9f 0444 root bin
+f usr/share/man/man9f/ddi_set_driver_private.9f 0444 root bin
+f usr/share/man/man9f/ddi_slaveonly.9f 0444 root bin
+f usr/share/man/man9f/ddi_soft_state.9f 0444 root bin
+f usr/share/man/man9f/ddi_soft_state_fini.9f 0444 root bin
+f usr/share/man/man9f/ddi_soft_state_free.9f 0444 root bin
+f usr/share/man/man9f/ddi_soft_state_init.9f 0444 root bin
+f usr/share/man/man9f/ddi_soft_state_zalloc.9f 0444 root bin
+f usr/share/man/man9f/ddi_strdup.9f 0444 root bin
+f usr/share/man/man9f/ddi_strtol.9f 0444 root bin
+f usr/share/man/man9f/ddi_strtoll.9f 0444 root bin
+f usr/share/man/man9f/ddi_strtoul.9f 0444 root bin
+f usr/share/man/man9f/ddi_strtoull.9f 0444 root bin
+f usr/share/man/man9f/ddi_taskq_create.9f 0444 root bin
+f usr/share/man/man9f/ddi_taskq_destroy.9f 0444 root bin
+f usr/share/man/man9f/ddi_taskq_dispatch.9f 0444 root bin
+f usr/share/man/man9f/ddi_taskq_resume.9f 0444 root bin
+f usr/share/man/man9f/ddi_taskq_suspend.9f 0444 root bin
+f usr/share/man/man9f/ddi_taskq_wait.9f 0444 root bin
+f usr/share/man/man9f/ddi_trigger_softintr.9f 0444 root bin
+f usr/share/man/man9f/ddi_umem_alloc.9f 0444 root bin
+f usr/share/man/man9f/ddi_umem_free.9f 0444 root bin
+f usr/share/man/man9f/ddi_umem_iosetup.9f 0444 root bin
+f usr/share/man/man9f/ddi_umem_lock.9f 0444 root bin
+f usr/share/man/man9f/ddi_umem_unlock.9f 0444 root bin
+f usr/share/man/man9f/ddi_unmap_regs.9f 0444 root bin
+f usr/share/man/man9f/delay.9f 0444 root bin
+f usr/share/man/man9f/desballoc.9f 0444 root bin
+f usr/share/man/man9f/devmap_default_access.9f 0444 root bin
+f usr/share/man/man9f/devmap_devmem_setup.9f 0444 root bin
+f usr/share/man/man9f/devmap_do_ctxmgt.9f 0444 root bin
+f usr/share/man/man9f/devmap_load.9f 0444 root bin
+f usr/share/man/man9f/devmap_set_ctx_timeout.9f 0444 root bin
+f usr/share/man/man9f/devmap_setup.9f 0444 root bin
+f usr/share/man/man9f/devmap_umem_setup.9f 0444 root bin
+f usr/share/man/man9f/devmap_unload.9f 0444 root bin
+f usr/share/man/man9f/disksort.9f 0444 root bin
+f usr/share/man/man9f/dlbindack.9f 0444 root bin
+f usr/share/man/man9f/dlerrorack.9f 0444 root bin
+f usr/share/man/man9f/dlokack.9f 0444 root bin
+f usr/share/man/man9f/dlphysaddrack.9f 0444 root bin
+f usr/share/man/man9f/dluderrorind.9f 0444 root bin
+f usr/share/man/man9f/drv_getparm.9f 0444 root bin
+f usr/share/man/man9f/drv_hztousec.9f 0444 root bin
+f usr/share/man/man9f/drv_priv.9f 0444 root bin
+f usr/share/man/man9f/drv_usectohz.9f 0444 root bin
+f usr/share/man/man9f/drv_usecwait.9f 0444 root bin
+f usr/share/man/man9f/dupb.9f 0444 root bin
+f usr/share/man/man9f/dupmsg.9f 0444 root bin
+f usr/share/man/man9f/enableok.9f 0444 root bin
+f usr/share/man/man9f/esballoc.9f 0444 root bin
+f usr/share/man/man9f/esbbcall.9f 0444 root bin
+f usr/share/man/man9f/flushband.9f 0444 root bin
+f usr/share/man/man9f/flushq.9f 0444 root bin
+f usr/share/man/man9f/free_pktiopb.9f 0444 root bin
+f usr/share/man/man9f/freeb.9f 0444 root bin
+f usr/share/man/man9f/freemsg.9f 0444 root bin
+f usr/share/man/man9f/freerbuf.9f 0444 root bin
+f usr/share/man/man9f/freezestr.9f 0444 root bin
+f usr/share/man/man9f/get_pktiopb.9f 0444 root bin
+f usr/share/man/man9f/geterror.9f 0444 root bin
+f usr/share/man/man9f/gethrtime.9f 0444 root bin
+f usr/share/man/man9f/getmajor.9f 0444 root bin
+f usr/share/man/man9f/getminor.9f 0444 root bin
+f usr/share/man/man9f/getq.9f 0444 root bin
+f usr/share/man/man9f/getrbuf.9f 0444 root bin
+f usr/share/man/man9f/gld.9f 0444 root bin
+f usr/share/man/man9f/gld_intr.9f 0444 root bin
+f usr/share/man/man9f/gld_mac_alloc.9f 0444 root bin
+f usr/share/man/man9f/gld_mac_free.9f 0444 root bin
+f usr/share/man/man9f/gld_recv.9f 0444 root bin
+f usr/share/man/man9f/gld_register.9f 0444 root bin
+f usr/share/man/man9f/gld_sched.9f 0444 root bin
+f usr/share/man/man9f/gld_unregister.9f 0444 root bin
+f usr/share/man/man9f/hook_alloc.9f 0444 root bin
+f usr/share/man/man9f/hook_free.9f 0444 root bin
+f usr/share/man/man9f/id32_alloc.9f 0444 root bin
+f usr/share/man/man9f/id32_free.9f 0444 root bin
+f usr/share/man/man9f/id32_lookup.9f 0444 root bin
+f usr/share/man/man9f/inb.9f 0444 root bin
+f usr/share/man/man9f/inl.9f 0444 root bin
+f usr/share/man/man9f/insq.9f 0444 root bin
+f usr/share/man/man9f/intro.9f 0444 root bin
+f usr/share/man/man9f/inw.9f 0444 root bin
+f usr/share/man/man9f/kiconv.9f 0444 root bin
+f usr/share/man/man9f/kiconv_close.9f 0444 root bin
+f usr/share/man/man9f/kiconv_open.9f 0444 root bin
+f usr/share/man/man9f/kiconvstr.9f 0444 root bin
+f usr/share/man/man9f/kmem_alloc.9f 0444 root bin
+f usr/share/man/man9f/kmem_cache_alloc.9f 0444 root bin
+f usr/share/man/man9f/kmem_cache_create.9f 0444 root bin
+f usr/share/man/man9f/kmem_cache_destroy.9f 0444 root bin
+f usr/share/man/man9f/kmem_cache_free.9f 0444 root bin
+f usr/share/man/man9f/kmem_cache_set_move.9f 0444 root bin
+f usr/share/man/man9f/kmem_free.9f 0444 root bin
+f usr/share/man/man9f/kmem_zalloc.9f 0444 root bin
+f usr/share/man/man9f/kstat_create.9f 0444 root bin
+f usr/share/man/man9f/kstat_delete.9f 0444 root bin
+f usr/share/man/man9f/kstat_install.9f 0444 root bin
+f usr/share/man/man9f/kstat_named_init.9f 0444 root bin
+f usr/share/man/man9f/kstat_named_setstr.9f 0444 root bin
+f usr/share/man/man9f/kstat_queue.9f 0444 root bin
+f usr/share/man/man9f/kstat_runq_back_to_waitq.9f 0444 root bin
+f usr/share/man/man9f/kstat_runq_enter.9f 0444 root bin
+f usr/share/man/man9f/kstat_runq_exit.9f 0444 root bin
+f usr/share/man/man9f/kstat_waitq_enter.9f 0444 root bin
+f usr/share/man/man9f/kstat_waitq_exit.9f 0444 root bin
+f usr/share/man/man9f/kstat_waitq_to_runq.9f 0444 root bin
+f usr/share/man/man9f/ldi_add_event_handler.9f 0444 root bin
+f usr/share/man/man9f/ldi_aread.9f 0444 root bin
+f usr/share/man/man9f/ldi_awrite.9f 0444 root bin
+f usr/share/man/man9f/ldi_close.9f 0444 root bin
+f usr/share/man/man9f/ldi_devmap.9f 0444 root bin
+f usr/share/man/man9f/ldi_dump.9f 0444 root bin
+f usr/share/man/man9f/ldi_ev_finalize.9f 0444 root bin
+f usr/share/man/man9f/ldi_ev_get_cookie.9f 0444 root bin
+f usr/share/man/man9f/ldi_ev_get_type.9f 0444 root bin
+f usr/share/man/man9f/ldi_ev_notify.9f 0444 root bin
+f usr/share/man/man9f/ldi_ev_register_callbacks.9f 0444 root bin
+f usr/share/man/man9f/ldi_ev_remove_callbacks.9f 0444 root bin
+f usr/share/man/man9f/ldi_get_dev.9f 0444 root bin
+f usr/share/man/man9f/ldi_get_devid.9f 0444 root bin
+f usr/share/man/man9f/ldi_get_eventcookie.9f 0444 root bin
+f usr/share/man/man9f/ldi_get_minor_name.9f 0444 root bin
+f usr/share/man/man9f/ldi_get_otyp.9f 0444 root bin
+f usr/share/man/man9f/ldi_get_size.9f 0444 root bin
+f usr/share/man/man9f/ldi_getmsg.9f 0444 root bin
+f usr/share/man/man9f/ldi_ident_from_dev.9f 0444 root bin
+f usr/share/man/man9f/ldi_ident_from_dip.9f 0444 root bin
+f usr/share/man/man9f/ldi_ident_from_stream.9f 0444 root bin
+f usr/share/man/man9f/ldi_ident_release.9f 0444 root bin
+f usr/share/man/man9f/ldi_ioctl.9f 0444 root bin
+f usr/share/man/man9f/ldi_open_by_dev.9f 0444 root bin
+f usr/share/man/man9f/ldi_open_by_devid.9f 0444 root bin
+f usr/share/man/man9f/ldi_open_by_name.9f 0444 root bin
+f usr/share/man/man9f/ldi_poll.9f 0444 root bin
+f usr/share/man/man9f/ldi_prop_exists.9f 0444 root bin
+f usr/share/man/man9f/ldi_prop_get_int.9f 0444 root bin
+f usr/share/man/man9f/ldi_prop_get_int64.9f 0444 root bin
+f usr/share/man/man9f/ldi_prop_lookup_byte_array.9f 0444 root bin
+f usr/share/man/man9f/ldi_prop_lookup_int64_array.9f 0444 root bin
+f usr/share/man/man9f/ldi_prop_lookup_int_array.9f 0444 root bin
+f usr/share/man/man9f/ldi_prop_lookup_string.9f 0444 root bin
+f usr/share/man/man9f/ldi_prop_lookup_string_array.9f 0444 root bin
+f usr/share/man/man9f/ldi_putmsg.9f 0444 root bin
+f usr/share/man/man9f/ldi_read.9f 0444 root bin
+f usr/share/man/man9f/ldi_remove_event_handler.9f 0444 root bin
+f usr/share/man/man9f/ldi_strategy.9f 0444 root bin
+f usr/share/man/man9f/ldi_write.9f 0444 root bin
+f usr/share/man/man9f/linkb.9f 0444 root bin
+f usr/share/man/man9f/list_create.9f 0444 root bin
+f usr/share/man/man9f/list_destroy.9f 0444 root bin
+f usr/share/man/man9f/list_head.9f 0444 root bin
+f usr/share/man/man9f/list_insert_after.9f 0444 root bin
+f usr/share/man/man9f/list_insert_before.9f 0444 root bin
+f usr/share/man/man9f/list_insert_head.9f 0444 root bin
+f usr/share/man/man9f/list_insert_tail.9f 0444 root bin
+f usr/share/man/man9f/list_is_empty.9f 0444 root bin
+f usr/share/man/man9f/list_link_active.9f 0444 root bin
+f usr/share/man/man9f/list_link_init.9f 0444 root bin
+f usr/share/man/man9f/list_link_replace.9f 0444 root bin
+f usr/share/man/man9f/list_move_tail.9f 0444 root bin
+f usr/share/man/man9f/list_next.9f 0444 root bin
+f usr/share/man/man9f/list_prev.9f 0444 root bin
+f usr/share/man/man9f/list_remove.9f 0444 root bin
+f usr/share/man/man9f/list_remove_head.9f 0444 root bin
+f usr/share/man/man9f/list_remove_tail.9f 0444 root bin
+f usr/share/man/man9f/list_tail.9f 0444 root bin
+f usr/share/man/man9f/makecom.9f 0444 root bin
+f usr/share/man/man9f/makecom_g0.9f 0444 root bin
+f usr/share/man/man9f/makecom_g0_s.9f 0444 root bin
+f usr/share/man/man9f/makecom_g1.9f 0444 root bin
+f usr/share/man/man9f/makecom_g5.9f 0444 root bin
+f usr/share/man/man9f/makedevice.9f 0444 root bin
+f usr/share/man/man9f/max.9f 0444 root bin
+f usr/share/man/man9f/mcopyin.9f 0444 root bin
+f usr/share/man/man9f/mcopymsg.9f 0444 root bin
+f usr/share/man/man9f/mcopyout.9f 0444 root bin
+f usr/share/man/man9f/membar_consumer.9f 0444 root bin
+f usr/share/man/man9f/membar_enter.9f 0444 root bin
+f usr/share/man/man9f/membar_exit.9f 0444 root bin
+f usr/share/man/man9f/membar_ops.9f 0444 root bin
+f usr/share/man/man9f/membar_producer.9f 0444 root bin
+f usr/share/man/man9f/memchr.9f 0444 root bin
+f usr/share/man/man9f/memcmp.9f 0444 root bin
+f usr/share/man/man9f/memcpy.9f 0444 root bin
+f usr/share/man/man9f/memmove.9f 0444 root bin
+f usr/share/man/man9f/memset.9f 0444 root bin
+f usr/share/man/man9f/merror.9f 0444 root bin
+f usr/share/man/man9f/mexchange.9f 0444 root bin
+f usr/share/man/man9f/min.9f 0444 root bin
+f usr/share/man/man9f/minphys.9f 0444 root bin
+f usr/share/man/man9f/mioc2ack.9f 0444 root bin
+f usr/share/man/man9f/miocack.9f 0444 root bin
+f usr/share/man/man9f/miocnak.9f 0444 root bin
+f usr/share/man/man9f/miocpullup.9f 0444 root bin
+f usr/share/man/man9f/mkiocb.9f 0444 root bin
+f usr/share/man/man9f/mod_info.9f 0444 root bin
+f usr/share/man/man9f/mod_install.9f 0444 root bin
+f usr/share/man/man9f/mod_modname.9f 0444 root bin
+f usr/share/man/man9f/mod_remove.9f 0444 root bin
+f usr/share/man/man9f/msgdsize.9f 0444 root bin
+f usr/share/man/man9f/msgpullup.9f 0444 root bin
+f usr/share/man/man9f/msgsize.9f 0444 root bin
+f usr/share/man/man9f/mt-streams.9f 0444 root bin
+f usr/share/man/man9f/mutex.9f 0444 root bin
+f usr/share/man/man9f/mutex_destroy.9f 0444 root bin
+f usr/share/man/man9f/mutex_enter.9f 0444 root bin
+f usr/share/man/man9f/mutex_exit.9f 0444 root bin
+f usr/share/man/man9f/mutex_init.9f 0444 root bin
+f usr/share/man/man9f/mutex_owned.9f 0444 root bin
+f usr/share/man/man9f/mutex_tryenter.9f 0444 root bin
+f usr/share/man/man9f/net_event_notify_register.9f 0444 root bin
+f usr/share/man/man9f/net_event_notify_unregister.9f 0444 root bin
+f usr/share/man/man9f/net_getifname.9f 0444 root bin
+f usr/share/man/man9f/net_getlifaddr.9f 0444 root bin
+f usr/share/man/man9f/net_getmtu.9f 0444 root bin
+f usr/share/man/man9f/net_getnetid.9f 0444 root bin
+f usr/share/man/man9f/net_getpmtuenabled.9f 0444 root bin
+f usr/share/man/man9f/net_hook_register.9f 0444 root bin
+f usr/share/man/man9f/net_hook_unregister.9f 0444 root bin
+f usr/share/man/man9f/net_inject.9f 0444 root bin
+f usr/share/man/man9f/net_inject_alloc.9f 0444 root bin
+f usr/share/man/man9f/net_inject_free.9f 0444 root bin
+f usr/share/man/man9f/net_instance_alloc.9f 0444 root bin
+f usr/share/man/man9f/net_instance_free.9f 0444 root bin
+f usr/share/man/man9f/net_instance_notify_register.9f 0444 root bin
+f usr/share/man/man9f/net_instance_notify_unregister.9f 0444 root bin
+f usr/share/man/man9f/net_instance_protocol_unregister.9f 0444 root bin
+f usr/share/man/man9f/net_instance_register.9f 0444 root bin
+f usr/share/man/man9f/net_instance_unregister.9f 0444 root bin
+f usr/share/man/man9f/net_ispartialchecksum.9f 0444 root bin
+f usr/share/man/man9f/net_isvalidchecksum.9f 0444 root bin
+f usr/share/man/man9f/net_kstat_create.9f 0444 root bin
+f usr/share/man/man9f/net_kstat_delete.9f 0444 root bin
+f usr/share/man/man9f/net_lifgetnext.9f 0444 root bin
+f usr/share/man/man9f/net_netidtozonid.9f 0444 root bin
+f usr/share/man/man9f/net_phygetnext.9f 0444 root bin
+f usr/share/man/man9f/net_phylookup.9f 0444 root bin
+f usr/share/man/man9f/net_protocol_lookup.9f 0444 root bin
+f usr/share/man/man9f/net_protocol_notify_register.9f 0444 root bin
+f usr/share/man/man9f/net_protocol_release.9f 0444 root bin
+f usr/share/man/man9f/net_protocol_walk.9f 0444 root bin
+f usr/share/man/man9f/net_routeto.9f 0444 root bin
+f usr/share/man/man9f/net_zoneidtonetid.9f 0444 root bin
+f usr/share/man/man9f/netinfo.9f 0444 root bin
+f usr/share/man/man9f/nochpoll.9f 0444 root bin
+f usr/share/man/man9f/nodev.9f 0444 root bin
+f usr/share/man/man9f/noenable.9f 0444 root bin
+f usr/share/man/man9f/nulldev.9f 0444 root bin
+f usr/share/man/man9f/numtos.9f 0444 root bin
+f usr/share/man/man9f/nv_alloc_fini.9f 0444 root bin
+f usr/share/man/man9f/nv_alloc_init.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_boolean.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_boolean_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_boolean_value.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_byte.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_byte_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_int16.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_int16_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_int32.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_int32_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_int64.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_int64_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_int8.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_int8_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_nvlist.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_nvlist_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_nvpair.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_string.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_string_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_uint16.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_uint16_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_uint32.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_uint32_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_uint64.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_uint64_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_uint8.9f 0444 root bin
+f usr/share/man/man9f/nvlist_add_uint8_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_alloc.9f 0444 root bin
+f usr/share/man/man9f/nvlist_dup.9f 0444 root bin
+f usr/share/man/man9f/nvlist_exists.9f 0444 root bin
+f usr/share/man/man9f/nvlist_free.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_boolean.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_boolean_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_boolean_value.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_byte.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_byte_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_int16.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_int16_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_int32.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_int32_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_int64.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_int64_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_int8.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_int8_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_nvlist.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_nvlist_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_nvpair.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_pairs.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_string.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_string_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_uint16.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_uint16_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_uint32.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_uint32_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_uint64.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_uint64_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_uint8.9f 0444 root bin
+f usr/share/man/man9f/nvlist_lookup_uint8_array.9f 0444 root bin
+f usr/share/man/man9f/nvlist_merge.9f 0444 root bin
+f usr/share/man/man9f/nvlist_next_nvpair.9f 0444 root bin
+f usr/share/man/man9f/nvlist_pack.9f 0444 root bin
+f usr/share/man/man9f/nvlist_remove.9f 0444 root bin
+f usr/share/man/man9f/nvlist_remove_all.9f 0444 root bin
+f usr/share/man/man9f/nvlist_size.9f 0444 root bin
+f usr/share/man/man9f/nvlist_t.9f 0444 root bin
+f usr/share/man/man9f/nvlist_unpack.9f 0444 root bin
+f usr/share/man/man9f/nvlist_xalloc.9f 0444 root bin
+f usr/share/man/man9f/nvlist_xdup.9f 0444 root bin
+f usr/share/man/man9f/nvlist_xpack.9f 0444 root bin
+f usr/share/man/man9f/nvlist_xunpack.9f 0444 root bin
+f usr/share/man/man9f/nvpair_name.9f 0444 root bin
+f usr/share/man/man9f/nvpair_type.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_boolean_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_byte.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_byte_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_int16.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_int16_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_int32.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_int32_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_int64.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_int64_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_int8.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_int8_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_nvlist.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_nvlist_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_string.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_string_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_uint16.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_uint16_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_uint32.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_uint32_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_uint64.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_uint64_array.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_uint8.9f 0444 root bin
+f usr/share/man/man9f/nvpair_value_uint8_array.9f 0444 root bin
+f usr/share/man/man9f/otherq.9f 0444 root bin
+f usr/share/man/man9f/outb.9f 0444 root bin
+f usr/share/man/man9f/outl.9f 0444 root bin
+f usr/share/man/man9f/outw.9f 0444 root bin
+f usr/share/man/man9f/pci_config_get16.9f 0444 root bin
+f usr/share/man/man9f/pci_config_get32.9f 0444 root bin
+f usr/share/man/man9f/pci_config_get64.9f 0444 root bin
+f usr/share/man/man9f/pci_config_get8.9f 0444 root bin
+f usr/share/man/man9f/pci_config_getb.9f 0444 root bin
+f usr/share/man/man9f/pci_config_getl.9f 0444 root bin
+f usr/share/man/man9f/pci_config_getll.9f 0444 root bin
+f usr/share/man/man9f/pci_config_getw.9f 0444 root bin
+f usr/share/man/man9f/pci_config_put16.9f 0444 root bin
+f usr/share/man/man9f/pci_config_put32.9f 0444 root bin
+f usr/share/man/man9f/pci_config_put64.9f 0444 root bin
+f usr/share/man/man9f/pci_config_put8.9f 0444 root bin
+f usr/share/man/man9f/pci_config_putb.9f 0444 root bin
+f usr/share/man/man9f/pci_config_putl.9f 0444 root bin
+f usr/share/man/man9f/pci_config_putll.9f 0444 root bin
+f usr/share/man/man9f/pci_config_putw.9f 0444 root bin
+f usr/share/man/man9f/pci_config_setup.9f 0444 root bin
+f usr/share/man/man9f/pci_config_teardown.9f 0444 root bin
+f usr/share/man/man9f/pci_ereport_post.9f 0444 root bin
+f usr/share/man/man9f/pci_ereport_setup.9f 0444 root bin
+f usr/share/man/man9f/pci_ereport_teardown.9f 0444 root bin
+f usr/share/man/man9f/pci_report_pmcap.9f 0444 root bin
+f usr/share/man/man9f/pci_restore_config_regs.9f 0444 root bin
+f usr/share/man/man9f/pci_save_config_regs.9f 0444 root bin
+f usr/share/man/man9f/physio.9f 0444 root bin
+f usr/share/man/man9f/pm_busy_component.9f 0444 root bin
+f usr/share/man/man9f/pm_idle_component.9f 0444 root bin
+f usr/share/man/man9f/pm_lower_power.9f 0444 root bin
+f usr/share/man/man9f/pm_power_has_changed.9f 0444 root bin
+f usr/share/man/man9f/pm_raise_power.9f 0444 root bin
+f usr/share/man/man9f/pm_trans_check.9f 0444 root bin
+f usr/share/man/man9f/pollwakeup.9f 0444 root bin
+f usr/share/man/man9f/priv_getbyname.9f 0444 root bin
+f usr/share/man/man9f/priv_policy.9f 0444 root bin
+f usr/share/man/man9f/priv_policy_choice.9f 0444 root bin
+f usr/share/man/man9f/priv_policy_only.9f 0444 root bin
+f usr/share/man/man9f/proc_ref.9f 0444 root bin
+f usr/share/man/man9f/proc_signal.9f 0444 root bin
+f usr/share/man/man9f/proc_unref.9f 0444 root bin
+f usr/share/man/man9f/ptob.9f 0444 root bin
+f usr/share/man/man9f/pullupmsg.9f 0444 root bin
+f usr/share/man/man9f/put.9f 0444 root bin
+f usr/share/man/man9f/putbq.9f 0444 root bin
+f usr/share/man/man9f/putctl.9f 0444 root bin
+f usr/share/man/man9f/putctl1.9f 0444 root bin
+f usr/share/man/man9f/putnext.9f 0444 root bin
+f usr/share/man/man9f/putnextctl.9f 0444 root bin
+f usr/share/man/man9f/putnextctl1.9f 0444 root bin
+f usr/share/man/man9f/putq.9f 0444 root bin
+f usr/share/man/man9f/qassociate.9f 0444 root bin
+f usr/share/man/man9f/qbufcall.9f 0444 root bin
+f usr/share/man/man9f/qenable.9f 0444 root bin
+f usr/share/man/man9f/qprocsoff.9f 0444 root bin
+f usr/share/man/man9f/qprocson.9f 0444 root bin
+f usr/share/man/man9f/qreply.9f 0444 root bin
+f usr/share/man/man9f/qsize.9f 0444 root bin
+f usr/share/man/man9f/qtimeout.9f 0444 root bin
+f usr/share/man/man9f/qunbufcall.9f 0444 root bin
+f usr/share/man/man9f/quntimeout.9f 0444 root bin
+f usr/share/man/man9f/qwait.9f 0444 root bin
+f usr/share/man/man9f/qwait_sig.9f 0444 root bin
+f usr/share/man/man9f/qwriter.9f 0444 root bin
+f usr/share/man/man9f/rd.9f 0444 root bin
+f usr/share/man/man9f/repinsb.9f 0444 root bin
+f usr/share/man/man9f/repinsd.9f 0444 root bin
+f usr/share/man/man9f/repinsw.9f 0444 root bin
+f usr/share/man/man9f/repoutsb.9f 0444 root bin
+f usr/share/man/man9f/repoutsd.9f 0444 root bin
+f usr/share/man/man9f/repoutsw.9f 0444 root bin
+f usr/share/man/man9f/rmalloc.9f 0444 root bin
+f usr/share/man/man9f/rmalloc_wait.9f 0444 root bin
+f usr/share/man/man9f/rmallocmap.9f 0444 root bin
+f usr/share/man/man9f/rmallocmap_wait.9f 0444 root bin
+f usr/share/man/man9f/rmfree.9f 0444 root bin
+f usr/share/man/man9f/rmfreemap.9f 0444 root bin
+f usr/share/man/man9f/rmvb.9f 0444 root bin
+f usr/share/man/man9f/rmvq.9f 0444 root bin
+f usr/share/man/man9f/rw_destroy.9f 0444 root bin
+f usr/share/man/man9f/rw_downgrade.9f 0444 root bin
+f usr/share/man/man9f/rw_enter.9f 0444 root bin
+f usr/share/man/man9f/rw_exit.9f 0444 root bin
+f usr/share/man/man9f/rw_init.9f 0444 root bin
+f usr/share/man/man9f/rw_read_locked.9f 0444 root bin
+f usr/share/man/man9f/rw_tryenter.9f 0444 root bin
+f usr/share/man/man9f/rw_tryupgrade.9f 0444 root bin
+f usr/share/man/man9f/rwlock.9f 0444 root bin
+f usr/share/man/man9f/samestr.9f 0444 root bin
+f usr/share/man/man9f/scsi_abort.9f 0444 root bin
+f usr/share/man/man9f/scsi_alloc_consistent_buf.9f 0444 root bin
+f usr/share/man/man9f/scsi_cname.9f 0444 root bin
+f usr/share/man/man9f/scsi_destroy_pkt.9f 0444 root bin
+f usr/share/man/man9f/scsi_dmafree.9f 0444 root bin
+f usr/share/man/man9f/scsi_dmaget.9f 0444 root bin
+f usr/share/man/man9f/scsi_dname.9f 0444 root bin
+f usr/share/man/man9f/scsi_errmsg.9f 0444 root bin
+f usr/share/man/man9f/scsi_ext_sense_fields.9f 0444 root bin
+f usr/share/man/man9f/scsi_find_sense_descr.9f 0444 root bin
+f usr/share/man/man9f/scsi_free_consistent_buf.9f 0444 root bin
+f usr/share/man/man9f/scsi_get_device_type_scsi_options.9f 0444 root bin
+f usr/share/man/man9f/scsi_get_device_type_string.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_attach.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_attach_setup.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_detach.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_fini.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_init.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_lookup_capstr.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_pkt_alloc.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_pkt_comp.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_pkt_free.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_probe.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_tran_alloc.9f 0444 root bin
+f usr/share/man/man9f/scsi_hba_tran_free.9f 0444 root bin
+f usr/share/man/man9f/scsi_ifgetcap.9f 0444 root bin
+f usr/share/man/man9f/scsi_ifsetcap.9f 0444 root bin
+f usr/share/man/man9f/scsi_init_pkt.9f 0444 root bin
+f usr/share/man/man9f/scsi_log.9f 0444 root bin
+f usr/share/man/man9f/scsi_mname.9f 0444 root bin
+f usr/share/man/man9f/scsi_pktalloc.9f 0444 root bin
+f usr/share/man/man9f/scsi_pktfree.9f 0444 root bin
+f usr/share/man/man9f/scsi_poll.9f 0444 root bin
+f usr/share/man/man9f/scsi_probe.9f 0444 root bin
+f usr/share/man/man9f/scsi_resalloc.9f 0444 root bin
+f usr/share/man/man9f/scsi_reset.9f 0444 root bin
+f usr/share/man/man9f/scsi_reset_notify.9f 0444 root bin
+f usr/share/man/man9f/scsi_resfree.9f 0444 root bin
+f usr/share/man/man9f/scsi_rname.9f 0444 root bin
+f usr/share/man/man9f/scsi_sense_asc.9f 0444 root bin
+f usr/share/man/man9f/scsi_sense_ascq.9f 0444 root bin
+f usr/share/man/man9f/scsi_sense_cmdspecific_uint64.9f 0444 root bin
+f usr/share/man/man9f/scsi_sense_info_uint64.9f 0444 root bin
+f usr/share/man/man9f/scsi_sense_key.9f 0444 root bin
+f usr/share/man/man9f/scsi_setup_cdb.9f 0444 root bin
+f usr/share/man/man9f/scsi_slave.9f 0444 root bin
+f usr/share/man/man9f/scsi_sname.9f 0444 root bin
+f usr/share/man/man9f/scsi_sync_pkt.9f 0444 root bin
+f usr/share/man/man9f/scsi_transport.9f 0444 root bin
+f usr/share/man/man9f/scsi_unprobe.9f 0444 root bin
+f usr/share/man/man9f/scsi_unslave.9f 0444 root bin
+f usr/share/man/man9f/scsi_validate_sense.9f 0444 root bin
+f usr/share/man/man9f/scsi_vu_errmsg.9f 0444 root bin
+f usr/share/man/man9f/sema_destroy.9f 0444 root bin
+f usr/share/man/man9f/sema_init.9f 0444 root bin
+f usr/share/man/man9f/sema_p.9f 0444 root bin
+f usr/share/man/man9f/sema_p_sig.9f 0444 root bin
+f usr/share/man/man9f/sema_tryp.9f 0444 root bin
+f usr/share/man/man9f/sema_v.9f 0444 root bin
+f usr/share/man/man9f/semaphore.9f 0444 root bin
+f usr/share/man/man9f/stoi.9f 0444 root bin
+f usr/share/man/man9f/strcasecmp.9f 0444 root bin
+f usr/share/man/man9f/strchr.9f 0444 root bin
+f usr/share/man/man9f/strcmp.9f 0444 root bin
+f usr/share/man/man9f/strcpy.9f 0444 root bin
+f usr/share/man/man9f/strdup.9f 0444 root bin
+f usr/share/man/man9f/strfree.9f 0444 root bin
+f usr/share/man/man9f/string.9f 0444 root bin
+f usr/share/man/man9f/strlcat.9f 0444 root bin
+f usr/share/man/man9f/strlcpy.9f 0444 root bin
+f usr/share/man/man9f/strlen.9f 0444 root bin
+f usr/share/man/man9f/strlog.9f 0444 root bin
+f usr/share/man/man9f/strncasecmp.9f 0444 root bin
+f usr/share/man/man9f/strncat.9f 0444 root bin
+f usr/share/man/man9f/strncmp.9f 0444 root bin
+f usr/share/man/man9f/strncpy.9f 0444 root bin
+f usr/share/man/man9f/strnlen.9f 0444 root bin
+f usr/share/man/man9f/strqget.9f 0444 root bin
+f usr/share/man/man9f/strqset.9f 0444 root bin
+f usr/share/man/man9f/strrchr.9f 0444 root bin
+f usr/share/man/man9f/strspn.9f 0444 root bin
+f usr/share/man/man9f/swab.9f 0444 root bin
+f usr/share/man/man9f/taskq.9f 0444 root bin
+f usr/share/man/man9f/taskq_suspended.9f 0444 root bin
+f usr/share/man/man9f/testb.9f 0444 root bin
+f usr/share/man/man9f/timeout.9f 0444 root bin
+f usr/share/man/man9f/u8_strcmp.9f 0444 root bin
+f usr/share/man/man9f/u8_textprep_str.9f 0444 root bin
+f usr/share/man/man9f/u8_validate.9f 0444 root bin
+f usr/share/man/man9f/uconv_u16tou32.9f 0444 root bin
+f usr/share/man/man9f/uconv_u16tou8.9f 0444 root bin
+f usr/share/man/man9f/uconv_u32tou16.9f 0444 root bin
+f usr/share/man/man9f/uconv_u32tou8.9f 0444 root bin
+f usr/share/man/man9f/uconv_u8tou16.9f 0444 root bin
+f usr/share/man/man9f/uconv_u8tou32.9f 0444 root bin
+f usr/share/man/man9f/uiomove.9f 0444 root bin
+f usr/share/man/man9f/unbufcall.9f 0444 root bin
+f usr/share/man/man9f/unfreezestr.9f 0444 root bin
+f usr/share/man/man9f/unlinkb.9f 0444 root bin
+f usr/share/man/man9f/untimeout.9f 0444 root bin
+f usr/share/man/man9f/ureadc.9f 0444 root bin
+f usr/share/man/man9f/usb_alloc_bulk_req.9f 0444 root bin
+f usr/share/man/man9f/usb_alloc_ctrl_req.9f 0444 root bin
+f usr/share/man/man9f/usb_alloc_intr_req.9f 0444 root bin
+f usr/share/man/man9f/usb_alloc_isoc_req.9f 0444 root bin
+f usr/share/man/man9f/usb_alloc_request.9f 0444 root bin
+f usr/share/man/man9f/usb_client_attach.9f 0444 root bin
+f usr/share/man/man9f/usb_client_detach.9f 0444 root bin
+f usr/share/man/man9f/usb_clr_feature.9f 0444 root bin
+f usr/share/man/man9f/usb_create_pm_components.9f 0444 root bin
+f usr/share/man/man9f/usb_free_bulk_req.9f 0444 root bin
+f usr/share/man/man9f/usb_free_ctrl_req.9f 0444 root bin
+f usr/share/man/man9f/usb_free_descr_tree.9f 0444 root bin
+f usr/share/man/man9f/usb_free_dev_data.9f 0444 root bin
+f usr/share/man/man9f/usb_free_intr_req.9f 0444 root bin
+f usr/share/man/man9f/usb_free_isoc_req.9f 0444 root bin
+f usr/share/man/man9f/usb_get_addr.9f 0444 root bin
+f usr/share/man/man9f/usb_get_alt_if.9f 0444 root bin
+f usr/share/man/man9f/usb_get_cfg.9f 0444 root bin
+f usr/share/man/man9f/usb_get_current_frame_number.9f 0444 root bin
+f usr/share/man/man9f/usb_get_dev_data.9f 0444 root bin
+f usr/share/man/man9f/usb_get_if_number.9f 0444 root bin
+f usr/share/man/man9f/usb_get_max_pkts_per_isoc_request.9f 0444 root bin
+f usr/share/man/man9f/usb_get_status.9f 0444 root bin
+f usr/share/man/man9f/usb_get_string_descr.9f 0444 root bin
+f usr/share/man/man9f/usb_handle_remote_wakeup.9f 0444 root bin
+f usr/share/man/man9f/usb_lookup_ep_data.9f 0444 root bin
+f usr/share/man/man9f/usb_owns_device.9f 0444 root bin
+f usr/share/man/man9f/usb_parse_data.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_bulk_xfer.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_close.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_ctrl_xfer.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_ctrl_xfer_wait.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_drain_reqs.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_get_max_bulk_transfer_size.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_get_private.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_get_state.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_intr_xfer.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_isoc_xfer.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_open.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_reset.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_set_private.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_stop_intr_polling.9f 0444 root bin
+f usr/share/man/man9f/usb_pipe_stop_isoc_polling.9f 0444 root bin
+f usr/share/man/man9f/usb_print_descr_tree.9f 0444 root bin
+f usr/share/man/man9f/usb_register_hotplug_cbs.9f 0444 root bin
+f usr/share/man/man9f/usb_reset_device.9f 0444 root bin
+f usr/share/man/man9f/usb_set_alt_if.9f 0444 root bin
+f usr/share/man/man9f/usb_set_cfg.9f 0444 root bin
+f usr/share/man/man9f/usb_unregister_hotplug_cbs.9f 0444 root bin
+f usr/share/man/man9f/uwritec.9f 0444 root bin
+f usr/share/man/man9f/va_arg.9f 0444 root bin
+f usr/share/man/man9f/va_copy.9f 0444 root bin
+f usr/share/man/man9f/va_end.9f 0444 root bin
+f usr/share/man/man9f/va_start.9f 0444 root bin
+f usr/share/man/man9f/vcmn_err.9f 0444 root bin
+f usr/share/man/man9f/vsprintf.9f 0444 root bin
+f usr/share/man/man9f/wr.9f 0444 root bin
+f usr/share/man/man9f/zcmn_err.9f 0444 root bin
+d usr/share/man/man9p 0755 root bin
+f usr/share/man/man9p/Nblock.9p 0444 root bin
+f usr/share/man/man9p/blksize.9p 0444 root bin
+f usr/share/man/man9p/ddi-forceattach.9p 0444 root bin
+f usr/share/man/man9p/ddi-no-autodetach.9p 0444 root bin
+f usr/share/man/man9p/device-blksize.9p 0444 root bin
+f usr/share/man/man9p/device-nblocks.9p 0444 root bin
+f usr/share/man/man9p/inquiry-device-type.9p 0444 root bin
+f usr/share/man/man9p/inquiry-product-id.9p 0444 root bin
+f usr/share/man/man9p/inquiry-revision-id.9p 0444 root bin
+f usr/share/man/man9p/inquiry-serial-no.9p 0444 root bin
+f usr/share/man/man9p/inquiry-vendor-id.9p 0444 root bin
+f usr/share/man/man9p/no-involuntary-power-cycles.9p 0444 root bin
+f usr/share/man/man9p/pm-components.9p 0444 root bin
+f usr/share/man/man9p/pm.9p 0444 root bin
+f usr/share/man/man9p/removable-media.9p 0444 root bin
+f usr/share/man/man9p/size.9p 0444 root bin
+d usr/share/man/man9s 0755 root bin
+f usr/share/man/man9s/Intro.9s 0444 root bin
+f usr/share/man/man9s/aio_req.9s 0444 root bin
+f usr/share/man/man9s/buf.9s 0444 root bin
+f usr/share/man/man9s/cb_ops.9s 0444 root bin
+f usr/share/man/man9s/copyreq.9s 0444 root bin
+f usr/share/man/man9s/copyresp.9s 0444 root bin
+f usr/share/man/man9s/datab.9s 0444 root bin
+f usr/share/man/man9s/dblk.9s 0444 root bin
+f usr/share/man/man9s/ddi_device_acc_attr.9s 0444 root bin
+f usr/share/man/man9s/ddi_dma_attr.9s 0444 root bin
+f usr/share/man/man9s/ddi_dma_cookie.9s 0444 root bin
+f usr/share/man/man9s/ddi_dma_lim.9s 0444 root bin
+f usr/share/man/man9s/ddi_dma_lim_sparc.9s 0444 root bin
+f usr/share/man/man9s/ddi_dma_lim_x86.9s 0444 root bin
+f usr/share/man/man9s/ddi_dma_req.9s 0444 root bin
+f usr/share/man/man9s/ddi_dmae_req.9s 0444 root bin
+f usr/share/man/man9s/ddi_fm_error.9s 0444 root bin
+f usr/share/man/man9s/ddi_idevice_cookie.9s 0444 root bin
+f usr/share/man/man9s/dev_ops.9s 0444 root bin
+f usr/share/man/man9s/devmap_callback_ctl.9s 0444 root bin
+f usr/share/man/man9s/fmodsw.9s 0444 root bin
+f usr/share/man/man9s/free_rtn.9s 0444 root bin
+f usr/share/man/man9s/gld_mac_info.9s 0444 root bin
+f usr/share/man/man9s/gld_stats.9s 0444 root bin
+f usr/share/man/man9s/hook_nic_event.9s 0444 root bin
+f usr/share/man/man9s/hook_pkt_event.9s 0444 root bin
+f usr/share/man/man9s/hook_t.9s 0444 root bin
+f usr/share/man/man9s/intro.9s 0444 root bin
+f usr/share/man/man9s/iocblk.9s 0444 root bin
+f usr/share/man/man9s/iovec.9s 0444 root bin
+f usr/share/man/man9s/kstat.9s 0444 root bin
+f usr/share/man/man9s/kstat_intr.9s 0444 root bin
+f usr/share/man/man9s/kstat_io.9s 0444 root bin
+f usr/share/man/man9s/kstat_named.9s 0444 root bin
+f usr/share/man/man9s/linkblk.9s 0444 root bin
+f usr/share/man/man9s/mblk.9s 0444 root bin
+f usr/share/man/man9s/modldrv.9s 0444 root bin
+f usr/share/man/man9s/modlinkage.9s 0444 root bin
+f usr/share/man/man9s/modlmisc.9s 0444 root bin
+f usr/share/man/man9s/modlstrmod.9s 0444 root bin
+f usr/share/man/man9s/module_info.9s 0444 root bin
+f usr/share/man/man9s/msgb.9s 0444 root bin
+f usr/share/man/man9s/net_inject_t.9s 0444 root bin
+f usr/share/man/man9s/net_instance_t.9s 0444 root bin
+f usr/share/man/man9s/qband.9s 0444 root bin
+f usr/share/man/man9s/qinit.9s 0444 root bin
+f usr/share/man/man9s/queclass.9s 0444 root bin
+f usr/share/man/man9s/queue.9s 0444 root bin
+f usr/share/man/man9s/scsi_address.9s 0444 root bin
+f usr/share/man/man9s/scsi_arq_status.9s 0444 root bin
+f usr/share/man/man9s/scsi_asc_key_strings.9s 0444 root bin
+f usr/share/man/man9s/scsi_device.9s 0444 root bin
+f usr/share/man/man9s/scsi_extended_sense.9s 0444 root bin
+f usr/share/man/man9s/scsi_hba_tran.9s 0444 root bin
+f usr/share/man/man9s/scsi_inquiry.9s 0444 root bin
+f usr/share/man/man9s/scsi_pkt.9s 0444 root bin
+f usr/share/man/man9s/scsi_status.9s 0444 root bin
+f usr/share/man/man9s/streamtab.9s 0444 root bin
+f usr/share/man/man9s/stroptions.9s 0444 root bin
+f usr/share/man/man9s/tuple.9s 0444 root bin
+f usr/share/man/man9s/uio.9s 0444 root bin
+f usr/share/man/man9s/usb_bulk_request.9s 0444 root bin
+f usr/share/man/man9s/usb_callback_flags.9s 0444 root bin
+f usr/share/man/man9s/usb_cfg_descr.9s 0444 root bin
+f usr/share/man/man9s/usb_client_dev_data.9s 0444 root bin
+f usr/share/man/man9s/usb_completion_reason.9s 0444 root bin
+f usr/share/man/man9s/usb_ctrl_request.9s 0444 root bin
+f usr/share/man/man9s/usb_dev_descr.9s 0444 root bin
+f usr/share/man/man9s/usb_dev_qlf_descr.9s 0444 root bin
+f usr/share/man/man9s/usb_ep_descr.9s 0444 root bin
+f usr/share/man/man9s/usb_if_descr.9s 0444 root bin
+f usr/share/man/man9s/usb_intr_request.9s 0444 root bin
+f usr/share/man/man9s/usb_isoc_request.9s 0444 root bin
+f usr/share/man/man9s/usb_other_speed_cfg_descr.9s 0444 root bin
+f usr/share/man/man9s/usb_request_attributes.9s 0444 root bin
+f usr/share/man/man9s/usb_string_descr.9s 0444 root bin
+d usr/share/src 0755 root sys
+s usr/spool=../var/spool
+s usr/src=share/src
+s usr/tmp=../var/tmp
+d usr/ucb 0755 root bin
+d usr/ucb/amd64 0755 root bin
+f usr/ucb/amd64/ps 0555 root bin
+f usr/ucb/df 0755 root bin
+d usr/ucb/i86 0755 root bin
+f usr/ucb/i86/ps 0555 root bin
+f usr/ucb/ls 0755 root bin
+s usr/ucb/more=../bin/more
+s usr/ucb/page=../bin/more
+h usr/ucb/ps=usr/lib/isaexec
+f usr/ucb/shutdown 0755 root bin
+f usr/ucb/touch 0755 root bin
+s usr/ucb/uptime=../bin/uptime
+d usr/ucbinclude 0755 root bin
+f usr/ucbinclude/curses.h 0755 root bin
+f usr/ucbinclude/dbm.h 0755 root bin
+s usr/ucbinclude/fcntl.h=sys/fcntl.h
+f usr/ucbinclude/setjmp.h 0755 root bin
+f usr/ucbinclude/sgtty.h 0755 root bin
+f usr/ucbinclude/signal.h 0755 root bin
+f usr/ucbinclude/stdio.h 0755 root bin
+f usr/ucbinclude/strings.h 0755 root bin
+d usr/ucbinclude/sys 0755 root bin
+f usr/ucbinclude/sys/dir.h 0755 root bin
+f usr/ucbinclude/sys/fcntl.h 0755 root bin
+f usr/ucbinclude/sys/file.h 0755 root bin
+f usr/ucbinclude/sys/ioctl.h 0755 root bin
+f usr/ucbinclude/sys/param.h 0755 root bin
+f usr/ucbinclude/sys/resource.h 0755 root bin
+f usr/ucbinclude/sys/rusage.h 0755 root bin
+f usr/ucbinclude/sys/signal.h 0755 root bin
+f usr/ucbinclude/sys/sysmacros.h 0755 root bin
+f usr/ucbinclude/sys/ttychars.h 0755 root bin
+f usr/ucbinclude/sys/types.h 0755 root bin
+f usr/ucbinclude/sys/vfs.h 0755 root bin
+f usr/ucbinclude/sys/wait.h 0755 root bin
+f usr/ucbinclude/unistd.h 0755 root bin
+d usr/ucblib 0755 root bin
+s usr/ucblib/32=.
+s usr/ucblib/64=amd64
+d usr/ucblib/amd64 0755 root bin
+s usr/ucblib/amd64/libucb.so=libucb.so.1
+f usr/ucblib/amd64/libucb.so.1 0755 root bin
+s usr/ucblib/libucb.so=libucb.so.1
+f usr/ucblib/libucb.so.1 0755 root bin
+d usr/xpg4 0755 root bin
+d usr/xpg4/bin 0755 root bin
+s usr/xpg4/bin/alias=../../bin/alias
+f usr/xpg4/bin/ar 0555 root bin
+f usr/xpg4/bin/at 4755 root bin
+f usr/xpg4/bin/awk 0555 root bin
+f usr/xpg4/bin/basename 0555 root bin
+f usr/xpg4/bin/batch 0555 root bin
+s usr/xpg4/bin/bg=../../bin/alias
+s usr/xpg4/bin/cd=../../bin/alias
+f usr/xpg4/bin/chgrp 0555 root bin
+f usr/xpg4/bin/chown 0555 root bin
+s usr/xpg4/bin/command=../../bin/alias
+f usr/xpg4/bin/cp 0555 root bin
+f usr/xpg4/bin/crontab 4555 root bin
+f usr/xpg4/bin/ctags 0555 root bin
+f usr/xpg4/bin/date 0555 root bin
+f usr/xpg4/bin/df 0555 root bin
+f usr/xpg4/bin/du 0555 root bin
+f usr/xpg4/bin/ed 0555 root bin
+f usr/xpg4/bin/edit 0555 root bin
+h usr/xpg4/bin/egrep=usr/xpg4/bin/grep
+f usr/xpg4/bin/env 0555 root bin
+h usr/xpg4/bin/ex=usr/xpg4/bin/edit
+f usr/xpg4/bin/expr 0555 root bin
+s usr/xpg4/bin/fc=../../bin/alias
+s usr/xpg4/bin/fg=../../bin/alias
+h usr/xpg4/bin/fgrep=usr/xpg4/bin/grep
+f usr/xpg4/bin/file 0555 root bin
+f usr/xpg4/bin/find 0555 root bin
+f usr/xpg4/bin/getconf 0555 root bin
+s usr/xpg4/bin/getopts=../../bin/alias
+f usr/xpg4/bin/grep 0555 root bin
+s usr/xpg4/bin/hash=../../bin/alias
+f usr/xpg4/bin/id 0555 root bin
+s usr/xpg4/bin/ipcs=../../bin/ipcs
+s usr/xpg4/bin/jobs=../../bin/alias
+s usr/xpg4/bin/kill=../../bin/alias
+f usr/xpg4/bin/link 0555 root bin
+h usr/xpg4/bin/ln=usr/xpg4/bin/cp
+f usr/xpg4/bin/ls 0555 root bin
+f usr/xpg4/bin/m4 0555 root bin
+f usr/xpg4/bin/more 0555 root bin
+h usr/xpg4/bin/mv=usr/xpg4/bin/cp
+f usr/xpg4/bin/nice 0555 root bin
+f usr/xpg4/bin/nl 0555 root bin
+f usr/xpg4/bin/nm 0555 root bin
+f usr/xpg4/bin/nohup 0555 root bin
+s usr/xpg4/bin/od=../../bin/od
+s usr/xpg4/bin/pfsh=../../bin/pfexec
+f usr/xpg4/bin/pr 0555 root bin
+s usr/xpg4/bin/read=../../bin/alias
+f usr/xpg4/bin/rm 0555 root bin
+f usr/xpg4/bin/sed 0555 root bin
+s usr/xpg4/bin/sh=../../bin/ksh93
+f usr/xpg4/bin/sort 0555 root bin
+f usr/xpg4/bin/stty 0555 root bin
+s usr/xpg4/bin/tail=../../bin/tail
+s usr/xpg4/bin/test=../../bin/alias
+s usr/xpg4/bin/tr=../../bin/tr
+s usr/xpg4/bin/type=../../bin/alias
+s usr/xpg4/bin/ulimit=../../bin/alias
+s usr/xpg4/bin/umask=../../bin/alias
+s usr/xpg4/bin/unalias=../../bin/alias
+h usr/xpg4/bin/vedit=usr/xpg4/bin/edit
+h usr/xpg4/bin/vi=usr/xpg4/bin/edit
+h usr/xpg4/bin/view=usr/xpg4/bin/edit
+s usr/xpg4/bin/wait=../../bin/alias
+f usr/xpg4/bin/who 0555 root bin
+d usr/xpg4/include 0755 root bin
+f usr/xpg4/include/curses.h 0644 root bin
+f usr/xpg4/include/term.h 0644 root bin
+f usr/xpg4/include/unctrl.h 0644 root bin
+d usr/xpg4/lib 0755 root bin
+s usr/xpg4/lib/64=amd64
+d usr/xpg4/lib/amd64 0755 root bin
+f usr/xpg4/lib/amd64/libcurses.so.1 0755 root bin
+f usr/xpg4/lib/amd64/libcurses.so.2 0755 root bin
+s usr/xpg4/lib/amd64/libcurses.so=libcurses.so.2
+f usr/xpg4/lib/libcurses.so.1 0755 root bin
+f usr/xpg4/lib/libcurses.so.2 0755 root bin
+s usr/xpg4/lib/libcurses.so=libcurses.so.2
+d var 0755 root sys
+d var/adm 0775 root sys
+d var/adm/acct 0775 adm adm
+d var/adm/acct/fiscal 0775 adm adm
+d var/adm/acct/nite 0775 adm adm
+d var/adm/acct/sum 0775 adm adm
+d var/adm/exacct 0755 adm adm
+d var/adm/log 0755 adm adm
+d var/adm/pool 0755 root sys
+d var/adm/sa 0775 adm sys
+d var/adm/sm.bin 0755 root sys
+d var/adm/streams 0755 root sys
+d var/audit 0755 root sys
+d var/cache 0755 root bin
+d var/cores 0755 root sys
+d var/cron 0755 root sys
+d var/db 0755 root sys
+d var/db/ipf 0755 root sys
+d var/fm 0755 root sys
+d var/fm/fmd 0755 root sys
+d var/fm/fmd/ckpt 0755 root sys
+d var/fm/fmd/rsrc 0755 root sys
+d var/fm/fmd/xprt 0755 root sys
+d var/games 0755 root bin
+d var/idmap 0755 daemon daemon
+d var/inet 0755 root sys
+d var/krb5 0755 root sys
+d var/krb5/rcache 1777 root sys
+d var/krb5/rcache/root 0700 root sys
+d var/ldap 0755 root sys
+d var/lib 0755 root other
+d var/lib/sgml 0755 root sys
+s var/lib/sgml/CATALOG.jade_dsl=CATALOG.openjade
+d var/log 0755 root sys
+d var/log/pool 0755 root sys
+d var/logadm 0755 root bin
+d var/mail 1777 root mail
+d var/mail/:saved 0775 root mail
+d var/news 0755 root bin
+d var/ntp 0755 root sys
+d var/ntp/ntpstats 0755 root sys
+d var/opt 0755 root sys
+d var/pkg 0755 root root
+d var/pkg/download 0755 root root
+d var/pkg/file 0755 root root
+d var/pkg/history 0755 root root
+d var/pkg/index 0755 root root
+d var/pkg/pkg 0755 root root
+d var/pkg/publisher 0755 root root
+d var/pkg/state 0755 root root
+d var/pkg/state/installed 0755 root root
+d var/pkg/state/known 0755 root root
+d var/pkg/tmp 0755 root root
+d var/preserve 1777 root bin
+d var/run 0755 root sys
+d var/sadm 0755 root sys
+d var/sadm/install 0755 root bin
+d var/sadm/install/admin 0755 root bin
+d var/sadm/install/logs 0555 root bin
+d var/sadm/install_data 0755 root sys
+d var/sadm/pkg 0555 root sys
+d var/sadm/security 0555 root sys
+d var/sadm/softinfo 0755 root sys
+s var/sadm/softinfo/INST_RELEASE=../system/admin/INST_RELEASE
+d var/sadm/system 0755 root sys
+d var/sadm/system/admin 0755 root sys
+d var/sadm/system/admin/services 0755 root sys
+d var/sadm/system/data 0755 root sys
+d var/sadm/system/logs 0755 root sys
+d var/saf 0755 root bin
+d var/saf/zsmon 0755 root sys
+d var/smb 0755 root sys
+d var/spool 0755 root bin
+d var/spool/clientmqueue 0770 smmsp smmsp
+d var/spool/cron 0755 root sys
+d var/spool/cron/atjobs 0755 root sys
+d var/spool/cron/crontabs 0755 root sys
+d var/spool/locks 0755 uucp uucp
+d var/spool/mqueue 0750 root bin
+d var/spool/pkg 1777 root bin
+d var/ssh 0755 root sys
+d var/svc 0755 root sys
+d var/svc/log 0755 root sys
+d var/svc/manifest 0755 root sys
+d var/svc/manifest/application 0755 root sys
+d var/svc/manifest/application/management 0755 root sys
+d var/svc/manifest/application/security 0755 root sys
+d var/svc/manifest/device 0755 root sys
+d var/svc/manifest/milestone 0755 root sys
+d var/svc/manifest/network 0755 root sys
+d var/svc/manifest/network/dns 0755 root sys
+d var/svc/manifest/network/ipsec 0755 root sys
+d var/svc/manifest/network/ldap 0755 root sys
+d var/svc/manifest/network/nfs 0755 root sys
+d var/svc/manifest/network/nis 0755 root sys
+d var/svc/manifest/network/routing 0755 root sys
+d var/svc/manifest/network/rpc 0755 root sys
+d var/svc/manifest/network/security 0755 root sys
+d var/svc/manifest/network/shares 0755 root sys
+d var/svc/manifest/network/ssl 0755 root sys
+d var/svc/manifest/platform 0755 root sys
+d var/svc/manifest/site 0755 root sys
+d var/svc/manifest/system 0755 root sys
+d var/svc/manifest/system/device 0755 root sys
+d var/svc/manifest/system/filesystem 0755 root sys
+d var/svc/manifest/system/security 0755 root sys
+d var/svc/manifest/system/svc 0755 root sys
+d var/svc/profile 0755 root sys
+d var/tmp 1777 root sys
+d var/yp 0755 root bin
+d var/yp/binding 0755 root bin
diff --git a/usr/src/Makefile b/usr/src/Makefile
index 722fa72f8a..eadc394b7d 100644
--- a/usr/src/Makefile
+++ b/usr/src/Makefile
@@ -45,7 +45,7 @@ $(SPARC_BLD)psm: stand
SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
-HDRSUBDIRS= uts head lib cmd
+HDRSUBDIRS= uts head lib cmd ucbhead
# UCB headers are bug-for-bug compatible and not checkable against the header
# standards.
@@ -55,7 +55,7 @@ CHKHDRSUBDIRS= head uts lib
#
# Headers that can be built in parallel
#
-PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders
+PARALLEL_HEADERS = sysheaders userheaders libheaders ucbheaders cmdheaders
#
# Directories that can be built in parallel
@@ -107,7 +107,7 @@ all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg
# packaging to be pulled from $(SRC) and $(CLOSED) and staged in
# $(ROOT)/licenses.
#
-install: install1 install2 _msg stage-licenses
+install: install1 install2 _msg
@cd msg; pwd; $(MAKE) _msg
@rm -rf "$(ROOT)/catalog"
@@ -155,13 +155,13 @@ closedbins: bldtools $(ROOTDIRS) FRC
.PARALLEL: $(PARALLEL_HEADERS) DUMMY
.PARALLEL: $(PARALLEL_DIRS) DUMMY
-$(SUBDIRS) head pkg: FRC
+$(SUBDIRS) head ucbhead pkg: FRC
@cd $@; pwd; $(MAKE) $(TARGET)
# librpcsvc has a dependency on headers installed by
# userheaders, hence the .WAIT before libheaders.
sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
- libheaders cmdheaders
+ libheaders ucbheaders cmdheaders
#
# Top-level setup target to setup the development environment that includes
@@ -198,6 +198,9 @@ libheaders: bldtools
sysheaders: FRC
@cd uts; pwd; $(MAKE) install_h
+ucbheaders: FRC
+ @cd ucbhead; pwd; $(MAKE) install_h
+
cmdheaders: FRC
@cd cmd/fm; pwd; $(MAKE) install_h
@cd cmd/mdb; pwd; $(MAKE) install_h
diff --git a/usr/src/Makefile.lint b/usr/src/Makefile.lint
index 6c8b973928..03850d711c 100644
--- a/usr/src/Makefile.lint
+++ b/usr/src/Makefile.lint
@@ -340,6 +340,7 @@ COMMON_SUBDIRS = \
lib/libbe \
lib/pylibbe \
lib/brand/sn1 \
+ lib/brand/sngl \
lib/brand/solaris10 \
lib/crypt_modules \
lib/extendedFILE \
@@ -461,7 +462,6 @@ COMMON_SUBDIRS = \
lib/pam_modules \
lib/passwdutil \
lib/pkcs11 \
- lib/print \
lib/raidcfg_plugins \
lib/scsi \
lib/smbsrv \
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index 27de79e438..e606c7d5b4 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -30,6 +30,17 @@
ROOT= /proto
#
+# Adjunct root, containing an additional proto area to be used for headers
+# and libraries.
+#
+ADJUNCT_PROTO=
+
+#
+# Adjunct for building things that run on the build machine.
+#
+NATIVE_ADJUNCT= /usr
+
+#
# RELEASE_BUILD should be cleared for final release builds.
# NOT_RELEASE_BUILD is exactly what the name implies.
#
@@ -202,6 +213,8 @@ ELFSIGN= /usr/bin/elfsign
DTRACE= /usr/sbin/dtrace -xnolibs
UNIQ= /usr/bin/uniq
TAR= /usr/bin/tar
+ASTBINDIR= /usr/ast/bin
+MSGCC= $(ASTBINDIR)/msgcc
FILEMODE= 644
DIRMODE= 755
@@ -266,7 +279,8 @@ INS.symlink= $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
# rebuilds if the baked-in mtime != the mtime of the source file
# (rather than only if it's less than), thus when installing python
# files we must make certain to not adjust the mtime of the source
-# (.py) file.
+# (.py) file. As a part of this we also go through and change the #!
+# line in the python script to that of the actual python we are using.
#
INS.pyfile= $(INS.file); $(TOUCH) -r $< $@
@@ -448,9 +462,17 @@ sparcv9_COPTFLAG= -xO3
i386_COPTFLAG= -O
amd64_COPTFLAG= -xO3
+# This would normally be added by cw(1) but cannot be while we want to support
+# Both GCC 3.x and GCC 4.x
+$(__GNUC4)$(MACH)_COPTFLAG += -_gcc=-fno-inline-small-functions \
+ -_gcc=-fno-inline-functions-called-once
+$(__GNUC4)$(MACH64)_COPTFLAG += -_gcc=-fno-inline-small-functions \
+ -_gcc=-fno-inline-functions-called-once
+
COPTFLAG= $($(MACH)_COPTFLAG)
COPTFLAG64= $($(MACH64)_COPTFLAG)
+
# When -g is used, the compiler globalizes static objects
# (gives them a unique prefix). Disable that.
CNOGLOBAL= -W0,-noglobal
@@ -552,8 +574,10 @@ NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging.
DTS_ERRNO=-D_TS_ERRNO
CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
- $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
-CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
+ $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
+ $(ADJUNCT_PROTO:%=-I%/usr/include)
+CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
+ $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
CPPFLAGS= $(CPPFLAGS.master)
AS_CPPFLAGS= $(CPPFLAGS.master)
JAVAFLAGS= -deprecation
@@ -663,6 +687,7 @@ MAPFILE.INT = mapfile-intf
# LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
#
LDLIBS32 = $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
+LDLIBS32 += $(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
LDLIBS.cmd = $(LDLIBS32)
LDLIBS.lib = $(LDLIBS32)
#
@@ -1092,9 +1117,16 @@ PKGPUBLISHER_NONREDIST= on-extra
$(RM) $@;
$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
$(CHMOD) +x $@
+#
+# You might ask why we aren't using -i for sed here. That's because illumos
+# 1815 hasn't been fixed and sadly we didn't back out something that broke a lot
+# of working code in favor of GNU compatibility.
+#
+SED.py= $(SED) -e 's?^$(POUND_SIGN)!ON_PYTHON_26$$?$(POUND_SIGN)!$(PYTHON_26)?' \
+ -e 's?^$(POUND_SIGN)!ON_PYTHON$$?$(POUND_SIGN)!$(PYTHON)?'
.py:
- $(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
+ $(RM) $@; $(SED.py) $< > $@; $(CHMOD) +x $@
.py.pyc:
$(RM) $@
diff --git a/usr/src/Makefile.master.64 b/usr/src/Makefile.master.64
index 850571dbd3..5bfd0e6b76 100644
--- a/usr/src/Makefile.master.64
+++ b/usr/src/Makefile.master.64
@@ -49,6 +49,7 @@ LDLIBS1= $(ENVLDLIBS1:%=%/$(MACH64))
LDLIBS2= $(ENVLDLIBS2:%=%/$(MACH64))
LDLIBS3= $(ENVLDLIBS3:%=%/$(MACH64))
LDLIBS64 = $(LDLIBS1) $(LDLIBS2) $(LDLIBS3)
+LDLIBS64 += $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64))
#
# Moved these up to the top level here, so they can be overridden
#
diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs
index d81535d3f4..3852f0cf8b 100644
--- a/usr/src/Targetdirs
+++ b/usr/src/Targetdirs
@@ -248,6 +248,7 @@ DIRS= \
/usr/lib/brand/labeled \
/usr/lib/brand/shared \
/usr/lib/brand/sn1 \
+ /usr/lib/brand/sngl \
/usr/lib/brand/solaris10 \
/usr/lib/class \
/usr/lib/class/FSS \
@@ -534,6 +535,7 @@ DIRS64= \
/usr/lib/$(MACH64) \
/usr/lib/$(MACH64)/gss \
/usr/lib/brand/sn1/$(MACH64) \
+ /usr/lib/brand/sngl/$(MACH64) \
/usr/lib/brand/solaris10/$(MACH64) \
/usr/lib/elfedit/$(MACH64) \
/usr/lib/fm/$(MACH64) \
@@ -605,6 +607,7 @@ SYM.DIRS64= \
/lib/secure/64 \
/usr/lib/64 \
/usr/lib/brand/sn1/64 \
+ /usr/lib/brand/sngl/64 \
/usr/lib/brand/solaris10/64 \
/usr/lib/elfedit/64 \
/usr/lib/libp/64 \
@@ -713,6 +716,7 @@ $(BUILD64) $(ROOT)/lib/secure/64:= LINKDEST=$(MACH64)
$(BUILD64) $(ROOT)/usr/lib/64:= LINKDEST=$(MACH64)
$(BUILD64) $(ROOT)/usr/lib/elfedit/64:= LINKDEST=$(MACH64)
$(BUILD64) $(ROOT)/usr/lib/brand/sn1/64:= LINKDEST=$(MACH64)
+$(BUILD64) $(ROOT)/usr/lib/brand/sngl/64:= LINKDEST=$(MACH64)
$(BUILD64) $(ROOT)/usr/lib/brand/solaris10/64:= LINKDEST=$(MACH64)
$(BUILD64) $(ROOT)/usr/lib/libp/64:= LINKDEST=$(MACH64)
$(BUILD64) $(ROOT)/usr/lib/lwp/64:= LINKDEST=$(MACH64)
diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile
index 5c05a088f5..3b38625c93 100644
--- a/usr/src/cmd/Makefile
+++ b/usr/src/cmd/Makefile
@@ -21,14 +21,14 @@
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2010 Nexenta Systems, Inc. All rights reserved.
-# Copyright 2011 Joyent, Inc. All rights reserved.
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2013 DEY Storage Systems, Inc. All rights reserved.
include ../Makefile.master
#
-# Note that the commands 'agents', 'lp', 'perl', and 'man' are first in
+# Note that the commands 'perl', and 'man' are first in
# the list, violating alphabetical order. This is because they are very
# long-running and should be given the most wall-clock time for a
# parallel build.
@@ -50,7 +50,6 @@ FIRST_SUBDIRS= \
COMMON_SUBDIRS= \
allocate \
availdevs \
- lp \
perl \
man \
Adm \
@@ -95,6 +94,7 @@ COMMON_SUBDIRS= \
cmd-crypto \
cmd-inet \
col \
+ column \
compress \
consadm \
coreadm \
@@ -188,7 +188,6 @@ COMMON_SUBDIRS= \
groups \
grpck \
gss \
- hal \
halt \
head \
hostid \
@@ -207,6 +206,7 @@ COMMON_SUBDIRS= \
intrstat \
ipcrm \
ipcs \
+ ipdadm \
ipf \
isainfo \
isalist \
@@ -225,7 +225,6 @@ COMMON_SUBDIRS= \
kvmstat \
last \
lastcomm \
- latencytop \
ldap \
ldapcachemgr \
lgrpinfo \
@@ -246,7 +245,6 @@ COMMON_SUBDIRS= \
look \
ls \
luxadm \
- lvm \
mach \
machid \
mail \
@@ -311,7 +309,6 @@ COMMON_SUBDIRS= \
plockstat \
pr \
prctl \
- print \
printf \
priocntl \
profiles \
@@ -329,7 +326,6 @@ COMMON_SUBDIRS= \
pwck \
pwconv \
pwd \
- pyzfs \
raidctl \
ramdiskadm \
rcap \
@@ -511,11 +507,10 @@ sparc_SUBDIRS= \
vntsd
#
-# Commands that are messaged. Note that 'lp' and 'man' come first
-# (see previous comment about 'lp' and 'man').
+# Commands that are messaged. Note that 'man' comes first
+# (see previous comment about 'man').
#
MSGSUBDIRS= \
- lp \
man \
abi \
acctadm \
@@ -628,7 +623,6 @@ MSGSUBDIRS= \
logins \
ls \
luxadm \
- lvm \
mailx \
mesg \
mkdir \
@@ -657,7 +651,6 @@ MSGSUBDIRS= \
power \
pr \
praudit \
- print \
profiles \
projadd \
projects \
@@ -668,7 +661,6 @@ MSGSUBDIRS= \
ptools \
pwconv \
pwd \
- pyzfs \
raidctl \
ramdiskadm \
rcap \
@@ -855,7 +847,6 @@ _dc: $(DCSUBDIRS)
fs.d: fstyp
ksh: shcomp isaexec
mdb: terminfo
-print: lp
$(FIRST_SUBDIRS) $(BWOSDIRS) $(SUBDIRS) $(AUDITSUBDIRS): FRC
@if [ -f $@/Makefile ]; then \
diff --git a/usr/src/cmd/Makefile.check b/usr/src/cmd/Makefile.check
index 5cd0b89828..70c12088bc 100644
--- a/usr/src/cmd/Makefile.check
+++ b/usr/src/cmd/Makefile.check
@@ -118,7 +118,6 @@ MANIFEST_SUBDIRS= \
krb5/krb5kdc \
krb5/kwarn \
krb5/slave \
- lp/cmd/lpsched \
lvm/rpc.mdcommd \
lvm/rpc.metad \
lvm/rpc.metamedd \
@@ -127,8 +126,6 @@ MANIFEST_SUBDIRS= \
lvm/util \
picl/picld \
pools/poold \
- print/bsd-sysv-commands \
- print/ppdmgr \
rcap/rcapd \
rpcsvc/rpc.bootparamd \
sendmail/lib \
diff --git a/usr/src/cmd/availdevs/Makefile b/usr/src/cmd/availdevs/Makefile
index 571c88cd3d..1ca23b0fe9 100644
--- a/usr/src/cmd/availdevs/Makefile
+++ b/usr/src/cmd/availdevs/Makefile
@@ -32,7 +32,7 @@ include ../Makefile.cmd
ROOTCMDDIR= $(ROOTLIB)/zfs
-INCS += -I/usr/include/libxml2
+INCS += -I$(ADJUNCT_PROTO)/usr/include/libxml2
#
# There is no lint library for libxml2, so we need to avoid linking against
diff --git a/usr/src/cmd/boot/bootadm/bootadm_upgrade.c b/usr/src/cmd/boot/bootadm/bootadm_upgrade.c
index b80581432c..17590bc528 100644
--- a/usr/src/cmd/boot/bootadm/bootadm_upgrade.c
+++ b/usr/src/cmd/boot/bootadm/bootadm_upgrade.c
@@ -124,7 +124,6 @@ get_boot_cap(const char *osroot)
}
if (!is_grub(osroot)) {
- bam_error(NOT_GRUB_ROOT, osroot);
return (BAM_ERROR);
}
diff --git a/usr/src/cmd/cmd-crypto/kmfcfg/Makefile b/usr/src/cmd/cmd-crypto/kmfcfg/Makefile
index 33d43da3d9..2200fcc0d7 100644
--- a/usr/src/cmd/cmd-crypto/kmfcfg/Makefile
+++ b/usr/src/cmd/cmd-crypto/kmfcfg/Makefile
@@ -47,7 +47,8 @@ POFILES = $(OBJS:%.o=%.po)
POFILE = $(PROG)_msg.po
MSGFILES = $(SRCS:%.c=%.i)
-CPPFLAGS += -I/usr/include/libxml2 -I$(KMFDIR)/include -I.
+CPPFLAGS += -I$(ADJUNCT_PROTO)//usr/include/libxml2 \
+ -I$(KMFDIR)/include -I.
LDLIBS += -L$(ROOT)/usr/lib -lkmf -lcryptoutil
XMLLIB = -lxml2
diff --git a/usr/src/cmd/cmd-crypto/pktool/Makefile b/usr/src/cmd/cmd-crypto/pktool/Makefile
index 8c4c3d8a1e..d33a9d5cc9 100644
--- a/usr/src/cmd/cmd-crypto/pktool/Makefile
+++ b/usr/src/cmd/cmd-crypto/pktool/Makefile
@@ -48,7 +48,7 @@ POFILES = $(OBJS:%.o=%.po)
POFILE = $(PROG)_msg.po
MSGFILES=$(SRCS:%.c=%.i)
-CPPFLAGS += -I. -I$(KMFDIR)/include -I/usr/include/libxml2 \
+CPPFLAGS += -I. -I$(KMFDIR)/include -I$(ADJUNCT_PROTO)/usr/include/libxml2 \
-I$(KMFDIR)/ber_der/inc
CFLAGS += $(CCVERBOSE) -DDEBUG
diff --git a/usr/src/cmd/cmd-crypto/tpmadm/Makefile b/usr/src/cmd/cmd-crypto/tpmadm/Makefile
index 0cda8bf725..de581b779b 100644
--- a/usr/src/cmd/cmd-crypto/tpmadm/Makefile
+++ b/usr/src/cmd/cmd-crypto/tpmadm/Makefile
@@ -35,7 +35,7 @@ POFILE = $(PROG)_msg.po
MSGFILES=$(SRCS:%.c=%.i)
CPPFLAGS += -xCC
-LINTFLAGS += -XCC -L/usr/lib
+LINTFLAGS += -XCC -L$(ADJUNCT_PROTO)/usr/lib
LDLIBS += -ltspi -luuid
.KEEP_STATE:
diff --git a/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt b/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt
index 77b6be9f54..d5812793d4 100644
--- a/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt
+++ b/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt
@@ -21,6 +21,7 @@
#
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# This daemon stores address object to logical interface number mappings
# (among other things) and reads/writes from/to ipmgmtd data store.
@@ -38,14 +39,16 @@ fi
# When the non-global shared-IP stack zone boots, it tries to bring up this
# service as well. If we don't start a background process and simply exit the
# service, the service will go into maintenance mode and so will all it's
-# dependents.
+# dependents. Ideally we would simply exit with SMF_EXIT_NODAEMON, but since
+# this method is also used in an S10C zone, where support for SMF_EXIT_NODAEMON
+# does not exist, we have to stick around.
#
# In S10C zone (where this script is also used) smf_isnonglobalzone
# function is unavailable in smf_include.sh
#
if [ `/sbin/zonename` != global ]; then
if [ `/sbin/zonename -t` = shared ]; then
- (while true ; do sleep 3600 ; done) &
+ (while true ; do sleep 3600 ; done) &
exit $SMF_EXIT_OK
fi
fi
diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c
index 78da07aebf..9a710f9125 100644
--- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c
+++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*
* REQUESTING state of the client state machine.
*/
@@ -38,6 +39,7 @@
#include <dhcp_hostconf.h>
#include <dhcpagent_util.h>
#include <dhcpmsg.h>
+#include <strings.h>
#include "states.h"
#include "util.h"
@@ -641,8 +643,24 @@ accept_v4_acknak(dhcp_smach_t *dsmp, PKT_LIST *plp)
stop_pkt_retransmission(dsmp);
if (*plp->opts[CD_DHCP_TYPE]->value == NAK) {
- dhcpmsg(MSG_WARNING, "accept_v4_acknak: NAK on interface %s",
- dsmp->dsm_name);
+ char saddr[18];
+
+ saddr[0] = '\0';
+ if (plp->opts[CD_SERVER_ID] != NULL &&
+ plp->opts[CD_SERVER_ID]->len == sizeof (struct in_addr)) {
+ struct in_addr t_server;
+
+ bcopy(plp->opts[CD_SERVER_ID]->value, &t_server,
+ plp->opts[CD_SERVER_ID]->len);
+ (void) strlcpy(saddr, inet_ntoa(t_server),
+ sizeof (saddr));
+ }
+
+ dhcpmsg(MSG_WARNING, "accept_v4_acknak: NAK on interface %s "
+ "from %s %s",
+ dsmp->dsm_name,
+ inet_ntoa(plp->pktfrom.v4.sin_addr), saddr);
+
dsmp->dsm_bad_offers++;
free_pkt_entry(plp);
dhcp_restart(dsmp);
diff --git a/usr/src/cmd/cmd-inet/usr.lib/mdnsd/DNSCommon.c b/usr/src/cmd/cmd-inet/usr.lib/mdnsd/DNSCommon.c
index ce771e3188..173a8f8325 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/mdnsd/DNSCommon.c
+++ b/usr/src/cmd/cmd-inet/usr.lib/mdnsd/DNSCommon.c
@@ -1485,7 +1485,7 @@ mDNSlocal const mDNSu8 *getOptRdata(const mDNSu8 *ptr, const mDNSu8 *const limit
ptr += sizeof(mDNSs32);
nread += sizeof(mDNSs32);
}
- else { LogMsg("ERROR: getOptRdata - unknown opt %d", opt->opt); return mDNSNULL; }
+ else { return mDNSNULL; }
opt++; // increment pointer into rdatabody
}
diff --git a/usr/src/cmd/cmd-inet/usr.lib/vrrpd/vrrpd.c b/usr/src/cmd/cmd-inet/usr.lib/vrrpd/vrrpd.c
index a319c119a6..096ef2422b 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/vrrpd/vrrpd.c
+++ b/usr/src/cmd/cmd-inet/usr.lib/vrrpd/vrrpd.c
@@ -23,6 +23,10 @@
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sockio.h>
@@ -2003,9 +2007,19 @@ vrrpd_updateconf(vrrp_vr_conf_t *newconf, uint_t op)
op == VRRP_CONF_UPDATE ? "update" : "delete");
if ((fp = fopen(vrrpd_conffile, "r+F")) == NULL) {
- vrrp_log(VRRP_ERR, "vrrpd_updateconf(): open %s failed: %s",
- vrrpd_conffile, strerror(errno));
- return (VRRP_EDB);
+ if (errno != ENOENT) {
+ vrrp_log(VRRP_ERR, "vrrpd_updateconf(): open %s for "
+ "update failed: %s", vrrpd_conffile,
+ strerror(errno));
+ return (VRRP_EDB);
+ }
+
+ if ((fp = fopen(vrrpd_conffile, "w+F")) == NULL) {
+ vrrp_log(VRRP_ERR, "vrrpd_updateconf(): open %s for "
+ "write failed: %s", vrrpd_conffile,
+ strerror(errno));
+ return (VRRP_EDB);
+ }
}
(void) snprintf(newfile, MAXPATHLEN, "%s.new", vrrpd_conffile);
@@ -2662,7 +2676,8 @@ vrrpd_enable(const char *vn, boolean_t updateconf)
if ((strlen(conf->vvc_link) == 0) || dladm_name2info(vrrpd_vh->vh_dh,
conf->vvc_link, NULL, &flags, &class, NULL) != DLADM_STATUS_OK ||
!(flags & DLADM_OPT_ACTIVE) || ((class != DATALINK_CLASS_PHYS) &&
- (class != DATALINK_CLASS_VLAN) && (class != DATALINK_CLASS_AGGR))) {
+ (class != DATALINK_CLASS_VLAN) && (class != DATALINK_CLASS_AGGR) &&
+ (class != DATALINK_CLASS_VNIC))) {
vrrp_log(VRRP_DBG1, "vrrpd_enable(%s): invalid link %s",
vn, conf->vvc_link);
return (VRRP_EINVALLINK);
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c
index 71a2fc9853..be826baba2 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c
@@ -21,10 +21,9 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -46,6 +45,7 @@
#include <libscf.h>
#include <libscf_priv.h>
#include <libuutil.h>
+#include <ifaddrs.h>
/*
* This program moves routing management under SMF. We do this by giving
@@ -2335,8 +2335,8 @@ out:
/*
*
- * Return the number of IPv6 addresses configured. This answers the
- * generic question, "is IPv6 configured?". We only start in.ndpd if IPv6
+ * Return the number of non-loopback IPv6 addresses configured. This answers
+ * the generic question, "is IPv6 configured?". We only start in.ndpd if IPv6
* is configured, and we also only enable IPv6 routing daemons if IPv6 is
* enabled.
*/
@@ -2344,28 +2344,24 @@ static int
ra_numv6intfs(void)
{
static int num = -1;
- int ipsock;
- struct lifnum lifn;
+ int cnt;
+ struct ifaddrs *ifp_head, *ifp;
if (num != -1)
return (num);
- if ((ipsock = socket(PF_INET6, SOCK_DGRAM, 0)) == -1) {
- (void) fprintf(stderr,
- gettext("%1$s: unable to open %2$s: %3$s\n"),
- myname, IP_DEV_NAME, strerror(errno));
+ if (getifaddrs(&ifp_head) < 0)
return (0);
- }
- lifn.lifn_family = AF_INET6;
- lifn.lifn_flags = 0;
- if (ioctl(ipsock, SIOCGLIFNUM, &lifn) == -1) {
- (void) close(ipsock);
- return (0);
+ cnt = 0;
+ for (ifp = ifp_head; ifp; ifp = ifp->ifa_next) {
+ if (!(ifp->ifa_flags & IFF_LOOPBACK) &&
+ (ifp->ifa_flags & IFF_IPV6))
+ cnt++;
}
- (void) close(ipsock);
- return (num = lifn.lifn_count);
+ freeifaddrs(ifp_head);
+ return (num = cnt);
}
/*
diff --git a/usr/src/cmd/lp/cmd/Makefile.msg b/usr/src/cmd/column/Makefile
index 55da7c46d3..ab4cf3390e 100644
--- a/usr/src/cmd/lp/cmd/Makefile.msg
+++ b/usr/src/cmd/column/Makefile
@@ -20,16 +20,24 @@
# CDDL HEADER END
#
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-# cmd/lp/cmd/Makefile.msg
-POFILES = $(OBJS:%.o=%.po)
+PROG=column
+
+include ../Makefile.cmd
+
+CFLAGS += $(CCVERBOSE)
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+install: all $(ROOTPROG)
+
+clean:
-include ../../Makefile.lp.msg
+lint: lint_PROG
-catalog: $(POFILE)
- $(CP) $(POFILE) ../..
+include ../Makefile.targ
diff --git a/usr/src/cmd/column/THIRDPARTYLICENSE b/usr/src/cmd/column/THIRDPARTYLICENSE
new file mode 100644
index 0000000000..a80f56cb43
--- /dev/null
+++ b/usr/src/cmd/column/THIRDPARTYLICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 1989, 1993, 1994
+ The Regents of the University of California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+ *
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/usr/src/cmd/column/THIRDPARTYLICENSE.descrip b/usr/src/cmd/column/THIRDPARTYLICENSE.descrip
new file mode 100644
index 0000000000..42051a2982
--- /dev/null
+++ b/usr/src/cmd/column/THIRDPARTYLICENSE.descrip
@@ -0,0 +1 @@
+PORTIONS OF COLUMN COMMAND FUNCTIONALITY
diff --git a/usr/src/cmd/column/column.c b/usr/src/cmd/column/column.c
new file mode 100644
index 0000000000..4f9a3c81a6
--- /dev/null
+++ b/usr/src/cmd/column/column.c
@@ -0,0 +1,335 @@
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+/*
+ * Portions Copyright (c) 2013 Joyent, Inc. All rights reserved.
+ */
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1989, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
+#endif
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/param.h>
+#include <sys/termios.h>
+
+#include <err.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#define TAB 8
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
+
+static void c_columnate(void);
+static void input(FILE *);
+static void maketbl(void);
+static void print(void);
+static void r_columnate(void);
+static void usage(void);
+static int width(const wchar_t *);
+
+static int termwidth = 80; /* default terminal width */
+
+static int entries; /* number of records */
+static int eval; /* exit value */
+static int maxlength; /* longest record */
+static wchar_t **list; /* array of pointers to records */
+static const wchar_t *separator = L"\t "; /* field separator for table option */
+
+int
+main(int argc, char **argv)
+{
+ struct winsize win;
+ FILE *fp;
+ int ch, tflag, xflag;
+ char *p;
+ const char *src;
+ wchar_t *newsep;
+ size_t seplen;
+
+ (void) setlocale(LC_ALL, "");
+
+ if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) {
+ if ((p = getenv("COLUMNS")))
+ termwidth = atoi(p);
+ } else
+ termwidth = win.ws_col;
+
+ tflag = xflag = 0;
+ while ((ch = getopt(argc, argv, "c:s:tx")) != -1)
+ switch (ch) {
+ case 'c':
+ termwidth = atoi(optarg);
+ break;
+ case 's':
+ src = optarg;
+ seplen = mbsrtowcs(NULL, &src, 0, NULL);
+ if (seplen == (size_t)-1)
+ err(1, "bad separator");
+ newsep = malloc((seplen + 1) * sizeof (wchar_t));
+ if (newsep == NULL)
+ err(1, NULL);
+ (void) mbsrtowcs(newsep, &src, seplen + 1, NULL);
+ separator = newsep;
+ break;
+ case 't':
+ tflag = 1;
+ break;
+ case 'x':
+ xflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (!*argv)
+ input(stdin);
+ else for (; *argv; ++argv)
+ if ((fp = fopen(*argv, "rF"))) {
+ input(fp);
+ (void) fclose(fp);
+ } else {
+ warn("%s", *argv);
+ eval = 1;
+ }
+
+ if (!entries)
+ exit(eval);
+
+ maxlength = roundup(maxlength + 1, TAB);
+ if (tflag)
+ maketbl();
+ else if (maxlength >= termwidth)
+ print();
+ else if (xflag)
+ c_columnate();
+ else
+ r_columnate();
+ exit(eval);
+
+ /*NOTREACHED*/
+ return (eval);
+}
+
+static void
+c_columnate(void)
+{
+ int chcnt, col, cnt, endcol, numcols;
+ wchar_t **lp;
+
+ numcols = termwidth / maxlength;
+ endcol = maxlength;
+ for (chcnt = col = 0, lp = list; ; ++lp) {
+ (void) wprintf(L"%ls", *lp);
+ chcnt += width(*lp);
+ if (!--entries)
+ break;
+ if (++col == numcols) {
+ chcnt = col = 0;
+ endcol = maxlength;
+ (void) putwchar('\n');
+ } else {
+ while ((cnt = roundup(chcnt + 1, TAB)) <= endcol) {
+ (void) putwchar('\t');
+ chcnt = cnt;
+ }
+ endcol += maxlength;
+ }
+ }
+ if (chcnt)
+ (void) putwchar('\n');
+}
+
+static void
+r_columnate(void)
+{
+ int base, chcnt, cnt, col, endcol, numcols, numrows, row;
+
+ numcols = termwidth / maxlength;
+ numrows = entries / numcols;
+ if (entries % numcols)
+ ++numrows;
+
+ for (row = 0; row < numrows; ++row) {
+ endcol = maxlength;
+ for (base = row, chcnt = col = 0; col < numcols; ++col) {
+ (void) wprintf(L"%ls", list[base]);
+ chcnt += width(list[base]);
+ if ((base += numrows) >= entries)
+ break;
+ while ((cnt = roundup(chcnt + 1, TAB)) <= endcol) {
+ (void) putwchar('\t');
+ chcnt = cnt;
+ }
+ endcol += maxlength;
+ }
+ (void) putwchar('\n');
+ }
+}
+
+static void
+print(void)
+{
+ int cnt;
+ wchar_t **lp;
+
+ for (cnt = entries, lp = list; cnt--; ++lp)
+ (void) wprintf(L"%ls\n", *lp);
+}
+
+typedef struct _tbl {
+ wchar_t **list;
+ int cols, *len;
+} TBL;
+#define DEFCOLS 25
+
+static void
+maketbl(void)
+{
+ TBL *t;
+ int coloff, cnt;
+ wchar_t *p, **lp;
+ int *lens, maxcols;
+ TBL *tbl;
+ wchar_t **cols;
+ wchar_t *last;
+
+ if ((t = tbl = calloc(entries, sizeof (TBL))) == NULL)
+ err(1, (char *)NULL);
+ if ((cols = calloc((maxcols = DEFCOLS), sizeof (*cols))) == NULL)
+ err(1, (char *)NULL);
+ if ((lens = calloc(maxcols, sizeof (int))) == NULL)
+ err(1, (char *)NULL);
+ for (cnt = 0, lp = list; cnt < entries; ++cnt, ++lp, ++t) {
+ for (coloff = 0, p = *lp;
+ (cols[coloff] = wcstok(p, separator, &last));
+ p = NULL)
+ if (++coloff == maxcols) {
+ if (!(cols = realloc(cols, ((uint_t)maxcols +
+ DEFCOLS) * sizeof (char *))) ||
+ !(lens = realloc(lens,
+ ((uint_t)maxcols + DEFCOLS) *
+ sizeof (int))))
+ err(1, NULL);
+ (void) memset((char *)lens + maxcols *
+ sizeof (int), 0, DEFCOLS * sizeof (int));
+ maxcols += DEFCOLS;
+ }
+ if ((t->list = calloc(coloff, sizeof (*t->list))) == NULL)
+ err(1, (char *)NULL);
+ if ((t->len = calloc(coloff, sizeof (int))) == NULL)
+ err(1, (char *)NULL);
+ for (t->cols = coloff; --coloff >= 0; ) {
+ t->list[coloff] = cols[coloff];
+ t->len[coloff] = width(cols[coloff]);
+ if (t->len[coloff] > lens[coloff])
+ lens[coloff] = t->len[coloff];
+ }
+ }
+ for (cnt = 0, t = tbl; cnt < entries; ++cnt, ++t) {
+ for (coloff = 0; coloff < t->cols - 1; ++coloff)
+ (void) wprintf(L"%ls%*ls", t->list[coloff],
+ lens[coloff] - t->len[coloff] + 2, L" ");
+ (void) wprintf(L"%ls\n", t->list[coloff]);
+ }
+}
+
+#define DEFNUM 1000
+#define MAXLINELEN (LINE_MAX + 1)
+
+static void
+input(FILE *fp)
+{
+ static int maxentry;
+ int len;
+ wchar_t *p, buf[MAXLINELEN];
+
+ if (!list)
+ if ((list = calloc((maxentry = DEFNUM), sizeof (*list))) ==
+ NULL)
+ err(1, (char *)NULL);
+ while (fgetws(buf, MAXLINELEN, fp)) {
+ for (p = buf; *p && iswspace(*p); ++p)
+ ;
+ if (!*p)
+ continue;
+ if (!(p = wcschr(p, L'\n'))) {
+ warnx("line too long");
+ eval = 1;
+ continue;
+ }
+ *p = L'\0';
+ len = width(buf);
+ if (maxlength < len)
+ maxlength = len;
+ if (entries == maxentry) {
+ maxentry += DEFNUM;
+ if (!(list = realloc(list,
+ (uint_t)maxentry * sizeof (*list))))
+ err(1, NULL);
+ }
+ list[entries] = malloc((wcslen(buf) + 1) * sizeof (wchar_t));
+ if (list[entries] == NULL)
+ err(1, NULL);
+ (void) wcscpy(list[entries], buf);
+ entries++;
+ }
+}
+
+/* Like wcswidth(), but ignores non-printing characters. */
+static int
+width(const wchar_t *wcs)
+{
+ int w, cw;
+
+ for (w = 0; *wcs != L'\0'; wcs++)
+ if ((cw = wcwidth(*wcs)) > 0)
+ w += cw;
+ return (w);
+}
+
+static void
+usage(void)
+{
+
+ (void) fprintf(stderr,
+ "usage: column [-tx] [-c columns] [-s sep] [file ...]\n");
+ exit(1);
+}
diff --git a/usr/src/cmd/coreadm/coreadm.xml b/usr/src/cmd/coreadm/coreadm.xml
index 46a4cda17a..28f1e27240 100644
--- a/usr/src/cmd/coreadm/coreadm.xml
+++ b/usr/src/cmd/coreadm/coreadm.xml
@@ -48,14 +48,6 @@
<service_fmri value='svc:/system/filesystem/minimal' />
</dependency>
- <dependency
- name='coreadm_manifest-import'
- type='service'
- grouping='require_all'
- restart_on='none'>
- <service_fmri value='svc:/system/manifest-import:default' />
- </dependency>
-
<instance name='default' enabled='false'>
<exec_method
type='method'
diff --git a/usr/src/cmd/cron/cron.c b/usr/src/cmd/cron/cron.c
index 54d3c9d971..8c5c54fb64 100644
--- a/usr/src/cmd/cron/cron.c
+++ b/usr/src/cmd/cron/cron.c
@@ -23,6 +23,7 @@
* Use is subject to license terms.
*
* Copyright 2013 Joshua M. Clulow <josh@sysmgr.org>
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -313,7 +314,8 @@ static int ex(struct event *e);
static void read_dirs(int);
static void mail(char *, char *, int);
static char *next_field(int, int);
-static void readcron(struct usr *, time_t);
+static void readcron(char *, struct usr *, time_t);
+static void readcronfile(FILE *, struct usr *, time_t);
static int next_ge(int, char *);
static void free_if_unused(struct usr *);
static void del_atjob(char *, char *);
@@ -418,7 +420,7 @@ extern void el_delete(void);
static int valid_entry(char *, int);
static struct usr *create_ulist(char *, int);
-static void init_cronevent(char *, int);
+static void init_cronevent(char *, char *, int);
static void init_atevent(char *, time_t, int, int);
static void update_atevent(struct usr *, char *, time_t, int);
@@ -757,6 +759,18 @@ read_dirs(int first)
time_t tim;
+ if (chdir(SYSCRONDIR) != -1) {
+ cwd = CRON;
+ if ((dir = opendir(".")) != NULL) {
+ while ((dp = readdir(dir)) != NULL) {
+ if (!valid_entry(dp->d_name, CRONEVENT))
+ continue;
+ init_cronevent(SYSCRONDIR, dp->d_name, first);
+ }
+ (void) closedir(dir);
+ }
+ }
+
if (chdir(CRONDIR) == -1)
crabort(BADCD, REMOVE_FIFO|CONSOLE_MSG);
cwd = CRON;
@@ -765,7 +779,7 @@ read_dirs(int first)
while ((dp = readdir(dir)) != NULL) {
if (!valid_entry(dp->d_name, CRONEVENT))
continue;
- init_cronevent(dp->d_name, first);
+ init_cronevent(CRONDIR, dp->d_name, !first);
}
(void) closedir(dir);
@@ -851,22 +865,22 @@ create_ulist(char *name, int type)
}
void
-init_cronevent(char *name, int first)
+init_cronevent(char *basedir, char *name, int first)
{
struct usr *u;
if (first) {
u = create_ulist(name, CRONEVENT);
- readcron(u, 0);
+ readcron(basedir, u, 0);
} else {
if ((u = find_usr(name)) == NULL) {
u = create_ulist(name, CRONEVENT);
- readcron(u, 0);
+ readcron(basedir, u, 0);
} else {
u->ctexists = TRUE;
rm_ctevents(u);
el_remove(u->ctid, 0);
- readcron(u, 0);
+ readcron(basedir, u, 0);
}
}
}
@@ -948,7 +962,7 @@ mod_ctab(char *name, time_t reftime)
(void) strcpy(u->home, pw->pw_dir);
u->uid = pw->pw_uid;
u->gid = pw->pw_gid;
- readcron(u, reftime);
+ readcron(CRONDIR, u, reftime);
} else {
u->uid = pw->pw_uid;
u->gid = pw->pw_gid;
@@ -971,7 +985,7 @@ mod_ctab(char *name, time_t reftime)
/* user didnt have a crontab last time */
u->ctid = ecid++;
u->ctevents = NULL;
- readcron(u, reftime);
+ readcron(CRONDIR, u, reftime);
return;
}
#ifdef DEBUG
@@ -979,7 +993,7 @@ mod_ctab(char *name, time_t reftime)
#endif
rm_ctevents(u);
el_remove(u->ctid, 0);
- readcron(u, reftime);
+ readcron(CRONDIR, u, reftime);
}
}
@@ -1114,8 +1128,94 @@ update_atevent(struct usr *u, char *name, time_t tim, int jobtype)
static char line[CTLINESIZE]; /* holds a line from a crontab file */
static int cursor; /* cursor for the above line */
+static int
+copyfile(char *name, FILE *dp)
+{
+ FILE *tf;
+
+ if ((tf = fopen(name, "r")) == NULL) {
+ (void) fclose(dp);
+ return (1);
+ }
+
+ while (fgets(line, CTLINESIZE, tf) != NULL) {
+ if (fputs(line, dp) == EOF) {
+ (void) fclose(tf);
+ (void) fclose(dp);
+ return (1);
+ }
+ }
+ (void) fclose(tf);
+
+ return (0);
+}
+
static void
-readcron(struct usr *u, time_t reftime)
+readcron(char *basedir, struct usr *u, time_t reftime)
+{
+ char *altpath;
+ struct stat sb;
+ FILE *cf; /* cf will be a user's crontab file */
+ char altnamebuf[PATH_MAX];
+ char namebuf[PATH_MAX];
+
+ if (strcmp(basedir, SYSCRONDIR) == 0)
+ altpath = CRONDIR;
+ else
+ altpath = SYSCRONDIR;
+
+ if (snprintf(altnamebuf, sizeof (altnamebuf), "%s/%s", altpath,
+ u->name) >= sizeof (altnamebuf))
+ return;
+
+ if (snprintf(namebuf, sizeof (namebuf), "%s/%s", basedir, u->name) >=
+ sizeof (namebuf))
+ return;
+
+ if (stat(altnamebuf, &sb) != -1) {
+ /*
+ * There is a secondary crontab for this user. We need to
+ * merge the two crontabs into a temporary file for loading.
+ */
+ int fd;
+ char tmpfile[PATH_MAX];
+
+ (void) strlcpy(tmpfile, "/tmp/cronXXXXXX", sizeof (tmpfile));
+ if ((fd = mkstemp(tmpfile)) == -1)
+ return;
+
+ unlink(tmpfile);
+ if ((cf = fdopen(fd, "w+")) == NULL) {
+ close(fd);
+ return;
+ }
+
+ if (copyfile(namebuf, cf) != 0)
+ return;
+
+ if (copyfile(altnamebuf, cf) != 0)
+ return;
+
+ (void) fflush(cf);
+ rewind(cf);
+
+ } else {
+ /*
+ * Only one crontab, open it directly.
+ */
+ if ((cf = fopen(namebuf, "r")) == NULL) {
+ mail(u->name, NOREAD, ERR_UNIXERR);
+ return;
+ }
+ }
+
+ readcronfile(cf, u, reftime);
+
+ (void) fclose(cf);
+}
+
+static void
+readcronfile(FILE *cf, struct usr *u, time_t reftime)
{
/*
* readcron reads in a crontab file for a user (u). The list of
@@ -1123,12 +1223,9 @@ readcron(struct usr *u, time_t reftime)
* this list. Each event is also entered into the main event
* list.
*/
- FILE *cf; /* cf will be a user's crontab file */
struct event *e;
int start;
unsigned int i;
- char namebuf[PATH_MAX];
- char *pname;
struct shared *tz = NULL;
struct shared *home = NULL;
struct shared *shell = NULL;
@@ -1136,19 +1233,6 @@ readcron(struct usr *u, time_t reftime)
/* read the crontab file */
cte_init(); /* Init error handling */
- if (cwd != CRON) {
- if (snprintf(namebuf, sizeof (namebuf), "%s/%s",
- CRONDIR, u->name) >= sizeof (namebuf)) {
- return;
- }
- pname = namebuf;
- } else {
- pname = u->name;
- }
- if ((cf = fopen(pname, "r")) == NULL) {
- mail(u->name, NOREAD, ERR_UNIXERR);
- return;
- }
while (fgets(line, CTLINESIZE, cf) != NULL) {
char *tmp;
/* process a line of a crontab file */
@@ -1277,7 +1361,6 @@ again:
#endif
}
cte_sendmail(u->name); /* mail errors if any to user */
- (void) fclose(cf);
rel_shared(tz);
rel_shared(shell);
rel_shared(home);
@@ -2440,6 +2523,9 @@ ex(struct event *e)
} else {
r = audit_cron_session(e->u->name, CRONDIR,
e->u->uid, e->u->gid, NULL);
+ if (r != 0)
+ r = audit_cron_session(e->u->name, SYSCRONDIR,
+ e->u->uid, e->u->gid, NULL);
}
if (r != 0) {
msg("cron audit problem. job failed (%s) for user %s",
diff --git a/usr/src/cmd/cron/cron.h b/usr/src/cmd/cron/cron.h
index a76016299c..93e21e7b41 100644
--- a/usr/src/cmd/cron/cron.h
+++ b/usr/src/cmd/cron/cron.h
@@ -71,6 +71,9 @@ struct message {
char logname[LLEN];
};
+/* anything below here can be changed */
+
+#define SYSCRONDIR "/etc/cron.d/crontabs"
#define CRONDIR "/var/spool/cron/crontabs"
#define ATDIR "/var/spool/cron/atjobs"
#define ACCTFILE "/var/cron/log"
diff --git a/usr/src/cmd/cron/crontab.c b/usr/src/cmd/cron/crontab.c
index 327a71388b..ff39d93824 100644
--- a/usr/src/cmd/cron/crontab.c
+++ b/usr/src/cmd/cron/crontab.c
@@ -236,8 +236,24 @@ main(int argc, char **argv)
exit(0);
}
if (lflag) {
- if ((fp = fopen(cf, "r")) == NULL)
- crabort(BADOPEN);
+ int sys_done = 0;
+ char sysconf[PATH_MAX];
+
+ if (snprintf(sysconf, sizeof (sysconf), "%s/%s",
+ SYSCRONDIR, login) < sizeof (sysconf) &&
+ (fp = fopen(sysconf, "r")) != NULL) {
+ while (fgets(line, CTLINESIZE, fp) != NULL)
+ fputs(line, stdout);
+ fclose(fp);
+ sys_done = 1;
+ }
+
+ if ((fp = fopen(cf, "r")) == NULL) {
+ if (!sys_done)
+ crabort(BADOPEN);
+ else
+ exit(0);
+ }
while (fgets(line, CTLINESIZE, fp) != NULL)
fputs(line, stdout);
fclose(fp);
diff --git a/usr/src/cmd/date/date.c b/usr/src/cmd/date/date.c
index 2d74cf8e4d..617de3b8a5 100644
--- a/usr/src/cmd/date/date.c
+++ b/usr/src/cmd/date/date.c
@@ -26,7 +26,9 @@
/*
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
-
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -75,6 +77,7 @@ static int Rflag = 0;
static int get_adj(char *, struct timeval *);
static int setdate(struct tm *, char *);
+static char *fmt_extensions(const char *, const struct timespec *);
int
main(int argc, char **argv)
@@ -82,7 +85,9 @@ main(int argc, char **argv)
struct tm *tp, tm;
struct timeval tv;
char *fmt;
+ char *fmtbuf;
int c, aflag = 0, illflag = 0;
+ struct timespec ts;
(void) setlocale(LC_ALL, "");
@@ -126,7 +131,11 @@ main(int argc, char **argv)
exit(1);
}
- (void) time(&clock_val);
+ if (clock_gettime(CLOCK_REALTIME, &ts) != 0) {
+ perror(gettext("data: Failed to obtain system time"));
+ exit(1);
+ }
+ clock_val = ts.tv_sec;
if (aflag) {
if (adjtime(&tv, 0) < 0) {
@@ -151,6 +160,8 @@ main(int argc, char **argv)
} else
fmt = nl_langinfo(_DATE_FMT);
+ fmtbuf = fmt_extensions(fmt, &ts);
+
if (uflag) {
(void) putenv("TZ=GMT0");
tzset();
@@ -158,7 +169,7 @@ main(int argc, char **argv)
} else
tp = localtime(&clock_val);
(void) memcpy(&tm, tp, sizeof (struct tm));
- (void) strftime(buf, BUFSIZ, fmt, &tm);
+ (void) strftime(buf, BUFSIZ, fmtbuf, &tm);
(void) puts(buf);
@@ -352,3 +363,64 @@ get_adj(char *cp, struct timeval *tp)
return (0);
}
}
+
+/*
+ * Extensions that cannot be interpreted by strftime are interpreted here.
+ */
+char *
+fmt_extensions(const char *fmt, const struct timespec *tsp)
+{
+ size_t len;
+ char *fmt_buf;
+ const char *p;
+ char *q;
+
+ if (strstr(fmt, "%N") == NULL)
+ return ((char *)fmt);
+
+ len = strlen(fmt) + 1;
+
+ for (p = fmt; *p != '\0';) {
+ if (*p == '%') {
+ switch (*(p + 1)) {
+ case 'N':
+ len += 7; /* 9 digits minus the %N */
+ break;
+ default:
+ break;
+ }
+
+ p += 2;
+ continue;
+ }
+ ++p;
+ }
+
+ fmt_buf = malloc(len);
+ if (fmt_buf == NULL) {
+ perror(gettext("date: failed to allocate memory"));
+ exit(1);
+ }
+
+ for (p = fmt, q = fmt_buf; *p != '\0';) {
+ if (*p == '%') {
+ switch (*(p + 1)) {
+ case 'N':
+ q += snprintf(q, len - (q - fmt_buf),
+ "%09lu", tsp->tv_nsec);
+ break;
+ default:
+ *q = *p;
+ *(q + 1) = *(p + 1);
+ q += 2;
+ break;
+ }
+ p += 2;
+ } else {
+ *q++ = *p++;
+ }
+ }
+ *q = '\0';
+
+ return (fmt_buf);
+}
diff --git a/usr/src/cmd/devfsadm/Makefile.com b/usr/src/cmd/devfsadm/Makefile.com
index 7fd05bd0f2..fe4363e13b 100644
--- a/usr/src/cmd/devfsadm/Makefile.com
+++ b/usr/src/cmd/devfsadm/Makefile.com
@@ -66,7 +66,6 @@ LINK_OBJS_CMN = \
fssnap_link.o \
sgen_link.o \
smp_link.o \
- md_link.o \
dtrace_link.o \
vscan_link.o \
zfs_link.o \
diff --git a/usr/src/cmd/devfsadm/devlink.tab.sh b/usr/src/cmd/devfsadm/devlink.tab.sh
index 6724fcb573..0267efeb9f 100644
--- a/usr/src/cmd/devfsadm/devlink.tab.sh
+++ b/usr/src/cmd/devfsadm/devlink.tab.sh
@@ -22,8 +22,7 @@
#
# Copyright (c) 1998, 2000 by Sun Microsystems, Inc.
# All rights reserved.
-#
-#ident "%Z%%M% %I% %E% SMI"
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
#
# This is the script that generates the devlink.tab file. It is
# architecture-aware, and dumps different stuff for x86 and sparc.
@@ -34,8 +33,6 @@
#
cat <<EOM
-#ident "%Z%%M% %I% %E% SMI"
-#
# Copyright (c) 1998 by Sun Microsystems, Inc.
#
#
diff --git a/usr/src/cmd/devfsadm/misc_link.c b/usr/src/cmd/devfsadm/misc_link.c
index 9465e2c886..b7aef8b00d 100644
--- a/usr/src/cmd/devfsadm/misc_link.c
+++ b/usr/src/cmd/devfsadm/misc_link.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <regex.h>
@@ -107,6 +108,9 @@ static devfsadm_create_t misc_cbt[] = {
"(^nca$)|(^rds$)|(^sdp$)|(^ipnet$)|(^dlpistub$)|(^bpf$)",
TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name
},
+ { "pseudo", "ddi_pseudo", "ipd",
+ TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name
+ },
{ "pseudo", "ddi_pseudo",
"(^ipf$)|(^ipnat$)|(^ipstate$)|(^ipauth$)|"
"(^ipsync$)|(^ipscan$)|(^iplookup$)",
diff --git a/usr/src/cmd/dfs.cmds/sharemgr/Makefile.com b/usr/src/cmd/dfs.cmds/sharemgr/Makefile.com
index fe67e74b4f..49272439c6 100644
--- a/usr/src/cmd/dfs.cmds/sharemgr/Makefile.com
+++ b/usr/src/cmd/dfs.cmds/sharemgr/Makefile.com
@@ -35,7 +35,8 @@ PROG= sharemgr
OBJS = sharemgr_main.o commands.o shareutil.o
SRCS = $(OBJS:%.o=../%.c)
-MYCPPFLAGS = -I../../../../lib/libfsmgt/common -I/usr/include/libxml2 \
+MYCPPFLAGS = -I../../../../lib/libfsmgt/common \
+ -I$(ADJUNCT_PROTO)/usr/include/libxml2 \
-I../..
CPPFLAGS += $(MYCPPFLAGS)
LDLIBS += -lshare -lscf -lsecdb -lumem
diff --git a/usr/src/cmd/dladm/dladm.c b/usr/src/cmd/dladm/dladm.c
index 8efdb32d0e..6352e33fa5 100644
--- a/usr/src/cmd/dladm/dladm.c
+++ b/usr/src/cmd/dladm/dladm.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
@@ -154,6 +155,7 @@ typedef struct show_vnic_state {
dladm_status_t vs_status;
uint32_t vs_flags;
ofmt_handle_t vs_ofmt;
+ char *vs_zonename;
} show_vnic_state_t;
typedef struct show_part_state {
@@ -265,7 +267,7 @@ typedef struct cmd {
static cmd_t cmds[] = {
{ "rename-link", do_rename_link,
- " rename-link <oldlink> <newlink>" },
+ " rename-link [-z zonename] <oldlink> <newlink>" },
{ "show-link", do_show_link,
" show-link [-pP] [-o <field>,..] [-s [-i <interval>]] "
"[<link>]\n" },
@@ -300,12 +302,13 @@ static cmd_t cmds[] = {
{ "show-wifi", do_show_wifi,
" show-wifi [-p] [-o <field>,...] [<link>]\n" },
{ "set-linkprop", do_set_linkprop,
- " set-linkprop [-t] -p <prop>=<value>[,...] <name>" },
+ " set-linkprop [-t] [-z zonename] -p <prop>=<value>[,...] "
+ "<name>" },
{ "reset-linkprop", do_reset_linkprop,
- " reset-linkprop [-t] [-p <prop>,...] <name>" },
+ " reset-linkprop [-t] [-z zonename] [-p <prop>,...] <name>"},
{ "show-linkprop", do_show_linkprop,
- " show-linkprop [-cP] [-o <field>,...] [-p <prop>,...] "
- "<name>\n" },
+ " show-linkprop [-cP] [-o <field>,...] [-z zonename] "
+ "[-p <prop>,...] <name>\n" },
{ "show-ether", do_show_ether,
" show-ether [-px][-o <field>,...] <link>\n" },
{ "create-secobj", do_create_secobj,
@@ -346,10 +349,10 @@ static cmd_t cmds[] = {
"\t\t {vrrp -V <vrid> -A {inet | inet6}} [-v <vid> [-f]]\n"
"\t\t [-p <prop>=<value>[,...]] <vnic-link>" },
{ "delete-vnic", do_delete_vnic,
- " delete-vnic [-t] <vnic-link>" },
+ " delete-vnic [-t] [-z zonename] <vnic-link>" },
{ "show-vnic", do_show_vnic,
- " show-vnic [-pP] [-l <link>] [-s [-i <interval>]] "
- "[<link>]\n" },
+ " show-vnic [-pP] [-l <link>] [-z zonename] "
+ "[-s [-i <interval>]] [<link>]\n" },
{ "up-vnic", do_up_vnic, NULL },
{ "create-part", do_create_part,
" create-part [-t] [-f] -l <link> [-P <pkey>]\n"
@@ -958,6 +961,7 @@ typedef struct show_linkprop_state {
char ls_link[MAXLINKNAMELEN];
char *ls_line;
char **ls_propvals;
+ char *ls_zonename;
dladm_arg_list_t *ls_proplist;
boolean_t ls_parsable;
boolean_t ls_persist;
@@ -1010,21 +1014,24 @@ typedef struct vnic_fields_buf_s
char vnic_macaddr[18];
char vnic_macaddrtype[19];
char vnic_vid[6];
+ char vnic_zone[ZONENAME_MAX];
} vnic_fields_buf_t;
static const ofmt_field_t vnic_fields[] = {
{ "LINK", 13,
offsetof(vnic_fields_buf_t, vnic_link), print_default_cb},
-{ "OVER", 13,
+{ "OVER", 11,
offsetof(vnic_fields_buf_t, vnic_over), print_default_cb},
-{ "SPEED", 7,
+{ "SPEED", 6,
offsetof(vnic_fields_buf_t, vnic_speed), print_default_cb},
{ "MACADDRESS", 18,
offsetof(vnic_fields_buf_t, vnic_macaddr), print_default_cb},
-{ "MACADDRTYPE", 20,
+{ "MACADDRTYPE", 12,
offsetof(vnic_fields_buf_t, vnic_macaddrtype), print_default_cb},
-{ "VID", 7,
+{ "VID", 5,
offsetof(vnic_fields_buf_t, vnic_vid), print_default_cb},
+{ "ZONE", 20,
+ offsetof(vnic_fields_buf_t, vnic_zone), print_default_cb},
{ NULL, 0, 0, NULL}}
;
@@ -2494,13 +2501,17 @@ do_rename_link(int argc, char *argv[], const char *use)
char *link1, *link2;
char *altroot = NULL;
dladm_status_t status;
+ char *zonename = NULL;
opterr = 0;
- while ((option = getopt_long(argc, argv, ":R:", lopts, NULL)) != -1) {
+ while ((option = getopt_long(argc, argv, ":R:z:", lopts, NULL)) != -1) {
switch (option) {
case 'R':
altroot = optarg;
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option, use);
break;
@@ -2516,7 +2527,7 @@ do_rename_link(int argc, char *argv[], const char *use)
link1 = argv[optind++];
link2 = argv[optind];
- if ((status = dladm_rename_link(handle, link1, link2)) !=
+ if ((status = dladm_rename_link(handle, zonename, link1, link2)) !=
DLADM_STATUS_OK)
die_dlerr(status, "rename operation failed");
}
@@ -3406,11 +3417,12 @@ do_show_link(int argc, char *argv[], const char *use)
ofmt_handle_t ofmt;
ofmt_status_t oferr;
uint_t ofmtflags = 0;
+ char *zonename = NULL;
bzero(&state, sizeof (state));
opterr = 0;
- while ((option = getopt_long(argc, argv, ":pPsSi:o:",
+ while ((option = getopt_long(argc, argv, ":pPsSi:o:z:",
show_lopts, NULL)) != -1) {
switch (option) {
case 'p':
@@ -3449,6 +3461,9 @@ do_show_link(int argc, char *argv[], const char *use)
if (!dladm_str2interval(optarg, &interval))
die("invalid interval value '%s'", optarg);
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option, use);
break;
@@ -3474,8 +3489,8 @@ do_show_link(int argc, char *argv[], const char *use)
if (strlcpy(linkname, argv[optind], MAXLINKNAMELEN) >=
MAXLINKNAMELEN)
die("link name too long");
- if ((status = dladm_name2info(handle, linkname, &linkid, &f,
- NULL, NULL)) != DLADM_STATUS_OK) {
+ if ((status = dladm_zname2info(handle, zonename, linkname,
+ &linkid, &f, NULL, NULL)) != DLADM_STATUS_OK) {
die_dlerr(status, "link %s is not valid", linkname);
}
@@ -4740,6 +4755,12 @@ do_create_vnic(int argc, char *argv[], const char *use)
if ((flags & DLADM_OPT_FORCE) != 0 && vid == 0)
die("-f option can only be used with -v");
+ /*
+ * If creating a transient VNIC for a zone, mark it in the kernel.
+ */
+ if (strstr(propstr, "zone=") != NULL && !(flags & DLADM_OPT_PERSIST))
+ flags |= DLADM_OPT_TRANSIENT;
+
if (mac_prefix_len != 0 && mac_addr_type != VNIC_MAC_ADDR_TYPE_RANDOM &&
mac_addr_type != VNIC_MAC_ADDR_TYPE_FIXED)
usage();
@@ -4831,9 +4852,10 @@ do_delete_vnic_common(int argc, char *argv[], const char *use,
datalink_id_t linkid;
char *altroot = NULL;
dladm_status_t status;
+ char *zonename = NULL;
opterr = 0;
- while ((option = getopt_long(argc, argv, ":R:t", lopts,
+ while ((option = getopt_long(argc, argv, ":R:tz:", lopts,
NULL)) != -1) {
switch (option) {
case 't':
@@ -4842,6 +4864,9 @@ do_delete_vnic_common(int argc, char *argv[], const char *use,
case 'R':
altroot = optarg;
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option, use);
}
@@ -4854,8 +4879,8 @@ do_delete_vnic_common(int argc, char *argv[], const char *use,
if (altroot != NULL)
altroot_cmd(altroot, argc, argv);
- status = dladm_name2info(handle, argv[optind], &linkid, NULL, NULL,
- NULL);
+ status = dladm_zname2info(handle, zonename, argv[optind], &linkid, NULL,
+ NULL, NULL);
if (status != DLADM_STATUS_OK)
die("invalid link name '%s'", argv[optind]);
@@ -4987,6 +5012,9 @@ print_vnic(show_vnic_state_t *state, datalink_id_t linkid)
char vnic_name[MAXLINKNAMELEN];
char mstr[MAXMACADDRLEN * 3];
vnic_fields_buf_t vbuf;
+ uint_t valcnt = 1;
+ char zonename[DLADM_PROP_VAL_MAX + 1];
+ char *valptr[1];
if ((status = dladm_vnic_info(handle, linkid, vnic, state->vs_flags)) !=
DLADM_STATUS_OK)
@@ -5016,6 +5044,18 @@ print_vnic(show_vnic_state_t *state, datalink_id_t linkid)
NULL, devname, sizeof (devname)) != DLADM_STATUS_OK)
(void) sprintf(devname, "?");
+
+ zonename[0] = '\0';
+ if (!is_etherstub) {
+ valptr[0] = zonename;
+ (void) dladm_get_linkprop(handle, linkid,
+ DLADM_PROP_VAL_CURRENT, "zone", (char **)valptr, &valcnt);
+ }
+
+ if (state->vs_zonename != NULL &&
+ strcmp(state->vs_zonename, zonename) != 0)
+ return (DLADM_STATUS_OK);
+
state->vs_found = B_TRUE;
if (state->vs_stats) {
/* print vnic statistics */
@@ -5091,6 +5131,13 @@ print_vnic(show_vnic_state_t *state, datalink_id_t linkid)
(void) snprintf(vbuf.vnic_vid, sizeof (vbuf.vnic_vid),
"%d", vnic->va_vid);
+
+ if (zonename[0] != '\0')
+ (void) snprintf(vbuf.vnic_zone,
+ sizeof (vbuf.vnic_zone), "%s", zonename);
+ else
+ (void) strlcpy(vbuf.vnic_zone, "--",
+ sizeof (vbuf.vnic_zone));
}
ofmt_print(state->vs_ofmt, &vbuf);
@@ -5129,10 +5176,11 @@ do_show_vnic_common(int argc, char *argv[], const char *use,
ofmt_handle_t ofmt;
ofmt_status_t oferr;
uint_t ofmtflags = 0;
+ char *zonename = NULL;
bzero(&state, sizeof (state));
opterr = 0;
- while ((option = getopt_long(argc, argv, ":pPl:si:o:", lopts,
+ while ((option = getopt_long(argc, argv, ":pPl:si:o:z:", lopts,
NULL)) != -1) {
switch (option) {
case 'p':
@@ -5171,6 +5219,9 @@ do_show_vnic_common(int argc, char *argv[], const char *use,
o_arg = B_TRUE;
fields_str = optarg;
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option, use);
}
@@ -5181,8 +5232,8 @@ do_show_vnic_common(int argc, char *argv[], const char *use,
/* get vnic ID (optional last argument) */
if (optind == (argc - 1)) {
- status = dladm_name2info(handle, argv[optind], &linkid, NULL,
- NULL, NULL);
+ status = dladm_zname2info(handle, zonename, argv[optind],
+ &linkid, NULL, NULL, NULL);
if (status != DLADM_STATUS_OK) {
die_dlerr(status, "invalid vnic name '%s'",
argv[optind]);
@@ -5193,8 +5244,8 @@ do_show_vnic_common(int argc, char *argv[], const char *use,
}
if (l_arg) {
- status = dladm_name2info(handle, state.vs_link, &dev_linkid,
- NULL, NULL, NULL);
+ status = dladm_zname2info(handle, zonename, state.vs_link,
+ &dev_linkid, NULL, NULL, NULL);
if (status != DLADM_STATUS_OK) {
die_dlerr(status, "invalid link name '%s'",
state.vs_link);
@@ -5206,6 +5257,7 @@ do_show_vnic_common(int argc, char *argv[], const char *use,
state.vs_etherstub = etherstub;
state.vs_found = B_FALSE;
state.vs_flags = flags;
+ state.vs_zonename = zonename;
if (!o_arg || (o_arg && strcasecmp(fields_str, "all") == 0)) {
if (etherstub)
@@ -6694,6 +6746,7 @@ do_show_linkprop(int argc, char **argv, const char *use)
ofmt_handle_t ofmt;
ofmt_status_t oferr;
uint_t ofmtflags = 0;
+ char *zonename = NULL;
bzero(propstr, DLADM_STRSIZE);
opterr = 0;
@@ -6704,7 +6757,7 @@ do_show_linkprop(int argc, char **argv, const char *use)
state.ls_header = B_TRUE;
state.ls_retstatus = DLADM_STATUS_OK;
- while ((option = getopt_long(argc, argv, ":p:cPo:",
+ while ((option = getopt_long(argc, argv, ":p:cPo:z:",
prop_longopts, NULL)) != -1) {
switch (option) {
case 'p':
@@ -6723,6 +6776,9 @@ do_show_linkprop(int argc, char **argv, const char *use)
case 'o':
fields_str = optarg;
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option, use);
break;
@@ -6730,8 +6786,8 @@ do_show_linkprop(int argc, char **argv, const char *use)
}
if (optind == (argc - 1)) {
- if ((status = dladm_name2info(handle, argv[optind], &linkid,
- NULL, NULL, NULL)) != DLADM_STATUS_OK) {
+ if ((status = dladm_zname2info(handle, zonename, argv[optind],
+ &linkid, NULL, NULL, NULL)) != DLADM_STATUS_OK) {
die_dlerr(status, "link %s is not valid", argv[optind]);
}
} else if (optind != argc) {
@@ -6742,6 +6798,7 @@ do_show_linkprop(int argc, char **argv, const char *use)
!= DLADM_STATUS_OK)
die("invalid link properties specified");
state.ls_proplist = proplist;
+ state.ls_zonename = zonename;
state.ls_status = DLADM_STATUS_OK;
if (state.ls_parsable)
@@ -6786,6 +6843,17 @@ show_linkprop_onelink(dladm_handle_t hdl, datalink_id_t linkid, void *arg)
return (DLADM_WALK_CONTINUE);
}
+ if (statep->ls_zonename != NULL) {
+ datalink_id_t tlinkid;
+
+ if (dladm_zname2info(hdl, statep->ls_zonename, statep->ls_link,
+ &tlinkid, NULL, NULL, NULL) != DLADM_STATUS_OK ||
+ linkid != tlinkid) {
+ statep->ls_status = DLADM_STATUS_NOTFOUND;
+ return (DLADM_WALK_CONTINUE);
+ }
+ }
+
if ((statep->ls_persist && !(flags & DLADM_OPT_PERSIST)) ||
(!statep->ls_persist && !(flags & DLADM_OPT_ACTIVE))) {
statep->ls_status = DLADM_STATUS_BADARG;
@@ -6868,11 +6936,12 @@ set_linkprop(int argc, char **argv, boolean_t reset, const char *use)
dladm_status_t status = DLADM_STATUS_OK;
char propstr[DLADM_STRSIZE];
dladm_arg_list_t *proplist = NULL;
+ char *zonename = NULL;
opterr = 0;
bzero(propstr, DLADM_STRSIZE);
- while ((option = getopt_long(argc, argv, ":p:R:t",
+ while ((option = getopt_long(argc, argv, ":p:R:tz:",
prop_longopts, NULL)) != -1) {
switch (option) {
case 'p':
@@ -6887,6 +6956,9 @@ set_linkprop(int argc, char **argv, boolean_t reset, const char *use)
case 'R':
altroot = optarg;
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option, use);
@@ -6909,8 +6981,8 @@ set_linkprop(int argc, char **argv, boolean_t reset, const char *use)
altroot_cmd(altroot, argc, argv);
}
- status = dladm_name2info(handle, argv[optind], &linkid, NULL, NULL,
- NULL);
+ status = dladm_zname2info(handle, zonename, argv[optind], &linkid,
+ NULL, NULL, NULL);
if (status != DLADM_STATUS_OK)
die_dlerr(status, "link %s is not valid", argv[optind]);
diff --git a/usr/src/cmd/dlmgmtd/dlmgmt_db.c b/usr/src/cmd/dlmgmtd/dlmgmt_db.c
index 99307dbc03..a2000ff3b5 100644
--- a/usr/src/cmd/dlmgmtd/dlmgmt_db.c
+++ b/usr/src/cmd/dlmgmtd/dlmgmt_db.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#include <assert.h>
@@ -43,6 +44,7 @@
#include <libcontract.h>
#include <libcontract_priv.h>
#include <sys/contract/process.h>
+#include <sys/vnic.h>
#include "dlmgmt_impl.h"
typedef enum dlmgmt_db_op {
@@ -552,6 +554,10 @@ dlmgmt_db_update(dlmgmt_db_op_t op, const char *entryname, dlmgmt_link_t *linkp,
linkp->ll_zoneid, flags, &err)) == NULL)
return (err);
+ /* If transient op and onloan, use the global zone cache file. */
+ if (flags == DLMGMT_ACTIVE && linkp->ll_onloan)
+ req->ls_zoneid = GLOBAL_ZONEID;
+
/*
* If the return error is EINPROGRESS, this request is handled
* asynchronously; return success.
@@ -1382,13 +1388,49 @@ dlmgmt_db_walk(zoneid_t zoneid, datalink_class_t class, db_walk_func_t *func)
}
/*
+ * Attempt to mitigate one of the deadlocks in the dlmgmtd architecture.
+ *
+ * dlmgmt_db_init() calls dlmgmt_process_db_req() which eventually gets to
+ * dlmgmt_zfop() which tries to fork, enter the zone and read the file.
+ * Because of the upcall architecture of dlmgmtd this can lead to deadlock
+ * with the following scenario:
+ * a) the thread preparing to fork will have acquired the malloc locks
+ * then attempt to suspend every thread in preparation to fork.
+ * b) all of the upcalls will be blocked in door_ucred() trying to malloc()
+ * and get the credentials of their caller.
+ * c) we can't suspend the in-kernel thread making the upcall.
+ *
+ * Thus, we cannot serve door requests because we're blocked in malloc()
+ * which fork() owns, but fork() is in turn blocked on the in-kernel thread
+ * making the door upcall. This is a fundamental architectural problem with
+ * any server handling upcalls and also trying to fork().
+ *
+ * To minimize the chance of this deadlock occuring, we check ahead of time to
+ * see if the file we want to read actually exists in the zone (which it almost
+ * never does), so we don't need fork in that case (i.e. rarely to never).
+ */
+static boolean_t
+zone_file_exists(char *zoneroot, char *filename)
+{
+ struct stat sb;
+ char fname[MAXPATHLEN];
+
+ (void) snprintf(fname, sizeof (fname), "%s/%s", zoneroot, filename);
+
+ if (stat(fname, &sb) == -1)
+ return (B_FALSE);
+
+ return (B_TRUE);
+}
+
+/*
* Initialize the datalink <link name, linkid> mapping and the link's
* attributes list based on the configuration file /etc/dladm/datalink.conf
* and the active configuration cache file
* /etc/svc/volatile/dladm/datalink-management:default.cache.
*/
int
-dlmgmt_db_init(zoneid_t zoneid)
+dlmgmt_db_init(zoneid_t zoneid, char *zoneroot)
{
dlmgmt_db_req_t *req;
int err;
@@ -1398,22 +1440,28 @@ dlmgmt_db_init(zoneid_t zoneid)
DATALINK_INVALID_LINKID, zoneid, DLMGMT_ACTIVE, &err)) == NULL)
return (err);
- if ((err = dlmgmt_process_db_req(req)) != 0) {
- /*
- * If we get back ENOENT, that means that the active
- * configuration file doesn't exist yet, and is not an error.
- * We'll create it down below after we've loaded the
- * persistent configuration.
- */
- if (err != ENOENT)
- goto done;
+ if (zone_file_exists(zoneroot, cachefile)) {
+ if ((err = dlmgmt_process_db_req(req)) != 0) {
+ /*
+ * If we get back ENOENT, that means that the active
+ * configuration file doesn't exist yet, and is not an
+ * error. We'll create it down below after we've
+ * loaded the persistent configuration.
+ */
+ if (err != ENOENT)
+ goto done;
+ boot = B_TRUE;
+ }
+ } else {
boot = B_TRUE;
}
- req->ls_flags = DLMGMT_PERSIST;
- err = dlmgmt_process_db_req(req);
- if (err != 0 && err != ENOENT)
- goto done;
+ if (zone_file_exists(zoneroot, DLMGMT_PERSISTENT_DB_PATH)) {
+ req->ls_flags = DLMGMT_PERSIST;
+ err = dlmgmt_process_db_req(req);
+ if (err != 0 && err != ENOENT)
+ goto done;
+ }
err = 0;
if (rewrite_needed) {
/*
@@ -1451,8 +1499,29 @@ dlmgmt_db_fini(zoneid_t zoneid)
while (linkp != NULL) {
next_linkp = AVL_NEXT(&dlmgmt_name_avl, linkp);
if (linkp->ll_zoneid == zoneid) {
+ vnic_ioc_delete_t ioc;
+ boolean_t onloan;
+
+ ioc.vd_vnic_id = linkp->ll_linkid;
+ onloan = linkp->ll_onloan;
+
+ /*
+ * Cleanup any VNICs that were loaned to the zone
+ * before the zone goes away and we can no longer
+ * refer to the VNIC by the name/zoneid.
+ */
+ if (onloan)
+ (void) dlmgmt_delete_db_entry(linkp,
+ DLMGMT_ACTIVE);
+
(void) dlmgmt_destroy_common(linkp,
DLMGMT_ACTIVE | DLMGMT_PERSIST);
+
+ if (onloan && ioctl(dladm_dld_fd(dld_handle),
+ VNIC_IOC_DELETE, &ioc) < 0)
+ dlmgmt_log(LOG_WARNING, "dlmgmt_db_fini "
+ "delete VNIC ioctl failed %d %d",
+ ioc.vd_vnic_id, errno);
}
linkp = next_linkp;
}
diff --git a/usr/src/cmd/dlmgmtd/dlmgmt_door.c b/usr/src/cmd/dlmgmtd/dlmgmt_door.c
index 11e4329669..ef5fa0e745 100644
--- a/usr/src/cmd/dlmgmtd/dlmgmt_door.c
+++ b/usr/src/cmd/dlmgmtd/dlmgmt_door.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
/*
@@ -58,6 +59,10 @@
#include <libsysevent.h>
#include <libdlmgmt.h>
#include <librcm.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
#include "dlmgmt_impl.h"
typedef void dlmgmt_door_handler_t(void *, void *, size_t *, zoneid_t,
@@ -439,6 +444,10 @@ dlmgmt_getlinkid(void *argp, void *retp, size_t *sz, zoneid_t zoneid,
dlmgmt_link_t *linkp;
int err = 0;
+ /* Enable the global zone to lookup links it has given away. */
+ if (zoneid == GLOBAL_ZONEID && getlinkid->ld_zoneid != -1)
+ zoneid = getlinkid->ld_zoneid;
+
/*
* Hold the reader lock to access the link
*/
@@ -1245,7 +1254,19 @@ dlmgmt_setzoneid(void *argp, void *retp, size_t *sz, zoneid_t zoneid,
"zone %d: %s", linkid, oldzoneid, strerror(err));
goto done;
}
- avl_remove(&dlmgmt_loan_avl, linkp);
+
+ if (newzoneid == GLOBAL_ZONEID && linkp->ll_onloan) {
+ /*
+ * We can only reassign a loaned VNIC back to the
+ * global zone when the zone is shutting down, since
+ * otherwise the VNIC is in use by the zone and will be
+ * busy. Leave the VNIC assigned to the zone so we can
+ * still see it and delete it when dlmgmt_zonehalt()
+ * runs.
+ */
+ goto done;
+ }
+
linkp->ll_onloan = B_FALSE;
}
if (newzoneid != GLOBAL_ZONEID) {
@@ -1256,7 +1277,6 @@ dlmgmt_setzoneid(void *argp, void *retp, size_t *sz, zoneid_t zoneid,
(void) zone_add_datalink(oldzoneid, linkid);
goto done;
}
- avl_add(&dlmgmt_loan_avl, linkp);
linkp->ll_onloan = B_TRUE;
}
@@ -1309,6 +1329,10 @@ dlmgmt_zonehalt(void *argp, void *retp, size_t *sz, zoneid_t zoneid,
int err = 0;
dlmgmt_door_zonehalt_t *zonehalt = argp;
dlmgmt_zonehalt_retval_t *retvalp = retp;
+ static char my_pid[10];
+
+ if (my_pid[0] == NULL)
+ (void) snprintf(my_pid, sizeof (my_pid), "%d\n", getpid());
if ((err = dlmgmt_checkprivs(0, cred)) == 0) {
if (zoneid != GLOBAL_ZONEID) {
@@ -1316,9 +1340,31 @@ dlmgmt_zonehalt(void *argp, void *retp, size_t *sz, zoneid_t zoneid,
} else if (zonehalt->ld_zoneid == GLOBAL_ZONEID) {
err = EINVAL;
} else {
+ /*
+ * dlmgmt_db_fini makes ioctls which lead to the
+ * following kernel stack:
+ * vnic_ioc_delete
+ * vnic_dev_delete
+ * dls_devnet_destroy
+ * dls_devnet_destroy calls mac_perim_enter_by_mh
+ * which could lead to deadlock if another process is
+ * holding the mac perimeter then made an upcall to
+ * dlmgmtd. To try to avoid this, we serialize zone
+ * activity on the /etc/dladm/zone.lck file.
+ */
+ int fd;
+
+ while ((fd = open(ZONE_LOCK, O_WRONLY |
+ O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) < 0)
+ (void) sleep(1);
+ (void) write(fd, my_pid, sizeof(my_pid));
+ (void) close(fd);
+
dlmgmt_table_lock(B_TRUE);
dlmgmt_db_fini(zonehalt->ld_zoneid);
dlmgmt_table_unlock();
+
+ (void) unlink(ZONE_LOCK);
}
}
retvalp->lr_err = err;
diff --git a/usr/src/cmd/dlmgmtd/dlmgmt_impl.h b/usr/src/cmd/dlmgmtd/dlmgmt_impl.h
index cdfd0d8a4d..107870fbe2 100644
--- a/usr/src/cmd/dlmgmtd/dlmgmt_impl.h
+++ b/usr/src/cmd/dlmgmtd/dlmgmt_impl.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
/*
@@ -84,6 +85,8 @@ typedef struct dlmgmt_dlconf_s {
avl_node_t ld_node;
} dlmgmt_dlconf_t;
+#define ZONE_LOCK "/etc/dladm/zone.lck"
+
extern boolean_t debug;
extern const char *progname;
extern char cachefile[];
@@ -138,7 +141,7 @@ void dlmgmt_handler(void *, char *, size_t, door_desc_t *, uint_t);
void dlmgmt_log(int, const char *, ...);
int dlmgmt_write_db_entry(const char *, dlmgmt_link_t *, uint32_t);
int dlmgmt_delete_db_entry(dlmgmt_link_t *, uint32_t);
-int dlmgmt_db_init(zoneid_t);
+int dlmgmt_db_init(zoneid_t, char *);
void dlmgmt_db_fini(zoneid_t);
#ifdef __cplusplus
diff --git a/usr/src/cmd/dlmgmtd/dlmgmt_main.c b/usr/src/cmd/dlmgmtd/dlmgmt_main.c
index c02610bb5f..e0c179cf5e 100644
--- a/usr/src/cmd/dlmgmtd/dlmgmt_main.c
+++ b/usr/src/cmd/dlmgmtd/dlmgmt_main.c
@@ -22,6 +22,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/*
@@ -125,7 +126,7 @@ dlmgmt_door_fini(void)
dlmgmt_door_fd = -1;
}
-int
+static int
dlmgmt_door_attach(zoneid_t zoneid, char *rootdir)
{
int fd;
@@ -203,7 +204,7 @@ dlmgmt_zone_init(zoneid_t zoneid)
return (EPERM);
}
- if ((err = dlmgmt_db_init(zoneid)) != 0)
+ if ((err = dlmgmt_db_init(zoneid, rootdir)) != 0)
return (err);
return (dlmgmt_door_attach(zoneid, rootdir));
}
@@ -214,7 +215,7 @@ dlmgmt_zone_init(zoneid_t zoneid)
static int
dlmgmt_allzones_init(void)
{
- int err, i;
+ int i;
zoneid_t *zids = NULL;
uint_t nzids, nzids_saved;
@@ -235,11 +236,37 @@ again:
}
for (i = 0; i < nzids; i++) {
- if ((err = dlmgmt_zone_init(zids[i])) != 0)
- break;
+ int res;
+ zone_status_t status;
+
+ /*
+ * Skip over zones that have gone away or are going down
+ * since we got the list. Process all zones in the list,
+ * logging errors for any that failed.
+ */
+ if (zone_getattr(zids[i], ZONE_ATTR_STATUS, &status,
+ sizeof (status)) < 0)
+ continue;
+ switch (status) {
+ case ZONE_IS_SHUTTING_DOWN:
+ case ZONE_IS_EMPTY:
+ case ZONE_IS_DOWN:
+ case ZONE_IS_DYING:
+ case ZONE_IS_DEAD:
+ /* FALLTHRU */
+ continue;
+ default:
+ break;
+ }
+ if ((res = dlmgmt_zone_init(zids[i])) != 0) {
+ (void) fprintf(stderr, "zone (%ld) init error %s",
+ zids[i], strerror(res));
+ dlmgmt_log(LOG_ERR, "zone (%d) init error %s",
+ zids[i], strerror(res));
+ }
}
free(zids);
- return (err);
+ return (0);
}
static int
@@ -262,6 +289,8 @@ dlmgmt_init(void)
return (err);
}
+ (void) unlink(ZONE_LOCK);
+
/*
* First derive the name of the cache file from the FMRI name. This
* cache name is used to keep active datalink configuration.
diff --git a/usr/src/cmd/dlmgmtd/dlmgmt_util.c b/usr/src/cmd/dlmgmtd/dlmgmt_util.c
index 004c8f257b..a2d9800b7b 100644
--- a/usr/src/cmd/dlmgmtd/dlmgmt_util.c
+++ b/usr/src/cmd/dlmgmtd/dlmgmt_util.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
/*
@@ -45,13 +46,10 @@
/*
* There are three datalink AVL tables. The dlmgmt_name_avl tree contains all
* datalinks and is keyed by zoneid and link name. The dlmgmt_id_avl also
- * contains all datalinks, and it is keyed by link ID. The dlmgmt_loan_avl is
- * keyed by link name, and contains the set of global-zone links that are
- * currently on loan to non-global zones.
+ * contains all datalinks, and it is keyed by link ID.
*/
avl_tree_t dlmgmt_name_avl;
avl_tree_t dlmgmt_id_avl;
-avl_tree_t dlmgmt_loan_avl;
avl_tree_t dlmgmt_dlconf_avl;
@@ -162,8 +160,6 @@ dlmgmt_linktable_init(void)
offsetof(dlmgmt_link_t, ll_name_node));
avl_create(&dlmgmt_id_avl, cmp_link_by_id, sizeof (dlmgmt_link_t),
offsetof(dlmgmt_link_t, ll_id_node));
- avl_create(&dlmgmt_loan_avl, cmp_link_by_name, sizeof (dlmgmt_link_t),
- offsetof(dlmgmt_link_t, ll_loan_node));
avl_create(&dlmgmt_dlconf_avl, cmp_dlconf_by_id,
sizeof (dlmgmt_dlconf_t), offsetof(dlmgmt_dlconf_t, ld_node));
dlmgmt_nextlinkid = 1;
@@ -181,7 +177,6 @@ dlmgmt_linktable_fini(void)
avl_destroy(&dlmgmt_dlconf_avl);
avl_destroy(&dlmgmt_name_avl);
- avl_destroy(&dlmgmt_loan_avl);
avl_destroy(&dlmgmt_id_avl);
}
@@ -385,7 +380,6 @@ link_activate(dlmgmt_link_t *linkp)
linkp->ll_zoneid = zoneid;
avl_add(&dlmgmt_name_avl, linkp);
- avl_add(&dlmgmt_loan_avl, linkp);
linkp->ll_onloan = B_TRUE;
}
} else if (linkp->ll_zoneid != GLOBAL_ZONEID) {
@@ -429,10 +423,6 @@ link_by_name(const char *name, zoneid_t zoneid)
(void) strlcpy(link.ll_link, name, MAXLINKNAMELEN);
link.ll_zoneid = zoneid;
linkp = avl_find(&dlmgmt_name_avl, &link, NULL);
- if (linkp == NULL && zoneid == GLOBAL_ZONEID) {
- /* The link could be on loan to a non-global zone? */
- linkp = avl_find(&dlmgmt_loan_avl, &link, NULL);
- }
return (linkp);
}
@@ -510,8 +500,6 @@ dlmgmt_destroy_common(dlmgmt_link_t *linkp, uint32_t flags)
if ((flags & DLMGMT_ACTIVE) && linkp->ll_zoneid != GLOBAL_ZONEID) {
(void) zone_remove_datalink(linkp->ll_zoneid, linkp->ll_linkid);
- if (linkp->ll_onloan)
- avl_remove(&dlmgmt_loan_avl, linkp);
}
if (linkp->ll_flags == 0) {
diff --git a/usr/src/cmd/dlmgmtd/svc-dlmgmtd b/usr/src/cmd/dlmgmtd/svc-dlmgmtd
index 7559207535..a75e71f9b3 100644
--- a/usr/src/cmd/dlmgmtd/svc-dlmgmtd
+++ b/usr/src/cmd/dlmgmtd/svc-dlmgmtd
@@ -23,17 +23,16 @@
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2012 Joyent, Inc. All rights reserved.
#
-# ident "%Z%%M% %I% %E% SMI"
. /lib/svc/share/smf_include.sh
-# The real daemon is not started in a non-global zone. But we need to
-# create a dummy background process to preserve contract lifetime.
+# The real daemon is not started in a non-global zone. Exit to leave
+# an empty contract.
if smf_is_nonglobalzone; then
- (while true ; do sleep 3600 ; done) &
- exit $SMF_EXIT_OK
+ exit $SMF_EXIT_NODAEMON
fi
# Start the dlmgmtd daemon.
diff --git a/usr/src/cmd/dlstat/dlstat.c b/usr/src/cmd/dlstat/dlstat.c
index a931ba82ff..2615fdbb12 100644
--- a/usr/src/cmd/dlstat/dlstat.c
+++ b/usr/src/cmd/dlstat/dlstat.c
@@ -62,7 +62,7 @@ typedef struct link_chain_s {
struct link_chain_s *lc_next;
} link_chain_t;
-typedef void * (*stats2str_t)(const char *, void *,
+typedef void * (*stats2str_t)(const char *, const char *, void *,
char, boolean_t);
typedef struct show_state {
@@ -141,6 +141,7 @@ typedef struct total_fields_buf_s {
char t_rbytes[MAXSTATLEN];
char t_opackets[MAXSTATLEN];
char t_obytes[MAXSTATLEN];
+ char t_zone[ZONENAME_MAX];
} total_fields_buf_t;
static ofmt_field_t total_s_fields[] = {
@@ -154,6 +155,8 @@ static ofmt_field_t total_s_fields[] = {
offsetof(total_fields_buf_t, t_opackets), print_default_cb},
{ "OBYTES", 8,
offsetof(total_fields_buf_t, t_obytes), print_default_cb},
+{ "ZONE", 20,
+ offsetof(total_fields_buf_t, t_zone), print_default_cb},
{ NULL, 0, 0, NULL}};
/*
@@ -957,8 +960,8 @@ cleanup_removed_links(show_state_t *state)
}
void *
-print_total_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_total_stats(const char *linkname, const char *zonename, void *statentry,
+ char unit, boolean_t parsable)
{
total_stat_entry_t *sentry = statentry;
total_stat_t *link_stats = &sentry->tse_stats;
@@ -970,6 +973,7 @@ print_total_stats(const char *linkname, void *statentry, char unit,
(void) snprintf(buf->t_linkname, sizeof (buf->t_linkname), "%s",
linkname);
+ (void) snprintf(buf->t_zone, sizeof (buf->t_zone), "%s", zonename);
map_to_units(buf->t_ipackets, sizeof (buf->t_ipackets),
link_stats->ts_ipackets, unit, parsable);
@@ -988,8 +992,8 @@ done:
}
void *
-print_rx_generic_ring_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_rx_generic_ring_stats(const char *linkname, const char *zonename,
+ void *statentry, char unit, boolean_t parsable)
{
ring_stat_entry_t *sentry = statentry;
ring_stat_t *link_stats = &sentry->re_stats;
@@ -1022,8 +1026,8 @@ done:
}
void *
-print_tx_generic_ring_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_tx_generic_ring_stats(const char *linkname, const char *zonename,
+ void *statentry, char unit, boolean_t parsable)
{
ring_stat_entry_t *sentry = statentry;
ring_stat_t *link_stats = &sentry->re_stats;
@@ -1056,8 +1060,8 @@ done:
}
void *
-print_rx_ring_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_rx_ring_stats(const char *linkname, const char *zonename, void *statentry,
+ char unit, boolean_t parsable)
{
ring_stat_entry_t *sentry = statentry;
ring_stat_t *link_stats = &sentry->re_stats;
@@ -1090,8 +1094,8 @@ done:
}
void *
-print_tx_ring_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_tx_ring_stats(const char *linkname, const char *zonename, void *statentry,
+ char unit, boolean_t parsable)
{
ring_stat_entry_t *sentry = statentry;
ring_stat_t *link_stats = &sentry->re_stats;
@@ -1124,8 +1128,8 @@ done:
}
void *
-print_rx_generic_lane_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_rx_generic_lane_stats(const char *linkname, const char *zonename,
+ void *statentry, char unit, boolean_t parsable)
{
rx_lane_stat_entry_t *sentry = statentry;
rx_lane_stat_t *link_stats = &sentry->rle_stats;
@@ -1172,8 +1176,8 @@ done:
}
void *
-print_tx_generic_lane_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_tx_generic_lane_stats(const char *linkname, const char *zonename,
+ void *statentry, char unit, boolean_t parsable)
{
tx_lane_stat_entry_t *sentry = statentry;
tx_lane_stat_t *link_stats = &sentry->tle_stats;
@@ -1217,8 +1221,8 @@ done:
}
void *
-print_rx_lane_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_rx_lane_stats(const char *linkname, const char *zonename, void *statentry,
+ char unit, boolean_t parsable)
{
rx_lane_stat_entry_t *sentry = statentry;
rx_lane_stat_t *link_stats = &sentry->rle_stats;
@@ -1283,9 +1287,8 @@ done:
}
void *
-print_tx_lane_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
-{
+print_tx_lane_stats(const char *linkname, const char *zonename, void *statentry,
+ char unit, boolean_t parsable) {
tx_lane_stat_entry_t *sentry = statentry;
tx_lane_stat_t *link_stats = &sentry->tle_stats;
tx_lane_fields_buf_t *buf = NULL;
@@ -1338,8 +1341,8 @@ done:
}
void *
-print_fanout_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_fanout_stats(const char *linkname, const char *zonename, void *statentry,
+ char unit, boolean_t parsable)
{
fanout_stat_entry_t *sentry = statentry;
fanout_stat_t *link_stats = &sentry->fe_stats;
@@ -1392,8 +1395,8 @@ done:
}
void *
-print_aggr_port_stats(const char *linkname, void *statentry, char unit,
- boolean_t parsable)
+print_aggr_port_stats(const char *linkname, const char *zonename,
+ void *statentry, char unit, boolean_t parsable)
{
aggr_port_stat_entry_t *sentry = statentry;
aggr_port_stat_t *link_stats = &sentry->ape_stats;
@@ -1470,7 +1473,8 @@ done:
void
walk_dlstat_stats(show_state_t *state, const char *linkname,
- dladm_stat_type_t stattype, dladm_stat_chain_t *diff_stat)
+ const char *zonename, dladm_stat_type_t stattype,
+ dladm_stat_chain_t *diff_stat)
{
dladm_stat_chain_t *curr;
@@ -1480,7 +1484,8 @@ walk_dlstat_stats(show_state_t *state, const char *linkname,
/* Format the raw numbers for printing */
fields_buf = state->ls_stats2str[stattype](linkname,
- curr->dc_statentry, state->ls_unit, state->ls_parsable);
+ zonename, curr->dc_statentry, state->ls_unit,
+ state->ls_parsable);
/* Print the stats */
if (fields_buf != NULL)
ofmt_print(state->ls_ofmt, fields_buf);
@@ -1495,12 +1500,20 @@ show_queried_stats(dladm_handle_t dh, datalink_id_t linkid, void *arg)
int i;
dladm_stat_chain_t *diff_stat;
char linkname[DLPI_LINKNAME_MAX];
+ char zonename[DLADM_PROP_VAL_MAX + 1];
+ char *valptr[1];
+ uint_t valcnt = 1;
if (dladm_datalink_id2info(dh, linkid, NULL, NULL, NULL, linkname,
DLPI_LINKNAME_MAX) != DLADM_STATUS_OK) {
goto done;
}
+ valptr[0] = zonename;
+ if (dladm_get_linkprop(handle, linkid, DLADM_PROP_VAL_CURRENT, "zone",
+ (char **)valptr, &valcnt) != 0)
+ zonename[0] = '\0';
+
for (i = 0; i < DLADM_STAT_NUM_STATS; i++) {
if (state->ls_stattype[i]) {
/*
@@ -1508,7 +1521,8 @@ show_queried_stats(dladm_handle_t dh, datalink_id_t linkid, void *arg)
* Stats are returned as chain of raw numbers
*/
diff_stat = query_link_stats(handle, linkid, arg, i);
- walk_dlstat_stats(state, linkname, i, diff_stat);
+ walk_dlstat_stats(state, linkname, zonename, i,
+ diff_stat);
dladm_link_stat_free(diff_stat);
}
}
@@ -1628,7 +1642,7 @@ do_show(int argc, char *argv[], const char *use)
char *o_fields_str = NULL;
char *total_stat_fields =
- "link,ipkts,rbytes,opkts,obytes";
+ "link,ipkts,rbytes,opkts,obytes,zone";
char *rx_total_stat_fields =
"link,ipkts,rbytes,intrs,polls,ch<10,ch10-50,ch>50";
char *tx_total_stat_fields =
diff --git a/usr/src/cmd/dtrace/test/cmd/scripts/dtest.pl b/usr/src/cmd/dtrace/test/cmd/scripts/dtest.pl
index d6f1c8c277..0cda80bd0b 100644
--- a/usr/src/cmd/dtrace/test/cmd/scripts/dtest.pl
+++ b/usr/src/cmd/dtrace/test/cmd/scripts/dtest.pl
@@ -566,7 +566,7 @@ $defdir = -d $dt_tst ? $dt_tst : '.';
$bindir = -d $dt_bin ? $dt_bin : '.';
if (!$opt_F) {
- my @dependencies = ("gcc", "make", "java", "perl");
+ my @dependencies = ("gcc", "cc", "make", "java", "perl");
for my $dep (@dependencies) {
if (!inpath($dep)) {
diff --git a/usr/src/cmd/dtrace/test/tst/common/Makefile b/usr/src/cmd/dtrace/test/tst/common/Makefile
index 9853f3be16..fc984d67bf 100644
--- a/usr/src/cmd/dtrace/test/tst/common/Makefile
+++ b/usr/src/cmd/dtrace/test/tst/common/Makefile
@@ -26,6 +26,7 @@
#
# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
include $(SRC)/Makefile.master
@@ -71,6 +72,18 @@ pid/tst.gcc.exe: pid/tst.gcc.c
$(GCC) -o pid/tst.gcc.exe pid/tst.gcc.c $(LDFLAGS)
$(POST_PROCESS) ; $(STRIP_STABS)
+json/tst.usdt.o: json/usdt.h
+
+json/usdt.h: json/usdt.d
+ $(DTRACE) -h -s json/usdt.d -o json/usdt.h
+
+json/usdt.o: json/usdt.d json/tst.usdt.o
+ $(COMPILE.d) -o json/usdt.o -s json/usdt.d json/tst.usdt.o
+
+json/tst.usdt.exe: json/tst.usdt.o json/usdt.o
+ $(LINK.c) -o json/tst.usdt.exe json/tst.usdt.o json/usdt.o $(LDLIBS)
+ $(POST_PROCESS) ; $(STRIP_STABS)
+
usdt/tst.args.exe: usdt/tst.args.o usdt/args.o
$(LINK.c) -o usdt/tst.args.exe usdt/tst.args.o usdt/args.o $(LDLIBS)
$(POST_PROCESS) ; $(STRIP_STABS)
@@ -99,6 +112,14 @@ usdt/tst.forker.o: usdt/forker.h
usdt/forker.h: usdt/forker.d
$(DTRACE) -h -s usdt/forker.d -o usdt/forker.h
+ustack/tst.unpriv.exe: ustack/tst.unpriv.o ustack/unpriv_helper.o
+ $(LINK.c) -o ustack/tst.unpriv.exe \
+ ustack/tst.unpriv.o ustack/unpriv_helper.o $(LDLIBS)
+ $(POST_PROCESS) ; $(STRIP_STABS)
+
+ustack/unpriv_helper.o: ustack/unpriv_helper.d
+ $(COMPILE.d) -o ustack/unpriv_helper.o -s ustack/unpriv_helper.d
+
usdt/tst.lazyprobe.exe: usdt/tst.lazyprobe.o usdt/lazyprobe.o
$(LINK.c) -o usdt/tst.lazyprobe.exe \
usdt/tst.lazyprobe.o usdt/lazyprobe.o $(LDLIBS)
diff --git a/usr/src/cmd/dtrace/test/tst/common/aggs/tst.subr.d b/usr/src/cmd/dtrace/test/tst/common/aggs/tst.subr.d
index bb0739f0d3..ccafc2edd1 100644
--- a/usr/src/cmd/dtrace/test/tst/common/aggs/tst.subr.d
+++ b/usr/src/cmd/dtrace/test/tst/common/aggs/tst.subr.d
@@ -22,6 +22,7 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/dtrace.h>
@@ -98,6 +99,9 @@ STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t))))
STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t))))
STRFUNC(toupper("foo"))
STRFUNC(tolower("BAR"))
+INTFUNC(getf(0))
+INTFUNC(strtoll("0x12EE5D5", 16))
+STRFUNC(json("{\"systemtap\": false}", "systemtap"))
BEGIN
/subr == DIF_SUBR_MAX + 1/
diff --git a/usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.nonarrow.ksh b/usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.nonarrow.ksh
new file mode 100644
index 0000000000..3a2942e9f1
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.nonarrow.ksh
@@ -0,0 +1,48 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+
+#
+# Somewhat surprisingly, DTrace very much relies on the fact that when 32-bit
+# is forced, pointers are not, in fact, narrowed to 32-bits. In particular, if
+# this is not so (that is, if pointers are narrowed to their seemingly correct
+# 32-bit width), helpers attached to 32-bit programs will fail to operate:
+# they will erroneously zero the high 32-bits of the return values of 64-bit
+# kernel pointers as returned by copyin(), alloca(), etc. This test asserts
+# this implicit behavior -- and this comment regrettably serves as this
+# behavior's only documentation.
+#
+doit()
+{
+ /usr/sbin/dtrace $1 -n BEGIN'{trace(sizeof (long))}' \
+ -n 'BEGIN{*(int *)alloca(4) = 21506; exit(0)}' \
+ -n 'ERROR{exit(1)}'
+
+ if [ "$?" -ne 0 ]; then
+ exit $?
+ fi
+}
+
+doit
+doit -32
diff --git a/usr/src/cmd/dtrace/test/tst/common/json/tst.general.d b/usr/src/cmd/dtrace/test/tst/common/json/tst.general.d
new file mode 100644
index 0000000000..4600811d95
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/json/tst.general.d
@@ -0,0 +1,179 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * General functional tests of JSON parser for json().
+ */
+
+#pragma D option quiet
+#pragma D option strsize=1k
+
+#define TST(name) \
+ printf("\ntst |%s|\n", name)
+#define IN2(vala, valb) \
+ in = strjoin(vala, valb); \
+ printf("in |%s|\n", in)
+#define IN(val) \
+ in = val; \
+ printf("in |%s|\n", in)
+#define SEL(ss) \
+ out = json(in, ss); \
+ printf("sel |%s|\nout |%s|\n", ss, \
+ out != NULL ? out : "<NULL>")
+
+BEGIN
+{
+ TST("empty array");
+ IN("[]");
+ SEL("0");
+
+ TST("one-element array: integer");
+ IN("[1]");
+ SEL("0");
+ SEL("1");
+ SEL("100");
+ SEL("-1");
+
+ TST("one-element array: hex integer (not in spec, not supported)");
+ IN("[0x1000]");
+ SEL("0");
+
+ TST("one-element array: float");
+ IN("[1.5001]");
+ SEL("0");
+
+ TST("one-element array: float + exponent");
+ IN("[16.3e10]");
+ SEL("0");
+
+ TST("one-element array: integer + whitespace");
+ IN("[ \t 5\t]");
+ SEL("0");
+
+ TST("one-element array: integer + exponent + whitespace");
+ IN("[ \t \t 16E10 \t ]");
+ SEL("0");
+
+ TST("one-element array: string");
+ IN("[\"alpha\"]");
+ SEL("0");
+
+ TST("alternative first-element indexing");
+ IN("[1,5,10,15,20]");
+ SEL("[0]");
+ SEL("[3]");
+ SEL("[4]");
+ SEL("[5]");
+
+ TST("one-element array: object");
+ IN("[ { \"first\": true, \"second\": false }]");
+ SEL("0.first");
+ SEL("0.second");
+ SEL("0.third");
+
+ TST("many-element array: integers");
+ IN("[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]");
+ SEL("10"); /* F(10) = 55 */
+ SEL("14"); /* F(14) = 377 */
+ SEL("19");
+
+ TST("many-element array: multiple types");
+ IN2("[\"string\",32,true,{\"a\":9,\"b\":false},100.3e10,false,200.5,",
+ "{\"key\":\"val\"},null]");
+ SEL("0");
+ SEL("0.notobject");
+ SEL("1");
+ SEL("2");
+ SEL("3");
+ SEL("3.a");
+ SEL("3.b");
+ SEL("3.c");
+ SEL("4");
+ SEL("5");
+ SEL("6");
+ SEL("7");
+ SEL("7.key");
+ SEL("7.key.notobject");
+ SEL("7.nonexist");
+ SEL("8");
+ SEL("9");
+
+ TST("many-element array: multiple types + whitespace");
+ IN2("\n[\t\"string\" ,\t32 , true\t,\t {\"a\": 9,\t\"b\": false},\t\t",
+ "100.3e10, false, 200.5,{\"key\" \t:\n \"val\"},\t\t null ]\t\t");
+ SEL("0");
+ SEL("0.notobject");
+ SEL("1");
+ SEL("2");
+ SEL("3");
+ SEL("3.a");
+ SEL("3.b");
+ SEL("3.c");
+ SEL("4");
+ SEL("5");
+ SEL("6");
+ SEL("7");
+ SEL("7.key");
+ SEL("7.key.notobject");
+ SEL("7.nonexist");
+ SEL("8");
+ SEL("9");
+
+ TST("two-element array: various string escape codes");
+ IN2("[\"abcd \\\" \\\\ \\/ \\b \\f \\n \\r \\t \\u0000 \\uf00F \", ",
+ "\"final\"]");
+ SEL("0");
+ SEL("1");
+
+ TST("three-element array: broken escape code");
+ IN("[\"fine here\", \"dodgey \\u00AZ\", \"wont get here\"]");
+ SEL("0");
+ SEL("1");
+ SEL("2");
+
+ TST("nested objects");
+ IN2("{ \"top\": { \"mid\" : { \"legs\": \"feet\" }, \"number\": 9, ",
+ "\"array\":[0,1,{\"a\":true,\"bb\":[1,2,false,{\"x\":\"yz\"}]}]}}");
+ SEL("top");
+ SEL("fargo");
+ SEL("top.mid");
+ SEL("top.centre");
+ SEL("top.mid.legs");
+ SEL("top.mid.number");
+ SEL("top.mid.array");
+ SEL("top.number");
+ SEL("top.array");
+ SEL("top.array[0]");
+ SEL("top.array[1]");
+ SEL("top.array[2]");
+ SEL("top.array[2].a");
+ SEL("top.array[2].b");
+ SEL("top.array[2].bb");
+ SEL("top.array[2].bb[0]");
+ SEL("top.array[2].bb[1]");
+ SEL("top.array[2].bb[2]");
+ SEL("top.array[2].bb[3]");
+ SEL("top.array[2].bb[3].x");
+ SEL("top.array[2].bb[3].x.nofurther");
+ SEL("top.array[2].bb[4]");
+ SEL("top.array[3]");
+
+ exit(0);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/usr/src/cmd/dtrace/test/tst/common/json/tst.general.d.out b/usr/src/cmd/dtrace/test/tst/common/json/tst.general.d.out
new file mode 100644
index 0000000000..a857ab91d8
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/json/tst.general.d.out
@@ -0,0 +1,218 @@
+
+tst |empty array|
+in |[]|
+sel |0|
+out |<NULL>|
+
+tst |one-element array: integer|
+in |[1]|
+sel |0|
+out |1|
+sel |1|
+out |<NULL>|
+sel |100|
+out |<NULL>|
+sel |-1|
+out |<NULL>|
+
+tst |one-element array: hex integer (not in spec, not supported)|
+in |[0x1000]|
+sel |0|
+out |<NULL>|
+
+tst |one-element array: float|
+in |[1.5001]|
+sel |0|
+out |1.5001|
+
+tst |one-element array: float + exponent|
+in |[16.3e10]|
+sel |0|
+out |16.3e10|
+
+tst |one-element array: integer + whitespace|
+in |[ 5 ]|
+sel |0|
+out |5|
+
+tst |one-element array: integer + exponent + whitespace|
+in |[ 16E10 ]|
+sel |0|
+out |16E10|
+
+tst |one-element array: string|
+in |["alpha"]|
+sel |0|
+out |alpha|
+
+tst |alternative first-element indexing|
+in |[1,5,10,15,20]|
+sel |[0]|
+out |1|
+sel |[3]|
+out |15|
+sel |[4]|
+out |20|
+sel |[5]|
+out |<NULL>|
+
+tst |one-element array: object|
+in |[ { "first": true, "second": false }]|
+sel |0.first|
+out |true|
+sel |0.second|
+out |false|
+sel |0.third|
+out |<NULL>|
+
+tst |many-element array: integers|
+in |[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]|
+sel |10|
+out |55|
+sel |14|
+out |377|
+sel |19|
+out |<NULL>|
+
+tst |many-element array: multiple types|
+in |["string",32,true,{"a":9,"b":false},100.3e10,false,200.5,{"key":"val"},null]|
+sel |0|
+out |string|
+sel |0.notobject|
+out |<NULL>|
+sel |1|
+out |32|
+sel |2|
+out |true|
+sel |3|
+out |{"a":9,"b":false}|
+sel |3.a|
+out |9|
+sel |3.b|
+out |false|
+sel |3.c|
+out |<NULL>|
+sel |4|
+out |100.3e10|
+sel |5|
+out |false|
+sel |6|
+out |200.5|
+sel |7|
+out |{"key":"val"}|
+sel |7.key|
+out |val|
+sel |7.key.notobject|
+out |<NULL>|
+sel |7.nonexist|
+out |<NULL>|
+sel |8|
+out |null|
+sel |9|
+out |<NULL>|
+
+tst |many-element array: multiple types + whitespace|
+in |
+[ "string" , 32 , true , {"a": 9, "b": false}, 100.3e10, false, 200.5,{"key" :
+ "val"}, null ] |
+sel |0|
+out |string|
+sel |0.notobject|
+out |<NULL>|
+sel |1|
+out |32|
+sel |2|
+out |true|
+sel |3|
+out |{"a": 9, "b": false}|
+sel |3.a|
+out |9|
+sel |3.b|
+out |false|
+sel |3.c|
+out |<NULL>|
+sel |4|
+out |100.3e10|
+sel |5|
+out |false|
+sel |6|
+out |200.5|
+sel |7|
+out |{"key" :
+ "val"}|
+sel |7.key|
+out |val|
+sel |7.key.notobject|
+out |<NULL>|
+sel |7.nonexist|
+out |<NULL>|
+sel |8|
+out |null|
+sel |9|
+out |<NULL>|
+
+tst |two-element array: various string escape codes|
+in |["abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F ", "final"]|
+sel |0|
+out |abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F |
+sel |1|
+out |final|
+
+tst |three-element array: broken escape code|
+in |["fine here", "dodgey \u00AZ", "wont get here"]|
+sel |0|
+out |fine here|
+sel |1|
+out |<NULL>|
+sel |2|
+out |<NULL>|
+
+tst |nested objects|
+in |{ "top": { "mid" : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}}|
+sel |top|
+out |{ "mid" : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}|
+sel |fargo|
+out |<NULL>|
+sel |top.mid|
+out |{ "legs": "feet" }|
+sel |top.centre|
+out |<NULL>|
+sel |top.mid.legs|
+out |feet|
+sel |top.mid.number|
+out |<NULL>|
+sel |top.mid.array|
+out |<NULL>|
+sel |top.number|
+out |9|
+sel |top.array|
+out |[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]|
+sel |top.array[0]|
+out |0|
+sel |top.array[1]|
+out |1|
+sel |top.array[2]|
+out |{"a":true,"bb":[1,2,false,{"x":"yz"}]}|
+sel |top.array[2].a|
+out |true|
+sel |top.array[2].b|
+out |<NULL>|
+sel |top.array[2].bb|
+out |[1,2,false,{"x":"yz"}]|
+sel |top.array[2].bb[0]|
+out |1|
+sel |top.array[2].bb[1]|
+out |2|
+sel |top.array[2].bb[2]|
+out |false|
+sel |top.array[2].bb[3]|
+out |{"x":"yz"}|
+sel |top.array[2].bb[3].x|
+out |yz|
+sel |top.array[2].bb[3].x.nofurther|
+out |<NULL>|
+sel |top.array[2].bb[4]|
+out |<NULL>|
+sel |top.array[3]|
+out |<NULL>|
+
diff --git a/usr/src/cmd/dtrace/test/tst/common/json/tst.strsize.d b/usr/src/cmd/dtrace/test/tst/common/json/tst.strsize.d
new file mode 100644
index 0000000000..6aa50b9ad0
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/json/tst.strsize.d
@@ -0,0 +1,51 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * ASSERTION:
+ * json() run time must be bounded above by strsize. This test makes strsize
+ * small and deliberately overflows it to prove we bail and return NULL in
+ * the event that we run off the end of the string.
+ *
+ */
+
+#pragma D option quiet
+#pragma D option strsize=18
+
+BEGIN
+{
+ in = "{\"a\": 1024}"; /* length == 19 */
+ out = json(in, "a");
+ printf("|%s|\n%s\n\n", in, out != NULL ? out : "<NULL>");
+
+ in = "{\"a\": 1024}"; /* length == 11 */
+ out = json(in, "a");
+ printf("|%s|\n%s\n\n", in, out != NULL ? out : "<NULL>");
+
+ in = "{\"a\":false,\"b\":true}"; /* length == 20 */
+ out = json(in, "b");
+ printf("|%s|\n%s\n\n", in, out != NULL ? out : "<NULL>");
+
+ in = "{\"a\":false,\"b\":20}"; /* length == 18 */
+ out = json(in, "b");
+ printf("|%s|\n%s\n\n", in, out != NULL ? out : "<NULL>");
+
+ exit(0);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/usr/src/cmd/dtrace/test/tst/common/json/tst.strsize.d.out b/usr/src/cmd/dtrace/test/tst/common/json/tst.strsize.d.out
new file mode 100644
index 0000000000..7f1d79b6fe
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/json/tst.strsize.d.out
@@ -0,0 +1,13 @@
+|{"a": 1024|
+<NULL>
+
+|{"a": 1024}|
+1024
+
+|{"a":false,"b":tru|
+<NULL>
+
+|{"a":false,"b":20}|
+20
+
+
diff --git a/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.c b/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.c
new file mode 100644
index 0000000000..307106d903
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.c
@@ -0,0 +1,61 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012 (c), Joyent, Inc. All rights reserved.
+ */
+
+#include <sys/sdt.h>
+#include "usdt.h"
+
+#define FMT "{" \
+ " \"sizes\": [ \"first\", 2, %f ]," \
+ " \"index\": %d," \
+ " \"facts\": {" \
+ " \"odd\": \"%s\"," \
+ " \"even\": \"%s\"" \
+ " }," \
+ " \"action\": \"%s\"" \
+ "}\n"
+
+int
+waiting(volatile int *a)
+{
+ return (*a);
+}
+
+int
+main(int argc, char **argv)
+{
+ volatile int a = 0;
+ int idx;
+ double size = 250.5;
+
+ while (waiting(&a) == 0)
+ continue;
+
+ for (idx = 0; idx < 10; idx++) {
+ char *odd, *even, *json, *action;
+
+ size *= 1.78;
+ odd = idx % 2 == 1 ? "true" : "false";
+ even = idx % 2 == 0 ? "true" : "false";
+ action = idx == 7 ? "ignore" : "print";
+
+ asprintf(&json, FMT, size, idx, odd, even, action);
+ BUNYAN_FAKE_LOG_DEBUG(json);
+ free(json);
+ }
+
+ BUNYAN_FAKE_LOG_DEBUG("{\"finished\": true}");
+
+ return (0);
+}
diff --git a/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.d b/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.d
new file mode 100644
index 0000000000..f0fbdd5cab
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.d
@@ -0,0 +1,65 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option strsize=4k
+#pragma D option quiet
+#pragma D option destructive
+
+/*
+ * This test reads a JSON string from a USDT probe, roughly simulating the
+ * primary motivating use case for the json() subroutine: filtering
+ * JSON-formatted log messages from a logging subsystem like node-bunyan.
+ */
+
+pid$1:a.out:waiting:entry
+{
+ this->value = (int *)alloca(sizeof (int));
+ *this->value = 1;
+ copyout(this->value, arg0, sizeof (int));
+}
+
+bunyan*$1:::log-*
+{
+ this->j = copyinstr(arg0);
+}
+
+bunyan*$1:::log-*
+/json(this->j, "finished") == NULL && json(this->j, "action") != "ignore"/
+{
+ this->index = strtoll(json(this->j, "index"));
+ this->size = json(this->j, "sizes[2]");
+ this->odd = json(this->j, "facts.odd");
+ this->even = json(this->j, "facts.even");
+ printf("[%d] sz %s odd %s even %s\n", this->index, this->size,
+ this->odd, this->even);
+}
+
+bunyan*$1:::log-*
+/json(this->j, "finished") != NULL/
+{
+ printf("FINISHED!\n");
+ exit(0);
+}
+
+tick-10s
+{
+ printf("ERROR: Timed out before finish message!\n");
+ exit(1);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.d.out b/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.d.out
new file mode 100644
index 0000000000..c7f58bb535
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/json/tst.usdt.d.out
@@ -0,0 +1,11 @@
+[0] sz 445.890000 odd false even true
+[1] sz 793.684200 odd true even false
+[2] sz 1412.757876 odd false even true
+[3] sz 2514.709019 odd true even false
+[4] sz 4476.182054 odd false even true
+[5] sz 7967.604057 odd true even false
+[6] sz 14182.335221 odd false even true
+[8] sz 44935.310914 odd false even true
+[9] sz 79984.853427 odd true even false
+FINISHED!
+
diff --git a/usr/src/cmd/dtrace/test/tst/common/json/usdt.d b/usr/src/cmd/dtrace/test/tst/common/json/usdt.d
new file mode 100644
index 0000000000..1a4fc87f60
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/json/usdt.d
@@ -0,0 +1,27 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * Sets up a fake node-bunyan-like USDT provider for use from C.
+ */
+
+provider bunyan_fake {
+ probe log__trace(char *msg);
+ probe log__debug(char *msg);
+ probe log__info(char *msg);
+ probe log__warn(char *msg);
+ probe log__error(char *msg);
+ probe log__fatal(char *msg);
+};
diff --git a/usr/src/cmd/dtrace/test/tst/common/llquantize/tst.range.d b/usr/src/cmd/dtrace/test/tst/common/llquantize/tst.range.d
index e2882b3f8e..a9138d2f54 100644
--- a/usr/src/cmd/dtrace/test/tst/common/llquantize/tst.range.d
+++ b/usr/src/cmd/dtrace/test/tst/common/llquantize/tst.range.d
@@ -19,10 +19,6 @@
* CDDL HEADER END
*/
-/*
- * Copyright (c) 2011, Joyent, Inc. All rights reserved.
- */
-
#pragma D option quiet
BEGIN
diff --git a/usr/src/cmd/print/conv_fix/Makefile b/usr/src/cmd/dtrace/test/tst/common/mdb/tst.postmort.ksh
index cac80619e0..c5921b8d28 100644
--- a/usr/src/cmd/print/conv_fix/Makefile
+++ b/usr/src/cmd/dtrace/test/tst/common/mdb/tst.postmort.ksh
@@ -18,52 +18,52 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/client/conv_fix/Makefile
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
#
-include ../Makefile.sp
-
-PROG= conv_fix
-
-SRCS= $(PROG).c
-
-OBJS= $(SRCS:.c=.o)
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
-ROOTLIBPRINTPROG= $(PROG:%=$(ROOTLIBPRINT)/%)
+dtrace=$1
+DIR=/var/tmp/dtest.$$
-FILEMODE= 0555
+mkdir $DIR
+cd $DIR
-CPPFLAGS += -I$(NPRTINC)
+expected=`od -t u8 -N 8 /dev/urandom | head -1 | cut -d ' ' -f2`
-CERRWARN += -_gcc=-Wno-implicit-function-declaration
+$dtrace -x bufpolicy=ring -x bufsize=10k -qs /dev/stdin > /dev/null 2>&1 <<EOF &
+ tick-1ms
+ /i < 10000/
+ {
+ printf("%d: expected is $expected!\n", i++);
+ }
-.KEEP_STATE:
+ tick-1ms
+ /i >= 10000/
+ {
+ exit(0);
+ }
+EOF
-all: $(PROG)
+background=$!
-install: all $(ROOTLIBPRINTPROG)
-
-$(ROOTLIBPRINT)/%: %
- $(INS.file)
-
-strip:
- $(STRIP) $(PROG)
-
-lint:
- $(LINT.c) $(PROG).c $(LDLIBS)
+#
+# Give some time for the enabling to get there...
+#
+sleep 2
-cstyle:
- cstyle $(SRCS)
+echo "::walk dtrace_state | ::dtrace" | mdb -k | tee test.out
+grep "expected is $expected" test.out 2> /dev/null 1>&2
+status=$?
-_msg:
- @echo "Messages are made in usr/src/cmd/print"
+kill $background
-clean:
- $(RM) $(OBJS)
+cd /
+/usr/bin/rm -rf $DIR
-clobber: clean
- -$(RM) $(PROG) $(CLOBBERFILES)
+exit $status
diff --git a/usr/src/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh b/usr/src/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh
new file mode 100644
index 0000000000..22c267dcfc
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/misc/tst.dofmax.ksh
@@ -0,0 +1,97 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+
+let j=8
+
+enable()
+{
+ prog=/var/tmp/dtest.$$.d
+ err=/var/tmp/dtest.$$.err
+
+ nawk -v nprobes=$1 'BEGIN { \
+ for (i = 0; i < nprobes - 1; i++) { \
+ printf("dtrace:::BEGIN,\n"); \
+ } \
+ \
+ printf("dtrace:::BEGIN { exit(0); }\n"); \
+ }' /dev/null > $prog
+
+ dtrace -qs $prog > /dev/null 2> $err
+
+ if [[ "$?" -eq 0 ]]; then
+ return 0
+ else
+ if ! grep "DIF program exceeds maximum program size" $err \
+ 1> /dev/null 2>&1 ; then
+ echo "failed to enable $prog: `cat $err`"
+ exit 1
+ fi
+
+ return 1
+ fi
+}
+
+#
+# First, establish an upper bound
+#
+let upper=1
+
+while enable $upper ; do
+ let lower=upper
+ let upper=upper+upper
+ echo success at $lower, raised to $upper
+done
+
+#
+# Now search for the highest value that can be enabled
+#
+while [[ "$lower" -lt "$upper" ]]; do
+ let guess=$(((lower + upper) / 2))
+ echo "lower is $lower; upper is $upper; guess is $guess\c"
+
+ if enable $guess ; then
+ if [[ $((upper - lower)) -le 2 ]]; then
+ let upper=guess
+ fi
+
+ echo " (success)"
+ let lower=guess
+ else
+ echo " (failure)"
+ let upper=guess
+ fi
+done
+
+let expected=10000
+
+if [[ "$lower" -lt "$expected" ]]; then
+ echo "expected support for enablings of at least $expected probes; \c"
+ echo "found $lower"
+ exit 1
+fi
+
+echo "maximum supported enabled probes found to be $lower"
+exit 0
+
diff --git a/usr/src/cmd/dtrace/test/tst/common/privs/tst.fds.ksh b/usr/src/cmd/dtrace/test/tst/common/privs/tst.fds.ksh
new file mode 100644
index 0000000000..a5aa27137e
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/privs/tst.fds.ksh
@@ -0,0 +1,91 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+
+tmpin=/tmp/tst.fds.$$.d
+tmpout1=/tmp/tst.fds.$$.out1
+tmpout2=/tmp/tst.fds.$$.out2
+
+cat > $tmpin <<EOF
+#define DUMPFIELD(fd, fmt, field) \
+ errmsg = "could not dump field"; \
+ printf("%d: field =fmt\n", fd, fds[fd].field);
+
+/*
+ * Note that we are explicitly not looking at fi_mount -- it (by design) does
+ * not work if not running with kernel permissions.
+ */
+#define DUMP(fd) \
+ DUMPFIELD(fd, %s, fi_name); \
+ DUMPFIELD(fd, %s, fi_dirname); \
+ DUMPFIELD(fd, %s, fi_pathname); \
+ DUMPFIELD(fd, %d, fi_offset); \
+ DUMPFIELD(fd, %s, fi_fs); \
+ DUMPFIELD(fd, %o, fi_oflags);
+
+BEGIN
+{
+ DUMP(0);
+ DUMP(1);
+ DUMP(2);
+ DUMP(3);
+ DUMP(4);
+ exit(0);
+}
+
+ERROR
+{
+ printf("error: %s\n", errmsg);
+ exit(1);
+}
+EOF
+
+#
+# First, with all privs
+#
+/usr/sbin/dtrace -q -Cs /dev/stdin < $tmpin > $tmpout2
+mv $tmpout2 $tmpout1
+
+#
+# And now with only dtrace_proc and dtrace_user -- the output should be
+# identical.
+#
+ppriv -s A=basic,dtrace_proc,dtrace_user $$
+
+/usr/sbin/dtrace -q -Cs /dev/stdin < $tmpin > $tmpout2
+
+echo ">>> $tmpout1"
+cat $tmpout1
+
+echo ">>> $tmpout2"
+cat $tmpout2
+
+rval=0
+
+if ! cmp $tmpout1 $tmpout2 ; then
+ rval=1
+fi
+
+rm $tmpout1 $tmpout2 $tmpin
+exit $rval
diff --git a/usr/src/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh b/usr/src/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh
index ae4934cdeb..da9bb4c6c6 100644
--- a/usr/src/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh
@@ -22,8 +22,8 @@
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
-#ident "%Z%%M% %I% %E% SMI"
ppriv -s A=basic,dtrace_proc,dtrace_user $$
@@ -31,7 +31,7 @@ ppriv -s A=basic,dtrace_proc,dtrace_user $$
BEGIN {
errorcount = 0;
- expected_errorcount = 23;
+ expected_errorcount = 27;
}
BEGIN { trace(mutex_owned(&`pidlock)); }
@@ -55,6 +55,8 @@ BEGIN { trace(strtok(`initname, "/")); }
BEGIN { trace(strtok(NULL, "/")); }
BEGIN { trace(strtok("foo/bar", `initname)); }
BEGIN { trace(strtok(NULL, `initname)); }
+BEGIN { trace(strtoll(`initname)); }
+BEGIN { trace(strtoll(`initname, 10)); }
BEGIN { trace(substr(`initname, 2, 3)); }
BEGIN { trace(ddi_pathname(`top_devinfo, 1)); }
@@ -63,6 +65,9 @@ BEGIN { trace(strjoin("foo", `initname)); }
BEGIN { trace(dirname(`initname)); }
BEGIN { trace(cleanpath(`initname)); }
+BEGIN { j = "{\"/sbin/init\":\"uh oh\"}"; trace(json(j, `initname)); }
+BEGIN { trace(json(`initname, "x")); }
+
ERROR {
errorcount++;
}
diff --git a/usr/src/cmd/dtrace/test/tst/common/privs/tst.getf.ksh b/usr/src/cmd/dtrace/test/tst/common/privs/tst.getf.ksh
new file mode 100644
index 0000000000..8f4d65dfd5
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/privs/tst.getf.ksh
@@ -0,0 +1,98 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+
+ppriv -s A=basic,dtrace_proc,dtrace_user $$
+
+/usr/sbin/dtrace -q -Cs /dev/stdin <<EOF
+
+#define CANREAD(field) \
+ BEGIN { this->fp = getf(0); errmsg = "can't read field"; \
+ printf("field: "); trace(this->fp->field); printf("\n"); }
+
+#define CANTREAD(field) \
+ BEGIN { errmsg = ""; this->fp = getf(0); trace(this->fp->field); \
+ printf("\nable to successfully read field!"); exit(1); }
+
+CANREAD(f_flag)
+CANREAD(f_flag2)
+CANREAD(f_vnode)
+CANREAD(f_offset)
+CANREAD(f_cred)
+CANREAD(f_audit_data)
+CANREAD(f_count)
+
+/*
+ * We can potentially read parts of our cred, but we can't dereference
+ * through cr_zone.
+ */
+CANTREAD(f_cred->cr_zone->zone_id)
+
+CANREAD(f_vnode->v_path)
+CANREAD(f_vnode->v_op)
+CANREAD(f_vnode->v_op->vnop_name)
+
+CANTREAD(f_vnode->v_flag)
+CANTREAD(f_vnode->v_count)
+CANTREAD(f_vnode->v_pages)
+CANTREAD(f_vnode->v_type)
+CANTREAD(f_vnode->v_vfsmountedhere)
+CANTREAD(f_vnode->v_op->vop_open)
+
+BEGIN
+{
+ errmsg = "";
+ this->fp = getf(0);
+ this->fp2 = getf(1);
+
+ trace(this->fp->f_vnode);
+ printf("\nable to successfully read this->fp!");
+ exit(1);
+}
+
+BEGIN
+{
+ errmsg = "";
+ this->fp = getf(0);
+}
+
+BEGIN
+{
+ trace(this->fp->f_vnode);
+ printf("\nable to successfully read this->fp from prior clause!");
+}
+
+BEGIN
+{
+ exit(0);
+}
+
+ERROR
+/errmsg != ""/
+{
+ printf("fatal error: %s", errmsg);
+ exit(1);
+}
+
+EOF
diff --git a/usr/src/cmd/dtrace/test/tst/common/privs/tst.procpriv.ksh b/usr/src/cmd/dtrace/test/tst/common/privs/tst.procpriv.ksh
new file mode 100755
index 0000000000..6227a057da
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/privs/tst.procpriv.ksh
@@ -0,0 +1,138 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+
+ppriv -s A=basic,dtrace_proc,dtrace_user $$
+
+#
+# When we have dtrace_proc (but lack dtrace_kernel), we expect to be able to
+# read certain curpsinfo/curlwpsinfo/curcpu fields even though they require
+# reading in-kernel state. However, there are other fields in these translated
+# structures that we know we shouldn't be able to read, as they require reading
+# in-kernel state that we cannot read with only dtrace_proc. Finally, there
+# are a few fields that we may or may not be able to read depending on the
+# specifics of context. This test therefore asserts that we can read what we
+# think we should be able to, that we can't read what we think we shouldn't be
+# able to, and (for purposes of completeness) that we are indifferent about
+# what we cannot assert one way or the other.
+#
+/usr/sbin/dtrace -q -Cs /dev/stdin <<EOF
+
+#define CANREAD(what, field) \
+ BEGIN { errmsg = "can't read field from what"; printf("field: "); \
+ trace(what->field); printf("\n"); }
+
+#define CANTREAD(what, field) \
+ BEGIN { errmsg = ""; trace(what->field); \
+ printf("\nable to successfully read field from what!"); exit(1); }
+
+#define MIGHTREAD(what, field) \
+ BEGIN { errmsg = ""; printf("field: "); trace(what->field); printf("\n"); }
+
+#define CANREADVAR(vname) \
+ BEGIN { errmsg = "can't read vname"; printf("vname: "); \
+ trace(vname); printf("\n"); }
+
+#define CANTREADVAR(vname) \
+ BEGIN { errmsg = ""; trace(vname); \
+ printf("\nable to successfully read vname!"); exit(1); }
+
+#define MIGHTREADVAR(vname) \
+ BEGIN { errmsg = ""; printf("vname: "); trace(vname); printf("\n"); }
+
+CANREAD(curpsinfo, pr_pid)
+CANREAD(curpsinfo, pr_nlwp)
+CANREAD(curpsinfo, pr_ppid)
+CANREAD(curpsinfo, pr_uid)
+CANREAD(curpsinfo, pr_euid)
+CANREAD(curpsinfo, pr_gid)
+CANREAD(curpsinfo, pr_egid)
+CANREAD(curpsinfo, pr_addr)
+CANREAD(curpsinfo, pr_start)
+CANREAD(curpsinfo, pr_fname)
+CANREAD(curpsinfo, pr_psargs)
+CANREAD(curpsinfo, pr_argc)
+CANREAD(curpsinfo, pr_argv)
+CANREAD(curpsinfo, pr_envp)
+CANREAD(curpsinfo, pr_dmodel)
+
+/*
+ * If our p_pgidp points to the same pid structure as our p_pidp, we will
+ * be able to read pr_pgid -- but we won't if not.
+ */
+MIGHTREAD(curpsinfo, pr_pgid)
+
+CANTREAD(curpsinfo, pr_sid)
+CANTREAD(curpsinfo, pr_ttydev)
+CANTREAD(curpsinfo, pr_projid)
+CANTREAD(curpsinfo, pr_zoneid)
+CANTREAD(curpsinfo, pr_contract)
+
+CANREAD(curlwpsinfo, pr_flag)
+CANREAD(curlwpsinfo, pr_lwpid)
+CANREAD(curlwpsinfo, pr_addr)
+CANREAD(curlwpsinfo, pr_wchan)
+CANREAD(curlwpsinfo, pr_stype)
+CANREAD(curlwpsinfo, pr_state)
+CANREAD(curlwpsinfo, pr_sname)
+CANREAD(curlwpsinfo, pr_syscall)
+CANREAD(curlwpsinfo, pr_pri)
+CANREAD(curlwpsinfo, pr_onpro)
+CANREAD(curlwpsinfo, pr_bindpro)
+CANREAD(curlwpsinfo, pr_bindpset)
+
+CANTREAD(curlwpsinfo, pr_clname)
+CANTREAD(curlwpsinfo, pr_lgrp)
+
+CANREAD(curcpu, cpu_id)
+
+CANTREAD(curcpu, cpu_pset)
+CANTREAD(curcpu, cpu_chip)
+CANTREAD(curcpu, cpu_lgrp)
+CANTREAD(curcpu, cpu_info)
+
+/*
+ * We cannot assert one thing or another about the variable "root": for those
+ * with only dtrace_proc, it will be readable in the global but not readable in
+ * the non-global.
+ */
+MIGHTREADVAR(root)
+
+CANREADVAR(cpu)
+CANTREADVAR(pset)
+CANTREADVAR(cwd)
+CANTREADVAR(chip)
+CANTREADVAR(lgrp)
+
+BEGIN
+{
+ exit(0);
+}
+
+ERROR
+/errmsg != ""/
+{
+ printf("fatal error: %s", errmsg);
+ exit(1);
+}
diff --git a/usr/src/cmd/dtrace/test/tst/common/privs/tst.providers.ksh b/usr/src/cmd/dtrace/test/tst/common/privs/tst.providers.ksh
new file mode 100644
index 0000000000..94c3722f78
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/privs/tst.providers.ksh
@@ -0,0 +1,126 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+
+#
+# First, make sure that we can successfully enable the io provider
+#
+if ! dtrace -P io -n BEGIN'{exit(0)}' > /dev/null 2>&1 ; then
+ echo failed to enable io provider with full privs
+ exit 1
+fi
+
+ppriv -s A=basic,dtrace_proc,dtrace_user $$
+
+#
+# Now make sure that we cannot enable the io provider with reduced privs
+#
+if ! dtrace -x errtags -P io -n BEGIN'{exit(1)}' 2>&1 | \
+ grep D_PDESC_ZERO > /dev/null 2>&1 ; then
+ echo successfully enabled the io provider with reduced privs
+ exit 1
+fi
+
+#
+# Keeping our reduced privs, we want to assure that we can see every provider
+# that we think we should be able to see -- and that we can see curpsinfo
+# state but can't otherwise see arguments.
+#
+/usr/sbin/dtrace -wq -Cs /dev/stdin <<EOF
+
+int seen[string];
+int err;
+
+#define CANENABLE(provider) \
+provider::: \
+/err == 0 && progenyof(\$pid) && !seen["provider"]/ \
+{ \
+ trace(arg0); \
+ printf("\nsuccessful trace of arg0 in %s:%s:%s:%s\n", \
+ probeprov, probemod, probefunc, probename); \
+ exit(++err); \
+} \
+ \
+provider::: \
+/progenyof(\$pid)/ \
+{ \
+ seen["provider"]++; \
+} \
+ \
+provider::: \
+/progenyof(\$pid)/ \
+{ \
+ errstr = "provider"; \
+ this->ignore = stringof(curpsinfo->pr_psargs); \
+ errstr = ""; \
+} \
+ \
+END \
+/err == 0 && !seen["provider"]/ \
+{ \
+ printf("no probes from provider\n"); \
+ exit(++err); \
+} \
+ \
+END \
+/err == 0/ \
+{ \
+ printf("saw %d probes from provider\n", seen["provider"]); \
+}
+
+CANENABLE(proc)
+CANENABLE(sched)
+CANENABLE(vminfo)
+CANENABLE(sysinfo)
+
+BEGIN
+{
+ /*
+ * We'll kick off a system of a do-nothing command -- which should be
+ * enough to kick proc, sched, vminfo and sysinfo probes.
+ */
+ system("echo > /dev/null");
+}
+
+ERROR
+/err == 0 && errstr != ""/
+{
+ printf("fatal error: couldn't read curpsinfo->pr_psargs in ");
+ printf("%s-provided probe\n", errstr);
+ exit(++err);
+}
+
+proc:::exit
+/progenyof(\$pid)/
+{
+ exit(0);
+}
+
+tick-10ms
+/i++ > 500/
+{
+ printf("exit probe did not seem to fire\n");
+ exit(++err);
+}
+EOF
diff --git a/usr/src/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d b/usr/src/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d
new file mode 100644
index 0000000000..4d6b5af75b
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/strtoll/err.BaseTooLarge.d
@@ -0,0 +1,35 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * ASSERTION:
+ * The largest base we will accept is Base 36 -- i.e. using all of 0-9 and
+ * A-Z as numerals.
+ *
+ * SECTION: Actions and Subroutines/strtoll()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("%d\n", strtoll("0", 37));
+ exit(0);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/usr/src/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d b/usr/src/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d
new file mode 100644
index 0000000000..de56b50e9e
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/strtoll/err.BaseTooSmall.d
@@ -0,0 +1,34 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * ASSERTION:
+ * The smallest base we will accept is Base 2.
+ *
+ * SECTION: Actions and Subroutines/strtoll()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("%d\n", strtoll("0", 1));
+ exit(0);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/usr/src/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d b/usr/src/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d
new file mode 100644
index 0000000000..0b1812a53c
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d
@@ -0,0 +1,66 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * ASSERTION:
+ * Test the strtoll() subroutine.
+ *
+ * SECTION: Actions and Subroutines/strtoll()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+
+ /* minimum base (2) and maximum base (36): */
+ printf("%d\n", strtoll("0", 2));
+ printf("%d\n", strtoll("1", 36));
+
+ /* simple tests: */
+ printf("%d\n", strtoll("0x20", 16));
+ printf("%d\n", strtoll("-32", 10));
+ printf("%d\n", strtoll("010", 8));
+ printf("%d\n", strtoll("101010", 2));
+
+ /* INT64_MIN and INT64_MAX: */
+ printf("%d\n", strtoll("9223372036854775807"));
+ printf("%d\n", strtoll("-9223372036854775808"));
+ printf("%d\n", strtoll("0777777777777777777777", 8));
+ printf("%d\n", strtoll("-01000000000000000000000", 8));
+
+ /* wrapping: */
+ printf("%d\n", strtoll("1000000000000000000000", 8));
+ printf("%d\n", strtoll("-1000000000000000000001", 8));
+
+ /* hex without prefix: */
+ printf("%d\n", strtoll("baddcafe", 16));
+
+ /* stopping at first out-of-base character: */
+ printf("%d\n", strtoll("12j", 10));
+ printf("%d\n", strtoll("102", 2));
+
+ /* base 36: */
+ printf("%d\n", strtoll("-0DTrace4EverZ", 36));
+
+ /* base 10 is assumed: */
+ printf("%d\n", strtoll("1985"));
+ printf("%d\n", strtoll("-2012"));
+
+ /* empty string: */
+ printf("%d\n", strtoll(""));
+
+ exit(0);
+}
diff --git a/usr/src/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out b/usr/src/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out
new file mode 100644
index 0000000000..d12eb9c197
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/strtoll/tst.strtoll.d.out
@@ -0,0 +1,20 @@
+0
+1
+32
+-32
+8
+42
+9223372036854775807
+-9223372036854775808
+9223372036854775807
+-9223372036854775808
+-9223372036854775808
+9223372036854775807
+3135097598
+12
+2
+-1819882045752187535
+1985
+-2012
+0
+
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh
index 3c41f66214..15e3b1fc03 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh
@@ -23,6 +23,7 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
@@ -60,12 +61,12 @@ main(int argc, char **argv)
}
EOF
-gcc -m64 -c -o test64.o test.c
+cc -m64 -c -o test64.o test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c 64-bit"
exit 1
fi
-gcc -m32 -c -o test32.o test.c
+cc -m32 -c -o test32.o test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c 32-bit"
exit 1
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
index 9b71ac2637..fcb352f810 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
@@ -23,6 +23,7 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+#ident "%Z%%M% %I% %E% SMI"
#
# This test is primarily intended to verify a fix for SPARC, but there's no
@@ -76,7 +77,7 @@ main(int argc, char **argv)
}
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -86,7 +87,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh
index 59339f766c..9c5bc00086 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh
@@ -23,6 +23,7 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
@@ -60,7 +61,7 @@ main(int argc, char **argv)
}
EOF
-gcc -m32 -c test.c
+cc -m32 -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -70,7 +71,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -m32 -o test test.o prov.o
+cc -m32 -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh
index e270290e7d..7fa6f4cc43 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh
@@ -23,6 +23,7 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
@@ -60,7 +61,7 @@ main(int argc, char **argv)
}
EOF
-gcc -m64 -c test.c
+cc -m64 -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -70,7 +71,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -m64 -o test test.o prov.o
+cc -m64 -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.include.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
index 5576ab81ec..1baa02b785 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
@@ -23,6 +23,7 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
# Make sure <unistd.h> defines _DTRACE_VERSION
@@ -45,7 +46,7 @@ main(int argc, char **argv)
}
EOF
-gcc -m32 -o test test.c
+cc -m32 -o test test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh
new file mode 100644
index 0000000000..7def9ed2ab
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh
@@ -0,0 +1,106 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
+#
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+echo '#pragma D option quiet' > test.d
+echo '#pragma D option aggsortkey' >> test.d
+
+cat > test.c <<EOF
+#include <unistd.h>
+
+void
+main()
+{
+EOF
+
+objs=
+
+for oogle in doogle bagnoogle; do
+ cat > $oogle.c <<EOF
+#include <sys/sdt.h>
+
+void
+$oogle()
+{
+ DTRACE_PROBE($oogle, knows);
+}
+EOF
+
+ cat > $oogle.d <<EOF
+provider $oogle {
+ probe knows();
+};
+EOF
+
+ cc -c $oogle.c
+
+ if [ $? -ne 0 ]; then
+ print -u2 "failed to compile $oogle.c"
+ exit 1
+ fi
+
+ $dtrace -G -32 -s $oogle.d $oogle.o -o $oogle.d.o
+
+ if [ $? -ne 0 ]; then
+ print -u2 "failed to process $oogle.d"
+ exit 1
+ fi
+
+ objs="$objs $oogle.o $oogle.d.o"
+ echo $oogle'();' >> test.c
+ echo $oogle'$target:::{@[probefunc] = count()}' >> test.d
+done
+
+echo "}" >> test.c
+
+echo 'END{printa("%-10s %@d\\n", @)}' >> test.d
+
+cc -o test test.c $objs
+
+if [ $? -ne 0 ]; then
+ print -u2 "failed to compile test.c"
+ exit 1
+fi
+
+$dtrace -s ./test.d -Zc ./test
+
+if [ $? -ne 0 ]; then
+ print -u2 "failed to execute test"
+ exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
+exit 0
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out
new file mode 100644
index 0000000000..966b6f6735
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out
@@ -0,0 +1,3 @@
+bagnoogle 1
+doogle 1
+
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh
index c0c3465e76..1599c79c32 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh
@@ -23,6 +23,7 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
# Fake up a scenario where _DTRACE_VERSION is not defined by having our own
# <unistd.h>. This tests that dtrace -h will produce a header file which can
@@ -69,12 +70,12 @@ main(int argc, char **argv)
}
EOF
-gcc -I. -m32 -c test.c
+cc -I. -m32 -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
fi
-gcc -m32 -o test test.o
+cc -m32 -o test test.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
diff --git a/usr/src/cmd/print/scripts/desktop-print-management-prefs b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh
index a0de4d1172..a43970f560 100644
--- a/usr/src/cmd/print/scripts/desktop-print-management-prefs
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh
@@ -1,4 +1,3 @@
-#!/bin/sh
#
# CDDL HEADER START
#
@@ -21,13 +20,40 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
-# This interface launches an available print management tool capable of
-# configuration management of the LP print service.
-#
-exec /usr/bin/ospm-preferences
-/bin/zenity --error --test "preferences are unavailable for the desktop print management tool"
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.c <<EOF
+void
+foo()
+{}
+EOF
+
+cat > doogle.d <<EOF
+provider doogle {
+ probe bagnoogle();
+};
+EOF
+
+cc -c test.c
+$dtrace -G -32 -s doogle.d test.o -o doogle.d.o
+
+if [ $? -eq 0 ]; then
+ print -u2 "dtrace succeeded despite having no probe sites"
+ exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
exit 0
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
index 338dcdf03e..0125d50b80 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
index a2e5edee38..1260903467 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
index f18c585ef6..e9b96638fc 100644
--- a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
diff --git a/usr/src/cmd/dtrace/test/tst/common/ustack/tst.unpriv.c b/usr/src/cmd/dtrace/test/tst/common/ustack/tst.unpriv.c
new file mode 100644
index 0000000000..43ba244444
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/ustack/tst.unpriv.c
@@ -0,0 +1,7 @@
+int
+main(int argc, char *argv[])
+{
+ for (;;)
+ ;
+ return (0);
+}
diff --git a/usr/src/cmd/print/scripts/getmodels b/usr/src/cmd/dtrace/test/tst/common/ustack/tst.unpriv.ksh
index eeb4309ce2..26c430bff7 100644
--- a/usr/src/cmd/print/scripts/getmodels
+++ b/usr/src/cmd/dtrace/test/tst/common/ustack/tst.unpriv.ksh
@@ -1,4 +1,3 @@
-#!/usr/bin/ksh
#
# CDDL HEADER START
#
@@ -19,27 +18,51 @@
#
# CDDL HEADER END
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
#
-# get a list of the Models for this Model from the ppdcache
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
#
-# Input:
-# Manufacturer (Note: printmgr passes only the first word
-# Lexmark of the manufacturer name)
-# Output:
-# Manufacturer Model
-# Lexmark Optra Color 1200
-if [[ $# -lt 1 ]]; then
- exit 1
+ppriv -s A=basic,dtrace_user,dtrace_proc $$
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
fi
-cachefile=/var/lp/ppd/ppdcache
-[[ -f $cachefile ]] || exit 1
-/bin/grep "^$1" $cachefile | nawk '{FS=":"; print $2}' | uniq
-exit 0
+file=out.$$
+dtrace=$1
+
+rm -f $file
+
+dir=`/bin/dirname $tst`
+
+$dtrace -o $file -c $dir/tst.unpriv.exe -ws /dev/stdin <<EOF
+ profile-1234hz
+ /pid == \$target/
+ {
+ @[ustack(20, 8192)] = count();
+ }
+
+ tick-1s
+ {
+ secs++;
+ }
+
+ tick-1s
+ /secs > 10/
+ {
+ trace("test timed out");
+ exit(1);
+ }
+
+ profile-1234hz
+ /pid == \$target && secs > 5/
+ {
+ raise(SIGINT);
+ exit(0);
+ }
+EOF
+
+status=$?
+exit $status
diff --git a/usr/src/cmd/dtrace/test/tst/common/ustack/unpriv_helper.d b/usr/src/cmd/dtrace/test/tst/common/ustack/unpriv_helper.d
new file mode 100644
index 0000000000..eb7b0e9e9d
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/ustack/unpriv_helper.d
@@ -0,0 +1,4 @@
+dtrace:helper:ustack:
+{
+ this->otherstr = "doogle";
+}
diff --git a/usr/src/cmd/flowadm/flowadm.c b/usr/src/cmd/flowadm/flowadm.c
index 374fa1675c..34e597dc78 100644
--- a/usr/src/cmd/flowadm/flowadm.c
+++ b/usr/src/cmd/flowadm/flowadm.c
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
@@ -233,9 +234,9 @@ usage(void)
(void) fprintf(stderr, gettext("usage: flowadm <subcommand>"
" <args>...\n"
" add-flow [-t] -l <link> -a <attr>=<value>[,...]\n"
- "\t\t [-p <prop>=<value>,...] <flow>\n"
- " remove-flow [-t] {-l <link> | <flow>}\n"
- " show-flow [-p] [-l <link>] "
+ "\t\t [-p <prop>=<value>,...] [-z zonename] <flow>\n"
+ " remove-flow [-t] [-z zonename] {-l <link> | <flow>}\n"
+ " show-flow [-p] [-l <link>] [-z zonename] "
"[<flow>]\n\n"
" set-flowprop [-t] -p <prop>=<value>[,...] <flow>\n"
" reset-flowprop [-t] [-p <prop>,...] <flow>\n"
@@ -333,11 +334,12 @@ do_add_flow(int argc, char *argv[])
dladm_arg_list_t *proplist = NULL;
dladm_arg_list_t *attrlist = NULL;
dladm_status_t status;
+ char *zonename = NULL;
bzero(propstr, DLADM_STRSIZE);
bzero(attrstr, DLADM_STRSIZE);
- while ((option = getopt_long(argc, argv, "tR:l:a:p:",
+ while ((option = getopt_long(argc, argv, "tR:l:a:p:z:",
prop_longopts, NULL)) != -1) {
switch (option) {
case 't':
@@ -351,9 +353,6 @@ do_add_flow(int argc, char *argv[])
MAXLINKNAMELEN) >= MAXLINKNAMELEN) {
die("link name too long");
}
- if (dladm_name2info(handle, devname, &linkid, NULL,
- NULL, NULL) != DLADM_STATUS_OK)
- die("invalid link '%s'", devname);
l_arg = B_TRUE;
break;
case 'a':
@@ -368,6 +367,9 @@ do_add_flow(int argc, char *argv[])
DLADM_STRSIZE)
die("property list too long '%s'", propstr);
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option);
}
@@ -376,6 +378,10 @@ do_add_flow(int argc, char *argv[])
die("link is required");
}
+ if (dladm_zname2info(handle, zonename, devname, &linkid, NULL,
+ NULL, NULL) != DLADM_STATUS_OK)
+ die("invalid link '%s'", devname);
+
opterr = 0;
index = optind;
@@ -414,11 +420,12 @@ do_remove_flow(int argc, char *argv[])
boolean_t l_arg = B_FALSE;
remove_flow_state_t state;
dladm_status_t status;
+ char *zonename = NULL;
bzero(&state, sizeof (state));
opterr = 0;
- while ((option = getopt_long(argc, argv, ":tR:l:",
+ while ((option = getopt_long(argc, argv, ":tR:l:z:",
longopts, NULL)) != -1) {
switch (option) {
case 't':
@@ -432,12 +439,11 @@ do_remove_flow(int argc, char *argv[])
MAXLINKNAMELEN) >= MAXLINKNAMELEN) {
die("link name too long");
}
- if (dladm_name2info(handle, linkname, &linkid, NULL,
- NULL, NULL) != DLADM_STATUS_OK) {
- die("invalid link '%s'", linkname);
- }
l_arg = B_TRUE;
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option);
break;
@@ -458,6 +464,12 @@ do_remove_flow(int argc, char *argv[])
/* if link is specified then flow name should not be there */
if (optind == argc-1)
usage();
+
+ if (dladm_zname2info(handle, zonename, linkname, &linkid, NULL,
+ NULL, NULL) != DLADM_STATUS_OK) {
+ die("invalid link '%s'", linkname);
+ }
+
/* walk the link to find flows and remove them */
state.fs_tempop = t_arg;
state.fs_altroot = altroot;
@@ -597,11 +609,12 @@ do_show_flow(int argc, char *argv[])
ofmt_handle_t ofmt;
ofmt_status_t oferr;
uint_t ofmtflags = 0;
+ char *zonename = NULL;
bzero(&state, sizeof (state));
opterr = 0;
- while ((option = getopt_long(argc, argv, ":pPl:o:",
+ while ((option = getopt_long(argc, argv, ":pPl:o:z:",
longopts, NULL)) != -1) {
switch (option) {
case 'p':
@@ -622,17 +635,23 @@ do_show_flow(int argc, char *argv[])
if (strlcpy(linkname, optarg, MAXLINKNAMELEN)
>= MAXLINKNAMELEN)
die("link name too long\n");
- if (dladm_name2info(handle, linkname, &linkid, NULL,
- NULL, NULL) != DLADM_STATUS_OK)
- die("invalid link '%s'", linkname);
l_arg = B_TRUE;
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option);
break;
}
}
+ if (l_arg) {
+ if (dladm_zname2info(handle, zonename, linkname, &linkid, NULL,
+ NULL, NULL) != DLADM_STATUS_OK)
+ die("invalid link '%s'", linkname);
+ }
+
/* get flow name (optional last argument */
if (optind == (argc-1)) {
if (strlcpy(flowname, argv[optind], MAXFLOWNAMELEN)
diff --git a/usr/src/cmd/flowstat/flowstat.c b/usr/src/cmd/flowstat/flowstat.c
index 3ddff9e34f..781ce6b0f0 100644
--- a/usr/src/cmd/flowstat/flowstat.c
+++ b/usr/src/cmd/flowstat/flowstat.c
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
@@ -190,9 +191,9 @@ static char *progname;
static dladm_handle_t handle = NULL;
const char *usage_ermsg = "flowstat [-r | -t] [-i interval] "
- "[-l link] [flow]\n"
+ "[-l link] [-z zonename] [flow]\n"
" flowstat [-S] [-A] [-i interval] [-p] [ -o field[,...]]\n"
- " [-u R|K|M|G|T|P] [-l link] [flow]\n"
+ " [-u R|K|M|G|T|P] [-l link] [-z zonename] [flow]\n"
" flowstat -h [-a] [-d] [-F format]"
" [-s <DD/MM/YYYY,HH:MM:SS>]\n"
" [-e <DD/MM/YYYY,HH:MM:SS>] -f <logfile> "
@@ -556,6 +557,7 @@ main(int argc, char *argv[])
show_flow_state_t state;
char *fields_str = NULL;
char *o_fields_str = NULL;
+ char *zonename = NULL;
char *total_stat_fields =
"flow,ipkts,rbytes,ierrs,opkts,obytes,oerrs";
@@ -582,10 +584,11 @@ main(int argc, char *argv[])
if ((status = dladm_open(&handle)) != DLADM_STATUS_OK)
die_dlerr(status, "could not open /dev/dld");
+ linkname[0] = '\0';
bzero(&state, sizeof (state));
opterr = 0;
- while ((option = getopt_long(argc, argv, ":rtApSi:o:u:l:h",
+ while ((option = getopt_long(argc, argv, ":rtApSi:o:u:l:hz:",
NULL, NULL)) != -1) {
switch (option) {
case 'r':
@@ -642,9 +645,6 @@ main(int argc, char *argv[])
if (strlcpy(linkname, optarg, MAXLINKNAMELEN)
>= MAXLINKNAMELEN)
die("link name too long\n");
- if (dladm_name2info(handle, linkname, &linkid, NULL,
- NULL, NULL) != DLADM_STATUS_OK)
- die("invalid link '%s'", linkname);
break;
case 'h':
if (r_arg || t_arg || p_arg || o_arg || u_arg ||
@@ -655,6 +655,9 @@ main(int argc, char *argv[])
do_show_history(argc, argv);
return (0);
break;
+ case 'z':
+ zonename = optarg;
+ break;
default:
die_opterr(optopt, option, usage_ermsg);
break;
@@ -683,6 +686,12 @@ main(int argc, char *argv[])
die("the option -A is not compatible with "
"-r, -t, -p, -o, -u, -i");
+ if (linkname[0] != '\0') {
+ if (dladm_zname2info(handle, zonename, linkname, &linkid, NULL,
+ NULL, NULL) != DLADM_STATUS_OK)
+ die("invalid link '%s'", linkname);
+ }
+
/* get flow name (optional last argument) */
if (optind == (argc-1)) {
if (strlcpy(flowname, argv[optind], MAXFLOWNAMELEN)
diff --git a/usr/src/cmd/fm/fmdump/common/asru.c b/usr/src/cmd/fm/fmdump/common/asru.c
index 46df5a7a12..414c3fb880 100644
--- a/usr/src/cmd/fm/fmdump/common/asru.c
+++ b/usr/src/cmd/fm/fmdump/common/asru.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <fmdump.h>
@@ -144,5 +145,8 @@ const fmdump_ops_t fmdump_asru_ops = {
(fmd_log_rec_f *)asru_pretty
}, {
NULL, NULL
+}, {
+NULL,
+(fmd_log_rec_f *)fmdump_print_json
} }
};
diff --git a/usr/src/cmd/fm/fmdump/common/error.c b/usr/src/cmd/fm/fmdump/common/error.c
index 62abbcf6ae..a8c849993e 100644
--- a/usr/src/cmd/fm/fmdump/common/error.c
+++ b/usr/src/cmd/fm/fmdump/common/error.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <fmdump.h>
@@ -111,5 +112,8 @@ const fmdump_ops_t fmdump_err_ops = {
(fmd_log_rec_f *)err_pretty
}, {
NULL, NULL
+}, {
+NULL,
+(fmd_log_rec_f *)fmdump_print_json
} }
};
diff --git a/usr/src/cmd/fm/fmdump/common/fault.c b/usr/src/cmd/fm/fmdump/common/fault.c
index 268d6773c2..a8fa104a20 100644
--- a/usr/src/cmd/fm/fmdump/common/fault.c
+++ b/usr/src/cmd/fm/fmdump/common/fault.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <fmdump.h>
@@ -285,5 +286,8 @@ const fmdump_ops_t fmdump_flt_ops = {
}, {
NULL,
(fmd_log_rec_f *)flt_msg
+}, {
+NULL,
+(fmd_log_rec_f *)fmdump_print_json
} }
};
diff --git a/usr/src/cmd/fm/fmdump/common/fmdump.c b/usr/src/cmd/fm/fmdump/common/fmdump.c
index dc22eff7df..0cd3905e0c 100644
--- a/usr/src/cmd/fm/fmdump/common/fmdump.c
+++ b/usr/src/cmd/fm/fmdump/common/fmdump.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <alloca.h>
@@ -193,7 +194,8 @@ static const char *synopsis =
"\t-m display human-readable messages (only for fault logs)\n"
"\t-v set verbose mode: display additional event detail\n"
"\t-V set very verbose mode: display complete event contents\n"
- "\t-p Used with -V: apply some output prettification\n "
+ "\t-p Used with -V: apply some output prettification\n"
+ "\t-j Used with -V: emit JSON-formatted output\n "
"Selection filters:\n"
"\t-c select events that match the specified class\n"
"\t-t select events that occurred after the specified time\n"
@@ -1027,7 +1029,7 @@ pipeline_thr(void *arg)
static int
aggregate(char **ifiles, int n_ifiles, int opt_f,
fmd_log_filter_t *fv, uint_t fc,
- int opt_v, int opt_V, int opt_p)
+ int opt_v, int opt_V, int opt_p, int opt_j)
{
struct fmdump_pipeline *pipeline, *pl;
struct fmdump_srlzer srlzer;
@@ -1074,7 +1076,8 @@ aggregate(char **ifiles, int n_ifiles, int opt_f,
}
if (opt_V)
- fmt = opt_p ? FMDUMP_PRETTY : FMDUMP_VERB2;
+ fmt = opt_p ? FMDUMP_PRETTY : opt_j ? FMDUMP_JSON :
+ FMDUMP_VERB2;
else if (opt_v)
fmt = FMDUMP_VERB1;
else
@@ -1152,7 +1155,7 @@ int
main(int argc, char *argv[])
{
int opt_a = 0, opt_e = 0, opt_f = 0, opt_H = 0, opt_m = 0, opt_p = 0;
- int opt_u = 0, opt_v = 0, opt_V = 0;
+ int opt_u = 0, opt_v = 0, opt_V = 0, opt_j = 0;
int opt_i = 0, opt_I = 0;
int opt_A = 0;
char **ifiles = NULL;
@@ -1187,7 +1190,7 @@ main(int argc, char *argv[])
while (optind < argc) {
while ((c =
- getopt(argc, argv, "Aac:efHiImn:O:pR:t:T:u:vV")) != EOF) {
+ getopt(argc, argv, "Aac:efHiIjmn:O:pR:t:T:u:vV")) != EOF) {
switch (c) {
case 'A':
opt_A++;
@@ -1221,6 +1224,11 @@ main(int argc, char *argv[])
return (usage(stderr));
opt_I++;
break;
+ case 'j':
+ if (opt_p)
+ return (usage(stderr));
+ opt_j++;
+ break;
case 'm':
opt_m++;
break;
@@ -1229,6 +1237,8 @@ main(int argc, char *argv[])
iflags |= FMD_LOG_XITER_OFFS;
break;
case 'p':
+ if (opt_j)
+ return (usage(stderr));
opt_p++;
break;
case 'R':
@@ -1309,7 +1319,7 @@ main(int argc, char *argv[])
rc = aggregate(ifiles, n_ifiles, opt_f,
allfv, allfc,
- opt_v, opt_V, opt_p);
+ opt_v, opt_V, opt_p, opt_j);
cleanup(ifiles, n_ifiles);
return (rc);
@@ -1400,7 +1410,8 @@ main(int argc, char *argv[])
if (opt_V) {
arg.da_fmt =
- &ops->do_formats[opt_p ? FMDUMP_PRETTY : FMDUMP_VERB2];
+ &ops->do_formats[opt_p ? FMDUMP_PRETTY :
+ opt_j ? FMDUMP_JSON : FMDUMP_VERB2];
iflags |= FMD_LOG_XITER_REFS;
} else if (opt_v) {
arg.da_fmt = &ops->do_formats[FMDUMP_VERB1];
diff --git a/usr/src/cmd/fm/fmdump/common/fmdump.h b/usr/src/cmd/fm/fmdump/common/fmdump.h
index ad3577756f..cc26e0c756 100644
--- a/usr/src/cmd/fm/fmdump/common/fmdump.h
+++ b/usr/src/cmd/fm/fmdump/common/fmdump.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#ifndef _FMDUMP_H
@@ -53,6 +54,7 @@ enum {
FMDUMP_VERB2,
FMDUMP_PRETTY,
FMDUMP_MSG,
+ FMDUMP_JSON,
FMDUMP_NFMTS
};
@@ -101,6 +103,8 @@ extern char *fmdump_nvl2str(nvlist_t *nvl);
extern int fmdump_render_nvlist(nvlist_prtctl_t, void *, nvlist_t *,
const char *, nvlist_t *);
+extern int fmdump_print_json(fmd_log_t *, const fmd_log_record_t *, FILE *);
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/cmd/fm/fmdump/common/info.c b/usr/src/cmd/fm/fmdump/common/info.c
index 943dbbc0c1..728da41043 100644
--- a/usr/src/cmd/fm/fmdump/common/info.c
+++ b/usr/src/cmd/fm/fmdump/common/info.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <fmdump.h>
@@ -114,5 +115,8 @@ const fmdump_ops_t fmdump_info_ops = {
(fmd_log_rec_f *)info_pretty
}, {
NULL, NULL
+}, {
+NULL,
+(fmd_log_rec_f *)fmdump_print_json
} }
};
diff --git a/usr/src/cmd/fm/fmdump/common/nvlrender.c b/usr/src/cmd/fm/fmdump/common/nvlrender.c
index 4a55d315c4..2c2f5ca662 100644
--- a/usr/src/cmd/fm/fmdump/common/nvlrender.c
+++ b/usr/src/cmd/fm/fmdump/common/nvlrender.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/*
@@ -72,3 +73,19 @@ fmdump_render_nvlist(nvlist_prtctl_t pctl, void *private, nvlist_t *nvl,
return (1);
}
+
+/*
+ * Thin wrapper around libnvpair's inbuilt JSON routine. Simply dumps the
+ * entire log record nvlist without any reformatting.
+ */
+
+/*ARGSUSED*/
+int
+fmdump_print_json(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
+{
+ if (nvlist_print_json(fp, rp->rec_nvl) != 0 || fprintf(fp, "\n") < 0 ||
+ fflush(fp) != 0)
+ return (-1);
+
+ return (0);
+}
diff --git a/usr/src/cmd/fm/fmtopo/common/fmtopo.c b/usr/src/cmd/fm/fmtopo/common/fmtopo.c
index b2e26c596f..0de419e2b1 100644
--- a/usr/src/cmd/fm/fmtopo/common/fmtopo.c
+++ b/usr/src/cmd/fm/fmtopo/common/fmtopo.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
@@ -597,30 +598,29 @@ set_prop(topo_hdl_t *thp, tnode_t *node, nvlist_t *fmri, struct prop_args *pp)
{
int ret, err = 0;
topo_type_t type;
- nvlist_t *nvl, *f = NULL;
+ nvlist_t *nvl = NULL;
char *end;
if (pp->prop == NULL || pp->type == NULL || pp->value == NULL)
- return;
+ goto out;
if ((type = str2type(pp->type)) == TOPO_TYPE_INVALID) {
(void) fprintf(stderr, "%s: invalid property type %s for %s\n",
g_pname, pp->type, pp->prop);
- return;
+ goto out;
}
if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0) {
(void) fprintf(stderr, "%s: nvlist allocation failed for "
"%s=%s:%s\n", g_pname, pp->prop, pp->type, pp->value);
- return;
+ goto out;
}
ret = nvlist_add_string(nvl, TOPO_PROP_VAL_NAME, pp->prop);
ret |= nvlist_add_uint32(nvl, TOPO_PROP_VAL_TYPE, type);
if (ret != 0) {
(void) fprintf(stderr, "%s: invalid property type %s for %s\n",
g_pname, pp->type, pp->prop);
- nvlist_free(nvl);
- return;
+ goto out;
}
errno = 0;
@@ -681,13 +681,17 @@ set_prop(topo_hdl_t *thp, tnode_t *node, nvlist_t *fmri, struct prop_args *pp)
}
case TOPO_TYPE_FMRI:
{
- if ((ret = topo_fmri_str2nvl(thp, pp->value, &f, &err))
- < 0)
+ nvlist_t *val = NULL;
+
+ if ((ret = topo_fmri_str2nvl(thp, pp->value, &val,
+ &err)) < 0)
break;
if ((ret = nvlist_add_nvlist(nvl, TOPO_PROP_VAL_VAL,
- f)) != 0)
+ val)) != 0)
err = ETOPO_PROP_NVL;
+
+ nvlist_free(val);
break;
}
default:
@@ -697,60 +701,54 @@ set_prop(topo_hdl_t *thp, tnode_t *node, nvlist_t *fmri, struct prop_args *pp)
if (ret != 0) {
(void) fprintf(stderr, "%s: unable to set property value for "
"%s: %s\n", g_pname, pp->prop, topo_strerror(err));
- nvlist_free(nvl);
- return;
+ goto out;
}
if (node != NULL) {
- if (topo_prop_setprop(node, pp->group, nvl, TOPO_PROP_MUTABLE,
- f, &ret) < 0) {
+ if ((ret = topo_prop_setprop(node, pp->group, nvl,
+ TOPO_PROP_MUTABLE, nvl, &err)) < 0) {
(void) fprintf(stderr, "%s: unable to set property "
"value for " "%s=%s:%s: %s\n", g_pname, pp->prop,
- pp->type, pp->value, topo_strerror(ret));
- nvlist_free(nvl);
- nvlist_free(f);
- return;
+ pp->type, pp->value, topo_strerror(err));
+ goto out;
}
} else {
- if (topo_fmri_setprop(thp, fmri, pp->group, nvl,
- TOPO_PROP_MUTABLE, f, &ret) < 0) {
+ if ((ret = topo_fmri_setprop(thp, fmri, pp->group, nvl,
+ TOPO_PROP_MUTABLE, nvl, &err)) < 0) {
(void) fprintf(stderr, "%s: unable to set property "
"value for " "%s=%s:%s: %s\n", g_pname, pp->prop,
- pp->type, pp->value, topo_strerror(ret));
- nvlist_free(nvl);
- nvlist_free(f);
- return;
+ pp->type, pp->value, topo_strerror(err));
+ goto out;
}
}
nvlist_free(nvl);
+ nvl = NULL;
/*
* Now, get the property back for printing
*/
if (node != NULL) {
- if (topo_prop_getprop(node, pp->group, pp->prop, f, &nvl,
- &err) < 0) {
+ if ((ret = topo_prop_getprop(node, pp->group, pp->prop, NULL,
+ &nvl, &err)) < 0) {
(void) fprintf(stderr, "%s: failed to get %s.%s: %s\n",
g_pname, pp->group, pp->prop, topo_strerror(err));
- nvlist_free(f);
- return;
+ goto out;
}
} else {
- if (topo_fmri_getprop(thp, fmri, pp->group, pp->prop,
- f, &nvl, &err) < 0) {
+ if ((ret = topo_fmri_getprop(thp, fmri, pp->group, pp->prop,
+ NULL, &nvl, &err)) < 0) {
(void) fprintf(stderr, "%s: failed to get %s.%s: %s\n",
g_pname, pp->group, pp->prop, topo_strerror(err));
- nvlist_free(f);
- return;
+ goto out;
}
}
print_pgroup(thp, node, pp->group, NULL, NULL, 0);
print_prop_nameval(thp, node, nvl);
- nvlist_free(nvl);
- nvlist_free(f);
+out:
+ nvlist_free(nvl);
}
static void
diff --git a/usr/src/cmd/fm/modules/common/Makefile b/usr/src/cmd/fm/modules/common/Makefile
index 27c00d9b08..2d92330f4f 100644
--- a/usr/src/cmd/fm/modules/common/Makefile
+++ b/usr/src/cmd/fm/modules/common/Makefile
@@ -23,6 +23,7 @@
#
SUBDIRS = cpumem-retire \
+ disk-lights \
disk-monitor \
disk-transport \
eversholt \
diff --git a/usr/src/cmd/fm/modules/common/disk-lights/Makefile b/usr/src/cmd/fm/modules/common/disk-lights/Makefile
new file mode 100644
index 0000000000..d7c3bdadb7
--- /dev/null
+++ b/usr/src/cmd/fm/modules/common/disk-lights/Makefile
@@ -0,0 +1,23 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
+#
+
+MODULE = disk-lights
+CLASS = common
+SRCS = disk_lights.c
+
+include ../../Makefile.plugin
+
+LDLIBS += -ltopo
+LDFLAGS += -L$(ROOT)/usr/lib/fm -R/usr/lib/fm
diff --git a/usr/src/cmd/fm/modules/common/disk-lights/disk-lights.conf b/usr/src/cmd/fm/modules/common/disk-lights/disk-lights.conf
new file mode 100644
index 0000000000..c0701dde08
--- /dev/null
+++ b/usr/src/cmd/fm/modules/common/disk-lights/disk-lights.conf
@@ -0,0 +1,17 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
+#
+
+subscribe fault.io.disk.*
+subscribe fault.io.scsi.*
diff --git a/usr/src/cmd/fm/modules/common/disk-lights/disk_lights.c b/usr/src/cmd/fm/modules/common/disk-lights/disk_lights.c
new file mode 100644
index 0000000000..7eaa421559
--- /dev/null
+++ b/usr/src/cmd/fm/modules/common/disk-lights/disk_lights.c
@@ -0,0 +1,325 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * Disk Lights Agent (FMA)
+ *
+ * This Fault Management Daemon (fmd) module periodically scans the topology
+ * tree, enumerates all disks with associated fault indicators, and then
+ * synchronises the fault status of resources in the FMA Resource Cache with
+ * the indicators. In short: it turns the fault light on for befallen disks.
+ *
+ * Presently, we recognise associated fault indicators for disks by looking
+ * for the following structure in the topology tree:
+ *
+ * /bay=N
+ * |
+ * +---- /disk=0 <---------------- our Disk
+ * |
+ * +---- /bay=N?indicator=fail <---- the Fault Light
+ * \---- /bay=N?indicator=ident
+ *
+ * That is: a DISK node will have a parent BAY; that BAY will itself have
+ * child Facility nodes, one of which will be called "fail". If any of the
+ * above does not hold, we simply do nothing for this disk.
+ */
+
+#include <string.h>
+#include <strings.h>
+#include <libnvpair.h>
+#include <fm/libtopo.h>
+#include <fm/topo_list.h>
+#include <fm/topo_hc.h>
+#include <fm/fmd_api.h>
+#include <sys/fm/protocol.h>
+
+
+typedef struct disk_lights {
+ fmd_hdl_t *dl_fmd;
+ uint64_t dl_poll_interval;
+ uint64_t dl_coalesce_interval;
+ id_t dl_timer;
+ boolean_t dl_triggered;
+} disk_lights_t;
+
+static void disklights_topo(fmd_hdl_t *, topo_hdl_t *);
+static void disklights_recv(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
+ const char *);
+static void disklights_timeout(fmd_hdl_t *, id_t, void *);
+
+static const fmd_hdl_ops_t fmd_ops = {
+ disklights_recv, /* fmdo_recv */
+ disklights_timeout, /* fmdo_timeout */
+ NULL, /* fmdo_close */
+ NULL, /* fmdo_stats */
+ NULL, /* fmdo_gc */
+ NULL, /* fmdo_send */
+ disklights_topo, /* fmdo_topo */
+};
+
+/*
+ * POLL_INTERVAL is the period after which we perform an unsolicited poll
+ * to ensure we remain in sync with reality.
+ */
+#define DL_PROP_POLL_INTERVAL "poll-interval"
+
+/*
+ * COALESCE_INTERVAL is how long we wait after we are trigged by either a
+ * topology change or a relevant list.* event, in order to allow a series
+ * of events to coalesce.
+ */
+#define DL_PROP_COALESCE_INTERVAL "coalesce-interval"
+
+static const fmd_prop_t fmd_props[] = {
+ { DL_PROP_POLL_INTERVAL, FMD_TYPE_TIME, "5min" },
+ { DL_PROP_COALESCE_INTERVAL, FMD_TYPE_TIME, "3s" },
+ { NULL, 0, NULL }
+};
+
+static const fmd_hdl_info_t fmd_info = {
+ "Disk Lights Agent",
+ "1.0",
+ &fmd_ops,
+ fmd_props
+};
+
+/*
+ * Fetch the Facility Node properties (name, type) from the FMRI
+ * for this node, or return -1 if we can't.
+ */
+static int
+get_facility_props(topo_hdl_t *hdl, tnode_t *node, char **facname,
+ char **factype)
+{
+ int e, ret = -1;
+ nvlist_t *fmri = NULL, *fnvl;
+ char *nn = NULL, *tt = NULL;
+
+ if (topo_node_resource(node, &fmri, &e) != 0)
+ goto out;
+
+ if (nvlist_lookup_nvlist(fmri, FM_FMRI_FACILITY, &fnvl) != 0)
+ goto out;
+
+ if (nvlist_lookup_string(fnvl, FM_FMRI_FACILITY_NAME, &nn) != 0)
+ goto out;
+
+ if (nvlist_lookup_string(fnvl, FM_FMRI_FACILITY_TYPE, &tt) != 0)
+ goto out;
+
+ *facname = topo_hdl_strdup(hdl, nn);
+ *factype = topo_hdl_strdup(hdl, tt);
+ ret = 0;
+
+out:
+ nvlist_free(fmri);
+ return (ret);
+}
+
+typedef struct dl_fault_walk_inner {
+ char *fwi_name;
+ uint32_t fwi_mode;
+} dl_fault_walk_inner_t;
+
+static int
+dl_fault_walk_inner(topo_hdl_t *thp, tnode_t *node, void *arg)
+{
+ dl_fault_walk_inner_t *fwi = arg;
+ char *facname = NULL, *factype = NULL;
+ int err;
+
+ /*
+ * We're only interested in BAY children that are valid Facility Nodes.
+ */
+ if (topo_node_flags(node) != TOPO_NODE_FACILITY ||
+ get_facility_props(thp, node, &facname, &factype) != 0) {
+ goto out;
+ }
+
+ if (strcmp(fwi->fwi_name, facname) != 0)
+ goto out;
+
+ /*
+ * Attempt to set the LED mode appropriately. If this fails, give up
+ * and move on.
+ */
+ (void) topo_prop_set_uint32(node, TOPO_PGROUP_FACILITY, TOPO_LED_MODE,
+ TOPO_PROP_MUTABLE, fwi->fwi_mode, &err);
+
+out:
+ topo_hdl_strfree(thp, facname);
+ topo_hdl_strfree(thp, factype);
+ return (TOPO_WALK_NEXT);
+}
+
+static int
+dl_fault_walk_outer(topo_hdl_t *thp, tnode_t *node, void *arg)
+{
+ disk_lights_t *dl = arg;
+ dl_fault_walk_inner_t fwi;
+ tnode_t *pnode;
+ int err, has_fault;
+ nvlist_t *fmri = NULL;
+
+ bzero(&fwi, sizeof (fwi));
+
+ /*
+ * We are only looking for DISK nodes in the topology that have a parent
+ * BAY.
+ */
+ if (strcmp(DISK, topo_node_name(node)) != 0 ||
+ (pnode = topo_node_parent(node)) == NULL ||
+ strcmp(BAY, topo_node_name(pnode)) != 0) {
+ return (TOPO_WALK_NEXT);
+ }
+
+ /*
+ * Check to see if the Resource this FMRI describes is Faulty:
+ */
+ if (topo_node_resource(node, &fmri, &err) != 0)
+ return (TOPO_WALK_NEXT);
+ has_fault = fmd_nvl_fmri_has_fault(dl->dl_fmd, fmri,
+ FMD_HAS_FAULT_RESOURCE, NULL);
+ nvlist_free(fmri);
+
+ /*
+ * Walk the children of this BAY and flush out our fault status if
+ * we find an appropriate indicator node.
+ */
+ fwi.fwi_name = "fail";
+ fwi.fwi_mode = has_fault ? TOPO_LED_STATE_ON : TOPO_LED_STATE_OFF;
+ (void) topo_node_child_walk(thp, pnode, dl_fault_walk_inner, &fwi,
+ &err);
+
+ return (TOPO_WALK_NEXT);
+}
+
+/*
+ * Walk all of the topology nodes looking for DISKs that match the structure
+ * described in the overview. Once we find them, check their fault status
+ * and update their fault indiciator accordingly.
+ */
+static void
+dl_examine_topo(disk_lights_t *dl)
+{
+ int err;
+ topo_hdl_t *thp = NULL;
+ topo_walk_t *twp = NULL;
+
+ thp = fmd_hdl_topo_hold(dl->dl_fmd, TOPO_VERSION);
+ if ((twp = topo_walk_init(thp, FM_FMRI_SCHEME_HC, dl_fault_walk_outer,
+ dl, &err)) == NULL) {
+ fmd_hdl_error(dl->dl_fmd, "failed to get topology: %s\n",
+ topo_strerror(err));
+ goto out;
+ }
+
+ if (topo_walk_step(twp, TOPO_WALK_CHILD) == TOPO_WALK_ERR) {
+ fmd_hdl_error(dl->dl_fmd, "failed to walk topology: %s\n",
+ topo_strerror(err));
+ goto out;
+ }
+
+out:
+ if (twp != NULL)
+ topo_walk_fini(twp);
+ if (thp != NULL)
+ fmd_hdl_topo_rele(dl->dl_fmd, thp);
+}
+
+static void
+dl_trigger_enum(disk_lights_t *dl)
+{
+ /*
+ * If we're already on the short-poll coalesce timer, then return
+ * immediately.
+ */
+ if (dl->dl_triggered == B_TRUE)
+ return;
+ dl->dl_triggered = B_TRUE;
+
+ /*
+ * Replace existing poll timer with coalesce timer:
+ */
+ if (dl->dl_timer != 0)
+ fmd_timer_remove(dl->dl_fmd, dl->dl_timer);
+ dl->dl_timer = fmd_timer_install(dl->dl_fmd, NULL, NULL,
+ dl->dl_coalesce_interval);
+}
+
+static void
+disklights_timeout(fmd_hdl_t *hdl, id_t id, void *data)
+{
+ disk_lights_t *dl = fmd_hdl_getspecific(hdl);
+
+ dl->dl_triggered = B_FALSE;
+
+ dl_examine_topo(dl);
+
+ /*
+ * Install the long-interval timer for the next poll.
+ */
+ dl->dl_timer = fmd_timer_install(hdl, NULL, NULL, dl->dl_poll_interval);
+}
+
+static void
+disklights_topo(fmd_hdl_t *hdl, topo_hdl_t *thp)
+{
+ disk_lights_t *dl = fmd_hdl_getspecific(hdl);
+
+ dl_trigger_enum(dl);
+}
+
+static void
+disklights_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
+ const char *class)
+{
+ disk_lights_t *dl = fmd_hdl_getspecific(hdl);
+
+ dl_trigger_enum(dl);
+}
+
+void
+_fmd_init(fmd_hdl_t *hdl)
+{
+ disk_lights_t *dl;
+
+ if (fmd_hdl_register(hdl, FMD_API_VERSION, &fmd_info) != 0)
+ return;
+
+ dl = fmd_hdl_zalloc(hdl, sizeof (*dl), FMD_SLEEP);
+ fmd_hdl_setspecific(hdl, dl);
+
+ /*
+ * Load Configuration:
+ */
+ dl->dl_fmd = hdl;
+ dl->dl_poll_interval = fmd_prop_get_int64(hdl, DL_PROP_POLL_INTERVAL);
+ dl->dl_coalesce_interval = fmd_prop_get_int64(hdl,
+ DL_PROP_COALESCE_INTERVAL);
+
+ /*
+ * Schedule the initial enumeration:
+ */
+ dl_trigger_enum(dl);
+}
+
+void
+_fmd_fini(fmd_hdl_t *hdl)
+{
+ disk_lights_t *dl = fmd_hdl_getspecific(hdl);
+
+ fmd_hdl_free(hdl, dl, sizeof (*dl));
+}
diff --git a/usr/src/cmd/fm/modules/common/fabric-xlate/Makefile b/usr/src/cmd/fm/modules/common/fabric-xlate/Makefile
index 04fcae4022..ef2fd7530d 100644
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/Makefile
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/Makefile
@@ -29,7 +29,7 @@ SRCS = fabric-xlate.c fx_epkt.c fx_fabric.c fx_fire.c fx_subr.c
include ../../Makefile.plugin
-CPPFLAGS += -I/usr/include/libxml2 -I$(KMFDIR)/include -I.
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I$(KMFDIR)/include -I.
CPPFLAGS += -I$(SRC)/uts/sun4v/io/px
INCDIRS = $(SRC)/uts/common
CFLAGS += -I$(INCDIRS)
diff --git a/usr/src/cmd/fs.d/Makefile b/usr/src/cmd/fs.d/Makefile
index d8c2f66a0a..1854cd4909 100644
--- a/usr/src/cmd/fs.d/Makefile
+++ b/usr/src/cmd/fs.d/Makefile
@@ -19,6 +19,7 @@
# CDDL HEADER END
#
# Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2012, Joyent, Inc. All rights reserved.
#
# The filesystem independent utilities clri, fsdb, dcopy, labelit, and mkfs
@@ -38,8 +39,8 @@ DEFAULTFILES= fs.dfl
include ../Makefile.cmd
-SUBDIR1= lofs zfs
-SUBDIR2= dev fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs cachefs \
+SUBDIR1= hyprlofs lofs zfs
+SUBDIR2= dev fd pcfs nfs hsfs lxproc proc ctfs udfs ufs tmpfs cachefs \
autofs mntfs objfs sharefs smbclnt reparsed
SUBDIRS= $(SUBDIR1) $(SUBDIR2)
I18NDIRS= $(SUBDIR2)
diff --git a/usr/src/cmd/lp/lib/Makefile.msg b/usr/src/cmd/fs.d/hyprlofs/Makefile
index 6139f92225..1a3aaf18d3 100644
--- a/usr/src/cmd/lp/lib/Makefile.msg
+++ b/usr/src/cmd/fs.d/hyprlofs/Makefile
@@ -19,17 +19,24 @@
#
# CDDL HEADER END
#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/lib/Makefile.msg
-POFILES = $(OBJECTS:%.o=%.po)
+SUBDIRS= hlcfg mount
+
+all:= TARGET= all
+install:= TARGET= install
+clean:= TARGET= clean
+clobber:= TARGET= clobber
+lint:= TARGET= lint
+
+.KEEP_STATE:
+
+.PARALLEL: $(SUBDIRS)
+
+all install clean clobber lint: $(SUBDIRS)
-include ../../Makefile.lp.msg
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
-catalog: $(POFILE)
- $(CP) $(POFILE) ../..
+FRC:
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/postio.fd b/usr/src/cmd/fs.d/hyprlofs/hlcfg/Makefile
index d6a3dabba2..d2ae22e9fd 100644
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/postio.fd
+++ b/usr/src/cmd/fs.d/hyprlofs/hlcfg/Makefile
@@ -1,4 +1,3 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
#
# CDDL HEADER START
#
@@ -20,10 +19,12 @@
#
# CDDL HEADER END
#
+# Copyright 2012, Joyent, Inc. All rights reserved.
+#
+
+FSTYPE= hyprlofs
+LIBPROG= hlcfg
-Input types: postdown
-Output types: PS
-Printer types: PS
-Printers: any
-Filter type: fast
-Command: /usr/lib/lp/postscript/postio 2>>$ERRFILE
+include ../../Makefile.fstype
+include ../../Makefile.mount
+include ../../Makefile.mount.targ
diff --git a/usr/src/cmd/fs.d/hyprlofs/hlcfg/hlcfg.c b/usr/src/cmd/fs.d/hyprlofs/hlcfg/hlcfg.c
new file mode 100644
index 0000000000..16e8e32b1c
--- /dev/null
+++ b/usr/src/cmd/fs.d/hyprlofs/hlcfg/hlcfg.c
@@ -0,0 +1,244 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * This is a simple test program to exercise the hyprlofs ioctls. This is
+ * not designed as a full featured CLI and only does minimal error checking
+ * and reporting.
+ */
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <strings.h>
+#include <sys/errno.h>
+#include <sys/fs/hyprlofs.h>
+
+extern int errno;
+
+char *usage = "usage: <fs path> add [<file name> <alias>]+\n"
+ " <fs path> addl [<file name>]+\n"
+ " <fs path> rm [<alias>]+\n"
+ " <fs path> clear"
+ " <fs path> get";
+
+typedef enum {
+ CMD_ADD,
+ CMD_RM,
+ CMD_CLR,
+ CMD_ADDL,
+ CMD_GET
+} cmd_t;
+
+static int
+get_entries(int fd)
+{
+ int err;
+ int i;
+ hyprlofs_curr_entries_t e;
+ hyprlofs_curr_entry_t *ep;
+
+ e.hce_cnt = 0;
+ e.hce_entries = NULL;
+
+ err = ioctl(fd, HYPRLOFS_GET_ENTRIES, &e);
+ if (err != 0 && errno != E2BIG) {
+ perror("ioctl");
+ return (1);
+ }
+
+ if (err == 0) {
+ (void) printf("success, but no entries\n");
+ return (0);
+ }
+
+ /*
+ * E2BIG is what we expect when there are existing mappings
+ * since the current cnt is still returned in that case.
+ */
+ (void) printf("cnt: %d\n", e.hce_cnt);
+
+ /* alloc array and call again, then print array */
+ if ((ep = (hyprlofs_curr_entry_t *)
+ malloc(sizeof (hyprlofs_curr_entry_t) * e.hce_cnt)) == NULL) {
+ (void) fprintf(stderr, "out of memory\n");
+ exit(1);
+ }
+
+ e.hce_entries = ep;
+ errno = 0;
+ if (ioctl(fd, HYPRLOFS_GET_ENTRIES, &e) != 0) {
+ /*
+ * Not handling an increase here. We would need to free and
+ * start over to do that, but ok for a test program.
+ */
+ perror("ioctl");
+ free(ep);
+ return (1);
+ }
+ for (i = 0; i < e.hce_cnt; i++)
+ (void) printf("%s %s\n", ep[i].hce_path, ep[i].hce_name);
+
+ free(ep);
+ return (0);
+}
+
+int
+main(int argc, char **argv)
+{
+ int i, ap;
+ cmd_t cmd;
+ int cnt = 0;
+ int fd;
+ int rv = 0;
+ hyprlofs_entry_t *e = NULL;
+ hyprlofs_entries_t ents;
+
+ if (argc < 3) {
+ (void) fprintf(stderr, "%s\n", usage);
+ exit(1);
+ }
+
+ if ((fd = open(argv[1], O_RDONLY)) < 0) {
+ perror("can't open hyprlofs mount");
+ exit(1);
+ }
+
+ if (strcmp(argv[2], "add") == 0) {
+ cmd = CMD_ADD;
+ } else if (strcmp(argv[2], "rm") == 0) {
+ cmd = CMD_RM;
+ } else if (strcmp(argv[2], "clear") == 0) {
+ cmd = CMD_CLR;
+ } else if (strcmp(argv[2], "addl") == 0) {
+ cmd = CMD_ADDL;
+ } else if (strcmp(argv[2], "get") == 0) {
+ cmd = CMD_GET;
+ } else {
+ (void) fprintf(stderr, "%s\n", usage);
+ exit(1);
+ }
+
+ /* Count up the number of parameters. The arg format varies w/ cmd */
+ switch (cmd) {
+ case CMD_ADD:
+ for (i = 3; i < argc; i++) {
+ /* argv[i] is the file path */
+
+ /* The next arg is the alias */
+ if (++i >= argc) {
+ (void) fprintf(stderr, "missing alias for %s\n",
+ argv[i - 1]);
+ exit(1);
+ }
+
+ cnt++;
+ }
+ break;
+ case CMD_ADDL:
+ cnt = argc - 3;
+ break;
+ case CMD_RM:
+ cnt = argc - 3;
+ break;
+ case CMD_CLR: /*FALLTHRU*/
+ case CMD_GET:
+ if (argc > 3) {
+ (void) fprintf(stderr, "%s\n", usage);
+ exit(1);
+ }
+ break;
+ }
+
+ if (cnt > 0) {
+ if ((e = (hyprlofs_entry_t *)malloc(sizeof (hyprlofs_entry_t) *
+ cnt)) == NULL) {
+ (void) fprintf(stderr, "out of memory\n");
+ exit(1);
+ }
+ }
+
+ /*
+ * Format up the args.
+ * We only setup the path member for the add cmd.
+ * We won't run this loop for the clear cmd.
+ * The addl command is special since we use basename to get the alias.
+ */
+ for (i = 0, ap = 3; i < cnt; i++, ap++) {
+ if (cmd == CMD_ADDL) {
+ e[i].hle_path = argv[ap];
+ e[i].hle_plen = strlen(e[i].hle_path);
+
+ e[i].hle_name = basename(argv[ap]);
+ e[i].hle_nlen = strlen(e[i].hle_name);
+
+ continue;
+ }
+
+ if (cmd == CMD_ADD) {
+ e[i].hle_path = argv[ap++];
+ e[i].hle_plen = strlen(e[i].hle_path);
+ }
+
+ e[i].hle_name = argv[ap];
+ e[i].hle_nlen = strlen(e[i].hle_name);
+ }
+
+ ents.hle_entries = e;
+ ents.hle_len = cnt;
+
+ switch (cmd) {
+ case CMD_ADD: /*FALLTHRU*/
+ case CMD_ADDL:
+ if (ioctl(fd, HYPRLOFS_ADD_ENTRIES, &ents) < 0) {
+ perror("ioctl");
+ rv = 1;
+ }
+ break;
+ case CMD_RM:
+ if (ioctl(fd, HYPRLOFS_RM_ENTRIES, &ents) < 0) {
+ perror("ioctl");
+ rv = 1;
+ }
+ break;
+ case CMD_CLR:
+ if (ioctl(fd, HYPRLOFS_RM_ALL) < 0) {
+ perror("ioctl");
+ rv = 1;
+ }
+ break;
+ case CMD_GET:
+ rv = get_entries(fd);
+ break;
+ }
+
+ (void) close(fd);
+ if (cnt > 0)
+ free(e);
+ return (rv);
+}
diff --git a/usr/src/cmd/fs.d/hyprlofs/mount/Makefile b/usr/src/cmd/fs.d/hyprlofs/mount/Makefile
new file mode 100644
index 0000000000..a0b63d211c
--- /dev/null
+++ b/usr/src/cmd/fs.d/hyprlofs/mount/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2012 Joyent, Inc. All rights reserved.
+#
+
+FSTYPE= hyprlofs
+LIBPROG= mount
+
+include ../../Makefile.fstype
+include ../../Makefile.mount
+include ../../Makefile.mount.targ
diff --git a/usr/src/cmd/fs.d/hyprlofs/mount/mount.c b/usr/src/cmd/fs.d/hyprlofs/mount/mount.c
new file mode 100644
index 0000000000..a95c9ca3c2
--- /dev/null
+++ b/usr/src/cmd/fs.d/hyprlofs/mount/mount.c
@@ -0,0 +1,148 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
+ */
+
+#define HLFS
+#define MNTTYPE_HYFS "hyprlofs"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libintl.h>
+#include <errno.h>
+#include <sys/fstyp.h>
+#include <sys/fsid.h>
+#include <sys/mntent.h>
+#include <sys/mnttab.h>
+#include <sys/mount.h>
+#include <sys/signal.h>
+#include <sys/stat.h>
+#include <fslib.h>
+
+#define RET_OK 0
+/*
+ * /sbin/mount and the fs-local method understand this exit code to
+ * mean that all the mount failures were related to hyprlofs mounts. Since
+ * this program only attempts to mount hyfs file systems, when it fails
+ * it returns this exit status.
+ */
+#define RET_ERR 111
+
+static void usage(void);
+
+static char optbuf[MAX_MNTOPT_STR] = { '\0', };
+static int optsize = 0;
+
+static char fstype[] = MNTTYPE_HYFS;
+
+/*
+ * usage: mount [-Ormq] [-o options] special mountp
+ *
+ * This mount program is exec'ed by /usr/sbin/mount if '-F hyprlofs' is
+ * specified.
+ */
+int
+main(int argc, char *argv[])
+{
+ int c;
+ char *special; /* Entity being mounted */
+ char *mountp; /* Entity being mounted on */
+ char *savedoptbuf;
+ char *myname;
+ char typename[64];
+ int flags = 0;
+ int errflag = 0;
+ int qflg = 0;
+
+ myname = strrchr(argv[0], '/');
+ myname = myname ? myname+1 : argv[0];
+ (void) snprintf(typename, sizeof (typename), "%s %s", fstype, myname);
+ argv[0] = typename;
+
+ while ((c = getopt(argc, argv, "o:rmOq")) != EOF) {
+ switch (c) {
+ case '?':
+ errflag++;
+ break;
+
+ case 'o':
+ if (strlcpy(optbuf, optarg, sizeof (optbuf)) >=
+ sizeof (optbuf)) {
+ (void) fprintf(stderr,
+ gettext("%s: Invalid argument: %s\n"),
+ myname, optarg);
+ return (2);
+ }
+ optsize = strlen(optbuf);
+ break;
+ case 'O':
+ flags |= MS_OVERLAY;
+ break;
+ case 'r':
+ flags |= MS_RDONLY;
+ break;
+
+ case 'm':
+ flags |= MS_NOMNTTAB;
+ break;
+
+ case 'q':
+ qflg = 1;
+ break;
+
+ default:
+ usage();
+ }
+ }
+ if ((argc - optind != 2) || errflag) {
+ usage();
+ }
+ special = argv[argc - 2];
+ mountp = argv[argc - 1];
+
+ if ((savedoptbuf = strdup(optbuf)) == NULL) {
+ (void) fprintf(stderr, gettext("%s: out of memory\n"),
+ myname);
+ exit(2);
+ }
+ if (mount(special, mountp, flags | MS_OPTIONSTR, fstype, NULL, 0,
+ optbuf, MAX_MNTOPT_STR)) {
+ (void) fprintf(stderr, "mount: ");
+ perror(special);
+ exit(RET_ERR);
+ }
+ if (optsize && !qflg)
+ cmp_requested_to_actual_options(savedoptbuf, optbuf,
+ special, mountp);
+ return (0);
+}
+
+void
+usage(void)
+{
+ (void) fprintf(stderr,
+ "Usage: mount [-Ormq] [-o options] special mountpoint\n");
+ exit(RET_ERR);
+}
diff --git a/usr/src/cmd/fs.d/lxproc/Makefile b/usr/src/cmd/fs.d/lxproc/Makefile
new file mode 100644
index 0000000000..77075ef1dd
--- /dev/null
+++ b/usr/src/cmd/fs.d/lxproc/Makefile
@@ -0,0 +1,32 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+FSTYPE= lxproc
+LIBPROG= mount
+
+include ../Makefile.fstype
+include ../Makefile.mount
+include ../Makefile.mount.targ
diff --git a/usr/src/cmd/fs.d/lxproc/mount.c b/usr/src/cmd/fs.d/lxproc/mount.c
new file mode 100644
index 0000000000..5a000997bd
--- /dev/null
+++ b/usr/src/cmd/fs.d/lxproc/mount.c
@@ -0,0 +1,140 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libintl.h>
+#include <errno.h>
+#include <sys/fstyp.h>
+#include <sys/fsid.h>
+#include <sys/mntent.h>
+#include <sys/mnttab.h>
+#include <sys/mount.h>
+#include <sys/signal.h>
+#include <sys/stat.h>
+#include <fslib.h>
+
+#define RET_OK 0
+#define RET_ERR 33
+
+static void usage(void);
+
+static char optbuf[MAX_MNTOPT_STR] = { '\0', };
+static int optsize = 0;
+
+static char fstype[] = "lxproc";
+
+/*
+ * usage: mount [-Ormq] [-o options] special mountp
+ *
+ * This mount program is exec'ed by /usr/sbin/mount if '-F lxproc' is
+ * specified.
+ */
+int
+main(int argc, char *argv[])
+{
+ int c;
+ char *special; /* Entity being mounted */
+ char *mountp; /* Entity being mounted on */
+ char *savedoptbuf;
+ char *myname;
+ char typename[64];
+ int flags = 0;
+ int errflag = 0;
+ int qflg = 0;
+
+ myname = strrchr(argv[0], '/');
+ myname = myname ? myname+1 : argv[0];
+ (void) snprintf(typename, sizeof (typename), "%s %s", fstype, myname);
+ argv[0] = typename;
+
+ while ((c = getopt(argc, argv, "o:rmOq")) != EOF) {
+ switch (c) {
+ case '?':
+ errflag++;
+ break;
+
+ case 'o':
+ if (strlcpy(optbuf, optarg, sizeof (optbuf)) >=
+ sizeof (optbuf)) {
+ (void) fprintf(stderr,
+ gettext("%s: Invalid argument: %s\n"),
+ myname, optarg);
+ return (2);
+ }
+ optsize = strlen(optbuf);
+ break;
+ case 'O':
+ flags |= MS_OVERLAY;
+ break;
+ case 'r':
+ flags |= MS_RDONLY;
+ break;
+
+ case 'm':
+ flags |= MS_NOMNTTAB;
+ break;
+
+ case 'q':
+ qflg = 1;
+ break;
+
+ default:
+ usage();
+ }
+ }
+ if ((argc - optind != 2) || errflag) {
+ usage();
+ }
+ special = argv[argc - 2];
+ mountp = argv[argc - 1];
+
+ if ((savedoptbuf = strdup(optbuf)) == NULL) {
+ (void) fprintf(stderr, gettext("%s: out of memory\n"),
+ myname);
+ exit(2);
+ }
+ if (mount(special, mountp, flags | MS_OPTIONSTR, fstype, NULL, 0,
+ optbuf, MAX_MNTOPT_STR)) {
+ (void) fprintf(stderr, "mount: ");
+ perror(special);
+ exit(RET_ERR);
+ }
+ if (optsize && !qflg)
+ cmp_requested_to_actual_options(savedoptbuf, optbuf,
+ special, mountp);
+ return (0);
+}
+
+void
+usage(void)
+{
+ (void) fprintf(stderr,
+ "Usage: mount [-Ormq] [-o options] special mountpoint\n");
+ exit(RET_ERR);
+}
diff --git a/usr/src/cmd/fs.d/nfs/lib/smfcfg.c b/usr/src/cmd/fs.d/nfs/lib/smfcfg.c
index 78b34389a5..ced841d945 100644
--- a/usr/src/cmd/fs.d/nfs/lib/smfcfg.c
+++ b/usr/src/cmd/fs.d/nfs/lib/smfcfg.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
#include <stdlib.h>
@@ -342,8 +343,23 @@ fs_smf_get_prop(smf_fstype_t fstype, char *prop_name, char *cbuf,
} else {
ret = scf_error();
}
- if ((ret != 0) && scf_error() != SCF_ERROR_NONE)
- fprintf(stdout, gettext("%s\n"), scf_strerror(ret));
+ if ((ret != 0) && scf_error() != SCF_ERROR_NONE) {
+ /*
+ * This is a workaround for the NFS service manifests not
+ * containing the proper properties in local zones.
+ *
+ * When in a local zone and the property doesn't exist on an NFS
+ * service (most likely nfs/server or nfs/client), don't print
+ * the error. The caller will still see the correct error code,
+ * but a user creating a delegated dataset or mounting an NFS
+ * share won't see this spurious error.
+ */
+ if (getzoneid() == GLOBAL_ZONEID ||
+ scf_error() != SCF_ERROR_NOT_FOUND) {
+ fprintf(stdout, gettext("%s\n"), scf_strerror(ret));
+ }
+ }
+
out:
fs_smf_fini(phandle);
return (ret);
diff --git a/usr/src/cmd/fs.d/nfs/lib/smfcfg.h b/usr/src/cmd/fs.d/nfs/lib/smfcfg.h
index 46855ab8ed..7eae380827 100644
--- a/usr/src/cmd/fs.d/nfs/lib/smfcfg.h
+++ b/usr/src/cmd/fs.d/nfs/lib/smfcfg.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SMFCFG_H
@@ -42,6 +43,7 @@
#include <locale.h>
#include <errno.h>
#include <sys/types.h>
+#include <zone.h>
#ifdef __cplusplus
extern "C" {
diff --git a/usr/src/cmd/fs.d/nfs/mountd/mountd.c b/usr/src/cmd/fs.d/nfs/mountd/mountd.c
index dbf4c11ea1..04f8ff1def 100644
--- a/usr/src/cmd/fs.d/nfs/mountd/mountd.c
+++ b/usr/src/cmd/fs.d/nfs/mountd/mountd.c
@@ -20,6 +20,7 @@
*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -390,6 +391,13 @@ main(int argc, char *argv[])
exit(1);
}
+ /* Mountd cannot run in a non-global zone. */
+ if (getzoneid() != GLOBAL_ZONEID) {
+ (void) fprintf(stderr, "%s: can only run in the global zone\n",
+ argv[0]);
+ exit(1);
+ }
+
maxthreads = 0;
while ((c = getopt(argc, argv, "vrm:")) != EOF) {
diff --git a/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c b/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c
index 6c0e0bda5e..c34c39a13e 100644
--- a/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c
+++ b/usr/src/cmd/fs.d/nfs/nfsd/nfsd.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -176,6 +177,13 @@ main(int ac, char *av[])
exit(1);
}
+ /* Nfsd cannot run in a non-global zone. */
+ if (getzoneid() != GLOBAL_ZONEID) {
+ (void) fprintf(stderr, "%s: can only run in the global zone\n",
+ av[0]);
+ exit(1);
+ }
+
(void) enable_extended_FILE_stdio(-1, -1);
/*
diff --git a/usr/src/cmd/fs.d/nfs/svc/nfs-server b/usr/src/cmd/fs.d/nfs/svc/nfs-server
index b0c6d155a5..8542ce9b9f 100644
--- a/usr/src/cmd/fs.d/nfs/svc/nfs-server
+++ b/usr/src/cmd/fs.d/nfs/svc/nfs-server
@@ -50,13 +50,13 @@ configure_ipfilter()
#
# Nothing to do if:
+ # - service's policy is 'use_global'
# - ipfilter isn't online
# - global policy is 'custom'
- # - service's policy is 'use_global'
#
+ [ "`get_policy $SMF_FMRI`" = "use_global" ] && return 0
service_check_state $IPF_FMRI $SMF_ONLINE || return 0
[ "`get_global_def_policy`" = "custom" ] && return 0
- [ "`get_policy $SMF_FMRI`" = "use_global" ] && return 0
svcadm restart $IPF_FMRI
}
diff --git a/usr/src/cmd/hal/Makefile.hal b/usr/src/cmd/hal/Makefile.hal
index a6bd4ac3f9..fc3a54f617 100644
--- a/usr/src/cmd/hal/Makefile.hal
+++ b/usr/src/cmd/hal/Makefile.hal
@@ -53,10 +53,13 @@ HAL_CONFIG_CPPFLAGS = -DPACKAGE_DATA_DIR=\"/usr/lib\" \
-DHAL_USER=\"$(HAL_USER)\" \
-DHAL_GROUP=\"$(HAL_GROUP)\"
-HAL_DBUS_CPPFLAGS = -DDBUS_API_SUBJECT_TO_CHANGE -DDBUS_SYSTEMD_DIR=\"/etc/dbus-1/system.d\" \
- -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
+HAL_DBUS_CPPFLAGS = -DDBUS_API_SUBJECT_TO_CHANGE \
+ -DDBUS_SYSTEMD_DIR=\"/etc/dbus-1/system.d\" \
+ -I$(ADJUNCT_PROTO)/usr/include/dbus-1.0 \
+ -I$(ADJUNCT_PROTO)/usr/lib/dbus-1.0/include
-HAL_GLIB_CPPFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+HAL_GLIB_CPPFLAGS = -I$(ADJUNCT_PROTO)/usr/include/glib-2.0 \
+ -I$(ADJUNCT_PROTO)/usr/lib/glib-2.0/include
HAL_GETTEXT_PACKAGE = $(TEXT_DOMAIN)
diff --git a/usr/src/cmd/halt/halt.c b/usr/src/cmd/halt/halt.c
index 528823531e..9a4e113936 100644
--- a/usr/src/cmd/halt/halt.c
+++ b/usr/src/cmd/halt/halt.c
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -1228,6 +1229,17 @@ do_archives_update(int do_fast_reboot)
pid_t pid;
char *cmd_argv[MAXARGS];
+#if defined(__i386)
+ {
+ /*
+ * bootadm will complain and exit if not a grub root, so
+ * just skip running it.
+ */
+ struct stat sb;
+ if (stat("/boot/grub/stage2", &sb) == -1)
+ return;
+ }
+#endif /* __i386 */
cmd_argv[i++] = "/sbin/bootadm";
cmd_argv[i++] = "-ea";
@@ -1294,7 +1306,7 @@ main(int argc, char *argv[])
optstring = "dlnqfp";
usage = gettext("usage: %s [ -dlnq(p|f) ] [ boot args ]\n");
#endif
- cmd = A_SHUTDOWN;
+ cmd = A_REBOOT;
fcn = AD_BOOT;
} else {
(void) fprintf(stderr,
@@ -1503,7 +1515,8 @@ main(int argc, char *argv[])
* check_zone_haltedness later on.
*/
if (zoneid == GLOBAL_ZONEID && cmd != A_DUMP) {
- need_check_zones = halt_zones();
+ if (!qflag)
+ need_check_zones = halt_zones();
}
#if defined(__i386)
@@ -1603,7 +1616,7 @@ main(int argc, char *argv[])
(void) signal(SIGINT, SIG_IGN);
- if (!qflag && !nosync) {
+ if (!nosync) {
struct utmpx wtmpx;
bzero(&wtmpx, sizeof (struct utmpx));
diff --git a/usr/src/cmd/hwdata/pci.ids b/usr/src/cmd/hwdata/pci.ids
index f33d90befa..76584f8932 100644
--- a/usr/src/cmd/hwdata/pci.ids
+++ b/usr/src/cmd/hwdata/pci.ids
@@ -1,8 +1,8 @@
#
# List of PCI ID's
#
-# Version: 2012.04.09
-# Date: 2012-04-09 03:15:02
+# Version: 2012.10.24
+# Date: 2012-10-24 03:15:01
#
# Maintained by Martin Mares <mj@ucw.cz> and other volunteers from the
# PCI ID Project at http://pci-ids.ucw.cz/.
@@ -88,7 +88,6 @@
04b3 IBM Corp.
4001 Remote System Administration device [RSA2]
050d Belkin
-058f Alcor Micro Corporation
05a9 OmniVision
8519 OV519 series
05e3 CyberDoor
@@ -122,8 +121,8 @@
08e6 Gemalto NV
08ff AuthenTec
afe4 [Anchor] AF-S2 FingerLoc Sensor Module
-0925 First International Computer, Inc.
- 1234 VA-502 Mainboard
+0925 VIA Technologies, Inc. (Wrong ID)
+ 1234 VT82C686/A/B USB Controller
093a PixArt Imaging Inc.
010e Innovage Mini Digital Camera
010f SDC-300 Webcam
@@ -202,6 +201,7 @@
7020 USB Controller
a0ec Fibre Channel Host Controller
a0f0 Advanced System Management Controller
+ 0e11 b0f3 ProLiant DL360
a0f3 Triflex PCI to ISA Bridge
a0f7 PCI Hotplug Controller
8086 002a PCI Hotplug Controller A
@@ -325,6 +325,8 @@
4c53 1080 CT8 mainboard
4c53 1300 P017 mezzanine (32-bit PMC)
4c53 1310 P017 mezzanine (64-bit PMC)
+ 002f MegaRAID SAS 2208 IOV [Thunderbolt]
+ 1028 1f3e SPERC 8
0030 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI
0e11 00da ProLiant ML 350
1028 0123 LSI Logic 1020/1030
@@ -375,6 +377,11 @@
0059 MegaRAID SAS 8208ELP/8208ELP
005a SAS1066E PCI-Express Fusion-MPT SAS
005b MegaRAID SAS 2208 [Thunderbolt]
+ 1000 9265 MegaRAID SAS 9265-8i
+ 1000 9266 MegaRAID SAS 9266-8i
+ 1000 9268 MegaRAID SAS 9265CV-8i / 9270CV-8i
+ 1014 040b ServeRAID M5110 SAS/SATA Controller
+ 1014 0412 ServeRAID M5110e SAS/SATA Controller
1028 1f2d PERC H810 Adapter
1028 1f30 PERC H710 Embedded
1028 1f31 PERC H710P Adapter
@@ -383,10 +390,11 @@
1028 1f35 PERC H710 Adapter
1028 1f37 PERC H710 Mini (for blades)
1028 1f38 PERC H710 Mini (for monolithics)
- 8086 3513 RMS25PB080 RAID Controller
+ 8086 3513 RMS25CB080 RAID Controller
005c SAS1064A PCI-X Fusion-MPT SAS
005d MegaRAID SAS-3 3108 [Invader]
005e SAS1066 PCI-X Fusion-MPT SAS
+ 005f MegaRAID SAS-3 3008 [Fury]
0060 MegaRAID SAS 1078
1000 1006 MegaRAID SAS 8888ELP
1000 100a MegaRAID SAS 8708ELP
@@ -436,6 +444,7 @@
0073 MegaRAID SAS 2008 [Falcon]
1000 9240 MegaRAID SAS 9240-8i
1000 9241 MegaRAID SAS 9240-4i
+ 1000 92a0 MegaRAID SAS 9220-8i
1014 03b1 ServeRAID M1015 SAS/SATA Controller
1028 1f4e PERC H310 Adapter
1028 1f4f PERC H310 Integrated
@@ -608,7 +617,9 @@
# nee ATI Technologies Inc.
1002 Advanced Micro Devices [AMD] nee ATI
1314 Wrestler HDMI Audio [Radeon HD 6250/6310]
+ 174b 1001 Sapphire PURE Fusion Mini
1714 BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series]
+ 103c 168b ProBook 4535s
3150 M24 1P [Radeon Mobility X600]
103c 0934 nx8220
3151 M24 [FireMV 2400]
@@ -788,6 +799,8 @@
1179 ff50 Satellite P305D-S8995E
1458 4385 GA-MA770-DS3rev2.0 Motherboard
1462 7368 K9AG Neo2
+ 15d9 a811 H8DGU
+ 174b 1001 Sapphire PURE Fusion Mini
17f2 5000 KI690-AM2 Motherboard
4386 SB600 USB Controller (EHCI)
103c 280a DC5750 Microtower
@@ -840,6 +853,7 @@
103c 1611 Pavilion DM1Z-3000
1043 82ef M3A78-EH Motherboard
1043 8443 M5A88-V EVO
+ 174b 1001 Sapphire PURE Fusion Mini
4392 SB7x0/SB8x0/SB9x0 SATA Controller [Non-RAID5 mode]
4393 SB7x0/SB8x0/SB9x0 SATA Controller [RAID5 mode]
4394 SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
@@ -848,21 +862,28 @@
103c 1611 Pavilion DM1Z-3000
1043 82ef M3A78-EH Motherboard
1043 8443 M5A88-V EVO
+ 15d9 a811 H8DGU
+ 174b 1001 Sapphire PURE Fusion Mini
4397 SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
103c 1611 Pavilion DM1Z-3000
1043 82ef M3A78-EH Motherboard
1043 8443 M5A88-V EVO
+ 15d9 a811 H8DGU
+ 174b 1001 Sapphire PURE Fusion Mini
4398 SB7x0 USB OHCI1 Controller
1043 82ef M3A78-EH Motherboard
+ 15d9 a811 H8DGU
4399 SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
1043 82ef M3A78-EH Motherboard
1043 8443 M5A88-V EVO
+ 174b 1001 Sapphire PURE Fusion Mini
439c SB7x0/SB8x0/SB9x0 IDE Controller
1043 82ef M3A78-EH Motherboard
439d SB7x0/SB8x0/SB9x0 LPC host controller
103c 1611 Pavilion DM1Z-3000
1043 82ef M3A78-EH Motherboard
1043 8443 M5A88-V EVO
+ 174b 1001 Sapphire PURE Fusion Mini
43a0 SB700/SB800/SB900 PCI to PCI bridge (PCIE port 0)
43a1 SB700/SB800/SB900 PCI to PCI bridge (PCIE port 1)
43a2 SB900 PCI to PCI bridge (PCIE port 2)
@@ -1394,12 +1415,14 @@
5a10 RD890 Northbridge only dual slot (2x16) PCI-e GFX Hydra part
5a11 RD890 Northbridge only single slot PCI-e GFX Hydra part
5a12 RD890 Northbridge only dual slot (2x8) PCI-e GFX Hydra part
+ 15d9 a811 H8DGU
5a13 RD890 PCI to PCI bridge (external gfx0 port A)
5a14 RD890 PCI to PCI bridge (external gfx0 port B)
5a15 RD890 PCI to PCI bridge (PCI express gpp port A)
5a16 RD890 PCI to PCI bridge (PCI express gpp port B)
5a17 RD890 PCI to PCI bridge (PCI express gpp port C)
5a18 RD890 PCI to PCI bridge (PCI express gpp port D)
+ 15d9 a811 H8DGU
5a19 RD890 PCI to PCI bridge (PCI express gpp port E)
5a1a RD890 PCI to PCI bridge (PCI express gpp port F)
5a1b RD890 PCI to PCI bridge (PCI express gpp port G)
@@ -1407,6 +1430,8 @@
5a1d RD890 PCI to PCI bridge (external gfx1 port A)
5a1e RD890 PCI to PCI bridge (external gfx1 port B)
5a1f RD890 PCI to PCI bridge (NB-SB link)
+ 15d9 a811 H8DGU
+ 5a20 RD890S PCI Express bridge for GPP2 port 1
5a23 RD990 I/O Memory Management Unit (IOMMU)
5a33 Radeon Xpress 200 Host Bridge
5a34 RS480 PCI-X Root Port
@@ -1488,26 +1513,35 @@
5e6d RV410 [Radeon X700 (PCIE)] (Secondary)
148c 2117 PowerColor Bravo X700
5f57 R423 [Radeon X800XT (PCIE)]
+ 6600 Mars [Radeon HD 8600/8700M Series]
+ 6601 Mars [Radeon HD 8500/8700M Series]
+ 6606 Mars [Radeon HD 8790M]
+ 6610 Oland [Radeon HD 8600 Series]
+ 6611 Oland [Radeon HD 8500 Series]
+ 6704 Cayman PRO GL [FirePro V7900]
6707 Cayman LE GL [FirePro V5900]
6718 Cayman XT [Radeon HD 6970]
6719 Cayman PRO [Radeon HD 6950]
671d Antilles [AMD Radeon HD 6990]
671f Cayman [Radeon HD 6900 Series]
6720 Blackcomb [Radeon HD 6900M series]
- 6738 Barts XT [ATI Radeon HD 6800 Series]
- 6739 Barts PRO [ATI Radeon HD 6800 Series]
+ 6738 Barts XT [Radeon HD 6800 Series]
+ 6739 Barts PRO [Radeon HD 6800 Series]
+ 1043 03b4 EAH6850 [Radeon HD 6850]
673e Barts LE [AMD Radeon HD 6700 Series]
6740 Whistler XT [AMD Radeon HD 6700M Series]
6741 Whistler [AMD Radeon HD 6600M Series]
+ 106b 00e2 MacBookPro8,2 [Core i7, 15", Late 2011]
6742 Whistler LE [AMD Radeon HD 6625M Graphics]
6743 Whistler [Radeon E6760]
6749 Turks [FirePro V4900]
+ 674a Turks [AMD FirePro V3900]
6750 Turks [AMD Radeon HD 6570]
6751 Turks [Radeon HD 7600A Series]
6758 Turks [Radeon HD 6670]
6759 Turks [Radeon HD 6570]
675d Turks [Radeon HD 7500 Series]
- 6760 Seymour [Radeon HD 6400M Series]
+ 6760 Caicos [Radeon HD 6400M/7400M Series]
1028 04cc Vostro 3350
6761 Seymour LP [Radeon HD 6430M]
6763 Seymour [Radeon E6460]
@@ -1520,21 +1554,34 @@
6798 Tahiti XT [Radeon HD 7970]
6799 New Zealand [Radeon HD 7990]
679a Tahiti PRO [Radeon HD 7950]
- 6800 WIMBLEDON XT [Radeon HD 7970M]
- 6818 PITCAIRN [Radeon HD 7800]
- 6819 PITCAIRN PRO [Radeon HD 7800 Series]
+ 679e Tahiti LE [Radeon HD 7800 Series]
+ 6800 Wimbledon XT [Radeon HD 7970M]
+ 6818 Pitcairn [Radeon HD 7800]
+ 6819 Pitcairn PRO [Radeon HD 7800]
+ 6820 Radeon HD 8800M Series
+ 6821 Radeon HD 8800M Series
+ 6823 Radeon HD 8800M Series
+ 6825 Cape Verde [Radeon HD 7800M Series]
+ 682b Radeon HD 8800M Series
+ 682f Cape Verde [Radeon HD 7700M Series]
+ 683b Cape Verde [Radeon HD 7700 Series]
+ 683d Cape Verde [Radeon HD 7700 Series]
683f Cape Verde PRO [Radeon HD 7700 Series]
6840 Thames XT/GL [Radeon HD 7600M Series]
6841 Thames [Radeon 7500M/7600M Series]
+ 6842 Thames LE [Radeon HD 7000M Series]
6843 Thames [Radeon HD 7670M]
6850 Lombok GL AIO [Radeon HD 7570]
6858 Lombok [Radeon HD 7400 series]
+ 6888 Cypress [FirePro 3D V8800]
6889 Cypress [FirePro V7800]
+ 688a Cypress XT [FirePro 3D V9800]
688c Cypress [AMD FireStream 9370]
688d Cypress [AMD FireStream 9350]
6898 Cypress XT [Radeon HD 5870]
1462 8032 R5870 PM2D1G
- 6899 Cypress [Radeon HD 5800 Series]
+ 6899 Cypress PRO [Radeon HD 5800 Series]
+ 1043 0330 EAH5850 [Radeon HD5850]
689b Cypress [Radeon HD 6800 Series]
689c Hemlock [Radeon HD 5900 Series]
689e Cypress LE [Radeon HD 5800 Series]
@@ -1544,6 +1591,7 @@
68a8 Broadway [ATI Mobility Radeon HD 6800 Series]
68a9 Juniper XT [FirePro 3D V5800]
68b8 Juniper [Radeon HD 5700 Series]
+ 106b 00cf MacPro5,1 [Mac Pro 2.8GHz DDR3]
68b9 Juniper [Radeon HD 5600/5700]
68ba Juniper XT [AMD Radeon HD 6000 Series]
68be Juniper [Radeon HD 5700 Series]
@@ -1566,7 +1614,7 @@
68e5 Robson LE [AMD Radeon HD 6300M Series]
68f1 Cedar [FirePro 2460]
68f2 Cedar [FirePro 2270]
- 68f9 Cedar PRO [Radeon HD 5450]
+ 68f9 Cedar PRO [Radeon HD 5450/6350]
1028 010e XPS 8300
68fa EG Cedar [Radeon HD 7300 Series]
700f PCI Bridge [IGP 320M]
@@ -1715,14 +1763,16 @@
17f2 5000 KI690-AM2 Motherboard
791f RS690M [Radeon X1200 Series]
1179 ff50 Satellite P305D-S8995E
- 7930 Radeon Xpress 7930 Host Bridge
- 7932 RS7932 PCI Bridge
- 7933 RS7933 PCI Bridge
- 7936 RS7936 PCI Bridge
- 793b RS600 audio device [Radeon Xpress 12xx Series]
- 793f RS600 [Radeon Xpress 1200 Series]
- 7941 RS600 [Radeon Xpress 1200 Series]
- 7942 Radeon Xpress 1250
+ 7930 RS600 Host Bridge
+ 7932 RS600 PCI to PCI Bridge (Internal gfx)
+ 7933 RS600 PCI to PCI Bridge (PCI Express Graphics Port 0)
+ 7935 RS600 PCI to PCI Bridge (PCI Express Port 1)
+ 7936 RS600 PCI to PCI Bridge (PCI Express Port 2)
+ 7937 RS690 PCI to PCI Bridge (PCI Express Port 3)
+ 793b RS600 HDMI Audio [Radeon Xpress 1250]
+ 793f RS600 [Radeon Xpress 1250]
+ 7941 RS600 [Radeon Xpress 1250]
+ 7942 RS600 [Radeon Xpress 1250]
796e Radeon 2100
7c37 RV350 AQ [Radeon 9600 SE]
9400 R600 [Radeon HD 2900 Series]
@@ -1822,6 +1872,7 @@
95c4 RV620 [Mobility Radeon HD 3400 Series]
1002 95c4 Mobility Radeon HD 3400
95c5 RV620 LE [Radeon HD 3450]
+ 1028 0342 OptiPlex 980
95c6 RV620 LE AGP [Radeon HD 3450]
95c7 RV620 CE [Radeon HD 3430]
95c9 RV620 PCI [Radeon HD 3450]
@@ -1840,6 +1891,7 @@
9616 RS780L [Radeon HD 3000]
9640 BeaverCreek [Radeon HD 6550D]
9641 BeaverCreek [Mobility Radeon HD 6620G]
+ 9647 BeaverCreek [Radeon HD 6520G]
964a BeaverCreek [Radeon HD 6530D]
970f RS880 HDMI Audio [Radeon HD 4200 Series]
1043 83a2 M4A785TD Motherboard
@@ -1853,9 +1905,13 @@
1043 843e M5A88-V EVO
# Radeon HD 6250 too?
9802 Wrestler [Radeon HD 6310]
+ 174b 1001 Sapphire PURE Fusion Mini
9804 Wrestler [Radeon HD 6250]
9806 Wrestler [Radeon HD 6320]
9807 Wrestler [Radeon HD 6290]
+# AMD A10-5800K CPU
+ 9901 Trinity [Radeon HD 7660D]
+ 9990 Trinity [Radeon HD 7520G]
aa00 R600 Audio Device [Radeon HD 2900 Series]
aa08 RV630 audio device [Radeon HD 2600 Series]
aa10 RV610 HDMI Audio [Radeon HD 2350/2400 Series]
@@ -1879,8 +1935,7 @@
1028 aa68 XPS 8300
aa80 Cayman/Antilles HDMI Audio [Radeon HD 6900 Series]
aa88 Barts HDMI Audio [Radeon HD 6800 Series]
-# 6500, 6600 and mobile 6700 series
- aa90 Turks HDMI Audio [Radeon HD 6000 Series]
+ aa90 Turks/Whistler HDMI Audio [Radeon HD 6000 Series]
aa98 Caicos HDMI Audio [Radeon HD 6400 Series]
174b aa98 Sapphire HD 6450 1GB DDR3
aaa0 Tahiti XT HDMI Audio [Radeon HD 7970 Series]
@@ -1920,8 +1975,11 @@
1004 0306 QSound ThunderBird PCI Audio Support Registers
122d 1208 DSP368 Audio Support Registers
1483 5022 XWave Thunder 3D Audio Support Registers
- 0307 Thunderbird
- 0308 Thunderbird
+ 0307 SAA7785 ThunderBird PCI Audio
+ 1004 0703 Philips Rhythmic Edge PSC703
+ 1004 0705 Philips Seismic Edge PSC705
+ 1004 0706 Philips Acoustic Edge PSC706
+ 0308 SAA7785 ThunderBird PCI Audio Gameport
0702 VAS96011 [Golden Gate II]
0703 Tollgate
1005 Avance Logic Inc. [ALI]
@@ -2387,7 +2445,9 @@
1418 Family 15h (Models 10h-1fh) Processor Root Port
1419 Family 15h (Models 10h-1fh) I/O Memory Management Unit
1510 Family 14h Processor Root Complex
+ 174b 1001 Sapphire PURE Fusion Mini
1512 Family 14h Processor Root Port
+ 174b 1001 Sapphire PURE Fusion Mini
1513 Family 14h Processor Root Port
1514 Family 14h Processor Root Port
1515 Family 14h Processor Root Port
@@ -2456,6 +2516,10 @@
2097 CS5536 [Geode companion] UOC
209a CS5536 [Geode companion] IDE
3000 ELanSC520 Microcontroller
+ 43a0 Hudson PCI to PCI bridge (PCIE port 0)
+ 43a1 Hudson PCI to PCI bridge (PCIE port 1)
+ 43a2 Hudson PCI to PCI bridge (PCIE port 2)
+ 43a3 Hudson PCI to PCI bridge (PCIE port 3)
7006 AMD-751 [Irongate] System Controller
7007 AMD-751 [Irongate] AGP Bridge
700a AMD-IGR4 AGP Host to PCI Bridge
@@ -2869,6 +2933,7 @@
1028 028d PowerEdge T410 MGA G200eW WPCM450
1028 029c PowerEdge M710 MGA G200eW WPCM450
1028 02a4 PowerEdge T310 MGA G200eW WPCM450
+ 15d9 a811 H8DGU
0533 MGA G200EH
103c 3381 iLO4
0534 G200eR2
@@ -2898,11 +2963,10 @@
102b ff05 MGA-G100 Productiva AGP Multi-Monitor
110a 001e MGA-G100 AGP
2007 MGA Mistral
- 2527 MGA G550 AGP
+ 2527 Millennium G550
102b 0f83 Millennium G550
102b 0f84 Millennium G550 Dual Head DDR 32Mb
102b 1e41 Millennium G550
-# Clearly the device name should not say AGP anymore...
102b 2300 Millennium G550 LP PCIE
2537 Millenium P650/P750
102b 1820 Millennium P750 64MB
@@ -3113,6 +3177,7 @@
013a Dual Tuner/MPEG Encoder
0194 uPD720200 USB 3.0 Host Controller
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
1043 8413 P8P67 Deluxe Motherboard
1b96 0001 USB 3.0 PCIe Card
01e7 uPD72873 [Firewarden] IEEE1394a OHCI 1.1 Link/2-port PHY Controller
@@ -3125,12 +3190,12 @@
1038 AMP, Inc
1039 Silicon Integrated Systems [SiS]
0001 AGP Port (virtual PCI-to-PCI bridge)
- 0002 SG86C202
+ 0002 AGP Port (virtual PCI-to-PCI bridge)
0003 AGP Port (virtual PCI-to-PCI bridge)
0004 PCI-to-PCI bridge
0006 85C501/2/3
0008 SiS85C503/5513 (LPC Bridge)
- 0009 ACPI
+ 0009 5595 Power Management Controller
000a PCI-to-PCI bridge
0016 SiS961/2/3 SMBus controller
0018 SiS85C503/5513 (LPC Bridge)
@@ -3368,6 +3433,8 @@
1361 BCM4312 802.11a/b/g WLAN Controller
1371 Broadcom Corporation BCM4312 802.11a/b/g (rev 02)
1717 Intel 82571EB dual 1 Gb Ethernet controller
+ 179b EliteBook 8470p Notebook
+ 179d EliteBook 8470p Notebook
2910 E2910A PCIBus Exerciser
2925 E2925A 32 Bit, 33 MHzPCI Exerciser & Analyzer
3080 Pavilion ze2028ea
@@ -3434,6 +3501,7 @@
4037 PCIe Local Bus Adapter
403b PCIe Root Port
60e8 NetRAID-2M : ZX1/M (OEM AMI MegaRAID 493)
+ 780d Hudson Azalia Controller (rev 01) - Soundcard
103e Solliday Engineering
103f Synopsys/Logic Modeling Group
1040 Accelgraphics Inc.
@@ -3473,6 +3541,8 @@
82e8 M3N72-D
8383 P7P55D Series Motherboard
83a4 Motherboard M2N68-AM SE2
+# Onboard audio for M4A89 series motherboards.
+ 8410 SBx00 [Azalia]
843e M5A88-V EVO
# wrong vendor ID (should have been AMD)
9602 RS880 PCI to PCI bridge (int gfx)
@@ -3540,6 +3610,7 @@
c825 82C825 [Firebridge 2]
c832 82C832
c861 82C861
+ c881 82C881 [FireLink] 1394 OHCI Link Controller
c895 82C895
c935 EV1935 ECTIVA MachOne PCIAudio
d568 82C825 [Firebridge 2]
@@ -3655,7 +3726,7 @@
8024 TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link)
107d 6620 Winfast DV2000 FireWire Controller
1443 8024 FireBoard Blue
- 1458 1000 GA-EP45-DS5 Motherboard
+ 1458 1000 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
8025 TSB82AA2 IEEE-1394b Link Layer Controller
1043 813c P5P series mainboard
1443 8025 FireBoard800
@@ -3741,6 +3812,7 @@
823f XIO2213A/B/XIO2221 IEEE-1394b OHCI Controller [Cheetah Express]
1546 803c FWB-PCIE1X11B
8240 XIO2001 PCI Express-to-PCI Bridge
+ 8241 TUSB73x0 SuperSpeed USB 3.0 xHCI Host Controller
8400 ACX 100 22Mbps Wireless Interface
1186 3b00 DWL-650+ PC Card cardbus 22Mbs Wireless Adapter [AirPlus]
1186 3b01 DWL-520+ 22Mbps PCI Wireless Adapter
@@ -4393,9 +4465,7 @@
107c LG Electronics [Lucky Goldstar Co. Ltd]
107d LeadTek Research Inc.
0000 P86C850
- 204d [GeForce 7800 GTX] Winfast PX7800 GTX TDH
2134 WinFast 3D S320 II
- 2971 [GeForce FX 5900] WinFast A350 TDH MyViVo
6609 Winfast TV 2000 XP RM
6654 Conexant CX23883 [WinFast DTV1800 H]
6f22 WinFast PxTV1200
@@ -4467,7 +4537,6 @@
1001 Happy Meal 10/100 Ethernet [hme]
1100 RIO EBUS
108e 1100 RIO EBUS on Blade 100 motherboard
-# Correction
1101 RIO 10/100 Ethernet [eri]
108e 1101 RIO GEM on Blade 100 motherboard
1102 RIO 1394
@@ -4933,6 +5002,7 @@
8547 PEX 8547 48-lane, 3-port PCI Express Switch
8548 PEX 8548 48-lane, 9-port PCI Express Switch
8604 PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch
+ 8605 PEX 8605 PCI Express 4-port Gen2 Switch
8606 PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch
8608 PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch
8609 PEX 8609 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch with DMA
@@ -4960,7 +5030,7 @@
87b0 PEX 8732 32-lane, 8-Port PCI Express Gen 3 (8.0 GT/s) Switch
9016 PLX 9016 8-port serial controller
9030 PCI9030 32-bit 33MHz PCI <-> IOBus Bridge
- 10b5 2695 Hilscher CIF50-PB Profibus Master Board
+ 10b5 2695 Hilscher CIF50-PB/DPS Profibus
10b5 2862 Alpermann+Velte PCL PCI LV (3V/5V): Timecode Reader Board
10b5 2906 Alpermann+Velte PCI TS (3V/5V): Time Synchronisation Board
10b5 2940 Alpermann+Velte PCL PCI D (3V/5V): Timecode Reader Board
@@ -5093,6 +5163,8 @@
a100 Blackmagic Design DeckLink
bb04 B&B 3PCIOSD1A Isolated PCI Serial
c001 CronyxOmega-PCI (8-port RS232)
+ d44d PCI9030 32-bit 33MHz PCI <-> IOBus Bridge
+ 10b5 17f6 entVoice E1 Card
10b6 Madge Networks
0001 Smart 16/4 PCI Ringnode
0002 Smart 16/4 PCI Ringnode Mk2
@@ -5270,7 +5342,8 @@
1001 FDC 37C922
a011 83C170QF
b106 SMC34C90
-10b9 ALi Corporation
+# Split off ALi Corporation in 2003
+10b9 ULi Electronics Inc.
0101 CMI8338/C3DX PCI Audio Device
0111 C-Media CMI8738/C3DX Audio Device (OEM)
10b9 0111 C-Media CMI8738/C3DX Audio Device (OEM)
@@ -5487,6 +5560,7 @@
1623 PCEA4 PCI-Express Dual Port ESCON Adapter
2001 mb86605
200c MB86613L IEEE1394 OHCI 1.0 Controller
+ 2010 MB86613S IEEE1394 OHCI 1.1 Controller
2019 MB86295S [CORAL P]
201e MB86296S [CORAL PA]
202b MB86297A [Carmine Graphics Controller]
@@ -5522,7 +5596,6 @@
10de NVIDIA Corporation
0008 NV1 [EDGE 3D]
0009 NV1 [EDGE 3D]
- 0010 NV2 [Mutara V08]
0020 NV4 [RIVA TNT]
1043 0200 V3400 TNT
1048 0c18 Erazor II SGRAM
@@ -5640,6 +5713,7 @@
10f1 2865 Tomcat K8E (S2865)
1458 0c11 GA-K8N Ultra-9 Mainboard
1462 7100 MSI K8N Diamond
+ 1462 7125 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 3402 NF4 AM2L Mainboard
0051 CK804 ISA Bridge
@@ -5650,6 +5724,7 @@
10f1 2865 Tomcat K8E (S2865)
1458 0c11 GA-K8N Ultra-9 Mainboard
1462 7100 MSI K8N Diamond
+ 1462 7125 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 3402 NF4 AM2L Mainboard
0053 CK804 IDE
@@ -5657,6 +5732,7 @@
10f1 2865 Tomcat K8E (S2865)
1458 5002 GA-K8N Ultra-9 Mainboard
1462 7100 MSI K8N Diamond
+ 1462 7125 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 3402 NF4 AM2L Mainboard
0054 CK804 Serial ATA Controller
@@ -5665,6 +5741,7 @@
10f1 2865 Tomcat K8E (S2865)
1458 b003 GA-K8N Ultra-9 Mainboard
1462 7100 MSI K8N Diamond
+ 1462 7125 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 5401 NF4 AM2L Mainboard
0055 CK804 Serial ATA Controller
@@ -5672,6 +5749,7 @@
1043 815a K8N4-E or A8N-E Mainboard
10f1 2865 Tomcat K8E (S2865)
1458 b003 GA-K8N Ultra-9 Mainboard
+ 1462 7125 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 5401 NF4 AM2L Mainboard
0056 CK804 Ethernet Controller
@@ -5681,12 +5759,14 @@
10f1 2865 Tomcat K8E (S2865)
1458 e000 GA-K8N Ultra-9 Mainboard
1462 7100 MSI K8N Diamond
+ 1462 7125 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 2501 NF4 AM2L Mainboard
0058 CK804 AC'97 Modem
0059 CK804 AC'97 Audio Controller
1043 812a K8N4-E or A8N-E Mainboard
10f1 2865 Tomcat K8E (S2865)
+ 1462 7585 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 8211 NF4 AM2L Mainboard
005a CK804 USB Controller
@@ -5695,6 +5775,7 @@
10f1 2865 Tomcat K8E (S2865)
1458 5004 GA-K8N Ultra-9 Mainboard
1462 7100 MSI K8N Diamond
+ 1462 7125 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 3402 NF4 AM2L Mainboard
005b CK804 USB Controller
@@ -5703,6 +5784,7 @@
10f1 2865 Tomcat K8E (S2865)
1458 5004 GA-K8N Ultra-9 Mainboard
1462 7100 MSI K8N Diamond
+ 1462 7125 K8N Neo4-F mainboard
147b 1c1a KN8-Ultra Mainboard
1565 3402 NF4 AM2L Mainboard
005c CK804 PCI Bridge
@@ -5714,7 +5796,8 @@
10f1 2865 Tomcat K8E (S2865)
10f1 2891 Thunder K8SRE Mainboard
1458 5000 GA-K8N Ultra-9 Mainboard
- 1462 7100 MSI K8N Diamond
+ 1462 7100 K8N Diamond Mainboard
+ 1462 7125 K8N Neo4-F Mainboard
147b 1c1a KN8-Ultra Mainboard
1565 3402 NF4 AM2L Mainboard
005f CK804 Memory Controller
@@ -6114,6 +6197,7 @@
0259 NV25GL [Quadro4 750 XGL]
025b NV25GL [Quadro4 700 XGL]
0260 MCP51 LPC Bridge
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81bc A8N-VM CSM Mainboard
1458 5001 GA-M55plus-S3G
@@ -6123,25 +6207,30 @@
0262 MCP51 LPC Bridge
0263 MCP51 LPC Bridge
0264 MCP51 SMBus
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81bc A8N-VM CSM Mainboard
105b 0cad Winfast 6100K8MB
1462 7207 K8NGM2 series
0265 MCP51 IDE
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81bc A8N-VM CSM Mainboard
1462 7207 K8NGM2 series
# Foxconn has used a wrong vendor ID for this one
f05b 0cad Winfast 6100K8MB
0266 MCP51 Serial ATA Controller
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81bc A8N-VM CSM Mainboard
1462 7207 K8NGM2 series
0267 MCP51 Serial ATA Controller
+ 103c 2a34 Pavilion a1677c
1043 81bc A8N-VM CSM Mainboard
1462 7207 K8NGM2 series
0268 MCP51 Ethernet Controller
0269 MCP51 Ethernet Controller
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 8141 A8N-VM CSM Mainboard
1462 7207 K8NGM2 series
@@ -6149,16 +6238,19 @@
026b MCP51 AC97 Audio Controller
105b 0cad Winfast 6100K8MB
026c MCP51 High Definition Audio
+ 103c 2a34 Pavilion a1677c
103c 30b5 Presario V3242AU
103c 30b7 Presario V6133CL
10de cb84 ASUSTeK Computer Inc. A8N-VM CSM Mainboard
1462 7207 K8NGM2 series
026d MCP51 USB Controller
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81bc A8N-VM CSM Mainboard
105b 0cad Winfast 6100K8MB
1462 7207 K8NGM2 series
026e MCP51 USB Controller
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81bc A8N-VM CSM Mainboard
105b 0cad Winfast 6100K8MB
@@ -6166,6 +6258,7 @@
026f MCP51 PCI Bridge
103c 30b7 Presario V6133CL
0270 MCP51 Host Bridge
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81bc A8N-VM CSM Mainboard
105b 0cad Winfast 6100K8MB
@@ -6175,13 +6268,16 @@
103c 30b5 Presario V3242AU
103c 30b7 Presario V6133CL
0272 MCP51 Memory Controller 0
+ 103c 2a34 Pavilion a1677c
105b 0cad Winfast 6100K8MB
027e C51 Memory Controller 2
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81cd A8N-VM CSM Mainboard
1458 5000 GA-M55plus-S3G
1462 7207 K8NGM2 series
027f C51 Memory Controller 3
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81cd A8N-VM CSM Mainboard
1458 5000 GA-M55plus-S3G
@@ -6226,6 +6322,7 @@
02e4 G71 [GeForce 7950 GT]
1682 2271 PV-T71A-YDF7 (512MB)
02f0 C51 Host Bridge
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81cd A8N-VM CSM Mainboard
1462 7207 K8NGM2 series
@@ -6238,6 +6335,7 @@
02f6 C51 Host Bridge
02f7 C51 Host Bridge
02f8 C51 Memory Controller 5
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81cd A8N-VM CSM Mainboard
1458 5000 GA-M55plus-S3G
@@ -6248,6 +6346,7 @@
1458 5000 GA-M55plus-S3G
1462 7207 K8NGM2 series
02fa C51 Memory Controller 0
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81cd A8N-VM CSM Mainboard
1458 5000 GA-M55plus-S3G
@@ -6258,11 +6357,13 @@
02fd C51 PCI Express Bridge
103c 30b7 Presario V6133CL
02fe C51 Memory Controller 1
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81cd A8N-VM CSM Mainboard
1458 5000 GA-M55plus-S3G
1462 7207 K8NGM2 series
02ff C51 Host Bridge
+ 103c 2a34 Pavilion a1677c
103c 30b7 Presario V6133CL
1043 81cd A8N-VM CSM Mainboard
1458 5000 GA-M55plus-S3G
@@ -6590,7 +6691,6 @@
1849 054c ALiveNF7G-HDready, MCP67 Gigabit Ethernet
054d MCP67 Ethernet
054e MCP67 Ethernet
-# forcedeth source code from Nvidi
054f MCP67 Ethernet
0550 MCP67 AHCI Controller
1043 8308 M2N68-AM Motherboard
@@ -6612,10 +6712,12 @@
1849 0562 ALiveNF7G-HDready
0563 MCP67 PCI Express Bridge
0568 MCP78S [GeForce 8200] Memory Controller
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 0568 K10N78FullHD-hSLI R3.0 Memory Controller
0569 MCP78S [GeForce 8200] PCI Express Bridge
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 0569 K10N78FullHD-hSLI R3.0 PCI Express Bridge
@@ -6735,9 +6837,9 @@
06cd GF100 [GeForce GTX 470]
06d1 GF100 [Tesla C2050 / C2070]
06d2 GF100 [Tesla M2070]
- 06d8 GF100 [Quadro 6000]
- 06d9 GF100 [Quadro 5000]
- 06dd GF100 [Quadro 4000]
+ 06d8 GF100GL [Quadro 6000]
+ 06d9 GF100GL [Quadro 5000]
+ 06dd GF100GL [Quadro 4000]
06de GF100 [Tesla S2050]
06df GF100 [Tesla M2070Q]
06e0 G98 [GeForce 9300 GE]
@@ -6764,18 +6866,22 @@
06fd G98 [Quadro NVS 295]
06ff G98 [HICx16 + Graphics]
0751 MCP78S [GeForce 8200] Memory Controller
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 0751 K10N78FullHD-hSLI R3.0 Memory Controller
0752 MCP78S [GeForce 8200] SMBus
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 0752 K10N78FullHD-hSLI R3.0 SMBus
0753 MCP78S [GeForce 8200] Co-Processor
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 0753 K10N78FullHD-hSLI R3.0 Co-Processor
0754 MCP78S [GeForce 8200] Memory Controller
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 0754 K10N78FullHD-hSLI R3.0 Memory Controller
@@ -6784,18 +6890,22 @@
1462 7508 K9N2GM-FIH
1849 0759 K10N78FullHD-hSLI R3.0 IDE
075a MCP78S [GeForce 8200] PCI Bridge
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1849 075a K10N78FullHD-hSLI R3.0 PCI Bridge
075b MCP78S [GeForce 8200] PCI Express Bridge
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 075b K10N78FullHD-hSLI R3.0 PCI Express Bridge
075c MCP78S [GeForce 8200] LPC Bridge
+ 103c 2a9e Pavilion p6310f
1462 7508 K9N2GM-FIH
1849 075c K10N78FullHD-hSLI R3.0 LPC Bridge
075d MCP78S [GeForce 8200] LPC Bridge
1043 82e8 M3N72-D
0760 MCP77 Ethernet
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 0760 K10N78FullHD-hSLI R3.0 Ethernet
@@ -6803,31 +6913,38 @@
0762 MCP77 Ethernet
0763 MCP77 Ethernet
0774 MCP72XE/MCP72P/MCP78U/MCP78S High Definition Audio
+ 103c 2a9e Pavilion p6310f
# has a Realtek ALC1200 HDAudio Codec
1043 82fe M3N72-D
1462 7508 K9N2GM-FIH
1849 3662 K10N78FullHD-hSLI R3.0 High Definition Audio
0778 MCP78S [GeForce 8200] PCI Express Bridge
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 0778 K10N78FullHD-hSLI R3.0 PCI Express Bridge
077a MCP78S [GeForce 8200] PCI Bridge
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 077a K10N78FullHD-hSLI R3.0 PCI Bridge
077b MCP78S [GeForce 8200] OHCI USB 1.1 Controller
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 077b K10N78FullHD-hSLI R3.0 OHCI USB 1.1 Controller
077c MCP78S [GeForce 8200] EHCI USB 2.0 Controller
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 077c K10N78FullHD-hSLI R3.0 EHCI USB 2.0 Controller
077d MCP78S [GeForce 8200] OHCI USB 1.1 Controller
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 077d K10N78FullHD-hSLI R3.0 OHCI USB 1.1 Controller
077e MCP78S [GeForce 8200] EHCI USB 2.0 Controller
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1462 7508 K9N2GM-FIH
1849 077e K10N78FullHD-hSLI R3.0 EHCI USB 2.0 Controller
@@ -6903,6 +7020,7 @@
0845 C77 [GeForce 8200M G]
0846 C77 [GeForce 9200]
0847 C78 [GeForce 9100]
+ 103c 2a9e Pavilion p6310f
0848 C77 [GeForce 8300]
0849 C77 [GeForce 8200]
1462 7508 K9N2GM-FIH
@@ -6960,6 +7078,8 @@
0a65 GT218 [GeForce 210]
1043 8334 EN210 SILENT
0a66 GT218 [GeForce 310]
+# taken from nv_disp.inf
+ 0a67 GT218 [GeForce 315]
0a68 G98M [GeForce G105M]
0a69 G98M [GeForce G105M]
0a6a GT218 [NVS 2100M]
@@ -6974,6 +7094,7 @@
0a73 GT218 [GeForce 305M]
0a74 GT218 [GeForce G210M]
0a75 GT218 [GeForce 310M]
+ 0a76 GT218 [ION 2]
0a78 GT218GL [Quadro FX 380 LP]
0a7c GT218 [Quadro FX 380M]
0a80 MCP79 Host Bridge
@@ -7040,6 +7161,7 @@
1462 7508 K9N2GM-FIH
1849 0ad0 K10N78FullHD-hSLI R3.0 IDE
0ad4 MCP78S [GeForce 8200] AHCI Controller
+ 103c 2a9e Pavilion p6310f
1043 82e8 M3N72-D
1849 0ad4 K10N78FullHD-hSLI R3.0 AHCI Controller
0ad8 MCP78S [GeForce 8200] SATA Controller (RAID mode)
@@ -7061,9 +7183,13 @@
0ca2 GT215 [GeForce GT 320]
0ca3 GT215 [GeForce GT 240]
0ca4 GT215 [GeForce GT 340]
+# taken from nv_disp.inf
+ 0ca5 GT215 [GeForce GT 220]
0ca7 GT215 [GeForce GT 330]
0ca8 GT215 [GeForce GTS 260M]
0ca9 GT215 [GeForce GTS 250M]
+# GT215, not GT216 per http://www.techpowerup.com/gpuz/594cm/
+ 0cac GT215 [GeForce GT 220]
0caf GT215 [GeForce GT 335M]
0cb0 GT215 [GeForce GTS 350M]
0cb1 GT215 [GeForce GTS 360M]
@@ -7084,7 +7210,13 @@
0d94 MCP89 High Definition Audio
0d9c MCP89 OHCI USB 1.1 Controller
0d9d MCP89 EHCI USB 2.0 Controller
+# taken from nv_disp.inf
+ 0dc0 GF108 [GeForce GT 440]
0dc4 GF106 [GeForce GTS 450]
+# taken from nv_disp.inf
+ 0dc5 GF106 [GeForce GTS 450]
+# taken from nv_disp.inf
+ 0dc6 GF106 [GeForce GTS 450]
0dcd GF106 [GeForce GT 555M]
0dce GF106 [GeForce GT 555M]
# rev a1
@@ -7092,55 +7224,137 @@
1558 8687 CLEVO/KAPOK W860CU
0dd2 GF106 [GeForce GT 445M]
0dd8 GF106GL [Quadro 2000]
- 0dda GF106 [Quadro 2000M]
+# NVIDIA calls it GF106GML
+ 0dda GF106GLM [Quadro 2000M]
0de0 GF108 [GeForce GT 440]
0de1 GF108 [GeForce GT 430]
3842 1430 GeForce GT 430
0de2 GF108 [GeForce GT 420]
+# taken from nv_disp.inf
+ 0de4 GF108 [GeForce GT 520]
+# taken from nv_disp.inf
+ 0de5 GF108 [GeForce GT 530]
+ 0de9 GF108 [GeForce GT 630M]
# Not fully sure that it's GF108, might also be GF106.
0deb GF108 [GeForce GT 555M]
0dee GF108 [GeForce GT 415M]
+ 0def GF108 [Quadro NVS 5400M]
0df0 GF108 [GeForce GT 425M]
0df2 GF108 [GeForce GT 435M]
0df4 GF108 [GeForce GT 540M]
0df5 GF108 [GeForce GT 540M]
0df7 GF108 [GeForce GT 520M]
- 0df8 GF108 [Quadro 600]
- 0dfa GF108 [Quadro 1000M]
- 0e08 HDMI Audio stub
+# NVIDIA calls it GL
+ 0df8 GF108GL [Quadro 600]
+# NVIDIA calls it GLM
+ 0df9 GF108GLM [Quadro 500M]
+# NVIDIA calls it GLM
+ 0dfa GF108GLM [Quadro 1000M]
+ 0e08 GF119 HDMI Audio Controller
0e09 GF110 High Definition Audio Controller
- 0e0a GK104 [Geforce GTX680]
- 0e0c GF110 High Definition Audio Controller
+ 0e0a GK104 HDMI Audio Controller
+ 0e0c GF114 HDMI Audio Controller
0e22 GF104 [GeForce GTX 460]
1462 2322 N460GTX Cyclone 1GD5/OC
+# taken from nv_disp.inf
+ 0e23 GF104 [GeForce GTX 460 SE]
+# taken from nv_disp.inf
+ 0e24 GF104 [GeForce GTX 460]
0e3a GF104 [Quadro 3000M]
0e3b GF104 [Quadro 4000M]
+# taken from nv_disp.inf
+ 0f00 GK107 [GeForce GT 630]
+# Probably GF108
+ 0f01 GeForce GT 620
+# taken from nv_disp.inf
+ 0fc0 GK107 [GeForce GT 640]
+# taken from nv_disp.inf
+ 0fc1 GK107 [GeForce GT 640]
+ 0fd1 GK107 [GeForce GT 650M]
+ 1043 2103 N56VZ
0fd2 GK107 [GeForce GT 640M]
+ 0ff2 GK107 [VGX K1]
+ 0ffa GK107 [Quadro K600]
+ 0ffb GK107 [Quadro K2000M]
+ 0ffc GK107 [Quadro K1000M]
+ 0ffe GK107 [Quadro K2000]
+ 0fff GK107 [Quadro 410]
1040 GF119 [GeForce GT 520]
+# taken from nv_disp.inf
+ 1042 GF119 [GeForce 510]
+# taken from nv_disp.inf
+ 1048 GF119 [GeForce 605]
+# taken from nv_disp.inf
+ 1049 GF119 [GeForce GT 620]
+# taken from nv_disp.inf
+ 104a GF119 [GeForce GT 610]
1050 GF119 [GeForce GT 520M]
1051 GF119 [GeForce GT 520MX]
1056 GF119 [Quadro NVS 4200M]
1057 GF119 [Quadro NVS 4200M]
+ 105a GF119 [GeForce 610M]
+ 107d GF119 [Quadro NVS 310]
1080 GF110 [GeForce GTX 580]
1081 GF110 [GeForce GTX 570]
10de 087e Leadtek WinFast GTX 570
- 1082 GF114 [GeForce GTX 560 Ti]
+ 1082 GF110 [GeForce GTX 560 Ti]
+# taken from nv_disp.inf
+ 1084 GF110 [GeForce GTX 560]
1086 GF110 [GeForce GTX 570 HD]
+ 1087 GF110 [GeForce GTX 560 Ti 448 Cores]
+# taken from nv_disp.inf
+ 1088 GF110 [GeForce GTX 590]
+# taken from nv_disp.inf
+ 1089 GF110 [GeForce GTX 580]
+# taken from nv_disp.inf
+ 108b GF110 [GeForce GTX 580]
1091 Tesla M2090
1094 Tesla M2075 Dual-Slot Computing Processor Module
1096 Tesla C2075
+ 109b GF100GL [Quadro 7000]
10c3 GT218 [GeForce 8400 GS]
10de 066d G98 [GeForce 8400GS]
- 10c5 Dell M116N [GeForce 405]
- 10d8 GT218 [NVS 300]
+ 10c5 GT218 [GeForce 405]
+ 10d8 GT218 [Quadro NVS 300]
1180 GK104 [GeForce GTX 680]
- 1200 GF110 [GeForce GTX 560 Ti]
+ 1183 GK104 [GeForce GTX 660 Ti]
+ 1188 GK104 [GeForce GTX 690]
+ 1189 GK104 [GeForce GTX 670]
+ 11ba GK104 [Quadro K5000]
+ 11bc GK104 [Quadro K5000M]
+ 11bd GK104 [Quadro K4000M]
+ 11be GK104 [Quadro K3000M]
+ 11bf GK104GL [VGX K2]
+ 11fa GK104 [Quadro K4000]
+ 1200 GF114 [GeForce GTX 560 Ti]
1201 GF114 [GeForce GTX 560]
1205 GF114 [GeForce GTX 460 v2]
+# taken from nv_disp.inf
+ 1206 GF114 [GeForce GTX 555]
+# taken from nv_disp.inf
+ 1207 GF114 [GeForce GTX 645]
+# taken from nv_disp.inf
+ 1208 GF114 [GeForce GTX 560 SE]
+# GT, not GTX
+ 1241 GF116 [GeForce GT 545]
+# GT, not GTX
+ 1243 GF116 [GeForce GT 545]
1244 GF116 [GeForce GTX 550 Ti]
1245 GF116 [GeForce GTS 450]
1247 GF106 [GeForce GT 555M]
+# taken from nv_disp.inf
+ 1249 GF116 [GeForce GTS 450]
+# taken from nv_disp.inf
+ 124b GF116 [GeForce GT 640]
10df Emulex Corporation
+ 0720 OneConnect NIC (Skyhawk)
+ 0722 OneConnect iSCSI Initiator (Skyhawk)
+ 0723 OneConnect iSCSI Initiator + Target (Skyhawk)
+ 0724 OneConnect FCoE Initiator (Skyhawk)
+ 0728 OneConnect NIC (Skyhawk-VF)
+ 072a OneConnect iSCSI Initiator (Skyhawk-VF)
+ 072b OneConnect iSCSI Initiator + Target (Skyhawk-VF)
+ 072c OneConnect FCoE Initiator (Skyhawk-VF)
1ae5 LP6000 Fibre Channel Host Adapter
e100 Proteus-X: LightPulse IOV Fibre Channel Host Adapter
e131 LightPulse 8Gb/s PCIe Shared I/O Fibre Channel Adapter
@@ -7286,6 +7500,7 @@
0885 Realtek 885 High Definition Audio
0888 Realtek 888 High Definition Audio
1028 020d Inspiron 530
+ 0892 Realtek 892 High Definition Audio
5209 RTS5209 PCI Express Card Reader
5229 RTS5229 PCI Express Card Reader
5288 Barossa PCI Express Card Reader
@@ -7360,6 +7575,7 @@
8168 RTL8111/8168B PCI Express Gigabit Ethernet controller
1019 8168 MCP73PVT-SM
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
103c 1611 Pavilion DM1Z-3000
1043 11f5 A6J-Q008
1043 16d5 U6V/U31J laptop
@@ -7368,14 +7584,14 @@
1043 83a3 M4A785TD Motherboard
1043 8432 P8P67 and other motherboards
10ec 8168 TEG-ECTX Gigabit PCI-E Adapter [Trendnet]
- 1458 e000 GA-EP45-DS5 Motherboard
+ 1458 e000 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
1462 238c Onboard RTL8111b on MSI P965 Platinum Mainboard
1462 368c K9AG Neo2
1462 7522 X58 Pro-E
1775 11cc CC11/CL11
1849 8168 Motherboard (one of many)
8086 d615 Desktop Board D510MO
- 8169 RTL-8169 Gigabit Ethernet
+ 8169 RTL8169 PCI Gigabit Ethernet Controller
1025 0079 Aspire 5024WLMi
10bd 3202 EP-320G-TX1 32-bit PCI Gigabit Ethernet Adapter
10ec 8169 RTL8169/8110 Family PCI Gigabit Ethernet NIC
@@ -7405,6 +7621,7 @@
8190 RTL8190 802.11n Wireless LAN
8191 RTL8188CE 802.11b/g/n WiFi Adapter
8192 RTL8192E/RTL8192SE Wireless LAN Controller
+ 8193 RTL8192DE Wireless LAN Controller
8197 SmartLAN56 56K Modem
8199 RTL8187SE Wireless LAN Controller
1462 6894 MN54G2 / MS-6894 Wireless Mini PCIe Card
@@ -7568,6 +7785,9 @@
0007 HPT371/371N
0008 HPT374
0009 HPT372N
+ 0620 RocketRAID 620 2 Port SATA-III Controller
+ 0622 RocketRAID 622 2 Port SATA-III Controller
+ 0640 RocketRAID 640 4 Port SATA-III Controller
1720 RocketRAID 1720 (2x SATA II RAID Controller)
1740 RocketRAID 1740
1742 RocketRAID 1742
@@ -7588,6 +7808,7 @@
3120 RocketRAID 3120
3220 RocketRAID 3220
3320 RocketRAID 3320
+ 4310 RocketRaid 4310
1104 RasterOps Corp.
1105 Sigma Designs, Inc.
1105 REALmagic Xcard MPEG 1/2/3/4 DVD Decoder
@@ -7777,6 +7998,7 @@
147b 1407 KV8-MAX3 motherboard
182d 201d CN-029 USB2.0 4 port PCI Card
1849 3038 K7VT6
+ 19da a179 ZBOX nano VD01
3040 VT82C586B ACPI
3043 VT86C100A [Rhine]
10bd 0000 VT86C100A Fast Ethernet Adapter
@@ -7786,6 +8008,7 @@
0010 0001 IEEE 1394 4port DCST 1394-3+1B
1025 005a TravelMate 290
103c 2a20 Pavilion t3030.de Desktop PC
+ 103c 2a3b Media Center PC m7590n
1043 808a A8V/A8N/P4P800 series motherboard
1043 81fe M4A series motherboard
1458 1000 GA-7VT600-1394 Motherboard
@@ -7889,6 +8112,7 @@
147b 1407 KV8-MAX3 motherboard
182d 201d CN-029 USB 2.0 4 port PCI Card
1849 3104 K7VT6 motherboard
+ 19da a179 ZBOX nano VD01
3106 VT6105/VT6106S [Rhine-III]
1106 0105 VT6106S [Rhine-III]
1186 1403 DFE-530TX rev C
@@ -7971,6 +8195,7 @@
3282 K8T800Pro Host Bridge
3287 VT8251 PCI to ISA Bridge
3288 VT8237A/VT8251 HDA Controller
+ 19da a179 ZBOX VD01
3290 K8M890 Host Bridge
3296 P4M800 Host Bridge
3324 CX700/VX700 Host Bridge
@@ -7993,6 +8218,7 @@
1043 8384 P8P67 Deluxe Motherboard
3409 VX855/VX875 DRAM Bus Control
3410 VX900 DRAM Bus Control
+ 19da a179 ZBOX nano VD01
4149 VIA VT6420 (ATA133) Controller
4204 K8M800 Host Bridge
4208 PT890 Host Bridge
@@ -8015,6 +8241,8 @@
4364 CN896/VN896/P4M900 Host Bridge
4397 VT1708B/1702S/1708S HD audio codec
4409 VX855/VX875 Power Management Control
+ 4410 VX900 Power Management and Chip Testing Control
+ 19da a179 ZBOX nano VD01
4428 VT1718S HD Audio Codec
5030 VT82C596 ACPI [Apollo PRO]
5122 VX855/VX875 Chrome 9 HCM Integrated Graphics
@@ -8032,12 +8260,16 @@
5364 CN896/VN896/P4M900 I/O APIC Interrupt Controller
5372 VT8237/8251 Serial ATA Controller
5409 VX855/VX875 APIC and Central Traffic Control
+ 5410 VX900 APIC and Central Traffic Control
6100 VT85C100A [Rhine II]
6287 SATA RAID Controller
+ 6290 K8M890CE Host Bridge
6327 P4M890 Security Device
6353 VX800/VX820 Scratch Registers
6364 CN896/VN896/P4M900 Security Device
6409 VX855/VX875 Scratch Registers
+ 6410 VX900 Scratch Registers
+ 19da a179 ZBOX nano VD01
7122 VX900 Graphics [Chrome9 HD]
7204 K8M800 Host Bridge
7205 KM400/KN400/P4M800 [S3 UniChrome]
@@ -8062,6 +8294,8 @@
7353 VX800/VX820 North-South Module Interface Control
7364 CN896/VN896/P4M900 Host Bridge
7409 VX855/VX875 North-South Module Interface Control
+ 7410 VX900 North-South Module Interface Control
+ 19da a179 ZBOX nano VD01
8231 VT8231 [PCI-to-ISA Bridge]
8235 VT8235 ACPI
8305 VT8363/8365 [KT133/KM133 AGP]
@@ -8070,6 +8304,8 @@
8391 VT8371 [KX133 AGP]
8400 MVP4
8409 VX855/VX875 Bus Control and Power Management
+ 8410 VX900 Bus Control and Power Management
+ 19da a179 ZBOX VD01
8500 KLE133/PLE133/PLE133T
8501 VT8501 [Apollo MVP4 AGP]
8596 VT82C596 [Apollo PRO AGP]
@@ -8435,7 +8671,6 @@
0000 5071 Behold TV 507 RDS
0000 507b Behold TV 507 RDS
0000 5201 Behold TV Columbus
-# Deleting vendor name after rereading submit instructions
0070 6701 WinTV HVR-1110
1019 4cb5 Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)
1043 0210 FlyTV mini Asus Digimatrix
@@ -8447,6 +8682,7 @@
1131 2001 Proteus Pro [philips reference design]
1131 2018 Tiger reference design
1131 4ee9 MonsterTV Mobile
+ 1131 7133 Pinnacle PCTV 301i
11bd 002b PCTV Stereo
11bd 002e PCTV 110i (saa7133)
12ab 0800 PURPLE TV
@@ -8699,6 +8935,7 @@
0001 Raceway Bridge
0002 Dual PCI to RapidIO Bridge
000b POET Serial RapidIO Bridge
+ 000d POET PSDMS Device
1135 Fuji Xerox Co Ltd
0001 Printer controller
1136 Momentum Data Systems
@@ -8713,10 +8950,14 @@
1137 0047 VIC P81E PCIe Ethernet NIC
1137 0048 VIC M81KR Mezzanine Ethernet NIC
1137 004f VIC 1280 Mezzanine Ethernet NIC
+ 1137 0084 VIC 1240 MLOM Ethernet NIC
+ 1137 0085 VIC 1225 PCIe Ethernet NIC
0044 VIC Ethernet NIC Dynamic
1137 0047 VIC P81E PCIe Ethernet NIC Dynamic
1137 0048 VIC M81KR Mezzanine Ethernet NIC Dynamic
1137 004f VIC 1280 Mezzanine Ethernet NIC Dynamic
+ 1137 0084 VIC 1240 MLOM Ethernet NIC Dynamic
+ 1137 0085 VIC 1225 PCIe Ethernet NIC Dynamic
0045 VIC FCoE HBA
1137 0047 VIC P81E PCIe FCoE HBA
1137 0048 VIC M81KR Mezzanine FCoE HBA
@@ -9115,7 +9356,7 @@
1179 0001 FIR Port Type-DO
117a A-Trend Technology
117b L G Electronics, Inc.
-117c Atto Technology
+117c ATTO Technology, Inc.
002c SAS RAID Adapter
0030 Ultra320 SCSI Host Adapter
117c 8013 ExpressPCI UL4D
@@ -9214,6 +9455,7 @@
1028 01d7 XPS M1210
1028 01f3 Inspiron 1420
1028 01f5 Dell Inspiron 1501
+ 1028 024f Dell Latitude e6500
103c 03b5 Presario V3242AU
103c 30b7 Presario V6133CL
1183 0843 Alienware Aurora m9700
@@ -9226,10 +9468,16 @@
1043 1967 V6800V
1180 0852 Pavilion 2410us
1324 10cf P7120
- e230 Memory Stick Host Controller
+ e230 R5U2xx (R5U230 / R5U231 / R5U241) [Memory Stick Host Controller]
+ e476 CardBus bridge
+ 1028 040a Latitude E6410
+ 1028 040b Latitude E6510
e822 MMC/SD Host Controller
+ 1028 040a Latitude E6410
1028 040b Latitude E6510
+ e823 PCIe SDXC/MMC Host Controller
e832 R5C832 PCIe IEEE 1394 Controller
+ 1028 040a Latitude E6410
1028 040b Latitude E6510
e852 PCIe xD-Picture Card Controller
1181 Telmatics International
@@ -9271,6 +9519,8 @@
4000 DL2000-based Gigabit Ethernet
4001 DGE-550SX PCI-X Gigabit Ethernet Adapter
4300 DGE-528T Gigabit Ethernet Adapter
+# rev. B1; RealTek RTL8168E.
+ 1186 4b10 DGE-560T PCI Express (x1) Gigabit Ethernet Adapter
4302 DGE-530T Gigabit Ethernet Adapter (rev.C1) [Realtek RTL8169]
# There are at least 3 revisions of this adapter; 4800 is board revision A1 as far as I can tell, revision B1 is 4c00.
4800 DGE-530T Gigabit Ethernet Adapter (rev 11)
@@ -9384,6 +9634,7 @@
2a01 88W8335 [Libertas] 802.11b/g Wireless
2a02 88W8361 [TopDog] 802.11n Wireless
07d1 3b02 DIR-615 rev. A1 Mini PCI Wireless Module
+ 1385 7c01 WN511T RangeMax Next 300 Mbps Wireless Notebook Adapter
1385 7e00 WN311T RangeMax Next 300 Mbps Wireless PCI Adapter
1799 801b F5D8011 v2 802.11n N1 Wireless Notebook Card
2a08 88W8362e [TopDog] 802.11a/b/g/n Wireless
@@ -9463,6 +9714,7 @@
4353 88E8039 PCI-E Fast Ethernet Controller
104d 902d VAIO VGN-NR120E
4354 88E8040 PCI-E Fast Ethernet Controller
+ 144d c072 Notebook N150P
4355 88E8040T PCI-E Fast Ethernet Controller
1179 ff50 Satellite P305D-S8995E
4356 88EC033 PCI-E Fast Ethernet Controller
@@ -9555,7 +9807,7 @@
6081 MV88SX6081 8-port SATA II PCI-X Controller
6101 88SE6101/6102 single-port PATA133 interface
6111 88SE6111 1-port PATA133(IDE) and 1-port SATA II Controllers
- 6121 88SE6121 SATA II Controller
+ 6121 88SE6121 SATA II / PATA Controller
6141 88SE614x SATA II PCI-E controller
6145 88SE6145 SATA II PCI-E controller
6180 88F6180 [Kirkwood] ARM SoC
@@ -9743,14 +9995,17 @@
5801 USB
5802 USS-312 USB Controller
5803 USS-344S USB Controller
- 5811 FW322/323
- 1043 8294 IEEE 1394a Firewire Controller
+ 5811 FW322/323 [TrueFire] 1394a Controller
+ 103c 2a34 Pavilion a1677c
+ 103c 2a9e Pavilion p6310f
+ 1043 8294 LSI FW322/323 IEEE 1394a FireWire Controller
8086 524c D865PERL mainboard
dead 0800 FireWire Host Bus Adapter
- 5901 FW643 PCI Express 1394b Controller (PHY/Link)
+ 5901 FW643 [TrueFire] PCIe 1394b Controller
+ 11c1 5900 FW643 [TrueFire] PCIe 1394b Controller
1443 0643 FireBoard800-e V.2
- 1546 0643 FWB-PCIE1X20
- 5903 FW533 PCI Express 1394a Controller (PHY/Link)
+ 1546 0643 FWB-PCIE1X2x
+ 5903 FW533 [TrueFire] PCIe 1394a Controller
8110 T8110 H.100/H.110 TDM switch
12d9 000c E1/T1 PMXc cPCI carrier card
ab10 WL60010 Wireless LAN MAC
@@ -9921,6 +10176,7 @@
0805 RocketPort UPCI 8 port w/octa cable
080c RocketModem III 8 port
080d RocketModem III 4 port
+ 0810 RocketPort UPCI Plus 4 port RS232
0811 RocketPort UPCI Plus 8 port RS232
0812 RocketPort UPCI Plus 8 port RS422
0903 RocketPort Compact PCI 16 port w/external I/F
@@ -10794,6 +11050,9 @@
12d7 Biotronic SRL
12d8 Pericom Semiconductor
01a7 PI7C21P100 PCI to PCI Bridge
+ 400a PI7C9X442SL PCI Express Bridge Port
+ 400e PI7C9X442SL USB OHCI Controller
+ 400f PI7C9X442SL USB EHCI Controller
71e2 PI7C7300A/PI7C7300D PCI-to-PCI Bridge
71e3 PI7C7300A/PI7C7300D PCI-to-PCI Bridge (Secondary Bus 2)
8140 PI7C8140A PCI-to-PCI Bridge
@@ -10961,8 +11220,10 @@
0067 PCI-DAS6070
0068 PCI-DAS6071
006f PCI-DAS6036
+ 0070 PCI-DAC6702
0078 PCI-DAS6013
0079 PCI-DAS6014
+ 0115 PCIe-DAS1602/16
1308 Jato Technologies Inc.
0001 NetCelerator Adapter
1308 0001 NetCelerator Adapter
@@ -11087,6 +11348,13 @@
1343 Phylon Communications Inc
# nee Crucial Technology
1344 Micron Technology Inc
+ 5150 RealSSD P320h
+ 5151 RealSSD P320m
+ 5152 RealSSD P320s
+ 5153 RealSSD P325m
+ 5160 RealSSD P420h
+ 5161 RealSSD P420m
+ 5163 RealSSD P425m
1345 Arescom Inc
1347 Odetics
1349 Sumitomo Electric Industries, Ltd.
@@ -11112,7 +11380,8 @@
134f Algo System Co Ltd
1350 Systec Co. Ltd
1351 Sonix Inc
-1353 Thales Idatys
+# nee Thales Idatys
+1353 Vierling Communication SAS
0002 Proserver
0003 PCI-FUT
0004 PCI-S0
@@ -11290,6 +11559,7 @@
1389 Applicom International
0001 PCI1500PFB [Intelligent fieldbus adaptor]
138a Fusion Micromedia Corp
+ 003d VFS491 Validity Sensor
138b Tokimec Inc
138c Silicon Reality
138d Future Techno Designs pte Ltd
@@ -11537,7 +11807,7 @@
13f6 ffff CMI8338/C3DX PCI Audio Device
0101 CM8338B
13f6 0101 CMI8338-031 PCI Audio Device
- 0111 CM8738
+ 0111 CMI8738/CMI8768 PCI Audio
1019 0970 P6STP-FL motherboard
1043 8035 CUSI-FX motherboard
1043 8077 CMI8738 6-channel audio controller
@@ -11547,6 +11817,9 @@
153b 1144 Aureon 5.1
153b 1170 Aureon 7.1
1681 a000 Gamesurround MUSE XL
+ 17ab 0604 PSC604 Dynamic Edge
+ 17ab 0605 PSC605 Sonic Edge
+ 17ab 7777 PSC605 Sonic Edge
270f 1103 CT-7NJS Ultra motherboard
270f f462 7NJL1 motherboard
584d 3731 Digital X-Mystique
@@ -11556,6 +11829,8 @@
584d 3771 X-Mystique 7.1 LP Value
7284 8384 Striker 7.1
0211 CM8738
+ 5011 CM8888 [Oxygen Express]
+ 13f6 5011 HDA Controller
8788 CMI8788 [Oxygen HD Audio]
1043 8269 Virtuoso 200 (Xonar D2)
1043 8275 Virtuoso 100 (Xonar DX)
@@ -11580,6 +11855,7 @@
7284 9761 CLARO
7284 9781 CLARO halo
7284 9783 eCLARO
+ 7284 9787 CLARO II
9880 CM9880
13f7 Wildfire Communications
13f8 Ad Lib Multimedia Inc
@@ -11767,6 +12043,7 @@
153b 1151 PHASE88
16ce 1040 Edirol DA-2496
1724 VT1720/24 [Envy24PT/HT] PCI Multi-Channel Audio Controller
+ 10b0 0200 Hollywood@Home 7.1
1412 1724 Albatron PX865PE 7.1
1412 3630 M-Audio Revolution 7.1
1412 3631 M-Audio Revolution 5.1
@@ -11821,6 +12098,9 @@
9513 OX16PCI954 (Quad 16950 UART) function 1 (parallel port)
9521 OX16PCI952 (Dual 16950 UART)
9523 OX16PCI952 Integrated Parallel Port
+ c158 OXPCIe952 Dual 16C950 UART
+ e4bf c504 CP4-SCAT Wireless Technologies Carrier Board
+ e4bf d551 DU1-MUSTANG Dual-Port RS-485 Interface
c308 EX-44016 16-port serial
1416 Multiwave Innovation pte Ltd
1417 Convergenet Technologies Inc
@@ -11861,6 +12141,8 @@
4008 T420-CX Unified Wire Ethernet Controller
4009 T420-BT Unified Wire Ethernet Controller
400a T404-BT Unified Wire Ethernet Controller
+ 400b B420-SR Unified Wire Ethernet Controller
+ 400c B404-BT Unified Wire Ethernet Controller
400d T480 Unified Wire Ethernet Controller
400e T440-LP-CR Unified Wire Ethernet Controller
4401 T420-CR Unified Wire Ethernet Controller
@@ -11873,6 +12155,8 @@
4408 T420-CX Unified Wire Ethernet Controller
4409 T420-BT Unified Wire Ethernet Controller
440a T404-BT Unified Wire Ethernet Controller
+ 440b B420-SR Unified Wire Ethernet Controller
+ 440c B404-BT Unified Wire Ethernet Controller
440d T480 Unified Wire Ethernet Controller
440e T440-LP-CR Unified Wire Ethernet Controller
4501 T420-CR Unified Wire Storage Controller
@@ -11885,6 +12169,8 @@
4508 T420-CX Unified Wire Storage Controller
4509 T420-BT Unified Wire Storage Controller
450a T404-BT Unified Wire Storage Controller
+ 450b B420-SR Unified Wire Ethernet Controller
+ 450c B404-BT Unified Wire Ethernet Controller
450d T480 Unified Wire Storage Controller
450e T440-LP-CR Unified Wire Storage Controller
4601 T420-CR Unified Wire Storage Controller
@@ -11897,6 +12183,8 @@
4608 T420-CX Unified Wire Storage Controller
4609 T420-BT Unified Wire Storage Controller
460a T404-BT Unified Wire Storage Controller
+ 460b B420-SR Unified Wire Ethernet Controller
+ 460c B404-BT Unified Wire Ethernet Controller
460d T480 Unified Wire Storage Controller
460e T440-LP-CR Unified Wire Storage Controller
4701 T420-CR Unified Wire Ethernet Controller
@@ -11909,6 +12197,8 @@
4708 T420-CX Unified Wire Ethernet Controller
4709 T420-BT Unified Wire Ethernet Controller
470a T404-BT Unified Wire Ethernet Controller
+ 470b B420-SR Unified Wire Ethernet Controller
+ 470c B404-BT Unified Wire Ethernet Controller
470d T480 Unified Wire Ethernet Controller
470e T440-LP-CR Unified Wire Ethernet Controller
4801 T420-CR Unified Wire Ethernet Controller
@@ -11921,6 +12211,8 @@
4808 T420-CX Unified Wire Ethernet Controller
4809 T420-BT Unified Wire Ethernet Controller
480a T404-BT Unified Wire Ethernet Controller
+ 480b B420-SR Unified Wire Ethernet Controller
+ 480c B404-BT Unified Wire Ethernet Controller
480d T480 Unified Wire Ethernet Controller
480e T440-LP-CR Unified Wire Ethernet Controller
a000 PE10K Unified Wire Ethernet Controller
@@ -12201,7 +12493,7 @@
8002 VScom 020L 2 port parallel adaptor
8010 VScom 100L 1 port serial adaptor
8011 VScom 110L 1 port serial and 1 port parallel adaptor
- 8020 VScom 200L 1 port serial adaptor
+ 8020 VScom 200L 1 or 2 port serial adaptor
8021 VScom 210L 2 port serial and 1 port parallel adaptor
8028 VScom 200I/200I-SI 2-port serial adapter
8040 VScom 400L 4 port serial adaptor
@@ -12290,6 +12582,12 @@
1028 028d PowerEdge T410 BCM5716 Gigabit Ethernet
1028 02f1 PowerEdge R510 BCM5716 Gigabit Ethernet
163c NetXtreme II BCM5716S Gigabit Ethernet
+ 163d NetXtreme II BCM57811 10-Gigabit Ethernet
+ 163e NetXtreme II BCM57811 10 Gigabit Ethernet Multi Function
+ 163f NetXtreme II BCM57811 10-Gigabit Ethernet Virtual Function
+ 1641 NetXtreme BCM57787 Gigabit Ethernet PCIe
+ 1642 NetXtreme BCM57764 Gigabit Ethernet PCIe
+ 1643 NetXtreme BCM5725 Gigabit Ethernet PCIe
1644 NetXtreme BCM5700 Gigabit Ethernet
1014 0277 Broadcom Vigil B5700 1000Base-T
1028 00d1 Broadcom BCM5700
@@ -12472,9 +12770,11 @@
1680 NetXtreme BCM5761e Gigabit Ethernet PCIe
1681 NetXtreme BCM5761 Gigabit Ethernet PCIe
1682 NetXtreme BCM57762 Gigabit Ethernet PCIe
+ 1683 NetXtreme BCM57767 Gigabit Ethernet PCIe
1684 NetXtreme BCM5764M Gigabit Ethernet PCIe
1685 NetXtreme II BCM57500S Gigabit Ethernet
1686 NetXtreme BCM57766 Gigabit Ethernet PCIe
+ 1687 NetXtreme BCM5762 Gigabit Ethernet PCIe
# The Broadcom 57800 device has two 1Gig ports and two 10Gig ports. The subsystem information can be used to differentiate.
168a NetXtreme II BCM57800 1/10 Gigabit Ethernet
1028 1f5c BCM57800 10-Gigabit Ethernet
@@ -12506,6 +12806,9 @@
1462 590c KT6 Delta-FIS2R (MS-6590)
169d NetLink BCM5789 Gigabit Ethernet PCI Express
16a0 NetLink BCM5785 Fast Ethernet
+ 16a1 BCM57840 NetXtreme II 10 Gigabit Ethernet
+ 16a2 BCM57840 NetXtreme II 10/20-Gigabit Ethernet
+ 16a4 BCM57840 NetXtreme II Ethernet Multi Function
# The Broadcom 57800 device has two 1Gig ports and two 10Gig ports. The subsystem information can be used to differentiate.
16a5 NetXtreme II BCM57800 1/10 Gigabit Ethernet Multi Function
1028 1f5c NetXtreme II BCM57800 10-Gigabit Ethernet Multi Function
@@ -12724,16 +13027,19 @@
1737 0066 WPC600N v1 802.11a/b/g/n Wireless-N CardBus Adapter
1737 0068 WEC600N v1 802.11a/b/g/n Wireless-N ExpressCard
4329 BCM4321 802.11b/g/n
+ 1385 7b00 WN511B RangeMax NEXT Wireless Notebook Adapter
1385 7d00 WN311B RangeMax Next 270 Mbps Wireless PCI Adapter
1737 0058 WPC300N v1 Wireless-N Notebook Adapter
432a BCM4321 802.11an Wireless Network Controller
432b BCM4322 802.11a/b/g/n Wireless LAN Controller
1028 000d Wireless 1510 Wireless-N WLAN Mini-Card
+ 106b 008e AirPort Extreme
432c BCM4322 802.11b/g/n
1799 d311 Dynex DX-NNBX 802.11n WLAN Cardbus Card
432d BCM4322 802.11an Wireless Network Controller
4331 BCM4331 802.11a/b/g/n
106b 00d6 AirPort Extreme
+ 4333 Serial (EDGE/GPRS modem part of Option GT Combo Edge)
4344 EDGE/GPRS data and 802.11b/g combo cardbus [GC89]
4353 BCM43224 802.11a/b/g/n
1028 000e Wireless 1520 Half-size Mini PCIe Card
@@ -12743,6 +13049,9 @@
4358 BCM43227 802.11b/g/n
4359 BCM43228 802.11a/b/g/n
1028 0011 Wireless 1530 Half-size Mini PCIe Card
+ 103c 182c BCM943228HM4L 802.11a/b/g/n 2x2 Wi-Fi Adapter
+ 4365 BCM43142 802.11b/g/n
+ 1028 0016 Wireless 1704 802.11n + BT 4.0
4401 BCM4401 100Base-T
1025 0035 TravelMate 660
103c 08b0 tc1100 tablet
@@ -13066,6 +13375,7 @@
8852 CX23885 PCI Video and Audio Decoder
0070 8010 Hauppauge WinTV HVR-1400 ExpressCard
1461 c039 AVerTV Hybrid Express (A577)
+ 153b 117e Cinergy T PCIe Dual
18ac db78 FusionHDTV DVB-T Dual Express
8880 CX23887/8 PCIe Broadcast Audio and Video Decoder with 3D Comb
0070 c108 WinTV-HVR-4400-HD model 1278
@@ -13408,6 +13718,7 @@
07c0 PVSCSI SCSI Controller
0801 Virtual Machine Interface
15ad 0800 Hypervisor ROM Interface
+ 1977 HD Audio Controller
15ae Amersham Pharmacia Biotech
15b0 Zoltrix International Ltd
15b1 Source Technology Inc
@@ -13415,6 +13726,7 @@
15b3 Mellanox Technologies
0191 MT25408 [ConnectX IB Flash Recovery]
01f6 MT27500 Family [ConnectX-3 Flash Recovery]
+ 01ff MT27600 Family [Connect-IB Flash Recovery]
1002 MT25400 Family [ConnectX-2 Virtual Function]
1003 MT27500 Family [ConnectX-3]
1004 MT27500 Family [ConnectX-3 Virtual Function]
@@ -13430,6 +13742,12 @@
100e MT27551 Family
100f MT27560 Family
1010 MT27561 Family
+ 1011 MT27600 [Connect-IB]
+ 1012 MT27600 Family [Connect-IB Virtual Function]
+ 1013 MT27620 Family
+ 1014 MT27621 Family
+ 1015 MT27630 Family
+ 1016 MT27631 Family
5274 MT21108 InfiniBridge
5a44 MT23108 InfiniHost
5a45 MT23108 [Infinihost HCA Flash Recovery]
@@ -13636,7 +13954,7 @@
103c 1743 HP 81B 8Gbps single port FC HBA
1657 0014 415/815 4Gbps/8Gbps single port PCIe FC HBA
0021 804 8Gbps FC HBA for HP Bladesystem c-class
- 0022 1860 16Gbps FC HBA and/or 10Gbps CNA
+ 0022 1867/1860: 16Gbps/10Gbps Fabric Adapter
1657 0022 10Gbps CNA - FCOE
1657 0023 10Gbps CNA - LL
1657 0024 16Gbps FC HBA
@@ -13837,11 +14155,13 @@
0777 4005 SR71-15 802.11an Mini PCI Adapter
1186 3a7a DWA-552 802.11n Xtreme N Desktop Adapter (rev A2)
002a AR928X Wireless Network Adapter (PCI-Express)
+ 0777 4f05 SR71-X 802.11abgn Wireless ExpressCard Adapter [AR9280]
103c 3041 AR5BHB92-H 802.11abgn Wireless Half-size Mini PCIe Card [AR9280]
105b e006 T77H053.00 802.11bgn Wireless Mini PCIe Card [AR9281]
105b e01f T77H047.31 802.11bgn Wireless Half-size Mini PCIe Card [AR9283]
11ad 6600 WN6600A 802.11bgn Wireless Mini PCIe Card [AR9281]
144f 7141 WLL6080 802.11bgn Wireless Mini PCIe Card [AR9281]
+ 168c 0203 DW1525 802.11abgn WLAN PCIe Card [AR9280]
1a32 0303 EM303 802.11bgn Wireless Mini PCIe Card [AR9281]
1a32 0306 EM306 802.11bgn Wireless Half-size Mini PCIe Card [AR9283]
1a3b 1067 AW-NE771 802.11bgn Wireless Mini PCIe Card [AR9281]
@@ -13863,12 +14183,14 @@
002d AR9227 Wireless Network Adapter
002e AR9287 Wireless Network Adapter (PCI-Express)
0030 AR9300 Wireless LAN adaptor
- 103c 1627 HB112AGN 802.11abgn 3x3 Wi-Fi Adapter
+ 103c 1627 AR9380/HB112 802.11abgn 3×3 Wi-Fi Adapter
1a56 2000 Killer Wireless-N 1102 Half-size Mini PCIe Card [AR9382]
1a56 2001 Killer Wireless-N 1103 Half-size Mini PCIe Card [AR9380]
0032 AR9485 Wireless Network Adapter
+ 103c 1838 AR9485/HB125 802.11bgn 1×1 Wi-Fi Adapter
0033 AR9580 Wireless Network Adapter
0034 AR9462 Wireless Network Adapter
+ 0036 AR9565 Wireless Network Adapter
0207 AR5210 Wireless Network Adapter [AR5000 802.11a]
1014 AR5212 802.11abg NIC
1014 058a ThinkPad 11a/b/g Wireless LAN Mini Express Adapter (AR5BXB6)
@@ -13903,7 +14225,19 @@
16c9 EONIC B.V. The Netherlands
16ca CENATEK Inc
0001 Rocket Drive DL
-16cd Densitron Technologies
+# nee Innocore Gaming Ltd., nee Densitron Gaming Ltd., a division of Densitron Technologies
+16cd Advantech Co. Ltd
+ 0101 DirectPCI SRAM for DPX-11x series
+ 0102 DirectPCI SRAM for DPX-S/C/E-series
+ 0103 DirectPCI ROM for DPX-11x series
+ 0104 DirectPCI ROM for DPX-S/C/E-series
+ 0105 DirectPCI I/O for DPX-114/DPX-115
+ 0106 DirectPCI I/O for DPX-116
+ 0107 DirectPCI I/O for DPX-116U
+ 0108 DirectPCI I/O for DPX-117
+ 0109 DirectPCI I/O for DPX-112
+ 010a DirectPCI I/O for DPX-C/E-series
+ 010b DirectPCI I/O for DPX-S series
16ce Roland Corp.
16d5 Acromag, Inc.
0504 PMC-DX504 Reconfigurable FPGA with LVDS I/O
@@ -13956,6 +14290,10 @@
5807 XMC-SLX150: Reconfigurable Spartan-6 FPGA with plug-in I/O
5808 XMC-SLX150-1M: Reconfigurable Spartan-6 FPGA with plug-in I/O
5901 APCe8650 PCI Express IndustryPack Carrier Card
+ 6301 XMC Module with user-configurable Virtex-6 FPGA, 240k logic cells, SFP front I/O
+ 6302 XMC Module with user-configurable Virtex-6 FPGA, 365k logic cells, SFP front I/O
+ 6303 XMC Module with user-configurable Virtex-6 FPGA, 240k logic cells, no front I/O
+ 6304 XMC Module with user-configurable Virtex-6 FPGA, 365k logic cells, no front I/O
16da Advantech Co., Ltd.
0011 INES GPIB-PCI
16df PIKA Technologies Inc.
@@ -14086,7 +14424,6 @@
8083 GL880 USB 1.1 UHCI controller
8084 GL880 USB 2.0 EHCI controller
17aa Lenovo
- 20b1 ThinkPad T61p
17ab Phillips Components
17af Hightech Information System Ltd.
17b3 Hawking Technologies
@@ -14125,6 +14462,7 @@
17d3 1221 ARC-1221 8-Port PCI-Express to SATA RAID Controller
1300 ARC-1300ix-16 16-Port PCI-Express to SAS Non-RAID Host Adapter
1680 ARC-1680 8 port PCIe/PCI-X to SAS/SATA II RAID Controller
+ 17d3 1212 ARC-1212 4-Port PCIe to SAS/SATA II RAID Controller
1880 ARC-1880 8/12 port PCIe/PCI-X to SAS/SATA II RAID Controller
# nee Neterion Inc., previously S2io Inc.
17d5 Exar Corp.
@@ -14168,6 +14506,7 @@
0011 EN2010 [c.Link] MoCA Network Controller (Coax, MPEG interface)
0021 EN2210 [c.Link] MoCA Network Controller (Coax)
0025 EN2510 [c.Link] MoCA Network Controller (Coax, PCIe interface)
+ 0027 EN2710 [c.Link] MoCA 2.0 Network Controller (Coax, PCIe interface)
17ee Connect Components Ltd
17f2 Albatron Corp.
17f3 RDC Semiconductor, Inc.
@@ -14219,7 +14558,7 @@
1814 2560 RT2500 Wireless 802.11bg
182d 9073 WL-115 Wireless Network PCI Adapter
185f 22a0 CN-WF513 Wireless Cardbus Adapter
- 18eb 5312 Tornado 122 IEEE 802.11g PCI Card-EU
+ 18eb 5312 WL531P IEEE 802.11g PCI Card-EU
1948 3c00 C54RC v1 Wireless 11g CardBus Adapter
1948 3c01 C54Ri v1 Wireless 11g PCI Adapter
0300 Wireless Adapter Canyon CN-WF511
@@ -14233,7 +14572,7 @@
1799 700e F5D7000 v6000 Wireless G Desktop Card
1799 701e F5D7010 v6000 Wireless G Notebook Card
17f9 0012 AWLC3026T 802.11g Wireless CardBus Adapter
- 1814 2561 EW-7108PCg
+ 1814 2561 EW-7108PCg/EW-7128g
0302 RT2561/RT61 rev B 802.11g
1186 3a71 DWA-510 Wireless G Desktop Adapter
1186 3c08 AirPlus G DWL-G630 Wireless Cardbus Adapter (rev.E2)
@@ -14260,8 +14599,10 @@
13bd 1057 GN-WS32L-RH Half-size Mini PCIe Card
3091 RT3091 Wireless 802.11n 1T/2R PCIe
3092 RT3092 Wireless 802.11n 2T/2R PCIe
+ 3592 RT3592 Wireless 802.11abgn 1T/1R PCIe
5360 RT5360 Wireless 802.11n 1T/1R
1186 3c05 DWA-525 Wireless N 150 Desktop Adapter (rev.A2)
+ 20f4 703a TEW-703PI N150 Wireless PCI Adapter
5390 RT5390 Wireless 802.11n 1T/1R PCIe
103c 1636 U98Z077.00 Half-size Mini PCIe Card
539f RT5390 [802.11 b/g/n 1T1R G-band PCI Express Single Chip]
@@ -14287,6 +14628,7 @@
08a8 MVC101 SDI
08a9 MVC102 DVI+Audio
08b0 MVC200-DC
+1846 Alcatel-Lucent
1849 ASRock Incorporation
184a Thales Computers
1100 MAX II cPLD
@@ -14362,7 +14704,6 @@
18ca XGI Technology Inc. (eXtreme Graphics Innovation)
0020 Z7/Z9 (XG20 core)
0021 Z9s/Z9m (XG21 core)
-# duh! Device name, not my name :)
0027 Z11/Z11M
0040 Volari V3XT/V5/V8
0047 Volari 8300 (chip: XP10, codename: XG47)
@@ -14429,7 +14770,7 @@
18f1 Spectrum GmbH
18f4 Napatech A/S
0031 NT20X Network Adapter
- 0051 NT20-X Capture Card
+ 0051 NT20X Capture Card
0061 NT20E Capture Card
0064 NT20E Inline Card
0071 NT4E Capture Card
@@ -14438,7 +14779,13 @@
0091 NT20X Capture Card [New Rev]
00a1 NT4E-STD Capture Card
00a4 NT4E-STD Inline Card
- 00c5 NT20E2 Network Adapter
+# 8 x 1 Gbps / 10 Gbps PCIe Optical Bypass Adapter
+ 00b1 NTBPE Optical Bypass Adapter
+ 00c5 NT20E2 Network Adapter 2x10Gb
+ 00d5 NT40E2-4 Network Adapter 4x10Gb
+ 00e5 NT40E2-1 Network Adapter 1x40Gb
+# 4-Port Adapter for 1 GbE In-Line Bypass Applications
+ 00f5 NT4E2-4T-BP Network Adapter 4x1Gb with Electrical Bypass
18f6 NextIO
1000 [Nexsis] Switch Virtual P2P PCIe Bridge
1050 [Nexsis] Switch Virtual P2P PCI Bridge
@@ -14453,7 +14800,6 @@
000b Fastcom 232/8-PCI-335 Async 8-Port RS-232 Serial PCI Adapter
000f Fastcom FSCC
0010 Fastcom GSCC
-# Dual Serocco
0011 Fastcom QSSB
0014 SuperFSCC
0015 SuperFSCC-104
@@ -14511,6 +14857,7 @@
1924 5201 SFN4112F-R1
1924 5202 SFN4112F-R2
0803 SFC9020 [Solarstorm]
+ 1924 1201 SFA6902F-R1 SFP+ AOE Adapter
1924 6200 SFN5122F-R0
1924 6201 SFN5122F-R1
1924 6202 SFN5122F-R2
@@ -14526,6 +14873,7 @@
1924 6501 SFN5802K-R1
1924 6511 SFN5814H-R1
1924 6521 SFN5812H-R1
+ 1924 6562 SFN6832F-R2 SFP+ Mezzanine Adapter
1924 6a05 SFN5112F-R5
1924 6a06 SFN5112F-R6
1924 7206 SFN5162F-R6
@@ -14557,6 +14905,7 @@
1924 0304 SFE4003-A4
1924 0500 SFE4005-A0
c101 EF1-21022T [EtherFabric]
+192a BiTMICRO Networks Inc.
192e TransDimension
1931 Option N.V.
000c Qualcomm MSM6275 UMTS chip
@@ -14568,6 +14917,7 @@
0363 AHA363-PCIe
0364 AHA364-PCIe
0367 AHA367-PCIe
+ 0370 AHA370-PCIe
1942 ClearSpeed Technology plc
e511 Advance X620 accelerator card
e521 Advance e620 accelerator card
@@ -14639,6 +14989,7 @@
010b P1012
0110 P1022E
0111 P1022
+ 1c7f 5200 EB5200
0118 P1013E
0119 P1013
0128 P1010
@@ -14678,13 +15029,14 @@
1062 AR8132 Fast Ethernet
1063 AR8131 Gigabit Ethernet
1458 e000 GA-G31M-ES2L Motherboard
- 1066 L2c Gigabit Ethernet
- 1067 L1c Gigabit Ethernet
+ 1066 Attansic L2c Gigabit Ethernet
+ 1067 Attansic L1c Gigabit Ethernet
1073 AR8151 v1.0 Gigabit Ethernet
1083 AR8151 v2.0 Gigabit Ethernet
1090 AR8162 Fast Ethernet
1091 AR8161 Gigabit Ethernet
- 2048 L2 Fast Ethernet
+ 1043 1477 N56VZ
+ 2048 Attansic L2 Fast Ethernet
2060 AR8152 v1.1 Fast Ethernet
2062 AR8152 v2.0 Fast Ethernet
196a Sensory Networks Inc.
@@ -14745,6 +15097,7 @@
890a Virtual HBA Device
199f Auvitek
8501 AU85X1 PCI REV1.1
+ 8521 AU8521 TV card
# nee ServerEngines Corp.
19a2 Emulex Corporation
0200 BladeEngine 10Gb PCI-E iSCSI adapter
@@ -14829,6 +15182,7 @@
0200 TILE-Gx36 processor
1a4a SLAC National Accelerator Lab PPA-REG
1000 MCOR Power Supply Controller
+ 1010 AMC EVR - Stockholm Timing Board
2000 PGPCard - 4 Lane
2010 PCI-Express EVR
1a51 Hectronic AB
@@ -14850,7 +15204,7 @@
1a78 0037 FlashMAX PCIe SSD [rev 3D]
1a78 0038 FlashMAX PCIe SSD [rev 4]
1a78 0039 FlashMAX PCIe SSD [rev 4D]
- 1a78 0040 FlashMAX PCIe SSD [LP Z1]
+ 0040 FlashMAX II
1a84 Commex Technologies
0001 Vulcan SP HT6210 10-Gigabit Ethernet (rev 02)
1a88 MEN Mikro Elektronik
@@ -14865,6 +15219,11 @@
1aae Global Velocity, Inc.
1ab6 CalDigit, Inc.
6201 RAID Card
+# Parallels VM virtual devices
+1ab8 Parallels, Inc.
+ 4000 Virtual Machine Communication Interface
+ 4005 Accelerated Virtual Video Adapter
+ 4006 Memory Ballooning Controller
1ab9 Espia Srl
1acc Point of View B.V
1ad7 Spectracom Corporation
@@ -14873,6 +15232,8 @@
1ade Spin Master Ltd.
1501 Swipetech barcode scanner
1ae0 Google, Inc.
+1ae7 First Wise Media GmbH
+ 0520 HFC-S PCI A [X-TENSIONS XC-520]
1ae8 Silicon Software GmbH
0a40 microEnable IV-BASE x1
0a41 microEnable IV-FULL x1
@@ -14904,6 +15265,7 @@
1afa J & W Electronics Co., Ltd.
1b03 Magnum Semiconductor, Inc,
6100 DXT/DXTPro Multiformat Broadcast HD/SD Encoder/Decoder/Transcoder
+1b08 MSC Vertriebs GmbH
1b13 Jaton Corp
1b1a K&F Computing Research Co.
0e70 GRAPE
@@ -14927,6 +15289,7 @@
0601 NumaChip N601
0602 NumaChip N602
1b4b Marvell Technology Group Ltd.
+ 0640 88SE9128 SATA III 6Gb/s RAID Controller
9120 88SE9120 SATA 6Gb/s Controller
9123 88SE9123 PCIe SATA 6.0 Gb/s controller
9125 88SE9125 PCIe SATA 6.0 Gb/s controller
@@ -14934,21 +15297,39 @@
9130 88SE9128 PCIe SATA 6 Gb/s RAID controller with HyperDuo
1043 8438 P8P67 Deluxe Motherboard
9172 88SE9172 SATA 6Gb/s Controller
+ 917a 88SE9172 SATA III 6Gb/s RAID Controller
+ 9192 88SE9172 SATA III 6Gb/s RAID Controller
91a0 88SE91A0 SATA 6Gb/s Controller
- 91a4 88SE91A4 SATA 6Gb/s Controller
+ 91a4 88SE9128 IDE Controller
+ 9230 88SE9230 PCIe SATA 6Gb/s Controller
9480 88SE9480 SAS/SATA 6Gb/s RAID controller
1b55 NetUP Inc.
2a2c Dual DVB-S2-CI card
e2e4 Dual DVB-T/C-CI RF card
+# 2xHDMI and 2xHD-SDI inputs
+ e5f4 MPEG2 and H264 Encoder-Transcoder
+ f1c4 Dual ASI-RX/TX-CI card
1b6f Etron Technology, Inc.
7023 EJ168 USB 3.0 Host Controller
+ 7052 EJ188/EJ198 USB 3.0 Host Controller
1b73 Fresco Logic
1000 FL1000G USB 3.0 Host Controller
+ 1d5c 1000 Anker USB 3.0 Express Card
+ 1009 FL1009 USB 3.0 Host Controller
+1b74 OpenVox Communication Co. Ltd.
+ 0115 D115P/D115E Single-port E1/T1 card
+ d130 D130P/D130E Single-port E1/T1 card (3rd GEN)
+ d210 D210P/D210E Dual-port E1/T1 card(2nd generation)
+ d230 D230 Dual-port E1/T1 card (2nd generation)
+ d410 D410/430 Quad-port E1/T1 card
+ d430 D410/430 Quad-port E1/T1 card
1b85 OCZ Technology Group, Inc.
1041 RevoDrive 3 X2 PCI-Express SSD 240 GB (Marvell Controller)
1b96 Western Digital
1b9a XAVi Technologies Corp.
1bad ReFLEX CES
+1bb0 SimpliVity Corporation
+ 0002 OmniCube Accelerator OA-3000
1bb3 Bluecherry
4304 BC-04120A MPEG4 4 port video encoder / decoder
4309 BC-08240A MPEG4 4 port video encoder / decoder
@@ -14962,16 +15343,23 @@
1bb5 Quantenna Communications, Inc.
1bbf Maxeler Technologies Ltd.
0003 MAX3
+ 0004 MAX4
1bf4 VTI Instruments Corporation
1c1c Symphony
0001 82C101
1c2c Fiberblaze
# Used on V120 VME Crate Controller
1c32 Highland Technology, Inc.
+1c3b Accensus, LLC
+ 0200 Telas2
1c44 Enmotus Inc
8000 8000 Storage IO Controller
+1c7f Elektrobit Austria GmbH
+ 5100 EB5100
+1c8a TSF5 Corporation
1d44 DPT
a400 PM2x24/PM3224
+1d5c Fantasia Trading LLC
1de1 Tekram Technology Co.,Ltd.
0391 TRM-S1040
2020 DC-390
@@ -15020,6 +15408,7 @@
2003 Smart Link Ltd.
8800 LM-I56N
2004 Smart Link Ltd.
+20f4 TRENDnet
2116 ZyDAS Technology Corp.
21c3 21st Century Computer Corp.
# (Probably only the Mobile Phone Division)
@@ -15499,8 +15888,6 @@
1092 5a55 Viper II Z200
1092 5a57 Viper II Z200
ca00 SonicVibes
-53c1 SC1-ALLEGRO
- 0cd1 CD1-OPERA
5431 AuzenTech, Inc.
544c Teralogic Inc
0350 TL880-based HDTV/ATSC tuner
@@ -15585,13 +15972,13 @@
004b Core Processor Secondary PCI Express Root Port
0050 Core Processor Thermal Management Controller
0069 Core Processor DRAM Controller
- 0082 Centrino Advanced-N 6205
+ 0082 Centrino Advanced-N 6205 [Taylor Peak]
8086 1301 Centrino Advanced-N 6205 AGN
8086 1306 Centrino Advanced-N 6205 ABG
8086 1307 Centrino Advanced-N 6205 BG
8086 1321 Centrino Advanced-N 6205 AGN
8086 1326 Centrino Advanced-N 6205 ABG
- 0083 Centrino Wireless-N 1000
+ 0083 Centrino Wireless-N 1000 [Condor Peak]
8086 1205 Centrino Wireless-N 1000 BGN
8086 1206 Centrino Wireless-N 1000 BG
8086 1225 Centrino Wireless-N 1000 BGN
@@ -15600,35 +15987,35 @@
8086 1306 Centrino Wireless-N 1000 BG
8086 1325 Centrino Wireless-N 1000 BGN
8086 1326 Centrino Wireless-N 1000 BG
- 0084 Centrino Wireless-N 1000
+ 0084 Centrino Wireless-N 1000 [Condor Peak]
8086 1215 Centrino Wireless-N 1000 BGN
8086 1216 Centrino Wireless-N 1000 BG
8086 1315 Centrino Wireless-N 1000 BGN
8086 1316 Centrino Wireless-N 1000 BG
- 0085 Centrino Advanced-N 6205
+ 0085 Centrino Advanced-N 6205 [Taylor Peak]
8086 1311 Centrino Advanced-N 6205 AGN
8086 1316 Centrino Advanced-N 6205 ABG
- 0087 Centrino Advanced-N + WiMAX 6250
+ 0087 Centrino Advanced-N + WiMAX 6250 [Kilmer Peak]
8086 1301 Centrino Advanced-N + WiMAX 6250 2x2 AGN
8086 1306 Centrino Advanced-N + WiMAX 6250 2x2 ABG
8086 1321 Centrino Advanced-N + WiMAX 6250 2x2 AGN
8086 1326 Centrino Advanced-N + WiMAX 6250 2x2 ABG
- 0089 Centrino Advanced-N + WiMAX 6250
+ 0089 Centrino Advanced-N + WiMAX 6250 [Kilmer Peak]
8086 1311 Centrino Advanced-N + WiMAX 6250 2x2 AGN
8086 1316 Centrino Advanced-N + WiMAX 6250 2x2 ABG
- 008a Centrino Wireless-N 1030
+ 008a Centrino Wireless-N 1030 [Rainbow Peak]
8086 5305 Centrino Wireless-N 1030 BGN
8086 5307 Centrino Wireless-N 1030 BG
8086 5325 Centrino Wireless-N 1030 BGN
8086 5327 Centrino Wireless-N 1030 BG
- 008b Centrino Wireless-N 1030
+ 008b Centrino Wireless-N 1030 [Rainbow Peak]
8086 5315 Centrino Wireless-N 1030 BGN
8086 5317 Centrino Wireless-N 1030 BG
- 0090 Centrino Advanced-N 6230
+ 0090 Centrino Advanced-N 6230 [Rainbow Peak]
8086 5211 Centrino Advanced-N 6230 AGN
8086 5215 Centrino Advanced-N 6230 BGN
8086 5216 Centrino Advanced-N 6230 ABG
- 0091 Centrino Advanced-N 6230
+ 0091 Centrino Advanced-N 6230 [Rainbow Peak]
8086 5201 Centrino Advanced-N 6230 AGN
8086 5205 Centrino Advanced-N 6230 BGN
8086 5206 Centrino Advanced-N 6230 ABG
@@ -15641,10 +16028,14 @@
1043 844d P8P67 Deluxe Motherboard
0101 Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port
1028 04b2 Vostro 3350
+ 106b 00dc MacBookPro8,2 [Core i7, 15", 2011]
0102 2nd Generation Core Processor Family Integrated Graphics Controller
0104 2nd Generation Core Processor Family DRAM Controller
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
+ 106b 00dc MacBookPro8,2 [Core i7, 15", 2011]
0105 Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port
+ 106b 00dc MacBookPro8,2 [Core i7, 15", 2011]
0106 2nd Generation Core Processor Family Integrated Graphics Controller
0108 Xeon E3-1200 Processor Family DRAM Controller
0109 Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port
@@ -15655,26 +16046,30 @@
010e Xeon E3-1200/2nd Generation Core Processor Family Integrated Graphics Controller
0112 2nd Generation Core Processor Family Integrated Graphics Controller
0116 2nd Generation Core Processor Family Integrated Graphics Controller
+ 1028 04da Vostro 3750
0122 2nd Generation Core Processor Family Integrated Graphics Controller
0126 2nd Generation Core Processor Family Integrated Graphics Controller
1028 04cc Vostro 3350
- 0150 Ivy Bridge DRAM Controller
- 0151 Ivy Bridge PCI Express Root Port
- 0152 Ivy Bridge Graphics Controller
- 0154 Ivy Bridge DRAM Controller
- 0155 Ivy Bridge PCI Express Root Port
- 0156 Ivy Bridge Graphics Controller
- 0158 Ivy Bridge DRAM Controller
- 0159 Ivy Bridge PCI Express Root Port
- 015a Ivy Bridge Graphics Controller
- 015c Ivy Bridge DRAM Controller
- 015d Ivy Bridge PCI Express Root Port
- 015e Ivy Bridge Graphics Controller
- 0162 Ivy Bridge Graphics Controller
- 0166 Ivy Bridge Graphics Controller
- 016a Ivy Bridge Graphics Controller
- 0172 Ivy Bridge Graphics Controller
- 0176 Ivy Bridge Graphics Controller
+ 0150 Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller
+ 0151 Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port
+ 1043 1477 N56VZ
+ 0152 Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller
+ 0154 3rd Gen Core processor DRAM Controller
+ 1043 1477 N56VZ
+ 0155 Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port
+ 0156 3rd Gen Core processor Graphics Controller
+ 0158 Xeon E3-1200 v2/Ivy Bridge DRAM Controller
+ 0159 Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port
+ 015a Xeon E3-1200 v2/Ivy Bridge Graphics Controller
+ 015c Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller
+ 015d Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port
+ 015e Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller
+ 0162 Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller
+ 0166 3rd Gen Core processor Graphics Controller
+ 1043 2103 N56VZ
+ 016a Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller
+ 0172 Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller
+ 0176 3rd Gen Core processor Graphics Controller
0309 80303 I/O Processor PCI-to-PCI Bridge
030d 80312 I/O Companion Chip PCI-to-PCI Bridge
0326 6700/6702PXH I/OxAPIC Interrupt Controller A
@@ -15704,7 +16099,7 @@
0412 Haswell Integrated Graphics Controller
0416 Haswell Integrated Graphics Controller
041a Haswell Integrated Graphics Controller
- 0436 DH89xxCC Gigabit SGMII Connection
+ 0436 DH8900CC Null Device
0438 DH8900CC Series Gigabit Network Connection
043a DH8900CC Series Gigabit Fiber Network Connection
043c DH8900CC Series Gigabit Backplane Network Connection
@@ -15827,6 +16222,12 @@
0960 80960RP (i960RP) Microprocessor/Bridge
0962 80960RM (i960RM) Bridge
0964 80960RP (i960RP) Microprocessor/Bridge
+ 0a04 Haswell-ULT DRAM Controller
+ 0a06 Haswell-ULT Integrated Graphics Controller
+ 0a16 Haswell-ULT Integrated Graphics Controller
+ 0a22 Haswell-ULT Integrated Graphics Controller
+ 0a26 Haswell-ULT Integrated Graphics Controller
+ 0a2a Haswell-ULT Integrated Graphics Controller
0be0 Atom Processor D2xxx/N2xxx Integrated Graphics Controller
0be1 Atom Processor D2xxx/N2xxx Integrated Graphics Controller
0be2 Atom Processor D2xxx/N2xxx Integrated Graphics Controller
@@ -15884,6 +16285,197 @@
0c7d Centerton Internal Fabric
0c7e Centerton Internal Fabric
0c7f Centerton Internal Fabric
+ 0e00 Ivytown DMI2
+ 0e01 Ivytown PCI Express Root Port in DMI2 Mode
+ 0e04 Ivytown PCI Express Root Port 2a
+ 0e05 Ivytown PCI Express Root Port 2b
+ 0e06 Ivytown PCI Express Root Port 2c
+ 0e07 Ivytown PCI Express Root Port 2d
+ 0e08 Ivytown PCI Express Root Port 3a
+ 0e09 Ivytown PCI Express Root Port 3b
+ 0e0a Ivytown PCI Express Root Port 3c
+ 0e0b Ivytown PCI Express Root Port 3d
+ 0e1c Ivytown Debug and Error Injection Related Registers
+ 0e1d Ivytown R2PCIe
+ 0e1e Ivytown Semaphore and Scratchpad Configuration Registers
+ 0e1f Ivytown Semaphore and Scratchpad Configuration Registers
+ 0e20 Ivytown Crystal Beach DMA Channel 0
+ 0e21 Ivytown Crystal Beach DMA Channel 1
+ 0e22 Ivytown Crystal Beach DMA Channel 2
+ 0e23 Ivytown Crystal Beach DMA Channel 3
+ 0e24 Ivytown Crystal Beach DMA Channel 4
+ 0e25 Ivytown Crystal Beach DMA Channel 5
+ 0e26 Ivytown Crystal Beach DMA Channel 6
+ 0e27 Ivytown Crystal Beach DMA Channel 7
+ 0e28 Ivytown VTd/Memory Map/Misc
+ 0e29 Ivytown Memory Hotplug
+ 0e2a Ivytown IIO RAS
+ 0e2c Ivytown IOAPIC
+ 0e2e Ivytown CBDMA
+ 0e2f Ivytown CBDMA
+ 0e30 Ivytown Home Agent 0
+ 0e32 Ivytown QPI Link 0
+ 0e33 Ivytown QPI Link 1
+ 0e34 Ivytown PCI Express Ring Performance Monitoring
+ 0e36 Ivytown QPI Ring Performance Ring Monitoring
+ 0e37 Ivytown QPI Ring Performance Ring Monitoring
+ 0e38 Ivytown Home Agent 1
+ 0e3a Ivytown QPI Link 2
+ 0e3e Ivytown QPI Ring Performance Ring Monitoring
+ 0e3f Ivytown QPI Ring Performance Ring Monitoring
+ 0e40 Ivytown QPI Link 2
+ 0e41 Ivytown QPI Ring Registers
+ 0e43 Ivytown QPI Link Reut 2
+ 0e44 Ivytown QPI Link Reut 2
+ 0e60 Ivytown Home Agent 1
+ 0e68 Ivytown Integrated Memory Controller 1 Target Address/Thermal Registers
+ 0e6a Ivytown Integrated Memory Controller 1 Channel Target Address Decoder Registers
+ 0e6b Ivytown Integrated Memory Controller 1 Channel Target Address Decoder Registers
+ 0e6c Ivytown Integrated Memory Controller 1 Channel Target Address Decoder Registers
+ 0e6d Ivytown Integrated Memory Controller 1 Channel Target Address Decoder Registers
+ 0e71 Ivytown Integrated Memory Controller 0 RAS Registers
+ 0e79 Ivytown Integrated Memory Controller 1 RAS Registers
+ 0e80 Ivytown QPI Link 0
+ 0e81 Ivytown QPI Ring Registers
+ 0e83 Ivytown QPI Link Reut 0
+ 0e84 Ivytown QPI Link Reut 0
+ 0e90 Ivytown QPI Link 1
+ 0e93 Ivytown QPI Link 1
+ 0e94 Ivytown QPI Link Reut 1
+ 0ea0 Ivytown Home Agent 0
+ 0ea8 Ivytown Integrated Memory Controller 0 Target Address/Thermal Registers
+ 0eaa Ivytown Integrated Memory Controller 0 Channel Target Address Decoder Registers
+ 0eab Ivytown Integrated Memory Controller 0 Channel Target Address Decoder Registers
+ 0eac Ivytown Integrated Memory Controller 0 Channel Target Address Decoder Registers
+ 0ead Ivytown Integrated Memory Controller 0 Channel Target Address Decoder Registers
+ 0eb0 Ivytown Integrated Memory Controller 1 Channel 0-3 Thermal Control 0
+ 0eb1 Ivytown Integrated Memory Controller 1 Channel 0-3 Thermal Control 1
+ 0eb2 Ivytown Integrated Memory Controller 1 Channel 0-3 ERROR Registers 0
+ 0eb3 Ivytown Integrated Memory Controller 1 Channel 0-3 ERROR Registers 1
+ 0eb4 Ivytown Integrated Memory Controller 1 Channel 0-3 Thermal Control 2
+ 0eb5 Ivytown Integrated Memory Controller 1 Channel 0-3 Thermal Control 3
+ 0eb7 Ivytown Integrated Memory Controller 1 Channel 0-3 ERROR Registers 2
+ 0ec0 Ivytown Power Control Unit 0
+ 0ec1 Ivytown Power Control Unit 1
+ 0ec2 Ivytown Power Control Unit 2
+ 0ec3 Ivytown Power Control Unit 3
+ 0ec4 Ivytown Power Control Unit 4
+ 0ec8 Ivytown System Address Decoder
+ 0ec9 Ivytown Broadcast Registers
+ 0eca Ivytown Broadcast Registers
+ 0ed8 Ivytown DDRIO
+ 0ed9 Ivytown DDRIO
+ 0edc Ivytown DDRIO
+ 0edd Ivytown DDRIO
+ 0ede Ivytown DDRIO
+ 0edf Ivytown DDRIO
+ 0ee0 Ivytown Unicast Registers
+ 0ee1 Ivytown Unicast Registers
+ 0ee2 Ivytown Unicast Registers
+ 0ee3 Ivytown Unicast Registers
+ 0ee4 Ivytown Unicast Registers
+ 0ee5 Ivytown Unicast Registers
+ 0ee6 Ivytown Unicast Registers
+ 0ee7 Ivytown Unicast Registers
+ 0ee8 Ivytown Unicast Registers
+ 0ee9 Ivytown Unicast Registers
+ 0eea Ivytown Unicast Registers
+ 0eeb Ivytown Unicast Registers
+ 0eec Ivytown Unicast Registers
+ 0eed Ivytown Unicast Registers
+ 0eee Ivytown Unicast Registers
+ 0ef0 Ivytown Integrated Memory Controller 0 Channel 0-3 Thermal Control 0
+ 0ef1 Ivytown Integrated Memory Controller 0 Channel 0-3 Thermal Control 1
+ 0ef2 Ivytown Integrated Memory Controller 0 Channel 0-3 ERROR Registers 0
+ 0ef3 Ivytown Integrated Memory Controller 0 Channel 0-3 ERROR Registers 2
+ 0ef4 Ivytown Integrated Memory Controller 0 Channel 0-3 Thermal Control 2
+ 0ef5 Ivytown Integrated Memory Controller 0 Channel 0-3 Thermal Control 3
+ 0ef7 Ivytown Integrated Memory Controller 0 Channel 0-3 ERROR Registers 3
+ 0ef8 Ivytown DDRIO
+ 0ef9 Ivytown DDRIO
+ 0efa Ivytown DDRIO
+ 0efb Ivytown DDRIO
+ 0efc Ivytown DDRIO
+ 0efd Ivytown DDRIO
+ 0f00 ValleyView SSA-CUnit
+ 0f01 ValleyView SSA-CUnit
+ 0f02 ValleyView SSA-CUnit
+ 0f03 ValleyView SSA-CUnit
+ 0f04 ValleyView High Definition Audio Controller
+ 0f05 ValleyView High Definition Audio Controller
+ 0f06 ValleyView LPIO1 DMA Controller
+ 0f07 ValleyView LPIO1 DMA Controller
+ 0f08 ValleyView LPIO1 PWM Controller
+ 0f09 ValleyView LPIO1 PWM Controller
+ 0f0a ValleyView LPIO1 HSUART Controller #1
+ 0f0b ValleyView LPIO1 HSUART Controller #1
+ 0f0c ValleyView LPIO1 HSUART Controller #2
+ 0f0d ValleyView LPIO1 HSUART Controller #2
+ 0f0e ValleyView LPIO1 SPI Controller
+ 0f0f ValleyView LPIO1 SPI Controller
+ 0f10 ValleyView LPIO1 Controller
+ 0f11 ValleyView LPIO1 Controller
+ 0f12 ValleyView SMBus Controller
+ 0f13 ValleyView SMBus Controller
+ 0f14 ValleyView SDIO Controller
+ 0f15 ValleyView SDIO Controller
+ 0f16 ValleyView SDIO Controller
+ 0f17 ValleyView SDIO Controller
+ 0f18 ValleyView SEC
+ 0f19 ValleyView SEC
+ 0f1a ValleyView SEC
+ 0f1b ValleyView SEC
+ 0f1c ValleyView Power Control Unit
+ 0f1d ValleyView Power Control Unit
+ 0f1e ValleyView Power Control Unit
+ 0f1f ValleyView Power Control Unit
+ 0f20 ValleyView 4-Port SATA Storage Controller
+ 0f21 ValleyView 4-Port SATA Storage Controller
+ 0f22 ValleyView 6-Port SATA AHCI Controller
+ 0f23 ValleyView 6-Port SATA AHCI Controller
+ 0f24 ValleyView SATA RAID Storage Controller
+ 0f25 ValleyView SATA RAID Storage Controller
+ 0f26 ValleyView 2-Port SATA Storage Controller
+ 0f27 ValleyView 2-Port SATA Storage Controller
+ 0f28 ValleyView LPE Audio Controller
+ 0f29 ValleyView LPE Audio Controller
+ 0f2a ValleyView LPE Audio Controller
+ 0f2b ValleyView LPE Audio Controller
+ 0f2e ValleyView SATA RAID Storage Controller
+ 0f2f ValleyView SATA RAID Storage Controller
+ 0f30 ValleyView Gen7
+ 0f31 ValleyView Gen7
+ 0f32 ValleyView Gen7
+ 0f33 ValleyView Gen7
+ 0f34 ValleyView USB Enhanced Host Controller
+ 0f35 ValleyView USB xHCI Host Controller
+ 0f36 ValleyView USB xHCI Host Controller
+ 0f37 ValleyView OTG
+ 0f38 ValleyView ISP
+ 0f39 ValleyView ISP
+ 0f3a ValleyView ISP
+ 0f3b ValleyView ISP
+ 0f3c ValleyView ISP
+ 0f3d ValleyView ISP
+ 0f3e ValleyView ISP
+ 0f3f ValleyView ISP
+ 0f40 ValleyView LPIO2 DMA Controller
+ 0f41 ValleyView LPIO2 I2C Controller #1
+ 0f42 ValleyView LPIO2 I2C Controller #2
+ 0f43 ValleyView LPIO2 I2C Controller #3
+ 0f44 ValleyView LPIO2 I2C Controller #4
+ 0f45 ValleyView LPIO2 I2C Controller #5
+ 0f46 ValleyView LPIO2 I2C Controller #6
+ 0f47 ValleyView LPIO2 I2C Controller #7
+ 0f48 ValleyView PCI Express Root Port
+ 0f49 ValleyView PCI Express Root Port
+ 0f4a ValleyView PCI Express Root Port
+ 0f4b ValleyView PCI Express Root Port
+ 0f4c ValleyView PCI Express Root Port
+ 0f4d ValleyView PCI Express Root Port
+ 0f4e ValleyView PCI Express Root Port
+ 0f4f ValleyView PCI Express Root Port
+ 0f50 ValleyView MIPI-HSI Controller
1000 82542 Gigabit Ethernet Controller (Fiber)
0e11 b0df NC6132 Gigabit Ethernet Adapter (1000-SX)
0e11 b0e0 NC6133 Gigabit Ethernet Adapter (1000-LX)
@@ -16254,6 +16846,7 @@
103c 323f NC362i Integrated Dual port Gigabit Server Adapter
10a9 8028 UV-BaseIO dual-port GbE
13a3 0037 DS4100 Secure Multi-Gigabit Server Adapter with Compression
+ 15d9 a811 H8DGU
8086 a01c Gigabit ET Dual Port Server Adapter
8086 a03c Gigabit ET Dual Port Server Adapter
8086 a04c Gigabit ET Dual Port Server Adapter
@@ -16298,6 +16891,7 @@
8086 a02b Gigabit ET Quad Port Server Adapter
8086 a02c Gigabit ET Quad Port Server Adapter
10ea 82577LM Gigabit Network Connection
+ 1028 040a Latitude E6410
1028 040b Latitude E6510
e4bf 50c1 PC1-GROOVE
10eb 82577LC Gigabit Network Connection
@@ -16306,6 +16900,7 @@
8086 a11f 10-Gigabit CX4 Dual Port Server Adapter
10ed 82599 Ethernet Controller Virtual Function
10ef 82578DM Gigabit Network Connection
+ 1028 02da OptiPlex 980
10f0 82578DC Gigabit Network Connection
10f1 82598EB 10-Gigabit AF Dual Port Network Connection
8086 a20f 10-Gigabit AF DA Dual Port Server Adapter
@@ -16325,6 +16920,7 @@
8086 000c Ethernet X520 10GbE Dual Port KX4-KR Mezz
10f9 82599EB 10 Gigabit CX4 Dual Port Network Connection
10fb 82599EB 10-Gigabit SFI/SFP+ Network Connection
+ 1028 1f72 Ethernet 10G 4P X520/I350 rNDC
103c 17d0 Ethernet 10Gb 2-port 560FLR-SFP+ Adapter
103c 17d2 Ethernet 10Gb 2-port 560M Adapter
103c 17d3 Ethernet 10Gb 2-port 560SFP+ Adapter
@@ -16628,8 +17224,10 @@
8086 0001 Ethernet Server Adapter I340-F4
8086 0002 Ethernet Server Adapter I340-F4
1528 Ethernet Controller 10-Gigabit X540-AT2
+ 103c 192d 561FLR-T 2-port 10Gb Ethernet Adapter
108e 7b14 Sun Dual Port 10 GbE PCIe 2.0 ExpressModule, Base-T
108e 7b15 Sun Dual Port 10 GbE PCIe 2.0 Low Profile Adapter, Base-T
+ 1137 00bf Ethernet Converged Network Adapter X540-T2
8086 0001 Ethernet Converged Network Adapter X540-T2
8086 0002 Ethernet Converged Network Adapter X540-T1
8086 001a Ethernet Converged Network Adapter X540-T2
@@ -16638,12 +17236,26 @@
8086 5003 Ethernet 10G 2P X540-t Adapter
1529 82599 10 Gigabit Dual Port Backplane Connection with FCoE
152a 82599 10 Gigabit Dual port Network Connection with FCoE
+ 1533 I210 Gigabit Network Connection
+ 103c 0003 Ethernet Server Adapter I210-T1
+ 8086 0001 Ethernet Server Adapter I210-T1
+ 8086 0002 Ethernet Server Adapter I210-T1
+ 1534 I210 Gigabit Network Connection
+ 1536 I210 Gigabit Fiber Network Connection
+ 1537 I210 Gigabit Backplane Connection
+ 1538 I210 Gigabit Network Connection
+ 1539 I211 Gigabit Network Connection
+ 153a Ethernet Connection I217-LM
+ 153b Ethernet Connection I217-V
+ 1547 DSL3510 Thunderbolt Port [Cactus Ridge]
+ 1549 DSL3510 Thunderbolt Controller [Cactus Ridge]
154a Ethernet Server Adapter X520-4
8086 011a Ethernet Converged Network Adapter X520-4
8086 011b Ethernet Converged Network Adapter X520-4
8086 011c Ethernet Converged Network Adapter X520-4
154d 82599EB 10-Gigabit SFP+ Network Connection
8086 7b11 10GbE 2P X520 Adapter
+ 1560 Ethernet Controller X540-AT1
1960 80960RP (i960RP) Microprocessor
101e 0431 MegaRAID 431 RAID Controller
101e 0438 MegaRAID 438 Ultra2 LVD RAID Controller
@@ -16694,45 +17306,66 @@
1043 844d P8P67 Deluxe Motherboard
1c03 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c04 6 Series/C200 Series Chipset Family SATA RAID Controller
1c05 6 Series/C200 Series Chipset Family SATA RAID Controller
1c08 6 Series/C200 Series Chipset Family 2 port SATA IDE Controller
1c09 6 Series/C200 Series Chipset Family 2 port SATA IDE Controller
1c10 6 Series/C200 Series Chipset Family PCI Express Root Port 1
+ 1028 04da Vostro 3750
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c12 6 Series/C200 Series Chipset Family PCI Express Root Port 2
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c14 6 Series/C200 Series Chipset Family PCI Express Root Port 3
+ 1028 04da Vostro 3750
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c16 6 Series/C200 Series Chipset Family PCI Express Root Port 4
1c18 6 Series/C200 Series Chipset Family PCI Express Root Port 5
+ 1028 04da Vostro 3750
1c1a 6 Series/C200 Series Chipset Family PCI Express Root Port 6
+ 1028 04da Vostro 3750
1c1c 6 Series/C200 Series Chipset Family PCI Express Root Port 7
1c1e 6 Series/C200 Series Chipset Family PCI Express Root Port 8
1c20 6 Series/C200 Series Chipset Family High Definition Audio Controller
1028 0490 Alienware M17x R3
1028 04aa XPS 8300
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
1043 8418 P8P67 Deluxe Motherboard
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c22 6 Series/C200 Series Chipset Family SMBus Controller
1028 04aa XPS 8300
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
1043 844d P8P67 Deluxe Motherboard
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c24 6 Series/C200 Series Chipset Family Thermal Management Controller
1c25 6 Series/C200 Series Chipset Family DMI to PCI Bridge
1c26 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1
1028 04aa XPS 8300
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
1043 844d P8P67 Deluxe Motherboard
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c27 6 Series/C200 Series Chipset Family USB Universal Host Controller #1
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c2c 6 Series/C200 Series Chipset Family USB Universal Host Controller #5
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c2d 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2
1028 04aa XPS 8300
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
1043 844d P8P67 Deluxe Motherboard
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c33 6 Series/C200 Series Chipset Family LAN Controller
1c35 6 Series/C200 Series Chipset Family VECI Controller
1c3a 6 Series/C200 Series Chipset Family MEI Controller #1
1028 04aa XPS 8300
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
1043 844d P8P67 Deluxe Motherboard
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c3b 6 Series/C200 Series Chipset Family MEI Controller #2
1c3c 6 Series/C200 Series Chipset Family IDE-r Controller
1c3d 6 Series/C200 Series Chipset Family KT Controller
@@ -16747,10 +17380,12 @@
1c47 UM67 Express Chipset Family LPC Controller
1c48 6 Series/C200 Series Chipset Family LPC Controller
1c49 HM65 Express Chipset Family LPC Controller
+ 8086 7270 Apple MacBookPro8,2 [Core i7, 15", 2011]
1c4a H67 Express Chipset Family LPC Controller
1028 04aa XPS 8300
1c4b HM67 Express Chipset Family LPC Controller
1028 04b2 Vostro 3350
+ 1028 04da Vostro 3750
1c4c Q65 Express Chipset Family LPC Controller
1c4d QS67 Express Chipset Family LPC Controller
1c4e Q67 Express Chipset Family LPC Controller
@@ -16835,69 +17470,79 @@
1d72 C608 chipset SMBus Controller 2
1d74 C608/C606/X79 series chipset PCI Express Upstream Port
1d76 C600/X79 series chipset Multi-Function Glue
- 1e00 Panther Point 4 port SATA Controller [IDE mode]
- 1e01 Panther Point 4 port SATA Controller [IDE mode]
- 1e02 Panther Point 6 port SATA Controller [AHCI mode]
- 1e03 Panther Point 6 port SATA Controller [AHCI mode]
- 1e04 Panther Point SATA Controller [RAID mode]
- 1e05 Panther Point SATA Controller [RAID mode]
- 1e06 Panther Point SATA Controller [Premium RAID mode]
- 1e07 Panther Point SATA Controller [Premium RAID mode]
- 1e08 Panther Point 2 port SATA Controller [IDE mode]
- 1e09 Panther Point 2 port SATA Controller [IDE mode]
- 1e0e Panther Point SATA Controller [RAID mode]
- 1e10 Panther Point PCI Express Root Port 1
- 1e12 Panther Point PCI Express Root Port 2
- 1e14 Panther Point PCI Express Root Port 3
- 1e16 Panther Point PCI Express Root Port 4
- 1e18 Panther Point PCI Express Root Port 5
- 1e1a Panther Point PCI Express Root Port 6
- 1e1c Panther Point PCI Express Root Port 7
- 1e1e Panther Point PCI Express Root Port 8
- 1e20 Panther Point High Definition Audio Controller
- 1e22 Panther Point SMBus Controller
- 1e24 Panther Point Thermal Management Controller
- 1e25 Panther Point DMI to PCI Bridge
- 1e26 Panther Point USB Enhanced Host Controller #1
- 1e2d Panther Point USB Enhanced Host Controller #2
- 1e31 Panther Point USB xHCI Host Controller
- 1e33 Panther Point LAN Controller
- 1e3a Panther Point MEI Controller #1
- 1e3b Panther Point MEI Controller #2
- 1e3c Panther Point IDE-r Controller
- 1e3d Panther Point KT Controller
- 1e40 Panther Point LPC Controller
- 1e41 Panther Point LPC Controller
- 1e42 Panther Point LPC Controller
- 1e43 Panther Point LPC Controller
- 1e44 Panther Point LPC Controller
- 1e45 Panther Point LPC Controller
- 1e46 Panther Point LPC Controller
- 1e47 Panther Point LPC Controller
- 1e48 Panther Point LPC Controller
- 1e49 Panther Point LPC Controller
- 1e4a Panther Point LPC Controller
- 1e4b Panther Point LPC Controller
- 1e4c Panther Point LPC Controller
- 1e4d Panther Point LPC Controller
- 1e4e Panther Point LPC Controller
- 1e4f Panther Point LPC Controller
- 1e50 Panther Point LPC Controller
- 1e51 Panther Point LPC Controller
- 1e52 Panther Point LPC Controller
- 1e53 Panther Point LPC Controller
- 1e54 Panther Point LPC Controller
- 1e55 Panther Point LPC Controller
- 1e56 Panther Point LPC Controller
- 1e57 Panther Point LPC Controller
- 1e58 Panther Point LPC Controller
- 1e59 Panther Point LPC Controller
- 1e5a Panther Point LPC Controller
- 1e5b Panther Point LPC Controller
- 1e5c Panther Point LPC Controller
- 1e5d Panther Point LPC Controller
- 1e5e Panther Point LPC Controller
- 1e5f Panther Point LPC Controller
+ 1e00 7 Series/C210 Series Chipset Family 4-port SATA Controller [IDE mode]
+ 1e01 7 Series Chipset Family 4-port SATA Controller [IDE mode]
+ 1e02 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode]
+ 1e03 7 Series Chipset Family 6-port SATA Controller [AHCI mode]
+ 1043 1477 N56VZ
+ 1e04 7 Series/C210 Series Chipset Family SATA Controller [RAID mode]
+ 1e05 7 Series Chipset SATA Controller [RAID mode]
+ 1e06 7 Series/C210 Series Chipset Family SATA Controller [RAID mode]
+ 1e07 7 Series Chipset Family SATA Controller [RAID mode]
+ 1e08 7 Series/C210 Series Chipset Family 2-port SATA Controller [IDE mode]
+ 1e09 7 Series Chipset Family 2-port SATA Controller [IDE mode]
+ 1e0e 7 Series/C210 Series Chipset Family SATA Controller [RAID mode]
+ 1e10 7 Series/C210 Series Chipset Family PCI Express Root Port 1
+ 1043 1477 N56VZ
+ 1e12 7 Series/C210 Series Chipset Family PCI Express Root Port 2
+ 1043 1477 N56VZ
+ 1e14 7 Series/C210 Series Chipset Family PCI Express Root Port 3
+ 1e16 7 Series/C210 Series Chipset Family PCI Express Root Port 4
+ 1043 1477 N56VZ
+ 1e18 7 Series/C210 Series Chipset Family PCI Express Root Port 5
+ 1e1a 7 Series/C210 Series Chipset Family PCI Express Root Port 6
+ 1e1c 7 Series/C210 Series Chipset Family PCI Express Root Port 7
+ 1e1e 7 Series/C210 Series Chipset Family PCI Express Root Port 8
+ 1e20 7 Series/C210 Series Chipset Family High Definition Audio Controller
+ 1043 1477 N56VZ
+ 1e22 7 Series/C210 Series Chipset Family SMBus Controller
+ 1043 1477 N56VZ
+ 1e24 7 Series/C210 Series Chipset Family Thermal Management Controller
+ 1e25 7 Series/C210 Series Chipset Family DMI to PCI Bridge
+ 1e26 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
+ 1043 1477 N56VZ
+ 1e2d 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
+ 1043 1477 N56VZ
+ 1e31 7 Series/C210 Series Chipset Family USB xHCI Host Controller
+ 1043 1477 N56VZ
+ 1e33 7 Series/C210 Series Chipset Family LAN Controller
+ 1e3a 7 Series/C210 Series Chipset Family MEI Controller #1
+ 1043 1477 N56VZ
+ 1e3b 7 Series/C210 Series Chipset Family MEI Controller #2
+ 1e3c 7 Series/C210 Series Chipset Family IDE-r Controller
+ 1e3d 7 Series/C210 Series Chipset Family KT Controller
+ 1e41 7 Series Chipset Family LPC Controller
+ 1e42 7 Series Chipset Family LPC Controller
+ 1e43 7 Series Chipset Family LPC Controller
+ 1e44 Z77 Express Chipset LPC Controller
+ 1e45 7 Series Chipset Family LPC Controller
+ 1e46 Z75 Express Chipset LPC Controller
+ 1e47 Q77 Express Chipset LPC Controller
+ 1e48 Q75 Express Chipset LPC Controller
+ 1e49 B75 Express Chipset LPC Controller
+ 1e4a H77 Express Chipset LPC Controller
+ 1e4b 7 Series Chipset Family LPC Controller
+ 1e4c 7 Series Chipset Family LPC Controller
+ 1e4d 7 Series Chipset Family LPC Controller
+ 1e4e 7 Series Chipset Family LPC Controller
+ 1e4f 7 Series Chipset Family LPC Controller
+ 1e50 7 Series Chipset Family LPC Controller
+ 1e51 7 Series Chipset Family LPC Controller
+ 1e52 7 Series Chipset Family LPC Controller
+ 1e53 C216 Series Chipset LPC Controller
+ 1e54 7 Series Chipset Family LPC Controller
+ 1e55 QM77 Express Chipset LPC Controller
+ 1e56 QS77 Express Chipset LPC Controller
+ 1e57 HM77 Express Chipset LPC Controller
+ 1e58 UM77 Express Chipset LPC Controller
+ 1e59 HM76 Express Chipset LPC Controller
+ 1043 1477 N56VZ
+ 1e5a 7 Series Chipset Family LPC Controller
+ 1e5b UM77 Express Chipset LPC Controller
+ 1e5c 7 Series Chipset Family LPC Controller
+ 1e5d HM75 Express Chipset LPC Controller
+ 1e5e 7 Series Chipset Family LPC Controller
+ 1e5f 7 Series Chipset Family LPC Controller
2310 DH89xxCC LPC Controller
2323 DH89xxCC 4 Port SATA AHCI Controller
2330 DH89xxCC SMBus Controller
@@ -16995,7 +17640,6 @@
104d 80df Vaio PCG-FX403
2448 82801 Mobile PCI Bridge
1028 040b Latitude E6510
-# (rev d3) (prog-if (rev d3) (prog-if 01 [Subtractive decode])
103c 0934 HP Compaq nw8240 Mobile Workstation
103c 099c NX6110/NC6120
103c 309f Compaq nx9420 Notebook
@@ -17003,6 +17647,7 @@
103c 30c1 Compaq 6910p
104d 902d VAIO VGN-NR120E
144d c00c P30 notebook
+ 144d c072 Notebook N150P
1734 1055 Amilo M1420
17aa 20ae ThinkPad T61
e4bf cc47 CCG-RUMBA
@@ -17057,6 +17702,7 @@
1014 0267 NetVista A30p
1028 020d Inspiron 530
1028 0211 Optiplex 755
+ 1028 02da OptiPlex 980
103c 2a3b Pavilion A1512X
103c 330b ProLiant ML150 G6 Server
1458 5000 GA-EP45-DS5 Motherboard
@@ -18001,10 +18647,11 @@
10f7 8338 Panasonic CF-Y5 laptop
17aa 2009 ThinkPad T60/R60 series
27bc NM10 Family LPC Controller
+ 144d c072 Notebook N150P
8086 4f4d DeskTop Board D510MO
27bd 82801GHM (ICH7-M DH) LPC Interface Bridge
1025 006c 9814 WKMI
- 27c0 N10/ICH7 Family SATA Controller [IDE mode]
+ 27c0 NM10/ICH7 Family SATA Controller [IDE mode]
1028 01ad OptiPlex GX620
1028 01df PowerEdge SC440
1028 01e6 PowerEdge 860
@@ -18014,9 +18661,10 @@
1462 7236 945P Neo3-F Rev. 2.2 motherboard
1775 11cc CC11/CL11
8086 544e DeskTop Board D945GTP
- 27c1 N10/ICH7 Family SATA Controller [AHCI mode]
+ 27c1 NM10/ICH7 Family SATA Controller [AHCI mode]
1028 01df PowerEdge SC440
103c 2a3b Pavilion A1512X
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
8086 4f4d DeskTop Board D510MO
8086 5842 DeskTop Board D975XBX
@@ -18032,7 +18680,7 @@
103c 30a3 Compaq nw8440
17aa 200d ThinkPad T60/R60 series
27c6 82801GHM (ICH7-M DH) SATA Controller [RAID mode]
- 27c8 N10/ICH 7 Family USB UHCI Controller #1
+ 27c8 NM10/ICH7 Family USB UHCI Controller #1
1025 006c 9814 WKMI
1028 01ad OptiPlex GX620
1028 01d7 XPS M1210
@@ -18045,11 +18693,12 @@
1043 1237 A6J-Q008
1043 8179 P5KPL-VM,P5LD2-VM Mainboard
107b 5048 E4500
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
17aa 200a ThinkPad T60/R60 series
8086 4f4d DeskTop Board D510MO
8086 544e DeskTop Board D945GTP
- 27c9 N10/ICH 7 Family USB UHCI Controller #2
+ 27c9 NM10/ICH7 Family USB UHCI Controller #2
1025 006c 9814 WKMI
1028 01ad OptiPlex GX620
1028 01d7 XPS M1210
@@ -18062,11 +18711,12 @@
1043 1237 A6J-Q008
1043 8179 P5KPL-VM,P5LD2-VM Mainboard
107b 5048 E4500
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
17aa 200a ThinkPad T60/R60 series
8086 4f4d DeskTop Board D510MO
8086 544e DeskTop Board D945GTP
- 27ca N10/ICH 7 Family USB UHCI Controller #3
+ 27ca NM10/ICH7 Family USB UHCI Controller #3
1025 006c 9814 WKMI
1028 01ad OptiPlex GX620
1028 01d7 XPS M1210
@@ -18079,11 +18729,12 @@
1043 1237 A6J-Q008
1043 8179 P5KPL-VM,P5LD2-VM Mainboard
107b 5048 E4500
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
17aa 200a ThinkPad T60/R60 series
8086 4f4d DeskTop Board D510MO
8086 544e DeskTop Board D945GTP
- 27cb N10/ICH 7 Family USB UHCI Controller #4
+ 27cb NM10/ICH7 Family USB UHCI Controller #4
1025 006c 9814 WKMI
1028 01ad OptiPlex GX620
1028 01d7 XPS M1210
@@ -18095,11 +18746,12 @@
1043 1237 A6J-Q008
1043 8179 P5KPL-VM,P5LD2-VM Mainboard
107b 5048 E4500
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
17aa 200a ThinkPad T60/R60 series
8086 4f4d DeskTop Board D510MO
8086 544e DeskTop Board D945GTP
- 27cc N10/ICH 7 Family USB2 EHCI Controller
+ 27cc NM10/ICH7 Family USB2 EHCI Controller
1025 006c 9814 WKMI
1028 01ad OptiPlex GX620
1028 01d7 XPS M1210
@@ -18111,24 +18763,29 @@
103c 30a3 Compaq nw8440
1043 1237 A6J-Q008
1043 8179 P5KPL-VM,P5LD2-VM Mainboard
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
17aa 200b ThinkPad T60/R60 series
8086 4f4d DeskTop Board D510MO
8086 544e DeskTop Board D945GTP
- 27d0 N10/ICH 7 Family PCI Express Port 1
+ 27d0 NM10/ICH7 Family PCI Express Port 1
103c 309f Compaq nx9420 Notebook
103c 30a3 Compaq nw8440
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
- 27d2 N10/ICH 7 Family PCI Express Port 2
+ 27d2 NM10/ICH7 Family PCI Express Port 2
103c 309f Compaq nx9420 Notebook
103c 30a3 Compaq nw8440
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
- 27d4 N10/ICH 7 Family PCI Express Port 3
+ 27d4 NM10/ICH7 Family PCI Express Port 3
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
- 27d6 N10/ICH 7 Family PCI Express Port 4
+ 27d6 NM10/ICH7 Family PCI Express Port 4
103c 30a3 Compaq nw8440
+ 144d c072 Notebook N150P
1775 11cc CC11/CL11
- 27d8 N10/ICH 7 Family High Definition Audio Controller
+ 27d8 NM10/ICH7 Family High Definition Audio Controller
1025 006c 9814 WKMI
1028 01d7 XPS M1210
103c 2a3b Pavilion A1512X
@@ -18145,6 +18802,7 @@
1179 ff10 Toshiba Satellite A100-796 audio (Realtek ALC861)
1179 ff31 AC97 Data Fax SoftModem with SmartCP
1447 1043 Asus A8JP (Analog Devices AD1986A)
+ 144d c072 Notebook N150P
1458 a102 GA-8I945PG-RH Mainboard
152d 0753 Softmodem
1734 10ad Conexant softmodem SmartCP
@@ -18154,7 +18812,7 @@
8086 27d8 DeskTop Board D945GTP
8086 d618 DeskTop Board D510MO
8384 7680 STAC9221 HD Audio Codec
- 27da N10/ICH 7 Family SMBus Controller
+ 27da NM10/ICH7 Family SMBus Controller
1025 006c 9814 WKMI
1028 01ad OptiPlex GX620
1028 01d7 XPS M1210
@@ -18163,13 +18821,14 @@
103c 2a3b Pavilion A1512X
1043 8179 P5KPL-VM Motherboard
10f7 8338 Panasonic CF-Y5 laptop
+ 144d c072 Notebook N150P
1458 5001 GA-8I945PG-RH Mainboard
1775 11cc CC11/CL11
17aa 200f ThinkPad T60/R60 series
8086 4f4d DeskTop Board D510MO
8086 544e DeskTop Board D945GTP
8086 5842 DeskTop Board D975XBX
- 27dc N10/ICH 7 Family LAN Controller
+ 27dc NM10/ICH7 Family LAN Controller
103c 2a3b Pavilion A1512X
8086 308d DeskTop Board D945GTP
27dd 82801G (ICH7 Family) AC'97 Modem Controller
@@ -18260,7 +18919,6 @@
1028 01da OptiPlex 745
1028 01f3 Inspiron 1420
103c 30c0 Compaq 6710b
-# Name mistyped on previous submission
103c 30c1 Compaq 6910p
103c 30cc Pavilion dv6700
103c 30d9 Presario C700
@@ -18444,7 +19102,6 @@
292c 82801IEM (ICH9M-E) SATA Controller [RAID mode]
292d 82801IBM/IEM (ICH9M/ICH9M-E) 2 port SATA Controller [IDE mode]
e4bf cc4d CCM-BOOGIE
- 292e ICH9M SATA IDE Controller
2930 82801I (ICH9 Family) SMBus Controller
1028 020d Inspiron 530
1028 0211 Optiplex 755
@@ -18895,11 +19552,15 @@
2e16 4 Series Chipset PT IDER Controller
2e17 4 Series Chipset Serial KT Controller
2e20 4 Series Chipset DRAM Controller
+ 1043 82d3 P5Q Deluxe Motherboard
1458 5000 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
2e21 4 Series Chipset PCI Express Root Port
+ 1043 82d3 P5Q Deluxe Motherboard
1458 5000 GA-EP45-DS5 Motherboard
2e22 4 Series Chipset Integrated Graphics Controller
+ 1458 d000 GA-EG45M-DS2H Mainboard
2e23 4 Series Chipset Integrated Graphics Controller
+ 1458 d000 GA-EG45M-DS2H Mainboard
2e24 4 Series Chipset HECI Controller
2e25 4 Series Chipset HECI Controller
2e26 4 Series Chipset PT IDER Controller
@@ -18987,9 +19648,10 @@
3404 5520/5500/X58 I/O Hub to ESI Port
3405 5520/5500/X58 I/O Hub to ESI Port
3406 5520 I/O Hub to ESI Port
+ 103c 330b ProLiant G6 series
3407 5520/5500/X58 I/O Hub to ESI Port
3408 5520/5500/X58 I/O Hub PCI Express Root Port 1
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
3409 5520/5500/X58 I/O Hub PCI Express Root Port 2
340a 5520/5500/X58 I/O Hub PCI Express Root Port 3
103c 330b ProLiant ML150 G6 Server
@@ -18999,30 +19661,33 @@
340e 5520/5500/X58 I/O Hub PCI Express Root Port 7
103c 330b ProLiant ML150 G6 Server
340f 5520/5500/X58 I/O Hub PCI Express Root Port 8
- 3410 5520/5500/X58 I/O Hub PCI Express Root Port 9
- 3411 5520/5500/X58 I/O Hub PCI Express Root Port 10
- 3418 5520/5500/X58 Physical Layer Port 0
- 3419 5520/5500 Physical Layer Port 1
- 3420 5500 Non-Legacy I/O Hub PCI Express Root Port 0
- 3421 5520 Non-Legacy I/O Hub PCI Express Root Port 0
- 3422 5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers
- 3423 5520/5500/X58 I/O Hub Control Status and RAS Registers
- 3425 5520/5500/X58 Physical and Link Layer Registers Port 0
- 3426 5520/5500/X58 Routing and Protocol Layer Registers Port 0
- 3427 5520/5500 Physical and Link Layer Registers Port 1
- 3428 5520/5500 Routing & Protocol Layer Register Port 1
+ 3410 7500/5520/5500/X58 I/O Hub PCI Express Root Port 9
+ 3411 7500/5520/5500/X58 I/O Hub PCI Express Root Port 10
+ 3418 7500/5520/5500/X58 Physical Layer Port 0
+ 3419 7500/5520/5500 Physical Layer Port 1
+ 3420 7500/5520/5500/X58 I/O Hub PCI Express Root Port 0
+ 3421 7500/5520/5500/X58 I/O Hub PCI Express Root Port 0
+ 3422 7500/5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers
+ 103c 330b ProLiant G6 series
+ 3423 7500/5520/5500/X58 I/O Hub Control Status and RAS Registers
+ 103c 330b ProLiant G6 series
+ 3425 7500/5520/5500/X58 Physical and Link Layer Registers Port 0
+ 3426 7500/5520/5500/X58 Routing and Protocol Layer Registers Port 0
+ 3427 7500/5520/5500 Physical and Link Layer Registers Port 1
+ 3428 7500/5520/5500 Routing & Protocol Layer Register Port 1
3429 5520/5500/X58 Chipset QuickData Technology Device
342a 5520/5500/X58 Chipset QuickData Technology Device
342b 5520/5500/X58 Chipset QuickData Technology Device
342c 5520/5500/X58 Chipset QuickData Technology Device
- 342d 5520/5500/X58 I/O Hub I/OxAPIC Interrupt Controller
- 342e 5520/5500/X58 I/O Hub System Management Registers
- 342f 5520/5500/X58 Trusted Execution Technology Registers
+ 342d 7500/5520/5500/X58 I/O Hub I/OxAPIC Interrupt Controller
+ 342e 7500/5520/5500/X58 I/O Hub System Management Registers
+ 103c 330b ProLiant G6 series
+ 342f 7500/5520/5500/X58 Trusted Execution Technology Registers
3430 5520/5500/X58 Chipset QuickData Technology Device
3431 5520/5500/X58 Chipset QuickData Technology Device
3432 5520/5500/X58 Chipset QuickData Technology Device
3433 5520/5500/X58 Chipset QuickData Technology Device
- 3438 5520/5500/X58 I/O Hub Throttle Registers
+ 3438 7500/5520/5500/X58 I/O Hub Throttle Registers
3500 6311ESB/6321ESB PCI Express Upstream Port
3501 6310ESB PCI Express Upstream Port
3504 6311ESB/6321ESB I/OxAPIC Interrupt Controller
@@ -19208,7 +19873,8 @@
3a16 82801JIR (ICH10R) LPC Interface Controller
1028 028c PowerEdge R410 LPC Interface Controller
1028 028d PowerEdge T410 LPC Interface Controller
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
+ 1043 82d4 P5Q Deluxe Motherboard
1458 5001 GA-EP45-DS5 Motherboard
3a18 82801JIB (ICH10) LPC Interface Controller
3a1a 82801JD (ICH10D) LPC Interface Controller
@@ -19216,9 +19882,9 @@
1028 028c PowerEdge R410 SATA IDE Controller
1028 028d PowerEdge T410 SATA IDE Controller
3a22 82801JI (ICH10 Family) SATA AHCI Controller
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
1043 82d4 P5Q Deluxe Motherboard
- 1458 b005 GA-EP45-DS5 Motherboard
+ 1458 b005 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
3a25 82801JIR (ICH10R) SATA RAID Controller
1028 028c PERC S100 Controller (PE R410)
1028 028d PERC S100 Controller (PE T410)
@@ -19227,57 +19893,68 @@
1028 028c PowerEdge R410 SATA IDE Controller
1028 028d PowerEdge T410 SATA IDE Controller
3a30 82801JI (ICH10 Family) SMBus Controller
- 1458 5001 GA-EP45-DS5 Motherboard
+ 1043 82d4 P5Q Deluxe Motherboard
+ 1458 5001 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
3a32 82801JI (ICH10 Family) Thermal Subsystem
3a34 82801JI (ICH10 Family) USB UHCI Controller #1
1028 028c PowerEdge R410 USB UHCI Controller
1028 028d PowerEdge T410 USB UHCI Controller
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
+ 1043 82d4 P5Q Deluxe Motherboard
1458 5004 GA-EP45-DS5 Motherboard
3a35 82801JI (ICH10 Family) USB UHCI Controller #2
1028 028c PowerEdge R410 USB UHCI Controller
1028 028d PowerEdge T410 USB UHCI Controller
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
+ 1043 82d4 P5Q Deluxe Motherboard
1458 5004 GA-EP45-DS5 Motherboard
3a36 82801JI (ICH10 Family) USB UHCI Controller #3
1028 028c PowerEdge R410 USB UHCI Controller
1028 028d PowerEdge T410 USB UHCI Controller
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
+ 1043 82d4 P5Q Deluxe Motherboard
1458 5004 GA-EP45-DS5 Motherboard
3a37 82801JI (ICH10 Family) USB UHCI Controller #4
1028 028c PowerEdge R410 USB UHCI Controller
1028 028d PowerEdge T410 USB UHCI Controller
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
+ 1043 82d4 P5Q Deluxe Motherboard
1458 5004 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
3a38 82801JI (ICH10 Family) USB UHCI Controller #5
1028 028c PowerEdge R410 USB UHCI Controller
1028 028d PowerEdge T410 USB UHCI Controller
103c 330b ProLiant ML150 G6 Server
+ 1043 82d4 P5Q Deluxe Motherboard
1458 5004 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
3a39 82801JI (ICH10 Family) USB UHCI Controller #6
1028 028c PowerEdge R410 USB UHCI Controller
1028 028d PowerEdge T410 USB UHCI Controller
103c 330b ProLiant ML150 G6 Server
- 1458 5004 GA-EP45-DS5 Motherboard
+ 1043 82d4 P5Q Deluxe Motherboard
+ 1458 5004 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
3a3a 82801JI (ICH10 Family) USB2 EHCI Controller #1
1028 028c PowerEdge R410 USB EHCI Controller
1028 028d PowerEdge T410 USB EHCI Controller
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
+ 1043 82d4 P5Q Deluxe Motherboard
1458 5006 GA-EP45-DS5 Motherboard
3a3c 82801JI (ICH10 Family) USB2 EHCI Controller #2
1028 028c PowerEdge R410 USB EHCI Controller
1028 028d PowerEdge T410 USB EHCI Controller
- 103c 330b ProLiant ML150 G6 Server
+ 103c 330b ProLiant G6 series
+ 1043 82d4 P5Q Deluxe Motherboard
1458 5006 GA-EP45-DS5 Motherboard
3a3e 82801JI (ICH10 Family) HD Audio Controller
+ 1043 8311 P5Q Deluxe Motherboard
1458 a002 GA-EP45-UD3R Motherboard
- 1458 a102 GA-EP45-DS5 Motherboard
+ 1458 a102 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
3a40 82801JI (ICH10 Family) PCI Express Root Port 1
1028 028c PowerEdge R410 PCI Express Port 1
1028 028d PowerEdge T410 PCI Express Port 1
103c 330b ProLiant ML150 G6 Server
+ 1043 82d4 P5Q Deluxe Motherboard
1043 82ea P6T DeLuxe Motherboard
- 1458 5001 GA-EP45-DS5 Motherboard
+ 1458 5001 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
3a42 82801JI (ICH10 Family) PCI Express Port 2
3a44 82801JI (ICH10 Family) PCI Express Root Port 3
1043 82ea P6T DeLuxe Motherboard
@@ -19290,8 +19967,9 @@
1458 5001 GA-EP45-DS5 Motherboard
3a4a 82801JI (ICH10 Family) PCI Express Root Port 6
103c 330b ProLiant ML150 G6 Server
+ 1043 82d4 P5Q Deluxe Motherboard
1043 82ea P6T DeLuxe Motherboard
- 1458 5001 GA-EP45-DS5 Motherboard
+ 1458 5001 GA-EP45-DS5/GA-EG45M-DS2H Motherboard
3a4c 82801JI (ICH10 Family) Gigabit Ethernet Controller
3a51 82801JDO (ICH10DO) VECI Controller
3a55 82801JD/DO (ICH10 Family) Virtual SATA Controller
@@ -19327,6 +20005,7 @@
3b09 Mobile 5 Series Chipset LPC Interface Controller
1025 0347 Aspire 7740G
3b0a 5 Series Chipset LPC Interface Controller
+ 1028 02da OptiPlex 980
3b0b Mobile 5 Series Chipset LPC Interface Controller
3b0c 5 Series Chipset LPC Interface Controller
3b0d 5 Series/3400 Series Chipset LPC Interface Controller
@@ -19351,6 +20030,7 @@
3b20 5 Series/3400 Series Chipset 4 port SATA IDE Controller
3b21 5 Series/3400 Series Chipset 2 port SATA IDE Controller
3b22 5 Series/3400 Series Chipset 6 port SATA AHCI Controller
+ 1028 02da OptiPlex 980
3b23 5 Series/3400 Series Chipset 4 port SATA AHCI Controller
3b25 5 Series/3400 Series Chipset SATA RAID Controller
3b26 5 Series/3400 Series Chipset 2 port SATA IDE Controller
@@ -19367,12 +20047,14 @@
e4bf 50c1 PC1-GROOVE
3b30 5 Series/3400 Series Chipset SMBus Controller
1025 0347 Aspire 7740G
+ 1028 02da OptiPlex 980
1028 040b Latitude E6510
e4bf 50c1 PC1-GROOVE
3b32 5 Series/3400 Series Chipset Thermal Subsystem
1025 0347 Aspire 7740G
3b34 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
1025 0347 Aspire 7740G
+ 1028 02da OptiPlex 980
1028 040b Latitude E6510
e4bf 50c1 PC1-GROOVE
3b36 5 Series/3400 Series Chipset USB Universal Host Controller
@@ -19383,6 +20065,7 @@
3b3b 5 Series/3400 Series Chipset USB Universal Host Controller
3b3c 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
1025 0347 Aspire 7740G
+ 1028 02da OptiPlex 980
1028 040b Latitude E6510
e4bf 50c1 PC1-GROOVE
3b3e 5 Series/3400 Series Chipset USB Universal Host Controller
@@ -19390,19 +20073,23 @@
3b40 5 Series/3400 Series Chipset USB Universal Host Controller
3b41 5 Series/3400 Series Chipset LAN Controller
3b42 5 Series/3400 Series Chipset PCI Express Root Port 1
+ 1028 02da OptiPlex 980
1028 040b Latitude E6510
3b44 5 Series/3400 Series Chipset PCI Express Root Port 2
1028 040b Latitude E6510
3b46 5 Series/3400 Series Chipset PCI Express Root Port 3
+ 1028 040b Latitude E6510
3b48 5 Series/3400 Series Chipset PCI Express Root Port 4
1028 040b Latitude E6510
3b4a 5 Series/3400 Series Chipset PCI Express Root Port 5
+ 1028 02da OptiPlex 980
3b4c 5 Series/3400 Series Chipset PCI Express Root Port 6
3b4e 5 Series/3400 Series Chipset PCI Express Root Port 7
3b50 5 Series/3400 Series Chipset PCI Express Root Port 8
3b53 5 Series/3400 Series Chipset VECI Controller
3b56 5 Series/3400 Series Chipset High Definition Audio
1025 0347 Aspire 7740G
+ 1028 02da OptiPlex 980
1028 040b Latitude E6510
e4bf 50c1 PC1-GROOVE
3b57 5 Series/3400 Series Chipset High Definition Audio
@@ -19829,38 +20516,38 @@
8817 Platform Controller Hub EG20T I2C Controller
8818 Platform Controller Hub EG20T Controller Area Network (CAN) Controller
8819 Platform Controller Hub EG20T IEEE 1588 Hardware Assist
- 8c00 Lynx Point 4-Port SATA IDE Controller
- 8c01 Lynx Point 4-Port SATA IDE Controller
- 8c02 Lynx Point 6-Port SATA AHCI Controller
- 8c03 Lynx Point 6-Port SATA AHCI Controller
- 8c04 Lynx Point SATA RAID Controller
- 8c05 Lynx Point SATA RAID Controller
- 8c06 Lynx Point SATA RAID Controller
- 8c07 Lynx Point SATA RAID Controller
- 8c08 Lynx Point 2-Port SATA IDE Controller
- 8c09 Lynx Point 2-Port SATA IDE Controller
- 8c0e Lynx Point SATA RAID Controller
- 8c0f Lynx Point SATA RAID Controller
- 8c10 Lynx Point PCI Express Root Port 1
- 8c11 Lynx Point PCI Express Root Port 1
- 8c12 Lynx Point PCI Express Root Port 2
- 8c13 Lynx Point PCI Express Root Port 2
- 8c14 Lynx Point PCI Express Root Port 3
- 8c15 Lynx Point PCI Express Root Port 3
- 8c16 Lynx Point PCI Express Root Port 4
- 8c17 Lynx Point PCI Express Root Port 4
- 8c18 Lynx Point PCI Express Root Port 5
- 8c19 Lynx Point PCI Express Root Port 5
- 8c1a Lynx Point PCI Express Root Port 6
- 8c1b Lynx Point PCI Express Root Port 6
- 8c1c Lynx Point PCI Express Root Port 7
- 8c1d Lynx Point PCI Express Root Port 7
- 8c1e Lynx Point PCI Express Root Port 8
- 8c1f Lynx Point PCI Express Root Port 8
- 8c20 Lynx Point HD Audio Controller
- 8c21 Lynx Point HD Audio Controller
+ 8c00 Lynx Point 4-port SATA Controller 1 [IDE mode]
+ 8c01 Lynx Point 4-port SATA Controller 1 [IDE mode]
+ 8c02 Lynx Point 6-port SATA Controller 1 [AHCI mode]
+ 8c03 Lynx Point 6-port SATA Controller 1 [AHCI mode]
+ 8c04 Lynx Point SATA Controller 1 [RAID mode]
+ 8c05 Lynx Point SATA Controller 1 [RAID mode]
+ 8c06 Lynx Point SATA Controller 1 [RAID mode]
+ 8c07 Lynx Point SATA Controller 1 [RAID mode]
+ 8c08 Lynx Point 2-port SATA Controller 2 [IDE mode]
+ 8c09 Lynx Point 2-port SATA Controller 2 [IDE mode]
+ 8c0e Lynx Point SATA Controller 1 [RAID mode]
+ 8c0f Lynx Point SATA Controller 1 [RAID mode]
+ 8c10 Lynx Point PCI Express Root Port #1
+ 8c11 Lynx Point PCI Express Root Port #1
+ 8c12 Lynx Point PCI Express Root Port #2
+ 8c13 Lynx Point PCI Express Root Port #2
+ 8c14 Lynx Point PCI Express Root Port #3
+ 8c15 Lynx Point PCI Express Root Port #3
+ 8c16 Lynx Point PCI Express Root Port #4
+ 8c17 Lynx Point PCI Express Root Port #4
+ 8c18 Lynx Point PCI Express Root Port #5
+ 8c19 Lynx Point PCI Express Root Port #5
+ 8c1a Lynx Point PCI Express Root Port #6
+ 8c1b Lynx Point PCI Express Root Port #6
+ 8c1c Lynx Point PCI Express Root Port #7
+ 8c1d Lynx Point PCI Express Root Port #7
+ 8c1e Lynx Point PCI Express Root Port #8
+ 8c1f Lynx Point PCI Express Root Port #8
+ 8c20 Lynx Point High Definition Audio Controller
+ 8c21 Lynx Point High Definition Audio Controller
8c22 Lynx Point SMBus Controller
- 8c23 Lynx Point CHAP Counter
+ 8c23 Lynx Point CHAP Counters
8c24 Lynx Point Thermal Management Controller
8c26 Lynx Point USB Enhanced Host Controller #1
8c2d Lynx Point USB Enhanced Host Controller #2
@@ -19911,16 +20598,75 @@
9622 Integrated RAID
9641 Integrated RAID
96a1 Integrated RAID
- a000 N10 Family DMI Bridge
+ 9c00 Lynx Point-LP SATA Controller 1 [IDE mode]
+ 9c01 Lynx Point-LP SATA Controller 1 [IDE mode]
+ 9c02 Lynx Point-LP SATA Controller 1 [AHCI mode]
+ 9c03 Lynx Point-LP SATA Controller 1 [AHCI mode]
+ 9c04 Lynx Point-LP SATA Controller 1 [RAID mode]
+ 9c05 Lynx Point-LP SATA Controller 1 [RAID mode]
+ 9c06 Lynx Point-LP SATA Controller 1 [RAID mode]
+ 9c07 Lynx Point-LP SATA Controller 1 [RAID mode]
+ 9c08 Lynx Point-LP SATA Controller 2 [IDE mode]
+ 9c09 Lynx Point-LP SATA Controller 2 [IDE mode]
+ 9c0a LynxPoint-LP SATA Controller [Reserved]
+ 9c0b LynxPoint-LP SATA Controller [Reserved]
+ 9c0c LynxPoint-LP SATA Controller [Reserved]
+ 9c0d LynxPoint-LP SATA Controller [Reserved]
+ 9c0e Lynx Point-LP SATA Controller 1 [RAID mode]
+ 9c0f Lynx Point-LP SATA Controller 1 [RAID mode]
+ 9c10 Lynx Point-LP PCI Express Root Port 1
+ 9c11 Lynx Point-LP PCI Express Root Port 1
+ 9c12 Lynx Point-LP PCI Express Root Port 2
+ 9c13 Lynx Point-LP PCI Express Root Port 2
+ 9c14 Lynx Point-LP PCI Express Root Port 3
+ 9c15 Lynx Point-LP PCI Express Root Port 3
+ 9c16 Lynx Point-LP PCI Express Root Port 4
+ 9c17 Lynx Point-LP PCI Express Root Port 4
+ 9c18 Lynx Point-LP PCI Express Root Port 5
+ 9c19 Lynx Point-LP PCI Express Root Port 5
+ 9c1a Lynx Point-LP PCI Express Root Port 6
+ 9c1b Lynx Point-LP PCI Express Root Port 6
+ 9c20 Lynx Point-LP HD Audio Controller
+ 9c21 Lynx Point-LP HD Audio Controller
+ 9c22 Lynx Point-LP SMBus Controller
+ 9c23 Lynx Point-LP CHAP Counters
+ 9c24 Lynx Point-LP Thermal
+ 9c26 Lynx Point-LP USB EHCI #1
+ 9c31 Lynx Point-LP USB xHCI HC
+ 9c35 Lynx Point-LP SDIO Controller
+ 9c36 Lynx Point-LP Audio DSP Controller
+ 9c3a Lynx Point-LP HECI #0
+ 9c3b Lynx Point-LP HECI #1
+ 9c3c Lynx Point-LP HECI IDER
+ 9c3d Lynx Point-LP HECI KT
+ 9c40 Lynx Point-LP LPC Controller
+ 9c41 Lynx Point-LP LPC Controller
+ 9c42 Lynx Point-LP LPC Controller
+ 9c43 Lynx Point-LP LPC Controller
+ 9c44 Lynx Point-LP LPC Controller
+ 9c45 Lynx Point-LP LPC Controller
+ 9c46 Lynx Point-LP LPC Controller
+ 9c47 Lynx Point-LP LPC Controller
+ 9c60 Lynx Point-LP Low Power Sub-System DMA
+ 9c61 Lynx Point-LP I2C Controller #0
+ 9c62 Lynx Point-LP I2C Controller #1
+ 9c63 Lynx Point-LP UART Controller #0
+ 9c64 Lynx Point-LP UART Controller #1
+ 9c65 Lynx Point-LP SPI Controller #0
+ 9c66 Lynx Point-LP SPI Controller #1
+ a000 Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge
8086 4f4d DeskTop Board D510MO
- a001 N10 Family Integrated Graphics Controller
+ a001 Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller
8086 4f4d DeskTop Board D510MO
- a002 N10 Family Integrated Graphics Controller
- a003 N10 Family CHAPS counter
- a010 N10 Family DMI Bridge
- a011 N10 Family Integrated Graphics Controller
- a012 N10 Family Integrated Graphics Controller
- a013 N10 Family CHAPS counter
+ a002 Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller
+ a003 Atom Processor D4xx/D5xx/N4xx/N5xx CHAPS counter
+ a010 Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge
+ 144d c072 Notebook N150P
+ a011 Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller
+ 144d c072 Notebook N150P
+ a012 Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller
+ 144d c072 Notebook N150P
+ a013 Atom Processor D4xx/D5xx/N4xx/N5xx CHAPS counter
a620 6400/6402 Advanced Memory Buffer (AMB)
b152 21152 PCI-to-PCI Bridge
8086 b152 21152 PCI-to-PCI Bridge
@@ -19935,6 +20681,7 @@
e4bf 1000 CC8-1-BLUES
d130 Core Processor DMI
d131 Core Processor DMI
+ 1028 02da OptiPlex 980
d132 Core Processor DMI
1028 040b Latitude E6510
d133 Core Processor DMI
@@ -19943,6 +20690,7 @@
d136 Core Processor DMI
d137 Core Processor DMI
d138 Core Processor PCI Express Root Port 1
+ 1028 02da OptiPlex 980
1028 040b Latitude E6510
d139 Core Processor PCI Express Root Port 2
d13a Core Processor PCI Express Root Port 3
@@ -20264,6 +21012,31 @@
9005 02b3 2400
9005 02b4 ICP ICP5045AL
9005 0800 Callisto
+ 028b Series 6 - 6G SAS/PCIe 2
+ 9005 0200 Series 6 Entry Level - ASR-6405E - 4 internal 6G SAS ports
+ 9005 0201 Series 6 Entry Level - ASR-6805E - 8 internal 6G SAS ports
+ 9005 0300 Series 6 - ASR-6405 - 4 internal 6G SAS ports
+ 9005 0301 Series 6 - ASR-6805 - 8 internal 6G SAS ports
+ 9005 0302 Series 6 - ASR-6445 - 4 internal and 4 external 6G SAS ports
+ 9005 0310 Series 6 Connectors on Top - ASR-6405T - 4 internal 6G SAS ports
+ 9005 0311 Series 6 Connectors on Top - ASR-6805T - 8 internal 6G SAS
+ 9005 0400 Series 6 - ASR-61205 - 12 internal 6G SAS ports
+ 9005 0401 Series 6 - ASR-61605 - 16 internal 6G SAS ports
+ 9005 0403 Series 6 - ASR-62405 - 24 internal 6G SAS ports
+ 028c Series 7 6G SAS/PCIe 3
+ 9005 0500 Series 7 - ASR-7805 - 8 internal 6G SAS Port/PCIe 3.0
+ 9005 0501 Series 7 - ASR-71605 - 16 internal 6G SAS Port/PCIe 3.0
+ 9005 0502 Series 7 - ASR-71685 - 16 internal 8 external 6G SAS Port/PCIe 3.0
+ 9005 0503 Series 7 - ASR-72405 - 24 internal 0 external 6G SAS Port/PCIe 3.0
+ 9005 0504 Series 7 - ASR-7885 - 8 internal 8 external 6G SAS Port/PCIe 3.0
+ 9005 0505 Series 7 Entry Level - ASR-71685E - 16 internal 8 external 6G SAS Port/PCIe 3.0
+ 9005 0506 Series 7 Entry Level - ASR-72405E - 24 internal 0 external 6G SAS Port/PCIe 3.0
+ 028d Series 8 12G SAS/PCIe 3
+ 9005 0550 Series 8 - ASR-82405 - 24 internal 0 external 12G SAS Port/PCIe 3.0
+ 9005 0551 Series 8 - ASR-81605 - 16 internal 0 external 12G SAS Port/PCIe 3.0
+ 9005 0552 Series 8 - ASR-8805 - 8 internal 0 external 12G SAS Port/PCIe 3.0
+ 9005 0553 Series 8 - ASR-8085 - 0 internal 8 external 12G SAS Port/PCIe 3.0
+ 9005 0554 Series 8 - ASR-8885 - 8 internal 8 external 12G SAS Port/PCIe 3.0
0410 AIC-9410W SAS (Razor HBA RAID)
9005 0410 ASC-48300(Spirit RAID)
9005 0411 ASC-58300 (Oakmont RAID)
@@ -20359,6 +21132,8 @@
9865 PCI 9865 Multi-I/O Controller
9901 PCIe 9901 Multi-I/O Controller
9904 4-Port PCIe Serial Adapter
+# 2-port Serial 1-port Parallel Adaptor
+ 9912 PCIe 9912 Multi-I/O Controller
9922 PCIe 9922 Multi-I/O Controller
9990 MCS9990 PCIe to 4â€Port USB 2.0 Host Controller
9902 Stargen Inc.
@@ -20449,6 +21224,10 @@ dada Datapath Limited
db10 Diablo Technologies
dcba Dynamic Engineering
0046 PCIeAlteraCycloneIV
+# VPX format Receiver Controller Board
+ 0047 VPX-RCB
+# PMC Format FPGA design with 8 high speed UART channels
+ 0048 PMC-Biserial-III-BAE9
dd01 Digital Devices GmbH
0003 Octopus LE DVB adapter
dead Indigita Corporation
diff --git a/usr/src/cmd/ibd_upgrade/ibd_delete_link.c b/usr/src/cmd/ibd_upgrade/ibd_delete_link.c
index b9d10a56cd..f63630207d 100644
--- a/usr/src/cmd/ibd_upgrade/ibd_delete_link.c
+++ b/usr/src/cmd/ibd_upgrade/ibd_delete_link.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#include <stdio.h>
@@ -86,6 +87,7 @@ ibd_delete_link(dladm_handle_t dlh, char *link)
getlinkid.ld_cmd = DLMGMT_CMD_GETLINKID;
(void) strlcpy(getlinkid.ld_link, link, MAXLINKNAMELEN);
+ getlinkid.ld_zoneid = -1;
if ((status = ibd_dladm_door_call(dlh, &getlinkid, sizeof (getlinkid),
&retval, sizeof (retval))) != DLADM_STATUS_OK) {
diff --git a/usr/src/cmd/init/init.c b/usr/src/cmd/init/init.c
index e04bbecd89..d7c8853a08 100644
--- a/usr/src/cmd/init/init.c
+++ b/usr/src/cmd/init/init.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -141,6 +142,8 @@
#define UT_LINE_SZ 32 /* Size of a utmpx ut_line field */
+#define CHECK_SVC SCF_INSTANCE_FS_MINIMAL
+
/*
* SLEEPTIME The number of seconds "init" sleeps between wakeups if
* nothing else requires this "init" wakeup.
@@ -693,9 +696,8 @@ main(int argc, char *argv[])
console(B_FALSE,
"\n\n%s Release %s Version %s %d-bit\r\n",
un.sysname, un.release, un.version, bits);
- console(B_FALSE,
- "Copyright (c) 1983, 2010, Oracle and/or its affiliates."
- " All rights reserved.\r\n");
+ console(B_FALSE, "Copyright (c) 2010-2012, "
+ "Joyent Inc. All rights reserved.\r\n");
}
/*
@@ -3503,6 +3505,28 @@ bail:
}
/*
+ * Attempt to confirm that svc.startd is ready to accept a user-initiated
+ * run-level change. startd is not ready until it has started its
+ * _scf_notify_wait thread to watch for events from svc.configd. This is
+ * inherently racy. To workaround this, we check the status of a file that
+ * startd will create once it has started the _scf_notify_wait thread.
+ * If we don't see this file after one minute, then charge ahead.
+ */
+static void
+verify_startd_ready()
+{
+ struct stat64 buf;
+ int i;
+
+ for (i = 0; i < 60; i++) {
+ if (stat64("/etc/svc/volatile/startd.ready", &buf) == 0)
+ return;
+ sleep(1);
+ }
+ console(B_TRUE, "verify startd timeout\n");
+}
+
+/*
* Function to handle requests from users to main init running as process 1.
*/
static void
@@ -3590,6 +3614,12 @@ userinit(int argc, char **argv)
(void) audit_put_record(ADT_SUCCESS, ADT_SUCCESS, argv[1]);
/*
+ * Before we tell init to start a run-level change, we need to be
+ * sure svc.startd is ready to accept that.
+ */
+ verify_startd_ready();
+
+ /*
* Signal init; init will take care of telling svc.startd.
*/
if (kill(init_pid, init_signal) == FAILURE) {
@@ -4292,9 +4322,7 @@ contract_event(struct pollfd *poll)
if (ret == 0) {
if (cookie == STARTD_COOKIE &&
do_restart_startd) {
- if (smf_debug)
- console(B_TRUE, "Restarting "
- "svc.startd.\n");
+ console(B_TRUE, "Restarting svc.startd.\n");
/*
* Account for the failure. If the failure rate
diff --git a/usr/src/cmd/initpkg/mountall.sh b/usr/src/cmd/initpkg/mountall.sh
index 56f2798e18..38693dd8da 100644
--- a/usr/src/cmd/initpkg/mountall.sh
+++ b/usr/src/cmd/initpkg/mountall.sh
@@ -28,6 +28,8 @@
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
# All Rights Reserved
#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
usage () {
if [ -n "$1" ]; then
@@ -148,6 +150,9 @@ isremote() {
# Get list of remote FS types (just once)
RemoteFSTypes=`while read t junk; do echo $t; done < /etc/dfs/fstypes`
+# Ensure nfs/smbfs are remote FS types even if not delivered from fstypes
+isremote "nfs" || set -A RemoteFSTypes "nfs"
+isremote "smbfs" || set -A RemoteFSTypes "smbfs"
#
# Process command line args
diff --git a/usr/src/cmd/initpkg/shutdown.sh b/usr/src/cmd/initpkg/shutdown.sh
index e65224c632..820d50310c 100644
--- a/usr/src/cmd/initpkg/shutdown.sh
+++ b/usr/src/cmd/initpkg/shutdown.sh
@@ -41,7 +41,7 @@ usage() {
}
notify() {
- /usr/sbin/wall -a <<-!
+ /usr/sbin/wall -Za <<-!
$*
!
if [ -x /usr/sbin/showmount -a -x /usr/sbin/rwall ]
diff --git a/usr/src/cmd/initpkg/umountall.sh b/usr/src/cmd/initpkg/umountall.sh
index c9a94fd8f1..4a45e19e18 100644
--- a/usr/src/cmd/initpkg/umountall.sh
+++ b/usr/src/cmd/initpkg/umountall.sh
@@ -25,6 +25,7 @@
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
# All Rights Reserved
#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
usage () {
@@ -98,6 +99,9 @@ isremote() {
# Get list of remote FS types (just once)
RemoteFSTypes=`while read t junk; do echo $t; done < /etc/dfs/fstypes`
+# Ensure nfs/smbfs are remote FS types even if not delivered from fstypes
+isremote "nfs" || set -A RemoteFSTypes "nfs"
+isremote "smbfs" || set -A RemoteFSTypes "smbfs"
#
# Process command line args
diff --git a/usr/src/cmd/ipdadm/Makefile b/usr/src/cmd/ipdadm/Makefile
new file mode 100644
index 0000000000..96051c38d3
--- /dev/null
+++ b/usr/src/cmd/ipdadm/Makefile
@@ -0,0 +1,54 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
+#
+
+PROG= ipdadm
+OBJS = ipdadm.o
+SRCS = $(OBJS:%.o=../%.c)
+
+
+include ../Makefile.cmd
+include ../Makefile.ctf
+
+CLEANFILES += $(OBJS)
+CFLAGS += $(CCVERBOSE)
+LDLIBS += -lipd
+
+.KEEP_STATE:
+
+$(PROG): $(OBJS)
+ $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
+ $(CTFCONVERT_O)
+
+clean:
+ -$(RM) $(CLEANFILES)
+
+lint: lint_PROG
+
+%.o: ../%.c
+ $(COMPILE.c) $<
+
+install: $(PROG) $(ROOTUSRSBINPROG)
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/ipdadm/ipdadm.c b/usr/src/cmd/ipdadm/ipdadm.c
new file mode 100644
index 0000000000..61020ecd4c
--- /dev/null
+++ b/usr/src/cmd/ipdadm/ipdadm.c
@@ -0,0 +1,444 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <values.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <strings.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stropts.h>
+#include <zone.h>
+#include <libgen.h>
+#include <assert.h>
+
+#include <libipd.h>
+
+static char *g_pname;
+static char g_zonename[ZONENAME_MAX];
+static zoneid_t g_zid;
+
+#define E_SUCCESS 0
+#define E_ERROR 1
+#define E_USAGE 2
+
+typedef int (*idc_cmd_func_t)(int, char *[]);
+typedef struct ipdadm_cmd {
+ const char *idc_name; /* subcommand name */
+ idc_cmd_func_t idc_func; /* subcommand function */
+ const char *idc_usage; /* subcommand help */
+} ipdadm_cmd_t;
+
+static int ipdadm_list(int, char *[]);
+static int ipdadm_info(int, char *[]);
+static int ipdadm_corrupt(int, char *[]);
+static int ipdadm_delay(int, char *[]);
+static int ipdadm_drop(int, char *[]);
+static int ipdadm_remove(int, char *[]);
+
+#define IPDADM_NCMDS 6
+static ipdadm_cmd_t ipdadm_cmds[] = {
+ { "list", ipdadm_list, "list [-v]" },
+ { "info", ipdadm_info, "info" },
+ { "corrupt", ipdadm_corrupt, "corrupt <percentage>" },
+ { "delay", ipdadm_delay, "delay <microseconds>" },
+ { "drop", ipdadm_drop, "drop <percentage>" },
+ { "remove", ipdadm_remove, "remove [corrupt|delay|drop]" }
+};
+
+static int
+usage(FILE *fp)
+{
+ int ii;
+ ipdadm_cmd_t *cmd;
+
+ (void) fprintf(fp, "Usage: %s [-z zonename] subcommand "
+ "[subcommand opts]\n\n", g_pname);
+ (void) fprintf(fp, "Subcommands:\n");
+ for (ii = 0; ii < IPDADM_NCMDS; ii++) {
+ cmd = &ipdadm_cmds[ii];
+ (void) fprintf(fp, "\t%s\n", cmd->idc_usage);
+ }
+
+ return (E_USAGE);
+}
+
+static void
+ipdadm_list_one(zoneid_t z, const ipd_config_t *icp, void *arg)
+{
+ char zonename[ZONENAME_MAX];
+ int opt_v = (int)(intptr_t)arg;
+
+ if (getzonenamebyid(z, zonename, sizeof (zonename)) < 0)
+ (void) printf("%ld", z);
+ else
+ (void) printf("%s", zonename);
+
+ if (!opt_v) {
+ (void) printf("\n");
+ return;
+ }
+
+ (void) printf("\t%u\t%u\t%u\n", icp->ic_corrupt, icp->ic_drop,
+ icp->ic_delay);
+}
+
+static int
+ipdadm_list(int argc, char *argv[])
+{
+ int opt_v = 0;
+ int fd, rval;
+ ipd_stathdl_t hdl;
+
+ if (argc > 1)
+ return (usage(stderr));
+
+ if (argc == 1) {
+ if (strcmp(argv[0], "-v") == 0)
+ ++opt_v;
+ else
+ return (usage(stderr));
+ }
+
+ fd = ipd_open(NULL);
+ rval = ipd_status_read(fd, &hdl);
+ (void) ipd_close(fd);
+
+ if (rval != 0) {
+ (void) fprintf(stderr, "%s: failed to get list info: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
+
+ ipd_status_foreach_zone(hdl, ipdadm_list_one, (void *)(intptr_t)opt_v);
+ ipd_status_free(hdl);
+
+ return (E_SUCCESS);
+}
+
+/*ARGSUSED*/
+static int
+ipdadm_info(int argc, char *argv[])
+{
+ int rval, fd;
+ ipd_stathdl_t hdl;
+ ipd_config_t *icp;
+
+ if (argc != 0)
+ return (usage(stderr));
+
+ fd = ipd_open(NULL);
+ rval = ipd_status_read(fd, &hdl);
+ (void) ipd_close(fd);
+ if (rval != 0) {
+ (void) fprintf(stderr, "%s: failed to get info: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
+
+ if (ipd_status_get_config(hdl, g_zid, &icp) != 0) {
+ if (ipd_errno == EIPD_ZC_NOENT) {
+ (void) printf("zone %s does not exist or has no "
+ "ipd actions enabled\n", g_zonename);
+ return (E_SUCCESS);
+ }
+ (void) fprintf(stderr, "%s: failed to get info: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
+
+ (void) printf("ipd information for zone %s:\n",
+ g_zonename);
+ (void) printf("\tcorrupt:\t%u%% chance of packet corruption\n",
+ icp->ic_corrupt);
+ (void) printf("\tdrop:\t\t%u%% chance of packet drop\n",
+ icp->ic_drop);
+ (void) printf("\tdelay:\t\t%u microsecond delay per packet\n",
+ icp->ic_delay);
+
+ ipd_status_free(hdl);
+
+ return (E_SUCCESS);
+}
+
+static long
+ipdadm_parse_long(const char *str, const char *name, long min, long max)
+{
+ long val;
+ char *end;
+
+ errno = 0;
+ val = strtol(str, &end, 10);
+ if (errno != 0) {
+ (void) fprintf(stderr, "%s: invalid value for %s: %s\n",
+ g_pname, name, str);
+ exit(E_ERROR);
+ }
+
+ /*
+ * We want to make sure that we got the whole string. If not that's an
+ * error. e.g. 23.42 should not be valid.
+ */
+ if (*end != '\0') {
+ (void) fprintf(stderr, "%s: %s value must be an integer\n",
+ g_pname, name);
+ exit(E_ERROR);
+ }
+
+ if (val < min || val > max) {
+ (void) fprintf(stderr, "%s: %s value must be between %ld and "
+ "%ld inclusive\n", g_pname, name, min, max);
+ exit(E_ERROR);
+ }
+
+ return (val);
+}
+
+static int
+ipdadm_corrupt(int argc, char *argv[])
+{
+ int rval, fd;
+ long val;
+ ipd_config_t ic;
+
+ if (argc != 1) {
+ (void) fprintf(stderr, "%s: corrupt <percentage>\n",
+ g_pname);
+ return (usage(stderr));
+ }
+
+ val = ipdadm_parse_long(argv[0], "corrupt", 0, 100);
+ bzero(&ic, sizeof (ic));
+ ic.ic_mask = IPDM_CORRUPT;
+ ic.ic_corrupt = val;
+
+ fd = ipd_open(NULL);
+ rval = ipd_ctl(fd, g_zid, &ic);
+ (void) ipd_close(fd);
+
+ if (rval != 0) {
+ (void) fprintf(stderr, "%s: failed to change corrupt "
+ "value: %s\n", g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
+
+ return (E_SUCCESS);
+}
+
+static int
+ipdadm_delay(int argc, char *argv[])
+{
+ long val;
+ int fd, rval;
+ ipd_config_t ic;
+
+ if (argc != 1) {
+ (void) fprintf(stderr, "%s: delay <microseconds>\n",
+ g_pname);
+ return (usage(stderr));
+ }
+
+ val = ipdadm_parse_long(argv[0], "delay", 0, MAXLONG);
+ bzero(&ic, sizeof (ic));
+ ic.ic_mask = IPDM_DELAY;
+ ic.ic_delay = val;
+
+ fd = ipd_open(NULL);
+ rval = ipd_ctl(fd, g_zid, &ic);
+ (void) ipd_close(fd);
+
+ if (rval != 0) {
+ (void) fprintf(stderr, "%s: failed to change delay value: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
+
+ return (E_SUCCESS);
+}
+
+static int
+ipdadm_drop(int argc, char *argv[])
+{
+ long val;
+ int fd, rval;
+ ipd_config_t ic;
+
+ if (argc != 1) {
+ (void) fprintf(stderr, "%s: drop <percentage>\n",
+ g_pname);
+ return (usage(stderr));
+ }
+
+ val = ipdadm_parse_long(argv[0], "drop", 0, 100);
+ bzero(&ic, sizeof (ic));
+ ic.ic_mask = IPDM_DROP;
+ ic.ic_drop = val;
+
+ fd = ipd_open(NULL);
+ rval = ipd_ctl(fd, g_zid, &ic);
+ (void) ipd_close(fd);
+
+ if (rval != 0) {
+ (void) fprintf(stderr, "%s: failed to change drop value: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
+
+ return (E_SUCCESS);
+}
+
+static int
+ipdadm_remove_valid(const char *str)
+{
+ if (strcmp(str, "corrupt") == 0) {
+ return (IPDM_CORRUPT);
+ } else if (strcmp(str, "drop") == 0) {
+ return (IPDM_DROP);
+ } else if (strcmp(str, "delay") == 0) {
+ return (IPDM_DELAY);
+ }
+
+ return (0);
+}
+
+static int
+ipdadm_remove(int argc, char *argv[])
+{
+ ipd_config_t ic;
+ char *cur, *res;
+ int rval, fd;
+
+ if (argc < 1) {
+ (void) fprintf(stderr, "%s: remove <arguments>\n",
+ g_pname);
+ return (usage(stderr));
+ }
+
+ if (argc > 1) {
+ (void) fprintf(stderr, "%s: remove's arguments must be "
+ "comma seperated\n", g_pname);
+ return (E_ERROR);
+ }
+
+ bzero(&ic, sizeof (ic));
+
+ cur = argv[0];
+ while ((res = strchr(cur, ',')) != NULL) {
+ *res = '\0';
+ if ((rval = ipdadm_remove_valid(cur)) == 0) {
+ (void) fprintf(stderr, "%s: unknown remove "
+ "argument: %s\n", g_pname, cur);
+ return (E_ERROR);
+ }
+ ic.ic_mask |= rval;
+ cur = res + 1;
+ }
+
+ if ((rval = ipdadm_remove_valid(cur)) == 0) {
+ (void) fprintf(stderr, "%s: unknown remove argument: %s\n",
+ g_pname, cur);
+ return (E_ERROR);
+ }
+ ic.ic_mask |= rval;
+
+ fd = ipd_open(NULL);
+ rval = ipd_ctl(fd, g_zid, &ic);
+ (void) ipd_close(fd);
+ if (rval == -1) {
+ (void) fprintf(stderr, "%s: failed to remove instances: %s\n",
+ g_pname, ipd_errmsg);
+ return (E_ERROR);
+ }
+
+ return (E_SUCCESS);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ int ii;
+ ipdadm_cmd_t *cmd;
+
+ g_pname = basename(argv[0]);
+
+ if (argc < 2)
+ return (usage(stderr));
+ argc--;
+ argv++;
+
+ g_zid = getzoneid();
+ if (strcmp("-z", argv[0]) == 0) {
+ argc--;
+ argv++;
+ if (argc < 1) {
+ (void) fprintf(stderr, "%s: -z requires an argument\n",
+ g_pname);
+ return (usage(stderr));
+ }
+
+ if (g_zid != GLOBAL_ZONEID) {
+ (void) fprintf(stderr, "%s: -z option only permitted "
+ "in global zone\n", g_pname);
+ return (usage(stderr));
+ }
+
+ g_zid = getzoneidbyname(argv[0]);
+ if (g_zid == -1) {
+ (void) fprintf(stderr, "%s: %s: invalid zone\n",
+ g_pname, argv[0]);
+ return (E_ERROR);
+ }
+ argc--;
+ argv++;
+ }
+
+ if (getzonenamebyid(g_zid, g_zonename, sizeof (g_zonename)) < 0) {
+ (void) fprintf(stderr, "%s: failed to get zonename: %s\n",
+ g_pname, strerror(errno));
+ return (E_ERROR);
+ }
+
+ if (argc < 1)
+ return (usage(stderr));
+
+ for (ii = 0; ii < IPDADM_NCMDS; ii++) {
+ cmd = &ipdadm_cmds[ii];
+ if (strcmp(argv[0], cmd->idc_name) == 0) {
+ argv++;
+ argc--;
+ assert(cmd->idc_func != NULL);
+ return (cmd->idc_func(argc, argv));
+ }
+ }
+
+ (void) fprintf(stderr, "%s: %s: unknown command\n", g_pname, argv[0]);
+ return (usage(stderr));
+}
diff --git a/usr/src/cmd/ipf/lib/common/load_hash.c b/usr/src/cmd/ipf/lib/common/load_hash.c
index e43ddf54a3..d91a831f44 100644
--- a/usr/src/cmd/ipf/lib/common/load_hash.c
+++ b/usr/src/cmd/ipf/lib/common/load_hash.c
@@ -7,6 +7,8 @@
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -17,6 +19,10 @@
#include "netinet/ip_lookup.h"
#include "netinet/ip_htable.h"
+#if SOLARIS
+#include "ipfzone.h"
+#endif
+
static int hashfd = -1;
@@ -35,6 +41,12 @@ ioctlfunc_t iocfunc;
hashfd = open(IPLOOKUP_NAME, O_RDWR);
if ((hashfd == -1) && ((opts & OPT_DONOTHING) == 0))
return -1;
+#if SOLARIS
+ if (setzone(hashfd) != 0) {
+ close(hashfd);
+ return -1;
+ }
+#endif
for (n = 0, a = list; a != NULL; a = a->ipe_next)
n++;
diff --git a/usr/src/cmd/ipf/lib/common/load_hashnode.c b/usr/src/cmd/ipf/lib/common/load_hashnode.c
index 8cf1bb2c67..dd343f3ab1 100644
--- a/usr/src/cmd/ipf/lib/common/load_hashnode.c
+++ b/usr/src/cmd/ipf/lib/common/load_hashnode.c
@@ -7,6 +7,8 @@
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -17,6 +19,10 @@
#include "netinet/ip_lookup.h"
#include "netinet/ip_htable.h"
+#if SOLARIS
+#include "ipfzone.h"
+#endif
+
static int hashfd = -1;
@@ -34,6 +40,12 @@ ioctlfunc_t iocfunc;
hashfd = open(IPLOOKUP_NAME, O_RDWR);
if ((hashfd == -1) && ((opts & OPT_DONOTHING) == 0))
return -1;
+#if SOLARIS
+ if (setzone(hashfd) != 0) {
+ close(hashfd);
+ return -1;
+ }
+#endif
op.iplo_type = IPLT_HASH;
op.iplo_unit = unit;
diff --git a/usr/src/cmd/ipf/lib/common/load_pool.c b/usr/src/cmd/ipf/lib/common/load_pool.c
index b8146c060c..e09f77f6b4 100644
--- a/usr/src/cmd/ipf/lib/common/load_pool.c
+++ b/usr/src/cmd/ipf/lib/common/load_pool.c
@@ -7,6 +7,8 @@
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -17,6 +19,10 @@
#include "netinet/ip_lookup.h"
#include "netinet/ip_pool.h"
+#if SOLARIS
+#include "ipfzone.h"
+#endif
+
static int poolfd = -1;
@@ -32,6 +38,12 @@ ioctlfunc_t iocfunc;
poolfd = open(IPLOOKUP_NAME, O_RDWR);
if ((poolfd == -1) && ((opts & OPT_DONOTHING) == 0))
return -1;
+#if SOLARIS
+ if (setzone(poolfd) != 0) {
+ close(poolfd);
+ return -1;
+ }
+#endif
op.iplo_unit = plp->ipo_unit;
op.iplo_type = IPLT_POOL;
diff --git a/usr/src/cmd/ipf/lib/common/load_poolnode.c b/usr/src/cmd/ipf/lib/common/load_poolnode.c
index e992a80281..37c7ef861e 100644
--- a/usr/src/cmd/ipf/lib/common/load_poolnode.c
+++ b/usr/src/cmd/ipf/lib/common/load_poolnode.c
@@ -4,6 +4,8 @@
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id: load_poolnode.c,v 1.3.2.1 2004/03/06 14:33:29 darrenr Exp $
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <fcntl.h>
@@ -12,6 +14,10 @@
#include "netinet/ip_lookup.h"
#include "netinet/ip_pool.h"
+#if SOLARIS
+#include "ipfzone.h"
+#endif
+
static int poolfd = -1;
@@ -29,6 +35,12 @@ ioctlfunc_t iocfunc;
poolfd = open(IPLOOKUP_NAME, O_RDWR);
if ((poolfd == -1) && ((opts & OPT_DONOTHING) == 0))
return -1;
+#if SOLARIS
+ if (setzone(poolfd) != 0) {
+ close(poolfd);
+ return -1;
+ }
+#endif
op.iplo_unit = role;
op.iplo_type = IPLT_POOL;
diff --git a/usr/src/cmd/ipf/tools/Makefile.tools b/usr/src/cmd/ipf/tools/Makefile.tools
index 71f81169f1..ccc5bf3c93 100644
--- a/usr/src/cmd/ipf/tools/Makefile.tools
+++ b/usr/src/cmd/ipf/tools/Makefile.tools
@@ -22,17 +22,19 @@
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# Copyright (c) 2012, Joyent Inc. All rights reserved.
+#
PROG= ipf ipfs ipmon ipnat ippool ipfstat
IPFPROG= ipftest
-IPF_OBJS= ipf.o ipfcomp.o ipf_y.o ipf_l.o
-IPFS_OBJS= ipfs.o
-IPFSTAT_OBJS= ipfstat.o
-IPMON_OBJS= ipmon.o ipmon_y.o ipmon_l.o
-IPNAT_OBJS= ipnat.o ipnat_y.o ipnat_l.o
-IPPOOL_OBJS= ippool.o ippool_y.o ippool_l.o
-IPFTEST_OBJS= ipftest.o \
+IPF_OBJS= ipf.o ipfcomp.o ipfzone.o ipf_y.o ipf_l.o
+IPFS_OBJS= ipfs.o ipfzone.o
+IPFSTAT_OBJS= ipfstat.o ipfzone.o
+IPMON_OBJS= ipmon.o ipfzone.o ipmon_y.o ipmon_l.o
+IPNAT_OBJS= ipnat.o ipfzone.o ipnat_y.o ipnat_l.o
+IPPOOL_OBJS= ippool.o ipfzone.o ippool_y.o ippool_l.o
+IPFTEST_OBJS= ipftest.o ipfzone.o \
ip_fil.o ip_state.o ip_compat.o \
ip_frag.o ip_nat.o ip_nat6.o fil.o \
ip_htable.o ip_lookup.o \
diff --git a/usr/src/cmd/ipf/tools/ipf.c b/usr/src/cmd/ipf/tools/ipf.c
index e81389b342..5f1406fbf5 100644
--- a/usr/src/cmd/ipf/tools/ipf.c
+++ b/usr/src/cmd/ipf/tools/ipf.c
@@ -5,6 +5,8 @@
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifdef __FreeBSD__
@@ -21,6 +23,10 @@
#include <sys/ioctl.h>
#include "netinet/ipl.h"
+#ifdef SOLARIS
+#include "ipfzone.h"
+#endif
+
#if !defined(lint)
static const char sccsid[] = "@(#)ipf.c 1.23 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)$Id: ipf.c,v 1.35.2.3 2004/12/15 18:27:17 darrenr Exp $";
@@ -62,9 +68,14 @@ static ioctlfunc_t iocfunctions[IPL_LOGSIZE] = { ioctl, ioctl, ioctl,
static void usage()
{
- fprintf(stderr, "usage: ipf [-6AdDEInoPrRsvVyzZ] %s %s %s\n",
+ fprintf(stderr, "usage: ipf [-6AdDEInoPrRsvVyzZ] %s %s %s",
"[-l block|pass|nomatch|state|nat]", "[-cc] [-F i|o|a|s|S|u]",
"[-f filename] [-T <tuneopts>]");
+#if SOLARIS
+ fprintf(stderr, " [zonename]\n");
+#else
+ fprintf(stderr, "\n");
+#endif
exit(1);
}
@@ -74,11 +85,20 @@ int argc;
char *argv[];
{
int c;
+ const char *optstr = "6Ac:dDEf:F:Il:noPrRsT:vVyzZ";
if (argc < 2)
usage();
- while ((c = getopt(argc, argv, "6Ac:dDEf:F:Il:noPrRsT:vVyzZ")) != -1) {
+#if SOLARIS
+ /*
+ * We need to set the zone name before calling the functions
+ * in the switch statement below
+ */
+ getzonearg(argc, argv, optstr);
+#endif
+
+ while ((c = getopt(argc, argv, optstr)) != -1) {
switch (c)
{
case '?' :
@@ -187,6 +207,14 @@ int check;
if ((fd = open(ipfdev, O_RDWR)) == -1)
if ((fd = open(ipfdev, O_RDONLY)) == -1)
perror("open device");
+
+#if SOLARIS
+ if (setzone(fd) != 0) {
+ close(fd);
+ return -1;
+ }
+#endif
+
return fd;
}
@@ -307,6 +335,13 @@ char *opt;
if (opts & OPT_VERBOSE)
printf("set state log flag\n");
xfd = open(IPSTATE_NAME, O_RDWR);
+#if SOLARIS
+ if (xfd >= 0 && setzone(xfd) != 0) {
+ close(xfd);
+ xfd = -1;
+ }
+#endif
+
if (xfd >= 0) {
logopt = 0;
if (ioctl(xfd, SIOCGETLG, &logopt))
@@ -324,6 +359,13 @@ char *opt;
if (opts & OPT_VERBOSE)
printf("set nat log flag\n");
xfd = open(IPNAT_NAME, O_RDWR);
+#if SOLARIS
+ if (xfd >= 0 && setzone(xfd) != 0) {
+ close(xfd);
+ xfd = -1;
+ }
+#endif
+
if (xfd >= 0) {
logopt = 0;
if (ioctl(xfd, SIOCGETLG, &logopt))
@@ -516,6 +558,14 @@ static int showversion()
return 1;
}
+#if SOLARIS
+ if (setzone(vfd) != 0) {
+ close(vfd);
+ return 1;
+ }
+#endif
+
+
if (ioctl(vfd, SIOCGETFS, &ipfo)) {
perror("ioctl(SIOCGETFS)");
close(vfd);
diff --git a/usr/src/cmd/ipf/tools/ipfs.c b/usr/src/cmd/ipf/tools/ipfs.c
index da8387324a..b5b9eebac1 100644
--- a/usr/src/cmd/ipf/tools/ipfs.c
+++ b/usr/src/cmd/ipf/tools/ipfs.c
@@ -5,6 +5,8 @@
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifdef __FreeBSD__
@@ -44,6 +46,9 @@
#include <resolv.h>
#include "ipf.h"
#include "netinet/ipl.h"
+#if SOLARIS
+#include "ipfzone.h"
+#endif
#if !defined(lint)
static const char rcsid[] = "@(#)Id: ipfs.c,v 1.12 2003/12/01 01:56:53 darrenr Exp";
@@ -86,14 +91,21 @@ char *progname;
void usage()
{
- fprintf(stderr, "usage: %s [-nv] -l\n", progname);
- fprintf(stderr, "usage: %s [-nv] -u\n", progname);
- fprintf(stderr, "usage: %s [-nv] [-d <dir>] -R\n", progname);
- fprintf(stderr, "usage: %s [-nv] [-d <dir>] -W\n", progname);
- fprintf(stderr, "usage: %s [-nv] [-N|-S] [-f <file>] -r\n", progname);
- fprintf(stderr, "usage: %s [-nv] [-N|-S] [-f <file>] -w\n", progname);
- fprintf(stderr, "usage: %s [-nv] [-N|-S] -f <file> -i <if1>,<if2>\n",
- progname);
+#if SOLARIS
+ const char *zoneopt = "[-z zonename] ";
+#else
+ const char *zoneopt = "";
+#endif
+ fprintf(stderr, "usage: %s %s[-nv] -l\n", progname, zoneopt);
+ fprintf(stderr, "usage: %s %s[-nv] -u\n", progname, zoneopt);
+ fprintf(stderr, "usage: %s %s[-nv] [-d <dir>] -R\n", progname, zoneopt);
+ fprintf(stderr, "usage: %s %s[-nv] [-d <dir>] -W\n", progname, zoneopt);
+ fprintf(stderr, "usage: %s %s[-nv] [-N|-S] [-f <file>] -r\n", progname,
+ zoneopt);
+ fprintf(stderr, "usage: %s %s[-nv] [-N|-S] [-f <file>] -w\n", progname,
+ zoneopt);
+ fprintf(stderr, "usage: %s %s[-nv] [-N|-S] -f <file> -i <if1>,<if2>\n",
+ progname, zoneopt);
exit(1);
}
@@ -218,7 +230,7 @@ char *argv[];
char *dirname = NULL, *filename = NULL, *ifs = NULL;
progname = argv[0];
- while ((c = getopt(argc, argv, "d:f:lNnSRruvWw")) != -1)
+ while ((c = getopt(argc, argv, "d:f:lNnSRruvWwz:")) != -1)
switch (c)
{
case 'd' :
@@ -287,6 +299,11 @@ char *argv[];
rw = 3;
set = 1;
break;
+#if SOLARIS
+ case 'z' :
+ setzonename(optarg);
+ break;
+#endif
case '?' :
default :
usage();
@@ -355,6 +372,14 @@ char *ipfdev;
if ((fd = open(ipfdev, O_RDWR)) == -1)
if ((fd = open(ipfdev, O_RDONLY)) == -1)
perror("open device");
+
+#if SOLARIS
+ if (setzone(fd) != 0) {
+ close(fd);
+ fd = -1;
+ }
+#endif
+
return fd;
}
diff --git a/usr/src/cmd/ipf/tools/ipfstat.c b/usr/src/cmd/ipf/tools/ipfstat.c
index 27b018e273..916d75277b 100644
--- a/usr/src/cmd/ipf/tools/ipfstat.c
+++ b/usr/src/cmd/ipf/tools/ipfstat.c
@@ -5,6 +5,8 @@
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifdef __FreeBSD__
@@ -162,6 +164,10 @@ static int sort_dstip __P((const void *, const void *));
static int sort_dstpt __P((const void *, const void *));
#endif
+#if SOLARIS
+#include "ipfzone.h"
+#endif
+
static void usage(name)
char *name;
@@ -177,6 +183,9 @@ char *name;
#else
fprintf(stderr, " %s -t [-C] ", name);
#endif
+#ifdef SOLARIS
+ fprintf(stderr, "[-z zonename] ");
+#endif
fprintf(stderr, "[-D destination address] [-P protocol] [-S source address] [-T refresh time]\n");
exit(1);
}
@@ -207,9 +216,9 @@ char *argv[];
u_32_t frf;
#ifdef USE_INET6
- options = "6aACdfghIilnostvD:M:N:P:RS:T:";
+ options = "6aACdfghIilnostvD:M:N:P:RS:T:z:";
#else
- options = "aACdfghIilnostvD:M:N:P:RS:T:";
+ options = "aACdfghIilnostvD:M:N:P:RS:T:z:";
#endif
saddr.in4.s_addr = INADDR_ANY; /* default any v4 source addr */
@@ -223,7 +232,7 @@ char *argv[];
opterr = 0;
/*
- * Parse these two arguments now lest there be any buffer overflows
+ * Parse these three arguments now lest there be any buffer overflows
* in the parsing of the rest.
*/
myoptind = optind;
@@ -238,6 +247,14 @@ char *argv[];
kern = optarg;
live_kernel = 0;
break;
+ case 'z' :
+#if SOLARIS
+ setzonename(optarg);
+#else
+ usage(argv[0]);
+ break;
+#endif
+ break;
}
}
optind = myoptind;
@@ -247,11 +264,23 @@ char *argv[];
perror("open(IPSTATE_NAME)");
exit(-1);
}
+#if SOLARIS
+ if (setzone(state_fd) != 0) {
+ close(state_fd);
+ exit(-1);
+ }
+#endif
if ((ipf_fd = open(device, O_RDONLY)) == -1) {
fprintf(stderr, "open(%s)", device);
perror("");
exit(-1);
}
+#if SOLARIS
+ if (setzone(ipf_fd) != 0) {
+ close(ipf_fd);
+ exit(-1);
+ }
+#endif
}
if (kern != NULL || memf != NULL) {
@@ -360,6 +389,8 @@ char *argv[];
opts |= OPT_VERBOSE;
opts |= OPT_UNDEF;
break;
+ case 'z' :
+ break;
default :
usage(argv[0]);
break;
@@ -482,6 +513,13 @@ u_32_t *frfp;
exit(-1);
}
+#if SOLARIS
+ if (setzone(ipf_fd) != 0) {
+ close(ipf_fd);
+ exit(-1);
+ }
+#endif
+
bzero((caddr_t)&ipfo, sizeof(ipfo));
ipfo.ipfo_rev = IPFILTER_VERSION;
ipfo.ipfo_size = sizeof(fr_authstat_t);
diff --git a/usr/src/cmd/ipf/tools/ipfzone.c b/usr/src/cmd/ipf/tools/ipfzone.c
new file mode 100644
index 0000000000..1dabbcd447
--- /dev/null
+++ b/usr/src/cmd/ipf/tools/ipfzone.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * See the IPFILTER.LICENCE file for details on licensing.
+ */
+
+
+#include <errno.h>
+#include <net/if.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <zone.h>
+
+#include "netinet/ip_fil.h"
+#include "ipfzone.h"
+
+static ipfzoneobj_t ipzo;
+static int do_setzone = 0;
+
+extern int errno;
+extern int optind;
+extern char *optarg;
+
+/*
+ * Get the zonename if it's the last argument and set the zonename
+ * in ipfzo to it
+ */
+void
+getzonearg(int argc, char *argv[], const char *optstr)
+{
+ /*
+ * Let getopt figure out if the last argument belongs to a flag or is
+ * actually a zonename.
+ */
+ while (getopt(argc, argv, optstr) != -1) { }
+
+ if (optind < argc)
+ setzonename(argv[optind]);
+
+ /*
+ * Reset optind so the next getopt call will go through all of argv
+ * again.
+ */
+ optind = 1;
+}
+
+/*
+ * Get a -z option from argv and set the zonename in ipfzo accordingly
+ */
+void
+getzoneopt(int argc, char *argv[], const char *optstr)
+{
+ int c;
+
+ while ((c = getopt(argc, argv, optstr)) != -1) {
+ if (c == 'z')
+ setzonename(optarg);
+ }
+
+ /*
+ * Reset optind so the next getopt call will go through all of argv
+ * again.
+ */
+ optind = 1;
+}
+
+/*
+ * Set the zonename in ipfzo to the given string
+ */
+void
+setzonename(const char *zonename)
+{
+ memcpy(ipzo.ipfz_zonename, zonename, sizeof (ipzo.ipfz_zonename));
+ do_setzone = 1;
+}
+
+/*
+ * Set the zone that all further ioctls will operate on
+ */
+int
+setzone(int fd)
+{
+ if (!do_setzone)
+ return (0);
+
+ if (ioctl(fd, SIOCIPFZONESET, &ipzo) == -1) {
+ switch (errno) {
+ case ENODEV:
+ (void) fprintf(stderr,
+ "Could not find running zone: %s\n",
+ ipzo.ipfz_zonename);
+ break;
+ case EACCES:
+ (void) fprintf(stderr,
+ "Permission denied setting zone: %s\n",
+ ipzo.ipfz_zonename);
+ break;
+ default:
+ perror("Error setting zone");
+ }
+ return (-1);
+ }
+
+ return (0);
+}
diff --git a/usr/src/cmd/ipf/tools/ipfzone.h b/usr/src/cmd/ipf/tools/ipfzone.h
new file mode 100644
index 0000000000..a62747af7d
--- /dev/null
+++ b/usr/src/cmd/ipf/tools/ipfzone.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * See the IPFILTER.LICENCE file for details on licensing.
+ */
+
+#ifndef __IPFZONE_H__
+#define __IPFZONE_H__
+
+void getzonearg(int, char *[], const char *);
+void getzoneopt(int, char *[], const char *);
+int setzone(int);
+void setzonename(const char *);
+
+#endif /* __IPFZONE_H__ */
diff --git a/usr/src/cmd/ipf/tools/ipmon.c b/usr/src/cmd/ipf/tools/ipmon.c
index d4a351b015..0c025b8c56 100644
--- a/usr/src/cmd/ipf/tools/ipmon.c
+++ b/usr/src/cmd/ipf/tools/ipmon.c
@@ -5,6 +5,8 @@
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
@@ -78,6 +80,9 @@
#include "netinet/ip_state.h"
#include "netinet/ip_proxy.h"
#include "ipmon.h"
+#if SOLARIS
+#include "ipfzone.h"
+#endif
#if !defined(lint)
static const char sccsid[] = "@(#)ipmon.c 1.21 6/5/96 (C)1993-2000 Darren Reed";
@@ -1340,8 +1345,13 @@ printipflog:
static void usage(prog)
char *prog;
{
- fprintf(stderr, "%s: [-abDFhnpstvxX] %s %s %s %s %s %s\n",
- prog, "[-N device]", "[ [-o [NSI]] [-O [NSI]]",
+#if SOLARIS
+ const char *zoneopt = " [-z zonename]";
+#else
+ const char *zoneopt = "";
+#endif
+ fprintf(stderr, "%s: [-abDFhnpstvxX]%s %s %s %s %s %s %s\n",
+ prog, zoneopt, "[-N device]", "[ [-o [NSI]] [-O [NSI]]",
"[-P pidfile]", "[-S device]", "[-f device]",
"filename");
exit(1);
@@ -1380,6 +1390,13 @@ FILE *log;
exit(1);
}
+#if SOLARIS
+ if (setzone(fd) != 0) {
+ close(fd);
+ exit(1);
+ }
+#endif
+
if (ioctl(fd, SIOCIPFFB, &flushed) == 0) {
printf("%d bytes flushed from log buffer\n",
flushed);
@@ -1444,6 +1461,7 @@ char *argv[];
char buf[DEFAULT_IPFLOGSIZE], *iplfile[3], *s;
extern int optind;
extern char *optarg;
+ const char *optstr = "?abB:C:Df:FhnN:o:O:pP:sS:tvxXz:";
fd[0] = fd[1] = fd[2] = -1;
fdt[0] = fdt[1] = fdt[2] = -1;
@@ -1451,7 +1469,15 @@ char *argv[];
iplfile[1] = IPNAT_NAME;
iplfile[2] = IPSTATE_NAME;
- while ((c = getopt(argc, argv, "?abB:C:Df:FhnN:o:O:pP:sS:tvxX")) != -1)
+#if SOLARIS
+ /*
+ * We need to set the zone name before calling openlog in
+ * the switch statement below
+ */
+ getzoneopt(argc, argv, optstr);
+#endif
+
+ while ((c = getopt(argc, argv, optstr)) != -1)
switch (c)
{
case 'a' :
@@ -1535,6 +1561,10 @@ char *argv[];
case 'X' :
opts |= OPT_HEXHDR;
break;
+#if SOLARIS
+ case 'z' :
+ break;
+#endif
default :
case 'h' :
case '?' :
@@ -1571,6 +1601,13 @@ char *argv[];
exit(1);
/* NOTREACHED */
}
+
+#if SOLARIS
+ if (setzone(fd[i]) != 0) {
+ close(fd[i]);
+ exit(1);
+ }
+#endif
if (!(regular[i] = !S_ISCHR(sb.st_mode)))
devices++;
}
diff --git a/usr/src/cmd/ipf/tools/ipnat.c b/usr/src/cmd/ipf/tools/ipnat.c
index 4a9a37a4a9..1f320a606f 100644
--- a/usr/src/cmd/ipf/tools/ipnat.c
+++ b/usr/src/cmd/ipf/tools/ipnat.c
@@ -7,6 +7,8 @@
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
@@ -56,6 +58,10 @@
#include "netinet/ipl.h"
#include "kmem.h"
+#if SOLARIS
+#include "ipfzone.h"
+#endif
+
#ifdef __hpux
# define nlist nlist64
#endif
@@ -95,7 +101,12 @@ int opts;
void usage(name)
char *name;
{
- fprintf(stderr, "Usage: %s [-CdFhlnrRsv] [-f filename]\n", name);
+ fprintf(stderr, "Usage: %s [-CdFhlnrRsv] [-f filename]", name);
+#if SOLARIS
+ fprintf(stderr, " [-z zonename]\n");
+#else
+ fprintf(stderr, "\n");
+#endif
exit(1);
}
@@ -117,7 +128,7 @@ char *argv[];
kernel = NULL;
mode = O_RDWR;
- while ((c = getopt(argc, argv, "CdFf:hlM:N:nrRsv")) != -1)
+ while ((c = getopt(argc, argv, "CdFf:hlM:N:nrRsvz:")) != -1)
switch (c)
{
case 'C' :
@@ -162,6 +173,11 @@ char *argv[];
case 'v' :
opts |= OPT_VERBOSE;
break;
+#if SOLARIS
+ case 'z' :
+ setzonename(optarg);
+ break;
+#endif
default :
usage(argv[0]);
}
@@ -194,6 +210,12 @@ char *argv[];
STRERROR(errno));
exit(1);
}
+#if SOLARIS
+ if (setzone(fd) != 0) {
+ close(fd);
+ exit(1);
+ }
+#endif
bzero((char *)&obj, sizeof(obj));
obj.ipfo_rev = IPFILTER_VERSION;
diff --git a/usr/src/cmd/ipf/tools/ippool.c b/usr/src/cmd/ipf/tools/ippool.c
index 5f18379420..adf6ba7b69 100644
--- a/usr/src/cmd/ipf/tools/ippool.c
+++ b/usr/src/cmd/ipf/tools/ippool.c
@@ -5,6 +5,8 @@
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -42,6 +44,10 @@
#include "netinet/ip_htable.h"
#include "kmem.h"
+#if SOLARIS
+#include "ipfzone.h"
+#endif
+
extern int ippool_yyparse __P((void));
extern int ippool_yydebug;
extern FILE *ippool_yyin;
@@ -71,15 +77,25 @@ int use_inet6 = 0;
void usage(prog)
char *prog;
{
+#if SOLARIS
+ const char *zoneopt = "[-z zonename] ";
+#else
+ const char *zoneopt = "";
+#endif
fprintf(stderr, "Usage:\t%s\n", prog);
- fprintf(stderr, "\t\t\t-a [-dnv] [-m <name>] [-o <role>] -i <ipaddr>[/netmask]\n");
- fprintf(stderr, "\t\t\t-A [-dnv] [-m <name>] [-o <role>] [-S <seed>] [-t <type>]\n");
- fprintf(stderr, "\t\t\t-f <file> [-dnuv]\n");
- fprintf(stderr, "\t\t\t-F [-dv] [-o <role>] [-t <type>]\n");
- fprintf(stderr, "\t\t\t-l [-dv] [-m <name>] [-t <type>]\n");
- fprintf(stderr, "\t\t\t-r [-dnv] [-m <name>] [-o <role>] -i <ipaddr>[/netmask]\n");
- fprintf(stderr, "\t\t\t-R [-dnv] [-m <name>] [-o <role>] [-t <type>]\n");
- fprintf(stderr, "\t\t\t-s [-dtv] [-M <core>] [-N <namelist>]\n");
+ fprintf(stderr, "\t\t\t-a [-dnv] %s[-m <name>] [-o <role>] -i <ipaddr>[/netmask]\n",
+ zoneopt);
+ fprintf(stderr, "\t\t\t-A [-dnv] %s[-m <name>] [-o <role>] [-S <seed>] [-t <type>]\n",
+ zoneopt);
+ fprintf(stderr, "\t\t\t-f <file> %s[-dnuv]\n", zoneopt);
+ fprintf(stderr, "\t\t\t-F [-dv] %s[-o <role>] [-t <type>]\n", zoneopt);
+ fprintf(stderr, "\t\t\t-l [-dv] %s[-m <name>] [-t <type>]\n", zoneopt);
+ fprintf(stderr, "\t\t\t-r [-dnv] %s[-m <name>] [-o <role>] -i <ipaddr>[/netmask]\n",
+ zoneopt);
+ fprintf(stderr, "\t\t\t-R [-dnv] %s[-m <name>] [-o <role>] [-t <type>]\n",
+ zoneopt);
+ fprintf(stderr, "\t\t\t-s [-dtv] %s[-M <core>] [-N <namelist>]\n",
+ zoneopt);
exit(1);
}
@@ -140,7 +156,7 @@ char *argv[];
role = IPL_LOGIPF;
bzero((char *)&node, sizeof(node));
- while ((c = getopt(argc, argv, "di:m:no:Rv")) != -1)
+ while ((c = getopt(argc, argv, "di:m:no:Rvz:")) != -1)
switch (c)
{
case 'd' :
@@ -219,7 +235,7 @@ char *argv[];
bzero((char *)&iph, sizeof(iph));
bzero((char *)&pool, sizeof(pool));
- while ((c = getopt(argc, argv, "dm:no:RS:t:v")) != -1)
+ while ((c = getopt(argc, argv, "dm:no:RS:t:vz:")) != -1)
switch (c)
{
case 'd' :
@@ -308,7 +324,7 @@ char *argv[], *infile;
infile = optarg;
- while ((c = getopt(argc, argv, "dnRuv")) != -1)
+ while ((c = getopt(argc, argv, "dnRuvz:")) != -1)
switch (c)
{
case 'd' :
@@ -327,6 +343,13 @@ char *argv[], *infile;
case 'v' :
opts |= OPT_VERBOSE;
break;
+ case 'z' :
+#if SOLARIS
+ setzonename(optarg);
+#else
+ usage(argv[0]);
+#endif
+ break;
}
if (opts & OPT_DEBUG)
@@ -338,6 +361,12 @@ char *argv[], *infile;
perror("open(IPLOOKUP_NAME)");
exit(1);
}
+#if SOLARIS
+ if (setzone(fd) != 0) {
+ close(fd);
+ exit(1);
+ }
+#endif
}
if (ippool_parsefile(fd, infile, ioctl) != 0)
@@ -365,7 +394,7 @@ char *argv[];
poolname = NULL;
role = IPL_LOGALL;
- while ((c = getopt(argc, argv, "dm:M:N:o:Rt:v")) != -1)
+ while ((c = getopt(argc, argv, "dm:M:N:o:Rt:vz:")) != -1)
switch (c)
{
case 'd' :
@@ -402,6 +431,13 @@ char *argv[];
case 'v' :
opts |= OPT_VERBOSE;
break;
+ case 'z' :
+#if SOLARIS
+ setzonename(optarg);
+#else
+ usage(argv[0]);
+#endif
+ break;
}
if (opts & OPT_DEBUG)
@@ -413,6 +449,12 @@ char *argv[];
perror("open(IPLOOKUP_NAME)");
exit(1);
}
+#if SOLARIS
+ if (setzone(fd) != 0) {
+ close(fd);
+ exit(1);
+ }
+#endif
}
bzero((char *)&op, sizeof(op));
@@ -615,7 +657,7 @@ char *argv[];
bzero((char *)&op, sizeof(op));
- while ((c = getopt(argc, argv, "dM:N:o:t:v")) != -1)
+ while ((c = getopt(argc, argv, "dM:N:o:t:vz:")) != -1)
switch (c)
{
case 'd' :
@@ -647,6 +689,12 @@ char *argv[];
case 'v' :
opts |= OPT_VERBOSE;
break;
+ case 'z' :
+#if SOLARIS
+ setzonename(optarg);
+#else
+ usage(argv[0]);
+#endif
}
if (opts & OPT_DEBUG)
@@ -658,6 +706,12 @@ char *argv[];
perror("open(IPLOOKUP_NAME)");
exit(1);
}
+#if SOLARIS
+ if (setzone(fd) != 0) {
+ close(fd);
+ exit(1);
+ }
+#endif
}
if (type == IPLT_ALL || type == IPLT_POOL) {
@@ -705,7 +759,7 @@ char *argv[];
type = IPLT_ALL;
role = IPL_LOGALL;
- while ((c = getopt(argc, argv, "do:t:v")) != -1)
+ while ((c = getopt(argc, argv, "do:t:vz:")) != -1)
switch (c)
{
case 'd' :
@@ -728,6 +782,13 @@ char *argv[];
case 'v' :
opts |= OPT_VERBOSE;
break;
+ case 'z' :
+#if SOLARIS
+ setzonename(optarg);
+#else
+ usage(argv[0]);
+#endif
+ break;
}
if (opts & OPT_DEBUG)
@@ -739,6 +800,12 @@ char *argv[];
perror("open(IPLOOKUP_NAME)");
exit(1);
}
+#if SOLARIS
+ if (setzone(fd) != 0) {
+ close(fd);
+ exit(1);
+ }
+#endif
}
bzero((char *)&flush, sizeof(flush));
diff --git a/usr/src/cmd/isns/isnsadm/Makefile b/usr/src/cmd/isns/isnsadm/Makefile
index 77c0349c65..e121b27ff0 100644
--- a/usr/src/cmd/isns/isnsadm/Makefile
+++ b/usr/src/cmd/isns/isnsadm/Makefile
@@ -31,7 +31,7 @@ include ../../Makefile.cmd
LDLIBS += -lxml2 -lscf -lc
CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I. -I/usr/include/libxml2 -I../isnsd
+CPPFLAGS += -I. -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I../isnsd
POFILE = isnsadm_all.po
POFILES = $(OBJS:%.o=%.po)
diff --git a/usr/src/cmd/isns/isnsd/Makefile b/usr/src/cmd/isns/isnsd/Makefile
index 0b0425d5e2..aaecd2ae6f 100644
--- a/usr/src/cmd/isns/isnsd/Makefile
+++ b/usr/src/cmd/isns/isnsd/Makefile
@@ -51,7 +51,7 @@ ROOTMANIFESTDIR = $(ROOTSVCNETWORK)
$(ROOTSVCNETWORK)/isns_server.xml := FILEMODE = 0444
CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I./ -I/usr/include/libxml2
+CPPFLAGS += -I./ -I$(ADJUNCT_PROTO)/usr/include/libxml2
CPPFLAGS += -DTARGET_DATA_STORE=$(DATA_STORE)
CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS
LINTFLAGS += -xerroff=E_BAD_PTR_CAST_ALIGN
diff --git a/usr/src/cmd/krb5/kadmin/Makefile b/usr/src/cmd/krb5/kadmin/Makefile
index 22a8259cc5..398aa66fd6 100644
--- a/usr/src/cmd/krb5/kadmin/Makefile
+++ b/usr/src/cmd/krb5/kadmin/Makefile
@@ -27,7 +27,7 @@ include ../../Makefile.cmd
SUBDIRS= cli dbutil ktutil kpasswd server kclient kdcmgr
# EXPORT DELETE START
-SUBDIRS += gui
+#SUBDIRS += gui
# EXPORT DELETE END
all := TARGET= all
diff --git a/usr/src/cmd/latencytop/Makefile.com b/usr/src/cmd/latencytop/Makefile.com
index 16884c4fd3..32e74087c8 100644
--- a/usr/src/cmd/latencytop/Makefile.com
+++ b/usr/src/cmd/latencytop/Makefile.com
@@ -32,6 +32,8 @@ include ../../Makefile.cmd
CFLAGS += $(CCVERBOSE)
CFLAGS64 += $(CCVERBOSE)
+CPPFLAGS += -DEMBED_CONFIGS -I$(ADJUNCT_PROTO)/usr/include/glib-2.0 \
+ -I$(ADJUNCT_PROTO)/usr/lib/glib-2.0/include
CERRWARN += -_gcc=-Wno-uninitialized
CPPFLAGS += -DEMBED_CONFIGS -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
diff --git a/usr/src/cmd/localedef/Makefile b/usr/src/cmd/localedef/Makefile
index bd41aa702e..9acfe6dfbf 100644
--- a/usr/src/cmd/localedef/Makefile
+++ b/usr/src/cmd/localedef/Makefile
@@ -12,6 +12,7 @@
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright 2011 EveryCity Ltd. All rights reserved.
+# Copyright 2012 Joyent, Inc. All rights reserved.
#
PROG=localedef
@@ -42,19 +43,19 @@ CLEANFILES += \
8859-11.cm 8859-13.cm 8859-14.cm 8859-15.cm \
8859-16.cm \
KOI8-R.cm
-CLOBBERFILES = $(PROG) $(POFILE) $(DATA:%=locale/%)
+CLOBBERFILES = $(PROG) $(POFILE) $(DATA:%=%)
PIFILES = $(OBJS:%.o=%.i)
POFILE = localedef_cmd.po
ISO8859_1_LOCALES = \
da_DK \
- de_CH \
+ de_CH de_DE \
en_AU en_CA en_GB en_NZ en_US \
- es_AR es_BO es_CL es_CO es_EC es_GT es_MX es_NI es_PA \
+ es_AR es_BO es_CL es_CO es_EC es_ES es_GT es_MX es_NI es_PA \
es_PE es_SV es_UY es_VE \
- fr_CA fr_CH \
+ fr_CA fr_CH fr_FR \
is_IS \
- it_CH \
+ it_CH it_IT \
sv_SE
ISO8859_2_LOCALES = \
@@ -267,8 +268,11 @@ locale/%.UTF-8/stamp: data/%.UTF-8.src UTF-8.cm \
$(SED) '/^LC_CTYPE/,/^END LC_CTYPE/d;$$r UTF-8.ct' $< | \
./$(PROG) -U -f UTF-8.cm $(@D)
$(TOUCH) $@
+# Convert EURO_SIGN to CURRENCY_SIGN for the ISO8859-1 locales
locale/%.ISO8859-1/stamp: data/%.UTF-8.src 8859-1.cm locale $(PROG)
- ./$(PROG) -U -i $< -f 8859-1.cm $(@D)
+ sed 's/EURO_SIGN/CURRENCY_SIGN/' $< > $<.tmp
+ ./$(PROG) -U -i $<.tmp -f 8859-1.cm $(@D)
+ rm -f $<.tmp
$(TOUCH) $@
locale/%.ISO8859-2/stamp: data/%.UTF-8.src 8859-2.cm locale $(PROG)
./$(PROG) -U -i $< -f 8859-2.cm $(@D)
diff --git a/usr/src/cmd/lofiadm/main.c b/usr/src/cmd/lofiadm/main.c
index 23c127da4e..0d310c2579 100644
--- a/usr/src/cmd/lofiadm/main.c
+++ b/usr/src/cmd/lofiadm/main.c
@@ -143,7 +143,7 @@ lofi_compress_info_t lofi_compress_table[LOFI_COMPRESS_FUNCTIONS] = {
#define KILOBYTE 1024
#define MEGABYTE (KILOBYTE * KILOBYTE)
#define GIGABYTE (KILOBYTE * MEGABYTE)
-#define LIBZ "libz.so"
+#define LIBZ "libz.so.1"
static void
usage(const char *pname)
@@ -341,7 +341,8 @@ out:
* DO NOT use this function if the filename is actually the device name.
*/
static int
-lofi_map_file(int lfd, struct lofi_ioctl li, const char *filename)
+lofi_map_file(int lfd, struct lofi_ioctl li, const char *filename,
+ boolean_t no_devlink_flag)
{
int minor;
@@ -354,7 +355,8 @@ lofi_map_file(int lfd, struct lofi_ioctl li, const char *filename)
"unsupported"));
die(gettext("could not map file %s"), filename);
}
- wait_until_dev_complete(minor);
+ if (!no_devlink_flag)
+ wait_until_dev_complete(minor);
return (minor);
}
@@ -364,7 +366,8 @@ lofi_map_file(int lfd, struct lofi_ioctl li, const char *filename)
*/
static void
add_mapping(int lfd, const char *devicename, const char *filename,
- mech_alias_t *cipher, const char *rkey, size_t rksz)
+ mech_alias_t *cipher, const char *rkey, size_t rksz,
+ boolean_t no_devlink_flag)
{
struct lofi_ioctl li;
@@ -398,7 +401,7 @@ add_mapping(int lfd, const char *devicename, const char *filename,
int minor;
/* pick one via the driver */
- minor = lofi_map_file(lfd, li, filename);
+ minor = lofi_map_file(lfd, li, filename, no_devlink_flag);
/* if mapping succeeds, print the one picked */
(void) printf("/dev/%s/%d\n", LOFI_BLOCK_NAME, minor);
return;
@@ -419,7 +422,8 @@ add_mapping(int lfd, const char *devicename, const char *filename,
die(gettext("could not map file %s to %s"), filename,
devicename);
}
- wait_until_dev_complete(li.li_minor);
+ if (!no_devlink_flag)
+ wait_until_dev_complete(li.li_minor);
}
/*
@@ -1288,7 +1292,7 @@ lofi_uncompress(int lfd, const char *filename)
if (statbuf.st_size == 0)
return;
- minor = lofi_map_file(lfd, li, filename);
+ minor = lofi_map_file(lfd, li, filename, B_FALSE);
(void) snprintf(devicename, sizeof (devicename), "/dev/%s/%d",
LOFI_BLOCK_NAME, minor);
@@ -1793,6 +1797,7 @@ main(int argc, char *argv[])
boolean_t ephflag = B_FALSE;
boolean_t compressflag = B_FALSE;
boolean_t uncompressflag = B_FALSE;
+ boolean_t no_devlink_flag = B_FALSE;
/* the next two work together for -c, -k, -T, -e options only */
boolean_t need_crypto = B_FALSE; /* if any -c, -k, -T, -e */
boolean_t cipher_only = B_TRUE; /* if -c only */
@@ -1808,7 +1813,7 @@ main(int argc, char *argv[])
(void) setlocale(LC_ALL, "");
(void) textdomain(TEXT_DOMAIN);
- while ((c = getopt(argc, argv, "a:c:Cd:efk:o:s:T:U")) != EOF) {
+ while ((c = getopt(argc, argv, "a:c:Cd:efk:o:s:T:UX")) != EOF) {
switch (c) {
case 'a':
addflag = B_TRUE;
@@ -1883,6 +1888,13 @@ main(int argc, char *argv[])
case 'U':
uncompressflag = B_TRUE;
break;
+ case 'X':
+ /*
+ * Private flag to skip the wait for the /dev links to
+ * be created.
+ */
+ no_devlink_flag = B_TRUE;
+ break;
case '?':
default:
errflag = B_TRUE;
@@ -2009,7 +2021,8 @@ main(int argc, char *argv[])
* Now to the real work.
*/
if (addflag)
- add_mapping(lfd, devicename, filename, cipher, rkey, rksz);
+ add_mapping(lfd, devicename, filename, cipher, rkey, rksz,
+ no_devlink_flag);
else if (compressflag)
lofi_compress(&lfd, filename, compress_index, segsize);
else if (uncompressflag)
diff --git a/usr/src/cmd/logadm/main.c b/usr/src/cmd/logadm/main.c
index d1f105f7be..b03782c3c3 100644
--- a/usr/src/cmd/logadm/main.c
+++ b/usr/src/cmd/logadm/main.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*
* logadm/main.c -- main routines for logadm
*
@@ -37,6 +38,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/filio.h>
+#include <sys/sysmacros.h>
#include <time.h>
#include <utime.h>
#include "err.h"
@@ -828,7 +830,7 @@ rotateto(struct fn *fnp, struct opts *opts, int n, struct fn *recentlog,
fn_free(dirname);
/* do the rename */
- if (opts_count(opts, "c") != NULL) {
+ if (n == 0 && opts_count(opts, "c") != NULL) {
docopytruncate(opts, fn_s(fnp), fn_s(newfile));
} else if (n == 0 && opts_count(opts, "M")) {
struct fn *rawcmd = fn_new(opts_optarg(opts, "M"));
@@ -1100,10 +1102,12 @@ docmd(struct opts *opts, const char *msg, const char *cmd,
static void
docopytruncate(struct opts *opts, const char *file, const char *file_copy)
{
- int fi, fo, len;
- char buf[4096];
+ int fi, fo;
+ char buf[128 * 1024];
struct stat s;
struct utimbuf times;
+ off_t written = 0, rem, last = 0, thresh = 1024 * 1024;
+ ssize_t len;
/* print info if necessary */
if (opts_count(opts, "vn") != NULL) {
@@ -1129,7 +1133,7 @@ docopytruncate(struct opts *opts, const char *file, const char *file_copy)
}
/* create new file for copy destination with correct attributes */
- if ((fo = open(file_copy, O_CREAT|O_APPEND|O_WRONLY, s.st_mode)) < 0) {
+ if ((fo = open(file_copy, O_CREAT|O_TRUNC|O_WRONLY, s.st_mode)) < 0) {
err(EF_SYS, "cannot create file: %s", file_copy);
(void) close(fi);
return;
@@ -1137,6 +1141,77 @@ docopytruncate(struct opts *opts, const char *file, const char *file_copy)
(void) fchown(fo, s.st_uid, s.st_gid);
+ /*
+ * Now we'll loop, reading the log file and writing it to our copy
+ * until the bytes remaining are beneath our atomicity threshold -- at
+ * which point we'll lock the file and copy the remainder atomically.
+ * The body of this loop is non-atomic with respect to writers, the
+ * rationale being that total atomicity (that is, locking the file for
+ * the entire duration of the copy) comes at too great a cost for a
+ * large log file, as the writer (i.e., the daemon whose log is being
+ * rolled) can be blocked for an unacceptable duration. (For one
+ * particularly loquacious daemon, this period was observed to be
+ * several minutes in length -- a time so long that it induced
+ * additional failures in dependent components.) Note that this means
+ * that if the log file is not always appended to -- if it is opened
+ * without O_APPEND or otherwise truncated outside of logadm -- this
+ * will result in our log snapshot being incorrect. But of course, in
+ * either of these cases, the use of logadm at all is itself
+ * suspect...
+ */
+ do {
+ if (fstat(fi, &s) < 0) {
+ err(EF_SYS, "cannot stat: %s", file);
+ (void) close(fi);
+ (void) close(fo);
+ (void) remove(file_copy);
+ return;
+ }
+
+ if ((rem = s.st_size - written) < thresh) {
+ if (rem >= 0)
+ break;
+
+ /*
+ * If the file became smaller, something fishy is going
+ * on; we'll truncate our copy, reset our seek offset
+ * and break into the atomic copy.
+ */
+ (void) ftruncate(fo, 0);
+ (void) lseek(fo, 0, SEEK_SET);
+ (void) lseek(fi, 0, SEEK_SET);
+ break;
+ }
+
+ if (written != 0 && rem > last) {
+ /*
+ * We're falling behind -- this file is getting bigger
+ * faster than we're able to write it; break out and
+ * lock the file to block the writer.
+ */
+ break;
+ }
+
+ last = rem;
+
+ while (rem > 0) {
+ if ((len = read(fi, buf, MIN(sizeof (buf), rem))) <= 0)
+ break;
+
+ if (write(fo, buf, len) == len) {
+ rem -= len;
+ written += len;
+ continue;
+ }
+
+ err(EF_SYS, "cannot write into file %s", file_copy);
+ (void) close(fi);
+ (void) close(fo);
+ (void) remove(file_copy);
+ return;
+ }
+ } while (len >= 0);
+
/* lock log file so that nobody can write into it before we are done */
if (fchmod(fi, s.st_mode|S_ISGID) < 0)
err(EF_SYS, "cannot set mandatory lock bit for: %s", file);
diff --git a/usr/src/cmd/logadm/tester b/usr/src/cmd/logadm/tester
index 1ff4985e6d..ab7c32cd0b 100644
--- a/usr/src/cmd/logadm/tester
+++ b/usr/src/cmd/logadm/tester
@@ -21,6 +21,7 @@
#
#
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
#
# tester - run logadm tests
@@ -281,7 +282,7 @@ sub set_testconffile {
# logadm typically runs early every morning via an entry in
# root's crontab (see crontab(1)).
#
-/var/adm/messages -C 4 -P 'Thu Nov 1 16:56:42 2001' -a 'kill -HUP `cat /var/run/syslog.pid`'
+/var/adm/messages -C 4 -P 'Thu Nov 1 16:56:42 2001' -a 'kill -HUP `cat /var/run/*syslog*pid`'
/var/cron/log -s 512k -t /var/cron/olog
/var/lp/logs/lpsched -C 2 -N -t '$file.$N'
#
@@ -289,7 +290,7 @@ sub set_testconffile {
#
/var/adm/pacct -C 0 -a '/usr/lib/acct/accton pacct' -g adm -m 664 -o adm -p never
apache -C 24 -a '/usr/apache/bin/apachectl graceful' -p 1m -t '/var/apache/old-logs/$basename.%Y-%m' '/var/apache/logs/*{access,error}_log'
-/var/log/syslog -C 8 -P 'Thu Nov 1 09:16:38 2001' -a 'kill -HUP `cat /var/run/syslog.pid`'
+/var/log/syslog -C 8 -P 'Thu Nov 1 09:16:38 2001' -a 'kill -HUP `cat /var/run/*syslog*pid`'
/var/apache/logs/access_log -P 'Thu Nov 1 08:27:56 2001'
/var/apache/logs/error_log -P 'Thu Nov 1 08:27:56 2001'
/var/apache/logs/suexec_log -P 'Thu Nov 1 08:27:56 2001'
@@ -818,12 +819,12 @@ sub logadmV1 {
set_testconffile;
set_file('std.out.expect', <<'EOF');
-/var/adm/messages -C 4 -P 'Thu Nov 1 16:56:42 2001' -a 'kill -HUP `cat /var/run/syslog.pid`'
+/var/adm/messages -C 4 -P 'Thu Nov 1 16:56:42 2001' -a 'kill -HUP `cat /var/run/*syslog*pid`'
/var/cron/log -s 512k -t /var/cron/olog
/var/lp/logs/lpsched -C 2 -N -t '$file.$N'
/var/adm/pacct -C 0 -a '/usr/lib/acct/accton pacct' -g adm -m 664 -o adm -p never
apache -C 24 -a '/usr/apache/bin/apachectl graceful' -p 1m -t '/var/apache/old-logs/$basename.%Y-%m' '/var/apache/logs/*{access,error}_log'
-/var/log/syslog -C 8 -P 'Thu Nov 1 09:16:38 2001' -a 'kill -HUP `cat /var/run/syslog.pid`'
+/var/log/syslog -C 8 -P 'Thu Nov 1 09:16:38 2001' -a 'kill -HUP `cat /var/run/*syslog*pid`'
/var/apache/logs/access_log -P 'Thu Nov 1 08:27:56 2001'
/var/apache/logs/error_log -P 'Thu Nov 1 08:27:56 2001'
/var/apache/logs/suexec_log -P 'Thu Nov 1 08:27:56 2001'
@@ -1179,8 +1180,8 @@ sub logadm7 {
# logadm typically runs early every morning via an entry in
# root's crontab (see crontab(1)).
#
-dir1/syslog -C 8 -a 'echo kill -HUP `cat /etc/syslog.pid` >> cmd.out'
-dir2/messages -C 4 -a 'echo kill -HUP `cat /etc/syslog.pid` >> cmd.out'
+dir1/syslog -C 8 -a 'echo kill -HUP `cat /var/run/*syslog*pid` >> cmd.out'
+dir2/messages -C 4 -a 'echo kill -HUP `cat /var/run/*syslog*pid` >> cmd.out'
#
# The entry below is used by turnacct(1M)
#
@@ -1189,7 +1190,7 @@ EOF
system("/bin/cp logadm.conf logadm.conf.orig");
- $pid=`cat /etc/syslog.pid`;
+ $pid=`cat /var/run/*syslog*pid`;
chomp $pid;
set_file('cmd.out.expect', <<"EOF");
kill -HUP $pid
@@ -1260,7 +1261,7 @@ $bindir/logadm -f logadm.conf -F logadm.timestamps dir1/syslog dir2/messages >st
echo something > dir1/syslog
echo something > dir2/messages
$bindir/logadm -f logadm.conf -F logadm.timestamps >std.out3 2>std.err3 || exit 1
-exec $bindir/logadm -f logadm.conf -F logadm.timestamps dir2/messages -p now -a 'echo second kill -HUP `cat /etc/syslog.pid` >> cmd.out' >std.out4 2>std.err4
+exec $bindir/logadm -f logadm.conf -F logadm.timestamps dir2/messages -p now -a 'echo second kill -HUP `cat /var/run/*syslog*pid` >> cmd.out' >std.out4 2>std.err4
EOF
}
@@ -1748,8 +1749,8 @@ sub logadm14 {
# logadm typically runs early every morning via an entry in
# root's crontab (see crontab(1)).
#
-dir1/syslog -C 8 -a 'echo kill -HUP `cat /etc/syslog.pid` >> cmd.out'
-dir2/messages -C 4 -a 'echo kill -HUP `cat /etc/syslog.pid` >> cmd.out'
+dir1/syslog -C 8 -a 'echo kill -HUP `cat /var/run/*syslog*pid` >> cmd.out'
+dir2/messages -C 4 -a 'echo kill -HUP `cat /var/run/*syslog*pid` >> cmd.out'
#
# The entry below is used by turnacct(1M)
#
@@ -1806,7 +1807,7 @@ EOF
chmod 664 dir2/messages
# processing logname: /var/adm/pacct
# using default template: $file.$n
-sh -c echo kill -HUP `cat /etc/syslog.pid` >> cmd.out # -a cmd
+sh -c echo kill -HUP `cat /var/run/*syslog*pid` >> cmd.out # -a cmd
# logadm.conf and logadm.timestamps unchanged
EOF
@@ -2082,7 +2083,7 @@ EOF
sub logadm20 {
set_file('logadm.conf', <<'EOF');
# non-trivial entry
-/var/log/syslog -C 8 -a 'kill -HUP `cat /var/run/syslog.pid`'
+/var/log/syslog -C 8 -a 'kill -HUP `cat /var/run/*syslog*pid`'
EOF
set_file('std.err.expect', <<'EOF');
diff --git a/usr/src/cmd/lp/Makefile b/usr/src/cmd/lp/Makefile
deleted file mode 100644
index e18469f38a..0000000000
--- a/usr/src/cmd/lp/Makefile
+++ /dev/null
@@ -1,125 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
-#
-
-include ./Makefile.lp
-
-SUBDIRS = filter crontab lib cmd model
-
-MSGSUBDIRS = filter lib cmd model
-
-ROOTDIRS = \
- $(ROOTLIBLP) \
- $(ROOTLIBLP)/bin \
- $(ROOTLIBLP)/model \
- $(ROOTLIBLPLOCL) \
- $(ROOTLIB)/print \
- $(LPOWNSDIRS)
-LPOWNSDIRS = \
- $(ROOTETCLP) \
- $(ROOTETCLP)/classes \
- $(ROOTETCLP)/forms \
- $(ROOTETCLP)/interfaces \
- $(ROOTETCLP)/printers \
- $(ROOTETCLP)/pwheels \
- $(ROOTETCLP)/ppd \
- $(ROOTVAR)/lp \
- $(ROOTVAR)/lp/logs \
- $(ROOTVARSP)/lp \
- $(ROOTVARSP)/lp/admins \
- $(ROOTVARSP)/lp/requests \
- $(ROOTVARSP)/lp/system
-
-SYMDIR1 = $(ROOTVARSP)/lp/admins/lp
-SYMDIR2 = $(ROOTVARSP)/lp/bin
-SYMDIR3 = $(ROOTVARSP)/lp/logs
-SYMDIR4 = $(ROOTETCLP)/logs
-SYMDIR5 = $(ROOTVARSP)/lp/model
-
-$(SYMDIR1) := SYMLNKDEST = ../../../../etc/lp
-$(SYMDIR2) := SYMLNKDEST = ../../../usr/lib/lp/bin
-$(SYMDIR3) := SYMLNKDEST = ../../lp/logs
-$(SYMDIR4) := SYMLNKDEST = ../../var/lp/logs
-$(SYMDIR5) := SYMLNKDEST = ../../../usr/lib/lp/model
-
-ROOTSYMLINKDIRS = $(SYMDIR1) $(SYMDIR2) $(SYMDIR3) $(SYMDIR4) $(SYMDIR5)
-
-$(ROOTVAR)/lp := DIRMODE = 775
-$(ROOTVAR)/lp/logs := DIRMODE = 775
-$(ROOTETCLP) := DIRMODE = 775
-$(ROOTETCLP)/classes := DIRMODE = 775
-$(ROOTETCLP)/forms := DIRMODE = 775
-$(ROOTETCLP)/interfaces := DIRMODE = 775
-$(ROOTETCLP)/printers := DIRMODE = 775
-$(ROOTETCLP)/pwheels := DIRMODE = 775
-$(ROOTETCLP)/ppd := DIRMODE = 775
-$(ROOTVARSP)/lp := DIRMODE = 775
-$(ROOTVARSP)/lp/admins := DIRMODE = 775
-$(ROOTVARSP)/lp/requests := DIRMODE = 775
-$(ROOTVARSP)/lp/system := DIRMODE = 775
-$(ROOTLIB)/print := DIRMODE = 0755
-
-POFILE= lp.po
-POFILES= lp_*.po
-
-.KEEP_STATE:
-
-all: $(TXTS) $(SUBDIRS)
-
-#
-# Each message catalog file is generated in each sub
-# directory and copied to the usr/src/cmd/lp/ directory.
-# Those message catalog files are consolidated into one
-# message catalog file. The consolidated one will be copied
-# into the $(ROOT)/catalog/SUNW_OST_OSCMD/ directory.
-#
-
-_msg: $(MSGDOMAINPOFILE)
-
-$(POFILE): $(MSGSUBDIRS) pofile_POFILES
-
-install: $(ROOTDIRS) $(ROOTSYMLINKDIRS) $(SUBDIRS)
-
-clean strip lint: $(SUBDIRS)
-
-clobber: $(SUBDIRS) local_clobber
-
-local_clobber:
- $(RM) $(CLOBBERFILES)
-
-$(ROOTDIRS) :
- $(INS.dir)
-
-$(ROOTSYMLINKDIRS) :
- -$(RM) $@; $(SYMLINK) $(SYMLNKDEST) $@
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include $(SRC)/Makefile.msg.targ
diff --git a/usr/src/cmd/lp/Makefile.lp b/usr/src/cmd/lp/Makefile.lp
deleted file mode 100644
index 90814cf119..0000000000
--- a/usr/src/cmd/lp/Makefile.lp
+++ /dev/null
@@ -1,121 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# cmd/lp/Makefile.lp
-# Common makefile definitions (should be) used by all lp makefiles
-#
-
-include $(SRC)/cmd/Makefile.cmd
-
-LPROOT= $(SRC)/cmd/lp
-ROOTVAR= $(ROOT)/var
-ROOTVARSP= $(ROOT)/var/spool
-
-ROOTETCLP= $(ROOTETC)/lp
-ROOTLIBLP= $(ROOTLIB)/lp
-ROOTBINLP= $(ROOTBIN)/lp
-ROOTLIBLPPOST = $(ROOTLIBLP)/postscript
-ROOTLIBLPLOCL = $(ROOTLIBLP)/local
-
-ROOTUSRUCB= $(ROOT)/usr/ucb
-
-
-#
-# $(EMODES): Modes for executables
-# $(SMODES): Modes for setuid executables
-# $(DMODES): Modes for directories
-#
-EMODES = 0555
-SMODES = 04555
-DMODES = 0775
-
-
-INC = $(ROOT)/usr/include
-INCSYS = $(INC)/sys
-
-LPINC = $(SRC)/cmd/lp/include
-LPLIB = $(SRC)/cmd/lp/lib
-
-LIBACC = $(LPLIB)/access/liblpacc.a
-LIBCLS = $(LPLIB)/class/liblpcls.a
-LIBFLT = $(LPLIB)/filters/liblpflt.a
-LIBFRM = $(LPLIB)/forms/liblpfrm.a
-LIBLP = $(LPLIB)/lp/liblp.a
-LIBMSG = $(LPLIB)/msgs/liblpmsg.a
-LIBOAM = $(LPLIB)/oam/liblpoam.a
-LIBPRT = $(LPLIB)/printers/liblpprt.a
-LIBREQ = $(LPLIB)/requests/liblpreq.a
-LIBSEC = $(LPLIB)/secure/liblpsec.a
-LIBUSR = $(LPLIB)/users/liblpusr.a
-
-LINTACC = $(LPLIB)/access/llib-llpacc.ln
-LINTCLS = $(LPLIB)/class/llib-llpcls.ln
-LINTFLT = $(LPLIB)/filters/llib-llpflt.ln
-LINTFRM = $(LPLIB)/forms/llib-llpfrm.ln
-LINTLP = $(LPLIB)/lp/llib-llp.ln
-LINTMSG = $(LPLIB)/msgs/llib-llpmsg.ln
-LINTOAM = $(LPLIB)/oam/llib-llpoam.ln
-LINTPRT = $(LPLIB)/printers/llib-llpprt.ln
-LINTREQ = $(LPLIB)/requests/llib-llpreq.ln
-LINTSEC = $(LPLIB)/secure/llib-llpsec.ln
-LINTUSR = $(LPLIB)/users/llib-llpusr.ln
-
-CERRWARN += -_gcc=-Wno-sequence-point
-CERRWARN += -_gcc=-Wno-implicit-function-declaration
-CERRWARN += -_gcc=-Wno-parentheses
-CERRWARN += -_gcc=-Wno-uninitialized
-CERRWARN += -_gcc=-Wno-unused-variable
-CERRWARN += -_gcc=-Wno-unused-value
-CERRWARN += -_gcc=-Wno-unused-label
-CERRWARN += -_gcc=-Wno-unused-function
-CERRWARN += -_gcc=-Wno-clobbered
-CERRWARN += -_gcc=-Wno-empty-body
-CERRWARN += -_gcc=-Wno-extra
-CERRWARN += -_gcc=-Wno-address
-
-all:= TARGET= all
-install:= TARGET= install
-clean:= TARGET= clean
-clobber:= TARGET= clobber
-lint:= TARGET= lint
-strip:= TARGET= strip
-catalog:= TARGET= catalog
-_msg:= TARGET= catalog
-
-ROOTLIBLPPROG= $(PROG:%=$(ROOTLIBLP)/%)
-ROOTBINLPPROG= $(PROG:%=$(ROOTBINLP)/%)
-ROOTETCLPPROG= $(PROG:%=$(ROOTETCLP)/%)
-ROOTUSRUCBPROG= $(PROG:%=$(ROOTUSRUCB)/%)
-ROOTLIBLPPOSTPROG= $(PROG:%=$(ROOTLIBLPPOST)/%)
-ROOTLIBLPLOCLPROG= $(PROG:%=$(ROOTLIBLPLOCL)/%)
-
-$(ROOTLIBLP)/% \
-$(ROOTBINLP)/% \
-$(ROOTETCLP)/% \
-$(ROOTUSRUCB)/% \
-$(ROOTLIBLPPOST)/% $(ROOTLIBLPLOCL)/%: %
- $(INS.file)
diff --git a/usr/src/cmd/lp/cmd/Makefile b/usr/src/cmd/lp/cmd/Makefile
deleted file mode 100644
index 54b6369a00..0000000000
--- a/usr/src/cmd/lp/cmd/Makefile
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-include ../Makefile.lp
-
-SUBDIRS = lptest lpadmin lpsched scripts
-
-LOCALPROG = lpshut
-
-SBINPROG = lpfilter lpforms lpusers
-
-LIBLINKS = $(SBINPROG)
-
-PROG = $(LOCALPROG) $(SBINPROG)
-
-OBJS= $(SBINPROG:=.o)
-
-SRCS= $(OBJS:.o=.c)
-
-POFILE= lp_cmd.po
-POFILES= $(SRCS:%.c=%.po) lpschedlpshut.po
-
-ROOTLIBLPLOCLPROG= $(LOCALPROG:%=$(ROOTLIBLPLOCL)/%)
-ROOTSBINPROG= $(SBINPROG:%=$(ROOTUSRSBIN)/%)
-ROOTSYMLINKS= $(LIBLINKS:%=$(ROOTLIB)/%)
-
-
-CPPFLAGS = -I$(LPINC) $(CPPFLAGS.master)
-LDFLAGS += $(MAPFILE.NGB:%=-M%)
-
-# conditional assignments
-#
-lpfilter:= LDLIBS += $(LIBFLT) $(LIBMSG) $(LIBACC) $(LIBOAM) $(LIBLP) \
- -lgen -lsecdb
-lpforms:= LDLIBS += $(LIBFRM) $(LIBMSG) $(LIBREQ) $(LIBOAM) \
- $(LIBACC) $(LIBLP) -lsecdb
-lpshut:= LDLIBS += $(LIBMSG) $(LIBOAM) $(LIBLP)
-lpusers:= LDLIBS += $(LIBMSG) $(LIBACC) $(LIBOAM) $(LIBUSR) $(LIBLP)
-
-.KEEP_STATE:
-
-all: $(PROG) $(SUBDIRS)
-
-install: $(PROG) $(ROOTLIBLPLOCLPROG) $(ROOTSBINPROG) \
- $(ROOTSYMLINKS) $(SUBDIRS)
-
-catalog: $(SUBDIRS) $(POFILE)
- $(CP) $(POFILE) ..
-
-clean: $(SUBDIRS)
- $(RM) $(OBJS)
-
-clobber: $(SUBDIRS) local_clobber
-
-local_clobber:
- $(RM) $(OBJS) $(PROG) $(CLOBBERFILES)
-
-strip: $(SUBDIRS)
- $(STRIP) $(PROG)
-
-lint:
- $(LINT.c) $(SRCS) $(LDLIBS)
-
-$(ROOTSYMLINKS):
- $(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-include ../Makefile.lp.msg
-
-FRC:
diff --git a/usr/src/cmd/lp/cmd/lpadmin/Makefile b/usr/src/cmd/lp/cmd/lpadmin/Makefile
deleted file mode 100644
index ace6fc7acf..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/Makefile
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-
-
-#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/cmd/lpadmin/Makefile
-#
-
-include ../../Makefile.lp
-
-CPPFLAGS = -D_REENTRANT -I. -I$(LPINC) $(CPPFLAGS.master)
-
-SRCS= chkopts.c \
- default.c \
- do_align.c \
- do_fault.c \
- do_mount.c \
- do_printer.c \
- do_pwheel.c \
- done.c \
- fromclass.c \
- ismodel.c \
- lpadmin.c \
- options.c \
- output.c \
- pick_opts.c \
- rmdest.c \
- send_message.c \
- signals.c \
- startup.c \
- usage.c
-
-OBJS= $(SRCS:.c=.o)
-
-LPLIBS= $(LIBACC) \
- $(LIBCLS) \
- $(LIBMSG) \
- $(LIBPRT) \
- $(LIBFRM) \
- $(LIBREQ) \
- $(LIBOAM) \
- $(LIBLP)
-
-SYSLIBS= -lcurses
-
-LDLIBS += -lsecdb $(LPLIBS) $(SYSLIBS) $(I18N)
-LDFLAGS += $(MAPFILE.NGB:%=-M%)
-
-PROG= lpadmin
-
-
-#ROOTSYMLINK= $(ROOTLIBPROG)
-
-POFILE= lp_cmd_lpadmin.po
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-$(PROG): $(OBJS) $(MAPFILE.NGB)
- $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
- $(POST_PROCESS)
-
-install: all $(ROOTLIBLPLOCLPROG) #$(ROOTSYMLINK)
-
-#$(ROOTSYMLINK):
-# $(RM) $@; $(SYMLINK) ../sbin/$(PROG) $@
-
-clean:
- $(RM) $(OBJS)
-
-clobber: clean
- -$(RM) $(PROG) $(CLOBBERFILES)
-
-strip:
- $(STRIP) $(PROG)
-
-lint:
- $(LINT.c) $(SRCS) $(LDLIBS)
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/cmd/lpadmin/chkopts.c b/usr/src/cmd/lp/cmd/lpadmin/chkopts.c
deleted file mode 100644
index caf021c84f..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/chkopts.c
+++ /dev/null
@@ -1,1200 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdio.h"
-#include "string.h"
-#include "pwd.h"
-#include "sys/types.h"
-#include "errno.h"
-
-#include "lp.h"
-#include "printers.h"
-#include "form.h"
-#include "class.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-#define PPDZIP ".gz"
-
-
-extern PRINTER *printer_pointer;
-
-extern PWHEEL *pwheel_pointer;
-
-extern struct passwd *getpwnam();
-
-void chkopts2(),
- chkopts3();
-static void chksys();
-
-FORM formbuf;
-
-char **f_allow,
- **f_deny,
- **u_allow,
- **u_deny,
- **p_add,
- **p_remove;
-
-PRINTER *oldp = 0;
-
-PWHEEL *oldS = 0;
-
-short daisy = 0;
-
-static int root_can_write();
-
-static char *unpack_sdn();
-
-static char ** bad_list;
-
-#if defined(__STDC__)
-static unsigned long sum_chkprinter ( char ** , char * , char * , char * , char * , char * );
-static int isPPD(char *ppd_file);
-#else
-static unsigned long sum_chkprinter();
-static int isPPD();
-#endif
-
-/**
- ** chkopts() -- CHECK LEGALITY OF COMMAND LINE OPTIONS
- **/
-
-void chkopts ()
-{
- short isfAuto = 0;
-
- /*
- * Check -d.
- */
- if (d) {
- if (
- a || c || f || P || j || m || M || t || p || r || u || x
-#if defined(DIRECT_ACCESS)
- || C
-#endif
-#ifdef LP_USE_PAPI_ATTR
- || n_opt
-#endif
- || strlen(modifications)
- ) {
- LP_ERRMSG (ERROR, E_ADM_DALONE);
- done (1);
- }
-
- if (
- *d
- && !STREQU(d, NAME_NONE)
- && !isprinter(d)
- && !isclass(d)
- ) {
- LP_ERRMSG1 (ERROR, E_ADM_NODEST, d);
- done (1);
- }
- return;
- }
-
- /*
- * Check -x.
- */
- if (x) {
- if ( /* MR bl88-02718 */
- A || a || c || f || P || j || m || M || t || p || r || u || d
-#if defined(DIRECT_ACCESS)
- || C
-#endif
-#ifdef LP_USE_PAPI_ATTR
- || n_opt
-#endif
- || strlen(modifications)
- ) {
- LP_ERRMSG (ERROR, E_ADM_XALONE);
- done (1);
- }
-
- if (
- !STREQU(NAME_ALL, x)
- && !STREQU(NAME_ANY, x)
- && !isprinter(x)
- && !isclass(x)
- ) {
- LP_ERRMSG1 (ERROR, E_ADM_NODEST, x);
- done (1);
- }
- return;
- }
-
- /*
- * Problems common to both -p and -S (-S alone).
- */
- if (A && STREQU(A, NAME_LIST) && (W != -1 || Q != -1)) {
- LP_ERRMSG (ERROR, E_ADM_LISTWQ);
- done (1);
- }
-
-
- /*
- * Check -S.
- */
- if (!p && S) {
- if (
- M || t || a || f || P || c || r || e || i || m || H || h
- || l || v || I || T || D || F || u || U || j || o
-#ifdef LP_USE_PAPI_ATTR
- || n_opt
-#endif
- ) {
- LP_ERRMSG (ERROR, E_ADM_SALONE);
- done (1);
- }
- if (!A && W == -1 && Q == -1) {
- LP_ERRMSG (ERROR, E_ADM_NOAWQ);
- done (1);
- }
- if (S[0] && S[1])
- LP_ERRMSG (WARNING, E_ADM_ASINGLES);
- if (!STREQU(NAME_ALL, *S) && !STREQU(NAME_ANY, *S))
- chkopts3(1);
- return;
- }
-
- /*
- * At this point we must have a printer (-p option).
- */
- if (!p) {
- LP_ERRMSG (ERROR, E_ADM_NOACT);
- done (1);
- }
- if (STREQU(NAME_NONE, p)) {
- LP_ERRMSG1 (ERROR, E_LP_NULLARG, "p");
- done (1);
- }
-
-
- /*
- * Mount but nothing to mount?
- */
- if (M && (!f && !S)) {
- LP_ERRMSG (ERROR, E_ADM_MNTNONE);
- done (1);
- }
-
- /*
- * -Q isn't allowed with -p.
- */
- if (Q != -1) {
- LP_ERRMSG (ERROR, E_ADM_PNOQ);
- done (1);
- }
-
- /*
- * Fault recovery.
- */
- if (
- F
- && !STREQU(F, NAME_WAIT)
- && !STREQU(F, NAME_BEGINNING)
- && (
- !STREQU(F, NAME_CONTINUE)
- || j
- && STREQU(F, NAME_CONTINUE)
- )
- ) {
-#if defined(J_OPTION)
- if (j)
- LP_ERRMSG (ERROR, E_ADM_FBADJ);
- else
-#endif
- LP_ERRMSG (ERROR, E_ADM_FBAD);
- done (1);
- }
-
-#if defined(J_OPTION)
- /*
- * The -j option is used only with the -F option.
- */
- if (j) {
- if (M || t || a || f || P || c || r || e || i || m || H || h ||
-#ifdef LP_USE_PAPI_ATTR
- n_opt ||
-#endif
- l || v || I || T || D || u || U || o) {
- LP_ERRMSG (ERROR, E_ADM_JALONE);
- done (1);
- }
- if (j && !F) {
- LP_ERRMSG (ERROR, E_ADM_JNOF);
- done (1);
- }
- return;
- }
-#endif
-
-#if defined(DIRECT_ACCESS)
- /*
- * -C is only used to modify -u
- */
- if (C && !u) {
- LP_ERRMSG (ERROR, E_ADM_CNOU);
- done (1);
- }
-#endif
-
- /*
- * The -a option needs the -M and -f options,
- * Also, -ofilebreak is used only with -a.
- */
- if (a && (!M || !f)) {
- LP_ERRMSG (ERROR, E_ADM_MALIGN);
- done (1);
- }
- if (filebreak && !a)
- LP_ERRMSG (WARNING, E_ADM_FILEBREAK);
-
- /*
- * The "-p all" case is restricted to certain options.
- */
- if (
- (STREQU(NAME_ANY, p) || STREQU(NAME_ALL, p))
- && (
- a || h || l || M || t || D || e || f || P || H || s
-#ifdef LP_USE_PAPI_ATTR
- || n_opt
-#endif
- || i || I || m || S || T || u || U || v || banner != -1
- || cpi || lpi || width || length || stty_opt
- )
- ) {
- LP_ERRMSG (ERROR, E_ADM_ANYALLNONE);
- done (1);
-
- }
-
- /*
- * Allow giving -v or -U option as way of making
- * remote printer into local printer.
- * Note: "!s" here means the user has not given the -s;
- * later it means the user gave -s local-system.
- */
- if (!s && (v || U))
- s = Local_System;
-
- /*
- * Be careful about checking "s" before getting here.
- * We want "s == 0" to mean this is a local printer; however,
- * if the user wants to change a remote printer to a local
- * printer, we have to have "s == Local_System" long enough
- * to get into "chkopts2()" where a special check is made.
- * After "chkopts2()", "s == 0" means local.
- */
- if (!STREQU(NAME_ALL, p) && !STREQU(NAME_ANY, p))
- /*
- * If old printer, make sure it exists. If new printer,
- * check that the name is okay, and that enough is given.
- * (This stuff has been moved to "chkopts2()".)
- */
- chkopts2(1);
-
- if (!s) {
-
- /*
- * Only one of -i, -m, -e.
- */
- if ((i && e) || (m && e) || (i && m)) {
- LP_ERRMSG (ERROR, E_ADM_INTCONF);
- done (1);
- }
-
- /*
- * Check -e arg.
- */
- if (e) {
- if (!isprinter(e)) {
- LP_ERRMSG1 (ERROR, E_ADM_NOPR, e);
- done (1);
- }
- if (strcmp(e, p) == 0) {
- LP_ERRMSG (ERROR, E_ADM_SAMEPE);
- done (1);
- }
- }
-
- /*
- * Check -m arg.
- */
- if (m && !ismodel(m)) {
- LP_ERRMSG1 (ERROR, E_ADM_NOMODEL, m);
- done (1);
- }
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * Check -n arg. The ppd file exists.
- */
- if ((n_opt != NULL) && !isPPD(n_opt)) {
- LP_ERRMSG1 (ERROR, E_ADM_NOPPD, n_opt);
- done (1);
- }
-#endif
-
- /*
- * Need exactly one of -h or -l (but will default -h).
- */
- if (h && l) {
- LP_ERRMSG2 (ERROR, E_ADM_CONFLICT, 'h', 'l');
- done (1);
- }
- if (!h && !l)
- h = 1;
-
- /*
- * Check -c and -r.
- */
- if (c && r && strcmp(c, r) == 0) {
- LP_ERRMSG (ERROR, E_ADM_SAMECR);
- done (1);
- }
-
-
- /*
- * Are we creating a class with the same name as a printer?
- */
- if (c) {
- if (STREQU(c, p)) {
- LP_ERRMSG1 (ERROR, E_ADM_CLNPR, c);
- done (1);
- }
- if (isprinter(c)) {
- LP_ERRMSG1 (ERROR, E_ADM_CLPR, c);
- done (1);
- }
- }
-
- if (v && (is_printer_uri(v) < 0)) {
- /*
- * The device must be writeable by root.
- */
- if (v && root_can_write(v) == -1)
- done (1);
- }
-
- /*
- * Can't have both device and dial-out.
- */
- if (v && U) {
- LP_ERRMSG (ERROR, E_ADM_BOTHUV);
- done (1);
- }
-
- } else
- if (
- A || a || e || H || h || i || l || m || ( t && !M) || ( M && !t)
- || o || U || v || Q != -1 || W != -1
-#ifdef LP_USE_PAPI_ATTR
- || n_opt
-#endif
- ) {
- LP_ERRMSG (ERROR, E_ADM_NOTLOCAL);
- done(1);
- }
-
-
- /*
- * We need the printer type for some things, and the boolean
- * "daisy" (from Terminfo) for other things.
- */
- if (!T && oldp)
- T = oldp->printer_types;
- if (T) {
- short a_daisy;
-
- char ** pt;
-
-
- if (lenlist(T) > 1 && searchlist(NAME_UNKNOWN, T)) {
- LP_ERRMSG (ERROR, E_ADM_MUNKNOWN);
- done (1);
- }
-
- for (pt = T; *pt; pt++)
- if (tidbit(*pt, (char *)0) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_BADTYPE, *pt);
- done (1);
- }
-
- /*
- * All the printer types had better agree on whether the
- * printer takes print wheels!
- */
- daisy = a_daisy = -1;
- for (pt = T; *pt; pt++) {
- tidbit (*pt, "daisy", &daisy);
- if (daisy == -1)
- daisy = 0;
- if (a_daisy == -1)
- a_daisy = daisy;
- else if (a_daisy != daisy) {
- LP_ERRMSG (ERROR, E_ADM_MIXEDTYPES);
- done (1);
- }
- }
- }
- if (cpi || lpi || length || width || S || f || filebreak)
- if (!T) {
- LP_ERRMSG (ERROR, E_ADM_TOPT);
- done (1);
-
- }
-
- /*
- * Check -o cpi=, -o lpi=, -o length=, -o width=
- */
- if (cpi || lpi || length || width) {
- unsigned long rc;
-
- if ((rc = sum_chkprinter(T, cpi, lpi, length, width, NULL)) == 0) {
- if (bad_list)
- LP_ERRMSG1 (
- INFO,
- E_ADM_NBADCAPS,
- sprintlist(bad_list)
- );
-
- } else {
- if ((rc & PCK_CPI) && cpi)
- LP_ERRMSG1 (ERROR, E_ADM_BADCAP, "cpi=");
-
- if ((rc & PCK_LPI) && lpi)
- LP_ERRMSG1 (ERROR, E_ADM_BADCAP, "lpi=");
-
- if ((rc & PCK_WIDTH) && width)
- LP_ERRMSG1 (ERROR, E_ADM_BADCAP, "width=");
-
- if ((rc & PCK_LENGTH) && length)
- LP_ERRMSG1 (ERROR, E_ADM_BADCAP, "length=");
-
- LP_ERRMSG (ERROR, E_ADM_BADCAPS);
- done(1);
- }
- }
-
- /*
- * Check -I (old or new):
- */
- if (T && lenlist(T) > 1) {
-
-#define BADILIST(X) (lenlist(X) > 1 || X && *X && !STREQU(NAME_SIMPLE, *X))
- if (
- I && BADILIST(I)
- || !I && oldp && BADILIST(oldp->input_types)
- ) {
- LP_ERRMSG (ERROR, E_ADM_ONLYSIMPLE);
- done (1);
- }
- }
-
- /*
- * MOUNT:
- * Only one print wheel can be mounted at a time.
- */
- if (M && S && S[0] && S[1])
- LP_ERRMSG (WARNING, E_ADM_MSINGLES);
-
- /*
- * NO MOUNT:
- * If the printer takes print wheels, the -S argument
- * should be a simple list; otherwise, it must be a
- * mapping list. (EXCEPT: In either case, "none" alone
- * means delete the existing list.)
- */
- if (S && !M) {
- register char **item,
- *cp;
-
- /*
- * For us to be here, "daisy" must have been set.
- * (-S requires knowing printer type (T), and knowing
- * T caused call to "tidbit()" to set "daisy").
- */
- if (!STREQU(S[0], NAME_NONE) || S[1])
- if (daisy) {
- for (item = S; *item; item++) {
- if (strchr(*item, '=')) {
- LP_ERRMSG (ERROR, E_ADM_PWHEELS);
- done (1);
- }
- if (!syn_name(*item)) {
- LP_ERRMSG1 (ERROR, E_LP_NOTNAME, *item);
- done (1);
- }
- }
- } else {
- register int die = 0;
-
- for (item = S; *item; item++) {
- if (!(cp = strchr(*item, '='))) {
- LP_ERRMSG (ERROR, E_ADM_CHARSETS);
- done (1);
- }
-
- *cp = 0;
- if (!syn_name(*item)) {
- LP_ERRMSG1 (ERROR, E_LP_NOTNAME, *item);
- done (1);
- }
- if (PCK_CHARSET & sum_chkprinter(T, (char *)0, (char *)0, (char *)0, (char *)0, *item)) {
- LP_ERRMSG1 (ERROR, E_ADM_BADSET, *item);
- die = 1;
- } else {
- if (bad_list)
- LP_ERRMSG2 (
- INFO,
- E_ADM_NBADSET,
- *item,
- sprintlist(bad_list)
- );
- }
- *cp++ = '=';
- if (!syn_name(cp)) {
- LP_ERRMSG1 (ERROR, E_LP_NOTNAME, cp);
- done (1);
- }
- }
- if (die) {
- LP_ERRMSG (ERROR, E_ADM_BADSETS);
- done (1);
- }
- }
- }
-
- if (P) {
- int createForm = 0;
- char **plist;
-
- if (getform(P, &formbuf, (FALERT *)0, (FILE **)0) != -1) {
- if ((!formbuf.paper) || (!STREQU(formbuf.paper,P)) ) {
- LP_ERRMSG (ERROR, E_ADM_ALSO_SEP_FORM);
- done (1);
- }
- } else
- createForm = 1;
-
- if (*P == '~') { /* removing types of papers */
- P++;
- p_remove = getlist(P, LP_WS, LP_SEP);
- p_add = NULL;
- } else { /* adding types of papers */
- p_add = getlist(P, LP_WS, LP_SEP);
- p_remove = NULL;
- if (createForm) {
- char cmdBuf[200];
-
- for (plist = p_add; *plist; plist++) {
- snprintf(cmdBuf, sizeof (cmdBuf),
- "lpforms -f %s -d\n", *plist);
- system(cmdBuf);
- }
- }
- }
-
- if (!f && !M) { /* make paper allowed on printer too */
- f = Malloc(strlen(P) + strlen(NAME_ALLOW) +
- strlen(": "));
- sprintf(f, "%s:%s", NAME_ALLOW, P);
- isfAuto = 1;
- }
- }
- /*
- * NO MOUNT:
- * The -f option restricts the forms that can be used with
- * the printer.
- * - construct the allow/deny lists
- * - check each allowed form to see if it'll work
- * on the printer
- */
- if (f && !M) {
- register char *type = strtok(f, ":"),
- *str = strtok((char *)0, ":"),
- **pf;
-
- register int die = 0;
-
-
- if (STREQU(type, NAME_ALLOW) && str) {
- if ((pf = f_allow = getlist(str, LP_WS, LP_SEP)) != NULL) {
- while (*pf) {
- if ((!isfAuto) &&
- !STREQU(*pf, NAME_NONE)
- && verify_form(*pf) < 0
- )
- die = 1;
- pf++;
- }
- if (die) {
- LP_ERRMSG (ERROR, E_ADM_FORMCAPS);
- done (1);
- }
-
- } else
- LP_ERRMSG1 (WARNING, E_ADM_MISSING, NAME_ALLOW);
-
- } else if (STREQU(type, NAME_DENY) && str) {
- if ((pf = f_deny = getlist(str, LP_WS, LP_SEP)) != NULL) {
- if (!STREQU(*pf, NAME_ALL)) {
- while (*pf) {
- if ((!isfAuto) &&
- !STREQU(*pf, NAME_NONE) &&
- getform(*pf, &formbuf,
- (FALERT *)0, (FILE **)0) < 0
- ) {
- LP_ERRMSG2(WARNING,
- E_ADM_ICKFORM, *pf, p);
- die = 1;
- }
- pf++;
- }
- }
- if (die) {
- done (1);
- }
-
- } else
- LP_ERRMSG1 (WARNING, E_ADM_MISSING, NAME_DENY);
-
- } else {
- LP_ERRMSG (ERROR, E_ADM_FALLOWDENY);
- done (1);
- }
- }
-
- /*
- * The -u option is setting use restrictions on printers.
- * - construct the allow/deny lists
- */
- if (u) {
- register char *type = strtok(u, ":"),
- *str = strtok((char *)0, ":");
-
- if (STREQU(type, NAME_ALLOW) && str) {
- if (!(u_allow = getlist(str, LP_WS, LP_SEP)))
- LP_ERRMSG1 (WARNING, E_ADM_MISSING, NAME_ALLOW);
-
- } else if (STREQU(type, NAME_DENY) && str) {
- if (!(u_deny = getlist(str, LP_WS, LP_SEP)))
- LP_ERRMSG1 (WARNING, E_ADM_MISSING, NAME_DENY);
-
- } else {
- LP_ERRMSG (ERROR, E_LP_UALLOWDENY);
- done (1);
- }
- }
-
- return;
-}
-
-/**
- ** root_can_write() - CHECK THAT "root" CAN SENSIBLY WRITE TO PATH
- **/
-
-static int root_can_write (path)
- char *path;
-{
- static int lp_uid = -1;
-
- struct passwd *ppw;
-
- struct stat statbuf;
-
-
- if (lstat(path, &statbuf) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_NOENT, v);
- return (-1);
- }
- /*
- * If the device is a symlink (and it is not a root owned symlink),
- * verify that the owner matches the destination owner.
- */
- if (S_ISLNK(statbuf.st_mode) && statbuf.st_uid != 0) {
- uid_t uid = statbuf.st_uid;
-
- if (Stat(path, &statbuf) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_NOENT, v);
- return (-1);
- }
-
- if (statbuf.st_uid != uid) {
- LP_ERRMSG1 (ERROR, E_ADM_ISMISMATCH, v);
- done(1);
- }
-
- LP_ERRMSG1(WARNING, E_ADM_ISNOTROOTOWNED, v);
- }
-
- if ((statbuf.st_mode & S_IFMT) == S_IFDIR) {
- LP_ERRMSG1 (WARNING, E_ADM_ISDIR, v);
- } else if ((statbuf.st_mode & S_IFMT) == S_IFBLK)
- LP_ERRMSG1 (WARNING, E_ADM_ISBLK, v);
-
- if (lp_uid == -1) {
- if (!(ppw = getpwnam(LPUSER)))
- ppw = getpwnam(ROOTUSER);
- endpwent ();
- if (ppw)
- lp_uid = ppw->pw_uid;
- else
- lp_uid = 0;
- }
- if (!STREQU(v, "/dev/null"))
- if ((statbuf.st_uid && statbuf.st_uid != lp_uid)
- || (statbuf.st_mode & (S_IWGRP|S_IRGRP|S_IWOTH|S_IROTH)))
- LP_ERRMSG1 (WARNING, E_ADM_DEVACCESS, v);
-
- return (0);
-}
-
-/**
- ** unpack_sdn() - TURN SCALED TYPE INTO char* TYPE
- **/
-
-static char *unpack_sdn (sdn)
- SCALED sdn;
-{
- register char *cp;
- extern char *malloc();
-
- if (sdn.val <= 0 || 99999 < sdn.val)
- cp = 0;
-
- else if (sdn.val == N_COMPRESSED)
- cp = strdup(NAME_COMPRESSED);
-
- else if ((cp = malloc(sizeof("99999.999x"))))
- (void) sprintf(cp, "%.3f%c", sdn.val, sdn.sc);
-
- return (cp);
-}
-
-/**
- ** verify_form() - SEE IF PRINTER CAN HANDLE FORM
- **/
-
-int verify_form (form)
- char *form;
-{
- register char *cpi_f,
- *lpi_f,
- *width_f,
- *length_f,
- *chset;
-
- register int rc = 0;
- char **paperAllowed = NULL;
- char **paperDenied = NULL;
-
- register unsigned long checks;
-
-
- if (STREQU(form, NAME_ANY))
- form = NAME_ALL;
-
- while (getform(form, &formbuf, (FALERT *)0, (FILE **)0) != -1) {
- if (formbuf.paper) {
- if (!paperAllowed) {
- load_paperprinter_access(p, &paperAllowed,
- &paperDenied);
- freelist(paperDenied);
- }
- if (!allowed(formbuf.paper,paperAllowed,NULL)) {
- LP_ERRMSG1 (INFO, E_ADM_BADCAP,
- gettext("printer doesn't support paper type"));
- rc = -1;
- }
- }
- else {
-
- cpi_f = unpack_sdn(formbuf.cpi);
- lpi_f = unpack_sdn(formbuf.lpi);
- width_f = unpack_sdn(formbuf.pwid);
- length_f = unpack_sdn(formbuf.plen);
-
- if (
- formbuf.mandatory
- && !daisy
- && !search_cslist(
- formbuf.chset,
- (S && !M? S : (oldp? oldp->char_sets : (char **)0))
- )
- )
- chset = formbuf.chset;
- else
- chset = 0;
-
- if ((checks = sum_chkprinter(
- T,
- cpi_f,
- lpi_f,
- length_f,
- width_f,
- chset
- ))) {
- rc = -1;
- if ((checks & PCK_CPI) && cpi_f)
- LP_ERRMSG1 (INFO, E_ADM_BADCAP, "cpi");
-
- if ((checks & PCK_LPI) && lpi_f)
- LP_ERRMSG1 (INFO, E_ADM_BADCAP, "lpi");
-
- if ((checks & PCK_WIDTH) && width_f)
- LP_ERRMSG1 (INFO, E_ADM_BADCAP, "width");
-
- if ((checks & PCK_LENGTH) && length_f)
- LP_ERRMSG1 (INFO, E_ADM_BADCAP, "length");
-
- if ((checks & PCK_CHARSET) && formbuf.chset) {
- LP_ERRMSG1 (INFO, E_ADM_BADSET, formbuf.chset);
- rc = -2;
- }
- LP_ERRMSG1 (INFO, E_ADM_FORMCAP, formbuf.name);
- } else {
- if (bad_list)
- LP_ERRMSG2 (
- INFO,
- E_ADM_NBADMOUNT,
- formbuf.name,
- sprintlist(bad_list)
- );
- }
- }
-
- if (!STREQU(form, NAME_ALL)) {
- if (paperAllowed)
- freelist(paperAllowed);
- return (rc);
- }
-
- }
- if (paperAllowed)
- freelist(paperAllowed);
-
- if (!STREQU(form, NAME_ALL)) {
- LP_ERRMSG1 (ERROR, E_LP_NOFORM, form);
- done (1);
- }
-
- return (rc);
-}
-
-/*
- Second phase of parsing for -p option.
- In a seperate routine so we can call it from other
- routines. This is used when any or all are used as
- a printer name. main() loops over each printer, and
- must call this function for each printer found.
-*/
-void
-chkopts2(called_from_chkopts)
-int called_from_chkopts;
-{
- /*
- Only do the getprinter() if we are not being called
- from lpadmin.c. Otherwise we mess up our arena for
- "all" processing.
- */
- if (!called_from_chkopts)
- oldp = printer_pointer;
- else if (!(oldp = getprinter(p)) && errno != ENOENT) {
- LP_ERRMSG2 (ERROR, E_LP_GETPRINTER, p, PERROR);
- done(1);
- }
-
- if (oldp) {
- if (
- !c && !d && !f && !P && !M && !t && !r && !u && !x && !A
- && !strlen(modifications)
- ) {
- LP_ERRMSG (ERROR, E_ADM_PLONELY);
- done (1);
- }
-
- /*
- * For the case "-s local-system", we need to keep
- * "s != 0" long enough to get here, where it keeps
- * us from taking the old value. After this, we make
- * "s == 0" to indicate this is a local printer.
- */
- if (s && s != Local_System)
- chksys(s);
- if (!s && oldp->remote && *(oldp->remote))
- s = strdup(oldp->remote);
- if (s == Local_System)
- s = 0;
-
- /*
- * A remote printer converted to a local printer
- * requires device or dial info.
- */
- if (!s && oldp->remote && !v && !U) {
- LP_ERRMSG (ERROR, E_ADM_NOUV);
- done (1);
- }
-
-
- } else {
- if (getclass(p)) {
- LP_ERRMSG1 (ERROR, E_ADM_PRCL, p);
- done (1);
- }
-
- if (!syn_name(p)) {
- LP_ERRMSG1 (ERROR, E_LP_NOTNAME, p);
- done (1);
- }
-
- if (s == Local_System)
- s = 0;
- if (s)
- chksys(s);
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * New printer - if no model and a PPD file is defined then
- * use 'standard_foomatic' otherwise use
- * the 'standard' model.
- */
- if (!(e || i || m) && !s) {
- if (n_opt != NULL) {
- m = STANDARD_FOOMATIC;
- } else {
- m = STANDARD;
- }
- }
-#else
- /*
- * New printer - if no model, use standard
- */
- if (!(e || i || m) && !s)
- m = STANDARD;
-#endif
-
- /*
- * A new printer requires device or dial info.
- */
- if (!v && !U && !s) {
- LP_ERRMSG (ERROR, E_ADM_NOUV);
- done (1);
- }
-
- /*
- * Can't quiet a new printer,
- * can't list the alerting for a new printer.
- */
- if (
- A
- && (STREQU(A, NAME_QUIET) || STREQU(A, NAME_LIST))
- ) {
- LP_ERRMSG1 (ERROR, E_ADM_BADQUIETORLIST, p);
- done (1);
- }
-
- /*
- * New printer - if no input types given, assume "simple".
- */
- if (!I) {
- I = getlist(NAME_SIMPLE, LP_WS, LP_SEP);
- strcat (modifications, "I");
- }
- }
-}
-
-/*
- Second phase of parsing for -S option.
- In a seperate routine so we can call it from other
- routines. This is used when any or all are used as
- a print wheel name. main() loops over each print wheel,
- and must call this function for each print wheel found.
-*/
-void
-chkopts3(called_from_chkopts)
-int called_from_chkopts;
-{
- /*
- Only do the getpwheel() if we are not being called
- from lpadmin.c. Otherwise we mess up our arena for
- "all" processing.
- */
- if (!called_from_chkopts)
- oldS = pwheel_pointer;
- else
- oldS = getpwheel(*S);
-
- if (!oldS) {
- if (!syn_name(*S)) {
- LP_ERRMSG1 (ERROR, E_LP_NOTNAME, *S);
- done (1);
- }
-
- /*
- * Can't quiet a new print wheel,
- * can't list the alerting for a new print wheel.
- */
- if (
- A
- && (STREQU(A, NAME_QUIET) || STREQU(A, NAME_LIST))
- ) {
- LP_ERRMSG1 (ERROR, E_ADM_BADQUIETORLIST, *S);
- done (1);
- }
- }
-}
-
-static void
-chksys(s)
-char *s;
-{
- char *cp;
-
- if (STREQU(s, NAME_ALL) || STREQU(s, NAME_ANY)) {
- LP_ERRMSG (ERROR, E_ADM_ANYALLSYS);
- done(1);
- }
-
- if ((cp = strchr(s, '!')) != NULL)
- *cp = '\0';
-
- if (cp)
- *cp = '!';
-
- return;
-}
-
-/**
- ** sum_chkprinter() - CHECK TERMINFO STUFF FOR A LIST OF PRINTER TYPES
- **/
-
-#include "lp.set.h"
-
-static unsigned long
-#if defined(__STDC__)
-sum_chkprinter (
- char ** types,
- char * cpi,
- char * lpi,
- char * len,
- char * wid,
- char * cs
-)
-#else
-sum_chkprinter (types, cpi, lpi, len, wid, cs)
- char ** types;
- char * cpi;
- char * lpi;
- char * len;
- char * wid;
- char * cs;
-#endif
-{
- char ** pt;
-
- unsigned long worst = 0;
- unsigned long this = 0;
-
-
- /*
- * Check each printer type, to see if any won't work with
- * the attributes requested. However, return ``success''
- * if at least one type works. Keep a list of the failed
- * types for the caller to report.
- */
- bad_list = 0;
- for (pt = types; *pt; pt++) {
- this = chkprinter(*pt, cpi, lpi, len, wid, cs);
- if (this != 0)
- addlist (&bad_list, *pt);
- worst |= this;
- }
- if (lenlist(types) == lenlist(bad_list))
- return (worst);
- else
- return (0);
-}
-
-/*
- * Function: isPPD()
- *
- * Description: Check that the given PPD file exists. The argument given can
- * either be a relative path or a full path to the file.
- *
- * Returns: 1 = PPD file found
- * 0 = PPD file not found
- */
-
-static int
-isPPD(char *ppd_file)
-{
- int result = 0;
- char *ppd = NULL;
-
- if (ppd_file != NULL) {
- if (*ppd_file == '/') {
- ppd = strdup(ppd_file);
- } else {
- ppd = makepath(Lp_Model, "ppd", ppd_file, (char *)0);
- }
-
- /*
- * now check the file exists
- */
- if ((ppd != NULL) && (Access(ppd, 04) != -1)) {
- result = 1;
- } else {
- /*
- * files does not exist so append .gz and check if
- * that exist
- */
- ppd = Realloc(ppd, strlen(ppd)+ strlen(PPDZIP)+2);
- if (ppd != NULL) {
- ppd = strcat(ppd, PPDZIP);
- if (Access(ppd, 04) != -1) {
- result = 1;
- }
- }
- }
-
- if (ppd != NULL) {
- free(ppd);
- }
- }
- return (result);
-} /* isPPD() */
diff --git a/usr/src/cmd/lp/cmd/lpadmin/default.c b/usr/src/cmd/lp/cmd/lpadmin/default.c
deleted file mode 100644
index aba979373a..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/default.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include "stdio.h"
-#include "errno.h"
-#include "sys/types.h"
-
-#include "lp.h"
-#include "printers.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-
-/**
- ** getdflt() - RETURN DEFAULT DESTINATION
- **/
-
-char *getdflt ()
-{
- char *name;
-
- if ((name = getdefault()))
- return (name);
- else
- return ("");
-}
-
-/**
- ** newdflt() - ESTABLISH NEW DEFAULT DESTINATION
- **/
-
-void newdflt (name)
- char *name;
-{
- BEGIN_CRITICAL
- if (name && *name && !STREQU(name, NAME_NONE)) {
- if (putdefault(name) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_WRDEFAULT, PERROR);
- done (1);
- }
-
- } else {
- if (deldefault() == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_WRDEFAULT, PERROR);
- done (1);
- }
-
- }
- END_CRITICAL
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/do_align.c b/usr/src/cmd/lp/cmd/lpadmin/do_align.c
deleted file mode 100644
index ed845761bf..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/do_align.c
+++ /dev/null
@@ -1,677 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <string.h>
-#include <stdlib.h>
-#include <libintl.h>
-
-#include "lp.h"
-#include "msgs.h"
-#include "printers.h"
-#include "requests.h"
-#include "form.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-
-extern void mount_unmount();
-
-extern short printer_status;
-
-extern char *cur_pwheel,
- *disable_reason,
- *reject_reason;
-
-extern FORM formbuf;
-
-static int again();
-
-static void disable(),
- enable(),
- accept(),
- reject(),
- cancel(),
- sigpipe(),
- sigother();
-
-static jmp_buf cleanup_env,
- pipe_env;
-
-/**
- ** do_align() - SET UP PRINTER TO PRINT ALIGNMENT PATTERNS
- **/
-
-int do_align (printer, form, pwheel)
- char *printer,
- *form,
- *pwheel;
-{
- short status;
-
- char *req_id = 0,
- *file_prefix,
- *rfile,
- *fifo,
- buffer[MSGMAX];
-
- long printer_chk;
-
- int try;
-
- FILE *align_fp,
- *fifo_fp;
-
- REQUEST req;
-
- void (*old_sighup)(),
- (*old_sigint)(),
- (*old_sigquit)(),
- (*old_sigterm)();
-
-
- /*
- * Having reached this point means we've already fetched
- * the form definition. Now get the alignment pattern.
- */
- if (getform(form, (FORM *)0, (FALERT *)0, &align_fp) == -1) {
- LP_ERRMSG2 (ERROR, E_LP_GETFORM, form, PERROR);
- done (1);
- }
- if (!align_fp) {
- LP_ERRMSG1 (WARNING, E_ADM_NOALIGN, form);
- return (0);
- }
-
- /*
- * Having reached this far also means we've already obtained
- * the printer status from the Spooler. We'll be changing the
- * status of the printer and queue and will have to restore
- * the disable/reject reasons.
- * NOTE: We can't restore the dates!
- */
-
-
- /*
- * Construct a request to print a ``file'' for copy. The
- * equivalent "lp" command (with a filename) would be:
- *
- * lp -p printer -H immediate -f form -T type -S charset -c -P 1-N
- *
- * "type", "charset", and "N" are derived from the form def'n.
- * This command would make us next to print ONCE THE FORM IS
- * MOUNTED.
- *
- * NOTE: Don't bother with the -S charset if it isn't mandatory,
- * so we won't get a rejection. Also, we use either the print
- * wheel given in the -S option or, lacking that, the currently
- * mounted print wheel. (The former WILL be mounted.) This also
- * avoids a rejection by the Spooler.
- */
- req.copies = 1;
- req.destination = printer;
-/* req.file_list = 0; This is done later. */
- req.form = form;
- req.actions = ACT_IMMEDIATE | ACT_FAST;
- req.alert = 0;
- req.options = "nobanner";
- req.priority = 20; /* it doesn't matter */
- sprintf ((req.pages = "1-999999")+2, "%d", formbuf.np);
- req.charset = NAME_ANY; /* Don't restrict the request */
- req.modes = 0;
- req.title = "Aligning Form";
- req.input_type = formbuf.conttype;
- req.user = getname();
-
-
- /*
- * The following code is sensitive to interrupts: We must
- * catch interrupts so to restore the printer to its original
- * state, but if we get interrupted while receiving a message
- * from the Spooler, we can't issue additional messages because
- * the old responses still in the response queue will confuse us.
- * Thus while sending/receiving a message we ignore signals.
- */
- if (setjmp(cleanup_env) != 0)
- done (1);
- trap_signals (); /* make sure we've done this once */
- old_sighup = signal(SIGHUP, sigother);
- old_sigint = signal(SIGINT, sigother);
- old_sigquit = signal(SIGQUIT, sigother);
- old_sigterm = signal(SIGTERM, sigother);
-
- /*
- * We'll try the following twice, first with the page list
- * set as above. If the request gets refused because there's
- * no filter to convert the content, we'll try again without
- * the page list. I don't think the number-of-pages-in-a-form
- * feature is likely to be used much, so why hassle the
- * administrator?
-#if defined(WARN_OF_TOO_MANY_LINES)
- * However, do warn him or her.
-#endif
- */
-
- try = 0;
-Again: try++;
-
- /*
- * Have the Spooler allocate a request file and another file
- * for our use. We'll delete the other file and recreate it
- * as a FIFO. We can do this because "lpadmin" can only be run
- * (successfully) by an administrator. This is the key to what
- * we're doing! We are submitting a named pipe (FIFO) for
- * printing, which gives us a connection to the printer
- * through any filters needed!
- */
-
- BEGIN_CRITICAL
- send_message (S_ALLOC_FILES, 2);
- if (mrecv(buffer, MSGMAX) != R_ALLOC_FILES) {
- LP_ERRMSG (ERROR, E_LP_MRECV);
- done (1);
- }
- END_CRITICAL
- (void)getmessage (buffer, R_ALLOC_FILES, &status, &file_prefix);
-
- switch (status) {
- case MOK:
- break;
-
- case MNOMEM:
- LP_ERRMSG (ERROR, E_LP_MNOMEM);
- done (1);
- }
-
- if (!(rfile = malloc((unsigned int)strlen(file_prefix) + 2 + 1))) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done (1);
- }
-
- sprintf (rfile, "%s-1", file_prefix);
-
- if (!(fifo = makepath(Lp_Temp, rfile, (char *)0))) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done (1);
- }
- req.file_list = 0;
- addlist (&req.file_list, fifo);
-
- if (
- Unlink(fifo) == -1
- || Mknod(fifo, S_IFIFO | 0600, 0) == -1
- ) {
- LP_ERRMSG1 (ERROR, E_ADM_NFIFO, PERROR);
- done (1);
- }
-
- /*
- * In quick succession,
- *
- * - mount the form,
- * - disable the printer,
- * - make the Spooler accept requests (if need be),
- * - submit the request,
- * - make the Spooler reject requests (if need be).
- *
- * We want to minimize the window when another request can
- * be submitted ahead of ours. Though this window is small,
- * it is a flaw in our design. Disabling the printer will
- * help, because it will stop any request that is printing
- * (if the form is already mounted) and will prevent any other
- * request from printing. (We disable the printer AFTER trying
- * to mount the form, because we don't disable a printer for a
- * regular mount, and we'd like to make this mount APPEAR to
- * be as similar as possible.)
- */
-
- if (try == 1) {
-
- mount_unmount (S_MOUNT, printer, NB(form), NB(pwheel));
- /* This will die if the mount fails, leaving */
- /* the Spooler to clean up our files. */
-
- if (!(printer_status & PS_DISABLED))
- disable (printer, CUZ_MOUNTING, 0);
-
- if (printer_status & PS_REJECTED)
- accept (printer);
-
- if (setjmp(cleanup_env) != 0) {
- if (printer_status & PS_DISABLED)
- disable (printer, disable_reason, 1);
- if (printer_status & PS_REJECTED)
- reject (printer, reject_reason);
- if (req_id && *req_id)
- cancel (req_id);
- done (1);
- }
- }
-
- sprintf (rfile, "%s-0", file_prefix);
- if (putrequest(rfile, &req) == -1) {
- LP_ERRMSG1 (ERROR, E_LP_PUTREQUEST, PERROR);
- goto Done;
- }
- BEGIN_CRITICAL
- send_message (S_PRINT_REQUEST, rfile);
- if (mrecv(buffer, MSGMAX) != R_PRINT_REQUEST) {
- LP_ERRMSG (ERROR, E_LP_MRECV);
- done (1);
- }
- END_CRITICAL
- (void)getmessage (buffer, R_PRINT_REQUEST, &status, &req_id, &printer_chk);
-
- switch (status) {
-
- case MNOFILTER:
- if (try == 1) {
- req.pages = 0;
- goto Again;
- }
- LP_ERRMSG (ERROR, E_ADM_NFILTER);
- goto Done;
-
- case MOK:
-#if defined(WARN_OF_TOO_MANY_LINES)
- if (!req.pages)
- LP_ERRMSG1 (WARNING, E_ADM_NPAGES, formbuf.np);
-#endif
- break;
-
- case MERRDEST:
- accept (printer); /* someone snuck a reject in! */
- goto Again;
-
- case MNOMEM:
- LP_ERRMSG (ERROR, E_LP_MNOMEM);
- goto Done;
-
- case MNODEST:
- LP_ERRMSG1 (ERROR, E_LP_PGONE, printer);
- goto Done;
-
- case MNOOPEN: /* not quite, but close */
- LP_ERRMSG (ERROR, E_ADM_ERRDEST);
- goto Done;
-
- case MDENYDEST:
- if (printer_chk) {
- char reason[1024],
- *cp = reason;
-
- if (printer_chk & PCK_TYPE)
- cp += sprintf(cp, "printer type, ");
- if (printer_chk & PCK_CHARSET)
- cp += sprintf(cp, "character set, ");
- if (printer_chk & PCK_CPI)
- cp += sprintf(cp, "character pitch, ");
- if (printer_chk & PCK_LPI)
- cp += sprintf(cp, "line pitch, ");
- if (printer_chk & PCK_WIDTH)
- cp += sprintf(cp, "page width, ");
- if (printer_chk & PCK_LENGTH)
- cp += sprintf(cp, "page length, ");
- if (printer_chk & PCK_BANNER)
- cp += sprintf(cp, "nobanner, ");
- cp[-2] = 0;
- LP_ERRMSG1 (ERROR, E_LP_PTRCHK, reason);
- goto Done;
- }
- /*fall through*/
-
- case MUNKNOWN:
- case MNOMEDIA:
- case MDENYMEDIA:
- case MNOMOUNT:
- case MNOSPACE:
- case MNOPERM:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, status);
-
-Done: if (!(printer_status & PS_DISABLED))
- enable (printer);
- if (printer_status & PS_REJECTED)
- reject (printer, reject_reason);
- done (1);
- /*NOTREACHED*/
- }
-
- if (printer_status & PS_REJECTED)
- reject (printer, reject_reason);
-
- /*
- * Enable printing, to start the interface program going.
- * Because of our precautions above, our request SHOULD be
- * the one that prints!
- */
- enable (printer);
-
- /*
- * Open the FIFO. One problem: This will hang until the
- * interface program opens the other end!!
- */
- if (!(fifo_fp = fopen(fifo, "w"))) {
- LP_ERRMSG1 (ERROR, E_ADM_NFIFO, PERROR);
- done (1);
- }
-
- /*
- * Loop, dumping the ENTIRE alignment pattern to the FIFO
- * each time. SIGPIPE probably means the printer faulted.
- */
- if (setjmp(pipe_env) == 0) {
- /*
- * Don't send a form feed after the last copy, since
- * the interface program does that. To implement this,
- * we send the form feed BEFORE the alignment pattern;
- * this way we can simply not send it the first time.
- */
- char * ff = 0;
- char * ff_before = 0;
-
- /*
- * If we'll be inserting page breaks between alignment
- * patterns, look up the control sequence for this.
- *
- * MORE: We currently don't have the smarts to figure out
- * WHICH printer type the Spooler will pick; we would need
- * to steal some of its code for that (see pickfilter.c)
- * The best we do so far is use the alignment pattern's
- * content type, if known.
- */
- if (filebreak) {
- if (
- formbuf.conttype
- && searchlist_with_terminfo(
- formbuf.conttype,
- T /* having "filebreak" => OK */
- )
- )
- tidbit (formbuf.conttype, "ff", &ff);
- else
- tidbit (*T, "ff", &ff);
- }
-
- signal (SIGPIPE, sigpipe);
- do {
- register int n;
- char buf[BUFSIZ];
-
- if (ff_before && *ff_before)
- fputs (ff_before, fifo_fp);
- ff_before = ff;
-
- rewind (align_fp);
- while ((n = fread(buf, 1, BUFSIZ, align_fp)) > 0)
- fwrite (buf, 1, n, fifo_fp);
-
- fflush (fifo_fp);
-
- } while (again());
- fclose (align_fp);
- signal (SIGPIPE, SIG_DFL);
-
- } else {
- cancel (req_id);
-
-#define P(X) printf (X)
-
-P("We were interrupted while printing the alignment pattern;\n");
-P("check the printer. The form is mounted, so you will have to\n");
-P("unmount it if you need to print more alignment patterns later.\n");
- }
-
- /*
- * Disable the printer, if needed, and close the FIFO.
- * Use the wait version of the disable, so our request isn't
- * stopped, and do it before closing the FIFO, so another request
- * can't start printing if it isn't supposed to.
- */
- if (printer_status & PS_DISABLED)
- disable (printer, disable_reason, 1);
- fclose (fifo_fp);
-
- signal (SIGHUP, old_sighup);
- signal (SIGINT, old_sigint);
- signal (SIGQUIT, old_sigquit);
- signal (SIGTERM, old_sigterm);
-
- return (1);
-}
-
-/**
- ** accept() - MAKE PRINTER ACCEPT REQUESTS
- **/
-
-static void accept (printer)
- char *printer;
-{
- int rc;
-
- BEGIN_CRITICAL
- send_message (S_ACCEPT_DEST, printer);
- rc = output(R_ACCEPT_DEST);
- END_CRITICAL
-
- switch (rc) {
- case MOK:
- case MERRDEST: /* someone may have snuck in an accept */
- break;
-
- case MNODEST: /* make up your mind, Spooler! */
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- }
- return;
-}
-
-/**
- ** reject() - MAKE PRINTER REJECT REQUESTS
- **/
-
-static void reject (printer, reason)
- char *printer,
- *reason;
-{
- int rc;
-
- BEGIN_CRITICAL
- send_message (S_REJECT_DEST, printer, reason);
- rc = output(R_REJECT_DEST);
- END_CRITICAL
-
- switch (rc) {
-
- case MOK:
- case MERRDEST: /* someone may have snuck in a reject */
- break;
-
- case MNODEST: /* make up your mind, Spooler! */
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- }
- return;
-}
-
-/**
- ** enable() - ENABLE THE PRINTER
- **/
-
-static void enable (printer)
- char *printer;
-{
- int rc;
-
- BEGIN_CRITICAL
- send_message (S_ENABLE_DEST, printer);
- rc = output(R_ENABLE_DEST);
- END_CRITICAL
-
- switch (rc) {
- case MOK:
- case MERRDEST: /* someone may have snuck in an enable */
- break;
-
- case MNODEST: /* make up your mind, Spooler! */
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- }
- return;
-}
-
-/**
- ** disable() - DISABLE THE PRINTER
- **/
-
-static void disable (printer, reason, when)
- char *printer,
- *reason;
- int when;
-{
- int rc;
-
- BEGIN_CRITICAL
- send_message (S_DISABLE_DEST, printer, reason, when);
- rc = output(R_DISABLE_DEST);
- END_CRITICAL
-
- switch (rc) {
- case MOK:
- case MERRDEST: /* someone may have snuck in a disable */
- break;
-
- case MNODEST: /* make up your mind, Spooler! */
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- }
- return;
-}
-
-/**
- ** cancel() - MAKE PRINTER ACCEPT REQUESTS
- **/
-
-static void cancel (req_id)
- char *req_id;
-{
- int rc;
-
- BEGIN_CRITICAL
- send_message (S_CANCEL_REQUEST, req_id);
- rc = output(R_CANCEL_REQUEST);
- END_CRITICAL
-
- switch (rc) {
- case MOK:
- case MUNKNOWN:
- case M2LATE:
- break;
-
- case MNOPERM:
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- }
- return;
-}
-
-/**
- ** again()
- **/
-
-static int again ()
-{
- char answer[BUFSIZ];
-
-
- for (;;) {
-
- printf (
- gettext("Press return to print an alignment pattern [q to quit]: ")
- );
-
- if (!fgets(answer, sizeof (answer), stdin))
- return (0);
-
- answer[strlen(answer) -1] = '\0';
-
- if (
- STREQU(answer, "q")
- || STREQU(answer, "n")
- || STREQU(answer, "no")
- )
- return (0);
-
- else if (
- !*answer
- || STREQU(answer, "y")
- || STREQU(answer, "yes")
- )
- return (1);
-
- printf (gettext("Sorry?\n"));
- }
-}
-
-/**
- ** sigpipe()
- ** sigother()
- **/
-
-static void sigpipe ()
-{
- signal (SIGPIPE, SIG_IGN);
- longjmp (pipe_env, 1);
- /*NOTREACHED*/
-}
-
-static void sigother (sig)
- int sig;
-{
- signal (sig, SIG_IGN);
- longjmp (cleanup_env, 1);
- /*NOTREACHED*/
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/do_fault.c b/usr/src/cmd/lp/cmd/lpadmin/do_fault.c
deleted file mode 100644
index 9ef9795ef2..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/do_fault.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include "sys/types.h"
-
-#include "lp.h"
-#include "printers.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-
-/**
- ** do_fault() - CHANGE FAULT RECOVERY FOR CURRENT JOB
- **/
-
-void do_fault ()
-{
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/do_mount.c b/usr/src/cmd/lp/cmd/lpadmin/do_mount.c
deleted file mode 100644
index 86bb067155..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/do_mount.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-
-#include "stdio.h"
-#include "string.h"
-#include "sys/types.h"
-
-#include "lp.h"
-#include "msgs.h"
-#include "printers.h"
-#include "form.h"
-#include "access.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-extern FORM formbuf;
-
-void mount_unmount();
-
-short printer_status;
-
-static char *cur_pwheel;
-char *disable_reason,
- *reject_reason;
-
-static void inquire_printer_status();
-
-/**
- ** do_mount() - MOUNT/UNMOUNT A FORM/PRINT-WHEEL
- **/
-
-void do_mount (printer, form, pwheel)
- char *printer,
- *form,
- *pwheel;
-{
- /*
- * Take care of unmounts, first.
- */
-
- if (form && STREQU(form, NAME_NONE))
- form = "";
- if (pwheel && (STREQU(pwheel, NAME_ANY) || STREQU(pwheel, NAME_NONE)))
- pwheel = "";
-
- if (form && !*form && a)
- LP_ERRMSG (WARNING, E_ADM_UNALIGN);
-
- if (form && !*form && pwheel && !*pwheel) {
- mount_unmount (S_UNMOUNT, printer, NAME_NONE, NAME_ANY);
- form = 0;
- pwheel = 0;
- } else if (form && !*form) {
- mount_unmount (S_UNMOUNT, printer, NAME_NONE, "");
- form = 0;
- } else if (pwheel && !*pwheel) {
- mount_unmount (S_UNMOUNT, printer, "", NAME_ANY);
- pwheel = 0;
- }
-
- if (!form && !pwheel)
- return;
-
- /*
- * See if the form will work on the printer. We do this even if
- * the form has already been allowed, just in case the form has
- * changed since then. Also, the check reads the form definition
- * into a global that we can use for subsequent checks.
- */
- if (!s) { /* a local printer */
-
- if (form && *form)
- switch (verify_form(form)) {
- case -1:
- LP_ERRMSG (WARNING, E_ADM_BADMOUNT);
- break;
- case -2:
- LP_ERRMSG1 (ERROR, E_ADM_MANDCHSET, formbuf.chset);
- done (1);
- }
-
- /*
- * Is the form allowed on the printer?
- */
- if (form && *form && !is_form_allowed_printer(form, printer))
- LP_ERRMSG2 (WARNING, E_ADM_ICKFORM, form, printer);
-
-
- /*
- * Does the printer take print wheels?
- * For us to be here, "daisy" must have been set.
- * (-S requires knowing printer type (T), and knowing
- * T caused call to "tidbit()" to set "daisy").
- */
- if (pwheel && *pwheel && !daisy) {
- LP_ERRMSG (ERROR, E_ADM_NOPWHEEL);
- done (1);
- }
-
- /*
- * If the form requires a particular print wheel, make sure
- * it is either mounted already, or is being mounted now.
- */
- if (form && *form) {
- /*
- * The printer status is also needed for "do_align()".
- */
- inquire_printer_status (printer);
-
- /*
- * The "!daisy" case was investigated in "verify_form()".
- */
- if (daisy && formbuf.mandatory && formbuf.chset)
- if (!pwheel || !*pwheel) {
- if (!STREQU(formbuf.chset, cur_pwheel))
- LP_ERRMSG1 (
- WARNING,
- E_ADM_MANDPWHEEL1,
- formbuf.chset
- );
- } else if (!STREQU(formbuf.chset, pwheel)) {
- LP_ERRMSG1 (
- WARNING,
- E_ADM_MANDPWHEEL2,
- formbuf.chset
- );
- }
- }
-
- /*
- * Is the print wheel listed for this printer?
- * The information that will tell us is either in the
- * original info. we read in ("oldp->char_sets") if this
- * is an existing printer, or--if this is a new printer--we
- * don't have it (ambiguous -S options, mate!)
- */
- if (
- pwheel
- && *pwheel
- && !(
- oldp
- && searchlist(pwheel, oldp->char_sets)
- )
- )
- LP_ERRMSG2 (WARNING, E_ADM_ICKPWHEEL, pwheel, printer);
-
- }
-
- /*
- * Do the mount with the printing of the alignment pattern,
- * if required and possible. Otherwise, just mount the form
- * (and print-wheel).
- */
- if (!a || !do_align(printer, form, pwheel))
- mount_unmount (S_MOUNT, printer, NB(form), NB(pwheel));
-
- return;
-}
-
-void mount_unmount (type, printer, form, pwheel)
- int type;
- char *printer,
- *form,
- *pwheel;
-{
- int rc;
-
- if (t) { /* tray specified */
- type = (type == S_MOUNT ? S_MOUNT_TRAY : S_UNMOUNT_TRAY);
- send_message(type, printer, form, pwheel, t);
- } else
- send_message(type, printer, form, pwheel);
-
- rc = output(type + 1);
-
- switch(rc) {
-
- case MOK:
- break;
-
- case MNOMEDIA:
- LP_ERRMSG (ERROR, E_ADM_NOMEDIA);
- done (1);
- /*NOTREACHED*/
-
- case MNODEST:
- LP_ERRMSG1 (ERROR, E_ADM_NODEST, printer);
- done (1);
- /*NOTREACHED*/
-
- case MBUSY:
- LP_ERRMSG (ERROR, E_ADM_MNTLATER);
- done (1);
- /*NOTREACHED*/
-
- case MNOTRAY:
- LP_ERRMSG (ERROR, E_ADM_BADTRAY);
- done (1);
- /*NOTREACHED*/
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- /*NOTREACHED*/
-
- }
- return;
-}
-
-void
-do_max_trays(char *printer)
-{
- int rc;
-
- if (t) /* tray specified */
- send_message(S_MAX_TRAYS, printer, t);
-
- rc = output(R_MAX_TRAYS);
-
- switch(rc) {
-
- case MOK:
- break;
-
- case MNOMEDIA:
- LP_ERRMSG (ERROR, E_ADM_NOMEDIA);
- done (1);
- /*NOTREACHED*/
-
- case MNODEST:
- LP_ERRMSG1 (ERROR, E_ADM_NODEST, printer);
- done (1);
- /*NOTREACHED*/
-
- case MBUSY:
- LP_ERRMSG (ERROR, E_ADM_MNTLATER);
- done (1);
- /*NOTREACHED*/
-
- case MNOTRAY:
- LP_ERRMSG (ERROR, E_ADM_MAXTRAY);
- done (1);
- /*NOTREACHED*/
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- /*NOTREACHED*/
-
- }
- return;
-}
-
-/**
- ** inquire_printer_status()
- **/
-
-static void inquire_printer_status (printer)
- char *printer;
-{
- short status;
-
- char *s_ignore,
- buffer[MSGMAX];
-
- long l_ignore;
-
-
- send_message (S_INQUIRE_PRINTER_STATUS, printer);
- if (mrecv(buffer, MSGMAX) != R_INQUIRE_PRINTER_STATUS) {
- LP_ERRMSG (ERROR, E_LP_MRECV);
- done (1);
- }
- (void)getmessage (
- buffer,
- R_INQUIRE_PRINTER_STATUS,
- &status,
- &s_ignore,
- &s_ignore,
- &cur_pwheel,
- &disable_reason,
- &reject_reason,
- &printer_status,
- &s_ignore,
- &l_ignore,
- &l_ignore
- );
-
- switch (status) {
- case MOK:
- disable_reason = strdup(disable_reason);
- reject_reason = strdup(reject_reason);
- cur_pwheel = strdup(cur_pwheel);
- break;
-
- case MNODEST:
- LP_ERRMSG1 (ERROR, E_LP_PGONE, printer);
- done (1);
- }
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/do_printer.c b/usr/src/cmd/lp/cmd/lpadmin/do_printer.c
deleted file mode 100644
index 66ab3f2803..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/do_printer.c
+++ /dev/null
@@ -1,781 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/zone.h>
-#include <stdlib.h>
-#include <libintl.h>
-#include <sys/tsol/label_macro.h>
-#include <bsm/devices.h>
-#include "lp.h"
-#include "class.h"
-#if defined PS_FAULTED
-#undef PS_FAULTED
-#endif
-#include "printers.h"
-#include "msgs.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-extern void fromallclasses();
-
-#if !defined(PATH_MAX)
-# define PATH_MAX 1024
-#endif
-#if PATH_MAX < 1024
-# undef PATH_MAX
-# define PATH_MAX 1024
-#endif
-
-extern char *label;
-
-static void configure_printer();
-static char *fullpath();
-char *nameit();
-static void pack_white(char *ptr);
-
-/**
- ** do_printer() - CREATE OR CHANGE PRINTER
- **/
-
-void do_printer ()
-{
- int rc;
-
- /*
- * Set or change the printer configuration.
- */
- if (strlen(modifications))
- configure_printer (modifications);
-
- /*
- * Allow/deny forms.
- */
- BEGIN_CRITICAL
- if (!oldp)
- if (allow_form_printer(getlist(NAME_NONE, "", ","), p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
-
- if (f_allow || f_deny) {
- if (f_allow && allow_form_printer(f_allow, p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
-
- if (f_deny && deny_form_printer(f_deny, p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
- }
- END_CRITICAL
-
- /* Add/remove types of paper */
-
- BEGIN_CRITICAL
- if (!oldp)
- if (add_paper_to_printer(getlist(NAME_NONE, "", ","),p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
-
-
- if (p_add && add_paper_to_printer(p_add, p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
-
- if (p_remove && remove_paper_from_printer(p_remove, p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
- END_CRITICAL
-
- /*
- * Allow/deny users.
- */
- BEGIN_CRITICAL
- if (!oldp)
- if (allow_user_printer(getlist(NAME_ALL, "", ","), p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
-
- if (u_allow || u_deny) {
- if (u_allow && allow_user_printer(u_allow, p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
-
- if (u_deny && deny_user_printer(u_deny, p) == -1) {
- LP_ERRMSG1 (ERROR, E_ADM_ACCESSINFO, PERROR);
- done(1);
- }
- }
- END_CRITICAL
-
- /*
- * Tell the Spooler about the printer
- */
- send_message(S_LOAD_PRINTER, p, "", "");
- rc = output(R_LOAD_PRINTER);
-
- switch (rc) {
- case MOK:
- break;
-
- case MNODEST:
- case MERRDEST:
- LP_ERRMSG (ERROR, E_ADM_ERRDEST);
- done (1);
- /*NOTREACHED*/
-
- case MNOSPACE:
- LP_ERRMSG (WARNING, E_ADM_NOPSPACE);
- break;
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- /*NOTREACHED*/
- }
-
- /*
- * Now that the Spooler knows about the printer,
- * we can do the balance of the changes.
- */
-
- /*
- * Mount or unmount form, print-wheel.
- */
- if (M)
- do_mount(p, (f? f : (char *)0), (S? *S : (char *)0));
- else if (t) do_max_trays(p);
-
- /*
- * Display the alert type.
- */
- if (A && STREQU(A, NAME_LIST)) {
- if (label)
- (void) printf(gettext("Printer %s: "), label);
- printalert (stdout, &(oldp->fault_alert), 1);
- }
-
- /*
- * -A quiet.
- */
- if (A && STREQU(A, NAME_QUIET)) {
-
- send_message(S_QUIET_ALERT, p, (char *)QA_PRINTER, "");
- rc = output(R_QUIET_ALERT);
-
- switch(rc) {
- case MOK:
- break;
-
- case MNODEST: /* not quite, but not a lie either */
- case MERRDEST:
- LP_ERRMSG1 (WARNING, E_LP_NOQUIET, p);
- break;
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- /*NOTREACHED*/
- }
- }
-
- /*
- * Add printer p to class c
- */
- if (c) {
- CLASS *pc,
- clsbuf;
-
- if (STREQU(c, NAME_ANY))
- c = NAME_ALL;
-
-Loop: if (!(pc = getclass(c))) {
- if (STREQU(c, NAME_ALL))
- goto Done;
-
- if (errno != ENOENT) {
- LP_ERRMSG2 (
- ERROR,
- E_LP_GETCLASS,
- c,
- PERROR
- );
- done (1);
- }
-
- /*
- * Create the class
- */
- clsbuf.name = strdup(c);
- clsbuf.members = 0;
- if (addlist(&clsbuf.members, p) == -1) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done (1);
- }
- pc = &clsbuf;
-
- } else if (searchlist(p, pc->members))
- LP_ERRMSG2 (WARNING, E_ADM_INCLASS, p, pc->name);
-
- else if (addlist(&pc->members, p) == -1) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done (1);
- }
-
- BEGIN_CRITICAL
- if (putclass(pc->name, pc) == -1) {
- LP_ERRMSG2 (
- ERROR,
- E_LP_PUTCLASS,
- pc->name,
- PERROR
- );
- done(1);
- }
- END_CRITICAL
-
- send_message (S_LOAD_CLASS, pc->name);
- rc = output(R_LOAD_CLASS);
-
- switch(rc) {
- case MOK:
- break;
-
- case MNODEST:
- case MERRDEST:
- LP_ERRMSG (ERROR, E_ADM_ERRDEST);
- done (1);
- /*NOTREACHED*/
-
- case MNOSPACE:
- LP_ERRMSG (WARNING, E_ADM_NOCSPACE);
- break;
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- /*NOTREACHED*/
- }
-
- if (STREQU(c, NAME_ALL))
- goto Loop;
- }
-Done:
- /*
- * Remove printer p from class r
- */
- if (r) {
- if (STREQU(r, NAME_ALL) || STREQU(r, NAME_ANY))
- fromallclasses(p);
- else
- fromclass(p, r);
- }
-
- return;
-}
-
-/**
- ** configure_printer() - SET OR CHANGE CONFIGURATION OF PRINTER
- **/
-
-static void configure_printer (list)
- char *list;
-{
- register PRINTER *prbufp;
-
- PRINTER printer_struct;
-
- char type;
- char * infile_opts = NULL;
-
-
- if (oldp) {
-
- prbufp = oldp;
-
- if (!T)
- T = prbufp->printer_types;
-
- if (!i && !e && !m)
- /*
- * Don't copy the original interface program
- * again, but do keep the name of the original.
- */
- ignprinter = BAD_INTERFACE;
- else
- ignprinter = 0;
-
- /*
- * If we are making this a remote printer,
- * make sure that local-only attributes are
- * cleared.
- */
- if (s) {
- prbufp->banner = 0;
- prbufp->cpi.val = 0;
- prbufp->cpi.sc = 0;
- prbufp->device = 0;
- prbufp->dial_info = 0;
- prbufp->fault_rec = 0;
- prbufp->interface = 0;
- prbufp->lpi.val = 0;
- prbufp->lpi.sc = 0;
- prbufp->plen.val = 0;
- prbufp->plen.sc = 0;
- prbufp->login = 0;
- prbufp->speed = 0;
- prbufp->stty = 0;
- prbufp->pwid.val = 0;
- prbufp->pwid.sc = 0;
- prbufp->fault_alert.shcmd = strdup(NAME_NONE);
- prbufp->fault_alert.Q = 0;
- prbufp->fault_alert.W = 0;
-#if defined(CAN_DO_MODULES)
- prbufp->modules = 0;
-#endif
-
- /*
- * If we are making this a local printer, make
- * sure that some local-only attributes are set.
- * (If the user has specified these as well, his/her
- * values will overwrite what we set here.)
- */
- } else if (oldp->remote) {
- prbufp->banner = BAN_ALWAYS;
- prbufp->interface = makepath(Lp_Model, STANDARD, (char *)0);
- prbufp->fault_alert.shcmd = nameit(NAME_MAIL);
-
- /*
- * Being here means "!s && oldp->remote" is true,
- * i.e. this printer never had an interface pgm
- * before. Thus we can safely clear the following.
- * This is needed to let "putprinter()" copy the
- * (default) interface program.
- */
- ignprinter = 0;
- }
-
- } else {
- /*
- * The following takes care of the lion's share
- * of the initialization of a new printer structure.
- * However, special initialization (e.g. non-zero,
- * or substructure members) needs to be considered
- * for EACH NEW MEMBER added to the structure.
- */
- (void)memset (&printer_struct, 0, sizeof(printer_struct));
-
- prbufp = &printer_struct;
- prbufp->banner = BAN_ALWAYS;
- prbufp->cpi.val = 0;
- prbufp->cpi.sc = 0;
- if (!s)
- prbufp->interface = makepath(Lp_Model, m, (char *)0);
- prbufp->lpi.val = 0;
- prbufp->lpi.sc = 0;
- prbufp->plen.val = 0;
- prbufp->plen.sc = 0;
- prbufp->pwid.val = 0;
- prbufp->pwid.sc = 0;
- if (!s && !A)
- prbufp->fault_alert.shcmd = nameit(NAME_MAIL);
- prbufp->fault_alert.Q = 0;
- prbufp->fault_alert.W = 0;
- prbufp->options = NULL;
- }
-
- while ((type = *list++) != '\0') switch(type) {
-
- case 'A':
- if (!s) {
- if (STREQU(A, NAME_MAIL) || STREQU(A, NAME_WRITE))
- prbufp->fault_alert.shcmd = nameit(A);
- else if (!STREQU(A, NAME_QUIET))
- prbufp->fault_alert.shcmd = A;
- }
- break;
-
- case 'b':
- if (!s)
- prbufp->banner = banner;
- break;
-
- case 'c':
- if (!s)
- prbufp->cpi = cpi_sdn;
- break;
-
- case 'D':
- prbufp->description = D;
- break;
-
- case 'e':
- if (!s) {
- prbufp->interface = makepath(
- Lp_A_Interfaces,
- e,
- (char *)0
- );
- }
- break;
-
- case 'F':
- if (!s)
- prbufp->fault_rec = F;
- break;
-
-#if defined(CAN_DO_MODULES)
- case 'H':
- if (!s)
- prbufp->modules = H;
- break;
-#endif
-
- case 'h':
- if (!s)
- prbufp->login = 0;
- break;
-
- case 'i':
- if (!s)
- prbufp->interface = fullpath(i);
- break;
-
- case 'I':
- prbufp->input_types = I;
- break;
-
- case 'l':
- if (!s)
- prbufp->login = 1;
- break;
-
- case 'L':
- if (!s)
- prbufp->plen = length_sdn;
- break;
-
- case 'm':
- if (!s)
- prbufp->interface = makepath(Lp_Model, m, (char *)0);
- break;
-
- case 'M':
- if (!s)
- prbufp->lpi = lpi_sdn;
- break;
-
-#ifdef LP_USE_PAPI_ATTR
- case 'n':
- {
- if (n_opt != NULL)
- {
- if (*n_opt == '/')
- {
- prbufp->ppd = fullpath(n_opt);
- }
- else
- {
- prbufp->ppd =
- makepath(Lp_Model, "ppd", n_opt, (char *)0);
- }
- ppdopt = 1;
- }
- break;
- }
-#endif
-
- case 'o':
- /*
- * The "undefined" key-value -o options
- *
- * Options requires special handling. It is a
- * list whose members are to be handled
- * individually.
- *
- * Need to: set new options, keep old options if not
- * redefined, remove old options if defined as "key=".
- *
- *
- * "p" is a global containing the printer name
- */
-
- if (!s) {
-
- if ((infile_opts = getpentry(p, PR_OPTIONS)) == NULL)
- prbufp->options = o_options;
- else {
- prbufp->options =
- pick_opts(infile_opts, o_options);
- }
- }
- break;
-
- case 'R':
- if (s) {
- prbufp->remote = s;
- prbufp->dial_info = 0;
- prbufp->device = 0;
- } else
- prbufp->remote = 0;
- break;
-
- case 's':
- if (!s) {
- /*
- * lpadmin always defers to stty
- */
- prbufp->speed = 0;
- prbufp->stty = stty_opt;
- }
- break;
-
- case 'S':
- if (!M)
- if (STREQU(*S, NAME_NONE))
- prbufp->char_sets = 0;
- else
- prbufp->char_sets = S;
- break;
-
- case 'T':
- prbufp->printer_types = T;
- break;
-
- case 'U':
- if (!s) {
- prbufp->dial_info = U;
- prbufp->device = 0;
- prbufp->remote = 0;
- }
- break;
-
- case 'v':
- if (!s) {
- prbufp->device = v;
- prbufp->dial_info = 0;
- prbufp->remote = 0;
- }
- break;
-
- case 'w':
- if (!s)
- prbufp->pwid = width_sdn;
- break;
-
- case 'W':
- if (!s)
- prbufp->fault_alert.W = W;
- break;
-
- }
-
-
- BEGIN_CRITICAL
- if (putprinter(p, prbufp) == -1) {
- if (
- errno == EINVAL
- && (badprinter & BAD_INTERFACE)
- )
- LP_ERRMSG1 (
- ERROR,
- E_ADM_BADINTF,
- prbufp->interface
- );
- else
- LP_ERRMSG2 (
- ERROR,
- E_LP_PUTPRINTER,
- p,
- PERROR
- );
- done(1);
- }
-
- if ((getzoneid() == GLOBAL_ZONEID) && system_labeled &&
- (prbufp->device != NULL))
- update_dev_dbs(p, prbufp->device, "ADD");
-
- END_CRITICAL
-
- return;
-}
-
-/**
- ** fullpath()
- **/
-
-static char *fullpath (str)
- char *str;
-{
- register char *cur_dir,
- *path;
-
-
- while (*str && *str == ' ')
- str++;
- if (*str == '/')
- return (str);
-
- if (!(cur_dir = malloc(PATH_MAX + 1)))
- return (str);
-
- getcwd (cur_dir, PATH_MAX);
- path = makepath(cur_dir, str, (char *)0);
-
- /*
- * Here we could be nice and strip out /./ and /../
- * stuff, but it isn't necessary.
- */
-
- return (path);
-}
-
-/**
- ** nameit() - ADD USER NAME TO COMMAND
- **/
-
-char *nameit (cmd)
- char *cmd;
-{
- register char *nm = getname(),
- *copy = malloc(
- (unsigned) (strlen(cmd) + 1 +
- strlen(nm) + 1)
- );
-
- (void) strcpy (copy, cmd);
- (void) strcat (copy, " ");
- (void) strcat (copy, nm);
- return (copy);
-}
-
-/*
- * update_dev_dbs - ADD/REMOVE ENTRIES FOR THE PRINTER IN DEVICE
- * ALLOCATION FILES
- *
- * We intentionally ignore errors, since we don't want the printer
- * installation to be viewed as failing just because we didn't add
- * the device_allocate entry.
- *
- * Input:
- * prtname - printer name
- * devname - device associated w/ this printer
- * func - [ADD|REMOVE] entries in /etc/security/device_allocate
- * and /etc/security/device_maps
- *
- * Return:
- * Always 'quiet' return. Failures are ignored.
- */
-void
-update_dev_dbs(char *prtname, char *devname, char *func)
-{
- int fd, status;
- pid_t pid;
-
- pid = fork();
- switch (pid) {
- case -1:
- /* fork failed, just return quietly */
- return;
- case 0:
- /* child */
- /* redirect to /dev/null */
- (void) close(1);
- (void) close(2);
- fd = open("/dev/null", O_WRONLY);
- fd = dup(fd);
-
- if (strcmp(func, "ADD") == 0) {
- execl("/usr/sbin/add_allocatable", "add_allocatable",
- "-n", prtname, "-t", "lp", "-l", devname,
- "-o", "minlabel=admin_low:maxlabel=admin_high",
- "-a", "*", "-c", "/bin/true", NULL);
- } else {
- if (strcmp(func, "REMOVE") == 0) {
- execl("/usr/sbin/remove_allocatable",
- "remove_allocatable", "-n", prtname, NULL);
- }
- }
- _exit(1);
- /* NOT REACHED */
- default:
- waitpid(pid, &status, 0);
- return;
- }
-}
-
-/*
- * pack_white(ptr) trims off multiple occurances of white space from a NULL
- * terminated string pointed to by "ptr".
- */
-static void
-pack_white(char *ptr)
-{
- char *tptr;
- char *mptr;
- int cnt;
-
- if (ptr == NULL)
- return;
- cnt = strlen(ptr);
- if (cnt == 0)
- return;
- mptr = (char *)calloc((unsigned)cnt+1, sizeof (char));
- if (mptr == NULL)
- return;
- tptr = strtok(ptr, " \t");
- while (tptr != NULL) {
- (void) strcat(mptr, tptr);
- (void) strcat(mptr, " ");
- tptr = strtok(NULL, " \t");
- }
- cnt = strlen(mptr);
- (void) strcpy(ptr, mptr);
- free(mptr);
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/do_pwheel.c b/usr/src/cmd/lp/cmd/lpadmin/do_pwheel.c
deleted file mode 100644
index a53cb55d23..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/do_pwheel.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1991 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.11 */
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <libintl.h>
-
-#include "lp.h"
-#include "printers.h"
-#include "msgs.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-
-extern char *nameit(),
- *label;
-
-static void configure_pwheel();
-
-/**
- ** do_pwheel() - SET ALERT FOR NEED TO MOUNT PRINT WHEEL
- **/
-
-void do_pwheel ()
-{
- int rc;
-
-
- if (A && STREQU(A, NAME_NONE)) {
- BEGIN_CRITICAL
- if (delpwheel(*S) == -1) {
- LP_ERRMSG1 (WARNING, E_ADM_BADPWHEEL, *S);
- return;
- }
- END_CRITICAL
-
- } else if (strlen(modifications))
- configure_pwheel (modifications);
-
- if (A && STREQU(A, NAME_LIST)) {
- if (label)
- (void) printf(gettext("Print wheel %s: "), label);
- printalert (stdout, &(oldS->alert), 0);
- return;
- }
-
- if (A && STREQU(A, NAME_QUIET)) {
-
- send_message(S_QUIET_ALERT, *S, (char *)QA_PRINTWHEEL, "");
- rc = output(R_QUIET_ALERT);
-
- switch(rc) {
- case MOK:
- break;
-
- case MNODEST: /* not quite, but not a lie either */
- case MERRDEST:
- LP_ERRMSG1 (WARNING, E_LP_NOQUIET, *S);
- break;
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- /*NOTREACHED*/
- }
-
- return;
- }
-
- if (A && STREQU(A, NAME_NONE)) {
- send_message(S_UNLOAD_PRINTWHEEL, *S);
- rc = output(R_UNLOAD_PRINTWHEEL);
- } else {
- send_message(S_LOAD_PRINTWHEEL, *S);
- rc = output(R_LOAD_PRINTWHEEL);
- }
-
- switch(rc) {
- case MOK:
- break;
-
- case MNODEST:
- /*
- * Should only occur if we're deleting a print wheel
- * alert that doesn't exist.
- */
- break;
-
- case MERRDEST:
- LP_ERRMSG (ERROR, E_ADM_ERRDEST);
- done (1);
- /*NOTREACHED*/
-
- case MNOSPACE:
- LP_ERRMSG (WARNING, E_ADM_NOPWSPACE);
- break;
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- /*NOTREACHED*/
- }
- return;
-}
-
-/**
- ** configure_pwheel() - SET OR CHANGE CONFIGURATION OF A PRINT WHEEL
- **/
-
-static void configure_pwheel (list)
- char *list;
-{
- register PWHEEL *ppw;
-
- PWHEEL pwheel_buf;
-
- char type;
-
-
- if (oldS)
- ppw = oldS;
- else {
- ppw = &pwheel_buf;
- ppw->alert.shcmd = 0;
- ppw->alert.Q = 0;
- ppw->alert.W = 0;
- }
-
- while ((type = *list++) != '\0') switch(type) {
-
- case 'A':
- if (STREQU(A, NAME_MAIL) || STREQU(A, NAME_WRITE))
- ppw->alert.shcmd = nameit(A);
- else
- ppw->alert.shcmd = A;
-
- break;
-
- case 'Q':
- ppw->alert.Q = Q;
- break;
-
- case 'W':
- ppw->alert.W = W;
- break;
-
- }
-
- BEGIN_CRITICAL
- if (putpwheel(*S, ppw) == -1) {
- LP_ERRMSG2 (
- ERROR,
- E_ADM_PUTPWHEEL,
- *S,
- PERROR
- );
- done(1);
- }
- END_CRITICAL
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/done.c b/usr/src/cmd/lp/cmd/lpadmin/done.c
deleted file mode 100644
index 51121528d0..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/done.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-extern void exit();
-
-#include "lp.h"
-#include "msgs.h"
-
-#include "lpadmin.h"
-
-/**
- ** done() - CLEAN UP AND EXIT
- **/
-
-void done (rc)
- int rc;
-{
- (void)mclose ();
- exit (rc);
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/fromclass.c b/usr/src/cmd/lp/cmd/lpadmin/fromclass.c
deleted file mode 100644
index ab0cb36698..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/fromclass.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include "stdio.h"
-#include "errno.h"
-
-#include "lp.h"
-#include "class.h"
-#include "msgs.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-
-static void _fromclass();
-
-/**
- ** fromclass() - REMOVE PRINTER FROM A CLASS
- **/
-
-void fromclass (printer, class)
- char *printer,
- *class;
-{
- CLASS *pc;
-
- if (!(pc = getclass(class))) {
- LP_ERRMSG1 (ERROR, E_LP_NOCLASS, class);
- done (1);
- }
-
- if (!searchlist(printer, pc->members)) {
- LP_ERRMSG2 (ERROR, E_ADM_NOTMEM, printer, class);
- done (1);
- }
-
- _fromclass (printer, class, pc);
-
- return;
-}
-
-/**
- ** fromallclasses() - DELETE A PRINTER FROM ALL CLASSES
- **/
-
-void fromallclasses (printer)
- char *printer;
-{
- register CLASS *pc;
-
-
- while ((pc = getclass(NAME_ALL)))
- if (searchlist(printer, pc->members))
- _fromclass (printer, pc->name, pc);
-
- if (errno != ENOENT) {
- LP_ERRMSG1 (ERROR, E_ADM_GETCLASSES, PERROR);
- done (1);
- }
-
- return;
-}
-
-/**
- ** _fromclass() - REALLY DELETE PRINTER FROM CLASS
- **/
-
-static void _fromclass (printer, class, pc)
- char *printer,
- *class;
- CLASS *pc;
-{
- int rc;
-
-
- if (dellist(&pc->members, printer) == -1) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done(1);
- }
-
- if (!pc->members)
- rmdest (1, class);
-
- else {
- BEGIN_CRITICAL
- if (putclass(class, pc) == -1) {
- LP_ERRMSG2 (
- ERROR,
- E_LP_PUTCLASS,
- class,
- PERROR
- );
- done(1);
- }
- END_CRITICAL
-
- send_message(S_LOAD_CLASS, class, "", "");
- rc = output(R_LOAD_CLASS);
-
- switch(rc) {
- case MOK:
- break;
-
- case MNODEST:
- case MERRDEST:
- LP_ERRMSG (ERROR, E_ADM_ERRDEST);
- done (1);
- /*NOTREACHED*/
-
- case MNOSPACE:
- LP_ERRMSG (WARNING, E_ADM_NOCSPACE);
- break;
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- /*NOTREACHED*/
- }
-
- }
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/ismodel.c b/usr/src/cmd/lp/cmd/lpadmin/ismodel.c
deleted file mode 100644
index 3503747aac..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/ismodel.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include "lp.h"
-#include "lpadmin.h"
-
-extern int Access();
-
-int ismodel (name)
- char *name;
-{
- if (!name || !*name)
- return (0);
-
- return (Access(makepath(Lp_Model, name, (char *)0), 04) != -1);
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/lpadmin.c b/usr/src/cmd/lp/cmd/lpadmin/lpadmin.c
deleted file mode 100644
index 83560a6bf4..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/lpadmin.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdio.h"
-#include "ctype.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "sys/utsname.h"
-#include "string.h"
-
-#include "lp.h"
-#include "msgs.h"
-#include "access.h"
-#include "class.h"
-#include "printers.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-#include <locale.h>
-
-extern void chkopts(),
- chkopts2(),
- chkopts3(),
- exit();
-
-int system_labeled = 0;
-
-int scheduler_active = 0;
-
-char *label = 0;
-
-PRINTER *printer_pointer = 0;
-
-static CLASS *class_pointer = 0;
-
-PWHEEL *pwheel_pointer = 0;
-char *Local_System = 0;
-
-/**
- ** main()
- **/
-
-int
-main(int argc, char *argv[])
-{
- struct utsname un;
-
- (void) setlocale (LC_ALL, "");
-
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- if (!is_user_admin()) {
- LP_ERRMSG (ERROR, E_LP_NOTADM);
- done (1);
- /*NOTREACHED*/
- }
-
- system_labeled = is_system_labeled();
-
- uname(&un);
- Local_System = strdup(un.nodename);
-
- options (argc, argv); /* process command line options */
-
- chkopts (); /* check for legality of options */
-
- startup (); /* open path to Spooler */
-
- if (d)
- newdflt (d); /* -d */
-
- else if (x) {
-
- /* allow "any" or "all" to do all destinations */
- if (STREQU(NAME_ALL, x) || STREQU(NAME_ANY, x)) {
-
- /*
- * Just deleting all the printers should get
- * rid of all the classes, too, but removing
- * the classes first should make things go a bit
- * faster.
- */
-
- while ((class_pointer = getclass(NAME_ALL)))
- rmdest (1, class_pointer->name);
-
- if (errno != ENOENT) {
- LP_ERRMSG1 (
- ERROR,
- E_ADM_GETCLASSES,
- PERROR
- );
- done (1);
- /*NOTREACHED*/
- }
-
- while ((printer_pointer = getprinter(NAME_ALL)))
- rmdest (0, printer_pointer->name);
-
- if (errno != ENOENT) {
- LP_ERRMSG1 (
- ERROR,
- E_ADM_GETPRINTERS,
- PERROR
- );
- done (1);
- /*NOTREACHED*/
- }
-
- } else
- rmdest (isclass(x), x);
-
- } else if (!p && S) {
- if (STREQU(*S, NAME_ALL) || STREQU(*S, NAME_ANY)) {
- while ((pwheel_pointer = getpwheel(NAME_ALL))) {
- *S = pwheel_pointer->name;
- chkopts3 (0);
- label = *S;
- do_pwheel ();
- }
- } else {
- label = 0;
- do_pwheel ();
- }
-
-#if defined(J_OPTION)
- } else if (j) {
- do_fault (); /* -j */
-#endif
-
- } else {
- /* allow "any" or "all" to do all printers */
- if (STREQU(NAME_ALL, p) || STREQU(NAME_ANY, p)) {
- int called=0;
- while ((printer_pointer = getprinter(NAME_ALL)) != NULL) {
- /*
- * "chkopts2()" will clobber "s".
- */
- char * save_s = s;
-
- called++;
- p = printer_pointer->name;
- chkopts2 (0);
-
- if (s)
- if (
- A || a || e || F || H
- || h || i || l || m || M
- || o || U || v
- || Q != -1 || W != -1
- )
- LP_ERRMSG1 (
- WARNING,
- E_ADM_SIGNORE,
- p
- );
- label = p;
- do_printer ();
-
- s = save_s;
- }
- if (called == 0 )
- LP_ERRMSG (ERROR, E_ADM_PLONELY);
-
- if (errno != ENOENT) {
- LP_ERRMSG2 (
- ERROR,
- E_LP_GETPRINTER,
- NAME_ALL,
- PERROR
- );
- done (1);
- /*NOTREACHED*/
- }
- } else {
- label = 0;
- do_printer (); /* -p etc. */
- }
- }
- done (0);
- /*NOTREACHED*/
- return (0);
-}
-
-/**
- ** putp() - FAKE ROUTINES TO AVOID REAL ONES
- **/
-
-int putp ()
-{
- return (0);
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/lpadmin.h b/usr/src/cmd/lp/cmd/lpadmin/lpadmin.h
deleted file mode 100644
index 3e58a3b087..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/lpadmin.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#define BEGIN_CRITICAL { ignore_signals(); {
-#define END_CRITICAL } trap_signals(); }
-
-extern void ignore_signals(),
- trap_signals();
-
-extern int a,
- banner,
-#if defined(DIRECT_ACCESS)
- C,
-#endif
- filebreak,
- h,
- j,
- l,
- M,
- t,
- o,
- Q,
- W,
- scheduler_active;
-
-extern char *A,
- *c,
- *cpi,
- *d,
- *D,
- *e,
- *f,
- **f_allow,
- **f_deny,
- **p_add,
- **p_remove,
- *P,
- *F,
- **H,
- *i,
- **I,
- *length,
- *lpi,
- *m,
- modifications[128],
-#ifdef LP_USE_PAPI_ATTR
- *n_opt,
-#endif
- *p,
- *r,
- *s,
- *stty_opt,
- **o_options,
- **S,
- **T,
- *u,
- **u_allow,
- **u_deny,
- *U,
- *v,
- *width,
- *x;
-
-#if defined(LPUSER)
-extern SCALED cpi_sdn,
- length_sdn,
- lpi_sdn,
- width_sdn;
-#endif
-
-#if defined(PR_MAX)
-extern PRINTER *oldp;
-
-extern PWHEEL *oldS;
-#endif
-
-extern short daisy;
-
-extern char *Local_System;
-
-extern char *getdflt();
-
-extern int ismodel(),
- output(),
- verify_form(),
- do_align();
-
-extern void do_fault(),
- do_mount(),
- do_printer(),
- do_pwheel(),
- done(),
- fromclass(),
- newdflt(),
- options(),
- rmdest(),
- startup(),
- usage();
-
-/* Routines/variables needed for labeled systems */
-extern void update_dev_dbs(char *, char *, char *);
-extern int system_labeled;
-
-
-#if defined(__STDC__)
-void send_message( int , ... );
-extern char ** pick_opts(char *, char **);
-#else
-extern void send_message();
-extern char ** pick_opts();
-#endif
diff --git a/usr/src/cmd/lp/cmd/lpadmin/options.c b/usr/src/cmd/lp/cmd/lpadmin/options.c
deleted file mode 100644
index 04928e5795..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/options.c
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include "ctype.h"
-#include "stdio.h"
-#include "string.h"
-#include "stdlib.h"
-#include <libintl.h>
-
-#include "lp.h"
-#include "printers.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-#ifdef LP_USE_PAPI_ATTR
-#if defined(CAN_DO_MODULES)
-#define OPT_LIST "A:ac:d:D:e:f:F:H:hi:I:lm:Mn:o:p:Q:r:S:s:T:u:U:v:W:x:t:P:"
-#else
-#define OPT_LIST "A:ac:d:D:e:f:F:hi:I:lm:Mn:o:p:Q:r:S:s:T:u:U:v:W:x:t:P:"
-#endif
-
-#else
-#if defined(CAN_DO_MODULES)
-#define OPT_LIST "A:ac:d:D:e:f:F:H:hi:I:lm:Mo:p:Q:r:S:s:T:u:U:v:W:x:t:P:"
-#else
-#define OPT_LIST "A:ac:d:D:e:f:F:hi:I:lm:Mo:p:Q:r:S:s:T:u:U:v:W:x:t:P:"
-#endif
-#endif
-
-#define MALLOC(pointer) \
- if (!(pointer = strdup(optarg))) { \
- LP_ERRMSG (ERROR, E_LP_MALLOC); \
- done (1); \
- } else
-
-#define REALLOC(pointer) \
- if (!(pointer = realloc(pointer, (unsigned) (strlen(pointer) + 1 + strlen(optarg) + 1)))) { \
- LP_ERRMSG (ERROR, E_LP_MALLOC); \
- done (1); \
- } else if (strcat(pointer, " ")) \
- (void)strcat (pointer, optarg); \
- else
-
-extern char *optarg;
-
-extern int optind,
- opterr,
- optopt;
-
-extern double strtod();
-
-extern long strtol();
-
-int a = 0, /* alignment needed for mount */
- banner = -1, /* allow/don't-allow nobanner */
-#if defined(DIRECT_ACCESS)
- C = 0, /* direct a.o.t. normal access */
-#endif
- filebreak = 0,
- h = 0, /* hardwired terminal */
- j = 0, /* do -F just for current job */
- l = 0, /* login terminal */
- M = 0, /* do mount */
- t = 0, /* tray number*/
- o = 0, /* some -o options given */
- Q = -1, /* queue threshold for alert */
- W = -1; /* alert interval */
-
-char *A = 0, /* alert type */
- *c = 0, /* class name */
- *cpi = 0, /* string value of -o cpi= */
- *d = 0, /* default destination */
- *D = 0, /* description */
- *e = 0, /* copy existing interface */
- *f = 0, /* forms list - allow/deny */
- *P = 0, /* paper list */
- *F = 0, /* fault recovery */
- **H = 0, /* list of modules to push */
- *i = 0, /* interface pathname */
- **I = 0, /* content-type-list */
- *length = 0, /* string value of -o length= */
- *lpi = 0, /* string value of -o lpi= */
- *m = 0, /* model name */
- modifications[128], /* list of mods to make */
-#ifdef LP_USE_PAPI_ATTR
- *n_opt = NULL, /* PPD file name */
-#endif
- *p = 0, /* printer name */
- *r = 0, /* class to remove printer from */
- *s = 0, /* system printer is on */
- *stty_opt= 0, /* string value of -o stty= */
- **o_options = 0,/* undefined lpadmin -o options */
- **S = 0, /* -set/print-wheel list */
- **T = 0, /* terminfo names */
- *u = 0, /* user allow/deny list */
- *U = 0, /* dialer_info */
- *v = 0, /* device pathname */
- *width = 0, /* string value of -o width= */
- *x = 0; /* destination to be deleted */
-
-SCALED cpi_sdn = { 0, 0 },
- length_sdn = { 0, 0 },
- lpi_sdn = { 0, 0 },
- width_sdn = { 0, 0 };
-
-static char *modp = modifications;
-
-static void oparse();
-
-static char * empty_list[] = { 0 };
-
-/**
- ** options() - PARSE COMMAND LINE ARGUMENTS INTO OPTIONS
- **/
-
-void options (argc, argv)
- int argc;
- char *argv[];
-{
- int optsw,
- ac,
- Aflag = 0;
-
- char *cp,
- *rest,
- **av;
- char stroptsw[] = "-X";
-
-#if defined(__STDC__)
- typedef char * const * stupid; /* dumb-ass ANSI C */
-#else
- typedef char ** stupid;
-#endif
-
-
- /*
- * Add a fake value to the end of the "argv" list, to
- * catch the case that a valued-option comes last.
- */
- av = malloc((argc + 2) * sizeof(char *));
- for (ac = 0; ac < argc; ac++)
- av[ac] = argv[ac];
- av[ac++] = "--";
-
- opterr = 0;
- while ((optsw = getopt(ac, (stupid)av, OPT_LIST)) != EOF) {
-
- switch (optsw) {
-
- /*
- * These options MAY take a value. Check the value;
- * if it begins with a '-', assume it's really the next
- * option.
- */
- case 'd':
- case 'p': /* MR bl87-27863 */
- case 'I':
-#if defined(CAN_DO_MODULES)
- case 'H':
-#endif
- if (*optarg == '-') {
- /*
- * This will work if we were given
- *
- * -x -foo
- *
- * but would fail if we were given
- *
- * -x-foo
- */
- optind--;
- switch (optsw) {
- case 'd':
-#if defined(CAN_DO_MODULES)
- case 'H':
-#endif
- optarg = NAME_NONE;
- break;
- case 'p':
- optarg = NAME_ALL;
- break;
- case 'I':
- optarg = 0;
- break;
- }
- }
- break;
-
- /*
- * These options MUST have a value. Check the value;
- * if it begins with a dash or is null, complain.
- */
- case 'Q':
- case 'W':
- case 't':
- /*
- * These options take numeric values, which might
- * be negative. Negative values are handled later,
- * but here we just screen them.
- */
- (void)strtol(optarg, &rest, 10);
- if (!rest || !*rest)
- break;
- /*FALLTHROUGH*/
- case 'A':
- case 'c':
- case 'e':
- case 'f':
- case 'P':
- case 'F':
- case 'i':
- case 'm':
-#ifdef LP_USE_PAPI_ATTR
- case 'n':
-#endif
- case 'o':
-/* case 'p': */ /* MR bl87-27863 */
- case 'r':
- case 'S':
- case 's':
- case 'T':
- case 'u':
- case 'U':
- case 'v':
- case 'x':
- /*
- * These options also must have non-null args.
- */
- if (!*optarg) {
- stroptsw[1] = optsw;
- LP_ERRMSG1 (ERROR, E_LP_NULLARG, stroptsw);
- done (1);
- }
- if (*optarg == '-') {
- stroptsw[1] = optsw;
- LP_ERRMSG1 (ERROR, E_LP_OPTARG, stroptsw);
- done (1);
- }
- if (optsw == 'A')
- Aflag++;
- break;
- case 'D':
- /*
- * These options can have a null arg.
- */
- if (*optarg == '-') {
- stroptsw[1] = optsw;
- LP_ERRMSG1 (ERROR, E_LP_OPTARG, stroptsw);
- done (1);
- }
- break;
- }
-
- switch (optsw) {
-
- case 'a': /* alignment pattern needed for mount */
- a = 1;
- break;
-
- case 'A': /* alert type */
- if (A)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'A');
- MALLOC(A);
- Aflag++;
- if (!STREQU(A, NAME_QUIET) && !STREQU(A, NAME_LIST))
- *modp++ = 'A';
- break;
-
- case 'c': /* class to insert printer p */
- if (c)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'c');
- MALLOC(c);
- break;
-
-#if defined(DIRECT_ACCESS)
- case 'C':
- C = 1;
- break;
-#endif
-
- case 'd': /* system default destination */
- if (d)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'd');
- MALLOC(d);
- break;
-
- case 'D': /* description */
- if (D)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'D');
- MALLOC(D);
- *modp++ = 'D';
- break;
-
- case 'e': /* existing printer interface */
- if (e)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'e');
- MALLOC(e);
- *modp++ = 'e';
- break;
-
- case 'f': /* set up forms allow/deny */
- if (f)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'f');
- MALLOC(f);
- break;
-
- case 'P': /* set up forms allow/deny */
- if (P)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'P');
- MALLOC(P);
- break;
-
- case 'F': /* fault recovery */
- if (F)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'F');
- MALLOC(F);
- *modp++ = 'F';
- break;
-
-#if defined(CAN_DO_MODULES)
- case 'H':
- if (H)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'H');
- if (!optarg || !*optarg || STREQU(NAME_NONE, optarg))
- H = empty_list;
- if (!(H = getlist(optarg, LP_WS, LP_SEP))) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done(1);
- }
- *modp++ = 'H';
- break;
-#endif
-
- case 'h': /* hardwired terminal */
- h = 1;
- *modp++ = 'h';
- break;
-
- case 'i': /* interface pathname */
- if (i)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'i');
- MALLOC(i);
- *modp++ = 'i';
- break;
-
- case 'I': /* content-type-list */
- if (I)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'I');
- if (!optarg || !*optarg || STREQU(NAME_NONE, optarg))
- I = empty_list;
- else if (!(I = getlist(optarg, LP_WS, LP_SEP))) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done (1);
- }
- *modp++ = 'I';
- break;
-
-#if defined(J_OPTION)
- case 'j': /* fault recovery just for current job */
- j = 1;
-(void) printf (gettext("Sorry, the -j option is currently broken\n"));
- break;
-#endif
-
- case 'l': /* login terminal */
- l = 1;
- *modp++ = 'l';
- break;
-
- case 'm': /* model interface */
- if (m)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'm');
- MALLOC(m);
- *modp++ = 'm';
- break;
-
-#ifdef LP_USE_PAPI_ATTR
- case 'n': /* PPD file */
- if (n_opt)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'n');
- MALLOC(n_opt);
- *modp++ = 'n';
- break;
-#endif
-
- case 'M': /* a mount request */
- M = 1;
- break;
-
- case 'o': /* several different options */
- oparse (optarg);
- o = 1;
- break;
-
- case 'p': /* printer name */
- if (p)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'p');
- MALLOC(p);
- break;
-
- case 'Q':
- if (Q != -1)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'Q');
- if (STREQU(NAME_ANY, optarg))
- Q = 1;
- else {
- Q = strtol(optarg, &rest, 10);
- if (Q < 0) {
- LP_ERRMSG1 (ERROR, E_LP_NEGARG, 'Q');
- done (1);
- }
- if (rest && *rest) {
- LP_ERRMSG1 (ERROR, E_LP_GARBNMB, 'Q');
- done (1);
- }
- if (Q == 0) {
- LP_ERRMSG1 (ERROR, E_ADM_ZEROARG, 'Q');
- done (1);
- }
- }
- *modp++ = 'Q';
- break;
-
- case 'r': /* class to remove p from */
- if (r)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'r');
- MALLOC(r);
- break;
-
- case 'S': /* char_set/print-wheels */
- if (S)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'S');
- if (!(S = getlist(optarg, LP_WS, LP_SEP))) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done (1);
- }
- *modp++ = 'S';
- break;
-
- case 's':
- if (s)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 's');
-
- if ((cp = strchr(optarg, '!')))
- *cp = '\0';
-
- if ((STREQU(optarg, NAME_NONE)) ||
- (STREQU(optarg, "localhost")))
-
- s = Local_System;
- else if (STREQU(optarg, Local_System)) {
- if (cp) {
- LP_ERRMSG (ERROR, E_ADM_NAMEONLOCAL);
- done(1);
- } else
- s = Local_System;
- } else {
- if (cp)
- *cp = '!';
-
- MALLOC(s);
- }
-
- /* 's' already used for stty 'R' for remote? */
- *modp++ = 'R';
- break;
-
- case 't': /* tray number*/
- if (t != 0) LP_ERRMSG1 (WARNING, E_LP_2MANY, 't');
- t = strtol(optarg, &rest, 10);
- if (t <= 0) {
- LP_ERRMSG1 (ERROR, E_LP_NEGARG, 't');
- done (1);
- }
- if (rest && *rest) {
- LP_ERRMSG1 (ERROR, E_LP_GARBNMB, 't');
- done (1);
- }
- break;
-
- case 'T': /* terminfo names for p */
- if (T)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'T');
- if (!(T = getlist(optarg, LP_WS, LP_SEP))) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done (1);
- }
- *modp++ = 'T';
- break;
-
- case 'u': /* user allow/deny list */
- if (u)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'u');
- MALLOC(u);
- break;
-
- case 'U': /* dialer_info */
- if (U)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'U');
- MALLOC(U);
- *modp++ = 'U';
- break;
-
- case 'v': /* device pathname */
- if (v)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'v');
- MALLOC(v);
- *modp++ = 'v';
- break;
-
- case 'W': /* alert interval */
- if (W != -1)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'W');
- if (STREQU(NAME_ONCE, optarg))
- W = 0;
- else {
- W = strtol(optarg, &rest, 10);
- if (W < 0) {
- LP_ERRMSG1 (ERROR, E_LP_NEGARG, 'W');
- done (1);
- }
- if (rest && *rest) {
- LP_ERRMSG1 (ERROR, E_LP_GARBNMB, 'W');
- done (1);
- }
- }
- *modp++ = 'W';
- break;
-
- case 'x': /* destination to be deleted */
- if (x)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'x');
- MALLOC(x);
- break;
-
- default:
- if (optopt == '?') {
- usage ();
- done (0);
-
- } else {
- stroptsw[1] = optsw;
-
- if (strchr(OPT_LIST, optopt))
- LP_ERRMSG1 (ERROR, E_LP_OPTARG,
- stroptsw);
- else
- LP_ERRMSG1 (ERROR, E_LP_OPTION,
- stroptsw);
- done (1);
- }
- }
- }
-
- if (optind < argc)
- LP_ERRMSG1 (WARNING, E_LP_EXTRA, argv[optind]);
-
- if ((v) && (!Aflag)) {
- if (!(A = strdup("write"))) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- done (1);
- }
- *modp++ = 'A';
- }
-
- return;
-}
-
-/**
- ** oparse() - PARSE -o OPTION
- **/
-
-static void oparse (optarg)
- char *optarg;
-{
- register char **list = dashos(optarg);
-
-
- if (!list)
- return;
-
- for ( ; (optarg = *list); list++)
-
- if (STREQU(optarg, "banner")) {
- if (banner != -1)
- LP_ERRMSG1 (
- WARNING,
- E_ADM_2MANY,
- "banner/nobanner"
- );
- banner = BAN_ALWAYS;
- *modp++ = 'b';
-
- } else if (STREQU(optarg, "nobanner")) {
- if (banner != -1)
- LP_ERRMSG1 (
- WARNING,
- E_ADM_2MANY,
- "banner/nobanner"
- );
- banner = BAN_OPTIONAL;
- *modp++ = 'b';
-
- /* handle banner=(always|optional|never) */
- } else if (STRNEQU(optarg, "banner=", 7)) {
- char *ptr;
-
- ptr = (optarg += 7);
- if (banner != -1)
- LP_ERRMSG1 ( WARNING, E_ADM_2MANY,
- "banner/nobanner/banner=(always|optional|never)"
- );
-
- /* like "banner", always print a banner */
- if (strcasecmp(ptr, "always") == 0)
- banner = BAN_ALWAYS;
- /* like "nobanner", print a banner unless requested */
- if (strcasecmp(ptr, "optional") == 0)
- banner = BAN_OPTIONAL;
- /* never print a banner */
- if (strcasecmp(ptr, "never") == 0)
- banner = BAN_NEVER;
- *modp++ = 'b';
-
- } else if (STRNEQU(optarg, "length=", 7)) {
- if (length)
- LP_ERRMSG1 (
- WARNING,
- E_ADM_2MANY,
- "length="
- );
- length = (optarg += 7);
-
- if (!*optarg) {
- length_sdn.val = 0;
- length_sdn.sc = 0;
-
- } else {
- length_sdn = _getsdn(optarg, &optarg, 0);
- if (errno == EINVAL) {
- LP_ERRMSG (ERROR, E_LP_BADSCALE);
- done (1);
- }
- }
- *modp++ = 'L';
-
- } else if (STRNEQU(optarg, "width=", 6)) {
- if (width)
- LP_ERRMSG1 (
- WARNING,
- E_ADM_2MANY,
- "width="
- );
- width = (optarg += 6);
-
- if (!*optarg) {
- width_sdn.val = 0;
- width_sdn.sc = 0;
-
- } else {
- width_sdn = _getsdn(optarg, &optarg, 0);
- if (errno == EINVAL) {
- LP_ERRMSG (ERROR, E_LP_BADSCALE);
- done (1);
- }
- }
- *modp++ = 'w';
-
- } else if (STRNEQU(optarg, "cpi=", 4)) {
- if (cpi)
- LP_ERRMSG1 (WARNING, E_ADM_2MANY, "cpi=");
-
- cpi = (optarg += 4);
-
- if (!*optarg) {
- cpi_sdn.val = 0;
- cpi_sdn.sc = 0;
-
- } else {
- cpi_sdn = _getsdn(optarg, &optarg, 1);
- if (errno == EINVAL) {
- LP_ERRMSG (ERROR, E_LP_BADSCALE);
- done (1);
- }
- }
- *modp++ = 'c';
-
- } else if (STRNEQU(optarg, "lpi=", 4)) {
- if (lpi)
- LP_ERRMSG1 (WARNING, E_ADM_2MANY, "lpi=");
- lpi = (optarg += 4);
-
- if (!*optarg) {
- lpi_sdn.val = 0;
- lpi_sdn.sc = 0;
-
- } else {
- lpi_sdn = _getsdn(optarg, &optarg, 0);
- if (errno == EINVAL) {
- LP_ERRMSG (ERROR, E_LP_BADSCALE);
- done (1);
- }
- }
- *modp++ = 'M';
-
- } else if (STRNEQU(optarg, "stty=", 5)) {
-
- optarg += 5;
- if (!*optarg)
- stty_opt = 0;
-
- else {
- if (strchr(LP_QUOTES, *optarg)) {
- register int len
- = strlen(optarg);
-
- if (optarg[len - 1] == *optarg)
- optarg[len - 1] = 0;
- optarg++;
- }
- if (stty_opt)
- REALLOC (stty_opt);
- else
- MALLOC (stty_opt);
- }
- *modp++ = 's';
-
- } else if (STREQU(optarg, "filebreak")) {
- filebreak = 1;
-
- } else if (STREQU(optarg, "nofilebreak")) {
- filebreak = 0;
-
- /* added support for using -o to pass any key=value pair */
- } else if (*optarg) {
-
- if ((addlist(&o_options, optarg)) != 0) {
- fprintf(stderr, gettext("System Error %d\n"), errno);
- }
-
- *modp++ = 'o';
- optarg++;
- }
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/output.c b/usr/src/cmd/lp/cmd/lpadmin/output.c
deleted file mode 100644
index 269c6712a9..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/output.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-
-#include "stdio.h"
-#include "string.h"
-#include "sys/types.h"
-
-#include "lp.h"
-#include "printers.h"
-#include "msgs.h"
-#include "requests.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-
-/**
- ** output() - (MISNOMER) HANDLE MESSAGES BACK FROM SPOOLER
- **/
-
-int output (type)
- int type;
-{
- char buffer[MSGMAX];
-
- int rc;
-
- short status;
- char *dummy;
-
-
- if (!scheduler_active)
- switch (type) {
-
- case R_MOUNT_TRAY:
- case R_UNMOUNT_TRAY:
- case R_MOUNT:
- case R_UNMOUNT:
- case R_MAX_TRAYS:
- case R_QUIET_ALERT:
- case R_INQUIRE_PRINTER_STATUS:
- case R_ALLOC_FILES:
- case R_PRINT_REQUEST:
- case R_REJECT_DEST:
- case R_ACCEPT_DEST:
- case R_DISABLE_DEST:
- case R_ENABLE_DEST:
- case R_CANCEL_REQUEST:
- default:
- LP_ERRMSG (ERROR, E_LP_NEEDSCHED);
- done (1);
-
- case R_UNLOAD_PRINTER:
- case R_UNLOAD_CLASS:
- case R_UNLOAD_PRINTWHEEL:
- if (anyrequests()) {
- LP_ERRMSG (ERROR, E_LP_HAVEREQS);
- done (1);
- }
- /* fall through */
-
- case R_LOAD_PRINTER:
- case R_LOAD_CLASS:
- case R_LOAD_PRINTWHEEL:
- return (MOK);
-
- }
-
- status = MOKMORE;
- while (status == MOKMORE) {
-
- if ((rc = mrecv(buffer, MSGMAX)) != type) {
- LP_ERRMSG (ERROR, E_LP_MRECV);
- done (1);
- }
-
- switch(type) {
-
- case R_MOUNT_TRAY:
- case R_UNMOUNT_TRAY:
- case R_MOUNT:
- case R_UNMOUNT:
- case R_MAX_TRAYS:
- case R_LOAD_PRINTER:
- case R_UNLOAD_PRINTER:
- case R_LOAD_CLASS:
- case R_UNLOAD_CLASS:
- case R_LOAD_PRINTWHEEL:
- case R_UNLOAD_PRINTWHEEL:
- case R_QUIET_ALERT:
- case R_REJECT_DEST:
- case R_ACCEPT_DEST:
- case R_ENABLE_DEST:
- case R_CANCEL_REQUEST:
- rc = getmessage(buffer, type, &status);
- goto CheckRC;
-
- case R_DISABLE_DEST:
- rc = getmessage(buffer, type, &status, &dummy);
-CheckRC: if (rc != type) {
- LP_ERRMSG1 (ERROR, E_LP_BADREPLY, rc);
- done (1);
- }
- break;
-
- case R_INQUIRE_PRINTER_STATUS:
- case R_ALLOC_FILES:
- case R_PRINT_REQUEST:
- return (0); /* handled by caller */
- }
-
- }
-
- return (status);
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/pick_opts.c b/usr/src/cmd/lp/cmd/lpadmin/pick_opts.c
deleted file mode 100644
index a4c56dbd70..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/pick_opts.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <libintl.h>
-
-#include "lp.h"
-#include "class.h"
-#include "printers.h"
-#include "msgs.h"
-
-char **
-pick_opts(char * infile_opts, char ** new_opts)
-{
- char * flasts = NULL;
- char * old_opt;
- char ** final_opts = NULL;
- int key_len;
- int keyfound = 0;
- char ** head;
-
- if (infile_opts == NULL || new_opts == NULL) {
- (void) printf("lpadmin error: Cannot process -o options");
- return (NULL);
- }
-
- head = new_opts;
- for (; *new_opts != NULL; new_opts++) {
- if (strlen(*new_opts) > (strcspn(*new_opts, "=") + 1)) {
- if ((addlist(&final_opts, *new_opts)) != 0) {
- fprintf(stderr,
- gettext("lpadmin: System Error %d\n"),
- errno);
-
- return (NULL);
- }
- }
- }
- /*
- * For each currently set option, ie, those already in the file,
- * compare to new list from lpadmin (new_opts).
- */
- for (old_opt = strtok_r(infile_opts, LP_SEP, &flasts);
- old_opt != NULL; old_opt = strtok_r(NULL, LP_SEP, &flasts)) {
-
- keyfound = 0;
-
- for (new_opts = head; *new_opts != NULL; new_opts++) {
-
- key_len = strcspn(*new_opts, "=");
- /*
- * if the keys match, and the the key from the
- * lpadmin -o has a value, take the new value from
- * lpadmin
- */
- if ((strncmp(old_opt, *new_opts, key_len + 1)) == 0) {
- keyfound++;
- }
- }
- if (keyfound == 0) {
- if ((addlist(&final_opts, old_opt)) != 0) {
- fprintf(stderr,
- gettext("lpadmin: System Error %d\n"),
- errno);
-
- return (NULL);
- }
- }
-
- }
-
- return (final_opts);
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/rmdest.c b/usr/src/cmd/lp/cmd/lpadmin/rmdest.c
deleted file mode 100644
index 35ff27d364..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/rmdest.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#include "stdio.h"
-#include "ctype.h"
-#include "errno.h"
-#include "sys/types.h"
-
-#include "lp.h"
-#include "msgs.h"
-#include "access.h"
-#include "class.h"
-#include "printers.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-extern void fromallclasses();
-
-/**
- ** rmdest() - REMOVE DESTINATION
- **/
-
-void rmdest (aclass, dest)
- int aclass;
- char *dest;
-{
- int rc,
- type;
-
-
- if (!aclass)
- type = S_UNLOAD_PRINTER;
- else
- type = S_UNLOAD_CLASS;
-
-
- send_message(type, dest, "", "");
- rc = output(type + 1);
-
- switch (rc) {
- case MOK:
- case MNODEST:
- BEGIN_CRITICAL
- if (
- aclass && delclass(dest) == -1
- || !aclass && delprinter(dest) == -1
- ) {
- if (rc == MNODEST && errno == ENOENT)
- LP_ERRMSG1 (
- ERROR,
- E_ADM_NODEST,
- dest
- );
-
- else
- LP_ERRMSG2 (
- ERROR,
-(rc == MNODEST? (aclass? E_LP_DELCLASS : E_LP_DELPRINTER) : E_ADM_DELSTRANGE),
- dest,
- PERROR
- );
-
- done(1);
- }
- END_CRITICAL
-
- /*
- * S_UNLOAD_PRINTER tells the Spooler to remove
- * the printer from all classes (in its internal
- * tables, of course). So it's okay for us to do
- * the same with the disk copies.
- */
- if (!aclass)
- fromallclasses (dest);
-
- if (STREQU(getdflt(), dest))
- newdflt (NAME_NONE);
-
- if (system_labeled) {
- update_dev_dbs(dest, NULL, "REMOVE");
- }
- break;
-
- case MBUSY:
- LP_ERRMSG1 (ERROR, E_ADM_DESTBUSY, dest);
- done (1);
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, rc);
- done (1);
- break;
-
- }
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/send_message.c b/usr/src/cmd/lp/cmd/lpadmin/send_message.c
deleted file mode 100644
index b7cf7f366e..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/send_message.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-
-#include "stdio.h"
-
-#if defined(__STDC__)
-#include "stdarg.h"
-#else
-#include "varargs.h"
-#endif
-
-#include "msgs.h"
-
-#define WHO_AM_I I_AM_LPADMIN
-#include "oam.h"
-
-#include "lpadmin.h"
-
-
-/**
- ** send_message() - HANDLE MESSAGE SENDING TO SPOOLER
- **/
-
-/*VARARGS1*/
-
-void
-#if defined(__STDC__)
-send_message (
- int type,
- ...
-)
-#else
-send_message (type, va_alist)
- int type;
- va_dcl
-#endif
-{
- va_list ap;
-
- int n;
-
- char msgbuf[MSGMAX];
-
-
- if (!scheduler_active)
- return;
-
-#if defined(__STDC__)
- va_start (ap, type);
-#else
- va_start (ap);
-#endif
-
- (void)_putmessage (msgbuf, type, ap);
-
- va_end (ap);
-
- if (msend(msgbuf) == -1) {
- LP_ERRMSG (ERROR, E_LP_MSEND);
- done(1);
- }
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/signals.c b/usr/src/cmd/lp/cmd/lpadmin/signals.c
deleted file mode 100644
index 4cebf21564..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/signals.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include "signal.h"
-
-#include "lpadmin.h"
-
-static int trapping = -1; /* -1 means first time */
-
-static
-#ifdef SIGPOLL
- void
-#else
- int
-#endif
- (*old_sighup)(),
- (*old_sigint)(),
- (*old_sigquit)(),
- (*old_sigterm)();
-
-/**
- ** catch() - CLEAN UP AFTER SIGNAL
- **/
-
-static void
-catch (sig)
-{
- (void)signal (SIGHUP, SIG_IGN);
- (void)signal (SIGINT, SIG_IGN);
- (void)signal (SIGQUIT, SIG_IGN);
- (void)signal (SIGTERM, SIG_IGN);
- done (1);
-}
-
-/**
- ** trap_signals() - SET SIGNALS TO BE CAUGHT FOR CLEAN EXIT
- **/
-
-void trap_signals ()
-{
- switch (trapping) {
-
- case -1: /* first time */
-
-#define SETSIG(SIG) \
- if (signal(SIG, SIG_IGN) != SIG_IGN) \
- signal (SIG, catch);
-
- SETSIG (SIGHUP);
- SETSIG (SIGINT);
- SETSIG (SIGQUIT);
- SETSIG (SIGTERM);
- break;
-
- case 0: /* currently ignoring */
- signal (SIGHUP, old_sighup);
- signal (SIGINT, old_sigint);
- signal (SIGQUIT, old_sigquit);
- signal (SIGTERM, old_sigterm);
- trapping = 1;
- break;
-
- case 1: /* already trapping */
- break;
-
- }
- return;
-}
-
-/**
- ** ignore_signals() - SET SIGNALS TO BE IGNORED FOR CRITICAL SECTIONS
- **/
-
-void ignore_signals ()
-{
- switch (trapping) {
-
- case -1: /* first time */
- trap_signals ();
- /*fall through*/
-
- case 1: /* currently trapping */
- old_sighup = signal(SIGHUP, SIG_IGN);
- old_sigint = signal(SIGINT, SIG_IGN);
- old_sigquit = signal(SIGQUIT, SIG_IGN);
- old_sigterm = signal(SIGTERM, SIG_IGN);
- trapping = 0;
- break;
-
- case 0: /* already ignoring */
- break;
-
- }
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/startup.c b/usr/src/cmd/lp/cmd/lpadmin/startup.c
deleted file mode 100644
index 2c2fb76974..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/startup.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#include "stdio.h"
-
-#include "lp.h"
-#include "msgs.h"
-
-#include "lpadmin.h"
-
-
-/**
- ** startup() - OPEN CHANNEL TO SPOOLER
- **/
-
-void startup ()
-{
- trap_signals ();
-
- if (mopen() == -1)
- scheduler_active = 0;
- else
- scheduler_active = 1;
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpadmin/usage.c b/usr/src/cmd/lp/cmd/lpadmin/usage.c
deleted file mode 100644
index dc0f0bdbdf..0000000000
--- a/usr/src/cmd/lp/cmd/lpadmin/usage.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-
-#include "lp.h"
-#include "printers.h"
-#include <locale.h>
-
-/**
- ** usage() - PRINT COMMAND USAGE
- **/
-
-void usage ()
-{
-#if defined(CAN_DO_MODULES)
- (void) printf (gettext(
-"usage:\n"
-"\n"
-" (add printer)\n\n"
-" lpadmin -p printer {-v device | -U dial-info | -s system[!printer]} [options]\n"
-" [-s system[!printer]] (remote system/printer name)\n"
-" [-v device] (printer port name)\n"
-" [-U dial-info] (phone # or sys. name)\n"
-" [-T type-list] (printer types)\n"
-" [-c class | -r class] (add to/del from class)\n"
-" [-A mail|write|quiet|showfault|cmd [-W interval]]\n"
-" (alert definition)\n"
-" [-A none] (no alerts)\n"
-" [-A list] (examine alert)\n"
-" [-D comment] (printer description)\n"
-" [-e printer | -i interface | -m model] (interface program)\n"
-" [-l | -h] (is/isn't login tty)\n"
-" [-f allow:forms-list | deny:forms-list] (forms allowed)\n"
-" [-u allow:user-list | deny:user-list] (who's allowed to use)\n"
-" [-S char-set-maps | print-wheels] (list of avail. fonts)\n"
-" [-I content-type-list] (file types accepted\n"
-" [-F beginning|continue|wait] (fault recovery)\n"
-" [-o stty='stty-options'] (port characteristics)\n"
-" [-o cpi=scaled-number] (character pitch)\n"
-" [-o lpi=scaled-number] (line pitch)\n"
-" [-o width=scaled-number] (page width)\n"
-" [-o length=scaled-number] (page length)\n"
-" [-o nobanner] (allow no banner)\n\n"
-" [-P paper-list] (add paper type)\n"
-" [-P ~paper-list] (remove paper type)\n"
-" [-t number-of-trays] (number of paper trays)\n"
-" [-H module,...|keep|default|none] (STREAMS modules to push)\n\n"
-" (delete printer or class)\n"
-" lpadmin -x printer-or-class\n\n"
-" (define default destination)\n"
-" lpadmin -d printer-or-class\n\n"
-" (mount form, printwheel)\n"
-" lpadmin -p printer -M {options}\n"
-" [-f form [-a [-o filebreak]] [-t tray-number]]\n"
-" (mount (align) form (on tray))\n"
-" [-S print-wheel] (mount print wheel)\n\n"
-" (define print-wheel mount alert)\n"
-" lpadmin -S print-wheel {options}\n"
-" [-A mail|write|quiet|cmd [-W interval] [-Q queue-size]]\n"
-" [-A none] (no alerts)\n"
-" [-A list] (examine alert)\n "));
-#else
- (void) printf (gettext(
-"usage:\n"
-"\n"
-" (add printer)\n\n"
-" lpadmin -p printer {-v device | -U dial-info | -s system[!printer]} [options]\n"
-" [-s system[!printer]] (remote system/printer name)\n"
-" [-v device] (printer port name)\n"
-" [-U dial-info] (phone # or sys. name)\n"
-" [-T type-list] (printer types)\n"
-" [-c class | -r class] (add to/del from class)\n"
-" [-A mail|write|quiet|showfault|cmd [-W interval]]\n"
-" (alert definition)\n"
-" [-A none] (no alerts)\n"
-" [-A list] (examine alert)\n"
-" [-D comment] (printer description)\n"
-" [-e printer | -i interface | -m model] (interface program)\n"
-" [-l | -h] (is/isn't login tty)\n"
-" [-f allow:forms-list | deny:forms-list] (forms allowed)\n"
-" [-u allow:user-list | deny:user-list] (who's allowed to use)\n"
-" [-S char-set-maps | print-wheels] (list of avail. fonts)\n"
-" [-I content-type-list] (file types accepted\n"
-" [-F beginning|continue|wait] (fault recovery)\n"
-" [-o stty='stty-options'] (port characteristics)\n"
-" [-o cpi=scaled-number] (character pitch)\n"
-" [-o lpi=scaled-number] (line pitch)\n"
-" [-o width=scaled-number] (page width)\n"
-" [-o length=scaled-number] (page length)\n"
-" [-o nobanner] (allow no banner)\n\n"
-" [-P paper-list] (add paper type)\n"
-" [-P ~paper-list] (remove paper type)\n"
-" [-t number-of-trays] (number of paper trays)\n"
-" (delete printer or class)\n"
-" lpadmin -x printer-or-class\n\n"
-" (define default destination)\n"
-" lpadmin -d printer-or-class\n\n"
-" (mount form, printwheel)\n"
-" lpadmin -p printer -M {options}\n"
-" [-f form [-a [-o filebreak]] [-t tray-number]]\n"
-" (mount (align) form (on tray))\n"
-" [-S print-wheel] (mount print wheel)\n\n"
-" (define print-wheel mount alert)\n"
-" lpadmin -S print-wheel {options}\n"
-" [-A mail|write|quiet|cmd [-W interval] [-Q queue-size]]\n"
-" [-A none] (no alerts)\n"
-" [-A list] (examine alert)\n "));
-#endif
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpfilter.c b/usr/src/cmd/lp/cmd/lpfilter.c
deleted file mode 100644
index 257523ff86..0000000000
--- a/usr/src/cmd/lp/cmd/lpfilter.c
+++ /dev/null
@@ -1,916 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <locale.h>
-
-#include "lp.h"
-#include "access.h"
-#include "filters.h"
-#include "msgs.h"
-
-#define WHO_AM_I I_AM_LPFILTER
-#include "oam.h"
-
-#define OPT_LIST "f:F:ixl"
-
-int add_filter(),
- reload_filter(),
- delete_filter(),
- list_filter();
-
-static void alert_spooler(),
- same_complaints();
-
-static char *opt();
-
-/*
- * Unfortunately, the LP requirements show the listing of a filter
- * to be in a different order than the stored filter table. We can't
- * change the stored version because it's the same as UNISON uses.
- * So, we can't reuse the "FL_..." #defines found in "filters.h".
- * But the following have similar use.
- */
-#define FL_MAX_P FL_MAX
-# define FL_IGN_P 8
-# define FL_PTYPS_P 2
-# define FL_PRTRS_P 3
-# define FL_ITYPS_P 0
-# define FL_NAME_P 7
-# define FL_OTYPS_P 1
-# define FL_TYPE_P 4
-# define FL_CMD_P 5
-# define FL_TMPS_P 6
-
-#define TABLE 0
-#define TABLE_I 1
-
-static struct headings {
- char *v;
- short len;
-} headings[FL_MAX_P] = {
-
-#define ENTRY(X) X, sizeof(X)-1
- ENTRY("Input types:"),
- ENTRY("Output types:"),
- ENTRY("Printer types:"),
- ENTRY("Printers:"),
- ENTRY("Filter type:"),
- ENTRY("Command:"),
- ENTRY("Options:"),
- ENTRY(""),
- ENTRY("")
-#undef ENTRY
-
-};
-
-/**
- ** usage()
- **/
-
-void usage ()
-{
- (void) printf (gettext(
-"usage:\n"
-"\n"
-" (add or change filter)\n"
-" lpfilter -f filter-name {-F path-name | -}\n"
-"\n"
-" (restore delivered filter)\n"
-" lpfilter -f filter-name -i\n"
-"\n"
-" (list a filter)\n"
-" lpfilter -f filter-name -l\n"
-"\n"
-" (list all filters)\n"
-" lpfilter -f \"all\" -l\n"
-"\n"
-" (delete filter)\n"
-" lpfilter -f filter-name -x\n"));
-
- return;
-}
-
-/**
- ** main()
- **/
-
-int main (argc, argv)
- int argc;
- char *argv[];
-{
- extern int optind,
- opterr,
- optopt,
- getopt();
-
- extern char *optarg;
-
- int c,
- (*action)(),
- (*newaction)();
-
- FILE *input;
-
- char *filter,
- *p;
- char stroptsw[] = "-X";
-
-
- (void) setlocale (LC_ALL, "");
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- if (!is_user_admin()) {
- LP_ERRMSG (ERROR, E_LP_NOTADM);
- exit (1);
- }
-
- action = 0;
- input = 0;
- filter = 0;
-
- opterr = 0;
-
- while ((c = getopt(argc, argv, OPT_LIST)) != -1) switch (c) {
-
- case 'f':
- if (filter)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'f');
- filter = optarg;
- if (
- STREQU(NAME_ANY, filter)
- || STREQU(NAME_NONE, filter)
- ) {
- LP_ERRMSG (ERROR, E_LP_ANYNONE);
- exit (1);
- } else if (!syn_name(filter)) {
- LP_ERRMSG1 (ERROR, E_LP_NOTNAME, filter);
- exit (1);
- } else if (!*filter)
- filter = NAME_ALL;
- break;
-
- case 'F':
- if (input)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'F');
- if (!(input = fopen(optarg, "r"))) {
- LP_ERRMSG1 (ERROR, E_FL_OPEN, optarg);
- exit (1);
- }
- newaction = add_filter;
- goto Check;
-
- case 'i':
- newaction = reload_filter;
- goto Check;
-
- case 'x':
- newaction = delete_filter;
- goto Check;
-
- case 'l':
- newaction = list_filter;
-Check: if (action && newaction != action) {
- LP_ERRMSG2 (
- ERROR,
- E_LP_AMBIG,
- opt(action),
- opt(newaction)
- );
- exit (1);
- }
- action = newaction;
- break;
-
- default:
- if (optopt == '?') {
- usage ();
- exit (0);
- }
- stroptsw[1] = optopt;
- if (strchr(OPT_LIST, optopt))
- LP_ERRMSG1 (ERROR, E_LP_OPTARG, stroptsw);
- else
- LP_ERRMSG1 (ERROR, E_LP_OPTION, stroptsw);
- exit (1);
-
- }
-
- if (optind < argc && STREQU(argv[optind], "-"))
- if (action) {
- LP_ERRMSG2 (ERROR, E_LP_AMBIG, opt(action), "-");
- exit (1);
- } else {
- action = add_filter;
- optind++;
- }
-
- if (!filter) {
- LP_ERRMSG (ERROR, E_FL_NOFILT);
- exit (1);
- }
-
- if (!action) {
- LP_ERRMSG (ERROR, E_FL_NOACT);
- exit (1);
- }
-
- if (optind < argc)
- LP_ERRMSG1 (WARNING, E_FL_IGNORE, argv[optind]);
-
- return ((*action)(filter, input));
-}
-
-/**
- ** add_filter()
- **/
-
-int add_filter (filter, input)
- char *filter;
- FILE *input;
-{
- register FILTER *pf,
- *store,
- *ps;
-
- register int fld;
-
- register char *p;
-
- char buf[3 * BUFSIZ],
- *file;
-
- int line,
- bad_headings,
- real_fields[FL_MAX],
- at_least_one,
- ret;
-
- FILTER flbuf;
-
-
- /*
- * First we read in the input and parse it into a filter,
- * storing it in the filter buffer "flbuf". Keep track of
- * which fields have been given, to avoid overwriting unchanged
- * fields later.
- */
-
- if (!input)
- input = stdin;
-
- for (fld = 0; fld < FL_MAX; fld++)
- real_fields[fld] = 0;
- flbuf.templates = 0;
-
- line = bad_headings = 0;
- while (fgets(buf, sizeof(buf), input) != NULL) {
-
- buf[strlen(buf) - 1] = 0;
-
- line++;
-
- p = buf + strspn(buf, " \t");
- if (!*p || *p == '#')
- continue;
-
- for (fld = 0; fld < FL_MAX; fld++)
- if (
- headings[fld].v
- && headings[fld].len
- && CS_STRNEQU(
- p,
- headings[fld].v,
- headings[fld].len
- )
- ) {
- real_fields[fld] = 1;
- p += headings[fld].len + 1;
- break;
- }
-
- if (fld >= FL_MAX) {
-
- if (bad_headings++ >= 5) {
- LP_ERRMSG (ERROR, E_FL_GARBAGE);
- return (1);
- }
- LP_ERRMSG1 (WARNING, E_FL_HEADING, line);
-
- } else switch (fld) {
-
- case FL_IGN_P:
- case FL_NAME_P:
- break;
- case FL_CMD_P:
- flbuf.command = strdup(strip(p));
- break;
- case FL_TYPE_P:
- flbuf.type = s_to_filtertype(strip(p));
- break;
- case FL_PTYPS_P:
- flbuf.printer_types = getlist(p, LP_WS, LP_SEP);
- break;
- case FL_ITYPS_P:
- flbuf.input_types = getlist(p, LP_WS, LP_SEP);
- break;
- case FL_OTYPS_P:
- flbuf.output_types = getlist(p, LP_WS, LP_SEP);
- break;
- case FL_PRTRS_P:
- flbuf.printers = getlist(p, LP_WS, LP_SEP);
- break;
- case FL_TMPS_P:
- if (flbuf.templates) {
- char **temp;
-
- temp = getlist(p, "", LP_SEP);
- mergelist (&(flbuf.templates), temp);
- freelist (temp);
- } else
- flbuf.templates = getlist(p, "", LP_SEP);
- break;
-
- }
-
- }
- if (ferror(input)) {
- LP_ERRMSG (ERROR, E_FL_READ);
- return (1);
- }
-
- /*
- * We have the input stored, now get the current copy of the
- * filter(s). If no filter exists, we create it.
- */
-
- if (STREQU(NAME_ALL, filter)) {
-
- /*
- * Adding ``all'' means changing all filters to reflect
- * the information in the input. We'll preload the
- * filters so that we know how many there are.
- */
- if (
- !(file = getfilterfile(FILTERTABLE))
- || loadfilters(file) == -1
- ) {
- switch (errno) {
- case ENOENT:
- LP_ERRMSG (ERROR, E_FL_NOTALL);
- break;
- default:
- same_complaints (FILTERTABLE, TABLE);
- break;
- }
- return (1);
- }
-
- store = (FILTER *)malloc((nfilters + 1) * sizeof(FILTER));
- if (!store) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- return (1);
- }
-
- for (ps = store; (pf = getfilter(filter)); )
- *ps++ = *pf;
- ps->name = 0;
-
- switch (errno) {
- case ENOENT:
- if (ps - store != nfilters) {
- LP_ERRMSG1 (
- ERROR,
- E_FL_STRANGE,
- getfilterfile(FILTERTABLE)
- );
- return (1);
- }
- break;
- default:
- same_complaints (FILTERTABLE, TABLE);
- return (1);
- }
-
- } else {
-
- store = (FILTER *)malloc(2 * sizeof(FILTER));
- if (!store) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- return (1);
- }
-
- if ((pf = getfilter(filter))) {
- store[0] = *pf;
- } else
- switch (errno) {
- case ENOENT:
- /*
- * We must be adding a new filter, so
- * set up default values. Check that
- * we'll have something reasonable to add.
- */
- pf = store;
- pf->name = strdup(filter);
- pf->command = 0;
- pf->type = fl_slow;
- pf->printer_types = 0;
- pf->printers = 0;
- pf->input_types = 0;
- pf->output_types = 0;
- pf->templates = 0;
- if (!flbuf.command) {
- LP_ERRMSG (ERROR, E_FL_NOCMD);
- return (1);
- }
- break;
- default:
- same_complaints (FILTERTABLE, TABLE);
- return (1);
- }
-
- store[1].name = 0;
-
- }
-
- at_least_one = ret = 0;
- for (ps = store; ps->name; ps++) {
-
- for (fld = 0; fld < FL_MAX; fld++)
- if (real_fields[fld]) switch(fld) {
- case FL_IGN_P:
- case FL_NAME_P:
- break;
- case FL_CMD_P:
- ps->command = flbuf.command;
- break;
- case FL_TYPE_P:
- ps->type = flbuf.type;
- break;
- case FL_PTYPS_P:
- ps->printer_types = flbuf.printer_types;
- break;
- case FL_ITYPS_P:
- ps->input_types = flbuf.input_types;
- break;
- case FL_OTYPS_P:
- ps->output_types = flbuf.output_types;
- break;
- case FL_PRTRS_P:
- ps->printers = flbuf.printers;
- break;
- case FL_TMPS_P:
- ps->templates = flbuf.templates;
- break;
- }
-
- if (putfilter(ps->name, ps) == -1) {
- if (errno == EBADF) switch (lp_errno) {
- case LP_ETEMPLATE:
- LP_ERRMSG (ERROR, E_FL_BADTEMPLATE);
- break;
- case LP_EKEYWORD:
- LP_ERRMSG (ERROR, E_FL_BADKEY);
- break;
- case LP_EPATTERN:
- LP_ERRMSG (ERROR, E_FL_BADPATT);
- break;
- case LP_EREGEX:
- {
- char * why;
-
- extern int regerrno;
-
-
- switch (regerrno) {
- case 11:
- why = "range endpoint too large";
- break;
- case 16:
- why = "bad number";
- break;
- case 25:
- why = "\"\\digit\" out of range";
- break;
- case 36:
- why = "illegal or missing delimiter";
- break;
- case 41:
- why = "no remembered search string";
- break;
- case 42:
- why = "\\(...\\) imbalance";
- break;
- case 43:
- why = "too many \\(";
- break;
- case 44:
- why = "more than 2 numbers given in \\{...\\}";
- break;
- case 45:
- why = "} expected after \\";
- break;
- case 46:
- why = "first number exceeds second in \\{...\\}";
- break;
- case 49:
- why = "[...] imbalance";
- break;
- case 50:
- why = "regular expression overflow";
- break;
- }
- LP_ERRMSG1 (ERROR, E_FL_BADREGEX, why);
- break;
- }
- case LP_ERESULT:
- LP_ERRMSG (ERROR, E_FL_BADRESULT);
- break;
- case LP_ENOMEM:
- errno = ENOMEM;
- same_complaints (FILTERTABLE, TABLE);
- break;
- } else
- same_complaints (FILTERTABLE, TABLE);
- ret = 1;
- break;
- } else
- at_least_one = 1;
-
- }
-
- if (at_least_one)
- (void)alert_spooler ();
-
- return (ret);
-}
-
-/**
- ** reload_filter()
- **/
-
-int reload_filter (filter)
- char *filter;
-{
- register FILTER *pf,
- *store,
- *ps;
-
- char *factory_file;
-
- int ret,
- at_least_one;
-
- /*
- * ``Manually'' load the archived filters, so that a call
- * to "getfilter()" will read from them instead of the regular
- * table.
- */
- if (
- !(factory_file = getfilterfile(FILTERTABLE_I))
- || loadfilters(factory_file) == -1
- ) {
- switch (errno) {
- case ENOENT:
- LP_ERRMSG (ERROR, E_FL_NOFACTY);
- break;
- default:
- same_complaints (FILTERTABLE_I, TABLE_I);
- break;
- }
- return (1);
- }
-
- if (STREQU(NAME_ALL, filter)) {
-
- store = (FILTER *)malloc((nfilters + 1) * sizeof(FILTER));
- if (!store) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- return (1);
- }
-
- for (ps = store; (pf = getfilter(filter)); )
- *ps++ = *pf;
- ps->name = 0;
-
- switch (errno) {
- case ENOENT:
- if (ps - store != nfilters) {
- LP_ERRMSG1 (
- ERROR,
- E_FL_STRANGE,
- getfilterfile(FILTERTABLE_I)
- );
- return (1);
- }
- break;
- default:
- same_complaints (FILTERTABLE_I, TABLE_I);
- return (1);
- }
-
- } else {
-
- store = (FILTER *)malloc(2 * sizeof(FILTER));
- if (!store) {
- LP_ERRMSG (ERROR, E_LP_MALLOC);
- return (1);
- }
-
- if (!(pf = getfilter(filter))) switch (errno) {
- case ENOENT:
- LP_ERRMSG (ERROR, E_FL_FACTYNM);
- return (1);
- default:
- same_complaints (FILTERTABLE_I, TABLE_I);
- return (1);
- }
-
- store[0] = *pf;
- store[1].name = 0;
-
- }
-
- /*
- * Having stored the archived filter(s) in our own area, clear
- * the currently loaded table so that the subsequent calls to
- * "putfilter()" will read in the regular table.
- */
- trash_filters ();
-
- at_least_one = ret = 0;
- for (ps = store; ps->name; ps++)
- if (putfilter(ps->name, ps) == -1) {
- same_complaints (FILTERTABLE, TABLE);
- ret = 1;
- break;
- } else
- at_least_one = 1;
-
- if (at_least_one)
- (void)alert_spooler ();
-
- return (ret);
-}
-
-/**
- ** delete_filter()
- **/
-
-int delete_filter (filter)
- char *filter;
-{
- if (delfilter(filter) == -1) switch (errno) {
- case ENOENT:
- LP_ERRMSG1 (ERROR, E_FL_UNKFILT, filter);
- return (1);
- default:
- same_complaints (FILTERTABLE, TABLE);
- return (1);
- }
-
- (void)alert_spooler ();
-
- return (0);
-}
-
-/**
- ** list_filter()
- **/
-
-static void _list_filter();
-
-int list_filter (filter)
- char *filter;
-{
- register FILTER *pf;
-
- char *nl;
-
- if (STREQU(NAME_ALL, filter)) {
-
- nl = "";
- while ((pf = getfilter(filter))) {
- printf (gettext("%s(Filter \"%s\")\n"), nl, pf->name);
- _list_filter (pf);
- nl = "\n";
- }
-
- switch (errno) {
- case ENOENT:
- return (0);
- default:
- same_complaints (FILTERTABLE, TABLE);
- return (1);
- }
-
- } else {
-
- if ((pf = getfilter(filter))) {
- _list_filter (pf);
- return (0);
- }
-
- switch (errno) {
- case ENOENT:
- LP_ERRMSG1 (ERROR, E_FL_UNKFILT, filter);
- return (1);
- default:
- same_complaints (FILTERTABLE, TABLE);
- return (1);
- }
-
- }
-}
-
-static void _list_filter (pf)
- register FILTER *pf;
-{
- register char **pp,
- *sep;
-
- register int fld;
-
- char * head;
-
-
- for (fld = 0; fld < FL_MAX_P; fld++) switch (fld) {
- case FL_IGN_P:
- case FL_NAME_P:
- break;
- case FL_CMD_P:
- printf (
- "%s %s\n",
- headings[fld].v,
- (pf->command? pf->command : "")
- );
- break;
- case FL_TYPE_P:
- printf (
- "%s %s\n",
- headings[fld].v,
- (pf->type == fl_fast? FL_FAST : FL_SLOW)
- );
- break;
- case FL_PTYPS_P:
- pp = pf->printer_types;
- goto Lists;
- case FL_ITYPS_P:
- pp = pf->input_types;
- goto Lists;
- case FL_OTYPS_P:
- pp = pf->output_types;
- goto Lists;
- case FL_PRTRS_P:
- pp = pf->printers;
-Lists: printlist_qsep = 1;
- printlist_setup ("", "", LP_SEP, "");
- printf ("%s ", headings[fld].v);
- printlist (stdout, pp);
- printf ("\n");
- break;
- case FL_TMPS_P:
- head = makestr(headings[fld].v, " ", (char *)0);
- printlist_qsep = 1;
- printlist_setup (head, "", "\n", "\n");
- printlist (stdout, pf->templates);
- break;
- }
-
- return;
-}
-
-/**
- ** opt() - GENERATE OPTION FROM FUNCTION NAME
- **/
-
-static char *opt (fnc)
- int (*fnc)();
-{
- if (fnc == add_filter)
- return ("-F");
- else if (fnc == reload_filter)
- return ("-i");
- else if (fnc == list_filter)
- return ("-l");
- else if (fnc == delete_filter)
- return ("-x");
- else
- return ("-?");
-}
-
-/**
- ** alert_spooler() - TELL SPOOLER TO LOAD FILTER TABLE
- **/
-
-static void alert_spooler ()
-{
- char msgbuf[MSGMAX];
-
- int mtype;
-
- short status;
-
- /*
- * If the attempt to open a message queue to the
- * Spooler fails, assume it isn't running and just
- * return--don't say anything, `cause the user may
- * know. Any other failure deserves an error message.
- */
-
- if (mopen() == -1)
- return;
-
- (void)putmessage (msgbuf, S_LOAD_FILTER_TABLE);
-
- if (msend(msgbuf) == -1)
- goto Error;
- if (mrecv(msgbuf, MSGMAX) == -1)
- goto Error;
-
- mtype = getmessage(msgbuf, R_LOAD_FILTER_TABLE, &status);
- if (mtype != R_LOAD_FILTER_TABLE) {
- LP_ERRMSG1 (ERROR, E_LP_BADREPLY, mtype);
- (void)mclose ();
- exit (1);
- }
-
- if (status == MOK)
- goto NoError;
-
-Error: LP_ERRMSG (ERROR, E_FL_NOSPLOAD);
-
-NoError:(void)mclose ();
- return;
-
-}
-
-/**
- ** same_complaints() - PRINT COMMON ERROR MESSAGES
- **/
-
-static void same_complaints (table, type)
- char *table;
- int type;
-{
- switch (errno) {
- case EACCES:
- if (type == TABLE)
- LP_ERRMSG1 (
- ERROR,
- E_FL_ACCESS,
- getfilterfile(table)
- );
- else
- LP_ERRMSG1 (
- ERROR,
- E_FL_ACCESSI,
- getfilterfile(table)
- );
- break;
- case EAGAIN:
- case EDEADLK:
- LP_ERRMSG1 (ERROR, E_LP_AGAIN, getfilterfile(table));
- break;
- default:
- LP_ERRMSG2 (
- ERROR,
- E_FL_UNKNOWN,
- getfilterfile(table),
- strerror(errno)
- );
- break;
- }
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpforms.c b/usr/src/cmd/lp/cmd/lpforms.c
deleted file mode 100644
index a421304ad8..0000000000
--- a/usr/src/cmd/lp/cmd/lpforms.c
+++ /dev/null
@@ -1,1438 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include <locale.h>
-#include "stdio.h"
-#include "errno.h"
-#include "string.h"
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "access.h"
-#include "form.h"
-#include "msgs.h"
-
-#define WHO_AM_I I_AM_LPFORMS
-#include "oam.h"
-
-#define OPT_LIST "f:F:xlLA:u:W:Q:P:d"
-
-#define TMPDIR "/usr/tmp"
-
-typedef int (*Action)();
-
-#if defined(__STDC__)
-
-static int add_form ( char * , FILE * , FALERT * , char * );
-static int add_alert ( char * , FILE * , FALERT * , char * );
-static int delete_form ( char * );
-static int list_form ( char * );
-static int list_alert ( char * );
-static int list_both ( char * );
-static int any_alert ( char * , FILE * , FALERT * );
-static int quiet_alert ( char * );
-static int notify_spooler ( int , int , char * );
-static int onerror ( int , int , int );
-
-static Action set_action ( int (*)() , char * );
-
-#else
-
-static int add_form();
-static int add_alert();
-static int delete_form();
-static int list_form();
-static int list_alert();
-static int list_both();
-static int any_alert();
-static int quiet_alert();
-static int notify_spooler();
-static int onerror();
-
-static Action set_action();
-
-#endif
-
-/**
- ** usage()
- **/
-
-void usage ()
-{
- (void) printf (gettext(
-"usage:\n"
-"\n"
-" (add or change form)\n"
-" lpforms -f form-name [options]\n"
-" [-F path-name | - | -P paper [-d] | -d ] (form definition)\n"
-" -F path-name (initialize from file)\n"
-" - (initialize from stdin)\n"
-" -P paper [-d] (initialize with paper (as default))\n"
-" -d (create form with paper of same name)\n"
-" [-u allow:user-list | deny:user-list] (who's allowed to use)\n"
-" [-A mail | write | shell-command] (alert definition)\n"
-" [-Q threshold] (# needed for alert)\n"
-" [-W interval] (minutes between alerts)\n"
-"\n"
-" (list form)\n"
-" lpforms -f form-name -l\n"
-" lpforms -f form-name -L (verbose for -P forms)\n"
-"\n"
-" (delete form)\n"
-" lpforms -f form-name -x\n"
-"\n"
-" (define alert for forms with no alert yet)\n"
-" lpforms -f any -A {mail | write | shell-command}\n"
-"\n"
-" (define alert for all forms)\n"
-" lpforms -f all -A {mail | write | shell-command}\n"
-"\n"
-" (examine alerting)\n"
-" lpforms -f form-name -A list\n"
-"\n"
-" (stop alerting)\n"
-" lpforms -f form-name -A quiet (temporarily)\n"
-" lpforms -f form-name -A none (for good)"
-"\n"
-));
-
- return;
-}
-
-static char *P = NULL;
-static int d = 0;
-static int L = 0;
-/**
- ** main()
- **/
-
-int
-main(int argc, char *argv[])
-{
- extern int optind;
- extern int opterr;
- extern int optopt;
-
- extern char * optarg;
-
- int c;
- int cnt = 0;
-
- char * form = 0;
- char * u = 0;
- char * cp;
- char * rest;
- char stroptsw[] = "-X";
-
- Action action = 0;
-
- FILE *input = 0;
-
- FORM fbuf;
-
- FALERT alert = { (char *)0, -1, -1 };
-
- struct stat statbuf;
-
-
- (void) setlocale (LC_ALL, "");
-
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- if (!is_user_admin()) {
- LP_ERRMSG (ERROR, E_LP_NOTADM);
- exit (1);
- }
-
- opterr = 0;
-
- while ((c = getopt(argc, argv, OPT_LIST)) != -1) {
-
- /*
- * These options take values; "getopt()" passes values
- * that begin with a dash without checking if they're
- * options. If a value is missing, we want to complain
- * about it.
- */
- switch (c) {
- case 'W':
- case 'Q':
- /*
- * These options take numeric values, which might
- * be negative. Negative values are handled later,
- * but here we just screen them.
- */
- (void)strtol (optarg, &rest, 10);
- if (!rest || (!*rest && rest != optarg))
- break;
- /*FALLTHROUGH*/
- case 'f':
- case 'F':
- case 'A':
- case 'u':
- if (!*optarg) {
- stroptsw[1] = c;
- LP_ERRMSG1 (ERROR, E_LP_NULLARG, stroptsw);
- exit (1);
- }
- if (*optarg == '-') {
- stroptsw[1] = c;
- LP_ERRMSG1 (ERROR, E_LP_OPTARG, stroptsw);
- exit (1);
- }
- break;
- }
-
- switch (c) {
-
- case 'f':
- if (form)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'f');
- form = optarg;
- if (!syn_name(form)) {
- LP_ERRMSG1 (ERROR, E_LP_NOTNAME, form);
- exit (1);
- } else if (!*form)
- form = NAME_ALL;
- break;
-
- case 'F':
- if (input)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'F');
- if (!(input = fopen(optarg, "r"))) {
- LP_ERRMSG1 (ERROR, E_FOR_OPEN, optarg);
- exit (1);
- }
- action = set_action(add_form, "-F");
- break;
-
- case 'A':
- if (STREQU(NAME_LIST, optarg))
- action = set_action(list_alert, "\"-A list\"");
-
- else if (STREQU(NAME_QUIET, optarg))
- action = set_action(quiet_alert, "\"-A quiet\"");
-
- else {
- if (STREQU(MAIL, optarg) || STREQU(WRITE, optarg))
- alert.shcmd = makestr(optarg, " ", getname(), (char *)0);
- else
- alert.shcmd = strdup(optarg);
- action = set_action(add_alert, "-A");
- }
- break;
-
- case 'Q':
- if (alert.Q != -1)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'Q');
- if (STREQU(NAME_ANY, optarg))
- alert.Q = 1;
- else {
- alert.Q = strtol(optarg, &rest, 10);
- if (alert.Q < 0) {
- LP_ERRMSG1 (ERROR, E_LP_NEGARG, 'Q');
- exit (1);
- }
- if (rest && *rest) {
- LP_ERRMSG1 (ERROR, E_LP_GARBNMB, 'Q');
- exit (1);
- }
- if (alert.Q == 0) {
- LP_ERRMSG1 (ERROR, E_LP_ZEROARG, 'Q');
- exit (1);
- }
- }
- action = set_action(add_alert, "-Q");
- break;
-
- case 'W':
- if (alert.W != -1)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'W');
- if (STREQU(NAME_ONCE, optarg))
- alert.W = 0;
- else {
- alert.W = strtol(optarg, &rest, 10);
- if (alert.W < 0) {
- LP_ERRMSG1 (ERROR, E_LP_NEGARG, 'W');
- exit (1);
- }
- if (rest && *rest) {
- LP_ERRMSG1 (ERROR, E_LP_GARBNMB, 'W');
- exit (1);
- }
- }
- action = set_action(add_alert, "-W");
- break;
-
- case 'u':
- if (u)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'u');
- u = strdup(optarg);
- action = set_action(add_form, "-u");
- break;
-
- case 'x':
- action = set_action(delete_form, "-x");
- break;
-
- case 'L':
- L = 1;
- action = set_action(list_form, "-L");
- break;
- case 'l':
- action = set_action(list_form, "-l");
- break;
-
- case 'd':
- d = 1;
- action = set_action(add_form, "-d");
- break;
-
- case 'P':
- if (P)
- LP_ERRMSG1 (WARNING, E_LP_2MANY, 'P');
- action = set_action(add_form, "-P");
- P = strdup(optarg);
- break;
-
- default:
- if (optopt == '?') {
- usage ();
- exit (0);
- }
- stroptsw[1] = optopt;
- if (strchr(OPT_LIST, optopt))
- LP_ERRMSG1 (ERROR, E_LP_OPTARG, stroptsw);
- else
- LP_ERRMSG1 (ERROR, E_LP_OPTION, stroptsw);
- exit (1);
-
- }
- }
-
- if (!form) {
- LP_ERRMSG (ERROR, E_FOR_FORMNAME);
- exit (1);
- }
-
- if (STREQU(NAME_ANY, form))
- action = set_action(any_alert, "\"-f any\"");
-
- if (optind < argc && STREQU(argv[optind], "-")) {
- action = set_action(add_form, "-");
- input = stdin;
- optind++;
- }
- if (optind < argc)
- LP_ERRMSG1 (WARNING, E_FOR_EXTRAARG, argv[optind]);
-
- if (!action) {
- LP_ERRMSG (ERROR, E_FOR_NOACT);
- exit (1);
- }
-
- if (action == any_alert && STREQU(alert.shcmd, NAME_NONE)) {
- LP_ERRMSG (WARNING, E_FOR_ANYDEL);
- exit (0);
- }
-
- /*
- * We must have a shell command for the alert if:
- *
- * (1) we're adding a new form and the -W or -Q options
- * have been given, or
- *
- * (2) the -f any option was given.
- */
- if (
- (
- action == add_form
- && !alert.shcmd
- && (alert.Q != -1 || alert.W != -1)
- && !STREQU(NAME_ALL, form)
- && getform(form, &fbuf, (FALERT *)0, (FILE **)0) != 0
- )
- || action == any_alert && !alert.shcmd
- ) {
- LP_ERRMSG (ERROR, E_FOR_NOSHCMDERR);
- return (1);
- }
-
- if (P && (! STREQU(P,form))) {
- while (P && (cnt++ < 2)) {
- /*
- * two times should do it unless user has edited
- * files directly
- */
- if (getform(P, &fbuf, (FALERT *)0, (FILE **)0) != -1) {
- if (!fbuf.paper) {
- LP_ERRMSG3(ERROR, E_FOR_ALSO_SEP_FORM,
- form, P, P);
- return (1);
- } else if (!STREQU(fbuf.paper, P))
- P = Strdup(fbuf.paper);
- else
- break; /* we found a good paper */
- } else {
- int result;
- int saveD;
-
- saveD = d;
- d = 1;
- result = ((*action)(P, NULL, &alert, u));
- d = saveD;
- return (result ? result :
- ((*action)(form, input, &alert, u)));
- }
- }
- }
-
- if (d && !P)
- P = Strdup(form);
-
- return ((*action)(form, input, &alert, u));
-}
-
-/**
- ** add_alert()
- ** add_form()
- **/
-
-/*
- * "add_alert()" exists just to simplify the checking of mixed
- * options in "set_action()".
- */
-
-static int
-#if defined(__STDC__)
-add_alert (
- char * form,
- FILE * input,
- FALERT * p_new_alert,
- char * u
-)
-#else
-add_alert (form, input, new_alert, u)
- char * form;
- FILE * input;
- FALERT * p_new_alert;
- char * u;
-#endif
-{
- return (add_form(form, input, p_new_alert, u));
-}
-
-static int
-#if defined(__STDC__)
-add_form (
- char * form,
- FILE * input,
- FALERT * p_new_alert,
- char * u
-)
-#else
-add_form (form, input, new_alert, u)
- char * form;
- FILE * input;
- FALERT * p_new_alert;
- char * u;
-#endif
-{
- int fld;
- int which_set[FO_MAX];
- int new_form = 0;
- int nform;
- int return_code;
-
- char * all_list[] = { NAME_ALL, 0 };
- char ** u_allow = 0;
- char ** u_deny = 0;
-
- FILE * align_fp = 0;
-
- FORM fbuf;
- FORM new_fbuf;
-
- FALERT alert;
-
-
- /*
- * Read the input configuration (if any) and parse it into a form,
- * storing it in the form buffer "fbuf". Keep track of
- * which fields have been given, to avoid overwriting unchanged
- * fields later.
- */
- if (input) {
- for (fld = 0; fld < FO_MAX; fld++)
- which_set[fld] = 0;
-
- if (rdform(form, &new_fbuf, fileno(input), onerror,
- which_set) == -1) {
- LP_ERRMSG2 (ERROR, E_FOR_UNKNOWN, "(input)", PERROR);
- return (1);
- }
- for (fld = 0; fld < FO_MAX; fld++)
- if (which_set[fld])
- break;
- if (fld >= FO_MAX)
- LP_ERRMSG (WARNING, E_FOR_EMPTYFILE);
-
- /*
- * Read the alignment pattern (if any) into a temporary
- * file so that it can be used for (potentially) many
- * forms.
- */
- if (which_set[FO_ALIGN]) {
-
- size_t n;
-
- char buf[BUFSIZ];
-
-
-
- if ((align_fp = tmpfile()) == NULL) {
- LP_ERRMSG (ERROR, E_FOR_CTMPFILE);
- exit (1);
- }
-
- while ((n = fread(buf, 1, BUFSIZ, input)))
- fwrite (buf, 1, n, align_fp);
- }
- }
-
- /*
- * Parse the user allow/deny list (if any).
- */
- if (u) {
-
- char * cp;
- char * type;
-
-
- type = strtok(u, ":");
- cp = strtok((char *)0, ":");
-
- if (STREQU(type, NAME_ALLOW) && cp) {
- if (!(u_allow = getlist(cp, LP_WS, LP_SEP)))
- LP_ERRMSG1 (
- WARNING,
- E_LP_MISSING,
- NAME_ALLOW
- );
-
- } else if (STREQU(type, NAME_DENY) && cp) {
- if (!(u_deny = getlist(cp, LP_WS, LP_SEP)))
- LP_ERRMSG1 (
- WARNING,
- E_LP_MISSING,
- NAME_DENY
- );
-
- } else {
- LP_ERRMSG (ERROR, E_LP_UALLOWDENY);
- exit (1);
- }
- }
-
- /*
- * The following loop gets either a particular form or
- * all forms (one at a time). The value of "return_code"
- * controls the loop and is also the value to use in the
- * "return()" at the end.
- */
- nform = 0;
- return_code = -1;
- while (return_code == -1) {
-
- /*
- * If we are adding/changing a single form, set
- * the loop control to get us out.
- */
- if (!STREQU(NAME_ALL, form))
- return_code = 0;
-
- nform++;
-
- if (P) {
- memset ((char *)&fbuf, 0, sizeof(FORM));
- fbuf.name = strdup(form);
- fbuf.plen.val = DPLEN;
- fbuf.plen.sc = 0;
- fbuf.pwid.val = DPWIDTH;
- fbuf.pwid.sc = 0;
- fbuf.lpi.val = DLPITCH;
- fbuf.lpi.sc = 0;
- fbuf.cpi.val = DCPITCH;
- fbuf.cpi.sc = 0;
- fbuf.np = DNP;
- fbuf.chset = strdup(DCHSET);
- fbuf.mandatory = 0;
- fbuf.rcolor = strdup(DRCOLOR);
- fbuf.conttype = strdup(DCONTYP);
- fbuf.paper = P;
- fbuf.isDefault = d;
- alert.shcmd = 0;
- alert.W = alert.Q = -1;
- new_form = 1;
-
- } else if (getform(form, &fbuf, &alert, (FILE **)0) == -1)
- switch (errno) {
-
- case ENOENT:
- /*
- * This is a problem only if it occurs
- * immediately on trying to get ``all''.
- */
- if (STREQU(NAME_ALL, form)) {
- if (nform > 1)
- return_code = 0;
- else {
- LP_ERRMSG (ERROR, E_FOR_NOFORMS);
- return_code = 1;
- }
- continue;
- }
-
- /*
- * We're adding a new form,
- * so set up default values.
- */
- memset ((char *)&fbuf, 0, sizeof(FORM));
- fbuf.name = strdup(form);
- fbuf.plen.val = DPLEN;
- fbuf.plen.sc = 0;
- fbuf.pwid.val = DPWIDTH;
- fbuf.pwid.sc = 0;
- fbuf.lpi.val = DLPITCH;
- fbuf.lpi.sc = 0;
- fbuf.cpi.val = DCPITCH;
- fbuf.cpi.sc = 0;
- fbuf.np = DNP;
- fbuf.chset = strdup(DCHSET);
- fbuf.mandatory = 0;
- fbuf.rcolor = strdup(DRCOLOR);
- fbuf.conttype = strdup(DCONTYP);
- alert.shcmd = 0;
- alert.W = alert.Q = -1;
-
- new_form = 1;
- break;
-
- default:
- /*
- * Don't know if we'll have a good name
- * in the "all" case on getting here, so
- * punt on naming the form in the error
- * message.
- */
- LP_ERRMSG2 (ERROR, E_LP_GETFORM, form, PERROR);
- return_code = 1;
- continue;
- }
-
- /*
- * Copy just those items that were given in the input.
- */
- if (!input && new_form && !P) {
- LP_ERRMSG1 (ERROR, E_LP_NOFORM, form);
- return (1);
- }
- if (input)
- for (fld = 0; fld < FO_MAX; fld++)
- if (which_set[fld]) switch(fld) {
-
- case FO_PLEN:
- fbuf.plen = new_fbuf.plen;
- break;
-
- case FO_PWID:
- fbuf.pwid = new_fbuf.pwid;
- break;
-
- case FO_CPI:
- fbuf.cpi = new_fbuf.cpi;
- break;
-
- case FO_LPI:
- fbuf.lpi = new_fbuf.lpi;
- break;
-
- case FO_NP:
- fbuf.np = new_fbuf.np;
- break;
-
- case FO_CHSET:
- fbuf.chset = new_fbuf.chset;
- fbuf.mandatory = new_fbuf.mandatory;
- break;
-
- case FO_RCOLOR:
- fbuf.rcolor = new_fbuf.rcolor;
- break;
-
- case FO_CMT:
- fbuf.comment = new_fbuf.comment;
- break;
-
- case FO_ALIGN:
- fbuf.conttype = new_fbuf.conttype;
- rewind (align_fp);
- break;
-
- case FO_PAPER:
- fbuf.paper = new_fbuf.paper;
- fbuf.isDefault = new_fbuf.isDefault;
- break;
-
- }
-
- /*
- * Set just those alert elements that were given.
- * However, complain about those form(s) that don't have
- * a shell command yet, and none was given, yet -W or -Q
- * were given.
- */
- if (
- !alert.shcmd && !p_new_alert->shcmd
- && (p_new_alert->W != -1 || p_new_alert->Q != -1)
- )
- LP_ERRMSG1 (WARNING, E_FOR_NOSHCMDWARN, fbuf.name);
- else {
- if (p_new_alert->shcmd)
- alert.shcmd = p_new_alert->shcmd;
- if (p_new_alert->Q != -1)
- alert.Q = p_new_alert->Q;
- if (p_new_alert->W != -1)
- alert.W = p_new_alert->W;
- }
-
- /*
- * Create/update the form.
- */
-#define P_FBUF (new_form || input? &fbuf : (FORM *)0)
- if (putform(fbuf.name, P_FBUF, &alert, &align_fp) == -1) {
- LP_ERRMSG2 (ERROR, E_LP_PUTFORM, fbuf.name, PERROR);
- return_code = 1;
- continue;
- }
-
- /*
- * Allow/deny users.
- */
- if (new_form && allow_user_form(all_list, fbuf.name) == -1) {
- LP_ERRMSG1 (ERROR, E_LP_ACCESSINFO, PERROR);
- return_code = 1;
- continue;
- }
- if (u_allow && allow_user_form(u_allow, fbuf.name) == -1) {
- LP_ERRMSG1 (ERROR, E_LP_ACCESSINFO, PERROR);
- return_code = 1;
- continue;
- }
- if (u_deny && deny_user_form(u_deny, fbuf.name) == -1) {
- LP_ERRMSG1 (ERROR, E_LP_ACCESSINFO, PERROR);
- return_code = 1;
- continue;
- }
-
- notify_spooler (S_LOAD_FORM, R_LOAD_FORM, fbuf.name);
-
- }
-
- if (align_fp)
- close_lpfile (align_fp);
-
- return (return_code);
-}
-
-/**
- ** list_form()
- ** list_alert()
- ** list_both()
- **/
-
-#if defined(__STDC__)
-
-static int list ( char * , void (*)() );
-static void _list_form ( FORM * , FALERT * , FILE * );
-static void _list_alert ( FORM * , FALERT * );
-static void _list_both ( FORM * , FALERT * , FILE * );
-
-#else
-
-static int list();
-static void _list_form();
-static void _list_alert();
-static void _list_both();
-
-#endif
-
-static int
-#if defined(__STDC__)
-list_form (
- char *form
-)
-#else
-list_form (form)
- char *form;
-#endif
-{
- return (list(form, _list_form));
-}
-
-static int
-#if defined(__STDC__)
-list_alert (
- char *form
-)
-#else
-list_alert (form)
- char *form;
-#endif
-{
- return (list(form, _list_alert));
-}
-
-static int
-#if defined(__STDC__)
-list_both (
- char *form
-)
-#else
-list_both (form)
- char *form;
-#endif
-{
- return (list(form, _list_both));
-}
-
-static int
-#if defined(__STDC__)
-list (
- char *form,
- void (*subaction)()
-)
-#else
-list (form, subaction)
- char *form;
- void (*subaction)();
-#endif
-{
- FORM fbuf;
-
- FALERT alert;
-
- FILE * align_fp;
-
- char *nl;
-
-
- if (STREQU(NAME_ALL, form)) {
-
- nl = "";
- while (getform(form, &fbuf, &alert, &align_fp) == 0) {
- printf (gettext("%sForm name: %s\n"), nl, fbuf.name);
- (*subaction) (&fbuf, &alert, align_fp);
- nl = "\n";
- }
-
- switch (errno) {
- case ENOENT:
- return (0);
- default:
- /*
- * Don't know if we'll have a good name
- * in the "all" case on getting here, so
- * punt on naming the form in the error
- * message.
- */
- LP_ERRMSG2 (ERROR, E_LP_GETFORM, form, PERROR);
- return (1);
- }
-
- } else {
-
- if (getform(form, &fbuf, &alert, &align_fp) == 0) {
- (*subaction) (&fbuf, &alert, align_fp);
- return (0);
- }
-
- switch (errno) {
- case ENOENT:
- LP_ERRMSG1 (ERROR, E_LP_NOFORM, form);
- return (1);
- default:
- LP_ERRMSG2 (ERROR, E_LP_GETFORM, form, PERROR);
- return (1);
- }
-
- }
-}
-
-/**
- ** _list_form()
- **/
-
-static void
-#if defined(__STDC__)
-_list_form (
- FORM * pf,
- FALERT * palert,
- FILE * align_fp
-)
-#else
-_list_form (pf, palert, align_fp)
- FORM * pf;
- FALERT * palert;
- FILE * align_fp;
-#endif
-{
- size_t n;
-
- char buf[BUFSIZ];
-
- int which_set[FO_MAX];
- int fld,whichVal;
-
-
- whichVal = (pf->paper && (L == 0) ? 0 : 1);
- for (fld = 0; fld < FO_MAX; fld++)
- which_set[fld] = whichVal;
- if (!align_fp)
- which_set[FO_ALIGN] = 0;
- if (pf->paper)
- which_set[FO_PAPER] = 1;
- wrform (pf->name, pf, 1, onerror, which_set);
- if (align_fp)
- while ((n = fread(buf, 1, BUFSIZ, align_fp)))
- write (1, buf, n);
-}
-
-/**
- ** _list_alert()
- **/
-
-static void
-#if defined(__STDC__)
-_list_alert (
- FORM * ignore,
- FALERT * palert
-)
-#else
-_list_alert (ignore, palert)
- FORM * ignore;
- FALERT * palert;
-#endif
-{
- printalert (stdout, palert, 0);
-}
-
-/**
- ** _list_both()
- **/
-
-static void
-#if defined(__STDC__)
-_list_both (
- FORM * pf,
- FALERT * palert,
- FILE * align_fp
-)
-#else
-_list_both (pf, palert, align_fp)
- FORM * pf;
- FALERT * palert;
- FILE * align_fp;
-#endif
-{
- _list_alert (pf, palert);
- _list_form (pf, palert, align_fp);
-}
-
-/**
- ** any_alert()
- **/
-
-static int
-#if defined(__STDC__)
-any_alert (
- char * form,
- FILE * ignore,
- FALERT * p_new_alert
-)
-#else
-any_alert (form, ignore, p_new_alert)
- char * form;
- FILE * ignore;
- FALERT * p_new_alert;
-#endif
-{
- FORM fbuf;
-
- FALERT alert;
-
-
- while (getform(NAME_ALL, &fbuf, &alert, (FILE **)0) == 0)
- if (!alert.shcmd)
- if (putform(fbuf.name, (FORM *)0, p_new_alert, (FILE **)0) == -1) {
- LP_ERRMSG2 (ERROR, E_LP_PUTFORM, fbuf.name, PERROR);
- return (1);
- }
-
- return (0);
-}
-
-/**
- ** delete_form()
- ** quiet_alert()
- **/
-
-#if defined(__STDC__)
-
-static int dq ( char * , int (*)() );
-static int _delete_form ( char * );
-static int _quiet_alert ( char * );
-
-#else
-
-static int dq();
-static int _delete_form();
-static int _quiet_alert();
-
-#endif
-
-static int
-#if defined(__STDC__)
-delete_form (
- char *form
-)
-#else
-delete_form (form)
- char *form;
-#endif
-{
- return (dq(form, _delete_form));
-}
-
-static int
-#if defined(__STDC__)
-quiet_alert (
- char * form
-)
-#else
-quiet_alert (form)
- char * form;
-#endif
-{
- return (dq(form, _quiet_alert));
-}
-
-static int
-#if defined(__STDC__)
-dq (
- char *form,
- int (*subaction)()
-)
-#else
-dq (form, subaction)
- char *form;
- int (*subaction)();
-#endif
-{
- FORM fbuf;
-
-
- if (STREQU(NAME_ANY, form) || STREQU(NAME_NONE, form)) {
- LP_ERRMSG (ERROR, E_FOR_ANYNONE);
- exit (1);
- }
-
- if (STREQU(NAME_ALL, form)) {
-
- while (getform(form, &fbuf, (FALERT *)0, (FILE **)0) == 0)
- if ((*subaction)(fbuf.name) == 1)
- return (1);
-
- switch (errno) {
- case ENOENT:
- return (0);
- default:
- /*
- * Don't know if we'll have a good name
- * in the "all" case on getting here, so
- * punt on naming the form in the error
- * message.
- */
- LP_ERRMSG2 (ERROR, E_LP_GETFORM, form, PERROR);
- return (1);
- }
-
- } else {
-
- if (getform(form, &fbuf, (FALERT *)0, (FILE **)0) == 0)
- return ((*subaction)(fbuf.name));
-
- switch (errno) {
- case ENOENT:
- LP_ERRMSG1 (ERROR, E_LP_NOFORM, form);
- return (1);
- default:
- LP_ERRMSG2 (ERROR, E_LP_GETFORM, form, PERROR);
- return (1);
- }
- }
-}
-
-static int
-#if defined(__STDC__)
-_delete_form (
- char *form
-)
-#else
-_delete_form (form)
- char *form;
-#endif
-{
- switch (notify_spooler(S_UNLOAD_FORM, R_UNLOAD_FORM, form)) {
-
- case -1:
- if (anyrequests()) {
- LP_ERRMSG (ERROR, E_FOR_MOPENREQX);
- return (1);
- }
- /*FALLTHROUGH*/
-
- case MNODEST:
- if (delform(form) == -1) {
- if (errno == ENOENT) {
- LP_ERRMSG1 (ERROR, E_LP_NOFORM, form);
- return (1);
- } else {
- LP_ERRMSG2 (
- ERROR,
- E_FOR_UNKNOWN,
- form,
- PERROR
- );
- return (1);
- }
- }
- break;
-
- case MOK:
- if (delform(form) == -1) {
- LP_ERRMSG (ERROR, E_FOR_DELSTRANGE);
- return (1);
- }
- break;
- }
- return (0);
-}
-
-static int
-#if defined(__STDC__)
-_quiet_alert (
- char * form
-)
-#else
-_quiet_alert (form)
- char * form;
-#endif
-{
- char *msgbuf;
-
- int mtype;
-
- int size;
-
- short status;
-
- /*
- * If the attempt to open a message queue to the
- * Spooler fails, assume it isn't running and just
- * return--don't say anything, `cause the user may
- * know. Any other failure deserves an error message.
- */
-
- if (mopen() == -1)
- return (0);
-
- size = putmessage (NULL, S_QUIET_ALERT, form, QA_FORM);
- msgbuf = malloc(size);
- putmessage (msgbuf, S_QUIET_ALERT, form, QA_FORM);
-
- if (msend(msgbuf) == -1) {
- LP_ERRMSG (ERROR, E_LP_MSEND);
- mclose ();
- return (1);
- }
-
- if (mrecv(msgbuf, size) == -1) {
- LP_ERRMSG (ERROR, E_LP_MRECV);
- mclose ();
- return (1);
- }
-
- mtype = getmessage(msgbuf, R_QUIET_ALERT, &status);
- free (msgbuf);
- mclose ();
- if (mtype != R_QUIET_ALERT) {
- LP_ERRMSG (ERROR, E_LP_BADREPLY);
- return (1);
- }
-
- switch (status) {
-
- case MOK:
- break;
-
- case MNODEST: /* not quite, but not a lie either */
- case MERRDEST:
- LP_ERRMSG1 (WARNING, E_LP_NOQUIET, form);
- break;
-
- case MNOPERM: /* taken care of up front */
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, status);
- return (1);
- /*NOTREACHED*/
- }
-
- return (0);
-}
-
-/**
- ** set_action() - CHECK FOR AMBIGUOUS ACTIONS
- **/
-
-static Action
-#if defined(__STDC__)
-set_action (
- Action action,
- char * option
-)
-#else
-set_action (action, option)
- Action action;
- char * option;
-#endif
-{
- static Action prev_action = 0;
-
- static char * prev_option;
-
-
- if (
- action == list_form && prev_action == list_alert
- || action == list_alert && prev_action == list_form
- )
- action = list_both;
-
- else if (
- action == add_form && prev_action == add_alert
- || action == add_alert && prev_action == add_form
- )
- action = add_form;
-
- else if (
- action == any_alert && prev_action == add_alert
- || action == add_alert && prev_action == any_alert
- )
- action = any_alert;
-
- else if (prev_action && prev_action != action) {
- LP_ERRMSG2 (ERROR, E_LP_AMBIG, option, prev_option);
- exit (1);
- }
-
-OK: prev_action = action;
- prev_option = option;
- return (action);
-}
-
-/**
- ** notify_spooler() - NOTIFY SPOOLER OF ACTION ON FORMS DB
- **/
-
-static int
-#if defined(__STDC__)
-notify_spooler (
- int sendmsg,
- int replymsg,
- char * form
-)
-#else
-notify_spooler (sendmsg, replymsg, form)
- int sendmsg;
- int replymsg;
- char * form;
-#endif
-{
- char * msgbuf;
-
- int mtype;
- int size;
-
- short status;
-
- /*
- * If the attempt to open a message queue to the
- * Spooler fails, assume it isn't running and just
- * return--don't say anything, `cause the user may
- * know. Any other failure deserves an error message.
- */
-
- if (mopen() == -1)
- return (-1);
-
- size = putmessage((char *)0, sendmsg, form);
- msgbuf = malloc(size);
- putmessage (msgbuf, sendmsg, form);
-
- if (msend(msgbuf) == -1) {
- LP_ERRMSG (ERROR, E_LP_MSEND);
- mclose ();
- exit (1);
- }
- if (mrecv(msgbuf, size) == -1) {
- LP_ERRMSG (ERROR, E_LP_MRECV);
- mclose ();
- exit (1);
- }
- mclose ();
-
- mtype = getmessage(msgbuf, replymsg, &status);
- free (msgbuf);
- if (mtype != replymsg) {
- LP_ERRMSG (ERROR, E_LP_BADREPLY);
- exit (1);
- }
-
- if (status == MOK)
- return (MOK);
-
- if (sendmsg == S_LOAD_FORM)
- switch (status) {
- case MNOSPACE:
- LP_ERRMSG (ERROR, E_FOR_NOSPACE);
- break;
- case MNOPERM:
- LP_ERRMSG (ERROR, E_LP_NOTADM);
- break;
-
- /*
- * The following two error conditions should have
- * already been trapped, so treat them as bad status
- * should they occur.
- */
- case MNODEST:
- case MERRDEST:
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, status);
- break;
- }
-
- if (sendmsg == S_UNLOAD_FORM)
- switch (status) {
- case MBUSY:
- LP_ERRMSG1 (ERROR, E_FOR_FORMBUSY, form);
- break;
- case MNODEST:
- return (MNODEST);
- case MNOPERM:
- LP_ERRMSG (ERROR, E_LP_NOTADM);
- break;
- default:
- LP_ERRMSG (ERROR, E_LP_BADSTATUS);
- break;
- }
-
- exit (1);
-}
-
-/**
- ** onerror()
- **/
-
-static int
-#if defined(__STDC__)
-onerror (
- int Errno,
- int lp_errno,
- int linenum
-)
-#else
-onerror (Errno, lp_errno, linenum)
- int Errno;
- int lp_errno;
- int linenum;
-#endif
-{
- static int nerrors = 0;
-
-
- if (Errno == EBADF) {
- switch (lp_errno) {
- case LP_EBADSDN:
- LP_ERRMSG1 (WARNING, E_FOR_BADSCALE, linenum);
- break;
- case LP_EBADINT:
- LP_ERRMSG1 (WARNING, E_FOR_BADINT, linenum);
- break;
- case LP_EBADNAME:
- LP_ERRMSG1 (WARNING, E_FOR_NOTNAME, linenum);
- break;
- case LP_EBADARG:
- LP_ERRMSG1 (WARNING, E_FOR_BADCHSETQUALIFIER, linenum);
- break;
- case LP_ETRAILIN:
- LP_ERRMSG1 (WARNING, E_FOR_TRAILIN, linenum);
- break;
- case LP_EBADCTYPE:
- LP_ERRMSG1 (WARNING, E_FOR_NOTCTYPE, linenum);
- break;
- case LP_EBADHDR:
- LP_ERRMSG1 (WARNING, E_FOR_BADHDR, linenum);
- break;
- }
- if (nerrors++ >= 5) {
- LP_ERRMSG (ERROR, E_LP_GARBAGE);
- return (-1);
- }
- return (0);
- } else {
- LP_ERRMSG2 (ERROR, E_FOR_UNKNOWN, "(stdin)", PERROR);
- return (-1);
- }
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/Makefile b/usr/src/cmd/lp/cmd/lpsched/Makefile
deleted file mode 100644
index c5c645ffe8..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/Makefile
+++ /dev/null
@@ -1,139 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/cmd/lpsched/lpsched/Makefile
-#
-
-PROG= lpsched
-
-include ../../Makefile.lp
-
-MANIFEST= server.xml
-SVCMETHOD= print-svc
-
-ROOTMANIFESTDIR= $(ROOTSVCAPPLICATIONPRINT)
-
-PURIFYOPTS = -logfile=/tmp/errs.%p
-PURIFY = purify $(PURIFYOPTS)
-
-
-# Doing -DDEBUG allows some nice log files to be generated
-# with the -d option.
-
-CPPFLAGS = -I. -I$(LPINC) $(CPPFLAGS.master)
-
-HDRS= \
- nodes.h \
- dispatch.h \
- validate.h \
- lpsched.h
-
-SRCS= \
- alerts.c \
- cancel.c \
- daisyforms.c \
- disena.c \
- disp1.c \
- disp2.c \
- disp3.c \
- disp4.c \
- disp5.c \
- disptab.c \
- dowait.c \
- exec.c \
- faults.c \
- files.c \
- flt.c \
- fncs.c \
- getkey.c \
- init.c \
- log.c \
- lpfsck.c \
- lpsched.c \
- msgs.c \
- notify.c \
- pickfilter.c \
- ports.c \
- requeue.c \
- rstatus.c \
- schedule.c \
- status.c \
- terminate.c \
- validate.c
-
-OBJS= $(SRCS:.c=.o)
-
-
-LPLIBS = \
- $(LIBMSG) \
- $(LIBFRM) \
- $(LIBREQ) \
- $(LIBPRT) \
- $(LIBCLS) \
- $(LIBACC) \
- $(LIBFLT) \
- $(LIBUSR) \
- $(LIBOAM) \
- $(LIBLP) \
- $(LIBSEC)
-
-SYSLIBS= -lcurses -lgen -lcurses -lnsl -ltsol -lsecdb -lbsm
-
-LDLIBS += $(LPLIBS) $(SYSLIBS)
-
-POFILE= lp_cmd_lpsched.po
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-$(PROG): $(OBJS) $(LPLIBS)
- $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
- $(POST_PROCESS)
-
-$(PROG).pure: $(OBJS) $(LPLIBS)
- $(PURIFY) $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
- $(POST_PROCESS)
-
-install: all $(ROOTLIBLPLOCLPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
-
-
-check: $(CHKMANIFEST)
-
-
-clean:
- $(RM) $(OBJS)
-
-strip:
- $(STRIP) $(PROG)
-
-lint: lint_SRCS
-
-include ../Makefile.msg
-
-FRC:
-
-include ../../../Makefile.targ
diff --git a/usr/src/cmd/lp/cmd/lpsched/alerts.c b/usr/src/cmd/lp/cmd/lpsched/alerts.c
deleted file mode 100644
index 7e9b5c5824..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/alerts.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "lpsched.h"
-#include "stdarg.h"
-
-static char *Fa_msg[] =
-{
- "Subject: Mount form %s\n\nThe form %s needs to be mounted\non the printer(s):\n",
- " %-14s (%d requests)\n",
- "Total print requests queued for this form: %d\n",
- "Use the %s ribbon.\n",
- "Use any ribbon.\n",
- "Use the %s print wheel, if appropriate.\n",
- "Use any print wheel, if appropriate.\n",
-};
-
-static char *Fa_New_msg[] =
-{
- "The form `%s' needs to be mounted\non the printer(s):\n",
- "The form `%s' (paper size: `%s') needs\nto be mounted on the printer(s):\n",
-};
-
-static char *Pa_msg[] =
-{
- "Subject: Mount print-wheel %s\n\nThe print-wheel %s needs to be mounted\non the printer(s):\n",
- " %-14s (%d request(s))\n",
- "Total print requests queued for this print-wheel: %d\n",
-};
-
-static char *Pf_msg[] =
-{
- "Subject: Problem with printer %s\n\nThe printer %s has stopped printing for the reason given below.\n",
- "Fix the problem and bring the printer back on line\nto resume printing.\n",
- "Fix the problem and bring the printer back on line, and issue\nan enable command when you want to resume or restart printing.\n",
- "Fix the problem and bring the printer back on line.\nPrinting has stopped, but will be restarted in a few minutes;\nissue an enable command if you want to restart sooner.\nUnless someone issues a change request\n\n\tlp -i %s -P ...\n\nto change the page list to print, the current request will be reprinted from\nthe beginning.\n",
- "\nThe reason(s) it stopped (multiple reasons indicate repeated attempts):\n\n"
-};
-
-static void pformat(),
- pwformat(),
- fformat();
-
-static int f_count(),
- p_count();
-
-/*VARARGS1*/
-void
-alert (int type, ...)
-{
- va_list args;
-
- va_start (args, type);
-
- switch (type) {
- case A_PRINTER: {
- PSTATUS *pr = va_arg(args, PSTATUS *);
- RSTATUS *rp = va_arg(args, RSTATUS *);
- char *text = va_arg(args, char *);
- pformat(pr->alert->msgfile, text, pr, rp);
- if (!pr->alert->active)
- {
- if (exec(EX_ALERT, pr) == 0)
- pr->alert->active = 1;
- else
- {
- if (errno == EBUSY)
- pr->alert->exec->flags |= EXF_RESTART;
- else
- Unlink(pr->alert->msgfile);
- }
- }
- break;
- }
- case A_PWHEEL: {
- PWSTATUS *pp = va_arg(args, PWSTATUS *);
- pwformat(pp->alert->msgfile, pp);
- if (!pp->alert->active) {
- if (exec(EX_PALERT, pp) == 0)
- pp->alert->active = 1;
- else {
- if (errno == EBUSY)
- pp->alert->exec->flags |= EXF_RESTART;
- else
- Unlink(pp->alert->msgfile);
- }
- }
- break;
- }
- case A_FORM: {
- int isFormMessage;
- char *formPath;
- FSTATUS *fp = va_arg(args, FSTATUS *);
-
- isFormMessage = (STREQU(fp->form->alert.shcmd, "showfault"));
- if (isFormMessage)
- formPath = makepath(Lp_A_Forms, fp->form->name,
- FORMMESSAGEFILE, (char * )NULL);
- else
- formPath = fp->alert->msgfile;
-
- fformat(formPath, fp,isFormMessage);
-
- if (isFormMessage) {
- Free(formPath);
- schedule (EV_FORM_MESSAGE, fp);
- } else if (!fp->alert->active) {
- if (exec(EX_FALERT, fp) == 0)
- fp->alert->active = 1;
- else {
- if (errno == EBUSY)
- fp->alert->exec->flags |= EXF_RESTART;
- else
- Unlink(fp->alert->msgfile);
- }
- }
- break;
- }
- }
- va_end(args);
-}
-
-static void
-pformat(char *file, char *text, PSTATUS *pr, RSTATUS *rp)
-{
- int fd;
-
- if (Access(pr->alert->msgfile, 0) == 0) {
- if ((fd = open_locked(file, "a", MODE_READ)) < 0)
- return;
- if (text)
- fdprintf(fd, text);
- close(fd);
- } else {
- if ((fd = open_locked(file, "w", MODE_READ)) < 0)
- return;
- fdprintf(fd, Pf_msg[0], NB(pr->printer->name), NB(pr->printer->name));
- if (STREQU(pr->printer->fault_rec, NAME_WAIT))
- fdprintf(fd, Pf_msg[2]);
- else {
- if (pr->exec->pid > 0)
- fdprintf(fd, Pf_msg[1]);
- else if (rp)
- fdprintf(fd, Pf_msg[3], rp->secure->req_id);
- }
- fdprintf(fd, Pf_msg[4]);
- if (text) {
- while (*text == '\n' || *text == '\r')
- text++;
- fdprintf(fd, "%s", text);
- }
- close(fd);
- }
-}
-
-static void
-pwformat(char *file, PWSTATUS *pp)
-{
- int fd, i;
-
- if ((fd = open_locked(file, "w", MODE_READ)) < 0)
- return;
- fdprintf(fd, Pa_msg[0], NB(pp->pwheel->name), NB(pp->pwheel->name));
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++) {
- PSTATUS *p = PStatus[i];
-
- if (p->printer->daisy && !SAME(p->pwheel_name, pp->pwheel->name) &&
- searchlist(pp->pwheel->name, p->printer->char_sets)) {
- int n = p_count(pp, p->printer->name);
-
- if (n)
- fdprintf(fd, Pa_msg[1], p->printer->name, n);
- }
- }
- fdprintf(fd, Pa_msg[2], pp->requests);
- close(fd);
- pp->requests_last = pp->requests;
-}
-
-static void
-fformat(char *file, FSTATUS *fp, int isFormMessage)
-{
- int fd, i;
- int numLines=0;
-
- if ((fd = open_locked(file, "w", MODE_READ)) < 0)
- return;
-
- if (isFormMessage)
- if (fp->form->paper)
- fdprintf(fd, Fa_New_msg[1], NB(fp->form->name),
- fp->form->paper);
- else
- fdprintf(fd, Fa_New_msg[0], NB(fp->form->name));
- else
- fdprintf(fd, Fa_msg[0], NB(fp->form->name), NB(fp->form->name));
-
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++) {
- PSTATUS *p = PStatus[i];
-
- if ((! isFormMountedOnPrinter(p,fp)) &&
- allowed(fp->form->name, p->forms_allowed,
- p->forms_denied)) {
-
- int n = f_count(fp, p->printer->name);
-
- if (n) {
- fdprintf(fd, Fa_msg[1], p->printer->name, n);
- numLines++;
- }
- }
- }
-
- if (numLines != 1) fdprintf(fd, Fa_msg[2], fp->requests);
- if (!isFormMessage) {
- if (fp->form->rcolor && !STREQU(fp->form->rcolor, NAME_ANY))
- fdprintf(fd, Fa_msg[3], NB(fp->form->rcolor));
- else
- fdprintf(fd, Fa_msg[4]);
-
- if (fp->form->chset && !STREQU(fp->form->chset, NAME_ANY))
- fdprintf(fd, Fa_msg[5], NB(fp->form->chset));
- else
- fdprintf(fd, Fa_msg[6]);
- }
-
- close(fd);
- fp->requests_last = fp->requests;
-}
-
-
-/* VARARGS1 */
-void
-cancel_alert(int type, ...)
-{
- ALERT *ap;
- va_list args;
-
- va_start (args, type);
-
- switch (type)
- {
- case A_PRINTER:
- ap = va_arg(args, PSTATUS *)->alert;
- break;
-
- case A_PWHEEL:
- ap = va_arg(args, PWSTATUS *)->alert;
- break;
-
- case A_FORM:
- ap = va_arg(args, FSTATUS *)->alert;
- break;
-
- default:
- return;
- }
- va_end(args);
-
- ap->active = 0;
- terminate(ap->exec);
- Unlink(ap->msgfile);
- return;
-}
-
-static int
-dest_equivalent_printer(char *dest, char *printer)
-{
- CSTATUS * pc;
-
- return (
- STREQU(dest, printer)
- || STREQU(dest, NAME_ANY)
- || (
- ((pc = search_cstatus(dest)) != NULL)
- && searchlist(printer, pc->class->members)
- )
- );
-}
-
-static int
-f_count(FSTATUS *fp, char *name)
-{
- int count = 0;
- RSTATUS *rp;
-
- for (rp = Request_List; rp != NULL; rp = rp->next)
- if ((rp->form == fp ) &&
- (dest_equivalent_printer(rp->request->destination, name)))
- count++;
-
- if (
- NewRequest
- && NewRequest->form == fp
- && dest_equivalent_printer(NewRequest->request->destination, name)
- )
- count++;
-
- return(count);
-}
-
-static int
-p_count(PWSTATUS *pp, char *name)
-{
- int count = 0;
- RSTATUS *rp;
-
- for (rp = Request_List; rp != NULL; rp = rp->next)
- if ((rp->pwheel == pp) &&
- (dest_equivalent_printer(rp->request->destination, name)))
- count++;
-
- if (
- NewRequest
- && NewRequest->pwheel == pp
- && dest_equivalent_printer(NewRequest->request->destination, name)
- )
- count++;
-
- return(count);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/cancel.c b/usr/src/cmd/lp/cmd/lpsched/cancel.c
deleted file mode 100644
index 9b1fc200a7..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/cancel.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "lpsched.h"
-
-
-/**
- ** cancel() - CANCEL A REQUEST
- **/
-
-int
-cancel (RSTATUS *prs, int spool)
-{
- if (prs->request->outcome & RS_DONE)
- return (0);
-
- prs->request->outcome |= RS_CANCELLED;
-
- if (spool || (prs->request->actions & ACT_NOTIFY))
- prs->request->outcome |= RS_NOTIFY;
-
- if (prs->request->outcome & RS_PRINTING) {
- terminate(prs->printer->exec);
- }
- else if (prs->request->outcome & RS_FILTERING) {
- terminate (prs->exec);
- }
- else if (prs->request->outcome | RS_NOTIFY) {
- notify (prs, "canceled by remote system\n", 0, 0, 0);
- }
- check_request (prs);
-
- return (1);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/daisyforms.c b/usr/src/cmd/lp/cmd/lpsched/daisyforms.c
deleted file mode 100644
index 52304d9603..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/daisyforms.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "lpsched.h"
-#include <syslog.h>
-
-static int max_requests_needing_form_mounted ( FSTATUS * );
-static int max_requests_needing_pwheel_mounted ( char * );
-
-/**
- ** queue_form() - ADD A REQUEST TO A FORM QUEUE
- **/
-
-void
-queue_form(RSTATUS *prs, FSTATUS *pfs)
-{
- if ((prs->form = pfs) != NULL) {
- prs->form->requests++;
- if (prs->printer)
- check_form_alert (prs->form, (_FORM *)0);
- }
- return;
-}
-
-/**
- ** unqueue_form() - REMOVE A REQUEST FROM A FORM QUEUE
- **/
-
-void
-unqueue_form(RSTATUS *prs)
-{
- FSTATUS * pfs = prs->form;
-
- prs->form = 0;
- if (pfs) {
- pfs->requests--;
- if (prs->printer)
- check_form_alert (pfs, (_FORM *)0);
- }
- return;
-}
-
-/**
- ** queue_pwheel() - ADD A REQUEST TO A PRINT WHEEL QUEUE
- **/
-
-void
-queue_pwheel(RSTATUS *prs, char *name)
-{
- if (name) {
- prs->pwheel_name = Strdup(name);
- /*
- * Don't bother queueing the request for
- * a print wheel if this request is destined for
- * only this printer and the printer doesn't take
- * print wheels.
- */
- if (
- !one_printer_with_charsets(prs)
- && (prs->pwheel = search_pwstatus(name))
- ) {
- prs->pwheel->requests++;
- check_pwheel_alert (prs->pwheel, (PWHEEL *)0);
- }
- }
- return;
-}
-
-/**
- ** unqueue_pwheel() - REMOVE A REQUEST FROM A PRINT WHEEL QUEUE
- **/
-
-void
-unqueue_pwheel(RSTATUS *prs)
-{
- PWSTATUS * ppws = prs->pwheel;
-
- prs->pwheel = 0;
- unload_str (&(prs->pwheel_name));
- if (ppws) {
- ppws->requests--;
- check_pwheel_alert (ppws, (PWHEEL *)0);
- }
- return;
-}
-
-/**
- ** check_form_alert() - CHECK CHANGES TO MOUNT FORM ALERT
- **/
-
-void
-check_form_alert(FSTATUS *pfs, _FORM *pf)
-{
- short trigger,
- fire_off_alert = 0;
-
- int requests_waiting;
-
-
- /*
- * Call this routine whenever a requests has been queued
- * or dequeued for a form, and whenever the form changes.
- * If a pointer to a new _FORM is passed, the FSTATUS
- * structure is updated with the changes. Use a second
- * argument of 0 if no change.
- *
- * WARNING: It is valid to call this routine when adding
- * a NEW form (not just changing it). Thus the members of
- * the structure "pfs->form" may not be set.
- * In this case, though, "pf" MUST be set, and there can
- * be NO alert active.
- */
-
- syslog(LOG_DEBUG, "check_form_alert:\n");
- if (pfs)
- syslog(LOG_DEBUG, "check_form_alert: pfs->name <%s>\n",
- (pfs->form->name != NULL) ? pfs->form->name : "null");
- if (pf)
- syslog(LOG_DEBUG, "check_form_alert: pf->name <%s>\n",
- (pf->name != NULL) ? pf->name : "null");
-
-
- if (pf) {
- if ((trigger = pf->alert.Q) <= 0)
- trigger = 1;
- } else
- trigger = pfs->trigger;
-
- if (Starting)
- goto Return;
-
-#define OALERT pfs->form->alert
-#define NALERT pf->alert
-
- requests_waiting = max_requests_needing_form_mounted(pfs);
-
- /*
- * Cancel an active alert if the number of requests queued
- * has dropped below the threshold (or the threshold has been
- * raised), or if the alert command or period has changed.
- * In the latter case we'll reactive the alert later.
- */
- if (pfs->alert->active)
- if (!requests_waiting || requests_waiting < trigger)
- cancel_alert (A_FORM, pfs);
-
- else if (
- pf
- && (
- !SAME(NALERT.shcmd, OALERT.shcmd)
- || NALERT.W != OALERT.W
- || NALERT.Q != OALERT.Q
- )
- )
- cancel_alert (A_FORM, pfs);
-
- /*
- * If we still have the condition for an alert, we'll fire
- * one off. It is possible the alert is still running, but
- * that's okay. First, we may want to change the alert message;
- * second, the "alert()" routine doesn't execute an alert
- * if it is already running.
- */
- if (trigger > 0 && requests_waiting >= trigger)
- if ((pf && NALERT.shcmd) || OALERT.shcmd)
- fire_off_alert = 1;
-
-#undef OALERT
-#undef NALERT
-
-Return: if (pf) {
-
- pfs->form = pf;
-
- pfs->trigger = trigger;
- }
-
- /*
- * Have to do this after updating the changes.
- */
- if (fire_off_alert)
- alert (A_FORM, pfs);
-
- return;
-}
-
-/**
- ** check_pwheel_alert() - CHECK CHANGES TO MOUNT PRINTWHEEL ALERT
- **/
-
-void
-check_pwheel_alert(PWSTATUS *ppws, PWHEEL *ppw)
-{
- short trigger,
- fire_off_alert = 0;
- int requests_waiting;
-
-
- /*
- * Call this routine whenever a request has been queued
- * or dequeued for a print-wheel, and whenever the print-wheel
- * changes. If a pointer to a new PWHEEL is passed, the
- * PWSTATUS structure is updated with the changes. Use a
- * second argument of 0 if no change.
- *
- * WARNING: It is valid to call this routine when adding
- * a NEW print wheel (not just changing it). Thus the members
- * of the structure "ppws->pwheel" may not be set.
- * In this case, though, "ppw" MUST be set, and there can
- * be NO alert active.
- */
-
- if (ppw) {
- if ((trigger = ppw->alert.Q) <= 0)
- trigger = 1;
- } else
- trigger = ppws->trigger;
-
- if (Starting)
- goto Return;
-
-#define OALERT ppws->pwheel->alert
-#define NALERT ppw->alert
-
- requests_waiting = max_requests_needing_pwheel_mounted(ppws->pwheel->name);
-
- /*
- * Cancel an active alert if the number of requests queued
- * has dropped below the threshold (or the threshold has been
- * raised), or if the alert command or period has changed.
- * In the latter case we'll reactive the alert later.
- */
- if (ppws->alert->active)
- if (!requests_waiting || requests_waiting < trigger)
- cancel_alert (A_PWHEEL, ppws);
-
- else if (
- ppw
- && (
- !SAME(NALERT.shcmd, OALERT.shcmd)
- || NALERT.W != OALERT.W
- || NALERT.Q != OALERT.Q
- )
- )
- cancel_alert (A_PWHEEL, ppws);
-
- /*
- * If we still have the condition for an alert, we'll fire
- * one off. It is possible the alert is still running, but
- * that's okay. First, we may want to change the alert message;
- * second, the "alert()" routine doesn't execute an alert
- * if it is already running.
- */
- if (trigger > 0 && requests_waiting >= trigger)
- if ((ppw && NALERT.shcmd) || OALERT.shcmd)
- fire_off_alert = 1;
-
-#undef OALERT
-#undef NALERT
-
-Return: if (ppw) {
-
- ppws->pwheel = ppw;
- ppws->trigger = trigger;
- }
-
- /*
- * Have to do this after updating the changes.
- */
- if (fire_off_alert)
- alert (A_PWHEEL, ppws);
-
- return;
-}
-
-static int
-trayWithForm(PSTATUS *pps, FSTATUS *pfs, int startingTray, int checkAvail)
-{
- int i;
- PFSTATUS *ppfs;
-
- ppfs = pps->forms;
- if (startingTray < 0)
- startingTray = 0;
-
- if (ppfs) {
- for (i = startingTray; i < pps->numForms; i++)
- if ((!checkAvail || ppfs[i].isAvailable) &&
- (ppfs[i].form == pfs))
- return(i);
- }
- else if (!pfs)
- /* no form request matches no form mounted */
- return(0);
-
- return(-1);
-}
-
-char *
-allTraysWithForm(PSTATUS *pps, FSTATUS *pfs)
-{
-
- int tray = 0;
- char *ptr, *p;
- char trayList[MAX_INPUT];
- int n;
-
- ptr = trayList;
- if (pfs && pfs->form && pfs->form->paper)
- p = pfs->form->paper;
- else
- p = "";
-
- n = sizeof (trayList);
- snprintf(ptr, n, "LP_TRAY_ARG=%s:", p);
-
- ptr += strlen(ptr);
- n -= strlen(ptr);
-
- while ((tray = trayWithForm(pps, pfs, tray, 1)) > 0) {
- tray++;
- snprintf(ptr, n, "%d,", tray);
- ptr += strlen(ptr);
- n -= strlen(ptr);
- }
- if (*(ptr-1) == ',')
- *(ptr-1) = 0;
-
- putenv(trayList);
- return(NULL);
-}
-
-int
-isFormUsableOnPrinter(PSTATUS *pps, FSTATUS *pfs)
-{
- return (trayWithForm(pps,pfs,0,1) >= 0 );
-}
-int
-isFormMountedOnPrinter(PSTATUS *pps, FSTATUS *pfs)
-{
- return (trayWithForm(pps,pfs,0,0) >= 0 );
-}
-
-/**
- ** max_requests_needing_form_mounted()
- ** max_requests_needing_pwheel_mounted()
- **/
-
-static int
-max_requests_needing_form_mounted(FSTATUS *pfs)
-{
- PSTATUS * pps;
- RSTATUS * prs;
- int max = 0;
- int i;
-
- /*
- * For each printer that doesn't have this form mounted,
- * count the number of requests needing this form and
- * assigned to the printer. Find the maximum across all such
- * printers. Sorry, the code actually has a different loop
- * (it steps through the requests) but the description of what
- * happens below is easier to understand as given. (Looping
- * through the printers would result in #printers x #requests
- * steps, whereas this entails #requests steps.)
- */
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- PStatus[i]->nrequests = 0;
-
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if ((prs->form == pfs) && ((pps = prs->printer) != NULL) &&
- (!isFormMountedOnPrinter(pps,pfs)) &&
- (++pps->nrequests >= max))
- max = pps->nrequests;
-
- if (NewRequest)
- if (((pps = NewRequest->printer) != NULL) &&
- (!isFormMountedOnPrinter(pps,pfs)))
- if (++pps->nrequests >= max)
- max = pps->nrequests;
- return (max);
-}
-
-static int
-max_requests_needing_pwheel_mounted(char *pwheel_name)
-{
- PSTATUS * pps;
- RSTATUS * prs;
- int max = 0;
- int i;
-
-
- /*
- * For each printer that doesn't have this print-wheel mounted,
- * count the number of requests needing this print-wheel and
- * assigned to the printer. Find the maximum across all such
- * printers. Sorry, the code actually has a different loop
- * (it steps through the requests) but the description of what
- * happens below is easier to understand as given. (Looping
- * through the printers would result in #printers x #requests
- * steps, whereas this entails #requests steps.)
- */
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- PStatus[i]->nrequests = 0;
-
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if ((prs->pwheel_name != NULL) &&
- (STREQU(prs->pwheel_name, pwheel_name)) &&
- ((pps = prs->printer) != NULL) && pps->printer->daisy &&
- (!SAME(pps->pwheel_name, pwheel_name)))
- if (++pps->nrequests >= max)
- max = pps->nrequests;
-
- if (NewRequest)
- if (
- ((pps = NewRequest->printer) != NULL)
- && pps->printer->daisy
- && !SAME(pps->pwheel_name, pwheel_name)
- )
- if (++pps->nrequests >= max)
- max = pps->nrequests;
- return (max);
-}
-
-/**
- ** one_printer_with_charsets()
- **/
-
-int
-one_printer_with_charsets(RSTATUS *prs)
-{
- /*
- * This little function answers the question: Is a request
- * that needs a character set destined for a particular
- * printer that has selectable character sets instead of
- * mountable print wheels?
- */
- return (
- STREQU(prs->request->destination, prs->printer->printer->name)
- && !prs->printer->printer->daisy
- );
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/disena.c b/usr/src/cmd/lp/cmd/lpsched/disena.c
deleted file mode 100644
index 559e59e17e..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/disena.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9.1.4 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "lpsched.h"
-#include <time.h>
-
-/**
- ** disable() - DISABLE PRINTER
- **/
-
-int
-disable(PSTATUS *pps, char *reason, int when)
-{
- if (pps->status & PS_DISABLED)
- return (-1);
-
- else {
- pps->status |= PS_DISABLED;
- time (&pps->dis_date);
- load_str (&pps->dis_reason, reason);
-
- dump_pstatus ();
-
- if (pps->status & PS_BUSY)
- switch (when) {
-
- case DISABLE_STOP:
- /*
- * Stop current job, requeue.
- */
- if (pps->request)
- pps->request->request->outcome |= RS_STOPPED;
- terminate (pps->exec);
- break;
-
- case DISABLE_FINISH:
- /*
- * Let current job finish.
- */
- break;
-
- case DISABLE_CANCEL:
- /*
- * Cancel current job outright.
- */
- if (pps->request)
- cancel (pps->request, 1);
- break;
-
- }
-
- /*
- * Need we check to see if requests assigned to
- * this printer should be assigned elsewhere?
- * No, if the "validate()" routine is properly
- * assigning requests. If another printer is available
- * for printing requests (that would otherwise be)
- * assigned to this printer, at least one of those
- * requests will be assigned to that other printer,
- * and should be currently printing. Once it is done
- * printing, the queue will be examined for the next
- * request, and the one(s) assigned this printer will
- * be picked up.
- */
-/* (void)queue_repel (pps, 0, (qchk_fnc_type)0); */
-
- return (0);
- }
-}
-
-/**
- ** enable() - ENABLE PRINTER
- **/
-
-int
-enable (register PSTATUS *pps)
-{
- /*
- * ``Enabling a printer'' includes clearing a fault and
- * clearing the do-it-later flag to allow the printer
- * to start up again.
- */
- if (!(pps->status & (PS_FAULTED|PS_DISABLED|PS_LATER)))
- return (-1);
-
- else {
- pps->status &= ~(PS_FAULTED|PS_DISABLED|PS_LATER);
- (void) time (&pps->dis_date);
-
- dump_pstatus ();
-
- if (pps->alert->active)
- cancel_alert (A_PRINTER, pps);
-
- /*
- * Attract the FIRST request that is waiting to
- * print to this printer. In this regard we're acting
- * like the printer just finished printing a request
- * and is looking for another.
- */
- queue_attract (pps, qchk_waiting, 1);
- return (0);
- }
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/disp1.c b/usr/src/cmd/lp/cmd/lpsched/disp1.c
deleted file mode 100644
index d8e667550d..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/disp1.c
+++ /dev/null
@@ -1,1177 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include "dispatch.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <syslog.h>
-
-static char *reqpath(char *, char **);
-static int mv_file(RSTATUS *, char *);
-
-
-RSTATUS *NewRequest;
-
-/*
- * s_alloc_files()
- */
-
-void
-s_alloc_files(char *m, MESG *md) /* funcdef */
-{
- char *file_prefix;
- ushort_t count;
- mode_t old_msk;
-
-
- /*
- * Bugid 4140311
- * Set umask to 0 before creating files.
- */
- old_msk = umask((mode_t)0);
-
- getmessage(m, S_ALLOC_FILES, &count);
- syslog(LOG_DEBUG, "s_alloc_files(%d)", count);
-
- if ((file_prefix = _alloc_files(count, (char *)0, md->uid, md->gid))) {
- mputm(md, R_ALLOC_FILES, MOK, file_prefix);
- add_flt_act(md, FLT_FILES, file_prefix, count);
- } else if (errno == EEXIST)
- mputm(md, R_ALLOC_FILES, MERRDEST, "");
- else
- mputm(md, R_ALLOC_FILES, MNOMEM, "");
-
- (void) umask(old_msk);
-
-}
-
-/*
- * s_print_request()
- */
-
-void
-s_print_request(char *m, MESG *md)
-{
- extern char *Local_System;
- char *file;
- char *idno;
- char *path;
- char *req_file;
- char *req_id = 0;
- RSTATUS *rp;
- REQUEST *r;
- SECURE *s;
- struct passwd *pw;
- short err;
- short status;
- off_t size;
- uid_t org_uid;
- gid_t org_gid;
-#ifdef LP_USE_PAPI_ATTR
- struct stat tmpBuf;
- char tmpName[BUFSIZ];
-#endif
-
-
- (void) getmessage(m, S_PRINT_REQUEST, &file);
- syslog(LOG_DEBUG, "s_print_request(%s)", (file ? file : "NULL"));
-
- /*
- * "NewRequest" points to a request that's not yet in the
- * request list but is to be considered with the rest of the
- * requests (e.g. calculating # of requests awaiting a form).
- */
- if ((rp = NewRequest = new_rstatus(NULL, NULL)) == NULL)
- status = MNOMEM;
-
- else
- {
- req_file = reqpath(file, &idno);
- path = makepath(Lp_Tmp, req_file, (char *)0);
- (void) chownmod(path, Lp_Uid, Lp_Gid, 0644);
- Free(path);
-
- if (!(r = Getrequest(req_file)))
- status = MNOOPEN;
-
- else
- {
- rp->req_file = Strdup(req_file);
-
- freerequest(rp->request);
- rp->request = r;
-
- rp->request->outcome = 0;
- rp->secure->uid = md->uid;
- rp->secure->gid = md->gid;
- if (md->slabel != NULL)
- rp->secure->slabel = Strdup(md->slabel);
-
- pw = getpwuid(md->uid);
- endpwent();
- if (pw && pw->pw_name && *pw->pw_name)
- rp->secure->user = Strdup(pw->pw_name);
- else {
- rp->secure->user = Strdup(BIGGEST_NUMBER_S);
- (void) sprintf(rp->secure->user, "%u",
- md->uid);
- }
-
- if ((rp->request->actions & ACT_SPECIAL) == ACT_HOLD)
- rp->request->outcome |= RS_HELD;
- if ((rp->request->actions & ACT_SPECIAL) == ACT_RESUME)
- rp->request->outcome &= ~RS_HELD;
- if ((rp->request->actions & ACT_SPECIAL) ==
- ACT_IMMEDIATE) {
- if (!md->admin) {
- status = MNOPERM;
- goto Return;
- }
- rp->request->outcome |= RS_IMMEDIATE;
- }
-
- size = chfiles(rp->request->file_list, Lp_Uid, Lp_Gid);
-
- if (size < 0) {
- /*
- * at this point, chfiles() may have
- * failed because the file may live on
- * an NFS mounted filesystem, under
- * a directory of mode 700. such a
- * directory isn't accessible even by
- * root, according to the NFS protocol
- * (i.e. the Stat() in chfiles() failed).
- * this most commonly happens via the
- * automounter, and rlogin. thus we
- * change our euid/egid to that of the
- * user, and try again. if *this* fails,
- * then the file must really be
- * inaccessible.
- */
- org_uid = geteuid();
- org_gid = getegid();
-
- if (setegid(md->gid) != 0) {
- status = MUNKNOWN;
- goto Return;
- }
-
- if (seteuid(md->uid) != 0) {
- setgid(org_gid);
- status = MUNKNOWN;
- goto Return;
- }
-
- size = chfiles(rp->request->file_list,
- Lp_Uid, Lp_Gid);
-
- if (seteuid(org_uid) != 0) {
- /* should never happen */
- note("s_print_request(): ");
- note("seteuid back to uid=%d "
- "failed!!\n", org_uid);
- size = -1;
- }
-
- if (setegid(org_gid) != 0) {
- /* should never happen */
- note("s_print_request(): ");
- note("setegid back to uid=%d "
- "failed!!\n", org_uid);
- size = -1;
- }
-
- if (size < 0) {
- status = MUNKNOWN;
- goto Return;
- }
- }
- if (!(rp->request->outcome & RS_HELD) && size == 0) {
- status = MNOPERM;
- goto Return;
- }
- rp->secure->size = size;
-
- (void) time(&rp->secure->date);
- rp->secure->req_id = NULL;
-
- if (!rp->request->title) {
- if (strlen(*rp->request->file_list) <
- (size_t)24)
- rp->request->title =
- Strdup(*rp->request->file_list);
- else {
- char *r;
- if (r = strrchr(
- *rp->request->file_list, '/'))
- r++;
- else
- r = *rp->request->file_list;
-
- rp->request->title = malloc(25);
- sprintf(rp->request->title,
- "%-.24s", r);
- }
- }
-
- if ((err = validate_request(rp, &req_id, 0)) != MOK)
- status = err;
- else {
- /*
- * "req_id" will be supplied if this is from a
- * remote system.
- */
- if (rp->secure->req_id == NULL) {
- req_id = makestr(req_id, "-",
- idno, (char *)0);
- rp->secure->req_id = req_id;
- } else
- req_id = rp->secure->req_id;
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * Check if the PAPI job attribute file
- * exists, if it does change the
- * permissions and ownership of the file.
- * This file is created when print jobs
- * are submitted via the PAPI interface,
- * the file pathname of this file is
- * passed to the slow-filters and printer
- * interface script as an environment
- * variable when they are executed
- */
- snprintf(tmpName, sizeof (tmpName),
- "%s-%s", idno, LP_PAPIATTRNAME);
- path = makepath(Lp_Temp, tmpName, (char *)0);
-
- if (stat(path, &tmpBuf) == 0) {
- syslog(LOG_DEBUG,
- "s_print_request: "\
- "attribute file ='%s'", path);
-
- /*
- * IPP job attribute file exists
- * for this job so change
- * permissions and ownership of
- * the file
- */
- (void) chownmod(path, Lp_Uid,
- Lp_Gid, 0644);
- Free(path);
- }
- else
- {
- syslog(LOG_DEBUG,
- "s_print_request: "\
- "no attribute file");
- }
-#endif
-
- /*
- * fix for bugid 1103890.
- * use Putsecure instead.
- */
- if ((Putsecure(req_file, rp->secure) == -1) ||
- (putrequest(req_file, rp->request) == -1))
- status = MNOMEM;
- else
- {
- status = MOK;
-
- insertr(rp);
- NewRequest = 0;
-
- if (rp->slow)
- schedule(EV_SLOWF, rp);
- else
- schedule(EV_INTERF,
- rp->printer);
-
- del_flt_act(md, FLT_FILES);
- }
- }
- }
- }
-
-Return:
- NewRequest = 0;
- Free(req_file);
- Free(idno);
- if (status != MOK && rp) {
- rmfiles(rp, 0);
- free_rstatus(rp);
- }
- mputm(md, R_PRINT_REQUEST, status, NB(req_id), chkprinter_result);
-}
-
-/*
- * s_start_change_request()
- */
-
-void
-s_start_change_request(char *m, MESG *md)
-{
- char *req_id;
- char *req_file = "";
- short status;
- RSTATUS *rp;
- char *path;
- char tmpName[BUFSIZ];
- struct stat tmpBuf;
-
- (void) getmessage(m, S_START_CHANGE_REQUEST, &req_id);
- syslog(LOG_DEBUG, "s_start_change_request(%s)",
- (req_id ? req_id : "NULL"));
-
- if (!(rp = request_by_id(req_id)))
- status = MUNKNOWN;
- else if ((md->admin == 0) && (is_system_labeled()) &&
- (md->slabel != NULL) && (rp->secure->slabel != NULL) &&
- (!STREQU(md->slabel, rp->secure->slabel)))
- status = MUNKNOWN;
- else if (rp->request->outcome & RS_DONE)
- status = M2LATE;
- else if (!md->admin && md->uid != rp->secure->uid)
- status = MNOPERM;
- else if (rp->request->outcome & RS_CHANGING)
- status = MNOOPEN;
- else if (rp->request->outcome & RS_NOTIFYING)
- status = MBUSY;
- else {
- status = MOK;
-
- if (rp->request->outcome & RS_FILTERING &&
- !(rp->request->outcome & RS_STOPPED)) {
- rp->request->outcome |= (RS_REFILTER|RS_STOPPED);
- terminate(rp->exec);
- }
-
- if (rp->request->outcome & RS_PRINTING &&
- !(rp->request->outcome & RS_STOPPED)) {
- rp->request->outcome |= RS_STOPPED;
- terminate(rp->printer->exec);
- }
-
- rp->request->outcome |= RS_CHANGING;
-
- /*
- * Change the ownership of the request file to be "md->uid".
- * Either this is identical to "rp->secure->uid", or it is
- * "Lp_Uid" or it is root. The idea is that the
- * person at the other end needs access, and that may not
- * be who queued the request.
- */
-
- path = makepath(Lp_Tmp, rp->req_file, (char *)0);
- (void) Chown(path, md->uid, rp->secure->gid);
- Free(path);
-
-#ifdef LP_USE_PAPI_ATTR
-
- /*
- * Check if the PAPI job attribute file exists, if it does
- * change the ownership of the file to be "md->uid".
- * Either this is identical to "rp->secure->uid", or it is
- * "Lp_Uid" or it is root. The idea is that the
- * person at the other end needs access, and that may not
- * be who queued the request.
- */
-
- snprintf(tmpName, sizeof (tmpName),
- "%s-%s", strtok(strdup(rp->req_file), "-"),
- LP_PAPIATTRNAME);
-
- path = makepath(Lp_Tmp, tmpName, (char *)0);
-
- if (stat(path, &tmpBuf) == 0) {
- syslog(LOG_DEBUG,
- "s_start_change_request: attribute file ='%s'",
- path);
-
- /*
- * IPP job attribute file exists for this job so
- * change permissions and ownership of the file
- */
- (void) Chown(path, md->uid, rp->secure->gid);
- Free(path);
- }
- else
- {
- syslog(LOG_DEBUG,
- "s_start_change_request: no attribute file");
- }
-#endif
-
- add_flt_act(md, FLT_CHANGE, rp);
- req_file = rp->req_file;
-
- }
-
- mputm(md, R_START_CHANGE_REQUEST, status, req_file);
-}
-
-/*
- * s_end_change_request()
- */
-
-void
-s_end_change_request(char *m, MESG *md)
-{
- char *req_id;
- RSTATUS *rp;
- off_t size;
- off_t osize;
- short err;
- short status;
- REQUEST *r = 0;
- REQUEST oldr;
- int call_schedule = 0;
- int move_ok = 0;
- char *path;
- char tmpName[BUFSIZ];
- struct stat tmpBuf;
-
- (void) getmessage(m, S_END_CHANGE_REQUEST, &req_id);
- syslog(LOG_DEBUG, "s_end_change_request(%s)",
- (req_id ? req_id : "NULL"));
-
- if (!(rp = request_by_id(req_id)))
- status = MUNKNOWN;
- else if ((md->admin == 0) && (is_system_labeled()) &&
- (md->slabel != NULL) && (rp->secure->slabel != NULL) &&
- (!STREQU(md->slabel, rp->secure->slabel)))
- status = MUNKNOWN;
- else if (!(rp->request->outcome & RS_CHANGING))
- status = MNOSTART;
- else {
- path = makepath(Lp_Tmp, rp->req_file, (char *)0);
- (void) chownmod(path, Lp_Uid, Lp_Gid, 0644);
- Free(path);
-
-#ifdef LP_USE_PAPI_ATTR
-
- /*
- * Check if the PAPI job attribute file exists,
- * if it does change the permission and the ownership
- * of the file to be "Lp_Uid".
- */
-
- snprintf(tmpName, sizeof (tmpName),
- "%s-%s", strtok(strdup(rp->req_file), "-"),
- LP_PAPIATTRNAME);
-
- path = makepath(Lp_Tmp, tmpName, (char *)0);
-
- if (stat(path, &tmpBuf) == 0) {
- syslog(LOG_DEBUG,
- "s_end_change_request: attribute file ='%s'",
- path);
-
- /*
- * IPP job attribute file exists for this job so
- * change permissions and ownership of the file
- */
- (void) chownmod(path, Lp_Uid, Lp_Gid, 0644);
- Free(path);
- }
- else
- {
- syslog(LOG_DEBUG,
- "s_end_change_request: no attribute file");
- }
-#endif
- rp->request->outcome &= ~(RS_CHANGING);
- del_flt_act(md, FLT_CHANGE);
- /*
- * The RS_CHANGING bit may have been the only thing
- * preventing this request from filtering or printing,
- * so regardless of what happens below,
- * we must check to see if the request can proceed.
- */
- call_schedule = 1;
-
- if (!(r = Getrequest(rp->req_file)))
- status = MNOOPEN;
- else {
- oldr = *(rp->request);
- *(rp->request) = *r;
-
- move_ok =
- STREQU(oldr.destination, r->destination);
-
- /*
- * Preserve the current request status!
- */
- rp->request->outcome = oldr.outcome;
-
- /*
- * Here's an example of the dangers one meets
- * when public flags are used for private
- * purposes. ".actions" (indeed, anything in the
- * REQUEST structure) is set by the person
- * changing the job. However, lpsched uses
- * ".actions" as place to indicate that a job
- * came from a remote system and we must send
- * back job completion--this is a strictly
- * private flag that we must preserve.
- */
- rp->request->actions |=
- (oldr.actions & ACT_NOTIFY);
-
- if ((rp->request->actions & ACT_SPECIAL) ==
- ACT_HOLD) {
- rp->request->outcome |= RS_HELD;
- /*
- * To be here means either the user owns
- * the request or he or she is the
- * administrator. Since we don't want to
- * set the RS_ADMINHELD flag if the user
- * is the administrator, the following
- * compare will work.
- */
- if (md->uid != rp->secure->uid)
- rp->request->outcome |=
- RS_ADMINHELD;
- }
-
- if ((rp->request->actions & ACT_SPECIAL) ==
- ACT_RESUME) {
- if ((rp->request->outcome & RS_ADMINHELD) &&
- !md->admin) {
- status = MNOPERM;
- goto Return;
- }
- rp->request->outcome &=
- ~(RS_ADMINHELD|RS_HELD);
- }
-
- if ((rp->request->actions & ACT_SPECIAL)
- == ACT_IMMEDIATE) {
- if (!md->admin) {
- status = MNOPERM;
- goto Return;
- }
- rp->request->outcome |= RS_IMMEDIATE;
- }
-
- size = chfiles(rp->request->file_list, Lp_Uid,
- Lp_Gid);
- if (size < 0) {
- status = MUNKNOWN;
- goto Return;
- }
- if (!(rp->request->outcome & RS_HELD) &&
- size == 0) {
- status = MNOPERM;
- goto Return;
- }
-
- osize = rp->secure->size;
- rp->secure->size = size;
-
- if (move_ok == 0) {
- char *dest = strdup(r->destination);
- if ((status = mv_file(rp, dest)) == MOK)
- rp->secure->size = osize;
- free(dest);
- } else if ((err = validate_request(rp, (char **)0,
- move_ok)) != MOK) {
- status = err;
- rp->secure->size = osize;
- } else {
- status = MOK;
-
- if ((rp->request->outcome & RS_IMMEDIATE) ||
- (rp->request->priority != oldr.priority)) {
- remover(rp);
- insertr(rp);
- }
-
- freerequest(&oldr);
- (void) putrequest(rp->req_file, rp->request);
- /*
- * fix for bugid 1103890.
- * use Putsecure instead.
- */
- (void) Putsecure(rp->req_file, rp->secure);
- }
- }
- }
-
-Return:
- if (status != MOK && rp) {
- if (r) {
- freerequest(r);
- *(rp->request) = oldr;
- }
- if (status != MNOSTART)
- (void) putrequest(rp->req_file, rp->request);
- }
-
- if (call_schedule)
- maybe_schedule(rp);
-
- mputm(md, R_END_CHANGE_REQUEST, status, chkprinter_result);
-}
-
-/*
- * _cancel()
- * user may be (host!user)
- */
-
-static char *
-_cancel(MESG *md, char *dest, char *user, char *req_id)
-{
- static RSTATUS *rp;
- static char *s_dest;
- static char *s_user;
- static char *s_req_id;
- static int current;
- RSTATUS *crp;
- char *creq_id;
-
- syslog(LOG_DEBUG, "_cancel(%s, %s, %s)", (dest ? dest : "NULL"),
- (user ? user : "NULL"), (req_id ? req_id : "NULL"));
-
- if (dest || user || req_id) {
- s_dest = dest;
- if (STREQU(user, "!"))
- s_user = strdup("all!all");
- else
- s_user = user;
- s_req_id = req_id;
- rp = Request_List;
- current = 0;
- if (STREQU(s_req_id, CURRENT_REQ)) {
- current = 1;
- s_req_id = NULL;
- }
- }
-
- while (rp != NULL) {
- crp = rp;
- rp = rp->next;
-
- if (*s_dest && !STREQU(s_dest, crp->request->destination))
- continue;
-
- if (current && !(crp->request->outcome & RS_PRINTING))
- continue;
-
- if (s_req_id && *s_req_id &&
- !STREQU(s_req_id, crp->secure->req_id))
- continue;
-
- if (*s_user && !bangequ(s_user, crp->secure->user))
- continue;
-
- if (!md->admin && md->uid != crp->secure->uid) {
- errno = MNOPERM;
- return (Strdup(crp->secure->req_id));
- }
-
- /*
- * For Trusted Extensions, we need to check the
- * sensitivity label of the
- * connection and job before we try to cancel it.
- */
- if ((md->admin == 0) && (is_system_labeled()) &&
- (md->slabel != NULL) && (crp->secure->slabel != NULL) &&
- (!STREQU(md->slabel, crp->secure->slabel)))
- continue;
-
- crp->reason = MOK;
- creq_id = Strdup(crp->secure->req_id);
-
- syslog(LOG_DEBUG, "cancel reqid (%s) uid: %d, secureuid: %d",
- creq_id, md->uid, crp->secure->uid);
-
- if (cancel(crp, (md->uid != crp->secure->uid)))
- errno = MOK;
- else
- errno = M2LATE;
- return (creq_id);
- }
-
- errno = MUNKNOWN;
- return (NULL);
-}
-
-/*
- * s_cancel_request()
- */
-
-void
-s_cancel_request(char *m, MESG *md)
-{
- char *req_id, *rid;
- short status;
-
- (void) getmessage(m, S_CANCEL_REQUEST, &req_id);
- syslog(LOG_DEBUG, "s_cancel_request(%s)", (req_id ? req_id : "NULL"));
-
- if ((rid = _cancel(md, "", "", req_id)) != NULL)
- Free(rid);
- status = (short)errno;
-
- mputm(md, R_CANCEL_REQUEST, status);
-}
-
-/*
- * s_cancel()
- */
-
-void
-s_cancel(char *m, MESG *md)
-{
- char *req_id;
- char *user;
- char *destination;
- char *rid;
- char *nrid;
- int nerrno;
- int oerrno;
-
- (void) getmessage(m, S_CANCEL, &destination, &user, &req_id);
- syslog(LOG_DEBUG, "s_cancel(%s, %s, %s)",
- (destination ? destination : "NULL"), (user ? user : "NULL"),
- (req_id ? req_id : "NULL"));
-
- if (STREQU(destination, NAME_ALL))
- destination = "";
- if (STREQU(req_id, NAME_ALL))
- req_id = "";
-
- if (rid = _cancel(md, destination, user, req_id)) {
- oerrno = errno;
-
- while ((nrid = _cancel(md, NULL, NULL, NULL)) != NULL) {
- nerrno = errno;
- mputm(md, R_CANCEL, MOKMORE, oerrno, rid);
- Free(rid);
- rid = nrid;
- oerrno = nerrno;
- }
- mputm(md, R_CANCEL, MOK, oerrno, rid);
- Free(rid);
- return;
- }
-
- mputm(md, R_CANCEL, MOK, MUNKNOWN, "");
-}
-
-/*
- * s_inquire_request_rank()
- */
-
-void
-s_inquire_request_rank(char *m, MESG *md)
-{
- char *form;
- char *dest;
- char *pwheel;
- char *user;
- char *req_id;
- RSTATUS *rp;
- RSTATUS *found = NULL;
- int found_rank = 0;
- short prop;
- char files[BUFSIZ];
- int i;
-
- (void) getmessage(m, S_INQUIRE_REQUEST_RANK, &prop, &form, &dest,
- &req_id, &user, &pwheel);
- syslog(LOG_DEBUG, "s_inquire_request_rank(%d, %s, %s, %s, %s, %s)",
- prop, (form ? form : "NULL"), (dest ? dest : "NULL"),
- (req_id ? req_id : "NULL"), (user ? user : "NULL"),
- (pwheel ? pwheel : "NULL"));
-
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- PStatus[i]->nrequests = 0;
-
- for (rp = Request_List; rp != NULL; rp = rp->next) {
- if (rp->printer && !(rp->request->outcome & RS_DONE))
- rp->printer->nrequests++;
-
- if (*form && !SAME(form, rp->request->form))
- continue;
-
- if (*dest && !STREQU(dest, rp->request->destination)) {
- if (!rp->printer)
- continue;
- if (!STREQU(dest, rp->printer->printer->name))
- continue;
- }
-
- if (*req_id && !STREQU(req_id, rp->secure->req_id))
- continue;
-
- if (*user && !bangequ(user, rp->secure->user))
- continue;
-
- if (*pwheel && !SAME(pwheel, rp->pwheel_name))
- continue;
- /*
- * For Trusted Extensions, we need to check the sensitivity
- * label of the connection and job before we return it to the
- * client.
- */
- if ((md->admin <= 0) && (is_system_labeled()) &&
- (md->slabel != NULL) && (rp->secure->slabel != NULL) &&
- (!STREQU(md->slabel, rp->secure->slabel)))
- continue;
-
- if (found) {
- GetRequestFiles(found->request, files, sizeof (files));
- mputm(md, R_INQUIRE_REQUEST_RANK,
- MOKMORE,
- found->secure->req_id,
- found->request->user,
- /* bgolden 091996, bug 1257405 */
- found->secure->slabel,
- found->secure->size,
- found->secure->date,
- found->request->outcome,
- found->printer->printer->name,
- (found->form? found->form->form->name : ""),
- NB(found->pwheel_name),
- found_rank,
- files);
- }
- found = rp;
- found_rank = found->printer->nrequests;
- }
-
- if (found) {
- GetRequestFiles(found->request, files, sizeof (files));
- mputm(md, R_INQUIRE_REQUEST_RANK,
- MOK,
- found->secure->req_id,
- found->request->user, /* bgolden 091996, bug 1257405 */
- found->secure->slabel,
- found->secure->size,
- found->secure->date,
- found->request->outcome,
- found->printer->printer->name,
- (found->form? found->form->form->name : ""),
- NB(found->pwheel_name),
- found_rank,
- files);
- } else
- mputm(md, R_INQUIRE_REQUEST_RANK, MNOINFO, "", "", "", 0L, 0L,
- 0, "", "", "", 0, "");
-}
-
-static int
-mv_file(RSTATUS *rp, char *dest)
-{
- int stat;
- char *olddest;
- EXEC *oldexec;
- SECURE * securep;
- RSTATUS * prs;
- char *reqno;
-
- oldexec = rp->printer->exec;
- olddest = rp->request->destination;
- rp->request->destination = Strdup(dest);
- if ((stat = validate_request(rp, (char **)0, 1)) == MOK) {
- Free(olddest);
-
- if (rp->request->outcome & RS_FILTERED) {
- int cnt = 0;
- char *reqno;
- char **listp;
- char tmp_nam[MAXPATHLEN];
-
- reqno = getreqno(rp->secure->req_id);
- for (listp = rp->request->file_list; *listp; listp++) {
- cnt++;
- snprintf(tmp_nam, sizeof (tmp_nam),
- "%s/F%s-%d", Lp_Temp, reqno, cnt);
- unlink(tmp_nam);
-
- }
- rp->request->outcome &= ~RS_FILTERED;
- }
-
- /* update /var/spool/lp/tmp/<host>/nnn-0 */
- if (putrequest(rp->req_file, rp->request) < 0) {
- note("putrequest failed\n");
- return (MNOMEM);
- }
-
- /* update /var/spool/lp/requests/<host>/nnn-0 */
- if ((securep = Getsecure(rp->req_file))) {
- reqno = strdup(getreqno(securep->req_id));
- (void) free(securep->req_id);
- if ((securep->req_id = calloc(strlen(dest) + 1 +
- strlen(reqno) +1, sizeof (char))) == NULL)
- return (MNOMEM);
- (void) sprintf(securep->req_id, "%s-%s", dest, reqno);
- /* remove the old request file; save new one */
- (void) rmsecure(rp->secure->req_id);
- if (Putsecure(rp->req_file, securep) < 0) {
- /* Putsecure includes note/errmessage */
- return (MNOMEM);
- }
- } else {
- note("Getsecure failed\n");
- return (MNOMEM);
- }
-
- /* update internal jobs list: Request_list */
- if (prs = request_by_id(rp->secure->req_id)) {
- free(prs->secure->req_id);
- prs->secure->req_id = strdup(securep->req_id);
-
- /*
- * We calloc'd securep->reqid earlier, now we free it
- * here because we no longer call 'freesecure' from
- * Putsecure() if we use a static structure
- */
-
- free(securep->req_id);
- } else {
- note("request_by_id failed\n");
- return (MUNKNOWN);
- }
-
- /*
- * If the request was being filtered or was printing,
- * it would have been stopped in "validate_request()",
- * but only if it has to be refiltered. Thus, the
- * filtering has been stopped if it has to be stopped,
- * but the printing may still be going.
- */
- if (rp->request->outcome & RS_PRINTING &&
- !(rp->request->outcome & RS_STOPPED)) {
- rp->request->outcome |= RS_STOPPED;
- terminate(oldexec);
- }
-
- maybe_schedule(rp);
- return (MOK);
- }
-
- Free(rp->request->destination);
- rp->request->destination = olddest;
- return (stat);
-}
-
-/*
- * s_move_request()
- */
-
-void
-s_move_request(char *m, MESG *md)
-{
- RSTATUS *rp;
- short err;
- char *req_id;
- char *dest;
-
- (void) getmessage(m, S_MOVE_REQUEST, &req_id, &dest);
- syslog(LOG_DEBUG, "s_move_request(%s, %s)", (req_id ? req_id : "NULL"),
- (dest ? dest : "NULL"));
-
-
- if (!(search_pstatus(dest)) && !(search_cstatus(dest))) {
- mputm(md, R_MOVE_REQUEST, MNODEST, 0L);
- return;
- }
-
- if ((rp = request_by_id(req_id))) {
- if (STREQU(rp->request->destination, dest)) {
- mputm(md, R_MOVE_REQUEST, MOK, 0L);
- return;
- }
- if (rp->request->outcome & (RS_DONE|RS_NOTIFYING)) {
- mputm(md, R_MOVE_REQUEST, M2LATE, 0L);
- return;
- }
- if (rp->request->outcome & RS_CHANGING) {
- mputm(md, R_MOVE_REQUEST, MBUSY, 0L);
- return;
- }
- if ((err = mv_file(rp, dest)) == MOK) {
- mputm(md, R_MOVE_REQUEST, MOK, 0L);
- return;
- }
- mputm(md, R_MOVE_REQUEST, err, chkprinter_result);
- return;
- }
- mputm(md, R_MOVE_REQUEST, MUNKNOWN, 0L);
-}
-
-/*
- * s_move_dest()
- */
-
-void
-s_move_dest(char *m, MESG *md)
-{
- char *dest;
- char *fromdest;
- RSTATUS *rp;
- char *found = (char *)0;
- short num_ok = 0;
-
- (void) getmessage(m, S_MOVE_DEST, &fromdest, &dest);
- syslog(LOG_DEBUG, "s_move_dest(%s, %s)", (fromdest ? fromdest : "NULL"),
- (dest ? dest : "NULL"));
-
- if (!search_pstatus(fromdest) && !search_cstatus(fromdest)) {
- mputm(md, R_MOVE_DEST, MNODEST, fromdest, 0);
- return;
- }
-
- if (!(search_pstatus(dest)) && !(search_cstatus(dest))) {
- mputm(md, R_MOVE_DEST, MNODEST, dest, 0);
- return;
- }
-
- if (STREQU(dest, fromdest)) {
- mputm(md, R_MOVE_DEST, MOK, "", 0);
- return;
- }
-
- for (rp = Request_List; rp != NULL; rp = rp->next) {
- if ((STREQU(rp->request->destination, fromdest)) &&
- (!(rp->request->outcome &
- (RS_DONE|RS_CHANGING|RS_NOTIFYING)))) {
- if (mv_file(rp, dest) == MOK) {
- num_ok++;
- continue;
- }
- }
-
- if (found)
- mputm(md, R_MOVE_DEST, MMORERR, found, 0);
-
- found = rp->secure->req_id;
- }
-
- if (found)
- mputm(md, R_MOVE_DEST, MERRDEST, found, num_ok);
- else
- mputm(md, R_MOVE_DEST, MOK, "", num_ok);
-}
-
-/*
- * reqpath
- */
-
-static char *
-reqpath(char *file, char **idnumber)
-{
- char *path;
- char *cp;
- char *cp2;
-
- /*
- * /var/spool/lp/tmp/machine/123-0
- * /var/spool/lp/temp/123-0
- * /usr/spool/lp/temp/123-0
- * /usr/spool/lp/tmp/machine/123-0
- * 123-0
- * machine/123-0
- *
- * /var/spool/lp/tmp/machine/123-0 + 123
- */
- if (*file == '/') {
- /*CONSTCOND*/
- if (STRNEQU(file, Lp_Spooldir, strlen(Lp_Spooldir)))
- cp = file + strlen(Lp_Spooldir) + 1;
- else {
- if (STRNEQU(file, "/usr/spool/lp", 13))
- cp = file + strlen("/usr/spool/lp") + 1;
- else {
- *idnumber = NULL;
- return (NULL);
- }
- }
-
- if (STRNEQU(cp, "temp", 4)) {
- cp += 5;
- path = makepath(Local_System, cp, NULL);
- }
- else
- path = Strdup(cp);
- }
- else
- {
- if (strchr(file, '/'))
- path = makepath(file, NULL);
- else
- path = makepath(Local_System, file, NULL);
- }
-
- cp = strrchr(path, '/');
- cp++;
- if ((cp2 = strrchr(cp, '-')) == NULL)
- *idnumber = Strdup(cp);
- else
- {
- *cp2 = '\0';
- *idnumber = Strdup(cp);
- *cp2 = '-';
- }
-
- return (path);
-}
-
-/*
- * The client is sending a peer connection to retrieve label information
- * from. This is used in the event that the client is an intermediary for
- * the actual requestor in a Trusted environment.
- */
-void
-s_pass_peer_connection(char *m, MESG *md)
-{
- short status = MTRANSMITERR;
- char *dest;
- struct strrecvfd recv_fd;
-
- (void) getmessage(m, S_PASS_PEER_CONNECTION);
- syslog(LOG_DEBUG, "s_pass_peer_connection()");
-
- memset(&recv_fd, NULL, sizeof (recv_fd));
- if (ioctl(md->readfd, I_RECVFD, &recv_fd) == 0) {
- int fd = recv_fd.fd;
-
- if (get_peer_label(fd, &md->slabel) == 0) {
- if (md->admin == 1)
- md->admin = -1; /* turn off query privilege */
- status = MOK;
- }
-
- close(fd);
- }
-
- mputm(md, R_PASS_PEER_CONNECTION, status);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/disp2.c b/usr/src/cmd/lp/cmd/lpsched/disp2.c
deleted file mode 100644
index 459367f2dc..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/disp2.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "dispatch.h"
-#include <syslog.h>
-#include <time.h>
-
-char *showForms(PSTATUS *);
-
-/*
- * untidbit_all() - CALL untidbit() FOR A LIST OF TYPES
- */
-
-static void
-untidbit_all (char **printer_types)
-{
- char ** pl;
-
- for (pl = printer_types; *pl; pl++)
- untidbit (*pl);
- return;
-}
-
-/*
- * s_load_printer()
- */
-
-void
-s_load_printer(char *m, MESG *md)
-{
- char *printer;
- ushort status;
- register PRINTER *pp;
- register PSTATUS *pps;
- char **paperDenied;
-
- (void) getmessage(m, S_LOAD_PRINTER, &printer);
- syslog(LOG_DEBUG, "s_load_printer(%s)", (printer ? printer : "NULL"));
-
- if (!*printer)
- /* no printer */
- status = MNODEST;
- else if (!(pp = Getprinter(printer))) {
- /* Strange or missing printer? */
- switch (errno) {
- case EBADF:
- status = MERRDEST;
- break;
- case ENOENT:
- default:
- status = MNODEST;
- break;
- }
- } else if ((pps = search_pstatus(printer))) {
- /* Printer we know about already? */
- PRINTER *op = pps->printer;
-
- pps->printer = pp;
-
- /*
- * Ensure that an old Terminfo type that's no longer
- * needed gets freed, and that an existing type gets
- * reloaded (in case it has been changed).
- */
- untidbit_all (op->printer_types);
- untidbit_all (pp->printer_types);
-
- /*
- * Does an alert get affected?
- * - Different command?
- * - Different wait interval?
- */
- if (pps->alert->active)
- if (!SAME(pp->fault_alert.shcmd,
- op->fault_alert.shcmd) ||
- pp->fault_alert.W != op->fault_alert.W) {
- /*
- * We can't use "cancel_alert()" here
- * because it will remove the message.
- * We'll do half of the cancel, then
- * check if we need to run the new alert,
- * and remove the message if not.
- */
- pps->alert->active = 0;
- terminate (pps->alert->exec);
- if (pp->fault_alert.shcmd)
- alert(A_PRINTER, pps, (RSTATUS *)0,
- (char *)0);
- else
- Unlink (pps->alert->msgfile);
- }
- freeprinter (op);
-
- unload_list (&pps->users_allowed);
- unload_list (&pps->users_denied);
- unload_list (&pps->forms_allowed);
- unload_list (&pps->forms_denied);
- load_userprinter_access(pp->name, &pps->users_allowed,
- &pps->users_denied);
- load_formprinter_access(pp->name, &pps->forms_allowed,
- &pps->forms_denied);
-
- unload_list (&pps->paper_allowed);
- load_paperprinter_access(pp->name, &pps->paper_allowed,
- &paperDenied);
- freelist(paperDenied);
-
- load_sdn (&pps->cpi, pp->cpi);
- load_sdn (&pps->lpi, pp->lpi);
- load_sdn (&pps->plen, pp->plen);
- load_sdn (&pps->pwid, pp->pwid);
-
- pps->last_dial_rc = 0;
- pps->nretry = 0;
-
- /*
- * Evaluate all requests queued for this printer,
- * to make sure they are still eligible. They will
- * get moved to another printer, get (re)filtered,
- * or get canceled.
- */
- (void) queue_repel(pps, 0, (qchk_fnc_type)0);
-
- status = MOK;
- } else if (pp->remote) {
- /* don't really load a remote printer */
- status = MOK;
- } else if ((pps = new_pstatus(pp))) {
- pps->status = PS_DISABLED | PS_REJECTED;
- load_str (&pps->dis_reason, CUZ_NEW_PRINTER);
- load_str (&pps->rej_reason, CUZ_NEW_DEST);
- load_str (&pps->fault_reason, CUZ_PRINTING_OK);
- time (&pps->dis_date);
- time (&pps->rej_date);
-
- dump_pstatus ();
-
- status = MOK;
- } else {
- freeprinter (pp);
- status = MNOSPACE;
- }
-
-
- mputm (md, R_LOAD_PRINTER, status);
- return;
-}
-
-/*
- * s_unload_printer()
- */
-
-static void
-_unload_printer(PSTATUS *pps)
-{
- int i;
-
- if (pps->alert->active)
- cancel_alert (A_PRINTER, pps);
-
- /*
- * Remove this printer from the classes it may be in.
- * This is likely to be redundant, i.e. upon deleting
- * a printer the caller is SUPPOSED TO check all the
- * classes; any that contain the printer will be changed
- * and we should receive a S_LOAD_CLASS message for each
- * to reload the class.
- *
- * HOWEVER, this leaves a (small) window where someone
- * can sneak a request in destined for the CLASS. If
- * we have deleted the printer but still have it in the
- * class, we may have trouble!
- */
- for (i = 0; CStatus != NULL && CStatus[i] != NULL; i++)
- (void) dellist(&(CStatus[i]->class->members),
- pps->printer->name);
-
- free_pstatus(pps);
- /*
- * this is removed from the PStatus table by the caller
- * list_remove((void ***)&PStatus, (void *)pps);
- */
-
- return;
-}
-
-void
-s_unload_printer(char *m, MESG *md)
-{
- char *printer;
- ushort status;
- register PSTATUS *pps;
-
- (void) getmessage(m, S_UNLOAD_PRINTER, &printer);
-
- syslog(LOG_DEBUG, "s_unload_printer(%s)",
- (printer ? printer : "NULL"));
-
- if (!*printer || STREQU(printer, NAME_ALL))
- /* Unload ALL printers */
- if (!Request_List)
- /* If we have ANY requests queued, we can't do it. */
- status = MBUSY;
-
- else {
- int i;
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- _unload_printer (PStatus[i]);
- free(PStatus);
- PStatus = NULL;
- status = MOK;
- }
-
- else if (!(pps = search_pstatus(printer)))
- /* Have we seen this printer before */
- status = MNODEST;
- else {
- /*
- * Note: This routine WILL MOVE requests to another
- * printer. It will not stop until it has gone through
- * the entire list of requests, so all requests that
- * can be moved will be moved. If any couldn't move,
- * however, we don't unload the printer.
- */
- if (queue_repel(pps, 1, (qchk_fnc_type)0))
- status = MOK;
- else
- status = MBUSY;
-
- if (status == MOK) {
- _unload_printer (pps);
- list_remove((void ***)&PStatus, (void *)pps);
- }
- }
-
- if (status == MOK)
- dump_pstatus ();
-
- mputm (md, R_UNLOAD_PRINTER, status);
- return;
-}
-
-/*
- * combineReasons()
- */
-
-static char *
-combineReasons(PSTATUS *pps, char *freeReason)
-{
- char *reason = NULL;
-
- if (pps->status & PS_FAULTED) {
- if ((pps->status & (PS_DISABLED | PS_LATER)) &&
- (!STREQU(pps->dis_reason, CUZ_STOPPED)) &&
- (addstring(&reason, "Fault reason: ") == 0) &&
- (addstring(&reason, pps->fault_reason) == 0) &&
- (addstring(&reason, "\n\tDisable reason: ") == 0) &&
- (addstring(&reason, pps->dis_reason) == 0))
- *freeReason = 1;
-
- else {
- if (reason)
- /* memory allocation failed part way through */
- Free(reason);
-
- reason = pps->fault_reason;
- *freeReason = 0;
- }
- } else {
- reason = pps->dis_reason;
- *freeReason = 0;
- }
- return (reason);
-}
-
-static void
-local_printer_status(MESG *md, PSTATUS *pps, short status)
-{
- char *reason = NULL;
- char freeReason = 0;
- char *formList = NULL;
-
- reason = combineReasons(pps, &freeReason);
- formList = showForms(pps);
-
- send(md, R_INQUIRE_PRINTER_STATUS, status, pps->printer->name,
- (formList ? formList : ""),
- (pps->pwheel_name ? pps->pwheel_name : ""),
- reason, pps->rej_reason, pps->status,
- (pps->request ? pps->request->secure->req_id : ""),
- pps->dis_date, pps->rej_date);
-
- if (formList)
- Free(formList);
-
- if (freeReason)
- Free(reason);
-}
-
-/*
- * s_inquire_printer_status()
- */
-
-void
-s_inquire_printer_status(char *m, MESG *md)
-{
- char *printer;
- register PSTATUS *pps;
-
- (void) getmessage(m, S_INQUIRE_PRINTER_STATUS, &printer);
- syslog(LOG_DEBUG, "s_inquire_printer_status(%s)", printer);
-
- if (!*printer || STREQU(printer, NAME_ALL)) {
- /* inquire about all printers */
- int i;
-
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++) {
- pps = PStatus[i];
- if (PStatus[i + 1] != NULL)
- local_printer_status(md, pps, MOKMORE);
- }
- } else
- /* inquire about a specific printer */
- pps = search_pstatus(printer);
-
- if (pps)
- local_printer_status(md, pps, MOK);
- else {
- mputm(md, R_INQUIRE_PRINTER_STATUS, MNODEST, "", "", "", "",
- "", 0, "", 0L, 0L);
- }
-}
-
-
-/*
- * s_load_class()
- */
-
-void
-s_load_class(char *m, MESG *md)
-{
- char *class;
- ushort status;
- register CLASS *pc;
- register CSTATUS *pcs;
-
- (void) getmessage(m, S_LOAD_CLASS, &class);
- syslog(LOG_DEBUG, "s_load_class(%s)", (class ? class : "NULL"));
-
- if (!*class)
- /* no class defined */
- status = MNODEST;
- else if (!(pc = Getclass(class))) {
- /* Strange or missing class */
- switch (errno) {
- case EBADF:
- status = MERRDEST;
- break;
- case ENOENT:
- default:
- status = MNODEST;
- break;
- }
-
- } else if ((pcs = search_cstatus(class))) {
- /* Class we already know about */
- register RSTATUS *prs;
-
- freeclass (pcs->class);
- pcs->class = pc;
-
- /*
- * Here we go through the list of requests
- * to see who gets affected.
- */
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if (STREQU(prs->request->destination, class)) {
- /*
- * If not still eligible for this class...
- */
- switch (validate_request(prs, (char **)0, 1)) {
- case MOK:
- case MERRDEST: /* rejecting (shouldn't happen) */
- break;
- case MDENYDEST:
- case MNOMOUNT:
- case MNOMEDIA:
- case MNOFILTER:
- default:
- /*
- * ...then too bad!
- */
- cancel (prs, 1);
- break;
- }
- }
-
- status = MOK;
- } else if ((pcs = new_cstatus(pc))) {
- /* Room for new class? */
- pcs->status = CS_REJECTED;
- load_str (&pcs->rej_reason, CUZ_NEW_DEST);
- time (&pcs->rej_date);
-
- dump_cstatus ();
-
- status = MOK;
- } else {
- freeclass (pc);
- status = MNOSPACE;
- }
-
-
- mputm (md, R_LOAD_CLASS, status);
- return;
-}
-
-/*
- * s_unload_class()
- */
-
-static void
-_unload_class(CSTATUS *pcs)
-{
- freeclass (pcs->class);
- if (pcs->rej_reason != NULL)
- Free (pcs->rej_reason);
- Free(pcs);
-
- return;
-}
-
-void
-s_unload_class(char *m, MESG *md)
-{
- char *class;
- ushort status;
- RSTATUS *prs;
- register CSTATUS *pcs;
-
- (void) getmessage(m, S_UNLOAD_CLASS, &class);
- syslog(LOG_DEBUG, "s_unload_class(%s)", (class ? class : "NULL"));
-
- /*
- * Unload ALL classes?
- */
- if (!*class || STREQU(class, NAME_ALL)) {
- int i;
- /*
- * If we have a request queued for a member of ANY
- * class, we can't do it.
- */
- status = MOK;
- for (i = 0; ((CStatus[i] != NULL) && (status == MOK)); i++) {
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if (STREQU(prs->request->destination,
- CStatus[i]->class->name)) {
- status = MBUSY;
- break;
- }
- }
-
- if (status == MOK) {
- for (i = 0; CStatus != NULL && CStatus[i] != NULL; i++)
- _unload_class (CStatus[i]);
- free(CStatus);
- CStatus = NULL;
- }
-
- /*
- * Have we seen this class before?
- */
- } else if (!(pcs = search_cstatus(class)))
- status = MNODEST;
-
- /*
- * Is there even one request queued for this class?
- * If not, we can safely remove it.
- */
- else {
- status = MOK;
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if (STREQU(prs->request->destination, class)) {
- status = MBUSY;
- break;
- }
-
- if (status == MOK) {
- _unload_class (pcs);
- list_remove((void ***)&CStatus, (void *)pcs);
- }
- }
-
- if (status == MOK)
- dump_cstatus ();
-
- mputm (md, R_UNLOAD_CLASS, status);
- return;
-}
-
-/*
- * s_inquire_class()
- */
-
-void
-s_inquire_class(char *m, MESG *md)
-{
- char *class;
- register CSTATUS *pcs;
-
- (void) getmessage(m, S_INQUIRE_CLASS, &class);
- syslog(LOG_DEBUG, "s_inquire_class(%s)", (class ? class : "NULL"));
-
-
-
- if (!*class || STREQU(class, NAME_ALL)) {
- /* inquire about ALL classes */
- int i;
-
- for (i = 0; CStatus != NULL && CStatus[i] != NULL; i++) {
- pcs = CStatus[i];
- if (CStatus[i + 1] != NULL)
- send(md, R_INQUIRE_CLASS, MOKMORE,
- pcs->class->name, pcs->status,
- pcs->rej_reason, pcs->rej_date);
- }
- } else
- /* inquire about a single class */
- pcs = search_cstatus(class);
-
- if (pcs)
- send(md, R_INQUIRE_CLASS, MOK, pcs->class->name, pcs->status,
- pcs->rej_reason, pcs->rej_date);
- else
- mputm (md, R_INQUIRE_CLASS, MNODEST, "", 0, "", 0L);
-
- return;
-}
-
-/*
- * s_paper_allowed()
- */
-
-void
-s_paper_allowed(char *m, MESG *md)
-{
- char *printer;
- char *paperList = NULL;
- register PSTATUS *pps, *ppsnext;
-
- (void) getmessage(m, S_PAPER_ALLOWED, &printer);
- syslog(LOG_DEBUG, "s_paper_allowed(%s)", (printer ? printer : "NULL"));
-
-
- if (!*printer || STREQU(printer, NAME_ALL)) {
- /* inquire about ALL printers */
- int i;
-
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++) {
- pps = PStatus[i];
- if (PStatus[i + 1] != NULL) {
- paperList = sprintlist(pps->paper_allowed);
- send(md, R_PAPER_ALLOWED, MOKMORE,
- pps->printer->name,
- (paperList ? paperList : ""));
- if (paperList)
- Free(paperList);
- }
- }
- } else
- /* inquire about a specific printer */
- pps = search_pstatus(printer);
-
- if (pps) {
- paperList = sprintlist(pps->paper_allowed);
- send(md, R_PAPER_ALLOWED, MOK, pps->printer->name,
- (paperList ? paperList : ""));
- if (paperList)
- Free(paperList);
-
- } else {
- mputm(md, R_PAPER_ALLOWED, MNODEST, "", "");
- }
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/disp3.c b/usr/src/cmd/lp/cmd/lpsched/disp3.c
deleted file mode 100644
index 4d363e7915..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/disp3.c
+++ /dev/null
@@ -1,804 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#include "dispatch.h"
-#include <syslog.h>
-
-/**
- ** remount_form() - MOUNT A FORM WHERE ANOTHER WAS MOUNTED
- **/
-
-void
-remount_form(register PSTATUS *pps, FSTATUS *pfs, short trayNum)
-{
- trayNum--; /* make zero based */
- if (pps->forms && (pps->forms[trayNum].form == pfs)) {
- pps->forms[trayNum].isAvailable = (pfs ? 1 : 0);
- /* force it */
- return; /* nothing to do */
- } else if ((!pps->forms) && (!pfs)) {
- return; /* nothing to do */
- }
-
- /*
- * Unmount the old form.
- */
- if (pps->forms && pps->forms[trayNum].form) {
- register FSTATUS *Opfs = pps->forms[trayNum].form;
-
- pps->forms[trayNum].form = 0;
- pps->forms[trayNum].isAvailable = 1;
- Opfs->mounted--;
-
- /*
- * Unmounting the form may make some print requests
- * no longer printable, because they were accepted
- * only because the form was already mounted.
- * Unmounting the form will also force some requests
- * to another printer (where the form is mounted)
- * so they can print.
- */
- form_in_question = Opfs;
- (void)queue_repel (pps, 0, qchk_form);
-
- /*
- * Maybe an alert is due.
- */
- check_form_alert (Opfs, (_FORM *)0);
- }
-
- /*
- * Mount the new form?
- */
- if (pfs) {
- syslog(LOG_DEBUG, "remount_form add %x(%s) to tray %d\n",
- pfs, (pfs ? pfs->form->name : "NULL"), trayNum);
-
- if (pps && !pps->forms) {
- pps->forms = (PFSTATUS *)calloc((trayNum +1),
- sizeof(PFSTATUS));
- pps->numForms = trayNum + 1;
- }
-
- if (pps && pps->forms && (pps->numForms > trayNum)) {
- pps->forms[trayNum].form = pfs;
- pps->forms[trayNum].isAvailable = 1;
- pfs->mounted++;
- } else {
- return; /* nothing to do, can't mount form,
- so no need to pretend we did */
- }
-
-
- /*
- * Attract all the requests needing this newly mounted
- * form. This may cause some unnecessary shuffling, but
- * we have to ensure requests aren't assigned to a printer
- * without the form mounted, so that the alert check is
- * correct.
- */
- if (pfs->requests) {
- form_in_question = pfs;
- queue_attract (pps, qchk_form, 0);
-
- /*
- * Maybe an alert can be shut off.
- */
- check_form_alert (pfs, (_FORM *)0);
- }
-
- } else {
- /*
- * Attract first request that doesn't need a form mounted.
- * We only need to get one request printing, because it
- * completing will cause the next request to be attracted.
- */
- form_in_question = 0;
- queue_attract (pps, qchk_form, 1);
- }
-
- dump_pstatus ();
-
- return;
-}
-
-/**
- ** remount_pwheel() - MOUNT A PRINT-WHEEL WHERE ANOTHER WAS MOUNTED
- **/
-
-static void
-remount_pwheel(register PSTATUS *pps, char *pwheel_name)
-{
- PWSTATUS *ppws;
-
- if (SAME(pps->pwheel_name, pwheel_name))
- return; /* nothing to do */
-
- /*
- * Unmount the old print wheel
- */
- if (pps->pwheel_name) {
- register PWSTATUS *Oppws = pps->pwheel;
-
- pps->pwheel = 0;
- if (Oppws)
- Oppws->mounted--;
-
- /*
- * Unmounting the print wheel may make some print
- * requests no longer printable, because they were
- * accepted only because the print wheel was already
- * mounted. Unmounting the print wheel will also force
- * some requests to another printer (where the print wheel
- * is mounted) so they can print.
- */
- pwheel_in_question = pps->pwheel_name;
- (void)queue_repel (pps, 0, qchk_pwheel);
-
- unload_str (&pps->pwheel_name);
-
- /*
- * Maybe an alert is due.
- */
- if (Oppws)
- check_pwheel_alert (Oppws, (PWHEEL *)0);
- }
-
- /*
- * Mount the new print wheel?
- */
- if (pwheel_name) {
- load_str (&pps->pwheel_name, pwheel_name);
- if (ppws = search_pwstatus(pwheel_name)) {
- pps->pwheel = ppws;
- ppws->mounted++;
-
- /*
- * Attract all requests needing this newly
- * mounted print wheel. This may cause some
- * unnecessary shuffling, but we have to ensure
- * requests aren't assigned to a printer without
- * the print-wheel mounted, so that the alert
- * check is correct.
- */
- if (ppws->requests) {
- pwheel_in_question = pwheel_name;
- queue_attract (pps, qchk_pwheel, 0);
-
- /*
- * Maybe an alert can be shut off.
- */
- check_pwheel_alert (ppws, (PWHEEL *)0);
- }
-
- } else {
- /*
- * Attract the first request that needs this newly
- * mounted print wheel. If no alert has been
- * defined for the print wheel, we don't know how
- * many requests are queued waiting for it, so we
- * have to do this unconditionally.
- */
- pwheel_in_question = pwheel_name;
- queue_attract (pps, qchk_pwheel, 1);
- }
-
- } else {
- /*
- * Attract the first request that doesn't need a
- * print wheel mounted.
- * We only need to get one request printing, because it
- * completing will cause the next request to be attracted.
- */
- pwheel_in_question = 0;
- queue_attract (pps, qchk_pwheel, 1);
- }
-
- dump_pstatus ();
-
- return;
-}
-
-#define MAX_TRAYS 100
-
-/**
- ** s_max_trays()
- **/
-
-void
-s_max_trays(char *m, MESG *md)
-{
- char *printer;
- ushort status;
- short numTrays;
- register PSTATUS *pps;
- register PFSTATUS *ppfs;
-
- (void) getmessage(m, S_MAX_TRAYS, &printer, &numTrays);
- syslog(LOG_DEBUG, "s_max_trays(%s, %d)", (printer ? printer : "NULL"),
- numTrays);
-
- /* Have we seen this printer before? */
- if (!*printer || !(pps = search_pstatus(printer)))
- status = MNODEST;
-
- /* How about the tray? */
- else if ((numTrays <=0) || (numTrays > MAX_TRAYS))
- status = MNOTRAY;
-
- /* If the printer is currently printing, we can't disturb it. */
- else if (pps->request)
- status = MBUSY;
-
- else if (pps->forms) {
- if (!(ppfs = Realloc(pps->forms,numTrays * sizeof(PFSTATUS))))
- status = MNOMEM;
- else {
- int i;
-
- for (i = pps->numForms; i < numTrays; i++) {
- ppfs[i].form = NULL;
- ppfs[i].isAvailable = 1;
- }
- pps->forms = ppfs;
- pps->numForms = numTrays;
- status = MOK;
- }
- } else if (!(ppfs = Calloc(numTrays,sizeof(PFSTATUS)))) {
- status = MNOMEM;
- } else {
- pps->forms = ppfs;
- pps->numForms = numTrays;
- status = MOK;
- }
- dump_pstatus();
- mputm(md, R_MAX_TRAYS, status);
-}
-
-/**
- ** s_mount()
- **/
-
-void
-s_mount(char *m, MESG *md)
-{
- char *printer, *form, *pwheel_name;
- ushort status;
- register PSTATUS *pps;
- register FSTATUS *pfs;
-
- (void) getmessage(m, S_MOUNT, &printer, &form, &pwheel_name);
- syslog(LOG_DEBUG, "s_mount(%s, %s, %s)", (printer ? printer : "NULL"),
- (form ? form : "NULL"), (pwheel_name ? pwheel_name : "NULL"));
-
- if (!*form && !*pwheel_name)
- status = MNOMEDIA;
-
- /* Have we seen this printer before? */
- else if (!*printer || !(pps = search_pstatus(printer)))
- status = MNODEST;
-
- /* How about the form? */
- else if (*form && !(pfs = search_fstatus(form)))
- status = MNOMEDIA;
-
- /* If the printer is currently printing, we can't disturb it. */
- else if (pps->request)
- status = MBUSY;
-
- else {
- /*
- * Mount them.
- */
- if (*form)
- remount_form (pps, pfs,1);
- if (*pwheel_name)
- remount_pwheel(pps, pwheel_name);
-
- status = MOK;
- }
-
- mputm(md, R_MOUNT, status);
-}
-
-/*
- * s_mount_tray()
- */
-
-void
-s_mount_tray(char *m, MESG *md)
-{
- char *printer, *form, *pwheel_name;
- ushort status;
- short trayNum;
- register PSTATUS *pps;
- register FSTATUS *pfs;
-
- (void) getmessage(m, S_MOUNT_TRAY, &printer, &form, &pwheel_name,
- &trayNum);
- syslog(LOG_DEBUG, "s_mount_tray(%s, %s, %s, %d)",
- (printer ? printer : "NULL"), (form ? form : "NULL"),
- (pwheel_name ? pwheel_name : "NULL"), trayNum);
-
- if (!*form && !*pwheel_name)
- status = MNOMEDIA;
-
- /* Have we seen this printer before? */
- else if (!*printer || !(pps = search_pstatus(printer)))
- status = MNODEST;
-
- /* How about the form? */
- else if (*form && !(pfs = search_fstatus(form)))
- status = MNOMEDIA;
-
- /* How about the tray? */
- else if ((trayNum <=0) || (trayNum > pps->numForms))
- status = MNOTRAY;
-
- /* If the printer is currently printing, we can't disturb it. */
- else if (pps->request)
- status = MBUSY;
-
- else {
- /*
- * Mount them.
- */
- if (*form)
- remount_form(pps, pfs,trayNum);
- if (*pwheel_name)
- remount_pwheel(pps, pwheel_name);
-
- status = MOK;
- }
-
- mputm (md, R_MOUNT_TRAY, status);
-}
-
-/**
- ** s_unmount()
- **/
-
-void
-s_unmount(char *m, MESG *md)
-{
- char *printer,
- *form,
- *pwheel_name;
- ushort status;
- register PSTATUS *pps;
-
- (void)getmessage (m, S_UNMOUNT, &printer, &form, &pwheel_name);
- syslog(LOG_DEBUG, "s_unmount(%s, %s, %s)",
- (printer ? printer : "NULL"), (form ? form : "NULL"),
- (pwheel_name ? pwheel_name : "NULL"));
-
- if (!*form && !*pwheel_name)
- status = MNOMEDIA;
-
- /*
- * Have we seen this printer before?
- */
- else if (!*printer || !(pps = search_pstatus(printer)))
- status = MNODEST;
-
-
- /*
- * If the printer is currently printing a request,
- * we can't unmount the current form/pwheel.
- */
- else if (pps->request)
- status = MBUSY;
-
- else {
- /*
- * Unmount them.
- */
- if (*form)
- remount_form (pps, (FSTATUS *)0,1);
- if (*pwheel_name)
- remount_pwheel (pps, (char *)0);
-
- status = MOK;
- }
-
- mputm (md, R_UNMOUNT, status);
- return;
-}
-/**
- ** s_unmount_tray()
- **/
-
-void
-s_unmount_tray(char *m, MESG *md)
-{
- char *printer,
- *form,
- *pwheel_name;
-
- ushort status;
- short trayNum;
-
- register PSTATUS *pps;
-
- (void)getmessage (m, S_UNMOUNT_TRAY, &printer, &form, &pwheel_name,
- &trayNum);
- syslog(LOG_DEBUG, "s_unmount_tray(%s, %s, %s, %d)",
- (printer ? printer : "NULL"), (form ? form : "NULL"),
- (pwheel_name ? pwheel_name : "NULL"), trayNum);
-
-
- if (!*form && !*pwheel_name)
- status = MNOMEDIA;
-
- else if (!*printer || !(pps = search_pstatus(printer)))
- /* haven't seen this printer before */
- status = MNODEST;
- else if ((trayNum <=0) || (trayNum > pps->numForms))
- /* haven't seen the tray before */
- status = MNOTRAY;
- else if (pps->request)
- /* is the printer busy */
- status = MBUSY;
- else {
- /* Unmount them. */
- if (*form)
- remount_form (pps, (FSTATUS *)0,trayNum);
- if (*pwheel_name)
- remount_pwheel (pps, (char *)0);
-
- status = MOK;
- }
-
- mputm (md, R_UNMOUNT_TRAY, status);
- return;
-}
-
-/**
- ** s_load_form()
- **/
-
-void
-s_load_form(char *m, MESG *md)
-{
- char *form;
- ushort status;
- register _FORM *pf;
- register FSTATUS *pfs;
-
- (void)getmessage (m, S_LOAD_FORM, &form);
- syslog(LOG_DEBUG, "s_load_form(%s)", (form ? form : "NULL"));
-
- if (!*form)
- /* no form specified */
- status = MNODEST;
- else if (!(pf = Getform(form))) {
- /* strange or missing form */
- switch (errno) {
- case EBADF:
- status = MERRDEST;
- break;
- case ENOENT:
- default:
- status = MNODEST;
- break;
- }
-
- } else if ((pfs = search_fstatus(form))) {
- /* Have we seen this form before? */
- unload_list (&pfs->users_allowed);
- unload_list (&pfs->users_denied);
- load_userform_access (
- pf->name,
- &pfs->users_allowed,
- &pfs->users_denied
- );
-
- load_sdn (&pfs->cpi, pf->cpi);
- load_sdn (&pfs->lpi, pf->lpi);
- load_sdn (&pfs->plen, pf->plen);
- load_sdn (&pfs->pwid, pf->pwid);
-
-
- /*
- * These have to be done in the order shown,
- * and after the assignments above, so that all
- * the new information is in place for the
- * checks. An unfortunate side effect is that
- * it is possible for the alert to shut off
- * and then come on again, if (1) enough requests
- * are canceled to drop the level below the old
- * alert threshold, but (2) the new alert threshold
- * is even lower. The final alert will be correct,
- * though.
- */
-
- form_in_question = pfs;
- queue_check (qchk_form);
-
- check_form_alert (pfs, pf);
-
-
- status = MOK;
-
- /*
- * Room for a new form?
- */
- } else if ((pfs = new_fstatus(pf))) {
- /*
- * No alert is possible for a new form, of course,
- * but this routine does a bit more than just check
- * the alert.
- */
- check_form_alert (pfs, pf);
- status = MOK;
- } else {
- free_form (pf);
- status = MNOSPACE;
- }
-
- mputm (md, R_LOAD_FORM, status);
- return;
-}
-
-/**
- ** s_unload_form()
- **/
-
-static void
-_unload_form(register FSTATUS *pfs)
-{
- int i;
- short numForms;
- PFSTATUS *ppfs;
-
- /*
- * Unmount this form everywhere and get rid of it.
- */
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- if (((ppfs = PStatus[i]->forms) != NULL) &&
- ((numForms = PStatus[i]->numForms) > 0)) {
- int j;
- for ( j = 0 ; j < numForms ; j++ )
- if (ppfs[j].form == pfs) ppfs[j].form= NULL;
- }
-
- return;
-}
-
-void
-s_unload_form(char *m, MESG *md)
-{
- char *form;
- ushort status;
- RSTATUS *prs;
- register FSTATUS *pfs;
-
- (void)getmessage (m, S_UNLOAD_FORM, &form);
- syslog(LOG_DEBUG, "s_unload_form(%s)", (form ? form : "NULL"));
-
- if (!*form || STREQU(form, NAME_ALL)) {
- int i;
- /* If we have a request queued for ANY form, we can't do it. */
- status = MOK;
- for (i = 0; FStatus != NULL && FStatus[i] != NULL &&
- status == MOK; i++) {
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if (prs->form == FStatus[i]) {
- status = MBUSY;
- break;
- }
- }
-
- if (status == MOK) {
- for (i = 0; FStatus != NULL && FStatus[i] != NULL; i++)
- _unload_form (FStatus[i]);
- free(FStatus);
- FStatus = NULL;
- }
-
- } else if (!*form || !(pfs = search_fstatus(form)))
- /* Have we seen this form before? */
- status = MNODEST;
- else {
- /* Is there even one request waiting for this form? */
- status = MOK;
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if (prs->form == pfs) {
- status = MBUSY;
- break;
- }
-
- if (status == MOK) {
- _unload_form (pfs);
- list_remove((void ***)&FStatus, (void *)pfs);
- }
- }
-
- mputm (md, R_UNLOAD_FORM, status);
- return;
-}
-
-/**
- ** s_load_printwheel()
- **/
-
-void
-s_load_printwheel(char *m, MESG *md)
-{
- char *pwheel_name;
- ushort status;
- register PWHEEL *ppw;
- register PWSTATUS *ppws;
-
- (void)getmessage (m, S_LOAD_PRINTWHEEL, &pwheel_name);
- syslog(LOG_DEBUG, "s_load_printwheel(%s)",
- (pwheel_name ? pwheel_name : "NULL"));
-
- if (!*pwheel_name)
- /* no printwheel specified */
- status = MNODEST;
- else if (!(ppw = Getpwheel(pwheel_name))) {
- /* Strange or missing print wheel? */
- switch (errno) {
- case EBADF:
- status = MERRDEST;
- break;
- case ENOENT:
- default:
- status = MNODEST;
- break;
- }
- } else if ((ppws = search_pwstatus(pwheel_name))) {
- /* Print wheel we already know about? */
- check_pwheel_alert (ppws, ppw);
- status = MOK;
- } else if ((ppws = new_pwstatus(ppw))) {
- /* Room for a new print wheel? */
- register RSTATUS *prs;
-
- /*
- * Because of the quirky nature of the print wheel
- * structures, i.e. no structure unless an alert has
- * been defined, we have to run through the requests
- * and see which ones are waiting for this print wheel,
- * so we can assign alerts and count pending requests.
- */
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if ((prs->pwheel_name == pwheel_name) &&
- (!one_printer_with_charsets(prs))) {
- prs->pwheel = ppws;
- ppws->requests++;
- }
- check_pwheel_alert (ppws, ppw);
-
- status = MOK;
- } else {
- freepwheel (ppw);
- status = MNOSPACE;
- }
-
- mputm (md, R_LOAD_PRINTWHEEL, status);
- return;
-}
-
-/**
- ** s_unload_printwheel()
- **/
-
-static void
-_unload_pwheel(register PWSTATUS *ppws)
-{
- register PSTATUS *pps;
- register RSTATUS *prs;
- int i;
-
-
- /*
- * ``Unmount'' the alert part of this print wheel everywhere.
- * THIS IS NOT A COMPLETE UNMOUNT, JUST THE ALERT STRUCTURE
- * IS REMOVED.
- */
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- if (PStatus[i]->pwheel == ppws)
- PStatus[i]->pwheel = 0;
-
- /*
- * Remove the alert part from all requests.
- */
- for (prs = Request_List; prs; prs = prs->next)
- if (prs->pwheel == ppws)
- prs->pwheel = 0;
-
- /*
- * Cancel any alert pending. Here we're different from the
- * similar code for unloading a form, because, to be able to
- * unload a form we first require NO requests pending. If no
- * requests are pending there should be no alert to cancel.
- * Print wheels, on the other hand, only exist as names and
- * alerts. We can always unload a ``print wheel'' because
- * all we're really unloading is an alert. Thus, there can
- * be requests queued for the print wheel (the name), and
- * thus there can be an alert running.
- */
- if (ppws->alert->active)
- cancel_alert (A_PWHEEL, ppws);
-
- free_pwstatus(ppws);
-
- return;
-}
-
-void
-s_unload_printwheel(char *m, MESG *md)
-{
- char *pwheel_name;
-
- ushort status;
-
- register PWSTATUS *ppws;
-
-
- /*
- * We don't care if any requests are waiting for the print
- * wheel(s)--what we're removing here is (are) just the alert(s)!
- */
-
- (void)getmessage (m, S_UNLOAD_PRINTWHEEL, &pwheel_name);
- syslog(LOG_DEBUG, "s_unload_printwheel(%s)",
- (pwheel_name ? pwheel_name : "NULL"));
-
-
- /*
- * Remove all print wheel alerts?
- */
- if (!*pwheel_name || STREQU(pwheel_name, NAME_ALL)) {
- int i;
-
- for (i = 0; PWStatus != NULL && PWStatus[i] != NULL; i++)
- _unload_pwheel (PWStatus[i]);
- free(PWStatus);
- PWStatus = NULL;
- status = MOK;
-
- /*
- * Have we seen this print wheel before?
- */
- } else if (!(ppws = search_pwstatus(pwheel_name)))
- status = MNODEST;
-
- else {
- _unload_pwheel (ppws);
- list_remove((void ***)&PWStatus, (void *)ppws);
- status = MOK;
-
- }
-
- mputm (md, R_UNLOAD_PRINTWHEEL, status);
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/disp4.c b/usr/src/cmd/lp/cmd/lpsched/disp4.c
deleted file mode 100644
index bb61d0cddc..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/disp4.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "time.h"
-#include "dispatch.h"
-#include <syslog.h>
-
-
-/**
- ** s_accept_dest()
- **/
-
-void
-s_accept_dest(char *m, MESG *md)
-{
- char *destination;
- ushort status;
- register PSTATUS *pps;
- register CSTATUS *pcs;
-
- getmessage (m, S_ACCEPT_DEST, &destination);
- syslog(LOG_DEBUG, "s_accept_dest(%s)",
- (destination ? destination : "NULL"));
-
- /*
- * Have we seen this destination as a printer?
- */
- if ((pps = search_pstatus(destination)))
- if ((pps->status & PS_REJECTED) == 0)
- status = MERRDEST;
- else {
- pps->status &= ~PS_REJECTED;
- (void) time (&pps->rej_date);
- dump_pstatus ();
- status = MOK;
- }
-
- /*
- * Have we seen this destination as a class?
- */
- else if ((pcs = search_cstatus(destination)))
- if ((pcs->status & CS_REJECTED) == 0)
- status = MERRDEST;
- else {
- pcs->status &= ~CS_REJECTED;
- (void) time (&pcs->rej_date);
- dump_cstatus ();
- status = MOK;
- }
-
- else
- status = MNODEST;
-
- mputm (md, R_ACCEPT_DEST, status);
- return;
-}
-
-/**
- ** s_reject_dest()
- **/
-
-void
-s_reject_dest(char *m, MESG *md)
-{
- char *destination,
- *reason;
- ushort status;
- register PSTATUS *pps;
- register CSTATUS *pcs;
-
-
- getmessage (m, S_REJECT_DEST, &destination, &reason);
- syslog(LOG_DEBUG, "s_reject_dest(%s, %s)",
- (destination ? destination : "NULL"),
- (reason ? reason : "NULL"));
-
- /*
- * Have we seen this destination as a printer?
- */
- if ((pps = search_pstatus(destination)))
- if (pps->status & PS_REJECTED)
- status = MERRDEST;
- else {
- pps->status |= PS_REJECTED;
- (void) time (&pps->rej_date);
- load_str (&pps->rej_reason, reason);
- dump_pstatus ();
- status = MOK;
- }
-
- /*
- * Have we seen this destination as a class?
- */
- else if ((pcs = search_cstatus(destination)))
- if (pcs->status & CS_REJECTED)
- status = MERRDEST;
- else {
- pcs->status |= CS_REJECTED;
- (void) time (&pcs->rej_date);
- load_str (&pcs->rej_reason, reason);
- dump_cstatus ();
- status = MOK;
- }
-
- else
- status = MNODEST;
-
- mputm (md, R_REJECT_DEST, status);
- return;
-}
-
-/**
- ** s_enable_dest()
- **/
-
-void
-s_enable_dest(char *m, MESG *md)
-{
- char *printer;
- ushort status;
- register PSTATUS *pps;
-
-
- getmessage (m, S_ENABLE_DEST, &printer);
- syslog(LOG_DEBUG, "s_enable_dest(%s)", (printer ? printer : "NULL"));
-
- /*
- * Have we seen this printer before?
- */
- if ((pps = search_pstatus(printer)))
- if (enable(pps) == -1)
- status = MERRDEST;
- else
- status = MOK;
- else
- status = MNODEST;
-
- mputm (md, R_ENABLE_DEST, status);
- return;
-}
-
-/**
- ** s_disable_dest()
- **/
-
-void
-s_disable_dest(char *m, MESG *md)
-{
- char *destination,
- *reason,
- *req_id = 0;
- ushort when,
- status;
- register PSTATUS *pps;
-
- getmessage (m, S_DISABLE_DEST, &destination, &reason, &when);
- syslog(LOG_DEBUG, "s_disable_dest(%s, %s, %d)",
- (destination ? destination : "NULL"),
- (reason ? reason : "NULL"), when);
-
-
- /*
- * Have we seen this printer before?
- */
- if ((pps = search_pstatus(destination))) {
-
- /*
- * If we are to cancel a currently printing request,
- * we will send back the request's ID.
- * Save a copy of the ID before calling "disable()",
- * in case the disabling loses it (e.g. the request
- * might get attached to another printer). (Actually,
- * the current implementation won't DETACH the request
- * from this printer until the child process responds,
- * but a future implementation might.)
- */
- if (pps->request && when == 2)
- req_id = Strdup(pps->request->secure->req_id);
-
- if (disable(pps, reason, (int)when) == -1) {
- if (req_id) {
- Free (req_id);
- req_id = 0;
- }
- status = MERRDEST;
- } else
- status = MOK;
-
- } else
- status = MNODEST;
-
- mputm (md, R_DISABLE_DEST, status, NB(req_id));
- if (req_id)
- Free (req_id);
-
- return;
-}
-
-/**
- ** s_load_filter_table()
- **/
-
-void
-s_load_filter_table(char *m, MESG *md)
-{
- ushort status;
-
- syslog(LOG_DEBUG, "s_load_filter_table()");
-
- trash_filters ();
- if (Loadfilters((char *)0) == -1)
- status = MNOOPEN;
- else {
- /*
- * This is what makes changing filters expensive!
- */
- queue_check (qchk_filter);
-
- status = MOK;
- }
-
- mputm (md, R_LOAD_FILTER_TABLE, status);
- return;
-}
-
-/**
- ** s_unload_filter_table()
- **/
-
-void
-s_unload_filter_table(char *m, MESG *md)
-{
- syslog(LOG_DEBUG, "s_unload_filter_table()");
-
- trash_filters ();
-
- /*
- * This is what makes changing filters expensive!
- */
- queue_check (qchk_filter);
-
- mputm (md, R_UNLOAD_FILTER_TABLE, MOK);
- return;
-}
-
-/**
- ** s_load_user_file()
- **/
-
-void
-s_load_user_file(char *m, MESG *md)
-{
- /*
- * The first call to "getuser()" will load the whole file.
- */
- syslog(LOG_DEBUG, "s_load_user_file()");
-
- trashusers ();
-
- mputm (md, R_LOAD_USER_FILE, MOK);
- return;
-}
-
-/**
- ** s_unload_user_file()
- **/
-
-void
-s_unload_user_file(char *m, MESG *md)
-{
- syslog(LOG_DEBUG, "s_unload_user_file()");
-
- trashusers (); /* THIS WON'T DO TRUE UNLOAD, SORRY! */
-
- mputm (md, R_UNLOAD_USER_FILE, MOK);
- return;
-}
-/**
- ** s_shutdown()
- **/
-
-void
-s_shutdown(char *m, MESG *md)
-{
- ushort immediate;
-
- (void)getmessage (m, S_SHUTDOWN, &immediate);
- syslog(LOG_DEBUG, "s_shutdown(%d)", immediate);
-
- switch (md->type) {
- case MD_STREAM:
- case MD_SYS_FIFO:
- case MD_USR_FIFO:
- mputm (md, R_SHUTDOWN, MOK);
- lpshut (immediate);
- /*NOTREACHED*/
- default:
- syslog(LOG_DEBUG,
- "Received S_SHUTDOWN on a type %d connection\n",
- md->type);
- }
-
- return;
-}
-
-/**
- ** s_quiet_alert()
- **/
-
-void
-s_quiet_alert(char *m, MESG *md)
-{
- char *name;
- ushort type,
- status;
- register FSTATUS *pfs;
- register PSTATUS *pps;
- register PWSTATUS *ppws;
-
-
- /*
- * We quiet an alert by cancelling it with "cancel_alert()"
- * and then resetting the active flag. This effectively just
- * terminates the process running the alert but tricks the
- * rest of the Spooler into thinking it is still active.
- * The alert will be reactivated only AFTER "cancel_alert()"
- * has been called (to clear the active flag) and then "alert()"
- * is called again. Thus:
- *
- * For printer faults the alert will be reactivated when:
- * - a fault is found after the current fault has been
- * cleared (i.e. after successful print or after manually
- * enabled).
- *
- * For forms/print-wheels the alert will be reactivated when:
- * - the form/print-wheel becomes mounted and then unmounted
- * again, with too many requests still pending;
- * - the number of requests falls below the threshold and
- * then rises above it again.
- */
-
- (void)getmessage (m, S_QUIET_ALERT, &name, &type);
- syslog(LOG_DEBUG, "s_quiet_alert(%s, %d)", (name ? name : "NULL"),
- type);
-
- if (!*name)
- status = MNODEST;
-
- else switch (type) {
- case QA_FORM:
- if (!(pfs = search_fstatus(name)))
- status = MNODEST;
-
- else if (!pfs->alert->active)
- status = MERRDEST;
-
- else {
- cancel_alert (A_FORM, pfs);
- pfs->alert->active = 1;
- status = MOK;
- }
- break;
-
- case QA_PRINTER:
- if (!(pps = search_pstatus(name)))
- status = MNODEST;
-
- else if (!pps->alert->active)
- status = MERRDEST;
-
- else {
- cancel_alert (A_PRINTER, pps);
- pps->alert->active = 1;
- status = MOK;
- }
- break;
-
- case QA_PRINTWHEEL:
- if (!(ppws = search_pwstatus(name)))
- status = MNODEST;
-
- else if (!ppws->alert->active)
- status = MERRDEST;
-
- else {
- cancel_alert (A_PWHEEL, ppws);
- ppws->alert->active = 1;
- status = MOK;
- }
- break;
- }
-
- mputm (md, R_QUIET_ALERT, status);
- return;
-}
-
-/**
- ** s_send_fault()
- **/
-
-void
-s_send_fault(char *m, MESG *md)
-{
- long key;
- char *printerOrForm, *alert_text;
- ushort status;
- register PSTATUS *pps;
-
- getmessage (m, S_SEND_FAULT, &printerOrForm, &key, &alert_text);
- syslog(LOG_DEBUG, "s_send_fault(%s, %x, %s)",
- (printerOrForm ? printerOrForm : "NULL"), key,
- (alert_text ? alert_text : "NULL"));
-
- if (!(pps = search_pstatus(printerOrForm)) || (!pps->exec) ||
- pps->exec->key != key || !pps->request) {
- status = MERRDEST;
- } else {
- printer_fault(pps, pps->request, alert_text, 0);
- status = MOK;
- }
-
- mputm (md, R_SEND_FAULT, status);
-}
-
-/*
- * s_clear_fault()
- */
-void
-s_clear_fault(char *m, MESG *md)
-{
- long key;
- char *printerOrForm, *alert_text;
- ushort status;
- register PSTATUS *pps;
-
- getmessage(m, S_CLEAR_FAULT, &printerOrForm, &key, &alert_text);
- syslog(LOG_DEBUG, "s_clear_fault(%s, %x, %s)",
- (printerOrForm ? printerOrForm : "NULL"), key,
- (alert_text ? alert_text : "NULL"));
-
-
- if (! (pps = search_pstatus(printerOrForm)) || ((key > 0) &&
- ((!pps->exec) || pps->exec->key != key || !pps->request ))) {
- status = MERRDEST;
- } else {
- clear_printer_fault(pps, alert_text);
- status = MOK;
- }
-
- mputm (md, R_CLEAR_FAULT, status);
-}
-
-
-/*
- * s_paper_changed()
- */
-void
-s_paper_changed(char *m, MESG *md)
-{
- short trayNum, mode, pagesPrinted;
- char *printer, *paper;
- ushort status;
- short chgd = 0;
- register PSTATUS *pps;
- register FSTATUS *pfs,*pfsWas;
-
- getmessage(m, S_PAPER_CHANGED, &printer, &trayNum, &paper, &mode,
- &pagesPrinted);
- syslog(LOG_DEBUG, "s_paper_changed(%s, %d, %s, %d, %d)",
- (printer ? printer : "NULL"), trayNum, (paper ? paper : "NULL"),
- mode, pagesPrinted);
-
- if (!(pps = search_pstatus(printer)))
- status = MNODEST;
- else if ((trayNum <=0) || (trayNum > pps->numForms))
- status = MNOTRAY;
- else {
- status = MOK;
- if (*paper && (pfsWas = pps->forms[trayNum-1].form) &&
- (!STREQU(pfsWas->form->paper,paper))) {
- pfs = search_fptable(paper);
- if (pfs) {
- remount_form(pps, pfs, trayNum);
- chgd = 1;
- } else
- status = MNOMEDIA;
- }
- if ( status == MOK ) {
- pps->forms[trayNum].isAvailable = mode;
- if ((chgd || !mode) && (!pagesPrinted) && pps->exec) {
- if (pps->request)
- pps->request->request->outcome |=
- RS_STOPPED;
- terminate(pps->exec);
- schedule(EV_LATER, 1, EV_INTERF, pps);
- }
- }
- }
- mputm(md, R_PAPER_CHANGED, status);
-}
-
diff --git a/usr/src/cmd/lp/cmd/lpsched/disp5.c b/usr/src/cmd/lp/cmd/lpsched/disp5.c
deleted file mode 100644
index bd3a3dd92c..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/disp5.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "dispatch.h"
-#include <syslog.h>
-
-extern int Net_fd;
-
-extern MESG * Net_md;
-
-/**
- ** s_child_done()
- **/
-
-void
-s_child_done(char *m, MESG *md)
-{
- long key;
- short status;
- short err;
- int i;
-
-
- getmessage (m, S_CHILD_DONE, &key, &status, &err);
- syslog(LOG_DEBUG, "s_child_done(%d, %d, %d)", key, status, err);
-
- for (i = 0; Exec_Table[i] != NULL; i++)
- if ((Exec_Table[i]->key == key) && (Exec_Table[i]->md == md)) {
- EXEC *ep = Exec_Table[i];
-
- syslog(LOG_DEBUG,
- "s_child_done(%d, 0x%8.8x): clearing 0x%8.8x",
- key, md, ep);
- /*
- * Remove the message descriptor from the listen
- * table, then forget about it; we don't want to
- * accidently match this exec-slot to a future,
- * unrelated child.
- */
- DROP_MD (ep->md);
-
- ep->pid = -99;
- ep->status = status;
- ep->Errno = err;
- DoneChildren++;
- }
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/dispatch.h b/usr/src/cmd/lp/cmd/lpsched/dispatch.h
deleted file mode 100644
index ddb109e100..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/dispatch.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4.1.2 */
-
-# include <time.h>
-
-# include "lpsched.h"
-
-void s_accept_dest ( char * , MESG * );
-void s_alloc_files ( char * , MESG * );
-void s_cancel ( char * , MESG * );
-void s_cancel_request ( char * , MESG * );
-void s_complete_job ( char * , MESG * );
-void s_disable_dest ( char * , MESG * );
-void s_enable_dest ( char * , MESG * );
-void s_end_change_request ( char * , MESG * );
-void s_inquire_class ( char * , MESG * );
-void s_inquire_printer_status ( char * , MESG * );
-void s_inquire_request_rank ( char * , MESG * );
-void s_load_class ( char * , MESG * );
-void s_load_filter_table ( char * , MESG * );
-void s_load_form ( char * , MESG * );
-void s_load_printer ( char * , MESG * );
-void s_load_printwheel ( char * , MESG * );
-void s_load_system ( char * , MESG * );
-void s_load_user_file ( char * , MESG * );
-void s_mount ( char * , MESG * );
-void s_move_dest ( char * , MESG * );
-void s_move_request ( char * , MESG * );
-void s_print_request ( char * , MESG * );
-void s_quiet_alert ( char * , MESG * );
-void s_reject_dest ( char * , MESG * );
-void s_send_fault ( char * , MESG * );
-void s_clear_fault ( char * , MESG * );
-void s_shutdown ( char * , MESG * );
-void s_start_change_request ( char * , MESG * );
-void s_unload_class ( char * , MESG * );
-void s_unload_filter_table ( char * , MESG * );
-void s_unload_form ( char * , MESG * );
-void s_unload_printer ( char * , MESG * );
-void s_unload_printwheel ( char * , MESG * );
-void s_unload_system ( char * , MESG * );
-void s_unload_user_file ( char * , MESG * );
-void s_unmount ( char * , MESG * );
-void r_new_child ( char * , MESG * );
-void r_send_job ( char * , MESG * );
-void s_job_completed ( char * , MESG * );
-void s_child_done ( char * , MESG * );
-void s_get_fault_message ( char * , MESG * );
-void s_max_trays ( char * , MESG *);
-void s_mount_tray ( char *, MESG * );
-void s_unmount_tray ( char *, MESG *);
-void s_paper_changed ( char *, MESG *);
-void s_paper_allowed ( char *, MESG *);
-void s_pass_peer_connection ( char * , MESG * );
-
-/**
- ** dispatch_table[]
- **/
-
-/*
- * The dispatch table is used to decide if we should handle
- * a message and which function should be used to handle it.
- *
- * D_ADMIN is set for messages that should be handled
- * only if it came from an administrator. These entries should
- * have a corresponding entry for the R_... message case, that
- * provides a routine for sending back a MNOPERM message to those
- * that aren't administrators. This is needed because the response
- * message varies in size with the message type.
- */
-
-typedef struct DISPATCH {
- void (*fncp)();
- ushort flags;
-} DISPATCH;
-
-#define D_ADMIN 0x01 /* Only "lp" or "root" can use msg. */
-#define D_BADMSG 0x02 /* We should never get this message */
-#define D_SYSTEM 0x04 /* Only siblings may use this message */
diff --git a/usr/src/cmd/lp/cmd/lpsched/disptab.c b/usr/src/cmd/lp/cmd/lpsched/disptab.c
deleted file mode 100644
index f828a4bbd6..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/disptab.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include "dispatch.h"
-#include <syslog.h>
-
-static void r_H(),
- r_HS();
-
-static DISPATCH dispatch_table[] = {
-/* R_BAD_MESSAGE */ 0, D_BADMSG,
-/* S_NEW_QUEUE */ 0, D_BADMSG,
-/* R_NEW_QUEUE */ 0, D_BADMSG,
-/* S_ALLOC_FILES */ s_alloc_files, 0,
-/* R_ALLOC_FILES */ 0, D_BADMSG,
-/* S_PRINT_REQUEST */ s_print_request, 0,
-/* R_PRINT_REQUEST */ 0, D_BADMSG,
-/* S_START_CHANGE_REQUEST */ s_start_change_request, 0,
-/* R_START_CHANGE_REQUEST */ 0, D_BADMSG,
-/* S_END_CHANGE_REQUEST */ s_end_change_request, 0,
-/* R_END_CHANGE_REQUEST */ 0, D_BADMSG,
-/* S_CANCEL_REQUEST */ s_cancel_request, 0,
-/* R_CANCEL_REQUEST */ 0, D_BADMSG,
-/* S_INQUIRE_REQUEST */ 0, D_BADMSG,
-/* R_INQUIRE_REQUEST */ 0, D_BADMSG,
-/* S_LOAD_PRINTER */ s_load_printer, D_ADMIN,
-/* R_LOAD_PRINTER */ r_H, D_BADMSG,
-/* S_UNLOAD_PRINTER */ s_unload_printer, D_ADMIN,
-/* R_UNLOAD_PRINTER */ r_H, D_BADMSG,
-/* S_INQUIRE_PRINTER_STATUS */ s_inquire_printer_status, 0,
-/* R_INQUIRE_PRINTER_STATUS */ 0, D_BADMSG,
-/* S_LOAD_CLASS */ s_load_class, D_ADMIN,
-/* R_LOAD_CLASS */ r_H, D_BADMSG,
-/* S_UNLOAD_CLASS */ s_unload_class, D_ADMIN,
-/* R_UNLOAD_CLASS */ r_H, D_BADMSG,
-/* S_INQUIRE_CLASS */ s_inquire_class, 0,
-/* R_INQUIRE_CLASS */ 0, D_BADMSG,
-/* S_MOUNT */ s_mount, D_ADMIN,
-/* R_MOUNT */ r_H, D_BADMSG,
-/* S_UNMOUNT */ s_unmount, D_ADMIN,
-/* R_UNMOUNT */ r_H, D_BADMSG,
-/* S_MOVE_REQUEST */ s_move_request, D_ADMIN,
-/* R_MOVE_REQUEST */ r_H, D_BADMSG,
-/* S_MOVE_DEST */ s_move_dest, D_ADMIN,
-/* R_MOVE_DEST */ r_HS, D_BADMSG,
-/* S_ACCEPT_DEST */ s_accept_dest, D_ADMIN,
-/* R_ACCEPT_DEST */ r_H, D_BADMSG,
-/* S_REJECT_DEST */ s_reject_dest, D_ADMIN,
-/* R_REJECT_DEST */ r_H, D_BADMSG,
-/* S_ENABLE_DEST */ s_enable_dest, D_ADMIN,
-/* R_ENABLE_DEST */ r_H, D_BADMSG,
-/* S_DISABLE_DEST */ s_disable_dest, D_ADMIN,
-/* R_DISABLE_DEST */ r_HS, D_BADMSG,
-/* S_LOAD_FILTER_TABLE */ s_load_filter_table, D_ADMIN,
-/* R_LOAD_FILTER_TABLE */ r_H, D_BADMSG,
-/* S_UNLOAD_FILTER_TABLE */ s_unload_filter_table, D_ADMIN,
-/* R_UNLOAD_FILTER_TABLE */ r_H, D_BADMSG,
-/* S_LOAD_PRINTWHEEL */ s_load_printwheel, D_ADMIN,
-/* R_LOAD_PRINTWHEEL */ r_H, D_BADMSG,
-/* S_UNLOAD_PRINTWHEEL */ s_unload_printwheel, D_ADMIN,
-/* R_UNLOAD_PRINTWHEEL */ r_H, D_BADMSG,
-/* S_LOAD_USER_FILE */ s_load_user_file, D_ADMIN,
-/* R_LOAD_USER_FILE */ r_H, D_BADMSG,
-/* S_UNLOAD_USER_FILE */ s_unload_user_file, D_ADMIN,
-/* R_UNLOAD_USER_FILE */ r_H, D_BADMSG,
-/* S_LOAD_FORM */ s_load_form, D_ADMIN,
-/* R_LOAD_FORM */ r_H, D_BADMSG,
-/* S_UNLOAD_FORM */ s_unload_form, D_ADMIN,
-/* R_UNLOAD_FORM */ r_H, D_BADMSG,
-/* S_GETSTATUS */ 0, D_ADMIN,
-/* R_GETSTATUS */ 0, D_BADMSG,
-/* S_QUIET_ALERT */ s_quiet_alert, D_ADMIN,
-/* R_QUIET_ALERT */ r_H, D_BADMSG,
-/* S_SEND_FAULT */ s_send_fault, 0,
-/* R_SEND_FAULT */ 0, D_BADMSG,
-/* S_SHUTDOWN */ s_shutdown, D_ADMIN,
-/* R_SHUTDOWN */ r_H, D_BADMSG,
-/* S_GOODBYE */ 0, D_BADMSG,
-/* S_CHILD_DONE */ s_child_done, 0,
-/* I_GET_TYPE */ 0, D_BADMSG,
-/* I_QUEUE_CHK */ 0, D_BADMSG,
-/* R_CONNECT */ 0, D_BADMSG,
-/* S_GET_STATUS */ 0, D_BADMSG,
-/* R_GET_STATUS */ 0, D_BADMSG,
-/* S_INQUIRE_REQUEST_RANK */ s_inquire_request_rank, 0,
-/* R_INQUIRE_REQUEST_RANK */ 0, D_BADMSG,
-/* S_CANCEL */ s_cancel, 0,
-/* R_CANCEL */ 0, D_BADMSG,
-/* S_NEW_CHILD */ 0, D_BADMSG,
-/* R_NEW_CHILD */ 0, D_BADMSG,
-/* S_SEND_JOB */ 0, D_BADMSG,
-/* R_SEND_JOB */ 0, D_BADMSG,
-/* S_JOB_COMPLETED */ 0, D_BADMSG,
-/* R_JOB_COMPLETED */ 0, D_BADMSG,
-/* S_INQUIRE_REMOTE_PRINTER */ 0, D_BADMSG,
-/* R_INQUIRE_REMOTE_PRINTER */ 0, D_BADMSG,
-/* S_LOAD_SYSTEM */ 0, D_BADMSG,
-/* R_LOAD_SYSTEM */ 0, D_BADMSG,
-/* S_UNLOAD_SYSTEM */ 0, D_BADMSG,
-/* R_UNLOAD_SYSTEM */ 0, D_BADMSG,
-/* S_CLEAR_FAULT */ s_clear_fault, 0,
-/* R_CLEAR_FAULT */ 0, D_BADMSG,
-/* S_MOUNT_TRAY */ s_mount_tray, D_ADMIN,
-/* R_MOUNT_TRAY */ r_H, D_BADMSG,
-/* S_UNMOUNT_TRAY */ s_unmount_tray, D_ADMIN,
-/* R_UNMOUNT_TRAY */ r_H, D_BADMSG,
-/* S_MAX_TRAYS */ s_max_trays, D_ADMIN,
-/* R_MAX_TRAYS */ r_H, D_BADMSG,
-/* S_PAPER_CHANGED */ s_paper_changed, 0,
-/* R_PAPER_CHANGED */ 0, D_BADMSG,
-/* S_PAPER_ALLOWED */ s_paper_allowed, 0,
-/* R_PAPER_ALLOWED */ 0, D_BADMSG,
-/* S_PASS_PEER_CONNECTION */ s_pass_peer_connection, 0,
-/* R_PASS_PEER_CONNECTION */ 0, D_BADMSG,
-};
-
-static char *dispatch_names[] = {
-"R_BAD_MESSAGE",
-"S_NEW_QUEUE",
-"R_NEW_QUEUE",
-"S_ALLOC_FILES",
-"R_ALLOC_FILES",
-"S_PRINT_REQUEST",
-"R_PRINT_REQUEST",
-"S_START_CHANGE_REQUEST",
-"R_START_CHANGE_REQUEST",
-"S_END_CHANGE_REQUEST",
-"R_END_CHANGE_REQUEST",
-"S_CANCEL_REQUEST",
-"R_CANCEL_REQUEST",
-"S_INQUIRE_REQUEST",
-"R_INQUIRE_REQUEST",
-"S_LOAD_PRINTER",
-"R_LOAD_PRINTER",
-"S_UNLOAD_PRINTER",
-"R_UNLOAD_PRINTER",
-"S_INQUIRE_PRINTER_STATUS",
-"R_INQUIRE_PRINTER_STATUS",
-"S_LOAD_CLASS",
-"R_LOAD_CLASS",
-"S_UNLOAD_CLASS",
-"R_UNLOAD_CLASS",
-"S_INQUIRE_CLASS",
-"R_INQUIRE_CLASS",
-"S_MOUNT",
-"R_MOUNT",
-"S_UNMOUNT",
-"R_UNMOUNT",
-"S_MOVE_REQUEST",
-"R_MOVE_REQUEST",
-"S_MOVE_DEST",
-"R_MOVE_DEST",
-"S_ACCEPT_DEST",
-"R_ACCEPT_DEST",
-"S_REJECT_DEST",
-"R_REJECT_DEST",
-"S_ENABLE_DEST",
-"R_ENABLE_DEST",
-"S_DISABLE_DEST",
-"R_DISABLE_DEST",
-"S_LOAD_FILTER_TABLE",
-"R_LOAD_FILTER_TABLE",
-"S_UNLOAD_FILTER_TABLE",
-"R_UNLOAD_FILTER_TABLE",
-"S_LOAD_PRINTWHEEL",
-"R_LOAD_PRINTWHEEL",
-"S_UNLOAD_PRINTWHEEL",
-"R_UNLOAD_PRINTWHEEL",
-"S_LOAD_USER_FILE",
-"R_LOAD_USER_FILE",
-"S_UNLOAD_USER_FILE",
-"R_UNLOAD_USER_FILE",
-"S_LOAD_FORM",
-"R_LOAD_FORM",
-"S_UNLOAD_FORM",
-"R_UNLOAD_FORM",
-"S_GETSTATUS",
-"R_GETSTATUS",
-"S_QUIET_ALERT",
-"R_QUIET_ALERT",
-"S_SEND_FAULT",
-"R_SEND_FAULT",
-"S_SHUTDOWN",
-"R_SHUTDOWN",
-"S_GOODBYE",
-"S_CHILD_DONE",
-"I_GET_TYPE",
-"I_QUEUE_CHK",
-"R_CONNECT",
-"S_GET_STATUS",
-"R_GET_STATUS",
-"S_INQUIRE_REQUEST_RANK",
-"R_INQUIRE_REQUEST_RANK",
-"S_CANCEL",
-"R_CANCEL",
-"S_NEW_CHILD",
-"R_NEW_CHILD",
-"S_SEND_JOB",
-"R_SEND_JOB",
-"S_JOB_COMPLETED",
-"R_JOB_COMPLETED",
-"S_INQUIRE_REMOTE_PRINTER",
-"R_INQUIRE_REMOTE_PRINTER",
-"S_LOAD_SYSTEM",
-"R_LOAD_SYSTEM",
-"S_UNLOAD_SYSTEM",
-"R_UNLOAD_SYSTEM",
-"S_CLEAR_FAULT",
-"R_CLEAR_FAULT",
-"S_MOUNT_TRAY",
-"R_MOUNT_TRAY",
-"S_UNMOUNT_TRAY",
-"R_UNMOUNT_TRAY",
-"S_MAX_TRAYS",
-"R_MAX_TRAYS",
-"S_PAPER_CHANGED",
-"R_PAPER_CHANGED",
-"S_PAPER_ALLOWED",
-"R_PAPER_ALLOWED",
-"S_PASS_PEER_CONNECTION",
-"R_PASS_PEER_CONNECTION",
-};
-
-/* see include/msgs.h */
-static char *status_names[] = {
-"MOK",
-"MOKMORE",
-"MOKREMOTE",
-"MMORERR",
-"MNODEST",
-"MERRDEST",
-"MDENYDEST",
-"MNOMEDIA",
-"MDENYMEDIA",
-"MNOFILTER",
-"MNOINFO",
-"MNOMEM",
-"MNOMOUNT",
-"MNOOPEN",
-"MNOPERM",
-"MNOSTART",
-"MUNKNOWN",
-"M2LATE",
-"MNOSPACE",
-"MBUSY",
-"MTRANSMITERR",
-"MNOMORE",
-"MGONEREMOTE",
-"MNOTRAY"
-};
-
-#define LAST_STATUS 23
-
-/*
- * dispatchName() - ROUTINE TO GIVE ASCII DISPATCH NAME
- */
-
-char *
-dispatchName(int type)
-{
- if (type <= 0 || type > LAST_MESSAGE)
- type = 0;
- return (dispatch_names[type]);
-}
-
-char *
-statusName(int status)
-{
- if (status < 0 || status > LAST_STATUS)
- return ("unknown");
- return (status_names[status]);
-}
-
-/*
- * dispatch() - DISPATCH A ROUTINE TO HANDLE A MESSAGE
- */
-
-void
-dispatch(int type, char *m, MESG *md)
-{
- register DISPATCH *pd = &dispatch_table[type];
-
- syslog(LOG_DEBUG, "dispatch(%s, %s, 0x%8.8x)",
- dispatchName(type), m, md);
-
- if (type <= 0 || type >= LAST_MESSAGE || pd->fncp == NULL)
- mputm(md, R_BAD_MESSAGE);
-
- else if (!pd->fncp || pd->flags & D_BADMSG)
- mputm(md, R_BAD_MESSAGE);
-
- else if (pd->flags & D_ADMIN && !md->admin)
- if ((++pd)->fncp)
- (*pd->fncp) (md, type+1);
- else
- mputm(md, R_BAD_MESSAGE);
-
- else if (pd->flags & D_SYSTEM && md->type != MD_CHILD &&
- md->type != MD_BOUND)
- if ((++pd)->fncp)
- (*pd->fncp) (md, type+1);
- else
- mputm(md, R_BAD_MESSAGE);
-
- else
- (*pd->fncp) (m, md);
-}
-
-/*
- * r_H() - SEND MNOPERM RESPONSE MESSAGE
- * r_HS() - SEND MNOPERM RESPONSE MESSAGE
- */
-
-static void
-r_H(MESG *md, int type)
-{
- mputm(md, type, MNOPERM);
-}
-
-static void
-r_HS(MESG *md, int type)
-{
- mputm(md, type, MNOPERM, "");
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/dowait.c b/usr/src/cmd/lp/cmd/lpsched/dowait.c
deleted file mode 100644
index aadd4d34d3..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/dowait.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "lpsched.h"
-#include "ctype.h"
-#include "sys/stat.h"
-#include <syslog.h>
-
-/*
- * Macro to test if we should notify the user.
- */
-#define SHOULD_NOTIFY(PRS) \
- ( \
- (PRS)->request->actions & (ACT_MAIL|ACT_WRITE|ACT_NOTIFY)\
- || (PRS)->request->alert \
- )
-
-static char * geterrbuf ( RSTATUS * );
-
-/**
- ** dowait() - CLEAN UP CHILD THAT HAS FINISHED, RESCHEDULE ANOTHER TASK
- **/
-
-void
-dowait (void)
-{
- int exited,
- killed,
- canned,
- i;
- EXEC *ep;
- char *errbuf = NULL;
- register RSTATUS *prs;
- register PSTATUS *pps;
- register ALERT *pas;
-
- syslog(LOG_DEBUG, "dowait(%d)", DoneChildren);
- while (DoneChildren > 0) {
- DoneChildren--;
-
- for (i = 0; (ep = Exec_Table[i]) != NULL; i++)
- if (ep->pid == -99)
- break;
-
- syslog(LOG_DEBUG, "dowait(): 0x%8.8x", ep);
-
- if (Exec_Table[i] == NULL) /* nothing to cleanup */
- continue;
-
- syslog(LOG_DEBUG, "dowait(): cleaning up 0x%8.8x", ep);
-
- ep->pid = 0;
- ep->key = 0; /* avoid subsequent sneaks */
- if (ep->md)
- DROP_MD(ep->md);
-
- killed = KILLED(ep->status);
- exited = EXITED(ep->status);
-
- syslog(LOG_DEBUG, "dowait(): type %d, killed %d, exited %d",
- ep->type, killed, exited);
-
- switch (ep->type) {
-
- case EX_INTERF:
- /*
- * WARNING: It could be that when we get here
- *
- * pps->request->printer != pps
- *
- * because the request has been assigned to
- * another printer.
- */
- pps = ep->ex.printer;
- prs = pps->request;
- pps->request = 0;
- pps->status &= ~PS_BUSY;
-
- /*
- * If the interface program exited cleanly
- * or with just a user error, the printer
- * is assumed to be working.
- */
- if (0 <= exited && exited < EXEC_EXIT_USER) {
- pps->status &= ~PS_FAULTED;
- if (pps->alert->active)
- cancel_alert (A_PRINTER, pps);
- }
-
- /*
- * If the interface program was killed with
- * SIGTERM, it may have been because we canceled
- * the request, disabled the printer, or for some
- * other reason stopped the request.
- * If so, clear the "killed" flag because that's
- * not the condition of importance here.
- */
- canned = 0;
- if (killed == SIGTERM) {
- if (prs->request->outcome & RS_CANCELLED)
- canned = 1;
-
- if (
- canned
- || pps->status & (PS_DISABLED|PS_FAULTED)
- || prs->request->outcome & RS_STOPPED
- || Shutdown
- )
- killed = 0;
- }
-
- /*
- * If there was standard error output from the
- * interface program, or if the interface program
- * exited with a (user) exit code, or if it got
- * a strange signal, the user should be notified.
- */
- errbuf = geterrbuf(prs);
- if (
- errbuf
- || (0 < exited && exited <= EXEC_EXIT_USER)
- || killed
- ) {
- if (exited != EXIT_RETRY) {
- prs->request->outcome |= RS_FAILED;
- }
- prs->request->outcome |= RS_NOTIFY;
- notify (prs, errbuf, killed, exited, 0);
- if (errbuf)
- Free (errbuf);
-
- /*
- * If the request was canceled, call "notify()"
- * in case we're to notify the user.
- */
- } else if (canned) {
- if (SHOULD_NOTIFY(prs))
- prs->request->outcome |= RS_NOTIFY;
- notify (prs, (char *)0, 0, 0, 0);
-
- /*
- * If the request finished successfully, call
- * "notify()" in case we're to notify the user.
- */
- } else if (exited == 0) {
- prs->request->outcome |= RS_PRINTED;
-
- if (SHOULD_NOTIFY(prs))
- prs->request->outcome |= RS_NOTIFY;
- notify (prs, (char *)0, 0, 0, 0);
- }
-
- /*
- * If the interface program exits with an
- * exit code higher than EXEC_EXIT_USER, it's
- * a special case.
- */
-
- switch (exited) {
-
- case EXEC_EXIT_FAULT:
- printer_fault (pps, prs, 0, 0);
- break;
-
- case EXEC_EXIT_HUP:
- printer_fault (pps, prs, HANGUP_FAULT, 0);
- break;
-
- case EXEC_EXIT_INTR:
- printer_fault (pps, prs, INTERRUPT_FAULT, 0);
- break;
-
- case EXEC_EXIT_PIPE:
- printer_fault (pps, prs, PIPE_FAULT, 0);
- break;
-
- case EXEC_EXIT_EXIT:
- note (
- "Bad exit from interface program for printer %s: %d\n",
- pps->printer->name,
- ep->Errno
- );
- printer_fault (pps, prs, EXIT_FAULT, 0);
- break;
-
- case EXEC_EXIT_NPORT:
- printer_fault (pps, prs, OPEN_FAULT, ep->Errno);
- break;
-
- case EXEC_EXIT_TMOUT:
- printer_fault (pps, prs, TIMEOUT_FAULT, 0);
- break;
-
- case EXEC_EXIT_NOPEN:
- errno = ep->Errno;
- note (
- "Failed to open a print service file (%s).\n",
- PERROR
- );
- break;
-
- case EXEC_EXIT_NEXEC:
- errno = ep->Errno;
- note (
- "Failed to exec child process (%s).\n",
- PERROR
- );
- break;
-
- case EXEC_EXIT_NOMEM:
- mallocfail ();
- break;
-
- case EXEC_EXIT_NFORK:
- errno = ep->Errno;
- note (
- "Failed to fork child process (%s).\n",
- PERROR
- );
- break;
-
- case EXEC_EXIT_NPUSH:
- printer_fault (pps, prs, PUSH_FAULT, ep->Errno);
- break;
-
- default:
- if ((exited & EXEC_EXIT_NMASK) == EXEC_EXIT_NDIAL)
- dial_problem (
- pps,
- prs,
- exited & ~EXEC_EXIT_NMASK
- );
-
- else if (
- exited < -1
- || exited > EXEC_EXIT_USER
- )
- note (
- "Bad exit from exec() for printer %s: %d\n",
- pps->printer->name,
- exited
- );
-
- break;
- }
-
- /*
- * Being in the "dowait()" routine means the
- * interface (and fast filter!) have stopped.
- * If we have a fault and we're expected to try
- * again later, make sure we try again later.
- */
- if (
- (pps->status & PS_FAULTED)
- && !STREQU(pps->printer->fault_rec, NAME_WAIT)
- && !(pps->status & (PS_LATER|PS_DISABLED))
- ) {
- load_str (&pps->dis_reason, CUZ_STOPPED);
- schedule (EV_LATER, WHEN_PRINTER, EV_ENABLE, pps);
- }
-
- prs->request->outcome &= ~(RS_PRINTING|RS_STOPPED);
-
- /*
- * If the printer to which this request was
- * assigned is not able to handle requests now,
- * push waiting requests off on to another
- * printer.
- */
- if (prs->printer->status & (PS_FAULTED|PS_DISABLED|PS_LATER))
- (void)queue_repel (prs->printer, 0, (qchk_fnc_type)0);
-
- /*
- * If the request is now assigned to a different
- * printer, call "schedule()" to fire up an
- * interface. If this request also happens to
- * be dead, or in need of refiltering, it won't
- * get scheduled.
- */
- if (
- prs->printer != pps
- )
- schedule (EV_INTERF, prs->printer);
-
- check_request (prs);
-
- /*
- * Attract the FIRST request that is waiting to
- * print to this printer, unless the printer isn't
- * ready to print another request. We do this
- * even though requests may already be assigned
- * to this printer, because a request NOT assigned
- * might be ahead of them in the queue.
- */
- if (!(pps->status & (PS_FAULTED|PS_DISABLED|PS_LATER)))
- queue_attract (pps, qchk_waiting, 1);
-
- break;
-
- case EX_SLOWF:
- prs = ep->ex.request;
- ep->ex.request = 0;
- prs->exec = 0;
- prs->request->outcome &= ~RS_FILTERING;
-
- /*
- * If the slow filter was killed with SIGTERM,
- * it may have been because we canceled the
- * request, stopped the filtering, or put a
- * change hold on the request. If so, clear
- * the "killed" flag because that's not the
- * condition of importance.
- */
- canned = 0;
- if (killed == SIGTERM){
- if (prs->request->outcome & RS_CANCELLED)
- canned = 1;
-
- if (
- canned
- || prs->request->outcome & RS_STOPPED
- || Shutdown
- )
- killed = 0;
- }
-
- /*
- * If there was standard error output from the
- * slow filter, or if the interface program exited
- * with a non-zero exit code, the user should
- * be notified.
- */
- errbuf = geterrbuf(prs);
- if (prs->request->outcome
- & (RS_REFILTER | RS_STOPPED)) {
- if (errbuf) {
- Free(errbuf);
- errbuf = NULL;
- }
- }
- if (
- errbuf
- || 0 < exited && exited <= EXEC_EXIT_USER
- || killed
- ) {
- prs->request->outcome |= RS_FAILED;
- prs->request->outcome |= RS_NOTIFY;
- notify (prs, errbuf, killed, exited, 1);
- if (errbuf)
- Free (errbuf);
-
-
- /*
- * If the request was canceled, call "notify()"
- * in case we're to notify the user.
- */
- } else if (canned) {
- if (SHOULD_NOTIFY(prs))
- prs->request->outcome |= RS_NOTIFY;
- notify (prs, (char *)0, 0, 0, 1);
-
- /*
- * If the slow filter exited normally, mark
- * the request as finished slow filtering.
- */
- } else if (exited == 0) {
- prs->request->outcome |= RS_FILTERED;
-
- } else if (exited == -1) {
- /*EMPTY*/;
-
- } else if (exited == EXEC_EXIT_NOPEN) {
- errno = ep->Errno;
- note (
- "Failed to open a print service file (%s).\n",
- PERROR
- );
-
- } else if (exited == EXEC_EXIT_NEXEC) {
- errno = ep->Errno;
- note (
- "Failed to exec child process (%s).\n",
- PERROR
- );
-
- } else if (exited == EXEC_EXIT_NOMEM) {
- mallocfail ();
-
- }
-
- prs->request->outcome &= ~RS_STOPPED;
-
- schedule (EV_INTERF, prs->printer);
- if (
- prs->request->outcome & RS_REFILTER
- )
- schedule (EV_SLOWF, prs);
- else
- schedule (EV_SLOWF, (RSTATUS *)0);
-
- check_request (prs);
- break;
-
- case EX_NOTIFY:
- prs = ep->ex.request;
- ep->ex.request = 0;
- prs->exec = 0;
-
- prs->request->outcome &= ~RS_NOTIFYING;
- if (!Shutdown || !killed)
- prs->request->outcome &= ~RS_NOTIFY;
-
- /*
- * Now that this notification process slot
- * has opened up, schedule the next notification
- * (if any).
- */
- schedule (EV_NOTIFY, (RSTATUS *)0);
-
- check_request (prs);
- break;
-
- case EX_ALERT:
- pas = ep->ex.printer->alert;
- goto CleanUpAlert;
-
- case EX_FALERT:
- pas = ep->ex.form->alert;
- goto CleanUpAlert;
-
- case EX_PALERT:
- pas = ep->ex.pwheel->alert;
- /*
- * CAUTION: It may well be that we've removed
- * the print wheel by the time we get here.
- * Only the alert structure (and exec structure)
- * can be considered okay.
- */
-
-CleanUpAlert:
- if (Shutdown)
- break;
-
- if (ep->flags & EXF_RESTART) {
- ep->flags &= ~(EXF_RESTART);
- if (exec(ep->type, ep->ex.form) == 0) {
- pas->active = 1;
- break;
- }
- }
- (void)Unlink (pas->msgfile);
- break;
-
- }
- }
-
- return;
-}
-
-
-/**
- ** geterrbuf() - READ NON-BLANK STANDARD ERROR OUTPUT
- **/
-
-static char *
-geterrbuf(RSTATUS *prs)
-{
- register char *cp;
- int fd,
- n;
- char *buf = 0,
- *file;
- struct stat statbuf;
-
- if (!prs) return(NULL);
-
- file = makereqerr(prs);
- if (
- Stat(file, &statbuf) == 0
- && statbuf.st_size
- && (fd = Open(file, O_RDONLY)) != -1
- ) {
- /*
- * Don't die if we can't allocate space for this
- * file--the file may be huge!
- */
- lp_alloc_fail_handler = 0;
- if ((buf = Malloc(statbuf.st_size + 1)))
- if ((n = Read(fd, buf, statbuf.st_size)) > 0) {
- buf[n] = 0;
-
- /*
- * NOTE: Ignore error output with no
- * printable text. This hides problems we
- * have with some shell scripts that
- * occasionally cause spurious newlines
- * when stopped via SIGTERM. Without this
- * check for non-blank output, stopping
- * a request sometimes causes a request
- * failure.
- */
- for (cp = buf; *cp && isspace(*cp); cp++)
- ;
- if (!*cp) {
- Free (buf);
- buf = 0;
- }
- } else {
- Free (buf);
- buf = 0;
- }
- lp_alloc_fail_handler = mallocfail;
- Close(fd);
- }
- if (file)
- Free (file);
-
- return (buf);
-}
-
-/**
- ** check_request() - CLEAN UP AFTER REQUEST
- **/
-
-void
-check_request(RSTATUS *prs)
-{
- /*
- * If the request is done, decrement the count of requests
- * needing the form or print wheel. Update the disk copy of
- * the request. If we're finished with the request, get rid of it.
- */
- if (prs->request->outcome & RS_DONE) {
- unqueue_form (prs);
- unqueue_pwheel (prs);
- putrequest (prs->req_file, prs->request);
- if (!(prs->request->outcome & (RS_ACTIVE | RS_NOTIFY))) {
- rmfiles (prs, 1);
- free_rstatus (prs);
- }
- }
- return;
-}
-
-/**
- ** check_children()
- **/
-
-void
-check_children(void)
-{
- register int i;
-
- for (i = 0; Exec_Table[i] != NULL; i++)
- if (Exec_Table[i]->pid > 0)
- break;
-
- if (Exec_Table[i] == NULL)
- Shutdown = 2;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/exec.c b/usr/src/cmd/lp/cmd/lpsched/exec.c
deleted file mode 100644
index df88c57f21..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/exec.c
+++ /dev/null
@@ -1,1435 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include <pwd.h>
-#include <zone.h>
-#if defined PS_FAULTED
-#undef PS_FAULTED
-#endif /* PS_FAULTED */
-#include <dial.h>
-
-#include <stdlib.h>
-#include "limits.h"
-#include "stdarg.h"
-#include "wait.h"
-#include "dial.h"
-#include "lpsched.h"
-#include <syslog.h>
-#include "tsol/label.h"
-
-#define Done(EC,ERRNO) done(((EC) << 8),ERRNO)
-
-#define STRLCAT(dst, src, size) \
- if (strlcat((dst), (src), (size)) >= (size)) { \
- errno = EINVAL; \
- return (-1); \
- }
-
-static MESG * ChildMd;
-
-static int ChildPid;
-static int WaitedChildPid;
-static int do_undial;
-
-static char argbuf[ARG_MAX];
-
-static long key;
-
-static void sigtrap ( int );
-static void done ( int , int );
-static void cool_heels ( void );
-static void addenv (char ***envp, char * , char * );
-static void trap_fault_signals ( void );
-static void ignore_fault_signals ( void );
-static void child_mallocfail ( void );
-static void Fork2 ( void );
-
-static int Fork1 ( EXEC * );
-
-static void
-relock(void)
-{
- struct flock l;
-
- l.l_type = F_WRLCK;
- l.l_whence = 1;
- l.l_start = 0;
- l.l_len = 0;
- (void)Fcntl (lock_fd, F_SETLK, &l);
- return;
-}
-
-static char *_exec_name(int type)
-{
- static char *_names[] = {
- "", "EX_INTERF", "EX_SLOWF", "EX_ALERT", "EX_FALERT", "EX_PALERT",
- "EX_NOTIFY", "EX_FAULT_MESSAGE", "EX_FORM_MESSAGE", NULL };
-
- if ((type < 0) || (type > EX_FORM_MESSAGE))
- return ("BAD_EXEC_TYPE");
- else
- return (_names[type]);
-}
-
-/*
- * This function replaces characters in a string that might be used
- * to exploit a security hole. Replace command seperators (`, &, ;, |, ^),
- * output redirection (>, |), variable expansion ($), and character
- * escape (\).
- *
- * Bugid 4141687
- * Add ( ) < * ? [
- * Bugid 4139071
- * Remove \
- */
-void clean_string(char *ptr)
-{
- char *cp;
- wchar_t wc;
- size_t len;
-
- for (cp = ptr; *cp != NULL; ) {
- if ((len = mbtowc(&wc, cp, MB_CUR_MAX)) == -1) {
- cp++;
- continue;
- }
-
- if (len == 1 &&
- ((wc == L'`') || (wc == L'&') || (wc == L';') ||
- (wc == L'|') || (wc == L'>') || (wc == L'^') ||
- (wc == L'$') || (wc == L'(') || (wc == L')') ||
- (wc == L'<') || (wc == L'*') || (wc == L'?') ||
- (wc == L'[')))
- *cp = '_';
- cp += len;
- }
-}
-
-enum trust {TRUSTED, UNTRUSTED};
-
-static char *arg_string(enum trust type, char *fmt, ...) __PRINTFLIKE(2);
-
-/* PRINTFLIKE2 */
-static char *
-arg_string(enum trust type, char *fmt, ...)
-{
- char buf[BUFSIZ];
- va_list args;
-
- va_start(args, fmt);
- (void) vsnprintf(buf, sizeof(buf), fmt, args);
- va_end(args);
-
- /*
- * If the string contains data from an untrusted origin (user supplied),
- * clean it up in case one of our progeny is a shell script and isn't
- * careful about checking its input.
- */
- if (type == UNTRUSTED)
- clean_string(buf);
-
- return (strdup(buf));
-}
-
-/* stolen from libc/gen/port/gen/execvp.c */
-static const char *
-execat(const char *s1, const char *s2, char *si)
-{
- char *s;
- int cnt = PATH_MAX + 1; /* number of characters in s2 */
-
- s = si;
- while (*s1 && *s1 != ':') {
- if (cnt > 0) {
- *s++ = *s1++;
- cnt--;
- } else
- s1++;
- }
- if (si != s && cnt > 0) {
- *s++ = '/';
- cnt--;
- }
- while (*s2 && cnt > 0) {
- *s++ = *s2++;
- cnt--;
- }
- *s = '\0';
- return (*s1 ? ++s1: 0);
-}
-
-/*
- * Similiar to execvp(), execpt you can supply an environment and we always
- * use /bin/sh for shell scripts. The PATH searched is the PATH in the
- * current environment, not the environment in the argument list.
- * This was pretty much stolen from libc/gen/port/execvp.c
- */
-static int
-execvpe(char *name, char *const argv[], char *const envp[])
-{
- char *path;
- char fname[PATH_MAX+2];
- char *newargs[256];
- int i;
- const char *cp;
- unsigned etxtbsy = 1;
- int eacces = 0;
-
- if (*name == '\0') {
- errno = ENOENT;
- return (-1);
- }
-
- if ((path = getenv("PATH")) == NULL)
- path = "/usr/bin:/bin";
-
- cp = strchr(name, '/')? (const char *)"": path;
-
- do {
- cp = execat(cp, name, fname);
- retry:
- /*
- * 4025035 and 4038378
- * if a filename begins with a "-" prepend "./" so that
- * the shell can't interpret it as an option
- */
- if (*fname == '-') {
- size_t size = strlen(fname) + 1;
- if ((size + 2) > sizeof (fname)) {
- errno = E2BIG;
- return (-1);
- }
- (void) memmove(fname + 2, fname, size);
- fname[0] = '.';
- fname[1] = '/';
- }
- (void) execve(fname, argv, envp);
- switch (errno) {
- case ENOEXEC:
- newargs[0] = "sh";
- newargs[1] = fname;
- for (i = 1; (newargs[i + 1] = argv[i]) != NULL; ++i) {
- if (i >= 254) {
- errno = E2BIG;
- return (-1);
- }
- }
- (void) execve("/bin/sh", newargs, envp);
- return (-1);
- case ETXTBSY:
- if (++etxtbsy > 5)
- return (-1);
- (void) sleep(etxtbsy);
- goto retry;
- case EACCES:
- ++eacces;
- break;
- case ENOMEM:
- case E2BIG:
- case EFAULT:
- return (-1);
- }
- } while (cp);
- if (eacces)
- errno = EACCES;
- return (-1);
-}
-
-static char time_buf[50];
-
-/**
- ** exec() - FORK AND EXEC CHILD PROCESS
- **/
-
-/*VARARGS1*/
-int
-exec(int type, ...)
-{
- va_list args;
-
- int i;
- int procuid;
- int procgid;
- int ret;
- int fr_flg;
-
- char *cp;
- char *infile;
- char *outfile;
- char *errfile;
- char *sep;
-
- char **listp;
- char **file_list;
- char *printerName;
- char *printerNameToShow;
- static char nameBuf[100];
- char *clean_title;
-
- PSTATUS *printer;
-
- RSTATUS *request;
-
- FSTATUS *form;
-
- EXEC *ep;
-
- PWSTATUS *pwheel;
- time_t now;
- struct passwd *pwp;
-#ifdef LP_USE_PAPI_ATTR
- struct stat tmpBuf;
- char tmpName[BUFSIZ];
- char *path = NULL;
-#endif
- char *av[ARG_MAX];
- char **envp = NULL;
- int ac = 0;
- char *mail_zonename = NULL;
- char *slabel = NULL;
- int setid = 1;
- char *ridno = NULL, *tmprid = NULL;
-
- syslog(LOG_DEBUG, "exec(%s)", _exec_name(type));
-
- memset(av, 0, sizeof (*av));
-
- va_start (args, type);
-
- switch (type) {
-
- case EX_INTERF:
- printer = va_arg(args, PSTATUS *);
- request = printer->request;
- ep = printer->exec;
- break;
-
- case EX_FAULT_MESSAGE:
- printer = va_arg(args, PSTATUS *);
- request = va_arg(args, RSTATUS *);
- if (! ( printer->status & (PS_FORM_FAULT | PS_SHOW_FAULT))) {
- return(0);
- }
- ep = printer->fault_exec;
- printerName = (printer->printer && printer->printer->name
- ? printer->printer->name : "??");
- snprintf(nameBuf, sizeof (nameBuf),
- "%s (on %s)\n", printerName, Local_System);
-
- printerNameToShow = nameBuf;
-
- (void) time(&now);
- (void) strftime(time_buf, sizeof (time_buf),
- NULL, localtime(&now));
- break;
-
- case EX_SLOWF:
- request = va_arg(args, RSTATUS *);
- ep = request->exec;
- break;
-
- case EX_NOTIFY:
- request = va_arg(args, RSTATUS *);
- if (request->request->actions & ACT_NOTIFY) {
- errno = EINVAL;
- return (-1);
- }
- ep = request->exec;
- break;
-
- case EX_ALERT:
- printer = va_arg(args, PSTATUS *);
- if (!(printer->printer->fault_alert.shcmd)) {
- errno = EINVAL;
- return(-1);
- }
- ep = printer->alert->exec;
- break;
-
- case EX_PALERT:
- pwheel = va_arg(args, PWSTATUS *);
- ep = pwheel->alert->exec;
- break;
-
- case EX_FORM_MESSAGE:
- (void) time(&now);
- (void) strftime(time_buf, sizeof (time_buf),
- NULL, localtime(&now));
-
- /*FALLTHRU*/
- case EX_FALERT:
- form = va_arg(args, FSTATUS *);
- ep = form->alert->exec;
- break;
-
- default:
- errno = EINVAL;
- return(-1);
-
- }
- va_end (args);
-
- if (!ep || (ep->pid > 0)) {
- errno = EBUSY;
- return(-1);
- }
-
- ep->flags = 0;
-
- key = ep->key = getkey();
-
- switch ((ep->pid = Fork1(ep))) {
-
- case -1:
- relock ();
- return(-1);
-
- case 0:
- /*
- * We want to be able to tell our parent how we died.
- */
- lp_alloc_fail_handler = child_mallocfail;
- break;
-
- default:
- switch(type) {
-
- case EX_INTERF:
- request->request->outcome |= RS_PRINTING;
- break;
-
- case EX_NOTIFY:
- request->request->outcome |= RS_NOTIFYING;
- break;
-
- case EX_SLOWF:
- request->request->outcome |= RS_FILTERING;
- request->request->outcome &= ~RS_REFILTER;
- break;
-
- }
- return(0);
-
- }
-
- for (i = 0; i < NSIG; i++)
- (void)signal (i, SIG_DFL);
- (void)signal (SIGALRM, SIG_IGN);
- (void)signal (SIGTERM, sigtrap);
-
- closelog();
- for (i = 0; i < OpenMax; i++)
- if (i != ChildMd->writefd)
- Close (i);
- openlog("lpsched", LOG_PID|LOG_NDELAY|LOG_NOWAIT, LOG_LPR);
-
- setpgrp();
-
- /* Set a default path */
- addenv (&envp, "PATH", "/usr/lib/lp/bin:/usr/bin:/bin:/usr/sbin:/sbin");
- /* copy locale related variables */
- addenv (&envp, "TZ", getenv("TZ"));
- addenv (&envp, "LANG", getenv("LANG"));
- addenv (&envp, "LC_ALL", getenv("LC_ALL"));
- addenv (&envp, "LC_COLLATE", getenv("LC_COLLATE"));
- addenv (&envp, "LC_CTYPE", getenv("LC_CTYPE"));
- addenv (&envp, "LC_MESSAGES", getenv("LC_MESSAGES"));
- addenv (&envp, "LC_MONETARY", getenv("LC_MONETARY"));
- addenv (&envp, "LC_NUMERIC", getenv("LC_NUMERIC"));
- addenv (&envp, "LC_TIME", getenv("LC_TIME"));
-
- sprintf ((cp = BIGGEST_NUMBER_S), "%ld", key);
- addenv (&envp, "SPOOLER_KEY", cp);
-
-#if defined(DEBUG)
- addenv (&envp, "LPDEBUG", (debug? "1" : "0"));
-#endif
-
- /*
- * Open the standard input, standard output, and standard error.
- */
- switch (type) {
-
- case EX_SLOWF:
- case EX_INTERF:
- /*
- * stdin: /dev/null
- * stdout: /dev/null (EX_SLOWF), printer port (EX_INTERF)
- * stderr: req#
- */
- infile = 0;
- outfile = 0;
- errfile = makereqerr(request);
- break;
-
- case EX_NOTIFY:
- /*
- * stdin: req#
- * stdout: /dev/null
- * stderr: /dev/null
- */
- infile = makereqerr(request);
- outfile = 0;
- errfile = 0;
-
- break;
-
- case EX_ALERT:
- case EX_FALERT:
- case EX_PALERT:
- case EX_FAULT_MESSAGE:
- case EX_FORM_MESSAGE:
- /*
- * stdin: /dev/null
- * stdout: /dev/null
- * stderr: /dev/null
- */
- infile = 0;
- outfile = 0;
- errfile = 0;
- break;
-
- }
-
- if (infile) {
- if (Open(infile, O_RDONLY) == -1)
- Done (EXEC_EXIT_NOPEN, errno);
- } else {
- if (Open("/dev/null", O_RDONLY) == -1)
- Done (EXEC_EXIT_NOPEN, errno);
- }
-
- if (outfile) {
- if (Open(outfile, O_CREAT|O_TRUNC|O_WRONLY, 0600) == -1)
- Done (EXEC_EXIT_NOPEN, errno);
- } else {
- /*
- * If EX_INTERF, this is still needed to cause the
- * standard error channel to be #2.
- */
- if (Open("/dev/null", O_WRONLY) == -1)
- Done (EXEC_EXIT_NOPEN, errno);
- }
-
- if (errfile) {
- if (Open(errfile, O_CREAT|O_TRUNC|O_WRONLY, 0600) == -1)
- Done (EXEC_EXIT_NOPEN, errno);
- } else {
- if (Open("/dev/null", O_WRONLY) == -1)
- Done (EXEC_EXIT_NOPEN, errno);
- }
-
- switch (type) {
-
- case EX_INTERF:
- /*
- * Opening a ``port'' can be dangerous to our health:
- *
- * - Hangups can occur if the line is dropped.
- * - The printer may send an interrupt.
- * - A FIFO may be closed, generating SIGPIPE.
- *
- * We catch these so we can complain nicely.
- */
- trap_fault_signals ();
-
- (void)Close (1);
-
- procuid = request->secure->uid;
- procgid = request->secure->gid;
-
- if (printer->printer->dial_info)
- {
- ret = open_dialup(request->printer_type,
- printer->printer);
- if (ret == 0)
- do_undial = 1;
- }
- else
- {
- ret = open_direct(request->printer_type,
- printer->printer);
- do_undial = 0;
- /* this is a URI */
- if (is_printer_uri(printer->printer->device) == 0)
- addenv(&envp, "DEVICE_URI",
- printer->printer->device);
- }
- addenv(&envp, "DEVICE_URI",
- printer->printer->device);
- if (ret != 0)
- Done (ret, errno);
-
- if (!(request->request->outcome & RS_FILTERED))
- file_list = request->request->file_list;
-
- else {
- register int count = 0;
- register char * num = BIGGEST_REQID_S;
- register char * prefix;
-
- prefix = makestr(
- Lp_Temp,
- "/F",
- getreqno(request->secure->req_id),
- "-",
- (char *)0
- );
-
- file_list = (char **)Malloc(
- (lenlist(request->request->file_list) + 1)
- * sizeof(char *)
- );
-
- for (
- listp = request->request->file_list;
- *listp;
- listp++
- ) {
- sprintf (num, "%d", count + 1);
- file_list[count] = makestr(
- prefix,
- num,
- (char *)0
- );
- count++;
- }
- file_list[count] = 0;
- }
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * Check if the PAPI job attribute file exists, if it does
- * pass the file's pathname to the printer interface script
- * in an environment variable. This file is created when
- * print jobs are submitted via the PAPI interface.
- */
- snprintf(tmpName, sizeof (tmpName), "%s-%s",
- getreqno(request->secure->req_id), LP_PAPIATTRNAME);
- path = makepath(Lp_Temp, tmpName, (char *)0);
- if ((path != NULL) && (stat(path, &tmpBuf) == 0))
- {
- /*
- * IPP job attribute file exists for this job so
- * set the environment variable
- */
- addenv(&envp, "ATTRPATH", path);
- }
- Free(path);
-
- /*
- * now set environment variable for the printer's PostScript
- * Printer Description (PPD) file, this is used by the filter
- * when forming the print data for this printer.
- */
- if ((request->printer != NULL) &&
- (request->printer->printer != NULL) &&
- (request->printer->printer->name != NULL))
- {
- snprintf(tmpName, sizeof (tmpName), "%s.ppd",
- request->printer->printer->name);
- path = makepath(ETCDIR, "ppd", tmpName, (char *)0);
- if ((path != NULL) && (stat(path, &tmpBuf) == 0))
- {
- addenv(&envp, "PPD", path);
- }
- Free(path);
- }
-#endif
-
- if (request->printer_type)
- addenv(&envp, "TERM", request->printer_type);
-
- if (!(printer->printer->daisy)) {
- register char * chset = 0;
- register char * csp;
-
- if (
- request->form
- && request->form->form->chset
- && request->form->form->mandatory
- && !STREQU(NAME_ANY, request->form->form->chset)
- )
- chset = request->form->form->chset;
-
- else if (
- request->request->charset
- && !STREQU(NAME_ANY, request->request->charset)
- )
- chset = request->request->charset;
-
- if (chset) {
- csp = search_cslist(
- chset,
- printer->printer->char_sets
- );
-
- /*
- * The "strtok()" below wrecks the string
- * for future use, but this is a child
- * process where it won't be needed again.
- */
- addenv (&envp, "CHARSET",
- (csp? strtok(csp, "=") : chset)
- );
- }
- }
-
- if (request->fast)
- addenv(&envp, "FILTER", request->fast);
-
- /*
- * Add the sensitivity label to the environment for
- * banner page and header/footer processing
- */
-
- if (is_system_labeled() && request->secure->slabel != NULL)
- addenv(&envp, "SLABEL", request->secure->slabel);
-
- /*
- * Add the system name to the user name (ala system!user)
- * unless it is already there. RFS users may have trouble
- * here, sorry!
- */
- cp = strchr(request->secure->user, '@');
-
- allTraysWithForm(printer, request->form);
-
- /*
- * Fix for 4137389
- * Remove double quotes from title string.
- */
- fr_flg = 1;
- clean_title = strdup(NB(request->request->title));
- if (clean_title == NULL) {
- /*
- * strdup failed. We're probably hosed
- * but try setting clean_title
- * to original title and continuing.
- */
- clean_title = NB(request->request->title);
- fr_flg = 0;
- } else if (strcmp(clean_title, "") != 0) {
- char *ct_p;
-
- for (ct_p = clean_title; *ct_p != NULL; ct_p++) {
- if (*ct_p == '"')
- *ct_p = ' ';
- }
- }
-
- av[ac++] = arg_string(TRUSTED, "%s/%s", Lp_A_Interfaces,
- printer->printer->name);
- /*
- * Read the options field of the request
- * In case of remote lpd request
- * the options field will have
- * job-id-requested. This is the
- * id sent by the client
- */
- if (request->request->options != NULL) {
- char *options = NULL, *temp = NULL;
- options = temp = strdup(request->request->options);
-
- /*
- * Search for job-id-requested in
- * options string
- */
- options = strstr(options, "job-id-requested");
- if (options != NULL) {
- /*
- * Extract the ridno from the string
- * job-id-requested=xxx
- * In this case ridno = xxx
- */
- if (STRNEQU(options, "job-id-requested=", 17)) {
- ridno = strdup(options + 17);
- tmprid = strstr(ridno, " ");
- if (ridno != NULL) {
- /*
- * Read job-id-requested
- * successfully
- */
- tmprid = strstr(ridno, " ");
- if (tmprid != NULL)
- *tmprid = '\0';
-
- setid = 0;
- } else
- /*
- * could not read
- * ridno from the string
- * job-id-requested=xxx
- */
- setid = 1;
- } else
- /*
- * could not read
- * ridno from the string
- * job-id-requested=xxx
- */
- setid = 1;
- } else
- /*
- * No job-id-requested in
- * request options
- */
- setid = 1;
-
- if (temp != NULL)
- free(temp);
-
- } else
- /*
- * options field in request structure
- * not set
- */
- setid = 1;
-
-
- /*
- * setid = 1 means the job-id-requested attribute
- * is not set so read the request->secure->req_id
- */
- if (setid)
- av[ac++] = arg_string(TRUSTED, "%s",
- request->secure->req_id);
- else {
- /*
- * From request->secure->req_id extract the
- * printer-name.
- * request->secure->req_id = <printer-name>-<req_id>
- * The final req-id will be
- * <printer-name>-<ridno>
- */
- char *r1 = NULL, *r2 = NULL, *tmp = NULL;
- r1 = r2 = tmp = strdup(request->secure->req_id);
- r2 = strrchr(r1, '-');
- if (r2 != NULL) {
- char *r3 = NULL;
- int lr1 = strlen(r1);
- int lr2 = strlen(r2);
- r1[lr1 - lr2 + 1] = '\0';
-
- /*
- * Now r1 = <printer-name>-
- */
- lr1 = strlen(r1);
- lr2 = strlen(ridno);
-
- r3 = (char *)malloc(lr1+lr2+1);
- if (r3 != NULL) {
- strcpy(r3, r1);
- strcat(r3, ridno);
- /*
- * Here r3 = <printer-name>-<ridno>
- */
- av[ac++] = arg_string(TRUSTED,
- "%s", r3);
- free(r3);
- } else
- av[ac++] = arg_string(TRUSTED, "%s",
- request->secure->req_id);
-
- } else
- av[ac++] = arg_string(TRUSTED, "%s",
- request->secure->req_id);
-
- if (tmp != NULL)
- free(tmp);
-
- if (ridno != NULL)
- free(ridno);
- }
-
- av[ac++] = arg_string(UNTRUSTED, "%s", request->request->user);
- av[ac++] = arg_string(TRUSTED, "%s", clean_title);
- av[ac++] = arg_string(TRUSTED, "%d", request->copies);
-
- if (fr_flg)
- free (clean_title);
-
- sep = "";
-
- /*
- * Do the administrator defined key=value pair options
- */
-
- argbuf[0] = '\0';
-
- if (printer->printer->options) {
- char **tmp = printer->printer->options;
- while(*tmp != NULL) {
- STRLCAT(argbuf, sep, sizeof (argbuf));
- sep = " ";
- STRLCAT(argbuf, *tmp++, sizeof (argbuf));
- }
- }
-
- /*
- * Do the administrator defined ``stty'' stuff before
- * the user's -o options, to allow the user to override.
- */
- if (printer->printer->stty) {
- STRLCAT (argbuf, sep, sizeof (argbuf));
- sep = " ";
- STRLCAT (argbuf, "stty='", sizeof (argbuf));
- STRLCAT (argbuf, printer->printer->stty,
- sizeof (argbuf));
- STRLCAT (argbuf, "'", sizeof (argbuf));
- }
-
- /*
- * Do all of the user's options except the cpi/lpi/etc.
- * stuff, which is done separately.
- */
- if (request->request->options) {
- listp = dashos(request->request->options);
- while (*listp) {
- if (
- !STRNEQU(*listp, "cpi=", 4)
- && !STRNEQU(*listp, "lpi=", 4)
- && !STRNEQU(*listp, "width=", 6)
- && !STRNEQU(*listp, "length=", 7)
- ) {
- STRLCAT (argbuf, sep, sizeof (argbuf));
- sep = " ";
- STRLCAT (argbuf, *listp,
- sizeof (argbuf));
- }
- listp++;
- }
- }
-
- /*
- * The "pickfilter()" routine (from "validate()")
- * stored the cpi/lpi/etc. stuff that should be
- * used for this request. It chose form over user,
- * and user over printer.
- */
- if (request->cpi) {
- STRLCAT (argbuf, sep, sizeof (argbuf));
- sep = " ";
- STRLCAT (argbuf, "cpi=", sizeof (argbuf));
- STRLCAT (argbuf, request->cpi, sizeof (argbuf));
- }
- if (request->lpi) {
- STRLCAT (argbuf, sep, sizeof (argbuf));
- sep = " ";
- STRLCAT (argbuf, "lpi=", sizeof (argbuf));
- STRLCAT (argbuf, request->lpi, sizeof (argbuf));
- }
- if (request->pwid) {
- STRLCAT (argbuf, sep, sizeof (argbuf));
- sep = " ";
- STRLCAT (argbuf, "width=", sizeof (argbuf));
- STRLCAT (argbuf, request->pwid, sizeof (argbuf));
- }
- if (request->plen) {
- STRLCAT (argbuf, sep, sizeof (argbuf));
- sep = " ";
- STRLCAT (argbuf, "length=", sizeof (argbuf));
- STRLCAT (argbuf, request->plen, sizeof (argbuf));
- }
-
- /*
- * Do the ``raw'' bit last, to ensure it gets
- * done. If the user doesn't want this, then he or
- * she can do the correct thing using -o stty=
- * and leaving out the -r option.
- */
- if (request->request->actions & ACT_RAW) {
- STRLCAT (argbuf, sep, sizeof (argbuf));
- sep = " ";
- STRLCAT (argbuf, "stty=-opost", sizeof (argbuf));
- }
-
-
- /* the "options" */
- av[ac++] = arg_string(UNTRUSTED, "%s", argbuf);
-
- for (listp = file_list; *listp; listp++)
- av[ac++] = arg_string(TRUSTED, "%s", *listp);
-
- (void)chfiles (file_list, procuid, procgid);
-
- break;
-
-
- case EX_SLOWF:
- if (request->slow)
- addenv(&envp, "FILTER", request->slow);
-
- procuid = request->secure->uid;
- procgid = request->secure->gid;
-
- cp = _alloc_files(
- lenlist(request->request->file_list),
- getreqno(request->secure->req_id),
- procuid, procgid);
-
- av[ac++] = arg_string(TRUSTED, "%s", Lp_Slow_Filter);
- av[ac++] = arg_string(TRUSTED, "%s/%s", Lp_Temp, cp);
- for (listp = request->request->file_list; *listp; listp++)
- av[ac++] = arg_string(TRUSTED, "%s", *listp);
-
- (void)chfiles (request->request->file_list, procuid, procgid);
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * Check if the PAPI job attribute file exists, if it does
- * pass the file's pathname to the slow-filters in an
- * environment variable. Note: this file is created when
- * print jobs are submitted via the PAPI interface.
- */
- snprintf(tmpName, sizeof (tmpName), "%s-%s",
- getreqno(request->secure->req_id), LP_PAPIATTRNAME);
- path = makepath(Lp_Temp, tmpName, (char *)0);
- if ((path != NULL) && (stat(path, &tmpBuf) == 0))
- {
- /*
- * IPP job attribute file exists for this job so
- * set the environment variable
- */
- addenv(&envp, "ATTRPATH", path);
- }
- Free(path);
-
-
- /*
- * now set environment variable for the printer's PostScript
- * Printer Description (PPD) file, this is used by the filter
- * when forming the print data for this printer.
- */
- if ((request->printer != NULL) &&
- (request->printer->printer != NULL) &&
- (request->printer->printer->name != NULL))
- {
- snprintf(tmpName, sizeof (tmpName), "%s.ppd",
- request->printer->printer->name);
- path = makepath(ETCDIR, "ppd", tmpName, (char *)0);
- if ((path != NULL) && (stat(path, &tmpBuf) == 0))
- {
- addenv(&envp, "PPD", path);
- }
- Free(path);
- }
-#endif
- break;
-
- case EX_ALERT:
- procuid = Lp_Uid;
- procgid = Lp_Gid;
- (void)Chown (printer->alert->msgfile, procuid, procgid);
-
- av[ac++] = arg_string(TRUSTED, "%s/%s/%s", Lp_A_Printers,
- printer->printer->name, ALERTSHFILE);
- av[ac++] = arg_string(TRUSTED, "%s", printer->alert->msgfile);
-
- break;
-
- case EX_PALERT:
- procuid = Lp_Uid;
- procgid = Lp_Gid;
- (void)Chown (pwheel->alert->msgfile, procuid, procgid);
-
- av[ac++] = arg_string(TRUSTED, "%s/%s/%s", Lp_A_PrintWheels,
- pwheel->pwheel->name, ALERTSHFILE);
- av[ac++] = arg_string(TRUSTED, "%s", printer->alert->msgfile);
-
- break;
-
- case EX_FALERT:
- procuid = Lp_Uid;
- procgid = Lp_Gid;
- (void)Chown (form->alert->msgfile, procuid, procgid);
-
- av[ac++] = arg_string(TRUSTED, "%s/%s/%s", Lp_A_Forms,
- form->form->name, ALERTSHFILE);
- av[ac++] = arg_string(TRUSTED, "%s", printer->alert->msgfile);
-
- break;
-
- case EX_FORM_MESSAGE:
- procuid = Lp_Uid;
- procgid = Lp_Gid;
-
- av[ac++] = arg_string(TRUSTED, "%s/form", Lp_A_Faults);
- av[ac++] = arg_string(TRUSTED, "%s", form->form->name);
- av[ac++] = arg_string(TRUSTED, "%s", time_buf);
- av[ac++] = arg_string(TRUSTED, "%s/%s/%s", Lp_A_Forms,
- form->form->name, FORMMESSAGEFILE);
-
- break;
-
- case EX_FAULT_MESSAGE:
- procuid = Lp_Uid;
- procgid = Lp_Gid;
-
- av[ac++] = arg_string(TRUSTED, "%s/printer", Lp_A_Faults);
- av[ac++] = arg_string(TRUSTED, "%s", printerNameToShow);
- av[ac++] = arg_string(TRUSTED, "%s", time_buf);
- av[ac++] = arg_string(TRUSTED, "%s/%s/%s", Lp_A_Printers,
- printerName, FAULTMESSAGEFILE);
-
- break;
-
- case EX_NOTIFY:
- if (request->request->alert) {
- procuid = request->secure->uid;
- procgid = request->secure->gid;
-
- av[ac++] = arg_string(TRUSTED, "%s",
- request->request->alert);
- } else {
- char *user = strdup(request->request->user);
- clean_string(user);
- slabel = request->secure->slabel;
-
- if (request->request->actions & ACT_WRITE) {
- av[ac++] = arg_string(TRUSTED, "%s", BINWRITE);
- snprintf(argbuf, sizeof (argbuf),
- "%s %s || %s %s",
- BINWRITE, user,
- BINMAIL, user
- );
- av[ac++] = arg_string(TRUSTED, "/bin/sh");
- av[ac++] = arg_string(TRUSTED, "-c");
- av[ac++] = arg_string(TRUSTED, "%s", argbuf);
- } else if ((getzoneid() == GLOBAL_ZONEID) &&
- is_system_labeled() && (slabel != NULL)) {
- /*
- * If in the global zone and the system is
- * labeled, mail is handled via a local
- * labeled zone that is the same label as
- * the request.
- */
- if ((mail_zonename =
- get_labeled_zonename(slabel)) ==
- (char *)-1) {
- /*
- * Cannot find labeled zone, just
- * return 0.
- */
- return(0);
- }
- }
- if (mail_zonename == NULL) {
- procuid = Lp_Uid;
- procgid = Lp_Gid;
- av[ac++] = arg_string(TRUSTED, "%s", BINMAIL);
- av[ac++] = arg_string(UNTRUSTED, "%s", user);
- } else {
- procuid = getuid();
- procgid = getgid();
- av[ac++] = arg_string(TRUSTED, "%s",
- "/usr/sbin/zlogin");
- av[ac++] = arg_string(TRUSTED, "%s",
- mail_zonename);
- av[ac++] = arg_string(TRUSTED, "%s",
- BINMAIL);
- av[ac++] = arg_string(UNTRUSTED, "%s",
- user);
- Free(mail_zonename);
- }
-
- free(user);
- }
- break;
- }
-
- av[ac++] = NULL;
-
- Fork2 ();
- /* only the child returns */
-
- /*
- * Correctly set up the supplemental group list
- * for proper file access (before execl the interface program)
- */
-
- pwp = getpwuid(procuid);
- if (pwp == NULL) {
- note("getpwuid(%d) call failed\n", procuid);
- } else if (initgroups(pwp->pw_name, procgid) < 0) {
- note("initgroups() call failed %d\n", errno);
- }
-
- setgid (procgid);
- setuid (procuid);
-
- /*
- * The shell doesn't allow the "trap" builtin to set a trap
- * for a signal ignored when the shell is started. Thus, don't
- * turn off signals in the last child!
- */
-
-#ifdef DEBUG
- for (i = 0; av[i] != NULL; i++)
- note("exec(%s): av[%d] = %s", _exec_name(type), i, av[i]);
- for (i = 0; envp[i] != NULL; i++)
- note("exec(%s): envp[%d] = %s", _exec_name(type), i, envp[i]);
-#endif
-
- execvpe(av[0], av, envp);
- Done (EXEC_EXIT_NEXEC, errno);
- /*NOTREACHED*/
- return (0);
-}
-
-/**
- ** addenv() - ADD A VARIABLE TO THE ENVIRONMENT
- **/
-
-static void
-addenv(char ***envp, char *name, char *value)
-{
- register char * cp;
-
- if ((name == NULL) || (value == NULL))
- return;
-
- if ((cp = makestr(name, "=", value, (char *)0)))
- addlist(envp, cp);
- return;
-}
-
-/**
- ** Fork1() - FORK FIRST CHILD, SET UP CONNECTION TO IT
- **/
-
-static int
-Fork1(EXEC *ep)
-{
- int pid;
- int fds[2];
-
- if (pipe(fds) == -1) {
- note("Failed to create pipe for child process (%s).\n", PERROR);
- errno = EAGAIN ;
- return(-1);
- }
-
- ep->md = mconnect((char *)0, fds[0], fds[1]);
-
- switch (pid = fork()) {
-
- case -1:
- mdisconnect(ep->md);
- close(fds[0]);
- close(fds[1]);
- ep->md = 0;
- return (-1);
-
- case 0:
- ChildMd = mconnect(NULL, fds[1], fds[1]);
- return (0);
-
- default:
- mlistenadd(ep->md, POLLIN);
- return (pid);
- }
-}
-
-/**
- ** Fork2() - FORK SECOND CHILD AND WAIT FOR IT
- **/
-
-static void
-Fork2(void)
-{
- switch ((ChildPid = fork())) {
-
- case -1:
- Done (EXEC_EXIT_NFORK, errno);
- /*NOTREACHED*/
-
- case 0:
- return;
-
- default:
- /*
- * Delay calling "ignore_fault_signals()" as long
- * as possible, to give the child a chance to exec
- * the interface program and turn on traps.
- */
-
- cool_heels ();
- /*NOTREACHED*/
-
- }
-}
-
-
-/**
- ** cool_heels() - WAIT FOR CHILD TO "DIE"
- **/
-
-static void
-cool_heels(void)
-{
- int status;
-
- /*
- * At this point our only job is to wait for the child process.
- * If we hang out for a bit longer, that's okay.
- * By delaying before turning off the fault signals,
- * we increase the chance that the child process has completed
- * its exec and has turned on the fault traps. Nonetheless,
- * we can't guarantee a zero chance of missing a fault.
- * (We don't want to keep trapping the signals because the
- * interface program is likely to have a better way to handle
- * them; this process provides only rudimentary handling.)
- *
- * Note that on a very busy system, or with a very fast interface
- * program, the tables could be turned: Our sleep below (coupled
- * with a delay in the kernel scheduling us) may cause us to
- * detect the fault instead of the interface program.
- *
- * What we need is a way to synchronize with the child process.
- */
- sleep (1);
- ignore_fault_signals ();
-
- WaitedChildPid = 0;
- while ((WaitedChildPid = wait(&status)) != ChildPid)
- ;
-
- if (
- EXITED(status) > EXEC_EXIT_USER
- && EXITED(status) != EXEC_EXIT_FAULT
- )
- Done (EXEC_EXIT_EXIT, EXITED(status));
-
- done (status, 0); /* Don't use Done() */
- /*NOTREACHED*/
-}
-
-
-/**
- ** trap_fault_signals() - TRAP SIGNALS THAT CAN OCCUR ON PRINTER FAULT
- ** ignore_fault_signals() - IGNORE SAME
- **/
-
-static void
-trap_fault_signals(void)
-{
- signal (SIGHUP, sigtrap);
- signal (SIGINT, sigtrap);
- signal (SIGQUIT, sigtrap);
- signal (SIGPIPE, sigtrap);
- return;
-}
-
-static void
-ignore_fault_signals(void)
-{
- signal (SIGHUP, SIG_IGN);
- signal (SIGINT, SIG_IGN);
- signal (SIGQUIT, SIG_IGN);
- signal (SIGPIPE, SIG_IGN);
- return;
-}
-
-/**
- ** sigtrap() - TRAP VARIOUS SIGNALS
- **/
-
-static void
-sigtrap(int sig)
-{
- signal (sig, SIG_IGN);
- switch (sig) {
-
- case SIGHUP:
- Done (EXEC_EXIT_HUP, 0);
- /*NOTREACHED*/
-
- case SIGQUIT:
- case SIGINT:
- Done (EXEC_EXIT_INTR, 0);
- /*NOTREACHED*/
-
- case SIGPIPE:
- Done (EXEC_EXIT_PIPE, 0);
- /*NOTREACHED*/
-
- case SIGTERM:
- /*
- * If we were killed with SIGTERM, it should have been
- * via the Spooler who should have killed the entire
- * process group. We have to wait for the children,
- * since we're their parent, but WE MAY HAVE WAITED
- * FOR THEM ALREADY (in cool_heels()).
- */
- if (ChildPid != WaitedChildPid) {
- register int cpid;
-
- while (
- (cpid = wait((int *)0)) != ChildPid
- && (cpid != -1 || errno != ECHILD)
- )
- ;
- }
-
- /*
- * We can't rely on getting SIGTERM back in the wait()
- * above, because, for instance, some shells trap SIGTERM
- * and exit instead. Thus we force it.
- */
- done (SIGTERM, 0); /* Don't use Done() */
- /*NOTREACHED*/
- }
-}
-
-/**
- ** done() - TELL SPOOLER THIS CHILD IS DONE
- **/
-
-static void
-done(int status, int err)
-{
- if (do_undial)
- undial (1);
-
- mputm (ChildMd, S_CHILD_DONE, key, status, err);
- mdisconnect (ChildMd);
-
- exit (0);
- /*NOTREACHED*/
-}
-
-/**
- ** child_mallocfail()
- **/
-
-static void
-child_mallocfail(void)
-{
- Done (EXEC_EXIT_NOMEM, ENOMEM);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/faults.c b/usr/src/cmd/lp/cmd/lpsched/faults.c
deleted file mode 100644
index d6ee713356..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/faults.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "lpsched.h"
-#include <syslog.h>
-
-static char *
-shortenReason(char *reason)
-{
- register char *ptr, *pe;
- int peLen;
-
- if (strncmp(reason,"%%[",3) == 0)
- reason += 3;
-
- while (*reason == ' ')
- reason++;
-
- pe = "PrinterError:";
- peLen = strlen(pe);
- if (strncmp(reason,pe,peLen) == 0)
- reason += peLen;
-
- if (((ptr = strchr(reason,']')) != NULL) && (strncmp(ptr,"]%%",3) == 0))
- *ptr = 0;
-
- pe = reason + strlen(reason) -1;
- pe = reason;
- while (pe = strchr(pe,'\n'))
- *pe = ' ';
-
- pe = reason + strlen(reason) -1;
- while ((pe > reason) && (*pe == ' ')) {
- *pe = 0;
- pe--;
- }
- return(reason);
-}
-
-/**
- ** printer_fault() - RECOGNIZE PRINTER FAULT
- **/
-
-void
-printer_fault(register PSTATUS *pps, register RSTATUS *prs, char *alert_text,
- int err)
-{
- register char *why,*shortWhy;
-
- pps->status |= PS_FAULTED;
-
- /* -F wait */
- if (STREQU(pps->printer->fault_rec, NAME_WAIT))
- disable (pps, CUZ_FAULT, DISABLE_STOP);
-
- /* -F beginning */
- else if (STREQU(pps->printer->fault_rec, NAME_BEGINNING))
- terminate (pps->exec);
-
- /* -F continue AND the interface program died */
- else if (!(pps->status & PS_LATER) && !pps->request) {
- load_str (&pps->dis_reason, CUZ_STOPPED);
- schedule (EV_LATER, WHEN_PRINTER, EV_ENABLE, pps);
- }
-
- if (err) {
- errno = err;
- why = makestr(alert_text, "(", PERROR, ")\n", (char *)0);
- } else if (! alert_text)
- why = makestr("exec exit fault", (char *) 0);
- else
- why = makestr(alert_text, (char *) 0);
-
- if (!why)
- why = alert_text;
-
- shortWhy = (why != alert_text ? shortenReason(why) : why);
-
- load_str (&pps->fault_reason, shortWhy);
- dump_fault_status (pps);
- if (STREQU(pps->printer->fault_alert.shcmd,"show fault"))
- pps->status |= PS_SHOW_FAULT;
- else
- pps->status &= ~PS_SHOW_FAULT;
-
- note("printer fault. type: %s, status: %x\nmsg: (%s)\n",
- (pps->printer->fault_alert.shcmd ?
- pps->printer->fault_alert.shcmd : "??"),
- pps->status, shortWhy);
-
- if (pps->status & PS_SHOW_FAULT)
- schedule (EV_MESSAGE, pps);
- else {
- alert(A_PRINTER, pps, prs, shortWhy);
- }
- if (why != alert_text)
- Free (why);
-}
-
-/**
- ** clear_printer_fault() - RECOGNIZE PRINTER FAULT
- **/
-
-void
-clear_printer_fault(register PSTATUS *pps, char *alert_text)
-{
- register char *why, *shortWhy;
-
- pps->status &= ~PS_FAULTED;
-
- why = makestr(alert_text, (char *) 0);
-
- shortWhy = (why ? shortenReason(why) : alert_text);
-
- load_str (&pps->fault_reason, shortWhy);
- dump_fault_status (pps);
- if (STREQU(pps->printer->fault_alert.shcmd,"show fault"))
- pps->status |= PS_SHOW_FAULT;
- else
- pps->status &= ~PS_SHOW_FAULT;
-
- if (pps->status & PS_SHOW_FAULT)
- schedule (EV_MESSAGE, pps);
- if (why != alert_text)
- Free(why);
- schedule(EV_ENABLE, pps);
-}
-
-/**
- ** dial_problem() - ADDRESS DIAL-OUT PROBLEM
- **/
-
-void
-dial_problem(register PSTATUS *pps, RSTATUS *prs, int rc)
-{
- static struct problem {
- char *reason;
- int retry_max,
- dial_error;
- } problems[] = {
- "DIAL FAILED", 10, 2, /* D_HUNG */
- "CALLER SCRIPT FAILED", 10, 3, /* NO_ANS */
- "CAN'T ACCESS DEVICE", 0, 6, /* L_PROB */
- "DEVICE LOCKED", 20, 8, /* DV_NT_A */
- "NO DEVICES AVAILABLE", 0, 10, /* NO_BD_A */
- "SYSTEM NOT IN Systems FILE", 0, 13, /* BAD_SYS */
- "UNKNOWN dial() FAILURE", 0, 0
- };
-
- register struct problem *p;
-
- register char *msg;
-
-#define PREFIX "Connect problem: "
-#define SUFFIX "This problem has occurred several times.\nPlease check the dialing instructions for this printer.\n"
-
-
- for (p = problems; p->dial_error; p++)
- if (p->dial_error == rc)
- break;
-
- if (!p->retry_max) {
- msg = Malloc(strlen(PREFIX) + strlen(p->reason) + 2);
- sprintf (msg, "%s%s\n", PREFIX, p->reason);
- printer_fault (pps, prs, msg, 0);
- Free (msg);
-
- } else if (pps->last_dial_rc != rc) {
- pps->nretry = 1;
- pps->last_dial_rc = (short)rc;
-
- } else if (pps->nretry++ > p->retry_max) {
- pps->nretry = 0;
- pps->last_dial_rc = (short)rc;
- msg = Malloc(
- strlen(PREFIX) + strlen(p->reason) + strlen(SUFFIX) + 2
- );
- sprintf (msg, "%s%s%s\n", PREFIX, p->reason, SUFFIX);
- printer_fault (pps, prs, msg, 0);
- Free (msg);
- }
-
- if (!(pps->status & PS_FAULTED)) {
- load_str (&pps->dis_reason, p->reason);
- schedule (EV_LATER, WHEN_PRINTER, EV_ENABLE, pps);
- }
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/files.c b/usr/src/cmd/lp/cmd/lpsched/files.c
deleted file mode 100644
index 00f2ac85be..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/files.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "lpsched.h"
-#include <syslog.h>
-#include <strings.h>
-
-static char time_buf[50];
-#ifdef LP_USE_PAPI_ATTR
-static char *extractReqno(char *req_file);
-#endif
-
-/**
- ** chfiles() - CHANGE OWNERSHIP OF FILES, RETURN TOTAL SIZE
- **/
-
-off_t chfiles ( char * * list, uid_t uid, gid_t gid ) /* funcdef */
-{
- size_t total;
- struct stat stbuf;
- char *file;
-
- total = 0;
-
- while(file = *list++)
- {
- if (STRNEQU(Lp_Temp, file, strlen(Lp_Temp)) ||
- STRNEQU(Lp_Tmp, file, strlen(Lp_Tmp)))
- {
- /*
- * Once this routine (chfiles) is called for a request,
- * any temporary files are ``ours'', i.e. they are on our
- * machine. A user running on an RFS-connected remote machine
- * can't necessarily know our machine name, so can't put
- * the files where they belong (Lp_Tmp/machine). But now we
- * can. Of course, this is all done with mirrors, as Lp_Temp
- * and Lp_Tmp/local-machine are symbolicly linked. So we just
- * change the name. This saves on wear and tear later.
- */
- if (STRNEQU(Lp_Temp, file, strlen(Lp_Temp)))
- {
- char *newfile = makepath(Lp_Tmp, Local_System,
- file + strlen(Lp_Temp) + 1, NULL);
-
- Free(file);
- list[-1] = file = newfile;
- }
-
- (void) chownmod(file, uid, gid, 0600);
- }
-
- if (Stat(file, &stbuf) == -1)
- return(-1);
-
- switch (stbuf.st_mode & S_IFMT) {
- case 0:
- case S_IFREG:
- break;
-
- case S_IFIFO:
- if (!isadmin(uid))
- return(-1);
- /*
- * If any of the files is a FIFO, the size indicator
- * becomes meaningless. On the other hand, returning
- * a total of zero causes the request to be rejected,
- * so we return something > 0.
- */
- stbuf.st_size = 1;
- break;
-
- case S_IFDIR:
- case S_IFCHR:
- case S_IFBLK:
- default:
- return(-1);
- }
-
- total += stbuf.st_size;
- }
- return(total);
-}
-
-/**
- ** rmfiles() - DELETE/LOG FILES FOR DEFUNCT REQUEST
- **/
-
-void rmfiles ( RSTATUS * rp, int log_it ) /* funcdef */
-{
- char **file = rp->request->file_list;
- char *path;
- char num[STRSIZE(MOST_FILES) + 1];
- static int fd = -1;
- int reqfd;
- int count = 0;
-#ifdef LP_USE_PAPI_ATTR
- struct stat tmpBuf;
- char *idno = NULL;
- char tmpName[BUFSIZ];
-#endif
-
-
- if (rp->req_file) {
- char *p, *q;
-
- /*
- * The secure request file is removed first to prevent
- * reloading should the system crash while in rmfiles().
- */
- path = makepath(Lp_Requests, rp->req_file, (char *)0);
- (void) Unlink(path);
- Free(path);
-
- /*
- * Copy the request file to the log file, if asked,
- * or simply remove it.
- */
- path = makepath(Lp_Tmp, rp->req_file, (char *)0);
- if (log_it && rp->secure && rp->secure->req_id) {
- if (fd == -1)
- fd = open_locked(Lp_ReqLog, "a", MODE_NOREAD);
- if ((fd >= 0) && (reqfd = Open(path, O_RDONLY, 0)) != -1) {
- register int n;
- char buf[BUFSIZ];
-
- (void) strftime(time_buf, sizeof (time_buf),
- NULL, localtime(&(rp->secure->date)));
- fdprintf(fd, "= %s, uid %u, gid %u, size %ld, %s\n",
- rp->secure->req_id, rp->secure->uid, rp->secure->gid,
- rp->secure->size, time_buf);
- if (rp->slow)
- fdprintf(fd, "x %s\n", rp->slow);
- if (rp->fast)
- fdprintf(fd, "y %s\n", rp->fast);
- if (rp->printer && rp->printer->printer)
- fdprintf(fd, "z %s\n", rp->printer->printer->name);
- while ((n = Read(reqfd, buf, BUFSIZ)) > 0)
- write (fd, buf, n);
- Close (reqfd);
- }
- }
- (void)Unlink (path); /* remove request file */
- Free (path);
-
- p = strdup(rp->req_file); /* remove host/id file */
- if (q = strrchr(p, '-')) {
- *q = NULL;
- path = makepath(Lp_Tmp, p, NULL);
- (void) Unlink(path);
- Free(path);
- }
- Free(p);
-
-#ifdef LP_USE_PAPI_ATTR
- /* Look for a PAPI job attribute file, if it exists remove it */
- idno = extractReqno(rp->req_file);
- snprintf(tmpName, sizeof (tmpName), "%s-%s", idno, LP_PAPIATTRNAME);
- path = makepath(Lp_Temp, tmpName, (char *)0);
-
- if (((path != NULL) && (idno != NULL)) && (stat(path, &tmpBuf) == 0))
- {
- /* PAPI job attribute file exists for this job so remove it */
- (void) Unlink(path);
- }
-
- Free(idno);
- Free(path);
-#endif
- }
-
- if (file) /* remove file in filelist */
- while(*file)
- {
- /*
- * The copies of user files.
- */
- if ((STRNEQU(Lp_Temp, *file, strlen(Lp_Temp)) ||
- STRNEQU(Lp_Tmp, *file, strlen(Lp_Tmp))) &&
- (! strstr(*file, "../")))
-
- (void) Unlink(*file);
-
- count++;
- file++;
- }
-
- if (rp->secure && rp->secure->req_id) {
- char *p;
- p = getreqno(rp->secure->req_id);
-
- /*
- * The filtered files. We can't rely on just the RS_FILTERED
- * flag, since the request may have been cancelled while
- * filtering. On the other hand, just checking "rp->slow"
- * doesn't mean that the files exist, because the request
- * may have been canceled BEFORE filtering started. Oh well.
- */
- if (rp->slow)
- while(count > 0)
- {
- sprintf(num, "%d", count--);
- path = makestr(Lp_Temp, "/F", p, "-", num, (char *)0);
- Unlink(path);
- Free(path);
- }
-
- /*
- * The notify/error file.
- */
- path = makepath(Lp_Temp, p, (char *)0);
- (void) Unlink(path);
- Free(path);
- }
-}
-
-/**
- ** _alloc_req_id(void) - ALLOCATE NEXT REQUEST ID
- **/
-
-#define SEQF_DEF_START 1
-#define SEQF_DEF_END 59999
-#define SEQF_DEF_INCR 1
-#define SEQF ".SEQF"
-
-
-long
-_alloc_req_id ( void )
-{
- static short started = 0;
-
- static int fd;
-
- static long start;
- static long end;
- static long incr;
- static long curr;
- static long wrap;
-
- static char fmt[
- STRSIZE(BIGGEST_REQID_S)/* start */
- + 1 /* : */
- + STRSIZE(BIGGEST_REQID_S)/* end */
- + 1 /* : */
- + STRSIZE(BIGGEST_REQID_S)/* incr */
- + 1 /* : */
- + 4 /* %ld\n */
- + 1 /* (nul) */
- ];
-
- char buf[256];
- int len;
-
- long ret;
-
-
- if (!started) {
- snprintf(buf, sizeof (buf), "%s/%s", Lp_Temp, SEQF);
- if (((fd = open_locked(buf, "r+", 0644)) < 0) &&
- ((fd = open_locked(buf, "w", 0644)) < 0))
- fail ("Can't open file %s (%s).\n", buf, PERROR);
-
- lseek(fd, 0, SEEK_SET);
-
- read(fd, buf, sizeof (buf));
- if (sscanf(buf, "%ld:%ld:%ld:%ld\n", &start, &end, &incr, &curr) != 4) {
- start = SEQF_DEF_START;
- end = SEQF_DEF_END;
- curr = start;
- incr = SEQF_DEF_INCR;
- }
-
- if (start < 0)
- start = SEQF_DEF_START;
- if (end > SEQF_DEF_END)
- end = SEQF_DEF_END;
- if (curr < start || curr > end)
- curr = start;
-
- sprintf (fmt, "%ld:%ld:%ld:%%ld\n", start, end, incr);
- started = 1;
- }
-
- wrap = curr;
- do {
- ret = curr;
- if ((curr += incr) > end)
- curr = start;
-
- } while ( wrap != curr && ((RSTATUS *)request_by_id_num(ret)) ) ;
-
- /* write the new id file */
- lseek(fd, 0, SEEK_SET);
- len = sprintf(buf, fmt, curr);
- write(fd, buf, len);
- ftruncate(fd, len);
-
- if (curr == wrap) {
- note("alloc_req_id(): out of ids\n");
- errno = EEXIST;
- return(SEQF_DEF_START-1);
- } else
- return (ret);
-}
-
-/**
- ** _alloc_file() - ALLOCATE FILES FOR A REQUEST
- **/
-
-char *
-_alloc_files (
- int num,
- char * prefix,
- uid_t uid,
- gid_t gid
-)
-{
- static char base[
- 1 /* F */
- + STRSIZE(BIGGEST_REQID_S)/* req-id */
- + 1 /* - */
- + STRSIZE(MOST_FILES_S) /* file-no */
- + 1 /* (nul) */
- ];
-
- char * file;
- char * cp;
-
- int fd;
- int plus;
-
-
- if (num > BIGGEST_REQID)
- return (0);
-
- if (!prefix) {
- int id;
-
- if ((id = _alloc_req_id()) < SEQF_DEF_START )
- return(NULL); /* Out of request IDs (errno = EEXIST) */
- snprintf (base, sizeof (base), "%d-%d", id, MOST_FILES);
- plus = 0;
- } else {
- if (strlen(prefix) > (size_t) 6)
- return (0);
- snprintf (base, sizeof (base), "F%s-%d", prefix, MOST_FILES);
- plus = 1;
- }
-
- file = makepath(Lp_Temp, base, (char *)0);
-
- cp = strrchr(file, '-') + 1;
- while (num--) {
- sprintf (cp, "%d", num + plus);
- if ((fd = Open(file, O_CREAT|O_TRUNC, 0600)) == -1) {
- Free (file);
- return (0);
- } else {
- Close (fd);
- (void) chownmod(file, uid, gid, 0600);
- }
- }
-
-#ifdef LP_USE_PAPI_ATTR
- if (prefix == NULL)
- {
- /*
- * Initial job request (s_alloc_files) so create an empty PAPI
- * Attribute file; note, this file will only be used if the
- * print job has been submitted via the PAPI interface.
- */
-
- file = (char *)Realloc(file, strlen(file) +
- strlen(LP_PAPIATTRNAME) + 1);
- if (file != NULL)
- {
- cp = strrchr(file, '-') + 1;
- sprintf(cp, "%s", LP_PAPIATTRNAME);
-
- if ((fd = Open(file, O_CREAT|O_TRUNC, 0600)) == -1)
- {
- Free(file);
- return (0);
- }
- else
- {
- Close(fd);
- (void) chownmod(file, uid, gid, 0600);
- }
-
- Free(file);
- }
- }
-#endif
-
-
- if ((cp = strrchr(base, '-')))
- *cp = 0;
-
- return (base);
-}
-
-
-#ifdef LP_USE_PAPI_ATTR
-static char *extractReqno(char *req_file)
-
-{
- char *start = NULL;
- char *end = NULL;
- char *result = NULL;
-
- start = strrchr(req_file, '/');
- end = strrchr(req_file, '-');
-
- if ((start != NULL) && (end != NULL))
- {
- start++;
- if (end > start)
- {
- int n = end - start;
- result = (char *)Malloc(n+1);
- strncpy(result, start, n);
- result[n] = '\0';
- }
- }
-
- return (result);
-} /* extractReqno() */
-#endif
diff --git a/usr/src/cmd/lp/cmd/lpsched/flt.c b/usr/src/cmd/lp/cmd/lpsched/flt.c
deleted file mode 100644
index dc96387354..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/flt.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-# include <stdarg.h>
-# include "lpsched.h"
-
-typedef struct fault FLT;
-
-struct fault
-{
- FLT * next;
- int type;
- int i1;
- char * s1;
- RSTATUS * r1;
- MESG * ident;
-};
-
-static void free_flt ( FLT * );
-static void do_flt_acts ( MESG * );
-
-static FLT Fault_Head = { NULL, 0, 0, NULL, NULL, NULL };
-static FLT * Fault_List = &Fault_Head;
-
-void
-add_flt_act(MESG * md, ...)
-{
- va_list arg;
- FLT *f;
-
- va_start (arg, md);
-
- f = (FLT *)Malloc(sizeof(FLT));
-
- (void) memset((char *)f, 0, sizeof(FLT));
-
- f->type = (int)va_arg(arg, int);
- f->ident = md;
-
- if (md->on_discon == NULL)
- if (mon_discon(md, do_flt_acts))
- mallocfail();
-
- switch(f->type)
- {
- case FLT_FILES:
- f->s1 = Strdup((char *)va_arg(arg, char *));
- f->i1 = (int)va_arg(arg, int);
- break;
-
- case FLT_CHANGE:
- f->r1 = (RSTATUS *)va_arg(arg, RSTATUS *);
- break;
- }
-
- va_end(arg);
-
- f->next = Fault_List->next;
- Fault_List->next = f;
-}
-
-
-void
-del_flt_act(MESG *md, ...)
-{
- va_list arg;
- int type;
- FLT *fp;
- FLT *f;
-
- va_start(arg, md);
-
- type = (int)va_arg(arg, int);
-
- for (f = Fault_List; f->next; f = f->next)
- if (f->next->type == type && f->next->ident == md)
- {
- fp = f->next;
- f->next = f->next->next;
- free_flt(fp);
- break;
- }
-
- va_end(arg);
-}
-
-static void
-do_flt_acts(MESG *md)
-{
- FLT *f;
- FLT *fp;
- char *file;
- char id[15];
-#ifdef LP_USE_PAPI_ATTR
- struct stat tmpBuf;
- char attrFile[BUFSIZ];
-#endif
-
- for (f = Fault_List; f && f->next; f = f->next)
- if (f->next->ident == md)
- {
- fp = f->next;
- f->next = f->next->next;
-
- switch (fp->type)
- {
- case FLT_FILES:
- /* remove files created with alloc_files */
-
- while(fp->i1--)
- {
- (void) snprintf(id, sizeof (id), "%s-%d", fp->s1, fp->i1);
- file = makepath(Lp_Temp, id, (char *)0);
- (void) Unlink(file);
- Free(file);
- }
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * check if the PAPI attribute file exists, if it does delete it
- */
- (void) snprintf(attrFile, sizeof (attrFile),
- "%s-%s", fp->s1, LP_PAPIATTRNAME);
- file = makepath(Lp_Temp, attrFile, (char *)0);
- if ((file != NULL) && (stat(file, &tmpBuf) == 0))
- {
- (void) Unlink(file);
- }
- Free(file);
-#endif
- break;
-
-
- case FLT_CHANGE:
- /* clear RS_CHANGE bit, write request file, and schedule */
- fp->r1->request->outcome &= ~RS_CHANGING;
- putrequest(fp->r1->req_file, fp->r1->request);
- if (NEEDS_FILTERING(fp->r1))
- schedule(/* LP_FILTER */ EV_SLOWF, fp->r1);
- else
- schedule(/* LP_PRINTER */ EV_INTERF, fp->r1->printer);
- break;
- }
- free_flt(fp);
- }
-}
-
-static void
-free_flt(FLT *f)
-{
- if (f->s1)
- Free(f->s1);
- Free((char *)f);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/fncs.c b/usr/src/cmd/lp/cmd/lpsched/fncs.c
deleted file mode 100644
index b99815b0f1..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/fncs.c
+++ /dev/null
@@ -1,996 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "unistd.h"
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "errno.h"
-#include "fcntl.h"
-#include "stdlib.h"
-#include "string.h"
-
-#include "lpsched.h"
-
-static int __list_increment = 16;
-
-int
-list_append(void ***list, void *item)
-{
- int count;
-
- if ((list == NULL) || (item == NULL)) {
- errno = EINVAL;
- return (-1);
- }
-
- if (item != NULL) {
- if (*list == NULL)
- *list = (void **)calloc(__list_increment,
- sizeof (void *));
-
- if (*list == NULL)
- return (-1);
-
- for (count = 0; (*list)[count] != NULL; count++);
-
- if ((count + 1) % __list_increment == 0) { /* expand the list */ void **new_list = NULL;
- int new_size = (((count + 1) / __list_increment) + 1) *
- __list_increment;
-
- new_list = (void **)calloc(new_size, sizeof (void *));
- if (new_list == NULL)
- return (-1);
-
- for (count = 0; (*list)[count] != NULL; count++)
- new_list[count] = (*list)[count];
- free(*list);
- *list = new_list;
- }
-
- (*list)[count] = item;
- }
-
- return (0);
-}
-
-void
-list_remove(void ***list, void *item)
-{
- int i, count;
- void **tmp = NULL;
-
- if ((list == NULL) || (*list == NULL) || (item == NULL))
- return;
-
- for (count = 0; (*list)[count] != NULL; count++)
- ;
-
- if (count > 0) {
- int new_size = (((count + 1) / __list_increment) + 1) *
- __list_increment;
-
- if ((tmp = (void **)calloc(new_size, sizeof (void *))) == NULL)
- tmp = *list;
-
- /* copy up to item */
- for (i = 0; (((*list)[i] != NULL) && ((*list)[i] != item)); i++)
- tmp[i] = (*list)[i];
- /* copy after item */
- if ((*list)[i] == item)
- for (++i; ((*list)[i] != NULL); i++)
- tmp[i-1] = (*list)[i];
- }
-
- /* replace the list */
- if (tmp != *list) {
- free(*list);
- *list = tmp;
- }
-}
-
-void
-free_exec(EXEC *ep)
-{
- if (ep != NULL) {
- free(ep);
- list_remove((void ***)&Exec_Table, (void *)ep);
- }
-}
-
-EXEC *
-new_exec(int type, void *ex)
-{
- EXEC *result = calloc(1, sizeof (*result));
-
- if (result != NULL) {
- result->type = type;
- switch (type) {
- case EX_ALERT:
- case EX_INTERF:
- case EX_FAULT_MESSAGE:
- result->ex.printer = ex;
- break;
- case EX_FALERT:
- result->ex.form = ex;
- break;
- case EX_PALERT:
- result->ex.pwheel = ex;
- break;
- case EX_SLOWF:
- case EX_NOTIFY:
- break;
- }
- list_append((void ***)&Exec_Table, (void *)result);
- }
-
- return (result);
-}
-
-void
-free_alert(ALERT *ap)
-{
- if (ap != NULL) {
- if (ap->msgfile != NULL)
- free(ap->msgfile);
- if (ap->exec != NULL)
- free_exec(ap->exec);
- free(ap);
- }
-}
-
-ALERT *
-new_alert(char *fmt, int i)
-{
- ALERT *result = calloc(1, sizeof (*result));
-
- if (result != NULL) {
- char buf[15];
-
- snprintf(buf, sizeof (buf), fmt, i);
- result->msgfile = makepath(Lp_Temp, buf, (char *)0);
- (void) Unlink(result->msgfile);
- }
-
- return (result);
-}
-
-void
-free_pstatus(PSTATUS *psp)
-{
- if (psp != NULL) {
- if (psp->alert != NULL)
- free_alert(psp->alert);
- if (psp->exec != NULL)
- free_exec(psp->exec);
- if (psp->fault_exec != NULL)
- free_exec(psp->fault_exec);
- if (psp->printer != NULL)
- freeprinter(psp->printer);
- if (psp->pwheel_name != NULL)
- free(psp->pwheel_name);
- if (psp->dis_reason != NULL)
- free(psp->dis_reason);
- if (psp->rej_reason != NULL)
- free(psp->rej_reason);
- if (psp->users_allowed != NULL)
- unload_list(&psp->users_allowed);
- if (psp->users_denied != NULL)
- unload_list(&psp->users_denied);
- if (psp->forms_allowed != NULL)
- unload_list(&psp->forms_allowed);
- if (psp->forms_denied != NULL)
- unload_list(&psp->forms_denied);
- if (psp->cpi != NULL)
- free(psp->cpi);
- if (psp->lpi != NULL)
- free(psp->lpi);
- if (psp->plen != NULL)
- free(psp->plen);
- if (psp->pwid != NULL)
- free(psp->pwid);
- if (psp->fault_reason != NULL)
- free(psp->fault_reason);
- if (psp->paper_allowed != NULL)
- unload_list(&psp->paper_allowed);
- free(psp);
- }
-}
-
-void
-pstatus_add_printer(PSTATUS *ps, PRINTER *p)
-{
- if ((ps != NULL) && (p != NULL)) {
- char **paperDenied = NULL;
-
- ps->printer = p;
- load_userprinter_access(p->name, &(ps->users_allowed),
- &(ps->users_denied));
- load_formprinter_access(p->name, &(ps->forms_allowed),
- &(ps->forms_denied));
- load_paperprinter_access(p->name, &ps->paper_allowed,
- &paperDenied);
- freelist(paperDenied);
- load_sdn(&(ps->cpi), p->cpi);
- load_sdn(&(ps->lpi), p->lpi);
- load_sdn(&(ps->plen), p->plen);
- load_sdn(&(ps->pwid), p->pwid);
- }
-}
-
-PSTATUS *
-new_pstatus(PRINTER *p)
-{
- PSTATUS *result = calloc(1, sizeof (*result));
-
- if (result != NULL) {
- static int i = 0;
- char **paperDenied = NULL;
-
- result->alert = new_alert("A-%d", i++);
- result->alert->exec = new_exec(EX_ALERT, result);
- result->exec = new_exec(EX_INTERF, result);
- result->fault_exec = new_exec(EX_FAULT_MESSAGE, result);
-
- if (p != NULL)
- pstatus_add_printer(result, p);
-
- list_append((void ***)&PStatus, (void *)result);
- }
-
- return (result);
-}
-
-void
-free_cstatus(CSTATUS *csp)
-{
- if (csp != NULL) {
- if (csp->rej_reason != NULL)
- free(csp->rej_reason);
- if (csp->class != NULL)
- freeclass(csp->class);
- free(csp);
- }
-}
-
-CSTATUS *
-new_cstatus(CLASS *c)
-{
- CSTATUS *result = calloc(1, sizeof (*result));
-
- if (result != NULL) {
- if (c != NULL)
- result->class = c;
- else
- result->class = calloc(1, sizeof (CLASS));
-
- list_append((void ***)&CStatus, result);
- }
-
- return (result);
-}
-
-void
-free_fstatus(FSTATUS *fsp)
-{
- if (fsp != NULL) {
- if (fsp->form != NULL)
- free_form(fsp->form);
- if (fsp->alert != NULL)
- free_alert(fsp->alert);
- if (fsp->users_allowed != NULL)
- unload_list(&fsp->users_allowed);
- if (fsp->users_denied != NULL)
- unload_list(&fsp->users_denied);
- if (fsp->cpi != NULL)
- free(fsp->cpi);
- if (fsp->lpi != NULL)
- free(fsp->lpi);
- if (fsp->plen != NULL)
- free(fsp->plen);
- if (fsp->pwid != NULL)
- free(fsp->pwid);
- free(fsp);
- }
-}
-
-FSTATUS *
-new_fstatus(_FORM *f)
-{
- FSTATUS *result = calloc(1, sizeof (*result));
-
- if (result != NULL) {
- static int i = 0;
-
- if (f != NULL)
- result->form = f;
- else
- result->form = calloc(1, sizeof (_FORM));
-
- result->alert = new_alert("F-%d", i++);
- result->alert->exec = new_exec(EX_FALERT, result);
- result->trigger = result->form->alert.Q;
-
- if (f != NULL) {
- load_userform_access(f->name, &(result->users_allowed),
- &(result->users_denied));
- load_sdn (&(result->cpi), f->cpi);
- load_sdn (&(result->lpi), f->lpi);
- load_sdn (&(result->plen), f->plen);
- load_sdn (&(result->pwid), f->pwid);
- }
-
- list_append((void ***)&FStatus, (void *)result);
- }
-
- return (result);
-}
-
-void
-free_pwstatus(PWSTATUS *pwp)
-{
- if (pwp != NULL) {
- if (pwp->pwheel)
- freepwheel(pwp->pwheel);
- if (pwp->alert != NULL)
- free_alert(pwp->alert);
- free(pwp);
- }
-}
-
-PWSTATUS *
-new_pwstatus(PWHEEL *p)
-{
- PWSTATUS *result = calloc(1, sizeof (*result));
-
- if (result != NULL) {
- static int i = 0;
-
- if (p != NULL)
- result->pwheel = p;
- else
- result->pwheel = calloc(1, sizeof (*result));
-
- result->alert = new_alert("P-%d", i++);
- result->alert->exec = new_exec(EX_PALERT, result);
- result->trigger = result->pwheel->alert.Q;
-
- list_append((void ***)&PWStatus, (void *)result);
- }
-
- return (result);
-}
-
-void
-free_rstatus(RSTATUS *rsp)
-{
- if (rsp != NULL) {
- remover(rsp);
-
- if (rsp->request != NULL)
- freerequest(rsp->request);
- if (rsp->secure != NULL)
- freesecure(rsp->secure);
- if (rsp->req_file)
- Free (rsp->req_file);
- if (rsp->slow)
- Free (rsp->slow);
- if (rsp->fast)
- Free (rsp->fast);
- if (rsp->pwheel_name)
- Free (rsp->pwheel_name);
- if (rsp->printer_type)
- Free (rsp->printer_type);
- if (rsp->output_type)
- Free (rsp->output_type);
- if (rsp->cpi)
- Free (rsp->cpi);
- if (rsp->lpi)
- Free (rsp->lpi);
- if (rsp->plen)
- Free (rsp->plen);
- if (rsp->pwid)
- Free (rsp->pwid);
- free(rsp);
- }
-}
-
-RSTATUS *
-new_rstatus(REQUEST *r, SECURE *s)
-{
- RSTATUS *result = calloc(1, sizeof (*result));
-
- if (result != NULL) {
- if ((result->request = r) == NULL)
- result->request = calloc(1, sizeof (REQUEST));
- if ((result->secure = s) == NULL)
- result->secure = calloc(1, sizeof (SECURE));
- }
-
- return (result);
-}
-
-/**
- ** search_pstatus() - SEARCH PRINTER TABLE
- ** search_fstatus() - SEARCH FORMS TABLE
- ** search_cstatus() - SEARCH CLASS TABLE
- ** search_pwstatus() - SEARCH PRINT WHEEL TABLE
- **/
-
-PSTATUS *
-search_pstatus(register char *name)
-{
- PSTATUS *ps = NULL;
-
- if (name != NULL) {
- if (PStatus != NULL) {
- int i;
-
- for (i = 0; ((PStatus[i] != NULL) && (ps == NULL)); i++)
- if (SAME(PStatus[i]->printer->name, name))
- ps = PStatus[i];
- }
- } else
- ps = new_pstatus(NULL);
-
- return (ps);
-}
-
-
-FSTATUS *
-search_fstatus(register char *name)
-{
- FSTATUS *ps = NULL;
-
- if (name != NULL) {
- if (FStatus != NULL) {
- int i;
-
- for (i = 0; ((FStatus[i] != NULL) && (ps == NULL)); i++)
- if (SAME(FStatus[i]->form->name, name))
- ps = FStatus[i];
- }
- } else
- ps = new_fstatus(NULL);
-
- return (ps);
-}
-
-FSTATUS *
-search_fptable(register char *paper)
-{
- FSTATUS *ps = NULL;
- int i;
-
- if (FStatus != NULL) {
- for (i = 0; ((FStatus[i] != NULL) && (ps == NULL)); i++)
- if (SAME(FStatus[i]->form->paper, paper)) {
- if (ps->form->isDefault)
- ps = FStatus[i];
- }
- }
-
- return (ps);
-}
-
-CSTATUS *
-search_cstatus(register char *name)
-{
- CSTATUS *ps = NULL;
-
- if (name != NULL) {
- if (CStatus != NULL) {
- int i;
-
- for (i = 0; ((CStatus[i] != NULL) && (ps == NULL)); i++)
- if (SAME(CStatus[i]->class->name, name))
- ps = CStatus[i];
- }
- } else
- ps = new_cstatus(NULL);
-
- return (ps);
-}
-
-PWSTATUS *
-search_pwstatus(register char *name)
-{
- PWSTATUS *ps = NULL;
-
- if (name != NULL) {
- if (PWStatus != NULL) {
- int i;
-
- for (i = 0; ((PWStatus[i] != NULL) && (ps == NULL)); i++)
- if (SAME(PWStatus[i]->pwheel->name, name))
- ps = PWStatus[i];
- }
- } else
- ps = new_pwstatus(NULL);
-
- return (ps);
-}
-
-
-/**
- ** load_str() - LOAD STRING WHERE ALLOC'D STRING MAY BE
- ** unload_str() - REMOVE POSSIBLE ALLOC'D STRING
- **/
-
-void
-load_str(char **pdst, char *src)
-{
- if (*pdst)
- Free (*pdst);
- *pdst = Strdup(src);
- return;
-}
-
-void
-unload_str(char **pdst)
-{
- if (*pdst)
- Free (*pdst);
- *pdst = 0;
- return;
-}
-
-/**
- ** unload_list() - REMOVE POSSIBLE ALLOC'D LIST
- **/
-
-void
-unload_list(char ***plist)
-{
- if (*plist)
- freelist (*plist);
- *plist = 0;
- return;
-}
-
-/**
- ** load_sdn() - LOAD STRING WITH ASCII VERSION OF SCALED DECIMAL NUMBER
- **/
-
-void
-load_sdn(char **p, SCALED sdn)
-{
- if (!p)
- return;
-
- if (*p)
- Free (*p);
- *p = 0;
-
- if (sdn.val <= 0 || 999999 < sdn.val)
- return;
-
- *p = Malloc(sizeof("999999.999x"));
- sprintf (
- *p,
- "%.3f%s",
- sdn.val,
- (sdn.sc == 'c'? "c" : (sdn.sc == 'i'? "i" : ""))
- );
-
- return;
-}
-
-/**
- ** Getform() - EASIER INTERFACE TO "getform()"
- **/
-
-_FORM *
-Getform(char *form)
-{
- _FORM *_form;
-
- FORM formbuf;
-
- FALERT alertbuf;
-
- int ret;
-
-
- while (
- (ret = getform(form, &formbuf, &alertbuf, (FILE **)0)) == -1
- && errno == EINTR
- )
- ;
- if (ret == -1)
- return (0);
-
- _form = calloc(1, sizeof (*_form));
- _form->plen = formbuf.plen;
- _form->pwid = formbuf.pwid;
- _form->lpi = formbuf.lpi;
- _form->cpi = formbuf.cpi;
- _form->np = formbuf.np;
- _form->chset = formbuf.chset;
- _form->mandatory = formbuf.mandatory;
- _form->rcolor = formbuf.rcolor;
- _form->comment = formbuf.comment;
- _form->conttype = formbuf.conttype;
- _form->name = formbuf.name;
- _form->paper = formbuf.paper;
- _form->isDefault = formbuf.isDefault;
-
- if ((_form->alert.shcmd = alertbuf.shcmd) != NULL) {
- _form->alert.Q = alertbuf.Q;
- _form->alert.W = alertbuf.W;
- } else {
- _form->alert.Q = 0;
- _form->alert.W = 0;
- }
-
- return (_form);
-}
-
-/**
- ** Getprinter()
- ** Getrequest()
- ** Getuser()
- ** Getclass()
- ** Getpwheel()
- ** Getsecure()
- ** Loadfilters()
- **/
-
-PRINTER *
-Getprinter(char *name)
-{
- register PRINTER *ret;
-
- while (!(ret = getprinter(name)) && errno == EINTR)
- ;
- return (ret);
-}
-
-REQUEST *
-Getrequest(char *file)
-{
- register REQUEST *ret;
-
- while (!(ret = getrequest(file)) && errno == EINTR)
- ;
- return (ret);
-}
-
-USER *
-Getuser(char *name)
-{
- register USER *ret;
-
- while (!(ret = getuser(name)) && errno == EINTR)
- ;
- return (ret);
-}
-
-CLASS *
-Getclass(char *name)
-{
- register CLASS *ret;
-
- while (!(ret = getclass(name)) && errno == EINTR)
- ;
- return (ret);
-}
-
-PWHEEL *
-Getpwheel(char *name)
-{
- register PWHEEL *ret;
-
- while (!(ret = getpwheel(name)) && errno == EINTR)
- ;
- return (ret);
-}
-
-SECURE *
-Getsecure(char *file)
-{
- register SECURE *ret;
-
- while (!(ret = getsecure(file)) && errno == EINTR)
- ;
- return ((SECURE *) ret);
-}
-
-
-int
-Loadfilters(char *file)
-{
- register int ret;
-
- while ((ret = loadfilters(file)) == -1 && errno == EINTR)
- ;
- return (ret);
-}
-
-/**
- ** free_form() - FREE MEMORY ALLOCATED FOR _FORM STRUCTURE
- **/
-
-void
-free_form(register _FORM *pf)
-{
- if (!pf)
- return;
- if (pf->chset)
- Free (pf->chset);
- if (pf->rcolor)
- Free (pf->rcolor);
- if (pf->comment)
- Free (pf->comment);
- if (pf->conttype)
- Free (pf->conttype);
- if (pf->name)
- Free (pf->name);
- if (pf->paper)
- Free (pf->paper);
- pf->name = 0;
- if (pf->alert.shcmd)
- Free (pf->alert.shcmd);
- return;
-}
-
-/**
- ** getreqno() - GET NUMBER PART OF REQUEST ID
- **/
-
-char *
-getreqno(char *req_id)
-{
- register char *cp;
-
-
- if (!(cp = strrchr(req_id, '-')))
- cp = req_id;
- else
- cp++;
- return (cp);
-}
-
-/* Putsecure(): Insurance for writing out the secure request file.
- * input: char ptr to name of the request file,
- * ptr to the SECURE structure to be written.
- * ouput: 0 if successful, -1 otherwise.
- *
- * Description:
- * The normal call to putsecure() is woefully lacking.
- * The bottom line here is that there
- * is no way to make sure that the file has been written out
- * as expected. This can cause rude behaviour later on.
- *
- * This routine calls putsecure(), and then does a getsecure().
- * The results are compared to the original structure. If the
- * info obtained by getsecure() doesn't match, we retry a few
- * times before giving up (presumably something is very seriously
- * wrong at that point).
- */
-
-
-int
-Putsecure(char *file, SECURE *secbufp)
-{
- SECURE *pls;
- int retries = 5; /* # of attempts */
- int status; /* 0 = success, nonzero otherwise */
-
-
- while (retries--) {
- status = 1; /* assume the worst, hope for the best */
- if (putsecure(file, secbufp) == -1) {
- rmsecure(file);
- continue;
- }
-
- if ((pls = getsecure(file)) == (SECURE *) NULL) {
- rmsecure(file);
- status = 2;
- continue;
- }
-
- /* now compare each field */
-
- /*
- * A comparison is only valid if secbufp and pls point to
- * different locations. In reality getsecure() will have
- * already been called, allocating the same STATIC memory
- * location to both structures making the following compare
- * meaningless.
- * Therefore test for this condition to prevent us from
- * calling freesecure which will destroy uid and
- * req_id fields in the strucure
- */
-
- status = 0;
- if (secbufp != pls) {
- if (strcmp(pls->req_id, secbufp->req_id) != 0) {
- rmsecure(file);
- status = 3;
- continue;
- }
-
- if (pls->uid != secbufp->uid) {
- rmsecure(file);
- status = 4;
- continue;
- }
-
- if (strcmp(pls->user, secbufp->user) != 0) {
- rmsecure(file);
- status = 5;
- continue;
- }
-
- if (pls->gid != secbufp->gid) {
- rmsecure(file);
- status = 6;
- continue;
- }
-
- if (pls->size != secbufp->size) {
- rmsecure(file);
- status = 7;
- continue;
- }
-
- if (pls->date != secbufp->date) {
- rmsecure(file);
- status = 8;
- continue;
- }
-
- freesecure(pls);
- }
- break;
- }
-
- if (status != 0) {
- note("Putsecure failed, status=%d\n", status);
- return -1;
- }
-
- return 0;
-}
-
-void GetRequestFiles(REQUEST *req, char *buffer, int length)
-{
- char buf[BUFSIZ];
-
- memset(buf, 0, sizeof(buf));
-
- if (req->title) {
- char *r = req->title;
- char *ptr = buf;
-
- while ( *r && strncmp(r,"\\n",2)) {
- *ptr++ = *r++;
- }
- } else if (req->file_list)
- strlcpy(buf, *req->file_list, sizeof (buf));
-
- if (*buf == NULL || !strncmp(buf, SPOOLDIR, sizeof(SPOOLDIR)-1))
- strcpy(buf, "<File name not available>");
-
- if (strlen(buf) > (size_t) 24) {
- char *r;
-
- if (r = strrchr(buf, '/'))
- r++;
- else
- r = buf;
-
- snprintf(buffer, length, "%-.24s", r);
- } else
- strlcpy(buffer, buf, length);
- return;
-}
-
-
-/**
- ** _Malloc()
- ** _Realloc()
- ** _Calloc()
- ** _Strdup()
- ** _Free()
- **/
-
-void (*lp_alloc_fail_handler)( void ) = 0;
-
-typedef void *alloc_type;
-
-alloc_type
-_Malloc(size_t size, const char *file, int line)
-{
- alloc_type ret;
-
- ret = malloc(size);
- if (!ret) {
- if (lp_alloc_fail_handler)
- (*lp_alloc_fail_handler)();
- errno = ENOMEM;
- }
- return (ret);
-}
-
-alloc_type
-_Realloc(void *ptr, size_t size, const char *file, int line)
-{
- alloc_type ret = realloc(ptr, size);
-
- if (!ret) {
- if (lp_alloc_fail_handler)
- (*lp_alloc_fail_handler)();
- errno = ENOMEM;
- }
- return (ret);
-}
-
-alloc_type
-_Calloc(size_t nelem, size_t elsize, const char *file, int line)
-{
- alloc_type ret = calloc(nelem, elsize);
-
- if (!ret) {
- if (lp_alloc_fail_handler)
- (*lp_alloc_fail_handler)();
- errno = ENOMEM;
- }
- return (ret);
-}
-
-char *
-_Strdup(const char *s, const char *file, int line)
-{
- char * ret;
-
- if (!s)
- return( (char *) 0);
-
- ret = strdup(s);
-
- if (!ret) {
- if (lp_alloc_fail_handler)
- (*lp_alloc_fail_handler)();
- errno = ENOMEM;
- }
- return (ret);
-}
-
-void
-_Free(void *ptr, const char *file, int line)
-{
- free (ptr);
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/getkey.c b/usr/src/cmd/lp/cmd/lpsched/getkey.c
deleted file mode 100644
index b0722e06f5..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/getkey.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1.1.4 */
-
-#include "sys/types.h"
-#include "time.h"
-#include "stdlib.h"
-
-#include "lpsched.h"
-
-long
-getkey (void)
-{
- static int started = 0;
-
- if (!started) {
- srand48 (time((time_t *)0));
- started = 1;
- }
- return (lrand48());
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/init.c b/usr/src/cmd/lp/cmd/lpsched/init.c
deleted file mode 100644
index fe318e1e81..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/init.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "lpsched.h"
-#include <syslog.h>
-
-CSTATUS **CStatus = NULL; /* Status of same */
-PSTATUS **PStatus = NULL; /* Status of same */
-FSTATUS **FStatus = NULL; /* status of same */
-PWSTATUS **PWStatus = NULL; /* Status of same */
-EXEC **Exec_Table = NULL; /* Running processes */
-EXEC **Exec_Slow = NULL; /* Slow filters */
-EXEC **Exec_Notify = NULL; /* Notifications */
-RSTATUS *Request_List = NULL; /* Queue of print requests */
-
-int ET_SlowSize = 1,
- ET_NotifySize = 1;
-
-static void init_printers(),
- init_classes(),
- init_forms(),
- init_pwheels(),
- init_exec();
-
-
-static void init_requests();
-
-void
-init_memory(void)
-{
- init_exec();
- init_printers();
- init_classes();
- init_forms();
- init_pwheels();
-
- /*
- * Load the status after the basic structures have been loaded,
- * but before loading requests still in the queue. This is so
- * the requests can be compared against accurate status information
- * (except rejection status--accept the jobs anyway).
- */
- load_status();
-
- Loadfilters(Lp_A_Filters);
-
- init_requests();
-}
-
-static void
-init_printers()
-{
- PRINTER *p;
- int i = 0;
-
- while((p = Getprinter(NAME_ALL)) != NULL || errno != ENOENT) {
- if ((!p) || (p->remote)) /* NULL or this is remote, ignore it */
- continue;
-
- (void) new_pstatus(p);
- syslog(LOG_DEBUG, "Loaded printer: %s", p->name);
- }
-}
-
-static void
-init_classes()
-{
- CLASS *c;
-
- while((c = Getclass(NAME_ALL)) != NULL) {
- (void) new_cstatus(c);
- syslog(LOG_DEBUG, "Loaded class: %s", c->name);
- }
-}
-
-static void
-init_forms()
-{
- _FORM *f;
- int i = 0;
-
- while ((f = Getform(NAME_ALL)) != NULL) {
- (void) new_fstatus(f);
- syslog(LOG_DEBUG, "Loaded form: %s", f->name);
- }
-}
-
-static void
-init_pwheels()
-{
- PWHEEL *p;
- int i = 0;
-
- while((p = Getpwheel(NAME_ALL)) != NULL || errno != ENOENT)
- {
- if (!p) /* NULL, ignore it. */
- continue;
-
- (void) new_pwstatus(p);
- syslog(LOG_DEBUG, "Loaded print-wheel: %s", p->name);
- }
-}
-
-static void
-init_requests(void)
-{
- RSTATUS **table = NULL;
- REQUEST *r;
- SECURE *s;
- char *name;
- char *sysdir;
- char *sysname;
- char *reqfile = NULL;
- long addr = -1;
- long sysaddr = -1;
- short vr_ret;
-
- while((sysname = next_dir(Lp_Requests, &addr)) != NULL) {
- RSTATUS *rsp;
-
- sysdir = makepath(Lp_Requests, sysname, NULL);
-
- while((name = next_file(sysdir, &sysaddr)) != NULL) {
- reqfile = makepath(sysname, name, NULL);
- Free(name);
-
- if ((s = Getsecure(reqfile)) == NULL) {
- RSTATUS tmp;
-
- memset(&tmp, 0, sizeof (tmp));
- tmp.req_file = reqfile; /* fix for 1103890 */
- rmfiles(&tmp, 0);
- free(tmp.req_file);
- continue;
- }
- syslog(LOG_DEBUG, "Loaded request: %s", reqfile);
-
- if((r = Getrequest(reqfile)) == NULL) {
- RSTATUS tmp;
-
- memset(&tmp, 0, sizeof (tmp));
- tmp.req_file = reqfile; /* fix for 1103890 */
- rmfiles(&tmp, 0);
- freesecure(s);
- free(tmp.req_file);
- continue;
- }
- syslog(LOG_DEBUG, "Loaded secure: %s", s->req_id);
-
- rsp = new_rstatus(r, s);
-
- r->outcome &= ~RS_ACTIVE; /* it can't be! */
- rsp->req_file = reqfile;
-
- if ((r->outcome & (RS_CANCELLED|RS_FAILED)) &&
- !(r->outcome & RS_NOTIFY)) {
- rmfiles(rsp, 0);
- free_rstatus(rsp);
- continue;
- }
-
- /*
- * So far, the only way RS_NOTIFY can be set without there
- * being a notification file containing the message to the
- * user, is if the request was cancelled. This is because
- * cancelling a request does not cause the creation of the
- * message if the request is currently printing or filtering.
- * (The message is created after the child process dies.)
- * Thus, we know what to say.
- *
- * If this behaviour changes, we may have to find another way
- * of determining what to say in the message.
- */
- if (r->outcome & RS_NOTIFY) {
- char *file = makereqerr(rsp);
-
- if (Access(file, F_OK) == -1) {
- if (!(r->outcome & RS_CANCELLED)) {
- Free(file);
- rmfiles(rsp, 0);
- free_rstatus(rsp);
- continue;
- }
- notify(rsp, NULL, 0, 0, 0);
- }
- Free(file);
- }
-
- /* fix for bugid 1103709. if validate_request returns
- * MNODEST, then the printer for the request doesn't exist
- * anymore! E.g. lpadmin -x was issued, and the request
- * hasn't been cleaned up. In this case, the "printer"
- * element of table[] will be NULL, and cancel will
- * core dump! So we clean this up here.
- */
-
- /*
- * Well actually this happens with MDENYDEST too. The real problem
- * is if the printer is NULL, so test for it
- */
-
- if ((vr_ret=validate_request(rsp, NULL, 1)) != MOK) {
- if (vr_ret == MNODEST || (rsp->printer == NULL)) {
- rmfiles(rsp, 0);
- free_rstatus(rsp);
- continue;
- }
- cancel(rsp, 1);
- }
-
- list_append((void ***)&table, (void *)rsp);
- }
- Free(sysdir);
- Free(sysname);
- sysaddr = -1;
- }
-
- if (table != NULL) {
- unsigned long i;
-
- for (i = 0; table[i] != NULL; i++);
-
- qsort((void *)table, i, sizeof(RSTATUS *),
- (int (*)(const void * , const void *))rsort);
-
- for (i = 0; table[i] != NULL; i++) {
- table[i]->next = table[i + 1];
- if (table[i + 1] != NULL)
- table[i + 1]->prev = table[i];
- }
-
- Request_List = *table;
- Free(table);
- }
-}
-
-static void
-init_exec()
-{
- EXEC *ep;
- int i;
-
- for (i = 0; i < ET_SlowSize; i++) {
- ep = new_exec(EX_SLOWF, NULL);
- list_append((void ***)&Exec_Slow, (void *)ep);
- }
-
- for (i = 0; i < ET_NotifySize; i++) {
- ep = new_exec(EX_NOTIFY, NULL);
- list_append((void ***)&Exec_Notify, (void *)ep);
- }
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/log.c b/usr/src/cmd/lp/cmd/lpsched/log.c
deleted file mode 100644
index 7c2041de70..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/log.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdarg.h"
-#include "lpsched.h"
-#include <syslog.h>
-
-static void log(char *, va_list);
-
-/**
- ** open_logfile() - OPEN FILE FOR LOGGING MESSAGE
- **/
-
-static int
-open_logfile(char *name)
-{
- char path[80];
-
- snprintf(path, sizeof (path), "%s/%s", Lp_Logs, name);
- return (open_locked(path, "a", 0640));
-}
-
-
-/**
- ** fail() - LOG MESSAGE AND EXIT (ABORT IF DEBUGGING)
- **/
-
-/*VARARGS1*/
-void
-fail(char *format, ...)
-{
- va_list ap;
-
- va_start (ap, format);
- log (format, ap);
- va_end (ap);
-
-#if defined(DEBUG)
- if (debug & DB_ABORT)
- abort ();
- else
-#endif
- exit (1);
- /*NOTREACHED*/
-}
-
-/**
- ** note() - LOG MESSAGE
- **/
-
-/*VARARGS1*/
-void
-note(char *format, ...)
-{
- va_list ap;
-
- va_start (ap, format);
- log (format, ap);
- va_end (ap);
-}
-
-
-
-/**
- ** mallocfail() - COMPLAIN ABOUT MEMORY ALLOCATION FAILURE
- **/
-
-void
-mallocfail(void)
-{
- fail ("Memory allocation failed!\n");
- /*NOTREACHED*/
-}
-
-/**
- ** log() - LOW LEVEL ROUTINE THAT LOGS MESSSAGES
- **/
-
-static void
-log(char *format, va_list ap)
-{
- int close_it;
- int fd;
- static int nodate = 0;
- char buf[BUFSIZ];
-
- vsyslog(LOG_DEBUG, format, ap);
-
- if (!am_in_background) {
- fd = 1;
- close_it = 0;
- } else {
- if ((fd = open_logfile("lpsched")) < 0)
- return;
- close_it = 1;
- }
-
- if (am_in_background && !nodate) {
- time_t curtime;
- struct tm *tm;
-
- time(&curtime);
- if ((tm = localtime(&curtime)) != NULL)
- fdprintf (fd, "%.2d/%.2d %.2d:%.2d:%.2d: ",
- tm->tm_mon+1, tm->tm_mday, tm->tm_hour,
- tm->tm_min, tm->tm_sec);
- else
- fdprintf(fd, "bad date: ");
- }
- nodate = 0;
-
- vsnprintf (buf, sizeof (buf), format, ap);
- write(fd, buf, strlen(buf));
- if (format[strlen(format) - 1] != '\n')
- nodate = 1;
-
- if (close_it)
- close(fd);
-}
-
-/**
- ** execlog()
- **/
-
-/*VARARGS1*/
-void
-execlog(char *format, ...)
-{
- va_list ap;
-
-#if defined(DEBUG)
- int fd = open_logfile("exec");
- char buf[BUFSIZ];
- EXEC * ep;
- static int nodate = 0;
-
- va_start (ap, format);
- if (fd >= 0) {
- if (!nodate) {
- time_t now = time((time_t *)0);
-
- fdprintf (fd, "%24.24s: ", ctime(&now));
- }
- nodate = 0;
- if (!STREQU(format, "%e")) {
- vsnprintf (buf, sizeof (buf), format, ap);
- write(fd, buf, strlen(buf));
- if (format[strlen(format) - 1] != '\n')
- nodate = 1;
- } else switch ((ep = va_arg(ap, EXEC *))->type) {
- case EX_INTERF:
- fdprintf(fd, " EX_INTERF %s %s\n",
- ep->ex.printer->printer->name,
- ep->ex.printer->request->secure->req_id);
- break;
- case EX_SLOWF:
- fdprintf(fd, " EX_SLOWF %s\n",
- ep->ex.request->secure->req_id);
- break;
- case EX_ALERT:
- fdprintf(fd, " EX_ALERT %s\n",
- ep->ex.printer->printer->name);
- break;
- case EX_FAULT_MESSAGE:
- fdprintf(fd, " EX_FAULT_MESSAGE %s\n",
- ep->ex.printer->printer->name);
- break;
- case EX_FORM_MESSAGE:
- fdprintf(fd, " EX_FORM_MESSAGE %s\n",
- ep->ex.form->form->name);
- break;
- case EX_FALERT:
- fdprintf(fd, " EX_FALERT %s\n",
- ep->ex.form->form->name);
- break;
- case EX_PALERT:
- fdprintf(fd, " EX_PALERT %s\n",
- ep->ex.pwheel->pwheel->name);
- break;
- case EX_NOTIFY:
- fdprintf(fd, " EX_NOTIFY %s\n",
- ep->ex.request->secure->req_id);
- break;
- default:
- fdprintf (fd, " EX_???\n");
- break;
- }
- close(fd);
- }
-#endif
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/lpfsck.c b/usr/src/cmd/lp/cmd/lpsched/lpfsck.c
deleted file mode 100644
index 3175ae2d17..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/lpfsck.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdarg.h"
-#include "stdlib.h"
-#include "fcntl.h"
-#include <sys/param.h>
-#include "lpsched.h"
-
-
-static void check_link();
-
-/**
- ** lpfsck()
- **/
-
-#define F 0
-#define D 1
-#define P 2
-#define S 3
-
-static void proto (int, int, ...);
-static int va_makepath(va_list *, char **);
-static void _rename (char *, char *, ...);
-
-void
-lpfsck(void)
-{
- struct stat stbuf;
- int real_am_in_background = am_in_background;
-
-
- /*
- * Force log messages to go into the log file instead of stdout.
- */
- am_in_background = 1;
-
- /*
- * Most of these lines repeat the prototype file from the
- * packaging and should match those items exactly.
- * (In fact, they probably ought to be generated from that file,
- * but that work is for a rainy day...)
- */
-
- /*
- * DIRECTORIES:
- */
-proto (D, 0, Lp_A, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_A_Classes, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_A_Forms, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_A_Interfaces, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_A_Printers, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_A_PrintWheels, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 0, "/var/lp", NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_Logs, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_Spooldir, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_Admins, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_Requests, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_Requests, Local_System, NULL, 0770, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_System, NULL, 0775, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_Tmp, NULL, 0771, Lp_Uid, Lp_Gid);
-proto (D, 1, Lp_Tmp, Local_System, NULL, 0775, Lp_Uid, Lp_Gid);
-
- /*
- * DIRECTORIES: not described in the packaging
- */
-proto (D, 0, Lp_Spooldir, FIFOSDIR, NULL, 0775, Lp_Uid, Lp_Gid);
-
- /*
- * THE MAIN FIFO:
- */
-proto (P, 1, Lp_FIFO, NULL, 0666, Lp_Uid, Lp_Gid);
-
- /*
- * SYMBOLIC LINKS:
- * Watch out! These names are given in the reverse
- * order found in the prototype file (sorry!)
- */
-proto (S, 1, Lp_Model, NULL, "/etc/lp/model", NULL);
-proto (S, 1, Lp_Logs, NULL, "/etc/lp/logs", NULL);
-/* S, 1, Lp_Tmp, Local_System, ... DONE BELOW */
-proto (S, 1, Lp_Bin, NULL, Lp_Spooldir, "bin", NULL);
-proto (S, 1, Lp_A, NULL, Lp_Admins, "lp", NULL);
-
- /*
- * OTHER FILES:
- */
-
- /*
- * SPECIAL CASE:
- * If the "temp" symbolic link already exists,
- * but is not correct, assume the machine's nodename changed.
- * Rename directories that include the nodename, if possible,
- * so that unprinted requests are saved. Then change the
- * symbolic link.
- * Watch out for a ``symbolic link'' that isn't!
- */
- if (Lstat(Lp_Temp, &stbuf) == 0)
- switch (stbuf.st_mode & S_IFMT) {
-
- default:
- Unlink (Lp_Temp);
- break;
-
- case S_IFDIR:
- Rmdir (Lp_Temp);
- break;
-
- case S_IFLNK:
- check_link();
- break;
- }
-
- proto(S, 1, Lp_Tmp, Local_System, NULL, Lp_Temp, NULL);
-
- am_in_background = real_am_in_background;
- return;
-}
-
-static void
-check_link()
-{
- int len;
- char symbolic[MAXPATHLEN + 1];
- char *real_dir;
- char *old_system;
-
- if ((len = Readlink(Lp_Temp, symbolic, MAXPATHLEN)) <= 0) {
- Unlink(Lp_Temp);
- return;
- }
-
- /*
- * If the symbolic link contained trailing slashes, remove
- * them.
- */
- while ((len > 1) && (symbolic[len - 1] == '/')) {
- len--;
- }
- symbolic[len] = 0;
-
- /* check that symlink points into /var/spool/lp/tmp */
- if (strncmp(Lp_Tmp, symbolic, strlen(Lp_Tmp)) != 0) {
- Unlink(Lp_Temp);
- return;
- }
-
- /*
- * Check that symlink points to something.
- * There should be at least 2 characters
- * after the string '/var/spool/lp/tmp':
- * a '/' and another character.
- */
- if (len <= strlen(Lp_Tmp) + 1) {
- Unlink(Lp_Temp);
- return;
- }
-
- real_dir = makepath(Lp_Tmp, Local_System, NULL);
- if (!STREQU(real_dir, symbolic)) {
- if (!(old_system = strrchr(symbolic, '/')))
- old_system = symbolic;
- else
- old_system++;
-
- /*
- * The "rename()" system call (buried
- * inside the "_rename()" routine) should
- * succeed, even though we blindly created
- * the new directory earlier, as the only
- * directory entries should be . and ..
- * (although if someone already created
- * them, we'll note the fact).
- */
- _rename(old_system, Local_System, Lp_Tmp, NULL);
- _rename(old_system, Local_System, Lp_Requests, NULL);
-
- Unlink(Lp_Temp);
- }
- Free(real_dir);
-}
-
-
-/**
- ** proto()
- **/
-
-static void
-proto(int type, int rm_ok, ...)
-{
- va_list ap;
-
- char *path,
- *symbolic;
-
- int exist,
- err;
-
- mode_t mode;
-
- uid_t uid;
-
- gid_t gid;
-
- struct stat stbuf;
-
-
- va_start(ap, rm_ok);
-
- if ((err = va_makepath(&ap, &path)) < 0)
- fail ("\"%s\" is a truncated name!\n", path);
-
- exist = (stat(path, &stbuf) == 0);
-
- switch (type) {
-
- case S:
- if (!exist)
- fail ("%s is missing!\n", path);
- if ((err = va_makepath(&ap, &symbolic)) < 0)
- fail ("\"%s\" is a truncated name!\n", symbolic);
- Symlink (path, symbolic);
- Free (symbolic);
- Free (path);
- return;
-
- case D:
- if (exist && !S_ISDIR(stbuf.st_mode)) {
- if (!rm_ok)
- fail ("%s is not a directory!\n", path);
- else {
- Unlink (path);
- exist = 0;
- }
- }
- if (!exist)
- Mkdir (path, 0);
- break;
-
- case F:
- if (exist && !S_ISREG(stbuf.st_mode)) {
- if (!rm_ok)
- fail ("%s is not a file!\n", path);
- else {
- Unlink (path);
- exist = 0;
- }
- }
- if (!exist)
- Close(Creat(path, 0));
- break;
-
- case P:
- /*
- * Either a pipe or a file.
- */
- if (exist &&
- !S_ISREG(stbuf.st_mode) && !S_ISFIFO(stbuf.st_mode)) {
- if (!rm_ok)
- fail ("%s is not a file or pipe!\n", path);
- else {
- Unlink (path);
- exist = 0;
- }
- }
- if (!exist)
- Close(Creat(path, 0));
- break;
-
- }
-
- mode = va_arg(ap, mode_t);
- uid = va_arg(ap, uid_t);
- gid = va_arg(ap, gid_t);
- (void) chownmod(path, uid, gid, mode);
-
- Free (path);
- return;
-}
-
-/*
- * va_makepath()
- *
- * Takes a variable length list of path components and attempts to string them
- * together into a path. It returns a heap-allocated string via the output
- * parameter 'ret', and returns an integer success value: < 0 indicates failure,
- * 0 indicates success. Note that 'ret' will never be NULL (unless the system
- * is so overloaded that it can't allocate a single byte), and should always be
- * free()d.
- */
-static int
-va_makepath (va_list *pap, char **ret)
-{
- char *component;
- char buf[MAXPATHLEN];
- int buflen;
-
- memset(buf, NULL, sizeof (buf));
- while ((component = va_arg((*pap), char *)) != NULL) {
- if (strlcat(buf, component, sizeof (buf)) >= sizeof (buf) ||
- strlcat(buf, "/", sizeof (buf)) >= sizeof (buf)) {
- if ((*ret = strdup(buf)) == NULL)
- *ret = strdup("");
- return (-1);
- }
- }
-
- /* remove the trailing slash */
- buflen = strlen(buf);
- if ((buflen > 1) && (buf[buflen - 1] == '/')) {
- buf[buflen - 1] = '\0';
- }
-
- if ((*ret = strdup(buf)) == NULL) {
- *ret = strdup("");
- return (-1);
- }
- return (0);
-}
-
-/**
- ** _rename()
- **/
-
-static void
-_rename(char *old_system, char *new_system, ...)
-{
- va_list ap;
-
- char * prefix;
- char * old;
- char * new;
- int err;
-
-
- va_start (ap, new_system);
- if ((err = va_makepath(&ap, &prefix)) < 0)
- fail (
- "Rename failed; prefix \"%s\" is a truncated name.\n",
- prefix
- );
- va_end (ap);
-
- old = makepath(prefix, old_system, (char *)0);
- new = makepath(prefix, new_system, (char *)0);
-
- if (Rename(old, new) == 0)
- note ("Renamed %s to %s.\n", old, new);
- else if (errno == EEXIST)
- note (
- "Rename of %s to %s failed because %s exists.\n",
- old,
- new,
- new
- );
- else
- fail (
- "Rename of %s to %s failed (%s).\n",
- old,
- new,
- PERROR
- );
-
- Free (new);
- Free (old);
- Free (prefix);
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/lpsched.c b/usr/src/cmd/lp/cmd/lpsched/lpsched.c
deleted file mode 100644
index f4c8d7fad4..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/lpsched.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "limits.h"
-#include "ulimit.h"
-#include "sys/utsname.h"
-
-#include "lpsched.h"
-
-#include <sys/stat.h>
-#include <sys/time.h> /* to up the max # of fds */
-#include <sys/resource.h>
-#include <syslog.h>
-#include <locale.h>
-#include <stdio_ext.h>
-
-
-int lock_fd = -1;
-int isStartingForms = 0;
-int Starting = 0;
-int Shutdown = 0;
-int DoneChildren = 0;
-int Sig_Alrm = 0;
-int OpenMax = OPEN_MAX;
-int Reserve_Fds = 0;
-
-char *Local_System = 0;
-char *SHELL = 0;
-
-gid_t Lp_Gid;
-uid_t Lp_Uid;
-
-#if defined(DEBUG)
-unsigned long debug = 0;
-static int signals = 0;
-#endif
-
-extern int errno;
-extern void shutdown_messages();
-
-int am_in_background = 0;
-
-static void disable_signals();
-static void startup();
-static void process();
-static void ticktock(int);
-static void background();
-static void usage();
-static void Exit();
-static void disable_signals();
-
-/**
- ** main()
- **/
-
-int
-main(int argc, char *argv[])
-{
- int c;
- extern char *optarg;
- extern int optopt;
- extern int opterr;
- char * cp;
- struct rlimit rlim;
- int fd_limit = 4096;
-
- (void) setlocale(LC_ALL, "");
- if ((cp = strrchr(argv[0], '/')) == NULL)
- cp = argv[0];
- else
- cp++;
-
- /* open the syslog() */
- openlog(cp, LOG_PID|LOG_NDELAY|LOG_NOWAIT, LOG_LPR);
-
- SHELL = DEFAULT_SHELL;
-
- opterr = 0;
- while((c = getopt(argc, (char * const *)argv, "dsf:n:r:M:p:")) != EOF)
- switch(c)
- {
-# if defined (DEBUG)
- case 'd':
- debug = DB_ALL;
- syslog(LOG_DEBUG, "debug = DB_ALL");
- break;
-
- case 's':
- signals++;
- break;
-# endif /* DEBUG */
-
- case 'f':
- if ((ET_SlowSize = atoi(optarg)) < 1)
- ET_SlowSize = 1;
- syslog(LOG_DEBUG, "-f option is %d", ET_SlowSize);
- break;
-
- case 'n':
- if ((ET_NotifySize = atoi(optarg)) < 1)
- ET_NotifySize = 1;
- syslog(LOG_DEBUG, "-n option is %d", ET_NotifySize);
- break;
-
- case 'r':
- if ((Reserve_Fds = atoi(optarg)) < 0)
- Reserve_Fds = 0;
- syslog(LOG_DEBUG, "-r option is %d", Reserve_Fds);
- break;
-
- case 'p':
- if ((fd_limit = atoi(optarg)) < 16)
- fd_limit = 4096;
- syslog(LOG_DEBUG, "-p option is %d", fd_limit);
- break;
-
- case '?':
- if (optopt == '?') {
- usage ();
- exit (0);
- } else
- fail ("%s: illegal option -- %c\n", argv[0], optopt);
- }
-
- /* reset the fd resource limit */
- rlim.rlim_max = rlim.rlim_cur = fd_limit;
- setrlimit(RLIMIT_NOFILE, &rlim);
- getrlimit(RLIMIT_NOFILE, &rlim);
- (void) enable_extended_FILE_stdio(-1, -1);
- syslog(LOG_DEBUG, "file descriptor resource limit is %d (~%d printers)",
- rlim.rlim_cur, (rlim.rlim_cur - 12)/ 2);
-
- lp_alloc_fail_handler = mallocfail;
-
- startup();
-
- process();
-
- lpshut(1); /* one last time to clean up */
- /*NOTREACHED*/
- return (0);
-}
-
-static void
-startup()
-{
- struct passwd *p;
-
-
- Starting = 1;
- getpaths();
-
- /*
- * There must be a user named "lp".
- */
- if ((p = getpwnam(LPUSER)) == NULL)
- fail ("Can't find the user \"lp\" on this system!\n");
-
- Lp_Uid = p->pw_uid;
- Lp_Gid = p->pw_gid;
-
- /*
- * Only "root" is allowed to run us.
- */
- if ((getuid() != 0) && (geteuid() != 0))
- fail ("You must be \"root\" to run this program.\n");
-
- setuid (0);
-
- Local_System = Strdup("localhost");
-
- /*
- * Make sure that all critical directories are present and that
- * symbolic links are correct.
- */
- lpfsck();
-
- /*
- * Try setting the lock file to see if another Spooler is running.
- * We'll release it immediately; this allows us to fork the child
- * that will run in the background. The child will relock the file.
- */
- if ((lock_fd = open_locked(Lp_Schedlock, "a", 0664)) < 0)
- if (errno == EAGAIN)
- fail ("Print services already active.\n");
- else
- fail ("Can't open file \"%s\" (%s).\n", NB(Lp_Schedlock), PERROR);
- close(lock_fd);
-
- background();
- /*
- * We are the child process now.
- */
-
- if ((lock_fd = open_locked(Lp_Schedlock, "w", 0664)) < 0)
- fail ("Failed to lock the file \"%s\" (%s).\n", NB(Lp_Schedlock), PERROR);
-
- Close (0);
- Close (2);
- if (am_in_background)
- Close (1);
-
- if ((OpenMax = ulimit(4, 0L)) == -1)
- OpenMax = OPEN_MAX;
-
- disable_signals();
-
- init_messages();
-
- init_memory();
-
- note ("Print services started.\n");
- Starting = 0;
-}
-
-void
-lpshut(int immediate)
-{
- int i;
- extern MESG * Net_md;
-
-
- /*
- * If this is the first time here, stop all running
- * child processes, and shut off the alarm clock so
- * it doesn't bug us.
- */
- if (!Shutdown) {
- mputm (Net_md, S_SHUTDOWN, 1);
- for (i = 0; Exec_Table != NULL && Exec_Table[i] != NULL; i++)
- terminate (Exec_Table[i]);
- alarm (0);
- Shutdown = (immediate? 2 : 1);
- }
-
- /*
- * If this is an express shutdown, or if all the
- * child processes have been cleaned up, clean up
- * and get out.
- */
- if (Shutdown == 2) {
-
- /*
- * We don't shut down the message queues until
- * now, to give the children a chance to answer.
- * This means an LP command may have been snuck
- * in while we were waiting for the children to
- * finish, but that's OK because we'll have
- * stored the jobs on disk (that's part of the
- * normal operation, not just during shutdown phase).
- */
- shutdown_messages();
-
- (void) close(lock_fd);
- (void) Unlink(Lp_Schedlock);
-
- note ("Print services stopped.\n");
- exit (0);
- /*NOTREACHED*/
- }
-}
-
-static void
-process()
-{
- FSTATUS *pfs;
- PWSTATUS *ppws;
- int i;
-
-
- /*
- * Call the "check_..._alert()" routines for each form/print-wheel;
- * we need to do this at this point because these routines
- * short-circuit themselves while we are in startup mode.
- * Calling them now will kick off any necessary alerts.
- */
- isStartingForms = 1;
- for (i = 0; FStatus != NULL && FStatus[i] != NULL; i++)
- check_form_alert (FStatus[i], (_FORM *)0);
- isStartingForms = 0;
-
- for (i = 0; PWStatus != NULL && PWStatus[i] != NULL; i++)
- check_pwheel_alert (PWStatus[i], (PWHEEL *)0);
-
- /*
- * Clear the alarm, then schedule an EV_ALARM. This will clear
- * all events that had been scheduled for later without waiting
- * for the next tick.
- */
- alarm (0);
- schedule (EV_ALARM);
-
- /*
- * Start the ball rolling.
- */
- schedule (EV_INTERF, (PSTATUS *)0);
- schedule (EV_NOTIFY, (RSTATUS *)0);
- schedule (EV_SLOWF, (RSTATUS *)0);
-
- for (EVER) {
- take_message ();
-
- if (Sig_Alrm)
- schedule (EV_ALARM);
-
- if (DoneChildren)
- dowait ();
-
- if (Shutdown)
- check_children();
- if (Shutdown == 2)
- break;
- }
-}
-
-/*ARGSUSED*/
-static void
-ticktock(int sig)
-{
- Sig_Alrm = 1;
- (void)signal (SIGALRM, ticktock);
- return;
-}
-
-static void
-background()
-{
-#if defined(DEBUG)
- if (debug & DB_SDB)
- return;
-#endif
-
- switch(fork())
- {
- case -1:
- fail ("Failed to fork child process (%s).\n", PERROR);
- /*NOTREACHED*/
-
- case 0:
- (void) setpgrp();
- am_in_background = 1;
- return;
-
- default:
- note ("Print services started.\n");
- exit(0);
- /* NOTREACHED */
- }
-}
-
-static void
-usage()
-{
- note ("\
-usage: lpsched [ options ]\n\
- [ -f #filter-slots ] (increase no. concurrent slow filters)\n\
- [ -n #notify-slots ] (increase no. concurrent notifications)\n\
- [ -r #reserved-fds ] (increase margin of file descriptors)\n"
- );
-
-#if defined(DEBUG)
- note ("\
- [ -d ] (same as -D ALL)\n\
- [ -s ] (don't trap most signals)\n"
- );
-#endif
-
- note ("\
-WARNING: all these options are currently unsupported\n"
- );
-
- return;
-}
-
-static void
-Exit(n)
- int n;
-{
- fail ("Received unexpected signal %d; terminating.\n", n);
-}
-
-static void
-disable_signals()
-{
- int i;
-
-# if defined(DEBUG)
- if (!signals)
-# endif
- for (i = 0; i < NSIG; i++)
- if (signal(i, SIG_IGN) != SIG_IGN)
- signal (i, Exit);
-
- (void) signal(SIGHUP, SIG_IGN);
- (void) signal(SIGINT, SIG_IGN);
- (void) signal(SIGQUIT, SIG_IGN);
- (void) signal(SIGALRM, ticktock);
- (void) signal(SIGTERM, lpshut); /* needs arg, but sig# OK */
- (void) signal(SIGCLD, SIG_IGN);
- (void) signal(SIGTSTP, SIG_IGN);
- (void) signal(SIGCONT, SIG_DFL);
- (void) signal(SIGTTIN, SIG_IGN);
- (void) signal(SIGTTOU, SIG_IGN);
- (void) signal(SIGXFSZ, SIG_IGN); /* could be a problem */
- (void) signal(SIGWINCH, SIG_IGN); /* if started in a window */
- (void) signal(SIGTHAW, SIG_IGN); /* used by CPR - energystar */
-
-#if defined(DEBUG)
- if (debug & DB_ABORT)
- (void) signal(SIGABRT, SIG_DFL);
-#endif
-
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/lpsched.h b/usr/src/cmd/lp/cmd/lpsched/lpsched.h
deleted file mode 100644
index c9a4d95b99..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/lpsched.h
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdio.h"
-#include "sys/types.h"
-#include "memory.h"
-#include "string.h"
-#include "pwd.h"
-#include "fcntl.h"
-#include "errno.h"
-#include "signal.h"
-#include "unistd.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "access.h"
-#include "form.h"
-#include "requests.h"
-#include "filters.h"
-#include "printers.h"
-#include "class.h"
-#include "users.h"
-#include "secure.h"
-#include "msgs.h"
-
-#include "nodes.h"
-
-/**
- ** Defines:
- **/
-
-/*
- * These are the fields in the PSTATUS and CSTATUS files,
- * found in the SYSTEM directory.
- */
-
-#define PST_MAX 8
-# define PST_BRK 0
-# define PST_NAME 1
-# define PST_STATUS 2
-# define PST_DATE 3
-# define PST_DISREAS 4
-# define PST_REJREAS 5
-# define PST_PWHEEL 6
-# define PST_FORM 7
-
-#define CST_MAX 5
-# define CST_BRK 0
-# define CST_NAME 1
-# define CST_STATUS 2
-# define CST_DATE 3
-# define CST_REJREAS 4
-
-/*
- * Exit codes from child processes:
- *
- * 0 <= exit <= 0177 (127) are reserved for ``normal'' exits.
- * 0200 <= exit <= 0377 (255) are reserved for special failures.
- *
- * If bit 0200 is set, then we have three sets of special error
- * codes available, with 32 values in each set (except the first):
- *
- * 0201 - 0237 Printer faults
- * 0240 - 0277 Dial problems
- * 0300 - 0337 Port problems
- * 0340 - 0377 Exec problems
- *
- * 0200 Interface received SIGTERM
- */
-#define EXEC_EXIT_OKAY 0 /* success */
-#define EXEC_EXIT_USER 0177 /* user exit codes, 7 bits */
-#define EXEC_EXIT_NMASK 0340 /* mask to uncover reason bits */
-#define EXEC_EXIT_FAULT 0201 /* printer fault */
-#define EXEC_EXIT_HUP 0202 /* got hangup early in exec */
-#define EXEC_EXIT_INTR 0203 /* got interrupt early in exec */
-#define EXEC_EXIT_PIPE 0204 /* got close of FIFO early in exec */
-#define EXEC_EXIT_EXIT 0237 /* interface used reserved exit code */
-#define EXEC_EXIT_NDIAL 0240 /* can't dial, low 5 bits abs(dial()) */
-#define EXEC_EXIT_NPORT 0300 /* can't open port */
-#define EXEC_EXIT_TMOUT 0301 /* can't open port in N seconds */
-#define EXEC_EXIT_NOPEN 0340 /* can't open input/output file */
-#define EXEC_EXIT_NEXEC 0341 /* can't exec */
-#define EXEC_EXIT_NOMEM 0342 /* malloc failed */
-#define EXEC_EXIT_NFORK 0343 /* fork failed, must try again */
-#define EXEC_EXIT_NPUSH 0344 /* could not push streams module(s) */
-
-#define EXIT_RETRY 129 /* interface failed, try again */
-
-/*
- * If killed, return signal, else 0.
- */
-#define KILLED(x) (!(x & 0xFF00)? (x & 0x7F) : 0)
-
-/*
- * If exited, return exit code, else -1.
- */
-#define EXITED(x) (!(x & 0xFF)? ((x >> 8) & 0xFF) : -1)
-
-/*
- * Events that can be scheduled:
- */
-#define EV_SLOWF 1
-#define EV_INTERF 2
-#define EV_NOTIFY 3
-#define EV_LATER 4
-#define EV_ALARM 5
-#define EV_MESSAGE 6
-#define EV_ENABLE 7
-#define EV_FORM_MESSAGE 8
-
-/*
- * How long to wait before retrying an event:
- * (For best results, make CLOCK_TICK a factor of 60.)
- */
-#define CLOCK_TICK 10 /* no. seconds between alarms */
-#define MINUTE (60/CLOCK_TICK) /* number of ticks per minute */
-#define WHEN_FORK (MINUTE) /* retry forking child process */
-#define WHEN_PRINTER (1*MINUTE) /* retry faulted printer */
-
-/*
- * Alert types:
- */
-#define A_PRINTER 1
-#define A_PWHEEL 2
-#define A_FORM 3
-
-/*
- * How to handle active requests when disabling a printer:
- */
-#define DISABLE_STOP 0
-#define DISABLE_FINISH 1
-#define DISABLE_CANCEL 2
-
-/*
- * validate_request() - VERIFY REQUEST CAN BE PRINTED
- * evaluate_request() - TRY REQUEST ON A PARTICULAR PRINTER
- * reevaluate_request() - TRY TO MOVE REQUEST TO ANOTHER PRINTER
- */
-
-#define validate_request(PRS,PREFIXP,MOVING) \
- _validate((PRS), (PSTATUS *)0, (PSTATUS *)0, (PREFIXP), (MOVING))
-
-#define evaluate_request(PRS,PPS,MOVING) \
- _validate((PRS), (PPS), (PSTATUS *)0, (char **)0, (MOVING))
-
-#define reevaluate_request(PRS,PPS) \
- _validate((PRS), (PSTATUS *)0, (PPS), (char **)0, 0)
-
-/*
- * Request is ready to be slow-filtered:
- */
-#define NEEDS_FILTERING(PRS) \
- ((PRS)->slow && !((PRS)->request->outcome & RS_FILTERED))
-
-/*
- * Misc:
- */
-
-#define isadmin(ID) (!(ID) || (ID) == Lp_Uid)
-
-#define makereqerr(PRS) \
- makepath( \
- Lp_Temp, \
- getreqno((PRS)->secure->req_id), \
- (char *)0 \
- )
-
-#define EVER ;;
-
-#define DEFAULT_SHELL "/bin/sh"
-
-#define BINMAIL "/bin/mail"
-#define BINWRITE "/bin/write"
-
-#define RMCMD "/usr/bin/rm -f"
-
-
-#if defined(MLISTENDEL_WORKS)
-#define DROP_MD(MD) if (MD) { \
- mlistendel (MD); \
- mdisconnect (MD); \
- MD = 0; \
- } else /*EMPTY*/
-#else
-#define DROP_MD(MD) if (MD) { \
- Close ((MD)->readfd); \
- if ((MD)->writefd == (MD)->readfd) \
- (MD)->writefd = -1; \
- (MD)->readfd = -1; \
- MD = 0; \
- } else /*EMPTY*/
-#endif
-
-/**
- ** External routines:
- **/
-
-typedef int (*qchk_fnc_type)( RSTATUS * );
-
-CLASS * Getclass ( char * );
-
-extern void GetRequestFiles(REQUEST *req, char *buffer, int length);
-
-
-PRINTER * Getprinter ( char * );
-
-PWHEEL * Getpwheel ( char * );
-
-
-REQUEST * Getrequest ( char * );
-
-RSTATUS * request_by_id ( char * );
-RSTATUS * request_by_id_num ( long );
-RSTATUS * request_by_jobid ( char * , char * );
-
-SECURE * Getsecure ( char * );
-
-USER * Getuser ( char * );
-
-_FORM * Getform ( char * );
-
-char * _alloc_files ( int , char * , uid_t , gid_t);
-char * dispatchName(int);
-char * statusName(int);
-char * getreqno ( char * );
-
-int Loadfilters ( char * );
-int Putsecure(char *, SECURE *);
-int cancel ( RSTATUS * , int );
-int disable ( PSTATUS * , char * , int );
-int enable ( PSTATUS * );
-int exec ( int , ... );
-int one_printer_with_charsets ( RSTATUS * );
-int open_dialup ( char * , PRINTER * );
-int open_direct ( char * , PRINTER * );
-int qchk_filter ( RSTATUS * );
-int qchk_form ( RSTATUS * );
-int qchk_pwheel ( RSTATUS * );
-int qchk_waiting ( RSTATUS * );
-int queue_repel ( PSTATUS * , int , int (*)( RSTATUS * ) );
-int rsort ( RSTATUS ** , RSTATUS ** );
-
-long getkey ( void );
-long _alloc_req_id ( void );
-
-off_t chfiles ( char ** , uid_t , gid_t );
-
-short _validate ( RSTATUS * , PSTATUS * , PSTATUS * , char ** , int );
-
-void add_flt_act ( MESG * , ... );
-void alert ( int , ... );
-void cancel_alert ( int , ... );
-void check_children ( void );
-void check_form_alert ( FSTATUS * , _FORM * );
-void check_pwheel_alert ( PWSTATUS * , PWHEEL * );
-void check_request ( RSTATUS * );
-void del_flt_act ( MESG * , ... );
-void dial_problem ( PSTATUS * , RSTATUS * , int );
-void dispatch ( int , char * , MESG * );
-void dowait ( void );
-void dump_cstatus ( void );
-void dump_fault_status(PSTATUS *);
-void dump_pstatus ( void );
-void dump_status ( void );
-void execlog ( char * , ... );
-void fail ( char * , ... );
-void free_form ( _FORM * );
-void freerstatus ( register RSTATUS * );
-void init_memory ( void );
-void init_messages ( void );
-void insertr ( RSTATUS * );
-void load_sdn ( char ** , SCALED );
-void load_status ( void );
-void load_str ( char ** , char * );
-void lp_endpwent ( void );
-void lp_setpwent ( void );
-void lpfsck ( void );
-void lpshut ( int );
-void mallocfail ( void );
-void maybe_schedule ( RSTATUS * );
-void note ( char * , ... );
-void notify ( RSTATUS * , char * , int , int , int );
-void printer_fault ( PSTATUS * , RSTATUS * , char * , int );
-void clear_printer_fault ( PSTATUS * , char * );
-void putjobfiles ( RSTATUS * );
-void queue_attract ( PSTATUS * , int (*)( RSTATUS * ) , int );
-void queue_check ( int (*)( RSTATUS * ) );
-void queue_form ( RSTATUS * , FSTATUS * );
-void queue_pwheel ( RSTATUS * , char * );
-void remount_form(register PSTATUS *, FSTATUS *, short);
-void remover ( RSTATUS * );
-void rmfiles ( RSTATUS * , int );
-void rmreq ( RSTATUS * );
-void schedule ( int , ... );
-void take_message ( void );
-void terminate ( EXEC * );
-void unload_list ( char *** );
-void unload_str ( char ** );
-void unqueue_form ( RSTATUS * );
-void unqueue_pwheel ( RSTATUS * );
-void update_req ( char * , long );
-int isFormMountedOnPrinter ( PSTATUS *, FSTATUS * );
-int isFormUsableOnPrinter ( PSTATUS *, FSTATUS * );
-char *allTraysWithForm ( PSTATUS *, FSTATUS * );
-extern int list_append(void ***, void *);
-extern void list_remove(void ***, void *);
-
-extern RSTATUS *new_rstatus(REQUEST *, SECURE *);
-extern PSTATUS *new_pstatus(PRINTER *);
-extern CSTATUS *new_cstatus(CLASS *);
-extern FSTATUS *new_fstatus(_FORM *f);
-extern PWSTATUS *new_pwstatus(PWHEEL *p);
-extern ALERT *new_alert(char *fmt, int i);
-extern EXEC *new_exec(int type, void *ex);
-
-extern void pstatus_add_printer(PSTATUS *, PRINTER *);
-
-extern void free_exec(EXEC *);
-extern void free_alert(ALERT *);
-extern void free_pwstatus(PWSTATUS *);
-extern void free_fstatus(FSTATUS *);
-extern void free_cstatus(CSTATUS *);
-extern void free_pstatus(PSTATUS *);
-extern void free_rstatus(RSTATUS *);
-
-extern CSTATUS *search_cstatus ( char * );
-extern FSTATUS *search_fptable(register char *);
-extern FSTATUS *search_fstatus ( char * );
-extern PSTATUS *search_pstatus ( char * );
-extern PWSTATUS *search_pwstatus ( char * );
-
-/*
- * Things that can't be passed as parameters:
- */
-
-extern FSTATUS *form_in_question;
-
-extern char *pwheel_in_question;
-
-/**
- ** External tables, lists:
- **/
-
-extern CSTATUS **CStatus; /* Status of classes */
-extern PSTATUS **PStatus; /* Status of printers */
-extern FSTATUS **FStatus; /* Status of forms */
-extern PWSTATUS **PWStatus; /* Status of print wheels */
-
-extern EXEC **Exec_Table; /* Running processes */
-extern EXEC **Exec_Slow, /* First slow filter exec */
- **Exec_Notify; /* First notification exec */
-
-extern RSTATUS *Request_List; /* Queue of print requests */
-extern RSTATUS *NewRequest; /* Not in Request_List yet */
-
-extern int ET_SlowSize, /* Number of filter execs */
- ET_NotifySize; /* Number of notify execs */
-
-#if defined(DEBUG)
-#define DB_ABORT 0x00000008
-#define DB_SDB 0x00000020
-#define DB_ALL 0xFFFFFFFF
-
-extern unsigned long debug;
-#endif
-
-extern char *Local_System, /* Node name of local system */
- *SHELL; /* value of $SHELL, or default */
-
-extern int lock_fd;
-
-extern uid_t Lp_Uid;
-
-extern gid_t Lp_Gid;
-
-extern int Starting,
- OpenMax,
- Sig_Alrm,
- DoneChildren,
- am_in_background,
- Shutdown;
-
-extern unsigned long chkprinter_result;
-
-#if defined(MDL)
-#include "mdl.h"
-#endif
-# define CLOSE_ON_EXEC(fd) (void) Fcntl(fd, F_SETFD, 1)
diff --git a/usr/src/cmd/lp/cmd/lpsched/msgs.c b/usr/src/cmd/lp/cmd/lpsched/msgs.c
deleted file mode 100644
index a9e51c6224..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/msgs.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-# include <stdarg.h>
-# include <limits.h>
-# include <sys/types.h>
-# include <poll.h>
-# include <stropts.h>
-# include <unistd.h>
-#include <syslog.h>
-
-# include "lpsched.h"
-
-#define TURN_OFF(X,F) (void)Fcntl(X, F_SETFL, (Fcntl(X, F_GETFL, 0) & ~(F)))
-
-
-static void conn_shutdown();
-
-extern int Filter_Status;
-extern void dispatch();
-extern int Waitrequest;
-void shutdown_messages();
-static char *Message;
-static int MaxClients = 0,
- do_msg();
-extern int Reserve_Fds;
-extern int Shutdown;
-
-MESG *Net_md;
-
-/*
-** take_message() - WAIT FOR INTERRUPT OR ONE MESSAGE FROM USER PROCESS
-*/
-
-void take_message(void)
-{
- int bytes;
- int i;
- MESG * md;
-
- for (EVER) { /* not really forever...returns are in the loop */
- if ((md = mlisten()) == NULL)
- switch(errno) {
- case EAGAIN:
- case EINTR:
- return;
-
- case ENOMEM:
- mallocfail();
- /* NOTREACHED */
-
- default:
- fail ("Unexpected streams error in mlisten (%s).\n" , PERROR);
- }
-
- /*
- * Check for a dropped connection to a child.
- * Normally a child should tell us that it is dying
- * (with S_SHUTDOWN or S_SEND_CHILD), but it may have
- * died a fast death. We'll simulate the message we
- * wanted to get so we can use the same code to clean up.
- */
- if ((md->event & POLLHUP) && !(md->event & POLLIN) ||
- (md->event & (POLLERR|POLLNVAL))) {
- switch (md->type) {
-
- case MD_CHILD:
- /*
- * If the message descriptor is found in the
- * exec table, it must be an interface pgm,
- * notification, etc. Otherwise, it must be
- * a network child.
- */
- for (i = 0; Exec_Table[i] != NULL; i++)
- if (Exec_Table[i]->md == md)
- break;
-
- if (Exec_Table[i] != NULL) {
- (void) putmessage(Message, S_CHILD_DONE,
- Exec_Table[i]->key, 0, 0);
- } else {
- (void) putmessage(Message, S_SHUTDOWN, 1);
- }
- bytes = 1;
- break;
-
- default:
- bytes = -1;
- break;
-
- }
-
- } else {
- if (md->readfd == -1) { /* something happened to the readfd */
- syslog(LOG_DEBUG, "take_message: readfd is -1");
- return;
- }
- bytes = mread(md, Message, MSGMAX);
- }
-
- switch (bytes) {
- case -1:
- if (errno == EINTR)
- return;
- else
- fail ("Unexpected streams error (%s).\n" , PERROR);
- break;
-
- case 0:
- break;
-
- default:
- if (do_msg(md))
- return;
- break;
- }
- }
-}
-
-/*
-** do_msg() - HANDLE AN INCOMING MESSAGE
-*/
-
-static int
-do_msg(MESG *md)
-{
- int type = mtype(Message);
-
- if (type != S_GOODBYE) {
- md->wait = 0;
- dispatch (type, Message, md);
- /*
- * The message may have caused the need to
- * schedule something, so go back and check.
- */
- return(1);
- }
- return(0);
-}
-
-/*
-** calculate_nopen() - DETERMINE # FILE DESCRIPTORS AVAILABLE FOR QUEUES
-*/
-
-static void
-calculate_nopen(void)
-{
- int fd, nopen;
-
- /*
- * How many file descriptorss are currently being used?
- */
- for (fd = nopen = 0; fd < OpenMax; fd++)
- if (fcntl(fd, F_GETFL, 0) != -1)
- nopen++;
-
- /*
- * How many file descriptors are available for use
- * as open FIFOs? Leave one spare as a way to tell
- * clients we don't have any to spare (hmmm....) and
- * one for the incoming fifo.
- */
-
- MaxClients = OpenMax;
- MaxClients -= nopen; /* current overhead */
- MaxClients -= Reserve_Fds;
- MaxClients -= 2; /* incoming FIFO and spare outgoing */
- MaxClients--; /* the requests log */
- MaxClients--; /* HPI routines and lpsched log */
-
- return;
-}
-
-static void conn_shutdown ( )
-{
- if (!Shutdown) {
- note ("The public connection \"%s\", has failed.\n", Lp_FIFO);
- lpshut(1);
- }
-}
-
-/*
-** init_messages() - INITIALIZE MAIN MESSAGE QUEUE
-*/
-
-void
-init_messages(void)
-{
- char *cmd;
- MESG * md;
-
- (void) signal(SIGPIPE, SIG_IGN);
-
- calculate_nopen ();
-
- Message = (char *)Malloc(MSGMAX);
-
- (void) Chmod(Lp_Tmp, 0711);
-
- if ((md = mcreate(Lp_FIFO)) == NULL)
- fail ("Can't create public message device (%s).\n", PERROR);
- mon_discon(md, conn_shutdown);
-
- if (mlisteninit(md) != 0)
- if (errno == ENOMEM)
- mallocfail();
- else
- fail ("Unexpected streams error (%s).\n" , PERROR);
-
- (void) Chmod(Lp_FIFO, 0666);
- return;
-}
-
-
-void
-shutdown_messages(void)
-{
- MESG *md;
-
- (void) Chmod(Lp_Tmp, 0700);
- (void) Chmod(Lp_FIFO, 0600);
- md = mlistenreset();
- mdestroy(md);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/nodes.h b/usr/src/cmd/lp/cmd/lpsched/nodes.h
deleted file mode 100644
index 3ace135c23..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/nodes.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-typedef struct alert_node ALERT;
-typedef struct cstat_node CSTATUS;
-typedef struct exec_node EXEC;
-typedef struct form_node _FORM;
-typedef struct fstat_node FSTATUS;
-typedef struct pfstat_node PFSTATUS;
-typedef struct pstat_node PSTATUS;
-typedef struct pwstat_node PWSTATUS;
-typedef struct rstat_node RSTATUS;
-
-struct alert_node
-{
- short active; /* Non-zero if triggered */
- EXEC *exec; /* Index into EXEC table */
- char *msgfile;
-};
-
-struct cstat_node
-{
- short status;
- char *rej_reason;
- time_t rej_date;
- CLASS *class;
-};
-
-struct exec_node
-{
- int pid; /* process-id of exec */
- int status; /* low order bits from wait */
- long key; /* private key for security */
- short Errno; /* copy of child's errno */
- short type; /* type of exec, EX_... */
- ushort flags; /* flags, EXF_... */
- MESG *md;
- union ex
- {
- RSTATUS *request;
- FSTATUS *form;
- PWSTATUS *pwheel;
- PSTATUS *printer;
- } ex;
-};
-
-#define EX_INTERF 1 /* exec interface for ex.printer */
-#define EX_SLOWF 2 /* exec slow filter for ex.request */
-#define EX_ALERT 3 /* exec alert for ex.printer */
-#define EX_FALERT 4 /* exec alert for ex.form */
-#define EX_PALERT 5 /* exec alert for ex.pwheel */
-#define EX_NOTIFY 6 /* exec notification for ex.request */
-#define EX_FAULT_MESSAGE 7 /* exec fault message*/
-#define EX_FORM_MESSAGE 8 /* form fault message*/
-
-#define EXF_RESTART 0x0001 /* restart the exec */
-#define EXF_KILLED 0x0002 /* terminate() has killed the exec */
-#define EXF_GONE 0x0004 /* child has disappeared */
-
-/*
-** Possible values for FLT.type
-*/
-#define FLT_FILES 1 /* remove alloc'd files */
-#define FLT_CHANGE 2 /* clear RS_CHANGING for .r1 */
-
-struct fstat_node
-{
- _FORM *form;
- ALERT *alert;
- short requests; /* Number of events thus far */
- short requests_last; /* # when alert last sent */
- short trigger; /* Trigger when this value */
- short mounted; /* # times currently mounted */
- char **users_allowed;
- char **users_denied;
- char *cpi;
- char *lpi;
- char *plen;
- char *pwid;
-};
-
-struct pfstat_node
-{
- FSTATUS *form;
- short isAvailable;
-};
-
-struct pstat_node
-{
- short status; /* Current Status of printer */
- RSTATUS *request;
- PRINTER *printer;
- ALERT *alert;
- EXEC *exec;
- PFSTATUS *forms;
- char *pwheel_name;
- PWSTATUS *pwheel;
- char *dis_reason;
- char *rej_reason;
- char **users_allowed;
- char **users_denied;
- char **forms_allowed;
- char **forms_denied;
- char *cpi;
- char *lpi;
- char *plen;
- char *pwid;
- time_t dis_date;
- time_t rej_date;
- short last_dial_rc; /* last exit from dial() */
- short nretry; /* number of dial attempts */
- short nrequests; /* TEMP ONLY! (used variously) */
- char *fault_reason;
- EXEC *fault_exec;
- short numForms;
- char **paper_allowed;
-};
-
-struct pwstat_node
-{
- PWHEEL *pwheel;
- ALERT *alert;
- short requests;
- short requests_last; /* # when alert last sent */
- short trigger;
- short mounted;
-};
-
-#define send mputm
-
-struct rstat_node
-{
- long status;
- MESG *md;
-
- char *req_file;
- char *slow;
- char *fast;
- short copies; /* # copies interface is to make */
- short reason; /* reason for failing _validate() */
-
- SECURE *secure;
- REQUEST *request;
- PSTATUS *printer;
- FSTATUS *form;
- char *pwheel_name;
- PWSTATUS *pwheel;
- EXEC *exec; /* Pointer to running filter or notify */
-
- char *printer_type;
- char *output_type;
- char *cpi;
- char *lpi;
- char *plen;
- char *pwid;
-
- RSTATUS *next;
- RSTATUS *prev;
- short msgType; /* for getting status */
- short trayNum; /* for mounting trays remotely */
- char *formName; /* for mounting forms remotely */
-};
-
-# define RSS_PWMAND 0x00000008 /* pwheel must be mounted */
-# define RSS_SEND_FAULT_MESSAGE 0x00000040 /* need to send message*/
-# define RSS_SEND_FORM_MESSAGE 0x00000080 /* need to send form message*/
-
-struct form_node
-{
- SCALED plen;
- SCALED pwid;
- SCALED lpi;
- SCALED cpi;
- int np;
- char *chset;
- short mandatory;
- char *rcolor;
- char *comment;
- char *conttype;
- char *name;
- FALERT alert;
- char *paper;
- short isDefault;
-};
diff --git a/usr/src/cmd/lp/cmd/lpsched/notify.c b/usr/src/cmd/lp/cmd/lpsched/notify.c
deleted file mode 100644
index bd5987718b..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/notify.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "lpsched.h"
-
-static char *N_Msg[] = {
- "Subject: Status of lp request %s\n\nYour request %s destined for %s%s\n",
- "has completed successfully on printer %s.\n",
- "was canceled by the lpsched daemon%s\n", /* bugfix 1100252 */
- "encountered an error during filtering.\n",
- "encountered an error while printing on printer %s.\n",
- "Filtering stopped with an exit code of %d.\n",
- "Printing stopped with an exit code of %d.\n",
- "Filtering was interrupted with a signal %d.\n",
- "Printing was interrupted with a signal %d.\n",
- "\nReason for failure:\n\n%s\n",
- "\nReason for being canceled:\n\n%s\n",
-};
-
-static struct reason {
- short reason;
- char *msg;
-} N_Reason[] = {
- {
- MNODEST,
- "The requested print destination has been removed."
- }, {
- MERRDEST,
- "All candidate destinations are rejecting further requests."
- }, {
- MDENYDEST,
- "You are no longer allowed to use any printer suitable for\nthe request."
- }, {
- MDENYDEST,
- "No candidate printer can handle these characteristics:"
- }, {
- MNOMEDIA,
- "The form you requested no longer exists."
- }, {
- MDENYMEDIA,
- "You are no longer allowed to use the form you requested."
- }, {
- MDENYMEDIA,
- "The form you wanted now requires a different character set."
- }, {
- MNOFILTER,
- "There is no longer a filter that will convert your file for printing."
- }, {
- MNOMOUNT,
- "The form or print wheel you requested is not allowed on any\nprinter otherwise suitable for the request."
- }, {
- MNOSPACE,
- "Memory allocation problem."
- }, {
- -1,
- ""
- }
-};
-
-
-static void print_reason(int, int);
-
-
-/**
- ** notify() - NOTIFY USER OF FINISHED REQUEST
- **/
-
-void
-notify(register RSTATUS *prs, char *errbuf, int k, int e, int slow)
-{
- register char *cp;
- char *file;
- int fd;
-
-
- /*
- * Screen out cases where no notification is needed.
- */
- if (!(prs->request->outcome & RS_NOTIFY))
- return;
- if (
- !(prs->request->actions & (ACT_MAIL|ACT_WRITE|ACT_NOTIFY))
- && !prs->request->alert
- && !(prs->request->outcome & RS_CANCELLED)
- && !e && !k && !errbuf /* exited normally */
- )
- return;
-
- /*
- * Create the notification message to the user.
- */
- file = makereqerr(prs);
- if ((fd = open_locked(file, "w", MODE_NOREAD)) >= 0) {
- fdprintf(fd, N_Msg[0], prs->secure->req_id, prs->secure->req_id,
- prs->request->destination,
- STREQU(prs->request->destination, NAME_ANY)? " printer"
- : "");
-
- if (prs->request) {
- char file[BUFSIZ];
-
- GetRequestFiles(prs->request, file, sizeof(file));
- fdprintf(fd, "\nThe job title was:\t%s\n", file);
- fdprintf(fd, " submitted by:\t%s\n",
- prs->request->user);
- fdprintf(fd, " at:\t%s\n",
- ctime(&prs->secure->date));
- }
-
- if (prs->request->outcome & RS_PRINTED)
- fdprintf(fd, N_Msg[1], prs->printer->printer->name);
-
- if (prs->request->outcome & RS_CANCELLED)
- fdprintf(fd, N_Msg[2],
- (prs->request->outcome & RS_FAILED)? ", and"
- : ".");
-
-
- if (prs->request->outcome & RS_FAILED) {
- if (slow)
- fdprintf(fd, N_Msg[3]);
- else
- fdprintf(fd, N_Msg[4],
- prs->printer->printer->name);
-
- if (e > 0)
- fdprintf(fd, N_Msg[slow? 5 : 6], e);
- else if (k)
- fdprintf(fd, N_Msg[slow? 7 : 8], k);
- }
-
- if (errbuf) {
- for (cp = errbuf; *cp && *cp == '\n'; cp++)
- ;
- fdprintf(fd, N_Msg[9], cp);
- if (prs->request->outcome & RS_CANCELLED)
- fdprintf(fd, "\n");
- }
-
- /* start fix for bugid 1100252 */
- if (prs->request->outcome & RS_CANCELLED) {
- print_reason (fd, prs->reason);
- }
-
- close(fd);
- schedule (EV_NOTIFY, prs);
-
- }
- if (file)
- Free (file);
-
- return;
-}
-
-/**
- ** print_reason() - PRINT REASON FOR AUTOMATIC CANCEL
- **/
-
-static void
-print_reason(int fd, int reason)
-{
- register int i;
-
-
-#define P(BIT,MSG) if (chkprinter_result & BIT) fdprintf(fd, MSG)
-
- for (i = 0; N_Reason[i].reason != -1; i++)
- if (N_Reason[i].reason == reason) {
- if (reason == MDENYDEST && chkprinter_result)
- i++;
- if (reason == MDENYMEDIA && chkprinter_result)
- i++;
- fdprintf(fd, N_Msg[10], N_Reason[i].msg);
- if (reason == MDENYDEST && chkprinter_result) {
- P (PCK_TYPE, "\tprinter type\n");
- P (PCK_CHARSET, "\tcharacter set\n");
- P (PCK_CPI, "\tcharacter pitch\n");
- P (PCK_LPI, "\tline pitch\n");
- P (PCK_WIDTH, "\tpage width\n");
- P (PCK_LENGTH, "\tpage length\n");
- P (PCK_BANNER, "\tno banner\n");
- }
- break;
- }
-
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/pickfilter.c b/usr/src/cmd/lp/cmd/lpsched/pickfilter.c
deleted file mode 100644
index e5aa5b817b..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/pickfilter.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1996 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2.1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "limits.h"
-
-#include "lpsched.h"
-
-#include "validate.h"
-
-/*
- * Transform consecutive "LP_SEP" characters to a single comma and n-1 LP_SEP;
- *
- * BUT we'll leave LP_SEP inside single quotes alone!
- *
- * This is to allow the following case (and the like) to work correctly:
- * prtitle='standard input'
- */
-
-void
-transform_WS_to_SEP(char *cp)
-{ char *p;
- int inside_quote = 0;
- int done_one_already = 0;
-
- for (p = cp; *p != '\0'; p++) {
- if (*p == '\'') {
- inside_quote = (inside_quote + 1) % 2;
- continue;
- }
- if (inside_quote)
- continue;
- if (*p == ' ') {
- if (!done_one_already) {
- *p = ',';
- done_one_already = 1;
- } else {
- /* multiple LP_WS into one LP_SEP */
- }
- } else {
- done_one_already = 0;
- }
- }
-}
-
-/**
- ** pickfilter() - SEE IF WE CAN FIND A FILTER FOR THIS REQUEST
- **/
-
-int
-pickfilter(RSTATUS *prs, CANDIDATE *pc, FSTATUS *pfs)
-{
- register char ** pp;
- register char ** pl;
-
- register PSTATUS * pps = pc->pps;
-
- char * pipes[2] = { 0 , 0 };
- char * cp;
- char * output_type;
-
- char ** modes = 0;
- char ** parms = 0;
- char ** valid_printer_types;
- char ** p_cpi = 0;
- char ** p_lpi = 0;
- char ** p_pwid = 0;
- char ** p_plen = 0;
-
- FILTERTYPE ret = fl_none;
-
- int got_cpi = 0;
- int got_lpi = 0;
- int got_plen = 0;
- int got_pwid = 0;
- int must_have_filter= 0;
-
- unsigned long chk;
-
-
- /* fix for bugid 1097387 */
- output_type = (char *) NULL;
-
- /*
- * The bulk of the code below is building a parameter list "parms"
- * to send to "insfilter()".
- */
-
- if (prs->request->modes) {
- cp = Strdup(prs->request->modes);
- transform_WS_to_SEP(cp);
- modes = getlist(cp, "", LP_SEP);
- Free (cp);
- }
-
- pp = parms = (char **)Malloc(
- 2 * (NPARM_SPEC + lenlist(modes) + 1) * sizeof(char *)
- );
-
- /*
- * Add to the parameter list the appropriate cpi/lpi/etc.
- * characteristics (aka ``stuff'') that will be used for
- * this job. The printer defaults are questionable.
- * Take this opportunity to also save the ``stuff'' in
- * the request structure.
- */
-
- unload_str (&(prs->cpi));
- unload_str (&(prs->lpi));
- unload_str (&(prs->plen));
- unload_str (&(prs->pwid));
-
- /*
- * If a form is involved, pick up its page size and print
- * spacing requirements.
- */
- if (pfs) {
- if (pfs->cpi) {
- *pp++ = PARM_CPI;
- *pp++ = prs->cpi = pfs->cpi;
- got_cpi = 1;
- }
- if (pfs->lpi) {
- *pp++ = PARM_LPI;
- *pp++ = prs->lpi = pfs->lpi;
- got_lpi = 1;
- }
- if (pfs->plen) {
- *pp++ = PARM_LENGTH;
- *pp++ = prs->plen = pfs->plen;
- got_plen = 1;
- }
- if (pfs->pwid) {
- *pp++ = PARM_WIDTH;
- *pp++ = prs->pwid = pfs->pwid;
- got_pwid = 1;
- }
-
- /*
- * If no form is involved, pick up whatever page size and print
- * spacing requirements were given by the user.
- */
- } else {
- if (o_cpi) {
- *pp++ = PARM_CPI;
- *pp++ = prs->cpi = o_cpi;
- got_cpi = 1;
- }
- if (o_lpi) {
- *pp++ = PARM_LPI;
- *pp++ = prs->lpi = o_lpi;
- got_lpi = 1;
- }
- if (o_length) {
- *pp++ = PARM_LENGTH;
- *pp++ = prs->plen = o_length;
- got_plen = 1;
- }
- if (o_width) {
- *pp++ = PARM_WIDTH;
- *pp++ = prs->pwid = o_width;
- got_pwid = 1;
- }
- }
-
- /*
- * Pick up whatever page size and print spacing requirements
- * haven't been specified yet from the printer defaults.
- *
- * Note: The following cpi/lpi/etc are guaranteed to work
- * for at least one type of the printer at hand, but not
- * necessarily all types. Once we pick a type that works
- * we'll verify that the cpi/lpi/etc stuff works, too.
- * The code that does that assumes that we do the following last,
- * after picking up the form and/or user stuff. If this changes,
- * then the later code will have to be changed, too.
- */
- if (!got_cpi && pps->cpi) {
- *pp++ = PARM_CPI;
- *(p_cpi = pp++) = prs->cpi = pps->cpi;
- }
- if (!got_lpi && pps->lpi) {
- *pp++ = PARM_LPI;
- *(p_lpi = pp++) = prs->lpi = pps->lpi;
- }
- if (!got_plen && pps->plen) {
- *pp++ = PARM_LENGTH;
- *(p_plen = pp++) = prs->plen = pps->plen;
- }
- if (!got_pwid && pps->pwid) {
- *pp++ = PARM_WIDTH;
- *(p_pwid = pp++) = prs->pwid = pps->pwid;
- }
-
- /*
- * Pick up the number of pages, character set (the form's
- * or the user's), the form name, the number of copies,
- * and the modes.
- */
-
- if (prs->request->pages) {
- *pp++ = PARM_PAGES;
- *pp++ = prs->request->pages;
- must_have_filter = 1;
- }
-
- if (prs->request->charset) {
- *pp++ = PARM_CHARSET;
- *pp++ = prs->request->charset;
-
- } else if (pfs && pfs->form->chset) {
- *pp++ = PARM_CHARSET;
- *pp++ = pfs->form->chset;
- }
-
- if (prs->request->form) {
- *pp++ = PARM_FORM;
- *pp++ = prs->request->form;
- }
-
- if (prs->request->copies > 1) {
- *pp++ = PARM_COPIES;
- sprintf ((*pp++ = BIGGEST_NUMBER_S), "%d", prs->request->copies);
- }
-
- if (modes) {
- for (pl = modes; *pl; pl++) {
- *pp++ = PARM_MODES;
- *pp++ = *pl;
- }
- must_have_filter = 1;
- }
-
- *pp = 0; /* null terminated list! */
-
-
- /*
- * If the printer type(s) are not ``unknown'', then include
- * them as possible ``output'' type(s) to match
- * with the user's input type (directly, or through a filter).
- */
- if (!STREQU(*(pps->printer->printer_types), NAME_UNKNOWN))
- valid_printer_types = pc->printer_types;
- else {
- valid_printer_types = 0;
- must_have_filter = 0;
- }
-
- pc->fast = 0;
- pc->slow = 0;
- pc->output_type = 0;
- pc->flags = 0;
- ret = fl_none;
-
- /*
- * If we don't really need a filter and the types match,
- * then that's good enough. Some ``broadly defined''
- * filters might match our needs, but if the printer
- * can do what we need, then why pull in a filter?
-
-
-
- * Besides, Section 3.40 in the requirements imply
- * that we don't use a filter if the printer can handle
- * the file.
- */
- if (!must_have_filter ) {
-
- if (
- valid_printer_types
- && searchlist_with_terminfo(
- prs->request->input_type,
- valid_printer_types
- )
- ) {
- ret = fl_both; /* not really, but ok */
- pc->printer_type = Strdup(prs->request->input_type);
-
- } else if (
- pps->printer->input_types
- && searchlist_with_terminfo(
- prs->request->input_type,
- pps->printer->input_types
- )
- ) {
- ret = fl_both; /* not really, but ok */
-
- /*
- * (1) There is one printer type, might even
- * be ``unknown'';
- * (2) There are several printer types, but that
- * means only one input type, ``simple'',
- * which any of the printer types can handle.
- */
- pc->printer_type = Strdup(*(pc->printer_types));
-
- }
- }
-
- /*
- * Don't try using a filter if the user doesn't want
- * a filter to be used! He or she would rather see an
- * error message than (heaven forbid!) a filter being
- * used.
- */
- if (ret == fl_none && !(prs->request->actions & ACT_RAW)) {
-
- /*
- * For each printer type, and each input type the printer
- * accepts, see if we have a filter that matches the
- * request to the printer. Each time we try, save the
- * output type we use in case of success; we just might
- * need that value later....
- */
-
- for (
- pl = valid_printer_types;
- pl && *pl && ret == fl_none;
- pl++
- )
- ret = insfilter(
- pipes,
- prs->request->input_type,
- (output_type = *pl),
- *pl,
- pps->printer->name,
- parms,
- &(pc->flags)
- );
- if (ret != fl_none)
- pc->printer_type = Strdup(*pl);
-
- for (
- pl = pps->printer->input_types;
- pl && *pl && ret == fl_none;
- pl++
- )
- /*
- * Don't waste time with check we've already made.
- */
- if ((must_have_filter == 1) ||
- !valid_printer_types
- || !searchlist(*pl, valid_printer_types)
- )
- /*
- * Either we have one (or less) printer
- * types and many input types, or we have
- * one input type, ``simple''; regardless,
- * using the first printer type is OK.
- */
- ret = insfilter(
- pipes,
- prs->request->input_type,
- (output_type = *pl),
- *(pc->printer_types),
- pps->printer->name,
- parms,
- &(pc->flags)
- );
- if (ret != fl_none)
- pc->printer_type = Strdup(*(pc->printer_types));
-
- }
-
- /*
- * If we were successful, check that the printer type
- * we picked can handle the PRINTER'S cpi/lpi/etc. defaults.
- * (We know that ALL the printer's types can handle the stuff
- * the user gave or the stuff in the form.)
- * Each printer's default that doesn't pass muster gets dropped.
- * This may mean re-instantiating the filter(s) (if any).
- */
- if (ret != fl_none && (p_cpi || p_lpi || p_pwid || p_plen)) {
-
-#define NZ(X) ((X)? *(X) : (char *)0)
- chk = chkprinter(
- pc->printer_type,
- NZ(p_cpi),
- NZ(p_lpi),
- NZ(p_plen),
- NZ(p_pwid),
- (char *)0
- );
-
- if (chk) {
- register char ** _pp;
-
- char * hole = "";
-
-
- /*
- * Remove the offending printer defaults from the
- * request list of cpi/lpi/etc. stuff, and punch
- * (non-null!) holes in the parameter list.
- */
-#define DROP(P,R) if (P) {P[-1] = P[0] = hole; R = 0;} else/*EMPTY*/
- if (chk & PCK_CPI) DROP (p_cpi, prs->cpi);
- if (chk & PCK_LPI) DROP (p_lpi, prs->lpi);
- if (chk & PCK_WIDTH) DROP (p_pwid, prs->pwid);
- if (chk & PCK_LENGTH) DROP (p_plen, prs->plen);
-
- /*
- * If there are filters, we have to re-instantiate
- * them. (Can't check "ret" here, because it may
- * be misleading.)
- */
- if (pipes[0] || pipes[1]) {
-
- /*
- * First, close up the gaps we punched in
- * the parameter list.
- */
- for (pp = _pp = parms; *pp; pp++)
- if (*pp != hole)
- *_pp++ = *pp;
- *_pp = 0;
-
- /*
- * Re-instantiate the filter(s). This
- * CAN'T fail, because it is not mandatory
- * that filters handle cpi/lpi/etc. stuff.
- */
- ret = insfilter(
- pipes,
- prs->request->input_type,
- output_type,
- pc->printer_type,
- pps->printer->name,
- parms,
- &(pc->flags)
- );
- }
- }
- }
-
- /*
- * Save the filters, if any. Note: although "ret" can be
- * misleading, i.e. set to "fl_both" when there really aren't
- * any filters, the declaration of "pipes" ensured they'd be
- * zero if not set.
- */
- if (ret == fl_both || ret == fl_slow)
- pc->slow = pipes[0];
- if (ret == fl_both || ret == fl_fast)
- pc->fast = pipes[1];
-
- if (ret != fl_none)
- pc->output_type = Strdup (output_type);
-
- /*
- * Wait until now to allocate storage for the cpi/etc.
- * stuff, to make life easier above.
- */
- if (prs->cpi) prs->cpi = Strdup(prs->cpi);
- if (prs->lpi) prs->lpi = Strdup(prs->lpi);
- if (prs->plen) prs->plen = Strdup(prs->plen);
- if (prs->pwid) prs->pwid = Strdup(prs->pwid);
-
-
- if (parms)
- Free ((char *)parms);
- if (modes)
- freelist (modes);
-
- return ((ret != fl_none));
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/ports.c b/usr/src/cmd/lp/cmd/lpsched/ports.c
deleted file mode 100644
index cf1e8a226f..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/ports.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#include "termio.h"
-#include "dial.h"
-#include "unistd.h"
-
-#include "lpsched.h"
-
-#include <sys/ioccom.h>
-#include <sys/ecppsys.h>
-
-static void sigalrm(int);
-static int push_module(int, char *, char *);
-
-static int SigAlrm;
-
-/*
- * open_dialup() - OPEN A PORT TO A ``DIAL-UP'' PRINTER
- */
-
-int
-open_dialup(char *ptype, PRINTER *pp)
-{
- static char *baud_table[] = {
- 0,
- "50",
- "75",
- "110",
- "134",
- "150",
- "200",
- "300",
- "600",
- "1200",
- "1800",
- "2400",
- "4800",
- "9600",
- "19200",
- "38400",
- "57600",
- "76800",
- "115200",
- "153600",
- "230400",
- "307200",
- "460800",
- "921600"
- };
-
- struct termio tio;
- struct termios tios;
-
- CALL call;
-
- int speed, fd;
-
- char *sspeed;
-
-
- if (pp->speed == NULL || (speed = atoi(pp->speed)) <= 0)
- speed = -1;
-
- call.attr = 0;
- call.speed = speed;
- call.line = 0;
- call.telno = pp->dial_info;
-
- if ((fd = dial(call)) < 0)
- return (EXEC_EXIT_NDIAL | (~EXEC_EXIT_NMASK & abs(fd)));
-
- /*
- * "dial()" doesn't guarantee which file descriptor
- * it uses when it opens the port, so we probably have to
- * move it.
- */
- if (fd != 1) {
- dup2(fd, 1);
- Close(fd);
- }
-
- /*
- * The "printermgmt()" routines move out of ".stty"
- * anything that looks like a baud rate, and puts it
- * in ".speed", if the printer port is dialed. Thus
- * we are saved the task of cleaning out spurious
- * baud rates from ".stty".
- *
- * However, we must determine the baud rate and
- * concatenate it onto ".stty" so that that we can
- * override the default in the interface progam.
- * Putting the override in ".stty" allows the user
- * to override us (although it would be probably be
- * silly for him or her to do so.)
- */
- if (ioctl(1, TCGETS, &tios) < 0) {
- ioctl(1, TCGETA, &tio);
- tios.c_cflag = tio.c_cflag;
- }
- if ((sspeed = baud_table[cfgetospeed(&tios)]) != NULL) {
-
- if (pp->stty == NULL)
- pp->stty = "";
-
- {
- char *new_stty = Malloc(
- strlen(pp->stty) + 1 + strlen(sspeed) + 1);
-
- sprintf(new_stty, "%s %s", pp->stty, sspeed);
-
- /*
- * We can trash "pp->stty" because
- * the parent process has the good copy.
- */
- pp->stty = new_stty;
- }
- }
-
- return (0);
-}
-
-/*
- * open_direct() - OPEN A PORT TO A DIRECTLY CONNECTED PRINTER
- */
-
-int
-open_direct(char *ptype, PRINTER *pp)
-{
- short bufsz = -1, cps = -1;
- int open_mode, fd;
- register unsigned int oldalarm, newalarm = 0;
- char *device;
-
- struct ecpp_transfer_parms ecpp_params; /* for ECPP port checking */
- char **modules = NULL;
-
- struct flock lck;
- struct stat buf;
-
- register void (*oldsig)() = signal(SIGALRM, sigalrm);
-
-
- /*
- * Set an alarm to wake us from trying to open the port.
- * We'll try at least 60 seconds, or more if the printer
- * has a huge buffer that, in the worst case, would take
- * a long time to drain.
- */
- tidbit(ptype, "bufsz", &bufsz);
- tidbit(ptype, "cps", &cps);
- if (bufsz > 0 && cps > 0)
- newalarm = (((long)bufsz * 1100) / cps) / 1000;
- if (newalarm < 60)
- newalarm = 60;
- oldalarm = alarm(newalarm);
-
- device = pp->device;
- if (is_printer_uri(device) == 0) {
- /*
- * if it's a device uri and the endpoint contains a valid
- * path, that path should be opened/locked by lpsched for
- * the backend. If not, the uri isn't associated with a
- * local device, so use /dev/null.
- */
- device = strstr(device, "://");
- if (device != NULL)
- device = strchr(device + 3, '/');
-
- if ((device == NULL) || (access(device, F_OK) < 0))
- device = "/dev/null";
- }
-
- /*
- * The following open must be interruptable.
- * O_APPEND is set in case the ``port'' is a file.
- * O_RDWR is set in case the interface program wants
- * to get input from the printer. Don't fail, though,
- * just because we can't get read access.
- */
-
- open_mode = O_WRONLY;
- if (access(device, R_OK) == 0)
- open_mode = O_RDWR;
- open_mode |= O_APPEND;
-
- SigAlrm = 0;
-
- while ((fd = open(device, open_mode, 0)) == -1) {
- if (errno != EINTR)
- return (EXEC_EXIT_NPORT);
- else if (SigAlrm)
- return (EXEC_EXIT_TMOUT);
- }
-
- alarm(oldalarm);
- signal(SIGALRM, oldsig);
-
- /*
- * Lock the file in case two "printers" are defined on the
- * same port. Don't lock /dev/null.
- */
-
- lck.l_type = F_WRLCK;
- lck.l_whence = 0;
- lck.l_start = 0L;
- lck.l_len = 0L;
-
- if (strcmp(device, "/dev/null") && Fcntl(fd, F_SETLKW, &lck) < 0) {
- execlog("lock error: %s\n", pp->device);
- return (EXEC_EXIT_NPORT);
- }
-
- /*
- * We should get the correct channel number (1), but just
- * in case....
- */
- if (fd != 1) {
- dup2(fd, 1);
- Close(fd);
- }
-
- /*
- * Handle streams modules:
- */
- if (fstat(1, &buf))
- buf.st_mode = 0;
-
- /*
- * for some unknown reason, lpsched appears to pop the streams
- * modules off the device and push back some "default" ones,
- * unless a specific set were specified with the printer configuration.
- * This behaviour causes problems with the ECPP port, so if we have
- * an ECPP port, and nobody specified a set of modules to use, we
- * should leave it alone. Normally, we would not bother to play with
- * the streams modules, but it is possible that someone has come
- * to rely on this behaviour for other devices.
- */
- if ((pp->modules != NULL) && (pp->modules[0] != NULL) &&
- (strcmp(pp->modules[0], "default") != 0))
- modules = pp->modules;
-
- if ((modules == NULL) && (ioctl(1, ECPPIOC_GETPARMS, &ecpp_params) < 0))
- modules = getlist(DEFMODULES, LP_WS, LP_SEP);
-
- /* if "nopush" is supplied, leave the modules alone */
- if ((modules != NULL) && (modules[0] != NULL) &&
- (strcasecmp(modules[0], "nopush") == 0))
- modules = NULL;
-
- /*
- * If we have a stream and a list of modules to use, then pop the old
- * modules and push the new ones.
- */
- if ((modules != NULL) && !S_ISFIFO(buf.st_mode) && isastream(1)) {
- /*
- * First, pop all current modules off, unless
- * instructed not to.
- */
- while (ioctl(1, I_POP, 0) == 0)
- ;
-
- /*
- * Now push either the administrator specified modules
- * or the standard modules, unless instructed to push
- * nothing.
- */
-
- if ((modules[1] == NULL) &&
- (strcasecmp(modules[0], "none") == 0))
- return (0);
-
- while (*modules)
- if (push_module(1, device, *modules++) == -1)
- return (EXEC_EXIT_NPUSH);
- }
-
- return (0);
-}
-
-/*
- * sigalrm()
- */
-static void
-sigalrm(int ignore)
-{
- signal(SIGALRM, SIG_IGN);
- SigAlrm = 1;
-}
-
-
-/*
- * push_module()
- */
-
-static int
-push_module(int fd, char *device, char *module)
-{
- int ret = ioctl(fd, I_PUSH, module);
-
- if (ret == -1)
- note("push (%s) on %s failed (%s)\n", module, device, PERROR);
- return (ret);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/print-svc b/usr/src/cmd/lp/cmd/lpsched/print-svc
deleted file mode 100644
index 97c48a9c68..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/print-svc
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/sbin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#
-
-. /lib/svc/share/smf_include.sh
-. /lib/svc/share/ipf_include.sh
-
-# SERVICE = parent service name
-SERVICE=`echo $SMF_FMRI | /usr/bin/cut -f1,2 -d":"`
-
-case "$1" in
-'start')
-
-isopts=`/usr/sbin/svccfg <<-EOF
- select $SMF_FMRI
- listpg cmd_opts
-
- EOF`
-
-if [ "$isopts" ] ; then
-
-#called by /usr/lib/lpsched; use cmd_opts properties only
-
- num_notifiers=`/bin/svcprop -p cmd_opts/num_notifiers $SMF_FMRI`
-
- if [ "$num_notifiers" != "" ] ; then
- OPTS="$OPTS -n $num_notifiers"
- fi
-
- num_filters=`/bin/svcprop -p cmd_opts/num_filters $SMF_FMRI`
-
- if [ "$num_filters" != "" ] ; then
- OPTS="$OPTS -f $num_filters"
- fi
-
- fd_limit=`/bin/svcprop -p cmd_opts/fd_limit $SMF_FMRI`
-
- if [ "$fd_limit" != "" ] ; then
- OPTS="$OPTS -p $fd_limit"
- fi
-
- reserved_fds=`/bin/svcprop -p cmd_opts/reserved_fds $SMF_FMRI`
-
- if [ "$reserved_fds" != "" ] ; then
- OPTS="$OPTS -r $reserved_fds"
- fi
-
-# clear out cmd_opts property group
-
- svccfg <<-EOF
- select $SMF_FMRI
- delpg cmd_opts
-
- EOF
-
-else
-
-# We are here through enable; use lpsched properties
-# Check for saved properties
-
- num_notifiers=`/bin/svcprop -p lpsched/num_notifiers $SERVICE`
- if [ "$num_notifiers" != "" ] && [ "$num_notifiers" != "0" ] ; then
- OPTS="$OPTS -n $num_notifiers"
- fi
-
- num_filters=`/bin/svcprop -p lpsched/num_filters $SERVICE`
- if [ "$num_filters" != "" ] && [ "$num_filters" != "0" ] ; then
- OPTS="$OPTS -f $num_filters"
- fi
-
- fd_limit=`/bin/svcprop -p lpsched/fd_limit $SERVICE`
- if [ "$fd_limit" != "" ] && [ "$fd_limit" != "0" ]; then
- OPTS="$OPTS -p $fd_limit"
- fi
-
- reserved_fds=`/bin/svcprop -p lpsched/reserved_fds $SERVICE`
- if [ "$reserved_fds" != "" ] && [ "$reserved_fds" != "0" ] ; then
- OPTS="$OPTS -r $reserved_fds"
- fi
-fi
-
-# set temporary or permanent properties from OPTS
-
- [ -f /usr/lib/lp/local/lpsched ] || exit $SMF_EXIT_ERR_CONFIG
-
- /usr/lib/lp/local/lpsched ${OPTS}
-
- ;;
-
-'stop')
- [ -f /usr/lib/lp/local/lpshut ] || exit $SMF_EXIT_ERR_CONFIG
-
- /usr/lib/lp/local/lpshut
- ;;
-
-'ipfilter')
- FMRI=$2
- IPP_FMRI="svc:/application/print/ipp-listener:default"
- RFC1179_FMRI="svc:/application/print/rfc1179:default"
- IPP_CONF=/etc/apache/httpd-standalone-ipp.conf
- ip="any"
-
- policy=`get_policy $FMRI`
-
- file=`fmri_to_file $RFC1179_FMRI $IPF_SUFFIX`
- echo "# $RFC1179_FMRI" >$file
- service_is_enabled ${RFC1179_FMRI}
- if [ $? -eq 0 ]; then
- rfc_name=`svcprop -p inetd/name ${RFC1179_FMRI} 2>/dev/null`
- rfc_proto=`svcprop -p inetd/proto ${RFC1179_FMRI} 2>/dev/null | \
- sed 's/6/ /'`
- rfc_port=`$SERVINFO -p -t -s $rfc_name`
- generate_rules $FMRI $policy $rfc_proto $ip $rfc_port $file
- fi
-
- file=`fmri_to_file $IPP_FMRI $IPF_SUFFIX`
- echo "# $IPP_FMRI" >$file
- service_is_enabled ${IPP_FMRI}
- if [ $? -eq 0 ]; then
- #
- # If Listen directives are used, it's possibie to listen on
- # more than one ports. Process the Port directives only when Listen
- # directives don't exist.
- #
- ipp_ports=`grep '^[ \t]*[^# ]*Listen' ${IPP_CONF} | awk '{print $2}'`
-
- if [ -z "$ipp_ports" ]; then
- ipp_ports=`grep '^[ \t]*[^# ]*Port' ${IPP_CONF} | \
- awk '{print $2}' | tail -1`
- fi
-
- for port in $ipp_ports; do
- generate_rules $FMRI $policy "tcp" $ip $port $file
- done
- fi
-
- ;;
-
-*)
- echo "Usage: $0 { start | stop }"
- exit 1
- ;;
-esac
-exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/lp/cmd/lpsched/requeue.c b/usr/src/cmd/lp/cmd/lpsched/requeue.c
deleted file mode 100644
index 47798de6b3..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/requeue.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "lpsched.h"
-#include "validate.h"
-
-/*
- * The routines in this file are used to examine queued requests
- * to see if something must be done about them. We don't bother
- * checking requests that are:
- *
- * - printing (we could, to allow the administrator to stop
- * a request by making a configuration change, but that
- * can lead to trouble (yet another way to terminate a child)
- * and the administrator can always disable the request to
- * force it to stop printing and be reevaluated);
- *
- * - changing, since once the change is complete the request
- * will be reevaluated again anyway;
- *
- * - notifying, since the request is essentially finished
- *
- * - being sent or already sent to a remote machine;
- *
- * - done.
- *
- * Requests that are being held or are filtering ARE to be considered,
- * because things may have changed to make them impossible to print.
- */
-#define RS_SKIP ((RS_ACTIVE & ~RS_FILTERING) | RS_DONE)
-#define SKIP_IT(PRS) ((PRS)->request->outcome & RS_SKIP)
-
-/**
- ** queue_attract() - REASSIGN REQUEST(S) TO PRINTER, IF POSSIBLE
- **/
-
-void
-queue_attract(PSTATUS *pps, int (*qchk_p)(RSTATUS *), int attract_just_one)
-{
- register RSTATUS *prs;
- register CSTATUS *pcs;
- int called_schedule = 0;
-
-
- /*
- * Evaluate requests that:
- * - meet a criteria set by a function passed.
- * - are already queued for the printer
- * - are destined for a class containing this printer
- * - or are destined for any printer
- * We stop on the first one that will work on the printer,
- * and schedule an interface for the printer (which will
- * find the first request ready, namely the one we stopped on).
- */
-
-#define SAMECLASS(PRS,PPS) \
- ( \
- ((pcs = search_cstatus(PRS->request->destination)) != NULL) \
- && searchlist(PPS->printer->name, pcs->class->members) \
- )
-
-#define ISANY(PRS) STREQU(PRS->request->destination, NAME_ANY)
-
- for (prs = Request_List; prs; prs = prs->next) {
- if (
- !SKIP_IT(prs)
- && (!qchk_p || (*qchk_p)(prs))
- && (
- prs->printer == pps
- || ISANY(prs)
- || SAMECLASS(prs, pps)
- )
- )
- /*
- * Don't need to evaluate the request if it
- * is already queued!
- */
- if (
- prs->printer == pps
- || evaluate_request(prs, pps, 0) == MOK
- ) {
- /*
- * This request was attracted to the
- * printer but maybe it now needs to be
- * filtered. If so, filter it but see if
- * there's another request all set to go.
- */
- if (NEEDS_FILTERING(prs))
- schedule (EV_SLOWF, prs);
- else {
- if (!called_schedule) {
- schedule (EV_INTERF, pps);
- called_schedule = 1;
- }
- if (attract_just_one)
- break;
- }
- }
- }
-
- return;
-}
-
-/**
- ** queue_repel() - REASSIGN REQUESTS TO ANOTHER PRINTER, IF POSSIBLE
- **/
-
-int
-queue_repel(PSTATUS *pps, int move_off, int (*qchk_p)(RSTATUS *))
-{
- register RSTATUS *prs;
- register int all_can = 1;
- register PSTATUS *stop_pps = (move_off? pps : 0);
-
- /*
- * Reevaluate all requests that are assigned to this
- * printer, to see if there's another printer that
- * can handle them.
- *
- * If the "move_off" flag is set, don't consider the current
- * printer when reevaluating, but also don't cancel the request
- * if it can't be moved off the printer.
- * (Currently this is only used when deciding if a printer
- * can be deleted.)
- */
- for (prs = Request_List; prs != NULL; prs = prs->next) {
- if (prs->printer != pps)
- continue;
-
- /*
- * "all_can" keeps track of whether all of the requests
- * of interest to the caller (governed by "qchk_p") can
- * be moved to another printer. Now we don't move certain
- * requests (active, done, gone remote), and some of those
- * matter in the ``all can'' consideration.
- */
- if (qchk_p && !(*qchk_p)(prs))
- continue;
- else if (SKIP_IT(prs)) {
- if ( !(prs->request->outcome & RS_DONE) )
- all_can = 0;
- continue;
-
- } else
-
- if (reevaluate_request(prs, stop_pps) == MOK) {
-
- /*
- * If this request needs to be filtered,
- * try to schedule it for filtering,
- * otherwise schedule it for printing.
- * We are inefficient here, because we may
- * try to schedule many requests but the
- * filtering slot(s) and printers are
- * busy; but the requests may languish
- * if we don't check here.
- */
- if (NEEDS_FILTERING(prs))
- schedule (EV_SLOWF, prs);
- else
- schedule (EV_INTERF, prs->printer);
-
- } else {
- all_can = 0;
- if (!move_off)
- cancel (prs, 1);
- else
- prs->reason = MOK;
- }
- }
-
- return (all_can);
-}
-
-/**
- ** queue_check() - CHECK ALL REQUESTS AGAIN
- **/
-
-void
-queue_check(int (*qchk_p)( RSTATUS * ))
-{
- register RSTATUS *prs;
-
-
- for (prs = Request_List; prs; prs = prs->next)
- if (!SKIP_IT(prs) && (!qchk_p || (*qchk_p)(prs)))
- if (reevaluate_request(prs, (PSTATUS *)0) == MOK)
- if (NEEDS_FILTERING(prs))
- schedule (EV_SLOWF, prs);
- else
- schedule (EV_INTERF, prs->printer);
- else
- cancel (prs, 1);
-
- return;
-}
-
-/**
- ** qchk_waiting() - CHECK IF REQUEST IS READY TO PRINT
- ** qchk_filter() - CHECK IF REQUEST NEEDS A FILTER
- ** qchk_form() - CHECK IF REQUEST NEEDS A FORM
- ** qchk_pwheel() - CHECK IF REQUEST NEEDS PRINT A WHEEL
- **/
-
-int
-qchk_waiting(RSTATUS *prs)
-{
- return (
- !(prs->request->outcome & (RS_HELD|RS_DONE|RS_ACTIVE))
- && !NEEDS_FILTERING(prs)
- );
-}
-
-int
-qchk_filter(RSTATUS *prs)
-{
- /*
- * No need to reevaluate this request if it isn't using a filter
- * or if it is done or is being changed.
- */
- return (
- !(prs->request->outcome & (RS_DONE|RS_CHANGING|RS_NOTIFY))
- && (prs->slow || prs->fast)
- );
-}
-
-FSTATUS * form_in_question;
-
-int
-qchk_form(RSTATUS *prs)
-{
- return (prs->form == form_in_question);
-}
-
-char * pwheel_in_question;
-
-int
-qchk_pwheel(RSTATUS *prs)
-{
- return (SAME(prs->pwheel_name, pwheel_in_question));
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/rstatus.c b/usr/src/cmd/lp/cmd/lpsched/rstatus.c
deleted file mode 100644
index 791ba432a0..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/rstatus.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "lpsched.h"
-
-
-/**
- ** insertr()
- **/
-
-void
-insertr(RSTATUS *r)
-{
- RSTATUS *prs;
-
-
- if (!Request_List) {
- Request_List = r;
- return;
- }
-
- for (prs = Request_List; prs; prs = prs->next) {
- if (rsort(&r, &prs) < 0) {
- r->prev = prs->prev;
- if (r->prev)
- r->prev->next = r;
- r->next = prs;
- prs->prev = r;
- if (prs == Request_List)
- Request_List = r;
- return;
- }
-
- if (prs->next)
- continue;
-
- r->prev = prs;
- prs->next = r;
- return;
- }
-}
-
-/**
- ** remover()
- **/
-
-void
-remover(RSTATUS *r)
-{
- if (r == Request_List) /* on the request chain */
- Request_List = r->next;
-
- if (r->next)
- r->next->prev = r->prev;
-
- if (r->prev)
- r->prev->next = r->next;
-
- r->next = 0;
- r->prev = 0;
- return;
-}
-
-/**
- ** request_by_id()
- **/
-
-RSTATUS *
-request_by_id(char *id)
-{
- register RSTATUS *prs;
-
- for (prs = Request_List; prs; prs = prs->next)
- if (STREQU(id, prs->secure->req_id))
- return (prs);
- return (0);
-}
-
-RSTATUS *
-request_by_id_num( long num )
-{
- register RSTATUS *prs;
-
- for (prs = Request_List; prs; prs = prs->next) {
- char *tmp = strrchr(prs->secure->req_id, '-');
-
- if (tmp && (num == atol(++tmp)))
- return (prs);
- }
- return(0);
-}
-
-
-/**
- ** rsort()
- **/
-
-static int later ( RSTATUS * , RSTATUS * );
-
-int
-rsort (RSTATUS **p1, RSTATUS **p2)
-{
- /*
- * Of two requests needing immediate handling, the first
- * will be the request with the LATER date. In case of a tie,
- * the first is the one with the larger request ID (i.e. the
- * one that came in last).
- */
- if ((*p1)->request->outcome & RS_IMMEDIATE)
- if ((*p2)->request->outcome & RS_IMMEDIATE)
- if (later(*p1, *p2))
- return (-1);
- else
- return (1);
- else
- return (-1);
-
- else if ((*p2)->request->outcome & RS_IMMEDIATE)
- return (1);
-
- /*
- * Of two requests not needing immediate handling, the first
- * will be the request with the highest priority. If both have
- * the same priority, the first is the one with the EARLIER date.
- * In case of a tie, the first is the one with the smaller ID
- * (i.e. the one that came in first).
- */
- else if ((*p1)->request->priority == (*p2)->request->priority)
- if (!later(*p1, *p2))
- return (-1);
- else
- return (1);
-
- else
- return ((*p1)->request->priority - (*p2)->request->priority);
- /*NOTREACHED*/
-}
-
-static int
-later(RSTATUS *prs1, RSTATUS *prs2)
-{
- if (prs1->secure->date > prs2->secure->date)
- return (1);
-
- else if (prs1->secure->date < prs2->secure->date)
- return (0);
-
- /*
- * The dates are the same, so compare the request IDs.
- * One problem with comparing request IDs is that the order
- * of two IDs may be reversed if the IDs wrapped around. This
- * is a very unlikely problem, because the cycle should take
- * more than one second to wrap!
- */
- else {
- register int len1 = strlen(prs1->req_file),
- len2 = strlen(prs2->req_file);
-
- /*
- * Use the request file name (ID-0) for comparison,
- * because the real request ID (DEST-ID) won't compare
- * properly because of the destination prefix.
- * The strlen() comparison is necessary, otherwise
- * IDs like "99-0" and "100-0" will compare wrong.
- */
- if (len1 > len2)
- return (1);
- else if (len1 < len2)
- return (0);
- else
- return (strcmp(prs1->req_file, prs2->req_file) > 0);
- }
- /*NOTREACHED*/
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/schedule.c b/usr/src/cmd/lp/cmd/lpsched/schedule.c
deleted file mode 100644
index 01fbe4213a..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/schedule.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdarg.h"
-#include "lpsched.h"
-#include <syslog.h>
-
-extern int isStartingForms;
-
-typedef struct later {
- struct later * next;
- int event,
- ticks;
- union arg {
- PSTATUS * printer;
- RSTATUS * request;
- FSTATUS * form;
- } arg;
-} LATER;
-
-static LATER LaterHead = { 0 },
- TempHead;
-
-static void ev_interf(PSTATUS *);
-static void ev_message(PSTATUS *);
-static void ev_form_message(FSTATUS *);
-static int ev_slowf(RSTATUS *);
-static int ev_notify(RSTATUS *);
-
-static EXEC *find_exec_slot(EXEC **);
-
-static char *_event_name(int event)
-{
- static char *_names[] = {
- "", "EV_SLOWF", "EV_INTERF", "EV_NOTIFY", "EV_LATER", "EV_ALARM",
- "EV_MESSAGE", "EV_ENABLE", "EV_FORM_MESSAGE", NULL };
-
- if ((event < 0) || (event > EV_FORM_MESSAGE))
- return ("BAD_EVENT");
- else
- return (_names[event]);
-}
-
-/*
- * schedule() - SCHEDULE BY EVENT
- */
-
-/*VARARGS1*/
-void
-schedule(int event, ...)
-{
- va_list ap;
-
- LATER * plprev;
- LATER * pl;
- LATER * plnext = 0;
-
- register PSTATUS * pps;
- register RSTATUS * prs;
- register FSTATUS * pfs;
-
- int i;
- /*
- * If we're in the process of shutting down, don't
- * schedule anything.
- */
- syslog(LOG_DEBUG, "schedule(%s)", _event_name(event));
-
- if (Shutdown)
- return;
-
- va_start (ap, event);
-
- /*
- * If we're still in the process of starting up, don't start
- * anything! Schedule it for one tick later. While we're starting
- * ticks aren't counted, so the events won't be started.
- * HOWEVER, with a count of 1, a single EV_ALARM after we're
- * finished starting will be enough to clear all things scheduled
- * for later.
- */
- if (Starting) {
- switch (event) {
-
- case EV_INTERF:
- case EV_ENABLE:
- pps = va_arg(ap, PSTATUS *);
- schedule (EV_LATER, 1, event, pps);
- goto Return;
-
- case EV_SLOWF:
- case EV_NOTIFY:
- prs = va_arg(ap, RSTATUS *);
- schedule (EV_LATER, 1, event, prs);
- goto Return;
-
- case EV_MESSAGE:
- pps = va_arg(ap, PSTATUS *);
- schedule (EV_LATER, 1, event, pps);
- goto Return;
-
- case EV_FORM_MESSAGE:
- pfs = va_arg(ap, FSTATUS *);
- schedule (EV_LATER, 1, event, pfs);
- goto Return;
-
- case EV_LATER:
- /*
- * This is okay--in fact it may be us!
- */
- break;
-
- case EV_ALARM:
- /*
- * The alarm will go off again, hold off for now.
- */
- goto Return;
-
- }
- }
-
- /*
- * Schedule something:
- */
- switch (event) {
-
- case EV_INTERF:
- if ((pps = va_arg(ap, PSTATUS *)) != NULL)
- ev_interf (pps);
-
- else
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- ev_interf (PStatus[i]);
-
- break;
-
- /*
- * The EV_ENABLE event is used to get a printer going again
- * after waiting for a fault to be cleared. We used to use
- * just the EV_INTERF event, but this wasn't enough: For
- * requests that can go on several different printers (e.g.
- * queued for class, queued for ``any''), a printer is
- * arbitrarily assigned. The EV_INTERF event just checks
- * assignments, not possibilities, so a printer with no
- * assigned requests but still eligible to handle one or
- * more requests would never automatically start up again after
- * a fault. The EV_ENABLE event calls "enable()" which eventually
- * gets around to invoking the EV_INTERF event. However, it first
- * calls "queue_attract()" to get an eligible request assigned
- * so that things proceed. This also makes sense from the
- * following standpoint: The documented method of getting a
- * printer going, while it is waiting for auto-retry, is to
- * manually issue the enable command!
- *
- * Note: "enable()" will destroy the current record of the fault,
- * so if the fault is still with us any new alert will not include
- * the history of each repeated fault. This is a plus and a minus,
- * usually a minus: While a repeated fault may occasionally show
- * a varied record, usually the same reason is given each time;
- * before switching to EV_ENABLE we typically saw a boring, long
- * list of identical reasons.
- */
- case EV_ENABLE:
- if ((pps = va_arg(ap, PSTATUS *)) != NULL)
- enable (pps);
- else
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- enable (PStatus[i]);
- break;
-
- case EV_SLOWF:
- if ((prs = va_arg(ap, RSTATUS *)) != NULL)
- (void) ev_slowf (prs);
- else
- for (prs = Request_List; prs && ev_slowf(prs) != -1;
- prs = prs->next);
- break;
-
- case EV_NOTIFY:
- if ((prs = va_arg(ap, RSTATUS *)) != NULL)
- (void) ev_notify (prs);
- else
- for (prs = Request_List; prs && ev_notify(prs) != -1;
- prs = prs->next);
- break;
-
- case EV_MESSAGE:
- pps = va_arg(ap, PSTATUS *);
- ev_message(pps);
- break;
-
- case EV_FORM_MESSAGE:
- pfs = va_arg(ap, FSTATUS *);
- ev_form_message(pfs);
- break;
-
- case EV_LATER:
- pl = (LATER *)Malloc(sizeof (LATER));
-
- if (!LaterHead.next)
- alarm (CLOCK_TICK);
-
- pl->next = LaterHead.next;
- LaterHead.next = pl;
-
- pl->ticks = va_arg(ap, int);
- pl->event = va_arg(ap, int);
- switch (pl->event) {
-
- case EV_MESSAGE:
- case EV_INTERF:
- case EV_ENABLE:
- pl->arg.printer = va_arg(ap, PSTATUS *);
- if (pl->arg.printer)
- pl->arg.printer->status |= PS_LATER;
- break;
-
- case EV_FORM_MESSAGE:
- pl->arg.form = va_arg(ap, FSTATUS *);
- break;
-
- case EV_SLOWF:
- case EV_NOTIFY:
- pl->arg.request = va_arg(ap, RSTATUS *);
- break;
-
- }
- break;
-
- case EV_ALARM:
- Sig_Alrm = 0;
-
- /*
- * The act of scheduling some of the ``laters'' may
- * cause new ``laters'' to be added to the list.
- * To ease the handling of the linked list, we first
- * run through the list and move all events ready to
- * be scheduled to another list. Then we schedule the
- * events off the new list. This leaves the main ``later''
- * list ready for new events.
- */
- TempHead.next = 0;
- for (pl = (plprev = &LaterHead)->next; pl; pl = plnext) {
- plnext = pl->next;
- if (--pl->ticks)
- plprev = pl;
- else {
- plprev->next = plnext;
-
- pl->next = TempHead.next;
- TempHead.next = pl;
- }
- }
-
- for (pl = TempHead.next; pl; pl = plnext) {
- plnext = pl->next;
- switch (pl->event) {
-
- case EV_MESSAGE:
- case EV_INTERF:
- case EV_ENABLE:
- pl->arg.printer->status &= ~PS_LATER;
- schedule (pl->event, pl->arg.printer);
- break;
-
- case EV_FORM_MESSAGE:
- schedule (pl->event, pl->arg.form);
- break;
-
- case EV_SLOWF:
- case EV_NOTIFY:
- schedule (pl->event, pl->arg.request);
- break;
-
- }
- Free ((char *)pl);
- }
-
- if (LaterHead.next)
- alarm (CLOCK_TICK);
- break;
-
- }
-
-Return: va_end (ap);
-
- return;
-}
-
-/*
- * maybe_schedule() - MAYBE SCHEDULE SOMETHING FOR A REQUEST
- */
-
-void
-maybe_schedule(RSTATUS *prs)
-{
- /*
- * Use this routine if a request has been changed by some
- * means so that it is ready for filtering or printing,
- * but a previous filtering or printing process for this
- * request MAY NOT have finished yet. If a process is still
- * running, then the cleanup of that process will cause
- * "schedule()" to be called. Calling "schedule()" regardless
- * might make another request slip ahead of this request.
- */
-
- /*
- * "schedule()" will refuse if this request is filtering.
- * It will also refuse if the request ``was'' filtering
- * but the filter was terminated in "validate_request()",
- * because we can not have heard from the filter process
- * yet. Also, when called with a particular request,
- * "schedule()" won't slip another request ahead.
- */
- if (NEEDS_FILTERING(prs))
- schedule (EV_SLOWF, prs);
-
- else if (!(prs->request->outcome & RS_STOPPED))
- schedule (EV_INTERF, prs->printer);
-
- return;
-}
-
-static void
-ev_message(PSTATUS *pps)
-{
- register RSTATUS *prs;
- char toSelf;
-
- syslog(LOG_DEBUG, "ev_message(%s)",
- (pps && pps->request && pps->request->req_file ?
- pps->request->req_file : "NULL"));
-
- toSelf = 0;
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if (prs->printer == pps) {
- note("prs (%d) pps (%d)\n", prs, pps);
- if (!toSelf) {
- toSelf = 1;
- exec(EX_FAULT_MESSAGE, pps, prs);
- }
- }
-}
-
-static void
-ev_form_message_body(FSTATUS *pfs, RSTATUS *prs, char *toSelf, char ***sysList)
-{
- syslog(LOG_DEBUG, "ev_form_message_body(%s, %d, 0x%x)",
- (pfs && pfs->form && pfs->form->name ? pfs->form->name : "NULL"),
- (toSelf ? *toSelf : 0),
- sysList);
-
- if (!*toSelf) {
- *toSelf = 1;
- exec(EX_FORM_MESSAGE, pfs);
- }
-}
-
-static void
-ev_form_message(FSTATUS *pfs)
-{
- register RSTATUS *prs;
- char **sysList;
- char toSelf;
-
- syslog(LOG_DEBUG, "ev_form_message(%s)",
- (pfs && pfs->form && pfs->form->name ?
- pfs->form->name : "NULL"));
-
- toSelf = 0;
- sysList = NULL;
-
- for (prs = Request_List; prs != NULL; prs = prs->next)
- if (prs->form == pfs)
- ev_form_message_body(pfs, prs, &toSelf, &sysList);
-
- if (NewRequest && (NewRequest->form == pfs))
- ev_form_message_body(pfs, NewRequest, &toSelf, &sysList);
-
- freelist(sysList);
-}
-
-/*
- * ev_interf() - CHECK AND EXEC INTERFACE PROGRAM
- */
-
-/*
- * Macro to check if the request needs a print wheel or character set (S)
- * and the printer (P) has it mounted or can select it. Since the request
- * has already been approved for the printer, we don't have to check the
- * character set, just the mount. If the printer has selectable character
- * sets, there's nothing to check so the request is ready to print.
- */
-#define MATCH(PRS, PPS) (\
- !(PPS)->printer->daisy || \
- !(PRS)->pwheel_name || \
- !((PRS)->status & RSS_PWMAND) || \
- STREQU((PRS)->pwheel_name, NAME_ANY) || \
- ((PPS)->pwheel_name && \
- STREQU((PPS)->pwheel_name, (PRS)->pwheel_name)))
-
-
-static void
-ev_interf(PSTATUS *pps)
-{
- register RSTATUS *prs;
-
- syslog(LOG_DEBUG, "ev_interf(%s)",
- (pps && pps->request && pps->request->req_file ?
- pps->request->req_file : "NULL"));
-
-
- /*
- * If the printer isn't tied up doing something
- * else, and isn't disabled, see if there is a request
- * waiting to print on it. Note: We don't include
- * PS_FAULTED here, because simply having a printer
- * fault (without also being disabled) isn't sufficient
- * to keep us from trying again. (In fact, we HAVE TO
- * try again, to see if the fault has gone away.)
- *
- * NOTE: If the printer is faulted but the filter controlling
- * the printer is waiting for the fault to clear, a
- * request will still be attached to the printer, as
- * evidenced by "pps->request", so we won't try to
- * schedule another request!
- */
- if (pps->request || pps->status & (PS_DISABLED|PS_LATER|PS_BUSY))
- return;
-
- for (prs = Request_List; prs != NULL; prs = prs->next) {
- if ((prs->printer == pps) && (qchk_waiting(prs)) &&
- isFormUsableOnPrinter(pps, prs->form) && MATCH(prs, pps)) {
- /*
- * Just because the printer isn't busy and the
- * request is assigned to this printer, don't get the
- * idea that the request can't be printing (RS_ACTIVE),
- * because another printer may still have the request
- * attached but we've not yet heard from the child
- * process controlling that printer.
- *
- * We have the waiting request, we have
- * the ready (local) printer. If the exec fails
- * because the fork failed, schedule a
- * try later and claim we succeeded. The
- * later attempt will sort things out,
- * e.g. will re-schedule if the fork fails
- * again.
- */
- pps->request = prs;
- if (exec(EX_INTERF, pps) == 0) {
- pps->status |= PS_BUSY;
- return;
- }
- pps->request = 0;
- if (errno == EAGAIN) {
- load_str (&pps->dis_reason, CUZ_NOFORK);
- schedule (EV_LATER, WHEN_FORK, EV_ENABLE, pps);
- return;
- }
- }
- }
-
- return;
-}
-
-/*
- * ev_slowf() - CHECK AND EXEC SLOW FILTER
- */
-
-static int
-ev_slowf(RSTATUS *prs)
-{
- register EXEC *ep;
-
- syslog(LOG_DEBUG, "ev_slowf(%s)",
- (prs && prs->req_file ? prs->req_file : "NULL"));
-
- /*
- * Return -1 if no more can be executed (no more exec slots)
- * or if it's unwise to execute any more (fork failed).
- */
-
- if (!(ep = find_exec_slot(Exec_Slow))) {
- syslog(LOG_DEBUG, "ev_slowf(%s): no slot",
- (prs && prs->req_file ? prs->req_file : "NULL"));
- return (-1);
- }
-
- if (!(prs->request->outcome & (RS_DONE|RS_HELD|RS_ACTIVE)) &&
- NEEDS_FILTERING(prs)) {
- (prs->exec = ep)->ex.request = prs;
- if (exec(EX_SLOWF, prs) != 0) {
- ep->ex.request = 0;
- prs->exec = 0;
- if (errno == EAGAIN) {
- schedule (EV_LATER, WHEN_FORK, EV_SLOWF, prs);
- return (-1);
- }
- }
- }
- return (0);
-}
-
-/*
- * ev_notify() - CHECK AND EXEC NOTIFICATION
- */
-
-static int
-ev_notify(RSTATUS *prs)
-{
- register EXEC *ep;
-
- syslog(LOG_DEBUG, "ev_notify(%s)",
- (prs && prs->req_file ? prs->req_file : "NULL"));
-
- /*
- * Return -1 if no more can be executed (no more exec slots)
- * or if it's unwise to execute any more (fork failed, already
- * sent one to remote side).
- */
-
- /*
- * If the job came from a remote machine, we forward the
- * outcome of the request to the network manager for sending
- * to the remote side.
- */
- if (prs->request->actions & ACT_NOTIFY) {
- if (prs->request->outcome & RS_NOTIFY) {
- prs->request->actions &= ~ACT_NOTIFY;
- return (0); /* but try another request */
- }
- /*
- * If the job didn't come from a remote system,
- * we'll try to start a process to send the notification
- * to the user. But we only allow so many notifications
- * to run at the same time, so we may not be able to
- * do it.
- */
- } else if (!(ep = find_exec_slot(Exec_Notify)))
- return (-1);
-
- else if (prs->request->outcome & RS_NOTIFY &&
- !(prs->request->outcome & RS_NOTIFYING)) {
-
- (prs->exec = ep)->ex.request = prs;
- if (exec(EX_NOTIFY, prs) != 0) {
- ep->ex.request = 0;
- prs->exec = 0;
- if (errno == EAGAIN) {
- schedule (EV_LATER, WHEN_FORK, EV_NOTIFY, prs);
- return (-1);
- }
- }
- }
- return (0);
-}
-
-
-/*
- * find_exec_slot() - FIND AVAILABLE EXEC SLOT
- */
-
-static EXEC *
-find_exec_slot(EXEC **exec_table)
-{
- int i;
-
- for (i = 0; exec_table[i] != NULL; i++)
- if (exec_table[i]->pid == 0)
- return (exec_table[i]);
-
- syslog(LOG_DEBUG, "find_exec_slot(0x%8.8x): after %d, no slots",
- exec_table, i);
- return (0);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/server.xml b/usr/src/cmd/lp/cmd/lpsched/server.xml
deleted file mode 100644
index 790355f873..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/server.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
-<!--
- Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- Use is subject to license terms.
-
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
- NOTE: This service manifest is not editable; its contents will
- be overwritten by package or patch operations, including
- operating system upgrade. Make customizations in a different
- file.
--->
-
-<service_bundle type='manifest' name='SUNWpsr:lpsched'>
-
-<service
- name='application/print/server'
- type='service'
- version='1'>
-
- <create_default_instance enabled='false' />
- <single_instance />
-
- <dependency
- name='fs-local'
- grouping='require_all'
- restart_on='none'
- type='service'>
- <service_fmri value='svc:/system/filesystem/local' />
- </dependency>
-
- <dependency
- name='filesystem'
- grouping='require_all'
- restart_on='none'
- type='service'>
- <service_fmri value='svc:/system/filesystem/usr'/>
- </dependency>
-
- <dependency
- name='identity'
- grouping='require_all'
- restart_on='refresh'
- type='service'>
- <service_fmri value='svc:/system/identity:domain' />
- </dependency>
-
- <dependency
- name='system-log'
- grouping='optional_all'
- restart_on='none'
- type='service'>
- <service_fmri value='svc:/system/system-log' />
- </dependency>
-
- <dependent
- name='print-server_multi-user'
- grouping='optional_all'
- restart_on='none'>
- <service_fmri value='svc:/milestone/multi-user' />
- </dependent>
-
- <exec_method
- type='method'
- name='start'
- exec='/lib/svc/method/print-svc start'
- timeout_seconds='60' />
-
- <exec_method
- type='method'
- name='stop'
- exec='/lib/svc/method/print-svc stop'
- timeout_seconds='60' />
-
- <property_group name='lpsched' type='framework'>
- <propval name='num_notifiers' type='count' value='0' />
- <propval name='num_filters' type='count' value='0' />
- <propval name='fd_limit' type='count' value='0' />
- <propval name='reserved_fds' type='count' value='0' />
- </property_group>
-
- <property_group name='general' type='framework'>
- <!-- to start/stop spooling daemon -->
- <propval name='action_authorization' type='astring'
- value='solaris.print.admin' />
- <propval name='value_authorization' type='astring'
- value='solaris.print.admin' />
- </property_group>
-
- <property_group name='firewall_context' type='com.sun,fw_definition'>
- <propval name='ipf_method' type='astring'
- value='/lib/svc/method/print-svc ipfilter' />
- </property_group>
-
- <property_group name='firewall_config' type='com.sun,fw_configuration'>
- <propval name='policy' type='astring' value='use_global' />
- <propval name='apply_to' type='astring' value='' />
- <propval name='exceptions' type='astring' value='' />
- <propval name='value_authorization' type='astring'
- value='solaris.smf.value.firewall.config' />
- </property_group>
-
- <stability value='Unstable' />
-
- <template>
- <common_name>
- <loctext xml:lang='C'>
- LP print server
- </loctext>
- </common_name>
- <documentation>
- <manpage title='lpsched' section='1M'
- manpath='/usr/share/man' />
- </documentation>
- </template>
-</service>
-
-</service_bundle>
diff --git a/usr/src/cmd/lp/cmd/lpsched/status.c b/usr/src/cmd/lp/cmd/lpsched/status.c
deleted file mode 100644
index 893ffa3c05..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/status.c
+++ /dev/null
@@ -1,721 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdlib.h"
-#include "string.h"
-#include "unistd.h"
-#include <syslog.h>
-
-#include "lpsched.h"
-
-#define NCMP(X,Y) (STRNEQU((X), (Y), sizeof(Y)-1))
-
-static void load_pstatus ( void );
-static void load_fault_status ( void );
-static void load_cstatus ( void );
-static void put_multi_line ( int , char * );
-static PFSTATUS * parseFormList ( char *,short *);
-static void markFormsMounted( PSTATUS *);
-
-
-#define FAULT_MESSAGE_FILE "faultMessage"
-static char *pstatus = 0,
- *cstatus = 0;
-
-/**
- ** load_status() - LOAD PRINTER/CLASS STATUS FILES
- **/
-
-void
-load_status(void)
-{
- load_pstatus ();
-
- load_cstatus ();
- load_fault_status ();
- return;
-}
-
-/**
- ** load_pstatus() - LOAD PRITNER STATUS FILE
- **/
-
-static void
-load_pstatus(void)
-{
- PSTATUS *pps;
-
- char *rej_reason,
- *dis_reason,
- *pwheel_name,
- buf[BUFSIZ],
- *name,
- *p;
-
- time_t rej_date,
- dis_date;
-
- short status;
-
- PFSTATUS *ppfs;
-
- PWSTATUS *ppws;
-
- int i,
- len,
- total;
-
- time_t now;
-
- int fd;
-
- register int f;
- short numForms;
-
-
- (void) time(&now);
-
- if (!pstatus)
- pstatus = makepath(Lp_System, PSTATUSFILE, (char *)0);
- if ((fd = open_locked(pstatus, "r", 0)) >= 0) {
- char *tmp = pstatus; /* not NULL */
-
- while (tmp != NULL) {
- status = 0;
- total = 0;
- name = 0;
- rej_reason = 0;
- dis_reason = 0;
- ppfs = 0;
-
- errno = 0;
- for (f = 0;
- (f < PST_MAX) && (tmp = fdgets(buf, BUFSIZ, fd));
- f++) {
- if (p = strrchr(buf, '\n'))
- *p = '\0';
-
- switch (f) {
- case PST_BRK:
- break;
-
- case PST_NAME:
- name = Strdup(buf);
- break;
-
- case PST_STATUS:
- if (NCMP(buf, NAME_DISABLED))
- status |= PS_DISABLED;
- p = strchr(buf, ' ');
- if (!p || !*(++p))
- break;
- if (NCMP(p, NAME_REJECTING))
- status |= PS_REJECTED;
- break;
-
- case PST_DATE:
- dis_date = (time_t)atol(buf);
- p = strchr(buf, ' ');
- if (!p || !*(++p))
- break;
- rej_date = (time_t)atol(p);
- break;
-
- case PST_DISREAS:
- len = strlen(buf);
- if (buf[len - 1] == '\\') {
- buf[len - 1] = '\n';
- f--;
- }
- if (dis_reason) {
- total += len;
- dis_reason = Realloc(
- dis_reason,
- total+1
- );
- strcat (dis_reason, buf);
- } else {
- dis_reason = Strdup(buf);
- total = len;
- }
- break;
-
- case PST_REJREAS:
- len = strlen(buf);
- if (buf[len - 1] == '\\') {
- buf[len - 1] = '\n';
- f--;
- }
- if (rej_reason) {
- total += len;
- rej_reason = Realloc(
- rej_reason,
- total+1
- );
- strcat (rej_reason, buf);
- } else {
- rej_reason = Strdup(buf);
- total = len;
- }
- break;
-
- case PST_PWHEEL:
- if (*buf) {
- ppws = search_pwstatus(buf);
- pwheel_name = Strdup(buf);
- } else {
- ppws = 0;
- pwheel_name = 0;
- }
- break;
-
- case PST_FORM:
- ppfs = parseFormList (buf,&numForms);
- break;
- }
- }
-
- if ((errno != 0) || f && f != PST_MAX) {
- close(fd);
- note("Had trouble reading file %s", pstatus);
- return;
- }
-
- if ((tmp != NULL) && name &&
- (pps = search_pstatus(name))) {
- pps->rej_date = rej_date;
- pps->status |= status;
- pps->forms = ppfs;
- if (ppfs) markFormsMounted(pps);
- pps->numForms = numForms;
- pps->pwheel_name = pwheel_name;
- if ((pps->pwheel = ppws) != NULL)
- ppws->mounted++;
- pps->rej_reason = rej_reason;
- load_str(&pps->fault_reason, CUZ_PRINTING_OK);
- if (pps->printer->login) {
- pps->dis_date = now;
- pps->dis_reason =
- Strdup(CUZ_LOGIN_PRINTER);
- } else {
- pps->dis_date = dis_date;
- pps->dis_reason = dis_reason;
- }
-
- } else {
- if (ppfs)
- Free(ppfs);
- if (dis_reason)
- Free (dis_reason);
- if (rej_reason)
- Free (rej_reason);
- }
- if (name)
- Free (name);
- }
- }
-
- if (fd >= 0) {
- if (errno != 0) {
- close(fd);
- note("Had trouble reading file %s", pstatus);
- return;
- }
- close(fd);
- }
-
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++)
- if (PStatus[i]->printer->name && !PStatus[i]->rej_reason) {
- PStatus[i]->dis_reason = Strdup(CUZ_NEW_PRINTER);
- PStatus[i]->rej_reason = Strdup(CUZ_NEW_DEST);
- PStatus[i]->fault_reason = Strdup(CUZ_PRINTING_OK);
- PStatus[i]->dis_date = now;
- PStatus[i]->rej_date = now;
- PStatus[i]->status |= PS_DISABLED | PS_REJECTED;
- }
-
- return;
-}
-
-/**
- ** load_fault_status() - LOAD PRITNER Fault STATUS FILE
- **/
-
-static void
-load_fault_status(void)
-{
- char *fault_reason = NULL,
- buf[BUFSIZ],
- *fault_status,
- *printerName,
- *p;
-
- int i,
- len,
- total;
-
-
- int fd;
-
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++) {
- PSTATUS *pps = PStatus[i];
-
- printerName = pps->printer->name;
- if (printerName) {
- fault_status = makepath(Lp_A_Printers, printerName,
- FAULT_MESSAGE_FILE , (char *) 0);
- fault_reason = NULL;
- total = 0;
-
- if ((fd = open_locked(fault_status, "r", 0)) >= 0) {
- while (fdgets(buf, BUFSIZ, fd)) {
- len = strlen(buf);
- if (fault_reason) {
- total += len;
- fault_reason =
- Realloc(fault_reason,
- total+1);
- strcat (fault_reason, buf);
- } else {
- fault_reason = Strdup(buf);
- total = len;
- }
- }
-
- if (fault_reason &&
- (pps = search_pstatus(printerName))) {
- p = fault_reason + strlen(fault_reason)
- - 1;
- if (*p == '\n')
- *p = 0;
- load_str(&pps->fault_reason,
- fault_reason);
- }
- if (fault_reason)
- Free(fault_reason);
-
- close(fd);
- }
- Free(fault_status);
- }
- }
-}
-
-
-/**
- ** load_cstatus() - LOAD CLASS STATUS FILE
- **/
-
-static void
-load_cstatus(void)
-{
- CSTATUS *pcs;
- char *rej_reason,
- buf[BUFSIZ],
- *name,
- *p;
- time_t rej_date;
- short status;
- int i,
- len,
- total;
- time_t now;
- int fd;
- register int f;
-
-
- (void) time(&now);
-
- if (!cstatus)
- cstatus = makepath(Lp_System, CSTATUSFILE, (char *)0);
-
- if ((fd = open_locked(cstatus, "r", 0)) >= 0) {
- char *tmp = cstatus; /* not NULL */
-
- errno = 0;
- while (tmp != NULL) {
- status = 0;
-
- total = 0;
- name = 0;
-
- rej_reason = 0;
- for (f = 0;
- (f < CST_MAX) && (tmp = fdgets(buf, BUFSIZ, fd));
- f++) {
- if (p = strrchr(buf, '\n'))
- *p = '\0';
- switch (f) {
- case CST_BRK:
- break;
-
- case CST_NAME:
- name = Strdup(buf);
- break;
-
- case CST_STATUS:
- if (NCMP(buf, NAME_REJECTING))
- status |= PS_REJECTED;
- break;
-
- case CST_DATE:
- rej_date = (time_t)atol(buf);
- break;
-
- case CST_REJREAS:
- len = strlen(buf);
- if (buf[len - 1] == '\\') {
- buf[len - 1] = '\n';
- f--;
- }
- if (rej_reason) {
- total += len;
- rej_reason = Realloc(
- rej_reason,
- total+1
- );
- strcat (rej_reason, buf);
- } else {
- rej_reason = Strdup(buf);
- total = len;
- }
- break;
- }
- }
-
- if ((errno != 0) || f && f != CST_MAX) {
- close(fd);
- note("Had trouble reading file %s", cstatus);
- return;
- }
-
- if ((tmp != NULL) && name &&
- (pcs = search_cstatus(name))) {
- pcs->rej_reason = rej_reason;
- pcs->rej_date = rej_date;
- pcs->status |= status;
-
- } else
- if (rej_reason)
- Free (rej_reason);
-
- if (name)
- Free (name);
- }
- }
-
- if (fd >= 0) {
- if (errno != 0) {
- close(fd);
- note("Had trouble reading file %s", cstatus);
- return;
- }
- close(fd);
- }
-
- for (i = 0; CStatus != NULL && CStatus[i] != NULL; i++)
- if (CStatus[i]->class->name && !CStatus[i]->rej_reason) {
- CStatus[i]->status |= CS_REJECTED;
- CStatus[i]->rej_reason = Strdup(CUZ_NEW_DEST);
- CStatus[i]->rej_date = now;
- }
-
- return;
-}
-
-/**
- ** showForms()
- **/
-char *
-showForms(PSTATUS *pps)
-{
- int i;
- char *formList = NULL;
- char buf[100];
- FSTATUS *pfs;
- PFSTATUS *ppfs;
- short numForms;
-
- numForms = pps->numForms;
- ppfs = pps->forms;
- if (ppfs) {
- for (i = 0; i < numForms; i++) {
- pfs = ppfs[i].form;
- snprintf(buf, sizeof (buf), "%s%c",
- (pfs ? pfs->form->name : ""),
- ((i + 1 < numForms) ? *LP_SEP : '\0'));
-
- if (addstring(&formList,buf)) { /* allocation failed */
- if (formList) {
- Free(formList);
- formList = NULL;
- }
- return(NULL);
- }
- }
- }
- return(formList);
-}
-
-/**
- ** markFormsMounted()
- **/
-
-void
-markFormsMounted(PSTATUS *pps)
-{
- int i;
- int numTrays;
- PFSTATUS *ppfs;
- FSTATUS *pfs;
-
-
- ppfs = pps->forms;
- if (ppfs) {
- numTrays = pps->numForms;
- for (i = 0; i < numTrays; i++) {
- pfs = ppfs[i].form;
- if (pfs)
- pfs->mounted++;
- }
- }
-}
-
-/**
- ** parseFormList()
- **/
-
-static PFSTATUS *
-parseFormList(char *formList, short *num)
-{
- int i;
- FSTATUS *pfs;
- PFSTATUS *ppfs;
- short numForms=0;
- char *endPtr,*ptr;
-
-
- ptr = strchr(formList,*LP_SEP);
- while (ptr) {
- numForms++;
- ptr = strchr(ptr+1,*LP_SEP);
- }
- if ((numForms == 0) && (*formList))
- numForms = 1;
-
- if (numForms &&
- (ppfs = (PFSTATUS *) Calloc(numForms, sizeof(PFSTATUS)))) {
- endPtr = strchr(formList,*LP_SEP);
- if (!endPtr)
- endPtr = formList + strlen(formList);
-
- ptr = formList;
- for (i = 0; endPtr && (i < numForms); i++) {
- *endPtr = 0;
- ppfs[i].form = pfs = search_fstatus(ptr);
- ppfs[i].isAvailable = (pfs ? 1 : 0);
- ptr = endPtr+1;
- endPtr = strchr(ptr,*LP_SEP);
- }
- *num = numForms;
- } else {
- ppfs = NULL;
- *num = 0;
- }
- return(ppfs);
-}
-
-/**
- ** dump_pstatus() - DUMP PRINTER STATUS FILE
- **/
-
-void
-dump_pstatus(void)
-{
- PSTATUS *ppsend;
- int fd;
- register PSTATUS *pps;
- register int f;
- int i;
-
- if (!pstatus)
- pstatus = makepath(Lp_System, PSTATUSFILE, (char *)0);
- if ((fd = open_locked(pstatus, "w", MODE_READ)) < 0) {
- note ("Can't open file \"%s\" (%s).\n", pstatus, PERROR);
- return;
- }
-
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++) {
- PSTATUS *pps = PStatus[i];
-
- if (pps->printer->name)
- for (f = 0; f < PST_MAX; f++) switch (f) {
- case PST_BRK:
- (void)fdprintf(fd, "+%s\n", STATUS_BREAK);
- break;
- case PST_NAME:
- (void)fdprintf(fd, "%s\n",
- NB(pps->printer->name));
- break;
- case PST_STATUS:
- (void)fdprintf(fd, "%s %s\n",
- (pps->status & PS_DISABLED ?
- NAME_DISABLED : NAME_ENABLED),
- (pps->status & PS_REJECTED ?
- NAME_REJECTING : NAME_ACCEPTING));
- break;
- case PST_DATE:
- (void)fdprintf(fd, "%ld %ld\n", pps->dis_date,
- pps->rej_date);
- break;
- case PST_DISREAS:
- put_multi_line(fd, pps->dis_reason);
- break;
- case PST_REJREAS:
- put_multi_line(fd, pps->rej_reason);
- break;
- case PST_PWHEEL:
- (void)fdprintf(fd, "%s\n",
- NB(pps->pwheel_name));
- break;
- case PST_FORM: {
- char *list;
- list = showForms(pps);
- (void)fdprintf(fd, "%s\n", (list ? list : ""));
- if (list)
- Free(list);
- break;
- }
- }
- }
- close(fd);
-
- return;
-}
-
-/**
- ** dump_fault_status() - DUMP PRINTER FAULT STATUS FILE
- **/
-
-void
-dump_fault_status(PSTATUS *pps)
-{
- int fd;
- char *fault_status, *printerName;
-
- printerName = pps->printer->name;
- fault_status = makepath(Lp_A_Printers, printerName, FAULT_MESSAGE_FILE,
- (char *) 0);
- if ((fd = open_locked(fault_status, "w", MODE_READ)) < 0) {
- syslog(LOG_DEBUG, "Can't open file %s (%m)", fault_status);
- } else {
- fdprintf(fd, "%s\n", pps->fault_reason);
- close(fd);
- }
-
- Free(fault_status);
- return;
-}
-
-
-/**
- ** dump_cstatus() - DUMP CLASS STATUS FILE
- **/
-
-void
-dump_cstatus(void)
-{
- int fd;
- register int f;
- int i;
-
-
- if (!cstatus)
- cstatus = makepath(Lp_System, CSTATUSFILE, (char *)0);
- if ((fd = open_locked(cstatus, "w", MODE_READ)) < 0) {
- syslog(LOG_DEBUG, "Can't open file %s (%m)", cstatus);
- return;
- }
-
- for (i = 0; CStatus != NULL && CStatus[i] != NULL; i++) {
- CSTATUS *pcs = CStatus[i];
-
- if (pcs->class->name)
- for (f = 0; f < CST_MAX; f++) switch (f) {
- case CST_BRK:
- (void)fdprintf(fd, "%s\n", STATUS_BREAK);
- break;
- case CST_NAME:
- (void)fdprintf(fd, "%s\n",
- NB(pcs->class->name));
- break;
- case CST_STATUS:
- (void)fdprintf(fd, "%s\n",
- (pcs->status & CS_REJECTED ?
- NAME_REJECTING : NAME_ACCEPTING)
- );
- break;
- case CST_DATE:
- (void)fdprintf(fd, "%ld\n", pcs->rej_date);
- break;
- case CST_REJREAS:
- put_multi_line(fd, pcs->rej_reason);
- break;
- }
- }
- close(fd);
-
- return;
-}
-
-/**
- ** put_multi_line() - PRINT OUT MULTI-LINE TEXT
- **/
-
-static void
-put_multi_line(int fd, char *buf)
-{
- register char *cp,
- *p;
-
- if (!buf) {
- (void)fdprintf(fd, "\n");
- return;
- }
-
- for (p = buf; (cp = strchr(p, '\n')); ) {
- *cp++ = 0;
- (void)fdprintf(fd, "%s\\\n", p);
- p = cp;
- }
- (void)fdprintf(fd, "%s\n", p);
- return;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/terminate.c b/usr/src/cmd/lp/cmd/lpsched/terminate.c
deleted file mode 100644
index 919123115f..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/terminate.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "lpsched.h"
-
-/*
- * terminate() - STOP A CHILD PROCESS
- *
- * Note: If you're trying to debug lpsched, and worried about
- * seeing lots of calls to terminate() in the debug output,
- * don't be; it gets called once for each entry in the child
- * process table, whether or not there's such a child.
- */
-
-void
-terminate(register EXEC *ep)
-{
- int retries; /* fix for sunsoft bugid 1108465 */
-
- if (ep->pid <= 0)
- return;
-
- if (ep->flags & EXF_KILLED)
- return;
- ep->flags |= EXF_KILLED;
-
- /*
- * Theoretically, the following "if-then" is not needed,
- * but there's some bug in the code that occasionally
- * prevents us from hearing from a finished child.
- * (Kill -9 on the child would do that, of course, but
- * the problem has occurred in other cases.)
- */
- if (kill(-ep->pid, SIGTERM) == -1 && errno == ESRCH) {
- ep->pid = -99;
- ep->status = SIGTERM;
- ep->Errno = 0;
- DoneChildren++;
- return;
- }
-
- /*
- * Start fix for sunsoft bugid 1108465
- * the original code here was extremely optimistic, and
- * under certain circumstances, the pid's would still be
- * left around. here we get really serious about killing
- * the sucker.
- * we patiently wait for the pid to die. if it doesn't
- * do so in a reasonable amount of time, we get more forceful.
- * note that the original "ep->pid == -99" is a crude hack;
- * but that the convention is being followed. sigh.
- */
- for (retries = 5; retries > 0; retries--) {
- /* see if the process is still there */
- if ((kill(-ep->pid, 0) == -1) && (errno == ESRCH)) {
- ep->pid = -99;
- ep->status = SIGTERM;
- ep->Errno = 0;
- DoneChildren++;
- return;
- } else if (errno == EINTR)
- break;
-
- sleep(2);
- }
-
- /* if it's still not dead, then get more forceful */
- for (retries = 5; retries > 0; retries--) {
- if ((kill(-ep->pid, SIGKILL) == -1) && (errno == ESRCH)) {
- ep->pid = -99;
- ep->status = SIGTERM;
- ep->Errno = 0;
- DoneChildren++;
- return;
- }
- sleep(3);
- }
- /* end of sunsoft bugfix 1108465 */
- /*
- * well hardkill didn't work so just flag this request as done
- */
- ep->pid = -99;
- ep->status = SIGTERM;
- ep->Errno = 0;
- DoneChildren++;
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/validate.c b/usr/src/cmd/lp/cmd/lpsched/validate.c
deleted file mode 100644
index bec1434f9b..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/validate.c
+++ /dev/null
@@ -1,1075 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* SVr4.0 1.11.1.10 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "lpsched.h"
-
-#include "validate.h"
-
-#include <syslog.h>
-#include <errno.h>
-#include <deflt.h>
-#include <tsol/label.h>
-#include <auth_list.h>
-
-#define register auto
-
-
-int pickfilter ( RSTATUS * , CANDIDATE * , FSTATUS * );
-
-unsigned long chkprinter_result = 0;
-char * o_cpi = 0;
-char * o_lpi = 0;
-char * o_width = 0;
-char * o_length = 0;
-
-static int wants_nobanner = 0;
-static int wants_nolabels = 0;
-static int lp_or_root = 0;
-
-static int _chkopts ( RSTATUS *, CANDIDATE * , FSTATUS * );
-static void free_candidate ( CANDIDATE * );
-static int tsol_check_printer_label_range(char *, const char *);
-static int tsol_lpauth(char *, char *);
-static int secpolicy_chkpolicy(char *policyp);
-
-/**
- ** _validate() - FIND A PRINTER TO HANDLE A REQUEST
- **/
-
-short
-_validate(RSTATUS *prs, PSTATUS *pps, PSTATUS *stop_pps, char **prefixp,
- int moving)
-{
- register CANDIDATE *pc = 0,
- *pcend,
- *best_pc = 0;
-
- register FSTATUS *pfs = 0;
-
- register CSTATUS *pcs = 0;
-
- CANDIDATE *arena = 0,
- single;
-
- size_t n;
- int i;
-
- short ret;
-
- chkprinter_result = 0;
- o_cpi = o_lpi = o_width = o_length = 0;
- wants_nobanner = 0;
- memset (&single, 0, sizeof(single));
-
- wants_nolabels = 0;
- /*
- * If the system is labeled, the printing of postscript files
- * is restricted. All users can print postscript files if the
- * file /etc/default/print contains "PRINT_POSTSCRIPT=1".
- * (this is checked by secpolicy_chkpolicy). Otherwise the
- * user must have PRINT_POSTSCRIPT_AUTH to print postscript files.
- */
- if ((is_system_labeled() &&
- strcmp(prs->request->input_type, "postscript") == 0) &&
- (secpolicy_chkpolicy("PRINT_POSTSCRIPT=") == 0)) {
- if (tsol_lpauth(PRINT_POSTSCRIPT_AUTH, prs->secure->user)
- == 0) {
- ret = MDENYDEST;
- goto Return;
- }
- }
- lp_or_root = 0;
-
- if (bangequ(prs->secure->user, "root") ||
- bangequ(prs->secure->user, "lp"))
- lp_or_root = 1;
-
- if (prefixp)
- *prefixp = prs->request->destination;
-
- /*
- * If a destination other than "any" was given,
- * see if it exists in our internal tables.
- */
- if (!pps && prs->request->destination &&
- !STREQU(prs->request->destination, NAME_ANY))
- if (((pps = search_pstatus(prs->request->destination)) != NULL) ||
- ((pcs = search_cstatus(prs->request->destination)) != NULL) &&
- pcs->class->members)
- /*EMPTY*/;
- else {
- ret = MNODEST;
- goto Return;
- }
-
- /*
- * If we are trying to avoid a printer, but the request
- * was destined for just that printer, we're out.
- */
- if (pps && pps == stop_pps) {
- ret = MERRDEST;
- goto Return;
- }
-
- /*
- * If a form was given, see if it exists; if so,
- * see if the user is allowed to use it.
- * If a remote printer was specified, then don't use any local
- * form knowledge.
- */
- if (prs && prs->request && prs->request->form && (pps || pcs)) {
- if ((pfs = search_fstatus(prs->request->form))) {
- if (lp_or_root || allowed(prs->secure->user,
- pfs->users_allowed, pfs->users_denied))
- /*EMPTY*/;
- else {
- ret = MDENYMEDIA;
- goto Return;
- }
- } else {
- ret = MNOMEDIA;
- goto Return;
- }
- }
-
- /*
- * If the request includes -o options there may be pitch and
- * size and no-banner requests that have to be checked. One
- * could argue that this shouldn't be in the Spooler, because
- * the Spooler's job is SPOOLING, not PRINTING. That's right,
- * except that the Spooler will be making a choice of printers
- * so it has to evaluate carefully: E.g. user wants ANY printer,
- * so we should pick one that can handle what he/she wants.
- *
- * Parse out the important stuff here so we have it when we
- * need it.
- */
- {
- register char **list,
- **pl;
-
- if (
- prs->request->options
- && (list = dashos(prs->request->options))
- ) {
- for (pl = list ; *pl; pl++)
- if (STRNEQU(*pl, "cpi=", 4))
- o_cpi = Strdup(*pl + 4);
- else if (STRNEQU(*pl, "lpi=", 4))
- o_lpi = Strdup(*pl + 4);
- else if (STRNEQU(*pl, "width=", 6))
- o_width = Strdup(*pl + 6);
- else if (STRNEQU(*pl, "length=", 7))
- o_length = Strdup(*pl + 7);
- else if (STREQU(*pl, "nobanner"))
- wants_nobanner = 1;
- else if (STREQU(*pl, "nolabels"))
- wants_nolabels = 1;
- freelist (list);
- }
- }
-
- /*
- * This macro checks that a form has a mandatory print wheel
- * (or character set).
- */
-#define CHKMAND(PFS) \
- ( \
- (PFS) \
- && (PFS)->form->chset \
- && !STREQU((PFS)->form->chset, NAME_ANY) \
- && (PFS)->form->mandatory \
- )
-
- /*
- * This macro checks that the user is allowed to use the
- * printer.
- */
-#define CHKU(PRS,PPS) \
- ( \
- lp_or_root \
- || allowed( \
- (PRS)->secure->user, \
- (PPS)->users_allowed, \
- (PPS)->users_denied \
- ) \
- )
-
- /*
- * This macro checks that the form is allowed on the printer,
- * or is already mounted there.
- * Note: By doing this check we don't have to check that the
- * characteristics of the form, such as pitch, size, or
- * character set, against the printer's capabilities, ASSUMING,
- * of course, that the allow list is correct. That is, the
- * allow list lists forms that have already been checked against
- * the printer!
- */
-#define CHKF(PFS,PPS) \
- ( \
- isFormMountedOnPrinter(PPS,PFS) \
- || allowed( \
- (PFS)->form->name, \
- (PPS)->forms_allowed, \
- (PPS)->forms_denied \
- ) \
- )
-
- /*
- * This macro checks that the print wheel is acceptable
- * for the printer or is mounted. Note: If the printer doesn't
- * take print wheels, the check passes. The check for printers
- * that don't take print wheels is below.
- */
-#define CHKPW(PW,PPS) \
- ( \
- !(PPS)->printer->daisy \
- || ( \
- (PPS)->pwheel_name \
- && STREQU((PPS)->pwheel_name, (PW)) \
- ) \
- || searchlist((PW), (PPS)->printer->char_sets) \
- )
-
- /*
- * This macro checks the pitch, page size, and (if need be)
- * the character set. The character set isn't checked if the
- * printer takes print wheels, or if the character set is
- * listed in the printer's alias list.
- * The form has to be checked as well; while we're sure that
- * at least one type for each printer can handle the form's
- * cpi/lpi/etc. characteristics (lpadmin made sure), we aren't
- * sure that ALL the types work.
- */
-#define CHKOPTS(PRS,PC,PFS) _chkopts((PRS),(PC),(PFS)) /* was a macro */
-
- /*
- * This macro checks the acceptance status of a printer.
- * If the request is already assigned to that printer,
- * then it's okay. It's ambiguous what should happen if
- * originally a "-d any" request was accepted, temporarily
- * assigned one printer, then the administrator (1) rejected
- * further requests for the printers and (2) made the
- * temporarily assigned printer unusable for the request.
- * What will happen, of course, is that the request will
- * be canceled, even though the other printers would be okay
- * if not rejecting....but if we were to say, gee it's okay,
- * the request has already been accepted, we may be allowing
- * it on printers that were NEVER accepting. Thus we can
- * continue to accept it only for the printer already assigned.
- */
-#define CHKACCEPT(PRS,PPS) \
- ( \
- !((PPS)->status & PS_REJECTED) \
- || (PRS)->printer == (PPS) \
- || moving \
- )
-
- /*
- * If a print wheel or character set is given, see if it
- * is allowed on the form.
- */
- if (prs->request->charset)
- if (
- !CHKMAND(pfs)
- || STREQU(prs->request->charset, pfs->form->chset)
- )
- /*EMPTY*/;
- else {
- ret = MDENYMEDIA;
- chkprinter_result |= PCK_CHARSET;
- goto Return;
- }
-
- /*
- * If a single printer was named, check the request against it.
- * Do the accept/reject check late so that we give the most
- * useful information to the user.
- */
- if (pps) {
- (pc = &single)->pps = pps;
-
- /* Does the printer allow the user? */
- if (!CHKU(prs, pps)) {
- ret = MDENYDEST;
- goto Return;
- }
-
- /* Check printer label range */
- if (is_system_labeled() && prs->secure->slabel != NULL) {
- if (tsol_check_printer_label_range(
- prs->secure->slabel,
- pps->printer->name) == 0) {
- ret = MDENYDEST;
- goto Return;
- }
- }
-
- /* Does the printer allow the form? */
- if (pfs && !CHKF(pfs, pps)) {
- ret = MNOMOUNT;
- goto Return;
- }
-
- /* Does the printer allow the pwheel? */
- if (
- prs->request->charset
- && !CHKPW(prs->request->charset, pps)
- ) {
- ret = MNOMOUNT;
- goto Return;
- }
-
- /* Can printer handle the pitch/size/charset/nobanner? */
- if (!CHKOPTS(prs, pc, pfs)) {
- ret = MDENYDEST;
- goto Return;
- }
-
- /* Is the printer allowing requests? */
- if (!CHKACCEPT(prs, pps)) {
- ret = MERRDEST;
- goto Return;
- }
-
- /* Is there a filter which will convert the input? */
- if (!pickfilter(prs, pc, pfs)) {
- ret = MNOFILTER;
- goto Return;
- }
-
- best_pc = pc;
- ret = MOK;
- goto Return;
- }
-
- /*
- * Do the acceptance check on the class (if we have one)
- * now so we can proceed with checks on individual printers
- * in the class. Don't toss out the request if it is already
- * assigned a printer just because the class is NOW rejecting.
- */
- if (
- pcs
- && (pcs->status & CS_REJECTED)
- && !moving
- && !prs->printer
- ) {
- ret = MERRDEST;
- goto Return;
- }
-
- /*
- * Construct a list of printers based on the destination
- * given. Cross off those that aren't accepting requests,
- * that can't take the form, or which the user can't use.
- * See if the list becomes empty.
- */
-
- if (pcs)
- n = lenlist(pcs->class->members);
- else {
- for (n = 0; PStatus != NULL && PStatus[n] != NULL; n++) ;
- }
- pcend = arena = (CANDIDATE *)Calloc(n, sizeof(CANDIDATE));
-
- /*
- * Start with a list of printers that are accepting requests.
- * Don't skip a printer if it's rejecting but the request
- * has already been accepted for it.
- */
- if (pcs) {
- register char **pn;
-
- for (pn = pcs->class->members; *pn; pn++)
- if (
- ((pps = search_pstatus(*pn)) != NULL)
- && pps != stop_pps
- )
- (pcend++)->pps = pps;
-
-
- } else
- for (i = 0; PStatus != NULL && PStatus[i] != NULL; i++) {
- pps = PStatus[i];
-
- if (CHKACCEPT(prs, pps) && pps != stop_pps)
- (pcend++)->pps = pps;
- }
-
- if (pcend == arena) {
- ret = MERRDEST;
- goto Return;
- }
-
- /*
- * Clean out printers that the user can't use. We piggy-back
- * the pitch/size/banner checks here because the same error return
- * is given (strange, eh?).
- */
- {
- register CANDIDATE *pcend2;
-
- for (pcend2 = pc = arena; pc < pcend; pc++) {
- if (CHKU(prs, pc->pps) && CHKOPTS(prs, pc, pfs))
- *pcend2++ = *pc;
- else
- free_candidate (pc);
- }
-
- if (pcend2 == arena) {
- ret = MDENYDEST;
- goto Return;
- }
- pcend = pcend2;
-
- }
-
- /*
- * Clean out printers that can't mount the form,
- * EXCEPT for printers that already have it mounted:
- */
- if (pfs) {
- register CANDIDATE *pcend2;
-
- for (pcend2 = pc = arena; pc < pcend; pc++)
- if (CHKF(pfs, pc->pps))
- *pcend2++ = *pc;
- else
- free_candidate (pc);
-
- if (pcend2 == arena) {
- ret = MNOMOUNT;
- goto Return;
- }
- pcend = pcend2;
-
- }
-
- /*
- * Clean out printers that can't take the print wheel
- * EXCEPT for printers that already have it mounted
- * or printers for which it is a selectable character set:
- */
- if (prs->request->charset) {
- register CANDIDATE *pcend2;
-
- for (pcend2 = pc = arena; pc < pcend; pc++)
- if (CHKPW(prs->request->charset, pc->pps))
- *pcend2++ = *pc;
- else
- free_candidate (pc);
-
- if (pcend2 == arena) {
- ret = MNOMOUNT;
- goto Return;
- }
- pcend = pcend2;
-
- }
-
- /*
- * Clean out printers that can't handle the printing
- * and for which there's no filter to convert the input.
- *
- */
-
- /*
- * Is the form mounted, or is none needed?
- */
-#define CHKFMNT(PFS,PPS) (isFormUsableOnPrinter(PPS,PFS))
-
- /*
- * Is the print-wheel mounted, or is none needed?
- */
-#define CHKPWMNT(PRS,PPS) SAME((PPS)->pwheel_name, (PRS)->request->charset)
-
- /*
- * Do we NOT need a special character set, or can we select
- * it on the printer? Note: Getting this far means that IF
- * the printer has selectable character sets (!daisy) then
- * it can select the one we want.
- */
-#define CHKCHSET(PRS,PPS) \
- ( \
- !(PRS)->request->charset \
- || !(PPS)->printer->daisy \
- )
-
- /*
- * Is the printer able to print now?
- */
-#define CHKENB(PPS) (!((PPS)->status & (PS_DISABLED|PS_FAULTED)))
-
- /*
- * Is the printer not busy printing another request, or
- * not awaiting an auto-retry after a fault?
- */
-#define CHKFREE(PPS) (!((PPS)->status & (PS_BUSY|PS_LATER)))
-
- {
- register CANDIDATE *pcend2;
-
- for (pcend2 = pc = arena; pc < pcend; pc++)
- if (pickfilter(prs, pc, pfs)) {
-
- /*
- * Compute a ``weight'' for this printer,
- * based on its status. We'll later pick
- * the printer with the highest weight.
- */
- pc->weight = 0;
- if (!pc->fast && !pc->slow)
- pc->weight += WEIGHT_NOFILTER;
- if (CHKFREE(pc->pps))
- pc->weight += WEIGHT_FREE;
- if (CHKENB(pc->pps))
- pc->weight += WEIGHT_ENABLED;
- if (CHKFMNT(pfs, pc->pps))
- pc->weight += WEIGHT_MOUNTED;
- if (CHKPWMNT(prs, pc->pps))
- pc->weight += WEIGHT_MOUNTED;
- if (CHKCHSET(prs, pc->pps))
- pc->weight += WEIGHT_SELECTS;
-
-#if defined(FILTER_EARLY_OUT)
- if (pc->weight == WEIGHT_MAX) {
- /*
- * This is the one!
- */
- best_pc = pc;
- ret = MOK;
- goto Return;
- }
-#endif
- /*
- * This is a candidate!
- */
- *pcend2++ = *pc;
-
- } else
- /*
- * No filter for this one!
- */
- free_candidate (pc);
-
- if (pcend2 == arena) {
- ret = MNOFILTER;
- goto Return;
- }
- pcend = pcend2;
-
- }
-
- if (pcend - arena == 1) {
- best_pc = arena;
- ret = MOK;
- goto Return;
- }
- /*
- * Clean out local printers
- * where the request is outside the printer label range.
- */
- {
- register CANDIDATE *pcend2 = pcend;
-
- if (is_system_labeled()) {
- for (pcend2 = pc = arena; pc < pcend; pc++) {
- if (tsol_check_printer_label_range(
- prs->secure->slabel,
- pps->printer->name) == 1)
- *pcend2++ = *pc;
- else
- free_candidate(pc);
- }
- }
-
- if (pcend2 == arena) {
- ret = MDENYDEST;
- goto Return;
- }
- pcend = pcend2;
- }
-
-#if defined(OTHER_FACTORS)
- /*
- * Here you might want to add code that considers
- * other factors: the size of the file(s) to be
- * printed ("prs->secure->size") in relation to the
- * printer (e.g. printer A gets mostly large
- * files, printer B gets mostly small files); the
- * number/total-size of requests currently queued
- * for the printer; etc.
- *
- * If your code includes eliminating printers drop them
- * from the list (as done in several places above).
- * Otherwise, your code should add weights to the weight
- * already computed. Change the WEIGHT_MAX, increase the
- * other WEIGHT_X values to compensate, etc., as appropriate.
- */
- ;
-#endif
-
- /*
- * Pick the best printer from a list of eligible candidates.
- */
- best_pc = arena;
- for (pc = arena + 1; pc < pcend; pc++)
- if (pc->weight > best_pc->weight)
- best_pc = pc;
- ret = MOK;
-
- /*
- * Branch to here if MOK and/or if things have been allocated.
- */
-Return: if (ret == MOK) {
- register USER *pu = Getuser(prs->secure->user);
-
- register char *pwheel_name;
-
- PSTATUS *oldpps = prs->printer;
-
-
- /*
- * We are going to accept this print request, having
- * found a printer for it. This printer will be assigned
- * to the request, although this assignment may be
- * temporary if other printers qualify and this printer
- * is changed to no longer qualify. Qualification in
- * this context includes being ready to print!
- */
- prs->printer = best_pc->pps;
- load_str (&(prs->printer_type), best_pc->printer_type);
-
- /*
- * Assign the form (if any) to the request. Adjust
- * the number of requests queued for old and new form
- * accordingly.
- */
- if (prs->form != pfs) {
- unqueue_form (prs);
- queue_form (prs, pfs);
- }
-
- /*
- * Ditto for the print wheel, except include here the
- * print wheel needed by the form.
- * CAUTION: When checking this request later, don't
- * refuse to service it if the print wheel for the
- * form isn't mounted but the form is; a mounted form
- * overrides its other needs. Don't be confused by the
- * name of the bit, RSS_PWMAND; a printer that prints
- * this request MUST have the print wheel mounted
- * (if it takes print wheels) if the user asked for
- * a particular print wheel.
- */
- prs->status &= ~RSS_PWMAND;
- if (CHKMAND(pfs))
- pwheel_name = pfs->form->chset;
- else
- if ((pwheel_name = prs->request->charset) != NULL)
- prs->status |= RSS_PWMAND;
-
- if (!SAME(pwheel_name, prs->pwheel_name)) {
- unqueue_pwheel (prs);
- queue_pwheel (prs, pwheel_name);
- }
-
- /*
- * Adjust the priority to lie within the limits allowed
- * for the user (this is a silent adjustment as required).
- * CURRENTLY, ONLY NEW REQUESTS WILL GET QUEUED ACCORDING
- * TO THIS PRIORITY. EXISTING REQUESTS BEING (RE)EVALUATED
- * WILL NOT BE REQUEUED.
- * A wild priority is changed to the default, or the
- * limit, whichever is the lower priority (higher value).
- */
- if (prs->request->priority < 0 || 39 < prs->request->priority)
- prs->request->priority = getdfltpri();
- if (pu && prs->request->priority < pu->priority_limit)
- prs->request->priority = pu->priority_limit;
-
- /*
- * If a filter is involved, change the number of
- * copies to 1 (if the filter handles it).
- */
- if (
- (best_pc->fast || best_pc->slow)
- && (best_pc->flags & FPARM_COPIES)
- && prs->request->copies > 1
- )
- prs->copies = 1;
- else
- /*
- * We use two ".copies" because we don't
- * want to lose track of the number requested,
- * but do want to mark the number the interface
- * program is to handle. Here is the best
- * place to know this.
- */
- prs->copies = prs->request->copies;
-
- if (best_pc->slow) {
- /*
- * If the filter has changed, the request will
- * have to be refiltered. This may mean stopping
- * a currently running filter or interface.
- */
- if (!SAME(best_pc->slow, prs->slow)) {
-
- if (prs->request->outcome & RS_FILTERED)
- prs->request->outcome &= ~RS_FILTERED;
-
- if (
- prs->request->outcome & RS_FILTERING
- && !(prs->request->outcome & RS_STOPPED)
- ) {
- prs->request->outcome |= RS_REFILTER;
- prs->request->outcome |= RS_STOPPED;
- terminate (prs->exec);
-
- } else if (
- prs->request->outcome & RS_PRINTING
- && !(prs->request->outcome & RS_STOPPED)
- ) {
- prs->request->outcome |= RS_STOPPED;
- terminate (oldpps->exec);
- }
-
- }
-
- load_str (&(prs->slow), best_pc->slow);
- /* Assumption: if there is a slow filter,
- * there is an output_type
- */
-
- load_str (&(prs->output_type), best_pc->output_type);
- } else
- unload_str (&(prs->slow));
-
- load_str (&(prs->fast), best_pc->fast);
-
- if (prs->request->actions & ACT_FAST && prs->slow) {
- if (prs->fast) {
- prs->fast = makestr(
- prs->slow,
- "|",
- prs->fast,
- (char *)0
- );
- Free (prs->slow);
- } else
- prs->fast = prs->slow;
- prs->slow = 0;
- }
-
- }
-
-
- /*
- * Free the space allocated for the candidates, INCLUDING
- * the one chosen. Any allocated space in the chosen candidate
- * that has to be saved should have been COPIED already.
- */
- if (arena) {
- for (pc = arena; pc < pcend; pc++)
- free_candidate (pc);
- Free ((char *)arena);
- } else if (best_pc)
- free_candidate (best_pc);
-
- if (o_length)
- Free (o_length);
- if (o_width)
- Free (o_width);
- if (o_lpi)
- Free (o_lpi);
- if (o_cpi)
- Free (o_cpi);
-
-
- /*
- * The following value is valid ONLY IF the request
- * is canceled or rejected. Not all requests that
- * we fail in this routine are tossed out!
- */
- prs->reason = ret;
-
-
- return (ret);
-}
-
-/**
- ** _chkopts() - CHECK -o OPTIONS
- **/
-
-static int
-_chkopts(RSTATUS *prs, CANDIDATE *pc, FSTATUS *pfs)
-{
- unsigned long ret = 0;
- unsigned long chk = 0;
-
- char * charset;
- char * cpi = 0;
- char * lpi = 0;
- char * width = 0;
- char * length = 0;
- char * paper = NULL;
-
- char ** pt;
- int nobanner_not_allowed = 0;
-
-
- /*
- * If we have a form, it overrides whatever print characteristics
- * the user gave.
- */
- if (pfs) {
- cpi = pfs->cpi;
- lpi = pfs->lpi;
- width = pfs->pwid;
- length = pfs->plen;
- paper = pfs->form->paper;
- } else {
- cpi = o_cpi;
- lpi = o_lpi;
- width = o_width;
- length = o_length;
- }
-
- /*
- * If the printer takes print wheels, or the character set
- * the user wants is listed in the character set map for this
- * printer, we needn't check if the printer can handle the
- * character set. (Note: The check for the print wheel case
- * is done elsewhere.)
- */
-
- if (pc->pps->printer->daisy ||
- search_cslist(prs->request->charset, pc->pps->printer->char_sets))
- charset = 0;
- else
- charset = prs->request->charset;
-
- pc->printer_types = 0;
- for (pt = pc->pps->printer->printer_types; *pt; pt++) {
- unsigned long this;
-
- if (paper) {
- if (allowed(paper,pc->pps->paper_allowed,NULL)) {
- addlist (&(pc->printer_types), *pt);
- } else {
- ret |= PCK_PAPER;
- }
- } else {
- this = chkprinter(*pt, cpi, lpi, length, width,
- charset);
- if (this == 0)
- addlist(&(pc->printer_types), *pt);
- chk |= this;
- }
- }
- if (!pc->printer_types)
- ret |= chk;
-
- /*
- * If the sytem is labeled, then user who wants 'nolabels' must
- * have PRINT_UNLABELED_AUTH authorizations to allow it.
- */
- if (is_system_labeled() && (wants_nolabels == 1)) {
- if (!tsol_lpauth(PRINT_UNLABELED_AUTH, prs->secure->user)) {
- /* if not authorized, remove "nolabels" from options */
- register char **list;
- if (prs->request->options &&
- (list = dashos(prs->request->options))) {
- dellist(&list, "nolabels");
- free(prs->request->options);
- prs->request->options = sprintlist(list);
- }
- }
- }
-
-
- if (pc->pps->printer->banner == BAN_ALWAYS) {
- /* delete "nobanner" */
- char **list;
-
- /*
- * If the system is labeled, users must have
- * PRINT_NOBANNER_AUTH authorization to print
- * without a banner.
- */
- if (is_system_labeled()) {
- if (wants_nobanner == 1) {
- if (tsol_lpauth(PRINT_NOBANNER_AUTH,
- prs->secure->user) == 0) {
- nobanner_not_allowed = 1;
- }
- }
-
- }
- else if ((wants_nobanner == 1) && (lp_or_root != 1)) {
- nobanner_not_allowed = 1;
- }
- if (nobanner_not_allowed == 1) {
- /* Take out 'nobanner' from request options. */
- if (prs->request->options &&
- (list = dashos(prs->request->options))) {
- dellist(&list, "nobanner");
- free(prs->request->options);
- prs->request->options = sprintlist(list);
- }
- }
- } else if (pc->pps->printer->banner == BAN_NEVER) {
- if (wants_nobanner == 0) {
- /* add "nobanner" */
- char **list = NULL;
-
- if (prs->request->options) {
- list = dashos(prs->request->options);
- free(prs->request->options);
- }
- appendlist(&list, "nobanner");
- prs->request->options = sprintlist(list);
- }
- } else /* if (pc->pps->printer->banner == BAN_OPTIONAL) */ {
- /* it is optional, leave it alone */
- }
-
- chkprinter_result |= ret;
- return (ret == 0);
-}
-
-/**
- ** free_candidate()
- **/
-
-static void
-free_candidate(CANDIDATE *pc)
-{
- if (pc->slow)
- unload_str (&(pc->slow));
- if (pc->fast)
- unload_str (&(pc->fast));
- if (pc->printer_types) {
- freelist (pc->printer_types);
- pc->printer_types = 0;
- }
- if (pc->printer_type)
- unload_str (&(pc->printer_type));
- if (pc->output_type)
- unload_str (&(pc->output_type));
- return;
-}
-
-static int
-tsol_check_printer_label_range(char *slabel, const char *printer)
-{
- int in_range = 0;
- int err = 0;
- m_range_t *range;
- m_label_t *sl = NULL;
-
- if (slabel == NULL)
- return (0);
-
- if ((err =
- (str_to_label(slabel, &sl, USER_CLEAR, L_NO_CORRECTION, &in_range)))
- == -1) {
- /* stobsl error on printer max label */
- return (0);
- }
- if ((range = getdevicerange(printer)) == NULL) {
- m_label_free(sl);
- return (0);
- }
-
- /* blinrange returns true (1) if in range, false (0) if not */
- in_range = blinrange(sl, range);
-
- m_label_free(sl);
- m_label_free(range->lower_bound);
- m_label_free(range->upper_bound);
- free(range);
-
- return (in_range);
-}
-
-/*
- * Given a character string with a "username" or "system!username"
- * this function returns a pointer to "username"
- */
-static int
-tsol_lpauth(char *auth, char *in_name)
-{
- char *cp;
- int res;
-
- if ((cp = strchr(in_name, '@')) != NULL) {
- /* user@system */
- *cp = '\0';
- res = chkauthattr(auth, in_name);
- *cp = '@';
- } else if ((cp = strchr(in_name, '!')) != NULL)
- /* system!user */
- res = chkauthattr(auth, cp+1);
- else
- /* user */
- res = chkauthattr(auth, in_name);
-
- return (res);
-}
-
-#define POLICY_FILE "/etc/default/print"
-
-int
-secpolicy_chkpolicy(char *policyp)
-{
- char *option;
- int opt_val;
-
- if (policyp == NULL)
- return (0);
- opt_val = 0;
- if (defopen(POLICY_FILE) == 0) {
-
- defcntl(DC_SETFLAGS, DC_STD & ~DC_CASE); /* ignore case */
-
- if ((option = defread(policyp)) != NULL)
- opt_val = atoi(option);
- }
- (void) defopen((char *)NULL);
- syslog(LOG_DEBUG, "--- Policy %s, opt_val==%d",
- policyp ? policyp : "NULL", opt_val);
- return (opt_val);
-}
diff --git a/usr/src/cmd/lp/cmd/lpsched/validate.h b/usr/src/cmd/lp/cmd/lpsched/validate.h
deleted file mode 100644
index cf415a0b0b..0000000000
--- a/usr/src/cmd/lp/cmd/lpsched/validate.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * The old LP Spooler would take a job destined for a class of printers
- * if the class was accepting, regardless of the acceptance status of
- * the printers. This sounds a bit silly, so we thought we'd change it.
- * Well, that's not compatible. So YOU decide. Define the following if
- * you want compatibility, don't define it if you want to require BOTH
- * the printers (at least one) and the class to be accepting.
- */
-#define CLASS_ACCEPT_PRINTERS_REJECT_SOWHAT 1 /* */
-
-/*
- * Define the following if we should stop examing a list of printers
- * on the first one that meets all the needs of the request.
- * Currently this is done because to continue wouldn't matter. However,
- * you may add additional code that considers other factors (e.g. size
- * of queue for printer, size of file under consideration.)
- */
-#define FILTER_EARLY_OUT 1 /* */
-
-typedef struct candidate {
- PSTATUS * pps;
- char * slow;
- char * fast;
- char ** printer_types;
- char * printer_type;
- char * output_type;
- unsigned short flags;
- unsigned short weight;
-} CANDIDATE;
-
-#define WEIGHT_NOFILTER 1
-#define WEIGHT_FREE 2
-#define WEIGHT_ENABLED 4
-#define WEIGHT_MOUNTED 8
-#define WEIGHT_SELECTS 16
-#define WEIGHT_MAX ( \
- WEIGHT_NOFILTER \
- + WEIGHT_FREE \
- + WEIGHT_ENABLED \
- + 2 * WEIGHT_MOUNTED \
- + WEIGHT_SELECTS \
- )
-
-extern int pick_filter();
-
-extern char *o_cpi,
- *o_lpi,
- *o_width,
- *o_length;
diff --git a/usr/src/cmd/lp/cmd/lpshut.c b/usr/src/cmd/lp/cmd/lpshut.c
deleted file mode 100644
index 925b669f5b..0000000000
--- a/usr/src/cmd/lp/cmd/lpshut.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <locale.h>
-#include "stdio.h"
-#include "signal.h"
-#include "string.h"
-#include "sys/types.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "msgs.h"
-
-#define WHO_AM_I I_AM_LPSHUT
-#include "oam.h"
-
-void startup(),
- cleanup(),
- done();
-
-/*
- * There are no sections of code in this progam that have to be
- * protected from interrupts. We do want to catch them, however,
- * so we can clean up properly.
- */
-
-/**
- ** main()
- **/
-
-int
-main(int argc, char *argv[])
-{
- char msgbuf[MSGMAX];
- char * tempo;
-
- int mtype;
-
- short status;
-
-
- (void) setlocale (LC_ALL, "");
-
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- if (argc > 1)
- if (STREQU(argv[1], "-?")) {
- printf (gettext("usage: lpshut\n"));
- exit (0);
-
- } else {
- LP_ERRMSG1 (ERROR, E_LP_OPTION, argv[1]);
- exit (1);
- }
-
-
- startup ();
-
- if ((tempo = getenv("LPSHUT")) && STREQU(tempo, "slow"))
- (void)putmessage (msgbuf, S_SHUTDOWN, 0);
- else
- (void)putmessage (msgbuf, S_SHUTDOWN, 1);
-
- if (msend(msgbuf) == -1) {
- LP_ERRMSG (ERROR, E_LP_MSEND);
- done (1);
- }
- if (mrecv(msgbuf, sizeof(msgbuf)) == -1) {
- LP_ERRMSG (ERROR, E_LP_MRECV);
- done (1);
- }
-
- mtype = getmessage(msgbuf, R_SHUTDOWN, &status);
- if (mtype != R_SHUTDOWN) {
- LP_ERRMSG1 (ERROR, E_LP_BADREPLY, mtype);
- done (1);
- }
-
- switch (status) {
-
- case MOK:
- printf (gettext("Print services stopped.\n"));
- done (0);
-
- case MNOPERM:
- LP_ERRMSG (WARNING, E_SHT_CANT);
- done (1);
-
- default:
- LP_ERRMSG1 (ERROR, E_LP_BADSTATUS, status);
- done (1);
- }
- /*NOTREACHED*/
- return (0);
-}
-
-/**
- ** startup() - OPEN MESSAGE QUEUE TO SPOOLER
- **/
-
-void startup ()
-{
- void catch();
-
- /*
- * Open a private queue for messages to the Spooler.
- * An error is deadly.
- */
- if (mopen() == -1) {
-
- switch (errno) {
- case ENOMEM:
- case ENOSPC:
- LP_ERRMSG (ERROR, E_LP_MLATER);
- exit (1);
- /*NOTREACHED*/
-
- default:
- printf (gettext("Print services already stopped.\n"));
- exit (1);
- /*NOTREACHED*/
- }
- }
-
- /*
- * Now that the queue is open, quickly trap signals
- * that we might get so we'll be able to close the
- * queue again, regardless of what happens.
- */
- if(signal(SIGHUP, SIG_IGN) != SIG_IGN)
- signal(SIGHUP, catch);
- if(signal(SIGINT, SIG_IGN) != SIG_IGN)
- signal(SIGINT, catch);
- if(signal(SIGQUIT, SIG_IGN) != SIG_IGN)
- signal(SIGQUIT, catch);
- if(signal(SIGTERM, SIG_IGN) != SIG_IGN)
- signal(SIGTERM, catch);
-
- return;
-}
-
-/**
- ** catch() - CATCH INTERRUPT, HANGUP, ETC.
- **/
-
-void catch (sig)
- int sig;
-{
- signal (sig, SIG_IGN);
- done (1);
-}
-
-/**
- ** cleanup() - CLOSE THE MESSAGE QUEUE TO THE SPOOLER
- **/
-
-void cleanup ()
-{
- mclose ();
- return;
-}
-
-/**
- ** done() - CLEANUP AND EXIT
- **/
-
-void done (ec)
- int ec;
-{
- cleanup ();
- exit (ec);
-}
diff --git a/usr/src/cmd/lp/cmd/lptest/Makefile b/usr/src/cmd/lp/cmd/lptest/Makefile
deleted file mode 100644
index 9c2aea6eb7..0000000000
--- a/usr/src/cmd/lp/cmd/lptest/Makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
-# All Rights Reserved
-#
-# cmd/lp/cmd/lptest/Makefile
-#
-
-include ../../Makefile.lp
-
-PROG= lptest
-
-ROOTUSRUCBSYMLINK= $(ROOTUSRUCB)/$(PROG)
-ROOTUSRBINPROG= $(PROG:%=$(ROOTBIN)/%)
-
-SRCS= lptest.c
-
-OBJS= $(SRCS:.c=.o)
-
-CPPFLAGS = -I$(LPINC) $(CPPFLAGS.master)
-LDLIBS += $(LIBBSD) $(LIBREQ) $(LIBMSG) $(LIBOAM)
-
-POFILE= lp_cmd_lptest.po
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-install: all .WAIT $(ROOTUSRBINPROG) $(ROOTUSRUCBSYMLINK)
-
-$(ROOTUSRUCBSYMLINK):
- $(RM) $@; $(SYMLINK) ../bin/$(PROG) $@
-
-clean:
- $(RM) $(OBJS)
-
-clobber: clean
- -$(RM) $(PROG) $(CLOBBERFILES)
-
-strip:
- $(STRIP) $(PROG)
-
-lint:
- $(LINT.c) $(PROG).c $(LDLIBS)
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE b/usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE
deleted file mode 100644
index 522cd49165..0000000000
--- a/usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE
+++ /dev/null
@@ -1,32 +0,0 @@
-Copyright (c) 1983 Regents of the University of California.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- 3. All advertising materials mentioning features or use of this
- software must display the following acknowledgement:
- This product includes software developed by the University
- of California, Berkeley and its contributors.
- 4. Neither the name of the University nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE.descrip b/usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE.descrip
deleted file mode 100644
index a0ae5f87c7..0000000000
--- a/usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE.descrip
+++ /dev/null
@@ -1 +0,0 @@
-PORTIONS OF LPTEST COMMAND FUNCTIONALITY
diff --git a/usr/src/cmd/lp/cmd/lptest/lptest.c b/usr/src/cmd/lp/cmd/lptest/lptest.c
deleted file mode 100644
index 9e5ff775e7..0000000000
--- a/usr/src/cmd/lp/cmd/lptest/lptest.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * lptest -- line printer test program (and other devices).
- */
-
-#include <stdio.h>
-
-int
-main(int argc, char **argv)
-{
- int len, count;
- register int i, j, fc, nc;
- char outbuf[BUFSIZ];
-
- setbuf(stdout, outbuf);
- if (argc >= 2)
- len = atoi(argv[1]);
- else
- len = 79;
- if (argc >= 3)
- count = atoi(argv[2]);
- else
- count = 200;
- fc = ' ';
- for (i = 0; i < count; i++) {
- if (++fc == 0177)
- fc = ' ';
- nc = fc;
- for (j = 0; j < len; j++) {
- putchar(nc);
- if (++nc == 0177)
- nc = ' ';
- }
- putchar('\n');
- }
- (void) fflush(stdout);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/cmd/lpusers.c b/usr/src/cmd/lp/cmd/lpusers.c
deleted file mode 100644
index b862e788ac..0000000000
--- a/usr/src/cmd/lp/cmd/lpusers.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/* lpusers [-q priority-level] -u (user-list | "")
- lpusers -d priority-level
- lpusers -l
-*/
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <locale.h>
-
-#include "lp.h"
-#include "users.h"
-#include "msgs.h"
-
-#define WHO_AM_I I_AM_LPUSERS
-#include "oam.h"
-
-char message[100],
- reply[100];
-
-char *PRIORITY;
-
-int add_user(), del_user();
-
-int
-main(int argc, char *argv[])
-{
- int mtype, size, c,
- list = FALSE, limit = -1, deflt = -1;
- int fd;
- char *userlist = 0, *user, **users, *p;
- char stroptsw[] = "-X";
- short status;
- struct user_priority *ppri_tbl, *ld_priority_file();
- extern char *optarg;
- extern int optind, opterr, optopt, errno;
-
- setlocale(LC_ALL, "");
-
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
-
- if(argc == 1) {
-usage:
- (void) printf(gettext("usage: \n"));
- (void) printf(gettext("(assign priority limit to users)\n"));
- (void) printf(gettext("\tlpusers -q priority -u user-list\n"));
-
- (void) printf(gettext(
- "(assign default priority limit for balance of users)\n"));
- (void) printf(gettext("\tlpusers -q priority\n"));
-
- (void) printf(gettext("(put users back to default priority limit)\n"));
- (void) printf(gettext("\tlpusers -u user-list\n"));
-
- (void) printf(gettext("(assign default priority)\n"));
- (void) printf(gettext("\tlpusers -d priority\n"));
-
- (void) printf(gettext("(examine priority limits, defaults)\n"));
- (void) printf(gettext("\tlpusers -l\n"));
-
- exit(argc == 1);
- }
-
- opterr = 0; /* disable printing of errors by getopt */
- while ((c = getopt(argc, argv, "ld:q:u:")) != -1)
- switch(c) {
- case 'l':
- if (list)
- LP_ERRMSG1(WARNING, E_LP_2MANY, 'l');
- list = TRUE;
- break;
- case 'd':
- if (deflt != -1)
- LP_ERRMSG1(WARNING, E_LP_2MANY, 'd');
- deflt = (int)strtol(optarg,&p,10);
- if (*p || deflt<PRI_MIN || deflt>PRI_MAX) {
- LP_ERRMSG1(ERROR, E_LP_BADPRI, optarg);
- exit(1);
- }
- break;
- case 'q':
- if (limit != -1)
- LP_ERRMSG1(WARNING, E_LP_2MANY, 'q');
- limit = (int)strtol(optarg,&p,10);
- if (*p || limit<PRI_MIN || limit>PRI_MAX) {
- LP_ERRMSG1(ERROR, E_LP_BADPRI, optarg);
- exit(1);
- }
- break;
- case 'u':
- if (userlist)
- LP_ERRMSG1(WARNING, E_LP_2MANY, 'u');
- userlist = optarg;
- break;
- case '?':
- if (optopt == '?')
- goto usage;
- stroptsw[1] = optopt;
- if (strchr("ldqu", optopt))
- LP_ERRMSG1(ERROR, E_LP_OPTARG, stroptsw);
- else
- LP_ERRMSG1(ERROR, E_LP_OPTION, stroptsw);
- exit(1);
- }
-
- if (optind < argc) {
- LP_ERRMSG1(ERROR, E_LP_EXTRA, argv[optind]);
- exit(1);
- }
-
- if (((list || deflt != -1) && (limit != -1 || userlist))
- || (list && deflt != -1)) {
- LP_ERRMSG(ERROR, E_LP_OPTCOMB);
- /* invalid combination of options */
- exit(1);
- }
-
- PRIORITY = Lp_Users;
-
- /* load existing priorities from file */
- if (!(ppri_tbl = ld_priority_file(PRIORITY))) {
- switch (errno) {
- case EBADF:
- LP_ERRMSG1(ERROR, E_LPU_BADFORM, PRIORITY);
- break;
- default:
- LP_ERRMSG2(ERROR, E_LPU_BADFILE, PRIORITY, errno);
- }
- exit(1);
- }
-
- if (list) {
- print_tbl(ppri_tbl);
- exit (0);
- } else {
- if (userlist) {
- users = getlist(userlist, " \t", ",");
- if (users)
- while (user = *users++) {
- if (del_user(ppri_tbl, user) && (limit == -1))
- LP_ERRMSG1(WARNING, E_LPU_NOUSER, user);
- if (limit != -1) {
- if (add_user(ppri_tbl, user, limit))
- LP_ERRMSG1(WARNING, E_LPU_BADU, user);
- }
- }
- } else if (deflt != -1)
- ppri_tbl->deflt = deflt;
- else
- ppri_tbl->deflt_limit = limit;
-
- if ((fd = open_locked(PRIORITY, "w", LPU_MODE)) < 0) {
- LP_ERRMSG1(ERROR, E_LP_ACCESS, PRIORITY);
- exit(1);
- }
- output_tbl(fd, ppri_tbl);
- close(fd);
- }
-
- if (mopen()) /* error on mopen == no spooler, exit quietly */
- exit(0);
-
- (void)putmessage (message, S_LOAD_USER_FILE);
-
- if (msend(message))
- goto Error;
- if (mrecv(reply, sizeof(reply)) == -1)
- goto Error;
- mtype = getmessage(reply, R_LOAD_USER_FILE, &status);
- if (mtype != R_LOAD_USER_FILE) {
- LP_ERRMSG1 (ERROR, E_LP_BADREPLY, mtype);
- goto NoError;
- }
-
- if (status == 0)
- goto NoError;
-
-Error: LP_ERRMSG (ERROR, E_LPU_NOLOAD);
-
-NoError:(void)mclose ();
- return (0);
-}
diff --git a/usr/src/cmd/lp/cmd/scripts/Makefile b/usr/src/cmd/lp/cmd/scripts/Makefile
deleted file mode 100644
index a564e47a62..0000000000
--- a/usr/src/cmd/lp/cmd/scripts/Makefile
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/cmd/scripts/Makefile
-#
-
-
-include $(SRC)/cmd/Makefile.cmd
-
-USRSBINPROG = lpshut
-ROOTUSRSBINPROG= $(USRSBINPROG:%=$(ROOTUSRSBIN)/%)
-$(ROOTUSRSBINPROG) := FILEMODE=555
-
-LIBPROG = lpsched
-ROOTLIBPROG= $(LIBPROG:%=$(ROOTLIB)/%)
-$(ROOTLIBPROG) := FILEMODE=555
-
-MSGFILES= lpsched lpshut
-POFILE= lpschedlpshut.po
-
-LIBLINKS = lpshut
-ROOTSYMLINKS= $(LIBLINKS:%=$(ROOTLIB)/%)
-
-.KEEP_STATE:
-
-all: $(USRSBINPROG) $(LIBPROG)
-
-install: $(ROOTUSRSBINPROG) $(ROOTLIBPROG) $(ROOTSYMLINKS)
-
-catalog: $(POFILE)
- $(CP) $(POFILE) ..
-
-_msg: $(POFILE)
-
-$(POFILE): $(MSGFILES)
- grep gettext $(MSGFILES) | tr '`' ' ' | sed -e "s/gettext \"/gettext \(\"/" | sed -e "s/$$/);/" > $(POFILE).i
- $(XGETTEXT) -s $(POFILE).i
- $(RM) $@ $(POFILE).i
- mv messages.po $(POFILE)
-
-#
-# Create a message file to test with
-#
-_msg_test:
- grep gettext $(MSGFILES) | tr '`' ' ' | sed -e "s/gettext \"/gettext \(\"/" | sed -e "s/$$/);/" > $(POFILE).i
- $(XGETTEXT) -s -m "xxx" $(POFILE).i
- $(RM) $@ $(POFILE).i
- mv messages.po $(POFILE)
-
-clean:
- $(RM) $(POFILE)
-
-clobber: clean
-
-$(ROOTSYMLINKS):
- $(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
diff --git a/usr/src/cmd/lp/cmd/scripts/lpsched b/usr/src/cmd/lp/cmd/scripts/lpsched
deleted file mode 100644
index bc30036f65..0000000000
--- a/usr/src/cmd/lp/cmd/scripts/lpsched
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
- [ -f /usr/lib/lp/local/lpsched ] || exit 1
-
-# Get command line options and set them in print service
-# -f num_filters
-# -n num_notifiers
-# -p fd_limit
-# -r reserved_fds
-
-# Check to see if lpsched is already running
-
-state=`svcprop -p restarter/state svc:/application/print/server:default`
-if [ "$state" = "online" ] ; then
- /bin/gettext "Print services already active.\n"
- exit 1
-fi
-
-OPTS=$*
-
-# no options set
-
-if [ "$OPTS" = "" ] ; then
- /usr/sbin/svcadm enable -t svc:/application/print/server:default
- if [ $? = 0 ] ; then
- /bin/gettext "Print services started.\n"
- exit 0
- else
- exit 1
- fi
-
-else
-
-# Get and set the options
-
- /usr/sbin/svccfg <<-EOF 2>/dev/null
- select svc:/application/print/server:default
- addpg cmd_opts count P
-
- EOF
-
-num_filters=0
-num_notifiers=0
-fd_limit=0
-reserved_fds=0
-
-while getopts :f:n:p:r: arg; do
- case $arg in
- f)
- num_filters=$OPTARG
-
- /usr/sbin/svccfg <<-EOF 2>/dev/null
- select svc:/application/print/server:default
- setprop cmd_opts/num_filters = count: ${num_filters}
-
- EOF
-
- ;;
-
- n)
- num_notifiers=$OPTARG
-
- /usr/sbin/svccfg <<-EOF 2>/dev/null
- select svc:/application/print/server:default
- setprop cmd_opts/num_notifiers = count: ${num_notifiers}
-
- EOF
-
- ;;
-
- p)
- fd_limit=$OPTARG
-
- /usr/sbin/svccfg <<-EOF 2>/dev/null
- select svc:/application/print/server:default
- setprop cmd_opts/fd_limit = count: ${fd_limit}
-
- EOF
-
- ;;
-
- r)
- reserved_fds=$OPTARG
-
- /usr/sbin/svccfg <<-EOF 2>/dev/null
- select svc:/application/print/server:default
- setprop cmd_opts/reserved_fds = count: ${reserved_fds}
-
- EOF
-
- ;;
-
- *) echo "Invalid flag -$OPTARG. Exiting"
- exit 1
- esac
-done
-
- /usr/sbin/svcadm enable -t svc:/application/print/server:default
- if [ $? = 0 ] ; then
- /bin/gettext "Print services started.\n"
- exit 0
- else
- exit 1
- fi
-
-fi
-
diff --git a/usr/src/cmd/lp/cmd/scripts/lpshut b/usr/src/cmd/lp/cmd/scripts/lpshut
deleted file mode 100644
index aff2761852..0000000000
--- a/usr/src/cmd/lp/cmd/scripts/lpshut
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/sbin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-
- state=`svcprop -p restarter/state svc:/application/print/server:default`
- if [ "$state" != "online" ] ; then
- gettext "Print services already stopped.\n"
- exit 1
- fi
-
- /usr/sbin/svcadm disable -t svc:/application/print/server:default
- if [ $? != 0 ] ; then
- exit 1
- else
- gettext "Print services stopped.\n"
- fi
-exit 0
diff --git a/usr/src/cmd/lp/crontab/lp b/usr/src/cmd/lp/crontab/lp
deleted file mode 100644
index 610cf71a44..0000000000
--- a/usr/src/cmd/lp/crontab/lp
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# At 03:13am on Sundays:
-# Move a weeks worth of 'requests' to 'requests.1'.
-# If there was a 'requests.1' move it to 'requests.2'.
-# If there was a 'requests.2' then it is lost.
-#
-13 3 * * 0 cd /var/lp/logs; if [ -f requests ]; then if [ -f requests.1 ]; then /bin/mv requests.1 requests.2; fi; /usr/bin/cp requests requests.1; >requests; fi
-#
-# Rotating of the "lpsched" log files is handled by logadm(1M).
-#
diff --git a/usr/src/cmd/lp/filter/Makefile b/usr/src/cmd/lp/filter/Makefile
deleted file mode 100644
index bb86e4fde4..0000000000
--- a/usr/src/cmd/lp/filter/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/Makefile
-#
-
-include ../Makefile.lp
-
-ROOTLIBLPBIN = $(ROOTLIBLP)/bin
-
-SUBDIRS = postscript
-
-
-PROG = slow.filter
-
-ROOTLIBLPBINPROG = $(PROG:%=$(ROOTLIBLPBIN)/%)
-
-.KEEP_STATE :
-
-all : $(PROG) $(SUBDIRS)
-
-install : $(PROG) $(ROOTLIBLPBINPROG) $(SUBDIRS)
-
-$(ROOTLIBLPBIN)/% : %
- $(INS.file)
-
-clean clobber strip lint catalog: $(SUBDIRS)
-
-$(SUBDIRS) : FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC :
diff --git a/usr/src/cmd/lp/filter/postscript/Makefile.msg b/usr/src/cmd/lp/filter/postscript/Makefile.msg
deleted file mode 100644
index 5a978d7830..0000000000
--- a/usr/src/cmd/lp/filter/postscript/Makefile.msg
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/Makefile.msg
-
-POFILES = $(SRCS:%.c=%.po)
-
-include ../../../Makefile.lp.msg
-
-catalog: $(POFILE)
- $(CP) $(POFILE) ../../..
diff --git a/usr/src/cmd/lp/filter/postscript/README b/usr/src/cmd/lp/filter/postscript/README
deleted file mode 100644
index 76de6f8678..0000000000
--- a/usr/src/cmd/lp/filter/postscript/README
+++ /dev/null
@@ -1,306 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Version 3.15 source code for a few programs that can be used with PostScript
-printers. Most of the important changes are described in the VERSION file. The
-main Makefile is also slightly different so take a look at the next section or,
-equivalently, check the comments at the beginning of Makefile before you build
-or install the programs.
-
-If you change LIBDIR or FONTDIR (in Makefile) make the corresponding changes to
-the pathnames defined in common/path.h before compiling the programs. If you're
-on a UTS system compile the programs with the native compiler! The new postreverse
-is backwards compatible, but output from the new translators should not be passed
-through old versions of postreverse. The likely result in that case will be no
-output at all. ENCODING (in Makefile) controls how dpost encodes lines of text.
-By setting ENCODING to 2 I've selected the fast, but not thoroughly tested method
-that usually results in a 20% improvement in throughput. If you have problems
-set ENCODING to 0 and recompile dpost. That results in a default version of dpost
-that produces output essentially identical to earlier versions. The -R, -B, and
--q options usually result in better performance from postio. Take a look at the
-man page or file postio/README if you want to change the default.
-
-There are potential conflicts with earlier versions, so I strongly recommend you
-install the new code on all your systems at about the same time. The new version
-of postreverse is safe and should be included if any new translators are installed.
-The important files that get replaced on a complete install are:
-
- /usr/lib/postscript/* ie. $(LIBDIR)/* in Makefile
- /usr/lbin/postscript/* ie. $(BINDIR)/* in Makefile
- /usr/lib/macros/pictures ie. $(MACRODIR)/pictures in Makefile
- /usr/lib/macros/color ie. $(MACRODIR)/color in Makefile
- /usr/lib/font/devpost/* ie. $(FONTDIR)/devpost/* in Makefile
- /usr/lib/font/PDQ/devpost/* ie. $(FONTDIR)/PDQ/devpost/* in Makefile
- /usr/bin/dpost only if it's already there
-
-The final pathnames depend on the values assigned to LIBDIR, BINDIR, MACRODIR,
-FONTDIR, MANDIR, and ROOT in Makefile. When Makefile is ready type,
-
- make all
-
-to build (but not install) everything or,
-
- make install
-
-to build and install the entire package, although you'll probably have to be root
-before the install will work. If you're just interested in part of the package
-(eg. installing dpost and the font files) type,
-
- make TARGETS="dpost font" install
-
-There are makefiles in most of the subdirectories, but they're not designed to
-be used on their own, especially not if you're installing things. Each needs
-many of the definitions made in Makefile before they're guaranteed to work. As
-long as you run make in this directory using Makefile you won't have to worry
-about any other changes or additions. The appropriate definitions will be exported
-before any of the other makefiles are used.
-
-There's a long list of people who have made significant contributions to this
-package. Included in that list are Richard Flood, Chris Warth, Guy Riddle, Paul
-Glick, Allan Wilks, Rick Becker, Johnathan Shopiro, Alan Buckwalter, Chi Choy,
-Carmela L'Hommedieu, and Maryann Csaszar. Many thanks to all of them and anyone
-else I (unintentionally) omitted.
-
-----------------------
-
-There's not much you'll need to change, but you may not agree with some of my
-choices, so before you do anything else, check the following definitions in
-Makefile:
-
-
- ENCODING - An integer (0, 1, 2 or 3) that sets the default text encoding
- scheme used by dpost. Increasing ENCODING (up to 3) decreases
- print time and the size of output files produced by dpost. 0 is
- slow, but the most stable choice and produces output essentially
- equivalent to previous versions of dpost. 2 and 3 are encoding
- schemes based on widthshow. Both are fast, perhaps 20% faster
- than the 0 level scheme, but neither is well tested. Setting
- encoding to 3 is not recommended, and will result in ragged right
- margins. The encoding scheme can also be set at run time using
- the -e option. Setting ENCODING to 2 may be worth a try.
-
- ROOT - A string that's prepended to all the installation directories
- (eg. BINDIR). Only used when things are installed, and probably
- won't be of much use to anyone.
-
- BINDIR - Where programs, like dpost and postprint, are installed. You may
- want to change this definition. Things are set up so the programs
- get put in a directory that's probably not in anyone's PATH.
-
- FONTDIR - Where the binary font files go. Should be set to troff's font
- directory on your system. If you change it do the same thing to
- the definition of FONTDIR in ./common/path.h.
-
- LIBDIR - All the files from directory ./postscript that end in .ps (plus
- a few others) get put here. Mostly prologues for translators. If
- you change it fix the corresponding paths in ./common/path.h
- before doing a compile.
-
- MANDIR - Where the manual pages are installed. This one is undoubtedly
- wrong!
-
- MACRODIR - Macro packages get installed here. The ones I've included handle
- picture inclusion and color selection.
-
- OWNER - Owner of any files that are installed.
-
- GROUP - The group that's assigned to all installed files.
-
- SYSTEM - The version of Unix you're running. Recognized choices are,
-
- SYSV - System V
- V9 - Ninth Edition
- BSD4_2 - Berkeley
-
- Primarily for conditional compilation in postio.
-
- CFLAGS - Some of the programs use floating point arithmetic, so if you're
- running on a system without floating point hardware add the -f
- option before compiling the programs.
-
- LIST - The command that's run to produce a source listing. Not terribly
- important, but the default will only be right on MHCC systems.
-
- TARGETS - The default group of things (ie. source directories) that make
- operates on when you select targets like install or clobber.
-
- DKHOSTDIR - If your system has DKHOST software this is where it should be.
- Used for conditional compilation in postio, and only if SYSTEM
- is set to SYSV. Needed so dk.h and libdk.a are picked up. To
- disable the DKHOST stuff just remove this definition.
-
- DOCDIR - Documentation about the picture drawing macro gets put in this
- directory. Includes a short paper and the associated PostScript
- files that describe how to use the macros and submit jobs on
- MHCC systems. It's undoubtedly not right for your system and
- won't be installed unless you add docs to the TARGET list. If
- you're going to install the documentation you'll undoubtedly
- have to edit docs/pictures. All the .BP calls will have to
- reflect the new DOCDIR directory, and the command line used to
- submit jobs will have to change.
-
-----------------------
-
-Brief descriptions of the programs and source directories follow. Check the man
-pages for more detailed information about the programs.
-
-postio
- A program that can be used to send files to PostScript printers over an
- RS-232 serial line. If you're on System V, have the DKHOST software
- package, and request a line that doesn't begin a / postio may treat it
- as a Datakit destination. The new version of postio can run as a single
- process or as separate read and write processes, and can also be used to
- establish an interactive connection to the printer. Check the man page
- for more details.
-
- EXAMPLES:
-
- A typical command line would look like,
-
- postio -l /dev/tty?? file.ps
-
- If your printer is running at something other than 9600 baud (eg.
- 19200) use the -b option to select the appropriate speed,
-
- postio -l /dev/tty?? -b19200 file.ps
-
- Adding the -R2 option to to either of the command lines would force
- postio to run as separate read and write processes.
-
-dpost
- Translates output produced by the device independent troff into PostScript.
- The default font files (in /usr/lib/font/devpost) assume a resolution of
- 720, which isn't expected to match your printer's resolution.
-
- EXAMPLE:
-
- A typical command line (assuming you have up to date versions of eqn
- and pic) would be,
-
- pic file | tbl | eqn | troff -mm -Tpost | dpost >file.ps
-
- If old versions of eqn and pic are installed try,
-
- pic -T720 | tbl | eqn -r720 | troff -mm -Tpost | dpost >file.ps
-
-postprint
- Translates ASCII files into PostScript.
-
- EXAMPLE:
-
- pr -n file | postprint >file.ps
-
-postreverse
- A simple program that reverses pages in files that conform to Adobe's 1.0
- or 2.0 file structuring conventions. Can be used with all the translators
- in this package, even though the output from dpost often doesn't conform
- to either convention.
-
- EXAMPLE:
-
- postprint file | postreverse >file.ps
-
-buildtables
- A collection of programs and data files that can be used if you want to
- have a PostScript printer generate new troff width tables for printer or
- host resident fonts. All the ASCII width tables in ./font/devpost were
- built this way.
-
-common
- Common source and header files used when most of the programs are compiled.
- The only changes here may be to the pathnames defined in common/path.h.
- The definitions of LIBDIR and FONTDIR in Makefile must agree with what's
- in path.h.
-
-doc
- Additional documentation, that right now only includes a short paper that
- shows how to use the picture inclusion macros. What's supplied will not
- be right for all systems.
-
-font
- Font and device description files for many of the standard PostScript
- fonts. The ASCII files can be found in directory font/devpost, and are
- built assuming a device resolution of 720 dpi, which isn't expected to
- match your printer's actual resolution. All the fonts available on the
- LaserWriter Plus (and a few others) are supported, but all may not be
- available on your printer. Characters that troff uses but that aren't on
- PostScript fonts are built up using definitions in font/devpost/charlib.
-
- The mapping from troff's one or two character font names into PostScript
- font names is handled by the definitions made in postscript/dpost.ps. If
- you build a new font file put the ASCII version in directory font/devpost,
- add an appropriate definition to postscript/dpost.ps, and then build and
- install the new binary font file and prologue by typing,
-
- make TARGETS="postscript font" install
-
- Building new ASCII font files is described in more detail in font/README
- and buildtables/README. Files that you'll find in the buildtables source
- directory, once you understand what's there, let the printer generate
- the width tables for you.
-
-macros
- Stand-alone troff macro packages that currently support picture inclusion
- and color selection (also reverse video) and only work with dpost.
-
-man
- Manual pages for all the programs supplied with this package.
-
-misc
- Some interesting and perhaps useful programs obtained from various sources.
- All are unsupported! Included is an example lp interface program that came
- from Maryann Csaszar.
-
-postscript
- PostScript files, mostly prologues, used by the translators supplied in
- this package. All the files in this directory that end in .ps (and a few
- others) are copied to /usr/lib/postscript (ie. $(LIBDIR)) when you do an
- install.
-
-template
- Files that may help if you're writing a PostScript translator. The basic
- outline of the C code, the PostScript prologue, and the makefile has been
- included.
-
-tests
- Simple test files for all the PostScript translators supplied with this
- package.
-
-----------------------
-
-The new translators all attempt to conform to Adobe's Version 2.0 file structuring
-conventions. dpost falls short, but only because page independence is sacrificed
-for efficiency. None of the translators use their own dictionary, but perhaps the
-most glaring omission is the lack of a %%BoundingBox comment in output produced by
-most of the translators. Both are issues I hope to address in the next release.
-
-Changing the default behavior for dpost and postio isn't difficult. You get the
-fast (but not completely tested) version of dpost by setting ENCODING in Makefile
-to 2 before compiling dpost - which is what I've supplied. Speeding up the default
-version of postio requires more work, and isn't strongly recommended. The required
-changes (all simple fixes to the C code), are outlined in postio/README.
-
-
- Richard Drechsler
- MH 2F-241 x7442
- mhuxa!drexler
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/Makefile b/usr/src/cmd/lp/filter/postscript/common/Makefile
deleted file mode 100644
index 3ce1c25073..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/Makefile
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/common/Makefile
-#
-
-include ../../../Makefile.lp
-
-SRCS = glob.c misc.c request.c tempnam.c
-
-OBJS = $(SRCS:%.c=%.o)
-
-TXTS = README
-
-ENCODING= 2
-CPPFLAGS = -DDFLTENCODING=$(ENCODING) \
- -DSYSV \
- -I. \
- $(CPPFLAGS.master)
-
-POFILE = lp_filter_postscript_common.po
-
-.KEEP_STATE :
-
-all : $(TXTS) $(OBJS)
-
-install strip :
-
-clean :
- $(RM) $(OBJS)
-
-lint : lint_SRCS
-
-clobber: clean
- $(RM) $(CLOBBERFILES)
-
-lint_SRCS:
- $(LINT.c) $(SRCS)
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/filter/postscript/common/README b/usr/src/cmd/lp/filter/postscript/common/README
deleted file mode 100644
index 3ccb24a313..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/README
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Common header and source files used when you compile most of the programs in this
-package. Only required changes may be to the pathnames set in path.h. They must
-agree with the LIBDIR and FONTDIR definitions in ../Makefile.
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/comments.h b/usr/src/cmd/lp/filter/postscript/common/comments.h
deleted file mode 100644
index b2cbfbca2a..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/comments.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- *
- * Currently defined file structuring comments from Adobe - plus a few others.
- * Ones that end with a colon expect arguments, while those ending with a newline
- * stand on their own. Truly overkill on Adobe's part and mine for including them
- * all!
- *
- * All PostScript files should begin with a header that starts with one of the
- * following comments.
- *
- */
-
-#define NONCONFORMING "%!PS\n"
-#define MINCONFORMING "%!PS-Adobe-\n"
-#define OLDCONFORMING "%!PS-Adobe-1.0\n"
-
-#define CONFORMING "%!PS-Adobe-2.0\n"
-#define CONFORMINGEPS "%!PS-Adobe-2.0 EPS\n"
-#define CONFORMINGQUERY "%!PS-Adobe-2.0 Query\n"
-#define CONFORMINGEXITSERVER "%!PS-Adobe-2.0 ExitServer\n"
-
-/*
- *
- * Header comments - immediately follow the appropriate document classification
- * comment.
- *
- */
-
-#define TITLE "%%Title:"
-#define CREATOR "%%Creator:"
-#define CREATIONDATE "%%CreationDate:"
-#define FOR "%%For:"
-#define ROUTING "%%Routing:"
-#define BOUNDINGBOX "%%BoundingBox:"
-#define PAGES "%%Pages:"
-#define REQUIREMENTS "%%Requirements:"
-
-#define DOCUMENTFONTS "%%DocumentFonts:"
-#define DOCUMENTNEEDEDFONTS "%%DocumentNeededFonts:"
-#define DOCUMENTSUPPLIEDFONTS "%%DocumentSuppliedFonts:"
-#define DOCUMENTNEEDEDPROCSETS "%%DocumentNeededProcSets:"
-#define DOCUMENTSUPPLIEDPROCSETS "%%DocumentSuppliedProcSets:"
-#define DOCUMENTNEEDEDFILES "%%DocumentNeededFiles:"
-#define DOCUMENTSUPPLIEDFILES "%%DocumentSuppliedFiles:"
-#define DOCUMENTPAPERSIZES "%%DocumentPaperSizes:"
-#define DOCUMENTPAPERFORMS "%%DocumentPaperForms:"
-#define DOCUMENTPAPERCOLORS "%%DocumentPaperColors:"
-#define DOCUMENTPAPERWEIGHTS "%%DocumentPaperWeights:"
-#define DOCUMENTPRINTERREQUIRED "%%DocumentPrinterREquired:"
-#define ENDCOMMENTS "%%EndComments\n"
-#define ENDPROLOG "%%EndProlog\n"
-
-/*
- *
- * Body comments - can appear anywhere in a document.
- *
- */
-
-#define BEGINSETUP "%%BeginSetup\n"
-#define ENDSETUP "%%EndSetup\n"
-#define BEGINDOCUMENT "%%BeginDocument:"
-#define ENDDOCUMENT "%%EndDocument\n"
-#define BEGINFILE "%%BeginFile:"
-#define ENDFILE "%%EndFile\n"
-#define BEGINPROCSET "%%BeginProcSet:"
-#define ENDPROCSET "%%EndProcSet\n"
-#define BEGINBINARY "%%BeginBinary:"
-#define ENDBINARY "%%EndBinary\n"
-#define BEGINPAPERSIZE "%%BeginePaperSize:"
-#define ENDPAPERSIZE "%%EndPaperSize\n"
-#define BEGINFEATURE "%%BeginFeature:"
-#define ENDFEATURE "%%EndFeature\n"
-#define BEGINEXITSERVER "%%BeginExitServer:"
-#define ENDEXITSERVER "%%EndExitServer\n"
-#define TRAILER "%%Trailer\n"
-
-/*
- *
- * Page level comments - usually will occur once per page.
- *
- */
-
-#define PAGE "%%Page:"
-#define PAGEFONTS "%%PageFonts:"
-#define PAGEFILES "%%PageFiles:"
-#define PAGEBOUNDINGBOX "%%PageBoundingBox:"
-#define BEGINPAGESETUP "%%BeginPageSetup\n"
-#define BEGINOBJECT "%%BeginObject:"
-#define ENDOBJECT "%%EndObject\n"
-
-/*
- *
- * Resource requirements - again can appear anywhere in a document.
- *
- */
-
-#define INCLUDEFONT "%%IncludeFont:"
-#define INCLUDEPROCSET "%%IncludeProcSet:"
-#define INCLUDEFILE "%%IncludeFile:"
-#define EXECUTEFILE "%%ExecuteFile:"
-#define CHANGEFONT "%%ChangeFont:"
-#define PAPERFORM "%%PaparForm:"
-#define PAPERCOLOR "%%PaperColor:"
-#define PAPERWEIGHT "%%PaperWeight:"
-#define PAPERSIZE "%%PaperSize:"
-#define FEATURE "%%Feature:"
-#define ENDOFFILE "%%EOF\n"
-
-#define CONTINUECOMMENT "%%+"
-#define ATEND "(atend)"
-
-/*
- *
- * Some non-standard document comments. Global definitions are occasionally used
- * in dpost and are marked by BEGINGLOBAL and ENDGLOBAL. The resulting document
- * violates page independence, but can easily be converted to a conforming file
- * using a utililty program.
- *
- */
-
-#define BEGINSCRIPT "%%BeginScript\n"
-#define BEGINGLOBAL "%%BeginGlobal\n"
-#define ENDGLOBAL "%%EndGlobal\n"
-#define ENDPAGE "%%EndPage:"
-#define FORMSPERPAGE "%%FormsPerPage:"
-#define VERSION "%%Version:"
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/dev.h b/usr/src/cmd/lp/filter/postscript/common/dev.h
deleted file mode 100644
index 082156991f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/dev.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * University Copyright- Copyright (c) 1982, 1986, 1988
- * The Regents of the University of California
- * All Rights Reserved
- *
- * University Acknowledgment- Portions of this document are derived from
- * software developed by the University of California, Berkeley, and its
- * contributors.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- dev.h: characteristics of a typesetter
-*/
-
-struct dev {
- unsigned short filesize; /* number of bytes in file, */
- /* excluding dev part */
- short res; /* basic resolution in goobies/inch */
- short hor; /* goobies horizontally */
- short vert;
- short unitwidth; /* size at which widths are given, in effect */
- short nfonts; /* number of fonts physically available */
- short nsizes; /* number of sizes it has */
- short sizescale; /* scaling for fractional point sizes */
- short paperwidth; /* max line length in units */
- short paperlength; /* max paper length in units */
- short nchtab; /* number of funny names in chtab */
- short lchname; /* length of chname table */
- short biggestfont; /* #chars in largest ever font */
- short spare2; /* in case of expansion */
-};
-
-struct Font { /* characteristics of a font */
- char nwfont; /* number of width entries for this font */
- char specfont; /* 1 == special font */
- char ligfont; /* 1 == ligatures exist on this font */
- char spare1; /* unused for now */
- char namefont[10]; /* name of this font (e.g., "R" */
- char intname[10]; /* internal name (=number) on device, in ascii */
-};
-
-/* ligatures, ORed into ligfont */
-
-#define LFF 01
-#define LFI 02
-#define LFL 04
-#define LFFI 010
-#define LFFL 020
diff --git a/usr/src/cmd/lp/filter/postscript/common/ext.h b/usr/src/cmd/lp/filter/postscript/common/ext.h
deleted file mode 100644
index fd17b8f0b9..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/ext.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- *
- * External varible declarations - many are defined in glob.c.
- *
- */
-
-
-extern char **argv; /* global so everyone can use them */
-extern int argc;
-
-extern int x_stat; /* program exit status */
-extern int debug; /* debug flag */
-extern int ignore; /* what we do with FATAL errors */
-
-extern long lineno; /* line number */
-extern long position; /* byte position */
-extern char *prog_name; /* and program name - for errors */
-extern char *temp_file; /* temporary file - for some programs */
-
-
-extern char *optarg; /* for getopt() */
-extern int optind;
-
-extern char *malloc();
-extern char *calloc();
-extern char *tempnam();
-extern char *strtok();
-extern long ftell();
-extern double atof();
-extern double sqrt();
-extern double atan2();
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/gen.h b/usr/src/cmd/lp/filter/postscript/common/gen.h
deleted file mode 100644
index c29fd7e7d1..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/gen.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- *
- * A few definitions that shouldn't have to change. They're used by most of the
- * programs in this package.
- *
- */
-
-
-#define PROGRAMVERSION "3.15"
-
-
-#define NON_FATAL 0
-#define FATAL 1
-#define USER_FATAL 2
-
-#define OFF 0
-#define ON 1
-
-#define FALSE 0
-#define TRUE 1
-
-#define BYTE 8
-#define BMASK 0377
-
-#define POINTS 72.3
-
-#ifndef PI
-#define PI 3.141592654
-#endif
-
-
-/*
- *
- * A few simple macros.
- *
- */
-
-
-#define ABS(A) ((A) >= 0 ? (A) : -(A))
-#define MIN(A, B) ((A) < (B) ? (A) : (B))
-#define MAX(A, B) ((A) > (B) ? (A) : (B))
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/glob.c b/usr/src/cmd/lp/filter/postscript/common/glob.c
deleted file mode 100644
index 4fa8962729..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/glob.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- *
- * Definition and initialization of some global variables.
- *
- */
-
-
-#include <stdio.h>
-#include "gen.h" /* general purpose definitions */
-
-
-char **argv; /* global so everyone can use them */
-int argc;
-
-int x_stat = 0; /* program exit status */
-int debug = OFF; /* debug flag */
-int ignore = OFF; /* what we do with FATAL errors */
-
-long lineno = 0; /* line number */
-long position = 0; /* byte position */
-char *prog_name = ""; /* and program name - for errors */
-char *temp_file = NULL; /* temporary file - for some programs */
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/misc.c b/usr/src/cmd/lp/filter/postscript/common/misc.c
deleted file mode 100644
index 377828109b..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/misc.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * A few general purpose routines.
- *
- */
-
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <fcntl.h>
-
-#include "gen.h" /* a few general purpose definitions */
-#include "ext.h" /* external variable declarations */
-
-
-int nolist = 0; /* number of specified ranges */
-int olist[50]; /* processing range pairs */
-
-
-
-void
-error(int kind, char *mesg, ...)
-{
-
-
-/*
- *
- * Called when we've run into some kind of program error. *mesg is printed using
- * the control string arguments a?. We'll quit if we're not ignoring errors and
- * kind is FATAL.
- *
- */
-
-
- if ( mesg != NULL && *mesg != '\0' ) {
- va_list ap;
-
- fprintf(stderr, "%s: ", prog_name);
- va_start(ap, mesg);
- vfprintf(stderr, mesg, ap);
- va_end(ap);
- if ( lineno > 0 )
- fprintf(stderr, " (line %d)", lineno);
- if ( position > 0 )
- fprintf(stderr, " (near byte %d)", position);
- putc('\n', stderr);
- } /* End if */
-
- if ( kind == FATAL && ignore == OFF ) {
- if ( temp_file != NULL )
- unlink(temp_file);
- exit(x_stat | 01);
- } /* End if */
-
-} /* End of error */
-
-
-/*****************************************************************************/
-
-/*****************************************************************************/
-
-
-void
-out_list(str)
-
-
- char *str; /* process ranges in this string */
-
-
-{
-
-
- int start, stop; /* end points */
-
-
-/*
- *
- * Called to get the processing ranges that were specified by using the -o option.
- * The range syntax should be identical to the one used in nroff and troff.
- *
- */
-
-
- while ( *str && nolist < sizeof(olist) - 2 ) {
- start = stop = str_convert(&str, 0);
-
- if ( *str == '-' && *str++ )
- stop = str_convert(&str, 9999);
-
- if ( start > stop )
- error(FATAL, "illegal range %d-%d", start, stop);
-
- olist[nolist++] = start;
- olist[nolist++] = stop;
-
- if ( *str != '\0' ) str++;
-
- } /* End while */
-
- olist[nolist] = 0;
-
-} /* End of out_list */
-
-
-/*****************************************************************************/
-
-
-int
-in_olist(num)
-
-
- int num; /* should we print this page? */
-
-
-{
-
-
- int i; /* just a loop index */
-
-
-/*
- *
- * Returns ON if num represents a page that we're supposed to print. If no ranges
- * were selected nolist will be 0 and we'll print everything.
- *
- */
-
-
- if ( nolist == 0 ) /* everything's included */
- return(ON);
-
- for ( i = 0; i < nolist; i += 2 )
- if ( num >= olist[i] && num <= olist[i+1] )
- return(ON);
-
- return(OFF);
-
-} /* End of in_olist */
-
-
-/*****************************************************************************/
-
-
-int
-cat(file)
-
-
- char *file; /* copy this file to stdout */
-
-
-{
-
-
- int fd_in; /* for the input */
- int fd_out; /* and output files */
- char buf[512]; /* buffer for reads and writes */
- int count; /* number of bytes we just read */
-
-
-/*
- *
- * Copies *file to stdout - mostly for the prologue. Returns FALSE if there was a
- * problem and TRUE otherwise.
- *
- */
-
-
- fflush(stdout);
-
- if ( (fd_in = open(file, O_RDONLY)) == -1 )
- return(FALSE);
-
- fd_out = fileno(stdout);
- while ( (count = read(fd_in, buf, sizeof(buf))) > 0 )
- write(fd_out, buf, count);
-
- close(fd_in);
-
- return(TRUE);
-
-} /* End of cat */
-
-
-/*****************************************************************************/
-
-
-int
-str_convert(str, err)
-
-
- char **str; /* get next number from this string */
- int err; /* value returned on error */
-
-
-{
-
-
- int i; /* just a loop index */
-
-
-/*
- *
- * Gets the next integer from **str and returns its value to the caller. If **str
- * isn't an integer err is returned. *str is updated after each digit is processed.
- *
- */
-
-
- if ( ! isdigit(**str) ) /* something's wrong */
- return(err);
-
- for ( i = 0; isdigit(**str); *str += 1 )
- i = 10 * i + **str - '0';
-
- return(i);
-
-} /* End of str_convert */
-
-
-/*****************************************************************************/
-
-
-
-
-void interrupt(sig)
-
-
- int sig; /* signal that we caught */
-
-
-{
-
-
-/*
- *
- * Called when we get a signal that we're supposed to catch.
- *
- */
-
-
- if ( temp_file != NULL )
- unlink(temp_file);
-
- exit(1);
-
-} /* End of interrupt */
-
-
-/*****************************************************************************/
-
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/path.h b/usr/src/cmd/lp/filter/postscript/common/path.h
deleted file mode 100644
index d4cf2d12c5..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/path.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/*
- * pathname definitions for important files and directories.
- */
-
-
-#define DPOST "/usr/lib/lp/postscript/dpost.ps"
-#define POSTPRINT "/usr/lib/lp/postscript/postprint.ps"
-
-#define BASELINE "/usr/lib/lp/postscript/baseline.ps"
-#define COLOR "/usr/lib/lp/postscript/color.ps"
-#define DRAW "/usr/lib/lp/postscript/draw.ps"
-#define FORMFILE "/usr/lib/lp/postscript/forms.ps"
-#define KERNING "/usr/lib/lp/postscript/kerning.ps"
-#define REQUESTFILE "/usr/lib/lp/postscript/ps.requests"
-
-#define HOSTFONTDIR "/usr/share/lib/hostfontdir"
-#define FONTDIR "/usr/lib/font"
-#define TEMPDIR "/tmp"
diff --git a/usr/src/cmd/lp/filter/postscript/common/request.c b/usr/src/cmd/lp/filter/postscript/common/request.c
deleted file mode 100644
index b0b0050b9c..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/request.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * Things used to handle special requests (eg. manual feed) globally or on a per
- * page basis. Requests are passed through to the translator using the -R option.
- * The argument to -R can be "request", "request:page", or "request:page:file".
- * If page is omitted (as in the first form) or set to 0 request will be applied
- * to the global environment. In all other cases it applies only to the selected
- * page. If a file is given, page must be supplied, and the lookup is in that file
- * rather than *requestfile.
- *
- */
-
-
-#include <stdio.h>
-
-#include "gen.h" /* general purpose definitions */
-#include "request.h" /* a few special definitions */
-#include "path.h" /* for the default request file */
-
-
-Request request[MAXREQUEST]; /* next page or global request */
-int nextreq = 0; /* goes in request[nextreq] */
-char *requestfile = REQUESTFILE; /* default lookup file */
-
-void dumprequest(char *, char *, FILE *);
-
-/*****************************************************************************/
-
-
-void
-saverequest(char *want)
- /* grab code for this stuff */
-{
- char *page; /* and save it for this page */
- char *strtok();
-
-/*
- *
- * Save the request until we get to appropriate page - don't even bother with
- * the lookup right now. Format of *want string is "request", "request:page", or
- * "request:page:file", and we assume we can change the string here as needed.
- * If page is omitted or given as 0 the request will be done globally. If *want
- * includes a file, request and page must also be given, and in that case *file
- * will be used for the lookup.
- *
- */
-
-
- if ( nextreq < MAXREQUEST ) {
- request[nextreq].want = strtok(want, ": ");
- if ( (page = strtok(NULL, ": ")) == NULL )
- request[nextreq].page = 0;
- else request[nextreq].page = atoi(page);
- if ( (request[nextreq].file = strtok(NULL, ": ")) == NULL )
- request[nextreq].file = requestfile;
- nextreq++;
- } else error(NON_FATAL, "too many requests - ignoring %s", want);
-
-} /* End of saverequest */
-
-
-/*****************************************************************************/
-
-
-void
-writerequest(int page, FILE *fp_out)
- /* page - write everything for this page */
- /* fp_out - to this file */
-{
- int i; /* loop index */
-
-/*
- *
- * Writes out all the requests that have been saved for page. Page 0 refers to
- * the global environment and is done during initial setup.
- *
- */
-
-
- for ( i = 0; i < nextreq; i++ )
- if ( request[i].page == page )
- dumprequest(request[i].want, request[i].file, fp_out);
-
-} /* End of writerequest */
-
-
-/*****************************************************************************/
-
-
-void
-dumprequest(char *want, char *file, FILE *fp_out)
- /* want - look for this string */
- /* file - in this file */
- /* fp_out - and write the value out here */
-{
- char buf[100]; /* line buffer for reading *file */
- FILE *fp_in;
-
-/*
- *
- * Looks for *want in the request file and if it's found the associated value
- * is copied to the output file. Keywords (ie. the *want strings) begin an @ in
- * the first column of file, while the values (ie. the stuff that's copied to
- * the output file) starts on the next line and extends to the next keyword or
- * to the end of file.
- *
- */
-
-
- if ( (fp_in = fopen(file, "r")) != NULL ) {
- while ( fgets(buf, sizeof(buf), fp_in) != NULL )
- if ( buf[0] == '@' && strncmp(want, &buf[1], strlen(want)) == 0 )
- while ( fgets(buf, sizeof(buf), fp_in) != NULL )
- if ( buf[0] == '#' || buf[0] == '%' )
- continue;
- else if ( buf[0] != '@' )
- fprintf(fp_out, "%s", buf);
- else break;
- fclose(fp_in);
- } /* End if */
-
-} /* End of dumprequest */
-
-
-/*****************************************************************************/
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/request.h b/usr/src/cmd/lp/filter/postscript/common/request.h
deleted file mode 100644
index b5cdb2d0ea..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/request.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- *
- * Things used to handle special PostScript requests (like manual feed) globally
- * or on a per page basis. All the translators I've supplied accept the -R option
- * that can be used to insert special PostScript code before the global setup is
- * done, or at the start of named pages. The argument to the -R option is a string
- * that can be "request", "request:page", or "request:page:file". If page isn't
- * given (as in the first form) or if it's 0 in the last two, the request applies
- * to the global environment, otherwise request holds only for the named page.
- * If a file name is given a page number must be supplied, and in that case the
- * request will be looked up in that file.
- *
- */
-
-#define MAXREQUEST 30
-
-typedef struct {
-
- char *want;
- int page;
- char *file;
-
-} Request;
-
-
diff --git a/usr/src/cmd/lp/filter/postscript/common/tempnam.c b/usr/src/cmd/lp/filter/postscript/common/tempnam.c
deleted file mode 100644
index dfefe86c4b..0000000000
--- a/usr/src/cmd/lp/filter/postscript/common/tempnam.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#include <stdio.h>
-#include <errno.h>
-
-#if defined(V9) || defined(BSD4_2)
-char *tempnam(dir, pfx)
-char *dir, *pfx;
-{
- int pid;
- unsigned int len;
- char *tnm, *malloc();
- static int seq = 0;
-
- pid = getpid();
- len = strlen(dir) + strlen(pfx) + 10;
- if ((tnm = malloc(len)) != NULL) {
- sprintf(tnm, "%s", dir);
- if (access(tnm, 7) == -1)
- return(NULL);
- do {
- sprintf(tnm, "%s/%s%d%d", dir, pfx, pid, seq++);
- errno = 0;
- if (access(tnm, 7) == -1)
- if (errno == ENOENT)
- return(tnm);
- } while (1);
- }
- return(tnm);
-}
-#endif
diff --git a/usr/src/cmd/lp/filter/postscript/download/Makefile b/usr/src/cmd/lp/filter/postscript/download/Makefile
deleted file mode 100644
index b07b2223e4..0000000000
--- a/usr/src/cmd/lp/filter/postscript/download/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/download/Makefile
-#
-
-include ../../../Makefile.lp
-
-PROG= download
-
-SRCS = download.c
-
-OBJS = $(SRCS:%.c=%.o)
-
-COMMONDIR = ../common
-
-COMMONOBJS = $(COMMONDIR)/glob.o \
- $(COMMONDIR)/misc.o \
- $(COMMONDIR)/tempnam.o
-
-TXTS = README
-
-ENCODING = 2
-CPPFLAGS = -DDFLTENCODING=$(ENCODING) \
- -I. -I$(COMMONDIR) \
- $(CPPFLAGS.master)
-
-POFILE = lp_filter_postscript_download.po
-
-.KEEP_STATE:
-
-all: $(TXTS) $(PROG)
-
-install: all $(ROOTLIBLPPOSTPROG)
-
-$(PROG): $(OBJS) $(COMMONOBJS)
- $(LINK.c) -o $@ $(OBJS) $(COMMONOBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-$(COMMONOBJS): $$(@:%.o=%.c)
- cd $(@D); $(MAKE) $(@F)
-
-clean:
- $(RM) $(OBJS)
-
-strip:
- $(STRIP) $(PROG)
-
-lint: lint_PROG
-
-include ../../../../Makefile.targ
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/filter/postscript/download/README b/usr/src/cmd/lp/filter/postscript/download/README
deleted file mode 100644
index a57c4eaa85..0000000000
--- a/usr/src/cmd/lp/filter/postscript/download/README
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-A simple program that scans PostScript files for %%DocumentFonts: comments
-and prepends requested host resident font files to the input. The downloaded
-fonts are the ones named in the %%DocumentFonts: comment and listed in a
-special map file (which can be selected using the -m option). See example.map
-and the comments in downloader.c for examples of map files. By default map
-files and font files are in *hostfontdir. It's initialized using HOSTFONTDIR
-(file ../common/path.h) and can be changed on the command line using the
--m option.
-
diff --git a/usr/src/cmd/lp/filter/postscript/download/download.c b/usr/src/cmd/lp/filter/postscript/download/download.c
deleted file mode 100644
index 1960cd2887..0000000000
--- a/usr/src/cmd/lp/filter/postscript/download/download.c
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * download - host resident font downloader
- *
- * Prepends host resident fonts to PostScript input files. The program assumes
- * the input files are part of a single PostScript job and that requested fonts
- * can be downloaded at the start of each input file. Downloaded fonts are the
- * ones named in a %%DocumentFonts: comment and listed in a special map table.
- * Map table pathnames (supplied using the -m option) that begin with a / are
- * taken as is. Otherwise the final pathname is built using *hostfontdir (-H
- * option), *mapname (-m option), and *suffix.
- *
- * The map table consists of fontname-filename pairs, separated by white space.
- * Comments are introduced by % (as in PostScript) and extend to the end of the
- * current line. The only fonts that can be downloaded are the ones listed in
- * the active map table that point the program to a readable Unix file. A request
- * for an unlisted font or inaccessible file is ignored. All font requests are
- * ignored if the map table can't be read. In that case the program simply copies
- * the input files to stdout.
- *
- * An example (but not one to follow) of what can be in a map table is,
- *
- * %
- * % Map requests for Bookman-Light to file *hostfontdir/KR
- * %
- *
- * Bookman-Light KR % Keeping everything (including the map
- * % table) in *hostfontdir seems like the
- * % cleanest approach.
- *
- * %
- * % Map Palatino-Roman to file *hostfontdir/palatino/Roman
- * %
- * Palatino-Roman palatino/Roman
- *
- * % Map ZapfDingbats to file /usr/lib/host/dingbats
- *
- * ZapfDingbats /usr/lib/host/dingbats
- *
- * Once again, file names that begin with a / are taken as is. All others have
- * *hostfontdir/ prepended to the file string associated with a particular font.
- *
- * Map table can be associated with a printer model (e.g. a LaserWriter), a
- * printer destination, or whatever - the choice is up to an administrator.
- * By destination may be best if your spooler is running several private
- * printers. Host resident fonts are usually purchased under a license that
- * restricts their use to a limited number of printers. A font licensed for
- * a single printer should only be used on that printer.
- *
- * Was written quickly, so there's much room for improvement. Undoubtedly should
- * be a more general program (e.g. scan for other comments).
- *
- */
-
-#include <stdio.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "comments.h" /* PostScript file structuring comments */
-#include "gen.h" /* general purpose definitions */
-#include "path.h" /* for temporary directory */
-#include "ext.h" /* external variable declarations */
-#include "download.h" /* a few special definitions */
-
-char *temp_dir = TEMPDIR; /* temp directory - for copying stdin */
-char *hostfontdir = HOSTFONTDIR; /* host resident directory */
-char *mapname = "map"; /* map table - usually in *hostfontdir */
-char *suffix = ""; /* appended to the map table pathname */
-Map *map = NULL; /* device font map table */
-char *stringspace = NULL; /* for storing font and file strings */
-int next = 0; /* next free slot in map[] */
-
-char *residentfonts = NULL; /* list of printer resident fonts */
-char *printer = NULL; /* printer name - only for Unix 4.0 lp */
-
-char buf[2048]; /* input file line buffer */
-char *comment = DOCUMENTFONTS; /* look for this comment */
-int atend = FALSE; /* TRUE only if a comment says so */
-
-FILE *fp_in = stdin; /* next input file */
-FILE *fp_temp = NULL; /* for copying stdin */
-
-static Map *allocate(Map *, int);
-static void arguments(void);
-static void copyfonts(char *);
-static void copyinput(void);
-static void done(void);
-static void download(void);
-static void init_signals(void);
-static int lookup(char *);
-static void options(void);
-static void readmap(void);
-static void readresident(void);
-
-/*****************************************************************************/
-
-int
-main(int agc, char *agv[])
-{
-
-/*
- *
- * Host resident font download. The input files are assumed to be part of a
- * single PostScript job.
- *
- */
-
- argc = agc; /* other routines may want them */
- argv = agv;
-
- prog_name = argv[0]; /* just for error messages */
-
- init_signals(); /* sets up interrupt handling */
- options(); /* first get command line options */
- readmap(); /* read the font map table */
- readresident(); /* and the optional resident font list */
- arguments(); /* then process non-option arguments */
- done(); /* and clean things up */
-
- return (x_stat); /* not much could be wrong */
-
-} /* End of main */
-
-/*****************************************************************************/
-
-static void
-init_signals(void)
-{
- void interrupt(); /* handles signals if we catching them */
-
-/*
- *
- * Makes sure we handle interrupts properly.
- *
- */
-
- if ( signal(SIGINT, interrupt) == SIG_IGN ) {
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
- } else {
- signal(SIGHUP, interrupt);
- signal(SIGQUIT, interrupt);
- } /* End else */
-
- signal(SIGTERM, interrupt);
-
-} /* End of init_signals */
-
-/*****************************************************************************/
-
-static void
-options(void)
-{
-
- int ch; /* return value from getopt() */
- char *optnames = "c:fm:p:r:H:T:DI";
-
- extern char *optarg; /* used by getopt() */
- extern int optind;
-
-/*
- *
- * Reads and processes the command line options.
- *
- */
-
- while ( (ch = getopt(argc, argv, optnames)) != EOF ) {
-
- switch ( ch ) {
-
- case 'c': /* look for this comment */
- comment = optarg;
- break;
-
- case 'f': /* force a complete input file scan */
- atend = TRUE;
- break;
-
- case 'm': /* printer map table name */
- mapname = optarg;
- break;
-
- case 'p': /* printer name - for Unix 4.0 lp */
- printer = optarg;
- break;
-
- case 'r': /* resident font list */
- residentfonts = optarg;
- break;
-
- case 'H': /* host resident font directory */
- hostfontdir = optarg;
- break;
-
- case 'T': /* temporary file directory */
- temp_dir = optarg;
- break;
-
- case 'D': /* debug flag */
- debug = ON;
- break;
-
- case 'I': /* ignore FATAL errors */
- ignore = ON;
- break;
-
- case '?': /* don't understand the option */
- error(FATAL, "");
- break;
-
- default: /* don't know what to do for ch */
- error(FATAL, "missing case for option %c\n", ch);
- break;
-
- } /* End switch */
-
- } /* End while */
-
- argc -= optind; /* get ready for non-option args */
- argv += optind;
-
-} /* End of options */
-
-/*****************************************************************************/
-
-static void
-readmap(void)
-{
- char *path;
- char *ptr;
- int fd;
- struct stat sbuf;
-
-/*
- *
- * Initializes the map table by reading an ASCII mapping file. If mapname begins
- * with a / it's the map table. Otherwise hostfontdir, mapname, and suffix are
- * combined to build the final pathname. If we can open the file we read it all
- * into memory, erase comments, and separate the font and file name pairs. When
- * we leave next points to the next free slot in the map[] array. If it's zero
- * nothing was in the file or we couldn't open it.
- *
- */
-
- if ( hostfontdir == NULL || mapname == NULL )
- return;
-
- if ( *mapname != '/' ) {
- if ( (path = malloc(strlen(hostfontdir) + strlen(mapname) +
- strlen(suffix) + 2)) == NULL )
- error(FATAL, "no memory");
- sprintf(path, "%s/%s%s", hostfontdir, mapname, suffix);
- } else path = mapname;
-
- if ( (fd = open(path, 0)) != -1 ) {
- if ( fstat(fd, &sbuf) == -1 )
- error(FATAL, "can't fstat %s", path);
- if ( (stringspace = malloc(sbuf.st_size + 2)) == NULL )
- error(FATAL, "no memory");
- if ( read(fd, stringspace, sbuf.st_size) == -1 )
- error(FATAL, "can't read %s", path);
- close(fd);
-
- stringspace[sbuf.st_size] = '\n'; /* just to be safe */
- stringspace[sbuf.st_size+1] = '\0';
- for ( ptr = stringspace; *ptr != '\0'; ptr++ ) /* erase comments */
- if ( *ptr == '%' )
- for ( ; *ptr != '\n' ; ptr++ )
- *ptr = ' ';
-
- for ( ptr = stringspace; ; next++ ) {
- if ( (next % 50) == 0 )
- map = allocate(map, next+50);
- map[next].downloaded = FALSE;
- map[next].font = strtok(ptr, " \t\n");
- map[next].file = strtok(ptr = NULL, " \t\n");
- if ( map[next].font == NULL )
- break;
- if ( map[next].file == NULL )
- error(FATAL, "map table format error - check %s", path);
- } /* End for */
- } /* End if */
-
-} /* End of readmap */
-
-/*****************************************************************************/
-
-static void
-readresident(void)
-{
- FILE *fp;
- char *path;
- int ch;
- int n;
-
-/*
- *
- * Reads a file that lists the resident fonts for a particular printer and marks
- * each font as already downloaded. Nothing's done if the file can't be read or
- * there's no mapping file. Comments, as in the map file, begin with a % and
- * extend to the end of the line. Added for Unix 4.0 lp.
- *
- */
-
- if ( next == 0 || (printer == NULL && residentfonts == NULL) )
- return;
-
- if ( printer != NULL ) { /* use Unix 4.0 lp pathnames */
- sprintf(buf, "/etc/lp/printers/%s/residentfonts", printer);
- path = buf;
- } else path = residentfonts;
-
- if ( (fp = fopen(path, "r")) != NULL ) {
- while ( fscanf(fp, "%s", buf) != EOF )
- if ( buf[0] == '%' )
- while ( (ch = getc(fp)) != EOF && ch != '\n' ) ;
- else if ( (n = lookup(buf)) < next )
- map[n].downloaded = TRUE;
- fclose(fp);
- } /* End if */
-
-} /* End of readresident */
-
-/*****************************************************************************/
-
-static void
-arguments(void)
-{
-
-/*
- *
- * Makes sure all the non-option command line arguments are processed. If we get
- * here and there aren't any arguments left, or if '-' is one of the input files
- * we'll translate stdin. Assumes input files are part of a single PostScript
- * job and fonts can be downloaded at the start of each file.
- *
- */
-
- if ( argc < 1 )
- download();
- else {
- while ( argc > 0 ) {
- fp_temp = NULL;
- if ( strcmp(*argv, "-") == 0 )
- fp_in = stdin;
- else if ( (fp_in = fopen(*argv, "r")) == NULL )
- error(FATAL, "can't open %s", *argv);
- download();
- if ( fp_in != stdin )
- fclose(fp_in);
- if ( fp_temp != NULL )
- fclose(fp_temp);
- argc--;
- argv++;
- } /* End while */
- } /* End else */
-
-} /* End of arguments */
-
-/*****************************************************************************/
-
-static void
-done(void)
-{
-
-/*
- *
- * Clean things up before we quit.
- *
- */
-
- if ( temp_file != NULL )
- unlink(temp_file);
-
-} /* End of done */
-
-/*****************************************************************************/
-
-static void
-download(void)
-{
- int infontlist = FALSE;
-
-/*
- *
- * If next is zero the map table is empty and all we do is copy the input file
- * to stdout. Otherwise we read the input file looking for %%DocumentFonts: or
- * continuation comments, add any accessible fonts to the output file, and then
- * append the input file. When reading stdin we append lines to fp_temp and
- * recover them when we're ready to copy the input file. fp_temp will often
- * only contain part of stdin - if there's no %%DocumentFonts: (atend) comment
- * we stop reading fp_in after the header.
- *
- */
-
- if ( next > 0 ) {
- if ( fp_in == stdin ) {
- if ( (temp_file = tempnam(temp_dir, "post")) == NULL )
- error(FATAL, "can't generate temp file name");
- if ( (fp_temp = fopen(temp_file, "w+")) == NULL )
- error(FATAL, "can't open %s", temp_file);
- unlink(temp_file);
- temp_file = NULL;
- } /* End if */
-
- while ( fgets(buf, sizeof(buf), fp_in) != NULL ) {
- if ( fp_temp != NULL )
- fprintf(fp_temp, "%s", buf);
- if ( buf[0] != '%' || buf[1] != '%' ) {
- if ( (buf[0] != '%' || buf[1] != '!') && atend == FALSE )
- break;
- infontlist = FALSE;
- } else if ( strncmp(buf, comment, strlen(comment)) == 0 ) {
- copyfonts(buf);
- infontlist = TRUE;
- } else if ( buf[2] == '+' && infontlist == TRUE )
- copyfonts(buf);
- else infontlist = FALSE;
- } /* End while */
- } /* End if */
-
- copyinput();
-
-} /* End of download */
-
-/*****************************************************************************/
-
-static void
-copyfonts(char *list)
-{
- char *font;
- char *path;
- int n;
-
-/*
- *
- * list points to a %%DocumentFonts: or continuation comment. What follows the
- * the keyword will be a list of fonts separated by white space (or (atend)).
- * Look for each font in the map table and if it's found copy the font file to
- * stdout (once only).
- *
- */
-
- strtok(list, " \n"); /* skip to the font list */
-
- while ( (font = strtok(NULL, " \t\n")) != NULL ) {
- if ( strcmp(font, ATEND) == 0 ) {
- atend = TRUE;
- break;
- } /* End if */
- if ( (n = lookup(font)) < next ) {
- if ( *map[n].file != '/' ) {
- if ( (path = malloc(strlen(hostfontdir)+strlen(map[n].file)+2)) == NULL )
- error(FATAL, "no memory");
- sprintf(path, "%s/%s", hostfontdir, map[n].file);
- cat(path);
- free(path);
- } else cat(map[n].file);
- map[n].downloaded = TRUE;
- } /* End if */
- } /* End while */
-
-} /* End of copyfonts */
-
-/*****************************************************************************/
-
-static void
-copyinput(void)
-{
-
-/*
- *
- * Copies the input file to stdout. If fp_temp isn't NULL seek to the start and
- * add it to the output file - it's a partial (or complete) copy of stdin made
- * by download(). Then copy fp_in, but only seek to the start if it's not stdin.
- *
- */
-
- if ( fp_temp != NULL ) {
- fseek(fp_temp, 0L, 0);
- while ( fgets(buf, sizeof(buf), fp_temp) != NULL )
- printf("%s", buf);
- } /* End if */
-
- if ( fp_in != stdin )
- fseek(fp_in, 0L, 0);
-
- while ( fgets(buf, sizeof(buf), fp_in) != NULL )
- printf("%s", buf);
-
-} /* End of copyinput */
-
-/*****************************************************************************/
-
-static int
-lookup(char *font)
-{
- int i;
-
-/*
- *
- * Looks for *font in the map table. Return the map table index if found and
- * not yet downloaded - otherwise return next.
- *
- */
-
- for ( i = 0; i < next; i++ )
- if ( strcmp(font, map[i].font) == 0 ) {
- if ( map[i].downloaded == TRUE )
- i = next;
- break;
- } /* End if */
-
- return(i);
-
-} /* End of lookup */
-
-/*****************************************************************************/
-
-static Map *
-allocate(Map *ptr, int num)
-{
-
-/*
- *
- * Allocates space for num Map elements. Calls malloc() if ptr is NULL and
- * realloc() otherwise.
- *
- */
-
- if ( ptr == NULL )
- ptr = (Map *)malloc(num * sizeof(Map));
- else ptr = (Map *)realloc(ptr, num * sizeof(Map));
-
- if ( ptr == NULL )
- error(FATAL, "no map memory");
-
- return(ptr);
-
-} /* End of allocate */
diff --git a/usr/src/cmd/lp/filter/postscript/download/download.h b/usr/src/cmd/lp/filter/postscript/download/download.h
deleted file mode 100644
index 985332490d..0000000000
--- a/usr/src/cmd/lp/filter/postscript/download/download.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#ifndef _DOWNLOAD_H
-#define _DOWNLOAD_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cpluplus
-extern {
-#endif
-
-/*
- *
- * The font data for a printer is saved in an array of the following type.
- *
- */
-
-typedef struct map {
-
- char *font; /* a request for this PostScript font */
- char *file; /* means copy this unix file */
- int downloaded; /* TRUE after *file is downloaded */
-
-} Map;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _DOWNLOAD_H */
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/Makefile b/usr/src/cmd/lp/filter/postscript/dpost/Makefile
deleted file mode 100644
index bb081538d4..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/Makefile
+++ /dev/null
@@ -1,85 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/dpost/Makefile
-#
-
-include ../../../Makefile.lp
-
-PROG= dpost
-
-SRCS = dpost.c draw.c color.c pictures.c ps_include.c
-
-OBJS = $(SRCS:%.c=%.o)
-
-COMMONDIR= ../common
-
-COMMONOBJS = $(COMMONDIR)/glob.o \
- $(COMMONDIR)/misc.o \
- $(COMMONDIR)/request.o \
- $(COMMONDIR)/tempnam.o
-
-TXTS= README
-
-# dpost uses some floating point arithmetic, so if you're running on a system
-# without floating point hardware add the -f option to the definition of CFLAGS.
-
-ENCODING= 2
-CPPFLAGS = -DDFLTENCODING=$(ENCODING) \
- -I. -I$(COMMONDIR) \
- $(CPPFLAGS.master)
-
-POFILE = lp_filter_postscript_dpost.po
-
-.KEEP_STATE:
-
-all: $(TXTS) $(PROG)
-
-install: all $(ROOTLIBLPPOSTPROG)
-
-$(PROG): $(OBJS) $(COMMONOBJS)
- $(LINK.c) -o $@ $(OBJS) $(COMMONOBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-$(COMMONOBJS): $$(@:%.o=%.c)
- cd $(@D); $(MAKE) $(@F)
-
-ps_include.o: ps_include.h
-ps_include.h: ps_include.ps ps_include.awk
- $(RM) $@; awk -f ps_include.awk ps_include.ps >$@
-
-clean:
- $(RM) $(OBJS) ps_include.h
-
-strip:
- $(STRIP) $(PROG)
-
-lint: lint_SRCS
-
-include ../../../../Makefile.targ
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/README b/usr/src/cmd/lp/filter/postscript/dpost/README
deleted file mode 100644
index a2ad48ed2f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/README
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Source code for a program that translates device independent troff output into
-PostScript.
-
-Several new text encoding schemes, based on widthshow, have been added. Each can
-be accessed using the -e option and often reduce print time by 20% or more. Level
-0 is the slowest but most stable choice. Level 2 encoding (which right now is the
-default) is fast and does a good job placing text and justifying the right margin.
-You can change the default encoding scheme by adjusting the definition of ENCODING
-in ../Makefile. Levels 0, 1, and 2 are the only reasonable defaults, but at present
-only level 0 is guaranteed. The new encoding schemes are not thoroughly tested,
-but passed the tests I ran.
-
-Other interesting features include color support, the ability to treat complex
-paths built from the standard drawing commands as single entities (eg. for filling
-a polygon with a color), and reverse video printing as a special case of color.
-Also added, although using it is far from trivial, is the ability to set text
-along an arbitrary baseline (see ../postscript/baseline.ps). All are accessed via
-special device control escapes (from routine devcntrl() in dpost.c).
-
-ASCII font and description files for many standard PostScript fonts can be found
-in ../font/devpost. They should be installed in /usr/lib/font/devpost, and are
-read when you add the -Tpost option to troff. A typical command line would be,
-
- pic file | tbl | eqn | troff -mm -Tpost | dpost >file.ps
-
-while,
-
- pic -T720 file | tbl | eqn -r720 | troff -mm -Tpost | dpost >file.ps
-
-should work if you're using old versions of eqn and pic.
-
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/color.c b/usr/src/cmd/lp/filter/postscript/dpost/color.c
deleted file mode 100644
index 0b7f0c25e5..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/color.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * Routines that handle color requests passed through as device control commands
- * in the form "x X SetColor:red". The following PostScript procedures are needed:
- *
- * setcolor
- *
- * mark /color setcolor mark
- * mark /color1 /color2 setcolor mark
- *
- * Called whenever we want to change PostScript's current color graphics
- * state parameter. One or two color arguments can be given. In each case
- * the colors are looked up in the PostScript colordict dictionary that's
- * defined in *colorfile. Two named colors implies reverse video printing
- * with the background given in /color2 and the text printed in /color1.
- * Unknown colors are mapped into defaults - black for a single color and
- * white on black for reverse video.
- *
- * drawrvbox
- *
- * leftx rightx drawrvbox -
- *
- * Fills a box that extends from leftx to rightx with the background color
- * that was requested when setcolor set things up for reverse video mode.
- * The vertical extent of the box is determined using FontBBox just before
- * the first string is printed, and the height remains in effect until
- * there's an explicit color change. In otherwords font or size changes
- * won't always produce correct result in reverse video mode.
- *
- * setdecoding
- *
- * num setdecoding -
- *
- * Selects the text decoding procedure (ie. what's assigned to PostScript
- * procedure t) from the decodingdefs array defined in the prologue. num
- * should be the value assigned to variable encoding (in dpost) and will
- * remain constant throughout a job, unless special features, like reverse
- * video printing, are requested. The text encoding scheme can be set on
- * the command line using the -e option. Print time and the size of the
- * output file will usually decrease as the value assigned to encoding
- * increases.
- *
- *
- * The recognized collection of "x X SetColor:" commands are:
- *
- * x X SetColor: selects black
- * x X SetColor:color selects color
- * x X SetColor:color1 on color2 reverse video
- * x X SetColor:color1 color2 reverse video again
- * x X SetColor:num1 num2 num3 rgb explicit rgb color request
- * x X SetColor:num1 num2 num3 hsb explicit hsb color request
- *
- * In the last three examples num1, num2, and num3 should be numbers between 0 and
- * 1 inclusive and are passed on as aguments to the approrpriate PostScript color
- * command (eg. setrgbcolor). Unknown color names (ie. the ones that setcolor
- * doesn't find in colordict) are mapped into defaults. For one color the default
- * is black, while for reverse video it's white text on a black background.
- *
- * dpost makes sure the current color is maintained across page boundaries, which
- * may not be what you want if you're using a macro package like mm that puts out
- * page footers and headers. Adding a color request to troff and keeping track of
- * the color in each environment may be the best solution.
- *
- * To get reverse video printing follow the "x X SetColor:" command with two or
- * three arguments. "x X SetColor:white on black" or "x X SetColor:white black"
- * both produce white text on a black background. Any two colors named in colordict
- * (in file *colorfile) can be chosen so "x X SetColor:yellow on blue" also works.
- * Each reverse video mode request selects the vertical extent of the background
- * box based on the font and size in use just before the first string is printed.
- * Font and/or size changes aren't guaranteed to work properly in reverse video
- * printing.
- *
- */
-
-
-#include <stdio.h>
-#include <ctype.h>
-
-#include "gen.h" /* general purpose definitions */
-#include "ext.h" /* external variable definitions */
-
-
-#define DEFAULTCOLOR "black"
-
-char color[50] = DEFAULTCOLOR; /* current color */
-int gotcolor = FALSE; /* TRUE after *colorfile is downloaded */
-int wantcolor = FALSE; /* TRUE if we really ask for a color */
-
-
-/*
- *
- * All these should be defined in dpost.c.
- *
- */
-
-
-extern int lastend;
-extern int encoding;
-extern int maxencoding;
-extern int realencoding;
-
-extern char *colorfile;
-extern FILE *tf;
-
-
-/*****************************************************************************/
-
-
-void
-getcolor(void)
-{
-
-/*
- *
- * Responsible for making sure the PostScript color procedures are downloaded from
- * *colorfile. Done at most once per job, and only if the job really uses color.
- * For now I've decided not to quit if we can't read the color file.
- *
- */
-
-
- if ( gotcolor == FALSE && access(colorfile, 04) == 0 )
- doglobal(colorfile);
-
- if ( tf == stdout )
- gotcolor = TRUE;
-
-} /* End of getcolor */
-
-
-/*****************************************************************************/
-
-
-void
-newcolor(char *name)
- /* of the color */
-{
- char *p; /* next character in *name */
- int i; /* goes in color[i] */
-
-/*
- *
- * Converts *name to lower case and saves the result in color[] for use as the
- * current color. The first time something other than DEFAULTCOLOR is requested
- * sets wantcolor to TRUE. Characters are converted to lower case as they're put
- * in color[] and we quit when we find a newline or get to the end of *name. The
- * isupper() test is for Berkley systems.
- *
- */
-
-
- for ( p = name; *p && (*p == ' ' || *p == ':'); p++ ) ;
-
- for ( i = 0; i < sizeof(color) - 1 && *p != '\n' && *p; i++, p++ )
- if ( isupper(*p) )
- color[i] = tolower(*p);
- else color[i] = *p;
-
- if ( i == 0 )
- strcpy(color, DEFAULTCOLOR);
- else color[i] = '\0';
-
- if ( strcmp(color, DEFAULTCOLOR) != 0 )
- wantcolor = TRUE;
-
-} /* End of newcolor */
-
-
-/*****************************************************************************/
-
-
-void
-setcolor(void)
-{
- int newencoding; /* text encoding scheme that's needed */
- char *p; /* for converting what's in color[] */
-
-/*
- *
- * Sets the color being used by the printer to whatever's stored as the current
- * color (ie. the string in color[]). wantcolor is only set to TRUE if we've been
- * through newcolor() and asked for something other than DEFAULTCOLOR (probably
- * black). While in reverse video mode encoding gets set to maxencoding + 1 in
- * dpost and 0 on the printer. Didn't see much point in trying to extend reverse
- * video to all the different encoding schemes. realencoding is restored when we
- * leave reverse video mode.
- *
- */
-
-
- if ( wantcolor == TRUE ) {
- endtext();
- getcolor();
-
- lastend = -1;
- newencoding = realencoding;
-
- if ( islower(color[0]) == 0 ) /* explicit rgb or hsb request */
- fprintf(tf, "%s\n", color);
- else {
- putc('/', tf);
- for ( p = color; *p && *p != ' '; p++ )
- putc(*p, tf);
- for ( ; *p && *p == ' '; p++ ) ;
- if ( strncmp(p, "on ", 3) == 0 ) p += 3;
- if ( *p != '\0' ) {
- fprintf(tf, " /%s", p);
- newencoding = maxencoding + 1;
- } /* End if */
- fprintf(tf, " setcolor\n");
- } /* End else */
-
- if ( newencoding != encoding ) {
- encoding = newencoding;
- fprintf(tf, "%d setdecoding\n", encoding);
- resetpos();
- } /* End if */
- } /* End if */
-
-} /* End of setcolor */
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/dpost.c b/usr/src/cmd/lp/filter/postscript/dpost/dpost.c
deleted file mode 100644
index 28afb1db18..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/dpost.c
+++ /dev/null
@@ -1,2826 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * dpost - troff post-processor for PostScript printers.
- *
- * A program that translates output generated by the device independent troff
- * into PostScript. Much was borrowed from dimpress and dps (formally dlzw),
- * and even though the code has been changed, credit has to be given to Richard
- * Flood for his early work on the PostScript driver.
- *
- * Among the most interesting new features are color support (see devcntrl() and
- * file color.c) and code to handle complex paths pieced together using any of the
- * standard drawing commands (see devcntrl() and file draw.c). Reverse video mode
- * has also been included as a special case of the color support. Two encoding
- * schemes based on widthshow are also new additions. The safe one is obtained when
- * you set encoding to 2 (eg. using the -e2 option). The slightly faster method
- * is obtained by setting encoding to 3 (eg. using the -e3 option), although it's
- * not recommended. Rounding errors in character widths can accumulate and become
- * quite noticeable by the time you get to the right margin. More often than not
- * you end up getting a ragged right margin.
- *
- * The program handles files formatted for any device, although the best and
- * most efficient output is generated when the font and description files match
- * PostScript's resident fonts. Device emulation is relatively expensive, and
- * can produce output files that are more than twice the size of the input files.
- * In most cases output files will be smaller than input files, perhaps by up to
- * 40 percent, although the results you get depend on what you're doing and the
- * text encoding you're using. You'll get the worst results if you're emulating
- * another device, using special bitmap characters, like the logo, or doing lots
- * of vertical motion or drawing.
- *
- * PostScript fonts don't support all of troff's characters, so some have to
- * be built by special PostScript procedures. Those routines can be found in
- * *fontdir/devpost/charlib, and are only used when we try to print a character
- * that has been assigned a code less than 32. Definitions are only made the
- * first time each character is used. Subsequent requests to print the character
- * only generate a call to the PostScript procedure that's been copied to the
- * output file. For example you'll find a file called sq in directory
- * *fontdir/devpost/charlib. It defines a PostScript procedure called build_sq
- * that's called whenever we need to print a square. Special characters that
- * have been assigned a code of 2 are expected to come in two pieces. The
- * definition part and bitmap part (or whatever). The definition is only made
- * once, but the contents of the character's .map file are copied to the output
- * file each time, immediately after charlib() generates the call to the
- * PostScript procedure (build_?? ) that builds the character. That's typically
- * how logos built from bitmaps would be handled.
- *
- * Several different methods can be used to encode lines of text. What's done
- * depends on the value assigned to encoding. Print time should decrease as
- * encoding increases (up to MAXENCODING). Setting encoding to 0, which should
- * probably be the default, produces output essentially identical to the original
- * version of dpost. It's the slowest but most stable method of encoding lines of
- * text, and won't be bothered by rounding errors in the font width tables that
- * could become noticeable by the time you get to the end of a line. Other schemes
- * seem to work, but aren't well tested and are not guaranteed for all possible
- * jobs. encoding can be changed on the command line using the -e option. Part of
- * the support for different encoding schemes was to move control of all text
- * related output to separate routines. It makes dpost work harder, but changing
- * things is easy. For example adding stuff to support widthshow took less than
- * an hour.
- *
- * According to Adobe's structuring conventions, the output produced by dpost is
- * still nonconforming. Global definitions that are occasionally made in individual
- * pages are the primary problem. Among other things they handle downloading host
- * resident fonts and defining special characters not generally available on
- * PostScript printers. The approach used here works on a demand basis and violates
- * page independence. A definition is made once in the first page that needs it
- * and is bracketed by PostScript code that ensures the definition is exported to
- * the global environment where it will be available for use by all the pages that
- * follow. Simple changes, like downloading definitions the first time they're
- * used in each page, restores page independence but wouldn't be an efficient
- * solution. Other approaches are also available, but every one I've considered
- * sacrifices much in efficiency - just to maintain page independence. I'll leave
- * things be for now. Global definitions made in individual pages are bracketed
- * by %%BeginGlobal and %%EndGlobal comments and can easily be pulled out of
- * individual pages and put in the prologue by utility programs like postreverse.
- *
- * I've also added code that handles the DOCUMENTFONTS comment, although it's
- * only produced for those fonts in directory /usr/lib/font/devpost that have an
- * associated .name file. The first string in a .name file should be the (long)
- * PostScript name (eg. Times-Roman in R.name). For now everything else in the
- * .name file is ignored, although that may also change. You'll find .name files
- * for all the supported fonts in the devpost source directory, although they may
- * not be installed in /usr/lib/font/devpost.
- *
- * The PostScript prologue is copied from *prologue before any of the input files
- * are translated. The program expects the following procedures are avaliable:
- *
- * setup
- *
- * mark ... setup -
- *
- * Handles special initialization stuff that depends on how the program
- * was called. Expects to find a mark followed by key/value pairs on the
- * stack. The def operator is applied to each pair up to the mark, then
- * the default state is set up. An 'x res' command must preceed the
- * 'x init' command!
- *
- * pagesetup
- *
- * page pagesetup -
- *
- * Called at the start of each page, immediately after the page level
- * save, to do special initialization on a per page basis. Right now the
- * only argument is the current page number, and actually nothing of any
- * importance is currently done.
- *
- * setdecoding
- *
- * num setdecoding -
- *
- * Selects the text decoding procedure (ie. what's assigned to PostScript
- * procedure t) from the decodingdefs array defined in the prologue. num
- * should be the value assigned to variable encoding (in dpost) and will
- * remain constant throughout a job, unless special features, like reverse
- * video printing, are requested. The text encoding scheme can be set on
- * the command line using the -e option. Print time and the size of the
- * output file will usually decrease as the value assigned to encoding
- * increases.
- *
- * f
- *
- * size font f -
- *
- * Selects the size and font to be used for character imaging. Font names
- * are defined, in *prologue, so they agree with the one or two character
- * names used by troff.
- *
- * m
- *
- * x y m -
- *
- * Moves to point (x, y). Normally only used when the vertical position
- * changes. Horizontal positioning between words (or letters) is handled
- * in procedure t (below).
- *
- * t
- *
- * mark text t mark
- *
- * Processes everything on the stack, up to the mark, as a single line
- * of text to be printed at a fixed vertical position. What's put out as
- * text depends on the encoding scheme. Setting encoding to 0 produces
- * output essentially identical to the original version of dpost. In that
- * case everything on the stack, up to a mark, is interpreted (from top
- * down) as an absolute horizontal position and a string to be printed at
- * that point. For example the stack might look like,
- *
- * mark(this)1000(is)1100(an)1200(example)1300 t
- *
- * Procedure t would go through the stack, up to the mark, adjusting the
- * horizontal position before printing each string. In other encoding
- * schemes, like the one based on widthshow, strings containing several
- * space separated words would appear on the stack, and each one would be
- * preceeded by a number that's expected to be added to the width of a
- * space. For example we might have,
- *
- * mark(an example)30(this is)40 2 1000 2000 t
- *
- * where (1000, 2000) is where the first string starts and 2 is the repeat
- * count (ie. number of string and space pairs on the stack).
- *
- * w
- *
- * string x y w -
- *
- * Prints a single word starting at position (x, y). Only used in the more
- * complicated encoding schemes (eg. the ones based on widthshow).
- *
- * done
- *
- * Makes sure the last page is printed. Only needed when we're printing
- * more than one page on each sheet of paper.
- *
- * The PostScript procedures that support troff's drawing commands have been moved
- * out of *prologue and put in a separate file (ie. DRAW as defined in path.h).
- * The procedures are used by the routines in file draw.c, and are copied to the
- * output file at most once and only when needed. Yet another convenient violation
- * of page independence. If you don't approve append *drawfile to *prologue and
- * make sure *drawfile can't be read when DPOST runs.
- *
- * Many default values, like the magnification and orientation, are defined in
- * the prologue, which is where they belong. If they're changed (by options), an
- * appropriate definition is made after the prologue is added to the output file.
- * The -P option passes arbitrary PostScript through to the output file. Among
- * other things it can be used to set (or change) values that can't be accessed by
- * other options.
- *
- *
- * output language from troff:
- * all numbers are character strings
- *
- * sn size in points
- * fn font as number from 1-n
- * cx ascii character x
- * Cxyz funny char xyz. terminated by white space
- * Hn go to absolute horizontal position n
- * Vn go to absolute vertical position n (down is positive)
- * hn go n units horizontally (relative)
- * vn ditto vertically
- * nnc move right nn, then print c (exactly 2 digits!)
- * (this wart is an optimization that shrinks output file size
- * about 35% and run-time about 15% while preserving ascii-ness)
- * Dt ...\n draw operation 't':
- * Dl x y line from here by x,y
- * Dc d circle of diameter d with left side here
- * De x y ellipse of axes x,y with left side here
- * Da x1 y1 x2 y2 arc counter-clockwise from current point (x, y) to
- * (x + x1 + x2, y + y1 + y2)
- * D~ x y x y ... wiggly line by x,y then x,y ...
- * nb a end of line (information only -- no action needed)
- * b = space before line, a = after
- * p new page begins -- set v to 0
- * #...\n comment
- * x ...\n device control functions:
- * x i init
- * x T s name of device is s
- * x r n h v resolution is n/inch
- * h = min horizontal motion, v = min vert
- * x p pause (can restart)
- * x s stop -- done forever
- * x t generate trailer
- * x f n s font position n contains font s
- * x H n set character height to n
- * x S n set slant to N
- *
- * Subcommands like "i" are often spelled out like "init".
- *
- */
-
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <math.h>
-#include <ctype.h>
-#include <time.h>
-
-#include "comments.h" /* PostScript file structuring comments */
-#include "gen.h" /* general purpose definitions */
-#include "path.h" /* for the prologue and a few other files */
-#include "ext.h" /* external variable definitions */
-#include "dev.h" /* typesetter and font descriptions */
-#include "dpost.h" /* a few definitions just used here */
-
-
-char *prologue = DPOST; /* the basic PostScript prologue */
-char *colorfile = COLOR; /* things needed for color support */
-char *drawfile = DRAW; /* and drawing */
-char *formfile = FORMFILE; /* stuff for multiple pages per sheet */
-char *baselinefile = BASELINE;
-
-char *fontdir = FONTDIR; /* binary device directories found here */
-char *hostfontdir = NULL; /* host resident font directory */
-
-int formsperpage = 1; /* page images on each piece of paper */
-int copies = 1; /* and this many copies of each sheet */
-int picflag = ON; /* enable/disable picture inclusion */
-
-
-/*
- *
- * encoding selects the encoding scheme used to output lines of text. Change it
- * to something other than 0 at your own risk. The other methods seem to work but
- * aren't well tested and are not guaranteed. Some special features, like reverse
- * video, may temporarily change the encoding scheme and reset it to realencoding
- * when done.
- *
- */
-
-
-int encoding = DFLTENCODING;
-int realencoding = DFLTENCODING;
-int maxencoding = MAXENCODING;
-
-
-/*
- *
- * seenfonts[] keeps track of the fonts we've used, based on internal numbers. It
- * helps manage host resident fonts and the DOCUMENTFONTS comment, but only works
- * if all fonts have internal numbers less than MAXINTERNAL. *docfonts counts the
- * number of font names we've recorded in *temp_file. If it's positive routine
- * done() adds *temp_file to the output file before quitting.
- *
- */
-
-
-char seenfonts[MAXINTERNAL+1];
-int docfonts = 0;
-
-
-/*
- *
- * devname[] is the device troff used when the job was formatted, while *realdev
- * is combined with *fontdir and used to locate the font and device tables that
- * that control the translation of the input files into PostScript. *realdev can
- * be changed using the -T option, but if you do you may end up getting garbage.
- * The character code field must agree with PostScript's font encoding and font
- * names must be properly mapped into PostScript font names in the prologue.
- *
- */
-
-
-char devname[20] = ""; /* job is formatted for this printer */
-char *realdev = DEVNAME; /* a good description of target printer */
-
-
-/*
- *
- * Standard things that come from binary font and description files for *realdev.
- * Most are initialized in fontinit() or loadfont().
- *
- */
-
-
-struct dev dev; /* DESC.out starts this way */
-struct Font *fontbase[NFONT+1]; /* FONT.out files begin this way */
-short *pstab; /* list of available sizes */
-int nsizes = 1; /* and the number of sizes in that list */
-int smnt; /* index of first special font */
-int nchtab; /* number of special character names */
-int fsize; /* max size of a font files in bytes */
-int unitwidth; /* set to dev.unitwidth */
-char *chname; /* special character strings */
-short *chtab; /* used to locate character names */
-char *fitab[NFONT+1]; /* locates char info on each font */
-char *widthtab[NFONT+1]; /* character width data for each font */
-char *codetab[NFONT+1]; /* and codes to get characters printed */
-
-
-/*
- *
- * Special characters missing from standard PostScript fonts are defined by files
- * in directory *fontdir/devpost/charlib. Files have the same names as the troff
- * special character names (for now at least) and each one defines a PostScript
- * procedure that begins with the prefix build_ and ends with the character's
- * name.
- *
- * For example, the routine used to build character \(12, would be build_12.
- * downloaded[] points to an array, allocated in fontinit(), that keeps track of
- * the characters that have already been defined - so we only do it once.
- *
- */
-
-
-char *downloaded; /* nonzero means it's been downloaded */
-
-
-/*
- *
- * Variables that keep track of troff's requests. All are set from values in the
- * input files. nfonts is adjusted in t_fp() as new fonts are mounted.
- *
- */
-
-
-int nfonts = 0; /* number of font positions */
-int size = 1; /* current size - internal value */
-int font = 0; /* font position we're using now */
-int hpos = 0; /* where troff wants to be - horizontally */
-int vpos = 0; /* same but vertically */
-float lastw = 0; /* width of the last input character */
-int lastc = 0; /* and its name (or index) */
-
-int fontheight = 0; /* points from x H ... */
-int fontslant = 0; /* angle from x S ... */
-
-int res; /* resolution assumed in input file */
-float widthfac = 1.0; /* for emulation = res/dev.res */
-
-
-/*
- *
- * Remember some of the same things, but this time for the printer. lastend is only
- * used when we're doing reverse video, and is where the last character on the
- * current line was printed.
- *
- */
-
-
-int lastsize = -1; /* last internal size we used */
-int lastfont = -1; /* last font we told printer about */
-float lastx = -1; /* printer's current position */
-int lasty = -1;
-int lastend; /* where last character on this line was */
-
-
-/*
- *
- * fontname[] keeps track of the mounted fonts. Filled in (by t_fp()) from data
- * in the binary font files.
- *
- */
-
-
-struct {
-
- char *name; /* name of the font loaded here */
- int number; /* its internal number */
-
-} fontname[NFONT+1] = {NULL, 0};
-
-
-/*
- *
- * All the special fonts will be mounted after the last legitimate font position.
- * It helps when we're translating files prepared for devices, like the 202, that
- * have a different set of special fonts. The set of special fonts needed when
- * *realdev's tables are used may not get mounted when we're emulating another
- * device. gotspecial keeps track of whether we've done it yet. seenpage is set
- * to TRUE after we've seen the first page command in the input file. It controls
- * what's done in t_font() and is needed because nfonts is no longer set when the
- * DESC.out file is read, but rather is updated from "x font" commands in the
- * input files.
- *
- */
-
-
-int gotspecial = FALSE;
-int seenpage = FALSE;
-
-
-/*
- *
- * The amount of horizontal positioning error we accept controls both the size
- * of the output file and the appearance of the printed text. It's probably most
- * important when we're emulating other devices, like the APS-5. The error can be
- * set using the -S option. It's converted from points to machine units in t_init()
- * after the resolution is known. rvslop is also set in t_init() and only used to
- * adjust the width of the box that's drawn around text when we're printing in
- * reverse video mode.
- *
- */
-
-
-float pointslop = SLOP; /* horizontal error in points */
-int slop; /* and machine units */
-int rvslop; /* to extend box in reverse video mode */
-
-
-/*
- *
- * Characters are accumulated and saved in PostScript strings that are eventually
- * processed by making a single call to procedure t. textcount counts the number
- * of individual strings collected but not yet processed, and is primarily used to
- * make sure PostScript's stack doesn't get too big. When textcount is positive
- * we've started accumulating strings and need to generate a call to PostScript
- * procedure t to process the text before anything else (like a font change) is
- * done.
- *
- */
-
-
-int textcount = 0; /* strings accumulated so far */
-int stringstart = 0; /* where the next one starts */
-int spacecount = 0; /* spaces seen so far on current line */
-
-
-/*
- *
- * Things that can be used by text line encoding schemes that need to read and
- * remember an entire line before doing any output. The strings that make up the
- * line can be saved in array strings[] and accessed by fields in line[]. *strptr
- * points to the next free slot in strings[].
- *
- */
-
-
-char strings[STRINGSPACE];
-char *strptr;
-Line line[MAXSTACK+3];
-
-
-/*
- *
- * When we're emulating another device we may want to map font name requests that
- * come in as "x font pos name" commands into some other font name before anything
- * else is done (ie. calling loadfont()). Font names can collide or we may just
- * want to a mapping that depends on the device troff used to format the input
- * files. devfontmap points to a structure that's filled in by getdevmap() if the
- * mapping file /usr/lib/font/dev*realdev/fontmaps/devname exists. mapdevfont()
- * then uses that table to translate font name requests into something else before
- * loadfont() gets called.
- *
- * fontmap[] provides a simple minded translation that maps an unrecognized font
- * name (in loadfont()) into another font name that we know will be available. It
- * doesn't provide the fine control available with *devfontmap, but should be good
- * enough for most jobs. Both structures are only needed when emulating another
- * device using *realdev's font tables.
- *
- */
-
-
-Devfontmap *devfontmap = NULL; /* device level */
-Fontmap fontmap[] = FONTMAP; /* and general mapping tables - emulation */
-
-
-/*
- *
- * A few variables that are really only used if we're doing accounting. Designed
- * for our use at Murray Hill and probably won't suit your needs. Changes should
- * be easy and can be made in routine account().
- *
- */
-
-
-int printed = 0; /* charge for this many pages */
-
-
-/*
- *
- * Output and accounting file definitions. The PostScript output always goes to
- * stdout or /dev/null, while the accounting file can be selected using the -A
- * option.
- *
- */
-
-
-FILE *tf = NULL; /* PostScript output goes here */
-FILE *fp_acct = NULL; /* accounting stuff written here */
-
-
-/*
- *
- * Need the list of valid options in header() and options(), so I've moved the
- * definition here.
- *
- */
-
-
-char *optnames = "a:c:e:m:n:o:p:tw:x:y:A:C:J:F:H:L:OP:R:S:T:DI";
-
-
-/*
- *
- * Very temporary space that can be used to do things like building up pathnames
- * immediately before opening a file. Contents may not be preserved across calls
- * to subroutines defined in this file, so it probably should only be used in low
- * level subroutines like loadfont() or fontinit() and nowhere else.
- *
- */
-
-
-char temp[150];
-
-static void account(void);
-static void addchar(int);
-static void addoctal(int);
-static void arguments(void);
-static void charlib(int);
-static void conv(FILE *);
-static void devcntrl(FILE *);
-static void documentfonts(void);
-static void done(void);
-static void endline(void);
-static void endstring(void);
-void endtext(void);
-static void fontinit(void);
-static void fontprint(int);
-static void getdevmap(void);
-static void header(void);
-void hgoto(int);
-static void hmot(int);
-static void init_signals(void);
-static void loaddefault(void);
-static void loadfont(int, char *, char *);
-static void loadspecial(void);
-static void options(void);
-static void oput(int);
-static void put1(int);
-static void put1s(char *);
-static void redirect(int);
-void reset(void);
-void resetpos(void);
-static void setfont(int);
-static void setpaths(char *);
-static void setsize(int);
-static void setup(void);
-static void starttext(void);
-static void t_charht(int);
-static void t_fp(int, char *, char *);
-static void t_init(void);
-static void t_newline(void);
-static void t_page(int);
-static void t_reset(int);
-void t_sf(void);
-static void t_slant(int);
-static void t_trailer(void);
-void vgoto(int);
-static void vmot(int);
-
-
-/*****************************************************************************/
-
-
-int
-main(int agc, char *agv[])
-{
-
-/*
- *
- * A program that translates troff output into PostScript. All the input files
- * must have been formatted for the same device, which doesn't necessarily have to
- * be *realdev. If there's more than one input file, each begins on a new page.
- *
- */
-
-
- argc = agc; /* global so everyone can use them */
- argv = agv;
-
- prog_name = argv[0]; /* just for error messages */
-
- init_signals(); /* sets up interrupt handling */
- header(); /* PostScript file structuring comments */
- options(); /* command line options */
- arguments(); /* translate all the input files */
- done(); /* add trailing comments etc. */
- account(); /* job accounting data */
-
- return (x_stat); /* everything probably went OK */
-
-} /* End of main */
-
-
-/*****************************************************************************/
-
-
-static void
-init_signals(void)
-{
- void interrupt(); /* signal handler */
-
-/*
- *
- * Make sure we handle interrupts.
- *
- */
-
-
- if ( signal(SIGINT, interrupt) == SIG_IGN ) {
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
- } else {
- signal(SIGHUP, interrupt);
- signal(SIGQUIT, interrupt);
- } /* End else */
-
- signal(SIGTERM, interrupt);
-
-} /* End of init_signals */
-
-
-/*****************************************************************************/
-
-static void
-header(void)
-{
-
-
- int ch; /* return value from getopt() */
- int old_optind = optind; /* for restoring optind - should be 1 */
-
-
-/*
- *
- * Scans the option list looking for things, like the prologue file, that we need
- * right away but could be changed from the default. Doing things this way is an
- * attempt to conform to Adobe's latest file structuring conventions. In particular
- * they now say there should be nothing executed in the prologue, and they have
- * added two new comments that delimit global initialization calls. Once we know
- * where things really are we write out the job header, follow it by the prologue,
- * and then add the ENDPROLOG and BEGINSETUP comments.
- *
- */
-
-
- while ( (ch = getopt(argc, argv, optnames)) != EOF )
- if ( ch == 'L' )
- setpaths(optarg);
- else if ( ch == '?' )
- error(FATAL, "");
-
- optind = old_optind; /* get ready for option scanning */
-
- fprintf(stdout, "%s", NONCONFORMING);
- fprintf(stdout, "%s %s\n", VERSION, PROGRAMVERSION);
- fprintf(stdout, "%s %s\n", DOCUMENTFONTS, ATEND);
- fprintf(stdout, "%s %s\n", PAGES, ATEND);
- fprintf(stdout, "%s", ENDCOMMENTS);
-
- if ( cat(prologue) == FALSE )
- error(FATAL, "can't read %s", prologue);
-
- fprintf(stdout, "%s", ENDPROLOG);
- fprintf(stdout, "%s", BEGINSETUP);
- fprintf(stdout, "mark\n");
-
-} /* End of header */
-
-
-/*****************************************************************************/
-
-
-static void
-options(void)
-{
- int ch; /* name returned by getopt() */
-
- extern char *optarg; /* option argument set by getopt() */
- extern int optind;
-
-/*
- *
- * Reads and processes the command line options. There are, without a doubt, too
- * many options!
- *
- */
-
-
- while ( (ch = getopt(argc, argv, optnames)) != EOF ) {
-
- switch ( ch ) {
-
- case 'a': /* aspect ratio */
- fprintf(stdout, "/aspectratio %s def\n", optarg);
- break;
-
- case 'c': /* number of copies */
- copies = atoi(optarg);
- fprintf(stdout, "/#copies %s store\n", optarg);
- break;
-
- case 'e': /* change the encoding scheme */
- if ( (encoding = atoi(optarg)) < 0 || encoding > MAXENCODING )
- encoding = DFLTENCODING;
- realencoding = encoding;
- break;
-
- case 'm': /* magnification */
- fprintf(stdout, "/magnification %s def\n", optarg);
- break;
-
- case 'n': /* forms per page */
- formsperpage = atoi(optarg);
- fprintf(stdout, "%s %s\n", FORMSPERPAGE, optarg);
- fprintf(stdout, "/formsperpage %s def\n", optarg);
- break;
-
- case 'o': /* output page list */
- out_list(optarg);
- break;
-
- case 'p': /* landscape or portrait mode */
- if ( *optarg == 'l' )
- fprintf(stdout, "/landscape true def\n");
- else fprintf(stdout, "/landscape false def\n");
- break;
-
- case 't': /* just for compatibility */
- break;
-
- case 'w': /* line width for drawing */
- fprintf(stdout, "/linewidth %s def\n", optarg);
- break;
-
- case 'x': /* shift horizontally */
- fprintf(stdout, "/xoffset %s def\n", optarg);
- break;
-
- case 'y': /* and vertically on the page */
- fprintf(stdout, "/yoffset %s def\n", optarg);
- break;
-
- case 'A': /* force job accounting */
- case 'J':
- if ( (fp_acct = fopen(optarg, "a")) == NULL )
- error(FATAL, "can't open accounting file %s", optarg);
- break;
-
- case 'C': /* copy file to straight to output */
- if ( cat(optarg) == FALSE )
- error(FATAL, "can't read %s", optarg);
- break;
-
- case 'F': /* font table directory */
- fontdir = optarg;
- break;
-
- case 'H': /* host resident font directory */
- hostfontdir = optarg;
- break;
-
- case 'L': /* PostScript prologue file */
- setpaths(optarg); /* already been done in header() */
- break;
-
- case 'O': /* turn picture inclusion off */
- picflag = OFF;
- break;
-
- case 'P': /* PostScript pass through */
- fprintf(stdout, "%s\n", optarg);
- break;
-
- case 'R': /* special global or page level request */
- saverequest(optarg);
- break;
-
- case 'S': /* horizontal position error */
- if ( (pointslop = atof(optarg)) < 0 )
- pointslop = 0;
- break;
-
- case 'T': /* target printer */
- realdev = optarg;
- break;
-
- case 'D': /* debug flag */
- debug = ON;
- tf = stdout;
- break;
-
- case 'I': /* ignore FATAL errors */
- ignore = ON;
- break;
-
- case '?': /* don't know the option */
- error(FATAL, "");
- break;
-
- default:
- error(FATAL, "missing case for option %c", ch);
- break;
-
- } /* End switch */
- } /* End while */
-
- argc -= optind; /* get ready for non-options args */
- argv += optind;
-
-} /* End of options */
-
-
-/*****************************************************************************/
-
-
-static void
-setpaths(char *name)
- /* string that followed the -L option */
-{
- char *path; /* start of the pathname */
-
-/*
- *
- * Extends the -L option to permit run time modification of pathnames that were
- * fixed or didn't exist in previous versions of dpost. For example, the PostScript
- * drawing procedures have been moved out of *prologue and put in *drawfile. The
- * new syntax can be either -Lfile or -Lname:file. If the "name:" prefix is omitted
- * file will be used as the prologue, otherwise name should be one of "prologue",
- * "font", "draw", "color", or "form" and is used to select the pointer that gets
- * set to string "file".
- *
- */
-
-
- for ( path = name; *path; path++ )
- if ( *path == ':' || *path == ' ' ) {
- while ( *path == ':' || *path == ' ' ) path++;
- break;
- } /* End if */
-
- if ( *path == '\0' ) /* didn't find a "name:" prefix */
- path = name;
-
- if ( path == name || strncmp(name, "prologue", strlen("prologue")) == 0 )
- prologue = path;
- else if ( strncmp(name, "draw", strlen("draw")) == 0 )
- drawfile = path;
- else if ( strncmp(name, "color", strlen("color")) == 0 )
- colorfile = path;
- else if ( strncmp(name, "form", strlen("form")) == 0 )
- formfile = path;
- else if ( strncmp(name, "baseline", strlen("baseline")) == 0 )
- baselinefile = path;
-
-} /* End of setpaths */
-
-
-/*****************************************************************************/
-
-
-static void
-setup(void)
-{
-
-/*
- * Handles things that must be done after the options are read but before the
- * input files are processed. Called from t_init() after an "x init" command is
- * read, because we need the resolution before we can generate the call to the
- * setup procedure defined in *prologue. Only allowing one call to setup assumes
- * all the input files have been prepared for the same device.
- *
- */
-
-
- writerequest(0, stdout); /* global requests eg. manual feed */
- fprintf(stdout, "/resolution %d def\n", res);
- fprintf(stdout, "setup\n");
- fprintf(stdout, "%d setdecoding\n", encoding);
-
- if ( formsperpage > 1 ) { /* followed by stuff for multiple pages */
- if ( cat(formfile) == FALSE )
- error(FATAL, "can't read %s", formfile);
- fprintf(stdout, "%d setupforms\n", formsperpage);
- } /* End if */
-
- fprintf(stdout, "%s", ENDSETUP);
-
-} /* End of setup */
-
-
-/*****************************************************************************/
-
-
-static void
-arguments(void)
-{
- FILE *fp; /* next input file */
-
-/*
- *
- * Makes sure all the non-option command line arguments are processed. If we get
- * here and there aren't any arguments left, or if '-' is one of the input files
- * we'll translate stdin.
- *
- */
-
-
- if ( argc < 1 )
- conv(stdin);
- else
- while ( argc > 0 ) {
- if ( strcmp(*argv, "-") == 0 )
- fp = stdin;
- else if ( (fp = fopen(*argv, "r")) == NULL )
- error(FATAL, "can't open %s", *argv);
- conv(fp);
- if ( fp != stdin )
- fclose(fp);
- argc--;
- argv++;
- } /* End while */
-
-} /* End of arguments */
-
-
-/*****************************************************************************/
-
-
-static void
-done(void)
-{
-
-/*
- *
- * Finished with all the input files, so mark the end of the pages with a TRAILER
- * comment, make sure the last page prints, and add things like the DOCUMENTFONTS
- * and PAGES comments that can only be determined after all the input files have
- * been read.
- *
- */
-
-
- fprintf(stdout, "%s", TRAILER);
- fprintf(stdout, "done\n");
-
- if ( temp_file != NULL ) {
- if ( docfonts > 0 ) {
- cat(temp_file);
- putc('\n', stdout);
- } /* End if */
- unlink(temp_file);
- } /* End if */
-
- fprintf(stdout, "%s %d\n", PAGES, printed);
-
-} /* End of done */
-
-
-/*****************************************************************************/
-
-
-static void
-account(void)
-{
-
-/*
- *
- * Writes an accounting record to *fp_acct provided it's not NULL. Accounting is
- * requested using the -A or -J options.
- *
- */
-
- if ( fp_acct != NULL )
- fprintf(fp_acct, " print %d\n copies %d\n", printed, copies);
-
-} /* End of account */
-
-
-/*****************************************************************************/
-
-
-static void
-conv(FILE *fp)
- /* next input file */
-{
- int c; /* usually first char in next command */
- int m, n, n1, m1; /* when we need to read integers */
- char str[50]; /* for special chars and font numbers */
-
-
-/*
- *
- * Controls the translation of troff's device independent output language into
- * PostScript. The call to t_page() that prints the last page is made when we
- * exit the loop, but probably belongs in t_trailer().
- *
- */
-
-
- redirect(-1); /* only do output after a page command */
- lineno = 1; /* line in current file */
-
- while ((c = getc(fp)) != EOF) {
-
- switch (c) {
-
- case '\n': /* just count this line */
- lineno++;
- break;
-
- case ' ': /* when input is text */
- case 0: /* occasional noise creeps in */
- break;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- /* two motion digits plus a character */
- hmot((c-'0')*10 + getc(fp)-'0');
- put1(getc(fp));
- break;
-
- case 'c': /* single ascii character */
- put1(getc(fp));
- break;
-
- case 'C': /* special character */
- fscanf(fp, "%s", str);
- put1s(str);
- break;
-
- case 'N': /* character at position n */
- fscanf(fp, "%d", &m);
- endtext();
- oput(m);
- break;
-
- case 'D': /* drawing functions */
- endtext();
- getdraw();
- if ( size != lastsize )
- t_sf();
- switch ((c=getc(fp))) {
- case 'p': /* draw a path */
- while (fscanf(fp, "%d %d", &n, &m) == 2)
- drawline(n, m);
- lineno++;
- break;
-
- case 'l': /* draw a line */
- fscanf(fp, "%d %d %c", &n, &m, &n1);
- drawline(n, m);
- break;
-
- case 'c': /* circle */
- fscanf(fp, "%d", &n);
- drawcirc(n);
- break;
-
- case 'e': /* ellipse */
- fscanf(fp, "%d %d", &m, &n);
- drawellip(m, n);
- break;
-
- case 'a': /* counter-clockwise arc */
- case 'A': /* clockwise arc */
- fscanf(fp, "%d %d %d %d", &n, &m, &n1, &m1);
- drawarc(n, m, n1, m1, c);
- break;
-
- case 'q': /* spline without end points */
- drawspline(fp, 1);
- lineno++;
- break;
-
- case '~': /* wiggly line */
- drawspline(fp, 2);
- lineno++;
- break;
-
- default:
- error(FATAL, "unknown drawing function %c", c);
- break;
- } /* End switch */
- break;
-
- case 's': /* use this point size */
- fscanf(fp, "%d", &n); /* ignore fractional sizes */
- setsize(t_size(n));
- break;
-
- case 'f': /* use font mounted here */
- fscanf(fp, "%s", str);
- setfont(t_font(str));
- break;
-
- case 'H': /* absolute horizontal motion */
- fscanf(fp, "%d", &n);
- hgoto(n);
- break;
-
- case 'h': /* relative horizontal motion */
- fscanf(fp, "%d", &n);
- hmot(n);
- break;
-
- case 'w': /* word space */
- break;
-
- case 'V': /* absolute vertical position */
- fscanf(fp, "%d", &n);
- vgoto(n);
- break;
-
- case 'v': /* relative vertical motion */
- fscanf(fp, "%d", &n);
- vmot(n);
- break;
-
- case 'p': /* new page */
- fscanf(fp, "%d", &n);
- t_page(n);
- break;
-
- case 'n': /* end of line */
- while ( (c = getc(fp)) != '\n' && c != EOF ) ;
- t_newline();
- lineno++;
- break;
-
- case '#': /* comment */
- while ( (c = getc(fp)) != '\n' && c != EOF ) ;
- lineno++;
- break;
-
- case 'x': /* device control function */
- devcntrl(fp);
- lineno++;
- break;
-
- default:
- error(FATAL, "unknown input character %o %c", c, c);
- done();
-
- } /* End switch */
-
- } /* End while */
-
- t_page(-1); /* print the last page */
- endtext();
-
-} /* End of conv */
-
-
-/*****************************************************************************/
-
-
-static void
-devcntrl(FILE *fp)
- /* current input file */
-{
-
-
- char str[50], buf[256], str1[50];
- int c, n;
-
-
-/*
- *
- * Called from conv() to process the rest of a device control function. There's
- * a whole family of them and they all start with the string "x ", which we've
- * already read. The "x X ..." commands are an extensible (and device dependent)
- * family that we use here for things like picture inclusion. Unrecognized device
- * control commands are ignored.
- *
- */
-
-
- fscanf(fp, "%s", str); /* get the control function name */
-
- switch ( str[0] ) { /* only the first character counts */
-
- case 'i': /* initialize */
- t_init();
- break;
-
- case 'T': /* device name */
- fscanf(fp, "%s", devname);
- getdevmap();
- strcpy(devname, realdev);
- break;
-
- case 't': /* trailer */
- t_trailer();
- break;
-
- case 'p': /* pause -- can restart */
- t_reset('p');
- break;
-
- case 's': /* stop */
- t_reset('s');
- break;
-
- case 'r': /* resolution assumed when prepared */
- fscanf(fp, "%d", &res);
- break;
-
- case 'f': /* load font in a position */
- fscanf(fp, "%d %s", &n, str);
- fgets(buf, sizeof buf, fp); /* in case there's a filename */
- ungetc('\n', fp); /* fgets() goes too far */
- str1[0] = '\0'; /* in case there's nothing to come in */
- sscanf(buf, "%s", str1);
- loadfont(n, mapdevfont(str), str1);
- break;
-
- /* these don't belong here... */
- case 'H': /* char height */
- fscanf(fp, "%d", &n);
- t_charht(n);
- break;
-
- case 'S': /* slant */
- fscanf(fp, "%d", &n);
- t_slant(n);
- break;
-
- case 'X': /* copy through - from troff */
- fscanf(fp, " %[^: \n]:", str);
- fgets(buf, sizeof(buf), fp);
- ungetc('\n', fp);
- if ( strcmp(str, "PI") == 0 || strcmp(str, "PictureInclusion") == 0 )
- picture(buf);
- else if ( strcmp(str, "InlinePicture") == 0 )
- inlinepic(fp, buf);
- else if ( strcmp(str, "BeginPath") == 0 )
- beginpath(buf, FALSE);
- else if ( strcmp(str, "DrawPath") == 0 )
- drawpath(buf, FALSE);
- else if ( strcmp(str, "BeginObject") == 0 )
- beginpath(buf, TRUE);
- else if ( strcmp(str, "EndObject") == 0 )
- drawpath(buf, TRUE);
- else if ( strcmp(str, "NewBaseline") == 0 )
- newbaseline(buf);
- else if ( strcmp(str, "DrawText") == 0 )
- drawtext(buf);
- else if ( strcmp(str, "SetText") == 0 )
- settext(buf);
- else if ( strcmp(str, "SetColor") == 0 ) {
- newcolor(buf);
- setcolor();
- } else if ( strcmp(str, "PS") == 0 || strcmp(str, "PostScript") == 0 ) {
- endtext();
- /* xymove(hpos, vpos); ul90-22006 */
- fprintf(tf, "%s", buf);
- } /* End else */
- break;
- } /* End switch */
-
- while ( (c = getc(fp)) != '\n' && c != EOF ) ;
-
-} /* End of devcntrl */
-
-
-/*****************************************************************************/
-
-
-static void
-fontinit(void)
-{
- int fin; /* for reading the DESC.out file */
- char *filebase; /* the whole thing goes here */
- int i; /* loop index */
-
-
-/*
- *
- * Reads *realdev's DESC.out file and uses what's there to initialize things like
- * the list of available point sizes. Old versions of the program used *devname's
- * DESC.out file to initialize nfonts, but that meant we needed to have *devname's
- * binary font files available for emulation. That restriction has been removed
- * and we now set nfonts using the "x font" commands in the input file, so by the
- * time we get here all we really need is *realdev. In fact devcntrl() reads the
- * device name from the "x T ..." command, but almost immediately replaces it with
- * string *realdev so we end up using *realdev's DESC.out file. Later on (in
- * t_font()) we mount all of *realdev's special fonts after the last legitimate
- * font position, just to be sure device emulation works reasonably well - there's
- * no guarantee *devname's special fonts match what's needed when *realdev's tables
- * are used.
- *
- */
-
-
- sprintf(temp, "%s/dev%s/DESC.out", fontdir, devname);
- if ( (fin = open(temp, 0)) < 0 )
- error(FATAL, "can't open tables for %s", temp);
-
- read(fin, &dev, sizeof(struct dev));
-
- nfonts = 0; /* was dev.nfonts - now set in t_fp() */
- nsizes = dev.nsizes;
- nchtab = dev.nchtab;
- unitwidth = dev.unitwidth;
-
- if ( (filebase = malloc(dev.filesize)) == NULL )
- error(FATAL, "no memory for description file");
-
- read(fin, filebase, dev.filesize); /* all at once */
- close(fin);
-
- pstab = (short *) filebase;
- chtab = pstab + nsizes + 1;
- chname = (char *) (chtab + nchtab);
- fsize = 3 * 255 + nchtab + 128 - 32 + sizeof(struct Font);
-
- for ( i = 1; i <= NFONT; i++ ) { /* so loadfont() knows nothing's there */
- fontbase[i] = NULL;
- widthtab[i] = codetab[i] = fitab[i] = NULL;
- } /* End for */
-
- if ( (downloaded = (char *) calloc(nchtab + 128, sizeof(char))) == NULL )
- error(FATAL, "no memory");
-
-} /* End of fontinit */
-
-
-/*****************************************************************************/
-
-
-static void
-loadfont(int n, char *s, char *s1)
- /* n - load this font position */
- /* s - with the .out file for this font */
- /* s1 - taken from here - possibly */
-{
- int fin; /* for reading *s.out file */
- int nw; /* number of width table entries */
-
-
-/*
- *
- * Loads font position n with the binary font file for *s.out provided it's not
- * already there. If *s1 is NULL or points to the empty string we read files from
- * directory *fontdir/dev*devname, otherwise directory *s1 is used. If the first
- * open fails we try to map font *s into one we expect will be available, and then
- * we try again.
- *
- */
-
-
- if ( n < 0 || n > NFONT ) /* make sure it's a legal position */
- error(FATAL, "illegal fp command %d %s", n, s);
-
- if ( fontbase[n] != NULL && strcmp(s, fontbase[n]->namefont) == 0 )
- return;
-
- if ( s1 == NULL || s1[0] == '\0' )
- sprintf(temp, "%s/dev%s/%s.out", fontdir, devname, s);
- else sprintf(temp, "%s/%s.out", s1, s);
-
- if ( (fin = open(temp, 0)) < 0 ) {
- sprintf(temp, "%s/dev%s/%s.out", fontdir, devname, mapfont(s));
- if ( (fin = open(temp, 0)) < 0 )
- error(FATAL, "can't open font table %s", temp);
- } /* End if */
-
- if ( fontbase[n] != NULL ) /* something's already there */
- free(fontbase[n]); /* so release the memory first */
-
- fontbase[n] = (struct Font *) malloc(fsize);
- if ( fontbase[n] == NULL )
- error(FATAL, "Out of space in loadfont %s", s);
-
- read(fin, fontbase[n], fsize);
- close(fin);
-
- if ( smnt == 0 && fontbase[n]->specfont == 1 )
- smnt = n;
-
- nw = fontbase[n]->nwfont & BMASK;
- widthtab[n] = (char *) fontbase[n] + sizeof(struct Font);
- codetab[n] = (char *) widthtab[n] + 2 * nw;
- fitab[n] = (char *) widthtab[n] + 3 * nw;
-
- t_fp(n, fontbase[n]->namefont, fontbase[n]->intname);
-
- if ( debug == ON )
- fontprint(n);
-
-} /* End of loadfont */
-
-
-/*****************************************************************************/
-
-
-static void
-loadspecial(void)
-{
- char *p; /* for next binary font file */
- int nw; /* width entries in next font */
- int i; /* loop index */
-
-
-/*
- *
- * Loads all the special fonts after the last legal font position. Mostly used
- * for device emulation, but we'll do it no matter what. Needed because there's
- * no consistency in special fonts across different devices, and relying on having
- * them mounted in the input file doesn't guarantee the whole collection will be
- * there. The special fonts are determined and mounted using the copy of the
- * DESC.out file that's been read into memory. Initially had this stuff at the
- * end of fontinit(), but we now don't know nfonts until much later.
- *
- */
-
-
- if ( gotspecial == FALSE )
- for ( i = 1, p = chname + dev.lchname; i <= dev.nfonts; i++ ) {
- nw = *p & BMASK;
- if ( ((struct Font *) p)->specfont == 1 )
- loadfont(++nfonts, ((struct Font *)p)->namefont, NULL);
- p += 3 * nw + dev.nchtab + 128 - 32 + sizeof(struct Font);
- } /* End for */
-
- gotspecial = TRUE;
-
-} /* End of loadspecial */
-
-
-/*****************************************************************************/
-char *defaultFonts[] =
- { "R", "I", "B", "BI", "CW", "H", "HB", "HX", "S1", "S", NULL };
-
-static void
-loaddefault(void)
-{
- int i;
-
- for (i = 0; defaultFonts[i] != NULL ; i++)
- loadfont(++nfonts, defaultFonts[i], NULL);
-}
-
-
-static void
-fontprint(int i)
- /* font's index in fontbase[] */
-{
- int j, n;
- char *p;
-
-
-/*
- *
- * Debugging routine that dumps data about the font mounted in position i.
- *
- */
-
-
- fprintf(tf, "font %d:\n", i);
-
- p = (char *) fontbase[i];
- n = fontbase[i]->nwfont & BMASK;
-
- fprintf(tf, "base=0%o, nchars=%d, spec=%d, name=%s, widtab=0%o, fitab=0%o\n",
- p, n, fontbase[i]->specfont, fontbase[i]->namefont, widthtab[i], fitab[i]);
-
- fprintf(tf, "widths:\n");
- for ( j = 0; j <= n; j++ ) {
- fprintf(tf, " %2d", widthtab[i][j] & BMASK);
- if ( j % 20 == 19 ) putc('\n', tf);
- } /* End for */
-
- fprintf(tf, "\ncodetab:\n");
- for ( j = 0; j <= n; j++ ) {
- fprintf(tf, " %2d", codetab[i][j] & BMASK);
- if ( j % 20 == 19 ) putc('\n', tf);
- } /* End for */
-
- fprintf(tf, "\nfitab:\n");
- for ( j = 0; j <= dev.nchtab + 128-32; j++ ) {
- fprintf(tf, " %2d", fitab[i][j] & BMASK);
- if ( j % 20 == 19 ) putc('\n', tf);
- } /* End for */
-
- putc('\n', tf);
-
-} /* End of fontprint */
-
-
-/*****************************************************************************/
-
-
-char *
-mapfont(char *name)
- /* troff wanted this font */
-{
- int i; /* loop index */
-
-
-/*
- *
- * If loadfont() can't find font *name we map it into something else that should
- * be available and return a pointer to the new name. Used mostly for emulating
- * devices like the APS-5.
- *
- */
-
-
- for ( i = 0; fontmap[i].name != NULL; i++ )
- if ( strcmp(name, fontmap[i].name) == 0 )
- return(fontmap[i].use);
-
- switch ( *++name ) {
- case 'I':
- return("I");
-
- case 'B':
- return("B");
-
- case 'X':
- return("BI");
-
- default:
- return("R");
- } /* End switch */
-
-} /* End of mapfont */
-
-
-/*****************************************************************************/
-
-
-static void
-getdevmap(void)
-{
-
-
- FILE *fp; /* for reading the device fontmap file */
- int i = 0; /* number of mapping pairs we've read */
- int c; /* for skipping lines */
-
-
-/*
- *
- * Looks for the device font mapping file *fontdir/dev*realdev/fontmaps/devname.
- * The file, if it exists, should be an ASCII file containing pairs of one or two
- * character font names per line. The first name is the font troff will be asking
- * for and the second is the one we'll use. Comments are lines that begin with
- * a '#' as the first non-white space character on a line. The devfontmap list
- * ends with a member that has the empty string in the name field.
- *
- */
-
-
- sprintf(temp, "%s/dev%s/fontmaps/%s", fontdir, realdev, devname);
-
- if ( devfontmap == NULL && (fp = fopen(temp, "r")) != NULL ) {
- devfontmap = (Devfontmap *) malloc(10 * sizeof(Devfontmap));
-
- while ( fscanf(fp, "%s", temp) != EOF ) {
- if ( temp[0] != '#' && strlen(temp) < 3 )
- if ( fscanf(fp, "%s", &temp[3]) == 1 && strlen(&temp[3]) < 3 ) {
- strcpy((devfontmap + i)->name, temp);
- strcpy((devfontmap + i)->use, &temp[3]);
- if ( ++i % 10 == 0 )
- devfontmap = (Devfontmap *) realloc(devfontmap, (i + 10) * sizeof(Devfontmap));
- } /* End if */
- while ( (c = getc(fp)) != '\n' && c != EOF ) ;
- } /* End while */
-
- (devfontmap + i)->name[0] = '\0'; /* end the list we just read */
- fclose(fp);
- } /* End if */
-
-} /* End of getdevmap */
-
-
-/*****************************************************************************/
-
-
-char *
-mapdevfont(char *str)
-{
- int i;
-
-
-/*
- *
- * Called immediately before loadfont() after an 'x font' command is recognized.
- * Takes the font name that troff asked for, looks it up in the devfontmap list,
- * and returns the mapped name to the caller. No mapping is done if the devfontmap
- * list is empty or font *str isn't found in the list.
- *
- */
-
-
- if ( devfontmap != NULL )
- for ( i = 0; (devfontmap + i)->name[0] != '\0'; i++ )
- if ( strcmp((devfontmap + i)->name, str) == 0 )
- return((devfontmap + i)->use);
-
- return(str);
-
-} /* End of mapdevfont */
-
-
-/*****************************************************************************/
-
-
-void
-reset(void)
-{
-
-/*
- *
- * Resets the variables that keep track of the printer's current position, font,
- * and size. Typically used after a restore/save pair (eg. when we finish with a
- * page) to make sure we force the printer back into sync (in terms of the font
- * and current point) before text is printed.
- *
- */
-
-
- lastx = -(slop + 1);
- lasty = -1;
- lastfont = lastsize = -1;
-
-} /* End of reset */
-
-
-/*****************************************************************************/
-
-
-void
-resetpos(void)
-{
-
-
-/*
- *
- * Resets the variables that keep track of the printer's current position. Used
- * when there's a chance we've lost track of the printer's current position or
- * done something that may have wiped it out, and we want to force dpost to set
- * the printer's position before printing text or whatever. For example stroke or
- * fill implicitly do a newpath, and that wipes out the current point, unless the
- * calls were bracketed by a gsave/grestore pair.
- *
- */
-
-
- lastx = -(slop + 1);
- lasty = -1;
-
-} /* End of resetpos */
-
-
-/*****************************************************************************/
-
-
-static void
-t_init(void)
-{
- static int initialized = FALSE; /* only do most things once */
-
-
-/*
- *
- * Called from devcntrl() after an "x init" command is read. Things only work if
- * we've already seen the "x res" command, and much of the stuff, including the
- * call to setup, should only be done once. Restricting everything to one call of
- * setup (ie. the one in the prologue) means all the input files must have been
- * formatted for the same device.
- *
- */
-
-
- endtext(); /* moved - for cat'ed troff files */
-
- if ( initialized == FALSE ) { /* only do this stuff once per job */
- fontinit();
- gotspecial = FALSE;
- widthfac = (float) res /dev.res;
- slop = pointslop * res / POINTS + .5;
- rvslop = res * .025;
- setup();
- initialized = TRUE;
- } /* End if */
-
- hpos = vpos = 0; /* upper left corner */
- setsize(t_size(10)); /* start somewhere */
- reset(); /* force position and font stuff - later */
-
-} /* End of t_init */
-
-
-/*****************************************************************************/
-
-
-static void
-t_page(int pg)
- /* troff's current page number */
-{
- static int lastpg = 0; /* last one we started - for ENDPAGE */
-
-
-/*
- *
- * Called whenever we've finished the last page and want to get ready for the
- * next one. Also used at the end of each input file, so we have to be careful
- * about what's done. The first time through (up to the redirect(pg) call) output
- * goes to /dev/null because of the redirect(-1) call made in conv().
- *
- * Adobe now recommends that the showpage operator occur after the page level
- * restore so it can be easily redefined to have side-effects in the printer's VM.
- * Although it seems reasonable I haven't implemented it, because it makes other
- * things, like selectively setting manual feed or choosing an alternate paper
- * tray, clumsy - at least on a per page basis.
- *
- */
-
-
- if ( tf == stdout ) /* count the last page */
- printed++;
-
- endtext(); /* print the last line? */
-
- fprintf(tf, "cleartomark\n");
- fprintf(tf, "showpage\n");
- fprintf(tf, "restore\n");
- fprintf(tf, "%s %d %d\n", ENDPAGE, lastpg, printed);
-
- redirect(pg);
-
- fprintf(tf, "%s %d %d\n", PAGE, pg, printed+1);
- fprintf(tf, "save\n");
- fprintf(tf, "mark\n");
- writerequest(printed+1, tf);
- fprintf(tf, "%d pagesetup\n", printed+1);
- setcolor();
-
- lastpg = pg; /* for the next ENDPAGE comment */
- hpos = vpos = 0; /* get ready for the next page */
- reset(); /* force position and font stuff - later */
-
- seenpage = TRUE;
-
-} /* End of t_page */
-
-
-/*****************************************************************************/
-
-
-static void
-t_newline(void)
-{
-
-
-/*
- *
- * Just finished the last line. All we do is set the horizontal position to 0,
- * although even that probably isn't necessary.
- *
- */
-
-
- hpos = 0;
-
-} /* End of t_newline */
-
-
-/*****************************************************************************/
-
-
-int
-t_size(int n)
- /* convert this to an internal size */
-{
- int i; /* loop index */
-
-
-/*
- *
- * Converts a point size into an internal size that can be used as an index into
- * pstab[]. The internal size is one plus the index of the least upper bound of
- * n in pstab[], or nsizes if n is larger than all the listed sizes.
- *
- */
-
-
- if ( n <= pstab[0] )
- return(1);
- else if (n >= pstab[nsizes-1])
- return(nsizes);
-
- for ( i = 0; n > pstab[i]; i++ ) ;
-
- return(i+1);
-
-} /* End of t_size */
-
-
-/*****************************************************************************/
-
-
-static void
-setsize(int n)
- /* new internal size */
-{
-
-
-/*
- *
- * Now using internal size n, where pstab[n-1] is the best available approximation
- * to the size troff asked for.
- *
- */
-
-
- size = n;
-
-} /* End of setsize */
-
-
-/*****************************************************************************/
-
-
-static void
-t_fp(int n, char *s, char *si)
- /* n - this position */
- /* s - now has this font mounted */
- /* si - its internal number */
-
-
-{
-
-
-/*
- *
- * Updates nfonts and the array that keeps track of the mounted fonts. Called from
- * loadfont() after an "x font pos font" command is read, and if pos is larger than
- * the current value assigned to nfonts we set gotspecial to FALSE to make sure
- * t_font() loads all the special fonts after the last legitimate font position.
- *
- */
-
-
- fontname[n].name = s;
- fontname[n].number = atoi(si);
-
- if ( n == lastfont ) /* force a call to t_sf() */
- lastfont = -1;
-
- if ( n > nfonts ) { /* got more positions */
- nfonts = n;
- gotspecial = FALSE;
- } /* End if */
-
-} /* End of t_fp */
-
-
-/*****************************************************************************/
-
-int
-t_font(char *s)
- /* use font in this position next */
-{
- int n;
-
-
-/*
- *
- * Converts the string *s into an integer and checks to make sure it's a legal
- * font position. Also arranges to mount all the special fonts after the last
- * legitimate font (by calling loadspecial()), provided it hasn't already been
- * done.
- *
- */
-
-
- n = atoi(s);
-
- if ( seenpage == TRUE ) {
- if ( n < 0 || n > nfonts )
- error(FATAL, "illegal font position %d", n);
-
- if ( gotspecial == FALSE )
- loadspecial();
- } /* End if */
-
- return(n);
-
-} /* End of t_font */
-
-
-/*****************************************************************************/
-
-
-static void
-setfont(int n)
- /* use the font mounted here */
-{
-
-
-/*
- *
- * troff wants to use the font that's been mounted in position n. All we do here
- * is update the variable that keeps track of the current position. PostScript
- * font changes are handled in t_sf(), and are only generated right before we're
- * ready to print or draw something.
- *
- */
-
-
- if ( n < 0 || n > NFONT )
- error(FATAL, "illegal font %d", n);
- if ( fontname[n].name == NULL && fontname[n].number == 0)
- loaddefault();
- if ( fontname[n].name == NULL && fontname[n].number == 0)
- error(FATAL,
- "font %d not loaded: check 'dpost' input for 'x font %d XXX' before 'f%d'",
- n, n, n);
-
- font = n;
-
-} /* End of setfont */
-
-
-/*****************************************************************************/
-
-void
-t_sf(void)
-{
- int fnum; /* internal font number */
-
-
-/*
- *
- * Called whenever we need to use a new font or size. Only done right before we
- * print a character. The seenfonts[] array keeps track of the fonts we've used.
- * Helps manage host resident fonts and the DOCUMENTFONTS comment that's put out
- * at the end of the job. The array is indexed by internal number. Only works for
- * fonts that have internal numbers less than or equal to MAXINTERNAL.
- *
- */
-
-
- if ( fontname[font].name == NULL )
- return;
-
- endtext();
-
- if ( (fnum = fontname[font].number) > MAXINTERNAL || fnum < 0 )
- fnum = 0;
-
- if ( fnum > 0 && seenfonts[fnum] == 0 && hostfontdir != NULL ) {
- sprintf(temp, "%s/%s", hostfontdir, fontname[font].name);
- if ( access(temp, 04) == 0 )
- doglobal(temp);
- } /* End if */
-
- if ( tf == stdout ) {
- lastfont = font;
- lastsize = size;
- if ( seenfonts[fnum] == 0 )
- documentfonts();
- seenfonts[fnum] = 1;
- } /* End if */
-
- fprintf(tf, "%d %s f\n", pstab[size-1], fontname[font].name);
-
- if ( fontheight != 0 || fontslant != 0 )
- fprintf(tf, "%d %d changefont\n", fontslant, (fontheight != 0) ? fontheight : pstab[size-1]);
-
-} /* End of t_sf */
-
-
-/*****************************************************************************/
-
-
-static void
-t_charht(int n)
- /* use this as the character height */
-{
-
-/*
- *
- * Remembers the requested height, from 'x H n'. Forces a call to t_sf(), which
- * is where the real work is done, by setting lastfont to -1.
- *
- */
-
- fontheight = (n == pstab[size-1]) ? 0 : n;
- lastfont = -1;
-
-} /* End of t_charht */
-
-
-/*****************************************************************************/
-
-
-static void
-t_slant(int n)
- /* slant characters this many degrees */
-{
-
-/*
- *
- * Remembers the requested slant, from 'x X n'. Forces a call to t_sf(), which
- * is where the real work is done, by setting lastfont to -1.
- *
- */
-
- fontslant = n;
- lastfont = -1;
-
-} /* End of t_slant */
-
-
-/*****************************************************************************/
-
-
-static void
-t_reset(int c)
- /* pause or restart */
-{
-
-/*
- *
- * Found an "x stop" or "x pause" command. Although nothing's done here we could
- * add code to reset everything so dpost could handle multiple files formatted for
- * different devices.
- *
- */
-
-
-} /* End of t_reset */
-
-
-/*****************************************************************************/
-
-
-static void
-t_trailer(void)
-{
-
-/*
- *
- * Called after we find an "x trailer" in the input file. Forcing out the last
- * page is done at the end of conv(), but probably belongs here.
- *
- */
-
-
- endtext();
-
-} /* End of t_trailer */
-
-
-/*****************************************************************************/
-
-
-void
-hgoto(int n)
- /* new horizontal position */
-{
-
-
-/*
- *
- * Want to be at this absolute horizontal position next. Actual motion commands
- * are generated in oput(), charlib(), and the drawing routines.
- *
- */
-
-
- hpos = n;
-
-} /* End of hgoto */
-
-
-/*****************************************************************************/
-
-
-static void
-hmot(int n)
- /* move this far horizontally */
-{
-
-/*
- *
- * Handles relative horizontal motion. troff's current positon, as recorded in
- * in hpos, is changed by n units. Usually called right before we're supposed to
- * print a character.
- *
- */
-
-
- hpos += n;
-
-} /* End of hmot */
-
-
-/*****************************************************************************/
-
-
-void
-vgoto(int n)
- /* new vertical position */
-{
-
-/*
- *
- * Moves vertically in troff's coordinate system to absolute position n.
- *
- */
-
-
- vpos = n;
-
-} /* End of vgoto */
-
-
-/*****************************************************************************/
-
-
-static void
-vmot(int n)
- /* move this far vertically */
-{
-
-/*
- *
- * Handles relative vertical motion of n units in troff's coordinate system.
- *
- */
-
-
- vpos += n;
-
-} /* End of vmot */
-
-
-/*****************************************************************************/
-
-
-void
-xymove(int x, int y)
- /* this is where we want to be */
-{
-
-/*
- *
- * Makes sure the post-processor and printer agree about the current position.
- *
- */
-
-
- hgoto(x);
- vgoto(y);
-
- fprintf(tf, "%d %d m\n", hpos, vpos);
-
- lastx = hpos;
- lasty = vpos;
-
-} /* End of xymove */
-
-
-/*****************************************************************************/
-
-
-static void
-put1s(char *s)
- /* find and print this character */
-{
- static int i = 0; /* last one we found - usually */
-
-/*
- *
- * *s points to the start of a two character string that represents one of troff's
- * special characters. To print it we first look for *s in the chname[] array using
- * chtab[i] to find the string representing character i in chname[]. If the lookup
- * is successful we add 128 to i and ask put1() to finish printing the character.
- * We remember the index where the last character was found because requests to
- * print a special character often come in bunches (eg. drawing lines with \(ru).
- *
- */
-
-
- if ( strcmp(s, &chname[chtab[i]]) != 0 )
- for ( i = 0; i < nchtab; i++ )
- if ( strcmp(&chname[chtab[i]], s) == 0 )
- break;
-
- if ( i < nchtab )
- put1(i + 128);
- else i = 0;
-
-} /* End of put1s */
-
-
-/*****************************************************************************/
-
-
-static void
-put1(int c)
- /* want to print this character */
-{
-
- int i; /* character code from fitab */
- int j; /* number of fonts we've checked so far */
- int k; /* font we're currently looking at */
- char *pw; /* font widthtab and */
- char *p; /* and codetab where c was found */
- int code; /* code used to get c printed */
- int ofont; /* font when we started */
-
-
-/*
- *
- * Arranges to have character c printed. If c < 128 it's a simple ASCII character,
- * otherwise it's a special character. Things done here have to agree with the way
- * the font tables were built by makedev, and work as follows. First we subtract
- * 32 from c because the tables don't record the non-graphic ASCII characters.
- * If fitab[k][c] isn't zero the character is on font k and the value is an index
- * that can be used to recover width and character code data from the other two
- * tables. If fitab[k][c] is zero the character isn't defined on font k and we
- * check the next font, which is found as follows. The current font is the first
- * one we check, and it's followed by a circular search of all the remaining fonts
- * that starts with the first special font and skips font position 0. If character
- * c is found somewhere besides the current font we change to that font and use
- * fitab[k][c] to locate missing data in the other two tables. The width of the
- * character can be found at widthtab[k][c] while codetab[k][c] is whatever we
- * need to tell the printer to have character c printed. lastc records the real
- * name of the character because it's lost by the time oput() gets called but
- * charlib() may need it.
- *
- * Took all the debugging stuff out because at least this part of the program is
- * reasonably solid.
- *
- */
-
-
- lastc = c; /* charlib() needs the name not the code */
- if ( (c -= 32) <= 0 ) /* probably never happens */
- return;
-
- k = ofont = font;
-
- if ( (i = fitab[k][c] & BMASK) != 0 ) { /* it's on this font */
- p = codetab[font];
- pw = widthtab[font];
- } else if ( smnt > 0 ) { /* on special (we hope) */
- for ( k=smnt, j=0; j <= nfonts; j++, k = (k+1) % (nfonts+1) ) {
- if ( k == 0 ) continue;
- if ( (i = fitab[k][c] & BMASK) != 0 ) {
- p = codetab[k];
- pw = widthtab[k];
- setfont(k);
- break;
- } /* End if */
- } /* End for */
- } /* End else */
-
- if ( i != 0 && (code = p[i] & BMASK) != 0 ) {
- lastw = widthfac * (((pw[i] & BMASK) * pstab[size-1] + unitwidth/2) / unitwidth);
- oput(code);
- } /* End if */
-
- if ( font != ofont )
- setfont(ofont);
-
-} /* End of put1 */
-
-
-/*****************************************************************************/
-
-
-static void
-oput(int c)
- /* want to print this character */
-{
-
-/*
- *
- * Arranges to print the character whose code is c in the current font. All the
- * actual positioning is done here, in charlib(), or in the drawing routines.
- *
- */
-
-
- if ( textcount > MAXSTACK ) /* don't put too much on the stack? */
- endtext();
-
- if ( font != lastfont || size != lastsize )
- t_sf();
-
- if ( vpos != lasty )
- endline();
-
- starttext();
-
- if ( ABS(hpos - lastx) > slop )
- endstring();
-
- if ( isascii(c) && isprint(c) )
- switch ( c ) {
- case '(':
- case ')':
- case '\\':
- addchar('\\');
-
- default:
- addchar(c);
- } /* End switch */
- else if ( c > 040 )
- addoctal(c);
- else charlib(c);
-
- lastx += lastw;
-
-} /* End of oput */
-
-
-/*****************************************************************************/
-
-
-static void
-starttext(void)
-{
-
-/*
- * Called whenever we want to be sure we're ready to start collecting characters
- * for the next call to PostScript procedure t (ie. the one that prints them). If
- * textcount is positive we've already started, so there's nothing to do. The more
- * complicated encoding schemes save text strings in the strings[] array and need
- * detailed information about the strings when they're written to the output file
- * in endtext().
- *
- */
-
-
- if ( textcount < 1 ) {
- switch ( encoding ) {
- case 0:
- case 1:
- putc('(', tf);
- break;
-
- case 2:
- case 3:
- strptr = strings;
- spacecount = 0;
- line[1].str = strptr;
- line[1].dx = 0;
- line[1].spaces = 0;
- line[1].start = hpos;
- line[1].width = 0;
- break;
-
- case MAXENCODING+1: /* reverse video */
- if ( lastend == -1 )
- lastend = hpos;
- putc('(', tf);
- break;
-
- case MAXENCODING+2: /* follow a funny baseline */
- putc('(', tf);
- break;
- } /* End switch */
- textcount = 1;
- lastx = stringstart = hpos;
- } /* End if */
-
-} /* End of starttext */
-
-
-/*****************************************************************************/
-
-
-void
-endtext(void)
-{
-
- int i; /* loop index */
-
-
-/*
- *
- * Generates a call to the PostScript procedure that processes all the text we've
- * accumulated - provided textcount is positive.
- *
- */
-
- if ( textcount > 0 ) { /* started working on some text */
- switch ( encoding ) {
- case 0:
- fprintf(tf, ")%d t\n", stringstart);
- break;
-
- case 1:
- fprintf(tf, ")%d %d t\n", stringstart, lasty);
- break;
-
- case 2:
- *strptr = '\0';
- line[textcount].width = lastx - line[textcount].start;
- if ( spacecount != 0 || textcount != 1 ) {
- for ( i = textcount; i > 0; i-- )
- fprintf(tf, "(%s)%d %d", line[i].str, line[i].spaces, line[i].width);
- fprintf(tf, " %d %d %d t\n", textcount, stringstart, lasty);
- } else fprintf(tf, "(%s)%d %d w\n", line[1].str, stringstart, lasty);
- break;
-
- case 3:
- *strptr = '\0';
- if ( spacecount != 0 || textcount != 1 ) {
- for ( i = textcount; i > 0; i-- )
- fprintf(tf, "(%s)%d", line[i].str, line[i].dx);
- fprintf(tf, " %d %d %d t\n", textcount, stringstart, lasty);
- } else fprintf(tf, "(%s)%d %d w\n", line[1].str, stringstart, lasty);
- break;
-
- case MAXENCODING+1:
- fprintf(tf, ")%d ", stringstart);
- fprintf(tf, "%d %d drawrvbox ", lastend - rvslop, (int)(lastx + .5) + rvslop);
- fprintf(tf, "t\n", stringstart);
- lastend = (lastx + .5) + 2 * rvslop;
- break;
-
- case MAXENCODING+2:
- fprintf(tf, ")%d %d t\n", stringstart, lasty);
- break;
- } /* End switch */
- } /* End if */
-
- textcount = 0;
-
-} /* End of endtext */
-
-
-/*****************************************************************************/
-
-
-static void
-endstring(void)
-{
- int dx;
-
-/*
- *
- * Horizontal positions are out of sync. End the last open string, adjust the
- * printer's position, and start a new string. Assumes we've already started
- * accumulating text.
- *
- */
-
-
- switch ( encoding ) {
- case 0:
- case 1:
- fprintf(tf, ")%d(", stringstart);
- textcount++;
- lastx = stringstart = hpos;
- break;
-
- case 2:
- case 3:
- dx = hpos - lastx;
- if ( spacecount++ == 0 )
- line[textcount].dx = dx;
- if ( line[textcount].dx != dx ) {
- *strptr++ = '\0';
- line[textcount].width = lastx - line[textcount].start;
- line[++textcount].str = strptr;
- *strptr++ = ' ';
- line[textcount].dx = dx;
- line[textcount].start = lastx;
- line[textcount].width = 0;
- line[textcount].spaces = 1;
- } else {
- *strptr++ = ' ';
- line[textcount].spaces++;
- } /* End else */
- lastx += dx;
- break;
-
- case MAXENCODING+1:
- fprintf(tf, ")%d(", stringstart);
- textcount++;
- lastx = stringstart = hpos;
- break;
-
- case MAXENCODING+2:
- endtext();
- starttext();
- break;
-
- } /* End switch */
-
-} /* End of endstring */
-
-
-/*****************************************************************************/
-
-
-static void
-endline(void)
-{
-
-/*
- *
- * The vertical position has changed. Dump any accumulated text, then adjust
- * the printer's vertical position.
- *
- */
-
-
- endtext();
-
- if ( encoding == 0 || encoding == MAXENCODING+1 )
- fprintf(tf, "%d %d m\n", hpos, vpos);
-
- lastx = stringstart = lastend = hpos;
- lasty = vpos;
-
-} /* End of endline */
-
-
-/*****************************************************************************/
-
-
-static void
-addchar(int c)
- /* next character in current string */
-{
-
-/*
- *
- * Does whatever is needed to add character c to the current string.
- *
- */
-
-
- switch ( encoding ) {
- case 0:
- case 1:
- putc(c, tf);
- break;
-
- case 2:
- case 3:
- *strptr++ = c;
- break;
-
- case MAXENCODING+1:
- case MAXENCODING+2:
- putc(c, tf);
- break;
- } /* End switch */
-
-} /* End of addchar */
-
-
-/*****************************************************************************/
-
-
-static void
-addoctal(int c)
- /* add it as an octal escape */
-{
-
-
-/*
- *
- * Adds c to the current string as an octal escape \ddd.
- *
- */
-
-
- switch ( encoding ) {
- case 0:
- case 1:
- fprintf(tf, "\\%o", c);
- break;
-
- case 2:
- case 3:
- sprintf(strptr, "\\%o", c);
- strptr += strlen(strptr);
- break;
-
- case MAXENCODING+1:
- case MAXENCODING+2:
- fprintf(tf, "\\%o", c);
- break;
- } /* End switch */
-
-} /* End of addoctal */
-
-
-/*****************************************************************************/
-
-
-static void
-charlib(int code)
- /* either 1 or 2 */
-{
- char *name; /* name of the character */
- char tname[10]; /* in case it's a single ASCII character */
-
-
-/*
- *
- * Called from oput() for characters having codes less than 040. Special files
- * that define PostScript procedures for certain characters can be found in
- * directory *fontdir/devpost/charlib. If there's a file that has the same name as
- * the character we're trying to print it's copied to the output file, otherwise
- * nothing, except some positioning, is done.
- *
- * All character definitions are only made once. Subsequent requests to print the
- * character generate a call to a procedure that begins with the prefix build_ and
- * ends with the character's name. Special characters that are assigned codes
- * other than 1 are assumed to have additional data files that should be copied
- * to the output file immediately after the build_ call. Those data files should
- * end in the suffix .map, and usually will be a hex representation of a bitmap.
- *
- */
-
-
- endtext();
-
- if ( lastc < 128 ) { /* just a simple ASCII character */
- sprintf(tname, "%.3o", lastc);
- name = tname;
- } else name = &chname[chtab[lastc - 128]];
-
- if ( downloaded[lastc] == 0 ) {
- sprintf(temp, "%s/dev%s/charlib/%s", fontdir, realdev, name);
- if ( access(temp, 04) == 0 && doglobal(temp) == TRUE ) {
- downloaded[lastc] = 1;
- t_sf();
- } /* End if */
- } /* End if */
-
- if ( downloaded[lastc] == 1 ) {
- xymove(hpos, vpos);
- fprintf(tf, "%d build_%s\n", (int) lastw, name);
- if ( code != 1 ) { /* get the bitmap or whatever */
- sprintf(temp, "%s/dev%s/charlib/%s.map", fontdir, realdev, name);
- if ( access(temp, 04) == 0 && tf == stdout )
- cat(temp);
- } /* End if */
- fprintf(tf, "%d %d m\n", stringstart = hpos + lastw, vpos);
- } /* End if */
-
-} /* End of charlib */
-
-
-/*****************************************************************************/
-
-
-int
-doglobal(char *name)
- /* copy this to the output - globally */
-{
- int val = FALSE; /* returned to the caller */
-
-
-/*
- *
- * Copies file *name to the output file and brackets it with whatever commands are
- * needed to have it exported to the global environment. TRUE is returned if we
- * successfully add file *name to the output file.
- *
- */
-
-
- if ( tf == stdout ) {
- endtext();
- fprintf(tf, "cleartomark restore\n");
- fprintf(tf, "%s", BEGINGLOBAL);
- val = cat(name);
- fprintf(tf, "%s", ENDGLOBAL);
- fprintf(tf, "save mark\n");
- reset();
- } /* End if */
-
- return(val);
-
-} /* End of doglobal */
-
-
-/*****************************************************************************/
-
-
-static void
-documentfonts(void)
-{
- FILE *fp_in; /* PostScript font name read from here */
- FILE *fp_out; /* and added to this file */
-
-
-/*
- *
- * Whenever a new font is used we try to record the appropriate PostScript font
- * name in *temp_file for the DOCUMENTFONTS comment that's put out in done().
- * By default PostScript font names are found in /usr/lib/font/devpost. Fonts
- * that have a .name file are recorded in *temp_file. The first string in that
- * file is expected to be that font's (long) PostScript name.
- *
- */
-
-
- if ( temp_file == NULL ) /* generate a temp file name */
- if ( (temp_file = tempnam(TEMPDIR, "dpost")) == NULL )
- return;
-
- sprintf(temp, "%s/dev%s/%s.name", fontdir, realdev, fontname[font].name);
-
- if ( (fp_in = fopen(temp, "r")) != NULL ) {
- if ( (fp_out = fopen(temp_file, "a")) != NULL ) {
- if ( fscanf(fp_in, "%s", temp) == 1 ) {
- if ( docfonts++ == 0 )
- fprintf(fp_out, "%s", DOCUMENTFONTS);
- else if ( (docfonts - 1) % 8 == 0 )
- fprintf(fp_out, "\n%s", CONTINUECOMMENT);
- fprintf(fp_out, " %s", temp);
- } /* End if */
- fclose(fp_out);
- } /* End if */
- fclose(fp_in);
- } /* End if */
-
-} /* End of documentfonts */
-
-
-/*****************************************************************************/
-
-
-static void
-redirect(int pg)
- /* next page we're printing */
-{
- static FILE *fp_null = NULL; /* if output is turned off */
-
-
-/*
- *
- * If we're not supposed to print page pg, tf will be directed to /dev/null,
- * otherwise output goes to stdout.
- *
- */
-
-
- if ( pg >= 0 && in_olist(pg) == ON )
- tf = stdout;
- else if ( (tf = fp_null) == NULL )
- tf = fp_null = fopen("/dev/null", "w");
-
-} /* End of redirect */
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/dpost.h b/usr/src/cmd/lp/filter/postscript/dpost/dpost.h
deleted file mode 100644
index 49b469a001..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/dpost.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- *
- * Definitions used by the troff post-processor for PostScript printers.
- *
- * DEVNAME should be the name of a device whose font files accurately describe
- * what's available on the target printer. It's a string that's combined with
- * "/usr/lib/font/dev" to locate the final font directory. It can be changed
- * using the -T option, but you may end up getting garbage - the character code
- * field must agree with PostScript's character encoding scheme for each font and
- * troff's one or two character font names must be mapped into the appropriate
- * PostScript font names (typically in the prologue)
- *
- *
- */
-
-#define DEVNAME "post" /* name of the target printer */
-
-/*
- *
- * NFONT is the most font positions we'll allow. It's set ridiculously high for no
- * good reason.
- *
- */
-
-#define NFONT 60 /* max number of font positions */
-
-/*
- *
- * SLOP controls how much horizontal positioning error we'll accept and primarily
- * helps when we're emulating another device. It's used when we output characters
- * in oput() to check if troff and the printer have gotten too far out of sync.
- * Given in units of points and can be changed using the -S option. Converted to
- * machine units in t_init() after the resolution is known.
- *
- */
-
-#define SLOP .2 /* horizontal error - in points */
-
-/*
- *
- * Fonts are assigned unique internal numbers (positive integers) in their ASCII
- * font files. MAXINTERNAL is the largest internal font number that lets the host
- * resident and DOCUMENTFONTS stuff work. Used to allocate space for an array that
- * keeps track of what fonts we've seen and perhaps downloaded - could be better!
- *
- */
-
-#define MAXINTERNAL 256
-
-/*
- *
- * Several different text line encoding schemes are supported. Print time should
- * decrease as the value assigned to encoding (in dpost.c) increases, although the
- * only encoding that's well tested is the lowest level one, which produces output
- * essentially identical to the original version of dpost. Setting DFLTENCODING to
- * 0 will give you the most stable (but slowest) encoding. The encoding scheme can
- * also be set on the command line using the -e option. Faster methods are based
- * on widthshow and may not place words exactly where troff wanted, but errors will
- * usually not be noticeable.
- *
- */
-
-#define MAXENCODING 3
-
-#ifndef DFLTENCODING
-#define DFLTENCODING 0
-#endif
-
-/*
- *
- * The encoding scheme controls how lines of text are output. In the lower level
- * schemes words and horizontal positions are put on the stack as they're read and
- * when they're printed it's done in reverse order - the first string printed is
- * the one on top of the stack and it's the last one on the line. Faster methods
- * may be forced to reverse the order of strings on the stack, making the top one
- * the first string on the line. STRINGSPACE sets the size of a character array
- * that's used to save the strings that make up a line of text so they can be
- * output in reverse order or perhaps combined in groups for widthshow.
- *
- * MAXSTACK controls how far we let PostScript's operand stack grow and determines
- * the number of strings we'll save before printing all or part of a line of text.
- * The internal limit in PostScript printers built by Adobe is 500, so MAXSTACK
- * should never be bigger than about 240!
- *
- * Line is a structure used to keep track of the words (or rather strings) on the
- * current line that have been read but not printed. dx is the width troff wants
- * to use for a space in the current string. start is where the string began, width
- * is the total width of the string, and spaces is the number of space characters
- * in the current string. *str points to the start of the string in the strings[]
- * array. The Line structure is only used in the higher level encoding schemes.
- *
- */
-
-#define MAXSTACK 50 /* most strings we'll save at once */
-#define STRINGSPACE 2000 /* bytes available for string storage */
-
-typedef struct {
-
- char *str; /* where the string is stored */
- int dx; /* width of a space */
- int spaces; /* number of space characters */
- int start; /* horizontal starting position */
- int width; /* and its total width */
-
-} Line;
-
-/*
- *
- * Simple stuff used to map unrecognized font names into something reasonable. The
- * mapping array is initialized using FONTMAP and used in loadfont() whenever the
- * job tries to use a font that we don't recognize. Normally only needed when we're
- * emulating another device.
- *
- */
-
-typedef struct {
-
- char *name; /* font name we're looking for */
- char *use; /* and this is what we should use */
-
-} Fontmap;
-
-#define FONTMAP \
- \
- { \
- "G", "H", \
- "LO", "S", \
- "S2", "S", \
- "GI", "HI", \
- "HM", "H", \
- "HK", "H", \
- "HL", "H", \
- "PA", "R", \
- "PI", "I", \
- "PB", "B", \
- "PX", "BI", \
- NULL, NULL, \
- }
-
-/*
- *
- * The Fontmap stuff isn't quite enough if we expect to do a good job emulating
- * other devices. A recognized font in *realdev's tables may be have a different
- * name in *devname's tables, and using the *realdev font may not be the best
- * choice. The fix is to use an optional lookup table for *devname that's used to
- * map font names into something else before anything else is done. The table we
- * use is /usr/lib/font/dev*realdev/fontmaps/devname and if it exists getdevmap()
- * uses the file to fill in a Devfontmap array. Then whenever an "x font pos name"
- * command is read mapdevfont() uses the lookup table to map name into something
- * else before loadfont() is called.
- *
- */
-
-typedef struct {
-
- char name[3]; /* map this font name */
- char use[3]; /* into this one */
-
-} Devfontmap;
-
-/*
- *
- * Some of the non-integer valued functions in dpost.c.
- *
- */
-
-char *mapfont();
-char *mapdevfont();
-
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/draw.c b/usr/src/cmd/lp/filter/postscript/dpost/draw.c
deleted file mode 100644
index e357592748..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/draw.c
+++ /dev/null
@@ -1,777 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/*
- * University Copyright- Copyright (c) 1982, 1986, 1988
- * The Regents of the University of California
- * All Rights Reserved
- *
- * University Acknowledgment- Portions of this document are derived from
- * software developed by the University of California, Berkeley, and its
- * contributors.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * Drawing routines used by dpost. Almost no real work is done here. Instead
- * the required calculations are done in special Postscript procedures that
- * include:
- *
- *
- * Dl
- *
- * x1 y1 x y Dl -
- *
- * Starts a new path and then draws a line from the current point
- * (x, y) to (x1, y1).
- *
- * De
- *
- * x y a b De -
- *
- * Starts a new path and then draws an ellipse that has its left side
- * at the current point (x, y) and horizontal and vertical axes lengths
- * given by a and b respectively.
- *
- * Da
- *
- * x y dx1 dy1 dx2 dy2 Da -
- *
- * Starts a new segment and then draws a circular arc from the current
- * point (x, y) to (x + dx1 + dx2, y + dy1 + dy2). The center of the
- * circle is at (x + dx1, y + dy1). Arcs always go counter-clockwise
- * from the starting point to the end point.
- *
- * DA
- *
- * x y dx1 dy1 dx2 dy2 DA -
- *
- * Draws a clockwise arc from (x, y) to (x + dx1 + dx2, y + dy1 + dy2)
- * with center at (x + dx1, y + dy1). Only needed when we're building
- * large paths that use arcs and want to control the current point. The
- * arguments passed to drawarc() will be whatever they would have been
- * for a counter-clockwise arc, so we need to map them into appropriate
- * arguments for PostScript's arcn operator. The mapping is,
- *
- * x = hpos + dx1' + dx2'
- * y = vpos + dy1' + dy2'
- * dx1 = -dx2'
- * dy1 = -dy2'
- * dx2 = -dx1'
- * dy2 = -dy1'
- *
- * where primed values represent the drawarc() arguments and (hpos, vpos)
- * is our current position.
- *
- * Ds
- *
- * x0 y0 x1 y1 x2 y2 Ds -
- *
- * Starts a new segment and then draws a quadratic spline connecting
- * point ((x0 + x1)/2, (y0 + y1)/2) to ((x1 + x2)/2, (y1 + y2)/2).
- * The points used in Postscript's curveto procedure are given by,
- *
- * x0' = (x0 + 5 * x1) / 6
- * x1' = (x2 + 5 * x1) / 6
- * x2' = (x1 + x2) / 2
- *
- * with similar equations for the y coordinates.
- *
- * By default all the PostScript drawing procedures begin with a newpath (just to
- * be safe) and end with a stroke, which essentially isolates the path elements
- * built by the drawing procedures. In order to accommodate big paths built from
- * smaller pieces each of the PostScript drawing procedures can forced to retain
- * the path that's being built. That's what happens in beginpath() when an "x X
- * BeginPath" command is read. beginpath() sets the PostScript variable inpath to
- * true, and that essentially eliminates the newpath/stroke pair that bracket the
- * individual pieces. In that case the path is terminated and drawn when dpost
- * reads an "x X DrawPath" command.
- *
- * Early versions of dpost included the PostScript drawing procedures as part of
- * the prologue, and as a result they were included with every job, even if they
- * were never used. This version has separated the drawing procedures from the
- * default prologue (they're now in *drawfile) and only includes them if they're
- * really needed, which is yet another convenient violation of page independence.
- * Routine getdraw() is responsible for adding *drawfile to the output file, and
- * if it can't read *drawfile it continues on as if nothing happened. That means
- * everything should still work if you append *drawfile to *prologue and then
- * delete *drawfile.
- *
- */
-
-
-#include <stdio.h>
-#include <math.h>
-
-#include "gen.h" /* general purpose definitions */
-#include "ext.h" /* external variable definitions */
-
-
-int gotdraw = FALSE; /* TRUE when *drawfile has been added */
-int gotbaseline = FALSE; /* TRUE after *baselinefile is added */
-int inpath = FALSE; /* TRUE if we're putting pieces together */
-
-
-/*
- *
- * All these should be defined in file dpost.c.
- *
- */
-
-
-extern int hpos;
-extern int vpos;
-extern int encoding;
-extern int maxencoding;
-extern int realencoding;
-
-extern char *drawfile;
-extern char *baselinefile;
-extern FILE *tf;
-
-void drawcirc(int);
-void drawellip(int, int);
-static void parsebuf(char *);
-
-/*****************************************************************************/
-
-
-void
-getdraw(void)
-{
-
-
-/*
- *
- * Responsible for making sure the PostScript drawing procedures are downloaded
- * from *drawfile. Stuff is done at most once per job, and only if the job needs
- * them. For now I've decided not to quit if we can't read the drawing file. That
- * pretty much assumes an old version of prologue is being used that includes all
- * the drawing procedures.
- *
- */
-
-
- if ( gotdraw == FALSE && access(drawfile, 04) == 0 )
- doglobal(drawfile);
-
- if ( tf == stdout )
- gotdraw = TRUE;
-
-} /* End of getdraw */
-
-
-/*****************************************************************************/
-
-
-void
-drawline(int dx, int dy)
- /* endpoint is (hpos+dx, vpos+dy) */
-{
-
-/*
- *
- * Draws a line from (hpos, vpos) to (hpos+dx, vpos+dy), and leaves the current
- * position at the endpoint.
- *
- */
-
-
- if ( dx == 0 && dy == 0 )
- drawcirc(1);
- else fprintf(tf, "%d %d %d %d Dl\n", hpos + dx, vpos + dy, hpos, vpos);
-
- hgoto(hpos+dx); /* where troff expects to be */
- vgoto(vpos+dy);
-
- resetpos(); /* not sure where the printer is */
-
-} /* End of drawline */
-
-
-/*****************************************************************************/
-
-
-void
-drawcirc(int d)
- /* diameter of the circle */
-{
-
-/*
- *
- * Draws a circle of diameter d with the left 'side' of the circle at the
- * current point. After we're finished drawing we move the current position
- * to the right side.
- *
- */
-
- drawellip(d, d);
-
-} /* End of drawcirc */
-
-
-/*****************************************************************************/
-
-
-void
-drawellip(int a, int b)
- /* axes lengths for the ellipse */
-{
-
-/*
- *
- * Draws an ellipse having axes lengths horizontally and vertically of a and
- * b. The left side of the ellipse is at the current point. After we're done
- * drawing the path we move the current position to the right side.
- *
- */
-
-
- if ( a == 0 && b == 0 )
- return;
-
- fprintf(tf, "%d %d %d %d De\n", hpos, vpos, a, b);
-
- hgoto(hpos + a); /* where troff expects to be */
- vgoto(vpos);
-
- resetpos(); /* not sure where the printer is */
-
-} /* End of drawellip */
-
-
-/*****************************************************************************/
-
-
-void
-drawarc(int dx1, int dy1, int dx2, int dy2, int c)
- /* dx1, dy1 - vector from current pos to center */
- /* dx2, dy2 - from center to end of the arc */
- /* c - clockwise if c is A */
-{
-
-/*
- *
- * If c isn't set to 'A' a counter-clockwise arc is drawn from the current point
- * (hpos, vpos) to (hpos+dx1+dx2, vpos+dy1+dy2). The center of the circle is the
- * point (hpos+dx1, vpos+dy1). If c is 'A' the arc goes clockwise from the point
- * (hpos+dx1+dx2, vpos+dy1+dy2) to (hpos, vpos). Clockwise arcs are only needed
- * if we're building a larger path out of pieces that include arcs, and want to
- * have PostScript manage the path for us. Arguments (for a clockwise arc) are
- * what would have been supplied if the arc was drawn in a counter-clockwise
- * direction, and are converted to values suitable for use with PostScript's arcn
- * operator.
- *
- */
-
-
- if ( (dx1 != 0 || dy1 != 0) && (dx2 != 0 || dy2 != 0) )
- if ( c != 'A' )
- fprintf(tf, "%d %d %d %d %d %d Da\n", hpos, vpos, dx1, dy1, dx2, dy2);
- else fprintf(tf, "%d %d %d %d %d %d DA\n", hpos+dx1+dx2, vpos+dy1+dy2,
- -dx2, -dy2, -dx1, -dy1);
-
- hgoto(hpos + dx1 + dx2); /* where troff expects to be */
- vgoto(vpos + dy1 + dy2);
-
- resetpos(); /* not sure where the printer is */
-
-} /* End of drawarc */
-
-
-/*****************************************************************************/
-
-
-void
-drawspline(FILE *fp, int flag)
- /* fp - input for point list */
- /* flag - flag!=1 connect end points */
-{
-
-
- int x[100], y[100];
- int i, N;
-
-
-/*
- *
- * Spline drawing routine for Postscript printers. The complicated stuff is
- * handled by procedure Ds, which should be defined in the library file. I've
- * seen wrong implementations of troff's spline drawing, so fo the record I'll
- * write down the parametric equations and the necessary conversions to Bezier
- * cubic splines (as used in Postscript).
- *
- *
- * Parametric equation (x coordinate only):
- *
- *
- * (x2 - 2 * x1 + x0) 2 (x0 + x1)
- * x = ------------------ * t + (x1 - x0) * t + ---------
- * 2 2
- *
- *
- * The coefficients in the Bezier cubic are,
- *
- *
- * A = 0
- * B = (x2 - 2 * x1 + x0) / 2
- * C = x1 - x0
- *
- *
- * while the current point is,
- *
- * current-point = (x0 + x1) / 2
- *
- * Using the relationships given in the Postscript manual (page 121) it's easy to
- * see that the control points are given by,
- *
- *
- * x0' = (x0 + 5 * x1) / 6
- * x1' = (x2 + 5 * x1) / 6
- * x2' = (x1 + x2) / 2
- *
- *
- * where the primed variables are the ones used by curveto. The calculations
- * shown above are done in procedure Ds using the coordinates set up in both
- * the x[] and y[] arrays.
- *
- * A simple test of whether your spline drawing is correct would be to use cip
- * to draw a spline and some tangent lines at appropriate points and then print
- * the file.
- *
- */
-
-
- for ( N = 2; N < sizeof(x)/sizeof(x[0]); N++ )
- if (fscanf(fp, "%d %d", &x[N], &y[N]) != 2)
- break;
-
- x[0] = x[1] = hpos;
- y[0] = y[1] = vpos;
-
- for (i = 1; i < N; i++) {
- x[i+1] += x[i];
- y[i+1] += y[i];
- } /* End for */
-
- x[N] = x[N-1];
- y[N] = y[N-1];
-
- for (i = ((flag!=1)?0:1); i < ((flag!=1)?N-1:N-2); i++)
- fprintf(tf, "%d %d %d %d %d %d Ds\n", x[i], y[i], x[i+1], y[i+1], x[i+2], y[i+2]);
-
- hgoto(x[N]); /* where troff expects to be */
- vgoto(y[N]);
-
- resetpos(); /* not sure where the printer is */
-
-} /* End of drawspline */
-
-
-/*****************************************************************************/
-
-
-void
-beginpath(char *buf, int copy)
- /* buf - whatever followed "x X BeginPath" */
- /* copy - ignore *buf if FALSE */
-{
-
-/*
- *
- * Called from devcntrl() whenever an "x X BeginPath" command is read. It's used
- * to mark the start of a sequence of drawing commands that should be grouped
- * together and treated as a single path. By default the drawing procedures in
- * *drawfile treat each drawing command as a separate object, and usually start
- * with a newpath (just as a precaution) and end with a stroke. The newpath and
- * stroke isolate individual drawing commands and make it impossible to deal with
- * composite objects. "x X BeginPath" can be used to mark the start of drawing
- * commands that should be grouped together and treated as a single object, and
- * part of what's done here ensures that the PostScript drawing commands defined
- * in *drawfile skip the newpath and stroke, until after the next "x X DrawPath"
- * command. At that point the path that's been built up can be manipulated in
- * various ways (eg. filled and/or stroked with a different line width).
- *
- * String *buf is unnecessary and is only included for compatibility with an early
- * verion of that's still in use. In that version "x X BeginObject" marked the
- * start of a graphical object, and whatever followed it was passed along in *buf
- * and copied to the output file. Color selection is one of the options that's
- * available in parsebuf(), so if we get here we add *colorfile to the output
- * file before doing anything important.
- *
- */
-
-
-
- if ( inpath == FALSE ) {
- endtext();
- getdraw();
- getcolor();
- fprintf(tf, "gsave\n");
- fprintf(tf, "newpath\n");
- fprintf(tf, "%d %d m\n", hpos, vpos);
- fprintf(tf, "/inpath true def\n");
- if ( copy == TRUE )
- fprintf(tf, "%s", buf);
- inpath = TRUE;
- } /* End if */
-
-} /* End of beginpath */
-
-
-/*****************************************************************************/
-
-
-void
-drawpath(char *buf, int copy)
-{
-
-/*
- *
- * Called from devcntrl() whenever an "x X DrawPath" command is read. It marks the
- * end of the path started by the last "x X BeginPath" command and uses whatever
- * has been passed along in *buf to manipulate the path (eg. fill and/or stroke
- * the path). Once that's been done the drawing procedures are restored to their
- * default behavior in which each drawing command is treated as an isolated path.
- * The new version (called after "x X DrawPath") has copy set to FALSE, and calls
- * parsebuf() to figure out what goes in the output file. It's a feeble attempt
- * to free users and preprocessors (like pic) from having to know PostScript. The
- * comments in parsebuf() describe what's handled.
- *
- * In the early version a path was started with "x X BeginObject" and ended with
- * "x X EndObject". In both cases *buf was just copied to the output file, and
- * was expected to be legitimate PostScript that manipulated the current path.
- * The old escape sequence will be supported for a while (for Ravi), and always
- * call this routine with copy set to TRUE.
- *
- *
- */
-
-
- if ( inpath == TRUE ) {
- if ( copy == TRUE )
- fprintf(tf, "%s", buf);
- else parsebuf(buf);
- fprintf(tf, "grestore\n");
- fprintf(tf, "/inpath false def\n");
- reset();
- inpath = FALSE;
- } /* End if */
-
-} /* End of drawpath */
-
-
-/*****************************************************************************/
-
-
-static void
-parsebuf(char *buf)
- /* whatever followed "x X DrawPath" */
-{
- char *p; /* usually the next token */
- char *p1; /* for grabbing arguments */
- char *pend; /* end of the original string (ie. *buf) */
- int gsavelevel = 0; /* non-zero if we've done a gsave */
-
-/*
- *
- * Simple minded attempt at parsing the string that followed an "x X DrawPath"
- * command. Everything not recognized here is simply ignored - there's absolutely
- * no error checking and what was originally in buf is clobbered by strtok().
- * A typical *buf might look like,
- *
- * gray .9 fill stroke
- *
- * to fill the current path with a gray level of .9 and follow that by stroking the
- * outline of the path. Since unrecognized tokens are ignored the last example
- * could also be written as,
- *
- * with gray .9 fill then stroke
- *
- * The "with" and "then" strings aren't recognized tokens and are simply discarded.
- * The "stroke", "fill", and "wfill" force out appropriate PostScript code and are
- * followed by a grestore. In otherwords changes to the grahics state (eg. a gray
- * level or color) are reset to default values immediately after the stroke, fill,
- * or wfill tokens. For now "fill" gets invokes PostScript's eofill operator and
- * "wfill" calls fill (ie. the operator that uses the non-zero winding rule).
- *
- * The tokens that cause temporary changes to the graphics state are "gray" (for
- * setting the gray level), "color" (for selecting a known color from the colordict
- * dictionary defined in *colorfile), and "line" (for setting the line width). All
- * three tokens can be extended since strncmp() makes the comparison. For example
- * the strings "line" and "linewidth" accomplish the same thing. Colors are named
- * (eg. "red"), but must be appropriately defined in *colorfile. For now all three
- * tokens must be followed immediately by their single argument. The gray level
- * (ie. the argument that follows "gray") should be a number between 0 and 1, with
- * 0 for black and 1 for white.
- *
- * To pass straight PostScript through enclose the appropriate commands in double
- * quotes. Straight PostScript is only bracketed by the outermost gsave/grestore
- * pair (ie. the one from the initial "x X BeginPath") although that's probably
- * a mistake. Suspect I may have to change the double quote delimiters.
- *
- */
-
-
- pend = buf + strlen(buf);
- p = strtok(buf, " \n");
-
- while ( p != NULL ) {
- if ( gsavelevel == 0 ) {
- fprintf(tf, "gsave\n");
- gsavelevel++;
- } /* End if */
- if ( strcmp(p, "stroke") == 0 ) {
- fprintf(tf, "closepath stroke\ngrestore\n");
- gsavelevel--;
- } else if ( strcmp(p, "openstroke") == 0 ) {
- fprintf(tf, "stroke\ngrestore\n");
- gsavelevel--;
- } else if ( strcmp(p, "fill") == 0 ) {
- fprintf(tf, "eofill\ngrestore\n");
- gsavelevel--;
- } else if ( strcmp(p, "wfill") == 0 ) {
- fprintf(tf, "fill\ngrestore\n");
- gsavelevel--;
- } else if ( strcmp(p, "sfill") == 0 ) {
- fprintf(tf, "eofill\ngrestore\ngsave\nstroke\ngrestore\n");
- gsavelevel--;
- } else if ( strncmp(p, "gray", strlen("gray")) == 0 ) {
- p1 = strtok(NULL, " \n");
- fprintf(tf, "%s setgray\n", p1);
- } else if ( strncmp(p, "color", strlen("color")) == 0 ) {
- p1 = strtok(NULL, " \n");
- fprintf(tf, "/%s setcolor\n", p1);
- } else if ( strncmp(p, "line", strlen("line")) == 0 ) {
- p1 = strtok(NULL, " \n");
- fprintf(tf, "%s resolution mul 2 div setlinewidth\n", p1);
- } else if ( strncmp(p, "reverse", strlen("reverse")) == 0 )
- fprintf(tf, "reversepath\n");
- else if ( *p == '"' ) {
- for ( ; gsavelevel > 0; gsavelevel-- )
- fprintf(tf, "grestore\n");
- if ( (p1 = p + strlen(p)) < pend )
- *p1 = ' ';
- p = strtok(p, "\"\n");
- fprintf(tf, "%s\n", p);
- } /* End else */
- p = strtok(NULL, " \n");
- } /* End while */
-
- for ( ; gsavelevel > 0; gsavelevel-- )
- fprintf(tf, "grestore\n");
-
-} /* End of parsebuf */
-
-
-/*****************************************************************************/
-
-static void
-getbaseline(void)
-{
-
-/*
- *
- * Responsible for making sure the PostScript procedures needed for printing text
- * along an arbitrary baseline are downloaded from *baselinefile. Done at most
- * once per job, and only if the the stuff is really used.
- *
- */
-
-
- if ( gotbaseline == FALSE && access(baselinefile, 04) == 0 )
- doglobal(baselinefile);
-
- if ( tf == stdout )
- gotbaseline = TRUE;
-
-} /* End of getbaseline */
-
-
-/*****************************************************************************/
-
-
-void
-newbaseline(char *buf)
- /* whatever followed "x X NewBaseline" */
-{
- char *p; /* for eliminating white space etc. */
-
-
-/*
- *
- * Called from devcntrl() whenever an "x X NewBaseline" command is recognized. We
- * assume whatever is in *buf is a set of parametric equations that describe the
- * new baseline. Equations for x(t), y(t), dx/dt, and dy/dt must be written in
- * PostScript, bracketed by { and } characters, and supplied in exactly that order.
- * In particular the equation for x must come first in *buf and it ends up as the
- * last one on the stack, while the equation for dy/dt comes last (in *buf) and
- * ends up on the top of the PostScript stack. For example if *buf is given by,
- *
- * {} {180 mul 3.1416 div cos} {pop 1} {180 mul 3.1416 div sin neg}
- *
- * text will be printed along the curve y = cos(x).
- *
- * Angles given in radians must be converted to degrees for the PostScript trig
- * functions, and things are scaled so that 1 unit maps into 1 inch. In the last
- * example the cosine curve that describes the baseline has an amplitude of 1 inch.
- * As another example of this rather confusing syntax if *buf is,
- *
- * {} {} {pop 1} {pop 1}
- *
- * the baseline will be the 45 degree line y = x.
- *
- * When any of the four functions is used they're called with a single number on
- * the stack that's equal to the current value of the parameter t. The coordinate
- * system axes run parallel to the PostScript coordinate system that's currently
- * being used.
- *
- */
-
-
- for ( p = buf; *p; p++ ) /* eliminate trailing '\n' */
- if ( *p == '\n' ) {
- *p = '\0';
- break;
- } /* End if */
-
- for ( p = buf; *p && (*p == ' ' || *p == ':'); p++ ) ;
-
- if ( *p != '\0' ) { /* something's there */
- endtext();
- getbaseline();
- fprintf(tf, "mark resolution %s newbaseline\n", p);
- t_sf();
- resetpos();
- } /* End if */
-
-} /* End of newbaseline */
-
-
-/*****************************************************************************/
-
-void
-drawtext(char *buf)
- /* whatever followed "x X DrawText */
-{
- char *p; /* for eliminating white space etc. */
-
-
-/*
- *
- * Called from devcntrl() whenever an "x X DrawText command is recognized. *buf
- * should contain three arguments in the following order. First comes the text we
- * want to print along the current baseline. Right now the string should be given
- * as a PostScript string using characters '(' and ')' as the delimiters. Next in
- * *buf comes a justification mode that can be the words left, right, or center.
- * Last comes a number that represents the starting value of the parameter t that's
- * given as the argument to the parametric equations that describe the current
- * baseline. For example if *buf is given by,
- *
- * (hello world) left .5
- *
- * hello world will be printed along the path described by the current baseline
- * and left justified at whatever (x(.5), y(.5)) happens to be. Usually will be
- * preceeded by an "x X NewBaseline" call that defines the current baseline. The
- * origin of the coordinate system used by the parametric equations will be the
- * current point.
- *
- */
-
-
- for ( p = buf; *p; p++ ) /* eliminate trailing '\n' */
- if ( *p == '\n' ) {
- *p = '\0';
- break;
- } /* End if */
-
- for ( p = buf; *p && (*p == ' ' || *p == ':'); p++ ) ;
-
- if ( *p != '\0' ) { /* something's there */
- endtext();
- getbaseline();
- xymove(hpos, vpos);
- fprintf(tf, "mark %s drawfunnytext\n", p);
- resetpos();
- } /* End if */
-
-} /* End of drawtext */
-
-
-/*****************************************************************************/
-
-void
-settext(char *buf)
-{
- char *p;
-
-
-/*
- *
- * Does whatever is needed to ensure any text that follows will be set along the
- * curve described by the PostScript procedures listed in *buf. If *buf doesn't
- * contain anything useful (eg. just a newline) things are restored to whatever
- * they originally were. Doesn't work well if we try to start in the middle of a
- * line of text.
- *
- * The parametric equations needed are,
- *
- * x = f(t)
- * y = g(t)
- * dx/dt = f'(t)
- * dy/dt = g'(t)
- *
- * and must be given as proper PostScript procedures. The equation for x must come
- * first (ie. it ends up on the bottom of the stack) and the equation for dy/dt
- * must be given last (ie. it ends up on top of the stack). For example if *buf
- * is given by,
- *
- * {} {180 mul 3.1416 div cos} {pop 1} {180 mul 3.1416 div sin neg}
- *
- * text will be set along the curve y=cos(x).
- *
- */
-
-
- endtext();
- getbaseline();
-
- for ( p = buf; *p && *p == ' '; p++ ) ;
-
- if ( *p && *p != '\n' ) {
- encoding = maxencoding + 2;
- fprintf(tf, "mark resolution %s newbaseline\n", buf);
- } else encoding = realencoding;
-
- fprintf(tf, "%d setdecoding\n", encoding);
- resetpos();
-
-} /* End of settext */
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/pictures.c b/usr/src/cmd/lp/filter/postscript/dpost/pictures.c
deleted file mode 100644
index 023bc014b5..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/pictures.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * PostScript picture inclusion routines. Support for managing in-line pictures
- * has been added, and works in combination with the simple picpack pre-processor
- * that's supplied with this package. An in-line picture begins with a special
- * device control command that looks like,
- *
- * x X InlinPicture name size
- *
- * where name is the pathname of the original picture file and size is the number
- * of bytes in the picture, which begins immediately on the next line. When dpost
- * encounters the InlinePicture device control command inlinepic() is called and
- * that routine appends the string name and the integer size to a temporary file
- * (fp_pic) and then adds the next size bytes read from the current input file to
- * file fp_pic. All in-line pictures are saved in fp_pic and located later using
- * the name string and picture file size that separate pictures saved in fp_pic.
- *
- * When a picture request (ie. an "x X PI" command) is encountered picopen() is
- * called and it first looks for the picture file in fp_pic. If it's found there
- * the entire picture (ie. size bytes) is copied from fp_pic to a new temp file
- * and that temp file is used as the picture file. If there's nothing in fp_pic
- * or if the lookup failed the original route is taken.
- *
- * Support for in-line pictures is an attempt to address requirements, expressed
- * by several orginazations, of being able to store a document as a single file
- * (usually troff input) that can then be sent through dpost and ultimately to
- * a PostScript printer. The mechanism may help some users, but the are obvious
- * disadvantages to this approach, and the original mechanism is the recommended
- * approach! Perhaps the most important problem is that troff output, with in-line
- * pictures included, doesn't fit the device independent language accepted by
- * important post-processors (like proff) and that means you won't be able to
- * reliably preview a packed file on your 5620 (or whatever).
- *
- */
-
-
-#include <stdio.h>
-
-#include "comments.h" /* PostScript file structuring comments */
-#include "gen.h" /* general purpose definitions */
-#include "path.h" /* just for TEMPDIR definition */
-
-
-FILE *fp_pic = NULL; /* in-line pictures go here */
-FILE *picopen();
-
-extern int res, hpos, vpos;
-extern int picflag;
-extern FILE *tf;
-
-static void piccopy(FILE *, FILE *, long);
-
-/*****************************************************************************/
-
-
-void
-picture(char *buf)
- /* stuff following 'x X PI' command */
-{
- int poffset; /* page offset */
- int indent; /* indent */
- int length; /* line length */
- int totrap; /* distance to next trap */
- char name[100]; /* picture file and page string */
- char hwo[40], *p; /* height, width and offset strings */
- char flags[20]; /* miscellaneous stuff */
- int page = 1; /* page number pulled from name[] */
- double frame[4]; /* height, width, y, and x offsets from hwo[] */
- char units; /* scale indicator for frame dimensions */
- int whiteout = 0; /* white out the box? */
- int outline = 0; /* draw a box around the picture? */
- int scaleboth = 0; /* scale both dimensions? */
- double adjx = 0.5; /* left-right adjustment */
- double adjy = 0.5; /* top-bottom adjustment */
- double rot = 0; /* rotation in clockwise degrees */
- FILE *fp_in; /* for *name */
- int i; /* loop index */
-
- char *strchr();
-
-
-/*
- *
- * Called from devcntrl() after an 'x X PI' command is found. The syntax of that
- * command is:
- *
- * x X PI:args
- *
- * with args separated by colons and given by:
- *
- * poffset
- * indent
- * length
- * totrap
- * file[(page)]
- * height[,width[,yoffset[,xoffset]]]
- * [flags]
- *
- * poffset, indent, length, and totrap are given in machine units. height, width,
- * and offset refer to the picture frame in inches, unless they're followed by
- * the u scale indicator. flags is a string that provides a little bit of control
- * over the placement of the picture in the frame. Rotation of the picture, in
- * clockwise degrees, is set by the a flag. If it's not followed by an angle
- * the current rotation angle is incremented by 90 degrees, otherwise the angle
- * is set by the number that immediately follows the a.
- *
- */
-
-
- if ( picflag == OFF ) /* skip it */
- return;
-
- endtext();
-
- flags[0] = '\0'; /* just to be safe */
- if ( sscanf(buf, "%d:%d:%d:%d:%[^:]:%[^:]:%[^:]", &poffset, &indent,
- &length, &totrap, name, hwo, flags) < 6 ) {
- error(NON_FATAL, "too few arguments to specify picture");
- return;
- } /* End if */
-
- if ( sscanf(name, "%*[^(](%d", &page) == 1 ) /* grab the page number */
- strtok(name, "("); /* and separate it from the name */
-
- if ( (fp_in = picopen(name)) == NULL ) {
- error(NON_FATAL, "can't open picture file %s", name);
- return;
- } /* End if */
-
- frame[0] = frame[1] = -1; /* default frame height, width */
- frame[2] = frame[3] = 0; /* and y and x offsets */
-
- for ( i = 0, p = hwo-1; i < 4 && p != NULL; i++, p = strchr(p, ',') )
- if ( sscanf(++p, "%lf%c", &frame[i], &units) == 2 )
- if ( units == 'i' || units == ',' || units == '\0' )
- frame[i] *= res;
-
- if ( frame[0] <= 0 ) /* check what we got for height */
- frame[0] = totrap;
-
- if ( frame[1] <= 0 ) /* and width - check too big?? */
- frame[1] = length - indent;
-
- frame[3] += poffset + indent; /* real x offset */
-
- for ( i = 0; flags[i]; i++ )
- switch ( flags[i] ) {
- case 'c': adjx = adjy = 0.5; break; /* move to the center */
- case 'l': adjx = 0; break; /* left */
- case 'r': adjx = 1; break; /* right */
- case 't': adjy = 1; break; /* top */
- case 'b': adjy = 0; break; /* or bottom justify */
- case 'o': outline = 1; break; /* outline the picture */
- case 'w': whiteout = 1; break; /* white out the box */
- case 's': scaleboth = 1; break; /* scale both dimensions */
- case 'a': if ( sscanf(&flags[i+1], "%lf", &rot) != 1 )
- rot += 90;
- } /* End switch */
-
- fprintf(tf, "cleartomark restore\n");
-
- ps_include(fp_in, tf, page, whiteout, outline, scaleboth,
- frame[3]+frame[1]/2, -vpos-frame[2]-frame[0]/2, frame[1], frame[0], adjx, adjy, -rot);
-
- fprintf(tf, "save mark\n");
- xymove(hpos, vpos);
- t_sf();
-
- fclose(fp_in);
-
-} /* End of picture */
-
-
-/*****************************************************************************/
-
-
-FILE *
-picopen(char *path)
- /* picture file pathname */
-{
- char name[100]; /* pathnames */
- long total; /* and sizes - from *fp_pic */
- char *tname; /* pathname */
- FILE *fp; /* and pointer for the new temp file */
-
-
-/*
- *
- * Responsible for finding and opening the next picture file. If we've accumulated
- * any in-line pictures fp_pic won't be NULL and we'll look there first. If *path
- * is found in *fp_pic we create another temp file, open it for update, unlink it,
- * copy in the picture, seek back to the start of the new temp file, and return
- * the file pointer to the caller. If fp_pic is NULL or the lookup fails we just
- * open file *path and return the resulting file pointer to the caller.
- *
- */
-
-
- if ( fp_pic != NULL ) {
- fseek(fp_pic, 0L, 0);
- while ( fscanf(fp_pic, "%s %ld\n", name, &total) != EOF ) {
- if ( strcmp(path, name) == 0 ) {
- if ( (tname = tempnam(TEMPDIR, "dpost")) == NULL )
- error(FATAL, "can't generate temp file name");
- if ( (fp = fopen(tname, "w+")) == NULL )
- error(FATAL, "can't open %s", tname);
- unlink(tname);
- free(tname);
- piccopy(fp_pic, fp, total);
- fseek(fp, 0L, 0);
- return(fp);
- } /* End if */
- fseek(fp_pic, total, 1);
- } /* End while */
- } /* End if */
-
- return(fopen(path, "r"));
-
-} /* End of picopen */
-
-
-/*****************************************************************************/
-
-
-void
-inlinepic(FILE *fp, char *buf)
- /* fp - current input file */
- /* buf - whatever followed "x X InlinePicture" */
-{
- char *tname; /* temp file pathname - for *fp_pic */
- char name[100]; /* picture file pathname */
- long total; /* and size - both from *buf */
-
-
-/*
- *
- * Adds an in-line picture file to the end of temporary file *fp_pic. All pictures
- * grabbed from the input file are saved in the same temp file. Each is preceeded
- * by a one line header that includes the original picture file pathname and the
- * size of the picture in bytes. The in-line picture file is opened for update,
- * left open, and unlinked so it disappears when we do.
- *
- */
-
-
- if ( fp_pic == NULL ) {
- if ( (tname = tempnam(TEMPDIR, "dpost")) == NULL )
- error(FATAL, "can't generate in-line picture file name");
- if ( (fp_pic = fopen(tname, "w+")) == NULL )
- error(FATAL, "can't open in-line picture file %s", tname);
- unlink(tname);
- } /* End if */
-
- if ( sscanf(buf, "%s %ld", name, &total) != 2 )
- error(FATAL, "in-line picture error");
-
- fseek(fp_pic, 0L, 2);
- fprintf(fp_pic, "%s %ld\n", name, total);
- getc(fp);
- fflush(fp_pic);
- piccopy(fp, fp_pic, total);
- ungetc('\n', fp);
-
-} /* End of inlinepic */
-
-
-/*****************************************************************************/
-
-
-static void
-piccopy(FILE *fp_in, FILE *fp_out, long total)
- /* fp_in - input */
- /* fp_out - and output file pointers */
- /* total - number of bytes to be copied */
-{
- long i; /* loop index */
-
-
-/*
- *
- * Copies total bytes from file fp_in to fp_out. Used to append picture files to
- * *fp_pic and then copy them to yet another temporary file immediately before
- * they're used (in picture()).
- *
- */
-
-
- for ( i = 0; i < total; i++ )
- if ( putc(getc(fp_in), fp_out) == EOF )
- error(FATAL, "error copying in-line picture file");
- fflush(fp_out);
-
-} /* End of piccopy */
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/ps_include.c b/usr/src/cmd/lp/filter/postscript/dpost/ps_include.c
deleted file mode 100644
index 1cd79abe63..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/ps_include.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/*
- *
- * Picture inclusion code for PostScript printers.
- *
- */
-
-
-#include <stdio.h>
-#include "ps_include.h"
-
-
-#define var(x) fprintf(fout, "/%s %g def\n", #x, x)
-#define has(word) (strncmp(buf, word, strlen(word)) == 0)
-#define grab(n) ((Section *)(nglobal \
- ? realloc((char *)global, n * sizeof (Section)) \
- : calloc(n, sizeof (Section))))
-
-
-char buf[512];
-typedef struct {
- long start;
- long end;
-} Section;
-
-extern char *calloc(), *realloc();
-
-static void print(FILE *, char **);
-static void copy(FILE *, FILE *, Section *);
-
-
-/*
- * fin, fout - input and output files
- * page_no physical page number from *fin
- * whiteout - erase picture area
- * outline - draw a box around it and
- * scaleboth - scale both dimensions - if not zero
- * cx, cy - center of the picture and
- * sx, sy - its size - in current coordinates
- * ax, ay - left-right, up-down adjustment
- * rot - rotation - in clockwise degrees
- */
-void
-ps_include(FILE *fin, FILE *fout, int page_no, int whiteout,
- int outline, int scaleboth, double cx, double cy,
- double sx, double sy, double ax, double ay, double rot)
-{
- /* found the page when non zero */
- int foundpage = 0;
- /* number of global defs so far */
- int nglobal = 0;
- /* and the number we've got room for */
- int maxglobal = 0;
- /* prologue, page, and trailer offsets */
- Section prolog, page, trailer;
- /* offsets for all global definitions */
- Section *global;
- /* lower left and */
- double llx, lly;
- /* upper right corners - default coords */
- double urx, ury;
- /* mostly for the var() macro */
- double w = whiteout != 0;
- double o = outline != 0;
- double s = scaleboth != 0;
- int i;
-
-
- /*
- *
- * Reads a PostScript file (*fin), and uses structuring comments to
- * locate the prologue, trailer, global definitions, and the requested
- * page. After the whole file is scanned, the special ps_include
- * PostScript definitions are copied to *fout, followed by the
- * prologue, global definitions, the requested page, and the
- * trailer. Before returning the initial environment (saved in
- * PS_head) is restored.
- *
- * By default we assume the picture is 8.5 by 11 inches, but the
- * BoundingBox comment, if found, takes precedence.
- *
- */
-
- /* default BoundingBox - 8.5x11 inches */
- llx = lly = 0;
- urx = 72 * 8.5;
- ury = 72 * 11.0;
-
- /* section boundaries and bounding box */
-
- prolog.start = prolog.end = 0;
- page.start = page.end = 0;
- trailer.start = 0;
- fseek(fin, 0L, 0);
-
- while (fgets(buf, sizeof (buf), fin) != NULL)
- if (!has("%%"))
- continue;
- else if (has("%%Page: ")) {
- if (!foundpage)
- page.start = ftell(fin);
- sscanf(buf, "%*s %*s %d", &i);
- if (i == page_no)
- foundpage = 1;
- else if (foundpage && page.end <= page.start)
- page.end = ftell(fin);
- } else if (has("%%EndPage: ")) {
- sscanf(buf, "%*s %*s %d", &i);
- if (i == page_no) {
- foundpage = 1;
- page.end = ftell(fin);
- }
- if (!foundpage)
- page.start = ftell(fin);
- } else if (has("%%BoundingBox:"))
- sscanf(buf, "%%%%BoundingBox: %lf %lf %lf %lf",
- &llx, &lly, &urx, &ury);
- else if (has("%%EndProlog") || has("%%EndSetup") ||
- has("%%EndDocumentSetup"))
- prolog.end = page.start = ftell(fin);
- else if (has("%%Trailer"))
- trailer.start = ftell(fin);
- else if (has("%%BeginGlobal")) {
- if (page.end <= page.start) {
- if (nglobal >= maxglobal) {
- maxglobal += 20;
- global = grab(maxglobal);
- }
- global[nglobal].start = ftell(fin);
- }
- } else if (has("%%EndGlobal"))
- if (page.end <= page.start)
- global[nglobal++].end = ftell(fin);
-
- fseek(fin, 0L, 2);
- if (trailer.start == 0)
- trailer.start = ftell(fin);
- trailer.end = ftell(fin);
-
- if (page.end <= page.start)
- page.end = trailer.start;
-
- /* all output here */
- print(fout, PS_head);
- var(llx); var(lly); var(urx); var(ury); var(w); var(o); var(s);
- var(cx); var(cy); var(sx); var(sy); var(ax); var(ay); var(rot);
- print(fout, PS_setup);
- copy(fin, fout, &prolog);
- for (i = 0; i < nglobal; i++)
- copy(fin, fout, &global[i]);
- copy(fin, fout, &page);
- copy(fin, fout, &trailer);
- print(fout, PS_tail);
-
- if (nglobal)
- free(global);
-
-}
-
-static void
-print(FILE *fout, char **s)
-{
- while (*s)
- fprintf(fout, "%s\n", *s++);
-}
-
-static void
-copy(FILE *fin, FILE *fout, Section *s)
-{
- if (s->end <= s->start)
- return;
- fseek(fin, s->start, 0);
- while (ftell(fin) < s->end && fgets(buf, sizeof (buf), fin) != NULL)
- if (buf[0] != '%')
- fprintf(fout, "%s", buf);
-}
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/ps_include.ps b/usr/src/cmd/lp/filter/postscript/dpost/ps_include.ps
deleted file mode 100644
index 70dfdc6990..0000000000
--- a/usr/src/cmd/lp/filter/postscript/dpost/ps_include.ps
+++ /dev/null
@@ -1,139 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
--> PS_head
-
-%ps_include: begin
-save
-/ed {exch def} def
-
-# redefine dangerous operators
-{} /showpage ed
-{} /copypage ed
-{} /erasepage ed
-{} /letter ed
-
-# computations are done in the context of a new dictionary
-36 dict dup /PS-include-dict-dw ed begin
-
-# context holds the save object created earlier
-/context ed
-
-# save and clear the operand stack
-count array astore /o-stack ed
-
-# the following variables are now expected:
-# llx,lly,urx,ury bounding box of picture to be included
-# w nonzero if space should be painted white to start
-# o nonzero if space should be outlined
-# s nonzero if both dimensions should be scaled
-# cx,cy center of page space in current coordinates
-# sx,sy size of page space in current coordinates
-# ax,ay left-right, up-down adjustment of picture in page space
-# rot rotation of picture in page space
-%ps_include: variables begin
-
-
-
--> PS_setup
-
-%ps_include: variables end
-
-# some routines:
-# - BBOX llx lly urx ury put bounding box on stack
-# llx lly urx ury BOXPATH - make a path with given box corners
-# dx dy LEN length compute length of positionless vector
-# a b MIN min compute minimum of two numbers
-# a b MAX max compute maximum of two numbers
-# x y NICE x y move to pixel boundaries in default coords
-{llx lly urx ury} /bbox ed
-{newpath 2 index exch 2 index exch dup 6 index exch
- moveto 3 {lineto} repeat closepath} /boxpath ed
-{dup mul exch dup mul add sqrt} /len ed
-{2 copy gt {exch} if pop} /min ed
-{2 copy lt {exch} if pop} /max ed
-{transform round exch round exch A itransform} /nice ed
-
-# A is the transformation from default to current coordinates
-{6 array} /n ed
-n defaultmatrix n currentmatrix n invertmatrix n concatmatrix /A ed
-
-# Sx,Sy and Cx,Cy are dimensions and size of bounding box in current coordinates
-urx llx sub 0 A dtransform len /Sx ed
-0 ury lly sub A dtransform len /Sy ed
-llx urx add 2 div lly ury add 2 div A transform /Cy ed /Cx ed
-
-# H and W are height and width of rotated box in current coordinates
-rot dup sin abs /S ed cos abs /C ed
-Sx S mul Sy C mul add /H ed
-Sx C mul Sy S mul add /W ed
-
-# Scalex and Scaley are the required horizontal and vertical scaling factors
-sy H div /Scaley ed
-sx W div /Scalex ed
-
-# Preserve aspect ratio if we're not scaling both dimensions (ie. s is 0)
-s 0 eq {Scalex Scaley min dup /Scalex ed /Scaley ed} if
-
-# add to cx,cy the shift needed within the page space
-sx Scalex W mul sub 0 max ax 0.5 sub mul cx add /cx ed
-sy Scaley H mul sub 0 max ay 0.5 sub mul cy add /cy ed
-
-# the actual rotation needed is rot less the current rotation
-urx llx sub 0 A dtransform exch atan rot exch sub /rot ed
-
-# set up the coordinate system
-n currentmatrix initgraphics setmatrix
-cx cy translate
-Scalex Scaley scale
-rot rotate
-Cx neg Cy neg translate
-A concat
-
-# set the clipping region, and conditionally whiteout and outline
-bbox boxpath clip newpath
-w 0 ne {gsave bbox boxpath 1 setgray fill grestore} if
-
-# pop local dictionary from the dict stack
-end
-
-# now begins the actual material extracted from the file
-gsave
-%ps_include: inclusion begin
-
-
-
--> PS_tail
-
-%ps_include: inclusion end
-grestore
-
-# within the context of the local dictionary ...
-PS-include-dict-dw begin
-
-o 0 ne {gsave A defaultmatrix /A ed llx lly nice urx ury nice
- initgraphics 0.1 setlinewidth boxpath stroke grestore} if
-
-# ... restore the operand stack and the save context
-clear o-stack aload pop
-context end restore
-%ps_include: end
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/Makefile b/usr/src/cmd/lp/filter/postscript/filtdesc/Makefile
deleted file mode 100644
index 6c9e6d4c1b..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/filtdesc/Makefile
-#
-
-include ../../../Makefile.lp
-
-ROOTETCLPFD= $(ROOTETCLP)/fd
-
-FILES= catv.fd \
- download.fd \
- dpost.fd \
- postio.fd \
- postior.fd \
- postprint.fd \
- postreverse.fd \
- postpages.fd \
- pr.fd
-
-ROOTFILES = $(FILES:%=$(ROOTETCLPFD)/%)
-
-TXTS = README
-
-FILEMODE = 644
-
-.KEEP_STATE:
-
-all: $(TXTS) $(FILES)
-
-install: all $(ROOTETCLPFD) $(ROOTFILES)
-
-$(ROOTETCLPFD) :
- $(INS.dir)
-
-$(ROOTETCLPFD)/% : %
- $(INS.file)
-
-clean clobber strip lint catalog:
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/catv.fd b/usr/src/cmd/lp/filter/postscript/filtdesc/catv.fd
deleted file mode 100644
index bf26c5bff4..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/catv.fd
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-Input types: simple,postscript
-Output types: simple
-Printer types: any
-Printers: any
-Filter type: slow
-Command: /usr/bin/cat
-Options: MODES catv_filter = -v
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/download.fd b/usr/src/cmd/lp/filter/postscript/filtdesc/download.fd
deleted file mode 100644
index 1225be8d9c..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/download.fd
+++ /dev/null
@@ -1,30 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Input types: postscript
-Output types: postdown
-Printer types: PS,PSR,PS-b,PS-r,PS-br
-Printers: any
-Filter type: fast
-Command: /usr/lib/lp/postscript/download
-Options: PRINTER * = -p*
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/dpost.fd b/usr/src/cmd/lp/filter/postscript/filtdesc/dpost.fd
deleted file mode 100644
index 179d7f2eeb..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/dpost.fd
+++ /dev/null
@@ -1,39 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Input types: troff
-Output types: postscript
-Printer types: any
-Printers: any
-Filter type: slow
-Command: /usr/lib/lp/postscript/dpost
-Options: PAGES * = -o*
-Options: COPIES * = -c*
-Options: LENGTH * = -l*
-Options: MODES group = -n2
-Options: MODES group\=\([2-9]\) = -n\1
-Options: MODES portrait = -pp
-Options: MODES landscape = -pl
-Options: MODES x\=\(\-*[\.0-9]*\) = -x\1
-Options: MODES y\=\(\-*[\.0-9]*\) = -y\1
-Options: MODES magnify\=\([\.0-9]*\) = -m\1
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/postior.fd b/usr/src/cmd/lp/filter/postscript/filtdesc/postior.fd
deleted file mode 100644
index 2ccded24e5..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/postior.fd
+++ /dev/null
@@ -1,29 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Input types: postdown
-Output types: PS
-Printer types: PSR
-Printers: any
-Filter type: fast
-Command: /usr/lib/lp/postscript/postreverse | /usr/lib/lp/postscript/postio 2>>$ERRFILE
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/postpages.fd b/usr/src/cmd/lp/filter/postscript/filtdesc/postpages.fd
deleted file mode 100644
index bc86038ceb..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/postpages.fd
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-Input types: postscript
-Output types: postscript
-Printer types: any
-Printers: any
-Filter type: slow
-Command: /usr/lib/lp/postscript/postreverse -r
-Options: PAGES * = -o*
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/postprint.fd b/usr/src/cmd/lp/filter/postscript/filtdesc/postprint.fd
deleted file mode 100644
index 83d8c74b9b..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/postprint.fd
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-
-Input types: simple
-Output types: postscript
-Printer types: any
-Printers: any
-Filter type: slow
-Command: /usr/lib/lp/postscript/postprint
-Options: PAGES * = -o*
-Options: LENGTH * = -l*
-Options: MODES group = -n2
-Options: MODES group\=\([2-9]\) = -n\1
-Options: MODES portrait = -pp
-Options: MODES landscape = -pl
-Options: MODES x\=\(\-*[\.0-9]*\) = -x\1
-Options: MODES y\=\(\-*[\.0-9]*\) = -y\1
-Options: MODES magnify\=\([\.0-9]*\) = -m\1
-Options: MODES catv_filter = -I
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/postreverse.fd b/usr/src/cmd/lp/filter/postscript/filtdesc/postreverse.fd
deleted file mode 100644
index f00257e288..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/postreverse.fd
+++ /dev/null
@@ -1,30 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Input types: postscript,post
-Output types: postscript
-Printer types: any
-Printers: any
-Filter type: slow
-Command: /usr/lib/lp/postscript/postreverse
-Options: PAGES * = -o*
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/pr.fd b/usr/src/cmd/lp/filter/postscript/filtdesc/pr.fd
deleted file mode 100644
index 385fdb3dc0..0000000000
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/pr.fd
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-Input types: pr
-Output types: simple
-Printer types: any
-Printers: any
-Filter type: slow
-Command: /usr/bin/pr
-Options: MODES prtitle\=\(\'.*\'\) = -h \1
-Options: MODES width\=\(.*\) = -w\1
-Options: MODES indent\=\(.*\) = -o\1
diff --git a/usr/src/cmd/lp/filter/postscript/font/Makefile b/usr/src/cmd/lp/filter/postscript/font/Makefile
deleted file mode 100644
index 27496b4f75..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/Makefile
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/font/Makefile
-#
-
-include ../../../Makefile.lp
-
-PROG = makedev
-
-SRCS = makedev.c
-
-OBJS = $(SRCS:%.c=%.o)
-
-SUBDIRS = devpost
-
-COMMONDIR = ../common
-ROOTLIBFONT = $(ROOTLIB)/font
-ROOTLIBFONTPROG = $(PROG:%=$(ROOTLIBFONT)/%)
-
-CPPFLAGS = -I$(COMMONDIR) $(CPPFLAGS.master)
-
-POFILE = lp_filter_postscript_font.po
-
-NATIVEDIR = native
-NATIVEPROG = $(NATIVEDIR)/$(PROG)
-$(NATIVEPROG) := CC=$(NATIVECC)
-$(NATIVEPROG) := LDLIBS=
-$(NATIVEPROG) := CPPFLAGS.master=
-
-.KEEP_STATE:
-
-all : $(PROG) $(NATIVEPROG) $(SUBDIRS)
-
-install : $(PROG) $(ROOTLIBFONTPROG) $(SUBDIRS)
-
-clean : $(SUBDIRS)
- $(RM) $(OBJS)
-
-clobber : $(SUBDIRS) clean
- $(RM) $(PROG) $(NATIVEPROG) $(CLOBBERFILES)
-
-strip:
- $(STRIP) $(PROG)
-
-lint:
- $(LINT.c) $(SRCS)
-
-include ../Makefile.msg
-
-$(NATIVEPROG) : $(NATIVEDIR) $(SRCS)
- $(LINK.c) -o $@ $(SRCS) $(LDLIBS)
-
-$(NATIVEDIR) :
- -@mkdir -p $@
-
-$(ROOTLIBFONT)/%: %
- $(INS.file)
-
-$(PROG) : $(SRCS)
- $(LINK.c) -o $@ $(SRCS) $(LDLIBS)
- $(POST_PROCESS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
diff --git a/usr/src/cmd/lp/filter/postscript/font/README b/usr/src/cmd/lp/filter/postscript/font/README
deleted file mode 100644
index d5a5a865bc..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/README
+++ /dev/null
@@ -1,139 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-The devpost directory includes width tables for the entire LaserWriter Plus font
-set (and a few others). The width tables assume a resolution of 720 dpi (which
-isn't expected to match your printer's resolution) and by default are installed
-in /usr/lib/font/devpost. You can point troff there using the -Tpost option, while
-dpost goes there automatically. The width tables were generated on a PostScript
-printer using postio (with the -t option) and the files that you'll find in
-directory ../buildtables.
-
-The mapping from troff's one or two character font names to PostScript fonts is
-handled by definitions made near the start of file ../postscript/dpost.ps. troff
-characters not available in PostScript fonts are constructed using the files in
-./devpost/charlib. Characters that are assigned a code (ie. number in the fourth
-column) less than 32 are looked up (by dpost) in the charlib directory. A code
-of 1 implies the character definition comes in one piece, while anything else
-means the character may come in two pieces. The first part is downloaded once,
-while the second part (ie. the one that ends in .map) must be included every
-time the character is printed.
-
-Adding a new font file (for troff and dpost) can be time consuming, but isn't
-difficult. The steps you'll need to follow are outlined below:
-
- 1: Pick a one or two character font name for troff and dpost - no longer a
- trivial task! To find out what two character font names are taken type,
-
- cd devpost
- ls -l ? ??
-
- Any unused one or two character font name can be chosen. I've tried to choose
- two character font names with the first character representing the font family
- (eg. K for Bookman) and second (upper or lower case R, I, B, or X) indicating
- the style.
-
- 2: Choose a unique internal name (ie. integer between 1 and 255). To find out
- what internal names (ie. numbers) are already taken type,
-
- cd devpost
- grep internalname ? ?? | sort -n +1 -2
-
- Any number not already used can be chosen. Consecutive numbering starting at
- a fixed offset (like 128) might be a useful approach.
-
- 3: Build the width tables and install the ASCII files in ./devpost. Width tables
- can be built by hand or you can use postio (with the -t option) and the stuff
- in directory ../buildtables and have the printer generate the tables. Widths
- (ie. numbers in column 2) are point size 10 widths assuming a resolution of
- 720 dpi. As an example if you wanted to find the width of character A in
- Times-Roman you could send the following to a PostScript printer,
-
- /Times-Roman findfont 100 scalefont setfont
- (A) stringwidth pop ==
-
- The fourth column in the width tables is the character code field and is only
- used by dpost. It must be the code assigned to the character in the PostScript
- font. For simple characters (like an a) it's just the ASCII code. Characters
- that are assigned codes less than 32 (typically 1 or 2) are special and are
- built up using files in devpost/charlib.
-
- 4: Any new special character names you've added to the width table must appear in
- the charset portion of file devpost/DESC.
-
- 5: Add a mapping definition to ../postscript/dpost.ps. For example if you've
- built a width table for font XR and the PostScript name is /ExtraFont-Roman
- then add,
-
- /XR /ExtraFont-Roman def
-
- to the dpost prologue.
-
- 6: If you're system uses PDQs you'll need to build new PDQ font files. I've
- included the PDQ version of makedev and font.mk includes a target called PDQ
- that works on MHCC systems. Typing,
-
- make -f font.mk PDQ
-
- should work, provided you can execute the PDQFRONT program. The new binary
- PDQ files initially go in directory PDQ/devpost and from there are installed
- in /usr/lib/font/PDQ/devpost. If you don't know what PDQs are skip this stuff.
-
- 7: Build and install the new binary font files and dpost prologue by typing,
-
- cd ..
- make TARGETS='font postscript' install
-
- Actually the install (as written above) installs everything in directory
- ../postscript. Since all you need is the new version of dpost.ps the following
- might be safer,
-
- cd ..
- make TARGETS=font install
- cd postscript
- cp dpost.ps /usr/lib/postscript/dpost.ps
-
-The devpostaps directory is new and the binary tables won't be built or installed
-unless you do it by hand. The tables are an attempt to make Linotronic output look
-something like APS-5 output, and won't be useful to most people. The only real
-application is for simple (perhaps one or two page) updates to larger documents
-that have already been formatted and printed on the APS-5. The following commands
-build and install the devpostaps tables,
-
- make -f font.mk makedev
- cd devpostaps
- ../makedev DESC ? ??
- mkdir /usr/lib/font/devpostaps
- cp *.out /usr/lib/font/devpostaps
- cd charlib
- mkdir /usr/lib/font/devpostaps/charlib
- cp * /usr/lib/font/devpostaps/charlib
-
-The tables should only be used by dpost - troff files should be formatted with
-the -Taps option. In addition dpost must use level 2 encoding. A command line
-that forces dpost to do the best it can with APS files would be,
-
- dpost -e2 -Tpostaps -C/usr/lib/postscript/aps.ps file >file.ps
-
-where aps.ps is additional PostScript code (pulled in using the -C option) that
-tunes the Courier, Times, and Helvetica fonts so they look more like APS fonts.
-
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/AB b/usr/src/cmd/lp/filter/postscript/font/devpost/AB
deleted file mode 100644
index b838a54749..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/AB
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# AvantGarde-Demi
-name AB
-internalname 27
-ligatures fi fl 0
-charset
-! 28 2 33
-$ 56 2 36
-% 86 2 37
-& 68 2 38
-' 28 2 39
-( 38 3 40
-) 38 3 41
-* 44 2 42
-+ 60 0 43
-, 28 1 44
-hy 42 0 45
-- "
-. 28 0 46
-/ 46 3 47
-0 56 2 48
-1 56 2 49
-2 56 2 50
-3 56 2 51
-4 56 2 52
-5 56 2 53
-6 56 2 54
-7 56 2 55
-8 56 2 56
-9 56 2 57
-: 28 0 58
-; 28 1 59
-= 60 0 61
-? 56 2 63
-A 74 2 65
-B 58 2 66
-C 78 2 67
-D 70 2 68
-E 52 2 69
-F 48 2 70
-G 84 2 71
-H 68 2 72
-I 28 2 73
-J 48 2 74
-K 62 2 75
-L 44 2 76
-M 90 2 77
-N 74 2 78
-O 84 2 79
-P 56 2 80
-Q 84 2 81
-R 58 2 82
-S 52 2 83
-T 42 2 84
-U 64 2 85
-V 70 2 86
-W 90 2 87
-X 68 2 88
-Y 62 2 89
-Z 50 2 90
-[ 32 3 91
-] 32 3 93
-` 28 2 96
-a 66 0 97
-b 66 2 98
-c 64 0 99
-d 66 2 100
-e 64 0 101
-f 28 2 102
-g 66 1 103
-h 60 2 104
-i 24 2 105
-j 26 3 106
-k 58 2 107
-l 24 2 108
-m 94 0 109
-n 60 0 110
-o 64 0 111
-p 66 1 112
-q 66 1 113
-r 32 0 114
-s 44 0 115
-t 30 2 116
-u 60 0 117
-v 56 0 118
-w 80 0 119
-x 56 0 120
-y 58 1 121
-z 46 0 122
-ct 56 2 162
-fi 52 2 174
-fl 52 2 175
-dg 56 3 178
-bu 60 0 183
-de 36 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 48 2 170
-'' 48 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/AB.name b/usr/src/cmd/lp/filter/postscript/font/devpost/AB.name
deleted file mode 100644
index 66cbce00a8..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/AB.name
+++ /dev/null
@@ -1 +0,0 @@
-AvantGarde-Demi
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/AI b/usr/src/cmd/lp/filter/postscript/font/devpost/AI
deleted file mode 100644
index b7872c4f59..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/AI
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# AvantGarde-BookOblique
-name AI
-internalname 26
-ligatures fi fl 0
-charset
-! 29 2 33
-$ 55 2 36
-% 77 2 37
-& 76 2 38
-' 35 2 39
-( 37 3 40
-) 37 3 41
-* 42 2 42
-+ 61 0 43
-, 28 0 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 44 3 47
-0 55 2 48
-1 55 2 49
-2 55 2 50
-3 55 2 51
-4 55 2 52
-5 55 2 53
-6 55 2 54
-7 55 2 55
-8 55 2 56
-9 55 2 57
-: 28 0 58
-; 28 0 59
-= 61 0 61
-? 59 2 63
-A 74 2 65
-B 57 2 66
-C 81 2 67
-D 74 2 68
-E 54 2 69
-F 49 2 70
-G 87 2 71
-H 68 2 72
-I 23 2 73
-J 48 2 74
-K 59 2 75
-L 46 2 76
-M 92 2 77
-N 74 2 78
-O 87 2 79
-P 59 2 80
-Q 87 2 81
-R 61 2 82
-S 50 2 83
-T 43 2 84
-U 66 2 85
-V 70 2 86
-W 96 2 87
-X 61 2 88
-Y 59 2 89
-Z 48 2 90
-[ 35 3 91
-] 35 3 93
-` 35 2 96
-a 68 0 97
-b 68 2 98
-c 65 0 99
-d 69 2 100
-e 65 0 101
-f 31 2 102
-g 67 1 103
-h 61 2 104
-i 20 2 105
-j 20 3 106
-k 50 2 107
-l 20 2 108
-m 94 0 109
-n 61 0 110
-o 66 0 111
-p 68 1 112
-q 68 1 113
-r 30 0 114
-s 39 0 115
-t 34 2 116
-u 61 0 117
-v 55 0 118
-w 83 0 119
-x 48 0 120
-y 54 1 121
-z 42 0 122
-ct 55 2 162
-fi 49 2 174
-fl 49 2 175
-dg 55 3 178
-bu 61 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/AI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/AI.name
deleted file mode 100644
index 042c47d36d..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/AI.name
+++ /dev/null
@@ -1 +0,0 @@
-AvantGarde-BookOblique
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/AR b/usr/src/cmd/lp/filter/postscript/font/devpost/AR
deleted file mode 100644
index 9263876201..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/AR
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# AvantGarde-Book
-name AR
-internalname 25
-ligatures fi fl 0
-charset
-! 29 2 33
-$ 55 2 36
-% 77 2 37
-& 76 2 38
-' 35 2 39
-( 37 3 40
-) 37 3 41
-* 42 2 42
-+ 61 0 43
-, 28 0 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 44 3 47
-0 55 2 48
-1 55 2 49
-2 55 2 50
-3 55 2 51
-4 55 2 52
-5 55 2 53
-6 55 2 54
-7 55 2 55
-8 55 2 56
-9 55 2 57
-: 28 0 58
-; 28 0 59
-= 61 0 61
-? 59 2 63
-A 74 2 65
-B 57 2 66
-C 81 2 67
-D 74 2 68
-E 54 2 69
-F 49 2 70
-G 87 2 71
-H 68 2 72
-I 23 2 73
-J 48 2 74
-K 59 2 75
-L 46 2 76
-M 92 2 77
-N 74 2 78
-O 87 2 79
-P 59 2 80
-Q 87 2 81
-R 61 2 82
-S 50 2 83
-T 43 2 84
-U 66 2 85
-V 70 2 86
-W 96 2 87
-X 61 2 88
-Y 59 2 89
-Z 48 2 90
-[ 35 3 91
-] 35 3 93
-` 35 2 96
-a 68 0 97
-b 68 2 98
-c 65 0 99
-d 69 2 100
-e 65 0 101
-f 31 2 102
-g 67 1 103
-h 61 2 104
-i 20 2 105
-j 20 3 106
-k 50 2 107
-l 20 2 108
-m 94 0 109
-n 61 0 110
-o 66 0 111
-p 68 1 112
-q 68 1 113
-r 30 0 114
-s 39 0 115
-t 34 2 116
-u 61 0 117
-v 55 0 118
-w 83 0 119
-x 48 0 120
-y 54 1 121
-z 42 0 122
-ct 55 2 162
-fi 49 2 174
-fl 49 2 175
-dg 55 3 178
-bu 61 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/AR.name b/usr/src/cmd/lp/filter/postscript/font/devpost/AR.name
deleted file mode 100644
index 8e691047db..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/AR.name
+++ /dev/null
@@ -1 +0,0 @@
-AvantGarde-Book
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/AX b/usr/src/cmd/lp/filter/postscript/font/devpost/AX
deleted file mode 100644
index c756805d33..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/AX
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# AvantGarde-DemiOblique
-name AX
-internalname 28
-ligatures fi fl 0
-charset
-! 28 2 33
-$ 56 2 36
-% 86 2 37
-& 68 2 38
-' 28 2 39
-( 38 3 40
-) 38 3 41
-* 44 2 42
-+ 60 0 43
-, 28 1 44
-hy 42 0 45
-- "
-. 28 0 46
-/ 46 3 47
-0 56 2 48
-1 56 2 49
-2 56 2 50
-3 56 2 51
-4 56 2 52
-5 56 2 53
-6 56 2 54
-7 56 2 55
-8 56 2 56
-9 56 2 57
-: 28 0 58
-; 28 1 59
-= 60 0 61
-? 56 2 63
-A 74 2 65
-B 58 2 66
-C 78 2 67
-D 70 2 68
-E 52 2 69
-F 48 2 70
-G 84 2 71
-H 68 2 72
-I 28 2 73
-J 48 2 74
-K 62 2 75
-L 44 2 76
-M 90 2 77
-N 74 2 78
-O 84 2 79
-P 56 2 80
-Q 84 2 81
-R 58 2 82
-S 52 2 83
-T 42 2 84
-U 64 2 85
-V 70 2 86
-W 90 2 87
-X 68 2 88
-Y 62 2 89
-Z 50 2 90
-[ 32 3 91
-] 32 3 93
-` 28 2 96
-a 66 0 97
-b 66 2 98
-c 64 0 99
-d 66 2 100
-e 64 0 101
-f 28 2 102
-g 66 1 103
-h 60 2 104
-i 24 2 105
-j 26 3 106
-k 58 2 107
-l 24 2 108
-m 94 0 109
-n 60 0 110
-o 64 0 111
-p 66 1 112
-q 66 1 113
-r 32 0 114
-s 44 0 115
-t 30 2 116
-u 60 0 117
-v 56 0 118
-w 80 0 119
-x 56 0 120
-y 58 1 121
-z 46 0 122
-ct 56 2 162
-fi 52 2 174
-fl 52 2 175
-dg 56 3 178
-bu 60 0 183
-de 36 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 48 2 170
-'' 48 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/AX.name b/usr/src/cmd/lp/filter/postscript/font/devpost/AX.name
deleted file mode 100644
index 4cff429625..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/AX.name
+++ /dev/null
@@ -1 +0,0 @@
-AvantGarde-DemiOblique
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/B b/usr/src/cmd/lp/filter/postscript/font/devpost/B
deleted file mode 100644
index 1959f183b7..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/B
+++ /dev/null
@@ -1,134 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Times-Bold
-name B
-internalname 3
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 50 3 36
-% 100 2 37
-& 83 2 38
-' 33 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 57 0 43
-, 25 1 44
-hy 33 0 45
-- "
-. 25 0 46
-/ 28 2 47
-0 50 2 48
-1 50 2 49
-2 50 2 50
-3 50 2 51
-4 50 2 52
-5 50 2 53
-6 50 2 54
-7 50 2 55
-8 50 2 56
-9 50 2 57
-: 33 0 58
-; 33 1 59
-= 57 0 61
-? 50 2 63
-A 72 2 65
-B 67 2 66
-C 72 2 67
-D 72 2 68
-E 67 2 69
-F 61 2 70
-G 78 2 71
-H 78 2 72
-I 39 2 73
-J 50 2 74
-K 78 2 75
-L 67 2 76
-M 94 2 77
-N 72 2 78
-O 78 2 79
-P 61 2 80
-Q 78 3 81
-R 72 2 82
-S 56 2 83
-T 67 2 84
-U 72 2 85
-V 72 2 86
-W 100 2 87
-X 72 2 88
-Y 72 2 89
-Z 67 2 90
-[ 33 3 91
-] 33 3 93
-` 33 2 96
-a 50 0 97
-b 56 2 98
-c 44 0 99
-d 56 2 100
-e 44 0 101
-f 33 2 102
-g 50 1 103
-h 56 2 104
-i 28 2 105
-j 33 3 106
-k 56 2 107
-l 28 2 108
-m 83 0 109
-n 56 0 110
-o 50 0 111
-p 56 1 112
-q 56 1 113
-r 44 0 114
-s 39 0 115
-t 33 2 116
-u 56 0 117
-v 50 0 118
-w 72 0 119
-x 50 0 120
-y 50 1 121
-z 44 0 122
-ct 50 3 162
-fi 56 2 174
-fl 56 2 175
-ff 60 2 1
-Fi 84 2 1
-Fl 84 2 1
-dg 50 3 178
-bu 35 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-sq 50 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/B.name b/usr/src/cmd/lp/filter/postscript/font/devpost/B.name
deleted file mode 100644
index 0eff771010..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/B.name
+++ /dev/null
@@ -1 +0,0 @@
-Times-Bold
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/BI b/usr/src/cmd/lp/filter/postscript/font/devpost/BI
deleted file mode 100644
index f5c5d99daa..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/BI
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Times-BoldItalic
-name BI
-internalname 4
-ligatures fi fl 0
-charset
-! 39 2 33
-$ 50 2 36
-% 83 2 37
-& 78 2 38
-' 33 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 57 0 43
-, 25 1 44
-hy 33 0 45
-- "
-. 25 0 46
-/ 28 2 47
-0 50 2 48
-1 50 2 49
-2 50 2 50
-3 50 2 51
-4 50 2 52
-5 50 2 53
-6 50 2 54
-7 50 2 55
-8 50 2 56
-9 50 2 57
-: 33 0 58
-; 33 1 59
-= 57 0 61
-? 50 2 63
-A 67 2 65
-B 67 2 66
-C 67 2 67
-D 72 2 68
-E 67 2 69
-F 67 2 70
-G 72 2 71
-H 78 2 72
-I 39 2 73
-J 50 2 74
-K 67 2 75
-L 61 2 76
-M 89 2 77
-N 72 2 78
-O 72 2 79
-P 61 2 80
-Q 72 3 81
-R 67 2 82
-S 56 2 83
-T 61 2 84
-U 72 2 85
-V 67 2 86
-W 89 2 87
-X 67 2 88
-Y 61 2 89
-Z 61 2 90
-[ 33 3 91
-] 33 3 93
-` 33 2 96
-a 50 0 97
-b 50 2 98
-c 44 0 99
-d 50 2 100
-e 44 0 101
-f 33 3 102
-g 50 1 103
-h 56 2 104
-i 28 2 105
-j 28 3 106
-k 50 2 107
-l 28 2 108
-m 78 0 109
-n 56 0 110
-o 50 0 111
-p 50 1 112
-q 50 1 113
-r 39 0 114
-s 39 0 115
-t 28 2 116
-u 56 0 117
-v 44 0 118
-w 67 0 119
-x 50 0 120
-y 44 1 121
-z 39 0 122
-ct 50 3 162
-fi 56 3 174
-fl 56 3 175
-dg 50 3 178
-bu 35 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/BI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/BI.name
deleted file mode 100644
index 3aed601b14..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/BI.name
+++ /dev/null
@@ -1 +0,0 @@
-Times-BoldItalic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CB b/usr/src/cmd/lp/filter/postscript/font/devpost/CB
deleted file mode 100644
index 1dd2c34050..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CB
+++ /dev/null
@@ -1,134 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Courier-Bold
-name CB
-internalname 7
-spacewidth 60
-charset
-! 60 2 33
-" 60 2 34
-# 60 2 35
-$ 60 2 36
-% 60 2 37
-& 60 2 38
-' 60 2 39
-( 60 3 40
-) 60 3 41
-* 60 2 42
-+ 60 0 43
-, 60 1 44
-hy 60 0 45
-- "
-. 60 0 46
-/ 60 2 47
-0 60 2 48
-1 60 2 49
-2 60 2 50
-3 60 2 51
-4 60 2 52
-5 60 2 53
-6 60 2 54
-7 60 2 55
-8 60 2 56
-9 60 2 57
-: 60 0 58
-; 60 1 59
-< 60 2 60
-= 60 0 61
-> 60 2 62
-? 60 2 63
-@ 60 2 64
-A 60 2 65
-B 60 2 66
-C 60 2 67
-D 60 2 68
-E 60 2 69
-F 60 2 70
-G 60 2 71
-H 60 2 72
-I 60 2 73
-J 60 2 74
-K 60 2 75
-L 60 2 76
-M 60 2 77
-N 60 2 78
-O 60 2 79
-P 60 2 80
-Q 60 3 81
-R 60 2 82
-S 60 2 83
-T 60 2 84
-U 60 2 85
-V 60 2 86
-W 60 2 87
-X 60 2 88
-Y 60 2 89
-Z 60 2 90
-[ 60 3 91
-\ 60 3 92
-] 60 3 93
-^ 60 2 94
-_ 60 1 95
-` 60 2 96
-a 60 0 97
-b 60 2 98
-c 60 0 99
-d 60 2 100
-e 60 0 101
-f 60 2 102
-g 60 1 103
-h 60 2 104
-i 60 2 105
-j 60 3 106
-k 60 2 107
-l 60 2 108
-m 60 0 109
-n 60 0 110
-o 60 0 111
-p 60 1 112
-q 60 1 113
-r 60 0 114
-s 60 0 115
-t 60 2 116
-u 60 0 117
-v 60 0 118
-w 60 0 119
-x 60 0 120
-y 60 1 121
-z 60 0 122
-{ 60 3 123
-| 60 3 124
-} 60 3 125
-~ 60 0 126
-ct 60 2 162
-\- 60 0 177
-en "
-dg 60 3 178
-bu 60 0 183
-de 60 2 202
-em 60 0 208
-14 60 2 1
-34 60 2 1
-12 60 2 1
-`` 60 2 170
-'' 60 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CB.name b/usr/src/cmd/lp/filter/postscript/font/devpost/CB.name
deleted file mode 100644
index e29f392a7e..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CB.name
+++ /dev/null
@@ -1 +0,0 @@
-Courier-Bold
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CI b/usr/src/cmd/lp/filter/postscript/font/devpost/CI
deleted file mode 100644
index 3b8ad8b379..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CI
+++ /dev/null
@@ -1,142 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Courier-Oblique
-name CI
-internalname 6
-spacewidth 60
-charset
-! 60 2 33
-" 60 2 34
-# 60 2 35
-$ 60 2 36
-% 60 2 37
-& 60 2 38
-' 60 2 39
-( 60 3 40
-) 60 3 41
-* 60 2 42
-+ 60 0 43
-, 60 1 44
-hy 60 0 45
-- "
-. 60 0 46
-/ 60 2 47
-0 60 2 48
-1 60 2 49
-2 60 2 50
-3 60 2 51
-4 60 2 52
-5 60 2 53
-6 60 2 54
-7 60 2 55
-8 60 2 56
-9 60 2 57
-: 60 0 58
-; 60 1 59
-< 60 2 60
-= 60 0 61
-> 60 2 62
-? 60 2 63
-@ 60 2 64
-A 60 2 65
-B 60 2 66
-C 60 2 67
-D 60 2 68
-E 60 2 69
-F 60 2 70
-G 60 2 71
-H 60 2 72
-I 60 2 73
-J 60 2 74
-K 60 2 75
-L 60 2 76
-M 60 2 77
-N 60 2 78
-O 60 2 79
-P 60 2 80
-Q 60 3 81
-R 60 2 82
-S 60 2 83
-T 60 2 84
-U 60 2 85
-V 60 2 86
-W 60 2 87
-X 60 2 88
-Y 60 2 89
-Z 60 2 90
-[ 60 3 91
-\ 60 3 92
-] 60 3 93
-^ 60 2 94
-_ 60 1 95
-` 60 2 96
-a 60 0 97
-b 60 2 98
-c 60 0 99
-d 60 2 100
-e 60 0 101
-f 60 2 102
-g 60 1 103
-h 60 2 104
-i 60 2 105
-j 60 3 106
-k 60 2 107
-l 60 2 108
-m 60 0 109
-n 60 0 110
-o 60 0 111
-p 60 1 112
-q 60 1 113
-r 60 0 114
-s 60 0 115
-t 60 2 116
-u 60 0 117
-v 60 0 118
-w 60 0 119
-x 60 0 120
-y 60 1 121
-z 60 0 122
-{ 60 3 123
-| 60 3 124
-} 60 3 125
-~ 60 0 126
-ct 60 2 162
-\- 60 0 177
-en "
-dg 60 3 178
-bu 60 0 183
-de 60 2 202
-em 60 0 208
-14 60 2 1
-34 60 2 1
-12 60 2 1
-`` 60 2 170
-'' 60 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/CI.name
deleted file mode 100644
index 96620c5d3b..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CI.name
+++ /dev/null
@@ -1 +0,0 @@
-Courier-Oblique
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CO b/usr/src/cmd/lp/filter/postscript/font/devpost/CO
deleted file mode 100644
index f6a1c8c64e..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CO
+++ /dev/null
@@ -1,134 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Courier
-name CW
-internalname 5
-spacewidth 60
-charset
-! 60 2 33
-" 60 2 34
-# 60 2 35
-$ 60 2 36
-% 60 2 37
-& 60 2 38
-' 60 2 39
-( 60 3 40
-) 60 3 41
-* 60 2 42
-+ 60 0 43
-, 60 1 44
-hy 60 0 45
-- "
-. 60 0 46
-/ 60 2 47
-0 60 2 48
-1 60 2 49
-2 60 2 50
-3 60 2 51
-4 60 2 52
-5 60 2 53
-6 60 2 54
-7 60 2 55
-8 60 2 56
-9 60 2 57
-: 60 0 58
-; 60 1 59
-< 60 2 60
-= 60 0 61
-> 60 2 62
-? 60 2 63
-@ 60 2 64
-A 60 2 65
-B 60 2 66
-C 60 2 67
-D 60 2 68
-E 60 2 69
-F 60 2 70
-G 60 2 71
-H 60 2 72
-I 60 2 73
-J 60 2 74
-K 60 2 75
-L 60 2 76
-M 60 2 77
-N 60 2 78
-O 60 2 79
-P 60 2 80
-Q 60 3 81
-R 60 2 82
-S 60 2 83
-T 60 2 84
-U 60 2 85
-V 60 2 86
-W 60 2 87
-X 60 2 88
-Y 60 2 89
-Z 60 2 90
-[ 60 3 91
-\ 60 3 92
-] 60 3 93
-^ 60 2 94
-_ 60 1 95
-` 60 2 96
-a 60 0 97
-b 60 2 98
-c 60 0 99
-d 60 2 100
-e 60 0 101
-f 60 2 102
-g 60 1 103
-h 60 2 104
-i 60 2 105
-j 60 3 106
-k 60 2 107
-l 60 2 108
-m 60 0 109
-n 60 0 110
-o 60 0 111
-p 60 1 112
-q 60 1 113
-r 60 0 114
-s 60 0 115
-t 60 2 116
-u 60 0 117
-v 60 0 118
-w 60 0 119
-x 60 0 120
-y 60 1 121
-z 60 0 122
-{ 60 3 123
-| 60 3 124
-} 60 3 125
-~ 60 0 126
-ct 60 2 162
-\- 60 0 177
-en "
-dg 60 3 178
-bu 60 0 183
-de 60 2 202
-em 60 0 208
-14 60 2 1
-34 60 2 1
-12 60 2 1
-`` 60 2 170
-'' 60 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CO.name b/usr/src/cmd/lp/filter/postscript/font/devpost/CO.name
deleted file mode 100644
index 75f4fae71e..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CO.name
+++ /dev/null
@@ -1 +0,0 @@
-Courier
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CW b/usr/src/cmd/lp/filter/postscript/font/devpost/CW
deleted file mode 100644
index 64016b9270..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CW
+++ /dev/null
@@ -1,142 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Courier
-name CW
-internalname 5
-spacewidth 60
-charset
-! 60 2 33
-" 60 2 34
-# 60 2 35
-$ 60 2 36
-% 60 2 37
-& 60 2 38
-' 60 2 39
-( 60 3 40
-) 60 3 41
-* 60 2 42
-+ 60 0 43
-, 60 1 44
-hy 60 0 45
-- "
-. 60 0 46
-/ 60 2 47
-0 60 2 48
-1 60 2 49
-2 60 2 50
-3 60 2 51
-4 60 2 52
-5 60 2 53
-6 60 2 54
-7 60 2 55
-8 60 2 56
-9 60 2 57
-: 60 0 58
-; 60 1 59
-< 60 2 60
-= 60 0 61
-> 60 2 62
-? 60 2 63
-@ 60 2 64
-A 60 2 65
-B 60 2 66
-C 60 2 67
-D 60 2 68
-E 60 2 69
-F 60 2 70
-G 60 2 71
-H 60 2 72
-I 60 2 73
-J 60 2 74
-K 60 2 75
-L 60 2 76
-M 60 2 77
-N 60 2 78
-O 60 2 79
-P 60 2 80
-Q 60 3 81
-R 60 2 82
-S 60 2 83
-T 60 2 84
-U 60 2 85
-V 60 2 86
-W 60 2 87
-X 60 2 88
-Y 60 2 89
-Z 60 2 90
-[ 60 3 91
-\ 60 3 92
-] 60 3 93
-^ 60 2 94
-_ 60 1 95
-` 60 2 96
-a 60 0 97
-b 60 2 98
-c 60 0 99
-d 60 2 100
-e 60 0 101
-f 60 2 102
-g 60 1 103
-h 60 2 104
-i 60 2 105
-j 60 3 106
-k 60 2 107
-l 60 2 108
-m 60 0 109
-n 60 0 110
-o 60 0 111
-p 60 1 112
-q 60 1 113
-r 60 0 114
-s 60 0 115
-t 60 2 116
-u 60 0 117
-v 60 0 118
-w 60 0 119
-x 60 0 120
-y 60 1 121
-z 60 0 122
-{ 60 3 123
-| 60 3 124
-} 60 3 125
-~ 60 0 126
-ct 60 2 162
-\- 60 0 177
-en "
-dg 60 3 178
-bu 60 0 183
-de 60 2 202
-em 60 0 208
-14 60 2 1
-34 60 2 1
-12 60 2 1
-`` 60 2 170
-'' 60 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CW.name b/usr/src/cmd/lp/filter/postscript/font/devpost/CW.name
deleted file mode 100644
index 75f4fae71e..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CW.name
+++ /dev/null
@@ -1 +0,0 @@
-Courier
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CX b/usr/src/cmd/lp/filter/postscript/font/devpost/CX
deleted file mode 100644
index b804583461..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CX
+++ /dev/null
@@ -1,142 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Courier-BoldOblique
-name CX
-internalname 8
-spacewidth 60
-charset
-! 60 2 33
-" 60 2 34
-# 60 2 35
-$ 60 2 36
-% 60 2 37
-& 60 2 38
-' 60 2 39
-( 60 3 40
-) 60 3 41
-* 60 2 42
-+ 60 0 43
-, 60 1 44
-hy 60 0 45
-- "
-. 60 0 46
-/ 60 2 47
-0 60 2 48
-1 60 2 49
-2 60 2 50
-3 60 2 51
-4 60 2 52
-5 60 2 53
-6 60 2 54
-7 60 2 55
-8 60 2 56
-9 60 2 57
-: 60 0 58
-; 60 1 59
-< 60 2 60
-= 60 0 61
-> 60 2 62
-? 60 2 63
-@ 60 2 64
-A 60 2 65
-B 60 2 66
-C 60 2 67
-D 60 2 68
-E 60 2 69
-F 60 2 70
-G 60 2 71
-H 60 2 72
-I 60 2 73
-J 60 2 74
-K 60 2 75
-L 60 2 76
-M 60 2 77
-N 60 2 78
-O 60 2 79
-P 60 2 80
-Q 60 3 81
-R 60 2 82
-S 60 2 83
-T 60 2 84
-U 60 2 85
-V 60 2 86
-W 60 2 87
-X 60 2 88
-Y 60 2 89
-Z 60 2 90
-[ 60 3 91
-\ 60 3 92
-] 60 3 93
-^ 60 2 94
-_ 60 1 95
-` 60 2 96
-a 60 0 97
-b 60 2 98
-c 60 0 99
-d 60 2 100
-e 60 0 101
-f 60 2 102
-g 60 1 103
-h 60 2 104
-i 60 2 105
-j 60 3 106
-k 60 2 107
-l 60 2 108
-m 60 0 109
-n 60 0 110
-o 60 0 111
-p 60 1 112
-q 60 1 113
-r 60 0 114
-s 60 0 115
-t 60 2 116
-u 60 0 117
-v 60 0 118
-w 60 0 119
-x 60 0 120
-y 60 1 121
-z 60 0 122
-{ 60 3 123
-| 60 3 124
-} 60 3 125
-~ 60 0 126
-ct 60 2 162
-\- 60 0 177
-en "
-dg 60 3 178
-bu 60 0 183
-de 60 2 202
-em 60 0 208
-14 60 2 1
-34 60 2 1
-12 60 2 1
-`` 60 2 170
-'' 60 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/CX.name b/usr/src/cmd/lp/filter/postscript/font/devpost/CX.name
deleted file mode 100644
index cbd4f3d606..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/CX.name
+++ /dev/null
@@ -1 +0,0 @@
-Courier-BoldOblique
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/DESC b/usr/src/cmd/lp/filter/postscript/font/devpost/DESC
deleted file mode 100644
index 0472a8f612..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/DESC
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Description file for Postscript printers. The resolution and unitwidth have
-# been selected to match, in a sense, PostScript's default coordinate system
-# and the widths given in Adobe's Font manual.
-#
-# Right now biggestfont shouldn't be set larger than 219.
-#
-
-fonts 10 R I B BI CW H HB HX S1 S
-sizes 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
-24 25 26 27 28 29 30 31 32 33 34 35 36 38 40 44 48 54 60 72 0
-res 720
-hor 1
-vert 1
-unitwidth 10
-biggestfont 200
-charset
-hy ct fi fl ff Fi Fl dg em 14 34 12 \- en \' aa
-\` ga ru sc dd -> \e br Sl ps cs cy as os =. ld
-rd le ge pp -+
-sq bx ci fa te ** pl mi \< eq \> ~= *A *B *X *D
-*E *F *G *Y *I *K *L *M *N *O *P *R *H *S *T *U
-*W *C *Q *Z ul \_ rn *a *b *x *d *e *f *g *y *i
-*k *l *m *n *o *p *h *r *s *t *u *w *c *q *z \{
-\| \} ap fm <= sl if <- ua da de +- >= mu pt pd
-bu di != == ~~ al Ox O+ es ca cu sp ip sb ib mo
-gr rg co tm sr no \^ or lc lf lt lk lb bv is rc
-rf rt rk rb ts lh rh LV LH Lb L1 LA `` '' ob vr
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/DESC.big b/usr/src/cmd/lp/filter/postscript/font/devpost/DESC.big
deleted file mode 100644
index 4c5d91e054..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/DESC.big
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Description file for Postscript printers. The resolution and unitwidth have
-# been selected to match, in a sense, PostScript's default coordinate system
-# and the widths given in Adobe's Font manual.
-#
-# Right now biggestfont shouldn't be set larger than 219.
-#
-
-fonts 10 R I B BI CW H HB HX S1 S
-sizes 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
-24 25 26 27 28 29 30 31 32 33 34 35 36 38 40 44 48 54 60 72 0
-res 720
-hor 1
-vert 1
-unitwidth 10
-biggestfont 200
-charset
-hy ct fi fl ff Fi Fl dg em 14 34 12 \- en \' aa
-\` ga ru sc dd -> \e br Sl ps cs cy as os =. ld
-rd le ge pp -+
-sq bx ci fa te ** pl mi \< eq \> ~= *A *B *X *D
-*E *F *G *Y *I *K *L *M *N *O *P *R *H *S *T *U *W
-*C *Q *Z ul \_ rn *a *b *x *d *e *f *g *y *i *k
-*l *m *n *o *p *h *r *s *t *u *w *c *q *z \{ \|
-\} ap fm <= sl if <- ua da de +- >= mu pt pd bu
-di != == ~~ al Ox O+ es ca cu sp ip sb ib mo gr
-rg co tm sr no \^ or lc lf lt lk lb bv is rc rf
-rt rk rb ts lh rh LV LH Lb L1 LA `` ''
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/DESC.small b/usr/src/cmd/lp/filter/postscript/font/devpost/DESC.small
deleted file mode 100644
index 3c68c4e766..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/DESC.small
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# A DESC file that can be used with the new version of makedev to produce smaller
-# DESC.out files. May help if you're running troff on a PC with a small address
-# space. biggestfont is set to the size of the CW font, and will accomodate all
-# font files except S and ZD. If you use this version ZD will only be mountable
-# in font position 0 using \f(ZD. To use it replace DESC by DESC.small before
-# building the binary font files. Also included a version of the S font file,
-# S.small, that has all unnamed characters (ie. ones named by ---) removed. Using
-# it will further decrease the size of DESC.out - but may not be necessary.
-#
-
-fonts 10 R I B BI CW H HB HX S1 S
-sizes 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
-24 25 26 27 28 29 30 31 32 33 34 35 36 38 40 44 48 54 60 72 0
-res 720
-hor 1
-vert 1
-unitwidth 10
-biggestfont 106
-charset
-hy ct fi fl ff Fi Fl dg em 14 34 12 \- en \' aa
-\` ga ru sc dd -> \e br Sl ps cs cy as os =. ld
-rd le ge pp -+
-sq bx ci fa te ** pl mi \< eq \> ~= *A *B *X *D
-*E *F *G *Y *I *K *L *M *N *O *P *R *H *S *T *U *W
-*C *Q *Z ul \_ rn *a *b *x *d *e *f *g *y *i *k
-*l *m *n *o *p *h *r *s *t *u *w *c *q *z \{ \|
-\} ap fm <= sl if <- ua da de +- >= mu pt pd bu
-di != == ~~ al Ox O+ es ca cu sp ip sb ib mo gr
-rg co tm sr no \^ or lc lf lt lk lb bv is rc rf
-rt rk rb ts lh rh LV LH Lb L1 LA `` ''
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/GR b/usr/src/cmd/lp/filter/postscript/font/devpost/GR
deleted file mode 100644
index 919f70bda4..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/GR
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Greek
-name GR
-internalname 33
-special
-charset
-*a 63 0 97
-*b 55 3 98
-*g 41 1 103
-*d 49 2 100
-*e 44 0 101
-*z 49 3 122
-*y 60 1 104
-*h 52 2 113
-*i 33 0 105
-*k 55 0 107
-*l 55 2 108
-*m 58 1 109
-*n 52 0 110
-*c 49 3 120
-*o 55 0 111
-*p 55 0 112
-*r 55 1 114
-*s 60 0 115
-*t 44 0 116
-*u 58 0 117
-*f 52 3 102
-*x 55 1 99
-*q 69 1 121
-*w 69 0 119
-*A 72 2 65
-*B 67 2 66
-*G 60 2 71
-*D 61 2 68
-*E 61 2 69
-*Z 61 2 90
-*Y 72 2 72
-*H 74 2 81
-*R 56 2 82
-*I 33 2 73
-*K 72 2 75
-*L 69 2 76
-*M 89 2 77
-*N 72 2 78
-*C 65 2 88
-*O 72 2 79
-*P 77 2 80
-*S 59 2 83
-*T 61 2 84
-*U 69 2 85
-*F 76 2 70
-*X 72 2 67
-*Q 80 2 89
-*W 77 2 87
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/GR.name b/usr/src/cmd/lp/filter/postscript/font/devpost/GR.name
deleted file mode 100644
index c5fe836342..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/GR.name
+++ /dev/null
@@ -1 +0,0 @@
-Symbol
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/H b/usr/src/cmd/lp/filter/postscript/font/devpost/H
deleted file mode 100644
index 1aef144198..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/H
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Helvetica
-name H
-internalname 9
-ligatures fi fl 0
-charset
-! 28 2 33
-$ 56 3 36
-% 89 2 37
-& 67 2 38
-' 22 2 39
-( 33 3 40
-) 33 3 41
-* 39 2 42
-+ 58 0 43
-, 28 1 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 28 2 47
-0 56 2 48
-1 56 2 49
-2 56 2 50
-3 56 2 51
-4 56 2 52
-5 56 2 53
-6 56 2 54
-7 56 2 55
-8 56 2 56
-9 56 2 57
-: 28 0 58
-; 28 1 59
-= 58 0 61
-? 56 2 63
-A 67 2 65
-B 67 2 66
-C 72 2 67
-D 72 2 68
-E 67 2 69
-F 61 2 70
-G 78 2 71
-H 72 2 72
-I 28 2 73
-J 50 2 74
-K 67 2 75
-L 56 2 76
-M 83 2 77
-N 72 2 78
-O 78 2 79
-P 67 2 80
-Q 78 2 81
-R 72 2 82
-S 67 2 83
-T 61 2 84
-U 72 2 85
-V 67 2 86
-W 94 2 87
-X 67 2 88
-Y 67 2 89
-Z 61 2 90
-[ 28 3 91
-] 28 3 93
-` 22 2 96
-a 56 0 97
-b 56 2 98
-c 50 0 99
-d 56 2 100
-e 56 0 101
-f 28 2 102
-g 56 1 103
-h 56 2 104
-i 22 2 105
-j 22 3 106
-k 50 2 107
-l 22 2 108
-m 83 0 109
-n 56 0 110
-o 56 0 111
-p 56 1 112
-q 56 1 113
-r 33 0 114
-s 50 0 115
-t 28 2 116
-u 56 0 117
-v 50 0 118
-w 72 0 119
-x 50 0 120
-y 50 1 121
-z 50 0 122
-ct 56 3 162
-fi 50 2 174
-fl 50 2 175
-dg 56 3 178
-bu 35 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 33 2 170
-'' 33 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/H.name b/usr/src/cmd/lp/filter/postscript/font/devpost/H.name
deleted file mode 100644
index c2ed429f59..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/H.name
+++ /dev/null
@@ -1 +0,0 @@
-Helvetica
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/HB b/usr/src/cmd/lp/filter/postscript/font/devpost/HB
deleted file mode 100644
index f6758640c6..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/HB
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Helvetica-Bold
-name HB
-internalname 11
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 56 3 36
-% 89 2 37
-& 72 2 38
-' 28 2 39
-( 33 3 40
-) 33 3 41
-* 39 2 42
-+ 58 0 43
-, 28 1 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 28 2 47
-0 56 2 48
-1 56 2 49
-2 56 2 50
-3 56 2 51
-4 56 2 52
-5 56 2 53
-6 56 2 54
-7 56 2 55
-8 56 2 56
-9 56 2 57
-: 33 0 58
-; 33 1 59
-= 58 0 61
-? 61 2 63
-A 72 2 65
-B 72 2 66
-C 72 2 67
-D 72 2 68
-E 67 2 69
-F 61 2 70
-G 78 2 71
-H 72 2 72
-I 28 2 73
-J 56 2 74
-K 72 2 75
-L 61 2 76
-M 83 2 77
-N 72 2 78
-O 78 2 79
-P 67 2 80
-Q 78 2 81
-R 72 2 82
-S 67 2 83
-T 61 2 84
-U 72 2 85
-V 67 2 86
-W 94 2 87
-X 67 2 88
-Y 67 2 89
-Z 61 2 90
-[ 33 3 91
-] 33 3 93
-` 28 2 96
-a 56 0 97
-b 61 2 98
-c 56 0 99
-d 61 2 100
-e 56 0 101
-f 33 2 102
-g 61 1 103
-h 61 2 104
-i 28 2 105
-j 28 3 106
-k 56 2 107
-l 28 2 108
-m 89 0 109
-n 61 0 110
-o 61 0 111
-p 61 1 112
-q 61 1 113
-r 39 0 114
-s 56 0 115
-t 33 2 116
-u 61 0 117
-v 56 0 118
-w 78 0 119
-x 56 0 120
-y 56 1 121
-z 50 0 122
-ct 56 3 162
-fi 61 2 174
-fl 61 2 175
-dg 56 3 178
-bu 35 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/HB.name b/usr/src/cmd/lp/filter/postscript/font/devpost/HB.name
deleted file mode 100644
index b6fcae93c0..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/HB.name
+++ /dev/null
@@ -1 +0,0 @@
-Helvetica-Bold
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/HI b/usr/src/cmd/lp/filter/postscript/font/devpost/HI
deleted file mode 100644
index fe5d467043..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/HI
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Helvetica-Oblique
-name HI
-internalname 10
-ligatures fi fl 0
-charset
-! 28 2 33
-$ 56 3 36
-% 89 2 37
-& 67 2 38
-' 22 2 39
-( 33 3 40
-) 33 3 41
-* 39 2 42
-+ 58 0 43
-, 28 1 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 28 2 47
-0 56 2 48
-1 56 2 49
-2 56 2 50
-3 56 2 51
-4 56 2 52
-5 56 2 53
-6 56 2 54
-7 56 2 55
-8 56 2 56
-9 56 2 57
-: 28 0 58
-; 28 1 59
-= 58 0 61
-? 56 2 63
-A 67 2 65
-B 67 2 66
-C 72 2 67
-D 72 2 68
-E 67 2 69
-F 61 2 70
-G 78 2 71
-H 72 2 72
-I 28 2 73
-J 50 2 74
-K 67 2 75
-L 56 2 76
-M 83 2 77
-N 72 2 78
-O 78 2 79
-P 67 2 80
-Q 78 2 81
-R 72 2 82
-S 67 2 83
-T 61 2 84
-U 72 2 85
-V 67 2 86
-W 94 2 87
-X 67 2 88
-Y 67 2 89
-Z 61 2 90
-[ 28 3 91
-] 28 3 93
-` 22 2 96
-a 56 0 97
-b 56 2 98
-c 50 0 99
-d 56 2 100
-e 56 0 101
-f 28 2 102
-g 56 1 103
-h 56 2 104
-i 22 2 105
-j 22 3 106
-k 50 2 107
-l 22 2 108
-m 83 0 109
-n 56 0 110
-o 56 0 111
-p 56 1 112
-q 56 1 113
-r 33 0 114
-s 50 0 115
-t 28 2 116
-u 56 0 117
-v 50 0 118
-w 72 0 119
-x 50 0 120
-y 50 1 121
-z 50 0 122
-ct 56 3 162
-fi 50 2 174
-fl 50 2 175
-dg 56 3 178
-bu 35 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 33 2 170
-'' 33 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/HI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/HI.name
deleted file mode 100644
index 1082d54ec2..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/HI.name
+++ /dev/null
@@ -1 +0,0 @@
-Helvetica-Oblique
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/HX b/usr/src/cmd/lp/filter/postscript/font/devpost/HX
deleted file mode 100644
index 857b910acb..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/HX
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Helvetica-BoldOblique
-name HX
-internalname 12
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 56 3 36
-% 89 2 37
-& 72 2 38
-' 28 2 39
-( 33 3 40
-) 33 3 41
-* 39 2 42
-+ 58 0 43
-, 28 1 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 28 2 47
-0 56 2 48
-1 56 2 49
-2 56 2 50
-3 56 2 51
-4 56 2 52
-5 56 2 53
-6 56 2 54
-7 56 2 55
-8 56 2 56
-9 56 2 57
-: 33 0 58
-; 33 1 59
-= 58 0 61
-? 61 2 63
-A 72 2 65
-B 72 2 66
-C 72 2 67
-D 72 2 68
-E 67 2 69
-F 61 2 70
-G 78 2 71
-H 72 2 72
-I 28 2 73
-J 56 2 74
-K 72 2 75
-L 61 2 76
-M 83 2 77
-N 72 2 78
-O 78 2 79
-P 67 2 80
-Q 78 2 81
-R 72 2 82
-S 67 2 83
-T 61 2 84
-U 72 2 85
-V 67 2 86
-W 94 2 87
-X 67 2 88
-Y 67 2 89
-Z 61 2 90
-[ 33 3 91
-] 33 3 93
-` 28 2 96
-a 56 0 97
-b 61 2 98
-c 56 0 99
-d 61 2 100
-e 56 0 101
-f 33 2 102
-g 61 1 103
-h 61 2 104
-i 28 2 105
-j 28 3 106
-k 56 2 107
-l 28 2 108
-m 89 0 109
-n 61 0 110
-o 61 0 111
-p 61 1 112
-q 61 1 113
-r 39 0 114
-s 56 0 115
-t 33 2 116
-u 61 0 117
-v 56 0 118
-w 78 0 119
-x 56 0 120
-y 56 1 121
-z 50 0 122
-ct 56 3 162
-fi 61 2 174
-fl 61 2 175
-dg 56 3 178
-bu 35 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/HX.name b/usr/src/cmd/lp/filter/postscript/font/devpost/HX.name
deleted file mode 100644
index 41e8c82f18..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/HX.name
+++ /dev/null
@@ -1 +0,0 @@
-Helvetica-BoldOblique
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Hb b/usr/src/cmd/lp/filter/postscript/font/devpost/Hb
deleted file mode 100644
index ad7b7636c0..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Hb
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Helvetica-Narrow-Bold
-name Hb
-internalname 19
-ligatures fi fl 0
-charset
-! 27 2 33
-$ 46 3 36
-% 73 2 37
-& 59 2 38
-' 23 2 39
-( 27 3 40
-) 27 3 41
-* 32 2 42
-+ 48 0 43
-, 23 1 44
-hy 27 0 45
-- "
-. 23 0 46
-/ 23 2 47
-0 46 2 48
-1 46 2 49
-2 46 2 50
-3 46 2 51
-4 46 2 52
-5 46 2 53
-6 46 2 54
-7 46 2 55
-8 46 2 56
-9 46 2 57
-: 27 0 58
-; 27 1 59
-= 48 0 61
-? 50 2 63
-A 59 2 65
-B 59 2 66
-C 59 2 67
-D 59 2 68
-E 55 2 69
-F 50 2 70
-G 64 2 71
-H 59 2 72
-I 23 2 73
-J 46 2 74
-K 59 2 75
-L 50 2 76
-M 68 2 77
-N 59 2 78
-O 64 2 79
-P 55 2 80
-Q 64 2 81
-R 59 2 82
-S 55 2 83
-T 50 2 84
-U 59 2 85
-V 55 2 86
-W 77 2 87
-X 55 2 88
-Y 55 2 89
-Z 50 2 90
-[ 27 3 91
-] 27 3 93
-` 23 2 96
-a 46 0 97
-b 50 2 98
-c 46 0 99
-d 50 2 100
-e 46 0 101
-f 27 2 102
-g 50 1 103
-h 50 2 104
-i 23 2 105
-j 23 3 106
-k 46 2 107
-l 23 2 108
-m 73 0 109
-n 50 0 110
-o 50 0 111
-p 50 1 112
-q 50 1 113
-r 32 0 114
-s 46 0 115
-t 27 2 116
-u 50 0 117
-v 46 0 118
-w 64 0 119
-x 46 0 120
-y 46 1 121
-z 41 0 122
-ct 46 3 162
-fi 50 2 174
-fl 50 2 175
-dg 46 3 178
-bu 29 0 183
-de 27 2 202
-em 82 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 41 2 170
-'' 41 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Hb.name b/usr/src/cmd/lp/filter/postscript/font/devpost/Hb.name
deleted file mode 100644
index c13a099737..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Hb.name
+++ /dev/null
@@ -1 +0,0 @@
-Helvetica-Narrow-Bold
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Hi b/usr/src/cmd/lp/filter/postscript/font/devpost/Hi
deleted file mode 100644
index f8261bd80f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Hi
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Helvetica-Narrow-Oblique
-name Hi
-internalname 18
-ligatures fi fl 0
-charset
-! 23 2 33
-$ 46 3 36
-% 73 2 37
-& 55 2 38
-' 18 2 39
-( 27 3 40
-) 27 3 41
-* 32 2 42
-+ 48 0 43
-, 23 1 44
-hy 27 0 45
-- "
-. 23 0 46
-/ 23 2 47
-0 46 2 48
-1 46 2 49
-2 46 2 50
-3 46 2 51
-4 46 2 52
-5 46 2 53
-6 46 2 54
-7 46 2 55
-8 46 2 56
-9 46 2 57
-: 23 0 58
-; 23 1 59
-= 48 0 61
-? 46 2 63
-A 55 2 65
-B 55 2 66
-C 59 2 67
-D 59 2 68
-E 55 2 69
-F 50 2 70
-G 64 2 71
-H 59 2 72
-I 23 2 73
-J 41 2 74
-K 55 2 75
-L 46 2 76
-M 68 2 77
-N 59 2 78
-O 64 2 79
-P 55 2 80
-Q 64 2 81
-R 59 2 82
-S 55 2 83
-T 50 2 84
-U 59 2 85
-V 55 2 86
-W 77 2 87
-X 55 2 88
-Y 55 2 89
-Z 50 2 90
-[ 23 3 91
-] 23 3 93
-` 18 2 96
-a 46 0 97
-b 46 2 98
-c 41 0 99
-d 46 2 100
-e 46 0 101
-f 23 2 102
-g 46 1 103
-h 46 2 104
-i 18 2 105
-j 18 3 106
-k 41 2 107
-l 18 2 108
-m 68 0 109
-n 46 0 110
-o 46 0 111
-p 46 1 112
-q 46 1 113
-r 27 0 114
-s 41 0 115
-t 23 2 116
-u 46 0 117
-v 41 0 118
-w 59 0 119
-x 41 0 120
-y 41 1 121
-z 41 0 122
-ct 46 3 162
-fi 41 2 174
-fl 41 2 175
-dg 46 3 178
-bu 29 0 183
-de 27 2 202
-em 82 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 27 2 170
-'' 27 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Hi.name b/usr/src/cmd/lp/filter/postscript/font/devpost/Hi.name
deleted file mode 100644
index 5702536b08..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Hi.name
+++ /dev/null
@@ -1 +0,0 @@
-Helvetica-Narrow-Oblique
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Hr b/usr/src/cmd/lp/filter/postscript/font/devpost/Hr
deleted file mode 100644
index a67afe0f41..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Hr
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Helvetica-Narrow
-name Hr
-internalname 17
-ligatures fi fl 0
-charset
-! 23 2 33
-$ 46 3 36
-% 73 2 37
-& 55 2 38
-' 18 2 39
-( 27 3 40
-) 27 3 41
-* 32 2 42
-+ 48 0 43
-, 23 1 44
-hy 27 0 45
-- "
-. 23 0 46
-/ 23 2 47
-0 46 2 48
-1 46 2 49
-2 46 2 50
-3 46 2 51
-4 46 2 52
-5 46 2 53
-6 46 2 54
-7 46 2 55
-8 46 2 56
-9 46 2 57
-: 23 0 58
-; 23 1 59
-= 48 0 61
-? 46 2 63
-A 55 2 65
-B 55 2 66
-C 59 2 67
-D 59 2 68
-E 55 2 69
-F 50 2 70
-G 64 2 71
-H 59 2 72
-I 23 2 73
-J 41 2 74
-K 55 2 75
-L 46 2 76
-M 68 2 77
-N 59 2 78
-O 64 2 79
-P 55 2 80
-Q 64 2 81
-R 59 2 82
-S 55 2 83
-T 50 2 84
-U 59 2 85
-V 55 2 86
-W 77 2 87
-X 55 2 88
-Y 55 2 89
-Z 50 2 90
-[ 23 3 91
-] 23 3 93
-` 18 2 96
-a 46 0 97
-b 46 2 98
-c 41 0 99
-d 46 2 100
-e 46 0 101
-f 23 2 102
-g 46 1 103
-h 46 2 104
-i 18 2 105
-j 18 3 106
-k 41 2 107
-l 18 2 108
-m 68 0 109
-n 46 0 110
-o 46 0 111
-p 46 1 112
-q 46 1 113
-r 27 0 114
-s 41 0 115
-t 23 2 116
-u 46 0 117
-v 41 0 118
-w 59 0 119
-x 41 0 120
-y 41 1 121
-z 41 0 122
-ct 46 3 162
-fi 41 2 174
-fl 41 2 175
-dg 46 3 178
-bu 29 0 183
-de 27 2 202
-em 82 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 27 2 170
-'' 27 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Hr.name b/usr/src/cmd/lp/filter/postscript/font/devpost/Hr.name
deleted file mode 100644
index 73a487bb4a..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Hr.name
+++ /dev/null
@@ -1 +0,0 @@
-Helvetica-Narrow
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Hx b/usr/src/cmd/lp/filter/postscript/font/devpost/Hx
deleted file mode 100644
index daf3bbde92..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Hx
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Helvetica-Narrow-BoldOblique
-name Hx
-internalname 20
-ligatures fi fl 0
-charset
-! 27 2 33
-$ 46 3 36
-% 73 2 37
-& 59 2 38
-' 23 2 39
-( 27 3 40
-) 27 3 41
-* 32 2 42
-+ 48 0 43
-, 23 1 44
-hy 27 0 45
-- "
-. 23 0 46
-/ 23 2 47
-0 46 2 48
-1 46 2 49
-2 46 2 50
-3 46 2 51
-4 46 2 52
-5 46 2 53
-6 46 2 54
-7 46 2 55
-8 46 2 56
-9 46 2 57
-: 27 0 58
-; 27 1 59
-= 48 0 61
-? 50 2 63
-A 59 2 65
-B 59 2 66
-C 59 2 67
-D 59 2 68
-E 55 2 69
-F 50 2 70
-G 64 2 71
-H 59 2 72
-I 23 2 73
-J 46 2 74
-K 59 2 75
-L 50 2 76
-M 68 2 77
-N 59 2 78
-O 64 2 79
-P 55 2 80
-Q 64 2 81
-R 59 2 82
-S 55 2 83
-T 50 2 84
-U 59 2 85
-V 55 2 86
-W 77 2 87
-X 55 2 88
-Y 55 2 89
-Z 50 2 90
-[ 27 3 91
-] 27 3 93
-` 23 2 96
-a 46 0 97
-b 50 2 98
-c 46 0 99
-d 50 2 100
-e 46 0 101
-f 27 2 102
-g 50 1 103
-h 50 2 104
-i 23 2 105
-j 23 3 106
-k 46 2 107
-l 23 2 108
-m 73 0 109
-n 50 0 110
-o 50 0 111
-p 50 1 112
-q 50 1 113
-r 32 0 114
-s 46 0 115
-t 27 2 116
-u 50 0 117
-v 46 0 118
-w 64 0 119
-x 46 0 120
-y 46 1 121
-z 41 0 122
-ct 46 3 162
-fi 50 2 174
-fl 50 2 175
-dg 46 3 178
-bu 29 0 183
-de 27 2 202
-em 82 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 41 2 170
-'' 41 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Hx.name b/usr/src/cmd/lp/filter/postscript/font/devpost/Hx.name
deleted file mode 100644
index bcb1cd265f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Hx.name
+++ /dev/null
@@ -1 +0,0 @@
-Helvetica-Narrow-BoldOblique
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/I b/usr/src/cmd/lp/filter/postscript/font/devpost/I
deleted file mode 100644
index ce4d027019..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/I
+++ /dev/null
@@ -1,134 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Times-Italic
-name I
-internalname 2
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 50 2 36
-% 83 2 37
-& 78 2 38
-' 33 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 68 0 43
-, 25 1 44
-hy 33 0 45
-- "
-. 25 0 46
-/ 28 2 47
-0 50 2 48
-1 50 2 49
-2 50 2 50
-3 50 2 51
-4 50 2 52
-5 50 2 53
-6 50 2 54
-7 50 2 55
-8 50 2 56
-9 50 2 57
-: 33 0 58
-; 33 1 59
-= 68 0 61
-? 50 2 63
-A 61 2 65
-B 61 2 66
-C 67 2 67
-D 72 2 68
-E 61 2 69
-F 61 2 70
-G 72 2 71
-H 72 2 72
-I 33 2 73
-J 44 2 74
-K 67 2 75
-L 56 2 76
-M 83 2 77
-N 67 2 78
-O 72 2 79
-P 61 2 80
-Q 72 3 81
-R 61 2 82
-S 50 2 83
-T 56 2 84
-U 72 2 85
-V 61 2 86
-W 83 2 87
-X 61 2 88
-Y 56 2 89
-Z 56 2 90
-[ 39 3 91
-] 39 3 93
-` 33 2 96
-a 50 0 97
-b 50 2 98
-c 44 0 99
-d 50 2 100
-e 44 0 101
-f 28 3 102
-g 50 1 103
-h 50 2 104
-i 28 2 105
-j 28 3 106
-k 44 2 107
-l 28 2 108
-m 72 0 109
-n 50 0 110
-o 50 0 111
-p 50 1 112
-q 50 1 113
-r 39 0 114
-s 39 0 115
-t 28 0 116
-u 50 0 117
-v 44 0 118
-w 67 0 119
-x 44 0 120
-y 44 1 121
-z 39 0 122
-ct 50 3 162
-fi 50 3 174
-fl 50 3 175
-ff 50 2 1
-Fi 72 2 1
-Fl 72 2 1
-dg 50 2 178
-bu 35 0 183
-de 33 2 202
-em 89 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-sq 50 2 1
-`` 56 2 170
-'' 56 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/I.name b/usr/src/cmd/lp/filter/postscript/font/devpost/I.name
deleted file mode 100644
index df19d08bda..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/I.name
+++ /dev/null
@@ -1 +0,0 @@
-Times-Italic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/KB b/usr/src/cmd/lp/filter/postscript/font/devpost/KB
deleted file mode 100644
index 1aef8be74f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/KB
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Bookman-Demi
-name KB
-internalname 23
-ligatures fi fl 0
-charset
-! 36 2 33
-$ 66 3 36
-% 94 2 37
-& 80 2 38
-' 32 2 39
-( 32 3 40
-) 32 3 41
-* 46 2 42
-+ 60 0 43
-, 34 1 44
-hy 36 0 45
-- "
-. 34 0 46
-/ 60 3 47
-0 66 2 48
-1 66 2 49
-2 66 2 50
-3 66 2 51
-4 66 2 52
-5 66 2 53
-6 66 2 54
-7 66 2 55
-8 66 2 56
-9 66 2 57
-: 34 0 58
-; 34 1 59
-= 60 0 61
-? 66 2 63
-A 72 2 65
-B 72 2 66
-C 74 2 67
-D 78 2 68
-E 72 2 69
-F 68 2 70
-G 78 2 71
-H 82 2 72
-I 40 2 73
-J 64 2 74
-K 80 2 75
-L 64 2 76
-M 94 2 77
-N 74 2 78
-O 80 2 79
-P 66 2 80
-Q 80 3 81
-R 78 2 82
-S 66 2 83
-T 70 2 84
-U 74 2 85
-V 72 2 86
-W 94 2 87
-X 78 2 88
-Y 70 2 89
-Z 64 2 90
-[ 30 3 91
-] 30 3 93
-` 32 2 96
-a 58 0 97
-b 60 2 98
-c 58 0 99
-d 64 2 100
-e 58 0 101
-f 38 2 102
-g 58 3 103
-h 68 2 104
-i 36 2 105
-j 34 3 106
-k 66 2 107
-l 34 2 108
-m 100 0 109
-n 68 0 110
-o 62 0 111
-p 64 1 112
-q 62 1 113
-r 46 0 114
-s 52 0 115
-t 46 2 116
-u 66 0 117
-v 60 0 118
-w 80 0 119
-x 60 0 120
-y 62 1 121
-z 56 0 122
-ct 66 2 162
-fi 74 2 174
-fl 74 2 175
-dg 44 3 178
-bu 46 0 183
-de 34 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 54 2 170
-'' 54 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/KB.name b/usr/src/cmd/lp/filter/postscript/font/devpost/KB.name
deleted file mode 100644
index 8b408b1708..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/KB.name
+++ /dev/null
@@ -1 +0,0 @@
-Bookman-Demi
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/KI b/usr/src/cmd/lp/filter/postscript/font/devpost/KI
deleted file mode 100644
index 2264ef1c30..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/KI
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Bookman-LightItalic
-name KI
-internalname 22
-ligatures fi fl 0
-charset
-! 32 2 33
-$ 62 2 36
-% 80 2 37
-& 82 2 38
-' 28 2 39
-( 28 3 40
-) 28 3 41
-* 44 2 42
-+ 60 0 43
-, 30 1 44
-hy 32 0 45
-- "
-. 30 0 46
-/ 60 3 47
-0 62 2 48
-1 62 2 49
-2 62 2 50
-3 62 2 51
-4 62 2 52
-5 62 2 53
-6 62 2 54
-7 62 2 55
-8 62 2 56
-9 62 2 57
-: 30 0 58
-; 30 1 59
-= 60 0 61
-? 54 2 63
-A 70 2 65
-B 72 2 66
-C 72 2 67
-D 74 2 68
-E 68 2 69
-F 62 2 70
-G 76 2 71
-H 80 2 72
-I 32 2 73
-J 56 2 74
-K 72 2 75
-L 58 2 76
-M 86 2 77
-N 72 2 78
-O 76 2 79
-P 60 2 80
-Q 78 3 81
-R 70 2 82
-S 64 2 83
-T 60 2 84
-U 72 2 85
-V 68 2 86
-W 96 2 87
-X 70 2 88
-Y 66 2 89
-Z 58 2 90
-[ 26 3 91
-] 26 3 93
-` 28 2 96
-a 62 0 97
-b 60 2 98
-c 48 0 99
-d 64 2 100
-e 54 0 101
-f 34 3 102
-g 56 1 103
-h 62 2 104
-i 28 2 105
-j 28 3 106
-k 60 2 107
-l 28 2 108
-m 88 0 109
-n 62 0 110
-o 54 0 111
-p 60 1 112
-q 56 1 113
-r 40 0 114
-s 54 0 115
-t 34 2 116
-u 62 0 117
-v 54 0 118
-w 88 0 119
-x 54 0 120
-y 60 1 121
-z 52 0 122
-ct 62 2 162
-fi 64 3 174
-fl 66 3 175
-dg 62 3 178
-bu 46 0 183
-de 30 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 44 2 170
-'' 44 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/KI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/KI.name
deleted file mode 100644
index d00e32f28b..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/KI.name
+++ /dev/null
@@ -1 +0,0 @@
-Bookman-LightItalic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/KR b/usr/src/cmd/lp/filter/postscript/font/devpost/KR
deleted file mode 100644
index 59303d06ac..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/KR
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Bookman-Light
-name KR
-internalname 21
-ligatures fi fl 0
-charset
-! 30 2 33
-$ 62 2 36
-% 90 2 37
-& 80 2 38
-' 22 2 39
-( 30 3 40
-) 30 3 41
-* 44 2 42
-+ 60 0 43
-, 32 1 44
-hy 40 0 45
-- "
-. 32 0 46
-/ 60 3 47
-0 62 2 48
-1 62 2 49
-2 62 2 50
-3 62 2 51
-4 62 2 52
-5 62 2 53
-6 62 2 54
-7 62 2 55
-8 62 2 56
-9 62 2 57
-: 32 0 58
-; 32 1 59
-= 60 0 61
-? 54 2 63
-A 68 2 65
-B 74 2 66
-C 74 2 67
-D 80 2 68
-E 72 2 69
-F 64 2 70
-G 80 2 71
-H 80 2 72
-I 34 2 73
-J 60 2 74
-K 72 2 75
-L 60 2 76
-M 92 2 77
-N 74 2 78
-O 80 2 79
-P 62 2 80
-Q 82 3 81
-R 72 2 82
-S 66 2 83
-T 62 2 84
-U 78 2 85
-V 70 2 86
-W 96 2 87
-X 72 2 88
-Y 64 2 89
-Z 64 2 90
-[ 30 3 91
-] 30 3 93
-` 22 2 96
-a 58 0 97
-b 62 2 98
-c 52 0 99
-d 62 2 100
-e 52 0 101
-f 32 2 102
-g 54 3 103
-h 66 2 104
-i 30 2 105
-j 30 3 106
-k 62 2 107
-l 30 2 108
-m 94 0 109
-n 66 0 110
-o 56 0 111
-p 62 1 112
-q 58 1 113
-r 44 0 114
-s 52 0 115
-t 38 2 116
-u 68 0 117
-v 52 0 118
-w 78 0 119
-x 56 0 120
-y 54 1 121
-z 48 0 122
-ct 62 2 162
-fi 62 2 174
-fl 62 2 175
-dg 54 3 178
-bu 46 0 183
-de 32 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 40 2 170
-'' 40 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/KR.name b/usr/src/cmd/lp/filter/postscript/font/devpost/KR.name
deleted file mode 100644
index f9eef0ca61..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/KR.name
+++ /dev/null
@@ -1 +0,0 @@
-Bookman-Light
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/KX b/usr/src/cmd/lp/filter/postscript/font/devpost/KX
deleted file mode 100644
index da20dbdf73..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/KX
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Bookman-DemiItalic
-name KX
-internalname 24
-ligatures fi fl 0
-charset
-! 32 2 33
-$ 68 3 36
-% 88 2 37
-& 98 2 38
-' 32 2 39
-( 26 3 40
-) 26 3 41
-* 46 2 42
-+ 60 0 43
-, 34 1 44
-hy 28 0 45
-- "
-. 34 0 46
-/ 36 2 47
-0 68 2 48
-1 68 2 49
-2 68 2 50
-3 68 2 51
-4 68 2 52
-5 68 2 53
-6 68 2 54
-7 68 2 55
-8 68 2 56
-9 68 2 57
-: 34 0 58
-; 34 1 59
-= 60 0 61
-? 62 2 63
-A 72 2 65
-B 72 2 66
-C 70 2 67
-D 76 2 68
-E 72 2 69
-F 66 2 70
-G 76 2 71
-H 80 2 72
-I 38 2 73
-J 62 2 74
-K 78 2 75
-L 64 2 76
-M 86 2 77
-N 74 2 78
-O 76 2 79
-P 64 2 80
-Q 76 3 81
-R 74 2 82
-S 70 2 83
-T 70 2 84
-U 74 2 85
-V 66 2 86
-W 100 2 87
-X 74 2 88
-Y 66 2 89
-Z 68 2 90
-[ 26 3 91
-] 26 3 93
-` 32 2 96
-a 68 0 97
-b 60 2 98
-c 56 0 99
-d 68 2 100
-e 56 0 101
-f 42 3 102
-g 62 1 103
-h 70 2 104
-i 38 2 105
-j 32 3 106
-k 70 2 107
-l 38 2 108
-m 96 0 109
-n 68 0 110
-o 60 0 111
-p 66 1 112
-q 62 1 113
-r 50 0 114
-s 54 0 115
-t 44 2 116
-u 68 0 117
-v 54 0 118
-w 86 0 119
-x 62 0 120
-y 60 1 121
-z 56 0 122
-ct 68 2 162
-fi 82 3 174
-fl 82 3 175
-dg 42 3 178
-bu 36 0 183
-de 36 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 52 2 170
-'' 52 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/KX.name b/usr/src/cmd/lp/filter/postscript/font/devpost/KX.name
deleted file mode 100644
index 591feecdc8..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/KX.name
+++ /dev/null
@@ -1 +0,0 @@
-Bookman-DemiItalic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/LINKFILE b/usr/src/cmd/lp/filter/postscript/font/devpost/LINKFILE
deleted file mode 100644
index e70c33ad16..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/LINKFILE
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-
-#
-# This file is used to link any missing .out files to appropriate existing
-# .out files.
-#
-
-rm -f G.out
-ln H.out G.out
-
-rm -f GI.out
-ln HI.out GI.out
-
-rm -f HM.out
-ln H.out HM.out
-
-rm -f HK.out
-ln H.out HK.out
-
-rm -f HL.out
-ln H.out HL.out
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/Makefile b/usr/src/cmd/lp/filter/postscript/font/devpost/Makefile
deleted file mode 100644
index fffb603bf0..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/Makefile
+++ /dev/null
@@ -1,98 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1989 by Sun Microsystems, Inc.
-#
-# cmd/lp/filter/postscript/font/devpost/Makefile
-#
-
-include ../../../../Makefile.lp
-
-FONTFILES = AB AI AR AX BI CB CI CO \
- CW CX GR HB HI HX Hb Hi \
- Hr Hx KB KI KR KX NB NI \
- NR NX PA PB PI PX S1 VB \
- VI VR VX ZD ZI B H I \
- R S
-FONTLNK1 = G HM HK HL
-FONTLNK2 = GI
-DESCFILE = DESC
-TXTS = DESC.big DESC.small S.big S.small LINKFILE
-
-FONTNAMES = $(FONTFILES:%=%.name)
-FONTLNK1OUTS = $(FONTLNK1:%=%.out)
-FONTLNK2OUTS = $(FONTLNK2:%=%.out)
-FONTOUTS = $(FONTFILES:%=%.out) $(DESCFILE:%=%.out)
-
-SUBDIRS = charlib
-
-NATIVEMAKEDEV = ../native/makedev
-
-ROOTLIBFONT = $(ROOT)/usr/lib/font
-ROOTDEVPOST = $(ROOTLIBFONT)/devpost
-
-ROOTFONTFILES = $(FONTFILES:%=$(ROOTDEVPOST)/%) \
- $(ROOTDEVPOST)/$(DESCFILE)
-ROOTFONTNAMES = $(FONTNAMES:%=$(ROOTDEVPOST)/%)
-ROOTFONTOUTS = $(FONTOUTS:%=$(ROOTDEVPOST)/%) \
- $(FONTLNK1OUTS:%=$(ROOTDEVPOST)/%) \
- $(FONTLNK2OUTS:%=$(ROOTDEVPOST)/%)
-
-FILEMODE = 0444
-
-.KEEP_STATE:
-
-all : $(TXTS) $(FONTOUTS) $(FONTNAMES) $(SUBDIRS)
-
-install: $(TXTS) $(FONTOUTS) $(FONTNAMES) \
- $(ROOTDEVPOST) $(ROOTFONTFILES) $(ROOTFONTNAMES) \
- $(ROOTFONTOUTS) $(SUBDIRS)
-
-$(FONTOUTS) : $$(@:%.out=%) $(NATIVEMAKEDEV)
- @$(RM) $@; $(NATIVEMAKEDEV) $(@:%.out=%)
-
-$(ROOTDEVPOST) :
- $(INS.dir)
-
-$(NATIVEMAKEDEV) :
- @cd ..; $(MAKE) native/makedev
-
-$(FONTLNK1OUTS) : H.out
- @$(RM) $@; $(LN) H.out $@
-
-$(FONTLNK2OUTS) : HI.out
- @$(RM) $@; $(LN) HI.out $@
-
-$(ROOTDEVPOST)/% : %
- $(INS.file)
-
-clean strip lint : $(SUBDIRS)
-
-clobber: $(SUBDIRS)
- $(RM) $(FONTOUTS) $(FONTLNK1OUTS) $(FONTLNK2OUTS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/NB b/usr/src/cmd/lp/filter/postscript/font/devpost/NB
deleted file mode 100644
index 63e9e27684..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/NB
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# NewCenturySchlbk-Bold
-name NB
-internalname 31
-ligatures fi fl 0
-charset
-! 30 2 33
-$ 57 3 36
-% 83 2 37
-& 85 2 38
-' 24 2 39
-( 39 3 40
-) 39 3 41
-* 50 2 42
-+ 61 0 43
-, 28 1 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 28 2 47
-0 57 2 48
-1 57 2 49
-2 57 2 50
-3 57 2 51
-4 57 2 52
-5 57 2 53
-6 57 2 54
-7 57 2 55
-8 57 2 56
-9 57 2 57
-: 28 0 58
-; 28 1 59
-= 61 0 61
-? 50 2 63
-A 76 2 65
-B 78 2 66
-C 78 2 67
-D 83 2 68
-E 76 2 69
-F 72 2 70
-G 83 2 71
-H 87 2 72
-I 44 2 73
-J 65 2 74
-K 81 2 75
-L 72 2 76
-M 98 2 77
-N 83 2 78
-O 83 2 79
-P 76 2 80
-Q 83 3 81
-R 81 2 82
-S 67 2 83
-T 72 2 84
-U 83 2 85
-V 76 2 86
-W 98 2 87
-X 72 2 88
-Y 72 2 89
-Z 67 2 90
-[ 39 3 91
-] 39 3 93
-` 24 2 96
-a 61 0 97
-b 65 2 98
-c 56 0 99
-d 67 2 100
-e 57 0 101
-f 39 2 102
-g 61 1 103
-h 69 2 104
-i 37 2 105
-j 35 3 106
-k 67 2 107
-l 35 2 108
-m 96 0 109
-n 69 0 110
-o 61 0 111
-p 67 1 112
-q 65 1 113
-r 52 0 114
-s 50 0 115
-t 43 2 116
-u 69 0 117
-v 61 0 118
-w 89 0 119
-x 61 0 120
-y 61 1 121
-z 54 0 122
-ct 57 3 162
-fi 69 2 174
-fl 69 2 175
-dg 50 2 178
-bu 61 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 48 2 170
-'' 48 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/NB.name b/usr/src/cmd/lp/filter/postscript/font/devpost/NB.name
deleted file mode 100644
index 3caf245522..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/NB.name
+++ /dev/null
@@ -1 +0,0 @@
-NewCenturySchlbk-Bold
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/NI b/usr/src/cmd/lp/filter/postscript/font/devpost/NI
deleted file mode 100644
index 8c5e8c9512..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/NI
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# NewCenturySchlbk-Italic
-name NI
-internalname 30
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 56 3 36
-% 83 2 37
-& 85 2 38
-' 20 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 61 0 43
-, 28 1 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 61 2 47
-0 56 2 48
-1 56 2 49
-2 56 2 50
-3 56 2 51
-4 56 2 52
-5 56 2 53
-6 56 2 54
-7 56 2 55
-8 56 2 56
-9 56 2 57
-: 28 0 58
-; 28 1 59
-= 61 0 61
-? 44 2 63
-A 70 2 65
-B 72 2 66
-C 72 2 67
-D 78 2 68
-E 72 2 69
-F 67 2 70
-G 78 2 71
-H 83 2 72
-I 41 2 73
-J 61 2 74
-K 74 2 75
-L 67 2 76
-M 94 2 77
-N 81 2 78
-O 78 2 79
-P 67 2 80
-Q 78 3 81
-R 74 2 82
-S 67 2 83
-T 69 2 84
-U 81 2 85
-V 70 2 86
-W 93 2 87
-X 70 2 88
-Y 69 2 89
-Z 67 2 90
-[ 33 3 91
-] 33 3 93
-` 20 2 96
-a 57 0 97
-b 56 2 98
-c 44 0 99
-d 61 2 100
-e 44 0 101
-f 33 3 102
-g 54 1 103
-h 61 2 104
-i 33 2 105
-j 32 3 106
-k 56 2 107
-l 33 2 108
-m 89 0 109
-n 61 0 110
-o 50 0 111
-p 57 1 112
-q 56 1 113
-r 44 0 114
-s 44 0 115
-t 35 2 116
-u 61 0 117
-v 52 0 118
-w 78 0 119
-x 50 0 120
-y 50 1 121
-z 46 0 122
-ct 56 3 162
-fi 61 3 174
-fl 61 3 175
-dg 50 3 178
-bu 61 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 39 2 170
-'' 39 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/NI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/NI.name
deleted file mode 100644
index 2874e8afbe..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/NI.name
+++ /dev/null
@@ -1 +0,0 @@
-NewCenturySchlbk-Italic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/NR b/usr/src/cmd/lp/filter/postscript/font/devpost/NR
deleted file mode 100644
index f5d795f0c9..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/NR
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# NewCenturySchlbk-Roman
-name NR
-internalname 29
-ligatures fi fl 0
-charset
-! 30 2 33
-$ 56 3 36
-% 83 2 37
-& 81 2 38
-' 20 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 61 0 43
-, 28 1 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 28 2 47
-0 56 2 48
-1 56 2 49
-2 56 2 50
-3 56 2 51
-4 56 2 52
-5 56 2 53
-6 56 2 54
-7 56 2 55
-8 56 2 56
-9 56 2 57
-: 28 0 58
-; 28 1 59
-= 61 0 61
-? 44 2 63
-A 72 2 65
-B 72 2 66
-C 72 2 67
-D 78 2 68
-E 72 2 69
-F 67 2 70
-G 78 2 71
-H 83 2 72
-I 41 2 73
-J 56 2 74
-K 78 2 75
-L 67 2 76
-M 94 2 77
-N 81 2 78
-O 78 2 79
-P 67 2 80
-Q 78 3 81
-R 72 2 82
-S 63 2 83
-T 67 2 84
-U 81 2 85
-V 72 2 86
-W 98 2 87
-X 70 2 88
-Y 70 2 89
-Z 61 2 90
-[ 33 3 91
-] 33 3 93
-` 20 2 96
-a 56 0 97
-b 56 2 98
-c 44 0 99
-d 57 2 100
-e 50 0 101
-f 33 2 102
-g 54 1 103
-h 61 2 104
-i 32 2 105
-j 30 3 106
-k 59 2 107
-l 32 2 108
-m 89 0 109
-n 61 0 110
-o 50 0 111
-p 57 1 112
-q 56 1 113
-r 44 0 114
-s 46 0 115
-t 39 2 116
-u 61 0 117
-v 54 0 118
-w 78 0 119
-x 54 0 120
-y 54 1 121
-z 48 0 122
-ct 56 3 162
-fi 61 2 174
-fl 61 2 175
-dg 50 3 178
-bu 61 2 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 39 2 170
-'' 39 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/NR.name b/usr/src/cmd/lp/filter/postscript/font/devpost/NR.name
deleted file mode 100644
index 82ea91140f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/NR.name
+++ /dev/null
@@ -1 +0,0 @@
-NewCenturySchlbk-Roman
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/NX b/usr/src/cmd/lp/filter/postscript/font/devpost/NX
deleted file mode 100644
index e7750c0fa0..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/NX
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# NewCenturySchlbk-BoldItalic
-name NX
-internalname 32
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 57 3 36
-% 89 2 37
-& 89 2 38
-' 26 2 39
-( 41 3 40
-) 41 3 41
-* 50 2 42
-+ 61 0 43
-, 29 1 44
-hy 33 0 45
-- "
-. 29 0 46
-/ 28 2 47
-0 57 2 48
-1 57 2 49
-2 57 2 50
-3 57 2 51
-4 57 2 52
-5 57 2 53
-6 57 2 54
-7 57 2 55
-8 57 2 56
-9 57 2 57
-: 29 0 58
-; 29 1 59
-= 61 0 61
-? 48 2 63
-A 74 2 65
-B 76 2 66
-C 76 2 67
-D 83 2 68
-E 74 2 69
-F 70 2 70
-G 81 2 71
-H 87 2 72
-I 44 2 73
-J 67 2 74
-K 78 2 75
-L 70 2 76
-M 94 2 77
-N 85 2 78
-O 83 2 79
-P 74 2 80
-Q 83 3 81
-R 80 2 82
-S 69 2 83
-T 72 2 84
-U 83 2 85
-V 74 2 86
-W 94 2 87
-X 74 2 88
-Y 70 2 89
-Z 70 2 90
-[ 41 3 91
-] 41 3 93
-` 26 2 96
-a 67 0 97
-b 61 2 98
-c 54 0 99
-d 67 2 100
-e 52 0 101
-f 39 3 102
-g 61 1 103
-h 69 2 104
-i 39 2 105
-j 37 3 106
-k 65 2 107
-l 39 2 108
-m 94 0 109
-n 69 0 110
-o 57 0 111
-p 65 1 112
-q 63 1 113
-r 52 0 114
-s 48 0 115
-t 41 2 116
-u 69 0 117
-v 56 0 118
-w 83 0 119
-x 57 0 120
-y 52 1 121
-z 52 0 122
-ct 57 3 162
-fi 69 3 174
-fl 69 3 175
-dg 50 3 178
-bu 61 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 48 2 170
-'' 48 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/NX.name b/usr/src/cmd/lp/filter/postscript/font/devpost/NX.name
deleted file mode 100644
index cce962696f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/NX.name
+++ /dev/null
@@ -1 +0,0 @@
-NewCenturySchlbk-BoldItalic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/PA b/usr/src/cmd/lp/filter/postscript/font/devpost/PA
deleted file mode 100644
index 80ed449f66..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/PA
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Palatino-Roman
-name PA
-internalname 13
-ligatures fi fl 0
-charset
-! 28 2 33
-$ 50 2 36
-% 84 2 37
-& 78 2 38
-' 28 2 39
-( 33 2 40
-) 33 2 41
-* 39 2 42
-+ 61 0 43
-, 25 1 44
-hy 33 0 45
-- "
-. 25 0 46
-/ 61 2 47
-0 50 2 48
-1 50 2 49
-2 50 2 50
-3 50 2 51
-4 50 2 52
-5 50 2 53
-6 50 2 54
-7 50 2 55
-8 50 2 56
-9 50 2 57
-: 25 0 58
-; 25 1 59
-= 61 0 61
-? 44 2 63
-A 78 2 65
-B 61 2 66
-C 71 2 67
-D 77 2 68
-E 61 2 69
-F 56 2 70
-G 76 2 71
-H 83 2 72
-I 34 2 73
-J 33 3 74
-K 73 2 75
-L 61 2 76
-M 95 2 77
-N 83 2 78
-O 79 2 79
-P 60 2 80
-Q 79 3 81
-R 67 2 82
-S 53 2 83
-T 61 2 84
-U 78 2 85
-V 72 2 86
-W 100 2 87
-X 67 2 88
-Y 67 2 89
-Z 67 2 90
-[ 33 2 91
-] 33 2 93
-` 28 2 96
-a 50 0 97
-b 55 2 98
-c 44 0 99
-d 61 2 100
-e 48 0 101
-f 33 2 102
-g 56 1 103
-h 58 2 104
-i 29 2 105
-j 23 3 106
-k 56 2 107
-l 29 2 108
-m 88 0 109
-n 58 0 110
-o 55 0 111
-p 60 1 112
-q 56 1 113
-r 40 0 114
-s 42 0 115
-t 33 2 116
-u 60 0 117
-v 56 0 118
-w 83 0 119
-x 52 0 120
-y 56 1 121
-z 50 0 122
-ct 50 0 162
-fi 61 2 174
-fl 61 2 175
-dg 50 2 178
-bu 61 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/PA.name b/usr/src/cmd/lp/filter/postscript/font/devpost/PA.name
deleted file mode 100644
index b5b49c8bfe..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/PA.name
+++ /dev/null
@@ -1 +0,0 @@
-Palatino-Roman
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/PB b/usr/src/cmd/lp/filter/postscript/font/devpost/PB
deleted file mode 100644
index 82d7ca2b7f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/PB
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Palatino-Bold
-name PB
-internalname 15
-ligatures fi fl 0
-charset
-! 28 2 33
-$ 50 2 36
-% 89 2 37
-& 83 2 38
-' 28 2 39
-( 33 2 40
-) 33 2 41
-* 44 2 42
-+ 61 0 43
-, 25 1 44
-hy 33 0 45
-- "
-. 25 0 46
-/ 30 2 47
-0 50 2 48
-1 50 2 49
-2 50 2 50
-3 50 2 51
-4 50 2 52
-5 50 2 53
-6 50 2 54
-7 50 2 55
-8 50 2 56
-9 50 2 57
-: 25 0 58
-; 25 1 59
-= 61 0 61
-? 44 2 63
-A 78 2 65
-B 67 2 66
-C 72 2 67
-D 83 2 68
-E 61 2 69
-F 56 2 70
-G 83 2 71
-H 83 2 72
-I 39 2 73
-J 39 3 74
-K 78 2 75
-L 61 2 76
-M 100 2 77
-N 83 2 78
-O 83 2 79
-P 61 2 80
-Q 83 3 81
-R 72 2 82
-S 61 2 83
-T 67 2 84
-U 78 2 85
-V 78 2 86
-W 100 2 87
-X 67 2 88
-Y 67 2 89
-Z 67 2 90
-[ 33 2 91
-] 33 2 93
-` 28 2 96
-a 50 0 97
-b 61 2 98
-c 44 0 99
-d 61 2 100
-e 50 0 101
-f 39 2 102
-g 56 1 103
-h 61 2 104
-i 33 2 105
-j 33 3 106
-k 61 2 107
-l 33 2 108
-m 89 0 109
-n 61 0 110
-o 56 0 111
-p 61 1 112
-q 61 1 113
-r 39 0 114
-s 44 0 115
-t 33 2 116
-u 61 0 117
-v 56 0 118
-w 83 0 119
-x 50 0 120
-y 56 1 121
-z 50 0 122
-ct 50 0 162
-fi 61 2 174
-fl 61 2 175
-dg 50 2 178
-bu 61 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/PB.name b/usr/src/cmd/lp/filter/postscript/font/devpost/PB.name
deleted file mode 100644
index 63a4fa8374..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/PB.name
+++ /dev/null
@@ -1 +0,0 @@
-Palatino-Bold
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/PI b/usr/src/cmd/lp/filter/postscript/font/devpost/PI
deleted file mode 100644
index 4150f9b063..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/PI
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Palatino-Italic
-name PI
-internalname 14
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 50 2 36
-% 89 2 37
-& 78 2 38
-' 28 2 39
-( 33 2 40
-) 33 2 41
-* 39 2 42
-+ 61 0 43
-, 25 1 44
-hy 33 0 45
-- "
-. 25 0 46
-/ 30 3 47
-0 50 2 48
-1 50 2 49
-2 50 2 50
-3 50 2 51
-4 50 2 52
-5 50 2 53
-6 50 2 54
-7 50 2 55
-8 50 2 56
-9 50 2 57
-: 25 0 58
-; 25 1 59
-= 61 0 61
-? 50 2 63
-A 72 2 65
-B 61 2 66
-C 67 2 67
-D 78 2 68
-E 61 2 69
-F 56 2 70
-G 72 2 71
-H 78 2 72
-I 33 2 73
-J 33 3 74
-K 67 2 75
-L 56 2 76
-M 94 2 77
-N 78 2 78
-O 78 2 79
-P 61 2 80
-Q 78 3 81
-R 67 2 82
-S 56 2 83
-T 61 2 84
-U 78 2 85
-V 72 2 86
-W 94 2 87
-X 72 2 88
-Y 67 2 89
-Z 67 2 90
-[ 33 2 91
-] 33 2 93
-` 28 2 96
-a 44 0 97
-b 46 2 98
-c 41 0 99
-d 50 2 100
-e 39 0 101
-f 28 3 102
-g 50 1 103
-h 50 2 104
-i 28 2 105
-j 28 3 106
-k 44 2 107
-l 28 2 108
-m 78 0 109
-n 56 0 110
-o 44 0 111
-p 50 1 112
-q 46 1 113
-r 39 0 114
-s 39 0 115
-t 33 2 116
-u 56 0 117
-v 50 0 118
-w 72 0 119
-x 50 0 120
-y 50 1 121
-z 44 0 122
-ct 50 0 162
-fi 53 3 174
-fl 54 3 175
-dg 50 2 178
-bu 50 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/PI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/PI.name
deleted file mode 100644
index f6e9f5ee5d..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/PI.name
+++ /dev/null
@@ -1 +0,0 @@
-Palatino-Italic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/PX b/usr/src/cmd/lp/filter/postscript/font/devpost/PX
deleted file mode 100644
index 9dd7927160..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/PX
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Palatino-BoldItalic
-name PX
-internalname 16
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 50 2 36
-% 89 2 37
-& 83 2 38
-' 28 2 39
-( 33 2 40
-) 33 2 41
-* 44 2 42
-+ 61 0 43
-, 25 1 44
-hy 39 0 45
-- "
-. 25 0 46
-/ 32 2 47
-0 50 2 48
-1 50 2 49
-2 50 2 50
-3 50 2 51
-4 50 2 52
-5 50 2 53
-6 50 2 54
-7 50 2 55
-8 50 2 56
-9 50 2 57
-: 25 0 58
-; 25 1 59
-= 61 0 61
-? 44 2 63
-A 72 2 65
-B 67 2 66
-C 69 2 67
-D 78 2 68
-E 61 2 69
-F 56 2 70
-G 78 2 71
-H 78 2 72
-I 39 2 73
-J 39 3 74
-K 72 2 75
-L 61 2 76
-M 94 2 77
-N 78 2 78
-O 83 2 79
-P 67 2 80
-Q 83 3 81
-R 72 2 82
-S 56 2 83
-T 61 2 84
-U 78 2 85
-V 67 2 86
-W 100 2 87
-X 72 2 88
-Y 61 2 89
-Z 67 2 90
-[ 33 2 91
-] 33 2 93
-` 28 2 96
-a 56 0 97
-b 54 2 98
-c 44 0 99
-d 56 2 100
-e 44 0 101
-f 33 3 102
-g 50 1 103
-h 56 2 104
-i 33 2 105
-j 33 3 106
-k 56 2 107
-l 33 2 108
-m 83 0 109
-n 56 0 110
-o 56 0 111
-p 56 1 112
-q 54 1 113
-r 39 0 114
-s 44 0 115
-t 39 2 116
-u 56 0 117
-v 56 0 118
-w 83 0 119
-x 50 0 120
-y 56 1 121
-z 50 0 122
-ct 50 0 162
-fi 61 3 174
-fl 61 3 175
-dg 56 2 178
-bu 61 0 183
-de 56 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 50 2 170
-'' 50 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/PX.name b/usr/src/cmd/lp/filter/postscript/font/devpost/PX.name
deleted file mode 100644
index bbca096271..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/PX.name
+++ /dev/null
@@ -1 +0,0 @@
-Palatino-BoldItalic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/R b/usr/src/cmd/lp/filter/postscript/font/devpost/R
deleted file mode 100644
index 585879eb07..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/R
+++ /dev/null
@@ -1,134 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Times-Roman
-name R
-internalname 1
-ligatures fi fl 0
-charset
-! 33 2 33
-$ 50 2 36
-% 83 2 37
-& 78 2 38
-' 33 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 56 0 43
-, 25 1 44
-hy 33 0 45
-- "
-. 25 0 46
-/ 28 2 47
-0 50 2 48
-1 50 2 49
-2 50 2 50
-3 50 2 51
-4 50 2 52
-5 50 2 53
-6 50 2 54
-7 50 2 55
-8 50 2 56
-9 50 2 57
-: 28 0 58
-; 28 1 59
-= 56 0 61
-? 44 2 63
-A 72 2 65
-B 67 2 66
-C 67 2 67
-D 72 2 68
-E 61 2 69
-F 56 2 70
-G 72 2 71
-H 72 2 72
-I 33 2 73
-J 39 2 74
-K 72 2 75
-L 61 2 76
-M 89 2 77
-N 72 2 78
-O 72 2 79
-P 56 2 80
-Q 72 3 81
-R 67 2 82
-S 56 2 83
-T 61 2 84
-U 72 2 85
-V 72 2 86
-W 94 2 87
-X 72 2 88
-Y 72 2 89
-Z 61 2 90
-[ 33 3 91
-] 33 3 93
-` 33 2 96
-a 44 0 97
-b 50 2 98
-c 44 0 99
-d 50 2 100
-e 44 0 101
-f 33 2 102
-g 50 1 103
-h 50 2 104
-i 28 2 105
-j 28 3 106
-k 50 2 107
-l 28 2 108
-m 78 0 109
-n 50 0 110
-o 50 0 111
-p 50 1 112
-q 50 1 113
-r 33 0 114
-s 39 0 115
-t 28 2 116
-u 50 0 117
-v 50 0 118
-w 72 0 119
-x 50 0 120
-y 50 1 121
-z 44 0 122
-ct 50 3 162
-fi 56 2 174
-fl 56 2 175
-ff 60 2 1
-Fi 84 2 1
-Fl 84 2 1
-dg 50 3 178
-bu 35 0 183
-de 33 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-sq 50 2 1
-`` 44 2 170
-'' 44 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/R.name b/usr/src/cmd/lp/filter/postscript/font/devpost/R.name
deleted file mode 100644
index 1a9e5453e1..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/R.name
+++ /dev/null
@@ -1 +0,0 @@
-Times-Roman
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/S b/usr/src/cmd/lp/filter/postscript/font/devpost/S
deleted file mode 100644
index 0837c0b2f5..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/S
+++ /dev/null
@@ -1,236 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Symbol
-name S
-internalname 33
-special
-charset
-bx 50 2 1
-ci 75 0 1
-sq 50 2 1
-~= 55 0 1
-L1 110 1 2
-LA 110 1 2
-LV 110 3 2
-LH 210 1 2
-Lb "
-lh 100 0 2
-rh 100 0 2
---- 25 0 32
---- 33 2 33
-fa 71 2 34
---- 50 2 35
-te 55 2 36
---- 83 2 37
---- 78 2 38
---- 44 0 39
---- 33 3 40
---- 33 3 41
-** 50 0 42
-pl 55 0 43
---- 25 1 44
-mi 55 0 45
---- 25 0 46
---- 28 2 47
---- 50 2 48
---- 50 2 49
---- 50 2 50
---- 50 2 51
---- 50 2 52
---- 50 2 53
---- 50 2 54
---- 50 2 55
---- 50 2 56
---- 50 2 57
---- 28 0 58
---- 28 1 59
-< 55 0 60
-eq 55 0 61
-> 55 0 62
---- 44 2 63
-*A 72 2 65
-*B 67 2 66
-*X 72 2 67
-*D 61 2 68
-*E 61 2 69
-*F 76 2 70
-*G 60 2 71
-*Y 72 2 72
-*I 33 2 73
---- 63 2 74
-*K 72 2 75
-*L 69 2 76
-*M 89 2 77
-*N 72 2 78
-*O 72 2 79
-*P 77 2 80
-*H 74 2 81
-*R 56 2 82
-*S 59 2 83
-*T 61 2 84
-*U 69 2 85
---- 44 1 86
-ts 44 1 86
-*W 77 2 87
-*C 65 2 88
-*Q 80 2 89
-*Z 61 2 90
---- 33 3 91
---- 86 0 92
---- 33 3 93
---- 66 2 94
-ul 50 1 95
-_ "
-rn 50 2 96
-*a 63 0 97
-*b 55 3 98
-*x 55 1 99
-*d 49 2 100
-*e 44 0 101
-*f 52 3 102
-*g 41 1 103
-*y 60 1 104
-*i 33 0 105
---- 60 1 106
-*k 55 0 107
-*l 55 2 108
-*m 58 1 109
-*n 52 0 110
-*o 55 0 111
-*p 55 0 112
-*h 52 2 113
-*r 55 1 114
-*s 60 0 115
-*t 44 0 116
-*u 58 0 117
---- 71 2 118
-*w 69 0 119
-*c 49 3 120
-*q 69 1 121
-*z 49 3 122
-{ 48 3 123
-or 20 3 124
-} 48 3 125
-ap 55 0 126
---- 62 2 161
-fm 25 2 162
-<= 55 2 163
-sl 17 2 164
-if 73 0 165
---- 50 3 166
---- 75 0 167
---- 75 0 168
---- 75 0 169
---- 75 0 170
---- 104 0 171
-<- 99 0 172
-ua 60 2 173
--> 99 0 174
-da 60 2 175
-de 40 2 176
-+- 55 2 177
---- 41 2 178
->= 55 2 179
-mu 55 0 180
-pt 71 0 181
-pd 49 2 182
-bu 46 0 183
-di 55 0 184
-!= 55 0 185
-== 55 0 186
-~~ 55 0 187
---- 100 0 188
---- 60 3 189
---- 100 0 190
---- 66 2 191
-al 82 2 192
---- 69 2 193
---- 80 2 194
---- 99 3 195
-Ox 77 2 196
-O+ 77 2 197
-es 82 2 198
-ca 77 0 199
-cu 77 0 200
-sp 71 0 201
-ip 71 1 202
---- 71 0 203
-sb 71 0 204
-ib 71 1 205
-mo 71 0 206
---- 71 0 207
---- 77 2 208
-gr 71 2 209
-rg 79 2 210
-co 79 2 211
-tm 89 2 212
---- 82 2 213
-sr 55 2 214
---- 25 0 215
-no 71 0 216
-^ 60 0 217
-or 60 0 218
---- 104 0 219
---- 99 0 220
---- 60 2 221
---- 99 0 222
---- 60 2 223
---- 49 2 224
---- 33 3 225
---- 79 2 226
---- 79 2 227
---- 79 2 228
---- 71 2 229
---- 38 3 230
-br 0 3 231
---- 38 3 232
-lc 50 2 233
-vr 0 2 234
-lf 50 2 235
-lt 49 2 236
-lk 49 2 237
-lb 49 2 238
-bv 49 2 239
---- 25 0 240
---- 33 3 241
-is 50 3 242
---- 69 2 243
---- 69 2 244
---- 69 2 245
---- 38 3 246
---- 38 2 247
---- 38 3 248
-rc 38 2 249
-| 50 3 250
-rf 38 2 251
-rt 49 2 252
-rk 49 2 253
-rb 49 2 254
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/S.big b/usr/src/cmd/lp/filter/postscript/font/devpost/S.big
deleted file mode 100644
index 7ded493934..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/S.big
+++ /dev/null
@@ -1,228 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Symbol
-#
-name S
-internalname 33
-special
-charset
-bx 50 2 1
-ci 75 0 1
-sq 50 2 1
-~= 55 0 1
-L1 110 1 2
-LA 110 1 2
-LV 110 3 2
-LH 210 1 2
-Lb "
-lh 100 0 2
-rh 100 0 2
---- 25 0 32
---- 33 2 33
-fa 71 2 34
---- 50 2 35
-te 55 2 36
---- 83 2 37
---- 78 2 38
---- 44 0 39
---- 33 3 40
---- 33 3 41
-** 50 0 42
-pl 55 0 43
---- 25 1 44
-mi 55 0 45
---- 25 0 46
---- 28 2 47
---- 50 2 48
---- 50 2 49
---- 50 2 50
---- 50 2 51
---- 50 2 52
---- 50 2 53
---- 50 2 54
---- 50 2 55
---- 50 2 56
---- 50 2 57
---- 28 0 58
---- 28 1 59
-< 55 0 60
-eq 55 0 61
-> 55 0 62
---- 44 2 63
-*A 72 2 65
-*B 67 2 66
-*X 72 2 67
-*D 61 2 68
-*E 61 2 69
-*F 76 2 70
-*G 60 2 71
-*Y 72 2 72
-*I 33 2 73
---- 63 2 74
-*K 72 2 75
-*L 69 2 76
-*M 89 2 77
-*N 72 2 78
-*O 72 2 79
-*P 77 2 80
-*H 74 2 81
-*R 56 2 82
-*S 59 2 83
-*T 61 2 84
-*U 69 2 85
---- 44 1 86
-ts 44 1 86
-*W 77 2 87
-*C 65 2 88
-*Q 80 2 89
-*Z 61 2 90
---- 33 3 91
---- 86 0 92
---- 33 3 93
---- 66 2 94
-ul 50 1 95
-_ "
-rn 50 2 96
-*a 63 0 97
-*b 55 3 98
-*x 55 1 99
-*d 49 2 100
-*e 44 0 101
-*f 52 3 102
-*g 41 1 103
-*y 60 1 104
-*i 33 0 105
---- 60 1 106
-*k 55 0 107
-*l 55 2 108
-*m 58 1 109
-*n 52 0 110
-*o 55 0 111
-*p 55 0 112
-*h 52 2 113
-*r 55 1 114
-*s 60 0 115
-*t 44 0 116
-*u 58 0 117
---- 71 2 118
-*w 69 0 119
-*c 49 3 120
-*q 69 1 121
-*z 49 3 122
-{ 48 3 123
-or 20 3 124
-} 48 3 125
-ap 55 0 126
---- 62 2 161
-fm 25 2 162
-<= 55 2 163
-sl 17 2 164
-if 73 0 165
---- 50 3 166
---- 75 0 167
---- 75 0 168
---- 75 0 169
---- 75 0 170
---- 104 0 171
-<- 99 0 172
-ua 60 2 173
--> 99 0 174
-da 60 2 175
-de 40 2 176
-+- 55 2 177
---- 41 2 178
->= 55 2 179
-mu 55 0 180
-pt 71 0 181
-pd 49 2 182
-bu 46 0 183
-di 55 0 184
-!= 55 0 185
-== 55 0 186
-~~ 55 0 187
---- 100 0 188
---- 60 3 189
---- 100 0 190
---- 66 2 191
-al 82 2 192
---- 69 2 193
---- 80 2 194
---- 99 3 195
-Ox 77 2 196
-O+ 77 2 197
-es 82 2 198
-ca 77 0 199
-cu 77 0 200
-sp 71 0 201
-ip 71 1 202
---- 71 0 203
-sb 71 0 204
-ib 71 1 205
-mo 71 0 206
---- 71 0 207
---- 77 2 208
-gr 71 2 209
-rg 79 2 210
-co 79 2 211
-tm 89 2 212
---- 82 2 213
-sr 55 2 214
---- 25 0 215
-no 71 0 216
-^ 60 0 217
-or 60 0 218
---- 104 0 219
---- 99 0 220
---- 60 2 221
---- 99 0 222
---- 60 2 223
---- 49 2 224
---- 33 3 225
---- 79 2 226
---- 79 2 227
---- 79 2 228
---- 71 2 229
---- 38 3 230
-br 0 3 231
---- 38 3 232
-lc 50 2 233
-vr 0 2 234
-lf 50 2 235
-lt 49 2 236
-lk 49 2 237
-lb 49 2 238
-bv 49 2 239
---- 25 0 240
---- 33 3 241
-is 50 3 242
---- 69 2 243
---- 69 2 244
---- 69 2 245
---- 38 3 246
---- 38 2 247
---- 38 3 248
-rc 38 2 249
-| 50 3 250
-rf 38 2 251
-rt 49 2 252
-rk 49 2 253
-rb 49 2 254
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/S.name b/usr/src/cmd/lp/filter/postscript/font/devpost/S.name
deleted file mode 100644
index c5fe836342..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/S.name
+++ /dev/null
@@ -1 +0,0 @@
-Symbol
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/S.small b/usr/src/cmd/lp/filter/postscript/font/devpost/S.small
deleted file mode 100644
index d002a7aa17..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/S.small
+++ /dev/null
@@ -1,155 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Symbol
-#
-name S
-internalname 33
-special
-charset
-bx 50 2 1
-ci 75 0 1
-sq 50 2 1
-~= 55 0 1
-L1 110 1 2
-LA 110 1 2
-LV 110 3 2
-LH 210 1 2
-Lb "
-lh 100 0 2
-rh 100 0 2
-fa 71 2 34
-te 55 2 36
-** 50 0 42
-pl 55 0 43
-mi 55 0 45
-< 55 0 60
-eq 55 0 61
-> 55 0 62
-*A 72 2 65
-*B 67 2 66
-*X 72 2 67
-*D 61 2 68
-*E 61 2 69
-*F 76 2 70
-*G 60 2 71
-*Y 72 2 72
-*I 33 2 73
-*K 72 2 75
-*L 69 2 76
-*M 89 2 77
-*N 72 2 78
-*O 72 2 79
-*P 77 2 80
-*H 74 2 81
-*R 56 2 82
-*S 59 2 83
-*T 61 2 84
-*U 69 2 85
-ts 44 1 86
-*W 77 2 87
-*C 65 2 88
-*Q 80 2 89
-*Z 61 2 90
-ul 50 1 95
-_ "
-rn 50 2 96
-*a 63 0 97
-*b 55 3 98
-*x 55 1 99
-*d 49 2 100
-*e 44 0 101
-*f 52 3 102
-*g 41 1 103
-*y 60 1 104
-*i 33 0 105
-*k 55 0 107
-*l 55 2 108
-*m 58 1 109
-*n 52 0 110
-*o 55 0 111
-*p 55 0 112
-*h 52 2 113
-*r 55 1 114
-*s 60 0 115
-*t 44 0 116
-*u 58 0 117
-*w 69 0 119
-*c 49 3 120
-*q 69 1 121
-*z 49 3 122
-{ 48 3 123
-or 20 3 124
-} 48 3 125
-ap 55 0 126
-fm 25 2 162
-<= 55 2 163
-sl 17 2 164
-if 73 0 165
-<- 99 0 172
-ua 60 2 173
--> 99 0 174
-da 60 2 175
-de 40 2 176
-+- 55 2 177
->= 55 2 179
-mu 55 0 180
-pt 71 0 181
-pd 49 2 182
-bu 46 0 183
-di 55 0 184
-!= 55 0 185
-== 55 0 186
-~~ 55 0 187
-al 82 2 192
-Ox 77 2 196
-O+ 77 2 197
-es 82 2 198
-ca 77 0 199
-cu 77 0 200
-sp 71 0 201
-ip 71 1 202
-sb 71 0 204
-ib 71 1 205
-mo 71 0 206
-gr 71 2 209
-rg 79 2 210
-co 79 2 211
-tm 89 2 212
-sr 55 2 214
-no 71 0 216
-^ 60 0 217
-or 60 0 218
-br 0 3 231
-lc 50 2 233
-vr 0 2 234
-lf 50 2 235
-lt 49 2 236
-lk 49 2 237
-lb 49 2 238
-bv 49 2 239
-is 50 3 242
-rc 38 2 249
-| 50 3 250
-rf 38 2 251
-rt 49 2 252
-rk 49 2 253
-rb 49 2 254
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/S1 b/usr/src/cmd/lp/filter/postscript/font/devpost/S1
deleted file mode 100644
index ac624b6f46..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/S1
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-# Times-Roman special font
-name S1
-internalname 1
-special
-charset
-" 41 2 34
-# 50 2 35
-< 56 0 60
-> 56 0 62
-@ 92 3 64
-\ 28 2 92
-or 20 2 124
-^ 33 2 195
-~ 33 2 196
-\' 33 2 194
-aa "
-\` 33 2 193
-ga "
-ru 50 0 95
-\- 65 0 177
-en "
-sc 50 3 167
-dg 50 3 178
-dd 50 3 179
-ct 50 3 162
-14 75 2 1
-34 75 2 1
-12 75 2 1
-Sl 50 2 1
-ob 38 0 1
-`` 44 2 170
-'' 44 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/S1.name b/usr/src/cmd/lp/filter/postscript/font/devpost/S1.name
deleted file mode 100644
index 1a9e5453e1..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/S1.name
+++ /dev/null
@@ -1 +0,0 @@
-Times-Roman
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/VB b/usr/src/cmd/lp/filter/postscript/font/devpost/VB
deleted file mode 100644
index eaf054c416..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/VB
+++ /dev/null
@@ -1,126 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Varitimes#Bold
-name VB
-internalname 1
-special
-charset
-! 28 2 33
-$ 53 3 36
-% 83 2 37
-& 77 2 38
-' 28 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 77 0 43
-, 28 1 44
-hy 33 0 45
-- "
-. 28 0 46
-/ 33 2 47
-0 53 2 48
-1 53 2 49
-2 53 2 50
-3 53 2 51
-4 53 2 52
-5 53 2 53
-6 53 2 54
-7 53 2 55
-8 53 2 56
-9 53 2 57
-: 28 0 58
-; 28 1 59
-= 77 0 61
-? 47 2 63
-A 72 2 65
-B 64 2 66
-C 72 2 67
-D 72 2 68
-E 66 2 69
-F 61 2 70
-G 75 2 71
-H 77 2 72
-I 39 2 73
-J 50 2 74
-K 77 2 75
-L 64 2 76
-M 94 2 77
-N 75 2 78
-O 77 2 79
-P 64 2 80
-Q 77 3 81
-R 72 2 82
-S 55 2 83
-T 66 2 84
-U 75 2 85
-V 72 2 86
-W 100 2 87
-X 69 2 88
-Y 72 2 89
-Z 64 2 90
-[ 33 3 91
-] 33 3 93
-` 28 2 96
-a 50 0 97
-b 55 2 98
-c 44 0 99
-d 55 2 100
-e 44 0 101
-f 36 2 102
-g 50 1 103
-h 55 2 104
-i 28 2 105
-j 30 3 106
-k 55 2 107
-l 28 2 108
-m 83 0 109
-n 55 0 110
-o 50 0 111
-p 55 1 112
-q 55 1 113
-r 44 0 114
-s 39 0 115
-t 33 2 116
-u 55 0 117
-v 47 0 118
-w 69 0 119
-x 50 0 120
-y 47 1 121
-z 44 0 122
-ct 53 3 162
-fi 55 2 174
-fl 55 2 175
-ff 60 2 1
-Fi 84 2 1
-Fl 84 2 1
-dg 53 3 178
-bu 41 0 183
-de 50 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-sq 50 2 1
-`` 44 2 170
-'' 44 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/VB.name b/usr/src/cmd/lp/filter/postscript/font/devpost/VB.name
deleted file mode 100644
index 7ce3b11ae1..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/VB.name
+++ /dev/null
@@ -1 +0,0 @@
-Varitimes#Bold
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/VI b/usr/src/cmd/lp/filter/postscript/font/devpost/VI
deleted file mode 100644
index 24e6d80335..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/VI
+++ /dev/null
@@ -1,126 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Varitimes#Italic
-name VI
-internalname 1
-special
-charset
-! 25 2 33
-$ 55 2 36
-% 89 2 37
-& 75 2 38
-' 25 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 77 0 43
-, 22 1 44
-hy 39 0 45
-- "
-. 22 0 46
-/ 33 2 47
-0 55 2 48
-1 55 2 49
-2 55 2 50
-3 55 2 51
-4 55 2 52
-5 55 2 53
-6 55 2 54
-7 55 2 55
-8 55 2 56
-9 55 2 57
-: 22 0 58
-; 22 1 59
-= 77 0 61
-? 44 2 63
-A 69 2 65
-B 64 2 66
-C 69 2 67
-D 75 2 68
-E 61 2 69
-F 58 2 70
-G 75 2 71
-H 75 2 72
-I 33 2 73
-J 41 2 74
-K 64 2 75
-L 58 2 76
-M 86 2 77
-N 72 2 78
-O 75 2 79
-P 58 2 80
-Q 75 3 81
-R 61 2 82
-S 53 2 83
-T 61 2 84
-U 75 2 85
-V 69 2 86
-W 89 2 87
-X 69 2 88
-Y 64 2 89
-Z 66 2 90
-[ 33 3 91
-] 33 3 93
-` 25 2 96
-a 53 0 97
-b 53 2 98
-c 44 0 99
-d 53 2 100
-e 41 0 101
-f 33 3 102
-g 44 1 103
-h 53 2 104
-i 25 2 105
-j 25 3 106
-k 47 2 107
-l 25 2 108
-m 77 0 109
-n 53 0 110
-o 53 0 111
-p 53 1 112
-q 53 1 113
-r 36 0 114
-s 36 0 115
-t 28 0 116
-u 53 0 117
-v 44 0 118
-w 72 0 119
-x 47 0 120
-y 47 1 121
-z 39 0 122
-ct 50 3 162
-fi 55 3 174
-fl 55 3 175
-ff 60 2 1
-Fi 84 2 1
-Fl 84 2 1
-dg 53 2 178
-bu 41 0 183
-de 50 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-sq 50 2 1
-`` 44 2 170
-'' 44 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/VI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/VI.name
deleted file mode 100644
index 4562893d5c..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/VI.name
+++ /dev/null
@@ -1 +0,0 @@
-Varitimes#Italic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/VR b/usr/src/cmd/lp/filter/postscript/font/devpost/VR
deleted file mode 100644
index a9d2371263..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/VR
+++ /dev/null
@@ -1,126 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Varitimes#Roman
-name VR
-internalname 1
-special
-charset
-! 25 2 33
-$ 55 2 36
-% 83 2 37
-& 77 2 38
-' 25 2 39
-( 33 3 40
-) 33 3 41
-* 50 2 42
-+ 77 0 43
-, 22 1 44
-hy 39 0 45
-- "
-. 22 0 46
-/ 39 2 47
-0 55 2 48
-1 55 2 49
-2 55 2 50
-3 55 2 51
-4 55 2 52
-5 55 2 53
-6 55 2 54
-7 55 2 55
-8 55 2 56
-9 55 2 57
-: 22 0 58
-; 22 1 59
-= 77 0 61
-? 47 2 63
-A 75 2 65
-B 64 2 66
-C 75 2 67
-D 77 2 68
-E 66 2 69
-F 61 2 70
-G 77 2 71
-H 75 2 72
-I 33 2 73
-J 39 2 74
-K 75 2 75
-L 64 2 76
-M 91 2 77
-N 75 2 78
-O 77 2 79
-P 61 2 80
-Q 77 3 81
-R 69 2 82
-S 53 2 83
-T 66 2 84
-U 75 2 85
-V 72 2 86
-W 100 2 87
-X 75 2 88
-Y 72 2 89
-Z 64 2 90
-[ 33 3 91
-] 33 3 93
-` 25 2 96
-a 50 0 97
-b 53 2 98
-c 47 0 99
-d 53 2 100
-e 47 0 101
-f 33 2 102
-g 53 1 103
-h 53 2 104
-i 28 2 105
-j 28 3 106
-k 55 2 107
-l 28 2 108
-m 83 0 109
-n 53 0 110
-o 53 0 111
-p 53 1 112
-q 53 1 113
-r 36 0 114
-s 39 0 115
-t 30 2 116
-u 53 0 117
-v 50 0 118
-w 75 0 119
-x 50 0 120
-y 50 1 121
-z 47 0 122
-ct 53 3 162
-fi 58 2 174
-fl 58 2 175
-ff 60 2 1
-Fi 84 2 1
-Fl 84 2 1
-dg 53 3 178
-bu 41 0 183
-de 50 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-sq 50 2 1
-`` 44 2 170
-'' 44 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/VR.name b/usr/src/cmd/lp/filter/postscript/font/devpost/VR.name
deleted file mode 100644
index ce7ab7c8ee..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/VR.name
+++ /dev/null
@@ -1 +0,0 @@
-Varitimes#Roman
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/VX b/usr/src/cmd/lp/filter/postscript/font/devpost/VX
deleted file mode 100644
index 59283ea1d9..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/VX
+++ /dev/null
@@ -1,126 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Varitimes#BoldItalic
-name VX
-internalname 1
-special
-charset
-! 28 2 33
-$ 55 2 36
-% 91 2 37
-& 75 2 38
-' 28 2 39
-( 33 3 40
-) 33 3 41
-* 55 2 42
-+ 77 0 43
-, 28 1 44
-hy 39 0 45
-- "
-. 28 1 46
-/ 22 2 47
-0 53 2 48
-1 53 2 49
-2 53 2 50
-3 53 2 51
-4 53 2 52
-5 53 2 53
-6 53 2 54
-7 53 2 55
-8 53 2 56
-9 53 2 57
-: 28 0 58
-; 28 1 59
-= 77 0 61
-? 44 2 63
-A 66 2 65
-B 69 2 66
-C 69 2 67
-D 77 2 68
-E 69 2 69
-F 66 2 70
-G 77 2 71
-H 80 2 72
-I 39 2 73
-J 50 2 74
-K 69 2 75
-L 64 2 76
-M 94 2 77
-N 75 2 78
-O 75 2 79
-P 64 2 80
-Q 75 3 81
-R 72 2 82
-S 58 2 83
-T 66 2 84
-U 77 2 85
-V 69 2 86
-W 91 2 87
-X 66 2 88
-Y 61 2 89
-Z 64 2 90
-[ 33 3 91
-] 33 3 93
-` 28 2 96
-a 53 0 97
-b 53 2 98
-c 44 0 99
-d 53 2 100
-e 44 0 101
-f 33 3 102
-g 50 1 103
-h 55 2 104
-i 30 2 105
-j 33 3 106
-k 53 2 107
-l 30 2 108
-m 80 0 109
-n 55 0 110
-o 50 0 111
-p 53 1 112
-q 53 1 113
-r 41 0 114
-s 39 0 115
-t 33 2 116
-u 55 0 117
-v 44 0 118
-w 66 0 119
-x 50 0 120
-y 44 1 121
-z 44 0 122
-ct 44 3 162
-fi 61 3 174
-fl 61 3 175
-ff 60 2 1
-Fi 84 2 1
-Fl 84 2 1
-dg 50 3 178
-bu 41 0 183
-de 30 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-sq 50 2 1
-`` 44 2 170
-'' 44 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/VX.name b/usr/src/cmd/lp/filter/postscript/font/devpost/VX.name
deleted file mode 100644
index 6beb074533..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/VX.name
+++ /dev/null
@@ -1 +0,0 @@
-Varitimes#BoldItalic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/ZD b/usr/src/cmd/lp/filter/postscript/font/devpost/ZD
deleted file mode 100644
index 57834daf39..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/ZD
+++ /dev/null
@@ -1,214 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# ZapfDingbats
-name ZD
-internalname 36
-ligatures fi fl 0
-charset
-! 97 2 33
-" 96 2 34
-# 97 2 35
-$ 98 3 36
-% 72 2 37
-& 79 3 38
-' 79 3 39
-( 79 3 40
-) 69 2 41
-* 96 2 42
-+ 94 2 43
-, 55 3 44
-- 86 2 45
-. 91 2 46
-/ 93 2 47
-0 91 2 48
-1 94 2 49
-2 97 2 50
-3 76 3 51
-4 85 3 52
-5 76 2 53
-6 76 2 54
-7 57 3 55
-8 68 3 56
-9 76 2 57
-: 76 2 58
-; 76 2 59
-< 75 3 60
-= 49 2 61
-> 55 2 62
-? 54 3 63
-@ 58 2 64
-A 69 3 65
-B 79 3 66
-C 79 3 67
-D 79 3 68
-E 79 3 69
-F 79 3 70
-G 79 3 71
-H 82 3 72
-I 82 3 73
-J 79 3 74
-K 84 3 75
-L 82 3 76
-M 83 3 77
-N 82 3 78
-O 83 3 79
-P 92 3 80
-Q 74 2 81
-R 72 2 82
-S 75 2 83
-T 79 3 84
-U 79 3 85
-V 69 3 86
-W 78 3 87
-X 77 3 88
-Y 79 3 89
-Z 76 2 90
-[ 71 3 91
-\ 71 3 92
-] 68 3 93
-^ 70 3 94
-_ 83 3 95
-` 81 3 96
-a 79 3 97
-b 79 3 98
-c 71 3 99
-d 69 2 100
-e 70 2 101
-f 69 2 102
-g 79 3 103
-h 79 3 104
-i 71 3 105
-j 79 3 106
-k 78 3 107
-l 79 3 108
-m 87 3 109
-n 76 2 110
-o 76 2 111
-p 76 2 112
-q 76 3 113
-r 76 3 114
-s 89 2 115
-t 89 3 116
-u 79 3 117
-v 78 3 118
-w 44 3 119
-x 14 2 120
-y 28 2 121
-z 41 2 122
-{ 39 2 123
-| 39 2 124
-} 67 2 125
-~ 67 2 126
-hy 73 3 161
-em 54 3 162
-de 54 3 163
-\- 91 2 164
-en 67 3 165
-ff 76 3 166
-fi 76 2 167
-fl 78 2 168
-Fi 60 3 169
-Fl 69 3 170
-fm 63 3 171
-ru 79 3 172
-dg 79 3 173
-bu 79 3 174
-14 79 3 175
-34 79 3 176
-12 79 3 177
-ct 79 3 178
-rg 79 3 179
-sq 79 3 180
-sl 79 3 181
-ul 79 3 182
-or 79 3 183
-no 79 3 184
--> 79 3 185
-<- 79 3 186
-da 79 3 187
-lh 79 3 188
-ua 79 3 189
-\e 79 3 190
-\' 79 3 191
-aa 79 3 192
-\` 79 3 193
-ga 79 3 194
-pl 79 3 195
-mi 79 3 196
-mu 79 3 197
-di 79 3 198
-eq 79 3 199
-== 79 3 200
->= 79 3 201
-<= 79 3 202
-!= 79 3 203
-+- 79 3 204
--+ 79 3 205
-ap 79 3 206
-~= 79 3 207
-gr 79 3 208
-is 79 3 209
-pd 79 3 210
-if 79 3 211
-sr 89 2 212
-rn 84 2 213
-sb 102 2 214
-sp 46 3 215
-cu 75 2 216
-ca 92 2 217
-ib 75 2 218
-ip 92 2 219
-mo 93 2 220
-es 93 2 221
-sc 93 2 222
-dd 83 2 223
-lc 87 2 224
-rc 83 2 225
-lf 92 2 226
-rf 92 2 227
-bv 92 2 228
-** 93 2 229
-br 93 2 230
-ci 46 3 231
-ts 88 2 232
-co 84 2 233
-lt 84 2 234
-rt 87 2 235
-lb 87 2 236
-rb 70 2 237
-lk 70 2 238
-rk 87 2 239
-rh 87 2 241
-tm 76 2 242
-Sl 95 2 243
-ps 77 2 244
-cs 86 2 245
-cy 77 2 246
-as 89 3 247
-os 97 2 248
-=. 89 3 249
-ld 83 2 250
-rd 87 2 251
-le 93 2 252
-ge 97 2 253
-pp 92 2 254
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/ZD.name b/usr/src/cmd/lp/filter/postscript/font/devpost/ZD.name
deleted file mode 100644
index b70c41eb04..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/ZD.name
+++ /dev/null
@@ -1 +0,0 @@
-ZapfDingbats
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/ZI b/usr/src/cmd/lp/filter/postscript/font/devpost/ZI
deleted file mode 100644
index 48820a3188..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/ZI
+++ /dev/null
@@ -1,122 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# ZapfChancery-MediumItalic
-name ZI
-internalname 37
-ligatures fi fl 0
-charset
-! 28 2 33
-$ 44 3 36
-% 68 2 37
-& 78 2 38
-' 24 2 39
-( 26 3 40
-) 22 3 41
-* 42 2 42
-+ 52 0 43
-, 22 0 44
-hy 28 0 45
-- "
-. 22 0 46
-/ 34 3 47
-0 44 2 48
-1 44 2 49
-2 44 2 50
-3 44 2 51
-4 44 2 52
-5 44 2 53
-6 44 2 54
-7 44 2 55
-8 44 2 56
-9 44 2 57
-: 26 0 58
-; 24 0 59
-= 52 0 61
-? 38 2 63
-A 62 2 65
-B 60 2 66
-C 52 2 67
-D 70 2 68
-E 62 2 69
-F 58 2 70
-G 62 3 71
-H 68 2 72
-I 38 2 73
-J 40 2 74
-K 66 3 75
-L 58 2 76
-M 84 2 77
-N 70 3 78
-O 60 2 79
-P 54 2 80
-Q 60 3 81
-R 60 3 82
-S 46 2 83
-T 50 2 84
-U 74 2 85
-V 64 2 86
-W 88 2 87
-X 56 2 88
-Y 56 3 89
-Z 62 2 90
-[ 24 3 91
-] 32 3 93
-` 24 2 96
-a 42 0 97
-b 42 2 98
-c 34 0 99
-d 44 2 100
-e 34 0 101
-f 32 3 102
-g 40 1 103
-h 44 2 104
-i 24 2 105
-j 22 3 106
-k 44 3 107
-l 24 2 108
-m 62 0 109
-n 46 0 110
-o 40 0 111
-p 44 1 112
-q 40 3 113
-r 30 0 114
-s 32 0 115
-t 32 2 116
-u 46 0 117
-v 44 0 118
-w 68 0 119
-x 42 1 120
-y 40 1 121
-z 44 0 122
-ct 44 2 162
-fi 52 3 174
-fl 52 3 175
-dg 46 3 178
-bu 60 2 183
-de 30 2 202
-em 100 0 208
-14 75 2 1
-34 75 2 1
-12 75 2 1
-`` 34 2 170
-'' 36 2 186
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/ZI.name b/usr/src/cmd/lp/filter/postscript/font/devpost/ZI.name
deleted file mode 100644
index f995af1403..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/ZI.name
+++ /dev/null
@@ -1 +0,0 @@
-ZapfChancery-MediumItalic
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/12 b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/12
deleted file mode 100644
index 69e8cf28d1..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/12
+++ /dev/null
@@ -1,40 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/12 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_12 {
- pop
- /optsize ptsize def
- /osize size def
- /ofont font def
-
- optsize 2 div dup R exch R f
- 0 size 2 mul 3 div dup neg exch 0 exch rmoveto
-
- (1) show
- rmoveto
- optsize R f
- (\244) show
- f
- (2) show
-
- optsize ofont f
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/14 b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/14
deleted file mode 100644
index f2c643e984..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/14
+++ /dev/null
@@ -1,40 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/14 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_14 {
- pop
- /optsize ptsize def
- /osize size def
- /ofont font def
-
- optsize 2 div dup R exch R f
- 0 size 2 mul 3 div dup neg exch 0 exch rmoveto
-
- (1) show
- rmoveto
- optsize R f
- (\244) show
- f
- (4) show
-
- optsize ofont f
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/34 b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/34
deleted file mode 100644
index 991b800a88..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/34
+++ /dev/null
@@ -1,40 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/34 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_34 {
- pop
- /optsize ptsize def
- /osize size def
- /ofont font def
-
- optsize 2 div dup R exch R f
- 0 size 2 mul 3 div dup neg exch 0 exch rmoveto
-
- (3) show
- rmoveto
- optsize R f
- (\244) show
- f
- (4) show
-
- optsize ofont f
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/BRACKETS_NOTE b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/BRACKETS_NOTE
deleted file mode 100644
index c120e3d83a..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/BRACKETS_NOTE
+++ /dev/null
@@ -1,58 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
- lc, rc, lf, and rf contain PostScript code that can be used to build the top
- and bottom bracket pieces used by eqn. The files are only used if the character
- code field in the S font file for lc, rc, lf, and rf is set to 1. A code larger
- than 32 means a character from Adobe's Symbol font will be used. Think the real
- solution is to change eqn so large brackets and braces are built differently.
-
- There were some serious collisions with eqn's bracket building algorithm and
- Adobe's Symbol font. eqn extends all the pieces with the \(bv character, while
- the bracket and brace pieces available in Adobe's Symbol are all quite different
- and are designed to work with their own extenders. The reference points are
- different, but worse still the thickness of brackets and braces don't match.
- Anyway using a single extender (the way eqn does) can't ever work with the
- bracket and brace characters available in Adobe's Symbol font.
-
- The lc, rc, lf, and rf files are a very complicated attempt to get around the
- problem. Each builds the troff character by using the \(bv character from the
- Symbol font and then draws a small horizontal line at either the top or bottom
- of the \(bv. Using \(bv for the vertical part guarantees things will stack
- properly, but getting to the precise top or bottom of the \(bv (down to the
- pixel level on all devices and in all sizes) proved to be very difficult. In
- fact you would think that determining the bounding box of \(bv would be enough
- to let you draw a good bracket piece that matched up nicely with the extender.
- Not quite, at least I didn't find that it was possible to do a good job drawing
- the pieces from the \(bv bounding box. Think roundoff errors introduced by the
- CTM caused the trouble, although I expect there's more to it.
-
- Clipping a rectangular region 2 pixels smaller in height than the bounding box
- of the \(bv character, and using the corners of that box to locate the top and
- bottom of the bv for the horizontal extender solved the problems I originally
- had with the precise placement of the horizontal rule. Anyway that's what the
- clipping and idtransform are for. The initgraphics stuff is an attempt to fit
- a tight bounding box around the \(bv character independent of the rotation of
- our coordinate system. pathbbox only returns what we want if the coordinate
- system has been rotated by a multiple of 90 degrees.
-
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Fi b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Fi
deleted file mode 100644
index 78f7b710d5..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Fi
+++ /dev/null
@@ -1,26 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/Fi 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_Fi {
- pop
- size .05 mul neg 0 (ffi) ashow
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Fl b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Fl
deleted file mode 100644
index 5106155229..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Fl
+++ /dev/null
@@ -1,26 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/Fl 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_Fl {
- pop
- size .05 mul neg 0 (ffl) ashow
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/L1 b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/L1
deleted file mode 100644
index 9650fddac4..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/L1
+++ /dev/null
@@ -1,34 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/L1 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_L1 {
- pop
- /picstr 40 string def
- gsave
- currentpoint translate
- .533 72 mul size mul 36 div
- .5 72 mul size mul 36 div
- scale
- 160 150 1 [160 0 0 -150 0 150]
- {currentfile picstr readhexstring pop} image
- grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/L1.map b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/L1.map
deleted file mode 100644
index 0847af4559..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/L1.map
+++ /dev/null
@@ -1,150 +0,0 @@
-FFFFFFFFFFFFFFFFFF0007FFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFF00000007FFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFE0000000007FFFFFFFFFFFFFFF
-FFFFFFFFFFFFFF00000000000FFFFFFFFFFFFFFF
-FFFFFFFFFFFFF8000000000001FFFFFFFFFFFFFF
-FFFFFFFFFFFFE00000000000003FFFFFFFFFFFFF
-FFFFFFFFFFFF000000000000000FFFFFFFFFFFFF
-FFFFFFFFFFFC0000000000000003FFFFFFFFFFFF
-FFFFFFFFFFF000000000000000007FFFFFFFFFFF
-FFFFFFFFFFC000000000000000003FFFFFFFFFFF
-FFFFFFFFFF8FFFFFFF00000000000FFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFF0000000007FFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFF000000000FFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFC00000000003FFFFFFFF
-FFFFFFF81FFFFFFFFFC0000000000001FFFFFFFF
-FFFFFFF0000000000000000000000000FFFFFFFF
-FFFFFFE00000000000000000000000007FFFFFFF
-FFFFFFC00000000000000000000000003FFFFFFF
-FFFFFF800000000000000000000000001FFFFFFF
-FFFFFF000000000000000000000000000FFFFFFF
-FFFFFE0007FFFFFFFF8000000000000007FFFFFF
-FFFFFE7FFFFFFFFFFFFFFE000000000003FFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFF0000000003FFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFE000000001FFFFF
-FFFFFFFFFFFFFFFFFFFFFFFF80000000001FFFFF
-FFFF01FFFFFFFFFFFFFFFFC000000000000FFFFF
-FFFE00000000000000000000000000000007FFFF
-FFFE00000000000000000000000000000007FFFF
-FFFC00000000000000000000000000000003FFFF
-FFFC00000000000000000000000000000003FFFF
-FFF800000000000000000000000000000001FFFF
-FFF800000000000000000000000000000000FFFF
-FFF80FFFFFFFFFFFFFFFFFE0000000000000FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFE0000000000FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000001FFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFC0000000001FFF
-FF87FFFFFFFFFFFFFFFFFFFFC000000000000FFF
-FF000000007FFFFFFFFFFC000000000000000FFF
-FF000000000000000000000000000000000007FF
-FF000000000000000000000000000000000007FF
-FE000000000000000000000000000000000007FF
-FE000000000000000000000000000000000003FF
-FE000000000000000000000000000000000003FF
-FE0007FFFFFFFFFFFFFFFFC000000000000003FF
-FC0FFFFFFFFFFFFFFFFFFFFFFC000000000003FF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFC000000003FF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000001FF
-FFFFFFFFFFFFFFFFFFFFFFFFFF800000000001FF
-F8FFFFFFFFFFFFFFFFFFFFFF80000000000000FF
-F8000FFFFFFFFFFFFFFFFF0000000000000000FF
-F8000000000000000000000000000000000000FF
-F0000000000000000000000000000000000000FF
-F0000000000000000000000000000000000000FF
-F0000000000000000000000000000000000000FF
-F00000000000000000000000000000000000007F
-F00000007FFFFFFFFFFFE000000000000000007F
-F000FFFFFFFFFFFFFFFFFFFF000000000000007F
-F07FFFFFFFFFFFFFFFFFFFFFFFC000000000007F
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFF0000000000007F
-F007FFFFFFFFFFFFFFFFFFFC000000000000007F
-F00003FFFFFFFFFFFFFFF000000000000000007F
-F00000000000000000000000000000000000007F
-F00000000000000000000000000000000000007F
-F0000000000000000000000000000000000000FF
-F0000000000000000000000000000000000000FF
-F8000000000000000000000000000000000000FF
-F8000000000000000000000000000000000000FF
-F80003FFFFFFFFFFFFFFF80000000000000000FF
-F80FFFFFFFFFFFFFFFFFFFFFC0000000000000FF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFE00000000000003FF
-FC003FFFFFFFFFFFFFFE000000000000000003FF
-FE000000FFFFFFFFC800000000000000000003FF
-FE000000000000000000000000000000000003FF
-FE000000000000000000000000000000000003FF
-FE000000000000000000000000000000000003FF
-FF000000000000000000000000000000000007FF
-FF000000000000000000000000000000000007FF
-FF000000000000000000000000000000000007FF
-FF80000000000000000000000000000000000FFF
-FF8000000007FF80000000000000000000000FFF
-FFC00007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFC07FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF03FFFFFFFFFFFFFFFC0000000000000007FFF
-FFF0000007FFFFFE000000000000000000007FFF
-FFF800000000000000000000000000000000FFFF
-FFF800000000000000000000000000000000FFFF
-FFF800000000000000000000000000000000FFFF
-FFFC00000000000000000000000000000001FFFF
-FFFE00000000000000000000000000000003FFFF
-FFFE00000000000000000000000000000003FFFF
-FFFF00000000000000000000000000000007FFFF
-FFFF0000000000000000000000000000000FFFFF
-FFFF8000000000000000000000000000000FFFFF
-FFFFC000003FFFE00000000000000000001FFFFF
-FFFFE007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFC0000000000000000000000000001FFFFFF
-FFFFFE0000000000000000000000000003FFFFFF
-FFFFFF0000000000000000000000000003FFFFFF
-FFFFFF0000000000000000000000000007FFFFFF
-FFFFFF800000000000000000000000000FFFFFFF
-FFFFFFC00000000000000000000000001FFFFFFF
-FFFFFFE00000000000000000000000003FFFFFFF
-FFFFFFF00000000000000000000000007FFFFFFF
-FFFFFFFC000000000000000000000000FFFFFFFF
-FFFFFFFE000000000000000000000003FFFFFFFF
-FFFFFFFF000000000000000000000007FFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFF00000000000000000003FFFFFFFFFF
-FFFFFFFFFF8000000000000000000FFFFFFFFFFF
-FFFFFFFFFFE000000000000000001FFFFFFFFFFF
-FFFFFFFFFFF000000000000000007FFFFFFFFFFF
-FFFFFFFFFFFC0000000000000001FFFFFFFFFFFF
-FFFFFFFFFFFF0000000000000007FFFFFFFFFFFF
-FFFFFFFFFFFFE00000000000003FFFFFFFFFFFFF
-FFFFFFFFFFFFF8000000000000FFFFFFFFFFFFFF
-FFFFFFFFFFFFFF000000000007FFFFFFFFFFFFFF
-FFFFFFFFFFFFFFF0000000007FFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFF00000007FFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFE0007FFFFFFFFFFFFFFFFFF
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/LH b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/LH
deleted file mode 100644
index 740d2c58ab..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/LH
+++ /dev/null
@@ -1,23 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/LH 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_LH {pop} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/LH.map b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/LH.map
deleted file mode 100644
index b2aa627216..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/LH.map
+++ /dev/null
@@ -1,871 +0,0 @@
-gsave
-/M {moveto} def
-/L {lineto} def
-
-currentpoint translate
-0 360 translate
-2.4 2.4 scale
-ptsize 36 div dup neg scale
-
-68 1 M
-68 1 L
-60 2 L
-55 3 L
-52 4 L
-49 5 L
-47 6 L
-44 7 L
-42 8 L
-40 9 L
-38 10 L
-37 11 L
-39 11 L
-53 10 L
-68 11 L
-76 12 L
-112 12 L
-111 11 L
-109 10 L
-108 9 L
-105 8 L
-103 7 L
-101 6 L
-98 5 L
-95 4 L
-92 3 L
-88 2 L
-80 1 L
-closepath
-84 17 M
-84 17 L
-78 18 L
-70 19 L
-50 20 L
-30 19 L
-25 19 L
-24 20 L
-23 21 L
-22 22 L
-21 23 L
-20 24 L
-19 25 L
-19 26 L
-20 26 L
-32 25 L
-50 24 L
-69 25 L
-83 26 L
-92 27 L
-129 27 L
-129 26 L
-128 25 L
-127 24 L
-126 23 L
-125 22 L
-124 21 L
-123 20 L
-122 19 L
-121 18 L
-119 17 L
-closepath
-99 32 M
-99 32 L
-93 33 L
-86 34 L
-52 35 L
-18 34 L
-12 34 L
-11 35 L
-11 36 L
-10 37 L
-10 38 L
-9 39 L
-9 40 L
-9 41 L
-15 41 L
-51 40 L
-87 41 L
-99 42 L
-139 42 L
-139 41 L
-139 40 L
-138 39 L
-137 38 L
-137 37 L
-136 36 L
-136 35 L
-135 34 L
-134 33 L
-134 32 L
-closepath
-110 47 M
-110 47 L
-102 48 L
-94 49 L
-82 50 L
-59 51 L
-36 50 L
-8 49 L
-5 49 L
-4 50 L
-4 51 L
-4 52 L
-3 53 L
-3 54 L
-3 55 L
-3 56 L
-2 57 L
-7 57 L
-16 56 L
-51 55 L
-86 56 L
-98 57 L
-110 58 L
-145 58 L
-145 57 L
-145 56 L
-145 55 L
-145 54 L
-144 53 L
-144 52 L
-144 51 L
-143 50 L
-143 49 L
-142 48 L
-142 47 L
-closepath
-178 49 M
-178 49 L
-178 50 L
-177 51 L
-177 52 L
-177 53 L
-176 54 L
-176 55 L
-176 56 L
-175 57 L
-175 58 L
-175 59 L
-174 60 L
-174 61 L
-174 62 L
-173 63 L
-173 64 L
-173 65 L
-172 66 L
-172 67 L
-172 68 L
-171 69 L
-171 70 L
-171 71 L
-170 72 L
-170 73 L
-170 74 L
-169 75 L
-169 76 L
-169 77 L
-168 78 L
-168 79 L
-168 80 L
-167 81 L
-167 82 L
-167 83 L
-166 84 L
-166 85 L
-166 86 L
-165 87 L
-165 88 L
-165 89 L
-164 90 L
-164 91 L
-164 92 L
-163 93 L
-163 94 L
-163 95 L
-162 96 L
-162 97 L
-162 98 L
-161 99 L
-161 100 L
-161 101 L
-160 102 L
-174 102 L
-174 101 L
-175 100 L
-175 99 L
-175 98 L
-176 97 L
-176 96 L
-176 95 L
-177 94 L
-185 93 L
-194 94 L
-194 95 L
-195 96 L
-195 97 L
-195 98 L
-195 99 L
-196 100 L
-196 101 L
-196 102 L
-210 102 L
-209 101 L
-209 100 L
-209 99 L
-208 98 L
-208 97 L
-208 96 L
-208 95 L
-207 94 L
-207 93 L
-207 92 L
-206 91 L
-206 90 L
-206 89 L
-205 88 L
-205 87 L
-205 86 L
-204 85 L
-204 84 L
-204 83 L
-203 82 L
-203 81 L
-203 80 L
-202 79 L
-202 78 L
-202 77 L
-202 76 L
-201 75 L
-201 74 L
-201 73 L
-200 72 L
-200 71 L
-200 70 L
-199 69 L
-199 68 L
-199 67 L
-198 66 L
-198 65 L
-198 64 L
-197 63 L
-197 62 L
-197 61 L
-197 60 L
-196 59 L
-196 58 L
-196 57 L
-195 56 L
-195 55 L
-195 54 L
-194 53 L
-194 52 L
-194 51 L
-193 50 L
-193 49 L
-closepath
-200 49 M
-200 49 L
-200 50 L
-200 51 L
-200 52 L
-200 53 L
-200 54 L
-200 55 L
-200 56 L
-200 57 L
-200 58 L
-200 59 L
-200 60 L
-214 61 L
-214 62 L
-214 63 L
-214 64 L
-214 65 L
-214 66 L
-214 67 L
-214 68 L
-214 69 L
-214 70 L
-214 71 L
-214 72 L
-214 73 L
-214 74 L
-214 75 L
-214 76 L
-214 77 L
-214 78 L
-214 79 L
-214 80 L
-214 81 L
-214 82 L
-214 83 L
-214 84 L
-214 85 L
-214 86 L
-214 87 L
-214 88 L
-214 89 L
-214 90 L
-214 91 L
-214 92 L
-214 93 L
-214 94 L
-214 95 L
-214 96 L
-214 97 L
-214 98 L
-214 99 L
-214 100 L
-214 101 L
-214 102 L
-228 102 L
-228 101 L
-228 100 L
-228 99 L
-228 98 L
-228 97 L
-228 96 L
-228 95 L
-228 94 L
-228 93 L
-228 92 L
-228 91 L
-228 90 L
-228 89 L
-228 88 L
-228 87 L
-228 86 L
-228 85 L
-228 84 L
-228 83 L
-228 82 L
-228 81 L
-228 80 L
-228 79 L
-228 78 L
-228 77 L
-228 76 L
-228 75 L
-228 74 L
-228 73 L
-228 72 L
-228 71 L
-228 70 L
-228 69 L
-228 68 L
-228 67 L
-228 66 L
-228 65 L
-228 64 L
-228 63 L
-228 62 L
-228 61 L
-241 60 L
-241 59 L
-241 58 L
-241 57 L
-241 56 L
-241 55 L
-241 54 L
-241 53 L
-241 52 L
-241 51 L
-241 50 L
-241 49 L
-closepath
-266 49 M
-266 49 L
-266 50 L
-266 51 L
-266 52 L
-266 53 L
-266 54 L
-266 55 L
-266 56 L
-266 57 L
-266 58 L
-266 59 L
-266 60 L
-280 61 L
-280 62 L
-280 63 L
-280 64 L
-280 65 L
-280 66 L
-280 67 L
-280 68 L
-280 69 L
-280 70 L
-280 71 L
-280 72 L
-280 73 L
-280 74 L
-280 75 L
-280 76 L
-280 77 L
-280 78 L
-280 79 L
-280 80 L
-280 81 L
-280 82 L
-280 83 L
-280 84 L
-280 85 L
-280 86 L
-280 87 L
-280 88 L
-280 89 L
-280 90 L
-280 91 L
-280 92 L
-280 93 L
-280 94 L
-280 95 L
-280 96 L
-280 97 L
-280 98 L
-280 99 L
-280 100 L
-280 101 L
-280 102 L
-294 102 L
-294 101 L
-294 100 L
-294 99 L
-294 98 L
-294 97 L
-294 96 L
-294 95 L
-294 94 L
-294 93 L
-294 92 L
-294 91 L
-294 90 L
-294 89 L
-294 88 L
-294 87 L
-294 86 L
-294 85 L
-294 84 L
-294 83 L
-294 82 L
-294 81 L
-294 80 L
-294 79 L
-294 78 L
-294 77 L
-294 76 L
-294 75 L
-294 74 L
-294 73 L
-294 72 L
-294 71 L
-294 70 L
-294 69 L
-294 68 L
-294 67 L
-294 66 L
-294 65 L
-294 64 L
-294 63 L
-294 62 L
-294 61 L
-308 60 L
-308 59 L
-308 58 L
-308 57 L
-308 56 L
-308 55 L
-308 54 L
-308 53 L
-308 52 L
-308 51 L
-308 50 L
-308 49 L
-closepath
-251 59 M
-251 59 L
-245 60 L
-243 61 L
-241 62 L
-240 63 L
-239 64 L
-239 65 L
-238 66 L
-238 67 L
-237 68 L
-237 69 L
-237 70 L
-237 71 L
-237 72 L
-238 73 L
-238 74 L
-238 75 L
-239 76 L
-239 77 L
-240 78 L
-239 79 L
-238 80 L
-237 81 L
-237 82 L
-237 83 L
-236 84 L
-236 85 L
-235 86 L
-235 87 L
-235 88 L
-235 89 L
-235 90 L
-235 91 L
-235 92 L
-236 93 L
-236 94 L
-237 95 L
-237 96 L
-238 97 L
-239 98 L
-240 99 L
-241 100 L
-243 101 L
-245 102 L
-249 103 L
-259 103 L
-262 102 L
-265 101 L
-267 100 L
-270 101 L
-272 102 L
-276 102 L
-276 101 L
-276 100 L
-276 99 L
-276 98 L
-276 97 L
-276 96 L
-276 95 L
-276 94 L
-276 93 L
-273 92 L
-273 91 L
-274 90 L
-274 89 L
-274 88 L
-274 87 L
-274 86 L
-274 85 L
-274 84 L
-274 83 L
-274 82 L
-274 81 L
-274 80 L
-274 79 L
-274 78 L
-274 77 L
-274 76 L
-264 75 L
-264 74 L
-264 73 L
-264 72 L
-264 71 L
-264 70 L
-264 69 L
-264 68 L
-264 67 L
-263 66 L
-263 65 L
-263 64 L
-262 63 L
-261 62 L
-260 61 L
-258 60 L
-253 59 L
-closepath
-114 62 M
-114 62 L
-101 63 L
-93 64 L
-84 65 L
-49 66 L
-15 65 L
-3 64 L
-1 64 L
-1 65 L
-1 66 L
-0 67 L
-0 68 L
-0 69 L
-0 70 L
-0 71 L
-0 72 L
-0 73 L
-4 73 L
-11 72 L
-28 71 L
-53 70 L
-79 71 L
-92 72 L
-102 73 L
-148 73 L
-148 72 L
-148 71 L
-148 70 L
-147 69 L
-147 68 L
-147 67 L
-147 66 L
-147 65 L
-147 64 L
-146 63 L
-146 62 L
-closepath
-185 68 M
-185 68 L
-186 67 L
-187 68 L
-187 69 L
-187 70 L
-188 71 L
-188 72 L
-188 73 L
-188 74 L
-189 75 L
-189 76 L
-189 77 L
-189 78 L
-190 79 L
-190 80 L
-190 81 L
-185 82 L
-181 81 L
-181 80 L
-181 79 L
-182 78 L
-182 77 L
-182 76 L
-183 75 L
-183 74 L
-183 73 L
-184 72 L
-184 71 L
-184 70 L
-184 69 L
-closepath
-250 68 M
-250 68 L
-251 67 L
-253 68 L
-254 69 L
-254 70 L
-254 71 L
-254 72 L
-254 73 L
-254 74 L
-254 75 L
-252 76 L
-251 75 L
-250 74 L
-249 73 L
-249 72 L
-249 71 L
-249 70 L
-249 69 L
-closepath
-254 77 M
-254 77 L
-259 76 L
-264 77 L
-264 78 L
-264 79 L
-264 80 L
-264 81 L
-264 82 L
-264 83 L
-264 84 L
-263 85 L
-262 84 L
-261 83 L
-260 82 L
-258 81 L
-257 80 L
-256 79 L
-255 78 L
-closepath
-100 78 M
-100 78 L
-90 79 L
-80 80 L
-48 81 L
-17 80 L
-8 79 L
-0 79 L
-0 80 L
-0 81 L
-0 82 L
-0 83 L
-0 84 L
-1 85 L
-1 86 L
-1 87 L
-1 88 L
-7 88 L
-17 87 L
-49 86 L
-81 87 L
-94 88 L
-147 88 L
-147 87 L
-147 86 L
-147 85 L
-147 84 L
-147 83 L
-148 82 L
-148 81 L
-148 80 L
-148 79 L
-148 78 L
-closepath
-246 86 M
-246 86 L
-247 85 L
-249 86 L
-250 87 L
-252 88 L
-253 89 L
-254 90 L
-255 91 L
-255 92 L
-252 93 L
-250 92 L
-248 91 L
-247 90 L
-247 89 L
-246 88 L
-246 87 L
-closepath
-91 93 M
-91 93 L
-75 94 L
-65 95 L
-64 96 L
-63 95 L
-62 95 L
-44 96 L
-27 95 L
-13 94 L
-2 94 L
-3 95 L
-3 96 L
-3 97 L
-3 98 L
-4 99 L
-4 100 L
-4 101 L
-5 102 L
-5 103 L
-6 104 L
-6 105 L
-12 105 L
-24 104 L
-40 103 L
-46 102 L
-53 103 L
-143 103 L
-143 102 L
-144 101 L
-144 100 L
-144 99 L
-145 98 L
-145 97 L
-145 96 L
-145 95 L
-145 94 L
-145 93 L
-closepath
-8 108 M
-8 108 L
-8 109 L
-9 110 L
-9 111 L
-9 112 L
-10 113 L
-11 114 L
-11 115 L
-12 116 L
-12 117 L
-13 118 L
-14 119 L
-15 120 L
-24 120 L
-37 119 L
-46 118 L
-55 119 L
-134 119 L
-135 118 L
-135 117 L
-136 116 L
-137 115 L
-137 114 L
-138 113 L
-139 112 L
-139 111 L
-139 110 L
-140 109 L
-140 108 L
-78 108 L
-59 109 L
-45 110 L
-32 109 L
-13 108 L
-closepath
-18 124 M
-18 124 L
-19 125 L
-20 126 L
-20 127 L
-21 128 L
-22 129 L
-23 130 L
-24 131 L
-26 132 L
-27 133 L
-28 134 L
-120 134 L
-121 133 L
-123 132 L
-124 131 L
-125 130 L
-126 129 L
-127 128 L
-128 127 L
-129 126 L
-129 125 L
-130 124 L
-closepath
-36 139 M
-36 139 L
-37 140 L
-39 141 L
-40 142 L
-42 143 L
-44 144 L
-47 145 L
-49 146 L
-52 147 L
-56 148 L
-60 149 L
-67 150 L
-80 150 L
-88 149 L
-92 148 L
-96 147 L
-99 146 L
-101 145 L
-104 144 L
-106 143 L
-108 142 L
-110 141 L
-111 140 L
-113 139 L
-closepath
-fill
-grestore
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Lb b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Lb
deleted file mode 100644
index 054da5a132..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Lb
+++ /dev/null
@@ -1,34 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/Lb 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_Lb {
- pop
- /picstr 78 string def
- gsave
- currentpoint translate
- 1.03 72 mul size mul 36 div
- .5 72 mul size mul 36 div
- scale
- 309 150 1 [309 0 0 -150 0 150]
- {currentfile picstr readhexstring pop} image
- grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Lb.map b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Lb.map
deleted file mode 100644
index e467b45798..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Lb.map
+++ /dev/null
@@ -1,150 +0,0 @@
-FFFFFFFFFFFFFFFFF0007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFF00000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFE0000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFF00000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFF8000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFE00000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFF000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFC0000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFF000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFC000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFF8FFFFFFF00000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFF0000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFC00000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFF81FFFFFFFFFC0000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFF0000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFE00000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFC00000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF800000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFE0007FFFFFFFF8000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFE7FFFFFFFFFFFFFFE000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFF0000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFE000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFF80000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF01FFFFFFFFFFFFFFFFC000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFE00000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFE00000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFC00000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFC00000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF80FFFFFFFFFFFFFFFFFE0000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFE0000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFC00000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFC0000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-F87FFFFFFFFFFFFFFFFFFFFC000000000000FFFFFFFFC0003F00000000003FFFFFC00000000007
-F000000007FFFFFFFFFFC000000000000000FFFFFFFFC0003F00000000003FFFFFC00000000007
-F000000000000000000000000000000000007FFFFFFF80001F00000000003FFFFFC00000000007
-F000000000000000000000000000000000007FFFFFFF80001F00000000003FFFFFC00000000007
-E000000000000000000000000000000000007FFFFFFF80001F00000000003FFFFFC00000000007
-E000000000000000000000000000000000003FFFFFFF00000F00000000003FFFFFC00000000007
-E000000000000000000000000000000000003FFFFFFF00000F00000000003FFFFFC00000000007
-E0007FFFFFFFFFFFFFFFFC000000000000003FFFFFFF00000F00000000003FFFFFC00000000007
-C0FFFFFFFFFFFFFFFFFFFFFFC000000000003FFFFFFE00000700000000003FFFFFC00000000007
-FFFFFFFFFFFFFFFFFFFFFFFFFFFC000000003FFFFFFE00000700000000003FFFFFC00000000007
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000700000000003FE3FFC00000000007
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC000003000000000038001FC00000000007
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC000003FFFC0007FFE00007FFFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000001FFFFFFC000003FFFC0007FF800003FFFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFF800000000001FFFFFF8000003FFFC0007FF000001FFFF0001FFFF
-8FFFFFFFFFFFFFFFFFFFFFF80000000000000FFFFFF8000001FFFC0007FE000000FFFF0001FFFF
-8000FFFFFFFFFFFFFFFFF0000000000000000FFFFFF8000001FFFC0007FE000000FFFF0001FFFF
-8000000000000000000000000000000000000FFFFFF0000001FFFC0007FC000000FFFF0001FFFF
-0000000000000000000000000000000000000FFFFFF0000000FFFC0007FC0000007FFF0001FFFF
-0000000000000000000000000000000000000FFFFFF0002000FFFC0007F80018007FFF0001FFFF
-0000000000000000000000000000000000000FFFFFE0006000FFFC0007F8003C007FFF0001FFFF
-00000000000000000000000000000000000007FFFFE00060007FFC0007F8003C007FFF0001FFFF
-00000007FFFFFFFFFFFE000000000000000007FFFFE00070007FFC0007F8003C007FFF0001FFFF
-000FFFFFFFFFFFFFFFFFFFF000000000000007FFFFC00070007FFC0007F8003C007FFF0001FFFF
-07FFFFFFFFFFFFFFFFFFFFFFFC000000000007FFFFC000F0003FFC0007FC003C007FFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC000F0003FFC0007FC001C007FFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000F8003FFC0007FC000C007FFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8001F8001FFC0007FE000000001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8001F8001FFC0007FE0001FF001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFF0000000000007FFFF0001F8001FFC0007FF0000FF001F0001FFFF
-007FFFFFFFFFFFFFFFFFFFC000000000000007FFFF0003FC001FFC0007FE00007F001F0001FFFF
-00003FFFFFFFFFFFFFFF000000000000000007FFFF0003FC000FFC0007FC00003F001F0001FFFF
-00000000000000000000000000000000000007FFFE0003FC000FFC0007F800001F001F0001FFFF
-00000000000000000000000000000000000007FFFE000000000FFC0007F8000007001F0001FFFF
-0000000000000000000000000000000000000FFFFE0000000007FC0007F8000003001F0001FFFF
-0000000000000000000000000000000000000FFFFC0000000007FC0007F0000001001F0001FFFF
-8000000000000000000000000000000000000FFFFC0000000007FC0007F0000000001F0001FFFF
-8000000000000000000000000000000000000FFFFC0000000003FC0007E0018000001F0001FFFF
-80003FFFFFFFFFFFFFFF80000000000000000FFFF80000000003FC0007E001C000001F0001FFFF
-80FFFFFFFFFFFFFFFFFFFFFC0000000000000FFFF80000000003FC0007E001F000001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80000000001FC0007E000F800001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000001FC0007E000FC00001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000001FC0007E0007E00003F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000FC0007E0001E00003F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFE00000000000003FFFE00000000000FC0007F000000000070001FFFF
-C003FFFFFFFFFFFFFFE000000000000000003FFFE0003FFFC000FC0007F000000000070001FFFF
-E000000FFFFFFFFC800000000000000000003FFFE0007FFFC0007C0007F800000000070001FFFF
-E000000000000000000000000000000000003FFFC0007FFFE0007C0007F800000000070001FFFF
-E000000000000000000000000000000000003FFFC0007FFFE0007C0007FC00000000070001FFFF
-E000000000000000000000000000000000003FFFC000FFFFE0007C0007FE00000000070001FFFF
-F000000000000000000000000000000000007FFF8000FFFFE0003C0007FF00000000070001FFFF
-F000000000000000000000000000000000007FFF8000FFFFF0003C0007FF80000000070001FFFF
-F000000000000000000000000000000000007FFF8001FFFFF0003C0007FFE000003C070001FFFF
-F80000000000000000000000000000000000FFFF0001FFFFF0001C0007FFF80001FF070001FFFF
-F8000000007FF80000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFF800FFFFFFFFFFFFF
-FC00007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FC07FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF03FFFFFFFFFFFFFFFC0000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF0000007FFFFFE000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFC00000000000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFE00000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFE00000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF00000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF0000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF8000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFC000003FFFE00000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFE007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFC0000000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFE0000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF0000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF0000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF800000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFC00000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFE00000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFF00000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFC000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFE000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFF000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFF00000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFF8000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFE000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFF000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFC0000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFF0000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFE00000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFF8000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFF000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFF0000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFF00000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFE0007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Makefile b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Makefile
deleted file mode 100644
index 0cedf220dd..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/font/devpost/charlib/Makefile
-#
-
-include ../../../../../Makefile.lp
-
-CHARFILES = 12 14 34 Fi Fl L1 LH Lb \
- OLD_LH Sl bx ci ff lc lf lh \
- ob rc rf rh sq
-MAPFILES = L1.map LH.map Lb.map OLD_LH.map
-TXTS = BRACKETS_NOTE README
-FILES = $(CHARFILES) $(MAPFILES) $(TXTS)
-
-ROOTCHARLIB = $(ROOT)/usr/lib/font/devpost/charlib
-
-ROOTFILES = $(FILES:%=$(ROOTCHARLIB)/%)
-
-FILEMODE = 0444
-
-.KEEP_STATE:
-
-all: $(FILES)
-
-# because of its name, the file ~= is a special case
-#
-install: all $(ROOTCHARLIB) $(ROOTFILES)
- $(RM) $(ROOTCHARLIB)/~=
- $(INS) -m $(FILEMODE) -f $(ROOTCHARLIB) ~=
- $(RM) $(ROOTCHARLIB)/'~'
- $(LN) $(ROOTCHARLIB)/~= $(ROOTCHARLIB)/'~'
-
-$(ROOTCHARLIB):
- $(INS.dir)
-
-$(ROOTCHARLIB)/% : %
- $(INS.file)
-
-clean clobber strip lint :
-
-FRC:
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/OLD_LH b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/OLD_LH
deleted file mode 100644
index 3feb59c636..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/OLD_LH
+++ /dev/null
@@ -1,34 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/OLD_LH 1.1"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_LH {
- pop
- /picstr 78 string def
- gsave
- currentpoint translate
- 1.03 72 mul size mul 36 div
- .5 72 mul size mul 36 div
- scale
- 309 150 1 [309 0 0 -150 0 150]
- {currentfile picstr readhexstring pop} image
- grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/OLD_LH.map b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/OLD_LH.map
deleted file mode 100644
index e467b45798..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/OLD_LH.map
+++ /dev/null
@@ -1,150 +0,0 @@
-FFFFFFFFFFFFFFFFF0007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFF00000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFE0000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFF00000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFF8000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFE00000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFF000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFC0000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFF000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFC000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFF8FFFFFFF00000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFF0000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFC00000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFF81FFFFFFFFFC0000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFF0000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFE00000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFC00000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF800000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFE0007FFFFFFFF8000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFE7FFFFFFFFFFFFFFE000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFF0000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFE000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFF80000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF01FFFFFFFFFFFFFFFFC000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFE00000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFE00000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFC00000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFC00000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF80FFFFFFFFFFFFFFFFFE0000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFE0000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFC00000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFC0000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-F87FFFFFFFFFFFFFFFFFFFFC000000000000FFFFFFFFC0003F00000000003FFFFFC00000000007
-F000000007FFFFFFFFFFC000000000000000FFFFFFFFC0003F00000000003FFFFFC00000000007
-F000000000000000000000000000000000007FFFFFFF80001F00000000003FFFFFC00000000007
-F000000000000000000000000000000000007FFFFFFF80001F00000000003FFFFFC00000000007
-E000000000000000000000000000000000007FFFFFFF80001F00000000003FFFFFC00000000007
-E000000000000000000000000000000000003FFFFFFF00000F00000000003FFFFFC00000000007
-E000000000000000000000000000000000003FFFFFFF00000F00000000003FFFFFC00000000007
-E0007FFFFFFFFFFFFFFFFC000000000000003FFFFFFF00000F00000000003FFFFFC00000000007
-C0FFFFFFFFFFFFFFFFFFFFFFC000000000003FFFFFFE00000700000000003FFFFFC00000000007
-FFFFFFFFFFFFFFFFFFFFFFFFFFFC000000003FFFFFFE00000700000000003FFFFFC00000000007
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000700000000003FE3FFC00000000007
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC000003000000000038001FC00000000007
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC000003FFFC0007FFE00007FFFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000001FFFFFFC000003FFFC0007FF800003FFFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFF800000000001FFFFFF8000003FFFC0007FF000001FFFF0001FFFF
-8FFFFFFFFFFFFFFFFFFFFFF80000000000000FFFFFF8000001FFFC0007FE000000FFFF0001FFFF
-8000FFFFFFFFFFFFFFFFF0000000000000000FFFFFF8000001FFFC0007FE000000FFFF0001FFFF
-8000000000000000000000000000000000000FFFFFF0000001FFFC0007FC000000FFFF0001FFFF
-0000000000000000000000000000000000000FFFFFF0000000FFFC0007FC0000007FFF0001FFFF
-0000000000000000000000000000000000000FFFFFF0002000FFFC0007F80018007FFF0001FFFF
-0000000000000000000000000000000000000FFFFFE0006000FFFC0007F8003C007FFF0001FFFF
-00000000000000000000000000000000000007FFFFE00060007FFC0007F8003C007FFF0001FFFF
-00000007FFFFFFFFFFFE000000000000000007FFFFE00070007FFC0007F8003C007FFF0001FFFF
-000FFFFFFFFFFFFFFFFFFFF000000000000007FFFFC00070007FFC0007F8003C007FFF0001FFFF
-07FFFFFFFFFFFFFFFFFFFFFFFC000000000007FFFFC000F0003FFC0007FC003C007FFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC000F0003FFC0007FC001C007FFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000F8003FFC0007FC000C007FFF0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8001F8001FFC0007FE000000001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8001F8001FFC0007FE0001FF001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFF0000000000007FFFF0001F8001FFC0007FF0000FF001F0001FFFF
-007FFFFFFFFFFFFFFFFFFFC000000000000007FFFF0003FC001FFC0007FE00007F001F0001FFFF
-00003FFFFFFFFFFFFFFF000000000000000007FFFF0003FC000FFC0007FC00003F001F0001FFFF
-00000000000000000000000000000000000007FFFE0003FC000FFC0007F800001F001F0001FFFF
-00000000000000000000000000000000000007FFFE000000000FFC0007F8000007001F0001FFFF
-0000000000000000000000000000000000000FFFFE0000000007FC0007F8000003001F0001FFFF
-0000000000000000000000000000000000000FFFFC0000000007FC0007F0000001001F0001FFFF
-8000000000000000000000000000000000000FFFFC0000000007FC0007F0000000001F0001FFFF
-8000000000000000000000000000000000000FFFFC0000000003FC0007E0018000001F0001FFFF
-80003FFFFFFFFFFFFFFF80000000000000000FFFF80000000003FC0007E001C000001F0001FFFF
-80FFFFFFFFFFFFFFFFFFFFFC0000000000000FFFF80000000003FC0007E001F000001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80000000001FC0007E000F800001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000001FC0007E000FC00001F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000001FC0007E0007E00003F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000FC0007E0001E00003F0001FFFF
-FFFFFFFFFFFFFFFFFFFFFFE00000000000003FFFE00000000000FC0007F000000000070001FFFF
-C003FFFFFFFFFFFFFFE000000000000000003FFFE0003FFFC000FC0007F000000000070001FFFF
-E000000FFFFFFFFC800000000000000000003FFFE0007FFFC0007C0007F800000000070001FFFF
-E000000000000000000000000000000000003FFFC0007FFFE0007C0007F800000000070001FFFF
-E000000000000000000000000000000000003FFFC0007FFFE0007C0007FC00000000070001FFFF
-E000000000000000000000000000000000003FFFC000FFFFE0007C0007FE00000000070001FFFF
-F000000000000000000000000000000000007FFF8000FFFFE0003C0007FF00000000070001FFFF
-F000000000000000000000000000000000007FFF8000FFFFF0003C0007FF80000000070001FFFF
-F000000000000000000000000000000000007FFF8001FFFFF0003C0007FFE000003C070001FFFF
-F80000000000000000000000000000000000FFFF0001FFFFF0001C0007FFF80001FF070001FFFF
-F8000000007FF80000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFF800FFFFFFFFFFFFF
-FC00007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FC07FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF03FFFFFFFFFFFFFFFC0000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF0000007FFFFFE000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FF800000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFC00000000000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFE00000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFE00000000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF00000000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF0000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFF8000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFC000003FFFE00000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFE007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFC0000000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFE0000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF0000000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF0000000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFF800000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFC00000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFE00000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFF00000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFC000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFE000000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFF000000000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFF00000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFF8000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFE000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFF000000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFC0000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFF0000000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFE00000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFF8000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFF000000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFF0000000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFF00000007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-FFFFFFFFFFFFFFFFE0007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/README b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/README
deleted file mode 100644
index f8a31f9254..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/README
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# University Copyright- Copyright (c) 1982, 1986, 1988
-# The Regents of the University of California
-# All Rights Reserved
-#
-# University Acknowledgment- Portions of this document are derived from
-# software developed by the University of California, Berkeley, and its
-# contributors.
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-Postscript definitions of some special troff characters. For now each file
-is named by its two character troff name and is copied to the output file,
-as is, when the character is first used. Each procedure is called with a
-single argument, namely the width of the character. The name of the PostScript
-procedure that builds the character must begin with the prefix build_ and
-end with the character's name.
-
-The following variables are defined in dpost.ps and may help when you're building
-a new character:
-
- font name of the current font
- ptsize and the point size
- size Postscript is using this size - it's scaled up from ptsize
-
-
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Sl b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Sl
deleted file mode 100644
index b05f0e8540..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/Sl
+++ /dev/null
@@ -1,126 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/Sl 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_Sl {
-pop
-gsave
-size .0022 mul dup scale
-currentpoint translate
-14 93 moveto
-14 96 lineto
-29 110 lineto
-44 121 lineto
-54 127 lineto
-55 132 lineto
-57 146 lineto
-59 157 lineto
-62 171 lineto
-66 186 lineto
-70 199 lineto
-75 213 lineto
-81 228 lineto
-88 243 lineto
-96 257 lineto
-106 272 lineto
-118 287 lineto
-133 300 lineto
-148 307 lineto
-163 308 lineto
-178 304 lineto
-191 293 lineto
-197 281 lineto
-198 277 lineto
-198 260 lineto
-194 246 lineto
-187 231 lineto
-179 217 lineto
-168 202 lineto
-155 187 lineto
-141 172 lineto
-126 158 lineto
-111 146 lineto
-96 136 lineto
-94 131 lineto
-93 123 lineto
-92 112 lineto
-91 103 lineto
-90 93 lineto
-89 81 lineto
-89 40 lineto
-92 28 lineto
-97 18 lineto
-108 10 lineto
-122 10 lineto
-134 18 lineto
-145 33 lineto
-152 48 lineto
-158 62 lineto
-168 58 lineto
-168 59 lineto
-163 45 lineto
-157 31 lineto
-148 16 lineto
-133 3 lineto
-118 -1 lineto
-103 0 lineto
-88 5 lineto
-73 18 lineto
-64 31 lineto
-58 46 lineto
-55 59 lineto
-53 73 lineto
-52 111 lineto
-37 101 lineto
-22 86 lineto
-14 93 lineto
-
-97 152 moveto
-97 153 lineto
-99 166 lineto
-101 178 lineto
-103 190 lineto
-106 205 lineto
-109 218 lineto
-113 232 lineto
-118 246 lineto
-124 261 lineto
-132 275 lineto
-144 290 lineto
-157 298 lineto
-171 298 lineto
-181 291 lineto
-186 283 lineto
-187 279 lineto
-187 264 lineto
-186 260 lineto
-181 246 lineto
-174 233 lineto
-165 218 lineto
-155 204 lineto
-142 190 lineto
-127 175 lineto
-112 162 lineto
-97 152 lineto
-
-eofill
-grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/bx b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/bx
deleted file mode 100644
index 0ec7bf411e..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/bx
+++ /dev/null
@@ -1,34 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/bx 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_bx {
- pop
- size 2 div /side exch def
- currentpoint
- newpath
- moveto
- 0 side rlineto
- side 0 rlineto
- 0 side neg rlineto
- closepath
- fill
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ci b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ci
deleted file mode 100644
index dba95d10b9..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ci
+++ /dev/null
@@ -1,30 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/ci 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_ci {
- pop
- size 3 mul 8 div /rad exch def
- currentpoint
- newpath
- rad add exch rad add exch rad 0 360 arc
- stroke
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ff b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ff
deleted file mode 100644
index fea5a53e70..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ff
+++ /dev/null
@@ -1,26 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/ff 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_ff {
- pop
- size .05 mul neg 0 (ff) ashow
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lc b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lc
deleted file mode 100644
index 3f34ba0d3a..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lc
+++ /dev/null
@@ -1,58 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/lc 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% This stuff has gotten terribly complicated - sorry.
-%
-
-currentdict /bvbbox known not {/bvbbox [0 0 0 0 0 0 0] def} if
-
-/build_lc {
- pop
- gsave
- currentpoint translate newpath
- bvbbox 6 get size ne {
- gsave
- initgraphics
- scaling scaling scale
- 0 0 moveto
- (\357) false charpath flattenpath pathbbox 0 0 size bvbbox astore pop
- 0 1 idtransform dup mul exch dup mul add sqrt dup
- bvbbox 1 get add bvbbox 1 3 -1 roll put
- bvbbox 3 get exch sub bvbbox 3 3 -1 roll put
- bvbbox 2 get bvbbox 0 get sub bvbbox 4 3 -1 roll put
- bvbbox 2 get bvbbox 0 get add 2 div bvbbox 5 3 -1 roll put
- grestore
- } if
- bvbbox 0 get bvbbox 1 get moveto
- bvbbox 0 get bvbbox 3 get lineto
- bvbbox 5 get bvbbox 4 get 8 mul add dup bvbbox 3 get lineto
- bvbbox 1 get lineto closepath clip newpath
- 0 0 moveto (\357) show
- bvbbox 5 get bvbbox 3 get moveto
- bvbbox 4 get dup dup
- 8 mul 0 rlineto
- 0 exch neg rlineto
- 8 mul neg 0 rlineto
- closepath clip eofill
- grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lf b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lf
deleted file mode 100644
index b99ab46001..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lf
+++ /dev/null
@@ -1,58 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/lf 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% This stuff has gotten terribly complicated - sorry.
-%
-
-currentdict /bvbbox known not {/bvbbox [0 0 0 0 0 0 0] def} if
-
-/build_lf {
- pop
- gsave
- currentpoint translate newpath
- bvbbox 6 get size ne {
- gsave
- initgraphics
- scaling scaling scale
- 0 0 moveto
- (\357) false charpath flattenpath pathbbox 0 0 size bvbbox astore pop
- 0 1 idtransform dup mul exch dup mul add sqrt dup
- bvbbox 1 get add bvbbox 1 3 -1 roll put
- bvbbox 3 get exch sub bvbbox 3 3 -1 roll put
- bvbbox 2 get bvbbox 0 get sub bvbbox 4 3 -1 roll put
- bvbbox 2 get bvbbox 0 get add 2 div bvbbox 5 3 -1 roll put
- grestore
- } if
- bvbbox 0 get bvbbox 1 get moveto
- bvbbox 0 get bvbbox 3 get lineto
- bvbbox 5 get bvbbox 4 get 8 mul add dup bvbbox 3 get lineto
- bvbbox 1 get lineto closepath clip newpath
- 0 0 moveto (\357) show
- bvbbox 5 get bvbbox 1 get moveto
- bvbbox 4 get dup dup
- 8 mul 0 rlineto
- 0 exch rlineto
- 8 mul neg 0 rlineto
- closepath clip eofill
- grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lh b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lh
deleted file mode 100644
index 59d43b4033..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/lh
+++ /dev/null
@@ -1,188 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/lh 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_lh {
-pop
-gsave
-size .0022 mul dup scale
-currentpoint translate
-
-16 177 moveto
-16 188 lineto
-21 193 lineto
-30 193 lineto
-34 189 lineto
-36 183 lineto
-36 180 lineto
-34 174 lineto
-27 170 lineto
-19 172 lineto
-16 177 lineto
-stroke
-
-38 194 moveto
-38 196 lineto
-53 199 lineto
-68 201 lineto
-83 202 lineto
-98 203 lineto
-113 204 lineto
-128 204 lineto
-143 205 lineto
-158 205 lineto
-173 205 lineto
-188 204 lineto
-203 203 lineto
-218 202 lineto
-233 200 lineto
-248 198 lineto
-263 196 lineto
-278 194 lineto
-293 190 lineto
-308 186 lineto
-323 181 lineto
-338 176 lineto
-353 168 lineto
-361 162 lineto
-364 153 lineto
-366 138 lineto
-367 126 lineto
-368 106 lineto
-369 80 lineto
-369 74 lineto
-368 60 lineto
-367 54 lineto
-362 43 lineto
-348 34 lineto
-333 28 lineto
-318 25 lineto
-303 26 lineto
-288 29 lineto
-273 31 lineto
-258 32 lineto
-243 32 lineto
-228 30 lineto
-213 27 lineto
-198 24 lineto
-183 23 lineto
-168 23 lineto
-153 27 lineto
-148 34 lineto
-148 47 lineto
-153 54 lineto
-168 58 lineto
-183 58 lineto
-198 58 lineto
-213 59 lineto
-226 60 lineto
-228 62 lineto
-228 67 lineto
-223 71 lineto
-208 71 lineto
-193 70 lineto
-178 70 lineto
-163 70 lineto
-148 70 lineto
-133 71 lineto
-123 76 lineto
-120 84 lineto
-120 91 lineto
-122 98 lineto
-129 104 lineto
-144 106 lineto
-159 107 lineto
-174 107 lineto
-189 107 lineto
-202 108 lineto
-204 110 lineto
-204 117 lineto
-201 119 lineto
-186 119 lineto
-171 119 lineto
-156 119 lineto
-141 119 lineto
-126 119 lineto
-111 121 lineto
-103 128 lineto
-101 137 lineto
-101 142 lineto
-103 150 lineto
-111 158 lineto
-126 161 lineto
-141 161 lineto
-156 162 lineto
-171 163 lineto
-186 163 lineto
-191 165 lineto
-192 167 lineto
-192 171 lineto
-190 174 lineto
-176 175 lineto
-161 175 lineto
-146 175 lineto
-131 174 lineto
-116 174 lineto
-101 174 lineto
-86 173 lineto
-71 172 lineto
-56 171 lineto
-41 171 lineto
-41 174 lineto
-43 178 lineto
-43 187 lineto
-38 194 lineto
-stroke
-
-373 169 moveto
-373 176 lineto
-375 182 lineto
-386 190 lineto
-401 193 lineto
-408 191 lineto
-411 185 lineto
-412 181 lineto
-414 167 lineto
-415 158 lineto
-416 144 lineto
-417 128 lineto
-418 110 lineto
-418 60 lineto
-417 45 lineto
-415 37 lineto
-409 34 lineto
-394 31 lineto
-381 35 lineto
-379 42 lineto
-379 52 lineto
-380 67 lineto
-380 77 lineto
-379 77 lineto
-378 106 lineto
-377 121 lineto
-376 133 lineto
-375 147 lineto
-374 158 lineto
-373 169 lineto
-
-stroke
-grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ob b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ob
deleted file mode 100644
index c53491c351..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/ob
+++ /dev/null
@@ -1,30 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/ob 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_ob {
- pop
- size 3 mul 16 div /rad exch def
- currentpoint
- newpath
- rad add exch rad add exch rad 0 360 arc
- stroke
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rc b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rc
deleted file mode 100644
index 9e34612524..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rc
+++ /dev/null
@@ -1,58 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/rc 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% This stuff has gotten terribly complicated - sorry.
-%
-
-currentdict /bvbbox known not {/bvbbox [0 0 0 0 0 0 0] def} if
-
-/build_rc {
- pop
- gsave
- currentpoint translate newpath
- bvbbox 6 get size ne {
- gsave
- initgraphics
- scaling scaling scale
- 0 0 moveto
- (\357) false charpath flattenpath pathbbox 0 0 size bvbbox astore pop
- 0 1 idtransform dup mul exch dup mul add sqrt dup
- bvbbox 1 get add bvbbox 1 3 -1 roll put
- bvbbox 3 get exch sub bvbbox 3 3 -1 roll put
- bvbbox 2 get bvbbox 0 get sub bvbbox 4 3 -1 roll put
- bvbbox 2 get bvbbox 0 get add 2 div bvbbox 5 3 -1 roll put
- grestore
- } if
- bvbbox 2 get bvbbox 1 get moveto
- bvbbox 2 get bvbbox 3 get lineto
- bvbbox 5 get bvbbox 4 get 8 mul sub dup bvbbox 3 get lineto
- bvbbox 1 get lineto closepath clip newpath
- 0 0 moveto (\357) show
- bvbbox 5 get bvbbox 3 get moveto
- bvbbox 4 get dup dup
- 8 mul neg 0 rlineto
- 0 exch neg rlineto
- 8 mul 0 rlineto
- closepath clip eofill
- grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rf b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rf
deleted file mode 100644
index 17de01d417..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rf
+++ /dev/null
@@ -1,58 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/rf 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% This stuff has gotten terribly complicated - sorry.
-%
-
-currentdict /bvbbox known not {/bvbbox [0 0 0 0 0 0 0] def} if
-
-/build_rf {
- pop
- gsave
- currentpoint translate newpath
- bvbbox 6 get size ne {
- gsave
- initgraphics
- scaling scaling scale
- 0 0 moveto
- (\357) false charpath flattenpath pathbbox 0 0 size bvbbox astore pop
- 0 1 idtransform dup mul exch dup mul add sqrt dup
- bvbbox 1 get add bvbbox 1 3 -1 roll put
- bvbbox 3 get exch sub bvbbox 3 3 -1 roll put
- bvbbox 2 get bvbbox 0 get sub bvbbox 4 3 -1 roll put
- bvbbox 2 get bvbbox 0 get add 2 div bvbbox 5 3 -1 roll put
- grestore
- } if
- bvbbox 2 get bvbbox 1 get moveto
- bvbbox 2 get bvbbox 3 get lineto
- bvbbox 5 get bvbbox 4 get 8 mul sub dup bvbbox 3 get lineto
- bvbbox 1 get lineto closepath clip newpath
- 0 0 moveto (\357) show
- bvbbox 5 get bvbbox 1 get moveto
- bvbbox 4 get dup dup
- 8 mul neg 0 rlineto
- 0 exch rlineto
- 8 mul 0 rlineto
- closepath clip eofill
- grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rh b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rh
deleted file mode 100644
index 5a929ef4ae..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/rh
+++ /dev/null
@@ -1,179 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/rh 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_rh {
-pop
-gsave
-size .0022 mul dup scale
-currentpoint translate
-
-15 66 moveto
-15 86 lineto
-16 131 lineto
-17 146 lineto
-18 158 lineto
-19 167 lineto
-21 181 lineto
-24 190 lineto
-34 193 lineto
-49 189 lineto
-58 182 lineto
-60 177 lineto
-60 166 lineto
-59 156 lineto
-58 143 lineto
-57 130 lineto
-56 117 lineto
-55 102 lineto
-54 42 lineto
-53 39 lineto
-49 35 lineto
-34 34 lineto
-19 39 lineto
-16 47 lineto
-15 66 lineto
-stroke
-
-65 60 moveto
-65 111 lineto
-66 127 lineto
-67 139 lineto
-69 153 lineto
-72 163 lineto
-83 171 lineto
-98 177 lineto
-113 182 lineto
-128 187 lineto
-143 190 lineto
-158 194 lineto
-173 196 lineto
-188 199 lineto
-203 201 lineto
-218 203 lineto
-233 205 lineto
-248 205 lineto
-263 206 lineto
-278 206 lineto
-293 206 lineto
-308 206 lineto
-323 206 lineto
-338 205 lineto
-353 203 lineto
-368 202 lineto
-383 200 lineto
-394 197 lineto
-389 190 lineto
-389 180 lineto
-391 176 lineto
-391 173 lineto
-380 173 lineto
-365 173 lineto
-350 174 lineto
-335 175 lineto
-320 176 lineto
-305 176 lineto
-290 176 lineto
-275 177 lineto
-260 177 lineto
-245 177 lineto
-240 173 lineto
-240 170 lineto
-245 165 lineto
-260 164 lineto
-275 164 lineto
-290 164 lineto
-305 163 lineto
-320 160 lineto
-327 155 lineto
-330 149 lineto
-330 134 lineto
-328 129 lineto
-323 124 lineto
-309 121 lineto
-294 121 lineto
-279 121 lineto
-264 121 lineto
-249 121 lineto
-234 121 lineto
-228 118 lineto
-228 112 lineto
-234 109 lineto
-249 109 lineto
-264 109 lineto
-279 108 lineto
-294 108 lineto
-306 104 lineto
-311 97 lineto
-312 91 lineto
-312 88 lineto
-311 82 lineto
-305 74 lineto
-290 72 lineto
-275 72 lineto
-260 72 lineto
-245 73 lineto
-230 73 lineto
-215 73 lineto
-205 70 lineto
-205 63 lineto
-217 60 lineto
-232 60 lineto
-247 60 lineto
-262 60 lineto
-277 57 lineto
-283 52 lineto
-285 44 lineto
-285 41 lineto
-284 35 lineto
-280 30 lineto
-268 26 lineto
-253 25 lineto
-238 26 lineto
-223 28 lineto
-208 31 lineto
-193 33 lineto
-178 34 lineto
-163 33 lineto
-148 31 lineto
-133 28 lineto
-118 27 lineto
-103 28 lineto
-88 34 lineto
-73 43 lineto
-67 52 lineto
-65 60 lineto
-stroke
-
-396 180 moveto
-396 188 lineto
-399 194 lineto
-410 196 lineto
-416 190 lineto
-416 180 lineto
-415 177 lineto
-411 173 lineto
-400 173 lineto
-396 180 lineto
-stroke
-
-grestore
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/sq b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/sq
deleted file mode 100644
index ed03e8baa7..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/sq
+++ /dev/null
@@ -1,34 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/sq 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_sq {
- pop
- size 2 div /side exch def
- currentpoint
- newpath
- moveto
- 0 side rlineto
- side 0 rlineto
- 0 side neg rlineto
- closepath
- font B eq {fill} {stroke} ifelse
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/~= b/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/~=
deleted file mode 100644
index 7b7a4d6c57..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/devpost/charlib/~=
+++ /dev/null
@@ -1,26 +0,0 @@
-%ident "@(#)lp:filter/postscript/font/devpost/charlib/~= 1.2"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-/build_~= {
- pop
- (\176) stringwidth pop neg size -.15 mul (\176\055) ashow
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/font/makedev.c b/usr/src/cmd/lp/filter/postscript/font/makedev.c
deleted file mode 100644
index 5e9212e71a..0000000000
--- a/usr/src/cmd/lp/filter/postscript/font/makedev.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/*
- * University Copyright- Copyright (c) 1982, 1986, 1988
- * The Regents of the University of California
- * All Rights Reserved
- *
- * University Acknowledgment- Portions of this document are derived from
- * software developed by the University of California, Berkeley, and its
- * contributors.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* Note added 9/25/83
- Setting the parameter biggestfont in the DESC file
- to be at least as big as the number of characters
- in the largest font for a particular device
- eliminates the "font X too big for position Y"
- message from troff.
- Thanks to Dave Stephens, WECo.
-*/
-/*
- makedev:
- read text info about a particular device
- (e.g., cat, 202, aps5) from file, convert
- it into internal (binary) form suitable for
- fast reading by troff initialization (ptinit()).
-
- Usage:
-
- makedev DESC [ F ... ]
- uses DESC to create a description file
- using the information therein.
- It creates the file DESC.out.
-
- makedev F ...
- makes the font tables for fonts F only,
- creates files F.out.
-
- DESC.out contains:
- dev structure with fundamental sizes
- list of sizes (nsizes+1) terminated by 0, as short's
- indices of char names (nchtab * sizeof(short))
- char names as hy\0em\0... (lchname)
- nfonts occurrences of
- widths (nwidth)
- kerning (nwidth) [ascender+descender only so far]
- codes (nwidth) to drive actual typesetter
- fitab (nchtab+128-32)
- each of these is an array of char.
-
- dev.filesize contains the number of bytes
- in the file, excluding the dev part itself.
-
- F.out contains the font header, width, kern, codes, and fitab.
- Width, kern and codes are parallel arrays.
- (Which suggests that they ought to be together?)
- Later, we might allow for codes which are actually
- sequences of formatting info so characters can be drawn.
-*/
-
-#include "stdio.h"
-#include "dev.h"
-
-#define BYTEMASK 0377
-#define skipline(f) while(getc(f) != '\n')
-
-struct dev dev;
-struct Font font;
-
-#define NSIZE 100 /* maximum number of sizes */
-short size[NSIZE];
-#define NCH 256 /* max number of characters with funny names */
-char chname[5*NCH]; /* character names, including \0 for each */
-short chtab[NCH]; /* index of character in chname */
-
-#define NFITAB (NCH + 128-32) /* includes ascii chars, but not non-graphics */
-char fitab[NFITAB]; /* font index table: position of char i on this font. */
- /* zero if not there */
-
-#define FSIZE 254 /* size of a physical font (e.g., 102 for cat) */
-char width[FSIZE]; /* width table for a physical font */
-char kern[FSIZE]; /* ascender+descender info */
-char code[FSIZE]; /* actual device codes for a physical font */
-#define BIGGESTFONT FSIZE /* biggest font if no size in DESC */
- /* MUST be < 256 */
-
-#define NFONT 50 /* max number of default fonts */
-char fname[NFONT][10]; /* temp space to hold default font names */
-
-int fflag = 0; /* on if font table to be written */
-int fdout; /* output file descriptor */
-char *fout = "DESC.out";
-
-static int dofont(char *);
-static int getlig(FILE *);
-
-int
-main(int argc, char *argv[])
-{
- FILE *fin;
- char cmd[100], *p;
- int i, totfont, v;
-
- if (argc < 2) {
- fprintf(stderr, "Usage: makedev [DESC] [fonts]\n");
- exit(1);
- }
- if ((fin = fopen("DESC", "r")) == NULL) {
- fprintf(stderr, "makedev: can't open DESC file\n");
- exit(1);
- }
- while (fscanf(fin, "%s", cmd) != EOF) {
- if (cmd[0] == '#') /* comment */
- skipline(fin);
- else if (strcmp(cmd, "res") == 0) {
- fscanf(fin, "%hd", &dev.res);
- } else if (strcmp(cmd, "hor") == 0) {
- fscanf(fin, "%hd", &dev.hor);
- } else if (strcmp(cmd, "vert") == 0) {
- fscanf(fin, "%hd", &dev.vert);
- } else if (strcmp(cmd, "unitwidth") == 0) {
- fscanf(fin, "%hd", &dev.unitwidth);
- } else if (strcmp(cmd, "sizescale") == 0) {
- fscanf(fin, "%hd", &dev.sizescale);
- } else if (strcmp(cmd, "paperwidth") == 0) {
- fscanf(fin, "%hd", &dev.paperwidth);
- } else if (strcmp(cmd, "paperlength") == 0) {
- fscanf(fin, "%hd", &dev.paperlength);
- } else if (strcmp(cmd, "biggestfont") == 0) {
- fscanf(fin, "%hd", &dev.biggestfont);
- } else if (strcmp(cmd, "spare2") == 0) {
- fscanf(fin, "%hd", &dev.spare2);
- } else if (strcmp(cmd, "sizes") == 0) {
- dev.nsizes = 0;
- while (fscanf(fin, "%d", &v) != EOF && v != 0)
- size[dev.nsizes++] = v;
- size[dev.nsizes] = 0; /* need an extra 0 at the end */
- } else if (strcmp(cmd, "fonts") == 0) {
- fscanf(fin, "%hd", &dev.nfonts);
- for (i = 0; i < dev.nfonts; i++)
- fscanf(fin, "%s", fname[i]);
- } else if (strcmp(cmd, "charset") == 0) {
- short pchname;
-
- p = chname;
- pchname = 0;
- dev.nchtab = 0;
- while (fscanf(fin, "%s", p) != EOF) {
- chtab[dev.nchtab++] = pchname;
- while (*p++) /* skip to end of name */
- pchname++;
- pchname++;
- }
- dev.lchname = pchname;
- chtab[dev.nchtab++] = 0; /* terminate properly */
- } else
- fprintf(stderr, "makedev: unknown command %s\n", cmd);
- }
- if (argc > 1 && strcmp(argv[1], "DESC") == 0) {
- fdout = creat(fout, 0666);
- if (fdout < 0) {
- fprintf(stderr, "makedev: can't open %s\n", fout);
- exit(1);
- }
- write(fdout, &dev, sizeof(struct dev));
- write(fdout, size, (dev.nsizes+1) * sizeof(size[0])); /* we need a 0 on the end */
- write(fdout, chtab, dev.nchtab * sizeof(chtab[0]));
- write(fdout, chname, dev.lchname);
- totfont = 0;
- for (i = 0; i < dev.nfonts; i++) {
- totfont += dofont(fname[i]);
- write(fdout, &font, sizeof(struct Font));
- write(fdout, width, font.nwfont & BYTEMASK);
- write(fdout, kern, font.nwfont & BYTEMASK);
- write(fdout, code, font.nwfont & BYTEMASK);
- write(fdout, fitab, dev.nchtab+128-32);
- }
- lseek(fdout, 0L, 0); /* back to beginning to install proper size */
- dev.filesize = /* excluding dev struct itself */
- (dev.nsizes+1) * sizeof(size[0])
- + dev.nchtab * sizeof(chtab[0])
- + dev.lchname * sizeof(char)
- + totfont * sizeof(char);
- write(fdout, &dev, sizeof(struct dev));
- close(fdout);
- argc--;
- argv++;
- }
- for (i = 1; i < argc; i++)
- dofont(argv[i]);
- return (0);
-}
-
-static int
-dofont(char *name) /* create fitab and width tab for font */
-{
- FILE *fin;
- int fdout;
- int i, nw, spacewidth, n, v;
- char buf[100], ch[10], s1[10], s2[10], s3[10], cmd[30];
-
- if ((fin = fopen(name, "r")) == NULL) {
- fprintf(stderr, "makedev: can't open font %s\n", name);
- exit(2);
- }
- sprintf(cmd, "%s.out", name);
- fdout = creat(cmd, 0666);
- if (fdout < 0) {
- fprintf(stderr, "makedev: can't open %s\n", fout);
- exit(1);
- }
- for (i = 0; i < NFITAB; i++)
- fitab[i] = 0;
- for (i = 0; i < FSIZE; i++)
- width[i] = kern[i] = code[i] = 0;
- font.specfont = font.ligfont = spacewidth = 0;
- while (fscanf(fin, "%s", cmd) != EOF) {
- if (cmd[0] == '#')
- skipline(fin);
- else if (strcmp(cmd, "name") == 0)
- fscanf(fin, "%s", font.namefont);
- else if (strcmp(cmd, "internalname") == 0)
- fscanf(fin, "%s", font.intname);
- else if (strcmp(cmd, "special") == 0)
- font.specfont = 1;
- else if (strcmp(cmd, "spare1") == 0)
- fscanf(fin, "%1s", &font.spare1);
- else if (strcmp(cmd, "ligatures") == 0) {
- font.ligfont = getlig(fin);
- } else if (strcmp(cmd, "spacewidth") == 0) {
- fscanf(fin, "%d", &spacewidth);
- width[0] = spacewidth; /* width of space on this font */
- } else if (strcmp(cmd, "charset") == 0) {
- skipline(fin);
- nw = 0;
- /* widths are origin 1 so fitab==0 can mean "not there" */
- while (fgets(buf, 100, fin) != NULL) {
- sscanf(buf, "%s %s %s %s", ch, s1, s2, s3);
- if (s1[0] != '"') { /* it's a genuine new character */
- nw++;
- width[nw] = atoi(s1);
- kern[nw] = atoi(s2);
- /* temporarily, pick up one byte as code */
- if (s3[0] == '0')
- sscanf(s3, "%o", &i);
- else
- sscanf(s3, "%d", &i);
- code[nw] = i;
- }
- /* otherwise it's a synonym for previous character,
- * so leave previous values intact
- */
- if (strlen(ch) == 1) /* it's ascii */
- fitab[ch[0] - 32] = nw; /* fitab origin omits non-graphics */
- else if (strcmp(ch, "---") != 0) { /* it has a 2-char name */
- for (i = 0; i < dev.nchtab; i++)
- if (strcmp(&chname[chtab[i]], ch) == 0) {
- fitab[i + 128-32] = nw; /* starts after the ascii */
- break;
- }
- if (i >= dev.nchtab)
- fprintf(stderr, "makedev: font %s: %s not in charset\n", name, ch);
- }
- }
- nw++;
- if (dev.biggestfont > 0)
- n = dev.biggestfont + 1;
- else
- n = BIGGESTFONT;
- /*
- * Make files at least as big as biggestfont. Larger fonts
- * may only fit in postion 0.
- */
- if ( nw > n ) {
- n = nw;
- fprintf(stderr, "makedev: warning font %s may only fit in position 0\n", font.namefont);
- }
- if (n >= NCH) {
- fprintf(stderr, "makedev: font has %d characters, too big\n", n);
- exit(2);
- }
- font.nwfont = n;
- }
- }
- if (spacewidth == 0)
- width[0] = dev.res * dev.unitwidth / 72 / 3; /* should be rounded */
- fclose(fin);
-
- write(fdout, &font, sizeof(struct Font));
- write(fdout, width, font.nwfont & BYTEMASK);
- write(fdout, kern, font.nwfont & BYTEMASK);
- write(fdout, code, font.nwfont & BYTEMASK);
- write(fdout, fitab, dev.nchtab+128-32);
- close(fdout);
- v = sizeof(struct Font) + 3 * n + dev.nchtab + 128-32;
- fprintf(stderr, "%3s: %3d chars, width %3d, size %3d\n",
- font.namefont, nw, width[0], v);
- return (v);
-}
-
-static int
-getlig(FILE *fin) /* pick up ligature list */
-{
- int lig;
- char temp[100];
-
- lig = 0;
- while (fscanf(fin, "%s", temp) != EOF && strcmp(temp, "0") != 0) {
- if (strcmp(temp, "fi") == 0)
- lig |= LFI;
- else if (strcmp(temp, "fl") == 0)
- lig |= LFL;
- else if (strcmp(temp, "ff") == 0)
- lig |= LFF;
- else if (strcmp(temp, "ffi") == 0)
- lig |= LFFI;
- else if (strcmp(temp, "ffl") == 0)
- lig |= LFFL;
- else
- fprintf(stderr, "illegal ligature %s\n", temp);
- }
- skipline(fin);
- return (lig);
-}
diff --git a/usr/src/cmd/lp/filter/postscript/postcomm/postcomm.c b/usr/src/cmd/lp/filter/postscript/postcomm/postcomm.c
deleted file mode 100644
index dde1e97e9f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postcomm/postcomm.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * A simple program that can be used to filter jobs for PostScript
- * printers. It's a cleaned up version of usg_iox, that I assume was
- * written by Richard Flood. The most important addition includes some
- * simple processing of printer status reports, usually obtained when
- * \024 is sent to the printer. The returned status lines look like:
- *
- *
- * %%[ status: idle; source serial 25 ]%%
- * %%[ status: waiting; source serial 25 ]%%
- * %%[ status: initializing; source serial 25 ]%%
- * %%[ status: busy; source serial 25 ]%%
- * %%[ status: printing; source serial 25 ]%%
- * %%[ status: PrinterError: out of paper; source serial 25 ]%%
- * %%[ status: PrinterError: no paper tray; source serial 25 ]%%
- *
- *
- * although the list isn't meant to be complete.
- *
- * Other changes to the original program include the addition of
- * options that let you select the tty line, baud rate, and printer
- * log file. The program seems to work reasonably well, at least for
- * our QMS PS-800 printer, but could still use some work.
- *
- * There were a couple of serious mistakes in the first few versions of
- * postcomm. Both were made in setting up flow control in routine
- * initialize(). Setting the IXANY flag in c_iflag was wrong, and
- * often caused problems when the printer transmitted a spontaneous
- * status report, which always happens when the paper runs out.
- * Things were kludged up to get around the problems, but they were
- * never exactly right, and probably could never be guaranteed to work
- * 100%.
- *
- * The other mistake was setting the IXOFF flag, again in c_iflag.
- * Although I never saw deadlock in the original versions of postcomm,
- * it could happen. Apparently the IXANY and IXOFF flags combined to
- * make that an unlikely event. Anyway both flags should normally be
- * turned off to ensure reliable transmission of jobs.
- *
- * The implications of only setting IXON are obvious. Job transmission
- * should be reliable, but data returned by the printer over the tty
- * line may get lost. That won't cause problems in postcomm, but there
- * may be occasions when you want to run a job and recover data
- * generated by the printer. The -t option sets the IXOFF, IXANY, and
- * IXON flags in c_iflag and causes send() to be far more careful about
- * when data is sent to the printer. In addition anything not
- * recognized as a status report is written on stdout. It seems to
- * work reasonably well, but it's slow and may hang or have flow
- * control problems. Only use the -t option when it's absolutely
- * necessary. A small block size, like 512, should also help.
- *
- * Using two processes, one for reads and the other for writes, may
- * eventually be needed. For now postcomm seems to do a good job
- * transmitting data, and the -t option is probably acceptable for
- * those few jobs that need to recover data from the printer.
- *
- * A typical command line might be:
- *
- * postcomm -L log -t <file1 > device
- *
- * where -L selects the printer log file and -t sends data from the
- * printer out to the printer. If you don't choose a log file stderr
- * will be used and the information mailed or written to you.
- *
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-
-
-# define OFF 0
-# define ON 1
-# define TRUE 1
-# define FALSE 0
-# define FATAL 1
-# define NON_FATAL 0
-
-#include "postcomm.h" /* some special definitions */
-
-
-char *prog_name = "postcomm"; /* just for error messages */
-
-int debug = OFF; /* debug flag */
-int ignore = OFF; /* what's done for FATAL errors */
-
-
-char *block = NULL; /* input file buffer */
-int blocksize = BLOCKSIZE; /* and its size in bytes */
-int head = 0; /* block[head] is the next character */
-int tail = 0; /* one past the last byte in block[] */
-
-char mesg[BUFSIZE]; /* exactly what came back on ttyi */
-char sbuf[BUFSIZE]; /* for parsing the message */
-int next = 0; /* next character goes in sbuf[next] */
-Status status[] = STATUS; /* for converting status strings */
-
-int stopbits = 1; /* number of stop bits */
-int tostdout = FALSE; /* non-status stuff goes to stdout? */
-int curfile = 0; /* only needed when tostdout is TRUE */
-
-char *postbegin = POSTBEGIN; /* preceeds all the input files */
-
-int ttyi; /* input */
-int ttyo = 2; /* and output file descriptors */
-
-FILE *fp_log = stderr; /* log file for data from the printer */
-
-
-
-static void filter(void);
-static int getstatus(int);
-static void initialize(void);
-static void options(int, char *[]);
-static int readblock(int);
-static int readline(void);
-static void reset(void);
-static int writeblock(void);
-
-void
-logit(char *mesg, ...)
-{
-
-/*
- *
- * Simple routine that's used to write a message to the log file.
- *
- */
-
-
- if (mesg != NULL)
- {
- va_list ap;
-
- va_start(ap, mesg);
- vfprintf(fp_log, mesg, ap);
- va_end(ap);
- fflush(fp_log);
- }
-
-} /* End of logit */
-
-
-
-
-
-void
-error(int kind, char *mesg, ...)
-{
-
-
-/*
- *
- * Called when we've run into some kind of program error. First *mesg is
- * printed using the control string arguments a?. Then if kind is FATAL
- * and we're not ignoring errors the program will be terminated.
- *
- * If mesg is NULL or *mesg is the NULL string nothing will be printed.
- *
- */
-
-
- if ( mesg != NULL && *mesg != '\0' ) {
- va_list ap;
-
- fprintf(fp_log, "%s: ", prog_name);
- va_start(ap, mesg);
- vfprintf(fp_log, mesg, ap);
- va_end(ap);
- putc('\n', fp_log);
- } /* End if */
-
- if ( kind == FATAL && ignore == OFF ) {
- write(ttyo, "\003\004", 2);
- exit(1);
- } /* End if */
-
-} /* End of error */
-
-
-
-
-
-int
-main(int argc, char *argv[])
-{
-
-/*
- *
- * A simple program that manages input and output for PostScript
- * printers. If you're sending a PostScript program that will be
- * returning useful information add the -ot option to the lp(1) command
- * line. Everything not recognized as a printer status report will go
- * to stdout. The -ot option should only be used when needed! It's slow
- * and doesn't use flow control properly, but it's probably the best
- * that can be done using a single process for reading and writing.
- */
-
- prog_name = argv[0]; /* really just for error messages */
-
- options(argc, argv);
-
- initialize(); /* Set printer up for printing */
-
- filter();
-
- reset(); /* wait 'til it's finished & reset it*/
-
- return (0); /* everything probably went OK */
-
-} /* End of main */
-
-
-
-
-
-static void
-options(int argc, char *argv[])
-{
-
-
- int ch; /* return value from getopt() */
- char *names = "tB:L:P:DI";
-
- extern char *optarg; /* used by getopt() */
-
-/*
- *
- * Reads and processes the command line options. The -t option should
- * only be used when absolutely necessary. It's slow and doesn't do
- * flow control properly. Selecting a small block size (eg. 512 or
- * less) with with the -B option may help when you need the -t option.
- *
- */
-
-
- while ( (ch = getopt(argc, argv, names)) != EOF )
- {
- switch ( ch )
- {
- case 't': /* non-status stuff goes to stdout */
- tostdout = TRUE;
- break;
-
- case 'B': /* set the job buffer size */
- if ((blocksize = atoi(optarg)) <= 0)
- blocksize = BLOCKSIZE;
- break;
-
- case 'L': /* printer log file */
- if ((fp_log = fopen(optarg, "w")) == NULL)
- {
- fp_log = stderr;
- error(NON_FATAL, "can't open log file %s",
- optarg);
- } /* End if */
- break;
-
- case 'P': /* initial PostScript program */
- postbegin = optarg;
- break;
-
- case 'D': /* debug flag */
- debug = ON;
- break;
-
- case 'I': /* ignore FATAL errors */
- ignore = ON;
- break;
-
- case '?': /* don't understand the option */
- error(FATAL, "");
- break;
-
- default: /* don't know what to do for ch */
- error(FATAL, "missing case for option %c\n", ch);
- break;
-
- } /* End switch */
-
- } /* End while */
-} /* End of options */
-
-
-
-
-
-static void
-initialize(void)
-{
- if ((block = malloc(blocksize)) == NULL)
- error(FATAL, "no memory");
-
- ttyi = fileno(stdout);
-
- if ((ttyo = dup(ttyi)) == -1)
- error(FATAL, "can't dup file descriptor for stdout");
-
-/*
- *
- * Makes sure the printer is in the
- * IDLE state before any real data is sent.
- *
- */
-
-
- logit("printer startup\n");
-
- while ( 1 )
- switch (getstatus(1))
- {
- case IDLE:
- if (postbegin != NULL)
- write(ttyo, postbegin, strlen(postbegin));
- else
- write(ttyo, "\n", 1);
- return;
-
- case WAITING:
- case BUSY:
- case ERROR:
- write(ttyo, "\003\004", 2);
- sleep(1);
- break;
-
- case FLUSHING:
- write(ttyo, "\004", 1);
- sleep(1);
- break;
-
- case PRINTERERROR:
- case INITIALIZING:
- sleep(15);
- break;
-
- case DISCONNECT:
- /* talk to spooler w/S_FAULT_ALERT */
- error(FATAL, "printer appears to be offline");
- break;
-
- default:
- sleep(1);
- break;
-
- } /* End switch */
-
-} /* End of initialize */
-
-
-
-
-
-static void
-filter(void)
-{
- static int wflag = 0; /* nonzero if we've written a block */
- int fd_in = fileno(stdin);
-
-/*
- *
- * Responsible for sending the next file to the printer.
- * Most of the hard stuff is done in getstatus() and readline().
- * All this routine really does is control what happens for the
- * different printer states.
- *
- */
-
-
- logit("sending file\n");
-
- curfile++;
-
- while (readblock(fd_in))
- switch (getstatus(0))
- {
- case WAITING:
- writeblock();
- wflag = 1;
- break;
-
- case BUSY:
- case PRINTING:
- case PRINTERERROR:
- if (tostdout == FALSE)
- {
- writeblock();
- wflag = 1;
- }
- else
- sleep(1);
- break;
-
- case UNKNOWN:
- if (tostdout == FALSE)
- {
- writeblock();
- wflag = 1;
- }
- break;
-
- case NOSTATUS:
- if (tostdout == FALSE)
- {
- if (wflag)
- writeblock();
- }
- else
- sleep(1);
- break;
-
- case IDLE:
- if (wflag)
- error(FATAL, "printer is idle");
- write(ttyo, "\n", 1);
- break;
-
- case ERROR:
- fprintf(stderr, "%s", mesg); /* for csw */
- error(FATAL, "PostScript error");
- break;
-
- case FLUSHING:
- error(FATAL, "PostScript error");
- break;
-
- case INITIALIZING:
- error(FATAL, "printer booting");
- break;
-
- case DISCONNECT:
- error(FATAL, "printer appears to be offline");
- break;
-
- } /* End switch */
-
-} /* End of print */
-
-
-
-
-
-static int
-readblock(int fd_in)
- /* current input file */
-{
-
-/*
- *
- * Fills the input buffer with the next block, provided we're all done
- * with the last one. Blocks from fd_in are stored in array block[].
- * Head is the index of the next byte in block[] that's supposed to go
- * to the printer. tail points one past the last byte in the current
- * block. head is adjusted in writeblock() after each successful
- * write, while head and tail are reset here each time a new block is
- * read. Returns the number of bytes left in the current block. Read
- * errors cause the program to abort.
- *
- */
-
- if (head >= tail)
- { /* done with the last block */
- if ((tail = read(fd_in, block, blocksize)) == -1)
- error(FATAL, "error reading input file");
- head = 0;
- }
-
- return(tail - head);
-
-} /* End of readblock */
-
-
-
-
-
-static int
-writeblock(void)
-{
- int count; /* bytes successfully written */
-
-/*
- *
- * Called from send() when it's OK to send the next block to the
- * printer. head is adjusted after the write, and the number of bytes
- * that were successfully written is returned to the caller.
- *
- */
-
-
- if ((count = write(ttyo, &block[head], tail - head)) == -1)
- error(FATAL, "error writing to stdout");
- else
- if (count == 0)
- error(FATAL, "printer appears to be offline");
-
- head += count;
- return(count);
-} /* End of writeblock */
-
-
-
-
-
-static int
-getstatus(int t)
- /* sleep time after sending '\024' */
-{
- char *state; /* new printer state - from sbuf[] */
- int i; /* index of new state in status[] */
- static int laststate = NOSTATUS;
- /* last state we found out about */
-
-/*
- *
- * Sends a status request to the printer and tries to read the response.
- * If an entire line is available readline() returns TRUE and the
- * string in sbuf[] is parsed and converted into an integer code that
- * represents the printer's state. If readline() returns FALSE,
- * meaning an entire line wasn't available, NOSTATUS is returned.
- *
- */
-
- if (readline() == TRUE)
- {
- state = sbuf;
-
- if (strncmp(sbuf, "%%[", 3) == 0)
- {
- strtok(sbuf, " "); /* skip the leading "%%[ " */
- if (strcmp(state = strtok(NULL, " :;"), "status") == 0)
- state = strtok(NULL, " :;");
- }
-
- for (i = 0; status[i].state != NULL; i++)
- if (strcmp(state, status[i].state) == 0)
- break;
-
- if (status[i].val != laststate || debug == ON)
- logit("%s", mesg);
-
- if (tostdout == TRUE && status[i].val == UNKNOWN && curfile > 0)
- fprintf(stdout, "%s", mesg);
-
- return(laststate = status[i].val);
- } /* End if */
-
- if ( write(ttyo, "\024", 1) != 1 )
- error(FATAL, "printer appears to be offline");
-
- if ( t > 0 )
- sleep(t);
-
- return(NOSTATUS);
-
-} /* End of getstatus */
-
-
-
-
-
-static void
-reset(void)
-{
- int sleeptime = 15; /* for 'out of paper' etc. */
- int senteof = FALSE;
-
-/*
- *
- * We're all done sending the input files, so we'll send an EOF to the
- * printer and wait until it tells us it's done.
- *
- */
-
-
- logit("waiting for end of job\n");
-
- while (1)
- {
- switch (getstatus(2))
- {
- case WAITING:
- write(ttyo, "\004", 1);
- senteof = TRUE;
- sleeptime = 15;
- break;
-
- case ENDOFJOB:
- if (senteof == TRUE)
- {
- logit("job complete\n");
- return;
- }
- sleeptime = 15;
- break;
-
- case BUSY:
- case PRINTING:
- sleeptime = 15;
- sleep(1);
- break;
-
- case PRINTERERROR:
- sleep(sleeptime++);
- break;
-
- case ERROR:
- fprintf(stderr, "%s", mesg); /* for csw */
- error(FATAL, "PostScript error");
- return;
-
- case FLUSHING:
- error(FATAL, "PostScript error");
- return;
-
- case IDLE:
- error(FATAL, "printer is idle");
- return;
-
- case INITIALIZING:
- error(FATAL, "printer booting");
- return;
-
- case DISCONNECT:
- error(FATAL, "printer appears to be offline");
- return;
-
- default:
- sleep(1);
- break;
-
- } /* End switch */
-
- if (sleeptime > 60)
- sleeptime = 60;
-
- } /* End while */
-
-} /* End of reset */
-
-
-
-
-
-
-
-
-
-static int
-readline(void)
-{
- char ch; /* next character from ttyi */
- int n; /* read() return value */
-
-/*
- *
- * Reads the printer's tty line up to a newline (or EOF) or until no
- * more characters are available. As characters are read they're
- * converted to lower case and put in sbuf[next] until a newline (or
- * EOF) are found. The string is then terminated with '\0', next is
- * reset to zero, and TRUE is returned.
- *
- */
-
-
- while ((n = read(ttyi, &ch, 1)) != 0)
- {
- if (n < 0)
- error(FATAL, "error reading stdout");
- mesg[next] = ch;
- sbuf[next++] = tolower(ch);
- if (ch == '\n' || ch == '\004')
- {
- mesg[next] = sbuf[next] = '\0';
- if (ch == '\004')
- sprintf(sbuf, "%%%%[ status: endofjob ]%%%%\n");
- next = 0;
- return(TRUE);
- } /* End if */
- } /* End while */
-
- return(FALSE);
-
-} /* End of readline */
diff --git a/usr/src/cmd/lp/filter/postscript/postcomm/postcomm.h b/usr/src/cmd/lp/filter/postscript/postcomm/postcomm.h
deleted file mode 100644
index 9a26fff546..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postcomm/postcomm.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- *
- * A few special definitions used by the program that sends jobs to PostScript
- * printers. Most, if not all the testing, was done on a QMS PS-800 printer.
- *
- * POSTBEGIN, if it's not NULL, is some PostScript code that's sent to the
- * printer before any of the input files. It's not terribly important since the
- * same thing can be accomplished in other ways, but it is convenient. POSTBEGIN
- * is initialized so as to disable job timeouts. The string can also be set on
- * the command line using the -P option.
- *
- */
-
-
-#define POSTBEGIN "statusdict /waittimeout 0 put\n"
-
-
-/*
- *
- * Status lines returned by the printer usually look like,
- *
- *
- * %%[ status: idle; source serial 25 ]%%
- * %%[ status: waiting; source serial 25 ]%%
- * %%[ status: initializing; source serial 25 ]%%
- * %%[ status: busy; source serial 25 ]%%
- * %%[ status: printing; source serial 25 ]%%
- * %%[ status: PrinterError: out of paper; source serial 25 ]%%
- * %%[ status: PrinterError: no paper tray; source serial 25 ]%%
- *
- *
- * although the list isn't meant to be complete.
- *
- * The following constants are used to classify some of the different printer
- * states. readline() reads status lines from ttyi and converts everything to
- * lower case. getstatus() interprets the text that readline() stores in sbuf[]
- * and returns integer codes that classify the printer status. Those codes are
- * used in routines start(), send(), and done() to figure out what's happening
- * and what should be done next.
- *
- */
-
-
-#define WAITING 0 /* printer wants more data */
-#define BUSY 1 /* processing data already sent */
-#define PRINTING 2 /* printing a page */
-#define IDLE 3 /* ready to start the next job */
-#define ENDOFJOB 4 /* readline() builds this up on EOF */
-#define PRINTERERROR 5 /* PrinterError - eg. out of paper */
-#define ERROR 6 /* some kind of PostScript problem */
-#define FLUSHING 7 /* throwing out the rest of the job */
-#define INITIALIZING 8 /* printer's booting */
-#define DISCONNECT 9 /* from Datakit */
-#define UNKNOWN 10 /* in case we missed anything */
-#define NOSTATUS 11 /* no response from the printer */
-
-
-/*
- *
- * An array of type Status is used, in getstatus(), to figure out the printer's
- * current state. Just helps convert strings representing the current state into
- * integer codes that other routines use.
- *
- */
-
-
-typedef struct {
-
- char *state; /* printer's current status */
- int val; /* value returned by getstatus() */
-
-} Status;
-
-
-/*
- *
- * STATUS is used to initialize an array of type Status that translates the
- * ASCII strings returned by the printer into appropriate codes that can be used
- * later on in the program. State strings should all be entered in lower case.
- * readline() converts characters to lower before adding them to sbuf[]. If you
- * add any states, do it in lower case only, and be sure to add the new status
- * descriptions before the UNKNOWN entry. The lookup in getstatus() terminates
- * when it finds the printer state or encounters an entry with NULL in the state
- * field.
- *
- */
-
-
-#define STATUS \
- \
- { \
- "waiting", WAITING, \
- "busy", BUSY, \
- "printing", PRINTING, \
- "idle", IDLE, \
- "endofjob", ENDOFJOB, \
- "printererror", PRINTERERROR, \
- "error", ERROR, \
- "flushing", FLUSHING, \
- "initializing", INITIALIZING, \
- "conversation ended.\n", DISCONNECT, \
- NULL, UNKNOWN \
- }
-
-
-/*
- *
- * The baud rate can be set on the command line using the -b option. If you omit
- * it BAUDRATE will be used.
- *
- */
-
-
-#define BAUDRATE B9600
-
-
-/*
- *
- * An array of type Baud is used, in routine getbaud(), to translate ASCII
- * strings into termio values that represent the requested baud rate.
- *
- */
-
-
-typedef struct {
-
- char *rate; /* string identifying the baud rate */
- short val; /* and its termio.h value */
-
-} Baud;
-
-
-/*
- *
- * BAUDTABLE initializes the array that's used to translate baud rate requests
- * into termio values. It needs to end with an entry that has NULL assigned to
- * the rate field.
- *
- */
-
-
-#define BAUDTABLE \
- \
- { \
- "9600", B9600, \
- "B9600", B9600, \
- "19200", EXTA, \
- "19.2", EXTA, \
- "B19200", EXTA, \
- "EXTA", EXTA, \
- "1200", B1200, \
- "B1200", B1200, \
- "B4800", B4800, \
- "4800", B4800, \
- NULL, B9600 \
- }
-
-
-/*
- *
- * A few miscellaneous definitions. BLOCKSIZE is the default size of the buffer
- * used for reading the input files (changed with the -B option). BUFSIZE is
- * the size of the character array used to store printer status lines - don't
- * make it too small!
- *
- */
-
-
-#define BLOCKSIZE 1024
-#define BUFSIZE 512
-
-
-/*
- *
- * Finally we'll declare a few of the non-integer valued functions used in
- * postio.c.
- *
- */
-
-
-char *malloc();
-char *strtok();
-
-
diff --git a/usr/src/cmd/lp/filter/postscript/postio/Makefile b/usr/src/cmd/lp/filter/postscript/postio/Makefile
deleted file mode 100644
index 5bc75cb6a1..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postio/Makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/postio/Makefile
-#
-
-include ../../../Makefile.lp
-
-COMMONDIR= ../common
-
-PROG= postio
-
-SRCS= postio.c ifdef.c slowsend.c parallel.c
-
-OBJS = $(SRCS:%.c=%.o)
-
-TXTS= README
-
-ENCODING= 2
-CPPFLAGS = -DDFLTENCODING=$(ENCODING) \
- -DSYSV \
- -I. -I$(COMMONDIR) \
- $(CPPFLAGS.master)
-
-POFILE = lp_filter_postscript_postio.po
-
-.KEEP_STATE:
-
-all: $(TXTS) $(PROG)
-
-install: all $(ROOTLIBLPPOSTPROG)
-
-$(PROG): $(OBJS)
- $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-clean :
- $(RM) $(OBJS)
-
-strip:
- $(STRIP) $(PROG)
-
-lint: lint_SRCS
-
-include ../../../../Makefile.targ
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/filter/postscript/postio/README b/usr/src/cmd/lp/filter/postscript/postio/README
deleted file mode 100644
index 9afc7f95fa..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postio/README
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-Source code in this directory is for the program that can be used to send files
-to printers that understand PostScript.
-
-I've added code that lets you split the program into separate read and write
-processes (the -R2 option), supports an interactive mode (-i option), suppresses
-status queries while the files are being transmitted to the printer (-q option),
-and runs in a mode that can help if flow control doesn't appear to be working
-properly (-S option). All the options are described in the man page. In addition
-The parsing of lines returned by the printer has been improved and should do a
-decent job with anything that comes its way.
-
-By default the program runs much like the original version - a single process with
-status queries sent every block or two. It's not how to get the best performance,
-but using a single read/write process may be important if you're running lots of
-printers under a single userid. Four things can help improve performance, and all
-can be set by command line options:
-
- 1: Use separate read and write processes. The -R2 option gets it or if you want
- it as the default initialize splitme (near line 132 in postio.c) to TRUE before
- compiling postio.
-
- 2: Use a large input buffer. The default size is 2048 bytes, but it can be set
- to whatever you want on the command line using the -B option. If you want a
- larger default buffer change the definition of BLOCKSIZE (near line 204 in
- postio.h) before you compile postio.
-
- 3: Quiet mode prevents the transmission of status requests (ie. ^Ts) while files
- are being sent to the printer. You can turn off the status query stuff with
- the -q option or if you want it as the default initialize quiet (near line 122
- in postio.c) to TRUE before compiling the program.
-
- 4: Avoid using the -S option. It's real slow and I thought some about leaving it
- out, but it's needed at a few sites. Seems to help most with printers connected
- to UTS systems using DACUs and Datakit PVCs.
-
-One possible strategy would be to have the spooler run postio as a single process
-on all small printers (eg. LaserWriters or PS-800s) and use two processes on faster
-printers like the DataProducts 2665 or QMS PS-2400.
-
-A typical command line might look something like,
-
- postio -l /dev/tty?? -b 9600 -L log file1 file2 file3
-
-where /dev/tty?? is the line that's connected to the printer, 9600 (or B9600) is
-the baud rate, and log is a file used to record printer status. You should always
-use the -l option to select the printer line, and if you don't choose a log file
-everything coming back from the printer goes to stderr. The following command line
-accomplishes the same thing, but runs postio as separate read and write processes,
-
- postio -R2 -l/dev/tty?? -b9600 -Llog file1 file2 file3
-
-Check the man page for more examples.
-
diff --git a/usr/src/cmd/lp/filter/postscript/postio/ifdef.c b/usr/src/cmd/lp/filter/postscript/postio/ifdef.c
deleted file mode 100644
index 6ca546cb9f..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postio/ifdef.c
+++ /dev/null
@@ -1,967 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/*
- *
- * Conditionally compiled routines for setting up and reading the line. Things
- * were getting out of hand with all the ifdefs, and even though this defeats
- * part of the purpose of conditional complilation directives, I think it's easier
- * to follow this way. Thanks to Alan Buckwalter for the System V DKHOST code.
- *
- * postio now can be run as separate read and write processes, but requires that
- * you write a procedure called resetline() and perhaps modify readline() some.
- * I've already tested the code on System V and it seems to work. Ninth Edition
- * and BSD code may be missing.
- *
- * By request I've changed the way some of the setupline() procedures (eg. in the
- * System V implementation) handle things when no line has been given. If line is
- * NULL the new setupline() procedures try to continue, assuming whoever called
- * postio connected stdout to the printer. Things will only work if we can read
- * and write stdout!
- *
- */
-
-
-#include <stdio.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <errno.h>
-
-#include "ifdef.h" /* conditional header file inclusion */
-#include "gen.h" /* general purpose definitions */
-
-FILE *fp_ttyi = NULL, *fp_ttyo;
-char *ptr = mesg;
-extern FILE *fp_log;
-
-
-/*****************************************************************************/
-
-
-#ifdef SYSV
-void
-setupline(void)
-{
- struct termio termio;
- struct termios termios;
- char buf[100];
-
-
-/*
- *
- * Line initialization for SYSV. For now if no line is given (ie. line == NULL )
- * we continue on as before using stdout as ttyi and ttyo. Doesn't work when we're
- * running in interactive mode or forcing stuff that comes back from the printer
- * to stdout. Both cases are now caught by a test that's been added to routine
- * initialize(). The change is primarily for the version of lp that's available
- * with SVR3.2.
- *
- */
-
-#ifdef DKHOST
- if ( line != NULL && *line != '/' ) {
- if ( strncmp(line, "DK:", 3) == 0 )
- line += 3;
- dkhost_connect();
- } else
-#endif
-
- if ( line == NULL ) {
- ttyi = fileno(stdout);
- }
- else if ( (ttyi = open(line, O_RDWR)) == -1 )
- error(FATAL, "can't open %s", line);
-
- if ( (ttyo = dup(ttyi)) == -1 ) {
- error(FATAL, "can't dup file descriptor for %s", line);
- }
-
- if ( fcntl(ttyi, F_SETFL, O_NDELAY) == -1 ) {
- error(FATAL, "fcntl error - F_SETFL");
- }
-
- if ( ioctl(ttyi, TCGETS, &termios) < 0 ) {
- if ( ioctl(ttyi, TCGETA, &termio) == -1 ) {
- error(FATAL, "ioctl error - TCGETA");
- }
- stopbits = (stopbits == 1) ? 0 : CSTOPB;
-
- termio.c_iflag = IXON | IGNCR;
- termio.c_oflag = 0;
- termio.c_cflag = HUPCL | CREAD | CS8 | stopbits |
- ((line != NULL) ? baudrate : (termio.c_cflag & CBAUD));
- termio.c_lflag = 0;
- termio.c_cc[VMIN] = termio.c_cc[VTIME] = 0;
- if ( ioctl(ttyi, TCSETA, &termio) == -1 ) {
- error(FATAL, "ioctl error - TCSETA");
- }
- } else {
- stopbits = (stopbits == 1) ? 0 : CSTOPB;
-
- termios.c_iflag = IXON | IGNCR;
- termios.c_oflag = 0;
- termios.c_cflag = HUPCL | CREAD | CS8 | stopbits |
- ((line != NULL) ? baudrate : cfgetospeed(&termios));
- termios.c_lflag = 0;
- termios.c_cc[VMIN] = termios.c_cc[VTIME] = 0;
- if ( ioctl(ttyi, TCSETS, &termios) == -1 ) {
- error(FATAL, "ioctl error - TCSETS");
- }
- }
-
- if ( ioctl(ttyi, TCFLSH, 2) == -1 ) {
- error(FATAL, "ioctl error - TCFLSH");
- }
- fp_ttyi = fdopen(ttyi, "r");
-
- if ( line == NULL ) {
- line = "stdout";
- }
-
-} /* End of setupline */
-
-
-/*****************************************************************************/
-
-
-int
-resetline(void)
-{
-
-
- int flags; /* for turning O_NDELAY off */
- struct termio termio; /* so we can reset flow control */
-
-
-/*
- *
- * Only used if we're running the program as separate read and write processes.
- * Called from split() after the initial connection has been made and returns
- * TRUE if two processes should work. Don't know if the O_NDELAY stuff is really
- * needed, but setting c_cc[VMIN] to 1 definitely is. If we leave it be (as a 0)
- * the read in readline() won't block!
- *
- */
-
-
- if ( (flags = fcntl(ttyi, F_GETFL, 0)) == -1 )
- error(FATAL, "fcntl error - F_GETFL");
-
- flags &= ~O_NDELAY;
-
- if ( fcntl(ttyi, F_SETFL, flags) == -1 )
- error(FATAL, "fcntl error - F_SETFL");
-
- if ( ioctl(ttyi, TCGETA, &termio) == -1 )
- error(FATAL, "ioctl error - TCGETA");
-
- termio.c_iflag &= ~IXANY;
- termio.c_iflag |= IXON | IXOFF;
- termio.c_cc[VMIN] = 1;
- termio.c_cc[VTIME] = 0;
-
- if ( ioctl(ttyi, TCSETA, &termio) == -1 )
- error(FATAL, "ioctl error - TCSETA");
-
- return(TRUE);
-
-} /* End of resetline */
-
-
-/*****************************************************************************/
-
-
-void
-setupstdin(int mode)
- /* what to do with stdin settings */
-{
- struct termio termio;
-
- static int saved = FALSE;
- static struct termio oldtermio;
-
-
-/*
- *
- * Save (mode = 0), reset (mode = 1), or restore (mode = 2) the tty settings for
- * stdin. Expect something like raw mode with no echo will be set up. Explicit
- * code to ensure blocking reads probably isn't needed because blocksize is set
- * to 1 when we're in interactive mode, but I've included it anyway.
- *
- */
-
-
- if ( interactive == TRUE )
- switch ( mode ) {
- case 0:
- if ( isatty(0) != 1 )
- error(FATAL, "stdin not a terminal - can't run interactive mode");
- if ( ioctl(0, TCGETA, &oldtermio) == -1 )
- error(FATAL, "can't save terminal settings");
- saved = TRUE;
- break;
-
- case 1:
- termio = oldtermio;
- termio.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL);
- termio.c_cc[VMIN] = 1;
- termio.c_cc[VTIME] = 0;
- ioctl(0, TCSETA, &termio);
- break;
-
- case 2:
- if ( saved == TRUE )
- ioctl(0, TCSETA, &oldtermio);
- break;
- } /* End switch */
-
-} /* End of setupstdin */
-
-
-/*****************************************************************************/
-
-
-int
-readline(void)
-{
-
-
- int n; /* read() return value */
- int ch; /* for interactive mode */
-
- static int tries = 0; /* consecutive times read returned 0 */
-
-
-/*
- *
- * Reads characters coming back from the printer on ttyi up to a newline (or EOF)
- * or until no more characters are available. Characters are put in mesg[], the
- * string is terminated with '\0' when we're done with a line and TRUE is returned
- * to the caller. If complete line wasn't available FALSE is returned. Interactive
- * mode should loop here forever, except during start(), echoing characters to
- * stdout. If it happens to leave FALSE should be returned. The non-blocking read
- * gets us out until split() is called.
- *
- * Some users (apparently just on 3B2 DKHOST systems) have had problems with the
- * two process implementation that's forced me to kludge things up some. When a
- * printer (on those systems) is turned off while postio is transmitting files
- * the write process hangs in writeblock() (postio.c) - it's typically in the
- * middle of a write() call, while the read() call (below) continually returns 0.
- * In the original code readline() returned FALSE when read() returned 0 and we
- * get into a loop that never ends - because the write process is hung. In the
- * one process implementation having read return 0 is legitimate because the line
- * is opened for no delay, but with two processes the read() blocks and a return
- * value of 0 should never occur. From my point of view the real problem is that
- * the write() call hangs on 3B2 DKHOST systems and apparently doesn't anywhere
- * else. If the write returned anything less than or equal to 0 writeblock() would
- * shut things down. The kludge I've implemented counts the number of consecutive
- * times read() returns a 0 and if it exceeds a limit (100) the read process will
- * shut things down. In fact one return of 0 from read() when we're in the two
- * process mode is undoubtedly sufficient and no counting should be necessary!!!
- * Moving the check to getstatus() should also work and is probably where things
- * belong.
- *
- */
-
- if ( interactive == FALSE ) {
- while ( (n = read(ttyi, ptr, 1)) != 0 ) {
- if ( n < 0 )
- if ( errno == EINTR )
- continue;
- else error(FATAL, "error reading %s", line);
- tries = 0;
- if ( *ptr == '\n' || *ptr == '\004' || ptr >= endmesg ) {
- *(ptr+1) = '\0';
- if ( *ptr == '\004' )
- strcpy(ptr, "%%[ status: endofjob ]%%\n");
- ptr = mesg;
- return(TRUE);
- } /* End if */
- ptr++;
- } /* End while */
- if ( canread == TRUE && canwrite == FALSE ) /* read process kludge */
- if ( ++tries > 100 )
- error(FATAL, "printer appears to be offline - shutting down");
- return(FALSE);
- } /* End if */
-
- if ( canwrite == TRUE ) /* don't block during start() */
- return(FALSE);
-
- while ( (ch = getc(fp_ttyi)) != EOF )
- putc(ch, stdout);
- return(FALSE);
-
-} /* End of readline */
-#endif
-
-
-/*****************************************************************************/
-
-
-#ifdef V9
-#include <ipc.h>
-
-char tbuf[256]; /* temporary input buffer */
-char *nptr = tbuf; /* next character comes from here */
-char *eptr = tbuf; /* one past the last character in tbuf */
-
-
-setupline()
-
-
-{
-
-
- struct sgttyb sgtty;
- struct ttydevb ttydev; /* for setting up the line */
- static struct tchars tchar = { '\377', /* interrupt */
- '\377', /* quit */
- '\021', /* start output */
- '\023', /* stop output */
- '\377', /* end-of-file */
- '\377' /* input delimiter */
- };
-
-/*
- *
- * Line initialization for V9.
- *
- */
-
-
- if ( line == NULL ) {
- ttyi = ttyo = 1;
- return;
- } /* End if */
-
- if ( strncmp(line, "/cs", 3) == 0 ) {
- if ((ttyi = ipcopen(line, "")) < 0) {
- sleep(5); /* wait for Datakit to hangup */
- if ((ttyi = ipcopen(line, "")) < 0)
- error(FATAL, "can't ipcopen %s", line);
- }
- } else if ( (ttyi = open(line, O_RDWR)) == -1 )
- error(FATAL, "can't open %s", line);
-
- if ( (ttyo = dup(ttyi)) == -1 )
- error(FATAL, "can't dup file descriptor for %s", line);
-
- if ( ioctl(ttyi, FIOPUSHLD, &tty_ld) == -1 )
- error(FATAL, "ioctl error - FIOPUSHLD");
-
- if ( ioctl(ttyi, TIOCGDEV, &ttydev) == -1 )
- error(FATAL, "ioctl error - TIOCGDEV");
-
- if ( ioctl(ttyi, TIOCGETP, &sgtty) == -1 )
- error(FATAL, "ioctl error - TIOCGETP");
-
- sgtty.sg_flags &= ~ECHO;
- sgtty.sg_flags &= ~CRMOD;
- sgtty.sg_flags |= CBREAK;
- ttydev.ispeed = baudrate;
- ttydev.ospeed = baudrate;
-
- if ( ioctl(ttyi, TIOCSDEV, &ttydev) == -1 )
- error(FATAL, "ioctl error - TIOCSDEV");
-
- if ( ioctl(ttyi, TIOCSETP, &sgtty) == -1 )
- error(FATAL, "ioctl error - TIOCSETP");
-
- if ( ioctl(ttyi, TIOCSETC, &tchar) == -1 )
- error(FATAL, "ioctl error - TIOCSETC");
-
- fp_ttyi = fdopen(ttyi, "r");
-
-} /* End of setupline */
-
-
-/*****************************************************************************/
-
-
-resetline()
-
-
-{
-
-
- struct sgttyb sgtty;
-
-
-/*
- *
- * Only used if we're running the program as separate read and write processes.
- * Called from split() after the initial connection has been made and returns
- * TRUE if two processes should work. Haven't tested or even compiled the stuff
- * for separate read and write processes on Ninth Edition systems - no guarantees
- * even though we return TRUE!
- *
- */
-
-
- if ( ioctl(ttyi, TIOCGETP, &sgtty) == -1 )
- error(FATAL, "ioctl error - TIOCGETP");
-
- sgtty.sg_flags |= TANDEM;
-
- if ( ioctl(ttyi, TIOCSETP, &sgtty) == -1 )
- error(FATAL, "ioctl error - TIOCSETP");
-
- return(TRUE);
-
-} /* End of resetline */
-
-
-/*****************************************************************************/
-
-
-setupstdin(mode)
-
-
- int mode; /* what to do with stdin settings */
-
-
-{
-
-
- struct sgttyb sgtty;
-
- static int saved = FALSE;
- static struct sgttyb oldsgtty;
-
-
-/*
- *
- * Save (mode = 0), reset (mode = 1), or restore (mode = 2) the tty settings for
- * stdin. Expect something like raw mode with no echo will be set up. Need to make
- * sure interrupt and quit still work - they're the only good way to exit when
- * we're running interactive mode. I haven't tested or even compiled this code
- * so there are no guarantees.
- *
- */
-
-
- if ( interactive == TRUE )
- switch ( mode ) {
- case 0:
- if ( ioctl(0, TIOCGETP, &oldsgtty) == -1 )
- error(FATAL, "can't save terminal settings");
- saved = TRUE;
- break;
-
- case 1:
- sgtty = oldsgtty;
- sgtty.sg_flags &= ~ECHO;
- sgtty.sg_flags |= CBREAK;
- ioctl(0, TIOCSETP, &sgtty);
- break;
-
- case 2:
- if ( saved == TRUE )
- ioctl(0, TIOCSETP, &oldsgtty);
- break;
- } /* End switch */
-
-} /* End of setupstdin */
-
-
-/*****************************************************************************/
-
-
-readline()
-
-
-{
-
-
- int n; /* read() return value */
- int ch; /* for interactive mode */
-
-
-/*
- *
- * Reads characters coming back from the printer on ttyi up to a newline (or EOF)
- * and transfers each line to the mesg[] array. Everything available on ttyi is
- * initially stored in tbuf[] and a line at a time is transferred from there to
- * mesg[]. The string in mesg[] is terminated with a '\0' and TRUE is returned to
- * the caller when we find a newline, EOF, or reach the end of the mesg[] array.
- * If nothing is available on ttyi we return FALSE if a single process is being
- * used for reads and writes, while in the two process implementation we force a
- * one character read. Interactive mode loops here forever, except during start(),
- * echoing everything that comes back on ttyi to stdout. The performance of a
- * simple getc/putc loop for interactive mode was unacceptable when run under mux
- * and has been replaced by more complicated code. When layers wasn't involved
- * the getc/putc loop worked well.
- *
- */
-
-
- if ( interactive == FALSE ) {
- while ( 1 ) {
- while ( nptr < eptr ) { /* grab characters from tbuf */
- *ptr = *nptr++;
- if ( *ptr == '\r' ) continue;
- if ( *ptr == '\n' || *ptr == '\004' || ptr >= endmesg ) {
- *(ptr+1) = '\0';
- if ( *ptr == '\004' )
- strcpy(ptr, "%%[ status: endofjob ]%%\n");
- ptr = mesg;
- return(TRUE);
- } /* End if */
- ++ptr;
- } /* End for */
-
- nptr = eptr = tbuf;
- if ( ioctl(ttyi, FIONREAD, &n) < 0 )
- if ( errno == EINTR )
- continue;
- else error(FATAL, "ioctl error - FIONREAD");
- if ( n <= 0 )
- if ( canwrite == TRUE )
- return(FALSE);
- n = ((n < 1) ? 1 : ((n < sizeof(tbuf)) ? n : sizeof(tbuf)));
- if ( (n = read(ttyi, tbuf, n)) < 0 )
- if ( errno == EINTR )
- continue;
- else error(FATAL, "error reading line %s", line);
- else eptr = nptr + n;
- } /* End while */
- } /* End if */
-
- if ( canwrite == TRUE ) /* don't block during start() */
- return(FALSE);
-
- while ( 1 ) { /* only interactive mode gets here */
- if ( ioctl(ttyi, FIONREAD, &n) < 0 )
- error(FATAL, "ioctl error - FIONREAD");
- n = ((n < 1) ? 1 : ((n < sizeof(tbuf)) ? n : sizeof(tbuf)));
- if ( (n = read(ttyi, tbuf, n)) < 0 )
- error(FATAL, "error reading line %s", line);
- else if ( n == 0 ) /* should not happen */
- error(FATAL, "end of file in interactive mode");
- if ( write(1, tbuf, n) != n )
- error(FATAL, "error writing to stdout");
- } /* End while */
-
- return(FALSE);
-
-} /* End of readline */
-#endif
-
-
-/*****************************************************************************/
-
-
-#ifdef BSD4_2
-setupline()
-
-
-{
-
-
- struct sgttyb sgtty;
- static struct tchars tchar = { '\377', /* interrupt */
- '\377', /* quit */
- '\021', /* start output */
- '\023', /* stop output */
- '\377', /* end-of-file */
- '\377' /* input delimiter */
- };
- long lmodes;
- int disc = NTTYDISC;
-
-
-/*
- *
- * Line initialization for BSD4_2. As in the System V code, if no line is given
- * (ie. line == NULL) we continue on as before using stdout as ttyi and ttyo.
- *
- */
-
-
- if ( line == NULL )
- ttyi = fileno(stdout);
- else if ( (ttyi = open(line, O_RDWR)) == -1 )
- error(FATAL, "can't open %s", line);
-
- if ( (ttyo = dup(ttyi)) == -1 )
- error(FATAL, "can't dup file descriptor for %s", line);
-
- if (ioctl(ttyi, TIOCSETD, &disc) == -1 )
- error(FATAL, "ioctl error - TIOCSETD");
-
- if ( ioctl(ttyi, TIOCGETP, &sgtty) == -1 )
- error(FATAL, "ioctl error - TIOCGETP");
-
- if ( ioctl(ttyi, TIOCLGET, &lmodes) == -1 )
- error(FATAL, "ioctl error - TIOCLGET");
-
- sgtty.sg_flags &= ~ECHO;
- sgtty.sg_flags &= ~CRMOD;
- sgtty.sg_flags |= CBREAK;
- sgtty.sg_ispeed = baudrate;
- sgtty.sg_ospeed = baudrate;
- lmodes |= LDECCTQ;
-
- if ( ioctl(ttyi, TIOCSETP, &sgtty) == -1 )
- error(FATAL, "ioctl error - TIOCSETP");
-
- if ( ioctl(ttyi, TIOCSETC, &tchar) == -1 )
- error(FATAL, "ioctl error - TIOCSETC");
-
- if ( ioctl(ttyi, TIOCLSET, &lmodes) == -1 )
- error(FATAL, "ioctl error - TIOCLSET");
-
- fp_ttyi = fdopen(ttyi, "r");
-
-} /* End of setupline */
-
-
-/*****************************************************************************/
-
-
-resetline()
-
-
-{
-
-
- struct sgttyb sgtty;
-
-
-/*
- *
- * Only used if we're running the program as separate read and write processes.
- * Called from split() after the initial connection has been made and returns
- * TRUE if two processes should work. Haven't tested or even compiled the stuff
- * for separate read and write processes on Berkeley systems - no guarantees
- * even though we return TRUE!
- *
- */
-
-
- if ( ioctl(ttyi, TIOCGETP, &sgtty) == -1 )
- error(FATAL, "ioctl error - TIOCGETP");
-
- sgtty.sg_flags |= TANDEM;
-
- if ( ioctl(ttyi, TIOCSETP, &sgtty) == -1 )
- error(FATAL, "ioctl error - TIOCSETP");
-
- return(TRUE);
-
-} /* End of resetline */
-
-
-/*****************************************************************************/
-
-
-setupstdin(mode)
-
-
- int mode; /* what to do with stdin settings */
-
-
-{
-
-
- struct sgttyb sgtty;
-
- static int saved = FALSE;
- static struct sgttyb oldsgtty;
-
-
-/*
- *
- * Save (mode = 0), reset (mode = 1), or restore (mode = 2) the tty settings for
- * stdin. Expect something like raw mode with no echo will be set up. Need to make
- * sure interrupt and quit still work - they're the only good way to exit when
- * we're running interactive mode. I haven't tested or even compiled this code
- * so there are no guarantees.
- *
- */
-
-
- if ( interactive == TRUE )
- switch ( mode ) {
- case 0:
- if ( isatty(0) != 1 )
- error(FATAL, "stdin not a terminal - can't run interactive mode");
- if ( ioctl(0, TIOCGETP, &oldsgtty) == -1 )
- error(FATAL, "can't save terminal settings");
- saved = TRUE;
- break;
-
- case 1:
- sgtty = oldsgtty;
- sgtty.sg_flags &= ~ECHO;
- sgtty.sg_flags |= CBREAK;
- ioctl(0, TIOCSETP, &sgtty);
- break;
-
- case 2:
- if ( saved == TRUE )
- ioctl(0, TIOCSETP, &oldsgtty);
- break;
- } /* End switch */
-
-} /* End of setupstdin */
-
-
-/*****************************************************************************/
-
-
-readline()
-
-
-{
-
-
- int n; /* read() return value */
- int ch; /* for interactive mode */
-
-
-/*
- *
- * Reads characters coming back from the printer on ttyo up to a newline (or EOF)
- * or until no more characters are available. Characters are put in mesg[], the
- * string is terminated with '\0' when we're done with a line and TRUE is returned
- * to the caller. If complete line wasn't available FALSE is returned. Interactive
- * mode should loop here forever, except during start(), echoing characters to
- * stdout. If it happens to leave FALSE should be returned. Probably should read
- * everything available on ttyi into a temporary buffer and work from there rather
- * than reading one character at a time.
- *
- */
-
-
- if ( interactive == FALSE ) {
- while ( 1 ) {
- if ( ioctl(ttyi, FIONREAD, &n) < 0 )
- if ( errno == EINTR )
- continue;
- else error(FATAL, "ioctl error - FIONREAD");
- if ( n <= 0 )
- if ( canwrite == TRUE )
- return(FALSE);
- else n = 1;
- for ( ; n > 0; n-- ) {
- /*if ( read(ttyi, ptr, 1) < 0 )*/
- if ( (*ptr = getc(fp_ttyi)) == EOF )
- if ( errno == EINTR )
- continue;
- else error(FATAL, "error reading %s", line);
- if ( *ptr == '\r' ) continue;
- if ( *ptr == '\n' || *ptr == '\004' || ptr >= endmesg ) {
- *(ptr+1) = '\0';
- if ( *ptr == '\004' )
- strcpy(ptr, "%%[ status: endofjob ]%%\n");
- ptr = mesg;
- return(TRUE);
- } /* End if */
- ++ptr;
- } /* End for */
- } /* End while */
- } /* End if */
-
- if ( canwrite == TRUE ) /* don't block during start() */
- return(FALSE);
-
- while ( (ch = getc(fp_ttyi)) != EOF )
- putc(ch, stdout);
- return(FALSE);
-
-} /* End of readline */
-
-
-/*****************************************************************************/
-
-
-/* @(#)strspn.c 1.2 */
-/*LINTLIBRARY*/
-/*
- * Return the number of characters in the maximum leading segment
- * of string which consists solely of characters from charset.
- */
-int
-strspn(string, charset)
-char *string;
-register char *charset;
-{
- register char *p, *q;
-
- for(q=string; *q != '\0'; ++q) {
- for(p=charset; *p != '\0' && *p != *q; ++p)
- ;
- if(*p == '\0')
- break;
- }
- return(q-string);
-}
-
-/* @(#)strpbrk.c 1.2 */
-/*LINTLIBRARY*/
-/*
- * Return ptr to first occurance of any character from `brkset'
- * in the character string `string'; NULL if none exists.
- */
-
-char *
-strpbrk(string, brkset)
-register char *string, *brkset;
-{
- register char *p;
-
- do {
- for(p=brkset; *p != '\0' && *p != *string; ++p)
- ;
- if(*p != '\0')
- return(string);
- }
- while(*string++);
- return((char*)0);
-}
-
-/* @(#)strtok.c 1.2 */
-/* 3.0 SID # 1.2 */
-/*LINTLIBRARY*/
-/*
- * uses strpbrk and strspn to break string into tokens on
- * sequentially subsequent calls. returns NULL when no
- * non-separator characters remain.
- * `subsequent' calls are calls with first argument NULL.
- */
-
-
-extern int strspn();
-extern char *strpbrk();
-
-char *
-strtok(string, sepset)
-char *string, *sepset;
-{
- register char *p, *q, *r;
- static char *savept;
-
- /*first or subsequent call*/
- p = (string == (char*)0)? savept: string;
-
- if(p == 0) /* return if no tokens remaining */
- return((char*)0);
-
- q = p + strspn(p, sepset); /* skip leading separators */
-
- if(*q == '\0') /* return if no tokens remaining */
- return((char*)0);
-
- if((r = strpbrk(q, sepset)) == (char*)0) /* move past token */
- savept = 0; /* indicate this is last token */
- else {
- *r = '\0';
- savept = ++r;
- }
- return(q);
-}
-#endif
-
-
-/*****************************************************************************/
-
-
-#ifdef DKHOST
-
-short dkrmode[3] = {DKR_TIME, 0, 0};
-
-dkhost_connect()
-
-
-{
-
-
- int ofd; /* for saving and restoring stderr */
- int dfd;
- int retrytime = 5;
-
-
-/*
- *
- * Tries to connect to a Datakit destination. The extra stuff I've added to save
- * and later restore stderr is primarily for our spooling setup at Murray Hill.
- * postio is usually called with stderr directed to a file that will be returned
- * to the user when the job finishes printing. Problems encountered by dkdial(),
- * like busy messages, go to stderr but don't belong in the user's mail. They'll
- * be temporarily directed to the log file. After we've connected stderr will be
- * restored.
- *
- */
-
-
- if ( *line == '\0' )
- error(FATAL, "incomplete Datakit line");
-
- if ( fp_log != stderr ) { /* save stderr - redirect dkdial errors */
- ofd = dup(2);
- close(2);
- dup(fileno(fp_log));
- } /* End if */
-
- while ( (dfd = ttyi = dkdial(line)) < 0 ) {
- if ( retrytime < 0 )
- error(FATAL, "can't connect to %s", line);
- sleep(retrytime++);
- if ( retrytime > 60 )
- retrytime = 60;
- } /* End while */
-
- if ( fp_log != stderr ) { /* restore stderr */
- close(2);
- dup(ofd);
- close(ofd);
- } /* End if */
-
- if ( ioctl(ttyi, DIOCRMODE, dkrmode) == -1 )
- error(FATAL, "ioctl error - DIOCRMODE");
-
- line = dtnamer(dkminor(ttyi));
-
- if ( (ttyi = open(line, O_RDWR)) == -1 )
- error(FATAL, "can't open %s", line);
-
- close(dfd);
-
-} /* End of dkhost_connect */
-#endif
-
-
-/*****************************************************************************/
-
diff --git a/usr/src/cmd/lp/filter/postscript/postio/ifdef.h b/usr/src/cmd/lp/filter/postscript/postio/ifdef.h
deleted file mode 100644
index d36cc5a5bb..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postio/ifdef.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1996 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-/*
- *
- * Conditional compilation definitions needed in ifdef.c and postio.c.
- *
- */
-
-
-#ifdef SYSV
-#include <termio.h>
-#endif
-
-
-#ifdef V9
-#include <sys/filio.h>
-#include <sys/ttyio.h>
-
-extern int tty_ld;
-#endif
-
-
-#ifdef BSD4_2
-#include <sgtty.h>
-#include <sys/time.h>
-#include <errno.h>
-
-#define FD_ZERO(s) (s) = 0
-#define FD_SET(n,s) (s) |= 1 << (n)
-
-extern int errno;
-#endif
-
-
-#ifdef DKHOST
-#include <dk.h>
-#include <sysexits.h>
-
-extern char *dtnamer();
-extern int dkminor();
-#endif
-
-
-/*
- *
- * External variable declarations - most (if not all) are defined in postio.c and
- * needed by the routines in ifdef.c.
- *
- */
-
-
-extern char *line; /* printer is on this line */
-extern int ttyi; /* input */
-extern int ttyo; /* and output file descriptors */
-extern FILE *fp_log; /* just for DKHOST stuff */
-
-extern char mesg[]; /* exactly what came back on ttyi */
-extern char *endmesg; /* one in front of last free slot in mesg */
-extern int next; /* next character goes in mesg[next] */
-
-extern short baudrate; /* printer is running at this speed */
-extern int stopbits; /* and expects this many stop bits */
-extern int interactive; /* TRUE for interactive mode */
-
-extern int canread; /* allows reads */
-extern int canwrite; /* and writes if TRUE */
-
diff --git a/usr/src/cmd/lp/filter/postscript/postio/parallel.c b/usr/src/cmd/lp/filter/postscript/postio/parallel.c
deleted file mode 100644
index a8bca7e41e..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postio/parallel.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-extern char *postbegin;
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/ioccom.h>
-#include <sys/ioctl.h>
-
-#include <sys/bpp_io.h>
-#include <sys/ecppsys.h>
-#include <sys/prnio.h>
-
-#define PRINTER_IO_ERROR 129
-
-/*
- * the parameter structure for the parallel port
- */
-struct ppc_params_t {
- int flags; /* same as above */
- int state; /* status of the printer interface */
- int strobe_w; /* strobe width, in uS */
- int data_setup; /* data setup time, in uS */
- int ack_timeout; /* ACK timeout, in secs */
- int error_timeout; /* PAPER OUT, etc... timeout, in secs */
- int busy_timeout; /* BUSY timeout, in seconds */
-};
-
-
-
-extern char *block;
-extern int head, tail;
-extern int readblock(int);
-extern FILE *fp_log;
-static void printer_info(char *fmt, ...);
-
-/* These are the routines avaliable to others for use */
-int is_a_parallel_bpp(int);
-int bpp_state(int);
-int parallel_comm(int, int());
-int get_ecpp_status(int);
-int is_a_prnio(int);
-int prnio_state(int);
-
-#define PRINTER_ERROR_PAPER_OUT 1
-#define PRINTER_ERROR_OFFLINE 2
-#define PRINTER_ERROR_BUSY 3
-#define PRINTER_ERROR_ERROR 4
-#define PRINTER_ERROR_CABLE_POWER 5
-#define PRINTER_ERROR_UNKNOWN 6
-#define PRINTER_ERROR_TIMEOUT 7
-
-/****************************************************************************/
-
-/**
- * for BPP PARALLEL interfaces
- **/
-
-int is_a_parallel_bpp(int fd)
-{
- if (ioctl(fd, BPPIOC_TESTIO) == 0 || errno == EIO)
- return(1);
- return(0);
-}
-
-
-#if defined(DEBUG) && defined(NOTDEF)
-char *BppState(int state)
-{
- static char buf[BUFSIZ];
-
- memset(buf, 0, sizeof(buf));
- sprintf(buf, "State (0x%.4x) - (%s%s%s%s)\n", state,
- ((state & BPP_SLCT_ERR) ? "offline " : ""),
- ((state & BPP_BUSY_ERR) ? "busy " : ""),
- ((state & BPP_PE_ERR) ? "paper " : ""),
- ((state & BPP_ERR_ERR) ? "error " : ""));
-
- return(buf);
-}
-#endif
-
-int bpp_state(int fd)
-{
- if (ioctl(fd, BPPIOC_TESTIO)) {
- struct bpp_error_status bpp_stat;
- int state;
-
- if (ioctl(fd, BPPIOC_GETERR, &bpp_stat) < 0)
- exit(PRINTER_IO_ERROR);
- state = bpp_stat.pin_status;
-
-#if defined(DEBUG) && defined(NOTDEF)
- logit("%s", BppState(state));
-#endif
-
- if (state == (BPP_PE_ERR | BPP_ERR_ERR | BPP_SLCT_ERR)) {
- /* paper is out */
- return(PRINTER_ERROR_PAPER_OUT);
- } else if (state & BPP_BUSY_ERR) {
- /* printer is busy */
- return(PRINTER_ERROR_BUSY);
- } else if (state & BPP_SLCT_ERR) {
- /* printer is offline */
- return(PRINTER_ERROR_OFFLINE);
- } else if (state & BPP_ERR_ERR) {
- /* printer is errored */
- return(PRINTER_ERROR_ERROR);
- } else if (state == BPP_PE_ERR) {
- /* printer is off/unplugged */
- return(PRINTER_ERROR_CABLE_POWER);
- } else if (state) {
- return(PRINTER_ERROR_UNKNOWN);
- } else
- return(0);
- }
- return(0);
-}
-
-int
-get_ecpp_status(int fd)
-{
- int state;
- struct ecpp_transfer_parms transfer_parms;
-
-
- if (ioctl(fd, ECPPIOC_GETPARMS, &transfer_parms) == -1) {
- return(-1);
- }
-
- state = transfer_parms.mode;
- /*
- * We don't know what all printers will return in
- * nibble mode, therefore if we support nibble mode we will
- * force the printer to be in CENTRONICS mode.
- */
-
- if (state != ECPP_CENTRONICS) {
- transfer_parms.mode = ECPP_CENTRONICS;
- if (ioctl(fd, ECPPIOC_SETPARMS, &transfer_parms) == -1) {
- return(-1);
- } else {
- state = ECPP_CENTRONICS;
- }
- }
-
- return(state);
-}
-
-/**
- * For prnio(7I) - generic printer interface
- **/
-int is_a_prnio(int fd)
-{
- uint_t cap;
-
- /* check if device supports prnio */
- if (ioctl(fd, PRNIOC_GET_IFCAP, &cap) == -1) {
- return (0);
- }
- /* we will use 1284 status if available */
- if ((cap & PRN_1284_STATUS) == 0) {
- /* some devices may only support 1284 status in unidir. mode */
- if (cap & PRN_BIDI) {
- cap &= ~PRN_BIDI;
- (void) ioctl(fd, PRNIOC_SET_IFCAP, &cap);
- }
- }
- return (1);
-}
-
-int prnio_state(int fd)
-{
- uint_t status;
- uchar_t pins;
-
- if ((ioctl(fd, PRNIOC_GET_STATUS, &status) == 0) &&
- (status & PRN_READY)) {
- return(0);
- }
-
- if (ioctl(fd, PRNIOC_GET_1284_STATUS, &pins) != 0) {
- return(PRINTER_ERROR_UNKNOWN);
- }
-
- if ((pins & ~PRN_1284_BUSY) == PRN_1284_PE) {
- /* paper is out */
- return(PRINTER_ERROR_PAPER_OUT);
- } else if (pins == (PRN_1284_PE | PRN_1284_SELECT |
- PRN_1284_NOFAULT | PRN_1284_BUSY)) {
- /* printer is off/unplugged */
- return(PRINTER_ERROR_CABLE_POWER);
- } else if ((pins & PRN_1284_SELECT) == 0) {
- /* printer is offline */
- return(PRINTER_ERROR_OFFLINE);
- } else if ((pins & PRN_1284_NOFAULT) == 0) {
- /* printer is errored */
- return(PRINTER_ERROR_ERROR);
- } else if (pins & PRN_1284_PE) {
- /* paper is out */
- return(PRINTER_ERROR_PAPER_OUT);
- } else if (pins ^ (PRN_1284_SELECT | PRN_1284_NOFAULT)) {
- return(PRINTER_ERROR_UNKNOWN);
- }
- return(0);
-}
-
-/**
- * Common routines
- **/
-
-/*ARGSUSED0*/
-static void
-ByeByeParallel(int sig)
-{
- /* try to shove out the EOT */
- (void) write(1, "\004", 1);
- exit(0);
-}
-
-
-/*ARGSUSED0*/
-static void
-printer_info(char *fmt, ...)
-{
- char mesg[BUFSIZ];
- va_list ap;
-
- va_start(ap, fmt);
- vsprintf(mesg, fmt, ap);
- va_end(ap);
-
- fprintf(stderr,
- "%%%%[ PrinterError: %s; source: parallel ]%%%%\n",
- mesg);
- fflush(stderr);
- fsync(2);
-
- if (fp_log != stderr) {
- fprintf(fp_log,
- "%%%%[ PrinterError: %s; source: parallel ]%%%%\n",
- mesg);
- fflush(fp_log);
- }
-}
-
-static void
-printer_error(int error)
-{
- switch (error) {
- case -1:
- printer_info("ioctl(): %s", strerror(errno));
- break;
- case PRINTER_ERROR_PAPER_OUT:
- printer_info("out of paper");
- break;
- case PRINTER_ERROR_OFFLINE:
- printer_info("offline");
- break;
- case PRINTER_ERROR_BUSY:
- printer_info("busy");
- break;
- case PRINTER_ERROR_ERROR:
- printer_info("printer error");
- break;
- case PRINTER_ERROR_CABLE_POWER:
- printer_info("printer powered off or disconnected");
- break;
- case PRINTER_ERROR_UNKNOWN:
- printer_info("unknown error");
- break;
- case PRINTER_ERROR_TIMEOUT:
- printer_info("communications timeout");
- break;
- default:
- printer_info("get_status() failed");
- }
-}
-
-
-static void
-wait_state(int fd, int get_state())
-{
- int state;
- int was_faulted = 0;
-
- while (state = get_state(fd)) {
- was_faulted=1;
- printer_error(state);
- sleep(15);
- }
-
- if (was_faulted) {
- fprintf(stderr, "%%%%[ status: idle ]%%%%\n");
- fflush(stderr);
- fsync(2);
- if (fp_log != stderr) {
- fprintf(fp_log, "%%%%[ status: idle ]%%%%\n");
- fflush(fp_log);
- }
- }
-}
-
-
-int
-parallel_comm(int fd, int get_state())
-{
- int actual; /* number of bytes successfully written */
- int count = 0;
-
- (void) signal(SIGTERM, ByeByeParallel);
- (void) signal(SIGQUIT, ByeByeParallel);
- (void) signal(SIGHUP, ByeByeParallel);
- (void) signal(SIGINT, ByeByeParallel);
- (void) signal(SIGALRM, SIG_IGN);
-
- /* is the device ready? */
-
- /* bracket job with EOT */
- wait_state(fd, get_state);
- (void) write(fd, "\004", 1);
-
-/* write(fd, postbegin, strlen(postbegin)); */
-
- while (readblock(fileno(stdin)) > 0) {
- wait_state(fd, get_state);
- alarm(120);
- if ((actual = write(fd, block + head, tail - head)) == -1) {
- alarm(0);
- if (errno == EINTR) {
- printer_error(PRINTER_ERROR_TIMEOUT);
- sleep(30);
- continue;
- } else {
- printer_info("I/O Error during write(): %s",
- strerror(errno));
- exit(2);
- }
- }
- alarm(0);
- if (actual >= 0)
- head += actual;
-
-#if defined(DEBUG) && defined(NOTDEF)
- logit("Writing (%d) at 0x%x actual: %d, %s\n", count++, head,
- actual, (actual < 1 ? strerror(errno) : ""));
-#endif
- }
-
- /* write the final EOT */
- wait_state(fd, get_state);
- (void) write(fd, "\004", 1);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/filter/postscript/postio/postio.c b/usr/src/cmd/lp/filter/postscript/postio/postio.c
deleted file mode 100644
index c1a1ab01dd..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postio/postio.c
+++ /dev/null
@@ -1,1246 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * postio - RS-232 serial interface for PostScript printers
- *
- * A simple program that manages input and output for PostScript printers. Much
- * has been added and changed from early versions of the program, but the basic
- * philosophy is still the same. Don't send real data until we're certain we've
- * connected to a PostScript printer that's in the idle state and try to hold
- * the connection until the job is completely done. It's more work than you
- * might expect is necessary, but should provide a reasonably reliable spooler
- * interface that can return error indications to the caller via the program's
- * exit status.
- *
- * I've added code that will let you split the program into separate read/write
- * processes. Although it's not the default it should be useful if you have a
- * file that will be returning useful data from the printer. The two process
- * stuff was laid down on top of the single process code and both methods still
- * work. The implementation isn't as good as it could be, but didn't require
- * many changes to the original program (despite the fact that there are now
- * many differences).
- *
- * By default the program still runs as a single process. The -R2 option forces
- * separate read and write processes after the intial connection is made. If you
- * want that as the default initialize splitme (below) to TRUE. In addition the
- * -t option that's used to force stuff not recognized as status reports to
- * stdout also tries to run as two processes (by setting splitme to TRUE). It
- * will only work if the required code (ie. resetline() in ifdef.c) has been
- * implemented for your Unix system. I've only tested the System V code.
- *
- * Code needed to support interactive mode has also been added, although again
- * it's not as efficient as it could be. It depends on the system dependent
- * procedures resetline() and setupstdin() (file ifdef.c) and for now is only
- * guaranteed to work on System V. Can be requested using the -i option.
- *
- * Quiet mode (-q option) is also new, but was needed for some printers
- * connected to RADIAN. If you're running in quiet mode no status requests will
- * be sent to the printer while files are being transmitted (ie. in send()).
- *
- * The program expects to receive printer status lines that look like,
- *
- * %%[ status: idle; source: serial 25 ]%%
- * %%[ status: waiting; source: serial 25 ]%%
- * %%[ status: initializing; source: serial 25 ]%%
- * %%[ status: busy; source: serial 25 ]%%
- * %%[ status: printing; source: serial 25 ]%%
- * %%[ status: PrinterError: out of paper; source: serial 25 ]%%
- * %%[ status: PrinterError: no paper tray; source: serial 25 ]%%
- *
- * although this list isn't complete. Sending a '\024' (control T) character
- * forces the return of a status report. PostScript errors detected on the
- * printer result in the immediate transmission of special error messages that
- * look like,
- *
- * %%[ Error: undefined; OffendingCommand: xxx ]%%
- * %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
- *
- * although we only use the Error and Flushing keywords. Finally conditions,
- * like being out of paper, result in other messages being sent back from the
- * printer over the communications line. Typical PrinterError messages look
- * like,
- *
- * %%[ PrinterError: out of paper; source: serial 25 ]%%
- * %%[ PrinterError: paper jam; source: serial 25 ]%%
- *
- * although we only use the PrinterError keyword rather than trying to recognize
- * all possible printer errors.
- *
- * The implications of using one process and only flow controlling data going to
- * the printer are obvious. Job transmission should be reliable, but there can
- * be data loss in stuff sent back from the printer. Usually that only caused
- * problems with jobs designed to run on the printer and return useful data
- * back over the communications line. If that's the kind of job you're sending
- * call postio with the -t option. That should force the program to split into
- * separate read and write processes and everything not bracketed by "%%[ "
- * and " ]%%" strings goes to stdout. In otherwords the data you're expecting
- * should be separated from the status stuff that goes to the log file (or
- * stderr). The -R2 option does almost the same thing (ie. separate read and
- * write processes), but everything that comes back from the printer goes to
- * the log file (stderr by default) and you'll have to separate your data from
- * any printer messages.
- *
- * A typical command line might be,
- *
- * postio -l /dev/tty01 -b 9600 -L log file1 file2
- *
- * where -l selects the line, -b sets the baud rate, and -L selects the printer
- * log file. Since there's no default line, at least not right now, you'll
- * always need to use the -l option, and if you don't choose a log file stderr
- * will be used. If you have a program that will be returning data the command
- * line might look like,
- *
- * postio -t -l/dev/tty01 -b9600 -Llog file >results
- *
- * Status stuff goes to file log while the data you're expecting back from the
- * printer gets put in file results.
- *
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/ioccom.h>
-#include <sys/ioctl.h>
-#include <sys/bpp_io.h>
-#include <sys/ecppsys.h>
-
-#include "ifdef.h" /* conditional compilation stuff */
-#include "gen.h" /* general purpose definitions */
-#include "postio.h" /* some special definitions */
-
-static char **argv; /* global so everyone can use them */
-static int argc;
-static char *prog_name = ""; /* really just for error messages */
-static int x_stat = 0; /* program exit status */
-static int debug = OFF; /* debug flag */
-static int ignore = OFF; /* what's done for FATAL errors */
-static Baud baudtable[] = BAUDTABLE; /* converts strings to termio values */
-static int quiet = FALSE; /* no status queries in send if TRUE */
-char *postbegin = POSTBEGIN; /* preceeds all the input files */
-static int useslowsend = FALSE; /* not recommended! */
-static int splitme = FALSE; /* into READ & WRITE procs if TRUE */
-static int whatami = READWRITE; /* a READ or WRITE process - or both */
-static int otherpid = -1; /* who gets signals if greater than 1 */
-static int joinsig = SIGTRAP; /* reader gets when writing is done */
-static int writedone = FALSE; /* and then sets this to TRUE */
-static char sbuf[MESGSIZE]; /* for parsing the message */
-static char *mesgptr = NULL; /* printer msg starts here in mesg[] */
-static Status status[] = STATUS; /* for converting status strings */
-static int nostatus = NOSTATUS; /* default getstatus() return value */
-static int tostdout = FALSE; /* non-status stuff goes to stdout? */
-static int currentstate = NOTCONNECTED; /* START, SEND, or DONE */
-
-char *line = NULL; /* printer is on this tty line */
-short baudrate = BAUDRATE; /* and running at this baud rate */
-int stopbits = 1; /* number of stop bits */
-int interactive = FALSE; /* interactive mode */
-char *block = NULL; /* input file buffer */
-int blocksize = BLOCKSIZE; /* and its size in bytes */
-int head = 0; /* block[head] is the next character */
-int tail = 0; /* one past the last byte in block[] */
-int canread = TRUE; /* allow reads */
-int canwrite = TRUE; /* and writes if TRUE */
-char mesg[MESGSIZE]; /* exactly what came back on ttyi */
-char *endmesg = NULL; /* end for readline() in mesg[] */
-int ttyi = 0; /* input */
-int ttyo = 2; /* and output file descriptors */
-FILE *fp_log = stderr; /* log file for stuff from printer */
-
-static void init_signals(void);
-static void interrupt(int);
-static void options(void);
-static void initialize(void);
-static void initialize_parallel(void);
-static void start(void);
-static void split(void);
-static void arguments(void);
-static void send(int, char *);
-static void done(void);
-static void cleanup(void);
-static void clearline(void);
-void logit(char *, ...);
-static void quit(int sig);
-static void Rest(int t);
-static int parsemesg(void);
-static int sendsignal(int);
-static int writeblock(void);
-static int Write(int, char *, int);
-static short getbaud(char *);
-static char *find(char *, char *);
-
-void error(int, char *, ...);
-int getstatus(int);
-int readblock(int);
-
-
-/* from parallel.c for parallel interfaces */
-extern int is_a_parallel_bpp(int);
-extern int bpp_state(int);
-extern int is_a_prnio(int);
-extern int prnio_state(int);
-extern int parallel_comm(int, int()); /* arg is bpp_state */
-
-/* from ifdef.c for serial interfaces */
-extern void setupline(void);
-extern void setupstdin(int);
-extern void slowsend(int);
-extern int resetline(void);
-extern int readline(void);
-
-/*
- * A simple program that manages input and output for PostScript printers.
- * Can run as a single process or as separate read/write processes. What's
- * done depends on the value assigned to splitme when split() is called.
- */
-
-int nop(int fd) { return(0); }
-
-
-int
-main(int agc, char *agv[])
-{
- argc = agc;
- argv = agv;
- prog_name = argv[0]; /* really just for error messages */
-
- /* is this a serial or parallel port? */
-
- init_signals(); /* sets up interrupt handling */
- options(); /* get command line options */
-
- setbuf(stderr, NULL); /* unbuffer io for stderr */
-
-
- if (line) {
- close(1);
- open(line, O_RDWR);
-
- }
-
- if (is_a_prnio(1)) {
- initialize_parallel();
- x_stat = parallel_comm(1, prnio_state);
- } else if (is_a_parallel_bpp(1) ||
- (get_ecpp_status(1) == ECPP_CENTRONICS)) {
- initialize_parallel();
- x_stat = parallel_comm(1, bpp_state);
- } else if (isatty(1)) {
- initialize(); /* must be done after options() */
- start(); /* make sure the printer is ready */
- split(); /* into read/write processes - maybe */
- arguments(); /* then send each input file */
- done(); /* wait until the printer is finished */
- cleanup(); /* make sure the write process stops */
- } else {
- initialize_parallel();
- x_stat = parallel_comm(1, nop);
- }
-
-
- return (x_stat); /* everything probably went OK */
-}
-
-
-/*
- * Makes sure we handle interrupts. The proper way to kill the program, if
- * necessary, is to do a kill -15. That forces a call to interrupt(), which in
- * turn tries to reset the printer and then exits with a non-zero status. If the
- * program is running as two processes, sending SIGTERM to either the parent or
- * child should clean things up.
- */
-
-static void
-init_signals(void)
-{
- if (signal(SIGINT, interrupt) == SIG_IGN) {
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
- } else {
- signal(SIGHUP, interrupt);
- signal(SIGQUIT, interrupt);
- }
-
- signal(SIGTERM, interrupt);
-
-}
-
-
-/*
- * Reads and processes the command line options. The -R2, -t, and -i options all
- * force separate read and write processes by eventually setting splitme to TRUE
- * (check initialize()). The -S option is not recommended and should only be
- * used as a last resort!
- */
-
-static void
-options(void)
-{
- int ch; /* return value from getopt() */
- char *optnames = "b:il:qs:tB:L:P:R:SDI";
-
- extern char *optarg; /* used by getopt() */
- extern int optind;
-
- while ((ch = getopt(argc, argv, optnames)) != EOF) {
-
- switch (ch) {
-
- case 'b': /* baud rate string */
- baudrate = getbaud(optarg);
- break;
-
- case 'i': /* interactive mode */
- interactive = TRUE;
- break;
-
- case 'l': /* printer line */
- line = optarg;
- break;
-
- case 'q': /* no status queries - for RADIAN? */
- quiet = TRUE;
- break;
-
- case 's': /* use 2 stop bits - for UNISON? */
- if ((stopbits = atoi(optarg)) < 1 || stopbits > 2)
- stopbits = 1;
- break;
-
- case 't': /* non-status stuff goes to stdout */
- tostdout = TRUE;
- break;
-
- case 'B': /* set the job buffer size */
- if ((blocksize = atoi(optarg)) <= 0)
- blocksize = BLOCKSIZE;
- break;
-
- case 'L': /* printer log file */
- if ((fp_log = fopen(optarg, "w")) == NULL) {
- fp_log = stderr;
- error(NON_FATAL, "can't open log file %s", optarg);
- } /* End if */
- break;
-
- case 'P': /* initial PostScript code */
- postbegin = optarg;
- break;
-
- case 'R': /* run as one or two processes */
- if (atoi(optarg) == 2)
- splitme = TRUE;
- else splitme = FALSE;
- break;
-
- case 'S': /* slow and kludged up vers. of send */
- useslowsend = TRUE;
- break;
-
- case 'D': /* debug flag */
- debug = ON;
- break;
-
- case 'I': /* ignore FATAL errors */
- ignore = ON;
- break;
-
- case '?': /* don't understand the option */
- error(FATAL, "");
- break;
-
- default: /* don't know what to do for ch */
- error(FATAL, "missing case for option %c\n", ch);
- break;
-
- } /* End switch */
-
- } /* End while */
-
- argc -= optind; /* get ready for non-option args */
- argv += optind;
-
-}
-
-
-/*
- * Called from options() to convert a baud rate string into an appropriate
- * termio value. *rate is looked up in baudtable[] and if it's found, the
- * corresponding value is returned to the caller.
- */
-
-static short
-getbaud(char *rate) /* string representing the baud rate */
-{
- int i; /* for looking through baudtable[] */
-
- for (i = 0; baudtable[i].rate != NULL; i++)
- if (strcmp(rate, baudtable[i].rate) == 0)
- return (baudtable[i].val);
-
- error(FATAL, "don't recognize baud rate %s", rate);
- /*NOTREACHED*/
- return (0);
-
-}
-
-
-/*
- * Initialization, a few checks, and a call to setupline() (file ifdef.c) to
- * open and configure the communications line. Settings for interactive mode
- * always take precedence. The setupstdin() call with an argument of 0 saves
- * the current terminal settings if interactive mode has been requested -
- * otherwise nothing's done. Unbuffering stdout (via the setbuf() call) isn't
- * really needed on System V since it's flushed whenever terminal input is
- * requested. It's more efficient if we buffer the stdout (on System V) but
- * safer (for other versions of Unix) if we include the setbuf() call.
- */
-
-static void
-initialize(void)
-{
- whatami = READWRITE; /* always run start() as one process */
- canread = canwrite = TRUE;
-
- if (line == NULL) /* kludge for lp - they use -t option */
- tostdout = FALSE;
-
- if (tostdout == TRUE) /* force separate read/write procs */
- splitme = TRUE;
-
- if (interactive == TRUE) { /* interactive mode settings win */
- quiet = FALSE;
- tostdout = FALSE;
- splitme = TRUE;
- blocksize = 1;
- postbegin = NULL;
- useslowsend = FALSE;
- nostatus = INTERACTIVE;
- setbuf(stdout, NULL);
- }
-
- if (useslowsend == TRUE) { /* last resort only - not recommended */
- quiet = FALSE;
- splitme = FALSE;
- if (blocksize > 1024) /* don't send too much all at once */
- blocksize = 1024;
- }
-
- if (line == NULL && (interactive == TRUE || tostdout == TRUE))
- error(FATAL, "a printer line must be supplied - use the -l option");
-
- if ((block = malloc(blocksize)) == NULL)
- error(FATAL, "no memory");
-
- endmesg = mesg + sizeof mesg - 2; /* one byte from last pos. in mesg */
-
- setupline(); /* configure the communications line */
- setupstdin(0); /* save current stdin term settings */
-
-}
-
-static void
-initialize_parallel(void)
-{
- if ((block = malloc(blocksize)) == NULL)
- error(FATAL, "no memory");
-}
-
-
-/*
- * Tries to put the printer in the IDLE state before anything important is sent.
- * Run as a single process no matter what has been assigned to splitme. Separate
- * read and write processes, if requested, will be created after we're done
- * here.
- */
-
-static void
-start(void)
-{
- int longwait = 0;
-
- logit("printer startup\n");
-
- currentstate = START;
- clearline();
-
- for (;;)
- switch (getstatus(1)) {
-
- case IDLE:
- case INTERACTIVE:
- if (postbegin != NULL && *postbegin != '\0')
- Write(ttyo, postbegin, strlen(postbegin));
- clearline();
- return;
-
- case BUSY:
- Write(ttyo, "\003", 1);
- Rest(1);
- break;
-
- /* 03/24/95 - bob golden
- * The HP LJ3 starts in waiting mode and needs the EOF to move
- * from waiting to idle. To see what would happen, code was added
- * to send the INTR on waiting and later changed to INTR/EOF.
- * The INTR by itself had no effect. The INTR/EOF put the
- * the printer in a busy status loop from which the only
- * recovery was to reset the printer. Until further testing
- * testing is done, do not send an INTR to a HPLJ3 in waiting
- * state. WAITING moved to a separate case to eliminate the
- * INTR write.
- */
- case WAITING:
- Write(ttyo, "\004", 1);
- Rest(1);
- break;
-
- /* 03/24/95 - bob golden
- * The HP LJ3 seems to process INTR at later times. All the
- * longwaits are increaased to reduce the number of INTRs sent.
- */
- case ERROR:
- case FLUSHING:
- Write(ttyo, "\004", 1);
- if (longwait++ == 5) {
- Write(ttyo, "\003", 1);
- Rest(5);
- longwait = 0;
- }
- Rest(1);
- break;
-
- case PRINTERERROR:
- Rest(15);
- break;
-
- case DISCONNECT:
- error(FATAL, "Disconnected - printer may be offline");
- break;
-
- /* 03/24/95 - bob golden
- * The ENDJOB case has been removed. The HP LJ3 echoes all EOFs
- * sent so the ENDJOB has no real meaning.
- */
- case UNKNOWN:
- clearline();
- break;
-
- default:
- Rest(1);
- break;
-
- } /* End switch */
-
-} /* End of start */
-
-
-/*
- *
- * If splitme is TRUE we fork a process, make the parent handle reading, and let
- * the child take care of writing. resetline() (file ifdef.c) contains all the
- * system dependent code needed to reset the communications line for separate
- * read and write processes. For now it's expected to return TRUE or FALSE and
- * that value controls whether we try the fork. I've only tested the two process
- * stuff for System V. Other versions of resetline() may just be dummy
- * procedures that always return FALSE. If the fork() failed previous versions
- * continued as a single process, although the implementation wasn't quite
- * right, but I've now decided to quit. The main reason is a Datakit channel
- * may be configured to flow control data in both directions, and if we run
- * postio over that channel as a single process we likely will end up in
- * deadlock.
- */
-
-static void
-split(void)
-{
- int pid;
-
- if (splitme == TRUE)
- if (resetline() == TRUE) {
- pid = getpid();
- signal(joinsig, interrupt);
- if ((otherpid = fork()) == -1)
- error(FATAL, "can't fork");
- else if (otherpid == 0) {
- whatami = WRITE;
- nostatus = WRITEPROCESS;
- otherpid = pid;
- setupstdin(1);
- } else
- whatami = READ;
- } else if (interactive == TRUE || tostdout == TRUE)
- error(FATAL,
- "can't create two process - check resetline()");
- else
- error(NON_FATAL,
- "running as a single process - check resetline()");
-
- canread = (whatami & READ) ? TRUE : FALSE;
- canwrite = (whatami & WRITE) ? TRUE : FALSE;
-}
-
-
-/*
- * Makes sure all the non-option command line arguments are processed. If there
- * aren't any arguments left when we get here we'll send stdin. Input files are
- * only read and sent to the printer if canwrite is TRUE. Checking it here means
- * we won't have to do it in send(). If interactive mode is TRUE we'll stay here
- * forever sending stdin when we run out of files - exit with a break. Actually
- * the loop is bogus and used at most once when we're in interactive mode
- * because stdin is in a pseudo raw mode and the read() in readblock() should
- * never see the end of file.
- */
-
-static void
-arguments(void)
-{
- int fd_in; /* next input file */
-
- if (canwrite == TRUE)
- do /* loop is for interactive mode */
- if (argc < 1)
- send(fileno(stdin), "pipe.end");
- else {
- while (argc > 0) {
- if ((fd_in = open(*argv, O_RDONLY)) == -1)
- error(FATAL, "can't open %s", *argv);
- send(fd_in, *argv);
- close(fd_in);
- argc--;
- argv++;
- }
- }
- while (interactive == TRUE);
-}
-
-/*
- * Sends file *name to the printer. There's nothing left here that depends on
- * sending and receiving status reports, although it can be reassuring to know
- * the printer is responding and processing our job. Only the writer gets here
- * in the two process implementation, and in that case split() has reset
- * nostatus to WRITEPROCESS and that's what getstatus() always returns. For
- * now we accept the IDLE state and ENDOFJOB as legitimate and ignore the
- * INITIALIZING state.
- *
- * fd_in next input file
- * name it's pathname
- */
-
-static void
-send(int fd_in, char *name)
-{
- if (interactive == FALSE)
- logit("sending file %s\n", name);
-
- currentstate = SEND;
-
- if (useslowsend == TRUE) {
- slowsend(fd_in);
- return;
- }
-
- while (readblock(fd_in))
-
- switch (getstatus(0)) {
-
- case IDLE:
- case BUSY:
- case WAITING:
- case PRINTING:
- case ENDOFJOB:
- case PRINTERERROR:
- case UNKNOWN:
- case NOSTATUS:
- case WRITEPROCESS:
- case INTERACTIVE:
- writeblock();
- break;
-
- case ERROR:
- fprintf(stderr, "%s", mesg); /* for csw */
- error(USER_FATAL, "PostScript Error");
- break;
-
- case FLUSHING:
- error(USER_FATAL, "Flushing Job");
- break;
-
- case DISCONNECT:
- error(FATAL, "Disconnected - printer may be offline");
- break;
-
- }
-
-}
-
-
-/*
- * Tries to stay connected to the printer until we're reasonably sure the job is
- * complete. It's the only way we can recover error messages or data generated
- * by the PostScript program and returned over the communication line. Actually
- * doing it correctly for all possible PostScript jobs is more difficult that it
- * might seem. For example if we've sent several jobs, each with their own EOF
- * mark, then waiting for ENDOFJOB won't guarantee all the jobs have completed.
- * Even waiting for IDLE isn't good enough. Checking for the WAITING state after
- * all the files have been sent and then sending an EOF may be the best
- * approach, but even that won't work all the time - we could miss it or might
- * not get there. Even sending our own special PostScript job after all the
- * input files has it's own different set of problems, but probably could work
- * (perhaps by printing a fake status message or just not timing out). Anyway
- * it's probably not worth the trouble so for now we'll quit if writedone is
- * TRUE and we get ENDOFJOB or IDLE.
- *
- * If we're running separate read and write processes the reader gets here after
- * after split() while the writer goes to send() and only gets here after all
- * the input files have been transmitted. When they're both here the writer
- * sends the reader signal joinsig and that forces writedone to TRUE in the
- * reader. At that point the reader can begin looking for an indication of the
- * end of the job. The writer hangs around until the reader kills it (usually
- * in cleanup()) sending occasional status requests.
- */
-
-static void
-done(void)
-{
- int sleeptime = 15; /* for 'out of paper' etc. */
- int longwait = 0;
-
- if (canwrite == TRUE)
- logit("waiting for end of job\n");
-
- currentstate = DONE;
- writedone = (whatami == READWRITE) ? TRUE : FALSE;
-
- for (;;) {
-
- switch (getstatus(1)) {
- case WRITEPROCESS:
- if (writedone == FALSE) {
- sendsignal(joinsig);
- Write(ttyo, "\004", 1);
- writedone = TRUE;
- sleeptime = 1;
- }
- Rest(sleeptime++);
- break;
-
- /* 03/24/95 - bob golden
- * For the HP LJ3 INTR sent while in the waiting state have
- * either had no effect or put the printer into a unrecoverable
- * loop. Further testing may reveal this to not be the case
- * but for now, remove the send INTR.
- */
- case WAITING:
- Write(ttyo, "\004", 1);
- Rest(1);
- sleeptime = 15;
- break;
-
- /* 03/24/95 - bob golden
- * ENDOFJOB case removed here. The HP LJ 3 echoes all EOFs sent so
- * the ENDOFJOB case is meaningless.
- */
- case IDLE:
- if (writedone == TRUE) {
- logit("job complete\n");
- return;
- }
- break;
-
- /* 03/24/95 - bob golden
- * During print data transmission, the HP LJ3 stays in
- * status busy. So give it a rest.
- *
- */
- case BUSY:
- case PRINTING:
- Rest(1);
- sleeptime = 15;
- break;
-
- case INTERACTIVE:
- Write(ttyo, "\004", 1);
- sleeptime = 15;
- break;
-
- case PRINTERERROR:
- Rest(sleeptime++);
- break;
-
- case ERROR:
- Write(ttyo, "\004", 1);
- fprintf(stderr, "%s", mesg); /* for csw */
- error(USER_FATAL, "PostScript Error");
- return;
-
- case FLUSHING:
- Write(ttyo, "\004", 1);
- error(USER_FATAL, "Flushing Job");
- return;
-
- case DISCONNECT:
- error(FATAL, "Disconnected - printer may be offline");
- return;
-
- /* 03/24/95 - bob golden
- * These cases are ignored without a EOF being sent
- */
- case ENDOFJOB:
- case NOSTATUS:
- Rest(1);
- break;
-
- default:
- Write(ttyo, "\004", 1);
- Rest(1);
- break;
-
- }
-
- if (sleeptime > 60)
- sleeptime = 60;
-
- }
-
-}
-
-
-/*
- * Only needed if we're running separate read and write processes. Makes sure
- * the write process is killed after the read process has successfully finished
- * with all the jobs. sendsignal() returns a -1 if there's nobody to signal so
- * things work when we're running a single process.
- */
-
-static void
-cleanup(void)
-{
- int w;
-
- while (sendsignal(SIGKILL) != -1 && (w = wait((int *)0)) != otherpid &&
- w != -1);
- if ( currentstate != NOTCONNECTED )
- Write(ttyo, "\004", 1);
-}
-
-
-/*
- * Fills the input buffer with the next block, provided we're all done with the
- * last one. Blocks from fd_in are stored in array block[]. head is the index
- * of the next byte in block[] that's supposed to go to the printer. tail points
- * one past the last byte in the current block. head is adjusted in writeblock()
- * after each successful write, while head and tail are reset here each time
- * a new block is read. Returns the number of bytes left in the current block.
- * Read errors cause the program to abort. The fake status message that's put
- * out in quiet mode is only so you can look at the log file and know
- * something's happening - take it out if you want.
- */
-
-int
-readblock(int fd_in)
-{
- static long blocknum = 1;
-
- if (head >= tail) { /* done with the last block */
- if ((tail = read(fd_in, block, blocksize)) == -1)
- error(FATAL, "error reading input file");
- if (quiet == TRUE && tail > 0) /* put out a fake message? */
- logit("%%%%[ status: busy; block: %d ]%%%%\n", blocknum++);
- head = 0;
- }
-
- return (tail - head);
-
-}
-
-
-/*
- * Called from send() when it's OK to send the next block to the printer. head
- * is adjusted after the write, and the number of bytes that were successfully
- * written is returned to the caller.
- */
-
-static int
-writeblock(void)
-{
- int count; /* bytes successfully written */
-
- if ((count = write(ttyo, &block[head], tail - head)) == -1)
- error(FATAL, "error writing to %s", line);
- else if (count == 0)
- error(FATAL, "printer appears to be offline");
-
- head += count;
- return (count);
-
-}
-
-
-/*
- * Looks for things coming back from the printer on the communications line,
- * parses complete lines retrieved by readline(), and returns an integer
- * representation of the current printer status to the caller. If nothing was
- * available a status request (control T) is sent to the printer and nostatus
- * is returned to the caller (provided quiet isn't TRUE). Interactive mode
- * either never returns from readline() or returns FALSE.
- */
-
-int
-getstatus(int t) /* sleep time after sending '\024' */
-{
- int state = nostatus; /* the current state */
- static int laststate = NOSTATUS; /* last state recognized */
-
-
- if (canread == TRUE && readline() == TRUE) {
- state = parsemesg();
- if (state != laststate || mesgptr != mesg || debug == ON)
- logit("%s", mesg);
-
- if (tostdout == TRUE && currentstate != START) {
- *mesgptr = '\0';
- fprintf(stdout, "%s", mesg);
- }
- return (laststate = state);
- }
-
- if ((quiet == FALSE || currentstate != SEND) && interactive == FALSE) {
- if (Write(ttyo, "\024", 1) != 1)
- error(FATAL, "printer appears to be offline");
- if (t > 0) Rest(t);
- }
-
- return (nostatus);
-}
-
-
-/*
- *
- * Parsing the lines that readline() stores in mesg[] is messy, and what's done
- * here isn't completely correct nor as fast as it could be. The general format
- * of lines that come back from the printer (assuming no data loss) is:
- *
- * str%%[ key: val; key: val; key: val ]%%\n
- *
- * where str can be most anything not containing a newline and printer reports
- * (eg. status or error messages) are bracketed by "%%[ " and " ]%%" strings and
- * end with a newline. Usually we'll have the string or printer report but not
- * both. For most jobs the leading string will be empty, but could be anything
- * generated on a printer and returned over the communications line using the
- * PostScript print operator. I'll assume PostScript jobs are well behaved and
- * never bracket their messages with "%%[ " and " ]%%" strings that delimit
- * status or error messages.
- *
- * Printer reports consist of one or more key/val pairs, and what we're
- * interested in (status or error indications) may not be the first pair in the
- * list. In addition we'll sometimes want the value associated with a keyword
- * (eg. when key = status) and other times we'll want the keyword (eg. when
- * key = Error or Flushing). The last pair isn't terminated by a semicolon and
- * a value string often contains many space separated words and it can even
- * include colons in meaningful places. I've also decided to continue
- * converting things to lower case before doing the lookup in status[]. The
- * isupper() test is for Berkeley systems.
- */
-
-static int
-parsemesg(void)
-{
- char *e; /* end of printer message in mesg[] */
- char *key, *val; /* keyword/value strings in sbuf[] */
- char *p; /* for converting to lower case etc. */
- int i; /* where *key was found in status[] */
-
- if (*(mesgptr = find("%%[ ", mesg)) != '\0' &&
- *(e = find(" ]%%", mesgptr+4)) != '\0') {
-
- strcpy(sbuf, mesgptr+4); /* don't change mesg[] */
- sbuf[e-mesgptr-4] = '\0'; /* ignore the trailing " ]%%" */
-
- for (key = strtok(sbuf, " :"); key != NULL;
- key = strtok(NULL, " :")) {
- if ((val = strtok(NULL, ";")) != NULL &&
- strcmp(key, "status") == 0)
- key = val;
-
- for (; *key == ' '; key++); /* skip leading space */
- for (p = key; *p; p++) /* conv to lower case */
- if (*p == ':' || *p == ',') {
- *p = '\0';
- break;
- } else if (isupper(*p))
- *p = tolower(*p);
-
- for (i = 0; status[i].state != NULL; i++)
- if (strcmp(status[i].state, key) == 0)
- return (status[i].val);
- }
- } else if (strcmp(mesg, "CONVERSATION ENDED.\n") == 0)
- return (DISCONNECT);
-
- return (nostatus);
-}
-
-
-/*
- * Looks for *str1 in string *str2. Returns a pointer to the start of the
- * substring if it's found or to the end of string str2 otherwise.
- */
-
-static char *
-find(char *str1, char *str2)
-{
- char *s1, *s2; /* can't change str1 or str2 too fast */
-
- for (; *str2 != '\0'; str2++) {
- for (s1 = str1, s2 = str2; *s1 != '\0' && *s1 == *s2; s1++, s2++);
- if (*s1 == '\0')
- break;
- }
-
- return (str2);
-
-}
-
-
-/*
- * Reads characters from the input line until nothing's left. Don't do
- * anything if we're currently running separate read and write processes.
- */
-
-static void
-clearline(void)
-{
- if (whatami == READWRITE)
- while (readline() != FALSE);
-
-}
-
-
-/*
- * Sends signal sig to the other process if we're running as separate read and
- * write processes. Returns the result of the kill if there's someone else to
- * signal or -1 if we're running alone.
- *
- */
-
-static int
-sendsignal(int sig)
-{
- if (whatami != READWRITE && otherpid > 1)
- return (kill(otherpid, sig));
-
- return (-1);
-}
-
-
-/*
- * Caught a signal - all except joinsig cause the program to quit. joinsig is
- * the signal sent by the writer to the reader after all the jobs have been
- * transmitted. Used to tell the read process when it can start looking for
- * the end of the job.
- */
-
-static void
-interrupt(int sig)
-{
- signal(sig, SIG_IGN);
-
- if (sig != joinsig) {
- x_stat |= FATAL;
- if (canread == TRUE)
- if (interactive == FALSE)
- error(NON_FATAL, "signal %d abort", sig);
- else error(NON_FATAL, "quitting");
- quit(sig);
- }
-
- writedone = TRUE;
- signal(joinsig, interrupt);
-}
-
-
-/*
- * Simple routine that's used to write a message to the log file.
- */
-
-void
-logit(char *mesg, ...)
-{
- va_list ap;
-
- va_start(ap, mesg);
- vfprintf(fp_log, mesg, ap);
- va_end(ap);
-
- fflush(fp_log);
-
-}
-
-/*
- * Called when we've run into some kind of program error. First *mesg is
- * printed. If kind is FATAL and we're not ignoring errors the program
- * will be terminated. If mesg is NULL or *mesg is the NULL string nothing
- * will be printed.
- */
-
-void
-error(int kind, char *mesg, ...)
-{
- va_list ap;
-
- if (mesg != NULL && *mesg != '\0') {
- fprintf(fp_log, "%s: ", prog_name);
-
- va_start(ap, mesg);
- vfprintf(fp_log, mesg, ap);
- va_end(ap);
-
- putc('\n', fp_log);
- }
-
- x_stat |= kind;
-
- if (kind != NON_FATAL && ignore == OFF)
- quit(SIGTERM);
-
-}
-
-
-/*
- *
- * Makes sure everything is properly cleaned up if there's a signal or FATAL
- * error that should cause the program to terminate. The sleep by the write
- * process is to help give the reset sequence a chance to reach the printer
- * before we break the connection - primarily for printers connected to Datakit.
- * There's a very slight chance the reset sequence that's sent to the printer
- * could get us stuck here. Simplest solution is don't bother to send it -
- * everything works without it. Flushing ttyo would be better, but means yet
- * another system dependent procedure in ifdef.c! I'll leave things be for now.
- */
-
-static void
-quit(int sig)
-{
- int w;
-
- signal(sig, SIG_IGN);
- ignore = ON;
-
- while (sendsignal(sig) != -1 && (w = wait((int *)0)) != otherpid &&
- w != -1);
-
- setupstdin(2);
-
- if (currentstate != NOTCONNECTED)
- Write(ttyo, "\003\004", 2);
- alarm(0); /* prevents sleep() loop on V9 systems */
- Rest(2);
-
- exit(x_stat);
-
-}
-
-
-/*
- * Used to replace sleep() calls. Only needed if we're running the program as
- * a read and write process and don't want to have the read process sleep. Most
- * sleeps are in the code because of the non-blocking read used by the single
- * process implementation. Probably should be a macro.
- */
-
-static void
-Rest(int t)
-{
- if (t > 0 && canwrite == TRUE)
- sleep(t);
-
-}
-
-
-/*
- * Used to replace some of the read() calls. Only needed if we're running
- * separate read and write processes. Should only be used to replace read calls
- * on ttyi. Always returns 0 to the caller if the process doesn't have its
- * READ flag set. Probably should be a macro.
- */
-
-#ifdef NEVER
-
-static int
-Read(int fd, char *buf, int n)
-{
- int count;
-
- if (canread == TRUE) {
- if ((count = read(fd, buf, n)) == -1 && errno == EINTR)
- count = 0;
- } else count = 0;
-
- return (count);
-
-}
-
-#endif /* NEVER */
-
-
-/*
- *
- * Used to replace some of the write() calls. Again only needed if we're running
- * separate read and write processes. Should only be used to replace write calls
- * on ttyo. Always returns n to the caller if the process doesn't have its WRITE
- * flag set. Should also probably be a macro.
- *
- */
-
-static int
-Write(int fd, char *buf, int n)
-{
- int count;
-
- if (canwrite == TRUE) {
- if ((count = write(fd, buf, n)) == -1 && errno == EINTR)
- count = n;
- } else count = n;
-
- return (count);
-}
diff --git a/usr/src/cmd/lp/filter/postscript/postio/postio.h b/usr/src/cmd/lp/filter/postscript/postio/postio.h
deleted file mode 100644
index d9dbb7ccce..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postio/postio.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#ifndef _POSTIO_POSTIO_H
-#define _POSTIO_POSTIO_H
-
-/*
- *
- * Definitions used by the program that sends jobs to PostScript printers.
- *
- * POSTBEGIN, if it's not NULL, is some PostScript code that's sent to the
- * printer before any of the input files. It's not terribly important since
- * the same thing can be accomplished in other ways, but this approach is
- * convenient. POSTBEGIN is initialized so as to disable job timeouts. The
- * string can also be set on the command line using the -P option.
- *
- */
-
-#define POSTBEGIN "%!PS\nstatusdict /waittimeout 0 put\n"
-
-/*
- * The following help determine where postio is when it's running - either
- * in the START, SEND, or DONE states. Primarily controls what's done in
- * getstatus().
- * RADIAN occasionally had problems with two way conversations. Anyway this
- * stuff can be used to prevent status queries while we're transmitting a
- * job. Enabled by the -q option.
- *
- */
-
-#define NOTCONNECTED 0
-#define START 1
-#define SEND 2
-#define DONE 3
-
-/*
- * Previous versions of postio only ran as a single process. That was (and
- * still * is) convenient, but meant we could only flow control one direction.
- * Data coming back from the printer occasionally got lost, but that didn't
- * often hurt (except for lost error messages). Anyway I've added code that
- * lets you split the program into separate read and write processes, thereby
- * helping to prevent data loss in both directions. It should be particularly
- * useful when you're sending a job that you expect will be returning useful
- * data over the communications line.
- *
- * The next three definitions control what's done with data on communications
- * line. The READ flag means the line can be read, while the WRITE flag means
- * it can be written. When we're running as a single process both flags are
- * set. I tried to overlay the separate read/write process code on what was
- * there and working for one process. The implementation isn't as good as it
- * could be, but should be safe. The single process version still works,
- * and remains the default.
- */
-
-#define READ 1
-#define WRITE 2
-#define READWRITE 3
-
-/*
- * Messages generated on the printer and returned over the communications line
- * look like,
- *
- * %%[ status: idle; source: serial 25 ]%%
- * %%[ status: waiting; source: serial 25 ]%%
- * %%[ status: initializing; source: serial 25 ]%%
- * %%[ status: busy; source: serial 25 ]%%
- * %%[ status: printing; source: serial 25 ]%%
- * %%[ status: PrinterError: out of paper; source: serial 25 ]%%
- * %%[ status: PrinterError: no paper tray; source: serial 25 ]%%
- *
- * %%[ PrinterError: out of paper; source: serial 25 ]%%
- * %%[ PrinterError: no paper tray; source: serial 25 ]%%
- *
- * %%[ Error: undefined; OffendingCommand: xxx ]%%
- * %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
- *
- * although the list isn't meant to be complete.
- *
- * The following constants are used to classify the recognized printer states.
- * readline() reads complete lines from ttyi and stores them in array mesg[].
- * getstatus() looks for the "%%[ " and " ]%%" delimiters that bracket printer
- * messages and if found it tries to parse the enclosed message. After the
- * lookup one of the following numbers is returned as an indication of the
- * existence or content of the printer message. The return value is used in
- * start(), send(), and done() to figure out what's happening and what can
- * be done next.
- */
-
-#define BUSY 0 /* processing data already sent */
-#define WAITING 1 /* printer wants more data */
-#define PRINTING 2 /* printing a page */
-#define IDLE 3 /* ready to start the next job */
-#define ENDOFJOB 4 /* readline() builds this up on EOF */
-#define PRINTERERROR 5 /* PrinterError - eg. out of paper */
-#define ERROR 6 /* some kind of PostScript error */
-#define FLUSHING 7 /* throwing out the rest of the job */
-#define INITIALIZING 8 /* printer is booting */
-#define DISCONNECT 9 /* from Datakit! */
-#define UNKNOWN 10 /* in case we missed anything */
-#define NOSTATUS 11 /* no response from the printer */
-
-#define WRITEPROCESS 12 /* dummy states for write process */
-#define INTERACTIVE 13 /* and interactive mode */
-
-/*
- * An array of type Status is used, in getstatus(), to figure out the printer's
- * current state. Just helps convert strings representing the current state into
- * integer codes that other routines use.
- */
-
-typedef struct {
-
- char *state; /* printer's current status */
- int val; /* value returned by getstatus() */
-
-} Status;
-
-/*
- * STATUS is used to initialize an array of type Status that translates the
- * ASCII strings returned by the printer into appropriate codes that can be
- * used later on in the program. getstatus() converts characters to lower
- * case, so if you add any entries make them lower case and put them in
- * before the UNKNOWN entry.
- * The lookup terminates when we get a match or when an entry with a NULL state
- * is found.
- *
- */
-
-#define STATUS \
- \
- { \
- "busy", BUSY, \
- "waiting", WAITING, \
- "printing", PRINTING, \
- "idle", IDLE, \
- "endofjob", ENDOFJOB, \
- "printererror", PRINTERERROR, \
- "error", ERROR, \
- "flushing", FLUSHING, \
- "initializing", INITIALIZING, \
- NULL, UNKNOWN \
- }
-
-/*
- *
- * The baud rate can be set on the command line using the -b option. If you omit
- * it BAUDRATE will be used.
- *
- */
-
-#define BAUDRATE B9600
-
-/*
- *
- * An array of type Baud is used, in routine getbaud(), to translate ASCII
- * strings into termio values that represent the requested baud rate.
- *
- */
-
-typedef struct {
-
- char *rate; /* string identifying the baud rate */
- short val; /* and its termio.h value */
-
-} Baud;
-
-/*
- *
- * BAUDTABLE initializes the array that's used to translate baud rate requests
- * into termio values. It needs to end with an entry that has NULL assigned to
- * the rate field.
- *
- */
-
-#define BAUDTABLE \
- \
- { \
- "9600", B9600, \
- "B9600", B9600, \
- "19200", EXTA, \
- "19.2", EXTA, \
- "B19200", EXTA, \
- "EXTA", EXTA, \
- "1200", B1200, \
- "B1200", B1200, \
- "2400", B2400, \
- "B2400", B2400, \
- "B4800", B4800, \
- "4800", B4800, \
- "38400", EXTB, \
- "38.4", EXTB, \
- "B38400", EXTB, \
- "EXTB", EXTB, \
- "57600", B57600, \
- "57.6", B57600, \
- "76800", B76800, \
- "76.8", B76800, \
- "115200", B115200, \
- "115.2", B115200, \
- "153600", B153600, \
- "153.6", B153600, \
- "230400", B230400, \
- "230.4", B230400, \
- "307200", B307200, \
- "307.2", B307200, \
- "460800", B460800, \
- "460.8", B460800, \
- "921600", B921600, \
- "921.6", B921600, \
- NULL, B9600 \
- }
-
-/*
- *
- * A few miscellaneous definitions. BLOCKSIZE is the default size of the buffer
- * used for reading the input files (changed with the -B option). MESGSIZE is
- * the size of the character array used to store printer status lines - don't
- * make it too small!
- *
- */
-
-#define BLOCKSIZE 2048
-#define MESGSIZE 512
-
-#endif /* _POSTIO_POSTIO_H */
diff --git a/usr/src/cmd/lp/filter/postscript/postio/slowsend.c b/usr/src/cmd/lp/filter/postscript/postio/slowsend.c
deleted file mode 100644
index 618ebf36a3..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postio/slowsend.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/*
- *
- * Stuff that slows the transmission of jobs to PostScript printers. ONLY use it
- * if you appear to be having trouble with flow control. The idea is simple - only
- * send a significant amount of data when we're certain the printer is in the
- * WAITING state. Depends on receiving status messages and only works when the
- * program is run as a single process. What's done should stop printer generated
- * XOFFs - provided our input buffer (ie. blocksize) is sufficiently small. Was
- * originally included in the postio.tmp directory, but can now be requested with
- * the -S option. Considered eliminating this code, but some printers still depend
- * on it. In particular Datakit connections made using Datakit PVCs and DACUs seem
- * to have the most problems. Much of the new stuff that was added can't work when
- * you use this code.
- *
- */
-
-
-#include <stdio.h>
-
-#include "gen.h"
-#include "postio.h"
-
-
-extern char *block;
-extern int blocksize;
-extern int head;
-extern int tail;
-extern char *line;
-extern char mesg[];
-extern int ttyo;
-
-static int writeblock(int);
-
-/*****************************************************************************/
-
-
-void
-slowsend(int fd_in)
- /* next input file */
-{
-
-/*
- *
- * A slow version of send() that's very careful about when data is sent to the
- * printer. Should help prevent overflowing the printer's input buffer, provided
- * blocksize is sufficiently small (1024 should be safe). It's a totally kludged
- * up routine that should ONLY be used if you have constant transmission problems.
- * There's really no way it will be able to drive a printer much faster that about
- * six pages a minute, even for the simplest jobs. Get it by using the -S option.
- *
- */
-
-
- while ( readblock(fd_in) )
-
- switch ( getstatus(0) ) {
-
- case WAITING:
- writeblock(blocksize);
- break;
-
- case BUSY:
- case IDLE:
- case PRINTING:
- writeblock(30);
- break;
-
- case NOSTATUS:
- case UNKNOWN:
- break;
-
- case PRINTERERROR:
- sleep(30);
- break;
-
- case ERROR:
- fprintf(stderr, "%s", mesg); /* for csw */
- error(FATAL, "PostScript Error");
- break;
-
- case FLUSHING:
- error(FATAL, "Flushing Job");
- break;
-
- case DISCONNECT:
- error(FATAL, "Disconnected - printer may be offline");
- break;
-
- default:
- sleep(2);
- break;
-
- } /* End switch */
-
-} /* End of send */
-
-
-/*****************************************************************************/
-
-
-static int
-writeblock(int num)
- /* most bytes we'll write */
-{
- int count; /* bytes successfully written */
-
-/*
- *
- * Called from send() when it's OK to send the next block to the printer. head
- * is adjusted after the write, and the number of bytes that were successfully
- * written is returned to the caller.
- *
- */
-
-
- if ( num > tail - head )
- num = tail - head;
-
- if ( (count = write(ttyo, &block[head], num)) == -1 )
- error(FATAL, "error writing to %s", line);
- else if ( count == 0 )
- error(FATAL, "printer appears to be offline");
-
- head += count;
- return(count);
-
-} /* End of writeblock */
-
-
-/*****************************************************************************/
-
diff --git a/usr/src/cmd/lp/filter/postscript/postprint/Makefile b/usr/src/cmd/lp/filter/postscript/postprint/Makefile
deleted file mode 100644
index 94c2451fbe..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postprint/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/postprint/Makefile
-#
-
-include ../../../Makefile.lp
-
-PROG= postprint
-
-SRCS= postprint.c
-
-OBJS = $(SRCS:%.c=%.o)
-
-COMMONDIR = ../common
-
-COMMONOBJS = $(COMMONDIR)/request.o \
- $(COMMONDIR)/glob.o \
- $(COMMONDIR)/misc.o
-
-TXTS= README
-
-ENCODING = 2
-CPPFLAGS = -DDFLTENCODING=$(ENCODING) \
- -I. -I$(COMMONDIR) \
- $(CPPFLAGS.master)
-
-POFILE = lp_filter_postscript_postprint.po
-
-.KEEP_STATE:
-
-all: $(TXTS) $(PROG)
-
-install: all $(ROOTLIBLPPOSTPROG)
-
-$(PROG): $(OBJS) $(COMMONOBJS)
- $(LINK.c) -o $@ $(OBJS) $(COMMONOBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-$(COMMONOBJS): $$(@:%.o=%.c)
- cd $(@D); $(MAKE) $(@F)
-
-clean:
- $(RM) $(OBJS)
-
-strip:
- $(STRIP) $(PROG)
-
-lint: lint_SRCS
-
-include ../../../../Makefile.targ
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/filter/postscript/postprint/README b/usr/src/cmd/lp/filter/postscript/postprint/README
deleted file mode 100644
index 1d67e506d4..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postprint/README
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Source code for a simple program that translates ASCII files into PostScript. The
-only important change, besides the restructuring that's been applied to all the
-translators, is the addition of the -r option that controls how carriage returns
-are handled. As in previous versions the default behavior is to ignore carriage
-returns. The two other choices are to return to column 1 (-r1 option) or treat
-carriage returns as newlines (-r2 option). You can modify the default behavior by
-changing the initialization of crmode (near line 98) in postprint.c.
-
-Things have been tuned for PostScript printers running at 9600 baud, and may not
-be optimal for fast printers running at higher baud rates. A few simple changes
-here and in ../postscript/postprint.ps could help if throughput seems to be
-lacking:
-
- 1) Near line 755 in postprint.c change
-
- fprintf(fp_out, ")%d L\n", stringstart-1);
-
- to
-
- fprintf(fp_out, ")%d %d L\n", stringstart-1, stringcount);
-
- Then change the definition of procedure L in ../postscript/postprint.ps
- to,
-
- /L {
- {charwidth mul currentpoint exch pop show} repeat
- linespace add dup 0 exch moveto
- } bind def
-
- 2) Change the upper limit test near line 694 (procedure spaces()) in postprint.c
- from 6 to something bigger. Output files will be larger, but will run faster
- when they get to the printer. Should help if you're running at 19.2KB or
- higher.
-
- 3) Adjust the scaling set in procedure setup in ../postscript/postprint.ps so
- 1 unit corresponds to the line spacing. Then replace 'linespace add' in
- procedures l and L by '1 sub'. It's a little tricky, but I've tried it and
- it does work.
-
diff --git a/usr/src/cmd/lp/filter/postscript/postprint/postprint.c b/usr/src/cmd/lp/filter/postscript/postprint/postprint.c
deleted file mode 100644
index 49fe4bb3df..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postprint/postprint.c
+++ /dev/null
@@ -1,926 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- *
- * postprint - PostScript translator for ASCII files.
- *
- * A simple program that translates ASCII files into PostScript. All it really
- * does is expand tabs and backspaces, handle character quoting, print text lines,
- * and control when pages are started based on the requested number of lines per
- * page.
- *
- * The PostScript prologue is copied from *prologue before any of the input files
- * are translated. The program expects that the following procedures are defined
- * in that file:
- *
- * setup
- *
- * mark ... setup -
- *
- * Handles special initialization stuff that depends on how the program
- * was called. Expects to find a mark followed by key/value pairs on the
- * stack. The def operator is applied to each pair up to the mark, then
- * the default state is set up.
- *
- * pagesetup
- *
- * page pagesetup -
- *
- * Does whatever is needed to set things up for the next page. Expects
- * to find the current page number on the stack.
- *
- * l
- *
- * string l -
- *
- * Prints string starting in the first column and then goes to the next
- * line.
- *
- * L
- *
- * mark string column string column ... L mark
- *
- * Prints each string on the stack starting at the horizontal position
- * selected by column. Used when tabs and spaces can be sufficiently well
- * compressed to make the printer overhead worthwhile. Always used when
- * we have to back up.
- *
- * done
- *
- * done
- *
- * Makes sure the last page is printed. Only needed when we're printing
- * more than one page on each sheet of paper.
- *
- * Almost everything has been changed in this version of postprint. The program
- * is more intelligent, especially about tabs, spaces, and backspacing, and as a
- * result output files usually print faster. Output files also now conform to
- * Adobe's file structuring conventions, which is undoubtedly something I should
- * have done in the first version of the program. If the number of lines per page
- * is set to 0, which can be done using the -l option, pointsize will be used to
- * guess a reasonable value. The estimate is based on the values of LINESPP,
- * POINTSIZE, and pointsize, and assumes LINESPP lines would fit on a page if
- * we printed in size POINTSIZE. Selecting a point size using the -s option and
- * adding -l0 to the command line forces the guess to be made.
- *
- * Many default values, like the magnification and orientation, are defined in
- * the prologue, which is where they belong. If they're changed (by options), an
- * appropriate definition is made after the prologue is added to the output file.
- * The -P option passes arbitrary PostScript through to the output file. Among
- * other things it can be used to set (or change) values that can't be accessed by
- * other options.
- *
- */
-
-
-#include <stdio.h>
-#include <signal.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "comments.h" /* PostScript file structuring comments */
-#include "gen.h" /* general purpose definitions */
-#include "path.h" /* for the prologue */
-#include "ext.h" /* external variable declarations */
-#include "postprint.h" /* a few special definitions */
-
-
-char *optnames = "a:c:e:f:l:m:n:o:p:r:s:t:x:y:A:C:J:L:P:R:DI";
-
-char *prologue = POSTPRINT; /* default PostScript prologue */
-char *formfile = FORMFILE; /* stuff for multiple pages per sheet */
-char *locale = NULL;
-
-int formsperpage = 1; /* page images on each piece of paper */
-int copies = 1; /* and this many copies of each sheet */
-
-int linespp = LINESPP; /* number of lines per page */
-int pointsize = POINTSIZE; /* in this point size */
-int tabstops = TABSTOPS; /* tabs set at these columns */
-int crmode = 0; /* carriage return mode - 0, 1, or 2 */
-
-int col = 1; /* next character goes in this column */
-int line = 1; /* on this line */
-
-int stringcount = 0; /* number of strings on the stack */
-int stringstart = 1; /* column where current one starts */
-
-Fontmap fontmap[] = FONTMAP; /* for translating font names */
-char *fontname = "Courier"; /* use this PostScript font */
-
-int page = 0; /* page we're working on */
-int printed = 0; /* printed this many pages */
-
-FILE *fp_in = stdin; /* read from this file */
-FILE *fp_out = stdout; /* and write stuff here */
-FILE *fp_acct = NULL; /* for accounting data */
-
-static void account(void);
-static void arguments(void);
-static void done(void);
-static void endline(void);
-static void formfeed(void);
-static void header(void);
-static void init_signals(void);
-static void newline(void);
-static void options(void);
-static void oput(int);
-static void redirect(int);
-static void setup(void);
-static void spaces(int);
-static void startline(void);
-static void text(void);
-
-/*****************************************************************************/
-
-
-int
-main(int agc, char *agv[])
-{
-
-/*
- *
- * A simple program that translates ASCII files into PostScript. If there's more
- * than one input file, each begins on a new page.
- *
- */
-
-
- argc = agc; /* other routines may want them */
- argv = agv;
-
- prog_name = argv[0]; /* really just for error messages */
-
- init_signals(); /* sets up interrupt handling */
- header(); /* PostScript header and prologue */
- setup(); /* for PostScript */
- arguments(); /* followed by each input file */
- done(); /* print the last page etc. */
- account(); /* job accounting data */
-
- return (x_stat); /* not much could be wrong */
-
-} /* End of main */
-
-
-/*****************************************************************************/
-
-
-static void
-init_signals(void)
-{
- void interrupt(); /* signal handler */
-
-/*
- *
- * Makes sure we handle interrupts.
- *
- */
-
-
- if ( signal(SIGINT, interrupt) == SIG_IGN ) {
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
- } else {
- signal(SIGHUP, interrupt);
- signal(SIGQUIT, interrupt);
- } /* End else */
-
- signal(SIGTERM, interrupt);
-
-} /* End of init_signals */
-
-
-/*****************************************************************************/
-
-
-static void
-header(void)
-{
- int ch; /* return value from getopt() */
- int old_optind = optind; /* for restoring optind - should be 1 */
-
-/*
- *
- * Scans the option list looking for things, like the prologue file, that we need
- * right away but could be changed from the default. Doing things this way is an
- * attempt to conform to Adobe's latest file structuring conventions. In particular
- * they now say there should be nothing executed in the prologue, and they have
- * added two new comments that delimit global initialization calls. Once we know
- * where things really are we write out the job header, follow it by the prologue,
- * and then add the ENDPROLOG and BEGINSETUP comments.
- *
- */
-
-
- while ( (ch = getopt(argc, argv, optnames)) != EOF )
- if ( ch == 'L' )
- prologue = optarg;
- else if ( ch == '?' )
- error(FATAL, "");
-
- optind = old_optind; /* get ready for option scanning */
-
- fprintf(stdout, "%s", CONFORMING);
- fprintf(stdout, "%s %s\n", CREATOR, "%M%");
- fprintf(stdout, "%s %s\n", VERSION, "%I%");
- fprintf(stdout, "%s %s\n", DOCUMENTFONTS, ATEND);
- fprintf(stdout, "%s %s\n", PAGES, ATEND);
- fprintf(stdout, "%s", ENDCOMMENTS);
-
- options(); /* handle the command line options */
-
- if ( cat(prologue) == FALSE )
- error(FATAL, "can't read %s", prologue);
-
- fprintf(stdout, "%s", ENDPROLOG);
- fprintf(stdout, "%s", BEGINSETUP);
- fprintf(stdout, "mark\n");
-
-} /* End of header */
-
-
-/*****************************************************************************/
-
-
-static void
-options(void)
-{
- int ch; /* return value from getopt() */
- int euro = 0;
- extern char *getenv(char *);
-
-
-/*
- *
- * Reads and processes the command line options. Added the -P option so arbitrary
- * PostScript code can be passed through. Expect it could be useful for changing
- * definitions in the prologue for which options have not been defined.
- *
- * Although any PostScript font can be used, things will only work well for
- * constant width fonts.
- *
- */
-
- if (((locale = getenv("LC_MONETARY")) != NULL) ||
- ((locale = getenv("LANG")) != NULL)) {
- char *tmp = NULL;
-
- /* if there is a locale specific prologue, use it as the default */
- if ((tmp = calloc(1, strlen(POSTPRINT) + strlen(locale) + 2)) != NULL) {
- sprintf(tmp, "%s-%s", POSTPRINT, locale);
- if (access(tmp, R_OK) == 0)
- prologue = tmp;
- else
- free(tmp);
- }
-
- /* if the locale has 8859-15 or euro in it, add the symbol to font */
- if ((strstr(locale, "8859-15") != NULL) ||
- (strstr(locale, "euro") != NULL))
- euro = 1;
- }
-
- while ( (ch = getopt(argc, argv, optnames)) != EOF ) {
-#if defined(DEBUG)
- fprintf(stderr, " Opt: %c, arg: %s\n", ch, optarg);
-#endif
- switch ( ch ) {
-
- case 'a': /* aspect ratio */
- fprintf(stdout, "/aspectratio %s def\n", optarg);
- break;
-
- case 'c': /* copies */
- copies = atoi(optarg);
- fprintf(stdout, "/#copies %s store\n", optarg);
- break;
-
- case 'e': /* should we add the euro ? */
- euro = (strcasecmp(optarg, "on") == 0);
- break;
-
- case 'f': /* use this PostScript font */
- fontname = get_font(optarg);
- fprintf(stdout, "/font /%s def\n", fontname);
- break;
-
- case 'l': /* lines per page */
- linespp = atoi(optarg);
- break;
-
- case 'm': /* magnification */
- fprintf(stdout, "/magnification %s def\n", optarg);
- break;
-
- case 'n': /* forms per page */
- formsperpage = atoi(optarg);
-
- if (formsperpage <= 0) {
- /* set default value */
- formsperpage = 1;
- }
-
- fprintf(stdout, "/formsperpage %d def\n", formsperpage);
-
- break;
-
- case 'o': /* output page list */
- out_list(optarg);
- break;
-
- case 'p': /* landscape or portrait mode */
- if ( *optarg == 'l' )
- fprintf(stdout, "/landscape true def\n");
- else fprintf(stdout, "/landscape false def\n");
- break;
-
- case 'r': /* carriage return mode */
- crmode = atoi(optarg);
- break;
-
- case 's': /* point size */
- pointsize = atoi(optarg);
- fprintf(stdout, "/pointsize %s def\n", optarg);
- break;
-
- case 't': /* tabstops */
- tabstops = atoi(optarg);
-
- if (tabstops <= 0) {
- /* set default */
- tabstops = TABSTOPS;
- }
-
- break;
-
- case 'x': /* shift things horizontally */
- fprintf(stdout, "/xoffset %s def\n", optarg);
- break;
-
- case 'y': /* and vertically on the page */
- fprintf(stdout, "/yoffset %s def\n", optarg);
- break;
-
- case 'A': /* force job accounting */
- case 'J':
- if ( (fp_acct = fopen(optarg, "a")) == NULL )
- error(FATAL, "can't open accounting file %s", optarg);
- break;
-
- case 'C': /* copy file straight to output */
- if ( cat(optarg) == FALSE )
- error(FATAL, "can't read %s", optarg);
- break;
-
- case 'L': /* PostScript prologue file */
- prologue = optarg;
- break;
-
- case 'P': /* PostScript pass through */
- fprintf(stdout, "%s\n", optarg);
- break;
-
- case 'R': /* special global or page level request */
- saverequest(optarg);
- break;
-
- case 'D': /* debug flag */
- debug = ON;
- break;
-
- case 'I': /* ignore FATAL errors */
- ignore = ON;
- break;
-
- case '?': /* don't understand the option */
- error(FATAL, "");
- break;
-
- default: /* don't know what to do for ch */
- error(FATAL, "missing case for option %c\n", ch);
- break;
-
- } /* End switch */
-
- } /* End while */
-
- if (euro != 0)
- fprintf(stdout, "/must-add-euro-to-font true def\n");
-
- argc -= optind; /* get ready for non-option args */
- argv += optind;
-
-} /* End of options */
-
-
-/*****************************************************************************/
-
-
-char *get_font(name)
-
-
- char *name; /* name the user asked for */
-
-
-{
-
-
- int i; /* for looking through fontmap[] */
-
-
-/*
- *
- * Called from options() to map a user's font name into a legal PostScript name.
- * If the lookup fails *name is returned to the caller. That should let you choose
- * any PostScript font, although things will only work well for constant width
- * fonts.
- *
- */
-
-
- for ( i = 0; fontmap[i].name != NULL; i++ )
- if ( strcmp(name, fontmap[i].name) == 0 )
- return(fontmap[i].val);
-
- return(name);
-
-} /* End of get_font */
-
-
-/*****************************************************************************/
-
-
-static void
-setup(void)
-{
-
-/*
- *
- * Handles things that must be done after the options are read but before the
- * input files are processed. linespp (lines per page) can be set using the -l
- * option. If it's not positive we calculate a reasonable value using the
- * requested point size - assuming LINESPP lines fit on a page in point size
- * POINTSIZE.
- *
- */
-
- writerequest(0, stdout); /* global requests eg. manual feed */
- fprintf(stdout, "setup\n");
-
- if ( formsperpage > 1 ) {
- if ( cat(formfile) == FALSE )
- error(FATAL, "can't read %s", formfile);
- fprintf(stdout, "%d setupforms\n", formsperpage);
- } /* End if */
-
- fprintf(stdout, "%s", ENDSETUP);
-
- if ( linespp <= 0 )
- linespp = LINESPP * POINTSIZE / pointsize;
-
-} /* End of setup */
-
-
-/*****************************************************************************/
-
-
-static void
-arguments(void)
-{
-
-/*
- *
- * Makes sure all the non-option command line arguments are processed. If we get
- * here and there aren't any arguments left, or if '-' is one of the input files
- * we'll translate stdin.
- *
- */
-
- if ( argc < 1 )
- text();
- else { /* at least one argument is left */
- while ( argc > 0 ) {
- if ( strcmp(*argv, "-") == 0 )
- fp_in = stdin;
- else if ( (fp_in = fopen(*argv, "r")) == NULL )
- error(FATAL, "can't open %s", *argv);
- text();
- if ( fp_in != stdin )
- fclose(fp_in);
- argc--;
- argv++;
- } /* End while */
- } /* End else */
-
-} /* End of arguments */
-
-
-/*****************************************************************************/
-
-
-static void
-done(void)
-{
-
-/*
- *
- * Finished with all the input files, so mark the end of the pages with a TRAILER
- * comment, make sure the last page prints, and add things like the PAGES comment
- * that can only be determined after all the input files have been read.
- *
- */
- if (printed % formsperpage != 0) { /* pad to ENDPAGE */
- while (printed % formsperpage) {
- printed++;
-
- fprintf(stdout, "save\n");
- fprintf(stdout, "mark\n");
- writerequest(printed, stdout);
- fprintf(stdout, "%d pagesetup\n", printed);
-
- fprintf(stdout, "cleartomark\n");
- fprintf(stdout, "showpage\n");
- fprintf(stdout, "restore\n");
- }
- fprintf(stdout, "%s %d %d\n", ENDPAGE, page, printed);
- }
-
- fprintf(stdout, "%s", TRAILER);
- fprintf(stdout, "done\n");
- fprintf(stdout, "%s %s\n", DOCUMENTFONTS, fontname);
- fprintf(stdout, "%s %d\n", PAGES, printed);
-
-} /* End of done */
-
-
-/*****************************************************************************/
-
-
-static void
-account(void)
-{
-
-/*
- *
- * Writes an accounting record to *fp_acct provided it's not NULL. Accounting is
- * requested using the -A or -J options.
- *
- */
-
- if ( fp_acct != NULL )
- fprintf(fp_acct, " print %d\n copies %d\n", printed, copies);
-
-} /* End of account */
-
-
-/*****************************************************************************/
-
-
-static void
-text(void)
-{
- int ch; /* next input character */
-
-/*
- *
- * Translates *fp_in into PostScript. All we do here is handle newlines, tabs,
- * backspaces, and quoting of special characters. All other unprintable characters
- * are totally ignored. The redirect(-1) call forces the initial output to go to
- * /dev/null. It's done to force the stuff that formfeed() does at the end of
- * each page to /dev/null rather than the real output file.
- *
- */
-
-
- redirect(-1); /* get ready for the first page */
- formfeed(); /* force PAGE comment etc. */
-
- while ( (ch = getc(fp_in)) != EOF )
-
- switch ( ch ) {
-
- case '\n':
- newline();
- break;
-
- case '\t':
- case '\b':
- case ' ':
- spaces(ch);
- break;
-
- case '\014':
- formfeed();
- break;
-
- case '\r':
- if ( crmode == 1 )
- spaces(ch);
- else if ( crmode == 2 )
- newline();
- break;
-
- case '(':
- case ')':
- case '\\':
- startline();
- putc('\\', fp_out);
-
-/*
- *
- * Fall through to the default case.
- *
- */
-
- default:
- if ( isascii(ch) && isprint(ch) )
- oput(ch);
- else {
-#define isintlprint(ch) ((ch)&0x80)
-#define isss(ch) 0
- if (isintlprint(ch) || isss(ch)) {
- startline();
- fprintf(fp_out, "\\%03o", 0xFF&ch);
- col++;
- }
- }
- break;
-
- } /* End switch */
-
- formfeed(); /* next file starts on a new page? */
-
-} /* End of text */
-
-
-/*****************************************************************************/
-
-
-static void
-formfeed(void)
-{
-
-/*
- *
- * Called whenever we've finished with the last page and want to get ready for the
- * next one. Also used at the beginning and end of each input file, so we have to
- * be careful about what's done. The first time through (up to the redirect() call)
- * output goes to /dev/null.
- *
- * Adobe now recommends that the showpage operator occur after the page level
- * restore so it can be easily redefined to have side-effects in the printer's VM.
- * Although it seems reasonable I haven't implemented it, because it makes other
- * things, like selectively setting manual feed or choosing an alternate paper
- * tray, clumsy - at least on a per page basis.
- *
- */
-
-
- if ( fp_out == stdout ) /* count the last page */
- printed++;
-
- endline(); /* print the last line */
-
- fprintf(fp_out, "cleartomark\n");
- fprintf(fp_out, "showpage\n");
- fprintf(fp_out, "restore\n");
- if (printed % formsperpage == 0)
- fprintf(fp_out, "%s %d %d\n", ENDPAGE, page, printed);
-
- if ( ungetc(getc(fp_in), fp_in) == EOF )
- redirect(-1);
- else redirect(++page);
-
- if (printed % formsperpage == 0)
- fprintf(fp_out, "%s %d %d\n", PAGE, page, printed+1);
- fprintf(fp_out, "save\n");
- fprintf(fp_out, "mark\n");
- writerequest(printed+1, fp_out);
- fprintf(fp_out, "%d pagesetup\n", printed+1);
-
- line = 1;
-
-} /* End of formfeed */
-
-
-/*****************************************************************************/
-
-
-static void
-newline(void)
-{
-
-/*
- *
- * Called when we've read a newline character. The call to startline() ensures
- * that at least an empty string is on the stack.
- *
- */
-
- startline();
- endline(); /* print the current line */
-
- if ( ++line > linespp ) /* done with this page */
- formfeed();
-
-} /* End of newline */
-
-
-/*****************************************************************************/
-
-
-static void
-spaces(int ch)
- /* next input character */
-{
- int endcol; /* ending column */
- int i; /* final distance - in spaces */
-
-/*
- *
- * Counts consecutive spaces, tabs, and backspaces and figures out where the next
- * string should start. Once that's been done we try to choose an efficient way
- * to output the required number of spaces. The choice is between using procedure
- * l with a single string on the stack and L with several string and column pairs.
- * We usually break even, in terms of the size of the output file, if we need four
- * consecutive spaces. More means using L decreases the size of the file. For now
- * if there are less than 6 consecutive spaces we just add them to the current
- * string, otherwise we end that string, follow it by its starting position, and
- * begin a new one that starts at endcol. Backspacing is always handled this way.
- *
- */
-
-
- startline(); /* so col makes sense */
- endcol = col;
-
- do {
- if ( ch == ' ' )
- endcol++;
- else if ( ch == '\t' )
- endcol += tabstops - ((endcol - 1) % tabstops);
- else if ( ch == '\b' )
- endcol--;
- else if ( ch == '\r' )
- endcol = 1;
- else break;
- } while ( ch = getc(fp_in) ); /* if ch is 0 we'd quit anyway */
-
- ungetc(ch, fp_in); /* wasn't a space, tab, or backspace */
-
- if ( endcol < 1 ) /* can't move past left edge */
- endcol = 1;
-
- if ( (i = endcol - col) >= 0 && i < 6 )
- for ( ; i > 0; i-- )
- oput((int)' ');
- else {
- fprintf(fp_out, ")%d(", stringstart-1);
- stringcount++;
- col = stringstart = endcol;
- } /* End else */
-
-} /* End of spaces */
-
-
-/*****************************************************************************/
-
-
-static void
-startline(void)
-{
-
-/*
- *
- * Called whenever we want to be certain we're ready to start pushing characters
- * into an open string on the stack. If stringcount is positive we've already
- * started, so there's nothing to do. The first string starts in column 1.
- *
- */
-
-
- if ( stringcount < 1 ) {
- putc('(', fp_out);
- stringstart = col = 1;
- stringcount = 1;
- } /* End if */
-
-} /* End of startline */
-
-
-/*****************************************************************************/
-
-
-static void
-endline(void)
-{
-
-
-/*
- *
- * Generates a call to the PostScript procedure that processes all the text on
- * the stack - provided stringcount is positive. If one string is on the stack
- * the fast procedure (ie. l) is used to print the line, otherwise the slower
- * one that processes string and column pairs is used.
- *
- */
-
-
- if ( stringcount == 1 )
- fprintf(fp_out, ")l\n");
- else if ( stringcount > 1 )
- fprintf(fp_out, ")%d L\n", stringstart-1);
-
- stringcount = 0;
-
-} /* End of endline */
-
-
-/*****************************************************************************/
-
-
-static void
-oput(int ch)
- /* next output character */
-{
-
-/*
- *
- * Responsible for adding all printing characters from the input file to the
- * open string on top of the stack. The only other characters that end up in
- * that string are the quotes required for special characters. Some simple
- * changes here and in spaces could make line wrapping possible. Doing a good
- * job would probably force lots of printer dependent stuff into the program,
- * so I haven't bothered with it. Could also change the prologue, or perhaps
- * write a different one, that uses kshow instead of show to display strings.
- *
- */
-
-
- startline();
- putc(ch, fp_out);
- col++;
-
-} /* End of oput */
-
-
-/*****************************************************************************/
-
-
-static void
-redirect(int pg)
- /* next page we're printing */
-{
- static FILE *fp_null = NULL; /* if output is turned off */
-
-/*
- *
- * If we're not supposed to print page pg, fp_out will be directed to /dev/null,
- * otherwise output goes to stdout.
- *
- */
-
-
- if ( pg >= 0 && in_olist(pg) == ON )
- fp_out = stdout;
- else if ( (fp_out = fp_null) == NULL )
- fp_out = fp_null = fopen("/dev/null", "w");
-
-} /* End of redirect */
-
-
-/*****************************************************************************/
-
-
diff --git a/usr/src/cmd/lp/filter/postscript/postprint/postprint.h b/usr/src/cmd/lp/filter/postscript/postprint/postprint.h
deleted file mode 100644
index fb15ee67af..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postprint/postprint.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- *
- * Definitions used by the PostScript translator for ASCII files.
- *
- */
-
-#define LINESPP 66
-#define TABSTOPS 8
-#define POINTSIZE 10
-
-/*
- *
- * An array of type Fontmap helps convert font names requested by users into
- * legitimate PostScript names. The array is initialized using FONTMAP, which must
- * end with an entry that has NULL defined as its name field. The only fonts that
- * are guaranteed to work well are the constant width fonts.
- *
- */
-
-typedef struct {
-
- char *name; /* user's font name */
- char *val; /* corresponding PostScript name */
-
-} Fontmap;
-
-#define FONTMAP \
- \
- { \
- "R", "Courier", \
- "I", "Courier-Oblique", \
- "B", "Courier-Bold", \
- "CO", "Courier", \
- "CI", "Courier-Oblique", \
- "CB", "Courier-Bold", \
- "CW", "Courier", \
- "PO", "Courier", \
- "courier", "Courier", \
- "cour", "Courier", \
- "co", "Courier", \
- NULL, NULL \
- }
-
-/*
- *
- * Some of the non-integer functions in postprint.c.
- *
- */
-
-char *get_font();
-
diff --git a/usr/src/cmd/lp/filter/postscript/postreverse/Makefile b/usr/src/cmd/lp/filter/postscript/postreverse/Makefile
deleted file mode 100644
index bfd7985c8c..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postreverse/Makefile
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/postreverse/Makefile
-#
-
-include ../../../Makefile.lp
-
-PROG = postreverse
-
-SRCS = postreverse.c
-
-OBJS = $(SRCS:%.c=%.o)
-
-TXTS= README
-
-ENCODING = 2
-CPPFLAGS = -DDFLTENCODING=$(ENCODING) \
- -I. -I$(COMMONDIR) \
- $(CPPFLAGS.master)
-
-POFILE = lp_filter_postscript_postreverse.po
-
-.KEEP_STATE :
-
-all : $(TXTS) $(PROG)
-
-$(PROG) : $(OBJS)
- $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
- $(POST_PROCESS)
-
-install : all $(ROOTLIBLPPOSTPROG)
-
-clean :
- $(RM) $(OBJS) core *~ *#
-
-strip :
- $(STRIP) $(PROG)
-
-lint : lint_SRCS
-
-include ../../../../Makefile.targ
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/filter/postscript/postreverse/README b/usr/src/cmd/lp/filter/postscript/postreverse/README
deleted file mode 100644
index 1f94fd272a..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postreverse/README
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
- Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- Use is subject to license terms.
-
-# ident "%Z%%M% %I% %E% SMI"
-
-SCCS Revision 1.4 of postrevers.[ch] represents a new implementation of
-postreverse that is more memory/swap efficient as well as a much more efficient
-algorithm for parsing the PostScript files. The only requirements for a
-document to be parsed is that it contains DSC Page and Trailer comments. The
-algorithm is documented at the beginning of the code.
diff --git a/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c b/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c
deleted file mode 100644
index 72de24d3cd..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include "postreverse.h"
-
-/*
- * This version of postreverse should parse any Adobe DSC conforming
- * PostScript file and most that are not conforming, but minimally have the
- * page (%%Page:) and trailer (%%Trailer) comments in them at the begining of
- * the line.
- *
- * If a document cannot be parsed (no page and trailer comments), it is passed
- * through untouched. If you look through the code you will find that it
- * doesn't ever look for the PostScript magic (%!). This is because it
- * assumes that PostScript is sent in. If PostScript is in sent in, it will
- * still attempt to parse it based on DSC page and trailer comments as if it
- * were postscript.
- *
- * flow goes as follows:
- * 1) get command line options (including parsing a page
- * list if supplied)
- * 2) if no filename is supplied in command line, copy
- * stdin to temp file.
- * 3) parse the document:
- * start from begining looking for a DSC page comment
- * (that is the header) start from the end looking for
- * a DSC trailer comment (that is the trailer) start from
- * the header until the trailer looking for DSC page
- * comments. Each one signifies a new page.
- * start from the header until the trailer looking for BSD
- * global comments. Each one violates page independence and
- * will be stored so it can be printed after the header and
- * before any pages.
- * 4) print the document: if there is no header, trailer, or
- * pages, print it from start to end unaltered if they all
- * exist, print the header, pages, and trailer the pages
- * are compared against a page list before being printed,
- * and are reversed if the reverse flag has been set.
- * If global definitions were found in the pages of a
- * document, they are printed after the header and before
- * the pages.
- */
-
-static void *
-nmalloc(size_t size)
-{
- void *ret = malloc(size);
-
- if (!ret) {
- (void) fprintf(stderr,
- "postreverse : malloc() failed : Out of memory\n");
- exit(2);
- }
- return (ret);
-}
-
-static void *
-nrealloc(void *ptr, size_t size)
-{
- void *ret = realloc(ptr, size);
-
- if (!ret) {
- (void) fprintf(stderr,
- "postreverse : realloc() failed - Out of memory\n");
- exit(2);
- }
- return (ret);
-}
-
-/*
- * nstrlen() provides the same functionality as strlen() while also checking
- * that the pointer does not cross the end of file.
- *
- * Returns the number of non-NULL bytes in string argument.
- */
-
-static size_t
-nstrlen(const char *s, char *bptr)
-{
- const char *s0 = s;
-
- while (s < bptr && *s != '\0')
- s++;
- return (s - s0);
-}
-
-/*
- * nstrstr() provides the same functionality as strstr() while also checking
- * that the pointers do not cross the end of the file.
- *
- * nstrstr() locates the first occurrence in the string as1 of the sequence of
- * characters (excluding the terminating null character) in the string as2.
- * nstrstr() returns a pointer to the located string, or a null pointer if
- * the string is not found. If as2 is "", the function returns as1.
- */
-
-static char *
-nstrstr(const char *as1, const char *as2, char *bptr)
-{
- const char *s1, *s2;
- const char *tptr;
- char c;
-
- s1 = as1;
- s2 = as2;
-
- if (s2 == NULL || *s2 == '\0')
- return ((char *)s1);
- c = *s2;
-
- while (s1 < bptr && *s1)
- if (*s1++ == c) {
- tptr = s1;
- while ((s1 < bptr) &&
- (c = *++s2) == *s1++ && c);
- if (c == 0)
- return ((char *)tptr - 1);
- s1 = tptr;
- s2 = as2;
- c = *s2;
- }
- return (NULL);
-}
-
-
-/*
- * caddr_t strrstr(caddr_t as1, caddr_t as2 char *bptr1)
- * return the address of the beginning of the last occruence of as2
- * in as1 or NULL if not found
- */
-caddr_t
-strrstr(caddr_t s1, caddr_t s2, char *bptr)
-{
- char *t1, *t2;
- char c;
-
-
- t1 = s1 + nstrlen(s1, bptr) - 1;
- t2 = s2 + nstrlen(s2, bptr) - 1;
-
- if (t2 == NULL || *t2 == '\0')
- return ((char *)t1);
- c = *t2;
-
- while (s1 <= t1)
- if (*t1-- == c) {
- while ((c = *--t2) == *t1-- && t2 > s2);
- if (t2 <= s2)
- return ((char *)t1 + 1);
- t2 = s2 + nstrlen(s2, bptr) - 1;
- c = *t2;
- }
- return (NULL);
-}
-
-/*
- * Copy stdin to a temp file and return the name
- */
-char *
-StdinToFile()
-{
- char *fileName = tmpnam(NULL);
- int fd;
- int count;
- char buf[BUFSIZ];
-
- if ((fd = open(fileName, O_RDWR | O_CREAT | O_EXCL, 0600)) < 0) {
- fprintf(stderr, "open(%s): %s\n", fileName,
- strerror(errno));
- return (NULL);
- }
- while ((count = read(0, buf, sizeof (buf))) > 0)
- if (write(fd, buf, count) != count) {
- fprintf(stderr, "write(%d, 0x%x, %d): %s\n", fd, buf,
- count, strerror(errno));
- close(fd);
- unlink(fileName);
- return (NULL);
- }
- return (fileName);
-}
-
-/*
- * Usage(char *name) - program usage
- */
-void
-Usage(char *name)
-{
- fprintf(stderr, "Usage: %s [ -o list ] [ -r ] [ filename ]\n", name);
- exit(1);
-}
-
-
-/*
- * int **ParsePageList(char *list)
- * This will parse as string #,#,#-#,#... into an array of pointers
- * to integers. This array will contain all numbers in the list including
- * those int the range #-#. The list returned is NULL terminated.
- * It uses 2 passes to build the list. pass 1 counts the # of ints and
- * allocates the space, and pass 2 fills in the list.
- */
-int **
-ParsePageList(char *list)
-{
- int **pageList = NULL;
- int pass = 0;
-
- if (list == NULL)
- return (NULL);
-
- while (pass++ < 2) {
- char *page;
- char *tmplist;
- int size = 0;
-
- tmplist = strdup(list);
- page = strtok(tmplist, ",");
-
- do {
- int start, end;
- char *s1 = page, *s2;
-
- if (s2 = strchr(page, '-')) {
- *s2++ = NULL;
- start = atoi(s1);
- end = atoi(s2);
- if (end < start) {
- int tmp = end;
-
- end = start;
- start = tmp;
- }
- } else
- start = end = atoi(s1);
-
- while (start <= end)
- if (pass == 1)
- /* count the pages for allocation */
- size++, start++;
- else { /* fill in the page list */
- int *tmp = (int *)nmalloc(sizeof (int));
- *tmp = start++;
- pageList[size++] = tmp;
- }
- } while (page = strtok(NULL, ","));
- free(tmplist);
- if (pass == 1)
- pageList = (int **)calloc(sizeof (int *), (size + 1));
- }
- return (pageList);
-}
-
-
-/*
- * int PageIsListed(int page, int **pageList)
- * returns 1 if the pagelist is empty or if the page is in the
- * NULL terminated pageList. returns 0 if the page is not listed
- */
-int
-PageIsListed(int page, int **pageList)
-{
- int count = 0;
-
- if (!pageList)
- return (1);
-
- for (count = 0; pageList[count] != NULL; count++)
- if (*pageList[count] == page)
- return (1);
- return (0);
-}
-
-
-/*
- * Writes the document Header to the fd
- */
-int
-WriteDocumentHeader(int fd, DOCUMENT * d)
-{
- if (d) {
- HEADER *h = d->header;
-
- if (h)
- return (write(fd, h->start, h->size));
- }
- errno = EINVAL;
- return (-1);
-}
-
-/*
- * Writes the document global block to the fd
- */
-int
-WriteGlobal(int fd, GLOBAL * g)
-{
- if (g)
- return (write(fd, g->start, g->size));
- errno = EINVAL;
- return (-1);
-}
-
-/*
- * Writes the document Trailer to the fd
- */
-int
-WriteDocumentTrailer(int fd, DOCUMENT * d)
-{
- if (d) {
- TRAILER *t = d->trailer;
-
- if (t)
- return (write(fd, t->start, t->size));
- }
- errno = EINVAL;
- return (-1);
-}
-
-/*
- * Writes the document page to the fd
- */
-int
-WritePage(int fd, PAGE * p, int global, char *bptr)
-{
- if (p) {
- caddr_t ptr1;
-
- if (((ptr1 = nstrstr(p->start, PS_BEGIN_GLOBAL, bptr))
- != NULL) && (ptr1 < p->start + p->size) &&
- (global != 0)) {
- /* BeginGlobal/EndGlobal in the page... */
- write(fd, p->start, ptr1 - p->start);
- ptr1 = nstrstr(ptr1, PS_END_GLOBAL, bptr);
- ptr1 += nstrlen(PS_END_GLOBAL, bptr);
- return (write(fd, ptr1, (p->size - (ptr1 - p->start))));
- } else
- return (write(fd, p->start, p->size));
- }
- errno = EINVAL;
- return (-1);
-}
-
-/*
- * Writes out the document pages in pageList (or all if NULL) and reverse
- * the output if reverse == 1
- */
-void
-WriteDocument(DOCUMENT * document, int reverse, int **pageList)
-{
- int count = 0;
- int prnindex;
-
- if (document->header && document->trailer && document->page) {
- WriteDocumentHeader(1, document);
-
- if (document->global != NULL) {
- while (document->global[count] != NULL) {
- GLOBAL *global = document->global[count++];
-
- if (global)
- WriteGlobal(1, global);
- }
- }
- count = reverse ? (document->pages-1) : 0;
-
- for (prnindex = 0; prnindex < document->pages; prnindex++) {
- PAGE *page = document->page[count];
-
- if (page && PageIsListed(page->number, pageList))
- WritePage(1, page, document->global != NULL,
- document->start + document->size);
-
- count = reverse ? count - 1 : count + 1;
- }
-
- WriteDocumentTrailer(1, document);
- } else {
- write(1, document->start, document->size);
- }
-}
-
-/*
- * get a document header from document and return a pointer to a HEADER
- * structure.
- */
-HEADER *
-DocumentHeader(DOCUMENT * document)
-{
- HEADER *header;
- caddr_t start;
-
- header = (HEADER *) nmalloc(sizeof (*header));
- memset(header, 0, sizeof (*header));
- if (start = nstrstr(document->start, PS_PAGE,
- document->start + document->size)) {
- header->label = "Document Header";
- header->start = document->start;
- header->size = (start - document->start + 1);
- } else {
- free(header);
- header = NULL;
- }
- return (header);
-}
-
-
-/*
- * get a document trailer from document and return a pointer to a trailer
- * structure.
- */
-TRAILER *
-DocumentTrailer(DOCUMENT * document)
-{
- TRAILER *trailer;
-
- trailer = (TRAILER *) nmalloc(sizeof (*trailer));
- memset(trailer, 0, sizeof (trailer));
- if (trailer->start = strrstr(document->start, PS_TRAILER,
- document->start + document->size)) {
- trailer->label = "Document Trailer";
- trailer->start += 1;
- trailer->size = nstrlen(trailer->start,
- document->start + document->size);
- } else {
- free(trailer);
- trailer = NULL;
- }
- return (trailer);
-}
-
-GLOBAL **
-DocumentGlobals(DOCUMENT * document)
-{
- GLOBAL **globals = NULL, *global;
- caddr_t start, ptr1;
- int count = 0;
- char *bptr = document->start + document->size;
- long allocated_slots = 0;
- caddr_t global_end;
-
- start = nstrstr(document->start, PS_PAGE, bptr);
- if (start != NULL) {
- for (ptr1 = nstrstr(start, PS_BEGIN_GLOBAL, bptr); ptr1 != NULL;
- ptr1 = nstrstr(++ptr1, PS_BEGIN_GLOBAL, bptr)) {
- count++;
-
- global = (GLOBAL *) nmalloc(sizeof (GLOBAL));
- if ((global_end = nstrstr(++ptr1, PS_END_GLOBAL, bptr))
- == NULL) {
- fprintf(stderr,
- "DSC violation: %%%%BeginGlobal "
- "with no %%%%EndGlobal\n");
- exit(-1);
- }
- memset(global, 0, sizeof (GLOBAL));
- global->start = ptr1;
- global->size = strchr(++global_end, '\n') - ptr1 + 1;
-
- if (count > allocated_slots) {
- globals = (GLOBAL **) nrealloc(globals,
- (allocated_slots + BLOCKSIZE) *
- sizeof (GLOBAL *));
- memset(globals +
- allocated_slots * sizeof (GLOBAL *), 0,
- BLOCKSIZE *
- sizeof (GLOBAL *));
- allocated_slots += BLOCKSIZE;
- }
-
- globals[count - 1] = global;
- ptr1 = global->start + global->size;
- }
- }
- return (globals);
-}
-
-
-/*
- * get the pages from a document and return a pointer a list of PAGE
- * structures.
- */
-PAGE **
-DocumentPages(DOCUMENT * document)
-{
- PAGE **pages = NULL, *page;
- caddr_t ptr1, page_end;
- char *bptr = document->start + document->size;
- long allocated_slots = 0;
- long no_pages = 0;
- long number;
- char *label, *tmp, *tmp_end;
-
- for (ptr1 = nstrstr(document->start, PS_PAGE, bptr); ptr1 != NULL;
- ptr1 = nstrstr(++ptr1, PS_PAGE, bptr)) {
- no_pages++;
-
- if (no_pages > allocated_slots) {
- pages = (PAGE **) nrealloc(pages,
- (allocated_slots + BLOCKSIZE) * sizeof (PAGE *));
- memset(pages + allocated_slots, 0,
- BLOCKSIZE * sizeof (PAGE *));
- allocated_slots += BLOCKSIZE;
- }
- page = (PAGE *) nmalloc(sizeof (PAGE));
- label = NULL;
- number = -1;
-
- /* page start & end */
- if ((page_end = nstrstr(++ptr1, PS_PAGE, bptr)) == NULL)
- if (document->trailer)
- page_end = document->trailer->start - 1;
- else
- page_end = document->start + document->size;
-
- /* page label & number */
- if (tmp = strchr(ptr1, ' ')) {
-
- if (tmp_end = strchr(++tmp, ' ')) {
- label = (char *)nmalloc((tmp_end - tmp) + 1);
- memset(label, 0, (tmp_end - tmp) + 1);
- strncpy(label, tmp, (tmp_end - tmp));
- number = atol(++tmp_end);
- }
- }
- memset(page, 0, sizeof (PAGE));
- page->label = label;
- page->number = number;
- page->start = ptr1;
- page->size = page_end - ptr1 + 1;
-
- pages[document->pages++] = page;
- }
- return (pages);
-}
-
-/*
- * parse a document and return a pointer to a DOCUMENT structure
- */
-DOCUMENT *
-DocumentParse(char *name)
-{
- DOCUMENT *document = NULL;
- int fd;
- struct stat st;
-
- if (stat(name, &st) < 0) {
- fprintf(stderr, "stat(%s): %s\n", name, strerror(errno));
- return (NULL);
- }
- if (st.st_size == 0) {
- fprintf(stderr, "%s: empty file\n", name);
- return (NULL);
- }
- if ((fd = open(name, O_RDONLY)) < 0) {
- fprintf(stderr, "open(%s, O_RDONLY): %s\n", name,
- strerror(errno));
- return (NULL);
- }
- document = (DOCUMENT *) nmalloc(sizeof (DOCUMENT));
- memset(document, 0, sizeof (DOCUMENT));
- if ((document->start = mmap((void *)0, (size_t)st.st_size, PROT_READ,
- MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) {
- fprintf(stderr, "mmap(0, %ld, PROT_READ,"
- " MAP_SHARED, %d, 0): %s\n",
- st.st_size, fd, strerror(errno));
- free(document);
- document = NULL;
- } else {
- /* order in important */
- document->name = strdup(name);
- document->size = nstrlen(document->start,
- document->start + st.st_size);
- document->header = DocumentHeader(document);
- document->trailer = DocumentTrailer(document);
- document->page = DocumentPages(document);
- document->global = DocumentGlobals(document);
- }
- close(fd);
- return (document);
-}
-
-
-#if defined(DEBUG)
-/*
- * Print out the contents of the document structure
- */
-void
-PrintDocumentInfo(DOCUMENT * d)
-{
- if (d) {
- printf("Document:\n\tname: %s\n\tstart: 0x%x\n\tsize: %ld\n",
- d->name, d->start, d->size);
- if (d->header) {
- HEADER *h = d->header;
-
- printf("\tHeader: %s (0x%x, %ld)\n",
- h->label, h->start, h->size);
- }
- if (d->global) {
- int count = 0;
-
- while (d->global[count++] != NULL);
- printf("\tDSC violating BeginGlobals: %d\n", count);
- }
- if (d->page) {
- PAGE *p;
- int count = 0;
-
- printf("\tPages: (%d)\n", d->pages);
- for (p = d->page[0]; p != NULL; p = d->page[++count])
- printf("\t\t %4d (%s) - (0x%x, %ld)\n",
- p->number,
- (p->label ? p->label : "Page"),
- p->start, p->size);
- }
- if (d->trailer) {
- TRAILER *t = d->trailer;
-
- printf("\tTrailer: %s (0x%x, %ld)\n",
- t->label, t->start, t->size);
- }
- }
-}
-#endif /* DEBUG */
-
-
-int
-main(int ac, char *av[])
-{
- DOCUMENT *document;
- char *fileName = NULL;
- char *programName = NULL;
- char *unlinkFile = NULL;
- int reversePages = 1;
- int **pageList = NULL;
- int option;
-
- if (programName = strrchr(av[0], '/'))
- programName++;
- else
- programName = av[0];
-
- while ((option = getopt(ac, av, "o:r")) != EOF)
- switch (option) {
- case 'o':
- pageList = ParsePageList(optarg);
- break;
- case 'r':
- reversePages = 0;
- break;
- case '?':
- Usage(programName);
- break;
- default:
- fprintf(stderr, "missing case for option %c\n", option);
- Usage(programName);
- break;
- }
-
- ac -= optind;
- av += optind;
-
- switch (ac) {
- case 0:
- unlinkFile = fileName = StdinToFile();
- break;
- case 1:
- fileName = av[0];
- break;
- default:
- Usage(programName);
- }
-
- if ((document = DocumentParse(fileName)) == NULL) {
- fprintf(stderr, "Unable to parse document (%s)\n", fileName);
- exit(0);
- }
-#if defined(DEBUG) && defined(NOTDEF)
- PrintDocumentInfo(document);
-#endif /* DEBUG */
-
- WriteDocument(document, reversePages, pageList);
-
- if (unlinkFile)
- unlink(unlinkFile);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.h b/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.h
deleted file mode 100644
index e467140334..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 1993-2001 by Sun Microsystems, Inc.
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI"
-
-/**
- * Structures and definitions needed for PostScript page manipulation
- **/
-#if !defined(_POSTREVERSE_H)
-#define _POSTREVERSE_H
-
-/* PS DSC comments of interest */
-#define PS_PAGE "\n%%Page:"
-#define PS_TRAILER "\n%%Trailer"
-#define PS_BEGIN_GLOBAL "\n%%BeginGlobal"
-#define PS_END_GLOBAL "\n%%EndGlobal"
-
-#define BLOCKSIZE 10
-
-struct _global {
- caddr_t start;
- size_t size;
-};
-typedef struct _global GLOBAL;
-
-struct _page {
- unsigned int number;
- char *label;
- caddr_t start;
- size_t size;
-};
-typedef struct _page PAGE;
-
-struct _header {
- char *label;
- caddr_t start;
- size_t size;
-};
-typedef struct _header HEADER;
-
-struct _trailer {
- char *label;
- caddr_t start;
- size_t size;
-};
-typedef struct _trailer TRAILER;
-
-struct _document {
- char *name;
- caddr_t start;
- size_t size;
- HEADER *header;
- PAGE **page;
- GLOBAL **global;
- long pages;
- TRAILER *trailer;
-};
-typedef struct _document DOCUMENT;
-
-#endif /* _POSTREVERSE_H */
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/Makefile b/usr/src/cmd/lp/filter/postscript/postscript/Makefile
deleted file mode 100644
index 89e914697d..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/Makefile
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/filter/postscript/postscript/Makefile
-#
-
-include ../../../Makefile.lp
-
-COMMONDIR= ../common
-
-TXTFILES = README
-
-FILES = \
- aps.ps \
- banner.ps \
- baseline.ps \
- color.ps \
- dpost.ps \
- draw.ps \
- fatcourier.ps \
- forms.ps \
- postprint.ps \
- ps.requests \
- tsol_banner.ps \
- tsol_separator.ps \
- tsol_trailer.ps
-
-ROOTPOSTFILES= $(FILES:%=$(ROOTLIBLPPOST)/%)
-
-.KEEP_STATE:
-
-all: $(TXTFILES) $(FILES)
-
-install: all $(ROOTPOSTFILES)
-
-clean clobber strip lint catalog:
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/README b/usr/src/cmd/lp/filter/postscript/postscript/README
deleted file mode 100644
index ff9b3b2474..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/README
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-Prologues and a few other PostScript files that are copied to /usr/lib/postscript
-(ie. LIBDIR in ../Makefile) when you do an install.
-
-Default settings have been moved to these files. All can be changed without
-requiring a recompilation of any programs supplied with this package. In
-addition all the translators understand the -P option that lets you pass
-arbitrary PostScript through to the output file. The option can be useful if
-you want to change parameters that are defined in the prologue but not tied to
-specific command line options.
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/aps.ps b/usr/src/cmd/lp/filter/postscript/postscript/aps.ps
deleted file mode 100644
index 56bc76c68a..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/aps.ps
+++ /dev/null
@@ -1,149 +0,0 @@
-%ident "@(#)lp:filter/postscript/postscript/aps.ps 1.1"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Tune things up so Linotronic output looks more like the APS-5. Pull this file
-% into dpost output using the -C option. To get the best looking output run dpost
-% with the -e2 option and use special font files that look like the APS tables but
-% have character codes (ie. the fourth column in the width tables) appropriate for
-% PostScript fonts. Widths in these tables must be for APS fonts!
-%
-% Start with fat versions of the stroked Courier and Courier-Oblique fonts - from
-% Johnathan Shopiro.
-%
-
-/newdict /Courier findfont length dict def
-/Courier findfont {
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-newdict /StrokeWidth 65 put
-/Courier newdict definefont pop
-
-/newdict /Courier-Oblique findfont length dict def
-/Courier-Oblique findfont {
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-newdict /StrokeWidth 65 put
-/Courier-Oblique newdict definefont pop
-
-%
-% Scaled down versions of the Helvetica font family.
-%
-
-/newdict /Helvetica findfont length dict def
-/Helvetica findfont {
- 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if
-
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-/Helvetica newdict definefont pop
-
-/newdict /Helvetica-Oblique findfont length dict def
-/Helvetica-Oblique findfont {
- 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if
-
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-/Helvetica-Oblique newdict definefont pop
-
-/newdict /Helvetica-Bold findfont length dict def
-/Helvetica-Bold findfont {
- 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if
-
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-/Helvetica-Bold newdict definefont pop
-
-/newdict /Helvetica-BoldOblique findfont length dict def
-/Helvetica-BoldOblique findfont {
- 1 index /FontMatrix eq {.922 .922 matrix scale matrix concatmatrix} if
-
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-/Helvetica-BoldOblique newdict definefont pop
-
-%
-% Scaled up versions of the Times font family.
-%
-
-/newdict /Times-Roman findfont length dict def
-/Times-Roman findfont {
- 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if
-
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-/Times-Roman newdict definefont pop
-
-/newdict /Times-Italic findfont length dict def
-/Times-Italic findfont {
- 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if
-
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-/Times-Italic newdict definefont pop
-
-/newdict /Times-Bold findfont length dict def
-/Times-Bold findfont {
- 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if
-
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-/Times-Bold newdict definefont pop
-
-/newdict /Times-BoldItalic findfont length dict def
-/Times-BoldItalic findfont {
- 1 index /FontMatrix eq {1.0225 1.0225 matrix scale matrix concatmatrix} if
-
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-/Times-BoldItalic newdict definefont pop
-
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/banner.ps b/usr/src/cmd/lp/filter/postscript/postscript/banner.ps
deleted file mode 100644
index 27239cca56..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/banner.ps
+++ /dev/null
@@ -1,64 +0,0 @@
-%ident "@(#)lp:filter/postscript/postscript/banner.ps 1.1"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Simple program to print a banner page
-%
-% 04/19/91:
-% Modified to be more compatable with how other LP
-% banner pages look.
-%
-
-/banner {
- /saveobj save def
- erasepage initgraphics
-
- /#copies 1 def
- /inch {72 mul} bind def
- /pagebbox [clippath pathbbox newpath] def
-
- /font /Helvetica def
- /size 20 def
- /height pagebbox 3 get def
- /width pagebbox 2 get .09 mul def
-
- .92 setgray
- pagebbox 0 get pagebbox 1 get moveto
- width 0 rlineto 0 height rlineto width neg 0 rlineto closepath eofill
- pagebbox 2 get pagebbox 1 get moveto
- width neg 0 rlineto 0 height rlineto width 0 rlineto closepath eofill
- 0 setgray
-
- font findfont size scalefont setfont
- /linesp size size .15 mul add neg def
- /tab (Destination) stringwidth pop 1.5 mul def
- /nextline {0 0 moveto show tab 0 moveto show 0 linesp translate} def
-
- pagebbox 0 get 1.5 width mul add pagebbox 3 get 2.0 width mul sub translate
- (Owner:) nextline
- (Originator:) nextline
- (Title:) nextline
- (Job-Id:) nextline
- (Printed:) nextline
- showpage
- saveobj restore
-} bind def
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/baseline.ps b/usr/src/cmd/lp/filter/postscript/postscript/baseline.ps
deleted file mode 100644
index f3020c9a43..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/baseline.ps
+++ /dev/null
@@ -1,178 +0,0 @@
-%ident "@(#)lp:filter/postscript/postscript/baseline.ps 1.1"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Stuff used to draw or set text along a baseline specified by parametric equations
-% for x and y.
-%
-
-/left -1 def
-/center 0 def
-/right 1 def
-
-/baselinedict 50 dict def
-
-/newbaseline {
- baselinedict begin
- /g' exch bind def
- /f' exch bind def
- /g exch bind def
- /f exch bind def
-
- counttomark 2 eq {/hoffset exch def} if
- /res exch def
-
- /t 0 def
- /s 0 def
- /voffset false def
- cleartomark
- end
-} bind def
-
-/drawfunnytext {
- baselinedict begin
- /t exch def
- /mode exch def
- /str exch def
-
- mode left eq {
- /leftstring emptystring def
- /rightstring str def
- } if
-
- mode right eq {
- /leftstring str reversestring def
- /rightstring emptystring def
- } if
-
- mode center eq {
- str splitstring
- /rightstring exch def
- /leftstring exch reversestring def
- } if
-
- gsave currentpoint translate leftstring left t baselineshow grestore
- gsave currentpoint translate rightstring right t baselineshow grestore
-
- /t 0 def
- /s 0 def
- /voffset false def
- cleartomark
- end
-} bind def
-
-/setfunnytext {
- baselinedict begin
- /vpos exch def
- /hpos exch def
- /str exch def
-
- voffset vpos ne {
- /voffset vpos def
- /t 0 def
- /s hoffset def
- } if
-
- gsave
- hoffset voffset translate
- 0 0 moveto
- /ds hpos s sub def
- /dt ds t f' dup mul t g' dup mul add sqrt res mul div def
- /s s ds add def
- /t t dt add def
- str right t baselineshow
- grestore
- end
-} bind def
-
-baselinedict begin
-
-/f {} bind def
-/g {pop 0} bind def
-/f' {pop 1} bind def
-/g' {pop 0} bind def
-
-/s 0 def
-/t 0 def
-/res 72 def
-
-/onecharstring ( ) def
-/emptystring () def
-
-/baselineshow {
- /t exch def
- /mode exch def
- /str exch def
-
- gsave
- t f res mul t g res mul translate
- 0 0 moveto
- t g' t f' atan rotate
- {
- mode right eq {pop} if
- grestore gsave
- onecharstring 0 3 -1 roll put onecharstring stringwidth pop
- /ds exch mode mul def
- /dt ds t f' dup mul t g' dup mul add sqrt res mul div def
- /t t dt add def
- /s s ds add def
- t f res mul t g res mul translate
- 0 0 moveto
- t g' t f' atan rotate
- mode left eq {pop} if
- } str kshow
- grestore
-} bind def
-
-/reversestring {
- /str1 exch def
-
- /str2 str1 length string def
- /i 0 def
- /n str1 length 1 sub def
-
- {
- str1 n get str2 exch i exch put
- /i i 1 add def
- /n n 1 sub def
- n 0 lt {exit} if
- } loop
- str2
-} bind def
-
-/splitstring {
- /str1 exch def
-
- /len str1 stringwidth pop def
- /s 0 def
- /n 0 def
- str1 length {
- str1 n get onecharstring exch 0 exch put
- /s onecharstring stringwidth pop s add def
- s len 2 div ge {exit} if
- /n n 1 add def
- } repeat
- str1 0 n 1 add getinterval
- str1 n str1 length n sub getinterval
-} bind def
-
-end
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/color.ps b/usr/src/cmd/lp/filter/postscript/postscript/color.ps
deleted file mode 100644
index a4ae8a82f0..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/color.ps
+++ /dev/null
@@ -1,87 +0,0 @@
-%ident "@(#)lp:filter/postscript/postscript/color.ps 1.1"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Color and reverse video support for dpost. A call made to setcolor with two
-% arguments implies reverse video printing.
-%
-
-/rgb {setrgbcolor} bind def
-/hsb {sethsbcolor} bind def
-
-/colordict 50 dict dup begin
- /red { 1 0 0 } def
- /green { 0 1 0 } def
- /blue { 0 0 1 } def
- /cyan { 0 1 1 } def
- /magenta { 1 0 1 } def
- /yellow { 1 1 0 } def
- /white { 1 1 1 } def
- /black { 0 0 0 } def
-end def
-
-/setcolor {
- counttomark 1 eq {
- dup colordict exch known not {pop /black} if
- colordict exch get exec setrgbcolor
- } if
- counttomark 2 eq {
- /backcolor exch def
- /textcolor exch def
- colordict backcolor known not colordict textcolor known not or {
- /backcolor colordict /black get def
- /textcolor colordict /white get def
- } if
- /backcolor colordict backcolor get def
- /textcolor colordict textcolor get def
- /dY1 0 def
- /dY2 0 def
- textcolor exec setrgbcolor
- } if
-} bind def
-
-/drawrvbox {
- /x2 exch def
- /x1 exch def
-
- currentpoint dup
- /y1 exch def
- /y2 exch def pop
-
- dY1 0 eq dY2 0 eq and {
- currentfont /FontBBox get aload pop
- currentfont /FontMatrix get dtransform /dY2 exch def pop
- currentfont /FontMatrix get dtransform /dY1 exch def pop
- } if
-
- /y1 y1 dY1 add def
- /y2 y2 dY2 add def
-
- backcolor exec setrgbcolor
- newpath
- x1 y1 moveto
- x2 y1 lineto
- x2 y2 lineto
- x1 y2 lineto
- closepath fill
- textcolor exec setrgbcolor
-} bind def
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/dpost.ps b/usr/src/cmd/lp/filter/postscript/postscript/dpost.ps
deleted file mode 100644
index 9e1bd70514..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/dpost.ps
+++ /dev/null
@@ -1,223 +0,0 @@
-%
-% Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-% Use is subject to license terms.
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%ident "%Z%%M% %I% %E% SMI"
-%
-% Version 3.16 prologue for troff files.
-%
-
-/#copies 1 store
-/aspectratio 1 def
-/formsperpage 1 def
-/landscape false def
-/linewidth .3 def
-/magnification 1 def
-/margin 0 def
-/orientation 0 def
-/resolution 720 def
-/xoffset 0 def
-/yoffset 0 def
-
-/roundpage true def
-/useclippath true def
-/pagebbox [0 0 612 792] def
-
-/R /Times-Roman def
-/I /Times-Italic def
-/B /Times-Bold def
-/BI /Times-BoldItalic def
-/H /Helvetica def
-/HI /Helvetica-Oblique def
-/HB /Helvetica-Bold def
-/HX /Helvetica-BoldOblique def
-/CW /Courier def
-/CO /Courier def
-/CI /Courier-Oblique def
-/CB /Courier-Bold def
-/CX /Courier-BoldOblique def
-/PA /Palatino-Roman def
-/PI /Palatino-Italic def
-/PB /Palatino-Bold def
-/PX /Palatino-BoldItalic def
-/Hr /Helvetica-Narrow def
-/Hi /Helvetica-Narrow-Oblique def
-/Hb /Helvetica-Narrow-Bold def
-/Hx /Helvetica-Narrow-BoldOblique def
-/KR /Bookman-Light def
-/KI /Bookman-LightItalic def
-/KB /Bookman-Demi def
-/KX /Bookman-DemiItalic def
-/AR /AvantGarde-Book def
-/AI /AvantGarde-BookOblique def
-/AB /AvantGarde-Demi def
-/AX /AvantGarde-DemiOblique def
-/NR /NewCenturySchlbk-Roman def
-/NI /NewCenturySchlbk-Italic def
-/NB /NewCenturySchlbk-Bold def
-/NX /NewCenturySchlbk-BoldItalic def
-/ZD /ZapfDingbats def
-/ZI /ZapfChancery-MediumItalic def
-/VR /Varitimes#Roman def
-/VI /Varitimes#Italic def
-/VB /Varitimes#Bold def
-/VX /Varitimes#BoldItalic def
-/S /S def
-/S1 /S1 def
-/GR /Symbol def
-
-/inch {72 mul} bind def
-/min {2 copy gt {exch} if pop} bind def
-
-/setup {
- counttomark 2 idiv {def} repeat pop
-
- landscape {/orientation 90 orientation add def} if
- /scaling 72 resolution div def
- linewidth setlinewidth
- 1 setlinecap
-
- pagedimensions
- xcenter ycenter translate
- orientation neg rotate
- width 2 div neg height 2 div translate
- xoffset inch yoffset inch translate
- margin 2 div dup neg translate
- magnification dup aspectratio mul scale
- scaling scaling scale
-
- /Symbol /S Sdefs cf
- /Times-Roman /S1 S1defs cf
- 0 0 moveto
-} def
-
-/pagedimensions {
- useclippath userdict /gotpagebbox known not and {
- /pagebbox [clippath pathbbox newpath] def
- roundpage currentdict /roundpagebbox known and {roundpagebbox} if
- } if
- pagebbox aload pop
- 4 -1 roll exch 4 1 roll 4 copy
- landscape {4 2 roll} if
- sub /width exch def
- sub /height exch def
- add 2 div /xcenter exch def
- add 2 div /ycenter exch def
- userdict /gotpagebbox true put
-} def
-
-/pagesetup {
- /page exch def
- currentdict /pagedict known currentdict page known and {
- page load pagedict exch get cvx exec
- } if
-} def
-
-/decodingdefs [
- {counttomark 2 idiv {y moveto show} repeat}
- {neg /y exch def counttomark 2 idiv {y moveto show} repeat}
- {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat}
- {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat}
- {counttomark 2 idiv {y moveto show} repeat}
- {neg setfunnytext}
-] def
-
-/setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def
-
-/w {neg moveto show} bind def
-/m {neg dup /y exch def moveto} bind def
-/done {/lastpage where {pop lastpage} if} def
-
-/f {
- dup /font exch def findfont exch
- dup /ptsize exch def scaling div dup /size exch def scalefont setfont
- linewidth ptsize mul scaling 10 mul div setlinewidth
- /spacewidth ( ) stringwidth pop def
-} bind def
-
-/changefont {
- /fontheight exch def
- /fontslant exch def
- currentfont [
- 1 0
- fontheight ptsize div fontslant sin mul fontslant cos div
- fontheight ptsize div
- 0 0
- ] makefont setfont
-} bind def
-
-/sf {f} bind def
-
-/cf {
- dup length 2 idiv
- /entries exch def
- /chtab exch def
- /newfont exch def
-
- findfont dup length 1 add dict
- /newdict exch def
- {1 index /FID ne {newdict 3 1 roll put} {pop pop} ifelse} forall
-
- newdict /Metrics entries dict put
- newdict /Metrics get
- begin
- chtab aload pop
- 1 1 entries {pop def} for
- newfont newdict definefont pop
- end
-} bind def
-
-%
-% A few arrays used to adjust reference points and character widths in some
-% of the printer resident fonts. If square roots are too high try changing
-% the lines describing /radical and /radicalex to,
-%
-% /radical [0 -75 550 0]
-% /radicalex [-50 -75 500 0]
-%
-
-/Sdefs [
- /bracketlefttp [220 500]
- /bracketleftbt [220 500]
- /bracketrighttp [-70 380]
- /bracketrightbt [-70 380]
- /braceleftbt [220 490]
- /bracketrightex [220 -125 500 0]
- /radical [0 0 550 0]
- % NeWSprint's \(br is too low, compensate
- statusdict /product get (NeWS Server) eq {
- /radicalex [-50 100 500 0]
- /parenleftex [-20 100 0 0]
-
- } {
- /radicalex [-50 0 500 0]
- /parenleftex [-20 -170 0 0]
- } ifelse
- /integral [100 -50 500 0]
- /infinity [10 -75 730 0]
-] def
-
-/S1defs [
- /underscore [0 80 500 0]
- /endash [7 90 650 0]
-] def
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/draw.ps b/usr/src/cmd/lp/filter/postscript/postscript/draw.ps
deleted file mode 100644
index 4208567485..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/draw.ps
+++ /dev/null
@@ -1,97 +0,0 @@
-%ident "@(#)lp:filter/postscript/postscript/draw.ps 1.1"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Version 3.15 drawing procedures for dpost. Automatically pulled in, but only
-% when needed.
-%
-
-/inpath false def
-/savematrix matrix currentmatrix def
-
-/Dl {
- inpath
- {pop pop neg lineto}
- {newpath neg moveto neg lineto stroke}
- ifelse
-} bind def
-
-/De {
- /y1 exch 2 div def
- /x1 exch 2 div def
- neg exch x1 add exch translate
- x1 y1 scale
- 0 0 1 0 360
- inpath
- {1 0 moveto arc savematrix setmatrix}
- {newpath arc savematrix setmatrix stroke}
- ifelse
-} bind def
-
-/Da {
- /dy2 exch def
- /dx2 exch def
- /dy1 exch def
- /dx1 exch def
- dy1 add neg exch dx1 add exch
- dx1 dx1 mul dy1 dy1 mul add sqrt
- dy1 dx1 neg atan
- dy2 neg dx2 atan
- inpath
- {arc}
- {newpath arc stroke}
- ifelse
-} bind def
-
-/DA {
- /dy2 exch def
- /dx2 exch def
- /dy1 exch def
- /dx1 exch def
- dy1 add neg exch dx1 add exch
- dx1 dx1 mul dy1 dy1 mul add sqrt
- dy1 dx1 neg atan
- dy2 neg dx2 atan
- inpath
- {arcn}
- {newpath arcn stroke}
- ifelse
-} bind def
-
-/Ds {
- /y2 exch def
- /x2 exch def
- /y1 exch def
- /x1 exch def
- /y0 exch def
- /x0 exch def
- x0 5 x1 mul add 6 div
- y0 5 y1 mul add -6 div
- x2 5 x1 mul add 6 div
- y2 5 y1 mul add -6 div
- x1 x2 add 2 div
- y1 y2 add -2 div
- inpath
- {curveto}
- {newpath x0 x1 add 2 div y0 y1 add -2 div moveto curveto stroke}
- ifelse
-} bind def
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/fatcourier.ps b/usr/src/cmd/lp/filter/postscript/postscript/fatcourier.ps
deleted file mode 100644
index a0093d4e97..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/fatcourier.ps
+++ /dev/null
@@ -1,48 +0,0 @@
-%ident "@(#)lp:filter/postscript/postscript/fatcourier.ps 1.1"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Fat versions of the stroked Courier and Courier-Oblique - from Johnathan Shopiro.
-% Can be selectively pulled in using the -C option that's available with all the
-% PostScript translators or permanently added to any of the prologues. Helps on
-% Linotronic typesetters, where Courier and Courier-Oblique are too light!
-%
-
-/newdict /Courier findfont length dict def
-/Courier findfont {
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-newdict /StrokeWidth 60 put
-/Courier newdict definefont pop
-
-/newdict /Courier-Oblique findfont length dict def
-/Courier-Oblique findfont {
- 1 index /FID ne
- {newdict 3 1 roll put}
- {pop pop}
- ifelse
-} forall
-newdict /StrokeWidth 60 put
-/Courier-Oblique newdict definefont pop
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/forms.ps b/usr/src/cmd/lp/filter/postscript/postscript/forms.ps
deleted file mode 100644
index d19e073620..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/forms.ps
+++ /dev/null
@@ -1,218 +0,0 @@
-%ident "@(#)lp:filter/postscript/postscript/forms.ps 1.1"
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Procedures that let you print any number of pages on each sheet of paper. It's
-% far from perfect and won't handle everything (eg. it's not recursive), but should
-% be good enough for now. Assumes the default page coordinate system has been set
-% up before setupforms is called. lastpage makes certain the last page is printed,
-% and should be called immediately after the %%Trailer comment.
-%
-% Three lines of code needed for page image clipping have been commented out for
-% now. It works, but can really slow things down on some versions of PostScript.
-% Uncomment them if you want to clip pages.
-%
-
-/setupforms {
- /formsperpage exch def
-
- /currentform 0 def
- /slop 5 def
- /min {2 copy gt {exch} if pop} def
-
-%
-% Save the current environment. Needed because showpage will be redefined. Will be
-% restored in lastpage.
-%
-
- save
-
-%
-% Number of rows and columns we'll need - may exchange them later.
-%
-
- /columns formsperpage sqrt ceiling cvi def
- /rows formsperpage columns div ceiling cvi def
-
-%
-% Slop leaves a little room around the edge so page images can be outlined and have
-% the borders show up. Distance is in default coordinates, so we need to figure out
-% how it maps into user coordinates.
-%
-
- 6 array defaultmatrix
- 6 array currentmatrix
- 6 array invertmatrix
- 6 array concatmatrix
- /tempmatrix exch def
-
- 0 slop tempmatrix dtransform dup mul exch dup mul add sqrt
- /slop exch def
-
-%
-% Determine how big the image area is, using the clipping path bounding box minus
-% a little and leave the coordinates of the lower left corner of the clipping path
-% on the stack. Also temporarily set the size of each page (ie. formheight and
-% formwidth) from the clipping path - just in case old software uses this stuff.
-% Only works for coordinate systems that have been rotated by a multiple of 90
-% degrees.
-%
-
- newpath clippath pathbbox
- 2 index sub dup /formheight exch def slop 2 mul sub /pageheight exch def
- 2 index sub dup /formwidth exch def slop 2 mul sub /pagewidth exch def
-
-%
-% New translators all store the size of each page in default coordinates in the
-% pagebbox array and it can be different than the size determined by the clipping
-% path. If we can find pagebbox use it to set the real dimensions of each page.
-% Leaves the coordinates of the lower left corner on the stack, (either from
-% pagebbox or clippath) so four numbers are there when we're done.
-%
-
- userdict /gotpagebbox known userdict /pagebbox known and {
- newpath
- pagebbox 0 get pagebbox 1 get tempmatrix transform moveto
- pagebbox 0 get pagebbox 3 get tempmatrix transform lineto
- pagebbox 2 get pagebbox 3 get tempmatrix transform lineto
- pagebbox 2 get pagebbox 1 get tempmatrix transform lineto
- closepath pathbbox
- 2 index sub /formheight exch def
- 2 index sub /formwidth exch def
- } {2 copy} ifelse
-
-%
-% Top two numbers are the displacement from the job's origin to the lower left
-% corner of each page image when we finish setting up the new coordinate system.
-%
-
- /ycorner exch def
- /xcorner exch def
-
-%
-% The two numbers left on the stack are the coordinates of the lower left corner
-% of the clipping path. Go there and then up a bit so page images can be outlined.
-%
-
- translate
- slop slop translate
-
-%
-% If the page is wider than high we may be able to do better if we exchange rows
-% and columns. Won't make a difference in the current orientation or if rows and
-% columns are the same.
-%
-
- pagewidth pageheight gt {
- rows columns /rows exch def /columns exch def
- } if
-
-%
-% Find the orientation and scaling that makes things as large as possible. More
-% than what's really needed. First calculation essentially finds the minimum of
-% 1/rows and 1/columns.
-%
-
- pagewidth formwidth columns mul div pageheight formheight rows mul div min
- pageheight formwidth columns mul div pagewidth formheight rows mul div min
-
- 2 copy lt {
- pagewidth pageheight /pagewidth exch def /pageheight exch def
- -90 rotate
- pagewidth neg 0 translate
- exch
- } if
-
-%
-% Second number from the top is the best choice. Scale so everything will fit on
-% the current page, go back to the original origin, and then get ready for the
-% first page - which goes in the upper left corner.
-%
-
- pop dup dup scale
- xcorner neg ycorner neg translate
- 0 rows 1 sub formheight mul translate
-
-%
-% Try to center everything on the page - scaling we used is on top of the stack.
-%
-
- dup pagewidth exch div formwidth columns mul sub 2 div
- exch pageheight exch div formheight rows mul sub 2 div translate
-
-%
-% Redefine showpage. Assumes a save object is on top of the stack (we put another
-% one there later).
-%
-
- /showpage {
- restore
-% initclip
- formsperpage 1 gt {
- gsave .1 setlinewidth outlineform stroke grestore
- } if
- formwidth 0 translate
- /currentform currentform 1 add def
- currentform columns mod 0 eq {
- columns formwidth mul neg formheight neg translate
- } if
- currentform formsperpage mod 0 eq {
- gsave showpage grestore
- currentform columns mod formwidth mul neg
- formsperpage columns idiv formheight mul translate
- /currentform 0 def
- } if
-% outlineform clip newpath
- save
- } bind def
-
- /outlineform {
- newpath
- xcorner ycorner moveto
- formwidth 0 rlineto
- 0 formheight rlineto
- formwidth neg 0 rlineto
- closepath
- } bind def
-
- /lastpage {
- formsperpage 1 gt {
- currentform 0 ne {
- save
- 0 1 formsperpage currentform sub formsperpage mod {
- pop showpage
- } for
- restore
- } if
- pop restore
- } if
- } def
-
-%
-% Clip the first page image and save the environment we just set up, including
-% the redefined showpage.
-%
-
-% outlineform clip
- newpath
- save
-} def
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/postprint.ps b/usr/src/cmd/lp/filter/postscript/postscript/postprint.ps
deleted file mode 100644
index 438b7180a1..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/postprint.ps
+++ /dev/null
@@ -1,437 +0,0 @@
-%
-% Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-% Use is subject to license terms.
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-% Use is subject to license terms
-%
-%ident "%Z%%M% %I% %E% SMI"
-%
-
-/add-euro-to-font {
- /new-font exch def
- /old-font exch def
-
- % Begin Euro Font: A single character "Euro" font
- 10 dict begin
- /FontType 3 def
- /FontMatrix [.00060 0 0 .00060 0 0] def
- /FontBBox [0 0 1000 1000] def
-
- /Encoding [ /Euro ] def
-
- /CharProcs 2 dict def
- CharProcs begin
- /.notdef { } def
- /Euro { % Draw an EUR glyph
- gsave
- 955.852 232.172 moveto
- 904.495 180.815 lineto
- 829.454 117.848 734.626 83.333 636.667 83.333 curveto
- 406.667 83.333 220 270 220 500 curveto
- 220 730 406.667 916.667 636.667 916.667 curveto
- 759.831 916.667 876.684 862.177 955.852 767.828 curveto
- 988.474 855.291 lineto
- 894.851 947.996 768.422 1000 636.667 1000 curveto
- 360.667 1000 136.667 776 136.667 500 curveto
- 136.667 224 360.667 0 636.667 0 curveto
- 753.23 0 866.13 40.725 955.852 115.135 curveto
- closepath fill
-
- 869.037 541.667 moveto
- 901.025 625 lineto
- 31.989 625 lineto
- 0 541.667 lineto
- closepath fill
-
- 805.059 375 moveto
- 837.048 458.333 lineto
- 31.989 458.333 lineto
- 0 375 lineto
- closepath fill
- grestore
- } bind def
- end
-
- /BuildGlyph {
- 1000 0
- 0 0 1000 1000
- setcachedevice
- exch /CharProcs get exch
- 2 copy known not {pop /.notdef} if
- get exec
- } bind def
-
- /BuildChar {
- 1 index /Encoding get exch get
- 1 index /BuildGlyph get exch
- } bind def
-
- currentdict
- end
- /euro-font exch definefont pop
- % End of Euro Font
-
- % Begin Shifted Font: copy font, rotate encoding matrix, redefine it
- 20 dict begin
- old-font findfont
- {1 index /FID ne {def} {pop pop} ifelse} forall
- mark currentdict /Encoding get aload pop
- counttomark dup 165 sub roll counttomark array astore
- /Encoding exch def pop
- currentdict
- end
- /new-shifted exch definefont pop
- % End of Shifted Shifted Font
-
- % Begin Composite Font
- 20 dict begin
- /FontType 0 def
- /FontMatrix [1 0 0 1 0 0] def
- /FontBBox [ 0 0 0 0] def
- /WMode 0 def
- /Encoding [0 1 2] def
- old-font findfont /Encoding get dup /PrefEnc exch def pop
-
- /FMapType 6 def % Use the SubsVector to figure out which one
- /FDepVector [ old-font findfont /euro-font findfont
- /new-shifted findfont ] def
- /SubsVector <00 a4 01 > readonly def
-
- currentdict
- end
- new-font exch definefont pop
- % End Composite Font
-} bind def % end of adding euro to font
-
-% if (key not defined) define key=value in current dictionary
-/ifndef { % key value
- 1 index where { pop pop } { def } ifelse
-} def
-/noheader true def
-/gaudyheader false def
-/def_headerpointsize 10 def
-/headerpointsize def_headerpointsize ifndef
-/gaudy_pointsize 15 def
-/font /Courier ifndef
-/def_pointsize 10 def
-/pointsize def_pointsize ifndef
-/Linespace {/Linespace pointsize 1.1 mul neg dup 3 1 roll def } def
-/must-add-euro-to-font false ifndef
-/#copies 1 ifndef
-/aspectratio 1 ifndef
-/formsperpage 1 ifndef
-/landscape false ifndef
-/magnification 1 ifndef
-/margin 10 def
-/orientation 0 def
-/encoding /ISOLatin1Encoding def
-/def_yoffset -0.30 def
-/def_xoffset .35 def
-/xoffset def_xoffset ifndef
-/yoffset def_yoffset ifndef
-/roundpage true def
-/useclippath true def
-/pagebbox [0 0 612 792] def
-
-%
-% function definitions
-%
-/inch {72 mul} bind def
-/point {72 div} bind def
-/min {2 copy gt {exch} if pop} bind def
-/max {2 copy lt {exch} if pop} bind def
-/rectpath {4 2 roll moveto dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto closepath } def
-
-/setup {
- counttomark 2 idiv {def} repeat pop
- landscape {/orientation 90 orientation add def} if
-
- %
- % If user requested an encoding that does not exist, issue a warning
- % and use whatever is available.
- %
- /encoding-vec
- encoding where {
- begin encoding cvx exec end % convert name to vector
- }{
- systemdict /EncodingDirectory known {
- EncodingDirectory encoding known { % maybe it's there
- EncodingDirectory encoding get
- }{
- /ISOLatin1Encoding where { % find a substitute
- pop /ISOLatin1Encoding
- }{
- /StandardEncoding
- } ifelse
-
- %
- % Tell the user what we're substituting for what.
- %
- (%% [ ) print
- encoding 100 string cvs print
- ( not found, substituting ) print
- dup 100 string cvs print
- ( ] %%\n) print
-
- cvx exec % now convert name to vector
- } ifelse
- }{
- /ISOLatin1Encoding where { % find a substitute
- pop /ISOLatin1Encoding
- }{
- /StandardEncoding
- } ifelse
-
- %
- % Tell the user what we're substituting for what.
- %
- (%% [ ) print
- encoding 100 string cvs print
- ( not found, substituting ) print
- dup 100 string cvs print
- ( ] %%\n) print
-
- cvx exec % now convert name to vector
- } ifelse
- } ifelse
- def
-
- systemdict /encodefont known
- {
- font findfont pointsize scalefont encoding-vec encodefont setfont
- }{
- font findfont
- dup length dict begin
- {1 index /FID ne {def} {pop pop} ifelse} forall
- /Encoding encoding-vec def
- currentdict
- end
- /font-newencoding exch definefont pop
- % if we need the Euro
- must-add-euro-to-font { % add the euro and use the new font
- /font-newencoding /font-newencoding-euro add-euro-to-font
- /font-newencoding-euro
- } { % just use the new encoding
- /font-newencoding
- } ifelse findfont
- pointsize scalefont setfont
- } ifelse
-
- /charwidth (M) stringwidth pop def
- /linespace pointsize pointsize .10 mul add neg def
- /headerspace headerpointsize headerpointsize .10 mul add 2 linespace mul sub neg def
-
- pagedimensions
-
- % if height is less than what's needed, omit top margin to avoid clipping off text from the bottom
- % if weight is less than what's needed, omit left margin to avoid clipping off text from the right
-
- /standard_height 66 def_pointsize def_pointsize .10 mul add mul yoffset inch sub margin 2 div add def
- /standard_gaudy_height .5 inch 64 def_pointsize def_pointsize .10 mul add mul add .1 inch add margin 2 div add def
-
- landscape { %yoffset not to be changed for landscape mode because it will cut off the top part
- /rel_height standard_height def
- gaudyheader { /rel_width 10.25 inch def }
- { /rel_width 10.0 inch def } ifelse
- }
- { /rel_height height def
- gaudyheader { /rel_width 7.75 inch def }
- { /rel_width 7.5 inch def } ifelse
- } ifelse
-
- noheader { rel_height height lt
- { /yoffset yoffset def_yoffset sub margin point 2 div add def }if
- width rel_width lt
- { /xoffset xoffset def_xoffset sub margin point 2 div sub def }if
- }
- { gaudyheader
- { rel_height standard_gaudy_height lt
- { /yoffset yoffset .1 add margin point 2 div add def }if
- width rel_width lt
- { /xoffset xoffset .10 sub margin point 2 div sub def }if
- }
- { rel_height height lt
- { /yoffset yoffset def_yoffset sub margin point 2 div add def }if
- width rel_width lt
- { /xoffset xoffset def_xoffset sub margin point 2 div sub def }if
- } ifelse
- } ifelse
-
- xcenter ycenter translate
- orientation neg rotate
- width 2 div neg height 2 div translate
- xoffset inch yoffset inch translate
- margin 2 div dup neg translate
- magnification dup aspectratio mul scale
-
- noheader{ landscape {0 linespace 2 mul translate }
- {0 linespace translate } ifelse
- }
- { gaudyheader { 0 linespace translate }
- { landscape { 0 headerspace linespace add translate }
- { 0 headerspace translate } ifelse
- } ifelse
- } ifelse
-} def
-
-/pagedimensions {
- useclippath userdict /gotpagebbox known not and {
- /pagebbox [clippath pathbbox newpath] def
- roundpage currentdict /roundpagebbox known and {roundpagebbox} if
- } if
- pagebbox aload pop
-
- %
- % Adjust page dimensions to "ignore" the header.
- %
- noheader not {
- landscape {
- exch
- .5 sub
- headerpointsize def_headerpointsize gt { headerpointsize def_headerpointsize sub 72 div sub } if
- exch
- }{
- .5 sub
- headerpointsize def_headerpointsize gt { headerpointsize def_headerpointsize sub 72 div sub } if
- } ifelse
- } if
-
- 4 -1 roll exch 4 1 roll 4 copy
- landscape {4 2 roll} if
- sub /width exch def
- sub /height exch def
- add 2 div /xcenter exch def
- add 2 div /ycenter exch def
- userdict /gotpagebbox true put
-} def
-
-
-/show_date_and_time { % show the date and the time
- /Times-Roman findfont 15 scalefont setfont
- currentdict /date known
- { 0 13 moveto date 0 setgray show } if
-} def
-
-/show_heading { % show the page heading
- 0 exch moveto
- currentdict /headerfont known
- {headerfont findfont gaudy_pointsize scalefont setfont}
- {/Times-Roman findfont gaudy_pointsize scalefont setfont} ifelse
- dup stringwidth pop 2 div width xoffset inch .5 inch add sub 2 div exch sub
- 0 rmoveto 0 setgray show
-} def
-
-/page_num_len { % count number of digits of the current page number
- /digits 1 def
- /tens 10 def
- { page tens lt
- { exit }
- { /digits digits 1 add def
- /tens tens 10 mul def } ifelse
- } loop
-} def
-
-/page_num { % convert page to a string
- page_num_len page digits string cvs
-} def
-
-/printpage { % stk:int (right justified from this "int" value)
- page_num stringwidth pop % get length of string
- sub % calculate white space
- 0 rmoveto page_num % move over to the right that much
- 0 setgray show
-} def
-
-/show_pagenum { % shows the page number
- 0 12 moveto
- /Times-Roman findfont 20 scalefont setfont
- width xoffset inch .5 inch add sub printpage
-} def
-
-/show_gaudyheader {
- -20 0 width xoffset inch -.10 inch add sub .5 inch rectpath .9 setgray fill
- show_date_and_time
- currentdict /pageheading known currentdict /filename known and
- { pageheading 22 show_heading
- filename 6 show_heading }
- { currentdict /pageheading known { pageheading 14 show_heading } if
- currentdict /filename known { filename 14 show_heading } if
- } ifelse
- show_pagenum
-} def
-
-/show_simpleheader {
- currentdict /headerfont known
- {headerfont findfont headerpointsize scalefont setfont}
- {/Courier-Bold findfont headerpointsize scalefont setfont} ifelse
- currentdict /pageheading known {
-
- %
- % if header given then don't print page number and date and filename
- %
-
- 0 0 moveto
- pageheading stringwidth pop 2 div width xoffset inch .5 inch add sub 2 div exch sub
- 0 rmoveto pageheading 0 setgray show }
-
- %
- % else print those stuff
- %
-
- { currentdict /date known
- { 0 0 moveto date 0 setgray show } if
- currentdict /filename known
- { 0 0 moveto
- filename stringwidth pop 2 div width xoffset inch .5 inch add sub 2 div exch sub
- 0 rmoveto filename 0 setgray show } if
- 0 0 moveto width xoffset inch .75 inch add sub printpage
- } ifelse
-} def
-
-/pagesetup {
- /page exch def
- gsave
-
- noheader { 0 linespace neg translate }
- { gaudyheader { 0 linespace neg translate }
- { 0 headerpointsize .10 mul 2 linespace mul sub translate } ifelse
- } ifelse
-
- noheader not { gaudyheader { show_gaudyheader }
- { show_simpleheader }
- ifelse }
- if
-
- grestore
- 0 0 moveto 0
-
-} bind def
-
-/L {
- counttomark 2 idiv {charwidth mul currentpoint exch pop moveto show} repeat
- Linespace add dup 0 exch moveto
-} bind def
-
-/l {show Linespace add dup 0 exch moveto} bind def
-
-/done {/lastpage where {pop lastpage} if} def
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/ps.requests b/usr/src/cmd/lp/filter/postscript/postscript/ps.requests
deleted file mode 100644
index 16bf1ee4de..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/ps.requests
+++ /dev/null
@@ -1,36 +0,0 @@
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License, Version 1.0 only
-% (the "License"). You may not use this file except in compliance
-% with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-% Keywords begin with an @ in the first column. The value follows on the next line
-% and includes everything up to next keyword line, except for comments which are
-% lines that begin with % in the first column.
-%
-
-@manualfeed
- statusdict begin
- /manualfeedtimeout 300 def
- /manualfeed true def
- end
-
-@ledgertray
- statusdict begin
- ledgertray
- end
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/tsol_banner.ps b/usr/src/cmd/lp/filter/postscript/postscript/tsol_banner.ps
deleted file mode 100644
index babf5df1c5..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/tsol_banner.ps
+++ /dev/null
@@ -1,30 +0,0 @@
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License (the "License").
-% You may not use this file except in compliance with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-% Use is subject to license terms.
-%
-%ident "%Z%%M% %I% %E% SMI"
-%
-% works in conjunction with tsol_separator.ps to do a banner page
-%
-
-SeparatorPagesDict /Banner get exec
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/tsol_separator.ps b/usr/src/cmd/lp/filter/postscript/postscript/tsol_separator.ps
deleted file mode 100644
index 50c4820551..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/tsol_separator.ps
+++ /dev/null
@@ -1,687 +0,0 @@
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License (the "License").
-% You may not use this file except in compliance with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-% Use is subject to license terms.
-%
-%ident "%Z%%M% %I% %E% SMI"
-%
-%% This PostScript file is normally used as input to the lp.tsol_separator
-%% program, which will prepend code to set the values of a number of
-%% variables. lp.tsol_separator is called by the printer interface script.
-
-%% This PostScript file may be modified for local customizations or
-%% internationalization. Comments marked "INTERNATIONALIZE:" show
-%% places where changes may be made for internationalization. Comments
-%% marked "CUSTOMIZE:" show places where some typical customization
-%% changes may be made.
-
-
-%% The following comments describe variables set by lp.tsol_separator
-
-%% These variables are from the print job information that can be
-%% displayed with lpstat or lpq.
-%%
-%% /Job_Classification The classification (from the sensitivity label) to
-%% be displayed at the top and bottom of the banner
-%% /Job_Printer Printer Name
-%% /Job_Host Host job was submitted from
-%% /Job_User User who submitted the job
-%% /Job_JobID Job number
-%% /Job_Title Job title
-%%
-%%
-%% This variable is NO if an authorized user used the lp -o nobanner option
-%% and the printer was set up to allow bannerless jobs. Otherwise it is YES.
-%%
-%% /Job_DoPageLabels Print page labels YES/NO.
-%%
-%% These variables are generated from the system clock value.
-%%
-%% /Job_Date Date and time the job is being printed, in the
-%% locale's default format
-%% /Job_Hash A randomly generatred identifying number for
-%% matching up the banner and trailer pages of the job
-%%
-%%
-%% The following variables are the job's labels
-%% as interpreted by the bcltobanner(3TSOL) library routine.
-%%
-%% /Job_Classification The classification (from the sensitivity label) to be
-%% displayed at the top and bottom of the banner page.
-%% /Job_Protect The sensitivity label to be displayed in the protect-as
-%% field.
-%% /Job_Caveats The caveats from the sesitivity label.
-%% /Job_Channels The channels from the sesitivity label.
-%%
-%%
-%% The following variables are the job's Sensitivity Label and
-%% Information Label as interpreted by the bsltos and biltos library
-%% routines.
-%%
-%% /Job_SL_Internal The sensitivity label in internal view format.
-%% /Job_SL_External The sensitivity label in external view format.
-
-/SeparatorPagesDict 100 dict def
-userdict /JobDict known not {
- userdict /JobDict 100 dict put
-} if
-
-SeparatorPagesDict
-begin
-
- %% CUSTOMIZE: To print header page label left-justified, set this to false
- /center_label true def
-
- /center_show where {
- pop
- } {
- userdict /center_show
- {
- dup stringwidth exch
- 2 div neg exch rmoveto show
- } put
- } ifelse
-
- /append where
- { pop }
- {
- /append
- {
- 1 index length 1 index length add
- 1 index dup type /dicttype eq
- {
- pop dict
- begin
- exch { def } forall
- { def } forall
- currentdict
- end
- }
- {
- /arraytype eq { array } { string } ifelse
- dup 4 -1 roll 1 index copy length 4 -1 roll putinterval
- }
- ifelse
- } def
- } ifelse
-
- /fontheight
- systemdict /fontheight known
- { systemdict /fontheight get }
- {
- {
- gsave
- setfont (qf) true charpath flattenpath pathbbox
- 4 -1 roll pop exch pop exch sub
- grestore
- }
- } ifelse
- def
-
- /m { moveto } def
- /r { rmoveto } def
- /rl { rlineto } def
-
- /NewLine {
- currentpoint exch pop
- currentfont fontheight sub errorx0 exch moveto
- } def
-
- /clipSL {
- /MaxWidth exch def
- dup stringwidth pop MaxWidth gt {
- {
- dup stringwidth pop (<-) stringwidth pop add MaxWidth le {exit} if
- dup 0 exch length 1 sub getinterval
- } loop
- (<-)
- %% Concatenate strings
- dup length 2 index length add 1 index pop string
- dup 0 4 index putinterval
- dup 4 -1 roll length 4 -1 roll putinterval
- } if
- } def
-
- /BreakWithBlanks {
-
- {restoftext ( ) search
- {
- /blank_nextword exch def pop
- /blank_restoftext exch def
- /blank_wordwidth blank_nextword stringwidth pop def
-
- restoftext (/) search
- {
- /slash_nextword exch def pop
- /slash_restoftext exch def
- /slash_wordwidth slash_nextword stringwidth pop def
-
- blank_wordwidth slash_wordwidth lt
- {
- /nextword blank_nextword def
- /restoftext blank_restoftext def
- /wordwidth blank_wordwidth def
- /breakwidth ( ) stringwidth pop def
- }
- {
- /nextword slash_nextword def
- /restoftext slash_restoftext def
- /wordwidth slash_wordwidth def
- /breakwidth (/) stringwidth pop def
- }ifelse
- }
- {
- pop
- /nextword blank_nextword def
- /restoftext blank_restoftext def
- /wordwidth blank_wordwidth def
- /breakwidth ( ) stringwidth pop def
- }ifelse
-
- curwidth wordwidth add linewidth gt
- {textstring startchar
- lastwordbreak startchar sub
- getinterval proc
- /startchar lastwordbreak def
- /curwidth wordwidth breakwidth add def }
-
- {/curwidth curwidth wordwidth add
- breakwidth add def
- } ifelse
- /lastwordbreak lastwordbreak
- nextword length add 1 add def
- }
- {pop BreakWithSlashes exit}
- ifelse
- }loop
-}def
-
- /BreakWithSlashes
- {
- /breakchar (/) def
- /breakwidth breakchar stringwidth pop def
- {restoftext breakchar search
- {/nextword exch def pop
- /restoftext exch def
- /wordwidth nextword stringwidth pop def
-
- curwidth wordwidth add linewidth gt
- {textstring startchar
- lastwordbreak startchar sub
- getinterval proc
- /startchar lastwordbreak def
- /curwidth wordwidth breakwidth add def }
-
- {/curwidth curwidth wordwidth add
- breakwidth add def
- } ifelse
- /lastwordbreak lastwordbreak
- nextword length add 1 add def
- }
- {pop exit}
- ifelse
- }loop
- }def
-
- /BreakIntoLines
- {/proc exch def
- /linewidth exch 40 sub def
- /textstring exch def
-
- /curwidth 0 def
- /lastwordbreak 0 def
- /startchar 0 def
- /restoftext textstring def
-
- % begin scale the font if necessary
-
- /allowedarea linewidth fbh 10 div mul def
- /currentarea currentfont fontheight textstring stringwidth pop mul def
-
- currentarea allowedarea gt
- {
- currentfont allowedarea currentarea div scalefont setfont
- }if
-
- % end scale the font if necessary
-
- BreakWithBlanks
- /lastchar textstring length def
- textstring startchar lastchar startchar sub
- getinterval proc
- }def
-
-
- /ShowBanner {
- JobDict /Job_Proclam? get {
- systemdict /showpage get cvx exec
- } if
- } def
-
- /Init {
-
- initgraphics
- /#copies 1 def
- initmatrix
- erasepage
-
- clippath pathbbox /fbh exch def
- /fbw exch def
- pop pop newpath
- 0 0 moveto
- 0 fbh translate
- 0 0 moveto
-
- /margin fbh 20 div def
- /imargin margin 1.1 mul def
- /errorx0 imargin def
- /errorx1 fbw imargin sub def
- /errory1 imargin def
-
- gsave
- } def
-
-% this stuff is lpd dependant.
-
- /lpdglue {
- userdict
- begin
- JobDict
- begin
- % If Job_Printer is defined, assume the others are too,
- /Job_Printer where
- {
- pop
- /Job_Proclam? true def
- /Job_Endclam? true def
-
- /Printer Job_Printer def
- /Host Job_Host def
- /User Job_User def
- /Title Job_Title def
- /JobID Job_JobID def
- /Date Job_Date def
-
- %% CUSTOMIZE: To use a different string at the top and
- %% bottom of each page, change the following line. For
- %% instance, to use the sensitivity label in external view
- %% format, change the line to: /PageLabel Job_SL_External def
- %% To eliminate page labels completely, change this line to
- %% set the page label to an empty string: /PageLabel () def
- /PageLabel Job_SL_Internal def
- Job_Protect () eq
- {
- %% Job_Protect is empty because SLs are turned
- %% off in secconf. (Turning off SLs is actually not yet
- %% supported by the system.)
- /Protect () def
- /Protect_Text1 () def
- /Protect_Text2 () def
- }
- {
- %% INTERNATIONALIZE/CUSTOMIZE: Replace the text between
- %% parentheses with the appropriate text to display
- %% above and below the SL.
- /Protect Job_Protect def
- /Protect_Text1 (This output must be protected as:) def
- /Protect_Text2 (unless manually reviewed and downgraded.) def
- }
- ifelse
-
- %% CUSTOMIZE: To not print the caveats, change
- %% this line to /Caveats () def
- /Caveats Job_Caveats def
- %% CUSTOMIZE: To not print the channels, change
- %% this line to /Channels () def
- /Channels Job_Channels def
-
- %% CUSTOMIZE: To not print the hash number, change
- %% this line to /Hash () def
- /Hash Job_Hash def
-
- %% CUSTOMIZE: To not print the head label, change
- %% this line to /HeadLabel () def
- %% You may also substitute another string. For example, to use
- %% the SL in internal view format: /HeadLabel Job_SL_Internal def
- /HeadLabel Job_Classification def
- } {
- /Job_Proclam? false def
- /Job_Endclam? false def
- } ifelse
- end
- end
- } def
-
- /border {
- gsave
- setlinewidth
- setgray
- 30 -20 moveto
- 0 60 fbh sub rlineto
- fbw 60 sub 0 rlineto
- 0 fbh 60 sub rlineto
- 60 currentlinewidth 2 div sub fbw sub 0 rlineto
- stroke
- grestore
- } def
-
- /TSOLJobInfo {
- gsave
-
- /fontscale fbh 50 div def
- /Courier-Bold findfont fontscale scalefont setfont
- /ClippedLabel
- JobDict /HeadLabel get
- SeparatorPagesDict /fbw get 90 sub
- SeparatorPagesDict /clipSL get exec
- def
-
- /head_len {
- ClippedLabel stringwidth pop 5 add
- HeadLabel () eq { pop 0 } if
- } def
- 15 setlinewidth
- fbw 2 div head_len 2 div sub -20 moveto
- head_len 0 rlineto stroke
- 1 setgray
- fbw 10 div -25 m gsave ClippedLabel
- currentpoint exch pop fbw 2 div exch moveto
- center_show NewLine grestore
-
- 0 setgray
- /fontscale fbh 70 div def
-
- /Helvetica findfont fontscale scalefont setfont
- 0 fbh 8 div neg r Protect_Text1
- currentpoint exch pop
- center_label {
- fbw 2 div exch moveto center_show
- }
- {
- fbw 10 div exch moveto show
- }
- ifelse
- /fontscale fbh 60 div def
- /Helvetica-Bold findfont fontscale scalefont setfont
-
- 0 fbh 150 div neg r
- Protect
- fbw errorx0 3 mul sub % width minus margins
-
- center_label {
- {NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
- BreakIntoLines
- }
- {
- {NewLine currentpoint exch pop fbw 10 div exch moveto show}
- BreakIntoLines
- }
- ifelse
-
- /fontscale fbh 70 div def
- /Helvetica findfont fontscale scalefont setfont
- 0 fbh 50 div neg r Protect_Text2
- currentpoint exch pop
- center_label {
- fbw 2 div exch moveto center_show
- }
- {
- fbw 10 div exch moveto show
- }
- ifelse
-
- /fontscale fbh 60 div def
- /Helvetica-Bold findfont fontscale scalefont setfont
- 0 fbh 200 div neg r
-
- 0 fbh 10 div neg r
-
- /fontscale fbh 40 div def
- /Helvetica-Bold findfont fontscale scalefont setfont
-
- 0 fbh 30 div neg r gsave
- %% INTERNATIONALIZE: Replace the text between
- %% parentheses with the appropriate text.
- (User: ) User (@) Host append append append
- currentpoint exch pop fbw 2 div exch moveto center_show
- NewLine grestore
- 0 fbh 30 div neg r gsave
- %% INTERNATIONALIZE: Replace the text between
- %% parentheses with the appropriate text.
- (Job: ) JobID append
- currentpoint exch pop fbw 2 div exch moveto center_show
- NewLine grestore
- 0 fbh 30 div neg r gsave
- Title
- currentpoint exch pop fbw 2 div exch moveto center_show
- NewLine grestore
- /fontscale fbh 70 div def
- /Helvetica findfont fontscale scalefont setfont
- 0 fbh 30 div neg r gsave
- %% INTERNATIONALIZE: Replace the text between
- %% parentheses with the appropriate text.
- (Printed at: ) Date append
- currentpoint exch pop fbw 2 div exch moveto center_show
- NewLine grestore
- 0 fbh 30 div neg r gsave
- %% INTERNATIONALIZE: Replace the text between
- %% parentheses with the appropriate text.
- (Printer queue: ) Printer append
- currentpoint exch pop fbw 2 div exch moveto center_show
- NewLine grestore
-
- /Helvetica-Bold findfont fontscale scalefont setfont
- 0 fbh 20 div neg r
- Caveats
- fbw errorx0 3 mul sub % width minus margins
- {NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
- BreakIntoLines
-
- 0 fbh 30 div neg r
- Channels
- fbw errorx0 3 mul sub % width minus margins
- {NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
- BreakIntoLines
-
- /fontscale fbh 50 div def
- /Courier-Bold findfont fontscale scalefont setfont
- 15 setlinewidth
- fbw 2 div head_len 2 div sub 40 fbh sub moveto
- head_len 0 rlineto stroke
- 1 setgray
- fbw 10 div 35 fbh sub m gsave ClippedLabel
- currentpoint exch pop fbw 2 div exch moveto center_show
- NewLine grestore
-
- grestore
- } def
-
- /JobHashInfo {
- gsave
- 0 setgray
- /fontscale fbh 50 div def
- /Helvetica-Bold findfont fontscale scalefont setfont
-
- %% Upper left corner
- Hash
- fbw 12 div 50 neg m gsave show grestore
-
- %% Lower left corner
- Hash
- fbw 12 div fbh 60 sub neg m gsave show grestore
-
- %% Lower right corner
- Hash dup stringwidth pop
- fbw 11 mul 12 div exch sub fbh 60 sub neg m gsave show grestore
-
- %% Upper right corner
- Hash dup stringwidth pop
- fbw 11 mul 12 div exch sub 50 neg m gsave show grestore
-
- /fontscale fbh 40 div def
- /Helvetica-Bold findfont fontscale scalefont setfont
- fbw 10 div 120 fbh sub m gsave
- currentpoint exch pop fbw 2 div exch moveto center_show
-
- grestore
- } def
-
-
- /jobproclam {
- JobDict
- begin
- Job_Proclam?
- %% INTERNATIONALIZE: Replace the text between
- %% parentheses with the appropriate text.
- { TSOLJobInfo (JOB START) JobHashInfo}
- { 0 -100 rmoveto }
- ifelse
- end
- } def
-
- /jobendclam {
- JobDict
- begin
- Job_Endclam?
- %% INTERNATIONALIZE: Replace the text between
- %% parentheses with the appropriate text.
- { TSOLJobInfo (JOB END) JobHashInfo}
- { 0 -100 rmoveto }
- ifelse
- end
- } def
-
-
- /JobProclam {
- jobproclam
- } def
-
- /JobEndclam {
- jobendclam
- } def
-
-% A fancy box around page
-
- /BannerBorder {
- .7 16 border
- } def
-
- /TrailerBorder {
- 0 4 border
- } def
-
-%
-% -------------------------------------------------------------------------
-%
-% The structure of separator pages is defined below. This is invoked by
-% using a line like:
-%
-% SeparatorPagesDict /Banner get exec
-%
-
- /Banner {
- SeparatorPagesDict
- begin
- Init
- lpdglue
- BannerBorder
- JobProclam
- /SkipPageLabels true def
- ShowBanner
- /SkipPageLabels false def
- end
- } def
-
- /Trailer {
- SeparatorPagesDict
- begin
- Init
- lpdglue
- TrailerBorder
- JobEndclam
- /SkipPageLabels true def
- ShowBanner
- /SkipPageLabels false def
- end
- } def
-
- /SkipPageLabels false def
-end
-
-SeparatorPagesDict begin
- clippath pathbbox /fbh exch def
- /fbw exch def
- pop pop
- lpdglue
-end
-
-
-JobDict /Job_DoPageLabels get (YES) eq
- JobDict /PageLabel get () ne and {
- userdict begin
- /showpage {
- SeparatorPagesDict /SkipPageLabels get false eq {
- gsave
- initgraphics
- /Courier-Bold findfont
- 12 scalefont setfont
-
- /ClippedLabel
- JobDict /PageLabel get
- SeparatorPagesDict /fbw get 60 sub
- SeparatorPagesDict /clipSL get exec
- def
-
- /inf_len {
- ClippedLabel stringwidth pop 6 add
- } def
-
- /page_mid SeparatorPagesDict /fbw get 2 div def
-
- 10 setlinewidth
-
- % print label for bottom of page
- 0 setgray
- page_mid inf_len 2 div sub 17 moveto
- inf_len 0 rlineto stroke
-
- 1 setgray
- page_mid inf_len 2 div sub 14 moveto
- ClippedLabel show
-
- % print label for top of page
- 0 setgray
- page_mid inf_len 2 div sub
- SeparatorPagesDict /fbh get 5 sub moveto
- inf_len 0 rlineto stroke
-
- 1 setgray
- page_mid inf_len 2 div sub SeparatorPagesDict /fbh get 8
- sub moveto ClippedLabel show
- grestore
- } if
- systemdict /showpage get cvx exec
- } bind def
- end
-}if
-
-%% End of tsol_separator.ps
diff --git a/usr/src/cmd/lp/filter/postscript/postscript/tsol_trailer.ps b/usr/src/cmd/lp/filter/postscript/postscript/tsol_trailer.ps
deleted file mode 100644
index f716b3df06..0000000000
--- a/usr/src/cmd/lp/filter/postscript/postscript/tsol_trailer.ps
+++ /dev/null
@@ -1,29 +0,0 @@
-%
-% CDDL HEADER START
-%
-% The contents of this file are subject to the terms of the
-% Common Development and Distribution License (the "License").
-% You may not use this file except in compliance with the License.
-%
-% You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-% or http://www.opensolaris.org/os/licensing.
-% See the License for the specific language governing permissions
-% and limitations under the License.
-%
-% When distributing Covered Code, include this CDDL HEADER in each
-% file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-% If applicable, add the following below this CDDL HEADER, with the
-% fields enclosed by brackets "[]" replaced with your own identifying
-% information: Portions Copyright [yyyy] [name of copyright owner]
-%
-% CDDL HEADER END
-%
-%
-% Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-% Use is subject to license terms.
-%
-%ident "%Z%%M% %I% %E% SMI"
-%
-% used in conjunction with tsol_separator.ps to create a trailer page
-%
-SeparatorPagesDict /Trailer get exec
diff --git a/usr/src/cmd/lp/filter/slow.filter b/usr/src/cmd/lp/filter/slow.filter
deleted file mode 100644
index be5a5d3427..0000000000
--- a/usr/src/cmd/lp/filter/slow.filter
+++ /dev/null
@@ -1,115 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-###########
-##
-## Simple shell script that saves the Spooler alot of headaches.
-## This routine invokes a slow filter on each of the files in a
-## user's print request, sending the output to separate files.
-## The Spooler will take ANYTHING that goes to standard error
-## and give it to the user. Non-empty standard error or non-zero
-## exit code cause cancellation of the print request.
-##
-## Calling sequence:
-##
-## slow.filter prefix file1 file2 ... fileN
-##
-## "prefix" is prefix of full path name for output files. All we
-## do is append a ``-k'' for k = 1, 2, ..., N.
-##########
-
-#####
-#
-# Most of the time we don't want the standard error to be captured
-# by the Spooler, mainly to avoid "Terminated" messages that the
-# shell puts out when we get a SIGTERM. We'll save the standard
-# error channel under another number, so we can use it when it
-# should be captured.
-#####
-exec 5>&2 2>/dev/null
-
-#####
-# Error message formatter:
-#
-# Invoke as
-#
-# errmsg severity message-number problem help
-#
-# where severity is "ERROR" or "WARNING", message-number is
-# a unique identifier, problem is a short description of the
-# problem, and help is a short suggestion for fixing the problem.
-#####
-
-LP_ERR_LABEL="UX:lp"
-
-E_IP_ARGS=1
-E_IP_OPTS=2
-E_IP_FILTER=3
-E_IP_STTY=4
-E_IP_UNKNOWN=5
-E_IP_BADFILE=6
-E_IP_BADCHARSET=7
-E_IP_BADCPI=8
-E_IP_BADLPI=9
-E_IP_BADWIDTH=10
-E_IP_BADLENGTH=11
-E_IP_ERRORS=12
-
-errmsg () {
- case $1 in
- ERROR )
- sev=" ERROR";
- ;;
- WARNING )
- sev="WARNING";
- ;;
- esac
-# tag=`expr "${LP_ERR_LABEL}" : "\(.*\):"``expr "${LP_ERR_LABEL}" : ".*:\(.*\)"`
- echo "${LP_ERR_LABEL}: ${sev}: $3
- TO FIX: $4" >&5
-}
-
-prefix=$1
-shift
-
-k=1
-for file in "$@"
-do
- if [ ! -r "${file}" ]
- then
- errmsg ERROR ${E_IP_BADFILE} \
- "Cannot read the file \"${file}\"." \
- "See if it still exists and is readable, or
- consult your system administrator."
- else
- 0<${file} 1>${prefix}-${k} eval "2>&5 ${FILTER}" || {
- exit_code=$?
- while [ 127 -lt "${exit_code}" ]
- do
- exit_code=`expr "${exit_code}" - 128`
- done
- exit ${exit_code}
- }
- fi
- k=`expr "${k}" + 1`
-done
diff --git a/usr/src/cmd/lp/include/access.h b/usr/src/cmd/lp/include/access.h
deleted file mode 100644
index 7010e0a01a..0000000000
--- a/usr/src/cmd/lp/include/access.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-
-#if !defined(_LP_ACCESS_H)
-#define _LP_ACCESS_H
-
-#include "stdio.h"
-
-/*
- * To speed up reading in each allow/deny file, ACC_MAX_GUESS slots
- * will be preallocated for the internal copy. If these files
- * are expected to be substantially larger than this, bump it up.
- */
-#define ACC_MAX_GUESS 100
-
-int allow_form_printer ( char **, char * );
-int allow_user_form ( char ** , char * );
-int allow_user_printer ( char **, char * );
-int allowed ( char *, char **, char ** );
-int deny_form_printer ( char **, char * );
-int deny_user_form ( char ** , char * );
-int deny_user_printer ( char **, char * );
-int dumpaccess ( char *, char *, char *, char ***, char *** );
-int is_form_allowed_printer ( char *, char * );
-int is_user_admin ( void );
-int is_user_allowed ( char *, char ** , char ** );
-int is_user_allowed_form ( char *, char * );
-int is_user_allowed_printer ( char *, char * );
-int load_formprinter_access ( char *, char ***, char *** );
-int load_paperprinter_access(char *, char ***, char ***);
-int load_userform_access ( char *, char ***, char *** );
-int load_userprinter_access ( char *, char ***, char *** );
-int loadaccess ( char *, char *, char *, char ***, char *** );
-int bangequ ( char * , char * );
-int bang_searchlist ( char * , char ** );
-int bang_dellist ( char *** , char * );
-
-char * getaccessfile ( char *, char *, char *, char * );
-
-#endif
diff --git a/usr/src/cmd/lp/include/class.h b/usr/src/cmd/lp/include/class.h
deleted file mode 100644
index 3147a5f31b..0000000000
--- a/usr/src/cmd/lp/include/class.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#if !defined(_LP_CLASS_H)
-#define _LP_CLASS_H
-
-/**
- ** The internal flags seen by the Spooler/Scheduler and anyone who asks.
- **/
-
-#define CS_REJECTED 0x001
-
-/**
- ** The internal copy of a class as seen by the rest of the world:
- **/
-
-/*
- * A (char **) list is an array of string pointers (char *) with
- * a null pointer after the last item.
- */
-typedef struct CLASS {
- char *name; /* name of class (redundant) */
- char **members; /* members of class */
-} CLASS;
-
-/**
- ** Various routines.
- **/
-
-#if defined(__STDC__)
-
-CLASS *getclass ( char * );
-
-int putclass ( char *, CLASS * );
-int delclass ( char * );
-
-void freeclass ( CLASS * );
-
-#else
-
-CLASS *getclass();
-
-int putclass(),
- delclass();
-
-void freeclass();
-
-#endif
-
-#endif
diff --git a/usr/src/cmd/lp/include/filters.h b/usr/src/cmd/lp/include/filters.h
deleted file mode 100644
index c0b2a89103..0000000000
--- a/usr/src/cmd/lp/include/filters.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-/**
- ** The disk copy of the filter table:
- **/
-
-/*
- * There are 9 fields in the filter table (the first one is ignored).
- */
-#define FL_MAX 9
-# define FL_IGN 0
-# define FL_PTYPS 1
-# define FL_PRTRS 2
-# define FL_ITYPS 3
-# define FL_NAME 4
-# define FL_OTYPS 5
-# define FL_TYPE 6
-# define FL_CMD 7
-# define FL_TMPS 8
-
-/*
- * Various strings.
- */
-#define FL_SEP ":"
-#define FL_END "\n"
-#define FL_FAST "fast"
-#define FL_SLOW "slow"
-
-/**
- ** The internal copy of a filter as seen by the rest of the world:
- **/
-
-typedef enum FILTERTYPE {
- fl_none,
- fl_fast,
- fl_slow,
- fl_both
-} FILTERTYPE;
-
-/*
- * A (char **) list is an array of string pointers (char *) with
- * a null pointer after the last item.
- */
-typedef struct FILTER {
- char * name; /* name of filter (redundant) */
- char * command; /* shell command (full path) */
- FILTERTYPE type; /* type of filter (fast/slow) */
- char ** printer_types; /* list of valid printer types */
- char ** printers; /* list of valid printers */
- char ** input_types; /* list of valid input types */
- char ** output_types; /* list of valid output types */
- char ** templates; /* list of option templates */
-} FILTER;
-
-/**
- ** The internal copy of a filter as seen by the filter routines:
- **/
-
-/*
- * To speed up processing the filter table, FL_MAX_GUESS slots
- * will be preallocated for the internal copy. If filter tables
- * are expected to be substantially larger than this, bump it up.
- */
-#define FL_MAX_GUESS 10
-
-typedef struct TYPE {
- char * name;
- unsigned short info; /* 1 iff "name" is in Terminfo */
-} TYPE;
-
-#define PATT_STAR "*"
-
-typedef struct TEMPLATE {
- char * keyword;
- char * pattern;
- char * re;
- char * result;
- int nbra;
-} TEMPLATE;
-
-/*
- * A (TYPE *) list is an array of content-types (TYPE) with a null
- * "name" element. A (TEMPLATE *) list is an array of templates (TEMPLATE)
- * with a null "keyword" element.
- */
-typedef struct _FILTER {
- struct _FILTER * next; /* for linking several */
- char * name;
- char * command;
- char ** printers;
- TYPE * printer_types;
- TYPE * input_types; /* all possible choices */
- TYPE * output_types; /* all possible choices */
- TYPE * inputp; /* the one to be used */
- TYPE * outputp; /* the one to be used */
- TEMPLATE * templates;
- FILTERTYPE type;
- unsigned char mark,
- level;
-} _FILTER;
-
-#define FL_CLEAR 0x00
-#define FL_SKIP 0x01
-#define FL_LEFT 0x02
-#define FL_RIGHT 0x04
-
-#define PARM_INPUT "INPUT"
-#define PARM_OUTPUT "OUTPUT"
-#define PARM_TERM "TERM"
-#define PARM_PRINTER "PRINTER"
-
-#define NPARM_SPEC 8
-# define PARM_CPI "CPI"
-# define PARM_LPI "LPI"
-# define PARM_LENGTH "LENGTH"
-# define PARM_WIDTH "WIDTH"
-# define PARM_PAGES "PAGES"
-# define PARM_CHARSET "CHARSET"
-# define PARM_FORM "FORM"
-# define PARM_COPIES "COPIES"
-
-#define PARM_MODES "MODES"
-
-#define FPARM_CPI 0x0001
-#define FPARM_LPI 0x0002
-#define FPARM_LENGTH 0x0004
-#define FPARM_WIDTH 0x0008
-#define FPARM_PAGES 0x0010
-#define FPARM_CHARSET 0x0020
-#define FPARM_FORM 0x0040
-#define FPARM_COPIES 0x0080
-#define FPARM_MODES 0x0100
-
-/**
- ** Various routines.
- **/
-
-/*
- * Null terminated list (filters[i].name == NULL).
- */
-extern _FILTER *filters;
-
-extern size_t nfilters;
-
-#if defined(__STDC__)
-
-FILTER * getfilter ( char * );
-
-_FILTER * search_filter ( char * );
-
-FILTERTYPE insfilter ( char ** , char * , char * , char * , char * , char ** , unsigned short * );
-FILTERTYPE s_to_filtertype ( char * );
-
-TEMPLATE s_to_template ( char * );
-
-TEMPLATE * sl_to_templatel ( char ** );
-
-TYPE s_to_type ( char * );
-
-TYPE * sl_to_typel ( char ** );
-
-char * template_to_s ( TEMPLATE );
-char * type_to_s ( TYPE );
-
-char ** templatel_to_sl ( TEMPLATE * );
-char ** typel_to_sl ( TYPE * );
-
-int open_filtertable ( char * , char * );
-
-int get_and_load ( void );
-int putfilter ( char * , FILTER * );
-int delfilter ( char * );
-int loadfilters ( char * );
-int dumpfilters( char * );
-
-void freetempl ( TEMPLATE * );
-void freefilter ( FILTER * );
-void free_filter ( _FILTER * );
-void trash_filters ( void );
-void close_filtertable ( FILE * );
-
-#else
-
-extern FILTER *getfilter();
-
-extern _FILTER *search_filter();
-
-extern FILTERTYPE insfilter(),
- s_to_filtertype();
-
-extern TYPE s_to_type(),
- *sl_to_typel();
-
-extern TEMPLATE s_to_template(),
- *sl_to_templatel();
-
-#if defined(BUFSIZ)
-extern FILE *open_filtertable();
-#endif
-
-extern char **typel_to_sl(),
- **templatel_to_sl(),
- *getfilterfile();
-
-extern int putfilter(),
- delfilter(),
- loadfilters(),
- get_and_load();
-
-extern void freefilter(),
- free_filter(),
- freetempl(),
- trash_filters(),
- close_filtertable();
-
-#endif
diff --git a/usr/src/cmd/lp/include/form.h b/usr/src/cmd/lp/include/form.h
deleted file mode 100644
index a742cc9060..0000000000
--- a/usr/src/cmd/lp/include/form.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#if !defined(_LP_FORM_H)
-#define _LP_FORM_H
-
-/**
- ** The disk copy of the form files:
- **/
-
-/*
- * There are 10 fields in the form configuration file.
- */
-# define FO_MAX 10
-# define FO_PLEN 0
-# define FO_PWID 1
-# define FO_NP 2
-# define FO_LPI 3
-# define FO_CPI 4
-# define FO_CHSET 5
-# define FO_RCOLOR 6
-# define FO_CMT 7
-# define FO_ALIGN 8
-# define FO_PAPER 9
-
-/**
- ** The internal copy of a form as seen by the rest of the world:
- **/
-
-typedef struct FORM {
- SCALED plen;
- SCALED pwid;
- SCALED lpi;
- SCALED cpi;
- int np;
- char * chset;
- short mandatory;
- char * rcolor;
- char * comment;
- char * conttype;
- char * name;
- char * paper;
- short isDefault;
-} FORM;
-
-/*
- * Default configuration values:
- */
-#define DPLEN 66
-#define DPWIDTH 80
-#define DNP 1
-#define DLPITCH 6
-#define DCPITCH 10
-#define DCHSET NAME_ANY
-#define DRCOLOR NAME_ANY
-#define DCONTYP NAME_SIMPLE
-#define ENDENV "#ENDOF_ENV\n"
-#define MANSTR "mandatory"
-#define DFTSTR "default"
-
-/*
- * These are the filenames that may be used for storing a form
- */
-#define DESCRIBE "describe"
-#define COMMENT "comment"
-#define ALIGN_PTRN "align_ptrn"
-#define ALERTSH "alert.sh"
-#define ALERTVARS "alert.vars"
-
-#define err_hndlr int (*)( int , int , int )
-
-int delform ( char * );
-int getform ( char * , FORM * , FALERT * , FILE ** );
-int putform ( char * , FORM * , FALERT * , FILE ** );
-int rdform ( char * , FORM * , int , err_hndlr , int * );
-int wrform ( char * , FORM * , int , err_hndlr , int * );
-
-void freeform ( FORM * );
-
-#undef err_hndlr
-
-#endif
diff --git a/usr/src/cmd/lp/include/lp.h b/usr/src/cmd/lp/include/lp.h
deleted file mode 100644
index 50cef37ade..0000000000
--- a/usr/src/cmd/lp/include/lp.h
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#ifndef _LP_LP_H
-#define _LP_LP_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <dirent.h>
-
-/**
- ** Types:
- **/
-
-typedef struct SCALED {
- float val; /* value of number, scaled according to "sc" */
- char sc; /* 'i' inches, 'c' centimeters, ' ' lines/cols */
-} SCALED;
-
-typedef struct FALERT {
- char * shcmd; /* shell command used to perform the alert */
- int Q; /* # requests queued to activate alert */
- int W; /* alert is sent every "W" minutes */
-} FALERT;
-
-
-#define LP_USE_PAPI_ATTR 1 /* use PAPI attributes for printing */
- /* TODO: is this best place for this ? */
-
-/**
- ** Places:
- **/
-
-/*
- * These functions no longer exist. The defines take care
- * of recompiling code that expects these and the null functions
- * in getpaths.c take care of relinking objects that expect these.
- */
-#define getpaths()
-#define getadminpaths(x)
-
-#define LPDIR "/usr/lib/lp"
-#define ETCDIR "/etc/lp"
-#define SPOOLDIR "/var/spool/lp"
-#define LOGDIR "/var/lp/logs"
-
-#define TERMINFO "/usr/share/lib/terminfo"
-
-#define LPUSER "lp"
-#define ROOTUSER "root"
-
-#define BANG_S "!"
-#define BANG_C '!'
-
-#define LOCAL_LPUSER BANG_S LPUSER
-#define LOCAL_ROOTUSER BANG_S ROOTUSER
-#define ALL_BANG_ALL NAME_ALL BANG_S NAME_ALL
-
-/* #define ADMINSDIR "admins" */
-/* # define CLASSESDIR "classes" */
-/* # define FORMSDIR "forms" */
-/* # define INTERFACESDIR "interfaces" */
-/* # define PRINTERSDIR "printers" */
-/* # define PRINTWHEELSDIR "pwheels" */
-/* #define BINDIR "bin" */
-/* #define LOGSDIR "logs" */
-/* #define MODELSDIR "model" */
-/* #define NETWORKDIR "network" */
-#define FIFOSDIR "fifos"
-/* # define PRIVFIFODIR "private" */
-/* # define PUBFIFODIR "public" */
-/* #define REQUESTSDIR "requests" */
-/* #define SYSTEMDIR "system" */
-/* #define TEMPDIR "temp" */
-/* #define TMPDIR "tmp" */
-
-/* #define SCHEDLOCK "SCHEDLOCK" */
-/* #define FIFO "FIFO" */
-
-#define FILTERTABLE "filter.table"
-#define FILTERTABLE_I "filter.table.i"
-
-/* #define DESCRIBEFILE "describe" */
-/* #define ALIGNFILE "align_ptrn" */
-#define COMMENTFILE "comment"
-#define ALLOWFILE "allow"
-#define DENYFILE "deny"
-#define ALERTSHFILE "alert.sh"
-#define ALERTVARSFILE "alert.vars"
-#define ALERTPROTOFILE "alert.proto"
-#define CONFIGFILE "configuration"
-#define FACCESSPREFIX "forms."
-#define PACCESSPREFIX "paper."
-#define UACCESSPREFIX "users."
-#define FALLOWFILE FACCESSPREFIX ALLOWFILE
-#define FDENYFILE FACCESSPREFIX DENYFILE
-#define UALLOWFILE UACCESSPREFIX ALLOWFILE
-#define UDENYFILE UACCESSPREFIX DENYFILE
-/* #define DEFAULTFILE "default" */
-#define STATUSFILE "status"
-/* #define USERSFILE "users" */
-/* #define NAMEFILE "name" */
-/* #define XFERFILE "transfer" */
-/* #define EXECFILE "execute" */
-#define PSTATUSFILE "pstatus"
-#define CSTATUSFILE "cstatus"
-/* #define REQLOGFILE "requests" */
-
-#define STANDARD "standard"
-/* #define SLOWFILTER "slow.filter" */
-#define FAULTMESSAGEFILE "faultMessage"
-#define FORMMESSAGEFILE "formMessage"
-
-#define LPNET "/usr/lib/lp/lpNet"
-
-#ifdef LP_USE_PAPI_ATTR
-#define STANDARD_FOOMATIC "standard_foomatic"
- /*
- * The default model interface script to use if a printer is configured
- * with a PPD (PostScript Printer Definition) file.
- */
-#define LP_PAPIATTRNAME "attributes"
- /*
- * Job attributes filename extension,
- * eg. /var/spool/lp/temp/123-attributes
- */
-#endif
-
-/**
- ** Names and phrases:
- **/
-
-/*
- * If you change these from macros to defined (char *) strings,
- * be aware that in several places the lengths of the strings
- * are computed using "sizeof()", not "strlen()"!
- */
-#define NAME_ALL "all"
-#define NAME_ANY "any"
-#define NAME_NONE "none"
-#define NAME_TERMINFO "terminfo"
-#define NAME_SIMPLE "simple"
-#define NAME_HOLD "hold"
-#define NAME_RESUME "resume"
-#define NAME_IMMEDIATE "immediate"
-#define NAME_CONTINUE "continue"
-#define NAME_BEGINNING "beginning"
-#define NAME_WAIT "wait"
-#define NAME_MAIL "mail"
-#define NAME_WRITE "write"
-#define NAME_QUIET "quiet"
-#define NAME_LIST "list"
-#define NAME_ON "on"
-#define NAME_OFF "off"
-#define NAME_OPTIONAL "optional"
-#define NAME_ALWAYS "Always"
-#define NAME_UNKNOWN "unknown"
-#define NAME_REJECTING "rejecting"
-#define NAME_ACCEPTING "accepting"
-#define NAME_DISABLED "disabled"
-#define NAME_ENABLED "enabled"
-#define NAME_DIRECT "direct"
-#define NAME_PICA "pica"
-#define NAME_ELITE "elite"
-#define NAME_COMPRESSED "compressed"
-#define NAME_ALLOW "allow"
-#define NAME_DENY "deny"
-#define NAME_ONCE "once"
-#define NAME_DEFAULT "default"
-#define NAME_KEEP "keep"
-
-/**
- ** Common messages:
- **/
-
-#define CUZ_NEW_PRINTER "new printer"
-#define CUZ_NEW_DEST "new destination"
-#define CUZ_STOPPED "stopped with printer fault"
-#define CUZ_FAULT "printer fault"
-#define CUZ_LOGIN_PRINTER "disabled by Spooler: login terminal"
-#define CUZ_MOUNTING "mounting a form"
-#define CUZ_NOFORK "can't fork"
-#define CUZ_PRINTING_OK "ready and printing"
-
-#define TIMEOUT_FAULT \
-"Timed-out trying to open the printer port.\n"
-
-#define OPEN_FAULT \
-"Failed to open the printer port.\n"
-
-#define PUSH_FAULT \
-"Failed to push module(s) onto the printer port stream.\n"
-
-/*
- * When the Spooler detected the hangup, this message is used.
- */
-#define HANGUP_FAULT \
-"The connection to the printer dropped; perhaps the printer went off-line!\n"
-
-/*
- * When lp.cat detected the hangup, this message is used.
- */
-#define HANGUP_FAULT_LPCAT \
-"The connection to the printer dropped; perhaps the printer went off-line.\n"
-
-#define INTERRUPT_FAULT \
-"Received an interrupt from the printer. The reason is unknown,\nalthough a common cause is that the printer's buffer capacity\nwas exceeded. Using XON/XOFF flow control, adding carriage-return\ndelays, or lowering the baud rate may fix the problem.\nSee stty(1) and lpadmin(1M) man-pages for help in doing this.\n"
-
-#define PIPE_FAULT \
-"The output ``port'', a FIFO, was closed before all output was written.\n"
-
-#define EXIT_FAULT \
-"The interface program returned with a reserved exit code.\n"
-
-/**
- ** Lp-errno #defines, etc.
- **/
-
-#define LP_EBADSDN 1
-#define LP_EBADINT 2
-#define LP_EBADNAME 3
-#define LP_EBADARG 4
-#define LP_ETRAILIN 5
-#define LP_ENOCMT 6
-#define LP_EBADCTYPE 7
-#define LP_ENOALP 8
-#define LP_ENULLPTR 9
-#define LP_EBADHDR 10
-#define LP_ETEMPLATE 11
-#define LP_EKEYWORD 12
-#define LP_EPATTERN 13
-#define LP_ERESULT 14
-#define LP_EREGEX 15 /* and see extern int regerrno, regexpr(3G) */
-#define LP_ENOMEM 99
-
-extern int lp_errno;
-
-/**
- ** Misc. Macros
- **/
-
-#define LP_WS " " /* Whitespace (also list separator) */
-#define LP_SEP "," /* List separator */
-#define LP_QUOTES "'\""
-
-#define MAIL "mail"
-#define WRITE "write"
-
-#define STATUS_BREAK "=========="
-
-#define STREQU(A,B) ( (!(A) || !(B)) ? 0: (strcmp((A), (B)) == 0) )
-#define STRNEQU(A,B,N) ( (!(A) || !(B)) ? 0: (strncmp((A), (B), (N)) == 0) )
-#define CS_STREQU(A,B) (cs_strcmp((A), (B)) == 0)
-#define CS_STRNEQU(A,B,N) (cs_strncmp((A), (B), (N)) == 0)
-#define STRSIZE(X) (sizeof(X) - 1)
-
-/*
- * Almost STREQU but compares null pointers as equal, too.
- */
-#define SAME(A,B) ((A) == (B) || (A) && (B) && STREQU((A), (B)))
-
-#define PRINTF (void)printf
-#define SPRINTF (void)sprintf
-#define FPRINTF (void)fprintf
-
-#define NB(X) (X? X : "")
-
-#define PERROR strerror(errno)
-
-/*
- * Largest number we'll ever expect to get from doing %ld in printf,
- * as a string and number. ULONG_MAX from limits.h gives us the number,
- * but I can't figure out how to get that into a string.
- */
-#define BIGGEST_NUMBER ULONG_MAX
-#define BIGGEST_NUMBER_S "4294967295"
-
-/*
- * Largest request ID (numerical part), as string and number.
- * See comment above.
- */
-#define BIGGEST_REQID 999999
-#define BIGGEST_REQID_S "999999"
-
-/*
- * Maximum number of files queued per request, as string and number.
- * See earlier comment above.
- */
-#define MOST_FILES 999999
-#define MOST_FILES_S "999999"
-
-/**
- ** Alert macros:
- **/
-
-/*
- * Type of alert to be S_QUIET'd
- */
-#define QA_FORM 1
-#define QA_PRINTER 2
-#define QA_PRINTWHEEL 3
-
-/**
- ** File modes:
- ** (The "NO" prefix is relative to ``others''.)
- **/
-
-#define MODE_READ (mode_t)0664
-#define MODE_NOREAD (mode_t)0660
-#define MODE_EXEC (mode_t)0775
-#define MODE_NOEXEC (mode_t)0770
-#define MODE_DIR (mode_t)0775
-#define MODE_NODIR (mode_t)0770
-
-extern int printlist_qsep;
-
-extern char Lp_Spooldir[],
- Lp_Admins[],
- Lp_Bin[],
- Lp_FIFO[],
- Lp_Logs[],
- Lp_ReqLog[],
- Lp_Model[],
- Lp_Requests[],
- Lp_Secure[],
- Lp_Schedlock[],
- Lp_Slow_Filter[],
- Lp_System[],
- Lp_Temp[],
- Lp_Tmp[],
- Lp_Users[],
- Lp_A[],
- Lp_A_Classes[],
- Lp_A_Forms[],
- Lp_A_Interfaces[],
- Lp_A_Logs[],
- Lp_A_Printers[],
- Lp_A_PrintWheels[],
- Lp_A_Filters[],
- Lp_A_Systems[],
- Lp_Default[],
- Lp_A_Faults[];
-
-/*
- * File access:
- */
-
-extern int open_locked(char *, char *, mode_t);
-extern char *fdgets(char *, int, int);
-extern int fdprintf(int, char *, ...);
-extern int fdputs(char *, int);
-extern int fdputc(char, int);
-
-extern int is_printer_uri(char *);
-
-FILE *open_lpfile ( char * , char * , mode_t );
-int close_lpfile ( FILE * );
-int chown_lppath ( char * path );
-int mkdir_lpdir ( char * path , int mode );
-int rmfile ( char * path );
-int dumpstring ( char * path , char * str );
-
-char * loadstring ( char * path );
-char * loadline ( char * path );
-char * sop_up_rest (int, char * endsop );
-
-/*
- * List manipulation routines:
- */
-
-#define emptylist(LP) (!(LP) || !(LP)[0])
-
-int addlist ( char *** , char * );
-int addstring ( char ** , char * );
-int appendlist ( char *** , char * );
-int dellist ( char *** , char * );
-int joinlist ( char *** , char ** );
-int lenlist ( char ** );
-int printlist ( FILE * , char ** );
-int fdprintlist(int , char ** );
-int searchlist ( char *, char ** );
-int searchlist_with_terminfo ( char * , char ** );
-
-char ** duplist ( char ** );
-char ** getlist ( char * , char * , char * );
-char ** dashos ( char * );
-char ** wherelist ( char * , char ** );
-
-char * sprintlist ( char ** );
-char * search_cslist ( char * , char ** );
-
-void freelist ( char ** );
-void printlist_setup ( char * , char * , char * , char * );
-void printlist_unsetup ( void );
-
-/*
- * Scaled decimal number routines:
- */
-
-#define getsdn(S) _getsdn(S, (char **)0, 0)
-#define getcpi(S) _getsdn(S, (char **)0, 1)
-
-#define N_COMPRESSED 9999
-
-void printsdn ( FILE * , SCALED );
-void fdprintsdn ( int , SCALED );
-void printsdn_setup ( char * , char * , char * );
-void printsdn_unsetup ( void );
-
-SCALED _getsdn ( char * , char ** , int );
-
-/*
- * File name routines:
- */
-
-char * makepath ( char * , ... );
-char * getspooldir ( void );
-char * getrequestfile ( char * );
-char * getprinterfile ( char * , char * );
-char * getsystemfile ( char * , char * );
-char * getclassfile ( char * );
-char * getfilterfile ( char * );
-char * getformfile ( char * , char * );
-
-/*
- * Additional string manipulation routines:
- */
-
-int cs_strcmp ( char * , char * );
-int cs_strncmp ( char * , char * , int );
-
-/*
- * Syntax checking routines:
- */
-
-int syn_name ( char * );
-int syn_text ( char * );
-int syn_comment ( char * );
-int syn_machine_name ( char * );
-int syn_option ( char * );
-
-/*
- * Alert management routines:
- */
-
-int putalert ( char * , char * , FALERT * );
-int delalert ( char * , char * );
-
-FALERT * getalert ( char * , char * );
-
-void printalert ( FILE * , FALERT * , int );
-
-/*
- * Terminfo Database Inquiry Tool
- */
-
-int tidbit ( char * , char * , ... );
-void untidbit ( char * );
-
-/*
- * Auto-restarting and other system calls:
- * The two versions are here to reduce the chance of colliding
- * with similar names in standard libraries (e.g. dial(3C) uses
- * Read/Write).
- */
-
-#define Access _Access
-#define Chdir _Chdir
-#define Chmod _Chmod
-#define Chown _Chown
-#define Close _Close
-#define Creat _Creat
-#define Fcntl _Fcntl
-#define Fstat _Fstat
-#define Link _Link
-#define Lstat _Lstat
-#define Mknod _Mknod
-#define Open _Open
-#define Read _Read
-#define Readlink _Readlink
-#define Rename _Rename
-#define Stat _Stat
-#define Symlink _Symlink
-#define Unlink _Unlink
-#define Wait _Wait
-#define Write _Write
-
-#define Malloc(size) _Malloc(size, __FILE__, __LINE__)
-#define Realloc(ptr,size) _Realloc(ptr, size, __FILE__, __LINE__)
-#define Calloc(nelem,elsize) _Calloc(nelem, elsize, __FILE__, __LINE__)
-#define Strdup(s) _Strdup(s, __FILE__, __LINE__)
-#define Free(ptr) _Free(ptr, __FILE__, __LINE__)
-
-int _Access ( char * , int );
-int _Chdir ( char * );
-int _Chmod ( char * , int );
-int _Chown ( char * , int , int );
-int _Close ( int );
-int _Creat ( char * , int );
-int _Fcntl ( int , int , ... );
-int _Fstat ( int , struct stat * );
-int _Link ( char * , char * );
-int _Lstat ( char * , struct stat * );
-int _Mknod ( char * , int , int );
-int _Mkpipe ( char * , int , int );
-int _Open ( char * , int , ... /* mode_t */ );
-int _Read ( int , char * , unsigned int );
-int _Readlink ( char * , char * , unsigned int );
-int _Rename ( char * , char * );
-int _Symlink ( char * , char * );
-int _Stat ( char * , struct stat * );
-int _Unlink ( char * );
-int _Wait ( int * );
-int _Write ( int , char * , unsigned int );
-
-void * _Malloc ( size_t , const char * , int );
-void * _Realloc ( void * , size_t , const char * , int );
-void * _Calloc ( size_t , size_t , const char * , int );
-char * _Strdup ( const char * , const char * , int );
-void _Free ( void * , const char * , int );
-
-/*
- * Misc. routines:
- */
-
-int isterminfo ( char * );
-int isprinter ( char * );
-int isrequest ( char * );
-int isnumber ( char * );
-
-char * getname ( void );
-char * makestr ( char * , ... );
-char * strip ( char * );
-
-void sendmail ( char * , char * );
-
-void (*lp_alloc_fail_handler)( void );
-
-/*
- * Originally part of liblpfs.a and fs.h, now no longer needed
- * since the code doesn't have to work on pre-SVR4.0.
- */
-#define Opendir opendir
-#define Telldir telldir
-#define Seekdir seekdir
-#define Rewinddir(dirp) Seekdir(dirp, 0L)
-#define Closedir closedir
-#define Readdir readdir
-#define Mkdir mkdir
-#define Rmdir rmdir
-
-#define next_dir(base, ptr) next_x(base, ptr, S_IFDIR)
-#define next_file(base, ptr) next_x(base, ptr, S_IFREG)
-
-extern int chownmod(char *path, uid_t owner, gid_t group, mode_t mode);
-
-
-char * next_x ( char * , long * , unsigned int );
-
-/*
- * Stuff needed for Trusted Extensions
- */
-
-extern char *get_labeled_zonename(char *);
-extern int get_peer_label(int fd, char **slabel);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LP_LP_H */
diff --git a/usr/src/cmd/lp/include/lp.set.h b/usr/src/cmd/lp/include/lp.set.h
deleted file mode 100644
index e2a32abad4..0000000000
--- a/usr/src/cmd/lp/include/lp.set.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-
-#if !defined(_LP_LP_SET_H)
-#define _LP_LP_SET_H
-
-/*
- * How far should we check for "compressed" horizontal pitch?
- * Keep in mind that (1) too far and the user can't read it, and
- * (2) some Terminfo entries don't limit their parameters like
- * they should. Keep in mind the other hand, though: What is too
- * compact for you may be fine for the eagle eyes next to you!
- */
-#define MAX_COMPRESSED 30 /* CPI */
-
-#define E_SUCCESS 0
-#define E_FAILURE 1
-#define E_BAD_ARGS 2
-#define E_MALLOC 3
-
-#define OKAY(P) ((P) && (*P))
-#define R(F) (int)((F) + .5)
-
-#if !defined(CHARSETDIR)
-# define CHARSETDIR "/usr/share/lib/charset"
-#endif
-
-#if defined(__STDC__)
-
-int set_pitch ( char * , int , int );
-int set_size ( char * , int , int );
-int set_charset ( char * , int , char * );
-
-#else
-
-int set_pitch(),
- set_size(),
- set_charset();
-
-#endif
-
-#endif
diff --git a/usr/src/cmd/lp/include/msgs.h b/usr/src/cmd/lp/include/msgs.h
deleted file mode 100644
index 90d1f3f186..0000000000
--- a/usr/src/cmd/lp/include/msgs.h
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-# include <sys/types.h>
-# include <poll.h>
-# include <stdarg.h>
-# include <stropts.h>
-
-#if !defined(_LP_MSGS_H)
-# define _LP_MSGS_H
-
-/*
- * THE DISPATCH TABLE DEPENDS ON EACH R_... MESSAGE FOLLOWING
- * IMMEDIATELY AFTER ITS CORRESPONDING S_... COUNTERPART.
- * I.E R_... MESSAGE FOR A S_... MESSAGE IS (S_... + 1)
- */
-# define R_BAD_MESSAGE 0
-/* # define S_NEW_QUEUE 1 DEFUNCT */
-/* # define R_NEW_QUEUE 2 DEFUNCT */
-# define S_ALLOC_FILES 3
-# define R_ALLOC_FILES 4
-# define S_PRINT_REQUEST 5
-# define R_PRINT_REQUEST 6
-# define S_START_CHANGE_REQUEST 7
-# define R_START_CHANGE_REQUEST 8
-# define S_END_CHANGE_REQUEST 9
-# define R_END_CHANGE_REQUEST 10
-# define S_CANCEL_REQUEST 11
-# define R_CANCEL_REQUEST 12
-/* # define S_INQUIRE_REQUEST 13 DEFUNCT */
-/* # define R_INQUIRE_REQUEST 14 DEFUNCT */
-# define S_LOAD_PRINTER 15
-# define R_LOAD_PRINTER 16
-# define S_UNLOAD_PRINTER 17
-# define R_UNLOAD_PRINTER 18
-# define S_INQUIRE_PRINTER_STATUS 19
-# define R_INQUIRE_PRINTER_STATUS 20
-# define S_LOAD_CLASS 21
-# define R_LOAD_CLASS 22
-# define S_UNLOAD_CLASS 23
-# define R_UNLOAD_CLASS 24
-# define S_INQUIRE_CLASS 25
-# define R_INQUIRE_CLASS 26
-# define S_MOUNT 27
-# define R_MOUNT 28
-# define S_UNMOUNT 29
-# define R_UNMOUNT 30
-# define S_MOVE_REQUEST 31
-# define R_MOVE_REQUEST 32
-# define S_MOVE_DEST 33
-# define R_MOVE_DEST 34
-# define S_ACCEPT_DEST 35
-# define R_ACCEPT_DEST 36
-# define S_REJECT_DEST 37
-# define R_REJECT_DEST 38
-# define S_ENABLE_DEST 39
-# define R_ENABLE_DEST 40
-# define S_DISABLE_DEST 41
-# define R_DISABLE_DEST 42
-# define S_LOAD_FILTER_TABLE 43
-# define R_LOAD_FILTER_TABLE 44
-# define S_UNLOAD_FILTER_TABLE 45
-# define R_UNLOAD_FILTER_TABLE 46
-# define S_LOAD_PRINTWHEEL 47
-# define R_LOAD_PRINTWHEEL 48
-# define S_UNLOAD_PRINTWHEEL 49
-# define R_UNLOAD_PRINTWHEEL 50
-# define S_LOAD_USER_FILE 51
-# define R_LOAD_USER_FILE 52
-# define S_UNLOAD_USER_FILE 53
-# define R_UNLOAD_USER_FILE 54
-# define S_LOAD_FORM 55
-# define R_LOAD_FORM 56
-# define S_UNLOAD_FORM 57
-# define R_UNLOAD_FORM 58
-/* # define S_GETSTATUS 59 DEFUNCT */
-/* # define R_GETSTATUS 60 DEFUNCT */
-# define S_QUIET_ALERT 61
-# define R_QUIET_ALERT 62
-# define S_SEND_FAULT 63
-# define R_SEND_FAULT 64
-# define S_SHUTDOWN 65
-# define R_SHUTDOWN 66
-# define S_GOODBYE 67
-# define S_CHILD_DONE 68
-
-/*
-** These are for use by the scheduler only
-*/
-# define I_GET_TYPE 69
-# define I_QUEUE_CHK 70
-/* # define R_CONNECT 71 DEFUNCT */
-
-/* # define S_GET_STATUS 72 DEFUNCT */
-/* # define R_GET_STATUS 73 DEFUNCT */
-# define S_INQUIRE_REQUEST_RANK 74
-# define R_INQUIRE_REQUEST_RANK 75
-# define S_CANCEL 76
-# define R_CANCEL 77
-/* # define S_NEW_CHILD 78 DEFUNCT */
-/* # define R_NEW_CHILD 79 DEFUNCT */
-/* # define S_SEND_JOB 80 DEFUNCT */
-/* # define R_SEND_JOB 81 DEFUNCT */
-/* # define S_JOB_COMPLETED 82 DEFUNCT */
-/* # define R_JOB_COMPLETED 83 DEFUNCT */
-/* # define S_INQUIRE_REMOTE_PRINTER 84 DEFUNCT */
-/* # define R_INQUIRE_REMOTE_PRINTER 20 DEFUNCT */
-/* # define S_CHILD_SYNC 85 DEFUNCT */
-/* # define S_LOAD_SYSTEM 86 DEFUNCT */
-/* # define R_LOAD_SYSTEM 87 DEFUNCT */
-/* # define S_UNLOAD_SYSTEM 88 DEFUNCT */
-/* # define R_UNLOAD_SYSTEM 89 DEFUNCT */
-/* new messages */
-# define S_CLEAR_FAULT 90
-# define R_CLEAR_FAULT 91
-# define S_MOUNT_TRAY 92
-# define R_MOUNT_TRAY 93
-# define S_UNMOUNT_TRAY 94
-# define R_UNMOUNT_TRAY 95
-# define S_MAX_TRAYS 96
-# define R_MAX_TRAYS 97
-# define S_PAPER_CHANGED 98
-# define R_PAPER_CHANGED 99
-# define S_PAPER_ALLOWED 100
-# define R_PAPER_ALLOWED 101
-# define S_PASS_PEER_CONNECTION 102
-# define R_PASS_PEER_CONNECTION 103
-/*
-** Last available message
-*/
-# define LAST_MESSAGE 104
-
-/*
-** These are the possible status codes returned by the scheduler
-*/
-# define MOK 0
-# define MOKMORE 1
-# define MOKREMOTE 2
-# define MMORERR 3
-# define MNODEST 4
-# define MERRDEST 5
-# define MDENYDEST 6
-# define MNOMEDIA 7
-# define MDENYMEDIA 8
-# define MNOFILTER 9
-# define MNOINFO 10
-# define MNOMEM 11
-# define MNOMOUNT 12
-# define MNOOPEN 13
-# define MNOPERM 14
-# define MNOSTART 15
-# define MUNKNOWN 16
-# define M2LATE 17
-# define MNOSPACE 18
-# define MBUSY 19
-# define MTRANSMITERR 20
-# define MNOMORE 21
-# define MGONEREMOTE 22
-# define MNOTRAY 23
-
-/*
-** Offsets and lengths of the various elements of the message header.
-**
-** Macro Data Type Size Comment
-**
-** HEAD_RESYNC 2 bytes (2) *
-** HEAD_AUTHCODE short + long (6) *
-**
-** HEAD_SIZE 4 bytes (4) \
-** HEAD_TYPE 4 bytes (4) > message propper
-** HEAD_DATA n bytes (n) /
-**
-** TAIL_CHKSUM 4 bytes (4) *
-** TAIL_ENDSYNC 2 bytes (2) *
-**
-** Items marked with an asterisk are only used with the 3.2
-** Spooler protocol.
-*/
-
-/*
-** 3.2 Protocol Header Information:
-** 2-byte message introduction
-** 6-byte client authorization data
-*/
-#define HEAD_RESYNC (0)
-#define HEAD_RESYNC_LEN 2
-#define HEAD_AUTHCODE (HEAD_RESYNC + HEAD_RESYNC_LEN)
-#define HEAD_AUTHCODE_LEN (sizeof(short) + sizeof(long))
-
-/*
-** 3.2 Protocol Message Information:
-** 4-byte message size
-** 4-byte message type
-** n-byte message data
-*/
-#define HEAD_SIZE (HEAD_AUTHCODE + HEAD_AUTHCODE_LEN)
-#define HEAD_SIZE_LEN 4
-#define HEAD_TYPE (HEAD_SIZE + HEAD_SIZE_LEN)
-#define HEAD_TYPE_LEN 4
-#define HEAD_DATA (HEAD_TYPE + HEAD_TYPE_LEN)
-
-/*
-** 3.2 Protocol Size of non-data header information
-*/
-#define HEAD_LEN HEAD_DATA
-
-/*
-** Equivalents for 4.0 protocol
-*/
-#define MESG_SIZE (0)
-#define MESG_SIZE_LEN 4
-#define MESG_TYPE (MESG_SIZE + MESG_SIZE_LEN)
-#define MESG_TYPE_LEN 4
-#define MESG_DATA (MESG_TYPE + MESG_TYPE_LEN)
-
-#define MESG_LEN MESG_DATA
-
-/*
-** 3.2 Protocol Trailer Information:
-** 4-byte message check sum
-** 2-byte message closing identifier
-**
-** "N" is the decoded value of buffer[HEAD_SIZE]. This must
-** be provided because messages are variable length.
-*/
-#define TAIL_ENDSYNC_LEN 2
-#define TAIL_ENDSYNC(N) (N - TAIL_ENDSYNC_LEN)
-#define TAIL_CHKSUM_LEN 4
-#define TAIL_CHKSUM(N) (TAIL_ENDSYNC(N) - TAIL_CHKSUM_LEN)
-
-/*
-** 3.2 Protocol Size of non-data trailer information
-*/
-#define TAIL_LEN (TAIL_CHKSUM_LEN + TAIL_ENDSYNC_LEN)
-
-/*
-** 3.2 Protocol Size of all non-data information
-** (This is also the minimum size for 3.2 protocol messages)
-*/
-#define CONTROL_LEN (HEAD_LEN + TAIL_LEN)
-
-/*
-** Size of excess data induced by 3.2 Protocol.
-** (This is also the size differance between 3.2 & 4.0 protocols)
-*/
-#define EXCESS_3_2_LEN (HEAD_SIZE + TAIL_LEN)
-/**
- ** Checksum:
- **/
-#define CALC_CHKSUM(B,SZ,RC) \
-if (SZ >= CONTROL_LEN) \
-{ \
- register unsigned char *p = (unsigned char *)B, \
- *pend = p + SZ - TAIL_LEN; \
- RC = 0; \
- while (p < pend) \
- RC += *p++; /* let it overflow */ \
-} \
-else \
- return ((errno = EINVAL, -1))
-
-/*
-** Largest size permitted for any given message
-*/
-# define MSGMAX 2048
-
-/*
-** Possible values of the type field of S_QUIET_ALERT
-*/
-# define QA_FORM 1
-# define QA_PRINTER 2
-# define QA_PRINTWHEEL 3
-
-typedef struct strbuf strbuf_t; /* STREAMS buffer */
-
-typedef struct mque
-{
- struct mque *next;
- struct strbuf *dat;
-} MQUE;
-
-/*
-** Definition of a message descriptor
-*/
-typedef struct
-{
- short type; /* type of connection */
- int readfd; /* STREAM fd to read from */
- int writefd; /* STREAM fd to write to */
- int wait; /* number of systems waiting for */
- char *file; /* pipe name if type==MD_FIFO */
- short state; /* Current state of client */
- short admin; /* Non zero if admin */
- short event; /* Event returned from poll */
- MQUE * mque; /* backlogged message ptr */
- uid_t uid; /* Clients UID */
- gid_t gid; /* Clients GID */
- char * slabel; /* Clients SLABEL */
- void (**on_discon)(); /* Clean up functions */
-} MESG;
-
-# define MDSIZE (sizeof(MESG))
-
-/*
-** Possible values of MESG.state
-*/
-# define MDS_IDLE 0
-
-# define MDS_32PROTO 320
-# define MDS_32CONNECT 321
-
-/*
-** Possible values of MESG.type
-*/
-# define MD_UNKNOWN 0 /* We don't know just yet */
-# define MD_STREAM 1 /* 4.0 STREAMS pipe protocol */
-# define MD_BOUND 2 /* 4.0 STREAMS fd protocol */
-# define MD_SYS_FIFO 3 /* 3.2 named-pipe protocol */
-# define MD_USR_FIFO 4 /* 3.2 named-pipe protocol */
-# define MD_MASTER 5 /* MD_STREAM used by lpsched */
-# define MD_CHILD 6 /* MD_STREAM to a child process */
-
-/*
-** Definition for a FIFO buffer (used
-** in read_fifo.
-*/
-typedef struct
-{
- int full;
- char save [MSGMAX],
- *psave,
- *psave_end;
-} fifobuffer_t;
-
-/*
-** Definitions for the rest of the world and lint
-*/
-/*
-** Server functions in order of usage
-*/
-MESG * mcreate ( char * );
-int mlisteninit ( MESG * );
-MESG * mlisten ( void );
-int mlistenadd ( MESG *, short );
-int mon_discon ( MESG *, void (*)());
-MESG * mlistenreset ( void );
-int mdestroy ( MESG * );
-
-/*
-** Client functions in order of typical usage
-*/
-MESG * mconnect ( char *, int, int );
-int mgetm ( MESG *, int, ... );
-int mwrite ( MESG *, char * );
-int mputm ( MESG *, int, ... );
-int mread ( MESG *, char *, int );
-short msize ( char * );
-short mpeek ( MESG * );
-int mdisconnect ( MESG * );
-
-/*
-** This may be called to deallocate internal buffers allocated
-** by mgetm and mputm. Probably not useful except right before
-** a fork().
-*/
-void __mbfree ( void );
-
-/*
-** Client functions for pre-4.0 compatability
-*/
-int mclose ( void );
-int mneeds ( void );
-int mopen ( void );
-int mrecv ( char *, int );
-int msend ( char * );
-
-int Putmsg (MESG *, strbuf_t *, strbuf_t *, int);
-int Getmsg (MESG *, strbuf_t *, strbuf_t *, int *);
-int read3_2 (MESG * md, char *msgbuf, int size);
-int write3_2 (MESG *, char *, int);
-int read_fifo (int, char *, unsigned int);
-int write_fifo (int, char *, unsigned int);
-int ResetFifoBuffer (int);
-fifobuffer_t *GetFifoBuffer (int);
-
-/*
-** General purpose message manipulating functions
-*/
-char * htos ( char *, unsigned short );
-char * ltos ( char *, unsigned long );
-unsigned long stol ( char * );
-unsigned short stoh ( char * );
-int _getmessage ( char *, short, va_list );
-int _putmessage ( char *, short, va_list );
-int getmessage ( char *, short, ... );
-int putmessage ( char *, short, ... );
-
-/*
-** This will yield the type of a message
-*/
-# define mtype(buffer) (getmessage(buffer, I_GET_TYPE))
-
-/*
-** This will yeild the size of a message
-*/
-# define msize(buffer) (stoh(buffer))
-
-/*
-** Pass this for the request-id argument of S_CANCEL
-** to obtain the effect of the 3.2 S_CANCEL_REQUEST.
-*/
-# define CURRENT_REQ "current"
-
-#endif /* !defined (_LP_MSGS_H) */
diff --git a/usr/src/cmd/lp/include/oam.h b/usr/src/cmd/lp/include/oam.h
deleted file mode 100644
index 52176315b6..0000000000
--- a/usr/src/cmd/lp/include/oam.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1999 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-
-
-#if !defined(_LP_OAM_H)
-# define _LP_OAM_H
-/*
- * Change the following lines to include the appropriate
- * standard header file when it becomes available.
- * Or change all the LP source to include it directly,
- * and get rid of the following stuff (up to the ====...==== line).
- */
-
-char *agettxt(long msg_id, char *buf, int buflen);
-
-void fmtmsg(char * label, int severity, char * text, char * action);
-
-/*
- * Possible values of "severity":
- */
-#define MIN_SEVERITY 0
-#define HALT 0
-#define ERROR 1
-#define WARNING 2
-#define INFO 3
-#define MAX_SEVERITY 3
-
-/**======================================================================
- **
- ** LP Spooler specific error message handling.
- **/
-
-#define MSGSIZ 512
-
-#if defined(WHO_AM_I)
-
-#include "oam_def.h"
-
-#if WHO_AM_I == I_AM_CANCEL
-static char *who_am_i = "UX:cancel";
-
-#elif WHO_AM_I == I_AM_COMB
-static char *who_am_i = "UX:comb ";
- /* changed inside pgm */
-
-#elif WHO_AM_I == I_AM_LPMOVE
-static char *who_am_i = "UX:lpmove";
-
-#elif WHO_AM_I == I_AM_LPUSERS
-static char *who_am_i = "UX:lpusers";
-
-#elif WHO_AM_I == I_AM_LPNETWORK
-static char *who_am_i = "UX:lpnetwork";
-
-#elif WHO_AM_I == I_AM_LP
-static char *who_am_i = "UX:lp";
-
-#elif WHO_AM_I == I_AM_LPADMIN
-static char *who_am_i = "UX:lpadmin";
-
-#elif WHO_AM_I == I_AM_LPFILTER
-static char *who_am_i = "UX:lpfilter";
-
-#elif WHO_AM_I == I_AM_LPFORMS
-static char *who_am_i = "UX:lpforms";
-
-#elif WHO_AM_I == I_AM_LPPRIVATE
-static char *who_am_i = "UX:lpprivate";
-
-#elif WHO_AM_I == I_AM_LPSCHED
-static char *who_am_i = "UX:lpsched";
-
-#elif WHO_AM_I == I_AM_LPSHUT
-static char *who_am_i = "UX:lpshut";
-
-#elif WHO_AM_I == I_AM_LPSTAT
-static char *who_am_i = "UX:lpstat";
-
-#elif WHO_AM_I == I_AM_LPSYSTEM
-static char *who_am_i = "UX:lpsystem";
-
-#else
-static char *who_am_i = "UX:mysterious";
-
-#endif
-
-/*
- * Simpler interfaces to the "fmtmsg()" and "agettxt()" stuff.
- */
-
-#if defined(lint)
-
-#define LP_ERRMSG(C,X) (void)printf("", C, X)
-#define LP_ERRMSG1(C,X,A) (void)printf("", C, X, A)
-#define LP_ERRMSG2(C,X,A1,A2) (void)printf("", C, X, A1, A2)
-#define LP_ERRMSG3(C,X,A1,A2,A3) (void)printf("", C, X, A1, A2, A3)
-
-#else
-
-#define LP_ERRMSG(C,X) \
- fmtmsg ( \
- who_am_i, \
- C, \
- agettxt((X), _m_, MSGSIZ), \
- agettxt((X+1), _a_, MSGSIZ) \
- )
-#define LP_ERRMSG1(C,X,A) \
- fmtmsg ( \
- who_am_i, \
- C, \
- fmt1((X), A), \
- agettxt((X+1), _a_, MSGSIZ) \
- )
-#define LP_ERRMSG2(C,X,A1,A2) \
- fmtmsg ( \
- who_am_i, \
- C, \
- fmt2((X), A1, A2), \
- agettxt((X+1), _a_, MSGSIZ) \
- )
-#define LP_ERRMSG3(C,X,A1,A2,A3) \
- fmtmsg ( \
- who_am_i, \
- C, \
- fmt3((X), A1, A2, A3), \
- agettxt((X+1), _a_, MSGSIZ) \
- )
-
-
-#define vsnp (void)snprintf
-
-#define fmt1(X,A) (vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A), _m_)
-#define fmt2(X,A,B) (vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A,B), _m_)
-#define fmt3(X,A,B,C) (vsnp(_m_, MSGSIZ, agettxt((X),_f_,MSGSIZ), A,B,C), _m_)
-
-#endif /* lint */
-
-extern char _m_[],
- _a_[],
- _f_[],
- *_t_;
-
-#endif /* WHO_AM_I */
-
-#endif
diff --git a/usr/src/cmd/lp/include/printers.h b/usr/src/cmd/lp/include/printers.h
deleted file mode 100644
index baf8698645..0000000000
--- a/usr/src/cmd/lp/include/printers.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#if !defined(_LP_PRINTERS_H)
-#define _LP_PRINTERS_H
-
-/*
- * Define the following to support administrator configurable
- * streams modules:
- */
-#define CAN_DO_MODULES 1 /* */
-
-/**
- ** The disk copy of the printer files:
- **/
-
-/*
- * There are 19 fields in the printer configuration file.
- */
-#define PR_MAX 19
-# define PR_BAN 0
-# define PR_CPI 1
-# define PR_CS 2
-# define PR_ITYPES 3
-# define PR_DEV 4
-# define PR_DIAL 5
-# define PR_RECOV 6
-# define PR_INTFC 7
-# define PR_LPI 8
-# define PR_LEN 9
-# define PR_LOGIN 10
-# define PR_PTYPE 11
-# define PR_REMOTE 12
-# define PR_SPEED 13
-# define PR_STTY 14
-# define PR_WIDTH 15
-# define PR_MODULES 16
-#define PR_OPTIONS 17
-#define PR_PPD 18
-
-/**
- ** The internal flags seen by the Spooler/Scheduler and anyone who asks.
- **/
-
-#define PS_REJECTED 0x001
-#define PS_DISABLED 0x002
-#define PS_FAULTED 0x004
-#define PS_BUSY 0x008
-#define PS_LATER 0x010 /* Printer is scheduled for service */
-#define PS_SHOW_FAULT 0x100 /* set if exMess should be run when fault */
-#define PS_USE_AS_KEY 0x200 /* to insure that status used as key is non 0 */
-#define PS_FORM_FAULT 0x400 /* set a form fault rather a printer fault*/
-
-/**
- ** The internal copy of a printer as seen by the rest of the world:
- **/
-
-/*
- * A (char **) list is an array of string pointers (char *) with
- * a null pointer after the last item.
- */
-typedef struct PRINTER {
- char *name; /* name of printer (redundant) */
- unsigned short banner; /* banner page conditions */
- SCALED cpi; /* default character pitch */
- char **char_sets; /* list of okay char-sets/print-wheels */
- char **input_types; /* list of types acceptable to printer */
- char *device; /* printer port full path name */
- char *dial_info; /* system name or phone # for dial-up */
- char *fault_rec; /* printer fault recovery procedure */
- char *interface; /* interface program full path name */
- SCALED lpi; /* default line pitch */
- SCALED plen; /* default page length */
- unsigned short login; /* is/isn't a login terminal */
- char *printer_type; /* Terminfo look-up value (obsolete) */
- char *remote; /* remote machine!printer-name */
- char *speed; /* baud rate for connection */
- char *stty; /* space separated list of stty options */
- SCALED pwid; /* default page width */
- char *description; /* comment about printer */
- FALERT fault_alert; /* how to alert on printer fault */
- short daisy; /* 1/0 - printwheels/character-sets */
-#if defined(CAN_DO_MODULES)
- char **modules; /* streams modules to push */
-#endif
- char **printer_types; /* Terminfo look-up values */
- char **options; /* space separated list of undefined -o options */
-
-#ifdef LP_USE_PAPI_ATTR
- char *ppd; /* printer's PPD file full path name */
-#endif
- /*
- * Adding new members to this structure? Check out
- * cmd/lpadmin/do_printer.c, where we initialize
- * each new printer structure.
- */
-} PRINTER;
-
-#define BAN_ALWAYS 0x01 /* user can't override banner */
-#define BAN_OFF 0x02 /* don't print banner page */
-#define BAN_NEVER BAN_OFF
-#define BAN_OPTIONAL (BAN_ALWAYS | BAN_NEVER) /* user can override banner */
-
-#define LOG_IN 0x01 /* printer is login terminal */
-
-#define PCK_TYPE 0x0001 /* printer type isn't in Terminfo */
-#define PCK_CHARSET 0x0002 /* printer type can't handle ".char_sets" */
-#define PCK_CPI 0x0004 /* printer type can't handle ".cpi" */
-#define PCK_LPI 0x0008 /* printer type can't handle ".lpi" */
-#define PCK_WIDTH 0x0010 /* printer type can't handle ".pwid" */
-#define PCK_LENGTH 0x0020 /* printer type can't handle ".plen" */
-#define PCK_PAPER 0x0040 /* printer type can't handle paper */
-
-/*
- * The following PCK_... bits are only set by the Spooler,
- * when refusing a request.
- */
-#define PCK_BANNER 0x1000 /* printer needs banner */
-
-/*
- * Flags set by "putprinter()" for things that go wrong.
- */
-#define BAD_REMOTE 0x0001 /* has attributes of remote and local */
-#define BAD_INTERFACE 0x0002 /* no interface or can't read it */
-#define BAD_DEVDIAL 0x0004 /* no device or dial information */
-#define BAD_FAULT 0x0008 /* not recognized fault recovery */
-#define BAD_ALERT 0x0010 /* has reserved word for alert command */
-#define BAD_ITYPES 0x0020 /* multiple printer AND input types */
-#define BAD_PTYPES 0x0040 /* multiple printer types, incl unknown */
-#define BAD_DAISY 0x0080 /* printer types don't agree on "daisy" */
-
-/*
- * A comma separated list of STREAMS modules to be pushed on an
- * opened port.
- */
-#define DEFMODULES "ldterm"
-
-/*
- * For print wheels:
- */
-
-typedef struct PWHEEL {
- char *name; /* name of print wheel */
- FALERT alert; /* how to alert when mount needed */
-} PWHEEL;
-
-extern unsigned long badprinter,
- ignprinter;
-
-/*
- * Set if ppd file information is from the user rather than
- * the configuration file.
- */
-extern int ppdopt;
-
-/**
- ** Various routines.
- **/
-
-PRINTER * getprinter ( char * );
-
-PWHEEL * getpwheel ( char * );
-
-char * getdefault ( void );
-
-int putprinter ( char *, PRINTER *);
-int delprinter ( char * );
-int putdefault ( char * );
-int deldefault ( void );
-int putpwheel ( char * , PWHEEL * );
-int delpwheel ( char * );
-int okprinter ( char * , PRINTER * , int );
-
-unsigned long chkprinter (char *, char *, char *, char *, char *, char *);
-
-void freeprinter ( PRINTER * );
-void freepwheel ( PWHEEL * );
-
-char * getpentry(char *, int);
-
-/**
- ** Aliases (copies) of some important Terminfo caps.
- **/
-
-extern int ti_daisy;
-
-#endif
diff --git a/usr/src/cmd/lp/include/requests.h b/usr/src/cmd/lp/include/requests.h
deleted file mode 100644
index feaae89232..0000000000
--- a/usr/src/cmd/lp/include/requests.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#if !defined(_LP_REQUESTS_H)
-#define _LP_REQUESTS_H
-
-/**
- ** The disk copy of the request files:
- **/
-
-/*
- * There are 18 fields in the request file.
- */
-#define RQ_MAX 18
-# define RQ_COPIES 0
-# define RQ_DEST 1
-# define RQ_FILE 2
-# define RQ_FORM 3
-# define RQ_HANDL 4
-# define RQ_NOTIFY 5
-# define RQ_OPTS 6
-# define RQ_PRIOR 7
-# define RQ_PAGES 8
-# define RQ_CHARS 9
-# define RQ_TITLE 10
-# define RQ_MODES 11
-# define RQ_TYPE 12
-# define RQ_USER 13
-# define RQ_RAW 14
-# define RQ_FAST 15
-# define RQ_STAT 16
-
-/**
- ** The internal copy of a request as seen by the rest of the world:
- **/
-
-/*
- * A (char **) list is an array of string pointers (char *) with
- * a null pointer after the last item.
- */
-typedef struct REQUEST {
- short copies; /* number of copies of request to print */
- char *destination; /* printer or class name */
- char **file_list; /* list of files to print: req. content */
- char *form; /* preprinted form to print on */
- ushort actions; /* mail/write, immediate/hold/resume, raw */
- char *alert; /* program to run to alert user when done */
- char *options; /* print options; space separated list */
- short priority; /* priority level, 0-39, of the request */
- char *pages; /* list of pages to print (uniq. please!) */
- char *charset; /* character set to select or mount */
- char *modes; /* mode(s) of operation; space sep. list */
- char *title; /* optional title for banner page */
- char *input_type; /* type of content */
- char *user; /* user name of person submitting */
- ushort outcome; /* success/fauilure */
-} REQUEST;
-
-
-/*
- * Bit flags for the "actions" member:
- */
-#define ACT_MAIL 0x0001 /* send mail when finished printing */
-#define ACT_WRITE 0x0002 /* write to the terminal when finished */
-#define ACT_NOTIFY 0x0004 /* tell the remote that this is done */
-#define ACT_IMMEDIATE 0x0010 /* print immediately */
-#define ACT_HOLD 0x0020 /* don't print until resumed */
-#define ACT_RESUME 0x0030 /* resume a held request */
-#define ACT_SPECIAL 0x0030 /* bit mask of immediate/hold/resume */
-#define ACT_RAW 0x0100 /* don't filter the input */
-
-/*
- * Currently, the following is used only for alignment patterns:
- */
-#define ACT_FAST 0x8000 /* force all filters to be fast */
-
-
-/*
- * Bit flags for the "outcome" member:
- */
-#define RS_HELD 0x0001 /* held pending resume */
-#define RS_FILTERING 0x0002 /* slow filter is running */
-#define RS_FILTERED 0x0004 /* slow filter has finished running */
-#define RS_PRINTING 0x0008 /* on printer */
-#define RS_PRINTED 0x0010 /* has finished printing */
-#define RS_CHANGING 0x0020 /* request held pending user change */
-#define RS_CANCELLED 0x0040 /* request was cancelled */
-#define RS_IMMEDIATE 0x0080 /* should be next to print */
-#define RS_FAILED 0x0100 /* slow filter or interface failed */
-#define RS_NOTIFY 0x0400 /* user is to be notified (alert) */
-#define RS_NOTIFYING 0x0800 /* notification (alert) is running */
-#define RS_ADMINHELD 0x2000 /* administrator placed RS_HELD */
-#define RS_REFILTER 0x4000 /* had to change filters */
-#define RS_STOPPED 0x8000 /* temporarily stopped the request */
-
-/*
- * Some bit combinations, for convenience and consistency:
- *
- * RS_DONE request is finished printing or was cancelled
- * RS_ACTIVE request is being handled, can be skipped
- */
-#define RS_DONE (RS_CANCELLED|RS_PRINTED|RS_FAILED)
-#define RS_ACTIVE (RS_FILTERING|RS_PRINTING|RS_CHANGING|RS_NOTIFYING)
-
-/**
- ** Various routines.
- **/
-
-REQUEST * getrequest ( char * );
-int putrequest ( char *, REQUEST * );
-void freerequest ( REQUEST * );
-
-#endif
diff --git a/usr/src/cmd/lp/include/secure.h b/usr/src/cmd/lp/include/secure.h
deleted file mode 100644
index c1ff7f8657..0000000000
--- a/usr/src/cmd/lp/include/secure.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#if !defined(_LP_SECURE_H)
-#define _LP_SECURE_H
-
-#include "sys/types.h"
-
-/**
- ** The disk copy of the secure request files:
- **/
-
-/*
- * There are 8 fields in the secure request file.
- */
-#define SC_MAX 7
-# define SC_REQID 0 /* Original request id */
-# define SC_UID 1 /* Originator's user ID */
-# define SC_USER 2 /* Originator's real login name */
-# define SC_GID 3 /* Originator's group ID */
-# define SC_SIZE 4 /* Total size of the request data */
-# define SC_DATE 5 /* Date submitted (in seconds) */
-# define SC_SLABEL 6 /* Sensitivity Label */
-
-/**
- ** The internal copy of a request as seen by the rest of the world:
- **/
-
-typedef struct SECURE {
- uid_t uid;
- gid_t gid;
- off_t size;
- time_t date;
- char *user;
- char *req_id;
- char *slabel;
-} SECURE;
-
-/**
- ** Various routines.
- **/
-
-SECURE * getsecure ( char * );
-int putsecure ( char *, SECURE * );
-int rmsecure (char *);
-void freesecure ( SECURE * );
-
-#endif
diff --git a/usr/src/cmd/lp/include/users.h b/usr/src/cmd/lp/include/users.h
deleted file mode 100644
index cafd153d24..0000000000
--- a/usr/src/cmd/lp/include/users.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#if !defined(_LP_USERS_H)
-#define _LP_USERS_H
-
-#include "stdio.h"
-
-typedef struct
-{
- short priority_limit;
-}
-USER;
-
-int putuser ( char * , USER * );
-int deluser ( char * );
-int getdfltpri ( void );
-void trashusers ( void );
-
-USER * getuser ( char *);
-
-#define LEVEL_DFLT 20
-#define LIMIT_DFLT 0
-
-#define TRUE 1
-#define FALSE 0
-
-#define PRI_MAX 39
-#define PRI_MIN 0
-
-#define LPU_MODE 0644
-
-struct user_priority
-{
- short deflt; /* priority to use when not specified */
- short deflt_limit; /* priority limit for users not
- otherwise specified */
- char **users[PRI_MAX - PRI_MIN + 1];
-};
-
-#endif
diff --git a/usr/src/cmd/lp/lib/access/Makefile b/usr/src/cmd/lp/lib/access/Makefile
deleted file mode 100644
index 7734b7a65f..0000000000
--- a/usr/src/cmd/lp/lib/access/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/lib/access/Makefile
-#
-
-LIBRARY = liblpacc.a
-
-OBJECTS = allowed.o \
- bang.o \
- change.o \
- dumpaccess.o \
- files.o \
- loadaccess.o
-
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CPPFLAGS = -I../../include $(CPPFLAGS.master) $(C_PICFLAGS) -D_TS_ERRNO
-
-POFILE = lp_lib_access.po
-
-.KEEP_STATE :
-
-all install : $(LIBS)
-
-include ../../../../lib/Makefile.targ
-
-CLEANFILES += llib-llpacc.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-
-lint: lintlib
- $(LINT.c) $(LINTFLAGS) $(SRCS)
-
-lintlib:
- $(LINT.c) $(LINTFLAGS) -o lpacc llib-llpacc
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/access/allowed.c b/usr/src/cmd/lp/lib/access/allowed.c
deleted file mode 100644
index c8f6844af6..0000000000
--- a/usr/src/cmd/lp/lib/access/allowed.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "unistd.h"
-
-#include "lp.h"
-#include "access.h"
-#include <pwd.h>
-#include <auth_attr.h>
-#include <auth_list.h>
-#include <tsol/label.h>
-
-/**
- ** is_user_admin() - CHECK IF CURRENT USER IS AN ADMINISTRATOR
- **/
-
-int
-#if defined(__STDC__)
-is_user_admin (
- void
-)
-#else
-is_user_admin ()
-#endif
-{
- /* For a labeled system, tsol_check_admin_auth is called
- * instead of using Access.
- */
- if (is_system_labeled()) {
- /* Check that user has print admin authorization */
- return (tsol_check_admin_auth(getuid()));
- } else {
- return (Access(Lp_A, W_OK) == -1? 0 : 1);
- }
-}
-
-/**
- ** is_user_allowed() - CHECK USER ACCESS ACCORDING TO ALLOW/DENY LISTS
- **/
-
-int
-#if defined(__STDC__)
-is_user_allowed (
- char * user,
- char ** allow,
- char ** deny
-)
-#else
-is_user_allowed (user, allow, deny)
- char *user,
- **allow,
- **deny;
-#endif
-{
- if (bangequ(user, LOCAL_LPUSER) || bangequ(user, LOCAL_ROOTUSER))
- return (1);
-
- return (allowed(user, allow, deny));
-}
-
-/**
- ** is_user_allowed_form() - CHECK USER ACCESS TO FORM
- **/
-
-int
-#if defined(__STDC__)
-is_user_allowed_form (
- char * user,
- char * form
-)
-#else
-is_user_allowed_form (user, form)
- char *user,
- *form;
-#endif
-{
- char **allow,
- **deny;
-
- if (loadaccess(Lp_A_Forms, form, "", &allow, &deny) == -1)
- return (-1);
-
- return (is_user_allowed(user, allow, deny));
-}
-
-/**
- ** is_user_allowed_printer() - CHECK USER ACCESS TO PRINTER
- **/
-
-int
-#if defined(__STDC__)
-is_user_allowed_printer (
- char * user,
- char * printer
-)
-#else
-is_user_allowed_printer (user, printer)
- char *user,
- *printer;
-#endif
-{
- char **allow,
- **deny;
-
- if (loadaccess(Lp_A_Printers, printer, UACCESSPREFIX, &allow, &deny) == -1)
- return (-1);
-
- return (is_user_allowed(user, allow, deny));
-}
-
-/**
- ** is_form_allowed_printer() - CHECK FORM USE ON PRINTER
- **/
-
-int
-#if defined(__STDC__)
-is_form_allowed_printer (
- char * form,
- char * printer
-)
-#else
-is_form_allowed_printer (form, printer)
- char *form,
- *printer;
-#endif
-{
- char **allow,
- **deny;
-
- if (loadaccess(Lp_A_Printers, printer, FACCESSPREFIX, &allow, &deny) == -1)
- return (-1);
-
- return (allowed(form, allow, deny));
-}
-
-/**
- ** allowed() - GENERAL ROUTINE TO CHECK ALLOW/DENY LISTS
- **/
-
-int
-#if defined(__STDC__)
-allowed (
- char * item,
- char ** allow,
- char ** deny
-)
-#else
-allowed (item, allow, deny)
- char *item,
- **allow,
- **deny;
-#endif
-{
- if (allow) {
- if (bang_searchlist(item, allow))
- return (1);
- else
- return (0);
- }
-
- if (deny) {
- if (bang_searchlist(item, deny))
- return (0);
- else
- return (1);
- }
-
- return (0);
-}
-
-/*
- * Check to see if the specified user has the administer the printing
- * system authorization.
- */
-int
-tsol_check_admin_auth(uid_t uid)
-{
- struct passwd *p;
- char *name;
-
- p = getpwuid(uid);
- if (p != NULL && p->pw_name != NULL)
- name = p->pw_name;
- else
- name = "";
-
- return (chkauthattr(PRINT_ADMIN_AUTH, name));
-}
diff --git a/usr/src/cmd/lp/lib/access/bang.c b/usr/src/cmd/lp/lib/access/bang.c
deleted file mode 100644
index 9e68839f78..0000000000
--- a/usr/src/cmd/lp/lib/access/bang.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1999 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "unistd.h"
-#include "stdlib.h"
-#include "sys/utsname.h"
-
-#include "lp.h"
-
-/*
- * The rules:
- *
- * Key: A - some system
- * X - some user
- *
- * X a user named X on the local system
- * A!X the user named X from the system A
- * all!X all users named X from any system
- * all all users from local system
- * A!all all users from the system A
- * all!all all users from any system
- */
-
-
-/**
- ** bangequ() - LIKE STREQU, BUT HANDLES system!name CASES
- **/
-
-int
-bangequ (char *user1p, char *user2p)
-{
- int sysname1_all = 0,
- username1_all = 0;
- int sysname2_all = 0,
- username2_all = 0;
- char sysname1[BUFSIZ],
- sysname2[BUFSIZ];
- char username1[BUFSIZ],
- username2[BUFSIZ],
- *sp;
-
- static char *Nodenamep = (char *) 0;
-
- if (! user1p || ! user2p)
- return 1;
-
- if (! Nodenamep) {
- struct utsname utsbuf;
-
- (void) uname (&utsbuf);
- Nodenamep = Strdup (utsbuf.nodename);
- }
-
- /* pattern=all */
- if (STREQU (NAME_ALL, user2p) || STREQU(NAME_ALL, user1p))
- return 1;
-
- if ((sp = strrchr(user1p, '@')) != NULL) { /* user@host */
- *sp++ = '\0';
- (void) snprintf(sysname1, sizeof (sysname1), "%s", sp);
- (void) snprintf(username1, sizeof (username1), "%s", user1p);
- *--sp = '@';
- } else if ((sp = strchr(user1p, '!')) != NULL) { /* host!user */
- *sp++ = '\0';
- (void) snprintf(sysname1, sizeof (sysname1), "%s", user1p);
- (void) snprintf(username1, sizeof (username1), "%s", sp);
- *--sp = '!';
- } else { /* user */
- (void) snprintf(sysname1, sizeof (sysname1), "%s", Nodenamep);
- (void) snprintf(username1, sizeof (username1), "%s", user1p);
- }
-
- sysname1_all = STREQU (NAME_ALL, sysname1);
- username1_all = STREQU (NAME_ALL, username1);
-
- /* user2p is simple user name */
- if (strpbrk (user2p, "!@") == NULL)
- return (username1_all && sysname1_all) ||
- STREQU (username1, user2p);
-
- if ((sp = strrchr(user2p, '@')) != NULL) { /* user@host */
- *sp++ = '\0';
- (void) snprintf(sysname2, sizeof (sysname2), "%s", sp);
- (void) snprintf(username2, sizeof (username2), "%s", user2p);
- *--sp = '@';
- } else if ((sp = strchr(user2p, '!')) != NULL) { /* host!user */
- *sp++ = '\0';
- (void) snprintf(sysname2, sizeof (sysname2), "%s", user2p);
- (void) snprintf(username2, sizeof (username2), "%s", sp);
- *--sp = '!';
- } else { /* user */
- (void) snprintf(sysname2, sizeof (sysname2), "%s", Nodenamep);
- (void) snprintf(username2, sizeof (username2), "%s", user1p);
- }
-
- sysname2_all = STREQU (NAME_ALL, sysname2);
- username2_all = STREQU (NAME_ALL, username2);
-
- if ((sysname1_all && username1_all) ||
- (sysname2_all && username2_all) ||
- (sysname1_all && username2_all) ||
- (sysname2_all && username1_all))
- return 1;
-
- if (sysname1_all || sysname2_all)
- return STREQU (username1, username2);
-
- if (username1_all || username2_all)
- return STREQU (sysname1, sysname2);
-
- if (STREQU (sysname1, sysname2) && STREQU (username1, username2))
- return 1;
-
- return 0;
-}
-
-/**
- ** bang_searchlist() - SEARCH (char **) LIST FOR "system!user" ITEM
- **/
-int
-bang_searchlist(char *item, char **list)
-{
- if (!list || !*list)
- return (0);
-
- /*
- * This is a linear search--we believe that the lists
- * will be short.
- */
- while (*list) {
- if (bangequ(item, *list))
- return (1);
- list++;
- }
- return (0);
-}
-
-/**
- ** bang_dellist() - REMOVE "system!name" ITEM FROM (char **) LIST
- **/
-
-int
-bang_dellist(char ***plist, char *item)
-{
- register char ** pl;
- register char ** ql;
-
- register int n;
-
- /*
- * "hole" is a pointer guaranteed not
- * to point to anyplace malloc'd.
- */
- char * hole = "";
-
-
- /*
- * There are two ways this routine is different from the
- * regular "dellist()" routine: First, the items are of the form
- * ``system!name'', which means there is a two part matching
- * for ``all'' cases (all systems and/or all names). Second,
- * ALL matching items in the list are deleted.
- *
- * Now suppose the list contains just the word ``all'', and
- * the item to be deleted is the name ``fred''. What will
- * happen? The word ``all'' will be deleted, leaving the list
- * empty (null)! This may sound odd at first, but keep in mind
- * that this routine is paired with the regular "addlist()"
- * routine; the item (``fred'') is ADDED to an opposite list
- * (we are either deleting from a deny list and adding to an allow
- * list or vice versa). So, to continue the example, if previously
- * ``all'' were allowed, removing ``fred'' from the allow list
- * does indeed empty that list, but then putting him in the deny
- * list means only ``fred'' is denied, which is the effect we
- * want.
- */
-
- if (*plist) {
-
- for (pl = *plist; *pl; pl++)
- if (bangequ(item, *pl)) {
- Free (*pl);
- *pl = hole;
- }
-
- for (n = 0, ql = pl = *plist; *pl; pl++)
- if (*pl != hole) {
- *ql++ = *pl;
- n++;
- }
-
- if (n == 0) {
- Free ((char *)*plist);
- *plist = 0;
- } else {
- *plist = (char **)Realloc(
- (char *)*plist,
- (n + 1) * sizeof(char *)
- );
- if (!*plist)
- return (-1);
- (*plist)[n] = 0;
- }
- }
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/access/change.c b/usr/src/cmd/lp/lib/access/change.c
deleted file mode 100644
index 892586e5c3..0000000000
--- a/usr/src/cmd/lp/lib/access/change.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "access.h"
-
-static int chgaccess ( int , char ** , char * , char * , char * );
-static char ** empty_list ( void );
-
-/**
- ** deny_user_form() - DENY USER ACCESS TO FORM
- **/
-
-int
-deny_user_form(char **user_list, char *form)
-{
- return (chgaccess(0, user_list, form, Lp_A_Forms, ""));
-}
-
-/**
- ** allow_user_form() - ALLOW USER ACCESS TO FORM
- **/
-
-int
-allow_user_form(char **user_list, char *form)
-{
- return (chgaccess(1, user_list, form, Lp_A_Forms, ""));
-}
-
-/**
- ** deny_user_printer() - DENY USER ACCESS TO PRINTER
- **/
-
-int
-deny_user_printer(char **user_list, char *printer)
-{
- return (chgaccess(0, user_list, printer, Lp_A_Printers, UACCESSPREFIX));
-}
-
-/**
- ** allow_user_printer() - ALLOW USER ACCESS TO PRINTER
- **/
-
-int
-allow_user_printer(char **user_list, char *printer)
-{
- return (chgaccess(1, user_list, printer, Lp_A_Printers, UACCESSPREFIX));
-}
-
-/**
- ** deny_form_printer() - DENY FORM USE ON PRINTER
- **/
-
-int
-deny_form_printer(char **form_list, char *printer)
-{
- return (chgaccess(0, form_list, printer, Lp_A_Printers, FACCESSPREFIX));
-}
-
-/**
- ** allow_form_printer() - ALLOW FORM USE ON PRINTER
- **/
-
-int
-allow_form_printer(char **form_list, char *printer)
-{
- return (chgaccess(1, form_list, printer, Lp_A_Printers, FACCESSPREFIX));
-}
-
-/**
- ** remove_paper_from_printer() - DENY FORM USE ON PRINTER
- **/
-
-int
-remove_paper_from_printer(char **form_list, char *printer)
-{
- return (chgaccess(0, form_list, printer, Lp_A_Printers, PACCESSPREFIX));
-}
-
-/**
- ** add_paper_to_printer() - ALLOW FORM USE ON PRINTER
- **/
-
-int
-add_paper_to_printer(char **form_list, char *printer)
-{
- return (chgaccess(1, form_list, printer, Lp_A_Printers, PACCESSPREFIX));
-}
-
-/**
- ** chgaccess() - UPDATE ALLOW/DENY ACCESS OF ITEM TO RESOURCE
- **/
-
-static int
-chgaccess(int isallow, char **list, char *name, char *dir, char *prefix)
-{
- register char ***padd_list,
- ***prem_list,
- **pl;
-
- char **allow_list,
- **deny_list;
-
- if (loadaccess(dir, name, prefix, &allow_list, &deny_list) == -1)
- return (-1);
-
- if (isallow) {
- padd_list = &allow_list;
- prem_list = &deny_list;
- } else {
- padd_list = &deny_list;
- prem_list = &allow_list;
- }
-
- for (pl = list; *pl; pl++) {
-
- /*
- * Do the ``all'' and ``none'' cases explicitly,
- * so that we can clean up the lists nicely.
- */
- if (STREQU(*pl, NAME_NONE)) {
- isallow = !isallow;
- goto AllCase;
- }
- if (
- STREQU(*pl, NAME_ALL)
- || STREQU(*pl, NAME_ANY)
- || STREQU(*pl, ALL_BANG_ALL)
- ) {
-AllCase:
- freelist (allow_list);
- freelist (deny_list);
- if (isallow) {
- allow_list = 0;
- deny_list = empty_list();
- } else {
- allow_list = 0;
- deny_list = 0;
- }
- break;
-
- } else {
-
- /*
- * For each regular item in the list,
- * we add it to the ``add list'' and remove it
- * from the ``remove list''. This is not
- * efficient, especially if there are a lot of
- * items in the caller's list; doing it the
- * way we do, however, has the side effect
- * of skipping duplicate names in the caller's
- * list.
- *
- * Do a regular "addlist()"--the resulting
- * list may have redundancies, but it will
- * still be correct.
- */
- if (addlist(padd_list, *pl) == -1)
- return (-1);
- if (bang_dellist(prem_list, *pl) == -1)
- return (-1);
-
- }
-
- }
-
- return (dumpaccess(dir, name, prefix, &allow_list, &deny_list));
-}
-
-/**
- ** empty_list() - CREATE AN EMPTY LIST
- **/
-
-static char **
-empty_list(void)
-{
- register char **empty;
-
-
- if (!(empty = (char **)Malloc(sizeof(char *)))) {
- errno = ENOMEM;
- return (0);
- }
- *empty = 0;
- return (empty);
-}
diff --git a/usr/src/cmd/lp/lib/access/dumpaccess.c b/usr/src/cmd/lp/lib/access/dumpaccess.c
deleted file mode 100644
index 2bdc1462dc..0000000000
--- a/usr/src/cmd/lp/lib/access/dumpaccess.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "access.h"
-
-#if defined(__STDC__)
-static int _dumpaccess ( char * , char ** );
-#else
-static int _dumpaccess();
-#endif
-
-/**
- ** dumpaccess() - DUMP ALLOW OR DENY LISTS
- **/
-
-int
-dumpaccess(char *dir, char *name, char *prefix, char ***pallow, char ***pdeny)
-{
- register char *allow_file = 0,
- *deny_file = 0;
-
- int ret;
-
- if (
- !(allow_file = getaccessfile(dir, name, prefix, "allow"))
- || _dumpaccess(allow_file, *pallow) == -1 && errno != ENOENT
- || !(deny_file = getaccessfile(dir, name, prefix, "deny"))
- || _dumpaccess(deny_file, *pdeny) == -1 && errno != ENOENT
- )
- ret = -1;
- else
- ret = 0;
-
- if (allow_file)
- Free (allow_file);
- if (deny_file)
- Free (deny_file);
-
- return (ret);
-}
-
-/**
- ** _dumpaccess() - DUMP ALLOW OR DENY FILE
- **/
-
-static int
-_dumpaccess(char *file, char **list)
-{
- register char **pl;
-
- register int ret;
-
- int fd;
-
- if (list) {
- if ((fd = open_locked(file, "w", MODE_READ)) < 0)
- return (-1);
- errno = 0;
- for (pl = list; *pl; pl++)
- fdprintf (fd, "%s\n", *pl);
- if (errno != 0)
- ret = -1;
- else
- ret = 0;
- close(fd);
- } else
- ret = Unlink(file);
-
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/access/files.c b/usr/src/cmd/lp/lib/access/files.c
deleted file mode 100644
index 6c8470e1f5..0000000000
--- a/usr/src/cmd/lp/lib/access/files.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "stdio.h"
-#include "string.h"
-#include "unistd.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** getaccessfile() - BUILD NAME OF ALLOW OR DENY FILE
- **/
-
-char *
-#if defined(__STDC__)
-getaccessfile (
- char * dir,
- char * name,
- char * prefix,
- char * base
-)
-#else
-getaccessfile (dir, name, prefix, base)
- char *dir,
- *name,
- *prefix,
- *base;
-#endif
-{
- register char *parent,
- *file,
- *f;
-
- /*
- * It makes no sense talking about the access files if
- * the directory for the form or printer doesn't exist.
- */
- parent = makepath(dir, name, (char *)0);
- if (!parent)
- return (0);
- if (Access(parent, F_OK) == -1) {
- Free(parent);
- return (0);
- }
-
- if (!(f = makestr(prefix, base, (char *)0))) {
- Free(parent);
- errno = ENOMEM;
- return (0);
- }
- file = makepath(parent, f, (char *)0);
- Free (f);
- Free (parent);
-
- return (file);
-}
diff --git a/usr/src/cmd/lp/lib/access/llib-llpacc b/usr/src/cmd/lp/lib/access/llib-llpacc
deleted file mode 100644
index 8e15c15c3f..0000000000
--- a/usr/src/cmd/lp/lib/access/llib-llpacc
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-int allow_form_printer ( char **, char * );
-int allow_user_form ( char ** , char * );
-int allow_user_printer ( char **, char * );
-int allowed ( char *, char **, char ** );
-int deny_form_printer ( char **, char * );
-int deny_user_form ( char ** , char * );
-int deny_user_printer ( char **, char * );
-int dumpaccess ( char *, char *, char *, char ***, char *** );
-int is_form_allowed_printer ( char *, char * );
-int is_user_admin ( void );
-int is_user_allowed ( char *, char ** , char ** );
-int is_user_allowed_form ( char *, char * );
-int is_user_allowed_printer ( char *, char * );
-int load_formprinter_access ( char *, char ***, char *** );
-int load_paperprinter_access(char *, char ***, char ***);
-int load_userform_access ( char *, char ***, char *** );
-int load_userprinter_access ( char *, char ***, char *** );
-int loadaccess ( char *, char *, char *, char ***, char *** );
-int bangequ ( char * , char * );
-int bang_searchlist ( char * , char ** );
-int bang_dellist ( char *** , char * );
-
-char * getaccessfile ( char *, char *, char *, char * );
-
diff --git a/usr/src/cmd/lp/lib/access/loadaccess.c b/usr/src/cmd/lp/lib/access/loadaccess.c
deleted file mode 100644
index 9541528b22..0000000000
--- a/usr/src/cmd/lp/lib/access/loadaccess.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "errno.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "access.h"
-
-static char **_loadaccess ( char * );
-
-/**
- ** load_userform_access() - LOAD ALLOW/DENY LISTS FOR USER+FORM
- **/
-
-int
-load_userform_access(char *form, char ***pallow, char ***pdeny)
-{
- return (loadaccess(Lp_A_Forms, form, "", pallow, pdeny));
-}
-
-/**
- ** load_userprinter_access() - LOAD ALLOW/DENY LISTS FOR USER+PRINTER
- **/
-
-int
-load_userprinter_access(char *printer, char ***pallow, char ***pdeny)
-{
- return (loadaccess(Lp_A_Printers, printer, UACCESSPREFIX, pallow,
- pdeny));
-}
-
-/**
- ** load_formprinter_access() - LOAD ALLOW/DENY LISTS FOR FORM+PRINTER
- **/
-
-int
-load_formprinter_access(char *printer, char ***pallow, char ***pdeny)
-{
- return (loadaccess(Lp_A_Printers, printer, FACCESSPREFIX, pallow,
- pdeny));
-}
-
-/**
- ** load_paperprinter_access() - LOAD ALLOW/DENY LISTS FOR FORM+PRINTER
- **/
-
-int
-load_paperprinter_access(char *printer, char ***pallow, char ***pdeny)
-{
- return (loadaccess(Lp_A_Printers, printer, PACCESSPREFIX, pallow,
- pdeny));
-}
-
-/**
- ** loadaccess() - LOAD ALLOW OR DENY LISTS
- **/
-
-int
-loadaccess(char *dir, char *name, char *prefix, char ***pallow, char ***pdeny)
-{
- register char *allow_file = 0,
- *deny_file = 0;
-
- int ret;
-
- if (
- !(allow_file = getaccessfile(dir, name, prefix, ALLOWFILE))
- || !(*pallow = _loadaccess(allow_file)) && errno != ENOENT
- || !(deny_file = getaccessfile(dir, name, prefix, DENYFILE))
- || !(*pdeny = _loadaccess(deny_file)) && errno != ENOENT
- )
- ret = -1;
- else
- ret = 0;
-
- if (allow_file)
- Free (allow_file);
- if (deny_file)
- Free (deny_file);
-
- return (ret);
-}
-
-/**
- ** _loadaccess() - LOAD ALLOW OR DENY FILE
- **/
-
-static char **
-_loadaccess(char *file)
-{
- register size_t nalloc,
- nlist;
-
- register char **list;
-
- int fd;
-
- char buf[BUFSIZ];
-
-
- if ((fd = open_locked(file, "r", 0)) < 0)
- return (0);
-
- /*
- * Preallocate space for the initial list. We'll always
- * allocate one more than the list size, for the terminating null.
- */
- nalloc = ACC_MAX_GUESS;
- list = (char **)Malloc((nalloc + 1) * sizeof(char *));
- if (!list) {
- close(fd);
- errno = ENOMEM;
- return (0);
- }
-
- errno = 0;
- for (nlist = 0; fdgets(buf, BUFSIZ, fd); ) {
-
- buf[strlen(buf) - 1] = 0;
-
- /*
- * Allocate more space if needed.
- */
- if (nlist >= nalloc) {
- nalloc += ACC_MAX_GUESS;
- list = (char **)Realloc(
- (char *)list,
- (nalloc + 1) * sizeof(char *)
- );
- if (!list) {
- close(fd);
- return (0);
- }
- }
-
- list[nlist] = Strdup(buf); /* if fail, minor problem */
- list[++nlist] = 0;
-
- }
- if (errno != 0) {
- int save_errno = errno;
-
- close(fd);
- freelist (list);
- errno = save_errno;
- return (0);
- }
- close(fd);
-
- /*
- * If we have more space allocated than we need,
- * return the extra.
- */
- if (nlist != nalloc) {
- list = (char **)Realloc(
- (char *)list,
- (nlist + 1) * sizeof(char *)
- );
- if (!list) {
- errno = ENOMEM;
- return (0);
- }
- }
- list[nlist] = 0;
-
- return (list);
-}
diff --git a/usr/src/cmd/lp/lib/class/delclass.c b/usr/src/cmd/lp/lib/class/delclass.c
deleted file mode 100644
index ee88b33bce..0000000000
--- a/usr/src/cmd/lp/lib/class/delclass.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-/* LINTLIBRARY */
-
-#include "stdio.h"
-#include "errno.h"
-#include "string.h"
-#include "sys/types.h"
-#include "string.h"
-
-#include "lp.h"
-#include "class.h"
-
-static int _delclass ( char * );
-
-/**
- ** delclass() - WRITE CLASS OUT TO DISK
- **/
-
-int
-delclass(char *name)
-{
- long lastdir;
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(NAME_ALL, name)) {
- lastdir = -1;
- while ((name = next_file(Lp_A_Classes, &lastdir)))
- if (_delclass(name) == -1)
- return (-1);
- return (0);
- } else
- return (_delclass(name));
-}
-
-/**
- ** _delclass()
- **/
-
-static int
-#if defined(__STDC__)
-_delclass (
- char * name
-)
-#else
-_delclass (name)
- char *name;
-#endif
-{
- char *path;
-
- if (!(path = getclassfile(name)))
- return (-1);
- if (rmfile(path) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
- return (0);
-}
-
diff --git a/usr/src/cmd/lp/lib/class/freeclass.c b/usr/src/cmd/lp/lib/class/freeclass.c
deleted file mode 100644
index dc6fd9f448..0000000000
--- a/usr/src/cmd/lp/lib/class/freeclass.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* LINTLIBRARY */
-
-#include <syslog.h>
-#include "lp.h"
-#include "class.h"
-
-/**
- ** freeclass() - FREE SPACE USED BY CLASS STRUCTURE
- **/
-
-void
-#if defined(__STDC__)
-freeclass (
- CLASS * clsbufp
-)
-#else
-freeclass (clsbufp)
- CLASS *clsbufp;
-#endif
-{
- if (!clsbufp)
- return;
- syslog(LOG_DEBUG, "freeclass(%s)", clsbufp->name ? clsbufp->name : "");
- if (clsbufp->name)
- Free (clsbufp->name);
- freelist (clsbufp->members);
- Free(clsbufp);
-
- return;
-}
diff --git a/usr/src/cmd/lp/lib/class/getclass.c b/usr/src/cmd/lp/lib/class/getclass.c
deleted file mode 100644
index ad888370f4..0000000000
--- a/usr/src/cmd/lp/lib/class/getclass.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include <syslog.h>
-
-#include "lp.h"
-#include "class.h"
-
-/**
- ** getclass() - READ CLASS FROM TO DISK
- **/
-
-CLASS *
-getclass(char *name)
-{
- static long lastdir = -1;
-
- CLASS *clsp;
-
- char *file,
- buf[BUFSIZ];
-
- int fd;
-
- syslog(LOG_DEBUG, "getclass(%s)", name ? name : "");
-
- if (!name || !*name) {
- errno = EINVAL;
- return (0);
- }
-
- /*
- * Getting ``all''? If so, jump into the directory
- * wherever we left off.
- */
- if (STREQU(NAME_ALL, name)) {
- if (!(name = next_file(Lp_A_Classes, &lastdir)))
- return (0);
- } else
- lastdir = -1;
-
- /*
- * Get the class list.
- */
-
- if (!(file = getclassfile(name)))
- return (0);
-
- if ((fd = open_locked(file, "r", 0)) < 0) {
- Free (file);
- return (0);
- }
- Free (file);
-
- clsp = (CLASS *)calloc(sizeof (*clsp), 1);
-
- if (!(clsp->name = Strdup(name))) {
- Free (clsp);
- close(fd);
- errno = ENOMEM;
- return (0);
- }
-
- clsp->members = 0;
- errno = 0;
- while (fdgets(buf, BUFSIZ, fd)) {
- buf[strlen(buf) - 1] = 0;
- addlist (&clsp->members, buf);
- }
- if (errno != 0) {
- int save_errno = errno;
-
- freelist (clsp->members);
- Free (clsp->name);
- Free (clsp);
- close(fd);
- errno = save_errno;
- return (0);
- }
- close(fd);
-
- if (!clsp->members) {
- Free (clsp->name);
- Free (clsp);
- errno = EBADF;
- return (0);
- }
-
- return (clsp);
-}
diff --git a/usr/src/cmd/lp/lib/class/llib-llpcls b/usr/src/cmd/lp/lib/class/llib-llpcls
deleted file mode 100644
index fea59cd737..0000000000
--- a/usr/src/cmd/lp/lib/class/llib-llpcls
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-typedef struct CLASS {
- char *name; /* name of class (redundant) */
- char **members; /* members of class */
-} CLASS;
-
-int putclass ( char *, CLASS * );
-int delclass ( char * );
-
-void freeclass ( CLASS * );
-
diff --git a/usr/src/cmd/lp/lib/class/putclass.c b/usr/src/cmd/lp/lib/class/putclass.c
deleted file mode 100644
index 8f85a082af..0000000000
--- a/usr/src/cmd/lp/lib/class/putclass.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "string.h"
-
-#include "lp.h"
-#include "class.h"
-
-/**
- ** putclass() - WRITE CLASS OUT TO DISK
- **/
-
-int
-putclass(char *name, CLASS *clsbufp)
-{
- char *file;
- int fd;
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(NAME_ALL, name)) {
- errno = EINVAL;
- return (-1);
- }
-
- /*
- * Open the class file and write out the class members.
- */
-
- if (!(file = getclassfile(name)))
- return (-1);
-
- if ((fd = open_locked(file, "w", MODE_READ)) < 0) {
- Free (file);
- return (-1);
- }
- Free (file);
-
- errno = 0;
- fdprintlist(fd, clsbufp->members);
- if (errno != 0) {
- close(fd);
- return (-1);
- }
- close(fd);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/filters/Makefile b/usr/src/cmd/lp/lib/filters/Makefile
deleted file mode 100644
index 4b91ddcc4b..0000000000
--- a/usr/src/cmd/lp/lib/filters/Makefile
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 1990-2003 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-LIBRARY = liblpflt.a
-
-OBJECTS = conv.o \
- delfilter.o \
- dumpfilters.o \
- freefilter.o \
- getfilter.o \
- filtertable.o \
- insfilter.o \
- loadfilters.o \
- putfilter.o \
- regex.o \
- search.o \
- trash.o
-
-include ../../Makefile.lp
-
-include ../../../../lib/Makefile.lib
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CPPFLAGS = -I../../include $(CPPFLAGS.master)
-
-CERRWARN += -_gcc=-Wno-uninitialized
-CERRWARN += -_gcc=-Wno-parentheses
-
-POFILE = lp_lib_filters.po
-
-.KEEP_STATE:
-
-all install : $(LIBS)
-
-include ../../../../lib/Makefile.targ
-
-CLEANFILES += llib-llpflt.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-
-lint: lintlib
- $(LINT.c) $(LINTFLAGS) $(SRCS)
-
-lintlib:
- $(LINT.c) $(LINTFLAGS) -o lpflt llib-llpflt
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/filters/conv.c b/usr/src/cmd/lp/lib/filters/conv.c
deleted file mode 100644
index f5167265d5..0000000000
--- a/usr/src/cmd/lp/lib/filters/conv.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.13 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-#include "regexpr.h"
-
-#include "lp.h"
-#include "filters.h"
-
-static char *keyword_list[] = {
- PARM_INPUT,
- PARM_OUTPUT,
- PARM_TERM,
- PARM_PRINTER,
- PARM_CPI,
- PARM_LPI,
- PARM_LENGTH,
- PARM_WIDTH,
- PARM_PAGES,
- PARM_CHARSET,
- PARM_FORM,
- PARM_COPIES,
- PARM_MODES,
- 0
-};
-
-#if defined(__STDC__)
-static char * q_strchr ( char * , char );
-static char * q_strdup ( char * );
-#else
-static char *q_strchr(),
- *q_strdup();
-#endif
-
-/**
- ** s_to_filtertype() - CONVERT (char *) TO (FILTERTYPE)
- **/
-
-FILTERTYPE
-#if defined(__STDC__)
-s_to_filtertype (
- char * str
-)
-#else
-s_to_filtertype (str)
- char *str;
-#endif
-{
- /*
- * The default type, if none is given, is ``slow''.
- */
- if (STREQU(str, FL_FAST))
- return (fl_fast);
- else
- return (fl_slow);
-}
-
-/**
- ** s_to_type() - CONVERT (char *) TO (TYPE)
- **/
-
-TYPE
-#if defined(__STDC__)
-s_to_type (
- char * str
-)
-#else
-s_to_type (str)
- register char *str;
-#endif
-{
- TYPE ret;
-
- if ((ret.name = Strdup(str)))
- ret.info = isterminfo(str);
- return (ret);
-}
-
-/**
- ** s_to_template() - CONVERT (char *) TO (TEMPLATE)
- **/
-
-TEMPLATE
-#if defined(__STDC__)
-s_to_template (
- char * str
-)
-#else
-s_to_template (str)
- register char *str;
-#endif
-{
- TEMPLATE ret;
-
- register char *p,
- c;
-
-
- if (!*(str += strspn(str, " "))) {
- lp_errno = LP_ETEMPLATE;
- ret.keyword = 0;
- goto Done;
- }
-
- if (!(p = strchr(str, ' '))) {
- lp_errno = LP_EPATTERN;
- ret.keyword = 0;
- goto Done;
- }
-
- c = *p;
- *p = 0;
- ret.keyword = Strdup(str);
- *p = c;
-
- if (!ret.keyword) {
- lp_errno = LP_ENOMEM;
- goto Done;
- }
- if (!searchlist(ret.keyword, keyword_list)) {
- lp_errno = LP_EKEYWORD;
- ret.keyword = 0;
- goto Done;
- }
-
- str = p + strspn(p, " ");
- if (!(p = q_strchr(str, '='))) {
- lp_errno = LP_ERESULT;
- ret.keyword = 0;
- goto Done;
- }
- while (p[-1] == ' ' && p > str)
- p--;
-
- c = *p;
- *p = 0;
- ret.pattern = q_strdup(str);
- *p = c;
-
- if (!ret.pattern) {
- lp_errno = LP_ENOMEM;
- ret.keyword = 0;
- goto Done;
- }
-
- if (!*ret.pattern) {
- lp_errno = LP_EPATTERN;
- ret.keyword = 0;
- goto Done;
- }
-
- if (!(ret.re = compile(ret.pattern, (char *)0, (char *)0))) {
- lp_errno = LP_EREGEX;
- ret.keyword = 0;
- goto Done;
- }
- ret.nbra = nbra;
-
- if (!*(str = p + strspn(p, " ="))) {
- lp_errno = LP_ERESULT;
- ret.keyword = 0;
- goto Done;
- }
- ret.result = q_strdup(str);
- if (!ret.result) {
- lp_errno = LP_ENOMEM;
- ret.keyword = 0;
- }
-
-Done: return (ret);
-}
-
-/**
- ** sl_to_typel() - CONVERT (char **) LIST TO (TYPE *) LIST
- **/
-
-TYPE *
-#if defined(__STDC__)
-sl_to_typel (
- char ** src
-)
-#else
-sl_to_typel (src)
- char **src;
-#endif
-{
- register TYPE *dst;
-
- register int nitems,
- n;
-
- if (!src || !*src)
- return (0);
-
- for (nitems = 0; src[nitems]; nitems++)
- ;
-
- if (!(dst = (TYPE *)Malloc((nitems + 1) * sizeof(TYPE)))) {
- errno = ENOMEM;
- return (0);
- }
-
- for (n = 0; n < nitems; n++)
- dst[n] = s_to_type(src[n]);
- dst[nitems].name = 0;
-
- return (dst);
-}
-
-/**
- ** sl_to_templatel() - DUPLICATE A (char **) LIST AS (TEMPLATE *) LIST
- **/
-
-TEMPLATE *
-#if defined(__STDC__)
-sl_to_templatel (
- char ** src
-)
-#else
-sl_to_templatel (src)
- register char **src;
-#endif
-{
- register TEMPLATE *dst;
-
- register int nitems,
- n;
-
- if (!src || !*src)
- return (0);
-
- for (nitems = 0; src[nitems]; nitems++)
- ;
-
- if (!(dst = (TEMPLATE *)Malloc((nitems + 1) * sizeof(TEMPLATE)))){
- errno = ENOMEM;
- return (0);
- }
-
- for (n = 0; n < nitems; n++) {
- dst[n] = s_to_template(src[n]);
- if (dst[n].keyword == 0) {
- freetempl (dst);
- return (0);
- }
- }
- dst[nitems].keyword = 0;
-
- return (dst);
-}
-
-/**
- ** type_to_s() - CONVERT (TYPE) TO (char *)
- **/
-
-char *
-#if defined(__STDC__)
-type_to_s (
- TYPE t
-)
-#else
-type_to_s (t)
- TYPE t;
-#endif
-{
- return (Strdup(t.name));
-}
-
-/**
- ** template_to_s() - CONVERT (TEMPLATE) TO (char *)
- **/
-
-char *
-#if defined(__STDC__)
-template_to_s (
- TEMPLATE t
-)
-#else
-template_to_s (t)
- TEMPLATE t;
-#endif
-{
- register char *ret,
- *p,
- *r;
-
- register size_t len;
-
-
- len = strlen(t.keyword) + 1;
- for (p = t.pattern; *p; p++) {
- if (*p == '=')
- len++;
- len++;
- }
- len += 3 + strlen(t.result);
-
- ret = Malloc(len + 1);
- if (!ret) {
- errno = ENOMEM;
- return (0);
- }
-
- r = ret;
- for (p = t.keyword; *p; )
- *r++ = *p++;
- *r++ = ' ';
- for (p = t.pattern; *p; ) {
- if (*p == '=')
- *r++ = '\\';
- *r++ = *p++;
- }
- *r++ = ' ';
- *r++ = '=';
- *r++ = ' ';
- for (p = t.result; *p; )
- *r++ = *p++;
- *r = 0;
-
- return (ret);
-}
-
-/**
- ** typel_to_sl() - DUPLICATE (TYPE *) LIST AS (char **) LIST
- **/
-
-char **
-#if defined(__STDC__)
-typel_to_sl (
- TYPE * src
-)
-#else
-typel_to_sl (src)
- TYPE *src;
-#endif
-{
- register char **dst;
-
- register size_t nitems;
-
- register int n;
-
-
- if (!src || !src->name)
- return (0);
-
- for (nitems = 0; src[nitems].name; nitems++)
- ;
-
- if (!(dst = (char **)Malloc((nitems + 1) * sizeof(char *)))) {
- errno = ENOMEM;
- return (0);
- }
-
- for (n = 0; n < nitems; n++)
- dst[n] = type_to_s(src[n]);
- dst[nitems] = 0;
-
- return (dst);
-}
-
-/**
- ** templatel_to_sl() - DUPLICATE A (TEMPLATE *) LIST AS (char **) LIST
- **/
-
-char **
-#if defined(__STDC__)
-templatel_to_sl (
- TEMPLATE * src
-)
-#else
-templatel_to_sl (src)
- register TEMPLATE *src;
-#endif
-{
- register char **dst;
-
- register size_t nitems;
-
- register int n;
-
-
- if (!src || !src->keyword)
- return (0);
-
- for (nitems = 0; src[nitems].keyword; nitems++)
- ;
-
- if (!(dst = (char **)Malloc((nitems + 1) * sizeof(char *)))) {
- errno = ENOMEM;
- return (0);
- }
-
- for (n = 0; n < nitems; n++)
- dst[n] = template_to_s(src[n]);
- dst[nitems] = 0;
-
- return (dst);
-}
-
-/**
- ** q_strpbrk() - strpbrk() WITH BACKSLASH QUOTING
- ** q_strdup() - strdup() WITH BACKSLASHES OMITTED
- **/
-
-static char *
-#if defined(__STDC__)
-q_strchr (
- char * sp,
- char c
-)
-#else
-q_strchr (sp, c)
- register char *sp,
- c;
-#endif
-{
- do {
- if (*sp == '\\' && sp[1])
- sp += 2;
- if (*sp == c)
- return (sp);
- } while (*sp++);
- return (0);
-}
-
-static char *
-#if defined(__STDC__)
-q_strdup (
- char * str
-)
-#else
-q_strdup (str)
- char *str;
-#endif
-{
- char *ret;
-
- register char *p,
- *q;
-
- register int len = 0;
-
-
- for (p = str; *p; p++) {
- if (*p == '\\' && p[1] == '=')
- p++;
- len++;
- }
-
- if (!(ret = q = Malloc(len + 1)))
- return (0);
-
- for (p = str; *p; p++) {
- if (*p == '\\' && p[1] == '=')
- p++;
- *q++ = *p;
- }
- *q = 0;
-
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/filters/delfilter.c b/usr/src/cmd/lp/lib/filters/delfilter.c
deleted file mode 100644
index 5d1d0fa041..0000000000
--- a/usr/src/cmd/lp/lib/filters/delfilter.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "filters.h"
-
-/**
- ** delfilter() - DELETE A FILTER FROM FILTER TABLE
- **/
-
-int
-#if defined(__STDC__)
-delfilter (
- char * name
-)
-#else
-delfilter (name)
- char *name;
-#endif
-{
- register _FILTER *pf;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(NAME_ALL, name)) {
- trash_filters ();
- goto Done;
- }
-
- /*
- * Don't need to check for ENOENT, because if it is set,
- * well that's what we want to return anyway!
- */
- if (!filters && get_and_load() == -1 /* && errno != ENOENT */ )
- return (-1);
-
- if (!(pf = search_filter(name))) {
- errno = ENOENT;
- return (-1);
- }
-
- free_filter (pf);
- for (; pf->name; pf++)
- *pf = *(pf+1);
-
- nfilters--;
- filters = (_FILTER *)Realloc(
- (char *)filters, (nfilters + 1) * sizeof(_FILTER)
- );
- if (!filters) {
- errno = ENOMEM;
- return (-1);
- }
-
-/* filters[nfilters].name = 0; */ /* last for loop above did this */
-
-Done: return (dumpfilters((char *)0));
-}
diff --git a/usr/src/cmd/lp/lib/filters/dumpfilters.c b/usr/src/cmd/lp/lib/filters/dumpfilters.c
deleted file mode 100644
index 1395657fb4..0000000000
--- a/usr/src/cmd/lp/lib/filters/dumpfilters.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "stdlib.h"
-#include "unistd.h"
-
-#include "lp.h"
-#include "filters.h"
-
-static void q_print ( int , char * );
-
-static char *fw_zDblQte (char *zBuf);
-
-/**
- ** dumpfilters() - WRITE FILTERS FROM INTERNAL STRUCTURE TO FILTER TABLE
- **/
-
-int
-dumpfilters(char *file)
-{
- register _FILTER *pf;
- register TEMPLATE *pt;
- register TYPE *pty;
- register char *p,
- *sep;
- register int fld;
- int fd;
-
- if ((fd = open_filtertable(file, "w")) < 0)
- return (-1);
-
- printlist_setup ("", "", LP_SEP, "");
- if (filters) for (pf = filters; pf->name; pf++) {
-
- for (fld = 0; fld < FL_MAX; fld++) switch (fld) {
- case FL_IGN:
- break;
- case FL_NAME:
- p = pf->name;
- goto String;
- case FL_CMD:
- if ((p = fw_zDblQte (pf->command)) != NULL) {
- (void)fdprintf (fd, "%s%s", FL_SEP, p);
- free (p);
- break;
- }
- /* zDblQte failed so go without quotes */
- p = pf->command;
-String: (void)fdprintf (fd, "%s%s", FL_SEP, (p? p : ""));
- break;
- case FL_TYPE:
- (void)fdprintf(fd, "%s%s", FL_SEP,
- (pf->type == fl_fast? FL_FAST : FL_SLOW));
- break;
- case FL_PTYPS:
- pty = pf->printer_types;
- goto Types;
- case FL_ITYPS:
- pty = pf->input_types;
- goto Types;
- case FL_OTYPS:
- pty = pf->output_types;
-Types: (void)fdprintf(fd, "%s", FL_SEP);
- sep = "";
- if (pty) {
- for (; pty->name; pty++) {
- (void)fdprintf(fd, "%s%s", sep,
- pty->name);
- sep = ",";
- }
- } else
- (void)fdprintf(fd, "%s", NAME_ANY);
- break;
- case FL_PRTRS:
- (void)fdprintf(fd, "%s", FL_SEP);
- if (pf->printers)
- fdprintlist (fd, pf->printers);
- else
- (void)fdprintf(fd, "%s", NAME_ANY);
- break;
- case FL_TMPS:
- (void)fdprintf(fd, "%s", FL_SEP);
- sep = "";
- if ((pt = pf->templates))
- for(; pt->keyword; pt++) {
- (void)fdprintf(fd, "%s%s ", sep,
- pt->keyword);
- q_print(fd, pt->pattern);
- (void)fdprintf(fd, " = ");
- q_print(fd, pt->result);
- sep = ",";
- }
- break;
- }
- (void)fdprintf(fd, FL_END);
- }
-
- close(fd);
- return (0);
-}
-
-/**
- ** q_print() - PRINT STRING, QUOTING SEPARATOR CHARACTERS
- **/
-
-static void
-q_print(int fd, char *str)
-{
- /*
- * There are four reasons to quote a character: It is
- * a quote (backslash) character, it is a field separator,
- * it is a list separator, or it is a template separator.
- * "loadfilters()" strips the quote (backslash), but not
- * in one place.
- */
- if (!str)
- return;
- while (*str) {
- if (
- *str == '\\' /* quote reason #1 */
- || strchr(FL_SEP, *str) /* quote reason #2 */
- || strchr(LP_SEP, *str) /* quote reason #3 */
- || strchr("=", *str) /* quote reason #4 */
- )
- fdputc ('\\', fd);
- fdputc (*str, fd);
- str++;
- }
- return;
-}
-
-/*********************************************************
-
- fw_zDblQte
-
- Duplicates the given string allocating memory
- using malloc.
-
- Double quotes are used to encase the string
- and a backslash s put infront of any embedded
- quotes.
-
- returns a pointer to the string provided.
-
- It the function runs out of memory it returns
- NULL.
-
-
-*/
-static char *fw_zDblQte (char *zBuf)
-{
- char *zT;
- int i;
- int j;
- int iNewSize;
-
- /* count the embedded double quotes */
- for (i = j = 0; zBuf[i]; i++) {
- if (zBuf[i] == '"') {
- j++;
- }
- }
-
- /*
- Allocate a new buffer
- add 3 extra bytes for:
- the new leading double quote
- the new trailing double quote
- and the NULL
- add an extra byte for each embedded double quote
- */
- iNewSize = (strlen (zBuf) + 3 + j);
- if ((zT = malloc (iNewSize)) == NULL) {
- return (NULL); /* buffer overflow */
- }
-
- j = 0;
- zT[j++] = '"'; /* start with a leading double quote */
- for (i = 0; zBuf[i]; i++) {
- if (zBuf[i] == '"') {
- zT[j++] = '\\';
- }
- zT[j++] = zBuf[i];
- }
-
- zT[j++] = '"'; /* add a trailing double quote */
- zT[j] = '\0';
-
- return (zT);
-}
-
diff --git a/usr/src/cmd/lp/lib/filters/filtertable.c b/usr/src/cmd/lp/lib/filters/filtertable.c
deleted file mode 100644
index b8898f93b9..0000000000
--- a/usr/src/cmd/lp/lib/filters/filtertable.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "stdio.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "filters.h"
-
-/**
- ** get_and_load() - LOAD REGULAR FILTER TABLE
- **/
-
-int
-get_and_load()
-{
- register char *file;
-
- if (!(file = getfilterfile(FILTERTABLE)))
- return (-1);
- if (loadfilters(file) == -1) {
- Free (file);
- return (-1);
- }
- Free (file);
- return (0);
-}
-
-/**
- ** open_filtertable()
- **/
-
-int
-open_filtertable(char *file, char *mode)
-{
- int freeit;
-
- int fd;
-
- if (!file) {
- if (!(file = getfilterfile(FILTERTABLE)))
- return (0);
- freeit = 1;
- } else
- freeit = 0;
-
- fd = open_locked(file, mode, MODE_READ);
-
- if (freeit)
- Free (file);
-
- return (fd);
-}
diff --git a/usr/src/cmd/lp/lib/filters/freefilter.c b/usr/src/cmd/lp/lib/filters/freefilter.c
deleted file mode 100644
index 0ea87175b4..0000000000
--- a/usr/src/cmd/lp/lib/filters/freefilter.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.11 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdlib.h"
-
-#include "lp.h"
-#include "filters.h"
-
-/**
- ** freefilter() - FREE INTERNAL SPACE ALLOCATED FOR A FILTER
- ** free_filter() - FREE INTERNAL SPACE ALLOCATED FOR A _FILTER
- **/
-
-static void
-#if defined(__STDC__)
-freetypel (
- TYPE * typel
-)
-#else
-freetypel (typel)
- register TYPE *typel;
-#endif
-{
- register TYPE *pt;
-
- if (typel) {
- for (pt = typel; pt->name; pt++)
- Free (pt->name);
- Free ((char *)typel);
- }
- return;
-}
-
-void
-#if defined(__STDC__)
-freetempl (
- TEMPLATE * templ
-)
-#else
-freetempl (templ)
- register TEMPLATE *templ;
-#endif
-{
- register TEMPLATE *pt;
-
- if (templ) {
- for (pt = templ; pt->keyword; pt++) {
- Free (pt->keyword);
- if (pt->pattern)
- Free (pt->pattern);
- if (pt->re)
- Free (pt->re);
- if (pt->result)
- Free (pt->result);
- }
- Free ((char *)templ);
- }
- return;
-}
-
-void
-#if defined(__STDC__)
-freefilter (
- FILTER * pf
-)
-#else
-freefilter (pf)
- FILTER *pf;
-#endif
-{
- if (!pf)
- return;
- if (pf->name)
- Free (pf->name);
- if (pf->command)
- Free (pf->command);
- freelist (pf->printers);
- freelist (pf->printer_types);
- freelist (pf->input_types);
- freelist (pf->output_types);
- freelist (pf->templates);
-
- return;
-}
-
-void
-#if defined(__STDC__)
-free_filter (
- _FILTER * pf
-)
-#else
-free_filter (pf)
- _FILTER *pf;
-#endif
-{
- if (!pf)
- return;
- if (pf->name)
- Free (pf->name);
- if (pf->command)
- Free (pf->command);
- freelist (pf->printers);
- freetypel (pf->printer_types);
- freetypel (pf->input_types);
- freetypel (pf->output_types);
- freetempl (pf->templates);
-
- return;
-}
diff --git a/usr/src/cmd/lp/lib/filters/getfilter.c b/usr/src/cmd/lp/lib/filters/getfilter.c
deleted file mode 100644
index 95f2847592..0000000000
--- a/usr/src/cmd/lp/lib/filters/getfilter.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "filters.h"
-
-/**
- ** getfilter() - GET FILTER FROM FILTER TABLE
- **/
-
-FILTER *
-#if defined(__STDC__)
-getfilter (
- char * name
-)
-#else
-getfilter (name)
- char *name;
-#endif
-{
- static _FILTER *pf = 0;
-
- static FILTER flbuf;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (0);
- }
-
- /*
- * Don't need to check for ENOENT, because if it is set,
- * well that's what we want to return anyway!
- */
- if (!filters && get_and_load() == -1 /* && errno != ENOENT */ )
- return (0);
-
- if (STREQU(NAME_ALL, name))
- if (pf) {
- if (!(++pf)->name)
- pf = 0;
- } else
- pf = filters;
- else
- pf = search_filter(name);
-
- if (!pf || !pf->name) {
- errno = ENOENT;
- return (0);
- }
-
- flbuf.name = Strdup(pf->name);
- flbuf.command = (pf->command? Strdup(pf->command) : 0);
- flbuf.type = pf->type;
- flbuf.printer_types = typel_to_sl(pf->printer_types);
- flbuf.printers = duplist(pf->printers);
- flbuf.input_types = typel_to_sl(pf->input_types);
- flbuf.output_types = typel_to_sl(pf->output_types);
- flbuf.templates = templatel_to_sl(pf->templates);
-
- /*
- * Make sure a subsequent ``all'' query starts getting
- * filters from the beginning.
- */
- if (!STREQU(NAME_ALL, name))
- pf = 0;
-
- return (&flbuf);
-}
diff --git a/usr/src/cmd/lp/lib/filters/insfilter.c b/usr/src/cmd/lp/lib/filters/insfilter.c
deleted file mode 100644
index 51614dff9f..0000000000
--- a/usr/src/cmd/lp/lib/filters/insfilter.c
+++ /dev/null
@@ -1,869 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1998-1999 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "assert.h"
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "filters.h"
-
-#include "regex.h"
-
-
-#define MATCH(PT, PM) (STREQU((PT)->pattern, PATT_STAR) || \
- match((PT)->re, *((PM)->pvalue)))
-
-
-typedef struct PARM {
- char *keyword;
- unsigned short flags;
- char **pvalue;
-} PARM;
-
-#define X_MUST 0x0800 /* Pipeline MUST use this parm */
-#define X_FIRST 0x1000 /* Use parm only in 1st cmd of pipeline */
-#define X_FIXED 0x2000 /* Get value from elsewhere, not parms */
-#define X_MANY 0x4000 /* Several values allowed for parm */
-#define X_USED 0x8000 /* Used already, don't use again */
-
-static struct S {
- TYPE input_type;
- TYPE output_type;
- TYPE printer_type;
- char *printer;
- PARM *parms;
-} S;
-
-#if defined(__STDC__)
-
-static int searchlist_t(TYPE *, TYPE *);
-static int instantiate(_FILTER **, TYPE *, TYPE *,
- int (*)(), void *);
-static int check_pipeline(_FILTER *, PARM *);
-static char *build_pipe(_FILTER *, PARM *, unsigned short *);
-#else
-
-static int searchlist_t();
-static int instantiate();
-static int check_pipeline();
-static char *build_pipe();
-
-#endif
-
-/*
- * Table of recognized keywords, with info. about them.
- */
-
-#define NFIXED 4
-
-static PARM parmtable[] = {
-
-/* These must be the first NFIXED, and in this order */
-PARM_INPUT, X_FIXED, &S.input_type.name,
-PARM_OUTPUT, X_FIXED, &S.output_type.name,
-PARM_TERM, X_FIXED, &S.printer_type.name,
-PARM_PRINTER, X_FIXED, &S.printer,
-
-PARM_CPI, FPARM_CPI, 0,
-PARM_LPI, FPARM_LPI, 0,
-PARM_LENGTH, FPARM_LENGTH, 0,
-PARM_WIDTH, FPARM_WIDTH, 0,
-PARM_PAGES, FPARM_PAGES | X_FIRST | X_MUST, 0,
-PARM_CHARSET, FPARM_CHARSET, 0,
-PARM_FORM, FPARM_FORM, 0,
-PARM_COPIES, FPARM_COPIES | X_FIRST, 0,
-PARM_MODES, FPARM_MODES | X_MANY | X_MUST, 0,
-0, 0, 0,
-};
-
-/*
- * insfilter()
- */
-
-FILTERTYPE
-#if defined(__STDC__)
-insfilter(
- char **pipes,
- char *input_type,
- char *output_type,
- char *printer_type,
- char *printer,
- char **parms,
- unsigned short *flagsp
-)
-#else
-insfilter(pipes, input_type, output_type, printer_type, printer, parms, flagsp)
- char **pipes,
- *input_type,
- *output_type,
- *printer_type,
- *printer,
- **parms;
- unsigned short *flagsp;
-#endif
-{
- _FILTER *pipeline;
-
- FILTERTYPE ret;
-
-
- S.input_type.name = input_type;
- S.input_type.info = isterminfo(input_type);
- S.output_type.name = output_type;
- S.output_type.info = isterminfo(output_type);
- S.printer_type.name = printer_type;
- S.printer_type.info = isterminfo(printer_type);
- S.printer = printer;
-
- /*
- * If the filters have't been loaded yet, do so now.
- * We'll load the standard table, but the caller can override
- * this by first calling "loadfilters()" with the appropriate
- * filter table name.
- */
- if (!filters && loadfilters((char *)0) == -1)
- return (fl_none);
-
- /*
- * Allocate and initialize space to hold additional
- * information about each item in "parms".
- * THIS SPACE MUST BE FREED BEFORE EXITING THIS ROUTINE!
- */
- {
- register int n;
-
- register PARM * pp;
- register PARM * ppt;
-
- register char ** p;
-
-
-
- for (n = 0, p = parms; *p; n++, p++)
- ;
- n /= 2;
- n += NFIXED; /* for fixed parms (in/out/printer types) */
-
- if (!(S.parms = (PARM *)Malloc((n + 1) * sizeof (PARM)))) {
- errno = ENOMEM;
- return (fl_none);
- }
-
- for (ppt = parmtable; ppt->keyword; ppt++)
- ppt->flags &= ~X_USED;
-
- /*
- * Load the parameter list with the fixed ``type''
- * parameters. Mark them as used (if appropriate)
- * so we don't pick them up from the callers list.
- */
- pp = S.parms;
- for (ppt = parmtable; ppt < parmtable + NFIXED; ppt++) {
- pp->keyword = ppt->keyword;
- pp->flags = ppt->flags;
- if (ppt->flags & X_FIXED)
- pp->pvalue = ppt->pvalue;
- else
- pp->pvalue = parms + 1;
- if (!(ppt->flags & X_MANY))
- ppt->flags |= X_USED;
- pp++;
- }
-
- /*
- * Copy each parameter from the caller supplied list
- * to another list, adding information gathered from
- * the keyword table. Note that some keywords should
- * be given only once; additional occurrances in the
- * caller's list will be ignored.
- */
- for (p = parms; *p; p += 2)
- for (ppt = parmtable; ppt->keyword; ppt++)
- if (STREQU(*p, ppt->keyword) &&
- !(ppt->flags & X_USED)) {
-
- pp->keyword = ppt->keyword;
- pp->flags = ppt->flags;
- if (ppt->flags & X_FIXED)
- pp->pvalue = ppt->pvalue;
- else
- pp->pvalue = p + 1;
-
- if (!(ppt->flags & X_MANY))
- ppt->flags |= X_USED;
-
- pp++;
- break;
-
- }
-
- pp->keyword = 0;
-
- }
-
- /*
- * Preview the list of filters, to rule out those that
- * can't possibly work.
- */
- {
- register _FILTER * pf;
-
- for (pf = filters; pf->name; pf++) {
-
- pf->mark = FL_CLEAR;
-
- if (printer && !searchlist(printer, pf->printers))
- pf->mark = FL_SKIP;
-
- else if (printer_type &&
- !searchlist_t(&(S.printer_type),
- pf->printer_types))
- pf->mark = FL_SKIP;
-
- }
- }
-
- /*
- * Find a pipeline that will convert the input-type to the
- * output-type and map the parameters as well.
- */
- if (!instantiate(&pipeline, &S.input_type, &S.output_type,
- check_pipeline, S.parms)) {
- ret = fl_none;
- goto Return;
- }
-
- if (!pipes) {
- ret = fl_both;
- goto Return;
-
- } else {
- register _FILTER * pf;
- register _FILTER * pfastf; /* first in fast pipe */
- register _FILTER * pslowf; /* last in slow pipe */
-
- /*
- * Found a pipeline, so now build it.
- */
-
- /*
- * Split pipeline after last slow filter.
- * "pipeline" will point to first filter in slow
- * pipe, "pfastf" will point to first filter in
- * fast pipe.
- */
- for (pf = pfastf = pipeline, pslowf = 0; pf; pf = pf->next)
- if (pf->type == fl_slow) {
- pslowf = pf;
- pfastf = pf->next;
- }
-
- if (pslowf) {
- assert(pslowf != pfastf);
- pslowf->next = 0;
- pipes[0] = build_pipe(pipeline, S.parms, flagsp);
- ret = fl_slow;
- } else
- pipes[0] = 0;
-
- if (pfastf) {
- pipes[1] = build_pipe(pfastf, S.parms, flagsp);
- ret = fl_fast;
- } else
- pipes[1] = 0;
-
- if (pslowf && pfastf)
- ret = fl_both;
-
- /*
- * Check for the oops case.
- */
- if (pslowf && !pipes[0] || pfastf && !pipes[1])
- ret = fl_none;
-
- }
-
-Return: Free((char *)S.parms);
-
- return (ret);
-}
-
-/*
- * searchlist_t() - SEARCH (TYPE *) LIST FOR ITEM
- */
-
-static int
-#if defined(__STDC__)
-typematch(
- TYPE *type1,
- TYPE *type2
-)
-#else
-typematch(type1, type2)
- TYPE *type1, *type2;
-#endif
-{
- if (STREQU(type1->name, NAME_ANY) || STREQU(type2->name, NAME_ANY) ||
- STREQU(type1->name, type2->name) ||
- (STREQU(type1->name, NAME_TERMINFO) && type2->info) ||
- (STREQU(type2->name, NAME_TERMINFO) && type1->info))
- return (1);
- else
- return (0);
-}
-
-static int
-#if defined(__STDC__)
-searchlist_t(
- TYPE *itemp,
- TYPE *list
-)
-#else
-searchlist_t(itemp, list)
- TYPE *itemp;
- register TYPE *list;
-#endif
-{
- if (!list || !list->name)
- return (0);
-
- /*
- * This is a linear search--we believe that the lists
- * will be short.
- */
- while (list->name) {
- if (typematch(itemp, list))
- return (1);
- list++;
- }
- return (0);
-}
-
-/*
- * instantiate() - CREATE FILTER-PIPELINE KNOWING INPUT/OUTPUT TYPES
- */
-
-/*
- * The "instantiate()" routine is the meat of the "insfilter()"
- * algorithm. It is given an input-type and output-type and finds a
- * filter-pipline that will convert the input-type into the
- * output-type. Since the filter-pipeline must meet other criteria,
- * a function "verify" is also given, along with the set of criteria;
- * these are used by "instantiate()" to verify a filter-pipeline.
- *
- * The filter-pipeline is built up and returned in "pipeline".
- * Conceptually this is just a list of filters, with the pipeline to
- * be constructed by simply concatenating the filter simple-commmands
- * (after filling in option templates) in the order found in the
- * list. What is used in the routine, though, is a pair of linked
- * lists, one list forming the ``right-half'' of the pipeline, the
- * other forming the ``left-half''. The pipeline is then the two
- * lists taken together.
- *
- * The "instantiate()" routine looks for a single filter that matches
- * the input-type and output-type and satisfies the criteria. If one
- * is found, it is added to the end of the ``left-half'' list (it
- * could be added to the beginning of the ``right-half'' list with no
- * problem). The two lists are linked together to form one linked
- * list, which is passed, along with the set of criteria, to the
- * "verify" routine to check the filter-pipeline. If it passes the
- * check, the work is done.
- *
- * If a single filter is not found, "instantiate()" examines all
- * pairs of filters where one in the pair can accept the input-type
- * and the other can produce the output-type. For each of these, it
- * calls itself again to find a filter that can join the pair
- * together--one that accepts as input the output-type of the first
- * in the pair, and produces as output the input-type of the second
- * in the pair. This joining filter may be a single filter or may
- * be a filter-pipeline. "instantiate()" checks for the trivial case
- * where the input-type is the output-type; with trivial cases it
- * links the two lists without adding a filter and checks it with
- * "verify".
- */
-
-/*
- * instantiate()
- */
-
-/*
- * A PIPELIST is what is passed to each recursive call to "instantiate()".
- * It contains a pointer to the end of the ``left-list'', a pointer to the
- * head of the ``right-list'', and a pointer to the head of the left-list.
- * The latter is passed to "verify". The end of the right-list (and thus
- * the end of the entire list when left and right are joined) is the
- * filter with a null ``next'' pointer.
- */
-typedef struct PIPELIST {
- _FILTER * lhead;
- _FILTER * ltail;
- _FILTER * rhead;
-} PIPELIST;
-
-#if defined(__STDC__)
-static int _instantiate(PIPELIST *, TYPE *, TYPE *,
- int (*)(_FILTER *, void *), void *);
-#else
-static int _instantiate();
-#endif
-
-static int peg;
-
-static int
-#if defined(__STDC__)
-instantiate(
- _FILTER **pline,
- TYPE *input,
- TYPE *output,
- int (*verify)(_FILTER *, void *),
- void *criteria
-)
-#else
-instantiate(pline, input, output, verify, criteria)
- _FILTER **pline;
- TYPE *input,
- *output;
- int (*verify)();
- char *criteria;
-#endif
-{
- PIPELIST p;
- int ret;
-
- peg = 0;
- p.lhead = p.ltail = p.rhead = 0;
- ret = _instantiate(&p, input, output, verify, criteria);
- *pline = p.lhead;
- return (ret);
-}
-
-#define ENTER() int our_tag; our_tag = ++peg;
-
-#define LEAVE(Y) if (!Y) { \
- register _FILTER *f; \
- for (f = filters; f->name; f++) \
- CLEAR(f); \
- return (0); \
- } else \
- return (1)
-
-#define MARK(F, M) (((F)->mark |= M), (F)->level = our_tag)
-
-#define CLEAR(F) if ((F)->level == our_tag) \
- (F)->level = 0, (F)->mark = FL_CLEAR
-
-#define CHECK(F, M) (((F)->mark & M) && (F)->level == our_tag)
-
-#define USED(F) ((F)->mark)
-
-static int
-#if defined(__STDC__)
-_instantiate(
- PIPELIST *pp,
- TYPE *inputp,
- TYPE *outputp,
- int (*verify)(_FILTER *, void *),
- void *criteria
-)
-#else
-_instantiate(pp, inputp, outputp, verify, criteria)
- PIPELIST *pp;
- TYPE *inputp,
- *outputp;
- int (*verify)();
- char *criteria;
-#endif
-{
- register _FILTER *prev_lhead;
- register _FILTER *prev_ltail;
-
-
- /*
- * Must be first ``statement'' after declarations.
- */
- ENTER();
-
- /*
- * We're done when we've added filters on the left and right
- * that let us connect the left and right directly; i.e. when
- * the output of the left is the same type as the input of the
- * right. HOWEVER, there must be at least one filter involved,
- * to allow the filter feature to be used for handling modes,
- * pages, copies, etc. not just FILTERING data.
- */
- if (typematch(inputp, outputp) && pp->lhead) {
-
- /*
- * Getting here means that we must have a left and right
- * pipeline. Why? For "pp->lhead" to be non-zero it
- * must have been set below. The first place below
- * doesn't set the right pipeline, but it also doesn't
- * get us here (at least not directly). The only
- * place we can get to here again is the second place
- * "pp->phead" is set, and THAT sets the right pipeline.
- */
- pp->ltail->next = pp->rhead;
- if ((*verify)(pp->lhead, criteria))
- LEAVE(1);
- else
- LEAVE(0);
-
- }
-
- /*
- * Each time we search the list of filters, we examine
- * them in the order given and stop searching when a filter
- * that meets the needs is found. If the list is ordered with
- * fast filters before slow filters, then fast filters will
- * be chosen over otherwise-equal filters.
- */
-
- /*
- * See if there's a single filter that will work.
- * Just in case we can't find one, mark those that
- * will work as left- or right-filters, to save time
- * later.
- *
- * Also, record exactly *which* input/output
- * type would be needed if the filter was used.
- * This record will be complete (both input and output
- * recorded) IF the single filter works. Otherwise,
- * only the input, for the left possible filters,
- * and the output, for the right possible filters,
- * will be recorded. Thus, we'll have to record the
- * missing types later.
- */
- {
- register _FILTER * pf;
-
-
- for (pf = filters; pf->name; pf++) {
-
- if (USED(pf))
- continue;
-
- if (searchlist_t(inputp, pf->input_types)) {
- MARK(pf, FL_LEFT);
- pf->inputp = inputp;
- }
- if (searchlist_t(outputp, pf->output_types)) {
- MARK(pf, FL_RIGHT);
- pf->outputp = outputp;
- }
-
- if (CHECK(pf, FL_LEFT) && CHECK(pf, FL_RIGHT)) {
- prev_lhead = pp->lhead;
- prev_ltail = pp->ltail;
-
- if (!pp->lhead)
- pp->lhead = pf;
- else
- pp->ltail->next = pf;
- (pp->ltail = pf)->next = pp->rhead;
-
- if ((*verify)(pp->lhead, criteria))
- LEAVE(1);
-
- if ((pp->ltail = prev_ltail))
- pp->ltail->next = 0;
- pp->lhead = prev_lhead;
-
- }
-
- }
- }
-
- /*
- * Try all DISJOINT pairs of left- and right-filters; recursively
- * call this function to find a filter that will connect
- * them (it might be a ``null'' filter).
- */
- {
- register _FILTER * pfl;
- register _FILTER * pfr;
-
- register TYPE * llist;
- register TYPE * rlist;
-
-
- for (pfl = filters; pfl->name; pfl++) {
-
- if (!CHECK(pfl, FL_LEFT))
- continue;
-
- for (pfr = filters; pfr->name; pfr++) {
-
- if (pfr == pfl || !CHECK(pfr, FL_RIGHT))
- continue;
-
- prev_lhead = pp->lhead;
- prev_ltail = pp->ltail;
-
- if (!pp->lhead)
- pp->lhead = pfl;
- else
- pp->ltail->next = pfl;
- (pp->ltail = pfl)->next = 0;
-
- pfr->next = pp->rhead;
- pp->rhead = pfr;
-
- /*
- * Try all the possible output types of
- * the left filter with all the possible
- * input types of the right filter. If
- * we find a combo. that works, record
- * the output and input types for the
- * respective filters.
- */
- for (llist = pfl->output_types; llist->name;
- llist++)
- for (rlist = pfr->input_types;
- rlist->name; rlist++)
- if (_instantiate(pp, llist,
- rlist, verify,
- criteria)) {
- pfl->outputp = llist;
- pfr->inputp = rlist;
- LEAVE(1);
- }
- pp->rhead = pfr->next;
- if ((pp->ltail = prev_ltail))
- pp->ltail->next = 0;
- pp->lhead = prev_lhead;
-
- }
-
- }
- }
-
- LEAVE(0);
-}
-
-/*
- * check_pipeline() - CHECK THAT PIPELINE HANDLES MODES, PAGE-LIST
- */
-
-static int
-#if defined(__STDC__)
-check_pipeline(
- _FILTER *pipeline,
- PARM *parms
-)
-#else
-check_pipeline(pipeline, parms)
- _FILTER *pipeline;
- PARM *parms;
-#endif
-{
- register PARM *pm;
-
- register _FILTER *pf;
-
- register TEMPLATE *pt;
-
- register int fail;
-
-
- for (fail = 0, pm = parms; !fail && pm->keyword; pm++) {
-
- if (!(pm->flags & X_MUST))
- continue;
-
- for (pf = pipeline; pf; pf = pf->next) {
-
- if (!(pt = pf->templates))
- continue;
-
- for (; pt->keyword; pt++)
- if (STREQU(pt->keyword, pm->keyword) &&
- pt->result && MATCH(pt, pm))
- goto Okay;
-
- }
- fail = 1;
- continue;
-
-Okay:;
-
- }
-
- return (fail? 0 : 1);
-}
-
-/*
- * build_filter() - CONSTRUCT PIPELINE FROM LINKED LIST OF FILTERS
- */
-
-#if defined(__STDC__)
-static size_t build_simple_cmd(char **, _FILTER *, PARM *,
- unsigned short *);
-#else
-static size_t build_simple_cmd();
-#endif
-
-static char *
-#if defined(__STDC__)
-build_pipe(
- _FILTER *pipeline,
- PARM *parms,
- unsigned short *fp
-)
-#else
-build_pipe(pipeline, parms, fp)
- _FILTER *pipeline;
- PARM *parms;
- unsigned short *fp;
-#endif
-{
- register _FILTER *pf;
-
- register size_t nchars;
- register size_t n;
-
- char *p; /* NOT register */
- char *ret;
-
-
- /*
- * This is a two-pass routine. In the first pass we add
- * up how much space is needed for the pipeline, in the second
- * pass we allocate the space and construct the pipeline.
- */
-
- for (nchars = 0, pf = pipeline; pf; pf = pf->next)
- if ((n = build_simple_cmd((char **)0, pf, parms, fp)) > 0)
- nchars += n + 1; /* +1 for '|' or ending null */
-
- if (!(ret = p = Malloc(nchars))) {
- errno = ENOMEM;
- return (0);
- }
-
- for (pf = pipeline; pf; pf = pf->next, *p++ = (pf? '|' : 0))
- (void) build_simple_cmd(&p, pf, parms, fp);
-
- return (ret);
-}
-
-/*
- * build_simple_cmd()
- */
-
-static size_t
-#if defined(__STDC__)
-build_simple_cmd(
- char **pp,
- _FILTER *pf,
- PARM *parms,
- unsigned short *flagsp
-)
-#else
-build_simple_cmd(pp, pf, parms, flagsp)
- char **pp;
- _FILTER *pf;
- PARM *parms;
- unsigned short *flagsp;
-#endif
-{
- register size_t ncount;
-
- register TEMPLATE *pt;
-
- register PARM *pm;
-
-
- if (pf->command) {
- ncount = strlen(pf->command);
- if (pp) {
- strcpy (*pp, pf->command);
- *pp += ncount;
- }
- } else
- ncount = 0;
-
- if (!pf->templates)
- return (ncount);
-
- for (pm = parms; pm->keyword; pm++) {
-
- if ((pm->flags & X_USED) || !*(pm->pvalue))
- continue;
-
- for (pt = pf->templates; pt->keyword; pt++) {
-
- if (!STREQU(pt->keyword, pm->keyword) || !pt->result)
- continue;
-
- /*
- * INPUT and OUTPUT are those for *this* filter,
- * not for the entire pipeline.
- */
- if (STREQU(pt->keyword, PARM_INPUT))
- pm->pvalue = &(pf->inputp->name);
- else if (STREQU(pt->keyword, PARM_OUTPUT))
- pm->pvalue = &(pf->outputp->name);
-
- if (MATCH(pt, pm)) {
- if (pp)
- *(*pp)++ = ' ';
- ncount++;
-
- ncount += replace(pp, pt->result,
- *(pm->pvalue), pt->nbra);
-
- /*
- * Difficulty here due to the two pass
- * nature of this code. The first pass
- * just counts the number of bytes; if
- * we mark the once-only parms as being
- * used, then we don't pick them up the
- * second time through. We could get
- * difficult and mark them temporarily,
- * but that's hard. So on the first pass
- * we don't mark the flags. The only
- * problem is an estimate too high.
- */
- if (pp && pm->flags & X_FIRST)
- pm->flags |= X_USED;
-
- *flagsp |= pm->flags;
-
- }
- }
- }
-
- return (ncount);
-}
diff --git a/usr/src/cmd/lp/lib/filters/llib-llpflt b/usr/src/cmd/lp/lib/filters/llib-llpflt
deleted file mode 100644
index 61db757567..0000000000
--- a/usr/src/cmd/lp/lib/filters/llib-llpflt
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-
-typedef enum FILTERTYPE {
- fl_none,
- fl_fast,
- fl_slow,
- fl_both
-} FILTERTYPE;
-
-typedef struct FILTER {
- char * name; /* name of filter (redundant) */
- char * command; /* shell command (full path) */
- FILTERTYPE type; /* type of filter (fast/slow) */
- char ** printer_types; /* list of valid printer types */
- char ** printers; /* list of valid printers */
- char ** input_types; /* list of valid input types */
- char ** output_types; /* list of valid output types */
- char ** templates; /* list of option templates */
-} FILTER;
-
-
-
-typedef struct TYPE {
- char * name;
- unsigned short info; /* 1 iff "name" is in Terminfo */
-} TYPE;
-
-
-typedef struct TEMPLATE {
- char * keyword;
- char * pattern;
- char * re;
- char * result;
- int nbra;
-} TEMPLATE;
-
-typedef struct _FILTER {
- struct _FILTER * next; /* for linking several */
- char * name;
- char * command;
- char ** printers;
- TYPE * printer_types;
- TYPE * input_types; /* all possible choices */
- TYPE * output_types; /* all possible choices */
- TYPE * inputp; /* the one to be used */
- TYPE * outputp; /* the one to be used */
- TEMPLATE * templates;
- FILTERTYPE type;
- unsigned char mark,
- level;
-} _FILTER;
-
-
-FILTER * getfilter ( char * );
-
-_FILTER * search_filter ( char * );
-
-FILTERTYPE insfilter ( char ** , char * , char * , char * , char * , char ** , unsigned short * );
-FILTERTYPE s_to_filtertype ( char * );
-
-TEMPLATE s_to_template ( char * );
-
-TEMPLATE * sl_to_templatel ( char ** );
-
-TYPE s_to_type ( char * );
-
-TYPE * sl_to_typel ( char ** );
-
-char * template_to_s ( TEMPLATE );
-char * type_to_s ( TYPE );
-
-char ** templatel_to_sl ( TEMPLATE * );
-char ** typel_to_sl ( TYPE * );
-
-int open_filtertable ( char * , char * );
-
-int get_and_load ( void );
-int putfilter ( char * , FILTER * );
-int delfilter ( char * );
-int loadfilters ( char * );
-
-void freetempl ( TEMPLATE * );
-void freefilter ( FILTER * );
-void free_filter ( _FILTER * );
-void trash_filters ( void );
-void close_filtertable ( FILE * );
diff --git a/usr/src/cmd/lp/lib/filters/loadfilters.c b/usr/src/cmd/lp/lib/filters/loadfilters.c
deleted file mode 100644
index a4f1912bc5..0000000000
--- a/usr/src/cmd/lp/lib/filters/loadfilters.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-#include "unistd.h"
-
-#include "lp.h"
-#include "filters.h"
-
-_FILTER *filters;
-
-size_t nfilters;
-
-static int getfields (int, char *[], char *, int, int, char *);
-static int fs_cmp(const void *, const void *);
-
-/**
- ** loadfilters() - READ FILTERS FROM FILTER TABLE INTO INTERNAL STRUCTURE
- **/
-
-int
-loadfilters(char *file)
-{
- register _FILTER *pf;
- int fd;
- char *filt[FL_MAX],
- buf[3 * BUFSIZ];
- size_t nalloc;
-
- if (filters) {
- nalloc = nfilters;
- trash_filters ();
- } else
- nalloc = FL_MAX_GUESS;
-
- if ((fd = open_filtertable(file, "r")) < 0)
- return (-1);
-
- /*
- * Preallocate space for the internal filter table.
- * Our guess is the number of filters previously read in,
- * if any have been read in before (see above).
- */
- filters = (_FILTER *)Malloc((nalloc + 1) * sizeof(_FILTER));
- if (!filters) {
- close(fd);
- errno = ENOMEM;
- return (-1);
- }
-
- for (
- pf = filters, nfilters = 0;
- getfields(fd, filt, buf, sizeof(buf), FL_MAX, FL_SEP) != -1;
- pf++
- ) {
-
- char **list;
-
- /*
- * Allocate more space if needed.
- */
- if (++nfilters > nalloc) {
- nalloc = nfilters;
- filters = (_FILTER *)Realloc(
- filters,
- (nalloc + 1) * sizeof(_FILTER)
- );
- if (!filters) {
- close(fd);
- errno = ENOMEM;
- return (-1);
- }
- pf = &filters[nfilters - 1];
- }
-
-#define DFLT(X) (filt[X] && *filt[X]? filt[X] : NAME_ANY)
-
- pf->name = Strdup(filt[FL_NAME]);
- pf->type = s_to_filtertype(filt[FL_TYPE]);
- pf->command = Strdup(filt[FL_CMD]);
-
- pf->printers = getlist(DFLT(FL_PRTRS), LP_WS, LP_SEP);
-
- list = getlist(DFLT(FL_PTYPS), LP_WS, LP_SEP);
- pf->printer_types = sl_to_typel(list);
- freelist (list);
-
- list = getlist(DFLT(FL_ITYPS), LP_WS, LP_SEP);
- pf->input_types = sl_to_typel(list);
- freelist (list);
-
- list = getlist(DFLT(FL_OTYPS), LP_WS, LP_SEP);
- pf->output_types = sl_to_typel(list);
- freelist (list);
-
- /*
- * Note the use of "" instead of LP_WS. The
- * "sl_to_templatel()" routine will take care
- * of stripping leading blanks. Stripping trailing
- * blanks would be nice but shouldn't matter.
- */
-
-/* quote reason #3 (in "getlist()") */
- list = getlist(filt[FL_TMPS], "", LP_SEP);
-
-/* quote reason #4 (in "s_to_template()") */
- pf->templates = sl_to_templatel(list);
- freelist (list);
-
- }
- if (errno != 0) {
- int save_errno = errno;
-
- free_filter (pf);
- close(fd);
- errno = save_errno;
- return (-1);
- }
- close(fd);
-
- /*
- * If we have more space allocated than we need,
- * return the extra.
- */
- if (nfilters != nalloc) {
- filters = (_FILTER *)Realloc(
- filters,
- (nfilters + 1) * sizeof(_FILTER)
- );
- if (!filters) {
- errno = ENOMEM;
- return (-1);
- }
- }
- filters[nfilters].name = 0;
-
- /*
- * Sort the filters, putting ``fast'' filters before
- * ``slow'' filters. This preps the list for "insfilter()"
- * so that it can easily pick fast filters over otherwise
- * equivalent slow filters. This sorting is done every
- * time we read in the table; one might think that if
- * "putfilter()" would insert in the correct order then
- * the table, when written out to disk, would be sorted
- * already--removing the need to sort it here. We don't
- * take that approach, because (1) sorting it isn't that
- * expensive and (2) someone might tamper with the table
- * file.
- */
- qsort ((char *)filters, nfilters, sizeof(_FILTER), fs_cmp);
-
- return (0);
-}
-
-/**
- ** getfields() - PARSE NON-COMMENT LINE FROM FILE INTO FIELDS
- **/
-
-static int
-getfields(int fd, char *fields[], char *buf, int bufsiz, int max, char *seps)
-{
- register char *p,
- *q;
-
- register int n = 0;
- enum ParsingMode {CHECK_LEAD_DBL_QUOTE, NORMAL_PARSING, LITERAL_READ} eMode;
- errno = 0;
- while (fdgets(buf, bufsiz, fd) != NULL) {
- buf[strlen(buf) - 1] = 0;
- p = buf + strspn(buf, " \t");
- if (*p && *p != '#') {
- for (eMode = CHECK_LEAD_DBL_QUOTE, fields[n++] = q = p; *p; ) {
- switch (eMode) {
- case CHECK_LEAD_DBL_QUOTE: /* check for leading double quote */
- if (*p == '"') {
- eMode = LITERAL_READ;
- p++;
- break;
- }
- eMode = NORMAL_PARSING;
- /* drop through to NORMAL_PARSING case */
-
- case NORMAL_PARSING: /* default legacy editing */
- if (*p == '\\') {
- if (
-/* quote reason #1 */ p[1] == '\\'
-/* quote reason #2 */ || strchr(seps, p[1])
- )
- p++;
- *q++ = *p++;
- } else if (strchr(seps, *p)) {
- *q++ = 0;
- p++;
- if (n < max) {
- fields[n++] = q;
- eMode = CHECK_LEAD_DBL_QUOTE;
- }
- } else
- *q++ = *p++;
- break;
-
- case LITERAL_READ: /* read literally until another double quote */
- if (*p == '\\' && p[1] == '"') { /* embedded double quote */
- p++;
- *q++ = *p++;
- } else if (*p == '"') { /* end of literal read */
- p++;
- eMode = NORMAL_PARSING;
- } else {
- *q++ = *p++; /* capture as is */
- }
- break;
- }
- }
- *q = 0;
- while (n < max)
- fields[n++] = "";
- return (n);
- }
- }
- return (-1);
-}
-
-/**
- ** fs_cmp() - COMPARE TWO FILTERS BY "FILTERTYPE"
- **/
-
-static int
-fs_cmp(const void *pfa, const void *pfb)
-{
- if (((_FILTER *)pfa)->type == ((_FILTER *)pfb)->type)
- return (0);
- else if (((_FILTER *)pfa)->type == fl_fast)
- return (-1);
- else
- return (1);
-}
diff --git a/usr/src/cmd/lp/lib/filters/putfilter.c b/usr/src/cmd/lp/lib/filters/putfilter.c
deleted file mode 100644
index fad8e0d28c..0000000000
--- a/usr/src/cmd/lp/lib/filters/putfilter.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "filters.h"
-
-/**
- ** putfilter() - PUT FILTER INTO FILTER TABLE
- **/
-
-int
-#if defined(__STDC__)
-putfilter (
- char * name,
- FILTER * flbufp
-)
-#else
-putfilter (name, flbufp)
- char *name;
- FILTER *flbufp;
-#endif
-{
- _FILTER _flbuf;
-
- register _FILTER *pf;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(NAME_ALL, name)) {
- errno = EINVAL;
- return (-1);
- }
-
- _flbuf.name = Strdup(name);
- _flbuf.command = (flbufp->command? Strdup(flbufp->command) : 0);
- _flbuf.type = flbufp->type;
- _flbuf.printer_types = sl_to_typel(flbufp->printer_types);
- _flbuf.printers = duplist(flbufp->printers);
- _flbuf.input_types = sl_to_typel(flbufp->input_types);
- _flbuf.output_types = sl_to_typel(flbufp->output_types);
- if (!flbufp->templates)
- _flbuf.templates = 0;
- else if (!(_flbuf.templates = sl_to_templatel(flbufp->templates))) {
- free_filter (&_flbuf);
- errno = EBADF;
- return (-1);
- }
-
- if (!filters && get_and_load() == -1 && errno != ENOENT) {
- free_filter (&_flbuf);
- return (-1);
- }
-
- if (filters) {
-
- if ((pf = search_filter(name)))
- free_filter (pf);
- else {
- nfilters++;
- filters = (_FILTER *)Realloc(
- (char *)filters,
- (nfilters + 1) * sizeof(_FILTER)
- );
- if (!filters) {
- free_filter (&_flbuf);
- errno = ENOMEM;
- return (-1);
- }
- filters[nfilters].name = 0;
- pf = filters + nfilters - 1;
- }
-
- } else {
-
- nfilters = 1;
- pf = filters = (_FILTER *)Malloc(
- (nfilters + 1) * sizeof(_FILTER)
- );
- if (!filters) {
- free_filter (&_flbuf);
- errno = ENOMEM;
- return (-1);
- }
- filters[nfilters].name = 0;
-
- }
-
- *pf = _flbuf;
-
- return (dumpfilters((char *)0));
-}
diff --git a/usr/src/cmd/lp/lib/filters/regex.c b/usr/src/cmd/lp/lib/filters/regex.c
deleted file mode 100644
index e6931d2fcf..0000000000
--- a/usr/src/cmd/lp/lib/filters/regex.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "regexpr.h"
-#include "regex.h"
-#include "string.h"
-
-/**
- ** match() - TEST MATCH OF TEMPLATE/PATTERN WITH PARAMETER
- **/
-
-int
-#if defined(__STDC__)
-match (
- char * re,
- char * value
-)
-#else
-match (re, value)
- register char * re;
- register char * value;
-#endif
-{
- int ret;
-
- /*
- * We want exact matches, just as if the regular expression
- * was ^...$, to explicitly match the beginning and end of line.
- * Using "advance" instead of "step" takes care of the ^ and
- * checking where the match left off takes care of the $.
- * We don't do something silly like add the ^ and $ ourselves,
- * because the user may have done that already.
- */
- ret = advance(value, re);
- if (ret && *loc2)
- ret = 0;
- return (ret);
-}
-
-/**
- ** replace() - REPLACE TEMPLATE WITH EXPANDED REGULAR EXPRESSION MATCH
- **/
-
-size_t
-#if defined(__STDC__)
-replace (
- char ** pp,
- char * result,
- char * value,
- int nbra
-)
-#else
-replace (pp, result, value)
- char ** pp;
- char * result;
- char * value;
- int nbra;
-#endif
-{
- register char * p;
- register char * q;
-
- register size_t ncount = 0;
-
-
-/*
- * Count and perhaps copy a single character:
- */
-#define CCPY(SRC) if ((ncount++, pp)) \
- *p++ = SRC
-
-/*
- * Count and perhaps copy a string:
- */
-#define SCPY(SRC) if (pp) { \
- register char * r; \
- for (r = (SRC); *r; ncount++) \
- *p++ = *r++; \
- } else \
- ncount += strlen(SRC)
-
-
- if (pp)
- p = *pp;
-
- for (q = result; *q; q++) switch (*q) {
-
- case '*':
- case '&':
- SCPY (value);
- break;
-
- case '\\':
- switch (*++q) {
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- {
- register int n = *q-'1';
-
- if (n < nbra) {
- register char c = *(braelist[n]);
-
- *(braelist[n]) = 0;
- SCPY (braslist[n]);
- *(braelist[n]) = c;
- }
- break;
- }
-
- default:
- CCPY (*q);
- break;
- }
- break;
-
- default:
- CCPY (*q);
- break;
- }
-
- if (pp)
- *pp = p;
-
- return (ncount);
-}
diff --git a/usr/src/cmd/lp/lib/filters/regex.h b/usr/src/cmd/lp/lib/filters/regex.h
deleted file mode 100644
index e8fa4c78aa..0000000000
--- a/usr/src/cmd/lp/lib/filters/regex.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-
-#if defined(__STDC__)
-
-int match ( char * , char * );
-size_t replace ( char ** , char * , char * , int );
-
-#else
-
-int match();
-size_t replace();
-
-#endif
diff --git a/usr/src/cmd/lp/lib/filters/search.c b/usr/src/cmd/lp/lib/filters/search.c
deleted file mode 100644
index 428139ab32..0000000000
--- a/usr/src/cmd/lp/lib/filters/search.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-
-#include "lp.h"
-#include "filters.h"
-
-/**
- ** search_filter() - SEARCH INTERNAL FILTER TABLE FOR FILTER BY NAME
- **/
-
-_FILTER *
-#if defined(__STDC__)
-search_filter (
- char * name
-)
-#else
-search_filter (name)
- register char *name;
-#endif
-{
- register _FILTER *pf;
-
- for (pf = filters; pf->name; pf++)
- if (STREQU(pf->name, name))
- break;
- return (pf->name? pf : 0);
-}
diff --git a/usr/src/cmd/lp/lib/filters/trash.c b/usr/src/cmd/lp/lib/filters/trash.c
deleted file mode 100644
index 06e6953d39..0000000000
--- a/usr/src/cmd/lp/lib/filters/trash.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdlib.h"
-
-#include "lp.h"
-#include "filters.h"
-
-/**
- ** trash_filters() - FREE ALL SPACE ALLOCATED FOR FILTER TABLE
- **/
-
-void trash_filters ()
-{
- register _FILTER *pf;
-
- if (filters) {
- for (pf = filters; pf->name; pf++)
- free_filter (pf);
- Free ((char *)filters);
- nfilters = 0;
- filters = 0;
- }
- return;
-}
diff --git a/usr/src/cmd/lp/lib/forms/Makefile b/usr/src/cmd/lp/lib/forms/Makefile
deleted file mode 100644
index a085f5f66b..0000000000
--- a/usr/src/cmd/lp/lib/forms/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/lib/forms/Makefile
-#
-
-LIBRARY = liblpfrm.a
-
-OBJECTS = delform.o \
- f_head.o \
- freeform.o \
- getform.o \
- putform.o \
- rdform.o \
- wrform.o
-
-
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CFLAGS += $(C_BIGPICFLAGS)
-CPPFLAGS = -I../../include $(CPPFLAGS.master)
-
-POFILE = lp_lib_forms.po
-
-.KEEP_STATE:
-
-all install : $(LIBS)
-
-include ../../../../lib/Makefile.targ
-
-CLEANFILES += llib-llpfrm.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-
-lint: lintcheck
-
-lintlib:
- $(LINT.c) $(LINTFLAGS) -o lpfrm llib-llpfrm
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/forms/delform.c b/usr/src/cmd/lp/lib/forms/delform.c
deleted file mode 100644
index 6c367bbff1..0000000000
--- a/usr/src/cmd/lp/lib/forms/delform.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.11 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "form.h"
-
-#if defined(__STDC__)
-static int _delform ( char * );
-#else
-static int _delform();
-#endif
-
-/**
- ** delform()
- **/
-
-int
-#if defined(__STDC__)
-delform (
- char * name
-)
-#else
-delform (name)
- char *name;
-#endif
-{
- long lastdir;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(NAME_ALL, name)) {
- lastdir = -1;
- while ((name = next_dir(Lp_A_Forms, &lastdir)))
- if (_delform(name) == -1)
- return (-1);
- return (0);
- } else
- return (_delform(name));
-}
-
-/**
- ** _delform()
- **/
-
-static int
-#if defined(__STDC__)
-_delform (
- char * name
-)
-#else
-_delform (name)
- char *name;
-#endif
-{
- register char *path;
-
-#define RMFILE(X) if (!(path = getformfile(name, X))) \
- return (-1); \
- if (rmfile(path) == -1) { \
- Free (path); \
- return (-1); \
- } \
- Free (path)
- RMFILE (DESCRIBE);
- RMFILE (COMMENT);
- RMFILE (ALIGN_PTRN);
- RMFILE (ALLOWFILE);
- RMFILE (DENYFILE);
-
- delalert (Lp_A_Forms, name);
-
- if (!(path = getformfile(name, (char *)0)))
- return (-1);
- if (Rmdir(path) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/forms/f_head.c b/usr/src/cmd/lp/lib/forms/f_head.c
deleted file mode 100644
index 39cd34956a..0000000000
--- a/usr/src/cmd/lp/lib/forms/f_head.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-
-#include "lp.h"
-#include "form.h"
-
-struct {
- char *v;
- short len;
- short infile;
-} formheadings[FO_MAX] = {
-
-#define ENTRY(X) X, sizeof(X)-1
-
- ENTRY("page length:"), 1, /* FO_PLEN */
- ENTRY("page width:"), 1, /* FO_PWID */
- ENTRY("number of pages:"), 1, /* FO_NP */
- ENTRY("line pitch:"), 1, /* FO_LPI */
- ENTRY("character pitch:"), 1, /* FO_CPI */
- ENTRY("character set choice:"), 1, /* FO_CHSET */
- ENTRY("ribbon color:"), 1, /* FO_RCOLOR */
- ENTRY("comment:"), 0, /* FO_CMT */
- ENTRY("alignment pattern:"), 1, /* FO_ALIGN */
- ENTRY("paper:"), 1, /* FO_PAPER */
-
-#undef ENTRY
-
-};
-
-/**
- ** _search_fheading()
- **/
-
-int
-#if defined(__STDC__)
-_search_fheading (
- char * buf
-)
-#else
-_search_fheading (buf)
- char * buf;
-#endif
-{
- int fld;
-
-
- for (fld = 0; fld < FO_MAX; fld++)
- if (
- formheadings[fld].v
- && formheadings[fld].len
- && CS_STRNEQU(
- buf,
- formheadings[fld].v,
- formheadings[fld].len
- )
- )
- break;
-
- return (fld);
-}
diff --git a/usr/src/cmd/lp/lib/forms/freeform.c b/usr/src/cmd/lp/lib/forms/freeform.c
deleted file mode 100644
index 451650fe27..0000000000
--- a/usr/src/cmd/lp/lib/forms/freeform.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "form.h"
-
-/**
- ** freeform() - FREE MEMORY ALLOCATED FOR FORM STRUCTURE
- **/
-
-void
-#if defined(__STDC__)
-freeform (
- FORM * pf
-)
-#else
-freeform (pf)
- FORM * pf;
-#endif
-{
- if (!pf)
- return;
- if (pf->chset)
- Free (pf->chset);
- if (pf->rcolor)
- Free (pf->rcolor);
- if (pf->comment)
- Free (pf->comment);
- if (pf->conttype)
- Free (pf->conttype);
- if (pf->name)
- Free (pf->name);
- pf->name = 0;
-
- return;
-}
diff --git a/usr/src/cmd/lp/lib/forms/getform.c b/usr/src/cmd/lp/lib/forms/getform.c
deleted file mode 100644
index d0cf592484..0000000000
--- a/usr/src/cmd/lp/lib/forms/getform.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.14 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "form.h"
-
-/*
- * getform() - EXTRACT FORM STRUCTURE FROM DISK FILE
- *
- * The FILE **align_fp doesn't need to be changed for scalability, because
- * it is always NULL when getform is called by lpsched.
- */
-int
-getform(char *name, FORM *formp, FALERT *alertp, FILE **align_fp)
-{
- static long lastdir = -1;
-
- int fd;
-
- register char * path;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- /*
- * Getting ``all''? If so, jump into the directory
- * wherever we left off.
- */
- if (STREQU(NAME_ALL, name)) {
- if (!(name = next_dir(Lp_A_Forms, &lastdir)))
- return (-1);
- } else
- lastdir = -1;
-
-
- /*
- * Get the form configuration information (?)
- */
- if (formp) {
- path = getformfile(name, DESCRIBE);
- if (!path)
- return (-1);
- if ((fd = open_locked(path, "r", 0)) < 0) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- if (rdform(name, formp, fd, 0, (int *)0) == -1) {
- close(fd);
- return (-1);
- }
- close(fd);
- }
-
- /*
- * Get the alert information (?)
- */
- if (alertp) {
-
- FALERT * pa = getalert(Lp_A_Forms, name);
-
-
- /*
- * Don't fail if we can't read it because of access
- * permission UNLESS we're "root" or "lp"
- */
- if (!pa) {
-
- if (errno == ENOENT) {
- alertp->shcmd = 0;
- alertp->Q = alertp->W = -1;
-
- } else if (errno == ENOTDIR) {
- freeform (formp);
- errno = ENOENT; /* form doesn't exist */
- return (-1);
-
- } else if (
- errno != EACCES
- || !getpid() /* we be root */
- || STREQU(getname(), LPUSER) /* we be lp */
- ) {
- freeform (formp);
- return (-1);
- }
-
- } else
- *alertp = *pa;
- }
-
- /*
- * Get the alignment pattern (?)
- */
- if (align_fp) {
- path = getformfile(name, ALIGN_PTRN);
- if (!path) {
- freeform (formp);
- errno = ENOMEM;
- return (-1);
- }
- if (
- !(*align_fp = open_lpfile(path, "r", 0))
- && errno != ENOENT
- ) {
- Free (path);
- freeform (formp);
- return (-1);
- }
- Free (path);
- }
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/forms/llib-llpfrm b/usr/src/cmd/lp/lib/forms/llib-llpfrm
deleted file mode 100644
index 625d3e7be5..0000000000
--- a/usr/src/cmd/lp/lib/forms/llib-llpfrm
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "../../include/lp.h"
-
-typedef struct FORM {
- SCALED plen;
- SCALED pwid;
- SCALED lpi;
- SCALED cpi;
- int np;
- char * chset;
- short mandatory;
- char * rcolor;
- char * comment;
- char * conttype;
- char * name;
- char * paper;
- short isDefault;
-} FORM;
-
-#define err_hndlr int (*)( int , int , int )
-
-int delform ( char * );
-int getform ( char * , FORM * , FALERT * , FILE ** );
-int putform ( char * , FORM * , FALERT * , FILE ** );
-int rdform ( char * , FORM * , int , err_hndlr , int * );
-int wrform ( char * , FORM * , int , err_hndlr , int * );
-
-void freeform ( FORM * );
-
diff --git a/usr/src/cmd/lp/lib/forms/putform.c b/usr/src/cmd/lp/lib/forms/putform.c
deleted file mode 100644
index beaff08220..0000000000
--- a/usr/src/cmd/lp/lib/forms/putform.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "form.h"
-
-/**
- ** putform() - WRITE FORM STRUCTURE TO DISK FILES
- **/
-
-int
-putform(char *name, FORM *formp, FALERT *alertp, FILE **p_align_fp)
-{
- register char * path;
-
- int fd;
-
- struct stat statbuf;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(NAME_ALL, name)) {
- errno = EINVAL;
- return (-1);
- }
-
- /*
- * Create the parent directory for this form
- * if it doesn't yet exist.
- */
- if (!(path = getformfile(name, (char *)0)))
- return (-1);
- if (Stat(path, &statbuf) == 0) {
- if (!S_ISDIR(statbuf.st_mode)) {
- Free (path);
- errno = ENOTDIR;
- return (-1);
- }
- } else if (errno != ENOENT || mkdir_lpdir(path, MODE_DIR) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- /*
- * Open the configuration file and write out the form
- * configuration (?)
- */
- if (formp) {
- if (!(path = getformfile(name, DESCRIBE)))
- return (-1);
- if ((fd = open_locked(path, "w", MODE_READ)) < 0) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- if (wrform(name, formp, fd, 0, (int *)0) == -1) {
- close(fd);
- return (-1);
- }
- close(fd);
- }
-
- /*
- * Write out the alert condition (?)
- */
- if (alertp) {
- if (
- alertp->shcmd
- && putalert(Lp_A_Forms, name, alertp) == -1
- )
- return (-1);
- }
-
- /*
- * Write out the alignment pattern (?)
- */
- if (p_align_fp && *p_align_fp) {
-
- int size = 0,
- n;
-
- char buf[BUFSIZ];
-
-
- if (!(path = getformfile(name, ALIGN_PTRN)))
- return (-1);
- if ((fd = open_locked(path, "w", MODE_READ)) < 0) {
- Free (path);
- return (-1);
- }
-
- while ((n = fread(buf, 1, BUFSIZ, *p_align_fp)) != 0) {
- size += n;
- write (fd, buf, n);
- }
- close(fd);
-
- if (!size)
- Unlink(path);
-
- Free(path);
- }
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/forms/rdform.c b/usr/src/cmd/lp/lib/forms/rdform.c
deleted file mode 100644
index a92ebb70f4..0000000000
--- a/usr/src/cmd/lp/lib/forms/rdform.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.17 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "form.h"
-
-extern struct {
- char *v;
- short len;
- short infile;
-} formheadings[];
-
-#if defined(__STDC__)
-int _search_fheading ( char * );
-#else
-int _search_fheading();
-#endif
-
-int
-rdform(char *name, FORM *formp, int fd, int (*error_handler)( int , int , int ),
- int *which_set)
-{
- char buf[BUFSIZ];
-
- char * rest;
- char * mandp;
- char * dftp;
- char * here;
-
- int fld;
- int have_line_already;
- int found_alignment_pattern;
- int size;
- int add_size;
- int linenum;
- int i;
-
- SCALED sdn;
-
- register char * p;
-
-
- /*
- * Initialize the entire structure, to ensure no random
- * values get in it. However, make sure some values won't
- * be null or empty. Do the latter here as opposed to
- * after reading the file, because sometimes the file
- * contains an empty header to FORCE a null/empty value.
- */
- (void)memset ((char *)formp, 0, sizeof(*formp));
- formp->name = Strdup(name);
- formp->plen.val = DPLEN;
- formp->plen.sc = 0;
- formp->pwid.val = DPWIDTH;
- formp->pwid.sc = 0;
- formp->lpi.val = DLPITCH;
- formp->lpi.sc = 0;
- formp->cpi.val = DCPITCH;
- formp->cpi.sc = 0;
- formp->np = DNP;
- formp->chset = Strdup(DCHSET);
- formp->mandatory = 0;
- formp->rcolor = Strdup(DRCOLOR);
- formp->conttype = Strdup(DCONTYP);
- formp->paper = NULL;
- formp->isDefault = 0;
-
- /*
- * Read the file.
- */
-
-#define FGETS(B,S,F) (linenum++, fdgets(B,S,F))
-
- have_line_already = 0;
- found_alignment_pattern = 0;
- linenum = 0;
- errno = 0;
- while (!found_alignment_pattern
- && (have_line_already || FGETS(buf, BUFSIZ, fd))
- ) {
-
- int pos = strlen(buf) - 1;
-
-
- have_line_already = 0;
-
- while (isspace(buf[pos]))
- buf[pos--] = 0;
-
- fld = _search_fheading(buf);
- if (fld >= FO_MAX) {
- lp_errno = LP_EBADHDR;
-BadFile: errno = EBADF;
- if (error_handler) {
- if ((*error_handler)(errno, lp_errno, linenum) == -1)
- return (-1);
- continue;
- } else {
- /*
- * To allow future extensions to not
- * impact applications using old versions
- * of this routine, ignore strange fields.
- */
- continue;
- }
- }
-
- p = buf + formheadings[fld].len;
- while (isspace(*p))
- p++;
-
- if (which_set)
- which_set[fld] = 1;
-
- if (
- formheadings[fld].infile
- || error_handler
- ) switch (fld) {
-
- case FO_PLEN:
- sdn = getsdn(p);
- if (errno == EINVAL) {
- lp_errno = LP_EBADSDN;
- goto BadFile;
- }
- formp->plen = sdn;
- break;
-
- case FO_PWID:
- sdn = getsdn(p);
- if (errno == EINVAL) {
- lp_errno = LP_EBADSDN;
- goto BadFile;
- }
- formp->pwid = sdn;
- break;
-
- case FO_CPI:
- sdn = getcpi(p);
- if (errno == EINVAL) {
- lp_errno = LP_EBADSDN;
- goto BadFile;
- }
- formp->cpi = sdn;
- break;
-
- case FO_LPI:
- sdn = getsdn(p);
- if (errno == EINVAL) {
- lp_errno = LP_EBADSDN;
- goto BadFile;
- }
- formp->lpi = sdn;
- break;
-
- case FO_NP:
- if (
- (i = strtol(p, &rest, 10)) <= 0
- || *rest
- ) {
- lp_errno = LP_EBADINT;
- goto BadFile;
- }
- formp->np = i;
- break;
-
- case FO_CHSET:
- if (!(mandp = strchr(p, ',')))
- formp->mandatory = 0;
- else {
- do
- *mandp++ = 0;
- while (*mandp && isspace(*mandp));
- if (CS_STREQU(MANSTR, mandp))
- formp->mandatory = 1;
- else {
- lp_errno = LP_EBADARG;
- goto BadFile;
- }
- }
- if (!syn_name(p)) {
- lp_errno = LP_EBADNAME;
- goto BadFile;
- }
- if (formp->chset)
- Free (formp->chset);
- formp->chset = Strdup(p);
- break;
-
- case FO_RCOLOR:
- if (formp->rcolor)
- Free (formp->rcolor);
- formp->rcolor = Strdup(p);
- break;
-
- case FO_CMT:
- if (*p) {
- lp_errno = LP_ETRAILIN;
- goto BadFile;
- }
- if (formp->comment)
- Free (formp->comment);
- formp->comment = 0;
- size = 0;
- while (FGETS(buf, BUFSIZ, fd)) {
- p = buf;
-
- /*
- * A recognized header ends the comment.
- */
- if (_search_fheading(p) < FO_MAX) {
- have_line_already = 1;
- break;
- }
-
- /*
- * On the other hand, a '>' may hide what
- * would otherwise look like a header.
- */
- if (
- p[0] == '>'
- && _search_fheading(p+1) < FO_MAX
- )
- p++;
-
- /*
- * (Re)allocate space to hold this
- * (additional) line of the comment.
- */
- add_size = strlen(p);
- if (formp->comment)
- formp->comment = Realloc(
- formp->comment,
- size + add_size + 1
- );
- else
- formp->comment = Malloc(
- size + add_size + 1
- );
- if (!formp->comment) {
- freeform (formp);
- close(fd);
- errno = ENOMEM;
- return (-1);
- }
-
- /*
- * Copy this (additional) line of the
- * comment to the allocated space. "here"
- * points to where to copy the line.
- */
- strcpy (formp->comment + size, p);
- size += add_size;
- }
- if (errno != 0)
- goto BadFile;
-
- /*
- * The comment is held internally without a
- * trailing newline.
- */
- if (size && formp->comment[size - 1] == '\n')
- formp->comment[size - 1] = 0;
-
- break;
-
- case FO_ALIGN:
- if (*p) {
- if (!syn_type(p)) {
- lp_errno = LP_EBADCTYPE;
- goto BadFile;
- }
- if (formp->conttype)
- Free (formp->conttype);
- formp->conttype = Strdup(p);
- }
-
- /*
- * Actual alignment pattern has to be read in
- * by caller; we leave the file pointer ready.
- */
- found_alignment_pattern = 1;
- break;
-
- case FO_PAPER:
- if (!(dftp = strchr(p, ',')))
- formp->isDefault = 0;
- else {
- do
- *dftp++ = 0;
- while (*dftp && isspace(*dftp));
- if (CS_STREQU(DFTSTR, dftp))
- formp->isDefault = 1;
- else {
- lp_errno = LP_EBADARG;
- goto BadFile;
- }
- }
- if (!syn_name(p)) {
- lp_errno = LP_EBADNAME;
- goto BadFile;
- }
- if (formp->paper)
- Free (formp->paper);
- formp->paper = Strdup(p);
- break;
- }
-
- }
- if (errno != 0) {
- int save_errno = errno;
-
- freeform (formp);
- errno = save_errno;
- return (-1);
- }
-
- /*
- * Get the form description (if it exists) (?)
- */
- if (!error_handler) {
-
- char * path;
-
-
- if (!(path = getformfile(name, COMMENTFILE))) {
- freeform (formp);
- errno = ENOMEM;
- return (-1);
- }
- if (
- !(formp->comment = loadstring(path))
- && errno != ENOENT
- ) {
- Free (path);
- freeform (formp);
- return (-1);
- }
- Free (path);
- }
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/forms/wrform.c b/usr/src/cmd/lp/lib/forms/wrform.c
deleted file mode 100644
index a3a21a92cc..0000000000
--- a/usr/src/cmd/lp/lib/forms/wrform.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "form.h"
-
-extern struct {
- char *v;
- short len;
- short infile;
-} formheadings[];
-
-int _search_fheading ( char * );
-
-static void print_sdn(int, char *, SCALED);
-static void print_str(int, char *, char *);
-
-/**
- ** wrform()
- **/
-
-int
-wrform(char *name, FORM *formp, int fd, int (*error_handler)( int , int , int ),
- int *which_set)
-{
- int fld;
-
- char * cp;
-
-
- errno = 0;
- for (fld = 0; fld < FO_MAX; fld++)
- if ((!which_set || which_set[fld]) &&
- (formheadings[fld].infile || error_handler))
- switch (fld) {
-
-#define HEAD formheadings[fld].v
-
- case FO_PLEN:
- print_sdn(fd, HEAD, formp->plen);
- break;
-
- case FO_PWID:
- print_sdn(fd, HEAD, formp->pwid);
- break;
-
- case FO_LPI:
- print_sdn(fd, HEAD, formp->lpi);
- break;
-
- case FO_CPI:
- if (formp->cpi.val == N_COMPRESSED)
- print_str(fd, HEAD, NAME_COMPRESSED);
- else
- print_sdn(fd, HEAD, formp->cpi);
- break;
-
- case FO_NP:
- fdprintf(fd, "%s %d\n", HEAD, formp->np);
- break;
-
- case FO_CHSET:
- fdprintf(fd, "%s %s", HEAD, formp->chset);
- if (formp->mandatory == 1)
- fdprintf(fd, ",%s", MANSTR);
- fdprintf(fd, "\n");
- break;
-
- case FO_RCOLOR:
- print_str(fd, HEAD, formp->rcolor);
- break;
-
- case FO_CMT:
- if ((cp = formp->comment) && *cp) {
- fdprintf(fd, "%s\n", HEAD);
- do {
- char * nl = strchr(cp, '\n');
-
- if (nl)
- *nl = 0;
- if (_search_fheading(cp) < FO_MAX)
- fdputc ('>', fd);
- fdprintf(fd, "%s\n", cp);
- if (nl)
- *nl = '\n';
- cp = nl;
- } while (cp++); /* NOT *cp++ */
- }
- break;
-
- case FO_ALIGN:
- /* this must always be the last field in the file
- it is done outside of this loop */
- break;
-
- case FO_PAPER:
- if (formp->paper) {
- fdprintf(fd, "%s %s", HEAD, formp->paper);
- if (formp->isDefault == 1)
- fdprintf(fd, ",%s", DFTSTR);
- fdprintf(fd, "\n");
- }
- break;
-
- }
-
- if ((!which_set || which_set[FO_ALIGN]) &&
- (formheadings[FO_ALIGN].infile || error_handler)) {
- print_str(fd, formheadings[FO_ALIGN].v, formp->conttype);
- /*
- * Actual alignment pattern has to be written
- * out by caller; we leave the file pointer ready.
- */
- }
-
- if (errno != 0)
- return (-1);
-
- /*
- * Write out comment to a separate file (?)
- */
- if (!error_handler) {
-
- char * path;
-
-
- if (!(path = getformfile(name, COMMENT)))
- return (-1);
-
- if (formp->comment) {
- if (dumpstring(path, formp->comment) == -1) {
- Free (path);
- return (-1);
- }
-
- } else
- Unlink (path);
-
- Free (path);
-
- }
-
- return (0);
-}
-
-/**
- ** print_sdn() - PRINT SCALED DECIMAL NUMBER WITH HEADER
- ** print_str() - PRINT STRING WITH HEADER
- **/
-
-static void
-print_sdn(int fd, char *head, SCALED sdn)
-{
- if (sdn.val <= 0)
- return;
-
- (void)fdprintf(fd, "%s ", head);
- fdprintsdn(fd, sdn);
-
- return;
-}
-
-static void
-print_str(int fd, char *head, char *str)
-{
- if (!str || !*str)
- return;
-
- (void)fdprintf(fd, "%s %s\n", head, str);
-
- return;
-}
diff --git a/usr/src/cmd/lp/lib/lp/Makefile b/usr/src/cmd/lp/lib/lp/Makefile
deleted file mode 100644
index 7161681ef4..0000000000
--- a/usr/src/cmd/lp/lib/lp/Makefile
+++ /dev/null
@@ -1,106 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-
-
-#
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/lib/lp/Makefile
-#
-
-LIBRARY = liblp.a
-
-OBJECTS = Syscalls.o \
- Sys_malloc.o \
- addlist.o \
- addstring.o \
- appendlist.o \
- alerts.o \
- charset.o \
- cs_strcmp.o \
- cs_strncmp.o \
- dellist.o \
- dashos.o \
- dirs.o \
- duplist.o \
- files.o \
- freelist.o \
- getlist.o \
- getname.o \
- getpaths.o \
- getspooldir.o \
- isterminfo.o \
- joinlist.o \
- lenlist.o \
- lp_errno.o \
- makepath.o \
- makestr.o \
- mergelist.o \
- next.o \
- printlist.o \
- sdn.o \
- sprintlist.o \
- searchlist.o \
- set_charset.o \
- set_pitch.o \
- set_size.o \
- sop.o \
- strip.o \
- syntax.o \
- tidbit.o \
- tx.o \
- wherelist.o \
- which.o
-
-
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CPPFLAGS = -I../../include $(CPPFLAGS.master) $(C_PICFLAGS)
-
-POFILE = lp_lib_lp.po
-
-.KEEP_STATE:
-
-all install : $(LIBS)
-
-include ../../../../lib/Makefile.targ
-
-CLEANFILES += llib-llp.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-# lint does not take $(C_PICFLAGS)
-LINT_CPPFLAGS = -I../../include $(CPPFLAGS.master)
-
-lint: lintlib
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) $(SRCS)
-
-lintlib:
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) -o lp llib-llp
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/lp/Sys_malloc.c b/usr/src/cmd/lp/lib/lp/Sys_malloc.c
deleted file mode 100644
index 1a6364f0da..0000000000
--- a/usr/src/cmd/lp/lib/lp/Sys_malloc.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.14 */
-/* LINTLIBRARY */
-
-#include "unistd.h"
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "errno.h"
-#include "fcntl.h"
-#include "stdlib.h"
-#include "string.h"
-
-/**
- ** _Malloc()
- ** _Realloc()
- ** _Calloc()
- ** _Strdup()
- ** _Free()
- **/
-
-#if !defined(TRACE_MALLOC)
-
-#if defined(__STDC__)
-void (*lp_alloc_fail_handler)( void ) = 0;
-#else
-void (*lp_alloc_fail_handler)() = 0;
-#endif
-
-#if defined(__STDC__)
-typedef void *alloc_type;
-#else
-typedef char *alloc_type;
-#endif
-
-alloc_type
-#if defined(__STDC__)
-_Malloc (
- size_t size,
- const char * file,
- int line
-)
-#else
-_Malloc (size, file, line)
- size_t size;
- char * file;
- int line;
-#endif
-{
- alloc_type ret = malloc(size);
-
- if (!ret) {
- if (lp_alloc_fail_handler)
- (*lp_alloc_fail_handler)();
- errno = ENOMEM;
- }
- return (ret);
-}
-
-alloc_type
-#if defined(__STDC__)
-_Realloc (
- void * ptr,
- size_t size,
- const char * file,
- int line
-)
-#else
-_Realloc (ptr, size, file, line)
- char * ptr;
- size_t size;
- char * file;
- int line;
-#endif
-{
- alloc_type ret = realloc(ptr, size);
-
- if (!ret) {
- if (lp_alloc_fail_handler)
- (*lp_alloc_fail_handler)();
- errno = ENOMEM;
- }
- return (ret);
-}
-
-alloc_type
-#if defined(__STDC__)
-_Calloc (
- size_t nelem,
- size_t elsize,
- const char * file,
- int line
-)
-#else
-_Calloc (nelem, elsize, file, line)
- size_t nelem;
- size_t elsize;
- char * file;
- int line;
-#endif
-{
- alloc_type ret = calloc(nelem, elsize);
-
- if (!ret) {
- if (lp_alloc_fail_handler)
- (*lp_alloc_fail_handler)();
- errno = ENOMEM;
- }
- return (ret);
-}
-
-char *
-#if defined(__STDC__)
-_Strdup (
- const char * s,
- const char * file,
- int line
-)
-#else
-_Strdup (s, file, line)
- char * s;
- char * file;
- int line;
-#endif
-{
- char * ret;
-
- if (!s)
- return( (char *) 0);
-
- ret = strdup(s);
-
- if (!ret) {
- if (lp_alloc_fail_handler)
- (*lp_alloc_fail_handler)();
- errno = ENOMEM;
- }
- return (ret);
-}
-
-void
-#if defined(__STDC__)
-_Free (
- void * ptr,
- const char * file,
- int line
-)
-#else
-_Free (ptr, file, line)
- char * ptr;
- char * file;
- int line;
-#endif
-{
- free (ptr);
- return;
-}
-
-#else
-# include "mdl.c"
-#endif
diff --git a/usr/src/cmd/lp/lib/lp/Syscalls.c b/usr/src/cmd/lp/lib/lp/Syscalls.c
deleted file mode 100644
index aeb73eb785..0000000000
--- a/usr/src/cmd/lp/lib/lp/Syscalls.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.14 */
-/* LINTLIBRARY */
-
-#include "unistd.h"
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "errno.h"
-#include "fcntl.h"
-#include "stdlib.h"
-#include "string.h"
-
-/**
- ** Auto-restarting system calls:
- **/
-
-int
-#if defined(__STDC__)
-_Access (
- char * s,
- int i
-)
-#else
-_Access (s, i)
- char * s;
- int i;
-#endif
-{
- register int n;
-
- while ((n = access(s, i)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Chdir (
- char * s
-)
-#else
-_Chdir (s)
- char * s;
-#endif
-{
- register int n;
-
- while ((n = chdir(s)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Chmod (
- char * s,
- int i
-)
-#else
-_Chmod (s, i)
- char * s;
- int i;
-#endif
-{
- register int n;
-
- while ((n = chmod(s, i)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Chown (
- char * s,
- int i,
- int j
-)
-#else
-_Chown (s, i, j)
- char * s;
- int i;
- int j;
-#endif
-{
- register int n;
-
- while ((n = chown(s, i, j)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Close (
- int i
-)
-#else
-_Close (i)
- int i;
-#endif
-{
- register int n;
-
- while ((n = close(i)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Creat (
- char * s,
- int i
-)
-#else
-_Creat (s, i)
- char * s;
- int i;
-#endif
-{
- register int n;
-
- while ((n = creat(s, i)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Fcntl (
- int i,
- int j,
- struct flock * k
-)
-#else
-_Fcntl (i, j, k)
- int i;
- int j;
- struct flock * k;
-#endif
-{
- register int n;
-
- while ((n = fcntl(i, j, k)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Fstat (
- int i,
- struct stat * st
-)
-#else
-_Fstat (i, st)
- int i;
- struct stat * st;
-#endif
-{
- register int n;
-
- while ((n = fstat(i, st)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Link (
- char * s1,
- char * s2
-)
-#else
-_Link (s1, s2)
- char * s1;
- char * s2;
-#endif
-{
- register int n;
-
- while ((n = link(s1, s2)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Lstat (
- char * s,
- struct stat * st
-)
-#else
-_Lstat (s, st)
- char * s;
- struct stat * st;
-#endif
-{
- register int n;
-
- while ((n = lstat(s, st)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Mknod (
- char * s,
- int i,
- int j
-)
-#else
-_Mknod (s, i, j)
- char * s;
- int i;
- int j;
-#endif
-{
- register int n;
-
- while ((n = mknod(s, i, j)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Open (
- char * s,
- int i,
- int j
-)
-#else
-_Open (s, i, j)
- char * s;
- int i;
- int j;
-#endif
-{
- register int n;
-
- while ((n = open(s, i, j)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Read (
- int i,
- char * s,
- unsigned int j
-)
-#else
-_Read (i, s, j)
- int i;
- char * s;
- unsigned int j;
-#endif
-{
- register int n;
-
- while ((n = read(i, s, j)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Readlink (
- char * s1,
- char * s2,
- unsigned int j
-)
-#else
-_Readlink (s1, s2, j)
- char * s1;
- char * s2;
- unsigned int j;
-#endif
-{
- register int n;
-
- while ((n = readlink(s1, s2, j)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Rename (
- char * s1,
- char * s2
-)
-#else
-_Rename (s1, s2)
- char * s1;
- char * s2;
-#endif
-{
- register int n;
-
- while ((n = rename(s1, s2)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Stat (
- char * s,
- struct stat * st
-)
-#else
-_Stat (s, st)
- char * s;
- struct stat * st;
-#endif
-{
- register int n;
-
- while ((n = stat(s, st)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Symlink (
- char * s1,
- char * s2
-)
-#else
-_Symlink (s1, s2)
- char * s1;
- char * s2;
-#endif
-{
- register int n;
-
- while ((n = symlink(s1, s2)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Unlink (
- char * s
-)
-#else
-_Unlink (s)
- char * s;
-#endif
-{
- register int n;
-
- while ((n = unlink(s)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Wait (
- int * i
-)
-#else
-_Wait (i)
- int * i;
-#endif
-{
- register int n;
-
- while ((n = wait(i)) == -1 && errno == EINTR)
- ;
- return (n);
-}
-
-int
-#if defined(__STDC__)
-_Write (
- int i,
- char * s,
- unsigned int j
-)
-#else
-_Write (i, s, j)
- int i;
- char * s;
- unsigned int j;
-#endif
-{
- register int n;
-
- while ((n = write(i, s, j)) == -1 && errno == EINTR)
- ;
- return (n);
-}
diff --git a/usr/src/cmd/lp/lib/lp/addlist.c b/usr/src/cmd/lp/lib/lp/addlist.c
deleted file mode 100644
index 0608b5f914..0000000000
--- a/usr/src/cmd/lp/lib/lp/addlist.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** addlist() - ADD ITEM TO (char **) LIST
- **/
-
-int
-#if defined(__STDC__)
-addlist (
- char *** plist,
- char * item
-)
-#else
-addlist (plist, item)
- register char ***plist,
- *item;
-#endif
-{
- register char **pl;
-
- register int n;
-
- if (*plist) {
-
- n = lenlist(*plist);
-
- for (pl = *plist; *pl; pl++)
- if (STREQU(*pl, item))
- break;
-
- if (!*pl) {
-
- n++;
- *plist = (char **)Realloc(
- (char *)*plist,
- (n + 1) * sizeof(char *)
- );
- if (!*plist) {
- errno = ENOMEM;
- return (-1);
- }
- (*plist)[n - 1] = Strdup(item);
- (*plist)[n] = 0;
-
- }
-
- } else {
-
- *plist = (char **)Malloc(2 * sizeof(char *));
- if (!*plist) {
- errno = ENOMEM;
- return (-1);
- }
- (*plist)[0] = Strdup(item);
- (*plist)[1] = 0;
-
- }
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/addstring.c b/usr/src/cmd/lp/lib/lp/addstring.c
deleted file mode 100644
index ee2900435a..0000000000
--- a/usr/src/cmd/lp/lib/lp/addstring.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** addstring() - ADD ONE STRING TO ANOTHER, ALLOCATING SPACE AS NEEDED
- **/
-
-int
-#if defined(__STDC__)
-addstring (
- char ** dst,
- char * src
-)
-#else
-addstring (dst, src)
- char **dst;
- char *src;
-#endif
-{
- size_t len;
-
- if (!dst || !src) {
- errno = EINVAL;
- return (-1);
- }
-
- len = strlen(src) + 1;
-
- if (*dst) {
- if (!(*dst = Realloc(*dst, strlen(*dst) + len))) {
- errno = ENOMEM;
- return (-1);
- }
- } else {
- if (!(*dst = Malloc(len))) {
- errno = ENOMEM;
- return (-1);
- }
- (*dst)[0] = '\0';
- }
-
- (void) strcat(*dst, src);
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/alerts.c b/usr/src/cmd/lp/lib/lp/alerts.c
deleted file mode 100644
index 34c8ac1160..0000000000
--- a/usr/src/cmd/lp/lib/lp/alerts.c
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.17 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "limits.h"
-#include "unistd.h"
-
-#include "lp.h"
-
-extern char **environ;
-
-static void envlist(int, char **);
-
-/*
- * We recognize the following key phrases in the alert prototype
- * file, and replace them with appropriate values.
- */
-#define NALRT_KEYS 7
-# define ALRT_ENV 0
-# define ALRT_PWD 1
-# define ALRT_ULIMIT 2
-# define ALRT_UMASK 3
-# define ALRT_INTERVAL 4
-# define ALRT_CMD 5
-# define ALRT_USER 6
-
-static struct {
- char *v;
- short len;
-} shell_keys[NALRT_KEYS] = {
-#define ENTRY(X) X, sizeof(X)-1
- ENTRY("-ENVIRONMENT-"),
- ENTRY("-PWD-"),
- ENTRY("-ULIMIT-"),
- ENTRY("-UMASK-"),
- ENTRY("-INTERVAL-"),
- ENTRY("-CMD-"),
- ENTRY("-USER-"),
-};
-
-/*
- * These are used to bracket the administrator's command, so that
- * we can find it easily. We're out of luck if the administrator
- * includes an identical phrase in his or her command.
- */
-#define ALRT_CMDSTART "## YOUR COMMAND STARTS HERE -- DON'T TOUCH ABOVE!!"
-#define ALRT_CMDEND "## YOUR COMMAND ENDS HERE -- DON'T TOUCH BELOW!!"
-
-/**
- ** putalert() - WRITE ALERT TO FILES
- **/
-
-int
-putalert(char *parent, char *name, FALERT *alertp)
-{
- char *path,
- cur_dir[PATH_MAX + 1],
- buf[BUFSIZ];
-
- int cur_umask;
-
- int fdout, fdin;
-
-
- if (!parent || !*parent || !name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (!alertp->shcmd) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(alertp->shcmd, NAME_NONE))
- return (delalert(parent, name));
-
- /*
- * See if the form/printer/print-wheel exists.
- */
-
- if (!(path = makepath(parent, name, (char *)0)))
- return (-1);
-
- if (Access(path, F_OK) == -1) {
- if (errno == ENOENT)
- errno = ENOTDIR; /* not quite, but what else? */
- Free (path);
- return (-1);
- }
- Free (path);
-
- /*
- * First, the shell command file.
- */
-
- if (!(path = makepath(parent, name, ALERTSHFILE, (char *)0)))
- return (-1);
-
- if ((fdout = open_locked(path, "w", MODE_NOEXEC)) < 0) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- /*
- * We use a prototype file to build the shell command,
- * so that the alerts are easily customized. The shell
- * is expected to handle repeat alerts and failed alerts,
- * because the Spooler doesn't. Also, the Spooler runs
- * each alert with the UID and GID of the administrator
- * who defined the alert. Otherwise, anything goes.
- */
-
- if (!Lp_Bin) {
- getpaths ();
- if (!Lp_Bin)
- return (-1);
- }
- if (!(path = makepath(Lp_Bin, ALERTPROTOFILE, (char *)0)))
- return (-1);
-
- if ((fdin = open_locked(path, "r", 0)) < 0) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- errno = 0;
- while (fdgets(buf, BUFSIZ, fdin)) {
- int key;
- char *cp,
- *dash;
-
- cp = buf;
- while ((dash = strchr(cp, '-'))) {
-
- *dash = 0;
- fdputs (cp, fdout);
- *(cp = dash) = '-';
-
- for (key = 0; key < NALRT_KEYS; key++)
- if (STRNEQU(
- cp,
- shell_keys[key].v,
- shell_keys[key].len
- )) {
- register char *newline =
- (cp != buf)? "\n" : "";
-
- cp += shell_keys[key].len;
-
- switch (key) {
-
- case ALRT_ENV:
- fdprintf(fdout, newline);
- envlist(fdout, environ);
- break;
-
- case ALRT_PWD:
- getcwd (cur_dir, PATH_MAX);
- fdprintf (fdout, "%s", cur_dir);
- break;
-
- case ALRT_ULIMIT:
- fdprintf (fdout, "%ld", ulimit(1, (long)0));
- break;
-
- case ALRT_UMASK:
- umask (cur_umask = umask(0));
- fdprintf (fdout, "%03o", cur_umask);
- break;
-
- case ALRT_INTERVAL:
- fdprintf(fdout, "%ld", (long)alertp->W);
- break;
-
- case ALRT_CMD:
- fdprintf(fdout, newline);
- fdprintf(fdout, "%s\n", ALRT_CMDSTART);
- fdprintf(fdout, "%s\n", alertp->shcmd);
- fdprintf(fdout, "%s\n", ALRT_CMDEND);
- break;
-
- case ALRT_USER:
- fdprintf(fdout, "%s", getname());
- break;
-
- }
-
- break;
- }
- if (key >= NALRT_KEYS)
- fdputc(*cp++, fdout);
-
- }
- fdputs(cp, fdout);
-
- }
- if (errno != 0) {
- int save_errno = errno;
-
- close(fdin);
- close(fdout);
- errno = save_errno;
- return (-1);
- }
- close(fdin);
- close(fdout);
-
- /*
- * Next, the variables file.
- */
-
- if (!(path = makepath(parent, name, ALERTVARSFILE, (char *)0)))
- return (-1);
-
- if ((fdout = open_locked(path, "w", MODE_NOREAD)) < 0) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- fdprintf(fdout, "%d\n", alertp->Q > 0? alertp->Q : 1);
- fdprintf(fdout, "%d\n", alertp->W >= 0? alertp->W : 0);
-
- close(fdout);
-
- return (0);
-}
-
-/**
- ** getalert() - EXTRACT ALERT FROM FILES
- **/
-
-FALERT *
-getalert(char *parent, char *name)
-{
- int fd;
- char *tmp;
- static FALERT alert;
- register char *path;
- char buf[BUFSIZ];
- int len;
-
- if (!parent || !*parent || !name || !*name) {
- errno = EINVAL;
- return (0);
- }
-
- /*
- * See if the form/printer/print-wheel exists.
- */
-
- if (!(path = makepath(parent, name, (char *)0)))
- return (0);
-
- if (Access(path, F_OK) == -1) {
- if (errno == ENOENT)
- errno = ENOTDIR; /* not quite, but what else? */
- Free (path);
- return (0);
- }
- Free (path);
-
- /*
- * First, the shell command file.
- */
-
- if (!(path = makepath(parent, name, ALERTSHFILE, (char *)0)))
- return (0);
-
- if ((fd = open_locked(path, "r", 0)) < 0) {
- Free (path);
- return (0);
- }
- Free (path);
-
- /*
- * Skip over environment setting stuff, while loop, etc.,
- * to find the beginning of the command.
- */
- errno = 0;
- while ((tmp = fdgets(buf, BUFSIZ, fd)) &&
- !STRNEQU(buf, ALRT_CMDSTART, sizeof(ALRT_CMDSTART)-1))
- ;
- if ((tmp == NULL) || (errno != 0)) {
- int save_errno = errno;
-
- close(fd);
- errno = save_errno;
- return (0);
- }
-
- alert.shcmd = sop_up_rest(fd, ALRT_CMDEND);
-
- close(fd);
-
- if (!alert.shcmd)
- return (0);
-
- /*
- * Drop terminating newline.
- */
- if (alert.shcmd[(len = strlen(alert.shcmd)) - 1] == '\n')
- alert.shcmd[len - 1] = 0;
-
-
- /*
- * Next, the variables file.
- */
-
- if (!(path = makepath(parent, name, ALERTVARSFILE, (char *)0)))
- return (0);
-
- if ((fd = open_locked(path, "r", 0)) < 0) {
- Free (path);
- return (0);
- }
- Free (path);
-
- errno = 0;
- (void)fdgets (buf, BUFSIZ, fd);
- if (errno != 0) {
- int save_errno = errno;
-
- close(fd);
- errno = save_errno;
- return (0);
- }
- alert.Q = atoi(buf);
-
- (void)fdgets (buf, BUFSIZ, fd);
- if (errno != 0) {
- int save_errno = errno;
-
- close(fd);
- errno = save_errno;
- return (0);
- }
- alert.W = atoi(buf);
-
- close(fd);
-
- return (&alert);
-}
-
-/**
- ** delalert() - DELETE ALERT FILES
- **/
-
-int
-delalert(char *parent, char *name)
-{
- char *path;
-
-
- if (!parent || !*parent || !name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- /*
- * See if the form/printer/print-wheel exists.
- */
-
- if (!(path = makepath(parent, name, (char *)0)))
- return (-1);
-
- if (Access(path, F_OK) == -1) {
- if (errno == ENOENT)
- errno = ENOTDIR; /* not quite, but what else? */
- Free (path);
- return (-1);
- }
- Free (path);
-
- /*
- * Remove the two files.
- */
-
- if (!(path = makepath(parent, name, ALERTSHFILE, (char *)0)))
- return (-1);
- if (rmfile(path) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- if (!(path = makepath(parent, name, ALERTVARSFILE, (char *)0)))
- return (-1);
- if (rmfile(path) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- return (0);
-}
-
-/**
- ** envlist() - PRINT OUT ENVIRONMENT LIST SAFELY
- **/
-
-static void
-envlist(int fd, char **list)
-{
- register char *env,
- *value;
-
- if (!list || !*list)
- return;
-
- while ((env = *list++)) {
- if (!(value = strchr(env, '=')))
- continue;
- *value++ = 0;
- if (!strchr(value, '\''))
- fdprintf(fd, (char *)gettext("export %s; %s='%s'\n"),
- env, env, value);
- *--value = '=';
- }
-}
-
-/*
- * printalert() - PRINT ALERT DESCRIPTION
- *
- * This is not used in the scheduler, so we don't need to switch to using
- * file descriptors for scalability.
- */
-
-void
-printalert(FILE *fp, FALERT *alertp, int isfault)
-{
- if (!alertp->shcmd) {
- if (isfault)
- (void)fprintf (fp, (char *)gettext("On fault: no alert\n"));
- else
- (void)fprintf (fp, (char *)gettext("No alert\n"));
-
- } else {
- register char *copy = Strdup(alertp->shcmd),
- *cp;
-
- if (isfault)
- (void)fprintf (fp, (char *)gettext("On fault: "));
- else
- if (alertp->Q > 1)
- (void)fprintf (
- fp,
- (char *)gettext("When %d are queued: "),
- alertp->Q
- );
- else
- (void)fprintf (fp, (char *)gettext("Upon any being queued: "));
-
- if (copy && (cp = strchr(copy, ' ')))
- while (*cp == ' ')
- *cp++ = 0;
-
- if (
- copy
- && syn_name(cp)
- && (
- STREQU(copy, NAME_WRITE)
- || STREQU(copy, NAME_MAIL)
- )
- )
- (void)fprintf (fp, "%s to %s ", copy, cp);
- else
- (void)fprintf (fp, (char *)gettext("alert with \"%s\" "), alertp->shcmd);
-
- if (alertp->W > 0)
- (void)fprintf (fp, (char *)gettext("every %d minutes\n"), alertp->W);
- else
- (void)fprintf (fp, (char *)gettext("once\n"));
-
- Free (copy);
- }
- return;
-}
diff --git a/usr/src/cmd/lp/lib/lp/appendlist.c b/usr/src/cmd/lp/lib/lp/appendlist.c
deleted file mode 100644
index 3c936ad70a..0000000000
--- a/usr/src/cmd/lp/lib/lp/appendlist.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** appendlist() - ADD ITEM TO (char **) LIST
- **/
-
-int
-#if defined(__STDC__)
-appendlist (
- char *** plist,
- char * item
-)
-#else
-appendlist (plist, item)
- register char ***plist,
- *item;
-#endif
-{
- register int n;
-
- if (*plist) {
-
- n = lenlist(*plist);
-
- n++;
- *plist = (char **)Realloc(
- (char *)*plist,
- (n + 1) * sizeof(char *)
- );
- if (!*plist) {
- errno = ENOMEM;
- return (-1);
- }
- (*plist)[n - 1] = Strdup(item);
- (*plist)[n] = 0;
-
- } else {
-
- *plist = (char **)Malloc(2 * sizeof(char *));
- if (!*plist) {
- errno = ENOMEM;
- return (-1);
- }
- (*plist)[0] = Strdup(item);
- (*plist)[1] = 0;
-
- }
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/charset.c b/usr/src/cmd/lp/lib/lp/charset.c
deleted file mode 100644
index 60633ce1cb..0000000000
--- a/usr/src/cmd/lp/lib/lp/charset.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-
-#include "lp.h"
-
-/**
- ** search_cslist() - SEARCH CHARACTER SET ALIASES FOR CHARACTER SET
- **/
-
-char *
-#if defined(__STDC__)
-search_cslist (
- char * item,
- char ** list
-)
-#else
-search_cslist (item, list)
- register char *item;
- register char **list;
-#endif
-{
- register char *alias;
-
-
- if (!list || !*list)
- return (0);
-
- else if (STREQU(item, NAME_ANY))
- return (item);
-
- /*
- * This is a linear search--we believe that the lists
- * will be short.
- */
- while (*list) {
- alias = strchr(*list, '=');
- if (alias && STREQU(alias+1, item))
- return (*list);
- list++;
- }
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/cs_strcmp.c b/usr/src/cmd/lp/lib/lp/cs_strcmp.c
deleted file mode 100644
index 842859b8b3..0000000000
--- a/usr/src/cmd/lp/lib/lp/cs_strcmp.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "ctype.h"
-
-/*
- * Compare strings ignoring case: s1>s2: >0 s1==s2: 0 s1<s2: <0
- */
-
-int
-#if defined(__STDC__)
-cs_strcmp(
- char * s1,
- char * s2
-)
-#else
-cs_strcmp(s1, s2)
-register char *s1, *s2;
-#endif
-{
-
- if(s1 == s2)
- return(0);
- while(toupper(*s1) == toupper(*s2++))
- if(*s1++ == '\0')
- return(0);
- return(toupper(*s1) - toupper(*--s2));
-}
diff --git a/usr/src/cmd/lp/lib/lp/cs_strncmp.c b/usr/src/cmd/lp/lib/lp/cs_strncmp.c
deleted file mode 100644
index 516e402a7c..0000000000
--- a/usr/src/cmd/lp/lib/lp/cs_strncmp.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "ctype.h"
-
-/*
- * Compare strings (at most n bytes) ignoring case
- * returns: s1>s2; >0 s1==s2; 0 s1<s2; <0
- */
-
-int
-#if defined(__STDC__)
-cs_strncmp(
- char * s1,
- char * s2,
- int n
-)
-#else
-cs_strncmp(s1, s2, n)
-register char *s1, *s2;
-register n;
-#endif
-{
- if(s1 == s2)
- return(0);
- while(--n >= 0 && toupper(*s1) == toupper(*s2++))
- if(*s1++ == '\0')
- return(0);
- return((n < 0)? 0: (toupper(*s1) - toupper(*--s2)));
-}
diff --git a/usr/src/cmd/lp/lib/lp/dashos.c b/usr/src/cmd/lp/lib/lp/dashos.c
deleted file mode 100644
index 482d7e0395..0000000000
--- a/usr/src/cmd/lp/lib/lp/dashos.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-
-#include "lp.h"
-
-#define issep(X) strchr(LP_WS, X)
-
-/**
- ** dashos() - PARSE -o OPTIONS, (char *) --> (char **)
- **/
-
-char **
-#if defined(__STDC__)
-dashos (
- char * o
-)
-#else
-dashos (o)
- register char *o;
-#endif
-{
- register char quote,
- c,
- *option;
-
- char **list = 0;
-
- if (!o)
- return(0);
-
- while (*o) {
-
- while (*o && issep(*o))
- o++;
-
- for (option = o; *o && !issep(*o); o++)
- if (strchr(LP_QUOTES, (quote = *o)))
- for (o++; *o && *o != quote; o++)
- if (*o == '\\' && o[1])
- o++;
-
- if (option < o) {
- c = *o;
- *o = 0;
- addlist (&list, option);
- *o = c;
- }
-
- }
- return (list);
-}
diff --git a/usr/src/cmd/lp/lib/lp/dellist.c b/usr/src/cmd/lp/lib/lp/dellist.c
deleted file mode 100644
index 6840cdc8e6..0000000000
--- a/usr/src/cmd/lp/lib/lp/dellist.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** dellist() - REMOVE ITEM FROM (char **) LIST
- **/
-
-int
-#if defined(__STDC__)
-dellist (
- char *** plist,
- char * item
-)
-#else
-dellist (plist, item)
- register char ***plist,
- *item;
-#endif
-{
- register char **pl;
-
- register int n;
-
- if (*plist) {
-
- n = lenlist(*plist);
-
- for (pl = *plist; *pl; pl++)
- if (STREQU(*pl, item))
- break;
-
- if (*pl) {
- Free (*pl);
- for (; *pl; pl++)
- *pl = *(pl+1);
- if (--n == 0) {
- Free ((char *)*plist);
- *plist = 0;
- } else {
- *plist = (char **)Realloc(
- (char *)*plist,
- (n + 1) * sizeof(char *)
- );
- if (!*plist) {
- errno = ENOMEM;
- return (-1);
- }
-/* (*plist)[n] = 0; */ /* done in "for" loop */
- }
- }
-
- }
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/dirs.c b/usr/src/cmd/lp/lib/lp/dirs.c
deleted file mode 100644
index 16e7efb6a1..0000000000
--- a/usr/src/cmd/lp/lib/lp/dirs.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "errno.h"
-
-#include "lp.h"
-
-/**
- ** mkdir_lpdir()
- **/
-
-int
-#if defined(__STDC__)
-mkdir_lpdir (
- char * path,
- int mode
-)
-#else
-mkdir_lpdir (path, mode)
- char *path;
- int mode;
-#endif
-{
- int old_umask = umask(0);
- int ret;
- int save_errno;
-
-
- ret = Mkdir(path, mode);
- if (ret != -1)
- ret = chown_lppath(path);
- save_errno = errno;
- if (old_umask)
- umask (old_umask);
- errno = save_errno;
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/lp/duplist.c b/usr/src/cmd/lp/lib/lp/duplist.c
deleted file mode 100644
index b2419fd731..0000000000
--- a/usr/src/cmd/lp/lib/lp/duplist.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** duplist() - DUPLICATE A LIST OF STRINGS
- **/
-
-char **
-#if defined(__STDC__)
-duplist (
- char ** src
-)
-#else
-duplist (src)
- register char **src;
-#endif
-{
- register char **dst;
-
- register int nitems,
- n;
-
- if (!src || !*src)
- return (0);
-
- nitems = lenlist(src);
- if (!(dst = (char **)Malloc((nitems + 1) * sizeof(char *)))) {
- errno = ENOMEM;
- return (0);
- }
-
- for (n = 0; n < nitems; n++)
- if (!(dst[n] = Strdup(src[n]))) {
- while (n--)
- Free (dst[n]);
- Free ((char *)dst);
- errno = ENOMEM;
- return (0);
- }
- dst[nitems] = 0;
-
- return (dst);
-}
-
diff --git a/usr/src/cmd/lp/lib/lp/files.c b/usr/src/cmd/lp/lib/lp/files.c
deleted file mode 100644
index d85484f547..0000000000
--- a/usr/src/cmd/lp/lib/lp/files.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "fcntl.h"
-#include "string.h"
-#include "errno.h"
-#include "pwd.h"
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "stdlib.h"
-#include <stdarg.h>
-#include <unistd.h>
-#include "pwd.h"
-
-#include "lp.h"
-
-int
-is_printer_uri(char *value)
-{
- if (value == NULL)
- return (-1);
-
- if ((value[0] == '/') && (access(value, F_OK) == 0))
- return (-1); /* a valid path */
-
- if (strstr(value, "://") == NULL)
- return (-1); /* not in uri form */
-
- return (0);
-}
-
-/*
- * To avoid a race condition, chown() should always be called before
- * chmod().
- */
-int
-chownmod(char *path, uid_t owner, gid_t group, mode_t mode)
-{
- int rc;
-
- if ((rc = Chown(path, owner, group)) == 0)
- rc = Chmod(path, mode);
-
- return (rc);
-}
-
-
-int
-fdprintf(int fd, char *fmt, ...)
-{
- char buf[BUFSIZ];
- va_list ap;
-
- if (fd == 1)
- fflush(stdout);
- va_start(ap, fmt);
- vsnprintf(buf, sizeof (buf), fmt, ap);
- va_end(ap);
- return (Write(fd, buf, (int)strlen(buf)));
-}
-
-char *
-fdgets(char *buf, int len, int fd)
-{
- char tmp;
- int count = 0;
-
- memset(buf, NULL, len);
- while ((count < len) && (Read(fd, &tmp, 1) > 0))
- if ((buf[count++] = tmp) == '\n') break;
-
- if (count != 0)
- return (buf);
- return (NULL);
-}
-
-int
-fdputs(char *buf, int fd)
-{
- return (fdprintf(fd, "%s", buf));
-}
-
-int
-fdputc(char c, int fd)
-{
- if (fd == 1)
- fflush(stdout);
- return (write(fd, &c, 1));
-}
-
-int
-open_locked(char *path, char *type, mode_t mode)
-{
- struct flock l;
- int fd,
- oflag,
- create,
- truncate = 0;
-
- if (!path || !type) {
- errno = EINVAL;
- return (-1);
- }
-
-#define plus (type[1] == '+')
- switch (type[0]) {
- case 'w':
- oflag = plus? O_RDWR : O_WRONLY;
- create = 1;
- truncate = 1;
- break;
- case 'a':
- oflag = (plus? O_RDWR : O_WRONLY) | O_APPEND;
- create = 1;
- break;
- case 'r':
- oflag = plus? O_RDWR : O_RDONLY;
- create = 0;
- break;
- default:
- errno = EINVAL;
- return (-1);
- }
- if ((fd = Open(path, oflag, mode)) == -1)
- if (errno == ENOENT && create) {
- int old_umask = umask(0);
- int save_errno;
-
- if ((fd = Open(path, oflag|O_CREAT, mode)) != -1)
- chown_lppath(path);
- save_errno = errno;
- if (old_umask)
- umask(old_umask);
- errno = save_errno;
- }
-
- if (fd == -1)
- switch (errno) {
- case ENOTDIR:
- errno = EACCES;
- /* FALLTHROUGH */
- default:
- return (-1);
- }
-
- l.l_type = (oflag & (O_WRONLY|O_RDWR)? F_WRLCK : F_RDLCK);
- l.l_whence = 1;
- l.l_start = 0;
- l.l_len = 0;
- if (Fcntl(fd, F_SETLK, &l) == -1) {
- /*
- * Early UNIX op. sys. have wrong errno.
- */
- if (errno == EACCES)
- errno = EAGAIN;
- Close(fd);
- return (-1);
- }
-
- if (truncate) {
- if ((lseek(fd, 0, SEEK_SET) == (off_t)-1) ||
- (ftruncate(fd, 0) == -1)) {
- Close(fd);
- return (-1);
- }
- }
-
- return (fd);
-}
-
-
-FILE *
-open_lpfile(char *path, char *type, mode_t mode)
-{
- FILE *fp = NULL;
- int fd;
-
- if ((fd = open_locked(path, type, mode)) >= 0) {
- errno = 0; /* fdopen() may fail and not set errno */
- if (!(fp = fdopen(fd, type))) {
- Close(fd);
- }
- }
- return (fp);
-}
-int
-close_lpfile(FILE *fp)
-{
- return (fclose(fp));
-}
-
-/*
- * chown_lppath()
- */
-
-int
-chown_lppath(char *path)
-{
- static uid_t lp_uid;
-
- static gid_t lp_gid;
-
- static int gotids = 0;
-
- struct passwd *ppw;
-
-
- if (!gotids) {
- if (!(ppw = getpwnam(LPUSER)))
- ppw = getpwnam(ROOTUSER);
- endpwent();
- if (!ppw)
- return (-1);
- lp_uid = ppw->pw_uid;
- lp_gid = ppw->pw_gid;
- gotids = 1;
- }
- return (Chown(path, lp_uid, lp_gid));
-}
-
-/*
- * rmfile() - UNLINK FILE BUT NO COMPLAINT IF NOT THERE
- */
-
-int
-rmfile(char *path)
-{
- return (Unlink(path) == 0 || errno == ENOENT);
-}
-
-/*
- * loadline() - LOAD A ONE-LINE CHARACTER STRING FROM FILE
- */
-
-char *
-loadline(char *path)
-{
- int fd;
- register char *ret;
- register int len;
- char buf[BUFSIZ];
-
- if ((fd = open_locked(path, "r", MODE_READ)) < 0)
- return (0);
-
- if (fdgets(buf, BUFSIZ, fd)) {
- if ((len = strlen(buf)) && buf[len - 1] == '\n')
- buf[--len] = 0;
- if ((ret = Malloc(len + 1)))
- strcpy(ret, buf);
- } else {
- errno = 0;
- ret = 0;
- }
-
- close(fd);
- return (ret);
-}
-
-/*
- * loadstring() - LOAD A CHARACTER STRING FROM FILE
- */
-
-char *
-loadstring(char *path)
-{
- int fd;
- register char *ret;
- register int len;
-
- if ((fd = open_locked(path, "r", MODE_READ)) < 0)
- return (0);
-
- if ((ret = sop_up_rest(fd, (char *)0))) {
- if ((len = strlen(ret)) && ret[len - 1] == '\n')
- ret[len - 1] = 0;
- } else
- errno = 0;
-
- close(fd);
- return (ret);
-}
-
-/*
- * dumpstring() - DUMP CHARACTER STRING TO FILE
- */
-
-int
-dumpstring(char *path, char *str)
-{
- int fd;
-
- if (!str)
- return (rmfile(path));
-
- if ((fd = open_locked(path, "w", MODE_READ)) < 0)
- return (-1);
- fdprintf(fd, "%s\n", str);
- close(fd);
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/freelist.c b/usr/src/cmd/lp/lib/lp/freelist.c
deleted file mode 100644
index e8d4d6a803..0000000000
--- a/usr/src/cmd/lp/lib/lp/freelist.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** freelist() - FREE ALL SPACE USED BY LIST
- **/
-
-void
-#if defined(__STDC__)
-freelist (
- char ** list
-)
-#else
-freelist (list)
- char **list;
-#endif
-{
- register char **pp;
-
- if (list) {
- for (pp = list; *pp; pp++)
- Free (*pp);
- Free ((char *)list);
- }
- return;
-}
diff --git a/usr/src/cmd/lp/lib/lp/getlist.c b/usr/src/cmd/lp/lib/lp/getlist.c
deleted file mode 100644
index f64e7a4a1d..0000000000
--- a/usr/src/cmd/lp/lib/lp/getlist.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.13 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-#if defined(__STDC__)
-static char *unq_strdup ( char * , char * );
-#else
-static char *unq_strdup();
-#endif
-
-/**
- ** getlist() - CONSTRUCT LIST FROM STRING
- **/
-
-/*
- * Any number of characters from "ws", or a single
- * character from "hardsep", can separate items in the list.
- */
-
-char **
-#if defined(__STDC__)
-getlist (
- char * str,
- char * ws,
- char * hardsep
-)
-#else
-getlist (str, ws, hardsep)
- register char *str,
- *ws;
- char *hardsep;
-#endif
-{
- register char **list,
- *p,
- *sep,
- c;
-
- int n,
- len;
-
- char buf[10];
-
-
- if (!str || !*str)
- return (0);
-
- /*
- * Construct in "sep" the full list of characters that
- * can separate items in the list. Avoid a "malloc()"
- * if possible.
- */
- len = strlen(ws) + strlen(hardsep) + 1;
- if (len > sizeof(buf)) {
- if (!(sep = Malloc(len))) {
- errno = ENOMEM;
- return (0);
- }
- } else
- sep = buf;
- strcpy (sep, hardsep);
- strcat (sep, ws);
-
- /*
- * Skip leading white-space.
- */
- str += strspn(str, ws);
- if (!*str)
- return (0);
-
- /*
- * Strip trailing white-space.
- */
- p = strchr(str, '\0');
- while (--p != str && strchr(ws, *p))
- ;
- *++p = 0;
-
- /*
- * Pass 1: Count the number of items in the list.
- */
- for (n = 0, p = str; *p; ) {
- if ((c = *p++) == '\\')
- p++;
- else
- if (strchr(sep, c)) {
- n++;
- p += strspn(p, ws);
- if (
- !strchr(hardsep, c)
- && strchr(hardsep, *p)
- ) {
- p++;
- p += strspn(p, ws);
- }
- }
- }
-
- /*
- * Pass 2: Create the list.
- */
-
- /*
- * Pass 1 counted the number of list separaters, so
- * add 2 to the count (includes 1 for terminating null).
- */
- if (!(list = (char **)Malloc((n+2) * sizeof(char *)))) {
- errno = ENOMEM;
- goto Done;
- }
-
- /*
- * This loop will copy all but the last item.
- */
- for (n = 0, p = str; *p; )
- if ((c = *p++) == '\\')
- p++;
- else
- if (strchr(sep, c)) {
-
- p[-1] = 0;
- list[n++] = unq_strdup(str, sep);
- p[-1] = c;
-
- p += strspn(p, ws);
- if (
- !strchr(hardsep, c)
- && strchr(hardsep, *p)
- ) {
- p++;
- p += strspn(p, ws);
- }
- str = p;
-
- }
-
- list[n++] = unq_strdup(str, sep);
-
- list[n] = 0;
-
-Done: if (sep != buf)
- Free (sep);
- return (list);
-}
-
-/**
- ** unq_strdup()
- **/
-
-static char *
-#if defined(__STDC__)
-unq_strdup (
- char * str,
- char * sep
-)
-#else
-unq_strdup (str, sep)
- char *str,
- *sep;
-#endif
-{
- register int len = 0;
-
- register char *p,
- *q,
- *ret;
-
-
- for (p = str; *p; p++)
- if (*p != '\\' || !p[1] || !strchr(sep, p[1]))
- len++;
- if (!(q = ret = Malloc(len + 1)))
- return (0);
- for (p = str; *p; p++)
- if (*p != '\\' || !p[1] || !strchr(sep, p[1]))
- *q++ = *p;
- *q = 0;
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/lp/getname.c b/usr/src/cmd/lp/lib/lp/getname.c
deleted file mode 100644
index ecda8a5b89..0000000000
--- a/usr/src/cmd/lp/lib/lp/getname.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/*
- * getname(name) -- get logname
- *
- * getname tries to find the user's logname from:
- * ${LOGNAME}, if set and if it is telling the truth
- * /etc/passwd, otherwise
- *
- * The logname is returned as the value of the function.
- *
- * Getname returns the user's user id converted to ASCII
- * for unknown lognames.
- *
- */
-
-#include "string.h"
-#include "pwd.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-#include "unistd.h"
-
-#include "lp.h"
-
-char *
-#if defined(__STDC__)
-getname (
- void
-)
-#else
-getname ()
-#endif
-{
- uid_t uid;
- struct passwd *p;
- static char *logname = 0;
- char *l;
-
- if (logname)
- return (logname);
-
- uid = getuid();
-
- setpwent ();
- if (
- !(l = getenv("LOGNAME"))
- || !(p = getpwnam(l))
- || p->pw_uid != uid
- )
- if ((p = getpwuid(uid)))
- l = p->pw_name;
- else
- l = 0;
- endpwent ();
-
- if (l)
- logname = Strdup(l);
- else {
- if (uid > 0) {
- logname = Malloc(10 + 1);
- if (logname)
- sprintf (logname, "%d", uid);
- }
- }
-
- if (!logname)
- {
- errno = ENOMEM;
- }
- else
- {
- errno = 0;
- }
-
- return (logname);
-}
diff --git a/usr/src/cmd/lp/lib/lp/getpaths.c b/usr/src/cmd/lp/lib/lp/getpaths.c
deleted file mode 100644
index f664beaed5..0000000000
--- a/usr/src/cmd/lp/lib/lp/getpaths.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* LINTLIBRARY */
-
-#include "stdlib.h"
-
-#include "lp.h"
-
-char Lp_Spooldir[] = SPOOLDIR;
-char Lp_Admins[] = SPOOLDIR "/admins";
-char Lp_FIFO[] = SPOOLDIR "/fifos/FIFO";
-char Lp_Requests[] = SPOOLDIR "/requests";
-char Lp_Schedlock[] = SPOOLDIR "/SCHEDLOCK";
-char Lp_System[] = SPOOLDIR "/system";
-char Lp_Temp[] = SPOOLDIR "/temp";
-char Lp_Tmp[] = SPOOLDIR "/tmp";
-
-char Lp_Bin[] = LPDIR "/bin";
-char Lp_Model[] = LPDIR "/model";
-char Lp_Slow_Filter[] = LPDIR "/bin/slow.filter";
-
-char Lp_A_Logs[] = LOGDIR;
-char Lp_Logs[] = LOGDIR;
-char Lp_ReqLog[] = LOGDIR "/requests";
-
-char Lp_A[] = ETCDIR;
-char Lp_Users[] = ETCDIR "/users";
-char Lp_A_Classes[] = ETCDIR "/classes";
-char Lp_A_Forms[] = ETCDIR "/forms";
-char Lp_A_Interfaces[] = ETCDIR "/interfaces";
-char Lp_A_Printers[] = ETCDIR "/printers";
-char Lp_A_PrintWheels[] = ETCDIR "/pwheels";
-char Lp_A_Systems[] = ETCDIR "/systems";
-char Lp_A_Filters[] = ETCDIR "/filter.table";
-char Lp_Default[] = ETCDIR "/default";
-char Lp_A_Faults[] = ETCDIR "/alerts";
-
-/*
-** Sorry about these nonfunctional functions. The data is
-** static now. These exist for historical reasons.
-*/
-
-#undef getpaths
-#undef getadminpaths
-
-void getpaths ( void ) { return; }
-void getadminpaths ( char * admin) { return; }
-
-/**
- ** getprinterfile() - BUILD NAME OF PRINTER FILE
- **/
-
-char *
-getprinterfile(char *name, char *component)
-{
- char *path;
-
- if (!name)
- return (0);
-
- path = makepath(Lp_A_Printers, name, component, NULL);
-
- return (path);
-}
-
-/**
- ** getsystemfile() - BUILD NAME OF SYSTEM FILE
- **/
-
-char *
-getsystemfile(char *name, char *component)
-{
- char *path;
-
- if (!name)
- return (0);
-
- path = makepath(Lp_A_Systems, name, component, NULL);
-
- return (path);
-}
-
-/**
- ** getclassfile() - BUILD NAME OF CLASS FILE
- **/
-
-char *
-getclassfile(char *name)
-{
- char *path;
-
- if (!name)
- return (0);
-
- path = makepath(Lp_A_Classes, name, NULL);
-
- return (path);
-}
-
-/**
- ** getfilterfile() - BUILD NAME OF FILTER TABLE FILE
- **/
-
-char *
-getfilterfile(char *table)
-{
- char *path;
-
- if (!table)
- table = FILTERTABLE;
-
- path = makepath(ETCDIR, table, NULL);
-
- return (path);
-}
-
-/**
- ** getformfile() - BUILD NAME OF PRINTER FILE
- **/
-
-char *
-getformfile(char *name, char *component)
-{
- char *path;
-
- if (!name)
- return (0);
-
- path = makepath(Lp_A_Forms, name, component, NULL);
-
- return (path);
-}
diff --git a/usr/src/cmd/lp/lib/lp/getspooldir.c b/usr/src/cmd/lp/lib/lp/getspooldir.c
deleted file mode 100644
index 9b23d9d4a8..0000000000
--- a/usr/src/cmd/lp/lib/lp/getspooldir.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "lp.h"
-
-char *
-#if defined(__STDC__)
-getspooldir (
- void
-)
-#else
-getspooldir ()
-#endif
-{
- return (Lp_Spooldir);
-}
diff --git a/usr/src/cmd/lp/lib/lp/isterminfo.c b/usr/src/cmd/lp/lib/lp/isterminfo.c
deleted file mode 100644
index 9c3ad91699..0000000000
--- a/usr/src/cmd/lp/lib/lp/isterminfo.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include "fcntl.h"
-#include "errno.h"
-#include "string.h"
-#include "unistd.h"
-#include "search.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-#if defined(__STDC__)
-typedef void ** A2;
-typedef int (*A3)(const void *, const void *);
-#else
-typedef char ** A2;
-typedef int (*A3)();
-#endif
-
-/*
- * Define the following if you want to do a stronger check:
- * that a type names a valid entry in the Terminfo database.
- * The stronger check reads the entry and verifies the magic
- * number in the header. The weaker check is to see if we
- * have read access to the file. The weaker check will be a
- * tad faster.
- */
-/* #define STRONG_CHECK 1 */ /* */
-
-/*
- * Define the following if you want to cache hits and/or misses.
- * One reason for NOT caching is to guard against crazies who try
- * submitting print requests with goofball types, or every valid type
- * under the sun. Since Terminfo is limited, the hit cache is effectively
- * limited, so it shouldn't be a problem searching the cache (the search
- * is binary) but the cache can become big. The miss cache, on the other
- * hand, could cause a problem. This problem can become severe, so
- * consider limiting the size of the cache (see below).
- * Another reason for NOT caching is to pick up changes in the Terminfo
- * database. The "terminfo" type is not likely to be an oft used feature,
- * though, so this shouldn't be a big problem.
- * The reason FOR caching is to limit the number of file system accesses.
- * This routine is called OFTEN, so limiting the number of open() or
- * access() calls is a good idea.
- */
-#define CACHE_HITS 1 /* */
-#define CACHE_MISSES 1 /* */
-
-/*
- * Define the following if you want to limit the sizes of the caches.
- */
-#define HIT_CACHE_LIMIT 100 /* */
-#define MISS_CACHE_LIMIT 100 /* */
-
-#if defined(CACHE_HITS)
-static char *hit_cache = 0;
-
-# if defined(HIT_CACHE_LIMIT)
-static int hit_cache_size = 0;
-# endif
-#endif
-
-#if defined(CACHE_MISSES)
-static char *miss_cache = 0;
-
-# if defined(MISS_CACHE_LIMIT)
-static int miss_cache_size = 0;
-# endif
-#endif
-
-#if defined(__STDC__)
-static int _isterminfo ( char * , char * );
-#else
-static int _isterminfo();
-#endif
-
-/**
- ** isterminfo() - SEE IF TYPE IS IN TERMINFO DATABASE
- **/
-
-int
-#if defined(__STDC__)
-isterminfo (
- char * type
-)
-#else
-isterminfo (type)
- char *type;
-#endif
-{
- register int ret;
-
- static char *envTERMINFO = 0;
-
-
- if (!type || !*type)
- return (0);
-
-#if defined(CACHE_HITS)
- if (tfind(type, (A2)&hit_cache, (A3)strcmp))
- return (1);
-#endif
-
-#if defined(CACHE_MISSES)
- if (tfind(type, (A2)&miss_cache, (A3)strcmp))
- return (0);
-#endif
-
- if (!envTERMINFO)
- envTERMINFO = getenv("TERMNIFO");
- if (
- envTERMINFO
- && _isterminfo(type, envTERMINFO)
-#if defined(TERMINFO)
- || _isterminfo(type, TERMINFO)
-#endif
- ) {
- ret = 1;
-
-#if defined(CACHE_HITS)
-# if defined(HIT_CACHE_LIMIT)
- if (hit_cache_size++ < HIT_CACHE_LIMIT)
-# endif
- (void)tsearch (Strdup(type), (A2)&hit_cache, (A3)strcmp);
-#endif
-
- } else {
- ret = 0;
-
-#if defined(CACHE_MISSES)
-# if defined(MISS_CACHE_LIMIT)
- if (miss_cache_size++ < MISS_CACHE_LIMIT)
-# endif
- (void)tsearch (Strdup(type), (A2)&miss_cache, (A3)strcmp);
-#endif
- }
- return (ret);
-}
-
-/**
- ** _isterminfo()
- **/
-
-static int
-#if defined(__STDC__)
-_isterminfo (
- char * type,
- char * parent
-)
-#else
-_isterminfo (type, parent)
- char *type,
- *parent;
-#endif
-{
- char *path,
- type_letter[] = "X";
-
- int ret;
-
-#if defined(STRONG_CHECK)
- int fd;
-#endif
-
-
- type_letter[0] = type[0];
- if (!(path = makepath(parent, type_letter, type, (char *)0)))
- return (0);
-
-#if defined(STRONG_CHECK)
- if (!(fd = Open(path, O_RDONLY))) {
-
- /*
- * If we can't open the TERMINFO file because we
- * don't have any open channels left, let's err on
- * the side of likelihood--if the file can be
- * accessed, figure that it's okay.
- */
- if (errno == EMFILE && Access(path, R_OK) == 0)
- ret = 1;
- else
- ret = 0;
-
- } else {
-
- char buf[2];
-
- if (Read(fd, buf, 2) == 2 && buf[0] == 26 && buf[1] == 1)
- ret = 1;
- else
- ret = 0;
-
- Close (fd);
-
- }
-#else
- ret = (Access(path, R_OK) == 0);
-#endif
-
- Free (path);
-
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/lp/joinlist.c b/usr/src/cmd/lp/lib/lp/joinlist.c
deleted file mode 100644
index 516434c126..0000000000
--- a/usr/src/cmd/lp/lib/lp/joinlist.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-/* LINTLIBRARY */
-
-#include "lp.h"
-
-/**
- ** mergelist() - ADD CONTENT OF ONE LIST TO ANOTHER
- **/
-
-int
-#if defined(__STDC__)
-joinlist (
- char *** dstlist,
- char ** srclist
-)
-#else
-joinlist (dstlist, srclist)
- char *** dstlist;
- char ** srclist;
-#endif
-{
- if (!srclist || !*srclist)
- return (0);
-
- while (*srclist)
- if (appendlist(dstlist, *srclist++) == -1)
- return (-1);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/lenlist.c b/usr/src/cmd/lp/lib/lp/lenlist.c
deleted file mode 100644
index 90f8d6d376..0000000000
--- a/usr/src/cmd/lp/lib/lp/lenlist.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-/**
- ** lenlist() - COMPUTE LENGTH OF LIST
- **/
-
-int
-#if defined(__STDC__)
-lenlist (
- char ** list
-)
-#else
-lenlist (list)
- char **list;
-#endif
-{
- register char ** pl;
-
- if (!list)
- return (0);
- for (pl = list; *pl; pl++)
- ;
- return (pl - list);
-}
diff --git a/usr/src/cmd/lp/lib/lp/llib-llp b/usr/src/cmd/lp/lib/lp/llib-llp
deleted file mode 100644
index b1faa81b20..0000000000
--- a/usr/src/cmd/lp/lib/lp/llib-llp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "errno.h"
-#include "fcntl.h"
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "stdio.h"
-#include "dirent.h"
-
-typedef struct SCALED {
- float val; /* value of number, scaled according to "sc" */
- char sc; /* 'i' inches, 'c' centimeters, ' ' lines/cols */
-} SCALED;
-
-typedef struct FALERT {
- char * shcmd; /* shell command used to perform the alert */
- int Q; /* # requests queued to activate alert */
- int W; /* alert is sent every "W" minutes */
-} FALERT;
-
-extern int open_locked(char *, char *, mode_t);
-extern char *fdgets(char *, int, int);
-extern int fdprintf(int, char *, ...);
-extern int fdputs(char *, int);
-extern int fdputc(char, int);
-
-
-FILE *open_lpfile ( char * , char * , mode_t );
-int close_lpfile ( FILE * );
-int chown_lppath ( char * path );
-int mkdir_lpdir ( char * path , int mode );
-int rmfile ( char * path );
-int dumpstring ( char * path , char * str );
-
-char * loadstring ( char * path );
-char * loadline ( char * path );
-char * sop_up_rest (int, char * endsop );
-
-int addlist ( char *** , char * );
-int addstring ( char ** , char * );
-int appendlist ( char *** , char * );
-int dellist ( char *** , char * );
-int joinlist ( char *** , char ** );
-int lenlist ( char ** );
-int printlist ( FILE * , char ** );
-int fdprintlist(int , char ** );
-int searchlist ( char *, char ** );
-int searchlist_with_terminfo ( char * , char ** );
-
-char ** duplist ( char ** );
-char ** getlist ( char * , char * , char * );
-char ** dashos ( char * );
-char ** wherelist ( char * , char ** );
-
-char * sprintlist ( char ** );
-char * search_cslist ( char * , char ** );
-
-void freelist ( char ** );
-void printlist_setup ( char * , char * , char * , char * );
-void printlist_unsetup ( void );
-
-
-void printsdn ( FILE * , SCALED );
-void fdprintsdn ( int , SCALED );
-void printsdn_setup ( char * , char * , char * );
-void printsdn_unsetup ( void );
-
-SCALED _getsdn ( char * , char ** , int );
-
-char * makepath ( char * , ... );
-char * getspooldir ( void );
-char * getrequestfile ( char * );
-char * getprinterfile ( char * , char * );
-char * getsystemfile ( char * , char * );
-char * getclassfile ( char * );
-char * getfilterfile ( char * );
-char * getformfile ( char * , char * );
-
-int cs_strcmp ( char * , char * );
-int cs_strncmp ( char * , char * , int );
-
-int syn_name ( char * );
-int syn_text ( char * );
-int syn_comment ( char * );
-int syn_machine_name ( char * );
-int syn_option ( char * );
-
-int putalert ( char * , char * , FALERT * );
-int delalert ( char * , char * );
-
-FALERT * getalert ( char * , char * );
-
-void printalert ( FILE * , FALERT * , int );
-
-int tidbit ( char * , char * , ... );
-void untidbit ( char * );
-
-int _Access ( char * , int );
-int _Chdir ( char * );
-int _Chmod ( char * , int );
-int _Chown ( char * , int , int );
-int _Close ( int );
-int _Creat ( char * , int );
-int _Fcntl ( int , int , ... );
-int _Fstat ( int , struct stat * );
-int _Link ( char * , char * );
-int _Lstat ( char * , struct stat * );
-int _Mknod ( char * , int , int );
-int _Mkpipe ( char * , int , int );
-int _Open ( char * , int , ... /* mode_t */ );
-int _Read ( int , char * , unsigned int );
-int _Readlink ( char * , char * , unsigned int );
-int _Rename ( char * , char * );
-int _Symlink ( char * , char * );
-int _Stat ( char * , struct stat * );
-int _Unlink ( char * );
-int _Wait ( int * );
-int _Write ( int , char * , unsigned int );
-
-void * _Malloc ( size_t , const char * , int );
-void * _Realloc ( void * , size_t , const char * , int );
-void * _Calloc ( size_t , size_t , const char * , int );
-char * _Strdup ( const char * , const char * , int );
-void _Free ( void * , const char * , int );
-
-
-int isterminfo ( char * );
-int isprinter ( char * );
-int isrequest ( char * );
-int isnumber ( char * );
-
-char * getname ( void );
-char * makestr ( char * , ... );
-char * strip ( char * );
-
-void sendmail ( char * , char * );
-
-void (*lp_alloc_fail_handler)( void );
-
-char * next_x ( char * , long * , unsigned int );
-
diff --git a/usr/src/cmd/lp/lib/lp/makepath.c b/usr/src/cmd/lp/lib/lp/makepath.c
deleted file mode 100644
index d3ab6d8220..0000000000
--- a/usr/src/cmd/lp/lib/lp/makepath.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* LINTLIBRARY */
-
-#if defined(__STDC__)
-#include "stdarg.h"
-#else
-#include "varargs.h"
-#endif
-
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** makepath() - CREATE PATHNAME FROM COMPONENTS
- **/
-
-/*VARARGS1*/
-char *
-#if defined(__STDC__)
-makepath (
- char * s,
- ...
-)
-#else
-makepath (s, va_alist)
- char * s;
- va_dcl
-#endif
-{
- va_list ap;
-
- register char *component,
- *p,
- *q;
-
- register int len;
-
- char *ret;
-
-
-#if defined(__STDC__)
- va_start (ap, s);
-#else
- va_start (ap);
-#endif
-
- for (len = strlen(s) + 1; (component = va_arg(ap, char *)); )
- len += strlen(component) + 1;
-
- va_end (ap);
-
- if (!len) {
- errno = 0;
- return (0);
- }
-
- if (!(ret = Malloc(len))) {
- errno = ENOMEM;
- return (0);
- }
-
-#if defined(__STDC__)
- va_start (ap, s);
-#else
- va_start (ap);
-#endif
-
- for (
- p = ret, component = s;
- component;
- component = va_arg(ap, char *)
- ) {
- for (q = component; *q; )
- *p++ = *q++;
- *p++ = '/';
- }
- p[-1] = 0;
-
- va_end (ap);
-
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/lp/makestr.c b/usr/src/cmd/lp/lib/lp/makestr.c
deleted file mode 100644
index c61476a8dd..0000000000
--- a/usr/src/cmd/lp/lib/lp/makestr.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* LINTLIBRARY */
-
-#if defined(__STDC__)
-#include "stdarg.h"
-#else
-#include "varargs.h"
-#endif
-
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** makestr() - CONSTRUCT SINGLE STRING FROM SEVERAL
- **/
-
-/*VARARGS1*/
-char *
-#if defined(__STDC__)
-makestr (
- char * s,
- ...
-)
-#else
-makestr (s, va_alist)
- char * s;
- va_dcl
-#endif
-{
- va_list ap;
-
- register char *component,
- *p,
- *q;
-
- register int len;
-
- char *ret;
-
-
-#if defined(__STDC__)
- va_start (ap, s);
-#else
- va_start (ap);
-#endif
-
- for (len = strlen(s); (component = va_arg(ap, char *)); )
- len += strlen(component);
-
- va_end (ap);
-
- if (!len) {
- errno = 0;
- return (0);
- }
-
- if (!(ret = Malloc(len + 1))) {
- errno = ENOMEM;
- return (0);
- }
-
-#if defined(__STDC__)
- va_start (ap, s);
-#else
- va_start (ap);
-#endif
-
- for (
- p = ret, component = s;
- component;
- component = va_arg(ap, char *)
- )
- for (q = component; *q; )
- *p++ = *q++;
- *p = 0;
-
- va_end(ap);
-
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/lp/mergelist.c b/usr/src/cmd/lp/lib/lp/mergelist.c
deleted file mode 100644
index 8fdbad0880..0000000000
--- a/usr/src/cmd/lp/lib/lp/mergelist.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-/**
- ** mergelist() - ADD CONTENT OF ONE LIST TO ANOTHER
- **/
-
-int
-#if defined(__STDC__)
-mergelist (
- char *** dstlist,
- char ** srclist
-)
-#else
-mergelist (dstlist, srclist)
- register char ***dstlist,
- **srclist;
-#endif
-{
- if (!srclist || !*srclist)
- return (0);
-
- while (*srclist)
- if (addlist(dstlist, *srclist++) == -1)
- return (-1);
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/next.c b/usr/src/cmd/lp/lib/lp/next.c
deleted file mode 100644
index 5af076c69a..0000000000
--- a/usr/src/cmd/lp/lib/lp/next.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */
-/* LINTLIBRARY */
-
-#include "string.h"
-#include "errno.h"
-
-#include "lp.h"
-
-#if defined(__STDC__)
-static int is ( char *, char *, unsigned int );
-#else
-static int is();
-#endif
-
-/**
- ** next_x() - GO TO NEXT ENTRY UNDER PARENT DIRECTORY
- **/
-
-char *
-#if defined(__STDC__)
-next_x (
- char * parent,
- long * lastdirp,
- unsigned int what
-)
-#else
-next_x (parent, lastdirp, what)
- char *parent;
- long *lastdirp;
- unsigned int what;
-#endif
-{
- DIR *dirp;
-
- register char *ret = 0;
-
- struct dirent *direntp;
-
-
- if (!(dirp = Opendir(parent)))
- return (0);
-
- if (*lastdirp != -1)
- Seekdir (dirp, *lastdirp);
-
- do
- direntp = Readdir(dirp);
- while (
- direntp
- && (
- STREQU(direntp->d_name, ".")
- || STREQU(direntp->d_name, "..")
- || !is(parent, direntp->d_name, what)
- )
- );
-
- if (direntp) {
- if (!(ret = Strdup(direntp->d_name)))
- errno = ENOMEM;
- *lastdirp = Telldir(dirp);
- } else {
- errno = ENOENT;
- *lastdirp = -1;
- }
-
- Closedir (dirp);
-
- return (ret);
-}
-
-static int
-#if defined(__STDC__)
-is (
- char * parent,
- char * name,
- unsigned int what
-)
-#else
-is (parent, name, what)
- char *parent;
- char *name;
- unsigned int what;
-#endif
-{
- char *path;
-
- struct stat statbuf;
-
- if (!(path = makepath(parent, name, (char *)0)))
- return (0);
- if (Stat(path, &statbuf) == -1) {
- Free (path);
- return (0);
- }
- Free (path);
- return ((statbuf.st_mode & S_IFMT) == what);
-}
diff --git a/usr/src/cmd/lp/lib/lp/printlist.c b/usr/src/cmd/lp/lib/lp/printlist.c
deleted file mode 100644
index e0cec19d33..0000000000
--- a/usr/src/cmd/lp/lib/lp/printlist.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-
-#include "lp.h"
-
-#define DFLT_PREFIX 0
-#define DFLT_SUFFIX 0
-#define DFLT_SEP "\n"
-#define DFLT_NEWLINE "\n"
-
-int printlist_qsep = 0;
-
-static char *print_prefix = DFLT_PREFIX,
- *print_suffix = DFLT_SUFFIX,
- *print_sep = DFLT_SEP,
- *print_newline = DFLT_NEWLINE;
-
-static void q_print( int, char * , char * );
-
-/**
- ** printlist_setup() - ARRANGE FOR CUSTOM PRINTING
- ** printlist_unsetup() - RESET STANDARD PRINTING
- **/
-
-void
-printlist_setup(char *prefix, char *suffix, char *sep, char *newline)
-{
- if (prefix)
- print_prefix = prefix;
- if (suffix)
- print_suffix = suffix;
- if (sep)
- print_sep = sep;
- if (newline)
- print_newline = newline;
- return;
-}
-
-void
-printlist_unsetup()
-{
- print_prefix = DFLT_PREFIX;
- print_suffix = DFLT_SUFFIX;
- print_sep = DFLT_SEP;
- print_newline = DFLT_NEWLINE;
- return;
-}
-
-/**
- ** printlist() - PRINT LIST ON OPEN CHANNEL
- **/
-
-int
-printlist(FILE *fp, char **list)
-{
- return (fdprintlist(fileno(fp), list));
-}
-
-int
-fdprintlist(int fd, char **list)
-{
- register char *sep;
-
- if (list)
- for (sep = ""; *list; *list++, sep = print_sep) {
-
- (void)fdprintf (fd, "%s%s", sep, NB(print_prefix));
- if (printlist_qsep)
- q_print (fd, *list, print_sep);
- else
- (void)fdprintf (fd, "%s", *list);
- errno = 0;
- (void)fdprintf (fd, "%s", NB(print_suffix));
- if (errno != 0)
- return (-1);
-
- }
- (void)fdprintf (fd, print_newline);
-
- return (0);
-}
-
-
-static void
-q_print(int fd, char *str, char *sep)
-{
- while (*str) {
- if (strchr(sep, *str))
- fdputc('\\', fd);
- fdputc(*str, fd);
- str++;
- }
- return;
-}
diff --git a/usr/src/cmd/lp/lib/lp/sdn.c b/usr/src/cmd/lp/lib/lp/sdn.c
deleted file mode 100644
index 151717830f..0000000000
--- a/usr/src/cmd/lp/lib/lp/sdn.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-#define N_COMPRESSED 9999
-
-/**
- ** printsdn() - PRINT A SCALED DECIMAL NUMBER NICELY
- **/
-
-#define DFLT_PREFIX 0
-#define DFLT_SUFFIX 0
-#define DFLT_NEWLINE "\n"
-
-static char *print_prefix = DFLT_PREFIX,
- *print_suffix = DFLT_SUFFIX,
- *print_newline = DFLT_NEWLINE;
-
-void
-printsdn_setup(char *prefix, char *suffix, char *newline)
-{
- if (prefix)
- print_prefix = prefix;
- if (suffix)
- print_suffix = suffix;
- if (newline)
- print_newline = newline;
- return;
-}
-
-void
-printsdn_unsetup ()
-{
- print_prefix = DFLT_PREFIX;
- print_suffix = DFLT_SUFFIX;
- print_newline = DFLT_NEWLINE;
- return;
-}
-
-
-void
-printsdn(FILE *fp, SCALED sdn)
-{
- fdprintsdn(fileno(fp), sdn);
-}
-
-
-void
-fdprintsdn(int fd, SCALED sdn)
-{
- register char *dec = "9999.999",
- *z;
-
- if (sdn.val <= 0)
- return;
-
- (void)fdprintf (fd, "%s", NB(print_prefix));
-
- /*
- * Let's try to be a bit clever in dealing with decimal
- * numbers. If the number is an integer, don't print
- * a decimal point. If it isn't an integer, strip trailing
- * zeros from the fraction part, and don't print more
- * than the thousandths place.
- */
- if (-1000. < sdn.val && sdn.val < 10000.) {
-
- /*
- * Printing 0 will give us 0.000.
- */
- sprintf (dec, "%.3f", sdn.val);
-
- /*
- * Skip zeroes from the end until we hit
- * '.' or not-0. If we hit '.', clobber it;
- * if we hit not-0, it has to be in fraction
- * part, so leave it.
- */
- z = dec + strlen(dec) - 1;
- while (*z == '0' && *z != '.')
- z--;
- if (*z == '.')
- *z = '\0';
- else
- *++z = '\0';
-
- (void)fdprintf(fd, "%s", dec);
-
- } else
- (void)fdprintf(fd, "%.3f", sdn.val);
-
- if (sdn.sc == 'i' || sdn.sc == 'c')
- fdputc(sdn.sc, fd);
-
- (void)fdprintf(fd, "%s%s", NB(print_suffix), NB(print_newline));
- return;
-}
-
-
-/**
- ** _getsdn() - PARSE SCALED DECIMAL NUMBER
- **/
-
-SCALED
-_getsdn(char *str, char **p_after, int is_cpi)
-{
- static SCALED sdn = { 0.0 , 0 };
-
- char * rest;
-
-
- /*
- * A nonzero "errno" is our only method of indicating error.
- */
- errno = 0;
-
- if (is_cpi && STREQU(str, NAME_PICA)) {
- sdn.val = 10;
- sdn.sc = 0;
- if (p_after)
- *p_after = str + strlen(NAME_PICA);
-
- } else if (is_cpi && STREQU(str, NAME_ELITE)) {
- sdn.val = 12;
- sdn.sc = 0;
- if (p_after)
- *p_after = str + strlen(NAME_ELITE);
-
- } else if (is_cpi && STREQU(str, NAME_COMPRESSED)) {
- sdn.val = N_COMPRESSED;
- sdn.sc = 0;
- if (p_after)
- *p_after = str + strlen(NAME_COMPRESSED);
-
- } else {
- sdn.val = strtod(str, &rest);
- if (sdn.val <= 0) {
- lp_errno = LP_EBADSDN;
- errno = EINVAL;
- return (sdn);
- }
-
- while (*rest && *rest == ' ')
- rest++;
-
- switch (*rest) {
- case 0:
- sdn.sc = 0;
- if (p_after)
- *p_after = rest;
- break;
- case 'i':
- case 'c':
- sdn.sc = *rest++;
- if (p_after)
- *p_after = rest;
- break;
- default:
- lp_errno = LP_EBADSDN;
- errno = EINVAL;
- sdn.sc = 0;
- break;
- }
- }
-
- return (sdn);
-}
diff --git a/usr/src/cmd/lp/lib/lp/searchlist.c b/usr/src/cmd/lp/lib/lp/searchlist.c
deleted file mode 100644
index 46b5b476a0..0000000000
--- a/usr/src/cmd/lp/lib/lp/searchlist.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-
-#include "lp.h"
-
-/**
- ** searchlist() - SEARCH (char **) LIST FOR ITEM
- **/
-
-int
-#if defined(__STDC__)
-searchlist (
- char * item,
- char ** list
-)
-#else
-searchlist (item, list)
- register char *item;
- register char **list;
-#endif
-{
- if (!list || !*list)
- return (0);
-
- else if (STREQU(item, NAME_ANY) || STREQU(item, NAME_ALL))
- return (1);
-
- /*
- * This is a linear search--we believe that the lists
- * will be short.
- */
- while (*list) {
- if (
- STREQU(*list, item)
- || STREQU(*list, NAME_ANY)
- || STREQU(*list, NAME_ALL)
- )
- return (1);
- list++;
- }
- return (0);
-}
-
-/**
- ** searchlist_with_terminfo() - SEARCH (char **) LIST FOR ITEM
- **/
-
-int
-#if defined(__STDC__)
-searchlist_with_terminfo (
- char * item,
- char ** list
-)
-#else
-searchlist_with_terminfo (item, list)
- register char *item;
- register char **list;
-#endif
-{
- if (!list || !*list)
- return (0);
-
- else if (STREQU(item, NAME_ANY) || STREQU(item, NAME_ALL))
- return (1);
-
- /*
- * This is a linear search--we believe that the lists
- * will be short.
- */
- while (*list) {
- if (
- STREQU(*list, item)
- || STREQU(*list, NAME_ANY)
- || STREQU(*list, NAME_ALL)
- || (
- STREQU(*list, NAME_TERMINFO)
- && isterminfo(item)
- )
- )
- return (1);
- list++;
- }
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/set_charset.c b/usr/src/cmd/lp/lib/lp/set_charset.c
deleted file mode 100644
index 628ae30296..0000000000
--- a/usr/src/cmd/lp/lib/lp/set_charset.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.11 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "lp.set.h"
-
-#if defined(__STDC__)
-char * tparm ( char * , ... );
-#else
-extern char *tparm();
-#endif
-
-#if defined(__STDC__)
-static int cat_charset ( char *, int , char * , int );
-#else
-static int cat_charset();
-#endif
-
-/**
- ** set_charset()
- **/
-
-int
-#if defined(__STDC__)
-set_charset (
- char * char_set,
- int putout,
- char * type
-)
-#else
-set_charset (char_set, putout, type)
- char *char_set;
- int putout;
- char *type;
-#endif
-{
- int cs,
- ret;
-
- char *rest,
- *char_set_nm,
- *char_set_names,
- *select_char_set,
- *start_char_set_def,
- *p,
- *q;
-
- unsigned short has_print_wheel;
-
-
- tidbit ((char *)0, "daisy", &has_print_wheel);
- if (has_print_wheel)
- return (E_SUCCESS);
-
- tidbit ((char *)0, "csnm", &char_set_names);
- if (
- strlen(char_set) > (size_t) 2
- && char_set[0] == 'c'
- && char_set[1] == 's'
- && char_set[2]
- && 0 <= (cs = strtol(char_set + 2, &rest, 10)) && cs <= 63
- && !*rest
- )
- char_set_nm = tparm(char_set_names, cs);
-
- else {
- for (cs = 0; cs <= 63; cs++)
- if (
- (char_set_nm = tparm(char_set_names, cs))
- && *char_set_nm
- && STREQU(char_set_nm, char_set)
- )
- break;
- if (cs > 63)
- return (E_FAILURE);
- }
-
- if (cs == 0)
- return (E_SUCCESS);
-
- if (char_set_nm)
- if (!(char_set_nm = Strdup(char_set_nm))) {
- errno = ENOMEM;
- ret = E_FAILURE;
- goto Return;
- }
-
- tidbit ((char *)0, "scs", &select_char_set);
- p = q = 0;
- if ((p = tparm(select_char_set, cs)) && *p && (p = Strdup(p))) {
-
- tidbit ((char *)0, "scsd", &start_char_set_def);
- if ((q = tparm(start_char_set_def, cs)) && *q) {
- /*
- * The ``start char. set def'n.'' capability
- * is defined and set, so assume we MUST
- * download the character set before using it.
- */
- if (
- OKAY(char_set_nm)
- && cat_charset(char_set_nm, 0, type, putout) != -1
- || cat_charset((char *)0, cs, type, putout) != -1
- || cat_charset(char_set, 0, type, putout) != -1
- )
- ;
- else {
- ret = E_FAILURE;
- goto Return;
- }
-
- } else {
- /*
- * The ``start char. set def'n.'' capability
- * is not defined and or set, so assume we MAY
- * download the character set before using it.
- */
- if (
- OKAY(char_set_nm)
- && cat_charset(char_set_nm, 0, type, putout) != -1
- || cat_charset((char *)0, cs, type, putout) != -1
- || cat_charset(char_set, 0, type, putout) != -1
- )
- ;
- }
-
- if (putout)
- putp (p);
- ret = E_SUCCESS;
-
- } else
- ret = E_FAILURE;
-
-Return: if (p)
- Free (p);
- if (q)
- Free (q);
- if (char_set_nm)
- Free (char_set_nm);
- return (ret);
-}
-
-/**
- ** cat_charset() - DUMP CONTENT OF CHARACTER SET DEF'N FILE
- **/
-
-static int
-#if defined(__STDC__)
-cat_charset (
- char * name,
- int number,
- char * type,
- int putout
-)
-#else
-cat_charset (name, number, type, putout)
- char *name;
- int number,
- putout;
- char *type;
-#endif
-{
- int fd;
-
- char *p,
- *parent,
- *T,
- buf[BUFSIZ];
-
- int n,
- ret;
-
- if (!name)
- sprintf ((name = "63"), "%d", number);
-
- if (!(parent = getenv("CHARSETDIR")))
- parent = CHARSETDIR;
-
- (T = "x")[0] = type[0];
- p = makepath(parent, T, type, name, (char *)0);
- if (!p)
- return (-1);
- if ((fd = open_locked(p, "r", 0)) < 0) {
- Free (p);
- return (-1);
- }
- Free (p);
-
- if (putout) {
-
- errno = 0;
- while ((n = read(fd, buf, BUFSIZ)))
- fwrite (buf, 1, n, stdout);
-
- if (errno != 0)
- ret = -1;
- else
- ret = 0;
-
- }
- close(fd);
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/lp/set_pitch.c b/usr/src/cmd/lp/lib/lp/set_pitch.c
deleted file mode 100644
index ee317cdcad..0000000000
--- a/usr/src/cmd/lp/lib/lp/set_pitch.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "lp.set.h"
-
-extern char *tparm();
-
-short output_res_char = -1,
- output_res_line = -1,
- output_res_horz_inch = -1,
- output_res_vert_inch = -1;
-
-/**
- ** set_pitch()
- **/
-
-int
-#if defined(__STDC__)
-set_pitch (
- char * str,
- int which,
- int putout
-)
-#else
-set_pitch (str, which, putout)
- char *str;
- int which,
- putout;
-#endif
-{
- double xpi;
-
- int ixpi;
-
- short *output_res_p,
- *output_res_inch_p;
-
- unsigned short xpi_changes_res;
-
- char *rest,
- *change_pitch,
- *change_res,
- *p;
-
-
- if (which == 'H') {
-
- tidbit ((char *)0, "cpi", &change_pitch);
- tidbit ((char *)0, "chr", &change_res);
-
- output_res_inch_p = &output_res_horz_inch;
- if (output_res_horz_inch == -1)
- tidbit ((char *)0, "orhi", output_res_inch_p);
-
- output_res_p = &output_res_char;
- if (output_res_char == -1)
- tidbit ((char *)0, "orc", output_res_p);
-
- tidbit ((char *)0, "cpix", &xpi_changes_res);
-
- } else {
-
- tidbit ((char *)0, "lpi", &change_pitch);;
- tidbit ((char *)0, "cvr", &change_res);;
-
- output_res_inch_p = &output_res_vert_inch;
- if (output_res_vert_inch == -1)
- tidbit ((char *)0, "orvi", output_res_inch_p);
-
- output_res_p = &output_res_line;
- if (output_res_line == -1)
- tidbit ((char *)0, "orl", output_res_p);
-
- tidbit ((char *)0, "lpix", &xpi_changes_res);;
-
- }
-
- xpi = strtod(str, &rest);
- if (which == 'H' && STREQU(str, NAME_PICA))
- ixpi = R(xpi = 10);
-
- else if (which == 'H' && STREQU(str, NAME_ELITE))
- ixpi = R(xpi = 12);
-
- else if (
- which == 'H'
- && (
- STREQU(str, NAME_COMPRESSED)
- || xpi >= N_COMPRESSED
- )
- ) {
- if (change_pitch) {
-
- for (ixpi = MAX_COMPRESSED; ixpi; ixpi--)
- if ((p = tparm(change_pitch, ixpi)) && *p)
- break;
- if (!ixpi)
- ixpi = 10;
- xpi = (double)ixpi;
-
- } else if (change_res && *output_res_inch_p != -1) {
-
- for (xpi = MAX_COMPRESSED; xpi >= 1.; xpi -= 1.)
- if (
- (p = tparm(change_res, R(*output_res_inch_p / xpi)))
- && *p
- )
- break;
- if (xpi < 1.)
- xpi = 10.;
- ixpi = R(xpi);
-
- } else
- return (E_FAILURE);
-
- } else {
-
- if (xpi <= 0)
- return (E_BAD_ARGS);
-
- switch (*rest) {
- case ' ':
- case 0:
- break;
- case 'c':
- /*
- * Convert to [lines|chars] per inch.
- */
- xpi *= 2.54;
- /* fall through */
- case 'i':
- break;
- default:
- return (E_BAD_ARGS);
- }
-
- ixpi = R(xpi);
-
- }
-
- if (
- *output_res_inch_p != -1
- && *output_res_p != -1
- && R(*output_res_inch_p / (double)*output_res_p) == ixpi
- )
- return (E_SUCCESS);
-
- else if (
- change_pitch
- && (p = tparm(change_pitch, ixpi))
- && *p
- ) {
-
- if (putout)
- putp (p);
- if (xpi_changes_res) {
- if (*output_res_inch_p != -1)
- *output_res_inch_p = R(*output_res_p * xpi);
- } else {
- if (*output_res_p != -1)
- *output_res_p = R(*output_res_inch_p / xpi);
- }
- return (E_SUCCESS);
-
- } else if (
- change_res
- && *output_res_inch_p != -1
- && (p = tparm(change_res, R(*output_res_inch_p / xpi)))
- && *p
- ) {
-
- if (putout)
- putp (p);
- if (*output_res_p != -1)
- *output_res_p = R(*output_res_inch_p / xpi);
- return (E_SUCCESS);
-
- } else
-
- return (E_FAILURE);
-}
diff --git a/usr/src/cmd/lp/lib/lp/set_size.c b/usr/src/cmd/lp/lib/lp/set_size.c
deleted file mode 100644
index d2fec5a842..0000000000
--- a/usr/src/cmd/lp/lib/lp/set_size.c
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.13 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "lp.set.h"
-
-#if defined(__STDC__)
-
-char * tparm ( char * , ... );
-int putp ( char * );
-int tidbit ( char * , char * , ... );
-
-#else
-
-extern char *tparm();
-int putp();
-int tidbit();
-
-#endif
-
-extern short output_res_char,
- output_res_line,
- output_res_horz_inch,
- output_res_vert_inch;
-
-/**
- ** set_size()
- **/
-
-int
-#if defined(__STDC__)
-set_size (
- char * str,
- int which,
- int putout
-)
-#else
-set_size (str, which, putout)
- char *str;
- int which,
- putout;
-#endif
-{
- static int cleared_margins_already = 0;
-
- double size;
-
- int i,
- isize,
- ret;
-
- short curval,
- output_res,
- output_res_inch;
-
- char *rest,
- *set_margin1,
- *set_margin2,
- *set_margin1_parm,
- *set_margin2_parm,
- *set_both_margins = 0,
- *move1,
- *move2,
- *step2,
- *p1,
- *p2,
- *sp1,
- *sp2,
- *carriage_return,
- *parm_right_cursor,
- *column_address,
- *repeat_char,
- *cursor_right,
- *parm_down_cursor,
- *row_address,
- *cursor_down,
- *clear_margins,
- *finale,
- *slines;
-
-
- if (which == 'W') {
-
- tidbit ((char *)0, "cols", &curval);
-
- if (output_res_char == -1)
- tidbit ((char *)0, "orc", &output_res_char);
- output_res = output_res_char;
-
- if (output_res_horz_inch == -1)
- tidbit ((char *)0, "orhi", &output_res_horz_inch);
- output_res_inch = output_res_horz_inch;
-
- } else {
-
- tidbit ((char *)0, "lines", &curval);
-
- if (output_res_line == -1)
- tidbit ((char *)0, "orl", &output_res_line);
- output_res = output_res_line;
-
- if (output_res_vert_inch == -1)
- tidbit ((char *)0, "orvi", &output_res_vert_inch);
- output_res_inch = output_res_vert_inch;
-
- }
-
- size = strtod(str, &rest);
- if (size <= 0)
- return (E_BAD_ARGS);
-
- switch (*rest) {
- case ' ':
- case 0:
- break;
- case 'c':
- /*
- * Convert to inches.
- */
- size /= 2.54;
- /* fall through */
- case 'i':
- /*
- * Convert to lines/columns.
- */
- if (output_res == -1 || output_res_inch == -1)
- return (E_FAILURE);
- size *= output_res_inch / output_res;
- break;
- default:
- return (E_BAD_ARGS);
- }
-
-
- if ((isize = R(size)) == curval)
- return (E_SUCCESS);
-
- /*
- * We number things 0 through N (e.g. an 80 column
- * page is numbered 0 to 79). Thus if we are asked
- * to set a width of 132, we set the left margin at
- * 0 and the right at 131.
- * Of course, if we're using the "slines" string,
- * we give the length as N+1.
- */
- isize--;
-
- /*
- * When the width or length is set using the set-margin-at-
- * current-position caps (e.g. smgl and smgr, smgt, smgb):
- * If a parameterized motion capability exists, then we'll try
- * to use it. However, if the instantiation of the capability
- * (through tparm()) gives nothing, assume this means the motion
- * is not allowed--don't try the next choice. This is the only
- * way we have of checking for a width or length beyond the
- * limits of the printer. If a parameterized motion capability
- * doesn't exist, we have no way to check out-of-bounds width
- * and length, sorry.
- *
- * When the width or length is set using parameterized caps
- * (e.g. smglp and smgrp, or slines for length), the above is not
- * a problem, of course.
- */
- if (which == 'W') {
-
- tidbit ((char *)0, "smgl", &set_margin1);
- tidbit ((char *)0, "smgr", &set_margin2);
- tidbit ((char *)0, "smglp", &set_margin1_parm);
- tidbit ((char *)0, "smgrp", &set_margin2_parm);
- tidbit ((char *)0, "smglr", &set_both_margins);
-
- tidbit ((char *)0, "cr", &carriage_return);
- tidbit ((char *)0, "cuf", &parm_right_cursor);
- tidbit ((char *)0, "hpa", &column_address);
- tidbit ((char *)0, "rep", &repeat_char);
- tidbit ((char *)0, "cuf1", &cursor_right);
-
- if (OKAY(carriage_return))
- move1 = carriage_return;
- else
- move1 = "\r";
-
- if (OKAY(parm_right_cursor)) {
- move2 = tparm(parm_right_cursor, isize);
- step2 = 0;
-
- } else if (OKAY(column_address)) {
- move2 = tparm(column_address, isize);
- step2 = 0;
-
- } else if (OKAY(repeat_char)) {
- move2 = tparm(repeat_char, ' ', isize);
- step2 = 0;
-
- } else if (OKAY(cursor_right)) {
- move2 = 0;
- step2 = cursor_right;
-
- } else {
- move2 = 0;
- step2 = " ";
- }
-
- finale = move1; /* i.e. carriage return */
-
- } else {
-
- tidbit ((char *)0, "smgt", &set_margin1);
- tidbit ((char *)0, "smgb", &set_margin2);
- tidbit ((char *)0, "smgtp", &set_margin1_parm);
- tidbit ((char *)0, "smgbp", &set_margin2_parm);
- tidbit ((char *)0, "smgtb", &set_both_margins);
-
- /*
- * For compatibility with SVR3.2 era Terminfo files,
- * we check "u9" as an alias for "slines" IF a check
- * of "slines" comes up empty.
- */
- slines = 0; /* (in case compiled with old tidbit) */
- tidbit ((char *)0, "slines", &slines);
- if (!OKAY(slines))
- tidbit ((char *)0, "u9", &slines);
-
- tidbit ((char *)0, "cud", &parm_down_cursor);
- tidbit ((char *)0, "vpa", &row_address);
- tidbit ((char *)0, "cud1", &cursor_down);
-
- move1 = ""; /* Assume we're already at top-of-page */
-
- if (OKAY(parm_down_cursor)) {
- move2 = tparm(parm_down_cursor, isize);
- step2 = 0;
-
- } else if (OKAY(row_address)) {
- move2 = tparm(row_address, isize);
- step2 = 0;
-
- } else if (OKAY(cursor_down)) {
- move2 = 0;
- step2 = cursor_down;
-
- } else {
- move2 = 0;
- step2 = "\n";
- }
-
- /*
- * This has to be smarter, but we don't have the
- * smarts ourselves, yet; i.e. what do we do if
- * there is no "ff"?
- */
- tidbit ((char *)0, "ff", &finale);
-
- }
-
- /*
- * For a short while we needed a kludge in Terminfo
- * whereby if only one of the left/right or top/bottom
- * parameterized margin setters was defined, it was
- * a parm-string that could set BOTH margins. We now have
- * separate strings for setting both margins, but we still
- * allow the kludge.
- */
- if (!OKAY(set_both_margins)) {
- if (OKAY(set_margin1_parm) && !OKAY(set_margin2_parm))
- set_both_margins = set_margin1_parm;
- else if (OKAY(set_margin2_parm) && !OKAY(set_margin1_parm))
- set_both_margins = set_margin2_parm;
- }
-
- sp1 = sp2 = 0;
-
- if (
- which == 'L'
- && OKAY(slines)
- && (p1 = tparm(slines, isize + 1))
- ) {
- if (putout)
- putp (p1);
- finale = 0;
- ret = E_SUCCESS;
-
- } else if (
- OKAY(set_both_margins)
- && (p1 = tparm(set_both_margins, 0, isize))
- && *p1
- && (sp1 = Strdup(p1))
- ) {
-
- if (putout) {
-
- if (!cleared_margins_already) {
- tidbit ((char *)0, "mgc", &clear_margins);
- if (OKAY(clear_margins)) {
- cleared_margins_already = 1;
- putp (clear_margins);
- }
- }
-
- putp (sp1);
-
- }
- ret = E_SUCCESS;
-
- /*
- * The "smgbp" string takes two parameters; each defines the
- * position of the margin, the first counting lines from the top
- * of the page, the second counting lines from the bottom of the
- * page. This shows the flaw in using the set-margin commands
- * for setting the page length, because BY DEFINITION the second
- * parameter must be 0 for us. But giving 0 won't cause a change
- * in the page length, will it!
- *
- * Anyway, the "smgrp" expects just one parameter (thus will
- * ignore a second parameter) so we can safely give the second
- * parameter without caring which of width or length we're
- * setting.
- */
- } else if (
- OKAY(set_margin1_parm)
- && (p1 = tparm(set_margin1_parm, 0))
- && *p1
- && (sp1 = Strdup(p1))
- && OKAY(set_margin2_parm)
- && (p2 = tparm(set_margin2_parm, isize, 0))
- && *p2
- && (sp2 = Strdup(p2))
- ) {
-
- if (putout) {
-
- if (!cleared_margins_already) {
- tidbit ((char *)0, "mgc", &clear_margins);
- if (OKAY(clear_margins)) {
- cleared_margins_already = 1;
- putp (clear_margins);
- }
- }
-
- putp (sp1);
- putp (sp2);
-
- }
- ret = E_SUCCESS;
-
- } else if (
- OKAY(set_margin1)
- && OKAY(set_margin2)
- && (OKAY(move2) || OKAY(step2))
- ) {
-
- register char *p,
- *q;
-
- register int free_it = 0;
-
- if (putout) {
-
- if (!cleared_margins_already) {
- tidbit ((char *)0, "mgc", &clear_margins);
- if (OKAY(clear_margins)) {
- cleared_margins_already = 1;
- putp (clear_margins);
- }
- }
-
- putp (move1);
- putp (set_margin1);
-
- if (!move2) {
- move2 = Malloc(isize * strlen(step2) + 1);
- if (!move2)
- return (E_MALLOC);
- for (p = move2, i = 0; i < isize; i++)
- for (q = step2; *q; )
- *p++ = *q++;
- *p = 0;
- free_it = 1;
- }
-
- putp (move2);
- putp (set_margin2);
-
- if (free_it)
- Free (move2);
- }
- ret = E_SUCCESS;
-
- } else
- ret = E_FAILURE;
-
- if (putout && OKAY(finale))
- putp (finale);
-
- if (sp1)
- Free (sp1);
- if (sp2)
- Free (sp2);
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/lp/sop.c b/usr/src/cmd/lp/lib/lp/sop.c
deleted file mode 100644
index bf2121908c..0000000000
--- a/usr/src/cmd/lp/lib/lp/sop.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** sop_up_rest() - READ REST OF FILE INTO STRING
- **/
-char *
-sop_up_rest(int fd, char *endsop)
-{
- register int size,
- add_size,
- lenendsop;
-
- register char *str;
-
- char buf[BUFSIZ];
-
-
- str = 0;
- size = 0;
- if (endsop)
- lenendsop = strlen(endsop);
-
- errno = 0;
- while (fdgets(buf, BUFSIZ, fd)) {
- if (endsop && STRNEQU(endsop, buf, lenendsop))
- break;
- add_size = strlen(buf);
- if (str)
- str = Realloc(str, size + add_size + 1);
- else
- str = Malloc(size + add_size + 1);
- if (!str) {
- errno = ENOMEM;
- return (0);
- }
- strcpy (str + size, buf);
- size += add_size;
- }
- if (errno != 0) {
- Free (str);
- return (0);
- }
- return (str);
-}
diff --git a/usr/src/cmd/lp/lib/lp/sprintlist.c b/usr/src/cmd/lp/lib/lp/sprintlist.c
deleted file mode 100644
index 2faf7a811f..0000000000
--- a/usr/src/cmd/lp/lib/lp/sprintlist.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "errno.h"
-#include "string.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** sprintlist() - FLATTEN (char **) LIST INTO (char *) LIST
- **/
-
-char *
-#if defined(__STDC__)
-sprintlist (
- char ** list
-)
-#else
-sprintlist (list)
- char **list;
-#endif
-{
- register char **plist,
- *p,
- *q;
-
- char *ret;
-
- int len = 0;
-
-
- if (!list || !*list)
- return (0);
-
- for (plist = list; *plist; plist++)
- len += strlen(*plist) + 1;
-
- if (!(ret = Malloc(len))) {
- errno = ENOMEM;
- return (0);
- }
-
- q = ret;
- for (plist = list; *plist; plist++) {
- p = *plist;
- while (*q++ = *p++)
- ;
- q[-1] = ' ';
- }
- q[-1] = 0;
-
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/lp/strip.c b/usr/src/cmd/lp/lib/lp/strip.c
deleted file mode 100644
index d1a4c0b1b6..0000000000
--- a/usr/src/cmd/lp/lib/lp/strip.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-
-/**
- ** strip() - STRIP LEADING AND TRAILING BLANKS
- **/
-
-char *
-#if defined(__STDC__)
-strip (
- char * str
-)
-#else
-strip (str)
- register char *str;
-#endif
-{
- register char *p;
-
- if (!str || !*str)
- return (0);
-
- str += strspn(str, " ");
- for (p = str; *p; p++)
- ;
- p--;
- for (; p >= str && *p == ' '; p--)
- ;
- *++p = 0;
- return (str);
-}
diff --git a/usr/src/cmd/lp/lib/lp/syntax.c b/usr/src/cmd/lp/lib/lp/syntax.c
deleted file mode 100644
index 98e5838641..0000000000
--- a/usr/src/cmd/lp/lib/lp/syntax.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "ctype.h"
-#include "string.h"
-#include "sys/param.h"
-
-#include "lp.h"
-
-int
-#if defined(__STDC__)
-syn_name (
- char * str
-)
-#else
-syn_name (str)
- char *str;
-#endif
-{
- register char *p;
-
- if (!str || !*str)
- return(0);
-
- if (strlen(str) > (size_t) MAXPATHLEN)
- return (0);
-
- for (p = str; *p; p++)
- if (!isalnum(*p) && *p != '_' && *p != '-' && *p != '.')
- return (0);
-
- return (1);
-}
-
-int
-#if defined(__STDC__)
-syn_type (
- char * str
-)
-#else
-syn_type (str)
- char *str;
-#endif
-{
- register char *p;
-
- if (!str)
- return(0);
-
- if (strlen(str) > (size_t) MAXPATHLEN)
- return (0);
-
- for (p = str; *p; p++)
- if (!isalnum(*p) && *p != '-')
- return (0);
-
- return (1);
-}
-
-int
-#if defined(__STDC__)
-syn_text (
- char * str
-)
-#else
-syn_text (str)
- char *str;
-#endif
-{
- register char *p;
-
- if (!str)
- return(0);
-
- for (p = str; *p; p++)
- if (!isgraph(*p) && *p != '\t' && *p != ' ')
- return (0);
-
- return (1);
-}
-
-int
-#if defined(__STDC__)
-syn_comment (
- char * str
-)
-#else
-syn_comment (str)
- char *str;
-#endif
-{
- register char *p;
-
- if (!str)
- return(0);
-
- for (p = str; *p; p++)
- if (!isgraph(*p) && *p != '\t' && *p != ' ' && *p != '\n')
- return (0);
-
- return (1);
-}
-
-int
-#if defined(__STDC__)
-syn_machine_name (
- char * str
-)
-#else
-syn_machine_name (str)
- char *str;
-#endif
-{
- if (!str)
- return(0);
-
- if (strlen(str) > (size_t) 8)
- return (0);
-
- return (1);
-}
-
-int
-#if defined(__STDC__)
-syn_option (
- char * str
-)
-#else
-syn_option (str)
- char *str;
-#endif
-{
- register char *p;
-
- if (!str)
- return(0);
-
- for (p = str; *p; p++)
- if (!isprint(*p))
- return (0);
-
- return (1);
-}
diff --git a/usr/src/cmd/lp/lib/lp/tidbit.c b/usr/src/cmd/lp/lib/lp/tidbit.c
deleted file mode 100644
index 22b58941e7..0000000000
--- a/usr/src/cmd/lp/lib/lp/tidbit.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include "errno.h"
-#include "string.h"
-#include "sys/types.h"
-#include "sys/stat.h"
-
-#if defined(__STDC__)
-#include "stdarg.h"
-#else
-#include "varargs.h"
-#endif
-
-#include "lp.h"
-
-extern char *boolnames[],
- *numnames[],
- *strnames[];
-
-extern char *getenv();
-
-ushort_t tidbit_boolean = 0;
-
-short tidbit_number = 0;
-
-char *tidbit_string = 0;
-
-#if defined(__STDC__)
-static int open_terminfo_file(char *, char *);
-#else
-static int open_terminfo_file();
-#endif
-
-/*
- * _Getsh() - GET TWO-BYTE SHORT FROM "char *" POINTER PORTABLY
- */
-
-/*
- * "function" to get a short from a pointer. The short is in a standard
- * format: two bytes, the first is the low order byte, the second is
- * the high order byte (base 256). The only negative number allowed is
- * -1, which is represented as 255, 255. This format happens to be the
- * same as the hardware on the pdp-11 and vax, making it fast and
- * convenient and small to do this on a pdp-11.
- */
-
-#if vax || pdp11 || i386
-#define _Getsh(ip) (*((short *)((char *)(ip))))
-#endif /* vax || pdp11 || i386 */
-
-/*
- * The following macro is partly due to Mike Laman, laman@sdcsvax
- * NCR @ Torrey Pines. - Tony Hansen
- */
-#if u3b || u3b15 || u3b2 || m68000 || sparc
-#define _Getsh(ip) ((short)(*((unsigned char *) ip) | (*(ip+1) << 8)))
-#endif /* u3b || u3b15 || u3b2 || m68000 || sparc */
-
-#ifndef _Getsh
-/*
- * Here is a more portable version, which does not assume byte ordering
- * in shorts, sign extension, etc. It does assume that the C preprocessor
- * does sign-extension the same as on the machine being compiled for.
- * When ANSI C comes along, this should be changed to check <limits.h>
- * to see if the low character value is negative.
- */
-
-static int
-#if defined(__STDC__)
-_Getsh(
- register char *p
-)
-#else
-_Getsh(p)
- register char *p;
-#endif
-{
- register int rv,
- rv2;
-
-#if -1 == '\377' /* sign extension occurs */
- rv = (*p++) & 0377;
- rv2 = (*p) & 0377;
-#else /* -1 == '\377' */ /* no sign extension */
- rv = *p++;
- rv2 = *p;
-#endif /* -1 == '\377' */
- if ((rv2 == 0377) && ((rv == 0377) || (rv == 0376)))
- return (-1);
- return (rv + (rv2 * 256));
-}
-#endif /* _Getsh */
-
-#define MAX_TIDBS 32
-
-static struct tidb {
-
- int snames,
- nbools,
- nints,
- nstrs;
-
- char *term,
- *tiebuf,
- *boolean_offset,
- *number_offset,
- *string_offset,
- *string_table;
-
-} tidbs[MAX_TIDBS + 1]; /* one for last ditch */
-
-/*
- * tidbit() - TERMINFO DATABASE LOOKUP
- */
-
-/*
- * Four forms of calling:
- *
- * tidbit ("term-type", "boolean-cap-name", &ushort)
- * tidbit ("term-type", "numeric-cap-name", &short)
- * tidbit ("term-type", "string-cap-name", &charstar)
- * tidbit ("term-type", "any-cap-name", (char *)0)
- *
- * The last one is chancy, because of the pointer alignment
- * problem, but hey--what the heck. Anyway, the last one
- * causes the value to be stored in one of
- *
- * ushort tidbit_boolean;
- * short tidbit_number;
- * char *tidbit_string;
- *
- * as appropriate, and returns one of 1, 2, or 3 as the type
- * of the capability is boolean, numeric, or string.
- *
- * For example, to extract the size of the screen for a 5410:
- *
- * short cols, lines;
- *
- * tidbit ("5410", "cols", &cols);
- * tidbit ("5410", "lines", &lines);
- *
- * Note that for the lines and columns, this does NOT check
- * the LINES and COLUMNS environment variables nor the window
- * size, if running on a windowing terminal. That can be done
- * by the caller.
- *
- * If first argument is (char *)0, "tidbit()" uses the same TERM
- * used in the last call, or the TERM environment variable if this
- * is the first call.
- * If second argument is (char *)0, no lookup just verification
- * of terminal type.
- *
- * Return is 0 (or 1, 2, 3 as above) if successful, otherwise -1
- * with "errno" set:
- *
- * ENOENT can't open Terminfo file for terminal type
- * EBADF Terminfo file is corrupted
- * ENOMEM malloc failed
- */
-
-/*VARARGS2*/
-int
-#if defined(__STDC__)
-tidbit(
- char *term,
- char *cap,
- ...
-)
-#else
-tidbit(term, cap, va_alist)
- char *term,
- *cap;
- va_dcl
-#endif
-{
- va_list ap;
-
- int rc;
-
- register int i;
-
- register char **pp;
-
- register struct tidb *pt;
-
- static char *last_term;
-
-
- if (!term)
- if (last_term)
- term = last_term;
- else {
- term = getenv("TERM");
- if (!term || !*term)
- term = NAME_UNKNOWN;
- }
- if (term != last_term) {
- if (last_term)
- Free(last_term);
- last_term = Strdup(term);
- }
-
- for (i = 0; i < MAX_TIDBS; i++)
- if (tidbs[i].term && STREQU(tidbs[i].term, term)) {
- pt = &tidbs[i];
- break;
- }
-
- /*
- * Not cached, so read the file and cache it.
- */
- if (i >= MAX_TIDBS) {
-
- register int n,
- tfd;
-
- register char *terminfo;
-
- struct stat statbuf;
-
-
- /*
- * If no empty spot can be found, "i" will index the
- * last spot, a spare reserved to avoid problems with
- * a full cache.
- */
- for (i = 0; i < MAX_TIDBS; i++)
- if (!tidbs[i].term)
- break;
- pt = &tidbs[i];
-
- tfd = -1;
- if ((terminfo = getenv("TERMINFO")) && *terminfo)
- tfd = open_terminfo_file(terminfo, term);
-#if defined(TERMINFO)
- if (tfd < 0)
- tfd = open_terminfo_file(TERMINFO, term);
-#endif
- if (tfd >= 0)
- (void) Fstat(tfd, &statbuf);
-
- if (tfd < 0 || !statbuf.st_size) {
- errno = ENOENT;
- return (-1);
- }
-
- if (pt->tiebuf)
- Free(pt->tiebuf);
- if (!(pt->tiebuf = Malloc(statbuf.st_size))) {
- errno = ENOMEM;
- return (-1);
- }
-
- n = Read(tfd, pt->tiebuf, statbuf.st_size);
- (void) Close(tfd);
- if (n <= 0 || n >= 4096 || _Getsh(pt->tiebuf) != 0432) {
- Free(pt->tiebuf);
- pt->tiebuf = 0;
- errno = EBADF;
- return (-1);
- }
-
- if (pt->term)
- Free(pt->term);
- if (!(pt->term = Strdup(term))) {
- Free(pt->tiebuf);
- pt->tiebuf = 0;
- errno = ENOMEM;
- return (-1);
- }
-
- pt->snames = _Getsh(pt->tiebuf + 2);
- pt->nbools = _Getsh(pt->tiebuf + 4);
- pt->nints = _Getsh(pt->tiebuf + 6);
- pt->nstrs = _Getsh(pt->tiebuf + 8);
-
- pt->boolean_offset = pt->tiebuf + 6 * 2 + pt->snames;
-
- pt->number_offset = pt->boolean_offset + pt->nbools;
- if ((unsigned int)pt->number_offset & 1)
- pt->number_offset++;
-
- pt->string_offset = pt->number_offset + pt->nints * 2;
-
- pt->string_table = pt->string_offset + pt->nstrs * 2;
-
- }
-
- rc = 0;
-
-#if defined(__STDC__)
- va_start(ap, cap);
-#else
- va_start(ap);
-#endif
-
- if (!cap || !*cap)
- ;
-
- else if ((pp = wherelist(cap, boolnames))) {
- register ushort_t *ushort_p;
-
- register char *ip;
-
- register int index = pp - boolnames;
-
- if (!(ushort_p = va_arg(ap, ushort_t *))) {
- ushort_p = &tidbit_boolean;
- rc = 1;
- }
-
- if (index >= pt->nbools)
- *ushort_p = 0;
- else {
- ip = pt->boolean_offset + index;
- *ushort_p = (*ip & 01);
- }
-
- } else if ((pp = wherelist(cap, numnames))) {
- register short *short_p;
-
- register char *ip;
-
- register int index = pp - numnames;
-
- if (!(short_p = va_arg(ap, short *))) {
- short_p = &tidbit_number;
- rc = 2;
- }
-
- if (index >= pt->nints)
- *short_p = -1;
- else {
- ip = pt->number_offset + index * 2;
- *short_p = _Getsh(ip);
- if (*short_p == -2)
- *short_p = -1;
- }
-
- } else if ((pp = wherelist(cap, strnames))) {
- register char **charstar_p;
-
- register char *ip;
-
- register int index = pp - strnames;
-
- register short sindex;
-
-
- if (!(charstar_p = va_arg(ap, char **))) {
- charstar_p = &tidbit_string;
- rc = 3;
- }
-
- if (index >= pt->nstrs)
- *charstar_p = 0;
- else {
- ip = pt->string_offset + index * 2;
- if ((sindex = _Getsh(ip)) >= 0)
- *charstar_p = pt->string_table + sindex;
- else
- *charstar_p = 0;
- }
- }
-
- va_end(ap);
- return (rc);
-}
-
-/*
- * untidbit() - FREE SPACE ASSOCIATED WITH A TERMINFO ENTRY
- */
-
-void
-#if defined(__STDC__)
-untidbit(
- char *term
-)
-#else
-untidbit(term)
- char *term;
-#endif
-{
- register int i;
-
-
- for (i = 0; i < MAX_TIDBS; i++)
- if (tidbs[i].term && STREQU(tidbs[i].term, term)) {
- if (tidbs[i].tiebuf) {
- Free(tidbs[i].tiebuf);
- tidbs[i].tiebuf = 0;
- }
- Free(tidbs[i].term);
- tidbs[i].term = 0;
- break;
- }
-}
-
-/*
- * open_terminfo_file() - OPEN FILE FOR TERM ENTRY
- */
-
-static int
-#if defined(__STDC__)
-open_terminfo_file(
- char *terminfo,
- char *term
-)
-#else
-open_terminfo_file(terminfo, term)
- char *terminfo,
- *term;
-#endif
-{
- char first_letter[] = "X",
- *path;
-
- int fd;
-
- first_letter[0] = term[0];
- path = makepath(terminfo, first_letter, term, (char *)0);
-
- /* start fix for bugid 1109709 */
- if (path == NULL) {
- return (-1);
- }
- /* end fix for bugid 1109709 */
-
- fd = Open(path, 0);
- Free(path);
- return (fd);
-}
diff --git a/usr/src/cmd/lp/lib/lp/tx.c b/usr/src/cmd/lp/lib/lp/tx.c
deleted file mode 100644
index 7f440aea3e..0000000000
--- a/usr/src/cmd/lp/lib/lp/tx.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-#include <sys/types.h>
-#include <sys/zone.h>
-#include <syslog.h>
-#include <strings.h>
-
-#include <ucred.h>
-#include "tsol/label.h"
-/* lpsched include files */
-#if defined PS_FAULTED
-#undef PS_FAULTED
-#endif /* PS_FAULTED */
-#include "lp.h"
-#include <sys/tsol/label_macro.h>
-
-/*
- * get_labeled_zonename - gets the the zonename with the same label.
- *
- * Input:
- * slabel - USER_CLEAR label to match
- *
- * Output:
- * -1 - zonename with that label could not be found
- * or no memory for zonename
- * 0 - label was GLOBAL_ZONENAME
- * addr - zonename of zone matching USER_CLEAR label
- * must be retuened by calling Free(addr)
- *
- */
-
-char *
-get_labeled_zonename(char *slabel)
-{
- m_label_t *bsl = NULL;
- int err = 0;
- ssize_t zonename_size = -1;
- zoneid_t zid = -1;
- char *zname = NULL;
-
- syslog(LOG_DEBUG, "lpsched: get_labeled_zonename %s", slabel);
- /*
- * convert the label to binary.
- */
- if (str_to_label(slabel, &bsl, USER_CLEAR,
- L_NO_CORRECTION, &err) == -1) {
- /* label could not be converted, error */
- syslog(LOG_WARNING,
- "lpsched: %s: label not recognized (error==%d)",
- slabel, err);
- return ((char *)-1);
- }
- if ((zid = getzoneidbylabel(bsl)) < 0) {
- /* no zone with that label, cannot send mail */
- syslog(LOG_WARNING,
- "lpsched: cannot send mail, no zone with %s label",
- slabel);
- m_label_free(bsl);
- return ((char *)-1);
- }
- zname = Malloc(ZONENAME_MAX + 1);
- if ((zonename_size = getzonenamebyid(zid, zname, ZONENAME_MAX + 1))
- == -1) {
- /* cannot get zone name, cannot send mail */
- syslog(LOG_WARNING,
- "lpsched: cannot send mail, no zone name for %s",
- slabel);
- m_label_free(bsl);
- Free(zname);
- return ((char *)-1);
- } else {
- m_label_free(bsl);
- if (strcmp(zname, GLOBAL_ZONENAME) == 0) {
- Free(zname);
- zname = NULL;
- }
- }
- return (zname);
-}
-
-int
-get_peer_label(int fd, char **slabel)
-{
- if (is_system_labeled()) {
- ucred_t *uc = NULL;
- m_label_t *sl;
- m_label_t admin_low;
- m_label_t admin_high;
- char *pslabel = NULL; /* peer's slabel */
-
- if ((fd < 0) || (slabel == NULL)) {
- errno = EINVAL;
- return (-1);
- }
- bsllow(&admin_low);
- bslhigh(&admin_high);
-
- if (getpeerucred(fd, &uc) == -1)
- return (-1);
-
- sl = ucred_getlabel(uc);
-
- /*
- * Remote print requests from the global zone
- * arrive at admin_low, make them admin_high to
- * avoid downgrade.
- */
- if (blequal(sl, &admin_low)) {
- sl = &admin_high;
- syslog(LOG_DEBUG, "get_peer_label(): upgrade"
- " admin_low label to admin_high");
- }
-
- if (label_to_str(sl, &pslabel, M_INTERNAL, DEF_NAMES) != 0)
- syslog(LOG_WARNING, "label_to_str(): %m");
- ucred_free(uc);
-
- if (pslabel != NULL) {
- syslog(LOG_DEBUG, "get_peer_label(%d, %s): becomes %s",
- fd, (*slabel ? *slabel : "NULL"), pslabel);
- if (*slabel != NULL)
- free(*slabel);
- *slabel = strdup(pslabel);
- }
- }
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/wherelist.c b/usr/src/cmd/lp/lib/lp/wherelist.c
deleted file mode 100644
index 37d45b71b6..0000000000
--- a/usr/src/cmd/lp/lib/lp/wherelist.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-
-#include "lp.h"
-
-/**
- ** wherelist() - RETURN POINTER TO ITEM IN LIST
- **/
-
-char **
-#if defined(__STDC__)
-wherelist (
- char * item,
- char ** list
-)
-#else
-wherelist (item, list)
- register char *item;
- register char **list;
-#endif
-{
- if (!list || !*list)
- return (0);
-
- while (*list) {
- if (STREQU(*list, item))
- return (list);
- list++;
- }
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/lp/which.c b/usr/src/cmd/lp/lib/lp/which.c
deleted file mode 100644
index 8464a45eda..0000000000
--- a/usr/src/cmd/lp/lib/lp/which.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "ctype.h"
-#include "string.h"
-#include "stdlib.h"
-#include "unistd.h"
-
-#include "lp.h"
-
-/**
- ** isprinter() - SEE IF ARGUMENT IS A REAL PRINTER
- **/
-
-int
-#if defined(__STDC__)
-isprinter (
- char * str
-)
-#else
-isprinter (str)
- char *str;
-#endif
-{
- char *path = 0;
-
- int bool;
-
- bool = (
- str
- && *str
- && (path = getprinterfile(str, CONFIGFILE))
- && Access(path, F_OK) == 0
- );
- if (path)
- Free (path);
- return (bool);
-}
-
-/**
- ** isclass() - SEE IF ARGUMENT IS A REAL CLASS
- **/
-
-int
-#if defined(__STDC__)
-isclass (
- char * str
-)
-#else
-isclass (str)
- char *str;
-#endif
-{
- char *path = 0;
-
- int bool;
-
- bool = (
- str
- && *str
- && (path = getclassfile(str))
- && Access(path, F_OK) == 0
- );
- if (path)
- Free (path);
- return (bool);
-}
-
-/**
- ** isrequest() - SEE IF ARGUMENT LOOKS LIKE A REAL REQUEST
- **/
-
-int
-#if defined(__STDC__)
-isrequest (
- char * str
-)
-#else
-isrequest (str)
- char *str;
-#endif
-{
- char *dashp;
-
- /*
- * Valid print requests have the form
- *
- * dest-NNN
- *
- * where ``dest'' looks like a printer or class name.
- * An earlier version of this routine checked to see if
- * the ``dest'' was an EXISTING printer or class, but
- * that caused problems with valid requests moved from
- * a deleted printer or class (the request ID doesn't
- * change in the new LP).
- */
-
- if (!str || !*str)
- return (0);
-
- if (!(dashp = strrchr(str, '-')))
- return (0);
-
- if (dashp == str)
- return(0);
-
- *dashp = 0;
- if (!syn_name(str)) {
- *dashp = '-';
- return (0);
- }
- *dashp++ = '-';
-
- if (!isnumber(dashp))
- return (0);
-
- return (1);
-}
-
-int
-#if defined(__STDC__)
-isnumber (
- char * s
-)
-#else
-isnumber (s)
- char *s;
-#endif
-{
- register int c;
-
- if (!s || !*s)
- return (0);
- while ((c = *(s++)) != '\0')
- if (!isdigit(c))
- return (0);
- return (1);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/Makefile b/usr/src/cmd/lp/lib/msgs/Makefile
deleted file mode 100644
index a73baebb49..0000000000
--- a/usr/src/cmd/lp/lib/msgs/Makefile
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/lib/msgs/Makefile
-#
-
-LIBRARY = liblpmsg.a
-
-OBJECTS = _getmessage.o \
- _putmessage.o \
- getmessage.o \
- hslconv.o \
- putmessage.o \
- msgfmts.o \
- mclose.o \
- mconnect.o \
- mdisconnect.o \
- mgetputm.o \
- mlisten.o \
- mcreate.o \
- mdestroy.o \
- mneeds.o \
- mopen.o \
- mread.o \
- mrecv.o \
- msend.o \
- mwrite.o \
- streamio.o \
- fifo_buffs.o \
- read_fifo.o \
- write_fifo.o
-
-
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CPPFLAGS = -I../../include $(CPPFLAGS.master) $(C_PICFLAGS) -D_TS_ERRNO
-
-POFILE = lp_lib_msgs.po
-
-.KEEP_STATE:
-
-all install : $(LIBS)
-
-include ../../../../lib/Makefile.targ
-
-CLEANFILES += llib-llpmsg.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-LINT_CPPFLAGS = -I../../include $(CPPFLAGS.master)
-
-lint: lintlib
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) $(SRCS)
-
-lintlib:
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) -o lpmsg llib-llpmsg
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/msgs/_getmessage.c b/usr/src/cmd/lp/lib/msgs/_getmessage.c
deleted file mode 100644
index ae4d62374c..0000000000
--- a/usr/src/cmd/lp/lib/msgs/_getmessage.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-/* LINTLIBRARY */
-
-# include <stdarg.h>
-# include <string.h>
-# include <errno.h>
-
-# include "msgs.h"
-
-extern char *_lp_msg_fmts[];
-extern int errno;
-
-/* VARARGS */
-#if defined(__STDC__)
-int _getmessage ( char * buf, short rtype, va_list arg )
-#else
-int _getmessage (buf, rtype, arg)
- char *buf;
- short rtype;
- va_list arg;
-#endif
-{
- char *endbuf;
- char *fmt;
- char **t_string;
- int temp = 0;
- long *t_long;
- short *t_short;
- short etype;
-
- if (buf == (char *)0)
- {
- errno = ENOSPC;
- return(-1);
- }
-
- /*
- * We assume that we're given a buffer big enough to hold
- * the header.
- */
-
- endbuf = buf + (long)stoh(buf);
- if ((buf + MESG_DATA) > endbuf)
- {
- errno = ENOMSG;
- return(-1);
- }
-
- etype = stoh(buf + MESG_TYPE);
- if (etype < 0 || etype > LAST_MESSAGE)
- {
- errno = EBADMSG;
- return(-1);
- }
-
- if (etype != rtype)
- {
- if (rtype > 0 && rtype <= LAST_MESSAGE)
- fmt = _lp_msg_fmts[rtype];
- else
- {
- errno = EINVAL;
- return(-1);
- }
- }
- else
- fmt = _lp_msg_fmts[etype];
-
- buf += MESG_LEN;
-
- while (*fmt != '\0')
- switch(*fmt++)
- {
- case 'H':
- if ((buf + 4) > endbuf)
- {
- errno = ENOMSG;
- return(-1);
- }
-
- t_short = va_arg(arg, short *);
- *t_short = stoh(buf);
- buf += 4;
- break;
-
- case 'L':
- if ((buf + 8) > endbuf)
- {
- errno = ENOMSG;
- return(-1);
- }
-
- t_long = va_arg(arg, long *);
- *t_long = stol(buf);
- buf += 8;
- break;
-
- case 'D':
- if ((buf + 4) > endbuf)
- {
- errno = ENOMSG;
- return(-1);
- }
-
- t_short = va_arg(arg, short *);
- *t_short = stoh(buf);
- buf += 4;
- t_string = va_arg(arg, char **);
- if ((buf + *t_short) > endbuf)
- {
- errno = ENOMSG;
- return(-1);
- }
- (*t_short)--; /* Don't mention the null we added */
- *t_string = buf;
- buf += *t_short;
- break;
-
- case 'S':
- if ((buf + 4) > endbuf)
- {
- errno = ENOMSG;
- return(-1);
- }
-
- t_string = va_arg(arg, char **);
- temp = stoh(buf);
- buf += 4;
- if ((buf + temp) > endbuf)
- {
- errno = ENOMSG;
- return(-1);
- }
-
- *t_string = buf;
- buf += temp;
- break;
- }
- return(etype);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/_putmessage.c b/usr/src/cmd/lp/lib/msgs/_putmessage.c
deleted file mode 100644
index 66a6796f5d..0000000000
--- a/usr/src/cmd/lp/lib/msgs/_putmessage.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */
-/* LINTLIBRARY */
-
-# include <stdarg.h>
-# include <string.h>
-# include <errno.h>
-
-# include "msgs.h"
-
-extern char *_lp_msg_fmts[];
-extern int errno;
-
-/* VARARGS */
-#if defined(__STDC__)
-int _putmessage ( char * buf, short type, va_list arg )
-#else
-int _putmessage (buf, type, arg)
- char *buf;
- short type;
- va_list arg;
-#endif
-{
- char *fmt;
- char *t_string;
- int size = 0;
- long t_long;
- short t_short;
-
- if (type < 0 || type > LAST_MESSAGE)
- {
- errno = EBADMSG;
- return(-1);
- }
-
- if (buf)
- (void) htos(buf + MESG_TYPE, type);
-
- size = MESG_LEN;
-
- fmt = _lp_msg_fmts[type];
-
- while (*fmt != '\0')
- switch(*fmt++)
- {
- case 'H':
- t_short = (short) va_arg(arg, int);
- if (buf)
- (void) htos(buf + size, t_short);
-
- size += 4;
- break;
-
- case 'L':
- t_long = (long) va_arg(arg, int);
- if (buf)
- (void) ltos(buf + size, t_long);
-
- size += 8;
- break;
-
- case 'S':
- t_string = (char *) va_arg(arg, char *);
- t_short = (t_string? strlen(t_string) : 0) + 1;
-
- if (buf)
- (void) htos(buf + size, t_short);
-
- size += 4;
-
- if (buf)
- if (t_string)
- (void) memcpy(buf + size, t_string, t_short);
- else
- (buf + size)[0] = 0;
-
- size += t_short;
- break;
-
- case 'D':
- t_short = (short) va_arg(arg, int) + 1;
- t_string = (char *) va_arg(arg, char *);
-
- if (buf)
- (void) htos(buf + size, t_short);
-
- size += 4;
-
- if (buf)
- if (t_string)
- {
- (void) memcpy(buf + size, t_string, t_short);
- buf[size + t_short - 1] = '\0';
- }
- else
- *(buf + size) = '\0';
-
- size += t_short;
- break;
- }
-
-
- if (buf)
- *(buf + size) = '\0';
-
- size++; /* Add a null, just on general principle */
-
- if (buf)
- (void) htos(buf + MESG_SIZE, size);
-
- return(size);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/fifo_buffs.c b/usr/src/cmd/lp/lib/msgs/fifo_buffs.c
deleted file mode 100644
index bf5621bcab..0000000000
--- a/usr/src/cmd/lp/lib/msgs/fifo_buffs.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-/* LINTLIBRARY */
-
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include "lp.h"
-#include "msgs.h"
-
-static fifobuffer_t **FifoBufferTable = NULL;
-static int FifoBufferTableSize = 0;
-
-/*
-** Local functions
-*/
-static int InitFifoBufferTable (void);
-static int GrowFifoBufferTable (int);
-static fifobuffer_t *NewFifoBuffer (int);
-
-
-int
-ResetFifoBuffer(int fd)
-{
- if ((!FifoBufferTableSize) && (InitFifoBufferTable () < 0))
- return -1;
-
- if (fd >= FifoBufferTableSize)
- return 0;
-
- if (FifoBufferTable [fd]) {
- FifoBufferTable [fd]->full = 0;
- FifoBufferTable [fd]->psave =
- FifoBufferTable [fd]->psave_end =
- FifoBufferTable [fd]->save;
- }
- return 0;
-}
-
-
-fifobuffer_t *
-GetFifoBuffer(int fd)
-{
- if (fd < 0) {
- errno = EINVAL;
- return NULL;
- }
- if ((fd >= FifoBufferTableSize) && (GrowFifoBufferTable (fd) < 0))
- return NULL;
-
- if (!FifoBufferTable [fd]) {
- if (!NewFifoBuffer (fd))
- return NULL;
-
- FifoBufferTable [fd]->full = 0;
- FifoBufferTable [fd]->psave =
- FifoBufferTable [fd]->psave_end =
- FifoBufferTable [fd]->save;
- }
-
- return FifoBufferTable [fd];
-}
-
-
-static int
-InitFifoBufferTable()
-{
- if (FifoBufferTableSize)
- return 0;
-
- FifoBufferTable = (fifobuffer_t **)
- Calloc (100, sizeof (fifobuffer_t *));
- if (!FifoBufferTable)
- return -1; /* ENOMEM is already set. */
-
- FifoBufferTableSize = 100;
-
- return 0;
-}
-
-
-static int
-GrowFifoBufferTable (int fd)
-{
- fifobuffer_t **newpp;
-
- newpp = (fifobuffer_t **)
- Realloc ((void*)FifoBufferTable,
- (fd+10)*sizeof (fifobuffer_t *));
- if (!newpp)
- return -1; /* ENOMEM is already set. */
-
- FifoBufferTableSize = fd+10;
-
- return 0;
-}
-
-
-static fifobuffer_t *
-NewFifoBuffer(int fd)
-{
- int i;
-
- for (i=0; i < FifoBufferTableSize; i++)
- {
- if (FifoBufferTable [i] &&
- Fcntl (i, F_GETFL) < 0 &&
- errno == EBADF)
- {
- FifoBufferTable [fd] = FifoBufferTable [i];
- FifoBufferTable [i] = NULL;
- return FifoBufferTable [fd];
- }
- }
- FifoBufferTable [fd] = (fifobuffer_t *)
- Calloc (1, sizeof (fifobuffer_t));
-
- return FifoBufferTable [fd];
-}
diff --git a/usr/src/cmd/lp/lib/msgs/getmessage.c b/usr/src/cmd/lp/lib/msgs/getmessage.c
deleted file mode 100644
index 4af175d0bc..0000000000
--- a/usr/src/cmd/lp/lib/msgs/getmessage.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* LINTLIBRARY */
-/*
-*/
-
-#if defined(__STDC__)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
-
-/* VARARGS */
-#if defined(__STDC__)
-int getmessage ( char * buf, short type, ... )
-#else
-int getmessage (buf, type, va_alist)
- char *buf;
- short type;
- va_dcl
-#endif
-{
- va_list arg;
- int rval;
- int _getmessage();
-
-#if defined(__STDC__)
- va_start(arg, type);
-#else
- va_start(arg);
-#endif
-
- rval = _getmessage(buf, type, arg);
- va_end(arg);
- return(rval);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/hslconv.c b/usr/src/cmd/lp/lib/msgs/hslconv.c
deleted file mode 100644
index 4fa0143a86..0000000000
--- a/usr/src/cmd/lp/lib/msgs/hslconv.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* LINTLIBRARY */
-
-# include <string.h>
-
-static char _lp_hextable[17] = "0123456789ABCDEF";
-
-#if defined(__STDC__)
-char * ltos ( char * s, unsigned long l)
-#else
-char * ltos (s, l)
- char *s;
- unsigned long l;
-#endif
-{
- int i = 7;
-
- while (i >= 0)
- {
- s[i--] = _lp_hextable[l % 16];
- l /= 16;
- }
- s += 8;
- return(s);
-}
-
-#if defined(__STDC__)
-char * htos ( char * s, unsigned short h)
-#else
-char * htos (s, h)
- char *s;
- unsigned short h;
-#endif
-{
- int i = 3;
-
- while (i >= 0)
- {
- s[i--] = _lp_hextable[(long)h % 16];
- h = (long) h / 16;
- }
- s += 4;
- return(s);
-}
-
-#if defined(__STDC__)
-unsigned long stol ( char * s )
-#else
-unsigned long stol (s)
- char *s;
-#endif
-{
- int i = 0;
- unsigned long l = 0;
-
- while (i < 8)
- {
- l <<= 4;
- l += strchr(_lp_hextable, s[i++]) - _lp_hextable;
- }
- return(l);
-}
-
-#if defined(__STDC__)
-unsigned short stoh ( char * s )
-#else
-unsigned short stoh (s)
- char *s;
-#endif
-{
- int i = 0;
- unsigned short h = 0;
-
- while (i < 4)
- {
- h <<= 4;
- h += strchr(_lp_hextable, s[i++]) - _lp_hextable;
- }
- return(h);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/llib-llpmsg b/usr/src/cmd/lp/lib/msgs/llib-llpmsg
deleted file mode 100644
index 84d1fa3b1c..0000000000
--- a/usr/src/cmd/lp/lib/msgs/llib-llpmsg
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
-# include <sys/types.h>
-# include <poll.h>
-# include <stdarg.h>
-# include <stropts.h>
-
-
-typedef struct strbuf strbuf_t; /* STREAMS buffer */
-
-typedef struct mque
-{
- struct mque *next;
- struct strbuf *dat;
-} MQUE;
-
-typedef struct
-{
- short type; /* type of connection */
- int readfd; /* STREAM fd to read from */
- int writefd; /* STREAM fd to write to */
- int wait; /* number of systems waiting for */
- char *file; /* pipe name if type==MD_FIFO */
- short state; /* Current state of client */
- short admin; /* Non zero if admin */
- short event; /* Event returned from poll */
- MQUE * mque; /* backlogged message ptr */
- uid_t uid; /* Clients UID */
- gid_t gid; /* Clients GID */
- void (**on_discon)(); /* Clean up functions */
-} MESG;
-
-#define MSGMAX 2048
-typedef struct
-{
- int full;
- char save [MSGMAX],
- *psave,
- *psave_end;
-} fifobuffer_t;
-
-MESG * mcreate ( char * );
-int mlisteninit ( MESG * );
-MESG * mlisten ( void );
-int mlistenadd ( MESG *, short );
-int mon_discon ( MESG *, void (*)());
-MESG * mlistenreset ( void );
-int mdestroy ( MESG * );
-
-MESG * mconnect ( char *, int, int );
-int mgetm ( MESG *, int, ... );
-int mwrite ( MESG *, char * );
-int mputm ( MESG *, int, ... );
-int mread ( MESG *, char *, int );
-short msize ( char * );
-short mpeek ( MESG * );
-int mdisconnect ( MESG * );
-
-void __mbfree ( void );
-
-int mclose ( void );
-int mneeds ( void );
-int mopen ( void );
-int mrecv ( char *, int );
-int msend ( char * );
-
-int Putmsg (MESG *, strbuf_t *, strbuf_t *, int);
-int Getmsg (MESG *, strbuf_t *, strbuf_t *, int *);
-int read3_2 (MESG * md, char *msgbuf, int size);
-int write3_2 (MESG *, char *, int);
-int read_fifo (int, char *, unsigned int);
-int write_fifo (int, char *, unsigned int);
-int ResetFifoBuffer (int);
-fifobuffer_t *GetFifoBuffer (int);
-
-char * htos ( char *, unsigned short );
-char * ltos ( char *, unsigned long );
-unsigned long stol ( char * );
-unsigned short stoh ( char * );
-int _getmessage ( char *, short, va_list );
-int _putmessage ( char *, short, va_list );
-int getmessage ( char *, short, ... );
-int putmessage ( char *, short, ... );
diff --git a/usr/src/cmd/lp/lib/msgs/mclose.c b/usr/src/cmd/lp/lib/msgs/mclose.c
deleted file mode 100644
index 4a9260bb36..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mclose.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-/* LINTLIBRARY */
-
-#include "lp.h"
-#include "msgs.h"
-
-extern MESG *lp_Md;
-
-int mclose()
-{
- MESG *md = lp_Md;
-
- lp_Md = 0;
-
- return(mdisconnect(md));
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mconnect.c b/usr/src/cmd/lp/lib/msgs/mconnect.c
deleted file mode 100644
index 139c9d8ccb..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mconnect.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* LINTLIBRARY */
-
-# include <unistd.h>
-# include <fcntl.h>
-# include <errno.h>
-# include <sys/utsname.h>
-# include <stdlib.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-
-#include "lp.h"
-#include "msgs.h"
-
-#define TURN_OFF(X,F) (void)Fcntl(X, F_SETFL, (Fcntl(X, F_GETFL, 0) & ~(F)))
-
-#if defined(__STDC__)
-static int checklock ( void );
-#else
-static int checklock();
-#endif
-
-/*
-** mconnect() - OPEN A MESSAGE PATH
-*/
-
-#if defined(__STDC__)
-MESG * mconnect ( char * path, int id1, int id2 )
-#else
-MESG * mconnect ()
- char *path;
- int id1;
- int id2;
-#endif
-{
- int fd;
- int wronly = 0;
- int count = 0;
- MESG *md;
- struct stat stbuf;
-
- /*
- ** invoked as mconnect(path, 0, 0)
- **
- ** Open <path>, if isastream() is true for the returned file
- ** descriptor, then we're done.
- */
-
- if (path)
- {
- /*
- ** Verify that the spooler is running and that the
- ** <path> identifies a pipe.
- ** This prevents us from getting hung in the open
- ** and from thinking the <path> is a non-streams pipe.
- */
- if (checklock() == -1)
- return(NULL);
-Again: if (stat(path, &stbuf) == -1)
- return(NULL);
- if ((stbuf.st_mode & S_IFMT) != S_IFIFO) {
- if (count++ > 20)
- return (NULL);
- sleep(1);
- goto Again;
- }
-
- if ((fd = Open(path, O_RDWR, 0)) == -1)
- if ((fd = Open(path, O_WRONLY, 0)) == -1)
- return(NULL);
- else
- wronly = 1;
-
- if (isastream(fd) && !wronly)
- {
-#if defined(NOCONNLD)
- int fds[2];
-
- if (pipe(fds) != 0)
- return(NULL);
-
- if (ioctl(fd, I_SENDFD, fds[1]) != 0)
- return(NULL);
-
- (void)_Close(fd);
-
- fd = fds[0];
- (void)_Close(fds[1]);
-#endif
-
- if ((md = (MESG *)Malloc(MDSIZE)) == NULL)
- {
- errno = ENOMEM;
- return(NULL);
- }
-
- memset(md, 0, sizeof (MESG));
- md->gid = getgid();
- md->on_discon = NULL;
- md->readfd = fd;
- md->state = MDS_IDLE;
- md->type = MD_STREAM;
- md->uid = getuid();
- md->writefd = fd;
-
- ResetFifoBuffer (md->readfd);
- return(md);
- }
-
- return(NULL);
- }
-
- if (id1 > 0 && id2 > 0)
- {
- if ((md = (MESG *)Malloc(MDSIZE)) == NULL)
- {
- errno = ENOMEM;
- return(NULL);
- }
-
- memset(md, 0, sizeof (MESG));
- md->gid = getgid();
- md->on_discon = NULL;
- md->readfd = id1;
- md->state = MDS_IDLE;
- md->type = MD_BOUND;
- md->uid = getuid();
- md->writefd = id2;
-
- ResetFifoBuffer (md->readfd);
-
- return(md);
- }
-
- errno = EINVAL;
- return(NULL);
-}
-
-#if defined(__STDC__)
-static int checklock ( void )
-#else
-static int checklock()
-#endif
-{
- int fd;
- struct flock lock;
-
- if ((fd = Open(Lp_Schedlock, O_RDONLY, 0666)) == -1)
- return (-1);
-
- /*
- * Now, we try to read-lock the lock file. This can only succeed if
- * the Spooler (lpsched) is down.
- */
-
- lock.l_type = F_RDLCK;
- lock.l_whence = 0;
- lock.l_start = 0;
- lock.l_len = 0; /* till end of file */
-
- if (Fcntl(fd, F_SETLK, &lock) != -1 || errno != EAGAIN)
- {
- (void)Close (fd);
- return (-1);
- }
-
- /*
- * We can get here only when fcntl() == -1 && errno == EAGAIN,
- * i.e., spooler (lpsched) is running.
- */
-
- (void)Close (fd);
-
- return(0);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mcreate.c b/usr/src/cmd/lp/lib/msgs/mcreate.c
deleted file mode 100644
index 445d9e24a7..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mcreate.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1996 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-
-# include <unistd.h>
-# include <string.h>
-# include <stropts.h>
-# include <errno.h>
-# include <stdlib.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-#if defined(__STDC__)
-MESG * mcreate ( char * path )
-#else
-MESG * mcreate (path)
- char *path;
-#endif
-{
- int fds[2];
- MESG *md;
-
- if (pipe(fds) != 0)
- return(NULL);
-
-#if !defined(NOCONNLD)
- if (ioctl(fds[1], I_PUSH, "connld") != 0)
- return(NULL);
-#endif
-
- if (fattach(fds[1], path) != 0)
- return(NULL);
-
- if ((md = (MESG *)Malloc(MDSIZE)) == NULL)
- return(NULL);
-
- memset(md, 0, sizeof (MESG));
- md->admin = 1;
- md->file = Strdup(path);
- md->gid = getgid();
- md->readfd = fds[0];
- md->state = MDS_IDLE;
- md->type = MD_MASTER;
- md->uid = getuid();
-#if 1
- md->writefd = fds[1];
-#else
- md->writefd = fds[0];
- close(fds[1]);
-#endif
-
- return(md);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mdestroy.c b/usr/src/cmd/lp/lib/msgs/mdestroy.c
deleted file mode 100644
index eb029bb170..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mdestroy.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1996 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-# include <string.h>
-# include <stropts.h>
-# include <errno.h>
-# include <stdlib.h>
-# include <unistd.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-int mdestroy(MESG *md)
-{
- struct pollfd pfd;
- struct strrecvfd recbuf;
-
- if (!md || md->type != MD_MASTER || md->file == NULL) {
- errno = EINVAL;
- return(-1);
- }
-
- if (fdetach(md->file) != 0)
- return(-1);
-
- pfd.fd = md->readfd;
- pfd.events = POLLIN;
- while (poll(&pfd, 1, 500) > 0) {
- if (ioctl(md->readfd, I_RECVFD, &recbuf) == 0)
- close(recbuf.fd);
- }
-
- /*
- * Pop connld module
- */
- if (ioctl(md->writefd, I_POP, 0) != 0)
- return(-1);
-
- Free(md->file);
- md->file = NULL;
-
- (void) mdisconnect(md);
-
- return(0);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mdisconnect.c b/usr/src/cmd/lp/lib/msgs/mdisconnect.c
deleted file mode 100644
index b2230ccf5a..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mdisconnect.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* LINTLIBRARY */
-
-# include <stropts.h>
-# include <errno.h>
-# include <stdlib.h>
-
-#include "lp.h"
-#include "msgs.h"
-
-#if defined(__STDC__)
-static void disconnect3_2 ( MESG * );
-#else
-static void disconnect3_2();
-#endif
-
-#if defined(__STDC__)
-int mdisconnect ( MESG * md )
-#else
-int mdisconnect (md)
- MESG *md;
-#endif
-{
- int retvalue = 0;
- void (**fnp)();
- MQUE *p;
-
- if (!md)
- {
- errno = ENXIO;
- return(-1);
- }
-
- switch(md->type)
- {
- case MD_CHILD:
- case MD_STREAM:
- case MD_BOUND:
- if (md->writefd >= 0)
- (void) Close(md->writefd);
- if (md->readfd >= 0)
- (void) Close(md->readfd);
- break;
-
- case MD_USR_FIFO:
- case MD_SYS_FIFO:
- disconnect3_2(md);
- break;
- }
-
- if (md->on_discon)
- {
- for (fnp = md->on_discon; *fnp; fnp++)
- {
- (*fnp)(md);
- retvalue++;
- }
- Free(md->on_discon);
- }
-
- if (md->file)
- Free(md->file);
-
- if (md->mque)
- {
- while ((p = md->mque) != NULL)
- {
- md->mque = p->next;
- Free(p->dat->buf);
- Free(p->dat);
- Free(p);
- }
- }
- Free(md);
-
- return(retvalue);
-}
-
-int discon3_2_is_running = 0;
-
-#if defined(__STDC__)
-static void disconnect3_2 ( MESG * md )
-#else
-static void disconnect3_2 (md)
- MESG *md;
-#endif
-{
- char *msgbuf = 0;
- int size;
-
- discon3_2_is_running = 1;
-
- if (md->writefd != -1)
- {
- size = putmessage((char *)0, S_GOODBYE);
- if ((msgbuf = (char *)Malloc((unsigned)size)))
- {
- (void)putmessage (msgbuf, S_GOODBYE);
- (void)msend (msgbuf);
- Free (msgbuf);
- }
-
- (void) Close (md->writefd);
- }
-
- if (md->readfd != -1)
- (void) Close (md->readfd);
-
- if (md->file)
- {
- (void) Unlink (md->file);
- Free (md->file);
- }
-
- discon3_2_is_running = 0;
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mgetputm.c b/usr/src/cmd/lp/lib/msgs/mgetputm.c
deleted file mode 100644
index 0322087751..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mgetputm.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1994 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-# include <unistd.h>
-# include <errno.h>
-# include <stdlib.h>
-
-#if defined(__STDC__)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
-
-# include "lp.h"
-# include "msgs.h"
-
-
-/*
-** Size and pointer for mgetm()
-*/
-static int MBGSize = 0;
-static char * MBG = NULL;
-
-/*
-** Size and pointer for mputm()
-*/
-static int MBPSize = 0;
-static char * MBP = NULL;
-
-int peek3_2();
-
-#if defined(__STDC__)
-int mgetm ( MESG * md, int type, ... )
-#else
-int mgetm (md, type, va_alist)
- MESG *md;
- int type;
- va_dcl
-#endif
-{
- va_list vp;
- int ret;
- int needsize;
-
-#if defined(__STDC__)
- va_start(vp, type);
-#else
- va_start(vp);
-#endif
-
- needsize = mpeek(md);
- if (needsize <=0 || needsize > MSGMAX)
- needsize = MSGMAX;
- if (needsize > MBGSize)
- {
- if (MBG)
- Free(MBG);
- if ((MBG = (char *)Malloc(needsize)) == NULL)
- {
- MBGSize = 0;
- MBG = NULL;
- errno = ENOMEM;
- return(-1);
- }
- MBGSize = needsize;
- }
- if (mread(md, MBG, MBGSize) < 0)
- return(-1);
-
- ret = _getmessage(MBG, type, vp);
-
- va_end(vp);
-
- return(ret);
-}
-
-#if defined(__STDC__)
-int mputm ( MESG * md, int type, ... )
-#else
-int mputm (md, type, va_alist)
- MESG *md;
- int type;
- va_dcl
-#endif
-{
- va_list vp;
- int needsize;
-
-#if defined(__STDC__)
- va_start(vp, type);
-#else
- va_start(vp);
-#endif
- needsize = _putmessage(NULL, type, vp);
- va_end(vp);
- if (needsize <= 0)
- return(-1);
-
- if (needsize > MBPSize)
- {
- if (MBP)
- Free(MBP);
- if ((MBP = (char *)Malloc(needsize)) == NULL)
- {
- MBPSize = 0;
- MBP = NULL;
- errno = ENOMEM;
- return(-1);
- }
- MBPSize = needsize;
- }
-
-#if defined(__STDC__)
- va_start(vp, type);
-#else
- va_start(vp);
-#endif
- needsize = _putmessage(MBP, type, vp);
- va_end(vp);
- if (needsize <= 0)
- return(-1);
-
-
- return(mwrite(md, MBP));
-}
-
-#if defined(__STDC__)
-void __mbfree ( void )
-#else
-void __mbfree ()
-#endif
-{
- MBGSize = MBPSize = 0;
- if (MBG)
- Free (MBG);
- if (MBP)
- Free (MBP);
- MBG = MBP = NULL;
-}
-
-#if defined(__STDC__)
-short mpeek ( MESG * md )
-#else
-short mpeek (md)
- MESG *md;
-#endif
-{
- int size;
-
- if (md->type == MD_USR_FIFO || md->type == MD_SYS_FIFO)
- return(peek3_2(md->readfd) - EXCESS_3_2_LEN);
-
- if (ioctl(md->readfd, I_NREAD, &size))
- return((short)size);
-
- return(-1);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mlisten.c b/usr/src/cmd/lp/lib/msgs/mlisten.c
deleted file mode 100644
index b792801ccf..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mlisten.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-# include <unistd.h>
-# include <stdlib.h>
-# include <string.h>
-# include <poll.h>
-# include <stropts.h>
-# include <fcntl.h>
-# include <errno.h>
-#include <syslog.h>
-#include <user_attr.h>
-#include <secdb.h>
-#include <pwd.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-#define TURN_ON(X,F) (void)Fcntl(X, F_SETFL, (Fcntl(X, F_GETFL, 0)|(F)))
-
-static int NumEvents = 0;
-static int NumCons = 0;
-static int ConsSize= 0;
-static int NumNewCons = 0;
-static MESG ** Connections = NULL;
-static struct pollfd * PollFdList = NULL;
-
-int
-mlisteninit(MESG * md)
-{
- if (md == NULL)
- {
- errno = EINVAL;
- return(-1);
- }
-
- if (ConsSize > 0)
- {
- errno = EBUSY;
- return(-1);
- }
-
- ConsSize = 20;
- Connections = (MESG **) Malloc(ConsSize * MDSIZE);
- PollFdList = (struct pollfd*) Malloc(ConsSize * sizeof(struct pollfd));
- if (Connections == NULL || PollFdList == NULL)
- {
- errno = ENOMEM;
- return(-1);
- }
- Connections[0] = md;
- PollFdList[0].fd = md->readfd;
- PollFdList[0].events = POLLIN;
- PollFdList[0].revents = 0;
- NumCons = 1;
- return(0);
-}
-
-int
-mlistenadd(MESG * md, short events)
-{
- int slack;
- struct pollfd * fdp;
-
- /*
- ** See if we have room in the connection table.
- ** Realloc(3) the table if the number of connections
- ** changes by more than 20.
- */
-
- slack = ConsSize - (NumCons + NumNewCons + 1);
-
- if (slack < 0)
- {
- ConsSize += 20;
- Connections = (MESG **) Realloc(Connections, ConsSize * MDSIZE);
- PollFdList = (struct pollfd*) Realloc(PollFdList, ConsSize * sizeof(struct pollfd));
- if (Connections == NULL || PollFdList == NULL)
- {
- errno = ENOMEM;
- return(-1);
- }
- }
-
- if (slack > 20)
- {
- ConsSize -= 20;
- Connections = (MESG **) Realloc(Connections, ConsSize * MDSIZE);
- PollFdList = (struct pollfd*) Realloc(PollFdList, ConsSize * sizeof(struct pollfd));
- if (Connections == NULL || PollFdList == NULL)
- {
- errno = ENOMEM;
- return(-1);
- }
- }
-
- fdp = PollFdList + (NumCons + NumNewCons);
- fdp->fd = md->readfd;
- fdp->events = events;
- fdp->revents = 0;
-
- /*
- ** Now add the entry to the connection table
- ** NumCons will be updated above.
- */
- Connections[NumCons + NumNewCons++] = md;
- return(0);
-}
-
-MESG *
-mlistenreset ( void ) /* funcdef */
-{
- int x;
- MESG * md;
-
- if (ConsSize == 0)
- return(NULL);
-
- ConsSize = 0;
-
- for (x = 1; x < NumCons; x++)
- (void) mdisconnect(Connections[x]);
-
- md = Connections[0];
-
- Free(Connections);
- Free(PollFdList);
-
- Connections = NULL;
- PollFdList = NULL;
- NumCons = 0;
- NumNewCons = 0;
- NumEvents = 0;
- return(md);
-}
-
-MESG *
-mlisten()
-{
- extern uid_t Lp_Uid;
-
- MESG * mdp;
- MESG * md;
- MQUE * p;
- int flag = 0;
- int disconacts;
- int x;
- int y;
- struct pollfd * fdp;
- struct strrecvfd recbuf;
-#if defined(NOCONNLD)
- struct strbuf ctl;
- char cbuff[MSGMAX];
-#endif
-
-#if defined(NOCONNLD)
- /*
- ** Set up buffer for receiving messages.
- */
- ctl.buf = cbuff;
- ctl.maxlen = sizeof (cbuff);
-#endif
-
- /*
- ** This loop exists to return control to poll after the
- ** result of poll yeilds no new connections or serviceable
- ** messages.
- */
- for (;;)
- {
- /*
- ** If there are no unserviced events pending, call poll(2)
- ** and wait for a message or connection.
- ** NumEvents may be -1 in the event of an interrupt, hence
- ** <= 0
- */
- if (NumEvents <= 0)
- {
- /*
- ** Add new connections, if any, reset connection counter
- */
- NumCons += NumNewCons;
- NumNewCons = 0;
-
- if (NumCons <= 0)
- {
- errno = EINTR;
- return(NULL);
- }
-
- /*
- ** Scan the connection table and remove any holes
- */
- for (x = 0; x < NumCons; x++)
- {
- mdp = Connections[x];
-
- /*
- ** Disconnected, clear the node and compress the
- ** tables. If the disconnect called any
- ** on_discon functions (disconacts > 0), return
- ** because there may be something to clean up.
- ** Finally, decrement <x> so that the next node
- ** doesn't get missed.
- */
- if (mdp->readfd == -1)
- {
- disconacts = mdisconnect(mdp);
- NumCons--;
- for (y = x; y < (NumCons + NumNewCons); y++)
- {
- Connections[y] = Connections[y + 1];
- PollFdList[y] = PollFdList[y + 1];
- }
- if (disconacts > 0)
- {
- errno = EINTR;
- return(NULL);
- }
- else
- x--;
- } else {
- /*
- * We are in "mlisten", POLLIN is always set. We'll look
- * at POLLOUT possibility when mque is non-NULL.
- */
- PollFdList[x].events = POLLIN;
- if (mdp->mque)
- PollFdList[x].events |= POLLOUT;
- }
- }
-
- /*
- ** Wait for a message or a connection.
- ** This call may be interrupted by alarms used
- ** elsewhere, so if poll fails, return NULL and
- ** set errno to EAGAIN.
- */
- if ((NumEvents = poll(PollFdList, NumCons, -1)) < 0)
- {
- errno = EAGAIN;
- return(NULL);
- }
- }
-
- for (x = 0; x < NumCons; x++)
- {
- mdp = Connections[x];
- fdp = PollFdList + x;
-
- if (fdp->revents == 0)
- continue;
-
- switch (mdp->type) {
- case MD_MASTER:
- /*
- ** Only valid revent is: POLLIN
- */
- if (fdp->revents != POLLIN)
- {
- errno = EINVAL;
- return(NULL);
- }
-
- /*
- ** Retrieve the file descriptor
- */
- if (ioctl(mdp->readfd, I_RECVFD, &recbuf) != 0)
- {
- if (errno == EINTR)
- {
- errno = EAGAIN;
- return(NULL);
- }
- if (errno == ENXIO)
- {
- fdp->revents = 0;
- NumEvents--;
- continue;
- }
-#if defined(NOCONNLD)
- if (errno == EBADMSG)
- while (Getmsg(mdp, &ctl, &ctl, &flag) >= 0);
-#endif
- return(NULL);
- }
-
- TURN_ON(recbuf.fd, O_NDELAY);
- /*
- ** Now, create the message descriptor
- ** and populate it with what we know.
- */
- if ((md = (MESG *)Malloc(MDSIZE)) == NULL)
- {
- errno = ENOMEM;
- return(NULL);
- }
-
- memset(md, 0, sizeof (MESG));
- md->gid = recbuf.gid;
- md->readfd = md->writefd = recbuf.fd;
- md->state = MDS_IDLE;
- md->type = MD_UNKNOWN;
- md->uid = recbuf.uid;
-
- /*
- * Determine if a print administrator is contacting lpsched.
- * currently, root, lp and users with the "solaris.print.admin"
- * privilege are print administrators
- */
- md->admin = (md->uid == 0 || md->uid == Lp_Uid);
- if (md->admin == 0) {
- struct passwd *pw = NULL;
-
- if ((pw = getpwuid(md->uid)) != NULL)
- md->admin = chkauthattr("solaris.print.admin",
- pw->pw_name);
- }
-
- get_peer_label(md->readfd, &md->slabel);
-
- if (mlistenadd(md, POLLIN) != 0)
- return(NULL);
-
- ResetFifoBuffer (md->readfd);
- /*
- ** Reset fdp because mlistenadd may have
- ** realloc()ed PollFdList and changed its
- ** physical location.
- */
- fdp = PollFdList + x;
-
- /*
- ** Clear the event that brought us here,
- ** decrement the event counter, and get the
- ** next event.
- */
- fdp->revents = 0;
- NumEvents--;
- break;
-
- case MD_CHILD:
- /*
- ** If this connection is a child process, just
- ** save the event and return the message descriptor
- */
-
- if (fdp->revents & POLLOUT) {
- if (mdp->mque) {
- if (mflush(mdp) < 0) {
- syslog(LOG_DEBUG,
- "MD_CHILD mflush failed");
- }
- }
- }
-
- if (fdp->revents & POLLIN) {
- mdp->event = fdp->revents;
- NumEvents--;
- fdp->revents = 0;
- return (mdp); /* we are in listening mode */
- }
-
- NumEvents--;
- fdp->revents = 0;
- break;
-
- default:
- /*
- ** POLLNVAL means this client disconnected and
- ** all messages have been processed.
- */
- if (fdp->revents & POLLNVAL) /* disconnected & no msg */
- {
- if (mdp->readfd >= 0) {
- Close (mdp->readfd);
- if (mdp->writefd == mdp->readfd)
- mdp->writefd = -1;
- mdp->readfd = -1;
- }
- fdp->revents = 0;
- NumEvents--;
- continue;
- }
-
- /*
- ** POLLERR means an error message is on the
- ** stream. Since this is totally unexpected,
- ** the assumption is made that this stream will
- ** be flagged POLLNVAL next time through poll
- ** and will be removed at that time.
- */
- if (fdp->revents & POLLERR) /* uh, oh! */
- {
- if (mdp->readfd >= 0) {
- Close (mdp->readfd);
- if (mdp->writefd == mdp->readfd)
- mdp->writefd = -1;
- mdp->readfd = -1;
- }
- NumEvents--;
- fdp->revents = 0;
- continue;
- }
-
-
- /*
- ** POLLHUP means the client aborted the call.
- ** The client is not removed, because there may
- ** still be messages on the stream.
- */
- if (fdp->revents & POLLHUP) /* disconnected */
- {
- NumEvents--;
- fdp->revents = 0;
- /*
- * MORE: This is odd. Why are we closing the
- * stream if there ``may still be messages''???
- */
- if (mdp->readfd >= 0) {
- Close (mdp->readfd);
- if (mdp->writefd == mdp->readfd)
- mdp->writefd = -1;
- mdp->readfd = -1;
- }
- continue;
-
- /*
- * MORE: Why is this here??
- *
- if (mdp->type == MD_SYS_FIFO)
- (void) Close(mdp->writefd);
-
- mdp->writefd = -1;
-
- if (fdp->revents == POLLHUP)
- {
- NumEvents--;
- fdp->revents = 0;
- (void) Close(mdp->readfd);
- mdp->readfd = -1;
- continue;
- }
- *
- */
- }
- /*
- ** POLLOUT means that the client had a full
- ** stream and messages became backlogged and
- ** now the stream is empty. So the queued msgs
- ** are sent with putmsg(2)
- */
- if (fdp->revents & POLLOUT)
- {
- if (mdp->mque == NULL)
- {
- NumEvents--;
- fdp->revents = 0;
- continue;
- }
- while (mdp->mque) {
- if (Putmsg(mdp, NULL, mdp->mque->dat, 0))
- break; /* failed for some reason */
- p = mdp->mque;
- mdp->mque = p->next;
- Free(p->dat->buf);
- Free(p->dat);
- Free(p);
- }
- NumEvents--;
- fdp->revents = 0;
- continue;
- }
-
- /*
- ** POLLIN means that there is a message on the
- ** stream.
- ** Return the message descriptor to the caller
- ** so that the message may be received and
- ** processed.
- */
- if (fdp->revents & POLLIN) /* got a message */
- {
- NumEvents--;
- mdp->event = fdp->revents;
- fdp->revents = 0;
- if (mdp->type == MD_UNKNOWN)
- mdp->type = MD_STREAM;
- return(mdp);
- }
- break;
- }
- }
- }
-}
-
-# define VOID_FUNC_PTR void (*)()
-# define PTR_TO_VOID_FUNC_PTR void (**)()
-
-int
-mon_discon(MESG * md, void (*fn)())
-{
- int size = 2;
- void (**fnp) ();
-
- if (md->on_discon)
- {
- for (fnp = md->on_discon; *fnp; fnp++)
- size++;
- if ((md->on_discon = (PTR_TO_VOID_FUNC_PTR) Realloc (md->on_discon, size * sizeof(VOID_FUNC_PTR))) == NULL)
- {
- errno = ENOMEM;
- return(-1);
- }
- }
- else
- if ((md->on_discon = (PTR_TO_VOID_FUNC_PTR) Malloc (size * sizeof(VOID_FUNC_PTR))) == NULL)
- {
- errno = ENOMEM;
- return(-1);
- }
-
- size--;
- md->on_discon[size] = NULL;
- size--;
- md->on_discon[size] = fn;
- return(0);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mneeds.c b/usr/src/cmd/lp/lib/msgs/mneeds.c
deleted file mode 100644
index a1f48b78bb..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mneeds.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-/* LINTLIBRARY */
-
-/**
- ** mneeds() - RETURN NUMBER OF FILE DESCRIPTORS NEEDED BY mopen()
- **/
-
-int mneeds ( )
-{
- /*
- * This is the expected number of file descriptors needed.
- */
- return (4);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mopen.c b/usr/src/cmd/lp/lib/msgs/mopen.c
deleted file mode 100644
index 8ae14e27cc..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mopen.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* LINTLIBRARY */
-
-# include <errno.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-
-MESG *lp_Md = 0;
-
-/*
-** mopen() - OPEN A MESSAGE PATH
-*/
-
-int
-mopen ()
-{
- if (lp_Md != NULL)
- {
- errno = EEXIST;
- return (-1);
- }
-
- if ((lp_Md = mconnect(Lp_FIFO, 0, 0)) == NULL)
- return(-1);
-
- return(0);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mread.c b/usr/src/cmd/lp/lib/msgs/mread.c
deleted file mode 100644
index 754b884bbd..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mread.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* LINTLIBRARY */
-
-
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stropts.h>
-
-#include "lp.h"
-#include "msgs.h"
-
-extern int Lp_prio_msg;
-
-/*
-** Function: int mread( MESG *, char *, int)
-** Args: message descriptor
-** message buffer (var)
-** buffer size
-** Return: The size of the message in message buffer.
-** or -1 on error. Possible errnos are:
-** EINVAL Bad value for md or msgbuf.
-** E2BIG Not enough space for message.
-** EPIPE Far end dropped the connection.
-** ENOMSG No valid message available on fifo.
-**
-** mread examines message descriptor and either calls read3_2
-** to read 3.2 HPI messages or getmsg(2) to read 4.0 HPI messages.
-** If a message is read, it is returned in message buffer.
-*/
-
-#if defined(__STDC__)
-int mread ( MESG * md, char * msgbuf, int size )
-#else
-int mread ( md, msgbuf, size )
-MESG *md;
-char *msgbuf;
-int size;
-#endif
-{
- int flag = 0;
- char buff [MSGMAX];
- struct strbuf dat;
- struct strbuf ctl;
-
- if (md == NULL || msgbuf == NULL)
- {
- errno = EINVAL;
- return(-1);
- }
-
- switch(md->type)
- {
- case MD_CHILD:
- case MD_STREAM:
- case MD_BOUND:
- if (size <= 0)
- {
- errno = E2BIG;
- return(-1);
- }
- dat.buf = msgbuf;
- dat.maxlen = size;
- dat.len = 0;
- ctl.buf = buff;
- ctl.maxlen = sizeof (buff);
- ctl.len = 0;
- flag = Lp_prio_msg;
- Lp_prio_msg = 0; /* clean this up so there are no surprises */
-
- if (Getmsg(md, &ctl, &dat, &flag) < 0)
- {
- if (errno == EBADF)
- errno = EPIPE;
- return(-1);
- }
-
- if (dat.len == 0)
- {
- (void) Close(md->readfd);
- return(0);
- }
- break;
-
- case MD_USR_FIFO:
- case MD_SYS_FIFO:
- if (size < CONTROL_LEN)
- {
- errno = E2BIG;
- return(-1);
- }
-
- if (read3_2(md, msgbuf, size) < 0)
- return(-1);
- break;
- }
-
- return((int)msize(msgbuf));
-}
diff --git a/usr/src/cmd/lp/lib/msgs/mrecv.c b/usr/src/cmd/lp/lib/msgs/mrecv.c
deleted file mode 100644
index 9708cc1e61..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mrecv.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-/* LINTLIBRARY */
-# include <errno.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-extern MESG *lp_Md;
-
-/*
-** mrecv() - RECEIVE A MESSAGE
-*/
-
-int
-mrecv (msgbuf, size)
-char *msgbuf;
-int size;
-{
- int n;
-
- /*
- ** Restart interrupted reads for binary compatibility.
- */
- do
- n = mread(lp_Md, msgbuf, size);
- while (n < 0 && errno == EINTR);
-
- /*
- ** Return EIDRM on disconnect for binary compatibility.
- */
- if (errno == EPIPE)
- errno = EIDRM;
-
- if (n <= 0)
- return(-1);
-
- return(getmessage(msgbuf, I_GET_TYPE));
-}
diff --git a/usr/src/cmd/lp/lib/msgs/msend.c b/usr/src/cmd/lp/lib/msgs/msend.c
deleted file mode 100644
index 63cdb30a35..0000000000
--- a/usr/src/cmd/lp/lib/msgs/msend.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-/* LINTLIBRARY */
-# include <errno.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-extern MESG *lp_Md;
-extern int discon3_2_is_running;
-
-/*
-** msend() - SEND A MESSAGE VIA FIFOS
-*/
-
-#if defined(__STDC__)
-int msend ( char * msgbuf )
-#else
-int msend (msgbuf)
- char *msgbuf;
-#endif
-{
- int rval;
-
- do
- {
- if ((rval = mwrite(lp_Md, msgbuf)) < 0)
- {
- /*
- ** "mclose()" will try to say goodbye to the Spooler,
- ** and that, of course, will fail. But we'll call
- ** "mclose()" anyway, for the other cleanup it does.
- */
- if (errno == EPIPE)
- {
- if (!discon3_2_is_running)
- (void)mclose ();
- errno = EIDRM;
- }
- }
- }
- while (rval < 0 && errno == EINTR);
-
- return(rval);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/msgfmts.c b/usr/src/cmd/lp/lib/msgs/msgfmts.c
deleted file mode 100644
index 100f0b9730..0000000000
--- a/usr/src/cmd/lp/lib/msgs/msgfmts.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* LINTLIBRARY */
-
-char *_lp_msg_fmts[] =
-{
- "", /* 0 - R_BAD_MESSAGE */
- "HSS", /* 1 - S_NEW_QUEUE */
- "H", /* 2 - R_NEW_QUEUE */
- "H", /* 3 - S_ALLOC_FILES */
- "HS", /* 4 - R_ALLOC_FILES */
- "S", /* 5 - S_PRINT_REQUEST */
- "HSL", /* 6 - R_PRINT_REQUEST */
- "S", /* 7 - S_START_CHANGE_REQUEST */
- "HS", /* 8 - R_START_CHANGE_REQUEST */
- "S", /* 9 - S_END_CHANGE_REQUEST */
- "HL", /* 10 - R_END_CHANGE_REQUEST */
- "S", /* 11 - S_CANCEL_REQUEST */
- "H", /* 12 - R_CANCEL_REQUEST */
- "SSSSS", /* 13 - S_INQUIRE_REQUEST */
- "HSSSLLHSSSS", /* 14 - R_INQUIRE_REQUEST */
- "S", /* 15 - S_LOAD_PRINTER */
- "H", /* 16 - R_LOAD_PRINTER */
- "S", /* 17 - S_UNLOAD_PRINTER */
- "H", /* 18 - R_UNLOAD_PRINTER */
- "S", /* 19 - S_INQUIRE_PRINTER_STATUS */
- "HSSSSSHSLL", /* 20 - R_INQUIRE_PRINTER_STATUS */
- "S", /* 21 - S_LOAD_CLASS */
- "H", /* 22 - R_LOAD_CLASS */
- "S", /* 23 - S_UNLOAD_CLASS */
- "H", /* 24 - R_UNLOAD_CLASS */
- "S", /* 25 - S_INQUIRE_CLASS */
- "HSHSL", /* 26 - R_INQUIRE_CLASS */
- "SSS", /* 27 - S_MOUNT */
- "H", /* 28 - R_MOUNT */
- "SSS", /* 29 - S_UNMOUNT */
- "H", /* 30 - R_UNMOUNT */
- "SS", /* 31 - S_MOVE_REQUEST */
- "HL", /* 32 - R_MOVE_REQUEST */
- "SS", /* 33 - S_MOVE_DEST */
- "HSH", /* 34 - R_MOVE_DEST */
- "S", /* 35 - S_ACCEPT_DEST */
- "H", /* 36 - R_ACCEPT_DEST */
- "SS", /* 37 - S_REJECT_DEST */
- "H", /* 38 - R_REJECT_DEST */
- "S", /* 39 - S_ENABLE_DEST */
- "H", /* 40 - R_ENABLE_DEST */
- "SSH", /* 41 - S_DISABLE_DEST */
- "HS", /* 42 - R_DISABLE_DEST */
- "", /* 43 - S_LOAD_FILTER_TABLE */
- "H", /* 44 - R_LOAD_FILTER_TABLE */
- "", /* 45 - S_UNLOAD_FILTER_TABLE */
- "H", /* 46 - R_UNLOAD_FILTER_TABLE */
- "S", /* 47 - S_LOAD_PRINTWHEEL */
- "H", /* 48 - R_LOAD_PRINTWHEEL */
- "S", /* 49 - S_UNLOAD_PRINTWHEEL */
- "H", /* 50 - R_UNLOAD_PRINTWHEEL */
- "", /* 51 - S_LOAD_USER_FILE */
- "H", /* 52 - R_LOAD_USER_FILE */
- "", /* 53 - S_UNLOAD_USER_FILE */
- "H", /* 54 - R_UNLOAD_USER_FILE */
- "S", /* 55 - S_LOAD_FORM */
- "H", /* 56 - R_LOAD_FORM */
- "S", /* 57 - S_UNLOAD_FORM */
- "H", /* 58 - R_UNLOAD_FORM */
- "S", /* 59 - S_GETSTATUS */
- "S", /* 60 - R_GETSTATUS */
- "SH", /* 61 - S_QUIET_ALERT */
- "H", /* 62 - R_QUIET_ALERT */
- "SLS", /* 63 - S_SEND_FAULT */
- "H", /* 64 - R_SEND_FAULT */
- "H", /* 65 - S_SHUTDOWN */
- "H", /* 66 - R_SHUTDOWN */
- "", /* 67 - S_GOODBYE */
- "LHH", /* 68 - S_CHILD_DONE */
- "", /* 69 - I_GET_TYPE */
- "", /* 70 - I_QUEUE_CHK */
- "SH", /* 71 - R_CONNECT */
- "SSHH", /* 72 - S_GET_STATUS */
- "HSHH", /* 73 - R_GET_STATUS */
- "HSSSSS", /* 74 - S_INQUIRE_REQUEST_RANK */
- "HSSSLLHSSSHS", /* 75 - R_INQUIRE_REQUEST_RANK */
- "SSS", /* 76 - S_CANCEL */
- "HLS", /* 77 - R_CANCEL */
- "S", /* 78 - S_NEW_CHILD */
- "SSH", /* 79 - R_NEW_CHILD */
- "SHSD", /* 80 - S_SEND_JOB */
- "SHD", /* 81 - R_SEND_JOB */
- "HSS", /* 82 - S_JOB_COMPLETED */
- "H", /* 83 - R_JOB_COMPLETED */
- "S", /* 84 - S_INQUIRE_REMOTE_PRINTER */
-/* "", */ /* - the R_INQUIRE_REMOTE_STATUS uses format 20 */
- "H", /* 85 - S_CHILD_SYNC */
- "S", /* 86 - S_LOAD_SYSTEM */
- "H", /* 87 - R_LOAD_SYSTEM */
- "S", /* 88 - S_UNLOAD_SYSTEM */
- "H", /* 89 - R_UNLOAD_SYSTEM */
- "SLS", /* 90 - S_CLEAR_FAULT */
- "H", /* 91 - R_CLEAR_FAULT */
- "SSSH", /* 92 - S_MOUNT_TRAY */
- "H", /* 93 - R_MOUNT_TRAY */
- "SSSH", /* 94 - S_UNMOUNT_TRAY */
- "H", /* 95 - R_UNMOUNT_TRAY */
- "SH", /* 96 - S_MAX_TRAYS */
- "H", /* 97 - R_MAX_TRAY */
- "SHSHH", /* 98 - S_PAPER_CHANGED */
- "H", /* 99 - R_PAPER_CHANGED */
- "S", /* 100 - S_PAPER_ALLOWED */
- "HSS", /* 101 - R_PAPER_ALLOWED */
- "", /* 102 - S_PASS_PEER_CONNECTION */
- "H", /* 103 - R_PASS_PEER_CONNECTION */
- 0,
-};
diff --git a/usr/src/cmd/lp/lib/msgs/mwrite.c b/usr/src/cmd/lp/lib/msgs/mwrite.c
deleted file mode 100644
index b19a4bbb68..0000000000
--- a/usr/src/cmd/lp/lib/msgs/mwrite.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-/* LINTLIBRARY */
-
-# include <errno.h>
-# include <string.h>
-# include <stropts.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-int Lp_prio_msg = 0;
-
-static int _mwrite ( MESG * md , char * msgbuf , int );
-
-/*
- * mflush()
- * return 0
- * if it successfully writes all the queued message(s), or
- * if some of them (errno is EAGAIN in this case).
- * return -1 (with errno) when it failed.
- */
-
-int
-mflush(MESG *md)
-{
- MQUE *p;
-
- errno = 0;
- if (md == NULL || md->mque == NULL) {
- errno = ENXIO;
- return (-1);
- }
-
- while ((p = md->mque) != NULL) {
- if (_mwrite(md, p->dat->buf, p->dat->len) != 0)
- return (errno == EAGAIN ? 0 : -1);
-
- /* mwrite successful, get the next and free this entry */
- md->mque = p->next;
- Free(p->dat->buf);
- Free(p->dat);
- Free(p);
- }
-
- return (0);
-}
-
-/*
- * mwrite()
- * return 0
- * if it successfully writes the messages, or
- * if it has been queued (errno is EAGAIN in this case)
- * and md->mque is updated.
- * return -1 (with errno) when it failed.
- */
-
-int mwrite ( MESG * md, char * msgbuf )
-{
- short size;
- MQUE * p;
- MQUE * q;
-
- errno = 0;
- if (md == NULL)
- {
- errno = ENXIO;
- return(-1);
- }
- if (msgbuf == NULL)
- {
- errno = EINVAL;
- return(-1);
- }
-
- size = stoh(msgbuf);
-
- if (LAST_MESSAGE < stoh(msgbuf + MESG_TYPE))
- {
- errno = EINVAL;
- return (-1);
- }
- if (md->mque)
- goto queue; /* if there is a queue already, try to write all */
-
- if (_mwrite(md, msgbuf, size) == 0)
- return(0);
-
- if (errno != EAGAIN)
- return(-1);
-
- /*
- * fall through to queue the messages that cannot be sent now.
- */
-
-queue:
- if ((p = (MQUE *)Malloc(sizeof(MQUE))) == NULL
- || (p->dat = (struct strbuf *)Malloc(sizeof(struct strbuf))) == NULL
- || (p->dat->buf = (char *)Malloc(size)) == NULL)
- {
- errno = ENOMEM;
- return(-1);
- }
- (void) memcpy(p->dat->buf, msgbuf, size);
- p->dat->len = size;
- p->next = 0;
-
- if ((q = md->mque) != NULL)
- {
- /* insert the new one to tail */
- while (q->next)
- q = q->next;
- q->next = p;
-
- while ((p = md->mque) != NULL)
- {
- if (_mwrite(md, p->dat->buf, p->dat->len) != 0) {
- return (errno == EAGAIN ? 0 : -1);
- }
-
- /* mwrite successful, get the next and free this entry */
- md->mque = p->next;
- Free(p->dat->buf);
- Free(p->dat);
- Free(p);
- }
- }
- else
- md->mque = p;
-
- return(0);
-}
-
-int _mwrite ( MESG * md, char * msgbuf , int size )
-{
- int flag = 0;
- struct strbuf ctl;
- struct strbuf dat;
-
- switch (md->type)
- {
- case MD_CHILD:
- case MD_STREAM:
- case MD_BOUND:
- if (size <= 0 || size > MSGMAX)
- {
- errno = EINVAL;
- return(-1);
- }
-
- ctl.buf = "xyzzy";
- ctl.maxlen = ctl.len = strlen(ctl.buf)+1;
- dat.buf = msgbuf;
- dat.maxlen = dat.len = size;
- flag = Lp_prio_msg;
- Lp_prio_msg = 0; /* clean this up so there are no surprises */
-
- if (Putmsg(md, &ctl, &dat, flag) == 0)
- return(0);
- return(-1);
-
- case MD_SYS_FIFO:
- case MD_USR_FIFO:
- switch (write3_2(md, msgbuf, size))
- {
- case -1:
- return(-1);
- case 0:
- break;
- default:
- return(0);
- }
- break;
-
- default:
- errno = EINVAL;
- return(-1);
- }
- return 0;
-}
diff --git a/usr/src/cmd/lp/lib/msgs/putmessage.c b/usr/src/cmd/lp/lib/msgs/putmessage.c
deleted file mode 100644
index 0c50487c21..0000000000
--- a/usr/src/cmd/lp/lib/msgs/putmessage.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-/* LINTLIBRARY */
-
-#if defined(__STDC__)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
-
-/* VARARGS */
-#if defined(__STDC__)
-int putmessage(char * buf, short type, ... )
-#else
-int putmessage(buf, type, va_alist)
- char *buf;
- short type;
- va_dcl
-#endif
-{
- int size;
- va_list arg;
- int _putmessage();
-
-#if defined(__STDC__)
- va_start(arg, type);
-#else
- va_start(arg);
-#endif
-
- size = _putmessage(buf, type, arg);
- va_end(arg);
- return(size);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/read_fifo.c b/usr/src/cmd/lp/lib/msgs/read_fifo.c
deleted file mode 100644
index c30e39ba97..0000000000
--- a/usr/src/cmd/lp/lib/msgs/read_fifo.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* LINTLIBRARY */
-
-# include <errno.h>
-# include <string.h>
-#include <syslog.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-extern char Resync[];
-extern char Endsync[];
-static int Had_Full_Buffer = 1;
-int Garbage_Bytes = 0;
-int Garbage_Messages= 0;
-
-static int _buffer(int);
-
-/*
-** A real message is written in one piece, and the write
-** is atomic. Thus, even if the O_NDELAY flag is set,
-** if we read part of the real message, we can continue
-** to read the rest of it in as many steps as we want
-** (up to the size of the message, of course!) without
-** UNIX returning 0 because no data is available.
-** So, a real message doesn't have to be read in one piece,
-** which is good since we don't know how much to read!
-**
-** Fake messages, or improperly written messages, don't
-** have this nice property.
-**
-** INTERRUPTED READS:
-**
-** If a signal occurs during an attempted read, we can exit.
-** The caller can retry the read and we will correctly restart
-** it. The correctness of this assertion can be seen by noticing
-** that at the beginning of each READ below, we can go back
-** to the first statement executed (the first READ below)
-** and correctly reexecute the code.
-**
-** If the last writer closed the fifo, we'll read 0 bytes
-** (at least on the subsequent read). If we were in the
-** middle of reading a message, we were reading a bogus
-** message (but see below).
-**
-** If we read less than we expect, it's because we were
-** reading a fake message (but see below).
-**
-** HOWEVER: In the last two cases, we may have ONE OR MORE
-** REAL MESSAGES snuggled in amongst the trash!
-**
-** All this verbal rambling is preface to let you understand why we
-** buffer the data (which is a shame, but necessary).
-*/
-
-/*
-** As long as we get real messages, we can avoid needless function calls.
-** The SYNC argument in this macro should be set if the resynch. bytes
-** have been read--i.e. if the rest of the message is trying to be read.
-** In this case, if we had not read a full buffer last time, then we
-** must be in the middle of a bogus message.
-*/
-
-#define UNSYNCHED_READ(N) \
- if (fbp->psave_end - fbp->psave < N || fbp->psave >= fbp->psave_end) \
- { \
- switch (_buffer(fifo)) \
- { \
- case -1: \
- return (-1); \
- case 0: \
- if (fbp->psave_end > fbp->psave) \
- goto SyncUp; \
- return (0); \
- } \
- }
-
-#define SYNCHED_READ(N) \
- if (fbp->psave_end - fbp->psave < N || fbp->psave >= fbp->psave_end) \
- { \
- switch (_buffer(fifo)) \
- { \
- case -1: \
- return (-1); \
- case 0: \
- if (fbp->psave_end > fbp->psave) \
- goto SyncUp; \
- return (0); \
- } \
- if (!Had_Full_Buffer) \
- goto SyncUp; \
- }
-
-/*
-** read_fifo() - READ A BUFFER WITH HEADER AND CHECKSUM
-*/
-int
-read_fifo (fifo, buf, size)
-int fifo;
-char *buf;
-unsigned int size;
-{
- register fifobuffer_t *fbp;
- register unsigned int real_chksum,
- chksum,
- real_size;
-
- /*
- ** Make sure we start on a message boundary. The first
- ** line of defense is to look for the resync. bytes.
- **
- ** The "SyncUp" label is global to this routine (below this point)
- ** and is called whenever we determine that we're out
- ** of sync. with the incoming bytes.
- */
-
- if (!(fbp=GetFifoBuffer (fifo)))
- return -1;
-
- UNSYNCHED_READ (HEAD_RESYNC_LEN);
- while (*fbp->psave != Resync[0] || *(fbp->psave + 1) != Resync[1])
- {
-SyncUp:
-#if defined(TRACE_MESSAGES)
- if (trace_messages)
- syslog(LOG_DEBUG, "DISCARD %c\n", *fbp->psave);
-#endif
- fbp->psave++;
- Garbage_Bytes++;
- UNSYNCHED_READ (HEAD_RESYNC_LEN);
- }
-
-
- /*
- ** We're sync'd, so read the full header.
- */
-
- SYNCHED_READ (HEAD_LEN);
-
-
- /*
- ** If the header size is smaller than the minimum size for a header,
- ** or larger than allowed, we must assume that we really aren't
- ** synchronized.
- */
-
- real_size = stoh(fbp->psave + HEAD_SIZE);
- if (real_size < CONTROL_LEN || MSGMAX < real_size)
- {
-#if defined(TRACE_MESSAGES)
- if (trace_messages)
- syslog(LOG_DEBUG, "BAD SIZE\n");
-#endif
- goto SyncUp;
- }
-
- /*
- ** We have the header. Now we can finally read the rest of the
- ** message...
- */
-
- SYNCHED_READ (real_size);
-
-
- /*
- ** ...but did we read a real message?...
- */
-
- if
- (
- *(fbp->psave + TAIL_ENDSYNC(real_size)) != Endsync[0]
- || *(fbp->psave + TAIL_ENDSYNC(real_size) + 1) != Endsync[1]
- )
- {
-#if defined(TRACE_MESSAGES)
- if (trace_messages)
- syslog(LOG_DEBUG, "BAD ENDSYNC\n");
-#endif
- Garbage_Messages++;
- goto SyncUp;
- }
-
- chksum = stoh(fbp->psave + TAIL_CHKSUM(real_size));
- CALC_CHKSUM (fbp->psave, real_size, real_chksum);
- if (real_chksum != chksum)
- {
-#if defined(TRACE_MESSAGES)
- if (trace_messages)
- syslog(LOG_DEBUG, "BAD CHKSUM\n");
-#endif
- Garbage_Messages++;
- goto SyncUp;
- }
-
- /*
- ** ...yes!...but can the caller handle the message?
- */
-
- if (size < real_size)
- {
- errno = E2BIG;
- return (-1);
- }
-
-
- /*
- ** Yes!! We can finally copy the message into the caller's buffer
- ** and remove it from our buffer. That wasn't so bad, was it?
- */
-
-#if defined(TRACE_MESSAGES)
- if (trace_messages)
- syslog(LOG_DEBUG, "MESSAGE: %-.*s", real_size, fbp->psave);
-#endif
- (void)memcpy (buf, fbp->psave, real_size);
- fbp->psave += real_size;
- return (real_size);
-}
-
-int
-peek3_2 (fifo)
-int fifo;
-{
- register fifobuffer_t *fbp;
- register unsigned int real_size;
-
- /*
- ** Make sure we start on a message boundary. The first
- ** line of defense is to look for the resync. bytes.
- **
- ** The "SyncUp" label is global to this routine (below this point)
- ** and is called whenever we determine that we're out
- ** of sync. with the incoming bytes.
- */
-
- if (!(fbp=GetFifoBuffer (fifo)))
- return -1;
- UNSYNCHED_READ (HEAD_RESYNC_LEN);
- while (*fbp->psave != Resync[0] || *(fbp->psave + 1) != Resync[1])
- {
-SyncUp:
- fbp->psave++;
- Garbage_Bytes++;
- UNSYNCHED_READ (HEAD_RESYNC_LEN);
- }
-
-
- /*
- ** We're sync'd, so read the full header.
- */
-
- SYNCHED_READ (HEAD_LEN);
-
-
- /*
- ** If the header size is smaller than the minimum size for a header,
- ** or larger than allowed, we must assume that we really aren't
- ** synchronized.
- */
-
- real_size = stoh(fbp->psave + HEAD_SIZE);
- if (real_size < CONTROL_LEN || MSGMAX < real_size)
- {
- goto SyncUp;
- }
-
- return(real_size);
-}
-
-static int
-_buffer(int fifo)
-{
- int n, nbytes, count = 0;
- register fifobuffer_t *fbp;
-
- /*
- ** As long as we get real messages, and if we chose
- ** SAVE_SIZE well, we shouldn't have to move the data
- ** in the "else" branch below: Each time we call "read"
- ** we aren't likely to get as many bytes as we ask for,
- ** just as many as are in the fifo, AND THIS SHOULD
- ** REPRESENT AN INTEGRAL NUMBER OF MESSAGES. Since
- ** the "read_fifo" routine reads complete messages,
- ** it will end its read at the end of the message,
- ** which (eventually) will make "psave_end" == "psave".
- */
-
- /*
- ** If the buffer is empty, there's nothing to move.
- */
- if (!(fbp = GetFifoBuffer (fifo)))
- return -1;
- if (fbp->psave_end == fbp->psave)
- fbp->psave = fbp->psave_end = fbp->save; /* sane pointers! */
-
- /*
- ** If the buffer has data at the high end, move it down.
- */
- else
- if (fbp->psave != fbp->save) /* sane pointers! */
- {
- /*
- ** Move the data still left in the buffer to the
- ** front, so we can read as much as possible into
- ** buffer after it.
- */
-
- memmove(fbp->save, fbp->psave, fbp->psave_end - fbp->psave);
-
- fbp->psave_end = fbp->save + (fbp->psave_end - fbp->psave);
- fbp->psave = fbp->save; /* sane pointers! */
- }
-
- /*
- ** The "fbp->psave" and "fbp->psave_end" pointers must be in a sane
- ** state when we get here, in case the "read()" gets interrupted.
- ** When that happens, we return to the caller who may try
- ** to restart us! Sane: fbp->psave == fbp->save (HERE!)
- */
-
- nbytes = MSGMAX - (fbp->psave_end - fbp->save);
-
- while ((n = read(fifo, fbp->psave_end, nbytes)) == 0 && count < 60)
- {
- (void) sleep ((unsigned) 1);
- count++;
- }
-
- if (n > 0)
- fbp->psave_end += n;
-
- Had_Full_Buffer = fbp->full;
- fbp->full = (nbytes == n);
-
- return (n);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/streamio.c b/usr/src/cmd/lp/lib/msgs/streamio.c
deleted file mode 100644
index 58ce7a9871..0000000000
--- a/usr/src/cmd/lp/lib/msgs/streamio.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <unistd.h>
-#include <signal.h>
-#include <stropts.h>
-#include <errno.h>
-#include "lp.h"
-#include "msgs.h"
-
-extern int errno;
-
-/*
- * Putmsg() function
- * Return 0: success,
- * non-zero: return code of the failed putmsg() system call.
- * plus errno for caller to check.
- * NOTE: cannot do TRACE* calls if errno is expected to be returned!
- * TRACE* uses fprintf and destroys the content of errno.
- * Save errno before the TRACE* calls.
- */
-
-int
-Putmsg (MESG *mdp, strbuf_t *ctlp, strbuf_t *datap, int flags)
-{
- int i;
- int rtncode;
- int count;
- struct pollfd fds;
-
- fds.fd = mdp->writefd;
- fds.events = POLLOUT;
- fds.revents = 0;
-
- (void) poll(&fds, 1, 1000);
- if (fds.revents & (POLLHUP | POLLERR | POLLNVAL)) {
- errno = EBADF;
- return (-1);
- }
-
- if (!(fds.revents & POLLOUT)) {
- errno = EAGAIN;
- return (-1);
- }
-
- rtncode = putmsg (mdp->writefd, ctlp, datap, flags);
- return (rtncode);
-}
-
-int
-Getmsg (MESG *mdp, strbuf_t *ctlp, strbuf_t *datap, int *flagsp)
-{
- int rtncode;
-
- rtncode = getmsg (mdp->readfd, ctlp, datap, flagsp);
- return (rtncode);
-}
-
-char AuthCode[HEAD_AUTHCODE_LEN];
-static void (*callers_sigpipe_trap)() = SIG_DFL;
-
-
-/*
-** Function: static int read3_2( MESG *, char *, int)
-** Args: message descriptor
-** message buffer (var)
-** buffer size
-** Return: 0 for sucess, -1 for failure
-**
-** This performs a 3.2 HPI style read_fifo on the pipe referanced
-** in the message descriptor. If a message is found, it is returned
-** in message buffer.
-*/
-int read3_2 ( MESG * md, char *msgbuf, int size )
-{
- short type;
-
- if (md->type == MD_USR_FIFO)
- (void) Close (Open(md->file, O_RDONLY, 0));
-
- do
- {
- switch (read_fifo(md->readfd, msgbuf, size))
- {
- case -1:
- return (-1);
-
- case 0:
- /*
- ** The fifo was empty and we have O_NDELAY set,
- ** or the Spooler closed our FIFO.
- ** We don't set O_NDELAY in the user process,
- ** so that should never happen. But be warned
- ** that we can't tell the difference in some versions
- ** of the UNIX op. sys.!!
- **
- */
- errno = EPIPE;
- return (-1);
- }
-
- if ((type = stoh(msgbuf + HEAD_TYPE)) < 0 || LAST_MESSAGE < type)
- {
- errno = ENOMSG;
- return (-1);
- }
- }
- while (type == I_QUEUE_CHK);
-
- (void)memcpy (AuthCode, msgbuf + HEAD_AUTHCODE, HEAD_AUTHCODE_LEN);
-
- /*
- ** Get the size from the 3.2 HPI message
- ** minus the size of the control data
- ** Copy the actual message
- ** Reset the message size.
- */
- size = stoh(msgbuf + HEAD_SIZE) - EXCESS_3_2_LEN;
- memmove(msgbuf, msgbuf + HEAD_SIZE, size);
- (void) htos(msgbuf + MESG_SIZE, size);
- return(0);
-}
-
-int write3_2 ( MESG * md, char * msgbuf, int size )
-{
- char tmpbuf [MSGMAX + EXCESS_3_2_LEN];
- int rval;
-
-
- (void) memmove(tmpbuf + HEAD_SIZE, msgbuf, size);
- (void) htos(tmpbuf + HEAD_SIZE, size + EXCESS_3_2_LEN);
- (void) memcpy (tmpbuf + HEAD_AUTHCODE, AuthCode, HEAD_AUTHCODE_LEN);
-
- callers_sigpipe_trap = signal(SIGPIPE, SIG_IGN);
-
- rval = write_fifo(md->writefd, tmpbuf, size + EXCESS_3_2_LEN);
-
- (void) signal(SIGPIPE, callers_sigpipe_trap);
-
-
- return (rval);
-}
diff --git a/usr/src/cmd/lp/lib/msgs/write_fifo.c b/usr/src/cmd/lp/lib/msgs/write_fifo.c
deleted file mode 100644
index b2454f476c..0000000000
--- a/usr/src/cmd/lp/lib/msgs/write_fifo.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */
-/* LINTLIBRARY */
-
-# include <unistd.h>
-# include <errno.h>
-# include <string.h>
-
-# include "lp.h"
-# include "msgs.h"
-
-/*
-** Choose at least one byte that won't appear in the body or header
-** of a message.
-*/
-unsigned char Resync[HEAD_RESYNC_LEN] = { 0x01, 0xFE };
-unsigned char Endsync[HEAD_RESYNC_LEN] = { 0x02, 0xFD };
-
-
-/*
-** write_fifo() - WRITE A BUFFER WITH HEADER AND CHECKSUM
-*/
-
-#if defined(__STDC__)
-int write_fifo ( int fifo, char * buf, unsigned int size )
-#else
-int write_fifo (fifo, buf, size)
- int fifo;
- char *buf;
- unsigned int size;
-#endif
-{
- unsigned short chksum = 0;
- int wbytes = 0;
-
- (void)memcpy (buf + HEAD_RESYNC, Resync, HEAD_RESYNC_LEN);
- (void)memcpy (buf + TAIL_ENDSYNC(size), Endsync, TAIL_ENDSYNC_LEN);
-
- CALC_CHKSUM (buf, size, chksum);
- (void)htos (buf + TAIL_CHKSUM(size), chksum);
-
-
- /*
- ** A message must be written in one call, to avoid interleaving
- ** messages from several processes.
- **
- ** The caller is responsible for trapping SIGPIPE, so
- ** we just return what the "write()" system call does.
- **
- ** Well, almost. If the pipe was almost full, we may have
- ** written a partial message. If this is the case, we lie
- ** and say the pipe was full, so the caller can try again.
- **
- ** read_fifo can deal with a truncated message, so we let it
- ** do the grunt work associated with partial messages.
- **
- ** NOTE: Writing the remainder of the message is not feasible
- ** as someone else may have written something to the fifo
- ** while we were setting up to retry.
- */
-
- if ((wbytes = write(fifo, buf, size)) > 0)
- if (wbytes != size)
- return(0);
-
- return(wbytes);
-}
diff --git a/usr/src/cmd/lp/lib/oam/Makefile b/usr/src/cmd/lp/lib/oam/Makefile
deleted file mode 100644
index 531a504f7f..0000000000
--- a/usr/src/cmd/lp/lib/oam/Makefile
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 1990-2003 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/lib/oam/Makefile
-#
-include ../../Makefile.lp
-
-LIBRARY = liblpoam.a
-
-TEXTOBJS = e_adm__msgs.o \
- e_can__msgs.o \
- e_cmb__msgs.o \
- e_fl__msgs.o \
- e_for__msgs.o \
- e_lp__msgs.o \
- e_lpp__msgs.o \
- e_lpu__msgs.o \
- e_mov__msgs.o \
- e_sht__msgs.o \
- e_stat__msgs.o \
- e_sys__msgs.o
-
-OBJECTS = agettxt.o \
- buffers.o \
- fmtmsg.o \
- $(TEXTOBJS)
-
-# see the comment below about the '+' signs in TEXTTARG
-#
-TEXTSRCS = $(TEXTOBJS:%.o=%.c)
-TEXTTARG = $(TEXTSRCS:%=+ %)
-
-TFILES = msg.source gen-defs gen-text
-
-TXTFILES= $(TFILES)
-
-LPINC = ../../include
-OAMDEF_H = $(LPINC)/oam_def.h
-
-CLEANFILES = $(TEXTSRCS) $(OAMDEF_H) xx??
-
-include ../../../../lib/Makefile.lib
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CPPFLAGS = -I$(LPINC) $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all install : $(TXTFILES) $(LIBS)
-
-# derived source files
-# and their dependencies
-#
-# beware of the hidden ordering requirement in the target source
-# macros. TEXTTARG contains '+' signs to tell make that this is a
-# target group. Without this syntax, an infinite build loop occurs.
-#
-$(OAMDEF_H) $(TEXTTARG) :$(TFILES)
- sh gen-defs > $(OAMDEF_H)
- sh gen-text
-
-# dependencies slightly overstated but necessarily explicit
-$(OBJS) $(PICS) : $(OAMDEF_H) $$(@F:.o=.c)
-
-include ../../../../lib/Makefile.targ
-
-POFILE = lp_lib_oam.po
-XGETFLAGS += -a -x lp_lib_oam.xcl
-
-CLEANFILES += llib-llpoam.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-
-lint: lintlib
- $(LINT.c) $(LINTFLAGS) $(SRCS)
-
-lintlib:
- $(LINT.c) $(LINTFLAGS) -o lpoam llib-llpoam
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/oam/agettxt.c b/usr/src/cmd/lp/lib/oam/agettxt.c
deleted file mode 100644
index 0e389c6435..0000000000
--- a/usr/src/cmd/lp/lib/oam/agettxt.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* LINTLIBRARY */
-
-#include "oam.h"
-#include <string.h>
-#include <locale.h>
-
-char **_oam_msg_base_ = 0;
-
-char *
-#if defined(__STDC__)
-agettxt (
- long msg_id,
- char * buf,
- int buflen
-)
-#else
-agettxt (msg_id, buf, buflen)
- long msg_id;
- char *buf;
- int buflen;
-#endif
-{
- if (_oam_msg_base_)
- strncpy (buf, gettext(_oam_msg_base_[msg_id]), buflen-1);
- else
- strncpy (buf, gettext("No message defined--get help!"), buflen-1);
- buf[buflen-1] = 0;
- return (buf);
-}
diff --git a/usr/src/cmd/lp/lib/oam/fmtmsg.c b/usr/src/cmd/lp/lib/oam/fmtmsg.c
deleted file mode 100644
index 6f47c82166..0000000000
--- a/usr/src/cmd/lp/lib/oam/fmtmsg.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* LINTLIBRARY */
-
-#include "stdio.h"
-#include "string.h"
-
-#include "oam.h"
-#include <stdlib.h>
-#include <widec.h>
-#include <libintl.h>
-#include <locale.h>
-
-#define LINE_LEN 70
-
-#define SHORT_S 80
-#define LONG_S 2000
-
-static char *severity_names[MAX_SEVERITY-MIN_SEVERITY+1] = {
- "HALT",
- "ERROR",
- "WARNING",
- "INFO"
-};
-
-static const char *TOFIX = "TO FIX";
-
-static int wrap(wchar_t *, wchar_t *, int, wchar_t *);
-
-/**
- ** fmtmsg()
- **/
-
-void
-fmtmsg(char *label, int severity, char *text, char *action)
-{
- int tofix_len, indent_len;
- wchar_t wtofix[SHORT_S], wlabel[SHORT_S], wsev[SHORT_S], wtext[LONG_S],
- null[1] = {0};
-
- /*
- * Return if the severity isn't recognized.
- */
- if (severity < MIN_SEVERITY || MAX_SEVERITY < severity)
- return;
-
- mbstowcs(wtofix, gettext(TOFIX), SHORT_S);
- mbstowcs(wlabel, label, SHORT_S);
- mbstowcs(wsev, gettext(severity_names[severity]), SHORT_S);
- mbstowcs(wtext, text, LONG_S);
-
- tofix_len = wscol(wtofix),
- indent_len = wscol(wlabel) + wscol(wsev) + 2;
- if (indent_len < tofix_len)
- indent_len = tofix_len;
-
- if (wrap(wlabel, wsev, indent_len, wtext) <= 0)
- return;
-
- if (action && *action) {
- if (fputc('\n', stderr) == EOF)
- return;
-
- mbstowcs(wtext, action, LONG_S);
- if (wrap(wtofix, null, indent_len, wtext) <= 0)
- return;
- }
-
- if (fputc('\n', stderr) == EOF)
- return;
-
- fflush (stderr);
-}
-
-/**
- ** wrap() - PUT OUT "STUFF: string", WRAPPING string AS REQUIRED
- **/
-
-static int
-wrap(wchar_t *prefix, wchar_t *suffix, int indent_len, wchar_t *str)
-{
- int len, n, col;
- int maxlen, tmpcol;
- wchar_t *p, *pw, *ppw;
- static const wchar_t eol[] = {L'\r', L'\n', L'\0'};
-
- /*
- * Display the initial stuff followed by a colon.
- */
- if ((len = wscol(suffix)))
- n = fprintf(stderr, gettext("%*ws: %ws: "),
- indent_len - len - 2, prefix, suffix);
- else
- n = fprintf(stderr, gettext("%*ws: "), indent_len, prefix);
- if (n <= 0)
- return (-1);
-
- maxlen = LINE_LEN - indent_len - 1;
-
- /* Check for bogus indent_len */
- if (maxlen < 1) {
- return (-1);
- }
-
- /*
- * Loop once for each line of the string to display.
- */
- for (p = str; *p; ) {
-
- /*
- * Display the next "len" bytes of the string, where
- * "len" is the smallest of:
- *
- * - LINE_LEN
- * - # bytes before control character
- * - # bytes left in string
- *
- */
-
- len = wcscspn(p, eol);
- /* calc how many columns the string will take */
- col = wcswidth(p, len);
- if (col > maxlen) {
- /*
- * How many characters fit into our desired line length
- */
- pw = p;
- tmpcol = 0;
- while (*pw) {
- if (iswprint(*pw))
- tmpcol += wcwidth(*pw);
- if (tmpcol > maxlen)
- break;
- else
- pw++;
- }
- /*
- * At this point, pw may point to:
- * A null character: EOL found (should never happen, though)
- * The character that just overruns the maxlen.
- */
- if (!*pw) {
- /*
- * Found a EOL.
- * This should never happen.
- */
- len = pw - p;
- goto printline;
- }
- ppw = pw;
- /*
- * Don't split words
- *
- * Bugid 4202307 - liblpoam in lp internal library doesn't
- * handle multibyte character.
- */
- while (pw > p) {
- if (iswspace(*pw) ||
- (wdbindf(*(pw - 1), *pw, 1) < 5)) {
- break;
- } else {
- pw--;
- }
- }
- if (pw != p) {
- len = pw - p;
- } else {
- /*
- * Failed to find the best place to fold.
- * So, prints as much characters as maxlen allows
- */
- len = ppw - p;
- }
- }
-
-printline:
- for (n = 0; n < len; n++, p++) {
- if (iswprint(*p)) {
- if (fputwc(*p, stderr) == WEOF) {
- return (-1);
- }
- }
- }
-
- /*
- * If we displayed up to a control character,
- * put out the control character now; otherwise,
- * put out a newline unless we've put out all
- * the text.
- */
-
- if (*p == L'\r' || *p == L'\n') {
- while (*p == L'\r' || *p == L'\n') {
- if (fputwc(*p, stderr) == WEOF)
- return (-1);
- p++;
- }
- } else if (*p) {
- if (fputwc(L'\n', stderr) == WEOF)
- return (-1);
- }
-
- while (iswspace(*p))
- p++;
-
- /*
- * If the loop won't end this time (because we
- * have more stuff to display) put out leading
- * blanks to align the next line with the previous
- * lines.
- */
- if (*p) {
- for (n = 0; n < indent_len + 2; n++)
- (void) fputwc(L' ', stderr);
- }
- }
-
- return (1);
-}
diff --git a/usr/src/cmd/lp/lib/oam/gen-defs b/usr/src/cmd/lp/lib/oam/gen-defs
deleted file mode 100644
index ad8e72db71..0000000000
--- a/usr/src/cmd/lp/lib/oam/gen-defs
+++ /dev/null
@@ -1,63 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-##########
-#
-# Generate ../../include/oam_def.h
-##########
-
-echo "/*This file is automatically generated from msg.source.*/"
-
-csplit -k -s msg.source /E_.*__MSGS/ {99} 2>/dev/null
-
-sed -n -e '/^[ ]*#/p' xx00
-rm xx00
-
-echo 'extern char **_oam_msg_base_;'
-for x in xx??
-do
- BASE=`line <${x}`
- base=`echo ${BASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- echo 'extern char *'${base}'[];'
-done
-
-for x in xx??
-do
-
- (
- BASE=`line`
- base=`echo ${BASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-
- echo "${BASE}"
-
- sed -e '/^[ ]*$/d' \
- | sed -n \
- -e 's/^[ ]*\(E_.*\)$/\1:(_oam_msg_base_='${base}',(long)(:-'${BASE}'))/p' \
- -e '/^[ ]*#/p'
- ) <${x}
-
-done \
-| nl -bp"^E_" -v0 -i2 -s: \
-| sed \
- -e 's/^[ ]*\([0-9]*\):\(E_.*\):\(.*\):\(.*\)$/#define \2 \3\1\4/' \
- -e 's/^[ ]*\([0-9]*\):\(E_.*\)$/#define \2 (\1+2)/' \
-| sed -e 's/^[ ]*//'
diff --git a/usr/src/cmd/lp/lib/oam/gen-text b/usr/src/cmd/lp/lib/oam/gen-text
deleted file mode 100644
index 31299d3dc5..0000000000
--- a/usr/src/cmd/lp/lib/oam/gen-text
+++ /dev/null
@@ -1,46 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-##########
-#
-# Generate e_xxx__base.c files
-#
-# THE ../../oam_def.h FILE MUST BE GENERATED FIRST
-##########
-
-for x in xx??
-do
-
- (
- base=`line | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- echo "generating ${base}.c"
-
- (
- echo "/*This file is automatically generated from msg.source.*/"
- echo 'char *'${base}'[] = {'
- sed -n -e 's/^[ ]*".*"$/&,/p'
- echo '};'
- ) >${base}.c
-
- ) <${x}
-
-done
diff --git a/usr/src/cmd/lp/lib/oam/llib-llpoam b/usr/src/cmd/lp/lib/oam/llib-llpoam
deleted file mode 100644
index b2a06901ee..0000000000
--- a/usr/src/cmd/lp/lib/oam/llib-llpoam
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-char *agettxt(long msg_id, char *buf, int buflen);
-
-void fmtmsg(char * label, int severity, char * text, char * action);
-
-
diff --git a/usr/src/cmd/lp/lib/oam/msg.source b/usr/src/cmd/lp/lib/oam/msg.source
deleted file mode 100644
index d0650c00cf..0000000000
--- a/usr/src/cmd/lp/lib/oam/msg.source
+++ /dev/null
@@ -1,981 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/**
- **
- ** This file contains definitions for the E_... symbols
- ** used with the LP_ERRMSG routines. The definitions are
- ** linked with the text in this file, but they have to be split:
- ** The E_... symbols go into a header file, and the text
- ** go into separate, compilable files.
- **/
-
-/*
- *
- * Format of lines in this file:
- *
- * E_...
- * "text-for-error-message"
- * "text-for-TO-FIX-statement"
- *
- * Lines that DON'T begin with E_..., " (double quote), or #
- * (after leading spaces or tabs) are skipped. Thus these comment
- * lines are ignored, but the C preprocessor directives are kept.
- *
- * Note: The preprocessor directives DO NOT keep text from being
- * generated, nor do they keep the E_... symbols from being numbered
- * (which is consistent). The directives ARE useful for keeping them
- * from being needlessly defined in a program that includes "oam.h"
- */
-
-#define I_AM_CANCEL 1
-#define I_AM_COMB 2
-#define I_AM_LP 3
-#define I_AM_LPADMIN 4
-#define I_AM_LPFILTER 5
-#define I_AM_LPFORMS 6
-#define I_AM_LPMOVE 7
-#define I_AM_LPNETWORK 8
-#define I_AM_LPPRIVATE 9
-#define I_AM_LPSCHED 10
-#define I_AM_LPSHUT 11
-#define I_AM_LPSTAT 12
-#define I_AM_LPUSERS 13
-#define I_AM_LPSYSTEM 14
-#define I_AM_OZ 99
-
-/**
- ** COMMON MESSAGES USED BY ALL PROGRAMS
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_LP__MSGS
-
-E_LP_OPTION
- "Unrecognized option \"%s\"."
- ""
-E_LP_MALLOC
- "Not enough memory."
- "Try again later or give a simpler\ncommand."
-E_LP_AGAIN
- "Another process is using the file\n\"%s\"."
- "Try again later."
-E_LP_ANYNONE
- "The names \"any\" and \"none\" are reserved."
- "You must use a different name."
-E_LP_ACCESS
- "Can't access the file\n\"%s\"."
- "Check its file permissions."
-E_LP_NOTNAME
- "\"%s\" doesn't have the correct syntax."
- "Give a name that has 1 to 14 letters,\ndigits, dashes, or underscores."
-E_LP_OPTARG
- "The option %s requires an argument."
- ""
-E_LP_UNKREQID
- "Request \"%s\" doesn't exist."
- ""
-E_LP_MSEND
- "Can't send message to the LP print service."
- "The LP print service apparently has been\nstopped. Get help from your system\nadministrator."
-E_LP_MRECV
- "Can't receive message from the LP print service."
- "The LP print service apparently has been\nstopped. Get help from your system\nadministrator."
-E_LP_BADSTATUS
- "Received unexpected status %d in a reply from the\nLP print service."
- "It's likely there is an error in this\nsoftware. Please get help from your\nsystem administrator."
-E_LP_PGONE
- "Printer \"%s\" has disappeared!"
- "The administrator should completely\nremove the printer."
-E_LP_PNBUSY
- "Printer \"%s\" was not busy."
- ""
-E_LP_MOPEN
- "Can't establish contact with the LP print service."
- "Either the LP print service has stopped,\nor all message channels are busy. If the\nproblem continues, get help from your\nsystem administrator."
-E_LP_MLATER
- "All message channels busy."
- "Try again later."
-E_LP_AMBIG
- "Ambiguous or invalid combination of\n%s and %s options."
- "Give only one of the two options."
-E_LP_2MANY
- "Multiple -%c options given."
- "The last one will be used;\nprocessing continues."
-E_LP_BADREPLY
- "Received unexpected message %d from the LP print service."
- "It's likely there is an error in this\nsoftware. Please get help from your\nsystem administrator."
-E_LP_DSTUNK
- "Destination \"%s\" is unknown to the\nLP print service."
- ""
-E_LP_NOTADM
- "You aren't allowed to do that."
- "You must be logged in as \"lp\" or \"root\"."
-E_LP_NODEST
- "No destinations specified."
- ""
-E_LP_BADFILE
- "Cannot access the file:\n%s."
- "Make sure file names are valid."
-E_LP_EMPTY
- "\"%s\" is empty."
- ""
-E_LP_NOFILES
- "No (or empty) input files."
- ""
-E_LP_OPTCOMB
- "Illegal combination of options."
- "Check the manual for proper usage."
-E_LP_NOSPACE
- "No space to allocate temp files."
- "Clean up disk, or try again later."
-E_LP_ISDIR
- "\"%s\" is a directory."
- "A regular file is needed here; check the\nname."
-E_LP_BADSCALE
- "Improper scaled decimal number."
- "Number must be greater than zero. You\ncan use only 'i' and 'c' for scaling\nnumbers ('i' inches, 'c' centimeters).\nFor setting cpi (horizontal pitch),\nsynonyms \"pica\", \"elite\", \"compressed\"\nare allowed."
-E_LP_EXTRA
- "Extra command line arguments starting with\n\"%s\"."
- "Processing continues, but check for a\nmissing option. Use the -? option to see\na list of valid options."
-E_LP_BADPRI
- "Bad priority value \"%s\"."
- "Use an integer value from 0 to 39."
-E_LP_2LATE
- "Request \"%s\" is done."
- "It is too late to do anything with it."
-E_LP_BUSY
- "Request \"%s\" is busy."
- "If the request is printing, disable the\nprinter and resubmit this command."
-E_LP_NULLARG
- "Null argument given for %s option."
- "You have to give a non-empty value for\nthis option."
-E_LP_BADOARG
- "Argument to option -%c is invalid: \"%s\"."
- "Re-enter with valid option arguments."
-E_LP_NEEDSCHED
- "The LP print service isn't running or can't be\nreached."
- "Your request can't be completely handled\nwithout the LP print service. If this\nproblem continues, get help from your\nsystem administrator."
-E_LP_BADDEST
- "Destination \"%s\" does not exist."
- "Use a printer or class that exists on\nthis system."
-E_LP_PUTCLASS
- "Error writing class \"%s\" to disk\n(%s)."
- ""
-E_LP_GETCLASS
- "Error reading class \"%s\" from disk\n(%s)."
- ""
-E_LP_DELCLASS
- "Error deleting class \"%s\" from disk\n(%s)."
- ""
-E_LP_GETPRINTER
- "Error reading printer information for \"%s\"\n(%s)."
- ""
-E_LP_PUTPRINTER
- "Error writing printer information for \"%s\"\n(%s)."
- ""
-E_LP_DELPRINTER
- "Error deleting printer information for \"%s\"\n(%s)."
- ""
-E_LP_GETFORM
- "Error reading form information for \"%s\"\n(%s)."
- ""
-E_LP_PUTFORM
- "Error writing form information for \"%s\"\n(%s)."
- ""
-E_LP_DELFORM
- "Error deleting form information for \"%s\"\n(%s)."
- ""
-E_LP_GETREQUEST
- "Error reading request file.\n(%s)."
- ""
-E_LP_PUTREQUEST
- "Error writing request file.\n(%s)."
- ""
-E_LP_NOCLASS
- "Class \"%s\" does not exist."
- "Use the \"lpstat -c all\" command to list\nall known classes."
-E_LP_NOPRINTER
- "Printer \"%s\" does not exist."
- "Use the \"lpstat -p all\" command to list\nall known printers."
-E_LP_NOFORM
- "Form \"%s\" does not exist."
- "Use the \"lpstat -f all\" command to list\nall known forms."
-E_LP_GETMSG
- "Failed to parse message from the LP print service.\n(%s)"
- ""
-E_LP_HAVEREQS
- "The LP print service isn't running."
- "Your request may affect print jobs, but\nthe LP print service isn't running to\nevaluate this. Start it by running the\n/usr/lib/lp/lpsched command."
-E_LP_DENYDEST
- "You are not allowed to use the destination\n\"%s\"."
- "Use the lpstat -p command to list all\nknown printers; you can use those marked\n\"available\"."
-E_LP_NOFILTER
- "There is no filter to convert the file content."
- "Use the lpstat -p -l command to find a\nprinter that can handle the file type\n directly, check your filters using lpfilter -f all -l, or consult with your system\nadministrator."
-E_LP_REQDENY
- "Requests for destination \"%s\" aren't\nbeing accepted."
- "Use the \"lpstat -a\" command to see why\nthis destination is not accepting\nrequests."
-E_LP_PTRCHK
- "The following options can't be handled:\n%s"
- "The printer(s) that otherwise qualify\nfor printing your request can't handle\none or more of these options. Try\nanother printer, or change the options."
-E_LP_MNOMEM
- "No room for this request!"
- "The spooling directory is full, or the\nLP print service can't allocate enough\nmemory for this request."
-E_LP_UALLOWDENY
- "Invalid argument to the -u option."
- "The argument must begin with either\n\"allow:\" or \"deny:\" and be followed with\na list of user names."
-E_LP_NOQUIET
- "No alerts are active for \"%s\"."
- ""
-E_LP_GARBNMB
- "Illegal value for the -%c option."
- "Give an integer value with this option."
-E_LP_NEGARG
- "Illegal value for the -%c option."
- "This must be a non-negative number, that\nis also small enough to be interpreted\ncorrectly (numbers too large might be\nconverted to negative values)."
-E_LP_GONEREMOTE
- "Request %s is on the remote system."
- "The LP print service currently does not\nallow you to change or move a request,\nonce it is on the remote system."
-E_LP_ZEROARG
- "Illegal value for the -%c option."
- "Give a positive value for the option."
-E_LP_MISSING
- "No list given after the \"%s:\"."
- "You seem to have left something out;\nhowever, processing of the rest of the\ncommand line options continues."
-E_LP_ACCESSINFO
- "Error writing access information to disk\n(%s)."
- ""
-E_LP_GARBAGE
- "Too many bad input lines."
- "Fix the input and try again."
-E_LP_USAGE
- "Unrecognized option \"%s\".\nEnter command with -? option for proper usage."
- ""
-E_LP_NOREQ
- "No request ids available."
- "Check for faulted or disabled printer(s) with \n\"lpstat -a\"."
-E_LP_LARGEFILE
- "Large File encountered, can't print:\n%s."
- "Make sure the file is not a Large File."
-/**
- ** MESSAGES FOR THE LPFILTER PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_FL__MSGS
-
-#if WHO_AM_I == I_AM_LPFILTER || WHO_AM_I == I_AM_OZ
-#define E_FL_IGNORE E_LP_EXTRA
-#define E_FL_GARBAGE E_LP_GARBAGE
-
-E_FL_ACCESS
- "Can't access filter table\n\"%s\"."
- "Check its file permissions."
-E_FL_ACCESSI
- "Can't access archived filter table\n\"%s\"."
- "Check its file permissions."
-E_FL_NOCMD
- "No command specified."
- "You must give a command or program name."
-E_FL_NOFACTY
- "No filters are archived."
- "See if any were installed originally."
-E_FL_FACTYNM
- "No filter by that name was archived."
- "Check the name again."
-E_FL_NOFILT
- "No filter name given."
- "You must specify a filter name;\nuse the -f option."
-E_FL_OPEN
- "Can't open the file for reading: \"%s\""
- "Check that it exists and that you\ncan read it."
-E_FL_READ
- "Error reading input."
- ""
-E_FL_UNKFILT
- "No filter by the name \"%s\" exists."
- "Check the name again."
-E_FL_UNKNOWN
- "Error accessing filter table\n\"%s\"\n(%s)."
- ""
-E_FL_HEADING
- "Input line %d can not be used."
- "Fix the input if necessary;\nprocessing continues."
-E_FL_NOACT
- "Nothing to do."
- "You must give one of these options:\n-F, -, -x, -l."
-E_FL_NOTALL
- "Can't add a filter named \"all\"."
- "You must use another name."
-E_FL_STRANGE
- "Could not read all filters from table\n\"%s\"."
- ""
-E_FL_NOSPLOAD
- "The LP print service didn't load the filter table."
- "Try restarting the LP print service by\nrunning the /usr/lib/lp/lpsched command."
-E_FL_BADTEMPLATE
- "Missing option template."
- "There appears to be an incomplete option\ntemplate. This can be caused by a double\ncomma in the option list. Resubmit the\nentire input."
-E_FL_BADKEY
- "Unrecognized keyword in option template."
- "Resubmit the entire input. Check the\nlpfilter(1M) manual page for the list of\nvalid keywords."
-E_FL_BADPATT
- "Missing pattern in option template."
- "Resubmit the entire input; make sure all\noption templates include a keyword,\npattern, and replacement:\nkeyword pattern = replacement\n(e.g. MODES * = -m *)."
-E_FL_BADRESULT
- "Missing replacement in option template."
- "Resubmit the entire input; make sure all\noption templates include a keyword,\npattern, and replacement:\nkeyword pattern = replacement\n(e.g. MODES * = -m *)."
-E_FL_BADREGEX
- "Error in regular expression:\n %s"
- "Resubmit the entire input with the\ncorrect regular expression."
-#endif
-
-/**
- ** MESSAGES FOR THE CANCEL PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_CAN__MSGS
-
-#if WHO_AM_I == I_AM_CANCEL || WHO_AM_I == I_AM_OZ
-
-E_CAN_BADARG
- "\"%s\" is not a request id or a printer."
- "Cancel requests by id or by\nname of printer where printing."
-E_CAN_CANT
- "Can't cancel request \"%s\"."
- "You are not allowed to cancel\nanother's request."
-E_CAN_NOUSERP
- "No jobs on printer %s for user(s) %s."
- "Use the lpstat -o or lpstat -u commands\nto see what requests have been queued."
-E_CAN_ANYUSERP
- "No user has a job on printer %s."
- "Use the lpstat -o or lpstat -u commands\nto see what requests have been queued."
-E_CAN_NOUSERANYP
- "No jobs on any printer for user(s) %s."
- "Use the lpstat -o command to see what\nrequests have been queued."
-E_CAN_ANYUSERANYP
- "No requests queued."
- ""
-E_CAN_NOACT
- "Nothing to do."
- "You need to give a request ID or printer\nname, or the -u option to specify a user."
-
-#endif
-
-/**
- ** MESSAGES FOR THE ACCEPT, REJECT, ENABLE, DISABLE PROGRAMS
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_CMB__MSGS
-
-#if WHO_AM_I == I_AM_COMB || WHO_AM_I == I_AM_OZ
-
-E_REJ_2TIME
- "Destination \"%s\" was already\nnot accepting requests."
- ""
-
-E_ACC_2TIME
- "Destination \"%s\" was already accepting\nrequests."
- ""
-
-E_DIS_2TIME
- "Destination \"%s\" was already disabled."
- ""
-E_DIS_CLASS
- "\"%s\" is a class."
- "You can only disable printers, not\nclasses. If you want to prevent people\nfrom submitting requests to this class,\nuse the /usr/sbin/reject command."
-
-E_ENA_2TIME
- "Destination \"%s\" was already enabled."
- ""
-E_ENA_CLASS
- "\"%s\" is a class."
- "You can only enable printers, not\nclasses. If you want to allow people to\nsubmit requests to this class, use the\n/usr/sbin/accept command."
-
-#endif
-
-/**
- ** MESSAGES FOR THE LPMOVE PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_MOV__MSGS
-
-#if WHO_AM_I == I_AM_LPMOVE || WHO_AM_I == I_AM_OZ
-
-E_MOV_BADDEST
- "Request \"%s\" cannot be moved."
- ""
-E_MOV_NOMEDIA
- "Request \"%s\" cannot be moved."
- "The form or character set needed by the\nrequest no longer exists. You should\ncancel this request."
-E_MOV_DENYMEDIA
- "Request \"%s\" cannot be moved."
- "The form needed by the request is no\nlonger available to the user. You should\ncancel this request."
-E_MOV_NOMOUNT
- "Request \"%s\" cannot be moved."
- "The form needed by the request can't be\nmounted on the destined printer. Try\nanother destination, or wait for the\nrequest to finish printing or cancel it."
-E_MOV_PTRCHK
- "Request \"%s\" cannot be moved\nbecause the following options can't be handled:\n%s"
- "Try moving the request to another\ndestination, or wait for the request to\nfinish printing or cancel it."
-E_MOV_DENYDEST
- "Request \"%s\" cannot be moved."
- "The person who submitted the request is\nnot allowed to use the printer(s). Try\nanother destination, or wait for the\nrequest to finish printing or cancel it."
-E_MOV_NOFILTER
- "Request \"%s\" cannot be moved."
- "There is no filter to convert the file\ncontent for the printer(s). Try another\ndestination, or wait for the request to\nfinish printing or cancel it."
-
-#endif
-
-/**
- ** MESSAGES FOR THE LPUSERS PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_LPU__MSGS
-
-#if WHO_AM_I == I_AM_LPUSERS || WHO_AM_I == I_AM_OZ
-
-E_LPU_BADFILE
- "Bad file: %s, errno=%d."
- ""
-E_LPU_BADFORM
- "Bad user profile:\n\"%s\"."
- ""
-E_LPU_DEFTWICE
- "Default listed twice."
- ""
-E_LPU_NOLOAD
- "The LP print service did not load new priority\ndefinitions."
- "Try restarting the LP print service."
-E_LPU_BADU
- "Bad user specified: %s"
- ""
-E_LPU_NOUSER
- "User \"%s\" did not have a limit set\n(or is illegal)"
- ""
-
-#endif
-
-/**
- ** MESSAGES FOR THE LP PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_LPP__MSGS
-
-#if WHO_AM_I == I_AM_LP || WHO_AM_I == I_AM_OZ
-#define E_LPP_BADDEST E_LP_BADDEST
-
-E_LPP_ILLARG
- "Illegal file arguments with change request."
- "To change which files should be printed,\ncancel this request and resubmit it."
-E_LPP_NOSTART
- "End change received, but no start."
- "Internal error, report to administrator."
-E_LPP_FPUTREQ
- "Could not write request."
- ""
-E_LPP_FGETREQ
- "Could not read request \"%s\"."
- "Check argument to -i option."
-E_LPP_NODEST
- "No default destination."
- "You must identify which printer should\nhandle your request by naming it or a\nclass of printers (-d name) or by naming\na type of printer (-T type)."
-E_LPP_NOMEDIA
- "Form or character set not available."
- "Check the spelling of the form/character\nset name. Use the lpstat -f -S command\nto list all known forms and character\nsets."
-E_LPP_DENYMEDIA
- "You are not allowed to use the form\n\"%s\"."
- "Use the lpstat -f command to list all\nknown forms; you can use those marked\n\"available\"."
-E_LPP_NOMOUNT
- "The form or print wheel can't be used."
- "The printer(s) that otherwise qualify\nfor printing your request are not\nallowed to have the form or print wheel\nmounted. Use the lpstat -p -l command\nto list printers where it (they) can be\nmounted."
-E_LPP_COMBMW
- "Illegal combination of -w and -m options."
- "Notification will be by mail only;\nthe \"-w\" option is ignored."
-E_LPP_NOOPEN
- "The LP print service could not read your request\nfile."
- "See if the spooling file system is full.\nGet help from your system administrator."
-E_LPP_FORMCHARSET
- "The character set can't be used with the form."
- "Since the form is defined as needing a\nparticular character set, just resubmit\nthe command without the -S option."
-E_LPP_CURDIR
- "Can't determine the current directory."
- "The LP print service can not determine\nwhere all your files are located because\nit doesn't have the same current\ndirectory. Give the -c option to copy\nthe file(s)."
-E_LPP_ODDFILE
- "One or more files can't be used or found."
- "Either the files are illegal (fifos,\nblock devices, etc.), or can't be found\nby the LP print service. The latter\ntypically happens when your files are on\nlocal resources not accessible over RFS."
-
-#endif
-
-/**
- ** MESSAGES FOR THE LPSHUT PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_SHT__MSGS
-
-#if WHO_AM_I == I_AM_LPSHUT || WHO_AM_I == I_AM_OZ
-
-E_SHT_CANT
- "You can't shut down the LP print service."
- "You must be logged in as \"lp\" or \"root\"."
-
-#endif
-
-/**
- ** MESSAGES FOR THE LPADMIN PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_ADM__MSGS
-
-#if WHO_AM_I == I_AM_LPADMIN || WHO_AM_I == I_AM_OZ
-#define E_ADM_ZEROARG E_LP_ZEROARG
-#define E_ADM_MISSING E_LP_MISSING
-#define E_ADM_ACCESSINFO E_LP_ACCESSINFO
-
-E_ADM_NOTLOCAL
- "You have specified a remote printer\nand supplied one or more of the following\noptions: A,a,e,F,H,h,i,l,m,M,o,U,v,Q,W."
- ""
-E_ADM_ANYALLSYS
- "The names \"any\" and \"all\" are reserved."
- "You must use a system name that has\nbeen defined with the lpsystem command."
-E_ADM_DALONE
- "Other options given with -d option."
- "Give only the -d option to define\na default destination."
-E_ADM_XALONE
- "Other options given with -x option."
- "Give only the -x option to delete a\nprinter."
-E_ADM_SALONE
- "Confusing options given."
- "You are either missing the -p option or\nhave given extraneous options while\ntrying to define alerting for a\nprint wheel."
-E_ADM_JALONE
- "Wrong combination of options."
- "The -j option should not be given when\nadding a new printer."
-E_ADM_MNTNONE
- "Nothing to mount."
- "Give the -f or -S option to identify\nform or print wheel to mount."
-E_ADM_PNOQ
- "Illegal use of the -Q option."
- "Don't give the -Q option when setting\na printer fault alert."
-E_ADM_NODEST
- "Destination \"%s\" doesn't exist."
- "Check the name again. Use the lpstat -p\nor lpstat -c command to see if the\nprinter or class exists."
-E_ADM_NOACT
- "Nothing to do."
- "You must give one of these options:\n-p, -d, -x, -S."
-E_ADM_CNOU
- "No -u option given."
- "Give the -C option only with the\n-u option."
-E_ADM_JNOF
- "No -F option given."
- "Give the -j option only with the\n-F option."
-E_ADM_2MANY
- "Multiple -o %s options given."
- "The last one will be used;\nprocessing continues."
-E_ADM_QUOTES
- "Missing right %c quote in stty= argument."
- ""
-E_ADM_BADTYPE
- "Printer type \"%s\" is not in the\nTerminfo database."
- "Check the name again; if it is correct\nyou have to make an entry for it in the\nTerminfo database."
-E_ADM_MIXEDTYPES
- "Inconsistent printer types."
- "The printer types do not agree on\nwhether the printer takes print wheels\nor not. Check the printer types or the\nTerminfo database."
-E_ADM_MUNKNOWN
- "\"unknown\" not allowed with multiple printer types."
- "Your list of printer types includes the\ntype \"unknown\"; either remove that type\nfrom the list or give just the type\n\"unknown\"."
-E_ADM_BADCAP
- "\"%s\" setting impossible."
- ""
-E_ADM_BADCAPS
- "The printer can't handle all the above setting(s)."
- "Check the manual for the printer to make\nsure each value is correct; check that\nthe Terminfo entry/entries are correct."
-E_ADM_NBADCAPS
- "Settings won't work on these printer types:\n %s"
- "The incompatible settings won't be\napplied when these types are used to\nprint a request. Change the settings or\nlist of types, if you want."
-E_ADM_PRCL
- "Can't create the printer \"%s\"."
- "This is an existing class name;\nchoose another name."
-E_ADM_NOUV
- "Missing -U or -v option."
- "Local printers must have\na port defined (-v option) or\nhave dial-out instructions (-U option)."
-E_ADM_BOTHUV
- "Both -U and -v given."
- "Give only one of these options, the\n-v option to name the direct connect\nport or the -U to identify the dial-out\nmethod."
-E_ADM_NOTMEM
- "The printer \"%s\" is not a member of\nthe class \"%s\"."
- "Use the lpstat -c command to find the\ncorrect class."
-E_ADM_TOPT
- "No printer type (-T option) given."
- "The printer type must be known:\n* to set default cpi, lpi, length, width\n* to define character sets, print wheels\n* to allow forms."
-E_ADM_INTCONF
- "The options -e, -i and -m are mutually exclusive."
- "Give just one of these options to define\nan interface program."
-E_ADM_NOPR
- "The printer \"%s\" does not exist."
- "You must give the name of an existing\nprinter in the -e option."
-E_ADM_SAMEPE
- "The -p and -e options have the same value."
- "You must name a different printer\nin the -e option."
-E_ADM_SAMECR
- "The -c and -r options have the same value."
- "Don't try to remove the printer from the\nsame class to which you are adding it."
-E_ADM_NOMODEL
- "The model \"%s\" does not exist."
- "Use the command\n ls /usr/lib/lp/model\nto find the list of known models."
-E_ADM_CONFLICT
- "The options \"-%c\" and \"-%c\" are contradictory."
- "Give the -l option if the printer is\nalso a login terminal, give the\n-h option if it is not."
-E_ADM_ISDIR
- "\"%s\" is a directory."
- "If this is not what you intended, enter\nthe command again with the correct name."
-E_ADM_ISBLK
- "\"%s\" is a block device."
- "If this is not what you intended, enter\nthe command again with the correct name."
-E_ADM_ISMISMATCH
- "\"%s\" is a symlink that points to a file with a different owner."
- "Retry this operation with a new device."
-E_ADM_ISNOTROOTOWNED
- "\"%s\" is a symlink owned by an unprivileged user.\nThis introduces a potential security hole in your configuration."
- "If this is not what you intended, enter\nthe command again with the correct name."
-E_ADM_DEVACCESS
- "\"%s\" is accessible by others."
- "If other users can access it you may get\nunwanted output. If this is not what you\nwant change the owner to \"lp\" and change\nthe mode to 0600.\nProcessing continues."
-E_ADM_NOENT
- "\"%s\" doesn't exist."
- "Create the file, special device, or FIFO\nfor the -v option before running this\ncommand."
-E_ADM_INCLASS
- "The printer \"%s\" is already a member\nof the class \"%s\"."
- "If you made a mistake, rerun the command\nwith the correct names;\nprocessing continues."
-E_ADM_GETCLASSES
- "Error reading all classes from disk\n(%s)."
- ""
-E_ADM_GETPRINTERS
- "Error reading all printers from disk\n(%s)."
- ""
-E_ADM_FALLOWDENY
- "Invalid argument to the -f option."
- "The argument must begin with either\n\"allow:\" or \"deny:\" and be followed with\na list of form names. On the other hand,\nperhaps you forgot the -M option?"
-E_ADM_ICKFORM
- "Form \"%s\" is not listed as available\nfor the printer \"%s\"."
- "Check the name; if wrong enter the\ncommand again.\nProcessing continues."
-E_ADM_PWHEELS
- "-S must not give a character set map."
- "The printer takes only print wheels.\nFix the type or change the value in the\n-S option."
-E_ADM_CHARSETS
- "-S must give a character set map."
- "The printer has only selectable\ncharacter sets. Fix the type or change\nthe value in the -S option."
-E_ADM_BADSET
- "Illegal character set \"%s\"."
- ""
-E_ADM_NBADSET
- "Character set \"%s\" won't work with\nthese printer types:\n %s"
- ""
-E_ADM_BADSETS
- "The printer's type(s) don't have the\nabove character sets defined."
- "Check the manual for the printer to make\nsure each name is correct; check that\nthe Terminfo entry/entries are correct."
-E_ADM_NOPWHEEL
- "The printer doesn't take print wheels."
- "Check that you named the right printer.\nCheck that the Terminfo database is\ncorrect; if wrong, fix it and add the\nprint wheel list for the printer."
-E_ADM_ICKPWHEEL
- "Print wheel \"%s\" is not listed as\navailable for the printer \"%s\"."
- "Check the name; if wrong enter the\ncommand again with the correct name.\nProcessing continues."
-E_ADM_MNTLATER
- "The printer is busy; can't mount/unmount now."
- "Wait until the current job(s) are\nfinished, or disable the printer."
-E_ADM_NOMEDIA
- "Can't mount/unmount the form or print wheel."
- "Check the name. The one you gave isn't\nrecognized."
-E_ADM_DELSTRANGE
- "Strange, the LP print service took the request to\ndelete printer or class \"%s\" but the disk copy\ncan't be deleted.\n(%s)"
- ""
-E_ADM_DESTBUSY
- "There are jobs currently queued for destination\n\"%s\""
- "Use the /usr/sbin/lpmove command to\nassign them to another destination,\nor wait for them to finish printing."
-E_ADM_WRDEFAULT
- "Error writing default destination\n(%s)."
- ""
-E_ADM_PUTPWHEEL
- "Error writing print wheel information for \"%s\"\n(%s)."
- ""
-E_ADM_FBAD
- "Illegal value for the -F option"
- "You must give one of the values\n\"continue\", \"wait\", or \"beginning\"."
-#if defined(J_OPTION)
-E_ADM_FBADJ
- "Illegal value for the -F option"
- "You must give one of the values\n\"wait\" or \"beginning\".\n(\"continue\" is not allowed if you also\ngive the -j option.)"
-#endif
-E_ADM_BADO
- "\"%s\" is an illegal value for the\n-o option"
- "You must give one of the values\nbanner, nobanner,\ncpi=X, lpi=X, width=X, length=X,\nstty=... (if ... is a list, surround IT\nwith single quotes (') and put the whole\nthing in double quotes (\")),\nor filebreak or nofilebreak (with -a)."
-E_ADM_FORMCAP
- "The form \"%s\" requires capabilities\nnot provided by the printer."
- ""
-E_ADM_FORMCAPS
- "Can't allow one or more forms."
- "You have to adjust each form definition,\nif possible. Leave each form out of the\nallow list to continue defining the\nprinter."
-E_ADM_BADINTF
- "Can't access the file \"%s\"\nto copy the interface program."
- "Make sure the name is correct;\nmake sure the file exists."
-E_ADM_CLPR
- "Can't create class \"%s\"."
- "This is an existing printer name;\nchoose another name."
-E_ADM_BADQUIETORLIST
- "Illegal -A option for printer/print wheel\n\"%s\"."
- "You can't give the -A quiet or the\n-A list option for a printer or print\nwheel that doesn't exist yet."
-E_ADM_PLONELY
- "Nothing to do."
- "The -p option identifies a printer; give\nother options to do something with it."
-E_ADM_NOAWQ
- "Nothing to do."
- "The -S option identifies a print wheel;\ngive a -A, -W, and/or -Q option to set\nor change the alerting for it."
-E_ADM_MALIGN
- "Missing the -M or -f option"
- "The -a option asks for an alignment\npattern, but you need to tell what form\nto mount."
-E_ADM_NOALIGN
- "No alignment pattern has been registered with\nthe form \"%s\"."
- "The form will be mounted anyway. If you\nneed to check the alignment of the form,\nregister an alignment pattern using the\nlpforms command, unmount the form, then\nissue this command again."
-E_ADM_LISTWQ
- "Illegal combination of options."
- "Don't give the \"-A list\" option with the\n-W or -Q options."
-E_ADM_NOPSPACE
- "The LP print service can't take another printer."
- "The printer configuration has been saved\non disk nonetheless. Stop the LP print\nservice (/usr/sbin/lpshut) and restart it\n(/usr/lib/lp/lpsched) to have it recognize\nthe new printer."
-E_ADM_NOCSPACE
- "The LP print service can't take another class."
- "The class configuration has been saved\non disk nonetheless. Stop the LP print\nservice (/usr/sbin/lpshut) and restart it\n(/usr/lib/lp/lpsched) to have it\nrecognize the new class."
-E_ADM_NOPWSPACE
- "The LP print service can't take in another print\nwheel alert."
- "The alert configuration has been saved\non disk nonetheless. Stop the LP print\nservice (/usr/sbin/lpshut) and restart it\n(/usr/lib/lp/lpsched) to have it\nrecognize the new print wheel alert."
-E_ADM_BADMOUNT
- "Shouldn't mount the form."
- "You may want to adjust the form\ndefinition, if possible. Check that the\nTerminfo database gives correct\nattributes for the printer type.\nThe form is considered mounted anyway."
-E_ADM_NBADMOUNT
- "The form \"%s\" won't work with these\nprinter types:\n %s"
- ""
-E_ADM_CLNPR
- "Can't create both class and printer \"%s\"."
- "Make the two names different."
-E_ADM_GETSYS
- "Error reading system information for \"%s\"\n(%s)."
- ""
-E_ADM_NOSYS
- "System \"%s\" does not exist."
- "Use the \"lpsystem -l\" command to list\nall known systems."
-E_ADM_NAMEONLOCAL
- "You may not specify a remote printer\nname with a local system name."
- "Either specify a remote system name\nor omit the remote printer name."
-E_ADM_ANYALLNONE
- "The names \"any\", \"all\" and \"none\" are reserved."
- "Use a different name when adding a\nprinter. The name \"all\" can be used with\nthe -A, -x, -r, or -c options."
-E_ADM_NFIFO
- "Can't open FIFO to print alignment pattern.\n(%s)"
- ""
-E_ADM_NFILTER
- "No filter to convert the alignment pattern."
- "The printer can't print the alignment\npattern directly, and there's no filter\nthat will convert it. Check the form\ndefinition. Check the printer type."
-E_ADM_NPAGES
- "There may be extra lines in the alignment pattern."
- "If the printed alignment pattern is too\nlong, either add a filter that can print\na subset of pages or redefine the form\nwith a manually truncated pattern.\nProcessing continues."
-E_ADM_FILEBREAK
- "Ignoring the -o filebreak option."
- "This is only used with the -a option\nwhen mounting a form, to insert a page\nbreak between alignment patterns.\nPerhaps you left out the -a option?"
-E_ADM_UNALIGN
- "Ignoring the -a option."
- "This is only used when MOUNTING a form,\nto print a pattern to help you align it.\nUnmounting a form means you're replacing\nit with blank paper, which needs no\nalignment."
-E_ADM_ERRDEST
- "The LP print service could not read the disk file\ncontaining this configuration information."
- "This is probably due to a full spooling\nfile system. If it is, clean out files\nto free up space, then resubmit this\ncommand."
-E_ADM_MANDCHSET
- "The form requires the character set\n\"%s\"."
- "Check the form name and form definition.\nSince a particular character set is\nmandatory with this form but the printer\ncan't select that character set, you\ncan't mount the form on this printer."
-E_ADM_MANDPWHEEL1
- "The form requires the print wheel\n\"%s\"."
- "This print wheel has been listed as\nmandatory for the form, but it is not\ncurrently mounted. If you don't want the\ncurrent print wheel used, enter the\ncommand again, and identify the print\nwheel to be mounted."
-E_ADM_MANDPWHEEL2
- "The form requires the print wheel\n\"%s\"."
- "This print wheel has been listed as\nmandatory for the form. If you made a\nmistake, enter the command again and\nchange the print wheel to be mounted."
-E_ADM_ASINGLES
- "Only one print wheel at a time, please."
- "You can only give a single print wheel\nname, not a list of names, when defining\na print wheel alert. Only the first\nprint wheel will be defined. (Maybe you\nleft out the -p option?)"
-E_ADM_MSINGLES
- "Only one print wheel at a time, please."
- "You can only give a single print wheel\nname, not a list of names, when mounting\na print wheel. Only the first one will\nbe mounted."
-E_ADM_ONLYSIMPLE
- "Input types not allowed with multiple printer\ntypes."
- "The LP print service currently doesn't\nallow input types other than \"simple\"\nwhen more than one printer type is\ngiven. You have to change the printer\ntypes or input types."
-E_ADM_SIGNORE
- "Certain options ignored for remote printer\n %s."
- "When you try to change the configuration\nof all printers at once some options are\nignored for remote printers."
-E_ADM_BADPWHEEL
- "There are no alerts defined for the print wheel\n\"%s\"."
- "Check the name again."
-E_ADM_BADTRAY
- "The printer does not have the tray number you specified."
- "Try using the -t option with -M to set the total number of trays."
-E_ADM_MAXTRAY
- "The number of trays specified with the -t option must between 1 and 100."
- ""
-E_ADM_ALSO_SEP_FORM
- "`%s' cannot be used as a paper name because it\nis already defined as an old style form."
- "Either use another name, or remove the conflicting form using `lpforms'."
-E_ADM_NOPPD
- "The ppd \"%s\" does not exist."
- "Use the command\n find <PPD file repository> -type f\n"
- "where <PPD file repository> is one or more of the following:\n"
- " /usr/share/ppd/*/*/\n /usr/share/local/ppd/*/*/\n"
- " /opt/share/ppd/*/*/\n /var/lp/ppd/*/*/\n"
- "to find the list of known printer ppd definitions."
-
-#endif
-
-/**
- ** MESSAGES FOR THE LPFORMS PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_FOR__MSGS
-
-#if WHO_AM_I == I_AM_LPFORMS || WHO_AM_I == I_AM_OZ
-#define E_FOR_MOPENREQX E_LP_HAVEREQS
-#define E_FOR_UALLOWDENY E_LP_UALLOWDENY
-#define E_FOR_EXTRAARG E_LP_EXTRA
-
-E_FOR_FORMNAME
- "No form name given."
- "You must specify a form name using the\n-f option."
-E_FOR_NOACT
- "Nothing to do."
- "You must give one of these options:\n- -F (new form)\n- -F -l -x -u -A -W -Q (existing form)"
-E_FOR_EMPTYFILE
- "Empty form description file given."
- "All defaults will be used; resubmit the\ncommand if this is not what you want.\nProcessing continues."
-E_FOR_DELSTRANGE
- "Strange, the LP print service accepted\nthe delete form request but the disk\ncopy can't be deleted."
- ""
-E_FOR_CTMPFILE
- "Unable to create temporary file."
- "Set the TMPDIR environment variable to a\nsuitable temporary directory name."
-E_FOR_OPEN
- "Can't open \"%s\" for reading."
- "Check that it exists and that you\ncan read it."
-E_FOR_ANYNONE
- "Reserved words \"any\" and \"none\" are not\nappropriate in this context."
- ""
-E_FOR_NOFORMS
- "No forms currently defined."
- ""
-E_FOR_NOSHCMDERR
- "No alert given."
- "You must give a shell command to use as\nthe alert."
-E_FOR_NOSHCMDWARN
- "No alert defined for form \"%s\"."
- "Use the -A option to define a shell\ncommand to use as the alert.\nProcessing continues."
-E_FOR_BADHDR
- "Bad input header in form description file on\nline %d."
- ""
-E_FOR_BADSCALE
- "Improper scaled decimal number on line %d."
- "You can use only 'i' and 'c' for scaling numbers."
-E_FOR_BADINT
- "Invalid integer given on line %d."
- "You must give a positive non-zero\ninteger value."
-E_FOR_BADCHSETQUALIFIER
- "Bad qualifier given after character set on\nline %d."
- "The only legal qualifier immediately\nfollowing a character set name is\n\",mandatory\"."
-E_FOR_TRAILIN
- "Bad input follows legal input on line %d."
- "Check to the System Administrator's\nReference manual for the correct syntax."
-E_FOR_NOTNAME
- "Incorrect syntax for name on line %d."
- "Give a name that has 1 to 14 letters,\ndigits, or underscores."
-E_FOR_NOTCTYPE
- "Incorrect syntax for content type on line %d."
- "Give a content type that has 1 to 14\nletters, digits, or dashes."
-E_FOR_UNKNOWN
- "Error accessing form \"%s\"\n(%s)."
- ""
-E_FOR_FORMBUSY
- "There are jobs currently queued for form\n\"%s\""
- "Either wait for the requests to finish\nprinting or cancel them. Use the\nlpstat -o -l command to find out which\nneed this form."
-E_FOR_NOSPACE
- "The LP print service can't take in another form."
- "The form definition has been saved on\ndisk nonetheless. Stop the LP print\nservice (/usr/sbin/lpshut) and restart it\n(/usr/lib/lp/lpsched) to have it\nrecognize the new form."
-E_FOR_ANYDEL
- "Nothing will happen."
- "The \"-f any\" option is used to set an\nalert for those forms without an alert,\nbut \"-A none\" defines no alert."
-E_FOR_ALSO_SEP_FORM
- "The form `%s' cannot be defined with\npaper `%s' because `%s' is already\ndefined as an old style form. "
- "Either use another name, or remove the\nconflicting form using `lpforms'."
-
-#endif
-
-/**
- ** MESSAGES FOR THE LPSTAT PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_STAT__MSGS
-
-#if WHO_AM_I == I_AM_LPSTAT || WHO_AM_I == I_AM_OZ
-
-E_STAT_BADSET
- "Non-existent character set \"%s\"."
- "Check the name again; use the\n\"lpstat -S all\" command to get a list of\nall known character sets."
-E_STAT_BADSTAT
- "\"%s\" isn't a request ID or destination"
- "Use the \"lpstat -p all -c all\" command\nto get a list of valid destinations.\nUse the \"lpstat -o all\" command to get a\nlist of all outstanding print requests."
-E_STAT_DONE
- "\"%s\" already printed."
- "You can't get any information about this\nrequest, since no record of it remains."
-E_STAT_USER
- "\"%s\" is not currently a user on this system."
- "Check the spelling of the name.\nUse the \"lpstat -u all\" command to get a\nlist of outstanding print requests."
-
-#endif
-
-/**
- ** MESSAGES FOR THE LPSYSTEM PROGRAM
- **/
-
-/* DON'T TOUCH THE NEXT LINE */
-E_SYS__MSGS
-
-#if WHO_AM_I == I_AM_LPSYSTEM || WHO_AM_I == I_AM_OZ
-
-E_SYS_NOTCPIP
- "TCP/IP is not installed on this system."
- ""
-#endif
diff --git a/usr/src/cmd/lp/lib/papi/Makefile b/usr/src/cmd/lp/lib/papi/Makefile
deleted file mode 100644
index 0db8138e89..0000000000
--- a/usr/src/cmd/lp/lib/papi/Makefile
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-LIBRARY = psm-lpsched.a
-VERS=.1
-
-LPSCHED_OBJS = lpsched-msgs.o lpsched-service.o lpsched-printers.o \
- lpsched-jobs.o lpsched-misc.o
-OBJECTS = $(LPSCHED_OBJS) service.o printer.o job.o ppd.o library.o
-
-
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
-
-ROOTLIBDIR= $(ROOT)/usr/lib/print
-
-CPPFLAGS = -I.
-CPPFLAGS += -I$(LPINC)
-CPPFLAGS += -I$(SRC)/lib/print/libpapi-common/common
-CPPFLAGS += -D_REENTRANT
-CPPFLAGS += $(ENVCPPFLAGS1)
-CPPFLAGS += $(ENVCPPFLAGS2)
-LDLIBS += -lcurses -lc
-LDLIBS += -L$(SRC)/cmd/lp/lib/msgs -llpmsg
-LDLIBS += -L$(SRC)/cmd/lp/lib/printers -llpprt
-LDLIBS += -L$(SRC)/cmd/lp/lib/class -llpcls
-LDLIBS += -L$(SRC)/cmd/lp/lib/requests -llpreq
-LDLIBS += -L$(SRC)/cmd/lp/lib/secure -llpsec
-LDLIBS += -L$(SRC)/cmd/lp/lib/forms -llpfrm
-LDLIBS += -L$(SRC)/cmd/lp/lib/access -llpacc
-LDLIBS += -L$(SRC)/cmd/lp/lib/lp -llp
-
-MAPFILES = mapfile
-
-LIBS = $(DYNLIB)
-SRCS= $(OBJECTS:%.o=%.c)
-
-#${ROOTLIBDIR}:
-# $(INS.dir)
-
-POFILE = lp_lib_papi_psm.po
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-_msg: $(POFILE)
-
-install: $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS)
-
-cstyle:
- $(CSTYLE) $(SRCS)
-
-lint: lintcheck
-
-include ../../../../lib/Makefile.targ
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/papi/job.c b/usr/src/cmd/lp/lib/papi/job.c
deleted file mode 100644
index aafce80d0c..0000000000
--- a/usr/src/cmd/lp/lib/papi/job.c
+++ /dev/null
@@ -1,1420 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <libintl.h>
-#include <pwd.h>
-#include <sys/stat.h>
-#include <papi_impl.h>
-
-/*
- * for an older application that may have been linked with a pre-v1.0
- * PAPI implementation.
- */
-papi_status_t
-papiAttributeListAdd(papi_attribute_t ***attrs, int flags, char *name,
- papi_attribute_value_type_t type, papi_attribute_value_t *value)
-{
- return (papiAttributeListAddValue(attrs, flags, name, type, value));
-}
-
-#ifdef LP_USE_PAPI_ATTR
-static papi_status_t psm_modifyAttrsFile(papi_attribute_t **attrs, char *file);
-static papi_status_t psm_modifyAttrsList(char *file, papi_attribute_t **attrs,
- papi_attribute_t ***newAttrs);
-#endif
-
-int32_t
-check_job_id(papi_service_t svc, char *printer, int32_t id)
-{
- papi_job_t *jobs = NULL;
- papi_status_t status;
- int ret = -1;
- char *jattrs[] = { "job-id",
- "job-id-requested", NULL };
-
- status = papiPrinterListJobs(svc, printer, jattrs, PAPI_LIST_JOBS_ALL,
- 0, &jobs);
-
- if (status != PAPI_OK) {
- detailed_error(svc,
- gettext("Failed to query service for %s: %s\n"),
- printer, lpsched_status_string(status));
- return (-1);
- }
-
- if (jobs != NULL) {
- int i = 0;
-
- for (i = 0; jobs[i] != NULL; i++) {
- int32_t rid = -1;
- int32_t jid = -1;
- papi_attribute_t **list =
- papiJobGetAttributeList(jobs[i]);
-
- papiAttributeListGetInteger(list, NULL,
- "job-id-requested", &rid);
- papiAttributeListGetInteger(list, NULL,
- "job-id", &jid);
-
- /*
- * check if id matches with either rid or jid
- */
- if (rid == id) {
- /* get the actual id and return it */
- papiAttributeListGetInteger(list, NULL,
- "job-id", &id);
- return (id);
- } else if (jid == id) {
- if (rid != -1) {
- /*
- * It is a remote lpd job.
- * It cannot be modified based on job-id
- * or spool number
- */
- return (-1);
- } else {
- /*
- * It is either local job or
- * remote ipp job
- */
- return (id);
- }
- }
- }
- }
- return (id);
-}
-
-void
-papiJobFree(papi_job_t job)
-{
- job_t *tmp = (job_t *)job;
-
- if (tmp != NULL) {
- papiAttributeListFree(tmp->attributes);
- free(tmp);
- }
-}
-
-void
-papiJobListFree(papi_job_t *jobs)
-{
- if (jobs != NULL) {
- int i;
-
- for (i = 0; jobs[i] != NULL; i++) {
- papiJobFree(jobs[i]);
- }
- free(jobs);
- }
-}
-
-papi_attribute_t **
-papiJobGetAttributeList(papi_job_t job)
-{
- job_t *tmp = (job_t *)job;
-
- if (tmp != NULL)
- return (tmp->attributes);
-
- return (NULL);
-}
-
-char *
-papiJobGetPrinterName(papi_job_t job)
-{
- job_t *tmp = (job_t *)job;
- char *result = NULL;
-
- if (tmp != NULL)
- papiAttributeListGetString(tmp->attributes, NULL,
- "printer-name", &result);
-
- return (result);
-}
-
-int32_t
-papiJobGetId(papi_job_t job)
-{
- job_t *tmp = (job_t *)job;
- int result = -1;
-
- if (tmp != NULL)
- papiAttributeListGetInteger(tmp->attributes, NULL, "job-id",
- &result);
-
- return (result);
-}
-
-static REQUEST *
-create_request(papi_service_t svc, char *printer, papi_attribute_t **attributes)
-{
- REQUEST *r;
-
- if ((r = calloc(1, sizeof (*r))) != NULL) {
- char *hostname = NULL;
-
- r->priority = -1;
- r->destination = printer_name_from_uri_id(printer, -1);
-
- papiAttributeListGetString(attributes, NULL,
- "job-originating-host-name", &hostname);
-
- if (hostname == NULL) {
- char host[BUFSIZ];
-
- if (gethostname(host, sizeof (host)) == 0)
- papiAttributeListAddString(&attributes,
- PAPI_ATTR_REPLACE,
- "job-originating-host-name",
- host);
- }
-
- job_attributes_to_lpsched_request(svc, r, attributes);
- }
-
- return (r);
-}
-
-static papi_status_t
-authorized(service_t *svc, int32_t id)
-{
- papi_status_t result = PAPI_NOT_AUTHORIZED; /* assume the worst */
- char file[32];
- REQUEST *r;
-
- snprintf(file, sizeof (file), "%d-0", id);
- if ((r = getrequest(file)) != NULL) {
- uid_t uid = getuid();
- struct passwd *pw = NULL;
- char *user = "intruder"; /* assume an intruder */
-
- if ((pw = getpwuid(uid)) != NULL)
- user = pw->pw_name; /* use the process owner */
-
- if ((uid == 0) || (uid == 71)) { /* root/lp can forge this */
- papi_status_t s;
- s = papiAttributeListGetString(svc->attributes, NULL,
- "user-name", &user);
- if (s != PAPI_OK) /* true root/lp are almighty */
- result = PAPI_OK;
- }
-
- if (result != PAPI_OK) {
- if (strcmp(user, r->user) == 0)
- result = PAPI_OK;
- else {
- /*
- * user and r->user might contain the
- * host info also
- */
- char *token1 = strtok(r->user, "@");
- char *token2 = strtok(NULL, "@");
- char *token3 = strtok(user, "@");
- char *token4 = strtok(NULL, "@");
-
- /*
- * token1 and token3 contain usernames
- * token2 and token4 contain hostnames
- */
- if ((token1 == NULL) || (token3 == NULL))
- result = PAPI_NOT_AUTHORIZED;
- else if ((token4 != NULL) &&
- (strcmp(token4, "localhost") == 0) &&
- (strcmp(token3, "root") == 0) ||
- (strcmp(token3, "lp") == 0)) {
- /*
- * root/lp user on server can
- * cancel any requset
- */
- result = PAPI_OK;
- } else if (strcmp(token1, token3) == 0) {
- /*
- * usernames are same
- * compare the hostnames
- */
- if ((token4 != NULL) &&
- (token2 != NULL) &&
- (strcmp(token4, "localhost") ==
- 0)) {
- /*
- * Its server machine
- */
- static char host[256];
- if (gethostname(host,
- sizeof (host)) == 0) {
- if ((host != NULL) &&
- (strcmp(host,
- token2) == 0))
- result =
- PAPI_OK;
- }
-
- } else if ((token4 != NULL) &&
- (token2 != NULL) &&
- (strcmp(token4, token2) == 0)) {
- result = PAPI_OK;
- } else if ((token4 == NULL) &&
- (token2 != NULL)) {
- /*
- * When the request is sent from
- * client to server using ipp
- * token4 is NULL
- */
- result = PAPI_OK;
- }
- }
- }
- }
-
- freerequest(r);
- } else
- result = PAPI_NOT_FOUND;
-
- return (result);
-}
-
-static papi_status_t
-copy_file(char *from, char *to)
-{
- int ifd, ofd;
- char buf[BUFSIZ];
- int rc;
-
- if ((ifd = open(from, O_RDONLY)) < 0)
- return (PAPI_DOCUMENT_ACCESS_ERROR);
-
- if ((ofd = open(to, O_WRONLY)) < 0) {
- close(ifd);
- return (PAPI_NOT_POSSIBLE);
- }
-
- while ((rc = read(ifd, buf, sizeof (buf))) > 0)
- write(ofd, buf, rc);
-
- close(ifd);
- close(ofd);
-
- return (PAPI_OK);
-}
-
-
-#ifdef LP_USE_PAPI_ATTR
-/*
- * *****************************************************************************
- *
- * Description: Create a file containing all the attributes in the attribute
- * list passed to this function.
- * This file is then passed through lpsched and given to either
- * a slow-filter or to the printer's interface script to process
- * the attributes.
- *
- * Parameters: attrs - list of attributes and their values
- * file - file pathname to create and put the attributes into.
- *
- * *****************************************************************************
- */
-
-static papi_status_t
-psm_copy_attrsToFile(papi_attribute_t **attrs, char *file)
-
-{
- papi_status_t result = PAPI_OK;
-
- if ((attrs != NULL) && (*attrs != NULL)) {
- FILE *out = NULL;
-
- if ((out = fopen(file, "w")) != NULL) {
- papiAttributeListPrint(out, attrs, "");
- fclose(out);
- } else {
- result = PAPI_NOT_POSSIBLE;
- }
- }
-
- return (result);
-} /* psm_copy_attrsToFile */
-
-
-/*
- * *****************************************************************************
- *
- * Description: Modify the given attribute 'file' with the attributes from the
- * 'attrs' list. Attributes already in the file will be replaced
- * with the new value. New attributes will be added into the file.
- *
- * Parameters: attrs - list of attributes and their values
- * file - file pathname to create and put the attributes into.
- *
- * *****************************************************************************
- */
-
-static papi_status_t
-psm_modifyAttrsFile(papi_attribute_t **attrs, char *file)
-
-{
- papi_status_t result = PAPI_OK;
- papi_attribute_t **newAttrs = NULL;
- struct stat tmpBuf;
- FILE *fd = NULL;
-
- if ((attrs != NULL) && (*attrs != NULL) && (file != NULL)) {
-
- /*
- * check file exist before try to modify it, if it doesn't
- * exist assume there is an error
- */
- if (stat(file, &tmpBuf) == 0) {
- /*
- * if file is currently empty just write the given
- * attributes to the file otherwise exact the attributes
- * from the file and modify them accordingly before
- * writing them back to the file
- */
- if (tmpBuf.st_size == 0) {
- newAttrs = (papi_attribute_t **)attrs;
-
- fd = fopen(file, "w");
- if (fd != NULL) {
- papiAttributeListPrint(fd,
- newAttrs, "");
- fclose(fd);
- } else {
- result = PAPI_NOT_POSSIBLE;
- }
- } else {
- result =
- psm_modifyAttrsList(file, attrs, &newAttrs);
-
- fd = fopen(file, "w");
- if (fd != NULL) {
- papiAttributeListPrint(fd,
- newAttrs, "");
- fclose(fd);
- } else {
- result = PAPI_NOT_POSSIBLE;
- }
-
- papiAttributeListFree(newAttrs);
- }
- } else {
- result = PAPI_NOT_POSSIBLE;
- }
- }
-
- return (result);
-} /* psm_modifyAttrsFile */
-
-
-/*
- * *****************************************************************************
- *
- * Description: Extracts the attributes in the given attribute 'file' and
- * creates a new list 'newAttrs' containing the modified list of
- * attributes.
- *
- * Parameters: file - pathname of file containing attributes to be modified
- * attrs - list of attributes and their values to modify
- * newAttrs - returns the modified list of attributes
- *
- * *****************************************************************************
- */
-
-static papi_status_t
-psm_modifyAttrsList(char *file, papi_attribute_t **attrs,
- papi_attribute_t ***newAttrs)
-
-{
- papi_status_t result = PAPI_OK;
- papi_attribute_t *nextAttr = NULL;
- papi_attribute_value_t **values = NULL;
- void *iter = NULL;
- FILE *fd = NULL;
- register int fD = 0;
- char aBuff[200];
- char *a = NULL;
- char *p = NULL;
- int count = 0;
- int n = 0;
-
- fd = fopen(file, "r");
- if (fd != NULL) {
- fD = fileno(fd);
- a = &aBuff[0];
- p = &aBuff[0];
- count = read(fD, &aBuff[0], sizeof (aBuff) - 1);
- while ((result == PAPI_OK) && (count > 0)) {
- aBuff[count+n] = '\0';
- if (count == sizeof (aBuff) - n - 1) {
- p = strrchr(aBuff, '\n');
- if (p != NULL) {
- /* terminate at last complete line */
- *p = '\0';
- }
- }
- result = papiAttributeListFromString(
- newAttrs, PAPI_ATTR_EXCL, aBuff);
-
- if (result == PAPI_OK) {
- /*
- * handle any part lines and then read the next
- * buffer from the file
- */
- n = 0;
- if (p != a) {
- p++; /* skip NL */
- n = sizeof (aBuff) - 1 - (p - a);
- strncpy(aBuff, p, n);
- }
- count = read(fD, &aBuff[n],
- sizeof (aBuff) - n - 1);
- p = &aBuff[0];
- }
- }
- fclose(fd);
- }
-
- /* now modify the attribute list with the new attributes in 'attrs' */
-
- nextAttr = papiAttributeListGetNext((papi_attribute_t **)attrs, &iter);
- while ((result == PAPI_OK) && (nextAttr != NULL)) {
- values = nextAttr->values;
-
- if ((values != NULL) && (*values != NULL)) {
- result = papiAttributeListAddValue(newAttrs,
- PAPI_ATTR_REPLACE,
- nextAttr->name,
- nextAttr->type, *values);
- values++;
- }
-
- while ((result == PAPI_OK) &&
- (values != NULL) && (*values != NULL)) {
- result = papiAttributeListAddValue(newAttrs,
- PAPI_ATTR_APPEND,
- nextAttr->name,
- nextAttr->type, *values);
- values++;
- }
- nextAttr =
- papiAttributeListGetNext((papi_attribute_t **)attrs, &iter);
- }
-
- return (result);
-} /* papi_modifyAttrsList() */
-#endif
-
-
-papi_status_t
-papiJobSubmit(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job)
-{
- papi_status_t status;
- service_t *svc = handle;
- struct stat statbuf;
- job_t *j;
- int file_no;
- char *request_id = NULL;
- REQUEST *request;
- int i;
- char *c;
- char *tmp = NULL;
- char lpfile[BUFSIZ];
-
- if ((svc == NULL) || (printer == NULL) || (files == NULL) ||
- (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (job_ticket != NULL)
- return (PAPI_OPERATION_NOT_SUPPORTED);
-
- if (files != NULL)
- for (file_no = 0; files[file_no] != NULL; file_no++) {
- if (access(files[file_no], R_OK) < 0) {
- detailed_error(svc,
- gettext("Cannot access file: %s: %s"),
- files[file_no], strerror(errno));
- return (PAPI_BAD_ARGUMENT);
- }
- if (stat(files[file_no], &statbuf) < 0) {
- detailed_error(svc,
- gettext("Cannot access file: %s: %s"),
- files[file_no], strerror(errno));
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- }
- if (statbuf.st_size == 0) {
- detailed_error(svc,
- gettext("Zero byte (empty) file: %s"),
- files[file_no]);
- return (PAPI_BAD_ARGUMENT);
- }
- }
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /* file_no + 1 for the control file (-0) */
- status = lpsched_alloc_files(svc, file_no + 1, &request_id);
- if (status != PAPI_OK)
- return (status);
-
- request = create_request(svc, (char *)printer,
- (papi_attribute_t **)job_attributes);
-
- for (i = 0; files[i] != NULL; i++) {
- papi_status_t status;
- snprintf(lpfile, sizeof (lpfile), "%s%s-%d",
- "/var/spool/lp/temp/", request_id, i+1);
- status = copy_file(files[i], lpfile);
- if (status != PAPI_OK) {
- detailed_error(svc,
- gettext("unable to copy: %s -> %s: %s"),
- files[i], lpfile, strerror(errno));
- freerequest(request);
- return (PAPI_DEVICE_ERROR);
- }
- addlist(&(request->file_list), lpfile);
- }
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * store the job attributes in the PAPI job attribute file that was
- * created by lpsched_alloc_files(), the attributes will then pass
- * through lpsched and be given to the slow-filters and the printer's
- * interface script to process them
- */
- snprintf(lpfile, sizeof (lpfile), "%s%s-%s",
- "/var/spool/lp/temp/", request_id, LP_PAPIATTRNAME);
- status = psm_copy_attrsToFile(job_attributes, lpfile);
- if (status != PAPI_OK) {
- detailed_error(svc, "unable to copy attributes to file: %s: %s",
- lpfile, strerror(errno));
- return (PAPI_DEVICE_ERROR);
- }
-#endif
-
- /* store the meta-data file */
- snprintf(lpfile, sizeof (lpfile), "%s-0", request_id);
- if (putrequest(lpfile, request) < 0) {
- detailed_error(svc, gettext("unable to save request: %s: %s"),
- lpfile, strerror(errno));
- freerequest(request);
- return (PAPI_DEVICE_ERROR);
- }
-
- status = lpsched_commit_job(svc, lpfile, &tmp);
- if (status != PAPI_OK) {
- unlink(lpfile);
- freerequest(request);
- return (status);
- }
-
- lpsched_request_to_job_attributes(request, j);
- freerequest(request);
-
- if ((c = strrchr(tmp, '-')) != NULL)
- c++;
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "job-id", atoi(c));
- papiAttributeListAddString(&j->attributes, PAPI_ATTR_REPLACE,
- "job-uri", tmp);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiJobSubmitByReference(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job)
-{
- service_t *svc = handle;
- struct stat statbuf;
- job_t *j;
- int file_no;
- short status;
- char *request_id = NULL;
- REQUEST *request;
- char *c;
- char *tmp = NULL;
- char lpfile[BUFSIZ];
- char **file_list = NULL;
-
- if ((svc == NULL) || (printer == NULL) || (files == NULL) ||
- (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (job_ticket != NULL)
- return (PAPI_OPERATION_NOT_SUPPORTED);
-
- if (files != NULL)
- for (file_no = 0; files[file_no] != NULL; file_no++) {
- if (access(files[file_no], R_OK) < 0) {
- detailed_error(svc,
- gettext("Cannot access file: %s: %s"),
- files[file_no], strerror(errno));
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- }
- if (stat(files[file_no], &statbuf) < 0) {
- detailed_error(svc,
- gettext("Cannot access file: %s: %s"),
- files[file_no], strerror(errno));
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- }
- if (statbuf.st_size == 0) {
- detailed_error(svc,
- gettext("Zero byte (empty) file: %s"),
- files[file_no]);
- return (PAPI_BAD_ARGUMENT);
- }
-
- if (files[file_no][0] != '/') {
- char path[MAXPATHLEN];
-
- if (getcwd(path, sizeof (path)) == NULL) {
- detailed_error(svc, gettext(
- "getcwd for file: %s: %s"),
- files[file_no],
- strerror(errno));
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- }
- strlcat(path, "/", sizeof (path));
- if (strlcat(path, files[file_no], sizeof (path))
- >= sizeof (path)) {
- detailed_error(svc, gettext(
- "pathname too long: %s"),
- files[file_no]);
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- }
- addlist(&file_list, path);
- } else
- addlist(&file_list, (char *)files[file_no]);
- }
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /* 1 for the control file (-0) */
- status = lpsched_alloc_files(svc, 1, &request_id);
- if (status != PAPI_OK)
- return (status);
-
- request = create_request(svc, (char *)printer,
- (papi_attribute_t **)job_attributes);
- request->file_list = file_list;
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * store the job attributes in the PAPI job attribute file that was
- * created by lpsched_alloc_files(), the attributes will then pass
- * through lpsched and be given to the slow-filters and the printer's
- * interface script to process them
- */
- snprintf(lpfile, sizeof (lpfile), "%s%s-%s",
- "/var/spool/lp/temp/", request_id, LP_PAPIATTRNAME);
- status = psm_copy_attrsToFile(job_attributes, lpfile);
- if (status != PAPI_OK) {
- detailed_error(svc, "unable to copy attributes to file: %s: %s",
- lpfile, strerror(errno));
- return (PAPI_DEVICE_ERROR);
- }
-#endif
-
- /* store the meta-data file */
- snprintf(lpfile, sizeof (lpfile), "%s-0", request_id);
- if (putrequest(lpfile, request) < 0) {
- detailed_error(svc, gettext("unable to save request: %s: %s"),
- lpfile, strerror(errno));
- freerequest(request);
- return (PAPI_DEVICE_ERROR);
- }
-
- status = lpsched_commit_job(svc, lpfile, &tmp);
- if (status != PAPI_OK) {
- unlink(lpfile);
- freerequest(request);
- return (status);
- }
-
- lpsched_request_to_job_attributes(request, j);
-
- freerequest(request);
-
- if ((c = strrchr(tmp, '-')) != NULL)
- c++;
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "job-id", atoi(c));
- papiAttributeListAddString(&j->attributes, PAPI_ATTR_REPLACE,
- "job-uri", tmp);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiJobValidate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job)
-{
- papi_status_t status;
- papi_attribute_t **attributes = NULL;
- int i;
-
- papiAttributeListAddString(&attributes, PAPI_ATTR_REPLACE,
- "job-hold-until", "indefinite");
- for (i = 0; job_attributes[i]; i++)
- list_append(&attributes, job_attributes[i]);
-
- status = papiJobSubmitByReference(handle, printer,
- (papi_attribute_t **)attributes,
- job_ticket, files, job);
- if (status == PAPI_OK) {
- int id = papiJobGetId(*job);
-
- if (id != -1)
- papiJobCancel(handle, printer, id);
- }
-
- attributes[1] = NULL; /* after attr[0], they are in another list */
- papiAttributeListFree(attributes);
-
- return (status);
-}
-
-papi_status_t
-papiJobStreamOpen(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, papi_stream_t *stream)
-{
- papi_status_t status;
- service_t *svc = handle;
- job_stream_t *s = NULL;
- char *request_id = NULL;
- char lpfile[BUFSIZ];
-
- if ((svc == NULL) || (printer == NULL) || (stream == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (job_ticket != NULL)
- return (PAPI_OPERATION_NOT_SUPPORTED);
-
- if ((*stream = s = calloc(1, sizeof (*s))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /* 1 for data, 1 for the meta-data (-0) */
- status = lpsched_alloc_files(svc, 2, &request_id);
- if (status != PAPI_OK)
- return (status);
-
- papiAttributeListAddString(&job_attributes, PAPI_ATTR_EXCL,
- "job-name", "standard input");
-
- s->request = create_request(svc, (char *)printer,
- (papi_attribute_t **)job_attributes);
- snprintf(lpfile, sizeof (lpfile), "/var/spool/lp/temp/%s-1",
- request_id);
- s->fd = open(lpfile, O_WRONLY);
- addlist(&(s->request->file_list), lpfile);
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * store the job attributes in the PAPI job attribute file that was
- * created by lpsched_alloc_files(), the attributes will then pass
- * through lpsched and be given to the slow-filters and the printer's
- * interface script to process them
- */
- snprintf(lpfile, sizeof (lpfile), "%s%s-%s",
- "/var/spool/lp/temp/", request_id, LP_PAPIATTRNAME);
- status = psm_copy_attrsToFile(job_attributes, lpfile);
- if (status != PAPI_OK) {
- detailed_error(svc, "unable to copy attributes to file: %s: %s",
- lpfile, strerror(errno));
- close(s->fd);
- free(s);
- return (PAPI_DEVICE_ERROR);
- }
-#endif
-
- /* store the meta-data file */
- snprintf(lpfile, sizeof (lpfile), "%s-0", request_id);
- s->meta_data_file = strdup(lpfile);
- if (putrequest(lpfile, s->request) < 0) {
- detailed_error(svc, gettext("unable to save request: %s: %s"),
- lpfile, strerror(errno));
- s->request = NULL;
- return (PAPI_DEVICE_ERROR);
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiJobStreamWrite(papi_service_t handle,
- papi_stream_t stream, void *buffer, size_t buflen)
-{
- service_t *svc = handle;
- job_stream_t *s = stream;
-
- if ((svc == NULL) || (stream == NULL) || (buffer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (write(s->fd, buffer, buflen) != buflen)
- return (PAPI_DEVICE_ERROR);
-
- return (PAPI_OK);
-}
-papi_status_t
-papiJobStreamClose(papi_service_t handle,
- papi_stream_t stream, papi_job_t *job)
-{
- papi_status_t status = PAPI_OK;
- service_t *svc = handle;
- job_stream_t *s = stream;
- job_t *j = NULL;
- char *tmp = NULL, *c;
-
- if ((svc == NULL) || (stream == NULL) || (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- close(s->fd);
-
- lpsched_request_to_job_attributes(s->request, j);
-
- if (s->meta_data_file != NULL) {
- status = lpsched_commit_job(svc, s->meta_data_file, &tmp);
- if (status != PAPI_OK) {
- unlink(s->meta_data_file);
- return (status);
- }
- if ((c = strrchr(tmp, '-')) != NULL)
- c++;
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "job-id", atoi(c));
- papiAttributeListAddString(&j->attributes, PAPI_ATTR_REPLACE,
- "job-uri", tmp);
- free(s->meta_data_file);
- }
- freerequest(s->request);
- free(s);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiJobQuery(papi_service_t handle, char *printer, int32_t job_id,
- char **requested_attrs,
- papi_job_t *job)
-{
- service_t *svc = handle;
- job_t *j;
- char *dest;
- char req_id[32];
- short rc;
- char *form = NULL,
- *request_id = NULL,
- *charset = NULL,
- *user = NULL,
- *slabel = NULL,
- *file = NULL;
- time_t date = 0;
- size_t size = 0;
- short rank = 0,
- state = 0;
-
- if ((handle == NULL) || (printer == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(printer, job_id);
- snprintf(req_id, sizeof (req_id), "%s-%d", dest, job_id);
- free(dest);
-
- rc = snd_msg(svc, S_INQUIRE_REQUEST_RANK, 0, "", "", req_id, "", "");
- if (rc < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- if (rcv_msg(svc, R_INQUIRE_REQUEST_RANK, &rc, &request_id,
- &user, &slabel, &size, &date, &state, &dest, &form,
- &charset, &rank, &file) < 0) {
- detailed_error(svc,
- gettext("failed to read response from scheduler"));
- return (PAPI_DEVICE_ERROR);
- }
-
- if ((request_id == NULL) || (request_id[0] == NULL))
- return (PAPI_NOT_FOUND);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- snprintf(req_id, sizeof (req_id), "%d-0", job_id);
- lpsched_read_job_configuration(svc, j, req_id);
-
- job_status_to_attributes(j, request_id, user, slabel, size, date, state,
- dest, form, charset, rank, file);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiJobMove(papi_service_t handle, char *printer, int32_t job_id,
- char *destination)
-{
- papi_status_t result = PAPI_OK;
- long bits;
- service_t *svc = handle;
- char req_id[64];
- char *queue;
- char *user = NULL;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0) ||
- (destination == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- queue = printer_name_from_uri_id(printer, job_id);
- snprintf(req_id, sizeof (req_id), "%s-%d", queue, job_id);
- free(queue);
-
- if (papiAttributeListGetString(svc->attributes, NULL, "user-name",
- &user) == PAPI_OK) {
- REQUEST *r = getrequest(req_id);
-
- if ((r != NULL) && (r->user != NULL) &&
- (strcmp(r->user, user) != 0))
- result = PAPI_NOT_AUTHORIZED;
- freerequest(r);
- }
-
- if (result == PAPI_OK) {
- short status = MOK;
- char *dest = printer_name_from_uri_id(destination, -1);
-
- if ((snd_msg(svc, S_MOVE_REQUEST, req_id, dest) < 0) ||
- (rcv_msg(svc, R_MOVE_REQUEST, &status, &bits) < 0))
- status = MTRANSMITERR;
-
- free(dest);
-
- result = lpsched_status_to_papi_status(status);
- }
-
- return (result);
-}
-
-papi_status_t
-papiJobCancel(papi_service_t handle, char *printer, int32_t job_id)
-{
- papi_status_t result = PAPI_OK;
- service_t *svc = handle;
- char req_id[64];
- char *dest;
- char *user = NULL;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(printer, job_id);
- snprintf(req_id, sizeof (req_id), "%s-%d", dest, job_id);
- free(dest);
-
- if (papiAttributeListGetString(svc->attributes, NULL, "user-name",
- &user) == PAPI_OK) {
- REQUEST *r = getrequest(req_id);
-
- if ((result = authorized(handle, job_id)) != PAPI_OK)
- result = PAPI_NOT_AUTHORIZED;
-
- if ((r != NULL) && (r->user != NULL) &&
- (strcmp(r->user, user) != 0))
- result = PAPI_NOT_AUTHORIZED;
- freerequest(r);
- }
-
- if (result == PAPI_OK) {
- short status = MOK;
-
- if ((snd_msg(svc, S_CANCEL_REQUEST, req_id) < 0) ||
- (rcv_msg(svc, R_CANCEL_REQUEST, &status) < 0))
- status = MTRANSMITERR;
-
- result = lpsched_status_to_papi_status(status);
- }
-
- return (result);
-}
-
-papi_status_t
-hold_release_job(papi_service_t handle, char *printer,
- int32_t job_id, int flag)
-{
- papi_status_t status;
- service_t *svc = handle;
- REQUEST *r = NULL;
- char *file;
- char *dest;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- if ((status = authorized(svc, job_id)) != PAPI_OK)
- return (status);
-
- dest = printer_name_from_uri_id(printer, job_id);
- status = lpsched_start_change(svc, dest, job_id, &file);
- if (status != PAPI_OK)
- return (status);
-
- if ((r = getrequest(file)) != NULL) {
- r->actions &= ~ACT_RESUME;
- switch (flag) {
- case 0:
- r->actions |= ACT_HOLD;
- break;
- case 1:
- r->actions |= ACT_RESUME;
- break;
- case 2:
- r->actions |= ACT_IMMEDIATE;
- break;
- }
- if (putrequest(file, r) < 0) {
- detailed_error(svc,
- gettext("failed to write job: %s: %s"),
- file, strerror(errno));
- freerequest(r);
- return (PAPI_DEVICE_ERROR);
- }
- freerequest(r);
- } else {
- detailed_error(svc, gettext("failed to read job: %s: %s"),
- file, strerror(errno));
- return (PAPI_DEVICE_ERROR);
- }
-
- status = lpsched_end_change(svc, dest, job_id);
-
- return (status);
-}
-
-papi_status_t
-papiJobHold(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (hold_release_job(handle, printer, job_id, 0));
-}
-
-papi_status_t
-papiJobRelease(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (hold_release_job(handle, printer, job_id, 1));
-}
-
-papi_status_t
-papiJobPromote(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (hold_release_job(handle, printer, job_id, 2));
-}
-
-papi_status_t
-papiJobModify(papi_service_t handle, char *printer, int32_t job_id,
- papi_attribute_t **attributes, papi_job_t *job)
-{
- papi_status_t status;
- job_t *j = NULL;
- service_t *svc = handle;
- char *file = NULL;
- char *dest;
- REQUEST *r = NULL;
- char lpfile[BUFSIZ];
- int32_t job_id_actual;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0) ||
- (attributes == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- dest = printer_name_from_uri_id(printer, job_id);
-
- /*
- * job-id might be job-id-requested
- * If it is job-id-requested then we need to
- * look for corresponding job-id
- */
- job_id_actual = check_job_id(svc, printer, job_id);
-
- if (job_id_actual < 0) {
- status = PAPI_NOT_FOUND;
- detailed_error(svc,
- "failed to initiate change for job (%s-%d): %s",
- dest, job_id, "no such resource");
- return (status);
- }
-
- status = lpsched_start_change(svc, dest, job_id_actual, &file);
- if (status != PAPI_OK)
- return (status);
-
- if ((r = getrequest(file)) != NULL) {
- job_attributes_to_lpsched_request(handle, r,
- (papi_attribute_t **)attributes);
-#ifdef LP_USE_PAPI_ATTR
- /*
- * store the job attributes in the PAPI job attribute file
- * that was created by the original job request. We need to
- * modify the attributes in the file as per the new attributes
- */
- snprintf(lpfile, sizeof (lpfile), "%s%d-%s",
- "/var/spool/lp/temp/", job_id_actual, LP_PAPIATTRNAME);
- status = psm_modifyAttrsFile(attributes, lpfile);
- if (status != PAPI_OK) {
- detailed_error(svc,
- "unable to modify the attributes file: %s: %s",
- lpfile, strerror(errno));
- return (PAPI_DEVICE_ERROR);
- }
-#endif
-
- if (putrequest(file, r) < 0) {
- detailed_error(svc,
- gettext("failed to write job: %s: %s"),
- file, strerror(errno));
- freerequest(r);
- return (PAPI_DEVICE_ERROR);
- }
- } else {
- detailed_error(svc, gettext("failed to read job: %s: %s"),
- file, strerror(errno));
- return (PAPI_DEVICE_ERROR);
- }
-
- status = lpsched_end_change(svc, dest, job_id_actual);
- lpsched_request_to_job_attributes(r, j);
-
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "job-id", job_id_actual);
-
- freerequest(r);
-
- return (status);
-}
-
-/*
- * Extension to PAPI, a variation of this is slated for post-1.0
- */
-#define DUMMY_FILE "/var/spool/lp/fifos/FIFO"
-
-papi_status_t
-papiJobCreate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, papi_job_t *job)
-{
- papi_status_t status;
- service_t *svc = handle;
- job_t *j = NULL;
- REQUEST *request;
- char *request_id = NULL;
- char *c;
- char *tmp = NULL;
- char metadata_file[MAXPATHLEN];
-
- if ((svc == NULL) || (printer == NULL) || (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (job_ticket != NULL)
- return (PAPI_JOB_TICKET_NOT_SUPPORTED);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /* 1 for the control file (-0) */
- status = lpsched_alloc_files(svc, 1, &request_id);
- if (status != PAPI_OK)
- return (status);
-
- /* convert the attributes to an lpsched REQUEST structure */
- request = create_request(svc, (char *)printer,
- (papi_attribute_t **)job_attributes);
- if (request == NULL)
- return (PAPI_TEMPORARY_ERROR);
- addlist(&request->file_list, DUMMY_FILE); /* add a dummy file */
- request->actions |= ACT_HOLD; /* hold the job */
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * store the job attributes in the PAPI job attribute file that was
- * created by lpsched_alloc_files(), the attributes will then pass
- * through lpsched and be given to the slow-filters and the printer's
- * interface script to process them
- */
- snprintf(metadata_file, sizeof (metadata_file), "%s%s-%s",
- "/var/spool/lp/temp/", request_id, LP_PAPIATTRNAME);
- status = psm_copy_attrsToFile(job_attributes, metadata_file);
- if (status != PAPI_OK) {
- detailed_error(svc, "unable to copy attributes to file: %s: %s",
- metadata_file, strerror(errno));
- free(request_id);
- return (PAPI_DEVICE_ERROR);
- }
-#endif
-
- /* store the REQUEST on disk */
- snprintf(metadata_file, sizeof (metadata_file), "%s-0", request_id);
- free(request_id);
- if (putrequest(metadata_file, request) < 0) {
- detailed_error(svc, gettext("unable to save request: %s: %s"),
- metadata_file, strerror(errno));
- return (PAPI_DEVICE_ERROR);
- }
-
- status = lpsched_commit_job(svc, metadata_file, &tmp);
- if (status != PAPI_OK) {
- unlink(metadata_file);
- return (status);
- }
-
- lpsched_request_to_job_attributes(request, j);
-
- if ((c = strrchr(tmp, '-')) != NULL)
- c++;
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "job-id", atoi(c));
- papiAttributeListAddString(&j->attributes, PAPI_ATTR_REPLACE,
- "job-uri", tmp);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiJobCommit(papi_service_t handle, char *printer, int32_t id)
-{
- papi_status_t status = PAPI_OK;
- service_t *svc = handle;
- REQUEST *r = NULL;
- char *metadata_file;
- char *dest;
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(printer, id);
- /* tell the scheduler that we want to change the job */
- status = lpsched_start_change(svc, dest, id, &metadata_file);
- if (status != PAPI_OK)
- return (status);
-
- if ((r = getrequest(metadata_file)) != NULL) {
- r->actions &= ~ACT_RESUME;
- r->actions |= ACT_RESUME;
- dellist(&r->file_list, DUMMY_FILE);
-
- if (putrequest(metadata_file, r) < 0) {
- detailed_error(svc,
- gettext("failed to write job: %s: %s"),
- metadata_file, strerror(errno));
- freerequest(r);
- return (PAPI_DEVICE_ERROR);
- }
- } else {
- detailed_error(svc, gettext("failed to read job: %s: %s"),
- metadata_file, strerror(errno));
- return (PAPI_DEVICE_ERROR);
- }
-
- status = lpsched_end_change(svc, dest, id);
- freerequest(r);
-
- return (status);
-}
-
-papi_status_t
-papiJobStreamAdd(papi_service_t handle, char *printer, int32_t id,
- papi_stream_t *stream)
-{
- papi_status_t status;
- service_t *svc = handle;
- job_stream_t *s = NULL;
- char *metadata_file = NULL;
- char *dest;
- char path[MAXPATHLEN];
-
- /* allocate space for the stream */
- if ((*stream = s = calloc(1, sizeof (*s))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- dest = printer_name_from_uri_id(printer, id);
- /* create/open data file (only root or lp can really do this */
- snprintf(path, sizeof (path), "/var/spool/lp/temp/%d-XXXXXX", id);
- if ((s->fd = mkstemp(path)) < 0) {
- detailed_error(svc, gettext("unable to create sink (%s): %s"),
- path, strerror(errno));
- free(s);
- return (PAPI_NOT_AUTHORIZED);
- }
-
- /* add data file to job */
- status = lpsched_start_change(svc, dest, id, &metadata_file);
- if (status != PAPI_OK) {
- close(s->fd);
- free(s);
- unlink(path);
- return (status);
- }
-
- if ((s->request = getrequest(metadata_file)) == NULL) {
- detailed_error(svc, gettext("unable to load request: %s: %s"),
- metadata_file, strerror(errno));
- close(s->fd);
- free(s);
- unlink(path);
- return (PAPI_NOT_POSSIBLE);
- }
-
- addlist(&(s->request->file_list), path);
-
- if (putrequest(metadata_file, s->request) < 0) {
- detailed_error(svc, gettext("unable to save request: %s: %s"),
- metadata_file, strerror(errno));
- close(s->fd);
- free(s);
- unlink(path);
- return (PAPI_NOT_POSSIBLE);
- }
-
- status = lpsched_end_change(svc, dest, id);
-
- if (status != PAPI_OK)
- return (status);
-
- return (PAPI_OK);
-}
diff --git a/usr/src/cmd/lp/lib/papi/library.c b/usr/src/cmd/lp/lib/papi/library.c
deleted file mode 100644
index 53c3a956a6..0000000000
--- a/usr/src/cmd/lp/lib/papi/library.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <string.h>
-#include <papi.h>
-
-static char *calls[] = {
- /* Attribute Calls */
- "papiAttributeListAddValue",
- "papiAttributeListAddBoolean", "papiAttributeListAddCollection",
- "papiAttributeListAddDatetime", "papiAttributeListAddInteger",
- "papiAttributeListAddMetadata", "papiAttributeListAddRange",
- "papiAttributeListAddResolution", "papiAttributeListAddString",
- "papiAttributeListDelete",
- "papiAttributeListGetValue", "papiAttributeListGetNext",
- "papiAttributeListFind",
- "papiAttributeListGetBoolean", "papiAttributeListGetCollection",
- "papiAttributeListGetDatetime", "papiAttributeListGetInteger",
- "papiAttributeListGetMetadata", "papiAttributeListGetRange",
- "papiAttributeListGetResolution", "papiAttributeListGetString",
- "papiAttributeListFromString", "papiAttributeListToString",
- "papiAttributeListFree",
- /* Job Calls */
- "papiJobSubmit", "papiJobSubmitByReference", "papiJobValidate",
- "papiJobStreamOpen", "papiJobStreamWrite", "papiJobStreamClose",
- "papiJobQuery", "papiJobModify", "papiJobCancel", "papiJobPromote",
- "papiJobGetAttributeList", "papiJobGetId", "papiJobGetPrinterName",
- "papiJobFree", "papiJobListFree",
- "papiJobHold", "papiJobRelease",
- /* Printer Calls */
- "papiPrintersList", "papiPrinterQuery", "papiPrinterModify",
- "papiPrinterAdd", "papiPrinterRemove",
- "papiPrinterPause", "papiPrinterResume",
- "papiPrinterDisable", "papiPrinterEnable",
- "papiPrinterPurgeJobs", "papiPrinterListJobs",
- "papiPrinterGetAttributeList",
- "papiPrinterFree", "papiPrinterListFree",
- /* Service Calls */
- "papiServiceCreate", "papiServiceDestroy",
- "papiServiceGetAppData",
- "papiServiceGetEncryption", "papiServiceGetPassword",
- "papiServiceGetServiceName", "papiServiceGetUserName",
- "papiServiceSetAppData", "papiServiceSetAuthCB",
- "papiServiceSetEncryption", "papiServiceSetPassword",
- "papiServiceSetUserName",
- "papiServiceGetAttributeList", "papiServiceGetStatusMessage",
- /* Misc Calls */
- "papiStatusString",
- "papiLibrarySupportedCall", "papiLibrarySupportedCalls",
- NULL
-};
-
-char **
-papiLibrarySupportedCalls()
-{
- return (calls);
-}
-
-char
-papiLibrarySupportedCall(const char *name)
-{
- int i;
-
- for (i = 0; calls[i] != NULL; i++)
- if (strcmp(name, calls[i]) == 0)
- return (PAPI_TRUE);
-
- return (PAPI_FALSE);
-}
diff --git a/usr/src/cmd/lp/lib/papi/lpsched-jobs.c b/usr/src/cmd/lp/lib/papi/lpsched-jobs.c
deleted file mode 100644
index 0713de64c2..0000000000
--- a/usr/src/cmd/lp/lib/papi/lpsched-jobs.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <libintl.h>
-#include <pwd.h>
-
-/* lpsched include files */
-#include "lp.h"
-#include "requests.h"
-#include "printers.h"
-
-#include <papi_impl.h>
-
-papi_status_t
-job_attributes_to_lpsched_request(papi_service_t svc, REQUEST *r,
- papi_attribute_t **attributes)
-{
- papi_status_t status = PAPI_OK;
- papi_attribute_t *attr;
- papi_attribute_t **unmapped = NULL;
- papi_attribute_t *tmp[2];
- int i;
- char *s;
-
- char **options = NULL;
- char **modes = NULL;
-
- char pr_filter = 0;
- char *pr_title = NULL;
- int pr_width = -1;
- int pr_indent = -1;
- int numberUp = 0;
- int orientation = 0;
- int lower = 0;
- int upper = 0;
- char buf[256];
- void *iterator = NULL;
- char *mapped_keys[] = { "copies", "document-format", "form",
- "job-class", "job-hold-until", "job-host", "job-name",
- "job-originating-user-name", "job-printer",
- "job-sheets", "lp-charset", "lp-modes", "number-up",
- "orienttation-requested", "page-ranges", "pr-filter",
- "pr-indent", "pr-title", "pr-width", "job-priority",
- "requesting-user-name", "job-originating-host-name",
- NULL };
-
- if (attributes == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- /* replace the current destination */
- papiAttributeListGetLPString(attributes,
- "job-printer", &r->destination);
-
- /* set the copies. We need at least 1 */
- i = r->copies;
- papiAttributeListGetInteger(attributes, NULL, "copies", &i);
- if (i <= 0)
- i = 1;
- r->copies = i;
-
- /*
- * set the priority. PAPI/IPP uses 1-100, lpsched use 0-39, so we
- * have to convert it.
- */
- if (papiAttributeListGetInteger(attributes, NULL, "job-priority", &i)
- == PAPI_OK) {
- if ((i < 1) || (i > 100))
- i = 50;
- i = 40 - (i / 2.5);
- r->priority = i;
- }
- if ((r->priority < 0) || (r->priority > 39))
- r->priority = 20;
-
- /* set the requested form to print on */
- papiAttributeListGetLPString(attributes, "form", &r->form);
-
- /* set the page range */
- memset(tmp, NULL, sizeof (tmp));
- tmp[0] = papiAttributeListFind(attributes, "page-ranges");
- if (tmp[0] != NULL) {
- char buf[BUFSIZ];
-
- papiAttributeListToString(tmp, " ", buf, sizeof (buf));
- if ((s = strchr(buf, '=')) != NULL)
- r->pages = (char *)strdup(++s);
- }
-
- /*
- * set the document format, converting to old format names as
- * as needed.
- */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "document-format", &s);
- if (s != NULL)
- r->input_type = strdup(mime_type_to_lp_type(s));
-
-
- /*
- * If we don't have an owner, set one.
- */
- if (r->user == NULL) {
- uid_t uid = getuid();
- struct passwd *pw;
- char *user = "intruder";
- char *host = NULL;
- char buf[256];
-
- if ((pw = getpwuid(uid)) != NULL)
- user = pw->pw_name; /* default to the process owner */
-
- papiAttributeListGetString(attributes, NULL,
- "job-originating-host-name", &host);
- papiAttributeListGetString(attributes, NULL,
- "job-host", &host);
- papiAttributeListGetString(attributes, NULL,
- "job-originating-user-name", &user);
- papiAttributeListGetString(attributes, NULL,
- "requesting-user-name", &user);
-
- snprintf(buf, sizeof (buf), "%s%s%s", user,
- (host ? "@" : ""), (host ? host : ""));
- user = buf;
-
- r->user = strdup(user);
- }
-
- /* set any held state */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "job-hold-until", &s);
- if (s != NULL) {
- r->actions &= ~(ACT_SPECIAL); /* strip immediate/hold/resume */
- if (strcmp(s, "resume") == 0)
- r->actions |= ACT_RESUME;
- else if ((strcmp(s, "immediate") == 0) ||
- (strcmp(s, "no-hold") == 0))
- r->actions |= ACT_IMMEDIATE;
- else if ((strcmp(s, "indefinite") == 0) ||
- (strcmp(s, "hold") == 0))
- r->actions |= ACT_HOLD;
- }
-
- /* set lp charset/printwheel */
- papiAttributeListGetLPString(attributes, "lp-charset", &r->charset);
-
- /* legacy pr(1) filter related garbage "lpr -p" */
- papiAttributeListGetBoolean(attributes, NULL, "pr-filter", &pr_filter);
- papiAttributeListGetString(attributes, NULL, "pr-title", &pr_title);
- papiAttributeListGetInteger(attributes, NULL, "pr-width", &pr_width);
- papiAttributeListGetInteger(attributes, NULL, "pr-indent", &pr_indent);
-
- if (pr_filter != 0) {
- char buf[128];
-
- if (pr_title != NULL) {
- snprintf(buf, sizeof (buf), "prtitle='%s'", pr_title);
- appendlist(&modes, buf);
- }
-
- if (pr_width > 0) {
- snprintf(buf, sizeof (buf), "prwidth=%d", pr_width);
- appendlist(&modes, buf);
- }
-
- if (pr_indent > 0) {
- snprintf(buf, sizeof (buf), "indent=%d", pr_indent);
- appendlist(&modes, buf);
- }
- } else if ((pr_title != NULL) || (pr_width >= 0) || (pr_indent >= 0))
- detailed_error(svc, gettext(
- "pr(1) filter options specified without enabling pr(1) filter"));
-
- /* add burst page information */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "job-sheets", &s);
- if ((s != NULL) && (strcasecmp(s, "none") != 0)) {
- char buf[128];
- char *class = NULL;
- char *job_name = NULL;
-
- papiAttributeListGetLPString(attributes, "job-class", &class);
- papiAttributeListGetLPString(attributes, "job-name", &job_name);
-
- /* burst page is enabled by default, add the title */
- snprintf(buf, sizeof (buf), "%s%s%s",
- (job_name ? job_name : ""),
- (job_name && class ? "\\n#####\\n#####\\t\\t " : ""),
- (class ? class : ""));
- if (buf[0] != '\0') {
- if (r->title != NULL)
- free(r->title);
- r->title = strdup(buf);
- }
- } else if ((s != NULL) && (strcasecmp(s, "none") == 0)) {
- /* burst page is disabled via lp "option" */
- appendlist(&options, "nobanner");
- }
-
- /* Convert attribute "number-up" to mode group=n */
- papiAttributeListGetInteger(attributes, NULL, "number-up", &numberUp);
- if ((numberUp >= 2) && ((numberUp % 2) == 0)) {
- snprintf(buf, sizeof (buf), "group=%d", numberUp);
- appendlist(&modes, buf);
- }
-
- /*
- * Convert attribute "orientation-requested" to modes
- * 'landscape', 'portrait', etc.
- */
- papiAttributeListGetInteger(attributes, NULL,
- "orientation-requested", &orientation);
- if ((orientation >= 3) && (orientation <= 6)) {
- switch (orientation) {
- case 4: /* landscape */
- case 5: /* reverse-landscape, use landscape instead */
- appendlist(&modes, "landscape");
- break;
- case 3: /* portrait */
- case 6: /* reverse-portrait, use portrait instead */
- default:
- appendlist(&modes, "portrait");
- break;
- }
- }
-
- /* add "lp -y" modes */
- attr = papiAttributeListFind(attributes, "lp-modes");
- if ((attr != NULL) && (attr->type == PAPI_STRING) &&
- (attr->values != NULL)) {
- int i;
-
- for (i = 0; attr->values[i] != NULL; i++)
- appendlist(&modes, attr->values[i]->string);
- }
-
- if (modes != NULL) {
- if (r->modes == NULL)
- free(r->modes);
- r->modes = sprintlist(modes);
- freelist(modes);
- }
-
- /* add any unconsumed attributes to the "options" list */
- split_and_copy_attributes(mapped_keys, attributes, NULL, &unmapped);
- if (unmapped != NULL) { /* convert them to lp options */
- char *buf = malloc(1024);
- ssize_t size = 1024;
-
- while (papiAttributeListToString(unmapped, " ", buf, size)
- != PAPI_OK) {
- size += 1024;
- buf = realloc(buf, size);
- }
- appendlist(&options, buf);
- free(buf);
- papiAttributeListFree(unmapped);
- }
-
- if (options != NULL) {
- if (r->options != NULL)
- free(r->options);
- r->options = sprintlist(options);
- freelist(options);
- }
-
- return (PAPI_OK);
-}
-
-/*
- * Convert REQUEST->outcome (or R_REQUEST_* state) to the equivalent
- * PAPI attribute representation.
- */
-static void
-lpsched_request_outcome_to_attributes(papi_attribute_t ***attributes,
- unsigned short state)
-{
- if (attributes == NULL)
- return;
-
- if (state & RS_NOTIFYING) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x0800); /* notifying user */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-notifying");
- } else if (state & RS_HELD) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x0001); /* held */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-hold-until-specified");
- } else if (state & RS_CANCELLED) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x0040); /* job cancelled */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-canceled-by-user");
- } else if (state & RS_PRINTED) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x0010); /* finished printing job */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-complete");
- } else if (state & RS_PRINTING) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x0008); /* printing job */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-printing");
- } else if (state & RS_ADMINHELD) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x2000); /* held by admin */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-hold-until-specified");
- } else if (state & RS_FILTERED) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x0004); /* filtered */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-filtered");
- } else if (state & RS_CHANGING) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x0020); /* job held for changing */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-held-for-change");
- } else if (state & RS_FILTERING) {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x0002); /* being filtered */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-being-filtered");
- } else {
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-state", 0x4000); /* else */
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-state-reasons", "job-queued");
- }
-
-
-
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-hold-until",
- ((state & RS_HELD) ? "indefinite" : "no-hold"));
-}
-
-/*
- * convert user[@host] to papi attributes
- */
-static void
-lpsched_user_to_job_attributes(papi_attribute_t ***list, char *user)
-{
- if ((list != NULL) && (user != NULL) && (user[0] != NULL)) {
- char *host = strrchr(user, '@');
-
- if (host != NULL) {
- *host = NULL;
- papiAttributeListAddString(list, PAPI_ATTR_REPLACE,
- "job-originating-user-name", user);
- papiAttributeListAddString(list, PAPI_ATTR_REPLACE,
- "job-originating-host-name", host + 1);
- *host = '@';
- } else
- papiAttributeListAddString(list, PAPI_ATTR_REPLACE,
- "job-originating-user-name", user);
- }
-}
-
-/*
- * Convert REQUEST structure to the equivalent PAPI attribute representation.
- */
-void
-lpsched_request_to_job_attributes(REQUEST *r, job_t *j)
-{
- char *tmp;
- int i;
-
- /* copies */
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "copies", r->copies);
-
- /* destination */
- papiAttributeListAddLPString(&j->attributes, PAPI_ATTR_REPLACE,
- "printer-name", r->destination);
-
- /* form */
- papiAttributeListAddLPString(&j->attributes, PAPI_ATTR_REPLACE,
- "form", r->form);
-
- /* options */
- papiAttributeListFromString(&j->attributes, PAPI_ATTR_APPEND,
- r->options);
-
- tmp = (((r->options != NULL) && (strstr(r->options, "nobanner")
- != NULL)) ? "none" : "standard");
- papiAttributeListAddString(&j->attributes, PAPI_ATTR_REPLACE,
- "job-sheets", tmp);
-
- tmp = (((r->options != NULL) && (strstr(r->options, "duplex")
- != NULL)) ? "two-sized" : "one-sided");
- papiAttributeListAddString(&j->attributes, PAPI_ATTR_REPLACE,
- "sides", tmp);
-
- i = (((r->options != NULL) && (strstr(r->options, "landscape")
- != NULL)) ? 4 : 3);
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "orientation-requested", i);
-
- /* priority (map 0-39 to 1-100) */
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "job-priority",
- (int)(100 - (r->priority * 2.5)));
-
- /* pages */
- papiAttributeListAddLPString(&j->attributes, PAPI_ATTR_REPLACE,
- "page-ranges", r->pages);
-
- /* charset */
- papiAttributeListAddLPString(&j->attributes, PAPI_ATTR_REPLACE,
- "lp-charset", r->charset);
-
- /* modes */
- papiAttributeListAddLPString(&j->attributes, PAPI_ATTR_REPLACE,
- "lp-modes", r->modes);
-
- /* title */
- papiAttributeListAddLPString(&j->attributes, PAPI_ATTR_REPLACE,
- "job-name", r->title);
-
- /* input_type */
-
- /* user */
- lpsched_user_to_job_attributes(&j->attributes, r->user);
-
- /* outcome */
- lpsched_request_outcome_to_attributes(&j->attributes, r->outcome);
-
- /* constants, (should be derived from options) */
- papiAttributeListAddInteger(&j->attributes, PAPI_ATTR_REPLACE,
- "number-up", 1);
-
- papiAttributeListAddString(&j->attributes, PAPI_ATTR_REPLACE,
- "multiple-document-handling",
- "seperate-documents-collated-copies");
-}
-
-/*
- * Convert R_REQUEST_* results to the equivalent PAPI attribute representation.
- */
-void
-job_status_to_attributes(job_t *job, char *req_id, char *user, char *slabel,
- size_t size, time_t date, short state, char *destination,
- char *form, char *charset, short rank, char *file)
-{
- char buf[BUFSIZ];
- char *p;
-
- lpsched_user_to_job_attributes(&job->attributes, user);
- papiAttributeListAddInteger(&job->attributes, PAPI_ATTR_REPLACE,
- "job-k-octets", size/1024);
- papiAttributeListAddInteger(&job->attributes, PAPI_ATTR_REPLACE,
- "job-octets", size);
- if ((p = strrchr(req_id, '-')) != NULL) {
- papiAttributeListAddInteger(&job->attributes, PAPI_ATTR_REPLACE,
- "job-id", atoi(++p));
- }
- snprintf(buf, sizeof (buf), "lpsched://localhost/printers/%s/%d",
- destination, atoi(p));
- papiAttributeListAddString(&job->attributes, PAPI_ATTR_REPLACE,
- "job-uri", buf);
- snprintf(buf, sizeof (buf), "lpsched://localhost/printers/%s",
- destination);
- papiAttributeListAddString(&job->attributes, PAPI_ATTR_REPLACE,
- "job-printer-uri", buf);
- papiAttributeListAddInteger(&job->attributes, PAPI_ATTR_REPLACE,
- "job-printer-up-time", time(NULL));
- papiAttributeListAddString(&job->attributes, PAPI_ATTR_REPLACE,
- "output-device-assigned", destination);
- papiAttributeListAddString(&job->attributes, PAPI_ATTR_REPLACE,
- "printer-name", destination);
- papiAttributeListAddLPString(&job->attributes, PAPI_ATTR_REPLACE,
- "form", form);
-
- lpsched_request_outcome_to_attributes(&job->attributes, state);
-
- papiAttributeListAddInteger(&job->attributes, PAPI_ATTR_REPLACE,
- "time-at-creation", date);
- papiAttributeListAddLPString(&job->attributes, PAPI_ATTR_REPLACE,
- "lpsched-request-id", req_id);
- papiAttributeListAddLPString(&job->attributes, PAPI_ATTR_REPLACE,
- "lp-charset", charset);
- papiAttributeListAddInteger(&job->attributes, PAPI_ATTR_REPLACE,
- "lpsched-job-state", state);
- papiAttributeListAddInteger(&job->attributes, PAPI_ATTR_REPLACE,
- "number-of-intervening-jobs", rank - 1);
- papiAttributeListAddLPString(&job->attributes, PAPI_ATTR_REPLACE,
- "lpsched-file", file);
- papiAttributeListAddLPString(&job->attributes, PAPI_ATTR_EXCL,
- "job-name", file);
- papiAttributeListAddLPString(&job->attributes, PAPI_ATTR_EXCL,
- "tsol-sensitivity-label", slabel);
-}
-
-void
-lpsched_read_job_configuration(service_t *svc, job_t *j, char *file)
-{
- REQUEST *r;
-
- if ((r = getrequest(file)) == NULL) {
- detailed_error(svc, gettext("unable to read job data: %s"),
- file);
- return;
- }
-
- lpsched_request_to_job_attributes(r, j);
-}
diff --git a/usr/src/cmd/lp/lib/papi/lpsched-misc.c b/usr/src/cmd/lp/lib/papi/lpsched-misc.c
deleted file mode 100644
index ce45d1aa5c..0000000000
--- a/usr/src/cmd/lp/lib/papi/lpsched-misc.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <papi_impl.h>
-
-
-papi_status_t
-papiAttributeListAddLPString(papi_attribute_t ***list, int flags, char *name,
- char *value)
-{
- papi_status_t result = PAPI_BAD_ARGUMENT;
-
- if ((list != NULL) && (name != NULL) && (value != NULL) &&
- (value[0] != NULL))
- result = papiAttributeListAddString(list, flags, name, value);
- return (result);
-}
-
-papi_status_t
-papiAttributeListAddLPStrings(papi_attribute_t ***list, int flags, char *name,
- char **values)
-{
- papi_status_t result = PAPI_OK;
- int i, flgs = flags;
-
- if ((list == NULL) || (name == NULL) || (values == NULL))
- result = PAPI_BAD_ARGUMENT;
-
- for (i = 0; ((result == PAPI_OK) && (values[i] != NULL));
- i++, flgs = PAPI_ATTR_APPEND)
- result = papiAttributeListAddString(list, flgs, name,
- values[i]);
-
- return (result);
-}
-
-void
-papiAttributeListGetLPString(papi_attribute_t **attributes, char *key,
- char **string)
-{
- char *value = NULL;
-
- papiAttributeListGetString(attributes, NULL, key, &value);
- if (value != NULL) {
- if (*string != NULL)
- free(*string);
- *string = strdup(value);
- }
-}
-
-void
-papiAttributeListGetLPStrings(papi_attribute_t **attributes, char *key,
- char ***strings)
-{
- papi_status_t status;
- char **values = NULL;
- char *value = NULL;
- void *iter = NULL;
-
- for (status = papiAttributeListGetString(attributes, &iter,
- key, &value);
- status == PAPI_OK;
- status = papiAttributeListGetString(attributes, &iter,
- NULL, &value))
- addlist(&values, value);
-
- if (values != NULL) {
- if (*strings != NULL)
- freelist(*strings);
- *strings = values;
- }
-}
-
-char *
-printer_name_from_uri_id(char *uri, int32_t id)
-{
- REQUEST *request = NULL;
- char *result = "";
-
- if (uri != NULL) {
- if ((result = strrchr(uri, '/')) != NULL) {
- result += 1;
- } else
- result = (char *)uri;
-
- if ((strcmp(result, "jobs") == 0) ||
- (strcmp(result, "any") == 0) ||
- (strcmp(result, "all") == 0))
- result = "";
- }
-
- if ((result[0] == NULL) && (id != -1)) {
- char path[32];
-
- snprintf(path, sizeof (path), "%d-0", id);
- if ((request = getrequest(path)) != NULL)
- result = request->destination;
- }
-
- result = strdup(result);
-
- if (request != NULL)
- freerequest(request);
-
- return (result);
-}
-
-/*
- * LP content type <-> MIME type conversion table. (order dependent)
- */
-static struct {
- char *mime_type;
- char *lp_type;
-} type_map[] = {
- { "text/plain", "simple" },
- { "application/octet-stream", "raw" },
- { "application/octet-stream", "any" },
- { "application/postscript", "postscript" },
- { "application/postscript", "ps" },
- { "application/x-cif", "cif" },
- { "application/x-dvi", "dvi" },
- { "application/x-plot", "plot" },
- { "application/x-ditroff", "troff" },
- { "application/x-troff", "otroff" },
- { "application/x-pr", "pr" },
- { "application/x-fortran", "fortran" },
- { "application/x-raster", "raster" },
- { NULL, NULL}
-};
-
-char *
-mime_type_to_lp_type(char *mime_type)
-{
- int i;
-
- if (mime_type == NULL)
- return ("simple");
-
- for (i = 0; type_map[i].mime_type != NULL; i++)
- if (strcasecmp(type_map[i].mime_type, mime_type) == 0)
- return (type_map[i].lp_type);
-
- return (mime_type);
-}
-
-char *
-lp_type_to_mime_type(char *lp_type)
-{
- int i;
-
- if (lp_type == NULL)
- return ("text/plain");
-
- for (i = 0; type_map[i].lp_type != NULL; i++)
- if (strcasecmp(type_map[i].lp_type, lp_type) == 0)
- return (type_map[i].mime_type);
-
- return (lp_type);
-}
diff --git a/usr/src/cmd/lp/lib/papi/lpsched-msgs.c b/usr/src/cmd/lp/lib/papi/lpsched-msgs.c
deleted file mode 100644
index 2d64912d08..0000000000
--- a/usr/src/cmd/lp/lib/papi/lpsched-msgs.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <libintl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-
-
-/* lpsched include files */
-#include "lp.h"
-#include "msgs.h"
-#include "printers.h"
-#include "class.h"
-
-#include <papi_impl.h>
-
-
-/*
- * Format and send message to lpsched (die if any errors occur)
- */
-/*VARARGS1*/
-int
-snd_msg(service_t *svc, int type, ...)
-{
- int rc = -1;
- va_list ap;
-
- if (svc == NULL)
- return (-1);
-
- /* fill the message buffer */
- va_start(ap, type);
- rc = _putmessage(svc->msgbuf, type, ap);
- va_end(ap);
- if (rc < 0) {
- detailed_error(svc,
- gettext("unable to build message for scheduler: %s"),
- strerror(errno));
- return (rc);
- }
-
- /* write the message */
- while (((rc = mwrite(svc->md, svc->msgbuf)) < 0) && (errno == EINTR)) {
- }
-
- if (rc < 0)
- detailed_error(svc,
- gettext("unable to send message to scheduler: %s"),
- strerror(errno));
- return (rc);
-}
-
-/*
- * Receive message from lpsched (die if any errors occur)
- */
-int
-rcv_msg(service_t *svc, int type, ...)
-{
- int rc = -1;
-
- if (svc == NULL)
- return (-1);
-
- /* read the message */
- while (((rc = mread(svc->md, svc->msgbuf, svc->msgbuf_size)) < 0) &&
- (errno == EINTR)) {
- }
-
- if (rc < 0)
- detailed_error(svc,
- gettext("unable to read message from scheduler: %s"),
- strerror(errno));
- else {
- va_list ap;
-
- va_start(ap, type);
- rc = _getmessage(svc->msgbuf, type, ap);
- va_end(ap);
-
- if (rc < 0)
- detailed_error(svc,
- gettext("unable to parse message from scheduler: %s"),
- strerror(errno));
- }
-
- return (rc);
-}
-
-papi_status_t
-lpsched_status_to_papi_status(int status)
-{
- switch (status) {
- case MNOMEM:
- return (PAPI_TEMPORARY_ERROR);
- case MNOFILTER:
- return (PAPI_DOCUMENT_FORMAT_ERROR);
- case MNOOPEN:
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- case MERRDEST:
- case MDENYDEST:
- return (PAPI_NOT_ACCEPTING);
- case MNOMEDIA:
- return (PAPI_PRINT_SUPPORT_FILE_NOT_FOUND);
- case MDENYMEDIA:
- case MNOPERM:
- return (PAPI_NOT_AUTHORIZED);
- case MUNKNOWN:
- case MNODEST:
- case MNOINFO:
- return (PAPI_NOT_FOUND);
- case MTRANSMITERR:
- return (PAPI_SERVICE_UNAVAILABLE);
- case M2LATE:
- return (PAPI_GONE);
- case MBUSY:
- return (PAPI_PRINTER_BUSY);
- case MOK:
- case MOKMORE:
- return (PAPI_OK);
- }
-
- return (PAPI_INTERNAL_ERROR);
-}
-
-char *
-lpsched_status_string(short status)
-{
- switch (status) {
- case MNOMEM:
- return (gettext("lpsched: out of memory"));
- case MNOFILTER:
- return (gettext("No filter available to convert job"));
- case MNOOPEN:
- return (gettext("lpsched: could not open request"));
- case MERRDEST:
- return (gettext("queue disabled"));
- case MDENYDEST:
- return (gettext("destination denied request"));
- case MNOMEDIA:
- return (gettext("unknown form specified in job"));
- case MDENYMEDIA:
- return (gettext("access denied to form specified in job"));
- case MUNKNOWN:
- return (gettext("no such resource"));
- case MNODEST:
- return (gettext("unknown destination"));
- case MNOPERM:
- return (gettext("permission denied"));
- case MNOINFO:
- return (gettext("no information available"));
- case MTRANSMITERR:
- return (gettext("failure to communicate with lpsched"));
- default: {
- static char result[16];
-
- snprintf(result, sizeof (result), gettext("status: %d"),
- status);
- return (result);
- }
- }
-}
-
-papi_status_t
-lpsched_alloc_files(papi_service_t svc, int number, char **prefix)
-{
- papi_status_t result = PAPI_OK;
- short status = MOK;
-
- if ((svc == NULL) || (prefix == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((snd_msg(svc, S_ALLOC_FILES, number) < 0) ||
- (rcv_msg(svc, R_ALLOC_FILES, &status, prefix) < 0))
- status = MTRANSMITERR;
-
- if (status != MOK) {
- detailed_error(svc,
- gettext("failed to allocate %d file(s) for request: %s"),
- number, lpsched_status_string(status));
- result = lpsched_status_to_papi_status(status);
- }
-
- return (result);
-}
-
-papi_status_t
-lpsched_commit_job(papi_service_t svc, char *job, char **tmp)
-/* job is host/req-id */
-{
- papi_status_t result = PAPI_OK;
- short status = MOK;
- long bits;
-
- if ((svc == NULL) || (job == NULL) || (tmp == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((snd_msg(svc, S_PRINT_REQUEST, job) < 0) ||
- (rcv_msg(svc, R_PRINT_REQUEST, &status, tmp, &bits) < 0))
- status = MTRANSMITERR;
-
- if (status != MOK) {
- detailed_error(svc, gettext("failed to commit job (%s): %s"),
- job, lpsched_status_string(status));
- result = lpsched_status_to_papi_status(status);
- }
-
- return (result);
-}
-
-papi_status_t
-lpsched_start_change(papi_service_t svc, char *printer, int32_t job_id,
- char **tmp)
-{
- papi_status_t result = PAPI_OK;
- short status = MOK;
- char req[BUFSIZ];
- char *dest;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(printer, job_id);
- snprintf(req, sizeof (req), "%s-%d", dest, job_id);
- free(dest);
-
- if ((snd_msg(svc, S_START_CHANGE_REQUEST, req) < 0) ||
- (rcv_msg(svc, R_START_CHANGE_REQUEST, &status, tmp) < 0))
- status = MTRANSMITERR;
-
- if (status != MOK) {
- detailed_error(svc,
- gettext("failed to initiate change for job (%s-%d): %s"),
- printer,
- job_id, lpsched_status_string(status));
- result = lpsched_status_to_papi_status(status);
- }
-
- return (result);
-}
-
-papi_status_t
-lpsched_end_change(papi_service_t svc, char *printer, int32_t job_id)
-{
- papi_status_t result = PAPI_OK;
- short status = MOK;
- long bits;
- char req[BUFSIZ];
- char *dest;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(printer, job_id);
- snprintf(req, sizeof (req), "%s-%d", dest, job_id);
- free(dest);
-
- if ((snd_msg(svc, S_END_CHANGE_REQUEST, req) < 0) ||
- (rcv_msg(svc, R_END_CHANGE_REQUEST, &status, &bits) < 0))
- status = MTRANSMITERR;
-
- if (status != MOK) {
- detailed_error(svc,
- gettext("failed to commit change for job (%s-%d): %s"), printer,
- job_id, lpsched_status_string(status));
- result = lpsched_status_to_papi_status(status);
- }
-
- return (result);
-}
-
-papi_status_t
-lpsched_accept_printer(papi_service_t svc, char *printer)
-{
- papi_status_t result = PAPI_OK;
- short status = MOK;
- char *req_id;
- char *dest;
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(printer, -1);
- if ((snd_msg(svc, S_ACCEPT_DEST, dest) < 0) ||
- (rcv_msg(svc, R_ACCEPT_DEST, &status, &req_id) < 0))
- status = MTRANSMITERR;
- free(dest);
-
- if ((status != MOK) && (status != MERRDEST)) {
- detailed_error(svc, "%s: %s", printer,
- lpsched_status_string(status));
- }
- result = lpsched_status_to_papi_status(status);
-
- return (result);
-}
-
-papi_status_t
-lpsched_reject_printer(papi_service_t svc, char *printer, char *message)
-{
- papi_status_t result = PAPI_OK;
- short status = MOK;
- char *req_id;
- char *dest;
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (message == NULL)
- message = "stopped by user";
-
- dest = printer_name_from_uri_id(printer, -1);
- if ((snd_msg(svc, S_REJECT_DEST, dest, message, 0) < 0) ||
- (rcv_msg(svc, R_REJECT_DEST, &status, &req_id) < 0))
- status = MTRANSMITERR;
- free(dest);
-
- if ((status != MOK) && (status != MERRDEST)) {
- detailed_error(svc, "%s: %s", printer,
- lpsched_status_string(status));
- }
- result = lpsched_status_to_papi_status(status);
-
- return (result);
-}
-
-papi_status_t
-lpsched_enable_printer(papi_service_t svc, char *printer)
-{
- papi_status_t result = PAPI_OK;
- short status = MOK;
- char *req_id;
- char *dest;
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(printer, -1);
- if ((snd_msg(svc, S_ENABLE_DEST, dest) < 0) ||
- (rcv_msg(svc, R_ENABLE_DEST, &status, &req_id) < 0))
- status = MTRANSMITERR;
- free(dest);
-
- if ((status != MOK) && (status != MERRDEST)) {
- detailed_error(svc, "%s: %s", printer,
- lpsched_status_string(status));
- }
- result = lpsched_status_to_papi_status(status);
-
- return (result);
-}
-
-papi_status_t
-lpsched_disable_printer(papi_service_t svc, char *printer, char *message)
-{
- papi_status_t result = PAPI_OK;
- short status = MOK;
- char *req_id;
- char *dest;
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (message == NULL)
- message = "stopped by user";
-
- dest = printer_name_from_uri_id(printer, -1);
- if ((snd_msg(svc, S_DISABLE_DEST, dest, message, 0) < 0) ||
- (rcv_msg(svc, R_DISABLE_DEST, &status, &req_id) < 0))
- status = MTRANSMITERR;
- free(dest);
-
- if ((status != MOK) && (status != MERRDEST)) {
- detailed_error(svc, "%s: %s", printer,
- lpsched_status_string(status));
- }
- result = lpsched_status_to_papi_status(status);
-
- return (result);
-}
-
-papi_status_t
-lpsched_load_unload_dest(papi_service_t handle, char *dest, int type)
-{
- service_t *svc = handle;
- papi_status_t result;
- short status = MOK;
-
- /* tell the scheduler it's going */
- if (snd_msg(svc, type, dest, "", "") < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- switch (type) {
- case S_LOAD_PRINTER:
- type = R_LOAD_PRINTER;
- break;
- case S_UNLOAD_PRINTER:
- type = R_UNLOAD_PRINTER;
- break;
- case S_LOAD_CLASS:
- type = R_LOAD_CLASS;
- break;
- case S_UNLOAD_CLASS:
- type = R_UNLOAD_CLASS;
- }
-
- if (rcv_msg(svc, type, &status) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- result = lpsched_status_to_papi_status(status);
-
- return (result);
-}
-
-papi_status_t
-lpsched_remove_class(papi_service_t handle, char *dest)
-{
- papi_status_t result;
-
- /* tell the scheduler it's going */
- result = lpsched_load_unload_dest(handle, dest, S_UNLOAD_CLASS);
-
- if (result == PAPI_OK) {
- /* remove the scheduler config files */
- if (delclass(dest) == -1)
- result = PAPI_SERVICE_UNAVAILABLE;
- }
-
- return (result);
-}
-
-static void
-remove_from_class(papi_service_t handle, char *dest, CLASS *cls)
-{
- if (dellist(&cls->members, dest) == 0) {
- if (cls->members != NULL) {
- if (putclass(cls->name, cls) == 0)
- (void) lpsched_load_unload_dest(handle,
- cls->name, S_LOAD_CLASS);
- } else
- (void) lpsched_remove_class(handle, cls->name);
- }
-}
-
-papi_status_t
-lpsched_remove_printer(papi_service_t handle, char *dest)
-{
-
- papi_status_t result;
-
- /* tell the scheduler it's going */
- result = lpsched_load_unload_dest(handle, dest, S_UNLOAD_PRINTER);
-
- if (result == PAPI_OK) {
- CLASS *cls;
- char *dflt;
-
- /* remove the scheduler config files */
- if (delprinter(dest) == -1)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- /* remove from any classes */
- while ((cls = getclass(NAME_ALL)) != NULL) {
- if (searchlist(dest, cls->members) != 0)
- remove_from_class(handle, dest, cls);
- freeclass(cls);
- }
-
- /* reset the default if it needs to be done */
- if (((dflt = getdefault()) != NULL) &&
- (strcmp(dflt, dest) == 0))
- putdefault(NAME_NONE);
- }
-
- return (result);
-}
-
-papi_status_t
-lpsched_add_modify_class(papi_service_t handle, char *dest,
- papi_attribute_t **attributes)
-{
- papi_status_t result;
- void *iter = NULL;
- char **members = NULL;
- char *member;
-
- /*
- * The only attribute that we can modify for a class is the set of
- * members. Anything else will be ignored.
- */
- for (result = papiAttributeListGetString(attributes, &iter,
- "member-names", &member);
- result == PAPI_OK;
- result = papiAttributeListGetString(attributes, &iter,
- NULL, &member))
- addlist(&members, member);
-
- if (members != NULL) {
- /* modify the configuration file */
- CLASS class;
-
- memset(&class, 0, sizeof (class));
- class.name = dest;
- class.members = members;
-
- if (putclass(dest, &class) == -1) {
- if ((errno == EPERM) || (errno == EACCES))
- result = PAPI_NOT_AUTHORIZED;
- else
- result = PAPI_NOT_POSSIBLE;
- } else
- result = PAPI_OK;
-
- freelist(members);
- } else
- result = PAPI_ATTRIBUTES;
-
- /* tell the scheduler about the changes */
- if (result == PAPI_OK)
- result = lpsched_load_unload_dest(handle, dest, S_LOAD_CLASS);
-
- return (result);
-}
-
-papi_status_t
-lpsched_add_printer(papi_service_t handle, char *dest,
- papi_attribute_t **attributes)
-{
- PRINTER *p;
- papi_status_t result = PAPI_TEMPORARY_ERROR;
-
- if ((p = calloc(1, sizeof (*p))) != NULL) {
- p->name = strdup(dest);
- p->banner = BAN_ALWAYS;
- p->interface = strdup("/usr/lib/lp/model/uri");
- p->fault_alert.shcmd = strdup("mail");
-
- attributes_to_printer(attributes, p);
-
- if (putprinter(dest, p) == -1) {
- if ((errno == EPERM) || (errno == EACCES))
- result = PAPI_NOT_AUTHORIZED;
- else
- result = PAPI_NOT_POSSIBLE;
- } else
- result = PAPI_OK;
-
- freeprinter(p);
- }
-
- /* tell the scheduler about the changes */
- if (result == PAPI_OK)
- result = lpsched_load_unload_dest(handle, dest, S_LOAD_PRINTER);
-
- return (result);
-}
-
-papi_status_t
-lpsched_add_modify_printer(papi_service_t handle, char *dest,
- papi_attribute_t **attributes, int type)
-{
- PRINTER *p;
- papi_status_t result;
-
- if (type == 0) {
- if ((p = calloc(1, sizeof (*p))) != NULL) {
- p->name = strdup(dest);
- p->banner = BAN_ALWAYS;
- p->interface = strdup("/usr/lib/lp/model/uri");
- p->fault_alert.shcmd = strdup("mail");
- }
- } else
- p = getprinter(dest);
-
- if (p != NULL) {
- attributes_to_printer(attributes, p);
-
- if (putprinter(dest, p) == -1) {
- if ((errno == EPERM) || (errno == EACCES))
- result = PAPI_NOT_AUTHORIZED;
- else
- result = PAPI_NOT_POSSIBLE;
- } else
- result = PAPI_OK;
-
- freeprinter(p);
- } else
- result = PAPI_NOT_POSSIBLE;
-
- /* tell the scheduler about the changes */
- if (result == PAPI_OK)
- result = lpsched_load_unload_dest(handle, dest, S_LOAD_PRINTER);
-
- return (result);
-}
diff --git a/usr/src/cmd/lp/lib/papi/lpsched-printers.c b/usr/src/cmd/lp/lib/papi/lpsched-printers.c
deleted file mode 100644
index 3765e21f66..0000000000
--- a/usr/src/cmd/lp/lib/papi/lpsched-printers.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <libintl.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include <papi_impl.h>
-
-#include "class.h"
-
-void
-lpsched_printer_status_to_attributes(papi_attribute_t ***attrs,
- unsigned short status)
-{
- if (attrs == NULL)
- return;
-
- if (!(status & (PS_DISABLED|PS_LATER))) {
- if (status & PS_FAULTED) {
- if (status & PS_BUSY)
- /* faulted printing */
- papiAttributeListAddInteger(attrs,
- PAPI_ATTR_REPLACE,
- "printer-state", 0x06);
- else
- /* faulted printer */
- papiAttributeListAddInteger(attrs,
- PAPI_ATTR_REPLACE,
- "printer-state", 0x07);
-
- papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons", "none");
- } else if (status & PS_BUSY) {
- papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x04); /* processing */
- papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons", "moving-to-paused");
- } else if (status & PS_FORM_FAULT) {
- papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x05); /* stopped */
- papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons",
- "interpreter-resource-unavailable");
- } else
- papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x03); /* idle */
- } else if (status & PS_DISABLED) {
- papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x05); /* stopped */
- papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons", "paused");
- } else if (status & PS_LATER) {
- papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x08); /* waiting for auto reply */
- papiAttributeListAddString(attrs, PAPI_ATTR_REPLACE,
- "printer-state-reasons", "moving-to-paused");
- } else {
- papiAttributeListAddInteger(attrs, PAPI_ATTR_REPLACE,
- "printer-state", 0x03); /* idle */
- }
-
- papiAttributeListAddBoolean(attrs, PAPI_ATTR_REPLACE,
- "printer-is-accepting-jobs",
- ((status & PS_REJECTED) != PS_REJECTED));
- papiAttributeListAddBoolean(attrs, PAPI_ATTR_REPLACE,
- "printer-is-processing-jobs",
- ((status & PS_DISABLED) != PS_DISABLED));
-}
-
-void
-lpsched_printer_defaults(papi_attribute_t ***attributes)
-{
- if (attributes == NULL)
- return;
-
- papiAttributeListAddBoolean(attributes, PAPI_ATTR_REPLACE,
- "multiple-document-jobs-supported", PAPI_TRUE);
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "multiple-document-handling-supported",
- "seperate-documents-colated-copies");
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "pdl-override-supported", "not-attempted");
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-priority-supported", 40);
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-priority-default", 20);
- papiAttributeListAddRange(attributes, PAPI_ATTR_REPLACE,
- "copies-supported", 1, 65535);
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "copies-default", 1);
- papiAttributeListAddBoolean(attributes, PAPI_ATTR_REPLACE,
- "page-ranges-supported", PAPI_TRUE);
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "number-up-supported", 1);
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "number-up-default", 1);
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-hold-until-supported", "no-hold");
- papiAttributeListAddString(attributes, PAPI_ATTR_APPEND,
- "job-hold-until-supported", "indefinite");
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "job-hold-until-default", "no-hold");
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "document-format-default", "application/octet-stream");
-
-}
-
-papi_status_t
-lpsched_printer_configuration_to_attributes(service_t *svc, printer_t *p,
- char *dest)
-{
- PRINTER *tmp;
- char buf[BUFSIZ+1];
- struct utsname sysname;
- char **allowed = NULL, **denied = NULL;
- char **f_allowed = NULL, **f_denied = NULL;
-
- if ((svc == NULL) || (p == NULL) || (dest == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* get the configuration DB data */
- if ((tmp = getprinter(dest)) == NULL) {
- detailed_error(svc,
- gettext("unable to read configuration data"));
- return (PAPI_DEVICE_ERROR);
- }
-
- /* name */
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-name", tmp->name);
- if (tmp->name != NULL) {
- char uri[BUFSIZ];
-
- snprintf(uri, sizeof (uri), "lpsched://localhost/printers/%s",
- tmp->name);
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-uri-supported", uri);
- }
-
- /* banner */
- if ((tmp->banner & BAN_OPTIONAL) == BAN_OPTIONAL)
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_APPEND,
- "job-sheets-supported", "optional");
- else if (tmp->banner & BAN_NEVER)
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_APPEND,
- "job-sheets-supported", "none");
- else if (tmp->banner & BAN_ALWAYS)
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_APPEND,
- "job-sheets-supported", "standard");
-
- /* input_types */
- if (tmp->input_types != NULL) {
- int i;
-
- for (i = 0; tmp->input_types[i] != NULL; i++)
- papiAttributeListAddLPString(&p->attributes,
- PAPI_ATTR_APPEND, "document-format-supported",
- lp_type_to_mime_type(tmp->input_types[i]));
- }
-
- /* description */
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-info", tmp->description);
-
- /* add lpsched specific attributes */
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "device-uri", tmp->device);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-dial-info", tmp->dial_info);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-fault-recovery", tmp->fault_rec);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-interface-script", tmp->interface);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-data-rate", tmp->speed);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-stty", tmp->stty);
- papiAttributeListAddBoolean(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-login-term", tmp->login);
- papiAttributeListAddBoolean(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-daisy", tmp->daisy);
- papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-charsets", tmp->char_sets);
-#ifdef CAN_DO_MODULES
- papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-modules", tmp->modules);
-#endif /* CAN_DO_MODULES */
- papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-options", tmp->options);
- papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-printer-type", tmp->printer_types);
- if (tmp->fault_alert.shcmd != NULL) {
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-fault-alert-command",
- tmp->fault_alert.shcmd);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-fault-alert-threshold",
- tmp->fault_alert.Q);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-fault-alert-interval",
- tmp->fault_alert.W);
- }
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-cpi-value", tmp->cpi.val);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-cpi-unit", tmp->cpi.sc);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-lpi-value", tmp->lpi.val);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-lpi-unit", tmp->lpi.sc);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-plen-value", tmp->plen.val);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-plen-unit", tmp->plen.sc);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-pwid-value", tmp->pwid.val);
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-pwid-unit", tmp->pwid.sc);
-
- /* allow/deny list */
- load_userprinter_access(dest, &allowed, &denied);
- papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "requesting-user-name-allowed", allowed);
- papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "requesting-user-name-denied", denied);
-
- freelist(allowed);
- freelist(denied);
-
- /* forms allow/deny list */
- load_formprinter_access(dest, &f_allowed, &f_denied);
- papiAttributeListAddLPStrings(&p->attributes, PAPI_ATTR_REPLACE,
- "form-supported", f_allowed);
-
- /*
- * All forms allowed case
- * When all forms are allowed forms.allow does not get created but
- * forms.deny file gets created with no entries
- */
- if ((f_allowed == NULL) && (f_denied != NULL) && (f_denied[0] == NULL))
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "form-supported", "all");
-
- freelist(f_allowed);
- freelist(f_denied);
-
-#ifdef LP_USE_PAPI_ATTR
- if (tmp->ppd != NULL) {
- int fd;
- struct stat sbuf;
-
- /* construct the two URIs for the printer's PPD file */
- if (uname(&sysname) < 0) {
- /* failed to get systen name */
- sysname.nodename[0] = 0;
- }
- snprintf(buf, sizeof (buf), "file://%s%s/ppd/%s.ppd",
- sysname.nodename, ETCDIR, tmp->name);
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "ppd-file-uri", buf);
-
- snprintf(buf, sizeof (buf), "file://%s%s",
- sysname.nodename, tmp->ppd);
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-printer-configure-ppd-uri", buf);
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-ppd-source-path", tmp->ppd);
-
- snprintf(buf, sizeof (buf), "%s/ppd/%s.ppd", ETCDIR, tmp->name);
-
- /*
- * We don't return error on any of the error conditions, we just
- * silently return without adding the attribute.
- */
- PPDFileToAttributesList(&p->attributes, buf);
- }
-#endif
-
- freeprinter(tmp);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-printer_status_to_attributes(printer_t *p, char *printer, char *form,
- char *character_set, char *disable_reason, char *reject_reason,
- short status, char *request_id,
- long disable_date, long reject_date)
-{
- if (p == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "form-ready", form);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-active-job", request_id);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-mounted-char-set", character_set);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-disable-reason", disable_reason);
- papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-disable-date", disable_date);
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-reject-reason", reject_reason);
- papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-reject-date", reject_date);
-
- /* add the current system time */
- papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-current-time", time(NULL));
-
- /* add the time since last enabled */
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-up-time", time(NULL));
-
- /* add the status information */
- lpsched_printer_status_to_attributes(&p->attributes, status);
-
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_EXCL,
- "printer-state-reasons", "none");
-
- lpsched_printer_defaults(&p->attributes);
-
- return (PAPI_OK);
-}
-
-
-/*
- * This puts the class information in only. It could create a hybrid
- * printer object to return, but that is problematic at best.
- */
-papi_status_t
-lpsched_class_configuration_to_attributes(service_t *svc, printer_t *p,
- char *dest)
-{
- CLASS *tmp;
-
- if ((svc == NULL) || (p == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* get the configuration DB data */
- if ((tmp = getclass(dest)) == NULL) {
- detailed_error(svc,
- gettext("unable to read configuration data"));
- return (PAPI_DEVICE_ERROR);
- }
-
- /* name */
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-name", tmp->name);
- if (tmp->name != NULL) {
- char uri[BUFSIZ];
-
- snprintf(uri, sizeof (uri), "lpsched://localhost/printers/%s",
- tmp->name);
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-uri-supported", uri);
- }
-
- if (tmp->members != NULL) {
- char **members = tmp->members;
- int i;
-
- for (i = 0; members[i] != NULL; i++)
- papiAttributeListAddString(&p->attributes,
- PAPI_ATTR_APPEND,
- "member-names", members[i]);
- }
-
- freeclass(tmp);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-class_status_to_attributes(printer_t *p, char *printer, short status,
- char *reject_reason, long reject_date)
-{
- if (p == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- papiAttributeListAddLPString(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-reject-reason", reject_reason);
- papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "lpsched-reject-date", reject_date);
-
- /* add the current system time */
- papiAttributeListAddDatetime(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-current-time", time(NULL));
-
- papiAttributeListAddInteger(&p->attributes, PAPI_ATTR_REPLACE,
- "printer-up-time", time(NULL));
-
- /* add the status information */
- lpsched_printer_status_to_attributes(&p->attributes, status);
-
- papiAttributeListAddString(&p->attributes, PAPI_ATTR_EXCL,
- "printer-state-reasons", "none");
-
- lpsched_printer_defaults(&p->attributes);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-attributes_to_printer(papi_attribute_t **attributes, PRINTER *tmp)
-{
- papi_status_t status;
- void *iter = NULL;
- char *string = NULL;
- int flags;
- char **list = NULL;
-
- /* banner needs some conversion to the bitfield */
- iter = NULL, string = NULL; flags = 0;
- for (status = papiAttributeListGetString(attributes, &iter,
- "job-sheets-supported", &string);
- status == PAPI_OK;
- status = papiAttributeListGetString(attributes, &iter,
- NULL, &string))
- if (strcasecmp(string, "none") == 0)
- flags |= BAN_NEVER;
- else if (strcasecmp(string, "standard") == 0)
- flags |= BAN_ALWAYS;
- if (flags != 0)
- tmp->banner = flags;
-
- /* input_types needs mime-type conversion */
- iter = NULL, string = NULL; list = NULL;
- for (status = papiAttributeListGetString(attributes, &iter,
- "document-format-supported", &string);
- status == PAPI_OK;
- status = papiAttributeListGetString(attributes, &iter,
- NULL, &string))
- addlist(&list, mime_type_to_lp_type(string));
- if (list != NULL) {
- if (tmp->input_types != NULL)
- freelist(tmp->input_types);
- tmp->input_types = list;
- }
-
- papiAttributeListGetLPString(attributes,
- "device-uri", &tmp->device);
- papiAttributeListGetLPString(attributes,
- "printer-info", &tmp->description);
- papiAttributeListGetLPString(attributes,
- "lpsched-dial-info", &tmp->dial_info);
- papiAttributeListGetLPString(attributes,
- "lpsched-fault-recovery", &tmp->fault_rec);
- papiAttributeListGetLPString(attributes,
- "lpsched-interface-script", &tmp->interface);
- papiAttributeListGetLPString(attributes,
- "lpsched-data-rate", &tmp->speed);
- papiAttributeListGetLPString(attributes,
- "lpsched-stty", &tmp->stty);
- papiAttributeListGetLPStrings(attributes,
- "lpsched-charsets", &tmp->char_sets);
- papiAttributeListGetLPStrings(attributes,
- "lpsched-printer-types", &tmp->printer_types);
- papiAttributeListGetLPStrings(attributes,
- "lpsched-options", &tmp->options);
- papiAttributeListGetLPStrings(attributes,
- "lpsched-modules", &tmp->modules);
-#ifdef LP_USE_PAPI_ATTR
- papiAttributeListGetLPString(attributes,
- "lpsched-printer-ppd-uri", &tmp->ppd);
-#endif
-
- return (PAPI_OK);
-}
diff --git a/usr/src/cmd/lp/lib/papi/mapfile b/usr/src/cmd/lp/lib/papi/mapfile
deleted file mode 100644
index a4eeffdaf6..0000000000
--- a/usr/src/cmd/lp/lib/papi/mapfile
+++ /dev/null
@@ -1,273 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# Generic interface definition for usr/src/cmd/lp/lib/papi
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-SYMBOL_VERSION SUNW_1.0 {
- global:
- # PAPI Attribute Calls
- papiAttributeListAdd;
- papiAttributeListAddValue {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListAddBoolean {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListAddCollection {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListAddDatetime {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListAddInteger {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListAddMetadata {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListAddRange {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListAddResolution {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListAddString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListDelete {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetValue {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetNext {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListFind {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetBoolean {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetCollection {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetDatetime {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetInteger {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetMetadata {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetRange {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetResolution {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListGetString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListFromString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListToString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListFree {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
-
- # PAPI Service Calls
- papiServiceCreate;
- papiServiceDestroy;
- papiServiceSetUserName;
- papiServiceSetPassword;
- papiServiceSetEncryption;
- papiServiceSetAuthCB;
- papiServiceSetAppData;
- papiServiceGetUserName;
- papiServiceGetPassword;
- papiServiceGetEncryption;
- papiServiceGetAppData;
- papiServiceGetServiceName;
- papiServiceGetAttributeList;
- papiServiceGetStatusMessage;
-
- # PAPI Printer Calls
- papiPrintersList;
- papiPrinterQuery;
- papiPrinterAdd;
- papiPrinterModify;
- papiPrinterRemove;
- papiPrinterDisable;
- papiPrinterEnable;
- papiPrinterPause;
- papiPrinterResume;
- papiPrinterPurgeJobs;
- papiPrinterListJobs;
- papiPrinterGetAttributeList;
- papiPrinterFree;
- papiPrinterListFree;
-
- # PAPI Job Calls
- papiJobSubmit;
- papiJobSubmitByReference;
- papiJobValidate;
- papiJobStreamOpen;
- papiJobStreamWrite;
- papiJobStreamClose;
- papiJobQuery;
- papiJobModify;
- papiJobMove;
- papiJobCancel;
- papiJobHold;
- papiJobRelease;
- papiJobRestart {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiJobPromote;
- papiJobGetAttributeList;
- papiJobGetPrinterName;
- papiJobGetId;
- papiJobGetJobTicket {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiJobFree;
- papiJobListFree;
-
- # Misc. PAPI Calls
- papiStatusString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiLibrarySupportedCall;
- papiLibrarySupportedCalls;
-};
-
-SYMBOL_VERSION SUNWprivate_1.0 {
- global:
- papiServiceSetPeer; # used by to pass peer connection
- papiJobCreate;
- papiJobStreamAdd;
- papiJobCommit;
-
- # Misc. supporting calls
- # URI
- uri_from_string {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- uri_to_string {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- uri_free {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- # list
- list_remove {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- list_append {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- list_concatenate {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
-
- # NS
- getprinterbyname {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- is_localhost {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
-
- # extra Attribute Calls
- copy_attributes {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- split_and_copy_attributes {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
- papiAttributeListPrint {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- };
-
- local:
- *;
-};
diff --git a/usr/src/cmd/lp/lib/papi/papi_impl.h b/usr/src/cmd/lp/lib/papi/papi_impl.h
deleted file mode 100644
index 5d13df73ee..0000000000
--- a/usr/src/cmd/lp/lib/papi/papi_impl.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _PAPI_IMPL_H
-#define _PAPI_IMPL_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <papi.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <time.h>
-#include <sys/types.h>
-#include <stdarg.h>
-
-/* lpsched include files */
-#include <lp.h>
-#include <msgs.h>
-#include <printers.h>
-#include <requests.h>
-
-
-/*
- * Implementation specific types/prototypes/definitions follow
- *
- *
- * Ex:
- */
-
-typedef struct {
- papi_attribute_t **attributes;
- int (*authCB)(papi_service_t svc, void *app_data);
- void *app_data;
- MESG *md;
- char *msgbuf;
- size_t msgbuf_size;
-} service_t;
-
-typedef struct job {
- papi_attribute_t **attributes; /* job attributes */
-} job_t;
-
-typedef struct {
- papi_attribute_t **attributes; /* queue attributes */
-} printer_t;
-
-typedef struct {
- int fd;
- REQUEST *request;
- char *meta_data_file;
- char added;
-} job_stream_t;
-
-extern void lpsched_read_job_configuration(service_t *svc, job_t *j,
- char *file);
-extern void lpsched_request_to_job(REQUEST *r, job_t *j);
-
-extern void job_status_to_attributes(job_t *job, char *req_id, char *user,
- char *slabel, size_t size, time_t date,
- short state, char *destination, char *form,
- char *charset, short rank, char *file);
-extern papi_status_t addLPString(papi_attribute_t ***list,
- int flags, char *name, char *value);
-extern papi_status_t papiAttributeListAddLPStrings(papi_attribute_t ***list,
- int flags, char *name, char **values);
-extern void papiAttributeListGetLPString(papi_attribute_t **attributes,
- char *key, char **string);
-extern void papiAttributeListGetLPStrings(papi_attribute_t **attributes,
- char *key, char ***string);
-
-extern papi_status_t lpsched_printer_configuration_to_attributes(
- service_t *svc, printer_t *p, char *dest);
-extern papi_status_t lpsched_class_configuration_to_attributes(service_t *svc,
- printer_t *p, char *dest);
-extern papi_status_t class_status_to_attributes(printer_t *p, char *printer,
- short status, char *reject_reason, long reject_date);
-extern papi_status_t lpsched_reject_printer(papi_service_t svc,
- char *printer, char *message);
-extern papi_status_t lpsched_accept_printer(papi_service_t svc,
- char *printer);
-extern papi_status_t lpsched_disable_printer(papi_service_t svc,
- char *printer, char *message);
-extern papi_status_t lpsched_enable_printer(papi_service_t svc,
- char *printer);
-extern papi_status_t lpsched_status_to_papi_status(int status);
-extern papi_status_t job_attributes_to_lpsched_request(papi_service_t svc,
- REQUEST *r, papi_attribute_t **attributes);
-extern papi_status_t lpsched_alloc_files(papi_service_t svc, int number,
- char **prefix);
-extern papi_status_t lpsched_commit_job(papi_service_t svc, char *job,
- char **tmp);
-extern papi_status_t lpsched_start_change(papi_service_t svc,
- char *printer, int32_t job_id, char **tmp);
-extern papi_status_t lpsched_end_change(papi_service_t svc,
- char *printer, int32_t job_id);
-extern papi_status_t printer_status_to_attributes(printer_t *p, char *printer,
- char *form, char *character_set, char *reject_reason,
- char *disable_reason, short status, char *request_id, long enable_date,
- long reject_date);
-extern papi_status_t lpsched_remove_printer(papi_service_t svc, char *dest);
-extern papi_status_t lpsched_remove_class(papi_service_t svc, char *dest);
-extern papi_status_t lpsched_add_modify_printer(papi_service_t svc, char *dest,
- papi_attribute_t **attributes, int type);
-extern papi_status_t lpsched_add_modify_class(papi_service_t svc, char *dest,
- papi_attribute_t **attributes);
-
-extern void lpsched_service_information(papi_attribute_t ***attrs);
-extern void lpsched_request_to_job_attributes(REQUEST *r, job_t *j);
-extern void detailed_error(service_t *svc, char *fmt, ...);
-extern char *banner_type(unsigned short banner);
-extern char *mime_type_to_lp_type(char *mime_type);
-extern char *lp_type_to_mime_type(char *lp_type);
-extern char *fifo_name_from_uri(char *uri);
-extern char *printer_name_from_uri_id(char *uri, int32_t id);
-
-extern int snd_msg(service_t *svc, int type, ...);
-extern int rcv_msg(service_t *svc, int type, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PAPI_IMPL_H */
diff --git a/usr/src/cmd/lp/lib/papi/ppd.c b/usr/src/cmd/lp/lib/papi/ppd.c
deleted file mode 100644
index 5facf902be..0000000000
--- a/usr/src/cmd/lp/lib/papi/ppd.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * This file contains an extremely rudimentary implementation of PPD file
- * parsing support. The parsing done here converts the contents of a PPD
- * file into a set of PAPI attributes that applications can use to build
- * print panels.
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <papi.h>
-
-static void
-process_line(char *line, char **key, char **value, char **comment)
-{
- char *ptr, *ptr2;
-
- *key = &line[1];
- *value = NULL;
- *comment = NULL;
-
- if ((ptr = strchr(line, ':')) == NULL)
- return;
-
- /*
- * line is in the form:
- * *key: value/comment
- * or
- * *key value/comment: data
- */
- *ptr++ = NULL;
- while (isspace(*ptr) != 0)
- ptr++;
-
- if ((ptr2 = strchr(line, ' ')) != NULL) {
- ptr = ptr2;
- /*
- * line is in the form:
- * *key value/comment: data
- */
- *ptr++ = NULL;
- while (*ptr == ' ')
- ptr++;
- }
-
- if (*ptr == '*')
- ptr++;
-
- *value = ptr;
-
- if ((ptr = strchr(ptr, '/')) != NULL) {
- *ptr++ = NULL;
- *comment = ptr;
- }
-}
-
-papi_status_t
-PPDFileToAttributesList(papi_attribute_t ***attributes, char *filename)
-{
- papi_status_t status = PAPI_OK;
- FILE *fp;
- char line[256];
- char capability[256];
- char def[256];
- char supported[256];
- char *current_group_name = NULL;
-
- int ui = 0;
-
- if ((fp = fopen(filename, "r")) == NULL)
- return (PAPI_NOT_POSSIBLE);
-
- while ((status == PAPI_OK) &&
- (fgets(line, sizeof (line), fp) != NULL)) {
- char *key = NULL, *value = NULL, *text = NULL;
-
- /* we want *key...: "value" */
- if (line[0] != '*')
- continue;
-
- if (strchr(line, ':') == NULL)
- continue;
-
- if ((text = strrchr(line, '\n')) != NULL)
- *text = NULL;
-
- process_line(line, &key, &value, &text);
-
- if ((strcasecmp(key, "PageSize") == 0) ||
- (strcasecmp(key, "InputSlot") == 0))
- key = "media";
-
- if (strcasecmp(key, "OpenGroup") == 0) {
- if (value == NULL)
- value = "unknown";
- current_group_name = strdup(value);
- } else if (strcasecmp(key, "OpenUI") == 0) {
- if ((strcasecmp(value, "PageSize") == 0) ||
- (strcasecmp(value, "InputSlot") == 0))
- value = "media";
- snprintf(capability, sizeof (capability), "%s", value);
- snprintf(def, sizeof (def),
- "%s-default", value);
- snprintf(supported, sizeof (supported),
- "%s-supported", value);
- ui = 1;
- } else if (strcasecmp(key, "CloseGroup") == 0) {
- /* do nothing */
- } else if (strcasecmp(key, "CloseUI") == 0) {
- ui = 0;
- /* do nothing */
- } else if (strcasecmp(key, "Manufacturer") == 0) {
- status = papiAttributeListAddString(attributes,
- PAPI_ATTR_EXCL,
- "printer-make", value);
- } else if (strcasecmp(key, "ModelName") == 0) {
- status = papiAttributeListAddString(attributes,
- PAPI_ATTR_EXCL,
- "printer-model", value);
- } else if (strcasecmp(key, "ShortNickName") == 0) {
- status = papiAttributeListAddString(attributes,
- PAPI_ATTR_EXCL,
- "printer-make-and-model", value);
- } else if ((strncasecmp(key, "Default", 7) == 0) && ui) {
- status = papiAttributeListAddString(attributes,
- PAPI_ATTR_EXCL,
- def, value);
- } else if ((strcasecmp(key, capability) == 0) && ui) {
- status = papiAttributeListAddString(attributes,
- PAPI_ATTR_APPEND,
- supported, value);
- }
- }
- fclose(fp);
-
- return (status);
-}
diff --git a/usr/src/cmd/lp/lib/papi/printer.c b/usr/src/cmd/lp/lib/papi/printer.c
deleted file mode 100644
index 5a3fba075a..0000000000
--- a/usr/src/cmd/lp/lib/papi/printer.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <libintl.h>
-#include <papi_impl.h>
-#include <lp.h>
-
-extern int isclass(char *);
-
-void
-papiPrinterFree(papi_printer_t printer)
-{
- printer_t *tmp = printer;
-
- if (tmp != NULL) {
- papiAttributeListFree(tmp->attributes);
- free(tmp);
- }
-}
-
-void
-papiPrinterListFree(papi_printer_t *printers)
-{
- if (printers != NULL) {
- int i;
-
- for (i = 0; printers[i] != NULL; i++)
- papiPrinterFree(printers[i]);
- free(printers);
- }
-}
-
-papi_status_t
-papiPrintersList(papi_service_t handle, char **requested_attrs,
- papi_filter_t *filter, papi_printer_t **printers)
-{
- service_t *svc = handle;
- printer_t *p = NULL;
- short status = MOK;
- char *printer = NULL,
- *form = NULL,
- *request_id = NULL,
- *character_set = NULL,
- *reject_reason = NULL,
- *disable_reason = NULL;
- short printer_status = 0;
- long enable_date = 0, reject_date = 0;
-
- if ((handle == NULL) || (printers == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((filter == NULL) ||
- ((filter->filter.bitmask.mask & PAPI_PRINTER_LOCAL) ==
- (filter->filter.bitmask.value & PAPI_PRINTER_LOCAL))) {
- /* ask the spooler for the printer(s) and state */
- if (snd_msg(svc, S_INQUIRE_PRINTER_STATUS, NAME_ALL) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- do {
- if (rcv_msg(svc, R_INQUIRE_PRINTER_STATUS, &status,
- &printer, &form, &character_set,
- &disable_reason, &reject_reason,
- &printer_status, &request_id,
- &enable_date, &reject_date) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- if ((p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- lpsched_printer_configuration_to_attributes(svc, p,
- printer);
-
- printer_status_to_attributes(p, printer, form,
- character_set, disable_reason,
- reject_reason, printer_status,
- request_id, enable_date, reject_date);
-
- list_append(printers, p);
-
- } while (status == MOKMORE);
- }
-
- if ((filter == NULL) ||
- ((filter->filter.bitmask.mask & PAPI_PRINTER_CLASS) ==
- (filter->filter.bitmask.value & PAPI_PRINTER_CLASS))) {
- /* ask the spooler for the class(es) and state */
- if (snd_msg(svc, S_INQUIRE_CLASS, NAME_ALL) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- do {
- if (rcv_msg(svc, R_INQUIRE_CLASS, &status, &printer,
- &printer_status, &reject_reason,
- &reject_date) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- if ((p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- lpsched_class_configuration_to_attributes(svc, p,
- printer);
-
- class_status_to_attributes(p, printer, printer_status,
- reject_reason, reject_date);
-
- list_append(printers, p);
-
- } while (status == MOKMORE);
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiPrinterQuery(papi_service_t handle, char *name,
- char **requested_attrs,
- papi_attribute_t **job_attrs,
- papi_printer_t *printer)
-{
- papi_status_t pst;
- service_t *svc = handle;
- printer_t *p = NULL;
- char *dest;
- short status = MOK;
- char *pname = NULL,
- *form = NULL,
- *request_id = NULL,
- *character_set = NULL,
- *reject_reason = NULL,
- *disable_reason = NULL;
- short printer_status = 0;
- long enable_date = 0, reject_date = 0;
-
- if ((handle == NULL) || (name == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((*printer = p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- dest = printer_name_from_uri_id(name, -1);
-
- if (strcmp(dest, "_default") == 0) {
- static char *_default;
-
- if (_default == NULL) {
- int fd;
- static char buf[128];
-
- if ((fd = open("/etc/lp/default", O_RDONLY)) >= 0) {
- read(fd, buf, sizeof (buf));
- close(fd);
- _default = strtok(buf, " \t\n");
- }
- }
- dest = _default;
- }
-
- if (isprinter(dest) != 0) {
- pst = lpsched_printer_configuration_to_attributes(svc, p, dest);
- if (pst != PAPI_OK)
- return (pst);
-
- /* get the spooler status data now */
- if (snd_msg(svc, S_INQUIRE_PRINTER_STATUS, dest) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- if (rcv_msg(svc, R_INQUIRE_PRINTER_STATUS, &status, &pname,
- &form, &character_set, &disable_reason,
- &reject_reason, &printer_status, &request_id,
- &enable_date, &reject_date) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- printer_status_to_attributes(p, pname, form, character_set,
- disable_reason, reject_reason, printer_status,
- request_id, enable_date, reject_date);
- } else if (isclass(dest) != 0) {
- pst = lpsched_class_configuration_to_attributes(svc, p, dest);
- if (pst != PAPI_OK)
- return (pst);
-
- /* get the spooler status data now */
- if (snd_msg(svc, S_INQUIRE_CLASS, dest) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- if (rcv_msg(svc, R_INQUIRE_CLASS, &status, &pname,
- &printer_status, &reject_reason,
- &reject_date) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- class_status_to_attributes(p, pname, printer_status,
- reject_reason, reject_date);
- } else if (strcmp(dest, "PrintService") == 0) {
- /* fill the printer object with service information */
- lpsched_service_information(&p->attributes);
- } else
- return (PAPI_NOT_FOUND);
-
- free(dest);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiPrinterAdd(papi_service_t handle, char *name,
- papi_attribute_t **attributes, papi_printer_t *result)
-{
- papi_status_t status;
- printer_t *p = NULL;
- char *dest;
-
- if ((handle == NULL) || (name == NULL) || (attributes == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(name, -1);
-
- if (isprinter(dest) != 0) {
- status = lpsched_add_modify_printer(handle, dest,
- attributes, 0);
-
- if ((*result = p = calloc(1, sizeof (*p))) != NULL)
- lpsched_printer_configuration_to_attributes(handle, p,
- dest);
- else
- status = PAPI_TEMPORARY_ERROR;
-
- } else if (isclass(dest) != 0) {
- status = lpsched_add_modify_class(handle, dest, attributes);
-
- if ((*result = p = calloc(1, sizeof (*p))) != NULL)
- lpsched_class_configuration_to_attributes(handle, p,
- dest);
- else
- status = PAPI_TEMPORARY_ERROR;
-
- } else
- status = PAPI_NOT_FOUND;
-
- free(dest);
-
- return (status);
-}
-
-papi_status_t
-papiPrinterModify(papi_service_t handle, char *name,
- papi_attribute_t **attributes, papi_printer_t *result)
-{
- papi_status_t status;
- printer_t *p = NULL;
- char *dest;
-
- if ((handle == NULL) || (name == NULL) || (attributes == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(name, -1);
-
- if (isprinter(dest) != 0) {
- status = lpsched_add_modify_printer(handle, dest,
- attributes, 1);
-
- if ((*result = p = calloc(1, sizeof (*p))) != NULL)
- lpsched_printer_configuration_to_attributes(handle, p,
- dest);
- else
- status = PAPI_TEMPORARY_ERROR;
- } else if (isclass(dest) != 0) {
- status = lpsched_add_modify_class(handle, dest, attributes);
-
- if ((*result = p = calloc(1, sizeof (*p))) != NULL)
- lpsched_class_configuration_to_attributes(handle, p,
- dest);
- else
- status = PAPI_TEMPORARY_ERROR;
- } else
- status = PAPI_NOT_FOUND;
-
- free(dest);
-
- return (status);
-}
-
-papi_status_t
-papiPrinterRemove(papi_service_t handle, char *name)
-{
- papi_status_t result;
- char *dest;
-
- if ((handle == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(name, -1);
-
- if (isprinter(dest) != 0) {
- result = lpsched_remove_printer(handle, dest);
- } else if (isclass(dest) != 0) {
- result = lpsched_remove_class(handle, dest);
- } else
- result = PAPI_NOT_FOUND;
-
- free(dest);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterDisable(papi_service_t handle, char *name, char *message)
-{
- papi_status_t result;
-
- if ((handle == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- result = lpsched_disable_printer(handle, name, message);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterEnable(papi_service_t handle, char *name)
-{
- papi_status_t result;
-
- if ((handle == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- result = lpsched_enable_printer(handle, name);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterPause(papi_service_t handle, char *name, char *message)
-{
- papi_status_t result;
-
- if ((handle == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- result = lpsched_reject_printer(handle, name, message);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterResume(papi_service_t handle, char *name)
-{
- papi_status_t result;
-
- if ((handle == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- result = lpsched_accept_printer(handle, name);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterPurgeJobs(papi_service_t handle, char *name, papi_job_t **jobs)
-{
- service_t *svc = handle;
- papi_status_t result = PAPI_OK_SUBST;
- short more;
- long status;
- char *dest;
- char *req_id;
-
- if ((handle == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(name, -1);
- more = snd_msg(svc, S_CANCEL, dest, "", "");
- free(dest);
- if (more < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- do {
- if (rcv_msg(svc, R_CANCEL, &more, &status, &req_id) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- switch (status) {
- case MOK:
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_APPEND,
- "canceled-jobs", req_id);
- break;
- case M2LATE:
- case MUNKNOWN:
- case MNOINFO:
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_APPEND,
- "cancel-failed", req_id);
- result = PAPI_DEVICE_ERROR;
- break;
- case MNOPERM:
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_APPEND,
- "cancel-failed", req_id);
- result = PAPI_NOT_AUTHORIZED;
- break;
- default:
- detailed_error(svc, gettext("cancel failed, bad status (%d)\n"),
- status);
- return (PAPI_DEVICE_ERROR);
- }
- } while (more == MOKMORE);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterListJobs(papi_service_t handle, char *name,
- char **requested_attrs, int type_mask,
- int max_num_jobs, papi_job_t **jobs)
-{
- service_t *svc = handle;
- char *dest;
- short rc;
- int count = 1;
-
- if ((handle == NULL) || (name == NULL) || (jobs == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- dest = printer_name_from_uri_id(name, -1);
-
- rc = snd_msg(svc, S_INQUIRE_REQUEST_RANK, 0, "", dest, "", "", "");
- free(dest);
- if (rc < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- do {
- job_t *job = NULL;
- char *dest = NULL,
- *ptr,
- *form = NULL,
- *req_id = NULL,
- *charset = NULL,
- *owner = NULL,
- *slabel = NULL,
- *file = NULL;
- char request_file[128];
- time_t date = 0;
- size_t size = 0;
- short rank = 0, state = 0;
-
- if (rcv_msg(svc, R_INQUIRE_REQUEST_RANK, &rc, &req_id,
- &owner, &slabel, &size, &date, &state, &dest,
- &form, &charset, &rank, &file) < 0)
- return (PAPI_SERVICE_UNAVAILABLE);
-
- if ((rc != MOK) && (rc != MOKMORE))
- continue;
- /*
- * at this point, we should check to see if the job matches the
- * selection criterion defined in "type_mask".
- */
-
- /* too many yet? */
- if ((max_num_jobs != 0) && (count++ > max_num_jobs))
- continue;
-
- if ((job = calloc(1, sizeof (*job))) == NULL)
- continue;
-
- /* Request file is <req_id>-0 */
- if ((ptr = strrchr(req_id, '-')) != NULL) {
- ++ptr;
- snprintf(request_file, sizeof (request_file),
- "%s-0", ptr);
- }
-
- lpsched_read_job_configuration(svc, job, request_file);
-
- job_status_to_attributes(job, req_id, owner, slabel, size,
- date, state, dest, form, charset, rank, file);
-
- list_append(jobs, job);
-
- } while (rc == MOKMORE);
-
- if (rc == MNOINFO) /* If no jobs are found, it's still ok */
- rc = MOK;
-
- return (lpsched_status_to_papi_status(rc));
-}
-
-papi_attribute_t **
-papiPrinterGetAttributeList(papi_printer_t printer)
-{
- printer_t *tmp = printer;
-
- if (tmp == NULL)
- return (NULL);
-
- return (tmp->attributes);
-}
diff --git a/usr/src/cmd/lp/lib/papi/service.c b/usr/src/cmd/lp/lib/papi/service.c
deleted file mode 100644
index a15434fcfb..0000000000
--- a/usr/src/cmd/lp/lib/papi/service.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <alloca.h>
-#include <libintl.h>
-#include <papi_impl.h>
-
-#include <tsol/label.h>
-
-papi_status_t
-papiServiceCreate(papi_service_t *handle, char *service_name,
- char *user_name, char *password,
- int (*authCB)(papi_service_t svc, void *app_data),
- papi_encryption_t encryption, void *app_data)
-{
- service_t *svc = NULL;
- char *path = Lp_FIFO;
-
- if (handle == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if ((*handle = svc = calloc(1, sizeof (*svc))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- svc->md = mconnect(path, 0, 0);
- if (svc->md == NULL) {
- detailed_error(svc,
- gettext("can't connect to spooler for %s: %s"),
- (service_name ? service_name : ""), strerror(errno));
- return (PAPI_SERVICE_UNAVAILABLE);
- }
-
- svc->msgbuf_size = MSGMAX;
- if ((svc->msgbuf = calloc(1, svc->msgbuf_size)) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- if (service_name != NULL)
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_EXCL,
- "service-name", service_name);
-
- (void) papiServiceSetUserName(svc, user_name);
- (void) papiServiceSetPassword(svc, password);
- (void) papiServiceSetAuthCB(svc, authCB);
- (void) papiServiceSetAppData(svc, app_data);
- (void) papiServiceSetEncryption(svc, encryption);
-
- return (PAPI_OK);
-}
-
-void
-papiServiceDestroy(papi_service_t handle)
-{
- service_t *svc = handle;
-
- if (svc != NULL) {
- if (svc->md != NULL)
- mdisconnect(svc->md);
- if (svc->msgbuf != NULL)
- free(svc->msgbuf);
- papiAttributeListFree(svc->attributes);
- free(svc);
- }
-}
-
-/*
- * interface for passing a peer's connection to gather sensitivity labeling
- * from for Trusted Solaris.
- */
-papi_status_t
-papiServiceSetPeer(papi_service_t handle, int peerfd)
-{
- papi_status_t result = PAPI_OK;
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if (is_system_labeled()) {
- short status;
-
- if ((snd_msg(svc, S_PASS_PEER_CONNECTION) < 0) ||
- (ioctl(svc->md->writefd, I_SENDFD, peerfd) < 0) ||
- (rcv_msg(svc, R_PASS_PEER_CONNECTION, &status) < 0))
- status = MTRANSMITERR;
-
- if (status != MOK) {
- detailed_error(svc,
- gettext("failed to send peer connection: %s"),
- lpsched_status_string(status));
- result = lpsched_status_to_papi_status(status);
- }
- }
-
- return (result);
-}
-
-papi_status_t
-papiServiceSetUserName(papi_service_t handle, char *user_name)
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- return (papiAttributeListAddString(&svc->attributes, PAPI_ATTR_REPLACE,
- "user-name", user_name));
-}
-
-papi_status_t
-papiServiceSetPassword(papi_service_t handle, char *password)
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- return (papiAttributeListAddString(&svc->attributes, PAPI_ATTR_REPLACE,
- "password", password));
-}
-
-papi_status_t
-papiServiceSetEncryption(papi_service_t handle,
- papi_encryption_t encryption)
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- return (papiAttributeListAddInteger(&svc->attributes, PAPI_ATTR_REPLACE,
- "encryption", (int)encryption));
-}
-
-papi_status_t
-papiServiceSetAuthCB(papi_service_t handle,
- int (*authCB)(papi_service_t svc, void *app_data))
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- svc->authCB = (int (*)(papi_service_t svc, void *app_data))authCB;
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiServiceSetAppData(papi_service_t handle, void *app_data)
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- svc->app_data = (void *)app_data;
-
- return (PAPI_OK);
-}
-
-char *
-papiServiceGetServiceName(papi_service_t handle)
-{
- service_t *svc = handle;
- char *result = NULL;
-
- if (svc != NULL)
- papiAttributeListGetString(svc->attributes, NULL,
- "service-name", &result);
-
- return (result);
-}
-
-char *
-papiServiceGetUserName(papi_service_t handle)
-{
- service_t *svc = handle;
- char *result = NULL;
-
- if (svc != NULL)
- papiAttributeListGetString(svc->attributes, NULL,
- "user-name", &result);
-
- return (result);
-}
-
-char *
-papiServiceGetPassword(papi_service_t handle)
-{
- service_t *svc = handle;
- char *result = NULL;
-
- if (svc != NULL)
- papiAttributeListGetString(svc->attributes, NULL,
- "password", &result);
-
- return (result);
-}
-
-papi_encryption_t
-papiServiceGetEncryption(papi_service_t handle)
-{
- service_t *svc = handle;
- papi_encryption_t result = PAPI_ENCRYPT_NEVER;
-
- if (svc != NULL)
- papiAttributeListGetInteger(svc->attributes, NULL,
- "encryption", (int *)&result);
-
- return (result);
-}
-
-void *
-papiServiceGetAppData(papi_service_t handle)
-{
- service_t *svc = handle;
- void *result = NULL;
-
- if (svc != NULL)
- result = svc->app_data;
-
- return (result);
-}
-
-papi_attribute_t **
-papiServiceGetAttributeList(papi_service_t handle)
-{
- service_t *svc = handle;
- papi_attribute_t **result = NULL;
-
- if (svc != NULL) {
- lpsched_service_information(&svc->attributes);
- result = svc->attributes;
- }
-
- return (result);
-}
-
-char *
-papiServiceGetStatusMessage(papi_service_t handle)
-{
- service_t *svc = handle;
- char *result = NULL;
-
- if (svc != NULL)
- papiAttributeListGetString(svc->attributes, NULL,
- "detailed-status-message", &result);
-
- return (result);
-}
-
-void
-detailed_error(service_t *svc, char *fmt, ...)
-{
- if ((svc != NULL) && (fmt != NULL)) {
- va_list ap;
- size_t size;
- char *message = alloca(BUFSIZ);
-
- va_start(ap, fmt);
- /*
- * fill in the message. If the buffer is too small, allocate
- * one that is large enough and fill it in.
- */
- if ((size = vsnprintf(message, BUFSIZ, fmt, ap)) >= BUFSIZ)
- if ((message = alloca(size)) != NULL)
- vsnprintf(message, size, fmt, ap);
- va_end(ap);
-
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_APPEND,
- "detailed-status-message", message);
- }
-}
diff --git a/usr/src/cmd/lp/lib/printers/Makefile b/usr/src/cmd/lp/lib/printers/Makefile
deleted file mode 100644
index 578ebee8e4..0000000000
--- a/usr/src/cmd/lp/lib/printers/Makefile
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/lib/printers/Makefile
-#
-
-LIBRARY = liblpprt.a
-
-OBJECTS = chkprinter.o \
- default.o \
- delprinter.o \
- freeprinter.o \
- getprinter.o \
- getpentry.o \
- p_head.o \
- okprinter.o \
- printwheels.o \
- putprinter.o
-
-
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CPPFLAGS = -I../../include $(CPPFLAGS.master) $(C_PICFLAGS)
-
-POFILE = lp_lib_printers.po
-
-.KEEP_STATE:
-
-all install : $(LIBS)
-
-include ../../../../lib/Makefile.targ
-
-CLEANFILES += llib-llpprt.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-LINT_CPPFLAGS = -I../../include $(CPPFLAGS.master)
-
-lint: lintlib
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) $(SRCS)
-
-lintlib:
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) -o lpprt llib-llpprt
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/printers/chkprinter.c b/usr/src/cmd/lp/lib/printers/chkprinter.c
deleted file mode 100644
index 378f3a312c..0000000000
--- a/usr/src/cmd/lp/lib/printers/chkprinter.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-
-#include "lp.h"
-#include "lp.set.h"
-#include "printers.h"
-
-extern short output_res_char,
- output_res_line,
- output_res_horz_inch,
- output_res_vert_inch;
-
-/**
- ** chkprinter() - CHECK VALIDITY OF PITCH/SIZE/CHARSET FOR TERMINFO TYPE
- **/
-
-unsigned long
-#if defined(__STDC__)
-chkprinter (
- char * type,
- char * cpi,
- char * lpi,
- char * len,
- char * wid,
- char * cs
-)
-#else
-chkprinter (type, cpi, lpi, len, wid, cs)
- char *type,
- *cpi,
- *lpi,
- *len,
- *wid,
- *cs;
-#endif
-{
- register unsigned long retflags = 0;
-
-
- if (tidbit(type, (char *)0) == -1)
- return (retflags | PCK_TYPE);
-
- output_res_char = -1;
- output_res_line = -1;
- output_res_horz_inch = -1;
- output_res_vert_inch = -1;
-
- if (cpi && *cpi && set_pitch(cpi, 'H', 0) != E_SUCCESS)
- retflags |= PCK_CPI;
-
- if (lpi && *lpi && set_pitch(lpi, 'V', 0) != E_SUCCESS)
- retflags |= PCK_LPI;
-
- if (len && *len && set_size(len, 'L', 0) != E_SUCCESS)
- retflags |= PCK_LENGTH;
-
- if (wid && *wid && set_size(wid, 'W', 0) != E_SUCCESS)
- retflags |= PCK_WIDTH;
-
- if (cs && *cs && set_charset(cs, 0, type) != E_SUCCESS)
- retflags |= PCK_CHARSET;
-
- return (retflags);
-}
diff --git a/usr/src/cmd/lp/lib/printers/default.c b/usr/src/cmd/lp/lib/printers/default.c
deleted file mode 100644
index 29e8944c5a..0000000000
--- a/usr/src/cmd/lp/lib/printers/default.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "stdlib.h"
-
-#include "lp.h"
-
-/**
- ** getdefault() - READ THE NAME OF THE DEFAULT DESTINATION FROM DISK
- **/
-
-char *
-getdefault(void)
-{
- return (loadline(Lp_Default));
-}
-
-/**
- ** putdefault() - WRITE THE NAME OF THE DEFAULT DESTINATION TO DISK
- **/
-
-int
-putdefault(char *dflt)
-{
- int fd;
-
- if (!dflt || !*dflt)
- return (deldefault());
-
- if ((fd = open_locked(Lp_Default, "w", MODE_READ)) < 0)
- return (-1);
-
- fdprintf(fd, "%s\n", dflt);
-
- close(fd);
- return (0);
-}
-
-/**
- ** deldefault() - REMOVE THE NAME OF THE DEFAULT DESTINATION
- **/
-
-int
-deldefault(void)
-{
- return (rmfile(Lp_Default));
-}
diff --git a/usr/src/cmd/lp/lib/printers/delprinter.c b/usr/src/cmd/lp/lib/printers/delprinter.c
deleted file mode 100644
index a7a183e902..0000000000
--- a/usr/src/cmd/lp/lib/printers/delprinter.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "printers.h"
-
-#if defined(__STDC__)
-static int _delprinter ( char * );
-#else
-static int _delprinter();
-#endif
-
-/**
- ** delprinter()
- **/
-
-int
-#if defined(__STDC__)
-delprinter (
- char * name
-)
-#else
-delprinter (name)
- char *name;
-#endif
-{
- long lastdir;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (!Lp_A_Printers || !Lp_A_Interfaces) {
- getadminpaths (LPUSER);
- if (!Lp_A_Printers || !Lp_A_Interfaces)
- return (0);
- }
-
- if (STREQU(NAME_ALL, name)) {
- lastdir = -1;
- while ((name = next_dir(Lp_A_Printers, &lastdir)))
- if (_delprinter(name) == -1)
- return (-1);
- return (0);
- } else
- return (_delprinter(name));
-}
-
-/**
- ** _delprinter()
- **/
-
-static int
-#if defined(__STDC__)
-_delprinter (
- char * name
-)
-#else
-_delprinter (name)
- char *name;
-#endif
-{
- register char *path;
-#ifdef LP_USE_PAPI_ATTR
- char ppdfile[BUFSIZ];
-#endif
-
-#define RMFILE(X) if (!(path = getprinterfile(name, X))) \
- return (-1); \
- if (rmfile(path) == -1) { \
- Free (path); \
- return (-1); \
- } \
- Free (path)
- RMFILE (COMMENTFILE);
- RMFILE (CONFIGFILE);
- RMFILE (FALLOWFILE);
- RMFILE (FDENYFILE);
- RMFILE (UALLOWFILE);
- RMFILE (UDENYFILE);
- RMFILE (STATUSFILE);
- RMFILE (FAULTMESSAGEFILE);
-
- delalert (Lp_A_Printers, name);
-
- if (!(path = makepath(Lp_A_Interfaces, name, (char *)0)))
- return (-1);
- if (rmfile(path) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
-#ifdef LP_USE_PAPI_ATTR
- /* Check if the printer has a ppd file, if it does delete it */
- (void) snprintf(ppdfile, sizeof (ppdfile), "%s.ppd", name);
-
- if (!(path = makepath(ETCDIR, "ppd", ppdfile, (char *)0)))
- {
- return (-1);
- }
- if (rmfile(path) == -1)
- {
- Free(path);
- return (-1);
- }
- Free(path);
-#endif
-
- if (!(path = getprinterfile(name, (char *)0)))
- return (-1);
- if (Rmdir(path) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/printers/freeprinter.c b/usr/src/cmd/lp/lib/printers/freeprinter.c
deleted file mode 100644
index e915885dd0..0000000000
--- a/usr/src/cmd/lp/lib/printers/freeprinter.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "printers.h"
-#include <syslog.h>
-
-/**
- ** freeprinter() - FREE MEMORY ALLOCATED FOR PRINTER STRUCTURE
- **/
-
-void freeprinter (pp)
- PRINTER *pp;
-{
- if (!pp)
- return;
-
- syslog(LOG_DEBUG, "freeprinter(%s)", pp->name ? pp->name : "");
- if (pp->name)
- Free (pp->name);
- if (pp->char_sets)
- freelist (pp->char_sets);
- if (pp->input_types)
- freelist (pp->input_types);
- if (pp->options)
- freelist (pp->options);
- if (pp->device)
- Free (pp->device);
- if (pp->dial_info)
- Free (pp->dial_info);
- if (pp->fault_rec)
- Free (pp->fault_rec);
- if (pp->interface)
- Free (pp->interface);
- if (pp->printer_type)
- Free (pp->printer_type);
- if (pp->remote)
- Free (pp->remote);
- if (pp->speed)
- Free (pp->speed);
- if (pp->stty)
- Free (pp->stty);
- if (pp->description)
- Free (pp->description);
- if (pp->fault_alert.shcmd)
- Free (pp->fault_alert.shcmd);
-#if defined(CAN_DO_MODULES)
- if (pp->modules)
- freelist (pp->modules);
-#endif
- if (pp->printer_types)
- freelist (pp->printer_types);
- Free (pp);
-
- return;
-}
diff --git a/usr/src/cmd/lp/lib/printers/getpentry.c b/usr/src/cmd/lp/lib/printers/getpentry.c
deleted file mode 100644
index 8eeb753d52..0000000000
--- a/usr/src/cmd/lp/lib/printers/getpentry.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "printers.h"
-
-extern struct {
- char *v;
- short len,
- okremote;
-} prtrheadings[];
-
-/*
- * getpentry() - EXTRACT ONE PRINTER ENTRY FROM DISK FILE
- */
-
-char *
-getpentry(char *name, int want_fld)
-{
- static long lastdir = -1;
- char buf[BUFSIZ];
- int fld;
- int fd;
- register char * p;
- register char * path;
- int isNameAll;
- char * option_entry = NULL;
-
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (0);
- }
-
- /*
- * Getting ``all''? If so, jump into the directory
- * wherever we left off.
- */
- isNameAll = STREQU(NAME_ALL, name);
- for (; ; ) {
- /*
- * fix for bug 1117241
- * occasionally when a printer is removed, a printer directory
- * is left behind, but the CONFIGFILE is removed. In this
- * case this directory terminates the search for additional
- * printers as we have been returning 0 in this case.
- * Now, we loop back and try the next directory until
- * we have no more directories or we find a directory with
- * a CONFIGFILE
- */
- if (isNameAll) {
- if (!(name = next_dir(Lp_A_Printers, &lastdir)))
- return (0);
- } else
- lastdir = -1;
-
- /*
- * Get the printer configuration information.
- */
-
- path = getprinterfile(name, CONFIGFILE);
- if (!path) {
- if (isNameAll)
- Free(name);
- return (0);
- }
-
- if ((fd = open_locked(path, "r", 0)) < 0) {
- Free(path);
-
- /*
- * go around to loop again for
- * NAME_ALL case
- */
-
- if (!isNameAll) /* fix for bug 1117241 */
- return (0);
- else
- Free(name);
- }
- else
- break;
- }
- Free(path);
-
- /*
- * Read the file.
- */
- errno = 0;
- while (fdgets(buf, BUFSIZ, fd) != NULL) {
-
- buf[strlen(buf) - 1] = 0;
-
- for (fld = 0; fld < PR_MAX; fld++)
- if (prtrheadings[fld].v &&
- prtrheadings[fld].len &&
- STRNEQU(
- buf,
- prtrheadings[fld].v,
- prtrheadings[fld].len)) {
-
- p = buf + prtrheadings[fld].len;
- while (*p && *p == ' ')
- p++;
- break;
- }
-
- /*
- * To allow future extensions to not impact applications
- * using old versions of this routine, ignore strange
- * fields.
- */
- if (fld >= PR_MAX)
- continue;
-
- if (fld == want_fld) {
- if ((option_entry = strdup(p)) == NULL) {
- return (0);
- }
- }
-
-
- }
- if (errno != 0) {
- int save_errno = errno;
- close(fd);
- errno = save_errno;
- return (0);
- }
- close(fd);
-
- return (option_entry);
-}
diff --git a/usr/src/cmd/lp/lib/printers/getprinter.c b/usr/src/cmd/lp/lib/printers/getprinter.c
deleted file mode 100644
index 058d1ae2d7..0000000000
--- a/usr/src/cmd/lp/lib/printers/getprinter.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-#include <syslog.h>
-
-#include "lp.h"
-#include "printers.h"
-
-extern struct {
- char *v;
- short len,
- okremote;
-} prtrheadings[];
-
-/**
- ** getprinter() - EXTRACT PRINTER STRUCTURE FROM DISK FILE
- **/
-
-PRINTER *
-getprinter(char *name)
-{
- static long lastdir = -1;
-
- PRINTER *prp;
-
- char buf[BUFSIZ];
-
- short daisy;
-
- int fld;
-
- int fd;
-
- FALERT *pa;
-
- register char * p;
- register char ** pp;
- register char *** ppp;
- register char * path;
- int isNameAll;
-
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (0);
- }
-
- syslog(LOG_DEBUG, "getprinter(%s)", name ? name : "");
- /*
- * Getting ``all''? If so, jump into the directory
- * wherever we left off.
- */
- isNameAll = STREQU(NAME_ALL, name);
- for (; ; ) {
- /* fix for bug 1117241
- * occasionally when a printer is removed, a printer directory
- * is left behind, but the CONFIGFILE is removed. In this
- * case this directory terminates the search for additional
- * printers as we have been returning 0 in this case.
- * Now, we loop back and try the next directory until
- * we have no more directories or we find a directory with
- * a CONFIGFILE
- */
- if (isNameAll) {
- if (!(name = next_dir(Lp_A_Printers, &lastdir)))
- return (0);
- } else
- lastdir = -1;
-
- /*
- * Get the printer configuration information.
- */
-
- path = getprinterfile(name, CONFIGFILE);
- if (!path) {
- if (isNameAll)
- Free(name);
- return (0);
- }
-
- if ((fd = open_locked(path, "r", 0)) < 0) {
- Free(path); /*
- * go around to loop again for
- * NAME_ALL case
- */
-
- if (!isNameAll) /* fix for bug 1117241 */
- return(0);
- else
- Free(name);
- }
- else
- break;
- }
- Free (path);
-
- /*
- * Initialize the entire structure, to ensure no random
- * values get in it. However, make sure some values won't
- * be null or empty. Do the latter here as opposed to
- * after reading the file, because sometimes the file
- * contains an empty header to FORCE a null/empty value.
- */
- prp = calloc(sizeof (*prp), 1);
- prp->name = Strdup(name);
- if (isNameAll)
- Free(name);
- prp->printer_types = getlist(NAME_UNKNOWN, LP_WS, LP_SEP);
- prp->input_types = getlist(NAME_SIMPLE, LP_WS, LP_SEP);
-#if defined(CAN_DO_MODULES)
- prp->modules = getlist(NAME_DEFAULT, LP_WS, LP_SEP);
-#endif
-
- /*
- * Read the file.
- */
- errno = 0;
- while (fdgets(buf, BUFSIZ, fd) != NULL) {
-
- buf[strlen(buf) - 1] = 0;
-
- for (fld = 0; fld < PR_MAX; fld++)
- if (
- prtrheadings[fld].v
- && prtrheadings[fld].len
- && STRNEQU(
- buf,
- prtrheadings[fld].v,
- prtrheadings[fld].len
- )
- ) {
- p = buf + prtrheadings[fld].len;
- while (*p && *p == ' ')
- p++;
- break;
- }
-
- /*
- * To allow future extensions to not impact applications
- * using old versions of this routine, ignore strange
- * fields.
- */
- if (fld >= PR_MAX)
- continue;
-
- switch (fld) {
-
- case PR_BAN:
- if ((pp = getlist(p, LP_WS, ":"))) {
- if (pp[0] != NULL) {
- if (strcmp(pp[0], NAME_OPTIONAL) == 0)
- prp->banner = BAN_OPTIONAL;
- else if (strcmp(pp[0], NAME_OFF) == 0)
- prp->banner = BAN_NEVER;
- else if (strcmp(pp[0], NAME_ON) == 0)
- prp->banner = BAN_ALWAYS;
- else /* default to the LP default */
- prp->banner = BAN_ALWAYS;
- }
- if (pp[1] && CS_STREQU(pp[1], NAME_ALWAYS))
- prp->banner |= BAN_ALWAYS;
- freelist (pp);
- }
- break;
-
- case PR_LOGIN:
- prp->login = LOG_IN;
- break;
-
- case PR_CPI:
- prp->cpi = getcpi(p);
- break;
-
- case PR_LPI:
- prp->lpi = getsdn(p);
- break;
-
- case PR_LEN:
- prp->plen = getsdn(p);
- break;
-
- case PR_WIDTH:
- prp->pwid = getsdn(p);
- break;
-
- case PR_CS:
- ppp = &(prp->char_sets);
- goto CharStarStar;
-
- case PR_ITYPES:
- ppp = &(prp->input_types);
-CharStarStar: if (*ppp)
- freelist (*ppp);
- *ppp = getlist(p, LP_WS, LP_SEP);
- break;
-
- case PR_DEV:
- pp = &(prp->device);
- goto CharStar;
-
- case PR_DIAL:
- pp = &(prp->dial_info);
- goto CharStar;
-
- case PR_RECOV:
- pp = &(prp->fault_rec);
- goto CharStar;
-
- case PR_INTFC:
- pp = &(prp->interface);
- goto CharStar;
-
- case PR_PTYPE:
- ppp = &(prp->printer_types);
- goto CharStarStar;
-
- case PR_REMOTE:
- pp = &(prp->remote);
- goto CharStar;
-
- case PR_SPEED:
- pp = &(prp->speed);
- goto CharStar;
-
- case PR_STTY:
- pp = &(prp->stty);
-CharStar: if (*pp)
- Free (*pp);
- *pp = Strdup(p);
- break;
-
-#if defined(CAN_DO_MODULES)
- case PR_MODULES:
- ppp = &(prp->modules);
- goto CharStarStar;
-#endif
-
- case PR_OPTIONS:
- ppp = &(prp->options);
- goto CharStarStar;
- break;
-
- case PR_PPD:
- {
- pp = &(prp->ppd);
- goto CharStar;
- }
- }
-
- }
- if (errno != 0) {
- int save_errno = errno;
-
- freeprinter (prp);
- close(fd);
- errno = save_errno;
- return (0);
- }
- close(fd);
-
- /*
- * Get the printer description (if it exists).
- */
- if (!(path = getprinterfile(prp->name, COMMENTFILE)))
- return (0);
- if (!(prp->description = loadstring(path)) && errno != ENOENT) {
- Free (path);
- freeprinter (prp);
- return (0);
- }
- Free (path);
-
- /*
- * Get the information for the alert. Don't fail if we can't
- * read it because of access permission UNLESS we're "root"
- * or "lp"
- */
- if (!(pa = getalert(Lp_A_Printers, prp->name))) {
- if (
- errno != ENOENT
- && (
- errno != EACCES
- || !getpid() /* we be root */
- || STREQU(getname(), LPUSER) /* we be lp */
- )
- ) {
- freeprinter (prp);
- return (0);
- }
- } else
- prp->fault_alert = *pa;
-
- /*
- * Now go through the structure and see if we have
- * anything strange.
- */
- if (!okprinter(prp->name, prp, 0)) {
- freeprinter (prp);
- errno = EBADF;
- return (0);
- }
-
- /*
- * Just in case somebody tried to pull a fast one
- * by giving a printer type header by itself....
- */
- if (!prp->printer_types)
- prp->printer_types = getlist(NAME_UNKNOWN, LP_WS, LP_SEP);
-
- /*
- * If there are more than one printer type, then we can't
- * have any input types, except perhaps ``simple''.
- */
- if (
- lenlist(prp->printer_types) > 1
- && prp->input_types
- && (
- lenlist(prp->input_types) > 1
- || !STREQU(NAME_SIMPLE, *prp->input_types)
- )
- ) {
- freeprinter (prp);
- badprinter = BAD_ITYPES;
- errno = EBADF;
- return (0);
- }
-
- /*
- * If there are more than one printer types, none can
- * be ``unknown''.
- */
- if (
- lenlist(prp->printer_types) > 1
- && searchlist(NAME_UNKNOWN, prp->printer_types)
- ) {
- freeprinter (prp);
- badprinter = BAD_PTYPES;
- errno = EBADF;
- return (0);
- }
-
- /*
- * All the printer types had better agree on whether the
- * printer takes print wheels!
- */
- prp->daisy = -1;
- for (pp = prp->printer_types; *pp; pp++) {
- tidbit (*pp, "daisy", &daisy);
- if (daisy == -1)
- daisy = 0;
- if (prp->daisy == -1)
- prp->daisy = daisy;
- else if (prp->daisy != daisy) {
- freeprinter (prp);
- badprinter = BAD_DAISY;
- errno = EBADF;
- return (0);
- }
- }
-
- /*
- * Help out those who are still using the obsolete
- * "printer_type" member.
- */
- prp->printer_type = Strdup(*prp->printer_types);
-
- return (prp);
-}
diff --git a/usr/src/cmd/lp/lib/printers/llib-llpprt b/usr/src/cmd/lp/lib/printers/llib-llpprt
deleted file mode 100644
index f71ee5ff18..0000000000
--- a/usr/src/cmd/lp/lib/printers/llib-llpprt
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "../../include/lp.h"
-
-typedef struct PRINTER {
- char *name; /* name of printer (redundant) */
- unsigned short banner; /* banner page conditions */
- SCALED cpi; /* default character pitch */
- char **char_sets; /* list of okay char-sets/print-wheels */
- char **input_types; /* list of types acceptable to printer */
- char *device; /* printer port full path name */
- char *dial_info; /* system name or phone # for dial-up */
- char *fault_rec; /* printer fault recovery procedure */
- char *interface; /* interface program full path name */
- SCALED lpi; /* default line pitch */
- SCALED plen; /* default page length */
- unsigned short login; /* is/isn't a login terminal */
- char *printer_type; /* Terminfo look-up value (obsolete) */
- char *remote; /* remote machine!printer-name */
- char *speed; /* baud rate for connection */
- char *stty; /* space separated list of stty options */
- SCALED pwid; /* default page width */
- char *description; /* comment about printer */
- FALERT fault_alert; /* how to alert on printer fault */
- short daisy; /* 1/0 - printwheels/character-sets */
-#if defined(CAN_DO_MODULES)
- char **modules; /* streams modules to push */
-#endif
- char **printer_types; /* Terminfo look-up values */
- char **options; /* space separated list of undefined -o options */
-
- /*
- * Adding new members to this structure? Check out
- * cmd/lpadmin/do_printer.c, where we initialize
- * each new printer structure.
- */
-} PRINTER;
-
-typedef struct PWHEEL {
- char *name; /* name of print wheel */
- FALERT alert; /* how to alert when mount needed */
-} PWHEEL;
-
-extern unsigned long badprinter,
- ignprinter;
-PRINTER * getprinter ( char * );
-
-PWHEEL * getpwheel ( char * );
-
-char * getdefault ( void );
-
-int putprinter ( char *, PRINTER *);
-int delprinter ( char * );
-int putdefault ( char * );
-int deldefault ( void );
-int putpwheel ( char * , PWHEEL * );
-int delpwheel ( char * );
-int okprinter ( char * , PRINTER * , int );
-
-unsigned long chkprinter (char *, char *, char *, char *, char *, char *);
-
-void freeprinter ( PRINTER * );
-void freepwheel ( PWHEEL * );
-
-char * getpentry(char *, int);
-
-
diff --git a/usr/src/cmd/lp/lib/printers/okprinter.c b/usr/src/cmd/lp/lib/printers/okprinter.c
deleted file mode 100644
index 006bba00ab..0000000000
--- a/usr/src/cmd/lp/lib/printers/okprinter.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.19 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "sys/types.h"
-#include "stdlib.h"
-#include <unistd.h>
-
-#include "lp.h"
-#include "printers.h"
-
-unsigned long badprinter = 0;
-
-static int okinterface ( char * , PRINTER * );
-
-/**
- ** okprinter() - SEE IF PRINTER STRUCTURE IS SOUND
- **/
-
-int
-okprinter(char *name, PRINTER *prbufp, int isput)
-{
- badprinter = 0;
-
- /*
- * A printer can't be remote and have device, interface,
- * fault recovery, or alerts.
- */
- if (
- prbufp->remote
- && (
- prbufp->device
- || prbufp->interface
- || (
- prbufp->fault_alert.shcmd
- && !STREQU(NAME_NONE, prbufp->fault_alert.shcmd)
- )
-#if defined(CAN_DO_MODULES)
-# if defined(FIXED)
-/*
- * This needs some work...getprinter() initializes this to "default"
- */
- || (
- !emptylist(prbufp->modules)
- && !STREQU(NAME_NONE, prbufp->modules[0])
- )
-# endif
-#endif
- )
- )
- badprinter |= BAD_REMOTE;
-
- /*
- * A local printer must have an interface program. This is
- * for historical purposes (it let's someone know where the
- * interface program came from) AND is used by "putprinter()"
- * to copy the interface program. We must be able to read it.
- */
- if (!prbufp->remote && isput && !okinterface(name, prbufp))
- badprinter |= BAD_INTERFACE;
-
- /*
- * A local printer must have device or dial info.
- */
- if (!prbufp->remote && !prbufp->device && !prbufp->dial_info)
- badprinter |= BAD_DEVDIAL;
-
- /*
- * Fault recovery must be one of three kinds
- * (or default).
- */
- if (
- prbufp->fault_rec
- && !STREQU(prbufp->fault_rec, NAME_CONTINUE)
- && !STREQU(prbufp->fault_rec, NAME_BEGINNING)
- && !STREQU(prbufp->fault_rec, NAME_WAIT)
- )
- badprinter |= BAD_FAULT;
-
- /*
- * Alert command can't be reserved word.
- */
- if (
- prbufp->fault_alert.shcmd
- && (
- STREQU(prbufp->fault_alert.shcmd, NAME_QUIET)
- || STREQU(prbufp->fault_alert.shcmd, NAME_LIST)
- )
- )
- badprinter |= BAD_ALERT;
-
- return ((badprinter & ~ignprinter)? 0 : 1);
-}
-
-/**
- ** okinterface() - CHECK THAT THE INTERFACE PROGRAM IS OKAY
- **/
-
-static int
-canread(char *path)
-{
- return ((access(path, R_OK) < 0) ? 0 : 1);
-}
-
-static int
-okinterface(char *name, PRINTER *prbufp)
-{
- int ret;
-
- register char *path;
-
-
- if (prbufp->interface)
- ret = canread(prbufp->interface);
-
- else
- if (!(path = makepath(Lp_A_Interfaces, name, (char *)0)))
- ret = 0;
- else {
- ret = canread(path);
- Free (path);
- }
-
- return (ret);
-}
diff --git a/usr/src/cmd/lp/lib/printers/p_head.c b/usr/src/cmd/lp/lib/printers/p_head.c
deleted file mode 100644
index f7911435cc..0000000000
--- a/usr/src/cmd/lp/lib/printers/p_head.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-
-#include "lp.h"
-#include "printers.h"
-
-struct {
- char *v;
- short len,
- okremote;
-} prtrheadings[PR_MAX] = {
-
-#define ENTRY(X) X, sizeof(X)-1
-
- ENTRY("Banner:"), 0, /* PR_BAN */
- ENTRY("CPI:"), 0, /* PR_CPI */
- ENTRY("Character sets:"), 1, /* PR_CS */
- ENTRY("Content types:"), 1, /* PR_ITYPES */
- ENTRY("Device:"), 0, /* PR_DEV */
- ENTRY("Dial:"), 0, /* PR_DIAL */
- ENTRY("Fault:"), 0, /* PR_RECOV */
- ENTRY("Interface:"), 0, /* PR_INTFC */
- ENTRY("LPI:"), 0, /* PR_LPI */
- ENTRY("Length:"), 0, /* PR_LEN */
- ENTRY("Login:"), 0, /* PR_LOGIN */
- ENTRY("Printer type:"), 1, /* PR_PTYPE */
- ENTRY("Remote:"), 1, /* PR_REMOTE */
- ENTRY("Speed:"), 0, /* PR_SPEED */
- ENTRY("Stty:"), 0, /* PR_STTY */
- ENTRY("Width:"), 0, /* PR_WIDTH */
-#if defined(CAN_DO_MODULES)
- ENTRY("Modules:"), 0, /* PR_MODULES */
-#endif
- ENTRY("Options:"), 1, /* PR_OPTIONS */
- ENTRY("PPD:"), 0, /* PR_PPD */
-
-#undef ENTRY
-
-};
diff --git a/usr/src/cmd/lp/lib/printers/printwheels.c b/usr/src/cmd/lp/lib/printers/printwheels.c
deleted file mode 100644
index e553404fc4..0000000000
--- a/usr/src/cmd/lp/lib/printers/printwheels.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "printers.h"
-
-/**
- ** getpwheel() - GET PRINT WHEEL INFO FROM DISK
- **/
-
-PWHEEL *
-#if defined(__STDC__)
-getpwheel (
- char * name
-)
-#else
-getpwheel (name)
- char *name;
-#endif
-{
- static long lastdir = -1;
-
- PWHEEL *pwp;
-
- register FALERT *pa;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (0);
- }
-
- /*
- * Getting ``all''? If so, jump into the directory
- * wherever we left off.
- */
- if (STREQU(NAME_ALL, name)) {
- if (!(name = next_dir(Lp_A_PrintWheels, &lastdir)))
- return (0);
- } else
- lastdir = -1;
-
- /*
- * Get the information for the alert.
- */
- if (!(pa = getalert(Lp_A_PrintWheels, name))) {
-
- /*
- * Unless the world has turned weird, we shouldn't
- * get ENOTDIR if we're doing the ``all'' case--because
- * getting here in the all case meant the printwheel
- * directory exists, but ENOTDIR means it doesn't!
- */
- if (errno == ENOTDIR)
- errno = ENOENT; /* printwheel doesn't exist */
-
- return (0);
- }
-
- pwp = calloc(1, sizeof (*pwp));
- pwp->alert = *pa;
- pwp->name = Strdup(name);
-
- return (pwp);
-}
-
-/**
- ** putpwheel() - PUT PRINT WHEEL INFO TO DISK
- **/
-
-int
-#if defined(__STDC__)
-putpwheel (
- char * name,
- PWHEEL * pwheelp
-)
-#else
-putpwheel (name, pwheelp)
- char *name;
- PWHEEL *pwheelp;
-#endif
-{
- register char *path;
-
- struct stat statbuf;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(name, NAME_ALL)) {
- errno = ENOENT;
- return (-1);
- }
-
- /*
- * Create the parent directory for this printer
- * if it doesn't yet exist.
- */
- if (!(path = makepath(Lp_A_PrintWheels, name, (char *)0)))
- return (-1);
- if (Stat(path, &statbuf) == 0) {
- if (!S_ISDIR(statbuf.st_mode)) {
- Free (path);
- errno = ENOTDIR;
- return (-1);
- }
- } else if (errno != ENOENT || mkdir_lpdir(path, MODE_DIR) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- /*
- * Now write out the alert condition.
- */
- if (putalert(Lp_A_PrintWheels, name, &(pwheelp->alert)) == -1)
- return (-1);
-
- return (0);
-}
-
-/**
- ** delpwheel() - DELETE PRINT WHEEL INFO FROM DISK
- **/
-
-#if defined(__STDC__)
-static int _delpwheel ( char * );
-#else
-static int _delpwheel();
-#endif
-
-int
-#if defined(__STDC__)
-delpwheel (
- char * name
-)
-#else
-delpwheel (name)
- char *name;
-#endif
-{
- long lastdir;
-
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(NAME_ALL, name)) {
- lastdir = -1;
- while ((name = next_dir(Lp_A_PrintWheels, &lastdir)))
- if (_delpwheel(name) == -1)
- return (-1);
- return (0);
- } else
- return (_delpwheel(name));
-}
-
-/**
- ** _delpwheel()
- **/
-
-static int
-#if defined(__STDC__)
-_delpwheel (
- char * name
-)
-#else
-_delpwheel (name)
- char *name;
-#endif
-{
- register char *path;
-
- if (delalert(Lp_A_PrintWheels, name) == -1)
- return (-1);
- if (!(path = makepath(Lp_A_PrintWheels, name, (char *)0)))
- return (-1);
- if (Rmdir(path)) {
- Free (path);
- return (-1);
- }
- Free (path);
- return (0);
-}
-
-/**
- ** freepwheel() - FREE MEMORY ALLOCATED FOR PRINT WHEEL STRUCTURE
- **/
-
-void
-#if defined(__STDC__)
-freepwheel (
- PWHEEL * ppw
-)
-#else
-freepwheel (ppw)
- PWHEEL *ppw;
-#endif
-{
- if (!ppw)
- return;
- if (ppw->name)
- Free (ppw->name);
- if (ppw->alert.shcmd)
- Free (ppw->alert.shcmd);
- Free (ppw);
-
- return;
-}
diff --git a/usr/src/cmd/lp/lib/printers/putprinter.c b/usr/src/cmd/lp/lib/printers/putprinter.c
deleted file mode 100644
index f7214dfe65..0000000000
--- a/usr/src/cmd/lp/lib/printers/putprinter.c
+++ /dev/null
@@ -1,794 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "printers.h"
-
-#include <unistd.h>
-#include <sys/wait.h>
-
-#define SHELL "/bin/sh"
-#define PPDZIP ".gz"
-
-extern struct {
- char *v;
- short len,
- okremote;
-} prtrheadings[];
-
-#if defined(__STDC__)
-
-static void print_sdn (int, char *, SCALED);
-static void print_l (int, char *, char **);
-static void print_str (int, char *, char *);
-
-#ifdef LP_USE_PAPI_ATTR
-static int addPrintersPPD(char *name, PRINTER *prbufp);
-static int copyPPDFile(char *ppd, char *printersPPD);
-static int unzipPPDFile(char *ppd, char *printersPPD);
-#endif
-
-#else
-
-static void print_sdn(),
- print_l(),
- print_str();
-
-#ifdef LP_USE_PAPI_ATTR
-static int addPrintersPPD();
-static int copyPPDFile();
-static int unzipPPDFile();
-#endif
-
-#endif
-
-unsigned long ignprinter = 0;
-int ppdopt = 0;
-
-/**
- ** putprinter() - WRITE PRINTER STRUCTURE TO DISK FILES
- **/
-
-int
-putprinter(char *name, PRINTER *prbufp)
-{
- register char * path;
- register char * stty;
- register char * speed;
-
- int fdin, fdout;
-
- int fld;
-
- char buf[BUFSIZ];
-
- struct stat statbuf1,
- statbuf2;
-
-
- badprinter = 0;
-
- if (!name || !*name) {
- errno = EINVAL;
- return (-1);
- }
-
- if (STREQU(NAME_ALL, name)) {
- errno = EINVAL;
- return (-1);
- }
-
- /*
- * First go through the structure and see if we have
- * anything strange.
- */
- if (!okprinter(name, prbufp, 1)) {
- errno = EINVAL;
- return (-1);
- }
-
- if (!Lp_A_Printers || !Lp_A_Interfaces) {
- getadminpaths (LPUSER);
- if (!Lp_A_Printers || !Lp_A_Interfaces)
- return (0);
- }
-
- /*
- * Create the parent directory for this printer
- * if it doesn't yet exist.
- */
- if (!(path = getprinterfile(name, (char *)0)))
- return (-1);
- if (Stat(path, &statbuf1) == 0) {
- if (!S_ISDIR(statbuf1.st_mode)) {
- Free (path);
- errno = ENOTDIR;
- return (-1);
- }
- } else if (errno != ENOENT || mkdir_lpdir(path, MODE_DIR) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- /*
- * Create the copy of the interface program, unless
- * that would be silly or not desired.
- * Conversely, make sure the interface program doesn't
- * exist for a remote printer.
- */
- if (prbufp->remote) {
- if (!(path = makepath(Lp_A_Interfaces, name, (char *)0)))
- return (-1);
- (void)rmfile (path);
- Free (path);
- }
- if (prbufp->interface && (ignprinter & BAD_INTERFACE) == 0) {
- if (Stat(prbufp->interface, &statbuf1) == -1)
- return (-1);
- if (!(path = makepath(Lp_A_Interfaces, name, (char *)0)))
- return (-1);
- if (
- Stat(path, &statbuf2) == -1
- || statbuf1.st_dev != statbuf2.st_dev
- || statbuf1.st_ino != statbuf2.st_ino
- ) {
- register int n;
-
- if ((fdin = open_locked(prbufp->interface, "r", 0)) < 0) {
- Free (path);
- return (-1);
- }
- if ((fdout = open_locked(path, "w", MODE_EXEC)) < 0) {
- Free (path);
- close(fdin);
- return (-1);
- }
- while ((n = read(fdin, buf, BUFSIZ)) > 0)
- write (fdout, buf, n);
- close(fdout);
- close(fdin);
- }
- Free (path);
- }
-
-#ifdef LP_USE_PAPI_ATTR
- /*
- * Handle PPD (Postscript Printer Definition) file for printer
- * if this printer has been configured with one
- */
- if ((prbufp->ppd != NULL) && (ppdopt))
- {
- if (addPrintersPPD(name, prbufp) != 0)
- {
- /* failed to added the printers PPD file */
- return (-1);
- }
- }
-#endif
-
- /*
- * If this printer is dialed up, remove any baud rates
- * from the stty option list and move the last one to
- * the ".speed" member if the ".speed" member isn't already
- * set. Conversely, if this printer is directly connected,
- * move any value from the ".speed" member to the stty list.
- */
-
- stty = (prbufp->stty? Strdup(prbufp->stty) : 0);
- if (prbufp->speed)
- speed = Strdup(prbufp->speed);
- else
- speed = 0;
-
- if (prbufp->dial_info && stty) {
- register char *newstty,
- *p,
- *q;
-
- register int len;
-
- if (!(q = newstty = Malloc(strlen(stty) + 1))) {
- Free (stty);
- errno = ENOMEM;
- return (-1);
- }
- newstty[0] = 0; /* start with empty copy */
-
- for (
- p = strtok(stty, " ");
- p;
- p = strtok((char *)0, " ")
- ) {
- len = strlen(p);
- if (strspn(p, "0123456789") == len) {
- /*
- * If "prbufp->speed" isn't set, then
- * use the speed we just found. Don't
- * check "speed", because if more than
- * one speed was given in the list, we
- * want the last one.
- */
- if (!prbufp->speed) {
- if (speed)
- Free (speed);
- speed = Strdup(p);
- }
-
- } else {
- /*
- * Not a speed, so copy it to the
- * new stty string.
- */
- if (q != newstty)
- *q++ = ' ';
- strcpy (q, p);
- q += len;
- }
- }
-
- Free (stty);
- stty = newstty;
-
- } else if (!prbufp->dial_info && speed) {
- register char *newstty;
-
- newstty = Malloc(strlen(stty) + 1 + strlen(speed) + 1);
- if (!newstty) {
- if (stty)
- Free (stty);
- errno = ENOMEM;
- return (-1);
- }
-
- if (stty) {
- strcpy (newstty, stty);
- strcat (newstty, " ");
- strcat (newstty, speed);
- Free (stty);
- } else
- strcpy (newstty, speed);
- Free (speed);
- speed = 0;
-
- stty = newstty;
-
- }
-
- /*
- * Open the configuration file and write out the printer
- * configuration.
- */
-
- if (!(path = getprinterfile(name, CONFIGFILE))) {
- if (stty)
- Free (stty);
- if (speed)
- Free (speed);
- return (-1);
- }
- if ((fdout = open_locked(path, "w", MODE_READ)) < 0) {
- Free (path);
- if (stty)
- Free (stty);
- if (speed)
- Free (speed);
- return (-1);
- }
- Free (path);
-
- errno = 0;
- for (fld = 0; fld < PR_MAX; fld++) {
- if (prbufp->remote && !prtrheadings[fld].okremote)
- continue;
-
- switch (fld) {
-
-#define HEAD prtrheadings[fld].v
-
- case PR_BAN:
- {
- char *ptr = NAME_ON;
-
- switch (prbufp->banner) {
- case BAN_ALWAYS:
- ptr = NAME_ON;
- break;
- case BAN_NEVER:
- ptr = NAME_OFF;
- break;
- case BAN_OPTIONAL:
- ptr = NAME_OPTIONAL;
- break;
- }
- (void)fdprintf(fdout, "%s %s\n", HEAD, ptr);
- }
- break;
-
- case PR_CPI:
- print_sdn(fdout, HEAD, prbufp->cpi);
- break;
-
- case PR_CS:
- if (!emptylist(prbufp->char_sets))
- print_l(fdout, HEAD, prbufp->char_sets);
- break;
-
- case PR_ITYPES:
- /*
- * Put out the header even if the list is empty,
- * to distinguish no input types from the default.
- */
- print_l(fdout, HEAD, prbufp->input_types);
- break;
-
- case PR_DEV:
- print_str(fdout, HEAD, prbufp->device);
- break;
-
- case PR_DIAL:
- print_str(fdout, HEAD, prbufp->dial_info);
- break;
-
- case PR_RECOV:
- print_str(fdout, HEAD, prbufp->fault_rec);
- break;
-
- case PR_INTFC:
- print_str(fdout, HEAD, prbufp->interface);
- break;
-
- case PR_LPI:
- print_sdn(fdout, HEAD, prbufp->lpi);
- break;
-
- case PR_LEN:
- print_sdn(fdout, HEAD, prbufp->plen);
- break;
-
- case PR_LOGIN:
- if (prbufp->login & LOG_IN)
- (void)fdprintf(fdout, "%s\n", HEAD);
- break;
-
- case PR_PTYPE:
- {
- char **printer_types;
-
- /*
- * For backward compatibility for those who
- * use only "->printer_type", we have to play
- * some games here.
- */
- if (prbufp->printer_type && !prbufp->printer_types)
- printer_types = getlist(
- prbufp->printer_type,
- LP_WS,
- LP_SEP
- );
- else
- printer_types = prbufp->printer_types;
-
- if (!printer_types || !*printer_types)
- print_str(fdout, HEAD, NAME_UNKNOWN);
- else
- print_l(fdout, HEAD, printer_types);
-
- if (printer_types != prbufp->printer_types)
- freelist (printer_types);
- break;
- }
-
- case PR_REMOTE:
- print_str(fdout, HEAD, prbufp->remote);
- break;
-
- case PR_SPEED:
- print_str(fdout, HEAD, speed);
- break;
-
- case PR_STTY:
- print_str(fdout, HEAD, stty);
- break;
-
- case PR_WIDTH:
- print_sdn(fdout, HEAD, prbufp->pwid);
- break;
-
-#if defined(CAN_DO_MODULES)
- case PR_MODULES:
- /*
- * Put out the header even if the list is empty,
- * to distinguish no modules from the default.
- */
- print_l(fdout, HEAD, prbufp->modules);
- break;
-#endif
-
- case PR_OPTIONS:
- print_l(fdout, HEAD, prbufp->options);
- break;
-
- case PR_PPD:
- {
- print_str(fdout, HEAD, prbufp->ppd);
- break;
- }
- }
-
- }
- if (stty)
- Free (stty);
- if (speed)
- Free (speed);
- if (errno != 0) {
- close(fdout);
- return (-1);
- }
- close(fdout);
-
- /*
- * If we have a description of the printer,
- * write it out to a separate file.
- */
- if (prbufp->description) {
-
- if (!(path = getprinterfile(name, COMMENTFILE)))
- return (-1);
-
- if (dumpstring(path, prbufp->description) == -1) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- }
-
- /*
- * Now write out the alert condition.
- */
- if (
- prbufp->fault_alert.shcmd
- && putalert(Lp_A_Printers, name, &(prbufp->fault_alert)) == -1
- )
- return (-1);
-
- return (0);
-}
-
-/**
- ** print_sdn() - PRINT SCALED DECIMAL NUMBER WITH HEADER
- ** print_l() - PRINT (char **) LIST WITH HEADER
- ** print_str() - PRINT STRING WITH HEADER
- **/
-
-static void
-print_sdn(int fd, char *head, SCALED sdn)
-{
- if (sdn.val <= 0)
- return;
-
- (void)fdprintf (fd, "%s ", head);
- fdprintsdn (fd, sdn);
-
- return;
-}
-
-static void
-print_l(int fd, char *head, char **list)
-{
- (void)fdprintf (fd, "%s ", head);
- printlist_setup (0, 0, LP_SEP, 0);
- fdprintlist (fd, list);
- printlist_unsetup ();
-
- return;
-}
-
-static void
-print_str(int fd, char *head, char *str)
-{
- if (!str || !*str)
- return;
-
- (void)fdprintf (fd, "%s %s\n", head, str);
-
- return;
-}
-
-
-#ifdef LP_USE_PAPI_ATTR
-/*
- * Function: addPrintersPPD()
- *
- * Description: Handle PPD (Postscript Printer Definition) file for this
- * printer if it has been configured with one
- *
- */
-
-static int
-addPrintersPPD(char *name, PRINTER *prbufp)
-
-{
- int result = 0;
- char *path = NULL;
- char *ppd = NULL;
- char buf[BUFSIZ];
- struct stat statbuf;
-
- (void) snprintf(buf, sizeof (buf), "%s.ppd", name);
- if (prbufp->remote)
- {
- /* make sure the PPD file doesn't exist for a remote printer */
- if (!(path = makepath(ETCDIR, "ppd", buf, (char *)0)))
- {
- result = -1;
- }
- else
- {
- (void) rmfile(path);
- }
- }
-
- if ((result == 0) && (prbufp->ppd != NULL))
- {
- ppd = strdup(prbufp->ppd);
-
- if (ppd == NULL)
- {
- result = -1;
- }
- else
- {
- /* Check the PPD file given exists */
-
- if (Stat(ppd, &statbuf) == -1)
- {
- /*
- * The given ppd files does not exist, but
- * check if there is a zipped version of the
- * file that we can use instead
- */
- if (strstr(ppd, PPDZIP) != NULL)
- {
- /* this is a zipped file so exit */
- result = -1;
- }
- else
- {
- ppd = Realloc(ppd,
- strlen(ppd)+strlen(PPDZIP)+2);
- if (ppd != NULL)
- {
- ppd = strcat(ppd, PPDZIP);
- if (Stat(ppd, &statbuf) == -1)
- {
- /*
- * this zipped version
- * of the file does not
- * exist either
- */
- result = -1;
- }
- }
- else
- {
- result = -1;
- }
- }
- }
- }
-
- /*
- * Create the copy of the PPD file for this printer
- * unless that would be silly or not desired
- */
-
- if (result == 0)
- {
- if (!(path = makepath(ETCDIR, "ppd", buf, (char *)0)))
- {
- result = -1;
- }
- }
-
- /*
- * At this point we may have a zipped or unzipped ppd file, if
- * it's unzipped just copy it otherwise unzip it to the
- * printer's ppd file (/etc/lp/ppd/<printer>.ppd)
- */
-
- if (result == 0)
- {
- if (strstr(ppd, PPDZIP) == NULL)
- {
- result = copyPPDFile(ppd, path);
- }
- else
- {
- result = unzipPPDFile(ppd, path);
- }
-
- (void) chown_lppath(path);
- (void) chmod(path, 0644);
- }
-
- if (ppd != NULL)
- {
- Free(ppd);
- }
- if (path != NULL)
- {
- Free(path);
- }
- }
-
- return (result);
-} /* addPrintersPPD() */
-
-
-/*
- * Function: copyPPDFile()
- *
- * Description: Copy the given ppd file to the printer's file in /etc/lp/ppd
- *
- */
-
-static int
-copyPPDFile(char *ppd, char *printersPPD)
-
-{
- int result = 0;
- register int n = 0;
- int fdin = 0;
- int fdout = 0;
- char buf[BUFSIZ];
-
- if ((ppd != NULL) && (printersPPD != NULL))
- {
- if ((fdin = open_locked(ppd, "r", 0)) < 0)
- {
- result = -1;
- }
- else
- {
- fdout = open_locked(printersPPD, "w", MODE_EXEC);
- if (fdout < 0)
- {
- close(fdin);
- result = -1;
- }
- }
-
- if (result == 0)
- {
- while ((n = read(fdin, buf, BUFSIZ)) > 0)
- {
- write(fdout, buf, n);
- }
- close(fdout);
- close(fdin);
- }
- }
- else
- {
- result = -1;
- }
-
- return (result);
-} /* copyPPDFile() */
-
-
-
-/*
- * Function: unzipPPDFile()
- *
- * Description: Unzip the given ppd file to the printer's file in /etc/lp/ppd.
- * This is done by forking and running the unzip utility on the
- * zipped ppd file.
- *
- */
-
-static int
-unzipPPDFile(char *ppd, char *printersPPD)
-
-{
- int result = -1;
- char *cmdLine = NULL;
- pid_t childPID = 0;
- int stat = 0;
- int clSize = 0;
-
-
- if ((ppd != NULL) && (printersPPD != NULL))
- {
- childPID = fork();
-
- switch (childPID)
- {
- case -1:
- {
- /* return error */
- break;
- }
-
- case 0:
- {
- /* child process - so execute something */
-
- clSize = strlen("/usr/bin/rm -f ") +
- strlen(printersPPD) +
- strlen("/usr/bin/gzip -dc ") +
- strlen(ppd) +
- strlen(printersPPD) + 20;
- cmdLine = malloc(clSize);
- if (cmdLine != NULL)
- {
-
- (void) snprintf(cmdLine, clSize,
- "/usr/bin/rm -f %s; /usr/bin/gzip -dc %s > %s",
- printersPPD, ppd,
- printersPPD);
- result = execl(SHELL, SHELL, "-c",
- cmdLine, NULL);
- exit(result);
- }
- break;
- }
-
- default:
- {
- /* parent process, child pid is in childPID */
-
- while (wait(&stat) != childPID);
-
- if ((stat & 0xff00) == 0)
- {
- result = 0;
- }
- break;
- }
- }
- }
-
- return (result);
-} /* unzipPPDFile() */
-#endif
diff --git a/usr/src/cmd/lp/lib/requests/anyrequests.c b/usr/src/cmd/lp/lib/requests/anyrequests.c
deleted file mode 100644
index ec61529c54..0000000000
--- a/usr/src/cmd/lp/lib/requests/anyrequests.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-
-#include "lp.h"
-
-/**
- ** anyrequests() - SEE IF ANY REQUESTS ARE ``QUEUED''
- **/
-
-int
-#if defined(__STDC__)
-anyrequests (
- void
-)
-#else
-anyrequests ()
-#endif
-{
- long lastdir = -1;
-
- char * name;
-
-
- /*
- * This routine walks through the requests (secure)
- * directory looking for files, descending one level
- * into each sub-directory, if any. Finding at least
- * one file means that a request is queued.
- */
- while ((name = next_dir(Lp_Requests, &lastdir))) {
-
- long lastfile = -1;
-
- char * subdir;
-
-
- if (!(subdir = makepath(Lp_Requests, name, (char *)0)))
- return (1); /* err on safe side */
-
- if (next_file(subdir, &lastfile)) {
- Free (subdir);
- return (1);
- }
-
- Free (subdir);
- }
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/requests/freerequest.c b/usr/src/cmd/lp/lib/requests/freerequest.c
deleted file mode 100644
index cff15480ac..0000000000
--- a/usr/src/cmd/lp/lib/requests/freerequest.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "requests.h"
-
-/**
- ** freerequest() - FREE STRUCTURE ALLOCATED FOR A REQUEST STRUCTURE
- **/
-
-void
-#if defined(__STDC__)
-freerequest (
- REQUEST * reqbufp
-)
-#else
-freerequest (reqbufp)
- register REQUEST *reqbufp;
-#endif
-{
- if (!reqbufp)
- return;
- if (reqbufp->destination)
- Free (reqbufp->destination);
- if (reqbufp->file_list)
- freelist (reqbufp->file_list);
- if (reqbufp->form)
- Free (reqbufp->form);
- if (reqbufp->alert)
- Free (reqbufp->alert);
- if (reqbufp->options)
- Free (reqbufp->options);
- if (reqbufp->pages)
- Free (reqbufp->pages);
- if (reqbufp->charset)
- Free (reqbufp->charset);
- if (reqbufp->modes)
- Free (reqbufp->modes);
- if (reqbufp->title)
- Free (reqbufp->title);
- if (reqbufp->input_type)
- Free (reqbufp->input_type);
- if (reqbufp->user)
- Free (reqbufp->user);
- Free (reqbufp);
-
- return;
-}
diff --git a/usr/src/cmd/lp/lib/requests/getrequest.c b/usr/src/cmd/lp/lib/requests/getrequest.c
deleted file mode 100644
index 7aa5933395..0000000000
--- a/usr/src/cmd/lp/lib/requests/getrequest.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "requests.h"
-
-extern struct {
- char *v;
- short len;
-} reqheadings[];
-
-/**
- ** getrequest() - EXTRACT REQUEST STRUCTURE FROM DISK FILE
- **/
-
-REQUEST *
-#if defined(__STDC__)
-getrequest (
- char * file
-)
-#else
-getrequest (file)
- char *file;
-#endif
-{
- REQUEST *reqp;
-
- char buf[BUFSIZ],
- *path,
- *p;
-
- int fd;
-
- int fld;
-
-
- /*
- * Full pathname? If so the file must lie in LP's
- * regular temporary directory.
- */
- if (*file == '/') {
- if (!STRNEQU(file, Lp_Tmp, strlen(Lp_Tmp))) {
- errno = EINVAL;
- return (0);
- }
- path = Strdup(file);
-
- /*
- * A relative pathname (such as system/name)?
- * If so we'll locate it under LP's regular temporary
- * directory.
- */
- } else if (strchr(file, '/')) {
- if (!(path = makepath(Lp_Tmp, file, (char *)0)))
- return (0);
-
- /*
- * It must be a simple name. Locate this under the
- * special temporary directory that is linked to the
- * regular place for the local system.
- */
- } else if (!(path = makepath(Lp_Temp, file, (char *)0)))
- return (0);
-
-
- if ((fd = open_locked(path, "r", 0)) < 0) {
- Free (path);
- return (0);
- }
- Free (path);
-
- reqp = calloc(sizeof (*reqp), 1);
- reqp->copies = 1;
- reqp->priority = -1;
-
- errno = 0;
- while (fdgets(buf, BUFSIZ, fd)) {
-
- buf[strlen(buf) - 1] = 0;
-
- for (fld = 0; fld < RQ_MAX; fld++)
- if (
- reqheadings[fld].v
- && reqheadings[fld].len
- && STRNEQU(
- buf,
- reqheadings[fld].v,
- reqheadings[fld].len
- )
- ) {
- p = buf + reqheadings[fld].len;
- break;
- }
-
- /*
- * To allow future extensions to not impact applications
- * using old versions of this routine, ignore strange
- * fields.
- */
- if (fld >= RQ_MAX)
- continue;
-
- switch (fld) {
-
- case RQ_COPIES:
- reqp->copies = atoi(p);
- break;
-
- case RQ_DEST:
- reqp->destination = Strdup(p);
- break;
-
- case RQ_FILE:
- appendlist (&reqp->file_list, p);
- break;
-
- case RQ_FORM:
- if (!STREQU(p, NAME_ANY))
- reqp->form = Strdup(p);
- break;
-
- case RQ_HANDL:
- if (STREQU(p, NAME_RESUME))
- reqp->actions |= ACT_RESUME;
- else if (STREQU(p, NAME_HOLD))
- reqp->actions |= ACT_HOLD;
- else if (STREQU(p, NAME_IMMEDIATE))
- reqp->actions |= ACT_IMMEDIATE;
- break;
-
- case RQ_NOTIFY:
- if (STREQU(p, "M"))
- reqp->actions |= ACT_MAIL;
- else if (STREQU(p, "W"))
- reqp->actions |= ACT_WRITE;
- else if (STREQU(p, "N"))
- reqp->actions |= ACT_NOTIFY;
- else
- reqp->alert = Strdup(p);
- break;
-
- case RQ_OPTS:
- reqp->options = Strdup(p);
- break;
-
- case RQ_PRIOR:
- reqp->priority = atoi(p);
- break;
-
- case RQ_PAGES:
- reqp->pages = Strdup(p);
- break;
-
- case RQ_CHARS:
- if (!STREQU(p, NAME_ANY))
- reqp->charset = Strdup(p);
- break;
-
- case RQ_TITLE:
- reqp->title = Strdup(p);
- break;
-
- case RQ_MODES:
- reqp->modes = Strdup(p);
- break;
-
- case RQ_TYPE:
- reqp->input_type = Strdup(p);
- break;
-
- case RQ_USER:
- reqp->user = Strdup(p);
- break;
-
- case RQ_RAW:
- reqp->actions |= ACT_RAW;
- break;
-
- case RQ_FAST:
- reqp->actions |= ACT_FAST;
- break;
-
- case RQ_STAT:
- reqp->outcome = (ushort)strtol(p, (char **)0, 16);
- break;
-
- }
-
- }
- if (errno != 0) {
- int save_errno = errno;
-
- close(fd);
- errno = save_errno;
- return (0);
- }
- close(fd);
-
- /*
- * Now go through the structure and see if we have
- * anything strange.
- */
- if (
- reqp->copies <= 0
- || !reqp->file_list || !*(reqp->file_list)
- || reqp->priority < -1 || 39 < reqp->priority
- || STREQU(reqp->input_type, NAME_ANY)
- || STREQU(reqp->input_type, NAME_TERMINFO)
- ) {
- freerequest (reqp);
- errno = EBADF;
- return (0);
- }
-
- /*
- * Guarantee some return values won't be null or empty.
- */
- if (!reqp->destination || !*reqp->destination) {
- if (reqp->destination)
- Free (reqp->destination);
- reqp->destination = Strdup(NAME_ANY);
- }
- if (!reqp->input_type || !*reqp->input_type) {
- if (reqp->input_type)
- Free (reqp->input_type);
- reqp->input_type = Strdup(NAME_SIMPLE);
- }
-
- return (reqp);
-}
diff --git a/usr/src/cmd/lp/lib/requests/llib-llpreq b/usr/src/cmd/lp/lib/requests/llib-llpreq
deleted file mode 100644
index ec8a5f0250..0000000000
--- a/usr/src/cmd/lp/lib/requests/llib-llpreq
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-
-typedef struct REQUEST {
- short copies; /* number of copies of request to print */
- char *destination; /* printer or class name */
- char **file_list; /* list of files to print: req. content */
- char *form; /* preprinted form to print on */
- ushort actions; /* mail/write, immediate/hold/resume, raw */
- char *alert; /* program to run to alert user when done */
- char *options; /* print options; space separated list */
- short priority; /* priority level, 0-39, of the request */
- char *pages; /* list of pages to print (uniq. please!) */
- char *charset; /* character set to select or mount */
- char *modes; /* mode(s) of operation; space sep. list */
- char *title; /* optional title for banner page */
- char *input_type; /* type of content */
- char *user; /* user name of person submitting */
- ushort outcome; /* success/fauilure */
- ushort version; /* version of system sending job*/
-} REQUEST;
-
-REQUEST * getrequest ( char * );
-int putrequest ( char *, REQUEST * );
-void freerequest ( REQUEST * );
-
diff --git a/usr/src/cmd/lp/lib/requests/putrequest.c b/usr/src/cmd/lp/lib/requests/putrequest.c
deleted file mode 100644
index a426562057..0000000000
--- a/usr/src/cmd/lp/lib/requests/putrequest.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "stdio.h"
-#include "string.h"
-#include "errno.h"
-#include "sys/types.h"
-#include "sys/utsname.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "requests.h"
-
-extern struct {
- char *v;
- short len;
-} reqheadings[];
-
-/**
- ** putrequest() - WRITE REQUEST STRUCTURE TO DISK FILE
- **/
-
-int
-#if defined(__STDC__)
-putrequest (
- char * file,
- REQUEST * reqbufp
-)
-#else
-putrequest (file, reqbufp)
- char *file;
- REQUEST *reqbufp;
-#endif
-{
- char **pp,
- *path;
-
- int fd;
-
- int fld;
-
- /*
- * First go through the structure and see if we have
- * anything strange.
- */
- if (
- reqbufp->copies <= 0
- || !(reqbufp->destination)
- || !reqbufp->file_list || !*(reqbufp->file_list)
- || (reqbufp->actions & (ACT_MAIL|ACT_WRITE))
- && (reqbufp->alert && *(reqbufp->alert))
- || reqbufp->priority < -1 || 39 < reqbufp->priority
- ) {
- errno = EINVAL;
- return (-1);
- }
-
- /*
- * Now open the file and write out the request.
- */
-
- /*
- * Full pathname? If so the file must lie in LP's
- * regular temporary directory.
- */
- if (*file == '/') {
- if (!STRNEQU(file, Lp_Tmp, strlen(Lp_Tmp))) {
- errno = EINVAL;
- return (-1);
- }
- path = Strdup(file);
-
- /*
- * A relative pathname (such as system/name)?
- * If so we'll locate it under LP's regular temporary
- * directory.
- */
- } else if (strchr(file, '/')) {
- if (!(path = makepath(Lp_Tmp, file, (char *)0)))
- return (-1);
-
- /*
- * If must be a simple name. Locate this under the
- * special temporary directory that is linked to the
- * regular place for the local system.
- */
- } else if (!(path = makepath(Lp_Temp, file, (char *)0)))
- return (-1);
-
- if ((fd = open_locked(path, "w", MODE_NOREAD)) < 0) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- for (fld = 0; fld < RQ_MAX; fld++) switch (fld) {
-
-#define HEAD reqheadings[fld].v
-
- case RQ_COPIES:
- (void)fdprintf(fd, "%s%d\n", HEAD, reqbufp->copies);
- break;
-
- case RQ_DEST:
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->destination);
- break;
-
- case RQ_FILE:
- for (pp = reqbufp->file_list; *pp; pp++)
- (void)fdprintf(fd, "%s%s\n", HEAD, *pp);
- break;
-
- case RQ_FORM:
- if (reqbufp->form)
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->form);
- break;
-
- case RQ_HANDL:
- if ((reqbufp->actions & ACT_SPECIAL) == ACT_IMMEDIATE)
- (void)fdprintf(fd, "%s%s\n", HEAD, NAME_IMMEDIATE);
- else if ((reqbufp->actions & ACT_SPECIAL) == ACT_RESUME)
- (void)fdprintf(fd, "%s%s\n", HEAD, NAME_RESUME);
- else if ((reqbufp->actions & ACT_SPECIAL) == ACT_HOLD)
- (void)fdprintf(fd, "%s%s\n", HEAD, NAME_HOLD);
- break;
-
- case RQ_NOTIFY:
- if (reqbufp->actions & ACT_MAIL)
- (void)fdprintf(fd, "%sM\n", HEAD);
- else if (reqbufp->actions & ACT_WRITE)
- (void)fdprintf(fd, "%sW\n", HEAD);
- else if (reqbufp->actions & ACT_NOTIFY)
- (void)fdprintf(fd, "%sN\n", HEAD);
- else if (reqbufp->alert && *(reqbufp->alert))
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->alert);
- break;
-
- case RQ_OPTS:
- if (reqbufp->options)
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->options);
- break;
-
- case RQ_PRIOR:
- if (reqbufp->priority != -1)
- (void)fdprintf(fd, "%s%d\n", HEAD, reqbufp->priority);
- break;
-
- case RQ_PAGES:
- if (reqbufp->pages)
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->pages);
- break;
-
- case RQ_CHARS:
- if (reqbufp->charset)
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->charset);
- break;
-
- case RQ_TITLE:
- if (reqbufp->title)
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->title);
- break;
-
- case RQ_MODES:
- if (reqbufp->modes)
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->modes);
- break;
-
- case RQ_TYPE:
- if (reqbufp->input_type)
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->input_type);
- break;
-
- case RQ_USER:
- if (reqbufp->user)
- (void)fdprintf(fd, "%s%s\n", HEAD, reqbufp->user);
- break;
-
- case RQ_RAW:
- if (reqbufp->actions & ACT_RAW)
- (void)fdprintf(fd, "%s\n", HEAD);
- break;
-
- case RQ_FAST:
- if (reqbufp->actions & ACT_FAST)
- (void)fdprintf(fd, "%s\n", HEAD);
- break;
-
- case RQ_STAT:
- (void)fdprintf(fd, "%s%#6.4x\n", HEAD, reqbufp->outcome);
- break;
-
- }
-
- close(fd);
- return (0);
-}
diff --git a/usr/src/cmd/lp/lib/requests/r_head.c b/usr/src/cmd/lp/lib/requests/r_head.c
deleted file mode 100644
index 65b100be01..0000000000
--- a/usr/src/cmd/lp/lib/requests/r_head.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "sys/types.h"
-
-#include "lp.h"
-#include "requests.h"
-
-struct {
- char *v;
- short len;
-} reqheadings[RQ_MAX] = {
-
-#define ENTRY(X) X, sizeof(X)-1
-
- ENTRY("C "), /* RQ_COPIES */
- ENTRY("D "), /* RQ_DEST */
- ENTRY("F "), /* RQ_FILE */
- ENTRY("f "), /* RQ_FORM */
- ENTRY("H "), /* RQ_HANDL */
- ENTRY("N "), /* RQ_NOTIFY */
- ENTRY("O "), /* RQ_OPTS */
- ENTRY("P "), /* RQ_PRIOR */
- ENTRY("p "), /* RQ_PGES */
- ENTRY("S "), /* RQ_CHARS */
- ENTRY("T "), /* RQ_TITLE */
- ENTRY("Y "), /* RQ_MODES */
- ENTRY("t "), /* RQ_TYPE */
- ENTRY("U "), /* RQ_USER */
- ENTRY("r "), /* RQ_RAW */
- ENTRY("a "), /* RQ_FAST */
- ENTRY("s "), /* RQ_STAT */
- ENTRY("v "), /* RQ_VERSION */
-/* ENTRY("x "), */ /* reserved (slow filter) */
-/* ENTRY("y "), */ /* reserved (fast filter) */
-/* ENTRY("z "), */ /* reserved (printer name) */
-
-#undef ENTRY
-
-};
diff --git a/usr/src/cmd/lp/lib/secure/Makefile b/usr/src/cmd/lp/lib/secure/Makefile
deleted file mode 100644
index 5f1f8b3f9d..0000000000
--- a/usr/src/cmd/lp/lib/secure/Makefile
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/lib/secure/Makefile
-#
-
-LIBRARY = liblpsec.a
-
-OBJECTS = secure.o
-
-
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CPPFLAGS = -I../../include $(CPPFLAGS.master) $(C_PICFLAGS)
-
-POFILE = lp_lib_secure.po
-
-.KEEP_STATE:
-
-all install : $(LIBS)
-
-include ../../../../lib/Makefile.targ
-
-CLEANFILES += llib-llpsec.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-LINT_CPPFLAGS = -I../../include $(CPPFLAGS.master)
-
-lint: lintlib
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) $(SRCS)
-
-lintlib:
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) -o lpsec llib-llpsec
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/secure/llib-llpsec b/usr/src/cmd/lp/lib/secure/llib-llpsec
deleted file mode 100644
index 796719ea7a..0000000000
--- a/usr/src/cmd/lp/lib/secure/llib-llpsec
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "sys/types.h"
-
-typedef struct SECURE {
- uid_t uid;
- gid_t gid;
- off_t size;
- time_t date;
- char *system;
- char *user;
- char *req_id;
-} SECURE;
-
-
-SECURE * getsecure ( char * );
-int putsecure ( char *, SECURE * );
-int rmsecure (char *);
-void freesecure ( SECURE * );
-
diff --git a/usr/src/cmd/lp/lib/secure/secure.c b/usr/src/cmd/lp/lib/secure/secure.c
deleted file mode 100644
index ff9d583cda..0000000000
--- a/usr/src/cmd/lp/lib/secure/secure.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
-
-#include "string.h"
-#include "sys/param.h"
-#include "stdlib.h"
-
-#include "lp.h"
-#include "secure.h"
-#include <tsol/label.h>
-
-/**
- ** getsecure() - EXTRACT SECURE REQUEST STRUCTURE FROM DISK FILE
- **/
-
-SECURE *
-getsecure(char *file)
-{
- SECURE *secp;
-
- char buf[BUFSIZ],
- *path;
-
- int fd;
-
- int fld;
-
-
- if (*file == '/')
- path = Strdup(file);
- else
- path = makepath(Lp_Requests, file, (char *)0);
- if (!path)
- return (0);
-
- if ((fd = open_locked(path, "r", MODE_NOREAD)) < 0) {
- Free (path);
- return (0);
- }
- Free (path);
-
- secp = calloc(sizeof (*secp), 1);
-
- secp->user = 0;
- errno = 0;
- for (
- fld = 0;
- fld < SC_MAX && fdgets(buf, BUFSIZ, fd);
- fld++
- ) {
- buf[strlen(buf) - 1] = 0;
- switch (fld) {
-
- case SC_REQID:
- secp->req_id = Strdup(buf);
- break;
-
- case SC_UID:
- secp->uid = (uid_t)atol(buf);
- break;
-
- case SC_USER:
- secp->user = Strdup(buf);
- break;
-
- case SC_GID:
- secp->gid = (gid_t)atol(buf);
- break;
-
- case SC_SIZE:
- secp->size = (size_t)atol(buf);
- break;
-
- case SC_DATE:
- secp->date = (time_t)atol(buf);
- break;
-
- case SC_SLABEL:
- secp->slabel = Strdup(buf);
- break;
- }
- }
- if (errno != 0 || fld != SC_MAX) {
- int save_errno = errno;
-
- freesecure (secp);
- close(fd);
- errno = save_errno;
- return (0);
- }
- close(fd);
-
- /*
- * Now go through the structure and see if we have
- * anything strange.
- */
- if (
- secp->uid > MAXUID
- || !secp->user
- || secp->gid > MAXUID
- || secp->size == 0
- || secp->date <= 0
- ) {
- freesecure (secp);
- errno = EBADF;
- return (0);
- }
-
- return (secp);
-}
-
-/**
- ** putsecure() - WRITE SECURE REQUEST STRUCTURE TO DISK FILE
- **/
-
-int
-putsecure(char *file, SECURE *secbufp)
-{
- char *path;
-
- int fd;
-
- int fld;
-
- if (*file == '/')
- path = Strdup(file);
- else
- path = makepath(Lp_Requests, file, (char *)0);
- if (!path)
- return (-1);
-
- if ((fd = open_locked(path, "w", MODE_NOREAD)) < 0) {
- Free (path);
- return (-1);
- }
- Free (path);
-
- if (
- !secbufp->req_id ||
- !secbufp->user
- )
- return (-1);
-
- for (fld = 0; fld < SC_MAX; fld++)
-
- switch (fld) {
-
- case SC_REQID:
- (void)fdprintf(fd, "%s\n", secbufp->req_id);
- break;
-
- case SC_UID:
- (void)fdprintf(fd, "%u\n", secbufp->uid);
- break;
-
- case SC_USER:
- (void)fdprintf(fd, "%s\n", secbufp->user);
- break;
-
- case SC_GID:
- (void)fdprintf(fd, "%u\n", secbufp->gid);
- break;
-
- case SC_SIZE:
- (void)fdprintf(fd, "%lu\n", secbufp->size);
- break;
-
- case SC_DATE:
- (void)fdprintf(fd, "%ld\n", secbufp->date);
- break;
-
- case SC_SLABEL:
- if (secbufp->slabel == NULL) {
- if (is_system_labeled()) {
- m_label_t *sl;
-
- sl = m_label_alloc(MAC_LABEL);
- (void) getplabel(sl);
- if (label_to_str(sl, &(secbufp->slabel),
- M_INTERNAL, DEF_NAMES) != 0) {
- perror("label_to_str");
- secbufp->slabel =
- strdup("bad_label");
- }
- m_label_free(sl);
- (void) fdprintf(fd, "%s\n",
- secbufp->slabel);
- } else {
- (void) fdprintf(fd, "none\n");
- }
- } else {
- (void) fdprintf(fd, "%s\n", secbufp->slabel);
- }
- break;
- }
- close(fd);
-
- return (0);
-}
-
-/*
-** rmsecure ()
-**
-** o 'reqfilep' is of the form 'node-name/request-file'
-** e.g. 'sfcalv/123-0'.
-*/
-int
-rmsecure (char *reqfilep)
-{
- int n;
- char * pathp;
-
- pathp = makepath (Lp_Requests, reqfilep, (char *) 0);
- if (! pathp)
- return -1;
-
- n = Unlink (pathp);
- Free (pathp);
-
- return n;
-}
-
-/**
- ** freesecure() - FREE A SECURE STRUCTURE
- **/
-
-void
-freesecure(SECURE *secbufp)
-{
- if (!secbufp)
- return;
- if (secbufp->req_id)
- Free (secbufp->req_id);
- if (secbufp->user)
- Free (secbufp->user);
- Free (secbufp);
-
- return;
-}
diff --git a/usr/src/cmd/lp/lib/users/Makefile b/usr/src/cmd/lp/lib/users/Makefile
deleted file mode 100644
index b225c95c7e..0000000000
--- a/usr/src/cmd/lp/lib/users/Makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 1990-2003 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/lp/lib/users/Makefile
-#
-
-LIBRARY = liblpusr.a
-
-OBJECTS = usermgmt.o \
- loadpri.o \
- storepri.o
-
-
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-CPPFLAGS = -I../../include $(CPPFLAGS.master)
-
-POFILE = lp_lib_users.po
-
-.KEEP_STATE:
-
-all install : $(LIBS)
-
-include ../../../../lib/Makefile.targ
-
-CLEANFILES += llib-llpusr.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-
-lint: lintlib
- $(LINT.c) $(LINTFLAGS) $(SRCS)
-
-lintlib:
- $(LINT.c) $(LINTFLAGS) -o lpusr llib-llpusr
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/lib/users/llib-llpusr b/usr/src/cmd/lp/lib/users/llib-llpusr
deleted file mode 100644
index 86a18b8b1c..0000000000
--- a/usr/src/cmd/lp/lib/users/llib-llpusr
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdio.h"
-
-typedef struct
-{
- short priority_limit;
-}
-USER;
-
-int putuser ( char * , USER * );
-int deluser ( char * );
-int getdfltpri ( void );
-void trashusers ( void );
-
-USER * getuser ( char *);
-
-#define PRI_MAX 39
-#define PRI_MIN 0
-
-struct user_priority
-{
- short deflt; /* priority to use when not specified */
- short deflt_limit; /* priority limit for users not
- otherwise specified */
- char **users[PRI_MAX - PRI_MIN + 1];
-};
diff --git a/usr/src/cmd/lp/lib/users/loadpri.c b/usr/src/cmd/lp/lib/users/loadpri.c
deleted file mode 100644
index 0ade35eaa7..0000000000
--- a/usr/src/cmd/lp/lib/users/loadpri.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-# include <errno.h>
-# include <stdio.h>
-# include <stdlib.h>
-
-# include "lp.h"
-# include "users.h"
-
-static long pri;
-
-/*
- Input: Path name of the user priority file. It has the following
- format:
- 1 line with a number representing the default priority level.
- This must be the first line of the file, and no extra
- white space is allowed between the priority value and
- the newline.
- 1 line anywhere in the file with a number representing
- the default priority limit. This number is followed
- by a ':', and no extra white space is allowed.
- any number of lines with a number followed by a ':', followed
- by a white space (blank, tab or newline) separated
- list of user names. No white space is allowed
- between the priority value and the colon (:), but any
- amount is ok in the UID list.
-
- Note: If the default priority level is missing, a value of 20 will
- be used. If the default limit is missing, zero will be used.
- Also, the st_priority_file writes out the priority file in the
- same order as the fields occur in the user_priority structure,
- but the only order restriction is that the default level is
- the first this. A priority level may occur more than once, and
- this function will group them together (but the defaults may
- only occur once, however the defaults may occur only once each.
-
- Output: This function returns a pointer to a statically stored
- structure containing the priority information.
-
- Effect: The user priority file is read and parsed. Storage for
- the priorities are allocated and loaded. In case of an error,
- it prints out an error message, and returns 0 (NULL).
-*/
-
-struct user_priority * ld_priority_file ( char * path )
-{
- char line[BUFSIZ],
- *p,
- *user,
- *next_user();
- static struct user_priority pri_tbl;
- int line_no = 1,
- opri;
- int fd;
-
- if ((fd = open_locked(path, "r", 0)) < 0) {
- if (errno == ENOENT) {
-empty:
- pri_tbl.deflt = LEVEL_DFLT;
- pri_tbl.deflt_limit = LIMIT_DFLT;
- memset ((char *)pri_tbl.users, 0, sizeof(pri_tbl.users));
- return (&pri_tbl);
- }
- return(0);
- }
-
- /* initialize table to empty */
- pri_tbl.deflt = -1;
- pri_tbl.deflt_limit = -1;
- memset ((char *)pri_tbl.users, 0, sizeof(pri_tbl.users));
-
- /* this loop reads the line containing the default priority,
- if any, and the first priority limit. p is left pointing
- to the colon (:) in the line with the first limit. */
-
- while (1)
- {
- if (!(p = fdgets(line, BUFSIZ, fd)))
- goto empty;
- p = line;
- pri = strtol(line, &p, 10);
- if (p == line)
- goto Error;
- if (pri < PRI_MIN || pri > PRI_MAX)
- goto Error;
- if (line_no == 1 && *p == '\n' && !p[1])
- pri_tbl.deflt = pri;
- else
- if (*p == ':')
- {
- p++;
- break;
- }
- else
- goto Error;
- line_no++;
- }
-
- do
- {
- /* search list for this priority */
- opri = pri;
- if (!(user = next_user(fd, line, &p)))
- {
- if (pri_tbl.deflt_limit == -1)
- {
- pri_tbl.deflt_limit = opri;
- if (pri == -1) break;
- if (!(user = next_user(fd, line, &p))) goto Error;
- }
- else
- {
-Error:
- errno = EBADF;
- close(fd);
- return(0);
- }
- }
-
- do
- {
- add_user (&pri_tbl, user, pri);
- }
- while ((user = next_user(fd, line, &p)));
- }
- while (pri != -1);
-
- if (pri_tbl.deflt == -1)
- pri_tbl.deflt = LEVEL_DFLT;
-
- if (pri_tbl.deflt_limit == -1)
- pri_tbl.deflt_limit = LIMIT_DFLT;
-
- close(fd);
- return (&pri_tbl);
-}
-
-/*
-Inputs: A pointer to a limit structure, and a user.
-Ouputs: The limit structure is modified.
-Effects: Adds <user> to the list of users, if it is not already
- there.
-*/
-
-int add_user ( struct user_priority * ppri_tbl, char * user, int limit )
-{
- if (limit < PRI_MIN || PRI_MAX < limit)
- return 1;
- addlist (&(ppri_tbl->users[limit - PRI_MIN]), user);
- return 0;
-}
-
-/*
-Inputs: The input file to read additional lines, a pointer to
- a buffer containing the current line, and to read additional
- lines into, and a pointer to the location pointer (a pointer
- into buf).
-Outputs: The routine returns the next user-id read or 0 if all the
- users for this priority are read. The buffer, the location
- pointer, and the variable pri are modified as a side effect.
-Effects: The input buffer is scanned starting at *pp for the next
- user-id, if the end of the line is reached, the next line is
- read from the file. If it scans the next priority value, the
- variable pri (static to this file), is set to that priority.
- EOF is indicated by setting this variable to -1, and also
- returning 0.
-*/
-char * next_user (int fd, char * buf, char ** pp )
-{
- long temp;
- char *p;
- static int beg_line = 0; /* assumes a partial line is in buf to start */
-
- do
- {
- while (**pp == ' ' || **pp == '\n' || **pp == '\t')
- (*pp)++;
- p = *pp;
- if (*p)
- {
- if (*p >= '0' && *p <= '9')
- {
- temp = strtol(p, pp, 10);
- if (beg_line && **pp == ':')
- {
- (*pp)++;
- pri = temp;
- beg_line = 0;
- return (0);
- }
- }
-
- for (; **pp && **pp != ' ' && **pp != '\n' && **pp != '\t'; (*pp)++)
- ;
- if (**pp)
- *(*pp)++ = 0;
- beg_line = 0;
- return (p);
- }
- beg_line = 1;
- }
- while (*pp = fdgets(buf, BUFSIZ, fd));
-
- pri = -1;
- return (0);
-}
-
-/*
-Inputs: A pointer to a priority table and a user.
-Outputs: Zero if user found, else 1, and priority table is modified.
-Effects: All occurences of <user> in the priority table will be removed.
- (There should only be one at most.)
-*/
-int del_user ( struct user_priority * ppri_tbl, char * user )
-{
- int limit;
-
- for (limit = PRI_MIN; limit <= PRI_MAX; limit++)
- if (searchlist(user, ppri_tbl->users[limit - PRI_MIN]))
- {
- dellist (&(ppri_tbl->users[limit - PRI_MIN]), user);
- return (0);
- }
- return (1);
-}
diff --git a/usr/src/cmd/lp/lib/users/storepri.c b/usr/src/cmd/lp/lib/users/storepri.c
deleted file mode 100644
index 7356a88cd9..0000000000
--- a/usr/src/cmd/lp/lib/users/storepri.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-/* LINTLIBRARY */
-
-# include <stdio.h>
-
-# include "lp.h"
-# include "users.h"
-# include <locale.h>
-
-/*
-Inputs:
-Outputs:
-Effects:
-*/
-void
-print_tbl(struct user_priority * ppri_tbl)
-{
- int limit;
-
- printf(gettext("Default priority: %d\n"), ppri_tbl->deflt);
- printf(gettext("Priority limit for users not listed below: %d\n"), ppri_tbl->deflt_limit);
- printf(gettext("Priority Users\n"));
- printlist_setup ("", "", ",", "\n");
- for (limit = PRI_MIN; limit <= PRI_MAX; limit++) {
- if (ppri_tbl->users[limit - PRI_MIN])
- {
- printf(" %2d ", limit);
- fdprintlist(1, ppri_tbl->users[limit - PRI_MIN]);
- }
- }
-}
-
-/*
-Inputs:
-Outputs:
-Effects:
-*/
-void
-output_tbl(int fd, struct user_priority *ppri_tbl)
-{
- int limit;
-
- fdprintf(fd, "%d\n%d:\n", ppri_tbl->deflt, ppri_tbl->deflt_limit);
- printlist_setup (" ", "\n", "", "");
- for (limit = PRI_MIN; limit <= PRI_MAX; limit++)
- if (ppri_tbl->users[limit - PRI_MIN])
- {
- fdprintf(fd, "%d:", limit);
- fdprintlist(fd, ppri_tbl->users[limit - PRI_MIN]);
- }
-}
diff --git a/usr/src/cmd/lp/lib/users/usermgmt.c b/usr/src/cmd/lp/lib/users/usermgmt.c
deleted file mode 100644
index dfb2a9258e..0000000000
--- a/usr/src/cmd/lp/lib/users/usermgmt.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* LINTLIBRARY */
-
-# include <stdio.h>
-
-# include "lp.h"
-# include "users.h"
-
-static int loaded = 0;
-static struct user_priority *ppri_tbl;
-struct user_priority *ld_priority_file();
-static USER usr;
-
-int putuser ( char * user, USER * pri_s )
-{
- int fd;
-
- if (!loaded)
- {
- if (!(ppri_tbl = ld_priority_file(Lp_Users)))
- return(-1);
- loaded = 1;
- }
-
- if (!add_user(ppri_tbl, user, pri_s->priority_limit))
- {
- return(-1);
- }
-
- if ((fd = open_locked(Lp_Users, "w", LPU_MODE)) < 0)
- return(-1);
- output_tbl(fd, ppri_tbl);
- close(fd);
- return(0);
-}
-
-USER * getuser ( char * user )
-{
- int limit;
-
- /* root and lp do not get a limit */
- if (STREQU(user, "root") || STREQU(user, LPUSER))
- {
- usr.priority_limit = 0;
- return(&usr);
- }
-
- if (!loaded)
- {
- if (!(ppri_tbl = ld_priority_file(Lp_Users)))
- return((USER *)0);
-
- loaded = 1;
- }
-
- for (limit = PRI_MIN; limit <= PRI_MAX; limit++)
- if (bang_searchlist(user, ppri_tbl->users[limit - PRI_MIN]))
- {
- usr.priority_limit = limit;
- return(&usr);
- }
-
- usr.priority_limit = ppri_tbl->deflt_limit;
- return(&usr);
-}
-
-int deluser ( char * user )
-{
- int fd;
-
- if (!loaded)
- {
- if (!(ppri_tbl = ld_priority_file(Lp_Users)))
- return(-1);
-
- loaded = 1;
- }
-
- del_user(ppri_tbl, user);
-
- if ((fd = open_locked(Lp_Users, "w", LPU_MODE)) < 0)
- return(-1);
-
- output_tbl(fd, ppri_tbl);
- close(fd);
- return(0);
-}
-
-int getdfltpri ( void )
-{
- if (!loaded)
- {
- if (!(ppri_tbl = ld_priority_file(Lp_Users)))
- return(-1);
-
- loaded = 1;
- }
-
- return (ppri_tbl->deflt);
-}
-
-void
-trashusers(void)
-{
- int limit;
-
- if (loaded)
- {
- if (ppri_tbl)
- {
- for (limit = PRI_MIN; limit <= PRI_MAX; limit++)
- freelist (ppri_tbl->users[limit - PRI_MIN]);
- ppri_tbl = 0;
- }
- loaded = 0;
- }
-}
-
diff --git a/usr/src/cmd/lp/model/Makefile b/usr/src/cmd/lp/model/Makefile
deleted file mode 100644
index 5da2ee6539..0000000000
--- a/usr/src/cmd/lp/model/Makefile
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/model/Makefile
-#
-
-include ../Makefile.lp
-
-SUBDIRS = netpr
-
-PROG = lp.set \
- lp.cat \
- lp.tell \
- lp.tsol_separator \
- drain.output
-
-SRCS = $(PROG:%=%.c)
-
-OBJS = $(PROG:%=%.o)
-
-MODELS = standard \
- netstandard \
- tsol_standard \
- tsol_netstandard \
- tsol_standard_foomatic \
- tsol_netstandard_foomatic \
- uri
-
-MISC = alert.proto
-
-
-ROOTLIBLPMODEL= $(ROOTLIBLP)/model
-ROOTLIBLPBIN = $(ROOTLIBLP)/bin
-
-ROOTMISC = $(MISC:%=$(ROOTLIBLPBIN)/%)
-ROOTLPPROG = $(PROG:%=$(ROOTLIBLPBIN)/%)
-ROOTMODELS = $(MODELS:%=$(ROOTLIBLPMODEL)/%)
-
-CPPFLAGS = -I$(LPINC) $(CPPFLAGS.master)
-
-# conditional assignments
-lp.tell := LDLIBS += $(LIBMSG) $(LIBLP)
-lp.set drain.output lp.cat := LDLIBS += $(LIBLP) -lcurses
-lp.tsol_separator := LDLIBS += -ltsol
-
-$(ROOTMISC) := FILEMODE = 0444
-
-POFILE= lp_model.po
-POFILES= $(SRCS:%.c=%.po)
-
-.KEEP_STATE:
-
-all: $(PROG) $(MODELS) $(MISC) $(SUBDIRS)
-
-install: all .WAIT $(ROOTLPPROG) $(ROOTMODELS) $(ROOTMISC) \
- $(SUBDIRS)
-
-$(ROOTLIBLPMODEL)/% $(ROOTLIBLPBIN)/%: %
- $(INS.file)
-
-catalog: $(SUBDIRS) $(POFILE)
- $(CP) $(POFILE) ..
-
-clean: $(SUBDIRS)
- $(RM) $(OBJS)
-
-clobber: $(SUBDIRS) clean
- -$(RM) $(PROG) $(CLOBBERFILES)
-
-strip:
- $(STRIP) $(PROG)
-
-lint:
- $(LINT.c) $(SRCS) $(LDLIBS)
-
-$(SUBDIRS) : FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-include ../Makefile.lp.msg
-
-FRC:
diff --git a/usr/src/cmd/lp/model/alert.proto b/usr/src/cmd/lp/model/alert.proto
deleted file mode 100644
index 6c46f63adb..0000000000
--- a/usr/src/cmd/lp/model/alert.proto
+++ /dev/null
@@ -1,81 +0,0 @@
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Pardon the bizarre variable names, but we must not
-# conflict with any variables that the user gives us.
-#
-
--ENVIRONMENT-
-
-cd -PWD-
-
-if [ "`ulimit`" -gt -ULIMIT- ]
-then
- ulimit -ULIMIT-
-fi
-
-umask -UMASK-
-
-AlErT () {
- 2>&1 (
--CMD-
- ) <$1 1>${TmPsTdErR} || return 1
- return 0
-}
-
-TmPsTdErR=${TMPDIR:-/usr/tmp}/`/bin/uname -n`$$
-trap 'rm -f ${TmPsTdErR}; exit 0' 0 1 2 15
-
-while AlErT $1
-do
- if [ -INTERVAL- -le 0 ]
- then
- exit 0
- else
- TiCk=0
- while [ "${TiCk}" -lt -INTERVAL- ]
- do
- TiCk=`expr "${TiCk}" + 1`
- sleep 60
- done
- fi
-done
-
-ec=$?
-if [ "${ec}" -ne 0 ]
-then
- {
-
- echo "
-One of your print service alerts failed with exit code ${ec}.
-The standard output and standard error were:
- "
- cat ${TmPsTdErR}
- echo '
-
-The alert message is:
-'
- cat $1
-
- } | mailx -s 'Failed print service alert' -USER-
-fi
diff --git a/usr/src/cmd/lp/model/drain.output.c b/usr/src/cmd/lp/model/drain.output.c
deleted file mode 100644
index 6a11c4713c..0000000000
--- a/usr/src/cmd/lp/model/drain.output.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "termio.h"
-
-/*
- * The following macro computes the number of seconds to sleep
- * AFTER waiting for the system buffers to be drained.
- *
- * Various choices:
- *
- * - A percentage (perhaps even >100%) of the time it would
- * take to print the printer's buffer. Use this if it appears
- * the printers are affected if the port is closed before they
- * finish printing.
- *
- * - 0. Use this to avoid any extra sleep after waiting for the
- * system buffers to be flushed.
- *
- * - N > 0. Use this to have a fixed sleep after flushing the
- * system buffers.
- *
- * The sleep period can be overridden by a single command line argument.
- */
- /* 25% of the print-full-buffer time, plus 1 */
-#define LONG_ENOUGH(BUFSZ,CPS) (1 + ((250 * BUFSZ) / CPS) / 1000)
-
-extern int tidbit();
-
-/**
- ** main()
- **/
-
-int
-main(int argc, char *argv[])
-{
- extern char *getenv();
-
- short bufsz = -1,
- cps = -1;
-
- char *TERM;
-
- int sleep_time = 0;
-
-
- /*
- * Wait for the output to drain.
- */
- ioctl (1, TCSBRK, (struct termio *)1);
-
- /*
- * Decide how long to sleep.
- */
- if (argc != 2 || (sleep_time = atoi(argv[1])) < 0)
- if ((TERM = getenv("TERM"))) {
- tidbit (TERM, "bufsz", &bufsz);
- tidbit (TERM, "cps", &cps);
- if (cps > 0 && bufsz > 0)
- sleep_time = LONG_ENOUGH(bufsz, cps);
- } else
- sleep_time = 2;
-
- /*
- * Wait ``long enough'' for the printer to finish
- * printing what's in its buffer.
- */
- if (sleep_time)
- sleep (sleep_time);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/model/lp.cat.c b/usr/src/cmd/lp/model/lp.cat.c
deleted file mode 100644
index 29f14ad318..0000000000
--- a/usr/src/cmd/lp/model/lp.cat.c
+++ /dev/null
@@ -1,699 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <termio.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/times.h>
-#include <string.h>
-#include <limits.h>
-#include <sys/prnio.h>
-
-#include "lp.h"
-
-#include <locale.h>
-
-/*
- * Begin Sun Additions for Parallel ports
- */
-
-#include <string.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/ioccom.h>
-#include <sys/ioctl.h>
-
-#include <sys/bpp_io.h>
-#include <sys/ecppsys.h>
-#include <stropts.h>
-
-/*
- * the parameter structure for the parallel port
- */
-struct ppc_params_t {
- int flags; /* same as above */
- int state; /* status of the printer interface */
- int strobe_w; /* strobe width, in uS */
- int data_setup; /* data setup time, in uS */
- int ack_timeout; /* ACK timeout, in secs */
- int error_timeout; /* PAPER OUT, etc... timeout, in secs */
- int busy_timeout; /* BUSY timeout, in seconds */
-};
-
-
-
-static void printer_info(char *fmt, ...);
-
-/* These are the routines avaliable to others for use */
-int is_a_parallel_bpp(int);
-int bpp_state(int);
-int parallel_comm(int, int());
-int get_ecpp_status(int fd);
-int is_a_prnio(int);
-int prnio_state(int);
-
-#define PRINTER_ERROR_PAPER_OUT 1
-#define PRINTER_ERROR_OFFLINE 2
-#define PRINTER_ERROR_BUSY 3
-#define PRINTER_ERROR_ERROR 4
-#define PRINTER_ERROR_CABLE_POWER 5
-#define PRINTER_ERROR_UNKNOWN 6
-#define PRINTER_ERROR_TIMEOUT 7
-#define PRINTER_IO_ERROR 129
-
-
-/*
- * for BPP PARALLEL interfaces
- */
-
-int
-is_a_parallel_bpp(int fd)
-{
- if (ioctl(fd, BPPIOC_TESTIO) == 0 || errno == EIO)
- return (1);
- return (0);
-}
-
-
-#if defined(DEBUG) && defined(NOTDEF)
-char *
-BppState(int state)
-{
- static char buf[BUFSIZ];
-
- memset(buf, 0, sizeof (buf));
- sprintf(buf, "State (0x%.4x) - (%s%s%s%s)\n", state,
- ((state & BPP_SLCT_ERR) ? "offline " : ""),
- ((state & BPP_BUSY_ERR) ? "busy " : ""),
- ((state & BPP_PE_ERR) ? "paper " : ""),
- ((state & BPP_ERR_ERR) ? "error " : ""));
-
- return (buf);
-}
-#endif
-
-int
-bpp_state(int fd)
-{
- if (ioctl(fd, BPPIOC_TESTIO)) {
- struct bpp_error_status bpp_stat;
- int state;
-
- if (ioctl(fd, BPPIOC_GETERR, &bpp_stat) < 0)
- exit(PRINTER_IO_ERROR);
- state = bpp_stat.pin_status;
-
-#if defined(DEBUG) && defined(NOTDEF)
- logit("%s", BppState(state));
-#endif
-
- if (state == (BPP_PE_ERR | BPP_ERR_ERR | BPP_SLCT_ERR)) {
- /* paper is out */
- return (PRINTER_ERROR_PAPER_OUT);
- } else if (state & BPP_BUSY_ERR) {
- /* printer is busy */
- return (PRINTER_ERROR_BUSY);
- } else if (state & BPP_SLCT_ERR) {
- /* printer is offline */
- return (PRINTER_ERROR_OFFLINE);
- } else if (state & BPP_ERR_ERR) {
- /* printer is errored */
- return (PRINTER_ERROR_ERROR);
- } else if (state == BPP_PE_ERR) {
- /* printer is off/unplugged */
- return (PRINTER_ERROR_CABLE_POWER);
- } else if (state) {
- return (PRINTER_ERROR_UNKNOWN);
- } else
- return (0);
- }
- return (0);
-}
-
-/*
- * For ecpp parallel port
- */
-
-int
-get_ecpp_status(int fd)
-{
- int state;
- struct ecpp_transfer_parms transfer_parms;
-
-
- if (ioctl(fd, ECPPIOC_GETPARMS, &transfer_parms) == -1) {
- return (-1);
- }
-
- state = transfer_parms.mode;
- /*
- * We don't know what all printers will return in
- * nibble mode, therefore if we support nibble mode we will
- * force the printer to be in CENTRONICS mode.
- */
- if (state != ECPP_CENTRONICS) {
- transfer_parms.mode = ECPP_CENTRONICS;
- if (ioctl(fd, ECPPIOC_SETPARMS, &transfer_parms) == -1) {
- return (-1);
- } else {
- state = ECPP_CENTRONICS;
- }
- }
-
-
- return (state);
-}
-
-/*
- * For prnio(7I) - generic printer interface
- */
-int
-is_a_prnio(int fd)
-{
- uint_t cap;
-
- /* check if device supports prnio */
- if (ioctl(fd, PRNIOC_GET_IFCAP, &cap) == -1) {
- return (0);
- }
- /* we will use 1284 status if available */
- if ((cap & PRN_1284_STATUS) == 0) {
- /* some devices may only support 1284 status in unidir. mode */
- if (cap & PRN_BIDI) {
- cap &= ~PRN_BIDI;
- (void) ioctl(fd, PRNIOC_SET_IFCAP, &cap);
- }
- }
- return (1);
-}
-
-int
-prnio_state(int fd)
-{
- uint_t status;
- uchar_t pins;
-
- if ((ioctl(fd, PRNIOC_GET_STATUS, &status) == 0) &&
- (status & PRN_READY)) {
- return (0);
- }
-
- if (ioctl(fd, PRNIOC_GET_1284_STATUS, &pins) != 0) {
- return (PRINTER_ERROR_UNKNOWN);
- }
-
- if ((pins & ~PRN_1284_BUSY) == PRN_1284_PE) {
- /* paper is out */
- return (PRINTER_ERROR_PAPER_OUT);
- } else if (pins == (PRN_1284_PE | PRN_1284_SELECT |
- PRN_1284_NOFAULT | PRN_1284_BUSY)) {
- /* printer is off/unplugged */
- return (PRINTER_ERROR_CABLE_POWER);
- } else if ((pins & PRN_1284_SELECT) == 0) {
- /* printer is offline */
- return (PRINTER_ERROR_OFFLINE);
- } else if ((pins & PRN_1284_NOFAULT) == 0) {
- /* printer is errored */
- return (PRINTER_ERROR_ERROR);
- } else if (pins & PRN_1284_PE) {
- /* paper is out */
- return (PRINTER_ERROR_PAPER_OUT);
- } else if (pins ^ (PRN_1284_SELECT | PRN_1284_NOFAULT)) {
- return (PRINTER_ERROR_UNKNOWN);
- }
-
- return (0);
-}
-
-/*
- * Common routines
- */
-
-/*ARGSUSED0*/
-static void
-ByeByeParallel(int sig)
-{
- /* try to shove out the EOT */
- (void) write(1, "\004", 1);
- exit(0);
-}
-
-
-/*ARGSUSED0*/
-static void
-printer_info(char *fmt, ...)
-{
- char mesg[BUFSIZ];
- va_list ap;
-
- va_start(ap, fmt);
- vsprintf(mesg, fmt, ap);
- va_end(ap);
-/*
- * fprintf(stderr,
- * "%%%%[ PrinterError: %s; source: parallel ]%%%%\n",
- * mesg);
- */
- fprintf(stderr, "%s\n", mesg);
- fflush(stderr);
- fsync(2);
-
-}
-
-static void
-printer_error(int error)
-{
- switch (error) {
- case -1:
- printer_info("ioctl(): %s", strerror(errno));
- break;
- case PRINTER_ERROR_PAPER_OUT:
- printer_info("out of paper");
- break;
- case PRINTER_ERROR_OFFLINE:
- printer_info("offline");
- break;
- case PRINTER_ERROR_BUSY:
- printer_info("busy");
- break;
- case PRINTER_ERROR_ERROR:
- printer_info("printer error");
- break;
- case PRINTER_ERROR_CABLE_POWER:
- printer_info("printer powered off or disconnected");
- break;
- case PRINTER_ERROR_UNKNOWN:
- printer_info("unknown error");
- break;
- case PRINTER_ERROR_TIMEOUT:
- printer_info("communications timeout");
- break;
- default:
- printer_info("get_status() failed");
- }
-}
-
-
-static void
-wait_state(int fd, int get_state())
-{
- int state;
- int was_faulted = 0;
-
- while (state = get_state(fd)) {
- was_faulted = 1;
- printer_error(state);
- sleep(15);
- }
-
- if (was_faulted) {
- fprintf(stderr, "printer ok\n");
- fflush(stderr);
- fsync(2);
- }
-}
-
-/*
- * end of Sun Additions for parallel port
- */
-#define IDENTICAL(A, B) (A.st_dev == B.st_dev && A.st_ino == B.st_ino)
-#define ISBLK(A) ((A.st_mode & S_IFMT) == S_IFBLK)
-#define ISCHR(A) ((A.st_mode & S_IFMT) == S_IFCHR)
-
-#define E_SUCCESS 0
-#define E_BAD_INPUT 1
-#define E_BAD_OUTPUT 2
-#define E_BAD_TERM 3
-#define E_IDENTICAL 4
-#define E_WRITE_FAILED 5
-#define E_TIMEOUT 6
-#define E_HANGUP 7
-#define E_INTERRUPT 8
-
-#define SAFETY_FACTOR 2.0
-#define R(F) (int)((F) + .5)
-#define DELAY(N, D) R(SAFETY_FACTOR * ((N) / (double)(D)))
-
-char buffer[BUFSIZ];
-
-void sighup(),
- sigint(),
- sigquit(),
- sigpipe(),
- sigalrm(),
- sigterm();
-
-#if defined(baudrate)
-#undef baudrate
-#endif
-
-int baudrate();
-
-
-int
-nop(int fd)
-{
- return (0);
-}
-
-int bpp_state(int);
-
-
-/*
- * main()
- */
-
-int
-main(int argc, char *argv[])
-{
- int nin, nout, effective_rate, max_delay = 0, n;
- int report_rate;
- short print_rate;
- struct stat in, out;
- struct tms tms;
- long epoch_start, epoch_end;
- char *TERM;
- int (*func)(int fd);
-
- /*
- * The Spooler can hit us with SIGTERM for three reasons:
- *
- * - the user's job has been canceled
- * - the printer has been disabled while we were printing
- * - the Spooler heard that the printer has a fault,
- * and the fault recovery is wait or beginning
- *
- * We should exit cleanly for the first two cases,
- * but we have to be careful with the last. If it was THIS
- * PROGRAM that told the Spooler about the fault, we must
- * exit consistently.
- *
- * The method of avoiding any problem is to turn off the
- * trapping of SIGTERM before telling the Spooler about
- * the fault.
- *
- * Faults that we can detect:
- * - hangup (drop of carrier)
- * - interrupt (printer sent a break or quit character)
- * - SIGPIPE (output port is a FIFO, and was closed early)
- * - failed or incomplete write()
- * - excess delay in write() (handled with SIGALRM later)
- *
- * Pseudo-faults (errors in use):
- * - No input/output, or strange input/output
- * - Input/output identical
- * - No TERM defined or trouble reading Terminfo database
- */
- signal(SIGTERM, sigterm);
- signal(SIGHUP, sighup);
- signal(SIGINT, sigint);
- signal(SIGQUIT, sigint);
- signal(SIGPIPE, sigpipe);
-
-
- if (argc > 1 && STREQU(argv[1], "-r")) {
- report_rate = 1;
- argc--;
- argv++;
- } else
- report_rate = 0;
-
- (void) setlocale(LC_ALL, "");
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- /*
- * Stat the standard output to be sure it is defined.
- */
- if (fstat(1, &out) < 0) {
- signal(SIGTERM, SIG_IGN);
- fprintf(stderr, gettext("Can't stat output "
- "(%s);\nincorrect use of lp.cat!\n"), PERROR);
- exit(E_BAD_OUTPUT);
- }
-
- /*
- * Stat the standard input to be sure it is defined.
- */
- if (fstat(0, &in) < 0) {
- signal(SIGTERM, SIG_IGN);
- fprintf(stderr, gettext("Can't stat input "
- "(%s);\nincorrect use of lp.cat!\n"), PERROR);
- exit(E_BAD_INPUT);
- }
-
- /*
- * If the standard output is not a character special file or a
- * block special file, make sure it is not identical to the
- * standard input.
- *
- * If we are an ecpp parallel port in centronics mode treat
- * ourselves as a bpp compatible device.
- */
-
- if (is_a_prnio(1)) {
- func = prnio_state;
- } else if (is_a_parallel_bpp(1) ||
- (get_ecpp_status(1) == ECPP_CENTRONICS)) {
- func = bpp_state;
- } else if (isatty(1)) {
- /* serial connection (probably) - continue as usual */
- func = nop;
- } else {
- func = nop;
- }
-
- if (!ISCHR(out) && !ISBLK(out) && IDENTICAL(out, in)) {
- signal(SIGTERM, SIG_IGN);
- fprintf(stderr, gettext("Input and output are identical; "
- "incorrect use of lp.cat!\n"));
- exit(E_IDENTICAL);
- }
-
- /*
- * The effective data transfer rate is the lesser
- * of the transmission rate and print rate. If an
- * argument was passed to us, it should be a data
- * rate and it may be lower still.
- * Based on the effective data transfer rate,
- * we can predict the maximum delay we should experience.
- * But there are other factors that could introduce
- * delay, so let's be generous; after all, we'd rather
- * err in favor of waiting too long to detect a fault
- * than err too often on false alarms.
- */
-
- if (!(TERM = getenv("TERM")) || !*TERM) {
- signal(SIGTERM, SIG_IGN);
- fprintf(stderr, gettext("No TERM variable defined! "
- "Trouble with the Spooler!\n"));
- exit(E_BAD_TERM);
- }
- if (!STREQU(TERM, NAME_UNKNOWN) &&
- tidbit(TERM, "cps", &print_rate) == -1) {
- signal(SIGTERM, SIG_IGN);
- fprintf(stderr, gettext("Trouble identifying printer "
- "type \"%s\"; check the Terminfo database.\n"), TERM);
- exit(E_BAD_TERM);
- }
- if (STREQU(TERM, NAME_UNKNOWN))
- print_rate = -1;
-
- effective_rate = baudrate() / 10; /* okay for most bauds */
- if (print_rate != -1 && print_rate < effective_rate)
- effective_rate = print_rate;
- if (argc > 1 && (n = atoi(argv[1])) >= 0 && n < effective_rate)
- effective_rate = n; /* 0 means infinite delay */
- if (effective_rate)
- max_delay = DELAY(BUFSIZ, effective_rate);
-
- /*
- * We'll use the "alarm()" system call to keep us from
- * waiting too long to write to a printer in trouble.
- */
- if (max_delay)
- signal(SIGALRM, sigalrm);
-
- /*
- * While not end of standard input, copy blocks to
- * standard output.
- */
- while ((nin = read(0, buffer, BUFSIZ)) > 0) {
- char *ptr = buffer;
-
- /*
- * We should be safe from incomplete writes to a full
- * pipe, as long as the size of the buffer we write is
- * a even divisor of the pipe buffer limit. As long as
- * we read from files or pipes (not communication devices)
- * this should be true for all but the last buffer. The
- * last will be smaller, and won't straddle the pipe max
- * limit (think about it).
- */
-#if PIPE_BUF < BUFSIZ || (PIPE_MAX % BUFSIZ)
- this_wont_compile;
-#endif
- if (report_rate)
- epoch_start = times(&tms);
- do {
- wait_state(1, func);
-
- if (max_delay)
- alarm(max_delay);
- nout = write(1, ptr, nin);
- alarm(0);
- if (nout < 0) {
- fprintf(stderr, gettext("Write failed "
- "(%s);\nperhaps the printer has gone "
- "off-line.\n"), PERROR);
- fflush(stderr);
- if (errno != EINTR)
- /* I/O error on device, get lpcshed to retry */
- exit(PRINTER_IO_ERROR);
- else /* wait for printer to come back online */
- sleep(15);
- } else {
- nin -= nout;
- ptr += nout;
- }
- } while (nin > 0);
-
- if (max_delay)
- alarm(0);
- else if (report_rate) {
- epoch_end = times(&tms);
- if (epoch_end - epoch_start > 0)
- fprintf(stderr, "%d CPS\n",
- R((100 * BUFSIZ) /
- (double)(epoch_end - epoch_start)));
- }
-
- }
-
- return (E_SUCCESS);
-}
-
-/*
- * sighup() - CATCH A HANGUP (LOSS OF CARRIER)
- */
-void
-sighup()
-{
- signal(SIGTERM, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
- fprintf(stderr, gettext(HANGUP_FAULT_LPCAT));
- exit(E_HANGUP);
-}
-
-/*
- * sigint() - CATCH AN INTERRUPT
- */
-void
-sigint()
-{
- signal(SIGTERM, SIG_IGN);
- signal(SIGINT, SIG_IGN);
- fprintf(stderr, gettext(INTERRUPT_FAULT));
- exit(E_INTERRUPT);
-}
-
-/*
- * sigpipe() - CATCH EARLY CLOSE OF PIPE
- */
-void
-sigpipe()
-{
- signal(SIGTERM, SIG_IGN);
- signal(SIGPIPE, SIG_IGN);
- fprintf(stderr, gettext(PIPE_FAULT));
- exit(E_INTERRUPT);
-}
-
-/*
- * sigalrm() - CATCH AN ALARM
- */
-void
-sigalrm()
-{
- signal(SIGTERM, SIG_IGN);
- fprintf(stderr, gettext("Excessive write delay; "
- "perhaps the printer has gone off-line.\n"));
- exit(E_TIMEOUT);
-}
-
-/*
- * sigterm() - CATCH A TERMINATION SIGNAL
- */
-void
-sigterm()
-{
- signal(SIGTERM, SIG_IGN);
- /*
- * try to flush the output queue in the case of ecpp port.
- * ignore the return code as this may not be the ecpp.
- */
- ioctl(1, I_FLUSH, FLUSHW);
- exit(E_SUCCESS);
-}
-
-/*
- * baudrate() - RETURN BAUD RATE OF OUTPUT LINE
- */
-
-static int baud_convert[] =
-{
- 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200,
- 1800, 2400, 4800, 9600, 19200, 38400, 57600,
- 76800, 115200, 153600, 230400, 307200, 460800, 921600
-};
-
-int
-baudrate()
-{
- struct termio tm;
- struct termios tms;
- int speed;
-
- if (ioctl(1, TCGETS, &tms) < 0) {
- if (ioctl(1, TCGETA, &tm) < 0)
- return (1200);
- else
- speed = tm.c_cflag&CBAUD;
- } else
- speed = cfgetospeed(&tms);
-
- return (speed ? baud_convert[speed] : 1200);
-}
diff --git a/usr/src/cmd/lp/model/lp.set.c b/usr/src/cmd/lp/model/lp.set.c
deleted file mode 100644
index e2748a0890..0000000000
--- a/usr/src/cmd/lp/model/lp.set.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdio.h"
-
-#include "lp.h"
-#include "lp.set.h"
-
-extern char *getenv();
-
-/**
- ** main()
- **/
-
-int
-main(int argc, char *argv[])
-{
- static char not_set[10] = "H V W L S";
-
- int exit_code;
-
- char *TERM = getenv("TERM");
-
-
- if (!TERM || !*TERM || tidbit(TERM, (char *)0) == -1)
- exit (1);
-
- /*
- * Very simple calling sequence:
- *
- * lpset horz-pitch vert-pitch width length char-set
- *
- * The first four can be scaled with 'i' (inches) or
- * 'c' (centimeters). A pitch scaled with 'i' is same
- * as an unscaled pitch.
- * Blank arguments will skip the corresponding setting.
- */
- if (argc != 6)
- exit (1);
-
- exit_code = 0;
-
- if (argv[1][0]) {
- switch (set_pitch(argv[1], 'H', 1)) {
- case E_SUCCESS:
- not_set[0] = ' ';
- break;
- case E_FAILURE:
- break;
- default:
- exit_code = 1;
- break;
- }
- } else
- not_set[0] = ' ';
-
- if (argv[2][0]) {
- switch (set_pitch(argv[2], 'V', 1)) {
- case E_SUCCESS:
- not_set[2] = ' ';
- break;
- case E_FAILURE:
- break;
- default:
- exit_code = 1;
- break;
- }
- } else
- not_set[2] = ' ';
-
- if (argv[3][0]) {
- switch (set_size(argv[3], 'W', 1)) {
- case E_SUCCESS:
- not_set[4] = ' ';
- break;
- case E_FAILURE:
- break;
- default:
- exit_code = 1;
- break;
- }
- } else
- not_set[4] = ' ';
-
- if (argv[4][0]) {
- switch (set_size(argv[4], 'L', 1)) {
- case E_SUCCESS:
- not_set[6] = ' ';
- break;
- case E_FAILURE:
- break;
- default:
- exit_code = 1;
- break;
- }
- } else
- not_set[6] = ' ';
-
- if (argv[5][0]) {
- switch (set_charset(argv[5], 1, TERM)) {
- case E_SUCCESS:
- not_set[8] = ' ';
- break;
- case E_FAILURE:
- break;
- default:
- exit_code = 1;
- break;
- }
- } else
- not_set[8] = ' ';
-
- fprintf (stderr, "%s\n", not_set);
-
- return (exit_code);
-}
diff --git a/usr/src/cmd/lp/model/lp.tell.c b/usr/src/cmd/lp/model/lp.tell.c
deleted file mode 100644
index e58eb968b2..0000000000
--- a/usr/src/cmd/lp/model/lp.tell.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "signal.h"
-#include "stdio.h"
-#include "errno.h"
-
-#include "lp.h"
-#include "msgs.h"
-#include "string.h"
-
-void startup(),
- cleanup(),
- done();
-
-extern char *getenv(),
- *malloc(),
- *realloc();
-
-extern long atol();
-
-extern int atoi();
-
-static void wakeup();
-extern char *optarg;
-extern int optind, opterr, optopt;
-int optsw;
-
-#define PREFIX_STRING "%%["
-#define SUFFIX_STRING "]%%"
-#define PRINTER_ERROR_STRING "PrinterError:"
-#define STATUS_STRING "status:"
-#define JOB_STRING "job:"
-#define STATUS_OK_STRING "ready and printing"
-#define PAPER_CHANGED_STRING "paper changed:"
-
-/*
- * Some common postscript printer fault messages.
- * These strings are here so that they get l10ned and then lpstat will
- * be able to display them in the users language.
- * This seemed like a good place for them, since lp.tell knows about
- * postscript msgs.
- */
-
-char *ps_m1 = "unable to print: out of media (paper)";
-char *ps_m2 = "out of media (paper)";
-char *ps_m3 = "unable to print: tray not (properly) installed";
-char *ps_m4 = "tray not (properly) installed";
-char *ps_m5 = "unable to print: paper out for the selected tray";
-char *ps_m6 = "paper out for the selected tray";
-char *ps_m7 = "unable to print: cartridge life expiring";
-char *ps_m8 = "cartridge life expiring";
-char *ps_m9 = "unable to print: printer cover not locked";
-char *ps_m10 = "printer cover not locked";
-char *ps_m11 = "unable to print: media (paper) jam in exit path";
-char *ps_m12 = "media (paper) jam in exit path";
-char *ps_m13 = "unable to print: media (paper) jam in feed path";
-char *ps_m14 = "media (paper) jam in feed path";
-char *ps_m15 = "unable to print: drum assembly almost expended";
-char *ps_m16 = "drum assembly almost expended";
-char *ps_m17 = "unable to print: toner cartridge almost expended";
-char *ps_m18 = "toner cartridge almost expended";
-char *ps_m19 = "unable to print: drum assembly not (properly) installed";
-char *ps_m20 = "drum assembly not (properly) installed";
-char *ps_m21 = "unable to print: toner cartridge not (properly) installed";
-char *ps_m22 = "toner cartridge not (properly) installed";
-char *ps_m23 = "unable to print: drum assembly requires replacement";
-char *ps_m24 = "drum assembly requires replacement";
-char *ps_m25 = "unable to print: toner cartridge requires replacement";
-char *ps_m26 = "toner cartridge requires replacement";
-char *ps_m27 = "unable to print: fuser warming up";
-char *ps_m28 = "fuser warming up";
-char *ps_m29 = "unable to print: printer not responding";
-char *ps_m30 = "printer not responding";
-char *ps_m31 = "unable to print: fuser pausing";
-char *ps_m32 = "fuser pausing";
-char *ps_m33 = "unable to print: printer turned off";
-char *ps_m34 = "printer turned off";
-char *ps_m35 = "unable to print: printer warming up";
-char *ps_m36 = "printer warming up";
-char *ps_m37 = "unable to print: interlock open";
-char *ps_m38 = "interlock open";
-char *ps_m39 = "unable to print: selected tray out";
-char *ps_m40 = "selected tray out";
-char *ps_m41 = "unable to print: paper out for the manual tray";
-char *ps_m42 = "paper out for the manual tray";
-char *ps_m43 = "unable to print: paper exit jam";
-char *ps_m44 = "paper exit jam";
-char *ps_m45 = "unable to print: paper misfeed jam";
-char *ps_m46 = "paper misfeed jam";
-char *ps_m47 = "unable to print: paper jam between registration & heat rollers";
-char *ps_m48 = "paper jam between registration & heat rollers";
-char *ps_m49 = "unable to print: paper jam at registration roller";
-char *ps_m50 = "paper jam at registration roller";
-char *ps_m51 = "unable to print: no cartridge";
-char *ps_m52 = "no cartridge";
-char *ps_m53 = "unable to print: cartridge out";
-char *ps_m54 = "cartridge out";
-
-/**
- ** main()
- **/
-
-int
-main(int argc, char *argv[])
-{
- char *alert_text,
- buf[BUFSIZ],
- msgbuf[MSGMAX],
- *bufPtr,
- *printer,
- *s_key;
-
- char *printerErrorString = NULL;
- char *statusString = NULL;
- char *paperChangedString = NULL;
- char *suffixString = NULL;
- char *jobString = NULL;
- char *prefixString = NULL;
- char *statusOkString = NULL;
- int mtype,
- doStdOut,
- doDebug,
- first,
- oldalarm;
-
-
- short status;
-
- long key,clearKey;
- char *ptr1,*ptr2,*ptr3,*ptr4,*ptr5;
- int trayNum = 0;
- int mode = 0;
- int pagesPrinted = 0;
- char *paperType = NULL;
- short mesgRetType;
- int useLaserWriterMessages;
- int pLen,sLen,peLen,jLen,pcLen ;
-
- void (*oldsignal)();
-
-
- /*
- * Run immune from typical interruptions, so that
- * we stand a chance to get the fault message.
- * EOF (or startup error) is the only way out.
- */
- signal (SIGHUP, SIG_IGN);
- signal (SIGINT, SIG_IGN);
- signal (SIGQUIT, SIG_IGN);
- signal (SIGTERM, SIG_IGN);
-
- /*
- * Do we have a key?
- */
- if (
- argc < 2
- || !(s_key = getenv("SPOOLER_KEY"))
- || !*s_key
- || (key = atol(s_key)) <= 0
- ) {
- printf( "Usage: lptell [-lodk] [-X String] printer\n");
- printf("Options (where X is P,S,e,s, O or c )\n");
- printf(" environment variable SPOOLER_KEY: must be defined and > 0\n");
- printf(" printer: name of printer to give status for.\n");
- printf(" -l: expect laser writer type messages (NeWSprint does)\n");
- printf(" -o: send input to stdout\n");
- printf(" -d: send additional debugging output to stdout\n");
- printf(" -P String: string for prefix, default: '%%%%['\n");
- printf(" -S String: string for suffix, default: ']%%%%'\n");
- printf(" -e String: string to detect printer error,\n");
- printf(" default: 'PrinterError:', send S_SEND_FAULT to lpsched\n");
- printf(
- " -c String: string to detect paper change in context of printer error,\n");
- printf(" default: 'paper changed:', send S_PAPER_CHANGED to lpsched\n");
- printf(" -s String: string to detect printer ok status, \n");
- printf(" default: 'status:', send S_CLEAR_FAULT to lpsched\n");
- printf(" -k: do not use the key for making status ok\n");
- printf(" -O String: string sent as status message to lpsched,\n");
- printf(" default: 'ready and printing:'\n");
- exit (90);
- }
-
-
- doStdOut = 0;
- doDebug = 0;
- useLaserWriterMessages = 0;
- clearKey = key;
-
- prefixString = PREFIX_STRING; pLen = strlen(prefixString);
- suffixString = SUFFIX_STRING;
- printerErrorString = PRINTER_ERROR_STRING;
- peLen = strlen(printerErrorString);
- statusString = STATUS_STRING; sLen = strlen(statusString);
- jobString = JOB_STRING; jLen = strlen(jobString);
- paperChangedString = PAPER_CHANGED_STRING;
- pcLen = strlen(paperChangedString);
- statusOkString = STATUS_OK_STRING;
-
- while ((optsw = getopt(argc, argv, "le:s:c:okdO:S:P:")) != EOF) {
- switch ( optsw ) {
- case 'l':
- useLaserWriterMessages = 1;
- break;
- case 'P':
- prefixString = (optarg ? strdup(optarg) : NULL);
- pLen = strlen(prefixString );
- break;
- case 'S':
- suffixString = (optarg ? strdup(optarg) : NULL);
- break;
- case 'e':
- printerErrorString = (optarg ? strdup(optarg) : NULL);
- peLen = strlen(printerErrorString);
- break;
- case 's':
- statusString = (optarg ? strdup(optarg) : NULL);
- sLen = strlen(statusString);
- break;
- case 'O':
- statusOkString = (optarg ? strdup(optarg) : NULL);
- break;
- case 'c':
- paperChangedString = (optarg ? strdup(optarg) : NULL);
- pcLen = strlen(paperChangedString );
- break;
- case 'k':
- clearKey = -1;
- break;
- case 'o':
- doStdOut = 1;
- break;
- case 'd':
- doDebug = 1;
- break;
- }
- }
- /*
- * Which printer is this? Do we have a key?
- */
- if (
- !(printer = argv[optind])
- || !*printer
- ) {
- exit (90);
- }
- if (doDebug) {
- printf( "start lp.tell for %s key %d mode %s %s\n",
- printer,key,(useLaserWriterMessages ? "LW" : "standard"),
- (doStdOut ? "doStdOut" : "no output"));
- printf( "prefix (%s) suffix (%s) printerError (%s)\n",
- prefixString,suffixString,printerErrorString);
- printf( "paper_changed (%s) status (%s) key %d \n",
- paperChangedString,statusString , clearKey);
- fflush(stdout);
- }
- /*
- * Wait for a message on the standard input. When a single line
- * comes in, take a couple of more seconds to get any other lines
- * that may be ready, then send them to the Spooler.
- */
- while (fgets(buf, BUFSIZ, stdin)) {
- if (useLaserWriterMessages) {
- /* NeWSprint style processing (which simulates the LaserWriter
- *There are four types of messages:
- * 1) fault messages: printer error message from handler
- * 2) clear fault messages: printer ok messages from handler
- * 3) paper changed messages: printer handler detected paper change
- * 4) server messages: xnews problems
- */
- bufPtr = buf;
- if (strncmp(prefixString, bufPtr, pLen) == 0) {
- bufPtr += pLen;
- while (*bufPtr == ' ')
- bufPtr++;
-
- if (strncmp(printerErrorString, bufPtr,
- peLen) == 0) {
- bufPtr += peLen;
- while (*bufPtr == ' ')
- bufPtr++;
-
- if ((strncmp(bufPtr,paperChangedString,pcLen) == 0) &&
- (ptr1 = bufPtr +pcLen) &&
- (ptr2 = strchr(ptr1+1,':')) &&
- (ptr3 = strchr(ptr2+1,':')) &&
- (ptr4 = strchr(ptr3+1,':')) &&
- (ptr5 = strchr(ptr4+1,'\n'))) {
- if (doStdOut) printf("%s",buf);
- *ptr2 =0;
- *ptr3= 0;
- *ptr4= 0;
- *ptr5= 0;
- trayNum = atoi(ptr1+1);
- paperType = ptr2+1;
- mode = atoi(ptr3+1);
- pagesPrinted = atoi(ptr4+1);
- if (doDebug) {
- printf("Paper changed: %s tray %d paper %s md %d pages %d\n",
- printer,trayNum,paperType,mode,pagesPrinted);
- }
- startup ();
- mesgRetType = R_PAPER_CHANGED;
- (void)putmessage ( msgbuf, S_PAPER_CHANGED, printer, trayNum,
- paperType, mode, pagesPrinted);
- } else {
- if (doStdOut) printf("%s",buf);
- if (ptr1 = strstr(bufPtr,suffixString)) *ptr1 = 0;
- if ( doDebug ) {
- printf("Send fault: %s key %d (%s)\n",printer,key,bufPtr);
- }
- mesgRetType = R_SEND_FAULT;
- startup ();
- (void)putmessage (msgbuf,S_SEND_FAULT,printer,key,bufPtr);
- }
- } else if ((first = (strncmp(statusString,bufPtr,sLen) == 0)) ||
- (strncmp(jobString,bufPtr,jLen) == 0)) {
- bufPtr += (first ? sLen : jLen);
- if (doStdOut) printf("%s",buf);
- if (ptr1 = strstr(bufPtr,suffixString)) *ptr1 = 0;
- if ( doDebug ) {
- printf("Clear fault: %s key %d (%s)\n",printer, clearKey,
- bufPtr);
- }
- mesgRetType = R_CLEAR_FAULT;
- startup ();
- (void)putmessage( msgbuf,S_CLEAR_FAULT,printer,clearKey,
- statusOkString);
- } else {
- if (doStdOut) printf("%s",buf);
- if (ptr1 = strstr(bufPtr,suffixString)) *ptr1 = 0;
- if ( doDebug ) {
- printf("Server error: %s key %d (%s)\n",printer,key,
- buf);
- }
- mesgRetType = 0;
- }
- } else {
- if (doStdOut) printf("%s",buf);
- if (ptr1 = strstr(bufPtr,suffixString))
- *ptr1 = 0;
- if (doDebug) {
- printf("Server error: %s key %d (%s)\n",
- printer, key, buf);
- }
- mesgRetType = 0;
- }
- } else { /* not generic PostScript style messages */
- oldsignal = signal(SIGALRM, wakeup);
- oldalarm = alarm(2);
-
- alert_text = 0;
- do {
- if (alert_text)
- alert_text = realloc(alert_text,
- strlen(alert_text)+strlen(buf)+1
- );
- else {
- alert_text = malloc(strlen(buf) + 1);
- alert_text[0] = 0;
- }
- strcat (alert_text, buf);
-
- } while (fgets(buf, BUFSIZ, stdin));
-
- alarm (oldalarm);
- signal (SIGALRM, oldsignal);
-
- if (doStdOut) {
- if ( doDebug ) {
- printf("Send generic fault: %s key %d (%s)\n",printer,key,
- alert_text);
- }
- else {
- printf("%s\n",alert_text);
- }
- }
- if (strcmp(alert_text, "printer ok\n") == 0) {
- mesgRetType = R_CLEAR_FAULT;
- startup ();
- (void)putmessage(msgbuf, S_CLEAR_FAULT, printer,
- clearKey, statusOkString);
- } else {
- mesgRetType = R_SEND_FAULT;
- startup ();
- (void)putmessage(msgbuf, S_SEND_FAULT, printer,
- key, alert_text);
- }
- }
-
- if (mesgRetType) {
- if (msend(msgbuf) == -1)
- done (91);
- if (mrecv(msgbuf, sizeof(msgbuf)) == -1)
- done (92);
- mtype = getmessage(msgbuf, mesgRetType, &status);
- /*
- * check for R_CLEAR_FAULT here and 3 lines below
- * because older lpsched doesn't pass S_CLEAR_FAULT
- */
- if ((mtype != mesgRetType) &&
- (mesgRetType != R_CLEAR_FAULT))
- done (93);
-
- if ((status != MOK) && (mesgRetType != R_CLEAR_FAULT))
- done (94);
- }
-
- }
- done (0);
-
- return (0);
-}
-
-/**
- ** startup() - OPEN MESSAGE QUEUE TO SPOOLER
- ** cleanup() - CLOSE THE MESSAGE QUEUE TO THE SPOOLER
- **/
-
-static int have_contacted_spooler = 0;
-
-void startup ()
-{
- void catch();
-
- /*
- * Open a message queue to the Spooler.
- * An error is deadly.
- */
- if (!have_contacted_spooler) {
- if (mopen() == -1) {
-
- switch (errno) {
- case ENOMEM:
- case ENOSPC:
- break;
- default:
- break;
- }
-
- exit (1);
- }
- have_contacted_spooler = 1;
- }
- return;
-}
-
-void cleanup ()
-{
- if (have_contacted_spooler)
- mclose ();
- return;
-}
-
-/**
- ** wakeup() - TRAP ALARM
- **/
-
-static void wakeup ()
-{
- return;
-}
-
-/**
- ** done() - CLEANUP AND EXIT
- **/
-
-void done (ec)
- int ec;
-{
- cleanup ();
- exit (ec);
-}
diff --git a/usr/src/cmd/lp/model/lp.tsol_separator.c b/usr/src/cmd/lp/model/lp.tsol_separator.c
deleted file mode 100644
index a7ea55a154..0000000000
--- a/usr/src/cmd/lp/model/lp.tsol_separator.c
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Add TSOL banner, trailer, page header/footers to a print job
- */
-
-/* system header files */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <limits.h>
-#include <errno.h>
-#include <signal.h>
-#include <locale.h>
-#include <tsol/label.h>
-
-/* typedefs */
-
-typedef int BOOL;
-
-/* constants */
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#define ME "lp.tsol_separator"
-#define POSTSCRIPTLIB "/usr/lib/lp/postscript"
-#define SEPARATORPS "tsol_separator.ps"
-#define BANNERPS "tsol_banner.ps"
-#define TRAILERPS "tsol_trailer.ps"
-#define MAXUSERLEN 32
-#define MAXHOSTLEN 32
-
-/* external variables */
-
-int optind; /* Used by getopt */
-char *optarg; /* Used by getopt */
-
-/* prototypes for static functions */
-
-static int ProcessArgs(int argc, char **argv);
-static void Usage(void);
-static void ParseUsername(char *input, char *user, char *host);
-static void EmitPSFile(const char *name);
-static BOOL EmitFile(FILE *file);
-static void EmitJobData(void);
-static void EmitPrologue(void);
-static void EmitCommandLineInfo(void);
-static void EmitClockBasedInfo(void);
-static void EmitLabelInfo(void);
-static void CopyStdin(void);
-
-/* static variables */
-
-static char *ArgSeparatorPS;
-static char *ArgBannerPS;
-static char *ArgTrailerPS;
-static char *ArgPSLib;
-static char *ArgPrinter;
-static char *ArgJobID;
-static char *ArgUser;
-static char *ArgTitle;
-static char *ArgFile;
-static BOOL ArgReverse;
-static BOOL ArgNoPageLabels;
-static int ArgDebugLevel;
-static FILE *ArgLogFile;
-static m_label_t *FileLabel;
-static char *remoteLabel;
-
-int
-main(int argc, char *argv[])
-{
- int err;
- /*
- * Run immune from typical interruptions, so that
- * we stand a chance to get the fault message.
- * EOF (or startup error) is the only way out.
- */
- (void) signal(SIGHUP, SIG_IGN);
- (void) signal(SIGINT, SIG_IGN);
- (void) signal(SIGQUIT, SIG_IGN);
- (void) signal(SIGTERM, SIG_IGN);
-
- (void) setlocale(LC_ALL, "");
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- if (ProcessArgs(argc, argv) != 0)
- exit(1);
-
- if ((FileLabel = m_label_alloc(MAC_LABEL)) == NULL)
- exit(1);
- /*
- * If the job was submitted via remotely, the label of the
- * remote peer will be set in the SLABEL environment variable
- * by copying it out of the SECURE structure.
- *
- * If there is no SLABEL value, the job was submitted locally
- * via the named pipe, and the file label can be determined
- * from its pathname.
- */
- if ((remoteLabel = getenv("SLABEL")) != NULL) {
- m_label_free(FileLabel);
- FileLabel = NULL;
- if (str_to_label(remoteLabel, &FileLabel, MAC_LABEL,
- L_NO_CORRECTION, &err) == -1) {
- perror("str_to_label");
- exit(1);
- }
- } else if (getlabel(ArgFile, FileLabel) != 0) {
- (void) fprintf(ArgLogFile,
- gettext("%1$s: cannot get label of %2$s: %3$s\n"),
- ME, ArgFile, strerror(errno));
- exit(1);
- }
-
- /* All of these functions exit if they encounter an error */
- EmitJobData();
- EmitPSFile(ArgSeparatorPS);
- if (ArgReverse)
- EmitPSFile(ArgTrailerPS);
- else
- EmitPSFile(ArgBannerPS);
- CopyStdin();
- if (ArgReverse)
- EmitPSFile(ArgBannerPS);
- else
- EmitPSFile(ArgTrailerPS);
- if (ArgDebugLevel >= 1)
- (void) fprintf(ArgLogFile, gettext("Done.\n"));
- m_label_free(FileLabel);
- return (0);
-}
-
-static void
-EmitJobData(void)
-{
- EmitPrologue();
- EmitCommandLineInfo();
- EmitClockBasedInfo();
- EmitLabelInfo();
-
- /* Emit ending PostScript code */
- (void) printf("end\n\n");
- (void) printf("%%%% End of code generated by lp.tsol_separator\n\n");
-
-}
-
-static void
-EmitPrologue(void)
-{
- /* Emit preliminary PostScript code */
- (void) printf("%%!\n\n");
- (void) printf("%%%% Begin code generated by lp.tsol_separator\n\n");
-
- (void) printf("%%%% Create JobDict if it doesn't exist\n");
- (void) printf("userdict /JobDict known not {\n");
- (void) printf(" userdict /JobDict 100 dict put\n");
- (void) printf("} if\n\n");
-
- (void) printf("%%%% Define job parameters, including TSOL security "
- "info\n");
- (void) printf("JobDict\n");
- (void) printf("begin\n");
-}
-
-/* Emit parameters obtained from command line options */
-
-static void
-EmitCommandLineInfo(void)
-{
- char user[MAXUSERLEN + 1];
- char host[MAXHOSTLEN + 1];
-
- (void) printf("\t/Job_Printer (%s) def\n", ArgPrinter);
- ParseUsername(ArgUser, user, host);
- (void) printf("\t/Job_Host (%s) def\n", host);
- (void) printf("\t/Job_User (%s) def\n", user);
- (void) printf("\t/Job_JobID (%s) def\n", ArgJobID);
- (void) printf("\t/Job_Title (%s) def\n", ArgTitle);
- (void) printf("\t/Job_DoPageLabels (%s) def\n",
- ArgNoPageLabels ? "NO" : "YES");
- (void) printf("\n");
-}
-
-/* Emit parameters generated from the system clock */
-
-static void
-EmitClockBasedInfo(void)
-{
- char timebuf[80];
- struct timeval clockval;
-
- (void) gettimeofday(&clockval, NULL);
- (void) strftime(timebuf, sizeof (timebuf), NULL,
- localtime(&clockval.tv_sec));
- (void) printf("\t/Job_Date (%s) def\n", timebuf);
- (void) printf("\t/Job_Hash (%ld) def\n", clockval.tv_usec % 100000L);
- (void) printf("\n");
-}
-
-/* Emit parameters derived from the SL and IL of the file being printed. */
-
-static void
-EmitLabelInfo(void)
-{
- char *header = NULL; /* DIA banner page fields */
- char *label = NULL;
- char *caveats = NULL;
- char *channels = NULL;
- char *page_label = NULL; /* interior pages label */
-
- if (label_to_str(FileLabel, &header, PRINTER_TOP_BOTTOM,
- DEF_NAMES) != 0) {
- (void) fprintf(ArgLogFile,
- gettext("%s: label_to_str PRINTER_TOP_BOTTOM: %s.\n"),
- ME, strerror(errno));
- exit(1);
- }
- if (label_to_str(FileLabel, &label, PRINTER_LABEL,
- DEF_NAMES) != 0) {
- (void) fprintf(ArgLogFile,
- gettext("%s: label_to_str PRINTER_LABEL: %s.\n"),
- ME, strerror(errno));
- exit(1);
- }
- if (label_to_str(FileLabel, &caveats, PRINTER_CAVEATS,
- DEF_NAMES) != 0) {
- (void) fprintf(ArgLogFile,
- gettext("%s: label_to_str PRINTER_CAVEATS: %s.\n"),
- ME, strerror(errno));
- exit(1);
- }
- if (label_to_str(FileLabel, &channels, PRINTER_CHANNELS,
- DEF_NAMES) != 0) {
- (void) fprintf(ArgLogFile,
- gettext("%s: label_to_str PRINTER_CHANNELS: %s.\n"),
- ME, strerror(errno));
- exit(1);
- }
- if (label_to_str(FileLabel, &page_label, M_LABEL,
- LONG_NAMES) != 0) {
- (void) fprintf(ArgLogFile,
- gettext("%s: label_to_str M_LABEL: %s.\n"),
- ME, strerror(errno));
- exit(1);
- }
-
- (void) printf("\t/Job_Classification (%s) def\n", header);
- (void) printf("\t/Job_Protect (%s) def\n", label);
- (void) printf("\t/Job_Caveats (%s) def\n", caveats);
- (void) printf("\t/Job_Channels (%s) def\n", channels);
- (void) printf("\t/Job_SL_Internal (%s) def\n", page_label);
-
- /* Free memory allocated label_to_str */
- free(header);
- free(label);
- free(caveats);
- free(channels);
- free(page_label);
-}
-
-/*
- * Parse input "host!user" to separate host and user names.
- */
-
-static void
-ParseUsername(char *input, char *user, char *host)
-{
- char *cp;
-
- if ((cp = strchr(input, '@')) != NULL) {
- /* user@host */
- (void) strlcpy(host, cp + 1, MAXHOSTLEN + 1);
- *cp = '\0';
- (void) strlcpy(user, input, MAXUSERLEN + 1);
- *cp = '@';
- } else if ((cp = strchr(input, '!')) != NULL) {
- /* host!user */
- (void) strlcpy(user, cp + 1, MAXUSERLEN + 1);
- *cp = '\0';
- (void) strlcpy(host, input, MAXHOSTLEN + 1);
- *cp = '!';
- } else {
- /* user */
- (void) strlcpy(user, input, MAXUSERLEN + 1);
- host[0] = '\0';
- }
-}
-
-
-static void
-CopyStdin(void)
-{
- if (!EmitFile(stdin)) {
- (void) fprintf(ArgLogFile,
- gettext("%s: Error copying stdin to stdout\n"), ME);
- exit(1);
- }
-}
-
-
-static BOOL
-EmitFile(FILE *file)
-{
- int len;
-#define BUFLEN 1024
- char buf[BUFLEN];
-
- while ((len = fread(buf, 1, BUFLEN, file)) > 0) {
- if (fwrite(buf, 1, len, stdout) != len)
- return (FALSE);
- }
- if (!feof(file))
- return (FALSE);
- return (TRUE);
-}
-
-
-static void
-EmitPSFile(const char *name)
-{
- char path[PATH_MAX];
- FILE *file;
- BOOL emitted;
-
- if (name[0] != '/') {
- (void) strlcpy(path, ArgPSLib, sizeof (path));
- (void) strlcat(path, "/", sizeof (path));
- (void) strlcat(path, name, sizeof (path));
- } else {
- (void) strlcpy(path, name, sizeof (path));
- }
-
- file = fopen(path, "r");
- if (file == NULL) {
- (void) fprintf(ArgLogFile,
- gettext("%s: Error opening PostScript file %s. %s.\n"),
- ME, path, strerror(errno));
- exit(1);
- }
-
- emitted = EmitFile(file);
- (void) fclose(file);
- if (!emitted) {
- (void) fprintf(ArgLogFile, gettext(
- "%s: Error copying PostScript file %s to stdout.\n"),
- ME, path);
- exit(1);
- }
-}
-
-
-static int
-ProcessArgs(int argc, char *argv[])
-{
- int option_letter;
- char *options_string = "lrd:e:s:b:t:L:";
-
- /* set default values for arguments */
- ArgSeparatorPS = SEPARATORPS;
- ArgBannerPS = BANNERPS;
- ArgTrailerPS = TRAILERPS;
- ArgPSLib = POSTSCRIPTLIB;
- ArgNoPageLabels = ArgReverse = FALSE;
- ArgDebugLevel = 0;
- ArgLogFile = stderr;
-
- /* read switch arguments once to get error log file */
- while ((option_letter = getopt(argc, argv, options_string)) != EOF) {
- switch (option_letter) {
- case 'd':
- ArgDebugLevel = atoi(optarg);
- break;
- case 'e':
- ArgLogFile = fopen(optarg, "a");
- if (ArgLogFile == NULL) {
- (void) fprintf(stderr,
- gettext("Cannot open log file %s\n"),
- optarg);
- return (-1);
- }
- break;
- case '?': /* ? or unrecognized option */
- Usage();
- return (-1);
- }
- }
-
- if (ArgDebugLevel > 0)
- (void) fprintf(ArgLogFile,
- gettext("Processing switch arguments\n"));
-
- /* re-read switch arguments */
- optind = 1;
- while ((option_letter = getopt(argc, argv, options_string)) != EOF) {
- switch (option_letter) {
- case 'd':
- ArgDebugLevel = atoi(optarg);
- break;
- case 'e':
- /* This was handled in earlier pass through args */
- break;
- case 'l':
- ArgNoPageLabels = TRUE;
- break;
- case 'r':
- ArgReverse = TRUE;
- break;
- case 's':
- ArgSeparatorPS = optarg;
- break;
- case 'b':
- ArgBannerPS = optarg;
- break;
- case 't':
- ArgTrailerPS = optarg;
- break;
- case 'L':
- ArgPSLib = optarg;
- break;
- case '?': /* ? or unrecognized option */
- Usage();
- return (-1);
- }
- }
-
- /* Adjust arguments to skip over options */
- argc -= optind; /* Number of remaining(non-switch) args */
- argv += optind; /* argv[0] is first(non-switch) args */
-
- if (argc != 5) {
- (void) fprintf(ArgLogFile,
- gettext("Wrong number of arguments.\n\n"));
- Usage();
- return (-1);
- }
-
- ArgPrinter = argv++[0];
- ArgJobID = argv++[0];
- ArgUser = argv++[0];
- ArgTitle = argv++[0];
- ArgFile = argv++[0];
-
- if (ArgDebugLevel >= 1) {
- (void) fprintf(ArgLogFile, gettext("Arguments processed\n"));
- (void) fprintf(ArgLogFile, gettext("Printer: %s\n"),
- ArgPrinter);
- (void) fprintf(ArgLogFile, gettext("Job ID: %s\n"), ArgJobID);
- (void) fprintf(ArgLogFile, gettext("User: %s\n"), ArgUser);
- (void) fprintf(ArgLogFile, gettext("Title: %s\n"), ArgTitle);
- (void) fprintf(ArgLogFile, gettext("File: %s\n"), ArgFile);
- }
-
- return (0);
-}
-
-
-static void
-Usage(void)
-{
- static const char *OPTFMT = " %-8s %-9s %s\n";
-
- (void) fprintf(ArgLogFile,
- gettext("Usage: lp.tsol_separator [OPTIONS] %s\n"),
- gettext("PRINTER JOBID HOST!USER TITLE FILE"));
- (void) fprintf(ArgLogFile, gettext(" OPTIONS:\n"));
- (void) fprintf(ArgLogFile, OPTFMT, "-r", gettext("Reverse"),
- gettext("Reverse banner/trailer order"));
- (void) fprintf(ArgLogFile, OPTFMT, "-l", gettext("Labels"),
- gettext("Suppress page header/footer labels"));
- (void) fprintf(ArgLogFile, OPTFMT, gettext("-b FILE"),
- gettext("Banner"),
- gettext("PostScript program for banner (default tsol_banner.ps)"));
- (void) fprintf(ArgLogFile, OPTFMT, gettext("-s FILE"),
- gettext("Separator"),
- gettext("PostScript program for separator "
- "(default tsol_separator.ps)"));
- (void) fprintf(ArgLogFile, OPTFMT, gettext("-t FILE"),
- gettext("Trailer"),
- gettext("PostScript program for trailer "
- "(default tsol_trailer.ps)"));
- (void) fprintf(ArgLogFile, OPTFMT, gettext("-L DIR"),
- gettext("Library"),
- gettext("Directory to search for PostScript programs"));
- (void) fprintf(ArgLogFile, OPTFMT, "", "",
- gettext("(default /usr/lib/lp/postscript)"));
- (void) fprintf(ArgLogFile, OPTFMT, gettext("-d N"), gettext("Debug"),
- gettext("Set debug level to N"));
- (void) fprintf(ArgLogFile, OPTFMT, gettext("-e FILE"),
- gettext("Error File"),
- gettext("Append error and debugging output to FILE"));
-}
diff --git a/usr/src/cmd/lp/model/netpr/Makefile b/usr/src/cmd/lp/model/netpr/Makefile
deleted file mode 100644
index f447336bc3..0000000000
--- a/usr/src/cmd/lp/model/netpr/Makefile
+++ /dev/null
@@ -1,113 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/model/netpr
-#
-
-PROG= netpr
-
-include ../../Makefile.lp
-
-PURIFYOPTS = -logfile=/tmp/errs.%p
-PURIFY = purify $(PURIFYOPTS)
-
-CPPFLAGS = -I. -I$(LPINC) \
- $(CPPFLAGS.master)
-
-HDRS= \
- netpr.h \
- netdebug.h
-
-SRCS= \
- netpr.c \
- misc.c \
- net.c \
- tcp_misc.c \
- bsd_misc.c
-
-OBJS= $(SRCS:.c=.o)
-
-
-LPLIBS = \
- $(LIBMSG) \
- $(LIBFRM) \
- $(LIBREQ) \
- $(LIBPRT) \
- $(LIBCLS) \
- $(LIBACC) \
- $(LIBFLT) \
- $(LIBUSR) \
- $(LIBOAM) \
- $(LIBLP) \
- $(LIBSEC) \
- $(LIBSYS)
-
-SYSLIBS= -lnsl -lsocket
-
-LDLIBS += $(LPLIBS) $(SYSLIBS)
-ROOTLIBLPBIN = $(ROOTLIBLP)/bin
-
-ROOTNETPRPROG = $(PROG:%=$(ROOTLIBLPBIN)/%)
-
-FILEMODE= 04511
-
-POFILE= lp_model_netpr.po
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-install: all $(ROOTLIBLPBIN) $(ROOTNETPRPROG)
-
-$(ROOTLIBLPBIN):
- $(INS.dir)
-
-$(ROOTLIBLPBIN)/%: %
- $(INS.file)
-
-
-$(PROG): $(OBJS)
- $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
- $(POST_PROCESS)
-
-$(PROG).pure: $(OBJS)
- $(PURIFY) $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
- $(POST_PROCESS)
-
-clean:
- $(RM) $(OBJS)
-
-clobber: clean
- -$(RM) $(PROG) $(CLOBBERFILES)
-
-strip:
- $(STRIP) $(PROG)
-
-cstyle:
- cstyle $(SRCS)
-
-LINTFLAGS += -lnsl -lsocket
-lint:
- $(LINT.c) $(SRCS) $(LDLIBS)
-
-include ../Makefile.msg
diff --git a/usr/src/cmd/lp/model/netpr/bsd_misc.c b/usr/src/cmd/lp/model/netpr/bsd_misc.c
deleted file mode 100644
index a4402a5cde..0000000000
--- a/usr/src/cmd/lp/model/netpr/bsd_misc.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <libintl.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <syslog.h>
-#include "netpr.h"
-#include "netdebug.h"
-
-static int job_primitive(np_bsdjob_t *, char, char *);
-static int create_cfA_file(np_bsdjob_t *);
-static char *create_cfname(np_bsdjob_t *);
-static char *create_dfname(np_bsdjob_t *);
-extern char data_file_type;
-
-np_bsdjob_t *
-create_bsd_job(np_job_t *injob, int pr_order, int filesize)
-{
-
- np_bsdjob_t *job;
- char *id;
- int x;
- np_data_t *jobdata;
-
- if ((injob->request_id == NULL) || (injob->username == NULL) ||
- (injob->dest == NULL) || (injob->printer == NULL)) {
- return (NULL);
- }
-
- job = (np_bsdjob_t *)malloc(sizeof (np_bsdjob_t));
- ASSERT(job, MALLOC_ERR);
- (void) memset(job, 0, sizeof (np_bsdjob_t));
- job->np_printer = "auto"; /* default "queue" */
- /*
- * request-id comes in as printer-number
- * pull apart to create number
- */
- if ((id = strrchr(injob->request_id, (int)'-')) == NULL) {
- (void) fprintf(stderr,
- gettext("Netpr: request_id in unknown format:<%s>\n"),
- injob->request_id);
- syslog(LOG_DEBUG, "request id in unknown format: %s",
- injob->request_id);
- return (NULL);
- }
-
- id++;
-
- /*
- * 4261563 - A ID collides with an existing one, it plus
- * 1,000 with the ID causes breaking
- * Max job id for bsd is 999.
- */
- job->np_request_id = malloc(4);
- ASSERT(job->np_request_id, MALLOC_ERR);
- errno = 0;
- x = atoi(id);
- if ((errno != 0) || (x < 0)) {
- x = 0;
- }
- (void) snprintf(job->np_request_id, (size_t)4,
- "%.3d", x % 1000);
-
- /* seperate the user/host from host!user or user@host */
- if ((id = strchr(injob->username, '@')) != NULL) {
- *id++ = '\0';
- job->np_username = strdup(injob->username);
- job->np_host = strdup(id);
- *--id = '@';
- } else if ((id = strrchr(injob->username, '!')) != NULL) {
- *id++ = '\0';
- job->np_username = strdup(id);
- job->np_host = strdup(injob->username);
- *--id = '!';
- } else {
- syslog(LOG_DEBUG, "using localhost for user %s",
- injob->username);
- job->np_username = strdup(injob->username);
- job->np_host = strdup("localhost");
- }
-
- job->np_printer = injob->printer;
- job->np_filename = injob->filename;
-
- job->np_df_letter = 'A';
-
- /* build cfAfilename: (cfA)(np_request_id)(np_host) */
- if ((job->np_cfAfilename = create_cfname(job)) == NULL) {
- (void) fprintf(stderr,
- gettext("Netpr: System error creating cfAfilename\n"));
- syslog(LOG_DEBUG, "System error creating cfAfilename");
- return (NULL);
- }
-
- job->np_timeout = injob->timeout;
- job->np_banner = injob->banner;
- job->np_print_order = pr_order;
-
- if (injob->title == NULL)
- job->np_title = injob->filename;
- else
- job->np_title = injob->title;
-
- if ((create_cfA_file(job)) == -1) {
- (void) fprintf(stderr,
- gettext("Netpr: Cannot create bsd control file\n"));
- syslog(LOG_DEBUG, "Cannot create bsd control file");
- return (NULL);
- }
-
- /* Now we have a title, add to the control file */
- if (injob->banner == BANNER) {
- (void) job_primitive(job, 'C', job->np_host);
- (void) job_primitive(job, 'J', job->np_title);
- (void) job_primitive(job, 'L', job->np_username);
- }
-
-
- /* create dfname for this file */
-
- /* allocate the jobdata and initialize what we have so far */
- jobdata = malloc(sizeof (np_data_t));
- ASSERT(jobdata, MALLOC_ERR);
- (void) memset(jobdata, 0, sizeof (np_data_t));
-
- jobdata->np_path_file = malloc(strlen(job->np_filename) + 1);
- ASSERT(jobdata->np_path_file, MALLOC_ERR);
- (void) strcpy(jobdata->np_path_file, job->np_filename);
-
- jobdata->np_data_size = filesize;
-
- if ((jobdata->np_dfAfilename = create_dfname(job)) == NULL) {
- return (NULL);
- }
-
- /*
- * data_file_type should contain the RFC-1179 control file message
- * type for the control file. The is is set via the "-f" option
- * to netpr, which get it from the "destination-full-control-file-type"
- * option passed in. Normally this will be either 'l' or 'f'.
- */
- if (data_file_type != 0) {
- (void) job_primitive(job, data_file_type,
- jobdata->np_dfAfilename);
- (void) job_primitive(job, 'U', jobdata->np_dfAfilename);
- (void) job_primitive(job, 'N', "print-data");
- }
-
- syslog(LOG_DEBUG, "data file info: %s", job->np_cfAfile);
-
- /*
- * attach np_data to bsdjob
- */
- job->np_data = jobdata;
-
- return (job);
-}
-
-
-/*
- * Create df<x>name for this file
- * df<X><nnn><hostname>
- */
-static char *
-create_dfname(np_bsdjob_t *job)
-{
- char *dfname;
-
- if (job == NULL)
- return (NULL);
-
- /* Trying to print too many files */
- if (job->np_df_letter > 'z') {
- errno = ENFILE;
- return (NULL);
- }
-
- dfname = (char *)malloc(strlen(job->np_host) + 3 + 3 + 1);
- ASSERT(dfname, MALLOC_ERR);
- (void) memset(dfname, 0, strlen(job->np_host) + 3 + 3 + 1);
- (void) sprintf(dfname, "%s%c%s%s", "df", job->np_df_letter,
- job->np_request_id, job->np_host);
-
- /* udate np_df_letter for the next caller */
- job->np_df_letter += 1;
- if ((job->np_df_letter > 'Z') && (job->np_df_letter < 'a'))
- job->np_df_letter = 'a';
-
- return (dfname);
-}
-
-static char *
-create_cfname(np_bsdjob_t *job)
-{
- char *cfname;
-
- if (job == NULL)
- return (NULL);
-
- cfname = (char *)malloc(strlen(job->np_host) + 3 + 3 + 1);
- ASSERT(cfname, MALLOC_ERR);
- (void) memset(cfname, 0, strlen(job->np_host) + 3 + 3 + 1);
- (void) sprintf(cfname, "%s%s%s", "cfA",
- job->np_request_id, job->np_host);
- return (cfname);
-}
-
-static int
-create_cfA_file(np_bsdjob_t *job)
-{
- /*
- * Read through job structure, creating entries
- * in control file as appropriate
- */
- if ((job->np_host == NULL) || (job->np_username == NULL)) {
- (void) fprintf(stderr, gettext(
- "Netpr: Missing required data, cannot build control file\n"));
- return (-1);
- }
- (void) job_primitive(job, 'H', job->np_host);
- (void) job_primitive(job, 'P', job->np_username);
-
- return (0);
-}
-
-static int
-job_primitive(np_bsdjob_t *job, char option, char *value)
-{
- char buf[BUFSIZ];
-
- if ((job == NULL) || (value == NULL))
- return (-1);
-
- job->np_cfAfilesize += strlen(value) + 2; /* (opt)(value)\n */
- if (job->np_cfAfile == NULL) {
- /* Always allocate one greater than cfAfilesize for the \0 */
- job->np_cfAfile = calloc(1, job->np_cfAfilesize + 1);
- ASSERT(job->np_cfAfile, MALLOC_ERR);
- } else {
- job->np_cfAfile = realloc(job->np_cfAfile,
- job->np_cfAfilesize + 1);
- ASSERT(job->np_cfAfile, REALLOC_ERR);
- }
- (void) snprintf(buf, sizeof (buf), "%c%s\n", option, value);
- (void) strcat(job->np_cfAfile, buf);
- syslog(LOG_DEBUG, "adding: %d %s", job->np_cfAfilesize, buf);
-
- return (0);
-}
diff --git a/usr/src/cmd/lp/model/netpr/misc.c b/usr/src/cmd/lp/model/netpr/misc.c
deleted file mode 100644
index cec2b533bc..0000000000
--- a/usr/src/cmd/lp/model/netpr/misc.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1996-2002 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include "netpr.h"
-#include "netdebug.h"
-
-extern char *strtok_r(char *, const char *, char **);
-
-int
-check_file(char * filename)
-{
- struct stat status;
-
- if (filename == NULL)
- return (-1);
-
- /* Checking read permission */
- if (access(filename, R_OK) < 0)
- return (-1);
-
- if (stat(filename, &status) < 0)
- return (-1);
-
- /* Checking for regular file */
- if (S_ISREG(status.st_mode) == 0) {
- errno = EISDIR;
- return (-1);
- }
-
- /* Checking for empty file */
- if (status.st_size == 0) {
- errno = ESRCH;
- return (-1);
- }
- return (status.st_size);
-}
-
-
-/*
- * allocate the space; fill with input
- */
-char *
-alloc_str(char * instr)
-{
- char * outstr;
-
- outstr = (char *)malloc(strlen(instr) + 1);
- ASSERT(outstr, MALLOC_ERR);
- (void) memset(outstr, 0, strlen(instr) + 1);
- (void) strcpy(outstr, instr);
-
- return (outstr);
-}
-
-np_job_t *
-init_job()
-{
- np_job_t * job;
-
- if ((job = calloc(1, sizeof (*job))) != NULL) {
- job->protocol = BSD;
- job->banner = BANNER;
- }
-
- return (job);
-}
-
-void
-tell_lptell(int type, char *fmt, ...)
-{
- char msg[BUFSIZ];
- va_list ap;
-
- va_start(ap, fmt);
- (void) vsnprintf(msg, sizeof (msg), fmt, ap);
- va_end(ap);
-
- if (msg == NULL)
- return;
-
- switch (type) {
- case ERRORMSG:
- (void) fprintf(stderr, "%%%%[PrinterError: %s ]%%%%\n", msg);
- break;
- case OKMSG:
- /* In this case, the message is the job request-id */
- (void) fprintf(stderr,
- "%%%%[job: %s status: ok source: Netpr]%%%%\n", msg);
- break;
- default:
- /* unknown type, ignore */
- break;
- }
-
-
-}
-
-
-/*
- * Parse destination
- * bsd: <printer_host>[:<printer_vendor_defined_name]
- * tcp: <printer_host>[:port_number]
- */
-
-void
-parse_dest(char * dest, char **str1, char **str2, char * sep)
-{
- char * tmp;
- char * nexttok;
-
- *str1 = NULL;
- *str2 = NULL;
-
- if (dest != NULL) {
- tmp = (char *)strtok_r(dest, sep, &nexttok);
- if (tmp != NULL)
- *str1 = strdup(tmp);
- tmp = (char *)strtok_r(NULL, sep, &nexttok);
- if (tmp != NULL)
- *str2 = strdup(tmp);
- }
-
-}
-
-/*
- * void panic call
- * used with ASSERT macro; gives us a place to stop the debugger
- */
-void
-panic()
-{
-}
diff --git a/usr/src/cmd/lp/model/netpr/net.c b/usr/src/cmd/lp/model/netpr/net.c
deleted file mode 100644
index 9e056f2eef..0000000000
--- a/usr/src/cmd/lp/model/netpr/net.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <libintl.h>
-#include <signal.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <strings.h>
-#include <syslog.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/file.h>
-#include <netinet/in.h>
-#include "netpr.h"
-
-#define TIMEOUT 1
-
-static int netpr_send_message(int, char *, ...);
-static int xfer_cfAfile(int, char *, char *, uint);
-
-int
-bsd_print(int sockfd, caddr_t pa, np_bsdjob_t * bsdjob)
-{
- int filesize;
- int xfer;
- int net;
-
- syslog(LOG_DEBUG, "bsd_print");
-
- filesize = bsdjob->np_data->np_data_size;
- syslog(LOG_DEBUG, "filesize is %d", filesize);
-
-
- if (netpr_send_message(sockfd, "%c%s\n", XFER_REQUEST,
- bsdjob->np_printer) != 0) {
- return (NETWORK_ERROR_SEND_RESPONSE);
- }
-
- /*
- * control file
- */
-
- if (bsdjob->np_print_order == CONTROL_FIRST) {
- if ((xfer_cfAfile(sockfd, bsdjob->np_cfAfile,
- bsdjob->np_cfAfilename,
- bsdjob->np_cfAfilesize)) != 0) {
- (void) fprintf(stderr,
- gettext("Netpr: Error sending control file\n"));
- syslog(LOG_DEBUG, "Error sending control file");
- return (NETWORK_ERROR_UNKNOWN);
-
- }
- }
-
- /* send msg - get ready for transfer */
-
- if ((netpr_send_message(sockfd, "%c%d %s\n", XFER_DATA, filesize,
- bsdjob->np_data->np_dfAfilename)) != 0) {
- return (NETWORK_ERROR_SEND_RESPONSE);
- }
-
- /*
- * send the file
- */
-
- if ((xfer = xfer_file(sockfd, pa, filesize, bsdjob->np_timeout)) != 0) {
- return (xfer);
- }
-
- /* send msg - done */
- if ((net = netpr_send_message(sockfd, "", NULL)) != 0) {
- (void) fprintf(stderr,
- gettext("Netpr: network error transfering %s returns: %d\n"),
- bsdjob->np_filename, net);
- syslog(LOG_DEBUG,
- "network error transfering %s returns: %d",
- bsdjob->np_filename, net);
- return (NETWORK_ERROR_WRITE_FAILED);
- }
-
- /*
- * control file
- */
-
- if (bsdjob->np_print_order == DATA_FIRST) {
- if ((xfer_cfAfile(sockfd, bsdjob->np_cfAfile,
- bsdjob->np_cfAfilename,
- bsdjob->np_cfAfilesize)) != 0) {
-
- (void) fprintf(stderr,
- gettext("Netpr: Error sending control file\n"));
- syslog(LOG_DEBUG, "Error sending control file");
- return (NETWORK_ERROR_UNKNOWN);
- }
- }
-
- return (0);
-}
-
-int
-xfer_file(int sockfd, caddr_t pa, int filesize, int seed)
-{
- int ctr;
- int timeout;
- int nw;
- int error_msg = 0;
- int pause = 0;
-
- syslog(LOG_DEBUG, "xfer_file");
-
- /* send file */
- ctr = filesize;
- timeout = seed = seed ? seed : 10;
-
- while (ctr > 0) {
-
- syslog(LOG_DEBUG, "xfer_file: write while loop => ctr = %d", ctr);
- syslog(LOG_DEBUG, "xfer_file: timeout = %d", timeout);
-
- (void) signal(SIGALRM, null_sighandler);
- (void) alarm(10);
- nw = write(sockfd, pa, ctr);
- syslog(LOG_DEBUG, "xfer_file: write while loop => nw = %d", nw);
- (void) alarm(0);
- if ((nw == 0) || (nw < 0)) {
- if (timeout < (seed * 4)) {
- (void) sleep(timeout);
- timeout *= 2;
- } else if (timeout == (seed * 4)) {
- (void) sleep(timeout);
- timeout *= 2;
-
- /*
- * Send message to user once
- */
- if (error_msg == 0) {
- error_msg++;
- tell_lptell(ERRORMSG,
- gettext("Printer not accepting input;"
- "possibly offline or out of paper."));
- }
-
- } else if (timeout > (seed * 4)) {
- (void) sleep(timeout);
- if (pause++ > 3)
- timeout = (seed * 10);
- }
-
- } else {
- ctr -= nw;
- pa += nw;
- if (error_msg) {
- tell_lptell(OKMSG, "Current");
- error_msg = 0;
- pause = 0;
- }
- timeout = seed;
- }
- }
-
- return (E_SUCCESS);
-}
-
-static int
-xfer_cfAfile(int sockfd, char * cfAfile, char * cfAname, uint size)
-{
- int ctr;
- caddr_t pa;
- int nw = 0;
- int timeout;
- int printererr;
-
- syslog(LOG_DEBUG, "xfer_cfAfile");
-
- if ((netpr_send_message(sockfd, "%c%d %s\n", XFER_CONTROL,
- size, cfAname)) != 0) {
- return (NETWORK_ERROR_MSG_FAILED);
- }
-
- /* send the control file */
- pa = cfAfile;
- ctr = size;
- syslog(LOG_DEBUG, "xfer_cfAfile : cfAfile %s", pa);
- syslog(LOG_DEBUG, "xfer_cfAfile : size %d", size);
-
- /* send control file */
- timeout = TIMEOUT;
- printererr = 0;
- while (ctr > 0) {
- (void) signal(SIGALRM, null_sighandler);
- (void) alarm(2);
- nw = write(sockfd, pa, size);
- (void) alarm(0);
- if (nw <= 0) {
- if (timeout < 16) {
- (void) sleep(timeout);
- timeout *= 2;
- } else if (timeout == 16) {
- /* talk with the printer and see what's happening */
- /* send message back to caller */
- (void) sleep(timeout);
- timeout *= 2;
- printererr = 1;
-
- tell_lptell(ERRORMSG,
- gettext("Printer not accepting input;"
- "possibly offline or out of paper."));
-
- } else if (timeout > 16) {
- (void) sleep(timeout);
- }
- }
- ctr -= nw;
- pa += nw;
- }
-
- if (printererr == 1) {
- (void) fprintf(stderr, gettext("Printer status ok\n"));
- tell_lptell(OKMSG, "Current");
- }
-
-
- /* send msg - done */
- if (netpr_send_message(sockfd, "", NULL) != 0) {
- return (NETWORK_ERROR_MSG_FAILED);
- }
-
- return (0);
-}
-
-/*
- * netpr_response() reads in a byte from the network printer
- */
-static int
-netpr_response(int nd)
-{
- char c;
- int msg_given = 0;
- int firstloop = 0;
-
- syslog(LOG_DEBUG, "netpr_response");
-
- (void) signal(SIGALRM, null_sighandler);
- (void) alarm(2);
- while (1) {
- errno = 0;
- if ((read(nd, &c, 1) != 1)) {
-
- if (firstloop == 0) {
- (void) alarm(0);
- firstloop++;
- }
-
- if (errno == EINTR) {
- if (msg_given == 0) {
- tell_lptell(ERRORMSG,
- gettext("Printer not responding;"
- "Either warming up or needs attention"));
- msg_given++;
- syslog(LOG_DEBUG,
- "read hanging in netpr_response: %m");
- }
-
- } else {
- syslog(LOG_DEBUG,
- "read in netpr_response failed: %m");
- return (NETWORK_READ_RESPONSE_FAILED);
- }
-
- } else {
- if (c) {
- syslog(LOG_DEBUG,
- "Printer returned error: %m");
- return (NETWORK_PRINTER_REFUSED_CONN);
- } else {
- if (msg_given)
- tell_lptell(OKMSG, "Current");
- return (0);
- }
- }
- }
-
-}
-
-static int
-netpr_send_message(int nd, char *fmt, ...)
-{
- char buf[BUFSIZ];
- int ctr;
- char * pa;
- va_list ap;
- int timeout = 1;
- int nw;
- int err_msg = 0;
-
- syslog(LOG_DEBUG, "netpr_send_message");
- va_start(ap, fmt);
- (void) vsnprintf(buf, sizeof (buf), fmt, ap);
- va_end(ap);
-
- pa = buf;
- ctr = (strlen(buf) != 0) ? strlen(buf) : 1;
-
- syslog(LOG_DEBUG, "netpr_send_message : ctr = %d", ctr);
- while (ctr > 0) {
- (void) signal(SIGALRM, null_sighandler);
- (void) alarm(2);
- nw = write(nd, pa, ctr);
- syslog(LOG_DEBUG, "netpr_send_message : nw = %d", nw);
- (void) alarm(0);
-
- if (nw <= 0) {
- if (timeout < 16) {
- (void) sleep(timeout);
- timeout *= 2;
- } else if (timeout == 16) {
- (void) sleep(timeout);
- timeout *= 2;
- if (err_msg == 0) {
- err_msg++;
- tell_lptell(ERRORMSG,
- gettext("Printer not accepting input;"
- "possibly offline or out of paper."));
- }
- } else
- (void) sleep(timeout);
- } else {
- ctr -= nw;
- pa += nw;
- if (err_msg)
- tell_lptell(OKMSG, "Current");
- }
- }
-
- return (netpr_response(nd));
-}
-
-/*
- * null() is to be used as a signal handler that does nothing. It is used in
- * place of SIG_IGN, because we want the signal to be delivered and
- * interupt the current system call.
- */
-/*ARGSUSED*/
-void
-null_sighandler(int i)
-{
-}
diff --git a/usr/src/cmd/lp/model/netpr/netdebug.h b/usr/src/cmd/lp/model/netpr/netdebug.h
deleted file mode 100644
index ed1d91e216..0000000000
--- a/usr/src/cmd/lp/model/netpr/netdebug.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1996, by Sun Microsystems, Inc. */
-/* All rights reserved. */
-
-#ifndef _NETDEBUG_H
-#define _NETDEBUG_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MALLOC_ERR "aborting netpr: malloc returns NULL"
-#define REALLOC_ERR "aborting netpr: realloc returns NULL"
-
-#define ASSERT(expr, str) \
-{ \
- if (!expr) { \
- (void) fprintf(stderr, \
- "%s: line %d %s\n", __FILE__, __LINE__, str); \
- panic(); \
- exit(E_RETRY); \
- } \
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NETDEBUG_H */
diff --git a/usr/src/cmd/lp/model/netpr/netpr.c b/usr/src/cmd/lp/model/netpr/netpr.c
deleted file mode 100644
index bdce543aa5..0000000000
--- a/usr/src/cmd/lp/model/netpr/netpr.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <libintl.h>
-#include <locale.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <sys/utsname.h>
-#include "netpr.h"
-
-
-static void usage_exit();
-
-static void pipehandler(int);
-char data_file_type = 0;
-
-/*
- * null() is to be used as a signal handler that does nothing. It is used in
- * place of SIG_IGN, because we want the signal to be delivered and
- * interupt the current system call.
- */
-static void
-null(int i)
-{
- syslog(LOG_DEBUG, "null(%d)", i);
-}
-
-/*
- * net_open() opens a tcp connection to the printer port on the host specified
- * in the arguments passed in. If the connection is not made in the
- * timeout (in seconds) passed in, an error it returned. If the host is
- * unknown, an error is returned. If all is well, a file descriptor is
- * returned to be used for future communications.
- */
-int
-net_open(char *host, int timeout)
-{
- struct hostent *hp;
- struct servent *sp;
- struct sockaddr_in6 sin;
- void (*old_handler)();
- static struct utsname uts;
-
- int s,
- lport,
- err,
- error_num;
- unsigned timo = 1;
-
- syslog(LOG_DEBUG, "net_open(%s, %d)", (host != NULL ? host : "NULL"),
- timeout);
- /*
- * Get the host address and port number to connect to.
- */
- if (host == NULL) {
- return (-1);
- }
-
- (void) memset((char *)&sin, NULL, sizeof (sin));
- if ((hp = getipnodebyname(host, AF_INET6, AI_DEFAULT,
- &error_num)) == NULL) {
- syslog(LOG_DEBUG|LOG_ERR, "unknown host %s "
- "getipnodebyname() returned %d", host, error_num);
- return (NETWORK_ERROR_HOST);
- }
- (void) memcpy((caddr_t)&sin.sin6_addr, hp->h_addr, hp->h_length);
- sin.sin6_family = hp->h_addrtype;
- freehostent(hp);
-
- if ((sp = getservbyname("printer", "tcp")) == NULL) {
- syslog(LOG_DEBUG|LOG_ERR, "printer/tcp: unknown service");
- return (NETWORK_ERROR_SERVICE);
- }
- sin.sin6_port = sp->s_port;
-
-retry:
- /*
- * Try connecting to the server.
- *
- * Use 0 as lport means that rresvport_af() will bind to a port in
- * the anonymous privileged port range.
- */
- lport = 0;
- s = rresvport_af(&lport, AF_INET6);
- if (s < 0)
- return (NETWORK_ERROR_PORT);
-
- old_handler = signal(SIGALRM, null);
- (void) alarm(timeout);
- if (connect(s, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
- (void) alarm(0);
- (void) signal(SIGALRM, old_handler);
- err = errno;
- (void) close(s);
- errno = err;
- if (errno == EADDRINUSE) {
- goto retry;
- }
- /*
- * If connecting to the local system fails, try
- * again with "localhost" address instead.
- */
- if (uts.nodename[0] == '\0')
- (void) uname(&uts);
- if (strcmp(host, uts.nodename) == 0) {
- IN6_IPADDR_TO_V4MAPPED(htonl(INADDR_LOOPBACK),
- &sin.sin6_addr);
- sin.sin6_family = AF_INET6;
- goto retry;
- }
- if (errno == ECONNREFUSED && timo <= 16) {
- (void) sleep(timo);
- timo *= 2;
- goto retry;
- }
- return (NETWORK_ERROR_UNKNOWN);
- }
- (void) alarm(0);
- (void) signal(SIGALRM, old_handler);
- return (s);
-}
-
-int
-main(int argc, char *argv[])
-{
- extern char *optarg;
- extern int optind;
- int opt;
- np_job_t *job_data;
- char *destination = NULL;
- np_bsdjob_t *bsdjob;
- np_tcpjob_t *tcpjob;
- int sockfd;
- int pr_order = CONTROL_FIRST;
- char *vendor_pr_name = NULL;
- char *tcp_port = NULL;
- size_t filesize;
- int fd;
- caddr_t pa;
- int jobstatus;
- int exit_status = 0;
- int on = 1;
-
-
- (void) setlocale(LC_ALL, "");
-#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
-#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- openlog("netpr", LOG_PID, LOG_LPR);
- (void) signal(SIGPIPE, pipehandler);
-
- /* reduce privileges until needed to open reserved port */
- if (seteuid(getuid())) {
- syslog(LOG_DEBUG, "seteuid failed, exiting netpr");
- exit(E_FAILURE);
- }
-
- if ((job_data = init_job()) == NULL) {
- fprintf(stderr, gettext("init_job(): out of memory\n"));
- exit(E_RETRY);
- }
-
- while ((opt = getopt(argc, argv, "f:I:p:d:T:P:t:U:c:b")) != EOF)
- switch (opt) {
- case 'f':
- data_file_type = optarg[0];
- break;
- case 'I': /* foo-49 */
- job_data->request_id = alloc_str((char *)optarg);
- syslog(LOG_DEBUG, "request_id: %s",
- job_data->request_id);
- break;
- case 'U': /* awe172-126!wendyp */
- job_data->username = alloc_str((char *)optarg);
- syslog(LOG_DEBUG, "username: %s",
- job_data->username);
- break;
- case 'p': /* foo */
- job_data->printer = alloc_str((char *)optarg);
- syslog(LOG_DEBUG, "printer: %s",
- job_data->printer);
- break;
- case 'd': /* server for printer */
- job_data->dest = alloc_str((char *)optarg);
- syslog(LOG_DEBUG, "dest: %s",
- job_data->dest);
- break;
- case 'T': /* /tmp/file2 */
- job_data->title = alloc_str((char *)optarg);
- syslog(LOG_DEBUG, "title: %s",
- job_data->title);
- break;
- case 'P':
- if ((strcmp(optarg, "bsd")) == 0)
- job_data->protocol = BSD;
- else if ((strcmp(optarg, "tcp")) == 0)
- job_data->protocol = TCP;
- else
- usage_exit();
-
- syslog(LOG_DEBUG, "protocol: %d",
- job_data->protocol);
- break;
- case 't':
- job_data->timeout = atoi(optarg);
- if (job_data->timeout < 0)
- usage_exit();
- break;
- case 'c':
- if ((strcmp(optarg, "first")) == 0)
- pr_order = CONTROL_FIRST;
- else if ((strcmp(optarg, "last")) == 0)
- pr_order = DATA_FIRST;
- else
- usage_exit();
-
- syslog(LOG_DEBUG, "bsd print order: %d", pr_order);
- break;
- case 'b':
- job_data->banner = NOBANNER;
- syslog(LOG_DEBUG, "banner : %d",
- job_data->banner);
- break;
- case '?':
- usage_exit();
- }
-
-
- if ((job_data->dest == NULL) || (job_data->request_id == NULL) ||
- (job_data->printer == NULL) || (job_data->username == NULL))
- usage_exit();
-
- /*
- * Check that there is a file
- */
- if (optind == argc) {
- usage_exit();
- }
-
- job_data->filename = alloc_str(argv[optind]);
- syslog(LOG_DEBUG, "filename : %s", job_data->filename);
-
-
- /*
- * Sanity check the file
- * returns filesize
- */
-
- if ((filesize = check_file(job_data->filename)) == -1) {
- syslog(LOG_DEBUG, "Skipping file %s",
- job_data->filename ? job_data->filename : "Error NULL file");
-
- switch (errno) {
- case EISDIR:
- (void) fprintf(stderr,
- gettext("Netpr: %s: Not a regular file\n"),
- (job_data->filename ? job_data->filename : "Noname"));
- syslog(LOG_DEBUG, "Not a regular file");
- break;
- case ESRCH:
- (void) fprintf(stderr,
- gettext("Netpr: %s: Empty file\n"),
- (job_data->filename ? job_data->filename : "Noname"));
- syslog(LOG_DEBUG, "Empty file");
- break;
- default:
- perror(job_data->filename);
- (void) fprintf(stderr,
- gettext("Netpr: Cannot access file %s\n"),
- (job_data->filename ? job_data->filename : "Noname"));
- syslog(LOG_DEBUG, "Cannot access file.");
- break;
-
- }
-
- /*
- * This file not valid, so bail
- * Exit with zero so system will keep printing
- */
- exit(0);
- }
-
- /*
- * file looks ok, open and mmap it
- */
- if ((fd = open(job_data->filename, O_RDONLY)) < 0) {
- (void) fprintf(stderr, gettext("Netpr: Cannot open file %s\n"),
- (job_data->filename ? job_data->filename : "Error: NULL file"));
- syslog(LOG_DEBUG, "Cannot open file: %s",
- job_data->filename ? job_data->filename : "Error NULL file");
- exit(E_BAD_FILE);
- }
-
- if ((pa = mmap((caddr_t)0, filesize, PROT_READ,
- (MAP_SHARED | MAP_NORESERVE), fd, (off_t)0)) == MAP_FAILED) {
-
- (void) close(fd);
- (void) fprintf(stderr, gettext("Netpr: Cannot mmap file %s"),
- (job_data->filename ? job_data->filename : "Error: NULL file"));
-
- syslog(LOG_DEBUG, "Cannot mmap file: %s",
- job_data->filename ? job_data->filename : "Error NULL file");
-
- exit(E_RETRY);
- }
-
-
- if (job_data->protocol == BSD) {
- bsdjob = (np_bsdjob_t *)
- create_bsd_job(job_data, pr_order, filesize);
- if (bsdjob == NULL)
- exit(E_FAILURE);
- } else {
- tcpjob = (np_tcpjob_t *)create_tcp_job(job_data, filesize);
- if (tcpjob == NULL)
- exit(E_FAILURE);
- }
-
- /*
- * Parse destination
- */
-
- if ((strpbrk(job_data->dest, DEST_SEP)) != NULL) {
- if (job_data->protocol == BSD) {
- parse_dest(job_data->dest, &destination,
- &vendor_pr_name, DEST_SEP);
- if (vendor_pr_name != NULL) {
- bsdjob->np_printer = vendor_pr_name;
- syslog(LOG_DEBUG, "bsd vendor name: %s",
- bsdjob->np_printer);
- }
- } else {
- parse_dest(job_data->dest, &destination, &tcp_port,
- DEST_SEP);
- if (tcp_port != NULL)
- tcpjob->np_port = tcp_port;
- syslog(LOG_DEBUG, "tcp_port %s",
- tcpjob->np_port);
- }
- if (destination == NULL ||
- (job_data->protocol == TCP && tcp_port == NULL)) {
- (void) fprintf(stderr,
- gettext("Netpr: system error parsing destination %s\n"),
- job_data->dest);
- syslog(LOG_DEBUG, "system error parsing destination %s",
- job_data->dest);
-
- exit(E_FAILURE);
- }
-
- } else {
- destination = job_data->dest;
- }
- syslog(LOG_DEBUG, "destination : %s", destination);
-
- /*
- * We are now ready to open a connection to the printer
- * and print each of the files
- */
-
- if (job_data->protocol == BSD) {
-
- /* set privileges to get reserved port */
- if (seteuid(0)) {
- syslog(LOG_DEBUG, "seteuid(0) failed, exiting netpr");
- exit(E_FAILURE);
- }
- if ((sockfd = net_open(destination, 20)) < 0) {
- (void) fprintf(stderr,
- gettext("Netpr: Cannot open connection to <%s>\n"),
- destination);
- syslog(LOG_DEBUG,
- "Cannot open connection to %s: retrying",
- destination);
- exit(E_RETRY);
- }
- } else {
- if ((sockfd = tcp_open(destination, tcpjob, 20)) == -1) {
- exit(E_RETRY);
- }
- }
-
- /* lower privileges as we now have the reserved port */
- if (setuid(getuid())) {
- syslog(LOG_DEBUG, "setuid() failed, exiting netpr");
- exit(E_FAILURE);
- }
-
-
- /* Set SO_KEEPALIVE on socket to keep open */
- if ((setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,
- (char *)&on, sizeof (on))) < 0) {
- syslog(LOG_DEBUG, "setsocket (SO_KEEPALIVE): %m");
- }
-
- if (job_data->protocol == BSD) {
- if ((jobstatus = bsd_print(sockfd, pa, bsdjob)) != 0) {
- (void) fprintf(stderr,
- gettext("Netpr: Error return from bsd_print <%d>\n"),
- jobstatus);
- syslog(LOG_DEBUG,
- "Error return from bsd_print <%d>", jobstatus);
- exit_status = E_RETRY;
- }
- } else {
- if ((jobstatus =
- tcp_print(sockfd, pa, tcpjob)) != 0) {
- (void) fprintf(stderr,
- gettext("Netpr: Error return from tcp_print <%d>\n"),
- jobstatus);
- syslog(LOG_DEBUG,
- "Error return from tcp_print <%d>", jobstatus);
- exit_status = E_RETRY;
- }
- }
-
- (void) close(fd);
- (void) close(sockfd);
- (void) munmap(pa, filesize);
-
- syslog(LOG_DEBUG, "exit status: %d", exit_status);
- return (exit_status);
-}
-
-static void
-usage_exit()
-{
- (void) fprintf(stderr,
- gettext("Usage: netpr -I request_id -p printer -d destination\n"));
- (void) fprintf(stderr,
- gettext("\t\t-U username [ -f type ] [ -T title ] [ -P protocol ]\n"));
- (void) fprintf(stderr,
- gettext("\t\t[-t timeout] [ -c ] [ -b ]\n"));
- (void) fprintf(stderr, gettext("\t\tfiles\n"));
- exit(E_BAD_INPUT);
-}
-
-/*ARGSUSED*/
-void
-pipehandler(int i)
-{
- (void) signal(SIGPIPE, pipehandler);
- syslog(LOG_DEBUG, "Received SIGPIPE, connection to printer broken");
- exit(E_SIGPIPE);
-}
diff --git a/usr/src/cmd/lp/model/netpr/netpr.h b/usr/src/cmd/lp/model/netpr/netpr.h
deleted file mode 100644
index f155690a3c..0000000000
--- a/usr/src/cmd/lp/model/netpr/netpr.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _NETPR_H
-#define _NETPR_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BSD 0
-#define TCP 1
-#define NOBANNER 0
-#define BANNER 1
-
-#define CONTROL_FIRST 0
-#define DATA_FIRST 1
-
-#define ERRORMSG 0
-#define OKMSG 1
-
-#define DEST_SEP ":"
-
-#define MAX_REQ_ID 3
-
-#define ASCII_UULONG_MAX 22
-
-#define XFER_REQUEST 2 /* \2printer\n */
-#define XFER_CLEANUP 1 /* \1 */
-#define XFER_CONTROL 2 /* \2size name\n */
-#define XFER_DATA 3 /* \3size name\n */
-#define PRINT_REQUEST 1 /* \1printer\n */
-#define REMOVE_REQUEST 5 /* \5printer person [users|jobs ...]\n */
-#define SHOW_QUEUE_SHORT_REQUEST 3 /* \3printer [users|jobs ...]\n */
-#define SHOW_QUEUE_LONG_REQUEST 4 /* \4printer [users|jobs ...]\n */
-
-
-#define E_SUCCESS 0
-#define E_FAILURE 1
-#define E_SYSTEM_ERROR 2
-#define E_BAD_FILE 3
-#define E_BAD_INPUT 4
-#define E_SYSTEM_ERR 5
-#define E_SEND_OK 6
-#define E_RETRY 129
-#define E_SIGPIPE 130
-
-
-#define NETWORK_ERROR_UNKNOWN 20
-#define NETWORK_ERROR_HOST 21
-#define NETWORK_ERROR_SERVICE 22
-#define NETWORK_ERROR_PORT 23
-#define NETWORK_ERROR_SEND_RESPONSE 24
-#define NETWORK_ERROR_SEND_FAILED 25
-#define NETWORK_ERROR_MSG_FAILED 26
-#define NETWORK_ERROR_WRITE_FAILED 27
-#define NETWORK_PRINTER_REFUSED_CONN 28
-#define NETWORK_READ_RESPONSE_FAILED 29
-
-
-#define MALLOC (int size, char * msg) \
- { \
- printf("File %s line %d\n", __FILE__, __LINE__); \
- printf("malloc: size: <%d>, for <%s>\n"); \
- malloc(size); \
- }
-
-
-typedef struct np_data np_data_t;
-typedef struct np_bsdjob np_bsdjob_t;
-typedef struct job np_job_t;
-typedef struct np_tcp_job np_tcpjob_t;
-
-/*
- * Contains the input data for this job.
- * Data is independent of protocol
- */
-
-struct job {
- char *filename;
- char *request_id;
- char *printer;
- char *dest;
- char *title;
- int protocol;
- char *username;
- int timeout;
- int banner;
- int filesize;
-};
-
-struct np_tcp_job {
- np_job_t * gen_data;
- char * np_port;
- char * np_host;
-};
-
-struct np_data {
- char *np_dfAfilename;
- char *np_path_file; /* /<path>/<filename> we are printing */
- long np_data_size; /* using stat, XXX mmap better?? */
- char *jobfile_data;
-};
-
-
-struct np_bsdjob {
- char *np_filename;
- char *np_request_id;
- char *np_printer;
- char *np_destination;
- char *np_title;
- char *np_username;
- int np_timeout;
- int np_banner;
- char *np_host;
- int np_print_order;
- char *np_cfAfilename;
- char *np_cfAfile;
- uint np_cfAfilesize;
- char np_df_letter; /* [A-Z][a-z] use this one */
- np_data_t *np_data;
-};
-
-extern char * long2str(long, char *);
-extern void null_sighandler(int);
-extern int open_network(char *, int);
-extern int xfer_file(int, caddr_t, int, int);
-extern int add_bsd_file(char *, np_bsdjob_t *);
-extern int start_bsd_job(int, char *);
-extern void done_and_close(int);
-extern void panic();
-extern char * alloc_str(char *);
-extern np_bsdjob_t * create_bsd_job(np_job_t *, int, int);
-extern np_tcpjob_t * create_tcp_job(np_job_t *, int);
-extern int net_send_cmd(int, char *, ...);
-extern np_job_t * init_job(void);
-extern int bsd_print(int, caddr_t, np_bsdjob_t *);
-extern int tcp_print(int, caddr_t, np_tcpjob_t *);
-extern int tcp_open(char *, np_tcpjob_t *, int);
-extern void tell_lptell(int, char *, ...);
-extern int net_open(char *, int);
-extern void parse_dest(char *, char **, char **, char *);
-extern int check_file(char *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NETPR_H */
diff --git a/usr/src/cmd/lp/model/netpr/tcp_misc.c b/usr/src/cmd/lp/model/netpr/tcp_misc.c
deleted file mode 100644
index 8412550d4d..0000000000
--- a/usr/src/cmd/lp/model/netpr/tcp_misc.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <libintl.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <strings.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include "netpr.h"
-#include "netdebug.h"
-
-#define MAX_NLPS 60 /* Max no. loops in while */
-
-np_tcpjob_t *
-create_tcp_job(np_job_t *genjob, int filesize)
-{
- np_tcpjob_t *tcpjob;
-
- if (genjob == NULL)
- return (NULL);
-
- tcpjob = (np_tcpjob_t *)malloc(sizeof (np_tcpjob_t));
- ASSERT(tcpjob, MALLOC_ERR);
- (void) memset(tcpjob, 0, sizeof (np_tcpjob_t));
-
- tcpjob->np_port = "9100";
- tcpjob->gen_data = genjob;
- tcpjob->gen_data->filesize = filesize;
-
- return (tcpjob);
-}
-
-int
-tcp_open(char *dest, np_tcpjob_t *tcpjob, int timeout)
-{
- struct hostent *hp;
- struct sockaddr_in6 serv_addr;
- int s,
- err,
- error_num;
- unsigned timo = 1;
- int retry;
- int rtnerr;
-
- /*
- * Get the host address and port number to connect to.
- */
- if (dest == NULL) {
- return (-1);
- }
-
- if ((hp = (getipnodebyname(dest, AF_INET6, AI_DEFAULT,
- &error_num))) == NULL) {
- (void) fprintf(stderr,
- gettext("Netpr: System call getipnodebyname fails\n"));
- syslog(LOG_DEBUG, "System call getipnodebyname fails "
- "getipnodebyname() returned %d", error_num);
- return (-1);
- }
-
- (void) memset(&serv_addr, 0, sizeof (struct sockaddr_in6));
- bcopy(hp->h_addr, (caddr_t)&serv_addr.sin6_addr, hp->h_length);
- serv_addr.sin6_family = hp->h_addrtype;
- serv_addr.sin6_port = (int)htons(atoi(tcpjob->np_port));
-
- do {
-
- retry = 0;
- rtnerr = 0;
- /*
- * Try connecting to the printer.
- */
- s = socket(PF_INET6, SOCK_STREAM, 0);
- if (s < 0) {
- (void) fprintf(stderr,
- gettext("Netpr: System call socket fails\n"));
- syslog(LOG_DEBUG, "System call socket fails");
- rtnerr = -1;
- } else {
- (void) signal(SIGALRM, null_sighandler);
- (void) alarm(timeout);
- if (connect(s, (struct sockaddr *)&serv_addr,
- sizeof (serv_addr)) < 0) {
- err = errno;
- (void) alarm(0);
- errno = err;
-
- if (errno == ECONNREFUSED && timo <= 16) {
- (void) sleep(timo);
- timo *= 2;
- retry++;
- } else {
- (void) fprintf(stderr,
- gettext("Netpr: Cannot connect to printer\n"));
- syslog(LOG_DEBUG, "Cannot connect to printer");
- rtnerr = -1;
- }
- /* The connect on this socket failed; close it */
- (void) close(s);
- } else
- (void) alarm(0);
- }
-
- } while (retry);
-
- return ((rtnerr) ? rtnerr : s);
-}
-
-
-int
-tcp_print(int sockfd, caddr_t pa, np_tcpjob_t *tcpjob)
-{
- char c;
- int xfer;
- char buf[BUFSIZ + 1];
- int nr = 0;
- int ctr = 0;
- int msg_given = 0;
- int nlps = 0;
-
- if ((xfer = xfer_file(sockfd, pa,
- tcpjob->gen_data->filesize, tcpjob->gen_data->timeout)) < 0) {
- return (xfer);
- }
-
- if ((shutdown(sockfd, 1)) != 0) {
- (void) fprintf(stderr,
- gettext("Netpr: System error: possible loss of data\n"));
- syslog(LOG_DEBUG,
- "shutdown error; possible loss of data");
- return (E_SYSTEM_ERROR);
- }
-
-
- /* read in single character ack or msg from printer */
-
- (void) memset(buf, 0, BUFSIZ + 1);
- while (ctr < BUFSIZ) {
- (void) signal(SIGALRM, null_sighandler);
- (void) alarm(2);
- errno = 0;
- nr = read(sockfd, &c, 1);
- (void) alarm(0);
- if (errno == EINTR) {
- if (msg_given == 0) {
- tell_lptell(ERRORMSG,
- gettext("Printer not responding;" \
- "Either warming up or needs attention\n"));
- msg_given++;
- }
-
- /* if no ACK received, do not loop forever */
-
- if (nlps++ >= MAX_NLPS) {
- syslog(LOG_DEBUG, "No final ack received");
- break;
- }
- } else {
- if ((buf[ctr++] = c) == '\n' || (nr == 0))
- break;
- }
- }
- if (ctr > 1)
- syslog(LOG_DEBUG, "Message from tcp printer on read: %s",
- buf);
-
- if (msg_given && (nlps < MAX_NLPS)) {
- (void) fprintf(stderr, gettext("Printer ok\n"));
- tell_lptell(OKMSG, "Current");
- }
-
- return (E_SUCCESS);
-}
diff --git a/usr/src/cmd/lp/model/netstandard b/usr/src/cmd/lp/model/netstandard
deleted file mode 100644
index 0b428fdcd4..0000000000
--- a/usr/src/cmd/lp/model/netstandard
+++ /dev/null
@@ -1,644 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#pragma ident "%Z%%M% %I% %E% SMI"
-###########
-##
-## Network Standard printer interface program.
-##
-###########
-
-#####
-# We can't do much except exit if spooler/scheduler
-# cancels us.
-#####
-trap 'eval exit_clean 15' 15
-
-####
-#
-# Send standard error messages to /dev/null rather than to
-# the spooler. Avoids "Terminated" messages that shell puts out
-# when gets SIGTERM. Save standard error so it can be used
-# when we need it
-####
-exec 5>&2 2>/dev/null 3>&1
-
-####
-# set some global variables
-####
-
-: ${LPTMPDIR:=/tmp}
-: ${SPOOLDIR:=/usr/spool/lp}
-: ${LOCALPATH:=${SPOOLDIR}/bin}
-PATH="/bin:/usr/bin:${LOCALPATH}"
-exit_code=0
-
-
-# ${LPTELL} is the name of a program that will send its
-# standard input to the Spooler. It is used to forward
-# the description of a printer fault to the Spooler,
-# which uses it in an alert to the administrator.
-#####
-if [ ! -x "${LPTELL:=${LOCALPATH}/lp.tell}" ]
-then
- fake_lptell () {
- header="no"
- while read line
- do
- if [ "no" = "${header}" ]
- then
- errmsg ERROR ${E_IP_UNKNOWN} \
- "unknown printer/interface failure" \
- "consult your system administrator;
- reasons for failure (if any) follow:"
- header=yes
- fi
- echo "${line}" >&2
- done
- return 1
- }
- LPTELL=fake_lptell
-fi
-
-#####
-# Error message formatter:
-#
-# Invoke as
-#
-# errmsg severity message-number problem help
-#
-# where severity is "ERROR" or "WARNING", message-number is
-# a unique identifier, problem is a short description of the
-# problem, and help is a short suggestion for fixing the problem.
-#####
-
-LP_ERR_LABEL="UX:lp"
-E_IP_ARGS=1
-E_IP_OPTS=2
-#E_IP_FILTER=3
-E_IP_UNKNOWN=5
-E_IP_BADFILE=6
-E_IP_ERRORS=12 # (in slow.filter)
-
-errmsg () {
-
- case $1 in
- ERROR )
- sev=" ERROR";
- ;;
- WARNING )
- sev="WARNING";
- ;;
- esac
-
- echo "${LP_ERR_LABEL}:$2 ${sev}: $3
- TO FIX: $4" >&5
-}
-
-###########
-##
-## Check arguments
-###########
-
-parse () {
- echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
-}
-
-#####
-##
-## Error Cleanup and Exit
-##
-#####
-
-exit_clean()
-{
-
- if [ -f "${LPTMPDIR}/pr_eexit_code.$$" ]
- then
- /bin/rm ${LPTMPDIR}/pr_eexit_code.$$
- fi
-
- if [ -f "${LPTMPDIR}/small_banner.$$" ]
- then
- /bin/rm ${LPTMPDIR}/small_banner.$$
- fi
-
- if [ -f "${tmpfile}" ]
- then
- /bin/rm "${tmpfile}"
- fi
-
- exit $1
-}
-
-#####
-#
-# This program is invoked as
-#
-# ${SPOOLDIR}/.../printer request-id user title copies options files...
-#
-# The first three arguments are simply reprinted on the banner page,
-# the fourth (copies) is used to control the number of copies to print,
-# the fifth (options) is a blank separated list (in a single argument)
-# of user or Spooler supplied options (without the -o prefix),
-# and the last arguments are the files to print.
-#####
-
-if [ $# -lt 5 ]
-then
-
- errmsg ERROR ${E_IP_ARGS} \
- "wrong number of arguments to interface program" \
- "consult your system administrator"
- exit 1
-fi
-
-printer=`basename $0`
-request_id=$1
-user_name=$2
-title=$3
-copies=$4
-option_list=$5
-
-shift 5
-files="$*"
-
-
-#
-# debug sent to file if defined in /etc/syslog.conf
-# syslog.conf entry:
-# lpr.debug /path/filename
-#
-logger -p lpr.debug -t "netstandard: ${request_id}" " "
-logger -p lpr.debug -t "netstandard: ${request_id}" "INPUT"
-logger -p lpr.debug -t "netstandard: ${request_id}" " printer : ${printer}"
-logger -p lpr.debug -t "netstandard: ${request_id}" " request_id : ${request_id}"
-logger -p lpr.debug -t "netstandard: ${request_id}" " user_name : ${user_name}"
-logger -p lpr.debug -t "netstandard: ${request_id}" " title : ${title}"
-logger -p lpr.debug -t "netstandard: ${request_id}" " copies : ${copies}"
-logger -p lpr.debug -t "netstandard: ${request_id}" " option_list : ${option_list}"
-logger -p lpr.debug -t "netstandard: ${request_id}" " files : ${files}"
-logger -p lpr.debug -t "netstandard: ${request_id}" " spooler_key ${SPOOLER_KEY}"
-
-####
-# default: do print a banner
-####
-nobanner=no
-nofilebreak="no"
-inlist=
-data_file_flag=
-
-for i in ${option_list}
-do
- case "${inlist}${i}" in
-
- nobanner )
- nobanner="yes"
- ;;
-
- nofilebreak )
- nofilebreak="yes"
- ;;
-
- #####
- #
- # If you want to add simple options (e.g. -o simple)
- # identify them here.
- #####
-# simple )
-# simple="yes"
-# ;;
-
- cpi=pica )
- cpi=10
- ;;
- cpi=elite )
- cpi=12
- ;;
- cpi=* )
- cpi=`parse ${i}`
- ;;
-
- lpi=* )
- lpi=`parse ${i}`
- ;;
-
- length=* )
- length=`parse ${i}`
- ;;
-
- width=* )
- width=`parse ${i}`
- ;;
- dest=* )
- dest="-d `parse ${i}`"
- ;;
-
- protocol=* )
- protocol="-P `parse ${i}`"
- ;;
- bsdctrl=* )
- controlfile="-c `parse ${i}`"
- ;;
- timeout=* )
- timeout="-t `parse ${i}`"
- ;;
-
- data-file-type=* )
- data_file_flag="-f `parse ${i}`"
- ;;
-
- #####
- #
- # If you want to add simple-value options (e.g. -o value=a)
- # identify them here.
- #####
-# value=* )
-# value=`parse ${i}`
-# ;;
-
- #####
- #
- # If you want to add options that,
- # take a list (e.g. -o lopt='a b c'), identif
- # them here and below (look for LOPT).
- #####
-
-# flist=* | lpd=* | options=* )
- flist=* | lpd=* )
-#LOPT stty=* | flist=* | lpd=* | lopt=* )
-
- inlist=`expr "${inlist}${i}" : "^\([^=]*=\)"`
- case "${i}" in
- ${inlist}\'*\' )
- item=`expr "${i}" : "^[^=]*='*\(.*\)'\$"`
- ;;
- ${inlist}\' )
- continue
- ;;
- ${inlist}\'* )
- item=`expr "${i}" : "^[^=]*='*\(.*\)\$"`
- ;;
- ${inlist}* )
- item=`expr "${i}" : "^[^=]*=\(.*\)\$"`
- ;;
- *\' )
- item=`expr "${i}" : "^\(.*\)'\$"`
- ;;
- * )
- item="${i}"
- ;;
- esac
-
- #####
- #
- # We don't dare use "eval" because a clever user could
- # put something in an option value that we'd end up
- # exec'ing.
- #####
- case "${inlist}" in
- flist= )
- flist="${flist} ${item}"
- ;;
- lpd= )
- lpd="${lpd} ${item}"
- ;;
-#LOPT lopt= )
-#LOPT lopt="${lopt} ${item}"
-#LOPT ;;
-# options= )
-# options="${options} ${item}"
-# ;;
- esac
-
- case "${i}" in
- ${inlist}\'*\' )
- inlist=
- ;;
- ${inlist}\'* )
- ;;
- *\' | ${inlist}* )
- inlist=
- ;;
- esac
- ;;
-
- * )
- errmsg WARNING ${E_IP_OPTS} \
- "unrecognized \"-o ${i}\" option" \
- "check the option, resubmit if necessary
- printing continues"
- ;;
- esac
-done
-
-logger -p lpr.debug -t "netstandard: ${request_id}" "term : ${TERM}"
-
-if [ -z "${FILTER}" ]
-then
- #####
- #
- # If no filter is being used, we use netpr to push the
- # file to the printer.
- # (QUOTES ARE IMPORTANT!)
- #####
-
- case "$TERM" in
- PS )
- # make the "postscript" printers use netpr
- FILTER=
- ;;
- PSR )
- # make the "reverse postscript" printers reverse the
- # output and the use postio to talk to the printer
- #FILTER="/usr/lib/lp/postscript/postreverse "
- #FILTER=
- FILTER="/usr/lib/lp/postscript/postreverse "
- ;;
- * )
- # We don't know the type, so just assume that the
- # input and output are the same. Use netpr.
- #FILTER=/bin/cat
- FILTER=
- ;;
- esac
-fi
-
-####
-# sets default value for ordering of data and control files with
-# bsd protocol. Default: data files first. Administrator
-# may set to control file first with lpadmin -o bsdctrl=first
-####
-
-banner_flag=""
-case "${nobanner}" in
- yes )
- banner_flag="-b"
- ;;
-esac
-
-NETPR="/usr/lib/lp/bin/netpr ${banner_flag} ${data_file_flag} \
- -I ${request_id} -U ${user_name} \
- -p ${printer} ${dest} -T \"${title}\" \
- ${timeout} ${protocol} ${controlfile} "
-LPTELL_OPTS="-l" # netpr sends LaserWriter style messages back
-
-logger -p lpr.debug -t "netstandard: ${request_id}" "NETPR= ${NETPR}"
-logger -p lpr.debug -t "netstandard: ${request_id}" "filter : ${FILTER}"
-
-node=`uname -n`
-pid=$$
-tmpfile=${LPTMPDIR}/${node}.${pid}
-
-logger -p lpr.debug -t "netstandard: ${request_id}" "tmpfile : ${tmpfile}"
-
-#####
-#
-# Set up filter for banner page
-#
-#####
-banner_filter=
-case "${TERM}" in
-PS | PSR )
- banner_filter=" | /usr/lib/lp/postscript/postprint "
- LPTELL_OPTS="-l"
- ;;
-esac
-
-#####
-#
-# Build temporary file that is the banner page
-#
-#####
-PAD="#####${NL}"
-CR="\r"
-NL="${CR}\n"
-FF=
-
-small_banner() {
- echo "${CR}\c"
- echo "${PAD}\c"
- echo "##### User: ${user_name}${NL}\c"
- if [ -n "${title}" ]
- then
- echo "##### Title: ${title}${NL}\c"
- fi
- echo "##### Date: `LANG=C date '+%a %H:%M %h %d, %Y'`${NL}\c"
- echo "##### Job: ${request_id}${NL}\c"
- echo "${PAD}\c"
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-#####
-#
-# Doing small banner as we don't know what printer is out there
-#
-#####
-banner=small_banner
-
-if [ "no" = "${nobanner}" ]
-then
- eval "${banner} ${banner_filter}" 2>&1 1>${LPTMPDIR}/small_banner.$$
-fi
-
-#####
-#
-# Print banner page before job unless PSR
-#
-#####
-
-
-if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" ]
-then
- (
- eval ${NETPR} ${LPTMPDIR}/small_banner.$$ 2>&1
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug -t "netstandard: ${request_id}" \
- "banner page exit code : ${exit_code}"
-
-fi
-
-i=1
-while [ $i -le $copies ]
-do
- for file in ${files}
- do
- if [ -r "${file}" ]
- then
-
- if [ ! -z "${FILTER}" ]
- then
- (
- #####
- # There is a filter, use it
- #
- # Put 0<${file} before the "eval" to keep
- # clever users from giving a file name that
- # evaluates as something to execute.
- # Redirect stderr to stdout so LPTELL will
- # get error messages from pipe.
- #####
-
- 0<${file} eval ${FILTER} 2>&1 1>${tmpfile}
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug -t "netstandard: ${request_id}" \
- "filter exit_code : ${exit_code}"
-
- if [ -n "${exit_code}" ]
- then
- if [ "${exit_code}" -eq 0 ]
- then
- printfile=${tmpfile}
- else
- ####
- # The filter did not succeed, so don't try to print
- ####
- printfile=
- fi
- fi
-
- else
- printfile=${file}
- fi
-
- logger -p lpr.debug -t "netstandard: ${request_id}" \
- "printfile : ${printfile}"
-
- #####
- # Print the file
- #####
-
- if [ -r "${printfile}" ]
- then
- (
- eval ${NETPR} ${printfile} 2>&1
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug -t "netstandard: ${request_id}" \
- "netpr exit_code : ${exit_code}"
-
- if [ -f "${tmpfile}" ]
- then
- /bin/rm "${tmpfile}"
- fi
-
- if [ -n "${exit_code}" ]
- then
- if [ "${exit_code}" -eq 0 ]
- then
- printone=yes
- else
- if [ "${exit_code}" -lt 128 ]
- then
- noprint=yes
- else
- retry=yes
- fi
- fi
- fi
-
-
- else
-
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read temporary file \"${printfile}\""\
- "see if file still exists,
- or consult your system administrator;
- printing continues"
-
- fi
- else
-
- #####
- #
- # Don't complain about not being able to read
- # a file on second and subsequent copies, unless
- # we've not complained yet. This removes repeated
- # messages about the same file yet reduces the
- # chance that the user can remove a file and not
- # know that we had trouble finding it.
- #####
-
- if [ "${i}" -le 1 -o -z "${badfileyet}" ]
- then
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read file \"${file}\"" \
- "see if the file still exists and is readable,
- or consult your system administrator;
- printing continues"
- badfileyet=yes
- fi
-
- fi
-
-# for file in ${files}
- done
- i=`expr $i + 1`
-done
-
-#####
-#
-# If printing in reverse order, print the banner page now
-#
-#####
-
-if [ "no" = "${nobanner}" -a "${TERM}" = "PSR" ]
-then
-(
- eval ${NETPR} ${LPTMPDIR}/small_banner.$$ 2>&1
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
-) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-fi
-
-exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
-logger -p lpr.debug -t "netstandard: ${request_id}" \
- "banner page exit code : ${exit_code}"
-
-if [ -n "${printone}" -a -z "${retry}" -a -z "${noprint}" ]
-then
- exit_code=`expr 0`
-else
- if [ -n "${retry}" -a -z "${printone}" -a -z "${noprint}" ]
- then
- exit_code=`expr 129`
- else
- exit_code=`expr 1`
- fi
-fi
-
-logger -p lpr.debug -t "netstandard: ${request_id}" \
- "FINAL exit_code : ${exit_code}"
-
-exit_clean ${exit_code}
diff --git a/usr/src/cmd/lp/model/standard b/usr/src/cmd/lp/model/standard
deleted file mode 100644
index 5823de6d6e..0000000000
--- a/usr/src/cmd/lp/model/standard
+++ /dev/null
@@ -1,1078 +0,0 @@
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.26 */
-
-###########
-##
-## Standard printer interface program.
-###########
-
-#####
-#
-# Until we get to the point below where the printer port
-# and physical printer are initialized, we can't do much
-# except exit if the Spooler/Scheduler cancels us.
-#####
-trap 'exit' 15
-
-#####
-#
-# We can be clever about getting a hangup or interrupt, though, at least
-# until the filter runs. Do this early, even though $LPTELL
-# isn't defined, so that we're covered.
-#####
-catch_hangup () {
- if [ -n "${LPTELL}" ]
- then
- echo \
-"The connection to the printer dropped; perhaps the printer went off-line?" \
- | ${LPTELL} ${printer}
- fi
- return 0
-}
-catch_interrupt () {
- if [ -n "${LPTELL}" ]
- then
- echo \
-"Received an interrupt from the printer. The reason is unknown,
-although a common cause is that the baud rate is too high." \
- | ${LPTELL} ${printer}
- fi
- return 0
-}
-trap 'catch_hangup; exit_code=129 exit 129' 1
-trap 'catch_interrupt; exit_code=129 exit 129' 2 3
-
-#####
-#
-# Most of the time we don't want the standard error to be captured
-# by the Spooler, mainly to avoid "Terminated" messages that the
-# shell puts out when we get a SIGTERM. We'll save the standard
-# error channel under another number, so we can use it when it
-# should be captured.
-#
-# Open another channel to the printer port, for use when the
-# regular standard output won't be directed there, such as in
-# command substitution (`cmd`).
-#####
-exec 5>&2 2>/dev/null 3>&1
-
-#####
-#
-# Set some globally used variables and functions.
-#####
-
-: ${TMPDIR:=/tmp}
-: ${SPOOLDIR:=/usr/spool/lp}
-: ${TERMINFO:=/usr/lib/terminfo}
-: ${CHARSETDIR:=/usr/lib/charsets}
-
-: ${LOCALPATH:=${SPOOLDIR}/bin}
-PATH="/bin:/usr/bin:${LOCALPATH}"
-
-MAX_COLS_SMALL_BANNER=40
-
-#####
-#
-# On the 3.2 release of the 386unix product, the parallel port does
-# not support any ioctl calls. As a result, we cannot set the opost
-# and onlcr attributes to have <NL>'s expanded to <CR><NL>. This
-# "filter" gets the job done for us.
-#####
-: ${FIX386BD:=${LOCALPATH}/386parallel}
-if [ -n "${FIX386BD}" -a -x "${FIX386BD}" ]
-then
- FIX386BD="| ${FIX386BD}"
-else
- FIX386BD=""
-fi
-
-#####
-# Use ${TMPPREFIX} as the prefix for all temporary files, so
-# that cleanup is easy. The prefix may be up to 13 characters
-# long, so you only have space for one more character to make
-# a file name. If necessary, make a directory using this prefix
-# for better management of unique temporary file names.
-#####
-TMPPREFIX=${TMPDIR}/`uname -n`$$
-
-#####
-# Before exiting, set ${exit_code} to the value with which to exit.
-# Otherwise, the exit from this script will be 0.
-#####
-trap 'rm -fr ${TMPPREFIX}*; exit ${exit_code}' 0
-
-#####
-# ${LPTELL} is the name of a program that will send its
-# standard input to the Spooler. It is used to forward
-# the description of a printer fault to the Spooler,
-# which uses it in an alert to the administrator.
-#####
-if [ ! -x "${LPTELL:=${LOCALPATH}/lp.tell}" ]
-then
- fake_lptell () {
- header="no"
- while read line
- do
- if [ "no" = "${header}" ]
- then
- errmsg ERROR ${E_IP_UNKNOWN} \
- "unknown printer/interface failure" \
- "consult your system administrator;
- reasons for failure (if any) follow:"
- header=yes
- fi
- echo "${line}" >&2
- done
- return 1
- }
- LPTELL=fake_lptell
-fi
-
-#####
-# ${DRAIN} is the name of a program that will wait
-# long enough for data sent to the printer to print.
-#####
-if [ -x "${LOCALPATH}/drain.output" ]
-then
- DRAIN="${LOCALPATH}/drain.output 5" # wait only five seconds
-else
- DRAIN=
-fi
-
-#####
-# ${LPCAT} is the name of a program to use as a default
-# filter. Minimally it should copy its standard input to
-# the standard output, but it should also trap printer
-# faults. The current LPCAT traps hangups (DCD dropping, SIGHUP),
-# interrupts (SIGINT, SIGQUIT), broken pipe (SIGPIPE), and
-# excess delays in sending data to the printer, interpreting all
-# as printer faults.
-#####
-if [ ! -x "${LPCAT:=${LOCALPATH}/lp.cat}" ]
-then
- LPCAT="cat"
-fi
-
-#####
-# ${LPSET} is the name of a program that will set the
-# character pitch, line pitch, page width, page length,
-# and character set. It helps to have this in a single
-# binary program so that (1) it's faster than calls
-# to "tput"; and (2) it can access the new Terminfo
-# capabilities for printers (on pre SVR3.2 machines, tput can't).
-#####
-if [ ! -x "${LPSET:=${LOCALPATH}/lp.set}" ]
-then
- fake_lpset () {
- echo H V W L S >&2
- false
- }
- LPSET=fake_lpset
-fi
-
-internal_lpset () {
- #####
- #
- # The funny business with the "2>&1 1>&3" is to let us capture
- # the standard ERROR, not the standard OUTPUT as is the usual case
- # with foo=`cmd`. The standard output will go to the printer.
- #####
- [ -n "${stty1}" ] && stty ${stty1} 0<&1
- chk=`${LPSET} "$1" "$2" "$3" "$4" "$5" 2>&1 1>&3`
- [ -n "${stty2}" ] && stty ${stty2} 0<&1
-
- #####
- #
- # The standard error of the delivered ${LPSET} program
- # is a string of letters, H, V, W, L, S, which correspond
- # to cpi, lpi, width, length, and character set. A letter
- # is present only if the corresponding attribute could not
- # be set.
- #####
- for err in ${chk}
- do
- case ${err} in
- H )
- errmsg WARNING ${E_IP_BADCPI} \
- "can't select the character pitch \"${cpi}\"" \
- "check the valid pitches for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- V )
- errmsg WARNING ${E_IP_BADLPI} \
- "can't select the line pitch \"${lpi}\"" \
- "check the valid pitches for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- W )
- width=${cols}
- errmsg WARNING ${E_IP_BADWIDTH} \
- "can't select the page width \"${width}\"" \
- "check the valid widths for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- L )
- length=${lines}
- errmsg WARNING ${E_IP_BADLENGTH} \
- "can't select the page length \"${length}\"" \
- "check the valid lengths for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- S )
- errmsg WARNING ${E_IP_BADCHARSET} \
- "can't select the character set \"${CHARSET}\"" \
- "check the name given in the -S option,
- or consult your system administrator;
- printing continues"
- ;;
- esac
- done
-}
-
-
-#####
-# ${TPUT} is "tput" IF it works. We'll disable it if we get an
-# ugly error message the first time we use it. See the TERM variable
-# later in the script.
-#
-# NOTE: The check we use to see if "tput" works is to use an OLD
-# Terminfo capability, like "lines". If it works with that it may
-# still fail with some of the newer capabilities like "init" (SVR3.0)
-# or "swidm" (SVR3.2), because the version of "tput" we have on your
-# machine is older. Thus, on some of the code where ${TPUT} is used
-# you'll see "2>/dev/null" being used to avoid ugly error messages.
-#####
-TPUT=tput
-
-#####
-# Error message formatter:
-#
-# Invoke as
-#
-# errmsg severity message-number problem help
-#
-# where severity is "ERROR" or "WARNING", message-number is
-# a unique identifier, problem is a short description of the
-# problem, and help is a short suggestion for fixing the problem.
-#####
-
-LP_ERR_LABEL="UX:lp"
-
-E_IP_ARGS=1
-E_IP_OPTS=2
-#E_IP_FILTER=3
-E_IP_STTY=4
-E_IP_UNKNOWN=5
-E_IP_BADFILE=6
-E_IP_BADCHARSET=7
-E_IP_BADCPI=8
-E_IP_BADLPI=9
-E_IP_BADWIDTH=10
-E_IP_BADLENGTH=11
-E_IP_ERRORS=12 # (in slow.filter)
-
-errmsg () {
- case $1 in
- ERROR )
- sev=" ERROR";
- ;;
- WARNING )
- sev="WARNING";
- ;;
- esac
-# tag=`expr "${LP_ERR_LABEL}" : "\(.*\):"``expr "${LP_ERR_LABEL}" : ".*:\(.*\)"`
- echo "${LP_ERR_LABEL}: ${sev}: $3
- TO FIX: $4" >&5
-}
-
-
-###########
-##
-## Check arguments
-###########
-
-parse () {
- echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
-}
-
-#####
-#
-# This program is invoked as
-#
-# ${SPOOLDIR}/.../printer request-id user title copies options files...
-#
-# The first three arguments are simply reprinted on the banner page,
-# the fourth (copies) is used to control the number of copies to print,
-# the fifth (options) is a blank separated list (in a single argument)
-# of user or Spooler supplied options (without the -o prefix),
-# and the last arguments are the files to print.
-#####
-
-if [ $# -lt 5 ]
-then
- errmsg ERROR ${E_IP_ARGS} \
- "wrong number of arguments to interface program" \
- "consult your system administrator"
- exit 1
-fi
-
-printer=`basename $0`
-request_id=$1
-user_name=$2
-title=$3
-copies=$4
-option_list=$5
-
-shift 5
-files="$*"
-
-nobanner="no"
-nofilebreak="no"
-stty=
-
-inlist=
-for i in ${option_list}
-do
- case "${inlist}${i}" in
-
-
- nobanner )
- nobanner="yes"
- ;;
-
- nofilebreak )
- nofilebreak="yes"
- ;;
-
- #####
- #
- # If you want to add simple options (e.g. -o simple)
- # identify them here.
- #####
-# simple )
-# simple="yes"
-# ;;
-
-
- cpi=pica )
- cpi=10
- ;;
- cpi=elite )
- cpi=12
- ;;
- cpi=* )
- cpi=`parse ${i}`
- ;;
-
- lpi=* )
- lpi=`parse ${i}`
- ;;
-
- length=* )
- length=`parse ${i}`
- ;;
-
- width=* )
- width=`parse ${i}`
- ;;
-
- #####
- #
- # If you want to add simple-value options (e.g. -o value=a)
- # identify them here.
- #####
-# value=* )
-# value=`parse ${i}`
-# ;;
-
-
- #####
- #
- # If you want to add options that, like "stty",
- # take a list (e.g. -o lopt='a b c'), identify
- # them here and below (look for LOPT).
- #####
- stty=* | flist=* | lpd=* )
-#LOPT stty=* | flist=* | lpd=* | lopt=* )
-
- inlist=`expr "${inlist}${i}" : "^\([^=]*=\)"`
- case "${i}" in
- ${inlist}\'*\' )
- item=`expr "${i}" : "^[^=]*='*\(.*\)'\$"`
- ;;
- ${inlist}\' )
- continue
- ;;
- ${inlist}\'* )
- item=`expr "${i}" : "^[^=]*='*\(.*\)\$"`
- ;;
- ${inlist}* )
- item=`expr "${i}" : "^[^=]*=\(.*\)\$"`
- ;;
- *\' )
- item=`expr "${i}" : "^\(.*\)'\$"`
- ;;
- * )
- item="${i}"
- ;;
- esac
-
- #####
- #
- # We don't dare use "eval" because a clever user could
- # put something in an option value that we'd end up
- # exec'ing.
- #####
- case "${inlist}" in
- stty= )
- stty="${stty} ${item}"
- ;;
- flist= )
- flist="${flist} ${item}"
- ;;
- lpd= )
- lpd="${lpd} ${item}"
- ;;
-#LOPT lopt= )
-#LOPT lopt="${lopt} ${item}"
-#LOPT ;;
- esac
-
- case "${i}" in
- ${inlist}\'*\' )
- inlist=
- ;;
- ${inlist}\'* )
- ;;
- *\' | ${inlist}* )
- inlist=
- ;;
- esac
- ;;
-
- * )
- errmsg WARNING ${E_IP_OPTS} \
- "unrecognized \"-o ${i}\" option" \
- "check the option, resubmit if necessary
- printing continues"
- ;;
- esac
-done
-
-#####
-#
-# Additional ``parameters'' are passed via Shell environment
-# variables:
-#
-# TERM The printer type (used for Terminfo access)
-# CHARSET The character set to choose
-# FILTER The filter to run
-#####
-
-#####
-# Set defaults for unset variables.
-#####
-
-: ${TERM:=unknown}
-tput lines 1>/dev/null 2>&1 || TPUT=:
-
-: ${CHARSET:=cs0}
-
-if [ -z "${FILTER}" ]
-then
- #####
- #
- # If no filter is being used, we have a little routine that
- # will push the data to the printer. It traps hangups (loss
- # of carrier) and checks for excessive delays in sending the
- # data to the printer. The lesser of the print rate of the printer
- # (obtained from Terminfo) or the baud rate is used to compute
- # the expected delay. If neither of these is correct, you
- # may be experiencing false alarms. If so, give the correct
- # rate, in characters per second, as a single argument.
- # An argument of 0 means don't check for delays.
- # Give an -r option to get a printout of actual delays.
- # (QUOTES ARE IMPORTANT!)
- #####
- case "$TERM" in
- PS )
- # make the "postscript" printers use postio to
- # talk to the printer and periodically get a
- # status from them
- FILTER="/usr/lib/lp/postscript/postio"
- ;;
- PSR )
- # make the "reverse postscript" printers reverse the
- # output and the use postio to talk to the printer
- FILTER="/usr/lib/lp/postscript/postreverse | \
- /usr/lib/lp/postscript/postio"
- ;;
- * )
- # we don't know the type, so just assume that the
- # input and output are the same
- if [ `basename "${LPCAT}"` = "lp.cat" ] ; then
- FILTER="${LPCAT} 0" # infinite delays
- # FILTER="${LPCAT} 120" # e.g. 120 CPS
- # FILTER="${LPCAT} -r 0 2>/tmp/delays"
- # FILTER=${LPCAT}
- fi
- ;;
- esac
-fi
-
-###########
-##
-## Initialize the printer port
-###########
-
-#####
-#
-# SERIAL PORTS:
-# Initialize everything.
-#
-# PARALLEL PORTS:
-# Don't initialize baud rate.
-#
-# It's not obvious how to tell if a port is parallel or serial.
-# However, by splitting the initialization into two steps and letting
-# the serial-only part fail nicely, it'll work.
-#
-# Another point: The output must be a ``tty'' device. If not, don't
-# bother with any of this.
-#####
-stty1= stty2=
-tty 0<&1 1>/dev/null 2>&1 && {
-
- #####
- #
- # First set the default parameters,
- # then the requested parameters.
- #####
-
- stty \
- 9600 \
- 0<&1 2>/dev/null 1>&2
- stty \
- cs8 -cstopb -parenb -parodd \
- ixon -ixany \
- opost -olcuc onlcr -ocrnl -onocr -onlret -ofill \
- nl0 cr0 tab0 bs0 vt0 ff0 \
- 0<&1 2>/dev/null 1>&2
-
- if [ -n "${stty}" ]
- then
- if stty ${stty} 0<&1 1>/dev/null 2>&5
- then
- :
- else
- errmsg ERROR ${E_IP_STTY} \
- "stty option list failed" \
- "check the \"-o stty\" option you used,
- or consult your system administrator"
- exit 1
- fi
- fi
-
- #####
- #
- # Here you may want to add other port initialization code.
- # Some examples:
- #
- # estty # for printer needing hardware flow control (3B2/EPORTS)
- # fctty # for printer needing hardware flow control (3B15,3B20)
- #####
- #estty 0<&1
- #fctty 0<&1
-
-
- ##########
- #
- # Find out if we have to turn off opost before initializing the
- # printer and on after. Likewise, check clocal.
- #
- # Turning OFF opost (output postprocessing) keeps the UNIX system
- # from changing what we try to send to the printer. Turning ON
- # clocal keeps the UNIX system from dropping what we are trying to
- # send if the printer drops DTR. An example of the former is the
- # AT&T 479, which wants to send a linefeed (ASCII 10) when a page
- # width of 10 is set; with opost on, this COULD BE turned into a
- # carriage-return/linefeed pair. An example of the latter is the
- # AT&T 455, which momentarily drops DTR when it gets the
- # initialization string, is2; with clocal off, the UNIX system
- # stops sending the rest of the initialization sequence at that
- # point.
- #
- # THIS CODE MUST FOLLOW THE REST OF THE PORT INITIALIZATION CODE.
- ##########
- cur_stty=`stty -a 0<&3`
- expr "${cur_stty}" : '.*-opost' 1>/dev/null 2>&1 \
- || stty1="${stty1} -opost" stty2="${stty2} opost"
- expr "${cur_stty}" : '.*-clocal' 1>/dev/null 2>&1 \
- && stty1="${stty1} clocal" stty2="${stty2} -clocal"
- expr "${cur_stty}" : '.* opost.*' 1>/dev/null 2>&1 \
- || banner_filter=${FIX386BD}
-
-}
-
-
-###########
-##
-## Initialize the physical printer (Part I).
-## Here we bring the printer to a sane state and set the page size.
-###########
-
-##########
-#
-# WARNING! The "echo" command will catch backslashes (\) and
-# try to interpret the characters following it. Thus, using
-# "echo" to print string values obtained from "tput" is dangerous.
-##########
-
-#####
-# We're confident that most printers don't have backslashes
-# in the control sequences for carriage return and form-feed.
-# We're also confident that these don't contain newlines.
-# We're also confident that most printers have a linefeed
-# in the control sequence for doing a newline (move to beginning
-# of next line), but we can't capture it like we do the
-# carriage return or form-feed. Thus we set it unconditionally.
-# We don't set form-feed if it isn't defined, however, because
-# maybe the printer doesn't have a formfeed. If not set, we're
-# out of luck.
-#####
-
-CR=`${TPUT} cr`
-[ -z "${CR}" ] && CR="\r"
-
-FF=`${TPUT} ff`
-
-NL="${CR}\n"
-
-lines=`${TPUT} lines`
-[ -z "${lines}" -o 0 -ge "${lines}" ] && lines=66
-
-cols=`${TPUT} cols`
-[ -z "${cols}" -o 0 -ge "${cols}" ] && cols=132
-
-#####
-#
-# Basic initialization. The ``else'' clause is equivalent,
-# but covers cases where old Terminal Information Utilities are present.
-#####
-[ -n "${stty1}" ] && stty ${stty1} 0<&1
-
-#
-# "tput init" will return an "^M" in many cases to "stdout", i.e., printer!
-# This creates problems for some PS printers
-#
-if [ "${TERM}" = "PS" -o "${TERM}" = "PSR" ]
-then
- :
-elif ${TPUT} init 2>/dev/null
-then
- :
-else
- pgm=`${TPUT} iprog`
- if [ -x "${pgm}" ]
- then
- eval ${pgm}
- fi
-
- ${TPUT} is1
- ${TPUT} is2
-
- tabset=
- if [ "8" != "`${TPUT} it`" ]
- then
- stty tab3 0<&1 1>/dev/null 2>&1
-
- elif `${TPUT} ht >/dev/null`
- then
- tabset="/usr/lib/tabset/${TERM}"
- if [ -r ${tabset} ]
- then
- cat -s ${tabset}
- fi
- stty tab3 0<&1 1>/dev/null 2>&1
- fi
-
- file=`${TPUT} if`
- if [ "${tabset}" != "${file}" -a -r "${file}" ]
- then
- cat -s "${file}"
- fi
-
- ${TPUT} is3
- echo "${CR}\c"
-fi
-[ -n "${stty2}" ] && stty ${stty2} 0<&1
-
-#####
-#
-# Set the page size and print spacing, but not the character set.
-# We will be doing the character set later (after the header).
-#####
-internal_lpset "${cpi}" "${lpi}" "${width}" "${length}" ""
-
-#####
-#
-# The banner page (and cancellation page) will
-# use double width characters if they're available.
-#####
-WIDE_CS=`${TPUT} swidm 2>/dev/null` && NORM_CS=`${TPUT} rwidm 2>/dev/null`
-PAD="#####${NL}"
-
-#####
-#
-# Some printers need to have the banner page filtered.
-#####
-case "${TERM}" in
-
-PS | PSR )
- banner_filter="/usr/lib/lp/postscript/postprint | /usr/lib/lp/postscript/postio"
- LPTELL_OPTS="-l"
- ;;
-
-esac
-if [ -n "${banner_filter}" ]
-then
- banner_filter="| ${banner_filter}"
-fi
-
-#####
-#
-# Now that the printer is ready for printing, we're able
-# to record on paper a cancellation.
-#####
-
-cancel_banner () {
- echo "${PAD}${PAD}\c"
- echo "#####${WIDE_CS} Job ${request_id}${NORM_CS}${NL}\c"
- echo "#####${WIDE_CS} suspended or canceled${NORM_CS}${NL}\c"
- echo "${PAD}${PAD}\c"
-}
-
-canceled () {
- ${TPUT} scs 0 2>/dev/null
- echo "${CR}\c"
- if [ "${width:-${cols}}" -lt "${MAX_COLS_SMALL_BANNER}" ]
- then
- WIDE_CS= NORM_CS=
- fi
- cancel_banner
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-trap 'eval canceled ${banner_filter}; exit_code=0 exit' 15
-
-
-###########
-##
-## Print the banner page
-###########
-
-#####
-#
-# You may want to change the following code to get a custom banner.
-#####
-
-regular_banner () {
- echo "${CR}\c"
- echo "${PAD}${PAD}${PAD}${PAD}${PAD}\c"
- echo "#####${WIDE_CS} User: ${user_name}${NORM_CS}${NL}\c"
- if [ -n "$ALIAS_USERNAME" ]
- then
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Alias: ${ALIAS_USERNAME}${NORM_CS}${NL}\c"
- fi
- if [ -n "${title}" ]
- then
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Title: ${title}${NORM_CS}${NL}\c"
- fi
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Printed: `LANG=C date '+%a %H:%M %h %d, %Y'`${NORM_CS}${NL}\c"
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Job number: ${request_id}${NORM_CS}${NL}\c"
- echo "${PAD}${PAD}${PAD}${PAD}${PAD}\c"
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-small_banner () {
- echo "${CR}\c"
- echo "${PAD}\c"
- echo "##### User: ${user_name}${NL}\c"
- if [ -n "${title}" ]
- then
- echo "##### Title: ${title}${NL}\c"
- fi
- echo "##### Date: `LANG=C date '+%a %H:%M %h %d, %Y'`${NL}\c"
- echo "##### Job: ${request_id}${NL}\c"
- echo "${PAD}\c"
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-if [ "${width:-${cols}}" -lt "${MAX_COLS_SMALL_BANNER}" ]
-then
- banner=small_banner
-else
- banner=regular_banner
-fi
-
-if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" ]
-then
- ( eval "${banner} ${banner_filter}" 2>&1 1>&3 ) \
- | ${LPTELL} ${LPTELL_OPTS} ${printer}
-fi
-
-
-###########
-##
-## Initialize the physical printer (Part II)
-## Here we select the character set.
-## One could argue that this should be done before the banner is printed,
-## but we don't, to keep the banner page looking consistent for the
-## operator. You can move this code before the banner code if you
-## disagree. If you do, combine it with the other call to "internal_lpset"
-## to do everything in one shot.
-###########
-internal_lpset "" "" "" "" "${CHARSET}"
-
-###########
-##
-## Print some copies of the file(s)
-###########
-
-#####
-#
-# The protocol between the interface program and the Spooler
-# is fairly simple:
-#
-# All standard error output is assumed to indicate a
-# fault WITH THE REQUEST. The output is mailed to the
-# user who submitted the print request and the print
-# request is finished.
-#
-# If the interface program sets a zero exit code,
-# it is assumed that the file printed correctly.
-# If the interface program sets a non-zero exit code
-# less than 128, it is assumed that the file did not
-# print correctly, and the user will be notified.
-# In either case the print request is finished.
-#
-# If the interface program sets an exit code greater
-# than 128, it is assumed that the file did not print
-# because of a printer fault. If an alert isn't already
-# active (see below) one will be activated. (Exit code
-# 128 should not be used at all. The shell, which executes
-# this program, turns SIGTERM, used to kill this program
-# for a cancellation or disabling, into exit 128. The
-# Spooler thus interpretes 128 as SIGTERM.)
-#
-# A message sent to the standard input of the ${LPTELL}
-# program is assumed to describe a fault WITH THE PRINTER.
-# The output is used in an alert (if alerts are defined).
-# If the fault recovery is "wait" or "begin", the printer
-# is disabled (killing the interface program if need be),
-# and the print request is left on the queue.
-# If the fault recovery is "continue", the interface program
-# is allowed to wait for the printer fault to be cleared so
-# it can resume printing.
-#
-# This interface program relies on filters to detect printer faults.
-# In absence of a filter provided by the customer, it uses a simple
-# filter (${LPCAT}) to detect the class of faults that cause DCD
-# (``carrier'') drop. The protocol between the interface program and
-# the filter:
-#
-# The filter should exit with zero if printing was
-# successful and non-zero if printing failed because
-# of a printer fault. This interface program turns a
-# non-zero exit of the filter into an "exit 129" from
-# itself, thus telling the Spooler that a printer fault
-# (still) exists.
-#
-# The filter should report printer faults via a message
-# to its standard error. This interface program takes all
-# standard error output from the filter and feeds it as
-# standard input to the ${LPTELL} program.
-#
-# The filter should wait for a printer fault to clear,
-# and should resume printing when the fault clears.
-# Preferably it should resume at the top of the page
-# that was being printed when the fault occurred.
-# If it waits and finishes printing, it should exit
-# with a 0 exit code. If it can't wait, it should exit
-# with a non-zero exit code.
-#
-# The interface program expects that ANY message on the
-# standard error from the filter indicates a printer fault.
-# Therefore, a filter should not put user (input) error
-# messages on the standard error, but on the standard output
-# (where the user can read them when he or she examines
-# the print-out).
-#
-#####
-
-badfileyet=
-i=1
-while [ $i -le $copies ]
-do
- for file in ${files}
- do
- if [ -r "${file}" ]
- then
- #####
- #
- # Here's where we set up the $LPTELL program to
- # capture fault messages, and...
- #
- # Here's where we print the file.
- #
- # We set up a pipeline to $LPTELL, but play a trick
- # to get the filter's standard ERROR piped instead of
- # its standard OUTPUT: Divert the standard error (#2) to
- # the standard output (#1) IN THE PIPELINE. The shell
- # will have changed #1 to be the pipe, not the
- # printer, so diverting #2 connects it to the pipe.
- # We then change the filter's #1 to a copy of the real
- # standard output (the printer port) made earlier,
- # so that is connected back to the printer again.
- #
- # We do all this inside a parenthesized expression
- # so that we can get the exit code; this is necessary
- # because the exit code of a pipeline is the exit
- # code of the right-most command, which isn't the
- # filter.
- #
- # These two tricks could be avoided by using a named
- # pipe to connect the standard error to $LPTELL. In
- # fact an early prototype of this script did just
- # that; however, the named pipe introduced a timing
- # problem. The processes that open a named pipe hang
- # until both ends of the pipe are opened. Cancelling
- # a request or disabling the printer often killed one
- # of the processes, causing the other process to hang
- # forever waiting for the other end of the pipe to
- # be opened.
- #####
- EXIT_CODE=${TMPPREFIX}e
- trap '' 1 # Let the filter handle a hangup
- trap '' 2 3 # and interrupts
- (
- #####
- # Put the 0<${file} before the "eval" to keep
- # clever users from giving a file name that
- # evaluates as something to execute.
- #####
- 0<${file} eval ${FILTER} 2>&1 1>&3
- echo $? >${EXIT_CODE}
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
- trap 'catch_hangup; exit_code=129 exit 129' 1
- trap 'catch_interrupt; exit_code=129 exit 129' 2 3
- exit_code=`cat ${EXIT_CODE}`
-
- if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ]
- then
- trap '' 15 # Avoid dying from disable
- sleep 4 # Give $LPTELL a chance to tell
- exit ${exit_code}
- fi
-
- if [ -n "${FF}" -a "no" = "${nofilebreak}" ]
- then
- echo "${CR}${FF}\c"
- fi
-
- else
-
- #####
- #
- # Don't complain about not being able to read
- # a file on second and subsequent copies, unless
- # we've not complained yet. This removes repeated
- # messages about the same file yet reduces the
- # chance that the user can remove a file and not
- # know that we had trouble finding it.
- #####
- if [ "${i}" -le 1 -o -z "${badfileyet}" ]
- then
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read file \"${file}\"" \
- "see if the file still exists and is readable,
- or consult your system administrator;
- printing continues"
- badfileyet=yes
- fi
-
- fi
-
- done
- i=`expr $i + 1`
-
-done
-
-if [ "no" = "${nobanner}" -a "${TERM}" = "PSR" ]
-then
- ( eval "${banner} ${banner_filter}" 2>&1 1>&3 ) \
- | ${LPTELL} ${LPTELL_OPTS} ${printer}
-fi
-
-if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ]
-then
- exit ${exit_code}
-fi
-
-#####
-#
-# Always ensure the complete job ends with a ``formfeed'', to
-# let the next job start on a new page. (If someone wants to
-# concatenate files, they can give them in one job.)
-# So, if we haven't been putting out a ``formfeed'' between files,
-# it means we haven't followed the last file with a formfeed,
-# so we do it here.
-#####
-if [ -n "${FF}" -a "yes" = "${nofilebreak}" ]
-then
- echo "${CR}${FF}\c"
-fi
-
-${DRAIN}
-
-exit_code=0 exit 0
diff --git a/usr/src/cmd/lp/model/tsol_netstandard b/usr/src/cmd/lp/model/tsol_netstandard
deleted file mode 100644
index 6a04d5061d..0000000000
--- a/usr/src/cmd/lp/model/tsol_netstandard
+++ /dev/null
@@ -1,751 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-###########
-##
-## Network Standard printer interface program.
-##
-###########
-
-#####
-# We can't do much except exit if spooler/scheduler
-# cancels us.
-#####
-trap 'eval exit_clean 15' 15
-
-####
-#
-# Send standard error messages to /dev/null rather than to
-# the spooler. Avoids "Terminated" messages that shell puts out
-# when gets SIGTERM. Save standard error so it can be used
-# when we need it
-####
-exec 5>&2 2>/dev/null 3>&1
-
-####
-# set some global variables
-####
-
-: ${LPTMPDIR:=/tmp}
-: ${SPOOLDIR:=/usr/spool/lp}
-: ${LOCALPATH:=${SPOOLDIR}/bin}
-PATH="/bin:/usr/bin:${LOCALPATH}"
-exit_code=0
-
-
-# ${LPTELL} is the name of a program that will send its
-# standard input to the Spooler. It is used to forward
-# the description of a printer fault to the Spooler,
-# which uses it in an alert to the administrator.
-#####
-if [ ! -x "${LPTELL:=${LOCALPATH}/lp.tell}" ]
-then
- fake_lptell () {
- header="no"
- while read line
- do
- if [ "no" = "${header}" ]
- then
- errmsg ERROR ${E_IP_UNKNOWN} \
- "unknown printer/interface failure" \
- "consult your system administrator;
- reasons for failure (if any) follow:"
- header=yes
- fi
- echo "${line}" >&2
- done
- return 1
- }
- LPTELL=fake_lptell
-fi
-
-#####
-# ${LPTSOLSEPARATOR} is the name of a program to put banner and trailer
-# pages around the job.
-#####
-if [ -x ${LOCALPATH}/lp.tsol_separator ]
-then
- LPTSOLSEPARATOR=${LOCALPATH}/lp.tsol_separator
-else
- echo "${LOCALPATH}/lp.tsol_separator not found." >&2
- exit 1
-fi
-
-#####
-# Error message formatter:
-#
-# Invoke as
-#
-# errmsg severity message-number problem help
-#
-# where severity is "ERROR" or "WARNING", message-number is
-# a unique identifier, problem is a short description of the
-# problem, and help is a short suggestion for fixing the problem.
-#####
-
-LP_ERR_LABEL="UX:lp"
-E_IP_ARGS=1
-E_IP_OPTS=2
-#E_IP_FILTER=3
-E_IP_UNKNOWN=5
-E_IP_BADFILE=6
-E_IP_ERRORS=12 # (in slow.filter)
-
-errmsg () {
-
- case $1 in
- ERROR )
- sev=" ERROR";
- ;;
- WARNING )
- sev="WARNING";
- ;;
- esac
-
- echo "${LP_ERR_LABEL}:$2 ${sev}: $3
- TO FIX: $4" >&5
-}
-
-###########
-##
-## Check arguments
-###########
-
-parse () {
- echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
-}
-
-#####
-##
-## Error Cleanup and Exit
-##
-#####
-
-exit_clean()
-{
-
- if [ -f "${LPTMPDIR}/pr_eexit_code.$$" ]
- then
- /bin/rm ${LPTMPDIR}/pr_eexit_code.$$
- fi
-
- if [ -f "${LPTMPDIR}/small_banner.$$" ]
- then
- /bin/rm ${LPTMPDIR}/small_banner.$$
- fi
-
- if [ -f "${LPTMPDIR}/banner.exit_code.$$" ]
- then
- /bin/rm ${LPTMPDIR}/banner.exit_code.$$
- fi
-
- if [ -f "${LPTMPDIR}/banner.errmsg.$$" ]
- then
- /bin/rm ${LPTMPDIR}/banner.errmsg.$$
- fi
-
- if [ -f "${tmpfile}" ]
- then
- /bin/rm "${tmpfile}"
- fi
-
- exit $1
-}
-
-#####
-#
-# This program is invoked as
-#
-# ${SPOOLDIR}/.../printer request-id user title copies options files...
-#
-# The first three arguments are simply reprinted on the banner page,
-# the fourth (copies) is used to control the number of copies to print,
-# the fifth (options) is a blank separated list (in a single argument)
-# of user or Spooler supplied options (without the -o prefix),
-# and the last arguments are the files to print.
-#####
-
-if [ $# -lt 5 ]
-then
-
- errmsg ERROR ${E_IP_ARGS} \
- "wrong number of arguments to interface program" \
- "consult your system administrator"
- exit 1
-fi
-
-printer=`basename $0`
-request_id=$1
-user_name=$2
-title=$3
-copies=$4
-option_list=$5
-
-shift 5
-files="$*"
-
-
-#
-# debug sent to file if defined in /etc/syslog.conf
-# syslog.conf entry:
-# lpr.debug /path/filename
-#
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " "
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" "INPUT"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " \
- printer : ${printer}"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " \
- request_id : ${request_id}"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " \
- user_name : ${user_name}"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " title : ${title}"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " \
- copies : ${copies}"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " \
- option_list : ${option_list}"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " files : ${files}"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" " \
- spooler_key ${SPOOLER_KEY}"
-
-####
-# default: do print a banner
-####
-nobanner=no
-nolabels="no"
-nofilebreak="no"
-inlist=
-data_file_flag=
-
-for i in ${option_list}
-do
- case "${inlist}${i}" in
-
- nobanner )
- nobanner="yes"
- ;;
-
- nofilebreak )
- nofilebreak="yes"
- ;;
-
- nolabels )
- nolabels="yes"
- ;;
-
- #####
- #
- # If you want to add simple options (e.g. -o simple)
- # identify them here.
- #####
-# simple )
-# simple="yes"
-# ;;
-
- cpi=pica )
- cpi=10
- ;;
- cpi=elite )
- cpi=12
- ;;
- cpi=* )
- cpi=`parse ${i}`
- ;;
-
- lpi=* )
- lpi=`parse ${i}`
- ;;
-
- length=* )
- length=`parse ${i}`
- ;;
-
- width=* )
- width=`parse ${i}`
- ;;
- dest=* )
- dest="-d `parse ${i}`"
- ;;
-
- protocol=* )
- protocol="-P `parse ${i}`"
- ;;
- bsdctrl=* )
- controlfile="-c `parse ${i}`"
- ;;
- timeout=* )
- timeout="-t `parse ${i}`"
- ;;
-
- data-file-type=* )
- data_file_flag="-f `parse ${i}`"
- ;;
-
- #####
- #
- # If you want to add simple-value options (e.g. -o value=a)
- # identify them here.
- #####
-# value=* )
-# value=`parse ${i}`
-# ;;
-
- #####
- #
- # If you want to add options that,
- # take a list (e.g. -o lopt='a b c'), identif
- # them here and below (look for LOPT).
- #####
-
-# flist=* | lpd=* | options=* )
- flist=* | lpd=* )
-#LOPT stty=* | flist=* | lpd=* | lopt=* )
-
- inlist=`expr "${inlist}${i}" : "^\([^=]*=\)"`
- case "${i}" in
- ${inlist}\'*\' )
- item=`expr "${i}" : "^[^=]*='*\(.*\)'\$"`
- ;;
- ${inlist}\' )
- continue
- ;;
- ${inlist}\'* )
- item=`expr "${i}" : "^[^=]*='*\(.*\)\$"`
- ;;
- ${inlist}* )
- item=`expr "${i}" : "^[^=]*=\(.*\)\$"`
- ;;
- *\' )
- item=`expr "${i}" : "^\(.*\)'\$"`
- ;;
- * )
- item="${i}"
- ;;
- esac
-
- #####
- #
- # We don't dare use "eval" because a clever user could
- # put something in an option value that we'd end up
- # exec'ing.
- #####
- case "${inlist}" in
- flist= )
- flist="${flist} ${item}"
- ;;
- lpd= )
- lpd="${lpd} ${item}"
- ;;
-#LOPT lopt= )
-#LOPT lopt="${lopt} ${item}"
-#LOPT ;;
-# options= )
-# options="${options} ${item}"
-# ;;
- esac
-
- case "${i}" in
- ${inlist}\'*\' )
- inlist=
- ;;
- ${inlist}\'* )
- ;;
- *\' | ${inlist}* )
- inlist=
- ;;
- esac
- ;;
-
- * )
- errmsg WARNING ${E_IP_OPTS} \
- "unrecognized \"-o ${i}\" option" \
- "check the option, resubmit if necessary
- printing continues"
- ;;
- esac
-done
-
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" "term : ${TERM}"
-
-if [ -z "${FILTER}" ]
-then
- #####
- #
- # If no filter is being used, we use netpr to push the
- # file to the printer.
- # (QUOTES ARE IMPORTANT!)
- #####
-
- case "$TERM" in
- PS )
- # make the "postscript" printers use cat
- # (TSOL banners are added during filtering, so we have
- # to use some filter.)
- FILTER=/bin/cat
- ;;
- PSR )
- # make the "reverse postscript" printers reverse the
- # output and the use postio to talk to the printer
- #FILTER="/usr/lib/lp/postscript/postreverse "
- #FILTER=
- FILTER="/usr/lib/lp/postscript/postreverse "
- ;;
- * )
- # We don't know the type, so just assume that the
- # input and output are the same. Use netpr.
- #FILTER=/bin/cat
- FILTER=
- ;;
- esac
-fi
-
-####
-# sets default value for ordering of data and control files with
-# bsd protocol. Default: data files first. Administrator
-# may set to control file first with lpadmin -o bsdctrl=first
-####
-
-banner_flag=""
-case "${nobanner}" in
- yes )
- banner_flag="-b"
- ;;
-esac
-
-NETPR="/usr/lib/lp/bin/netpr ${banner_flag} ${data_file_flag} \
- -I ${request_id} -U ${user_name} \
- -p ${printer} ${dest} -T \"${title}\" \
- ${timeout} ${protocol} ${controlfile} "
-LPTELL_OPTS="-l" # netpr sends LaserWriter style messages back
-
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" "NETPR= ${NETPR}"
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" "filter : ${FILTER}"
-
-node=`uname -n`
-pid=$$
-tmpfile=${LPTMPDIR}/${node}.${pid}
-
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" "tmpfile : ${tmpfile}"
-
-#####
-#
-# Set up filter for banner page
-#
-#####
-banner_filter=
-case "${TERM}" in
-PS | PSR )
- banner_filter=" | /usr/lib/lp/postscript/postprint "
- LPTELL_OPTS="-l"
- ;;
-esac
-
-#####
-#
-# Build temporary file that is the banner page
-#
-#####
-PAD="#####${NL}"
-CR="\r"
-NL="${CR}\n"
-FF=
-
-small_banner() {
- echo "${CR}\c"
- echo "${PAD}\c"
- echo "##### User: ${user_name}${NL}\c"
- if [ -n "${title}" ]
- then
- echo "##### Title: ${title}${NL}\c"
- fi
- echo "##### Date: `LANG=C date '+%a %H:%M %h %d, %Y'`${NL}\c"
- echo "##### Job: ${request_id}${NL}\c"
- echo "${PAD}\c"
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-#####
-#
-# Doing small banner as we don't know what printer is out there
-#
-#####
-banner=small_banner
-
-## Skip this for PS/PSR printers, since lp.tsol_separator handles the banners
-if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- eval "${banner} ${banner_filter}" 2>&1 1>${LPTMPDIR}/small_banner.$$
-fi
-
-###########
-##
-## Surround the job by PostScript code to produce banner
-## and trailerpages and page headers and footers.
-##
-###########
-
-BANNER_EXIT_CODE=${LPTMPDIR}/banner.exit_code.$$
-echo 0 > ${BANNER_EXIT_CODE}
-TSOLSEPARATOR_LOG=${LPTMPDIR}/banner.errmsg.$$
-
-tsol_bannerize () {
- TSOLSEPARATOR_OPTS="-e ${TSOLSEPARATOR_LOG}"
-
- if [ "yes" = "${nolabels}" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -l"
- fi
-
- if [ "yes" = "${nobanner}" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -t /dev/null -b /dev/null"
- fi
-
- if [ "${TERM}" = "PSR" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -r"
- fi
-
- # Get rid of the #, TAB and NL characters in the title
- tsol_title=`echo $title`
- tsol_title=`echo $tsol_title | sed 's/#//g'`
-
- logger -p lpr.debug -t "tsol_netstandard: ${request_id}" \
- "banner command: ${LPTSOLSEPARATOR} ${TSOLSEPARATOR_OPTS} \
- ${printer} ${request_id} ${user_name} \"${tsol_title}\" ${file}"
- ${LPTSOLSEPARATOR} ${TSOLSEPARATOR_OPTS} ${printer} \
- ${request_id} ${user_name} "${tsol_title}" ${file}
-
- echo $? > ${BANNER_EXIT_CODE}
- true
-}
-
-bannerize=tsol_bannerize
-
-if [ "yes" = "${nobanner}" -a "yes" = "${nolabels}" ]
-then
- bannerize=cat
-fi
-
-if [ "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- bannerize=cat
-fi
-
-#####
-#
-# Print banner page before job unless PS or PSR.
-#
-#####
-
-if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- (
- eval ${NETPR} ${LPTMPDIR}/small_banner.$$ 2>&1
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug -t "tsol_netstandard: ${request_id}" \
- "banner page exit code : ${exit_code}"
-
-fi
-
-i=1
-while [ $i -le $copies ]
-do
- for file in ${files}
- do
- if [ -r "${file}" ]
- then
-
- if [ ! -z "${FILTER}" ]
- then
- (
- #####
- # There is a filter, use it
- #
- # Put 0<${file} before the "eval" to keep
- # clever users from giving a file name that
- # evaluates as something to execute.
- # Redirect stderr to stdout so LPTELL will
- # get error messages from pipe.
- #####
- 0<${file} $bannerize | eval ${FILTER} 2>&1 1>${tmpfile}
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- # if lp.tsol_separator had an error, send its logged
- # error message to LPTELL.
- banner_exit_code=`cat ${BANNER_EXIT_CODE}`
- if [ -n "${banner_exit_code}" -a \
- 0 -ne "${banner_exit_code}" -a \
- -n "${LPTELL}" -a \
- -r "${TSOLSEPARATOR_LOG}" ]
- then
- cat ${TSOLSEPARATOR_LOG} | ${LPTELL} ${printer}
- echo 77 > ${LPTMPDIR}/pr_eexit_code
- fi
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug \
- -t "tsol_netstandard: ${request_id}" \
- "filter exit_code : ${exit_code}"
-
- if [ -n "${exit_code}" ]
- then
- if [ "${exit_code}" -eq 0 ]
- then
- printfile=${tmpfile}
- else
- ####
- # The filter did not succeed, so don't try to print
- ####
- printfile=
- fi
- fi
-
- else
- printfile=${file}
- fi
-
- logger -p lpr.debug \
- -t "tsol_netstandard: ${request_id}" \
- "printfile : ${printfile}"
-
- #####
- # Print the file
- #####
-
- if [ -r "${printfile}" ]
- then
- (
- eval ${NETPR} ${printfile} 2>&1
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug \
- -t "tsol_netstandard: ${request_id}" \
- "netpr exit_code : ${exit_code}"
-
-# if [ -f "${tmpfile}" ]
-# then
-# /bin/rm "${tmpfile}"
-# fi
-
- if [ -n "${exit_code}" ]
- then
- if [ "${exit_code}" -eq 0 ]
- then
- printone=yes
- else
- if [ "${exit_code}" -lt 128 ]
- then
- noprint=yes
- else
- retry=yes
- fi
- fi
- fi
-
-
- else
-
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read temporary file \"${printfile}\""\
- "see if file still exists,
- or consult your system administrator;
- printing continues"
-
- fi
- else
-
- #####
- #
- # Don't complain about not being able to read
- # a file on second and subsequent copies, unless
- # we've not complained yet. This removes repeated
- # messages about the same file yet reduces the
- # chance that the user can remove a file and not
- # know that we had trouble finding it.
- #####
-
- if [ "${i}" -le 1 -o -z "${badfileyet}" ]
- then
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read file \"${file}\"" \
- "see if the file still exists and is readable,
- or consult your system administrator;
- printing continues"
- badfileyet=yes
- fi
-
- fi
-
-# for file in ${files}
- done
- i=`expr $i + 1`
-done
-
-#####
-#
-# If printing in reverse order, print the banner page now
-# Skip this for TSOL, since lp.tsol_separator handles the banners
-#
-#####
-
-#
-# if [ "no" = "${nobanner}" -a "${TERM}" = "PSR" ]
-# then
-# (
-# eval ${NETPR} ${LPTMPDIR}/small_banner.$$ 2>&1
-# echo $? > ${LPTMPDIR}/pr_eexit_code.$$
-# ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-# fi
-
-exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" \
- "banner page exit code : ${exit_code}"
-
-if [ -n "${printone}" -a -z "${retry}" -a -z "${noprint}" ]
-then
- exit_code=`expr 0`
-else
- if [ -n "${retry}" -a -z "${printone}" -a -z "${noprint}" ]
- then
- exit_code=`expr 129`
- else
- exit_code=`expr 1`
- fi
-fi
-
-logger -p lpr.debug -t "tsol_netstandard: ${request_id}" \
- "FINAL exit_code : ${exit_code}"
-
-exit_clean ${exit_code}
diff --git a/usr/src/cmd/lp/model/tsol_netstandard_foomatic b/usr/src/cmd/lp/model/tsol_netstandard_foomatic
deleted file mode 100644
index b23d06a1ba..0000000000
--- a/usr/src/cmd/lp/model/tsol_netstandard_foomatic
+++ /dev/null
@@ -1,788 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#
-###########
-##
-## Network Standard printer interface program for foomatic.
-##
-###########
-
-#####
-# We can't do much except exit if spooler/scheduler
-# cancels us.
-#####
-trap 'eval exit_clean 15' 15
-
-####
-#
-# Send standard error messages to /dev/null rather than to
-# the spooler. Avoids "Terminated" messages that shell puts out
-# when gets SIGTERM. Save standard error so it can be used
-# when we need it
-####
-exec 5>&2 2>/dev/null 3>&1
-
-####
-# set some global variables
-####
-
-: ${LPTMPDIR:=/tmp}
-: ${SPOOLDIR:=/usr/spool/lp}
-: ${LOCALPATH:=${SPOOLDIR}/bin}
-PATH="/bin:/usr/bin:${LOCALPATH}"
-exit_code=0
-
-
-# ${LPTELL} is the name of a program that will send its
-# standard input to the Spooler. It is used to forward
-# the description of a printer fault to the Spooler,
-# which uses it in an alert to the administrator.
-#####
-if [ ! -x "${LPTELL:=${LOCALPATH}/lp.tell}" ]
-then
- fake_lptell () {
- header="no"
- while read line
- do
- if [ "no" = "${header}" ]
- then
- errmsg ERROR ${E_IP_UNKNOWN} \
- "unknown printer/interface failure" \
- "consult your system administrator;
- reasons for failure (if any) follow:"
- header=yes
- fi
- echo "${line}" >&2
- done
- return 1
- }
- LPTELL=fake_lptell
-fi
-
-#####
-# ${LPTSOLSEPARATOR} is the name of a program to put banner and trailer
-# pages around the job.
-#####
-if [ -x ${LOCALPATH}/lp.tsol_separator ]
-then
- LPTSOLSEPARATOR=${LOCALPATH}/lp.tsol_separator
-else
- echo "${LOCALPATH}/lp.tsol_separator not found." >&2
- exit 1
-fi
-
-#####
-# Error message formatter:
-#
-# Invoke as
-#
-# errmsg severity message-number problem help
-#
-# where severity is "ERROR" or "WARNING", message-number is
-# a unique identifier, problem is a short description of the
-# problem, and help is a short suggestion for fixing the problem.
-#####
-
-LP_ERR_LABEL="UX:lp"
-E_IP_ARGS=1
-E_IP_OPTS=2
-#E_IP_FILTER=3
-E_IP_UNKNOWN=5
-E_IP_BADFILE=6
-E_IP_ERRORS=12 # (in slow.filter)
-
-errmsg () {
-
- case $1 in
- ERROR )
- sev=" ERROR";
- ;;
- WARNING )
- sev="WARNING";
- ;;
- esac
-
- echo "${LP_ERR_LABEL}:$2 ${sev}: $3
- TO FIX: $4" >&5
-}
-
-###########
-##
-## Check arguments
-###########
-
-parse () {
- echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
-}
-
-#####
-##
-## Error Cleanup and Exit
-##
-#####
-
-exit_clean()
-{
-
- if [ -f "${LPTMPDIR}/pr_eexit_code.$$" ]
- then
- /bin/rm ${LPTMPDIR}/pr_eexit_code.$$
- fi
-
- if [ -f "${LPTMPDIR}/small_banner.$$" ]
- then
- /bin/rm ${LPTMPDIR}/small_banner.$$
- fi
-
- if [ -f "${LPTMPDIR}/banner.exit_code.$$" ]
- then
- /bin/rm ${LPTMPDIR}/banner.exit_code.$$
- fi
-
- if [ -f "${LPTMPDIR}/banner.errmsg.$$" ]
- then
- /bin/rm ${LPTMPDIR}/banner.errmsg.$$
- fi
-
- if [ -f "${tmpfile}" ]
- then
- /bin/rm "${tmpfile}"
- fi
-
- exit $1
-}
-
-#####
-#
-# This program is invoked as
-#
-# ${SPOOLDIR}/.../printer request-id user title copies options files...
-#
-# The first three arguments are simply reprinted on the banner page,
-# the fourth (copies) is used to control the number of copies to print,
-# the fifth (options) is a blank separated list (in a single argument)
-# of user or Spooler supplied options (without the -o prefix),
-# and the last arguments are the files to print.
-#####
-
-if [ $# -lt 5 ]
-then
-
- errmsg ERROR ${E_IP_ARGS} \
- "wrong number of arguments to interface program" \
- "consult your system administrator"
- exit 1
-fi
-
-printer=`basename $0`
-request_id=$1
-user_name=$2
-title=$3
-copies=$4
-option_list=$5
-
-shift 5
-files="$*"
-
-
-#
-# debug sent to file if defined in /etc/syslog.conf
-# syslog.conf entry:
-# lpr.debug /path/filename
-#
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" " "
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" "INPUT"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- " printer : ${printer}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- " request_id : ${request_id}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- " user_name : ${user_name}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- " title : ${title}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- " copies : ${copies}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- " option_list : ${option_list}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- " files : ${files}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- " spooler_key ${SPOOLER_KEY}"
-
-####
-# default: do print a banner
-####
-nobanner=no
-nolabels="no"
-nofilebreak="no"
-inlist=
-data_file_flag=
-
-for i in ${option_list}
-do
- case "${inlist}${i}" in
-
- nobanner )
- nobanner="yes"
- ;;
-
- nofilebreak )
- nofilebreak="yes"
- ;;
-
- nolabels )
- nolabels="yes"
- ;;
-
- #####
- #
- # If you want to add simple options (e.g. -o simple)
- # identify them here.
- #####
-# simple )
-# simple="yes"
-# ;;
-
- cpi=pica )
- cpi=10
- ;;
- cpi=elite )
- cpi=12
- ;;
- cpi=* )
- cpi=`parse ${i}`
- ;;
-
- lpi=* )
- lpi=`parse ${i}`
- ;;
-
- length=* )
- length=`parse ${i}`
- ;;
-
- width=* )
- width=`parse ${i}`
- ;;
- dest=* )
- dest="-d `parse ${i}`"
- ;;
-
- protocol=* )
- protocol="-P `parse ${i}`"
- ;;
- bsdctrl=* )
- controlfile="-c `parse ${i}`"
- ;;
- timeout=* )
- timeout="-t `parse ${i}`"
- ;;
-
- data-file-type=* )
- data_file_flag="-f `parse ${i}`"
- ;;
-
- #
- # The IPP/PAPI attributes are handled by the foomatic-rip filter so
- # all we need to do here is ignore them so that they don't invoke the
- # "unrecognized option" message.
- #
-
- finishing=* | page-ranges=* | sides=* )
- ;;
- number-up=* | orientation-requested=* | media=* )
- ;;
- printer-resolution=* | print-quality=* )
- ;;
-
- #####
- #
- # If you want to add simple-value options (e.g. -o value=a)
- # identify them here.
- #####
-# value=* )
-# value=`parse ${i}`
-# ;;
-
- #####
- #
- # If you want to add options that,
- # take a list (e.g. -o lopt='a b c'), identif
- # them here and below (look for LOPT).
- #####
-
-# flist=* | lpd=* | options=* )
- flist=* | lpd=* )
-#LOPT stty=* | flist=* | lpd=* | lopt=* )
-
- inlist=`expr "${inlist}${i}" : "^\([^=]*=\)"`
- case "${i}" in
- ${inlist}\'*\' )
- item=`expr "${i}" : "^[^=]*='*\(.*\)'\$"`
- ;;
- ${inlist}\' )
- continue
- ;;
- ${inlist}\'* )
- item=`expr "${i}" : "^[^=]*='*\(.*\)\$"`
- ;;
- ${inlist}* )
- item=`expr "${i}" : "^[^=]*=\(.*\)\$"`
- ;;
- *\' )
- item=`expr "${i}" : "^\(.*\)'\$"`
- ;;
- * )
- item="${i}"
- ;;
- esac
-
- #####
- #
- # We don't dare use "eval" because a clever user could
- # put something in an option value that we'd end up
- # exec'ing.
- #####
- case "${inlist}" in
- flist= )
- flist="${flist} ${item}"
- ;;
- lpd= )
- lpd="${lpd} ${item}"
- ;;
-#LOPT lopt= )
-#LOPT lopt="${lopt} ${item}"
-#LOPT ;;
-# options= )
-# options="${options} ${item}"
-# ;;
- esac
-
- case "${i}" in
- ${inlist}\'*\' )
- inlist=
- ;;
- ${inlist}\'* )
- ;;
- *\' | ${inlist}* )
- inlist=
- ;;
- esac
- ;;
-
- * )
- errmsg WARNING ${E_IP_OPTS} \
- "unrecognized \"-o ${i}\" option" \
- "check the option, resubmit if necessary
- printing continues"
- ;;
- esac
-done
-
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- "term : ${TERM}"
-
-if [ -z "${FILTER}" ]
-then
- #####
- #
- # If no filter is being used, we use netpr to push the
- # file to the printer.
- # (QUOTES ARE IMPORTANT!)
- #####
-
- case "$TERM" in
- PS )
- # make the "postscript" printers use cat
- # (TSOL banners are added during filtering, so we have
- # to use some filter.)
- FILTER=/bin/cat
- ;;
- PSR )
- # make the "reverse postscript" printers reverse the
- # output and the use postio to talk to the printer
- #FILTER="/usr/lib/lp/postscript/postreverse "
- #FILTER=
- FILTER="/usr/lib/lp/postscript/postreverse "
- ;;
- * )
- # We don't know the type, so just assume that the
- # input and output are the same. Use netpr.
- #FILTER=/bin/cat
- FILTER=
- ;;
- esac
-fi
-
-####
-# sets default value for ordering of data and control files with
-# bsd protocol. Default: data files first. Administrator
-# may set to control file first with lpadmin -o bsdctrl=first
-####
-
-banner_flag=""
-case "${nobanner}" in
- yes )
- banner_flag="-b"
- ;;
-esac
-
-NETPR="/usr/lib/lp/bin/netpr ${banner_flag} ${data_file_flag} \
- -I ${request_id} -U ${user_name} \
- -p ${printer} ${dest} -T \"${title}\" \
- ${timeout} ${protocol} ${controlfile} "
-LPTELL_OPTS="-l" # netpr sends LaserWriter style messages back
-PPDFILTER=/usr/lib/lp/bin/foomatic-rip
-PPDFILTERA="${PPDFILTER} ${request_id} ${user_name} \"${title}\" ${copies} \"${option_list}\""
-
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- "NETPR= ${NETPR}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- "filter : ${FILTER}"
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- "ppdfilter : ${PPDFILTERA}"
-
-node=`uname -n`
-pid=$$
-tmpfile=${LPTMPDIR}/${node}.${pid}
-tmpfilefoo=${LPTMPDIR}/${node}.${pid}.1
-
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- "tmpfile : ${tmpfile}"
-
-#####
-#
-# Set up filter for banner page
-#
-#####
-banner_filter=
-case "${TERM}" in
-PS | PSR )
- banner_filter=" | /usr/lib/lp/postscript/postprint "
- LPTELL_OPTS="-l"
- ;;
-esac
-
-#####
-#
-# Build temporary file that is the banner page
-#
-#####
-PAD="#####${NL}"
-CR="\r"
-NL="${CR}\n"
-FF=
-
-small_banner() {
- echo "${CR}\c"
- echo "${PAD}\c"
- echo "##### User: ${user_name}${NL}\c"
- if [ -n "${title}" ]
- then
- echo "##### Title: ${title}${NL}\c"
- fi
- echo "##### Date: `LANG=C date '+%a %H:%M %h %d, %Y'`${NL}\c"
- echo "##### Job: ${request_id}${NL}\c"
- echo "${PAD}\c"
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-#####
-#
-# Doing small banner as we don't know what printer is out there
-#
-#####
-banner=small_banner
-
-## Skip this for PS/PSR printers, since lp.tsol_separator handles the banners
-if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- eval "${banner} ${banner_filter}" 2>&1 1>${LPTMPDIR}/small_banner.$$
-fi
-
-###########
-##
-## Surround the job by PostScript code to produce banner
-## and trailerpages and page headers and footers.
-##
-###########
-
-BANNER_EXIT_CODE=${LPTMPDIR}/banner.exit_code.$$
-echo 0 > ${BANNER_EXIT_CODE}
-TSOLSEPARATOR_LOG=${LPTMPDIR}/banner.errmsg.$$
-
-tsol_bannerize () {
- TSOLSEPARATOR_OPTS="-e ${TSOLSEPARATOR_LOG}"
-
- if [ "yes" = "${nolabels}" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -l"
- fi
-
- if [ "yes" = "${nobanner}" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -t /dev/null -b /dev/null"
- fi
-
- if [ "${TERM}" = "PSR" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -r"
- fi
-
- # Get rid of the #, TAB and NL characters in the title
- tsol_title=`echo $title`
- tsol_title=`echo $tsol_title | sed 's/#//g'`
-
- logger -p lpr.debug -t "tsol_netstandard: ${request_id}" \
- "banner command: ${LPTSOLSEPARATOR} ${TSOLSEPARATOR_OPTS} \
- ${printer} ${request_id} ${user_name} \"${tsol_title}\" ${file}"
- ${LPTSOLSEPARATOR} ${TSOLSEPARATOR_OPTS} ${printer} \
- ${request_id} ${user_name} "${tsol_title}" ${file}
-
- echo $? > ${BANNER_EXIT_CODE}
- true
-}
-
-bannerize=tsol_bannerize
-
-if [ "yes" = "${nobanner}" -a "yes" = "${nolabels}" ]
-then
- bannerize=cat
-fi
-
-if [ "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- bannerize=cat
-fi
-
-#####
-#
-# Print banner page before job unless PSR or PS
-#
-#####
-
-
-## Skip this for PS/PSR printers, since lp.tsol_separator handles the banners
-if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- (
- eval ${NETPR} ${LPTMPDIR}/small_banner.$$ 2>&1
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug -t \
- "tsol_netstandard_foomatic: ${request_id}" \
- "banner page exit code : ${exit_code}"
-
-fi
-
-i=1
-while [ $i -le $copies ]
-do
- for file in ${files}
- do
- if [ -r "${file}" ]
- then
-
- if [ ! -z "${FILTER}" ]
- then
- (
- #####
- # There is a filter, use it
- #
- # Put 0<${file} before the "eval" to keep
- # clever users from giving a file name that
- # evaluates as something to execute.
- # Redirect stderr to stdout so LPTELL will
- # get error messages from pipe.
- #####
-
- 0<${file} $bannerize | eval ${FILTER} 2>&1 1>${tmpfile}
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- # if lp.tsol_separator had an error,
- # send its logged error message to LPTELL.
- banner_exit_code=`cat ${BANNER_EXIT_CODE}`
- if [ -n "${banner_exit_code}" -a \
- 0 -ne "${banner_exit_code}" -a \
- -n "${LPTELL}" -a \
- -r "${TSOLSEPARATOR_LOG}" ]
- then
- cat ${TSOLSEPARATOR_LOG} | ${LPTELL} ${printer}
- echo 77 > ${LPTMPDIR}/pr_eexit_code
- fi
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug -t \
- "tsol_netstandard_foomatic: ${request_id}" \
- "filter exit_code : ${exit_code}"
-
- if [ -n "${exit_code}" ]
- then
- if [ "${exit_code}" -eq 0 ]
- then
- printfile=${tmpfile}
- else
- ####
- # The filter did not succeed, so don't try to print
- ####
- printfile=
- fi
- fi
-
- else
- printfile=${file}
- fi
-
- logger -p lpr.debug -t \
- "tsol_netstandard_foomatic: ${request_id}" \
- "printfile : ${printfile}"
-
- #####
- # Print the file
- #####
-
- if [ -r "${printfile}" ]
- then
- (
-logger -p lpr.debug -t \
- "@1 tsol_netstandard_foomatic: printfile = ${printfile}" ""
-logger -p lpr.debug -t \
- "tsol_netstandard_foomatic: ${NETPR} ${printfile}" ""
- #eval ${NETPR} ${printfile} 2>&1
- cat ${printfile} | ${PPDFILTER} \
- ${request_id} ${user_name} "${title}" ${copies} "${option_list}" \
- > ${tmpfilefoo} 2> /dev/null
- eval ${NETPR} ${tmpfilefoo} 2>&1
- echo $? > ${LPTMPDIR}/pr_eexit_code.$$
- /bin/rm -f ${tmpfilefoo}
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
- logger -p lpr.debug -t \
- "@2 netstandard_foomatic: ${request_id}" \
- "netpr exit_code : ${exit_code}"
-
-# if [ -f "${tmpfile}" ]
-# then
-# /bin/rm "${tmpfile}"
-# fi
-
- if [ -n "${exit_code}" ]
- then
- if [ "${exit_code}" -eq 0 ]
- then
- printone=yes
- else
- if [ "${exit_code}" -lt 128 ]
- then
- noprint=yes
- else
- retry=yes
- fi
- fi
- fi
-
-
- else
-
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read temporary file \"${printfile}\""\
- "see if file still exists,
- or consult your system administrator;
- printing continues"
-
- fi
- else
-
- #####
- #
- # Don't complain about not being able to read
- # a file on second and subsequent copies, unless
- # we've not complained yet. This removes repeated
- # messages about the same file yet reduces the
- # chance that the user can remove a file and not
- # know that we had trouble finding it.
- #####
-
- if [ "${i}" -le 1 -o -z "${badfileyet}" ]
- then
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read file \"${file}\"" \
- "see if the file still exists and is readable,
- or consult your system administrator;
- printing continues"
- badfileyet=yes
- fi
-
- fi
-
-# for file in ${files}
- done
- i=`expr $i + 1`
-done
-
-#####
-#
-# If printing in reverse order, print the banner page now
-# Skip this for TSOL, since lp.tsol_separator handles the banners
-#
-#####
-
-#if [ "no" = "${nobanner}" -a "${TERM}" = "PSR" ]
-#then
-#(
-# eval ${NETPR} ${LPTMPDIR}/small_banner.$$ 2>&1
-# echo $? > ${LPTMPDIR}/pr_eexit_code.$$
-#) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-#fi
-
-exit_code=`cat ${LPTMPDIR}/pr_eexit_code.$$`
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- "banner page exit code : ${exit_code}"
-
-if [ -n "${printone}" -a -z "${retry}" -a -z "${noprint}" ]
-then
- exit_code=`expr 0`
-else
- if [ -n "${retry}" -a -z "${printone}" -a -z "${noprint}" ]
- then
- exit_code=`expr 129`
- else
- exit_code=`expr 1`
- fi
-fi
-
-logger -p lpr.debug -t "tsol_netstandard_foomatic: ${request_id}" \
- "FINAL exit_code : ${exit_code}"
-
-exit_clean ${exit_code}
diff --git a/usr/src/cmd/lp/model/tsol_standard b/usr/src/cmd/lp/model/tsol_standard
deleted file mode 100644
index fe972a4148..0000000000
--- a/usr/src/cmd/lp/model/tsol_standard
+++ /dev/null
@@ -1,1162 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-###########
-##
-## Standard printer interface program.
-###########
-
-#####
-#
-# Until we get to the point below where the printer port
-# and physical printer are initialized, we can't do much
-# except exit if the Spooler/Scheduler cancels us.
-#####
-trap 'exit' 15
-
-#####
-#
-# We can be clever about getting a hangup or interrupt, though, at least
-# until the filter runs. Do this early, even though $LPTELL
-# isn't defined, so that we're covered.
-#####
-catch_hangup () {
- if [ -n "${LPTELL}" ]
- then
- echo \
-"The connection to the printer dropped; perhaps the printer went off-line?" \
- | ${LPTELL} ${printer}
- fi
- return 0
-}
-catch_interrupt () {
- if [ -n "${LPTELL}" ]
- then
- echo \
-"Received an interrupt from the printer. The reason is unknown,
-although a common cause is that the baud rate is too high." \
- | ${LPTELL} ${printer}
- fi
- return 0
-}
-trap 'catch_hangup; exit_code=129 exit 129' 1
-trap 'catch_interrupt; exit_code=129 exit 129' 2 3
-
-#####
-#
-# Most of the time we don't want the standard error to be captured
-# by the Spooler, mainly to avoid "Terminated" messages that the
-# shell puts out when we get a SIGTERM. We'll save the standard
-# error channel under another number, so we can use it when it
-# should be captured.
-#
-# Open another channel to the printer port, for use when the
-# regular standard output won't be directed there, such as in
-# command substitution (`cmd`).
-#####
-exec 5>&2 2>/dev/null 3>&1
-
-#####
-#
-# Set some globally used variables and functions.
-#####
-
-: ${TMPDIR:=/tmp}
-: ${SPOOLDIR:=/usr/spool/lp}
-: ${TERMINFO:=/usr/lib/terminfo}
-: ${CHARSETDIR:=/usr/lib/charsets}
-
-: ${LOCALPATH:=${SPOOLDIR}/bin}
-PATH="/bin:/usr/bin:${LOCALPATH}"
-
-MAX_COLS_SMALL_BANNER=40
-
-#####
-#
-# On the 3.2 release of the 386unix product, the parallel port does
-# not support any ioctl calls. As a result, we cannot set the opost
-# and onlcr attributes to have <NL>'s expanded to <CR><NL>. This
-# "filter" gets the job done for us.
-#####
-: ${FIX386BD:=${LOCALPATH}/386parallel}
-if [ -n "${FIX386BD}" -a -x "${FIX386BD}" ]
-then
- FIX386BD="| ${FIX386BD}"
-else
- FIX386BD=""
-fi
-
-#####
-# Use ${TMPPREFIX} as the prefix for all temporary files, so
-# that cleanup is easy. The prefix may be up to 13 characters
-# long, so you only have space for one more character to make
-# a file name. If necessary, make a directory using this prefix
-# for better management of unique temporary file names.
-#####
-TMPPREFIX=${TMPDIR}/`uname -n`$$
-
-#####
-# Before exiting, set ${exit_code} to the value with which to exit.
-# Otherwise, the exit from this script will be 0.
-#####
-trap 'rm -fr ${TMPPREFIX}*; exit ${exit_code}' 0
-
-#####
-# ${LPTELL} is the name of a program that will send its
-# standard input to the Spooler. It is used to forward
-# the description of a printer fault to the Spooler,
-# which uses it in an alert to the administrator.
-#####
-if [ ! -x "${LPTELL:=${LOCALPATH}/lp.tell}" ]
-then
- fake_lptell () {
- header="no"
- while read line
- do
- if [ "no" = "${header}" ]
- then
- errmsg ERROR ${E_IP_UNKNOWN} \
- "unknown printer/interface failure" \
- "consult your system administrator;
- reasons for failure (if any) follow:"
- header=yes
- fi
- echo "${line}" >&2
- done
- return 1
- }
- LPTELL=fake_lptell
-fi
-
-#####
-# ${DRAIN} is the name of a program that will wait
-# long enough for data sent to the printer to print.
-#####
-if [ -x "${LOCALPATH}/drain.output" ]
-then
- DRAIN="${LOCALPATH}/drain.output 5" # wait only five seconds
-else
- DRAIN=
-fi
-
-#####
-# ${LPTSOLSEPARATOR} is the name of a program to put banner and trailer
-# pages around the job.
-#####
-if [ -x ${LOCALPATH}/lp.tsol_separator ]
-then
- LPTSOLSEPARATOR=${LOCALPATH}/lp.tsol_separator
-else
- echo "${LOCALPATH}/lp.tsol_separator not found." >&2
- exit 1
-fi
-
-#####
-# ${LPCAT} is the name of a program to use as a default
-# filter. Minimally it should copy its standard input to
-# the standard output, but it should also trap printer
-# faults. The current LPCAT traps hangups (DCD dropping, SIGHUP),
-# interrupts (SIGINT, SIGQUIT), broken pipe (SIGPIPE), and
-# excess delays in sending data to the printer, interpreting all
-# as printer faults.
-#####
-if [ ! -x "${LPCAT:=${LOCALPATH}/lp.cat}" ]
-then
- LPCAT="cat"
-fi
-
-#####
-# ${LPSET} is the name of a program that will set the
-# character pitch, line pitch, page width, page length,
-# and character set. It helps to have this in a single
-# binary program so that (1) it's faster than calls
-# to "tput"; and (2) it can access the new Terminfo
-# capabilities for printers (on pre SVR3.2 machines, tput can't).
-#####
-if [ ! -x "${LPSET:=${LOCALPATH}/lp.set}" ]
-then
- fake_lpset () {
- echo H V W L S >&2
- false
- }
- LPSET=fake_lpset
-fi
-
-internal_lpset () {
- #####
- #
- # The funny business with the "2>&1 1>&3" is to let us capture
- # the standard ERROR, not the standard OUTPUT as is the usual case
- # with foo=`cmd`. The standard output will go to the printer.
- #####
- [ -n "${stty1}" ] && stty ${stty1} 0<&1
- chk=`${LPSET} "$1" "$2" "$3" "$4" "$5" 2>&1 1>&3`
- [ -n "${stty2}" ] && stty ${stty2} 0<&1
-
- #####
- #
- # The standard error of the delivered ${LPSET} program
- # is a string of letters, H, V, W, L, S, which correspond
- # to cpi, lpi, width, length, and character set. A letter
- # is present only if the corresponding attribute could not
- # be set.
- #####
- for err in ${chk}
- do
- case ${err} in
- H )
- errmsg WARNING ${E_IP_BADCPI} \
- "can't select the character pitch \"${cpi}\"" \
- "check the valid pitches for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- V )
- errmsg WARNING ${E_IP_BADLPI} \
- "can't select the line pitch \"${lpi}\"" \
- "check the valid pitches for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- W )
- width=${cols}
- errmsg WARNING ${E_IP_BADWIDTH} \
- "can't select the page width \"${width}\"" \
- "check the valid widths for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- L )
- length=${lines}
- errmsg WARNING ${E_IP_BADLENGTH} \
- "can't select the page length \"${length}\"" \
- "check the valid lengths for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- S )
- errmsg WARNING ${E_IP_BADCHARSET} \
- "can't select the character set \"${CHARSET}\"" \
- "check the name given in the -S option,
- or consult your system administrator;
- printing continues"
- ;;
- esac
- done
-}
-
-
-#####
-# ${TPUT} is "tput" IF it works. We'll disable it if we get an
-# ugly error message the first time we use it. See the TERM variable
-# later in the script.
-#
-# NOTE: The check we use to see if "tput" works is to use an OLD
-# Terminfo capability, like "lines". If it works with that it may
-# still fail with some of the newer capabilities like "init" (SVR3.0)
-# or "swidm" (SVR3.2), because the version of "tput" we have on your
-# machine is older. Thus, on some of the code where ${TPUT} is used
-# you'll see "2>/dev/null" being used to avoid ugly error messages.
-#####
-TPUT=tput
-
-#####
-# Error message formatter:
-#
-# Invoke as
-#
-# errmsg severity message-number problem help
-#
-# where severity is "ERROR" or "WARNING", message-number is
-# a unique identifier, problem is a short description of the
-# problem, and help is a short suggestion for fixing the problem.
-#####
-
-LP_ERR_LABEL="UX:lp"
-
-E_IP_ARGS=1
-E_IP_OPTS=2
-#E_IP_FILTER=3
-E_IP_STTY=4
-E_IP_UNKNOWN=5
-E_IP_BADFILE=6
-E_IP_BADCHARSET=7
-E_IP_BADCPI=8
-E_IP_BADLPI=9
-E_IP_BADWIDTH=10
-E_IP_BADLENGTH=11
-E_IP_ERRORS=12 # (in slow.filter)
-
-errmsg () {
- case $1 in
- ERROR )
- sev=" ERROR";
- ;;
- WARNING )
- sev="WARNING";
- ;;
- esac
-# tag=`expr "${LP_ERR_LABEL}" : "\(.*\):"``expr "${LP_ERR_LABEL}" : ".*:\(.*\)"`
- echo "${LP_ERR_LABEL}: ${sev}: $3
- TO FIX: $4" >&5
-}
-
-
-###########
-##
-## Check arguments
-###########
-
-parse () {
- echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
-}
-
-#####
-#
-# This program is invoked as
-#
-# ${SPOOLDIR}/.../printer request-id user title copies options files...
-#
-# The first three arguments are simply reprinted on the banner page,
-# the fourth (copies) is used to control the number of copies to print,
-# the fifth (options) is a blank separated list (in a single argument)
-# of user or Spooler supplied options (without the -o prefix),
-# and the last arguments are the files to print.
-#####
-
-if [ $# -lt 5 ]
-then
- errmsg ERROR ${E_IP_ARGS} \
- "wrong number of arguments to interface program" \
- "consult your system administrator"
- exit 1
-fi
-
-printer=`basename $0`
-request_id=$1
-user_name=$2
-title=$3
-copies=$4
-option_list=$5
-
-shift 5
-files="$*"
-
-nobanner="no"
-nofilebreak="no"
-nolabels="no"
-stty=
-
-inlist=
-for i in ${option_list}
-do
- case "${inlist}${i}" in
-
-
- nobanner )
- nobanner="yes"
- ;;
-
- nofilebreak )
- nofilebreak="yes"
- ;;
-
- nolabels )
- nolabels="yes"
- ;;
-
- #####
- #
- # If you want to add simple options (e.g. -o simple)
- # identify them here.
- #####
-# simple )
-# simple="yes"
-# ;;
-
-
- cpi=pica )
- cpi=10
- ;;
- cpi=elite )
- cpi=12
- ;;
- cpi=* )
- cpi=`parse ${i}`
- ;;
-
- lpi=* )
- lpi=`parse ${i}`
- ;;
-
- length=* )
- length=`parse ${i}`
- ;;
-
- width=* )
- width=`parse ${i}`
- ;;
-
- #####
- #
- # If you want to add simple-value options (e.g. -o value=a)
- # identify them here.
- #####
-# value=* )
-# value=`parse ${i}`
-# ;;
-
-
- #####
- #
- # If you want to add options that, like "stty",
- # take a list (e.g. -o lopt='a b c'), identify
- # them here and below (look for LOPT).
- #####
- stty=* | flist=* | lpd=* )
-#LOPT stty=* | flist=* | lpd=* | lopt=* )
-
- inlist=`expr "${inlist}${i}" : "^\([^=]*=\)"`
- case "${i}" in
- ${inlist}\'*\' )
- item=`expr "${i}" : "^[^=]*='*\(.*\)'\$"`
- ;;
- ${inlist}\' )
- continue
- ;;
- ${inlist}\'* )
- item=`expr "${i}" : "^[^=]*='*\(.*\)\$"`
- ;;
- ${inlist}* )
- item=`expr "${i}" : "^[^=]*=\(.*\)\$"`
- ;;
- *\' )
- item=`expr "${i}" : "^\(.*\)'\$"`
- ;;
- * )
- item="${i}"
- ;;
- esac
-
- #####
- #
- # We don't dare use "eval" because a clever user could
- # put something in an option value that we'd end up
- # exec'ing.
- #####
- case "${inlist}" in
- stty= )
- stty="${stty} ${item}"
- ;;
- flist= )
- flist="${flist} ${item}"
- ;;
- lpd= )
- lpd="${lpd} ${item}"
- ;;
-#LOPT lopt= )
-#LOPT lopt="${lopt} ${item}"
-#LOPT ;;
- esac
-
- case "${i}" in
- ${inlist}\'*\' )
- inlist=
- ;;
- ${inlist}\'* )
- ;;
- *\' | ${inlist}* )
- inlist=
- ;;
- esac
- ;;
-
- * )
- errmsg WARNING ${E_IP_OPTS} \
- "unrecognized \"-o ${i}\" option" \
- "check the option, resubmit if necessary
- printing continues"
- ;;
- esac
-done
-
-#####
-#
-# Additional ``parameters'' are passed via Shell environment
-# variables:
-#
-# TERM The printer type (used for Terminfo access)
-# CHARSET The character set to choose
-# FILTER The filter to run
-#####
-
-#####
-# Set defaults for unset variables.
-#####
-
-: ${TERM:=unknown}
-tput lines 1>/dev/null 2>&1 || TPUT=:
-
-: ${CHARSET:=cs0}
-
-if [ -z "${FILTER}" ]
-then
- #####
- #
- # If no filter is being used, we have a little routine that
- # will push the data to the printer. It traps hangups (loss
- # of carrier) and checks for excessive delays in sending the
- # data to the printer. The lesser of the print rate of the printer
- # (obtained from Terminfo) or the baud rate is used to compute
- # the expected delay. If neither of these is correct, you
- # may be experiencing false alarms. If so, give the correct
- # rate, in characters per second, as a single argument.
- # An argument of 0 means don't check for delays.
- # Give an -r option to get a printout of actual delays.
- # (QUOTES ARE IMPORTANT!)
- #####
- case "$TERM" in
- PS )
- # make the "postscript" printers use postio to
- # talk to the printer and periodically get a
- # status from them
- FILTER="/usr/lib/lp/postscript/postio"
- ;;
- PSR )
- # make the "reverse postscript" printers reverse the
- # output and the use postio to talk to the printer
- FILTER="/usr/lib/lp/postscript/postreverse | \
- /usr/lib/lp/postscript/postio"
- ;;
- * )
- # we don't know the type, so just assume that the
- # input and output are the same
- if [ `basename "${LPCAT}"` = "lp.cat" ] ; then
- FILTER="${LPCAT} 0" # infinite delays
- # FILTER="${LPCAT} 120" # e.g. 120 CPS
- # FILTER="${LPCAT} -r 0 2>/tmp/delays"
- # FILTER=${LPCAT}
- fi
- ;;
- esac
-fi
-
-###########
-##
-## Initialize the printer port
-###########
-
-#####
-#
-# SERIAL PORTS:
-# Initialize everything.
-#
-# PARALLEL PORTS:
-# Don't initialize baud rate.
-#
-# It's not obvious how to tell if a port is parallel or serial.
-# However, by splitting the initialization into two steps and letting
-# the serial-only part fail nicely, it'll work.
-#
-# Another point: The output must be a ``tty'' device. If not, don't
-# bother with any of this.
-#####
-stty1= stty2=
-tty 0<&1 1>/dev/null 2>&1 && {
-
- #####
- #
- # First set the default parameters,
- # then the requested parameters.
- #####
-
- stty \
- 9600 \
- 0<&1 2>/dev/null 1>&2
- stty \
- cs8 -cstopb -parenb -parodd \
- ixon -ixany \
- opost -olcuc onlcr -ocrnl -onocr -onlret -ofill \
- nl0 cr0 tab0 bs0 vt0 ff0 \
- 0<&1 2>/dev/null 1>&2
-
- if [ -n "${stty}" ]
- then
- if stty ${stty} 0<&1 1>/dev/null 2>&5
- then
- :
- else
- errmsg ERROR ${E_IP_STTY} \
- "stty option list failed" \
- "check the \"-o stty\" option you used,
- or consult your system administrator"
- exit 1
- fi
- fi
-
- #####
- #
- # Here you may want to add other port initialization code.
- # Some examples:
- #
- # estty # for printer needing hardware flow control (3B2/EPORTS)
- # fctty # for printer needing hardware flow control (3B15,3B20)
- #####
- #estty 0<&1
- #fctty 0<&1
-
-
- ##########
- #
- # Find out if we have to turn off opost before initializing the
- # printer and on after. Likewise, check clocal.
- #
- # Turning OFF opost (output postprocessing) keeps the UNIX system
- # from changing what we try to send to the printer. Turning ON
- # clocal keeps the UNIX system from dropping what we are trying to
- # send if the printer drops DTR. An example of the former is the
- # AT&T 479, which wants to send a linefeed (ASCII 10) when a page
- # width of 10 is set; with opost on, this COULD BE turned into a
- # carriage-return/linefeed pair. An example of the latter is the
- # AT&T 455, which momentarily drops DTR when it gets the
- # initialization string, is2; with clocal off, the UNIX system
- # stops sending the rest of the initialization sequence at that
- # point.
- #
- # THIS CODE MUST FOLLOW THE REST OF THE PORT INITIALIZATION CODE.
- ##########
- cur_stty=`stty -a 0<&3`
- expr "${cur_stty}" : '.*-opost' 1>/dev/null 2>&1 \
- || stty1="${stty1} -opost" stty2="${stty2} opost"
- expr "${cur_stty}" : '.*-clocal' 1>/dev/null 2>&1 \
- && stty1="${stty1} clocal" stty2="${stty2} -clocal"
- expr "${cur_stty}" : '.* opost.*' 1>/dev/null 2>&1 \
- || banner_filter=${FIX386BD}
-
-}
-
-
-###########
-##
-## Initialize the physical printer (Part I).
-## Here we bring the printer to a sane state and set the page size.
-###########
-
-##########
-#
-# WARNING! The "echo" command will catch backslashes (\) and
-# try to interpret the characters following it. Thus, using
-# "echo" to print string values obtained from "tput" is dangerous.
-##########
-
-#####
-# We're confident that most printers don't have backslashes
-# in the control sequences for carriage return and form-feed.
-# We're also confident that these don't contain newlines.
-# We're also confident that most printers have a linefeed
-# in the control sequence for doing a newline (move to beginning
-# of next line), but we can't capture it like we do the
-# carriage return or form-feed. Thus we set it unconditionally.
-# We don't set form-feed if it isn't defined, however, because
-# maybe the printer doesn't have a formfeed. If not set, we're
-# out of luck.
-#####
-
-CR=`${TPUT} cr`
-[ -z "${CR}" ] && CR="\r"
-
-FF=`${TPUT} ff`
-
-NL="${CR}\n"
-
-lines=`${TPUT} lines`
-[ -z "${lines}" -o 0 -ge "${lines}" ] && lines=66
-
-cols=`${TPUT} cols`
-[ -z "${cols}" -o 0 -ge "${cols}" ] && cols=132
-
-#####
-#
-# Basic initialization. The ``else'' clause is equivalent,
-# but covers cases where old Terminal Information Utilities are present.
-#####
-[ -n "${stty1}" ] && stty ${stty1} 0<&1
-
-#
-# "tput init" will return an "^M" in many cases to "stdout", i.e., printer!
-# This creates problems for some PS printers
-#
-if [ "${TERM}" = "PS" -o "${TERM}" = "PSR" ]
-then
- :
-elif ${TPUT} init 2>/dev/null
-then
- :
-else
- pgm=`${TPUT} iprog`
- if [ -x "${pgm}" ]
- then
- eval ${pgm}
- fi
-
- ${TPUT} is1
- ${TPUT} is2
-
- tabset=
- if [ "8" != "`${TPUT} it`" ]
- then
- stty tab3 0<&1 1>/dev/null 2>&1
-
- elif `${TPUT} ht >/dev/null`
- then
- tabset="/usr/lib/tabset/${TERM}"
- if [ -r ${tabset} ]
- then
- cat -s ${tabset}
- fi
- stty tab3 0<&1 1>/dev/null 2>&1
- fi
-
- file=`${TPUT} if`
- if [ "${tabset}" != "${file}" -a -r "${file}" ]
- then
- cat -s "${file}"
- fi
-
- ${TPUT} is3
- echo "${CR}\c"
-fi
-[ -n "${stty2}" ] && stty ${stty2} 0<&1
-
-#####
-#
-# Set the page size and print spacing, but not the character set.
-# We will be doing the character set later (after the header).
-#####
-internal_lpset "${cpi}" "${lpi}" "${width}" "${length}" ""
-
-#####
-#
-# The banner page (and cancellation page) will
-# use double width characters if they're available.
-#####
-WIDE_CS=`${TPUT} swidm 2>/dev/null` && NORM_CS=`${TPUT} rwidm 2>/dev/null`
-PAD="#####${NL}"
-
-#####
-#
-# Some printers need to have the banner page filtered.
-#####
-case "${TERM}" in
-
-PS | PSR )
- banner_filter="/usr/lib/lp/postscript/postprint | /usr/lib/lp/postscript/postio"
- LPTELL_OPTS="-l"
- ;;
-
-esac
-if [ -n "${banner_filter}" ]
-then
- banner_filter="| ${banner_filter}"
-fi
-
-#####
-#
-# Now that the printer is ready for printing, we're able
-# to record on paper a cancellation.
-#####
-
-cancel_banner () {
- echo "${PAD}${PAD}\c"
- echo "#####${WIDE_CS} Job ${request_id}${NORM_CS}${NL}\c"
- echo "#####${WIDE_CS} suspended or canceled${NORM_CS}${NL}\c"
- echo "${PAD}${PAD}\c"
-}
-
-canceled () {
- ${TPUT} scs 0 2>/dev/null
- echo "${CR}\c"
- if [ "${width:-${cols}}" -lt "${MAX_COLS_SMALL_BANNER}" ]
- then
- WIDE_CS= NORM_CS=
- fi
- cancel_banner
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-trap 'eval canceled ${banner_filter}; exit_code=0 exit' 15
-
-
-###########
-##
-## Print the banner page
-###########
-
-#####
-#
-# You may want to change the following code to get a custom banner.
-#####
-
-regular_banner () {
- echo "${CR}\c"
- echo "${PAD}${PAD}${PAD}${PAD}${PAD}\c"
- echo "#####${WIDE_CS} User: ${user_name}${NORM_CS}${NL}\c"
- if [ -n "$ALIAS_USERNAME" ]
- then
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Alias: ${ALIAS_USERNAME}${NORM_CS}${NL}\c"
- fi
- if [ -n "${title}" ]
- then
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Title: ${title}${NORM_CS}${NL}\c"
- fi
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Printed: `LANG=C date '+%a %H:%M %h %d, %Y'`${NORM_CS}${NL}\c"
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Job number: ${request_id}${NORM_CS}${NL}\c"
- echo "${PAD}${PAD}${PAD}${PAD}${PAD}\c"
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-small_banner () {
- echo "${CR}\c"
- echo "${PAD}\c"
- echo "##### User: ${user_name}${NL}\c"
- if [ -n "${title}" ]
- then
- echo "##### Title: ${title}${NL}\c"
- fi
- echo "##### Date: `LANG=C date '+%a %H:%M %h %d, %Y'`${NL}\c"
- echo "##### Job: ${request_id}${NL}\c"
- echo "${PAD}\c"
- if [ -n "${FF}" ]
- then
- echo "${CR}${FF}\c"
- fi
-}
-
-if [ "${width:-${cols}}" -lt "${MAX_COLS_SMALL_BANNER}" ]
-then
- banner=small_banner
-else
- banner=regular_banner
-fi
-
-## Skip this for PS/PSR in TSOL, since lp.tsol_separator handles the banners
-if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- ( eval "${banner} ${banner_filter}" 2>&1 1>&3 ) \
- | ${LPTELL} ${LPTELL_OPTS} ${printer}
-fi
-
-###########
-##
-## Surround the job by PostScript code to produce banner
-## and trailerpages and page headers and footers.
-##
-###########
-
-BANNER_EXIT_CODE=${TMPPREFIX}.banner.exit_code
-echo 0 > ${BANNER_EXIT_CODE}
-TSOLSEPARATOR_LOG=${TMPPREFIX}.banner.errmsg
-
-tsol_bannerize () {
- TSOLSEPARATOR_OPTS="-e ${TSOLSEPARATOR_LOG}"
-
- if [ "yes" = "${nolabels}" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -l"
- fi
-
- if [ "yes" = "${nobanner}" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -t /dev/null -b /dev/null"
- fi
-
- if [ "${TERM}" = "PSR" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -r"
- fi
-
- # Get rid of the #, TAB and NL characters in the title
- tsol_title=`echo $title`
- tsol_title=`echo $tsol_title | sed 's/#//g'`
-
- LC_TIME=C ${LPTSOLSEPARATOR} ${TSOLSEPARATOR_OPTS} "${printer}" \
- "${request_id}" "${user_name}" "${tsol_title}" "${file}"
- echo $? > ${BANNER_EXIT_CODE}
- true
-}
-
-bannerize=tsol_bannerize
-
-if [ "yes" = "${nobanner}" -a "yes" = "${nolabels}" ]
-then
- bannerize=cat
-fi
-
-if [ "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- bannerize=cat
-fi
-
-
-###########
-##
-## Initialize the physical printer (Part II)
-## Here we select the character set.
-## One could argue that this should be done before the banner is printed,
-## but we don't, to keep the banner page looking consistent for the
-## operator. You can move this code before the banner code if you
-## disagree. If you do, combine it with the other call to "internal_lpset"
-## to do everything in one shot.
-###########
-internal_lpset "" "" "" "" "${CHARSET}"
-
-###########
-##
-## Print some copies of the file(s)
-###########
-
-#####
-#
-# The protocol between the interface program and the Spooler
-# is fairly simple:
-#
-# All standard error output is assumed to indicate a
-# fault WITH THE REQUEST. The output is mailed to the
-# user who submitted the print request and the print
-# request is finished.
-#
-# If the interface program sets a zero exit code,
-# it is assumed that the file printed correctly.
-# If the interface program sets a non-zero exit code
-# less than 128, it is assumed that the file did not
-# print correctly, and the user will be notified.
-# In either case the print request is finished.
-#
-# If the interface program sets an exit code greater
-# than 128, it is assumed that the file did not print
-# because of a printer fault. If an alert isn't already
-# active (see below) one will be activated. (Exit code
-# 128 should not be used at all. The shell, which executes
-# this program, turns SIGTERM, used to kill this program
-# for a cancellation or disabling, into exit 128. The
-# Spooler thus interpretes 128 as SIGTERM.)
-#
-# A message sent to the standard input of the ${LPTELL}
-# program is assumed to describe a fault WITH THE PRINTER.
-# The output is used in an alert (if alerts are defined).
-# If the fault recovery is "wait" or "begin", the printer
-# is disabled (killing the interface program if need be),
-# and the print request is left on the queue.
-# If the fault recovery is "continue", the interface program
-# is allowed to wait for the printer fault to be cleared so
-# it can resume printing.
-#
-# This interface program relies on filters to detect printer faults.
-# In absence of a filter provided by the customer, it uses a simple
-# filter (${LPCAT}) to detect the class of faults that cause DCD
-# (``carrier'') drop. The protocol between the interface program and
-# the filter:
-#
-# The filter should exit with zero if printing was
-# successful and non-zero if printing failed because
-# of a printer fault. This interface program turns a
-# non-zero exit of the filter into an "exit 129" from
-# itself, thus telling the Spooler that a printer fault
-# (still) exists.
-#
-# The filter should report printer faults via a message
-# to its standard error. This interface program takes all
-# standard error output from the filter and feeds it as
-# standard input to the ${LPTELL} program.
-#
-# The filter should wait for a printer fault to clear,
-# and should resume printing when the fault clears.
-# Preferably it should resume at the top of the page
-# that was being printed when the fault occurred.
-# If it waits and finishes printing, it should exit
-# with a 0 exit code. If it can't wait, it should exit
-# with a non-zero exit code.
-#
-# The interface program expects that ANY message on the
-# standard error from the filter indicates a printer fault.
-# Therefore, a filter should not put user (input) error
-# messages on the standard error, but on the standard output
-# (where the user can read them when he or she examines
-# the print-out).
-#
-#####
-
-badfileyet=
-i=1
-while [ $i -le $copies ]
-do
- for file in ${files}
- do
- if [ -r "${file}" ]
- then
- #####
- #
- # Here's where we set up the $LPTELL program to
- # capture fault messages, and...
- #
- # Here's where we print the file.
- #
- # We set up a pipeline to $LPTELL, but play a trick
- # to get the filter's standard ERROR piped instead of
- # its standard OUTPUT: Divert the standard error (#2) to
- # the standard output (#1) IN THE PIPELINE. The shell
- # will have changed #1 to be the pipe, not the
- # printer, so diverting #2 connects it to the pipe.
- # We then change the filter's #1 to a copy of the real
- # standard output (the printer port) made earlier,
- # so that is connected back to the printer again.
- #
- # We do all this inside a parenthesized expression
- # so that we can get the exit code; this is necessary
- # because the exit code of a pipeline is the exit
- # code of the right-most command, which isn't the
- # filter.
- #
- # These two tricks could be avoided by using a named
- # pipe to connect the standard error to $LPTELL. In
- # fact an early prototype of this script did just
- # that; however, the named pipe introduced a timing
- # problem. The processes that open a named pipe hang
- # until both ends of the pipe are opened. Cancelling
- # a request or disabling the printer often killed one
- # of the processes, causing the other process to hang
- # forever waiting for the other end of the pipe to
- # be opened.
- #####
- EXIT_CODE=${TMPPREFIX}e
- trap '' 1 # Let the filter handle a hangup
- trap '' 2 3 # and interrupts
- (
- #####
- # Put the 0<${file} before the "eval" to keep
- # clever users from giving a file name that
- # evaluates as something to execute.
- #####
- 0<${file} $bannerize | eval ${FILTER} 2>&1 1>&3
- echo $? >${EXIT_CODE}
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- # if lp.tsol_separator had an error, send its logged
- # error message to LPTELL.
- banner_exit_code=`cat ${BANNER_EXIT_CODE}`
- if [ -n "${banner_exit_code}" -a \
- 0 -ne "${banner_exit_code}" -a \
- -n "${LPTELL}" -a \
- -r "${TSOLSEPARATOR_LOG}" ]
- then
- cat ${TSOLSEPARATOR_LOG} | ${LPTELL} ${printer}
- echo 77 > ${EXIT_CODE}
- fi
-
- trap 'catch_hangup; exit_code=129 exit 129' 1
- trap 'catch_interrupt; exit_code=129 exit 129' 2 3
- exit_code=`cat ${EXIT_CODE}`
-
- if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ]
- then
- trap '' 15 # Avoid dying from disable
- sleep 4 # Give $LPTELL a chance to tell
- exit ${exit_code}
- fi
-
- if [ -n "${FF}" -a "no" = "${nofilebreak}" ]
- then
- echo "${CR}${FF}\c"
- fi
-
- else
-
- #####
- #
- # Don't complain about not being able to read
- # a file on second and subsequent copies, unless
- # we've not complained yet. This removes repeated
- # messages about the same file yet reduces the
- # chance that the user can remove a file and not
- # know that we had trouble finding it.
- #####
- if [ "${i}" -le 1 -o -z "${badfileyet}" ]
- then
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read file \"${file}\"" \
- "see if the file still exists and is readable,
- or consult your system administrator;
- printing continues"
- badfileyet=yes
- fi
-
- fi
-
- done
- i=`expr $i + 1`
-
-done
-
-# Skip this for TSOL, since lp.tsol_separator handles the banners
-#
-# if [ "no" = "${nobanner}" -a "${TERM}" = "PSR" ]
-# then
-# ( eval "${banner} ${banner_filter}" 2>&1 1>&3 ) \
-# | ${LPTELL} ${LPTELL_OPTS} ${printer}
-# fi
-
-if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ]
-then
- exit ${exit_code}
-fi
-
-#####
-#
-# Always ensure the complete job ends with a ``formfeed'', to
-# let the next job start on a new page. (If someone wants to
-# concatenate files, they can give them in one job.)
-# So, if we haven't been putting out a ``formfeed'' between files,
-# it means we haven't followed the last file with a formfeed,
-# so we do it here.
-#####
-if [ -n "${FF}" -a "yes" = "${nofilebreak}" ]
-then
- echo "${CR}${FF}\c"
-fi
-
-${DRAIN}
-
-exit_code=0 exit 0
diff --git a/usr/src/cmd/lp/model/tsol_standard_foomatic b/usr/src/cmd/lp/model/tsol_standard_foomatic
deleted file mode 100644
index c446b0ad8c..0000000000
--- a/usr/src/cmd/lp/model/tsol_standard_foomatic
+++ /dev/null
@@ -1,1190 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-###########
-##
-## Standard printer interface program.
-##
-###########
-
-#####
-#
-# Until we get to the point below where the printer port
-# and physical printer are initialized, we can't do much
-# except exit if the Spooler/Scheduler cancels us.
-#####
-trap 'exit' 15
-
-#####
-#
-# We can be clever about getting a hangup or interrupt, though, at least
-# until the filter runs. Do this early, even though $LPTELL
-# isn't defined, so that we're covered.
-#####
-catch_hangup () {
- if [ -n "${LPTELL}" ]
- then
- echo \
-"The connection to the printer dropped; perhaps the printer went off-line?" \
- | ${LPTELL} ${printer}
- fi
- return 0
-}
-catch_interrupt () {
- if [ -n "${LPTELL}" ]
- then
- echo \
-"Received an interrupt from the printer. The reason is unknown,
-although a common cause is that the baud rate is too high." \
- | ${LPTELL} ${printer}
- fi
- return 0
-}
-trap 'catch_hangup; exit_code=129 exit 129' 1
-trap 'catch_interrupt; exit_code=129 exit 129' 2 3
-
-#####
-#
-# Most of the time we don't want the standard error to be captured
-# by the Spooler, mainly to avoid "Terminated" messages that the
-# shell puts out when we get a SIGTERM. We'll save the standard
-# error channel under another number, so we can use it when it
-# should be captured.
-#
-# Open another channel to the printer port, for use when the
-# regular standard output won't be directed there, such as in
-# command substitution (`cmd`).
-#####
-exec 5>&2 2>/dev/null 3>&1
-
-#####
-#
-# Set some globally used variables and functions.
-#####
-
-: ${TMPDIR:=/tmp}
-: ${SPOOLDIR:=/usr/spool/lp}
-: ${TERMINFO:=/usr/lib/terminfo}
-: ${CHARSETDIR:=/usr/lib/charsets}
-
-: ${LOCALPATH:=${SPOOLDIR}/bin}
-PATH="/bin:/usr/bin:${LOCALPATH}"
-
-MAX_COLS_SMALL_BANNER=40
-
-#####
-#
-# On the 3.2 release of the 386unix product, the parallel port does
-# not support any ioctl calls. As a result, we cannot set the opost
-# and onlcr attributes to have <NL>'s expanded to <CR><NL>. This
-# "filter" gets the job done for us.
-#####
-: ${FIX386BD:=${LOCALPATH}/386parallel}
-if [ -n "${FIX386BD}" -a -x "${FIX386BD}" ]
-then
- FIX386BD="| ${FIX386BD}"
-else
- FIX386BD=""
-fi
-
-#####
-# Use ${TMPPREFIX} as the prefix for all temporary files, so
-# that cleanup is easy. The prefix may be up to 13 characters
-# long, so you only have space for one more character to make
-# a file name. If necessary, make a directory using this prefix
-# for better management of unique temporary file names.
-#####
-TMPPREFIX=${TMPDIR}/`uname -n`$$
-
-#####
-# Before exiting, set ${exit_code} to the value with which to exit.
-# Otherwise, the exit from this script will be 0.
-#####
-trap 'rm -fr ${TMPPREFIX}*; exit ${exit_code}' 0
-
-#####
-# ${LPTELL} is the name of a program that will send its
-# standard input to the Spooler. It is used to forward
-# the description of a printer fault to the Spooler,
-# which uses it in an alert to the administrator.
-#####
-if [ ! -x "${LPTELL:=${LOCALPATH}/lp.tell}" ]
-then
- fake_lptell () {
- header="no"
- while read line
- do
- if [ "no" = "${header}" ]
- then
- errmsg ERROR ${E_IP_UNKNOWN} \
- "unknown printer/interface failure" \
- "consult your system administrator;
- reasons for failure (if any) follow:"
- header=yes
- fi
- echo "${line}" >&2
- done
- return 1
- }
- LPTELL=fake_lptell
-fi
-
-#####
-# ${DRAIN} is the name of a program that will wait
-# long enough for data sent to the printer to print.
-#####
-if [ -x "${LOCALPATH}/drain.output" ]
-then
- DRAIN="${LOCALPATH}/drain.output 5" # wait only five seconds
-else
- DRAIN=
-fi
-
-#####
-# ${LPTSOLSEPARATOR} is the name of a program to put banner and trailer
-# pages around the job.
-#####
-if [ -x ${LOCALPATH}/lp.tsol_separator ]
-then
- LPTSOLSEPARATOR=${LOCALPATH}/lp.tsol_separator
-else
- echo "${LOCALPATH}/lp.tsol_separator not found." >&2
- exit 1
-fi
-
-#####
-# ${LPCAT} is the name of a program to use as a default
-# filter. Minimally it should copy its standard input to
-# the standard output, but it should also trap printer
-# faults. The current LPCAT traps hangups (DCD dropping, SIGHUP),
-# interrupts (SIGINT, SIGQUIT), broken pipe (SIGPIPE), and
-# excess delays in sending data to the printer, interpreting all
-# as printer faults.
-#####
-if [ ! -x "${LPCAT:=${LOCALPATH}/lp.cat}" ]
-then
- LPCAT="cat"
-fi
-
-#####
-# ${LPSET} is the name of a program that will set the
-# character pitch, line pitch, page width, page length,
-# and character set. It helps to have this in a single
-# binary program so that (1) it's faster than calls
-# to "tput"; and (2) it can access the new Terminfo
-# capabilities for printers (on pre SVR3.2 machines, tput can't).
-#####
-if [ ! -x "${LPSET:=${LOCALPATH}/lp.set}" ]
-then
- fake_lpset () {
- echo H V W L S >&2
- false
- }
- LPSET=fake_lpset
-fi
-
-internal_lpset () {
- #####
- #
- # The funny business with the "2>&1 1>&3" is to let us capture
- # the standard ERROR, not the standard OUTPUT as is the usual case
- # with foo=`cmd`. The standard output will go to the printer.
- #####
- [ -n "${stty1}" ] && stty ${stty1} 0<&1
- chk=`${LPSET} "$1" "$2" "$3" "$4" "$5" 2>&1 1>&3`
- [ -n "${stty2}" ] && stty ${stty2} 0<&1
-
- #####
- #
- # The standard error of the delivered ${LPSET} program
- # is a string of letters, H, V, W, L, S, which correspond
- # to cpi, lpi, width, length, and character set. A letter
- # is present only if the corresponding attribute could not
- # be set.
- #####
- for err in ${chk}
- do
- case ${err} in
- H )
- errmsg WARNING ${E_IP_BADCPI} \
- "can't select the character pitch \"${cpi}\"" \
- "check the valid pitches for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- V )
- errmsg WARNING ${E_IP_BADLPI} \
- "can't select the line pitch \"${lpi}\"" \
- "check the valid pitches for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- W )
- width=${cols}
- errmsg WARNING ${E_IP_BADWIDTH} \
- "can't select the page width \"${width}\"" \
- "check the valid widths for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- L )
- length=${lines}
- errmsg WARNING ${E_IP_BADLENGTH} \
- "can't select the page length \"${length}\"" \
- "check the valid lengths for the printer,
- or consult your system administrator;
- printing continues"
- ;;
- S )
- errmsg WARNING ${E_IP_BADCHARSET} \
- "can't select the character set \"${CHARSET}\"" \
- "check the name given in the -S option,
- or consult your system administrator;
- printing continues"
- ;;
- esac
- done
-}
-
-
-#####
-# ${TPUT} is "tput" IF it works. We'll disable it if we get an
-# ugly error message the first time we use it. See the TERM variable
-# later in the script.
-#
-# NOTE: The check we use to see if "tput" works is to use an OLD
-# Terminfo capability, like "lines". If it works with that it may
-# still fail with some of the newer capabilities like "init" (SVR3.0)
-# or "swidm" (SVR3.2), because the version of "tput" we have on your
-# machine is older. Thus, on some of the code where ${TPUT} is used
-# you'll see "2>/dev/null" being used to avoid ugly error messages.
-#####
-TPUT=tput
-
-#####
-# Error message formatter:
-#
-# Invoke as
-#
-# errmsg severity message-number problem help
-#
-# where severity is "ERROR" or "WARNING", message-number is
-# a unique identifier, problem is a short description of the
-# problem, and help is a short suggestion for fixing the problem.
-#####
-
-LP_ERR_LABEL="UX:lp"
-
-E_IP_ARGS=1
-E_IP_OPTS=2
-#E_IP_FILTER=3
-E_IP_STTY=4
-E_IP_UNKNOWN=5
-E_IP_BADFILE=6
-E_IP_BADCHARSET=7
-E_IP_BADCPI=8
-E_IP_BADLPI=9
-E_IP_BADWIDTH=10
-E_IP_BADLENGTH=11
-E_IP_ERRORS=12 # (in slow.filter)
-
-errmsg () {
- case $1 in
- ERROR )
- sev=" ERROR";
- ;;
- WARNING )
- sev="WARNING";
- ;;
- esac
-# tag=`expr "${LP_ERR_LABEL}" : "\(.*\):"``expr "${LP_ERR_LABEL}" : ".*:\(.*\)"`
- echo "${LP_ERR_LABEL}: ${sev}: $3
- TO FIX: $4" >&5
-}
-
-
-###########
-##
-## Check arguments
-###########
-
-parse () {
- echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
-}
-
-#####
-#
-# This program is invoked as
-#
-# ${SPOOLDIR}/.../printer request-id user title copies options files...
-#
-# The first three arguments are simply reprinted on the banner page,
-# the fourth (copies) is used to control the number of copies to print,
-# the fifth (options) is a blank separated list (in a single argument)
-# of user or Spooler supplied options (without the -o prefix),
-# and the last arguments are the files to print.
-#####
-
-if [ $# -lt 5 ]
-then
- errmsg ERROR ${E_IP_ARGS} \
- "wrong number of arguments to interface program" \
- "consult your system administrator"
- exit 1
-fi
-
-printer=`basename $0`
-request_id=$1
-user_name=$2
-title=$3
-copies=$4
-option_list=$5
-
-shift 5
-files="$*"
-
-nobanner="no"
-nofilebreak="no"
-nolabels="no"
-stty=
-
-inlist=
-for i in ${option_list}
-do
- case "${inlist}${i}" in
-
-
- nobanner )
- nobanner="yes"
- ;;
-
- nofilebreak )
- nofilebreak="yes"
- ;;
-
- nolabels )
- nolabels="yes"
- ;;
-
- #
- # The IPP/PAPI attributes are handled by the foomatic-rip filter so
- # all we need to do here is ignore them so that they don't invoke the
- # "unrecognized option" message.
- #
-
- finishing=* | page-ranges=* | sides=* )
- ;;
- number-up=* | orientation-requested=* | media=* )
- ;;
- printer-resolution=* | print-quality=* )
- ;;
-
- #####
- #
- # If you want to add simple options (e.g. -o simple)
- # identify them here.
- #####
-# simple )
-# simple="yes"
-# ;;
-
-
- cpi=pica )
- cpi=10
- ;;
- cpi=elite )
- cpi=12
- ;;
- cpi=* )
- cpi=`parse ${i}`
- ;;
-
- lpi=* )
- lpi=`parse ${i}`
- ;;
-
- length=* )
- length=`parse ${i}`
- ;;
-
- width=* )
- width=`parse ${i}`
- ;;
-
- #####
- #
- # If you want to add simple-value options (e.g. -o value=a)
- # identify them here.
- #####
-# value=* )
-# value=`parse ${i}`
-# ;;
-
-
- #####
- #
- # If you want to add options that, like "stty",
- # take a list (e.g. -o lopt='a b c'), identify
- # them here and below (look for LOPT).
- #####
- stty=* | flist=* | lpd=* )
-#LOPT stty=* | flist=* | lpd=* | lopt=* )
-
- inlist=`expr "${inlist}${i}" : "^\([^=]*=\)"`
- case "${i}" in
- ${inlist}\'*\' )
- item=`expr "${i}" : "^[^=]*='*\(.*\)'\$"`
- ;;
- ${inlist}\' )
- continue
- ;;
- ${inlist}\'* )
- item=`expr "${i}" : "^[^=]*='*\(.*\)\$"`
- ;;
- ${inlist}* )
- item=`expr "${i}" : "^[^=]*=\(.*\)\$"`
- ;;
- *\' )
- item=`expr "${i}" : "^\(.*\)'\$"`
- ;;
- * )
- item="${i}"
- ;;
- esac
-
- #####
- #
- # We don't dare use "eval" because a clever user could
- # put something in an option value that we'd end up
- # exec'ing.
- #####
- case "${inlist}" in
- stty= )
- stty="${stty} ${item}"
- ;;
- flist= )
- flist="${flist} ${item}"
- ;;
- lpd= )
- lpd="${lpd} ${item}"
- ;;
-#LOPT lopt= )
-#LOPT lopt="${lopt} ${item}"
-#LOPT ;;
- esac
-
- case "${i}" in
- ${inlist}\'*\' )
- inlist=
- ;;
- ${inlist}\'* )
- ;;
- *\' | ${inlist}* )
- inlist=
- ;;
- esac
- ;;
-
- * )
- errmsg WARNING ${E_IP_OPTS} \
- "unrecognized \"-o ${i}\" option" \
- "check the option, resubmit if necessary
- printing continues"
- ;;
- esac
-done
-
-#####
-#
-# Additional ``parameters'' are passed via Shell environment
-# variables:
-#
-# TERM The printer type (used for Terminfo access)
-# CHARSET The character set to choose
-# FILTER The filter to run
-#####
-
-#####
-# Set defaults for unset variables.
-#####
-
-: ${TERM:=unknown}
-tput lines 1>/dev/null 2>&1 || TPUT=:
-
-: ${CHARSET:=cs0}
-
-PPDFILTER=/usr/lib/lp/bin/foomatic-rip
-PPDFILTERA="${PPDFILTER} ${request_id} ${user_name} \"${title}\" ${copies} \"${option_list}\""
-
-if [ -z "${FILTER}" ]
-then
- #####
- #
- # If no filter is being used, we have a little routine that
- # will push the data to the printer. It traps hangups (loss
- # of carrier) and checks for excessive delays in sending the
- # data to the printer. The lesser of the print rate of the printer
- # (obtained from Terminfo) or the baud rate is used to compute
- # the expected delay. If neither of these is correct, you
- # may be experiencing false alarms. If so, give the correct
- # rate, in characters per second, as a single argument.
- # An argument of 0 means don't check for delays.
- # Give an -r option to get a printout of actual delays.
- # (QUOTES ARE IMPORTANT!)
- #####
- case "$TERM" in
- PS )
- # make the "postscript" printers use postio to
- # talk to the printer and periodically get a
- # status from them
- FILTER="/usr/lib/lp/postscript/postio"
- ;;
- PSR )
- # make the "reverse postscript" printers reverse the
- # output and the use postio to talk to the printer
- FILTER="/usr/lib/lp/postscript/postreverse | \
- /usr/lib/lp/postscript/postio"
- ;;
- * )
- # we don't know the type, so just assume that the
- # input and output are the same
- if [ `basename "${LPCAT}"` = "lp.cat" ] ; then
- FILTER="${LPCAT} 0" # infinite delays
- # FILTER="${LPCAT} 120" # e.g. 120 CPS
- # FILTER="${LPCAT} -r 0 2>/tmp/delays"
- # FILTER=${LPCAT}
- fi
- ;;
- esac
-fi
-
-logger -p lpr.debug -t "tsol_standard_foomatic: ${request_id}" "filter : ${FILTER}"
-logger -p lpr.debug -t "tsol_standard_foomatic: ${request_id}" "ppdfilter : ${PPDFILTERA}"
-
-#
-# Append the PPD foomatic-rip filter
-#
-FILTER="${FILTER} | ${PPDFILTERA}"
-
-###########
-##
-## Initialize the printer port
-###########
-
-#####
-#
-# SERIAL PORTS:
-# Initialize everything.
-#
-# PARALLEL PORTS:
-# Don't initialize baud rate.
-#
-# It's not obvious how to tell if a port is parallel or serial.
-# However, by splitting the initialization into two steps and letting
-# the serial-only part fail nicely, it'll work.
-#
-# Another point: The output must be a ``tty'' device. If not, don't
-# bother with any of this.
-#####
-stty1= stty2=
-tty 0<&1 1>/dev/null 2>&1 && {
-
- #####
- #
- # First set the default parameters,
- # then the requested parameters.
- #####
-
- stty \
- 9600 \
- 0<&1 2>/dev/null 1>&2
- stty \
- cs8 -cstopb -parenb -parodd \
- ixon -ixany \
- opost -olcuc onlcr -ocrnl -onocr -onlret -ofill \
- nl0 cr0 tab0 bs0 vt0 ff0 \
- 0<&1 2>/dev/null 1>&2
-
- if [ -n "${stty}" ]
- then
- if stty ${stty} 0<&1 1>/dev/null 2>&5
- then
- :
- else
- errmsg ERROR ${E_IP_STTY} \
- "stty option list failed" \
- "check the \"-o stty\" option you used,
- or consult your system administrator"
- exit 1
- fi
- fi
-
- #####
- #
- # Here you may want to add other port initialization code.
- # Some examples:
- #
- # estty # for printer needing hardware flow control (3B2/EPORTS)
- # fctty # for printer needing hardware flow control (3B15,3B20)
- #####
- #estty 0<&1
- #fctty 0<&1
-
-
- ##########
- #
- # Find out if we have to turn off opost before initializing the
- # printer and on after. Likewise, check clocal.
- #
- # Turning OFF opost (output postprocessing) keeps the UNIX system
- # from changing what we try to send to the printer. Turning ON
- # clocal keeps the UNIX system from dropping what we are trying to
- # send if the printer drops DTR. An example of the former is the
- # AT&T 479, which wants to send a linefeed (ASCII 10) when a page
- # width of 10 is set; with opost on, this COULD BE turned into a
- # carriage-return/linefeed pair. An example of the latter is the
- # AT&T 455, which momentarily drops DTR when it gets the
- # initialization string, is2; with clocal off, the UNIX system
- # stops sending the rest of the initialization sequence at that
- # point.
- #
- # THIS CODE MUST FOLLOW THE REST OF THE PORT INITIALIZATION CODE.
- ##########
- cur_stty=`stty -a 0<&3`
- expr "${cur_stty}" : '.*-opost' 1>/dev/null 2>&1 \
- || stty1="${stty1} -opost" stty2="${stty2} opost"
- expr "${cur_stty}" : '.*-clocal' 1>/dev/null 2>&1 \
- && stty1="${stty1} clocal" stty2="${stty2} -clocal"
- expr "${cur_stty}" : '.* opost.*' 1>/dev/null 2>&1 \
- || banner_filter=${FIX386BD}
-
-}
-
-
-###########
-##
-## Initialize the physical printer (Part I).
-## Here we bring the printer to a sane state and set the page size.
-###########
-
-##########
-#
-# WARNING! The "echo" command will catch backslashes (\) and
-# try to interpret the characters following it. Thus, using
-# "echo" to print string values obtained from "tput" is dangerous.
-##########
-
-#####
-# We're confident that most printers don't have backslashes
-# in the control sequences for carriage return and form-feed.
-# We're also confident that these don't contain newlines.
-# We're also confident that most printers have a linefeed
-# in the control sequence for doing a newline (move to beginning
-# of next line), but we can't capture it like we do the
-# carriage return or form-feed. Thus we set it unconditionally.
-# We don't set form-feed if it isn't defined, however, because
-# maybe the printer doesn't have a formfeed. If not set, we're
-# out of luck.
-#####
-
-CR=`${TPUT} cr`
-[ -z "${CR}" ] && CR="\r"
-
-FF=`${TPUT} ff`
-BFF=$FF
-[ -z "${BFF}" ] && BFF="\f"
-
-NL="${CR}\n"
-
-lines=`${TPUT} lines`
-[ -z "${lines}" -o 0 -ge "${lines}" ] && lines=66
-
-cols=`${TPUT} cols`
-[ -z "${cols}" -o 0 -ge "${cols}" ] && cols=132
-
-#####
-#
-# Basic initialization. The ``else'' clause is equivalent,
-# but covers cases where old Terminal Information Utilities are present.
-#####
-[ -n "${stty1}" ] && stty ${stty1} 0<&1
-
-#
-# "tput init" will return an "^M" in many cases to "stdout", i.e., printer!
-# This creates problems for some PS printers
-#
-if [ "${TERM}" = "PS" -o "${TERM}" = "PSR" ]
-then
- :
-elif ${TPUT} init 2>/dev/null
-then
- :
-else
- pgm=`${TPUT} iprog`
- if [ -x "${pgm}" ]
- then
- eval ${pgm}
- fi
-
- ${TPUT} is1
- ${TPUT} is2
-
- tabset=
- if [ "8" != "`${TPUT} it`" ]
- then
- stty tab3 0<&1 1>/dev/null 2>&1
-
- elif `${TPUT} ht >/dev/null`
- then
- tabset="/usr/lib/tabset/${TERM}"
- if [ -r ${tabset} ]
- then
- cat -s ${tabset}
- fi
- stty tab3 0<&1 1>/dev/null 2>&1
- fi
-
- file=`${TPUT} if`
- if [ "${tabset}" != "${file}" -a -r "${file}" ]
- then
- cat -s "${file}"
- fi
-
- ${TPUT} is3
- echo "${CR}\c"
-fi
-[ -n "${stty2}" ] && stty ${stty2} 0<&1
-
-#####
-#
-# Set the page size and print spacing, but not the character set.
-# We will be doing the character set later (after the header).
-#####
-internal_lpset "${cpi}" "${lpi}" "${width}" "${length}" ""
-
-#####
-#
-# The banner page (and cancellation page) will
-# use double width characters if they're available.
-#####
-WIDE_CS=`${TPUT} swidm 2>/dev/null` && NORM_CS=`${TPUT} rwidm 2>/dev/null`
-PAD="#####${NL}"
-
-#####
-#
-# Some printers need to have the banner page filtered.
-#####
-case "${TERM}" in
-
-PS | PSR )
- banner_filter="/usr/lib/lp/postscript/postprint | /usr/lib/lp/postscript/postio"
- LPTELL_OPTS="-l"
- ;;
-
-esac
-if [ -n "${banner_filter}" ]
-then
- banner_filter="| ${banner_filter}"
-fi
-
-#####
-#
-# Now that the printer is ready for printing, we're able
-# to record on paper a cancellation.
-#####
-
-cancel_banner () {
- echo "${PAD}${PAD}\c"
- echo "#####${WIDE_CS} Job ${request_id}${NORM_CS}${NL}\c"
- echo "#####${WIDE_CS} suspended or canceled${NORM_CS}${NL}\c"
- echo "${PAD}${PAD}\c"
-}
-
-canceled () {
- ${TPUT} scs 0 2>/dev/null
- echo "${CR}\c"
- if [ "${width:-${cols}}" -lt "${MAX_COLS_SMALL_BANNER}" ]
- then
- WIDE_CS= NORM_CS=
- fi
- cancel_banner
- if [ -n "${BFF}" ]
- then
- echo "${CR}${BFF}\c"
- fi
-}
-
-trap 'eval canceled ${banner_filter}; exit_code=0 exit' 15
-
-
-###########
-##
-## Print the banner page
-###########
-
-#####
-#
-# You may want to change the following code to get a custom banner.
-#####
-
-regular_banner () {
- echo "${CR}\c"
- echo "${PAD}${PAD}${PAD}${PAD}${PAD}\c"
- echo "#####${WIDE_CS} User: ${user_name}${NORM_CS}${NL}\c"
- if [ -n "$ALIAS_USERNAME" ]
- then
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Alias: ${ALIAS_USERNAME}${NORM_CS}${NL}\c"
- fi
- if [ -n "${title}" ]
- then
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Title: ${title}${NORM_CS}${NL}\c"
- fi
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Printed: `LANG=C date '+%a %H:%M %h %d, %Y'`${NORM_CS}${NL}\c"
- echo "${PAD}\c"
- echo "#####${WIDE_CS} Job number: ${request_id}${NORM_CS}${NL}\c"
- echo "${PAD}${PAD}${PAD}${PAD}${PAD}\c"
- if [ -n "${BFF}" ]
- then
- echo "${CR}${BFF}\c"
- fi
-}
-
-small_banner () {
- echo "${CR}\c"
- echo "${PAD}\c"
- echo "##### User: ${user_name}${NL}\c"
- if [ -n "${title}" ]
- then
- echo "##### Title: ${title}${NL}\c"
- fi
- echo "##### Date: `LANG=C date '+%a %H:%M %h %d, %Y'`${NL}\c"
- echo "##### Job: ${request_id}${NL}\c"
- echo "${PAD}\c"
- if [ -n "${BFF}" ]
- then
- echo "${CR}${BFF}\c"
- fi
-}
-
-if [ "${width:-${cols}}" -lt "${MAX_COLS_SMALL_BANNER}" ]
-then
- banner=small_banner
-else
- banner=regular_banner
-fi
-
-## Skip this for PS/PSR in TSOL, since lp.tsol_separator handles the banners
-if [ "no" = "${nobanner}" -a "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- ( eval "${banner} ${banner_filter}" 2>&1 1>&3 ) \
- | ${LPTELL} ${LPTELL_OPTS} ${printer}
-fi
-
-###########
-##
-## Surround the job by PostScript code to produce banner
-## and trailerpages and page headers and footers.
-##
-###########
-
-BANNER_EXIT_CODE=${TMPPREFIX}.banner.exit_code
-echo 0 > ${BANNER_EXIT_CODE}
-TSOLSEPARATOR_LOG=${TMPPREFIX}.banner.errmsg
-
-tsol_bannerize () {
- TSOLSEPARATOR_OPTS="-e ${TSOLSEPARATOR_LOG}"
-
- if [ "yes" = "${nolabels}" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -l"
- fi
-
- if [ "yes" = "${nobanner}" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -t /dev/null -b /dev/null"
- fi
-
- if [ "${TERM}" = "PSR" ]
- then
- TSOLSEPARATOR_OPTS="${TSOLSEPARATOR_OPTS} -r"
- fi
-
- # Get rid of the #, TAB and NL characters in the title
- tsol_title=`echo $title`
- tsol_title=`echo $tsol_title | sed 's/#//g'`
-
- LC_TIME=C ${LPTSOLSEPARATOR} ${TSOLSEPARATOR_OPTS} "${printer}" \
- "${request_id}" "${user_name}" "${tsol_title}" "${file}"
- echo $? > ${BANNER_EXIT_CODE}
- true
-}
-
-bannerize=tsol_bannerize
-
-if [ "yes" = "${nobanner}" -a "yes" = "${nolabels}" ]
-then
- bannerize=cat
-fi
-
-if [ "${TERM}" != "PSR" -a "${TERM}" != "PS" ]
-then
- bannerize=cat
-fi
-
-
-###########
-##
-## Initialize the physical printer (Part II)
-## Here we select the character set.
-## One could argue that this should be done before the banner is printed,
-## but we don't, to keep the banner page looking consistent for the
-## operator. You can move this code before the banner code if you
-## disagree. If you do, combine it with the other call to "internal_lpset"
-## to do everything in one shot.
-###########
-internal_lpset "" "" "" "" "${CHARSET}"
-
-###########
-##
-## Print some copies of the file(s)
-###########
-
-#####
-#
-# The protocol between the interface program and the Spooler
-# is fairly simple:
-#
-# All standard error output is assumed to indicate a
-# fault WITH THE REQUEST. The output is mailed to the
-# user who submitted the print request and the print
-# request is finished.
-#
-# If the interface program sets a zero exit code,
-# it is assumed that the file printed correctly.
-# If the interface program sets a non-zero exit code
-# less than 128, it is assumed that the file did not
-# print correctly, and the user will be notified.
-# In either case the print request is finished.
-#
-# If the interface program sets an exit code greater
-# than 128, it is assumed that the file did not print
-# because of a printer fault. If an alert isn't already
-# active (see below) one will be activated. (Exit code
-# 128 should not be used at all. The shell, which executes
-# this program, turns SIGTERM, used to kill this program
-# for a cancellation or disabling, into exit 128. The
-# Spooler thus interpretes 128 as SIGTERM.)
-#
-# A message sent to the standard input of the ${LPTELL}
-# program is assumed to describe a fault WITH THE PRINTER.
-# The output is used in an alert (if alerts are defined).
-# If the fault recovery is "wait" or "begin", the printer
-# is disabled (killing the interface program if need be),
-# and the print request is left on the queue.
-# If the fault recovery is "continue", the interface program
-# is allowed to wait for the printer fault to be cleared so
-# it can resume printing.
-#
-# This interface program relies on filters to detect printer faults.
-# In absence of a filter provided by the customer, it uses a simple
-# filter (${LPCAT}) to detect the class of faults that cause DCD
-# (``carrier'') drop. The protocol between the interface program and
-# the filter:
-#
-# The filter should exit with zero if printing was
-# successful and non-zero if printing failed because
-# of a printer fault. This interface program turns a
-# non-zero exit of the filter into an "exit 129" from
-# itself, thus telling the Spooler that a printer fault
-# (still) exists.
-#
-# The filter should report printer faults via a message
-# to its standard error. This interface program takes all
-# standard error output from the filter and feeds it as
-# standard input to the ${LPTELL} program.
-#
-# The filter should wait for a printer fault to clear,
-# and should resume printing when the fault clears.
-# Preferably it should resume at the top of the page
-# that was being printed when the fault occurred.
-# If it waits and finishes printing, it should exit
-# with a 0 exit code. If it can't wait, it should exit
-# with a non-zero exit code.
-#
-# The interface program expects that ANY message on the
-# standard error from the filter indicates a printer fault.
-# Therefore, a filter should not put user (input) error
-# messages on the standard error, but on the standard output
-# (where the user can read them when he or she examines
-# the print-out).
-#
-#####
-
-badfileyet=
-i=1
-while [ $i -le $copies ]
-do
- for file in ${files}
- do
- if [ -r "${file}" ]
- then
- #####
- #
- # Here's where we set up the $LPTELL program to
- # capture fault messages, and...
- #
- # Here's where we print the file.
- #
- # We set up a pipeline to $LPTELL, but play a trick
- # to get the filter's standard ERROR piped instead of
- # its standard OUTPUT: Divert the standard error (#2) to
- # the standard output (#1) IN THE PIPELINE. The shell
- # will have changed #1 to be the pipe, not the
- # printer, so diverting #2 connects it to the pipe.
- # We then change the filter's #1 to a copy of the real
- # standard output (the printer port) made earlier,
- # so that is connected back to the printer again.
- #
- # We do all this inside a parenthesized expression
- # so that we can get the exit code; this is necessary
- # because the exit code of a pipeline is the exit
- # code of the right-most command, which isn't the
- # filter.
- #
- # These two tricks could be avoided by using a named
- # pipe to connect the standard error to $LPTELL. In
- # fact an early prototype of this script did just
- # that; however, the named pipe introduced a timing
- # problem. The processes that open a named pipe hang
- # until both ends of the pipe are opened. Cancelling
- # a request or disabling the printer often killed one
- # of the processes, causing the other process to hang
- # forever waiting for the other end of the pipe to
- # be opened.
- #####
- EXIT_CODE=${TMPPREFIX}e
- trap '' 1 # Let the filter handle a hangup
- trap '' 2 3 # and interrupts
- (
- #####
- # Put the 0<${file} before the "eval" to keep
- # clever users from giving a file name that
- # evaluates as something to execute.
- #####
- 0<${file} $bannerize | eval ${FILTER} 2>&1 1>&3
- echo $? >${EXIT_CODE}
- ) | ${LPTELL} ${LPTELL_OPTS} ${printer}
-
- # if lp.tsol_separator had an error, send its logged
- # error message to LPTELL.
- banner_exit_code=`cat ${BANNER_EXIT_CODE}`
- if [ -n "${banner_exit_code}" -a \
- 0 -ne "${banner_exit_code}" -a \
- -n "${LPTELL}" -a \
- -r "${TSOLSEPARATOR_LOG}" ]
- then
- cat ${TSOLSEPARATOR_LOG} | ${LPTELL} ${printer}
- echo 77 > ${EXIT_CODE}
- fi
-
- trap 'catch_hangup; exit_code=129 exit 129' 1
- trap 'catch_interrupt; exit_code=129 exit 129' 2 3
- exit_code=`cat ${EXIT_CODE}`
-
- if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ]
- then
- trap '' 15 # Avoid dying from disable
- sleep 4 # Give $LPTELL a chance to tell
- exit ${exit_code}
- fi
-
- if [ -n "${FF}" -a "no" = "${nofilebreak}" ]
- then
- echo "${CR}${FF}\c"
- fi
-
- else
-
- #####
- #
- # Don't complain about not being able to read
- # a file on second and subsequent copies, unless
- # we've not complained yet. This removes repeated
- # messages about the same file yet reduces the
- # chance that the user can remove a file and not
- # know that we had trouble finding it.
- #####
- if [ "${i}" -le 1 -o -z "${badfileyet}" ]
- then
- errmsg WARNING ${E_IP_BADFILE} \
- "cannot read file \"${file}\"" \
- "see if the file still exists and is readable,
- or consult your system administrator;
- printing continues"
- badfileyet=yes
- fi
-
- fi
-
- done
- i=`expr $i + 1`
-
-done
-
-# Skip this for TSOL, since lp.tsol_separator handles the banners
-#
-# if [ "no" = "${nobanner}" -a "${TERM}" = "PSR" ]
-# then
-# ( eval "${banner} ${banner_filter}" 2>&1 1>&3 ) \
-# | ${LPTELL} ${LPTELL_OPTS} ${printer}
-# fi
-
-if [ -n "${exit_code}" -a 0 -ne "${exit_code}" ]
-then
- exit ${exit_code}
-fi
-
-#####
-#
-# Always ensure the complete job ends with a ``formfeed'', to
-# let the next job start on a new page. (If someone wants to
-# concatenate files, they can give them in one job.)
-# So, if we haven't been putting out a ``formfeed'' between files,
-# it means we haven't followed the last file with a formfeed,
-# so we do it here.
-#####
-if [ -n "${FF}" -a "yes" = "${nofilebreak}" ]
-then
- echo "${CR}${FF}\c"
-fi
-
-${DRAIN}
-
-exit_code=0 exit 0
diff --git a/usr/src/cmd/lp/model/uri b/usr/src/cmd/lp/model/uri
deleted file mode 100755
index 7d8a26dfea..0000000000
--- a/usr/src/cmd/lp/model/uri
+++ /dev/null
@@ -1,253 +0,0 @@
-#!/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# printer interface script for printers with a URI instead of
-# device name.
-#
-# The existence of a "PPD" environment variable in the calling environment
-# indicates that Foomatic is to be used for filtering all job data as it is
-# streamed to the output device (printer).
-#
-# The contents of a "DEVICE_URI" environment variable in the calling
-# environment indicates the method and endpoint used in communicating with
-# the output device (printer). If no DEVICE_URI is present or the value
-# contains a missing or unknown scheme, the URI scheme is assumed to be
-# "file" and output streaming will be handled accordingly.
-
-export PATH=/bin:/usr/bin:/usr/lib/lp/bin:/usr/sfw/bin
-
-TAG="uri-interface"
-
-
-# Re-arrange fds for later use
-exec 5>&2 2>/dev/null 3>&1
-
-#
-# Exit Codes:
-#
-EXIT_OK=0
-EXIT_FATAL=1
-EXIT_TERM=128
-EXIT_RETRY=129
-
-fail() { # exit-code "message"
- logger -p lpr.error -t ${TAG} "${2}"
- echo ${2} >&5
- exit ${1}
-}
-
-# signal handling
-# EXIT 0 - normal exit
-# HUP 1 - the output stream disconnected
-# INT 2 - the output stream interupted us
-# QUIT 3 - the output stream interupted us
-# TERM 15 - we have been cancelled or shutdown
-
-catch_exit() {
- exit $exit_code
-}
-
-catch_disconnect() {
- fail ${EXIT_RETRY} "connection to the printer dropped; off-line?"
-}
-
-catch_interrupt() {
- fail ${EXIT_RETRY} "interrupt from the printer; baud-rate issues?"
-}
-
-catch_cancellation() {
- fail ${EXIT_RETRY} "job cancelled"
-}
-
-trap 'catch_disconnect()' HUP
-trap 'catch_interrupt()' INT QUIT
-trap 'catch_cancellation()' TERM
-
-parse_uri() { # scheme://[[user[:password]@]host[:port]]/path
- URI_SCHEME=$(expr "$1" : "\(.*\)://.*")
-}
-
-parse() {
- echo "$(expr \"$1\" : \"^[^=]*=\(.*\)\")"
-}
-
-#
-# Generate an ASCII burst page and pass it to the printer
-# This may be much faster than the PostScript(TM) burst page
-#
-ascii_burst_page() {
- cat <<EOF
- ${title}
- Request: ${request_id}
- User: ${user}
- Printer: ${printer}
- Time: $(date)
- Copies: ${copies}
-EOF
- tput ff
-}
-
-#
-# Generate a PostScript(TM) burst page (this assumes an 8.5x11 page size)
-#
-postscript_burst_page() {
- cat <<-EOF
- %!ps
- /PrintLine { exch findfont exch scalefont setfont moveto show } def
- newpath 4 setlinewidth 1 setlinejoin
- 15 760 moveto 595 760 lineto 595 585 lineto 15 585 lineto closepath
- gsave .75 setgray fill grestore
- 0 setgray stroke
- (${user}) 30 730 /Times-Bold 24 PrintLine
- (${request_id}) 415 730 /Times-Bold 24 PrintLine
- (${printer}) 30 600 /Times-Bold 16 PrintLine
- ($(date)) 350 600 /Times-Roman 16 PrintLine
- (${title}) 100 660 /Times-Bold 36 PrintLine
- (Copies: ${copies}) 30 25 /Times-Roman 16 PrintLine
- showpage
- EOF
-}
-
-logger -p lpr.debug -t ${TAG} "$0 $*"
-
-#
-# Detemine if we were called correctly
-#
-if [[ $# -lt 5 ]] ; then
- fail ${EXIT_FATAL} "wrong number of arguments to interface script"
-fi
-
-
-printer=$(basename $0)
-request_id=$1
-user=$2
-title=$3
-copies=$4
-options=$5
-
-shift 5
-files="$*"
-
-burst_page="postscript_burst_page"
-
-for i in ${options}
-do
- case "${i}" in
-
- nobanner )
- burst_page=""
- ;;
-
- nofilebreak )
- nofilebreak="yes"
- ;;
-
- burst-page-type=* )
- burst_page="$(parse ${i})_burst_page"
- ;;
-
- * )
- logger -p lpr.error -t ${TAG} \
- "unrecognized \"-o ${i}\" option, ignored" 1>&2
- ;;
- esac
-done
-
-
-#
-# Procss the DEVICE_URI if we have one
-#
-if [[ -n "${DEVICE_URI}" ]] ; then
- parse_uri ${DEVICE_URI} # split up the URI
-
- URI_SCHEME=${URI_SCHEME:-file} # if there is no scheme, assume "file"
-
- case "${URI_SCHEME}" in
- file|usb|ecpp|serial|parallel)
- IO_HANDLER="lp.cat"
- IO_HANDLER_ARGS=""
- ;;
- smb)
- IO_HANDLER="smbspool"
- IO_HANDLER_ARGS="${request_id} ${user} \"${title}\" 1
- \"${options}\""
- ;;
- tcp|socket)
- URI_HOST=$(expr "${DEVICE_URI}" : ".*://\([^:/]*\)")
- URI_PORT=$(expr "${DEVICE_URI}" : ".*://.*:\([^/]*\)")
- if [[ -z "${URI_HOST}" ]] ; then
- fail ${EXIT_FATAL} "invalid device-uri: ${DEVICE_URI}, reset with lpadmin -v"
- fi
- URI_PORT=${URI_PORT:-"9100"}
- IO_HANDLER="telnet"
- IO_HANDLER_ARGS="-c -E ${URI_HOST} ${URI_PORT}"
- ;;
- lpd|ipp)
- IO_HANDLER="lp"
- IO_HANDLER_ARGS="-s -d ${DEVICE_URI}"
- ;;
- *)
- IO_HANDLER=${URI_SCHEME}
- IO_HANDLER_ARGS=""
- ;;
- esac
-fi
-IO_HANDLER=${IO_HANDLER:-"lp.cat"} # if IO_HANDLER is still unset, use lp.cat
-
-# determine if the IO handler is available for us to use when communicating with
-# the output device (printer.)
-whence ${IO_HANDLER} >/dev/null
-if [[ $? -ne 0 ]] ; then
- fail ${ERR_FATAL} \
- "Interface script unable to locate IO handler: ${IO_HANDLER}"
-fi
-
-# There is a PPD file specified, so use foomatic
-if [[ -n "${PPD}" ]] ; then
- FILTER_CHAIN="| foomatic-rip"
-fi
-
-#
-# Start processing the job here
-#
-set | logger -p lpr.debug -t "${TAG}"
-
-(
- if [[ -n "${burst_page}" ]] ; then
- eval "${burst_page} ${FILTER_CHAIN}"
- fi
- while [[ $copies -gt 0 ]] ; do
- for file in ${files} ; do
- if [[ -r "${file}" ]] ; then
- eval "cat ${file} ${FILTER_CHAIN}"
- fi
- done
- copies=$(( copies - 1 ))
- done
-) | ${IO_HANDLER} ${IO_HANDLER_ARGS}
-
-exit ${EXIT_OK}
diff --git a/usr/src/cmd/lvm/metassist/controller/Makefile b/usr/src/cmd/lvm/metassist/controller/Makefile
index 4272d4d504..8581a74bca 100644
--- a/usr/src/cmd/lvm/metassist/controller/Makefile
+++ b/usr/src/cmd/lvm/metassist/controller/Makefile
@@ -36,7 +36,7 @@ include $(METASSIST_TOPLEVEL)/../../Makefile.cmd
include $(METASSIST_TOPLEVEL)/Makefile.env
INCLUDES += -I.. -I../common -I../xml -I../layout \
- -I/usr/include/libxml2
+ -I$(ADJUNCT_PROTO)/usr/include/libxml2
CFLAGS += $(INCLUDES)
POFILE = controllerp.po
diff --git a/usr/src/cmd/lvm/metassist/xml/Makefile b/usr/src/cmd/lvm/metassist/xml/Makefile
index 89f786d3a6..1a3963030a 100644
--- a/usr/src/cmd/lvm/metassist/xml/Makefile
+++ b/usr/src/cmd/lvm/metassist/xml/Makefile
@@ -35,7 +35,7 @@ MSGFILES = $(SRCS:%.c=%.i)
include $(METASSIST_TOPLEVEL)/../../Makefile.cmd
include $(METASSIST_TOPLEVEL)/Makefile.env
-INCLUDES += -I /usr/include/libxml2 -I../common
+INCLUDES += -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I../common
CFLAGS += $(INCLUDES)
POFILE = xmlp.po
diff --git a/usr/src/cmd/man/src/man.c b/usr/src/cmd/man/src/man.c
index f272ecab6e..a2ef30da5b 100644
--- a/usr/src/cmd/man/src/man.c
+++ b/usr/src/cmd/man/src/man.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, Josef 'Jeff' Sipek <jeffpc@31bits.net>. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T. */
@@ -530,10 +531,14 @@ doargs:
freev(pathv);
/*
- * Since we can't make use of GNU troff, set the path to ensure we
- * find the one in /usr/bin first.
+ * If the TROFF environment variable hasn't been set, set PATH to
+ * ensure that we find nroff in /usr/bin, regardless of the user's
+ * PATH. (If the TROFF environment variable has been set, we
+ * assume that the environment has been constructed to execute the
+ * the nroff/troff found in the PATH with any options that may be
+ * specific to that implementation -- e.g., groff.)
*/
- if (putenv("PATH=/usr/bin") != 0) {
+ if (getenv("TROFF") == NULL && putenv("PATH=/usr/bin") != 0) {
perror("putenv");
exit(1);
}
diff --git a/usr/src/cmd/mdb/Makefile.common b/usr/src/cmd/mdb/Makefile.common
index 4e282bf001..3bbca8d4e0 100644
--- a/usr/src/cmd/mdb/Makefile.common
+++ b/usr/src/cmd/mdb/Makefile.common
@@ -45,7 +45,8 @@ COMMON_MODULES_PROC = \
#
COMMON_MODULES_PROC_32BIT = \
svc.configd \
- svc.startd
+ svc.startd \
+ v8
#
# MDB modules used for debugging kernels.
diff --git a/usr/src/cmd/mdb/Makefile.kmdb.files b/usr/src/cmd/mdb/Makefile.kmdb.files
index 3c5983de21..a82206d42c 100644
--- a/usr/src/cmd/mdb/Makefile.kmdb.files
+++ b/usr/src/cmd/mdb/Makefile.kmdb.files
@@ -84,6 +84,7 @@ KMDBSRCS += \
mdb_target.c \
kmdb_terminfo.c \
mdb_termio.c \
+ mdb_typedef.c \
mdb_umem.c \
kmdb_umemglue.c \
mdb_value.c \
diff --git a/usr/src/cmd/mdb/Makefile.libstandctf b/usr/src/cmd/mdb/Makefile.libstandctf
index 7d4c8fbf0d..b5dce2d926 100644
--- a/usr/src/cmd/mdb/Makefile.libstandctf
+++ b/usr/src/cmd/mdb/Makefile.libstandctf
@@ -43,7 +43,7 @@ MAPFILE = ../../../common/libstandctf/mapfile
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CPPFLAGS += -I$(SRC)/common/ctf -I../../../common -DCTF_OLD_VERSIONS -D_MDB \
- -Dvsnprintf=ctf_vsnprintf
+ -Dvsnprintf=ctf_vsnprintf -Dassfail=kmdb_prom_assfail
#
# kmdb is a kernel module, so we'll use the kernel's build flags.
diff --git a/usr/src/cmd/mdb/Makefile.mdb b/usr/src/cmd/mdb/Makefile.mdb
index f331a43fda..9d1d7b4d6c 100644
--- a/usr/src/cmd/mdb/Makefile.mdb
+++ b/usr/src/cmd/mdb/Makefile.mdb
@@ -85,6 +85,7 @@ SRCS += \
mdb_target.c \
mdb_tdb.c \
mdb_termio.c \
+ mdb_typedef.c \
mdb_umem.c \
mdb_value.c \
mdb_vcb.c \
diff --git a/usr/src/cmd/mdb/common/libstandctf/mapfile b/usr/src/cmd/mdb/common/libstandctf/mapfile
index e72c2ddbcf..63b2ec06ee 100644
--- a/usr/src/cmd/mdb/common/libstandctf/mapfile
+++ b/usr/src/cmd/mdb/common/libstandctf/mapfile
@@ -20,6 +20,9 @@
#
# CDDL HEADER END
#
+#
+# Copyright (c) 2012, Joyent, Inc.
+#
#
# MAPFILE HEADER START
@@ -40,15 +43,19 @@ $mapfile_version 2
SYMBOL_SCOPE {
global:
ctf_add_array;
+ ctf_add_float;
+ ctf_add_integer;
ctf_add_member;
ctf_add_pointer;
ctf_add_struct;
+ ctf_add_type;
ctf_add_typedef;
ctf_add_union;
ctf_array_info;
ctf_bufopen;
ctf_close;
ctf_create;
+ ctf_delete_type;
ctf_discard;
ctf_enum_iter;
ctf_enum_name;
diff --git a/usr/src/cmd/mdb/common/mdb/mdb.c b/usr/src/cmd/mdb/common/mdb/mdb.c
index 5c74c71772..6f2df6f533 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb.c
@@ -21,9 +21,6 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- */
-
-/*
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
@@ -72,6 +69,7 @@
#include <mdb/mdb_err.h>
#include <mdb/mdb_lex.h>
#include <mdb/mdb_io.h>
+#include <mdb/mdb_ctf.h>
#ifdef _KMDB
#include <kmdb/kmdb_module.h>
#endif
@@ -555,6 +553,13 @@ mdb_create(const char *execname, const char *arg0)
(void) mdb_callb_add(NULL, MDB_CALLB_PROMPT, (mdb_callb_f)prompt_update,
NULL);
+ /*
+ * The call to ctf_create that this does can in fact fail, but that's
+ * okay. All of the ctf functions that might use the synthetic types
+ * make sure that this is safe.
+ */
+ (void) mdb_ctf_synthetics_init();
+
#ifdef _KMDB
(void) mdb_nv_create(&mdb.m_dmodctl, UM_SLEEP);
#endif
@@ -577,6 +582,8 @@ mdb_destroy(void)
mdb_intr_disable();
+ mdb_ctf_synthetics_fini();
+
mdb_macalias_destroy();
/*
@@ -899,6 +906,8 @@ mdb_call(uintmax_t addr, uintmax_t count, uint_t flags)
flags | DCMD_PIPE_OUT, &cp->c_argv,
&cp->c_addrv, cp->c_vcbs);
+ mdb.m_lastret = status;
+
ASSERT(mdb.m_in == iobs[MDB_IOB_RDIOB]);
ASSERT(mdb.m_out == iobs[MDB_IOB_WRIOB]);
} else {
@@ -943,8 +952,9 @@ mdb_call(uintmax_t addr, uintmax_t count, uint_t flags)
} else {
mdb_intr_enable();
- (void) mdb_call_idcmd(cp->c_dcmd, addr, count, flags,
+ status = mdb_call_idcmd(cp->c_dcmd, addr, count, flags,
&cp->c_argv, &cp->c_addrv, cp->c_vcbs);
+ mdb.m_lastret = status;
mdb_intr_disable();
}
diff --git a/usr/src/cmd/mdb/common/mdb/mdb.h b/usr/src/cmd/mdb/common/mdb/mdb.h
index dc91906295..46ff90eff5 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb.h
@@ -21,6 +21,8 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
/*
@@ -43,6 +45,7 @@
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_list.h>
#include <mdb/mdb_vcb.h>
+#include <mdb/mdb_ctf.h>
#include <mdb/mdb_tab.h>
#ifdef _KMDB
#include <kmdb/kmdb_wr.h>
@@ -181,6 +184,8 @@ typedef struct mdb {
char **m_env; /* Current environment */
mdb_list_t m_cblist; /* List of callbacks */
mdb_nv_t m_macaliases; /* Name/value hash of ADB macro aliases */
+ ctf_file_t *m_synth; /* Container for synthetic types */
+ int m_lastret; /* Result of running the last command */
#ifdef _KMDB
struct dpi_ops *m_dpi; /* DPI ops vector */
struct kdi *m_kdi; /* KDI ops vector */
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
index 4a7b39fd57..2818a35a70 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
@@ -22,11 +22,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- */
-
-/*
* Copyright (c) 2012 by Delphix. All rights reserved.
- * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#include <sys/elf.h>
@@ -67,6 +64,7 @@
#include <mdb/mdb_whatis_impl.h>
#include <mdb/mdb_macalias.h>
#include <mdb/mdb_tab.h>
+#include <mdb/mdb_typedef.h>
#ifdef _KMDB
#include <kmdb/kmdb_kdi.h>
#endif
@@ -2946,7 +2944,8 @@ const mdb_dcmd_t mdb_dcmd_builtins[] = {
{ "grep", "?expr", "print dot if expression is true", cmd_grep },
{ "head", "-num|-n num", "limit number of elements in pipe", cmd_head,
head_help },
- { "help", "[cmd]", "list commands/command help", cmd_help },
+ { "help", "[cmd]", "list commands/command help", cmd_help, NULL,
+ cmd_help_tab },
{ "list", "?type member [variable]",
"walk list using member as link pointer", cmd_list, NULL,
mdb_tab_complete_mt },
@@ -2964,8 +2963,9 @@ const mdb_dcmd_t mdb_dcmd_builtins[] = {
{ "print", "?[-aCdhiLptx] [-c lim] [-l lim] [type] [member|offset ...]",
"print the contents of a data structure", cmd_print, print_help,
cmd_print_tab },
- { "printf", "?format type member ...", "print and format the "
- "member(s) of a data structure", cmd_printf, printf_help },
+ { "printf", "?[format] [type] [member ... ]", "print and format the "
+ "member(s) of a data structure", cmd_printf, printf_help,
+ cmd_printf_tab },
{ "regs", NULL, "print general purpose registers", cmd_notsup },
{ "set", "[-wF] [+/-o opt] [-s dist] [-I path] [-L path] [-P prompt]",
"get/set debugger properties", cmd_set },
@@ -2978,6 +2978,8 @@ const mdb_dcmd_t mdb_dcmd_builtins[] = {
{ "status", NULL, "print summary of current target", cmd_notsup },
{ "term", NULL, "display current terminal type", cmd_term },
{ "typeset", "[+/-t] var ...", "set variable attributes", cmd_typeset },
+ { "typedef", "[-c model | -d | -l | -r file ] [type] [name]",
+ "create synthetic types", cmd_typedef, cmd_typedef_help },
{ "unset", "[name ...]", "unset variables", cmd_unset },
{ "vars", "[-npt]", "print listing of variables", cmd_vars },
{ "version", NULL, "print debugger version string", cmd_version },
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
index 3181f8290c..3128f95766 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
@@ -24,6 +24,7 @@
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <mdb/mdb_ctf.h>
@@ -71,6 +72,125 @@ typedef struct mbr_info {
mdb_ctf_id_t *mbr_typep;
} mbr_info_t;
+typedef struct synth_intrinsic {
+ const char *syn_name;
+ ctf_encoding_t syn_enc;
+ uint_t syn_kind;
+} synth_intrinsic_t;
+
+typedef struct synth_typedef {
+ const char *syt_src;
+ const char *syt_targ;
+} synth_typedef_t;
+
+/*
+ * As part of our support for synthetic types via ::typedef, we define a core
+ * set of types.
+ */
+static const synth_intrinsic_t synth_builtins32[] = {
+{ "void", { CTF_INT_SIGNED, 0, 0 }, CTF_K_INTEGER },
+{ "signed", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "char", { CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "short", { CTF_INT_SIGNED, 0, 16 }, CTF_K_INTEGER },
+{ "int", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "long", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "long long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "signed char", { CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "signed short", { CTF_INT_SIGNED, 0, 16 }, CTF_K_INTEGER },
+{ "signed int", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "signed long", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "signed long long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "unsigned char", { CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "unsigned short", { 0, 0, 16 }, CTF_K_INTEGER },
+{ "unsigned int", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned long", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned long long", { 0, 0, 64 }, CTF_K_INTEGER },
+{ "_Bool", { CTF_INT_BOOL, 0, 8 }, CTF_K_INTEGER },
+{ "float", { CTF_FP_SINGLE, 0, 32 }, CTF_K_FLOAT },
+{ "double", { CTF_FP_DOUBLE, 0, 64 }, CTF_K_FLOAT },
+{ "long double", { CTF_FP_LDOUBLE, 0, 128 }, CTF_K_FLOAT },
+{ "float imaginary", { CTF_FP_IMAGRY, 0, 32 }, CTF_K_FLOAT },
+{ "double imaginary", { CTF_FP_DIMAGRY, 0, 64 }, CTF_K_FLOAT },
+{ "long double imaginary", { CTF_FP_LDIMAGRY, 0, 128 }, CTF_K_FLOAT },
+{ "float complex", { CTF_FP_CPLX, 0, 64 }, CTF_K_FLOAT },
+{ "double complex", { CTF_FP_DCPLX, 0, 128 }, CTF_K_FLOAT },
+{ "long double complex", { CTF_FP_LDCPLX, 0, 256 }, CTF_K_FLOAT },
+{ NULL, { 0, 0, 0}, 0 }
+};
+
+static const synth_intrinsic_t synth_builtins64[] = {
+{ "void", { CTF_INT_SIGNED, 0, 0 }, CTF_K_INTEGER },
+{ "signed", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "char", { CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "short", { CTF_INT_SIGNED, 0, 16 }, CTF_K_INTEGER },
+{ "int", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "long long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "signed char", { CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "signed short", { CTF_INT_SIGNED, 0, 16 }, CTF_K_INTEGER },
+{ "signed int", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "signed long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "signed long long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "unsigned char", { CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "unsigned short", { 0, 0, 16 }, CTF_K_INTEGER },
+{ "unsigned int", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned long", { 0, 0, 64 }, CTF_K_INTEGER },
+{ "unsigned long long", { 0, 0, 64 }, CTF_K_INTEGER },
+{ "_Bool", { CTF_INT_BOOL, 0, 8 }, CTF_K_INTEGER },
+{ "float", { CTF_FP_SINGLE, 0, 32 }, CTF_K_FLOAT },
+{ "double", { CTF_FP_DOUBLE, 0, 64 }, CTF_K_FLOAT },
+{ "long double", { CTF_FP_LDOUBLE, 0, 128 }, CTF_K_FLOAT },
+{ "float imaginary", { CTF_FP_IMAGRY, 0, 32 }, CTF_K_FLOAT },
+{ "double imaginary", { CTF_FP_DIMAGRY, 0, 64 }, CTF_K_FLOAT },
+{ "long double imaginary", { CTF_FP_LDIMAGRY, 0, 128 }, CTF_K_FLOAT },
+{ "float complex", { CTF_FP_CPLX, 0, 64 }, CTF_K_FLOAT },
+{ "double complex", { CTF_FP_DCPLX, 0, 128 }, CTF_K_FLOAT },
+{ "long double complex", { CTF_FP_LDCPLX, 0, 256 }, CTF_K_FLOAT },
+{ NULL, { 0, 0, 0 }, 0 }
+};
+
+static const synth_typedef_t synth_typedefs32[] = {
+{ "char", "int8_t" },
+{ "short", "int16_t" },
+{ "int", "int32_t" },
+{ "long long", "int64_t" },
+{ "int", "intptr_t" },
+{ "unsigned char", "uint8_t" },
+{ "unsigned short", "uint16_t" },
+{ "unsigned", "uint32_t" },
+{ "unsigned long long", "uint64_t" },
+{ "unsigned char", "uchar_t" },
+{ "unsigned short", "ushort_t" },
+{ "unsigned", "uint_t" },
+{ "unsigned long", "ulong_t" },
+{ "unsigned long long", "u_longlong_t" },
+{ "int", "ptrdiff_t" },
+{ "unsigned", "uintptr_t" },
+{ NULL, NULL }
+};
+
+static const synth_typedef_t synth_typedefs64[] = {
+{ "char", "int8_t" },
+{ "short", "int16_t" },
+{ "int", "int32_t" },
+{ "long", "int64_t" },
+{ "long", "intptr_t" },
+{ "unsigned char", "uint8_t" },
+{ "unsigned short", "uint16_t" },
+{ "unsigned", "uint32_t" },
+{ "unsigned long", "uint64_t" },
+{ "unsigned char", "uchar_t" },
+{ "unsigned short", "ushort_t" },
+{ "unsigned", "uint_t" },
+{ "unsigned long", "ulong_t" },
+{ "unsigned long long", "u_longlong_t" },
+{ "long", "ptrdiff_t" },
+{ "unsigned long", "uintptr_t" },
+{ NULL, NULL }
+};
+
static void
set_ctf_id(mdb_ctf_id_t *p, ctf_file_t *fp, ctf_id_t id)
{
@@ -146,6 +266,7 @@ name_to_type(mdb_tgt_t *t, const char *cname, ctf_id_t *idp)
/*
* Attempt to look up the name in the primary object file. If this
* fails and the name was unscoped, search all remaining object files.
+ * Finally, search the synthetic types.
*/
if (((fp = mdb_tgt_name_to_ctf(t, object)) == NULL ||
(id = ctf_lookup_by_name(fp, name)) == CTF_ERR ||
@@ -162,6 +283,10 @@ name_to_type(mdb_tgt_t *t, const char *cname, ctf_id_t *idp)
if (arg.tn_id != CTF_ERR) {
fp = arg.tn_fp;
id = arg.tn_id;
+ } else if (mdb.m_synth != NULL) {
+ if ((id = ctf_lookup_by_name(mdb.m_synth,
+ name)) != CTF_ERR)
+ fp = mdb.m_synth;
}
}
@@ -675,7 +800,12 @@ mdb_ctf_type_iter(const char *object, mdb_ctf_type_f *cb, void *data)
int ret;
type_iter_t ti;
- if ((fp = mdb_tgt_name_to_ctf(t, object)) == NULL)
+ if (object == MDB_CTF_SYNTHETIC_ITER)
+ fp = mdb.m_synth;
+ else
+ fp = mdb_tgt_name_to_ctf(t, object);
+
+ if (fp == NULL)
return (-1);
ti.ti_cb = cb;
@@ -1553,3 +1683,465 @@ mdb_ctf_bufopen(const void *ctf_va, size_t ctf_size, const void *sym_va,
return (ctf_bufopen(&ctdata, &symtab, &strtab, errp));
}
+
+int
+mdb_ctf_synthetics_init(void)
+{
+ int err;
+
+ if ((mdb.m_synth = ctf_create(&err)) == NULL)
+ return (set_errno(ctf_to_errno(err)));
+
+ return (0);
+}
+
+void
+mdb_ctf_synthetics_fini(void)
+{
+ if (mdb.m_synth == NULL)
+ return;
+
+ ctf_close(mdb.m_synth);
+ mdb.m_synth = NULL;
+}
+
+int
+mdb_ctf_synthetics_create_base(int kind)
+{
+ const synth_intrinsic_t *synp;
+ const synth_typedef_t *sytp;
+ int err;
+ ctf_id_t id;
+ ctf_file_t *cp = mdb.m_synth;
+
+ if (mdb.m_synth == NULL) {
+ mdb_printf("synthetic types disabled: ctf create failed\n");
+ return (DCMD_ERR);
+ }
+
+ switch (kind) {
+ case SYNTHETIC_ILP32:
+ synp = synth_builtins32;
+ sytp = synth_typedefs32;
+ break;
+ case SYNTHETIC_LP64:
+ synp = synth_builtins64;
+ sytp = synth_typedefs64;
+ break;
+ default:
+ mdb_dprintf(MDB_DBG_CTF, "invalid type of intrinsic: %d\n",
+ kind);
+ return (1);
+ }
+
+ err = 0;
+ for (; synp->syn_name != NULL; synp++) {
+ if (synp->syn_kind == CTF_K_INTEGER) {
+ err = ctf_add_integer(cp, CTF_ADD_ROOT, synp->syn_name,
+ &synp->syn_enc);
+ } else {
+ err = ctf_add_float(cp, CTF_ADD_ROOT, synp->syn_name,
+ &synp->syn_enc);
+ }
+
+ if (err == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "couldn't add synthetic "
+ "type: %s\n", synp->syn_name);
+ err = set_errno(ctf_to_errno(ctf_errno(cp)));
+ goto discard;
+ }
+ }
+
+ if (ctf_update(cp) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types\n");
+ err = set_errno(ctf_to_errno(ctf_errno(cp)));
+ goto discard;
+ }
+
+ for (; sytp->syt_src != NULL; sytp++) {
+ id = ctf_lookup_by_name(cp, sytp->syt_src);
+ if (id == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "cailed to lookup %s: %s\n",
+ sytp->syt_src, ctf_errmsg(ctf_errno(cp)));
+ err = set_errno(ctf_to_errno(ctf_errno(cp)));
+ goto discard;
+ }
+ if (ctf_add_typedef(cp, CTF_ADD_ROOT, sytp->syt_targ, id) ==
+ CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "couldn't add typedef %s "
+ "%s: %s\n", sytp->syt_targ, sytp->syt_src,
+ ctf_errmsg(ctf_errno(cp)));
+ err = set_errno(ctf_to_errno(ctf_errno(cp)));
+ goto discard;
+ }
+ }
+
+ if (ctf_update(cp) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types\n");
+ err = set_errno(ctf_to_errno(ctf_errno(cp)));
+ goto discard;
+ }
+
+ return (0);
+
+discard:
+ (void) ctf_discard(cp);
+ return (err);
+}
+
+int
+mdb_ctf_synthetics_reset(void)
+{
+ mdb_ctf_synthetics_fini();
+ return (mdb_ctf_synthetics_init());
+}
+
+int
+mdb_ctf_add_typedef(const char *name, const mdb_ctf_id_t *p, mdb_ctf_id_t *new)
+{
+ ctf_id_t rid;
+ mdb_ctf_id_t tid;
+ mdb_ctf_impl_t *mcip = (mdb_ctf_impl_t *)p;
+
+ if (mdb.m_synth == NULL) {
+ mdb_printf("synthetic types disabled: ctf create failed\n");
+ return (DCMD_ERR);
+ }
+
+ if (mdb_ctf_lookup_by_name(name, &tid) == 0) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add type %s: a type "
+ "with that name already exists\n", name);
+ return (set_errno(EEXIST));
+ }
+
+ rid = ctf_add_type(mdb.m_synth, mcip->mci_fp, mcip->mci_id);
+ if (rid == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add reference type: %s\n",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+ rid = ctf_add_typedef(mdb.m_synth, CTF_ADD_ROOT, name, rid);
+ if (rid == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add typedef: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (new != NULL)
+ set_ctf_id(new, mdb.m_synth, rid);
+
+ return (0);
+}
+
+int
+mdb_ctf_add_struct(const char *name, mdb_ctf_id_t *rid)
+{
+ mdb_ctf_id_t tid;
+ ctf_id_t id;
+
+ if (mdb.m_synth == NULL) {
+ mdb_printf("synthetic types disabled: ctf create failed\n");
+ return (DCMD_ERR);
+ }
+
+ if (name != NULL && mdb_ctf_lookup_by_name(name, &tid) == 0) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add type %s: a type "
+ "with that name already exists\n", name);
+ return (set_errno(EEXIST));
+ }
+
+ if ((id = ctf_add_struct(mdb.m_synth, CTF_ADD_ROOT, name)) ==
+ CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add struct: %s\n",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (rid != NULL)
+ set_ctf_id(rid, mdb.m_synth, id);
+
+ return (0);
+}
+
+int
+mdb_ctf_add_union(const char *name, mdb_ctf_id_t *rid)
+{
+ mdb_ctf_id_t tid;
+ ctf_id_t id;
+
+ if (mdb.m_synth == NULL) {
+ mdb_printf("synthetic types disabled: ctf create failed\n");
+ return (DCMD_ERR);
+ }
+
+ if (name != NULL && mdb_ctf_lookup_by_name(name, &tid) == 0) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add type %s: a type "
+ "with that name already exists\n", name);
+ return (set_errno(EEXIST));
+ }
+
+ if ((id = ctf_add_union(mdb.m_synth, CTF_ADD_ROOT, name)) ==
+ CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add union: %s\n",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (rid != NULL)
+ set_ctf_id(rid, mdb.m_synth, id);
+
+ return (0);
+}
+
+int
+mdb_ctf_add_member(const mdb_ctf_id_t *p, const char *name,
+ const mdb_ctf_id_t *mtype, mdb_ctf_id_t *rid)
+{
+ ctf_id_t id, mtid;
+ mdb_ctf_impl_t *mcip = (mdb_ctf_impl_t *)p;
+ mdb_ctf_impl_t *mcim = (mdb_ctf_impl_t *)mtype;
+
+ if (mdb.m_synth == NULL) {
+ mdb_printf("synthetic types disabled: ctf create failed\n");
+ return (DCMD_ERR);
+ }
+
+ if (mcip->mci_fp != mdb.m_synth) {
+ mdb_dprintf(MDB_DBG_CTF, "requested to add member to a type "
+ "that wasn't created from a synthetic\n");
+ return (set_errno(EINVAL));
+ }
+
+ mtid = ctf_add_type(mdb.m_synth, mcim->mci_fp, mcim->mci_id);
+ if (mtid == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add member type: %s\n",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ id = ctf_add_member(mdb.m_synth, mcip->mci_id, name, mtid);
+ if (id == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add member %s: %s\n",
+ name, ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (rid != NULL)
+ set_ctf_id(rid, mdb.m_synth, id);
+
+ return (0);
+}
+
+int
+mdb_ctf_add_array(const mdb_ctf_arinfo_t *marp, mdb_ctf_id_t *rid)
+{
+ mdb_ctf_impl_t *mcip;
+ ctf_arinfo_t car;
+ ctf_id_t id;
+
+ if (mdb.m_synth == NULL) {
+ mdb_printf("synthetic types disabled: ctf create failed\n");
+ return (DCMD_ERR);
+ }
+
+ car.ctr_nelems = marp->mta_nelems;
+
+ mcip = (mdb_ctf_impl_t *)&marp->mta_contents;
+ id = ctf_add_type(mdb.m_synth, mcip->mci_fp, mcip->mci_id);
+ if (id == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add member type: %s\n",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+ car.ctr_contents = id;
+
+ mcip = (mdb_ctf_impl_t *)&marp->mta_index;
+ id = ctf_add_type(mdb.m_synth, mcip->mci_fp, mcip->mci_id);
+ if (id == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add member type: %s\n",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+ car.ctr_index = id;
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ id = ctf_add_array(mdb.m_synth, CTF_ADD_ROOT, &car);
+ if (id == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (rid != NULL)
+ set_ctf_id(rid, mdb.m_synth, id);
+
+ return (0);
+}
+
+int
+mdb_ctf_add_pointer(const mdb_ctf_id_t *p, mdb_ctf_id_t *rid)
+{
+ ctf_id_t id;
+ mdb_ctf_impl_t *mcip = (mdb_ctf_impl_t *)p;
+
+ if (mdb.m_synth == NULL) {
+ mdb_printf("synthetic types disabled: ctf create failed\n");
+ return (DCMD_ERR);
+ }
+
+ id = ctf_add_type(mdb.m_synth, mcip->mci_fp, mcip->mci_id);
+ if (id == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add pointer type: %s\n",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+
+ id = ctf_add_pointer(mdb.m_synth, CTF_ADD_ROOT, id);
+ if (id == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add pointer: %s\n",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+
+ if (rid != NULL)
+ set_ctf_id(rid, mdb.m_synth, id);
+
+ return (0);
+}
+
+int
+mdb_ctf_type_delete(const mdb_ctf_id_t *id)
+{
+ int ret;
+
+ mdb_ctf_impl_t *mcip = (mdb_ctf_impl_t *)id;
+
+ if (mcip->mci_fp != mdb.m_synth) {
+ mdb_warn("bad ctf_file_t, expected synth container\n");
+ return (DCMD_ERR);
+ }
+
+ ret = ctf_delete_type(mcip->mci_fp, mcip->mci_id);
+ if (ret != 0) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to delete synthetic type: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ if (ctf_update(mdb.m_synth) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types: %s",
+ ctf_errmsg(ctf_errno(mdb.m_synth)));
+ return (set_errno(ctf_to_errno(ctf_errno(mdb.m_synth))));
+ }
+
+ return (0);
+}
+
+static int
+mdb_ctf_synthetics_file_cb(mdb_ctf_id_t id, void *arg)
+{
+ ctf_file_t *targ = arg;
+ mdb_ctf_impl_t *mcip = (mdb_ctf_impl_t *)&id;
+
+ if (ctf_add_type(targ, mcip->mci_fp, mcip->mci_id) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to add type %d: %s\n",
+ mcip->mci_id, ctf_errmsg(ctf_errno(mcip->mci_fp)));
+ return (set_errno(ctf_to_errno(ctf_errno(mcip->mci_fp))));
+ }
+
+ return (0);
+}
+
+int
+mdb_ctf_synthetics_from_file(const char *file)
+{
+ ctf_file_t *fp, *syn = mdb.m_synth;
+ int ret;
+ type_iter_t ti;
+
+ if (syn == NULL) {
+ mdb_warn("synthetic types disabled: ctf create failed\n");
+ return (DCMD_ERR);
+ }
+
+ if ((fp = mdb_ctf_open(file, &ret)) == NULL) {
+ mdb_warn("failed to parse ctf data in %s", file);
+ return (DCMD_ERR);
+ }
+
+ ret = DCMD_OK;
+ ti.ti_fp = fp;
+ ti.ti_arg = syn;
+ ti.ti_cb = mdb_ctf_synthetics_file_cb;
+ if (ctf_type_iter(fp, type_iter_cb, &ti) == CTF_ERR) {
+ ret = set_errno(ctf_to_errno(ctf_errno(fp)));
+ mdb_warn("failed to add types");
+ goto cleanup;
+ }
+
+ if (ctf_update(syn) == CTF_ERR) {
+ mdb_dprintf(MDB_DBG_CTF, "failed to update synthetic types\n");
+ ret = set_errno(ctf_to_errno(ctf_errno(fp)));
+ }
+
+cleanup:
+ ctf_close(fp);
+ if (ret != DCMD_OK)
+ (void) ctf_discard(syn);
+ return (ret);
+}
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ctf.h b/usr/src/cmd/mdb/common/mdb/mdb_ctf.h
index 05b56a381a..2396145299 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_ctf.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb_ctf.h
@@ -24,6 +24,7 @@
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#ifndef _MDB_CTF_H
@@ -101,6 +102,29 @@ extern const char *mdb_ctf_enum_name(mdb_ctf_id_t, int);
extern int mdb_ctf_member_iter(mdb_ctf_id_t, mdb_ctf_member_f *, void *);
extern int mdb_ctf_enum_iter(mdb_ctf_id_t, mdb_ctf_enum_f *, void *);
extern int mdb_ctf_type_iter(const char *, mdb_ctf_type_f *, void *);
+extern int mdb_ctf_type_delete(const mdb_ctf_id_t *);
+
+/*
+ * Special values for mdb_ctf_type_iter.
+ */
+#define MDB_CTF_SYNTHETIC_ITER (const char *)(-1L)
+
+#define SYNTHETIC_ILP32 1
+#define SYNTHETIC_LP64 2
+extern int mdb_ctf_synthetics_create_base(int);
+extern int mdb_ctf_synthetics_reset(void);
+
+/*
+ * Synthetic creation routines
+ */
+extern int mdb_ctf_add_typedef(const char *, const mdb_ctf_id_t *,
+ mdb_ctf_id_t *);
+extern int mdb_ctf_add_struct(const char *, mdb_ctf_id_t *);
+extern int mdb_ctf_add_union(const char *, mdb_ctf_id_t *);
+extern int mdb_ctf_add_member(const mdb_ctf_id_t *, const char *,
+ const mdb_ctf_id_t *, mdb_ctf_id_t *);
+extern int mdb_ctf_add_array(const mdb_ctf_arinfo_t *, mdb_ctf_id_t *);
+extern int mdb_ctf_add_pointer(const mdb_ctf_id_t *, mdb_ctf_id_t *);
/* utility stuff */
extern ctf_id_t mdb_ctf_type_id(mdb_ctf_id_t);
@@ -128,6 +152,9 @@ extern ctf_file_t *mdb_ctf_open(const char *, int *); /* Internal */
extern ctf_file_t *mdb_ctf_bufopen(const void *, size_t, /* Internal */
const void *, Shdr *, const void *, Shdr *, int *);
extern void mdb_ctf_close(ctf_file_t *fp); /* Internal */
+extern int mdb_ctf_synthetics_init(void); /* Internal */
+extern void mdb_ctf_synthetics_fini(void); /* Internal */
+extern int mdb_ctf_synthetics_from_file(const char *); /* Internal */
#endif
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_help.c b/usr/src/cmd/mdb/common/mdb/mdb_help.c
index 2fe3ad56a1..95d3ec6af3 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_help.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_help.c
@@ -22,6 +22,7 @@
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <mdb/mdb_modapi.h>
@@ -252,6 +253,23 @@ cmd_help(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
return (DCMD_OK);
}
+int
+cmd_help_tab(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
+ const mdb_arg_t *argv)
+{
+ if (argc == 0 && !(flags & DCMD_TAB_SPACE))
+ return (0);
+
+ if (argc > 1)
+ return (0);
+
+ if (argc == 0)
+ return (mdb_tab_complete_dcmd(mcp, NULL));
+ else
+ return (mdb_tab_complete_dcmd(mcp, argv[0].a_un.a_str));
+}
+
+
static int
print_dcmd_def(mdb_var_t *v, void *private)
{
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_help.h b/usr/src/cmd/mdb/common/mdb/mdb_help.h
index 3c086e4065..92516a43dd 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_help.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb_help.h
@@ -22,12 +22,13 @@
/*
* Copyright (c) 1998-1999 by Sun Microsystems, Inc.
* All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _MDB_HELP_H
#define _MDB_HELP_H
-#pragma ident "%Z%%M% %I% %E% SMI"
+#include <mdb/mdb_tab.h>
#ifdef __cplusplus
extern "C" {
@@ -35,11 +36,13 @@ extern "C" {
#ifdef _MDB
+
extern int cmd_dmods(uintptr_t, uint_t, int, const mdb_arg_t *);
extern int cmd_dcmds(uintptr_t, uint_t, int, const mdb_arg_t *);
extern int cmd_walkers(uintptr_t, uint_t, int, const mdb_arg_t *);
extern int cmd_formats(uintptr_t, uint_t, int, const mdb_arg_t *);
extern int cmd_help(uintptr_t, uint_t, int, const mdb_arg_t *);
+extern int cmd_help_tab(mdb_tab_cookie_t *, uint_t, int, const mdb_arg_t *);
extern int cmd_which(uintptr_t, uint_t, int, const mdb_arg_t *);
#endif /* _MDB */
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_main.c b/usr/src/cmd/mdb/common/mdb/mdb_main.c
index caccef986d..4ca42e83cb 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_main.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_main.c
@@ -319,10 +319,12 @@ usage(int status)
{
mdb_iob_printf(mdb.m_err, "Usage: %s [-fkmuwyAFKMSUW] [+/-o option] "
"[-p pid] [-s dist] [-I path] [-L path]\n\t[-P prompt] "
- "[-R root] [-V dis-version] [object [core] | core | suffix]\n\n",
+ "[-R root] [-V dis-version] [-e expr] "
+ "[object [core] | core | suffix]\n\n",
mdb.m_pname);
mdb_iob_puts(mdb.m_err,
+ "\t-e evaluate expr and return status\n"
"\t-f force raw file debugging mode\n"
"\t-k force kernel debugging mode\n"
"\t-m disable demand-loading of module symbols\n"
@@ -415,6 +417,7 @@ main(int argc, char *argv[], char *envp[])
char *p;
const char *Iflag = NULL, *Lflag = NULL, *Vflag = NULL, *pidarg = NULL;
+ const char *eflag = NULL;
int fflag = 0, Kflag = 0, Rflag = 0, Sflag = 0, Oflag = 0, Uflag = 0;
int ttylike;
@@ -503,8 +506,15 @@ main(int argc, char *argv[], char *envp[])
while (optind < argc) {
while ((c = getopt(argc, argv,
- "fkmo:p:s:uwyACD:FI:KL:MOP:R:SUV:W")) != (int)EOF) {
+ "e:fkmo:p:s:uwyACD:FI:KL:MOP:R:SUV:W")) != (int)EOF) {
switch (c) {
+ case 'e':
+ if (eflag != NULL) {
+ warn("-e already specified\n");
+ terminate(2);
+ }
+ eflag = optarg;
+ break;
case 'f':
fflag++;
tgt_ctor = mdb_rawfile_tgt_create;
@@ -686,6 +696,12 @@ main(int argc, char *argv[], char *envp[])
/*NOTREACHED*/
}
+ if (eflag != NULL) {
+ IOP_CLOSE(in_io);
+ in_io = mdb_strio_create(eflag);
+ mdb.m_lastret = 0;
+ }
+
/*
* If standard input appears to have tty attributes, attempt to
* initialize a terminal i/o backend on top of stdin and stdout.
@@ -1058,7 +1074,8 @@ tcreate:
continue;
}
- terminate((status == MDB_ERR_QUIT || status == 0) ? 0 : 1);
+ terminate((status == MDB_ERR_QUIT || status == 0) ?
+ (eflag != NULL && mdb.m_lastret != 0 ? 1 : 0) : 1);
/*NOTREACHED*/
return (0);
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_modapi.c b/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
index df954e2a6d..a675398302 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
@@ -822,6 +822,55 @@ mdb_object_iter(mdb_object_cb_t cb, void *data)
}
/*
+ * Private callback structure for implementing mdb_symbol_iter, below.
+ */
+typedef struct {
+ mdb_symbol_cb_t si_cb;
+ void *si_arg;
+ int si_rval;
+} symbol_iter_arg_t;
+
+/*ARGSUSED*/
+static int
+mdb_symbol_cb(void *data, const GElf_Sym *gsym, const char *name,
+ const mdb_syminfo_t *sip, const char *obj)
+{
+ symbol_iter_arg_t *arg = data;
+ mdb_symbol_t sym;
+
+ if (arg->si_rval != 0)
+ return (0);
+
+ bzero(&sym, sizeof (sym));
+ sym.sym_name = name;
+ sym.sym_object = obj;
+ sym.sym_sym = gsym;
+ sym.sym_table = sip->sym_table;
+ sym.sym_id = sip->sym_id;
+
+ arg->si_rval = arg->si_cb(&sym, arg->si_arg);
+
+ return (0);
+}
+
+int
+mdb_symbol_iter(const char *obj, uint_t which, uint_t type,
+ mdb_symbol_cb_t cb, void *data)
+{
+ symbol_iter_arg_t arg;
+
+ arg.si_cb = cb;
+ arg.si_arg = data;
+ arg.si_rval = 0;
+
+ if (mdb_tgt_symbol_iter(mdb.m_target, obj, which, type,
+ mdb_symbol_cb, &arg) != 0)
+ return (-1);
+
+ return (arg.si_rval);
+}
+
+/*
* Private structure and function for implementing mdb_dumpptr on top
* of mdb_dump_internal
*/
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_modapi.h b/usr/src/cmd/mdb/common/mdb/mdb_modapi.h
index 20fa34fe13..bb880f9b11 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_modapi.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb_modapi.h
@@ -22,7 +22,7 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
- * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#ifndef _MDB_MODAPI_H
@@ -71,7 +71,13 @@ extern "C" {
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#endif
+#ifdef MDB_API_VERSION
+#if (MDB_API_VERSION != 3 && MDB_API_VERSION != 4)
+#error "Only modapi versions three and four are supported."
+#endif
+#else /* !MDB_API_VERISON */
#define MDB_API_VERSION 4 /* Current API version number */
+#endif /* MDB_API_VERISON */
/*
* Debugger command function flags:
@@ -85,11 +91,6 @@ extern "C" {
#define DCMD_HDRSPEC(fl) (((fl) & DCMD_LOOPFIRST) || !((fl) & DCMD_LOOP))
/*
- * Debugger tab command function flags
- */
-#define DCMD_TAB_SPACE 0x01 /* Tab cb invoked with trailing space */
-
-/*
* Debugger command function return values:
*/
#define DCMD_OK 0 /* Dcmd completed successfully */
@@ -118,10 +119,18 @@ typedef struct mdb_arg {
} a_un;
} mdb_arg_t;
+#if (MDB_API_VERSION >= 4)
+/*
+ * Debugger tab command function flags
+ */
+#define DCMD_TAB_SPACE 0x01 /* Tab cb invoked with trailing space */
+
typedef struct mdb_tab_cookie mdb_tab_cookie_t;
-typedef int mdb_dcmd_f(uintptr_t, uint_t, int, const mdb_arg_t *);
typedef int mdb_dcmd_tab_f(mdb_tab_cookie_t *, uint_t, int,
const mdb_arg_t *);
+#endif /* MDB_API_VERSION >= 4 */
+
+typedef int mdb_dcmd_f(uintptr_t, uint_t, int, const mdb_arg_t *);
typedef struct mdb_dcmd {
const char *dc_name; /* Command name */
@@ -129,7 +138,9 @@ typedef struct mdb_dcmd {
const char *dc_descr; /* Description */
mdb_dcmd_f *dc_funcp; /* Command function */
void (*dc_help)(void); /* Command help function (or NULL) */
+#if (MDB_API_VERSION >= 4)
mdb_dcmd_tab_f *dc_tabp; /* Tab completion function */
+#endif
} mdb_dcmd_t;
#define WALK_ERR -1 /* Walk fatal error (terminate walk) */
@@ -180,6 +191,14 @@ typedef struct mdb_object {
uintptr_t obj_size; /* in memory size of object in bytes */
} mdb_object_t;
+typedef struct mdb_symbol {
+ const char *sym_name; /* name of symbol */
+ const char *sym_object; /* name of containing object */
+ const GElf_Sym *sym_sym; /* ELF symbol information */
+ uint_t sym_table; /* symbol table id */
+ uint_t sym_id; /* symbol identifier */
+} mdb_symbol_t;
+
extern int mdb_pwalk(const char *, mdb_walk_cb_t, void *, uintptr_t);
extern int mdb_walk(const char *, mdb_walk_cb_t, void *);
@@ -296,6 +315,28 @@ extern ssize_t mdb_get_xdata(const char *, void *, size_t);
typedef int (*mdb_object_cb_t)(mdb_object_t *, void *);
extern int mdb_object_iter(mdb_object_cb_t, void *);
+#define MDB_SYMTAB 1 /* Normal symbol table (.symtab) */
+#define MDB_DYNSYM 2 /* Dynamic symbol table (.dynsym) */
+
+#define MDB_BIND_LOCAL 0x0001 /* Local (static-scope) symbols */
+#define MDB_BIND_GLOBAL 0x0002 /* Global symbols */
+#define MDB_BIND_WEAK 0x0004 /* Weak binding symbols */
+#define MDB_BIND_ANY 0x0007 /* Any of the above */
+
+#define MDB_TYPE_NOTYPE 0x0100 /* Symbol has no type */
+#define MDB_TYPE_OBJECT 0x0200 /* Symbol refers to data */
+#define MDB_TYPE_FUNC 0x0400 /* Symbol refers to text */
+#define MDB_TYPE_SECT 0x0800 /* Symbol refers to a section */
+#define MDB_TYPE_FILE 0x1000 /* Symbol refers to a source file */
+#define MDB_TYPE_COMMON 0x2000 /* Symbol refers to a common block */
+#define MDB_TYPE_TLS 0x4000 /* Symbol refers to TLS */
+
+#define MDB_TYPE_ANY 0x7f00 /* Any of the above */
+
+typedef int (*mdb_symbol_cb_t)(mdb_symbol_t *, void *);
+extern int mdb_symbol_iter(const char *, uint_t, uint_t, mdb_symbol_cb_t,
+ void *);
+
#define MDB_STATE_IDLE 0 /* Target is idle (not running yet) */
#define MDB_STATE_RUNNING 1 /* Target is currently executing */
#define MDB_STATE_STOPPED 2 /* Target is stopped */
@@ -313,6 +354,7 @@ typedef void (*mdb_callback_f)(void *);
extern void *mdb_callback_add(int, mdb_callback_f, void *);
extern void mdb_callback_remove(void *);
+#if (MDB_API_VERSION >= 4)
#define MDB_TABC_ALL_TYPES 0x1 /* Include array types in type output */
#define MDB_TABC_MEMBERS 0x2 /* Tab comp. types with members */
#define MDB_TABC_NOPOINT 0x4 /* Tab comp. everything but pointers */
@@ -337,6 +379,7 @@ extern int mdb_tab_typename(int *, const mdb_arg_t **, char *buf, size_t len);
*/
extern int mdb_tab_complete_mt(mdb_tab_cookie_t *, uint_t, int,
const mdb_arg_t *);
+#endif /* MDB_API_VERSION >= 4 */
extern size_t strlcat(char *, const char *, size_t);
extern char *strcat(char *, const char *);
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_module.h b/usr/src/cmd/mdb/common/mdb/mdb_module.h
index 4c6a54e28b..04cb3d1cee 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_module.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb_module.h
@@ -22,6 +22,8 @@
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
/*
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_print.c b/usr/src/cmd/mdb/common/mdb/mdb_print.c
index 910cc9ecfe..ee996be8cf 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_print.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_print.c
@@ -21,6 +21,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
/*
@@ -2055,45 +2057,19 @@ parse_member(printarg_t *pap, const char *str, mdb_ctf_id_t id,
return (0);
}
-int
-cmd_print_tab(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
+static int
+cmd_print_tab_common(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
const mdb_arg_t *argv)
{
char tn[MDB_SYM_NAMLEN];
char member[64];
- int i, dummy, delim, kind;
+ int delim, kind;
int ret = 0;
mdb_ctf_id_t id, rid;
mdb_ctf_arinfo_t ar;
char *start, *end;
ulong_t dul;
- /*
- * This getopts is only here to make the tab completion work better when
- * including options in the ::print arguments. None of the values should
- * be used. This should only be updated with additional arguments, if
- * they are added to cmd_print.
- */
- i = mdb_getopts(argc, argv,
- 'a', MDB_OPT_SETBITS, PA_SHOWADDR, &dummy,
- 'C', MDB_OPT_SETBITS, TRUE, &dummy,
- 'c', MDB_OPT_UINTPTR, &dummy,
- 'd', MDB_OPT_SETBITS, PA_INTDEC, &dummy,
- 'h', MDB_OPT_SETBITS, PA_SHOWHOLES, &dummy,
- 'i', MDB_OPT_SETBITS, TRUE, &dummy,
- 'L', MDB_OPT_SETBITS, TRUE, &dummy,
- 'l', MDB_OPT_UINTPTR, &dummy,
- 'n', MDB_OPT_SETBITS, PA_NOSYMBOLIC, &dummy,
- 'p', MDB_OPT_SETBITS, TRUE, &dummy,
- 's', MDB_OPT_UINTPTR, &dummy,
- 'T', MDB_OPT_SETBITS, PA_SHOWTYPE | PA_SHOWBASETYPE, &dummy,
- 't', MDB_OPT_SETBITS, PA_SHOWTYPE, &dummy,
- 'x', MDB_OPT_SETBITS, PA_INTHEX, &dummy,
- NULL);
-
- argc -= i;
- argv += i;
-
if (argc == 0 && !(flags & DCMD_TAB_SPACE))
return (0);
@@ -2113,10 +2089,10 @@ cmd_print_tab(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
/*
* This is the reason that tab completion was created. We're going to go
- * along and walk the delimiters until we find something a member that
- * we don't recognize, at which point we'll try and tab complete it.
- * Note that ::print takes multiple args, so this is going to operate on
- * whatever the last arg that we have is.
+ * along and walk the delimiters until we find something in a member
+ * that we don't recognize, at which point we'll try and tab complete
+ * it. Note that ::print takes multiple args, so this is going to
+ * operate on whatever the last arg that we have is.
*/
if (mdb_ctf_lookup_by_name(tn, &id) != 0)
return (1);
@@ -2126,11 +2102,11 @@ cmd_print_tab(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
delim = parse_delimiter(&start);
/*
- * If we hit the case where we actually have no delimiters, than we need
+ * If we hit the case where we actually have no delimiters, then we need
* to make sure that we properly set up the fields the loops would.
*/
if (delim == MEMBER_DELIM_DONE)
- (void) mdb_snprintf(member, sizeof (member), "%s", start);
+ (void) mdb_snprintf(member, sizeof (member), start);
while (delim != MEMBER_DELIM_DONE) {
switch (delim) {
@@ -2187,7 +2163,7 @@ cmd_print_tab(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
/*
* We are going to try to resolve this name as a member. There
- * are a few two different questions that we need to answer. The
+ * are a two different questions that we need to answer. The
* first is do we recognize this member. The second is are we at
* the end of the string. If we encounter a member that we don't
* recognize before the end, then we have to error out and can't
@@ -2217,6 +2193,42 @@ cmd_print_tab(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
* already have in rid.
*/
return (mdb_tab_complete_member_by_id(mcp, rid, member));
+
+}
+
+int
+cmd_print_tab(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
+ const mdb_arg_t *argv)
+{
+ int i, dummy;
+
+ /*
+ * This getopts is only here to make the tab completion work better when
+ * including options in the ::print arguments. None of the values should
+ * be used. This should only be updated with additional arguments, if
+ * they are added to cmd_print.
+ */
+ i = mdb_getopts(argc, argv,
+ 'a', MDB_OPT_SETBITS, PA_SHOWADDR, &dummy,
+ 'C', MDB_OPT_SETBITS, TRUE, &dummy,
+ 'c', MDB_OPT_UINTPTR, &dummy,
+ 'd', MDB_OPT_SETBITS, PA_INTDEC, &dummy,
+ 'h', MDB_OPT_SETBITS, PA_SHOWHOLES, &dummy,
+ 'i', MDB_OPT_SETBITS, TRUE, &dummy,
+ 'L', MDB_OPT_SETBITS, TRUE, &dummy,
+ 'l', MDB_OPT_UINTPTR, &dummy,
+ 'n', MDB_OPT_SETBITS, PA_NOSYMBOLIC, &dummy,
+ 'p', MDB_OPT_SETBITS, TRUE, &dummy,
+ 's', MDB_OPT_UINTPTR, &dummy,
+ 'T', MDB_OPT_SETBITS, PA_SHOWTYPE | PA_SHOWBASETYPE, &dummy,
+ 't', MDB_OPT_SETBITS, PA_SHOWTYPE, &dummy,
+ 'x', MDB_OPT_SETBITS, PA_INTHEX, &dummy,
+ NULL);
+
+ argc -= i;
+ argv += i;
+
+ return (cmd_print_tab_common(mcp, flags, argc, argv));
}
/*
@@ -2511,8 +2523,7 @@ print_help(void)
}
static int
-printf_signed(mdb_ctf_id_t id, uintptr_t addr, ulong_t off, char *fmt,
- boolean_t sign)
+printf_signed(mdb_ctf_id_t id, uintptr_t addr, ulong_t off, char *fmt, int sign)
{
ssize_t size;
mdb_ctf_id_t base;
@@ -2530,7 +2541,7 @@ printf_signed(mdb_ctf_id_t id, uintptr_t addr, ulong_t off, char *fmt,
} u;
if (mdb_ctf_type_resolve(id, &base) == -1) {
- mdb_warn("could not resolve type");
+ mdb_warn("could not resolve type\n");
return (DCMD_ABORT);
}
@@ -2540,7 +2551,7 @@ printf_signed(mdb_ctf_id_t id, uintptr_t addr, ulong_t off, char *fmt,
}
if (mdb_ctf_type_encoding(base, &e) != 0) {
- mdb_warn("could not get type encoding");
+ mdb_warn("could not get type encoding\n");
return (DCMD_ABORT);
}
@@ -2742,7 +2753,6 @@ printf_string(mdb_ctf_id_t id, uintptr_t addr, ulong_t off, char *fmt)
if (size != 1) {
mdb_warn("string format specifier requires "
"an array of characters\n");
- return (DCMD_ABORT);
}
bzero(buf, sizeof (buf));
@@ -2810,6 +2820,51 @@ enum {
};
int
+cmd_printf_tab(mdb_tab_cookie_t *mcp, uint_t flags, int argc,
+ const mdb_arg_t *argv)
+{
+ int ii;
+ char *f;
+
+ /*
+ * If argc doesn't have more than what should be the format string,
+ * ignore it.
+ */
+ if (argc <= 1)
+ return (0);
+
+ /*
+ * Because we aren't leveraging the lex and yacc engine, we have to
+ * manually walk the arguments to find both the first and last
+ * open/close quote of the format string.
+ */
+ f = strchr(argv[0].a_un.a_str, '"');
+ if (f == NULL)
+ return (0);
+
+ f = strchr(f + 1, '"');
+ if (f != NULL) {
+ ii = 0;
+ } else {
+ for (ii = 1; ii < argc; ii++) {
+ f = strchr(argv[ii].a_un.a_str, '"');
+ if (f != NULL)
+ break;
+ }
+ /* Never found */
+ if (ii == argc)
+ return (0);
+ }
+
+ ii++;
+ argc -= ii;
+ argv += ii;
+
+
+ return (cmd_print_tab_common(mcp, flags, argc, argv));
+}
+
+int
cmd_printf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
char type[MDB_SYM_NAMLEN];
@@ -2830,7 +2885,7 @@ cmd_printf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (argc == 0 || argv[0].a_type != MDB_TYPE_STRING) {
mdb_warn("expected a format string\n");
- return (DCMD_USAGE);
+ return (DCMD_ABORT);
}
/*
@@ -2839,12 +2894,6 @@ cmd_printf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
* subset of mdb_printf() format strings that we allow.
*/
fmt = argv[0].a_un.a_str;
- /*
- * 'dest' must be large enough to hold a copy of the format string,
- * plus a NUL and up to 2 additional characters for each conversion
- * in the format string. This gives us a bloat factor of 5/2 ~= 3.
- * e.g. "%d" (strlen of 2) --> "%lld\0" (need 5 bytes)
- */
dest = mdb_zalloc(strlen(fmt) * 3, UM_SLEEP | UM_GC);
fmts = mdb_zalloc(strlen(fmt) * sizeof (char *), UM_SLEEP | UM_GC);
funcs = mdb_zalloc(strlen(fmt) * sizeof (void *), UM_SLEEP | UM_GC);
@@ -3027,22 +3076,22 @@ static char _mdb_printf_help[] =
"\n"
" %% Prints the '%' symbol.\n"
" %a Prints the member in symbolic form.\n"
-" %d Prints the member as a decimal integer. If the member is a signed\n"
+" %d Prints the member as a decimal integer. If the member is a signed\n"
" integer type, the output will be signed.\n"
" %H Prints the member as a human-readable size.\n"
" %I Prints the member as an IPv4 address (must be 32-bit integer type).\n"
" %N Prints the member as an IPv6 address (must be of type in6_addr_t).\n"
" %o Prints the member as an unsigned octal integer.\n"
" %p Prints the member as a pointer, in hexadecimal.\n"
-" %q Prints the member in signed octal. Honk if you ever use this!\n"
-" %r Prints the member as an unsigned value in the current output radix.\n"
-" %R Prints the member as a signed value in the current output radix.\n"
+" %q Prints the member in signed octal. Honk if you ever use this!\n"
+" %r Prints the member as an unsigned value in the current output radix. \n"
+" %R Prints the member as a signed value in the current output radix. \n"
" %s Prints the member as a string (requires a pointer or an array of\n"
" characters).\n"
" %u Prints the member as an unsigned decimal integer.\n"
" %x Prints the member in hexadecimal.\n"
" %X Prints the member in hexadecimal, using the characters A-F as the\n"
-" digits for the values 10-15.\n"
+" digits for the values 10-15. \n"
" %Y Prints the member as a time_t as the string "
"'year month day HH:MM:SS'.\n"
"\n"
@@ -3055,13 +3104,13 @@ static char _mdb_printf_help[] =
"\n"
"The following flag specifers are recognized by ::printf:\n"
"\n"
-" %- Left-justify the output within the specified field width. If the\n"
+" %- Left-justify the output within the specified field width. If the\n"
" width of the output is less than the specified field width, the\n"
-" output will be padded with blanks on the right-hand side. Without\n"
+" output will be padded with blanks on the right-hand side. Without\n"
" %-, values are right-justified by default.\n"
"\n"
" %0 Zero-fill the output field if the output is right-justified and the\n"
-" width of the output is less than the specified field width. Without\n"
+" width of the output is less than the specified field width. Without\n"
" %0, right-justified values are prepended with blanks in order to\n"
" fill the field.\n"
"\n"
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_print.h b/usr/src/cmd/mdb/common/mdb/mdb_print.h
index 41e6c07dc4..7449e8e71a 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_print.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb_print.h
@@ -21,6 +21,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
/*
@@ -50,6 +52,7 @@ extern int cmd_print(uintptr_t, uint_t, int, const mdb_arg_t *);
extern int cmd_print_tab(mdb_tab_cookie_t *, uint_t, int, const mdb_arg_t *);
extern void print_help(void);
extern int cmd_printf(uintptr_t, uint_t, int, const mdb_arg_t *);
+extern int cmd_printf_tab(mdb_tab_cookie_t *, uint_t, int, const mdb_arg_t *);
extern void printf_help(void);
#endif /* _MDB */
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_proc.c b/usr/src/cmd/mdb/common/mdb/mdb_proc.c
index 7c419d8fcd..e3d9833a6b 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_proc.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_proc.c
@@ -23,6 +23,9 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* User Process Target
@@ -122,6 +125,13 @@ static int tlsbase(mdb_tgt_t *, mdb_tgt_tid_t, Lmid_t, const char *,
psaddr_t *);
/*
+ * When debugging postmortem, we don't resolve names as we may very well not
+ * be on a system on which those names resolve.
+ */
+#define PT_LIBPROC_RESOLVE(P) \
+ (!(mdb.m_flags & MDB_FL_LMRAW) && Pstate(P) != PS_DEAD)
+
+/*
* The Perror_printf() function interposes on the default, empty libproc
* definition. It will be called to report additional information on complex
* errors, such as a corrupt core file. We just pass the args to vwarn.
@@ -2163,11 +2173,20 @@ static const mdb_walker_t pt_walkers[] = {
{ NULL }
};
+static int
+pt_agent_check(boolean_t *agent, const lwpstatus_t *psp)
+{
+ if (psp->pr_flags & PR_AGENT)
+ *agent = B_TRUE;
+
+ return (0);
+}
static void
pt_activate_common(mdb_tgt_t *t)
{
pt_data_t *pt = t->t_data;
+ boolean_t hasagent = B_FALSE;
GElf_Sym sym;
/*
@@ -2181,13 +2200,23 @@ pt_activate_common(mdb_tgt_t *t)
"library information will not be available\n");
}
- /*
- * If we have a libproc handle and libthread is loaded, attempt to load
- * and initialize the corresponding libthread_db. If this fails, fall
- * back to our native LWP implementation and issue a warning.
- */
- if (t->t_pshandle != NULL && Pstate(t->t_pshandle) != PS_IDLE)
+ if (t->t_pshandle != NULL) {
+ (void) Plwp_iter(t->t_pshandle,
+ (proc_lwp_f *)pt_agent_check, &hasagent);
+ }
+
+ if (hasagent) {
+ mdb_warn("agent lwp detected; forcing "
+ "lwp thread model (use ::tmodel to change)\n");
+ } else if (t->t_pshandle != NULL && Pstate(t->t_pshandle) != PS_IDLE) {
+ /*
+ * If we have a libproc handle and we do not have an agent LWP,
+ * look for the correct thread debugging library. (If we have
+ * an agent LWP, we leave the model as the raw LWP model to
+ * allow the agent LWP to be visible to the debugger.)
+ */
(void) Pobject_iter(t->t_pshandle, (proc_map_f *)thr_check, t);
+ }
/*
* If there's a global object named '_mdb_abort_info', assuming we're
@@ -2805,7 +2834,7 @@ pt_lookup_by_addr(mdb_tgt_t *t, uintptr_t addr, uint_t flags,
* Once we get the closest symbol, we perform the EXACT match or
* smart-mode or absolute distance check ourself:
*/
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(P)) {
rv = Pxlookup_by_addr_resolved(P, addr, buf, nbytes,
symp, &si);
} else {
@@ -2850,7 +2879,7 @@ found:
const char *prefix = pmp->pr_mapname;
Lmid_t lmid;
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(P)) {
if (Pobjname_resolved(P, addr, pt->p_objname,
MDB_TGT_MAPSZ))
prefix = pt->p_objname;
@@ -2952,7 +2981,7 @@ pt_symbol_iter(mdb_tgt_t *t, const char *object, uint_t which,
which, type, pt_symbol_iter_cb, &ps);
return (0);
} else if (Prd_agent(t->t_pshandle) != NULL) {
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(t->t_pshandle)) {
(void) Pobject_iter_resolved(t->t_pshandle,
pt_objsym_iter, &ps);
} else {
@@ -2991,7 +3020,7 @@ pt_prmap_to_mdbmap(mdb_tgt_t *t, const prmap_t *prp, mdb_map_t *mp)
char *rv, name[MAXPATHLEN];
Lmid_t lmid;
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(P)) {
rv = Pobjname_resolved(P, prp->pr_vaddr, name, sizeof (name));
} else {
rv = Pobjname(P, prp->pr_vaddr, name, sizeof (name));
@@ -3057,7 +3086,7 @@ pt_mapping_iter(mdb_tgt_t *t, mdb_tgt_map_f *func, void *private)
pm.pmap_func = func;
pm.pmap_private = private;
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(t->t_pshandle)) {
(void) Pmapping_iter_resolved(t->t_pshandle,
pt_map_apply, &pm);
} else {
@@ -3086,7 +3115,7 @@ pt_object_iter(mdb_tgt_t *t, mdb_tgt_map_f *func, void *private)
pm.pmap_func = func;
pm.pmap_private = private;
- if ((mdb.m_flags & MDB_FL_LMRAW) == 0) {
+ if (PT_LIBPROC_RESOLVE(t->t_pshandle)) {
(void) Pobject_iter_resolved(t->t_pshandle,
pt_map_apply, &pm);
} else {
@@ -4495,6 +4524,14 @@ pt_getareg(mdb_tgt_t *t, mdb_tgt_tid_t tid,
*/
if (PTL_GETREGS(t, tid, grs) == 0) {
*rp = r | (ulong_t)grs[rd_num];
+ if (rd_flags & MDB_TGT_R_32)
+ *rp &= 0xffffffffULL;
+ else if (rd_flags & MDB_TGT_R_16)
+ *rp &= 0xffffULL;
+ else if (rd_flags & MDB_TGT_R_8H)
+ *rp = (*rp & 0xff00ULL) >> 8;
+ else if (rd_flags & MDB_TGT_R_8L)
+ *rp &= 0xffULL;
return (0);
}
return (-1);
@@ -4521,6 +4558,16 @@ pt_putareg(mdb_tgt_t *t, mdb_tgt_tid_t tid, const char *rname, mdb_tgt_reg_t r)
ushort_t rd_flags = MDB_TGT_R_FLAGS(rd_nval);
if (!MDB_TGT_R_IS_FP(rd_flags)) {
+
+ if (rd_flags & MDB_TGT_R_32)
+ r &= 0xffffffffULL;
+ else if (rd_flags & MDB_TGT_R_16)
+ r &= 0xffffULL;
+ else if (rd_flags & MDB_TGT_R_8H)
+ r = (r & 0xffULL) << 8;
+ else if (rd_flags & MDB_TGT_R_8L)
+ r &= 0xffULL;
+
#if defined(__sparc) && defined(_ILP32)
/*
* If we are debugging on 32-bit SPARC, the globals and
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_tab.c b/usr/src/cmd/mdb/common/mdb/mdb_tab.c
index b06b5db680..af5dec943d 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_tab.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_tab.c
@@ -342,7 +342,8 @@ tab_complete_dcmd(mdb_var_t *v, void *arg)
int
mdb_tab_complete_dcmd(mdb_tab_cookie_t *mcp, const char *dcmd)
{
- mdb_tab_setmbase(mcp, dcmd);
+ if (dcmd != NULL)
+ mdb_tab_setmbase(mcp, dcmd);
mdb_nv_sort_iter(&mdb.m_dcmds, tab_complete_dcmd, mcp,
UM_GC | UM_SLEEP);
return (0);
@@ -386,11 +387,6 @@ mdb_tab_size(mdb_tab_cookie_t *mcp)
return (mdb_nv_size(&mcp->mtc_nv));
}
-/*
- * Determine whether the specified name is a valid tab completion for
- * the given command. If the name is a valid tab completion then
- * it will be saved in the mdb_tab_cookie_t.
- */
void
mdb_tab_insert(mdb_tab_cookie_t *mcp, const char *name)
{
@@ -528,31 +524,18 @@ tab_complete_type(mdb_ctf_id_t id, void *arg)
mdb_tab_cookie_t *mcp = arg;
uint_t flags = (uint_t)(uintptr_t)mcp->mtc_cba;
- /*
- * CTF data includes types that mdb commands don't understand. Before
- * we resolve the actual type prune any entry that is a type we
- * don't care about.
- */
- switch (mdb_ctf_type_kind(id)) {
- case CTF_K_CONST:
- case CTF_K_RESTRICT:
- case CTF_K_VOLATILE:
- return (0);
- }
-
if (mdb_ctf_type_resolve(id, &rid) != 0)
return (1);
rkind = mdb_ctf_type_kind(rid);
-
- if ((flags & MDB_TABC_MEMBERS) && rkind != CTF_K_STRUCT &&
+ if (flags & MDB_TABC_MEMBERS && rkind != CTF_K_STRUCT &&
rkind != CTF_K_UNION)
return (0);
- if ((flags & MDB_TABC_NOPOINT) && rkind == CTF_K_POINTER)
+ if (flags & MDB_TABC_NOPOINT && rkind == CTF_K_POINTER)
return (0);
- if ((flags & MDB_TABC_NOARRAY) && rkind == CTF_K_ARRAY)
+ if (flags & MDB_TABC_NOARRAY && rkind == CTF_K_ARRAY)
return (0);
(void) mdb_ctf_type_name(id, buf, sizeof (buf));
@@ -579,6 +562,8 @@ mdb_tab_complete_type(mdb_tab_cookie_t *mcp, const char *name, uint_t flags)
mdb_tab_setmbase(mcp, name);
(void) mdb_tgt_object_iter(t, mdb_tab_complete_module, mcp);
+ (void) mdb_ctf_type_iter(MDB_CTF_SYNTHETIC_ITER, tab_complete_type,
+ mcp);
return (0);
}
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_target_impl.h b/usr/src/cmd/mdb/common/mdb/mdb_target_impl.h
index ecc5331a1e..7f78bc4879 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_target_impl.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb_target_impl.h
@@ -22,12 +22,13 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#ifndef _MDB_TARGET_IMPL_H
#define _MDB_TARGET_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <mdb/mdb_target.h>
#include <mdb/mdb_module.h>
#include <mdb/mdb_list.h>
@@ -250,6 +251,10 @@ extern long mdb_tgt_nop(); /* Return 0 for success */
#define MDB_TGT_R_FPQ 0x040 /* Quad-precision floating-point */
#define MDB_TGT_R_FPU 0x080 /* FPU control/status register */
#define MDB_TGT_R_RDONLY 0x100 /* Register is read-only */
+#define MDB_TGT_R_32 0x200 /* 32-bit version of register */
+#define MDB_TGT_R_16 0x400 /* 16-bit version of register */
+#define MDB_TGT_R_8H 0x800 /* upper half of a 16-bit reg */
+#define MDB_TGT_R_8L 0x1000 /* lower half of a 16-bit reg */
#define MDB_TGT_R_IS_FP(f) ((f) & 0xf0) /* Test MDB_TGT_R_FP* bits */
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_termio.c b/usr/src/cmd/mdb/common/mdb/mdb_termio.c
index 5e36cda7ad..9f9571d925 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_termio.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_termio.c
@@ -22,6 +22,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
/*
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_typedef.c b/usr/src/cmd/mdb/common/mdb/mdb_typedef.c
new file mode 100644
index 0000000000..e097cf67d5
--- /dev/null
+++ b/usr/src/cmd/mdb/common/mdb/mdb_typedef.c
@@ -0,0 +1,738 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
+ */
+
+#include <mdb/mdb_modapi.h>
+#include <mdb/mdb_ctf.h>
+#include <mdb/mdb_list.h>
+#include <mdb/mdb_nv.h>
+
+struct parse_node;
+
+#define PN_F_POINTER 0x01
+#define PN_F_ARRAY 0x02
+
+typedef struct parse_node {
+ mdb_list_t pn_list; /* list entry, must be first */
+ char *pn_type; /* name of base type */
+ char *pn_name; /* name of the member */
+ int pn_flags; /* flags */
+ int pn_nptrs; /* number of pointers */
+ int pn_asub; /* value of array subscript */
+} parse_node_t;
+
+typedef struct parse_root {
+ mdb_list_t pr_nodes; /* list of members */
+ int pr_kind; /* CTF_K_* */
+ const char *pr_name; /* entity name */
+ const char *pr_tname; /* entity typedef */
+} parse_root_t;
+
+static int
+typedef_valid_identifier(const char *str)
+{
+ /*
+ * We can't use the standard ctype.h functions because those aren't
+ * necessairly available in kmdb. On the flip side, we only care about
+ * ascii characters here so that isn't too bad.
+ *
+ * C Identifiers have to start with a letter or a _. Afterwards they can
+ * be alphanumeric or an _.
+ */
+
+ if (*str == '\0')
+ return (1);
+
+ if (*str != '_' &&
+ (*str < 0x41 || *str > 0x5a) &&
+ (*str < 0x61 || *str > 0x7a))
+ return (1);
+ str++;
+
+ while (*str != '\0') {
+ if (*str != '_' &&
+ (*str < 0x30 || *str > 0x39) &&
+ (*str < 0x41 || *str > 0x5a) &&
+ (*str < 0x61 || *str > 0x7a))
+ return (1);
+ str++;
+ }
+
+ return (0);
+}
+
+/*ARGSUSED*/
+static int
+typedef_list_cb(mdb_ctf_id_t id, void *arg)
+{
+ char buf[MDB_SYM_NAMLEN];
+
+ (void) mdb_ctf_type_name(id, buf, sizeof (buf));
+ mdb_printf("%s\n", buf);
+ return (0);
+}
+
+static char *
+typedef_join_strings(int nstr, const mdb_arg_t *args, int flags)
+{
+ int i, size = 0;
+ char *ret, *sptr;
+
+ for (i = 0; i <= nstr; i++) {
+ /* Always account for the space or the null terminator */
+ size += strlen(args[i].a_un.a_str) + 1;
+ }
+ ret = mdb_alloc(sizeof (char) * size, flags);
+ if (ret == NULL)
+ return (NULL);
+ sptr = ret;
+ for (i = 0; i <= nstr; i++) {
+ (void) strcpy(sptr, args[i].a_un.a_str);
+ sptr += strlen(args[i].a_un.a_str);
+ *sptr = ' ';
+ sptr++;
+ }
+ *sptr = '\0';
+
+ return (ret);
+}
+
+static int
+typedef_list(void)
+{
+
+ (void) mdb_ctf_type_iter(MDB_CTF_SYNTHETIC_ITER, typedef_list_cb,
+ NULL);
+ return (DCMD_OK);
+}
+
+static int
+typedef_destroy(void)
+{
+ if (mdb_ctf_synthetics_reset() != 0) {
+ mdb_warn("failed to reset synthetic types");
+ return (DCMD_ERR);
+ }
+ return (DCMD_OK);
+}
+
+/*
+ * We've been asked to create the basic types that exist. We accept the
+ * following strings to indicate what we should create.
+ * - LP32, ILP32 (case insensitive)
+ * - LP64
+ */
+static int
+typedef_create(const char *arg)
+{
+ int kind;
+
+ if (strcasecmp(arg, "LP32") == 0 || strcasecmp(arg, "ILP32") == 0) {
+ kind = SYNTHETIC_ILP32;
+ } else if (strcasecmp(arg, "LP64") == 0) {
+ kind = SYNTHETIC_LP64;
+ } else {
+ mdb_printf("invalid data model: %s\n", arg);
+ return (DCMD_USAGE);
+ }
+
+ if (mdb_ctf_synthetics_create_base(kind) != 0) {
+ mdb_printf("failed to create intrinsic types, maybe "
+ "they already exist\n");
+ return (DCMD_ERR);
+ }
+
+ return (DCMD_OK);
+}
+
+/*
+ * Search the current arguments for a complete member declaration. This function
+ * modifies the value of defn based on what's necessary for parsing. It returns
+ * the appropriate parse node in pnp.
+ */
+static int
+typedef_parse_member(char *defn, char **next, parse_node_t **pnp)
+{
+ char *c, *name, *array;
+ int nptrs = 0;
+ parse_node_t *pn;
+
+ c = strchr(defn, ';');
+ if (c == NULL) {
+ mdb_printf("Cannot find semi-colon to delineate the end "
+ "of a member.\n");
+ return (DCMD_ERR);
+ }
+ *c = '\0';
+ *next = c + 1;
+
+ c = strrchr(defn, ' ');
+ if (c == NULL) {
+ mdb_printf("Missing both a name and a type declaration for "
+ "a member. Instead, found '%s'\n", defn);
+ return (DCMD_ERR);
+ }
+ *c = '\0';
+ name = c + 1;
+ c--;
+ while (*c == '*' || *c == ' ') {
+ if (*c == '*')
+ nptrs++;
+ c--;
+ }
+ *(c + 1) = '\0';
+
+ pn = mdb_zalloc(sizeof (parse_node_t), UM_SLEEP | UM_GC);
+ pn->pn_type = defn;
+
+ /*
+ * Go through and prepare the name field. Note that we still have to
+ * check if this is a pointer or an array. We also need to strip the
+ * ending semi-colon.
+ */
+ while (*name == '*') {
+ name++;
+ nptrs++;
+ }
+
+ if ((c = strchr(name, '[')) != NULL) {
+ array = c;
+ if ((c = strchr(array, ']')) == NULL) {
+ mdb_printf("Found the beginning of an array size "
+ "but no closing ']' in %s\n", array);
+ return (DCMD_ERR);
+ }
+ *array = '\0';
+ array++;
+ *c = '\0';
+ pn->pn_flags |= PN_F_ARRAY;
+ pn->pn_asub = mdb_strtoull(array);
+ if (pn->pn_asub < 0) {
+ mdb_printf("Array lengths cannot be negative\n");
+ return (DCMD_ERR);
+ }
+ }
+
+ if (typedef_valid_identifier(name) != 0) {
+ mdb_printf("The name %s is not a valid C identifier.\n",
+ name);
+ return (DCMD_ERR);
+ }
+
+ if (nptrs) {
+ pn->pn_flags |= PN_F_POINTER;
+ pn->pn_nptrs = nptrs;
+ }
+ pn->pn_name = name;
+
+ *pnp = pn;
+ return (DCMD_OK);
+}
+
+/*
+ * We're going to parse out our types here. Note that we are not strictly
+ * speaking a truely ANSI C compliant parser. Currently we support normal
+ * declarations except for the following:
+ * o function pointers
+ * o bit-fields
+ */
+static int
+typedef_parse(char *defn, const char *name, parse_root_t **prp)
+{
+ int len, ret;
+ const char *kind, *basename;
+ char *c, *brace;
+ parse_root_t *pr;
+ parse_node_t *pn;
+ mdb_ctf_id_t id;
+
+ pr = mdb_zalloc(sizeof (parse_root_t), UM_SLEEP | UM_GC);
+ basename = defn;
+
+ c = strchr(defn, ' ');
+ if (c == NULL) {
+ mdb_printf("Invalid structure definition. Structure "
+ "must start with either 'struct {' or 'union {'\n");
+ return (DCMD_ERR);
+ }
+ *c = '\0';
+
+ if (strcmp(defn, "struct") == 0)
+ pr->pr_kind = CTF_K_STRUCT;
+ else if (strcmp(defn, "union") == 0)
+ pr->pr_kind = CTF_K_UNION;
+ else {
+ mdb_printf("Invalid start of definition. "
+ "Expected 'struct' or 'union'. "
+ "Found: '%s'\n", defn);
+ return (DCMD_ERR);
+ }
+
+ /*
+ * We transform this back to a space so we can validate that a
+ * non-anonymous struct or union name is valid.
+ */
+ *c = ' ';
+
+ kind = defn;
+ defn = c + 1;
+ while (*defn == ' ')
+ defn++;
+
+ /* Check whether this is anonymous or not */
+ if (*defn != '{') {
+ brace = strchr(defn, '{');
+ c = brace;
+ if (c == NULL) {
+ mdb_printf("Missing opening brace for %s definition. "
+ "Expected '{'. "
+ "Found: '%c'\n", kind, *defn);
+ return (DCMD_ERR);
+ }
+ *c = '\0';
+ c--;
+ while (*c == ' ')
+ c--;
+ *(c+1) = '\0';
+ if (typedef_valid_identifier(defn) != 0) {
+ mdb_printf("The name %s is not a valid C identifier.\n",
+ defn);
+ return (DCMD_ERR);
+ }
+
+ if (mdb_ctf_lookup_by_name(basename, &id) != CTF_ERR) {
+ mdb_printf("type name %s already in use\n", basename);
+ return (DCMD_ERR);
+ }
+
+ pr->pr_name = defn;
+ defn = brace;
+ } else {
+ pr->pr_name = NULL;
+ }
+
+ defn++;
+ while (*defn == ' ')
+ defn++;
+
+ len = strlen(defn);
+ if (defn[len-1] != '}') {
+ mdb_printf("Missing closing brace for %s declaration. "
+ "Expected '}'.\n");
+ return (DCMD_ERR);
+ }
+ defn[len-1] = '\0';
+
+ /*
+ * Start walking all the arguments, looking for a terminating semicolon
+ * for type definitions.
+ */
+ for (;;) {
+ ret = typedef_parse_member(defn, &c, &pn);
+ if (ret == DCMD_ERR)
+ return (DCMD_ERR);
+
+ mdb_list_append(&pr->pr_nodes, pn);
+
+ while (*c == ' ')
+ c++;
+
+ if (*c == '\0')
+ break;
+
+ defn = c;
+ }
+
+ pr->pr_tname = name;
+ *prp = pr;
+
+ return (DCMD_OK);
+}
+
+/*
+ * Make sure that none of the member names overlap and that the type names don't
+ * already exist. If we have an array entry that is a VLA, make sure it is the
+ * last member and not the only member.
+ */
+static int
+typedef_validate(parse_root_t *pr)
+{
+ mdb_nv_t nv;
+ parse_node_t *pn;
+ mdb_ctf_id_t id;
+ int count = 0;
+
+ (void) mdb_nv_create(&nv, UM_SLEEP | UM_GC);
+ for (pn = mdb_list_next(&pr->pr_nodes); pn != NULL;
+ pn = mdb_list_next(pn)) {
+ count++;
+ if (mdb_nv_lookup(&nv, pn->pn_name) != NULL) {
+ mdb_printf("duplicate name detected: %s\n",
+ pn->pn_name);
+ return (DCMD_ERR);
+ }
+
+ /*
+ * Our parse tree won't go away before the nv, so it's simpler
+ * to just mark everything external.
+ */
+ (void) mdb_nv_insert(&nv, pn->pn_name, NULL, 0, MDB_NV_EXTNAME);
+
+ if (pn->pn_flags & PN_F_ARRAY && pn->pn_asub == 0) {
+ if (pr->pr_kind != CTF_K_STRUCT) {
+ mdb_printf("Flexible array members are only "
+ "valid in structs.\n");
+ return (DCMD_ERR);
+ }
+
+ if (&pn->pn_list != pr->pr_nodes.ml_prev) {
+ mdb_printf("Flexible array entries are only "
+ "allowed to be the last entry in a "
+ "struct\n");
+ return (DCMD_ERR);
+ }
+
+ if (count == 1) {
+ mdb_printf("Structs must have members aside "
+ "from a flexible member\n");
+ return (DCMD_ERR);
+ }
+ }
+ }
+
+ if (mdb_ctf_lookup_by_name(pr->pr_tname, &id) != CTF_ERR) {
+ mdb_printf("typedef name %s already exists\n", pr->pr_tname);
+ return (DCMD_ERR);
+ }
+
+ return (DCMD_OK);
+}
+
+static int
+typedef_add(parse_root_t *pr)
+{
+ parse_node_t *pn;
+ mdb_ctf_id_t id, aid, tid;
+ mdb_ctf_arinfo_t ar;
+ int ii;
+
+ /* Pre-flight checks */
+ if (typedef_validate(pr) == DCMD_ERR)
+ return (DCMD_ERR);
+
+ if (pr->pr_kind == CTF_K_STRUCT) {
+ if (mdb_ctf_add_struct(pr->pr_name, &id) != 0) {
+ mdb_printf("failed to create struct for %s\n",
+ pr->pr_tname);
+ return (DCMD_ERR);
+ }
+ } else {
+ if (mdb_ctf_add_union(pr->pr_name, &id) != 0) {
+ mdb_printf("failed to create union for %s\n",
+ pr->pr_tname);
+ return (DCMD_ERR);
+ }
+ }
+
+ for (pn = mdb_list_next(&pr->pr_nodes); pn != NULL;
+ pn = mdb_list_next(pn)) {
+
+ if (mdb_ctf_lookup_by_name(pn->pn_type, &tid) == CTF_ERR) {
+ mdb_printf("failed to add member %s: type %s does "
+ "not exist\n", pn->pn_name, pn->pn_type);
+ goto destroy;
+ }
+
+ if (pn->pn_flags & PN_F_POINTER) {
+ for (ii = 0; ii < pn->pn_nptrs; ii++) {
+ if (mdb_ctf_add_pointer(&tid,
+ &tid) != 0) {
+ mdb_printf("failed to add a pointer "
+ "type as part of member: %s\n",
+ pn->pn_name);
+ goto destroy;
+ }
+ }
+ }
+
+ if (pn->pn_flags & PN_F_ARRAY) {
+ if (mdb_ctf_lookup_by_name("long", &aid) != 0) {
+ mdb_printf("failed to lookup the type 'long' "
+ "for array indexes, are you running mdb "
+ "without a target or using ::typedef -c?");
+ goto destroy;
+ }
+
+ ar.mta_contents = tid;
+ ar.mta_index = aid;
+ ar.mta_nelems = pn->pn_asub;
+
+ if (mdb_ctf_add_array(&ar, &tid) != 0) {
+ mdb_printf("failed to create array type for "
+ "memeber%s\n", pn->pn_name);
+ goto destroy;
+ }
+ }
+
+ if (mdb_ctf_add_member(&id, pn->pn_name, &tid, NULL) ==
+ CTF_ERR) {
+ mdb_printf("failed to create member %s\n",
+ pn->pn_name);
+ goto destroy;
+ }
+ }
+
+ if (mdb_ctf_add_typedef(pr->pr_tname, &id, NULL) != 0) {
+ mdb_printf("failed to add typedef for %s\n",
+ pr->pr_tname);
+ goto destroy;
+ }
+
+ return (DCMD_OK);
+
+destroy:
+ return (mdb_ctf_type_delete(&id));
+}
+
+static int
+typedef_readfile(const char *file)
+{
+ int ret;
+
+ ret = mdb_ctf_synthetics_from_file(file);
+ if (ret != DCMD_OK)
+ mdb_warn("failed to create synthetics from file\n");
+ return (ret);
+}
+
+/* ARGSUSED */
+int
+cmd_typedef(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ mdb_ctf_id_t id;
+ int i;
+ int destroy = 0, list = 0;
+ const char *cmode = NULL, *rfile = NULL;
+ const char *dst, *src;
+ char *dup;
+ parse_root_t *pr;
+
+ if (flags & DCMD_ADDRSPEC)
+ return (DCMD_USAGE);
+
+ i = mdb_getopts(argc, argv,
+ 'd', MDB_OPT_SETBITS, TRUE, &destroy,
+ 'l', MDB_OPT_SETBITS, TRUE, &list,
+ 'c', MDB_OPT_STR, &cmode,
+ 'r', MDB_OPT_STR, &rfile, NULL);
+
+ argc -= i;
+ argv += i;
+
+ /*
+ * All our options are mutually exclusive currently.
+ */
+ i = 0;
+ if (destroy)
+ i++;
+ if (cmode != NULL)
+ i++;
+ if (list)
+ i++;
+ if (rfile != NULL)
+ i++;
+ if (i > 1)
+ return (DCMD_USAGE);
+
+ if ((destroy || cmode != NULL || list || rfile != NULL) && argc != 0)
+ return (DCMD_USAGE);
+
+ if (destroy)
+ return (typedef_destroy());
+
+ if (cmode)
+ return (typedef_create(cmode));
+
+ if (list)
+ return (typedef_list());
+
+ if (rfile)
+ return (typedef_readfile(rfile));
+
+ if (argc < 2)
+ return (DCMD_USAGE);
+
+ /*
+ * Check to see if we are defining a struct or union. Note that we have
+ * to distinguish between struct foo and struct {. All typedef structs
+ * are annonymous structs that are only known by their typedef name. The
+ * same is true with unions. The problem that we have to deal with is
+ * that the ';' character in mdb causes mdb to begin another command. To
+ * work around that fact we require users to put the whole struct
+ * definition in a pair of "" or ''.
+ */
+ if (argc == 2 && strchr(argv[0].a_un.a_str, '{') != NULL) {
+ dup = mdb_alloc(strlen(argv[0].a_un.a_str) + 1,
+ UM_GC | UM_SLEEP);
+ (void) strcpy(dup, argv[0].a_un.a_str);
+ if (typedef_parse(dup, argv[1].a_un.a_str, &pr) == DCMD_ERR)
+ return (DCMD_ERR);
+ if (typedef_add(pr) == DCMD_ERR)
+ return (DCMD_ERR);
+
+ return (DCMD_OK);
+ }
+
+ /*
+ * Someone could give us something like struct foobar or unsigned int or
+ * even long double imaginary. In this case we end up conjoining all
+ * arguments except the last one into one large string that we look up.
+ */
+ if (argc - 1 == 1) {
+ src = argv[0].a_un.a_str;
+ } else {
+ src = typedef_join_strings(argc - 2, argv, UM_GC | UM_SLEEP);
+ }
+
+ dst = argv[argc-1].a_un.a_str;
+
+ if (mdb_ctf_lookup_by_name(dst, &id) != -1) {
+ mdb_printf("%s already exists\n", dst);
+ return (DCMD_ERR);
+ }
+
+ if (mdb_ctf_lookup_by_name(src, &id) != 0) {
+ mdb_printf("%s does not exist\n", src);
+ return (DCMD_ERR);
+ }
+
+ if (mdb_ctf_add_typedef(dst, &id, NULL) != 0) {
+ mdb_printf("failed to create typedef\n");
+ return (DCMD_ERR);
+ }
+
+ return (DCMD_OK);
+}
+
+static char typedef_desc[] =
+"::typedef operates like the C typedef keyword and creates a synthetic type\n"
+"that is usable across mdb just like a type that is embedded in CTF data.\n"
+"This includes familiar dcmds like ::print as well as mdb's tab completion\n"
+"engine. The \"type\" argument can either be a named structure or union\n"
+"declaration, like \"struct proc { int p_id; }\" declartion, an anonymous\n"
+"structure or union declaration, like \"struct { int count; }\", or simply\n"
+"the name of an existing type, like \"uint64_t\". Either form may refer to\n"
+"other types already defined in CTF or a previous ::typedef invocation. When\n"
+"debugging binaries without CTF, definitions for intrinsic types may be\n"
+"created using the -c option. See the OPTIONS section for more information.\n"
+"If a named struct or union is used, then a type will be created for it just\n"
+"like in C. This may be used to mimic a forward declaration and an example of\n"
+"this is in the EXAMPLES section. Regardless of whether a struct or union is\n"
+"anonymous or named, the \"name\" argument is always required.\n"
+"\n"
+"When declaring anonymous structures and unions, the entire definition must\n"
+"be enclosed within \"\" or ''. The ';' is used by mdb to separate commands\n"
+"in a similar fashion to the shell. The ';' cannot be escaped, therefore\n"
+"quoting your argument is necessary. See the EXAMPLES sections for examples\n"
+"of what this looks like.\n"
+"\n"
+"All member and type names must be valid C identifiers. They must start with\n"
+"an underscore or a letter. Subsequent characters are allowed to be letters,\n"
+"numbers, or an underscore.\n"
+"\n"
+"Declaring arrays and any number of pointers in anonymous structures is \n"
+"supported. However the following C features are not supported: \n"
+" o function pointers (use a void * instead)\n"
+" o bitfields (use an integer of the appropriate size instead)\n"
+" o packed structures (all structures currently use their natural alignment)\n"
+"\n"
+"::typedef also allows you to read type definitions from a file. Definitions\n"
+"can be read from any ELF file that has a CTF section that libctf can parse.\n"
+"You can check if a file has such a section with elfdump(1). If a binary or\n"
+"core dump does not have any type information, but you do have it elsewhere,\n"
+"then you can use ::typedef -r to read in that type information.\n"
+"\n";
+
+static char typedef_opts[] =
+" -c model create intrinsic types based on the specified data model.\n"
+" The INTRINSICS section lists the built-in types and typedefs.\n"
+" The following data models are supported:\n"
+" o LP64 - Traditional illumos 64-bit program\n"
+" o LP32 - Traditional illumos 32-bit program.\n"
+" o ILP32 - An alternate name for LP32.\n"
+" -d delete all synthetic types\n"
+" -l list all synthetic types\n"
+" -r file import type definitions (CTF) from another ELF file\n"
+"\n";
+
+static char typedef_examps[] =
+" ::typedef -c LP64\n"
+" ::typedef uint64_t bender_t\n"
+" ::typedef struct proc new_proc_t\n"
+" ::typedef \"union { int frodo; char sam; long gandalf; }\" ringbearer_t;\n"
+" ::typedef \"struct { uintptr_t stone[7]; void **white; }\" gift_t\n"
+" ::typedef \"struct list { struct list *l_next; struct list *l_prev; }\" "
+"list_t\n"
+" ::typedef -r /var/tmp/qemu-system-x86_64\n"
+"\n";
+
+static char typedef_intrins[] =
+"The following C types and <stdint.h> typedefs are provided when \n"
+"::typedef -c is used\n"
+"\n"
+" signed unsigned void\n"
+" char short int\n"
+" long long long signed char\n"
+" signed short signed int signed long\n"
+" singed long long unsigned char unsigned short\n"
+" unsigned int unsigned long unsigned long long\n"
+" _Bool float double\n"
+" long double float imaginary double imaginary\n"
+" long double imaginary float complex\n"
+" double complex long double complex\n"
+"\n"
+" int8_t int16_t int32_t\n"
+" int64_t intptr_t uint8_t\n"
+" uint16_t uint32_t uint64_t\n"
+" uchar_t ushort_t uint_t\n"
+" ulong_t u_longlong_t ptrdiff_t\n"
+" uintptr_t\n"
+"\n";
+
+void
+cmd_typedef_help(void)
+{
+ mdb_printf("%s", typedef_desc);
+ (void) mdb_dec_indent(2);
+ mdb_printf("%<b>OPTIONS%</b>\n");
+ (void) mdb_inc_indent(2);
+ mdb_printf("%s", typedef_opts);
+ (void) mdb_dec_indent(2);
+ mdb_printf("%<b>EXAMPLES%</b>\n");
+ (void) mdb_inc_indent(2);
+ mdb_printf("%s", typedef_examps);
+ (void) mdb_dec_indent(2);
+ mdb_printf("%<b>INTRINSICS%</b>\n");
+ (void) mdb_inc_indent(2);
+ mdb_printf("%s", typedef_intrins);
+}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAddPrinterFailedException.java b/usr/src/cmd/mdb/common/mdb/mdb_typedef.h
index c952484b08..28f91b7987 100644
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAddPrinterFailedException.java
+++ b/usr/src/cmd/mdb/common/mdb/mdb_typedef.h
@@ -19,22 +19,24 @@
* CDDL HEADER END
*/
/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmAddPrinterFailedException.java
- *
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
-package com.sun.admin.pm.client;
-import java.lang.*;
+#ifndef _MDB_TYPEDEF_H
+#define _MDB_TYPEDEF_H
-class pmAddPrinterFailedException extends pmGuiException {
- public pmAddPrinterFailedException(String s) {
- super(s);
- }
+#include <mdb/mdb_modapi.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int cmd_typedef(uintptr_t, uint_t, int, const mdb_arg_t *);
+void cmd_typedef_help(void);
+
+#ifdef __cplusplus
}
+#endif
+
+#endif /* _MDB_TYPEDEF_H */
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_whatis.c b/usr/src/cmd/mdb/common/mdb/mdb_whatis.c
index 1b53a32d39..6a26a7dec9 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_whatis.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_whatis.c
@@ -21,6 +21,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
/*
diff --git a/usr/src/cmd/mdb/common/modules/conf/mapfile-extern b/usr/src/cmd/mdb/common/modules/conf/mapfile-extern
index d1c401975c..5b4b8f2be1 100644
--- a/usr/src/cmd/mdb/common/modules/conf/mapfile-extern
+++ b/usr/src/cmd/mdb/common/modules/conf/mapfile-extern
@@ -148,6 +148,7 @@ SYMBOL_SCOPE {
mdb_set_pipe { FLAGS = EXTERN };
mdb_snprintf { FLAGS = EXTERN };
mdb_strtoull { FLAGS = EXTERN };
+ mdb_symbol_iter { FLAGS = EXTERN };
mdb_tgt_notsup { FLAGS = EXTERN };
mdb_vnode2path { FLAGS = EXTERN };
mdb_vread { FLAGS = EXTERN };
diff --git a/usr/src/cmd/mdb/common/modules/dtrace/dtrace.c b/usr/src/cmd/mdb/common/modules/dtrace/dtrace.c
index f484828b75..50ad2c3497 100644
--- a/usr/src/cmd/mdb/common/modules/dtrace/dtrace.c
+++ b/usr/src/cmd/mdb/common/modules/dtrace/dtrace.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/*
@@ -432,6 +433,7 @@ dtracemdb_bufsnap(dtrace_buffer_t *which, dtrace_bufdesc_t *desc)
desc->dtbd_size = bufsize;
desc->dtbd_drops = buf.dtb_drops;
desc->dtbd_errors = buf.dtb_errors;
+ desc->dtbd_timestamp = gethrtime();
return (0);
}
@@ -1273,19 +1275,19 @@ int
dtrace_helptrace_init(mdb_walk_state_t *wsp)
{
uint32_t next;
- int enabled;
+ uintptr_t buffer;
if (wsp->walk_addr != NULL) {
mdb_warn("dtrace_helptrace only supports global walks\n");
return (WALK_ERR);
}
- if (mdb_readvar(&enabled, "dtrace_helptrace_enabled") == -1) {
- mdb_warn("couldn't read 'dtrace_helptrace_enabled'");
+ if (mdb_readvar(&buffer, "dtrace_helptrace_buffer") == -1) {
+ mdb_warn("couldn't read 'dtrace_helptrace_buffer'");
return (WALK_ERR);
}
- if (!enabled) {
+ if (buffer == NULL) {
mdb_warn("helper tracing is not enabled\n");
return (WALK_ERR);
}
diff --git a/usr/src/cmd/mdb/common/modules/genunix/genunix.c b/usr/src/cmd/mdb/common/modules/genunix/genunix.c
index d54d11e8ce..48578a52f4 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/genunix.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/genunix.c
@@ -21,6 +21,7 @@
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
*/
#include <mdb/mdb_param.h>
@@ -109,10 +110,6 @@
*/
#define NINTR 16
-#define KILOS 10
-#define MEGS 20
-#define GIGS 30
-
#ifndef STACK_BIAS
#define STACK_BIAS 0
#endif
@@ -1900,24 +1897,24 @@ typedef struct datafmt {
} datafmt_t;
static datafmt_t kmemfmt[] = {
- { "cache ", "name ",
- "-------------------------", "%-25s " },
- { " buf", " size", "------", "%6u " },
- { " buf", "in use", "------", "%6u " },
- { " buf", " total", "------", "%6u " },
- { " memory", " in use", "----------", "%10lu%c " },
- { " alloc", " succeed", "---------", "%9u " },
- { "alloc", " fail", "-----", "%5u " },
+ { "cache ", "name ",
+ "------------------------------", "%-30s " },
+ { " buf", " size", "-----", "%5H " },
+ { " buf", " in use", "---------", "%9u " },
+ { " buf", " total", "---------", "%9u " },
+ { "memory", "in use", "------", "%6lH " },
+ { " alloc", " succeed", "----------", "%10u " },
+ { "alloc", " fail", "-----", "%5u" },
{ NULL, NULL, NULL, NULL }
};
static datafmt_t vmemfmt[] = {
- { "vmem ", "name ",
- "-------------------------", "%-*s " },
- { " memory", " in use", "----------", "%9llu%c " },
- { " memory", " total", "-----------", "%10llu%c " },
- { " memory", " import", "----------", "%9llu%c " },
- { " alloc", " succeed", "---------", "%9llu " },
+ { "vmem ", "name ",
+ "------------------------------", "%-*s " },
+ { " memory", " in use", "---------", "%9llH " },
+ { " memory", " total", "----------", "%10llH " },
+ { " memory", " import", "---------", "%9llH " },
+ { " alloc", " succeed", "----------", "%10llu " },
{ "alloc", " fail", "-----", "%5llu " },
{ NULL, NULL, NULL, NULL }
};
@@ -1969,15 +1966,9 @@ typedef struct kmastat_vmem {
int kv_fail;
} kmastat_vmem_t;
-typedef struct kmastat_args {
- kmastat_vmem_t **ka_kvpp;
- uint_t ka_shift;
-} kmastat_args_t;
-
static int
-kmastat_cache(uintptr_t addr, const kmem_cache_t *cp, kmastat_args_t *kap)
+kmastat_cache(uintptr_t addr, const kmem_cache_t *cp, kmastat_vmem_t **kvpp)
{
- kmastat_vmem_t **kvpp = kap->ka_kvpp;
kmastat_vmem_t *kv;
datafmt_t *dfp = kmemfmt;
int magsize;
@@ -2018,9 +2009,7 @@ out:
mdb_printf((dfp++)->fmt, cp->cache_bufsize);
mdb_printf((dfp++)->fmt, total - avail);
mdb_printf((dfp++)->fmt, total);
- mdb_printf((dfp++)->fmt, meminuse >> kap->ka_shift,
- kap->ka_shift == GIGS ? 'G' : kap->ka_shift == MEGS ? 'M' :
- kap->ka_shift == KILOS ? 'K' : 'B');
+ mdb_printf((dfp++)->fmt, meminuse);
mdb_printf((dfp++)->fmt, alloc);
mdb_printf((dfp++)->fmt, cp->cache_alloc_fail);
mdb_printf("\n");
@@ -2029,9 +2018,8 @@ out:
}
static int
-kmastat_vmem_totals(uintptr_t addr, const vmem_t *v, kmastat_args_t *kap)
+kmastat_vmem_totals(uintptr_t addr, const vmem_t *v, kmastat_vmem_t *kv)
{
- kmastat_vmem_t *kv = *kap->ka_kvpp;
size_t len;
while (kv != NULL && kv->kv_addr != addr)
@@ -2040,20 +2028,18 @@ kmastat_vmem_totals(uintptr_t addr, const vmem_t *v, kmastat_args_t *kap)
if (kv == NULL || kv->kv_alloc == 0)
return (WALK_NEXT);
- len = MIN(17, strlen(v->vm_name));
+ len = MIN(22, strlen(v->vm_name));
- mdb_printf("Total [%s]%*s %6s %6s %6s %10lu%c %9u %5u\n", v->vm_name,
- 17 - len, "", "", "", "",
- kv->kv_meminuse >> kap->ka_shift,
- kap->ka_shift == GIGS ? 'G' : kap->ka_shift == MEGS ? 'M' :
- kap->ka_shift == KILOS ? 'K' : 'B', kv->kv_alloc, kv->kv_fail);
+ mdb_printf("Total [%s]%*s %5s %9s %9s %6lH %10u %5u\n", v->vm_name,
+ 22 - len, "", "", "", "",
+ kv->kv_meminuse, kv->kv_alloc, kv->kv_fail);
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
-kmastat_vmem(uintptr_t addr, const vmem_t *v, const uint_t *shiftp)
+kmastat_vmem(uintptr_t addr, const vmem_t *v, const void *ignored)
{
datafmt_t *dfp = vmemfmt;
const vmem_kstat_t *vkp = &v->vm_kstat;
@@ -2071,16 +2057,10 @@ kmastat_vmem(uintptr_t addr, const vmem_t *v, const uint_t *shiftp)
}
mdb_printf("%*s", ident, "");
- mdb_printf((dfp++)->fmt, 25 - ident, v->vm_name);
- mdb_printf((dfp++)->fmt, vkp->vk_mem_inuse.value.ui64 >> *shiftp,
- *shiftp == GIGS ? 'G' : *shiftp == MEGS ? 'M' :
- *shiftp == KILOS ? 'K' : 'B');
- mdb_printf((dfp++)->fmt, vkp->vk_mem_total.value.ui64 >> *shiftp,
- *shiftp == GIGS ? 'G' : *shiftp == MEGS ? 'M' :
- *shiftp == KILOS ? 'K' : 'B');
- mdb_printf((dfp++)->fmt, vkp->vk_mem_import.value.ui64 >> *shiftp,
- *shiftp == GIGS ? 'G' : *shiftp == MEGS ? 'M' :
- *shiftp == KILOS ? 'K' : 'B');
+ mdb_printf((dfp++)->fmt, 30 - ident, v->vm_name);
+ mdb_printf((dfp++)->fmt, vkp->vk_mem_inuse.value.ui64);
+ mdb_printf((dfp++)->fmt, vkp->vk_mem_total.value.ui64);
+ mdb_printf((dfp++)->fmt, vkp->vk_mem_import.value.ui64);
mdb_printf((dfp++)->fmt, vkp->vk_alloc.value.ui64);
mdb_printf((dfp++)->fmt, vkp->vk_fail.value.ui64);
@@ -2095,44 +2075,35 @@ kmastat(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
kmastat_vmem_t *kv = NULL;
datafmt_t *dfp;
- kmastat_args_t ka;
-
- ka.ka_shift = 0;
- if (mdb_getopts(argc, argv,
- 'k', MDB_OPT_SETBITS, KILOS, &ka.ka_shift,
- 'm', MDB_OPT_SETBITS, MEGS, &ka.ka_shift,
- 'g', MDB_OPT_SETBITS, GIGS, &ka.ka_shift, NULL) != argc)
- return (DCMD_USAGE);
for (dfp = kmemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->hdr1);
+ mdb_printf("%s%s", dfp == kmemfmt ? "" : " ", dfp->hdr1);
mdb_printf("\n");
for (dfp = kmemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->hdr2);
+ mdb_printf("%s%s", dfp == kmemfmt ? "" : " ", dfp->hdr2);
mdb_printf("\n");
for (dfp = kmemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->dashes);
+ mdb_printf("%s%s", dfp == kmemfmt ? "" : " ", dfp->dashes);
mdb_printf("\n");
- ka.ka_kvpp = &kv;
- if (mdb_walk("kmem_cache", (mdb_walk_cb_t)kmastat_cache, &ka) == -1) {
+ if (mdb_walk("kmem_cache", (mdb_walk_cb_t)kmastat_cache, &kv) == -1) {
mdb_warn("can't walk 'kmem_cache'");
return (DCMD_ERR);
}
for (dfp = kmemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->dashes);
+ mdb_printf("%s%s", dfp == kmemfmt ? "" : " ", dfp->dashes);
mdb_printf("\n");
- if (mdb_walk("vmem", (mdb_walk_cb_t)kmastat_vmem_totals, &ka) == -1) {
+ if (mdb_walk("vmem", (mdb_walk_cb_t)kmastat_vmem_totals, kv) == -1) {
mdb_warn("can't walk 'vmem'");
return (DCMD_ERR);
}
for (dfp = kmemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->dashes);
+ mdb_printf("%s%s", dfp == kmemfmt ? "" : " ", dfp->dashes);
mdb_printf("\n");
mdb_printf("\n");
@@ -2149,7 +2120,7 @@ kmastat(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
mdb_printf("%s ", dfp->dashes);
mdb_printf("\n");
- if (mdb_walk("vmem", (mdb_walk_cb_t)kmastat_vmem, &ka.ka_shift) == -1) {
+ if (mdb_walk("vmem", (mdb_walk_cb_t)kmastat_vmem, NULL) == -1) {
mdb_warn("can't walk 'vmem'");
return (DCMD_ERR);
}
@@ -3986,8 +3957,7 @@ static const mdb_dcmd_t dcmds[] = {
{ "freedby", ":", "given a thread, print its freed buffers", freedby },
{ "kmalog", "?[ fail | slab ]",
"display kmem transaction log and stack traces", kmalog },
- { "kmastat", "[-kmg]", "kernel memory allocator stats",
- kmastat },
+ { "kmastat", NULL, "kernel memory allocator stats", kmastat },
{ "kmausers", "?[-ef] [cache ...]", "current medium and large users "
"of the kmem allocator", kmausers, kmausers_help },
{ "kmem_cache", "?[-n name]",
@@ -4089,6 +4059,9 @@ static const mdb_dcmd_t dcmds[] = {
/* from netstack.c */
{ "netstack", "", "show stack instances", netstack },
+ { "netstackid2netstack", ":",
+ "translate a netstack id to its netstack_t",
+ netstackid2netstack },
/* from nvpair.c */
{ NVPAIR_DCMD_NAME, NVPAIR_DCMD_USAGE, NVPAIR_DCMD_DESCR,
@@ -4179,6 +4152,10 @@ static const mdb_dcmd_t dcmds[] = {
pfiles_help },
/* from zone.c */
+ { "zid2zone", ":", "find the zone_t with the given zone id",
+ zid2zone },
+ { "zdid2zone", ":", "find the zone_t with the given zone debug id",
+ zdid2zone },
{ "zone", "?[-r [-v]]", "display kernel zone(s)", zoneprt },
{ "zsd", ":[-v] [zsd_key]", "display zone-specific-data entries for "
"selected zones", zsd },
diff --git a/usr/src/cmd/mdb/common/modules/genunix/netstack.c b/usr/src/cmd/mdb/common/modules/genunix/netstack.c
index 588bd6dbf3..d46bd85d1f 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/netstack.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/netstack.c
@@ -21,10 +21,9 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_ks.h>
#include <mdb/mdb_ctf.h>
@@ -121,3 +120,30 @@ netstack(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
return (DCMD_OK);
}
+
+static int
+netstackid_lookup_cb(uintptr_t addr, const netstack_t *ns, void *arg)
+{
+ netstackid_t nid = *(uintptr_t *)arg;
+ if (ns->netstack_stackid == nid)
+ mdb_printf("%p\n", addr);
+
+ return (WALK_NEXT);
+}
+
+/*ARGSUSED*/
+int
+netstackid2netstack(uintptr_t addr, uint_t flags, int argc,
+ const mdb_arg_t *argv)
+{
+ if (!(flags & DCMD_ADDRSPEC) || argc != 0)
+ return (DCMD_USAGE);
+
+ if (mdb_walk("netstack", (mdb_walk_cb_t)netstackid_lookup_cb, &addr) ==
+ -1) {
+ mdb_warn("failed to walk zone");
+ return (DCMD_ERR);
+ }
+
+ return (DCMD_OK);
+}
diff --git a/usr/src/cmd/mdb/common/modules/genunix/netstack.h b/usr/src/cmd/mdb/common/modules/genunix/netstack.h
index 392565caca..f5773c36c1 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/netstack.h
+++ b/usr/src/cmd/mdb/common/modules/genunix/netstack.h
@@ -26,8 +26,6 @@
#ifndef _NETSTACK_H
#define _NETSTACK_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <mdb/mdb_modapi.h>
#ifdef __cplusplus
@@ -38,6 +36,7 @@ int netstack_walk_init(mdb_walk_state_t *);
int netstack_walk_step(mdb_walk_state_t *);
int netstack(uintptr_t, uint_t, int, const mdb_arg_t *);
+int netstackid2netstack(uintptr_t, uint_t, int, const mdb_arg_t *);
#ifdef __cplusplus
}
diff --git a/usr/src/cmd/mdb/common/modules/genunix/zone.c b/usr/src/cmd/mdb/common/modules/genunix/zone.c
index 96f6b598ec..77ed2cbc48 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/zone.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/zone.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <mdb/mdb_param.h>
@@ -33,9 +34,9 @@
#define ZONE_NAMELEN 20
#ifdef _LP64
-#define ZONE_PATHLEN 32
+#define ZONE_PATHLEN 25
#else
-#define ZONE_PATHLEN 40
+#define ZONE_PATHLEN 33
#endif
/*
@@ -54,6 +55,56 @@ char *zone_status_names[] = {
"dead" /* ZONE_IS_DEAD */
};
+static int
+zid_lookup_cb(uintptr_t addr, const zone_t *zone, void *arg)
+{
+ zoneid_t zid = *(uintptr_t *)arg;
+ if (zone->zone_id == zid)
+ mdb_printf("%p\n", addr);
+
+ return (WALK_NEXT);
+}
+
+/*ARGSUSED*/
+int
+zid2zone(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ if (!(flags & DCMD_ADDRSPEC) || argc != 0)
+ return (DCMD_USAGE);
+
+ if (mdb_walk("zone", (mdb_walk_cb_t)zid_lookup_cb, &addr) == -1) {
+ mdb_warn("failed to walk zone");
+ return (DCMD_ERR);
+ }
+
+ return (DCMD_OK);
+}
+
+static int
+zdid_lookup_cb(uintptr_t addr, const zone_t *zone, void *arg)
+{
+ zoneid_t zdid = *(uintptr_t *)arg;
+ if (zone->zone_did == zdid)
+ mdb_printf("%p\n", addr);
+
+ return (WALK_NEXT);
+}
+
+/*ARGSUSED*/
+int
+zdid2zone(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ if (!(flags & DCMD_ADDRSPEC) || argc != 0)
+ return (DCMD_USAGE);
+
+ if (mdb_walk("zone", (mdb_walk_cb_t)zdid_lookup_cb, &addr) == -1) {
+ mdb_warn("failed to walk zone");
+ return (DCMD_ERR);
+ }
+
+ return (DCMD_OK);
+}
+
int
zoneprt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
@@ -96,10 +147,10 @@ zoneprt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
*/
if (DCMD_HDRSPEC(flags)) {
if (ropt_given == FALSE)
- mdb_printf("%<u>%?s %6s %-13s %-20s %-s%</u>\n",
+ mdb_printf("%<u>%?s %4s %-13s %-19s %-s%</u>\n",
"ADDR", "ID", "STATUS", "NAME", "PATH");
else
- mdb_printf("%<u>%?s %6s %10s %10s %-20s%</u>\n",
+ mdb_printf("%<u>%?s %6s %10s %10s %-19s%</u>\n",
"ADDR", "ID", "REFS", "CREFS", "NAME");
}
@@ -138,7 +189,7 @@ zoneprt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
statusp = zone_status_names[zn.zone_status];
else
statusp = "???";
- mdb_printf("%0?p %6d %-13s %-20s %s\n", addr, zn.zone_id,
+ mdb_printf("%0?p %4d %-13s %-19s %s\n", addr, zn.zone_id,
statusp, name, path);
} else {
/*
@@ -146,7 +197,7 @@ zoneprt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
* Display the zone's subsystem-specific reference counts if
* the user specified the '-v' option.
*/
- mdb_printf("%0?p %6d %10u %10u %-20s\n", addr, zn.zone_id,
+ mdb_printf("%0?p %6d %10u %10u %-19s\n", addr, zn.zone_id,
zn.zone_ref, zn.zone_cred_ref, name);
if (vopt_given == TRUE) {
GElf_Sym subsys_names_sym;
@@ -384,7 +435,7 @@ zsd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
* Prepare to output the specified zone's ZSD information.
*/
if (DCMD_HDRSPEC(flags))
- mdb_printf("%<u>%-20s %?s %?s %8s%</u>\n", "ZONE", "KEY",
+ mdb_printf("%<u>%-19s %?s %?s %8s%</u>\n", "ZONE", "KEY",
"VALUE", "FLAGS");
len = mdb_readstr(name, ZONE_NAMELEN, (uintptr_t)zone.zone_name);
if (len > 0) {
@@ -393,7 +444,7 @@ zsd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
} else {
(void) strcpy(name, "??");
}
- mdb_printf("%-20s ", name);
+ mdb_printf("%-19s ", name);
/*
* Display the requested ZSD entries.
diff --git a/usr/src/cmd/mdb/common/modules/genunix/zone.h b/usr/src/cmd/mdb/common/modules/genunix/zone.h
index e0e5038527..94a383e41c 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/zone.h
+++ b/usr/src/cmd/mdb/common/modules/genunix/zone.h
@@ -27,14 +27,14 @@
#ifndef _ZONE_H
#define _ZONE_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <mdb/mdb_modapi.h>
#ifdef __cplusplus
extern "C" {
#endif
+extern int zid2zone(uintptr_t, uint_t, int argc, const mdb_arg_t *);
+extern int zdid2zone(uintptr_t, uint_t, int argc, const mdb_arg_t *);
extern int zoneprt(uintptr_t, uint_t, int argc, const mdb_arg_t *);
extern int zone_walk_init(mdb_walk_state_t *);
diff --git a/usr/src/cmd/mdb/common/modules/libc/libc.c b/usr/src/cmd/mdb/common/modules/libc/libc.c
index 27dcade228..44e4f49b87 100644
--- a/usr/src/cmd/mdb/common/modules/libc/libc.c
+++ b/usr/src/cmd/mdb/common/modules/libc/libc.c
@@ -23,6 +23,9 @@
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#include <sys/mdb_modapi.h>
#include <mdb/mdb_whatis.h>
@@ -681,6 +684,12 @@ d_ulwp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
prt_addr((void *)(addr + OFFSET(ul_spinlock)), 1),
prt_addr((void *)(addr + OFFSET(ul_fpuenv)), 0));
+ HD("tmem.size &tmem.roots");
+ mdb_printf(OFFSTR "%-21H %s\n",
+ OFFSET(ul_tmem),
+ ulwp.ul_tmem.tm_size,
+ prt_addr((void *)(addr + OFFSET(ul_tmem) + sizeof (size_t)), 0));
+
return (DCMD_OK);
}
diff --git a/usr/src/cmd/mdb/common/modules/libumem/libumem.c b/usr/src/cmd/mdb/common/modules/libumem/libumem.c
index 4a77c5aa82..0984edbdf0 100644
--- a/usr/src/cmd/mdb/common/modules/libumem/libumem.c
+++ b/usr/src/cmd/mdb/common/modules/libumem/libumem.c
@@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#include "umem.h"
#include <libproc.h>
#include <mdb/mdb_modapi.h>
@@ -34,6 +38,8 @@
#include <umem_impl.h>
#include <sys/vmem_impl_user.h>
+#include <thr_uberdata.h>
+#include <stdio.h>
#include "umem_pagesize.h"
@@ -44,24 +50,33 @@ typedef struct datafmt {
char *fmt;
} datafmt_t;
+static datafmt_t ptcfmt[] = {
+ { " ", "tid", "---", "%3u " },
+ { " memory", " cached", "-------", "%7lH " },
+ { " %", "cap", "---", "%3u " },
+ { " %", NULL, "---", "%3u " },
+ { NULL, NULL, NULL, NULL }
+};
+
static datafmt_t umemfmt[] = {
{ "cache ", "name ",
"-------------------------", "%-25s " },
{ " buf", " size", "------", "%6u " },
- { " buf", "in use", "------", "%6u " },
- { " buf", " total", "------", "%6u " },
- { " memory", " in use", "---------", "%9u " },
+ { " buf", " in use", "-------", "%7u " },
+ { " buf", " in ptc", "-------", "%7s " },
+ { " buf", " total", "-------", "%7u " },
+ { " memory", " in use", "-------", "%7H " },
{ " alloc", " succeed", "---------", "%9u " },
- { "alloc", " fail", "-----", "%5llu " },
+ { "alloc", " fail", "-----", "%5llu" },
{ NULL, NULL, NULL, NULL }
};
static datafmt_t vmemfmt[] = {
{ "vmem ", "name ",
"-------------------------", "%-*s " },
- { " memory", " in use", "---------", "%9llu " },
- { " memory", " total", "----------", "%10llu " },
- { " memory", " import", "---------", "%9llu " },
+ { " memory", " in use", "---------", "%9H " },
+ { " memory", " total", "----------", "%10H " },
+ { " memory", " import", "---------", "%9H " },
{ " alloc", " succeed", "---------", "%9llu " },
{ "alloc", " fail", "-----", "%5llu " },
{ NULL, NULL, NULL, NULL }
@@ -105,14 +120,105 @@ typedef struct umastat_vmem {
int kv_fail;
} umastat_vmem_t;
+/*ARGSUSED*/
+static int
+umastat_cache_nptc(uintptr_t addr, const umem_cache_t *cp, int *nptc)
+{
+ if (!(cp->cache_flags & UMF_PTC))
+ return (WALK_NEXT);
+
+ (*nptc)++;
+ return (WALK_NEXT);
+}
+
+/*ARGSUSED*/
+static int
+umastat_cache_hdr(uintptr_t addr, const umem_cache_t *cp, void *ignored)
+{
+ if (!(cp->cache_flags & UMF_PTC))
+ return (WALK_NEXT);
+
+ mdb_printf("%3d ", cp->cache_bufsize);
+ return (WALK_NEXT);
+}
+
+/*ARGSUSED*/
+static int
+umastat_lwp_ptc(uintptr_t addr, void *buf, int *nbufs)
+{
+ (*nbufs)++;
+ return (WALK_NEXT);
+}
+
+/*ARGSUSED*/
+static int
+umastat_lwp_cache(uintptr_t addr, const umem_cache_t *cp, ulwp_t *ulwp)
+{
+ char walk[60];
+ int nbufs = 0;
+
+ if (!(cp->cache_flags & UMF_PTC))
+ return (WALK_NEXT);
+
+ (void) snprintf(walk, sizeof (walk), "umem_ptc_%d", cp->cache_bufsize);
+
+ if (mdb_pwalk(walk, (mdb_walk_cb_t)umastat_lwp_ptc,
+ &nbufs, (uintptr_t)ulwp->ul_self) == -1) {
+ mdb_warn("unable to walk '%s'", walk);
+ return (WALK_ERR);
+ }
+
+ mdb_printf("%3d ", ulwp->ul_tmem.tm_size ?
+ (nbufs * cp->cache_bufsize * 100) / ulwp->ul_tmem.tm_size : 0);
+
+ return (WALK_NEXT);
+}
+
+/*ARGSUSED*/
+static int
+umastat_lwp(uintptr_t addr, const ulwp_t *ulwp, void *ignored)
+{
+ size_t size;
+ datafmt_t *dfp = ptcfmt;
+
+ mdb_printf((dfp++)->fmt, ulwp->ul_lwpid);
+ mdb_printf((dfp++)->fmt, ulwp->ul_tmem.tm_size);
+
+ if (umem_readvar(&size, "umem_ptc_size") == -1) {
+ mdb_warn("unable to read 'umem_ptc_size'");
+ return (WALK_ERR);
+ }
+
+ mdb_printf((dfp++)->fmt, (ulwp->ul_tmem.tm_size * 100) / size);
+
+ if (mdb_walk("umem_cache",
+ (mdb_walk_cb_t)umastat_lwp_cache, (void *)ulwp) == -1) {
+ mdb_warn("can't walk 'umem_cache'");
+ return (WALK_ERR);
+ }
+
+ mdb_printf("\n");
+
+ return (WALK_NEXT);
+}
+
+/*ARGSUSED*/
+static int
+umastat_cache_ptc(uintptr_t addr, const void *ignored, int *nptc)
+{
+ (*nptc)++;
+ return (WALK_NEXT);
+}
+
static int
umastat_cache(uintptr_t addr, const umem_cache_t *cp, umastat_vmem_t **kvp)
{
umastat_vmem_t *kv;
datafmt_t *dfp = umemfmt;
+ char buf[10];
int magsize;
- int avail, alloc, total;
+ int avail, alloc, total, nptc = 0;
size_t meminuse = (cp->cache_slab_create - cp->cache_slab_destroy) *
cp->cache_slabsize;
@@ -130,6 +236,21 @@ umastat_cache(uintptr_t addr, const umem_cache_t *cp, umastat_vmem_t **kvp)
(void) mdb_pwalk("umem_cpu_cache", cpu_avail, &avail, addr);
(void) mdb_pwalk("umem_slab_partial", slab_avail, &avail, addr);
+ if (cp->cache_flags & UMF_PTC) {
+ char walk[60];
+
+ (void) snprintf(walk, sizeof (walk),
+ "umem_ptc_%d", cp->cache_bufsize);
+
+ if (mdb_walk(walk,
+ (mdb_walk_cb_t)umastat_cache_ptc, &nptc) == -1) {
+ mdb_warn("unable to walk '%s'", walk);
+ return (WALK_ERR);
+ }
+
+ (void) snprintf(buf, sizeof (buf), "%d", nptc);
+ }
+
for (kv = *kvp; kv != NULL; kv = kv->kv_next) {
if (kv->kv_addr == (uintptr_t)cp->cache_arena)
goto out;
@@ -147,6 +268,7 @@ out:
mdb_printf((dfp++)->fmt, cp->cache_name);
mdb_printf((dfp++)->fmt, cp->cache_bufsize);
mdb_printf((dfp++)->fmt, total - avail);
+ mdb_printf((dfp++)->fmt, cp->cache_flags & UMF_PTC ? buf : "-");
mdb_printf((dfp++)->fmt, total);
mdb_printf((dfp++)->fmt, meminuse);
mdb_printf((dfp++)->fmt, alloc);
@@ -165,8 +287,8 @@ umastat_vmem_totals(uintptr_t addr, const vmem_t *v, umastat_vmem_t *kv)
if (kv == NULL || kv->kv_alloc == 0)
return (WALK_NEXT);
- mdb_printf("Total [%s]%*s %6s %6s %6s %9u %9u %5u\n", v->vm_name,
- 17 - strlen(v->vm_name), "", "", "", "",
+ mdb_printf("Total [%s]%*s %6s %7s %7s %7s %7H %9u %5u\n", v->vm_name,
+ 17 - strlen(v->vm_name), "", "", "", "", "",
kv->kv_meminuse, kv->kv_alloc, kv->kv_fail);
return (WALK_NEXT);
@@ -209,20 +331,67 @@ umastat(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
umastat_vmem_t *kv = NULL;
datafmt_t *dfp;
+ int nptc = 0, i;
if (argc != 0)
return (DCMD_USAGE);
+ /*
+ * We need to determine if we have any caches that have per-thread
+ * caching enabled.
+ */
+ if (mdb_walk("umem_cache",
+ (mdb_walk_cb_t)umastat_cache_nptc, &nptc) == -1) {
+ mdb_warn("can't walk 'umem_cache'");
+ return (DCMD_ERR);
+ }
+
+ if (nptc) {
+ for (dfp = ptcfmt; dfp->hdr2 != NULL; dfp++)
+ mdb_printf("%s ", dfp->hdr1);
+
+ for (i = 0; i < nptc; i++)
+ mdb_printf("%s ", dfp->hdr1);
+
+ mdb_printf("\n");
+
+ for (dfp = ptcfmt; dfp->hdr2 != NULL; dfp++)
+ mdb_printf("%s ", dfp->hdr2);
+
+ if (mdb_walk("umem_cache",
+ (mdb_walk_cb_t)umastat_cache_hdr, NULL) == -1) {
+ mdb_warn("can't walk 'umem_cache'");
+ return (DCMD_ERR);
+ }
+
+ mdb_printf("\n");
+
+ for (dfp = ptcfmt; dfp->hdr2 != NULL; dfp++)
+ mdb_printf("%s ", dfp->dashes);
+
+ for (i = 0; i < nptc; i++)
+ mdb_printf("%s ", dfp->dashes);
+
+ mdb_printf("\n");
+
+ if (mdb_walk("ulwp", (mdb_walk_cb_t)umastat_lwp, NULL) == -1) {
+ mdb_warn("can't walk 'ulwp'");
+ return (DCMD_ERR);
+ }
+
+ mdb_printf("\n");
+ }
+
for (dfp = umemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->hdr1);
+ mdb_printf("%s%s", dfp == umemfmt ? "" : " ", dfp->hdr1);
mdb_printf("\n");
for (dfp = umemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->hdr2);
+ mdb_printf("%s%s", dfp == umemfmt ? "" : " ", dfp->hdr2);
mdb_printf("\n");
for (dfp = umemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->dashes);
+ mdb_printf("%s%s", dfp == umemfmt ? "" : " ", dfp->dashes);
mdb_printf("\n");
if (mdb_walk("umem_cache", (mdb_walk_cb_t)umastat_cache, &kv) == -1) {
@@ -231,7 +400,7 @@ umastat(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}
for (dfp = umemfmt; dfp->hdr1 != NULL; dfp++)
- mdb_printf("%s ", dfp->dashes);
+ mdb_printf("%s%s", dfp == umemfmt ? "" : " ", dfp->dashes);
mdb_printf("\n");
if (mdb_walk("vmem", (mdb_walk_cb_t)umastat_vmem_totals, kv) == -1) {
diff --git a/usr/src/cmd/mdb/common/modules/libumem/umem.c b/usr/src/cmd/mdb/common/modules/libumem/umem.c
index 26a62c7b52..69b003cc5c 100644
--- a/usr/src/cmd/mdb/common/modules/libumem/umem.c
+++ b/usr/src/cmd/mdb/common/modules/libumem/umem.c
@@ -24,7 +24,7 @@
*/
/*
- * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
@@ -36,6 +36,8 @@
#include <alloca.h>
#include <limits.h>
#include <mdb/mdb_whatis.h>
+#include <thr_uberdata.h>
+#include <stdio.h>
#include "misc.h"
#include "leaky.h"
@@ -104,12 +106,58 @@ umem_update_variables(void)
return (0);
}
+static int
+umem_ptc_walk_init(mdb_walk_state_t *wsp)
+{
+ if (wsp->walk_addr == NULL) {
+ if (mdb_layered_walk("ulwp", wsp) == -1) {
+ mdb_warn("couldn't walk 'ulwp'");
+ return (WALK_ERR);
+ }
+ }
+
+ return (WALK_NEXT);
+}
+
+static int
+umem_ptc_walk_step(mdb_walk_state_t *wsp)
+{
+ uintptr_t this;
+ int rval;
+
+ if (wsp->walk_layer != NULL) {
+ this = (uintptr_t)((ulwp_t *)wsp->walk_layer)->ul_self +
+ (uintptr_t)wsp->walk_arg;
+ } else {
+ this = wsp->walk_addr + (uintptr_t)wsp->walk_arg;
+ }
+
+ for (;;) {
+ if (mdb_vread(&this, sizeof (void *), this) == -1) {
+ mdb_warn("couldn't read ptc buffer at %p", this);
+ return (WALK_ERR);
+ }
+
+ if (this == NULL)
+ break;
+
+ rval = wsp->walk_callback(this, &this, wsp->walk_cbdata);
+
+ if (rval != WALK_NEXT)
+ return (rval);
+ }
+
+ return (wsp->walk_layer != NULL ? WALK_NEXT : WALK_DONE);
+}
+
/*ARGSUSED*/
static int
-umem_init_walkers(uintptr_t addr, const umem_cache_t *c, void *ignored)
+umem_init_walkers(uintptr_t addr, const umem_cache_t *c, int *sizes)
{
mdb_walker_t w;
char descr[64];
+ char name[64];
+ int i;
(void) mdb_snprintf(descr, sizeof (descr),
"walk the %s cache", c->cache_name);
@@ -124,6 +172,45 @@ umem_init_walkers(uintptr_t addr, const umem_cache_t *c, void *ignored)
if (mdb_add_walker(&w) == -1)
mdb_warn("failed to add %s walker", c->cache_name);
+ if (!(c->cache_flags & UMF_PTC))
+ return (WALK_NEXT);
+
+ /*
+ * For the per-thread cache walker, the address is the offset in the
+ * tm_roots[] array of the ulwp_t.
+ */
+ for (i = 0; sizes[i] != 0; i++) {
+ if (sizes[i] == c->cache_bufsize)
+ break;
+ }
+
+ if (sizes[i] == 0) {
+ mdb_warn("cache %s is cached per-thread, but could not find "
+ "size in umem_alloc_sizes\n", c->cache_name);
+ return (WALK_NEXT);
+ }
+
+ if (i >= NTMEMBASE) {
+ mdb_warn("index for %s (%d) exceeds root slots (%d)\n",
+ c->cache_name, i, NTMEMBASE);
+ return (WALK_NEXT);
+ }
+
+ (void) mdb_snprintf(name, sizeof (name),
+ "umem_ptc_%d", c->cache_bufsize);
+ (void) mdb_snprintf(descr, sizeof (descr),
+ "walk the per-thread cache for %s", c->cache_name);
+
+ w.walk_name = name;
+ w.walk_descr = descr;
+ w.walk_init = umem_ptc_walk_init;
+ w.walk_step = umem_ptc_walk_step;
+ w.walk_fini = NULL;
+ w.walk_init_arg = (void *)offsetof(ulwp_t, ul_tmem.tm_roots[i]);
+
+ if (mdb_add_walker(&w) == -1)
+ mdb_warn("failed to add %s walker", w.walk_name);
+
return (WALK_NEXT);
}
@@ -132,6 +219,8 @@ static void
umem_statechange_cb(void *arg)
{
static int been_ready = 0;
+ GElf_Sym sym;
+ int *sizes;
#ifndef _KMDB
leaky_cleanup(1); /* state changes invalidate leaky state */
@@ -147,7 +236,25 @@ umem_statechange_cb(void *arg)
return;
been_ready = 1;
- (void) mdb_walk("umem_cache", (mdb_walk_cb_t)umem_init_walkers, NULL);
+
+ /*
+ * In order to determine the tm_roots offset of any cache that is
+ * cached per-thread, we need to have the umem_alloc_sizes array.
+ * Read this, assuring that it is zero-terminated.
+ */
+ if (umem_lookup_by_name("umem_alloc_sizes", &sym) == -1) {
+ mdb_warn("unable to lookup 'umem_alloc_sizes'");
+ return;
+ }
+
+ sizes = mdb_zalloc(sym.st_size + sizeof (int), UM_SLEEP | UM_GC);
+
+ if (mdb_vread(sizes, sym.st_size, (uintptr_t)sym.st_value) == -1) {
+ mdb_warn("couldn't read 'umem_alloc_sizes'");
+ return;
+ }
+
+ (void) mdb_walk("umem_cache", (mdb_walk_cb_t)umem_init_walkers, sizes);
}
int
@@ -788,9 +895,9 @@ umem_estimate_allocated(uintptr_t addr, const umem_cache_t *cp)
} \
}
-int
+static int
umem_read_magazines(umem_cache_t *cp, uintptr_t addr,
- void ***maglistp, size_t *magcntp, size_t *magmaxp, int alloc_flags)
+ void ***maglistp, size_t *magcntp, size_t *magmaxp)
{
umem_magazine_t *ump, *mp;
void **maglist = NULL;
@@ -807,7 +914,7 @@ umem_read_magazines(umem_cache_t *cp, uintptr_t addr,
*maglistp = NULL;
*magcntp = 0;
*magmaxp = 0;
- return (WALK_NEXT);
+ return (0);
}
/*
@@ -828,11 +935,11 @@ umem_read_magazines(umem_cache_t *cp, uintptr_t addr,
if (magbsize >= PAGESIZE / 2) {
mdb_warn("magazine size for cache %p unreasonable (%x)\n",
addr, magbsize);
- return (WALK_ERR);
+ return (-1);
}
- maglist = mdb_alloc(magmax * sizeof (void *), alloc_flags);
- mp = mdb_alloc(magbsize, alloc_flags);
+ maglist = mdb_alloc(magmax * sizeof (void *), UM_SLEEP);
+ mp = mdb_alloc(magbsize, UM_SLEEP);
if (mp == NULL || maglist == NULL)
goto fail;
@@ -875,23 +982,80 @@ umem_read_magazines(umem_cache_t *cp, uintptr_t addr,
dprintf(("magazine layer: %d buffers\n", magcnt));
- if (!(alloc_flags & UM_GC))
- mdb_free(mp, magbsize);
+ mdb_free(mp, magbsize);
*maglistp = maglist;
*magcntp = magcnt;
*magmaxp = magmax;
- return (WALK_NEXT);
+ return (0);
fail:
- if (!(alloc_flags & UM_GC)) {
- if (mp)
- mdb_free(mp, magbsize);
- if (maglist)
- mdb_free(maglist, magmax * sizeof (void *));
+ if (mp)
+ mdb_free(mp, magbsize);
+ if (maglist)
+ mdb_free(maglist, magmax * sizeof (void *));
+
+ return (-1);
+}
+
+typedef struct umem_read_ptc_walk {
+ void **urpw_buf;
+ size_t urpw_cnt;
+ size_t urpw_max;
+} umem_read_ptc_walk_t;
+
+/*ARGSUSED*/
+static int
+umem_read_ptc_walk_buf(uintptr_t addr,
+ const void *ignored, umem_read_ptc_walk_t *urpw)
+{
+ if (urpw->urpw_cnt == urpw->urpw_max) {
+ size_t nmax = urpw->urpw_max ? (urpw->urpw_max << 1) : 1;
+ void **new = mdb_zalloc(nmax * sizeof (void *), UM_SLEEP);
+
+ if (nmax > 1) {
+ size_t osize = urpw->urpw_max * sizeof (void *);
+ bcopy(urpw->urpw_buf, new, osize);
+ mdb_free(urpw->urpw_buf, osize);
+ }
+
+ urpw->urpw_buf = new;
+ urpw->urpw_max = nmax;
}
- return (WALK_ERR);
+
+ urpw->urpw_buf[urpw->urpw_cnt++] = (void *)addr;
+
+ return (WALK_NEXT);
+}
+
+static int
+umem_read_ptc(umem_cache_t *cp,
+ void ***buflistp, size_t *bufcntp, size_t *bufmaxp)
+{
+ umem_read_ptc_walk_t urpw;
+ char walk[60];
+ int rval;
+
+ if (!(cp->cache_flags & UMF_PTC))
+ return (0);
+
+ (void) snprintf(walk, sizeof (walk), "umem_ptc_%d", cp->cache_bufsize);
+
+ urpw.urpw_buf = *buflistp;
+ urpw.urpw_cnt = *bufcntp;
+ urpw.urpw_max = *bufmaxp;
+
+ if ((rval = mdb_walk(walk,
+ (mdb_walk_cb_t)umem_read_ptc_walk_buf, &urpw)) == -1) {
+ mdb_warn("couldn't walk %s", walk);
+ }
+
+ *buflistp = urpw.urpw_buf;
+ *bufcntp = urpw.urpw_cnt;
+ *bufmaxp = urpw.urpw_max;
+
+ return (rval);
}
static int
@@ -1022,13 +1186,19 @@ umem_walk_init_common(mdb_walk_state_t *wsp, int type)
/*
* Read in the contents of the magazine layer
*/
- if (umem_read_magazines(cp, addr, &maglist, &magcnt, &magmax,
- UM_SLEEP) == WALK_ERR)
+ if (umem_read_magazines(cp, addr, &maglist, &magcnt, &magmax) != 0)
+ goto out2;
+
+ /*
+ * Read in the contents of the per-thread caches, if any
+ */
+ if (umem_read_ptc(cp, &maglist, &magcnt, &magmax) != 0)
goto out2;
/*
- * We have all of the buffers from the magazines; if we are walking
- * allocated buffers, sort them so we can bsearch them later.
+ * We have all of the buffers from the magazines and from the
+ * per-thread cache (if any); if we are walking allocated buffers,
+ * sort them so we can bsearch them later.
*/
if (type & UM_ALLOCATED)
qsort(maglist, magcnt, sizeof (void *), addrcmp);
diff --git a/usr/src/cmd/mdb/common/modules/mpt_sas/mpt_sas.c b/usr/src/cmd/mdb/common/modules/mpt_sas/mpt_sas.c
index 7c97ec8b42..fa6e1a578c 100644
--- a/usr/src/cmd/mdb/common/modules/mpt_sas/mpt_sas.c
+++ b/usr/src/cmd/mdb/common/modules/mpt_sas/mpt_sas.c
@@ -286,8 +286,10 @@ display_targets(struct mptsas_slots *s)
mdb_printf("devhdl %x, sasaddress %"PRIx64", phymask %x,"
"devinfo %x\n", ptgt->m_devhdl, ptgt->m_sas_wwn,
ptgt->m_phymask, ptgt->m_deviceinfo);
- mdb_printf("throttle %x, dr_flag %x, m_t_ncmds %x\n",
- ptgt->m_t_throttle, ptgt->m_dr_flag, ptgt->m_t_ncmds);
+ mdb_printf("throttle %x, dr_flag %x, m_t_ncmds %x, "
+ "enclosure %x, slot_num %x\n", ptgt->m_t_throttle,
+ ptgt->m_dr_flag, ptgt->m_t_ncmds, ptgt->m_enclosure,
+ ptgt->m_slot_num);
mdb_free(ptgt, sizeof (mptsas_target_t));
ptgt = (mptsas_target_t *)hash_traverse(
diff --git a/usr/src/cmd/mdb/common/modules/v8/mdb_v8.c b/usr/src/cmd/mdb/common/modules/v8/mdb_v8.c
new file mode 100644
index 0000000000..c6da9a7230
--- /dev/null
+++ b/usr/src/cmd/mdb/common/modules/v8/mdb_v8.c
@@ -0,0 +1,4104 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * mdb(1M) module for debugging the V8 JavaScript engine. This implementation
+ * makes heavy use of metadata defined in the V8 binary for inspecting in-memory
+ * structures. Canned configurations can be manually loaded for V8 binaries
+ * that predate this metadata. See mdb_v8_cfg.c for details.
+ */
+
+/*
+ * We hard-code our MDB_API_VERSION to be 3 to allow this module to be
+ * compiled on systems with higher version numbers, but still allow the
+ * resulting binary object to be used on older systems. (We do not make use
+ * of functionality present in versions later than 3.) This is particularly
+ * important for mdb_v8 because (1) it's used in particular to debug
+ * application-level software and (2) it has a history of rapid evolution.
+ */
+#define MDB_API_VERSION 3
+
+#include <sys/mdb_modapi.h>
+#include <assert.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <libproc.h>
+#include <sys/avl.h>
+#include <alloca.h>
+
+#include "v8dbg.h"
+#include "v8cfg.h"
+
+#define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
+
+/*
+ * The "v8_class" and "v8_field" structures describe the C++ classes used to
+ * represent V8 heap objects.
+ */
+typedef struct v8_class {
+ struct v8_class *v8c_next; /* list linkage */
+ struct v8_class *v8c_parent; /* parent class (inheritance) */
+ struct v8_field *v8c_fields; /* array of class fields */
+ size_t v8c_start; /* offset of first class field */
+ size_t v8c_end; /* offset of first subclass field */
+ char v8c_name[64]; /* heap object class name */
+} v8_class_t;
+
+typedef struct v8_field {
+ struct v8_field *v8f_next; /* list linkage */
+ ssize_t v8f_offset; /* field offset */
+ char v8f_name[64]; /* field name */
+ boolean_t v8f_isbyte; /* 1-byte int field */
+ boolean_t v8f_isstr; /* NUL-terminated string */
+} v8_field_t;
+
+/*
+ * Similarly, the "v8_enum" structure describes an enum from V8.
+ */
+typedef struct {
+ char v8e_name[64];
+ uint_t v8e_value;
+} v8_enum_t;
+
+/*
+ * During configuration, the dmod updates these globals with the actual set of
+ * classes, types, and frame types based on the debug metadata.
+ */
+static v8_class_t *v8_classes;
+
+static v8_enum_t v8_types[128];
+static int v8_next_type;
+
+static v8_enum_t v8_frametypes[16];
+static int v8_next_frametype;
+
+static int v8_silent;
+
+/*
+ * The following constants describe offsets from the frame pointer that are used
+ * to inspect each stack frame. They're initialized from the debug metadata.
+ */
+static ssize_t V8_OFF_FP_CONTEXT;
+static ssize_t V8_OFF_FP_MARKER;
+static ssize_t V8_OFF_FP_FUNCTION;
+static ssize_t V8_OFF_FP_ARGS;
+
+/*
+ * The following constants are used by macros defined in heap-dbg-common.h to
+ * examine the types of various V8 heap objects. In general, the macros should
+ * be preferred to using the constants directly. The values of these constants
+ * are initialized from the debug metadata.
+ */
+static intptr_t V8_FirstNonstringType;
+static intptr_t V8_IsNotStringMask;
+static intptr_t V8_StringTag;
+static intptr_t V8_NotStringTag;
+static intptr_t V8_StringEncodingMask;
+static intptr_t V8_TwoByteStringTag;
+static intptr_t V8_AsciiStringTag;
+static intptr_t V8_StringRepresentationMask;
+static intptr_t V8_SeqStringTag;
+static intptr_t V8_ConsStringTag;
+static intptr_t V8_ExternalStringTag;
+static intptr_t V8_FailureTag;
+static intptr_t V8_FailureTagMask;
+static intptr_t V8_HeapObjectTag;
+static intptr_t V8_HeapObjectTagMask;
+static intptr_t V8_SmiTag;
+static intptr_t V8_SmiTagMask;
+static intptr_t V8_SmiValueShift;
+static intptr_t V8_PointerSizeLog2;
+
+static intptr_t V8_ISSHARED_SHIFT;
+static intptr_t V8_DICT_SHIFT;
+static intptr_t V8_DICT_PREFIX_SIZE;
+static intptr_t V8_DICT_ENTRY_SIZE;
+static intptr_t V8_DICT_START_INDEX;
+static intptr_t V8_PROP_IDX_CONTENT;
+static intptr_t V8_PROP_IDX_FIRST;
+static intptr_t V8_PROP_TYPE_FIELD;
+static intptr_t V8_PROP_FIRST_PHANTOM;
+static intptr_t V8_PROP_TYPE_MASK;
+static intptr_t V8_PROP_DESC_KEY;
+static intptr_t V8_PROP_DESC_DETAILS;
+static intptr_t V8_PROP_DESC_VALUE;
+static intptr_t V8_PROP_DESC_SIZE;
+static intptr_t V8_TRANSITIONS_IDX_DESC;
+
+static intptr_t V8_TYPE_JSOBJECT = -1;
+static intptr_t V8_TYPE_JSARRAY = -1;
+static intptr_t V8_TYPE_FIXEDARRAY = -1;
+
+/*
+ * Although we have this information in v8_classes, the following offsets are
+ * defined explicitly because they're used directly in code below.
+ */
+static ssize_t V8_OFF_CODE_INSTRUCTION_SIZE;
+static ssize_t V8_OFF_CODE_INSTRUCTION_START;
+static ssize_t V8_OFF_CONSSTRING_FIRST;
+static ssize_t V8_OFF_CONSSTRING_SECOND;
+static ssize_t V8_OFF_EXTERNALSTRING_RESOURCE;
+static ssize_t V8_OFF_FIXEDARRAY_DATA;
+static ssize_t V8_OFF_FIXEDARRAY_LENGTH;
+static ssize_t V8_OFF_HEAPNUMBER_VALUE;
+static ssize_t V8_OFF_HEAPOBJECT_MAP;
+static ssize_t V8_OFF_JSARRAY_LENGTH;
+static ssize_t V8_OFF_JSDATE_VALUE;
+static ssize_t V8_OFF_JSFUNCTION_SHARED;
+static ssize_t V8_OFF_JSOBJECT_ELEMENTS;
+static ssize_t V8_OFF_JSOBJECT_PROPERTIES;
+static ssize_t V8_OFF_MAP_CONSTRUCTOR;
+static ssize_t V8_OFF_MAP_INOBJECT_PROPERTIES;
+static ssize_t V8_OFF_MAP_INSTANCE_ATTRIBUTES;
+static ssize_t V8_OFF_MAP_INSTANCE_DESCRIPTORS;
+static ssize_t V8_OFF_MAP_INSTANCE_SIZE;
+static ssize_t V8_OFF_MAP_BIT_FIELD3;
+static ssize_t V8_OFF_MAP_TRANSITIONS;
+static ssize_t V8_OFF_ODDBALL_TO_STRING;
+static ssize_t V8_OFF_SCRIPT_LINE_ENDS;
+static ssize_t V8_OFF_SCRIPT_NAME;
+static ssize_t V8_OFF_SEQASCIISTR_CHARS;
+static ssize_t V8_OFF_SEQONEBYTESTR_CHARS;
+static ssize_t V8_OFF_SHAREDFUNCTIONINFO_CODE;
+static ssize_t V8_OFF_SHAREDFUNCTIONINFO_FUNCTION_TOKEN_POSITION;
+static ssize_t V8_OFF_SHAREDFUNCTIONINFO_INFERRED_NAME;
+static ssize_t V8_OFF_SHAREDFUNCTIONINFO_LENGTH;
+static ssize_t V8_OFF_SHAREDFUNCTIONINFO_SCRIPT;
+static ssize_t V8_OFF_SHAREDFUNCTIONINFO_NAME;
+static ssize_t V8_OFF_STRING_LENGTH;
+
+#define NODE_OFF_EXTSTR_DATA 0x4 /* see node_string.h */
+
+#define V8_CONSTANT_OPTIONAL 1
+#define V8_CONSTANT_HASFALLBACK 2
+
+#define V8_CONSTANT_MAJORSHIFT 3
+#define V8_CONSTANT_MAJORMASK ((1 << 4) - 1)
+#define V8_CONSTANT_MAJOR(flags) \
+ (((flags) >> V8_CONSTANT_MAJORSHIFT) & V8_CONSTANT_MAJORMASK)
+
+#define V8_CONSTANT_MINORSHIFT 7
+#define V8_CONSTANT_MINORMASK ((1 << 9) - 1)
+#define V8_CONSTANT_MINOR(flags) \
+ (((flags) >> V8_CONSTANT_MINORSHIFT) & V8_CONSTANT_MINORMASK)
+
+#define V8_CONSTANT_FALLBACK(maj, min) \
+ (V8_CONSTANT_OPTIONAL | V8_CONSTANT_HASFALLBACK | \
+ ((maj) << V8_CONSTANT_MAJORSHIFT) | ((min) << V8_CONSTANT_MINORSHIFT))
+
+/*
+ * Table of constants used directly by this file.
+ */
+typedef struct v8_constant {
+ intptr_t *v8c_valp;
+ const char *v8c_symbol;
+ uint32_t v8c_flags;
+ intptr_t v8c_fallback;
+} v8_constant_t;
+
+static v8_constant_t v8_constants[] = {
+ { &V8_OFF_FP_CONTEXT, "v8dbg_off_fp_context" },
+ { &V8_OFF_FP_FUNCTION, "v8dbg_off_fp_function" },
+ { &V8_OFF_FP_MARKER, "v8dbg_off_fp_marker" },
+ { &V8_OFF_FP_ARGS, "v8dbg_off_fp_args" },
+
+ { &V8_FirstNonstringType, "v8dbg_FirstNonstringType" },
+ { &V8_IsNotStringMask, "v8dbg_IsNotStringMask" },
+ { &V8_StringTag, "v8dbg_StringTag" },
+ { &V8_NotStringTag, "v8dbg_NotStringTag" },
+ { &V8_StringEncodingMask, "v8dbg_StringEncodingMask" },
+ { &V8_TwoByteStringTag, "v8dbg_TwoByteStringTag" },
+ { &V8_AsciiStringTag, "v8dbg_AsciiStringTag" },
+ { &V8_StringRepresentationMask, "v8dbg_StringRepresentationMask" },
+ { &V8_SeqStringTag, "v8dbg_SeqStringTag" },
+ { &V8_ConsStringTag, "v8dbg_ConsStringTag" },
+ { &V8_ExternalStringTag, "v8dbg_ExternalStringTag" },
+ { &V8_FailureTag, "v8dbg_FailureTag" },
+ { &V8_FailureTagMask, "v8dbg_FailureTagMask" },
+ { &V8_HeapObjectTag, "v8dbg_HeapObjectTag" },
+ { &V8_HeapObjectTagMask, "v8dbg_HeapObjectTagMask" },
+ { &V8_SmiTag, "v8dbg_SmiTag" },
+ { &V8_SmiTagMask, "v8dbg_SmiTagMask" },
+ { &V8_SmiValueShift, "v8dbg_SmiValueShift" },
+ { &V8_PointerSizeLog2, "v8dbg_PointerSizeLog2" },
+
+ { &V8_DICT_SHIFT, "v8dbg_dict_shift",
+ V8_CONSTANT_FALLBACK(3, 13), 24 },
+ { &V8_DICT_PREFIX_SIZE, "v8dbg_dict_prefix_size",
+ V8_CONSTANT_FALLBACK(3, 11), 2 },
+ { &V8_DICT_ENTRY_SIZE, "v8dbg_dict_entry_size",
+ V8_CONSTANT_FALLBACK(3, 11), 3 },
+ { &V8_DICT_START_INDEX, "v8dbg_dict_start_index",
+ V8_CONSTANT_FALLBACK(3, 11), 3 },
+ { &V8_ISSHARED_SHIFT, "v8dbg_isshared_shift",
+ V8_CONSTANT_FALLBACK(3, 11), 0 },
+ { &V8_PROP_IDX_FIRST, "v8dbg_prop_idx_first" },
+ { &V8_PROP_TYPE_FIELD, "v8dbg_prop_type_field" },
+ { &V8_PROP_FIRST_PHANTOM, "v8dbg_prop_type_first_phantom" },
+ { &V8_PROP_TYPE_MASK, "v8dbg_prop_type_mask" },
+ { &V8_PROP_IDX_CONTENT, "v8dbg_prop_idx_content",
+ V8_CONSTANT_OPTIONAL },
+ { &V8_PROP_DESC_KEY, "v8dbg_prop_desc_key",
+ V8_CONSTANT_FALLBACK(0, 0), 0 },
+ { &V8_PROP_DESC_DETAILS, "v8dbg_prop_desc_details",
+ V8_CONSTANT_FALLBACK(0, 0), 1 },
+ { &V8_PROP_DESC_VALUE, "v8dbg_prop_desc_value",
+ V8_CONSTANT_FALLBACK(0, 0), 2 },
+ { &V8_PROP_DESC_SIZE, "v8dbg_prop_desc_size",
+ V8_CONSTANT_FALLBACK(0, 0), 3 },
+ { &V8_TRANSITIONS_IDX_DESC, "v8dbg_transitions_idx_descriptors",
+ V8_CONSTANT_OPTIONAL },
+};
+
+static int v8_nconstants = sizeof (v8_constants) / sizeof (v8_constants[0]);
+
+typedef struct v8_offset {
+ ssize_t *v8o_valp;
+ const char *v8o_class;
+ const char *v8o_member;
+ boolean_t v8o_optional;
+} v8_offset_t;
+
+static v8_offset_t v8_offsets[] = {
+ { &V8_OFF_CODE_INSTRUCTION_SIZE,
+ "Code", "instruction_size" },
+ { &V8_OFF_CODE_INSTRUCTION_START,
+ "Code", "instruction_start" },
+ { &V8_OFF_CONSSTRING_FIRST,
+ "ConsString", "first" },
+ { &V8_OFF_CONSSTRING_SECOND,
+ "ConsString", "second" },
+ { &V8_OFF_EXTERNALSTRING_RESOURCE,
+ "ExternalString", "resource" },
+ { &V8_OFF_FIXEDARRAY_DATA,
+ "FixedArray", "data" },
+ { &V8_OFF_FIXEDARRAY_LENGTH,
+ "FixedArray", "length" },
+ { &V8_OFF_HEAPNUMBER_VALUE,
+ "HeapNumber", "value" },
+ { &V8_OFF_HEAPOBJECT_MAP,
+ "HeapObject", "map" },
+ { &V8_OFF_JSARRAY_LENGTH,
+ "JSArray", "length" },
+ { &V8_OFF_JSDATE_VALUE,
+ "JSDate", "value", B_TRUE },
+ { &V8_OFF_JSFUNCTION_SHARED,
+ "JSFunction", "shared" },
+ { &V8_OFF_JSOBJECT_ELEMENTS,
+ "JSObject", "elements" },
+ { &V8_OFF_JSOBJECT_PROPERTIES,
+ "JSObject", "properties" },
+ { &V8_OFF_MAP_CONSTRUCTOR,
+ "Map", "constructor" },
+ { &V8_OFF_MAP_INOBJECT_PROPERTIES,
+ "Map", "inobject_properties" },
+ { &V8_OFF_MAP_INSTANCE_ATTRIBUTES,
+ "Map", "instance_attributes" },
+ { &V8_OFF_MAP_INSTANCE_DESCRIPTORS,
+ "Map", "instance_descriptors", B_TRUE },
+ { &V8_OFF_MAP_TRANSITIONS,
+ "Map", "transitions", B_TRUE },
+ { &V8_OFF_MAP_INSTANCE_SIZE,
+ "Map", "instance_size" },
+ { &V8_OFF_MAP_BIT_FIELD3,
+ "Map", "bit_field3", B_TRUE },
+ { &V8_OFF_ODDBALL_TO_STRING,
+ "Oddball", "to_string" },
+ { &V8_OFF_SCRIPT_LINE_ENDS,
+ "Script", "line_ends" },
+ { &V8_OFF_SCRIPT_NAME,
+ "Script", "name" },
+ { &V8_OFF_SEQASCIISTR_CHARS,
+ "SeqAsciiString", "chars", B_TRUE },
+ { &V8_OFF_SEQONEBYTESTR_CHARS,
+ "SeqOneByteString", "chars", B_TRUE },
+ { &V8_OFF_SHAREDFUNCTIONINFO_CODE,
+ "SharedFunctionInfo", "code" },
+ { &V8_OFF_SHAREDFUNCTIONINFO_FUNCTION_TOKEN_POSITION,
+ "SharedFunctionInfo", "function_token_position" },
+ { &V8_OFF_SHAREDFUNCTIONINFO_INFERRED_NAME,
+ "SharedFunctionInfo", "inferred_name" },
+ { &V8_OFF_SHAREDFUNCTIONINFO_LENGTH,
+ "SharedFunctionInfo", "length" },
+ { &V8_OFF_SHAREDFUNCTIONINFO_NAME,
+ "SharedFunctionInfo", "name" },
+ { &V8_OFF_SHAREDFUNCTIONINFO_SCRIPT,
+ "SharedFunctionInfo", "script" },
+ { &V8_OFF_STRING_LENGTH,
+ "String", "length" },
+};
+
+static int v8_noffsets = sizeof (v8_offsets) / sizeof (v8_offsets[0]);
+
+static uintptr_t v8_major;
+static uintptr_t v8_minor;
+static uintptr_t v8_build;
+static uintptr_t v8_patch;
+
+static int autoconf_iter_symbol(mdb_symbol_t *, void *);
+static v8_class_t *conf_class_findcreate(const char *);
+static v8_field_t *conf_field_create(v8_class_t *, const char *, size_t);
+static char *conf_next_part(char *, char *);
+static int conf_update_parent(const char *);
+static int conf_update_field(v8_cfg_t *, const char *);
+static int conf_update_enum(v8_cfg_t *, const char *, const char *,
+ v8_enum_t *);
+static int conf_update_type(v8_cfg_t *, const char *);
+static int conf_update_frametype(v8_cfg_t *, const char *);
+static void conf_class_compute_offsets(v8_class_t *);
+
+static int read_typebyte(uint8_t *, uintptr_t);
+static int heap_offset(const char *, const char *, ssize_t *);
+
+/*
+ * Invoked when this dmod is initially loaded to load the set of classes, enums,
+ * and other constants from the metadata in the target binary.
+ */
+static int
+autoconfigure(v8_cfg_t *cfgp)
+{
+ v8_class_t *clp;
+ v8_enum_t *ep;
+ struct v8_constant *cnp;
+ int ii;
+ int failed = 0;
+
+ assert(v8_classes == NULL);
+
+ /*
+ * Iterate all global symbols looking for metadata.
+ */
+ if (cfgp->v8cfg_iter(cfgp, autoconf_iter_symbol, cfgp) != 0) {
+ mdb_warn("failed to autoconfigure V8 support\n");
+ return (-1);
+ }
+
+ /*
+ * By now we've configured all of the classes so we can update the
+ * "start" and "end" fields in each class with information from its
+ * parent class.
+ */
+ for (clp = v8_classes; clp != NULL; clp = clp->v8c_next) {
+ if (clp->v8c_end != (size_t)-1)
+ continue;
+
+ conf_class_compute_offsets(clp);
+ };
+
+ /*
+ * Load various constants used directly in the module.
+ */
+ for (ii = 0; ii < v8_nconstants; ii++) {
+ cnp = &v8_constants[ii];
+
+ if (cfgp->v8cfg_readsym(cfgp,
+ cnp->v8c_symbol, cnp->v8c_valp) != -1) {
+ continue;
+ }
+
+ if (!(cnp->v8c_flags & V8_CONSTANT_OPTIONAL)) {
+ mdb_warn("failed to read \"%s\"", cnp->v8c_symbol);
+ failed++;
+ continue;
+ }
+
+ if (!(cnp->v8c_flags & V8_CONSTANT_HASFALLBACK) ||
+ v8_major < V8_CONSTANT_MAJOR(cnp->v8c_flags) ||
+ (v8_major == V8_CONSTANT_MAJOR(cnp->v8c_flags) &&
+ v8_minor < V8_CONSTANT_MINOR(cnp->v8c_flags))) {
+ *cnp->v8c_valp = -1;
+ continue;
+ }
+
+ /*
+ * We have a fallback -- and we know that the version satisfies
+ * the fallback's version constraints; use the fallback value.
+ */
+ *cnp->v8c_valp = cnp->v8c_fallback;
+ }
+
+ /*
+ * Load type values for well-known classes that we use a lot.
+ */
+ for (ep = v8_types; ep->v8e_name[0] != '\0'; ep++) {
+ if (strcmp(ep->v8e_name, "JSObject") == 0)
+ V8_TYPE_JSOBJECT = ep->v8e_value;
+
+ if (strcmp(ep->v8e_name, "JSArray") == 0)
+ V8_TYPE_JSARRAY = ep->v8e_value;
+
+ if (strcmp(ep->v8e_name, "FixedArray") == 0)
+ V8_TYPE_FIXEDARRAY = ep->v8e_value;
+ }
+
+ if (V8_TYPE_JSOBJECT == -1) {
+ mdb_warn("couldn't find JSObject type\n");
+ failed++;
+ }
+
+ if (V8_TYPE_JSARRAY == -1) {
+ mdb_warn("couldn't find JSArray type\n");
+ failed++;
+ }
+
+ if (V8_TYPE_FIXEDARRAY == -1) {
+ mdb_warn("couldn't find FixedArray type\n");
+ failed++;
+ }
+
+ /*
+ * Finally, load various class offsets.
+ */
+ for (ii = 0; ii < v8_noffsets; ii++) {
+ struct v8_offset *offp = &v8_offsets[ii];
+ const char *klass = offp->v8o_class;
+
+again:
+ if (heap_offset(klass, offp->v8o_member, offp->v8o_valp) == 0)
+ continue;
+
+ if (strcmp(klass, "FixedArray") == 0) {
+ /*
+ * The V8 included in node v0.6 uses a FixedArrayBase
+ * class to contain the "length" field, while the one
+ * in v0.4 has no such base class and stores the field
+ * directly in FixedArray; if we failed to derive
+ * the offset from FixedArray, try FixedArrayBase.
+ */
+ klass = "FixedArrayBase";
+ goto again;
+ }
+
+ if (offp->v8o_optional) {
+ *offp->v8o_valp = -1;
+ continue;
+ }
+
+ mdb_warn("couldn't find class \"%s\", field \"%s\"\n",
+ offp->v8o_class, offp->v8o_member);
+ failed++;
+ }
+
+ if (!((V8_OFF_SEQASCIISTR_CHARS != -1) ^
+ (V8_OFF_SEQONEBYTESTR_CHARS != -1))) {
+ mdb_warn("expected exactly one of SeqAsciiString and "
+ "SeqOneByteString to be defined\n");
+ failed++;
+ }
+
+ if (V8_OFF_SEQONEBYTESTR_CHARS != -1)
+ V8_OFF_SEQASCIISTR_CHARS = V8_OFF_SEQONEBYTESTR_CHARS;
+
+ return (failed ? -1 : 0);
+}
+
+/* ARGSUSED */
+static int
+autoconf_iter_symbol(mdb_symbol_t *symp, void *arg)
+{
+ v8_cfg_t *cfgp = arg;
+
+ if (strncmp(symp->sym_name, "v8dbg_parent_",
+ sizeof ("v8dbg_parent_") - 1) == 0)
+ return (conf_update_parent(symp->sym_name));
+
+ if (strncmp(symp->sym_name, "v8dbg_class_",
+ sizeof ("v8dbg_class_") - 1) == 0)
+ return (conf_update_field(cfgp, symp->sym_name));
+
+ if (strncmp(symp->sym_name, "v8dbg_type_",
+ sizeof ("v8dbg_type_") - 1) == 0)
+ return (conf_update_type(cfgp, symp->sym_name));
+
+ if (strncmp(symp->sym_name, "v8dbg_frametype_",
+ sizeof ("v8dbg_frametype_") - 1) == 0)
+ return (conf_update_frametype(cfgp, symp->sym_name));
+
+ return (0);
+}
+
+/*
+ * Extracts the next field of a string whose fields are separated by "__" (as
+ * the V8 metadata symbols are).
+ */
+static char *
+conf_next_part(char *buf, char *start)
+{
+ char *pp;
+
+ if ((pp = strstr(start, "__")) == NULL) {
+ mdb_warn("malformed symbol name: %s\n", buf);
+ return (NULL);
+ }
+
+ *pp = '\0';
+ return (pp + sizeof ("__") - 1);
+}
+
+static v8_class_t *
+conf_class_findcreate(const char *name)
+{
+ v8_class_t *clp, *iclp, *prev = NULL;
+ int cmp;
+
+ for (iclp = v8_classes; iclp != NULL; iclp = iclp->v8c_next) {
+ if ((cmp = strcmp(iclp->v8c_name, name)) == 0)
+ return (iclp);
+
+ if (cmp > 0)
+ break;
+
+ prev = iclp;
+ }
+
+ if ((clp = mdb_zalloc(sizeof (*clp), UM_NOSLEEP)) == NULL)
+ return (NULL);
+
+ (void) strlcpy(clp->v8c_name, name, sizeof (clp->v8c_name));
+ clp->v8c_end = (size_t)-1;
+ clp->v8c_next = iclp;
+
+ if (prev != NULL) {
+ prev->v8c_next = clp;
+ } else {
+ v8_classes = clp;
+ }
+
+ return (clp);
+}
+
+static v8_field_t *
+conf_field_create(v8_class_t *clp, const char *name, size_t offset)
+{
+ v8_field_t *flp, *iflp;
+
+ if ((flp = mdb_zalloc(sizeof (*flp), UM_NOSLEEP)) == NULL)
+ return (NULL);
+
+ (void) strlcpy(flp->v8f_name, name, sizeof (flp->v8f_name));
+ flp->v8f_offset = offset;
+
+ if (clp->v8c_fields == NULL || clp->v8c_fields->v8f_offset > offset) {
+ flp->v8f_next = clp->v8c_fields;
+ clp->v8c_fields = flp;
+ return (flp);
+ }
+
+ for (iflp = clp->v8c_fields; iflp->v8f_next != NULL;
+ iflp = iflp->v8f_next) {
+ if (iflp->v8f_next->v8f_offset > offset)
+ break;
+ }
+
+ flp->v8f_next = iflp->v8f_next;
+ iflp->v8f_next = flp;
+ return (flp);
+}
+
+/*
+ * Given a "v8dbg_parent_X__Y", symbol, update the parent of class X to class Y.
+ * Note that neither class necessarily exists already.
+ */
+static int
+conf_update_parent(const char *symbol)
+{
+ char *pp, *qq;
+ char buf[128];
+ v8_class_t *clp, *pclp;
+
+ (void) strlcpy(buf, symbol, sizeof (buf));
+ pp = buf + sizeof ("v8dbg_parent_") - 1;
+ qq = conf_next_part(buf, pp);
+
+ if (qq == NULL)
+ return (-1);
+
+ clp = conf_class_findcreate(pp);
+ pclp = conf_class_findcreate(qq);
+
+ if (clp == NULL || pclp == NULL) {
+ mdb_warn("mdb_v8: out of memory\n");
+ return (-1);
+ }
+
+ clp->v8c_parent = pclp;
+ return (0);
+}
+
+/*
+ * Given a "v8dbg_class_CLASS__FIELD__TYPE", symbol, save field "FIELD" into
+ * class CLASS with the offset described by the symbol. Note that CLASS does
+ * not necessarily exist already.
+ */
+static int
+conf_update_field(v8_cfg_t *cfgp, const char *symbol)
+{
+ v8_class_t *clp;
+ v8_field_t *flp;
+ intptr_t offset;
+ char *pp, *qq, *tt;
+ char buf[128];
+
+ (void) strlcpy(buf, symbol, sizeof (buf));
+
+ pp = buf + sizeof ("v8dbg_class_") - 1;
+ qq = conf_next_part(buf, pp);
+
+ if (qq == NULL || (tt = conf_next_part(buf, qq)) == NULL)
+ return (-1);
+
+ if (cfgp->v8cfg_readsym(cfgp, symbol, &offset) == -1) {
+ mdb_warn("failed to read symbol \"%s\"", symbol);
+ return (-1);
+ }
+
+ if ((clp = conf_class_findcreate(pp)) == NULL ||
+ (flp = conf_field_create(clp, qq, (size_t)offset)) == NULL)
+ return (-1);
+
+ if (strcmp(tt, "int") == 0)
+ flp->v8f_isbyte = B_TRUE;
+
+ if (strcmp(tt, "char") == 0)
+ flp->v8f_isstr = B_TRUE;
+
+ return (0);
+}
+
+static int
+conf_update_enum(v8_cfg_t *cfgp, const char *symbol, const char *name,
+ v8_enum_t *enp)
+{
+ intptr_t value;
+
+ if (cfgp->v8cfg_readsym(cfgp, symbol, &value) == -1) {
+ mdb_warn("failed to read symbol \"%s\"", symbol);
+ return (-1);
+ }
+
+ enp->v8e_value = (int)value;
+ (void) strlcpy(enp->v8e_name, name, sizeof (enp->v8e_name));
+ return (0);
+}
+
+/*
+ * Given a "v8dbg_type_TYPENAME" constant, save the type name in v8_types. Note
+ * that this enum has multiple integer values with the same string label.
+ */
+static int
+conf_update_type(v8_cfg_t *cfgp, const char *symbol)
+{
+ char *klass;
+ v8_enum_t *enp;
+ char buf[128];
+
+ if (v8_next_type > sizeof (v8_types) / sizeof (v8_types[0])) {
+ mdb_warn("too many V8 types\n");
+ return (-1);
+ }
+
+ (void) strlcpy(buf, symbol, sizeof (buf));
+
+ klass = buf + sizeof ("v8dbg_type_") - 1;
+ if (conf_next_part(buf, klass) == NULL)
+ return (-1);
+
+ enp = &v8_types[v8_next_type++];
+ return (conf_update_enum(cfgp, symbol, klass, enp));
+}
+
+/*
+ * Given a "v8dbg_frametype_TYPENAME" constant, save the frame type in
+ * v8_frametypes.
+ */
+static int
+conf_update_frametype(v8_cfg_t *cfgp, const char *symbol)
+{
+ const char *frametype;
+ v8_enum_t *enp;
+
+ if (v8_next_frametype >
+ sizeof (v8_frametypes) / sizeof (v8_frametypes[0])) {
+ mdb_warn("too many V8 frame types\n");
+ return (-1);
+ }
+
+ enp = &v8_frametypes[v8_next_frametype++];
+ frametype = symbol + sizeof ("v8dbg_frametype_") - 1;
+ return (conf_update_enum(cfgp, symbol, frametype, enp));
+}
+
+/*
+ * Now that all classes have been loaded, update the "start" and "end" fields of
+ * each class based on the values of its parent class.
+ */
+static void
+conf_class_compute_offsets(v8_class_t *clp)
+{
+ v8_field_t *flp;
+
+ assert(clp->v8c_start == 0);
+ assert(clp->v8c_end == (size_t)-1);
+
+ if (clp->v8c_parent != NULL) {
+ if (clp->v8c_parent->v8c_end == (size_t)-1)
+ conf_class_compute_offsets(clp->v8c_parent);
+
+ clp->v8c_start = clp->v8c_parent->v8c_end;
+ }
+
+ if (clp->v8c_fields == NULL) {
+ clp->v8c_end = clp->v8c_start;
+ return;
+ }
+
+ for (flp = clp->v8c_fields; flp->v8f_next != NULL; flp = flp->v8f_next)
+ ;
+
+ if (flp == NULL)
+ clp->v8c_end = clp->v8c_start;
+ else
+ clp->v8c_end = flp->v8f_offset + sizeof (uintptr_t);
+}
+
+/*
+ * Utility functions
+ */
+#define JSSTR_NONE 0
+#define JSSTR_NUDE JSSTR_NONE
+#define JSSTR_VERBOSE 0x1
+#define JSSTR_QUOTED 0x2
+
+static int jsstr_print(uintptr_t, uint_t, char **, size_t *);
+static boolean_t jsobj_is_undefined(uintptr_t addr);
+
+static const char *
+enum_lookup_str(v8_enum_t *enums, int val, const char *dflt)
+{
+ v8_enum_t *ep;
+
+ for (ep = enums; ep->v8e_name[0] != '\0'; ep++) {
+ if (ep->v8e_value == val)
+ return (ep->v8e_name);
+ }
+
+ return (dflt);
+}
+
+static void
+enum_print(v8_enum_t *enums)
+{
+ v8_enum_t *itp;
+
+ for (itp = enums; itp->v8e_name[0] != '\0'; itp++)
+ mdb_printf("%-30s = 0x%02x\n", itp->v8e_name, itp->v8e_value);
+}
+
+/*
+ * b[v]snprintf behave like [v]snprintf(3c), except that they update the buffer
+ * and length arguments based on how much buffer space is used by the operation.
+ * This makes it much easier to combine multiple calls in sequence without
+ * worrying about buffer overflow.
+ */
+static size_t
+bvsnprintf(char **bufp, size_t *buflenp, const char *format, va_list alist)
+{
+ size_t rv, len;
+
+ if (*buflenp == 0)
+ return (vsnprintf(NULL, 0, format, alist));
+
+ rv = vsnprintf(*bufp, *buflenp, format, alist);
+
+ len = MIN(rv, *buflenp);
+ *buflenp -= len;
+ *bufp += len;
+
+ return (len);
+}
+
+static size_t
+bsnprintf(char **bufp, size_t *buflenp, const char *format, ...)
+{
+ va_list alist;
+ size_t rv;
+
+ va_start(alist, format);
+ rv = bvsnprintf(bufp, buflenp, format, alist);
+ va_end(alist);
+
+ return (rv);
+}
+
+static void
+v8_warn(const char *format, ...)
+{
+ char buf[512];
+ va_list alist;
+ int len;
+
+ if (v8_silent)
+ return;
+
+ va_start(alist, format);
+ (void) vsnprintf(buf, sizeof (buf), format, alist);
+ va_end(alist);
+
+ /*
+ * This is made slightly annoying because we need to effectively
+ * preserve the original format string to allow for mdb to use the
+ * new-line at the end to indicate that strerror should be elided.
+ */
+ if ((len = strlen(format)) > 0 && format[len - 1] == '\n') {
+ buf[strlen(buf) - 1] = '\0';
+ mdb_warn("%s\n", buf);
+ } else {
+ mdb_warn("%s", buf);
+ }
+}
+
+/*
+ * Returns in "offp" the offset of field "field" in C++ class "klass".
+ */
+static int
+heap_offset(const char *klass, const char *field, ssize_t *offp)
+{
+ v8_class_t *clp;
+ v8_field_t *flp;
+
+ for (clp = v8_classes; clp != NULL; clp = clp->v8c_next) {
+ if (strcmp(klass, clp->v8c_name) == 0)
+ break;
+ }
+
+ if (clp == NULL)
+ return (-1);
+
+ for (flp = clp->v8c_fields; flp != NULL; flp = flp->v8f_next) {
+ if (strcmp(field, flp->v8f_name) == 0)
+ break;
+ }
+
+ if (flp == NULL)
+ return (-1);
+
+ *offp = V8_OFF_HEAP(flp->v8f_offset);
+ return (0);
+}
+
+/*
+ * Assuming "addr" is an instance of the C++ heap class "klass", read into *valp
+ * the pointer-sized value of field "field".
+ */
+static int
+read_heap_ptr(uintptr_t *valp, uintptr_t addr, ssize_t off)
+{
+ if (mdb_vread(valp, sizeof (*valp), addr + off) == -1) {
+ v8_warn("failed to read offset %d from %p", off, addr);
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*
+ * Like read_heap_ptr, but assume the field is an SMI and store the actual value
+ * into *valp rather than the encoded representation.
+ */
+static int
+read_heap_smi(uintptr_t *valp, uintptr_t addr, ssize_t off)
+{
+ if (read_heap_ptr(valp, addr, off) != 0)
+ return (-1);
+
+ if (!V8_IS_SMI(*valp)) {
+ v8_warn("expected SMI, got %p\n", *valp);
+ return (-1);
+ }
+
+ *valp = V8_SMI_VALUE(*valp);
+
+ return (0);
+}
+
+static int
+read_heap_double(double *valp, uintptr_t addr, ssize_t off)
+{
+ if (mdb_vread(valp, sizeof (*valp), addr + off) == -1) {
+ v8_warn("failed to read heap value at %p", addr + off);
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*
+ * Assuming "addr" refers to a FixedArray, return a newly-allocated array
+ * representing its contents.
+ */
+static int
+read_heap_array(uintptr_t addr, uintptr_t **retp, size_t *lenp, int flags)
+{
+ uint8_t type;
+ uintptr_t len;
+
+ if (!V8_IS_HEAPOBJECT(addr))
+ return (-1);
+
+ if (read_typebyte(&type, addr) != 0)
+ return (-1);
+
+ if (type != V8_TYPE_FIXEDARRAY)
+ return (-1);
+
+ if (read_heap_smi(&len, addr, V8_OFF_FIXEDARRAY_LENGTH) != 0)
+ return (-1);
+
+ *lenp = len;
+
+ if (len == 0) {
+ *retp = NULL;
+ return (0);
+ }
+
+ if ((*retp = mdb_zalloc(len * sizeof (uintptr_t), flags)) == NULL)
+ return (-1);
+
+ if (mdb_vread(*retp, len * sizeof (uintptr_t),
+ addr + V8_OFF_FIXEDARRAY_DATA) == -1) {
+ if (!(flags & UM_GC))
+ mdb_free(*retp, len * sizeof (uintptr_t));
+
+ return (-1);
+ }
+
+ return (0);
+}
+
+static int
+read_heap_byte(uint8_t *valp, uintptr_t addr, ssize_t off)
+{
+ if (mdb_vread(valp, sizeof (*valp), addr + off) == -1) {
+ v8_warn("failed to read heap value at %p", addr + off);
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*
+ * Given a heap object, returns in *valp the byte describing the type of the
+ * object. This is shorthand for first retrieving the Map at the start of the
+ * heap object and then retrieving the type byte from the Map object.
+ */
+static int
+read_typebyte(uint8_t *valp, uintptr_t addr)
+{
+ uintptr_t mapaddr;
+ ssize_t off = V8_OFF_HEAPOBJECT_MAP;
+
+ if (mdb_vread(&mapaddr, sizeof (mapaddr), addr + off) == -1) {
+ v8_warn("failed to read type of %p", addr);
+ return (-1);
+ }
+
+ if (!V8_IS_HEAPOBJECT(mapaddr)) {
+ v8_warn("object map is not a heap object\n");
+ return (-1);
+ }
+
+ if (read_heap_byte(valp, mapaddr, V8_OFF_MAP_INSTANCE_ATTRIBUTES) == -1)
+ return (-1);
+
+ return (0);
+}
+
+/*
+ * Given a heap object, returns in *valp the size of the object. For
+ * variable-size objects, returns an undefined value.
+ */
+static int
+read_size(size_t *valp, uintptr_t addr)
+{
+ uintptr_t mapaddr;
+ uint8_t size;
+
+ if (read_heap_ptr(&mapaddr, addr, V8_OFF_HEAPOBJECT_MAP) != 0)
+ return (-1);
+
+ if (!V8_IS_HEAPOBJECT(mapaddr)) {
+ v8_warn("heap object map is not itself a heap object\n");
+ return (-1);
+ }
+
+ if (read_heap_byte(&size, mapaddr, V8_OFF_MAP_INSTANCE_SIZE) != 0)
+ return (-1);
+
+ *valp = size << V8_PointerSizeLog2;
+ return (0);
+}
+
+/*
+ * Assuming "addr" refers to a FixedArray that is implementing a
+ * StringDictionary, iterate over its contents calling the specified function
+ * with key and value.
+ */
+static int
+read_heap_dict(uintptr_t addr,
+ int (*func)(const char *, uintptr_t, void *), void *arg)
+{
+ uint8_t type;
+ uintptr_t len;
+ char buf[512];
+ char *bufp;
+ int rval = -1;
+ uintptr_t *dict, ndict, i;
+ const char *typename;
+
+ if (read_heap_array(addr, &dict, &ndict, UM_SLEEP) != 0)
+ return (-1);
+
+ if (V8_DICT_ENTRY_SIZE < 2) {
+ v8_warn("dictionary entry size (%d) is too small for a "
+ "key and value\n", V8_DICT_ENTRY_SIZE);
+ goto out;
+ }
+
+ for (i = V8_DICT_START_INDEX + V8_DICT_PREFIX_SIZE; i < ndict;
+ i += V8_DICT_ENTRY_SIZE) {
+ /*
+ * The layout here is key, value, details. (This is hardcoded
+ * in Dictionary<Shape, Key>::SetEntry().)
+ */
+ if (jsobj_is_undefined(dict[i]))
+ continue;
+
+ if (read_typebyte(&type, dict[i]) != 0)
+ goto out;
+
+ typename = enum_lookup_str(v8_types, type, NULL);
+
+ if (typename != NULL && strcmp(typename, "Oddball") == 0) {
+ /*
+ * In some cases, the key can (apparently) be a hole;
+ * assume that any Oddball in the key field falls into
+ * this case and skip over it.
+ */
+ continue;
+ }
+
+ if (!V8_TYPE_STRING(type))
+ goto out;
+
+ bufp = buf;
+ len = sizeof (buf);
+
+ if (jsstr_print(dict[i], JSSTR_NUDE, &bufp, &len) != 0)
+ goto out;
+
+ if (func(buf, dict[i + 1], arg) == -1)
+ goto out;
+ }
+
+ rval = 0;
+out:
+ mdb_free(dict, ndict * sizeof (uintptr_t));
+
+ return (rval);
+}
+
+/*
+ * Returns in "buf" a description of the type of "addr" suitable for printing.
+ */
+static int
+obj_jstype(uintptr_t addr, char **bufp, size_t *lenp, uint8_t *typep)
+{
+ uint8_t typebyte;
+ uintptr_t strptr;
+ const char *typename;
+
+ if (V8_IS_FAILURE(addr)) {
+ if (typep)
+ *typep = 0;
+ (void) bsnprintf(bufp, lenp, "'Failure' object");
+ return (0);
+ }
+
+ if (V8_IS_SMI(addr)) {
+ if (typep)
+ *typep = 0;
+ (void) bsnprintf(bufp, lenp, "SMI: value = %d",
+ V8_SMI_VALUE(addr));
+ return (0);
+ }
+
+ if (read_typebyte(&typebyte, addr) != 0)
+ return (-1);
+
+ if (typep)
+ *typep = typebyte;
+
+ typename = enum_lookup_str(v8_types, typebyte, "<unknown>");
+ (void) bsnprintf(bufp, lenp, typename);
+
+ if (strcmp(typename, "Oddball") == 0) {
+ if (read_heap_ptr(&strptr, addr,
+ V8_OFF_ODDBALL_TO_STRING) != -1) {
+ (void) bsnprintf(bufp, lenp, ": \"");
+ (void) jsstr_print(strptr, JSSTR_NUDE, bufp, lenp);
+ (void) bsnprintf(bufp, lenp, "\"");
+ }
+ }
+
+ return (0);
+}
+
+/*
+ * Print out the fields of the given object that come from the given class.
+ */
+static int
+obj_print_fields(uintptr_t baddr, v8_class_t *clp)
+{
+ v8_field_t *flp;
+ uintptr_t addr, value;
+ int rv;
+ char *bufp;
+ size_t len;
+ uint8_t type;
+ char buf[256];
+
+ for (flp = clp->v8c_fields; flp != NULL; flp = flp->v8f_next) {
+ bufp = buf;
+ len = sizeof (buf);
+
+ addr = baddr + V8_OFF_HEAP(flp->v8f_offset);
+
+ if (flp->v8f_isstr) {
+ if (mdb_readstr(buf, sizeof (buf), addr) == -1) {
+ mdb_printf("%p %s (unreadable)\n",
+ addr, flp->v8f_name);
+ continue;
+ }
+
+ mdb_printf("%p %s = \"%s\"\n",
+ addr, flp->v8f_name, buf);
+ continue;
+ }
+
+ if (flp->v8f_isbyte) {
+ uint8_t sv;
+ if (mdb_vread(&sv, sizeof (sv), addr) == -1) {
+ mdb_printf("%p %s (unreadable)\n",
+ addr, flp->v8f_name);
+ continue;
+ }
+
+ mdb_printf("%p %s = 0x%x\n", addr, flp->v8f_name, sv);
+ continue;
+ }
+
+ rv = mdb_vread((void *)&value, sizeof (value), addr);
+
+ if (rv != sizeof (value) ||
+ obj_jstype(value, &bufp, &len, &type) != 0) {
+ mdb_printf("%p %s (unreadable)\n", addr, flp->v8f_name);
+ continue;
+ }
+
+ if (type != 0 && V8_TYPE_STRING(type)) {
+ (void) bsnprintf(&bufp, &len, ": ");
+ (void) jsstr_print(value, JSSTR_QUOTED, &bufp, &len);
+ }
+
+ mdb_printf("%p %s = %p (%s)\n", addr, flp->v8f_name, value,
+ buf);
+ }
+
+ return (DCMD_OK);
+}
+
+/*
+ * Print out all fields of the given object, starting with the root of the class
+ * hierarchy and working down the most specific type.
+ */
+static int
+obj_print_class(uintptr_t addr, v8_class_t *clp)
+{
+ int rv = 0;
+
+ /*
+ * If we have no fields, we just print a simple inheritance hierarchy.
+ * If we have fields but our parent doesn't, our header includes the
+ * inheritance hierarchy.
+ */
+ if (clp->v8c_end == 0) {
+ mdb_printf("%s ", clp->v8c_name);
+
+ if (clp->v8c_parent != NULL) {
+ mdb_printf("< ");
+ (void) obj_print_class(addr, clp->v8c_parent);
+ }
+
+ return (0);
+ }
+
+ mdb_printf("%p %s", addr, clp->v8c_name);
+
+ if (clp->v8c_start == 0 && clp->v8c_parent != NULL) {
+ mdb_printf(" < ");
+ (void) obj_print_class(addr, clp->v8c_parent);
+ }
+
+ mdb_printf(" {\n");
+ (void) mdb_inc_indent(4);
+
+ if (clp->v8c_start > 0 && clp->v8c_parent != NULL)
+ rv = obj_print_class(addr, clp->v8c_parent);
+
+ rv |= obj_print_fields(addr, clp);
+ (void) mdb_dec_indent(4);
+ mdb_printf("}\n");
+
+ return (rv);
+}
+
+/*
+ * Print the ASCII string for the given ASCII JS string, expanding ConsStrings
+ * and ExternalStrings as needed.
+ */
+static int jsstr_print_seq(uintptr_t, uint_t, char **, size_t *);
+static int jsstr_print_cons(uintptr_t, uint_t, char **, size_t *);
+static int jsstr_print_external(uintptr_t, uint_t, char **, size_t *);
+
+static int
+jsstr_print(uintptr_t addr, uint_t flags, char **bufp, size_t *lenp)
+{
+ uint8_t typebyte;
+ int err = 0;
+ char *lbufp;
+ size_t llen;
+ char buf[64];
+ boolean_t verbose = flags & JSSTR_VERBOSE ? B_TRUE : B_FALSE;
+
+ if (read_typebyte(&typebyte, addr) != 0)
+ return (0);
+
+ if (!V8_TYPE_STRING(typebyte)) {
+ (void) bsnprintf(bufp, lenp, "<not a string>");
+ return (0);
+ }
+
+ if (!V8_STRENC_ASCII(typebyte)) {
+ (void) bsnprintf(bufp, lenp, "<two-byte string>");
+ return (0);
+ }
+
+ if (verbose) {
+ lbufp = buf;
+ llen = sizeof (buf);
+ (void) obj_jstype(addr, &lbufp, &llen, NULL);
+ mdb_printf("%s\n", buf);
+ (void) mdb_inc_indent(4);
+ }
+
+ if (V8_STRREP_SEQ(typebyte))
+ err = jsstr_print_seq(addr, flags, bufp, lenp);
+ else if (V8_STRREP_CONS(typebyte))
+ err = jsstr_print_cons(addr, flags, bufp, lenp);
+ else if (V8_STRREP_EXT(typebyte))
+ err = jsstr_print_external(addr, flags, bufp, lenp);
+ else {
+ (void) bsnprintf(bufp, lenp, "<unknown string type>");
+ err = -1;
+ }
+
+ if (verbose)
+ (void) mdb_dec_indent(4);
+
+ return (err);
+}
+
+static int
+jsstr_print_seq(uintptr_t addr, uint_t flags, char **bufp, size_t *lenp)
+{
+ /*
+ * To allow the caller to allocate a very large buffer for strings,
+ * we'll allocate a buffer sized based on our input, making it at
+ * least enough space for our ellipsis and at most 256K.
+ */
+ uintptr_t len, rlen, blen = *lenp + sizeof ("[...]") + 1;
+ char *buf = alloca(MIN(blen, 256 * 1024));
+ boolean_t verbose = flags & JSSTR_VERBOSE ? B_TRUE : B_FALSE;
+ boolean_t quoted = flags & JSSTR_QUOTED ? B_TRUE : B_FALSE;
+
+ if (read_heap_smi(&len, addr, V8_OFF_STRING_LENGTH) != 0)
+ return (-1);
+
+ rlen = len <= blen - 1 ? len : blen - sizeof ("[...]");
+
+ if (verbose)
+ mdb_printf("length: %d, will read: %d\n", len, rlen);
+
+ buf[0] = '\0';
+
+ if (rlen > 0 && mdb_readstr(buf, rlen + 1,
+ addr + V8_OFF_SEQASCIISTR_CHARS) == -1) {
+ v8_warn("failed to read SeqString data");
+ return (-1);
+ }
+
+ if (rlen != len)
+ (void) strlcat(buf, "[...]", blen);
+
+ if (verbose)
+ mdb_printf("value: \"%s\"\n", buf);
+
+ (void) bsnprintf(bufp, lenp, "%s%s%s",
+ quoted ? "\"" : "", buf, quoted ? "\"" : "");
+
+ return (0);
+}
+
+static int
+jsstr_print_cons(uintptr_t addr, uint_t flags, char **bufp, size_t *lenp)
+{
+ boolean_t verbose = flags & JSSTR_VERBOSE ? B_TRUE : B_FALSE;
+ boolean_t quoted = flags & JSSTR_QUOTED ? B_TRUE : B_FALSE;
+ uintptr_t ptr1, ptr2;
+
+ if (read_heap_ptr(&ptr1, addr, V8_OFF_CONSSTRING_FIRST) != 0 ||
+ read_heap_ptr(&ptr2, addr, V8_OFF_CONSSTRING_SECOND) != 0)
+ return (-1);
+
+ if (verbose) {
+ mdb_printf("ptr1: %p\n", ptr1);
+ mdb_printf("ptr2: %p\n", ptr2);
+ }
+
+ if (quoted)
+ (void) bsnprintf(bufp, lenp, "\"");
+
+ if (jsstr_print(ptr1, verbose, bufp, lenp) != 0)
+ return (-1);
+
+ if (jsstr_print(ptr2, verbose, bufp, lenp) != 0)
+ return (-1);
+
+ if (quoted)
+ (void) bsnprintf(bufp, lenp, "\"");
+
+ return (0);
+}
+
+static int
+jsstr_print_external(uintptr_t addr, uint_t flags, char **bufp,
+ size_t *lenp)
+{
+ uintptr_t ptr1, ptr2;
+ size_t blen = *lenp + 1;
+ char *buf = alloca(blen);
+ boolean_t quoted = flags & JSSTR_QUOTED ? B_TRUE : B_FALSE;
+
+ if (flags & JSSTR_VERBOSE)
+ mdb_printf("assuming Node.js string\n");
+
+ if (read_heap_ptr(&ptr1, addr, V8_OFF_EXTERNALSTRING_RESOURCE) != 0)
+ return (-1);
+
+ if (mdb_vread(&ptr2, sizeof (ptr2),
+ ptr1 + NODE_OFF_EXTSTR_DATA) == -1) {
+ v8_warn("failed to read node external pointer: %p",
+ ptr1 + NODE_OFF_EXTSTR_DATA);
+ return (-1);
+ }
+
+ if (mdb_readstr(buf, blen, ptr2) == -1) {
+ v8_warn("failed to read ExternalString data");
+ return (-1);
+ }
+
+ if (buf[0] != '\0' && !isascii(buf[0])) {
+ v8_warn("failed to read ExternalString ascii data\n");
+ return (-1);
+ }
+
+ (void) bsnprintf(bufp, lenp, "%s%s%s",
+ quoted ? "\"" : "", buf, quoted ? "\"" : "");
+
+ return (0);
+}
+
+/*
+ * Returns true if the given address refers to the "undefined" object. Returns
+ * false on failure (since we shouldn't fail on the actual "undefined" value).
+ */
+static boolean_t
+jsobj_is_undefined(uintptr_t addr)
+{
+ uint8_t type;
+ uintptr_t strptr;
+ const char *typename;
+ char buf[16];
+ char *bufp = buf;
+ size_t len = sizeof (buf);
+
+ v8_silent++;
+
+ if (read_typebyte(&type, addr) != 0) {
+ v8_silent--;
+ return (B_FALSE);
+ }
+
+ v8_silent--;
+
+ typename = enum_lookup_str(v8_types, type, "<unknown>");
+ if (strcmp(typename, "Oddball") != 0)
+ return (B_FALSE);
+
+ if (read_heap_ptr(&strptr, addr, V8_OFF_ODDBALL_TO_STRING) == -1)
+ return (B_FALSE);
+
+ if (jsstr_print(strptr, JSSTR_NUDE, &bufp, &len) != 0)
+ return (B_FALSE);
+
+ return (strcmp(buf, "undefined") == 0);
+}
+
+static int
+jsobj_properties(uintptr_t addr,
+ int (*func)(const char *, uintptr_t, void *), void *arg)
+{
+ uintptr_t ptr, map;
+ uintptr_t *props = NULL, *descs = NULL, *content = NULL, *trans;
+ size_t size, nprops, ndescs, ncontent, ntrans;
+ ssize_t ii, rndescs;
+ uint8_t type, ninprops;
+ int rval = -1;
+ size_t ps = sizeof (uintptr_t);
+ ssize_t off;
+
+ /*
+ * Objects have either "fast" properties represented with a FixedArray
+ * or slow properties represented with a Dictionary.
+ */
+ if (mdb_vread(&ptr, ps, addr + V8_OFF_JSOBJECT_PROPERTIES) == -1)
+ return (-1);
+
+ if (read_typebyte(&type, ptr) != 0)
+ return (-1);
+
+ if (type != V8_TYPE_FIXEDARRAY) {
+ /*
+ * If our properties aren't a fixed array, we'll emit a member
+ * that contains the type name, but with a NULL value.
+ */
+ char buf[256];
+
+ (void) mdb_snprintf(buf, sizeof (buf), "<%s>",
+ enum_lookup_str(v8_types, type, "unknown"));
+
+ return (func(buf, NULL, arg));
+ }
+
+ /*
+ * To iterate the properties, we need to examine the instance
+ * descriptors of the associated Map object. Depending on the version
+ * of V8, this might be found directly from the map -- or indirectly
+ * via the transitions array.
+ */
+ if (mdb_vread(&map, ps, addr + V8_OFF_HEAPOBJECT_MAP) == -1)
+ goto err;
+
+ if (V8_DICT_SHIFT != -1) {
+ uintptr_t bit_field3;
+
+ if (mdb_vread(&bit_field3, sizeof (bit_field3),
+ map + V8_OFF_MAP_BIT_FIELD3) == -1)
+ goto err;
+
+ if (V8_SMI_VALUE(bit_field3) & (1 << V8_DICT_SHIFT))
+ return (read_heap_dict(ptr, func, arg));
+ } else if (V8_OFF_MAP_INSTANCE_DESCRIPTORS != -1) {
+ uintptr_t bit_field3;
+
+ if (mdb_vread(&bit_field3, sizeof (bit_field3),
+ map + V8_OFF_MAP_INSTANCE_DESCRIPTORS) == -1)
+ goto err;
+
+ if (V8_SMI_VALUE(bit_field3) == (1 << V8_ISSHARED_SHIFT)) {
+ /*
+ * On versions of V8 prior to that used in 0.10,
+ * the instance descriptors were overloaded to also
+ * be bit_field3 -- and there was no way from that
+ * field to infer a dictionary type. Because we
+ * can't determine if the map is actually the
+ * hash_table_map, we assume that if it's an object
+ * that has kIsShared set, that it is in fact a
+ * dictionary -- an assumption that is assuredly in
+ * error in some cases.
+ */
+ return (read_heap_dict(ptr, func, arg));
+ }
+ }
+
+ if (read_heap_array(ptr, &props, &nprops, UM_SLEEP) != 0)
+ goto err;
+
+ if ((off = V8_OFF_MAP_INSTANCE_DESCRIPTORS) == -1) {
+ if (V8_OFF_MAP_TRANSITIONS == -1 ||
+ V8_TRANSITIONS_IDX_DESC == -1 ||
+ V8_PROP_IDX_CONTENT != -1) {
+ mdb_warn("missing instance_descriptors, but did "
+ "not find expected transitions array metadata; "
+ "cannot read properties\n");
+ goto err;
+ }
+
+ off = V8_OFF_MAP_TRANSITIONS;
+ }
+
+ if (mdb_vread(&ptr, ps, map + off) == -1)
+ goto err;
+
+ if (V8_OFF_MAP_TRANSITIONS != -1) {
+ if (read_heap_array(ptr, &trans, &ntrans, UM_SLEEP) != 0)
+ goto err;
+
+ ptr = trans[V8_TRANSITIONS_IDX_DESC];
+ mdb_free(trans, ntrans * sizeof (uintptr_t));
+ }
+
+ if (read_heap_array(ptr, &descs, &ndescs, UM_SLEEP) != 0)
+ goto err;
+
+ if (read_size(&size, addr) != 0)
+ size = 0;
+
+ if (mdb_vread(&ninprops, 1, map + V8_OFF_MAP_INOBJECT_PROPERTIES) == -1)
+ goto err;
+
+ if (V8_PROP_IDX_CONTENT != -1 && V8_PROP_IDX_CONTENT < ndescs &&
+ read_heap_array(descs[V8_PROP_IDX_CONTENT], &content,
+ &ncontent, UM_SLEEP) != 0)
+ goto err;
+
+ if (V8_PROP_IDX_CONTENT == -1) {
+ /*
+ * On node v0.8 and later, the content is not stored in an
+ * orthogonal FixedArray, but rather with the descriptors.
+ */
+ content = descs;
+ ncontent = ndescs;
+ rndescs = ndescs > V8_PROP_IDX_FIRST ?
+ (ndescs - V8_PROP_IDX_FIRST) / V8_PROP_DESC_SIZE : 0;
+ } else {
+ rndescs = ndescs - V8_PROP_IDX_FIRST;
+ }
+
+ for (ii = 0; ii < rndescs; ii++) {
+ uintptr_t keyidx, validx, detidx, baseidx;
+ char buf[1024];
+ intptr_t val;
+ uint_t len = sizeof (buf);
+ char *c = buf;
+
+ if (V8_PROP_IDX_CONTENT != -1) {
+ /*
+ * In node versions prior to v0.8, this was hardcoded
+ * in the V8 implementation, so we hardcode it here
+ * as well.
+ */
+ keyidx = ii + V8_PROP_IDX_FIRST;
+ validx = ii << 1;
+ detidx = (ii << 1) + 1;
+ } else {
+ baseidx = V8_PROP_IDX_FIRST + (ii * V8_PROP_DESC_SIZE);
+ keyidx = baseidx + V8_PROP_DESC_KEY;
+ validx = baseidx + V8_PROP_DESC_VALUE;
+ detidx = baseidx + V8_PROP_DESC_DETAILS;
+ }
+
+ if (detidx >= ncontent) {
+ v8_warn("property descriptor %d: detidx (%d) "
+ "out of bounds for content array (length %d)\n",
+ ii, detidx, ncontent);
+ continue;
+ }
+
+ if (!V8_DESC_ISFIELD(content[detidx]))
+ continue;
+
+ if (keyidx >= ndescs) {
+ v8_warn("property descriptor %d: keyidx (%d) "
+ "out of bounds for descriptor array (length %d)\n",
+ ii, keyidx, ndescs);
+ continue;
+ }
+
+ if (jsstr_print(descs[keyidx], JSSTR_NUDE, &c, &len) != 0)
+ continue;
+
+ val = (intptr_t)content[validx];
+
+ if (!V8_IS_SMI(val)) {
+ v8_warn("object %p: property descriptor %d: value "
+ "index value is not an SMI: %p\n", addr, ii, val);
+ continue;
+ }
+
+ val = V8_SMI_VALUE(val) - ninprops;
+
+ if (val < 0) {
+ /* property is stored directly in the object */
+ if (mdb_vread(&ptr, sizeof (ptr), addr + V8_OFF_HEAP(
+ size + val * sizeof (uintptr_t))) == -1) {
+ v8_warn("failed to read in-object "
+ "property at %p\n", addr + V8_OFF_HEAP(
+ size + val * sizeof (uintptr_t)));
+ continue;
+ }
+ } else {
+ /* property should be in "props" array */
+ if (val >= nprops) {
+ v8_warn("property descriptor %d: value index "
+ "value (%d) out of bounds (%d)\n", ii, val,
+ nprops);
+ continue;
+ }
+
+ ptr = props[val];
+ }
+
+ if (func(buf, ptr, arg) != 0)
+ goto err;
+ }
+
+ rval = 0;
+err:
+ if (props != NULL)
+ mdb_free(props, nprops * sizeof (uintptr_t));
+
+ if (descs != NULL)
+ mdb_free(descs, ndescs * sizeof (uintptr_t));
+
+ if (content != NULL && V8_PROP_IDX_CONTENT != -1)
+ mdb_free(content, ncontent * sizeof (uintptr_t));
+
+ return (rval);
+}
+
+/*
+ * Given the line endings table in "lendsp", computes the line number for the
+ * given token position and print the result into "buf". If "lendsp" is
+ * undefined, prints the token position instead.
+ */
+static int
+jsfunc_lineno(uintptr_t lendsp, uintptr_t tokpos, char *buf, size_t buflen)
+{
+ uintptr_t size, bufsz, lower, upper, ii = 0;
+ uintptr_t *data;
+
+ if (jsobj_is_undefined(lendsp)) {
+ /*
+ * The token position is an SMI, but it comes in as its raw
+ * value so we can more easily compare it to values in the line
+ * endings table. If we're just printing the position directly,
+ * we must convert it here.
+ */
+ mdb_snprintf(buf, buflen, "position %d", V8_SMI_VALUE(tokpos));
+ return (0);
+ }
+
+ if (read_heap_smi(&size, lendsp, V8_OFF_FIXEDARRAY_LENGTH) != 0)
+ return (-1);
+
+ bufsz = size * sizeof (data[0]);
+
+ if ((data = mdb_alloc(bufsz, UM_NOSLEEP)) == NULL) {
+ v8_warn("failed to alloc %d bytes for FixedArray data", bufsz);
+ return (-1);
+ }
+
+ if (mdb_vread(data, bufsz, lendsp + V8_OFF_FIXEDARRAY_DATA) != bufsz) {
+ v8_warn("failed to read FixedArray data");
+ mdb_free(data, bufsz);
+ return (-1);
+ }
+
+ lower = 0;
+ upper = size - 1;
+
+ if (tokpos > data[upper]) {
+ (void) strlcpy(buf, "position out of range", buflen);
+ mdb_free(data, bufsz);
+ return (0);
+ }
+
+ if (tokpos <= data[0]) {
+ (void) strlcpy(buf, "line 1", buflen);
+ mdb_free(data, bufsz);
+ return (0);
+ }
+
+ while (upper >= 1) {
+ ii = (lower + upper) >> 1;
+ if (tokpos > data[ii])
+ lower = ii + 1;
+ else if (tokpos <= data[ii - 1])
+ upper = ii - 1;
+ else
+ break;
+ }
+
+ (void) mdb_snprintf(buf, buflen, "line %d", ii + 1);
+ mdb_free(data, bufsz);
+ return (0);
+}
+
+/*
+ * Given a SharedFunctionInfo object, prints into bufp a name of the function
+ * suitable for printing. This function attempts to infer a name for anonymous
+ * functions.
+ */
+static int
+jsfunc_name(uintptr_t funcinfop, char **bufp, size_t *lenp)
+{
+ uintptr_t ptrp;
+ char *bufs = *bufp;
+
+ if (read_heap_ptr(&ptrp, funcinfop,
+ V8_OFF_SHAREDFUNCTIONINFO_NAME) != 0 ||
+ jsstr_print(ptrp, JSSTR_NUDE, bufp, lenp) != 0)
+ return (-1);
+
+ if (*bufp != bufs)
+ return (0);
+
+ if (read_heap_ptr(&ptrp, funcinfop,
+ V8_OFF_SHAREDFUNCTIONINFO_INFERRED_NAME) != 0) {
+ (void) bsnprintf(bufp, lenp, "<anonymous>");
+ return (0);
+ }
+
+ (void) bsnprintf(bufp, lenp, "<anonymous> (as ");
+ bufs = *bufp;
+
+ if (jsstr_print(ptrp, JSSTR_NUDE, bufp, lenp) != 0)
+ return (-1);
+
+ if (*bufp == bufs)
+ (void) bsnprintf(bufp, lenp, "<anon>");
+
+ (void) bsnprintf(bufp, lenp, ")");
+
+ return (0);
+}
+
+/*
+ * JavaScript-level object printing
+ */
+typedef struct jsobj_print {
+ char **jsop_bufp;
+ size_t *jsop_lenp;
+ int jsop_indent;
+ uint64_t jsop_depth;
+ boolean_t jsop_printaddr;
+ uintptr_t jsop_baseaddr;
+ int jsop_nprops;
+ const char *jsop_member;
+ boolean_t jsop_found;
+} jsobj_print_t;
+
+static int jsobj_print_number(uintptr_t, jsobj_print_t *);
+static int jsobj_print_oddball(uintptr_t, jsobj_print_t *);
+static int jsobj_print_jsobject(uintptr_t, jsobj_print_t *);
+static int jsobj_print_jsarray(uintptr_t, jsobj_print_t *);
+static int jsobj_print_jsfunction(uintptr_t, jsobj_print_t *);
+static int jsobj_print_jsdate(uintptr_t, jsobj_print_t *);
+
+static int
+jsobj_print(uintptr_t addr, jsobj_print_t *jsop)
+{
+ uint8_t type;
+ const char *klass;
+ char **bufp = jsop->jsop_bufp;
+ size_t *lenp = jsop->jsop_lenp;
+
+ const struct {
+ char *name;
+ int (*func)(uintptr_t, jsobj_print_t *);
+ } table[] = {
+ { "HeapNumber", jsobj_print_number },
+ { "Oddball", jsobj_print_oddball },
+ { "JSObject", jsobj_print_jsobject },
+ { "JSArray", jsobj_print_jsarray },
+ { "JSFunction", jsobj_print_jsfunction },
+ { "JSDate", jsobj_print_jsdate },
+ { NULL }
+ }, *ent;
+
+ if (jsop->jsop_baseaddr != NULL && jsop->jsop_member == NULL)
+ (void) bsnprintf(bufp, lenp, "%p: ", jsop->jsop_baseaddr);
+
+ if (jsop->jsop_printaddr && jsop->jsop_member == NULL)
+ (void) bsnprintf(bufp, lenp, "%p: ", addr);
+
+ if (V8_IS_SMI(addr)) {
+ (void) bsnprintf(bufp, lenp, "%d", V8_SMI_VALUE(addr));
+ return (0);
+ }
+
+ if (!V8_IS_HEAPOBJECT(addr)) {
+ v8_warn("not a heap object: %p\n", addr);
+ return (-1);
+ }
+
+ if (read_typebyte(&type, addr) != 0)
+ return (-1);
+
+ if (V8_TYPE_STRING(type)) {
+ if (jsstr_print(addr, JSSTR_QUOTED, bufp, lenp) == -1)
+ return (-1);
+
+ return (0);
+ }
+
+ klass = enum_lookup_str(v8_types, type, "<unknown>");
+
+ for (ent = &table[0]; ent->name != NULL; ent++) {
+ if (strcmp(klass, ent->name) == 0)
+ return (ent->func(addr, jsop));
+ }
+
+ v8_warn("%p: unknown JavaScript object type \"%s\"\n", addr, klass);
+ return (-1);
+}
+
+static int
+jsobj_print_number(uintptr_t addr, jsobj_print_t *jsop)
+{
+ char **bufp = jsop->jsop_bufp;
+ size_t *lenp = jsop->jsop_lenp;
+ double numval;
+
+ if (read_heap_double(&numval, addr, V8_OFF_HEAPNUMBER_VALUE) == -1)
+ return (-1);
+
+ if (numval == (long long)numval)
+ (void) bsnprintf(bufp, lenp, "%lld", (long long)numval);
+ else
+ (void) bsnprintf(bufp, lenp, "%e", numval);
+
+ return (0);
+}
+
+static int
+jsobj_print_oddball(uintptr_t addr, jsobj_print_t *jsop)
+{
+ char **bufp = jsop->jsop_bufp;
+ size_t *lenp = jsop->jsop_lenp;
+ uintptr_t strptr;
+
+ if (read_heap_ptr(&strptr, addr, V8_OFF_ODDBALL_TO_STRING) != 0)
+ return (-1);
+
+ return (jsstr_print(strptr, JSSTR_NUDE, bufp, lenp));
+}
+
+static int
+jsobj_print_prop(const char *desc, uintptr_t val, void *arg)
+{
+ jsobj_print_t *jsop = arg, descend;
+ char **bufp = jsop->jsop_bufp;
+ size_t *lenp = jsop->jsop_lenp;
+
+ (void) bsnprintf(bufp, lenp, "%s\n%*s%s: ", jsop->jsop_nprops == 0 ?
+ "{" : "", jsop->jsop_indent + 4, "", desc);
+
+ descend = *jsop;
+ descend.jsop_depth--;
+ descend.jsop_indent += 4;
+
+ (void) jsobj_print(val, &descend);
+ (void) bsnprintf(bufp, lenp, ",");
+
+ jsop->jsop_nprops++;
+
+ return (0);
+}
+
+static int
+jsobj_print_prop_member(const char *desc, uintptr_t val, void *arg)
+{
+ jsobj_print_t *jsop = arg, descend;
+ const char *member = jsop->jsop_member, *next = member;
+ int rv;
+
+ for (; *next != '\0' && *next != '.' && *next != '['; next++)
+ continue;
+
+ if (*member == '[') {
+ mdb_warn("cannot use array indexing on an object\n");
+ return (-1);
+ }
+
+ if (strncmp(member, desc, next - member) != 0)
+ return (0);
+
+ if (desc[next - member] != '\0')
+ return (0);
+
+ /*
+ * This property matches the desired member; descend.
+ */
+ descend = *jsop;
+
+ if (*next == '\0') {
+ descend.jsop_member = NULL;
+ descend.jsop_found = B_TRUE;
+ } else {
+ descend.jsop_member = *next == '.' ? next + 1 : next;
+ }
+
+ rv = jsobj_print(val, &descend);
+ jsop->jsop_found = descend.jsop_found;
+
+ return (rv);
+}
+
+static int
+jsobj_print_jsobject(uintptr_t addr, jsobj_print_t *jsop)
+{
+ char **bufp = jsop->jsop_bufp;
+ size_t *lenp = jsop->jsop_lenp;
+
+ if (jsop->jsop_member != NULL)
+ return (jsobj_properties(addr, jsobj_print_prop_member, jsop));
+
+ if (jsop->jsop_depth == 0) {
+ (void) bsnprintf(bufp, lenp, "[...]");
+ return (0);
+ }
+
+ jsop->jsop_nprops = 0;
+
+ if (jsobj_properties(addr, jsobj_print_prop, jsop) != 0)
+ return (-1);
+
+ if (jsop->jsop_nprops > 0) {
+ (void) bsnprintf(bufp, lenp, "\n%*s", jsop->jsop_indent, "");
+ } else if (jsop->jsop_nprops == 0) {
+ (void) bsnprintf(bufp, lenp, "{");
+ } else {
+ (void) bsnprintf(bufp, lenp, "{ /* unknown property */ ");
+ }
+
+ (void) bsnprintf(bufp, lenp, "}");
+
+ return (0);
+}
+
+static int
+jsobj_print_jsarray_member(uintptr_t addr, jsobj_print_t *jsop)
+{
+ uintptr_t *elts;
+ jsobj_print_t descend;
+ uintptr_t ptr;
+ const char *member = jsop->jsop_member, *end, *p;
+ size_t elt = 0, place = 1, len, rv;
+
+ if (read_heap_ptr(&ptr, addr, V8_OFF_JSOBJECT_ELEMENTS) != 0 ||
+ read_heap_array(ptr, &elts, &len, UM_SLEEP | UM_GC) != 0)
+ return (-1);
+
+ if (*member != '[') {
+ mdb_warn("expected bracketed array index; "
+ "found '%s'\n", member);
+ return (-1);
+ }
+
+ if ((end = strchr(member, ']')) == NULL) {
+ mdb_warn("missing array index terminator\n");
+ return (-1);
+ }
+
+ /*
+ * We know where our array index ends; convert it to an integer
+ * by stepping through it from least significant digit to most.
+ */
+ for (p = end - 1; p > member; p--) {
+ if (*p < '0' || *p > '9') {
+ mdb_warn("illegal array index at '%c'\n", *p);
+ return (-1);
+ }
+
+ elt += (*p - '0') * place;
+ place *= 10;
+ }
+
+ if (place == 1) {
+ mdb_warn("missing array index\n");
+ return (-1);
+ }
+
+ if (elt >= len) {
+ mdb_warn("array index %d exceeds size of %d\n", elt, len);
+ return (-1);
+ }
+
+ descend = *jsop;
+
+ switch (*(++end)) {
+ case '\0':
+ descend.jsop_member = NULL;
+ descend.jsop_found = B_TRUE;
+ break;
+
+ case '.':
+ descend.jsop_member = end + 1;
+ break;
+
+ case '[':
+ descend.jsop_member = end;
+ break;
+
+ default:
+ mdb_warn("illegal character '%c' following "
+ "array index terminator\n", *end);
+ return (-1);
+ }
+
+ rv = jsobj_print(elts[elt], &descend);
+ jsop->jsop_found = descend.jsop_found;
+
+ return (rv);
+}
+
+static int
+jsobj_print_jsarray(uintptr_t addr, jsobj_print_t *jsop)
+{
+ char **bufp = jsop->jsop_bufp;
+ size_t *lenp = jsop->jsop_lenp;
+ int indent = jsop->jsop_indent;
+ jsobj_print_t descend;
+ uintptr_t ptr;
+ uintptr_t *elts;
+ size_t ii, len;
+
+ if (jsop->jsop_member != NULL)
+ return (jsobj_print_jsarray_member(addr, jsop));
+
+ if (jsop->jsop_depth == 0) {
+ (void) bsnprintf(bufp, lenp, "[...]");
+ return (0);
+ }
+
+ if (read_heap_ptr(&ptr, addr, V8_OFF_JSOBJECT_ELEMENTS) != 0 ||
+ read_heap_array(ptr, &elts, &len, UM_SLEEP | UM_GC) != 0)
+ return (-1);
+
+ if (len == 0) {
+ (void) bsnprintf(bufp, lenp, "[]");
+ return (0);
+ }
+
+ descend = *jsop;
+ descend.jsop_depth--;
+ descend.jsop_indent += 4;
+
+ if (len == 1) {
+ (void) bsnprintf(bufp, lenp, "[ ");
+ (void) jsobj_print(elts[0], &descend);
+ (void) bsnprintf(bufp, lenp, " ]");
+ return (0);
+ }
+
+ (void) bsnprintf(bufp, lenp, "[\n");
+
+ for (ii = 0; ii < len; ii++) {
+ (void) bsnprintf(bufp, lenp, "%*s", indent + 4, "");
+ (void) jsobj_print(elts[ii], &descend);
+ (void) bsnprintf(bufp, lenp, ",\n");
+ }
+
+ (void) bsnprintf(bufp, lenp, "%*s", indent, "");
+ (void) bsnprintf(bufp, lenp, "]");
+
+ return (0);
+}
+
+static int
+jsobj_print_jsfunction(uintptr_t addr, jsobj_print_t *jsop)
+{
+ char **bufp = jsop->jsop_bufp;
+ size_t *lenp = jsop->jsop_lenp;
+ uintptr_t shared;
+
+ if (read_heap_ptr(&shared, addr, V8_OFF_JSFUNCTION_SHARED) != 0)
+ return (-1);
+
+ (void) bsnprintf(bufp, lenp, "function ");
+ return (jsfunc_name(shared, bufp, lenp) != 0);
+}
+
+static int
+jsobj_print_jsdate(uintptr_t addr, jsobj_print_t *jsop)
+{
+ char **bufp = jsop->jsop_bufp;
+ size_t *lenp = jsop->jsop_lenp;
+ char buf[128];
+ uintptr_t value;
+ uint8_t type;
+ double numval;
+
+ if (V8_OFF_JSDATE_VALUE == -1) {
+ (void) bsnprintf(bufp, lenp, "<JSDate>", buf);
+ return (0);
+ }
+
+ if (read_heap_ptr(&value, addr, V8_OFF_JSDATE_VALUE) != 0)
+ return (-1);
+
+ if (read_typebyte(&type, value) != 0)
+ return (-1);
+
+ if (strcmp(enum_lookup_str(v8_types, type, ""), "HeapNumber") != 0)
+ return (-1);
+
+ if (read_heap_double(&numval, value, V8_OFF_HEAPNUMBER_VALUE) == -1)
+ return (-1);
+
+ mdb_snprintf(buf, sizeof (buf), "%Y",
+ (time_t)((long long)numval / MILLISEC));
+ (void) bsnprintf(bufp, lenp, "%lld (%s)", (long long)numval, buf);
+
+ return (0);
+}
+
+/*
+ * dcmd implementations
+ */
+
+/* ARGSUSED */
+static int
+dcmd_v8classes(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ v8_class_t *clp;
+
+ for (clp = v8_classes; clp != NULL; clp = clp->v8c_next)
+ mdb_printf("%s\n", clp->v8c_name);
+
+ return (DCMD_OK);
+}
+
+static int
+do_v8code(uintptr_t addr, boolean_t opt_d)
+{
+ uintptr_t instrlen;
+ ssize_t instroff = V8_OFF_CODE_INSTRUCTION_START;
+
+ if (read_heap_ptr(&instrlen, addr, V8_OFF_CODE_INSTRUCTION_SIZE) != 0)
+ return (DCMD_ERR);
+
+ mdb_printf("code: %p\n", addr);
+ mdb_printf("instructions: [%p, %p)\n", addr + instroff,
+ addr + instroff + instrlen);
+
+ if (!opt_d)
+ return (DCMD_OK);
+
+ mdb_set_dot(addr + instroff);
+
+ do {
+ (void) mdb_inc_indent(8); /* gets reset by mdb_eval() */
+
+ /*
+ * This is absolutely awful. We want to disassemble the above
+ * range of instructions. Because we don't know how many there
+ * are, we can't use "::dis". We resort to evaluating "./i",
+ * but then we need to advance "." by the size of the
+ * instruction just printed. The only way to do that is by
+ * printing out "+", but we don't want that to show up, so we
+ * redirect it to /dev/null.
+ */
+ if (mdb_eval("/i") != 0 ||
+ mdb_eval("+=p ! cat > /dev/null") != 0) {
+ (void) mdb_dec_indent(8);
+ v8_warn("failed to disassemble at %p", mdb_get_dot());
+ return (DCMD_ERR);
+ }
+ } while (mdb_get_dot() < addr + instroff + instrlen);
+
+ (void) mdb_dec_indent(8);
+ return (DCMD_OK);
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8code(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ boolean_t opt_d = B_FALSE;
+
+ if (mdb_getopts(argc, argv, 'd', MDB_OPT_SETBITS, B_TRUE, &opt_d,
+ NULL) != argc)
+ return (DCMD_USAGE);
+
+ return (do_v8code(addr, opt_d));
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8function(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ uint8_t type;
+ uintptr_t funcinfop, scriptp, lendsp, tokpos, namep, codep;
+ char *bufp;
+ uint_t len;
+ boolean_t opt_d = B_FALSE;
+ char buf[512];
+
+ if (mdb_getopts(argc, argv, 'd', MDB_OPT_SETBITS, B_TRUE, &opt_d,
+ NULL) != argc)
+ return (DCMD_USAGE);
+
+ if (read_typebyte(&type, addr) != 0)
+ return (DCMD_ERR);
+
+ if (strcmp(enum_lookup_str(v8_types, type, ""), "JSFunction") != 0) {
+ v8_warn("%p is not an instance of JSFunction\n", addr);
+ return (DCMD_ERR);
+ }
+
+ if (read_heap_ptr(&funcinfop, addr, V8_OFF_JSFUNCTION_SHARED) != 0 ||
+ read_heap_ptr(&tokpos, funcinfop,
+ V8_OFF_SHAREDFUNCTIONINFO_FUNCTION_TOKEN_POSITION) != 0 ||
+ read_heap_ptr(&scriptp, funcinfop,
+ V8_OFF_SHAREDFUNCTIONINFO_SCRIPT) != 0 ||
+ read_heap_ptr(&namep, scriptp, V8_OFF_SCRIPT_NAME) != 0 ||
+ read_heap_ptr(&lendsp, scriptp, V8_OFF_SCRIPT_LINE_ENDS) != 0)
+ return (DCMD_ERR);
+
+ bufp = buf;
+ len = sizeof (buf);
+ if (jsfunc_name(funcinfop, &bufp, &len) != 0)
+ return (DCMD_ERR);
+
+ mdb_printf("%p: JSFunction: %s\n", addr, buf);
+
+ bufp = buf;
+ len = sizeof (buf);
+ mdb_printf("defined at ");
+
+ if (jsstr_print(namep, JSSTR_NUDE, &bufp, &len) == 0)
+ mdb_printf("%s ", buf);
+
+ if (jsfunc_lineno(lendsp, tokpos, buf, sizeof (buf)) == 0)
+ mdb_printf("%s", buf);
+
+ mdb_printf("\n");
+
+ if (read_heap_ptr(&codep,
+ funcinfop, V8_OFF_SHAREDFUNCTIONINFO_CODE) != 0)
+ return (DCMD_ERR);
+
+ return (do_v8code(codep, opt_d));
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8frametypes(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ enum_print(v8_frametypes);
+ return (DCMD_OK);
+}
+
+static void
+dcmd_v8print_help(void)
+{
+ mdb_printf(
+ "Prints out \".\" (a V8 heap object) as an instance of its C++\n"
+ "class. With no arguments, the appropriate class is detected\n"
+ "automatically. The 'class' argument overrides this to print an\n"
+ "object as an instance of the given class. The list of known\n"
+ "classes can be viewed with ::jsclasses.");
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8print(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ const char *rqclass;
+ v8_class_t *clp;
+ char *bufp;
+ size_t len;
+ uint8_t type;
+ char buf[256];
+
+ if (argc < 1) {
+ /*
+ * If no type was specified, determine it automatically.
+ */
+ bufp = buf;
+ len = sizeof (buf);
+ if (obj_jstype(addr, &bufp, &len, &type) != 0)
+ return (DCMD_ERR);
+
+ if (type == 0) {
+ /* For SMI or Failure, just print out the type. */
+ mdb_printf("%s\n", buf);
+ return (DCMD_OK);
+ }
+
+ if ((rqclass = enum_lookup_str(v8_types, type, NULL)) == NULL) {
+ v8_warn("object has unknown type\n");
+ return (DCMD_ERR);
+ }
+ } else {
+ if (argv[0].a_type != MDB_TYPE_STRING)
+ return (DCMD_USAGE);
+
+ rqclass = argv[0].a_un.a_str;
+ }
+
+ for (clp = v8_classes; clp != NULL; clp = clp->v8c_next) {
+ if (strcmp(rqclass, clp->v8c_name) == 0)
+ break;
+ }
+
+ if (clp == NULL) {
+ v8_warn("unknown class '%s'\n", rqclass);
+ return (DCMD_USAGE);
+ }
+
+ return (obj_print_class(addr, clp));
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8type(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ char buf[64];
+ char *bufp = buf;
+ size_t len = sizeof (buf);
+
+ if (obj_jstype(addr, &bufp, &len, NULL) != 0)
+ return (DCMD_ERR);
+
+ mdb_printf("0x%p: %s\n", addr, buf);
+ return (DCMD_OK);
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8types(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ enum_print(v8_types);
+ return (DCMD_OK);
+}
+
+static int
+load_current_context(uintptr_t *fpp, uintptr_t *raddrp)
+{
+ mdb_reg_t regfp, regip;
+
+ if (mdb_getareg(1, "ebp", &regfp) != 0 ||
+ mdb_getareg(1, "eip", &regip) != 0) {
+ v8_warn("failed to load current context");
+ return (-1);
+ }
+
+ if (fpp != NULL)
+ *fpp = (uintptr_t)regfp;
+
+ if (raddrp != NULL)
+ *raddrp = (uintptr_t)regip;
+
+ return (0);
+}
+
+static int
+do_jsframe_special(uintptr_t fptr, uintptr_t raddr, char *prop)
+{
+ uintptr_t ftype;
+ const char *ftypename;
+
+ /*
+ * First see if this looks like a native frame rather than a JavaScript
+ * frame. We check this by asking MDB to print the return address
+ * symbolically. If that works, we assume this was NOT a V8 frame,
+ * since those are never in the symbol table.
+ */
+ if (mdb_snprintf(NULL, 0, "%A", raddr) > 1) {
+ if (prop != NULL)
+ return (0);
+
+ mdb_printf("%p %a\n", fptr, raddr);
+ return (0);
+ }
+
+ /*
+ * Figure out what kind of frame this is using the same algorithm as
+ * V8's ComputeType function. First, look for an ArgumentsAdaptorFrame.
+ */
+ if (mdb_vread(&ftype, sizeof (ftype), fptr + V8_OFF_FP_CONTEXT) != -1 &&
+ V8_IS_SMI(ftype) &&
+ (ftypename = enum_lookup_str(v8_frametypes, V8_SMI_VALUE(ftype),
+ NULL)) != NULL && strstr(ftypename, "ArgumentsAdaptor") != NULL) {
+ if (prop != NULL)
+ return (0);
+
+ mdb_printf("%p %a <%s>\n", fptr, raddr, ftypename);
+ return (0);
+ }
+
+ /*
+ * Other special frame types are indicated by a marker.
+ */
+ if (mdb_vread(&ftype, sizeof (ftype), fptr + V8_OFF_FP_MARKER) != -1 &&
+ V8_IS_SMI(ftype)) {
+ if (prop != NULL)
+ return (0);
+
+ ftypename = enum_lookup_str(v8_frametypes, V8_SMI_VALUE(ftype),
+ NULL);
+
+ if (ftypename != NULL)
+ mdb_printf("%p %a <%s>\n", fptr, raddr, ftypename);
+ else
+ mdb_printf("%p %a\n", fptr, raddr);
+
+ return (0);
+ }
+
+ return (-1);
+}
+
+static int
+do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose,
+ char *func, char *prop)
+{
+ uintptr_t funcp, funcinfop, tokpos, scriptp, lendsp, ptrp;
+ uintptr_t ii, nargs;
+ const char *typename;
+ char *bufp;
+ size_t len;
+ uint8_t type;
+ char buf[256];
+
+ /*
+ * Check for non-JavaScript frames first.
+ */
+ if (func == NULL && do_jsframe_special(fptr, raddr, prop) == 0)
+ return (DCMD_OK);
+
+ /*
+ * At this point we assume we're looking at a JavaScript frame. As with
+ * native frames, fish the address out of the parent frame.
+ */
+ if (mdb_vread(&funcp, sizeof (funcp),
+ fptr + V8_OFF_FP_FUNCTION) == -1) {
+ v8_warn("failed to read stack at %p",
+ fptr + V8_OFF_FP_FUNCTION);
+ return (DCMD_ERR);
+ }
+
+ /*
+ * Check if this thing is really a JSFunction at all. For some frames,
+ * it's a Code object, presumably indicating some internal frame.
+ */
+ v8_silent++;
+
+ if (read_typebyte(&type, funcp) != 0 ||
+ (typename = enum_lookup_str(v8_types, type, NULL)) == NULL) {
+ v8_silent--;
+
+ if (func != NULL || prop != NULL)
+ return (DCMD_OK);
+
+ mdb_printf("%p %a\n", fptr, raddr);
+ return (DCMD_OK);
+ }
+
+ v8_silent--;
+
+ if (strcmp("Code", typename) == 0) {
+ if (func != NULL || prop != NULL)
+ return (DCMD_OK);
+
+ mdb_printf("%p %a internal (Code: %p)\n", fptr, raddr, funcp);
+ return (DCMD_OK);
+ }
+
+ if (strcmp("JSFunction", typename) != 0) {
+ if (func != NULL || prop != NULL)
+ return (DCMD_OK);
+
+ mdb_printf("%p %a unknown (%s: %p)", fptr, raddr, typename,
+ funcp);
+ return (DCMD_OK);
+ }
+
+ if (read_heap_ptr(&funcinfop, funcp, V8_OFF_JSFUNCTION_SHARED) != 0)
+ return (DCMD_ERR);
+
+ bufp = buf;
+ len = sizeof (buf);
+ if (jsfunc_name(funcinfop, &bufp, &len) != 0)
+ return (DCMD_ERR);
+
+ if (func != NULL && strcmp(buf, func) != 0)
+ return (DCMD_OK);
+
+ if (prop == NULL)
+ mdb_printf("%p %a %s (%p)\n", fptr, raddr, buf, funcp);
+
+ if (!verbose && prop == NULL)
+ return (DCMD_OK);
+
+ /*
+ * Although the token position is technically an SMI, we're going to
+ * byte-compare it to other SMI values so we don't want decode it here.
+ */
+ if (read_heap_ptr(&tokpos, funcinfop,
+ V8_OFF_SHAREDFUNCTIONINFO_FUNCTION_TOKEN_POSITION) != 0)
+ return (DCMD_ERR);
+
+ if (read_heap_ptr(&scriptp, funcinfop,
+ V8_OFF_SHAREDFUNCTIONINFO_SCRIPT) != 0)
+ return (DCMD_ERR);
+
+ if (read_heap_ptr(&ptrp, scriptp, V8_OFF_SCRIPT_NAME) != 0)
+ return (DCMD_ERR);
+
+ bufp = buf;
+ len = sizeof (buf);
+ (void) jsstr_print(ptrp, JSSTR_NUDE, &bufp, &len);
+
+ if (prop != NULL && strcmp(prop, "file") == 0) {
+ mdb_printf("%s\n", buf);
+ return (DCMD_OK);
+ }
+
+ if (prop == NULL) {
+ (void) mdb_inc_indent(4);
+ mdb_printf("file: %s\n", buf);
+ }
+
+ if (read_heap_ptr(&lendsp, scriptp, V8_OFF_SCRIPT_LINE_ENDS) != 0)
+ return (DCMD_ERR);
+
+ (void) jsfunc_lineno(lendsp, tokpos, buf, sizeof (buf));
+
+ if (prop != NULL && strcmp(prop, "posn") == 0) {
+ mdb_printf("%s\n", buf);
+ return (DCMD_OK);
+ }
+
+ if (prop == NULL)
+ mdb_printf("posn: %s\n", buf);
+
+ if (read_heap_smi(&nargs, funcinfop,
+ V8_OFF_SHAREDFUNCTIONINFO_LENGTH) == 0) {
+ for (ii = 0; ii < nargs; ii++) {
+ uintptr_t argptr;
+ char arg[10];
+
+ if (mdb_vread(&argptr, sizeof (argptr),
+ fptr + V8_OFF_FP_ARGS + (nargs - ii - 1) *
+ sizeof (uintptr_t)) == -1)
+ continue;
+
+ (void) snprintf(arg, sizeof (arg), "arg%d", ii + 1);
+
+ if (prop != NULL) {
+ if (strcmp(arg, prop) != 0)
+ continue;
+
+ mdb_printf("%p\n", argptr);
+ return (DCMD_OK);
+ }
+
+ bufp = buf;
+ len = sizeof (buf);
+ (void) obj_jstype(argptr, &bufp, &len, NULL);
+
+ mdb_printf("arg%d: %p (%s)\n", (ii + 1), argptr, buf);
+ }
+ }
+
+ if (prop != NULL) {
+ mdb_warn("unknown frame property '%s'\n", prop);
+ return (DCMD_ERR);
+ }
+
+ (void) mdb_dec_indent(4);
+
+ return (DCMD_OK);
+}
+
+typedef struct findjsobjects_prop {
+ struct findjsobjects_prop *fjsp_next;
+ char fjsp_desc[1];
+} findjsobjects_prop_t;
+
+typedef struct findjsobjects_instance {
+ uintptr_t fjsi_addr;
+ struct findjsobjects_instance *fjsi_next;
+} findjsobjects_instance_t;
+
+typedef struct findjsobjects_obj {
+ findjsobjects_prop_t *fjso_props;
+ findjsobjects_prop_t *fjso_last;
+ size_t fjso_nprops;
+ findjsobjects_instance_t fjso_instances;
+ int fjso_ninstances;
+ avl_node_t fjso_node;
+ struct findjsobjects_obj *fjso_next;
+ boolean_t fjso_malformed;
+ char fjso_constructor[80];
+} findjsobjects_obj_t;
+
+typedef struct findjsobjects_stats {
+ int fjss_heapobjs;
+ int fjss_cached;
+ int fjss_typereads;
+ int fjss_jsobjs;
+ int fjss_objects;
+ int fjss_arrays;
+ int fjss_uniques;
+} findjsobjects_stats_t;
+
+typedef struct findjsobjects_reference {
+ uintptr_t fjsrf_addr;
+ char *fjsrf_desc;
+ size_t fjsrf_index;
+ struct findjsobjects_reference *fjsrf_next;
+} findjsobjects_reference_t;
+
+typedef struct findjsobjects_referent {
+ avl_node_t fjsr_node;
+ uintptr_t fjsr_addr;
+ findjsobjects_reference_t *fjsr_head;
+ findjsobjects_reference_t *fjsr_tail;
+ struct findjsobjects_referent *fjsr_next;
+} findjsobjects_referent_t;
+
+typedef struct findjsobjects_state {
+ uintptr_t fjs_addr;
+ uintptr_t fjs_size;
+ boolean_t fjs_verbose;
+ boolean_t fjs_brk;
+ boolean_t fjs_allobjs;
+ boolean_t fjs_initialized;
+ boolean_t fjs_marking;
+ boolean_t fjs_referred;
+ avl_tree_t fjs_tree;
+ avl_tree_t fjs_referents;
+ findjsobjects_referent_t *fjs_head;
+ findjsobjects_referent_t *fjs_tail;
+ findjsobjects_obj_t *fjs_current;
+ findjsobjects_obj_t *fjs_objects;
+ findjsobjects_stats_t fjs_stats;
+} findjsobjects_state_t;
+
+findjsobjects_obj_t *
+findjsobjects_alloc(uintptr_t addr)
+{
+ findjsobjects_obj_t *obj;
+
+ obj = mdb_zalloc(sizeof (findjsobjects_obj_t), UM_SLEEP);
+ obj->fjso_instances.fjsi_addr = addr;
+ obj->fjso_ninstances = 1;
+
+ return (obj);
+}
+
+void
+findjsobjects_free(findjsobjects_obj_t *obj)
+{
+ findjsobjects_prop_t *prop, *next;
+
+ for (prop = obj->fjso_props; prop != NULL; prop = next) {
+ next = prop->fjsp_next;
+ mdb_free(prop, sizeof (findjsobjects_prop_t) +
+ strlen(prop->fjsp_desc));
+ }
+
+ mdb_free(obj, sizeof (findjsobjects_obj_t));
+}
+
+int
+findjsobjects_cmp(findjsobjects_obj_t *lhs, findjsobjects_obj_t *rhs)
+{
+ findjsobjects_prop_t *lprop, *rprop;
+ int rv;
+
+ lprop = lhs->fjso_props;
+ rprop = rhs->fjso_props;
+
+ while (lprop != NULL && rprop != NULL) {
+ if ((rv = strcmp(lprop->fjsp_desc, rprop->fjsp_desc)) != 0)
+ return (rv > 0 ? 1 : -1);
+
+ lprop = lprop->fjsp_next;
+ rprop = rprop->fjsp_next;
+ }
+
+ if (lprop != NULL)
+ return (1);
+
+ if (rprop != NULL)
+ return (-1);
+
+ if (lhs->fjso_nprops > rhs->fjso_nprops)
+ return (1);
+
+ if (lhs->fjso_nprops < rhs->fjso_nprops)
+ return (-1);
+
+ rv = strcmp(lhs->fjso_constructor, rhs->fjso_constructor);
+
+ return (rv < 0 ? -1 : rv > 0 ? 1 : 0);
+}
+
+int
+findjsobjects_cmp_referents(findjsobjects_referent_t *lhs,
+ findjsobjects_referent_t *rhs)
+{
+ if (lhs->fjsr_addr < rhs->fjsr_addr)
+ return (-1);
+
+ if (lhs->fjsr_addr > rhs->fjsr_addr)
+ return (1);
+
+ return (0);
+}
+
+int
+findjsobjects_cmp_ninstances(const void *l, const void *r)
+{
+ findjsobjects_obj_t *lhs = *((findjsobjects_obj_t **)l);
+ findjsobjects_obj_t *rhs = *((findjsobjects_obj_t **)r);
+ size_t lprod = lhs->fjso_ninstances * lhs->fjso_nprops;
+ size_t rprod = rhs->fjso_ninstances * rhs->fjso_nprops;
+
+ if (lprod < rprod)
+ return (-1);
+
+ if (lprod > rprod)
+ return (1);
+
+ if (lhs->fjso_ninstances < rhs->fjso_ninstances)
+ return (-1);
+
+ if (lhs->fjso_ninstances > rhs->fjso_ninstances)
+ return (1);
+
+ if (lhs->fjso_nprops < rhs->fjso_nprops)
+ return (-1);
+
+ if (lhs->fjso_nprops > rhs->fjso_nprops)
+ return (1);
+
+ return (0);
+}
+
+/*ARGSUSED*/
+int
+findjsobjects_prop(const char *desc, uintptr_t val, void *arg)
+{
+ findjsobjects_state_t *fjs = arg;
+ findjsobjects_obj_t *current = fjs->fjs_current;
+ findjsobjects_prop_t *prop;
+
+ if (desc == NULL)
+ desc = "<unknown>";
+
+ prop = mdb_zalloc(sizeof (findjsobjects_prop_t) +
+ strlen(desc), UM_SLEEP);
+
+ strcpy(prop->fjsp_desc, desc);
+
+ if (current->fjso_last != NULL) {
+ current->fjso_last->fjsp_next = prop;
+ } else {
+ current->fjso_props = prop;
+ }
+
+ current->fjso_last = prop;
+ current->fjso_nprops++;
+ current->fjso_malformed =
+ val == NULL && current->fjso_nprops == 1 && desc[0] == '<';
+
+ return (0);
+}
+
+static void
+findjsobjects_constructor(findjsobjects_obj_t *obj)
+{
+ char *bufp = obj->fjso_constructor;
+ unsigned int len = sizeof (obj->fjso_constructor);
+ uintptr_t map, funcinfop;
+ uintptr_t addr = obj->fjso_instances.fjsi_addr;
+ uint8_t type;
+
+ v8_silent++;
+
+ if (read_heap_ptr(&map, addr, V8_OFF_HEAPOBJECT_MAP) != 0 ||
+ read_heap_ptr(&addr, map, V8_OFF_MAP_CONSTRUCTOR) != 0)
+ goto out;
+
+ if (read_typebyte(&type, addr) != 0)
+ goto out;
+
+ if (strcmp(enum_lookup_str(v8_types, type, ""), "JSFunction") != 0)
+ goto out;
+
+ if (read_heap_ptr(&funcinfop, addr, V8_OFF_JSFUNCTION_SHARED) != 0)
+ goto out;
+
+ if (jsfunc_name(funcinfop, &bufp, &len) != 0)
+ goto out;
+out:
+ v8_silent--;
+}
+
+int
+findjsobjects_range(findjsobjects_state_t *fjs, uintptr_t addr, uintptr_t size)
+{
+ uintptr_t limit;
+ findjsobjects_stats_t *stats = &fjs->fjs_stats;
+ uint8_t type;
+ int jsobject = V8_TYPE_JSOBJECT, jsarray = V8_TYPE_JSARRAY;
+ caddr_t range = mdb_alloc(size, UM_SLEEP);
+ uintptr_t base = addr, mapaddr;
+
+ if (mdb_vread(range, size, addr) == -1)
+ return (0);
+
+ for (limit = addr + size; addr < limit; addr++) {
+ findjsobjects_instance_t *inst;
+ findjsobjects_obj_t *obj;
+ avl_index_t where;
+
+ if (V8_IS_SMI(addr))
+ continue;
+
+ if (!V8_IS_HEAPOBJECT(addr))
+ continue;
+
+ stats->fjss_heapobjs++;
+
+ mapaddr = *((uintptr_t *)((uintptr_t)range +
+ (addr - base) + V8_OFF_HEAPOBJECT_MAP));
+
+ if (!V8_IS_HEAPOBJECT(mapaddr))
+ continue;
+
+ mapaddr += V8_OFF_MAP_INSTANCE_ATTRIBUTES;
+ stats->fjss_typereads++;
+
+ if (mapaddr >= base && mapaddr < base + size) {
+ stats->fjss_cached++;
+
+ type = *((uint8_t *)((uintptr_t)range +
+ (mapaddr - base)));
+ } else {
+ if (mdb_vread(&type, sizeof (uint8_t), mapaddr) == -1)
+ continue;
+ }
+
+ if (type != jsobject && type != jsarray)
+ continue;
+
+ stats->fjss_jsobjs++;
+
+ fjs->fjs_current = findjsobjects_alloc(addr);
+
+ if (type == jsobject) {
+ if (jsobj_properties(addr,
+ findjsobjects_prop, fjs) != 0) {
+ findjsobjects_free(fjs->fjs_current);
+ fjs->fjs_current = NULL;
+ continue;
+ }
+
+ findjsobjects_constructor(fjs->fjs_current);
+ stats->fjss_objects++;
+ } else {
+ uintptr_t ptr;
+ size_t *nprops = &fjs->fjs_current->fjso_nprops;
+ ssize_t len = V8_OFF_JSARRAY_LENGTH;
+ ssize_t elems = V8_OFF_JSOBJECT_ELEMENTS;
+ ssize_t flen = V8_OFF_FIXEDARRAY_LENGTH;
+ uintptr_t nelems;
+ uint8_t t;
+
+ if (read_heap_smi(nprops, addr, len) != 0 ||
+ read_heap_ptr(&ptr, addr, elems) != 0 ||
+ !V8_IS_HEAPOBJECT(ptr) ||
+ read_typebyte(&t, ptr) != 0 ||
+ t != V8_TYPE_FIXEDARRAY ||
+ read_heap_smi(&nelems, ptr, flen) != 0 ||
+ nelems < *nprops) {
+ findjsobjects_free(fjs->fjs_current);
+ fjs->fjs_current = NULL;
+ continue;
+ }
+
+ strcpy(fjs->fjs_current->fjso_constructor, "Array");
+ stats->fjss_arrays++;
+ }
+
+ /*
+ * Now determine if we already have an object matching our
+ * properties. If we don't, we'll add our new object; if we
+ * do we'll merely enqueue our instance.
+ */
+ obj = avl_find(&fjs->fjs_tree, fjs->fjs_current, &where);
+
+ if (obj == NULL) {
+ avl_add(&fjs->fjs_tree, fjs->fjs_current);
+ fjs->fjs_current->fjso_next = fjs->fjs_objects;
+ fjs->fjs_objects = fjs->fjs_current;
+ fjs->fjs_current = NULL;
+ stats->fjss_uniques++;
+ continue;
+ }
+
+ findjsobjects_free(fjs->fjs_current);
+ fjs->fjs_current = NULL;
+
+ inst = mdb_alloc(sizeof (findjsobjects_instance_t), UM_SLEEP);
+ inst->fjsi_addr = addr;
+ inst->fjsi_next = obj->fjso_instances.fjsi_next;
+ obj->fjso_instances.fjsi_next = inst;
+ obj->fjso_ninstances++;
+ }
+
+ mdb_free(range, size);
+
+ return (0);
+}
+
+static int
+findjsobjects_mapping(findjsobjects_state_t *fjs, const prmap_t *pmp,
+ const char *name)
+{
+ if (name != NULL && !(fjs->fjs_brk && (pmp->pr_mflags & MA_BREAK)))
+ return (0);
+
+ if (fjs->fjs_addr != NULL && (fjs->fjs_addr < pmp->pr_vaddr ||
+ fjs->fjs_addr >= pmp->pr_vaddr + pmp->pr_size))
+ return (0);
+
+ return (findjsobjects_range(fjs, pmp->pr_vaddr, pmp->pr_size));
+}
+
+static void
+findjsobjects_references_add(findjsobjects_state_t *fjs, uintptr_t val,
+ const char *desc, size_t index)
+{
+ findjsobjects_referent_t search, *referent;
+ findjsobjects_reference_t *reference;
+
+ search.fjsr_addr = val;
+
+ if ((referent = avl_find(&fjs->fjs_referents, &search, NULL)) == NULL)
+ return;
+
+ reference = mdb_zalloc(sizeof (*reference), UM_SLEEP | UM_GC);
+ reference->fjsrf_addr = fjs->fjs_addr;
+
+ if (desc != NULL) {
+ reference->fjsrf_desc =
+ mdb_alloc(strlen(desc) + 1, UM_SLEEP | UM_GC);
+ (void) strcpy(reference->fjsrf_desc, desc);
+ } else {
+ reference->fjsrf_index = index;
+ }
+
+ if (referent->fjsr_head == NULL) {
+ referent->fjsr_head = reference;
+ } else {
+ referent->fjsr_tail->fjsrf_next = reference;
+ }
+
+ referent->fjsr_tail = reference;
+}
+
+static int
+findjsobjects_references_prop(const char *desc, uintptr_t val, void *arg)
+{
+ findjsobjects_references_add(arg, val, desc, -1);
+
+ return (0);
+}
+
+static void
+findjsobjects_references_array(findjsobjects_state_t *fjs,
+ findjsobjects_obj_t *obj)
+{
+ findjsobjects_instance_t *inst = &obj->fjso_instances;
+ uintptr_t *elts;
+ size_t i, len;
+
+ for (; inst != NULL; inst = inst->fjsi_next) {
+ uintptr_t addr = inst->fjsi_addr, ptr;
+
+ if (read_heap_ptr(&ptr, addr, V8_OFF_JSOBJECT_ELEMENTS) != 0 ||
+ read_heap_array(ptr, &elts, &len, UM_SLEEP) != 0)
+ continue;
+
+ fjs->fjs_addr = addr;
+
+ for (i = 0; i < len; i++)
+ findjsobjects_references_add(fjs, elts[i], NULL, i);
+
+ mdb_free(elts, len * sizeof (uintptr_t));
+ }
+}
+
+static void
+findjsobjects_referent(findjsobjects_state_t *fjs, uintptr_t addr)
+{
+ findjsobjects_referent_t search, *referent;
+
+ search.fjsr_addr = addr;
+
+ if (avl_find(&fjs->fjs_referents, &search, NULL) != NULL) {
+ assert(fjs->fjs_marking);
+ mdb_warn("%p is already marked; ignoring\n", addr);
+ return;
+ }
+
+ referent = mdb_zalloc(sizeof (findjsobjects_referent_t), UM_SLEEP);
+ referent->fjsr_addr = addr;
+
+ avl_add(&fjs->fjs_referents, referent);
+
+ if (fjs->fjs_tail != NULL) {
+ fjs->fjs_tail->fjsr_next = referent;
+ } else {
+ fjs->fjs_head = referent;
+ }
+
+ fjs->fjs_tail = referent;
+
+ if (fjs->fjs_marking)
+ mdb_printf("findjsobjects: marked %p\n", addr);
+}
+
+static void
+findjsobjects_references(findjsobjects_state_t *fjs)
+{
+ findjsobjects_reference_t *reference;
+ findjsobjects_referent_t *referent;
+ avl_tree_t *referents = &fjs->fjs_referents;
+ findjsobjects_obj_t *obj;
+ void *cookie = NULL;
+ uintptr_t addr;
+
+ fjs->fjs_referred = B_FALSE;
+
+ v8_silent++;
+
+ /*
+ * First traverse over all objects and arrays, looking for references
+ * to our designated referent(s).
+ */
+ for (obj = fjs->fjs_objects; obj != NULL; obj = obj->fjso_next) {
+ findjsobjects_instance_t *head = &obj->fjso_instances, *inst;
+
+ if (obj->fjso_nprops != 0 && obj->fjso_props == NULL) {
+ findjsobjects_references_array(fjs, obj);
+ continue;
+ }
+
+ for (inst = head; inst != NULL; inst = inst->fjsi_next) {
+ fjs->fjs_addr = inst->fjsi_addr;
+
+ (void) jsobj_properties(inst->fjsi_addr,
+ findjsobjects_references_prop, fjs);
+ }
+ }
+
+ v8_silent--;
+ fjs->fjs_addr = NULL;
+
+ /*
+ * Now go over our referent(s), reporting any references that we have
+ * accumulated.
+ */
+ for (referent = fjs->fjs_head; referent != NULL;
+ referent = referent->fjsr_next) {
+ addr = referent->fjsr_addr;
+
+ if ((reference = referent->fjsr_head) == NULL) {
+ mdb_printf("%p is not referred to by a "
+ "known object.\n", addr);
+ continue;
+ }
+
+ for (; reference != NULL; reference = reference->fjsrf_next) {
+ mdb_printf("%p referred to by %p",
+ addr, reference->fjsrf_addr);
+
+ if (reference->fjsrf_desc == NULL) {
+ mdb_printf("[%d]\n", reference->fjsrf_index);
+ } else {
+ mdb_printf(".%s\n", reference->fjsrf_desc);
+ }
+ }
+ }
+
+ /*
+ * Finally, destroy our referent nodes.
+ */
+ while ((referent = avl_destroy_nodes(referents, &cookie)) != NULL)
+ mdb_free(referent, sizeof (findjsobjects_referent_t));
+
+ fjs->fjs_head = NULL;
+ fjs->fjs_tail = NULL;
+}
+
+static findjsobjects_instance_t *
+findjsobjects_instance(findjsobjects_state_t *fjs, uintptr_t addr,
+ findjsobjects_instance_t **headp)
+{
+ findjsobjects_obj_t *obj;
+
+ for (obj = fjs->fjs_objects; obj != NULL; obj = obj->fjso_next) {
+ findjsobjects_instance_t *head = &obj->fjso_instances, *inst;
+
+ for (inst = head; inst != NULL; inst = inst->fjsi_next) {
+ if (inst->fjsi_addr == addr) {
+ *headp = head;
+ return (inst);
+ }
+ }
+ }
+
+ return (NULL);
+}
+
+/*ARGSUSED*/
+static void
+findjsobjects_match_all(findjsobjects_obj_t *obj, const char *ignored)
+{
+ mdb_printf("%p\n", obj->fjso_instances.fjsi_addr);
+}
+
+static void
+findjsobjects_match_propname(findjsobjects_obj_t *obj, const char *propname)
+{
+ findjsobjects_prop_t *prop;
+
+ for (prop = obj->fjso_props; prop != NULL; prop = prop->fjsp_next) {
+ if (strcmp(prop->fjsp_desc, propname) == 0) {
+ mdb_printf("%p\n", obj->fjso_instances.fjsi_addr);
+ return;
+ }
+ }
+}
+
+static void
+findjsobjects_match_constructor(findjsobjects_obj_t *obj,
+ const char *constructor)
+{
+ if (strcmp(constructor, obj->fjso_constructor) == 0)
+ mdb_printf("%p\n", obj->fjso_instances.fjsi_addr);
+}
+
+static int
+findjsobjects_match(findjsobjects_state_t *fjs, uintptr_t addr,
+ uint_t flags, void (*func)(findjsobjects_obj_t *, const char *),
+ const char *match)
+{
+ findjsobjects_obj_t *obj;
+
+ if (!(flags & DCMD_ADDRSPEC)) {
+ for (obj = fjs->fjs_objects; obj != NULL;
+ obj = obj->fjso_next) {
+ if (obj->fjso_malformed && !fjs->fjs_allobjs)
+ continue;
+
+ func(obj, match);
+ }
+
+ return (DCMD_OK);
+ }
+
+ /*
+ * First, look for the specified address among the representative
+ * objects.
+ */
+ for (obj = fjs->fjs_objects; obj != NULL; obj = obj->fjso_next) {
+ if (obj->fjso_instances.fjsi_addr == addr) {
+ func(obj, match);
+ return (DCMD_OK);
+ }
+ }
+
+ /*
+ * We didn't find it among the representative objects; iterate over
+ * all objects.
+ */
+ for (obj = fjs->fjs_objects; obj != NULL; obj = obj->fjso_next) {
+ findjsobjects_instance_t *head = &obj->fjso_instances, *inst;
+
+ for (inst = head; inst != NULL; inst = inst->fjsi_next) {
+ if (inst->fjsi_addr == addr) {
+ func(obj, match);
+ return (DCMD_OK);
+ }
+ }
+ }
+
+ mdb_warn("%p does not correspond to a known object\n", addr);
+ return (DCMD_ERR);
+}
+
+static void
+findjsobjects_print(findjsobjects_obj_t *obj)
+{
+ int col = 19 + (sizeof (uintptr_t) * 2) + strlen("..."), len;
+ uintptr_t addr = obj->fjso_instances.fjsi_addr;
+ findjsobjects_prop_t *prop;
+
+ mdb_printf("%?p %8d %8d ",
+ addr, obj->fjso_ninstances, obj->fjso_nprops);
+
+ if (obj->fjso_constructor[0] != '\0') {
+ mdb_printf("%s%s", obj->fjso_constructor,
+ obj->fjso_props != NULL ? ": " : "");
+ col += strlen(obj->fjso_constructor) + 2;
+ }
+
+ for (prop = obj->fjso_props; prop != NULL; prop = prop->fjsp_next) {
+ if (col + (len = strlen(prop->fjsp_desc) + 2) < 80) {
+ mdb_printf("%s%s", prop->fjsp_desc,
+ prop->fjsp_next != NULL ? ", " : "");
+ col += len;
+ } else {
+ mdb_printf("...");
+ break;
+ }
+ }
+
+ mdb_printf("\n", col);
+}
+
+static void
+dcmd_findjsobjects_help(void)
+{
+ mdb_printf("%s\n\n",
+"Finds all JavaScript objects in the V8 heap via brute force iteration over\n"
+"all mapped anonymous memory. (This can take up to several minutes on large\n"
+"dumps.) The output consists of representative objects, the number of\n"
+"instances of that object and the number of properties on the object --\n"
+"followed by the constructor and first few properties of the objects. Once\n"
+"run, subsequent calls to ::findjsobjects use cached data. If provided an\n"
+"address (and in the absence of -r, described below), ::findjsobjects treats\n"
+"the address as that of a representative object, and lists all instances of\n"
+"that object (that is, all objects that have a matching property signature).");
+
+ mdb_dec_indent(2);
+ mdb_printf("%<b>OPTIONS%</b>\n");
+ mdb_inc_indent(2);
+
+ mdb_printf("%s\n",
+" -b Include the heap denoted by the brk(2) (normally excluded)\n"
+" -c cons Display representative objects with the specified constructor\n"
+" -p prop Display representative objects that have the specified property\n"
+" -l List all objects that match the representative object\n"
+" -m Mark specified object for later reference determination via -r\n"
+" -r Find references to the specified and/or marked object(s)\n"
+" -v Provide verbose statistics\n");
+}
+
+static int
+dcmd_findjsobjects(uintptr_t addr,
+ uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ static findjsobjects_state_t fjs;
+ static findjsobjects_stats_t *stats = &fjs.fjs_stats;
+ findjsobjects_obj_t *obj;
+ struct ps_prochandle *Pr;
+ boolean_t references = B_FALSE, listlike = B_FALSE;
+ const char *propname = NULL;
+ const char *constructor = NULL;
+
+ fjs.fjs_verbose = B_FALSE;
+ fjs.fjs_brk = B_FALSE;
+ fjs.fjs_marking = B_FALSE;
+ fjs.fjs_allobjs = B_FALSE;
+
+ if (mdb_getopts(argc, argv,
+ 'a', MDB_OPT_SETBITS, B_TRUE, &fjs.fjs_allobjs,
+ 'b', MDB_OPT_SETBITS, B_TRUE, &fjs.fjs_brk,
+ 'c', MDB_OPT_STR, &constructor,
+ 'l', MDB_OPT_SETBITS, B_TRUE, &listlike,
+ 'm', MDB_OPT_SETBITS, B_TRUE, &fjs.fjs_marking,
+ 'p', MDB_OPT_STR, &propname,
+ 'r', MDB_OPT_SETBITS, B_TRUE, &references,
+ 'v', MDB_OPT_SETBITS, B_TRUE, &fjs.fjs_verbose,
+ NULL) != argc)
+ return (DCMD_USAGE);
+
+ if (!fjs.fjs_initialized) {
+ avl_create(&fjs.fjs_tree,
+ (int(*)(const void *, const void *))findjsobjects_cmp,
+ sizeof (findjsobjects_obj_t),
+ offsetof(findjsobjects_obj_t, fjso_node));
+
+ avl_create(&fjs.fjs_referents,
+ (int(*)(const void *, const void *))
+ findjsobjects_cmp_referents,
+ sizeof (findjsobjects_referent_t),
+ offsetof(findjsobjects_referent_t, fjsr_node));
+
+ fjs.fjs_initialized = B_TRUE;
+ }
+
+ if (avl_is_empty(&fjs.fjs_tree)) {
+ findjsobjects_obj_t **sorted;
+ int nobjs, i;
+ hrtime_t start = gethrtime();
+
+ if (mdb_get_xdata("pshandle", &Pr, sizeof (Pr)) == -1) {
+ mdb_warn("couldn't read pshandle xdata");
+ return (DCMD_ERR);
+ }
+
+ v8_silent++;
+
+ if (Pmapping_iter(Pr,
+ (proc_map_f *)findjsobjects_mapping, &fjs) != 0) {
+ v8_silent--;
+ return (DCMD_ERR);
+ }
+
+ if ((nobjs = avl_numnodes(&fjs.fjs_tree)) != 0) {
+ /*
+ * We have the objects -- now sort them.
+ */
+ sorted = mdb_alloc(nobjs * sizeof (void *),
+ UM_SLEEP | UM_GC);
+
+ for (obj = fjs.fjs_objects, i = 0; obj != NULL;
+ obj = obj->fjso_next, i++) {
+ sorted[i] = obj;
+ }
+
+ qsort(sorted, avl_numnodes(&fjs.fjs_tree),
+ sizeof (void *), findjsobjects_cmp_ninstances);
+
+ for (i = 1, fjs.fjs_objects = sorted[0]; i < nobjs; i++)
+ sorted[i - 1]->fjso_next = sorted[i];
+
+ sorted[nobjs - 1]->fjso_next = NULL;
+ }
+
+ v8_silent--;
+
+ if (fjs.fjs_verbose) {
+ const char *f = "findjsobjects: %30s => %d\n";
+ int elapsed = (int)((gethrtime() - start) / NANOSEC);
+
+ mdb_printf(f, "elapsed time (seconds)", elapsed);
+ mdb_printf(f, "heap objects", stats->fjss_heapobjs);
+ mdb_printf(f, "type reads", stats->fjss_typereads);
+ mdb_printf(f, "cached reads", stats->fjss_cached);
+ mdb_printf(f, "JavaScript objects", stats->fjss_jsobjs);
+ mdb_printf(f, "processed objects", stats->fjss_objects);
+ mdb_printf(f, "processed arrays", stats->fjss_arrays);
+ mdb_printf(f, "unique objects", stats->fjss_uniques);
+ }
+ }
+
+ if (listlike && !(flags & DCMD_ADDRSPEC)) {
+ if (propname != NULL || constructor != NULL) {
+ char opt = propname != NULL ? 'p' : 'c';
+
+ mdb_warn("cannot specify -l with -%c; instead, pipe "
+ "output of ::findjsobjects -%c to "
+ "::findjsobjects -l\n", opt, opt);
+ return (DCMD_ERR);
+ }
+
+ return (findjsobjects_match(&fjs, addr, flags,
+ findjsobjects_match_all, NULL));
+ }
+
+ if (propname != NULL) {
+ if (constructor != NULL) {
+ mdb_warn("cannot specify both a property name "
+ "and a constructor\n");
+ return (DCMD_ERR);
+ }
+
+ return (findjsobjects_match(&fjs, addr, flags,
+ findjsobjects_match_propname, propname));
+ }
+
+ if (constructor != NULL) {
+ return (findjsobjects_match(&fjs, addr, flags,
+ findjsobjects_match_constructor, constructor));
+ }
+
+ if (references && !(flags & DCMD_ADDRSPEC) &&
+ avl_is_empty(&fjs.fjs_referents)) {
+ mdb_warn("must specify or mark an object to find references\n");
+ return (DCMD_ERR);
+ }
+
+ if (fjs.fjs_marking && !(flags & DCMD_ADDRSPEC)) {
+ mdb_warn("must specify an object to mark\n");
+ return (DCMD_ERR);
+ }
+
+ if (references && fjs.fjs_marking) {
+ mdb_warn("can't both mark an object and find its references\n");
+ return (DCMD_ERR);
+ }
+
+ if (flags & DCMD_ADDRSPEC) {
+ findjsobjects_instance_t *inst, *head;
+
+ /*
+ * If we've been passed an address, it's to either list like
+ * objects (-l), mark an object (-m) or find references to the
+ * specified/marked objects (-r). (Note that the absence of
+ * any of these options implies -l.)
+ */
+ inst = findjsobjects_instance(&fjs, addr, &head);
+
+ if (inst == NULL) {
+ mdb_warn("%p is not a valid object\n", addr);
+ return (DCMD_ERR);
+ }
+
+ if (!references && !fjs.fjs_marking) {
+ for (inst = head; inst != NULL; inst = inst->fjsi_next)
+ mdb_printf("%p\n", inst->fjsi_addr);
+
+ return (DCMD_OK);
+ }
+
+ if (!listlike) {
+ findjsobjects_referent(&fjs, inst->fjsi_addr);
+ } else {
+ for (inst = head; inst != NULL; inst = inst->fjsi_next)
+ findjsobjects_referent(&fjs, inst->fjsi_addr);
+ }
+ }
+
+ if (references)
+ findjsobjects_references(&fjs);
+
+ if (references || fjs.fjs_marking)
+ return (DCMD_OK);
+
+ mdb_printf("%-?s %8s %8s %s\n", "OBJECT",
+ "#OBJECTS", "#PROPS", "CONSTRUCTOR: PROPS");
+
+ for (obj = fjs.fjs_objects; obj != NULL; obj = obj->fjso_next) {
+ if (obj->fjso_malformed && !fjs.fjs_allobjs)
+ continue;
+
+ findjsobjects_print(obj);
+ }
+
+ return (DCMD_OK);
+}
+
+/* ARGSUSED */
+static int
+dcmd_jsframe(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ uintptr_t fptr, raddr;
+ boolean_t opt_v = B_FALSE, opt_i = B_FALSE;
+ char *opt_f = NULL, *opt_p = NULL;
+
+ if (mdb_getopts(argc, argv,
+ 'v', MDB_OPT_SETBITS, B_TRUE, &opt_v,
+ 'i', MDB_OPT_SETBITS, B_TRUE, &opt_i,
+ 'f', MDB_OPT_STR, &opt_f,
+ 'p', MDB_OPT_STR, &opt_p, NULL) != argc)
+ return (DCMD_USAGE);
+
+ /*
+ * As with $C, we assume we are given a *pointer* to the frame pointer
+ * for a frame, rather than the actual frame pointer for the frame of
+ * interest. This is needed to show the instruction pointer, which is
+ * actually stored with the next frame. For debugging, this can be
+ * overridden with the "-i" option (for "immediate").
+ */
+ if (opt_i)
+ return (do_jsframe(addr, 0, opt_v, opt_f, opt_p));
+
+ if (mdb_vread(&raddr, sizeof (raddr),
+ addr + sizeof (uintptr_t)) == -1) {
+ mdb_warn("failed to read return address from %p",
+ addr + sizeof (uintptr_t));
+ return (DCMD_ERR);
+ }
+
+ if (mdb_vread(&fptr, sizeof (fptr), addr) == -1) {
+ mdb_warn("failed to read frame pointer from %p", addr);
+ return (DCMD_ERR);
+ }
+
+ if (fptr == NULL)
+ return (DCMD_OK);
+
+ return (do_jsframe(fptr, raddr, opt_v, opt_f, opt_p));
+}
+
+/* ARGSUSED */
+static int
+dcmd_jsprint(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ char *buf, *bufp;
+ size_t bufsz = 262144, len = bufsz;
+ jsobj_print_t jsop;
+ boolean_t opt_b = B_FALSE;
+ int rv, i;
+
+ bzero(&jsop, sizeof (jsop));
+ jsop.jsop_depth = 2;
+ jsop.jsop_printaddr = B_FALSE;
+
+ i = mdb_getopts(argc, argv,
+ 'a', MDB_OPT_SETBITS, B_TRUE, &jsop.jsop_printaddr,
+ 'b', MDB_OPT_SETBITS, B_TRUE, &opt_b,
+ 'd', MDB_OPT_UINT64, &jsop.jsop_depth, NULL);
+
+ if (opt_b)
+ jsop.jsop_baseaddr = addr;
+
+ do {
+ if (i != argc) {
+ const mdb_arg_t *member = &argv[i++];
+
+ if (member->a_type != MDB_TYPE_STRING)
+ return (DCMD_USAGE);
+
+ jsop.jsop_member = member->a_un.a_str;
+ }
+
+ for (;;) {
+ if ((buf = bufp =
+ mdb_zalloc(bufsz, UM_NOSLEEP)) == NULL)
+ return (DCMD_ERR);
+
+ jsop.jsop_bufp = &bufp;
+ jsop.jsop_lenp = &len;
+
+ rv = jsobj_print(addr, &jsop);
+
+ if (len > 0)
+ break;
+
+ mdb_free(buf, bufsz);
+ bufsz <<= 1;
+ len = bufsz;
+ }
+
+ if (jsop.jsop_member == NULL && rv != 0)
+ return (DCMD_ERR);
+
+ if (jsop.jsop_member && !jsop.jsop_found) {
+ if (jsop.jsop_baseaddr)
+ (void) mdb_printf("%p: ", jsop.jsop_baseaddr);
+
+ (void) mdb_printf("undefined%s",
+ i < argc ? " " : "");
+ } else {
+ (void) mdb_printf("%s%s", buf, i < argc &&
+ !isspace(buf[strlen(buf) - 1]) ? " " : "");
+ }
+
+ mdb_free(buf, bufsz);
+ jsop.jsop_found = B_FALSE;
+ jsop.jsop_baseaddr = NULL;
+ } while (i < argc);
+
+ mdb_printf("\n");
+
+ return (DCMD_OK);
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8field(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ v8_class_t *clp;
+ v8_field_t *flp;
+ const char *klass, *field;
+ uintptr_t offset = 0;
+
+ /*
+ * We may be invoked with either two arguments (class and field name) or
+ * three (an offset to save).
+ */
+ if (argc != 2 && argc != 3)
+ return (DCMD_USAGE);
+
+ if (argv[0].a_type != MDB_TYPE_STRING ||
+ argv[1].a_type != MDB_TYPE_STRING)
+ return (DCMD_USAGE);
+
+ klass = argv[0].a_un.a_str;
+ field = argv[1].a_un.a_str;
+
+ if (argc == 3) {
+ if (argv[2].a_type != MDB_TYPE_STRING)
+ return (DCMD_USAGE);
+
+ offset = mdb_strtoull(argv[2].a_un.a_str);
+ }
+
+ for (clp = v8_classes; clp != NULL; clp = clp->v8c_next)
+ if (strcmp(clp->v8c_name, klass) == 0)
+ break;
+
+ if (clp == NULL) {
+ (void) mdb_printf("error: no such class: \"%s\"", klass);
+ return (DCMD_ERR);
+ }
+
+ for (flp = clp->v8c_fields; flp != NULL; flp = flp->v8f_next)
+ if (strcmp(field, flp->v8f_name) == 0)
+ break;
+
+ if (flp == NULL) {
+ if (argc == 2) {
+ mdb_printf("error: no such field in class \"%s\": "
+ "\"%s\"", klass, field);
+ return (DCMD_ERR);
+ }
+
+ flp = conf_field_create(clp, field, offset);
+ if (flp == NULL) {
+ mdb_warn("failed to create field");
+ return (DCMD_ERR);
+ }
+ } else if (argc == 3) {
+ flp->v8f_offset = offset;
+ }
+
+ mdb_printf("%s::%s at offset 0x%x\n", klass, field, flp->v8f_offset);
+ return (DCMD_OK);
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8array(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ uint8_t type;
+ uintptr_t *array;
+ size_t ii, len;
+
+ if (read_typebyte(&type, addr) != 0)
+ return (DCMD_ERR);
+
+ if (type != V8_TYPE_FIXEDARRAY) {
+ mdb_warn("%p is not an instance of FixedArray\n", addr);
+ return (DCMD_ERR);
+ }
+
+ if (read_heap_array(addr, &array, &len, UM_SLEEP | UM_GC) != 0)
+ return (DCMD_ERR);
+
+ for (ii = 0; ii < len; ii++)
+ mdb_printf("%p\n", array[ii]);
+
+ return (DCMD_OK);
+}
+
+/* ARGSUSED */
+static int
+dcmd_jsstack(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ uintptr_t raddr;
+ boolean_t opt_v;
+ char *opt_f = NULL, *opt_p = NULL;
+
+ if (mdb_getopts(argc, argv,
+ 'v', MDB_OPT_SETBITS, B_TRUE, &opt_v,
+ 'f', MDB_OPT_STR, &opt_f,
+ 'p', MDB_OPT_STR, &opt_p,
+ NULL) != argc)
+ return (DCMD_USAGE);
+
+ /*
+ * The "::jsframe" walker iterates the valid frame pointers, but the
+ * "::jsframe" dcmd looks at the frame after the one it was given, so we
+ * have to explicitly examine the top frame here.
+ */
+ if (!(flags & DCMD_ADDRSPEC)) {
+ if (load_current_context(&addr, &raddr) != 0 ||
+ do_jsframe(addr, raddr, opt_v, opt_f, opt_p) != 0)
+ return (DCMD_ERR);
+ }
+
+ if (mdb_pwalk_dcmd("jsframe", "jsframe", argc, argv, addr) == -1)
+ return (DCMD_ERR);
+
+ return (DCMD_OK);
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8str(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ boolean_t opt_v = B_FALSE;
+ char buf[512 * 1024];
+ char *bufp;
+ size_t len;
+
+ if (mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, B_TRUE, &opt_v,
+ NULL) != argc)
+ return (DCMD_USAGE);
+
+ bufp = buf;
+ len = sizeof (buf);
+ if (jsstr_print(addr, (opt_v ? JSSTR_VERBOSE : JSSTR_NONE) |
+ JSSTR_QUOTED, &bufp, &len) != 0)
+ return (DCMD_ERR);
+
+ mdb_printf("%s\n", buf);
+ return (DCMD_OK);
+}
+
+static void
+dcmd_v8load_help(void)
+{
+ v8_cfg_t *cfp, **cfgpp;
+
+ mdb_printf(
+ "To traverse in-memory V8 structures, the V8 dmod requires\n"
+ "configuration that describes the layout of various V8 structures\n"
+ "in memory. Normally, this information is pulled from metadata\n"
+ "in the target binary. However, it's possible to use the module\n"
+ "with a binary not built with metadata by loading one of the\n"
+ "canned configurations.\n\n");
+
+ mdb_printf("Available configurations:\n");
+
+ (void) mdb_inc_indent(4);
+
+ for (cfgpp = v8_cfgs; *cfgpp != NULL; cfgpp++) {
+ cfp = *cfgpp;
+ mdb_printf("%-10s %s\n", cfp->v8cfg_name, cfp->v8cfg_label);
+ }
+
+ (void) mdb_dec_indent(4);
+}
+
+/* ARGSUSED */
+static int
+dcmd_v8load(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ v8_cfg_t *cfgp = NULL, **cfgpp;
+
+ if (v8_classes != NULL) {
+ mdb_warn("v8 module already configured\n");
+ return (DCMD_ERR);
+ }
+
+ if (argc < 1 || argv->a_type != MDB_TYPE_STRING)
+ return (DCMD_USAGE);
+
+ for (cfgpp = v8_cfgs; *cfgpp != NULL; cfgpp++) {
+ cfgp = *cfgpp;
+ if (strcmp(argv->a_un.a_str, cfgp->v8cfg_name) == 0)
+ break;
+ }
+
+ if (cfgp == NULL || cfgp->v8cfg_name == NULL) {
+ mdb_warn("unknown configuration: \"%s\"\n", argv->a_un.a_str);
+ return (DCMD_ERR);
+ }
+
+ if (autoconfigure(cfgp) == -1) {
+ mdb_warn("autoconfigure failed\n");
+ return (DCMD_ERR);
+ }
+
+ mdb_printf("V8 dmod configured based on %s\n", cfgp->v8cfg_name);
+ return (DCMD_OK);
+}
+
+static int
+walk_jsframes_init(mdb_walk_state_t *wsp)
+{
+ if (wsp->walk_addr != NULL)
+ return (WALK_NEXT);
+
+ if (load_current_context(&wsp->walk_addr, NULL) != 0)
+ return (WALK_ERR);
+
+ return (WALK_NEXT);
+}
+
+static int
+walk_jsframes_step(mdb_walk_state_t *wsp)
+{
+ uintptr_t addr, next;
+ int rv;
+
+ addr = wsp->walk_addr;
+ rv = wsp->walk_callback(wsp->walk_addr, NULL, wsp->walk_cbdata);
+
+ if (rv != WALK_NEXT)
+ return (rv);
+
+ if (mdb_vread(&next, sizeof (next), addr) == -1)
+ return (WALK_ERR);
+
+ if (next == NULL)
+ return (WALK_DONE);
+
+ wsp->walk_addr = next;
+ return (WALK_NEXT);
+}
+
+typedef struct jsprop_walk_data {
+ int jspw_nprops;
+ int jspw_current;
+ uintptr_t *jspw_props;
+} jsprop_walk_data_t;
+
+/*ARGSUSED*/
+static int
+walk_jsprop_nprops(const char *desc, uintptr_t val, void *arg)
+{
+ jsprop_walk_data_t *jspw = arg;
+ jspw->jspw_nprops++;
+
+ return (0);
+}
+
+/*ARGSUSED*/
+static int
+walk_jsprop_props(const char *desc, uintptr_t val, void *arg)
+{
+ jsprop_walk_data_t *jspw = arg;
+ jspw->jspw_props[jspw->jspw_current++] = val;
+
+ return (0);
+}
+
+static int
+walk_jsprop_init(mdb_walk_state_t *wsp)
+{
+ jsprop_walk_data_t *jspw;
+ uintptr_t addr;
+ uint8_t type;
+
+ if ((addr = wsp->walk_addr) == NULL) {
+ mdb_warn("'jsprop' does not support global walks\n");
+ return (WALK_ERR);
+ }
+
+ if (!V8_IS_HEAPOBJECT(addr) || read_typebyte(&type, addr) != 0 ||
+ type != V8_TYPE_JSOBJECT) {
+ mdb_warn("%p is not a JSObject\n", addr);
+ return (WALK_ERR);
+ }
+
+ jspw = mdb_zalloc(sizeof (jsprop_walk_data_t), UM_SLEEP | UM_GC);
+
+ if (jsobj_properties(addr, walk_jsprop_nprops, jspw) == -1) {
+ mdb_warn("couldn't iterate over properties for %p\n", addr);
+ return (WALK_ERR);
+ }
+
+ jspw->jspw_props = mdb_zalloc(jspw->jspw_nprops *
+ sizeof (uintptr_t), UM_SLEEP | UM_GC);
+
+ if (jsobj_properties(addr, walk_jsprop_props, jspw) == -1) {
+ mdb_warn("couldn't iterate over properties for %p\n", addr);
+ return (WALK_ERR);
+ }
+
+ jspw->jspw_current = 0;
+ wsp->walk_data = jspw;
+
+ return (WALK_NEXT);
+}
+
+static int
+walk_jsprop_step(mdb_walk_state_t *wsp)
+{
+ jsprop_walk_data_t *jspw = wsp->walk_data;
+ int rv;
+
+ if (jspw->jspw_current >= jspw->jspw_nprops)
+ return (WALK_DONE);
+
+ if ((rv = wsp->walk_callback(jspw->jspw_props[jspw->jspw_current++],
+ NULL, wsp->walk_cbdata)) != WALK_NEXT)
+ return (rv);
+
+ return (WALK_NEXT);
+}
+
+/*
+ * MDB linkage
+ */
+
+static const mdb_dcmd_t v8_mdb_dcmds[] = {
+ /*
+ * Commands to inspect JavaScript-level state
+ */
+ { "jsframe", ":[-iv] [-f function] [-p property]",
+ "summarize a JavaScript stack frame", dcmd_jsframe },
+ { "jsprint", ":[-ab] [-d depth] [member]", "print a JavaScript object",
+ dcmd_jsprint },
+ { "jsstack", "[-v] [-f function] [-p property]",
+ "print a JavaScript stacktrace", dcmd_jsstack },
+ { "findjsobjects", "?[-vb] [-r | -c cons | -p prop]", "find JavaScript "
+ "objects", dcmd_findjsobjects, dcmd_findjsobjects_help },
+
+ /*
+ * Commands to inspect V8-level state
+ */
+ { "v8array", ":", "print elements of a V8 FixedArray",
+ dcmd_v8array },
+ { "v8classes", NULL, "list known V8 heap object C++ classes",
+ dcmd_v8classes },
+ { "v8code", ":[-d]", "print information about a V8 Code object",
+ dcmd_v8code },
+ { "v8field", "classname fieldname offset",
+ "manually add a field to a given class", dcmd_v8field },
+ { "v8function", ":[-d]", "print JSFunction object details",
+ dcmd_v8function },
+ { "v8load", "version", "load canned config for a specific V8 version",
+ dcmd_v8load, dcmd_v8load_help },
+ { "v8frametypes", NULL, "list known V8 frame types",
+ dcmd_v8frametypes },
+ { "v8print", ":[class]", "print a V8 heap object",
+ dcmd_v8print, dcmd_v8print_help },
+ { "v8str", ":[-v]", "print the contents of a V8 string",
+ dcmd_v8str },
+ { "v8type", ":", "print the type of a V8 heap object",
+ dcmd_v8type },
+ { "v8types", NULL, "list known V8 heap object types",
+ dcmd_v8types },
+
+ { NULL }
+};
+
+static const mdb_walker_t v8_mdb_walkers[] = {
+ { "jsframe", "walk V8 JavaScript stack frames",
+ walk_jsframes_init, walk_jsframes_step },
+ { "jsprop", "walk property values for an object",
+ walk_jsprop_init, walk_jsprop_step },
+ { NULL }
+};
+
+static mdb_modinfo_t v8_mdb = { MDB_API_VERSION, v8_mdb_dcmds, v8_mdb_walkers };
+
+static void
+configure(void)
+{
+ char *success;
+ v8_cfg_t *cfgp = NULL;
+ GElf_Sym sym;
+
+ if (mdb_readsym(&v8_major, sizeof (v8_major),
+ "_ZN2v88internal7Version6major_E") == -1 ||
+ mdb_readsym(&v8_minor, sizeof (v8_minor),
+ "_ZN2v88internal7Version6minor_E") == -1 ||
+ mdb_readsym(&v8_build, sizeof (v8_build),
+ "_ZN2v88internal7Version6build_E") == -1 ||
+ mdb_readsym(&v8_patch, sizeof (v8_patch),
+ "_ZN2v88internal7Version6patch_E") == -1) {
+ mdb_warn("failed to determine V8 version");
+ return;
+ }
+
+ mdb_printf("V8 version: %d.%d.%d.%d\n",
+ v8_major, v8_minor, v8_build, v8_patch);
+
+ /*
+ * First look for debug metadata embedded within the binary, which may
+ * be present in recent V8 versions built with postmortem metadata.
+ */
+ if (mdb_lookup_by_name("v8dbg_SmiTag", &sym) == 0) {
+ cfgp = &v8_cfg_target;
+ success = "Autoconfigured V8 support from target";
+ } else if (v8_major == 3 && v8_minor == 1 && v8_build == 8) {
+ cfgp = &v8_cfg_04;
+ success = "Configured V8 support based on node v0.4";
+ } else if (v8_major == 3 && v8_minor == 6 && v8_build == 6) {
+ cfgp = &v8_cfg_06;
+ success = "Configured V8 support based on node v0.6";
+ } else {
+ mdb_printf("mdb_v8: target has no debug metadata and "
+ "no existing config found\n");
+ return;
+ }
+
+ if (autoconfigure(cfgp) != 0) {
+ mdb_warn("failed to autoconfigure from target; "
+ "commands may have incorrect results!\n");
+ return;
+ }
+
+ mdb_printf("%s\n", success);
+}
+
+static void
+enable_demangling(void)
+{
+ const char *symname = "_ZN2v88internal7Version6major_E";
+ GElf_Sym sym;
+ char buf[64];
+
+ /*
+ * Try to determine whether C++ symbol demangling has been enabled. If
+ * not, enable it.
+ */
+ if (mdb_lookup_by_name("_ZN2v88internal7Version6major_E", &sym) != 0)
+ return;
+
+ (void) mdb_snprintf(buf, sizeof (buf), "%a", sym.st_value);
+ if (strstr(buf, symname) != NULL)
+ (void) mdb_eval("$G");
+}
+
+const mdb_modinfo_t *
+_mdb_init(void)
+{
+ configure();
+ enable_demangling();
+ return (&v8_mdb);
+}
diff --git a/usr/src/cmd/mdb/common/modules/v8/mdb_v8_cfg.c b/usr/src/cmd/mdb/common/modules/v8/mdb_v8_cfg.c
new file mode 100644
index 0000000000..1f0b02689d
--- /dev/null
+++ b/usr/src/cmd/mdb/common/modules/v8/mdb_v8_cfg.c
@@ -0,0 +1,723 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * mdb_v8_cfg.c: canned configurations for previous V8 versions.
+ *
+ * The functions and data defined here enable this dmod to support debugging
+ * Node.js binaries that predated V8's built-in postmortem debugging support.
+ */
+
+#include "v8cfg.h"
+
+/*ARGSUSED*/
+static int
+v8cfg_target_iter(v8_cfg_t *cfgp, int (*func)(mdb_symbol_t *, void *),
+ void *arg)
+{
+ return (mdb_symbol_iter(MDB_OBJ_EVERY, MDB_DYNSYM,
+ MDB_BIND_GLOBAL | MDB_TYPE_OBJECT | MDB_TYPE_FUNC,
+ func, arg));
+}
+
+/*ARGSUSED*/
+static int
+v8cfg_target_readsym(v8_cfg_t *cfgp, const char *name, intptr_t *valp)
+{
+ return (mdb_readsym(valp, sizeof (valp), name));
+}
+
+/*
+ * Analog of mdb_symbol_iter() for a canned configuration.
+ */
+static int
+v8cfg_canned_iter(v8_cfg_t *cfgp, int (*func)(mdb_symbol_t *, void *),
+ void *arg)
+{
+ v8_cfg_symbol_t *v8sym;
+ mdb_symbol_t mdbsym;
+ int rv;
+
+ for (v8sym = cfgp->v8cfg_symbols; v8sym->v8cs_name != NULL; v8sym++) {
+ mdbsym.sym_name = v8sym->v8cs_name;
+ mdbsym.sym_object = NULL;
+ mdbsym.sym_sym = NULL;
+ mdbsym.sym_table = 0;
+ mdbsym.sym_id = 0;
+
+ if ((rv = func(&mdbsym, arg)) != 0)
+ return (rv);
+ }
+
+ return (0);
+}
+
+/*
+ * Analog of mdb_readsym() for a canned configuration.
+ */
+static int
+v8cfg_canned_readsym(v8_cfg_t *cfgp, const char *name, intptr_t *valp)
+{
+ v8_cfg_symbol_t *v8sym;
+
+ for (v8sym = cfgp->v8cfg_symbols; v8sym->v8cs_name != NULL; v8sym++) {
+ if (strcmp(name, v8sym->v8cs_name) == 0)
+ break;
+ }
+
+ if (v8sym->v8cs_name == NULL)
+ return (-1);
+
+ *valp = v8sym->v8cs_value;
+ return (0);
+}
+
+/*
+ * Canned configuration for the V8 bundled with Node.js v0.4.8 and later.
+ */
+static v8_cfg_symbol_t v8_symbols_node_04[] = {
+ { "v8dbg_type_AccessCheckInfo__ACCESS_CHECK_INFO_TYPE", 0x91 },
+ { "v8dbg_type_AccessorInfo__ACCESSOR_INFO_TYPE", 0x90 },
+ { "v8dbg_type_BreakPointInfo__BREAK_POINT_INFO_TYPE", 0x9b },
+ { "v8dbg_type_ByteArray__BYTE_ARRAY_TYPE", 0x86 },
+ { "v8dbg_type_CallHandlerInfo__CALL_HANDLER_INFO_TYPE", 0x93 },
+ { "v8dbg_type_Code__CODE_TYPE", 0x81 },
+ { "v8dbg_type_CodeCache__CODE_CACHE_TYPE", 0x99 },
+ { "v8dbg_type_ConsString__CONS_ASCII_STRING_TYPE", 0x5 },
+ { "v8dbg_type_ConsString__CONS_ASCII_SYMBOL_TYPE", 0x45 },
+ { "v8dbg_type_ConsString__CONS_STRING_TYPE", 0x1 },
+ { "v8dbg_type_ConsString__CONS_SYMBOL_TYPE", 0x41 },
+ { "v8dbg_type_DebugInfo__DEBUG_INFO_TYPE", 0x9a },
+ { "v8dbg_type_ExternalAsciiString__EXTERNAL_ASCII_STRING_TYPE", 0x6 },
+ { "v8dbg_type_ExternalAsciiString__EXTERNAL_ASCII_SYMBOL_TYPE", 0x46 },
+ { "v8dbg_type_ExternalByteArray__EXTERNAL_BYTE_ARRAY_TYPE", 0x88 },
+ { "v8dbg_type_ExternalFloatArray__EXTERNAL_FLOAT_ARRAY_TYPE", 0x8e },
+ { "v8dbg_type_ExternalIntArray__EXTERNAL_INT_ARRAY_TYPE", 0x8c },
+ { "v8dbg_type_ExternalShortArray__EXTERNAL_SHORT_ARRAY_TYPE", 0x8a },
+ { "v8dbg_type_ExternalString__EXTERNAL_STRING_TYPE", 0x2 },
+ { "v8dbg_type_ExternalString__EXTERNAL_SYMBOL_TYPE", 0x42 },
+ { "v8dbg_type_ExternalUnsignedByteArray__"
+ "EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE", 0x89 },
+ { "v8dbg_type_ExternalUnsignedIntArray__"
+ "EXTERNAL_UNSIGNED_INT_ARRAY_TYPE", 0x8d },
+ { "v8dbg_type_ExternalUnsignedShortArray__"
+ "EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE", 0x8b },
+ { "v8dbg_type_FixedArray__FIXED_ARRAY_TYPE", 0x9c },
+ { "v8dbg_type_FunctionTemplateInfo__"
+ "FUNCTION_TEMPLATE_INFO_TYPE", 0x94 },
+ { "v8dbg_type_HeapNumber__HEAP_NUMBER_TYPE", 0x84 },
+ { "v8dbg_type_InterceptorInfo__INTERCEPTOR_INFO_TYPE", 0x92 },
+ { "v8dbg_type_JSArray__JS_ARRAY_TYPE", 0xa5 },
+ { "v8dbg_type_JSBuiltinsObject__JS_BUILTINS_OBJECT_TYPE", 0xa3 },
+ { "v8dbg_type_JSFunction__JS_FUNCTION_TYPE", 0xa7 },
+ { "v8dbg_type_JSGlobalObject__JS_GLOBAL_OBJECT_TYPE", 0xa2 },
+ { "v8dbg_type_JSGlobalPropertyCell__"
+ "JS_GLOBAL_PROPERTY_CELL_TYPE", 0x83 },
+ { "v8dbg_type_JSGlobalProxy__JS_GLOBAL_PROXY_TYPE", 0xa4 },
+ { "v8dbg_type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE", 0x9e },
+ { "v8dbg_type_JSObject__JS_OBJECT_TYPE", 0xa0 },
+ { "v8dbg_type_JSRegExp__JS_REGEXP_TYPE", 0xa6 },
+ { "v8dbg_type_JSValue__JS_VALUE_TYPE", 0x9f },
+ { "v8dbg_type_Map__MAP_TYPE", 0x80 },
+ { "v8dbg_type_ObjectTemplateInfo__OBJECT_TEMPLATE_INFO_TYPE", 0x95 },
+ { "v8dbg_type_Oddball__ODDBALL_TYPE", 0x82 },
+ { "v8dbg_type_Script__SCRIPT_TYPE", 0x98 },
+ { "v8dbg_type_SeqAsciiString__ASCII_STRING_TYPE", 0x4 },
+ { "v8dbg_type_SeqAsciiString__ASCII_SYMBOL_TYPE", 0x44 },
+ { "v8dbg_type_SharedFunctionInfo__SHARED_FUNCTION_INFO_TYPE", 0x9d },
+ { "v8dbg_type_SignatureInfo__SIGNATURE_INFO_TYPE", 0x96 },
+ { "v8dbg_type_String__STRING_TYPE", 0x0 },
+ { "v8dbg_type_String__SYMBOL_TYPE", 0x40 },
+ { "v8dbg_type_TypeSwitchInfo__TYPE_SWITCH_INFO_TYPE", 0x97 },
+
+ { "v8dbg_class_AccessCheckInfo__data__Object", 0xc },
+ { "v8dbg_class_AccessCheckInfo__indexed_callback__Object", 0x8 },
+ { "v8dbg_class_AccessCheckInfo__named_callback__Object", 0x4 },
+ { "v8dbg_class_AccessorInfo__data__Object", 0xc },
+ { "v8dbg_class_AccessorInfo__flag__Smi", 0x14 },
+ { "v8dbg_class_AccessorInfo__getter__Object", 0x4 },
+ { "v8dbg_class_AccessorInfo__name__Object", 0x10 },
+ { "v8dbg_class_AccessorInfo__setter__Object", 0x8 },
+ { "v8dbg_class_BreakPointInfo__break_point_objects__Object", 0x10 },
+ { "v8dbg_class_BreakPointInfo__code_position__Smi", 0x4 },
+ { "v8dbg_class_BreakPointInfo__source_position__Smi", 0x8 },
+ { "v8dbg_class_BreakPointInfo__statement_position__Smi", 0xc },
+ { "v8dbg_class_ByteArray__length__SMI", 0x4 },
+ { "v8dbg_class_CallHandlerInfo__callback__Object", 0x4 },
+ { "v8dbg_class_CallHandlerInfo__data__Object", 0x8 },
+ { "v8dbg_class_Code__deoptimization_data__FixedArray", 0xc },
+ { "v8dbg_class_Code__instruction_size__int", 0x4 },
+ { "v8dbg_class_Code__instruction_start__int", 0x20 },
+ { "v8dbg_class_Code__relocation_info__ByteArray", 0x8 },
+ { "v8dbg_class_CodeCache__default_cache__FixedArray", 0x4 },
+ { "v8dbg_class_CodeCache__normal_type_cache__Object", 0x8 },
+ { "v8dbg_class_ConsString__first__String", 0xc },
+ { "v8dbg_class_ConsString__second__String", 0x10 },
+ { "v8dbg_class_DebugInfo__break_points__FixedArray", 0x14 },
+ { "v8dbg_class_DebugInfo__code__Code", 0xc },
+ { "v8dbg_class_DebugInfo__original_code__Code", 0x8 },
+ { "v8dbg_class_DebugInfo__shared__SharedFunctionInfo", 0x4 },
+ { "v8dbg_class_ExternalString__resource__Object", 0xc },
+ { "v8dbg_class_FixedArray__data__uintptr_t", 0x8 },
+ { "v8dbg_class_FixedArray__length__SMI", 0x4 },
+ { "v8dbg_class_FunctionTemplateInfo__access_check_info__Object", 0x38 },
+ { "v8dbg_class_FunctionTemplateInfo__call_code__Object", 0x10 },
+ { "v8dbg_class_FunctionTemplateInfo__class_name__Object", 0x2c },
+ { "v8dbg_class_FunctionTemplateInfo__flag__Smi", 0x3c },
+ { "v8dbg_class_FunctionTemplateInfo__"
+ "indexed_property_handler__Object", 0x24 },
+ { "v8dbg_class_FunctionTemplateInfo__"
+ "instance_call_handler__Object", 0x34 },
+ { "v8dbg_class_FunctionTemplateInfo__instance_template__Object", 0x28 },
+ { "v8dbg_class_FunctionTemplateInfo__"
+ "named_property_handler__Object", 0x20 },
+ { "v8dbg_class_FunctionTemplateInfo__parent_template__Object", 0x1c },
+ { "v8dbg_class_FunctionTemplateInfo__"
+ "property_accessors__Object", 0x14 },
+ { "v8dbg_class_FunctionTemplateInfo__"
+ "prototype_template__Object", 0x18 },
+ { "v8dbg_class_FunctionTemplateInfo__serial_number__Object", 0xc },
+ { "v8dbg_class_FunctionTemplateInfo__signature__Object", 0x30 },
+ { "v8dbg_class_GlobalObject__builtins__JSBuiltinsObject", 0xc },
+ { "v8dbg_class_GlobalObject__global_context__Context", 0x10 },
+ { "v8dbg_class_GlobalObject__global_receiver__JSObject", 0x14 },
+ { "v8dbg_class_HeapNumber__value__SMI", 0x4 },
+ { "v8dbg_class_HeapObject__map__Map", 0x0 },
+ { "v8dbg_class_InterceptorInfo__data__Object", 0x18 },
+ { "v8dbg_class_InterceptorInfo__deleter__Object", 0x10 },
+ { "v8dbg_class_InterceptorInfo__enumerator__Object", 0x14 },
+ { "v8dbg_class_InterceptorInfo__getter__Object", 0x4 },
+ { "v8dbg_class_InterceptorInfo__query__Object", 0xc },
+ { "v8dbg_class_InterceptorInfo__setter__Object", 0x8 },
+ { "v8dbg_class_JSArray__length__Object", 0xc },
+ { "v8dbg_class_JSFunction__literals__FixedArray", 0x1c },
+ { "v8dbg_class_JSFunction__next_function_link__Object", 0x20 },
+ { "v8dbg_class_JSFunction__prototype_or_initial_map__Object", 0x10 },
+ { "v8dbg_class_JSFunction__shared__SharedFunctionInfo", 0x14 },
+ { "v8dbg_class_JSGlobalProxy__context__Object", 0xc },
+ { "v8dbg_class_JSMessageObject__arguments__JSArray", 0x10 },
+ { "v8dbg_class_JSMessageObject__end_position__SMI", 0x24 },
+ { "v8dbg_class_JSMessageObject__script__Object", 0x14 },
+ { "v8dbg_class_JSMessageObject__stack_frames__Object", 0x1c },
+ { "v8dbg_class_JSMessageObject__stack_trace__Object", 0x18 },
+ { "v8dbg_class_JSMessageObject__start_position__SMI", 0x20 },
+ { "v8dbg_class_JSMessageObject__type__String", 0xc },
+ { "v8dbg_class_JSObject__elements__Object", 0x8 },
+ { "v8dbg_class_JSObject__properties__FixedArray", 0x4 },
+ { "v8dbg_class_JSRegExp__data__Object", 0xc },
+ { "v8dbg_class_JSValue__value__Object", 0xc },
+ { "v8dbg_class_Map__code_cache__Object", 0x18 },
+ { "v8dbg_class_Map__constructor__Object", 0x10 },
+ { "v8dbg_class_Map__inobject_properties__int", 0x5 },
+ { "v8dbg_class_Map__instance_size__int", 0x4 },
+ { "v8dbg_class_Map__instance_attributes__int", 0x8 },
+ { "v8dbg_class_Map__instance_descriptors__DescriptorArray", 0x14 },
+ { "v8dbg_class_ObjectTemplateInfo__constructor__Object", 0xc },
+ { "v8dbg_class_ObjectTemplateInfo__"
+ "internal_field_count__Object", 0x10 },
+ { "v8dbg_class_Oddball__to_number__Object", 0x8 },
+ { "v8dbg_class_Oddball__to_string__String", 0x4 },
+ { "v8dbg_class_Script__column_offset__Smi", 0x10 },
+ { "v8dbg_class_Script__compilation_type__Smi", 0x24 },
+ { "v8dbg_class_Script__context_data__Object", 0x18 },
+ { "v8dbg_class_Script__data__Object", 0x14 },
+ { "v8dbg_class_Script__eval_from_instructions_offset__Smi", 0x34 },
+ { "v8dbg_class_Script__eval_from_shared__Object", 0x30 },
+ { "v8dbg_class_Script__id__Object", 0x2c },
+ { "v8dbg_class_Script__line_ends__Object", 0x28 },
+ { "v8dbg_class_Script__line_offset__Smi", 0xc },
+ { "v8dbg_class_Script__name__Object", 0x8 },
+ { "v8dbg_class_Script__source__Object", 0x4 },
+ { "v8dbg_class_Script__type__Smi", 0x20 },
+ { "v8dbg_class_Script__wrapper__Proxy", 0x1c },
+ { "v8dbg_class_SeqAsciiString__chars__char", 0xc },
+ { "v8dbg_class_SharedFunctionInfo__code__Code", 0x8 },
+ { "v8dbg_class_SharedFunctionInfo__compiler_hints__SMI", 0x50 },
+ { "v8dbg_class_SharedFunctionInfo__construct_stub__Code", 0x10 },
+ { "v8dbg_class_SharedFunctionInfo__debug_info__Object", 0x20 },
+ { "v8dbg_class_SharedFunctionInfo__end_position__SMI", 0x48 },
+ { "v8dbg_class_SharedFunctionInfo__"
+ "expected_nof_properties__SMI", 0x3c },
+ { "v8dbg_class_SharedFunctionInfo__formal_parameter_count__SMI", 0x38 },
+ { "v8dbg_class_SharedFunctionInfo__function_data__Object", 0x18 },
+ { "v8dbg_class_SharedFunctionInfo__"
+ "function_token_position__SMI", 0x4c },
+ { "v8dbg_class_SharedFunctionInfo__inferred_name__String", 0x24 },
+ { "v8dbg_class_SharedFunctionInfo__initial_map__Object", 0x28 },
+ { "v8dbg_class_SharedFunctionInfo__instance_class_name__Object", 0x14 },
+ { "v8dbg_class_SharedFunctionInfo__length__SMI", 0x34 },
+ { "v8dbg_class_SharedFunctionInfo__name__Object", 0x4 },
+ { "v8dbg_class_SharedFunctionInfo__num_literals__SMI", 0x40 },
+ { "v8dbg_class_SharedFunctionInfo__opt_count__SMI", 0x58 },
+ { "v8dbg_class_SharedFunctionInfo__script__Object", 0x1c },
+ { "v8dbg_class_SharedFunctionInfo__"
+ "start_position_and_type__SMI", 0x44 },
+ { "v8dbg_class_SharedFunctionInfo__"
+ "this_property_assignments__Object", 0x2c },
+ { "v8dbg_class_SharedFunctionInfo__"
+ "this_property_assignments_count__SMI", 0x54 },
+ { "v8dbg_class_SignatureInfo__args__Object", 0x8 },
+ { "v8dbg_class_SignatureInfo__receiver__Object", 0x4 },
+ { "v8dbg_class_String__length__SMI", 0x4 },
+ { "v8dbg_class_TemplateInfo__property_list__Object", 0x8 },
+ { "v8dbg_class_TemplateInfo__tag__Object", 0x4 },
+ { "v8dbg_class_TypeSwitchInfo__types__Object", 0x4 },
+
+ { "v8dbg_parent_AccessCheckInfo__Struct", 0x0 },
+ { "v8dbg_parent_AccessorInfo__Struct", 0x0 },
+ { "v8dbg_parent_BreakPointInfo__Struct", 0x0 },
+ { "v8dbg_parent_ByteArray__HeapObject", 0x0 },
+ { "v8dbg_parent_CallHandlerInfo__Struct", 0x0 },
+ { "v8dbg_parent_Code__HeapObject", 0x0 },
+ { "v8dbg_parent_CodeCache__Struct", 0x0 },
+ { "v8dbg_parent_ConsString__String", 0x0 },
+ { "v8dbg_parent_DebugInfo__Struct", 0x0 },
+ { "v8dbg_parent_DeoptimizationInputData__FixedArray", 0x0 },
+ { "v8dbg_parent_DeoptimizationOutputData__FixedArray", 0x0 },
+ { "v8dbg_parent_DescriptorArray__FixedArray", 0x0 },
+ { "v8dbg_parent_ExternalArray__HeapObject", 0x0 },
+ { "v8dbg_parent_ExternalAsciiString__ExternalString", 0x0 },
+ { "v8dbg_parent_ExternalByteArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalFloatArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalIntArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalShortArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalString__String", 0x0 },
+ { "v8dbg_parent_ExternalTwoByteString__ExternalString", 0x0 },
+ { "v8dbg_parent_ExternalUnsignedByteArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalUnsignedIntArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalUnsignedShortArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_Failure__MaybeObject", 0x0 },
+ { "v8dbg_parent_FixedArray__HeapObject", 0x0 },
+ { "v8dbg_parent_FunctionTemplateInfo__TemplateInfo", 0x0 },
+ { "v8dbg_parent_GlobalObject__JSObject", 0x0 },
+ { "v8dbg_parent_HeapNumber__HeapObject", 0x0 },
+ { "v8dbg_parent_HeapObject__Object", 0x0 },
+ { "v8dbg_parent_InterceptorInfo__Struct", 0x0 },
+ { "v8dbg_parent_JSArray__JSObject", 0x0 },
+ { "v8dbg_parent_JSBuiltinsObject__GlobalObject", 0x0 },
+ { "v8dbg_parent_JSFunction__JSObject", 0x0 },
+ { "v8dbg_parent_JSFunctionResultCache__FixedArray", 0x0 },
+ { "v8dbg_parent_JSGlobalObject__GlobalObject", 0x0 },
+ { "v8dbg_parent_JSGlobalPropertyCell__HeapObject", 0x0 },
+ { "v8dbg_parent_JSGlobalProxy__JSObject", 0x0 },
+ { "v8dbg_parent_JSMessageObject__JSObject", 0x0 },
+ { "v8dbg_parent_JSObject__HeapObject", 0x0 },
+ { "v8dbg_parent_JSRegExp__JSObject", 0x0 },
+ { "v8dbg_parent_JSRegExpResult__JSArray", 0x0 },
+ { "v8dbg_parent_JSValue__JSObject", 0x0 },
+ { "v8dbg_parent_Map__HeapObject", 0x0 },
+ { "v8dbg_parent_NormalizedMapCache__FixedArray", 0x0 },
+ { "v8dbg_parent_Object__MaybeObject", 0x0 },
+ { "v8dbg_parent_ObjectTemplateInfo__TemplateInfo", 0x0 },
+ { "v8dbg_parent_Oddball__HeapObject", 0x0 },
+ { "v8dbg_parent_Script__Struct", 0x0 },
+ { "v8dbg_parent_SeqAsciiString__SeqString", 0x0 },
+ { "v8dbg_parent_SeqString__String", 0x0 },
+ { "v8dbg_parent_SeqTwoByteString__SeqString", 0x0 },
+ { "v8dbg_parent_SharedFunctionInfo__HeapObject", 0x0 },
+ { "v8dbg_parent_SignatureInfo__Struct", 0x0 },
+ { "v8dbg_parent_Smi__Object", 0x0 },
+ { "v8dbg_parent_String__HeapObject", 0x0 },
+ { "v8dbg_parent_Struct__HeapObject", 0x0 },
+ { "v8dbg_parent_TemplateInfo__Struct", 0x0 },
+ { "v8dbg_parent_TypeSwitchInfo__Struct", 0x0 },
+
+ { "v8dbg_frametype_ArgumentsAdaptorFrame", 0x8 },
+ { "v8dbg_frametype_ConstructFrame", 0x7 },
+ { "v8dbg_frametype_EntryConstructFrame", 0x2 },
+ { "v8dbg_frametype_EntryFrame", 0x1 },
+ { "v8dbg_frametype_ExitFrame", 0x3 },
+ { "v8dbg_frametype_InternalFrame", 0x6 },
+ { "v8dbg_frametype_JavaScriptFrame", 0x4 },
+ { "v8dbg_frametype_OptimizedFrame", 0x5 },
+
+ { "v8dbg_off_fp_context", -0x4 },
+ { "v8dbg_off_fp_function", -0x8 },
+ { "v8dbg_off_fp_marker", -0x8 },
+ { "v8dbg_off_fp_args", 0x8 },
+
+ { "v8dbg_prop_idx_content", 0x0 },
+ { "v8dbg_prop_idx_first", 0x2 },
+ { "v8dbg_prop_type_field", 0x1 },
+ { "v8dbg_prop_type_first_phantom", 0x6 },
+ { "v8dbg_prop_type_mask", 0xf },
+
+ { "v8dbg_AsciiStringTag", 0x4 },
+ { "v8dbg_ConsStringTag", 0x1 },
+ { "v8dbg_ExternalStringTag", 0x2 },
+ { "v8dbg_FailureTag", 0x3 },
+ { "v8dbg_FailureTagMask", 0x3 },
+ { "v8dbg_FirstNonstringType", 0x80 },
+ { "v8dbg_HeapObjectTag", 0x1 },
+ { "v8dbg_HeapObjectTagMask", 0x3 },
+ { "v8dbg_IsNotStringMask", 0x80 },
+ { "v8dbg_NotStringTag", 0x80 },
+ { "v8dbg_SeqStringTag", 0x0 },
+ { "v8dbg_SmiTag", 0x0 },
+ { "v8dbg_SmiTagMask", 0x1 },
+ { "v8dbg_SmiValueShift", 0x1 },
+ { "v8dbg_StringEncodingMask", 0x4 },
+ { "v8dbg_StringRepresentationMask", 0x3 },
+ { "v8dbg_StringTag", 0x0 },
+ { "v8dbg_TwoByteStringTag", 0x0 },
+ { "v8dbg_PointerSizeLog2", 0x2 },
+
+ { NULL }
+};
+
+/*
+ * Canned configuration for the V8 bundled with Node.js v0.6.5.
+ */
+static v8_cfg_symbol_t v8_symbols_node_06[] = {
+ { "v8dbg_type_AccessCheckInfo__ACCESS_CHECK_INFO_TYPE", 0x93 },
+ { "v8dbg_type_AccessorInfo__ACCESSOR_INFO_TYPE", 0x92 },
+ { "v8dbg_type_BreakPointInfo__BREAK_POINT_INFO_TYPE", 0x9e },
+ { "v8dbg_type_ByteArray__BYTE_ARRAY_TYPE", 0x86 },
+ { "v8dbg_type_CallHandlerInfo__CALL_HANDLER_INFO_TYPE", 0x95 },
+ { "v8dbg_type_Code__CODE_TYPE", 0x81 },
+ { "v8dbg_type_CodeCache__CODE_CACHE_TYPE", 0x9b },
+ { "v8dbg_type_ConsString__CONS_ASCII_STRING_TYPE", 0x5 },
+ { "v8dbg_type_ConsString__CONS_ASCII_SYMBOL_TYPE", 0x45 },
+ { "v8dbg_type_ConsString__CONS_STRING_TYPE", 0x1 },
+ { "v8dbg_type_ConsString__CONS_SYMBOL_TYPE", 0x41 },
+ { "v8dbg_type_DebugInfo__DEBUG_INFO_TYPE", 0x9d },
+ { "v8dbg_type_ExternalAsciiString__EXTERNAL_ASCII_STRING_TYPE", 0x6 },
+ { "v8dbg_type_ExternalAsciiString__EXTERNAL_ASCII_SYMBOL_TYPE", 0x46 },
+ { "v8dbg_type_ExternalByteArray__EXTERNAL_BYTE_ARRAY_TYPE", 0x87 },
+ { "v8dbg_type_ExternalDoubleArray__EXTERNAL_DOUBLE_ARRAY_TYPE", 0x8e },
+ { "v8dbg_type_ExternalFloatArray__EXTERNAL_FLOAT_ARRAY_TYPE", 0x8d },
+ { "v8dbg_type_ExternalIntArray__EXTERNAL_INT_ARRAY_TYPE", 0x8b },
+ { "v8dbg_type_ExternalPixelArray__EXTERNAL_PIXEL_ARRAY_TYPE", 0x8f },
+ { "v8dbg_type_ExternalShortArray__EXTERNAL_SHORT_ARRAY_TYPE", 0x89 },
+ { "v8dbg_type_ExternalTwoByteString__EXTERNAL_STRING_TYPE", 0x2 },
+ { "v8dbg_type_ExternalTwoByteString__EXTERNAL_SYMBOL_TYPE", 0x42 },
+ { "v8dbg_type_ExternalUnsignedByteArray__"
+ "EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE", 0x88 },
+ { "v8dbg_type_ExternalUnsignedIntArray__"
+ "EXTERNAL_UNSIGNED_INT_ARRAY_TYPE", 0x8c },
+ { "v8dbg_type_ExternalUnsignedShortArray__"
+ "EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE", 0x8a },
+ { "v8dbg_type_FixedArray__FIXED_ARRAY_TYPE", 0x9f },
+ { "v8dbg_type_FixedDoubleArray__FIXED_DOUBLE_ARRAY_TYPE", 0x90 },
+ { "v8dbg_type_Foreign__FOREIGN_TYPE", 0x85 },
+ { "v8dbg_type_FunctionTemplateInfo__FUNCTION_TEMPLATE_INFO_TYPE",
+ 0x96 },
+ { "v8dbg_type_HeapNumber__HEAP_NUMBER_TYPE", 0x84 },
+ { "v8dbg_type_InterceptorInfo__INTERCEPTOR_INFO_TYPE", 0x94 },
+ { "v8dbg_type_JSArray__JS_ARRAY_TYPE", 0xa8 },
+ { "v8dbg_type_JSBuiltinsObject__JS_BUILTINS_OBJECT_TYPE", 0xa6 },
+ { "v8dbg_type_JSFunction__JS_FUNCTION_TYPE", 0xac },
+ { "v8dbg_type_JSFunctionProxy__JS_FUNCTION_PROXY_TYPE", 0xad },
+ { "v8dbg_type_JSGlobalObject__JS_GLOBAL_OBJECT_TYPE", 0xa5 },
+ { "v8dbg_type_JSGlobalPropertyCell__JS_GLOBAL_PROPERTY_CELL_TYPE",
+ 0x83 },
+ { "v8dbg_type_JSMessageObject__JS_MESSAGE_OBJECT_TYPE", 0xa1 },
+ { "v8dbg_type_JSObject__JS_OBJECT_TYPE", 0xa3 },
+ { "v8dbg_type_JSProxy__JS_PROXY_TYPE", 0xa9 },
+ { "v8dbg_type_JSRegExp__JS_REGEXP_TYPE", 0xab },
+ { "v8dbg_type_JSValue__JS_VALUE_TYPE", 0xa2 },
+ { "v8dbg_type_JSWeakMap__JS_WEAK_MAP_TYPE", 0xaa },
+ { "v8dbg_type_Map__MAP_TYPE", 0x80 },
+ { "v8dbg_type_ObjectTemplateInfo__OBJECT_TEMPLATE_INFO_TYPE", 0x97 },
+ { "v8dbg_type_Oddball__ODDBALL_TYPE", 0x82 },
+ { "v8dbg_type_PolymorphicCodeCache__POLYMORPHIC_CODE_CACHE_TYPE",
+ 0x9c },
+ { "v8dbg_type_Script__SCRIPT_TYPE", 0x9a },
+ { "v8dbg_type_SeqAsciiString__ASCII_STRING_TYPE", 0x4 },
+ { "v8dbg_type_SeqAsciiString__ASCII_SYMBOL_TYPE", 0x44 },
+ { "v8dbg_type_SeqTwoByteString__STRING_TYPE", 0x0 },
+ { "v8dbg_type_SeqTwoByteString__SYMBOL_TYPE", 0x40 },
+ { "v8dbg_type_SharedFunctionInfo__SHARED_FUNCTION_INFO_TYPE", 0xa0 },
+ { "v8dbg_type_SignatureInfo__SIGNATURE_INFO_TYPE", 0x98 },
+ { "v8dbg_type_SlicedString__SLICED_ASCII_STRING_TYPE", 0x7 },
+ { "v8dbg_type_SlicedString__SLICED_STRING_TYPE", 0x3 },
+ { "v8dbg_type_TypeSwitchInfo__TYPE_SWITCH_INFO_TYPE", 0x99 },
+
+ { "v8dbg_class_AccessCheckInfo__data__Object", 0xc },
+ { "v8dbg_class_AccessCheckInfo__indexed_callback__Object", 0x8 },
+ { "v8dbg_class_AccessCheckInfo__named_callback__Object", 0x4 },
+ { "v8dbg_class_AccessorInfo__data__Object", 0xc },
+ { "v8dbg_class_AccessorInfo__flag__Smi", 0x14 },
+ { "v8dbg_class_AccessorInfo__getter__Object", 0x4 },
+ { "v8dbg_class_AccessorInfo__name__Object", 0x10 },
+ { "v8dbg_class_AccessorInfo__setter__Object", 0x8 },
+ { "v8dbg_class_BreakPointInfo__break_point_objects__Object", 0x10 },
+ { "v8dbg_class_BreakPointInfo__code_position__Smi", 0x4 },
+ { "v8dbg_class_BreakPointInfo__source_position__Smi", 0x8 },
+ { "v8dbg_class_BreakPointInfo__statement_position__Smi", 0xc },
+ { "v8dbg_class_CallHandlerInfo__callback__Object", 0x4 },
+ { "v8dbg_class_CallHandlerInfo__data__Object", 0x8 },
+ { "v8dbg_class_Code__deoptimization_data__FixedArray", 0xc },
+ { "v8dbg_class_Code__instruction_size__int", 0x4 },
+ { "v8dbg_class_Code__instruction_start__int", 0x20 },
+ { "v8dbg_class_Code__next_code_flushing_candidate__Object", 0x10 },
+ { "v8dbg_class_Code__relocation_info__ByteArray", 0x8 },
+ { "v8dbg_class_CodeCache__default_cache__FixedArray", 0x4 },
+ { "v8dbg_class_CodeCache__normal_type_cache__Object", 0x8 },
+ { "v8dbg_class_ConsString__first__String", 0xc },
+ { "v8dbg_class_ConsString__second__String", 0x10 },
+ { "v8dbg_class_DebugInfo__break_points__FixedArray", 0x14 },
+ { "v8dbg_class_DebugInfo__code__Code", 0xc },
+ { "v8dbg_class_DebugInfo__original_code__Code", 0x8 },
+ { "v8dbg_class_DebugInfo__shared__SharedFunctionInfo", 0x4 },
+ { "v8dbg_class_ExternalString__resource__Object", 0xc },
+ { "v8dbg_class_FixedArray__data__uintptr_t", 0x8 },
+ { "v8dbg_class_FixedArrayBase__length__SMI", 0x4 },
+ { "v8dbg_class_FunctionTemplateInfo__access_check_info__Object", 0x38 },
+ { "v8dbg_class_FunctionTemplateInfo__call_code__Object", 0x10 },
+ { "v8dbg_class_FunctionTemplateInfo__class_name__Object", 0x2c },
+ { "v8dbg_class_FunctionTemplateInfo__flag__Smi", 0x3c },
+ { "v8dbg_class_FunctionTemplateInfo__indexed_property_handler__Object",
+ 0x24 },
+ { "v8dbg_class_FunctionTemplateInfo__instance_call_handler__Object",
+ 0x34 },
+ { "v8dbg_class_FunctionTemplateInfo__instance_template__Object", 0x28 },
+ { "v8dbg_class_FunctionTemplateInfo__named_property_handler__Object",
+ 0x20 },
+ { "v8dbg_class_FunctionTemplateInfo__parent_template__Object", 0x1c },
+ { "v8dbg_class_FunctionTemplateInfo__property_accessors__Object",
+ 0x14 },
+ { "v8dbg_class_FunctionTemplateInfo__prototype_template__Object",
+ 0x18 },
+ { "v8dbg_class_FunctionTemplateInfo__serial_number__Object", 0xc },
+ { "v8dbg_class_FunctionTemplateInfo__signature__Object", 0x30 },
+ { "v8dbg_class_GlobalObject__builtins__JSBuiltinsObject", 0xc },
+ { "v8dbg_class_GlobalObject__global_context__Context", 0x10 },
+ { "v8dbg_class_GlobalObject__global_receiver__JSObject", 0x14 },
+ { "v8dbg_class_HeapNumber__value__double", 0x4 },
+ { "v8dbg_class_HeapObject__map__Map", 0x0 },
+ { "v8dbg_class_InterceptorInfo__data__Object", 0x18 },
+ { "v8dbg_class_InterceptorInfo__deleter__Object", 0x10 },
+ { "v8dbg_class_InterceptorInfo__enumerator__Object", 0x14 },
+ { "v8dbg_class_InterceptorInfo__getter__Object", 0x4 },
+ { "v8dbg_class_InterceptorInfo__query__Object", 0xc },
+ { "v8dbg_class_InterceptorInfo__setter__Object", 0x8 },
+ { "v8dbg_class_JSArray__length__Object", 0xc },
+ { "v8dbg_class_JSFunction__literals__FixedArray", 0x1c },
+ { "v8dbg_class_JSFunction__next_function_link__Object", 0x20 },
+ { "v8dbg_class_JSFunction__prototype_or_initial_map__Object", 0x10 },
+ { "v8dbg_class_JSFunction__shared__SharedFunctionInfo", 0x14 },
+ { "v8dbg_class_JSFunctionProxy__call_trap__Object", 0x8 },
+ { "v8dbg_class_JSFunctionProxy__construct_trap__Object", 0xc },
+ { "v8dbg_class_JSGlobalProxy__context__Object", 0xc },
+ { "v8dbg_class_JSMessageObject__arguments__JSArray", 0x10 },
+ { "v8dbg_class_JSMessageObject__end_position__SMI", 0x24 },
+ { "v8dbg_class_JSMessageObject__script__Object", 0x14 },
+ { "v8dbg_class_JSMessageObject__stack_frames__Object", 0x1c },
+ { "v8dbg_class_JSMessageObject__stack_trace__Object", 0x18 },
+ { "v8dbg_class_JSMessageObject__start_position__SMI", 0x20 },
+ { "v8dbg_class_JSMessageObject__type__String", 0xc },
+ { "v8dbg_class_JSObject__elements__Object", 0x8 },
+ { "v8dbg_class_JSObject__properties__FixedArray", 0x4 },
+ { "v8dbg_class_JSProxy__handler__Object", 0x4 },
+ { "v8dbg_class_JSRegExp__data__Object", 0xc },
+ { "v8dbg_class_JSValue__value__Object", 0xc },
+ { "v8dbg_class_JSWeakMap__next__Object", 0x10 },
+ { "v8dbg_class_JSWeakMap__table__ObjectHashTable", 0xc },
+ { "v8dbg_class_Map__code_cache__Object", 0x18 },
+ { "v8dbg_class_Map__constructor__Object", 0x10 },
+ { "v8dbg_class_Map__inobject_properties__int", 0x5 },
+ { "v8dbg_class_Map__instance_attributes__int", 0x8 },
+ { "v8dbg_class_Map__instance_descriptors__FixedArray", 0x14 },
+ { "v8dbg_class_Map__instance_size__int", 0x4 },
+ { "v8dbg_class_Map__prototype_transitions__FixedArray", 0x1c },
+ { "v8dbg_class_ObjectTemplateInfo__constructor__Object", 0xc },
+ { "v8dbg_class_ObjectTemplateInfo__internal_field_count__Object",
+ 0x10 },
+ { "v8dbg_class_Oddball__to_number__Object", 0x8 },
+ { "v8dbg_class_Oddball__to_string__String", 0x4 },
+ { "v8dbg_class_PolymorphicCodeCache__cache__Object", 0x4 },
+ { "v8dbg_class_Script__column_offset__Smi", 0x10 },
+ { "v8dbg_class_Script__compilation_type__Smi", 0x24 },
+ { "v8dbg_class_Script__context_data__Object", 0x18 },
+ { "v8dbg_class_Script__data__Object", 0x14 },
+ { "v8dbg_class_Script__eval_from_instructions_offset__Smi", 0x34 },
+ { "v8dbg_class_Script__eval_from_shared__Object", 0x30 },
+ { "v8dbg_class_Script__id__Object", 0x2c },
+ { "v8dbg_class_Script__line_ends__Object", 0x28 },
+ { "v8dbg_class_Script__line_offset__Smi", 0xc },
+ { "v8dbg_class_Script__name__Object", 0x8 },
+ { "v8dbg_class_Script__source__Object", 0x4 },
+ { "v8dbg_class_Script__type__Smi", 0x20 },
+ { "v8dbg_class_Script__wrapper__Foreign", 0x1c },
+ { "v8dbg_class_SeqAsciiString__chars__char", 0xc },
+ { "v8dbg_class_SharedFunctionInfo__code__Code", 0x8 },
+ { "v8dbg_class_SharedFunctionInfo__compiler_hints__SMI", 0x50 },
+ { "v8dbg_class_SharedFunctionInfo__construct_stub__Code", 0x10 },
+ { "v8dbg_class_SharedFunctionInfo__debug_info__Object", 0x20 },
+ { "v8dbg_class_SharedFunctionInfo__end_position__SMI", 0x48 },
+ { "v8dbg_class_SharedFunctionInfo__expected_nof_properties__SMI",
+ 0x3c },
+ { "v8dbg_class_SharedFunctionInfo__formal_parameter_count__SMI", 0x38 },
+ { "v8dbg_class_SharedFunctionInfo__function_data__Object", 0x18 },
+ { "v8dbg_class_SharedFunctionInfo__function_token_position__SMI",
+ 0x4c },
+ { "v8dbg_class_SharedFunctionInfo__inferred_name__String", 0x24 },
+ { "v8dbg_class_SharedFunctionInfo__initial_map__Object", 0x28 },
+ { "v8dbg_class_SharedFunctionInfo__instance_class_name__Object", 0x14 },
+ { "v8dbg_class_SharedFunctionInfo__length__SMI", 0x34 },
+ { "v8dbg_class_SharedFunctionInfo__name__Object", 0x4 },
+ { "v8dbg_class_SharedFunctionInfo__num_literals__SMI", 0x40 },
+ { "v8dbg_class_SharedFunctionInfo__opt_count__SMI", 0x58 },
+ { "v8dbg_class_SharedFunctionInfo__script__Object", 0x1c },
+ { "v8dbg_class_SharedFunctionInfo__"
+ "start_position_and_type__SMI", 0x44 },
+ { "v8dbg_class_SharedFunctionInfo__"
+ "this_property_assignments__Object", 0x2c },
+ { "v8dbg_class_SharedFunctionInfo__"
+ "this_property_assignments_count__SMI", 0x54 },
+ { "v8dbg_class_SignatureInfo__args__Object", 0x8 },
+ { "v8dbg_class_SignatureInfo__receiver__Object", 0x4 },
+ { "v8dbg_class_SlicedString__offset__SMI", 0x10 },
+ { "v8dbg_class_String__length__SMI", 0x4 },
+ { "v8dbg_class_TemplateInfo__property_list__Object", 0x8 },
+ { "v8dbg_class_TemplateInfo__tag__Object", 0x4 },
+ { "v8dbg_class_TypeSwitchInfo__types__Object", 0x4 },
+
+ { "v8dbg_parent_AccessCheckInfo__Struct", 0x0 },
+ { "v8dbg_parent_AccessorInfo__Struct", 0x0 },
+ { "v8dbg_parent_BreakPointInfo__Struct", 0x0 },
+ { "v8dbg_parent_ByteArray__FixedArrayBase", 0x0 },
+ { "v8dbg_parent_CallHandlerInfo__Struct", 0x0 },
+ { "v8dbg_parent_Code__HeapObject", 0x0 },
+ { "v8dbg_parent_CodeCache__Struct", 0x0 },
+ { "v8dbg_parent_ConsString__String", 0x0 },
+ { "v8dbg_parent_DebugInfo__Struct", 0x0 },
+ { "v8dbg_parent_DeoptimizationInputData__FixedArray", 0x0 },
+ { "v8dbg_parent_DeoptimizationOutputData__FixedArray", 0x0 },
+ { "v8dbg_parent_DescriptorArray__FixedArray", 0x0 },
+ { "v8dbg_parent_ExternalArray__FixedArrayBase", 0x0 },
+ { "v8dbg_parent_ExternalAsciiString__ExternalString", 0x0 },
+ { "v8dbg_parent_ExternalByteArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalDoubleArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalFloatArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalIntArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalPixelArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalShortArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalString__String", 0x0 },
+ { "v8dbg_parent_ExternalTwoByteString__ExternalString", 0x0 },
+ { "v8dbg_parent_ExternalUnsignedByteArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalUnsignedIntArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_ExternalUnsignedShortArray__ExternalArray", 0x0 },
+ { "v8dbg_parent_Failure__MaybeObject", 0x0 },
+ { "v8dbg_parent_FixedArray__FixedArrayBase", 0x0 },
+ { "v8dbg_parent_FixedArrayBase__HeapObject", 0x0 },
+ { "v8dbg_parent_FixedDoubleArray__FixedArrayBase", 0x0 },
+ { "v8dbg_parent_Foreign__HeapObject", 0x0 },
+ { "v8dbg_parent_FunctionTemplateInfo__TemplateInfo", 0x0 },
+ { "v8dbg_parent_GlobalObject__JSObject", 0x0 },
+ { "v8dbg_parent_HashTable__FixedArray", 0x0 },
+ { "v8dbg_parent_HeapNumber__HeapObject", 0x0 },
+ { "v8dbg_parent_HeapObject__Object", 0x0 },
+ { "v8dbg_parent_InterceptorInfo__Struct", 0x0 },
+ { "v8dbg_parent_JSArray__JSObject", 0x0 },
+ { "v8dbg_parent_JSBuiltinsObject__GlobalObject", 0x0 },
+ { "v8dbg_parent_JSFunction__JSObject", 0x0 },
+ { "v8dbg_parent_JSFunctionProxy__JSProxy", 0x0 },
+ { "v8dbg_parent_JSFunctionResultCache__FixedArray", 0x0 },
+ { "v8dbg_parent_JSGlobalObject__GlobalObject", 0x0 },
+ { "v8dbg_parent_JSGlobalPropertyCell__HeapObject", 0x0 },
+ { "v8dbg_parent_JSMessageObject__JSObject", 0x0 },
+ { "v8dbg_parent_JSObject__JSReceiver", 0x0 },
+ { "v8dbg_parent_JSProxy__JSReceiver", 0x0 },
+ { "v8dbg_parent_JSReceiver__HeapObject", 0x0 },
+ { "v8dbg_parent_JSRegExp__JSObject", 0x0 },
+ { "v8dbg_parent_JSRegExpResult__JSArray", 0x0 },
+ { "v8dbg_parent_JSValue__JSObject", 0x0 },
+ { "v8dbg_parent_JSWeakMap__JSObject", 0x0 },
+ { "v8dbg_parent_Map__HeapObject", 0x0 },
+ { "v8dbg_parent_NormalizedMapCache__FixedArray", 0x0 },
+ { "v8dbg_parent_ObjectTemplateInfo__TemplateInfo", 0x0 },
+ { "v8dbg_parent_Oddball__HeapObject", 0x0 },
+ { "v8dbg_parent_PolymorphicCodeCache__Struct", 0x0 },
+ { "v8dbg_parent_Script__Struct", 0x0 },
+ { "v8dbg_parent_SeqAsciiString__SeqString", 0x0 },
+ { "v8dbg_parent_SeqString__String", 0x0 },
+ { "v8dbg_parent_SeqTwoByteString__SeqString", 0x0 },
+ { "v8dbg_parent_SharedFunctionInfo__HeapObject", 0x0 },
+ { "v8dbg_parent_SignatureInfo__Struct", 0x0 },
+ { "v8dbg_parent_SlicedString__String", 0x0 },
+ { "v8dbg_parent_Smi__Object", 0x0 },
+ { "v8dbg_parent_String__HeapObject", 0x0 },
+ { "v8dbg_parent_Struct__HeapObject", 0x0 },
+ { "v8dbg_parent_TemplateInfo__Struct", 0x0 },
+ { "v8dbg_parent_TypeSwitchInfo__Struct", 0x0 },
+
+ { "v8dbg_frametype_ArgumentsAdaptorFrame", 0x8 },
+ { "v8dbg_frametype_ConstructFrame", 0x7 },
+ { "v8dbg_frametype_EntryConstructFrame", 0x2 },
+ { "v8dbg_frametype_EntryFrame", 0x1 },
+ { "v8dbg_frametype_ExitFrame", 0x3 },
+ { "v8dbg_frametype_InternalFrame", 0x6 },
+ { "v8dbg_frametype_JavaScriptFrame", 0x4 },
+ { "v8dbg_frametype_OptimizedFrame", 0x5 },
+
+ { "v8dbg_off_fp_args", 0x8 },
+ { "v8dbg_off_fp_context", -0x4 },
+ { "v8dbg_off_fp_function", -0x8 },
+ { "v8dbg_off_fp_marker", -0x8 },
+
+ { "v8dbg_prop_idx_content", 0x1 },
+ { "v8dbg_prop_idx_first", 0x3 },
+ { "v8dbg_prop_type_field", 0x1 },
+ { "v8dbg_prop_type_first_phantom", 0x6 },
+ { "v8dbg_prop_type_mask", 0xf },
+
+ { "v8dbg_AsciiStringTag", 0x4 },
+ { "v8dbg_PointerSizeLog2", 0x2 },
+ { "v8dbg_SeqStringTag", 0x0 },
+ { "v8dbg_SmiTag", 0x0 },
+ { "v8dbg_SmiTagMask", 0x1 },
+ { "v8dbg_SmiValueShift", 0x1 },
+ { "v8dbg_StringEncodingMask", 0x4 },
+ { "v8dbg_StringRepresentationMask", 0x3 },
+ { "v8dbg_StringTag", 0x0 },
+ { "v8dbg_TwoByteStringTag", 0x0 },
+ { "v8dbg_ConsStringTag", 0x1 },
+ { "v8dbg_ExternalStringTag", 0x2 },
+ { "v8dbg_FailureTag", 0x3 },
+ { "v8dbg_FailureTagMask", 0x3 },
+ { "v8dbg_FirstNonstringType", 0x80 },
+ { "v8dbg_HeapObjectTag", 0x1 },
+ { "v8dbg_HeapObjectTagMask", 0x3 },
+ { "v8dbg_IsNotStringMask", 0x80 },
+ { "v8dbg_NotStringTag", 0x80 },
+
+ { NULL },
+};
+
+v8_cfg_t v8_cfg_04 = { "node-0.4", "node v0.4", v8_symbols_node_04,
+ v8cfg_canned_iter, v8cfg_canned_readsym };
+
+v8_cfg_t v8_cfg_06 = { "node-0.6", "node v0.6", v8_symbols_node_06,
+ v8cfg_canned_iter, v8cfg_canned_readsym };
+
+v8_cfg_t *v8_cfgs[] = {
+ &v8_cfg_04,
+ &v8_cfg_06,
+ NULL
+};
+
+v8_cfg_t v8_cfg_target = { NULL, NULL, NULL, v8cfg_target_iter,
+ v8cfg_target_readsym };
diff --git a/usr/src/lib/print/libpapi-common/common/uri.h b/usr/src/cmd/mdb/common/modules/v8/v8cfg.h
index 5dd714a199..9e722b0e2b 100644
--- a/usr/src/lib/print/libpapi-common/common/uri.h
+++ b/usr/src/cmd/mdb/common/modules/v8/v8cfg.h
@@ -18,49 +18,38 @@
*
* CDDL HEADER END
*/
-
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
-#ifndef _URI_H
-#define _URI_H
-
-/* $Id: uri.h 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*
- * scheme://[[user[:password]@]host[:port]]/path[[#fragment]|[?query]]
+ * v8cfg.h: canned configurations for previous V8 versions
*/
-typedef struct {
- char *scheme;
- char *scheme_part;
- char *user;
- char *password;
- char *host;
- char *port;
- char *path;
- char *fragment;
- char *query;
- /* really for testing, but left in */
- char *user_part;
- char *host_part;
- char *path_part;
-} uri_t;
-extern int uri_from_string(char *string, uri_t **uri);
-extern int uri_to_string(uri_t *uri, char *buffer, size_t buflen);
-extern void uri_free(uri_t *uri);
+#ifndef V8CFG_H
+#define V8CFG_H
-#ifdef __cplusplus
-}
-#endif
+#include <sys/types.h>
+#include <sys/mdb_modapi.h>
-#endif /* _URI_H */
+typedef struct {
+ const char *v8cs_name; /* symbol name */
+ intptr_t v8cs_value; /* symbol value */
+} v8_cfg_symbol_t;
+
+typedef struct v8_cfg {
+ const char *v8cfg_name; /* canned config name */
+ const char *v8cfg_label; /* description */
+ v8_cfg_symbol_t *v8cfg_symbols; /* actual symbol values */
+
+ int (*v8cfg_iter)(struct v8_cfg *, int (*)(mdb_symbol_t *, void *),
+ void *);
+ int (*v8cfg_readsym)(struct v8_cfg *, const char *, intptr_t *);
+} v8_cfg_t;
+
+extern v8_cfg_t v8_cfg_04;
+extern v8_cfg_t v8_cfg_06;
+extern v8_cfg_t v8_cfg_target;
+extern v8_cfg_t *v8_cfgs[];
+
+#endif /* V8CFG_H */
diff --git a/usr/src/cmd/mdb/common/modules/v8/v8dbg.h b/usr/src/cmd/mdb/common/modules/v8/v8dbg.h
new file mode 100644
index 0000000000..486ac5e255
--- /dev/null
+++ b/usr/src/cmd/mdb/common/modules/v8/v8dbg.h
@@ -0,0 +1,81 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * v8dbg.h: macros for use by V8 heap inspection tools. The consumer must
+ * define values for various tags and shifts. The MDB module gets these
+ * constants from information encoded in the binary itself.
+ */
+
+#ifndef _V8DBG_H
+#define _V8DBG_H
+
+/*
+ * Recall that while V8 heap objects are always 4-byte aligned, heap object
+ * pointers always have the last bit set. So when looking for a field nominally
+ * at offset X, one must be sure to clear the tag bit first.
+ */
+#define V8_OFF_HEAP(x) ((x) - V8_HeapObjectTag)
+
+/*
+ * Determine whether a given pointer refers to a SMI, Failure, or HeapObject.
+ */
+#define V8_IS_SMI(ptr) (((ptr) & V8_SmiTagMask) == V8_SmiTag)
+#define V8_IS_FAILURE(ptr) (((ptr) & V8_FailureTagMask) == V8_FailureTag)
+#define V8_IS_HEAPOBJECT(ptr) \
+ (((ptr) & V8_HeapObjectTagMask) == V8_HeapObjectTag)
+
+/*
+ * Extract the value of a SMI "pointer". Recall that small integers are stored
+ * using the upper 31 bits.
+ */
+#define V8_SMI_VALUE(smi) ((smi) >> V8_SmiValueShift)
+
+/*
+ * Determine the encoding and representation of a V8 string.
+ */
+#define V8_TYPE_STRING(type) (((type) & V8_IsNotStringMask) == V8_StringTag)
+
+#define V8_STRENC_ASCII(type) \
+ (((type) & V8_StringEncodingMask) == V8_AsciiStringTag)
+
+#define V8_STRREP_SEQ(type) \
+ (((type) & V8_StringRepresentationMask) == V8_SeqStringTag)
+#define V8_STRREP_CONS(type) \
+ (((type) & V8_StringRepresentationMask) == V8_ConsStringTag)
+#define V8_STRREP_EXT(type) \
+ (((type) & V8_StringRepresentationMask) == V8_ExternalStringTag)
+
+/*
+ * Several of the following constants and transformations are hardcoded in V8 as
+ * well, so there's no way to extract them programmatically from the binary.
+ */
+#define V8_DESC_KEYIDX(x) ((x) + V8_PROP_IDX_FIRST)
+#define V8_DESC_VALIDX(x) ((x) << 1)
+#define V8_DESC_DETIDX(x) (((x) << 1) + 1)
+
+#define V8_DESC_ISFIELD(x) \
+ (V8_SMI_VALUE((x) & V8_PROP_TYPE_MASK) == V8_PROP_TYPE_FIELD)
+
+#endif /* _V8DBG_H */
diff --git a/usr/src/cmd/mdb/i86pc/modules/unix/unix.c b/usr/src/cmd/mdb/i86pc/modules/unix/unix.c
index d774cde91f..b63876f1f8 100644
--- a/usr/src/cmd/mdb/i86pc/modules/unix/unix.c
+++ b/usr/src/cmd/mdb/i86pc/modules/unix/unix.c
@@ -22,6 +22,10 @@
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ */
+
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_ctf.h>
#include <sys/cpuvar.h>
@@ -36,6 +40,8 @@
#include <sys/mutex_impl.h>
#include "i86mmu.h"
#include <sys/apix.h>
+#include <sys/x86_archext.h>
+#include <sys/bitmap.h>
#define TT_HDLR_WIDTH 17
@@ -745,6 +751,137 @@ ptable_help(void)
"-m Interpret the PFN as an MFN (machine frame number)\n");
}
+/*
+ * NSEC_SHIFT is replicated here (it is not defined in a header file),
+ * but for amusement, the reader is directed to the comment that explains
+ * the rationale for this particular value on x86. Spoiler: the value is
+ * selected to accommodate 60 MHz Pentiums! (And a confession: if the voice
+ * in that comment sounds too familiar, it's because your author also wrote
+ * that code -- some fifteen years prior to this writing in 2011...)
+ */
+#define NSEC_SHIFT 5
+
+/*ARGSUSED*/
+static int
+scalehrtime_cmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ uint32_t nsec_scale;
+ hrtime_t tsc = addr, hrt;
+ unsigned int *tscp = (unsigned int *)&tsc;
+ uintptr_t scalehrtimef;
+ uint64_t scale;
+ GElf_Sym sym;
+
+ if (!(flags & DCMD_ADDRSPEC)) {
+ if (argc != 1)
+ return (DCMD_USAGE);
+
+ switch (argv[0].a_type) {
+ case MDB_TYPE_STRING:
+ tsc = mdb_strtoull(argv[0].a_un.a_str);
+ break;
+ case MDB_TYPE_IMMEDIATE:
+ tsc = argv[0].a_un.a_val;
+ break;
+ default:
+ return (DCMD_USAGE);
+ }
+ }
+
+ if (mdb_readsym(&scalehrtimef,
+ sizeof (scalehrtimef), "scalehrtimef") == -1) {
+ mdb_warn("couldn't read 'scalehrtimef'");
+ return (DCMD_ERR);
+ }
+
+ if (mdb_lookup_by_name("tsc_scalehrtime", &sym) == -1) {
+ mdb_warn("couldn't find 'tsc_scalehrtime'");
+ return (DCMD_ERR);
+ }
+
+ if (sym.st_value != scalehrtimef) {
+ mdb_warn("::scalehrtime requires that scalehrtimef "
+ "be set to tsc_scalehrtime\n");
+ return (DCMD_ERR);
+ }
+
+ if (mdb_readsym(&nsec_scale, sizeof (nsec_scale), "nsec_scale") == -1) {
+ mdb_warn("couldn't read 'nsec_scale'");
+ return (DCMD_ERR);
+ }
+
+ scale = (uint64_t)nsec_scale;
+
+ hrt = ((uint64_t)tscp[1] * scale) << NSEC_SHIFT;
+ hrt += ((uint64_t)tscp[0] * scale) >> (32 - NSEC_SHIFT);
+
+ mdb_printf("0x%llx\n", hrt);
+
+ return (DCMD_OK);
+}
+
+/*
+ * The x86 feature set is implemented as a bitmap array. That bitmap array is
+ * stored across a number of uchars based on the BT_SIZEOFMAP(NUM_X86_FEATURES)
+ * macro. We have the names for each of these features in unix's text segment
+ * so we do not have to duplicate them and instead just look them up.
+ */
+/*ARGSUSED*/
+static int
+x86_featureset_cmd(uintptr_t addr, uint_t flags, int argc,
+ const mdb_arg_t *argv)
+{
+ uchar_t *fset;
+ GElf_Sym sym;
+ uintptr_t nptr;
+ char name[128];
+ int ii;
+
+ size_t sz = sizeof (uchar_t) * BT_SIZEOFMAP(NUM_X86_FEATURES);
+
+ if (argc != 0)
+ return (DCMD_USAGE);
+
+ if (mdb_lookup_by_name("x86_feature_names", &sym) == -1) {
+ mdb_warn("couldn't find x86_feature_names");
+ return (DCMD_ERR);
+ }
+
+ fset = mdb_zalloc(sz, UM_NOSLEEP);
+ if (fset == NULL) {
+ mdb_warn("failed to allocate memory for x86_featureset");
+ return (DCMD_ERR);
+ }
+
+ if (mdb_readvar(fset, "x86_featureset") != sz) {
+ mdb_warn("failed to read x86_featureset");
+ mdb_free(fset, sz);
+ return (DCMD_ERR);
+ }
+
+ for (ii = 0; ii < NUM_X86_FEATURES; ii++) {
+ if (!BT_TEST((ulong_t *)fset, ii))
+ continue;
+
+ if (mdb_vread(&nptr, sizeof (char *), sym.st_value +
+ sizeof (void *) * ii) != sizeof (char *)) {
+ mdb_warn("failed to read feature array %d", ii);
+ mdb_free(fset, sz);
+ return (DCMD_ERR);
+ }
+
+ if (mdb_readstr(name, sizeof (name), nptr) == -1) {
+ mdb_warn("failed to read feature %d", ii);
+ mdb_free(fset, sz);
+ return (DCMD_ERR);
+ }
+ mdb_printf("%s\n", name);
+ }
+
+ mdb_free(fset, sz);
+ return (DCMD_OK);
+}
+
static const mdb_dcmd_t dcmds[] = {
{ "gate_desc", ":", "dump a gate descriptor", gate_desc },
{ "idt", ":[-v]", "dump an IDT", idt },
@@ -765,6 +902,10 @@ static const mdb_dcmd_t dcmds[] = {
{ "mfntopfn", ":", "convert hypervisor machine page to physical page",
mfntopfn_dcmd },
{ "memseg_list", ":", "show memseg list", memseg_list },
+ { "scalehrtime", ":",
+ "scale an unscaled high-res time", scalehrtime_cmd },
+ { "x86_featureset", NULL, "dump the x86_featureset vector",
+ x86_featureset_cmd },
{ NULL }
};
diff --git a/usr/src/cmd/mdb/intel/amd64/libumem/Makefile b/usr/src/cmd/mdb/intel/amd64/libumem/Makefile
index a8352ff865..ae22217a1b 100644
--- a/usr/src/cmd/mdb/intel/amd64/libumem/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/libumem/Makefile
@@ -22,6 +22,7 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
MODULE = libumem.so
MDBTGT = proc
@@ -42,6 +43,7 @@ include ../../../../Makefile.cmd
include ../../../../Makefile.cmd.64
CPPFLAGS += -I$(SRC)/lib/libumem/common
+CPPFLAGS += -I$(SRC)/lib/libc/inc
CPPFLAGS += -I$(MODSRCS_DIR)
include ../../Makefile.amd64
diff --git a/usr/src/cmd/mdb/intel/ia32/libpython2.6/Makefile b/usr/src/cmd/mdb/intel/ia32/libpython2.6/Makefile
index 53703a48cc..ab57dbd02a 100644
--- a/usr/src/cmd/mdb/intel/ia32/libpython2.6/Makefile
+++ b/usr/src/cmd/mdb/intel/ia32/libpython2.6/Makefile
@@ -34,6 +34,8 @@ include ../../../../Makefile.cmd
include ../../Makefile.ia32
include ../../../Makefile.module
+$(__GNUC)CPPFLAGS += -isystem $(ADJUNCT_PROTO)/usr/include
+
dmod/$(MODULE) := LDLIBS += -lproc
%.o: $(MODSRCS_DIR)/%.c
diff --git a/usr/src/cmd/mdb/intel/ia32/libumem/Makefile b/usr/src/cmd/mdb/intel/ia32/libumem/Makefile
index 2399f51d31..bde1be90ac 100644
--- a/usr/src/cmd/mdb/intel/ia32/libumem/Makefile
+++ b/usr/src/cmd/mdb/intel/ia32/libumem/Makefile
@@ -22,6 +22,7 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
MODULE = libumem.so
MDBTGT = proc
@@ -40,6 +41,7 @@ MODSRCS = \
include ../../../../Makefile.cmd
+CPPFLAGS += -I$(SRC)/lib/libc/inc
CPPFLAGS += -I$(SRC)/lib/libumem/common
CPPFLAGS += -I$(MODSRCS_DIR)
diff --git a/usr/src/cmd/lp/model/Makefile.msg b/usr/src/cmd/mdb/intel/ia32/v8/Makefile
index 820d0cb1ff..c84532289e 100644
--- a/usr/src/cmd/lp/model/Makefile.msg
+++ b/usr/src/cmd/mdb/intel/ia32/v8/Makefile
@@ -20,16 +20,25 @@
# CDDL HEADER END
#
#
-# ident "%Z%%M% %I% %E% SMI"
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
#
-# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/model/Makefile.msg
-POFILES = $(OBJS:%.o=%.po)
+MODULE = v8.so
+MDBTGT = proc
+
+MODSRCS_DIR = ../../../common/modules/v8
+
+MODSRCS = mdb_v8.c mdb_v8_cfg.c
+
+include ../../../../Makefile.cmd
+include ../../Makefile.ia32
+include ../../../Makefile.module
+
+dmod/$(MODULE) := LDLIBS += -lproc -lavl
-include ../../Makefile.lp.msg
+%.o: $(MODSRCS_DIR)/%.c
+ $(COMPILE.c) $<
+ $(CTFCONVERT_O)
-catalog: $(POFILE)
- $(CP) $(POFILE) ../..
+%.ln: $(MODSRCS_DIR)/%.c
+ $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/intel/mdb/kvm_isadep.c b/usr/src/cmd/mdb/intel/mdb/kvm_isadep.c
index 84db05c117..db04cb7a31 100644
--- a/usr/src/cmd/mdb/intel/mdb/kvm_isadep.c
+++ b/usr/src/cmd/mdb/intel/mdb/kvm_isadep.c
@@ -22,8 +22,9 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
/*
* Libkvm Kernel Target Intel component
@@ -57,6 +58,14 @@ kt_getareg(mdb_tgt_t *t, mdb_tgt_tid_t tid,
for (rdp = kt->k_rds; rdp->rd_name != NULL; rdp++) {
if (strcmp(rname, rdp->rd_name) == 0) {
*rp = kt->k_regs->kregs[rdp->rd_num];
+ if (rdp->rd_flags & MDB_TGT_R_32)
+ *rp &= 0xffffffffULL;
+ else if (rdp->rd_flags & MDB_TGT_R_16)
+ *rp &= 0xffffULL;
+ else if (rdp->rd_flags & MDB_TGT_R_8H)
+ *rp = (*rp & 0xff00ULL) >> 8;
+ else if (rdp->rd_flags & MDB_TGT_R_8L)
+ *rp &= 0xffULL;
return (0);
}
}
@@ -75,6 +84,15 @@ kt_putareg(mdb_tgt_t *t, mdb_tgt_tid_t tid, const char *rname, mdb_tgt_reg_t r)
for (rdp = kt->k_rds; rdp->rd_name != NULL; rdp++) {
if (strcmp(rname, rdp->rd_name) == 0) {
+ if (rdp->rd_flags & MDB_TGT_R_32)
+ r &= 0xffffffffULL;
+ else if (rdp->rd_flags & MDB_TGT_R_16)
+ r &= 0xffffULL;
+ else if (rdp->rd_flags & MDB_TGT_R_8H)
+ r = (r & 0xffULL) << 8;
+ else if (rdp->rd_flags & MDB_TGT_R_8L)
+ r &= 0xffULL;
+
kt->k_regs->kregs[rdp->rd_num] = (kreg_t)r;
return (0);
}
diff --git a/usr/src/cmd/mdb/intel/mdb/mdb_amd64util.c b/usr/src/cmd/mdb/intel/mdb/mdb_amd64util.c
index 65adaf37be..60aa1ec991 100644
--- a/usr/src/cmd/mdb/intel/mdb/mdb_amd64util.c
+++ b/usr/src/cmd/mdb/intel/mdb/mdb_amd64util.c
@@ -23,6 +23,9 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#include <sys/types.h>
#include <sys/reg.h>
@@ -50,20 +53,69 @@ const mdb_tgt_regdesc_t mdb_amd64_kregs[] = {
{ "savfp", KREG_SAVFP, MDB_TGT_R_EXPORT },
{ "savpc", KREG_SAVPC, MDB_TGT_R_EXPORT },
{ "rdi", KREG_RDI, MDB_TGT_R_EXPORT },
+ { "edi", KREG_RDI, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "di", KREG_RDI, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "dil", KREG_RDI, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rsi", KREG_RSI, MDB_TGT_R_EXPORT },
+ { "esi", KREG_RSI, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "si", KREG_RSI, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "sil", KREG_RSI, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rdx", KREG_RDX, MDB_TGT_R_EXPORT },
+ { "edx", KREG_RDX, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "dx", KREG_RDX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "dh", KREG_RDX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "dl", KREG_RDX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rcx", KREG_RCX, MDB_TGT_R_EXPORT },
+ { "ecx", KREG_RCX, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "cx", KREG_RCX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "ch", KREG_RCX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "cl", KREG_RCX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r8", KREG_R8, MDB_TGT_R_EXPORT },
+ { "r8d", KREG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r8w", KREG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r8l", KREG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r9", KREG_R9, MDB_TGT_R_EXPORT },
+ { "r9d", KREG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r9w", KREG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r9l", KREG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rax", KREG_RAX, MDB_TGT_R_EXPORT },
+ { "eax", KREG_RAX, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "ax", KREG_RAX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "ah", KREG_RAX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "al", KREG_RAX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rbx", KREG_RBX, MDB_TGT_R_EXPORT },
+ { "ebx", KREG_RBX, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "bx", KREG_RBX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "bh", KREG_RBX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "bl", KREG_RBX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rbp", KREG_RBP, MDB_TGT_R_EXPORT },
+ { "ebp", KREG_RBP, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "bp", KREG_RBP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "bpl", KREG_RBP, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r10", KREG_R10, MDB_TGT_R_EXPORT },
+ { "r10d", KREG_R10, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r10w", KREG_R10, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r10l", KREG_R10, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r11", KREG_R11, MDB_TGT_R_EXPORT },
+ { "r11d", KREG_R11, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r11w", KREG_R11, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r11l", KREG_R11, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r12", KREG_R12, MDB_TGT_R_EXPORT },
+ { "r12d", KREG_R12, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r12w", KREG_R12, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r12l", KREG_R12, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r13", KREG_R13, MDB_TGT_R_EXPORT },
+ { "r13d", KREG_R13, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r13w", KREG_R13, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r13l", KREG_R13, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r14", KREG_R14, MDB_TGT_R_EXPORT },
+ { "r14d", KREG_R14, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r14w", KREG_R14, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r14l", KREG_R14, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r15", KREG_R15, MDB_TGT_R_EXPORT },
+ { "r15d", KREG_R15, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r15w", KREG_R15, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r15l", KREG_R15, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "ds", KREG_DS, MDB_TGT_R_EXPORT },
{ "es", KREG_ES, MDB_TGT_R_EXPORT },
{ "fs", KREG_FS, MDB_TGT_R_EXPORT },
@@ -73,7 +125,11 @@ const mdb_tgt_regdesc_t mdb_amd64_kregs[] = {
{ "rip", KREG_RIP, MDB_TGT_R_EXPORT },
{ "cs", KREG_CS, MDB_TGT_R_EXPORT },
{ "rflags", KREG_RFLAGS, MDB_TGT_R_EXPORT },
+ { "eflags", KREG_RFLAGS, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
{ "rsp", KREG_RSP, MDB_TGT_R_EXPORT },
+ { "esp", KREG_RSP, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "sp", KREG_RSP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "spl", KREG_RSP, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "ss", KREG_SS, MDB_TGT_R_EXPORT },
{ NULL, 0, 0 }
};
diff --git a/usr/src/cmd/mdb/intel/mdb/mdb_ia32util.c b/usr/src/cmd/mdb/intel/mdb/mdb_ia32util.c
index addb37e19f..43db94741b 100644
--- a/usr/src/cmd/mdb/intel/mdb/mdb_ia32util.c
+++ b/usr/src/cmd/mdb/intel/mdb/mdb_ia32util.c
@@ -22,8 +22,9 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#include <sys/types.h>
#include <sys/reg.h>
@@ -48,13 +49,29 @@ const mdb_tgt_regdesc_t mdb_ia32_kregs[] = {
{ "savfp", KREG_SAVFP, MDB_TGT_R_EXPORT },
{ "savpc", KREG_SAVPC, MDB_TGT_R_EXPORT },
{ "eax", KREG_EAX, MDB_TGT_R_EXPORT },
+ { "ax", KREG_EAX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "ah", KREG_EAX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "al", KREG_EAX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "ebx", KREG_EBX, MDB_TGT_R_EXPORT },
+ { "bx", KREG_EBX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "bh", KREG_EBX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "bl", KREG_EBX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "ecx", KREG_ECX, MDB_TGT_R_EXPORT },
+ { "cx", KREG_ECX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "ch", KREG_ECX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "cl", KREG_ECX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "edx", KREG_EDX, MDB_TGT_R_EXPORT },
+ { "dx", KREG_EDX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "dh", KREG_EDX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "dl", KREG_EDX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "esi", KREG_ESI, MDB_TGT_R_EXPORT },
+ { "si", KREG_ESI, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "edi", KREG_EDI, MDB_TGT_R_EXPORT },
+ { "di", EDI, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "ebp", KREG_EBP, MDB_TGT_R_EXPORT },
+ { "bp", KREG_EBP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "esp", KREG_ESP, MDB_TGT_R_EXPORT },
+ { "sp", KREG_ESP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "cs", KREG_CS, MDB_TGT_R_EXPORT },
{ "ds", KREG_DS, MDB_TGT_R_EXPORT },
{ "ss", KREG_SS, MDB_TGT_R_EXPORT },
@@ -64,6 +81,7 @@ const mdb_tgt_regdesc_t mdb_ia32_kregs[] = {
{ "eflags", KREG_EFLAGS, MDB_TGT_R_EXPORT },
{ "eip", KREG_EIP, MDB_TGT_R_EXPORT },
{ "uesp", KREG_UESP, MDB_TGT_R_EXPORT | MDB_TGT_R_PRIV },
+ { "usp", KREG_UESP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "trapno", KREG_TRAPNO, MDB_TGT_R_EXPORT | MDB_TGT_R_PRIV },
{ "err", KREG_ERR, MDB_TGT_R_EXPORT | MDB_TGT_R_PRIV },
{ NULL, 0, 0 }
diff --git a/usr/src/cmd/mdb/intel/mdb/proc_amd64dep.c b/usr/src/cmd/mdb/intel/mdb/proc_amd64dep.c
index 29dd1682d1..75dd430c7d 100644
--- a/usr/src/cmd/mdb/intel/mdb/proc_amd64dep.c
+++ b/usr/src/cmd/mdb/intel/mdb/proc_amd64dep.c
@@ -23,8 +23,9 @@
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
/*
* User Process Target Intel 32-bit component
@@ -46,26 +47,79 @@
const mdb_tgt_regdesc_t pt_regdesc[] = {
{ "r15", REG_R15, MDB_TGT_R_EXPORT },
+ { "r15d", REG_R15, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r15w", REG_R15, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r15l", REG_R15, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r14", REG_R14, MDB_TGT_R_EXPORT },
+ { "r14d", REG_R14, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r14w", REG_R14, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r14l", REG_R14, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r13", REG_R13, MDB_TGT_R_EXPORT },
+ { "r13d", REG_R13, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r13w", REG_R13, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r13l", REG_R13, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r12", REG_R12, MDB_TGT_R_EXPORT },
+ { "r12d", REG_R12, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r12w", REG_R12, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r12l", REG_R12, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r11", REG_R11, MDB_TGT_R_EXPORT },
+ { "r11d", REG_R11, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r11w", REG_R11, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r11l", REG_R11, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r10", REG_R10, MDB_TGT_R_EXPORT },
+ { "r10d", REG_R10, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r10w", REG_R10, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r10l", REG_R10, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r9", REG_R9, MDB_TGT_R_EXPORT },
+ { "r9d", REG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r9w", REG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r9l", REG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "r8", REG_R8, MDB_TGT_R_EXPORT },
+ { "r8d", REG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "r8w", REG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "r8l", REG_R8, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rdi", REG_RDI, MDB_TGT_R_EXPORT },
+ { "edi", REG_RDI, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "di", REG_RDI, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "dil", REG_RDI, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rsi", REG_RSI, MDB_TGT_R_EXPORT },
+ { "esi", REG_RSI, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "si", REG_RSI, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "sil", REG_RSI, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rbp", REG_RBP, MDB_TGT_R_EXPORT },
+ { "ebp", REG_RBP, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "bp", REG_RBP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "bpl", REG_RBP, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rbx", REG_RBX, MDB_TGT_R_EXPORT },
+ { "ebx", REG_RBX, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "bx", REG_RBX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "bh", REG_RBX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "bl", REG_RBX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rdx", REG_RDX, MDB_TGT_R_EXPORT },
+ { "edx", REG_RDX, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "dx", REG_RDX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "dh", REG_RDX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "dl", REG_RDX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rcx", REG_RCX, MDB_TGT_R_EXPORT },
+ { "ecx", REG_RCX, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "cx", REG_RCX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "ch", REG_RCX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "cl", REG_RCX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "rax", REG_RAX, MDB_TGT_R_EXPORT },
+ { "eax", REG_RAX, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "ax", REG_RAX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "ah", REG_RAX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "al", REG_RAX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "trapno", REG_TRAPNO, MDB_TGT_R_EXPORT },
{ "err", REG_ERR, MDB_TGT_R_EXPORT },
{ "rip", REG_RIP, MDB_TGT_R_EXPORT },
{ "cs", REG_CS, MDB_TGT_R_EXPORT },
{ "rflags", REG_RFL, MDB_TGT_R_EXPORT },
+ { "eflags", REG_RFL, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
{ "rsp", REG_RSP, MDB_TGT_R_EXPORT },
+ { "esp", REG_RSP, MDB_TGT_R_EXPORT | MDB_TGT_R_32 },
+ { "sp", REG_RSP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "spl", REG_RSP, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "ss", REG_SS, MDB_TGT_R_EXPORT },
{ "fs", REG_FS, MDB_TGT_R_EXPORT },
{ "gs", REG_GS, MDB_TGT_R_EXPORT },
diff --git a/usr/src/cmd/mdb/intel/mdb/proc_ia32dep.c b/usr/src/cmd/mdb/intel/mdb/proc_ia32dep.c
index bca8445d86..b532dc9149 100644
--- a/usr/src/cmd/mdb/intel/mdb/proc_ia32dep.c
+++ b/usr/src/cmd/mdb/intel/mdb/proc_ia32dep.c
@@ -23,8 +23,9 @@
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
/*
* User Process Target Intel 32-bit component
@@ -50,19 +51,36 @@ const mdb_tgt_regdesc_t pt_regdesc[] = {
{ "es", ES, MDB_TGT_R_EXPORT },
{ "ds", DS, MDB_TGT_R_EXPORT },
{ "edi", EDI, MDB_TGT_R_EXPORT },
+ { "di", EDI, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "esi", ESI, MDB_TGT_R_EXPORT },
+ { "si", ESI, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "ebp", EBP, MDB_TGT_R_EXPORT },
+ { "bp", EBP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "kesp", ESP, MDB_TGT_R_EXPORT },
+ { "ksp", ESP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "ebx", EBX, MDB_TGT_R_EXPORT },
+ { "bx", EBX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "bh", EBX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "bl", EBX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "edx", EDX, MDB_TGT_R_EXPORT },
+ { "dx", EDX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "dh", EDX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "dl", EDX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "ecx", ECX, MDB_TGT_R_EXPORT },
+ { "cx", ECX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "ch", ECX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "cl", ECX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "eax", EAX, MDB_TGT_R_EXPORT },
+ { "ax", EAX, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
+ { "ah", EAX, MDB_TGT_R_EXPORT | MDB_TGT_R_8H },
+ { "al", EAX, MDB_TGT_R_EXPORT | MDB_TGT_R_8L },
{ "trapno", TRAPNO, MDB_TGT_R_EXPORT },
{ "err", ERR, MDB_TGT_R_EXPORT },
{ "eip", EIP, MDB_TGT_R_EXPORT },
{ "cs", CS, MDB_TGT_R_EXPORT },
{ "eflags", EFL, MDB_TGT_R_EXPORT },
{ "esp", UESP, MDB_TGT_R_EXPORT },
+ { "sp", UESP, MDB_TGT_R_EXPORT | MDB_TGT_R_16 },
{ "ss", SS, MDB_TGT_R_EXPORT },
{ NULL, 0, 0 }
};
diff --git a/usr/src/cmd/mdb/sparc/v7/libumem/Makefile b/usr/src/cmd/mdb/sparc/v7/libumem/Makefile
index 4553b15eba..0488e6739a 100644
--- a/usr/src/cmd/mdb/sparc/v7/libumem/Makefile
+++ b/usr/src/cmd/mdb/sparc/v7/libumem/Makefile
@@ -22,6 +22,7 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
MODULE = libumem.so
MDBTGT = proc
@@ -41,6 +42,7 @@ MODSRCS = \
include ../../../../Makefile.cmd
CPPFLAGS += -I$(SRC)/lib/libumem/common
+CPPFLAGS += -I$(SRC)/lib/libc/inc
CPPFLAGS += -I$(MODSRCS_DIR)
include ../../Makefile.sparcv7
diff --git a/usr/src/cmd/mdb/sparc/v9/libumem/Makefile b/usr/src/cmd/mdb/sparc/v9/libumem/Makefile
index 2cbeb25f5e..87ce977423 100644
--- a/usr/src/cmd/mdb/sparc/v9/libumem/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/libumem/Makefile
@@ -22,6 +22,7 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
MODULE = libumem.so
MDBTGT = proc
@@ -54,6 +55,7 @@ KMOD_SOURCES_DIFFERENT=$(POUND_SIGN)
include ../../../../Makefile.cmd
CPPFLAGS += -I$(SRC)/lib/libumem/common
+CPPFLAGS += -I$(SRC)/lib/libc/inc
CPPFLAGS += -I$(MODSRCS_DIR)
include ../../../../Makefile.cmd.64
diff --git a/usr/src/cmd/mdb/test/README b/usr/src/cmd/mdb/test/README
new file mode 100644
index 0000000000..28127e5916
--- /dev/null
+++ b/usr/src/cmd/mdb/test/README
@@ -0,0 +1,18 @@
+MDB Test suite
+
+This provides a primordial version of a test suite for mdb. To run the tests,
+run mtest. Tests exist in various subdirectories. The name of the test is
+important.
+
+A test must start with either:
+
+ o tst - Indicating that it should exit zero
+ o err - Indicating that it should exit non-zero
+
+A test must end with either:
+
+ o mdb - Indicating that the file should be passed as standard input to mdb
+ o ksh - Indicating that it should be run with ksh
+
+A test may have an optional .out file which if present indicates that the test
+should pass if and only if its standard ouput matches its standar error.
diff --git a/usr/src/cmd/mdb/test/exit-e/err.cmdbadopt.ksh b/usr/src/cmd/mdb/test/exit-e/err.cmdbadopt.ksh
new file mode 100644
index 0000000000..de50faeb01
--- /dev/null
+++ b/usr/src/cmd/mdb/test/exit-e/err.cmdbadopt.ksh
@@ -0,0 +1,2 @@
+$MDB -e '::typegraph'
+exit $?
diff --git a/usr/src/cmd/mdb/test/exit-e/err.enocmd.ksh b/usr/src/cmd/mdb/test/exit-e/err.enocmd.ksh
new file mode 100644
index 0000000000..038f121b26
--- /dev/null
+++ b/usr/src/cmd/mdb/test/exit-e/err.enocmd.ksh
@@ -0,0 +1,2 @@
+$MDB -e '::commandthatdoesnotexist'
+exit $?
diff --git a/usr/src/cmd/mdb/test/exit-e/tst.output.ksh b/usr/src/cmd/mdb/test/exit-e/tst.output.ksh
new file mode 100644
index 0000000000..13b5db072d
--- /dev/null
+++ b/usr/src/cmd/mdb/test/exit-e/tst.output.ksh
@@ -0,0 +1 @@
+$MDB -e '0t2 << 0t10=K'
diff --git a/usr/src/cmd/mdb/test/exit-e/tst.output.ksh.out b/usr/src/cmd/mdb/test/exit-e/tst.output.ksh.out
new file mode 100644
index 0000000000..7a38ab6e65
--- /dev/null
+++ b/usr/src/cmd/mdb/test/exit-e/tst.output.ksh.out
@@ -0,0 +1 @@
+ 800
diff --git a/usr/src/cmd/mdb/test/exit-e/tst.simple.ksh b/usr/src/cmd/mdb/test/exit-e/tst.simple.ksh
new file mode 100644
index 0000000000..4c8a3c58ad
--- /dev/null
+++ b/usr/src/cmd/mdb/test/exit-e/tst.simple.ksh
@@ -0,0 +1 @@
+$MDB -e '::dcmds'
diff --git a/usr/src/cmd/mdb/test/mtest.sh b/usr/src/cmd/mdb/test/mtest.sh
new file mode 100755
index 0000000000..f21d0faa21
--- /dev/null
+++ b/usr/src/cmd/mdb/test/mtest.sh
@@ -0,0 +1,235 @@
+#!/bin/bash
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2012 (c), Joyent, Inc.
+#
+
+#
+# mdb test driver
+#
+unalias -a
+shopt -s xpg_echo
+#set -o xtrace
+
+mt_arg0=$(basename $0)
+mt_ksh="/usr/bin/ksh"
+mt_mdb="/usr/bin/mdb"
+mt_outdir=
+mt_keep=
+mt_all=
+mt_tests=
+mt_tnum=0
+mt_tfail=0
+mt_tsuc=0
+
+function usage
+{
+ local msg="$*"
+ [[ -z "$msg" ]] || echo "$msg" 2>&1
+ cat <<USAGE >&2
+Usage: $mt_arg0 [ -o dir ] [ -k ] [ -m executable ] [ -a | test ... ]
+
+ -o dir Sets 'dir' as the output directory
+ -a Runs all tests, ignores tests passed in
+ -k Keep output from all tests, not just failures
+ -m mdb binary to test
+USAGE
+ exit 2
+}
+
+function fatal
+{
+ local msg="$*"
+ [[ -z "$msg" ]] && msg="failed"
+ echo "$mt_arg0: $msg" >&2
+ exit 1
+}
+
+function setup_outdir
+{
+ mt_outdir="$mt_outdir/$mt_arg0.$$"
+ mkdir -p $mt_outdir || fatal "failed to make output dir $mt_outdir"
+}
+
+function run_single
+{
+ local name=$1
+ local expect base ext exe command odir res reason input
+
+ [[ -z "$name" ]] && fail "missing test to run"
+ base=${name##*/}
+ ext=${base##*.}
+ expect=${base%%.*}
+ odir="$mt_outdir/current"
+ [[ -z "$ext" ]] && fatal "found test without ext: $name"
+ [[ -z "$expect" ]] && fatal "found test without prefix: $name"
+
+ case "$ext" in
+ "ksh")
+ command="$mt_ksh $name"
+ ;;
+ "mdb")
+ command="$mt_mdb"
+ input="$name"
+ ;;
+ "out")
+ #
+ # This is the file format for checking output against.
+ #
+ return 0
+ ;;
+ *)
+ echo "skipping test $name (unknown extensino)"
+ return 0
+ ;;
+ esac
+
+ echo "Executing test $name ... \c"
+ mkdir -p "$odir" >/dev/null || fatal "can't make output directory"
+ if [[ -z "$input" ]]; then
+ MDB=$mt_mdb $command > "$odir/stdout" 2>"$odir/stderr"
+ res=$?
+ else
+ MDB=$mt_mdb $command < $input > "$odir/stdout" 2>"$odir/stderr"
+ res=$?
+ fi
+
+ if [[ -f "$name.out" ]] && ! diff "$name.out" "$odir/stdout" >/dev/null; then
+ cp $name.out $odir/$base.out
+ reason="stdout mismatch"
+ elif [[ "$expect" == "tst" && $res -ne 0 ]]; then
+ reason="test exited $res, not zero"
+ elif [[ "$expect" == "err" && $res -eq 0 ]]; then
+ reason="test exited $res, not non-zero"
+ fi
+
+ if [[ -n "$reason" ]]; then
+ echo "$reason"
+ ((mt_tfail++))
+ mv "$odir" "$mt_outdir/failure.$mt_tfail" || fatal \
+ "failed to move test output directory"
+ cp "$name" "$mt_outdir/failure.$mt_tfail/test" || fatal \
+ "failed to copy test into output directory"
+ else
+ echo "passed"
+ ((mt_tsuc++))
+ mv "$odir" "$mt_outdir/success.$mt_tsuc" || fatal \
+ "failed to move test directory"
+ fi
+
+ ((mt_tnum++))
+}
+
+function run_all
+{
+ local tests t
+
+ tests=$(find . -type f -name '[tst,err]*.*.[ksh,mdb]*')
+ for t in $tests; do
+ run_single $t
+ done
+}
+
+function welcome
+{
+ cat <<WELCOME
+Starting tests...
+mtest target: $mt_mdb
+output directory: $mt_outdir
+WELCOME
+}
+
+function cleanup
+{
+ [[ -n "$mt_keep" ]] && return
+ rm -rf "$mt_outdir"/success.* || fatal \
+ "failed to remove successful test cases"
+ if [[ $mt_tfail -eq 0 ]]; then
+ rmdir "$mt_outdir" || fatal \
+ "failed to remove test output directory"
+ fi
+}
+
+function goodbye
+{
+ cat <<EOF
+
+-------------
+Results
+-------------
+
+Tests passed: $mt_tsuc
+Tests failed: $mt_tfail
+Tests ran: $mt_tnum
+
+EOF
+ if [[ $mt_tfail -eq 0 ]]; then
+ echo "Congrats, mdb isn't completely broken, the tests pass".
+ else
+ echo "Some tests failed, you have some work to do."
+ fi
+}
+
+while getopts ":ahko:m:" c $@; do
+ case "$c" in
+ a)
+ mt_all="y"
+ ;;
+ k)
+ mt_keep="y"
+ ;;
+ m)
+ mt_mdb="$OPTARG"
+ ;;
+ o)
+ mt_outdir="$OPTARG"
+ ;;
+ h)
+ usage
+ ;;
+ :)
+ usage "option requires an argument -- $OPTARG"
+ ;;
+ *)
+ usage "invalid option -- $OPTARG"
+ ;;
+ esac
+done
+
+shift $((OPTIND-1))
+
+[[ -z "$mt_all" && $# == 0 ]] && usage "no tests to run"
+
+[[ -x "$mt_mdb" ]] || fatal "unable to execute mdb binary: $mt_mdb"
+
+[[ -z "$mt_outdir" ]] && mt_outdir=/var/tmp
+
+setup_outdir
+welcome
+
+if [[ ! -z "$mt_all" ]]; then
+ run_all
+else
+ for t in $@; do
+ [[ -f $t ]] || fatal "cannot find test $t"
+ run_single $t
+ done
+fi
+
+goodbye
+cleanup
+
+#
+# Exit 1 if we have tests that return non-zero
+#
+[[ $mt_tfai -eq 0 ]]
diff --git a/usr/src/cmd/mdb/test/typedef/err.badid-leadnum.ksh b/usr/src/cmd/mdb/test/typedef/err.badid-leadnum.ksh
new file mode 100644
index 0000000000..f297cf99f1
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badid-leadnum.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef lp32; ::typedef uint8_t 42foo'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badid-leadschar.ksh b/usr/src/cmd/mdb/test/typedef/err.badid-leadschar.ksh
new file mode 100644
index 0000000000..5c7582b89c
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badid-leadschar.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef lp32; ::typedef uint8_t %foo'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badmodel.ksh b/usr/src/cmd/mdb/test/typedef/err.badmodel.ksh
new file mode 100644
index 0000000000..28d6cf05a5
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badmodel.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c LLP64'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-extrabraces.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-extrabraces.ksh
new file mode 100644
index 0000000000..3543aab1df
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-extrabraces.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7]; {} void {**white; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-neglenarr.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-neglenarr.ksh
new file mode 100644
index 0000000000..ec41576179
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-neglenarr.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[-3]; void **white; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayclose.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayclose.ksh
new file mode 100644
index 0000000000..b91094ae44
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayclose.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7; void **white; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarraylen.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarraylen.ksh
new file mode 100644
index 0000000000..4fe23fcee2
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarraylen.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[]; void **white; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayopen.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayopen.ksh
new file mode 100644
index 0000000000..9fe7e77200
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-noarrayopen.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone7]; void **white; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-nobraces.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-nobraces.ksh
new file mode 100644
index 0000000000..d50d8e3fb9
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-nobraces.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct uintptr_t stone[7]; void **white;" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noclosebrace.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noclosebrace.ksh
new file mode 100644
index 0000000000..4b20fac8c5
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-noclosebrace.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7]; void **white; " gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomembers.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomembers.ksh
new file mode 100644
index 0000000000..9fd82a01cc
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomembers.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemname.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemname.ksh
new file mode 100644
index 0000000000..e1e4eacf13
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemname.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { void; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemsemi.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemsemi.ksh
new file mode 100644
index 0000000000..9ab93a792f
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-nomemsemi.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7]; void **white }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noopenbrace.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noopenbrace.ksh
new file mode 100644
index 0000000000..450b35ade2
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-noopenbrace.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct uintptr_t stone[7]; void **white; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-noquotes.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-noquotes.ksh
new file mode 100644
index 0000000000..789caf63b0
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-noquotes.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef struct { uintptr_t stone[7]; void **white; } gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-repmemname.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-repmemname.ksh
new file mode 100644
index 0000000000..c00aca88fb
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-repmemname.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[7]; void **stone; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-vlaonly.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-vlaonly.ksh
new file mode 100644
index 0000000000..a678d136b6
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-vlaonly.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[]; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badstruct-zerolenarr.ksh b/usr/src/cmd/mdb/test/typedef/err.badstruct-zerolenarr.ksh
new file mode 100644
index 0000000000..7999c97a5a
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badstruct-zerolenarr.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "struct { uintptr_t stone[0]; void **white; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.badunion-hasvla.ksh b/usr/src/cmd/mdb/test/typedef/err.badunion-hasvla.ksh
new file mode 100644
index 0000000000..57a82a7752
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.badunion-hasvla.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "union { int foo; uintptr_t stone[]; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.extraargs.ksh b/usr/src/cmd/mdb/test/typedef/err.extraargs.ksh
new file mode 100644
index 0000000000..510797265b
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.extraargs.ksh
@@ -0,0 +1 @@
+$MDB -e "::typedef -c lp32; ::typedef uint8_t rm_t extra_t"
diff --git a/usr/src/cmd/mdb/test/typedef/err.noargs.ksh b/usr/src/cmd/mdb/test/typedef/err.noargs.ksh
new file mode 100644
index 0000000000..77eeacc5f2
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.noargs.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef'
diff --git a/usr/src/cmd/mdb/test/typedef/err.nokeyword.ksh b/usr/src/cmd/mdb/test/typedef/err.nokeyword.ksh
new file mode 100644
index 0000000000..9a5e1a1fcc
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.nokeyword.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c lp32; ::typedef "{ uintptr_t stone[7]; void **white; }" gift_t'
diff --git a/usr/src/cmd/mdb/test/typedef/err.nomodel.ksh b/usr/src/cmd/mdb/test/typedef/err.nomodel.ksh
new file mode 100644
index 0000000000..4614ac23d6
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.nomodel.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef -c'
diff --git a/usr/src/cmd/mdb/test/typedef/err.noname.ksh b/usr/src/cmd/mdb/test/typedef/err.noname.ksh
new file mode 100644
index 0000000000..04ebca1204
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.noname.ksh
@@ -0,0 +1 @@
+$MDB -e '::typedef int'
diff --git a/usr/src/cmd/mdb/test/typedef/err.typeexists.ksh b/usr/src/cmd/mdb/test/typedef/err.typeexists.ksh
new file mode 100644
index 0000000000..a1158cd830
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/err.typeexists.ksh
@@ -0,0 +1 @@
+$MDB /lib/libc.so -e '::typedef uint8_t uint16_t'
diff --git a/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb b/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb
new file mode 100644
index 0000000000..27de9428c6
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb
@@ -0,0 +1,4 @@
+::typedef -c lp32
+::typedef "struct { uintptr_t stone[7]; void **white; }" gift_t
+::sizeof gift_t
+::print -at gift_t
diff --git a/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb.out
new file mode 100644
index 0000000000..605e0facfc
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.anonstruct.mdb.out
@@ -0,0 +1,5 @@
+sizeof (gift_t) = 0x28
+0 gift_t {
+ 0 uintptr_t [7] stone
+ 20 void **white
+}
diff --git a/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb b/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb
new file mode 100644
index 0000000000..1aa17b5366
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb
@@ -0,0 +1,4 @@
+::typedef -c lp64
+::typedef "union { int frodo; char sam; long gandalf; }" ringbearer_t;
+::sizeof ringbearer_t
+::print -at ringbearer_t
diff --git a/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb.out
new file mode 100644
index 0000000000..0a762dc1f8
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.anonunion.mdb.out
@@ -0,0 +1,6 @@
+sizeof (ringbearer_t) = 8
+0 ringbearer_t {
+ 0 int frodo
+ 0 char sam
+ 0 long gandalf
+}
diff --git a/usr/src/cmd/mdb/test/typedef/tst.cleanupstruct.ksh b/usr/src/cmd/mdb/test/typedef/tst.cleanupstruct.ksh
new file mode 100644
index 0000000000..1abf7540ce
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.cleanupstruct.ksh
@@ -0,0 +1,22 @@
+#
+# One of the problems that we can encounter involves trying to typedef a struct
+# that has an error in it. The problem here is that we actually create the type
+# itself for the struct before we add members. So what we need is something that
+# will fail validation. So here we go!
+#
+
+TMPFILE="/tmp/$(mktemp mtest.XXXXXX)"
+if [[ -z "$TMPFILE" ]]; then
+ echo "Failed to get a temp file" 2>&1
+ exit 1
+fi
+
+$MDB <<EOF
+::typedef "struct foo { int r; }" foo_t
+::typedef -l ! cat > $TMPFILE
+EOF
+
+DATA=$(cat $TMPFILE)
+rm -f $TMPFILE
+
+[[ -z $DATA ]]
diff --git a/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb b/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb
new file mode 100644
index 0000000000..12c28075a8
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb
@@ -0,0 +1,27 @@
+::typedef -c LP32
+::sizeof int8_t
+::sizeof int16_t
+::sizeof int32_t
+::sizeof int64_t
+::sizeof uint8_t
+::sizeof uint16_t
+::sizeof uint32_t
+::sizeof uint64_t
+::sizeof intptr_t
+::sizeof uintptr_t
+::sizeof uchar_t
+::sizeof ushort_t
+::sizeof uint_t
+::sizeof ulong_t
+::sizeof u_longlong_t
+::sizeof ptrdiff_t
+::sizeof signed
+::sizeof unsigned
+::sizeof void
+::sizeof char
+::sizeof short
+::sizeof int
+::sizeof long
+::sizeof _Bool
+::sizeof float
+::sizeof double
diff --git a/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb.out
new file mode 100644
index 0000000000..792f42fbf2
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.deftypes32.mdb.out
@@ -0,0 +1,26 @@
+sizeof (int8_t) = 1
+sizeof (int16_t) = 2
+sizeof (int32_t) = 4
+sizeof (int64_t) = 8
+sizeof (uint8_t) = 1
+sizeof (uint16_t) = 2
+sizeof (uint32_t) = 4
+sizeof (uint64_t) = 8
+sizeof (intptr_t) = 4
+sizeof (uintptr_t) = 4
+sizeof (uchar_t) = 1
+sizeof (ushort_t) = 2
+sizeof (uint_t) = 4
+sizeof (ulong_t) = 4
+sizeof (u_longlong_t) = 8
+sizeof (ptrdiff_t) = 4
+sizeof (signed) = 4
+sizeof (unsigned) = 4
+sizeof (void) = 0
+sizeof (char) = 1
+sizeof (short) = 2
+sizeof (int) = 4
+sizeof (long) = 4
+sizeof (_Bool) = 1
+sizeof (float) = 4
+sizeof (double) = 8
diff --git a/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb b/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb
new file mode 100644
index 0000000000..5ae94cdea0
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb
@@ -0,0 +1,27 @@
+::typedef -c LP64
+::sizeof int8_t
+::sizeof int16_t
+::sizeof int32_t
+::sizeof int64_t
+::sizeof uint8_t
+::sizeof uint16_t
+::sizeof uint32_t
+::sizeof uint64_t
+::sizeof intptr_t
+::sizeof uintptr_t
+::sizeof uchar_t
+::sizeof ushort_t
+::sizeof uint_t
+::sizeof ulong_t
+::sizeof u_longlong_t
+::sizeof ptrdiff_t
+::sizeof signed
+::sizeof unsigned
+::sizeof void
+::sizeof char
+::sizeof short
+::sizeof int
+::sizeof long
+::sizeof _Bool
+::sizeof float
+::sizeof double
diff --git a/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb.out
new file mode 100644
index 0000000000..83b85b943a
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.deftypes64.mdb.out
@@ -0,0 +1,26 @@
+sizeof (int8_t) = 1
+sizeof (int16_t) = 2
+sizeof (int32_t) = 4
+sizeof (int64_t) = 8
+sizeof (uint8_t) = 1
+sizeof (uint16_t) = 2
+sizeof (uint32_t) = 4
+sizeof (uint64_t) = 8
+sizeof (intptr_t) = 8
+sizeof (uintptr_t) = 8
+sizeof (uchar_t) = 1
+sizeof (ushort_t) = 2
+sizeof (uint_t) = 4
+sizeof (ulong_t) = 8
+sizeof (u_longlong_t) = 8
+sizeof (ptrdiff_t) = 8
+sizeof (signed) = 4
+sizeof (unsigned) = 4
+sizeof (void) = 0
+sizeof (char) = 1
+sizeof (short) = 2
+sizeof (int) = 4
+sizeof (long) = 8
+sizeof (_Bool) = 1
+sizeof (float) = 4
+sizeof (double) = 8
diff --git a/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb b/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb
new file mode 100644
index 0000000000..e9009d7b68
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb
@@ -0,0 +1,3 @@
+::typdef -c lp32
+::typedef -d
+::typedef -l
diff --git a/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb.out
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.dellist.mdb.out
diff --git a/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb b/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb
new file mode 100644
index 0000000000..6c7505ac1c
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb
@@ -0,0 +1 @@
+::typedef -l
diff --git a/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb.out
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.emptylist.mdb.out
diff --git a/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh b/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh
new file mode 100644
index 0000000000..cf517cf937
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh
@@ -0,0 +1,6 @@
+$MDB /lib/libc.so <<EOF
+::typedef uint8_t rm_t
+::typedef -l
+::print -at rm_t
+::sizeof rm_t
+EOF
diff --git a/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh.out b/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh.out
new file mode 100644
index 0000000000..d37ffafbfb
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.libctype.ksh.out
@@ -0,0 +1,4 @@
+uint8_t
+rm_t
+0 rm_t
+sizeof (rm_t) = 1
diff --git a/usr/src/cmd/mdb/test/typedef/tst.models.ksh b/usr/src/cmd/mdb/test/typedef/tst.models.ksh
new file mode 100644
index 0000000000..8537ec443c
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.models.ksh
@@ -0,0 +1,11 @@
+lp64m="lp64 Lp64 LP64 lP64"
+lp32m="lp32 Lp32 LP32 lP32"
+ilp32m="ilp32 ilP32 iLp32 iLP32 Ilp32 IlP32 ILp32 ILP32"
+for m in $lp64m $lp32m $ilp32m; do
+ $MDB -e "::typedef -c $m"
+ if [[ ! $? -eq 0 ]]; then
+ echo "failed to create model $m" 2>&1
+ exit 1
+ fi
+done
+exit 0
diff --git a/usr/src/cmd/mdb/test/typedef/tst.struct.mdb b/usr/src/cmd/mdb/test/typedef/tst.struct.mdb
new file mode 100644
index 0000000000..2e0206e7ec
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.struct.mdb
@@ -0,0 +1,6 @@
+::typedef -c lp32
+::typedef "struct gift { uintptr_t stone[7]; void **white; }" gift_t
+::sizeof gift_t
+::print -at gift_t
+::sizeof struct gift
+::print -at struct gift
diff --git a/usr/src/cmd/mdb/test/typedef/tst.struct.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.struct.mdb.out
new file mode 100644
index 0000000000..9a7d801742
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.struct.mdb.out
@@ -0,0 +1,10 @@
+sizeof (gift_t) = 0x28
+0 gift_t {
+ 0 uintptr_t [7] stone
+ 20 void **white
+}
+sizeof (struct gift) = 0x28
+0 struct gift {
+ 0 uintptr_t [7] stone
+ 20 void **white
+}
diff --git a/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb b/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb
new file mode 100644
index 0000000000..85b3068e00
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb
@@ -0,0 +1,4 @@
+::typedef -c lp32
+::typedef "struct list { struct list *prev; struct list *next; }" list_t
+::sizeof list_t
+::print -at list_t
diff --git a/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb.out
new file mode 100644
index 0000000000..a6f4823ad1
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.structselfref.mdb.out
@@ -0,0 +1,5 @@
+sizeof (list_t) = 0x10
+0 list_t {
+ 0 struct list *prev
+ 8 struct list *next
+}
diff --git a/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb b/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb
new file mode 100644
index 0000000000..27cd56c186
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb
@@ -0,0 +1,4 @@
+::typedef -c lp32
+::typedef "struct gift { uintptr_t stone[7]; void **white; char owner[]; }" gift_t
+::sizeof gift_t
+::print -at gift_t
diff --git a/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb.out
new file mode 100644
index 0000000000..0a0d3d4029
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.structvla.mdb.out
@@ -0,0 +1,6 @@
+sizeof (gift_t) = 0x28
+0 gift_t {
+ 0 uintptr_t [7] stone
+ 20 void **white
+ 28 char [0] owner
+}
diff --git a/usr/src/cmd/mdb/test/typedef/tst.union.mdb b/usr/src/cmd/mdb/test/typedef/tst.union.mdb
new file mode 100644
index 0000000000..966446caee
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.union.mdb
@@ -0,0 +1,6 @@
+::typedef -c lp64
+::typedef "union ringbearer { int frodo; char sam; long gandalf; }" ringbearer_t;
+::sizeof ringbearer_t
+::print -at ringbearer_t
+::sizeof union ringbearer
+::print -at union ringbearer
diff --git a/usr/src/cmd/mdb/test/typedef/tst.union.mdb.out b/usr/src/cmd/mdb/test/typedef/tst.union.mdb.out
new file mode 100644
index 0000000000..2afc2eabb9
--- /dev/null
+++ b/usr/src/cmd/mdb/test/typedef/tst.union.mdb.out
@@ -0,0 +1,12 @@
+sizeof (ringbearer_t) = 8
+0 ringbearer_t {
+ 0 int frodo
+ 0 char sam
+ 0 long gandalf
+}
+sizeof (union ringbearer) = 8
+0 union ringbearer {
+ 0 int frodo
+ 0 char sam
+ 0 long gandalf
+}
diff --git a/usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen b/usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen
index 8db34d372d..2b82d41938 100644
--- a/usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen
+++ b/usr/src/cmd/ndmpd/ndmp/Makefile.rpcgen
@@ -39,13 +39,13 @@
all: $(NDMP_DIR)/ndmp.h $(NDMP_DIR)/ndmp_xdr.c $(NDMP_DIR)/ndmp_xdr.h
$(NDMP_DIR)/ndmp.h: $(NDMP_DIR)/ndmp.x
- rpcgen -C -h -o $(NDMP_DIR)/ndmp.h $(NDMP_DIR)/ndmp.x
+ $(RPCGEN) -C -h -o $(NDMP_DIR)/ndmp.h $(NDMP_DIR)/ndmp.x
$(NDMP_DIR)/ndmp_xdr.c: $(NDMP_DIR)/ndmp.x
- rpcgen -c -o $(NDMP_DIR)/ndmp_xdr.c $(NDMP_DIR)/ndmp.x
+ $(RPCGEN) -c -o $(NDMP_DIR)/ndmp_xdr.c $(NDMP_DIR)/ndmp.x
$(NDMP_DIR)/ndmp_xdr.h: $(NDMP_DIR)/ndmp.x
- rpcgen -C -h -o $(NDMP_DIR)/ndmp_xdr.h $(NDMP_DIR)/ndmp.x
+ $(RPCGEN) -C -h -o $(NDMP_DIR)/ndmp_xdr.h $(NDMP_DIR)/ndmp.x
rpcclean:
rm -f $(NDMP_DIR)/ndmp.h $(NDMP_DIR)/ndmp_xdr.h $(NDMP_DIR)/ndmp_xdr.c
diff --git a/usr/src/cmd/nscd/svc-nscd b/usr/src/cmd/nscd/svc-nscd
index 0c6aa1bc4b..78b318bf87 100644
--- a/usr/src/cmd/nscd/svc-nscd
+++ b/usr/src/cmd/nscd/svc-nscd
@@ -23,8 +23,8 @@
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2012 Joyent, Inc. All rights reserved.
#
-#ident "%Z%%M% %I% %E% SMI"
. /lib/svc/share/smf_include.sh
@@ -51,7 +51,7 @@ if (smf_is_system_labeled); then
$SMF_FMRI`
fi
if [ "$duration" != "transient" ]; then
- ( while true ; do sleep 3600 ; done ) &
+ exit $SMF_EXIT_NODAEMON
fi
# The real daemon is not started in non-global zones,
diff --git a/usr/src/cmd/passwd/Makefile b/usr/src/cmd/passwd/Makefile
index d53cad2cd6..079e8b6050 100644
--- a/usr/src/cmd/passwd/Makefile
+++ b/usr/src/cmd/passwd/Makefile
@@ -33,9 +33,7 @@ lint := LDLIBS += -lpasswdutil
LDFLAGS += $(ZIGNORE)
LDLIBS += -lbsm -lpam -lnsl
-CERRWARN += -_gcc=-Wno-switch
-CERRWARN += -_gcc=-Wno-parentheses
-CERRWARN += -_gcc=-Wno-uninitialized
+CPPFLAGS += -D__EXTENSIONS__
FILEMODE = 06555
XGETFLAGS += -a -x $(PROG).xcl
diff --git a/usr/src/cmd/passwd/passwd.c b/usr/src/cmd/passwd/passwd.c
index 851de6f237..c2baf63423 100644
--- a/usr/src/cmd/passwd/passwd.c
+++ b/usr/src/cmd/passwd/passwd.c
@@ -236,7 +236,7 @@ main(int argc, char *argv[])
int updated_reps;
- if (prognamep = strrchr(argv[0], '/'))
+ if ((prognamep = strrchr(argv[0], '/')) != NULL)
++prognamep;
else
prognamep = argv[0];
@@ -273,7 +273,7 @@ main(int argc, char *argv[])
argc -= optind;
if (argc < 1) {
- if ((usrname = getlogin()) == NULL) {
+ if ((usrname = getxlogin()) == NULL) {
struct passwd *pass = getpwuid(uid);
if (pass != NULL)
usrname = pass->pw_name;
@@ -1240,10 +1240,10 @@ get_attr(char *username, pwu_repository_t *repository, attrlist **attributes)
void
display_attr(char *usrname, attrlist *attributes)
{
- char *status;
+ char *status = NULL;
char *passwd;
long lstchg;
- int min, max, warn;
+ int min = 0, max = 0, warn = 0;
while (attributes) {
switch (attributes->type) {
@@ -1275,6 +1275,8 @@ display_attr(char *usrname, attrlist *attributes)
case ATTR_WARN:
warn = attributes->data.val_i;
break;
+ default:
+ break;
}
attributes = attributes->next;
}
diff --git a/usr/src/cmd/perl/Makefile b/usr/src/cmd/perl/Makefile
index 73217fa083..b238abdc17 100644
--- a/usr/src/cmd/perl/Makefile
+++ b/usr/src/cmd/perl/Makefile
@@ -32,7 +32,7 @@ clean := TARGET = clean
test := TARGET = test
# PERL_LEGACY is versions of Perl still delivered through ON
-PERL_VERSIONS = 5.10.0
+PERL_VERSIONS = 5.12
.PARALLEL: $(PERL_VERSIONS)
diff --git a/usr/src/cmd/perl/contrib/Sun/Solaris/PerlGcc/Makefile.PL b/usr/src/cmd/perl/contrib/Sun/Solaris/PerlGcc/Makefile.PL
index cbd36eb367..2f9a9dfeb1 100644
--- a/usr/src/cmd/perl/contrib/Sun/Solaris/PerlGcc/Makefile.PL
+++ b/usr/src/cmd/perl/contrib/Sun/Solaris/PerlGcc/Makefile.PL
@@ -22,6 +22,9 @@
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#
+#
+# Copyright 2011 Joyent Inc
+#
require 5.8.4;
use strict;
@@ -51,6 +54,12 @@ my $pver = sprintf('%vd', $^V);
# Figure out the appropriate Config.pm. Use an older version if necessary.
my $perlarch = ($arch eq "sparc") ? "sun4-solaris-64int":"i86pc-solaris-64int";
+if (! -d "/usr/perl5/$pver") {
+ my ($maj, $min, $micro);
+ ($maj, $min, $micro) = split(/\./, $pver, 3);
+ $pver = join(".", $maj, $min);
+}
+
my $configpm = "/usr/perl5/$pver/lib/$perlarch/Config.pm";
if (! -f $configpm) {
my $p = "config/$pver";
diff --git a/usr/src/cmd/perl/skel/Makefile b/usr/src/cmd/perl/skel/Makefile
index 73f9ebdcbd..d759f6e91f 100644
--- a/usr/src/cmd/perl/skel/Makefile
+++ b/usr/src/cmd/perl/skel/Makefile
@@ -31,7 +31,7 @@ KEEP_STATE_OFF = unset KEEP_STATE SUNPRO_DEPENDENCIES
# staging area to postprocess and install the result to $(ROOT)
STAGE = $(SRC)/cmd/perl/$(PERL_VERSION)/staging
-PERL=/usr/perl5/$(PERL_VERSION)/bin/perl
+PERL=$(ADJUNCT_PROTO)/usr/perl5/$(PERL_VERSION)/bin/perl
PERL_MM_ARGS = INSTALLDIRS=perl CC='$(CC)' LD='$(CC)'
diff --git a/usr/src/cmd/print/Makefile b/usr/src/cmd/print/Makefile
deleted file mode 100644
index c22b11279c..0000000000
--- a/usr/src/cmd/print/Makefile
+++ /dev/null
@@ -1,106 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/print/Makefile
-#
-
-include ../Makefile.cmd
-
-JAVA_SUBDIRS = printmgr
-
-PRINT_SUBDIRS = \
- scripts \
- lpget \
- lpset \
- conv_fix \
- printer-info \
- ppdmgr \
- selector \
- bsd-sysv-commands
-
-SUBDIRS = $(PRINT_SUBDIRS) $(JAVA_SUBDIRS)
-
-ROOTDIRS = $(ROOTLIB)/print
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-strip := TARGET= strip
-_msg := TARGET = _msg
-
-# For testing message catalogs
-_msg_test:= TARGET = _msg_test
-
-POFILE= print.po
-
-.KEEP_STATE:
-
-all install: $(ROOTDIRS) $(SUBDIRS)
-
-#
-# We define our own definition for _msg here because most of these
-# commands have the same PROG names as their counterparts in
-# cmd/lp. Using the _msg rule defined in Makefile.cmd would
-# result in clobbering the cmd/lp message files.
-# To get around this we will define one message file "print.po"
-# for these commands (except java printmgr). To build
-# this file we find all of the .c files and run xgettext on them.
-# Then concatenate this with the scripts.po file.
-#
-_msg: $(MSGDOMAIN) scripts $(JAVA_SUBDIRS)
- @$(RM) $(POFILE)
- $(XGETTEXT) -s `/bin/find . -type d -name SCCS -prune -o -type f -name '*.c' -print`
- @/bin/cat messages.po scripts/scripts.po | sed '/domain/d' > $(POFILE)
- @$(RM) messages.po
- $(RM) $(MSGDOMAIN)/$(POFILE)
- /bin/cp $(POFILE) $(MSGDOMAIN)
-
-#
-# Create a message file to test with.
-#
-_msg_test: scripts
- @$(RM) $(POFILE)
- $(XGETTEXT) -s -m "xxx" `/bin/find . -print | grep '\.c$$' | sed '/SCCS/d'`
- @/bin/cat messages.po scripts/scripts.po | sed '/domain/d' > $(POFILE)
- echo 'domain "SUNW_OST_OSCMD"' > SUNW_OST_OSCMD.po
- cat $(POFILE) >> SUNW_OST_OSCMD.po
- msgfmt SUNW_OST_OSCMD.po
- @$(RM) messages.po $(POFILE) SUNW_OST_OSCMD.po
-
-clean strip cstyle lint: $(SUBDIRS)
-
-clobber: $(SUBDIRS)
- $(RM) $(POFILE) $(CLOBBERFILES)
-
-$(ROOTDIRS) $(MSGDOMAIN):
- $(INS.dir)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
diff --git a/usr/src/cmd/print/Makefile.sp b/usr/src/cmd/print/Makefile.sp
deleted file mode 100644
index ebf97b53c6..0000000000
--- a/usr/src/cmd/print/Makefile.sp
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/print/Makefile.sp
-# Common makefile definitions (should be) used by all print(lp) makefiles
-#
-
-include $(SRC)/cmd/Makefile.cmd
-
-LPROOT= $(SRC)/cmd/lp
-NPRTROOT= $(LPROOT)
-ROOTVAR= $(ROOT)/var
-ROOTVARSP= $(ROOT)/var/spool
-ROOTVARSPOOLPRINT= $(ROOTVARSP)/print
-
-ROOTINIT_D= $(ROOTETC)/init.d
-ROOTRC0_D= $(ROOTETC)/rc0.d
-ROOTRCS_D= $(ROOTETC)/rcS.d
-ROOTRC1_D= $(ROOTETC)/rc1.d
-ROOTRC2_D= $(ROOTETC)/rc2.d
-
-
-ROOTETCLP= $(ROOTETC)/lp
-ROOTLIBLP= $(ROOTLIB)/lp
-ROOTBINLP= $(ROOTBIN)/lp
-ROOTLIBLPPOST = $(ROOTLIBLP)/postscript
-ROOTLOCALLP= $(ROOTLIBLP)/local
-ROOTLIBPRINT= $(ROOTLIB)/print
-ROOTLIBPRINTBIN= $(ROOTLIBPRINT)/bin
-
-ROOTUSRUCB= $(ROOT)/usr/ucb
-
-
-#
-# $(EMODES): Modes for executables
-# $(SMODES): Modes for setuid executables
-# $(DMODES): Modes for directories
-#
-EMODES = 0555
-SMODES = 04555
-DMODES = 0755
-
-
-INC = $(ROOT)/usr/include
-INCSYS = $(INC)/sys
-
-LPINC = $(SRC)/include
-#NPRTINC = $(NPRTROOT)/include
-NPRTINC = $(SRC)/lib/print/libprint/common
-LPLIB = $(SRC)/lib
-LDLIBS += -L$(LPLIB)
-
-
-LIBNPRT = -L$(ROOT)/usr/lib -lprint
-
-# lint definitions
-
-LINTFLAGS += -L $(SRC)/lib/print -lprint -lnsl -lsocket
-
-all :=TARGET= all
-install :=TARGET= install
-clean :=TARGET= clean
-clobber :=TARGET= clobber
-lint :=TARGET= lint
-strip :=TARGET= strip
-_msg :=TARGET= _msg
-
-ROOTLIBLPPROG= $(PROG:%=$(ROOTLIBLP)/%)
-ROOTBINLPPROG= $(PROG:%=$(ROOTBINLP)/%)
-ROOTETCLPPROG= $(PROG:%=$(ROOTETCLP)/%)
-ROOTUSRUCBPROG= $(PROG:%=$(ROOTUSRUCB)/%)
-ROOTLOCALLPPROG= $(PROG:%=$(ROOTLOCALLP)/%)
-ROOTLIBLPPOSTPROG= $(PROG:%=$(ROOTLIBLPPOST)/%)
-ROOTLIBPRINTPROG= $(PROG:%=$(ROOTLIBPRINT)/%)
-
-$(ROOTLIBLP)/% \
-$(ROOTBINLP)/% \
-$(ROOTETCLP)/% \
-$(ROOTUSRUCB)/% \
-$(ROOTLOCALLP)/% \
-$(ROOTLIBLPPOST)/% \
-$(ROOTLIBPRINT)/% : %
- $(INS.file)
diff --git a/usr/src/cmd/print/bsd-sysv-commands/Makefile b/usr/src/cmd/print/bsd-sysv-commands/Makefile
deleted file mode 100644
index ee6131c805..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/Makefile
+++ /dev/null
@@ -1,110 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#
-
-include ../Makefile.sp
-
-UCBPROGS = lpr lpq lprm lpc
-BINPROGS = lp lpstat cancel enable disable $(UCBPROGS)
-SBINPROGS = accept reject lpmove
-
-LIBPRINTPROGS = in.lpd
-
-LIBLPPROGS = $(BINPROGS) $(SBINPROGS)
-
-
-OBJS = $(BINPROGS:=.o) $(SBINPROGS:=.o) $(LIBPRINTPROGS:=.o) common.o
-
-ROOTLIBLPBIN=$(ROOTLIBLP)/bin
-
-ROOTBINPROGS = $(BINPROGS:%=$(ROOTBIN)/%)
-ROOTUSRSBINPROGS = $(SBINPROGS:%=$(ROOTUSRSBIN)/%)
-ROOTLIBPRINTPROGS = $(LIBPRINTPROGS:%=$(ROOTLIBPRINT)/%)
-ROOTLIBLPPROGS = $(LIBLPPROGS:%=$(ROOTLIBLPBIN)/%)
-
-
-FILEMODE = 0555
-
-include ../../Makefile.cmd
-
-MANIFEST= rfc1179.xml
-ROOTMANIFESTDIR= $(ROOTSVCAPPLICATIONPRINT)
-$(ROOTMANIFEST) := FILEMODE= 444
-
-LPLIB = $(SRC)/cmd/lp/lib
-LIBLP = $(LPLIB)/lp/liblp.a
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I.
-CPPFLAGS += -I../../../lib/print/libpapi-common/common
-CPPFLAGS += -I$(ROOT)/usr/include
-CPPFLAGS += -I../../lp/include
-LDLIBS += $(LIBLP) -lpapi -lc
-in.lpd:= CFLAGS += -DSOLARIS_PRIVATE_POST_0_9
-in.lpd:= LDLIBS += -lnsl -lsocket
-
-CERRWARN += -_gcc=-Wno-unused-variable
-CERRWARN += -_gcc=-Wno-uninitialized
-
-all: $(BINPROGS) $(SBINPROGS)
-
-# each program needs common.o as well
-$(BINPROGS) $(SBINPROGS) $(LIBPRINTPROGS): $(BINPROGS:%=%.c) $(SBINPROGS:%=%.c) $(LIBPRINTPROGS:%=%.c) common.o
- $(LINK.c) -o $@ $@.c common.o $(LDLIBS)
- $(POST_PROCESS)
-
-# ucb links (lptest is handled in usr/src/cmd/lp/cmd/Makefile)
-ROOTUSRUCB = $(ROOT)/usr/ucb
-ROOTUCBSYMLINKS = $(UCBPROGS:%=$(ROOTUSRUCB)/%)
-$(ROOTUSRUCB)/%: $(ROOTUSRUCB) %
-
-$(ROOTLIBLPBIN)/%: %
- $(INS.file)
-
-$(ROOTUCBSYMLINKS):
- $(RM) $@; $(SYMLINK) ../bin/$(@F) $@
-
-# usr/lib links
-ROOTUSRLIBSYMLINKS = $(SBINPROGS:%=$(ROOTLIB)/%)
-$(ROOTLIB)/%: $(ROOTLIB) %
-
-$(ROOTUSRLIBSYMLINKS):
- $(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
-
-.KEEP_STATE:
-
-install: $(ROOTLIBLPPROGS) \
- $(ROOTLIBPRINT) $(ROOTLIBPRINTPROGS) $(ROOTMANIFEST) \
- $(ROOTUCBSYMLINKS) $(ROOTUSRLIBSYMLINKS)
-
-check: $(CHKMANIFEST)
-
-clean:
- $(RM) $(OBJS)
-
-CLOBBERFILES += $(BINPROGS) $(SBINPROGS) $(LIBPRINTPROGS)
-
-lint:
-
-include ../../Makefile.targ
diff --git a/usr/src/cmd/print/bsd-sysv-commands/accept.c b/usr/src/cmd/print/bsd-sysv-commands/accept.c
deleted file mode 100644
index 74f392c9c3..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/accept.c
+++ /dev/null
@@ -1,117 +0,0 @@
-
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: accept.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout,
- gettext("Usage: %s destination ...\n"),
- name);
- exit(1);
-}
-
-int
-main(int ac, char *av[])
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- int exit_status = 0;
- int c;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av, "E")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_ALWAYS;
- break;
- default:
- usage(av[0]);
- }
-
- if (ac == optind)
- usage(av[0]);
-
- for (c = optind; c < ac; c++) {
- char *printer = av[c];
-
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit_status = 1;
- }
-
- status = papiPrinterResume(svc, printer);
- if (status == PAPI_OK) {
- printf(gettext(
- "Destination \"%s\" now accepting requests\n"),
- printer);
- } else if (status == PAPI_NOT_ACCEPTING) {
- fprintf(stderr, gettext(
- "Destination \"%s\" was already "
- "accepting requests.\n"), printer);
- exit_status = 1;
- } else {
- if (status == PAPI_OPERATION_NOT_SUPPORTED) {
- fprintf(stderr,
- verbose_papi_message(svc, status));
- } else {
- fprintf(stderr, gettext("accept: %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit_status = 1;
- }
- }
-
- papiServiceDestroy(svc);
- }
-
- return (exit_status);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/cancel.c b/usr/src/cmd/print/bsd-sysv-commands/cancel.c
deleted file mode 100644
index 23359d9b5e..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/cancel.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- *
- */
-
-/* $Id: cancel.c 147 2006-04-25 16:51:06Z njacobs $ */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout, "Usage: %s [-u user] (printer|request-id ...)\n", name);
- exit(1);
-}
-
-static int32_t
-get_job_id_requested(papi_job_t job) {
- int32_t rid = -1;
-
- papi_attribute_t **list = papiJobGetAttributeList(job);
- papiAttributeListGetInteger(list, NULL,
- "job-id-requested", &rid);
-
- return (rid);
-}
-
-int
-cancel_jobs_for_user(char *user, papi_encryption_t encryption, char *pname) {
-
- papi_status_t status;
- papi_service_t svc = NULL;
- char **printers = NULL;
- int i, exit_code;
-
- if (pname == NULL) {
- status = papiServiceCreate(&svc, NULL, NULL, NULL,
- cli_auth_callback, encryption, NULL);
- printers = interest_list(svc);
- papiServiceDestroy(svc);
- } else {
- list_append(&printers, strdup(pname));
- }
-
- if (printers == NULL)
- exit(0);
-
- for (i = 0; printers[i] != NULL; i++) {
- char *printer = printers[i];
-
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
-
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit(1);
- }
- exit_code = berkeley_cancel_request(svc, stdout, printer, 1,
- &user);
-
- papiServiceDestroy(svc);
- if (exit_code != 0)
- break;
- }
- free(printers);
- return (exit_code);
-}
-
-int
-main(int ac, char *av[])
-{
- int exit_code = 0;
- char *user = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- int c;
- int32_t rid = -1;
- int first_dest = 0;
-
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- if (ac == 1)
- usage(av[0]);
-
- while ((c = getopt(ac, av, "Eu:")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_REQUIRED;
- break;
- case 'u':
- user = optarg;
- break;
- default:
- usage(av[0]);
- }
-
- for (c = optind; c < ac; c++) {
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_job_t *jobs = NULL;
- char *printer = NULL;
- int32_t id = -1;
-
- status = papiServiceCreate(&svc, av[c], NULL, NULL,
- cli_auth_callback, encryption, NULL);
- if (status != PAPI_OK) {
- if (first_dest == 0) {
- (void) get_printer_id(av[c], &printer, &id);
- status = papiServiceCreate(&svc, printer, NULL,
- NULL, cli_auth_callback, encryption, NULL);
- }
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer,
- verbose_papi_message(svc, status));
- exit(1);
- }
- } else {
- first_dest = 1;
- printer = av[c];
- }
-
-#define OUT ((status == PAPI_OK) ? stdout : stderr)
-
- if (id != -1) { /* it's a job */
- char *mesg = gettext("cancelled");
-
- /*
- * Check if the job-id is job-id-requested
- * or job-id. If it is job-id-requested then find
- * corresponding job-id and send it to cancel
- */
- rid = job_to_be_queried(svc, printer, id);
- if (rid < 0) {
- /*
- * Either it is a remote job which cannot be
- * cancelled based on job-id or job-id is
- * not found
- */
- exit_code = 1;
- fprintf(OUT, "%s-%d: %s\n",
- printer, id, gettext("not-found"));
- } else {
- status = papiJobCancel(svc, printer, rid);
- if (status == PAPI_NOT_AUTHORIZED) {
- mesg = papiStatusString(status);
- exit_code = 1;
- } else if (status != PAPI_OK) {
- mesg = gettext(
- verbose_papi_message(
- svc, status));
- exit_code = 1;
- }
- fprintf(OUT, "%s-%d: %s\n", printer, id, mesg);
- }
-
- } else { /* it's a printer */
- if (user == NULL) {
-
- /* Remove first job from printer */
-
- status = papiPrinterListJobs(svc, printer,
- NULL, NULL, 0, &jobs);
-
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "ListJobs %s: %s\n"), printer,
- verbose_papi_message(svc, status));
- exit_code = 1;
- }
-
- if (jobs != NULL && *jobs != NULL) {
- char *mesg = gettext("cancelled");
- id = papiJobGetId(*jobs);
-
- status = papiJobCancel(svc,
- printer, id);
-
- if (status == PAPI_NOT_AUTHORIZED) {
- mesg = papiStatusString(status);
- exit_code = 1;
- } else if (status != PAPI_OK) {
- mesg = gettext(
- verbose_papi_message(
- svc, status));
- exit_code = 1;
- }
- /*
- * If job-id-requested exists for this
- * job-id then that should be displayed
- */
- rid = get_job_id_requested(*jobs);
- if (rid >= 0)
- fprintf(OUT, "%s-%d: %s\n",
- printer, rid, mesg);
- else
- fprintf(OUT, "%s-%d: %s\n",
- printer, id, mesg);
- }
- papiJobListFree(jobs);
-
- } else {
- /* Purging user's print jobs */
- exit_code = cancel_jobs_for_user(user,
- encryption, printer);
- }
- }
- papiServiceDestroy(svc);
- }
-
- if (optind == ac)
- exit_code = cancel_jobs_for_user(user, encryption, NULL);
-
- return (exit_code);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/common.c b/usr/src/cmd/print/bsd-sysv-commands/common.c
deleted file mode 100644
index 5df4e3b9b7..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/common.c
+++ /dev/null
@@ -1,678 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: common.c 162 2006-05-08 14:17:44Z njacobs $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <alloca.h>
-#include <string.h>
-#include <libintl.h>
-#include <ctype.h>
-#include <pwd.h>
-#include <papi.h>
-#include "common.h"
-
-#ifndef HAVE_GETPASSPHRASE /* some systems don't have getpassphrase() */
-#define getpassphrase getpass
-#endif
-
-/* give the most verbose error message to the caller */
-char *
-verbose_papi_message(papi_service_t svc, papi_status_t status)
-{
- char *mesg;
-
- mesg = papiServiceGetStatusMessage(svc);
-
- if (mesg == NULL)
- mesg = papiStatusString(status);
-
- return (mesg);
-}
-
-static int
-match_job(int id, char *user, int ac, char *av[])
-{
- int i;
-
- for (i = 0; i < ac; i++)
- if (strcmp("-", av[i]) == 0)
- return (0); /* "current" user match */
- else if ((isdigit(av[i][0]) != 0) && (id == atoi(av[i])))
- return (0); /* job-id match */
- else if (strcmp(user, av[i]) == 0)
- return (0); /* user match */
-
- return (-1);
-}
-
-/*
- * return 0 : argument passed is job-id && job-id matches
- * or argument passed is user
- */
-static int
-match_job_rid(int id, int ac, char *av[])
-{
- int i;
-
- for (i = 0; i < ac; i++)
- if (isdigit(av[i][0]) != 0) {
- if (id == atoi(av[i]))
- /* job-id match */
- return (0);
- } else
- /* argument passed is user */
- return (0);
- return (-1);
-}
-
-static struct {
- char *mime_type;
- char *lp_type;
-} type_map[] = {
- { "text/plain", "simple" },
- { "application/octet-stream", "raw" },
- { "application/octet-stream", "any" },
- { "application/postscript", "postscript" },
- { "application/postscript", "ps" },
- { "application/x-cif", "cif" },
- { "application/x-dvi", "dvi" },
- { "application/x-plot", "plot" },
- { "application/x-ditroff", "troff" },
- { "application/x-troff", "otroff" },
- { "application/x-pr", "pr" },
- { "application/x-fortran", "fortran" },
- { "application/x-raster", "raster" },
- { NULL, NULL}
-};
-
-char *
-lp_type_to_mime_type(char *lp_type)
-{
- int i;
-
- if (lp_type == NULL)
- return ("application/octet-stream");
-
- for (i = 0; type_map[i].lp_type != NULL; i++)
- if (strcasecmp(type_map[i].lp_type, lp_type) == 0)
- return (type_map[i].mime_type);
-
- return (lp_type);
-}
-
-/*
- * to support job/printer status
- */
-static char *
-state_string(int state)
-{
- switch (state) {
- case 3:
- return (gettext("idle"));
- case 4:
- return (gettext("processing"));
- case 5:
- return (gettext("stopped"));
- default:
- return (gettext("unknown"));
- }
-}
-
-static char *_rank_suffixes[] = {
- "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"
-};
-
-static char *
-rank_string(const int rank)
-{
- static char buf[12];
-
- if (rank < 0)
- snprintf(buf, sizeof (buf), gettext("invalid"));
- else if (rank == 0)
- snprintf(buf, sizeof (buf), gettext("active"));
- else if ((rank > 10) && (rank < 14))
- sprintf(buf, "%dth", rank);
- else
- sprintf(buf, "%d%s", rank, _rank_suffixes[rank % 10]);
-
- return (buf);
-}
-
-static void
-printer_state_line(FILE *fp, papi_printer_t p, int num_jobs, char *name)
-{
- papi_attribute_t **list = papiPrinterGetAttributeList(p);
- int state = 0;
- char *reason = "";
-
- (void) papiAttributeListGetInteger(list, NULL,
- "printer-state", &state);
- (void) papiAttributeListGetString(list, NULL,
- "printer-state-reasons", &reason);
- (void) papiAttributeListGetString(list, NULL,
- "printer-name", &name);
-
- if ((state != 0x03) || (num_jobs != 0)) {
- fprintf(fp, "%s: %s", name, state_string(state));
- if ((state == 0x05) ||
- (state == 0x06) ||
- (state == 0x07) ||
- (state == 0x08)) /* stopped */
- fprintf(fp, ": %s\n", reason);
- else
- fprintf(fp, "\n");
- } else
- fprintf(fp, "no entries\n");
-}
-
-static void
-print_header(FILE *fp)
-{
- fprintf(fp, gettext("Rank\tOwner\t Job\tFile(s)\t\t\t\tTotal Size\n"));
-}
-
-static void
-print_job_line(FILE *fp, int count, papi_job_t job, int fmt, int ac, char *av[])
-{
- papi_attribute_t **list = papiJobGetAttributeList(job);
- int copies = 1, id = 0, rank = count, size = 0;
- char *name = "print job";
- char *user = "nobody";
- char *host = "localhost";
- char *suffix = "k";
-
- (void) papiAttributeListGetInteger(list, NULL,
- "job-id", &id);
- (void) papiAttributeListGetInteger(list, NULL,
- "job-id-requested", &id);
- (void) papiAttributeListGetString(list, NULL,
- "job-originating-user-name", &user);
- (void) papiAttributeListGetString(list, NULL,
- "job-originating-host-name", &host);
-
- /* if we are looking and it doesn't match, return early */
- if ((ac > 0) && (match_job(id, user, ac, av) < 0))
- return;
-
- (void) papiAttributeListGetInteger(list, NULL,
- "copies", &copies);
- (void) papiAttributeListGetInteger(list, NULL,
- "number-of-intervening-jobs", &rank);
-
- if (papiAttributeListGetInteger(list, NULL, "job-octets", &size)
- == PAPI_OK)
- suffix = "bytes";
- else
- (void) papiAttributeListGetInteger(list, NULL,
- "job-k-octets", &size);
- (void) papiAttributeListGetString(list, NULL,
- "job-name", &name);
-
- size *= copies;
-
- if (fmt == 3) {
- fprintf(fp, gettext("%s\t%-8.8s %d\t%-32.32s%d %s\n"),
- rank_string(++rank), user, id, name, size, suffix);
- } else
- fprintf(fp, gettext(
- "\n%s: %s\t\t\t\t[job %d %s]\n\t%-32.32s\t%d %s\n"),
- user, rank_string(++rank), id, host, name, size,
- suffix);
-}
-
-/*
- * to support job cancelation
- */
-static void
-cancel_job(papi_service_t svc, FILE *fp, char *printer, papi_job_t job,
- int ac, char *av[])
-{
- papi_status_t status;
- papi_attribute_t **list = papiJobGetAttributeList(job);
- int id = -1;
- int rid = -1;
- char *user = "";
- char *mesg = gettext("cancelled");
- int i = 0;
-
- papiAttributeListGetInteger(list, NULL,
- "job-id", &id);
- papiAttributeListGetInteger(list, NULL,
- "job-id-requested", &rid);
- papiAttributeListGetString(list, NULL,
- "job-originating-user-name", &user);
-
- /* if we are looking and it doesn't match, return early */
- if ((ac > 0) && (match_job(id, user, ac, av) < 0) &&
- (match_job(rid, user, ac, av) < 0))
- return;
-
- /*
- * A remote lpd job should be cancelled only based on
- * job-id-requested
- */
- if (rid != -1) {
- if (match_job_rid(rid, ac, av) == -1)
- /* job-id mismatch */
- return;
- }
-
- status = papiJobCancel(svc, printer, id);
- if (status != PAPI_OK)
- mesg = papiStatusString(status);
-
- if (rid != -1)
- fprintf(fp, "%s-%d: %s\n", printer, rid, mesg);
- else
- fprintf(fp, "%s-%d: %s\n", printer, id, mesg);
-}
-
-int
-berkeley_queue_report(papi_service_t svc, FILE *fp, char *dest, int fmt,
- int ac, char *av[])
-{
- papi_status_t status;
- papi_printer_t p = NULL;
- papi_job_t *jobs = NULL;
- char *pattrs[] = { "printer-name", "printer-state",
- "printer-state-reasons", NULL };
- char *jattrs[] = { "job-name", "job-octets", "job-k-octets", "job-id",
- "job-originating-user-name", "job-id-requested",
- "job-originating-host-name",
- "number-of-intervening-jobs", NULL };
- int num_jobs = 0;
-
- status = papiPrinterQuery(svc, dest, pattrs, NULL, &p);
- if (status != PAPI_OK) {
- fprintf(fp, gettext(
- "Failed to query service for state of %s: %s\n"),
- dest, verbose_papi_message(svc, status));
- return (-1);
- }
-
- status = papiPrinterListJobs(svc, dest, jattrs, PAPI_LIST_JOBS_ALL,
- 0, &jobs);
- if (status != PAPI_OK) {
- fprintf(fp, gettext(
- "Failed to query service for jobs on %s: %s\n"),
- dest, verbose_papi_message(svc, status));
- return (-1);
- }
- if (jobs != NULL) {
- while (jobs[num_jobs] != NULL)
- num_jobs++;
- }
-
- printer_state_line(fp, p, num_jobs, dest);
- if (num_jobs > 0) {
- int i;
-
- if (fmt == 3)
- print_header(fp);
- for (i = 0; jobs[i] != NULL; i++)
- print_job_line(fp, i, jobs[i], fmt, ac, av);
- }
-
- papiPrinterFree(p);
- papiJobListFree(jobs);
-
- return (num_jobs);
-}
-
-int
-berkeley_cancel_request(papi_service_t svc, FILE *fp, char *dest,
- int ac, char *av[])
-{
- papi_status_t status;
- papi_job_t *jobs = NULL;
- char *jattrs[] = { "job-originating-user-name", "job-id",
- "job-id-requested", NULL };
-
- status = papiPrinterListJobs(svc, dest, jattrs, PAPI_LIST_JOBS_ALL,
- 0, &jobs);
-
- if (status != PAPI_OK) {
- fprintf(fp, gettext("Failed to query service for %s: %s\n"),
- dest, verbose_papi_message(svc, status));
- return (-1);
- }
-
- /* cancel the job(s) */
- if (jobs != NULL) {
- int i;
-
- for (i = 0; jobs[i] != NULL; i++)
- cancel_job(svc, fp, dest, jobs[i], ac, av);
- }
-
- papiJobListFree(jobs);
-
- return (0);
-}
-
-int
-get_printer_id(char *name, char **printer, int *id)
-{
- int result = -1;
-
- if (name != NULL) {
- char *p = strrchr(name, '-');
-
- *printer = name;
- if (p != NULL) {
- char *s = NULL;
-
- *id = strtol(p + 1, &s, 10);
- if (s[0] != '\0')
- *id = -1;
- else
- *p = '\0';
- result = 0;
- } else
- *id = -1;
- }
-
- return (result);
-}
-
-/*
- * strsplit() splits a string into a NULL terminated array of substrings
- * determined by a seperator. The original string is modified, and newly
- * allocated space is only returned for the array itself. If more than
- * 1024 substrings exist, they will be ignored.
- */
-char **
-strsplit(char *string, const char *seperators)
-{
- char *list[BUFSIZ],
- **result;
- int length = 0;
-
- if ((string == NULL) || (seperators == NULL))
- return (NULL);
-
- (void) memset(list, 0, sizeof (list));
- for (list[length] = strtok(string, seperators);
- (list[length] != NULL) && (length < (BUFSIZ - 2));
- list[length] = strtok(NULL, seperators))
- length++;
-
- if ((result = (char **)calloc(length+1, sizeof (char *))) != NULL)
- (void) memcpy(result, list, length * sizeof (char *));
-
- return (result);
-}
-
-papi_status_t
-jobSubmitSTDIN(papi_service_t svc, char *printer, char *prefetch, int len,
- papi_attribute_t **list, papi_job_t *job)
-{
- papi_status_t status;
- papi_stream_t stream = NULL;
- int rc;
- char buf[BUFSIZ];
-
- status = papiJobStreamOpen(svc, printer, list, NULL, &stream);
-
- if (len > 0)
- status = papiJobStreamWrite(svc, stream, prefetch, len);
-
- while ((status == PAPI_OK) && ((rc = read(0, buf, sizeof (buf))) > 0))
- status = papiJobStreamWrite(svc, stream, buf, rc);
-
- if (status == PAPI_OK)
- status = papiJobStreamClose(svc, stream, job);
-
- return (status);
-}
-
-/*
- * is_postscript() will detect if the file passed in contains postscript
- * data. A one is returned if the file contains postscript, zero is returned
- * if the file is not postscript, and -1 is returned if an error occurs
- */
-#define PS_MAGIC "%!"
-#define PC_PS_MAGIC "^D%!"
-int
-is_postscript_stream(int fd, char *buf, int *len)
-{
- if ((*len = read(fd, buf, *len)) < 0) {
- close(fd);
- return (-1);
- }
-
- if ((strncmp(buf, PS_MAGIC, sizeof (PS_MAGIC) - 1) == 0) ||
- (strncmp(buf, PC_PS_MAGIC, sizeof (PC_PS_MAGIC) - 1) == 0))
- return (1);
- else
- return (0);
-}
-
-int
-is_postscript(const char *file)
-{
- int rc = -1;
- int fd;
-
- if ((fd = open(file, O_RDONLY)) >= 0) {
- char buf[3];
- int len = sizeof (buf);
-
- rc = is_postscript_stream(fd, buf, &len);
- close(fd);
- }
-
- return (rc);
-}
-
-static char **
-all_list(papi_service_t svc)
-{
- papi_status_t status;
- papi_printer_t printer = NULL;
- char *list[] = { "member-names", NULL };
- char **result = NULL;
-
- status = papiPrinterQuery(svc, "_all", list, NULL, &printer);
- if ((status == PAPI_OK) && (printer != NULL)) {
- papi_attribute_t **attributes =
- papiPrinterGetAttributeList(printer);
- if (attributes != NULL) {
- void *iter = NULL;
- char *value = NULL;
-
- for (status = papiAttributeListGetString(attributes,
- &iter, "member-names", &value);
- status == PAPI_OK;
- status = papiAttributeListGetString(attributes,
- &iter, NULL, &value))
- list_append(&result, strdup(value));
- }
- papiPrinterFree(printer);
- }
-
- return (result);
-}
-
-static char **
-printers_list(papi_service_t svc)
-{
- papi_status_t status;
- papi_printer_t *printers = NULL;
- char *keys[] = { "printer-name", NULL };
- char **result = NULL;
-
- status = papiPrintersList(svc, keys, NULL, &printers);
- if ((status == PAPI_OK) && (printers != NULL)) {
- int i;
-
- for (i = 0; printers[i] != NULL; i++) {
- papi_attribute_t **attributes =
- papiPrinterGetAttributeList(printers[i]);
- char *name = NULL;
-
- (void) papiAttributeListGetString(attributes, NULL,
- "printer-name", &name);
- if ((name != NULL) && (strcmp(name, "_default") != 0))
- list_append(&result, strdup(name));
- }
- papiPrinterListFree(printers);
- }
-
- return (result);
-}
-
-char **
-interest_list(papi_service_t svc)
-{
- static char been_here;
- static char **result;
-
- if (been_here == 0) { /* only do this once */
- been_here = 1;
-
- if ((result = all_list(svc)) == NULL)
- result = printers_list(svc);
- }
-
- return (result);
-}
-
-char *
-localhostname()
-{
- static char *result;
-
- if (result == NULL) {
- static char buf[256];
-
- if (gethostname(buf, sizeof (buf)) == 0)
- result = buf;
- }
-
- return (result);
-}
-
-int
-cli_auth_callback(papi_service_t svc, void *app_data)
-{
- char prompt[BUFSIZ];
- char *user, *svc_name, *passphrase;
-
- /* get the name of the service we are contacting */
- if ((svc_name = papiServiceGetServiceName(svc)) == NULL)
- return (-1);
-
- /* find our who we are supposed to be */
- if ((user = papiServiceGetUserName(svc)) == NULL) {
- struct passwd *pw;
-
- if ((pw = getpwuid(getuid())) != NULL)
- user = pw->pw_name;
- else
- user = "nobody";
- }
-
- /* build the prompt string */
- snprintf(prompt, sizeof (prompt),
- gettext("passphrase for %s to access %s: "), user, svc_name);
-
- /* ask for the passphrase */
- if ((passphrase = getpassphrase(prompt)) != NULL)
- papiServiceSetPassword(svc, passphrase);
-
- return (0);
-}
-
-int32_t
-job_to_be_queried(papi_service_t svc, char *printer, int32_t id)
-{
- papi_job_t *jobs = NULL;
- papi_status_t status;
- int ret = -1;
- char *jattrs[] = { "job-id",
- "job-id-requested", NULL };
-
- status = papiPrinterListJobs(svc, printer, jattrs, PAPI_LIST_JOBS_ALL,
- 0, &jobs);
-
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("Failed to query service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- return (-1);
- }
-
- if (jobs != NULL) {
- int i = 0;
-
- for (i = 0; jobs[i] != NULL; i++) {
- int32_t rid = -1;
- int32_t jid = -1;
- papi_attribute_t **list =
- papiJobGetAttributeList(jobs[i]);
-
- papiAttributeListGetInteger(list, NULL,
- "job-id-requested", &rid);
- papiAttributeListGetInteger(list, NULL,
- "job-id", &jid);
-
- /*
- * check if id matches with either rid or jid
- */
- if (rid == id) {
- /* get the actual id and return it */
- papiAttributeListGetInteger(list, NULL,
- "job-id", &id);
- return (id);
- } else if (id == jid) {
- if (rid != -1) {
- /*
- * It is a remote lpd job
- * can be cancelled only
- * using rid
- */
- ret = -1;
- } else {
- /*
- * its local or
- * remote ipp job
- */
- return (id);
- }
- }
- }
- return (ret);
- }
- return (id);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/common.h b/usr/src/cmd/print/bsd-sysv-commands/common.h
deleted file mode 100644
index a729930bd5..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/common.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _BSD_SYSV_COMMON_H
-#define _BSD_SYSV_COMMON_H
-
-/* $Id: common.h 162 2006-05-08 14:17:44Z njacobs $ */
-
-#include <papi.h>
-
-#include <config-site.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char **strsplit(char *string, const char *seperators);
-extern char *verbose_papi_message(papi_service_t svc, papi_status_t status);
-
-extern int berkeley_cancel_request(papi_service_t svc, FILE *fp, char *dest,
- int ac, char *av[]);
-
-extern int get_printer_id(char *name, char **printer, int *id);
-
-extern int berkeley_queue_report(papi_service_t svc, FILE *fp, char *dest,
- int fmt, int ac, char *av[]);
-
-extern papi_status_t jobSubmitSTDIN(papi_service_t svc, char *printer,
- char *prefetch, int len,
- papi_attribute_t **list, papi_job_t *job);
-
-extern char **interest_list(papi_service_t svc);
-extern char *localhostname();
-extern char *lp_type_to_mime_type(char *lp_type);
-extern int is_postscript(const char *file);
-extern int is_postscript_stream(int fd, char *buf, int *len);
-
-extern int cli_auth_callback(papi_service_t svc, void *app_data);
-
-extern int32_t job_to_be_queried(papi_service_t svc, char *printer, int32_t id);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _BSD_SYSV_COMMON_H */
diff --git a/usr/src/cmd/print/bsd-sysv-commands/disable.c b/usr/src/cmd/print/bsd-sysv-commands/disable.c
deleted file mode 100644
index 0b3cb71f0c..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/disable.c
+++ /dev/null
@@ -1,163 +0,0 @@
-
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: disable.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout,
- gettext("Usage: %s [-c] [-W] [-r reason] destination ...\n"),
- name);
- exit(1);
-}
-
-static void
-cancel_active_job(papi_service_t svc, char *dest)
-{
- papi_status_t status;
- papi_job_t *j = NULL;
- char *req_attrs[] = { "job-state", "job-id", NULL };
-
- status = papiPrinterListJobs(svc, dest, req_attrs, 0, 0, &j);
- if ((status == PAPI_OK) && (j != NULL)) {
- int i;
-
- for (i = 0; j[i] != NULL; j++) {
- papi_attribute_t **a = papiJobGetAttributeList(j[i]);
- int state = 0;
-
- if (a == NULL)
- continue;
-
- (void) papiAttributeListGetInteger(a, NULL,
- "job-state", &state);
- if (state & 0x082A) { /* If state is RS_ACTIVE */
- int32_t id = papiJobGetId(j[i]);
-
- (void) papiJobCancel(svc, dest, id);
- }
- }
- papiJobListFree(j);
- }
-}
-
-int
-main(int ac, char *av[])
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- int exit_status = 0;
- int cancel = 0;
- int pending = 0; /* not implemented */
- char *reason = NULL;
- int c;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av, "EcWr:")) != EOF)
- switch (c) {
- case 'c': /* cancel active job first */
- cancel = 1;
- break;
- case 'W': /* wait for active request, not implemented */
- pending = 1;
- break;
- case 'r': /* reason */
- reason = optarg;
- break;
- case 'E':
- encryption = PAPI_ENCRYPT_NEVER;
- break;
- default:
- usage(av[0]);
- }
-
- if (ac <= optind)
- usage(av[0]);
-
- while (optind < ac) {
- char *printer = av[optind++];
-
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit_status = 1;
- }
-
- status = papiPrinterDisable(svc, printer, reason);
- if (status == PAPI_OK) {
- printf(gettext("printer \"%s\" now disabled\n"),
- printer);
- } else if (status == PAPI_NOT_ACCEPTING) {
- fprintf(stderr, gettext(
- "Destination \"%s\" was already disabled.\n"),
- printer);
- exit_status = 1;
- } else {
- /* The operation is not supported in lpd protocol */
- if (status == PAPI_OPERATION_NOT_SUPPORTED) {
- fprintf(stderr,
- verbose_papi_message(svc, status));
- } else {
- fprintf(stderr, gettext("disable: %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- }
- exit_status = 1;
- }
-
- if (cancel != 0)
- cancel_active_job(svc, printer);
-
- papiServiceDestroy(svc);
- }
-
- return (exit_status);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/enable.c b/usr/src/cmd/print/bsd-sysv-commands/enable.c
deleted file mode 100644
index c197337e1e..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/enable.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: enable.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout,
- gettext("Usage: %s destination ...\n"),
- name);
- exit(1);
-}
-
-int
-main(int ac, char *av[])
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- int exit_status = 0;
- int c;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av, "E")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_ALWAYS;
- break;
- default:
- usage(av[0]);
- }
-
- if (ac == optind)
- usage(av[0]);
-
- for (c = optind; c < ac; c++) {
- char *printer = av[c];
-
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit_status = 1;
- }
-
- status = papiPrinterEnable(svc, printer);
- if (status == PAPI_OK) {
- printf(gettext("printer \"%s\" now enabled\n"),
- printer);
- } else if (status == PAPI_NOT_ACCEPTING) {
- fprintf(stderr, gettext(
- "Destination \"%s\" was already enabled.\n"),
- printer);
- exit_status = 1;
- } else {
- /* The operation is not supported in lpd protocol */
- if (status == PAPI_OPERATION_NOT_SUPPORTED) {
- fprintf(stderr,
- verbose_papi_message(svc, status));
- } else {
- fprintf(stderr, gettext("enable: %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- }
- exit_status = 1;
- }
-
- papiServiceDestroy(svc);
- }
-
- return (exit_status);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/in.lpd.c b/usr/src/cmd/print/bsd-sysv-commands/in.lpd.c
deleted file mode 100644
index 1b058ac291..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/in.lpd.c
+++ /dev/null
@@ -1,786 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: in.lpd.c 170 2006-05-20 05:58:49Z njacobs $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <syslog.h>
-#include <libintl.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <sys/systeminfo.h>
-
-#include <papi.h>
-#include <uri.h>
-#include "common.h"
-
-#define ACK(fp) { (void) fputc('\0', fp); (void) fflush(fp); }
-#define NACK(fp) { (void) fputc('\1', fp); (void) fflush(fp); }
-
-/*
- * This file contains the front-end of the BSD Print Protocol adaptor. This
- * code assumes a BSD Socket interface to the networking side.
- */
-
-static char *
-remote_host_name(FILE *fp)
-{
- struct hostent *hp;
- struct sockaddr_in6 peer;
- socklen_t peer_len = sizeof (peer);
- int fd = fileno(fp);
- int error_num;
- char tmp_buf[INET6_ADDRSTRLEN];
- char *hostname;
-
- /* who is our peer ? */
- if (getpeername(fd, (struct sockaddr *)&peer, &peer_len) < 0) {
- if ((errno != ENOTSOCK) && (errno != EINVAL))
- return (NULL);
- else
- return (strdup("localhost"));
- }
-
- /* get their name or return a string containing their address */
- if ((hp = getipnodebyaddr((const char *)&peer.sin6_addr,
- sizeof (struct in6_addr), AF_INET6,
- &error_num)) == NULL) {
- return (strdup(inet_ntop(peer.sin6_family,
- &peer.sin6_addr, tmp_buf, sizeof (tmp_buf))));
- }
-
- hostname = strdup(hp->h_name);
- if (is_localhost(hp->h_name) != 0)
- return (strdup("localhost"));
-
- /* It must be someone else */
- return (hostname);
-}
-
-static void
-fatal(FILE *fp, char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vsyslog(LOG_DEBUG, fmt, ap);
- vfprintf(fp, fmt, ap);
- va_end(ap);
- exit(1);
-}
-
-static void
-cleanup(char ***files, char **cf)
-{
- if (*files != NULL) {
- int i;
-
- for (i = 0; (*files)[i] != NULL; i++) {
- (void) unlink((*files)[i]);
- free((*files)[i]);
- }
- free(*files);
- *files = NULL;
- }
-
- if (*cf != NULL) {
- free(*cf);
- *cf = NULL;
- }
-}
-
-static papi_attribute_t **
-parse_cf(papi_service_t svc, char *cf, char **files)
-{
- papi_attribute_t **list = NULL;
- char previous = NULL;
- char *entry;
- int copies_set = 0;
- int copies = 0;
-
- for (entry = strtok(cf, "\n"); entry != NULL;
- entry = strtok(NULL, "\n")) {
- char *format = NULL;
-
- /* count the copies */
- if ((entry[0] >= 'a') && (entry[0] <= 'z') &&
- (copies_set == 0) && (previous == entry[0]))
- copies++;
- else if ((previous >= 'a') && (previous <= 'z'))
- copies_set = 1;
- previous = entry[0];
-
- /* process the control message */
- switch (entry[0]) {
- /* RFC-1179 options */
- case 'J': /* RFC-1179 Banner Job Name */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-name", ++entry);
- break;
- case 'C': /* RFC-1179 Banner Class Name */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-class", ++entry);
- break;
- case 'L': /* RFC-1179 Banner toggle */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-sheets", "standard");
- break;
- case 'T': /* RFC-1179 Title (pr) */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "pr-title", ++entry);
- break;
- case 'H': /* RFC-1179 Host */
- /*
- * use the host as known by us, not by them
- *
- * papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- * "job-originating-host-name", ++entry);
- */
- break;
- case 'P': /* RFC-1179 User */
- ++entry;
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-originating-user-name", entry);
- papiServiceSetUserName(svc, entry);
- break;
- case 'M': /* RFC-1179 Mail to User */
- papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
- "rfc-1179-mail", 1);
- break;
- case 'W': /* RFC-1179 Width (pr) */
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "pr-width", atoi(++entry));
- break;
- case 'I': /* RFC-1179 Indent (pr) */
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "pr-indent", atoi(++entry));
- break;
- case 'N': /* RFC-1179 Filename */
- /* could have HPUX extension embedded */
- if (entry[1] != ' ') { /* real pathname */
-#ifdef DEBUG
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL,
- "flist", ++entry);
-#endif
- } else if (entry[2] == 'O') /* HPUX lp -o options */
- papiAttributeListFromString(&list,
- PAPI_ATTR_APPEND, ++entry);
- break;
- case 'U': /* RFC-1179 Unlink */
- break; /* ignored */
- case '1': /* RFC-1179 TROFF Font R */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-font-r", ++entry);
- break;
- case '2': /* RFC-1179 TROFF Font I */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-font-i", ++entry);
- break;
- case '3': /* RFC-1179 TROFF Font B */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-font-b", ++entry);
- break;
- case '4': /* RFC-1179 TROFF Font S */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-font-s", ++entry);
- break;
- case 'f': /* RFC-1179 ASCII file (print) */
- format = "text/plain";
- if (is_postscript(files[0]) == 1)
- format = "application/postscript";
- break;
- case 'l': /* RFC-1179 CATV file (print) */
- format = "application/octet-stream";
- if (is_postscript(files[0]) == 1)
- format = "application/postscript";
- break;
- case 'o': /* RFC-1179 Postscript file (print) */
- format = "application/postscript";
- break;
- case 'p': /* RFC-1179 PR file (print) */
- format = "application/x-pr";
- papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
- "pr-filter", 1);
- break;
- case 't': /* RFC-1179 TROFF file (print) */
- format = "application/x-troff";
- break;
- case 'n': /* RFC-1179 DITROFF file (print) */
- format = "application/x-ditroff";
- break;
- case 'd': /* RFC-1179 DVI file (print) */
- format = "application/x-dvi";
- break;
- case 'g': /* RFC-1179 GRAPH file (print) */
- format = "application/x-plot";
- break;
- case 'c': /* RFC-1179 CIF file (print) */
- format = "application/x-cif";
- break;
- case 'v': /* RFC-1179 RASTER file (print) */
- format = "application/x-raster";
- break;
- case 'r': /* RFC-1179 FORTRAN file (print) */
- format = "application/x-fortran";
- break;
- /* Sun Solaris Extensions */
- case 'O':
- ++entry;
- {
- int rd, wr;
-
- for (rd = wr = 0; entry[rd] != '\0'; rd++) {
- if (entry[rd] == '"')
- continue;
- if (rd != wr)
- entry[wr] = entry[rd];
- wr++;
- }
- entry[wr] = '\0';
-
- papiAttributeListFromString(&list,
- PAPI_ATTR_APPEND, entry);
- }
- break;
- case '5':
- ++entry;
- switch (entry[0]) {
- case 'f': /* Solaris form */
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL,
- "form", ++entry);
- break;
- case 'H': /* Solaris handling */
- ++entry;
- if (strcasecmp(entry, "hold") == 0)
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL,
- "job-hold-until", "indefinite");
- else if (strcasecmp(entry, "immediate") == 0)
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL,
- "job-hold-until", "no-hold");
- else
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL,
- "job-hold-until", entry);
- break;
- case 'p': /* Solaris notification */
- papiAttributeListAddBoolean(&list,
- PAPI_ATTR_EXCL, "rfc-1179-mail", 1);
- break;
- case 'P': { /* Solaris page list */
- char buf[BUFSIZ];
-
- snprintf(buf, sizeof (buf), "page-ranges=%s",
- ++entry);
- papiAttributeListFromString(&list,
- PAPI_ATTR_EXCL, buf);
- }
- break;
- case 'q': { /* Solaris priority */
- int i = atoi(++entry);
-
- i = 100 - (i * 2.5);
- if ((i < 1) || (i > 100))
- i = 50;
- papiAttributeListAddInteger(&list,
- PAPI_ATTR_EXCL, "job-priority", i);
- }
- break;
- case 'S': /* Solaris character set */
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL, "lp-charset",
- ++entry);
- break;
- case 'T': /* Solaris type */
- format = lp_type_to_mime_type(++entry);
- break;
- case 'y': /* Solaris mode */
- papiAttributeListAddString(&list,
- PAPI_ATTR_APPEND, "lp-modes", ++entry);
- break;
- default:
- syslog(LOG_INFO|LOG_DEBUG,
- "Warning: cf message (%s) ignored",
- entry);
- break;
- }
- break;
- /* Undefined Extensions: SCO, Ultrix, AIX, ... */
-
- default:
- syslog(LOG_INFO|LOG_DEBUG,
- "Warning: cf message (%s) ignored", entry);
- break;
- }
-
- if (format != NULL)
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", format);
- }
-
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "copies", ++copies);
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-sheets", "none");
-
- return (list);
-}
-
-static papi_status_t
-submit_job(papi_service_t svc, FILE *ifp, char *printer, int rid, char *cf,
- char **files)
-{
- papi_attribute_t **list = NULL;
- papi_status_t status;
- papi_job_t job = NULL;
- char *format = "";
-
- if ((list = parse_cf(svc, cf, files)) != NULL) {
- /* use the host as known by us, not by them */
- char *host = remote_host_name(ifp);
-
- if (host != NULL) {
- papiAttributeListAddString(&list, PAPI_ATTR_REPLACE,
- "job-originating-host-name", host);
- free(host);
- }
- if (rid >= 0) {
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "job-id-requested", rid);
- }
- }
-
- status = papiJobSubmit(svc, printer, list, NULL, files, &job);
- syslog(LOG_DEBUG, "submit: %s", papiStatusString(status));
- if (status != PAPI_OK) {
- char *tmp = papiServiceGetStatusMessage(svc);
-
- syslog(LOG_DEBUG, "submit-detail: %s", tmp ? tmp : "none");
- }
- papiJobFree(job);
-
- return (status);
-}
-
-static char *
-receive_control_file(papi_service_t svc, FILE *ifp, FILE *ofp, int size)
-{
- char *ptr, *cf_data;
-
- if ((ptr = cf_data = calloc(1, size + 1)) == NULL) {
- NACK(ofp);
- return (NULL);
- } else
- ACK(ofp);
-
- while (size > 0) {
- int rc;
-
- if (((rc = fread(ptr, 1, size, ifp)) == 0) &&
- (feof(ifp) != 0)) {
- free(cf_data);
- return (NULL);
- } else {
- ptr += rc;
- size -= rc;
- }
- }
- syslog(LOG_DEBUG, "cf_data(%s)", cf_data);
-
- if (fgetc(ifp) != 0) {
- free(cf_data);
- return (NULL);
- }
- ACK(ofp);
-
- return (cf_data);
-}
-
-static char *
-receive_data_file(FILE *ifp, FILE *ofp, int size)
-{
- char file[] = "lpdXXXXXX";
- char buf[BUFSIZ];
- int fd;
-
- if ((fd = mkstemp(file)) < 0) {
- NACK(ofp);
- return (NULL);
- } else
- ACK(ofp);
-
- while (size > 0) {
- int rc = ((size > BUFSIZ) ? BUFSIZ : size);
-
- if (((rc = fread(buf, 1, rc, ifp)) == 0) &&
- (feof(ifp) != 0)) {
- close(fd);
- unlink(file);
- return (NULL);
- } else {
- char *ptr = buf;
-
- while (rc > 0) {
- int wrc = write(fd, ptr, rc);
-
- if (wrc < 0) {
- close(fd);
- unlink(file);
- return (NULL);
- }
-
- ptr += wrc;
- size -= wrc;
- rc -= wrc;
- }
- }
- }
- close(fd);
- if (fgetc(ifp) != 0) {
- unlink(file);
- return (NULL);
- }
- ACK(ofp);
-
- return (strdup(file));
-}
-
-static papi_status_t
-berkeley_receive_files(papi_service_t svc, FILE *ifp, FILE *ofp, char *printer)
-{
- papi_status_t status = PAPI_OK;
- char *file, **files = NULL; /* the job data files */
- char *cf = NULL;
- int rid = 0;
- char buf[BUFSIZ];
-
- while (fgets(buf, sizeof (buf), ifp) != NULL) {
- int size;
-
- syslog(LOG_DEBUG, "XFER CMD: (%d)%s\n", buf[0], &buf[1]);
-#ifdef DEBUG /* translate [1-3]... messages to \[1-3] to run by hand */
- if ((buf[0] > '0') && (buf[0] < '4'))
- buf[0] -= '0';
-#endif
- switch (buf[0]) {
- case 0x01: /* Abort */
- cleanup(&files, &cf);
- break;
- case 0x02: { /* Receive control file */
- if (((cf = strchr(buf, ' ')) != NULL) &&
- (strlen(cf) > 4)) {
- while ((*cf != NULL) && (isdigit(*cf) == 0))
- cf++;
- rid = atoi(cf);
- }
- cf = receive_control_file(svc, ifp, ofp, atoi(&buf[1]));
- if (cf == NULL) {
- cleanup(&files, &cf);
- return (PAPI_BAD_REQUEST);
- } else if (files != NULL) {
- status = submit_job(svc, ifp, printer, rid, cf,
- files);
- cleanup(&files, &cf);
- }
- }
- break;
- case 0x03: { /* Receive data file */
- file = receive_data_file(ifp, ofp, atoi(&buf[1]));
- if (file == NULL) {
- cleanup(&files, &cf);
- return (PAPI_TEMPORARY_ERROR);
- }
- list_append(&files, file);
- }
- break;
- default:
- cleanup(&files, &cf);
- fatal(ofp, "protocol screwup");
- break;
- }
- }
-
- if ((cf != NULL) && (files != NULL))
- status = submit_job(svc, ifp, printer, rid, cf, files);
-
- cleanup(&files, &cf);
-
- return (status);
-}
-
-static papi_status_t
-berkeley_transfer_files(papi_service_t svc, FILE *ifp, FILE *ofp,
- char *printer)
-{
- papi_status_t status;
- papi_printer_t p = NULL;
- char *keys[] = { "printer-is-accepting-jobs", NULL };
-
- status = papiPrinterQuery(svc, printer, keys, NULL, &p);
- if ((status == PAPI_OK) && (p != NULL)) {
- papi_attribute_t **attrs = papiPrinterGetAttributeList(p);
- char accepting = PAPI_FALSE;
-
- papiAttributeListGetBoolean(attrs, NULL,
- "printer-is-accepting-jobs", &accepting);
-
- if (accepting == PAPI_TRUE) {
- ACK(ofp);
- status = berkeley_receive_files(svc, ifp, ofp, printer);
- } else
- NACK(ofp);
-
- papiPrinterFree(p);
- } else
- NACK(ofp);
-
- return (status);
-}
-
-static int
-cyclical_service_check(char *svc_name)
-{
- papi_attribute_t **list;
- uri_t *uri = NULL;
- char *s = NULL;
-
- /* was there a printer? */
- if (svc_name == NULL)
- return (0);
-
- if ((list = getprinterbyname(svc_name, NULL)) == NULL)
- return (0); /* if it doesnt' resolve, we will fail later */
-
- papiAttributeListGetString(list, NULL, "printer-uri-supported", &s);
- if ((s == NULL) || (strcasecmp(svc_name, s) != 0))
- return (0); /* they don't match */
-
- /* is it in uri form? */
- if (uri_from_string(s, &uri) < 0)
- return (0);
-
- if ((uri == NULL) || (uri->scheme == NULL) || (uri->host == NULL)) {
- uri_free(uri);
- return (0);
- }
-
- /* is it in lpd form? */
- if (strcasecmp(uri->scheme, "lpd") != 0) {
- uri_free(uri);
- return (0);
- }
-
- /* is it the local host? */
- if (is_localhost(uri->host) != 0) {
- uri_free(uri);
- return (0);
- }
-
- uri_free(uri);
- return (1);
-}
-
-
-/*
- * This is the entry point for this program. The program takes the
- * following options:
- * (none)
- */
-int
-main(int ac, char *av[])
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- FILE *ifp = stdin;
- FILE *ofp = stdout;
- int c;
- char buf[BUFSIZ];
- char **args;
- char *printer;
- char *run_dir = "/var/run/in.lpd";
- char *run_user = NULL;
- struct passwd *pw = NULL;
-
- (void) chdir("/tmp"); /* run in /tmp by default */
- openlog("bsd-gw", LOG_PID, LOG_LPR);
-
- while ((c = getopt(ac, av, "Ed:u:")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_ALWAYS;
- break;
- case 'd': /* run where they tell you */
- run_dir = optarg;
- break;
- case 'u': /* run as */
- run_user = optarg;
- break;
- default:
- ;
- }
-
- if (run_user != NULL) /* get the requested user info */
- pw = getpwnam(run_user);
-
- if (run_dir != NULL) { /* setup the run_dir */
- (void) mkdir(run_dir, 0700);
- if (pw != NULL)
- (void) chown(run_dir, pw->pw_uid, pw->pw_gid);
- }
-
- if (pw != NULL) { /* run as the requested user */
- syslog(LOG_DEBUG, "name: %s, uid: %d, gid: %d",
- pw->pw_name, pw->pw_uid, pw->pw_gid);
- initgroups(pw->pw_name, pw->pw_gid);
- setgid(pw->pw_gid);
- setuid(pw->pw_uid);
- }
-
- if (run_dir != NULL) /* move to the run_dir */
- if (chdir(run_dir) < 0) {
- syslog(LOG_DEBUG, "failed to chdir(%s)", run_dir);
- exit(1);
- }
-
- syslog(LOG_DEBUG, "$CWD = %s", getwd(NULL));
-
- if (fgets(buf, sizeof (buf), ifp) == NULL) {
- if (feof(ifp) == 0)
- syslog(LOG_ERR, "Error reading from connection: %s",
- strerror(errno));
- exit(1);
- }
-
- syslog(LOG_DEBUG, "CMD: (%d)%s\n", buf[0], &buf[1]);
-
-#ifdef DEBUG /* translate [1-5]... messages to \[1-5] to run by hand */
- if ((buf[0] > '0') && (buf[0] < '6'))
- buf[0] -= '0';
-#endif
-
- if ((buf[0] < 1) || (buf[0] > 5)) {
- fatal(ofp, "Invalid protocol request (%d): %c%s\n",
- buf[0], buf[0], buf);
- exit(1);
- }
-
- args = strsplit(&buf[1], "\t\n ");
- printer = *args++;
-
- if (printer == NULL) {
- fatal(ofp, "Can't determine requested printer");
- exit(1);
- }
-
- if (cyclical_service_check(printer) != 0) {
- fatal(ofp, "%s is cyclical\n", printer);
- exit(1);
- }
-
- status = papiServiceCreate(&svc, printer, NULL, NULL, NULL,
- encryption, NULL);
- if (status != PAPI_OK) {
- fatal(ofp, "Failed to contact service for %s: %s\n", printer,
- verbose_papi_message(svc, status));
- exit(1);
- }
-
- /*
- * Trusted Solaris can't be trusting of intermediaries. Pass
- * the socket connection to the print service to retrieve the
- * sensativity label off of a multi-level port.
- */
- (void) papiServiceSetPeer(svc, fileno(ifp));
-
- switch (buf[0]) {
- case '\1': /* restart printer */
- ACK(ofp); /* there is no equivalent */
- break;
- case '\2': /* transfer job(s) */
- status = berkeley_transfer_files(svc, ifp, ofp, printer);
- break;
- case '\3': /* show queue (short) */
- case '\4': { /* show queue (long) */
- int count;
-
- for (count = 0; args[count] != 0; count++) {}
-
- berkeley_queue_report(svc, ofp, printer, buf[0], count, args);
- }
- break;
- case '\5': { /* cancel job(s) */
- char *user = *args++;
- char *host = remote_host_name(ifp);
- int count;
-
- if (host != NULL) {
- char buf[BUFSIZ];
-
- snprintf(buf, sizeof (buf), "%s@%s", user, host);
- status = papiServiceSetUserName(svc, buf);
- } else
- status = papiServiceSetUserName(svc, user);
-
- for (count = 0; args[count] != 0; count++) {}
-
- berkeley_cancel_request(svc, ofp, printer, count, args);
- }
- break;
- default:
- fatal(ofp, "unsupported protocol request (%c), %s",
- buf[0], &buf[1]);
- }
-
- (void) fflush(ofp);
-
- syslog(LOG_DEBUG, "protocol request(%d) for %s completed: %s",
- buf[0], printer, papiStatusString(status));
- if (status != PAPI_OK)
- syslog(LOG_DEBUG, "detail: %s",
- verbose_papi_message(svc, status));
-
- papiServiceDestroy(svc);
-
- return (0);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lp.c b/usr/src/cmd/print/bsd-sysv-commands/lp.c
deleted file mode 100644
index 9ec5d0fed2..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/lp.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- *
- */
-
-/* $Id: lp.c 179 2006-07-17 18:24:07Z njacobs $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-#include <pwd.h>
-#include <grp.h>
-#include <sys/types.h>
-#ifdef HAVE_LIBMAGIC /* for mimetype auto-detection */
-#include <magic.h>
-#endif /* HAVE_LIBMAGIC */
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout,
- gettext("Usage: %s [-c] [-m] [-p] [-s] [-w] [-d destination] "
- "[-f form-name] [-H special-handling] [-n number] "
- "[-o option] [-P page-list] [-q priority-level] "
- "[-S character-set | print-wheel] [-t title] [-v] "
- "[-T content-type [-r]] [-y mode-list] [file...]\n"),
- name);
- exit(1);
-}
-
-int
-main(int ac, char *av[])
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_attribute_t **list = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- papi_job_t job = NULL;
- char prefetch[3];
- int prefetch_len = sizeof (prefetch);
- char *printer = NULL;
- char b = PAPI_TRUE;
- int copy = 0;
- int silent = 0;
- int dump = 0;
- int validate = 0;
- int modify = -1;
- int c;
- uid_t ruid;
- struct passwd *pw;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- ruid = getuid();
- if ((pw = getpwuid(ruid)) != NULL)
- (void) initgroups(pw->pw_name, pw->pw_gid);
- (void) setuid(ruid);
-
-
- while ((c = getopt(ac, av, "DEH:P:S:T:cd:f:i:mn:o:pq:rst:Vwy:")) != EOF)
- switch (c) {
- case 'H': /* handling */
- if (strcasecmp(optarg, "hold") == 0)
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL,
- "job-hold-until", "indefinite");
- else if (strcasecmp(optarg, "immediate") == 0)
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL,
- "job-hold-until", "no-hold");
- else
- papiAttributeListAddString(&list,
- PAPI_ATTR_EXCL,
- "job-hold-until", optarg);
- break;
- case 'P': { /* page list */
- char buf[BUFSIZ];
-
- snprintf(buf, sizeof (buf), "page-ranges=%s", optarg);
- papiAttributeListFromString(&list,
- PAPI_ATTR_EXCL, buf);
- }
- break;
- case 'S': /* charset */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "lp-charset", optarg);
- break;
- case 'T': /* type */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format",
- lp_type_to_mime_type(optarg));
- break;
- case 'D': /* dump */
- dump = 1;
- break;
- case 'c': /* copy */
- copy = 1;
- break;
- case 'd': /* destination */
- printer = optarg;
- break;
- case 'f': /* form */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "form", optarg);
- break;
- case 'i': /* modify job */
- if ((get_printer_id(optarg, &printer, &modify) < 0) ||
- (modify < 0)) {
- fprintf(stderr,
- gettext("invalid request id: %s\n"),
- optarg);
- exit(1);
- }
- break;
- case 'm': /* mail when complete */
- papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
- "rfc-1179-mail", 1);
- break;
- case 'n': /* copies */
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "copies", atoi(optarg));
- break;
- case 'o': /* lp "options" */
- papiAttributeListFromString(&list,
- PAPI_ATTR_REPLACE, optarg);
- break;
- case 'p': /* Solaris - notification */
- papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
- "rfc-1179-mail", 1);
- break;
- case 'q': { /* priority */
- int i = atoi(optarg);
-
- i = 100 - (i * 2.5);
- if ((i < 1) || (i > 100)) {
- fprintf(stderr, gettext("UX:lp: "));
- fprintf(stderr, gettext("ERROR: "));
- fprintf(stderr, gettext("Bad priority"
- " value \"%s\"."), optarg);
- fprintf(stderr, gettext("\n "));
- fprintf(stderr, gettext("TO FIX"));
- fprintf(stderr, gettext(": "));
- fprintf(stderr, gettext("Use an integer value"
- " from 0 to 39."));
- fprintf(stderr, gettext("\n"));
- exit(1);
- }
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "job-priority", i);
- }
- break;
- case 'r': /* "raw" mode */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format",
- "application/octet-stream");
- papiAttributeListAddString(&list, PAPI_ATTR_APPEND,
- "stty", "raw");
- break;
- case 's': /* suppress message */
- silent = 1;
- break;
- case 't': /* title */
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-name", optarg);
- break;
- case 'V': /* validate */
- validate = 1;
- break;
- case 'w':
- papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
- "rfc-1179-mail", 1);
- break;
- case 'y': /* lp "modes" */
- papiAttributeListAddString(&list, PAPI_ATTR_APPEND,
- "lp-modes", optarg);
- break;
- case 'E':
- encryption = PAPI_ENCRYPT_REQUIRED;
- break;
- default:
- usage(av[0]);
- }
-
- /* convert "banner", "nobanner" to "job-sheet" */
- if (papiAttributeListGetBoolean(list, NULL, "banner", &b) == PAPI_OK) {
- (void) papiAttributeListDelete(&list, "banner");
- if (b == PAPI_FALSE)
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-sheets", "none");
- }
-
- if ((printer == NULL) &&
- ((printer = getenv("PRINTER")) == NULL) &&
- ((printer = getenv("LPDEST")) == NULL))
- printer = DEFAULT_DEST;
-
- if (((optind + 1) == ac) && (strcmp(av[optind], "-") == 0))
- optind = ac;
-
- if (modify == -1) {
- char *document_format = "text/plain";
-
- if (optind != ac) {
- /* get the mime type of the file data */
-#ifdef MAGIC_MIME
- magic_t ms = NULL;
-
- if ((ms = magic_open(MAGIC_MIME)) != NULL) {
- document_format = magic_file(ms, av[optind]);
- magic_close(ms);
- }
-#else
- if (is_postscript(av[optind]) == 1)
- document_format = "application/postscript";
-#endif
- } else {
- if (is_postscript_stream(0, prefetch, &prefetch_len)
- == 1)
- document_format = "application/postscript";
- }
-
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL, "copies", 1);
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", document_format);
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-sheets", "standard");
- }
-
- status = papiServiceCreate(&svc, printer, NULL, NULL, cli_auth_callback,
- encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"), printer,
- verbose_papi_message(svc, status));
- exit(1);
- }
-
- if (dump != 0) {
- printf("requesting attributes:\n");
- papiAttributeListPrint(stdout, list, "\t");
- printf("\n");
- }
-
- if (modify != -1)
- status = papiJobModify(svc, printer, modify, list, &job);
- else if (optind == ac) /* no file list, use stdin */
- status = jobSubmitSTDIN(svc, printer, prefetch, prefetch_len,
- list, &job);
- else if (validate == 1) /* validate the request can be processed */
- status = papiJobValidate(svc, printer, list,
- NULL, &av[optind], &job);
- else if (copy == 0) /* reference the files in the job, default */
- status = papiJobSubmitByReference(svc, printer, list,
- NULL, &av[optind], &job);
- else /* copy the files before return, -c */
- status = papiJobSubmit(svc, printer, list,
- NULL, &av[optind], &job);
-
- papiAttributeListFree(list);
-
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("%s: %s\n"), printer,
- verbose_papi_message(svc, status));
- papiJobFree(job);
- papiServiceDestroy(svc);
- exit(1);
- }
-
- if (((silent == 0) || (dump != 0)) &&
- ((list = papiJobGetAttributeList(job)) != NULL)) {
- int32_t id = -1;
-
- if (printer == NULL)
- papiAttributeListGetString(list, NULL,
- "printer-name", &printer);
-
- papiAttributeListGetInteger(list, NULL,
- "job-id-requested", &id);
- if (id == -1) {
- papiAttributeListGetInteger(list, NULL, "job-id", &id);
- }
-
- printf(gettext("request id is %s-%d "), printer, id);
- if (ac != optind)
- printf("(%d file(s))\n", ac - optind);
- else
- printf("(standard input)\n");
-
- if (dump != 0) {
- printf("job attributes:\n");
- papiAttributeListPrint(stdout, list, "\t");
- printf("\n");
- }
- }
-
- papiJobFree(job);
- papiServiceDestroy(svc);
-
- return (0);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpc.c b/usr/src/cmd/print/bsd-sysv-commands/lpc.c
deleted file mode 100644
index a4a89e77cc..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/lpc.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lpc.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-typedef int (cmd_handler_t)(papi_service_t, char **);
-
-static papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
-
-/* ARGSUSED0 */
-static int
-lpc_exit(papi_service_t svc, char **args)
-{
- exit(0);
- /* NOTREACHED */
- return (0);
-}
-
-static int
-lpc_status(papi_service_t svc, char **args)
-{
- papi_status_t status;
- papi_printer_t p = NULL;
- char *pattrs[] = { "printer-state", "printer-state-reasons",
- "printer-is-accepting-jobs", NULL };
- char *destination = args[1];
-
- status = papiPrinterQuery(svc, destination, pattrs, NULL, &p);
- if (status == PAPI_OK) {
- papi_attribute_t **list = papiPrinterGetAttributeList(p);
- char accepting = 0;
- int32_t state = 0;
-
- printf("%s:\n", destination);
-
- (void) papiAttributeListGetBoolean(list, NULL,
- "printer-is-accepting-jobs", &accepting);
- printf(gettext("\tqueueing is %s\n"),
- (accepting ? gettext("enabled") : gettext("disabled")));
-
- (void) papiAttributeListGetInteger(list, NULL,
- "printer-state", &state);
- printf("\tprinting is %s\n",
- ((state != 0x05) ? gettext("enabled") :
- gettext("disabled")));
-
- if (state != 0x03) { /* !idle */
- papi_job_t *jobs = NULL;
- int i = 0;
-
- (void) papiPrinterListJobs(svc, destination, NULL,
- PAPI_LIST_JOBS_ALL, 0, &jobs);
- if (jobs != NULL) {
- for (i = 0; jobs[i] != NULL; i++);
- papiJobListFree(jobs);
- }
- printf(gettext("\t%d entries in spool area\n"), i);
- } else
- printf(gettext("\tno entries\n"));
-
- if (state == 0x04)
- printf(gettext("\tdaemon present\n"));
-
- } else {
- fprintf(stderr, "%s: %s\n", destination,
- verbose_papi_message(svc, status));
- return (-1);
- }
-
- papiPrinterFree(p);
-
- return (0);
-}
-
-static int
-lpc_abort(papi_service_t svc, char **args)
-{
- papi_status_t status;
- char *destination = args[1];
-
- if (destination == NULL) {
- fprintf(stderr, gettext("Usage: abort (destination)\n"));
- return (-1);
- }
-
- status = papiPrinterPause(svc, destination, "paused via lpc abort");
- if (status == PAPI_OK) {
- printf(gettext("%s: processing disabled after current job\n"),
- destination);
- } else {
- fprintf(stderr, "%s: %s\n", destination,
- verbose_papi_message(svc, status));
- }
-
- return (0);
-}
-
-static int
-lpc_clean(papi_service_t svc, char **args)
-{
- papi_status_t status;
- papi_job_t *jobs = NULL;
- char *destination = args[1];
-
- if (destination == NULL) {
- fprintf(stderr, gettext("Usage: clean (destination)\n"));
- return (-1);
- }
-
- status = papiPrinterPurgeJobs(svc, destination, &jobs);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("clean: %s: %s\n"), destination,
- verbose_papi_message(svc, status));
- return (-1);
- }
-
- if (jobs != NULL) {
- int i;
-
- for (i = 0; jobs[i] != NULL; i++)
- printf(gettext("\t%s-%d: cancelled\n"), destination,
- papiJobGetId(jobs[i]));
-
- papiJobListFree(jobs);
- }
-
- return (0);
-}
-
-static int
-lpc_disable(papi_service_t svc, char **args)
-{
- papi_status_t status;
- char *destination = args[1];
-
- if (destination == NULL) {
- fprintf(stderr, gettext("Usage: disable: (destination)\n"));
- return (-1);
- }
-
- status = papiPrinterDisable(svc, destination, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("disable: %s: %s\n"), destination,
- verbose_papi_message(svc, status));
- return (-1);
- }
-
- return (0);
-}
-
-static int
-lpc_enable(papi_service_t svc, char **args)
-{
- papi_status_t status;
- char *destination = args[1];
-
- if (destination == NULL) {
- fprintf(stderr, gettext("Usage: enable: (destination)\n"));
- return (-1);
- }
-
- status = papiPrinterEnable(svc, destination);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("enable: %s: %s\n"), destination,
- verbose_papi_message(svc, status));
- return (-1);
- }
-
- return (0);
-}
-
-static int
-lpc_restart(papi_service_t svc, char **args)
-{
- int rc = 0;
-
- rc += lpc_disable(svc, args);
- rc += lpc_enable(svc, args);
-
- return (rc);
-}
-
-static int
-lpc_start(papi_service_t svc, char **args)
-{
- papi_status_t status;
- char *destination = args[1];
-
- if (destination == NULL) {
- fprintf(stderr, gettext("Usage: start (destination)\n"));
- return (-1);
- }
-
- status = papiPrinterResume(svc, destination);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("start: %s: %s\n"), destination,
- verbose_papi_message(svc, status));
- return (-1);
- }
-
- return (0);
-}
-
-static int
-lpc_stop(papi_service_t svc, char **args)
-{
- papi_status_t status;
- char *destination = args[1];
-
- if (destination == NULL) {
- fprintf(stderr, gettext("Usage: stop (destination)\n"));
- return (-1);
- }
-
- status = papiPrinterPause(svc, destination, "paused via lpc");
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("stop: %s: %s\n"), destination,
- verbose_papi_message(svc, status));
- return (-1);
- }
-
- return (0);
-}
-
-static int
-lpc_topq(papi_service_t svc, char **args)
-{
- papi_status_t status;
- char *destination = args[1];
- char *idstr = args[2];
- int32_t id;
-
- if (destination == NULL || idstr == NULL) {
- fprintf(stderr, gettext("Usage: topq (destination) (id)\n"));
- return (-1);
- }
- id = atoi(idstr);
-
- status = papiJobPromote(svc, destination, id);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("topq: %s-%d: %s\n"), destination, id,
- verbose_papi_message(svc, status));
- return (-1);
- }
-
- return (0);
-}
-
-static int
-lpc_up(papi_service_t svc, char **args)
-{
- int rc = 0;
-
- rc += lpc_enable(svc, args);
- rc += lpc_start(svc, args);
-
- return (rc);
-}
-
-static int
-lpc_down(papi_service_t svc, char **args)
-{
- int rc = 0;
-
- rc += lpc_disable(svc, args);
- rc += lpc_stop(svc, args);
-
- return (rc);
-}
-
-static int lpc_help(papi_service_t svc, char **args); /* forward reference */
-
-static char help_help[] = "get help on commands";
-static char help_exit[] = "exit lpc";
-static char help_status[] = "show status of daemon and queue";
-static char help_abort[] =
- "disable print queue terminating any active job processing";
-static char help_clean[] = "remove all jobs from a queue";
-static char help_disable[] = "turn off spooling to a queue";
-static char help_down[] =
- "turn off queueing and printing for a queue and set a reason";
-static char help_enable[] = "turn on spooling to a queue";
-static char help_restart[] = "restart job processing for a queue";
-static char help_start[] = "turn on printing from a queue";
-static char help_stop[] = "turn off printing from a queue";
-static char help_up[] = "turn on queueing and printing for a queue";
-static char help_topq[] = "put a job at the top of the queue";
-
-static struct {
- char *cmd;
- int (*handler)(papi_service_t svc, char **args);
- char *help_string;
- int num_args;
-} cmd_tab[] = {
- { "?", lpc_help, help_help, 0 },
- { "help", lpc_help, help_help, 0 },
- { "exit", lpc_exit, help_exit, 0 },
- { "quit", lpc_exit, help_exit, 0 },
- { "status", lpc_status, help_status, 1 },
- { "abort", lpc_abort, help_abort, 1 },
- { "clean", lpc_clean, help_clean, 1 },
- { "disable", lpc_disable, help_disable, 1 },
- { "down", lpc_down, help_down, 2 },
- { "enable", lpc_enable, help_enable, 1 },
- { "restart", lpc_restart, help_restart, 1 },
- { "start", lpc_start, help_start, 1 },
- { "stop", lpc_stop, help_stop, 1 },
- { "up", lpc_up, help_up, 1 },
- { "topq", lpc_topq, help_topq, 2 },
- { NULL, NULL, NULL, 0 }
-};
-
-static int
-lpc_handler(char *cmd, cmd_handler_t **handler)
-{
- int i;
-
- for (i = 0; cmd_tab[i].cmd != NULL; i++)
- if (strcmp(cmd, cmd_tab[i].cmd) == 0) {
- *handler = cmd_tab[i].handler;
- return (cmd_tab[i].num_args);
- }
- return (-1);
-}
-
-static char *
-lpc_helptext(char *cmd)
-{
- int i;
-
- for (i = 0; cmd_tab[i].cmd != NULL; i++)
- if (strcmp(cmd, cmd_tab[i].cmd) == 0)
- return (gettext(cmd_tab[i].help_string));
- return (NULL);
-}
-
-/* ARGSUSED0 */
-static int
-lpc_help(papi_service_t svc, char **args)
-{
- if (args[1] == NULL) {
- int i;
-
- printf(gettext("Commands are:\n\n"));
- for (i = 0; cmd_tab[i].cmd != NULL; i++) {
- printf("\t%s", cmd_tab[i].cmd);
- if ((i % 7) == 6)
- printf("\n");
- }
- if ((i % 7) != 6)
- printf("\n");
- } else {
- char *helptext = lpc_helptext(args[1]);
-
- if (helptext == NULL)
- helptext = gettext("no such command");
-
- printf("%s: %s\n", args[1], helptext);
- }
-
- return (0);
-}
-
-static int
-process_one(int (*handler)(papi_service_t, char **), char **av, int expected)
-{
- int rc = -1;
- papi_status_t status = PAPI_OK;
- papi_service_t svc = NULL;
- char *printer = av[1];
-
- if ((printer != NULL) && (expected != 0)) {
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- }
- }
-
- if (status == PAPI_OK)
- rc = handler(svc, av);
-
- if (svc != NULL)
- papiServiceDestroy(svc);
-
- return (rc);
-}
-
-static int
-process_all(int (*handler)(papi_service_t, char **), char **av, int expected)
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- char **printers;
- int rc = 0;
-
- status = papiServiceCreate(&svc, NULL, NULL, NULL, NULL,
- encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("Failed to contact service: %s\n"),
- verbose_papi_message(svc, status));
- return (-1);
- }
-
- if ((printers = interest_list(svc)) != NULL) {
- int i;
-
- for (i = 0; printers[i] != NULL; i++) {
- av[1] = printers[i];
- rc += process_one(handler, av, expected);
- }
- }
-
- papiServiceDestroy(svc);
-
- return (rc);
-}
-
-static int
-process(int ac, char **av)
-{
- int (*handler)(papi_service_t, char **) = NULL;
- int num_args = -1;
-
- char *printer = av[1];
- int rc = -1;
-
- if ((num_args = lpc_handler(av[0], &handler)) < 0) {
- printf(gettext("%s: invalid command\n"), av[0]);
- return (-1);
- }
-
- if (((ac == 0) && (num_args == 1)) ||
- ((printer != NULL) && strcmp(printer, "all") == 0))
- rc = process_all(handler, av, num_args);
- else if (num_args < ac) {
- int i;
- char *argv[4];
-
- memset(argv, 0, sizeof (argv));
- argv[0] = av[0];
-
- if (strcmp(av[0], "topq") == 0) {
- argv[1] = av[1];
- for (i = 2; i <= ac; i++) {
- argv[2] = av[i];
- process_one(handler, argv, num_args);
- }
- } else
- for (i = 1; i <= ac; i++) {
- argv[1] = av[i];
- process_one(handler, argv, num_args);
- }
- } else
- rc = process_one(handler, av, num_args);
-
- return (rc);
-}
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout,
- gettext("Usage: %s [ command [ parameter...]]\n"),
- name);
- exit(1);
-}
-
-static void
-lpc_shell()
-{
- for (;;) {
- char line[256];
- char **av = NULL;
- int ac = 0;
-
- /* prompt */
- fprintf(stdout, "lpc> ");
- fflush(stdout);
-
- /* get command */
- if (fgets(line, sizeof (line), stdin) == NULL)
- exit(1);
- if ((av = strsplit(line, " \t\n")) != NULL)
- for (ac = 0; av[ac] != NULL; ac++);
- else
- continue;
-
- if (ac > 0)
- (void) process(ac - 1, av);
- free(av);
- }
-}
-
-int
-main(int ac, char *av[])
-{
- int result = 0;
- int c;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av, "E")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_ALWAYS;
- break;
- default:
- usage(av[0]);
- }
-
- if (optind == ac)
- lpc_shell();
- else
- result = process(ac - optind - 1, &av[optind]);
-
- return (result);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpmove.c b/usr/src/cmd/print/bsd-sysv-commands/lpmove.c
deleted file mode 100644
index 15cb076ef1..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/lpmove.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/* $Id: lpmove.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout,
- gettext("Usage: %s [request-id] (destination)\n"
- " %s (source) (destination)\n"), name, name);
- exit(1);
-}
-
-static int
-move_job(papi_service_t svc, char *src, int32_t id, char *dest)
-{
- int result = 0;
- papi_status_t status;
- char *mesg = gettext("moved");
-
- status = papiJobMove(svc, src, id, dest);
- if (status != PAPI_OK) {
- mesg = (char *)verbose_papi_message(svc, status);
- result = -1;
- }
- fprintf(stderr, gettext("%s-%d to %s: %s\n"), src, id, dest, mesg);
-
- return (result);
-}
-
-int
-main(int ac, char *av[])
-{
- int exit_code = 0;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- char *destination = NULL;
- int c;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av, "E:")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_REQUIRED;
- break;
- default:
- usage(av[0]);
- }
-
- if (optind >= ac - 1)
- usage(av[0]);
-
- destination = av[--ac];
-
- for (c = optind; c < ac; c++) {
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_job_t *jobs = NULL;
- char *printer = NULL;
- int32_t id = -1;
-
- (void) get_printer_id(av[c], &printer, &id);
-
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit(1);
- }
-
- if (id != -1) { /* it's a job */
- if (move_job(svc, printer, id, destination) < 0)
- exit_code = 1;
- } else { /* it's a printer */
- char message[128];
- int count = 0;
-
- snprintf(message, sizeof (message), "moved jobs to %s",
- destination);
- status = papiPrinterPause(svc, printer, message);
- if (status != PAPI_OK) {
- /*
- * If the user is denied the permission
- * to disable then return appropriate msg
- */
- char *result = NULL;
-
- result = papiServiceGetStatusMessage(svc);
-
- if (result != NULL) {
- /*
- * Check if user is denied
- * the permission
- */
- if (strstr(result, "permission denied")
- != NULL) {
- /*
- * user is denied
- * permission
- */
- fprintf(stderr, "UX:lpmove: ");
- fprintf(stderr,
- gettext("ERROR: "));
- fprintf(stderr, gettext("You "
- "aren't allowed to do"
- " that."));
- fprintf(stderr, "\n\t");
- fprintf(stderr,
- gettext("TO FIX"));
- fprintf(stderr, ": ");
- fprintf(stderr, gettext("You "
- "must be logged in as "
- "\"lp\" or \"root\"."));
- fprintf(stderr, "\n");
- exit_code = 1;
- } else {
- fprintf(stderr, gettext(
- "Reject %s: %s\n"),
- printer,
- verbose_papi_message(
- svc, status));
- exit_code = 1;
- }
- } else {
- fprintf(stderr, gettext(
- "Reject %s: %s\n"),
- printer,
- verbose_papi_message(svc, status));
- exit_code = 1;
- }
- } else {
- printf(gettext(
- "destination %s is not accepting"\
- " requests\n"), printer);
-
- status = papiPrinterListJobs(svc, printer, NULL,
- 0, 0, &jobs);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("Jobs %s:"\
- " %s\n"),
- printer,
- verbose_papi_message(svc, status));
- exit_code = 1;
- }
-
- printf(gettext("move in progress ...\n"));
- while ((jobs != NULL) && (*jobs != NULL)) {
- id = papiJobGetId(*jobs++);
- if (move_job(svc, printer,
- id, destination) < 0)
- exit_code = 1;
- else
- count++;
- }
- printf(gettext(
- "total of %d requests moved"\
- " from %s to %s\n"),
- count, printer, destination);
-
- papiJobListFree(jobs);
- }
- }
-
- papiServiceDestroy(svc);
- }
-
- return (exit_code);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpq.c b/usr/src/cmd/print/bsd-sysv-commands/lpq.c
deleted file mode 100644
index 188a5669d6..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/lpq.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lpq.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout, gettext("Usage: %s [-P printer] (user|id ...)\n"),
- name);
- exit(1);
-}
-
-static void
-clear_screen()
-{
- static char buf[32];
-
- /* quick and dirty for now, this should be fixed real soon */
- if (buf[0] == '\0') {
- FILE *fp = popen("/bin/tput clear", "r");
- if (fp != NULL) {
- fgets(buf, sizeof (buf), fp);
- fclose(fp);
- }
- }
- printf("%s", buf);
-}
-
-int
-main(int ac, char *av[])
-{
- char *printer = NULL;
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- int format = 3; /* lpq short format */
- int interval = 0;
- int num_jobs;
- int c;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av, "EP:l")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_REQUIRED;
- break;
- case 'P':
- printer = optarg;
- break;
- case 'l':
- format = 4; /* lpq long format */
- break;
- default:
- usage(av[0]);
- }
-
- if ((optind < ac) && (av[optind][0] == '+'))
- interval = atoi(av[optind++]);
-
- if ((printer == NULL) &&
- ((printer = getenv("PRINTER")) == NULL) &&
- ((printer = getenv("LPDEST")) == NULL))
- printer = DEFAULT_DEST;
-
- status = papiServiceCreate(&svc, printer, NULL, NULL, cli_auth_callback,
- encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"), printer,
- verbose_papi_message(svc, status));
- papiServiceDestroy(svc);
- exit(1);
- }
-
- do {
- if (interval != 0)
- clear_screen();
-
- num_jobs = berkeley_queue_report(svc, stdout, printer, format,
- ac - optind, &av[optind]);
-
- if ((interval != 0) && (num_jobs > 0))
- sleep(interval);
- } while ((interval > 0) && (num_jobs > 0));
-
- papiServiceDestroy(svc);
-
- return (0);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpr.c b/usr/src/cmd/print/bsd-sysv-commands/lpr.c
deleted file mode 100644
index 547e0df36f..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/lpr.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lpr.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-#ifdef HAVE_LIBMAGIC /* for mimetype auto-detection */
-#include <magic.h>
-#endif /* HAVE_LIBMAGIC */
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout,
- gettext("Usage: %s [-P printer] [-# copies] [-C class] "
- "[-J job] [-T title] "
- "[-p [-i indent] [-w width]] "
- "[-1|-2|-3|-4 font] [-m] [-h] [-s] "
- "[-filter_option] [file ..]\n"), name);
- exit(1);
-}
-
-int
-main(int ac, char *av[])
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_attribute_t **list = NULL;
- papi_job_t job = NULL;
- int exit_code = 0;
- char *printer = NULL;
- char prefetch[3];
- int prefetch_len = sizeof (prefetch);
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- int dump = 0;
- int validate = 0;
- int remove = 0;
- int copy = 1; /* default is to copy the data */
- char *document_format = "text/plain";
- int c;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av,
- "EP:#:C:DVJ:T:w:i:hplrstdgvcfmn1:2:3:4:")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_REQUIRED;
- break;
- case 'P':
- printer = optarg;
- break;
- case '#':
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "copies", atoi(optarg));
- break;
- case 'C':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-class", optarg);
- break;
- case 'D':
- dump = 1;
- break;
- case 'J':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-name", optarg);
- break;
- case 'T':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "pr-title", optarg);
- break;
- case 'p':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/x-pr");
- papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
- "pr-filter", 1);
- break;
- case 'i':
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "pr-indent", atoi(optarg));
- break;
- case 'w':
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
- "pr-width", atoi(optarg));
- break;
- case 'h':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-sheets", "none");
- break;
- case 'l':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/octet-stream");
- break;
- case 'o':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/postscript");
- break;
- case 'c':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/x-cif");
- break;
- case 'd':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/x-dvi");
- break;
- case 'f':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/x-fortran");
- break;
- case 'g':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/x-plot");
- break;
- case 'n':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/x-ditroff");
- break;
- case 't':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/x-troff");
- break;
- case 'v':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", "application/x-raster");
- break;
- case 'm':
- papiAttributeListAddBoolean(&list, PAPI_ATTR_EXCL,
- "rfc-1179-mail", 1);
- break;
- case 'r':
- remove = 1;
- break;
- case 's':
- copy = 0;
- break;
- case 'V': /* validate */
- validate = 1;
- break;
- case '1':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-font-r", optarg);
- break;
- case '2':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-font-i", optarg);
- break;
- case '3':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-font-b", optarg);
- break;
- case '4':
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "rfc-1179-font-s", optarg);
- break;
- default:
- usage(av[0]);
- }
-
- if ((printer == NULL) &&
- ((printer = getenv("PRINTER")) == NULL) &&
- ((printer = getenv("LPDEST")) == NULL))
- printer = DEFAULT_DEST;
-
- if (((optind + 1) == ac) && (strcmp(av[optind], "-") == 0))
- optind = ac;
-
- if (optind != ac) {
- /* get the mime type of the file data */
-#ifdef MAGIC_MIME
- magic_t ms;
-
- if ((ms = magic_open(MAGIC_MIME)) != NULL) {
- document_format = magic_file(ms, av[optind]);
- magic_close(ms);
- }
-#else
- if (is_postscript(av[optind]) == 1)
- document_format = "application/postscript";
-#endif
- } else {
- if (is_postscript_stream(0, prefetch, &prefetch_len) == 1)
- document_format = "application/postscript";
- }
-
- papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL, "copies", 1);
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "document-format", document_format);
- papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
- "job-sheets", "standard");
-
- status = papiServiceCreate(&svc, printer, NULL, NULL, cli_auth_callback,
- encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"), printer,
- verbose_papi_message(svc, status));
- exit(1);
- }
-
- if (validate == 1) /* validate the request can be processed */
- status = papiJobValidate(svc, printer, list,
- NULL, &av[optind], &job);
- else if (optind == ac) /* no file list, use stdin */
- status = jobSubmitSTDIN(svc, printer, prefetch, prefetch_len,
- list, &job);
- else if (copy == 0) /* reference the files in the job, default */
- status = papiJobSubmitByReference(svc, printer, list,
- NULL, &av[optind], &job);
- else /* copy the files before return, -c */
- status = papiJobSubmit(svc, printer, list,
- NULL, &av[optind], &job);
-
- papiAttributeListFree(list);
-
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("%s: %s\n"), printer,
- verbose_papi_message(svc, status));
- papiJobFree(job);
- papiServiceDestroy(svc);
- exit(1);
- }
-
- if (dump != 0) {
- list = papiJobGetAttributeList(job);
- printf("job attributes:\n");
- papiAttributeListPrint(stdout, list, "\t");
- printf("\n");
- }
-
- papiJobFree(job);
- papiServiceDestroy(svc);
-
- return (exit_code);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lprm.c b/usr/src/cmd/print/bsd-sysv-commands/lprm.c
deleted file mode 100644
index 841a5da811..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/lprm.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lprm.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout, gettext("Usage: %s [-P printer] (user|id ...)\n"),
- name);
- exit(1);
-}
-
-int
-main(int ac, char *av[])
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- char *printer = NULL;
- int c;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av, "EP:")) != EOF)
- switch (c) {
- case 'E':
- encryption = PAPI_ENCRYPT_REQUIRED;
- break;
- case 'P':
- printer = optarg;
- break;
- default:
- usage(av[0]);
- }
-
- if ((printer == NULL) &&
- ((printer = getenv("PRINTER")) == NULL) &&
- ((printer = getenv("LPDEST")) == NULL))
- printer = DEFAULT_DEST;
-
- status = papiServiceCreate(&svc, printer, NULL, NULL, cli_auth_callback,
- encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- papiServiceDestroy(svc);
- return (1);
- }
-
- berkeley_cancel_request(svc, stdout, printer,
- ac - optind, &av[optind]);
-
- papiServiceDestroy(svc);
-
- return (0);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpstat.c b/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
deleted file mode 100644
index 6f666bcc03..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
+++ /dev/null
@@ -1,1444 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lpstat.c 173 2006-05-25 04:52:06Z njacobs $ */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <ctype.h>
-#include <pwd.h>
-#include <papi.h>
-#include <uri.h>
-#include "common.h"
-#include "lp.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout, gettext("Usage: %s [-d] [-r] [-s] [-t] [-a [list]] "
- "[-c [list]] [-o [list] [-l]] [-R [list] [-l]] "
- "[-p [list] [-D] [-l]] [-v [list]] [-S [list] [-l]] "
- "[-f [list] [-l]] [-u list]\n"),
- name);
- exit(1);
-}
-
-static char *
-nctime(time_t *t)
-{
- static char buf[64];
- struct tm *tm = localtime(t);
-
- (void) strftime(buf, sizeof (buf), "%c", tm);
-
- return (buf);
-}
-
-static char *
-printer_name(papi_printer_t printer)
-{
- papi_attribute_t **attributes = papiPrinterGetAttributeList(printer);
- char *result = NULL;
-
- if (attributes != NULL)
- papiAttributeListGetString(attributes, NULL,
- "printer-name", &result);
-
- return (result);
-}
-
-static int
-lpstat_default_printer(papi_encryption_t encryption)
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_printer_t p = NULL;
- char *name = NULL;
-
- status = papiServiceCreate(&svc, NULL, NULL, NULL, cli_auth_callback,
- encryption, NULL);
- if (status == PAPI_OK) {
- char *req[] = { "printer-name", NULL };
-
- status = papiPrinterQuery(svc, DEFAULT_DEST, req, NULL, &p);
- if (p != NULL)
- name = printer_name(p);
- }
- if (name != NULL)
- printf(gettext("system default printer: %s\n"), name);
- else
- printf(gettext("no system default destination\n"));
- papiPrinterFree(p);
- papiServiceDestroy(svc);
-
- return (0);
-}
-
-static int
-lpstat_service_status(papi_encryption_t encryption)
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- char *name = NULL;
-
- if (((name = getenv("PAPI_SERVICE_URI")) == NULL) &&
- ((name = getenv("IPP_SERVER")) == NULL) &&
- ((name = getenv("CUPS_SERVER")) == NULL))
- name = DEFAULT_SERVICE_URI;
-
- status = papiServiceCreate(&svc, name, NULL, NULL, cli_auth_callback,
- encryption, NULL);
- if (status != PAPI_OK) {
- printf(gettext("scheduler is not running\n"));
- } else
- printf(gettext("scheduler is running\n"));
- papiServiceDestroy(svc);
-
- return (0);
-}
-
-static char *
-get_device_uri(papi_service_t svc, char *name)
-{
- papi_status_t status;
- papi_printer_t p = NULL;
- char *keys[] = { "device-uri", NULL };
- char *result = NULL;
-
- status = papiPrinterQuery(svc, name, keys, NULL, &p);
- if ((status == PAPI_OK) && (p != NULL)) {
- papi_attribute_t **attrs = papiPrinterGetAttributeList(p);
-
- (void) papiAttributeListGetString(attrs, NULL,
- "device-uri", &result);
- if (result != NULL)
- result = strdup(result);
-
- papiPrinterFree(p);
- }
-
- return (result);
-}
-
-static void
-print_description(papi_attribute_t **list, char *printer_name)
-{
- char *str = "";
-
- (void) papiAttributeListGetString(list, NULL,
- "printer-info", &str);
-
- /*
- * If no printer-info is read then
- * by default the printer-info is <printer-name>@<server>
- */
- if (str[0] == '\0') {
- char *uri = NULL;
- uri_t *u = NULL;
-
- (void) papiAttributeListGetString(list, NULL,
- "printer-uri-supported", &uri);
-
- if ((uri != NULL) && (uri_from_string(uri, &u) == 0)) {
- char *nodename = localhostname();
-
- if ((u->host == NULL) ||
- (strcasecmp(u->host, "localhost") == 0) ||
- (strcasecmp(u->host, nodename) == 0))
- printf(gettext("\tDescription:\n"));
- else
- printf(gettext("\tDescription: %s@%s\n"),
- printer_name, u->host);
-
- uri_free(u);
- } else
- printf(gettext("\tDescription:\n"));
- } else
- printf(gettext("\tDescription: %s\n"), str);
-}
-
-static char *report_device_keys[] = { "printer-name", "printer-uri-supported",
- NULL };
-/* ARGSUSED2 */
-static int
-report_device(papi_service_t svc, char *name, papi_printer_t printer,
- int verbose, int description)
-{
- papi_status_t status;
- papi_attribute_t **attrs = papiPrinterGetAttributeList(printer);
- char *uri = NULL;
- char *device = NULL;
- uri_t *u = NULL;
-
- if (name == NULL) {
- status = papiAttributeListGetString(attrs, NULL,
- "printer-name", &name);
- if (status != PAPI_OK)
- status = papiAttributeListGetString(attrs, NULL,
- "printer-uri-supported", &name);
- }
-
- if (name == NULL)
- return (-1);
-
- (void) papiAttributeListGetString(attrs, NULL,
- "printer-uri-supported", &uri);
-
- if ((uri != NULL) && (uri_from_string(uri, &u) == 0)) {
- char *nodename = localhostname();
-
- if ((u->host == NULL) ||
- (strcasecmp(u->host, "localhost") == 0) ||
- (strcasecmp(u->host, nodename) == 0))
- device = get_device_uri(svc, name);
-
- if (device != NULL) {
- printf(gettext("device for %s: %s\n"), name, device);
- return (0);
- } else if (uri != NULL) {
- printf(gettext("system for %s: %s (as %s)\n"), name,
- u->host?u->host:"localhost", uri);
- return (0);
- }
-
- uri_free(u);
- }
-
- return (0);
-}
-
-static char *report_accepting_keys[] = { "printer-name",
- "printer-uri-supported", "printer-is-accepting-jobs",
- "printer-up-time", "printer-state-time",
- "lpsched-reject-date", "lpsched-reject-reason", NULL };
-/* ARGSUSED2 */
-static int
-report_accepting(papi_service_t svc, char *name, papi_printer_t printer,
- int verbose, int description)
-{
- papi_status_t status;
- papi_attribute_t **attrs = papiPrinterGetAttributeList(printer);
- time_t curr;
- char boolean = PAPI_FALSE;
-
- if (name == NULL) {
- status = papiAttributeListGetString(attrs, NULL,
- "printer-name", &name);
- if (status != PAPI_OK)
- status = papiAttributeListGetString(attrs, NULL,
- "printer-uri-supported", &name);
- }
- if (name == NULL)
- return (-1);
-
- (void) papiAttributeListGetBoolean(attrs, NULL,
- "printer-is-accepting-jobs", &boolean);
- (void) time(&curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "printer-up-time", &curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "printer-state-time", &curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "lpsched-reject-date", &curr);
-
- if (boolean == PAPI_TRUE) {
- printf(gettext("%s accepting requests since %s\n"),
- name, nctime(&curr));
- } else {
- char *reason = "unknown reason";
-
- (void) papiAttributeListGetString(attrs, NULL,
- "lpsched-reject-reason", &reason);
-
- printf(gettext("%s not accepting requests since %s\n\t%s\n"),
- name, nctime(&curr), reason);
- }
-
- return (0);
-}
-
-static char *report_class_keys[] = { "printer-name", "printer-uri-supported",
- "member-names", NULL };
-/* ARGSUSED2 */
-static int
-report_class(papi_service_t svc, char *name, papi_printer_t printer,
- int verbose, int description)
-{
- papi_status_t status;
- papi_attribute_t **attrs = papiPrinterGetAttributeList(printer);
- char *member = NULL;
- void *iter = NULL;
-
- status = papiAttributeListGetString(attrs, &iter,
- "member-names", &member);
- if (status == PAPI_NOT_FOUND) /* it's not a class */
- return (0);
-
- if (name == NULL) {
- status = papiAttributeListGetString(attrs, NULL,
- "printer-name", &name);
- if (status != PAPI_OK)
- status = papiAttributeListGetString(attrs, NULL,
- "printer-uri-supported", &name);
- }
- if (name == NULL)
- return (-1);
-
- printf(gettext("members of class %s:\n\t%s\n"), name, member);
- while (papiAttributeListGetString(attrs, &iter, NULL, &member)
- == PAPI_OK)
- printf("\t%s\n", member);
-
- return (0);
-}
-
-static int
-get_remote_hostname(papi_attribute_t **attrs, char **host)
-{
- char *uri = NULL;
- uri_t *u;
- char *nodename;
-
- *host = NULL;
- (void) papiAttributeListGetString(attrs, NULL,
- "job-originating-host-name", host);
- (void) papiAttributeListGetString(attrs, NULL,
- "printer-uri-supported", &uri);
- if (*host == NULL) {
- if (uri != NULL) {
- if (uri_from_string(uri, &u) == 0) {
- if (u->host == NULL) {
- uri_free(u);
- return (0);
- }
- *host = strdup(u->host);
- uri_free(u);
- } else {
- return (0);
- }
- } else {
- return (0);
- }
- }
- nodename = localhostname();
- if ((strcasecmp(*host, "localhost") == 0) ||
- (strcasecmp(*host, nodename) == 0)) {
- return (0);
- }
- return (1);
-}
-
-static char *report_printer_keys[] = { "printer-name",
- "printer-uri-supported", "printer-state",
- "printer-up-time", "printer-state-time",
- "lpsched-disable-date", "printer-state-reasons",
- "lpsched-disable-reason", NULL };
-/* ARGSUSED2 */
-static int
-report_printer(papi_service_t svc, char *name, papi_printer_t printer,
- int verbose, int description)
-{
- papi_status_t status;
- papi_attribute_t **attrs = papiPrinterGetAttributeList(printer);
- time_t curr;
- int32_t pstat = 0;
- char *member = NULL;
- papi_job_t *j = NULL;
-
- status = papiAttributeListGetString(attrs, NULL,
- "member-names", &member);
- if (status == PAPI_OK) /* it's a class */
- return (0);
-
- if (name == NULL) {
- status = papiAttributeListGetString(attrs, NULL,
- "printer-name", &name);
- if (status != PAPI_OK)
- status = papiAttributeListGetString(attrs, NULL,
- "printer-uri-supported", &name);
- }
- if (name == NULL)
- return (-1);
-
- printf(gettext("printer %s "), name);
-
- status = papiAttributeListGetInteger(attrs, NULL,
- "printer-state", &pstat);
-
- switch (pstat) {
- case 0x03: /* idle */
- printf(gettext("is idle. enabled"));
- break;
- case 0x04: /* processing */
- case 0x06: /* faulted printing */
- status = papiPrinterListJobs(svc, name, NULL,
- 0, 0, &j);
-
- if (status == PAPI_OK) {
- if (j != NULL) {
- int i = 0;
- int32_t jobid = 0;
- int32_t jstate = 0;
-
- for (i = 0; j[i] != NULL; ++i) {
- papi_attribute_t **attr =
- papiJobGetAttributeList(j[i]);
-
- papiAttributeListGetInteger(attr,
- NULL, "job-state", &jstate);
- papiAttributeListGetInteger(attr,
- NULL, "job-id", &jobid);
- /*
- * For lpd protocol "job-id-requested"
- * should be read.
- */
- papiAttributeListGetInteger(attr,
- NULL, "job-id-requested", &jobid);
-
- /*
- * When lpd protocol is used job-state
- * cannot be retrieved, therefore
- * job-state will be 0.
- * When ipp protocol is used, the
- * active/printing job-state will be
- * RS_PRINTING (0x0008) post s10u5.
- * For pre-s10u5 job-state will be
- * RS_ACTIVE (0x05). So print only when
- * the job-state is RS_PRINTING (0x0008)
- * or RS_ACTIVE (0x05) or 0
- */
- if ((jstate == 0x0008) ||
- (jstate == 0x05) ||
- (jstate == 0)) {
- if (pstat == 0x04)
- printf(gettext
- ("now printing"\
- " %s-%d. enabled"),
- name, jobid);
- if (pstat == 0x06)
- printf(gettext
- ("faulted printing"\
- " %s-%d. enabled"),
- name, jobid);
- break;
- }
- }
- papiJobListFree(j);
- }
- }
- break;
- case 0x05: /* stopped */
- printf(gettext("disabled"));
- break;
- case 0x07: /* faulted printer */
- printf(gettext("faulted. enabled"));
- break;
- case 0x08: /* waiting for auto retry */
- printf(gettext("waiting for auto-retry."));
- break;
- default:
- printf(gettext("unknown state(0x%x)."), pstat);
- break;
- }
-
- if (pstat == 0x08)
- printf(gettext(" available.\n"));
- else {
- (void) time(&curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "printer-up-time", &curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "printer-state-time", &curr);
- (void) papiAttributeListGetDatetime(attrs, NULL,
- "lpsched-disable-date", &curr);
- printf(gettext(" since %s. available.\n"), nctime(&curr));
- }
-
- if ((pstat == 0x05) ||
- (pstat == 0x06) ||
- (pstat == 0x07) ||
- (pstat == 0x08)) {
- char *reason = "unknown reason";
-
- (void) papiAttributeListGetString(attrs, NULL,
- "printer-state-reasons", &reason);
- (void) papiAttributeListGetString(attrs, NULL,
- "lpsched-disable-reason", &reason);
- printf(gettext("\t%s\n"), reason);
- }
-
- if (verbose == 1) {
- void *iter;
- char *str;
- char *host = NULL;
-
- if ((get_remote_hostname(attrs, &host)) != 0) {
- (void) printf(
- gettext("\tRemote Name: %s\n\tRemote Server: "
- "%s\n"), name, host);
- free(host);
- return (0);
- }
- str = "";
- (void) papiAttributeListGetString(attrs, NULL,
- "form-ready", &str);
- printf(gettext("\tForm mounted: %s\n"), str);
-
- str = "";
- iter = NULL;
- (void) papiAttributeListGetString(attrs, &iter,
- "document-format-supported", &str);
- printf(gettext("\tContent types: %s"), str);
- while (papiAttributeListGetString(attrs, &iter, NULL, &str)
- == PAPI_OK)
- printf(", %s", str);
- printf("\n");
-
- /* Display the printer description */
- print_description(attrs, name);
-
- str = "";
- iter = NULL;
- (void) papiAttributeListGetString(attrs, &iter,
- "lpsched-printer-type", &str);
- printf(gettext("\tPrinter types: %s"), str);
- while (papiAttributeListGetString(attrs, &iter, NULL, &str)
- == PAPI_OK)
- printf(", %s", str);
- printf("\n");
-
- str = "";
- (void) papiAttributeListGetString(attrs, NULL,
- "lpsched-dial-info", &str);
- printf(gettext("\tConnection: %s\n"),
- ((str[0] == '\0') ? gettext("direct") : str));
-
- str = "";
- (void) papiAttributeListGetString(attrs, NULL,
- "lpsched-interface-script", &str);
- printf(gettext("\tInterface: %s\n"), str);
-
- str = NULL;
- (void) papiAttributeListGetString(attrs, NULL,
- "ppd-file-uri", &str);
- (void) papiAttributeListGetString(attrs, NULL,
- "lpsched-ppd-source-path", &str);
- if (str != NULL)
- printf(gettext("\tPPD: %s\n"), str);
-
- str = NULL;
- (void) papiAttributeListGetString(attrs, NULL,
- "lpsched-fault-alert-command", &str);
- if (str != NULL)
- printf(gettext("\tOn fault: %s\n"), str);
-
- str = "";
- (void) papiAttributeListGetString(attrs, NULL,
- "lpsched-fault-recovery", &str);
- printf(gettext("\tAfter fault: %s\n"),
- ((str[0] == '\0') ? gettext("continue") : str));
-
- str = "(all)";
- iter = NULL;
- (void) papiAttributeListGetString(attrs, &iter,
- "requesting-user-name-allowed", &str);
- printf(gettext("\tUsers allowed:\n\t\t%s\n"),
- ((str[0] == '\0') ? gettext("(none)") : str));
- if ((str != NULL) && (str[0] != '\0'))
- while (papiAttributeListGetString(attrs, &iter, NULL,
- &str) == PAPI_OK)
- printf("\t\t%s\n", str);
-
- str = NULL;
- iter = NULL;
- (void) papiAttributeListGetString(attrs, &iter,
- "requesting-user-name-denied", &str);
- if (str != NULL) {
- printf(gettext("\tUsers denied:\n\t\t%s\n"),
- ((str[0] == '\0') ? gettext("(none)") : str));
- if ((str != NULL) && (str[0] != '\0'))
- while (papiAttributeListGetString(attrs, &iter,
- NULL, &str) == PAPI_OK)
- printf("\t\t%s\n", str);
- }
-
- str = "none";
- iter = NULL;
- (void) papiAttributeListGetString(attrs, &iter,
- "form-supported", &str);
- printf(gettext("\tForms allowed:\n\t\t(%s)\n"),
- ((str[0] == '\0') ? gettext("none") : str));
- if ((str != NULL) && (str[0] != '\0'))
- while (papiAttributeListGetString(attrs, &iter, NULL,
- &str) == PAPI_OK)
- printf("\t\t(%s)\n", str);
-
- str = "";
- iter = NULL;
- (void) papiAttributeListGetString(attrs, &iter,
- "media-supported", &str);
- printf(gettext("\tMedia supported:\n\t\t%s\n"),
- ((str[0] == '\0') ? gettext("(none)") : str));
- if ((str != NULL) && (str[0] != '\0'))
- while (papiAttributeListGetString(attrs, &iter, NULL,
- &str) == PAPI_OK)
- printf("\t\t%s\n", str);
-
- str = "";
- (void) papiAttributeListGetString(attrs, NULL,
- "job-sheets-supported", &str);
- if ((strcasecmp(str, "none")) == 0)
- str = gettext("page never printed");
- else if (strcasecmp(str, "optional") == 0)
- str = gettext("not required");
- else
- str = gettext("required");
-
- printf(gettext("\tBanner %s\n"), str);
-
-
- str = "";
- iter = NULL;
- (void) papiAttributeListGetString(attrs, &iter,
- "lpsched-print-wheels", &str);
- printf(gettext("\tCharacter sets:\n\t\t%s\n"),
- ((str[0] == '\0') ? gettext("(none)") : str));
- if ((str != NULL) && (str[0] != '\0'))
- while (papiAttributeListGetString(attrs, &iter, NULL,
- &str) == PAPI_OK)
- printf("\t\t%s\n", str);
-
- printf(gettext("\tDefault pitch:\n"));
- printf(gettext("\tDefault page size:\n"));
- printf(gettext("\tDefault port setting:\n"));
-
- str = "";
- iter = NULL;
- (void) papiAttributeListGetString(attrs, &iter,
- "lpsched-options", &str);
- if (str != NULL) {
- printf(gettext("\tOptions: %s"), str);
- while (papiAttributeListGetString(attrs, &iter, NULL,
- &str) == PAPI_OK)
- printf(", %s", str);
- printf("\n");
- }
-
- } else if (description == 1)
- /* Display printer description */
- print_description(attrs, name);
- else if (verbose > 1)
- papiAttributeListPrint(stdout, attrs, "\t");
-
- if (verbose > 0)
- printf("\n");
-
- return (0);
-}
-
-static int
-printer_query(char *name, int (*report)(papi_service_t, char *, papi_printer_t,
- int, int), papi_encryption_t encryption,
- int verbose, int description)
-{
- int result = 0, i = 0;
- papi_status_t status;
- papi_service_t svc = NULL;
- char **list = getlist(name, LP_WS, LP_SEP);
-
- if (list == NULL) {
- list = (char **)malloc(sizeof (char *));
- list[0] = name;
- }
-
- /*
- * The for loop executes once for every printer
- * entry in list. If list is NULL that implies
- * name is also NULL, the loop runs only one time.
- */
-
- for (i = 0; name == NULL || list[i] != NULL; i++) {
- name = list[i];
-
- status = papiServiceCreate(&svc, name, NULL, NULL,
- cli_auth_callback, encryption, NULL);
- if (status != PAPI_OK) {
- if (status == PAPI_NOT_FOUND)
- fprintf(stderr,
- gettext("%s: unknown printer\n"),
- name ? name : "(NULL)");
- else
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- name ? name : "(NULL)",
- verbose_papi_message(svc, status));
- papiServiceDestroy(svc);
- result--;
- continue;
- }
-
- if (name == NULL) { /* all */
- char **interest = interest_list(svc);
-
- if (interest != NULL) {
- int i;
-
- for (i = 0; interest[i] != NULL; i++)
- result += printer_query(interest[i],
- report, encryption, verbose,
- description);
- }
- } else {
- papi_printer_t printer = NULL;
- char **keys = NULL;
-
- /*
- * Limit the query to only required data
- * to reduce the need to go remote for
- * information.
- */
- if (report == report_device)
- keys = report_device_keys;
- else if (report == report_class)
- keys = report_class_keys;
- else if (report == report_accepting)
- keys = report_accepting_keys;
- else if ((report == report_printer) && (verbose == 0))
- keys = report_printer_keys;
-
- status = papiPrinterQuery(svc, name, keys,
- NULL, &printer);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to get printer info for %s: %s\n"),
- name, verbose_papi_message(svc, status));
- papiServiceDestroy(svc);
- result--;
- continue;
- }
-
- if (printer != NULL)
- result += report(svc, name, printer, verbose,
- description);
-
- papiPrinterFree(printer);
- }
-
- papiServiceDestroy(svc);
-
- if (name == NULL)
- break;
- }
-
- freelist(list);
-
- return (result);
-}
-
-static int
-match_user(char *user, char **list)
-{
- int i;
-
- for (i = 0; list[i] != NULL; i++) {
- if (strcmp(user, list[i]) == 0)
- return (0);
- }
-
- return (-1);
-}
-
-static char **users = NULL;
-
-static int
-report_job(char *printer, papi_job_t job, int show_rank, int verbose)
-{
- papi_attribute_t **attrs = papiJobGetAttributeList(job);
- time_t clock = 0;
- char date[24];
- char request[26];
- char *user = "unknown";
- char *host = NULL;
- int32_t size = 0;
- int32_t jstate = 0;
- char User[50];
-
- char *destination = "unknown";
- int32_t id = -1;
- static int check = 0;
- static char *uri = NULL;
- static char *puri = NULL; /* printer-uri */
- static char *pname = NULL; /* printer-name */
-
- (void) papiAttributeListGetString(attrs, NULL,
- "job-originating-user-name", &user);
-
- if ((users != NULL) && (match_user(user, users) < 0))
- return (0);
-
- (void) papiAttributeListGetString(attrs, NULL,
- "job-originating-host-name", &host);
-
- /*
- * When lpstat is called for multiple printers
- * internally the function 'report_job' gets
- * called multiple times with different printer-names.
- * The following block of code handles the case when lpstat is
- * executed for multiple printers. In other words when 'report_job'
- * is called multiple times for different printers for
- * one lpstat command
- * For e.g: lpstat printer1 printer2 printer3
- */
- if (pname == NULL) {
- /*
- * When lpstat is queried for the first time
- * pname is NULL so this part of the code gets executed.
- * Read the attribute "job-printer-uri"
- * first time
- */
- (void) papiAttributeListGetString(attrs, NULL,
- "job-printer-uri", &uri);
-
- if (printer != NULL) {
- /*
- * Set pname to the printer that is being
- * queried so that this can be used later
- * if 'report_job' is called multiple times for
- * different printers for one lpstat command
- */
- pname = printer;
- }
-
- if (uri != NULL) {
- /*
- * Set puri so that "job-printer-uri" corresponding
- * to a particular printer can be used later when
- * lpstat is queried for the same printer as
- * "job-printer-uri" for a printer is read just once.
- */
- puri = strdup(uri);
- }
- } else {
- /*
- * This part of the code will get executed when
- * 'report_job' is called more than once for the same
- * lpstat command
- */
- if (printer != NULL) {
- if (strcasecmp(pname, printer) != 0) {
- /*
- * Read the job-printer-uri as
- * it will be different for
- * different printers
- */
- uri = NULL;
- (void) papiAttributeListGetString(attrs,
- NULL, "job-printer-uri", &uri);
- pname = printer;
- if (uri != NULL)
- puri = strdup(uri);
- else
- puri = NULL;
- } else {
- /*
- * Same printer queried twice
- * uri should be the same as
- * already read in the previous call
- * to 'report_job'.
- * For the same printer 'job-printer-uri'
- * is read just once because only in the
- * first call it contains the host information
- */
- uri = puri;
- }
- }
- }
-
- if (host) {
- /* Check if it is local printer or remote printer */
- uri_t *u = NULL;
-
- if ((uri != NULL) && (uri_from_string(uri, &u) == 0)) {
- char *nodename = localhostname();
-
- if ((u->host == NULL) ||
- (strcasecmp(u->host, "localhost") == 0) ||
- (strcasecmp(u->host, nodename) == 0)) {
-
- if (strcasecmp(host, nodename) == 0) {
- /*
- * Request submitted locally
- * for the local queue.
- * Hostname will not be displayed
- */
- snprintf(User, sizeof (User), "%s",
- user);
- }
- else
- snprintf(User, sizeof (User), "%s@%s",
- user, host);
- } else if (uri != NULL) {
- /*
- * It's a remote printer.
- * In case of remote printers hostname is
- * always displayed.
- */
- snprintf(User, sizeof (User), "%s@%s",
- user, host);
- }
- uri_free(u);
- } else {
- /*
- * If attribute "job-printer-uri"
- * cannot be read
- * by default append the hostname
- */
- snprintf(User, sizeof (User), "%s@%s", user, host);
- }
- } else {
- /*
- * When print server is s10u4 and ipp service is used
- * "job-originating-hostname" attribute is not set
- * So get the host information from the uri
- */
- uri_t *u = NULL;
- if ((uri != NULL) && (uri_from_string(uri, &u) == 0)) {
- if ((u != NULL) && (u->host != NULL))
- snprintf(User, sizeof (User), "%s@%s",
- user, u->host);
- else
- snprintf(User, sizeof (User), "%s", user);
-
- uri_free(u);
- } else
- snprintf(User, sizeof (User), "%s", user);
- }
- (void) papiAttributeListGetInteger(attrs, NULL, "job-k-octets", &size);
- size *= 1024; /* for the approximate byte size */
- (void) papiAttributeListGetInteger(attrs, NULL, "job-octets", &size);
-
- (void) time(&clock);
- (void) papiAttributeListGetInteger(attrs, NULL,
- "time-at-creation", (int32_t *)&clock);
- (void) strftime(date, sizeof (date), "%b %d %R", localtime(&clock));
-
- (void) papiAttributeListGetString(attrs, NULL,
- "job-printer-uri", &destination);
- (void) papiAttributeListGetString(attrs, NULL,
- "printer-name", &destination);
- (void) papiAttributeListGetInteger(attrs, NULL,
- "job-id", &id);
- (void) papiAttributeListGetInteger(attrs, NULL,
- "job-id-requested", &id);
-
-
- snprintf(request, sizeof (request), "%s-%d", printer, id);
-
- if (show_rank != 0) {
- int32_t rank = -1;
-
- (void) papiAttributeListGetInteger(attrs, NULL,
- "number-of-intervening-jobs", &rank);
- rank++;
-
- printf("%3d %-21s %-14s %7ld %s",
- rank, request, User, size, date);
- } else
- printf("%-23s %-14s %7ld %s", request, User, size, date);
-
- (void) papiAttributeListGetInteger(attrs, NULL,
- "job-state", &jstate);
-
- if (jstate == 0x0001)
- printf(gettext(" being held"));
- else if (jstate == 0x0800)
- printf(gettext(" notifying user"));
- else if (jstate == 0x0040)
- printf(gettext(" cancelled"));
- else if (jstate == 0x0010)
- printf(gettext(" finished printing"));
- else if (jstate == 0x0008)
- printf(gettext(" on %s"), destination);
- else if (jstate == 0x2000)
- printf(gettext(" held by admin"));
- else if (jstate == 0x0002)
- printf(gettext(" being filtered"));
- else if (jstate == 0x0004)
- printf(gettext(" filtered"));
- else if (jstate == 0x0020)
- printf(gettext(" held for change"));
-
- if (verbose == 1) {
- char *form = NULL;
-
- (void) papiAttributeListGetString(attrs, NULL,
- "output-device-assigned", &destination);
- printf("\n\t assigned %s", destination);
-
- (void) papiAttributeListGetString(attrs, NULL, "form", &form);
- if (form != NULL)
- printf(", form %s", form);
- } else if (verbose > 1) {
- printf("\n");
- papiAttributeListPrint(stdout, attrs, "\t");
- }
-
- printf("\n");
-
- return (0);
-}
-
-static int
-job_query(char *request, int (*report)(char *, papi_job_t, int, int),
- papi_encryption_t encryption, int show_rank, int verbose)
-{
- int result = 0;
- papi_status_t status;
- papi_service_t svc = NULL;
- char *printer = request;
- int32_t id = -1;
- int flag1 = 0;
- int flag = 1;
- int print_flag = 0;
-
- do {
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
-
- if ((status == PAPI_OK) && (printer != NULL))
- print_flag = 1;
-
- /* <name>-# printer name does not exist */
- if (status != PAPI_OK) {
- /*
- * Check if <name>-# is a request-id
- * Once this check is done flag1 is set
- */
- if (flag1 == 1)
- break;
-
- get_printer_id(printer, &printer, &id);
-
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
-
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- (printer ? printer : "all"),
- verbose_papi_message(svc, status));
- return (-1);
- }
- }
-
- if (printer == NULL) { /* all */
- char **interest = interest_list(svc);
-
- if (interest != NULL) {
- int i;
-
- for (i = 0; interest[i] != NULL; i++)
- result += job_query(interest[i], report,
- encryption, show_rank, verbose);
- }
- } else if (id == -1) { /* a printer */
- papi_job_t *jobs = NULL;
-
- status = papiPrinterListJobs(svc, printer, NULL,
- 0, 0, &jobs);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to get job list: %s\n"),
- verbose_papi_message(svc, status));
- papiServiceDestroy(svc);
- return (-1);
- }
-
- if (jobs != NULL) {
- int i;
-
- for (i = 0; jobs[i] != NULL; i++)
- result += report(printer,
- jobs[i], show_rank,
- verbose);
- }
-
- papiJobListFree(jobs);
- } else { /* a job */
- papi_job_t job = NULL;
-
- /* Once a job has been found stop processing */
- flag = 0;
-
- /*
- * Job-id could be the job-id requested
- * Check if it is job-id or job-id-requested
- */
- id = job_to_be_queried(svc, printer, id);
-
- if (id >= 0)
- status = papiJobQuery(svc, printer, id,
- NULL, &job);
- else
- /* id not found */
- status = PAPI_NOT_FOUND;
-
- if (status != PAPI_OK) {
- if (!print_flag)
- fprintf(stderr, gettext(
- "Failed to get job"\
- " info for %s: %s\n"),
- request,
- verbose_papi_message(svc, status));
- papiServiceDestroy(svc);
- return (-1);
- }
-
- if (job != NULL)
- result = report(printer, job,
- show_rank, verbose);
-
- papiJobFree(job);
- }
-
- if (flag) {
- id = -1;
- get_printer_id(printer, &printer, &id);
- if (id == -1)
- flag = 0;
- else
- flag1 = 1;
- }
- } while (flag);
-
- papiServiceDestroy(svc);
-
- return (result);
-}
-
-static int
-report_form(char *name, papi_attribute_t **attrs, int verbose)
-{
- papi_status_t status;
- char *form = NULL;
- void *iter = NULL;
-
- for (status = papiAttributeListGetString(attrs, &iter,
- "form-supported", &form);
- status == PAPI_OK;
- status = papiAttributeListGetString(attrs, &iter,
- NULL, &form)) {
- if ((name == NULL) || (strcmp(name, form) == 0)) {
- printf(gettext("form %s is available to you\n"), form);
- if (verbose != 0) {
- char *detail = NULL;
- status = papiAttributeListGetString(attrs, NULL,
- "form-supported-detail", &detail);
- if (status == PAPI_OK)
- printf("%s\n", detail);
- }
- }
- }
-
- return (0);
-}
-
-static int
-report_print_wheels(char *name, papi_attribute_t **attrs, int verbose)
-{
- papi_status_t status;
- char *pw = NULL;
- void *iter = NULL;
-
- for (status = papiAttributeListGetString(attrs, &iter,
- "pw-supported", &pw);
- status == PAPI_OK;
- status = papiAttributeListGetString(attrs, &iter, NULL, &pw)) {
- if ((name == NULL) || (strcmp(name, pw) == 0)) {
- printf(gettext("charset %s is available\n"), pw);
- if (verbose != 0) {
- char *info = NULL;
- status = papiAttributeListGetString(attrs, NULL,
- "pw-supported-extra", &info);
- if (status == PAPI_OK)
- printf("%s\n", info);
- }
- }
- }
-
- return (0);
-}
-
-static int
-service_query(char *name, int (*report)(char *, papi_attribute_t **, int),
- papi_encryption_t encryption, int verbose)
-{
- int result = 0;
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_attribute_t **attrs = NULL;
-
- status = papiServiceCreate(&svc, name, NULL, NULL, cli_auth_callback,
- encryption, NULL);
- if (status != PAPI_OK) {
- papiServiceDestroy(svc);
- return (-1);
- }
-
- attrs = papiServiceGetAttributeList(svc);
- if (attrs != NULL) {
- result = report(name, attrs, verbose);
-
- if (verbose > 1) {
- printf("\n");
- papiAttributeListPrint(stdout, attrs, "\t");
- printf("\n");
- }
- }
-
- papiServiceDestroy(svc);
-
- return (result);
-}
-
-int
-main(int ac, char *av[])
-{
- int exit_code = 0;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- int rank = 0;
- int verbose = 0;
- int description = 0;
- int c;
- char **argv;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- argv = (char **)calloc((ac + 1), sizeof (char *));
- for (c = 0; c < ac; c++) {
- if ((av[c][0] == '-') && (av[c][1] == 'l') &&
- (isalpha(av[c][2]) != 0)) {
- /* preserve old "-l[po...]" behavior */
- argv[c] = &av[c][1];
- argv[c][0] = '-';
- verbose = 1;
-
- } else
- argv[c] = av[c];
- }
-
- argv[c++] = "--";
- ac = c;
-
- /* preprocess argument list looking for '-l' or '-R' so it can trail */
- while ((c = getopt(ac, argv, "LEDf:S:stc:p:a:drs:v:l:o:R:u:")) != EOF) {
- switch (c) { /* these may or may not have an option */
- case 'a':
- case 'c':
- case 'p':
- case 'o':
- case 'R':
- case 'u':
- case 'v':
- case 'l':
- case 'f':
- case 'S':
- if (optarg[0] == '-') {
- /* this check stop a possible infinite loop */
- if ((optind > 1) && (argv[optind-1][1] != c))
- optind--;
- optarg = NULL;
- } else if (strcmp(optarg, "all") == 0)
- optarg = NULL;
- }
-
- switch (c) {
- case 'l':
- if ((optarg == NULL) || (optarg[0] == '-'))
- optarg = "1";
- verbose = atoi(optarg);
- break;
- case 'D':
- description = 1;
- break;
- case 'R':
- rank = 1;
- break;
- case 'E':
- encryption = PAPI_ENCRYPT_REQUIRED;
- break;
- default:
- break;
- }
- }
- optind = 1;
-
- /* process command line arguments */
- while ((c = getopt(ac, argv, "LEDf:S:stc:p:a:drs:v:l:o:R:u:")) != EOF) {
- switch (c) { /* these may or may not have an option */
- case 'a':
- case 'c':
- case 'p':
- case 'o':
- case 'R':
- case 'u':
- case 'v':
- case 'l':
- case 'f':
- case 'S':
- if (optarg[0] == '-') {
- /* this check stop a possible infinite loop */
- if ((optind > 1) && (argv[optind-1][1] != c))
- optind--;
- optarg = NULL;
- } else if (strcmp(optarg, "all") == 0)
- optarg = NULL;
- }
-
- switch (c) {
- case 'a':
- exit_code += printer_query(optarg, report_accepting,
- encryption, verbose, 0);
- break;
- case 'c':
- exit_code += printer_query(optarg, report_class,
- encryption, verbose, 0);
- break;
- case 'p':
- exit_code += printer_query(optarg, report_printer,
- encryption, verbose, description);
- break;
- case 'd':
- exit_code += lpstat_default_printer(encryption);
- break;
- case 'r':
- exit_code += lpstat_service_status(encryption);
- break;
- case 'u':
- if (optarg != NULL)
- users = strsplit(optarg, ", \n");
- exit_code += job_query(NULL, report_job,
- encryption, rank, verbose);
- if (users != NULL) {
- free(users);
- users = NULL;
- }
- break;
- case 'v':
- exit_code += printer_query(optarg, report_device,
- encryption, verbose, 0);
- break;
- case 'R': /* set "rank" flag in first pass */
- case 'o':
- exit_code += job_query(optarg, report_job,
- encryption, rank, verbose);
- break;
- case 'f':
- exit_code += service_query(optarg, report_form,
- encryption, verbose);
- break;
- case 'S':
- exit_code += service_query(optarg, report_print_wheels,
- encryption, verbose);
- break;
- case 's':
- exit_code += lpstat_service_status(encryption);
- exit_code += lpstat_default_printer(encryption);
- exit_code += printer_query(NULL, report_class,
- encryption, verbose, 0);
- exit_code += printer_query(NULL, report_device,
- encryption, verbose, 0);
- exit_code += service_query(optarg, report_form,
- encryption, verbose);
- exit_code += service_query(optarg, report_print_wheels,
- encryption, verbose);
- break;
- case 't':
- exit_code += lpstat_service_status(encryption);
- exit_code += lpstat_default_printer(encryption);
- exit_code += printer_query(NULL, report_class,
- encryption, verbose, 0);
- exit_code += printer_query(NULL, report_device,
- encryption, verbose, 0);
- exit_code += printer_query(NULL, report_accepting,
- encryption, verbose, 0);
- exit_code += printer_query(NULL, report_printer,
- encryption, verbose, 0);
- exit_code += service_query(optarg, report_form,
- encryption, verbose);
- exit_code += service_query(optarg, report_print_wheels,
- encryption, verbose);
- exit_code += job_query(NULL, report_job,
- encryption, rank, verbose);
- break;
- case 'L': /* local-only, ignored */
- case 'l': /* increased verbose level in first pass */
- case 'D': /* set "description" flag in first pass */
- case 'E': /* set encryption in the first pass */
- break;
- default:
- usage(av[0]);
- }
- }
- ac--;
-
- if (ac == 1) { /* report on my jobs */
- struct passwd *pw = getpwuid(getuid());
-
- if (pw != NULL)
- users = strsplit(pw->pw_name, "");
- exit_code += job_query(NULL, report_job, encryption,
- rank, verbose);
- if (users != NULL) {
- free(users);
- users = NULL;
- }
- } else {
- for (c = optind; c < ac; c++)
- exit_code += job_query(argv[c], report_job, encryption,
- rank, verbose);
- }
-
-
- if (exit_code != 0)
- exit_code = 1;
-
- return (exit_code);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/reject.c b/usr/src/cmd/print/bsd-sysv-commands/reject.c
deleted file mode 100644
index 2952bafba6..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/reject.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: reject.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <papi.h>
-#include "common.h"
-
-static void
-usage(char *program)
-{
- char *name;
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stdout,
- gettext("Usage: %s destination ...\n"),
- name);
- exit(1);
-}
-
-int
-main(int ac, char *av[])
-{
- papi_status_t status;
- papi_service_t svc = NULL;
- papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
- char *reason = NULL;
- int exit_status = 0;
- int c = 1;
-
- (void) setlocale(LC_ALL, "");
- (void) textdomain("SUNW_OST_OSCMD");
-
- while ((c = getopt(ac, av, "Er:")) != EOF)
- switch (c) {
- case 'r': /* reason */
- reason = optarg;
- break;
- case 'E':
- encryption = PAPI_ENCRYPT_ALWAYS;
- break;
- default:
- usage(av[0]);
- }
-
- if (ac <= optind)
- usage(av[0]);
-
- while (optind < ac) {
- char *printer = av[optind++];
-
- status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit_status = 1;
- }
-
- status = papiPrinterPause(svc, printer, reason);
- if (status == PAPI_OK) {
- printf(gettext(
- "Destination \"%s\" will no longer "
- "accept requests\n"), printer);
- } else if (status == PAPI_NOT_ACCEPTING) {
- fprintf(stderr, gettext(
- "Destination \"%s\" was already not "
- "accepting requests.\n"), printer);
- exit_status = 1;
- } else {
- /* The operation is not supported in lpd protocol */
- if (status == PAPI_OPERATION_NOT_SUPPORTED) {
- fprintf(stderr,
- verbose_papi_message(svc, status));
- } else {
- fprintf(stderr, gettext("reject: %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- }
- exit_status = 1;
- }
-
- papiServiceDestroy(svc);
- }
-
- return (exit_status);
-}
diff --git a/usr/src/cmd/print/bsd-sysv-commands/rfc1179.xml b/usr/src/cmd/print/bsd-sysv-commands/rfc1179.xml
deleted file mode 100644
index b6783bca28..0000000000
--- a/usr/src/cmd/print/bsd-sysv-commands/rfc1179.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
-
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
- Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- Use is subject to license terms.
-
- NOTE: This service manifest is not editable; its contents will
- be overwritten by package or patch operations, including
- operating system upgrade. Make customizations in a different
- file.
--->
-
-<service_bundle type='manifest' name='SUNWpsr:rfc1179'>
-
-<service
- name='application/print/rfc1179'
- type='service'
- version='1'>
-
- <create_default_instance enabled='false' />
-
- <restarter>
- <service_fmri value='svc:/network/inetd:default' />
- </restarter>
-
- <dependency
- name='lpsched'
- grouping='require_all'
- restart_on='refresh'
- type='service'>
- <service_fmri value='svc:/application/print/server' />
- </dependency>
-
- <exec_method
- type='method'
- name='inetd_start'
- exec='/usr/lib/print/in.lpd -u lp -d /var/run/in.lpd'
- timeout_seconds='0'>
- <method_context>
- <method_credential user='root' group='lp' />
- </method_context>
- </exec_method>
-
-
- <exec_method
- type='method'
- name='inetd_disable'
- exec=':kill'
- timeout_seconds='0'>
- </exec_method>
-
- <property_group name='inetd' type='framework'>
- <stability value='Evolving' />
- <propval name='endpoint_type' type='astring' value='stream' />
- <propval name='name' type='astring' value='printer' />
- <propval name='wait' type='boolean' value='false' />
- <propval name='isrpc' type='boolean' value='false' />
- <propval name='proto' type='astring' value='tcp6' />
- </property_group>
-
- <property_group name='general' type='framework'>
- <!-- to start/stop rfc1179 listening -->
- <propval name='action_authorization' type='astring'
- value='solaris.print.admin' />
- <propval name='value_authorization' type='astring'
- value='solaris.print.admin' />
- </property_group>
-
- <property_group name='firewall_context' type='com.sun,fw_definition'>
- <propval name='ipf_method' type='astring'
- value='/lib/svc/method/print-svc ipfilter svc:/application/print/server:default' />
- </property_group>
-
- <stability value='Unstable' />
-
- <template>
- <common_name>
- <loctext xml:lang='C'>
- BSD print protocol adapter
- </loctext>
- </common_name>
- <documentation>
- <manpage title='in.lpd' section='1M'
- manpath='/usr/share/man' />
- </documentation>
- </template>
-
-</service>
-
-</service_bundle>
diff --git a/usr/src/cmd/print/conv_fix/conv_fix.c b/usr/src/cmd/print/conv_fix/conv_fix.c
deleted file mode 100644
index 2833b106bb..0000000000
--- a/usr/src/cmd/print/conv_fix/conv_fix.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <sys/file.h>
-#include <fcntl.h>
-#include <errno.h>
-
-extern char *optarg;
-
-/*
- * FUNCTION:
- * static char *_file_getline(FILE *fp)
- * INPUT:
- * FILE *fp - file pointer to read from
- * OUTPUT:
- * char *(return) - an entry from the stream
- * DESCRIPTION:
- * This routine will read in a line at a time. If the line ends in a
- * newline, it returns. If the line ends in a backslash newline, it
- * continues reading more. It will ignore lines that start in # or
- * blank lines.
- */
-static char *
-_file_getline(FILE *fp)
-{
- char entry[BUFSIZ], *tmp;
- int size;
-
- size = sizeof (entry);
- tmp = entry;
-
- /* find an entry */
- while (fgets(tmp, size, fp)) {
- if ((tmp == entry) && ((*tmp == '#') || (*tmp == '\n'))) {
- continue;
- } else {
- if ((*tmp == '#') || (*tmp == '\n')) {
- *tmp = NULL;
- break;
- }
-
- size -= strlen(tmp);
- tmp += strlen(tmp);
-
- if (*(tmp-2) != '\\')
- break;
-
- size -= 2;
- tmp -= 2;
- }
- }
-
- if (tmp == entry)
- return (NULL);
- else
- return (strdup(entry));
-}
-
-int
-main(int ac, char *av[])
-{
- int c;
- char file[80], ofile[80];
- char *cp;
- FILE *fp, *fp2;
-
- (void) setlocale(LC_ALL, "");
-
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- while ((c = getopt(ac, av, "f:o:")) != EOF)
-
- switch (c) {
- case 'f':
- (void) strlcpy(file, optarg, sizeof (file));
- break;
- case 'o':
- (void) strlcpy(ofile, optarg, sizeof (ofile));
- break;
- default:
- (void) fprintf(stderr, gettext(
- "Usage: %s [-f file] [-o output file]\n"),
- av[0]);
- return (1);
- }
-
- if ((fp = fopen(file, "r")) != NULL) {
- int fd;
-
- fd = open(ofile, O_RDWR|O_APPEND);
- if ((fd < 0) && (errno == ENOENT))
- fd = open(ofile, O_RDWR|O_CREAT|O_EXCL, 0644);
-
- if (fd < 0) {
- (void) fprintf(stderr,
- gettext("Error trying to open file.\n"));
- return (1);
- }
-
- lseek(fd, 0, SEEK_END);
-
- if ((fp2 = fdopen(fd, "a")) != NULL) {
- while ((cp = _file_getline(fp)) != NULL) {
- (void) fprintf(fp2, "%s", cp);
- }
- return (0);
- } else {
- (void) fprintf(stderr,
- gettext("Error trying to open file.\n"));
- return (1);
- }
- } else {
- (void) fprintf(stderr,
- gettext("Error trying to open file.\n"));
- return (1);
- }
-}
diff --git a/usr/src/cmd/print/lpget/lpget.c b/usr/src/cmd/print/lpget/lpget.c
deleted file mode 100644
index 5c19480ae1..0000000000
--- a/usr/src/cmd/print/lpget/lpget.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <syslog.h>
-#include <locale.h>
-#ifndef SUNOS_4
-#include <libintl.h>
-#endif
-
-#include <ns.h>
-#include <list.h>
-
-extern char *optarg;
-extern int optind, opterr, optopt;
-extern char *getenv(const char *);
-
-
-static void
-Usage(char *name)
-{
- (void) fprintf(stderr,
- gettext("Usage: %s [-k key] [list|(printer) ...]\n"),
- name);
- exit(1);
-}
-
-static int
-display_kvp(char *key, char *value)
-{
- int rc = -1;
-
- if (value != NULL) {
- rc = 0;
- (void) printf("\n\t%s=%s", key, value);
- } else
- (void) printf(gettext("\n\t%s - undefined"), key);
-
- return (rc);
-}
-
-
-static int
-display_value(ns_printer_t *printer, char *name, char **keys)
-{
- int rc = -1;
-
- if (printer != NULL) {
- rc = 0;
- (void) printf("%s:", name);
- if (keys != NULL) {
- while (*keys != NULL) {
- char *string = ns_get_value_string(*keys,
- printer);
- rc += display_kvp(*keys, string);
- keys++;
- }
- } else {
- ns_kvp_t **list = printer->attributes;
-
- for (list = printer->attributes;
- (list != NULL && *list != NULL); list++) {
- char *string;
- if (((*list)->key[0] == '\t') ||
- ((*list)->key[0] == ' '))
- continue;
-
- string = ns_get_value_string((*list)->key,
- printer);
- rc += display_kvp((*list)->key, string);
- }
- }
- (void) printf("\n");
- } else
- (void) printf(gettext("%s: Not Found\n"), name);
-
- return (rc);
-}
-
-
-/*
- * main() calls the appropriate routine to parse the command line arguments
- * and then calls the local remove routine, followed by the remote remove
- * routine to remove jobs.
- */
-int
-main(int ac, char *av[])
-{
- char *program;
- int c;
- char **keys = NULL;
- char *ns = NULL;
- int exit_code = 0;
-
- (void) setlocale(LC_ALL, "");
-
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- if ((program = strrchr(av[0], '/')) == NULL)
- program = av[0];
- else
- program++;
-
- openlog(program, LOG_PID, LOG_LPR);
- while ((c = getopt(ac, av, "k:t:n:")) != EOF)
- switch (c) {
- case 'k':
- case 't':
- keys = (char **)list_append((void **)keys,
- (void *)optarg);
- break;
- case 'n':
- ns = optarg;
- break;
- default:
- Usage(program);
- }
-
- if (optind >= ac)
- Usage(program);
-
- ns = normalize_ns_name(ns);
-
- while (optind < ac) {
- char *name = av[optind++];
-
- if (strcmp(name, "list") == 0) {
- ns_printer_t **printers = ns_printer_get_list(ns);
-
- while (printers != NULL && *printers != NULL) {
- exit_code += display_value(*printers,
- (*printers)->name, keys);
- printers++;
- }
- } else
- exit_code = display_value(ns_printer_get_name(name, ns),
- name, keys);
-
-
- }
- return (exit_code);
-}
diff --git a/usr/src/cmd/print/lpset/Makefile b/usr/src/cmd/print/lpset/Makefile
deleted file mode 100644
index 7b81c117b2..0000000000
--- a/usr/src/cmd/print/lpset/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/client/lpset/Makefile
-#
-
-include ../Makefile.sp
-
-PROG= lpset
-
-SRCS= $(PROG).c
-
-OBJS= $(SRCS:.c=.o)
-
-ROOTBINPROG= $(PROG:%=$(ROOTBIN)/%)
-
-FILEMODE= 04511
-
-CPPFLAGS += -I$(NPRTINC)
-CERRWARN += -_gcc=-Wno-implicit-function-declaration
-LDLIBS += $(LIBNPRT) -lsecdb
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-install: all $(ROOTBIN) $(ROOTBINPROG)
-
-$(ROOTBIN):
- $(INS.dir)
-
-strip:
- $(STRIP) $(PROG)
-
-lint:
- $(LINT.c) $(PROG).c $(LDLIBS)
-
-cstyle:
- cstyle $(SRCS)
-
-_msg:
- @echo "Messages are made in usr/src/cmd/print"
-
-clean:
- $(RM) $(OBJS)
-
-clobber: clean
- -$(RM) $(PROG) $(CLOBBERFILES)
diff --git a/usr/src/cmd/print/lpset/lpset.c b/usr/src/cmd/print/lpset/lpset.c
deleted file mode 100644
index 6cb6b05a8a..0000000000
--- a/usr/src/cmd/print/lpset/lpset.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <limits.h>
-#include <string.h>
-#include <syslog.h>
-#include <errno.h>
-#include <locale.h>
-#ifndef SUNOS_4
-#include <libintl.h>
-#endif
-#include <pwd.h>
-#include <alloca.h>
-
-#include <ns.h>
-#include <list.h>
-
-extern char *optarg;
-extern int optind, opterr, optopt;
-extern char *getenv(const char *);
-
-static void _decode_ldapResult(int result, char *printerName);
-
-static int
-authorized()
-{
- struct passwd *pw;
- uid_t uid;
- gid_t *list;
- int len;
- int maxgrp;
-
- if ((uid = getuid()) == 0)
- return (1); /* "root" is authorized */
-
- if (((pw = getpwnam("lp")) != NULL) && (uid == pw->pw_uid))
- return (1); /* "lp" is authorized */
-
- if ((pw = getpwuid(uid)) == NULL)
- return (0); /* intruders are not authorized */
-
- if (chkauthattr("solaris.print.admin", pw->pw_name) == 1)
- return (1); /* "solaris.print.admin" is authorized */
-
- /* How many supplemental groups do we have? */
- maxgrp = getgroups(0, NULL);
- list = alloca(maxgrp * sizeof (gid_t));
-
- if ((len = getgroups(maxgrp, list)) != -1)
- while (len-- > 0)
- if (list[len] == 14)
- return (1); /* group 14 is authorized */
-
- return (0); /* nobody else is authorized */
-}
-
-static void
-Usage(char *name)
-{
- (void) fprintf(stderr,
- gettext("Usage: %s [-n files | ldap] [-x] "
- "[-h ldaphost] [-D binddn] [-w passwd] "
- "[-a key=value] [-d key] (printer)\n"),
- name);
- exit(1);
-}
-
-
-/*
- * main() calls the appropriate routine to parse the command line arguments
- * and then calls the local remove routine, followed by the remote remove
- * routine to remove jobs.
- */
-int
-main(int ac, char *av[])
-{
- int result = 0;
- int delete_printer = 0;
- int c;
- char *program = NULL,
- *printer = NULL,
- *host = NULL,
- *binddn = NULL,
- *passwd = NULL,
- *ins = NULL,
- *ons = "files";
- char **changes = NULL;
- ns_cred_t *cred = NULL;
- ns_printer_t *printer_obj = NULL;
-
- (void) setlocale(LC_ALL, "");
-
-#if !defined(TEXT_DOMAIN)
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
- (void) textdomain(TEXT_DOMAIN);
-
- if ((program = strrchr(av[0], '/')) == NULL)
- program = av[0];
- else
- program++;
-
- openlog(program, LOG_PID, LOG_LPR);
-
- if (ac < 2)
- Usage(program);
-
- while ((c = getopt(ac, av, "a:d:D:h:n:r:w:x")) != EOF)
- switch (c) {
- case 'd':
- if (strchr(optarg, '=') != NULL)
- Usage(program);
- /* FALLTHRU */
- case 'a':
- changes = (char **)list_append((void**)changes,
- (void *)strdup(optarg));
- break;
- case 'D':
- binddn = optarg;
- break;
- case 'h':
- host = optarg;
- break;
- case 'n':
- ons = optarg;
- break;
- case 'r':
- ins = optarg;
- break;
- case 'w':
- passwd = optarg;
- break;
- case 'x':
- delete_printer++;
- break;
- default:
- Usage(program);
- }
-
- if (optind != ac-1)
- Usage(program);
-
- /*
- * Check required options have been given: [ -x | [ -a | -d ]]
- */
- if ((changes == NULL) && (delete_printer == 0)) {
- Usage(program);
- }
-
- printer = av[optind];
-
- if (strchr(printer, ':') != NULL) {
- (void) fprintf(stderr, gettext(
- "POSIX-Style names are not valid destinations (%s)\n"),
- printer);
- return (1);
- }
-
- ins = normalize_ns_name(ins);
- ons = normalize_ns_name(ons);
- if (ins == NULL)
- ins = ons;
-
- /* check / set the name service for writing */
- if (strcasecmp("user", ons) == 0) {
- (void) setuid(getuid());
- ons = "user";
- } else if (strcasecmp("files", ons) == 0) {
- if (authorized() == 0) {
- (void) fprintf(stderr, gettext(
- "Permission denied: not authorized\n"));
- return (1);
- }
- ons = "files";
- } else if (strcasecmp("ldap", ons) == 0) {
- if ((cred = calloc(1, sizeof (*cred))) == NULL) {
- (void) fprintf(stderr,
- gettext("could not initialize credential\n"));
- return (1);
- }
-
- if (binddn == NULL) {
- (void) fprintf(stderr,
- gettext("Distinguished Name is required.\n"));
- return (1);
- }
-
- if (passwd == NULL) {
- passwd = getpassphrase(gettext("Bind Password:"));
- }
-
- /*
- * Setup LDAP bind credentials, so that it uses
- * the default ldap port, and the NS domain for this
- * ldapclient box. Note: passwdType is currently not
- * used but once the ldap native function can select
- * secure or insure password it will pass the user selected
- * security type.
- */
- cred->passwd = passwd;
- cred->passwdType = NS_PW_INSECURE; /* use default */
- cred->binddn = binddn;
- cred->host = host;
- cred->port = 0; /* use default */
- cred->domainDN = NULL; /* use default */
-
- ons = "ldap";
- (void) setuid(getuid());
- } else {
- (void) fprintf(stderr,
- gettext("%s is not a supported name service.\n"),
- ons);
- return (1);
- }
-
- if (strcasecmp(NS_SVC_LDAP, ons) != 0) {
-
- /* Naming Service is not LDAP */
-
- /* get the printer object */
- if ((printer_obj = ns_printer_get_name(printer, ins)) == NULL) {
- if (delete_printer != 0) {
- (void) fprintf(stderr, gettext
- ("%s: unknown printer\n"), printer);
- return (1);
- }
- if ((printer_obj = calloc(1, sizeof (*printer_obj)))
- == NULL) {
- (void) fprintf(stderr, gettext(
- "could not initialize printer object\n"));
- return (1);
- }
- printer_obj->name = strdup(printer);
- }
-
- printer_obj->source = ons;
-
- if (cred != NULL) {
- printer_obj->cred = cred;
- }
-
- /* make the changes to it */
- while (changes != NULL && *changes != NULL) {
- int has_equals = (strchr(*changes, '=') != NULL);
- char *p, *key = NULL, *value = NULL;
-
- key = *(changes++);
-
- for (p = key; ((p != NULL) && (*p != NULL)); p++)
- if (*p == '=') {
- *p = NULL;
- value = ++p;
- break;
- } else if (*p == '\\')
- p++;
-
- if ((value != NULL) && (*value == NULL))
- value = NULL;
-
- if ((key != NULL) && (key[0] != NULL)) {
- if ((value == NULL) &&
- (ns_get_value(key, printer_obj) == NULL) &&
- (has_equals == 0)) {
- fprintf(stderr,
- gettext("%s: unknown attribute\n"),
- key);
- result = 1;
- } else
- (void) ns_set_value_from_string(key, value,
- printer_obj);
- }
- }
- if (delete_printer != 0)
- printer_obj->attributes = NULL;
-
- /* write it back */
- if (ns_printer_put(printer_obj) != 0) {
- (void) fprintf(stderr,
- gettext("Failed to write into %s database\n"),
- ons);
- result = 1;
- }
- }
-
- else {
- /*
- * Naming Service is LDAP
- *
- * Action the request by calling ns ldap functions to
- * add, modify or delete the printer object.
- */
-
- if ((printer_obj = calloc(1, sizeof (*printer_obj))) == NULL) {
- (void) fprintf(stderr, gettext(
- "could not initialize printer object\n"));
- return (1);
- }
-
- if ((cred != NULL) && (printer_obj != NULL)) {
- printer_obj->name = strdup(printer);
- printer_obj->cred = cred;
- printer_obj->cred->domainDN = NULL; /* use default */
- printer_obj->source = ons;
- printer_obj->nsdata = malloc(sizeof (NS_LDAPDATA));
-
- if (printer_obj->nsdata != NULL) {
- /*
- * Update the LDAP directory for this printer
- */
-
- if (delete_printer != 0) {
- /* Delete the printer object */
- ((NS_LDAPDATA *)
- (printer_obj->nsdata))->attrList
- = NULL;
- } else {
- /* Add or modify the printer object */
- ((NS_LDAPDATA *)
- (printer_obj->nsdata))->attrList =
- changes;
- }
-
- result = ns_printer_put(printer_obj);
- if (result != 0) {
- /* display LDAP specific message */
- _decode_ldapResult(result, printer);
-
- (void) fprintf(stderr, gettext(
- "Failed to update %s database\n"), ons);
- result = 1;
- }
-
- free(printer_obj->nsdata);
- }
-
- else {
- _decode_ldapResult(NSL_ERR_MEMORY, NULL);
- result = 1;
- }
- }
-
- else {
- result = 1;
- (void) fprintf(stderr,
- gettext("Error - no LDAP credentials\n"));
- }
-
- if (printer_obj != NULL) {
- if (printer_obj->name != NULL) {
- free(printer_obj->name);
- }
- free(printer_obj);
- }
-
- }
-
- return (result);
-} /* main */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _decode_ldapResult()
- *
- * Description: Decode the ldap_put_printer specific error codes and display
- * the appropriate error message.
- *
- * Parameters:
- * Input: int result - contains the NSL_RESULT codes
- * char *printerName - name of printer
- * Output: None
- *
- * Returns: void
- *
- * *****************************************************************************
- */
-
-static void
-_decode_ldapResult(int result, char *printerName)
-
-{
- NSL_RESULT lresult = (NSL_RESULT)result;
-
- /* ------------- */
-
- switch (lresult)
- {
- case NSL_OK:
- {
- break;
- }
-
- case NSL_ERR_INTERNAL:
- {
- (void) fprintf(stderr,
- gettext("Unexpected software error\n"));
- break;
- }
-
- case NSL_ERR_ADD_FAILED:
- {
- (void) fprintf(stderr, "%s %s\n",
- gettext("Failed to add printer:"), printerName);
- break;
- }
-
- case NSL_ERR_MOD_FAILED:
- {
- (void) fprintf(stderr, "%s %s\n",
- gettext("Failed to modify printer:"),
- printerName);
- break;
- }
-
- case NSL_ERR_DEL_FAILED:
- {
- (void) fprintf(stderr, "%s %s\n",
- gettext("Failed to delete printer:"),
- printerName);
- break;
- }
-
-
- case NSL_ERR_UNKNOWN_PRINTER:
- {
- (void) fprintf(stderr, "%s %s\n",
- gettext("Unknown printer:"), printerName);
- break;
- }
-
- case NSL_ERR_CREDENTIALS:
- {
- (void) fprintf(stderr, "%s\n",
- gettext("Missing LDAP credential information for printer:"));
- break;
- }
-
- case NSL_ERR_CONNECT:
- {
- (void) fprintf(stderr, "%s\n",
- gettext("Failed to connect to LDAP server"));
- break;
- }
-
- case NSL_ERR_BIND:
- {
- (void) fprintf(stderr, gettext("LDAP bind failed\n"));
- break;
- }
-
- case NSL_ERR_RENAME:
- {
- (void) fprintf(stderr, "%s %s\n",
- gettext("Object rename not allowed for printer:"),
- printerName);
- break;
- }
-
- case NSL_ERR_KVP:
- {
- (void) fprintf(stderr, "%s",
- gettext("Setting sun-printer-kvp attribute is "
- "not supported through this command.\n"));
- break;
- }
-
- case NSL_ERR_BSDADDR:
- {
- (void) fprintf(stderr, "%s",
- gettext("Setting sun-printer-bsdaddr attribute is "
- "not supported through this command.\n"
- "Use the bsaddr attribute instead.\n"));
- break;
- }
-
- case NSL_ERR_PNAME:
- {
- (void) fprintf(stderr, "%s",
- gettext("Setting printer-name attribute is "
- "not supported through this command.\n"));
- break;
- }
-
- case NSL_ERR_MEMORY:
- {
- (void) fprintf(stderr,
- gettext("Memory allocation error\n"));
- break;
- }
-
- case NSL_ERR_MULTIOP:
- {
- (void) fprintf(stderr,
- gettext("Delete and add operation on the "
- "same key attribute is not allowed\n"));
- break;
- }
-
- case NSL_ERR_NOTALLOWED:
- {
- (void) fprintf(stderr,
- gettext("KVP attribute is not allowed\n"));
- break;
- }
-
- default:
- {
- (void) fprintf(stderr,
- gettext("Error code = %d\n"), result);
- break;
- }
- }
-
-} /* _decode_ldapResult */
diff --git a/usr/src/cmd/print/ppdmgr/Makefile b/usr/src/cmd/print/ppdmgr/Makefile
deleted file mode 100644
index ab8f07b46e..0000000000
--- a/usr/src/cmd/print/ppdmgr/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-MANIFEST= ppd-cache-update.xml
-SVCMETHOD= ppd-cache-update
-
-include ../Makefile.sp
-
-ROOTMANIFESTDIR= $(ROOTSVCAPPLICATIONPRINT)
-$(ROOTMANIFEST):= FILEMODE= 444
-
-ROOTVARLP= $(ROOTVAR)/lp
-ROOTVARLPPPD= $(ROOTVARLP)/ppd
-ROOTVARLPPPDCACHES= $(ROOTVARLPPPD)/caches
-
-$(ROOTVARLP):= DIRMODE= 775
-
-.KEEP_STATE:
-
-all:
-install: $(ROOTMANIFEST) $(ROOTSVCMETHOD) \
- $(ROOTVARLP) $(ROOTVARLPPPD) $(ROOTVARLPPPDCACHES)
-check: $(CHKMANIFEST)
-clean:
-clobber:
-lint:
-
-$(ROOTVARLP) $(ROOTVARLPPPD) $(ROOTVARLPPPDCACHES):
- $(INS.dir)
-
-include $(SRC)/cmd/Makefile.targ
diff --git a/usr/src/cmd/print/ppdmgr/ppd-cache-update b/usr/src/cmd/print/ppdmgr/ppd-cache-update
deleted file mode 100644
index 585f747c3f..0000000000
--- a/usr/src/cmd/print/ppdmgr/ppd-cache-update
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-
-. /lib/svc/share/smf_include.sh
-
-case "$1" in
-'start')
- if [ -x /usr/sbin/ppdmgr ] ; then
- /usr/sbin/ppdmgr -u -R all -L all
- fi
- ;;
-*)
- echo "Usage: $0 start"
- exit 1
- ;;
-esac
-exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/print/ppdmgr/ppd-cache-update.xml b/usr/src/cmd/print/ppdmgr/ppd-cache-update.xml
deleted file mode 100644
index 67ade9b999..0000000000
--- a/usr/src/cmd/print/ppdmgr/ppd-cache-update.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
--->
-<!--
- Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- Use is subject to license terms.
-
- ident "%Z%%M% %I% %E% SMI"
-
- NOTE: This service manifest is not editable; its contents will
- be overwritten by package or patch operations, including
- operating system upgrade. Make customizations in a different
- file.
--->
-
-<service_bundle type='manifest' name='SUNWppm:ppd-cache-update'>
-
-<service
- name='application/print/ppd-cache-update'
- type='service'
- version='1'>
-
- <create_default_instance enabled='false' />
-
- <single_instance />
-
- <!--
- This service writes to/reads from /tmp, /var, and /usr.
- -->
- <dependency
- name='filesystem'
- grouping='require_all'
- restart_on='none'
- type='service'>
- <service_fmri value='svc:/system/filesystem/minimal' />
- </dependency>
-
- <exec_method
- type='method'
- name='start'
- exec='/lib/svc/method/ppd-cache-update start'
- timeout_seconds='0'>
- </exec_method>
-
- <exec_method
- type='method'
- name='stop'
- exec=':true'
- timeout_seconds='3'>
- </exec_method>
-
- <property_group name='startd' type='framework'>
- <propval name='duration' type='astring' value='transient' />
- </property_group>
-
- <stability value='Unstable' />
-
- <template>
- <common_name>
- <loctext xml:lang='C'>
- ppd cache update
- </loctext>
- </common_name>
- <documentation>
- <manpage title='ppdmgr' section='1M'
- manpath='/usr/share/man' />
- </documentation>
- </template>
-</service>
-
-</service_bundle>
diff --git a/usr/src/cmd/print/printer-info/printer-info.c b/usr/src/cmd/print/printer-info/printer-info.c
deleted file mode 100644
index a469c5194d..0000000000
--- a/usr/src/cmd/print/printer-info/printer-info.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/prnio.h>
-#include <fcntl.h>
-
-#define COMMAND_SET_MAX 16 /* more than 16 command sets is not likely */
-#define NP(x) (x ? x : "")
-
-typedef struct {
- char *manufacturer;
- char *model;
- char *description;
- char *class;
- char *command_set[COMMAND_SET_MAX];
-} printer_description_t;
-
-int
-get_printer_description(char *path, printer_description_t *info)
-{
- int fd, rc;
- struct prn_1284_device_id id;
- char buf[BUFSIZ];
- char *s, *iter = NULL;
-
- /* open the device */
- if ((fd = open(path, O_RDWR)) < 0)
- return (fd);
-
- /* get the 1284 device id */
- memset(&id, 0, sizeof (id));
- memset(&buf, 0, sizeof (buf));
- id.id_len = sizeof (buf);
- id.id_data = buf;
-
- rc = ioctl(fd, PRNIOC_GET_1284_DEVID, &id);
- /* close(fd); */
- if (rc < 0)
- return (rc);
-
- memset(info, 0, sizeof (*info));
-
- /* parse the 1284 device id string */
- for (s = (char *)strtok_r(buf, ";\n", &iter); s != NULL;
- s = (char *)strtok_r(NULL, ";\n", &iter)) {
- char *t, *u, *iter2 = NULL;
-
- if ((t = (char *)strtok_r(s, ":\n", &iter2)) == NULL)
- continue;
-
- if ((u = (char *)strtok_r(NULL, ":\n", &iter2)) == NULL)
- continue;
-
- if ((strcasecmp(t, "MFG") == 0) ||
- (strcasecmp(t, "MANUFACTURER") == 0))
- info->manufacturer = strdup(u);
- else if ((strcasecmp(t, "MDL") == 0) ||
- (strcasecmp(t, "MODEL") == 0))
- info->model = strdup(u);
- else if ((strcasecmp(t, "DES") == 0) ||
- (strcasecmp(t, "DESCRIPTION") == 0))
- info->description = strdup(u);
- else if ((strcasecmp(t, "CLS") == 0) ||
- (strcasecmp(t, "CLASS") == 0))
- info->class = strdup(u);
- else if ((strcasecmp(t, "CMD") == 0) ||
- (strcasecmp(t, "COMMAND SET") == 0)) {
- /* this should be more dynamic, I got lazy */
- char *v, *iter3 = NULL;
- int i = 0;
-
- for (v = (char *)strtok_r(u, ",\n", &iter3);
- ((v != NULL) && (i < COMMAND_SET_MAX));
- v = (char *)strtok_r(NULL, ",\n", &iter3))
- info->command_set[i++] = strdup(v);
- }
- }
-
- return (0);
-}
-
-static void
-usage(char *name)
-{
- char *program;
-
- if ((program = strrchr(name, '/')) == NULL)
- program = name;
- else
- program++;
-
- printf("Usage: %s [-aMmdCc] (path) ...\n", program);
-}
-
-int
-main(int ac, char *av[])
-{
- int rc;
- int manufacturer = 0, model = 0, description = 0, command_set = 0,
- class = 0;
-
- while ((rc = getopt(ac, av, "aMmdCc")) != EOF)
- switch (rc) {
- case 'a':
- manufacturer++;
- model++;
- description++;
- command_set++;
- class++;
- break;
- case 'M':
- manufacturer++;
- break;
- case 'm':
- model++;
- break;
- case 'd':
- description++;
- break;
- case 'C':
- command_set++;
- break;
- case 'c':
- class++;
- break;
- default:
- usage(av[0]);
- exit(1);
- }
-
- if (optind >= ac) {
- usage(av[0]);
- exit(1);
- }
-
- while (optind < ac) {
- char *path = av[optind++];
- printer_description_t info;
-
- rc = get_printer_description(path, &info);
- if (rc == 0) {
- printf("%s:\n", path);
- if (manufacturer != 0)
- printf("\tManufacturer: %s\n",
- NP(info.manufacturer));
- if (model != 0)
- printf("\tModel: %s\n",
- NP(info.model));
- if (description != 0)
- printf("\tDescription: %s\n",
- NP(info.description));
- if (class != 0)
- printf("\tClass: %s\n",
- NP(info.class));
- if (command_set != 0) {
- int i;
-
- printf("\tCommand set:\n");
- for (i = 0; info.command_set[i] != NULL; i++)
- printf("\t\tcmd[%d]: %s\n", i,
- info.command_set[i]);
- }
- } else
- perror(path);
- }
- return (rc);
-}
diff --git a/usr/src/cmd/print/printmgr/Makefile b/usr/src/cmd/print/printmgr/Makefile
deleted file mode 100644
index ef82fd7feb..0000000000
--- a/usr/src/cmd/print/printmgr/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# Makefile for print manager
-#
-PROG = pmserver.jar pmclient.jar
-
-include $(SRC)/cmd/Makefile.cmd
-
-SUBDIRS = com bin
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-_msg := TARGET= _msg
-
-ROOTDIRS = $(ROOT)/usr/sadm/admin \
- $(ROOT)/usr/sadm/admin/printmgr \
- $(ROOT)/usr/sadm/admin/printmgr/classes
-
-ROOTBIN = $(ROOT)/usr/sadm/admin/printmgr/classes
-ROOTBINPROG = $(PROG:%=$(ROOTBIN)/%)
-
-$(ROOTBINPROG):= FILEMODE = 644
-
-.KEEP_STATE:
-
-all: $(SUBDIRS)
-install: $(SUBDIRS) $(ROOTDIRS) $(ROOTBINPROG) .WAIT links
-
-links:
- $(RM) $(ROOTUSRSBIN)/printmgr
- $(SYMLINK) ../../usr/sadm/admin/bin/printmgr \
- $(ROOTUSRSBIN)/printmgr
-
-clean clobber: $(SUBDIRS)
- -$(RM) $(PROG)
-
-lint _msg: $(SUBDIRS)
-
-strip:
-
-$(PROG): FRC
- @if [ $@ = "pmclient.jar" ]; \
- then $(JAR) cf $@ \
- com/sun/admin/pm/client/*class \
- com/sun/admin/pm/client/images/*gif 2>/dev/null; \
- else $(JAR) cf $@ \
- com/sun/admin/pm/server/*class 2>/dev/null; \
- fi
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-$(ROOTDIRS):
- $(INS.dir)
-
-$(ROOTBIN)/%: %
- $(INS.file)
-
-FRC:
diff --git a/usr/src/cmd/print/printmgr/bin/printmgr.sh b/usr/src/cmd/print/printmgr/bin/printmgr.sh
deleted file mode 100644
index c12d71cd86..0000000000
--- a/usr/src/cmd/print/printmgr/bin/printmgr.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#! /usr/bin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-PMDIR="/usr/sadm/admin/printmgr"
-CLSDIR="${PMDIR}/classes"
-L10NDIR="/usr/share/lib/locale"
-
-CLASSPATH="${L10NDIR}:${CLSDIR}/pmclient.jar:${CLSDIR}/pmserver.jar"
-LD_LIBRARY_PATH="${PMDIR}/lib"
-
-export CLASSPATH LD_LIBRARY_PATH
-
-exec /usr/java/bin/java com.sun.admin.pm.client.pmTop $1
diff --git a/usr/src/cmd/print/printmgr/com/Makefile b/usr/src/cmd/print/printmgr/com/Makefile
deleted file mode 100644
index 78a71dc67e..0000000000
--- a/usr/src/cmd/print/printmgr/com/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# Makefile for print manager
-#
-include $(SRC)/cmd/Makefile.cmd
-
-SUBDIRS = sun
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-_msg := TARGET= _msg
-
-all install clean clobber lint _msg: $(SUBDIRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
diff --git a/usr/src/cmd/print/printmgr/com/sun/Makefile b/usr/src/cmd/print/printmgr/com/sun/Makefile
deleted file mode 100644
index 9bfd4551f3..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# Makefile for print manager
-#
-include $(SRC)/cmd/Makefile.cmd
-
-SUBDIRS = admin
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-_msg := TARGET= _msg
-
-all install clean clobber lint _msg: $(SUBDIRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/Makefile b/usr/src/cmd/print/printmgr/com/sun/admin/Makefile
deleted file mode 100644
index 08b0c55bec..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# Makefile for print manager
-#
-include $(SRC)/cmd/Makefile.cmd
-
-SUBDIRS = pm
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-_msg := TARGET= _msg
-
-all install clean clobber lint _msg: $(SUBDIRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/Makefile b/usr/src/cmd/print/printmgr/com/sun/admin/pm/Makefile
deleted file mode 100644
index efbf6fee75..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright (c) 1999 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# Makefile for print manager
-#
-include $(SRC)/cmd/Makefile.cmd
-
-SUBDIRS = server client
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-_msg := TARGET= _msg
-
-all install clean clobber lint _msg: $(SUBDIRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/BST.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/BST.java
deleted file mode 100644
index 5bdd31d333..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/BST.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * BST.java
- * Simple binary search tree implementation for help articles
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-import java.util.*;
-import com.sun.admin.pm.server.*;
-
-
-public class BST extends Object {
-
- // these should be protected...
- public BST left = null;
- public BST right = null;
- public BST parent = null;
- public BSTItem data;
-
- static public int comparisons;
-
- public BST(BSTItem theItem) {
- // Debug.info("HELP: New BST(" + theItem + ")");
-
- left = right = null;
- data = theItem;
- }
-
-
- public BST() {
- this(new BSTItem("", null));
- }
-
- public BST insert(String key, Object data) {
- return insert(new BSTItem(key, data));
- }
-
-
- // normal bst insertion
- public BST insert(BSTItem theItem) {
-
- int comp = data.compare(theItem);
- BST node = null;
-
- if (comp == 0) {
- Debug.info("HELP: Duplicate insert: " +
- theItem.toString());
- } else if (comp > 0) {
- if (left != null)
- left.insert(theItem);
- else
- left = node = new BST(theItem);
- } else if (comp < 0) {
- if (right != null)
- right.insert(theItem);
- else
- right = node = new BST(theItem);
- }
-
- return node;
- }
-
-
- public BST find_tree(String newKey) {
- return find_tree(newKey, true);
- }
-
- public BSTItem find(String newKey) {
- return find(newKey, true);
- }
-
-
- public BST find_tree(String newKey, boolean exactMatch) {
- /*
- * Debug.info("HELP: Finding " +(exactMatch ? "exact " : "partial ") +
- * newKey);
- */
-
- BST rv = null;
- int comp = data.compare(newKey, exactMatch);
-
- ++comparisons;
-
- if (comp > 0) {
- if (left != null)
- rv = left.find_tree(newKey, exactMatch);
- } else if (comp < 0) {
- if (right != null)
- rv = right.find_tree(newKey, exactMatch);
- } else {
- rv = this;
- // Debug.info("HELP: Found " + newKey + " in " + data);
- }
-
- return rv;
- }
-
- public BSTItem find(String newKey, boolean exactMatch) {
- Debug.info("HELP: Finding " +(exactMatch ? "exact " : "partial ") +
- newKey);
-
- BSTItem rv = null;
- int comp = data.compare(newKey, exactMatch);
-
- ++comparisons;
-
- if (comp > 0) {
- if (left != null)
- rv = left.find(newKey, exactMatch);
- } else if (comp < 0) {
- if (right != null)
- rv = right.find(newKey, exactMatch);
- } else {
- Debug.info("HELP: Found " + newKey + " in " + data);
- rv = this.data;
- }
-
- return rv;
- }
-
-
-
- public void traverse() {
- if (left != null)
- left.traverse();
- Debug.info("HELP: Traverse: " + data);
- if (right != null)
- right.traverse();
- }
-
- public void traverse_right() {
- Debug.info("HELP: Traverse: " + data);
- if (right != null)
- right.traverse();
- }
-
-
- public void traverse_find(String key) {
- if (left != null)
- left.traverse_find(key);
- if (data.compare(key, false) < 0)
- return;
- Debug.info("HELP: Traverse_find: " + data.key);
- if (right != null)
- right.traverse_find(key);
- }
-
- // empty search string is a wildcard...
- public void traverse_find_vector(Vector v, String key) {
- /*
- * Debug.info("HELP: traverse_find_vector: node " +
- * data.key + "[" +(left!=null?left.data.key:"null") + "]" +
- * "[" +(right!=null ?right.data.key:"null") + "]" +
- * " seeking " + key);
- */
- int c = 0;
-
- if (key.length() > 0)
- c = data.compare(key, false);
-
- /*
- * Debug.info("HELP: traverse_find_vector: compare " +
- * data.key + " to "+ key + " = " + c);
- */
-
- if (c >= 0 && left != null)
- left.traverse_find_vector(v, key);
-
- if (c == 0) {
- // Debug.info("HELP: traverse_find_vector: adding " + data.key);
- v.addElement(data.data);
- }
-
- if (c <= 0) {
- if (right != null)
- right.traverse_find_vector(v, key);
- }
- }
-
-
- public void dump() {
- Debug.info("HELP: \nDump: this = " + data.key);
-
- if (left != null)
- Debug.info("HELP: Dump: left = " + left.data.key);
- else
- Debug.info("HELP: Dump: left = null");
-
-
- if (right != null)
- Debug.info("HELP: Dump: right = " + right.data.key);
- else
- Debug.info("HELP: Dump: right = null");
-
- if (left != null)
- left.dump();
- if (right != null)
- right.dump();
-
- }
-
- public static void main(String args[]) {
- BSTItem root = new BSTItem("Root");
- BSTItem a = new BSTItem("Alpha");
- BSTItem b = new BSTItem("Bravo");
- BSTItem c = new BSTItem("Charlie");
- BSTItem d = new BSTItem("Delta");
- BSTItem e = new BSTItem("Echo");
- BSTItem x = new BSTItem("Xray");
- BSTItem aa = new BSTItem("aspect");
- BSTItem ab = new BSTItem("assess");
- BSTItem ad = new BSTItem("assist");
- BSTItem ae = new BSTItem("asphalt");
- BSTItem af = new BSTItem("asap");
- BSTItem ag = new BSTItem("adroit");
- BSTItem ah = new BSTItem("adept");
- BSTItem ai = new BSTItem("asdf");
-
- BST bst = new BST(root);
-
- BST.comparisons = 0;
- bst.insert(a);
- System.out.println(BST.comparisons +
- " comparisons\n");
- BST.comparisons = 0;
- bst.insert(x);
- System.out.println(BST.comparisons +
- " comparisons\n");
- BST.comparisons = 0;
- bst.insert(e);
- System.out.println(BST.comparisons +
- " comparisons\n");
- BST.comparisons = 0;
- bst.insert(c);
- System.out.println(BST.comparisons +
- " comparisons\n");
- BST.comparisons = 0;
- bst.insert(b);
- System.out.println(BST.comparisons +
- " comparisons\n");
- BST.comparisons = 0;
- bst.insert(d);
- System.out.println(BST.comparisons +
- " comparisons\n");
-
- bst.insert(aa);
- bst.insert(ab);
- bst.insert(ad);
- bst.insert(ae);
- bst.insert(af);
- bst.insert(ag);
- bst.insert(ah);
- bst.insert(ai);
-
- bst.traverse();
-
- BST.comparisons = 0;
- bst.find("Echo");
- System.out.println(BST.comparisons +
- " comparisons\n");
- BST.comparisons = 0;
- bst.find("Xray");
- System.out.println(BST.comparisons +
- " comparisons\n");
- BST.comparisons = 0;
- bst.find("Delta");
- System.out.println(BST.comparisons +
- " comparisons\n");
- BST.comparisons = 0;
- bst.find("Root");
- System.out.println(BST.comparisons +
- " comparisons\n");
- bst.find("Alpha");
-
- bst.dump();
- if (bst.left != null)
- bst.left.dump();
- if (bst.right != null)
- bst.right.dump();
-
- {
- Debug.info("HELP: Looking for a");
- BST result = bst.find_tree("a", false);
- result.traverse_find("a");
-
- Debug.info("HELP: Looking for as");
- result = result.find_tree("as", false);
- result.traverse_find("as");
-
- Debug.info("HELP: Looking for ass");
- result = result.find_tree("ass", false);
- result.traverse_find("ass");
-
- Debug.info("HELP: Looking for ad");
- result = bst.find_tree("ad", false);
- result.traverse_find("ad");
- }
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/BSTItem.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/BSTItem.java
deleted file mode 100644
index 0ad3b5f8fe..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/BSTItem.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * BSTItem.java
- * Simple binary search tree implementation for help articles
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-import com.sun.admin.pm.server.*;
-
-public class BSTItem extends Object {
- public String key;
- public Object data;
- public int handle = UNINITIALIZED;
-
- static int serial = 0;
- static final int UNINITIALIZED = -1;
-
- public BSTItem(String newKey) {
- this(newKey, null);
- }
-
- public BSTItem(String newKey, Object obj) {
- key = newKey.toLowerCase();
- data = obj;
- handle = serial++;
- }
-
- public String toString() {
- return new String("Item " + key + " (" + handle + ")");
- }
-
- public int compare(BSTItem otherItem, boolean exact) {
-
- return compare(otherItem.key, exact);
- }
-
-
- public int compare(BSTItem otherItem) {
- return compare(otherItem, true);
- }
-
- public int compare(String otherKey) {
- return compare(otherKey, true);
- }
-
-
- public int compare(String otherKey, boolean exact) {
-
- /*
- * System.out.println(this.toString() + " comparing " +
- * (exact ? "exact" : "partial") + " to " + otherKey);
- */
-
- int rv = 0;
-
- if (otherKey != null && otherKey != "")
- rv = exact ?
- key.compareTo(otherKey) :
- compareSub(otherKey.toLowerCase());
-
- /*
- * System.out.println(
- * "Compare: " + key + " to " + otherKey + " -> " + rv);
- */
-
- return rv;
- }
-
-
- public int compareSub(String s) {
- Debug.info("HELP: compareSub: " + key + " to " + s);
-
- int rv = 0;
- try {
- rv = key.substring(0, s.length()).compareTo(s);
- } catch (Exception x) {
- Debug.info("HELP: compareSub caught: " + x);
- rv = -1;
- }
- return rv;
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/Constants.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/Constants.java
deleted file mode 100644
index 12ffe37f5d..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/Constants.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Comment which describes the contents of this file.
- *
- * Constants.java
- * Common constants for Printer Manager
- */
-
-package com.sun.admin.pm.client;
-
-/*
- * pmConstants.java
- * defines constants used with print manager
- */
-
-public interface Constants
-{
- // Buttons
- int OK = 1;
- int APPLY = 2;
- int RESET = 3;
- int CANCEL = 4;
- int HELP = 5;
-
- // Buttons for user access list
- int ADD = 6;
- int DELETE = 7;
-
- // Printer type to add/modify
- int ADDLOCAL = 1;
- int ADDNETWORK = 2;
- int MODIFYATTACHED = 3;
- int MODIFYREMOTE = 4;
- int MODIFYNETWORK = 5;
-
- // Printer connection types
- int ATTACHED = 1;
- int NETWORK = 2;
-
- // Useful Constants
- int MAXPNAMELEN = 20;
-
- // Combo Listener
- int PORT = 1;
- int TYPE = 2;
- int MAKE = 3;
- int MODEL = 4;
- int PPD = 5;
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/Makefile b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/Makefile
deleted file mode 100644
index f80827be30..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/Makefile
+++ /dev/null
@@ -1,144 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Makefile for Java Print Manager client
-#
-include $(SRC)/Makefile.master
-include $(SRC)/cmd/Makefile.cmd
-
-
-CLASSPATH= $(SRC)/cmd/print/printmgr
-
-CLASSFILES = Constants.class \
- pmAuthOptions.class \
- pmHelpFrame.class \
- pmTop.class \
- pmResources.class \
- pmCopyright.class \
- pmUtility.class \
- pmCalls.class \
- pmLoad.class \
- pmDelete.class \
- pmAccess.class \
- pmButtonScreen.class \
- pmInstallScreen.class \
- pmInstallPrinter.class \
- pmOKCancelDialog.class \
- pmMessageDialog.class \
- pmLogin.class \
- pmLogDisplay.class \
- pmHelpDetailPanel.class \
- pmHelpContent.class \
- pmHelpController.class \
- pmHelpDetailPanel.class \
- pmHelpIndexPanel.class \
- pmHelpItem.class \
- pmHelpRepository.class \
- pmHelpSearchPanel.class \
- BST.class \
- BSTItem.class \
- pmGuiException.class \
- pmHelpException.class \
- pmAddAccessFailedException.class \
- pmAddPrinterFailedException.class \
- pmIncompleteFormException.class \
- pmLoginFailedException.class \
- pmModifyPrinterFailedException.class \
- pmPrinterExistsException.class \
- pmDeleteFailedException.class \
- pmMustBeRemoteServerException.class \
- pmUserCancelledException.class \
- pmNullSelectedPrinterException.class \
- pmNeedPPDCacheException.class \
- pmCacheMissingPPDException.class \
- pmFindFrame.class \
- pmAboutBox.class \
- pmFrame.class \
- pmButton.class \
- pmTextField.class \
- pmAuthOptions.class \
- pmOther.class
-
-JAVAFILES = $(CLASSFILES:.class=.java)
-
-MSGDIRS = $(ROOT)/usr/share/lib/locale \
- $(ROOT)/usr/share/lib/locale/com \
- $(ROOT)/usr/share/lib/locale/com/sun \
- $(ROOT)/usr/share/lib/locale/com/sun/admin \
- $(ROOT)/usr/share/lib/locale/com/sun/admin/pm \
- $(ROOT)/usr/share/lib/locale/com/sun/admin/pm/client
-
-MSGDIR = $(ROOT)/usr/share/lib/locale/com/sun/admin/pm/client
-MSGJAVAFILES = pmResources.java pmHelpResources.java
-MSGFILES = $(MSGJAVAFILES:%=$(MSGDIR)/%)
-
-$(MSGFILES):= FILEMODE = 644
-
-CLEANFILES= *.class pmHelpResources.java pmCopyright.java \
- helptools/*.class helptools/parsehelp
-CLOBBERFILES=
-
-#
-# raw-text help files
-#
-HELPFILES= ./raw-help/*.rawhlp
-
-#
-# text file containing comments to be bound into the help resource bundle
-#
-HELP_COMMENTS=./help-l10n-comments.txt
-
-install all: pmCopyright.java $(CLASSFILES) help
-
-pmCopyright.java: pm_gen_copyright
- $(SH) ./pm_gen_copyright
-
-#
-# pmHelpResources.java is generated by parsing raw help text
-#
-pmHelpResources.java: $(HELP_COMMENTS) \
- $$(HELPFILES) \
- helptools/parseMain.class \
- helptools/parsehelp
- $(RM) pmHelpResources.*
- helptools/parsehelp -C $(HELP_COMMENTS) -D $(CLASSPATH) \
- -J $(JAVA_ROOT) $(HELPFILES)
-
-help: pmHelpResources.class
-
-_msg: $(MSGDIRS) help $(MSGFILES)
-
-$(MSGDIR)/%: %
- $(INS.file)
-
-$(MSGDIRS):
- $(INS.dir)
-
-jstyle:
- jstyle $(JAVAFILES)
-
-lint:
-clean:
- $(RM) $(CLEANFILES)
-clobber: clean
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/help-l10n-comments.txt b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/help-l10n-comments.txt
deleted file mode 100644
index d7440d8460..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/help-l10n-comments.txt
+++ /dev/null
@@ -1,242 +0,0 @@
-
-CDDL HEADER START
-
-The contents of this file are subject to the terms of the
-Common Development and Distribution License (the "License").
-You may not use this file except in compliance with the License.
-
-You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-or http://www.opensolaris.org/os/licensing.
-See the License for the specific language governing permissions
-and limitations under the License.
-
-When distributing Covered Code, include this CDDL HEADER in each
-file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-If applicable, add the following below this CDDL HEADER, with the
-fields enclosed by brackets "[]" replaced with your own identifying
-information: Portions Copyright [yyyy] [name of copyright owner]
-
-CDDL HEADER END
-
-Localization Notes for the Oracle Solaris Print Manager
-3/16/99
-
-1. Overview
- The help documentation tree consists of a collection of Articles,
- each relating to a specific dialog, message, procedure, or
- other topic. The text, keywords, and metadata comprising the
- entire set of Articles is delivered in a single (large)
- ResourceBundle per locale.
-
- Each article consists of several parts, all of which must be
- defined within the ResourceBundle. These parts are called Tag,
- Title, Content, Keywords, and See-Also. Title, Content, and
- Keywords must be localized while Tag and See-Also must not.
-
- The Tag is an identifier unique to each Article. The application
- uses Tags to refer to specific Articles. The ResourceBundle uses
- each Article's Tag to form the keys which identify the
- strings comprising the Article.
-
- The strings used as keys to identify the various parts of the
- articles in the ResourceBundle are in the form of a dotted pair,
- where the left side identifies the Tag of the Article to which
- this string belongs and the right side describes which part of
- that Article the string embodies.
-
- The suffixes used to identify the Tag, Title, Content, Keywords,
- and See-Also parts of a help article's resources are ".tag",
- ".title", ".content", ".keyword", and ".seealso" respectively.
-
- Examples: The key "ToAddPrinter.title" is associated with a
- localizable string that represents the title of the article whose
- tag is "ToAddPrinter". The key "ToDeletePrinter.content" refers to
- a localizable string which contains the content of the help article
- itself.
-
-
-2. Structure of Help Articles
-
-2.1 Tags
- Each Article is associated with a unique identifier called a Tag.
- Tags are used internally and are never directly visible to users.
-
- A Tag is a case-sensitive string of alphanumeric 7-bit ASCII
- characters containing no embedded whitespace or punctuation.
-
- For convenience, an article's Tag is usually formed by taking the
- title and removing whitespace and punctuation; for example,
- the article titled "Troubleshooting Printer Problems" might have
- the Tag "TroubleShootingPrinterProblems". Note that this is a
- mnemonic device only and in no way engenders a dependency between
- the non-localizable Tag, which must be embedded in the
- application's source code, and the article's title itself, which
- must be localized.
-
- *TAGS ARE NOT TO BE LOCALIZED!*
-
-
-2.2 Title and Content
- Each Article must contain a Title and some Content.
-
- The Title is an arbitrary localizable string which will be
- presented to the user upon viewing its associated Article.
-
- The Content of an Article consists of a block of localizable text
- which may contain a limited set of embedded HTML tags (subject to
- restrictions described below).
-
- Since the Content is displayed in a window whose size may be
- adjusted by the user, its layout cannot be completely controlled by
- the author. The Help display relies on word-wrapping and HTML
- formatting to ensure correct appearance.
-
- The viewable Content of an Article is authored in a tiny subset of
- HTML which can be reliably rendered in the Help component. The
- intention is to provide a simple facility for controlling the
- appearance of the text and for handling paragraph and line breaks.
-
- The supported capabilities are:
-
- . Emphasize sections of text by bolding: <b> ... </b>
-
- . Line breaks: <br>
-
- . Paragraph breaks: <p>
-
- No other HTML tags should be embedded in the Content as they
- may not produce the expected results. No hyperlinks or images
- are supported!
-
- Note that while the content itself may be localized, the HTML tags
- embedded within the content should be left in ASCII.
-
- *BOTH TITLE AND CONTENT MUST BE LOCALIZED!*
-
-
-2.3 Keywords
-
- Users may search the collection of help articles by specifying one
- or more keywords (in the locale's representation) which are matched
- against the set of Articles. Those articles whose keyword list has
- one or more matches with the user's list will then be viewable.
-
- Each Article may specify a (possibly empty) list of keywords
- separated by whitespace and containing no commas or punctuation.
- The whitespace in this list of keywords is used only to separate
- individual keywords.
-
- Each Keyword in the list must be a string of localizable
- alphanumeric text containing no whitespace (punctuation marks such
- as "-" may be OK).
-
- *KEYWORDS MUST BE LOCALIZED!*
-
-
-2.4 See-Also
-
- Each article may refer to other Articles by presenting the user
- with a "See-Also" list when the Article is viewed. This user's
- view of this list contains the Titles of the specified articles,
- and clicking a title causes that article to be presented.
-
- The See-Also list associated with a particular Article consists of
- a (possibly empty) list containing Tags of other articles separated
- by whitespace and containing no commas or punctuation. The list of
- Titles corresponding to these Tags will be displayed to the user in
- the same order that it appears in the definition of the Article.
-
- *SEE-ALSO ITEMS ARE NOT TO BE LOCALIZED!*
-
-
-3. Notes on Representation of Content
-
- The internal representation of the Content component of each
- article is as a single (long) Java String.
-
- Java permits the static initialization of Strings to use
- catenation on the right-hand side of the assignment.
- For example, the Java statements
- String s = "foo bar";
- and
- String s = "foo" + " " + bar;
- will result in an identical assignment.
-
- Since the HTML rendering process which displays the resource to
- the user ignores whitespace and line breaks, the initializations
- of Content strings in the Help ResourceBundle exploit this approach
- to make the code more readable and facilitate the localization
- process.
-
- Note that the breaking up of the Content string into source lines is
- transparent to the application; details of the source file's
- appearance can change across localizations (assuming that tag names
- are maintained correctly).
-
- As an example, consider the ResourceBundle entry which defines the
- Content portion of a help article whose tag is "ToDeletePrinter".
- This entry might appear in the ResourceBundle source as
-
- { "ToDeletePrinter.content",
-
- "This is some help content which would extend across several " +
- "lines of text if it were all in a single long string. " +
- "Since we can separate the one long string into several " +
- "short ones, " +
- "the source file is much more easily readable. "
- }
-
-
-4. Previewing Help Article Content
-
- It is possible to use an ordinary HTML browser to view the Content of
- all the help Articles in a ResourceBundle. To do so requires the
- extraction and formatting of the strings in the ResourceBundle which
- comprise the Content portions of all included Articles.
-
- One approach is to create a simple script which acts as a filter; its
- input is the pmHelpResources.java ResourceBundle source file and its
- output is a stream of HTML which can be saved to a file and viewed in
- a browser.
-
- The use of such a script can facilitate the localization process by
- enabling localization teams to view a particular version of the
- ResourceBundle as work on it progresses.
-
- An example of a script which performs the required formatting and
- extraction is as follows:
-
- -----------------------
- #!/bin/ksh
- #
- # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
- # All rights reserved.
- #
- # This filter accepts a pmHelpResources.java file as input
- # and produces formatted HTML as output.
- #
-
- while read line; do
- echo "$line" | grep '^.*{".*\.tag"' > /dev/null
- if [[ $? == 0 ]]; then
- print -n "<br> <h2> "
- print -n `echo "$line" | sed s/'\.'/\ / | \
- sed s/\"/\ /g | awk '{print \$2}'`
- print " </h2>"
- fi
-
- echo "$line" | grep '^\".*+$' | sed s/^\"//g | sed s/\"\ +\$//
-
- done
- -----------------------
-
- Usage of this script (assuming it is named 'extract') would be:
- % extract < pmHelpResources.java > content.html
-
-
-5. Support
-
- For further assistance please contact:
- Claude Noshpitz, clauden@eng.sun.com.
-
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helpTest.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helpTest.java
deleted file mode 100644
index 8af71ace2a..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helpTest.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * helpTest.java
- * Test harness for help subsystem
- */
-
-package com.sun.admin.pm.client;
-
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import javax.swing.JPanel;
-import javax.swing.border.*;
-import javax.swing.event.*;
-import javax.swing.*;
-import com.sun.admin.pm.server.*;
-
-class helpTest {
- static private pmHelpFrame helpFrame = null;
-
- public static void main(String args[]) {
-
- Debug.setDebugLevel(Debug.ERROR);
-
- JFrame frame = new JFrame("Help Test Tool");
- frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {System.exit(0); }
- });
-
- helpFrame = new pmHelpFrame();
- helpFrame.setLocation(180, 180);
-
-
- JList theList = new JList();
- theList.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
- JList l = (JList) e.getSource();
- int i = l.locationToIndex(e.getPoint());
- Debug.message("doubleclick index: " + i);
- if (i >= 0) {
- String s = (String) l.getModel().getElementAt(i);
- Debug.message("doubleclick: " + s);
- helpFrame.showHelp(s);
- }
- }
- }
- });
-
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.getViewport().setView(theList);
-
- JPanel tp = new JPanel();
- tp.setLayout(new GridBagLayout());
- GridBagConstraints pc = new GridBagConstraints();
- pc.insets = new Insets(5, 5, 0, 5);
- // pc.fill = GridBagConstraints.HORIZONTAL;
- pc.weightx = 1.0;
- pc.anchor = GridBagConstraints.WEST;
- pc.gridx = 0;
- pc.gridy = GridBagConstraints.RELATIVE;
-
- tp.add(new JLabel("Double-click a tag to load it."), pc);
- pc.insets = new Insets(0, 5, 5, 5);
- tp.add(new JLabel(""), pc);
-
- JPanel p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(5, 5, 5, 5);
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridheight = 1;
- c.gridx = 0;
- c.gridy = 0;
- c.weightx = 1.0;
- c.weighty = 0.0;
-
- c.anchor = GridBagConstraints.NORTH;
- p.add(tp, c);
-
- JPanel pp = new JPanel();
- pp.setLayout(new BorderLayout());
- pp.add(scrollPane, "Center");
-
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridheight = 0;
- c.weighty = 1.0;
- c.weightx = 0.0;
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.EAST;
-
- p.add(pp, c);
-
- p.setBorder(BorderFactory.createEtchedBorder());
-
- frame.getContentPane().add("Center", p);
-
- helpTestButtonPanel bp = new helpTestButtonPanel();
- frame.getContentPane().add("South", bp);
-
- p = new JPanel();
- Vector v = new Vector();
-
- ResourceBundle bundle = null;
-
- try {
- bundle = ResourceBundle.getBundle(
- "com.sun.admin.pm.client.pmHelpResources");
- } catch (MissingResourceException e) {
- System.out.println("Could not load pmHelpResources file");
- System.exit(-1);
- }
-
- Enumeration e = bundle.getKeys();
- while (e.hasMoreElements()) {
- String key = (String) e.nextElement();
- if (key.endsWith(".tag")) {
- String tagName = null;
- try {
- tagName = bundle.getString(key);
- } catch (MissingResourceException x) {
- System.out.println("Unable to find tag for " + key);
- continue;
- }
- v.addElement(tagName);
- }
- }
-
- theList.setListData(v);
- theList.removeSelectionInterval(
- theList.getMinSelectionIndex(),
- theList.getMaxSelectionIndex());
- // theList.addSelectionInterval(3, 5);
- // theList.disable();
-
- frame.pack();
- frame.setVisible(true);
- frame.repaint();
- System.err.println("Hello from main");
-
- }
-
- public void showHelpItem(String tag) {
- helpFrame.showHelp(tag);
- }
-
-}
-
- class helpTestButtonPanel extends JPanel {
- JButton dismiss;
-
- public helpTestButtonPanel() {
- add(dismiss = new JButton("Done"));
- dismiss.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- System.exit(0);
- }
- });
- }
- }
-
-
-
-
-
-
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/extract b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/extract
deleted file mode 100644
index b05f85fd20..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/extract
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-# Copyright (c) 1999, by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# This filter accepts a pmHelpResources.java file as input
-# and produces formatted HTML as output.
-#
-
-while read line; do
- echo "$line" | grep '^.*{".*\.tag"' > /dev/null
- if [[ $? == 0 ]]; then
- print -n "<br> <h2> "
- print -n `echo "$line" | sed s/'\.'/\ / | \
- sed s/\"/\ /g | awk '{print \$2}'`
- print " </h2>"
- fi
-
- echo "$line" | grep '^\".*+$' | sed s/^\"//g | sed s/\"\ +\$//
-
-done
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/parseMain.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/parseMain.java
deleted file mode 100644
index 4dbb34bb4e..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/parseMain.java
+++ /dev/null
@@ -1,811 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-import java.io.*;
-import java.util.*;
-import java.lang.*;
-
-
-class ResourceWriter {
-
- BufferedWriter theWriter = null;
- String theTag = null;
-
- static final String NL = new String("\n");
- static final String LOCALIZE = new String("// LOCALIZE");
- static final String NOLOCALIZE = new String("// DO NOT LOCALIZE");
- static final String INDENT = new String(" ");
- static final String INDENT_2 = new String(INDENT + INDENT);
- static final String COMMENTBLOCK_START = new String("/*");
- static final String COMMENTBLOCK_END = new String(" */");
- static final String COMMENTLINE_START = new String(" * ");
-
- public ResourceWriter(BufferedWriter w) {
- theWriter = w;
- }
-
- public void close() throws IOException {
- theWriter.flush();
- theWriter.close();
- }
-
- protected void writenl(String s) throws IOException {
- theWriter.write(s, 0, s.length());
- theWriter.newLine();
- }
-
- protected void write(String s) throws IOException {
- theWriter.write(s, 0, s.length());
- }
-
- public void fileheader() throws IOException {
- writenl("/* ");
- writenl(" * GENERATED CODE");
- writenl(" *");
- writenl(" * Copyright 1999 Sun Microsystems, Inc.");
- writenl(" * All rights reserved.");
- writenl(" *");
- writenl(" */");
- writenl("");
- writenl("package com.sun.admin.pm.client;");
- writenl("import java.util.*;");
- }
-
- public void classheader(String className) throws IOException {
- writenl("public class " + className +
- " extends ListResourceBundle {");
- writenl(INDENT +
- "static final Object[][] pmHelpBundlecontents = {");
- }
-
- public void footer() throws IOException {
- writenl(INDENT + "};");
- writenl(INDENT + "public Object[][] getContents() {");
- writenl(INDENT_2 + "return pmHelpBundlecontents;");
- writenl(INDENT + "}");
- writenl("}");
- }
-
-
- public void setTag(String tag) throws IOException {
- theTag = new String(tag);
- }
-
- public void tag(String tag) throws IOException {
- if (tag != null) {
- writenl(NL + INDENT_2 + NOLOCALIZE);
- writenl(INDENT_2 +
- "{\"" + theTag + ".tag\", \"" + tag + "\"},");
- }
- }
-
- public void title(String title) throws IOException {
- if (title != null) {
- writenl(NL + INDENT_2 + LOCALIZE);
- writenl(INDENT_2 +
- "{\"" + theTag + ".title\", \"" + title + "\"},");
- }
- }
-
- public void seealso(String seealso) throws IOException {
- if (seealso != null) {
- writenl(NL + INDENT_2 + NOLOCALIZE);
- writenl(INDENT_2 +
- "{\"" + theTag + ".seealso\", \"" + seealso + "\"},");
- }
- }
-
- public void keywords(String keywords) throws IOException {
- if (keywords != null) {
- writenl(NL + INDENT_2 + LOCALIZE);
- writenl(INDENT_2 +
- "{\"" + theTag + ".keywords\", \"" + keywords + "\"},");
- }
- }
-
- public void content(Vector content) throws IOException {
- if (content == null)
- return;
-
- writenl(NL + INDENT_2 + LOCALIZE);
- writenl(INDENT_2 + "{\"" + theTag + ".content\",");
-
- Enumeration e = content.elements();
- while (e.hasMoreElements()) {
- String s = (String) e.nextElement();
- if (s.length() == 0) {
- if (e.hasMoreElements())
- continue;
- else {
- writenl(INDENT_2 + " \"\"\n },");
- break;
- }
- }
- String endOfLine = (e.hasMoreElements() ?
- " +" :
- "\n },");
- writenl(INDENT_2 + " \"" + s + " \"" + endOfLine);
- }
- }
-
- public void delimiter() throws IOException {
- writenl(NL);
- }
-
- public void commentStart() throws IOException {
- writenl(COMMENTBLOCK_START);
- }
-
- public void commentEnd() throws IOException {
- writenl(COMMENTBLOCK_END);
- }
-
- public void comment(String s) throws IOException {
- writenl(COMMENTLINE_START + s);
- }
-}
-
-
-
-
-class Article {
- String theTitle;
- String theKeywords;
- String theSeeAlso;
- Vector theContent;
- String theTag;
-
- Reader r;
-
- public void read(Reader theReader) {
- r = theReader;
-
- Tag theTag = null;
-
- try {
- while (true) {
- theTag = readNextTag();
- Debug.message("Article read: " + theTag);
-
- if (theTag instanceof CommentTag) {
- Debug.message("Comment ignored");
- } else if (theTag instanceof TitleTag) {
- theTitle = theTag.content;
- } else if (theTag instanceof ContentTag) {
- theContent = theTag.contentVector;
- } else if (theTag instanceof SeeAlsoTag) {
- theSeeAlso = theTag.content;
- } else if (theTag instanceof KeywordsTag) {
- theKeywords = theTag.content;
- } else {
- Debug.message("Unknown tag: " + theTag);
- }
- }
- } catch (IOException x) {
- Debug.message("Article read caught " + x);
- }
-
-
- }
-
-
- int localread() throws IOException {
- int ch = r.read();
- if (ch == -1) {
- Debug.message("localread: eof");
- throw new IOException();
- }
- // Debug.message("localread: " + ch);
- return ch;
- }
-
-
- /*
- * read the word within tagOpen/tagClose pair
- */
- String readTagName() throws IOException {
- String rv = null;
- int ch;
- StringBuffer b = new StringBuffer();
-
- while (true)
- if (localread() == HelpSyntax.tagOpen)
- break;
-
- Debug.message("readTagName: got a tagOpen");
-
- while (true) {
- ch = localread();
- if (ch == HelpSyntax.tagClose)
- break;
- else
- b.append((char) ch);
- }
-
- Debug.message("readTagName: " + (new String(b)).trim());
- return (new String(b)).trim();
- }
-
-
- Tag readNextTag() throws IOException {
- Tag rv = null;
- int ch;
- StringBuffer b;
-
- String tag = readTagName();
- Debug.message("readNextTag name: " + tag);
-
- if (tag.equalsIgnoreCase(HelpSyntax.tagTitle)) {
- rv = new TitleTag();
- rv.read(r);
- } else if (tag.equalsIgnoreCase(HelpSyntax.tagKeywords)) {
- rv = new KeywordsTag();
- rv.read(r);
- } else if (tag.equalsIgnoreCase(HelpSyntax.tagSeeAlso)) {
- rv = new SeeAlsoTag();
- rv.read(r);
- } else if (tag.equalsIgnoreCase(HelpSyntax.tagContent)) {
- rv = new ContentTag();
- rv.readMultipleLines(r);
- } else {
- Debug.message("Bad tag: " + tag);
- }
- return rv;
- }
-
-
- public String toString() {
- return new String("Title <" + theTitle +
- "> Keywords <" + theKeywords +
- "> See-Also <" + theSeeAlso +
- "> Content <" + theContent + ">");
- }
-}
-
-
-class HelpSyntax {
- public final static int tagOpen = '<';
- public final static int tagClose = '>';
- public final static String startComment = "!-";
- public final static String endComment = "--";
- public final static String tagContent = "CONTENT";
- public final static String tagTitle = "TITLE";
- public final static String tagSeeAlso = "SEEALSO";
- public final static String tagKeywords = "KEYWORDS";
-}
-
-class ParseException extends Exception {
-}
-
-class BadTagException extends ParseException {
-}
-
-class SyntaxErrorException extends ParseException {
-}
-
-abstract class Tag {
- String content;
- Vector contentVector;
- protected String name;
- protected boolean escapeQuotes = false;
-
- public Tag(String s) {
- content = s;
- }
-
- public Tag() {
- this(null);
- }
-
- public String toString() {
- return new String(this.getClass().getName() + ": " + content);
- }
-
- // respect line spacing, stuff contentVector
- public void readMultipleLines(Reader r) throws IOException {
- int ch;
- StringBuffer b = new StringBuffer();
- Vector v = new Vector();
- boolean spaced = false;
-
- while (true) {
- ch = r.read();
- if (ch == -1)
- break;
-
- if (ch == '\n') {
- v.addElement(new String(b));
- b = new StringBuffer();
- continue;
- }
-
- if (Character.isWhitespace((char) ch)) {
- if (spaced == false) {
- b.append(" ");
- spaced = true;
- }
- continue;
- }
-
- if (escapeQuotes && ch == '\"') {
- b.append("\\\"");
- continue;
- }
-
- spaced = false;
- if (ch == HelpSyntax.tagOpen) {
- boolean localspaced = false;
- boolean localopen = true;
- Debug.message("Tag: got a tagOpen");
-
- StringBuffer tmp = new StringBuffer();
- while ((ch = r.read()) != HelpSyntax.tagClose) {
- if (Character.isWhitespace((char) ch)) {
- if (localspaced == false) {
- tmp.append(" ");
- localspaced = true;
- }
- continue;
- }
- tmp.append((char) ch);
- }
-
- String t = new String(tmp);
-
- if ((t.trim()).equalsIgnoreCase("/" + this.name)) {
- Debug.message("Tag: close tag = " + t);
- break;
- } else {
- Debug.message("Tag: ignoring bad close tag = " + t);
- b.append((char) HelpSyntax.tagOpen);
- b.append(t);
- b.append((char) HelpSyntax.tagClose);
- }
- } else {
- b.append((char)ch);
- }
- }
- contentVector = v;
- Debug.message("Tag: contentVector = " + contentVector);
- }
-
- // catenate input lines, eliminating whitespace
- public void read(Reader r) throws IOException {
- int ch;
- StringBuffer b = new StringBuffer();
- boolean spaced = false;
-
- while (true) {
- ch = r.read();
- if (ch == -1)
- break;
-
- if (Character.isWhitespace((char) ch)) {
- if (spaced == false) {
- b.append(" ");
- spaced = true;
- }
- continue;
- }
-
- if (escapeQuotes && ch == '\"') {
- b.append("\\\"");
- continue;
- }
-
- spaced = false;
- if (ch == HelpSyntax.tagOpen) {
- boolean localspaced = false;
- boolean localopen = true;
- Debug.message("Tag: got a tagOpen");
-
- StringBuffer tmp = new StringBuffer();
- while ((ch = r.read()) != HelpSyntax.tagClose) {
- if (Character.isWhitespace((char) ch)) {
- if (localspaced == false) {
- tmp.append(" ");
- localspaced = true;
- }
- continue;
- }
- tmp.append((char) ch);
- }
-
- String t = new String(tmp);
-
- if ((t.trim()).equalsIgnoreCase("/" + this.name)) {
- Debug.message("Tag: close tag = " + t);
- break;
- } else {
- Debug.message("Tag: ignoring bad close tag = " + t);
- b.append((char) HelpSyntax.tagOpen);
- b.append(t);
- b.append((char) HelpSyntax.tagClose);
- }
- } else {
- b.append((char)ch);
- }
- }
- content = (new String(b)).trim();
- Debug.message("Tag: content = " + content);
- }
-}
-
-class TitleTag extends Tag {
- public TitleTag() {
- name = HelpSyntax.tagTitle;
- }
-}
-
-class SeeAlsoTag extends Tag {
- public SeeAlsoTag() {
- name = HelpSyntax.tagSeeAlso;
- }
-}
-
-class ContentTag extends Tag {
- public ContentTag() {
- name = HelpSyntax.tagContent;
- escapeQuotes = true;
- }
-}
-
-class CommentTag extends Tag {
- public CommentTag() {
- name = null;
- }
-}
-
-class KeywordsTag extends Tag {
- public KeywordsTag() {
- name = HelpSyntax.tagKeywords;
- escapeQuotes = true;
- }
-}
-
-
-
-class parseMain {
-
- static String outputFileName = "pmHelpResources.java";
- static String commentFileName = "comments.txt";
- static int firstFile = 0;
-
- // returns -1 if error, 0 otherwise
- protected static int parseArgs(String[] args) {
- int rv = 0;
- int i;
-
- for (i = 0; i < args.length; ++i) {
- if (args[i].compareTo("-d") == 0) {
- if (args[i].length() > 2) {
- outputFileName = args[i].substring(2);
- } else {
- outputFileName = args[++i];
- }
- } else if (args[i].compareTo("-c") == 0) {
- if (args[i].length() > 2) {
- commentFileName = args[i].substring(2);
- } else {
- commentFileName = args[++i];
- }
- } else if (args[i].compareTo("-v") == 0) {
- Debug.setDebugLevel(Debug.WARNING);
- } else
- break; // unknown arg ==> list of files starts
-
- }
-
- firstFile = i;
-
- /*
- * System.out.println("outputFileName = " + outputFileName +
- * " commentFileName = " + commentFileName +
- * " firstFile = " + firstFile);
- */
-
- return rv;
- }
-
-
- public static void main(String args[]) {
- FileReader f = null;
- FileWriter fw = null;
- String filename = null;
-
- Debug.setDebugLevel(Debug.ERROR);
-
- // validate command line
- if (args.length == 0) {
- System.err.println("At least one filename required.");
- System.exit(-1);
- }
-
- if (parseArgs(args) < 0)
- System.exit(-1);
-
-
- outputFileName = outputFileName.trim();
-
- Debug.warning("Writing to " + outputFileName);
-
- try {
-
- // create output file
- fw = new FileWriter(outputFileName);
- BufferedWriter w = new BufferedWriter(fw);
- ResourceWriter rw = new ResourceWriter(w);
-
- // imports and package statement
- rw.fileheader();
-
- // comment block
- File commentFile = new File(commentFileName);
- if (commentFile.exists()) {
- rw.delimiter();
- rw.commentStart();
- BufferedReader comments =
- new BufferedReader(new FileReader(commentFileName));
- String commentLine;
- while ((commentLine = comments.readLine()) != null)
- rw.comment(commentLine);
- comments.close();
- rw.commentEnd();
- rw.delimiter();
- } else {
- Debug.error("Comment file " + commentFileName +
- " not found.");
- }
-
- // create class name w/o extension or leading path
- File cf = new File(outputFileName);
- String className = cf.getName();
-
- // class name is output filename w/o extension
- int dotIndex = className.indexOf(".");
- if (dotIndex < 0)
- dotIndex = className.length();
-
- className = className.substring(0, dotIndex);
-
- // class definition
- rw.classheader(className);
-
- // iterate over input files
- for (int i = firstFile; i < args.length; ++i) {
- filename = args[i];
- Debug.warning("Reading file " + filename);
-
- try {
- f = new FileReader(filename);
- } catch (Exception x) {
- Debug.fatal(x.toString());
- return;
- }
-
- BufferedReader r = new BufferedReader(f);
-
- Article a = new Article();
- a.read(r);
- // System.out.println(a);
-
- // process the Article
-
- String tagName = filenameToTag(filename);
- Debug.warning("Creating tag " + tagName);
-
- // HTML syntax checking on content
- if (!validHTMLSyntax(a.theContent))
- throw new IOException(
- "Bad HTML syntax in article " + tagName);
-
-
- rw.setTag(tagName);
- rw.tag(tagName);
- rw.seealso(a.theSeeAlso);
- rw.title(a.theTitle);
- rw.keywords(a.theKeywords);
- rw.content(a.theContent);
- rw.delimiter();
- }
-
- rw.footer();
- rw.close();
- w.close();
- } catch (IOException x) {
- Debug.fatal(x.toString());
-
- // try to unlink the broken output file
- boolean unlink = true;
-
- try {
- fw.close();
- } catch (IOException xx) {
- Debug.error(xx.toString());
- unlink = false;
- }
-
- if (unlink) {
- File theFile = new File(outputFileName);
-
- Debug.warning("Deleting file " + outputFileName);
-
- if (theFile.exists())
- theFile.delete();
- }
-
- System.exit(-2);
- }
- }
-
-
- // return true if no syntax errors found
- static boolean validHTMLSyntax(String s) {
-
- if (s == null)
- return true;
-
- // check only for <b>..</b> pairs
-
- String src = s.toLowerCase(); // html tags are case-neutral
-
- int i;
-
- int opens = 0;
- for (i = src.indexOf("<b>");
- i != -1;
- i = src.indexOf("<b>", i + 1))
- ++opens;
-
- int closes = 0;
- for (i = src.indexOf("</b>");
- i != -1;
- i = src.indexOf("</b>", i + 1))
- ++closes;
-
- // System.out.println("syntax: " + opens + " " + closes);
-
- return opens == closes;
-
- }
-
- // return true if no syntax errors found
- static boolean validHTMLSyntax(Vector v) {
- String s = new String();
- Enumeration e = v.elements();
- while (e.hasMoreElements())
- s = s + (String) e.nextElement();
- return validHTMLSyntax(s);
- }
-
- /*
- * extract the tag name from a filename, possibly containing
- * a fully qualified path as well as a complex extension.
- */
- static String filenameToTag(String filename) {
-
- // the help tag is the filename exclusive of path or extensions
-
- File f = new File(filename);
- String s = f.getName();
- int period = s.indexOf('.');
- // System.out.println("filename: " + s);
- if (period < 0)
- period = filename.length();
- // System.out.println("period = " + period);
- return s.substring(0, period);
- }
-
-
-}
-
-class Debug {
-
- /**
- * Log a highest-priority message.
- * @param String s The message to be logged.
- */
- static public void fatal(String s) {
- printIf(s, FATAL);
- }
-
- /**
- * Log a highest-priority message.
- * @param String s The message to be logged.
- */
- static public void error(String s) {
- printIf(s, ERROR);
- }
-
- /**
- * Log a highest-priority message.
- * @param String s The message to be logged.
- */
- static public void warning(String s) {
- printIf(s, WARNING);
- }
-
- /**
- * Log a highest-priority message.
- * @param String s The message to be logged.
- */
- static public void message(String s) {
- printIf(s, MESSAGE);
- }
-
- /**
- * Log a highest-priority message.
- * @param String s The message to be logged.
- */
- static public void setDebugLevel(int lvl) {
- if (lvl < ALL || lvl > NONE)
- return;
-
- globalDebugLevel = lvl;
- }
-
- private static void printIf(String s, int lvl) {
- if (lvl < globalDebugLevel)
- return;
- DebugPrint(s);
- }
-
- // here is where we could hide syslog or file destination...
- private static void DebugPrint(String s) {
- System.out.println(s); // for now
- }
-
-
- /**
- * Verbosity level to suppress all messages.
- */
- static public final int NONE = 5;
-
- /**
- * Verbosity level to log only highest-priority messages.
- */
- static public final int FATAL = 4;
-
- /**
- * Verbosity level to log high- and highest-priority messages.
- */
- static public final int ERROR = 3;
-
- /**
- * Verbosity level to log medium-, high-, and
- * highest-priority messages.
- */
- static public final int WARNING = 2;
-
- /**
- * Verbosity level to log low-, medium-, high-, and
- * highest-priority messages.
- */
- static public final int MESSAGE = 1;
-
- /**
- * Verbosity level to log all messages.
- */
- static public final int ALL = 0;
-
- private static int globalDebugLevel = ERROR;
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/parsehelp.sh b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/parsehelp.sh
deleted file mode 100644
index b2050c4ef3..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/helptools/parsehelp.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-# Copyright (c) 1999, by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# Helper script for processing raw help files.
-# Parameters:
-# -D <classpath> appends <classpath> to $CLASSPATH
-# -J <java_dir> uses <java_dir>/bin/java. Default is /usr/java.
-# -V enable verbose runtime messages
-
-
-if [[ $# == 0 ]]; then
- echo "One or more raw help files must be specified."
- echo "Usage:"
- echo " $0 [-D classpath] [-J java_home_dir] [-V] [-C comment_file] [-d destination-file] raw-help-file [raw-help-file]"
- exit -1
-fi
-
-while getopts "D:J:C:V" opt; do
-
- case $opt in
- D) DARG=$OPTARG;;
-
- J) JARG=$OPTARG;;
-
- C) COMMENT="-c "$OPTARG;;
-
- V) VERBOSE="-v";;
-
- esac
-done
-
-shift $(($OPTIND - 1))
-
-#echo "DARG: $DARG JARG: $JARG"
-#echo "num left: " $#
-#echo "args: $*"
-
-if [[ x$JARG == x ]]; then
- # echo "Using default java"
- JAVA_HOME="/usr/java"
-else
- JAVA_HOME=$JARG
-fi
-
-DIR=$DARG
-
-
-#PATH="$JAVA_HOME/bin:/usr/bin:/usr/sbin:/sbin:.:$PATH"
-THREADS_FLAG="native"
-CLASSPATH=":.:./helptools:$DIR"
-
-# echo "Path: $PATH"
-# echo "CLASSPATH: $CLASSPATH"
-# echo "Java: $JAVA_HOME/bin/java"
-
-echo "Processing raw help files..."
-# $JAVA_HOME/bin/java -fullversion
-$JAVA_HOME/bin/java -classpath $CLASSPATH parseMain $COMMENT $VERBOSE $*
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/images/appicon.gif b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/images/appicon.gif
deleted file mode 100644
index 76918b6467..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/images/appicon.gif
+++ /dev/null
Binary files differ
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAboutBox.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAboutBox.java
deleted file mode 100644
index fe840bc5af..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAboutBox.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmAboutBox.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.border.*;
-
-import com.sun.admin.pm.server.*;
-
-
-public class pmAboutBox extends pmFrame {
- public pmButton cancel = null;
- String title = pmUtility.getResource("About.Solaris.Print.Manager");
- String copyright = new String(pmUtility.getResource("info_copyright1")
- + pmUtility.getCopyrightResource("copyright_year")
- + pmUtility.getResource("info_copyright2"));
- String version = pmUtility.getResource("info_version");
- String appname = pmUtility.getResource("info_name");
- String contents = new String(appname + "\n" +
- version + "\n\n" +
- copyright + "\n");
-
- public pmAboutBox() {
-
- super(pmUtility.getResource("About.Solaris.Print.Manager"));
-
- cancel = new pmButton(pmUtility.getResource("Cancel"));
- cancel.setMnemonic(pmUtility.getIntResource("Cancel.mnemonic"));
- cancel.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- hideAboutBox();
- }
- });
-
- // Create a regular text field.
- JTextArea textArea = new JTextArea(contents);
- Font f = new pmJTextField().getFont();
- Font fb = new Font(f.getName(), f.PLAIN, f.getSize());
- textArea.setOpaque(false);
- textArea.setFont(fb);
- textArea.setLineWrap(true);
- textArea.setWrapStyleWord(true);
- textArea.setEditable(false);
- textArea.setDisabledTextColor(Color.blue);
-
- JPanel j1 = new JPanel();
- j1.setBorder(new EmptyBorder(10, 10, 10, 10));
- j1.setLayout(new BorderLayout());
- JScrollPane areaScrollPane = new JScrollPane(textArea);
- areaScrollPane.setPreferredSize(new Dimension(270, 175));
- j1.add(areaScrollPane, BorderLayout.CENTER);
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.setBorder(new EmptyBorder(0, 0, 10, 10));
- buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
- buttonPanel.add(cancel);
-
- JPanel bottomPanel = new JPanel(new BorderLayout());
- bottomPanel.add(buttonPanel, BorderLayout.SOUTH);
-
- Container contentPane = getContentPane();
- contentPane.add(j1, BorderLayout.CENTER);
- contentPane.add(bottomPanel, BorderLayout.SOUTH);
-
- // default button is cancel
- cancel.setAsDefaultButton();
-
- // handle Esc as cancel
- getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("HELP: cancel action");
- hideAboutBox();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- pack();
- repaint();
-
- }
-
- public void hideAboutBox() {
- this.setVisible(false);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAccess.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAccess.java
deleted file mode 100644
index 13b4c42bf4..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAccess.java
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Comment which describes the contents of this file.
- *
- * pmAccess.java
- * Add Access To Printer handling
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import java.util.Vector;
-import javax.swing.JPanel;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-/*
- * Window for Edit -> Add Access to a Printer
- */
-
-public class pmAccess extends pmButtonScreen {
- JComboBox portCombo;
- pmFrame frame = new pmFrame(
- pmUtility.getResource("SPM:Add.Access.To.Printer"));
- pmTextField pnameText;
- pmTextField snameText;
- pmTextField descText;
- Boolean makedefault;
- JCheckBox defaultp;
- Printer newpr = null;
- pmTop mytop;
- String printer = null;
- String server = null;
-
- String cmdLog = null;
- String errorLog = null;
- String warnLog = null;
-
-
- final static int OK = 1;
- final static int APPLY = 2;
- final static int RESET = 3;
- final static int CANCEL = 4;
- final static int HELP = 5;
-
- public pmAccess(pmTop mytop) {
-
- // ensure that pmButton hashtable gets cleaned up
- frame.setClearButtonsOnClose(true);
-
- setLayout(new BorderLayout());
-
- this.mytop = mytop;
-
- // Build the Frame
- centerPanel();
- southPanel();
-
- /*
- * let's try doing this in Show...
- *
- * // default button is always OK, for now...
- * frame.getRootPane().setDefaultButton(okButton);
- *
- * okButton.setAsDefaultButton();
- */
-
- // handle Esc as cancel
- this.registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- actioncancelButton();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- // enable the pmFrame to set focus to our default comp on activation
- frame.setDefaultComponent(pnameText);
-
-
- // following is test code, I think...
- Component glass = frame.getGlassPane();
-
- glass.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent k) {
- Debug.info("Glass: " + k);
- }
- public void keyReleased(KeyEvent k) {
- Debug.info("Glass: " + k);
- }
- public void keyTyped(KeyEvent k) {
- Debug.info("Glass: " + k);
- }
- });
-
- }
-
- public void centerPanel() {
- // Build center panel
- JPanel center = new JPanel();
- center.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- // define center constraints
- c.insets = new Insets(8, 5, 5, 5);
- c.gridheight = 1;
- c.gridwidth = 1;
-
- // build center components
- // Create
- c.gridx = 0;
- c.weightx = c.weighty = 0.0;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
-
- // Build the labels
- c.gridy = 0;
- center.add(new JLabel
- (pmUtility.getResource("Printer.Name:")), c);
- c.gridy = 1;
- center.add(new JLabel
- (pmUtility.getResource("Printer.Server:")), c);
- c.gridy = 2;
- center.add(new JLabel
- (pmUtility.getResource("Description:")), c);
- c.gridy = 3;
- center.add(new JLabel
- (pmUtility.getResource("Option:")), c);
-
- // Build the text fields
- // Common constraints
- c.gridx = 1;
- c.ipadx = 15;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.WEST;
- c.weightx = c.weighty = 1.0;
-
- c.gridy = 0;
- pnameText = new pmTextField(14);
-
- center.add(pnameText, c);
-
- c.gridy = 1;
- snameText = new pmTextField(25);
- center.add(snameText, c);
-
- c.gridy = 2;
- descText = new pmTextField(25);
- center.add(descText, c);
-
- // Add Choice Menus - ComboBox
- c.weightx = c.weighty = 0.0;
- c.gridy = 3;
-
- defaultp = new JCheckBox(
- pmUtility.getResource("Default.Printer"));
- center.add(defaultp, c);
-
- add("Center", center);
- }
-
- public void createAccess() throws pmGuiException {
- boolean getHostOk = true;
- String description = "";
-
- newpr = new Printer(mytop.ns);
- Debug.message("CLNT: createAccess()");
- pmCalls.debugShowPrinter(newpr);
- printer = pnameText.getText().trim();
- server = snameText.getText().trim();
- description = descText.getText();
-
- if (printer.equals("")) {
- pnameText.requestFocus();
- Debug.message("CLNT:pmAccess:Printer name required.");
- throw new pmIncompleteFormException(
- pmUtility.getResource("Printer.name.required."));
- }
-
- if (!Valid.remotePrinterName(printer)) {
- pnameText.requestFocus();
- Debug.message("CLNT:pmAccess:Printer name invalid: " + printer);
- throw new pmIncompleteFormException(
- pmUtility.getResource("Printer.name.invalid."));
- }
-
- if (server.equals("")) {
- snameText.requestFocus();
- Debug.message("CLNT:pmAccess:Server name required.");
- throw new pmIncompleteFormException(
- pmUtility.getResource("Server.name.required."));
- }
-
- if (!Valid.serverName(server)) {
- snameText.requestFocus();
- Debug.message("CLNT:pmAccess:Server name invalid.");
- throw new pmIncompleteFormException(
- pmUtility.getResource("Server.name.invalid."));
- }
-
- try {
- if (server.equals(mytop.host.getLocalHostName()) ||
- server.equals("localhost")) {
- snameText.requestFocus();
- getHostOk = false;
- }
- } catch (Exception e) {
- Debug.warning(
- "CLNT: pmAccess:createAccess:getLocalHostName exception");
- throw new pmGuiException(
- pmUtility.getResource(
- "Could.not.get.local.hostname " + e));
- }
-
- if (!getHostOk) {
- Debug.warning(
- "CLNT: pmAccess:createAccess:Server name required.");
- throw new pmMustBeRemoteServerException(
- pmUtility.getResource("Server.name.required."));
- }
-
- boolean exist;
- try {
- exist = PrinterUtil.exists(printer, mytop.ns);
- } catch (Exception e) {
- throw new pmGuiException(e.toString());
- }
-
- if (exist) {
- throw new pmPrinterExistsException();
- }
-
- if (mytop.ns.getNameService().equals("nis") == true ||
- mytop.ns.getNameService().equals("ldap") == true) {
- try {
- if (!mytop.ns.isAuth()) {
- pmUtility.doLogin(mytop, frame);
- }
- } catch (pmUserCancelledException e) {
- Debug.message("CLNT:pmAccess:user cancelled login");
- throw new pmUserCancelledException(
- pmUtility.getResource(
- "User.cancelled.login."));
- } catch (pmGuiException e) {
- Debug.message(
- "CLNT:pmAccess:login nis/ldap failed: " + e);
- throw new pmLoginFailedException();
- } catch (Exception e) {
- Debug.message(
- "CLNT:pmAccess:login nis/ldap failed: " + e);
- throw new pmLoginFailedException();
- }
- }
-
- Debug.message("CLNT:pmAccess:checkbox: " + defaultp.isSelected());
-
- // Check for confirmation option
- if (((mytop.getConfirmOption() == true) && (confirmAction() == true))
- || (mytop.getConfirmOption() == false)) {
-
- // Set the printer attributes
- newpr.setPrinterName(printer);
- newpr.setPrintServer(server);
- newpr.setComment(description);
- if (defaultp.isSelected())
- newpr.setIsDefaultPrinter(true);
-
- frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
- boolean failed = false;
- try {
- newpr.addRemotePrinter();
- } catch (Exception e) {
- failed = true;
- Debug.warning(
- "CLNT:pmAccess:addRemotePrinter caught:" + e);
- }
-
- frame.setCursor(Cursor.getDefaultCursor());
-
- gatherLogs();
- dumpLogs("CLNT:pmAccess:createAccess()");
-
- pmCalls.debugShowPrinter(newpr);
-
- mytop.setLogData(cmdLog, errorLog, warnLog);
- mytop.showLogData(
- pmUtility.getResource("Add.Access.To.Printer"));
-
- mytop.pmsetPrinterList();
- mytop.clearSelected();
- mytop.listTable.clearSelection();
-
- if (failed)
- throw new pmAddAccessFailedException(errorLog);
-
- }
- }
-
- public void clearAccessInput() {
- try {
- pnameText.setText("");
- snameText.setText("");
- descText.setText("");
- if (defaultp.isSelected())
- defaultp.doClick();
- } catch (Exception e) {
- // ignore???
- // throw new pmGuiException("pmAccess: Error clearAccessInput: " + e);
- Debug.warning("CLNT:pmAccess: Error clearAccessInput: " + e);
- }
- }
-
-
-
- public boolean confirmAction() {
- if (mytop.getConfirmOption() == true) {
- pmOKCancelDialog d = new pmOKCancelDialog(frame,
- pmUtility.getResource("Action.Confirmation"),
- pmUtility.getResource(
- "Continue.creating.access.for.this.printer?"));
- d.setVisible(true);
- if (d.getValue() != JOptionPane.OK_OPTION) {
- pmMessageDialog m = new pmMessageDialog(frame,
- pmUtility.getResource("Warning"),
- pmUtility.getResource("Operation.Cancelled"));
- m.setVisible(true);
- return false;
- }
- }
- return true;
- }
-
- void gatherLogs() {
- cmdLog = newpr.getCmdLog();
- errorLog = newpr.getErrorLog();
- warnLog = newpr.getWarnLog();
- }
-
-
- void dumpLogs(String who) {
- Debug.message(who);
- Debug.message(who + " command: " + cmdLog);
- Debug.message(who + " warnings: " + warnLog);
- Debug.message(who + " errors: " + errorLog);
- }
-
- // returns true if success, false otherwise
- boolean doAction() {
- boolean rv = false;
-
- try {
- createAccess();
- rv = true; // only if it didn't throw!
- } catch (pmIncompleteFormException ix) {
- Debug.warning(
- "CLNT:pmAccess:incomplete form " + ix.getMessage());
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- ix.getMessage(),
- mytop,
- "AddAccessFailed");
- m.setVisible(true);
- } catch (pmPrinterExistsException ex) {
- Debug.warning("CLNT:pmAccess:printer exists");
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource("The.specified.printer.already.exists."));
- m.setVisible(true);
- } catch (pmMustBeRemoteServerException rx) {
- Debug.warning("CLNT:pmAccess:server must be remove.");
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "The.server.must.be.a.remote.server."),
- mytop,
- "RemoteServer");
- m.setVisible(true);
-
- } catch (pmLoginFailedException lx) {
- Debug.warning("CLNT:pmAccess:Required login failed");
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource("Required.login.failed."),
- mytop,
- "LoginFailed");
- m.setVisible(true);
-
- } catch (pmAddAccessFailedException ax) {
- Debug.warning(
- "CLNT:pmAccess:add access failed " + ax.getMessage());
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- ax.getMessage(),
- mytop,
- "AddAccessFailed");
- m.setVisible(true);
-
- } catch (pmUserCancelledException cx) {
- Debug.message(
- "CLNT:pmAccess:createAccess: User cancelled namespace login");
- } catch (pmGuiException gx) {
- Debug.warning(
- "CLNT:pmAccess:Application Error" + gx.getMessage());
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Application.Error"),
- gx.getMessage());
- m.setVisible(true);
-
- } finally {
- // clearAccessInput();
- }
- return rv;
- }
-
-
- public void pmScreendispose() {
- frame.dispose();
- }
-
- public void actionokButton() {
- Debug.message("CLNT:pmAccess:actionokButton()");
-
- if (doAction() == true) {
- clearAccessInput();
- mytop.pmsetdefaultpLabel();
- frame.setVisible(false);
- frame.repaint();
- // frame.dispose();
- mytop.scrollPane.revalidate();
- mytop.scrollPane.repaint();
- } else {
- Debug.message("CLNT: pmAccess: doAction is false");
- }
-
- }
-
- public void actionapplyButton() {
- Debug.message("CLNT:pmAccess:actionapplyButton()");
-
- if (doAction() == true) {
- mytop.pmsetdefaultpLabel();
- mytop.scrollPane.revalidate();
- mytop.scrollPane.repaint();
-
- }
- }
-
-
- public void actionresetButton() {
- Debug.message("CLNT:pmAccess:actionresetButton()");
- clearAccessInput();
- pnameText.requestFocus();
- }
-
- public void actioncancelButton() {
- Debug.message("CLNT:pmAccess:actioncancelButton()");
- clearAccessInput();
- frame.setVisible(false);
- frame.repaint();
- // frame.dispose();
- }
-
- public void actionhelpButton() {
- Debug.message("CLNT:pmAccess:actionhelpButton()");
- mytop.showHelpItem("AddAccess");
- }
-
-
- public void Show() {
-
- frame.getContentPane().add("North", this);
- frame.pack();
- frame.setVisible(true);
- frame.repaint();
-
- frame.toFront();
- frame.requestFocus();
-
- okButton.setAsDefaultButton();
- pnameText.requestFocus();
- Debug.message("CLNT:pmAccess:Show()");
-
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAddAccessFailedException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAddAccessFailedException.java
deleted file mode 100644
index 40899aaf91..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAddAccessFailedException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmAddAccessFailedException.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-class pmAddAccessFailedException extends pmGuiException {
- public pmAddAccessFailedException(String s) {
- super(s);
- }
- public pmAddAccessFailedException() {
- super();
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAuthOptions.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAuthOptions.java
deleted file mode 100644
index 456fd87850..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmAuthOptions.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmAuthOptions.java
- * Prompt for root password from printmgr.
- * This a helper for printmgr which echoes YES, NO, or CANCEL to stdout.
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import javax.swing.*;
-import com.sun.admin.pm.server.*;
-
-
-public class pmAuthOptions {
-
- public static void main(String[] args) {
-
- boolean done = false;
- String rv = "CANCEL";
-
- pmAuthMessage o = new pmAuthMessage(null,
- pmUtility.getResource("Authentication.required"),
- pmUtility.getResource("Root.access.is.required"));
- o.setVisible(true);
- switch (o.getValue()) {
- case JOptionPane.YES_OPTION:
- break;
-
- case JOptionPane.NO_OPTION:
- System.out.println("NO");
- System.exit(0);
- break;
-
- case JOptionPane.CANCEL_OPTION:
- default:
- System.out.println("CANCEL");
- System.exit(0);
- break;
- }
-
- while (!done) {
- pmAuthLogin d = new pmAuthLogin(null,
- pmUtility.getResource("Root.authentication"),
- pmUtility.getResource("Enter.root.password"));
- d.setVisible(true);
- if (d.getValue() != JOptionPane.OK_OPTION)
- done = true;
- else {
- boolean ok = false;
- String pw = new String(d.getPassword());
- try {
- PrinterUtil.checkRootPasswd(pw);
- ok = true;
- } catch (Exception x) {
-
- }
- if (!ok) {
- pmOKCancelDialog m = new pmOKCancelDialog(null,
- pmUtility.getResource("Error"),
- pmUtility.getResource("Invalid.password"));
- m.setVisible(true);
- if (m.getValue() != JOptionPane.OK_OPTION)
- done = true;
- } else {
- done = true;
- rv = "YES";
- }
- }
- }
-
- System.out.println(rv);
- System.exit(0);
- }
-
-
-}
-
-
-/*
- */
-
-class pmAuthLogin extends pmDialog {
- private String theTag = null;
-
- protected pmButton okButton = null;
- protected pmButton cancelButton = null;
-
- public pmAuthLogin(JFrame f, String title, String msg) {
-
- super(f, title, true); // modal
-
- JLabel l;
- JPanel p;
-
- // initialize constraints
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridwidth = 1;
- c.gridheight = 1;
- c.insets = new Insets(10, 10, 10, 10);
- c.anchor = GridBagConstraints.EAST;
-
- // top panel contains the desired message
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- l = new JLabel(msg, SwingConstants.CENTER);
- p.add(l, c);
- this.getContentPane().add(p, "North");
-
-
- // middle panel contains username and password
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- l = new JLabel(pmUtility.getResource("Hostname:"),
- SwingConstants.RIGHT);
- p.add(l, c);
-
- l = new JLabel(pmUtility.getResource("Password:"),
- SwingConstants.RIGHT);
- p.add(l, c);
-
- passwordField = new JPasswordField(12);
- passwordField.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- okPressed();
- }
- });
- l.setLabelFor(passwordField);
-
- // for consistency, don't implement this until all are...
- // l.setDisplayedMnemonic(
- // pmUtility.getIntResource("Password.mnemonic"));
-
- c.gridx = 1;
- c.weightx = 1.0;
-
- c.anchor = GridBagConstraints.WEST;
-
- String hostname = null;
- try {
- hostname = (java.net.InetAddress.getLocalHost()).getHostName();
- } catch (java.net.UnknownHostException uhx) {
- System.out.println(uhx);
- }
-
- l = new JLabel(hostname, SwingConstants.LEFT);
- p.add(l, c);
-
-
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
- c.gridy = GridBagConstraints.RELATIVE;
-
- p.add(passwordField, c);
- passwordField.setEchoChar('*');
-
- this.getContentPane().add(p, "Center");
-
- // bottom panel contains buttons
- c.gridx = 0;
- c.weightx = 1.0;
- c.weighty = 0.0;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
-
- JPanel thePanel = new JPanel();
-
- okButton = new pmButton(
- pmUtility.getResource("OK"));
- okButton.setMnemonic(
- pmUtility.getIntResource("OK.mnemonic"));
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- okPressed();
- }
- });
- thePanel.add(okButton, c);
-
- cancelButton = new pmButton(
- pmUtility.getResource("Cancel"));
- cancelButton.setMnemonic(
- pmUtility.getIntResource("Cancel.mnemonic"));
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- cancelPressed();
- }
- });
- thePanel.add(cancelButton, c);
-
- this.getContentPane().add(thePanel, "South");
-
- addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- returnValue = JOptionPane.CANCEL_OPTION;
- setVisible(false);
- }
- });
-
- // handle Esc as cancel in any case
- this.getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- cancelPressed();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- // lay out the dialog
- this.pack();
-
- // set focus and defaults after packing...
- // this.getRootPane().setDefaultButton(okButton);
- okButton.setAsDefaultButton();
-
- passwordField.requestFocus();
- }
-
- public int getValue() {
- return returnValue;
- }
-
-
- public void okPressed() {
- returnValue = JOptionPane.OK_OPTION;
- setVisible(false);
- }
-
- public void cancelPressed() {
- returnValue = JOptionPane.CANCEL_OPTION;
- setVisible(false);
- }
-
-
- public void clearPressed() {
- passwordField.setText("");
- }
-
- public char[] getPassword() {
- return passwordField.getPassword();
- }
-
-
- public JPasswordField passwordField = null;
-
- protected int returnValue = JOptionPane.CANCEL_OPTION;
-
-}
-
-
-class pmAuthMessage extends pmDialog {
- private String theTag = null;
-
- protected pmButton authButton = null;
- protected pmButton cancelButton = null;
- protected pmButton contButton = null;
-
- public pmAuthMessage(JFrame f, String title, String msg) {
-
- super(f, title, true); // modal
-
- JPanel p;
-
- // initialize constraints
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridwidth = 1;
- c.gridheight = 1;
- c.insets = new Insets(10, 10, 10, 10);
- c.anchor = GridBagConstraints.EAST;
-
- // top panel contains the desired message
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
-
- JList l = new JList() {
- public boolean isFocusable() {
- return false;
- }
- };
- // pathetic hacks to make the list look the same as a label
- JLabel tmp = new JLabel();
- l.setBackground(tmp.getBackground());
- l.setForeground(tmp.getForeground());
- l.setFont(tmp.getFont());
- tmp = null;
- Vector v = new Vector();
- if (msg != null) {
- StringTokenizer st = new StringTokenizer(msg, "\n", false);
- try {
- while (st.hasMoreTokens())
- v.addElement(st.nextToken());
- } catch (Exception x) {
- }
- l.setListData(v);
- }
-
-
- p.add(l, c);
- this.getContentPane().add(p, "North");
-
-
- // bottom panel contains buttons
- c.gridx = 0;
- c.weightx = 1.0;
- c.weighty = 0.0;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
-
- JPanel thePanel = new JPanel();
-
- authButton = new pmButton(pmUtility.getResource("Authenticate"));
- authButton.setMnemonic(
- pmUtility.getIntResource("Authenticate.mnemonic"));
- authButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- authPressed();
- }
- });
- thePanel.add(authButton, c);
-
- contButton = new pmButton(pmUtility.getResource("Continue"));
- contButton.setMnemonic(pmUtility.getIntResource("Continue.mnemonic"));
- contButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- contPressed();
- }
- });
- thePanel.add(contButton, c);
-
- cancelButton = new pmButton(pmUtility.getResource("Cancel"));
- cancelButton.setMnemonic(pmUtility.getIntResource("Cancel.mnemonic"));
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- cancelPressed();
- }
- });
- thePanel.add(cancelButton, c);
-
- this.getContentPane().add(thePanel, "South");
-
- addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- returnValue = JOptionPane.CANCEL_OPTION;
- setVisible(false);
- }
- });
-
- // handle Esc as cancel in any case
- this.getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- cancelPressed();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- // lay out the dialog
- this.pack();
-
- // set focus and defaults after packing...
- authButton.setAsDefaultButton();
-
- }
-
- public int getValue() {
- return returnValue;
- }
-
-
- public void authPressed() {
- returnValue = JOptionPane.YES_OPTION;
- setVisible(false);
- }
-
- public void cancelPressed() {
- returnValue = JOptionPane.CANCEL_OPTION;
- setVisible(false);
- }
-
-
- public void contPressed() {
- returnValue = JOptionPane.NO_OPTION;
- setVisible(false);
- }
-
- protected int returnValue = JOptionPane.CANCEL_OPTION;
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmButton.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmButton.java
deleted file mode 100644
index 1c14c5642e..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmButton.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmButton.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-/*
- * strategy:
- * Keep a hashtable of root panes and their associated default buttons.
- * Note that there is at present no way to remove a root pane entry
- * from the table...
- *
- * Ideally there should be an interface to allow objects to
- * remove themselves before disappearing.
- */
-
-public class pmButton extends JButton {
-
- // static JButton defaultButton = null;
-
- // map root panes to their true default buttons
- static Hashtable map = new Hashtable();
-
- public static Hashtable getHashtable() {
- return map;
- }
-
- /*
- * make this button the default on this root pane
- * retunrs true if success, false o/w
- */
- boolean makeDefaultButton() {
- return makeDefaultButton(this);
- }
-
- /*
- * make b the default on this root pane
- * returns true if success, false otherwise
- */
- boolean makeDefaultButton(JButton b) {
- JRootPane r = this.getRootPane();
-
- if (r == null) {
- Debug.info("BUTTON: null root panel");
- return false;
- }
-
- if (b == null) {
- Debug.info("BUTTON: makeDefaultButton null on " + r);
- }
-
- /*
- * Debug.info("\nBUTTON: makeDefaultButton " +
- * (b == null ? "null" : b.getText()) +
- * " on " + r + "\n");
- */
-
- if (b != null && b.isDefaultCapable() == false) {
- Debug.info("BUTTON: false isDefaultCapable on " + r);
- return false;
- }
-
- // unfocus the old default, if it's different
- JButton oldb;
- if ((oldb = r.getDefaultButton()) != null && oldb != b) {
- oldb.setFocusPainted(false);
- }
-
- /*
- * Debug.info("\nBUTTON: makeDefaultButton: old button was " +
- * (oldb == null ? "null" : oldb.getText()) + "\n");
- */
-
- r.setDefaultButton(b);
-
- return true;
- }
-
-
- public pmButton(String s) {
- super(s);
-
- this.addFocusListener(new FocusAdapter() {
-
- // upon gaining focus: make this the root pane's default
- public void focusGained(FocusEvent e) {
- if (e.isTemporary()) {
- /*
- * Debug.info("BUTTON: " + getText() +
- * " gained temp - ignoring");
- */
- return;
- }
-
- Debug.info("BUTTON: " + getText() + " gained");
-
- if (makeDefaultButton())
- setFocusPainted(true);
-
- }
-
- // upon losing focus: make 'true' default the default
- public void focusLost(FocusEvent e) {
- if (e.isTemporary()) {
- /*
- * Debug.info("BUTTON: " + getText() +
- * " lost temp - ignoring");
- */
- return;
- }
-
- Debug.info("BUTTON: " + getText() + " lost");
-
- /*
- * i thought it might make sense to test for the
- * next focusable comp, but what if focus is being
- * lost as the result of a mouse click??
- */
-
- makeDefaultButton((JButton) map.get(getRootPane()));
- // setFocusPainted(false);
- }
-
- });
- }
-
- // make this the true default for this root pane
- void setAsDefaultButton() {
- setAsDefaultButton(this);
- }
-
- // make b the true default for this root pane
- void setAsDefaultButton(JButton b) {
- JRootPane r = getRootPane();
-
- /*
- * Debug.message("BUTTON: setAsDefaultButton " +
- * (b == null ? "null" : b.getText()) +
- * " root = " + r);
- */
-
- // setting default to null removes state
- if (b == null)
- map.remove(r);
- else
- map.put(r, b); // creates a new entry if needed
- makeDefaultButton(b);
- }
-
-
- // clean up component about to be removed
- void unreference() {
- JRootPane r = getRootPane();
- map.remove(r);
- }
-
- public static void unreference(JComponent c) {
- JRootPane r = c.getRootPane();
- map.remove(r);
- }
-
- public static void unreference(JRootPane r) {
- map.remove(r);
- }
-
-
- static boolean enableMnemonics = false;
-
- static void setEnableMnemonics(boolean m) {
- enableMnemonics = m;
- }
-
- public void setMnemonic(int mnemonic) {
- setMnemonic((char)mnemonic);
- }
-
- public void setMnemonic(char mnemonic) {
- if (enableMnemonics)
- super.setMnemonic(mnemonic);
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmButtonScreen.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmButtonScreen.java
deleted file mode 100644
index de18335be2..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmButtonScreen.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmButtonsScreen.java
- * Common dialog superclass
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.JPanel;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-/*
- * Screen class for JPanels
- */
-
-public class pmButtonScreen extends JPanel {
-
- final static int OK = 1;
- final static int APPLY = 2;
- final static int RESET = 3;
- final static int CANCEL = 4;
- final static int HELP = 5;
-
- pmButton okButton;
- pmButton applyButton;
- pmButton resetButton;
- pmButton cancelButton;
- pmButton helpButton;
-
-
- public void southPanel() {
-
- JPanel south = new JPanel();
-
- south.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.gridheight = 1;
- c.gridwidth = 1;
- c.weightx = c.weighty = 0.0;
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridy = 0;
-
- okButton = new pmButton(
- pmUtility.getResource("OK"));
- okButton.setMnemonic(
- pmUtility.getIntResource("OK.mnemonic"));
-
- applyButton = new pmButton(
- pmUtility.getResource("Apply"));
- applyButton.setMnemonic(
- pmUtility.getIntResource("Apply.mnemonic"));
-
- resetButton = new pmButton(
- pmUtility.getResource("Reset"));
- resetButton.setMnemonic(
- pmUtility.getIntResource("Reset.mnemonic"));
-
- cancelButton = new pmButton(
- pmUtility.getResource("Cancel"));
- cancelButton.setMnemonic(
- pmUtility.getIntResource("Cancel.mnemonic"));
-
- helpButton = new pmButton(
- pmUtility.getResource("Help"));
- helpButton.setMnemonic(
- pmUtility.getIntResource("Help.mnemonic"));
-
- okButton.addActionListener(new ButtonListener(OK));
- applyButton.addActionListener(new ButtonListener(APPLY));
- resetButton.addActionListener(new ButtonListener(RESET));
- cancelButton.addActionListener(new ButtonListener(CANCEL));
- helpButton.addActionListener(new ButtonListener(HELP));
-
- c.insets = new Insets(15, 5, 10, 5);
- c.gridx = 0;
- south.add(okButton, c);
- c.gridx = 1;
- south.add(applyButton, c);
- c.gridx = 2;
- south.add(resetButton, c);
- c.gridx = 3;
- south.add(cancelButton, c);
- c.gridx = 4;
- south.add(helpButton, c);
-
- add("South", south);
- }
-
- class ButtonListener implements ActionListener {
- int activeButton;
-
- // Constructor
-
- public ButtonListener(int aButton)
- {
- activeButton = aButton;
- }
-
- public void actionPerformed(ActionEvent e)
- {
- switch (activeButton) {
- case OK:
- actionokButton();
- break;
- case APPLY:
- actionapplyButton();
- break;
- case RESET:
- actionresetButton();
- break;
- case CANCEL:
- actioncancelButton();
- break;
- case HELP:
- actionhelpButton();
- break;
- }
- }
- }
-
- public void actionokButton()
- {
- }
-
- public void actionapplyButton()
- {
- }
-
- public void actionresetButton()
- {
- }
-
- public void actioncancelButton()
- {
- }
-
- public void actionhelpButton()
- {
- }
-
-
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmCacheMissingPPDException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmCacheMissingPPDException.java
deleted file mode 100644
index 4a2b171f68..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmCacheMissingPPDException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmInstallPrinter.java
- * Install and Modify Printer implementation
- *
- * pmCacheMissingPPDException
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-public class pmCacheMissingPPDException extends pmGuiException {
- public pmCacheMissingPPDException(String s) {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmCalls.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmCalls.java
deleted file mode 100644
index 5503d90a97..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmCalls.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmCalls.java
- * Debug messages
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.applet.*;
-import java.io.*;
-import java.util.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-/*
- * Class of calls to backend
- */
-
-public class pmCalls {
-
-/*
- * Debugging routines
- */
-
- public static void testout(String out) {
- Debug.info(out);
- }
-
- public static void debugShowPrinter(Printer p) {
- Debug.info("CLNT: debugShowPrinter");
-
- if (p.getPrinterName() != null) {
- Debug.info("CLNT: printer " +
- p.getPrinterName());
- }
-
- if (p.getPrintServer() != null)
- Debug.info("CLNT: server " +
- p.getPrintServer());
-
- if (p.getPrinterType() != null)
- Debug.info("CLNT: printer type " +
- p.getPrinterType());
-
- if (p.getComment() != null)
- Debug.info("CLNT: Comment " +
- p.getComment());
-
- if (p.getDevice() != null)
- Debug.info("CLNT: Device " +
- p.getDevice());
-
- if (p.getMake() != null)
- Debug.info("CLNT: Make " +
- p.getMake());
- else
- Debug.info("CLNT: Make is null");
-
- if (p.getModel() != null)
- Debug.info("CLNT: Model " +
- p.getModel());
- else
- Debug.info("CLNT: Model is null");
-
- if (p.getPPD() != null)
- Debug.info("CLNT: PPD " +
- p.getPPD());
- else
- Debug.info("CLNT: PPD is null");
-
- if (p.getNotify() != null)
- Debug.info("CLNT: Notify " +
- p.getNotify());
-
- if (p.getBanner() != null)
- Debug.info("CLNT: Banner " + p.getBanner());
-
- if (p.getProtocol() != null)
- Debug.info("CLNT: Protocol " +
- p.getProtocol());
-
- if (p.getDestination() != null)
- Debug.info("CLNT: Destination " +
- p.getDestination());
-
- if (p.getFileContents() != null) {
-
- String filedata[] = p.getFileContents();
- String filecontents = new String();
-
- Debug.info("CLNT: File Contents: ");
-
- if (filedata != null) {
- for (int i = 0; i < filedata.length; i++) {
- Debug.info(" " + filedata[i]);
- }
- }
- }
-
- if (p.getNotify() != null) {
- Debug.info("CLNT: Fault Notification: " + p.getNotify());
- }
-
- String ua[] = p.getUserAllowList();
- Debug.info("CLNT: UserAllowList ");
- if (ua != null) {
- for (int i = 0; i < ua.length; i++) {
- Debug.info(" " + ua[i]);
- }
- }
-
- Debug.info("CLNT: getIsDefaultPrinter is " + p.getIsDefaultPrinter());
-
- }
-
- public static void debugshowPrinterList(NameService ns) {
-
- String[] list;
-
- try {
- list = PrinterUtil.getPrinterList(ns);
- for (int i = 0; i < list.length; i++)
- Debug.info("CLNT: " + list[i]);
- } catch (Exception e) {
- Debug.info("CLNT: debugshowPrinterList(): exception " + e);
- }
-
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDelete.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDelete.java
deleted file mode 100644
index 4e138209b8..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDelete.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmDelete.java
- * Delete Printer implementation
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.JPanel;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-/*
- * Window for Edit -> Delete
- */
-
-// public class pmDelete extends JPanel {
-public class pmDelete {
-
- Printer newpr = null;
- pmTop mytop = null;
-
- public pmDelete(pmTop mytop)
- {
- this.mytop = mytop;
- newpr = new Printer(mytop.ns);
-
- Debug.message("CLNT: pmDelete");
-
- if (mytop.selectedPrinter.equals("")) {
- Debug.warning("CLNT: pmDelete:error: selectedPrinter empty");
- // Display error window
- actioncancelButton();
- }
-
- pmOKCancelDialog d = new pmOKCancelDialog(
- mytop.parentFrame,
- pmUtility.getResource("SPM:Delete.Printer"),
- pmUtility.getResource("Please.confirm.deletion.of.printer") +
- mytop.selectedPrinter, false);
- d.setVisible(true);
-
- if (d.getValue() != JOptionPane.OK_OPTION)
- actioncancelButton();
- else {
- try {
- actionokButton();
- } catch (pmUserCancelledException ce) {
- Debug.message("CLNT: pmDelete:okButton: Login cancelled");
- } catch (pmLoginFailedException de) {
- pmMessageDialog m = new pmMessageDialog(
- mytop.parentFrame,
- pmUtility.getResource("Error"),
- pmUtility.getResource("Required.login.failed."),
- mytop,
- "LoginFailed");
- m.setVisible(true);
- } catch (pmGuiException ge) {
- pmMessageDialog m = new pmMessageDialog(
- mytop.parentFrame,
- pmUtility.getResource("Application.Error"),
- ge.toString());
- m.setVisible(true);
- }
- }
-
- }
-
- public void actionokButton() throws pmGuiException {
- int ret;
- String cmd = null;
- String warn = null;
- String err = null;
-
- Debug.message("CLNT: pmDelete actionokButton()");
-
- // handle authentication if needed
- if (mytop.ns.getNameService().equals("nis") == true ||
- mytop.ns.getNameService().equals("ldap") == true) {
- try {
- if (!mytop.ns.isAuth()) {
- pmUtility.doLogin(mytop, mytop.parentFrame);
- }
- } catch (pmUserCancelledException e) {
- Debug.message("CLNT: pmDelete:User cancelled login");
- throw new pmUserCancelledException(
- pmUtility.getResource("User.Cancelled.Login"));
- } catch (pmGuiException e) {
- Debug.warning("CLNT: pmDelete:login for nis/ldap failed");
- throw new pmLoginFailedException(
- pmUtility.getResource("Login.Authorization.Failed"));
- } catch (Exception e) {
- Debug.warning("CLNT: pmDelete:login for nis/ldap failed");
- throw new pmLoginFailedException(
- pmUtility.getResource("Login.Authorization.Failed"));
- }
- }
-
- newpr.setPrinterName(mytop.selectedPrinter);
-
- // delete the printer
- boolean failed = false;
- try {
- newpr.deletePrinter();
- } catch (Exception e) {
- Debug.warning("CLNT: pmDelete:deletePrinter exception " + e);
- failed = true;
- }
-
- cmd = newpr.getCmdLog();
- warn = newpr.getWarnLog();
- err = newpr.getErrorLog();
-
- Debug.message("CLNT: pmDelete: delete cmd = " + cmd);
- Debug.message("CLNT: pmDelete: delete err = " + err);
- Debug.message("CLNT: pmDelete: delete warn = " + warn);
-
- if (failed) {
- pmMessageDialog m = new pmMessageDialog(
- mytop.parentFrame,
- pmUtility.getResource("Error"),
- ((err == null) ?
- pmUtility.getResource(
- "Printer.delete.operation.failed.") :
- err),
- mytop,
- "DeletePrinterFailed");
- m.setVisible(true);
-
- } else {
- Debug.message("CLNT: pmDelete return from deletePrinter ok");
-
- // Deletion successful, change the table
- if (mytop.selectedRow >= 0) {
- // update table
- mytop.pmsetPrinterList();
- mytop.clearSelected();
- mytop.listTable.clearSelection();
- mytop.pmsetdefaultpLabel();
- } else {
- Debug.warning("CLNT: pmDelete:selectedRow invalid: " +
- mytop.selectedRow);
- }
- }
- mytop.setLogData(cmd, err, warn);
- mytop.showLogData(pmUtility.getResource("Delete.Printer"));
- }
-
-
- public void actioncancelButton() {
- Debug.message("CLNT: pmDelete: actioncancelButton()");
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDialog.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDialog.java
deleted file mode 100644
index 87a9adbdf8..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDialog.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright(c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmDialog.java
- * Extends JDialog to provide for better default location.
- */
-
-package com.sun.admin.pm.client;
-
-import java.net.*;
-import java.awt.*;
-import javax.swing.*;
-import java.awt.event.*;
-
-import com.sun.admin.pm.server.Debug;
-
-public class pmDialog extends JDialog implements pmDialogConstraints {
-
- public pmDialog(Frame owner) {
- this(owner, null, false);
- }
-
- public pmDialog(Frame owner, boolean modal) {
- this(owner, null, modal);
- }
-
- public pmDialog(Frame owner, String title) {
- this(owner, title, false);
- }
-
- public pmDialog(Frame f, String title, boolean modal) {
-
- super(f, title, modal);
-
- // determine a nice location relative to parent frame
- Point newLocation = new Point(0, 0); // default
-
- if (f == null) {
- // centered on screen
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- newLocation = new Point(screenSize.width / 2 - xoffset,
- screenSize.height / 2 - yoffset);
-
- } else {
- // centered over parent frame
- Rectangle parentBounds = f.getBounds();
- newLocation = new Point(
- parentBounds.x + parentBounds.width / 2 - xoffset,
- parentBounds.y + parentBounds.height / 2 - yoffset);
- f.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- Debug.info("dialog Window closing");
- cleanupButtons();
- }
- public void windowClosed(WindowEvent e) {
- Debug.info("dialog Window closed");
- cleanupButtons();
- }
- public void windowDeactivated(WindowEvent e) {
- Debug.info("dialog Window deactivated");
- // possible java bug: too many of these events generated!
- // cleanupButtons();
- }
- });
- }
- setLocation(newLocation);
-
- // cannot set dialog icons under 1.1....
- /*
- * try {
- * String iconName = new String("images/appicon.gif");
- * Class thisClass = this.getClass();
- * URL iconUrl = thisClass.getResource(iconName);
- * if (iconUrl == null)
- * Debug.warning("Unable to resolve URL for icon " + iconName);
- * else {
- * Toolkit tk = Toolkit.getDefaultToolkit();
- * Image img = tk.getImage(iconUrl);
- * // this.setIconImage(img);
- * }
- * } catch (Exception x) {
- * Debug.warning(x.toString());
- * }
- */
-
- }
-
- public void cleanupButtons() {
- // drop this rootPane from pmButton's hashtable
- pmButton.unreference(this.getRootPane());
- }
-
- public void setVisible(boolean b) {
- if (b == false)
- cleanupButtons();
- super.setVisible(b);
- }
-
-}
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDialogConstraints.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDialogConstraints.java
deleted file mode 100644
index f7a90727c1..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDialogConstraints.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright(c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmDialogConstraints.java
- * Location constants for pmDialogs.
- */
-
-package com.sun.admin.pm.client;
-
-public interface pmDialogConstraints {
-
- /*
- * These are offsets from origin of a pmDialog's parent frame
- * at which to place the newly created dialog.
- */
- static final int xoffset = 100;
- static final int yoffset = 80;
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmFindFrame.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmFindFrame.java
deleted file mode 100644
index ad54f0a6b8..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmFindFrame.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmFindFrame.java
- * Find Printer dialog implementation
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.JPanel;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-public class pmFindFrame extends pmFrame {
-
- JLabel statusText = null;
- pmButton okButton = null;
- pmButton cancelButton = null;
- pmButton helpButton = null;
- pmTop theTop = null;
-
- String label = pmUtility.getResource("Enter.name.of.printer.to.find");
- String helpTag = "ToFindPrinter";
-
- public pmFindFrame(pmTop t) {
-
- super(pmUtility.getResource("SPM:Find.Printer"));
-
- setLocation(100, 100);
-
- theTop = t;
-
-
- JLabel l;
- JPanel p;
-
- // initialize constraints
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridwidth = 1;
- c.gridheight = 1;
- c.insets = new Insets(10, 10, 5, 10);
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1.0;
-
- // top panel contains the message
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- l = new JLabel(label, SwingConstants.LEFT);
- p.add(l, c);
-
- getContentPane().add(p, "North");
-
- // middle panel contains "other" text field
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- printerName = new pmTextField(30);
- printerName.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- okPressed();
- }
- });
- l.setLabelFor(printerName);
-
- c.gridx = 1;
- c.gridy = 0;
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
- c.insets = new Insets(0, 10, 5, 10);
-
- p.add(printerName, c);
-
- statusText = new JLabel(" ", SwingConstants.LEFT);
-
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridx = 0;
- c.gridwidth = 2;
-
- c.insets = new Insets(5, 10, 5, 10);
- p.add(statusText, c);
-
- getContentPane().add(p, "Center");
-
- // bottom panel contains buttons
- c.gridx = 0;
- c.weightx = 1.0;
- c.weighty = 0.0;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
- c.insets = new Insets(5, 10, 10, 10);
-
- JPanel thePanel = new JPanel();
-
- okButton = new pmButton(
- pmUtility.getResource("Find"));
- okButton.setMnemonic(
- pmUtility.getIntResource("Find.mnemonic"));
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- okPressed();
- }
- });
- thePanel.add(okButton, c);
-
- cancelButton = new pmButton(
- pmUtility.getResource("Dismiss"));
- cancelButton.setMnemonic(
- pmUtility.getIntResource("Dismiss.mnemonic"));
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- cancelPressed();
- }
- });
- thePanel.add(cancelButton, c);
-
- helpButton = new pmButton(
- pmUtility.getResource("Help"));
- helpButton.setMnemonic(
- pmUtility.getIntResource("Help.mnemonic"));
- helpButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- theTop.showHelpItem(helpTag);
- }
- });
- thePanel.add(helpButton, c);
-
- getContentPane().add(thePanel, "South");
-
- // lay out the dialog
- pack();
-
- // handle Esc as dismiss in any case
- getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- cancelPressed();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-
- // set focus to initial field, depending on which action is tbd
- // this seems to work best after pack()
-
- /*
- * frame.setVisible(true);
- * frame.repaint();
- */
-
- // getRootPane().setDefaultButton (okButton);
- okButton.setAsDefaultButton();
-
- printerName.requestFocus();
-
- // enable improved focus handling
- setDefaultComponent(printerName);
-
- }
-
-
- public void okPressed() {
- Debug.message("CLNT: pmFindFrame:okPressed():" +
- printerName.getText());
-
- String name = printerName.getText();
- boolean result = theTop.findPrinterInList(name.trim());
- if (!result)
- statusText.setText(new String(
- pmUtility.getResource("Unable.to.find.printer") + name));
- else
- statusText.setText(" ");
-
- // pmFindPanel.this.frame.setVisible (false);
-
- }
-
- public void cancelPressed() {
- Debug.message("CLNT: pmFindFrame: cancelPressed()");
- statusText.setText(" ");
- printerName.setText("");
- pmFindFrame.this.setVisible(false);
-
- }
-
- public pmTextField printerName = null;
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmFrame.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmFrame.java
deleted file mode 100644
index ec37480473..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmFrame.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmFrame.java
- * Extends JFrame to support better focus handling
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.net.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-class pmFrame extends JFrame {
-
- // this comp gets focus on frame open
- Component defaultComponent = null;
-
- // file path of icon; this does not provide for localization
- private static final String iconName = "images/appicon.gif";
-
- // if true, clean up pmButton state on frame close
- private boolean clearButtonsOnClose;
-
- public pmFrame(String s) {
- super(s);
-
- // default: do NOT clear default button state when frame is closed
- clearButtonsOnClose = false;
-
- this.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- Debug.message("CLNT: pmFrame focus gained: " + e);
- if (defaultComponent != null) {
- Debug.message("CLNT: pmFrame focus to default comp");
- defaultComponent.requestFocus();
- } else
- Debug.message("CLNT: pmFrame no default comp");
- }
- public void focusLost(FocusEvent e) {
- Debug.message("CLNT: frame focus lost: " + e);
- }
- });
-
- this.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- Debug.info("frame Window closing");
- cleanupButtons();
- }
- public void windowClosed(WindowEvent e) {
- Debug.info("frame Window closed");
- cleanupButtons();
- }
- });
-
- try {
- Class thisClass = this.getClass();
- URL iconUrl = thisClass.getResource(iconName);
- // System.out.println("Icon: " + iconUrl);
- if (iconUrl == null)
- Debug.warning("Unable to resolve URL for icon " + iconName);
- else {
- Toolkit tk = Toolkit.getDefaultToolkit();
- Image img = tk.getImage(iconUrl);
- this.setIconImage(img);
- }
-
- } catch (Exception x) {
- Debug.warning(x.toString());
- }
- }
-
-
- public void setDefaultComponent(Component c) {
- defaultComponent = c;
- }
-
-
- // If the frame is a minimized icon, make it un-minimized first
- public void setVisible(boolean isVisible) {
- if (isVisible == true) {
- try {
- // this will fail in jdk 1.1 but work fine in 1.2
- setState(NORMAL);
- } catch (Exception ssx) {
- // restores an iconified window in JDK 1.1
- removeNotify();
- addNotify();
- }
- } else
- cleanupButtons();
- super.setVisible(isVisible);
- }
-
- public void cleanupButtons() {
- // drop this rootPane from pmButton's hashtable
- if (clearButtonsOnClose)
- pmButton.unreference(this.getRootPane());
- }
-
- protected void setClearButtonsOnClose(boolean b) {
- clearButtonsOnClose = b;
- }
-
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmGuiException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmGuiException.java
deleted file mode 100644
index f4dfccae58..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmGuiException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmGuiException.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-public class pmGuiException extends Exception {
-
- String s = null;
-
- public pmGuiException(String s) {
- super(s);
-
- }
-
- public pmGuiException() {
- super();
-
- }
-
-// XXX use localized strings
- public String getLocalizedMessage() {
- return getMessage();
-
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpContent.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpContent.java
deleted file mode 100644
index 27919cbde5..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpContent.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHelpContent.java
- * Wrapper for content of help articles
- */
-
-package com.sun.admin.pm.client;
-
-class pmHelpContent extends Object {
- private String text;
-
- public pmHelpContent(String content) {
- text = content;
- }
-
- public pmHelpContent(pmHelpContent other) {
- text = new String(other.text);
- }
-
- public String toString() {
- return text;
- }
-
- public String getText() {
- return text;
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpController.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpController.java
deleted file mode 100644
index 320d470254..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpController.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHelpController.java
- * Help subsystem implementation
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import java.io.*;
-import javax.swing.JPanel;
-import javax.swing.border.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-class pmHelpController {
-
- public pmHelpFrame frame = null;
-
- /*
- * request presentation of the specified help item.
- */
- public void showHelpItem(String tag) {
- Debug.info("HELP: controller.showHelpitem " + tag);
- if (tag != null) {
- pmHelpItem item = viewPanel.loadItemForTag(tag);
- outerPanel.setSelectedComponent(viewPanel);
- }
- }
-
- public void showHelpItem(pmHelpItem item) {
- if (item != null)
- showHelpItem(item.tag);
- }
-
- JTabbedPane outerPanel;
- pmHelpDetailPanel viewPanel;
- pmHelpIndexPanel indexPanel;
- pmHelpSearchPanel searchPanel;
-
- Vector history;
-
- public JTabbedPane getTopPane() {
- return outerPanel;
- }
-
- public pmHelpController(pmHelpFrame f) {
-
- frame = f;
-
- outerPanel = new JTabbedPane();
-
- viewPanel = new pmHelpDetailPanel(this);
- indexPanel = new pmHelpIndexPanel(this);
- searchPanel = new pmHelpSearchPanel(this);
-
- outerPanel.add(pmUtility.getResource("View"), viewPanel);
- outerPanel.add(pmUtility.getResource("Index"), indexPanel);
- outerPanel.add(pmUtility.getResource("Search"), searchPanel);
-
- pmHelpRepository.populateHelpItemDB();
- pmHelpRepository.populateHelpKeywordDB();
- pmHelpRepository.populateHelpTitleDB();
-
- indexPanel.queryPanel.handleText(""); // prime it... ugly.
-
- history = new Vector();
-
- frame.setDefaultComponent(outerPanel);
- }
-
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpDetailPanel.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpDetailPanel.java
deleted file mode 100644
index 434670f508..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpDetailPanel.java
+++ /dev/null
@@ -1,597 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright(c) 1999 - 2001 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHelpDetailPanel.java
- * View a help article
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import java.io.*;
-import java.net.URL;
-import javax.swing.JPanel;
-import javax.swing.border.*;
-import javax.swing.event.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-class pmHelpLoc {
- public pmHelpItem item;
- public Point pos;
-
- public pmHelpLoc(pmHelpItem i) {
- this(i, new Point(0, 0));
- }
-
- public pmHelpLoc(pmHelpItem i, Point p) {
- item = i;
- pos = p;
- }
-
- public pmHelpLoc() {
- this(null, new Point(0, 0));
- }
-}
-
-public class pmHelpDetailPanel extends JPanel {
-
- pmHelpController controller;
- pmHelpSeeAlsoPanel seeAlsoPanel;
- pmHelpViewPanel viewPanel;
-
- pmHelpLoc history[];
- int historyIndex;
- int historyLast;
-
- static final int MAX_HISTORY_ITEMS = 101;
-
- public pmHelpDetailPanel(pmHelpController ctrl) {
-
- controller = ctrl;
-
- // build subpanels
- seeAlsoPanel = new pmHelpSeeAlsoPanel(this);
- viewPanel = new pmHelpViewPanel(this);
-
- // lay out top panel
- this.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.insets = new Insets(5, 5, 5, 5);
-
- c.gridwidth = GridBagConstraints.REMAINDER;
-
- c.gridx = 0;
- c.gridy = 0;
-
- c.gridheight = 2; // GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.weighty = 6.0;
- c.insets = new Insets(5, 5, 0, 5);
- this.add(viewPanel, c);
-
- c.gridy = GridBagConstraints.RELATIVE;
- // c.gridheight = GridBagConstraints.REMAINDER;
- c.gridheight = 0;
- c.weighty = 0.0;
- c.weightx = 1.0;
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.WEST;
- c.insets = new Insets(0, 5, 5, 5);
- this.add(seeAlsoPanel, c);
-
- this.setBorder(BorderFactory.createEtchedBorder());
-
- history = new pmHelpLoc[MAX_HISTORY_ITEMS];
- historyIndex = 0;
- historyLast = 0;
-
- // manage focus when we are tabbed or un-tabbed
- controller.outerPanel.addChangeListener(new ChangeListener() {
- public void stateChanged(ChangeEvent e) {
- JTabbedPane tp = (JTabbedPane) e.getSource();
- Debug.info("HELP: Tab event!");
- if (!(tp.getSelectedComponent() instanceof
- com.sun.admin.pm.client.pmHelpDetailPanel)) {
- Debug.info("HELP: Tab event: resetting default");
- /*
- * controller.frame.getRootPane().
- * setDefaultButton(
- * controller.frame.dismiss);
- */
- if (controller.frame.dismiss != null)
- controller.frame.dismiss.
- setAsDefaultButton();
- }
- }
- });
-
- addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- Debug.info("HELP: detailPanel gained focus");
- if (controller.frame.dismiss != null)
- controller.frame.dismiss.
- setAsDefaultButton();
-
- }
- });
- }
-
- // ask parent controller to show item
- public void showItem(String tag) {
- controller.showHelpItem(tag);
- }
-
- public void showHistoryBackItem() {
- Debug.message("HELP: showHistoryBackItem: index = " +
- historyIndex + " last = " +
- historyLast +
- "\n\thistory = " +
- history);
-
- // assuming item already visible, preserve its position
- history[historyIndex].pos = viewPanel.getPos();
-
- Debug.info("back: pos is " + history[historyIndex].pos);
-
- if (historyIndex > 1) {
- pmHelpLoc l = history [--historyIndex];
- pmHelpItem item = l.item;
- Point p = l.pos;
- loadItem(item, p);
- }
- viewPanel.setNavButtons(historyIndex, historyLast);
- }
-
- public void showHistoryForwardItem() {
- Debug.message("HELP: showHistoryForwardItem: index = " +
- historyIndex +
- " last = " + historyLast +
- "\n\thistory = " + history);
-
- // assuming already an item visible, preserve its position
- history[historyIndex].pos = viewPanel.getPos();
-
- Debug.info("HELP: fwd: pos is " + history[historyIndex].pos);
-
- if (historyIndex < historyLast) {
- pmHelpLoc l = history [++historyIndex];
- pmHelpItem item = l.item;
- Point p = l.pos;
- loadItem(item, p);
- }
- viewPanel.setNavButtons(historyIndex, historyLast);
- }
-
-
- /*
- * load the help item
- * internal
- */
- protected pmHelpItem loadItem(pmHelpItem item) {
- return loadItem(item, new Point(0, 0));
- }
-
- protected pmHelpItem loadItem(pmHelpItem item, Point pos) {
- Debug.message("HELP: View: loadItem " + item.tag);
- seeAlsoPanel.setItems(item.seealso);
-
- Debug.info("loadItem: pos is " + pos);
-
- viewPanel.setItem(item.title, item.content);
- viewPanel.setPos(pos);
- return item;
- }
-
-
- /*
- * load the help item corresponding to the specified tag
- * external - called from helpController
- * note that this is how see-also items are loadedes
- */
- public pmHelpItem loadItemForTag(String tag) {
-
- pmHelpItem item;
-
- if (tag == null ||
- (item = pmHelpRepository.helpItemForTag(tag)) == null) {
- Debug.warning("HELP: View: item not found");
- loadEmptyItem(tag);
- return null;
- }
-
- Debug.info("loadItem(before): index = " + historyIndex +
- ", last = " + historyLast);
-
- // if there's already an item visible, preserve its position
- if (historyIndex != 0 && historyLast != 0)
- history[historyIndex].pos = viewPanel.getPos();
-
- loadItem(item);
-
- Debug.info("HELP: loadItemForTag: index = " + historyIndex +
- " last = " + historyLast + "\n\thistory = " +
- history);
-
- /*
- * make the new item the latest in history.
- * if the history length is maxed out, the new item
- * will replace the item that's currently last.
- */
-
- if (historyIndex < history.length - 1) {
- // init pos to 0,0
- history [++historyIndex] = new pmHelpLoc(item);
- } else {
- // replace last item
- history [historyIndex] = new pmHelpLoc(item);
- }
- historyLast = historyIndex;
-
- viewPanel.setNavButtons(historyIndex, historyLast);
-
- Debug.info("loadItem(after): index = " + historyIndex +
- ", last = " + historyLast);
- return item;
- }
-
- private void loadEmptyItem(String itm) {
- String msg = new String(
- pmUtility.getResource("Item.not.found:") + itm);
- viewPanel.setItem(msg, new pmHelpContent(
- pmUtility.getResource("No.information.available.")));
- seeAlsoPanel.setItems(null);
- }
-
-}
-
-
-
-class pmHelpSeeAlsoPanel extends JPanel {
-
- pmHelpDetailPanel parentPanel = null;
- Vector seeAlsoItems = null;
- JComboBox theComboBox = null;
- pmButton selectButton = null;
-
- private void layoutBox() {
-
- JPanel p = new JPanel();
- p.setLayout(new BorderLayout(5, 0));
-
- p.add(new JPanel(), "North");
- p.add(new JPanel(), "South");
-
- p.add(new JLabel(
- pmUtility.getResource("See.also:")), "West");
-
- theComboBox = new JComboBox();
-
- Font f = theComboBox.getFont();
- Font fb = new Font(f.getName(), f.PLAIN, f.getSize());
- theComboBox.setFont(fb);
-
- theComboBox.setPreferredSize(
- new Dimension(200, theComboBox.getPreferredSize().height));
- theComboBox.setMinimumSize(
- new Dimension(20, theComboBox.getPreferredSize().height));
- theComboBox.setMaximumSize(
- new Dimension(300, theComboBox.getPreferredSize().height));
- theComboBox.setEnabled(false);
-
- /*
- * theComboBox.addActionListener(new ActionListener() {
- * public void actionPerformed(ActionEvent e) {
- * JComboBox src = (JComboBox) e.getSource();
- * System.out.println("Combo: action = " +
- * e.getActionCommand());
- * System.out.println("Combo: mod = " +
- * e.getModifiers());
- * System.out.println("Combo: param = " +
- * e.paramString());
- * System.out.println("Combo: item = " +
- * src.getSelectedItem());
- * }
- * });
- */
-
- p.add(theComboBox, "Center");
-
- selectButton = new pmButton(
- pmUtility.getResource("Show"));
- selectButton.setMnemonic(
- pmUtility.getIntResource("Show.mnemonic"));
- selectButton.setEnabled(false);
-
- p.add(selectButton, "East");
- selectButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- pmHelpItem i = (pmHelpItem) theComboBox.getSelectedItem();
- Debug.message("HELP: got button: item is " + i);
- // parentPanel.loadItemForTag(i.tag);
- parentPanel.showItem(i.tag);
- }
- });
-
- JPanel pp = new JPanel();
- pp.setLayout(new BorderLayout(5, 0));
- pp.add(p, "Center");
-
- this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
- this.add(Box.createHorizontalStrut(10));
- this.add(pp);
- this.add(Box.createHorizontalStrut(10));
- this.add(Box.createHorizontalGlue());
-
- }
-
- public pmHelpSeeAlsoPanel(pmHelpDetailPanel p) {
- parentPanel = p;
- layoutBox();
- this.setBorder(BorderFactory.createEtchedBorder());
- }
-
-
- /*
- * set the titles of the pmHelpItems whose tags are
- * passed into see-also combo box
- */
- public void setItems(Vector tags) {
- clearItems();
-
- if (tags == null)
- return;
-
- Enumeration e = tags.elements();
- while (e.hasMoreElements()) {
- pmHelpItem i =
- pmHelpRepository.helpItemForTag((String) e.nextElement());
- if (i != null)
- theComboBox.addItem(i);
- }
-
- selectButton.setEnabled(true);
- theComboBox.setEnabled(true);
-
-
- // repaint();
- }
-
-
- public void clearItems() {
- if (theComboBox.getItemCount() > 0)
- theComboBox.removeAllItems();
- selectButton.setEnabled(false);
- theComboBox.setEnabled(false);
- }
-
-}
-
-
-class pmHelpViewPanel extends JPanel {
- // JTextArea helpView;
- JEditorPane helpView;
- JScrollPane scrollPane;
- pmHelpHelpOnPanel titlePanel;
- pmHelpDetailPanel parentPanel;
- pmButton backButton;
- pmButton forwardButton;
-
- public pmHelpViewPanel(pmHelpDetailPanel par) {
- parentPanel = par;
-
- // helpView = new JTextArea(10, 32);
- // helpView.setLineWrap(true);
-
- helpView = new JEditorPane();
-
- helpView.setContentType("text/html");
- helpView.setEditable(false);
- helpView.setEnabled(false);
- helpView.setDisabledTextColor(Color.blue);
-
- scrollPane = new JScrollPane(helpView);
-
- this.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(5, 10, 5, 10);
- c.gridwidth = GridBagConstraints.REMAINDER;
-
- c.gridx = 0;
- c.gridy = 0;
-
- c.gridheight = 1;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1.0;
- // c.weighty = 1.0;
- c.weighty = 0.05;
-
- titlePanel = new pmHelpHelpOnPanel();
- this.add(titlePanel, c);
-
- c.gridy = 1;
- c.gridheight = 1;
-
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.weightx = 1.0;
- c.weighty = 6.0;
- c.fill = GridBagConstraints.BOTH;
- c.insets = new Insets(5, 10, 5, 10);
- // c.insets = new Insets(5, 5, 5, 5); // NEW
- this.add(scrollPane, c);
-
- this.setBorder(BorderFactory.createEtchedBorder());
-
- /*
- */
- try {
- helpView.setPage(new URL("file:///test.html"));
- } catch (Exception x) {
- Debug.info("setPage caught: " + x);
- }
- /*
- */
-
- // navigation buttons
- JPanel p = new JPanel();
- p.setLayout(new GridBagLayout());
- GridBagConstraints pc = new GridBagConstraints();
- // pc.insets = new Insets(2, 2, 2, 2);
- // pc.fill = GridBagConstraints.HORIZONTAL;
- pc.weightx = 1.0;
- pc.weighty = 1.0;
- pc.gridx = 0;
- pc.anchor = GridBagConstraints.WEST;
-
- backButton = new pmButton(
- pmUtility.getResource("Back"));
- backButton.setMnemonic(
- pmUtility.getIntResource("Back.mnemonic"));
- p.add(backButton, pc);
- backButton.setEnabled(false);
- backButton.setDefaultCapable(false);
- backButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- parentPanel.showHistoryBackItem();
- }
- });
-
-
- pc.gridx = 1;
- pc.anchor = GridBagConstraints.EAST;
-
- forwardButton = new pmButton(
- pmUtility.getResource("Forward"));
- forwardButton.setMnemonic(
- pmUtility.getIntResource("Forward.mnemonic"));
- p.add(forwardButton, pc);
- forwardButton.setEnabled(false);
- forwardButton.setDefaultCapable(false);
- forwardButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- parentPanel.showHistoryForwardItem();
- }
- });
-
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridheight = 1; // GridBagConstraints.REMAINDER;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.weightx = 1.0;
- // c.weighty = 1.0;
- c.weighty = 0.05; // NEW
-
- c.fill = GridBagConstraints.BOTH;
- c.insets = new Insets(0, 10, 5, 10);
- // c.insets = new Insets(0, 10, 5, 10);
- c.insets = new Insets(5, 10, 5, 10);
- // NEW
-
- add(p, c);
-
- }
-
-
- public void setItem(String title, pmHelpContent content) {
- helpView.setText(content.getText());
- // scrollPane.getViewport().setViewPosition(new Point(0, 0));
- titlePanel.helpTopic.setText(title);
- }
-
- public void setPos(Point p) {
- scrollPane.getViewport().setViewPosition(p);
- }
-
- public Point getPos() {
- return scrollPane.getViewport().getViewPosition();
- }
-
- public void setNavButtons(int index, int last) {
- Debug.message("HELP: NavButtons " + index + " " + last);
-
- if (last > index)
- forwardButton.setEnabled(true);
- else
- forwardButton.setEnabled(false);
-
- if (index > 1 && last > 1)
- backButton.setEnabled(true);
- else
- backButton.setEnabled(false);
- }
-
-}
-
-
-class pmJTextField extends JTextField {
- public boolean isFocusable() {
- return false;
- }
-}
-
-class pmHelpHelpOnPanel extends JPanel {
-
- pmJTextField helpTopic;
-
- public pmHelpHelpOnPanel() {
-
- helpTopic = new pmJTextField();
- helpTopic.setEditable(false);
- helpTopic.setText("Default help topic");
- helpTopic.setBackground(Color.white);
-
- Font f = helpTopic.getFont();
- Font fb = new Font(f.getName(), Font.BOLD, f.getSize());
- helpTopic.setFont(fb);
-
- this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
- JPanel p = new JPanel();
- p.setLayout(new BorderLayout(5, 0));
- p.add(new JLabel(
- pmUtility.getResource("Help.on:")),
- "West");
- p.add(helpTopic, "Center");
-
- JPanel pp = new JPanel();
- pp.setLayout(new BorderLayout(0, 0));
- pp.add(p, "Center");
-
- // this.add(Box.createHorizontalStrut(5));
- this.add(pp);
- // this.add(Box.createHorizontalStrut(5));
- this.add(Box.createHorizontalGlue());
-
-
- // this.setBorder(BorderFactory.createEtchedBorder());
-
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpFrame.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpFrame.java
deleted file mode 100644
index 094782a99f..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpFrame.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright(c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHelpFrame.java
- * Container for help subsystem GUI
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import java.io.*;
-import javax.swing.JPanel;
-import javax.swing.border.*;
-import javax.swing.*;
-import com.sun.admin.pm.server.*;
-
-
-public class pmHelpFrame extends pmFrame {
-
- protected pmHelpController theController = null;
- public pmButton dismiss = null; // expose for default button hacks
-
- public pmHelpFrame() {
- super(pmUtility.getResource("SPM:Help"));
-
- theController = new pmHelpController(this);
- getContentPane().add("Center", theController.getTopPane());
-
- dismiss = new pmButton(
- pmUtility.getResource("Dismiss"));
- dismiss.setMnemonic(
- pmUtility.getIntResource("Dismiss.mnemonic"));
- dismiss.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- hideHelp();
- }
- });
-
- JPanel p = new JPanel();
- p.add(dismiss);
-
- getContentPane().add("South", p);
-
- this.pack();
- this.setVisible(false);
- this.repaint();
-
- // default button is dismiss
- // getRootPane().setDefaultButton(dismiss);
- dismiss.setAsDefaultButton();
-
- // handle Esc as dismiss
- getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("HELP: dismiss action");
- hideHelp();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
- }
-
-
- public void hideHelp() {
- this.setVisible(false);
- }
-
-
- public void showHelp(String tag) {
- theController.showHelpItem(tag);
- this.setVisible(true);
- this.repaint();
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpIndexPanel.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpIndexPanel.java
deleted file mode 100644
index f97728cc7a..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpIndexPanel.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright(c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHelpIndexPanel.java
- * Search help titles
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import javax.swing.JPanel;
-import javax.swing.border.*;
-import javax.swing.event.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-public class pmHelpIndexPanel extends JPanel {
-
- pmHelpController controller;
- pmHelpIndexQueryPanel queryPanel;
- pmHelpIndexResultPanel resultPanel;
- JLabel textPanels[];
-
- public pmHelpIndexPanel(pmHelpController ctrl) {
- controller = ctrl;
-
- // build subpanels
- queryPanel = new pmHelpIndexQueryPanel(this);
- resultPanel = new pmHelpIndexResultPanel(this);
-
- textPanels = new JLabel[4];
- textPanels[0] = new JLabel(
- pmUtility.getResource("To.search.the.index..."));
- textPanels[1] = new JLabel(
- pmUtility.getResource("type.your.query.below..."));
-
- // lay out top panel
- this.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(5, 5, 5, 5);
- c.gridwidth = GridBagConstraints.REMAINDER;
-
- c.gridx = 0;
- c.gridy = 0;
-
- c.gridheight = 1; // GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.weighty = 0.0;
-
- JPanel p = new JPanel();
- p.setLayout(new GridBagLayout());
- GridBagConstraints pc = new GridBagConstraints();
- pc.insets = new Insets(5, 5, 0, 5);
- // pc.fill = GridBagConstraints.HORIZONTAL;
- pc.weightx = 1.0;
- pc.anchor = GridBagConstraints.WEST;
- pc.gridx = 0;
- pc.gridy = GridBagConstraints.RELATIVE;
-
- p.add(textPanels[0], pc);
- pc.insets = new Insets(0, 5, 5, 5);
- p.add(textPanels[1], pc);
- // p.add(textPanels[2]);
-
- this.add(p, c);
-
- p = new JPanel();
- p.setLayout(new BorderLayout());
- p.add(queryPanel, "North");
- p.add(resultPanel, "Center");
- p.setBorder(BorderFactory.createEtchedBorder());
-
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridheight = 0;
- c.weighty = 1.0;
- c.weightx = 0.0;
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.EAST;
-
- this.add(p, c);
-
- this.setBorder(BorderFactory.createEtchedBorder());
-
-
- // figure out when we are un-tabbed
- controller.outerPanel.addChangeListener(new ChangeListener() {
- public void stateChanged(ChangeEvent e) {
- JTabbedPane tp = (JTabbedPane) e.getSource();
- Debug.info("HELP: Tab event!");
- if (!(tp.getSelectedComponent() instanceof
- com.sun.admin.pm.client.pmHelpIndexPanel)) {
- Debug.info("HELP: Tab event: resetting default");
- /*
- * controller.frame.getRootPane().
- * setDefaultButton(
- * controller.frame.dismiss);
- */
- } else {
- // allow tab to retain focus
- // queryPanel.query.requestFocus();
- }
- }
- });
-
-
- }
-
-
- // place item titles in search result panel
- public void setSearchResults(Vector items) {
- Vector v = new Vector();
-
- if (items.size() == 0) {
- resultPanel.setListEmpty(true);
- v.addElement(pmUtility.getResource("Nothing.matched."));
- } else {
- Enumeration e = items.elements();
- while (e.hasMoreElements()) {
- pmHelpItem i = (pmHelpItem) e.nextElement();
- v.addElement(i);
- }
- resultPanel.setListEmpty(false);
- }
-
- resultPanel.setResultList(v);
- }
-
-}
-
-
-
-class pmHelpIndexResultPanel extends JPanel {
-
- JList resultList = null;
- pmButton selectButton = null;
- pmHelpIndexPanel parentPanel = null;
- protected boolean listEmpty = true;
-
-
- public pmHelpIndexResultPanel(pmHelpIndexPanel p) {
-
- parentPanel = p;
-
- this.setLayout(new GridBagLayout());
-
- GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(10, 10, 10, 10);
- c.fill = GridBagConstraints.NONE;
- c.weightx = c.weighty = 0.0;
- c.gridx = 0;
- c.gridy = 0;
- c.anchor = GridBagConstraints.NORTHWEST;
-
- JLabel promptLabel = new JLabel(
- pmUtility.getResource("Matching.entries:"));
-/*
- * MNEMONIC
- * promptLabel.setDisplayedMnemonic(
- * pmUtility.getIntResource("Matching.entries:.mnemonic"));
- */
-
- this.add(promptLabel, c);
-
- c.gridy = 1;
- c.anchor = GridBagConstraints.WEST;
-
- selectButton = new pmButton(
- pmUtility.getResource("Show"));
- selectButton.setMnemonic(
- pmUtility.getIntResource("Show.mnemonic"));
-
- selectButton.setEnabled(false);
-
- this.add(selectButton, c);
-
- selectButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- pmHelpItem selectedItem = (pmHelpItem)
- resultList.getSelectedValue();
- Debug.message("Selected " + selectedItem);
- parentPanel.controller.showHelpItem(selectedItem);
- }
- });
-
- Vector resultItems = null;
- try {
- // resultItems = pmHelpIndexQueryPanel.helpDB.getPartialMatch("");
- resultItems = pmHelpRepository.helpItemsForString("");
- } catch (pmHelpException x) {
- Debug.message("pmHelpIndexResultpanel init: " + x);
- resultItems = new Vector();
- resultItems.addElement(
- pmUtility.getResource("Nothing.matched."));
- }
-
- resultList = new JList(resultItems);
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.getViewport().setView(resultList);
- resultList.setVisibleRowCount(8);
-
- promptLabel.setLabelFor(resultList);
-
- resultList.addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (!listEmpty) {
- selectButton.setEnabled(true);
- /*
- * parentPanel.controller.frame.
- * getRootPane().setDefaultButton(selectButton);
- */
- selectButton.setAsDefaultButton();
-
- }
- }});
-
- resultList.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
- JList l = (JList) e.getSource();
- int i = l.locationToIndex(e.getPoint());
- Debug.message("doubleclick index: " + i);
- if (!listEmpty && i >= 0) {
- pmHelpItem item =
- (pmHelpItem) l.getModel().getElementAt(i);
- Debug.message("doubleclick: " + item.tag);
- parentPanel.controller.showHelpItem(item);
- }
- }
- }
- });
-
- c.gridwidth = 1; // 2;
- c.gridx = 1;
- c.gridy = 0;
- c.weightx = c.weighty = 1.0;
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.EAST;
-
- this.add(scrollPane, c);
-
- }
-
- void setResultList(Vector v) {
-
- resultList.setListData(v);
-
- resultList.setSelectedValue(v.elementAt(0), true);
- }
-
- void setListEmpty(boolean e) {
- listEmpty = e;
- selectButton.setEnabled(false);
- /*
- * parentPanel.controller.frame.getRootPane().
- * setDefaultButton(parentPanel.controller.frame.dismiss);
- */
- if (parentPanel.controller.frame.dismiss != null)
- parentPanel.controller.frame.dismiss.
- setAsDefaultButton();
- }
-
-}
-
-
-class pmHelpIndexQueryPanel extends JPanel {
-
- JTextField query;
- pmHelpIndexPanel parentPanel;
-
- public pmHelpIndexQueryPanel(pmHelpIndexPanel p) {
-
- parentPanel = p;
-
- this.setLayout(new GridBagLayout());
-
- GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(10, 10, 10, 10);
- c.fill = GridBagConstraints.NONE;
- c.weightx = c.weighty = 0.0;
- c.anchor = GridBagConstraints.WEST;
-
- c.gridx = 0;
- c.gridy = 0;
- c.gridwidth = 1;
- c.gridheight = 1;
- c.insets = new Insets(10, 10, 10, 10);
-
- JLabel promptLabel =
- new JLabel(pmUtility.getResource("Search.help.index.for:"));
-/*
- * MNEMONIC
- * promptLabel.setDisplayedMnemonic(
- * pmUtility.getIntResource("Search.help.index.for:.mnemonic"));
- */
-
- this.add(promptLabel, c);
-
- query = new JTextField();
- query.setEditable(true);
- query.setText("");
-
- promptLabel.setLabelFor(query);
-
- query.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.info("HELP: Action!");
- parentPanel.resultPanel.selectButton.doClick();
- }
- });
-
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.gridx = 1;
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.EAST;
-
- this.add(query, c);
-
- DocumentListener d = new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- // ignore
- }
-
- public void insertUpdate(DocumentEvent e) {
- handleText(query.getText());
- }
-
- public void removeUpdate(DocumentEvent e) {
- handleText(query.getText());
- }
- };
-
- query.getDocument().addDocumentListener(d);
- }
-
- public void handleText(String txt) {
-
- Debug.message("Got text " + txt);
-
- Vector v = null;
-
- try {
- // v = helpDB.getPartialMatch(txt);
- v = pmHelpRepository.helpItemsForString(txt);
- } catch (pmHelpException x) {
- Debug.warning("handleText: " + x);
- }
- parentPanel.setSearchResults(v);
-
- }
-
- // belongs in controller?
- // static pmHelpRepository helpDB = new pmHelpRepository();
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpItem.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpItem.java
deleted file mode 100644
index 94dab47210..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpItem.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHelpItem
- * Abstraction of a help article
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-
-import com.sun.admin.pm.server.*;
-
-class pmHelpItem extends Object {
- String title;
- String tag;
- Vector keywords;
- Vector seealso;
- pmHelpContent content;
-
- public pmHelpItem(String theTag) {
- tag = theTag;
- title = null;
- keywords = null;
- seealso = null;
- content = null;
- }
-
- public String toString() {
- /*
- * String s = new String("Item: " + tag + "\n");
- * s += ("\ttitle: " + title + "\n");
- * s += ("\tkeywords: " + keywords + "\n");
- * s += ("\tseealso: " + seealso + "\n");
- * s += ("\tcontent: " + content + "\n");
- */
- return title;
- }
-
-
- public void setTag(String s) {
- if (tag != null)
- tag = new String(s);
- }
-
- public void setTitle(String s) {
- if (s != null)
- title = new String(s);
- }
-
- public void setKeywords(Vector v) {
- if (v != null)
- keywords = (Vector) v.clone();
- }
-
- public void setSeeAlso(Vector v) {
- if (v != null)
- seealso = (Vector) v.clone();
- }
-
- public void setContent(pmHelpContent c) {
- if (c != null)
- content = new pmHelpContent(c);
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpRepository.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpRepository.java
deleted file mode 100644
index 45698ff0d5..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpRepository.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmHelpRepository.java
- * Database of help articles
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-
-import com.sun.admin.pm.server.*;
-
-
-
-/*
- * The help repository manages three distinct databases.
- *
- * helpItemDB: String tag -> pmHelpItem
- * Returns a pmHelpItem given its unique tag.
- * Used to resolve a reference from the app.
- *
- * helpKeywordDB: String -> Vector(of pmHelpItems)
- * Returns a Vector containing all pmHelpItems whose `keywords'
- * property contains the specifed keyword.
- *
- * helpTitleDB: String -> Vector (of pmHelpItems)
- * Returns a Vector containing all pmHelpItems whose `title'
- * property is a partial match for the specified string.
- */
-
-final class pmHelpRepository {
-
- private static Hashtable helpItemDB = null;
- private static Hashtable helpKeywordDB = null;
- private static BST helpTitleDB = null;
-
-
- // database of HelpItems, by tag string
- static void populateHelpItemDB() {
- helpItemDB = new Hashtable();
- loadHelpItemDB();
- // Debug.message("HELP: helpItemDB: " + helpItemDB);
- }
-
- // database of Vectors of HelpItems, by keyword string
- static void populateHelpKeywordDB() {
- if (helpItemDB == null)
- return;
-
- /*
- * Strategy:
- * for each item
- * for each keyword
- * if kw not in db
- * add ititem.tag
- * add item to keyword entry
- */
-
- helpKeywordDB = new Hashtable();
-
- Vector v = null;
- Enumeration items = helpItemDB.elements();
- while (items.hasMoreElements()) {
- pmHelpItem item = (pmHelpItem) items.nextElement();
- Enumeration keywords = item.keywords.elements();
- while (keywords.hasMoreElements()) {
- String keyword = (String) keywords.nextElement();
- v = (Vector) helpKeywordDB.get(keyword);
- if (v == null)
- helpKeywordDB.put(keyword, v = new Vector());
- v.addElement(item);
- }
- }
-
- // Debug.message("HELP: KeywordDB: " + helpKeywordDB);
- }
-
-
- // database of HelpItems, by (partial) title string
- static void populateHelpTitleDB() {
- if (helpItemDB == null)
- return;
-
- /*
- * strategy:
- * assume itemDB is loaded
- * for each item in itemDB
- * create an entry in titleDB
- */
-
- helpTitleDB = new BST();
-
- Enumeration items = helpItemDB.elements();
- while (items.hasMoreElements()) {
- pmHelpItem item = (pmHelpItem) items.nextElement();
- helpTitleDB.insert(item.title, item);
- }
- }
-
-
- static public pmHelpItem helpItemForTag(String tag) {
- if (helpItemDB == null || tag == null)
- return null;
- return (pmHelpItem) helpItemDB.get(tag);
- }
-
- static public Vector helpItemsForKeyword(String keyword) {
- if (helpKeywordDB == null)
- return null;
-
- return (Vector) helpKeywordDB.get(keyword.toLowerCase());
- }
-
-
- static public Vector helpItemsForString(String partialTitle)
- throws pmHelpException {
-
- Debug.info("HELP: helpItemsForString: " + partialTitle);
-
- if (helpTitleDB == null)
- return new Vector();
-
- Vector v = new Vector();
- helpTitleDB.traverse_find_vector(v, partialTitle);
-
- Debug.info("HELP: helpItemsForString: vector contains " +
- v.size() + " items");
-
- return v;
- }
-
-
-
-
- // this should go in utils...
- public static String getResource(String key) {
- String keyvalue = null;
- ResourceBundle bundle = null;
-
- Debug.message("HELP: getResource(" + key + ")");
-
- try {
- try {
- bundle = ResourceBundle.getBundle(
- "com.sun.admin.pm.client.pmHelpResources");
- } catch (MissingResourceException e) {
- Debug.fatal("HELP: Could not load pmHelpResources file");
- }
-
- try {
- keyvalue = bundle.getString(key);
- } catch (MissingResourceException e) {
- keyvalue = bundle.getString("Missing:") + key;
- Debug.error("HELP: Missing: " + key);
- }
- } catch (Exception other) {
- Debug.error("HELP: getResource(" + key + ") : " + other);
- }
-
- return keyvalue;
- }
-
-
- // from resources, presumably
- static public void loadHelpItemDB() {
-
- // Debug.setDebugLevel(new pmHelpRepository(), Debug.ALL);
-
- /*
- * strategy:
- * for each tag name (from pmHelpTagNameEnumerator):
- * get the property values from the resource bundle
- */
-
- Debug.message("HELP: Starting help item load");
-
- ResourceBundle bundle = null;
-
- try {
- bundle = ResourceBundle.getBundle(
- "com.sun.admin.pm.client.pmHelpResources");
- } catch (MissingResourceException e) {
- Debug.fatal("HELP: Could not load pmHelpResources file");
- return;
- }
- Enumeration e = bundle.getKeys();
- while (e.hasMoreElements()) {
- String key = (String) e.nextElement();
- if (key.endsWith(".tag")) {
- String tagName = null;
- try {
- tagName = bundle.getString(key);
- } catch (MissingResourceException x) {
- Debug.warning("HELP: Unable to find tag for " + key);
- continue;
- }
-
- Debug.message("HELP: Making new item " + tagName);
-
- pmHelpItem item = new pmHelpItem(tagName);
-
- String theTitle = getResource(tagName + ".title");
- item.setTitle(theTitle);
-
- item.setContent(new pmHelpContent(
- getResource(tagName + ".content")));
-
- Vector v = null;
- StringTokenizer st = null;
-
- String s = getResource(tagName + ".seealso");
- if (s != null) {
- v = new Vector();
- st = new StringTokenizer(s);
- while (st.hasMoreTokens())
- v.addElement(st.nextToken());
- item.setSeeAlso(v);
- }
-
- v = new Vector();
- s = getResource(tagName + ".keywords");
- if (s != null) {
- st = new StringTokenizer(s);
- while (st.hasMoreTokens()) {
- String word = st.nextToken();
- String quotelessWord = word.replace('\"', ' ');
- v.addElement(quotelessWord.trim());
- }
- } else
- Debug.warning("HELP: Item " + tagName +
- " keywords is empty");
-
-
- // insert item's title words into its keywords
- st = new StringTokenizer(theTitle);
- while (st.hasMoreTokens()) {
- String word = (st.nextToken()).toLowerCase();
-
- // ignore useless words
- if (ignoreKeyTitleWords.indexOf(word) != -1) {
- Debug.message("HELP: ignoring " + word +
- " from " + theTitle);
- continue;
- }
-
- Debug.message("HELP: adding " + word +
- " from " + theTitle);
-
- v.addElement(word);
- }
-
- item.setKeywords(v);
-
-
- Debug.message("HELP: New item: " + item);
-
- helpItemDB.put(item.tag, item);
- }
- }
- }
-
-
- // these words are not to be treated as keywords when they appear in title
- static final private String
- /* JSTYLED */
- ignoreKeyTitleWords = pmUtility.getResource("help.ignore.words");
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpSearchPanel.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpSearchPanel.java
deleted file mode 100644
index 03c0aefeba..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpSearchPanel.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright(c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHelpSearchPanel.java
- * Search help keywords
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import javax.swing.JPanel;
-import javax.swing.border.*;
-import javax.swing.event.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-public class pmHelpSearchPanel extends JPanel {
-
- pmHelpController controller;
- pmHelpSearchQueryPanel queryPanel;
- pmHelpSearchResultPanel resultPanel;
- JLabel textPanels[];
-
- public pmHelpSearchPanel(pmHelpController ctrl) {
- controller = ctrl;
-
- // build subpanels
- queryPanel = new pmHelpSearchQueryPanel(this);
- resultPanel = new pmHelpSearchResultPanel(this);
-
- textPanels = new JLabel[4];
- textPanels[0] = new JLabel(
- pmUtility.getResource("To.find.help.articles..."));
- textPanels[1] = new JLabel(
- pmUtility.getResource("enter.keywords.below..."));
-
- // lay out top panel
- this.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(5, 5, 5, 5);
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.gridx = 0;
- c.gridy = 0;
- c.gridheight = 1; // GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.weighty = 0.0;
-
- JPanel p = new JPanel();
- p.setLayout(new GridBagLayout());
- GridBagConstraints pc = new GridBagConstraints();
- pc.insets = new Insets(5, 5, 0, 5);
- // pc.fill = GridBagConstraints.HORIZONTAL;
- pc.weightx = 1.0;
- pc.anchor = GridBagConstraints.WEST;
- pc.gridx = 0;
- pc.gridy = GridBagConstraints.RELATIVE;
-
- p.add(textPanels[0], pc);
- pc.insets = new Insets(0, 5, 5, 5);
- p.add(textPanels[1], pc);
- // p.add(textPanels[2]);
-
- this.add(p, c);
-
-
- p = new JPanel();
- p.setLayout(new BorderLayout());
- queryPanel.setBorder(BorderFactory.createEtchedBorder());
- p.add(queryPanel, "North");
- resultPanel.setBorder(BorderFactory.createEtchedBorder());
- p.add(resultPanel, "Center");
- // p.setBorder(BorderFactory.createEtchedBorder());
-
- c.gridy = 1;
- // new stuff
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridheight = 0;
- c.weighty = 1.0;
- c.weightx = 0.0;
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.EAST;
- // end new stuff
-
- this.add(p, c);
- this.setBorder(BorderFactory.createEtchedBorder());
-
-
- // figure out when we are tabbed or un-tabbed
- controller.outerPanel.addChangeListener(new ChangeListener() {
- public void stateChanged(ChangeEvent e) {
- JTabbedPane tp = (JTabbedPane) e.getSource();
- Debug.info("HELP: Tab event!");
- if (!(tp.getSelectedComponent() instanceof
- com.sun.admin.pm.client.pmHelpSearchPanel)) {
- Debug.info("HELP: Tab event: resetting default");
- /*
- * controller.frame.getRootPane().
- * setDefaultButton(
- * controller.frame.dismiss);
- */
- /*
- * System.out.println(controller);
- * System.out.println(controller.frame);
- * System.out.println(controller.frame.dismiss);
- */
-
- if (controller.frame.dismiss != null)
- controller.frame.dismiss.
- setAsDefaultButton();
- } else {
- // better to have the tab itself keep focus.
- // queryPanel.query.requestFocus();
- }
- }
- });
-
- }
-
-
- // place item titles in search result panel
- public void setSearchResults(Vector items) {
- Vector v = new Vector();
-
- if (items.size() == 0) {
- resultPanel.setListEmpty(true);
- v.addElement(pmUtility.getResource("Nothing.matched."));
- } else {
- Enumeration e = items.elements();
- while (e.hasMoreElements()) {
- pmHelpItem i = (pmHelpItem) e.nextElement();
- v.addElement(i);
- }
- resultPanel.setListEmpty(false);
- }
- resultPanel.setResultList(v);
- }
-}
-
-
-
-class pmHelpSearchResultPanel extends JPanel {
-
- JList resultList = null;
- pmButton selectButton = null;
- pmHelpSearchPanel parentPanel = null;
- protected boolean listEmpty = true;
-
-
- public pmHelpSearchResultPanel(pmHelpSearchPanel par) {
-
- parentPanel = par;
-
- this.setLayout(new GridBagLayout());
-
- GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(10, 10, 10, 10);
- c.fill = GridBagConstraints.NONE;
- c.weightx = c.weighty = 0.0;
- c.gridx = 0;
- c.gridy = 0;
- c.anchor = GridBagConstraints.NORTHWEST;
-
- JLabel promptLabel = new JLabel(
- pmUtility.getResource("Search.Results:"));
-/*
- * MNEMONIC
- * promptLabel.setDisplayedMnemonic(
- * pmUtility.getIntResource("Search.Results:.mnemonic"));
- */
-
- this.add(promptLabel, c);
-
- selectButton = new pmButton(
- pmUtility.getResource("Show"));
- selectButton.setMnemonic(
- pmUtility.getIntResource("Show.mnemonic"));
-
- selectButton.setEnabled(false);
-
- selectButton.addActionListener(new ActionListener() {
- // load the selected item into view panel
- public void actionPerformed(ActionEvent e) {
- pmHelpItem selectedItem = (pmHelpItem)
- resultList.getSelectedValue();
- Debug.info("HELP: Selected " + selectedItem);
- parentPanel.controller.showHelpItem(selectedItem);
-
- }
- });
-
- c.gridy = 1;
- c.anchor = GridBagConstraints.SOUTHWEST;
- this.add(selectButton, c);
-
-
- Vector resultItems = new Vector();
-
- resultList = new JList(resultItems);
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.getViewport().setView(resultList);
- resultList.setVisibleRowCount(8);
-
- promptLabel.setLabelFor(resultList);
-
- resultList.addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (!listEmpty) {
- selectButton.setEnabled(true);
- /*
- * parentPanel.controller.frame.
- * getRootPane().setDefaultButton(selectButton);
- */
- selectButton.setAsDefaultButton();
-
- }
- }});
-
-
- resultList.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
- JList l = (JList) e.getSource();
- int i = l.locationToIndex(e.getPoint());
- Debug.info("HELP: doubleclick index: " + i);
- if (!listEmpty && i >= 0) {
- pmHelpItem item = (pmHelpItem) l.getModel().
- getElementAt(i);
- Debug.info("HELP: doubleclick: " + item.tag);
- parentPanel.controller.showHelpItem(item);
- }
- }
- }
- });
-
-
- c.gridwidth = 2;
- c.gridx = 1;
- c.gridy = 0;
- c.weightx = c.weighty = 1.0;
- c.fill = GridBagConstraints.BOTH;
- c.anchor = GridBagConstraints.WEST;
-
- this.add(scrollPane, c);
-
- }
-
- public void setResultList(Vector v) {
- resultList.setListData(v);
- resultList.setSelectedValue(v.elementAt(0), true);
-
- }
-
- void setListEmpty(boolean e) {
- listEmpty = e;
- selectButton.setEnabled(false);
- /*
- * parentPanel.controller.frame.getRootPane().
- * setDefaultButton(parentPanel.controller.frame.dismiss);
- */
- parentPanel.controller.frame.dismiss.setAsDefaultButton();
-
- }
-
-
-}
-
-
-class pmHelpSearchQueryPanel extends JPanel {
-
- JTextField query;
- pmButton search;
- pmHelpSearchPanel parentPanel = null;
-
- public pmHelpSearchQueryPanel(pmHelpSearchPanel par) {
-
- parentPanel = par;
-
- this.setLayout(new GridBagLayout());
-
- GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(10, 10, 10, 10);
- c.fill = GridBagConstraints.NONE;
- c.weightx = c.weighty = 0.0;
- c.anchor = GridBagConstraints.WEST;
-
- c.gridx = 0;
- c.gridy = 0;
- c.gridwidth = 1;
- c.gridheight = 1;
-
- JLabel promptLabel =
- new JLabel(pmUtility.getResource("Keywords:"));
-/*
- * MNEMONIC
- * promptLabel.setDisplayedMnemonic(
- * pmUtility.getIntResource("Keywords:.mnemonic"));
- */
-
- this.add(promptLabel, c);
-
- search = new pmButton(
- pmUtility.getResource("Find"));
- search.setMnemonic(
- pmUtility.getIntResource("Find.mnemonic"));
-
- search.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- // parse the keyword strings
- Vector v = null;
- StringTokenizer st = null;
- String s = query.getText();
- if (s != null) {
- v = new Vector();
- st = new StringTokenizer(s);
- while (st.hasMoreTokens())
- v.addElement(st.nextToken());
- v = getItemsForKeywords(v);
- parentPanel.setSearchResults(v);
-
- if (v != null && v.size() != 0) {
- Debug.info("HELP: search vector full");
- parentPanel.resultPanel.resultList.requestFocus();
- } else {
- Debug.info("HELP: search vector empty");
- }
- }
-
- }
- });
-
- c.fill = GridBagConstraints.NONE;
- c.gridx = 2;
- c.gridy = 0; // GridBagConstraints.RELATIVE;
- this.add(search, c);
-
- query = new JTextField();
- query.setEditable(true);
- query.setText(" ");
-
- promptLabel.setLabelFor(query);
-
- query.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.info("HELP: Action!");
- pmHelpSearchQueryPanel.this.search.doClick();
- }
- });
-
- query.getDocument().addDocumentListener(new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- // ignore
- }
-
- public void insertUpdate(DocumentEvent e) {
- // make search the default button
- Debug.info("HELP: search doc inserted update");
- pmHelpSearchQueryPanel.this.search.setEnabled(true);
- /*
- * parentPanel.controller.frame.
- * getRootPane().setDefaultButton(
- * pmHelpSearchQueryPanel.this.search);
- */
- if (pmHelpSearchQueryPanel.this.search != null)
- pmHelpSearchQueryPanel.this.search.
- setAsDefaultButton();
- }
-
- public void removeUpdate(DocumentEvent e) {
- Debug.info("HELP: search doc removed update");
- // restore the default button
- if (query.getText().length() == 0) {
- /*
- * parentPanel.controller.frame.
- * getRootPane().setDefaultButton(
- * parentPanel.controller.frame.dismiss);
- */
- if (parentPanel.controller.frame.dismiss != null)
- parentPanel.controller.frame.dismiss.
- setAsDefaultButton();
- }
- }
- });
-
-
-
- c.gridwidth = 1; // GridBagConstraints.REMAINDER;
- c.gridx = 1;
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.EAST;
-
- this.add(query, c);
-
- }
-
-
- Vector getItemsForKeywords(Vector keywords) {
- Vector result = new Vector();
-
- Debug.info("HELP: getItemsForKeywords: " + keywords);
-
- Enumeration words = keywords.elements();
- while (words.hasMoreElements()) {
- String s = (String) words.nextElement();
- Vector newItems = pmHelpRepository.helpItemsForKeyword(s);
- Debug.info("HELP: getItemsForKeywords new items: " + newItems);
-
- if (newItems != null) {
- Enumeration items = newItems.elements();
- while (items.hasMoreElements()) {
- pmHelpItem i = (pmHelpItem) items.nextElement();
- Debug.info("HELP: getItemsForKeywords result: " + result);
- Debug.info("HELP: getItemsForKeywords item: " + i);
-
- if (!result.contains(i))
- result.addElement(i);
- }
- }
- }
- return result;
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmIncompleteFormException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmIncompleteFormException.java
deleted file mode 100644
index 48926b44e8..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmIncompleteFormException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmIncompleteFormException.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-class pmIncompleteFormException extends pmGuiException {
- public pmIncompleteFormException(String s) {
- super(s);
- }
- public pmIncompleteFormException() {
- super();
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmInstallPrinter.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmInstallPrinter.java
deleted file mode 100644
index e24f1425d1..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmInstallPrinter.java
+++ /dev/null
@@ -1,2194 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Install and Modify Printer implementation
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.Vector;
-import javax.swing.JPanel;
-import javax.swing.*;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.table.AbstractTableModel;
-
-import com.sun.admin.pm.server.*;
-
-
-/*
- * Window for Edit -> Install Printer
- */
-
-public class pmInstallPrinter extends pmInstallScreen {
-
- int action;
- pmTop myTop;
- pmFrame frame;
- JScrollPane scrollPane;
- String printer = null;
- String server = null;
- String description = null;
- String port = null;
- String ptype = null;
- String fcontents = null;
- String make = null;
- String model = null;
- String ppd = null;
- String ppdfile = null;
- String oldmake = new String("oldmake");
- String oldmodel = new String("oldmodel");
- String faultn = null;
- String banner = null;
- String destination = null;
- String protocol = null;
- String useraccesslist[] = null;
- String oldptype = null;
- String olddevice = null;
- Printer workingPrinter;
-
- JList accessList;
- JScrollPane ascrollPane;
- accessListModel accessModel;
-
- String helpTag = null;
-
- String cmdLog = null;
- String errorLog = null;
- String warnLog = null;
-
- String actionName = null;
-
- // where to place initial focus
- Component defaultComponent = null;
-
- boolean usePPD;
- boolean useLocalhost;
-
- public pmInstallPrinter(pmTop myTop, int action) throws pmGuiException {
- boolean failed = false;
- boolean cacheerr = false;
- boolean ppdincacheerr = false;
-
- this.myTop = myTop;
- this.action = action;
- workingPrinter = new Printer(myTop.ns);
-
- usePPD = myTop.getUsePPD();
- useLocalhost = myTop.getUseLocalhost();
-
- switch (action) {
-
- case Constants.ADDLOCAL:
-
- Debug.message("CLNT:pmInstPr: ADD LOCAL");
- frame = new pmFrame(
- pmUtility.getResource("SPM:New.Attached.Printer"));
- if (pmMisc.isppdCachefile() && usePPD) {
- helpTag = "InstallLocalPPD";
- } else {
- helpTag = "InstallLocal";
- }
- actionName =
- pmUtility.getResource("New.Attached.Printer");
- break;
-
- case Constants.ADDNETWORK:
-
- Debug.message("CLNT:pmInstPr: ADD NETWORK");
- frame = new pmFrame(
- pmUtility.getResource("SPM:New.Network.Printer"));
- if ((pmMisc.isppdCachefile()) && (usePPD)) {
- helpTag = "InstallNetworkPPD";
- } else
- helpTag = "InstallNetwork";
- actionName = pmUtility.getResource("New.Network.Printer");
- break;
-
- case Constants.MODIFYATTACHED:
-
- Debug.message("CLNT:pmInstPr: MODIFY ATTACHED");
- frame = new pmFrame(
- pmUtility.getResource("SPM:Modify.Printer.Properties"));
- workingPrinter.setPrinterName(myTop.selectedPrinter);
-
- failed = false;
- try {
- workingPrinter.getPrinterDetails();
-
- } catch (pmNeedPPDCacheException e) {
- cacheerr = true;
- Debug.message("CLNT:pmInstPr:ModifyAttached caught: " + e);
-
- } catch (pmCacheMissingPPDException e) {
- ppdincacheerr = true;
- Debug.message("CLNT:pmInstPr:ModifyAttached caught: " + e);
-
- } catch (Exception e) {
- failed = true;
- Debug.message("CLNT:pmInsPr:ModifyAttached caught:" + e);
- }
-
- gatherLogs(workingPrinter);
-
- if (cacheerr) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "Cannot.modify.this.queue;ppdcache.file.missing."));
-
- m.setVisible(true);
-
- throw new pmGuiException("No ppdcache file");
- }
-
- if (ppdincacheerr) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "Cannot.modify.this.queue;PPD.file.not.in.ppdcache."));
-
- m.setVisible(true);
-
- throw new pmGuiException("PPD file not in ppdcache");
- }
-
- if (failed) {
- // error popup?
- // throw something?
- }
-
- pmCalls.debugShowPrinter(workingPrinter);
- dumpLogs("ModifyAttached()");
-
- if (workingPrinter.getPPD() != null)
- helpTag = "ModifyPPD";
- else
- helpTag = "Modify";
-
- // helpTag = "ModifyAttached";
-
- actionName = pmUtility.getResource("Modify.Printer.Properties");
- break;
-
- case Constants.MODIFYNETWORK:
-
- Debug.message("CLNT:pmInstPr: MODIFY NETWORK");
- frame = new pmFrame(
- pmUtility.getResource("SPM:Modify.Printer.Properties"));
- workingPrinter.setPrinterName(myTop.selectedPrinter);
-
- workingPrinter.setPrinterName(myTop.selectedPrinter);
- failed = false;
-
- try {
- workingPrinter.getPrinterDetails();
- } catch (Exception e) {
- failed = true;
- Debug.message("CLNT:pmInstPr:ModifyNetwork caught " + e);
- }
-
- gatherLogs(workingPrinter);
-
- if (failed) {
- // error popup?
- // throw new pmGuiException();
- }
-
- pmCalls.debugShowPrinter(workingPrinter);
- dumpLogs("ModifyNetwork()");
-
- if (workingPrinter.getPPD() != null)
- helpTag = "ModifyPPD";
- else
- helpTag = "Modify";
- // helpTag = "ModifyNetwork";
-
- actionName = pmUtility.getResource("Modify.Printer.Properties");
-
- break;
-
- case Constants.MODIFYREMOTE:
- Debug.message("CLNT:pmInstPr: MODIFY REMOTE");
- frame = new pmFrame(
- pmUtility.getResource("SPM:Modify.Printer.Properties"));
-
- workingPrinter.setPrinterName(myTop.selectedPrinter);
-
- failed = false;
- try {
- workingPrinter.getPrinterDetails();
- } catch (Exception e) {
- failed = true;
- Debug.warning("CLNT:pmInstPr:ModifyRemote caught " + e);
- }
- gatherLogs(workingPrinter);
-
- if (failed) {
- // error popup?
- // throw something?
- }
-
-
- if (workingPrinter.getPPD() != null)
- helpTag = "ModifyPPD";
- else
- helpTag = "Modify";
- // helpTag = "ModifyRemote";
-
- actionName = pmUtility.getResource("Modify.Printer.Properties");
- break;
-
- }
-
- // ensure that pmButton hashtable gets cleaned up
- frame.setClearButtonsOnClose(true);
-
- setLayout(new BorderLayout());
-
- // Build the Screen
- northPanel();
- if (action != Constants.MODIFYREMOTE) {
- centerPanel();
- }
-
- southPanel();
-
- // default button is always OK, for now...
- // frame.getRootPane().setDefaultButton (okButton);
- // okButton.setAsDefaultButton ();
-
- // handle Esc as cancel
- this.registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- actioncancelButton();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- if (action == Constants.ADDLOCAL || action == Constants.ADDNETWORK) {
- defaultComponent = pnameText;
- } else {
- defaultComponent = descText;
- }
-
- frame.setDefaultComponent(defaultComponent);
-
- defaultComponent.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- Debug.info("\ncomponent focus gained: " + e);
- }
- public void focusLost(FocusEvent e) {
- Debug.info("\ncomponent focus lost: " + e);
- }
- });
-
- }
-
-
- public class accessListModel extends AbstractListModel {
- int numColumns;
- Vector data;
- Vector access = new Vector(1, 1);
-
- public accessListModel() {
- numColumns = getColumnCount();
- }
-
- public void addaccessList(String data[]) {
-
- for (int i = 0; i < data.length; i++) {
- access.addElement(data[i]);
-
- }
- }
-
- public void addaccessList(String data) {
- access.addElement(data);
- }
-
- public boolean isduplicate(String d) {
- if (access == null)
- return false;
- else
- return access.contains(d);
- }
-
- public void removeRow(int row) {
- access.removeElementAt(row);
- }
-
- public void removeListEntries() {
- access.removeAllElements();
- }
-
- public int getRowCount() {
- return access.size();
- }
-
- public int getSize() {
- return access.size();
- }
-
- public int getColumnCount() {
- return 1;
- }
-
- public void addRow(Vector row) {
- access.addElement(row);
- }
-
- public Object getValueAt(int row) {
- return access.elementAt(row);
- }
-
- public Object getElementAt(int row) {
- return access.elementAt(row);
- }
-
- public Object getValueAt(int row, int col) {
- return access.elementAt(row);
- }
-
- public void setValueAt(String value, int row) {
- access.setElementAt(value, row);
- }
-
- public Vector getAccessList() {
- return access;
- }
-
- public void accesstoArray(String[] target) {
- access.copyInto(target);
- }
-
- }
-
- public void centerPanel() {
- JPanel center = new JPanel();
-
- accessModel = new accessListModel();
- accessList = new JList(accessModel);
- accessList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
-
- center.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- ListSelectionModel rowSelectModel = accessList.getSelectionModel();
- rowSelectModel.addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- ListSelectionModel accessSM =
- (ListSelectionModel)e.getSource();
- }
- });
-
- c.insets = new Insets(5, 5, 5, 5);
-
- // Create the label
- c.gridx = 0;
- c.gridy = 0;
- labelConstraints(c);
- center.add(new JLabel
- (pmUtility.getResource("User.Access.List:")), c);
-
- // Create User Access List
- String[] tmp = workingPrinter.getUserAllowList();
-
-
- if (tmp == null) {
- accessModel.addaccessList("all");
- } else {
- accessModel.addaccessList(tmp);
- }
-
- ascrollPane = new JScrollPane(accessList);
-
- c.gridwidth = 2;
- c.gridx = 1;
- c.weightx = c.weighty = 1.0;
- c.fill = GridBagConstraints.BOTH;
- center.add(ascrollPane, c);
-
- // Create Textfield
- c.gridx = 1;
- c.gridy = 1;
- c.ipadx = 15;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.WEST;
- c.weightx = c.weighty = 1.0;
- userText = new pmTextField(25);
- center.add(userText, c);
-
- // Add the Add/Delete Buttons
- c.gridx = 1;
- c.gridy = 2;
-
- adButtons(c);
-
- c.gridwidth = 1;
- center.add(addButton, c);
-
- c.gridx = 2;
- center.add(deleteButton, c);
-
- add("Center", center);
-
- }
-
- public void northPanel() {
- JPanel north = new JPanel();
- north.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- northPanelConstraints(c);
-
- // Define the constraints and create the labels
-
- // All Add/Modify
- labelConstraints(c);
- c.gridx = 0;
- c.gridy = 0;
- printernameLabel(north, c);
- c.gridy++;
- servernameLabel(north, c);
- c.gridy++;
- descriptionLabel(north, c);
- c.gridy++;
-
- // Add printers, modify local
- if (action != Constants.MODIFYREMOTE) {
-
- if ((action == Constants.ADDLOCAL) ||
- (action == Constants.MODIFYATTACHED)) {
- printerportLabel(north, c);
- c.gridy++;
- }
-
- if ((action == Constants.ADDLOCAL) ||
- (action == Constants.ADDNETWORK)) {
- if ((pmMisc.isppdCachefile()) && (usePPD)) {
- printermakeLabel(north, c);
- c.gridy++;
- printermodelsLabel(north, c);
- c.gridy++;
- ppdcontentsLabel(north, c);
- } else {
- printertypeLabel(north, c);
- c.gridy++;
- filecontentsLabel(north, c);
- }
- }
-
- if ((action == Constants.MODIFYATTACHED) ||
- (action == Constants.MODIFYNETWORK)) {
-
- // Show make/model/ppd or type/contents
-
- if (workingPrinter.getPPD() != null) {
-
- printermakeLabel(north, c);
- c.gridy++;
- printermodelsLabel(north, c);
- c.gridy++;
- ppdcontentsLabel(north, c);
- } else {
- printertypeLabel(north, c);
- c.gridy++;
- filecontentsLabel(north, c);
- }
- }
-
- c.gridy++;
- faultnotLabel(north, c);
- c.gridy++;
-
- if (action == Constants.ADDNETWORK ||
- action == Constants.MODIFYNETWORK) {
- destinationLabel(north, c);
- c.gridy++;
- protocolLabel(north, c);
- c.gridy++;
- }
-
- optionsLabel(north, c);
- c.gridy++;
- bannerLabel(north, c);
- } else {
- optionLabel(north, c);
- }
-
- // Define the constraints and create the fields
-
- // Add printers
- c.gridx = 1;
- c.gridy = 0;
-
- // Printer Name and Server Name
- if ((action == Constants.ADDLOCAL) ||
- (action == Constants.ADDNETWORK)) {
-
- TextFieldConstraints(c);
- printernameTextField(north, c);
- c.gridy++;
- labelConstraints(c);
- try {
- north.add(new JLabel(
- myTop.host.getLocalHostName()), c);
- } catch (Exception e) {
- Debug.warning(
- "CLNT:pmInstPr:getLocalHostName exception " + e);
- north.add(new JLabel(" "), c);
- }
- c.gridy++;
- } else {
- labelConstraints(c);
- north.add(new JLabel(myTop.selectedPrinter), c);
- c.gridy++;
- labelConstraints(c);
- north.add(new JLabel(myTop.selprinterServer), c);
- c.gridy++;
- }
-
- // Description
- TextFieldConstraints(c);
- descriptionField(north, c);
- if (action == Constants.MODIFYATTACHED ||
- action == Constants.MODIFYNETWORK ||
- action == Constants.MODIFYREMOTE) {
- if (workingPrinter.getComment() != null)
- descText.setText(workingPrinter.getComment());
- }
- c.gridy++;
-
- if (action != Constants.MODIFYREMOTE) {
- if (action == Constants.ADDLOCAL) {
- comboboxConstraints(c);
- printerportField(north, c);
- c.gridy++;
-
- } else if (action == Constants.MODIFYATTACHED) {
- labelConstraints(c);
- north.add(new JLabel(workingPrinter.getDevice()), c);
- c.gridy++;
- }
-
- comboboxConstraints(c);
-
- if ((action == Constants.ADDLOCAL) ||
- (action == Constants.ADDNETWORK)) {
- if ((pmMisc.isppdCachefile()) && (usePPD)) {
- printermakeField(north, c);
- c.gridy++;
- printermodelsField(north, c);
- c.gridy++;
- ppdcontentsField(north, c);
- } else {
- printertypeField(north, c);
- c.gridy++;
- filecontentsField(north, c);
- }
- }
-
- if ((action == Constants.MODIFYATTACHED) ||
- (action == Constants.MODIFYNETWORK)) {
-
- if (workingPrinter.getPPD() != null) {
-
- printermakeField(north, c);
- c.gridy++;
- printermodelsField(north, c);
- c.gridy++;
- ppdcontentsField(north, c);
-
- setMake();
- setModel();
- setPPD();
-
- } else {
- // display with printer type and file contents
-
- printertypeField(north, c);
- setPrinterType();
-
- c.gridy++;
-
- filecontentsField(north, c);
- setType();
- }
- }
-
- c.gridy++;
-
- faultnotField(north, c);
- if (action == Constants.MODIFYATTACHED ||
- action == Constants.MODIFYNETWORK) {
-
- setFault();
- }
- c.gridy++;
-
- if (action == Constants.ADDNETWORK ||
- action == Constants.MODIFYNETWORK) {
-
- TextFieldConstraints(c);
- destinationField(north, c);
- c.gridy++;
- comboboxConstraints(c);
- protocolField(north, c);
- c.gridy++;
- if (action == Constants.MODIFYNETWORK)
- setNetworkInfo();
- }
-
- optionsConstraints(c);
- optionsFields(north, c);
- if (action == Constants.MODIFYATTACHED ||
- action == Constants.MODIFYNETWORK) {
- if (workingPrinter.getIsDefaultPrinter()) {
- defaultp.doClick();
- }
- setBanner();
- }
- } else {
- optionsConstraints(c);
- defaultoptionField(north, c);
- if (workingPrinter.getIsDefaultPrinter()) {
- defaultp.doClick();
- }
- }
-
- add("North", north);
- }
-
- public void setNetworkInfo() {
- String p = workingPrinter.getProtocol();
-
- if (p != null) {
- if (p.equals("bsd"))
- protocolCombo.setSelectedItem("BSD");
- else if (p.equals("tcp"))
- protocolCombo.setSelectedItem("TCP");
- else if (p.equals("uri"))
- protocolCombo.setSelectedItem("URI");
-
- }
-
- if (destText != null)
- destText.setText(workingPrinter.getDestination());
- }
-
- public void setMake() {
- String make = workingPrinter.getMake();
- if (make != null) {
- makeCombo.setSelectedItem(make);
- }
- }
- public void setModel() {
- String model = workingPrinter.getModel();
- if (model != null)
- modelCombo.setSelectedItem(model);
- }
- public void setPPD() {
- String ppd = workingPrinter.getPPD();
- if (ppd != null)
- ppdCombo.setSelectedItem(ppd);
- }
-
- public void setFault() {
- String fault = workingPrinter.getNotify();
-
- if (fault == null || fault == "none")
- faultCombo.setSelectedItem(
- pmUtility.getResource("None"));
-
- else if (fault.equals("write"))
- faultCombo.setSelectedItem(
- pmUtility.getResource("Write.to.Superuser"));
-
- else if (fault.equals("mail"))
- faultCombo.setSelectedItem(
- pmUtility.getResource("Mail.to.Superuser"));
- else {
- faultCombo.addItem(fault);
- faultCombo.setSelectedItem(fault);
- }
- }
-
- public void setBanner() {
- String banner = workingPrinter.getBanner();
-
- if (banner == null)
- bannerCombo.setSelectedItem(
- pmUtility.getResource("Always.Print.Banner"));
-
- else if (banner.equals("never"))
- bannerCombo.setSelectedItem(
- pmUtility.getResource("Never.Print.Banner"));
-
- else if (banner.equals("always"))
- bannerCombo.setSelectedItem(
- pmUtility.getResource("Always.Print.Banner"));
-
- else if (banner.equals("optional"))
- bannerCombo.setSelectedItem(
- pmUtility.getResource("User.Selectable.Default.On"));
- }
-
- public void setType() {
- // lpadmin can combine things like: simple,any ...
-
- String filedata[] = workingPrinter.getFileContents();
- String filecontents = new String();
-
- if (filedata == null) {
- fileCombo.setSelectedItem(
- pmUtility.getResource("None"));
- } else {
- for (int i = 0; i < filedata.length; i++) {
- if (i > 0 && filedata[i] != null)
- filecontents = filecontents.concat(",");
-
- filecontents = filecontents.concat(filedata[i]);
- }
- Debug.message("CLNT:pmInstPr:setType: filecontents = " +
- filecontents);
-
- if (filecontents.equals("postscript")) {
- fileCombo.setSelectedItem(pmUtility.getResource(
- "PostScript"));
- } else if (filecontents.equals("application/postscript")) {
- fileCombo.setSelectedItem(pmUtility.getResource(
- "PostScript"));
-
- } else if (filecontents.equals("simple")) {
- fileCombo.setSelectedItem(pmUtility.getResource("ASCII"));
- } else if (filecontents.equals("text/plain")) {
- fileCombo.setSelectedItem(pmUtility.getResource("ASCII"));
-
- } else if (filecontents.equals("postscript,simple")) {
- fileCombo.setSelectedItem(pmUtility.getResource(
- "Both.PostScript.and.ASCII"));
- } else if (filecontents.equals("simple,postscript")) {
- fileCombo.setSelectedItem(pmUtility.getResource(
- "Both.PostScript.and.ASCII"));
- } else if (filecontents.equals(
- "text/plain,application/postscript")) {
- fileCombo.setSelectedItem(pmUtility.getResource(
- "Both.PostScript.and.ASCII"));
-
- } else if (filecontents.equals("none")) {
- fileCombo.setSelectedItem(
- pmUtility.getResource("None"));
- } else if (filecontents.equals("any")) {
- fileCombo.setSelectedItem(
- pmUtility.getResource("Any"));
- } else if (filecontents.equals("application/octet-stream")) {
- fileCombo.setSelectedItem(
- pmUtility.getResource("Any"));
- } else {
- Debug.message(
- "CLNT:pmInstPr:setType()unknown file contents type");
- fileCombo.addItem(filecontents);
- fileCombo.setSelectedItem(filecontents);
- }
- }
- }
-
- public void setPrinterType() {
- int x = 0;
- String type = workingPrinter.getPrinterType();
- Debug.message(
- "CLNT:pmInstPrsetPrinterType(): printer type is " + type);
-
- if (type == null)
- return;
-
- if (type.equals("PS")) {
- typeCombo.setSelectedItem("PostScript");
- } else if (type.equals("hplaser")) {
- typeCombo.setSelectedItem("HP Printer");
- } else if (type.equals("PSR")) {
- typeCombo.setSelectedItem("Reverse PostScript");
- } else if (type.equals("epson2500")) {
- typeCombo.setSelectedItem("Epson 2500");
- } else if (type.equals("ibmproprinter")) {
- typeCombo.setSelectedItem("IBM ProPrinter");
- } else if (type.equals("qume5")) {
- typeCombo.setSelectedItem("Qume Sprint 5");
- } else if (type.equals("daisy")) {
- typeCombo.setSelectedItem("Daisy");
- } else if (type.equals("diablo")) {
- typeCombo.setSelectedItem("Diablo");
- } else if (type.equals("datagraphix")) {
- typeCombo.setSelectedItem("Datagraphix");
- } else if (type.equals("la100")) {
- typeCombo.setSelectedItem("DEC LA100");
- } else if (type.equals("ln03")) {
- typeCombo.setSelectedItem("DEC LN03");
- } else if (type.equals("decwriter")) {
- typeCombo.setSelectedItem("Dec Writer");
- } else if (type.equals("ti800")) {
- typeCombo.setSelectedItem("Texas Instruments 800");
- } else {
- typeCombo.addItem(type);
- typeCombo.setSelectedItem(type);
- Debug.message(
- "CLNT:pmInstPr:setPrinterType(): user defined type " +
- type);
- }
-
- }
-
- public void getMakeModelPPD() throws pmGuiException {
- if (pmMisc.isppdCachefile()) {
- getMake();
-
- model = (String)modelCombo.getSelectedItem();
- ppd = (String)ppdCombo.getSelectedItem();
- }
- }
-
- public void getTypeContents() throws pmGuiException {
- ptype = (String)typeCombo.getSelectedItem();
- fcontents = (String)fileCombo.getSelectedItem();
- }
-
- public void getFault() throws pmGuiException {
- faultn = (String)faultCombo.getSelectedItem();
- }
-
- public void getBanner() throws pmGuiException {
- banner = (String)bannerCombo.getSelectedItem();
- }
-
- public void getPrinterServer() throws pmGuiException {
-
- // Printer Name is a required field.
- printer = pnameText.getText();
- if (printer.equals("")) {
- pnameText.requestFocus();
- throw new pmIncompleteFormException(
- pmUtility.getResource("Printer.name.required."));
- }
-
- if (!Valid.localPrinterName(printer)) {
- pnameText.requestFocus();
- throw new pmIncompleteFormException(
- pmUtility.getResource("Printer.name.invalid."));
- }
-
- server = null;
- try {
- if ((useLocalhost))
- server = "localhost";
- else
- server = myTop.host.getLocalHostName();
- } catch (Exception e) {
- Debug.warning(
- "CLNT:pmInstPr:getLocalHostName exception " + e);
- }
-
- Debug.message(
- "CLNT:pmInstPr:getPrinterServer(): printer is: " + printer);
- Debug.message(
- "CLNT:pmInstPr:getPrinterServer(): server is: " + server);
-
- }
-
- public void getPort() throws pmGuiException {
- port = (String)portCombo.getSelectedItem();
- if (port.equals(pmUtility.getResource("Not.Selected"))) {
- portCombo.requestFocus();
- throw new pmIncompleteFormException
- (pmUtility.getResource(
- "Printer.Port.Selection.required"));
- }
- Debug.message("CLNT:pmInstPr:getPort(): port is: " + port);
- }
-
- public void getMake() throws pmGuiException {
- make = (String)makeCombo.getSelectedItem();
- if (make.equals(pmUtility.getResource("Not.Selected"))) {
- makeCombo.requestFocus();
- throw new pmIncompleteFormException
- (pmUtility.getResource(
- "Printer.Make.Selection.required"));
- }
- Debug.message("CLNT:pmInstPr:getMake(): make is: " + make);
- }
-
- public void getNetworkInfo() throws pmIncompleteFormException {
- destination = destText.getText();
- if (destination.equals("")) {
- destText.requestFocus();
- throw new pmIncompleteFormException(
- pmUtility.getResource("Destination.required."));
- }
-
- if (!Valid.destination(destination)) {
- destText.requestFocus();
- throw new pmIncompleteFormException(
- pmUtility.getResource("Destination.invalid."));
- }
-
- protocol = (String)protocolCombo.getSelectedItem();
- port = new String("/dev/null");
- Debug.message(
- "CLNT:pmInstPr:getNetworkInfo(): destination is: " +
- destination);
- Debug.message(
- "CLNT:pmInstPr:getNetworkInfo(): protocol is: " + protocol);
- }
-
- public void getDescription() {
-
- String messy;
-
- messy = descText.getText();
- description = messy.trim();
- Debug.message(
- "CLNT:pmInstPr:getDescription():description: " + "<" +
- description + ">");
-
- if (workingPrinter.getComment() == null && description.equals(""))
- description = null;
-
- }
-
- public void getUserAccess() {
-
- if (accessModel.getRowCount() != 0) {
- useraccesslist = new String[accessModel.getRowCount()];
- accessModel.accesstoArray(useraccesslist);
- } else {
- useraccesslist = null;
- }
- }
-
- public String gui2lpptype(String t) {
- String lp;
-
- if (t != null) {
- if (t.equals("PostScript"))
- lp = new String("PS");
- else if (t.equals("HP Printer"))
- lp = new String("hplaser");
- else if (t.equals("Reverse PostScript"))
- lp = new String("PSR");
- else if (t.equals("Epson 2500"))
- lp = new String("epson2500");
- else if (t.equals("IBM ProPrinter"))
- lp = new String("ibmproprinter");
- else if (t.equals("Qume Sprint 5"))
- lp = new String("qume5");
- else if (t.equals("Daisy"))
- lp = new String("daisy");
- else if (t.equals("Diablo"))
- lp = new String("diablo");
- else if (t.equals("Datagraphix"))
- lp = new String("datagraphix");
- else if (t.equals("DEC LA100"))
- lp = new String("la100");
- else if (t.equals("DEC LN03"))
- lp = new String("ln03");
- else if (t.equals("Dec Writer"))
- lp = new String("decwriter");
- else if (t.equals("Texas Instruments 800"))
- lp = new String("ti800");
- else {
- Debug.message(
- "CLNT:pmIns:gui2lptype: printer type unknown: " + t);
- lp = new String(t);
- }
- } else {
- Debug.message("CLNT:pmInstPr:gui2lptype: input printer type null");
- lp = new String("");
- }
-
- return lp;
- }
-
- public String[] gui2lpfcontents(String f) {
-
- String[] lp = null;
-
- if (f != null) {
- if (f.equals(pmUtility.getResource("PostScript"))) {
- lp = new String[1];
- lp[0] = new String("postscript");
- } else if (f.equals(pmUtility.getResource("ASCII"))) {
- lp = new String[1];
- lp[0] = new String("simple");
- } else if (f.equals(pmUtility.getResource(
- "Both.PostScript.and.ASCII"))) {
- lp = new String[2];
- lp[0] = new String("simple");
- lp[1] = new String("postscript");
- } else if (f.equals(pmUtility.getResource("Any"))) {
- lp = new String[1];
- lp[0] = new String("any");
- } else if (f.equals(pmUtility.getResource("None"))) {
- lp = new String[1];
- lp[0] = new String("none");
- }
- } else {
- Debug.message(
- "CLNT:pmInstPr:gui2lpfcontents(): input string null");
- }
-
- return lp;
- }
-
- public String gui2lpfaultn(String n) {
- String lp = null;
- if (n != null) {
- if (n.equals(pmUtility.getResource("Write.to.Superuser")))
- lp = new String("write");
- else if (n.equals(pmUtility.getResource("Mail.to.Superuser")))
- lp = new String("mail");
- else if (n.equals(pmUtility.getResource("None")))
- lp = new String("none");
-
- } else {
- Debug.message(
- "CLNT:pmInstPr:gui2lpfaultn():input faultnotify null");
- }
- return lp;
- }
-
- public String gui2lpprotocol(String p) {
- String lp = null;
- if (p.equals("TCP"))
- lp = new String("tcp");
- else if (p.equals("BSD"))
- lp = new String("bsd");
- else if (p.equals("URI"))
- lp = new String("uri");
- else {
- Debug.message(
- "CLNT:pmInstPr:gui2lpprotocol: protocol is empty");
- }
- return lp;
- }
-
- public String gui2lpbanner(String p) {
- String lp = null;
- if (p.equals(pmUtility.getResource("Always.Print.Banner")))
- lp = new String("always");
- else if (p.equals(pmUtility.getResource("Never.Print.Banner")))
- lp = new String("never");
- else if (p.equals(pmUtility.getResource("User.Selectable.Default.On")))
- lp = new String("optional");
- else {
- Debug.message(
- "CLNT:pmInstPr:gui2lpbanner(): banner is empty");
- }
-
- if (lp != null)
- Debug.message(
- "CLNT:pmInstPr:gui2lpbanner(): banner is " + lp);
- return lp;
-
- }
-
- public void updatePrinter() {
- if (workingPrinter != null) {
- if (printer != null)
- workingPrinter.setPrinterName(printer);
- if (server != null) {
- workingPrinter.setPrintServer(server);
- }
- if (description != null)
- workingPrinter.setComment(description);
- if ((port != null) &&
- (!port.equals(pmUtility.getResource("Not.Selected"))))
- workingPrinter.setDevice(port);
- if (make != null) {
- workingPrinter.setMake(make);
- }
- if (model != null) {
- workingPrinter.setModel(model);
- }
- if (ppd != null) {
- workingPrinter.setPPD(ppd);
- }
-
- workingPrinter.setUsePPD(usePPD);
-
- if (ptype != null)
- workingPrinter.setPrinterType(gui2lpptype(ptype));
- if (fcontents != null)
- workingPrinter.setFileContents(gui2lpfcontents(fcontents));
- if (faultn != null)
- workingPrinter.setNotify(gui2lpfaultn(faultn));
- if (destination != null)
- workingPrinter.setDestination(destination);
- if (protocol != null)
- workingPrinter.setProtocol(gui2lpprotocol(protocol));
- if (useraccesslist != null)
- workingPrinter.setUserAllowList(useraccesslist);
- else {
- String[] a = new String[1];
- a[0] = new String("none");
- workingPrinter.setUserAllowList(a);
- }
-
- if (defaultp != null)
- workingPrinter.setIsDefaultPrinter(defaultp.isSelected());
-
- if (banner != null)
- workingPrinter.setBanner(gui2lpbanner(banner));
-
- } else {
- Debug.warning(
- "CLNT:pmInstPr:updatePrinter(): workingPrinter null");
- }
- }
-
-
- void gatherLogs(Printer p) {
- cmdLog = p.getCmdLog();
- errorLog = p.getErrorLog();
- warnLog = p.getWarnLog();
- }
-
-
- void dumpLogs(String who) {
- Debug.message(who);
- Debug.message(who + " command: " + cmdLog);
- Debug.message(who + " warnings: " + warnLog);
- Debug.message(who + " errors: " + errorLog);
- }
-
-
- public void doAddLocal() throws pmGuiException {
-
- try {
- getPrinterServer();
- getDescription();
- getPort();
- if ((pmMisc.isppdCachefile()) && (usePPD)) {
- getMakeModelPPD();
- } else {
- getTypeContents();
- }
- getFault();
- getBanner();
- getUserAccess();
- updatePrinter();
-
- } catch (pmIncompleteFormException ie) {
- throw new pmIncompleteFormException(ie.getMessage());
- }
-
-
- boolean exist;
- boolean failed = false;
-
- // exists could throw an exception from the underyling cmds...
- try {
- exist = PrinterUtil.exists(printer, myTop.ns);
- } catch (Exception e) {
- throw new pmGuiException();
- }
-
- if (exist) {
- throw new pmPrinterExistsException();
- }
-
- try {
- workingPrinter.addLocalPrinter();
- } catch (Exception e) {
- failed = true;
- } finally {
- gatherLogs(workingPrinter);
- pmCalls.debugShowPrinter(workingPrinter);
- dumpLogs("doAddLocal()");
- if (failed)
- throw new pmAddPrinterFailedException(errorLog);
- }
-
- }
-
-
- public void doAddNetwork() throws pmGuiException {
- try {
- getPrinterServer();
- getDescription();
- getNetworkInfo();
- if ((pmMisc.isppdCachefile()) && (usePPD)) {
- getMakeModelPPD();
- } else {
- getTypeContents();
- }
- getFault();
- getBanner();
- getUserAccess();
- updatePrinter();
- } catch (pmIncompleteFormException ie) {
- throw new pmIncompleteFormException(ie.getMessage());
- }
-
- boolean exist = false;
-
- try {
- exist = PrinterUtil.exists(printer, myTop.ns);
- } catch (Exception e) {
- Debug.message(
- "CLNT:pmInstPr:doAddNetwork:printer exists " + e);
- throw new pmGuiException();
- }
-
- if (exist) {
- Debug.message(
- "CLNT:pmInstPr:Trying to add existing printer: " + printer);
- throw new pmPrinterExistsException();
- }
-
- boolean failed = false;
- try {
- workingPrinter.addLocalPrinter();
- } catch (Exception e) {
- failed = true;
- } finally {
- gatherLogs(workingPrinter);
- pmCalls.debugShowPrinter(workingPrinter);
- dumpLogs("doAddNetwork()");
- if (failed)
- throw new pmAddPrinterFailedException(errorLog);
- }
- }
-
-
- public void doModifyLocalAttached() throws pmGuiException {
- getDescription();
- getFault();
- getBanner();
-
- if (workingPrinter.getPPD() != null) {
- getMakeModelPPD();
- } else {
- getTypeContents();
- }
- getUserAccess();
- updatePrinter();
-
- boolean failed = false;
- try {
- workingPrinter.modifyPrinter();
- } catch (Exception e) {
- Debug.warning("CLNT:doModifyLocalAttached: " + e);
- failed = true;
- } finally {
- gatherLogs(workingPrinter);
- pmCalls.debugShowPrinter(workingPrinter);
- dumpLogs("doModifyLocalAttached()");
- if (failed)
- throw new pmModifyPrinterFailedException(errorLog);
- }
-
- }
-
- public void doModifyLocalNetwork() throws pmGuiException {
- getDescription();
- getNetworkInfo();
- getFault();
- getBanner();
- if (workingPrinter.getPPD() != null) {
- getMakeModelPPD();
- } else {
- getTypeContents();
- }
- getUserAccess();
- updatePrinter();
-
- boolean failed = false;
- try {
- workingPrinter.modifyPrinter();
- } catch (Exception e) {
- Debug.warning("CLNT:pmInstPr:doModifyLocalNetwork: " + e);
- failed = true;
- } finally {
- gatherLogs(workingPrinter);
- pmCalls.debugShowPrinter(workingPrinter);
- dumpLogs("doModifyLocalNetwork()");
- if (failed)
- throw new pmModifyPrinterFailedException(errorLog);
- }
-
- }
-
-
- public void doModifyRemote() throws pmGuiException {
- getDescription();
- updatePrinter();
-
- boolean failed = false;
- try {
- workingPrinter.modifyPrinter();
- } catch (Exception e) {
- Debug.warning("CLNT:doModifyRemote: " + e);
- failed = true;
- } finally {
- gatherLogs(workingPrinter);
- pmCalls.debugShowPrinter(workingPrinter);
- dumpLogs("doModifyRemote()");
- if (failed)
- throw new pmModifyPrinterFailedException(errorLog);
- }
-
- }
-
-
- public void doClearFields() {
-
- if (pnameText != null)
- pnameText.setText("");
- if (snameText != null)
- snameText.setText("");
- if (descText != null)
- descText.setText("");
- if (portCombo != null)
- portCombo.setSelectedIndex(0);
- if (makeCombo != null)
- makeCombo.setSelectedIndex(0);
- if (modelCombo != null)
- modelCombo.setSelectedIndex(0);
- if (ppdCombo != null)
- ppdCombo.setSelectedIndex(0);
- if (typeCombo != null)
- typeCombo.setSelectedIndex(0);
- if (faultCombo != null)
- faultCombo.setSelectedIndex(0);
- if (protocolCombo != null)
- protocolCombo.setSelectedIndex(0);
- if (destText != null)
- destText.setText("");
-
- if (defaultp.isSelected())
- defaultp.doClick();
-
- if (bannerCombo != null)
- bannerCombo.setSelectedIndex(0);
-
- accessModel.removeListEntries();
- accessModel.addaccessList("all");
- }
-
- public void doResetFields() {
-
- if (workingPrinter != null) {
- try {
- if (workingPrinter.getComment() != null)
- descText.setText(workingPrinter.getComment());
- else
- descText.setText("");
- } catch (Exception e) {
- Debug.message(
- "CLNT:pmInstallPr:doResetFields(): getComment() " +
- "Exception: " + e);
- }
-
- if (action == Constants.ADDLOCAL ||
- action == Constants.ADDNETWORK ||
- action == Constants.MODIFYATTACHED) {
- try {
- portCombo.setSelectedItem(workingPrinter.getDevice());
- } catch (Exception e) {
- Debug.message(
- "CLNT:pmInsPr:doResetFields(): getDevice() " +
- "Exception: " + e);
- }
- }
-
- if (action != Constants.MODIFYREMOTE) {
- if (workingPrinter.getPPD() != null) {
- setMake();
- setModel();
- setPPD();
- } else {
- setPrinterType();
- setType();
- }
-
- setFault();
-
- if (action == Constants.MODIFYNETWORK)
- setNetworkInfo();
-
- try {
- accessModel.removeListEntries();
- accessModel.addaccessList(
- workingPrinter.getUserAllowList());
- accessList.setListData(accessModel.getAccessList());
- accessList.ensureIndexIsVisible(0);
- } catch (Exception e) {
- Debug.warning(
- "CLNT:InstPr:doResetFields(): addaccessList() " +
- "Exception: " + e);
- } finally {
- accessList.clearSelection();
- }
-
-
-
- // selected and banner object out of sync
- setBanner();
- }
-
- // selected and printer object out of sync
- if ((defaultp.isSelected() &&
- !workingPrinter.getIsDefaultPrinter()) ||
-
- (!defaultp.isSelected() &&
- workingPrinter.getIsDefaultPrinter()))
-
- defaultp.doClick();
-
- }
- }
-
-
-
- public boolean isactionModify() {
-
- if (action == Constants.MODIFYATTACHED ||
- action == Constants.MODIFYNETWORK ||
- action == Constants.MODIFYREMOTE)
-
- return true;
- else
- return false;
- }
-
- public void doReset() {
- Debug.message("CLNT:pmInsPr:doReset()");
- if (action == Constants.ADDLOCAL ||
- action == Constants.ADDNETWORK) {
-
- doClearFields();
- } else {
- doResetFields();
- }
-
- // as a side effect, the OK button will regain default status
- if (defaultComponent != null)
- defaultComponent.requestFocus();
- }
-
- public void doAction() throws pmGuiException {
-
- // if nameservice, check for login
-
- if (myTop.ns.getNameService().equals("nis") == true ||
- myTop.ns.getNameService().equals("ldap") == true) {
- try {
- if (!myTop.ns.isAuth()) {
- pmUtility.doLogin(myTop, frame);
- }
- } catch (pmUserCancelledException e) {
- throw new pmLoginFailedException(
- pmUtility.getResource("User.cancelled.login."));
- } catch (pmGuiException ge) {
- Debug.message("CLNT:pmInstPr: Required login failed.");
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource("Required.login.failed."),
- myTop,
- "LoginFailed");
- m.setVisible(true);
- Debug.message("CLNT:pmInstPr:required login failed.");
- throw new pmLoginFailedException(
- pmUtility.getResource("Required.login.failed."));
- } catch (Exception e) {
- Debug.message("CLNT:pmInstPr:login exception: " + e);
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource("Required.login.failed."),
- myTop,
- "LoginFailed");
- m.setVisible(true);
- throw new pmLoginFailedException(
- pmUtility.getResource("Required.login.failed."));
- }
- }
-
- frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
- Debug.message("CLNT:pmInstPr:doAction: action " + action);
-
- // Check for confirmation option
- if (((myTop.getConfirmOption() == true) && (confirmAction() == true))
- || (myTop.getConfirmOption() == false)) {
-
- try {
-
- switch (action) {
-
- case Constants.ADDLOCAL:
- doAddLocal();
- break;
- case Constants.ADDNETWORK:
- doAddNetwork();
- break;
- case Constants.MODIFYATTACHED:
- workingPrinter.getPrinterDetails();
- Debug.message(
- "CLNT:pmInstPr:Printer Details: server is " +
- workingPrinter.getPrintServer());
- doModifyLocalAttached();
- break;
- case Constants.MODIFYNETWORK:
- // add dest and protocol
- workingPrinter.getPrinterDetails();
- Debug.message("CLNT:pmInstPr:Printer Details: server is " +
- workingPrinter.getPrintServer());
- doModifyLocalNetwork();
- break;
- case Constants.MODIFYREMOTE:
- workingPrinter.getPrinterDetails();
- doModifyRemote();
- break;
- }
-
- } catch (pmIncompleteFormException fe) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- fe.getMessage()); // "FormError"
- m.setVisible(true);
- throw new pmIncompleteFormException();
- } catch (pmPrinterExistsException ee) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "The.specified.printer.already.exists."));
- m.setVisible(true);
- } catch (pmNullSelectedPrinterException ne) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "The.selected.printer.does.not.exist."));
- m.setVisible(true);
- cleanup();
- // frame.dispose();
- } catch (pmAddPrinterFailedException ae) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- ae.getMessage(),
- myTop,
- "AddPrinterFailed");
- m.setVisible(true);
-
- } catch (pmModifyPrinterFailedException me) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- me.getMessage(),
- myTop,
- "ModifyFailed");
- m.setVisible(true);
- } catch (pmGuiException ge) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Application.Error"),
- ge.toString());
- m.setVisible(true);
-
- } catch (pmCmdFailedException cfe) {
- String msg = cfe.getMessage();
- if (msg == null || msg.length() == 0)
- msg = pmUtility.getResource(
- "error.message.command-failed");
-
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Command.Failed.Error"),
- msg);
- m.setVisible(true);
-
- } catch (Exception e) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Unknown.Application.Error"),
- e.toString());
- m.setVisible(true);
-
- } finally {
- frame.setCursor(Cursor.getDefaultCursor());
- myTop.setLogData(cmdLog, errorLog, warnLog);
- myTop.showLogData(actionName);
- }
-
- // Update the list of printers
- myTop.pmsetPrinterList();
- }
-
- }
-
- public boolean confirmAction() {
- if (myTop.getConfirmOption() == true) {
- pmOKCancelDialog d = new pmOKCancelDialog(frame,
- pmUtility.getResource("Action.Confirmation"),
- pmUtility.getResource(
- "Continue.action.for.this.printer?"));
- d.setVisible(true);
- if (d.getValue() != JOptionPane.OK_OPTION) {
- pmMessageDialog m =
- new pmMessageDialog(
- frame,
- pmUtility.getResource("Warning"),
- pmUtility.getResource("Operation.Cancelled"));
- m.setVisible(true);
- return false;
- }
- }
- return true;
- }
-
-
- public void actionportCombo() {
- Debug.message("CLNT:pmInstPr:actionportCombo()");
- port = (String)portCombo.getSelectedItem();
- if (port.equals(pmUtility.getResource("Other..."))) {
- pmOther o = new pmOther(
- frame,
- pmUtility.getResource("SPM:Specify.Printer.Port"),
- pmUtility.getResource("Enter.printer.port.or.file"),
- myTop,
- "PrinterPort");
-
- o.setVisible(true);
- if (o.getValue() == JOptionPane.OK_OPTION) {
- port = o.deviceName.getText();
- int idx = portCombo.getItemCount();
- try {
- if (!port.equals("") && Valid.device(port)) {
- portCombo.insertItemAt(
- port, (idx > 0) ? idx -1 : idx);
- portCombo.setSelectedItem(port);
- } else if (!port.equals("")) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "Device.missing.or.not.writeable."),
- myTop,
- "PrinterPort"); // "InvalidDevice"
- m.setVisible(true);
- if (olddevice == null)
- portCombo.setSelectedIndex(0);
- else
- portCombo.setSelectedItem(olddevice);
- } else {
- if (olddevice == null)
- portCombo.setSelectedIndex(0);
- else
- portCombo.setSelectedItem(olddevice);
- }
- } catch (Exception de) {
- Debug.warning(
- "CLNT:pmInstPr:error validating device" + de);
- }
-
- } else { // Cancelled out of Other window
- if (olddevice == null)
- portCombo.setSelectedIndex(0);
- else
- portCombo.setSelectedItem(olddevice);
- }
- }
- olddevice = (String)portCombo.getSelectedItem();
- if (!port.equals(pmUtility.getResource("Not.Selected"))) {
- portCombo.removeItem(pmUtility.getResource("Not.Selected"));
- if ((pmMisc.isppdCachefile()) && (usePPD)) {
- String makemodel[] = null;
- String tmake;
- int idx;
- String models[] = null;
- int i;
-
- makemodel = PrinterUtil.getProbePrinter(olddevice);
- if (makemodel != null) {
- if ((makemodel[0] != null) &&
- (!makemodel[0].equals(null))) {
-
- idx = (makemodel[0]).indexOf(" ");
-
- Debug.message(
- "CLNT: makemodel[0] = " + makemodel[0]);
- Debug.message(
- "CLNT: makemodel[1] = " + makemodel[1]);
-
- if (idx != -1)
- tmake = new String(makemodel[0].substring(0, idx));
- else
- tmake = new String(makemodel[0]);
-
- // Some Manufacturers have multiple names
- // Collapse them
- if ((tmake.equals("hp")) ||
- (tmake.equals("Hewlett-Packard")) ||
- (tmake.equals("HEWLETT-PACKARD")))
- tmake = new String("HP");
-
- if ((tmake.equals("MINOLTA-QMS")) ||
- (tmake.equals("MINOLTA")))
- tmake = new String("Minolta");
-
- if ((tmake.equals("OKI")) ||
- (tmake.equals("OKI DATA CORP")))
- tmake = new String("Okidata");
-
- if (tmake.equals("XEROX"))
- tmake = new String("Xerox");
-
- if (tmake.equals("EPSON"))
- tmake = new String("Epson");
-
- Debug.message("CLNT:pmInstPr:Probe:make: " + tmake);
-
- if ((makemodel[1] != null) &&
- (!makemodel[1].equals(null))) {
-
- Debug.message(
- "CLNT:pmInstPr:Probe:model: " + makemodel[1]);
-
- try {
- models = PrinterUtil.getModelsList(
- tmake.trim());
- } catch (Exception e) {
- Debug.warning(
- "CLNT:pmInstPr:getModelsList: exception" + e);
- }
-
- boolean havemodel = false;
- boolean addmake = false;
-
- if (models == null) {
- Debug.warning(
- "CLNT:pmInstPr:Probe:no models for "
- + tmake);
- } else {
- for (i = 0; i < models.length; i++) {
- if (models[i].equalsIgnoreCase(
- makemodel[1].trim())) {
- havemodel = true;
- }
- }
- // Some Printers do not preceed the model
- // name with the Make. If fail, try adding
- // Make to front of model
- if (!havemodel) {
- for (i = 0; i < models.length; i++) {
- if (models[i].equalsIgnoreCase(
- tmake.trim() +
- " " + makemodel[1].trim())) {
- havemodel = true;
- addmake = true;
-
- }
- }
- }
-
- if (havemodel) {
- makeCombo.setSelectedItem(tmake);
- if (!addmake) {
- modelCombo.setSelectedItem(makemodel[1]);
- Debug.message("CLNT:pmInstPr:model is " +
- makemodel[1]);
- } else {
- modelCombo.setSelectedItem(tmake.trim() +
- " " + makemodel[1]);
- Debug.message("CLNT:pmInstPr:model is " +
- tmake.trim() + " " + makemodel[1]);
- }
-
- }
- }
- }
- }
- }
- }
- }
- }
-
- public void actiontypeCombo() {
-
- Debug.message("CLNT:pmInstPr:actiontypeCombo()");
- ptype = (String)typeCombo.getSelectedItem();
-
- if (ptype.equals(pmUtility.getResource("Other..."))) {
- pmOther o = new pmOther(
- frame,
- pmUtility.getResource("SPM:Specify.Printer.Type"),
- pmUtility.getResource("Enter.printer.type:"),
- myTop,
- "PrinterType");
- o.setVisible(true);
- if (o.getValue() == JOptionPane.OK_OPTION) {
- ptype = o.deviceName.getText();
- int idx = typeCombo.getItemCount();
- try {
- if (!ptype.equals("") && Valid.printerType(ptype)) {
- typeCombo.insertItemAt(
- ptype, (idx > 0) ? idx -1 : idx);
- typeCombo.setSelectedItem(ptype);
- } else if (!ptype.equals("")) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "Invalid.printer.type."),
- myTop,
- "PrinterType");
- m.setVisible(true);
- if (oldptype == null)
- typeCombo.setSelectedIndex(0);
- else
- typeCombo.setSelectedItem(oldptype);
- } else {
- if (oldptype == null)
- typeCombo.setSelectedIndex(0);
- else
- typeCombo.setSelectedItem(oldptype);
- }
-
- } catch (Exception pte) {
- Debug.message(
- "CLNT:pmInstPr:error validating printertype"
- + pte);
- }
-
- } else { // Cancelled out of Other window
- if (oldptype == null)
- typeCombo.setSelectedIndex(0);
- else
- typeCombo.setSelectedItem(oldptype);
- }
- }
- oldptype = (String)typeCombo.getSelectedItem();
- }
-
- // Printer make has been selected
- public void actionmakeCombo() {
- int i;
-
- make = (String)makeCombo.getSelectedItem();
- if (!make.equals(pmUtility.getResource("Not.Selected")))
- makeCombo.removeItem(pmUtility.getResource("Not.Selected"));
-
-
- if (!oldmake.equals(make))
- modelCombo.removeAllItems();
-
- oldmake = make;
- }
-
-
- // Get Model
- public void actionmodelCombo() {
- int i;
- String models[] = null;
-
- if (!oldmake.equals(make)) {
- try {
- models = PrinterUtil.getModelsList(make);
- } catch (Exception e) {
- Debug.warning(
- "CLNT:pmInstPr:actionmodelCombo: exception" + e);
- }
-
- if (models == null) {
- Debug.warning(
- "CLNT:pmInstPr:actionmodelCombo:no models for "
- + make);
- modelCombo.removeAllItems();
- modelCombo.addItem(pmUtility.getResource(
- "No.Models.Found"));
- } else {
- for (i = 0; i < models.length; i++)
- modelCombo.addItem(models[i]);
- }
- }
-
- model = (String)modelCombo.getSelectedItem();
- if (!oldmodel.equals(model))
- ppdCombo.removeAllItems();
-
- oldmodel = model;
- }
-
-
- public void actionppdCombo() {
- int i;
- int rec = -1;
- int idx = -1;
- String ppds[] = null;
-
- if (!oldmodel.equals(model)) {
-
- try {
- ppds = PrinterUtil.getPPDList(make, model);
-
- } catch (Exception e) {
- Debug.warning(
- "CLNT:pmInstPr:actionmodelCombo: exception" +e);
- }
-
- // Get the ppd files list
- // If a recommended ppd is in the list, display it first
- if (ppds == null) {
- Debug.warning(
- "CLNT:pmInstPr:actionmodelCombo: no ppds for " +
- make + "/" + model);
- ppdCombo.addItem(
- pmUtility.getResource("No.PPD.Files.Found"));
- } else {
- for (i = 0; i < ppds.length; i++) {
- ppdCombo.addItem(ppds[i]);
- rec = ppds[i].indexOf("recommended");
- if (rec != -1)
- idx = i;
- }
-
- if (idx != -1)
- ppdCombo.setSelectedIndex(idx);
- }
- }
-
- ppd = (String)ppdCombo.getSelectedItem();
-
- if (!ppd.equals(""))
- ppdCombo.removeItem("");
-
- }
-
-
- public void actionaddButton() {
-
- String tmp = null;
- String trimtmp;
- Debug.message("CLNT:pmInstPr:actionaddButton()");
- try {
- tmp = userText.getText();
- } catch (Exception e) {
- Debug.message(
- "CLNT:pmInstPr:actionaddButton:UserAccessList empty");
- }
-
- if (tmp == null || tmp.equals("") || tmp.trim().equals("")) {
- Debug.message("CLNT:pmInstPr:no username to add");
- } else {
- trimtmp = tmp.trim();
- if (accessModel.isduplicate(trimtmp))
- Debug.message("CLNT:pmInstPr:duplicate user");
-
- else if (!Valid.user(trimtmp)) {
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource("Invalid.username"));
- // "FormError"
- m.setVisible(true);
-
- } else {
- if (accessModel.getRowCount() > 0 &&
- (accessModel.getElementAt(0).equals("all") ||
- accessModel.getElementAt(0).equals("none")))
- accessModel.removeRow(0);
-
- if (trimtmp.equals("all") ||
- trimtmp.equals("none")) {
- accessModel.removeListEntries();
- }
-
- accessModel.addaccessList(trimtmp);
- accessList.setListData(accessModel.getAccessList());
- int rw = accessModel.getRowCount();
- accessList.setSelectedIndex(rw - 1);
- accessList.ensureIndexIsVisible(rw -1);
- }
-
- }
- userText.setText("");
- userText.requestFocus();
-
- ascrollPane.revalidate();
- ascrollPane.repaint();
-
- frame.repaint();
- }
-
- public void actiondeleteButton() {
- Debug.message("CLNT:pmInstPr:actiondeleteButton()");
- int row;
- int rcount;
- int idx;
-
- row = accessList.getSelectedIndex();
- rcount = accessModel.getRowCount();
-
- if ((row >= 0 && rcount > 0) && (!accessList.isSelectionEmpty())) {
- accessModel.removeRow(row);
- rcount = accessModel.getRowCount();
- if (rcount != 0) {
- if (row == rcount)
- accessList.setSelectedIndex(row - 1);
- idx = accessList.getFirstVisibleIndex();
- if (idx > 0 && idx < rcount)
- accessList.ensureIndexIsVisible(idx - 1);
- }
- }
- userText.requestFocus();
- frame.repaint();
- }
-
-
- // For ok/cancel
- public void cleanup() {
-
- if (action == Constants.ADDLOCAL) {
- myTop.localinstallView = null;
- }
-
- if (action == Constants.ADDNETWORK) {
- myTop.networkinstallView = null;
- }
-
- }
-
- public void pmScreendispose() {
- frame.dispose();
- }
-
- public void actionokButton() {
-
- Debug.message("CLNT:pmInstPr:actionokButton()");
- boolean incomplete = false;
-
- try {
- doAction();
- } catch (pmLoginFailedException le) {
- // User already notified
- Debug.message("CLNT:pmInstPr:pmLoginFailedException caught");
- } catch (pmIncompleteFormException fe) {
- // User already notified
- incomplete = true;
- } catch (pmGuiException ge) {
- Debug.message("CLNT:pmInstPr:login Exception, task cancelled");
- }
-
- if (!incomplete) {
- cleanup();
- myTop.pmsetdefaultpLabel();
- Debug.message("CLNT:pmInstPr:actionokbutton(): work done");
- pmCalls.debugShowPrinter(workingPrinter);
- frame.setVisible(false);
- frame.repaint();
- // frame.dispose();
- myTop.scrollPane.revalidate();
- myTop.scrollPane.repaint();
- }
- }
-
- public void actionapplyButton() {
-
- Debug.message("CLNT:pmInstPr:actionapplyButton()");
-
- try {
- doAction();
- } catch (pmLoginFailedException le) {
- // User already notified
- Debug.message("CLNT:pmInstPr:pmLoginFailedException caught");
- } catch (pmGuiException ge) {
- Debug.message("CLNT:pmInstPr:login Exception, task cancelled");
- }
-
- myTop.pmsetdefaultpLabel();
- Debug.message("CLNT:pmInstPr:actionapplybutton(): work done");
- pmCalls.debugShowPrinter(workingPrinter);
- myTop.scrollPane.revalidate();
- myTop.scrollPane.repaint();
- }
-
-
- public void actionresetButton() {
- Debug.message("CLNT:pmInstPr:actionresetButton()");
- doReset();
- frame.repaint();
- }
-
- public void actioncancelButton() {
- Debug.message("CLNT:pmInstPr:actioncancelButton()");
- cleanup();
- frame.setVisible(false);
- frame.repaint();
- // frame.dispose();
- }
-
- public void actionhelpButton() {
- Debug.message("CLNT:pmInstPr:actionhelpButton()");
- myTop.showHelpItem(helpTag);
- }
-
- public void Show() {
-
- Debug.message("CLNT:pmInstPr:Show()");
- frame.getContentPane().add("North", this);
- frame.pack();
- frame.setVisible(true);
- frame.repaint();
-
- // set focus to initial field, depending on which action is tbd
- // this seems to work best after pack()
-
- // default button is always OK, for now...
- // frame.getRootPane().setDefaultButton (okButton);
- okButton.setAsDefaultButton();
-
-
- Debug.info("Show: default comp is " + defaultComponent);
- if (defaultComponent != null) {
- defaultComponent.requestFocus();
- }
-
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmInstallScreen.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmInstallScreen.java
deleted file mode 100644
index 5527d4913b..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmInstallScreen.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmInstallScreen.java
- * Create add/modify GUI
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.Vector;
-import javax.swing.JPanel;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-/*
- * Screen for Installing/Modifying local and network printers
- */
-
-public class pmInstallScreen extends pmButtonScreen {
-
- pmTextField pnameText;
- pmTextField snameText;
- pmTextField descText;
- pmTextField userText;
- JComboBox portCombo;
- JComboBox faultCombo;
-
-// For printers configured without using make/model/PPD files
- JComboBox fileCombo;
- JComboBox typeCombo;
-
-// For printers configured using make/model/PPD files
- JComboBox ppdCombo;
- JComboBox makeCombo;
- JComboBox modelCombo;
-
- pmTextField destText;
- JComboBox protocolCombo;
- JCheckBox defaultp;
- JComboBox bannerCombo;
- pmButton addButton;
- pmButton deleteButton;
- JList userList;
- Vector userData;
-
- public pmInstallScreen() {}
-
-
- public void printernameLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Printer.Name:")), c);
- }
- public void printernameTextField(JPanel north, GridBagConstraints c) {
- pnameText = new pmTextField(14);
- north.add(pnameText, c);
- }
- public void printernameStaticField(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Printer.Server:")), c);
- }
-
- public void servernameLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Printer.Server:")), c);
- }
- public void servernameTextField(JPanel north, GridBagConstraints c) {
- snameText = new pmTextField(30);
- north.add(snameText, c);
- }
- public void servernameStaticField(JPanel north, GridBagConstraints c) {
- }
-
- public void descriptionLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Description:")), c);
- }
- public void descriptionField(JPanel north, GridBagConstraints c) {
- descText = new pmTextField(25);
- north.add(descText, c);
- }
-
- public void printerportLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Printer.Port:")), c);
- }
-
- public void devnullLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel("/dev/null"));
- }
-
- public void printerportField(JPanel north, GridBagConstraints c) {
-
- String devices[];
- int i;
-
- try {
- devices = PrinterUtil.getDeviceList();
- } catch (Exception e) {
- Debug.warning("CLNT: pmAccess:getDeviceList caught " + e);
- devices = new String[1];
- devices[0] = "";
- }
- portCombo = new JComboBox(devices);
- portCombo.insertItemAt(pmUtility.getResource("Not.Selected"), 0);
- portCombo.setSelectedIndex(0);
-
- portCombo.addItem(pmUtility.getResource("Other..."));
- portCombo.addActionListener(new ComboListener(Constants.PORT));
-
- north.add(portCombo, c);
-
- }
- public void printertypeLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Printer.Type:")), c);
- }
- public void printertypeField(JPanel north, GridBagConstraints c) {
- typeCombo = new JComboBox();
- typeCombo.addItem("PostScript");
- typeCombo.addItem("HP Printer");
- typeCombo.addItem("Reverse PostScript");
- typeCombo.addItem("Epson 2500");
- typeCombo.addItem("IBM ProPrinter");
- typeCombo.addItem("Qume Sprint 5");
- typeCombo.addItem("Daisy");
- typeCombo.addItem("Diablo");
- typeCombo.addItem("Datagraphix");
- typeCombo.addItem("DEC LA100");
- typeCombo.addItem("DEC LN03");
- typeCombo.addItem("Dec Writer");
- typeCombo.addItem("Texas Instruments 800");
- typeCombo.addItem(pmUtility.getResource("Other..."));
- typeCombo.addActionListener(new ComboListener(Constants.TYPE));
- north.add(typeCombo, c);
- }
-
- public void filecontentsLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("File.Contents:")), c);
- }
- public void filecontentsField(JPanel north, GridBagConstraints c) {
- fileCombo = new JComboBox();
- fileCombo.addItem(pmUtility.getResource("PostScript"));
- fileCombo.addItem(pmUtility.getResource("ASCII"));
- fileCombo.addItem(
- pmUtility.getResource("Both.PostScript.and.ASCII"));
- fileCombo.addItem(pmUtility.getResource("None"));
- fileCombo.addItem(pmUtility.getResource("Any"));
- north.add(fileCombo, c);
- }
-
-
- public void printermakeLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Printer.Make:")), c);
- }
- public void printermakeField(JPanel north, GridBagConstraints c) {
-
- String makes[];
-
- try {
- makes = PrinterUtil.getMakesList();
- } catch (Exception e) {
- Debug.warning("CLNT: pmAccess:getMakeList caught" +e);
- makes = new String[1];
- makes[0] = "";
- }
-
- makeCombo = new JComboBox(makes);
- makeCombo.insertItemAt(
- pmUtility.getResource("Not.Selected"), 0);
- makeCombo.setSelectedIndex(0);
-
-
- makeCombo.addActionListener(new ComboListener(Constants.MAKE));
- north.add(makeCombo, c);
- }
-
- public void printermodelsLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Printer.Model:")), c);
- }
-
- public void printermodelsField(JPanel north, GridBagConstraints c) {
- String models[];
- modelCombo = new JComboBox();
- modelCombo.addItem(" ");
- modelCombo.addActionListener(
- new ComboListener(Constants.MODEL));
- north.add(modelCombo, c);
- }
-
- public void ppdcontentsLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Printer.Driver:")), c);
- }
- public void ppdcontentsField(JPanel north, GridBagConstraints c) {
- ppdCombo = new JComboBox();
- ppdCombo.addItem(" ");
- ppdCombo.addActionListener(new ComboListener(Constants.PPD));
- north.add(ppdCombo, c);
- }
-
- public void faultnotLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Fault.Notification:")), c);
- }
- public void faultnotField(JPanel north, GridBagConstraints c) {
- faultCombo = new JComboBox();
-
- faultCombo.addItem(pmUtility.getResource("Write.to.Superuser"));
- faultCombo.addItem(pmUtility.getResource("Mail.to.Superuser"));
- faultCombo.addItem(pmUtility.getResource("None"));
- north.add(faultCombo, c);
- }
-
- public void destinationLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Destination:")), c);
- }
- public void destinationField(JPanel north, GridBagConstraints c) {
- destText = new pmTextField(25);
- north.add(destText, c);
- }
-
- public void protocolLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Protocol:")), c);
- }
- public void protocolField(JPanel north, GridBagConstraints c) {
- protocolCombo = new JComboBox();
- protocolCombo.addItem("BSD");
- protocolCombo.addItem("TCP");
- protocolCombo.addItem("URI");
- north.add(protocolCombo, c);
- }
-
- public void optionsLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Options:")), c);
- }
-
- public void bannerLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Banner:")), c);
- }
-
- public void optionLabel(JPanel north, GridBagConstraints c) {
- north.add(new JLabel
- (pmUtility.getResource("Option:")), c);
- }
-
- public void optionsFields(JPanel north, GridBagConstraints c) {
- defaultp = new JCheckBox(
- pmUtility.getResource("Default.Printer"));
-
- north.add(defaultp, c);
-
- c.gridy++;
- bannerCombo = new JComboBox();
- bannerCombo.addItem(pmUtility.getResource
- ("Always.Print.Banner"));
- bannerCombo.addItem(pmUtility.getResource
- ("User.Selectable.Default.On"));
- bannerCombo.addItem(pmUtility.getResource
- ("Never.Print.Banner"));
-
- north.add(bannerCombo, c);
- }
-
- public void defaultoptionField(JPanel north, GridBagConstraints c) {
- defaultp = new JCheckBox(
- pmUtility.getResource("Default.Printer"));
-
- north.add(defaultp, c);
- }
-
- public void northPanelConstraints(GridBagConstraints c) {
- c.weightx = c.weighty = 0.0;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- c.insets = new Insets(8, 5, 5, 5);
- c.gridheight = 1;
- c.gridwidth = 1;
- }
-
- public void labelConstraints(GridBagConstraints c) {
- c.weightx = c.weighty = 0.0;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- }
- public void TextFieldConstraints(GridBagConstraints c) {
- c.ipadx = 15;
- c.fill = GridBagConstraints.HORIZONTAL;
- // c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- c.weightx = c.weighty = 1.0;
- }
- public void comboboxConstraints(GridBagConstraints c) {
- c.weightx = c.weighty = 0.0;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- }
-
- public void optionsConstraints(GridBagConstraints c) {
- c.fill = GridBagConstraints.NONE;
- c.weightx = c.weighty = 0.0;
- }
-
- class ComboListener implements ActionListener {
- int activeCombo;
-
- // Constructor
- public ComboListener(int aCombo)
- {
- activeCombo = aCombo;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- switch (activeCombo)
- {
- case Constants.PORT:
- actionportCombo();
- break;
-
- case Constants.TYPE:
- actiontypeCombo();
- break;
-
- case Constants.MAKE:
- actionmakeCombo();
- break;
-
- case Constants.MODEL:
- actionmodelCombo();
- break;
-
- case Constants.PPD:
- actionppdCombo();
- break;
-
- }
- }
- }
-
- public void actionportCombo() {}
-
- public void actiontypeCombo() {}
-
- public void actionmakeCombo() {}
-
- public void actionmodelCombo() {}
-
- public void actionppdCombo() {}
-
- class adddelButtonListener implements ActionListener
- {
- int activeButton;
-
- public adddelButtonListener(int aButton)
- {
- activeButton = aButton;
- }
-
- public void actionPerformed(ActionEvent e) {
-
- switch (activeButton)
- {
- case Constants.ADD:
- actionaddButton();
- break;
- case Constants.DELETE:
- actiondeleteButton();
- break;
- }
- }
- }
-
- public void actionaddButton() {}
-
- public void actiondeleteButton() {}
-
- public void useraccessLabel(JPanel center, GridBagConstraints c) {
- center.add(new JLabel
- (pmUtility.getResource("User.Access.List:")), c);
- }
-
- public void adButtons(GridBagConstraints c) {
-
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.HORIZONTAL;
-
- addButton = new pmButton(pmUtility.getResource("Add"));
- deleteButton = new pmButton(pmUtility.getResource("Delete"));
- addButton.addActionListener(
- new adddelButtonListener(Constants.ADD));
- deleteButton.addActionListener(
- new adddelButtonListener(Constants.DELETE));
- }
-
- public void xxcenterPanel() {
-
- JPanel center = new JPanel();
- center.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.insets = new Insets(15, 15, 15, 15);
- c.anchor = GridBagConstraints.WEST;
-
- // Create the label
- c.gridx = 0;
- c.gridy = 0;
- c.fill = GridBagConstraints.NONE;
- c.weightx = c.weighty = 0.0;
- c.anchor = GridBagConstraints.NORTHWEST;
- center.add(new JLabel
- (pmUtility.getResource("User.Access.List:")), c);
-
- // Create the User Access List as JList
- userList = new JList();
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.getViewport().setView(userList);
-
- c.gridwidth = 2;
- c.gridx = 1;
- c.weightx = c.weighty = 1.0;
- c.fill = GridBagConstraints.BOTH;
- center.add(scrollPane, c);
-
- // Create the text field for adding users
- c.gridx = 1;
- c.gridy = 1;
- c.ipadx = 15;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.WEST;
- c.weightx = c.weighty = 1.0;
-
- userText = new pmTextField(25);
- center.add(userText, c);
-
- // Create the add/delete buttons
- c.gridx = 1;
- c.gridy = 2;
-
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.HORIZONTAL;
-
- addButton = new pmButton(pmUtility.getResource("Add"));
- deleteButton = new pmButton(pmUtility.getResource("Delete"));
- addButton.addActionListener(
- new adddelButtonListener(Constants.ADD));
- deleteButton.addActionListener(
- new adddelButtonListener(Constants.DELETE));
-
-
- c.gridwidth = 1;
- center.add(addButton, c);
-
- c.gridx = 2;
- center.add(deleteButton, c);
-
- add("Center", center);
-
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLoad.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLoad.java
deleted file mode 100644
index 802eb54a88..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLoad.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmLoad.java
- * Load a Naming Context implementation
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.JPanel;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-public class pmLoad extends JPanel {
-
- final static int OK = 1;
- final static int APPLY = 2;
- final static int RESET = 3;
- final static int CANCEL = 4;
- final static int HELP = 5;
-
- final static int NIS = 6;
- final static int NONE = 7;
-
- pmFrame frame = new pmFrame(
- pmUtility.getResource("SPM:Select.Naming.Service"));
- JComboBox nameserviceCombo = new JComboBox();
- pmTop mytop = null;
- int resetIndex;
-
- pmButton okButton = null;
- pmButton cancelButton = null;
- pmButton resetButton = null;
- pmButton helpButton = null;
-
-
- public pmLoad(pmTop mytop) {
- this.mytop = mytop;
-
- Debug.message("CLNT:pmLoad()");
- setLayout(new BorderLayout());
- resetIndex = mytop.actionindex;
-
- northPanel();
- southPanel();
-
-
- }
-
- public void northPanel() {
- JPanel north = new JPanel();
- north.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.weightx = c.weighty = 0.0;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- c.insets = new Insets(15, 15, 5, 15);
- c.gridheight = 1;
- c.gridwidth = 1;
-
- c.gridy = 1;
- c.gridx = 0;
- north.add(new JLabel
- (pmUtility.getResource("Naming.Service:")), c);
-
- c.gridy = 1;
- c.gridx = 2;
- c.ipadx = 15;
-
- nameserviceCombo.addItem("files");
-
- if (mytop.nisns != null)
- nameserviceCombo.addItem("NIS");
-
- if (mytop.ldapns != null)
- nameserviceCombo.addItem("LDAP");
-
- nameserviceCombo.setSelectedIndex(mytop.actionindex);
- north.add(nameserviceCombo, c);
-
- nameserviceCombo.addActionListener(new nsListener());
- nameserviceCombo.addItemListener(mytop.new topnsListener());
-
- add("North", north);
-
- }
-
- class nsListener implements ActionListener {
- public nsListener() {}
-
- public void actionPerformed(ActionEvent e)
- {
- mytop.actionindex = nameserviceCombo.getSelectedIndex();
- if (mytop.actionindex == 0) {
- Debug.message("CLNT:pmLoad:0: NONE");
- } else if (mytop.actionindex == 1) {
- Debug.message("CLNT:pmLoad:1: NIS");
- } else if (mytop.actionindex == 4) {
- Debug.message("CLNT:pmLoad:2: LDAP");
- }
- };
- }
-
- public void southPanel() {
- JPanel south = new JPanel();
-
- south.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.gridheight = 1;
- c.gridwidth = 1;
- c.weightx = c.weighty = 1.0;
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.insets = new Insets(15, 15, 15, 15);
- c.gridy = 0;
-
- okButton = new pmButton(
- pmUtility.getResource("OK"));
- okButton.setMnemonic(
- pmUtility.getIntResource("OK.mnemonic"));
-
- resetButton = new pmButton(
- pmUtility.getResource("Reset"));
- resetButton.setMnemonic(
- pmUtility.getIntResource("Reset.mnemonic"));
-
- cancelButton = new pmButton(
- pmUtility.getResource("Cancel"));
- cancelButton.setMnemonic(
- pmUtility.getIntResource("Cancel.mnemonic"));
-
- helpButton = new pmButton(
- pmUtility.getResource("Help"));
- helpButton.setMnemonic(
- pmUtility.getIntResource("Help.mnemonic"));
-
- okButton.addActionListener(new ButtonListener(OK));
- resetButton.addActionListener(new ButtonListener(RESET));
- cancelButton.addActionListener(new ButtonListener(CANCEL));
- helpButton.addActionListener(new ButtonListener(HELP));
-
- c.gridx = 0;
- south.add(okButton, c);
- c.gridx = 1;
- south.add(resetButton, c);
- c.gridx = 2;
- south.add(cancelButton, c);
- c.gridx = 3;
- south.add(helpButton, c);
-
- add("South", south);
- }
-
- class ButtonListener implements ActionListener {
- int activeButton;
-
- // Constructor
- public ButtonListener(int aButton)
- {
- activeButton = aButton;
- }
-
- // Select Active Button and call routine
-
- public void actionPerformed(ActionEvent e)
- {
-
- switch (activeButton) {
- case OK:
- actionokButton();
- break;
- case RESET:
- actionresetButton();
- break;
- case CANCEL:
- actioncancelButton();
- break;
- case HELP:
- actionhelpButton();
- break;
- }
-
- }
- }
-
- public void pmScreendispose() {
- frame.dispose();
- }
-
- // Action for buttons
-
- public void actionokButton() {
- Debug.message("CLNT:pmLoad:actionokButton()");
- mytop.pmsetNS();
- mytop.pmsetNSLabel();
- mytop.pmsetPrinterList();
- mytop.pmsetdefaultpLabel();
- frame.setVisible(false);
- frame.repaint();
- frame.dispose();
- }
-
- public void actionresetButton() {
- Debug.message("CLNT:pmLoad:actionresetButton()");
- nameserviceCombo.setSelectedIndex(resetIndex);
- frame.repaint();
- }
-
- public void actioncancelButton() {
- Debug.message("CLNT:pmLoad:actioncancelButton()");
- nameserviceCombo.setSelectedIndex(resetIndex);
- frame.setVisible(false);
- frame.repaint();
- frame.dispose();
- }
-
- public void actionhelpButton() {
- Debug.message("CLNT:pmLoad:actionhelpButton()");
- mytop.showHelpItem("NameService");
- }
-
- public void Show() {
- Debug.message("CLNT:pmLoad:Show()");
-
- frame.getContentPane().add("North", this);
- frame.pack();
-
- // handle Esc as cancel
- frame.getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- actioncancelButton();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- // default button is always OK, for now...
- okButton.setAsDefaultButton();
-
- frame.setDefaultComponent(nameserviceCombo);
-
- nameserviceCombo.requestFocus();
-
- frame.setVisible(true);
- frame.repaint();
-
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLogDisplay.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLogDisplay.java
deleted file mode 100644
index fc23e6a8c0..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLogDisplay.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright(c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmLogDisplay.java
- * Command Log implementation
- */
-
-package com.sun.admin.pm.client;
-
-import javax.swing.*;
-
-import java.awt.*;
-import java.util.*;
-import java.awt.event.*;
-
-import com.sun.admin.pm.server.*;
-
-public class pmLogDisplay extends pmFrame {
-
- pmButton helpButton = null;
- pmButton okButton = null;
- pmButton clearButton = null;
- pmTop theTop = null;
- String helpTag = null;
- JTextArea theList = null;
- String theContents = null;
-
- public pmLogDisplay() {
- this(null, null);
- }
-
-
- public pmLogDisplay(pmTop t, String h) {
- super(pmUtility.getResource("SPM:Command-Line.Console"));
-
- theTop = t;
- helpTag = h;
-
- setLocation(150, 200); // relative to parent frame
-
- // top panel
- JPanel p = new JPanel();
- p.setLayout(new BorderLayout());
-
- theContents = new String();
- theList = new JTextArea(12, 36);
- theList.setLineWrap(false);
- theList.setEditable(false);
-
- theList.registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- copyPressed();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, Event.CTRL_MASK),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- theList.registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- copyPressed();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-
- JScrollPane scroll = new JScrollPane();
- scroll.getViewport().setView(theList);
-
- p.add(scroll, "Center");
-
- this.getContentPane().add(p, "Center");
-
- p = new JPanel();
-
- okButton = new pmButton(
- pmUtility.getResource("Dismiss"));
- okButton.setMnemonic(
- pmUtility.getIntResource("Dismiss.mnemonic"));
- p.add(okButton);
-
- clearButton = new pmButton(
- pmUtility.getResource("Clear"));
- clearButton.setMnemonic(
- pmUtility.getIntResource("Clear.mnemonic"));
- p.add(clearButton);
-
- if (theTop != null && helpTag != null) {
- helpButton = new pmButton(
- pmUtility.getResource("Help"));
- helpButton.setMnemonic(
- pmUtility.getIntResource("Help.mnemonic"));
- p.add(helpButton);
- helpButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- Debug.message("Help button event");
- theTop.showHelpItem(helpTag);
- }
- });
- }
-
- this.getContentPane().add(p, "South");
-
- this.pack();
-
- this.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- returnValue = JOptionPane.CLOSED_OPTION;
- pmLogDisplay.this.setVisible(false);
- if (pmLogDisplay.this.theTop != null)
- pmLogDisplay.this.theTop.setLogOption(false);
- }
- });
-
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- okPressed();
- }
- });
-
- clearButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- pmLogDisplay.this.clear();
- }
- });
-
- // handle Esc as dismiss in any case
- getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- okPressed();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- // getRootPane().setDefaultButton(okButton);
- okButton.setAsDefaultButton();
-
- theList.requestFocus();
-
- }
-
- protected void copyPressed() {
- theList.copy();
- }
-
-
- protected void okPressed() {
- returnValue = JOptionPane.OK_OPTION;
- pmLogDisplay.this.setVisible(false);
- if (pmLogDisplay.this.theTop != null)
- pmLogDisplay.this.theTop.setLogOption(false);
- }
-
- public int getValue() {
- // Debug.message("getValue");
- return returnValue;
- }
-
- // i.e. a solid line, or spaces, or...
- public void addSeparator() {
- theContents = theContents + "\n\r";
- theList.setText(theContents);
- }
-
- // tricky: s may have embedded newlines...
- public void addText(String s) {
- theContents = theContents + s;
-
- /*
- * StringTokenizer st = new StringTokenizer(s, "\n\r", false);
- * try {
- * while(st.hasMoreTokens()) {
- * String ss = st.nextToken();
- * theContents.addElement(ss);
- * }
- * } catch(Exception x) {
- * Debug.warning("CLNT: Log addText caught: " + x);
- * }
- */
-
- /*
- * Debug.message("Log contents len = " + theContents.size());
- * for (int i = 0; i < theContents.size(); ++i)
- * Debug.message("\t" + i + ": " + theContents.elementAt(i));
- */
-
- // conveniently, this forces the last line to be scrolled to.
- theList.setText(theContents);
-
- }
-
- public void clear() {
- theContents = null;
- theContents = new String();
- theList.setText(theContents);
- }
-
- public void disableText(boolean d) {
- // theText.setEnabled(!d);
- }
-
- public static void main(String[] args) {
- JFrame f = new JFrame("Test Dialog");
- f.setSize(300, 100);
-
- f.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- System.exit(0);
- }
- });
-
- f.setVisible(true);
-
- pmLogDisplay d = new pmLogDisplay();
- d.addText("A\nB\nC\nD\nE\nF\nG\nH\nI\nJ");
- d.setVisible(true);
- }
-
-
- protected int returnValue = JOptionPane.CLOSED_OPTION;
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLogin.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLogin.java
deleted file mode 100644
index 97f3dca8b8..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLogin.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmLogin.java
- * Login dialog
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.JPanel;
-import javax.swing.*;
-import com.sun.admin.pm.server.*;
-
-
-
-/*
- * a panel dialog which captures a username and password.
- */
-
-public class pmLogin extends pmDialog {
- private pmTop theTop = null;
- private String theTag = null;
- private JFrame theFrame = null;
-
- protected pmButton okButton = null;
- protected pmButton cancelButton = null;
- protected pmButton helpButton = null;
-
- public pmLogin(JFrame f, String title, String msg) {
- this(f, title, msg, null, null);
- }
-
- public pmLogin(JFrame f, String title, String msg, pmTop t, String h) {
-
- super(f, title, true); // modal
-
- theTop = t;
- theTag = h;
- theFrame = f;
-
- JLabel l;
- JPanel p;
-
- // initialize constraints
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridwidth = 1;
- c.gridheight = 1;
- c.insets = new Insets(10, 10, 10, 10);
- c.anchor = GridBagConstraints.EAST;
-
- // top panel contains the desired message
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- l = new JLabel(msg, SwingConstants.CENTER);
- p.add(l, c);
- this.getContentPane().add(p, "North");
-
- // NIS middle panel
- // contains username and password
- if (t.ns.getNameService().equals("nis")) {
-
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- l = new JLabel(pmUtility.getResource("Hostname:"),
- SwingConstants.RIGHT);
- p.add(l, c);
-
- l = new JLabel(pmUtility.getResource("Username:"),
- SwingConstants.RIGHT);
- p.add(l, c);
-
- l = new JLabel(pmUtility.getResource("Password:"),
- SwingConstants.RIGHT);
- p.add(l, c);
-
- passwordField = new JPasswordField(12);
- passwordField.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- okPressed();
- }
- });
- l.setLabelFor(passwordField);
- // for consistency, don't implement this until all are...
- // l.setDisplayedMnemonic(
- // pmUtility.getIntResource("Password.mnemonic"));
-
- c.gridx = 1;
- c.weightx = 1.0;
-
- String nisMaster;
- try {
- nisMaster = theTop.host.getNisMaster();
- } catch (Exception e) {
- nisMaster = new String("Unknown");
- Debug.warning("pmLogin: getNisMaster() returns exception: " + e);
- }
-
- c.anchor = GridBagConstraints.WEST;
-
- l = new JLabel(nisMaster, SwingConstants.LEFT);
- p.add(l, c);
-
- l = new JLabel(("root"), SwingConstants.LEFT);
- p.add(l, c);
-
-
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
- c.gridy = GridBagConstraints.RELATIVE;
-
- p.add(passwordField, c);
- passwordField.setEchoChar('*');
-
- this.getContentPane().add(p, "Center");
-
- } else if (t.ns.getNameService().equals("ldap")) {
-
- // middle panel contains LDAP server name, distinguished name,
- // and password
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- // LDAP Server Name
- l = new JLabel(pmUtility.getResource("LDAP.Server:"),
- SwingConstants.RIGHT);
- p.add(l, c);
-
- serverField = new pmTextField(25);
- serverField.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- okPressed();
- }
- });
-
- String ldapMaster;
- try {
- ldapMaster = theTop.host.getLDAPMaster();
- } catch (Exception e) {
- ldapMaster = new String("");
- Debug.warning(
- "pmLdap: getLDAPMaster() returns exception: " + e);
- }
-
- serverField.setText(ldapMaster);
- c.gridx = 1;
- p.add(serverField, c);
-
-
- // Distinguished Name
- c.gridx = 0;
- l = new JLabel(pmUtility.getResource("Distinguished.Name:"),
- SwingConstants.RIGHT);
- p.add(l, c);
-
- dnField = new pmTextField(25);
- dnField.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- okPressed();
- }
- });
-
- String defaultDN;
- try {
- defaultDN = theTop.host.getDefaultAdminDN();
- } catch (Exception e) {
- defaultDN = new String("");
- Debug.warning(
- "pmLdap: getDefaultAdminDN() returns exception: " + e);
- }
-
- dnField.setText(defaultDN);
- c.gridx = 1;
- p.add(dnField, c);
-
- // Password
- c.gridx = 0;
- l = new JLabel(pmUtility.getResource("Password:"),
- SwingConstants.RIGHT);
- p.add(l, c);
-
- passwordField = new JPasswordField(12);
- passwordField.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- okPressed();
- }
- });
- l.setLabelFor(passwordField);
- // for consistency, don't implement this until all are...
- // l.setDisplayedMnemonic(
- // pmUtility.getIntResource("Password.mnemonic"));
-
- c.gridx = 1;
- c.weightx = 1.0;
-
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
- c.gridy = GridBagConstraints.RELATIVE;
-
- p.add(passwordField, c);
- passwordField.setEchoChar('*');
-
- this.getContentPane().add(p, "Center");
-
- }
-
-
- // bottom panel contains buttons
- c.gridx = 0;
- c.weightx = 1.0;
- c.weighty = 0.0;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
-
- JPanel thePanel = new JPanel();
-
- okButton = new pmButton(
- pmUtility.getResource("OK"));
- okButton.setMnemonic(
- pmUtility.getIntResource("OK.mnemonic"));
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- okPressed();
- }
- });
- thePanel.add(okButton, c);
-
- cancelButton = new pmButton(
- pmUtility.getResource("Cancel"));
- cancelButton.setMnemonic(
- pmUtility.getIntResource("Cancel.mnemonic"));
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- cancelPressed();
- }
- });
- thePanel.add(cancelButton, c);
-
- if (theTag != null && theTop != null) {
-
- helpButton = new pmButton(
- pmUtility.getResource("Help"));
- helpButton.setMnemonic(
- pmUtility.getIntResource("Help.mnemonic"));
- p.add(helpButton);
- helpButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- helpPressed();
- }
- });
- thePanel.add(helpButton, c);
- }
-
- this.getContentPane().add(thePanel, "South");
-
- addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- returnValue = JOptionPane.CLOSED_OPTION;
- pmLogin.this.setVisible(false);
- }
- });
-
- // handle Esc as cancel in any case
- this.getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- cancelPressed();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- // lay out the dialog
- this.pack();
-
- // set focus and defaults after packing...
- // this.getRootPane().setDefaultButton(okButton);
- okButton.setAsDefaultButton();
-
- passwordField.requestFocus();
- }
-
- public int getValue() {
- return returnValue;
- }
-
- public void getLDAPServer() throws pmIncompleteFormException {
- // LDAP Server name is required
- String LDAPserver = null;
- LDAPserver = serverField.getText();
- if (LDAPserver.equals("")) {
- serverField.requestFocus();
- throw new pmIncompleteFormException(
- pmUtility.getResource("LDAP.server.name.required."));
- }
- }
-
- public void getLDAPDN() throws pmIncompleteFormException {
- // LDAP Distinguished name is required
- String LDAPdn = null;
- LDAPdn = dnField.getText();
- if (LDAPdn.equals("")) {
- dnField.requestFocus();
- throw new pmIncompleteFormException(
- pmUtility.getResource("LDAP.Distinguished.name.required."));
- }
- }
-
- public void getLDAPPassword() throws pmIncompleteFormException {
-
- // LDAP password is required
-
- String tmpp = new String(passwordField.getPassword());
- String LDAPpass = new String(tmpp.trim());
-
- if (LDAPpass.equals("")) {
- passwordField.requestFocus();
- throw new pmIncompleteFormException(
- pmUtility.getResource("LDAP.Password.required."));
- }
- }
-
- public void okPressed() {
-
- // For LDAP, Check Server, Distinguished Name and Password
- boolean complete = true;
-
- if (theTop.ns.getNameService().equals("ldap")) {
- complete = false;
- try {
- getLDAPServer();
- getLDAPDN();
- getLDAPPassword();
- complete = true;
- } catch (pmIncompleteFormException fe) {
- pmMessageDialog m = new pmMessageDialog(
- theFrame,
- pmUtility.getResource("Error"),
- fe.getMessage()); // "FormError"
- m.setVisible(true);
- }
- }
-
- if (complete) {
- returnValue = JOptionPane.OK_OPTION;
- pmLogin.this.setVisible(false);
- }
- }
-
-
-
- public void cancelPressed() {
- returnValue = JOptionPane.CANCEL_OPTION;
- pmLogin.this.setVisible(false);
- }
-
-
- public void clearPressed() {
-
- passwordField.setText("");
- }
-
- public void helpPressed() {
- theTop.showHelpItem(theTag);
- }
-
- public static void main(String[] args) {
- JFrame f = new JFrame("Password test");
-
- f.setSize(300, 100);
- f.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- System.exit(0);
- }
- });
- f.setVisible(true);
-
- while (true) {
- pmLogin d = new pmLogin(f, "Test Login",
- "NIS/LDAP Authentication.");
- d.setVisible(true);
-
-
- }
- // System.exit(0);
- }
-
- public JPasswordField passwordField = null;
- public pmTextField serverField = null;
- public pmTextField dnField = null;
-
- protected int returnValue = JOptionPane.CLOSED_OPTION;
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLoginFailedException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLoginFailedException.java
deleted file mode 100644
index 2c769eeb37..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmLoginFailedException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmLoginFailedException.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-class pmLoginFailedException extends pmGuiException {
- public pmLoginFailedException(String s) {
- super(s);
- }
- public pmLoginFailedException() {
- super();
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmMessageDialog.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmMessageDialog.java
deleted file mode 100644
index 8f46a3f3e8..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmMessageDialog.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmMessageDialog.java
- * Common info message dialog
- */
-
-package com.sun.admin.pm.client;
-
-import javax.swing.*;
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-import com.sun.admin.pm.server.*;
-
-public class pmMessageDialog extends pmDialog {
-
- pmButton helpButton = null;
- pmButton okButton = null;
- JList theText = null;
- pmTop theTop = null;
- String helpTag = null;
-
-
- public pmMessageDialog(String title, String msg) {
- this(null, title, msg, null, null);
- }
-
- public pmMessageDialog(Frame f, String title, String msg) {
- this(f, title, msg, null, null);
- }
-
- public pmMessageDialog(Frame f,
- String title,
- String msg,
- pmTop top,
- String h) {
-
- super(f, title, true); // modal
-
- theTop = top;
- helpTag = h;
-
- // initialize constraints
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridwidth = 1;
- c.gridheight = 1;
- c.insets = new Insets(10, 10, 10, 10);
- c.anchor = GridBagConstraints.EAST;
-
- // top panel
- JPanel p = new JPanel();
- p.setLayout(new GridBagLayout());
- // p.setLayout(new BoxLayout(BoxLayout.X_AXIS));
-
- // JLabel label = new JLabel(msg, SwingConstants.CENTER);
- JList theText = new JList() {
- public boolean isFocusable() {
- return false;
- }
- };
-
- Vector v = new Vector();
-
- Debug.message("CLNT: MessageDialog: " + title + " , " + msg);
-
- if (msg != null) {
- StringTokenizer st = new StringTokenizer(msg, "\n", false);
- try {
- while (st.hasMoreTokens())
- v.addElement(st.nextToken());
- } catch (Exception x) {
- Debug.warning("CLNT: pmMessageDialog caught " + x);
- }
- theText.setListData(v);
- }
-
- theText.setBackground(p.getBackground());
-
- // p.add(theText, "Center");
- p.add(theText, c);
-
- this.getContentPane().add(p, "Center");
-
- okButton = new pmButton(
- pmUtility.getResource("Dismiss"));
- okButton.setMnemonic(
- pmUtility.getIntResource("Dismiss.mnemonic"));
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- actionOKButton();
- }
- });
-
- // handle Esc as dismiss in any case
- this.getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- actionOKButton();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- p = new JPanel();
- p.add(okButton);
-
- if (theTop != null && helpTag != null) {
- helpButton = new pmButton(
- pmUtility.getResource("Help"));
- helpButton.setMnemonic(
- pmUtility.getIntResource("Help.mnemonic"));
- p.add(helpButton);
- helpButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- theTop.showHelpItem(helpTag);
- }
- });
- }
-
- this.getContentPane().add(p, "South");
- this.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- actionOKButton();
- }
- });
-
- this.pack();
-
- // this.getRootPane().setDefaultButton(okButton);
- okButton.setAsDefaultButton();
-
- // okButton.requestFocus();
- okButton.grabFocus();
-
- }
-
-
- protected void actionOKButton() {
- returnValue = JOptionPane.OK_OPTION;
- pmMessageDialog.this.setVisible(false);
- }
-
-
- public int getValue() {
- return returnValue;
- }
-
-
- public static void main(String[] args) {
- JFrame f = new JFrame("Test Dialog");
- f.setSize(300, 100);
-
- f.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- System.exit(0);
- }
- });
-
- f.setVisible(true);
-
- while (true) {
- System.out.println("creating a new dialog instance...");
- pmMessageDialog d =
- new pmMessageDialog(null,
- "Dialog Test",
- "Dumb test message.",
- null,
- null);
- d.setVisible(true);
- System.out.println("Dialog returns " + d.getValue());
-
- d.dispose();
-
- }
-
- }
-
-
- protected int returnValue = JOptionPane.CLOSED_OPTION;
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmModifyPrinterFailedException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmModifyPrinterFailedException.java
deleted file mode 100644
index 007c10e77d..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmModifyPrinterFailedException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmModifyPrinterFailedException.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-class pmModifyPrinterFailedException extends pmGuiException {
- public pmModifyPrinterFailedException(String s) {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmMustBeRemoteServerException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmMustBeRemoteServerException.java
deleted file mode 100644
index 670e3df4b8..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmMustBeRemoteServerException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmDeleteFailedException.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-class pmMustBeRemoteServerException extends pmGuiException {
- public pmMustBeRemoteServerException(String s) {
- super(s);
- }
- public pmMustBeRemoteServerException() {
- super();
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmNeedPPDCacheException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmNeedPPDCacheException.java
deleted file mode 100644
index 2f2265070a..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmNeedPPDCacheException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmInstallPrinter.java
- * Install and Modify Printer implementation
- *
- * pmNeedPPDCache.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-public class pmNeedPPDCacheException extends pmGuiException {
- public pmNeedPPDCacheException(String s) {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmNullSelectedPrinterException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmNullSelectedPrinterException.java
deleted file mode 100644
index 943e5cdeb7..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmNullSelectedPrinterException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmNullSelectedPrinterException.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-class pmNullSelectedPrinterException extends pmGuiException {
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmOKCancelDialog.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmOKCancelDialog.java
deleted file mode 100644
index 4bffb3733a..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmOKCancelDialog.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmOKCancelDialog.java
- * Common dialog
- */
-
-package com.sun.admin.pm.client;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import com.sun.admin.pm.server.Debug;
-
-
-public class pmOKCancelDialog extends pmDialog {
- private pmTop theTop;
- private String theTag;
- protected boolean defaultIsOK = true;
-
- public pmOKCancelDialog(Frame f, String title, String msg) {
- this(f, title, msg, null, null, true);
- }
-
- public pmOKCancelDialog(Frame f, String title, String msg, boolean ok) {
- this(f, title, msg, null, null, ok);
- }
-
- public pmOKCancelDialog(Frame f, String title, String msg,
- pmTop t, String h) {
- this(f, title, msg, t, h, true);
- }
-
- public pmOKCancelDialog(Frame f, String title, String msg,
- pmTop t, String h, boolean ok) {
- super(f, title, true); // modal
-
- theTop = t;
- theTag = h;
- defaultIsOK = ok;
-
- // initialize constraints
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridwidth = 1;
- c.gridheight = 1;
- c.insets = new Insets(10, 10, 10, 10);
- c.anchor = GridBagConstraints.EAST;
-
- // top panel
- JPanel p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- JLabel label = new JLabel(msg, SwingConstants.CENTER);
- p.add(label, c);
-
- this.getContentPane().add(p, "Center");
-
- this.getContentPane().add(
- buttonPanel(defaultIsOK, theTop != null && theTag != null),
- "South");
-
- this.pack();
-
- this.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- returnValue = JOptionPane.CLOSED_OPTION;
- pmOKCancelDialog.this.setVisible(false);
- }
- });
-
- if (defaultIsOK) {
- // this.getRootPane().setDefaultButton(okButton);
- okButton.setAsDefaultButton();
- okButton.requestFocus();
- } else {
- // this.getRootPane().setDefaultButton(cancelButton);
- cancelButton.setAsDefaultButton();
- cancelButton.requestFocus();
- }
-
- // handle Esc as cancel in any case
- this.getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- actionCancelButton();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
- }
-
- public JPanel buttonPanel(boolean okDefault, boolean useHelp) {
- JPanel panel = new JPanel();
-
- panel.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.gridheight = 1;
- c.gridwidth = 1;
- c.weightx = c.weighty = 0.0;
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridy = 0;
-
-
- if (okDefault)
- c.gridx = 0;
- else
- c.gridx = 1;
-
- okButton = new pmButton(
- pmUtility.getResource("OK"));
- okButton.setMnemonic(
- pmUtility.getIntResource("OK.mnemonic"));
-
- if (okDefault)
- c.gridx = 1;
- else
- c.gridx = 0;
-
- cancelButton = new pmButton(
- pmUtility.getResource("Cancel"));
- cancelButton.setMnemonic(
- pmUtility.getIntResource("Cancel.mnemonic"));
-
- helpButton = null;
-
- if (useHelp) {
- c.gridx = 2;
- helpButton = new pmButton(
- pmUtility.getResource("Help"));
- helpButton.setMnemonic(
- pmUtility.getIntResource("Help.mnemonic"));
- }
-
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- actionOKButton();
- }
- });
-
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- actionCancelButton();
- }
- });
-
- if (helpButton != null) {
- helpButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- theTop.showHelpItem(theTag);
- }
- });
- }
-
- c.insets = new Insets(15, 15, 15, 15);
- c.gridx = 0;
- panel.add(okButton, c);
- c.gridx = 1;
- panel.add(cancelButton, c);
- c.gridx = 2;
- if (helpButton != null)
- panel.add(helpButton, c);
-
- return panel;
- }
-
- protected void actionOKButton() {
- returnValue = JOptionPane.OK_OPTION;
- pmOKCancelDialog.this.setVisible(false);
- }
-
- protected void actionCancelButton() {
- returnValue = JOptionPane.CANCEL_OPTION;
- pmOKCancelDialog.this.setVisible(false);
- }
-
-
-
- public int getValue() {
- return returnValue;
- }
-
-
- public static void main(String[] args) {
- JFrame f = new JFrame("Test Dialog");
- f.setSize(300, 100);
-
- f.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- System.exit(0);
- }
- });
-
- f.setVisible(true);
-
- while (true) {
- System.out.println("creating a new dialog instance...");
- pmOKCancelDialog d =
- new pmOKCancelDialog(
- null, "Dialog Test", "Some message.", false);
- d.setVisible(true);
- System.out.println("Dialog returns " + d.getValue());
-
- d.dispose();
-
- }
-
- }
-
-
- pmButton helpButton = null;
- pmButton okButton = null;
- pmButton cancelButton = null;
-
- protected int returnValue = JOptionPane.CLOSED_OPTION;
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmOther.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmOther.java
deleted file mode 100644
index 230e398a04..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmOther.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmOther.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.JPanel;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-/*
- * panel dialog which captures "other"
- */
-
-public class pmOther extends pmDialog {
-
- private pmTop theTop;
- private String theTag;
- pmButton okButton = null;
- pmButton cancelButton = null;
- pmButton helpButton = null;
-
- public pmOther(JFrame f, String title, String msg) {
- this(f, title, msg, null, null);
- }
-
- public pmOther(JFrame f, String title, String msg, pmTop t, String h) {
-
- super(f, title, true); // modal
-
- theTop = t;
- theTag = h;
-
- JLabel l;
- pmButton b;
- JPanel p;
-
- Debug.message("CLNT:pmOther()");
-
- // initialize constraints
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = GridBagConstraints.RELATIVE;
- c.gridwidth = 1;
- c.gridheight = 1;
- c.insets = new Insets(10, 10, 5, 10);
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1.0;
-
- // top panel contains the message
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- l = new JLabel(msg, SwingConstants.LEFT);
- p.add(l, c);
- this.getContentPane().add(p, "North");
-
- c.insets = new Insets(5, 10, 5, 10);
-
- // middle panel contains "other" text field
- p = new JPanel();
- p.setLayout(new GridBagLayout());
-
- deviceName.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- okPressed();
- }
- });
-
- l.setLabelFor(deviceName);
-
- c.gridx = 1;
- c.gridy = 0;
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
-
- p.add(deviceName, c);
-
- c.gridy = GridBagConstraints.RELATIVE;
-
- this.getContentPane().add(p, "Center");
-
- // bottom panel contains buttons
- c.gridx = 0;
- c.weightx = 1.0;
- c.weighty = 0.0;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.CENTER;
- c.insets = new Insets(5, 10, 10, 10);
-
- JPanel thePanel = new JPanel();
- okButton = new pmButton(
- pmUtility.getResource("OK"));
- okButton.setMnemonic(
- pmUtility.getIntResource("OK.mnemonic"));
- thePanel.add(okButton, c);
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- okPressed();
- }
- });
-
- cancelButton = new pmButton(
- pmUtility.getResource("Cancel"));
- cancelButton.setMnemonic(
- pmUtility.getIntResource("Cancel.mnemonic"));
- thePanel.add(cancelButton, c);
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- cancelPressed();
- }
- });
-
- if (theTop != null && theTag != null) {
- helpButton = new pmButton(
- pmUtility.getResource("Help"));
- helpButton.setMnemonic(
- pmUtility.getIntResource("Help.mnemonic"));
- thePanel.add(helpButton, c);
- helpButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- theTop.showHelpItem(theTag);
- }
- });
- }
-
-
- this.getContentPane().add(thePanel, "South");
-
- // lay out the dialog
- this.pack();
-
- this.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- returnValue = JOptionPane.CLOSED_OPTION;
- pmOther.this.setVisible(false);
- }
- });
-
- // this.getRootPane().setDefaultButton(okButton);
- okButton.setAsDefaultButton();
-
- // handle Esc as cancel in any case
- this.getRootPane().registerKeyboardAction(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: default cancel action");
- cancelPressed();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- deviceName.requestFocus();
-
- }
-
- public int getValue() {
- return returnValue;
- }
-
-
- public void okPressed() {
- Debug.message("CLNT:pmOther: " + deviceName.getText());
- returnValue = JOptionPane.OK_OPTION;
- pmOther.this.setVisible(false);
- }
-
- public void cancelPressed() {
- Debug.message("CLNT:pmOther: cancelPressed");
- pmOther.this.dispose();
- }
-
-
- public static void main(String[] args) {
- JFrame f = new JFrame("Other test");
-
- f.setSize(300, 100);
- f.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- System.exit(0);
- }
- });
- f.setVisible(true);
-
- while (true) {
- pmOther d = new pmOther(f, "Test pmOther", "Enter Printer Port");
- d.setVisible(true);
-
- Debug.message("CLNT:pmOther: Dialog login returns " + d.getValue());
-
- }
- // System.exit(0);
- }
-
-
- public pmTextField deviceName = new pmTextField(30);
- protected int returnValue = JOptionPane.CLOSED_OPTION;
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmPrinterExistsException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmPrinterExistsException.java
deleted file mode 100644
index 1912ab5f52..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmPrinterExistsException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmPrinterExistsException.java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-class pmPrinterExistsException extends pmGuiException {
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmResources.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmResources.java
deleted file mode 100644
index 5a5a8ec932..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmResources.java
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
- *
- * pmResources.java
- * Localizable resource strings
- */
-
-package com.sun.admin.pm.client;
-
-import java.util.*;
-
-/*
- * In accordance with the ResourceBundle pattern,
- * each line in this file defines a tuple containing
- * two strings:
- * string 1 is the key used by the app -- DO NOT LOCALIZE
- * string 2 is the string to be localized
- *
- * For example, in the tuple
- * {"info_name", "Oracle Solaris Print Manager"}
- *
- * "info_name" is the resource key that must
- * not be modified in any way
- *
- * "Oracle Solaris Print Manager" is the corresponding
- * text to be localized
- */
-
-public class pmResources extends ListResourceBundle {
- static final Object[][] pmBundlecontents = {
-
- /*
- * Descriptive strings used in the 'About' dialog
- */
- {"info_name", "Oracle Solaris Print Manager"},
- {"info_version", "Version 1.0"},
- {"info_authors", "Authors: Wendy Phillips"},
-
- // Note: the copyright notice is displayed on two lines.
- {"info_copyright1", "Copyright \251 "},
- /* JSTYLED */
- {"info_copyright2", " (c) Oracle and/or its affiliates. All rights reserved."},
-
- /*
- * Main window title, the application name
- */
- {"Solaris.Print.Manager", "Oracle Solaris Print Manager"},
-
-
- /*
- * Main window column labels for printer list
- */
- {"Printer.Name", "Printer Name"},
- {"Printer.Server", "Printer Server"},
- {"Description", "Description"},
-
-
- /*
- * Main window menu titles and mnemonics
- */
- {"Print.Manager", "Print Manager"},
- {"Print.Manager.mnemonic", "M"},
-
- {"Printer", "Printer" },
- {"Printer.mnemonic", "P"},
-
- {"Tools", "Tools" },
- {"Tools.mnemonic", "T"},
-
- {"Help", "Help"},
- {"Help.mnemonic", "H"},
-
-
- /*
- * Main window data labels
- */
- {"Default.Printer:", "Default Printer:"},
- {"Domain:", "Domain:"},
- {"Host:", "Host:"},
-
-
- /*
- * 'Printer Manager' menu item labels and mnemonics
- */
- {"Select.Naming.Service", "Select Naming Service..."},
- {"Select.Naming.Service.mnemonic", "N"},
-
- {"Show.Command-Line.Console", "Show Command-Line Console"},
- {"Show.Command-Line.Console.mnemonic", "L"},
-
- {"Confirm.All.Actions", "Confirm All Actions"},
- {"Confirm.All.Actions.mnemonic", "C"},
-
- {"Use.PPD.files", "Use PPD files"},
- {"Use.PPD.files.mnemonic", "F"},
-
- {"Use.localhost", "Use localhost for Printer Server"},
- {"Use.localhost.mnemonic", "U"},
-
- {"Exit", "Exit"},
- {"Exit.mnemonic", "X"},
-
- /*
- * 'Printer' menu item labels and mnemonics
- */
- {"Add.Access.to.Printer...", "Add Access to Printer..."},
- {"Add.Access.to.Printer.mnemonic", "A"},
-
- {"New.Attached.Printer...", "New Attached Printer..."},
- {"New.Attached.Printer.mnemonic", "T"},
-
- {"New.Network.Printer...", "New Network Printer..."},
- {"New.Network.Printer.mnemonic", "N"},
-
- {"Modify.Printer.Properties...", "Modify Printer Properties..."},
- {"Modify.Printer.Properties.mnemonic", "M"},
-
- {"Delete.Printer...", "Delete Printer..."},
- {"Delete.Printer.mnemonic", "D"},
-
-
- /*
- * 'Tools' menu item labels
- */
- {"Find.Printer", "Find Printer..."},
- {"Find.Printer.mnemonic", "F"},
-
-
- /*
- * 'Help' menu item labels
- */
- {"Overview", "Overview"},
- {"Overview.mnemonic", "O"},
-
- {"On.Help", "On Help"},
- {"On.Help.mnemonic", "H"},
-
- {"About.Print.Manager", "About Print Manager..."},
- {"About.Print.Manager.mnemonic", "A"},
-
- {"Print.Manager.Settings", "Print Manager Settings"},
- {"Print.Manager.Settings.mnemonic", "P"},
-
-
- /*
- * 'Select Naming Service' dialog title
- */
- {"SPM:Select.Naming.Service",
- "Oracle Solaris Print Manager: Select Naming Service"},
-
-
- /*
- * 'Command-Line Console' dialog title
- */
- {"SPM:Command-Line.Console",
- "Oracle Solaris Print Manager: Command-Line Console"},
-
-
- /*
- * 'Delete Printer' confirmation dialog title
- */
- {"SPM:Delete.Printer", "Oracle Solaris Print Manager: Delete Printer"},
-
-
- /*
- * 'Add Access to Printer' dialog title
- */
- {"SPM:Add.Access.To.Printer",
- "Oracle Solaris Print Manager: Add Access to Printer"},
-
-
- /*
- * 'Add Attached Printer' dialog title
- */
- {"SPM:New.Attached.Printer",
- "Oracle Solaris Print Manager: New Attached Printer"},
-
-
- /*
- * 'Add Network Printer' dialog title
- */
- {"SPM:New.Network.Printer",
- "Oracle Solaris Print Manager: New Network Printer"},
-
-
- /*
- * 'Modify Printer Properties' dialog title
- */
- {"SPM:Modify.Printer.Properties",
- "Oracle Solaris Print Manager: Modify Printer Properties"},
-
-
- /*
- * 'Find Printer' dialog title
- */
- {"SPM:Find.Printer", "Oracle Solaris Print Manager: Find Printer"},
-
-
- /*
- * 'Help' dialog title
- */
- {"SPM:Help", "Oracle Solaris Print Manager: Help"},
-
-
- /*
- * 'About Print Manager' dialog title
- */
- {"About.Solaris.Print.Manager", "About Oracle Solaris Print Manager"},
-
-
- /*
- * 'User Input of Printer Port' dialog title
- */
- {"SPM:Specify.Printer.Port",
- "Oracle Solaris Print Manager: Specify Printer Port"},
-
-
- /*
- * 'User Input of Printer Type' dialog title
- */
- {"SPM:Specify.Printer.Type",
- "Oracle Solaris Print Manager: Specify Printer Type"},
-
-
- /*
- * 'NIS Authentication' dialog title
- */
- {"NIS.Authentication", "NIS Authentication"},
-
- /*
- * 'LDAP Authentication' dialog title
- */
- {"LDAP.Authentication", "LDAP Authentication"},
-
-
- /*
- * 'Action Confirmation' dialog title
- */
- {"Action.Confirmation", "Action Confirmation"},
-
-
- /*
- * Button labels and mnemonics
- */
- {"Apply", "Apply"},
- {"Apply.mnemonic", "P"},
-
- {"Cancel", "Cancel"},
- {"Cancel.mnemonic", "C"},
-
- {"Clear", "Clear"},
- {"Clear.mnemonic", "L"},
-
- {"Dismiss", "Dismiss"},
- {"Dismiss.mnemonic", "D"},
-
- // {"Button Help", "Help"},
- // {"Button.Help.mnemonic", "H"},
-
- {"OK", "OK"},
- {"OK.mnemonic", "O"},
-
- {"Reset", "Reset"},
- {"Reset.mnemonic", "R"},
-
- {"Find", "Find"},
- {"Find.mnemonic", "F"},
-
- {"Show", "Show"},
- {"Show.mnemonic", "S"},
-
- {"Forward", "Forward"},
- {"Forward.mnemonic", "W"},
-
- {"Back", "Back"},
- {"Back.mnemonic", "B"},
-
- {"Add", "Add"},
- {"Add.mnemonic", "A"},
-
- {"Delete", "Delete"},
- {"Delete.mnemonic", "D"},
-
-
- /*
- * Actions performed by the application
- * as displayed in the Command-Line Console
- */
- {"New.Attached.Printer", "New Attached Printer"},
- {"New.Network.Printer", "New Network Printer"},
- {"Modify.Printer.Properties", "Modify Printer Properties"},
- {"Delete.Printer", "Delete Printer"},
- {"Add.Access.To.Printer", "Add Access To Printer"},
-
-
- /*
- * Prompts: messages to user describing required input.
- */
- {"Enter.name.of.printer.to.find",
- "Enter the name of a printer to find:"},
- {"Please.confirm.deletion.of.printer",
- "Please confirm deletion of printer "},
- {"Enter.printer.type:", "Enter printer type:"},
- {"Enter.printer.port.or.file", "Enter printer port or file:"},
-
-
- /*
- * 'Help' dialog tabbed-pane tab selection labels
- */
- {"View", "View"},
- {"Index", "Index"},
- {"Search", "Search"},
-
-
- /*
- * 'Help' dialog prompts, labels, and mnemonics
- */
- {"Help.on:", "Help on:"},
- {"See.also:", "See also:"},
-
- {"Matching.entries:", "Matching entries:"},
- {"Matching.entries:.mnemonic", "M"},
-
- {"Search.help.index.for:", "Search help index for: "},
- {"Search.help.index.for:.mnemonic", "S"},
-
- {"Search.Results:", "Search Results:"},
- {"Search.Results:.mnemonic", "R"},
-
- {"Keywords:", "Keywords: "},
- {"Keywords:.mnemonic", "K"},
-
-
- /*
- * 'Help' dialog descriptive messages to provide
- * assistance in using the features.
- */
-
- /*
- * The following two labels create one message, displayed on
- * two adjacent lines.
- */
- {"To.search.the.index...",
- "To search the index of help articles alphabetically,"},
- {"type.your.query.below...",
- "type your query below then select the desired article."},
-
- /*
- * The following two labels create one message, displayed on
- * two adjacent lines.
- */
- {"To.find.help.articles...",
- "To find help articles about a particular topic,"},
- {"enter.keywords.below...",
- "enter keywords below then press the Find button."},
-
-
- /*
- * Prompts/labels on 'Install Printer' and 'Modify Printer' dialogs
- */
- {"Printer.Name:", "Printer Name:"},
- {"Printer.Server:", "Printer Server:"},
- {"Description:", "Description:"},
- {"Printer.Port:", "Printer Port:"},
- {"Not.Selected", "Not Selected"},
- {"Printer.Type:", "Printer Type:"},
- {"Printer.Driver:", "Printer Driver:"},
- {"No.PPD.Files.Found", "No PPD files found"},
- {"Printer.Make:", "Printer Make:"},
- {"Printer.Model:", "Printer Model:"},
- {"No.Models.Found", "No Models Found"},
- {"File.Contents:", "File Contents:"},
- {"Fault.Notification:", "Fault Notification:"},
- {"Destination:", "Destination:"},
- {"Protocol:", "Protocol:"},
- {"Options:", "Options:"},
- {"Banner:", "Banner:"},
- {"Options.mnemonic", "O"},
- {"Option:", "Option:"},
- {"User.Access.List:", "User Access List:"},
-
-
- /*
- * Combo item allowing custom 'Printer Port' selection
- * See "Printer.Port:" above.
- */
- {"Other...", "Other..."},
-
-
- /*
- * Combo items specifying printer 'File Contents'
- * See "File.Contents" above.
- */
- {"PostScript", "PostScript"},
- {"ASCII", "ASCII"},
- {"None", "None"},
- {"Any", "Any"},
- {"Both.PostScript.and.ASCII", "Both PostScript and ASCII"},
-
-
- /*
- * Combo items specifying 'Fault Notification' options.
- * See "Fault.Notification" above.
- */
- {"Write.to.Superuser", "Write to Superuser"},
- {"Mail.to.Superuser", "Mail to Superuser"},
-
-
- /*
- * Labels for checkboxes used in 'Install Printer' and
- * 'Modify Printer' dialogs
- */
- {"Default.Printer", "Default Printer"},
- {"Always.Print.Banner", "Always Print Banner"},
- {"User.Selectable.Default.On", "User Selectable - Default=on"},
- {"Never.Print.Banner", "Never Print Banner"},
-
-
- /*
- * Prompt for 'Select Naming Service' combo
- */
- {"Naming.Service:", "Naming Service:"},
-
-
- /*
- * Descriptive label for 'NIS Authentication' dialog
- */
- {"Enter.NIS.authentication.data.", "Enter NIS authentication data."},
-
- /*
- * Descriptive label for 'LDAP Authentication' dialog
- */
- {"Enter.LDAP.authentication.data.", "Enter LDAP authentication data."},
-
-
- /*
- * Prompts and mnemonics for 'NIS Authentication' dialog
- */
- {"Hostname:", "Hostname:"},
- {"Hostname.mnemonic", "H"},
-
- {"Username:", "Username:"},
- {"Username.mnemonic", "U"},
-
- {"Password:", "Password:"},
- {"Password.mnemonic", "P"},
-
- /*
- * Prompts for 'LDAP Authentication' dialog
- */
- {"LDAP.Server:", "LDAP Server:"},
- {"Distinguished.Name:", "Distinguished Name:"},
- {"Password:", "Password:"},
-
-
- /*
- * Error dialog titles
- */
- {"Application.Error", "Application Error"},
- {"Unknown.Application.Error", "Unknown Application Error"},
- {"Command.Failed.Error", "Command Failed Error"},
- {"Error", "Error"},
- {"Warning", "Warning"},
-
-
- /*
- * Error messages displayed to user
- */
- {"Item.not.found:", "Item not found: "},
- {"No.information.available.", "No information available."},
- {"Unable.to.find.printer", "Unable to find printer "},
- {"Printer.delete.operation.failed.",
- "Printer delete operation failed."},
- {"Invalid.printer.type.", "Invalid printer type."},
- {"Device.missing.or.not.writeable.",
- "Device missing or not writeable."},
- {"Printer.name.required.", "Printer name required."},
- {"Printer.Port.Selection.required", "Printer Port Selection required."},
- {"Printer.Make.Selection.required", "Printer Make Selection required."},
- {"Printer.name.invalid.", "Printer name invalid."},
- {"Server.name.required.", "Server name required."},
- {"Server.name.invalid.", "Server name invalid."},
- {"User.Cancelled.Login", "User Cancelled Login"},
- {"Destination.required.", "Destination required."},
- {"User.Cancelled.Login", "User Cancelled Login"},
- {"Destination.invalid.", "Destination invalid."},
- {"Operation.Cancelled", "Operation Cancelled"},
- {"Login.Failure", "Login Failure"},
- {"Required.login.failed.", "Required login failed."},
- {"Login.Authorization.Failed", "Login Authorization Failed"},
- {"Cannot.modify.this.queue;ppdcache.file.missing.",
- "Cannot modify this queue; ppdcache file missing."},
- {"Cannot.modify.this.queue;PPD.file.not.in.ppdcache.",
- "Cannot modify this queue; PPD file not in ppdcache."},
- {"Request.cannot.be.completed.", "Request cannot be completed."},
- {"Could.not.get.local.hostname", "Could not get local hostname"},
- {"The.specified.printer.already.exists.",
- "The specified printer already exists."},
- {"The.server.must.be.a.remote.server.",
- "The server must be a remote server."},
- {"Required.login.failed.", "Required login failed."},
- {"Invalid.printer.type.", "Invalid printer type."},
- {"Invalid.username", "Invalid username"},
- {"Device.missing.or.not.writeable.",
- "Device missing or not writeable."},
- {"User.cancelled.login.", "User cancelled login."},
- {"Nothing.matched.", "Nothing matched."},
- {"The.specified.printer.already.exists.",
- "The specified printer already exists."},
- {"The.selected.printer.does.not.exist.",
- "The selected printer does not exist."},
- {"User.not.authorized.to.modify.this.namespace.",
- "User not authorized to modify this namespace."},
- {"Cannot.get.list.of.printers.Exiting.",
- "Cannot get list of printers. Exiting."},
- {"LDAP.server.name.required.",
- "LDAP Server Name required."},
- {"LDAP.Distinguished.name.required.",
- "LDAP Distinguished Name required."},
- {"LDAP.Password.required.",
- "LDAP Password required."},
-
-
- /*
- * Prompts for 'Confirm Action' dialogs
- */
- {"Continue.action.for.this.printer?",
- "Continue action for this printer?"},
- {"Continue.creating.access.for.this.printer?",
- "Continue creating access for this printer?"},
-
-
- /*
- * The help subsystem builds a database of searchable
- * keywords based in part on the title of each help
- * article. In order to avoid excessive false hits, the
- * following words are ignored when adding title words
- * to the searchable keyword list.
- *
- * If this list is left empty, all the words in the title of
- * each help article will be added to the keywords database.
- */
- {"help.ignore.words", "to an a of if the and or"},
-
-
-
- /*
- * Title for the authorization dialog which is invoked by
- * the printmgr executable.
- */
- {"Authentication.required", "Authentication Required"},
-
- /*
- * Prompt for the printmgr authorization dialog.
- * This is displayed with line breaks.
- */
- /* JSTYLED */
- {"Root.access.is.required", "Root access is required for full functionality.\nYou may authenticate as root or continue\nwith limited functionality."},
-
- /*
- * Buttons for the authorization dialog.
- */
- {"Authenticate", "Authenticate"},
- {"Authenticate.mnemonic", "A"},
-
- {"Continue", "Continue"},
- {"Continue.mnemonic", "N"},
-
- /*
- * Title for the root password request dialog invoked by printmgr.
- */
- {"Root.authentication", "Root Authentication"},
-
- /*
- * Prompt for the root password request dialog.
- */
- {"Enter.root.password", "Enter root password"},
-
- /*
- * Prompt for the root password request dialog.
- */
- {"Invalid.password", "Invalid password entered. Retry?"},
-
- /*
- * Just a placeholder, never used.
- */
- {"dummy", ""}
- };
-
- public Object[][] getContents() {
- return pmBundlecontents;
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmTextField.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmTextField.java
deleted file mode 100644
index a02778c907..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmTextField.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmTextField.java
- * Extension of JTextField which accepts only 8-bit-ASCII.
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.text.*;
-
-public class pmTextField extends JTextField {
- public pmTextField(int n) {
- this(null, n);
- }
-
- public pmTextField(String s) {
- this(s, 0);
- }
-
- public pmTextField(String s, int n) {
- super(s, n);
- }
-
- protected Document createDefaultModel() {
- return new pmFilterDoc();
- }
-
- /*
- * This doc implementation will disallow insertion of a
- * string containing any characters which are non-8-bit-ascii.
- */
- private class pmFilterDoc extends PlainDocument {
- public void insertString(int offset, String str, AttributeSet a)
- throws BadLocationException {
- int i, c;
- char[] buf = str.toCharArray();
-
- for (i = 0; i < buf.length; i++) {
- c = (new Character(buf[i])).charValue();
- if (c > 0x00ff)
- break;
- }
- if (i == buf.length)
- super.insertString(offset, str, a);
- else
- Toolkit.getDefaultToolkit().beep();
- }
- }
-
- public static void main(String args[]) {
- JFrame f = new JFrame();
- f.getContentPane().add(new pmTextField(20));
- f.pack();
- f.setVisible(true);
- f.repaint();
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmTop.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmTop.java
deleted file mode 100644
index 76fe55af95..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmTop.java
+++ /dev/null
@@ -1,1303 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- *
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmTop.java
- * Top level
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import java.util.Vector;
-import java.lang.*;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.text.*;
-import javax.swing.border.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-/*
- * Top window for printer manager
- */
-
-public class pmTop extends JPanel {
-
- static private pmTop myTop = null;
- static private pmHelpFrame helpFrame = null;
- static private pmAboutBox aboutBox = null;
- static private pmLogDisplay commandLog = null;
- static private pmFindFrame findFrame = null;
-
- JLabel nameserviceLabel = new JLabel();
- JLabel domainhostLabel;
- JLabel defaultpLabel;
- String defaultPrinter;
- JScrollPane scrollPane;
- JTable listTable;
- Host host = new Host();
- private JPanel north = new JPanel();
- JPanel center;
- listTableModel listModel;
- ListSelectionModel listSM;
-
- JMenuBar menuBar;
- JFrame parentFrame;
- JCheckBoxMenuItem logCheck;
- JCheckBoxMenuItem confirmCheck;
- JCheckBoxMenuItem usePPD;
- JCheckBoxMenuItem useLocalhost;
- JMenuItem modifyMenuItem = null;
- JMenuItem deleteMenuItem = null;
-
- JMenuItem access;
- JMenuItem local;
- JMenuItem network;
-
- int actionindex = 0;
- private String newNS;
- NameService ns = null;
- NameService nisns = null;
- NameService systemns = null;
- NameService ldapns = null;
-
- pmAccess accessView = null;
- pmInstallPrinter localinstallView = null;
- pmInstallPrinter networkinstallView = null;
- pmDelete deleteView = null;
- pmInstallPrinter modifyView = null;
- pmLoad loadView = null;
-
- String clickedPrinter;
- String selectedPrinter = null;
- String selprinterServer = null;
- int selectedRow = -1;
-
- String cmdLog = null;
- String errorLog = null;
- String warningLog = null;
-
- boolean runningAuth = false;
- boolean isRoot = false;
-
- pmFrame frame;
-
-
- public pmTop(JFrame parent) {
- parentFrame = parent;
- setLayout(new BorderLayout());
- pmTopInit();
-
- }
-
- public void pmTopInit() {
-
- try {
- systemns = new NameService("system");
- } catch (Exception e) {
- Debug.message("CLNT: system:Nameservice exception " + e);
- }
- try {
- nisns = new NameService("nis");
- } catch (Exception e) {
- Debug.message("CLNT: nis:Nameservice exception " + e);
- }
- try {
- ldapns = new NameService("ldap");
- } catch (Exception e) {
- Debug.message("CLNT: ldap:Nameservice exception " + e);
- }
-
- ns = systemns;
- newNS = "files";
-
- // determine root privileges
- try {
- ns.checkAuth();
- } catch (Exception ax) {
- Debug.message("CLNT: checkAuth threw " + ax);
- }
-
- if (ns.isAuth()) {
- runningAuth = true;
- isRoot = true;
- Debug.message("CLNT: Running as root");
- } else
- Debug.message("CLNT: Not running as root");
-
- northPanel();
- centerPanel();
- southPanel();
-
- }
-
- // Set values so that printer selection null
- public void clearSelected() {
- selectedPrinter = null;
- selprinterServer = null;
- selectedRow = -1;
- enableEditMenuItems(false);
- }
-
-
- // Create north panel with GridBagLayout
- public void northPanel() {
-
- menuBar = new JMenuBar();
- menuBar.setBorder(new EmptyBorder(5, 5, 5, 5));
- menuBar.add(appMenu());
- menuBar.add(objectMenu());
- menuBar.add(toolsMenu());
- menuBar.add(Box.createHorizontalGlue());
- menuBar.add(helpMenu());
-
- parentFrame.setJMenuBar(menuBar);
- }
-
- public class listTableModel extends AbstractTableModel {
- int numColumns;
-
- String[] columnNames = {
- pmUtility.getResource("Printer.Name"),
- pmUtility.getResource("Printer.Server"),
- pmUtility.getResource("Description")
-
- };
-
- // Initialize for JTable calls from SWING classes
- Vector data = new Vector(0, 0);
-
- public listTableModel() {
- numColumns = getColumnCount();
- }
-
- public void insertlistTable(String rowDataList[], int numcols) {
- Vector rowData = new Vector(3, 1);
- data = new Vector(100, 5);
- int j = 0;
-
- if ((rowDataList.length) <= 1) {
- return;
- }
-
- for (int i = 0; i < rowDataList.length; i = i + 3) {
- rowData = new Vector(3, 1);
- for (j = 0; j < 3; j++) {
- rowData.addElement(
- rowDataList[i + j]);
- }
- data.addElement(rowData);
- }
- }
-
- public void removeRow(int row) {
- data.removeElementAt(row);
- }
-
- public int getRowCount() {
- return data.size();
- }
-
- public int getColumnCount() {
- return columnNames.length;
- }
-
- public String getColumnName(int col) {
- return columnNames[col];
- }
-
- public Object getValueAt(int row, int col) {
- Vector rowVector = (Vector)data.elementAt(row);
- return rowVector.elementAt(col);
- }
-
- public void setValueAt(String value, int row, int col) {
- Vector rowVector = (Vector)data.elementAt(row);
- rowVector.setElementAt(value, col);
- }
-
- public void addRow(Vector row) {
- data.addElement(row);
- }
-
- public int findValue(String value) {
- for (int i = 0; i < data.size(); i++) {
- if (getValueAt(i, 0).equals(value))
- return i;
- }
- return -1;
- }
-
- };
-
-
- // called on enter or double-click
- void modifySelectedPrinter() {
-
- ListSelectionModel m = listTable.getSelectionModel();
-
- if (m.isSelectionEmpty()) {
- Debug.message("CLNT: list selection is empty");
- return;
- }
-
- int selectedRow = m.getMinSelectionIndex();
-
- Debug.message("CLNT: list row selected is " + selectedRow);
-
- selectedPrinter =
- (String) listTable.getModel().getValueAt(selectedRow, 0);
- selprinterServer =
- (String)listTable.getModel().getValueAt(selectedRow, 1);
-
- Debug.message("CLNT: selectedPrinter is " + selectedPrinter);
-
- doModify();
- }
-
-
- // Create printer list in center panel
- public void centerPanel() {
-
- center = new JPanel();
-
- listModel = new listTableModel();
- listTable = new JTable(listModel);
- listTable.setColumnSelectionAllowed(false);
- listTable.setRowSelectionAllowed(true);
- listTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- listTable.setShowGrid(false);
- listTable.registerKeyboardAction(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: enter action");
- if (runningAuth)
- modifySelectedPrinter();
- else
- Toolkit.getDefaultToolkit().beep();
- }},
- KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false),
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
-
- listTable.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- Point pt = e.getPoint();
- int rowIndex = listTable.rowAtPoint(pt);
- int colIndex = listTable.columnAtPoint(pt);
- int clickCount = e.getClickCount();
-
- Debug.message("CLNT: getClickCount() is " + clickCount);
-
- if (clickCount == 2) {
- if (rowIndex == -1) {
- Debug.message("CLNT: clicked outside table");
- } else {
- if (runningAuth)
- modifySelectedPrinter();
- else
- Toolkit.getDefaultToolkit().beep();
- }
- }
- }
- });
-
- // Add selection listener
- ListSelectionModel rowSelectModel = listTable.getSelectionModel();
-
- rowSelectModel.addListSelectionListener(new ListSelectionListener() {
-
- public void valueChanged(ListSelectionEvent e) {
-
- listSM = (ListSelectionModel)e.getSource();
- Debug.message("CLNT: listSM is " + listSM);
-
- if (listSM.isSelectionEmpty()) {
- Debug.message("CLNT: list selection is empty");
- enableEditMenuItems(false);
- } else {
- selectedRow = listSM.getMinSelectionIndex();
- Debug.message(
- "CLNT: list element selected" + selectedRow);
- selectedPrinter =
- (String)listTable.getModel().getValueAt(selectedRow, 0);
- selprinterServer =
- (String)listTable.getModel().getValueAt(selectedRow, 1);
- Debug.message(
- "CLNT: selectedPrinter is " + selectedPrinter);
- enableEditMenuItems(true);
- }
- }
- });
-
- GridBagConstraints c = new GridBagConstraints();
- center.setLayout(new BorderLayout());
-
- c.insets = new Insets(35, 50, 35, 50);
-
- try {
- listModel.insertlistTable(PrinterUtil.getPrinterList(ns),
- listModel.getColumnCount());
- } catch (Exception e) {
- Debug.fatal("CLNT: pmTop:getPrinterList() caught " + e);
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "Cannot.get.list.of.printers.Exiting."),
- myTop,
- "getPrinterListFailed");
- m.setVisible(true);
- System.exit(-1);
- }
-
- scrollPane = new JScrollPane();
- scrollPane.setViewportView(listTable);
-
- listTable.setPreferredScrollableViewportSize(
- new Dimension(500, 500));
- scrollPane.getViewport().setView(listTable);
- center.add(scrollPane);
- add("Center", center);
- }
-
- // Create south panel with grid layout
-
- public void southPanel() {
- JPanel south = new JPanel();
- GridBagConstraints c = new GridBagConstraints();
- south.setLayout(new GridBagLayout());
-
- // Constraints applied across all entries
- c.fill = GridBagConstraints.BOTH;
- c.insets = new Insets(6, 6, 6, 6);
- c.gridheight = 1;
- c.gridwidth = 1;
- c.gridy = 1;
-
- // Create the labels
- c.gridx = 0;
- c.weightx = c.weighty = 1.0;
-
- try {
- defaultpLabel =
- new JLabel(pmUtility.getResource("Default.Printer:") +
- " " + PrinterUtil.getDefaultPrinter(ns));
-
- } catch (Exception e) {
- Debug.warning("CLNT: pmTop:getDefaultPrinter() caught " + e);
- defaultpLabel = new JLabel(
- pmUtility.getResource("Default.Printer:"));
- }
-
- south.add(defaultpLabel, c);
-
-
- if (newNS.startsWith("files")) {
- try {
- domainhostLabel = new JLabel(pmUtility.getResource(
- "Host:") + " " + host.getLocalHostName());
-
- nameserviceLabel.setText(" ");
-
- } catch (Exception e) {
- Debug.warning("CLNT: pmTop:getLocalHostName caught " + e);
- }
-
- } else {
- try {
- nameserviceLabel.setText(
- pmUtility.getResource("Naming.Service:") + " " + newNS);
- domainhostLabel = new JLabel(
- pmUtility.getResource("Domain:") + " " +
- host.getDomainName());
- } catch (Exception e) {
- Debug.warning("CLNT: pmTop:getDomainName caught " + e);
- }
- }
-
- c.weightx = c.weighty = 1.0;
- c.gridx = 2;
- south.add(nameserviceLabel, c);
- c.gridx = 3;
- south.add(domainhostLabel, c);
- add("South", south);
- }
-
-
- public JMenu appMenu() {
- // name service
- // ---
- // cmd line console
- // confirm all actions
- // use ppd file
- // ---
- // exit
-
- JMenu appMenu = new JMenu(pmUtility.getResource("Print.Manager"));
- appMenu.setMnemonic(
- pmUtility.getIntResource("Print.Manager.mnemonic"));
-
- appMenu.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- Debug.message("CLNT: appMenu MouseListener");
- };
- });
-
- JMenuItem load = new JMenuItem(
- pmUtility.getResource("Select.Naming.Service"),
- pmUtility.getIntResource("Select.Naming.Service.mnemonic"));
-
- load.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from load action");
- if (loadView != null)
- loadView.setVisible(true);
- else
- loadView = new pmLoad(myTop);
- loadView.Show();
-
- };
- });
- load.setEnabled(true);
- appMenu.add(load);
-
- appMenu.addSeparator();
-
- logCheck = new JCheckBoxMenuItem(
- pmUtility.getResource("Show.Command-Line.Console"));
- logCheck.setMnemonic(
- pmUtility.getIntResource("Show.Command-Line.Console.mnemonic"));
-
- logCheck.addActionListener(new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from checkbox action");
- JCheckBoxMenuItem c = (JCheckBoxMenuItem) e.getSource();
- if (c.isSelected() == true) {
- commandLog.setVisible(true);
- } else {
- commandLog.setVisible(false);
- }
- }
- });
-
- if (!runningAuth)
- logCheck.setEnabled(false);
-
- appMenu.add(logCheck);
-
- confirmCheck = new JCheckBoxMenuItem(
- pmUtility.getResource("Confirm.All.Actions"), false);
- confirmCheck.setMnemonic(
- pmUtility.getIntResource("Confirm.All.Actions.mnemonic"));
- if (!runningAuth)
- confirmCheck.setEnabled(false);
-
- appMenu.add(confirmCheck);
-
- usePPD = new JCheckBoxMenuItem(
- pmUtility.getResource("Use.PPD.files"), true);
- usePPD.setMnemonic(pmUtility.getIntResource("Use.PPD.files.mnemonic"));
-
- useLocalhost = new JCheckBoxMenuItem(
- pmUtility.getResource("Use.localhost"), false);
- useLocalhost.setMnemonic(
- pmUtility.getIntResource("Use.localhost.mnemonic"));
-
-
- if (!runningAuth) {
- usePPD.setEnabled(false);
- useLocalhost.setEnabled(false);
- }
- appMenu.add(usePPD);
- appMenu.add(useLocalhost);
-
- appMenu.addSeparator();
-
- JMenuItem exit = new JMenuItem(
- pmUtility.getResource("Exit"),
- pmUtility.getIntResource("Exit.mnemonic"));
-
- exit.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from exit action");
- System.exit(0);
- };
- });
-
- exit.setEnabled(true);
- appMenu.add(exit);
-
- return appMenu;
- }
-
- // disable everything is not running as root
- public JMenu objectMenu() {
- // add access to printer...
- // ---
- // new local printer...
- // new network printer...
- // ---
- // delete printer
- // modify properties...
-
- JMenu objectMenu = new JMenu(
- pmUtility.getResource("Printer"));
-
- objectMenu.setMnemonic(
- pmUtility.getIntResource("Printer.mnemonic"));
-
- access = new JMenuItem(
- pmUtility.getResource("Add.Access.to.Printer..."),
- pmUtility.getIntResource("Add.Access.to.Printer.mnemonic"));
-
- access.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from access action");
- if (accessView != null)
- accessView.setVisible(true);
- else
- accessView = new pmAccess(myTop);
- accessView.Show();
- };
- });
-
- if (!runningAuth)
- access.setEnabled(false);
-
- objectMenu.add(access);
- objectMenu.addSeparator();
-
- local = new JMenuItem(
- pmUtility.getResource("New.Attached.Printer..."),
- pmUtility.getIntResource("New.Attached.Printer.mnemonic"));
-
- local.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from localinstall action");
- if (localinstallView != null)
- localinstallView.setVisible(true);
- else {
- try {
- localinstallView = new pmInstallPrinter(
- myTop, Constants.ADDLOCAL);
- } catch (Exception ex) {
- Debug.message("CLNT:pmTop:caught exception" + ex);
- }
- }
- localinstallView.Show();
- };
- });
-
- if (!runningAuth)
- local.setEnabled(false);
-
- objectMenu.add(local);
-
- network = new JMenuItem(
- pmUtility.getResource("New.Network.Printer..."),
- pmUtility.getIntResource("New.Network.Printer.mnemonic"));
-
- network.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from networkinstall action");
- if (networkinstallView != null)
- networkinstallView.setVisible(true);
- else {
- try {
- networkinstallView = new
- pmInstallPrinter(myTop, Constants.ADDNETWORK);
- } catch (Exception ex) {
- Debug.message("CLNT:pmTop:caught exception" + ex);
- }
- }
-
- networkinstallView.Show();
- };
- });
-
- if (!runningAuth)
- network.setEnabled(false);
-
- objectMenu.add(network);
- objectMenu.addSeparator();
-
- modifyMenuItem = new JMenuItem(
- pmUtility.getResource("Modify.Printer.Properties..."),
- pmUtility.getIntResource("Modify.Printer.Properties.mnemonic"));
-
- modifyMenuItem.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
-
- Debug.message("CLNT: Modify " + selectedPrinter);
- Debug.message("CLNT: Modify " + selprinterServer);
-
- doModify();
- };
- });
-
- modifyMenuItem.setEnabled(false);
- objectMenu.add(modifyMenuItem);
-
- deleteMenuItem = new JMenuItem(
- pmUtility.getResource("Delete.Printer..."),
- pmUtility.getIntResource("Delete.Printer.mnemonic"));
-
- deleteMenuItem.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from delete action");
- if (selectedPrinter == null) {
- Debug.warning("CLNT: selectedPrinter is null");
- Debug.message("CLNT: cannot call pmDelete");
- // show error window
- } else {
- deleteView = new pmDelete(myTop);
- }
- };
- });
- deleteMenuItem.setEnabled(false);
- objectMenu.add(deleteMenuItem);
- return objectMenu;
- }
-
- // returns true iff name was found in the printer list
- public boolean findPrinterInList(String name) {
-
- int row = -1;
-
- try {
- String p = name.trim();
- row = listModel.findValue(p);
- } catch (Exception ee) {
- Debug.warning("CLNT: pmTop:find ActionList: caught " + ee);
- }
-
- if (row != -1) {
- selectedRow = row;
- listTable.clearSelection();
- listTable.setRowSelectionInterval(row, row);
- listTable.scrollRectToVisible(listTable.getCellRect(row, 0, true));
- listTable.revalidate();
- scrollPane.revalidate();
- scrollPane.repaint();
- }
- return row != -1;
- }
-
- public JMenu toolsMenu() {
-
- // find printer...
- JMenu toolsMenu = new JMenu(
- pmUtility.getResource("Tools"));
- toolsMenu.setMnemonic(
- pmUtility.getIntResource("Tools.mnemonic"));
-
- JMenuItem find = new JMenuItem(
- pmUtility.getResource("Find.Printer"),
- pmUtility.getIntResource("Find.Printer.mnemonic"));
- find.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from find action");
- findFrame.setVisible(true);
- }
- });
-
- toolsMenu.add(find);
- return toolsMenu;
- }
-
- // Create help Menu
-
- public JMenu helpMenu() {
- JMenu helpMenu = new JMenu(pmUtility.getResource("Help"));
- helpMenu.setMnemonic(pmUtility.getIntResource("Help.mnemonic"));
-
- JMenuItem ov = new JMenuItem(
- pmUtility.getResource("Overview"),
- pmUtility.getIntResource("Overview.mnemonic"));
- ov.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- myTop.showHelpItem("Overview");
- };
- });
-
- helpMenu.add(ov);
-
- JMenuItem on = new JMenuItem(
- pmUtility.getResource("On.Help"),
- pmUtility.getIntResource("On.Help.mnemonic"));
- on.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- myTop.showHelpItem("HelpOnHelp");
- };
- });
-
- helpMenu.add(on);
- helpMenu.addSeparator();
-
- JMenuItem about = new JMenuItem(
- pmUtility.getResource("About.Print.Manager"),
- pmUtility.getIntResource("About.Print.Manager.mnemonic"));
- about.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: call from about help action");
- aboutBox.setVisible(true);
- };
- });
-
- helpMenu.add(about);
- helpMenu.addSeparator();
-
- JMenuItem settings = new JMenuItem(
- pmUtility.getResource("Print.Manager.Settings"),
- pmUtility.getIntResource("Print.Manager.Settings.mnemonic"));
- settings.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Debug.message("CLNT: print manager settings help action");
- myTop.showHelpItem("PrintManagerSettings");
- };
- });
-
- helpMenu.add(settings);
- return helpMenu;
- }
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- }
-
- public void doModify() {
-
- if (modifyView != null)
- modifyView.pmScreendispose();
-
- try {
-
- if (selectedPrinter == null || selprinterServer == null) {
-
- } else {
-
- if ((host.getLocalHostName()).equals(selprinterServer) ||
- selprinterServer.equals("localhost")) {
-
- if (isNetwork()) {
-
- modifyView = new
- pmInstallPrinter(
- myTop, Constants.MODIFYNETWORK);
-
- } else {
- modifyView = new
- pmInstallPrinter(
- myTop, Constants.MODIFYATTACHED);
- }
-
- modifyView.Show();
-
- } else {
-
- try {
- modifyView = new pmInstallPrinter(
- myTop, Constants.MODIFYREMOTE);
- } catch (Exception e) {
- Debug.message(
- "CLNT:pmTop:caught exception" + e);
- }
- modifyView.Show();
- }
- }
- } catch (Exception e) {
- Debug.warning("CLNT: pmTop:getLocalHostName() caught " + e);
- }
- } // doModify()
-
-
- public boolean isNetwork() {
-
- Printer newpr = new Printer(myTop.ns);
- newpr.setPrinterName(selectedPrinter);
-
- try {
- newpr.getPrinterDetails();
- } catch (Exception e) {
- Debug.warning("CLNT: pmTop:getPrinterDetails() caught " + e);
- }
-
- pmCalls.debugShowPrinter(newpr);
-
- if (newpr.getDestination() != null) {
- Debug.message("CLNT: isNetwork:getDestination " +
- newpr.getDestination());
- return true;
- } else {
- Debug.message("CLNT: isNetwork:getDestination is null");
- return false;
- }
- }
-
- // Set the new namespace
- public void pmsetNS() {
-
- String serverNS;
-
- // translate from gui to server
- if (newNS.startsWith("files")) {
- serverNS = new String("system");
- useLocalhost.setState(true);
- } else if (newNS.equals("NIS")) {
- serverNS = new String("nis");
- useLocalhost.setState(false);
- } else if (newNS.equals("LDAP")) {
- serverNS = new String("ldap");
- useLocalhost.setState(false);
- } else {
- serverNS = new String("system");
- useLocalhost.setState(true);
- }
-
- Debug.message("CLNT: newNS: " + newNS +
- "\n serverNS: " + serverNS +
- "\n ns.getNameService(): " + ns.getNameService());
-
- if (!serverNS.equals(ns.getNameService())) {
-
- if (newNS.startsWith("files")) {
- useLocalhost.setState(true);
- ns = systemns;
- } else if (newNS.equals("NIS")) {
- useLocalhost.setState(false);
- ns = nisns;
- } else if (newNS.equals("LDAP")) {
- useLocalhost.setState(false);
- ns = ldapns;
- } else {
- useLocalhost.setState(true);
- ns = systemns;
- }
- }
-
-
- // This tool is read-only unless the user is root on the
- // print server. Thus, don't check for namespace authorization
- // if user is not root.
-
- if (isRoot) {
- // Check if user is authorized with this nameservice
- if (ns.isAuth()) {
- runningAuth = true;
- } else {
- // nis/ldap is a special case
- // need to login to nis/ldap server
- if (ns.getNameService().equals("nis") == true ||
- ns.getNameService().equals("ldap") == true) {
-
- try {
- if (!ns.isAuth()) {
- pmUtility.doLogin(myTop, loadView.frame);
- runningAuth = true;
- }
- } catch (pmUserCancelledException e) {
- Debug.message(
- "CLNT:pmTop:user cancelled login");
- runningAuth = false;
- } catch (pmGuiException e) {
- Debug.message(
- "CLNT:pmTop:login nis/ldap failed: " + e);
- runningAuth = false;
- pmMessageDialog m = new pmMessageDialog(
- loadView.frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "Required.login.failed."),
- myTop,
- "LoginFailed");
- m.setVisible(true);
- } catch (Exception e) {
- Debug.message(
- "CLNT:pmTop:login nis/ldap failed: " + e);
- runningAuth = false;
- pmMessageDialog m = new pmMessageDialog(
- loadView.frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "Required.login.failed."),
- myTop,
- "LoginFailed");
- m.setVisible(true);
- }
- } else {
- try {
- ns.checkAuth();
- runningAuth = true;
- } catch (Exception ca) {
- runningAuth = false;
- pmMessageDialog m = new pmMessageDialog(
- loadView.frame,
- pmUtility.getResource("Error"),
- pmUtility.getResource(
- "User.not.authorized.to.modify.this.namespace."),
- myTop,
- "AuthorizationFailed");
- m.setVisible(true);
- }
- }
- }
-
- if (!serverNS.equals(ns.getNameService())) {
- deleteAllScreens();
- }
-
- // Change front panel as unauthorized to modify
- if (!runningAuth) {
- logCheck.setEnabled(false);
- confirmCheck.setEnabled(false);
- usePPD.setEnabled(false);
- useLocalhost.setEnabled(false);
- access.setEnabled(false);
- local.setEnabled(false);
- network.setEnabled(false);
- modifyMenuItem.setEnabled(false);
- deleteMenuItem.setEnabled(false);
- } else {
- logCheck.setEnabled(true);
- confirmCheck.setEnabled(true);
- access.setEnabled(true);
- local.setEnabled(true);
- network.setEnabled(true);
- if (pmMisc.isppdCachefile())
- usePPD.setEnabled(true);
- else
- usePPD.setEnabled(false);
- if (ns.getNameService().equals("system") == true) {
- useLocalhost.setEnabled(true);
- useLocalhost.setVisible(true);
- } else {
- useLocalhost.setVisible(false);
- }
- }
-
- } else {
- runningAuth = false;
- }
-
-
- Debug.message("CLNT: NEW ns.getNameService(): " +
- ns.getNameService());
-
- }
-
- class topnsListener implements ItemListener {
- public topnsListener() {}
-
- public void itemStateChanged(ItemEvent e) {
- Debug.message("CLNT: hello from topnsListener" + e.getItem());
- if (e.getStateChange() == ItemEvent.SELECTED) {
- newNS = (String)e.getItem();
- }
- }
- }
-
- public void pmsetdefaultpLabel() {
- try {
- defaultpLabel.setText(
- pmUtility.getResource("Default.Printer:") +
- " " + PrinterUtil.getDefaultPrinter(ns));
-
- Debug.message(
- "CLNT: pmTop:pmsetdefaultpLabel(): default printer: " +
- PrinterUtil.getDefaultPrinter(ns));
-
- } catch (Exception e) {
- Debug.warning("CLNT: pmTop:getDefaultPrinter() caught " + e);
- }
- }
-
- public boolean getLogOption() {
- return logCheck.getState();
- }
-
- public void setLogOption(boolean val) {
- logCheck.setState(val);
- }
-
- public boolean getConfirmOption() {
- return confirmCheck.getState();
- }
-
- public boolean getUsePPD() {
- return usePPD.getState();
- }
-
- public boolean getUseLocalhost() {
- return useLocalhost.getState();
- }
-
- public void doFind(String printer) {
- }
-
- public void deleteAllScreens() {
-
- if (accessView != null)
- accessView.pmScreendispose();
- accessView = null;
-
- if (localinstallView != null)
- localinstallView.pmScreendispose();
- localinstallView = null;
-
- if (networkinstallView != null)
- networkinstallView.pmScreendispose();
- networkinstallView = null;
-
- if (modifyView != null)
- modifyView.pmScreendispose();
- modifyView = null;
-
- if (loadView != null)
- loadView.pmScreendispose();
- loadView = null;
- }
-
-
- /*
- * enable/disable modify and delete items
- * this must be called when:
- * . an existing printer is selected
- * . the selection is disabled
- */
- void enableEditMenuItems(boolean state) {
- if (!runningAuth)
- return;
- modifyMenuItem.setEnabled(state);
- deleteMenuItem.setEnabled(state);
- }
-
- /*
- * set the log/error state for the current operation
- */
- void setLogData(String cmd, String err, String warn) {
- cmdLog = cmd;
- errorLog = err;
- warningLog = warn;
- }
-
- /*
- * display current log state for the specified action
- * if the cmdLog is empty nothing at all will be displayed!
- */
- void showLogData(String actionName) {
-
- // Debug.info("CLNT: showLogData():actionName: " + actionName);
- // Debug.info("CLNT: showLogData():cmdLog: " + cmdLog);
-
- if (cmdLog == null)
- return;
-
- addToCommandLog(actionName + "\n");
-
- // iterate over multiline cmds
- StringTokenizer st = new StringTokenizer(
- cmdLog, "\n\r", false);
- while (st.hasMoreTokens()) {
- addToCommandLog("% " + st.nextToken());
- addToCommandLog("\n");
- }
-
- if (errorLog != null) {
- st = new StringTokenizer(errorLog, "\n\r", false);
- while (st.hasMoreTokens()) {
- addToCommandLog(st.nextToken());
- addToCommandLog("\n");
- }
- }
-
- if (warningLog != null) {
- st = new StringTokenizer(warningLog, "\n\r", false);
- while (st.hasMoreTokens()) {
- addToCommandLog(st.nextToken());
- addToCommandLog("\n");
- }
- }
-
- addToCommandLog("***\n");
- }
-
- private void addToCommandLog(String s) {
- commandLog.addText(s);
- }
-
- public void showHelpItem(String tag) {
- if (helpFrame != null)
- helpFrame.showHelp(tag);
- else
- Toolkit.getDefaultToolkit().beep();
- }
-
- public void pmsetNSLabel() {
-
- if (newNS.startsWith("files")) {
-
- nameserviceLabel.setText(" ");
- Debug.message("CLNT: pmsetNSLabel:nameserviceLabel is : " +
- nameserviceLabel.getText());
-
- try {
- domainhostLabel.setText(
- pmUtility.getResource("Host:") + " " +
- host.getLocalHostName());
- } catch (Exception e) {
- Debug.warning(
- "CLNT: pmTop:getLocalHostName caught " + e);
- }
-
- } else {
- nameserviceLabel.setText(
- pmUtility.getResource("Naming.Service:") + newNS);
- Debug.message(
- "CLNT: pmsetNSLabel:nameserviceLabel is : " +
- nameserviceLabel.getText());
-
- try {
- domainhostLabel.setText(
- pmUtility.getResource("Domain:") + " " +
- host.getDomainName());
- } catch (Exception e) {
- Debug.warning(
- "CLNT: pmTop:getDomainName caught " + e);
- }
- }
- }
-
- // Update the list of printers
- // Printer list will change if nameservice changes and when user
- // adds/deletes/changes printers
-
- public void pmsetPrinterList() {
-
- Debug.message("CLNT: pmsetPrinterList() ns is :" +
- ns.getNameService());
-
- try {
- listModel.insertlistTable(PrinterUtil.getPrinterList(ns),
- listModel.getColumnCount());
- } catch (Exception e) {
- Debug.warning("CLNT: pmTop:getPrinterList() caught " + e);
- }
-
- listTable.clearSelection();
- scrollPane.getViewport().setView(listTable);
- scrollPane.revalidate();
- scrollPane.repaint();
- }
-
-
- // returns -1 if error, 0 otherwise
- protected static int parseArgs(String[] args) {
- int rv = 0;
-
- for (int i = 0; i < args.length; ++i) {
- if (args[i].compareTo("-debugall") == 0)
- Debug.setDebugLevel(Debug.ALL);
- else if (args[i].compareTo("-debugnone") == 0)
- Debug.setDebugLevel(Debug.NONE);
- else if (args[i].compareTo("-debugwarn") == 0)
- Debug.setDebugLevel(Debug.WARNING);
- else if (args[i].compareTo("-debugerr") == 0)
- Debug.setDebugLevel(Debug.ERROR);
- else if (args[i].compareTo("-debugfatal") == 0)
- Debug.setDebugLevel(Debug.FATAL);
- else if (args[i].compareTo("-debugmsg") == 0)
- Debug.setDebugLevel(Debug.MESSAGE);
- else if (args[i].compareTo("-debuginfo") == 0)
- Debug.setDebugLevel(Debug.INFO);
- }
-
- return rv;
- }
-
- public static void main(String[] args) {
-
- if (parseArgs(args) < 0)
- System.exit(-1);
-
- // use pmFrame to get app icon
- pmFrame frame = new pmFrame(pmUtility.getResource("info_name"));
-
- myTop = new pmTop(frame);
-
- frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- System.exit(0);
- }
- });
-
- frame.getContentPane().add("Center", myTop);
- frame.pack();
- frame.setVisible(true);
- frame.repaint();
-
- pmLoad firstload = new pmLoad(myTop);
- myTop.loadView = firstload;
- firstload.Show();
-
- aboutBox = new pmAboutBox();
- commandLog = new pmLogDisplay(myTop, "ShowCommandConsole");
- findFrame = new pmFindFrame(myTop);
-
- /*
- * Make sure to open the help frame after the about box,
- * command log, and find frame windows have been opened.
- * Otherwise it might cause null pointer exceptions as it
- * takes a long time for the help frame to load.
- */
- helpFrame = new pmHelpFrame();
-
- }
-
- // disable Enter action **for all JTextFields**
- static {
- JTextField f = new JTextField();
- KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
- Keymap map = f.getKeymap();
- map.removeKeyStrokeBinding(enter);
- }
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmUserCancelledException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmUserCancelledException.java
deleted file mode 100644
index 15ff9fb61c..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmUserCancelledException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmUserCancelledException .java
- *
- */
-
-package com.sun.admin.pm.client;
-
-import java.lang.*;
-
-class pmUserCancelledException extends pmGuiException {
- public pmUserCancelledException(String s) {
- super(s);
- }
- public pmUserCancelledException() {
- super();
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmUtility.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmUtility.java
deleted file mode 100644
index dc10376dc5..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmUtility.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * pmUtility.java
- * Resource loading and utility classes
- */
-
-package com.sun.admin.pm.client;
-
-import java.awt.*;
-import java.applet.*;
-import java.io.*;
-import java.util.*;
-import javax.swing.*;
-
-import com.sun.admin.pm.server.*;
-
-
-/*
- * Utility class to provide common functions to the printing
- * manager classes
- */
-
-public class pmUtility {
-
-/*
- * Gets the localized string from the named bundle
- */
-
- public static String getCopyrightResource(String key) {
- String keyvalue = null;
- ResourceBundle bundle = null;
-
-
- try {
- bundle = ResourceBundle.getBundle(
- "com.sun.admin.pm.client.pmCopyright");
- } catch (MissingResourceException e) {
- Debug.fatal("Could not load pmCopyright file");
- }
-
- try {
- keyvalue = bundle.getString(key);
- } catch (MissingResourceException e) {
- Debug.error("CLNT: getCopyrightResource: Missing: " + key);
- keyvalue = new String("<<" + key + ">>");
- }
-
- return keyvalue;
- }
-
- public static String getResource(String key) {
- String keyvalue = null;
- ResourceBundle bundle = null;
-
-
- try {
- bundle = ResourceBundle.getBundle(
- "com.sun.admin.pm.client.pmResources");
- } catch (MissingResourceException e) {
- Debug.fatal("Could not load pmResources file");
- }
-
- try {
- keyvalue = bundle.getString(key);
- } catch (MissingResourceException e) {
- Debug.error("CLNT: getResource: Missing: " + key);
- keyvalue = new String("<<" + key + ">>");
- }
-
- return keyvalue;
- }
-
- public static int getIntResource(String key) {
- int keyvalue = 0;
- String s = null;
- ResourceBundle bundle = null;
-
- try {
- bundle = ResourceBundle.getBundle(
- "com.sun.admin.pm.client.pmResources");
- } catch (MissingResourceException e) {
- Debug.fatal("Could not load pmResources file");
- }
-
- try {
- s = bundle.getString(key);
- } catch (MissingResourceException e) {
- Debug.error("Missing: " + key);
- }
-
- Debug.message("Resource: " + key + " Value: " + s);
-
- if (s != null) {
- try {
- keyvalue = s.charAt(0);
- } catch (Exception x) {
- Debug.error("Resource: " + key + " threw: " + x);
- }
- }
-
- return keyvalue;
- }
-
- public static void doLogin(
- pmTop mytop, JFrame frame) throws pmGuiException {
-
- pmLogin l;
-
- if (mytop.ns.getNameService().equals("nis") ||
- mytop.ns.getNameService().equals("ldap")) {
-
- if (mytop.ns.getNameService().equals("nis")) {
-
- l = new pmLogin(
- frame,
- pmUtility.getResource("NIS.Authentication"),
- pmUtility.getResource("Enter.NIS.authentication.data."),
- mytop,
- "NISAuthentication");
-
- } else { // LDAP
-
- l = new pmLogin(
- frame,
- pmUtility.getResource("LDAP.Authentication"),
- pmUtility.getResource("Enter.LDAP.authentication.data."),
- mytop,
- "LDAPAuthentication");
- }
-
- l.setVisible(true);
-
- if ((l.getValue() != JOptionPane.OK_OPTION) &&
- (l.getValue() != JOptionPane.CANCEL_OPTION)) {
-
- pmMessageDialog m = new pmMessageDialog(
- frame,
- pmUtility.getResource("Login.Failure"),
- pmUtility.getResource(
- "Request.cannot.be.completed."));
- m.setVisible(true);
- throw new pmGuiException
- ("pmAccess: Cannot create Login screen");
- }
-
-
- if (l.getValue() == JOptionPane.CANCEL_OPTION) {
- throw new pmUserCancelledException("User.Cancelled.Login");
- } else {
-
- // Pass data to backend
-
- // getPassword sends back untrimmed string that is invalid
- // as a password as it's too long
- String tmpp = new String(l.passwordField.getPassword());
- mytop.ns.setPasswd(tmpp.trim());
-
- if (mytop.ns.getNameService().equals("ldap")) {
- // setUser for binddn
- mytop.ns.setUser(l.dnField.getText());
- // setNameServiceHost overloaded for LDAP server name
- mytop.ns.setNameServiceHost(l.serverField.getText());
- }
-
- try {
- mytop.ns.checkAuth();
- Debug.message("doLogin():checkauth() OK");
- } catch (Exception e) {
- Debug.warning("doLogin:checkAuth()exception " + e);
- throw new pmGuiException("Login.Authorization.Failed");
- }
- }
-
-
- // User has not put in printer or server
- } else {
- pmMessageDialog m =
- new pmMessageDialog(
- frame,
- pmUtility.getResource("Login.Failure"),
- pmUtility.getResource("Request.cannot.be.completed."),
- mytop, "LoginFailed");
-
- m.setVisible(true);
- throw new pmGuiException("pmAccess: Cannot create Login screen");
- }
-
- }
-
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pm_gen_copyright b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pm_gen_copyright
deleted file mode 100644
index 0f8310dd38..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pm_gen_copyright
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# This script generates the pmCopyright.java file
-# which contains the copyright data needed by
-# the Solaris Print Manager. The pmCopyright.java
-# file is generated during a make in order to update
-# the copyright with the correct date info, eliminating
-# the need to update the copyright notice with every
-# release.
-
-PMFILE=pmCopyright.java
-DATE=`/usr/bin/date '+%Y'`
-
-/usr/bin/rm -f ${PMFILE}
-/usr/bin/cat > ${PMFILE} <<END
-/*
- * GENERATED CODE
- *
- * Copyright ${DATE} Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-package com.sun.admin.pm.client;
-import java.util.*;
-
-public class pmCopyright extends ListResourceBundle {
- static final Object[][] pmHelpBundlecontents = {
-
- {"copyright_year", "1999-${DATE}"},
- {"dummy", ""}
- };
-
- public Object[][] getContents() {
- return pmHelpBundlecontents;
- }
-}
-END
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddAccess.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddAccess.rawhlp
deleted file mode 100644
index 9898ecfa8e..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddAccess.rawhlp
+++ /dev/null
@@ -1,97 +0,0 @@
-<TITLE> Dialog: Add Access to Printer</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=AddAccess -->
-
-<CONTENT>
-
-<p>
-
-Use the Add Access to Printer dialog to make an installed printer
-accessible to print client computers. See the printers.conf(4) man
-page if you need more information about print client commands.
-
-<p>
-
-<b>Printer Name:</b> The name of the printer you wish to add access
-to. The printer name must be a text string composed of uppercase or
-lowercase alphabetical characters (a-z, A-Z), digits (0-9), hyphens, or
-underscores. A printer name can be a maximum of 14 characters long.
-<p>
-
-<b>Printer Server:</b> The name of the printer server the named printer is
-installed on. The printer may be physically connected to
-the server or it may be a network printer.
-
-<p>
-
-<b>NOTE:</b> Oracle Solaris Print Manager does not check for the validity of
-Printer Name or Printer Server.
-
-<p>
-
-<b>Description:</b> [Optional] A description of the printer, including,
-for example, the type and location of the printer.
-<p>
-
-<b>Option: Default Printer:</b> If checked and no naming service is
-being used, this printer is designated as the default printer for the
-computer on which you are running Oracle Solaris Print Manager. If checked
-and a naming service is being used, designates this as the default
-printer for the naming service.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-access "add access" description "default printer" "naming service"
-"printer name" "printer server" dialog: add printer
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToAddAccess
-ToModify
-ToDelete
-ToInstallLocal
-ToInstallNetwork
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddAccessFailed.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddAccessFailed.rawhlp
deleted file mode 100644
index b0153bb465..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddAccessFailed.rawhlp
+++ /dev/null
@@ -1,62 +0,0 @@
-<TITLE> If Add Access Fails</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License, Version 1.0 only
- (the "License"). You may not use this file except in compliance
- with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright 2001 Sun Microsystems, Inc. All rights reserved.
--- Use is subject to license terms.
---
--- ident "%Z%%M% %I% %E% SMI"
--->
-<!-- Tag=AddAccessFailed -->
-
-<CONTENT>
-
-<p>
-
-You must enter a printer name and a printer server name; the printer
-server must be a remote server (not the current server). See the man
-page for lpadmin(1M) for more information.
-
-<p>
-
-Display the Command-Line Console to help pinpoint where the error
-may have occurred. Choose Show Command-Line Console from the Print
-Manager menu to display the Command-Line Console.
-
-</CONTENT>
-
-<p>
-
-<KEYWORDS>
-add access fail failure fails
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-AddAccess
-ToAddAccess
-ToShowCommand
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddPrinterFailed.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddPrinterFailed.rawhlp
deleted file mode 100644
index 948abce0f6..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/AddPrinterFailed.rawhlp
+++ /dev/null
@@ -1,68 +0,0 @@
-<TITLE> If New Printer Action Fails</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License, Version 1.0 only
- (the "License"). You may not use this file except in compliance
- with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright 2001 Sun Microsystems, Inc. All rights reserved.
--- Use is subject to license terms.
---
--- ident "%Z%%M% %I% %E% SMI"
--->
-<!-- Tag=AddPrinterFailed -->
-
-<CONTENT>
-
-<p>
-
-The printer name must be a text string composed of uppercase or
-lowercase alphabetical characters (a-z, A-Z), digits (0-9), hyphens,
-or underscores. A printer name can be a maximum of 14 characters long.
-
-<p>
-
-Display the Command-Line Console to help pinpoint where the error
-may have occurred. Choose Show Command-Line Console from the Print
-Manager menu to display the Command-Line Console. See the man
-page for lpadmin(1M) for more information.
-
-<p>
-
-</CONTENT>
-
-<p>
-
-<KEYWORDS>
-install fail failure "new attached" "new network" new printer action
-fails
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-InstallLocal
-InstallNetwork
-ToInstallLocal
-ToInstallNetwork
-ToShowCommand
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/DeletePrinterFailed.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/DeletePrinterFailed.rawhlp
deleted file mode 100644
index ea10c85462..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/DeletePrinterFailed.rawhlp
+++ /dev/null
@@ -1,56 +0,0 @@
-<TITLE> If Delete Printer Fails</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License, Version 1.0 only
- (the "License"). You may not use this file except in compliance
- with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
--- Copyright 2001 Sun Microsystems, Inc. All rights reserved.
--- Use is subject to license terms.
---
--- ident "%Z%%M% %I% %E% SMI"
--->
-<!-- Tag=DeletePrinterFailed -->
-
-<CONTENT>
-
-<p>
-
-If the Delete printer process fails, follow the instructions in the
-error dialog. If the instructions are incomplete or unclear, display
-the Command-Line Console to help pinpoint where the error may have
-occurred. Choose Show Command-Line Console from the Print Manager menu
-to display the Command-Line Console. See the man page for lpadmin(1M)
-for more information.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-delete fail failure printer fails
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToDelete
-ToShowCommand
-Overview
-MainWindow
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/HelpOnHelp.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/HelpOnHelp.rawhlp
deleted file mode 100644
index d8286edfa8..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/HelpOnHelp.rawhlp
+++ /dev/null
@@ -1,127 +0,0 @@
-<TITLE> Help on Help </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=HelpOnHelp -->
-
-<CONTENT>
-
-<p>
-
-Oracle Solaris Print Manager help is displayed if you choose one of the help
-items from the Help menu in the Print Manager main window or if you
-click on a Help button in any of the Print Manager windows or dialogs.
-
-<p>
-
-<b> Viewing a help article </b>
-
-<p>
-
-When you click on a Help button or choose a help item from the Help
-menu, help for the selected topic is displayed in the help viewer. See
-the headings labeled Navigation, Index, and Search below for
-instructions for viewing other help articles.
-
-<p>
-
-<b> Navigation </b>
-
-<p>
-
-To move around in an article, click on the scroll bar to the right of
-the article text. Note that you can expand or contract the help window
-by grabbing a corner with the mouse cursor and moving the mouse. See
-below for instructions for viewing other help articles.
-
-<p>
-
-Back button: Click to move to the last article viewed.
-<br>
-Forward button: Click to move to the article viewed prior to clicking
-the Back button.
-<br>
-See also pulldown menu: Select an item from the menu and click Show to display
-the selected article.
-<br>
-Show button: After selecting an item from the See also menu, click Show
-to display it.
-
-<p>
-
-<b> Index </b>
-
-<p>
-
-1. Click the Index tab at the top of the help window to display the index
-search tool.
-
-<p>
-
-By default the Search field is blank and all help articles are listed.
-To limit the index listing, enter the first letters of a help article;
-the articles that start with the entered letters will be displayed as
-you type. To see all the task descriptions, for instance, enter "to"
-and a blank.
-
-<p>
-
-2. To view an article, double-click on it or select it and click
-Show. The article is displayed in view mode.
-
-<p>
-
-<b> Search </b>
-
-<p>
-
-Click the Search tab at the top of the help window to display the
-search tool.
-
-<p>
-
-Enter a word or phrase in the Keywords field and click Search.
-
-<p>
-
-All articles with the entered keyword or phrase marked as a keyword
-will be displayed in the Search Results list.
-
-<p>
-
-To view an article, double-click on it or select it and click
-Show. The article is displayed in view mode.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-view index search show back forward "see also" help keywords
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-Overview
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallLocal.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallLocal.rawhlp
deleted file mode 100644
index ff8602be43..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallLocal.rawhlp
+++ /dev/null
@@ -1,171 +0,0 @@
-<TITLE> Dialog: New Attached Printer </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=InstallLocal -->
-
-<CONTENT>
-
-<p>
-
-Once you have physically connected the printer to the printer server,
-use the New Attached Printer dialog to install the printer, which
-makes the printer available for printing from the computer on which
-you are running Oracle Solaris Print Manager.
-
-<p>
-
-<b> Printer Name:</b>
- Specifies a unique name for the printer. The
- printer name must be a text string composed of
- uppercase or lowercase alphabetical characters
- (a-z, A-Z), digits (0-9), hyphens, or
- underscores. A printer name can be a maximum of
- 14 characters long.
-<p>
-
-<b> Printer Server:</b> This is the computer you have selected to act
-as the server for print actions. You must be logged on to this
-computer and be running Oracle Solaris Print Manager on it. Oracle
-Solaris Print Manager sets up this system with the appropriate software to manage
-local and remote printers.
-
-<p>
-<b> Description:</b>
- [Optional] Describes the printer, including the printer type and
- location, possibly, or provides other information about the
- printer.
-
-<p>
-
-<b> Printer Port:</b>
-
-Specifies the hardware port, such as /dev/term/a, that the printer is
-connected to.
-<p>
-
-<b> Printer Type:</b>
- Specifies the generic name for a type of
- printer. Supported printer types correspond to
- items listed in the /usr/share/lib/terminfo
- directories. Examples are PostScript, Daisy, and Diablo.
-
-<p>
-
-<b> File Contents:</b>
- Specifies the format of files that can be
- printed without any special filtering by the
- print software. PostScript is the default and is
- probably correct most of the time.
-<p>
-
-<b> Fault Notification:</b>
- Specifies how the superuser will be notified in
- case of a printer error.
-
-<p>
-
-<b> Options: Default Printer:</b> If checked, designates this printer
-as the default printer for printing jobs from the computer on which
-you are running Oracle Solaris Print Manager. If you are using a naming
-service, this printer will be the default printer for the naming
-service, also.
-
-<p>
-
-Note that this is the last place the print subsystem looks to
-determine where a particular print job will be printed; the
-destination option of the lp command is the first place looked, and
-other environment variables are checked before this one. See the man
-page for printers.conf(4) for a full explanation of the search order.
-
-<p>
-
-<b> Options: Banner:</b> Specifies whether a banner
-page will be printed between jobs.
-<br>
-<br>
-"Aways Print Banner" stipulates that a banner will always be printed
-and may not be turned off by the user.
-<br>
-"User Selectable - Default=on" stipulates that a banner will be printed
-unless the user selects
-to turn the banner off.
-<br>
-"Never Print Banner" stipulates that a banner will never be printed
-and may not be turned on by the user.
-
-<p>
-
-<b> User Access List:</b>
-Specifies the print clients that can
- print to this printer. By default, all print
- clients have access to this printer, as designated by the word
-"all" in the list.
-
-<p>
-
-If you want to restrict its use to individual users, enter a user name
-in the text field below the list and click Add. Other legal constructs
-are system-name!login-ID (user "login-ID" on system "system-name"),
-system-name!all (all users on system "system-name"), and all!login-ID
-(user "login-ID" on all systems). Use the lpadmin(1M) command to deny
-access to users.
-
-<p>
-
-To delete a user from the list, select the user in the list and click
-Delete.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-</CONTENT>
-
-<KEYWORDS>
-install "local printer" "printer name" server description port
-"printer type" "file contents" fault "fault notification" "default
-printer" banner "attached printer" new nobanner dialog: new attached
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToInstallLocal
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallLocalPPD.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallLocalPPD.rawhlp
deleted file mode 100644
index c344d43861..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallLocalPPD.rawhlp
+++ /dev/null
@@ -1,177 +0,0 @@
-<TITLE> Dialog: New Attached Printer </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=InstallLocal -->
-
-<CONTENT>
-
-<p>
-
-Once you have physically connected the printer to the printer server,
-use the New Attached Printer dialog to install the printer, which
-makes the printer available for printing from the computer on which
-you are running Oracle Solaris Print Manager.
-
-<p>
-
-<b> Printer Name:</b>
- Specifies a unique name for the printer. The
- printer name must be a text string composed of
- uppercase or lowercase alphabetical characters
- (a-z, A-Z), digits (0-9), hyphens, or
- underscores. A printer name can be a maximum of
- 14 characters long.
-<p>
-
-<b> Printer Server:</b> This is the computer you have selected to act
-as the server for print actions. You must be logged on to this
-computer and be running Oracle Solaris Print Manager on it. Oracle
-Solaris Print Manager sets up this system with the appropriate software to manage
-local and remote printers.
-
-<p>
-<b> Description:</b>
- [Optional] Describes the printer, including the printer type and
- location, possibly, or provides other information about the
- printer.
-
-<p>
-
-<b> Printer Port:</b>
-
-Specifies the hardware port, such as /dev/term/a, that the printer is
-connected to.
-<p>
-
-<b> Printer Make:</b>
- Specifies the printer make, or manufacturer. This
- information is on the printer and/or in the documentation
- that is delivered with the printer.
-<p>
-
-<b> Printer Model:</b>
- Specifies the printer model. This information
- is found on the printer and/or in the documentation that is
- delivered with the printer.
-<p>
-
-<b> Printer Driver:</b>
- Specifies the printer driver to use with this printer. The label
- name followed in parentheses by one of the following letters
-representing the repository in which the printer driver information resides:
-U (user supplied printer information), A (administrator supplied printer
-information), V (vendor supplied printer information), or S (system supplied
-printer information), precedes the name of the Printer Driver.
-<p>
-
-<b> Fault Notification:</b>
- Specifies how the superuser will be notified in
- case of a printer error.
-
-<p>
-
-<b> Options: Default Printer:</b> If checked, designates this printer
-as the default printer for printing jobs from the computer on which
-you are running Oracle Solaris Print Manager. If you are using a naming
-service, this printer will be the default printer for the naming
-service, also.
-
-<p>
-
-Note that this is the last place the print subsystem looks to
-determine where a particular print job will be printed; the
-destination option of the lp command is the first place looked, and
-other environment variables are checked before this one. See the man
-page for printers.conf(4) for a full explanation of the search order.
-
-<p>
-
-<b> Options: Banner:</b> Specifies whether a banner
-page will be printed between jobs.
-<br>
-<br>
-"Aways Print Banner" stipulates that a banner will always be printed
-and may not be turned off by the user.
-<br>
-"User Selectable - Default=on" stipulates that a banner will be printed
-unless the user selects
-to turn the banner off.
-<br>
-"Never Print Banner" stipulates that a banner will never be printed
-and may not be turned on by the user.
-
-<p>
-
-<b> User Access List:</b>
-Specifies the print clients that can
- print to this printer. By default, all print
- clients have access to this printer, as designated by the word
-"all" in the list.
-
-<p>
-
-If you want to restrict its use to individual users, enter a user name
-in the text field below the list and click Add. Other legal constructs
-are system-name!login-ID (user "login-ID" on system "system-name"),
-system-name!all (all users on system "system-name"), and all!login-ID
-(user "login-ID" on all systems). Use the lpadmin(1M) command to deny
-access to users.
-
-<p>
-
-To delete a user from the list, select the user in the list and click
-Delete.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-</CONTENT>
-
-<KEYWORDS>
-install "local printer" "printer name" server description port
-"printer make" "printer model" "printer driver" fault "fault notification" "default
-printer" banner "attached printer" new nobanner dialog: new attached
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToInstallLocal
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallNetwork.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallNetwork.rawhlp
deleted file mode 100644
index c6d372193e..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallNetwork.rawhlp
+++ /dev/null
@@ -1,176 +0,0 @@
-<title> Dialog: New Network Printer </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=InstallNetwork -->
-
-<CONTENT>
-
-<p>
-
-Use the New Network Printer dialog to install a network printer,
-thus making the printer available for printing from the network.
-
-<p>
-
-<b> Printer Name:</b>
- Specifies a unique name for the printer. The
- printer name must be a text string composed of
- uppercase or lowercase alphabetical characters
- (a-z, A-Z), digits (0-9), hyphens, or
- underscores. A printer name can be a maximum of
- 14 characters long.
-<p>
-
-<b> Printer Server:</b> This is the computer you have selected to act
-as the server for print actions. You must be logged on to this
-computer and be running Oracle Solaris Print Manager on it. Oracle
-Solaris Print Manager sets up this system with the appropriate software to manage
-local and remote printers.
-
-<p>
-<b> Description:</b>
- [Optional] Describes the printer, including the printer type and
- location, possibly, or provides other information about the
- printer.
-
-<p>
-
-<b> Printer Type:</b>
- Specifies the generic name for a type of
- printer. Supported printer types correspond to
- entries in the /usr/share/lib/terminfo
- directory. Examples are PostScript, Daisy, and Diablo.
-<p>
-
-<b> File Contents:</b>
- Specifies the format of files that can be
- printed without any special filtering by the
- print software. PostScript is the default and is
- probably correct most of the time.
-<p>
-
-<b> Fault Notification:</b>
- Specifies how the superuser will be notified in
- case of a printer error.
-
-<p>
-<b> Destination:</b>
-<br>
-For <b>BSD</b> Protocol, the network name of the printer followed by a colon
-and the printer-vendor-supplied queue name.
-<br>
-For <b>TCP</b> Protocol, the network name of the printer followed by a colon
-and the tcp port number to connect to.
-<br>
-For <b>URI</b> Protocol, a printer URI to be used in connecting to the remote
-printer. For example: "smb://user@printer-host/printer-name".
-<p>
-
-<b> Protocol:</b>
-The internet protocol for file transfer; choices are BSD, TCP, or URI.
-<p>
-
-<b> Options: Default Printer:</b> If checked, this printer is
-designated as the default printer for printing jobs sent to this
-server. If another printer had been designated as the default printer
-for the network, this printer will replace it as the default. If you
-are using a naming service, this printer will be the default printer
-for the naming service, also.
-
-<p> Note that this is the last place the print subsystem looks to
-determine where a particular print job will be printed; the
-destination option of the lp command is the first place looked, and
-other environment variables are checked before this one. See the man
-page for printers.conf(4) for a full explanation of the search order.
-
-<p>
-
-<b> Options: Banner:</b> Specifies whether a banner
-page will be printed between jobs.
-<br>
-<br>
-"Aways Print Banner" stipulates that a banner will always be printed
-and may not be turned off by the user.
-<br>
-"User Selectable - Default=on" stipulates that a banner will be printed
-unless the user selects
-to turn the banner off.
-<br>
-"Never Print Banner" stipulates that a banner will never be printed
-and may not be turned on by the user.
-
-<p>
-
-<b> User Access List:</b>
-Specifies the print clients that can
- print to this printer. By default, all print
- clients have access to this printer, as designated by the word
-"all" in the list.
-<p>
-
-To add a user to the list, type a user name in the blank text field
-below the list and click Add. Note that this user name replaces "all"
-or "none" if either "all" or "none" is in the user access list. If
-"all" or "none" is added as a user, "all" or "none" will replace the
-names in the list.
-
-<p>
-
-To delete a user from the list, select the user in the list and click
-Delete.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-
-install "network printer" "printer name" server description port
-"printer type" "file contents" fault "fault notification" "default
-printer" banner new dialog: network printer
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToInstallNetwork
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallNetworkPPD.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallNetworkPPD.rawhlp
deleted file mode 100644
index 77c3217898..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/InstallNetworkPPD.rawhlp
+++ /dev/null
@@ -1,187 +0,0 @@
-<TITLE> Dialog: New Network Printer </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=InstallNetwork -->
-
-<CONTENT>
-
-<p>
-
-Use the New Network Printer dialog to install a network printer,
-thus making the printer available for printing from the network.
-
-<p>
-
-<b> Printer Name:</b>
- Specifies a unique name for the printer. The
- printer name must be a text string composed of
- uppercase or lowercase alphabetical characters
- (a-z, A-Z), digits (0-9), hyphens, or
- underscores. A printer name can be a maximum of
- 14 characters long.
-<p>
-
-<b> Printer Server:</b> This is the computer you have selected to act
-as the server for print actions. You must be logged on to this
-computer and be running Oracle Solaris Print Manager on it. Oracle
-Solaris Print Manager sets up this system with the appropriate software to manage
-local and remote printers.
-
-<p>
-<b> Description:</b>
- [Optional] Describes the printer, including the printer type and
- location, possibly, or provides other information about the
- printer.
-
-<p>
-
-<b> Printer Make:</b>
- Specifies the printer make, or manufacturer. This
- information is on the printer and/or in the documentation
- that is delivered with the printer.
-<p>
-
-<b> Printer Model:</b>
- Specifies the printer model. This information
- is found on the printer and/or in the documentation that is
- delivered with the printer.
-
-<p>
-
-<b> Printer Driver:</b>
- Specifies the printer driver to use with this printer. The label
- name followed in parentheses by one of the following letters
-representing the repository in which the printer driver information resides:
-U (user supplied printer information), A (administrator supplied printer
-information), V (vendor supplied printer information), or S (system supplied
-printer information), precedes the name of the Printer Driver.
-<p>
-
-
-<b> Fault Notification:</b>
- Specifies how the superuser will be notified in
- case of a printer error.
-
-<p>
-<b> Destination:</b>
-<br>
-For <b>BSD</b> Protocol, the network name of the printer followed by a colon
-and the printer-vendor-supplied queue name.
-<br>
-For <b>TCP</b> Protocol, the network name of the printer followed by a colon
-and the tcp port number to connect to.
-<br>
-For <b>URI</b> Protocol, a printer URI to be used in connecting to the remote
-printer. For example: "smb://user@printer-host/printer-name".
-<p>
-
-<b> Protocol:</b>
-The internet protocol for file transfer; choices are BSD, TCP, or URI.
-<p>
-
-<b> Options: Default Printer:</b> If checked, this printer is
-designated as the default printer for printing jobs sent to this
-server. If another printer had been designated as the default printer
-for the network, this printer will replace it as the default. If you
-are using a naming service, this printer will be the default printer
-for the naming service, also.
-
-<p> Note that this is the last place the print subsystem looks to
-determine where a particular print job will be printed; the
-destination option of the lp command is the first place looked, and
-other environment variables are checked before this one. See the man
-page for printers.conf(4) for a full explanation of the search order.
-
-<p>
-
-<b> Options: Banner:</b> Specifies whether a banner
-page will be printed between jobs.
-<br>
-<br>
-"Aways Print Banner" stipulates that a banner will always be printed
-and may not be turned off by the user.
-<br>
-"User Selectable - Default=on" stipulates that a banner will be printed
-unless the user selects
-to turn the banner off.
-<br>
-"Never Print Banner" stipulates that a banner will never be printed
-and may not be turned on by the user.
-
-<p>
-
-<p>
-
-<b> User Access List:</b>
-Specifies the print clients that can
- print to this printer. By default, all print
- clients have access to this printer, as designated by the word
-"all" in the list.
-<p>
-
-To add a user to the list, type a user name in the blank text field
-below the list and click Add. Note that this user name replaces "all"
-or "none" if either "all" or "none" is in the user access list. If
-"all" or "none" is added as a user, "all" or "none" will replace the
-names in the list.
-
-<p>
-
-To delete a user from the list, select the user in the list and click
-Delete.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-
-install "network printer" "printer name" server description port
-"printer make" "printer model" "printer driver" fault "fault notification" "default
-printer" banner new dialog: network printer
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToInstallNetwork
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/LDAPAuthentication.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/LDAPAuthentication.rawhlp
deleted file mode 100644
index 2e6070dc66..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/LDAPAuthentication.rawhlp
+++ /dev/null
@@ -1,132 +0,0 @@
-<TITLE> LDAP Authentication</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=LDAPAuthentication -->
-
-<CONTENT>
-
-<p>
-
-If you are using the LDAP naming service, you will need the distinguished
-name and password for a user who has update privileges to make any changes.
-Before making changes to the LDAP directory the user should be fully aware of
-the items in the <b>notes</b> below.
-The LDAP Authentication dialog is displayed when you select LDAP as the
-naming service.
-
-<p>
-
-1. Check the LDAP server name for correctness. You may select a
-different server name if appropriate.
-
-<p>
-
-2. Check the Distinguished Name (DN) for correctness. You may enter a
-different distinguished name of another user if appropriate. This may be the DN
-of any directory user who has permissions (directory update privileges) to
-update printer entries in the LDAP directory for the current ldapclient (1M)
-naming service (NS) domain.
-
-<p>
-
-3. Enter the password for the user's Distinguished Name.
-
-<p>
-
-4. Click OK.
-
-<p>
-
-The entries you have made will be validated against the LDAP directory and then
-saved, the LDAP Authentication dialog will be dismissed.
-
-<p>
-
-Click Cancel if you don't know the password for the Distinguished Name.
-
-<p>
-
-<b>Note:</b> Keep the following in mind if you are using Oracle Solaris Print
-Manager to update printer information in the LDAP naming service:
-
-<p>
-
-If the LDAP server is the Netscape Directory Server (NSDS) then
-the default distinguished name is "cn=Directory Manager".
-If the LDAP server is Sun Directory Server then an example
-of the distinguished name is "cn=admin, dc=XYZ, dc=COM".
-
-The Oracle Solaris Print Manager uses ldapclient(1M) to determine
-the default LDAP server name. If there is more than one
-server specified then the first one will be used.
-
-<p>
-
-The Print Manager always displays printer entries from the current
-ldapclient (1M) server. If this is not the domain Master LDAP server then
-the list of printers displayed may <b>not</b> be the current list of printers,
-this is because the ldapclient replica server may not have been updated by the
-master server and so be out of sync with the master. Replica servers can have
-various update replication agreements, for example; updated immediately there
-is a change on the master, or updated once a day from the master.
-
-<p>
-
-If the selected LDAP server is a replica LDAP server, any <b>updates</b> will be
-referred to the master server and done there. This again means the printer list
-could be out of sync with the master. For example, a deleted printer may still
-appear in the displayed printer list until the replica is updated from
-the master.
-
-<p>
-
-Users can use the ldap command line utilities (ldapadd (1) & ldapmodify (1))
-to update printer entries in the directory, but this is not recommended. If
-these utilities are used then the user <b>must ensure</b> that the printer-name
-attribute value is unique within the ou=printers container. If it is not unique
-the result of modifies done by the print manager (or lpset (1M)) may not be
-predictable.
-
-<p>
-
-</CONTENT>
-
-<p>
-
-<KEYWORDS>
-
-LDAP ldap "LDAP server" authentication login password naming "naming
-service" files "replica server" replica replication referral ldapclient
-"distinguished name" DN
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-NameService
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/LoginFailed.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/LoginFailed.rawhlp
deleted file mode 100644
index 8844f2323b..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/LoginFailed.rawhlp
+++ /dev/null
@@ -1,59 +0,0 @@
-<TITLE> If Login Fails</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright 2009 Sun Microsystems, Inc. All rights reserved.
--- Use is subject to license terms.
--->
-<!-- Tag=LoginFailed -->
-
-<CONTENT>
-
-<p>
-
-If the NIS naming service is being used, you will need to know the
-password for the naming service master. If LDAP is being used then
-a fully distinguished name with update privilege and password will
-be required. Note that default values may need to be overridden.
-See the man page for lpadmin(1M) and the help articles, "About
-Naming Services" and "NIS Authentication," for further information.
-
-<p>
-
-</CONTENT>
-
-<p>
-
-<KEYWORDS>
-"login failed" login fail failure fails
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToStart
-ToShowCommand
-NISAuthentication
-NameService
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/MainWindow.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/MainWindow.rawhlp
deleted file mode 100644
index 8a7f535d7a..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/MainWindow.rawhlp
+++ /dev/null
@@ -1,116 +0,0 @@
-<TITLE> Oracle Solaris Print Manager Main Window </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
--->
-<!-- Tag=MainWindow -->
-
-<CONTENT>
-
-<p>
-
-The main window is the starting point for any Oracle Solaris Print Manager
-activities.
-
-<p>
-<b> Print Manager Menu: </b> Select Naming Service, Show
-Command-Line Console, Confirm All Actions, Exit
-
-<p>
-<b> Printer Menu: </b> Add Access to Printer, New Attached
-Printer, New Network Printer, Modify Printer Properties,
-Delete Printer
-
-<p>
-<b> Tools Menu: </b> Find Printer
-
-<p>
-<b> Help Menu: </b> Overview, On Help, About Print Manager
-<p>
-
-<b> List of Printers: </b> This is the list of printers installed on
-the computer on which you are running Oracle Solaris Print Manager, or, if a
-naming service is being used, all printers in the naming service.
-
-<p>
-There are three columns in the list:
-<p>
-
-<b> Printer Name:</b> The name of the printer as specified during printer
-installation.
-<p>
-
-<b> Printer Server:</b> The name of the printer server for the printer
-specified in the Printer Name column.
-<p>
-
-<b> Description:</b> A description of the printer as specified during
-printer installation (New Attached Printer or New Network
-Printer) or modification (Modify Printer Properties). The
-description might include the location of the printer and its printer
-type.
-
-<p>
-
-The footer panel at the bottom of the window has two or three entries:
-
-<p>
-
-<b> Default Printer: </b> If no naming service is being used, the
-default printer for the computer on which you are running Oracle Solaris
-Print Manager. If a naming service is being used, the default printer
-for the naming service.
-
-<p>
-
-<b> Naming Service: </b> The naming service -- NIS or LDAP --
-that is being used for printing. This is not displayed if no naming
-service is being used.
-
-<p>
-
-<b> Domain or Host: </b> The network domain you are working in or the
-current host (if no naming service is being used). If you are
-using a naming service, the list of printers includes all printers in
-this domain.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-"Print Manager menu" "Printer menu" "Tools menu" "Help menu" "list
-of printers" printers "printer name" "printer server" description
-"default printer" "naming service" domain Oracle solaris print manager main
-window
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-Overview
-ToAddAccess
-ToInstallLocal
-ToInstallNetwork
-ToModify
-ToDelete
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/Modify.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/Modify.rawhlp
deleted file mode 100644
index 019f379c43..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/Modify.rawhlp
+++ /dev/null
@@ -1,167 +0,0 @@
-<TITLE> Dialog: Modify Printer Properties </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=Modify -->
-
-<CONTENT>
-
-<p>
-
-Use the Modify Printer Properties dialog to modify an installed
-printer. Note that you can modify the Description field only if this
-is not an attached printer. You can also check or uncheck the Default
-Printer box.
-
-<p>
-
-<b> Printer Name:</b> Cannot be modified.
-
-<p>
-
-<b> Printer Server:</b> Cannot be modified.
-This is the computer you have selected to act
-as the server for print actions. You must be logged on to this
-computer and be running Oracle Solaris Print Manager on it.
-
-<p>
-
-<b> Description:</b>
- [Optional] Describes the printer, including the printer type and
- location, possibly, or provides other information about the
- printer.
-
-<p>
-
-<b> Printer Port:</b> Cannot be modified.
-Specifies the hardware port, such as /dev/term/a, that the printer is
-connected to.
-
-<p>
-
-<b> Printer Type:</b>
- Specifies the generic name for a type of
- printer. Supported printer types correspond to
- items listed in the /usr/share/lib/terminfo
- directories. Examples are PostScript, Daisy, and Diablo.
-
-<p>
-
-<b> File Contents:</b>
- Specifies the format of files that can be
- printed without any special filtering by the
- print software. PostScript is the default and is
- probably correct most of the time.
-<p>
-
-<b> Fault Notification:</b>
- Specifies how the superuser will be notified in
- case of a printer error.
-
-<p>
-
-<b> Options: Default Printer:</b> If checked, designates this printer
-as the default printer for printing jobs from the computer on which
-you are running Oracle Solaris Print Manager. If you are using a naming
-service, this printer will be the default printer for the naming
-service, also.
-
-<p>
-
-Note that this is the last place the print subsystem looks to
-determine where a particular print job will be printed; the
-destination option of the lp command is the first place looked, and
-other environment variables are checked before this one. See the man
-page for printers.conf(4) for a full explanation of the search order.
-
-<p>
-
-<b> Options: Banner:</b> Specifies whether a banner
-page will be printed between jobs.
-<br>
-<br>
-"Aways Print Banner" stipulates that a banner will always be printed
-and may not be turned off by the user.
-<br>
-"User Selectable - Default=on" stipulates that a banner will be printed
-unless the user selects
-to turn the banner off.
-<br>
-"Never Print Banner" stipulates that a banner will never be printed
-and may not be turned on by the user.
-
-<p>
-
-<b> User Access List:</b>
-Specifies the print clients that can
- print to this printer. By default, all print
- clients have access to this printer, as designated by the word
-"all" in the list.
-
-<p>
-
-If you want to restrict its use to individual users, enter a user name
-in the text field below the list and click Add. Other legal constructs
-are system-name!login-ID (user "login-ID" on system "system-name"),
-system-name!all (all users on system "system-name"), and all!login-ID
-(user "login-ID" on all systems). Use the lpadmin(1M) command to deny
-access to users.
-
-<p>
-
-To delete a user from the list, select the user in the list and click
-Delete.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-</CONTENT>
-
-<KEYWORDS> modify properties "printer properties" "attached printer"
-"printer name" server description port "printer type" "file contents"
-fault "fault notification" "default printer" banner "attached printer"
-new nobanner dialog: printer
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToModify
-ModifyFailed
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ModifyFailed.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ModifyFailed.rawhlp
deleted file mode 100644
index 97a59c6a46..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ModifyFailed.rawhlp
+++ /dev/null
@@ -1,62 +0,0 @@
-<TITLE> If Modify Printer Fails</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License, Version 1.0 only
- (the "License"). You may not use this file except in compliance
- with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright 2001 Sun Microsystems, Inc. All rights reserved.
--- Use is subject to license terms.
---
--- ident "%Z%%M% %I% %E% SMI"
--->
-<!-- Tag=ModifyFailed -->
-
-<CONTENT>
-
-<p>
-
-An attempt to modify printer properties failed. It is possible that
-someone has deleted the printer before this modify operation completed.
-
-<p>
-
-Display the Command-Line Console to help pinpoint where the error
-may have occurred. Choose Show Command-Line Console from the Print
-Manager menu to display the Command-Line Console. See the man page for
-lpadmin(1M) for further information.
-
-</CONTENT>
-
-<p>
-
-<KEYWORDS>
-modify "modify printer" fail failure printer fails
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToModify
-Modify
-ToShowCommand
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ModifyPPD.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ModifyPPD.rawhlp
deleted file mode 100644
index 6399b8ac94..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ModifyPPD.rawhlp
+++ /dev/null
@@ -1,176 +0,0 @@
-<TITLE> Dialog: Modify Printer Properties </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ModifyPPD -->
-
-<CONTENT>
-
-<p>
-
-Use the Modify Printer Properties dialog to modify an installed
-printer. Note that you can modify the Description field only if this
-is not an attached printer. You can also check or uncheck the Default
-Printer box.
-
-<p>
-
-<b> Printer Name:</b> Cannot be modified.
-
-<p>
-
-<b> Printer Server:</b> Cannot be modified.
-This is the computer you have selected to act
-as the server for print actions. You must be logged on to this
-computer and be running Oracle Solaris Print Manager on it.
-
-<p>
-
-<b> Description:</b>
- [Optional] Describes the printer, including the printer type and
- location, possibly, or provides other information about the
- printer.
-
-<p>
-
-<b> Printer Port:</b> Cannot be modified.
-Specifies the hardware port, such as /dev/term/a, that the printer is
-connected to.
-
-<p>
-
-<b> Printer Make:</b>
- Specifies the printer make, or manufacturer. This
- information is on the printer and/or in the documentation
- that is delivered with the printer.
-
-<p>
-
-<b> Printer Model:</b>
- Specifies the printer model. This information
- is found on the printer and/or in the documentation that is
- delivered with the printer.
-<p>
-
-<b> Printer Driver:</b>
- Specifies the printer driver to use with this printer. The label
- name followed in parentheses by one of the following letters
-representing the repository in which the printer driver information resides:
-U (user supplied printer information), A (administrator supplied printer
-information), V (vendor supplied printer information), or S (system supplied
-printer information), precedes the name of the Printer Driver.
-<p>
-
-
-<b> Fault Notification:</b>
- Specifies how the superuser will be notified in
- case of a printer error.
-
-<p>
-
-<b> Options: Default Printer:</b> If checked, designates this printer
-as the default printer for printing jobs from the computer on which
-you are running Oracle Solaris Print Manager. If you are using a naming
-service, this printer will be the default printer for the naming
-service, also.
-
-<p>
-
-Note that this is the last place the print subsystem looks to
-determine where a particular print job will be printed; the
-destination option of the lp command is the first place looked, and
-other environment variables are checked before this one. See the man
-page for printers.conf(4) for a full explanation of the search order.
-
-<p>
-
-<b> Options: Banner:</b> Specifies whether a banner
-page will be printed between jobs.
-<br>
-<br>
-"Aways Print Banner" stipulates that a banner will always be printed
-and may not be turned off by the user.
-<br>
-"User Selectable - Default=on" stipulates that a banner will be printed
-unless the user selects
-to turn the banner off.
-<br>
-"Never Print Banner" stipulates that a banner will never be printed
-and may not be turned on by the user.
-
-<p>
-
-<b> User Access List:</b>
-Specifies the print clients that can
- print to this printer. By default, all print
- clients have access to this printer, as designated by the word
-"all" in the list.
-
-<p>
-
-If you want to restrict its use to individual users, enter a user name
-in the text field below the list and click Add. Other legal constructs
-are system-name!login-ID (user "login-ID" on system "system-name"),
-system-name!all (all users on system "system-name"), and all!login-ID
-(user "login-ID" on all systems). Use the lpadmin(1M) command to deny
-access to users.
-
-<p>
-
-To delete a user from the list, select the user in the list and click
-Delete.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-</CONTENT>
-
-<KEYWORDS> modify properties "printer properties" "attached printer"
-"printer name" server description port "printer make" "printer model"
-"printer driver" fault "fault notification" "default printer" banner
-"attached printer"
-new nobanner dialog: printer
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToModify
-ModifyFailed
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/NISAuthentication.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/NISAuthentication.rawhlp
deleted file mode 100644
index 6294176d9b..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/NISAuthentication.rawhlp
+++ /dev/null
@@ -1,97 +0,0 @@
-<TITLE> NIS Authentication</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=NISAuthentication -->
-
-<CONTENT>
-
-<p>
-
-If you are using the NIS naming service, you will need the root
-password for the NIS master computer to make any changes. The NIS
-Authentication dialog is displayed when you select NIS as the
-naming service.
-
-<p>
-
-1. Enter the password for the NIS master.
-
-<p>
-
-2. Click OK.
-
-<p>
-
-The entries you have made will be saved and the NIS Authentication
-dialog will be dismissed.
-
-<p>
-
-Click Cancel if you don't know the password for the NIS master.
-
-<p>
-
-<b>Note:</b> Keep the following in mind if you are using Oracle Solaris Print
-Manager to update printer information in the NIS name service:
-
-<p>
-
-- If your network is set up with NIS master and slave servers,
-the NIS slaves may not see the updated printer information
-until the NIS slaves are updated. See ypmake(1M) for more
-information.
-
-<p>
-
-- If your NIS servers are running Oracle Solaris 2.5 and compatible
-versions, you must have explicit permissions on the NIS master
-server to update the maps. This means an entry for your system
-name must reside in root's .rhosts file on the NIS master server.
-
-<p>
-
-- If you have modified the yp makefile to use something other
-than /etc/printers.conf as the source for the NIS map,
-printers.conf.byname, do not use Oracle Solaris Print Manager to modify NIS.
-
-</CONTENT>
-
-<p>
-
-<KEYWORDS>
-
-NIS "NIS master" master authentication login password naming "naming
-service" files .rhosts
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-NameService
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/NameService.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/NameService.rawhlp
deleted file mode 100644
index 885356086f..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/NameService.rawhlp
+++ /dev/null
@@ -1,155 +0,0 @@
-<TITLE> About Naming Services </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
--->
-<!-- Tag=NameService -->
-
-<CONTENT>
-
-<p>
-
-You can select "files" or a naming service (NIS or LDAP) when you
-start up Oracle Solaris Print Manager or when you choose Select Naming
-Service from the Print Manager menu. See the descriptions of each
-of the choices below.
-
-<p>
-
-Once you select a naming service, Print Manager will retrieve and update
-printer information in the database for the specified naming service
-when you add, modify, or delete a printer. Note that in addition to
-the naming service map, when updating attached or network printers
-the file /etc/printers.conf is also updated when a naming service
-is being used.
-
-<p>
-
-When you make a remote printer accessible by choosing Add Access to
-Printer from the Printer menu, either the naming service map is
-updated or /etc/printers.conf is updated (if "files" is selected and
-no naming service is being used).
-
-<p>
-
-<b>files</b>: Retrieve or update printer information from
-the file /etc/printers.conf.
-
-<p>
-
-<b>NIS</b>: Use the printers.conf.byname map stored in the Network
-Information Service for retrieving or updating printer information.
-See the ypserv(1M) man page for more information.
-
-<p>
-
-<b>Note: </b>When a site is set up with a NIS master and slaves, if the
-host binds to a slave, a user may not see NIS updates made through
-Print Manager until the slave computers are updated. See the ypmake(1M)
-man page for more information.
-
-<p>
-
-<b>LDAP</b>: Use the printers map stored in the LDAP
-naming service for retrieving or updating printer information.
-See the ldap(1) man page for more information.
-
-<p>
-
-To used the LDAP naming service the host computer must be configured as a
-LDAP client, see ldapclient(1M).
-
-<p>
-
-<b>Note:</b>If the host binds to a replica LDAP server, a user may not see
-updates made through Print Manager until the replica is updated from the master
-LDAP server.
-
-<p>
-
-The following privileges are needed for each naming service:
-
-<p>
-
-<b>For files:</b>
-
-<p>
-
-The tool must be started as root.
-
-<p>
-
-<b>For NIS:</b>
-
-<p>
-
-1) The tool must be started as root.
-
-<p>
-
-2) The password for the NIS master will be required when you select
-this naming service.
-
-<p>
-
-3) For NIS servers running pre-2.6 Oracle Solaris, you need to set up an
-rhosts entry on the NIS server allowing root on the print server root
-access on the NIS server. You must have explicit permissions on the
-NIS master server to update the maps. This means an entry for your
-host name must reside in root's .rhosts file on the NIS master server.
-See the hosts.equiv(4) man page for more information.
-
-<p>
-
-<b>For LDAP:</b>
-
-<p>
-
-1) The tool must be started as root.
-
-<p>
-
-2) A fully distinguished name (DN) with update privilege and password will
- be required when you select this naming service.
-
-<p>
-
-</CONTENT>
-
-<p>
-
-<KEYWORDS>
-
-"name service" "naming service" name naming nis none ldap
-keylogin printers.conf service files
-hosts.equiv nisgrpadm about services
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToStart
-ToSelectName
-Overview
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/Overview.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/Overview.rawhlp
deleted file mode 100644
index 361c3580e5..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/Overview.rawhlp
+++ /dev/null
@@ -1,122 +0,0 @@
-<TITLE> Overview </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=Overview -->
-
-<CONTENT>
-
-<p>
-
-Use Oracle Solaris Print Manager to select a naming service, to install attached
-or network printers, and to add, modify, or remove access to installed
-printers. Five windows or dialogs and 11 tasks -- listed below -- are described
-in the help volume. To view one of the help articles, select it
-in the See also pulldown menu and click the Show button.
-
-<p>
-
-If you need more information about printing, see the "Oracle Solaris Print
-Manager Administration Guide" AnswerBook or the "Setting Up Printers"
-chapter in the Oracle Solaris System Administrator AnswerBook.
-
-<p>
-
-<b> Windows and Dialogs </b>
-<p>
-Main Window
-<br>
-Add Access to Printer
-<br>
-New Attached Printer
-<br>
-New Network Printer
-<br>
-Modify Printer Properties
-
-<p>
-<b>Tasks</b>
-<p>
-To Start Oracle Solaris Print Manager
-<br>
-To Add Access to an Installed Printer
-<br>
-To Install an Attached Printer
-<br>
-To Install a Network Printer
-<br>
-To Modify Printer Properties
-<br>
-To Delete a Printer
-<br>
-To Select a Naming Service
-<br>
-To Exit Oracle Solaris Print Manager
-<br>
-To Find a Printer
-<br>
-To Show the Command-Line Console
-<br>
-To Confirm All Actions
-<p>
-
-<b>More About Printing and Oracle Solaris Print Manager </b>
-
-<p>
-
-If you need more information about printing or about Oracle Solaris Print
-Manager, including a description of mouseless navigation, see the
-"Oracle Solaris Print Manager Administration Guide" AnswerBook or the
-"Setting Up Printers" chapter in the Oracle Solaris System Administrator
-AnswerBook.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-overview contents task dialog
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-MainWindow
-AddAccess
-InstallLocal
-InstallNetwork
-Modify
-ToAddAccess
-ToStart
-ToInstallLocal
-ToInstallNetwork
-ToModify
-ToDelete
-ToSelectName
-ToExit
-ToFindPrinter
-ToShowCommand
-ToConfirmActions
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrintManagerSettings.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrintManagerSettings.rawhlp
deleted file mode 100644
index de175c0b7d..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrintManagerSettings.rawhlp
+++ /dev/null
@@ -1,111 +0,0 @@
-<TITLE> Print Manager Settings </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=Overview -->
-
-<CONTENT>
-
-<p>
-
-The Oracle Solaris Print Manager has tool-wide settings that may be selected.
-Each of these choices applies to all further tasks utilized within the
-Oracle Solaris Print Manager. For example, once Show Command-Line Console has been
-selected, or checked, the Console will be visible for all tasks until
-this selection is turned off, or unchecked.
-
-
-<p>
-
-<b> Show Command-Line Console: </b>
-The Command-Line Console displays the command-line version of add, modify,
-delete actions. Errors and warnings may also be displayed after the
-command.
-
-<p>
-The default is off.
-
-<p>
-
-<b> Confirm All Actions: </b>
-When Confirm All Actions is selected, all subsequent Oracle Solaris Print
-Manager actions will require confirmation before being performed.
-
-<p>
-The default is off.
-
-<p>
-<b> Use PPD files: </b>
-When configuring local printers, PPD files may be used to describe the
-printer. If selected, the New Attached Printer and New Network Printer
-screens offer the selection of printer Make, Model, and Printer Driver
-from matching PPD files. Duplicate entries may be displayed from
-PPD files in different labels within different PPD file repositories
-that represent suppliers of the PPD files. Thus, the label name
-associated with the PPD file, and one of the following letters,
-within parentheses, representing the repository in which the printer
-driver information resides: U (user supplied printer information),
-A (administrator supplied printer information), V (vendor supplied
-printer information), or S (system supplied printer information),
-precedes the name of the Printer Driver.
-
-<p>
-The default is on.
-
-<p>
-<b> Use localhost for Print Server Name: </b>
-
-The print server name utilized by the Oracle Solaris Print System may be
-either the hostname or "localhost". This applies to the tasks for adding
-new local printers in the "files" Name Service: New Attached Printer
-and New Network Printer. The use of "localhost" is recommended.
-
-<p>
-The default is on.
-<p>
-
-Documentation about Printing Services is found in the System Administration
-Guide: Advanced Administration.
-
-</CONTENT>
-
-<KEYWORDS>
-confirm action all actions "command-line" log console show "local printer"
-"printer model" "printer driver" "printer make" localhost hostname
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-Overview
-MainWindow
-ShowCommandConsole
-ToConfirmActions
-ToShowCommand
-InstallLocalPPD
-InstallNetworkPPD
-ToExit
-HelpOnHelp
-
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrinterPort.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrinterPort.rawhlp
deleted file mode 100644
index 23d11c054f..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrinterPort.rawhlp
+++ /dev/null
@@ -1,67 +0,0 @@
-<TITLE> Specify Printer Port </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License, Version 1.0 only
- (the "License"). You may not use this file except in compliance
- with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright 2001 Sun Microsystems, Inc. All rights reserved.
--- Use is subject to license terms.
---
--- ident "%Z%%M% %I% %E% SMI"
--->
-<!-- Tag=PrinterPort -->
-
-<CONTENT>
-
-<p>
-
-The printer port is the device name (typically, /dev/term/a,
-/dev/term/b, or /dev/bpp0) corresponding to the port to which a
-locally attached printer is physically connected. You usually connect
-printer cables to a serial port (/dev/term/a or /dev/term/b, for
-example) but in some cases you can use a parallel port (/dev/bpp0, for
-example). See the printer vendor's documentation and your system's
-installation documentation for information about switch settings and
-cabling requirements.
-
-<p>
-
-Note that the device name must exist and have write permissions
-set.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-port "printer port" other specify printer
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-InstallLocal
-ToInstallLocal
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
-
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrinterType.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrinterType.rawhlp
deleted file mode 100644
index 5ef9a49fce..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/PrinterType.rawhlp
+++ /dev/null
@@ -1,64 +0,0 @@
-<TITLE> Specify Printer Type </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License, Version 1.0 only
- (the "License"). You may not use this file except in compliance
- with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright 2001 Sun Microsystems, Inc. All rights reserved.
--- Use is subject to license terms.
---
--- ident "%Z%%M% %I% %E% SMI"
--->
-<!-- Tag=PrinterType -->
-
-<CONTENT>
-
-<p>
-
-When you configure a printer, you must identify the manufacturer
-and model of the printer in a way that the LP print service
-understands the printer type. Examples are PostScript, Daisy, and Diablo.
-
-<p>
-
-If you have a PostScript printer, for example, select PostScript as
-the Printer Type. To install a printer type that is not listed select
-Other. The printer type you enter must correspond to an entry in the
-/usr/share/lib/terminfo directories. See the terminfo(4) man page for
-more information.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-"printer type" type specify printer
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-InstallLocal
-InstallNetwork
-ToInstallLocal
-ToInstallNetwork
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/RemoteServer.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/RemoteServer.rawhlp
deleted file mode 100644
index 2188adb1c1..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/RemoteServer.rawhlp
+++ /dev/null
@@ -1,53 +0,0 @@
-<TITLE> Specify Remote Server </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License, Version 1.0 only
- (the "License"). You may not use this file except in compliance
- with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright 2001 Sun Microsystems, Inc. All rights reserved.
--- Use is subject to license terms.
---
--- ident "%Z%%M% %I% %E% SMI"
--->
-<!-- Tag=RemoteServer -->
-
-<CONTENT>
-
-<p>
-
-A printer server must be specified; the printer server is the computer
-on which the software for the remote printer is installed.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-remote "remote printer" server "printer server" fail failure specify
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-AddAccess
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ShowCommandConsole.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ShowCommandConsole.rawhlp
deleted file mode 100644
index 26b00dc463..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ShowCommandConsole.rawhlp
+++ /dev/null
@@ -1,84 +0,0 @@
-<TITLE> Command-Line Console</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ShowCommandConsole -->
-
-<CONTENT>
-
-<p>
-
-The Command-Line Console displays the command-line version of add,
-modify, and delete actions. Errors and warnings may also be
-displayed after the command.
-
-<p>
-
-For example, if you choose Add Access to Printer from the Print
-Manager menu and enter Printer Name = MyPrinter, Printer Server =
-PrintServer2, Description = Local Printer, the Command-line Console
-will display:
-
-<p>
-
-Add Access to printer
-<br>
-% /usr/sbin/lpadmin -p MyPrinter -s PrintServer2 -D "Local Printer"
-
-<p>
-
-The Command-line Console is displayed if the Show Command-Line Console box
-is checked in the Print Manager menu.
-
-<p>
-
-<b>Note: </b>When updating the NIS naming service, there are some
-cases where there is no command line equivalent for what Oracle Solaris Print
-Manager is doing. In these cases what gets reported to the
-Command-Line console is: "rsh [nis_master] ..." or
-"rexec([nis_master]) ..."
-
-<p>
-
-<b>Note: </b>When updating the LDAP naming service, the Oracle Solaris Print
-Manager uses native (or compiled) code to process updates. This
-is done to enhance security related to the LDAP password. The command-line
-used to update the LDAP database is not displayed for security reasons, but
-the log will include the entry "ldap ..." to indicate that the LDAP database
-has been updated.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-"command-line" log command console show
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-Overview
-MainWindow
-ToShowCommand
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToAddAccess.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToAddAccess.rawhlp
deleted file mode 100644
index d1c994ae88..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToAddAccess.rawhlp
+++ /dev/null
@@ -1,141 +0,0 @@
-<TITLE>To Add Access to an Installed Printer</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToAddAccess -->
-
-<CONTENT>
-
-<p>
-
-Do the following to make an installed printer accessible to print
-client computers. See the printers.conf(4) man page for more
-information about print client commands.
-
-<p>
-
-<b>Note:</b> If you are using a naming service, use this procedure to
-add access to a private printer (one that is not listed in the naming
-service) or to make the printer usable even if the naming service
-server is down. This adds access for all users in the naming service
-domain; see the man page for domainname(1M) for more information about
-domains.
-
-<p>
-
-If a naming service is not being used for printing, use this procedure
-to add access to a remote printer.
-
-<p>
-
-1. Choose Add Access to Printer from the Printer menu.
-
-<p>
-
- The Add Access To Printer dialog is displayed.
-
-<p>
-
-2. Enter a printer name, printer server name, and description (optional).
-
-<p>
-
-Note that Oracle Solaris Print Manager does not check for the validity of
-Printer Name or Printer Server.
-
-<p>
-
-3. Click Default Printer if you want this printer to be the default
-printer.
-
-<p>
-
-If a naming service is being used, this printer will be designated as
-the default printer for all users in the domain.
-
-<p>
-
-If no naming service is being used, this printer will be designated as
-the default printer for the computer on which you are running Oracle Solaris
-Print Manager.
-
-<p>
-
-Note that this is the last place the print commands will look to
-determine the printer for a specific print command; see the
-man page for printers.conf(4) for more information about resolving
-printer conflicts.
-
-<p>
-
-4. Click OK or Apply to add access for the specified printer.
-
-<p>
-
-<b> Note:</b> If you are using the NIS naming service, you have to know the
-root password for the NIS master. If you are using the LDAP naming service,
-you must know a fully distinguished name which has update privilege and
-the corresponding password. Default values may need to be overridden. You
-will be prompted for the password when you click Apply or OK. Enter the
-password and click OK.
-
-<p>
- The list of printers displayed in the Oracle Solaris Print Manager main window
- is updated to include the new printer.
-<p>
- The Add Access dialog will remain displayed if you click Apply,
-allowing you to add access to additional printers.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-access "add access" description "default printer" "naming service"
-"printer name" "printer server" add installed printer
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-AddAccess
-ToModify
-ToDelete
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
-
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToConfirmActions.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToConfirmActions.rawhlp
deleted file mode 100644
index af9d31a9ac..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToConfirmActions.rawhlp
+++ /dev/null
@@ -1,66 +0,0 @@
-<TITLE> To Confirm All Actions </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToConfirmActions -->
-
-<CONTENT>
-
-<p>
-
-Do the following to require that all Oracle Solaris Print Manager actions be
-confirmed before being executed, or to turn off this option.
-
-<p>
-
-1. Choose Confirm All Actions from the Print Manager menu.
-
-<p>
-
-If the Confirm All Actions box was not checked, it will be checked
-and all subsequent Oracle Solaris Print Manager actions will require
-confirmation before being performed.
-
-<p>
-
-If the Confirm All Actions box was checked, it will no longer be checked
-and subsequent Oracle Solaris Print Manager actions will NOT require
-confirmation before being performed. Note that some actions, such as
-Delete Printer, require confirmation regardless of the setting of the
-Confirm All Actions box.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-confirm action all actions
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToDelete.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToDelete.rawhlp
deleted file mode 100644
index 0842d3046b..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToDelete.rawhlp
+++ /dev/null
@@ -1,81 +0,0 @@
-<TITLE> To Delete a Printer </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToDelete -->
-
-<CONTENT>
-
-<p>
-
-Do the following to delete a printer from the printer list.
-
-<p> 1. Select the printer in the list of printers in the Oracle Solaris
-Print Manager main window.
-
-<p>
-
-2. Choose Delete Printer from the Printer menu.
-
-<p>
-
-A dialog is displayed,
-asking if you really want to delete the selected printer.
-
-<p> <b>Note:</b> If the printer is a local printer (one installed on
-the current server), the printer will be uninstalled; if a naming
-service has been selected, the entry for this printer will also be
-removed from the naming service.
-
-<p>
-3. Click OK to delete the printer.
-<p>
- A window is displayed asking you to confirm the
- deletion.
-<p>
-4. Click Delete.
-<p>
-The selected printer is deleted from the Oracle Solaris Print Manager main
-window.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-delete uninstall "local printer" "network printer" "attached printer"
-printer
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToAddAccess
-AddAccess
-MainWindow
-Overview
-HelpOnHelp
-</SEEALSO>
-
-
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToExit.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToExit.rawhlp
deleted file mode 100644
index 2f8ed987fc..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToExit.rawhlp
+++ /dev/null
@@ -1,53 +0,0 @@
-<TITLE> To Exit Oracle Solaris Print Manager </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToExit -->
-
-<CONTENT>
-
-<p>
-
-1. Choose Exit from the Print Manager menu.
-
-<p>
-
-The Oracle Solaris Print Manager main window and any other open Print Manager
-dialogs are closed.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-exit close Oracle solaris print manager
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToStart
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToFindPrinter.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToFindPrinter.rawhlp
deleted file mode 100644
index 1f8f54b42d..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToFindPrinter.rawhlp
+++ /dev/null
@@ -1,68 +0,0 @@
-<TITLE> To Find a Printer </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToFindPrinter -->
-
-<CONTENT>
-
-<p>
-
-Do the following to find a printer in the Oracle Solaris Print Manager list
-of printers.
-
-<p>
-
-1. Choose Find Printer from the Tools menu.
-
-<p>
-
-A dialog will be displayed, asking you to enter the name of a printer to find.
-
-<p>
-
-2. Type a printer name in the text field and click Find.
-
-<p>
-
-If the exact printer name is found in the list, it will be selected;
-the list will scroll, if necessary. If the printer is not found, a
-message will be displayed, indicating that the named printer was not
-found in the current list.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-find "printer name" tool printer
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToInstallLocal.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToInstallLocal.rawhlp
deleted file mode 100644
index ce6cc22764..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToInstallLocal.rawhlp
+++ /dev/null
@@ -1,176 +0,0 @@
-<TITLE> To Install an Attached Printer </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToInstallLocal -->
-
-<CONTENT>
-
-<p>
-
-Once you have physically connected the printer to the printer server,
-do the following to install the printer, which makes the printer
-available for printing from the computer on which you are running
-Oracle Solaris Print Manager.
-
-<p>
-
-<b> Note:</b> The computer on which you are running Oracle Solaris Print
-Manager becomes the printer server for the printer being installed.
-
-<p>
-
-1. Choose New Attached Printer from the Printer menu.
-
-<p>
-
-The New Attached Printer dialog will be displayed.
-
-<p>
-
-2. Enter a name in Printer Name.
-<p>
-
-3. [Optional] Enter a description of the printer.
-
-<p>
-This might include the location and the type of printer.
-
-<p>
-4. Select a port from the Printer Port pulldown menu.
-
-<p>
-This is the hardware port where the printer is plugged into the
-server. If you choose Other, a dialog will pop up asking you to
-specify a port. Enter a port and click OK.
-
-<p>
-5. Select a printer type from the Printer Type pulldown menu.
-
-<p>
-
-Scroll the list if necessary. If the printer type is not in the list,
-select Other; you will be asked to specify a printer type. Enter a
-printer type and click OK.
-
-<p>
-6. Select an item in the File Contents pulldown menu.
-
-<p>
-Choices include PostScript and ASCII; the default is PostScript, which
-will work in most cases.
-
-<p>
-7. Select an item in the Fault Notification pulldown menu.
-
-<p>
-
-The default is Write to Superuser.
-
-<p>
-8. [Optional] Click Default Printer if you want this printer to be the default
-printer for this server.
-
-<p>
-
-9. [Optional] Select option to define whether a banner
-page is to be printed between jobs. "Always Print Banner"
-specifies that a banner will be printed and the user may not specify
-otherwise. "User Selectable - Default=on" specifies that the user may
-specify to turn off the banner in the print command; if the user does
-not specify, the banner will be printed. "Never Print Banner" specifies
-that a banner will not be printed and the user may not specify
-otherwise. The default action is to always print the banner.
-
-<p>
-
-10. Modify the User Access List, if necessary.
-
-<p>
-
-The default value is "all," meaning that anyone can use this printer.
-If you want to restrict its use to individual users, enter a user name
-in the text field below the list and click Add. Other legal constructs
-are system-name!login-ID (user "login-ID" on system "system-name"),
-system-name!all (all users on system "system-name"), and all!login-ID
-(user "login-ID" on all systems). Use the lpadmin(1M) command to deny
-access to users.
-
-<p>
-
-To remove a name from the list, select it and click Delete.
-
-<p>
-
-<b> Note:</b> If you enter "all" or "none" in the text field and click
-Add, all individual user names will be deleted from the list and
-replaced by "all" or "none."
-
-<p>
-11. Click OK or Apply to install the printer.
-
-<p>
-The window will remain if you click Apply, allowing you to install
-additional printers.
-
-<p>
-
-<b> Note:</b> If you are using the NIS naming service, you have to know
-the root password for the NIS master. If you are using the LDAP naming
-service you must know a fully distinguished name which has update
-privilege and the corresponding password. Default values may need to be
-overridden. You will be prompted for the password when you click Apply or OK.
-Enter the password and click OK.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-install "local printer" "printer name" server description port
-"printer type" "file contents" fault "fault notification" "default
-printer" banner nobanner "attached printer" new attached printer
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-InstallLocal
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToInstallNetwork.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToInstallNetwork.rawhlp
deleted file mode 100644
index 60c41b168d..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToInstallNetwork.rawhlp
+++ /dev/null
@@ -1,181 +0,0 @@
-<TITLE> To Install a Network Printer </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToInstallNetwork -->
-
-<CONTENT>
-
-<p>
-
-Once you have physically connected the printer to the network,
-do the following to install the printer, which makes the printer
-available for printing from the network.
-
-<p>
-
-<b> Note:</b> The computer on which you are running Oracle Solaris Print
-Manager becomes the printer server for the printer being installed.
-
-<p>
-
-1. Choose New Network Printer from the Printer menu.
-
-<p>
-
-The New Attached Printer dialog will be displayed.
-
-<p>
-
-2. Enter a name in Printer Name.
-
-<p>
-
-3. [Optional] Enter a description of the printer.
-
-<p>
-This might include the location and the type of printer.
-
-<p>
-4. Select a printer type from the Printer Type pulldown menu.
-
-<p>
-
-Scroll the list if necessary. If the printer type is not in the list,
-select Other; you will be asked to specify a printer type. Enter a
-printer type and click OK.
-
-<p>
-5. Select an item in the File Contents pulldown menu.
-
-<p>
-Choices include PostScript and ASCII; the default is PostScript, which
-will work in most cases.
-
-<p>
-6. Select an item in the Fault Notification pulldown menu.
-
-<p>
-
-The default is Write to Superuser.
-
-<p>
-7a. If the printer uses BSD protocol, enter the network name of the printer
-in the Destination field, followed by a colon and the printer-vendor-supplied
-queue name.
-<p>
-7b. If the printer uses TCP protocol, enter the network name of the printer
-in the Destination field, followed by a colon and port number to be used in the
-tcp connection to the printer.
-<p>
-7c. If the printer uses a printer URI, enter the the URI for the printer
-in the Destination field (for example:
-"smb://printer-host/printer-name").
-
-<p>
-8. Select either BSD, TCP, or URI from the Protocol pulldown menu.
-
-<p>
-9. [Optional] Click Default Printer if you want this printer to be the default
-printer for this server.
-
-<p>
-
-10. [Optional] Select option to define whether a banner
-page is to be printed between jobs. "Always Print Banner"
-specifies that a banner will be printed and the user may not specify
-otherwise. "User Selectable - Default=on" specifies that the user may
-specify to turn off the banner in the print command; if the user does
-not specify, the banner will be printed. "Never Print Banner" specifies
-that a banner will not be printed and the user may not specify
-otherwise. The default action is to always print the banner.
-
-<p>
-11. Modify the User Access List, if necessary.
-
-<p>
-
-
-The default value is "all," meaning that anyone can use this printer.
-If you want to restrict its use to individual users, enter a user name
-in the text field below the list and click Add. Other legal constructs
-are system-name!login-ID (user "login-ID" on system "system-name"),
-system-name!all (all users on system "system-name"), and all!login-ID
-(user "login-ID" on all systems). Use the lpadmin(1M) command to deny
-access to users.
-
-<p>
-
-<b> Note:</b> If you enter "all" or "none" in the text field and click
-Add, all individual user names will be deleted from the list and
-replaced by "all" or "none."
-
-<p>
-12. Click OK or Apply to install the printer.
-
-<p>
-The window will remain if you click Apply, allowing you to install
-additional printers.
-
-<p>
-
-<b> Note:</b> If you are using the NIS naming service, you have to know
-the root password for the NIS master. If you are using the LDAP naming
-service, you must know a fully distinguished name which has update privilege
-and the corresponding password. Default values may need to be overridden.
-You will be prompted for the password when you click Apply or OK.
-Enter the password and click OK.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-
-install network "network printer" "printer name" server description
-port "printer type" "file contents" fault "fault notification"
-"default printer" banner destination protocol new bsd tcp printer
-
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-InstallNetwork
-ToAddAccess
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToModify.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToModify.rawhlp
deleted file mode 100644
index 567520e439..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToModify.rawhlp
+++ /dev/null
@@ -1,119 +0,0 @@
-<TITLE> To Modify Printer Properties </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToModify -->
-
-<CONTENT>
-
-<p>
-
-Do the following to modify the properties of an installed printer.
-
-<p>
-
-1. Double-click the printer in the Oracle Solaris Print Manager main window
-<p>
- OR
-<p>
- Select the printer in the Oracle Solaris Print Manager main window and choose
- Modify Printer Properties from the Printer menu.
-<p>
- The Modify Printer Properties dialog is displayed.
-
-<p>
-2. Modify the printer configuration, as needed.
-<p>
-
-If this is an attached printer (one installed on the computer on which
-you are running Oracle Solaris Print Manager) you can modify the Description,
-Printer Port, Printer Type, File Contents, Fault Notification,
-Options, and User Access List.
-
-<p>
-
-If this is not an attached printer, only the Description field can be
-modified. You can also check or uncheck the Default Printer box.
-
-<p>
-3. Click OK.
-<p>
-
-The changes you made are saved and the Modify Printer Properties
-dialog is dismissed.
-
-<p>
-
- If you modified the Description field, the new description is
-displayed in the Oracle Solaris Print Manager main window.
-
-<p>
-
-<b> Note:</b> If you are using the NIS naming service, you have to know
-the root password for the NIS master. If you are using the LDAP naming service,
-you must know a fully distinguished name which has update privilege and
-the corresponding password. Default values may need to be overridden.
-You will be prompted for the password when you select the NIS or
-LDAP naming service. Enter the password and click OK.
-
-<p>
-
-<b> Note:</b> To modify the Printer Name or Printer Server field,
-delete the printer and add it with a new printer and/or server name.
-
-<p>
-
-<b>OK:</b> Apply changes and dismiss the window.
-<br>
-<b>Apply:</b> Apply the changes and leave the window displayed.
-<br>
-<b>Reset:</b> Reset all fields to last Apply
-<br>
-<b>Cancel:</b> Dismiss the window.
-<br>
-<b>Help:</b> Display help for the current window or dialog.
-
-<p>
-</CONTENT>
-
-<KEYWORDS>
-modify "Printer menu" "local printer" nis "nis master" "naming service"
-ldap LDAP attached "network printer" local network printer properties
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-Modify
-ModifyFailed
-InstallLocal
-InstallNetwork
-ToInstallLocal
-ToInstallNetwork
-ToAddAccess
-ToDelete
-AddAccess
-MainWindow
-Overview
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToSelectName.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToSelectName.rawhlp
deleted file mode 100644
index 80eebff891..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToSelectName.rawhlp
+++ /dev/null
@@ -1,83 +0,0 @@
-<TITLE> To Select a Naming Service </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToSelectName -->
-
-<CONTENT>
-
-<p>
-
-Do the following to select a naming service for Oracle Solaris Print Manager or
-to change from using a naming service to using no naming service.
-
-<p>
-
-When you select a naming service you are specifying where Oracle Solaris
-Print Manager will retrieve printer information from, and where
-changes made in Print Manager will be made. If a naming service is
-selected, additions and deletions will be made in the printing
-configuration database for the selected naming service. If you choose
-"files," the /etc/printers.conf file will be used to determine which
-printers are available, and changes will be made there.
-
-<p>
-
-1. Choose Select Naming Service from the Print Manager menu.
-
-<p>
-
-A dialog is displayed, asking you to choose a naming service.
-
-<p>
-
-2. Choose a naming service (or "files," if no naming service is to be
-used) and click OK.
-
-<p>
-
-The Oracle Solaris Print Manager main window is displayed, listing all the
-accessible printers, which includes all printers in the selected
-naming service's printer configuration database.
-
-
-<p>
-
-See the man page for printers.conf(4) for more information.
-
-</CONTENT>
-
-<KEYWORDS>
-select "name service" "naming service" name naming service
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-NameService
-ToStart
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToShowCommand.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToShowCommand.rawhlp
deleted file mode 100644
index ad5324a322..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToShowCommand.rawhlp
+++ /dev/null
@@ -1,75 +0,0 @@
-<TITLE> To Show Command-Line Console</TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToShowCommand -->
-
-<CONTENT>
-
-<p>
-
-Do the following to cause the command-line version of add, modify, and
-delete actions to be displayed in the Oracle Solaris Print Manager
-Command-Line Console -- or to turn off this option if it was
-previously turned on. Errors and warnings may also be
-displayed after the command.
-
-<p>
-
-1. Choose Show Command-Line Console from the Print Manager menu.
-
-<p>
-
-If the Show Command-line Console box was not checked when you chose
-it, it will be checked and the Show Command-line Console will be
-displayed; Oracle Solaris Print Manager actions will be displayed in the
-Console.
-
-<p>
-
-Note that errors and warnings may also appear in the Console, after
-the commands used to complete the action.
-
-<p>
-
-If the Show Command-line Console box was checked when you chose it,
-it will no longer be checked and the Show Command-line Console will be
-closed.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-"command-line" log command show console
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ShowCommandConsole
-Overview
-MainWindow
-HelpOnHelp
-</SEEALSO>
-
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToStart.rawhlp b/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToStart.rawhlp
deleted file mode 100644
index 10b238a49f..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/raw-help/ToStart.rawhlp
+++ /dev/null
@@ -1,81 +0,0 @@
-<TITLE> To Start Oracle Solaris Print Manager </TITLE>
-<!--
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--- Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
---
--->
-<!-- Tag=ToStart -->
-
-<CONTENT>
-
-<p>
-
-If you have installed SUNWppm package, do the following to start
-Oracle Solaris Print Manager. Note that you must be root to run Print
-Manager; if you attempt to launch it from Solaris Management Console
-you will be prompted for the root password.
-
-<p>
-
-1. Double-click the Oracle Solaris Print Manager icon in Solaris Management
-Console
-
-<p>
-
- OR
-
-<p>
-
-cd to the directory /usr/sadm/admin/bin and as root type ./printmgr
-
-<p>
-
-A dialog is displayed, asking you to choose a naming service.
-
-<p>
-
-2. Choose a naming service (or files, if no naming service is to be
-used) and click OK.
-
-<p>
-
-The Oracle Solaris Print Manager main window is displayed, listing all the
-printers accessible from the computer on which you are running Oracle Solaris
-Print Manager.
-
-<p>
-
-</CONTENT>
-
-<KEYWORDS>
-start startup load "name service" "naming service" SUNWppm "Solaris Management Console"
-"the Console" Oracle solaris print manager
-</KEYWORDS>
-
-<p>
-
-<SEEALSO>
-ToSelectName
-ToExit
-Mainwindow
-Overview
-HelpOnHelp
-</SEEALSO>
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Debug.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Debug.java
deleted file mode 100644
index dc0147b093..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Debug.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * Debug class
- */
-
-package com.sun.admin.pm.server;
-
-import java.util.*;
-
-/**
- * A simple configurable debug logging class.
- * <p>
- *
- * Calling member classes <b>message()</b>, <b>warning()</b>,
- * <b>error()</b>, and <b>fatal()</b> causes a log entry to be
- * generated if the current verbosity level is greater than or equal
- * to the specified severity.
- * <p>
- *
- * Calling <b>setDebugLevel()</b> sets the verbosity level, which is a
- * threshold of severity below which messages will not be logged. The
- * verbosity level can be set at any time.
- * <p>
- *
- * For example, setting the verbosity level to <b>Debug.ERROR</b>
- * means that only <b>error()</b> and <b>fatal()</b> calls will
- * generate log entries, while setting the level to <b>WARNING</b>
- * will log <b>warning()</b> calls as well as <b>error()</b> and
- * <b>fatal()</b> while ignoring <b>message()</b>.
- * <p>
- *
- * Setting the verbosity level to <b>ALL</b> is equivalent to setting
- * it to <b>MESSAGE</b>; all calls are logged. The constant
- * <b>NONE</b> suppresses logging of all calls.
- * <p>
- *
- * The verbosity level can be set globally or on a class-by-class
- * basis. Use the form of <b>setDebugLevel()</b> which takes an
- * argument of type Object to set the level for all instances of the
- * specified class.
- * <p>
- *
- * Using the forms of <b>message()</b>, <b>warning()</b>,
- * <b>error()</b>, and <b>fatal()</b> which accept an argument of type
- * Object will use the verbosity value associated with the specified
- * class. If no value has been explicitly set for the class, the
- * global default will be used.
- * <p>
- *
- * At present log messages are written only to stdout.
- * An enhancement would be to implement an interface to the syslog facility.
- */
-
-
-public class Debug {
-
- /**
- * Log a highest-priority message.
- * @param String s The message to be logged.
- */
- static public void fatal(String s) {
- printIf(s, FATAL);
- }
-
- /**
- * Log a high-priority message.
- * @param String s The message to be logged.
- */
- static public void error(String s) {
- printIf(s, ERROR);
- }
-
- /**
- * Log a medium-priority message.
- * @param String s The message to be logged.
- */
- static public void warning(String s) {
- printIf(s, WARNING);
- }
-
- /**
- * Log a low-priority message.
- * @param String s The message to be logged.
- */
- static public void message(String s) {
- printIf(s, MESSAGE);
- }
-
-
- /**
- * Log a lowest-priority message.
- * @param String s The message to be logged.
- */
- static public void info(String s) {
- printIf(s, INFO);
- }
-
-
- /**
- * Log a highest-priority message.
- * @param String s The message to be logged.
- */
- static public void fatal(Object o, String s) {
- printIf(o, s, FATAL);
- }
-
- /**
- * Log a high-priority message.
- * @param String s The message to be logged.
- */
- static public void error(Object o, String s) {
- printIf(o, s, ERROR);
- }
-
- /**
- * Log a medium-priority message.
- * @param String s The message to be logged.
- */
- static public void warning(Object o, String s) {
- printIf(o, s, WARNING);
- }
-
- /**
- * Log a low-priority message.
- * @param String s The message to be logged.
- */
- static public void message(Object o, String s) {
- printIf(o, s, MESSAGE);
- }
-
- /**
- * Log a lowest-priority message.
- * @param String s The message to be logged.
- */
- static public void info(Object o, String s) {
- printIf(o, s, INFO);
- }
-
- /**
- * Set the verbosity level to the specified severity.
- * @param String s The message to be logged.
- */
- static public void setDebugLevel(int lvl) {
- if (lvl < ALL || lvl > NONE)
- return;
-
- globalDebugLevel = lvl;
- }
-
- /**
- * Set the verbosity level to the specified severity.
- * @param String s The message to be logged.
- */
- static public void setDebugLevel(Object o, int lvl) {
- if (lvl < ALL || lvl > NONE)
- return;
-
- classDB.put(o.getClass(), new Integer(lvl));
-
- /*
- * System.out.println("Debug: class " + o.getClass().getName() +
- * " level = " + classDB.get(o.getClass()));
- */
- }
-
- static public void setDebugLevel(String classname, int lvl) {
- if (lvl < ALL || lvl > NONE)
- return;
-
- try {
- classDB.put(Class.forName(classname), new Integer(lvl));
- } catch (Exception x) {
- System.out.println("setDebugLevel: " + x);
- }
- }
-
-
- private static void printIf(String s, int lvl) {
- if (lvl < globalDebugLevel)
- return;
- debugPrint(s);
- }
-
- private static void printIf(Object o, String s, int lvl) {
- if (lvl < getLevelForClass(o))
- return;
- debugPrint(s);
- }
-
-
- /*
- * get debug level for o's class, if already there
- * otherwise create an entry for o and set it to the global level
- */
- private synchronized static int getLevelForClass(Object o) {
- int lvl = globalDebugLevel;
- Object g;
- if ((g = classDB.get(o.getClass())) != null)
- lvl = ((Integer) g).intValue();
- else
- classDB.put(o.getClass(), new Integer(lvl));
-
- /*
- * System.out.println("Debug: getLevelForClass " +
- * o.getClass().getName() +
- * " = " + lvl);
- */
-
- return lvl;
- }
-
- // here is where we could hide syslog or file destination...
- private static void debugPrint(String s) {
- System.out.println(s); // for now
- }
-
- Object theInstance = null;
-
- public Debug(Object o) {
- theInstance = o;
- }
-
- public void SetDebugLevel(int lvl) {
- if (lvl < ALL || lvl > NONE)
- return;
- setDebugLevel(theInstance, lvl);
- }
-
- public void Fatal(String s) {
- fatal(theInstance, s);
- }
-
- public void Warning(String s) {
- warning(theInstance, s);
- }
-
- public void Error(String s) {
- error(theInstance, s);
- }
-
- public void Message(String s) {
- message(theInstance, s);
- }
-
- public void Info(String s) {
- info(theInstance, s);
- }
-
- /*
- * Verbosity level to suppress all messages.
- */
- static public final int NONE = 6;
-
- /*
- * Verbosity level to log only highest-priority messages.
- */
- static public final int FATAL = 5;
-
- /*
- * Verbosity level to log high- and highest-priority messages.
- */
- static public final int ERROR = 4;
-
- /*
- * Verbosity level to log medium-, high-, and highest-priority messages.
- */
- static public final int WARNING = 3;
-
- /*
- * Verbosity level to log low-, medium-, high-, and
- * highest-priority messages.
- */
- static public final int MESSAGE = 2;
-
- /*
- * Verbosity level to log lowest-, low-, medium-, high-, and
- * highest-priority messages.
- */
- static public final int INFO = 1;
-
-
- /*
- * Verbosity level to log all messages.
- */
- static public final int ALL = 0;
-
- private static int globalDebugLevel = FATAL;
- private static Hashtable classDB = new Hashtable();
-
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterAdd.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterAdd.java
deleted file mode 100644
index 287b0a328b..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterAdd.java
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * DoPrinterAdd class
- * Worker class for adding local and remote printers.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-import java.util.*;
-
-public class DoPrinterAdd {
-
- public static void main(String[] args) {
- //
- // Set attributes for testing
- //
- NameService ns = new NameService();
-
- String file_contents[] = new String[1];
- file_contents[0] = "any";
- String user_allow_list[] = new String[1];
- user_allow_list[0] = "allow1";
- String user_deny_list[] = new String[1];
- user_deny_list[0] = "deny1";
-
- Printer p = new Printer(ns);
- p.setPrinterName("javatest");
- p.setPrinterType("PS");
- p.setPrintServer("zelkova");
- p.setComment("This is a comment");
- p.setDevice("/var/tmp/test");
- p.setNotify("none");
- p.setProtocol("bsd");
- p.setDestination(null);
- p.setFileContents(file_contents);
- p.setUserAllowList(user_allow_list);
- p.setIsDefaultPrinter(false);
- p.setBanner("never");
- p.setEnable(true);
- p.setAccept(true);
- p.setLocale(null);
-
- try {
- add(p, ns);
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- System.out.println("Commands:\n" + p.getCmdLog());
- System.out.println("Errors:\n" + p.getErrorLog());
- System.out.println("Warnings:\n" + p.getWarnLog());
- System.exit(0);
- }
-
- //
- // Interface to Printer object.
- //
- public static void add(
- Printer p,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterAdd.add()");
-
- String device = p.getDevice();
- if (device == null) {
- addRemote(p, ns);
- } else {
- addLocal(p, ns);
- }
- return;
- }
-
- //
- // Do the work of adding a local printer.
- //
- private static void addLocal(
- Printer p,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterAdd.addLocal()");
-
- int exitvalue = 0;
- String err = null;
- String cmd = null;
- SysCommand syscmd = null;
-
- // Since it's local set extensions.
- // Eventually the gui should do this.
- p.setExtensions("Solaris");
-
- String printername = p.getPrinterName();
- String printertype = p.getPrinterType();
- String printserver = p.getPrintServer();
- String comment = p.getComment();
- String device = p.getDevice();
- String make = p.getMake();
- String model = p.getModel();
- String ppd = p.getPPD();
- String notify = p.getNotify();
- String protocol = p.getProtocol();
- String destination = p.getDestination();
- String[] file_contents = p.getFileContents();
- String[] user_allow_list = p.getUserAllowList();
- String[] user_deny_list = p.getUserDenyList();
- boolean default_printer = p.getIsDefaultPrinter();
- String banner = p.getBanner();
- boolean enable = p.getEnable();
- boolean accept = p.getAccept();
-
- String nameservice = ns.getNameService();
- String ppdfile = null;
-
- //
- // "uri" is a pseudo protocol and means that the device is
- // specified in the destination.
- //
- if ((protocol != null) && (protocol.equals("uri"))) {
- device = destination;
- destination = null;
- protocol = null;
- }
-
- if (ppd != null) {
- ppdfile = new String(
- DoPrinterUtil.getPPDFile(make, model, ppd));
- }
-
- cmd = "/usr/sbin/lpadmin -p " + printername;
- if (printserver != null)
- cmd = cmd.concat(" -s " + printserver);
- if (device != null) {
- cmd = cmd.concat(" -v " + device);
-
- if (device.indexOf("://") != -1)
- cmd = cmd.concat(" -m uri");
- else {
- if (destination != null)
- cmd = cmd.concat(" -m netstandard");
- else
- cmd = cmd.concat(" -m standard");
- if (ppd != null)
- cmd = cmd.concat("_foomatic");
- }
- }
- if (printertype != null)
- cmd = cmd.concat(" -T " + printertype);
- if (notify != null)
- cmd = cmd.concat(" -A " + notify);
- if (ppdfile != null) {
- cmd = cmd.concat(" -n " + ppdfile);
- }
-
-
- if (destination != null)
- cmd = cmd.concat(" -o dest=" + destination);
- if (protocol != null)
- cmd = cmd.concat(" -o protocol=" + protocol);
- if (banner != null)
- cmd = cmd.concat(" -o banner=" + banner);
-
- if ((file_contents != null) && (file_contents.length != 0)) {
- String tmpstr = file_contents[0];
- for (int i = 1; i < file_contents.length; i++) {
- tmpstr = tmpstr.concat("," + file_contents[i]);
- }
- cmd = cmd.concat(" -I " + tmpstr);
- } else {
- cmd = cmd.concat(" -I postscript");
- }
- if ((user_allow_list != null) && (user_allow_list.length != 0)) {
- String tmpstr = user_allow_list[0];
- for (int i = 1; i < user_allow_list.length; i++) {
- tmpstr = tmpstr.concat("," + user_allow_list[i]);
- }
- cmd = cmd.concat(" -u allow:" + tmpstr);
- }
-
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
-
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- syscmd = null;
- p.setErrorLog(err);
- throw new pmCmdFailedException(err);
- } else {
- p.setWarnLog(err);
- }
- syscmd = null;
-
- //
- // lpadmin won't take allow and deny lists together
- // so do the deny seperately.
- //
- if ((user_deny_list != null) && (user_deny_list.length != 0)) {
- String tmpstr = user_deny_list[0];
- for (int i = 1; i < user_deny_list.length; i++) {
- tmpstr = tmpstr.concat("," + user_deny_list[i]);
- }
- cmd = "/usr/sbin/lpadmin -p " + printername +
- " -u deny:" + tmpstr;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- if ((comment != null) && (!comment.equals(""))) {
- //
- // Have to use a command array here since
- // exec(String) doesn't parse quoted strings.
- //
- String cmd_array[] =
- { "/usr/sbin/lpadmin", "-p", printername,
- "-D", comment };
- cmd = "/usr/sbin/lpadmin -p " + printername + " -D " +
- "\"" + comment + "\"";
- p.setCmdLog(cmd);
-
- syscmd = new SysCommand();
- syscmd.exec(cmd_array);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- // If this is the default printer set it.
- // If it fails warn user.
- if (default_printer) {
- cmd = "/usr/sbin/lpadmin -d " + printername;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- // Check to see if we should enable it.
- // If it fails warn user.
- if (enable) {
- cmd = "/usr/bin/enable " + printername;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- // Check to see if we should accept it.
- // If it fails warn user.
- if (accept) {
- cmd = "/usr/sbin/accept " + printername;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- doFilters(p);
-
- //
- // Take care of name service now.
- //
- if (!nameservice.equals("system")) {
- try {
- DoPrinterNS.set("add", p, ns);
- }
- catch (Exception e) {
- p.clearLogs();
- NameService localns = new NameService();
- //
- // Back out the local printer.
- //
- try {
- DoPrinterDelete.delete(p, localns);
- }
- catch (Exception e2) {
- Debug.message("SVR:" + e2.getMessage());
- }
- p.clearLogs();
- throw (e);
- }
- }
- return;
- }
-
- //
- // Do the work of adding a remote printer.
- //
- private static void addRemote(
- Printer p,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterAdd.addRemote()");
-
- int exitvalue = 0;
- String err = null;
- String cmd = "";
- String cmd_array[] = new String[7];
- SysCommand syscmd = null;
-
- String printername = p.getPrinterName();
- String printserver = p.getPrintServer();
- String comment = p.getComment();
- boolean default_printer = p.getIsDefaultPrinter();
- String nameservice = ns.getNameService();
-
- boolean isnismaster = false;
- if (nameservice.equals("nis")) {
- //
- // Find out if we are the nis master
- //
- String nshost = ns.getNameServiceHost();
- Host h = new Host();
- String lh = h.getLocalHostName();
- if (lh.equals(nshost))
- isnismaster = true;
- h = null;
- }
-
- //
- // If the name service is not system and we are
- // not the nis master then do the name service
- // update and return.
- //
- if ((!nameservice.equals("system")) && (!isnismaster)) {
- DoPrinterNS.set("add", p, ns);
- return;
- }
-
- cmd_array[0] = "/usr/sbin/lpadmin";
- cmd_array[1] = "-p";
- cmd_array[2] = printername;
- cmd_array[3] = "-s";
- cmd_array[4] = printserver;
-
- if ((comment != null) && (!comment.equals(""))) {
- cmd_array[5] = "-D";
- cmd_array[6] = comment;
- }
-
- //
- // Fix up cmd so we can log it.
- //
- for (int i = 0; i < cmd_array.length; i++) {
- if (cmd_array[i] == null)
- continue;
- if (i == 6) {
- cmd = cmd.concat("\"" + comment + "\"");
- continue;
- }
- cmd = cmd.concat(cmd_array[i] + " ");
- }
-
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd_array);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- }
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
-
- // If this is the default printer set it.
- // If it fails warn user.
- if (default_printer) {
- cmd = "/usr/sbin/lpadmin -d " + printername;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- //
- // If it's nis and we are here then we are the nis
- // master. This call will do the make for us.
- //
- if (nameservice.equals("nis")) {
- try {
- DoPrinterNS.set("add", p, ns);
- }
- catch (Exception e) {
- p.clearLogs();
- try {
- //
- // Back out the local printer.
- //
- DoPrinterDelete.delete(p, ns);
- }
- catch (Exception e2)
- {
- Debug.message("SVR:" + e2.getMessage());
- }
- p.clearLogs();
- throw e;
- }
- }
- return;
- }
-
-
- //
- // Configure filters
- // Look in /etc/lp/fd and configure each filter if it hasn't
- // already been configured. We'll add warning messages if
- // there are problems but don't consider anything here fatal.
- //
- private static void doFilters(Printer p) throws Exception
- {
- Debug.message("SVR: DoPrinterAdd.doFilters()");
-
- int i = 0;
- int j = 0;
- String o = null;
- String err = null;
- String cmd = null;
- String psfilters[] = null;
- SysCommand syscmd = null;
-
- //
- // Get list of potential filters
- //
- cmd = "/usr/bin/ls /etc/lp/fd";
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- syscmd = null;
- return;
- }
- o = syscmd.getOutput();
- syscmd = null;
- if (o == null) {
- return;
- }
-
- StringTokenizer st = new StringTokenizer(o);
- if (st.countTokens() == 0) {
- return;
- }
- psfilters = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- psfilters[i] = st.nextToken();
- }
- //
- // Remove .fd suffix and empty slots that aren't filters.
- //
- for (i = 0; i < psfilters.length; i++) {
- if (psfilters[i].endsWith(".fd")) {
- j = psfilters[i].indexOf(".fd");
- psfilters[i] = psfilters[i].substring(0, j);
- } else {
- psfilters[i] = "";
- }
- }
-
- // Get list of currently configured filters
- cmd = "/usr/sbin/lpfilter -l -f all";
- syscmd = new SysCommand();
- syscmd.exec(cmd);
-
- o = null;
- if (syscmd.getExitValue() != 0) {
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- return;
- } else {
- o = syscmd.getOutput();
- }
-
- for (i = 0; i < psfilters.length; i++) {
- if (psfilters[i].equals(""))
- continue;
-
- // If we have filters see if this one is
- // already configured.
- if (o != null) {
- if (o.indexOf("\"" + psfilters[i] + "\"") > -1)
- continue;
- }
-
- // Add the filter
- cmd = "/usr/sbin/lpfilter -f " + psfilters[i] +
- " -F /etc/lp/fd/" + psfilters[i] + ".fd";
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
-
- if (syscmd.getExitValue() != 0) {
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- }
- syscmd = null;
- }
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterDelete.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterDelete.java
deleted file mode 100644
index ceeb721d84..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterDelete.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * DoPrinterDelete class
- * Worker class for deleting a printer.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-
-public class DoPrinterDelete {
-
- //
- // main for testing
- //
- public static void main(String[] args) {
-
- Printer p = null;
- try {
- NameService ns = new NameService();
-
- p = new Printer(ns);
- p.setPrinterName("javatest");
-
- delete(p, ns);
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- System.out.println("Commands:\n" + p.getCmdLog());
- System.out.println("Errors:\n" + p.getErrorLog());
- System.out.println("Warnings:\n" + p.getWarnLog());
- System.exit(0);
- }
-
- //
- // Interface to Printer object.
- //
- public static void delete(
- Printer p,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterDelete.delete()");
-
- boolean success = true;
- String err = null;
- String cmd = null;
- SysCommand syscmd = null;
-
- String printername = p.getPrinterName();
- String nameservice = ns.getNameService();
-
- boolean islocal = DoPrinterUtil.isLocal(printername);
-
- // Take care of locally installed case first.
- if (islocal) {
- // See if printer is already rejected.
- // Don't disable so queue can drain.
- Printer curr = new Printer();
- curr.setPrinterName(printername);
- try {
- DoPrinterView.view(curr, ns);
- }
- catch (Exception e) {
- Debug.message("SVR:" + e.getMessage());
- curr.setAccept(false);
- }
-
- if (curr.getAccept()) {
- cmd = "/usr/sbin/reject " + printername;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- curr = null;
- try {
- deleteLocal(p);
- }
- catch (Exception e) {
- Debug.message("SVR:" + e.getMessage());
- success = false;
- }
- }
-
- //
- // Check if we already removed it from /etc/printers.conf
- //
- boolean exists;
- exists = DoPrinterUtil.exists(printername, "system");
- if (nameservice.equals("system")) {
- if (exists) {
- try {
- deleteLocal(p);
- }
- catch (Exception e) {
- Debug.message("SVR:" + e.getMessage());
- success = false;
- }
- }
- } else {
- if ((nameservice.equals("nis")) && exists) {
- //
- // Special case if we are nis master
- //
- Host h = new Host();
- String nshost = ns.getNameServiceHost();
- String lh = h.getLocalHostName();
- if (lh.equals(nshost)) {
- try {
- deleteLocal(p);
- }
- catch (Exception e) {
- Debug.message("SVR:" + e.getMessage());
- success = false;
- }
- }
- h = null;
- }
- DoPrinterNS.set("delete", p, ns);
- }
- if (!success) {
- throw new pmException();
- }
- return;
- }
-
- private static void deleteLocal(Printer p) throws Exception
- {
- Debug.message("SVR: DoPrinterDelete.deleteLocal()");
-
- String cmd = null;
- String err = null;
- SysCommand syscmd = null;
- String printername = null;
-
- printername = p.getPrinterName();
-
- // Workaround for lpadmin bug not removing default
- String def = DoPrinterUtil.getDefault("system");
- if ((def != null) && (def.equals(printername))) {
- cmd = "/usr/sbin/lpadmin -x _default";
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- cmd = "/usr/sbin/lpadmin -x " + printername;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (err != null) {
- p.setWarnLog(err);
- }
- if (syscmd.getExitValue() != 0) {
- syscmd = null;
- throw new pmException(err);
- }
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterMod.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterMod.java
deleted file mode 100644
index b7cadaa1cb..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterMod.java
+++ /dev/null
@@ -1,841 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * DoPrinterMod class
- * Worker class for modifying a printer.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-
-public class DoPrinterMod {
-
- //
- // main for testing
- //
- public static void main(String[] args) {
- NameService ns = new NameService();
-
- String[] arr;
- arr = new String[1];
-
- Printer p = new Printer();
-
- p.setPrinterName("javatest");
- p.setPrinterType("hplaser");
- p.setPrintServer("zelkova");
- p.setComment("This is a new comment");
- p.setDevice("/var/tmp/test");
- p.setNotify("none");
- p.setProtocol("bsd");
- p.setDestination("");
- p.setIsDefaultPrinter(true);
- p.setBanner("never");
- p.setEnable(true);
- p.setAccept(false);
-
- arr[0] = "any";
- p.setFileContents(arr);
- arr[0] = "one";
- p.setUserAllowList(arr);
- arr[0] = "two";
- p.setUserDenyList(arr);
-
- p.setLocale(null);
-
- try {
- modify(p, ns);
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- System.out.println("Commands:\n" + p.getCmdLog());
- System.out.println("Errors:\n" + p.getErrorLog());
- System.out.println("Warnings:\n" + p.getWarnLog());
- System.exit(0);
-
- }
-
- //
- // Interface to Printer object.
- //
- public static void modify(
- Printer p,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterMod.modify()");
-
- Printer curr = new Printer(ns);
- curr.setPrinterName(p.getPrinterName());
- try {
- DoPrinterView.view(curr, ns);
- }
- catch (Exception e) {
- String err = curr.getErrorLog();
- p.setErrorLog(err);
- throw new pmCmdFailedException(err);
- }
-
- boolean islocal = DoPrinterUtil.isLocal(p.getPrinterName());
- if (islocal) {
- modifyLocal(p, curr, ns);
- } else {
- modifyRemote(p, curr, ns);
- }
- return;
- }
-
- //
- // Do the work of modifying a local printer.
- //
- private static void modifyLocal(
- Printer p,
- Printer curr,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterMod.modifyLocal()");
-
- String err = null;
- String cmd = null;
- SysCommand syscmd = null;
-
- // Since it's local set extensions
- // Eventually the gui should do this.
- p.setExtensions("Solaris");
-
- String nameservice = ns.getNameService();
-
- String printername = p.getPrinterName();
- String printertype = null;
- String printserver = null;
- String comment = null;
- String device = null;
- String notify = null;
- String make = null;
- String model = null;
- String ppd = null;
- String protocol = null;
- String destination = null;
- String[] file_contents = null;
- String[] user_allow_list = null;
- String[] user_deny_list = null;
- boolean default_printer = false;
- String banner = null;
- boolean enable = false;
- boolean accept = false;
- boolean isURI = false;
-
- boolean allow_changed = false;
- boolean default_printer_changed = false;
- boolean banner_req_changed = false;
- boolean enable_changed = false;
- boolean accept_changed = false;
-
- String ppdfile = null;
-
-
- //
- // Set the things that have changed.
- //
- if (!strings_equal(curr.getPrinterType(), p.getPrinterType()))
- printertype = p.getPrinterType();
- if (!strings_equal(curr.getComment(), p.getComment())) {
- comment = p.getComment();
- if (comment == null) {
- // Comment changed to empty.
- p.setComment("");
- comment = "";
- }
- }
- if (!strings_equal(curr.getDevice(), p.getDevice()))
- device = p.getDevice();
-
- if (!strings_equal(curr.getNotify(), p.getNotify()))
- notify = p.getNotify();
-
- if (!strings_equal(curr.getProtocol(), p.getProtocol())) {
- protocol = p.getProtocol();
- }
-
- // Need to know if the new protocol is uri or if the
- // protocol did not change and the current one is uri
- if (((protocol == null) && (curr.getProtocol() == "uri")) ||
- ((protocol != null) && (protocol.equals("uri")))) {
- isURI = true;
- }
- Debug.message("SVR:DoPrinterMod:isURI: " + isURI);
- Debug.message("SVR:DoPrinterMod:protocol: " + protocol);
- Debug.message(
- "SVR:DoPrinterMod:curr.getProtocol(): " + curr.getProtocol());
- Debug.message("SVR:DoPrinterMod:p.getProtocol(): " + p.getProtocol());
-
- if (!strings_equal(curr.getDestination(), p.getDestination()))
- destination = p.getDestination();
-
- if ((!strings_equal(curr.getMake(), p.getMake())) ||
- (!strings_equal(curr.getModel(), p.getModel())) ||
- (!strings_equal(curr.getPPD(), p.getPPD()))) {
-
- model = p.getModel();
- make = p.getMake();
- ppd = p.getPPD();
- }
-
-
- if (curr.getIsDefaultPrinter() != p.getIsDefaultPrinter()) {
- default_printer = p.getIsDefaultPrinter();
- default_printer_changed = true;
- }
- if (curr.getEnable() != p.getEnable()) {
- enable = p.getEnable();
- enable_changed = true;
- }
-
- if (curr.getIsDefaultPrinter() != p.getIsDefaultPrinter()) {
- default_printer = p.getIsDefaultPrinter();
- default_printer_changed = true;
- }
- if (curr.getEnable() != p.getEnable()) {
- enable = p.getEnable();
- enable_changed = true;
- }
-
- if (curr.getIsDefaultPrinter() != p.getIsDefaultPrinter()) {
- default_printer = p.getIsDefaultPrinter();
- default_printer_changed = true;
- }
- if (curr.getEnable() != p.getEnable()) {
- enable = p.getEnable();
- enable_changed = true;
- }
- if (curr.getAccept() != p.getAccept()) {
- accept = p.getAccept();
- accept_changed = true;
- }
- if (!strings_equal(curr.getBanner(), p.getBanner())) {
- banner = p.getBanner();
- banner_req_changed = true;
- }
-
- if (!arrays_equal(curr.getFileContents(), p.getFileContents()))
- file_contents = p.getFileContents();
-
- if (!arrays_equal(curr.getUserAllowList(), p.getUserAllowList())) {
- allow_changed = true;
- // If the current value is "none" and the new
- // value is null nothing is changing.
- String[] arr = curr.getUserAllowList();
- if ((arr != null) && (arr.length != 0)) {
- if (arr[0].equals("none")) {
- if (p.getUserAllowList() == null) {
- allow_changed = false;
- }
- }
- }
- }
- if (!arrays_equal(curr.getUserDenyList(), p.getUserDenyList())) {
- allow_changed = true;
- }
- if (allow_changed) {
- user_allow_list = p.getUserAllowList();
- user_deny_list = p.getUserDenyList();
- }
-
- //
- // Return if nothing changed.
- //
- if ((printertype == null) &&
- (comment == null) &&
- (device == null) &&
- (notify == null) &&
- (protocol == null) &&
- (destination == null) &&
- (make == null) &&
- (model == null) &&
- (ppd == null) &&
- (file_contents == null) &&
- (!allow_changed) &&
- (!default_printer_changed) &&
- (!enable_changed) &&
- (!accept_changed) &&
- (!banner_req_changed)) {
- return;
- }
-
- // If this is the default printer set it.
- if (default_printer_changed) {
- if (default_printer) {
- cmd = "/usr/sbin/lpadmin -d " + printername;
- } else {
- cmd = "/usr/sbin/lpadmin -x _default";
- }
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- //
- // If this is only a default printer change then possibly
- // update the name service and return.
- if ((printertype == null) &&
- (comment == null) &&
- (device == null) &&
- (notify == null) &&
- (protocol == null) &&
- (destination == null) &&
- (make == null) &&
- (model == null) &&
- (ppd == null) &&
- (file_contents == null) &&
- (!allow_changed) &&
- (!enable_changed) &&
- (!accept_changed) &&
- (!banner_req_changed)) {
- if (nameservice.equals("system")) {
- return;
- }
- p.modhints = "defaultonly";
-
- DoPrinterNS.set("modify", p, ns);
- p.modhints = "";
- return;
- }
-
- //
- // Do enable/accept
- //
- if (enable_changed) {
- if (p.getEnable() == true) {
- cmd = "/usr/bin/enable " + printername;
- } else {
- cmd = "/usr/bin/disable " + printername;
- }
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- if (accept_changed) {
- if (p.getAccept() == true) {
- cmd = "/usr/sbin/accept " + printername;
- } else {
- cmd = "/usr/sbin/reject " + printername;
- }
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
-
- //
- // Do some slight of hand to deal with overloading of destination
- // with device for uri protocol
- // Done at the last moment to prevent modifying logic for old/new
- // properties of the queue
-
- if (isURI) {
- if (destination != null)
- device = destination;
- else
- device = curr.getDestination();
- destination = null;
- protocol = null;
- } else {
- if (protocol != null) {
- device = "/dev/null";
- }
- }
-
-
-
- //
- // Build the modify command
- //
-
- cmd = "/usr/sbin/lpadmin -p " + printername;
-
- if (printername != null)
- if (DoPrinterUtil.isLocalhost(printername)) {
- cmd = cmd.concat(" -s localhost");
- Debug.message("SVR:DoModifyPrinter:isLocalhost:true");
- }
-
- if (device != null) {
- cmd = cmd.concat(" -v " + device);
- }
-
- // Network printer
- if (isURI) {
- cmd = cmd.concat(" -m uri");
-
- } else if (protocol != null) {
-
- if (curr.getPPD() != null)
- cmd = cmd.concat(" -m netstandard_foomatic");
- else
- cmd = cmd.concat(" -m netstandard");
- }
-
- if (printertype != null)
- cmd = cmd.concat(" -T " + printertype);
-
- if (ppd != null) {
- ppdfile = new String(DoPrinterUtil.getPPDFile(make,
- model, ppd));
-
- Debug.message("SVR:modifyLocal:ppdfile: " + ppdfile);
-
- cmd = cmd.concat(" -n " + ppdfile);
- }
-
- if (notify != null)
- cmd = cmd.concat(" -A " + notify);
-
- // destination is overloaded to hold uri device for network printers
- // if the protocol is uri, don't set either destination or protocol
- // the device has been set to the destination above
-
- if (isURI) {
- cmd = cmd.concat(" -o dest=");
- cmd = cmd.concat(" -o protocol=");
- } else {
- if (destination != null)
- cmd = cmd.concat(" -o dest=" + destination);
- if (protocol != null)
- cmd = cmd.concat(" -o protocol=" + protocol);
- }
-
- if ((file_contents != null) && (file_contents.length != 0)) {
- String tmpstr = file_contents[0];
- for (int i = 1; i < file_contents.length; i++) {
- tmpstr = tmpstr.concat("," + file_contents[i]);
- }
- cmd = cmd.concat(" -I " + tmpstr);
- }
-
- if (banner_req_changed) {
- if (banner != null) {
- cmd = cmd.concat(" -o banner=" + banner);
- }
- }
-
- //
- // Has any of the above changed.
- //
- if (!cmd.equals("/usr/sbin/lpadmin -p " + printername)) {
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- //
- // If the user allow list changed delete all then re-add
- //
- if (allow_changed) {
- cmd = "/usr/sbin/lpadmin -p " + printername +
- " -u allow:none";
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
-
- if ((user_deny_list != null) &&
- (user_deny_list.length != 0)) {
- String tmpstr = user_deny_list[0];
- for (int i = 1; i < user_deny_list.length; i++) {
- tmpstr = tmpstr.concat(","
- + user_deny_list[i]);
- }
- cmd = "/usr/sbin/lpadmin -p " + printername +
- " -u deny:" + tmpstr;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- if ((user_allow_list != null) &&
- (user_allow_list.length != 0) &&
- (!user_allow_list[0].equals("none"))) {
- String tmpstr = user_allow_list[0];
- for (int i = 1; i < user_allow_list.length; i++) {
- tmpstr = tmpstr.concat(","
- + user_allow_list[i]);
- }
- cmd = "/usr/sbin/lpadmin -p " + printername +
- " -u allow:" + tmpstr;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- }
-
- if (comment != null) {
- //
- // Have to use a command array here since
- // exec(String) doesn't parse quoted strings.
- // Use lpadmin so the comment in /etc/printers.conf
- // and /etc/lp/printers/comment stay in sync.
- //
- String cmd_array[] =
- { "/usr/sbin/lpadmin", "-D",
- comment, "-p", printername };
- cmd = "/usr/sbin/lpadmin -D " +
- "\"" + comment + "\"" + " -p " + printername;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd_array);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- if (comment.equals("")) {
- //
- // LPADMIN BUG. Comment not cleared in printers.conf
- // so force it with lpset.
- //
- cmd = "/usr/bin/lpset -a description= " + printername;
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- err = syscmd.getError();
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- }
-
- //
- // Return if we don't need to touch the name service.
- //
- if (nameservice.equals("system")) {
- return;
- }
- if ((comment == null) && (!default_printer_changed)) {
- return;
- }
-
- DoPrinterNS.set("modify", p, ns);
- return;
- }
-
- //
- // Do the work of modifying a remote printer.
- //
- private static void modifyRemote(
- Printer p,
- Printer curr,
- NameService ns) throws Exception
- {
- int exitvalue = 0;
- String err = null;
- String cmd = null;
- String cmd_array[] = new String[4];
- SysCommand syscmd = null;
-
- String printername = null;
- String printserver = null;
- String comment = null;
- String extensions = null;
- boolean default_printer = false;
- boolean default_printer_changed = false;
-
- String nameservice = ns.getNameService();
-
- printername = p.getPrinterName();
- if (!strings_equal(curr.getPrintServer(), p.getPrintServer()))
- printserver = p.getPrintServer();
-
- if (!strings_equal(curr.getComment(), p.getComment())) {
- comment = p.getComment();
- if (comment == null) {
- // The comment changed to empty.
- p.setComment("");
- comment = "";
- }
- }
-//
-// Don't support extensions in the gui yet.
-// If they exist leave them alone.
-// EXTENSIONS
- p.setExtensions(curr.getExtensions());
- if (!strings_equal(curr.getExtensions(), p.getExtensions()))
- extensions = p.getExtensions();
- if (curr.getIsDefaultPrinter() != p.getIsDefaultPrinter()) {
- default_printer = p.getIsDefaultPrinter();
- default_printer_changed = true;
- }
-
- //
- // Return if nothing changed.
- //
- if ((printserver == null) &&
- (extensions == null) &&
- (comment == null) &&
- (!default_printer_changed)) {
- return;
- }
-
- //
- // If this is only a default printer change then set modhints
- //
- if ((printserver == null) &&
- (extensions == null) &&
- (comment == null)) {
- p.modhints = "defaultonly";
- }
-
-
- //
- // Find out if we are the nis master
- //
- boolean isnismaster = false;
- if (nameservice.equals("nis")) {
- String nshost = ns.getNameServiceHost();
- Host h = new Host();
- String lh = h.getLocalHostName();
- if (lh.equals(nshost))
- isnismaster = true;
- h = null;
- }
-
- //
- // If we are not updating system and we are not the nis
- // master then update the name service and return.
- //
- if ((!nameservice.equals("system")) && (!isnismaster)) {
- DoPrinterNS.set("modify", p, ns);
- p.modhints = "";
- return;
- }
- p.modhints = "";
-
- //
- // Take care of the bsdaddr attribute
- //
- // EXTENSIONS
- // The gui doesn't support extensions yet so the goal
- // here is to prepare for it but don't actually
- // modify them.
- //
- if ((printserver != null) || (extensions != null)) {
- // If printserver is null we are changing
- // extensions. Set printserver to its current
- // value.
- if (printserver == null) {
- printserver = curr.getPrintServer();
- }
- String bsdaddr = "bsdaddr=" + printserver + ","
- + printername;
- //
- // Leave the extensions alone
- // EXTENSIONS
- //
- extensions = curr.getExtensions();
- if (extensions != null) {
- bsdaddr = bsdaddr.concat("," + extensions);
- }
- cmd = "/usr/bin/lpset -a " + bsdaddr + " " + printername;
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- }
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- if (comment != null) {
- cmd = "/usr/bin/lpset" + " -a description=" +
- "\"" + comment + "\"" +
- " " + printername;
- cmd_array[0] = "/usr/bin/lpset";
- cmd_array[1] = "-a";
- cmd_array[2] = "description=" + comment;
- cmd_array[3] = printername;
-
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd_array);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- }
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- // If this is the default printer set it.
- if (default_printer_changed) {
- if (default_printer) {
- cmd = "/usr/sbin/lpadmin -d " + printername;
- } else {
- cmd = "/usr/sbin/lpadmin -x _default";
- }
- p.setCmdLog(cmd);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- }
- if (err != null) {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
-
- //
- // If it's nis and we are here then we are the nis
- // master. This call will do the make for us.
- //
- if (nameservice.equals("nis")) {
- DoPrinterNS.set("modify", p, ns);
- }
- return;
- }
-
- private static boolean arrays_equal(String[] arr1, String[] arr2)
- {
- if ((arr1 == null) && (arr2 == null)) {
- return (true);
- }
- if ((arr1 == null) || (arr2 == null)) {
- return (false);
- }
- if (arr1.length != arr2.length) {
- return (false);
- }
-
- int i, j;
- String str;
- boolean found;
- for (i = 0; i < arr1.length; i++) {
- found = false;
- str = arr1[i];
- for (j = 0; j < arr2.length; j++) {
- if (str.equals(arr2[j])) {
- found = true;
- }
- }
- if (found == false) {
- return (false);
- }
- }
- return (true);
- }
-
- private static boolean strings_equal(String str1, String str2)
- {
- if ((str1 == null) && (str2 == null)) {
- return (true);
- }
- if ((str1 == null) || (str2 == null)) {
- return (false);
- }
-
- return (str1.equals(str2));
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterNS.c b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterNS.c
deleted file mode 100644
index 2cd059860d..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterNS.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-#pragma ident "%Z%%M% %I% %E% SMI"
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* LINTLIBRARY */
-
-#include <stdio.h>
-#include <strings.h>
-#include <libintl.h>
-#include "com_sun_admin_pm_server_DoPrinterNS.h"
-
-jstring glob_jstdout = NULL;
-jstring glob_jstderr = NULL;
-
-extern char glob_stdout[];
-extern char glob_stderr[];
-
-void set_stderr(JNIEnv *env);
-void set_stdout(JNIEnv *env);
-extern int _dorexec(
- const char *host,
- const char *user,
- const char *passwd,
- const char *cmd,
- const char *locale);
-
-extern int _updateoldyp(
- const char *action,
- const char *printername,
- const char *printserver,
- const char *extensions,
- const char *comment,
- const char *isdefault);
-
-extern int _updateldap(
- const char *action,
- const char *host,
- const char *user,
- const char *passwd,
- const char *printername,
- const char *printserver,
- const char *extensions,
- const char *comment,
- const char *isdefault);
-
-JNIEXPORT jint JNICALL
-Java_com_sun_admin_pm_server_DoPrinterNS_dorexec(
- JNIEnv *env,
- jclass class,
- jstring jhost,
- jstring juser,
- jstring jpasswd,
- jstring jcmd,
- jstring jlocale)
-{
- const char *host;
- const char *user;
- const char *passwd;
- const char *cmd;
- const char *locale;
-
- int ret = 0;
- jstring empty = (*env)->NewStringUTF(env, "");
- glob_jstdout = (*env)->NewGlobalRef(env, empty);
- glob_jstderr = (*env)->NewGlobalRef(env, empty);
-
- host = (*env)->GetStringUTFChars(env, jhost, 0);
- user = (*env)->GetStringUTFChars(env, juser, 0);
- passwd = (*env)->GetStringUTFChars(env, jpasswd, 0);
- cmd = (*env)->GetStringUTFChars(env, jcmd, 0);
- locale = (*env)->GetStringUTFChars(env, jlocale, 0);
-
- ret = _dorexec(host, user, passwd, cmd, locale);
-
- if (ret != 0) {
- (void) set_stderr(env);
- return (ret);
- }
- (void) set_stderr(env);
- (void) set_stdout(env);
- return (ret);
-}
-
-JNIEXPORT jstring JNICALL
-Java_com_sun_admin_pm_server_DoPrinterNS_getstderr(JNIEnv *env, jclass class)
-{
- return (glob_jstderr);
-}
-
-JNIEXPORT jstring JNICALL
-Java_com_sun_admin_pm_server_DoPrinterNS_getstdout(JNIEnv *env, jclass class)
-{
- return (glob_jstdout);
-}
-
-void
-set_stderr(JNIEnv *env)
-{
- static jstring jerrstr;
- static char errbuf[BUFSIZ];
-
- if (*glob_stderr == '\0') {
- (void) strcpy(errbuf, "");
- } else {
- (void) strcpy(errbuf, glob_stderr);
- }
-
- jerrstr = (*env)->NewStringUTF(env, "");
- if (glob_jstderr != NULL) {
- (*env)->DeleteGlobalRef(env, glob_jstderr);
- }
-
- jerrstr = (*env)->NewStringUTF(env, errbuf);
- glob_jstderr = (*env)->NewGlobalRef(env, jerrstr);
-}
-
-void
-set_stdout(JNIEnv *env)
-{
- static jstring joutstr;
- static char outbuf[BUFSIZ];
-
- if (*glob_stdout == '\0') {
- (void) strcpy(outbuf, "");
- } else {
- (void) strcpy(outbuf, glob_stdout);
- }
-
- joutstr = (*env)->NewStringUTF(env, "");
- if (glob_jstdout != NULL) {
- (*env)->DeleteGlobalRef(env, glob_jstdout);
- }
-
- joutstr = (*env)->NewStringUTF(env, outbuf);
- glob_jstdout = (*env)->NewGlobalRef(env, joutstr);
-}
-
-JNIEXPORT jint JNICALL
-Java_com_sun_admin_pm_server_DoPrinterNS_updateoldyp(
- JNIEnv *env,
- jclass class,
- jstring jaction,
- jstring jprintername,
- jstring jprintserver,
- jstring jextensions,
- jstring jcomment,
- jstring jisdefault)
-{
- const char *action = NULL;
- const char *printername = NULL;
- const char *printserver = NULL;
- const char *extensions = NULL;
- const char *comment = NULL;
- const char *isdefault = NULL;
-
- int ret = 0;
- jstring empty = (*env)->NewStringUTF(env, "");
- glob_jstdout = (*env)->NewGlobalRef(env, empty);
- glob_jstderr = (*env)->NewGlobalRef(env, empty);
-
- action = (*env)->GetStringUTFChars(env, jaction, 0);
- printername = (*env)->GetStringUTFChars(env, jprintername, 0);
- if (jprintserver != NULL) {
- printserver =
- (*env)->GetStringUTFChars(env, jprintserver, 0);
- }
- if (jextensions != NULL) {
- extensions =
- (*env)->GetStringUTFChars(env, jextensions, 0);
- }
- if (jcomment != NULL) {
- comment =
- (*env)->GetStringUTFChars(env, jcomment, 0);
- }
- isdefault = (*env)->GetStringUTFChars(env, jisdefault, 0);
-
- ret = _updateoldyp(action, printername, printserver,
- extensions, comment, isdefault);
-
- if (ret != 0) {
- (void) set_stderr(env);
- return (ret);
- }
- (void) set_stderr(env);
- (void) set_stdout(env);
- return (ret);
-}
-
-JNIEXPORT jint JNICALL
-Java_com_sun_admin_pm_server_DoPrinterNS_updateldap(
- JNIEnv *env,
- jclass class,
- jstring jaction,
- jstring jhost,
- jstring jbinddn,
- jstring jpasswd,
- jstring jprintername,
- jstring jprintserver,
- jstring jextensions,
- jstring jcomment,
- jstring jisdefault)
-{
- const char *action = NULL;
- const char *host = NULL;
- const char *binddn = NULL;
- const char *passwd = NULL;
- const char *printername = NULL;
- const char *printserver = NULL;
- const char *extensions = NULL;
- const char *comment = NULL;
- const char *isdefault = NULL;
-
- int ret = 0;
- jstring empty = (*env)->NewStringUTF(env, "");
- glob_jstdout = (*env)->NewGlobalRef(env, empty);
- glob_jstderr = (*env)->NewGlobalRef(env, empty);
-
- action = (*env)->GetStringUTFChars(env, jaction, 0);
- printername = (*env)->GetStringUTFChars(env, jprintername, 0);
- if (jhost != NULL) {
- host = (*env)->GetStringUTFChars(env, jhost, 0);
- }
- if (jbinddn != NULL) {
- binddn = (*env)->GetStringUTFChars(env, jbinddn, 0);
- }
- if (jpasswd != NULL) {
- passwd = (*env)->GetStringUTFChars(env, jpasswd, 0);
- }
- if (jprintserver != NULL) {
- printserver =
- (*env)->GetStringUTFChars(env, jprintserver, 0);
- }
- if (jextensions != NULL) {
- extensions =
- (*env)->GetStringUTFChars(env, jextensions, 0);
- }
- if (jcomment != NULL) {
- comment =
- (*env)->GetStringUTFChars(env, jcomment, 0);
- }
- isdefault = (*env)->GetStringUTFChars(env, jisdefault, 0);
-
- ret = _updateldap(action, host, binddn, passwd, printername,
- printserver, extensions, comment, isdefault);
-
- if (ret != 0) {
- (void) set_stderr(env);
- return (ret);
- }
- (void) set_stderr(env);
- (void) set_stdout(env);
- return (ret);
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterNS.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterNS.java
deleted file mode 100644
index 3fdb9753ee..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterNS.java
+++ /dev/null
@@ -1,626 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * DoPrinterNS class
- * Worker class for updating name services.
- * Interfaces to JNI code.
- */
-
-package com.sun.admin.pm.server;
-
-public class DoPrinterNS
-{
- //
- // JNI member functions
- //
- private synchronized static native int dorexec(String nshost,
- String user, String passwd, String cmd, String locale);
- private synchronized static native int updateoldyp(String action,
- String printername, String printserver, String extensions,
- String comment, String isdefault);
- private synchronized static native int updateldap(String action,
- String host, String binddn, String passwd,
- String printername, String printserver, String extensions,
- String comment, String isdefault);
- private synchronized static native String getstderr();
- private synchronized static native String getstdout();
-
- //
- // Load JNI.
- //
- static
- {
- System.loadLibrary("pmgr");
- }
-
- //
- // main for testing
- //
- public static void main(String[] args) {
- //
- // Set attributes for testing.
- //
- NameService ns = null;
- try {
- ns = new NameService("nis");
- }
- catch (Exception e) {
- System.out.println(e);
- System.exit(1);
- }
- ns.setPasswd("");
-
- Printer p = new Printer(ns);
- p.setPrinterName("javatest");
- p.setPrintServer("zelkova");
- p.setComment("This is a comment");
- p.setIsDefaultPrinter(false);
- p.setLocale(null);
-
- String action = "add";
- if (args.length >= 1)
- action = args[0];
- try {
- set(action, p, ns);
- }
- catch (Exception e) {
- System.out.println(e);
- }
- System.out.println("Commands:\n" + p.getCmdLog());
- System.out.println("Errors:\n" + p.getErrorLog());
- System.out.println("Warnings:\n" + p.getWarnLog());
- System.exit(0);
- }
-
- //
- // Interface to DoPrinter[add|mod|delete]
- //
- public static void set(
- String action,
- Printer p,
- NameService ns) throws Exception
- {
- String nameservice = ns.getNameService();
-
- if (nameservice.equals("system")) {
- return;
- } else if (nameservice.equals("nis")) {
- setNIS(action, p, ns);
- return;
- }
- setNS(action, p, ns);
- return;
- }
-
- private static void setNIS(
- String action,
- Printer p,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterNS.setNIS(): " + action);
-
- String printername = p.getPrinterName();
- String printserver = p.getPrintServer();
- String comment = p.getComment();
- String extensions = p.getExtensions();
- boolean default_printer = p.getIsDefaultPrinter();
- String locale = p.getLocale();
- if (locale == null)
- locale = "C";
-
- String nameservice = ns.getNameService();
- String nshost = ns.getNameServiceHost();
- String user = ns.getUser();
- String passwd = ns.getPasswd();
-
- String cmd = null;
- String err = null;
- int ret = 0;
- int exitvalue = 0;
-
- //
- // If this is the nis master we only need to do the make
- // locally.
- //
- Host h = new Host();
- String lh = h.getLocalHostName();
- if (lh.equals(nshost)) {
- cmd = "/usr/ccs/bin/make -f /var/yp/Makefile";
- cmd = cmd.concat(" -f /usr/lib/print/Makefile.yp ");
- cmd = cmd.concat("printers.conf");
-
- p.setCmdLog(cmd);
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
-
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else {
- // ignore touch warning
- // p.setWarnLog(err);
- }
- syscmd = null;
- return;
- }
-
- String cmdprefix = "rexec(" + nshost + "): ";
-
- cmd = "/usr/bin/echo";
- Debug.message("SVR: " + cmdprefix + cmd);
- ret = dorexec(nshost, user, passwd, cmd, locale);
- if (ret != 0) {
- throw new pmAuthException(getstderr());
- }
- //
- // Do we have lpset
- //
- cmd = "/usr/bin/ls /usr/bin/lpset";
- Debug.message("SVR: " + cmdprefix + cmd);
- ret = dorexec(nshost, user, passwd, cmd, locale);
- if (ret != 0) {
- throw new pmCmdFailedException(getstderr());
- }
- String tmpstr = getstdout();
- tmpstr = tmpstr.trim();
- if (!tmpstr.equals("/usr/bin/lpset")) {
- Debug.message("SVR: No lpset found. Checking rhosts.");
-
- // Are we set up in rhosts?
- cmd = "rsh ";
- cmd = cmd.concat(nshost);
- cmd = cmd.concat(" echo");
-
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- syscmd = null;
- throw new pmAuthRhostException(err);
- }
- syscmd = null;
- //
- // We don't have lpset. Must be pre-2.6 master.
- // We are set up in rhosts so use libprint
- // to update it.
- //
- p.setCmdLog("rsh " + nshost + "...");
- String def = "false";
- if (default_printer)
- def = "true";
-
- Debug.message("SVR: updateoldyp(): ");
- Debug.message("SVR: action=" + action);
- Debug.message("SVR: printername=" + printername);
- Debug.message("SVR: printserver=" + printserver);
- Debug.message("SVR: extensions=" + extensions);
- Debug.message("SVR: comment=" + comment);
- Debug.message("SVR: default=" + def);
-
- ret = updateoldyp(action, printername,
- printserver, extensions, comment, def);
- if (ret != 0) {
- throw new pmCmdFailedException("libprint");
- }
- return;
- }
-
- //
- // Add and modify are the same
- //
- boolean domake = false;
- if (!action.equals("delete")) {
- //
- // If we are here from a modify and only need
- // to change the default printer ...
- //
- if (!p.modhints.equals("defaultonly")) {
- String bsdaddr = "bsdaddr=" + printserver + "," +
- printername;
- if (extensions != null) {
- bsdaddr = bsdaddr.concat("," + extensions);
- }
- cmd = "/usr/bin/lpset -a " + bsdaddr;
- if (comment != null) {
- cmd = cmd.concat(" -a " + "description=" +
- "\"" + comment + "\"");
- }
- cmd = cmd.concat(" " + printername);
-
- Debug.message("SVR: " + cmdprefix + cmd);
- p.setCmdLog(cmdprefix + cmd);
- ret = dorexec(nshost, user, passwd, cmd, locale);
- err = getstderr();
- if (ret != 0) {
- p.setErrorLog(err);
- throw new pmCmdFailedException(err);
- }
- if (!err.equals("")) {
- p.setWarnLog(err);
- }
- domake = true;
- }
-
- cmd = null;
- String def = DoPrinterUtil.getDefault("nis");
- if (default_printer) {
- if (!printername.equals(def)) {
- cmd = "/usr/bin/lpset -a " + "use=" +
- printername + " _default";
- }
- } else {
- if ((def != null) && (def.equals(printername))) {
- //
- // It was the default but not any more.
- //
- cmd = "/usr/bin/lpset -x _default";
- }
- }
- if (cmd != null) {
- Debug.message("SVR: " + cmdprefix + cmd);
- p.setCmdLog(cmdprefix + cmd);
- ret = dorexec(nshost, user, passwd, cmd, locale);
- err = getstderr();
- if (ret != 0) {
- p.setErrorLog(err);
- throw new pmCmdFailedException(err);
- }
- if (!err.equals("")) {
- p.setWarnLog(err);
- }
- domake = true;
- }
- } else {
- if (DoPrinterUtil.exists(printername, "nis")) {
- // delete
- cmd = "/usr/bin/lpset -x " + printername;
- Debug.message("SVR: " + cmdprefix + cmd);
- p.setCmdLog(cmdprefix + cmd);
- ret = dorexec(nshost, user, passwd, cmd, locale);
- err = getstderr();
- if (ret != 0) {
- p.setErrorLog(err);
- throw new pmCmdFailedException(err);
- }
- if (!err.equals("")) {
- p.setWarnLog(err);
- }
- domake = true;
- }
- String def = DoPrinterUtil.getDefault("nis");
- if ((def != null) && (def.equals(printername))) {
- cmd = "/usr/bin/lpset -x _default";
- Debug.message("SVR: " + cmdprefix + cmd);
- p.setCmdLog(cmdprefix + cmd);
- ret = dorexec(nshost, user, passwd, cmd, locale);
- err = getstderr();
- if (ret != 0) {
- p.setErrorLog(err);
- throw new pmCmdFailedException(err);
- }
- if (!err.equals("")) {
- p.setWarnLog(err);
- }
- domake = true;
- }
- }
- if (!domake) {
- return;
- }
-
- cmd = "cd /var/yp; /usr/ccs/bin/make -f /var/yp/Makefile";
- cmd = cmd.concat(" -f /usr/lib/print/Makefile.yp printers.conf");
- Debug.message("SVR: " + cmdprefix + cmd);
- p.setCmdLog(cmdprefix + cmd);
- ret = dorexec(nshost, user, passwd, cmd, locale);
- err = getstderr();
- if (ret != 0) {
- p.setErrorLog(err);
- throw new pmCmdFailedException(err);
- }
- if (!err.equals("")) {
- p.setWarnLog(err);
- }
- return;
- }
-
- private static void setNS(
- String action,
- Printer p,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterNS.setNS(): " + action);
-
- String printername = p.getPrinterName();
- String printserver = p.getPrintServer();
- String extensions = p.getExtensions();
- String comment = p.getComment();
- boolean default_printer = p.getIsDefaultPrinter();
-
- String nameservice = ns.getNameService();
-
- String nshost = ns.getNameServiceHost();
- String user = ns.getUser();
- String passwd = ns.getPasswd();
-
- int exitvalue;
- SysCommand syscmd = null;
- String err;
- String cmd = null;
- String cmd_log = null;
- String cmd_array[] = new String[14];
-
- int index = 0;
- String base_cmd = "/usr/bin/lpset -n " + nameservice;
- String base_cmd_log = "/usr/bin/lpset -n " + nameservice;
-
- cmd_array[index++] = "/usr/bin/lpset";
- cmd_array[index++] = "-n";
- cmd_array[index++] = nameservice;
-
- /*
- * Use jni to update ldap since the passwd is sensitive.
- */
- if (nameservice.equals("ldap")) {
-
- if ((nshost == null) || (nshost.equals(""))) {
- throw new pmInternalErrorException(
- "Missing LDAP host for ldap operation");
- }
- if ((user == null) && (user.equals(""))) {
- throw new pmInternalErrorException(
- "Missing Binddn for ldap operation");
- }
- if ((passwd == null) && (passwd.equals(""))) {
- throw new pmInternalErrorException(
- "Missing passwd for ldap operation");
- }
-
- p.setCmdLog("ldap ...");
-
- String def = "false";
- if (default_printer)
- def = "true";
-
- Debug.message("SVR: updateldap(): ");
- Debug.message("SVR: action=" + action);
- Debug.message("SVR: host=" + nshost);
- Debug.message("SVR: binddn=" + user);
- Debug.message("SVR: passwd=****");
- Debug.message("SVR: printername=" + printername);
- Debug.message("SVR: printserver=" + printserver);
- Debug.message("SVR: extensions=" + extensions);
- Debug.message("SVR: comment=" + comment);
- Debug.message("SVR: default=" + def);
-
- exitvalue = updateldap(action, nshost, user, passwd,
- printername, printserver, extensions, comment,
- def);
-
- if (exitvalue != 0) {
- throw new pmCmdFailedException("libprint");
- }
- return;
- }
-
- //
- // Add and modify are the same
- //
- if (!action.equals("delete")) {
- //
- // If we are here for a modify and we're only setting
- // the default printer ...
- //
- if (!p.modhints.equals("defaultonly")) {
- String bsdaddr = "bsdaddr=" + printserver + "," +
- printername;
- if (extensions != null) {
- bsdaddr = bsdaddr.concat("," + extensions);
- }
- cmd_array[index++] = "-a";
- cmd_array[index++] = bsdaddr;
- cmd_log = base_cmd_log + " -a " + bsdaddr;
- if (comment != null) {
- cmd_array[index++] = "-a";
- cmd_array[index++] = "description=" + comment;
- cmd_log = cmd_log.concat(" -a " +
- "description=" + "\"" + comment + "\"");
- }
- cmd_array[index++] = printername;
- cmd_log = cmd_log.concat(" " + printername);
-
- p.setCmdLog(cmd_log);
- syscmd = new SysCommand();
- syscmd.exec(cmd_array);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- cmd = null;
- cmd_log = null;
- String args = null;
- String def = DoPrinterUtil.getDefault(nameservice);
- if (default_printer) {
- if (!printername.equals(def)) {
- args = " -a " + "use=" + printername +
- " _default";
- cmd = base_cmd + args;
- cmd_log = base_cmd_log + args;
- }
- } else {
- if ((def != null) && (def.equals(printername))) {
- //
- // It was the default but not any more.
- //
- args = " -x _default";
- cmd = base_cmd + args;
- cmd_log = base_cmd_log + args;
- }
- }
- if (cmd != null) {
- p.setCmdLog(cmd_log);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- } else {
- if (DoPrinterUtil.exists(printername, nameservice)) {
- // delete
- cmd = base_cmd + " -x " + printername;
- cmd_log = base_cmd_log + " -x " + printername;
- p.setCmdLog(cmd_log);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else {
- p.setWarnLog(err);
- }
- syscmd = null;
-
- }
- String def = DoPrinterUtil.getDefault(nameservice);
- if ((def != null) && (def.equals(printername))) {
- cmd = base_cmd + " -x _default";
- cmd_log = base_cmd_log + " -x _default";
- p.setCmdLog(cmd_log);
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- err = syscmd.getError();
- if (syscmd.getExitValue() != 0) {
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- } else {
- p.setWarnLog(err);
- }
- syscmd = null;
- }
- }
- return;
- }
-
- public static boolean doAuth(NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterNS.checkAuth()");
-
- String nsname = ns.getNameService();
- String host = ns.getNameServiceHost();
- String user = ns.getUser();
- String passwd = ns.getPasswd();
-
- if (nsname.equals("system")) {
- if (!isRoot()) {
- Debug.error(
- "SVR: User does not have root priveleges.");
- throw new pmAuthException();
- }
- } else if (nsname.equals("nis")) {
- Host h = new Host();
- String lh = h.getLocalHostName();
- String nm = h.getNisHost("master");
- if (lh.equals(nm)) {
- // Since we are on the NIS master the
- // check is the same as for "system".
- Debug.message("SVR: Host is NIS master.");
- if (!isRoot()) {
- Debug.error(
- "SVR: User does not have root access.");
- throw new pmAuthException();
- }
- }
- int ret = dorexec(host, user, passwd, "/usr/bin/echo", "C");
- if (ret != 0) {
- Debug.error(
- "SVR: User does not have NIS update access.");
- throw new pmAuthException(getstderr());
- }
- } else if (nsname.equals("ldap")) {
- int ret = updateldap("add", host, user, passwd,
- "_pmTestAuthToken", null, null, null, "false");
-
- if (ret != 0) {
- Debug.error(
- "SVR: User does not have LDAP update priveleges.");
- throw new pmAuthException();
- }
- ret = updateldap("delete", host, user, passwd,
- "_pmTestAuthToken", null, null, null, "false");
-
- } else {
- throw new pmInternalErrorException(
- "doAuth(): Invalid name service: " + nsname);
- }
- return (true);
- }
-
- public static void doCheckRootPasswd(String p)
- throws Exception
- {
- Host h = new Host();
- String lh = h.getLocalHostName();
-
- int ret = dorexec(lh, "root", p, "/usr/bin/echo", "C");
- if (ret != 0) {
- throw new pmAuthException(getstderr());
- }
- return;
- }
-
- public static boolean isRoot()
- throws Exception
- {
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/id", "LC_ALL=C");
-
- String o = syscmd.getOutput();
-
- if (o == null) {
- throw new pmCmdFailedException(syscmd.getError());
- }
- if (o.indexOf("uid=0(") == -1) {
- return (false);
- }
- return (true);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterUtil.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterUtil.java
deleted file mode 100644
index 6d8790a55c..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterUtil.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * DoPrinterUtil class
- * Worker utility class.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-import java.util.*;
-
-public class DoPrinterUtil {
-
- public static String getDefault(String ns) throws Exception
- {
- Debug.message("SVR: DoPrinterUtil.getDefault()");
- Debug.message("SVR: name service equals " + ns);
-
- String o = null;
- String cmd = "/usr/bin/lpget -n " + ns + " _default";
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- o = syscmd.getOutput();
- syscmd = null;
-
- if (o == null) {
- return (null);
- }
- int i = o.indexOf("use=");
- if (i == -1) {
- return (null);
- }
- o = o.substring(i);
- String dflt = DoPrinterView.getToken(o + "\n", "use=");
-
- Debug.message("SVR: default is " + dflt);
- return (new String(dflt));
- }
-
- public static String[] getDevices() throws Exception
- {
- Debug.message("SVR: DoPrinterUtil.getDevices()");
-
- int i = 0;
- String dev = "";
- String devices = "";
-
- String serial_possibilities[] = {"a", "b", "c", "d",
- "e", "f", "g", "h", "i", "j", "k", "l", "m",
- "n", "o", "p", "q", "r", "s", "t", "u", "v",
- "w", "x", "y", "z"};
-
- String cmd = "/usr/bin/find /dev -print";
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- String errstr = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(errstr);
- }
-
- String o = syscmd.getOutput();
- syscmd = null;
-
- if (o == null) {
- return (null);
- }
- o = o.concat("\n");
-
- for (i = 0; i < serial_possibilities.length; i++) {
- dev = "/dev/term/" + serial_possibilities[i] + "\n";
- if (o.indexOf(dev) != -1) {
- devices = devices.concat(" " + dev + " ");
- }
- }
- // sparc bpp parallel ports
- for (i = 0; i < 100; i++) {
- dev = "/dev/bpp" + i + "\n";
- if (o.indexOf(dev) != -1) {
- devices = devices.concat(" " + dev + " ");
- }
- }
- // sparc ecpp parallel ports
- for (i = 0; i < 100; i++) {
- dev = "/dev/ecpp" + i + "\n";
- if (o.indexOf(dev) != -1) {
- devices = devices.concat(" " + dev + " ");
- }
- }
- // intel parallel ports
- for (i = 0; i < 100; i++) {
- dev = "/dev/lp" + i + "\n";
- if (o.indexOf(dev) != -1) {
- devices = devices.concat(" " + dev + " ");
- }
- }
-
- // USB
- for (i = 0; i < 100; i++) {
- dev = "/dev/printers/" + i + "\n";
- if (o.indexOf(dev) != -1) {
- devices = devices.concat(" " + dev + " ");
- }
- }
-
- // SunPics
- dev = "/dev/lpvi\n";
- if (o.indexOf(dev) != -1) {
- devices = devices.concat(" " + dev + " ");
- }
-
- o = null;
-
- if (devices.equals("")) {
- return (null);
- }
-
- String ret[];
- StringTokenizer st = new StringTokenizer(devices);
- if (st.countTokens() == 0) {
- return (null);
- } else {
- ret = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- ret[i] = st.nextToken();
- }
- }
- return (ret);
- }
-
- public static String[] getMakes() throws Exception
- {
- int i;
-
- Debug.message("SVR: DoPrinterUtil.getMakes()");
-
- String cmd = "/usr/lib/lp/bin/getmakes";
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- String errstr = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(errstr);
- }
- String makes = syscmd.getOutput();
-
- String ret[];
- StringTokenizer st = new StringTokenizer(makes);
- if (st.countTokens() == 0) {
- return (null);
- } else {
- ret = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- ret[i] = st.nextToken();
-
- }
- }
- return (ret);
-
- }
- public static String[] getModels(String make) throws Exception
- {
- int i;
- String ret[];
-
- Debug.message("SVR:getModels()");
-
- if (make == null) {
- Debug.message("SVR:getModels: make is null");
- return (null);
- }
- // Make call for models for this make
- String cmd = "/usr/lib/lp/bin/getmodels " + make;
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- String errstr = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(errstr);
- }
- String models = syscmd.getOutput();
-
- if (models != null) {
- StringTokenizer st = new StringTokenizer(models, "\n");
- if (st.countTokens() == 0) {
- Debug.message("SVR:String tokenizer count is zero");
- return (null);
- } else {
- ret = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- ret[i] = st.nextToken();
-
- }
- }
- return (ret);
- } else
- return (null);
- }
-
- public static String[] getPPDs(String make, String model) throws Exception
- {
- int i;
- String ret[];
- ret = new String[2];
- if ((make == null) || (model == null)) {
- return null;
- }
- // get ppd files for this make/model
- String cmd = "/usr/lib/lp/bin/getppds " + make + " " + model;
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- String errstr = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(errstr);
- }
- String ppds = syscmd.getOutput();
- StringTokenizer st = new StringTokenizer(ppds, "\n");
- if (st.countTokens() == 0) {
- return (null);
- } else {
- ret = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- ret[i] = st.nextToken();
-
- }
- }
- return (ret);
- }
-
- public static String[] getMakeModelNick(String ppdfilename) throws Exception
- {
- int i;
- String ret[] = null;
- if (ppdfilename == null) {
- return (null);
- }
- // get ppd files for this make/model
- String cmd = "/usr/lib/lp/bin/ppdfilename2mmp " + ppdfilename;
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- String errstr = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(errstr);
- }
- String mmp = syscmd.getOutput();
-
- if (mmp != null) {
- ret = new String[2];
-
- StringTokenizer st = new StringTokenizer(mmp, "\n");
- if (st.countTokens() == 0) {
- return (null);
- } else {
- ret = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- ret[i] = st.nextToken();
-
- }
- }
- }
- return (ret);
- }
-
- public static String getPPDFile(
- String make, String model, String ppd) throws Exception
- {
- int i;
- String ret[];
- ret = new String[2];
- if (ppd == null) {
- return (null);
- }
- // get ppd path/filename for this ppd
- String cmd = "/usr/lib/lp/bin/getppdfile " +
- make + ":" + " " + model + ":" + " " + ppd + ":";
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- String errstr = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(errstr);
- }
- String ppdfile = syscmd.getOutput();
-
- return (ppdfile);
- }
-
-
- public static String[] getProbe(String device)
- {
- int i;
- String pmake = null;
- String pmodel = null;
- String tokens[] = null;
- String ret[];
- ret = new String[2];
-
- if (device == null)
- return (null);
-
- Debug.message("SVR: DoPrinterUtil.getProbe()");
-
- // Get Manufacturer and Model for printer in this port
- String cmd = "/usr/lib/lp/bin/printer-info -M -m " + device;
- SysCommand syscmd = new SysCommand();
- try {
- syscmd.exec(cmd);
- } catch (Exception e) {
- System.out.println(e);
- }
- if (syscmd.getExitValue() != 0) {
- String errstr = syscmd.getError();
- syscmd = null;
- return (null);
- }
-
- String mm = syscmd.getOutput();
- if (mm != null) {
- int numtokens;
- StringTokenizer st = new StringTokenizer(mm, ":" + "\n");
- if (st.countTokens() == 0) {
- return (null);
- } else {
- numtokens = st.countTokens();
- tokens = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- tokens[i] = st.nextToken();
- }
- }
- for (i = 0; i < numtokens; i++) {
- if ((tokens[i].trim()).equals("Manufacturer")) {
- pmake = new String(tokens[i + 1].trim());
- } else { if ((tokens[i].trim()).equals("Model"))
- pmodel = new String(tokens[i + 1].trim());
- }
- }
-
- if (pmake != null)
- ret[0] = pmake;
- if (pmodel != null)
- ret[1] = pmodel;
-
- return (ret);
- }
- return (null);
-
- }
-
- public static boolean isMakeModel(
- String make,
- String model)
- {
- int exitvalue;
-
- Debug.message("SVR: DoPrinterUtil.isMakeModel() " + make + " " + model);
-
- SysCommand syscmd = new SysCommand();
- // syscmd.exec("/usr/bin/lpget -n " + ns + " " + name);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
- if (exitvalue == 0) {
- return (true);
- }
- return (false);
- }
-
-
- public static String[] getList(String nsarg)
- throws Exception
- {
- Debug.message("SVR: DoPrinterUtil.getList()");
-
- int i = 0;
- int j = 0;
- int listi = 0;
-
- String cmd = null;
- String printername = "";
- String printserver = "";
- String comment = "";
- String nameservice;
- String list[];
-
- String o = null;
- cmd = "/usr/bin/lpget -n " + nsarg + " list";
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- String errstr = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(errstr);
- }
- o = syscmd.getOutput();
- syscmd = null;
-
- if (o == null) {
- return (null);
- }
-
- // Count entries
- int index = 0;
- while ((index = o.indexOf("bsdaddr=", index)) != -1) {
- index = index + 8;
- i++;
- }
- if (i <= 0)
- return (null);
-
- list = new String [i*3];
-
- int colon = 0;
- int nextcolon = 0;
- while ((colon = o.indexOf(":\n", colon + 1)) != -1) {
- nextcolon = o.indexOf(":\n", colon + 1);
- if (nextcolon == -1)
- nextcolon = o.length();
- // Extract printername
- i = colon;
- while ((o.charAt(i) != '\n') && (i != 0)) {
- i--;
- }
- if (i == 0)
- printername = o.substring(i, colon);
- else
- printername = o.substring(i + 1, colon);
-
- // Skip _all and _default keywords
- if (printername.equals("_all")) {
- continue;
- }
- if (printername.equals("_default")) {
- continue;
- }
-
- // Extract servername
- i = o.indexOf("bsdaddr=", colon);
- if ((i != -1) && (i < nextcolon)) {
- j = o.indexOf(",", i);
- if (j != -1)
- printserver = o.substring(i + 8, j);
- }
- // Skip entries without a server.
- if (printserver.equals("")) {
- Debug.warning(
- "SVR: printer does not have a server: "
- + printername);
- continue;
- }
-
- // Extract description
- i = o.indexOf("description=", colon);
- if ((i != -1) && (i < nextcolon)) {
- j = i;
- while (j < o.length()) {
- if (o.charAt(j) == '\n')
- break;
- j++;
- }
- comment = o.substring(i + 12, j);
- }
-
- list[listi++] = printername;
- list[listi++] = printserver;
- list[listi++] = comment;
- printername = "";
- printserver = "";
- comment = "";
- }
- return (list);
- }
-
- public static boolean exists(
- String name,
- String ns) throws Exception
- {
- int exitvalue;
-
- Debug.message("SVR: DoPrinterUtil.exists() " + ns);
-
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/lpget -n " + ns + " " + name);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
- if (exitvalue == 0) {
- return (true);
- }
- return (false);
- }
-
- public static boolean isLocal(
- String pn) throws Exception
- {
- int exitvalue;
-
- Debug.message("SVR: DoPrinterUtil.isLocal()");
-
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/test -d /etc/lp/printers/" + pn);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
- if (exitvalue != 0) {
- return (false);
- }
- return (true);
- }
-
- public static boolean isLocalhost(
- String queue) throws Exception
- {
- int exitvalue;
- String o = null;
-
- Debug.message("SVR: DoPrinterUtil.isLocalhost():queue " + queue);
-
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/grep " + queue + " /etc/printers.conf");
- exitvalue = syscmd.getExitValue();
- if (exitvalue != 0) {
- Debug.message(
- "SVR:DoPrinterUtil:isLocalhost:failed:queue: " + queue);
- return (false);
- }
- o = syscmd.getOutput();
- syscmd = null;
- Debug.message("SVR:DoPrinterUtil.java:isLocalhost: output: " + o);
- if (o.indexOf("localhost") != -1)
- return (true);
- else
- return (false);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterView.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterView.java
deleted file mode 100644
index d3446bb6bd..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/DoPrinterView.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- *
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * DoPrinterView class
- * Worker class for gathering printer information.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-import java.util.*;
-
-import com.sun.admin.pm.client.pmNeedPPDCacheException;
-import com.sun.admin.pm.client.pmCacheMissingPPDException;
-// import com.sun.admin.pm.client.pmGuiException;
-
-public class DoPrinterView {
-
- public static void main(String[] args) {
- Debug.setDebugLevel(Debug.ALL);
-
- Printer p = new Printer();
- p.setPrinterName("petite");
- NameService ns = new NameService();
-
- try {
- view(p, ns);
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- PrinterDebug.printObj(p);
-
- System.out.println("Commands:\n" + p.getCmdLog());
- System.out.println("Errors:\n" + p.getErrorLog());
- System.out.println("Warnings:\n" + p.getWarnLog());
- System.exit(0);
- }
-
- //
- // Interface to Printer object.
- //
- public static void view(
- Printer p,
- NameService ns) throws Exception
- {
- boolean islocal =
- DoPrinterUtil.isLocal(p.getPrinterName());
- if (islocal) {
- viewLocal(p, ns);
- } else {
- viewRemote(p, ns);
- }
-
- return;
- }
-
- //
- // Do the work getting Remote printer attributes.
- //
- private static void viewRemote(
- Printer p,
- NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterView.viewRemote()");
-
- int exitvalue = 0;
- int i, j;
- String o = null;
- String printername = p.getPrinterName();
- String printserver = null;
- String comment = null;
- String extensions = null;
- boolean default_printer = false;
-
- String nsarg = ns.getNameService();
-
- String err = null;
-
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/lpget -n " + nsarg + " " +
- printername, "LC_ALL=C");
-
- if (syscmd.getExitValue() != 0) {
- err = syscmd.getError();
- p.setErrorLog(err);
- // Add stdout since thats where lpget sends errors.
- err = syscmd.getOutput();
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- }
- o = syscmd.getOutput();
- syscmd = null;
-
- if (o == null) {
- throw new pmCmdFailedException(err);
- }
- // For easier parsing.
- o = o.concat("\n");
-
- i = o.indexOf("bsdaddr=");
- if (i == -1) {
- Debug.message("SVR: Can't parse bsdaddr for " + printername);
- throw new pmException();
- }
- i = i + 8;
- j = o.indexOf(",", i);
- if (j == -1) {
- Debug.message("SVR: Can't parse bsdaddr for " + printername);
- throw new pmException();
- }
- printserver = o.substring(i, j);
-
- i = o.indexOf(",Solaris");
- if (i != -1) {
- extensions = "Solaris";
- }
-
- i = o.indexOf("description=");
- if (i != -1) {
- i = i + 12;
- j = o.indexOf("\n", i);
- if (j != -1) {
- comment = o.substring(i, j);
- }
- }
-
- String def = DoPrinterUtil.getDefault(nsarg);
- if ((def != null) && (def.equals(printername))) {
- default_printer = true;
- }
- p.setPrintServer(printserver);
- p.setExtensions(extensions);
- p.setComment(comment);
- p.setIsDefaultPrinter(default_printer);
- return;
- }
-
- //
- // Do the work getting printer attributes.
- //
- private static void viewLocal(
- Printer p, NameService ns) throws Exception
- {
- Debug.message("SVR: DoPrinterView.viewLocal()");
-
- int i = -1;
- int exitvalue = 0;
- String str = null;
- String o = null;
-
- String printername = p.getPrinterName();
- String printertype = null;
- String printserver = null;
- String comment = null;
- String device = null;
- String make = null;
- String model = null;
- String ppd = null;
- String notify = null;
- String protocol = null;
- String destination = null;
- String extensions = "Solaris";
- String[] file_contents = null;
- String[] user_allow_list = null;
- String[] user_deny_list = null;
- boolean default_printer = false;
- String banner = null;
- boolean enable = false;
- boolean accept = false;
-
- String ppdfile = null;
-
- String def = DoPrinterUtil.getDefault("system");
- if ((def != null) && (def.equals(printername))) {
- default_printer = true;
- }
-
- //
- // Parse lpstat output
- //
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/lpstat -L -l -a " +
- printername + " -p " + printername, "LC_ALL=C");
-
- if (syscmd.getExitValue() != 0) {
- String err = syscmd.getError();
- p.setErrorLog(err);
- syscmd = null;
- throw new pmCmdFailedException(err);
- }
-
- o = syscmd.getOutput();
- syscmd = null;
-
- // Append a newline to make parsing easier.
- o = o.concat("\n");
-
- comment = getToken(o, "\tDescription:");
- if (comment == null || comment.equals("")) {
- comment = null;
- }
-
- // Get the PPD path/filename from lpstat
- // Get the make/model/ppd nickname using ppd-filename
- ppdfile = getToken(o, "\tPPD:");
- if ((ppdfile == null) || (ppdfile.equals("none")) ||
- (ppdfile.equals(""))) {
- ppdfile = null;
- } else {
- // Set the make/model/ppd
-
- if (!pmMisc.isppdCachefile()) {
- throw new pmNeedPPDCacheException("ppdcache missing");
- }
- String ret[];
- ret = new String[3];
- ret = DoPrinterUtil.getMakeModelNick(ppdfile);
-
- if ((ret != null) && (!ret.equals(""))) {
- make = ret[0];
- model = ret[1];
- ppd = ret[2];
- } else {
- throw new pmCacheMissingPPDException(
- "PPD file not in cache");
- }
- }
-
- int j = -1;
- printserver = p.getPrintServer();
-
- printertype = getToken(o, "Printer types:");
- i = o.indexOf("enabled since");
- if (i != -1) {
- enable = true;
- }
- i = o.indexOf("not accepting requests");
- if (i == -1) {
- accept = true;
- }
-
- i = o.indexOf("Banner not required");
- if (i != -1) {
- banner = "optional";
- }
- i = o.indexOf("Banner required");
- if (i != -1) {
- banner = "always";
- }
- i = o.indexOf("Banner page never printed");
- if (i != -1) {
- banner = "never";
- }
-
-
-
- // If we have Options then look for destination and protocol.
- protocol = "bsd";
- str = "Options:";
- i = o.indexOf(str);
- if (i != -1) {
- // Set str to the substring containing only the options line.
- j = o.indexOf("\n", i);
- str = o.substring(i, j);
-
- // Append a comma to make parsing easier.
- str = str.concat(",");
- i = str.indexOf("dest=");
- if (i != -1) {
- i += 5;
- j = str.indexOf(",", i);
- destination = str.substring(i, j);
- destination = destination.trim();
- }
- i = str.indexOf("protocol=");
- if (i != -1) {
- i += 9;
- j = str.indexOf(",", i);
- protocol = str.substring(i, j);
- protocol = protocol.trim();
- }
- }
-
- StringTokenizer st;
-
- // Build array of content types.
- str = getToken(o, "Content types:");
- if (str != null) {
- str = str.replace(',', ' ');
- st = new StringTokenizer(str);
- if (st.countTokens() != 0) {
- file_contents = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- file_contents[i] = st.nextToken();
- }
- }
- }
-
- //
- // User allow list.
- //
- str = "Users allowed:\n";
- i = o.indexOf(str);
- if (i != -1) {
- i += str.length();
- // Grab the substring containing only users.
- j = o.indexOf("\tForms");
- if (j != -1) {
- str = o.substring(i, j);
- st = new StringTokenizer(str);
- if (st.countTokens() != 0) {
- user_allow_list = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- user_allow_list[i] = st.nextToken();
- }
- }
- }
- }
- if (user_allow_list == null) {
- } else if (user_allow_list[0].equals("(all)")) {
- user_allow_list[0] = "all";
- } else if (user_allow_list[0].equals("(none)")) {
- user_allow_list[0] = "none";
- }
- //
- // User deny list
- //
- syscmd = new SysCommand();
- String cmd = "/bin/cat /etc/lp/printers/" + printername + "/users.deny";
- syscmd.exec(cmd);
- if (syscmd.getExitValue() == 0) {
- str = syscmd.getOutput();
- if ((str != null) && (str.length() != 0)) {
- st = new StringTokenizer(str);
- if (st.countTokens() != 0) {
- user_deny_list = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- user_deny_list[i] = st.nextToken();
- }
- }
- }
- }
- syscmd = null;
-
- //
- // Get fault action
- //
- str = getToken(o, "On fault:");
- if (str != null) {
- if (!str.equals("")) {
- if (str.indexOf("write") != -1) {
- notify = "write";
- } else if (str.indexOf("mail") != -1) {
- notify = "mail";
- } else if (str.indexOf("no alert") != -1) {
- notify = "none";
- } else if (str.indexOf("alert with") != -1) {
- i = str.indexOf("\"");
- if (i != -1) {
- j = str.lastIndexOf("\"");
- if (j > i) {
- notify = str.substring(++i, j);
- }
- }
- } else if (str.indexOf(" quiet ") != -1) {
- notify = "quiet";
- } else {
- notify = "unknown";
- }
- }
- }
- syscmd = null;
- //
- // Get the printers device
- //
- syscmd = new SysCommand();
- syscmd.exec("/usr/bin/lpstat -L -v " + printername,
- "LC_ALL=C");
-
- o = syscmd.getOutput();
- if (o != null) {
- o = o.concat("\n");
- device = getToken(o, ":");
- }
-
- Debug.message("SVR: DEVICE (" + device + ")");
- //
- // If the device is in URI form (scheme:// ...), set the protocol
- // for the "network attached" modify screen.
- //
- if (device != null && device.indexOf("://") != -1) {
- protocol = "uri";
- destination = device;
- device = null;
- }
-
- syscmd = null;
-
- p.setPrinterType(printertype);
- p.setPrintServer(printserver);
- p.setFileContents(file_contents);
- p.setComment(comment);
- p.setDevice(device);
- p.setMake(make);
- p.setModel(model);
- p.setPPD(ppd);
- p.setPPDFile(ppdfile);
- p.setNotify(notify);
- p.setProtocol(protocol);
- p.setDestination(destination);
- p.setExtensions(extensions);
- p.setIsDefaultPrinter(default_printer);
- p.setBanner(banner);
- p.setEnable(enable);
- p.setAccept(accept);
- p.setUserAllowList(user_allow_list);
- p.setUserDenyList(user_deny_list);
-
- if (ns.getNameService().equals("system"))
- return;
- Debug.message(
- "SVR: Overlaying name service attributes on local printer");
- try {
- viewRemote(p, ns);
- }
- catch (Exception e)
- {
- Debug.warning(
- "SVR: Overlay of name service attributes failed.");
- Debug.warning("SVR: " + e.getMessage());
- }
- return;
- }
-
- //
- // Return substring starting at sub + 1 and ending with
- // a newline.
- //
- public static String getToken(String str, String sub)
- {
- int i = -1;
- int j = -1;
- String result = null;
-
- i = str.indexOf(sub);
- if (i != -1) {
- if (str.charAt(i + sub.length()) == '\n') {
- return (null);
- }
- i = i + sub.length();
- j = str.indexOf("\n", i);
- if (j != -1) {
- result = str.substring(i, j);
- result = result.trim();
- }
- }
- return (result);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Host.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Host.java
deleted file mode 100644
index 330d990b7b..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Host.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Host class
- * Methods associated with a host.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-
-public class Host
-{
- public static void main(String[] args)
- {
- try {
- System.out.println(getLocalHostName());
- System.out.println(getDomainName());
- System.out.println(getNisHost("master"));
- }
- catch (Exception e) {
- System.out.println(e);
- }
- System.exit(0);
- }
-
- //
- // Get the local hostname
- // Return an empty string if we don't find one.
- //
- public synchronized static String getLocalHostName()
- throws Exception
- {
- Debug.message("SVR: Host.getLocalHostName()");
-
- String cmd = "/usr/bin/hostname";
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
-
- if (syscmd.getExitValue() != 0) {
- String err = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(err);
- }
- String o = syscmd.getOutput();
- syscmd = null;
-
- if (o == null)
- return (new String(""));
- return (new String(o));
- }
-
- //
- // Get the domainname
- // Return an empty string if we don't find one.
- //
- public synchronized static String getDomainName()
- throws Exception
- {
- Debug.message("SVR: Host.getDomainName()");
-
- String cmd = "/usr/bin/domainname";
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- String err = syscmd.getError();
- syscmd = null;
- throw new pmCmdFailedException(err);
- }
-
- String o = syscmd.getOutput();
- syscmd = null;
-
- if (o == null)
- return (new String(""));
- return (new String(o));
- }
-
- public synchronized static void pingHost(String host)
- throws Exception
- {
- int exitvalue;
-
- Debug.message("SVR: Host.pingHost()");
-
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/sbin/ping " + host);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
-
- if (exitvalue != 0) {
- String err = syscmd.getError();
- throw new pmHostNotPingableException(err);
- }
- }
-
- public synchronized static String getNisMaster()
- throws Exception
- {
- return (getNisHost("master"));
- }
-
- //
- // Look for the nis server.
- // If we are looking for the master server first try
- // the printers.conf.byname map. If that fails
- // look for passwd.
- //
- public synchronized static String getNisHost(String type)
- throws Exception
- {
- Debug.message("SVR: Host.getNisHost() " + type);
-
- SysCommand syscmd = null;
- String cmd = null;
- int exitvalue = 0;
-
- if (type.equals("master")) {
- cmd = "/usr/bin/ypwhich -m printers.conf.byname";
- } else {
- cmd = "/usr/bin/ypwhich";
- }
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- exitvalue = syscmd.getExitValue();
- if ((exitvalue != 0) && (type.equals("master"))) {
- Debug.message("SVR: printers.conf NIS host not found.");
- Debug.message("SVR: Looking for NIS passwd host.");
- cmd = "/usr/bin/ypwhich -m passwd";
-
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- exitvalue = syscmd.getExitValue();
- }
- if (exitvalue != 0) {
- Debug.error("SVR: NIS server could not be found");
- String err = syscmd.getError();
- syscmd = null;
- throw new pmNSNotConfiguredException(err);
- }
-
- String o = syscmd.getOutput();
- syscmd = null;
-
- if (o == null) {
- throw new pmCmdFailedException(syscmd.getError());
- }
- o = o.trim();
- return (new String(o));
- }
-
- /*
- * Return the name of the first server listed by ldapclient
- */
- public synchronized static String getLDAPMaster()
- throws Exception
- {
- SysCommand syscmd = null;
- String cmd = null;
- int exitvalue = 0;
-
- /* ldapclient will hang if we are not root. */
- if (!DoPrinterNS.isRoot()) {
- Debug.error("SVR: Not root. Can't determine LDAP master.");
- return null;
- }
-
- cmd = "/usr/sbin/ldapclient list";
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- exitvalue = syscmd.getExitValue();
-
- if (exitvalue != 0) {
- Debug.error("SVR: ldapclient failed.");
- Debug.error("SVR: " + syscmd.getError());
- syscmd = null;
- return null;
- }
- String o = syscmd.getOutput();
- syscmd = null;
-
- String master = DoPrinterView.getToken(o + "\n", "NS_LDAP_SERVERS=");
- if (master == null) {
- Debug.error("SVR: ldapclient did not return NS_LDAP_SERVERS.");
- syscmd = null;
- return null;
- }
-
- /* Extract the first address from the NS_LDAP_SERVERS list */
-
- for (int i = 0; i < master.length(); i++) {
- if ((master.charAt(i) == ',') ||
- (master.charAt(i) == ' ') ||
- (master.charAt(i) == '\t')) {
- master = master.substring(0, i);
- break;
- }
- }
- master = master.trim();
-
- return (new String(master));
- }
-
- /*
- * Get a default admin DN.
- */
- public synchronized static String getDefaultAdminDN()
- throws Exception
- {
- SysCommand syscmd = null;
- String cmd = null;
- int exitvalue = 0;
-
- try {
- String master = getLDAPMaster();
- cmd = "/usr/bin/ldapsearch -h " + master +
- " -b o=NetScapeRoot o=NetscapeRoot";
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- exitvalue = syscmd.getExitValue();
- if (exitvalue == 0) {
- String on = syscmd.getOutput();
- syscmd = null;
- if (on != null) {
- if (on.indexOf("NetscapeRoot") != -1) {
- return ("cn=Directory Manager");
- }
- }
- }
- syscmd = null;
- }
- catch (Exception e) {
- Debug.message("SVR: ldapsearch for NSDS failed. Continuing");
- }
-
- cmd = "/usr/bin/ldaplist -d printers";
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- exitvalue = syscmd.getExitValue();
-
- if (exitvalue != 0) {
- Debug.error("SVR: ldaplist printers failed.");
- Debug.error("SVR: " + syscmd.getError());
- syscmd = null;
- return null;
- }
- String o = syscmd.getOutput();
- syscmd = null;
-
- if (o == null) {
- return null;
- }
-
- String dn = DoPrinterView.getToken(o + "\n", "ou=printers,");
- if (dn == null) {
- return null;
- }
- dn = "cn=admin," + dn;
- dn = dn.trim();
-
- return (new String(dn));
- }
-
- //
- // Check to see if a name service is configured
- //
- public synchronized static void isNSConfigured(String ns)
- throws Exception
- {
- Debug.message("SVR: Host.isNSConfigured() " + ns);
-
- int exitvalue;
- String cmd = null;
- String err = null;
- SysCommand syscmd = null;
-
- if (ns.equals("system")) {
- return;
- } else if (ns.equals("nis")) {
- cmd = "/usr/bin/ypwhich";
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- exitvalue = syscmd.getExitValue();
- err = syscmd.getError();
- syscmd = null;
-
- if (exitvalue != 0) {
- throw new pmNSNotConfiguredException(err);
- }
-
- cmd = "/usr/bin/ypcat cred";
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
- if (exitvalue == 0) {
- Debug.warning(
- "SVR: Unable to update this configuration.");
- throw new pmNSNotConfiguredException();
- }
- } else if (ns.equals("ldap")) {
- /*
- * Check if the ldap-client is configured by first checking
- * if the config file exists and then invoking ldaplist
- * Note: we need to check if the config file exists before
- * invoking ldaplist so that we don't get its error message
- */
-
- File ldapConfig = new File("/var/ldap/ldap_client_file");
- if (ldapConfig.isFile()) {
- // Config file exists
-
- cmd = "/usr/bin/ldaplist -d printers";
- syscmd = new SysCommand();
- syscmd.exec(cmd);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
-
- if (exitvalue != 0) {
- throw new pmNSNotConfiguredException();
- }
- } else {
- throw new pmNSNotConfiguredException();
- }
- } else {
- throw new pmInternalErrorException(
- "Unkown name service " + ns);
- }
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Makefile b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Makefile
deleted file mode 100644
index 690b18ccfa..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Makefile
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# Makefile for Java Print Manager server
-#
-
-LIBRARY = libpmgr.a
-VERS = .1
-
-JNIHDR_FILES = com_sun_admin_pm_server_DoPrinterNS.h
-
-OBJECTS = DoPrinterNS.o NS.o
-
-CLASSFILES = Printer.class \
- Host.class \
- SysCommand.class \
- NameService.class \
- PrinterUtil.class \
- DoPrinterView.class \
- DoPrinterAdd.class \
- DoPrinterDelete.class \
- DoPrinterUtil.class \
- DoPrinterMod.class \
- DoPrinterNS.class \
- Valid.class \
- Test.class \
- Debug.class \
- PrinterDebug.class \
- pmException.class \
- pmAuthException.class \
- pmAuthRhostException.class \
- pmCmdFailedException.class \
- pmInternalErrorException.class \
- pmHostNotPingableException.class \
- pmNSNotConfiguredException.class \
- pmMisc.class
-
-JNICLASSFILES = DoPrinterNS.class
-
-include $(SRC)/lib/Makefile.lib
-
-SRCDIR = .
-
-# There should be a mapfile here
-MAPFILES =
-
-CLASSPATH= $(SRC)/cmd/print/printmgr
-
-JAVAFILES = $(CLASSFILES:.class=.java)
-
-ROOTDIRS = $(ROOT)/usr/sadm/admin \
- $(ROOT)/usr/sadm/admin/printmgr \
- $(ROOT)/usr/sadm/admin/printmgr/lib
-
-# override ROOTLIBDIR and ROOTLINKS
-ROOTLIBDIR = $(ROOT)/usr/sadm/admin/printmgr/lib
-ROOTLIBS= $(LIBS:%=$(ROOTLIBDIR)/%)
-
-
-# Following variables define where to find header files
-CPPFLAGS += -I$(JAVA_ROOT)/include -I$(JAVA_ROOT)/include/solaris -I.
-
-CERRWARN += -_gcc=-Wno-unused-variable
-CERRWARN += -_gcc=-Wno-uninitialized
-
-LDLIBS += -lprint -lnsl -lsocket -lc
-
-CLEANFILES= *.class $(LINTLIB) $(LINTOUT)
-CLOBBERFILES= $(JNIHDR_FILES) $(LIBLINKS)
-
-all: $(CLASSFILES) $(JNIHDR_FILES) $(DYNLIB)
-
-install: all $(ROOTDIRS) $(ROOTLINKS)
-
-#
-# Build jni header file
-# Use $@ instead of the "unreliable" $*
-#
-$(JNIHDR_FILES): $(JNICLASSFILES)
- $(JAVAH) -jni -classpath $(CLASSPATH) \
- `echo $@ | sed 's/.h$$//' | tr _ .`
-
-#
-# Build standalone programs for testing
-#
-NS: NS.c
- $(CC) NS.c -g $(ILDOFF) -o NS -DMAIN=1 $(ENVLDLIBS1) $(ENVLIBS2) \
- -lprint -lnsl -lsocket
-
-lint: $(JNIHDR_FILES) lintcheck
-
-cstyle:
- cstyle $(SRCS)
-
-jstyle:
- jstyle $(JAVAFILES)
-
-_msg:
-
-$(ROOTDIRS):
- $(INS.dir)
-
-include $(SRC)/lib/Makefile.targ
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/NS.c b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/NS.c
deleted file mode 100644
index eeeefdd31c..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/NS.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-#pragma ident "%Z%%M% %I% %E% SMI"
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <rpcsvc/ypclnt.h>
-
-char glob_stdout[BUFSIZ];
-char glob_stderr[BUFSIZ];
-
-void f_cleanup(FILE *fp, char *tmpf);
-void fd_cleanup(int fd1, int fd2);
-static void _freeList(char ***list);
-
-extern void **list_append(void **list, void *item);
-
-#ifdef MAIN
-
-#define THOSTNAME "cherwell"
-#define TPRINTERNAME "c"
-
-int
-main() {
- char *host = THOSTNAME;
- const char *user = "cn=Directory Manager";
- const char *passwd = "directorymanager";
- int result = 0;
-
- result = _updateldap("add", host, user, passwd,
- "_pmTestAuthToken", NULL, NULL, "new comment", "false");
- if (result != 0) {
- printf("Add 1 failed, err code = %d\n");
- }
-
- result = _updateldap("delete", host, user, passwd,
- "_pmTestAuthToken", NULL, NULL, NULL, "false");
- if (result != 0) {
- printf("Delete 1 failed, err code = %d\n");
- }
-
- result = _updateldap("delete", host, user, passwd, TPRINTERNAME,
- THOSTNAME, "", "new comment", "true");
- if (result != 0) {
- printf("delete failed, err code = %d\n");
- }
-
- result = _updateldap("delete", host, user, passwd, "_default",
- THOSTNAME, "", "new comment", "true");
- if (result != 0) {
- printf("delete failed, err code = %d\n");
- }
-
- result = _updateldap("add", host, user, passwd, TPRINTERNAME,
- THOSTNAME, "Solaris", "new comment", "true");
- if (result != 0) {
- printf("add failed, err code = %d\n");
- }
-
- result = _updateldap("modify", host, user, passwd, TPRINTERNAME,
- THOSTNAME, "", "modified comment", "true");
- if (result != 0) {
- printf("modify failed, err code = %d\n");
- }
-
- result = _updateldap("modify", host, user, passwd, TPRINTERNAME,
- THOSTNAME, "", NULL, "false");
- if (result != 0) {
- printf("modify failed, err code = %d\n");
- }
-
-
- exit(0);
-}
-#endif
-
-
-int
-_dorexec(
- const char *host,
- const char *user,
- const char *passwd,
- const char *cmd,
- const char *locale) {
-
- int ret = 0;
- int fd = 0;
- int fd2 = 1;
-
- FILE *fderr;
- char *ferr;
-
- (void) memset(glob_stdout, 0, BUFSIZ);
- (void) memset(glob_stderr, 0, BUFSIZ);
-
- /*
- * Re-direct stderr to a file
- */
- ferr = tempnam(NULL, NULL);
- if (ferr != NULL) {
- fderr = freopen(ferr, "w+", stderr);
- }
-
- fd = rexec((char **)&host, htons(512), user,
- passwd, cmd, &fd2);
-
- if (fd > -1) {
- /*
- * rexec worked. Clean up stderr file.
- */
- f_cleanup(fderr, ferr);
-
- ret = read(fd, glob_stdout, BUFSIZ - 1);
- if (ret < 0) {
- (void) strncpy(glob_stderr, strerror(errno),
- (BUFSIZ - 1));
- fd_cleanup(fd, fd2);
- return (errno);
- }
-
- ret = read(fd2, glob_stderr, BUFSIZ - 1);
- if (ret < 0) {
- (void) strncpy(glob_stderr, strerror(errno),
- (BUFSIZ - 1));
- fd_cleanup(fd, fd2);
- return (errno);
- }
- } else {
- /*
- * rexec failed. Read from the stderr file.
- */
- if (fderr != NULL) {
- char tmpbuf[BUFSIZ];
-
- (void) rewind(fderr);
- strcpy(glob_stderr, "");
- while (fgets(tmpbuf, BUFSIZ - 1,
- fderr) != NULL) {
- if ((strlen(glob_stderr) +
- strlen(tmpbuf)) > BUFSIZ - 1) {
- break;
- } else {
- (void) strcat(glob_stderr, tmpbuf);
- }
- }
- }
- f_cleanup(fderr, ferr);
- fd_cleanup(fd, fd2);
- return (1);
- }
- fd_cleanup(fd, fd2);
- return (0);
-}
-
-void
-fd_cleanup(int fd, int fd2)
-{
- if (fd > 0) {
- (void) close(fd);
- }
- if (fd2 > 0) {
- (void) close(fd2);
- }
-}
-
-void
-f_cleanup(FILE *fp, char *tmpf)
-{
- if (fp != NULL) {
- (void) fclose(fp);
- }
- if (tmpf != NULL) {
- (void) unlink(tmpf);
- (void) free(tmpf);
- }
-}
-
-struct ns_bsd_addr {
- char *server; /* server name */
- char *printer; /* printer name or NULL */
- char *extension; /* RFC-1179 conformance */
- char *pname; /* Local printer name */
-};
-typedef struct ns_bsd_addr ns_bsd_addr_t;
-
-/* Key/Value pair structure */
-struct ns_kvp {
- char *key; /* key */
- void *value; /* value converted */
-};
-typedef struct ns_kvp ns_kvp_t;
-
-/*
- * Information needed to update a name service.
- * Currently only used for ldap. (see lib/print/ns.h)
- */
-
-/* LDAP bind password security type */
-
-typedef enum NS_PASSWD_TYPE {
- NS_PW_INSECURE = 0,
- NS_PW_SECURE = 1
-} NS_PASSWD_TYPE;
-
-
-struct ns_cred {
- char *binddn;
- char *passwd;
- char *host;
- int port; /* LDAP port, 0 = default */
- NS_PASSWD_TYPE passwdType; /* password security type */
- uchar_t *domainDN; /* NS domain DN */
-};
-typedef struct ns_cred ns_cred_t;
-
-/* LDAP specific NS Data */
-
-typedef struct NS_LDAPDATA {
- char **attrList; /* list of user defined Key Value Pairs */
-} NS_LDAPDATA;
-
-/* Printer Object structure */
-struct ns_printer {
- char *name; /* primary name of printer */
- char **aliases; /* aliases for printer */
- char *source; /* name service derived from */
- ns_kvp_t **attributes; /* key/value pairs. */
- ns_cred_t *cred; /* info to update name service */
- void *nsdata; /* name service specific data */
-};
-typedef struct ns_printer ns_printer_t;
-
-extern ns_printer_t *ns_printer_get_name(const char *, const char *);
-extern int ns_printer_put(const ns_printer_t *);
-extern char *ns_get_value_string(const char *, const ns_printer_t *);
-extern int ns_set_value(const char *, const void *, ns_printer_t *);
-extern int ns_set_value_from_string(const char *, const char *,
- ns_printer_t *);
-extern ns_bsd_addr_t *bsd_addr_create(const char *, const char *,
- const char *);
-extern char *bsd_addr_to_string(const ns_bsd_addr_t *);
-extern void ns_printer_destroy(ns_printer_t *);
-
-int
-_updateoldyp(
- const char *action,
- const char *printername,
- const char *printserver,
- const char *extensions,
- const char *comment,
- const char *isdefault) {
-
- ns_printer_t *printer;
- ns_bsd_addr_t *addr;
- int status = 0;
-
- char mkcmd[BUFSIZ];
- char *domain = NULL;
- char *host = NULL;
-
- /*
- * libprint returns before we know that the printers.conf
- * map is made. So we'll make it again.
- */
- (void) yp_get_default_domain(&domain);
-
- if ((yp_master(domain, "printers.conf.byname", &host) != 0) &&
- (yp_master(domain, "passwd.byname", &host) != 0)) {
- strcpy(mkcmd, "/usr/bin/sleep 1");
- } else {
- sprintf(mkcmd, "/usr/bin/rsh -n %s 'cd /var/yp; "
- "/usr/ccs/bin/make -f /var/yp/Makefile "
- "-f /var/yp/Makefile.print printers.conf "
- "> /dev/null'", host);
- }
-
- if (strcmp(action, "delete") == 0) {
- if ((printer = (ns_printer_t *)
- ns_printer_get_name(printername, "nis")) == NULL) {
- return (0);
- }
-
- printer->attributes = NULL;
- status = ns_printer_put(printer);
- if (status != 0) {
- (void) free(printer);
- return (status);
- }
-
- if ((printer = (ns_printer_t *)
- ns_printer_get_name("_default", "nis")) != NULL) {
- char *dflt = (char *)
- ns_get_value_string("use", printer);
- if ((dflt != NULL) &&
- (strcmp(dflt, printername) == 0)) {
- printer->attributes = NULL;
- status = ns_printer_put(printer);
- if (status != 0) {
- (void) free(printer);
- return (status);
- }
- }
- }
- (void) free(printer);
- (void) system(mkcmd);
- return (0);
-
- } else if (strcmp(action, "add") == 0) {
- printer = (ns_printer_t *)malloc(sizeof (*printer));
- memset(printer, 0, sizeof (*printer));
- printer->name = (char *)printername;
- printer->source = "nis";
-
- addr = (ns_bsd_addr_t *)malloc(sizeof (*addr));
- memset(addr, 0, sizeof (*addr));
- addr->printer = (char *)printername;
- addr->server = (char *)printserver;
- if ((extensions != NULL) &&
- (strlen(extensions) > 0)) {
- addr->extension = (char *)extensions;
- }
- ns_set_value("bsdaddr", addr, printer);
-
- if ((comment != NULL) && (strlen(comment) > 0)) {
- ns_set_value_from_string("description",
- comment, printer);
- }
- status = ns_printer_put(printer);
- if (status != 0) {
- (void) free(addr);
- (void) free(printer);
- return (status);
- }
-
- if (strcmp(isdefault, "true") == 0) {
- printer->name = "_default";
- printer->attributes = NULL;
- ns_set_value_from_string("use", printername, printer);
- status = ns_printer_put(printer);
- if (status != 0) {
- (void) free(addr);
- (void) free(printer);
- return (status);
- }
- }
- (void) free(addr);
- (void) free(printer);
- (void) system(mkcmd);
- return (0);
- }
-
- /*
- * Modify
- */
- if ((printer = (ns_printer_t *)
- ns_printer_get_name(printername, "nis")) == NULL) {
- return (1);
- }
- if ((comment != NULL) && (strlen(comment) > 0)) {
- ns_set_value_from_string("description", comment, printer);
- } else {
- ns_set_value_from_string("description",
- NULL, printer);
- }
- status = ns_printer_put(printer);
- if (status != 0) {
- (void) free(printer);
- return (status);
- }
-
- if ((printer = (ns_printer_t *)
- ns_printer_get_name("_default", "nis")) != NULL) {
- char *dflt = (char *)ns_get_value_string("use", printer);
- if (strcmp(printername, dflt) == 0) {
- if (strcmp(isdefault, "false") == 0) {
- /*
- * We were the default printer but not
- * any more.
- */
- printer->attributes = NULL;
- status = ns_printer_put(printer);
- if (status != 0) {
- (void) free(printer);
- return (status);
- }
- }
- } else {
- if (strcmp(isdefault, "true") == 0) {
- ns_set_value_from_string("use",
- printername, printer);
- status = ns_printer_put(printer);
- if (status != 0) {
- (void) free(printer);
- return (status);
- }
- }
- }
- } else {
- printer = (ns_printer_t *)malloc(sizeof (*printer));
- memset(printer, 0, sizeof (*printer));
- printer->name = "_default";
- printer->source = "nis";
- ns_set_value_from_string("use", printername, printer);
- status = ns_printer_put(printer);
- if (status != 0) {
- (void) free(printer);
- return (status);
- }
- }
- (void) system(mkcmd);
- return (0);
-}
-
-int
-_updateldap(
- const char *action,
- const char *host,
- const char *binddn,
- const char *passwd,
- const char *printername,
- const char *printserver,
- const char *extensions,
- const char *comment,
- const char *isdefault)
-
-{
- ns_printer_t *printer;
- ns_bsd_addr_t *addr;
- ns_cred_t *cred;
-
- char *item = NULL;
- char **attrList = NULL;
-
- int status;
-
- if (printserver == NULL) {
- /* printserver not given so use host */
- printserver = host;
- }
-
- cred = (ns_cred_t *)malloc(sizeof (*cred));
- (void) memset(cred, '\0', sizeof (*cred));
- cred->passwd = strdup((char *)passwd);
- cred->binddn = strdup((char *)binddn);
- cred->host = strdup((char *)host);
-
- cred->passwdType = NS_PW_INSECURE; /* use default */
- cred->port = 0; /* use default */
- cred->domainDN = NULL; /* use default */
-
- if (strcmp(action, "delete") == 0) {
- /*
- * Delete printer object from LDAP directory DIT
- */
-
- if ((printer = (ns_printer_t *)
- ns_printer_get_name(printername, "ldap")) == NULL) {
- return (0);
- }
-
- printer->attributes = NULL;
- printer->nsdata = malloc(sizeof (NS_LDAPDATA));
- if (printer->nsdata == NULL) {
- return (1);
- }
- ((NS_LDAPDATA *)(printer->nsdata))->attrList = NULL;
- printer->cred = cred;
- printer->source = strdup("ldap");
- status = ns_printer_put(printer);
- free(printer->nsdata);
- (void) ns_printer_destroy(printer);
-
- if (status != 0) {
- return (status);
- }
-
- if ((printer = (ns_printer_t *)
- ns_printer_get_name("_default", "ldap")) != NULL) {
- char *dflt = (char *)
- ns_get_value_string("use", printer);
- if ((dflt != NULL) &&
- (strcmp(dflt, printername) == 0)) {
- printer->attributes = NULL;
- printer->nsdata = malloc(sizeof (NS_LDAPDATA));
- if (printer->nsdata == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- ((NS_LDAPDATA *)(printer->nsdata))->attrList = NULL;
- printer->cred = cred;
- printer->source = strdup("ldap");
- status = ns_printer_put(printer);
- free(printer->nsdata);
- if (status != 0) {
- (void) ns_printer_destroy(printer);
- return (status);
- }
- }
-
- (void) ns_printer_destroy(printer);
- }
- return (0);
-
- } else if (strcmp(action, "add") == 0) {
- /*
- * Add new printer object into LDAP directory DIT
- */
-
- printer = (ns_printer_t *)malloc(sizeof (*printer));
- if (printer == NULL) {
- return (1);
- }
- (void) memset(printer, 0, sizeof (*printer));
- printer->name = strdup((char *)printername);
- printer->source = strdup("ldap");
-
- printer->cred = cred;
-
- /* set BSD address in attribute list */
-
- if (extensions == NULL) {
- item = (char *)malloc(strlen("bsdaddr") +
- strlen(printserver) +
- strlen(printername) +
- strlen("Solaris") + 6);
- } else {
- item = (char *)malloc(strlen("bsdaddr") +
- strlen(printserver) +
- strlen(printername) +
- strlen(extensions) + 6);
- }
- if (item == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
-
- if (extensions == NULL) {
- sprintf(item, "%s=%s,%s,%s", "bsdaddr",
- printserver, printername, "Solaris");
- } else {
- sprintf(item, "%s=%s,%s,%s", "bsdaddr",
- printserver, printername, extensions);
- }
-
- attrList = (char **)list_append((void**)attrList,
- (void *)item);
- if ((comment != NULL) && (strlen(comment) > 0)) {
- item = (char *)malloc(strlen("description") +
- strlen(comment) + 4);
- if (item == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- sprintf(item, "%s=%s", "description", comment);
- attrList = (char **)list_append((void**)attrList,
- (void *)item);
- }
-
- printer->attributes = NULL;
- printer->nsdata = malloc(sizeof (NS_LDAPDATA) + 2);
- if (printer->nsdata == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- ((NS_LDAPDATA *)(printer->nsdata))->attrList = attrList;
-
- status = ns_printer_put(printer);
- _freeList(&attrList);
- if (status != 0) {
- free(printer->nsdata);
- (void) ns_printer_destroy(printer);
- return (status);
- }
-
- if (strcmp(isdefault, "true") == 0) {
- (void) free(printer->name);
-
- printer->name = strdup("_default");
- printer->attributes = NULL;
-
- attrList = NULL;
- item = (char *)malloc(strlen("use") +
- strlen(printername) + 4);
- if (item == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- sprintf(item, "%s=%s", "use", printername);
- attrList = (char **)list_append((void**)attrList,
- (void *)item);
-
- ((NS_LDAPDATA *)(printer->nsdata))->attrList = attrList;
-
- status = ns_printer_put(printer);
- _freeList(&attrList);
- free(printer->nsdata);
- if (status != 0) {
- (void) ns_printer_destroy(printer);
- return (status);
- }
- }
- (void) ns_printer_destroy(printer);
- return (0);
- }
-
- /*
- * Modify printer object in the LDAP directory DIT
- */
-
- if ((printer = (ns_printer_t *)
- ns_printer_get_name(printername, "ldap")) == NULL) {
- return (1);
- }
- printer->cred = cred;
- printer->source = strdup("ldap");
-
- if ((comment != NULL) && (strlen(comment) > 0)) {
- item = (char *)malloc(strlen("description") +
- strlen(comment) + 4);
- if (item == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- sprintf(item, "%s=%s", "description", comment);
- attrList = (char **)list_append((void**)attrList, (void *)item);
- } else {
- item = (char *)malloc(strlen("description") + 4);
- if (item == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- sprintf(item, "%s=", "description");
- attrList = (char **)list_append((void**)attrList, (void *)item);
- }
-
- printer->attributes = NULL;
- printer->nsdata = malloc(sizeof (NS_LDAPDATA));
- if (printer->nsdata == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- ((NS_LDAPDATA *)(printer->nsdata))->attrList = attrList;
-
- status = ns_printer_put(printer);
- _freeList(&attrList);
- free(printer->nsdata);
- if (status != 0) {
- (void) ns_printer_destroy(printer);
- return (status);
- }
-
- /*
- * Handle the default printer.
- */
- if ((printer = (ns_printer_t *)
- ns_printer_get_name("_default", "ldap")) != NULL) {
- char *dflt = (char *)ns_get_value_string("use", printer);
-
- printer->source = strdup("ldap");
- printer->cred = cred;
- if (strcmp(printername, dflt) == 0) {
- if (strcmp(isdefault, "false") == 0) {
- /*
- * We were the default printer but not
- * any more. So delete the default entry
- */
- printer->attributes = NULL;
- printer->nsdata = malloc(sizeof (NS_LDAPDATA));
- if (printer->nsdata == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- ((NS_LDAPDATA *)(printer->nsdata))->attrList = NULL;
- status = ns_printer_put(printer);
- free(printer->nsdata);
- if (status != 0) {
- (void) ns_printer_destroy(printer);
- return (status);
- }
- }
- } else if (strcmp(isdefault, "true") == 0) {
- /*
- * Modify this default entry to use us.
- */
- printer->attributes = NULL;
- printer->nsdata = malloc(sizeof (NS_LDAPDATA));
- if (printer->nsdata == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- attrList = NULL;
- item = (char *)malloc(strlen("use") +
- strlen(printername) + 4);
- if (item == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- sprintf(item, "%s=%s", "use", printername);
- attrList = (char **)list_append((void**)attrList,
- (void *)item);
-
- ((NS_LDAPDATA *)(printer->nsdata))->attrList = attrList;
-
- status = ns_printer_put(printer);
- _freeList(&attrList);
- free(printer->nsdata);
-
- if (status != 0) {
- (void) ns_printer_destroy(printer);
- return (status);
- }
- }
- } else if (strcmp(isdefault, "true") == 0) {
- /*
- * No default entry existed and we need one.
- */
- printer = (ns_printer_t *)malloc(sizeof (*printer));
- (void) memset(printer, 0, sizeof (*printer));
- printer->name = strdup("_default");
- printer->source = strdup("ldap");
- printer->cred = cred;
-
- printer->nsdata = malloc(sizeof (NS_LDAPDATA));
- if (printer->nsdata == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
-
- attrList = NULL;
- item = (char *)malloc(strlen("use") + strlen(printername) + 4);
- if (item == NULL) {
- (void) ns_printer_destroy(printer);
- return (1);
- }
- sprintf(item, "%s=%s", "use", printername);
- attrList = (char **)list_append((void**)attrList, (void *)item);
-
- ((NS_LDAPDATA *)(printer->nsdata))->attrList = attrList;
-
- status = ns_printer_put(printer);
- _freeList(&attrList);
- free(printer->nsdata);
-
- if (status != 0) {
- (void) ns_printer_destroy(printer);
- return (status);
- }
- }
-
- (void) ns_printer_destroy(printer);
- return (0);
-}
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _freeList()
- *
- * Description: Free the list created by list_append() where the items in
- * the list have been strdup'ed.
- *
- * Parameters:
- * Input: char ***list - returned set of kvp values
- *
- * Result: void
- *
- * *****************************************************************************
- */
-
-static void
-_freeList(char ***list)
-
-{
- int i = 0;
-
- /* ------ */
-
- if (list != NULL) {
- if (*list != NULL) {
- for (i = 0; (*list)[i] != NULL; i++) {
- free((*list)[i]);
- }
- free(*list);
- }
-
- *list = NULL;
- }
-} /* _freeList */
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/NameService.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/NameService.java
deleted file mode 100644
index 8b3e874161..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/NameService.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * NameService class
- * Methods and state associated with a name service.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-
-public class NameService
-{
- private String nameservice = null;
- private String nshost = null;
- private String user = null;
- private String passwd = null;
- private boolean boundtonisslave = false;
- private boolean isauth = false;
-
- //
- // Constructors
- //
- // This constructor is used internally in the server package.
- public NameService()
- {
- nameservice = "system";
- isauth = true;
- }
- // This constructor should always be used by the client.
- public NameService(String nsname) throws Exception
- {
- if ((nsname.equals("system")) ||
- (nsname.equals("nis")) ||
- (nsname.equals("ldap"))) {
- nameservice = nsname;
- } else {
- throw new pmInternalErrorException(
- "Unknown name service: " + nsname);
- }
-
- Host h = new Host();
- h.isNSConfigured(nameservice);
-
- if (nsname.equals("nis")) {
- String nm = h.getNisHost("master");
- String nb = h.getNisHost("bound");
- if (!nm.equals(nb)) {
- boundtonisslave = true;
- }
- setUser("root");
- setNameServiceHost(nm);
- setPasswd("");
- } else if (nsname.equals("ldap")) {
- String master = h.getLDAPMaster();
- if (master == null) {
- setNameServiceHost("");
- } else {
- setNameServiceHost(master);
- }
-
- String admin = h.getDefaultAdminDN();
- if (admin == null) {
- setUser("");
- } else {
- setUser(admin);
- }
-
- setPasswd("");
- }
-
- }
-
- public void setNameServiceHost(String arg)
- {
- nshost = arg;
- }
- public void setUser(String arg)
- {
- user = arg;
- }
- public void setPasswd(String arg)
- {
- passwd = arg;
- }
-
- public String getNameService()
- {
- return (nameservice);
- }
- public String getNameServiceHost()
- {
- return (nshost);
- }
- public String getUser()
- {
- return (user);
- }
- public String getPasswd()
- {
- return (passwd);
- }
- public boolean getBoundToNisSlave()
- {
- return (boundtonisslave);
- }
- public boolean isAuth()
- {
- return (isauth);
- }
-
- public void checkAuth() throws Exception
- {
- Debug.message("SVR: NameService.checkAuth()");
-
- DoPrinterNS.doAuth(this);
- isauth = true;
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Printer.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Printer.java
deleted file mode 100644
index 1f75989a3c..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Printer.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Printer class
- * Printer object containing attributes and methods for
- * updating printers.
- */
-
-package com.sun.admin.pm.server;
-
-public class Printer
-{
- //
- // Printer object attributes
- //
- private String printername = null;
- private String printertype = null;
- private String printserver = null;
- private String comment = null;
- private String device = null;
- private String make = null;
- private String model = null;
- private String ppd = null;
- private String ppdfile = null;
- private String notify = null;
- private String protocol = null;
- private String destination = null;
- private String extensions = null;
- private String[] file_contents = null;
- private String[] user_allow_list = null;
- private String[] user_deny_list = null;
- private boolean use_ppd_file = true;
- private boolean default_printer = false;
- private String banner = null;
- private boolean enable = true;
- private boolean accept = true;
-
- private String locale = null; // Possible future use
-
- private NameService nscontext;
-
- //
- // Logs
- //
- private String warnlog = null;
- private String errlog = null;
- private String cmdlog = null;
-
- //
- // Constructors
- //
- public Printer()
- {
- Debug.message("SVR: Printer constructor called empty.");
- nscontext = new NameService();
- PrinterDebug.printObj(nscontext);
- }
- public Printer(NameService ns)
- {
- Debug.message("SVR: Printer constructor called with NS.");
- nscontext = ns;
- PrinterDebug.printObj(ns);
- }
-
- //
- // Is a printer local to this machine
- //
- public synchronized boolean isPrinterLocal(String printername)
- throws Exception
- {
- Debug.message("SVR: Printer.isPrinterLocal()");
- return (DoPrinterUtil.isLocal(printername));
- }
-
- //
- // Get details of a printer.
- //
- public synchronized void getPrinterDetails()
- throws Exception
- {
- Debug.message("SVR: Printer.getPrinterDetails()");
-
- if (printername == null) {
- throw new pmInternalErrorException(
- "Printer.getPrinterDetails(): printername must be set");
- }
- DoPrinterView.view(this, nscontext);
- }
-
- //
- // Add a local printer
- //
- public synchronized void addLocalPrinter()
- throws Exception
- {
- Debug.message("SVR: Printer.addLocalPrinter()");
-
- if (printername == null) {
- throw new pmInternalErrorException(
- "Printer.addLocalPrinter(): printername must be set");
- }
- if (printserver == null) {
- Host h = new Host();
- printserver = h.getLocalHostName();
- h = null;
- }
- if (device == null) {
- throw new pmInternalErrorException(
- "Printer.addLocalPrinter(): device must be set");
- }
- if ((pmMisc.isppdCachefile()) && use_ppd_file) {
- if (make == null) {
- throw new pmInternalErrorException(
- "Printer.addLocalPrinter(): make must be set");
- }
- if (model == null) {
- throw new pmInternalErrorException(
- "Printer.addLocalPrinter(): model must be set");
- }
- if (ppd == null) {
- throw new pmInternalErrorException(
- "Printer.addLocalPrinter(): ppd file must be selected");
- }
- }
-
-
- PrinterDebug.printObj(this);
-
- clearLogs();
- DoPrinterAdd.add(this, nscontext);
- }
-
- //
- // Add access to a remote printer
- //
- public synchronized void addRemotePrinter()
- throws Exception
- {
- Debug.message("SVR: Printer.addRemotePrinter()");
-
- if (printername == null) {
- throw new pmInternalErrorException(
- "Printer.addRemotePrinter(): printername must be set");
- }
- if (printserver == null) {
- throw new pmInternalErrorException(
- "Printer.addRemotePrinter(): printserver must be set");
- }
- PrinterDebug.printObj(this);
-
- clearLogs();
- DoPrinterAdd.add(this, nscontext);
- }
-
- //
- // Delete a printer
- //
- public synchronized void deletePrinter()
- throws Exception
- {
- Debug.message("SVR: Printer.deletePrinter()");
-
- if (printername == null) {
- throw new pmInternalErrorException(
- "Printer.deletePrinter(): printername must be set");
- }
- PrinterDebug.printObj(this);
-
- clearLogs();
- DoPrinterDelete.delete(this, nscontext);
- }
-
- //
- // Modify a printer
- //
- public synchronized void modifyPrinter()
- throws Exception
- {
- Debug.message("SVR: Printer.modifyPrinter()");
-
- if (printername == null) {
- throw new pmInternalErrorException(
- "Printer.modifyPrinter(): printername must be set");
- }
- PrinterDebug.printObj(this);
-
- clearLogs();
- DoPrinterMod.modify(this, nscontext);
- }
-
- //
- // Set list of commands executed
- //
- public synchronized void setCmdLog(String newcmds)
- {
- if (newcmds == null) {
- return;
- }
- if (!newcmds.endsWith("\n")) {
- newcmds = newcmds.concat("\n");
- }
- if (cmdlog == null) {
- cmdlog = new String(newcmds);
- return;
- }
- cmdlog = cmdlog.concat(newcmds);
- }
-
- //
- // Set an error message.
- //
- public synchronized void setErrorLog(String errs)
- {
- if (errs == null) {
- return;
- }
- if (!errs.endsWith("\n")) {
- errs = errs.concat("\n");
- }
- if (errlog == null) {
- errlog = new String(errs);
- return;
- } else {
- errlog = errlog.concat(errs);
- }
- }
-
- //
- // Set an warning message.
- //
- public synchronized void setWarnLog(String warning)
- {
- if (warning == null) {
- return;
- }
- if (!warning.endsWith("\n")) {
- warning = warning.concat("\n");
- }
- if (warnlog == null) {
- warnlog = new String(warning);
- return;
- } else {
- warnlog = warnlog.concat(warning);
- }
- }
-
- //
- // Get commands executed.
- //
- public String getCmdLog()
- {
- if (cmdlog == null) {
- return (null);
- }
- return (new String(cmdlog.trim()));
- }
-
- //
- // Get error messages
- //
- public String getErrorLog()
- {
- if (errlog == null) {
- return (null);
- }
- return (new String(errlog.trim()));
- }
-
- //
- // Get warning messages
- //
- public String getWarnLog()
- {
- if (warnlog == null) {
- return (null);
- }
- return (new String(warnlog.trim()));
- }
-
- //
- // Set printer attributes
- //
- public synchronized void setPrinterName(String arg)
- {
- printername = arg;
- }
- public synchronized void setPrinterType(String arg)
- {
- printertype = arg;
- }
- public synchronized void setPrintServer(String arg)
- {
- printserver = arg;
- }
- public synchronized void setComment(String arg)
- {
- comment = arg;
- }
- public synchronized void setMake(String arg)
- {
- make = arg;
- }
- public synchronized void setModel(String arg)
- {
- model = arg;
- }
- public synchronized void setPPD(String arg)
- {
- ppd = arg;
- }
- public synchronized void setPPDFile(String arg)
- {
- ppdfile = arg;
- }
- public synchronized void setDevice(String arg)
- {
- device = arg;
- }
- public synchronized void setUsePPD(boolean arg)
- {
- use_ppd_file = arg;
- }
- public synchronized void setNotify(String arg)
- {
- notify = arg;
- }
- public synchronized void setProtocol(String arg)
- {
- protocol = arg;
- }
- public synchronized void setDestination(String arg)
- {
- destination = arg;
- }
- public synchronized void setExtensions(String arg)
- {
- extensions = arg;
- }
- public synchronized void setFileContents(String[] arg)
- {
- file_contents = arg;
- }
- public synchronized void setUserAllowList(String[] arg)
- {
- user_allow_list = arg;
- }
- public synchronized void setUserDenyList(String[] arg)
- {
- user_deny_list = arg;
- }
- public synchronized void setIsDefaultPrinter(boolean arg)
- {
- default_printer = arg;
- }
- public synchronized void setBanner(String arg)
- {
- banner = arg;
- }
- public synchronized void setEnable(boolean arg)
- {
- enable = arg;
- }
- public synchronized void setAccept(boolean arg)
- {
- accept = arg;
- }
- public synchronized void setLocale(String arg)
- {
- locale = arg;
- }
-
- //
- // Get printer attributes.
- //
- public String getPrinterName()
- {
- return (printername);
- }
- public String getPrinterType()
- {
- return (printertype);
- }
- public String getPrintServer()
- {
- return (printserver);
- }
- public String getComment()
- {
- return (comment);
- }
- public String getDevice()
- {
- return (device);
- }
- public boolean getUsePPD()
- {
- return (use_ppd_file);
- }
- public String getMake()
- {
- return (make);
- }
- public String getModel()
- {
- return (model);
- }
- public String getPPD()
- {
- return (ppd);
- }
- public String getPPDFile()
- {
- return (ppdfile);
- }
- public String getNotify()
- {
- return (notify);
- }
- public String getProtocol()
- {
- return (protocol);
- }
- public String getDestination()
- {
- return (destination);
- }
- public String getExtensions()
- {
- return (extensions);
- }
- public String[] getFileContents()
- {
- return (file_contents);
- }
- public String[] getUserAllowList()
- {
- return (user_allow_list);
- }
- public String[] getUserDenyList()
- {
- return (user_deny_list);
- }
- public boolean getIsDefaultPrinter()
- {
- return (default_printer);
- }
- public String getBanner()
- {
- return (banner);
- }
- public boolean getEnable()
- {
- return (enable);
- }
- public boolean getAccept()
- {
- return (accept);
- }
- public String getLocale()
- {
- return (locale);
- }
-
- protected void clearLogs()
- {
- warnlog = null;
- errlog = null;
- cmdlog = null;
- }
-
- // Hints for optimizing printer modifications
- protected String modhints = "";
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterDebug.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterDebug.java
deleted file mode 100644
index 1997111b1c..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterDebug.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * PrinterDebug class
- * Helper class to print attributes in objects.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-import java.util.*;
-
-public class PrinterDebug {
-
- public static void printObj(Printer p)
- {
- String arr[];
- int i;
-
- Debug.message("SVR: PrinterDebug.print_obj(Printer)");
-
- Debug.message("SVR: \tName:\t\t" + p.getPrinterName());
- Debug.message("SVR: \tType:\t\t" + p.getPrinterType());
- Debug.message("SVR: \tServer:\t\t" + p.getPrintServer());
- Debug.message("SVR: \tComment:\t" + p.getComment());
- Debug.message("SVR: \tDevice:\t\t" + p.getDevice());
- Debug.message("SVR: \tMake:\t\t" + p.getMake());
- Debug.message("SVR: \tModel:\t\t" + p.getModel());
- Debug.message("SVR: \tPPD:\t\t" + p.getPPD());
- Debug.message("SVR: \tNotify:\t\t" + p.getNotify());
- Debug.message("SVR: \tProtocol:\t" + p.getProtocol());
- Debug.message("SVR: \tDest:\t\t" + p.getDestination());
- Debug.message("SVR: \tExtensions:\t" + p.getExtensions());
- Debug.message("SVR: \tDefault:\t" + p.getIsDefaultPrinter());
- Debug.message("SVR: \tBanner:\t\t" + p.getBanner());
- Debug.message("SVR: \tEnable:\t\t" + p.getEnable());
- Debug.message("SVR: \tAccept:\t\t" + p.getAccept());
-
- arr = p.getFileContents();
- if (arr == null) {
- Debug.message("SVR: \tContents:\tNULL");
- } else {
- Debug.message("SVR: \tContents:");
- for (i = 0; i < arr.length; i++) {
- Debug.message("SVR: \t\t\t" + arr[i]);
- }
- }
- arr = p.getUserAllowList();
- if (arr == null) {
- Debug.message("SVR: \tUser allow:\tNULL");
- } else {
- Debug.message("SVR: \tUser allow:");
- for (i = 0; i < arr.length; i++) {
- Debug.message("SVR: \t\t\t" + arr[i]);
- }
- }
- arr = p.getUserDenyList();
- if (arr == null) {
- Debug.message("SVR: \tUser deny:\tNULL");
- } else {
- Debug.message("SVR: \tUser deny:");
- for (i = 0; i < arr.length; i++) {
- Debug.message("SVR: \t\t\t" + arr[i]);
- }
- }
- }
-
- public static void printObj(NameService ns)
- {
- Debug.message("SVR: PrinterDebug.printObj(NameService)");
-
- // Keep passwd secret.
- String passwd = ns.getPasswd();
- if (passwd != null) {
- passwd = "*****";
- }
- Debug.message("SVR: \tnameservice:\t" + ns.getNameService());
- Debug.message("SVR: \tnshost:\t\t" + ns.getNameServiceHost());
- Debug.message("SVR: \tuser:\t\t" + ns.getUser());
- Debug.message("SVR: \tpasswd:\t\t" + passwd);
- Debug.message("SVR: \tboundtonisslave:" + ns.getBoundToNisSlave());
- Debug.message("SVR: \tisAuth:\t\t" + ns.isAuth());
- }
-
- public static String arr_to_str(String[] arr)
- {
- if (arr == null) {
- return (new String("NULL"));
- }
- if (arr.length == 0) {
- return (new String("0 length array"));
- }
- String str = "";
- for (int i = 0; i < arr.length; i++) {
- if (arr[i] == null) {
- break;
- }
- str = str.concat(arr[i] + " ");
- }
- return (str);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterUtil.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterUtil.java
deleted file mode 100644
index ff5e947dcf..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterUtil.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * PrinterUtil class
- * Methods not associated with a printer instance.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-import java.util.*;
-
-public class PrinterUtil {
-
- //
- // main for testing
- //
- public static void main(String[] args) {
- String dp = null;
- String devs[] = null;
- String printers[] = null;
-
- try {
- NameService ns = new NameService("ldap");
-// checkRootPasswd("xxx");
- dp = getDefaultPrinter(ns);
- devs = getDeviceList();
- printers = getPrinterList(ns);
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- System.out.println("Default printer is: " + dp);
- for (int i = 0; i < devs.length; i++) {
- System.out.println(devs[i]);
- }
- for (int i = 0; i < printers.length; i += 3) {
- System.out.println("printername: " + printers[i]);
- System.out.println("servername: " + printers[i+1]);
- System.out.println("comment: " + printers[i+2]);
- }
- System.exit(0);
- }
-
- //
- // Get the default printer for a specified name space
- //
- public synchronized static String getDefaultPrinter(
- NameService ns) throws Exception
- {
- Debug.message("SVR: PrinterUtil.getDefaultPrinter()");
-
- String nsarg = ns.getNameService();
- String ret = DoPrinterUtil.getDefault(nsarg);
- if (ret == null) {
- return (new String(""));
- }
- return (new String(ret));
- }
-
- //
- // Get a list of possible printer devices for this machine.
- //
- public synchronized static String[] getDeviceList() throws Exception
- {
- Debug.message("SVR: PrinterUtil.getDeviceList()");
-
- String emptylist[] = new String[1];
- emptylist[0] = "";
-
- String ret[] = DoPrinterUtil.getDevices();
- if (ret == null) {
- return (emptylist);
- }
- return (ret);
- }
-
- //
- // Get the list of supported Printer Makes (Manufacturers)
- // If supported, a PPD file exists for this Make
- //
- public synchronized static String[] getMakesList() throws Exception
- {
- Debug.message("SVR: PrinterUtil.getMakesList()");
-
- String emptylist[] = new String[1];
- emptylist[0] = "";
-
- String ret[] = DoPrinterUtil.getMakes();
- if (ret == null) {
- return (emptylist);
- }
- return (ret);
- }
-
- public synchronized static String[] getModelsList(
- String make) throws Exception
-
- {
- Debug.message("SVR: PrinterUtil.getModelsList()");
-
- String emptylist[] = new String[1];
- emptylist[0] = "";
-
- String ret[] = DoPrinterUtil.getModels(make);
- return (ret);
- }
-
- public synchronized static String[] getPPDList(
- String make, String model) throws Exception
-
- {
- Debug.message("SVR: PrinterUtil.getPPDList()");
-
- String emptylist[] = new String[1];
- emptylist[0] = "";
-
- String ret[] = DoPrinterUtil.getPPDs(make, model);
- if (ret == null) {
- return (emptylist);
- }
- return (ret);
- }
-
- public synchronized static String[] getProbePrinter(String device)
- {
- Debug.message("SVR: PrinterUtil.getProbePrinter()");
-
- String ret[] = DoPrinterUtil.getProbe(device);
- return (ret);
- }
-
-
- //
- // Get a list of printers in the specified name service.
- //
- public synchronized static String[] getPrinterList(
- NameService ns) throws Exception
- {
- Debug.message("SVR: PrinterUtil.getPrinterList()");
-
- String emptylist[] = new String[1];
- emptylist[0] = "";
-
- String nsarg = ns.getNameService();
- String[] ret = DoPrinterUtil.getList(nsarg);
- if (ret == null) {
- return (emptylist);
- }
- return (ret);
- }
-
- //
- // Does this printer already exist in the specified
- // name service
- //
- public synchronized static boolean exists(
- String name,
- NameService ns) throws Exception
- {
- Debug.message("SVR: PrinterUtil.exists()");
-
- String nsname = ns.getNameService();
- return (DoPrinterUtil.exists(name, nsname));
- }
-
- public synchronized static boolean isLocal(
- String printername) throws Exception
- {
- Debug.message("SVR: PrinterUtil.isLocal()");
-
- return (DoPrinterUtil.isLocal(printername));
- }
-
- public synchronized static void checkRootPasswd(
- String passwd) throws Exception
- {
- DoPrinterNS.doCheckRootPasswd(passwd);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/SysCommand.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/SysCommand.java
deleted file mode 100644
index cd8afb1364..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/SysCommand.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * SysCommand
- * Execute a command and capture stdout/stderr.
- *
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-
-public class SysCommand
-{
-
- private Process p = null;
- private String out = null;
- private String err = null;
- private int status = 0;
-
- public static void main(String[] args) {
- SysCommand syscmd = new SysCommand();
- String cmd = "ypcat hosts";
- String o = "";
- try {
- syscmd.exec(cmd);
- }
- catch (Exception e) {
- System.out.println(e);
- }
- o = syscmd.getOutput();
- System.out.println(o);
- }
-
- /*
- * Execute a system command.
- * @param String cmd The command to be executed.
- */
- public void exec(String cmd) throws Exception
- {
- if (cmd == null) {
- throw new pmInternalErrorException(
- "SysCommand.exec(): null command");
- }
-
- debug_log(cmd);
-
- p = Runtime.getRuntime().exec(cmd);
- if (p == null) {
- throw new pmInternalErrorException(
- "SysCommand.exec(): null process");
- }
- out = readOut();
- err = readErr();
- p.waitFor();
- status = getStatus();
- dispose();
- }
-
- public void exec(String[] cmd) throws Exception
- {
- if (cmd == null) {
- throw new pmInternalErrorException(
- "SysCommand.exec(): null command");
- }
-
- // Trim command arrays with nulls at the end.
- int i;
- for (i = 0; i < cmd.length; i++) {
- if (cmd[i] == null) {
- break;
- }
- }
- if (i != cmd.length) {
- String[] newcmd = new String[i];
-
- for (i = 0; i < newcmd.length; i++) {
- newcmd[i] = cmd[i];
- }
- debug_log(PrinterDebug.arr_to_str(newcmd));
- p = Runtime.getRuntime().exec(newcmd);
- } else {
- debug_log(PrinterDebug.arr_to_str(cmd));
- p = Runtime.getRuntime().exec(cmd);
- }
- if (p == null) {
- throw new pmInternalErrorException(
- "SysCommand.exec(): null process");
- }
- out = readOut();
- err = readErr();
- p.waitFor();
- status = getStatus();
- dispose();
- }
-
-
- public void exec(String cmd, String locale) throws Exception
- {
- if (cmd == null) {
- throw new pmInternalErrorException(
- "SysCommand.exec(): null command");
- }
-
- debug_log(locale + "; " + cmd);
-
- String [] envp = new String[1];
- envp[0] = locale;
- p = Runtime.getRuntime().exec(cmd, envp);
- if (p == null) {
- throw new pmInternalErrorException(
- "SysCommand.exec(): null process");
- }
- out = readOut();
- err = readErr();
- p.waitFor();
- status = getStatus();
- dispose();
- }
-
- public String getOutput() {
- if (out == null)
- return (null);
- return (new String(out));
- }
- public String getError() {
- if (err == null)
- return (null);
- return (new String(err));
- }
- public int getExitValue() {
- return (status);
- }
-
-
- private String readOut() throws Exception
- {
- String result = null;
- String line = null;
- BufferedReader out = null;
-
- out = new BufferedReader(
- new InputStreamReader(p.getInputStream()));
- while ((line = out.readLine()) != null) {
- if (result == null)
- result = line;
- else
- result = result.concat("\n" + line);
- }
- return (result);
- }
-
- private String readErr() throws Exception
- {
- String errstr = null;
- String line = null;
- BufferedReader err = null;
-
- err = new BufferedReader(
- new InputStreamReader(p.getErrorStream()));
- while ((line = err.readLine()) != null) {
- if (errstr == null) {
- errstr = line;
- } else {
- errstr = errstr.concat("\n" + line);
- }
- }
- return (errstr);
- }
-
- private int getStatus() throws Exception
- {
- return (p.exitValue());
- }
-
- /*
- * Clean up opened file descriptors.
- */
- private void dispose() {
-
- try {
- p.getInputStream().close();
- p.getOutputStream().close();
- p.getErrorStream().close();
- p.destroy();
- }
- catch (Exception e) {
- Debug.message("SVR:" + e.getMessage());
- }
- }
-
- /*
- * Log all commands as is except lpset with a password.
- */
- private void debug_log(String cmd)
- {
- if ((cmd.indexOf("lpset") != -1) &&
- (cmd.indexOf(" -w ") != -1)) {
- String clean = "";
- int i = cmd.indexOf(" -w ");
- int j = 0;
-
- try {
- i += 4;
- clean = cmd.substring(0, i);
- clean = clean.concat("**** ");
- while (cmd.charAt(i) != ' ') {
- i++;
- }
- } catch (Exception e) {
- Debug.message("SVR: lpset command with a passwd.");
- return;
- }
-
- clean = clean.concat(cmd.substring(i, cmd.length()));
- Debug.message("SVR: " + clean);
-
- } else {
- Debug.message("SVR: " + cmd);
- }
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Test.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Test.java
deleted file mode 100644
index 31e9339f10..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Test.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Test
- * Command line front end to Printer class
- *
- * Takes one argument - the name of a test file
- * The format of the file is:
- * Required:
- * action=[add,delete,modify,view,list]
- *
- * Optional:
- * printername=
- * printertype=
- * printserver=
- * comment=
- * device=
- * notify=
- * protocol=
- * destination=
- * extensions=
- * default_printer=[true,false]
- * banner=
- * enable=[true,false]
- * accept=[true,false]
- * file_contents=[space seperated list]
- * user_allow_list=[space seperated list]
- * user_deny_list=[space seperated list]
- * nameservice=[system,nis]
- * nshost=
- * user=
- * passwd=
- * locale=
- *
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-import java.util.*;
-
-public class Test {
- public static void main(String[] args) {
- String tmpstr;
- int i;
- String testfile = "";
- if (args.length == 1) {
- testfile = args[0];
- } else {
- System.out.println("Usage: Test testfile");
- System.exit(1);
- }
-
- String cmd = "/usr/bin/cat " + testfile;
- String o = null;
- try {
- SysCommand syscmd = new SysCommand();
- syscmd.exec(cmd);
- if (syscmd.getExitValue() != 0) {
- System.out.println("Problem opening test file");
- System.exit(1);
- }
- o = syscmd.getOutput();
- syscmd = null;
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- o = o.concat("\n");
-
- String action = getToken(o, "action=");
- String printername = getToken(o, "printername=");
- String printertype = getToken(o, "printertype=");
- String printserver = getToken(o, "printserver=");
- String comment = getToken(o, "comment=");
- String device = getToken(o, "device=");
- String notify = getToken(o, "notify=");
- String banner = getToken(o, "banner=");
- String protocol = getToken(o, "protocol=");
- String destination = getToken(o, "destination=");
- String extensions = getToken(o, "extensions=");
-
- String[] file_contents = null;
- String[] user_allow_list = null;
- String[] user_deny_list = null;
-
- StringTokenizer st;
- tmpstr = getToken(o, "file_contents=");
- if (tmpstr != null) {
- st = new StringTokenizer(tmpstr);
- if (st.countTokens() != 0) {
- file_contents = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- file_contents[i] = st.nextToken();
- }
- }
- }
- tmpstr = getToken(o, "user_allow_list=");
- if (tmpstr != null) {
- st = new StringTokenizer(tmpstr);
- if (st.countTokens() != 0) {
- user_allow_list = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- user_allow_list[i] = st.nextToken();
- }
- }
- }
- tmpstr = getToken(o, "user_deny_list=");
- if (tmpstr != null) {
- st = new StringTokenizer(tmpstr);
- if (st.countTokens() != 0) {
- user_deny_list = new String[st.countTokens()];
- for (i = 0; st.hasMoreTokens(); i++) {
- user_deny_list[i] = st.nextToken();
- }
- }
- }
-
- boolean default_printer = false;
- boolean enable = false;
- boolean accept = false;
-
- tmpstr = getToken(o, "default_printer=");
- if (tmpstr != null) {
- if (tmpstr.equals("true")) {
- default_printer = true;
- }
- }
- tmpstr = getToken(o, "enable=");
- if (tmpstr != null) {
- if (tmpstr.equals("true")) {
- enable = true;
- }
- }
- tmpstr = getToken(o, "accept=");
- if (tmpstr != null) {
- if (tmpstr.equals("true")) {
- accept = true;
- }
- }
-
- String nameservice = getToken(o, "nameservice=");
- String nshost = getToken(o, "nshost=");
- String user = getToken(o, "user=");
- String passwd = getToken(o, "passwd=");
- String locale = getToken(o, "locale=");
-
- //
- // Done parsing. Let's do the work.
- //
- Debug.setDebugLevel(Debug.ALL);
-
- NameService ns = null;
- try {
- ns = new NameService(nameservice);
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- if (nameservice.equals("nis") || nameservice.equals("ldap")) {
- if (nshost != null)
- ns.setNameServiceHost(nshost);
- if (user != null)
- ns.setUser(user);
- if (passwd != null)
- ns.setPasswd(passwd);
- }
- try {
- ns.checkAuth();
- }
- catch (Exception e) {
- System.out.println(e);
- }
-
- Printer p = new Printer(ns);
-
- p.setPrinterName(printername);
- p.setPrinterType(printertype);
- p.setPrintServer(printserver);
- p.setFileContents(file_contents);
- p.setComment(comment);
- p.setDevice(device);
- p.setNotify(notify);
- p.setProtocol(protocol);
- p.setDestination(destination);
- p.setIsDefaultPrinter(default_printer);
- p.setBanner(banner);
- p.setEnable(enable);
- p.setAccept(accept);
- p.setUserAllowList(user_allow_list);
- p.setUserDenyList(user_deny_list);
- p.setLocale(locale);
-
- if (action.equals("list")) {
- String[] plist = null;
- try {
- plist = PrinterUtil.getPrinterList(ns);
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- if (plist == null) {
- System.out.println("No printers");
- } else {
- printPList(plist);
- }
- } else if (action.equals("view")) {
- try {
- p.getPrinterDetails();
- }
- catch (Exception e)
- {
- System.out.println(e);
- }
- printView(p);
- } else if (action.equals("add")) {
- try {
- if (device == null) {
- p.addRemotePrinter();
- } else {
- p.addLocalPrinter();
- }
- }
- catch (Exception e)
- {
- System.out.println(e);
- }
- } else if (action.equals("modify")) {
- try {
- p.modifyPrinter();
- }
- catch (Exception e)
- {
- System.out.println(e);
- }
- } else if (action.equals("delete")) {
- try {
- p.deletePrinter();
- }
- catch (Exception e)
- {
- System.out.println(e);
- }
- } else {
- System.out.println("unknown action");
- System.exit(1);
- }
- System.out.println("============================");
- System.out.println("Commands:\n" + p.getCmdLog());
- System.out.println("Errors:\n" + p.getErrorLog());
- System.out.println("Warnings:\n" + p.getWarnLog());
- System.exit(0);
- }
-
- private static String getToken(String str, String sub)
- {
- int i = -1;
- int j = -1;
- String result = null;
-
- i = str.indexOf(sub);
- if (i != -1) {
- i = i + sub.length();
- j = str.indexOf("\n", i);
- if (j != -1) {
- result = str.substring(i, j);
- result = result.trim();
- if (result.equals(""))
- result = null;
- }
- }
- return (result);
- }
-
- private static void printPList(String[] list)
- {
- if (list == null)
- return;
- if (list[0].equals("")) {
- System.out.println("No printers found");
- return;
- }
-
- for (int i = 0; i < list.length; ) {
- System.out.println("name: " + list[i++]);
- System.out.println("server: " + list[i++]);
- System.out.println("comment: " + list[i++]);
- }
- }
-
- private static void printView(Printer p)
- {
- String arr[];
- int i;
-
- System.out.println("Name: " + p.getPrinterName());
- System.out.println("Type: " + p.getPrinterType());
- System.out.println("Server: " + p.getPrintServer());
- System.out.println("Comment: " + p.getComment());
- System.out.println("Device: " + p.getDevice());
- System.out.println("Notify: " + p.getNotify());
- System.out.println("Protocol: " + p.getProtocol());
- System.out.println("Dest: " + p.getDestination());
- System.out.println("Extensions: " + p.getExtensions());
- System.out.println("Default: " + p.getIsDefaultPrinter());
- System.out.println("Banner: " + p.getBanner());
- System.out.println("Enable: " + p.getEnable());
- System.out.println("Accept: " + p.getAccept());
-
- arr = p.getFileContents();
- if (arr == null) {
- System.out.println("Contents: NULL");
- } else {
- System.out.println("Contents:");
- for (i = 0; i < arr.length; i++) {
- System.out.println("\t\t" + arr[i]);
- }
- }
- arr = p.getUserAllowList();
- if (arr == null) {
- System.out.println("Users allow: NULL");
- } else {
- System.out.println("Users allow:");
- for (i = 0; i < arr.length; i++) {
- System.out.println("\t\t" + arr[i]);
- }
- }
- arr = p.getUserDenyList();
- if (arr == null) {
- System.out.println("Users deny: NULL");
- } else {
- System.out.println("Users deny:");
- for (i = 0; i < arr.length; i++) {
- System.out.println("\t\t" + arr[i]);
- }
- }
-
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Valid.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Valid.java
deleted file mode 100644
index a457be1e58..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Valid.java
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Valid
- * Check user input. We are mostly concerned with characters
- * we know will cause problems for the sub-system.
- * multi-byte characters will be screened out by the gui.
- */
-
-package com.sun.admin.pm.server;
-
-import java.io.*;
-import java.util.*;
-
-public class Valid {
-
- static String spaces = "\t ";
- /* JSTYLED */
- static String badmetas = "\"\\$^&*(){}`'|;:?<>";
- /* JSTYLED */
- static String baddestmetas = "\"\\$^&*(){}`'|;?<>";
-
- // lpadmin used to only take 14.
- static int validlocalprinternamelength = 1024;
- // MAXHOSTNAMELEN + MAXPATHLEN seems reasonable.
- static int validremoteprinternamelength = 1280;
-
- static int validdestinationlength = 1023; // BUFSIZ-1 seems generous
- static int validcommentlength = 256; // From admintool
- static int validservernamelength = 256; // MAXHOSTNAMELEN = 256
- static int validusernamelength = 128; // LOGNAME_MAX = 8 but since
- // it's not enforced ...
- static int validmakelength = 256; // MAXNAMELEN = 256
-
- //
- // main for testing
- //
- public static void main(String[] args) {
- String[] users_arr = { "one", "two", "th`ee" };
- try {
- System.out.println(localPrinterName("foo/bar"));
- System.out.println(comment("abad:comment"));
- System.out.println(device("/dev/term/a"));
- System.out.println(printerType(" "));
- System.out.println(serverName(",bad"));
- System.out.println(users(users_arr));
- }
- catch (Exception e)
- {
- System.out.println(e);
- System.exit(1);
- }
- System.exit(0);
- }
-
- //
- // Valid comment
- //
- public static boolean comment(String cstr)
- {
- Debug.message("SVR: Valid.comment()");
- Debug.message("SVR: comment=" + cstr);
-
- if (cstr == null)
- return (false);
- if (cstr.length() > validcommentlength)
- return (false);
-
- String c = cstr.substring(0, 1);
- // Causes problems in lpadmin
- if (c.equals(",")) {
- return (false);
- }
- if (c.equals("-")) {
- return (false);
- }
-
- return (validString(cstr, badmetas + "="));
- }
-
- //
- // Valid local printer name
- //
- public static boolean localPrinterName(String pn)
- {
- Debug.message("SVR: Valid.localPrinterName()");
- Debug.message("SVR: printerName=" + pn);
-
- if (pn == null)
- return (false);
- if (pn.length() == 0)
- return (false);
- if (pn.length() > validlocalprinternamelength)
- return (false);
-
- String c = pn.substring(0, 1);
- if (c.equals(".")) {
- return (false);
- }
- if (c.equals("!")) {
- return (false);
- }
- if (c.equals("=")) {
- return (false);
- }
-
- // Keywords for the sub-system
- if (pn.equals("_default"))
- return (false);
- if (pn.equals("_all"))
- return (false);
-
- return (validString(pn, badmetas + spaces + "/#:,"));
- }
-
- //
- // Valid remote printer name
- //
- public static boolean remotePrinterName(String pn)
- {
- Debug.message("SVR: Valid.remotePrinterName()");
- Debug.message("SVR: printerName=" + pn);
-
- if (pn == null)
- return (false);
- if (pn.length() == 0)
- return (false);
- if (pn.length() > validremoteprinternamelength)
- return (false);
-
- // Keywords for the sub-system
- if (pn.equals("_default"))
- return (false);
- if (pn.equals("_all"))
- return (false);
-
- String c = pn.substring(0, 1);
- if (c.equals(".")) {
- return (false);
- }
- if (c.equals("!")) {
- return (false);
- }
- if (c.equals("=")) {
- return (false);
- }
-
- return (validString(pn, badmetas + spaces + "/#:,"));
- }
-
- //
- // Valid device
- // Does it exist and is it writable.
- //
- public static boolean device(String dev)
- throws Exception
- {
- int exitvalue;
-
- Debug.message("SVR: Valid.device()");
- Debug.message("SVR: device=" + dev);
-
- if (dev == null)
- return (false);
- if (dev.length() == 0)
- return (false);
- if (dev.indexOf("://") != 0) // don't test if it's a URI
- return (true);
-
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/test -w " + dev);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
-
- if (exitvalue != 0)
- return (false);
- return (true);
- }
-
- //
- // Valid Printer Make
- // Does a directory of that name exist, and is it readable.
- //
-
- public static boolean make(String dir)
- throws Exception
- {
- int exitvalue;
-
- Debug.message("SVR: Valid.make()");
- Debug.message("SVR: dir=" + dir);
-
- if (dir == null)
- return (false);
- if ((dir.length() == 0) || (dir.length() > validmakelength))
- return (false);
-
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/test -d -r " + dir);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
-
- if (exitvalue != 0)
- return (false);
- return (true);
- }
-
- //
- // Valid printer type
- //
- public static boolean printerType(String pt)
- throws Exception
- {
- int exitvalue;
-
- Debug.message("SVR: Valid.printerType()");
- Debug.message("SVR: printerType=" + pt);
-
- if (pt == null)
- return (false);
- if (pt.length() == 0)
- return (false);
-
- if (pt.equals("/"))
- return (false);
-
- if (pt.indexOf(" ") != -1) {
- return (false);
- }
- if (pt.indexOf("\t") != -1) {
- return (false);
- }
-
- String c = pt.substring(0, 1);
- String path = "/usr/share/lib/terminfo/" + c + "/" + pt;
- SysCommand syscmd = new SysCommand();
- syscmd.exec("/usr/bin/test -r " + path);
- exitvalue = syscmd.getExitValue();
- syscmd = null;
-
- if (exitvalue != 0)
- return (false);
- return (true);
- }
-
- //
- // Valid destination
- //
- public static boolean destination(String d)
- {
- Debug.message("SVR: Valid.destination()");
- Debug.message("SVR: destination=" + d);
-
- if (d == null)
- return (false);
- if (d.length() == 0)
- return (false);
- if (d.length() > validdestinationlength)
- return (false);
-
- return (validString(d, baddestmetas + spaces));
- }
-
- //
- // Valid Server name
- //
- public static boolean serverName(String s)
- {
- Debug.message("SVR: Valid.serverName()");
- Debug.message("SVR: serverName=" + s);
-
- if (s == null)
- return (false);
- if (s.length() == 0)
- return (false);
- if (s.length() > validservernamelength)
- return (false);
-
- String c = s.substring(0, 1);
- if (c.equals("!")) {
- return (false);
- }
- if (c.equals("=")) {
- return (false);
- }
-
- return (validString(s, badmetas + spaces + "#,:"));
- }
-
- //
- // Users
- //
- public static boolean users(String[] u)
- {
- Debug.message("SVR: Valid.users()");
- Debug.message("SVR: users = " + PrinterDebug.arr_to_str(u));
-
- if (u == null) {
- return (false);
- }
- if (u.length == 0) {
- return (false);
- }
-
- for (int i = 0; i < u.length; i++) {
- if (u[i] == null) {
- return (false);
- }
- if (u[i].length() == 0) {
- return (false);
- }
- if (u[i].length() > validusernamelength) {
- return (false);
- }
- if (!validString(u[i], badmetas + spaces)) {
- return (false);
- }
- }
- return (true);
- }
-
- //
- // User
- //
- public static boolean user(String u)
- {
- Debug.message("SVR: Valid.users()");
- Debug.message("SVR: users = " + u);
-
- if (u == null) {
- return (false);
- }
- if (u.length() == 0) {
- return (false);
- }
-
- if (u == null) {
- return (false);
- }
- if (u.length() == 0) {
- return (false);
- }
- if (u.length() > validusernamelength) {
- return (false);
- }
- if (!validString(u, badmetas + spaces)) {
- return (false);
- }
- return (true);
- }
-
-
- //
- // Check to see if a string contains an invalid character
- //
- private static boolean validString(String str, String badchars)
- {
- // Can't start with a hyphen
- String start = str.substring(0, 1);
- if (start.equals("-"))
- return (false);
-
- char[] badchars_arr = badchars.toCharArray();
-
- for (int i = 0; i < badchars_arr.length; i++) {
- if (str.indexOf(badchars_arr[i]) != -1) {
- return (false);
- }
- }
- return (true);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmAuthException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmAuthException.java
deleted file mode 100644
index 3c24fa53d2..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmAuthException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmAuthException class
- * User is not authorized to perform an operation.
- */
-
-package com.sun.admin.pm.server;
-
-public class pmAuthException extends pmException
-{
- public pmAuthException()
- {
- super();
- }
-
- public pmAuthException(String s)
- {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmAuthRhostException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmAuthRhostException.java
deleted file mode 100644
index 2f6b41e5f3..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmAuthRhostException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmAuthRhostException class
- * A .rhosts entry has not been set up allowing updates of
- * pre-2.6 nis servers.
- *
- */
-
-package com.sun.admin.pm.server;
-
-public class pmAuthRhostException extends pmAuthException
-{
- public pmAuthRhostException()
- {
- super();
- }
-
- public pmAuthRhostException(String s)
- {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmCmdFailedException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmCmdFailedException.java
deleted file mode 100644
index 26925a1d97..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmCmdFailedException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmCmdFailedException class
- * A command unexpectedly failed.
- */
-
-package com.sun.admin.pm.server;
-
-public class pmCmdFailedException extends pmException
-{
- public pmCmdFailedException()
- {
- super();
- }
-
- public pmCmdFailedException(String s)
- {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmHostNotPingableException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmHostNotPingableException.java
deleted file mode 100644
index cc8464a17b..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmHostNotPingableException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHostNotPingableException class
- * A host is not accessible using ping.
- */
-
-package com.sun.admin.pm.server;
-
-public class pmHostNotPingableException extends pmException
-{
- public pmHostNotPingableException()
- {
- super();
- }
-
- public pmHostNotPingableException(String s)
- {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmInternalErrorException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmInternalErrorException.java
deleted file mode 100644
index 08f50dbc8f..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmInternalErrorException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmInternalErrorException class
- * An internal error has occuured. This is often associated
- * with the server not getting enough information to perform
- * an action.
- */
-
-package com.sun.admin.pm.server;
-
-public class pmInternalErrorException extends pmException
-{
- public pmInternalErrorException()
- {
- super();
- }
-
- public pmInternalErrorException(String s)
- {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmNSNotConfiguredException.java b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmNSNotConfiguredException.java
deleted file mode 100644
index 1ffd8ccd50..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmNSNotConfiguredException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmNSNotConfiguredException class
- * The selected name service does not appear to be configured
- * on the host.
- */
-
-package com.sun.admin.pm.server;
-
-public class pmNSNotConfiguredException extends pmException
-{
- public pmNSNotConfiguredException()
- {
- super();
- }
-
- public pmNSNotConfiguredException(String s)
- {
- super(s);
- }
-}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/tests/template b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/tests/template
deleted file mode 100644
index 4096d9bae5..0000000000
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/tests/template
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-action=
-printername=
-printertype=
-printserver=
-file_contents=
-comment=
-device=
-notify=
-protocol=
-destination=
-default_printer=
-banner=
-enable=
-accept=
-user_allow_list=
-user_deny_list=
-nameservice=
-nshost=
-user=
-passwd=
-locale=
diff --git a/usr/src/cmd/print/scripts/Makefile b/usr/src/cmd/print/scripts/Makefile
deleted file mode 100644
index 7dfa94546e..0000000000
--- a/usr/src/cmd/print/scripts/Makefile
+++ /dev/null
@@ -1,149 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-include ../Makefile.sp
-
-ROOTPRINTLIB = $(ROOTLIB)/print
-ROOTLIBLPBIN = $(ROOTLIBLP)/bin
-ROOTVARLP = $(ROOTVAR)/lp
-ROOTVARLPPPD = $(ROOTVARLP)/ppd
-
-$(ROOTVARLP) := DIRMODE=0775
-
-FILEMODE = 0755
-
-MSGFILES = lpadmin ppdmgr
-POFILE = scripts.po
-
-PROG = conv_lp conv_lpd Makefile.yp
-ROOTLIBPRINTPROG= $(PROG:%=$(ROOTPRINTLIB)/%)
-$(ROOTLIBPRINTPROG) := FILEMODE=0555
-$(ROOTPRINTLIB)/Makefile.yp := FILEMODE=0444
-
-USRSBINPROG= lpsystem ppdmgr
-ROOTUSRSBINPROG= $(USRSBINPROG:%=$(ROOTUSRSBIN)/%)
-$(ROOTUSRSBINPROG) := FILEMODE=555
-
-PCONF= printers.conf
-ROOTPCONF= $(PCONF:%=$(ROOTETC)/%)
-$(ROOTPCONF) := FILEMODE=644
-
-MANUFALIASES= manufaliases
-ROOTMANUFALIASES= $(MANUFALIASES:%=$(ROOTVARLPPPD)/%)
-$(ROOTMANUFALIASES) := FILEMODE=444
-
-LIBLPPROGS= getmakes getmodels getppdfile getppds ppdfilename2mmp \
- lpadmin \
- desktop-print-management \
- desktop-print-management-applet \
- desktop-print-management-prefs
-
-ROOTLIBLPPROGS= $(LIBLPPROGS:%=$(ROOTLIBLPBIN)/%)
-$(ROOTLIBLPPROGS) := FILEMODE=555
-
-LIBLINKS= $(ROOTLIB)/lpadmin $(ROOTLIB)/lpsystem
-
-APPFILES = desktop-print-management.desktop
-APPFILES += desktop-print-management-prefs.desktop
-AUTOFILES = desktop-print-management-applet.desktop
-
-ROOTAPPDIR = $(ROOT)/usr/share/applications
-ROOTAUTODIR = $(ROOT)/usr/share/gnome/autostart
-ROOTAPPFILES = $(APPFILES:%=$(ROOTAPPDIR)/%)
-ROOTAUTOFILES = $(AUTOFILES:%=$(ROOTAUTODIR)/%)
-
-$(ROOTAPPFILES) := FILEMODE = 444
-$(ROOTAUTOFILES) := FILEMODE = 444
-
-
-.KEEP_STATE:
-
-all : $(PROG)
-
-$(ROOTLIB)/print/%: %
- $(INS.file)
-
-$(ROOTLIBLPBIN)/%: %
- $(INS.file)
-
-$(ROOTVARLPPPD)/%: %
- $(INS.file)
-
-$(ROOTAPPDIR)/%: %
- $(INS.file)
-
-$(ROOTAUTODIR)/%: %
- $(INS.file)
-
-$(ROOTUSRSBIN) $(ROOTVARSPOOLPRINT) $(ROOTVARLP) $(ROOTVARLPPPD):
- $(INS.dir)
-
-$(ROOTLIB)/lpadmin:
- $(RM) $@; $(SYMLINK) ../sbin/lpadmin $@
-
-$(ROOTLIB)/lpsystem:
- $(RM) $@; $(SYMLINK) ../sbin/lpsystem $@
-
-$(ROOTLNKPROGS) : $(ROOTSTARTPROG)
- $(RM) $@; $(LN) $(ROOTSTARTPROG) $@
-
-_msg: $(POFILE)
-
-$(POFILE): $(MSGFILES)
- grep gettext $(MSGFILES) | tr '`' ' ' | sed -e "s/gettext \"/gettext \(\"/" | sed -e "s/$$/);/" > $(POFILE).i
- $(XGETTEXT) -s $(POFILE).i
- $(RM) $@ $(POFILE).i
- mv messages.po $(POFILE)
-
-#
-# Create a message file to test with
-#
-_msg_test:
- grep gettext $(MSGFILES) | tr '`' ' ' | sed -e "s/gettext \"/gettext \(\"/" | sed -e "s/$$/);/" > $(POFILE).i
- $(XGETTEXT) -s -m "xxx" $(POFILE).i
- $(RM) $@ $(POFILE).i
- mv messages.po $(POFILE)
-
-install: $(ROOTLNKPROGS) \
- $(ROOTLIBPRINTPROG) $(ROOTSTARTPROG) \
- $(ROOTUSRSBIN) $(ROOTUSRSBINPROG) \
- $(ROOTVARSPOOLPRINT) $(ROOTPCONF) \
- $(ROOTLIBLPPROGS) $(LIBLINKS) \
- $(ROOTVARLP) $(ROOTVARLPPPD) \
- $(ROOTMANUFALIASES) \
- $(ROOTAPPFILES) $(ROOTAUTOFILES)
-
-$(SYMLINKS1):
- $(RM) $@; $(SYMLINK) ../sbin/$(SBINPROG1) $@
-
-$(SYMLINKS2):
- $(RM) $@; $(SYMLINK) ../sbin/$(SBINPROG2) $@
-
-clean:
- $(RM) $(POFILE)
-
-clobber: clean
-
-strip lint:
diff --git a/usr/src/cmd/print/scripts/Makefile.yp b/usr/src/cmd/print/scripts/Makefile.yp
deleted file mode 100644
index 2e5647f4f1..0000000000
--- a/usr/src/cmd/print/scripts/Makefile.yp
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyrights (c) 1996 by Sun Microsystems, Inc.
-# All Rights Reserved
-#
-# Example pieces of NIS Makefile.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-#
-# Printers conf Rules
-#
-DIR=/etc
-#
-$(DOM)/printers.conf.time: $(DIR)/printers.conf
- -@if [ -f $(DIR)/printers.conf ]; then \
- (sed -e '/^#/d' -e s/#.*$$// -e 's/[ ][ ]*$$//' \
- -e '/\\$$/s/\\$$/ /' $(DIR)/printers.conf $(CHKPIPE))\
- |( awk '/ $$/ {printf "%s", $$0} !/ $$/ {print}' $(CHKPIPE))\
- |( sed -e 's/[ ][ ]*/ /g' -e 's/:[ ]*:/:/' \
- $(CHKPIPE))\
- | awk -F: '{n=split($$1, nm, "|"); for (i=1; i<=n; i++) \
- print nm[i], $$0}' \
- | $(MAKEDBM) - $(YPDBDIR)/$(DOM)/printers.conf.byname ; \
- touch $(DOM)/printers.conf.time; \
- echo "updated printers.conf"; \
- if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOM) printers.conf.byname; \
- fi ; \
- if [ ! $(NOPUSH) ]; then echo "pushed printers.conf"; fi ; \
- else \
- echo "couldn't find $(DIR)/printers.conf"; \
- fi
-
-#
-# Dependency
-#
-printers.conf: $(DOM)/printers.conf.time
diff --git a/usr/src/cmd/print/scripts/conv_lp b/usr/src/cmd/print/scripts/conv_lp
deleted file mode 100644
index 286ba6f682..0000000000
--- a/usr/src/cmd/print/scripts/conv_lp
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright (c) 1994, 1995, 1996 by Sun Microsystems, Inc.
-# All Rights Reserved
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# This script will automatically generate a "printcap" file
-# from the currently configured LP printer configuration.
-#
-PATH=/bin:/usr/bin:/usr/sbin
-
-TEXTDOMAIN="SUNW_OST_OSCMD"
-export TEXTDOMAIN
-
-export PATH
-umask 022
-
-set -- `getopt d:f: $*`
-if [ $? != 0 ] ; then
- echo "Usage: $0 [-d dir] [-f file]"
- exit 1
-fi
-
-for OPTION in $*
-do
- case $OPTION in
- -f) SYSTEM_FILE=$2; shift 2;;
- -d) BASE_DIR=$2; shift 2;;
- --) shift; break;;
- esac
-done
-
-SYSTEM_FILE=${SYSTEM_FILE:-"${BASE_DIR}/etc/printers.conf"}
-
-if [ ! -d ${BASE_DIR}/etc/lp/printers ] ; then
- gettext "Exit $0: There is no directory ${BASE_DIR}/etc/lp/printers\n\tfrom which to create /etc/printers.conf."
- exit 0
-fi
-
-if [ -f ${BASE_DIR}/etc/lp/default ] ; then
- DEFAULT_PRINTER=`cat ${BASE_DIR}/etc/lp/default`
- lpset -n system -a "use=${DEFAULT_PRINTER}" _default
- mv ${BASE_DIR}/etc/lp/default ${BASE_DIR}/etc/default.orig
-fi
-
-cd ${BASE_DIR}/etc/lp/printers # get the list of locally configured printers
-PRINTERS=`echo *`
-
-for PRINTER in ${PRINTERS} # for each printer get config info
-do
- if [ "${PRINTER}" = "*" ] ; then
- continue
- fi
-
- RNAME=${PRINTER}
- DESC=""
- RHOST=""
-
- if [ -f ${PRINTER}/comment ] ; then
- DESC=`cat ${PRINTER}/comment`
- fi
-
- REMOTE=`grep Remote: ${PRINTER}/configuration 2>/dev/null | sed -e "s/^Remote: //"`
- DEVICE=`grep Device: ${PRINTER}/configuration 2>/dev/null | sed -e "s/^Device: //"`
-
- if [ -n "${DEVICE}" ] ; then
- RHOST=`uname -n`
- elif [ `echo ${REMOTE} | grep -c \!` -ne 0 ] ; then
- RHOST=`echo $REMOTE | cut -d \! -f 1`
- RNAME=`echo $REMOTE | cut -d \! -f 2`
- else
- RHOST=${REMOTE}
- fi
-
- lpset -n system -a "bsdaddr=${RHOST},${RNAME}" -a "description=${DESC}" \
- ${PRINTER}
-
-done
-
-exit 0
diff --git a/usr/src/cmd/print/scripts/conv_lpd b/usr/src/cmd/print/scripts/conv_lpd
deleted file mode 100644
index e75d411ba8..0000000000
--- a/usr/src/cmd/print/scripts/conv_lpd
+++ /dev/null
@@ -1,213 +0,0 @@
-#!/bin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright (c) 1994, 1995, 1996 by Sun Microsystems, Inc.
-# All Rights Reserved
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Printcap <-> Printers.conf conversion utility...
-#
-# Usage: conv_lpd [ -c (printers|printcap) ] [ -n ] (file)
-#
-
-TEXTDOMAIN="SUNW_OST_OSCMD"
-export TEXTDOMAIN
-
-USAGE=`gettext "Usage: conv_lpd [ -c (printers|printcap) ] [ -n ] (file)\n"`
-
-PATH=/usr/bin:/bin:/usr/sbin export PATH
-conversion="printers"
-namelist=0
-
-umask 022
-
-for i in $*
-do
- case $1 in
- -c*)
- conversion=$2;
- shift ; shift ;
- ;;
- -n*)
- namelist=1;
- shift ;
- ;;
- *)
- break ;
- ;;
- esac
-done
-
-TMPF1=/tmp/tinput1.$$
-TMPF2=/tmp/tinput2.$$
-FILE=/tmp/input.$$
-
-# Any remaining arg is the "file" specification. It is a required arg.
-if [ -z "$1" ]; then
- echo $USAGE
- exit 1
-else
- cp $1 $TMPF1
-fi
-
-echo >>$TMPF1
-echo "_done" >>$TMPF1
-
-#
-# First, strip all continuation characters, leaving one, single line
-# for each printer entry.
-#
- CONV_FIX=/usr/lib/print/conv_fix
-
- if [ -f $CONV_FIX ]; then
- $CONV_FIX -f $TMPF1 -o $TMPF2
- if [ $? != 0 ]; then
- echo "$0:"
- gettext "Fatal Error: $CONV_FIX failed.\n"
- gettext "Please contact your Sun support representative.\n"
- exit 1
- fi
- else
- gettext "$0: Fatal: Cannot locate $CONV_FIX binary.\n"
- gettext "Please contact your Sun support representative.\n"
- exit 1
- fi
-
-#
-# Continuation characters are now stripped. Continue processing.
-#
- /bin/sed -e "s/:[ ]*:/:/g" $TMPF2 > $FILE
-
-#
-# Empty colons ":[ <TAB>]*:" are now stripped. Continue processing.
-#
-
-nawk '
-BEGIN {
- "uname -n" | getline ;
- host = $0 ;
- found = 0 ;
- local_pr = 0;
-}
-
-{
- FS=":"; OFS=":" ;
- if ($0 !~ /^#/)
- {
- if ($0 ~ /^[_a-zA-Z0-9_]/) { # New entry
- if ( found != 0 ) {
- if ( "'$namelist'" == 1 )
- printer = names ;
- else
- printer = name[1] ;
-
- if ( "'$conversion'" == "printers" ) {
- printf "\n%s:", names ;
- for (key in values) {
- if ((key != "rp") &&
- (key != "rm")) {
- printf "\\\n\t:%s=%s:",
- key, values[key] ;
- delete values[key];
- }
- }
- if (values["rm"] != "") {
- printf "\\\n\t:bsdaddr=%s,%s:", \
- values["rm"], \
- values["rp"] ;
- if (values["rm"] == host) local_pr++;
- } else {
- printf "\\\n\t:bsdaddr=%s,%s:", \
- host, printer ;
- local_pr++;
- }
- delete values["rp"];
- delete values["rm"];
- } else {
- printf "\n%s:", names ;
- for (key in values) {
- if (key == "bsdaddr") {
- split(values[key],
- pair, ",");
- printf "\\\n\t:%s=%s:", \
- "rm", pair[1] ;
- if (pair[2] == "")
- pair[2] = printer;
- printf "\\\n\t:%s=%s:", \
- "rp", pair[2] ;
-
- } else if ((key == "br") || \
- (key == "fc") || \
- (key == "fs") || \
- (key == "mc") || \
- (key == "mx") || \
- (key == "pc") || \
- (key == "pl") || \
- (key == "pw") || \
- (key == "px") || \
- (key == "py") || \
- (key == "xc") || \
- (key == "xs"))
- printf "\\\n\t:%s#%s:", \
- key, \
- values[key] ;
- else if (values[key] == "true")
- printf "\\\n\t:%s:", \
- key ;
- else if (values[key] != "false")
- printf "\\\n\t:%s=%s:", \
- key, \
- values[key] ;
- delete values[key];
- }
- }
- }
- split( $1, name, "|");
- names = $1 ;
- found++;
- }
-
- for ( i = 1 ; i <= NF ; i++ ) {
- if (($i == names) || ($i == "") || \
- ($i == "\t"))
- continue ;
- if ((split( $i, pair, "=" ) != 2) && \
- (split( $i, pair, "\#") != 2))
- pair[2] = "true";
-
- if (pair[1] != "" && pair[1] != " ")
- values[pair[1]] = pair[2] ;
- }
- }
-}
-END {
- printf "\n" ;
- if (local_pr != 0)
- printf "One or more printers are local, you may want to run lpadmin to configure LP server side operation\n" | "cat 1>&2" ;
-
-}' ${FILE}
-
-/bin/rm -f ${TMPF1} ${TMP2} ${FILE}
-
-exit 0
diff --git a/usr/src/cmd/print/scripts/desktop-print-management-prefs.desktop b/usr/src/cmd/print/scripts/desktop-print-management-prefs.desktop
deleted file mode 100644
index 970861d7e9..0000000000
--- a/usr/src/cmd/print/scripts/desktop-print-management-prefs.desktop
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-[Desktop Entry]
-Name=Printers
-Name[de]=Drucker
-Name[es]=Impresoras
-Name[fr]=Imprimantes
-Name[it]=Stampanti
-Name[ja]=プリンタ
-Name[ko]=프린터
-Name[pt_BR]=Impressoras
-Name[zh_CN]=打å°æœº
-Name[zh_HK]=å°è¡¨æ©Ÿ
-Name[zh_TW]=å°è¡¨æ©Ÿ
-Comment=Set printer detection and connection behavior
-Comment[de]=Verhalten für Druckererkennung und -verbindung festlegen
-Comment[es]=Definir la detección de impresoras y el comportamiento de conexión
-Comment[fr]=Définir la détection des imprimantes et le comportement des connexions
-Comment[it]=Impostare la rilevazione della stampante e il comportamento della connessione
-Comment[ja]=プリンタã®æ¤œå‡ºãŠã‚ˆã³æŽ¥ç¶šã®å‹•ä½œã‚’設定ã—ã¾ã™
-Comment[ko]=프린터 ê°ì§€ ë° ì—°ê²° ë™ìž‘ 설정
-Comment[pt_BR]=Definir comportamento de conexão e detecção da impressora
-Comment[zh_CN]=设置打å°æœºæ£€æµ‹å’Œè¿žæŽ¥è¡Œä¸º
-Comment[zh_HK]=設定å°è¡¨æ©Ÿåµæ¸¬å’Œé€£ç·šçš„é‹ä½œæ–¹å¼
-Comment[zh_TW]=設定å°è¡¨æ©Ÿåµæ¸¬å’Œé€£ç·šçš„é‹ä½œæ–¹å¼
-Exec=env DESKTOP_LAUNCHED=true /usr/bin/desktop-print-management-prefs
-Icon=print-manager
-Terminal=false
-Type=Application
-StartupNotify=true
-Categories=GNOME;GTK;Settings;
-OnlyShowIn=GNOME;
diff --git a/usr/src/cmd/print/scripts/desktop-print-management.desktop b/usr/src/cmd/print/scripts/desktop-print-management.desktop
deleted file mode 100644
index 168ebc75ee..0000000000
--- a/usr/src/cmd/print/scripts/desktop-print-management.desktop
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-[Desktop Entry]
-Name=Print Manager
-Comment=Manage your printer queues and jobs
-Comment[cs]=Správa tiskových front a procesů
-Comment[de]=Druckerwarteschlangen und Druckaufträge verwalten
-Comment[es]=Administre las tareas y colas de la impresora
-Comment[fr]=Gérer les files d'attente et travaux de l'imprimante
-Comment[it]=Gestisci le code e i processi della stampante
-Comment[ja]=プリンタã®ã‚­ãƒ¥ãƒ¼ãŠã‚ˆã³ã‚¸ãƒ§ãƒ–を管ç†ã™ã‚‹
-Comment[ko]=프린터 대기열 ë° ìž‘ì—… 관리
-Comment[pt_BR]=Gerenciar filas e trabalhos da impressora
-Comment[zh_CN]=管ç†æ‰“å°æœºé˜Ÿåˆ—和作业
-Comment[zh_HK]=管ç†å°è¡¨æ©Ÿä½‡åˆ—和工作
-Comment[zh_TW]=管ç†å°è¡¨æ©Ÿä½‡åˆ—和工作
-Exec=env DESKTOP_LAUNCHED=true /usr/bin/desktop-print-management
-Icon=print-manager
-Terminal=false
-Type=Application
-StartupNotify=true
-Categories=GNOME;Application;System;Settings
-OnlyShowIn=GNOME;
diff --git a/usr/src/cmd/print/scripts/getmakes b/usr/src/cmd/print/scripts/getmakes
deleted file mode 100644
index 437d268324..0000000000
--- a/usr/src/cmd/print/scripts/getmakes
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-#
-# get a list of the Manufacturers from the ppdcache
-#
-
-[[ -f /var/lp/ppd/ppdcache ]] || exit 1
-/bin/cat /var/lp/ppd/ppdcache |
- nawk '{FS=":"; print $1}' |
- nawk '{print $1}' |
- /bin/sort -u
-exit 0
diff --git a/usr/src/cmd/print/scripts/getppdfile b/usr/src/cmd/print/scripts/getppdfile
deleted file mode 100644
index bba0590b1b..0000000000
--- a/usr/src/cmd/print/scripts/getppdfile
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-#
-# Get the path/ppdfilename for this ppd NickName
-# Input:
-# make: model: ppdlabel: ppd:
-# PrintersRus: ABC Model 1234: SUNWfoomatic(S): Foomatic/Postscript (recommended):
-#
-
-#
-# Returns the full path to the repository associated with
-# the repository letter found between parenthesis in the
-# extended PPD label.
-#
-# $1 - Extended PPD label
-#
-rep_path()
-{
- case "$(expr \"$1\" : ".*(\(.*\)).*")" in
- "S")
- echo "/usr/share/ppd"
- ;;
- "V")
- echo "/opt/share/ppd"
- ;;
- "A")
- echo "/usr/local/share/ppd"
- ;;
- "U")
- echo "/var/lp/ppd"
- ;;
- esac
-}
-
-if [[ $# -lt 4 ]]; then
- exit 1
-fi
-
-[[ -f /var/lp/ppd/ppdcache ]] || exit 1
-make=$(echo $* | /usr/bin/nawk '{FS=":"; print $1}')
-# strip leading blanks
-model=$(echo $* | /usr/bin/nawk '{FS=":"; print $2}' |
- /bin/sed -e 's/^[ ]*//')
-extppdlabel=$(echo $* | /usr/bin/nawk '{FS=":"; print $3}' |
- /bin/sed -e 's/^[ ]*//')
-ppd=$(echo $* | /usr/bin/nawk '{FS=":"; print $4}' |
- /bin/sed -e 's/^[ ]*//')
-
-#
-# Do not use ":" with $make. printmgr collapses manufacturer name
-# to first word, ie PrintersRus and PrintersRus International become
-# PrintersRus. The full path to the PPD file will be the 6th
-# colon separated entry in the ppdcache entry. If the format
-# of a ppdcache entry changes, then this will need to be modified
-# also.
-#
-/bin/grep "${make}" /var/lp/ppd/ppdcache |
- /bin/grep "${model}:" |
- /bin/grep "${ppd}:" |
- /bin/grep "$(rep_path ${extppdlabel})/${extppdlabel%\(*}" |
- /usr/bin/nawk '{FS=":"; print $6}'
-
-exit 0
diff --git a/usr/src/cmd/print/scripts/getppds b/usr/src/cmd/print/scripts/getppds
deleted file mode 100644
index de91dadef4..0000000000
--- a/usr/src/cmd/print/scripts/getppds
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# get a list of the Models for this Model from the ppdcache
-#
-
-# Input:
-# make model
-# HP OfficeJet 4200
-# Output:
-# <label>(<repository letter>): <driver>
-# userlabel(U): Foomatic/hpijs (recommended)
-# SUNWhpijs(S): Foomatic/hpijs (recommended)
-
-SaveIFS="$IFS"
-NoSpaceTabIFS='
-'
-SEP=": "
-
-#
-# Return cache entries matching the specified make
-# and model from the specified cache file.
-#
-# $1 - Make
-# $2 - Model
-# $3 - cachefile
-ppd_make_entries()
-{
- for hit in $(/bin/grep "${1}" "${3}" | /bin/grep ":${2}:")
- do
- echo "${hit#*:*:}"
- done
-}
-
-if [[ $# -lt 2 ]]; then
- exit 1
-fi
-
-cachefile=/var/lp/ppd/ppdcache
-[[ -f $cachefile ]] || exit 1
-make=$1
-shift
-model="$*"
-system=
-vendor=
-admin=
-user=
-
-#
-# Ensure each ppdcache entry is processed as a single string
-# otherwise it would be split up by spaces.
-#
-IFS="$NoSpaceTabIFS"
-for pentry in $(ppd_make_entries "${make}" "${model}" "${cachefile}")
-do
- IFS="$SaveIFS"
- ppdpath="${pentry##*:}"
- ppdlpath="${ppdpath%/*/*}"
- ppdlabel="${ppdlpath##*/}"
- driver="${pentry%%:*}"
-
- case "${ppdpath}" in
- "/usr/share/ppd/"*)
- system="${system}${ppdlabel}(S)${SEP}${driver}\n"
- ;;
- "/opt/share/ppd/"*)
- vendor="${vendor}${ppdlabel}(V)${SEP}${driver}\n"
- ;;
- "/usr/local/share/ppd/"*)
- admin="${admin}${ppdlabel}(A)${SEP}${driver}\n"
- ;;
- "/var/lp/ppd/"*)
- user="${user}${ppdlabel}(U)${SEP}${driver}\n"
- ;;
- esac
- IFS="$NoSpaceTabIFS"
-done
-
-IFS="$SaveIFS"
-echo "${user}${admin}${vendor}${system}"
-exit 0
diff --git a/usr/src/cmd/print/scripts/lpadmin b/usr/src/cmd/print/scripts/lpadmin
deleted file mode 100644
index 04c144a21f..0000000000
--- a/usr/src/cmd/print/scripts/lpadmin
+++ /dev/null
@@ -1,403 +0,0 @@
-#!/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#
-
-PATH=/bin:/usr/bin:/usr/sbin export PATH
-
-TEXTDOMAIN="SUNW_OST_OSCMD"
-export TEXTDOMAIN
-
-PFEXEC=/usr/bin/pfexec
-LPSET=/usr/bin/lpset
-LPGET=/usr/bin/lpget
-LPSTAT=/usr/bin/lpstat
-LPADMIN=/usr/lib/lp/local/lpadmin
-LPFILTER=/usr/sbin/lpfilter
-COMM=/usr/bin/comm
-PPDMGR=/usr/sbin/ppdmgr
-MKTEMP="/usr/bin/mktemp -t"
-
-HOST=$(/bin/uname -n)
-exit_code=0
-
-usage() {
- gettext "Usage:\n" 1>&2
- gettext " lpadmin -p (printer) (options)\n" 1>&2
- gettext " lpadmin -x (dest)\n" 1>&2
- gettext " lpadmin -d (dest)\n" 1>&2
- gettext " lpadmin -S print-wheel -A alert-type [ -W minutes ]\n" 1>&2
- gettext " [ -Q requests ]\n" 1>&2
- gettext " lpadmin -M -f form-name [ -a [ -o filebreak ]\n" 1>&2
- gettext " [ -t tray-number ]]\n" 1>&2
- exit 1
-}
-
-# create a filter table for LP service
-lp_config_filters() {
- if [[ ! -f /etc/lp/filter.table ]] ; then
- cd /etc/lp/fd ; for filter in *.fd ; do
- ${PFEXEC} ${LPFILTER} \
- -f $(/usr/bin/basename $filter .fd) \
- -F $filter
- done
- fi
-}
-
-# enable/disable LP related service(s)
-lp_config_service() { # (enable | disable)
- svcadm ${1} -s svc:/application/print/server:default
- # svcadm ${1} -s svc:/application/print/rfc1179:default
- # svcadm ${1} -s svc:/application/print/ipp-listener:default
-}
-
-# synchronize printers.conf with LP configuration changes
-lp_config_sync_pconf() { # (pre) (post)
- ADDED=$(${COMM} -13 ${1} ${2})
- REMOVED=$(${COMM} -23 ${1} ${2})
-
- lp_server=${server:-${HOST}}
- for DEST in ${ADDED} ; do
- lp_uri="ipp://${lp_server}/printers/${DEST}"
- lp_bsdaddr="${lp_server},${DEST},Solaris"
- ${LPSET} -n system \
- -a "printer-uri-supported=${lp_uri}" \
- -a "bsdaddr=${lp_bsdaddr}" \
- ${DEST} 2>/dev/null
- done
-
- for DEST in ${REMOVED} ; do
- ${LPSET} -n system -x ${DEST} 2>/dev/null
- done
-}
-
-# Delete all destinations in printers.conf
-delete_all() {
- for DEST in $(lpget -n system list | egrep -e '.+:$' | sed -e 's/://')
- do
- ${LPSET} -n system -x ${DEST}
- status=$?
- done
-}
-
-# Call the ppdmgr utility to add a new PPD file to the system.
-#
-# $1 - path to PPD file
-# $2 - label name (optional)
-add_new_ppd_file() {
- # Add new ppd file and echo full path it was actually saved to
- ppdmgrcmd="${PFEXEC} ${PPDMGR} -a ${1} -w"
-
- ppderrfile=$(${MKTEMP} lpadminerror.XXXXXX)
- if [[ -z "${ppderrfile}" ]] ; then
- gettext "lpadmin: System error; cannot create temporary file\n" 1>&2
- exit 2
- fi
- ppd_file=$(${ppdmgrcmd} 2>${ppderrfile})
- ppdmgrrc=$?
- if [[ -s "${ppderrfile}" ]] ; then
- print -n "lpadmin: " 1>&2
- cat ${ppderrfile} 1>&2
- rm -f ${ppderrfile} >/dev/null 2>&1
- if [[ ${ppdmgrrc} -ne 0 ]] ; then
- exit 1
- fi
- fi
- rm -f ${ppderrfile} >/dev/null 2>&1
-}
-
-#
-# Execution begins here
-#
-
-# be sure that we can run lpset and lpget
-if [[ ! -x ${LPSET} || ! -x ${LPGET} ]] ; then
- gettext "lpadmin: System error; cannot set default printer\n" 1>&2
- exit 2
-fi
-
-if [[ $# -lt 1 ]] ; then
- usage
- exit 1
-fi
-
-# Deal with the -d option independently since getopts does not handle
-# options that may or may not have arguments
-#
-if [[ ${1} = "-d" ]] ; then
- if [[ $# -eq 1 ]] ; then # remove the "default"
- ${LPGET} -n system _default >/dev/null 2>&1
- exit_code=$?
-
- if [[ ${exit_code} -eq 0 ]] ; then
- ${LPSET} -n system -x _default
- exit_code=$?
- else # no default, nothing to do
- exit_code=0
- fi
- elif [[ $# -eq 2 ]] ; then # add/change the "default"
- ${LPGET} -k bsdaddr ${2} >/dev/null 2>&1
- exit_code=$?
-
- if [[ $exit_code -eq 0 ]] ; then
- ${LPSET} -n system -a "use=${2}" _default
- exit_code=$?
- else # can't set default to an unconfigured printer
- gettext "${2}: undefined printer\n" 1>&1
- fi
- else # invalid usage
- usage
- exit 1
- fi
-
- exit ${exit_code}
-fi
-
-# Strip off legal options
-while getopts "A:ac:D:e:f:F:H:hi:I:lm:Mn:o:p:Q:r:S:s:T:u:U:v:W:x:t:P:" arg
-do
- case $arg in
- D)
- description="${OPTARG}"
- ;;
- n)
- ppd_file="${OPTARG}"
- ;;
- p)
- if [[ -n "${delete}" ]] ; then
- usage
- fi
- printer=${OPTARG}
- ;;
- s)
- server=${OPTARG}
- ;;
- v|U)
- device=${OPTARG}
- if [[ ! -n "${server}" ]] ; then
- server=${HOST}
- fi
- local="true"
- ;;
- x)
- if [[ -n "${printer}" || -n "${server}" || \
- -n "${device}" || -n "${description}" ]] ; then
- usage
- fi
- delete=${OPTARG}
- printer=${OPTARG}
- if [[ ${printer} = "all" ]] ; then
- local="true"
- fi
- ;;
- S|M|A)
- local="true"
- ;;
- c)
- class=${OPTARG}
- local="true"
- if [[ ! -f ${LPGET} ]] ; then
- gettext "lpadmin: System error; cannot set class\n " 1>&2
- exit 2
- fi
-
- ${LPGET} "${class}" > /dev/null 2>&1
- lpget_class=$?
- if [[ ${lpget_class} -eq 0 && ! -r /etc/lp/classes/"${class}" ]] ; then
- gettext "lpadmin: ERROR: Can't create class ${class}.\n" 1>&2
- gettext " TO FIX: This is an existing printer name;\n" 1>&2
- gettext " choose another name.\n" 1>&2
- exit 1
- fi
- ;;
- r)
- local="true"
- ;;
- esac
-done
-
-#
-# We don't have anything to do; let user know and bail
-#
-if [[ ! -n "${printer}" && ! -n "${delete}" && ! -n "${local}" ]] ; then
- gettext "lpadmin: ERROR: Nothing to do.\n" 1>&2
- gettext " TO FIX: You must give one of these options:\n" 1>&2
- gettext " -p, -d, -x -S\n" 1>&2
- exit 1
-fi
-
-#
-# Printer does not exist
-# To be consistent with 2.5, assume adding local printer
-#
-if [[ ! -n "${device}" && ! -n "${server}" && ! -n "${delete}" && \
- ! -n "${local}" ]] ; then
- ${LPGET} "${printer}" > /dev/null 2>&1
- lpget_stat=$?
- if [[ ${lpget_stat} -ne 0 ]] ; then
- gettext "lpadmin: ERROR: Missing -U or -v option.\n" 1>&2
- gettext " TO FIX: Local printers must have\n" 1>&2
- gettext " a port defined (-v option) or\n" 1>&2
- gettext " have dial-out instructions (-U option).\n" 1>&2
- exit 1
- fi
-fi
-
-# process the "server" value
-# It can be a hostname, UUCP form (server!queue), RCMD form(queue@server),
-# or in URI form ({scheme}://{endpoint})
-#
-case "${server}" in
- *://*) # URI form
- uri=${server}
- rem_printer=$(expr "${server}" : ".*://.*/\([^/]*\)")
- server=$(expr "${server}" : ".*://\([^/]*\)/.*")
- ;;
- *@*) # RCMD form
- rem_printer=$(expr "${server}" : "\(.*\)@.*")
- server=$(expr "${server}" : ".*@\(.*\)")
- ;;
- *!*) # UUCP form
- rem_printer=$(expr "${server}" : ".*!\(.*\)")
- server=$(expr "${server}" : "\(.*\)!.*")
- ;;
- *) # hostname
- rem_printer=${printer}
- ;;
-esac
-
-# if there is a "device" or LP configuration, it's local
-if [[ -n "${device}" || -f /etc/lp/printers/${printer}/configuration || \
- -f /etc/lp/classes/${printer} ]] ; then
- local="true"
-fi
-
-# Do the LP configuration for a local printer served by lpsched
-if [[ -x ${LPADMIN} && -n "${local}" ]] ; then
- # enumerate LP configured printers before modification
- PRE=$(${MKTEMP} lpadmin-pre.XXXXXX)
- if [[ -z "${PRE}" ]] ; then
- gettext "lpadmin: System error; cannot create temporary file\n" 1>&2
- exit 2
- fi
-
- (/bin/ls /etc/lp/printers 2>/dev/null ; /bin/ls /etc/lp/classes \
- 2>/dev/null) >${PRE}
-
- # if there are no printers configured, enable LP service(s)
- [[ ! -s "${PRE}" ]] && lp_config_service enable
-
- # add filters to LP service
- lp_config_filters
-
- # add new ppd file to PPD file repositories
- if [[ -n "${ppd_file}" && -x ${PPDMGR} ]] ; then
- add_new_ppd_file "${ppd_file}"
- fi
-
- # modify LP destination(s)
- CMD="${PFEXEC} ${LPADMIN}"
- while [[ -n "$*" ]] ; do # to deal with multi-word arguments
- CMD="$CMD \"$1\""
- # replace the ppd_file originally specified with the -n option
- # with the one returned from call to ppdmgr
- if [[ "${1}" = "-n" ]] ; then
- CMD="$CMD \"${ppd_file}\""
- shift
- fi
- shift
- done
- case "$CMD" in
- *\"-D\")
- CMD="$CMD \"\""
- ;;
- esac
-
- # execute the LP lpadmin command
- eval $CMD
- exit_code=$?
-
- # enumerate LP configured printers after modification
- POST=$(${MKTEMP} lpadmin-post.XXXXXX)
- if [[ -z "${POST}" ]] ; then
- gettext "lpadmin: System error; cannot create temporary file\n" 1>&2
- /bin/rm -f ${PRE} >/dev/null 2>&1
- exit 2
- fi
-
- (/bin/ls /etc/lp/printers 2>/dev/null ; /bin/ls /etc/lp/classes \
- 2>/dev/null) >${POST}
-
- # if there are no destinations, disable the service(s)
- [[ ! -s "${POST}" ]] && lp_config_service disable
-
- # sync printers.conf with LP configuration
- lp_config_sync_pconf "${PRE}" "${POST}"
-
- /bin/rm -f ${PRE} ${POST}
-fi
-
-# Do any printers.conf configuration that is required
-if [[ -n "${delete}" ]] ; then
- if [[ "${delete}" = "all" ]] ; then
- [[ $exit_code -eq 0 ]] && delete_all
- elif [[ -z "${local}" ]] ; then
- ${LPSET} -n system -x ${delete}
- exit_code=$?
- fi
-else
- if [[ -z "${local}" ]] ; then
- # if we need a uri, find the "best" one.
- if [[ -z "${uri}" ]] ; then
- uri="ipp://${server}/printers/${rem_printer}"
- ${LPSTAT} -p ${uri} >/dev/null 2>&1
- if [[ $? -ne 0 ]] ; then
- uri="lpd://${server}/printers/${rem_printer}#Solaris"
- fi
- fi
- # set the bsdaddr
- bsdaddr="${server},${rem_printer},Solaris"
-
- if [[ -n "${printer}" && -n "${server}" ]] ; then
- ${LPSET} -n system \
- -a "printer-uri-supported=${uri}" \
- -a "bsdaddr=${bsdaddr}" ${printer}
- exit_code=$?
- fi
-
- fi
-
- if [[ -n "${printer}" && -n "${description}" ]] ; then
- ${LPSET} -n system \
- -a "description=${description}" ${printer}
- exit_code=$?
- fi
-fi
-
-# if the "default" doesn't resolve a "bsdaddr", the printer is gone, remove it
-${LPGET} -n system -k bsdaddr _default >/dev/null 2>&1 ||
- ${LPSET} -n system -x _default >/dev/null 2>&1
-
-exit $exit_code
diff --git a/usr/src/cmd/print/scripts/manufaliases b/usr/src/cmd/print/scripts/manufaliases
deleted file mode 100644
index 4e6d489c36..0000000000
--- a/usr/src/cmd/print/scripts/manufaliases
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-Canon:Canon Inc.
-Dymo:Dymo-CoStar
-Epson
-HP:hewlett-packard
-Minolta:minolta-qms
-Okidata:oki:OKI DATA CORP
-Xerox
-Lexmark:Lexmark International
diff --git a/usr/src/cmd/print/scripts/ppdfilename2mmp b/usr/src/cmd/print/scripts/ppdfilename2mmp
deleted file mode 100644
index 1d24c0af99..0000000000
--- a/usr/src/cmd/print/scripts/ppdfilename2mmp
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-#
-# Get the make/model/nickname as well as the repository/label from ppdfilename
-#
-
-# Input
-# ppdfilename
-# /var/lp/ppd/user/HP/foo.ppd.gz
-# Output
-# make
-# model
-# label(repository letter): driver
-#
-# Lexmark
-# IBM Page Printer 3112
-# foomatic(L): Foomatic/hpijs
-#
-
-if [[ $# -lt 1 ]]; then
- exit 1
-fi
-
-cachefile=/var/lp/ppd/ppdcache
-[[ -f $cachefile ]] || exit 1
-
-cacheentry=$(/bin/grep "$1" $cachefile)
-[[ -n "$cacheentry" ]] || exit 1
-
-#
-# Retrieve the manufacturer (make)
-# Use only the first word in manufacturer entry
-#
-manuf=$(echo "$cacheentry" |
-nawk '{FS=":"; print $1}' |
-nawk '{print $1}')
-
-# Retrieve the model
-model=$(echo "$cacheentry" | nawk '{FS=":"; print $2}')
-
-# Retrieve the driver
-driver=$(echo "$cacheentry" | nawk '{FS=":"; print $3}')
-
-#
-# Retrieve the PPD path. Parse the PPD path to get the
-# label path and to figure out the repository letter
-# associated with the label path. Note:
-# the PPD file name is the 6th colon separated entry
-# in the cache entry. This is may need to be modified if the
-# format changes.
-#
-ppdpath=$(echo "$cacheentry" | /bin/nawk '{FS=":"; print $6}' )
-manupath=$(/bin/dirname "$ppdpath")
-labelpath=$(/bin/dirname "$manupath")
-
-case "$labelpath" in
-/usr/share/ppd/*)
- repltr=S
- ;;
-/opt/share/ppd/*)
- repltr=V
- ;;
-/usr/local/share/ppd/*)
- repltr=A
- ;;
-/var/lp/ppd/*)
- repltr=U
- ;;
-esac
-
-[[ -n "${repltr}" ]] || exit 1
-echo "${manuf}\n${model}"
-echo "$(/bin/basename "$labelpath")(${repltr}): $driver"
-
-exit 0
diff --git a/usr/src/cmd/print/scripts/ppdmgr b/usr/src/cmd/print/scripts/ppdmgr
deleted file mode 100644
index 335c01da7d..0000000000
--- a/usr/src/cmd/print/scripts/ppdmgr
+++ /dev/null
@@ -1,1765 +0,0 @@
-#!/bin/ksh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# Description: Script to generate the Solaris printmgr 'ppdcache' file from the
-# ppd files installed in the given ppd database directory
-#
-# ppdmgr -a <ppd_filename_path> [ -L <label> ] [-w]
-# ppdmgr -g <ppd_filename_path> [ -L <label> ] [ -R <ppd_repository> ]
-# ppdmgr -r [ -L <label> ] [ -R <ppd_repository> ]
-# ppdmgr -u [ -L <label> ] [ -R <ppd_repository> ]
-#
-# Options:
-# -a <ppd_filename_path> - Add a new PPD file to the specified
-# label in the "user" repository, and
-# updates to the "user" repository
-# in the ppdcache.
-# -g <ppd_filename_path> - Generate a cache file entry
-# for the specified PPD file
-# on standard out.
-# -L <label> - Label name. <label>
-# can be any characters from the
-# portable character set, however
-# may not contain a semi-colon (':').
-# The following are the defaults
-# for <label> for each option:
-# OPTION DEFAULT LABEL
-# ------ -------------
-# -a <label> from <ppd_filename_path>
-# if <ppd_filename_path>
-# is from a known repository,
-# otherwise defaults to "user".
-# -g <label> from <ppd_filename_path>
-# if <ppd_filename_path>
-# is from a known repository,
-# otherwise defaults to "user".
-# -r all
-# -u all
-# The following are reserved labels:
-# caches - may never be specified
-# ppdcache - may never be specified
-# manufaliases - may never be specified
-# all - applies specified
-# action to all labels
-# in a repository.
-# Can only be specified
-# with -r or -u.
-# SUNW* - anything starting with
-# SUNW is reserved for
-# use by Sun, but not
-# prohibited.
-# -r - Rebuild the cache information for the
-# specified label in the specified
-# repository. Similar to -u, however,
-# the cache file is removed to force an
-# update to the ppdcache.
-# -R <ppd_repository> - PPD repository name.
-# Defaults to "user".
-# The following are the possible
-# values for <ppd_repository> and
-# location in the system:
-# REP LOCATION
-# --- --------
-# user /var/lp/ppd
-# admin /usr/local/share/ppd
-# vendor /opt/share/ppd
-# system /usr/share/ppd
-# all all repositories
-#
-# Note: When specified with the -a option
-# only "user" and "admin" are valid.
-# "vendor", "system", and "all" will be
-# considered reserved.
-# -u - Update the PPD cache information
-# for the specified label in the specified
-# repository if needed. If the cache
-# update was required, then the updated
-# cache information is reflected in
-# the ppdcache.
-# -w - Display full path of where the
-# ppd file is located on the system.
-# Only valid with -a, otherwise the
-# option is ignored.
-#
-# If -a, -g, -r, or -u are specified on the command line, only the last action
-# specified will be performed.
-#
-# Cache file entry format:
-# <ModifiedManufacturerName>:<Model>:<NickName>:<1284DeviceIDManufacturer>:<1284DeviceIDModel>:<FullPPDFilePath>
-# HP:HP DeskJet 450:Foomatic/hpijs (recommended):dj450:hp:/usr/share/ppd/HP/HP-DeskJet_450-hpijs.ppd.gz
-#
-
-PATH=/bin:/usr/bin:/usr/sbin export PATH
-set -o noclobber
-
-TEXTDOMAIN="SUNW_OST_OSCMD"
-export TEXTDOMAIN
-
-#
-# Generates debug output for calling routine.
-# If calling routine's name is passed in, then
-# will also generate the name of the calling routine.
-#
-# $1 - Name of calling routine
-debugger()
-{
- [[ ${debug} -eq 1 ]] || return 1
- if [[ -n "${1}" ]] ; then
- echo "In ${1}..." 1>&2
- fi
- return 0
-}
-
-#
-# Set the ownership and permissions on a file.
-#
-# $1 - Mode
-# $2 - Owner:Group
-# $3 - Full path to file
-#
-set_perms()
-{
- /bin/chmod -f ${1} "${3}" >/dev/null 2>&1
- /bin/chown -f ${2} "${3}" >/dev/null 2>&1
-}
-
-#
-# Create administrator repository directories, /usr/local/share/ppd,
-# if needed. This is a special case a Solaris doesn't deliver
-# /usr/local/share and it has different permissions than the
-# user repository.
-#
-# $1 - destination repository name
-#
-create_adminrep_dirs()
-{
- if debugger "check_adminrep_dirs" ; then
- set -x
- fi
-
- # Only create administrator repository directories, if needed.
- [[ "${1}" = "${ADMIN}" ]] || return 0
-
- # Check /usr/local/share/ppd
- [[ ! -d "${ADMINREP}" ]] || return 0
-
- # Check /usr/local/share
- admpar=$(/bin/dirname "${ADMINREP}")
- if [[ ! -d "${admpar}" ]] ; then
-
- # Check /usr/local
- admppar=$(/bin/dirname "${admpar}")
- if [[ ! -d "${admppar}" ]] ; then
- make_dir ${DIRMODE} ${ADMINOWNER} "${admppar}" || \
- return 1
- fi
- make_dir ${DIRMODE} ${ADMINOWNER} "${admpar}" || return 1
- fi
- make_dir ${DIRMODE} ${ADMINOWNER} ${ADMINREP} || return 1
- return 0
-}
-
-#
-# Returns full path to PPD file that was added to the system.
-#
-# $1 - Full path to source PPD file
-# $2 - PPD file name
-# $3 - Full path to repository
-# $4 - Repository name
-# $5 - Label name
-#
-# Return codes:
-# 0 - File successfully added
-# 1 - Error
-# 2 - Duplicate file already exists
-#
-add_ppd()
-{
- if debugger ; then
- set -x
- fi
-
- verify_ppd_file "${1}"
- if [[ $? -ne 0 ]] ; then
- gettext "invalid PPD file: ${1}" 2>/dev/null
- return 3
- fi
-
- # The destination path can now be set
- dstlabelpath="${3}/${5}"
- dstmanufpath="${dstlabelpath}/${modmanuf}"
- dstpath="${dstmanufpath}/${2}"
-
- #
- # If a version (either compressed or not compressed) of the PPD
- # file exists in the destination in the label/repository,
- # then just return as there no work to be done.
- dst_copy_path=$(variant_copy "${1}" "${dstpath}" "${6}" "${ppdfname}")
- ap_rc=$?
- if [[ ${ap_rc} -ne 0 ]] ; then
- echo "${dst_copy_path}"
- return ${ap_rc}
- fi
-
- #
- # Can only add a PPD file to the "user" or "admin" repository.
- # Note: this check is here instead of at the top of this
- # function as we don't want to cause an error if a user
- # specifies the same repository and label as a the specified
- # ppd file and the repository of the specified ppd file
- # exists in a known repository.
- #
- if [[ "${4}" != "${USER}" && "${4}" != "${ADMIN}" ]] ; then
- gettext "invalid PPD file repository name: ${4}" 2>/dev/null
- return 3
- fi
-
- # Ensure destination directories exist
- if ! create_adminrep_dirs ${4} ${DIRMODE} ${ADMINOWNER} || \
- ! make_dir ${DIRMODE} ${DIROWNER} "${3}" || \
- ! make_dir ${DIRMODE} ${DIROWNER} "${dstlabelpath}" || \
- ! make_dir ${DIRMODE} ${DIROWNER} "${dstmanufpath}" ; then
- gettext "unable to create destination directories" 2>/dev/null
- return 3
- fi
-
- # Copy source PPD file, and compress if needed, to destination
- if [[ "${ppdfileext}" = "${PEXT}" ]] ; then
- ${GZIP} "${1}" >"${dst_copy_path}" 2>/dev/null
- if [[ $? -eq 1 ]] ; then
- gettext "unable to copy PPD file " 2>/dev/null
- gettext "to destination" 2>/dev/null
- return 3
- fi
- else
- /bin/cp -f "${1}" "${dst_copy_path}" >/dev/null 2>&1
- if [[ $? -ne 0 ]] ; then
- gettext "unable to copy PPD file " 2>/dev/null
- gettext "to destination" 2>/dev/null
- return 3
- fi
- fi
- set_perms ${FILEMODE} ${FILEOWNER} "${dst_copy_path}"
-
- echo "${dst_copy_path}"
-
- return 0
-}
-
-#
-# Returns 0 if the cache needs to be modified, otherwise
-# returns 1.
-#
-# $1 - Full path to cache
-# $2 - Full path to cache replacement candidate
-#
-changes_in_cache()
-{
- if debugger "changes_in_cache" ; then
- set -x
- fi
-
- if [[ "${action}" = "${REBUILD}" ]] ; then
- return 0
- fi
- [[ "${2}" -nt "${1}" ]] || return 1
- if $(${CMP} "${1}" "${2}" >/dev/null 2>&1) ; then
- # No differences. Just update timestamp
- /bin/touch -r "${2}" "${1}" >/dev/null 2>&1
- return 1
- else
- return 0
- fi
-}
-
-#
-# Generate a new golden cache file (/var/lp/ppd/ppdcache), by
-# concatenating and sorting all existing cache files in /var/lp/ppd/caches.
-#
-# If there are difference between the newly generated golden cache file and
-# the existing one (if it exists) then the newly generated one replaces the
-# existing one at /var/lp/ppd/ppdcache.
-#
-update_golden_cache()
-{
-
- if debugger "update_golden_cache" ; then
- set -x
- fi
-
- #
- # Remove any cache files that don't have an associated
- # label.
- #
- for cname in $(/bin/ls ${VARCACHES} 2>/dev/null) ; do
- repname="${cname%%:*}"
- cfile="${cname#*:}"
- checkdir="$(get_rep_path ${repname})/${cfile}"
- remove_unassociated_cache "${checkdir}" "${cname}"
- done
-
- #
- # Combine the contents of all cache files into a
- # temporary golden cache file.
- #
- tmpgoldencache=$ppdmgrtmpdir/tmpgoldencache
-
- /bin/sort "${VARCACHES}"/* >>"${tmpgoldencache}" 2>/dev/null
-
- if [[ ! -s "${tmpgoldencache}" ]] ; then
- # No cache files. Remove golden cache.
- /bin/rm -f "${GOLDCACHE}" >/dev/null 2>&1
- /bin/rm -f "${tmpgoldencache}" >/dev/null 2>&1
- elif [[ -e "${GOLDCACHE}" ]] ; then
- #
- # Use the newly generated "temporary" golden cache file if there
- # differences between the current and newly generated ppdcache
- # or if a rebuild is being performed.
- #
- if [[ "${VARCACHES}" -nt "${GOLDCACHE}" ]] || \
- changes_in_cache "${GOLDCACHE}" "${tmpgoldencache}" ; then
- set_perms ${FILEMODE} ${FILEOWNER} "${tmpgoldencache}"
- /bin/mv -f "${tmpgoldencache}" \
- "${GOLDCACHE}" >/dev/null 2>&1
- else
- /bin/rm -f "${tmpgoldencache}" >/dev/null 2>&1
- fi
- else
- # There wasn't an existing ppdcache. Install the newly
- # generated ppdcache file to the golden ppdcache.
- set_perms ${FILEMODE} ${FILEOWNER} "${tmpgoldencache}"
- /bin/mv -f "${tmpgoldencache}" "${GOLDCACHE}" >/dev/null 2>&1
- fi
-}
-
-#
-# Returns a list of PPD files that exist.
-#
-# $1 - Full path to cache file
-#
-remove_invalid_cache_entries()
-{
- if debugger ; then
- set -x
- fi
-
- [[ -s "${1}" ]] || return
-
- IFS="$NoSpaceTabIFS"
- for centry in $(/bin/cat "${1}" 2>/dev/null) ; do
- IFS="$SaveIFS"
- #
- # Keep the entry from the ppd cache if it still
- # exists and there haven't been any modifications
- # since the last update to the cache.
- #
- if [[ -n "${centry}" ]] ; then
- ppdfile="${centry##*:}"
- if [[ -n "${ppdfile}" && -e "${ppdfile}" &&
- "${1}" -nt "${ppdfile}" ]] ; then
- echo "${centry}"
- fi
- fi
- IFS="$NoSpaceTabIFS"
- done
- IFS="$SaveIFS"
-}
-
-#
-# Returns 0 if the path to the PPD is as follows:
-# <PPD file repository>/<label>/<manufacturer>/<PPD file>
-# otherwise, returns 1
-#
-# $1 Full path to PPD file
-#
-verify_ppd_location()
-{
- if debugger ; then
- set -x
- fi
-
- #
- # Strip off what should be <label>/<manufacturer>/<PPD file>
- # and verify the PPD file repository matches one of the
- # known PPD file repositories.
- #
- ppd_file_repository=${1%/*/*/*}
- found=1
- for repository in ${REPOSITORIES} ; do
- if [[ "${repository}" = "${ppd_file_repository}" ]] ; then
- found=0
- break
- fi
- done
- return ${found}
-}
-
-#
-# Generate, and sort, cache entries for each PPD files in the specified
-# list to the specified file.
-#
-# $1 - List of full paths to PPD files
-# $2 - Full path to current cache file
-# $3 - Full path to label
-# $4 - Full path to new cache file to generate
-#
-# Return code:
-# 0 success
-# 1 unsuccessful
-#
-generate_label_cache_file()
-{
- if debugger ; then
- set -x
- fi
-
- #
- # Generate a cache file containing cache entries for
- # all files in the label.
- #
- ucfile=$ppdmgrtmpdir/unsortedcache
-
- #
- # Before processing new files, remove any cache entries
- # which may be invalid.
- #
- valid_files=
- if [[ -e "${2}" && "${action}" != "${REBUILD}" ]] ; then
- valid_files=$(remove_invalid_cache_entries "${2}")
- if [[ -n "${valid_files}" ]] ; then
- echo "${valid_files}" >>${ucfile}
- fi
- fi
-
- #
- # If there are no valid PPD files in the current cache file,
- # and there are no new PPD files to process, the only thing
- # left to do is to remove the current cache file.
- #
- if [[ -z "${valid_files}" && -z "${1}" ]] ; then
- /bin/rm -f "${2}" >/dev/null 2>&1
- /bin/rm -f "${ucfile}" >/dev/null 2>&1
- return 0
- fi
-
- #
- # For each of the label's PPD files, generate
- # a cache file entry and add it to the cache file.
- #
- vpl_rc=0
- vpf_rc=0
- vpl_msg=
- vpf_msg=
- IFS="$NoSpaceTabIFS"
- for fname in ${1} ; do
- IFS="$SaveIFS"
- if [[ -n "${fname}" ]] ; then
- verify_ppd_location "${fname}"
- vpl_rc=$?
- if [[ ${vpl_rc} -ne 0 ]] ; then
- vpl_msg="${vpl_msg}\t${fname}\n"
- fi
-
- verify_ppd_file "${fname}"
- vpf_rc=$?
- if [[ ${vpf_rc} -ne 0 ]] ; then
- vpf_msg="${vpf_msg}\t${fname}\n"
- fi
-
- if [[ ${vpl_rc} -eq 0 && ${vpf_rc} -eq 0 ]] ; then
- echo "$(generate_cache_file_entry \
- "${modmanuf}" "${model}" "${nickn}" \
- "${devidmfg}" "${devidmdl}" "${fname}")"
- fi
- fi
- IFS="$NoSpaceTabIFS"
- done >>"${ucfile}"
- IFS="$SaveIFS"
- /bin/sort -u "${ucfile}" >>"${4}" 2>/dev/null
- /bin/rm -f "${ucfile}" >/dev/null 2>&1
-
- [[ -n "${vpl_msg}" || -n "${vpf_msg}" ]] || return 0
- if [[ -n ${vpl_msg} ]] ; then
- gettext " PPD file(s) not in valid location\n" 2>/dev/null
- gettext \
- " (<repository>/<label>/<manufacturer>/<PPD file>):\n" 2>/dev/null
- echo "${vpl_msg}"
- fi
- if [[ -n ${vpf_msg} ]] ; then
- gettext " invalid PPD file(s):\n" 2>/dev/null
- echo "${vpf_msg}"
- fi
- return 1
-}
-
-#
-# Update current cache file with candidate cache file if there are
-# differences.
-#
-# $1 - Current cache file
-# $2 - Candidate cache file to update
-# $3 - Repository name
-#
-update_current_cache_file()
-{
- if debugger "update_current_cache_file" ; then
- set -x
- fi
-
- if [[ ! -s "${2}" ]] ; then
- #
- # Candidate cache has zero size (label
- # directory with no PPD files under it).
- # Delete the empty candidate cache
- # file and delete the current cache
- # file.
- #
- /bin/rm -f "${1}" >/dev/null 2>&1
- /bin/rm -f "${2}" >/dev/null 2>&1
- elif [[ -e "${1}" ]] ; then
- #
- # If there are differences between the current
- # cache file and the newly generated one, then
- # replace the current one with the new one, and
- # set the flag to update the golden ppdcache
- # file.
- #
- if changes_in_cache "${1}" "${2}" ; then
- set_perms ${FILEMODE} ${FILEOWNER} "${2}"
- /bin/mv -f "${2}" "${1}" >/dev/null 2>&1
- else
- /bin/rm -f "${2}" >/dev/null 2>&1
- fi
- else
-
- #
- # There is no current cache file. Move the candidate
- # to the caches directory.
- #
- set_perms ${FILEMODE} ${FILEOWNER} "${2}"
- /bin/mv -f "${2}" "${1}" >/dev/null 2>&1
- fi
-}
-
-#
-# Returns 0 if there are files in $1 with newer timestamp
-# than $2 or if deletions have occurred under $1,
-# otherwise returns 1.
-#
-# $1 - Full path to the destination label
-# $2 - Full path to label cache file
-#
-changes_under_label()
-{
- if debugger ; then
- set -x
- fi
-
- # First check for newer files in the directory
- if [[ -e "${2}" && "${action}" != "${REBUILD}" ]] ; then
- newfiles=$(/bin/find "${1}" -type f -newer "${2}")
- else
- newfiles=$(/bin/find "${1}" -type f)
- fi
- echo "${newfiles}"
- [[ -z "${newfiles}" ]] || return 0
-
- #
- # Need to detect if PPD files have been deleted by checking
- # timestamps on label and manufacturer directories.
- #
- [[ ! "${1}" -nt "${2}" ]] || return 0
- /bin/find "${1}" -type d -newer "${2}" >/dev/null 2>&1 || return 1
- return 0
-}
-
-#
-# If -R was specified, or the timestamp on the specified label's
-# directory or any of the PPD files under the specified label in
-# the specified PPD file respository is newer than the cache file
-# associated with the label, then generate a new sorted cache file.
-#
-# The new cache will replace the existing one (if any) only if there
-# are differences. Note: if -r was specified, then a new cache file
-# file will always be installed at
-# /var/lp/ppd/caches/<PPD file repository name>-<label name>
-#
-# $1 - Full path of the destination PPD file repository
-# $2 - Destination PPD file repository name
-# $3 - Destination label name
-#
-update_label_cache()
-{
- if debugger ; then
- set -x
- fi
-
- dstlabelpath="${1}/${3}"
- replabelcachepath="${1}/${CACHES}/${3}"
- varlabelcachepath="${VARCACHES}/${2}${SEP}${3}"
-
- ulc_rc=0
- if [[ -d "${dstlabelpath}" ]] ; then
-
- #
- # If the cache doesn't exist for a label,
- # or if there were any changes under a label
- # (i.e., the timestamp on the label directory or any
- # of the PPD files under it is newer than the
- # existing cache file), then generate a new cache file.
- #
- tmpcachepath=$ppdmgrtmpdir/tmpcachepath
-
- # if this is a system repository, check for a prepopulated cache
- if [[ "${2}" = "${SYSTEM}" && -e ${FOOCACHEDIR}/${3}.cache ]] ; then
- # copy prepopulated cache
- /bin/cp -f ${FOOCACHEDIR}/${3}.cache ${tmpcachepath}
-
- else
- newfileslist=$(changes_under_label "${dstlabelpath}" \
- "${varlabelcachepath}")
- if [[ $? -eq 0 ]] ; then
- err_files=$(generate_label_cache_file \
- "${newfileslist}" "${varlabelcachepath}" \
- "${dstlabelpath}" "${tmpcachepath}")
- if [[ $? -ne 0 ]] ; then
- #
- # At least one PPD file was invalid.
- # Don't return yet, as the cache info
- # for the valid PPD files can still be
- # used to generate a cache file.
- #
- echo "${err_files}"
- ulc_rc=1
- fi
- fi
- fi
-
- if [[ -e "${tmpcachepath}" ]] ; then
- update_current_cache_file \
- "${varlabelcachepath}" "${tmpcachepath}" "${2}"
- /bin/rm -f "${tmpcachepath}" >/dev/null 2>&1
- fi
- else
- #
- # If there is a cache file in /var/lp/ppd/caches associated
- # with the label which no longer exists, remove it.
- #
- /bin/rm -f "${varlabelcachepath}" >/dev/null 2>&1
- fi
- return ${ulc_rc}
-}
-
-#
-# Returns the alias for the specified real manufacturer's name.
-#
-# $1 - Real manufacturer's name
-# $2 - File containing list of files that have manufacturers aliases
-#
-manuf_name_alias()
-{
- if debugger ; then
- set -x
- fi
-
- #
- # Found a couple of PPD files which had special characters
- # in the Manufacturer name (i.e, the following is the Manufacturer
- # entry:
- # *Manufacturer: "Canon Inc. (Kosugi Offic"
- # We'll only search the alias file for "Canon Inc."
- #
- tmpmanuf="${1% *\(*}"
-
- # Search alias files for a match on the real manufacturer name
- if [[ -s "${2}" ]] ; then
- #
- # Check the manufacturer aliases file for case
- # insensitive match of the Manufacturer entry
- # from the PPD file. If a match is found,
- # then modify the manufacturer entry to
- # be that of the specified alias.
- #
- manufaliases=$(/bin/egrep -i \
- "^${tmpmanuf}:|:${tmpmanuf}:|:${tmpmanuf}$" "${2}")
- if [[ -n "${manufaliases}" ]] ; then
- echo "${manufaliases%%:*}"
- break
- else
- echo "${tmpmanuf}"
- fi
- else
- echo "${tmpmanuf}"
- fi
-}
-
-#
-# Returns 0 if the extension to the specified PPD file is a known
-# extension, otherwise returns 1.
-#
-# $1 - Full path to PPD file
-#
-# Set upon return:
-# ppdfileext - PPD file ext (.ppd or .ppd.gz)
-#
-verify_file_ext()
-{
- if debugger ; then
- set -x
- fi
-
- if [[ "${1%.gz}".gz = "${1}" ]] ; then
- ppdfileext=${GEXT}
- elif [[ "${1%.ppd}".ppd = "${1}" ]] ; then
- ppdfileext=${PEXT}
- else
- # invalid PPD file name extension
- return 1
- fi
-
- return 0
-}
-
-#
-# Return the lines from the specified PPD file matching the specified
-# spec items.
-#
-# $1 - spec entries from PPD file
-# $2 - spec item
-#
-# $1 example - 1 string with substrings separated by newline:
-# *PPD-Adobe: "4.3"
-# *Manufacturer: "HP"
-# *Product: "(officejet 4200 series)"
-# *ModelName: "HP OfficeJet 4200"
-# *NickName: "HP OfficeJet 4200 Foomatic/hpijs (recommended)"
-# $2 example:
-# ^\*Manufacturer
-#
-spec_entry()
-{
- if debugger ; then
- set -x
- fi
-
- item=$(echo "${1}" | /bin/grep ${2})
- # Remove everything up to and including the first quote
- item=${item#*\"}
- # Remove the end quote
- echo "${item%\"}"
-}
-
-#
-# Return the lines from the specified PPD file matching the specified
-# spec items.
-#
-# Note: this is similar to spec_entry() except the tokens in the
-# spec entry are different.
-#
-# $1 - spec entries from PPD file
-# $2 - spec item
-#
-devid_spec_entry()
-{
- if debugger ; then
- set -x
- fi
-
- item=$(echo "${1}" | /bin/grep ${2})
- # Remove everything up to and including the first semi-colon
- item=${item#*\:}
- # Remove the end quote
- echo ${item%\;}
-
-}
-
-#
-# Verifies that the specified PPD file
-# - has a valid extension
-# - has the following required spec file entries:
-# *PPD-Adobe: "4.3"
-# Manufacturer
-# Product
-# ModelName
-# NickName
-#
-# In addition, the manufacture and model from the IEEE1284 device id
-# information will be gathered here, although it's not an error that
-# it isn't in the PPD file as many don't contain the IEEE1284 info.
-#
-# $1 - Full path to PPD file
-#
-# Return codes:
-# 0 success
-# 1 invalid PPD file
-#
-verify_ppd_file()
-{
- if debugger ; then
- set -x
- fi
-
- ADOBESPEC="PPD-Adobe"
- MANUF="Manufacturer"
- PRODUCT="Product"
- MODEL="ModelName"
- NICKNAME="NickName"
- DEVID="1284DeviceID"
-
- # Verify the PPD file extension
- verify_file_ext "${1}" || return 1
-
- # Query for the required spec items
- searchentries="^\*${ADOBESPEC}:|^\*${MANUF}:|^\*${PRODUCT}:"
- searchentries="${searchentries}|^\*${MODEL}:|^\*${NICKNAME}:"
- searchentries="${searchentries}|^\*${DEVID}:"
- ppd_info="$(/bin/gzgrep -e "${searchentries}" "${1}")"
-
- #
- # Process the query results to verify each of the required spec
- # file items appears in the PPD file.
- #
- for spec_item in ${ADOBESPEC} ${MANUF} ${PRODUCT} ${MODEL} \
- ${NICKNAME} ; do
- entry=$(spec_entry "${ppd_info}" "^\*${spec_item}:")
- [[ ! -z "${entry}" ]] || return 1
- case ${spec_item} in
- ${MANUF})
- realmanuf="${entry}"
- ;;
- ${PRODUCT})
- product="${entry}"
- ;;
- ${MODEL})
- model="${entry}"
- ;;
- ${NICKNAME})
- #
- # Remove the model and any commas and spaces
- # which appear before the driver
- #
- nickn="${entry#$model[, ]*}"
- ;;
- esac
-
- done
-
- # Save IEEE1284 device id information
- if $(echo "${ppd_info}" | grep "${DEVID}" >/dev/null 2>&1) ; then
- DMDL="MDL"
- DMFG="MFG"
- devid="$(/bin/gzgrep -e "^[ ]*${DMDL}:|^[ ]*${DMFG}:" "${1}")"
- devidmdl="$(devid_spec_entry "${devid}" "${DMDL}")"
- devidmfg="$(devid_spec_entry "${devid}" "${DMFG}")"
- else
- devidmdl=
- devidmfg=
- fi
- modmanuf=$(manuf_name_alias "${realmanuf}" ${aliasfile})
-
- return 0
-}
-
-#
-# generate_cache_file_entry()
-#
-# Returns a cache file entry for the specified PPD file.
-#
-# $1 - modmanuf
-# $2 - model
-# $3 - nickn
-# $4 - devidmfg
-# $5 - devidmdl
-# $6 - Full path to the specified PPD file
-#
-generate_cache_file_entry()
-{
- if debugger "generate_cache_file_entry" ; then
- set -x
- fi
-
- echo "${1}":"${2}":"${3}":"${4}":"${5}":"${6}"
-}
-
-#
-# Expand specified file to the full path.
-#
-# $1 - File path to expand
-#
-# Return code set to 0 if expanded successfully, otherwise set to 1.
-#
-ppd_pathname()
-{
- if debugger ; then
- set -x
- fi
-
- if [[ -f "${1}" && -s "${1}" ]] ; then
- (cd "$(/bin/dirname "${1}")" ; \
- echo "$(/bin/pwd)/$(/bin/basename "${1}")") || return 1
- return 0
- else
- return 1
- fi
-}
-
-#
-# Returns the PPD repsitory path associated with the specified
-# PPD repository name.
-#
-# $1 - Repository name
-#
-get_rep_path()
-{
- if debugger ; then
- set -x
- fi
-
- case ${1} in
- ${SYSTEM})
- echo "${SYSTEMREP}"
- ;;
- ${VENDOR})
- echo "${VENDORREP}"
- ;;
- ${ADMIN})
- echo "${ADMINREP}"
- ;;
- ${USER})
- echo "${USERREP}"
- ;;
- *)
- echo "${UNSET}"
- ;;
- esac
-}
-
-#
-# Returns the PPD respository name from the repository path
-#
-# $1 - PPD repository path
-#
-get_rep_name()
-{
- if debugger ; then
- set -x
- fi
-
- case ${1} in
- ${SYSTEMREP})
- echo "${SYSTEM}"
- ;;
- ${VENDORREP})
- echo "${VENDOR}"
- ;;
- ${ADMINREP})
- echo "${ADMIN}"
- ;;
- ${USERREP})
- echo "${USER}"
- ;;
- "all")
- echo "all"
- ;;
- *)
- echo "${UNSET}"
- ;;
- esac
-}
-
-#
-# Returns 0 if a matching label name is found in the specified repository,
-# otherwise returns 1.
-#
-# $1 - repository path
-# $2 - label name
-#
-label_path_in_repository()
-{
- if debugger "label_path_in_repository" ; then
- set -x
- fi
-
- [[ "${1}" != "" && "${2}" != "" ]] || return 1
- lpir_rc=1
- for repository in ${REPOSITORIES} ; do
- if [[ "${repository}" = "${1}" && -d "${1}/${2}" ]] ; then
- lpir_rc=0
- break
- fi
- done
- return ${lpir_rc}
-}
-
-#
-# Returns 0 if the source label path is the same
-# as the destination label path, otherwise returns 1.
-#
-# $1 - full path to source PPD file (source label path)
-# $2 - destination repository path
-# $3 - destination label name
-#
-label_path_match()
-{
- if debugger "label_path_match" ; then
- set -x
- fi
-
- # dest repository not specified
- if [[ "${2}" = "${UNSET}" ]] ; then
- # dest label not specified
- if [[ "${3}" = "${UNSET}" ]] ; then
- #
- # We've found a match if the label path is in a known
- # repository.
- #
- lpath="${1%/*/*}"
- label_path_in_repository \
- "${1%/*/*/*}" "${lpath##*/}" || return 1
- else
- #
- # If the source label path exists in the
- # in a known repository, and the destination
- # label is the same as the source label,
- # then we'll assume the default destination
- # repository is the same as the source
- # destination repository.
- #
- [[ "${1%/*/*}" = "${1%/*/*/*}/${3}" ]] || return 1
- label_path_in_repository "${1%/*/*/*}" "${3}" || \
- return 1
- fi
-
- # dest repository specified, dest label not specified
- elif [[ "${3}" = "${UNSET}" ]] ; then
- #
- # If the destination repository path is the same as the
- # source repository, and if the source label exists in the
- # destination repository path, then we'll assume the default
- # destination label is the same as the source label.
- #
- [[ "${2}" = "${1%/*/*/*}" ]] || return 1
- lpath="${1%/*/*}"
- label_path_in_repository "${2}" "${lpath##*/}" || return 1
-
- # dest repository and dest label specified.
- else
- #
- # We've found a match if the destination and label
- # match those of the source label path, and the source
- # label path is in a known repository.
- #
- [[ "${1%/*/*}" = "${2}/${3}" ]] || return 1
- label_path_in_repository "${2}" "${3}" || return 1
- fi
- return 0
-}
-
-#
-# Returns 0 if specified label name is a reserved label, otherwise
-# returns 1.
-#
-# $1 - label name
-#
-reserved_label()
-{
- if debugger ; then
- set -x
- fi
-
- rl_rc=1
- for labelname in ${RESERVEDLABELS} ; do
- if [[ "${1}" = "${labelname}" ]] ; then
- rl_rc=0
- break
- fi
- done
- return ${rl_rc}
-}
-
-#
-# Returns a list of all labels that exist in a repository that are
-# not reserved labels.
-#
-# $1 - Full path of repository
-# $2 - Repository name
-#
-get_rep_label_list()
-{
- if debugger ; then
- set -x
- fi
-
- #
- # Get a list of all labels that exist in all of the
- # PPD file repository.
- #
- for lname in $(/bin/ls "${1}" 2>/dev/null) ; do
- if [[ -d "${1}/${lname}" ]] ; then
- if ! reserved_label "${lname}" ; then
- echo "${lname} "
- fi
- fi
- done
-}
-
-#
-# Returns a valid PPD label.
-#
-# Verifies the specified PPD label is a valid label. If the
-# label is not set, then it is set to a default value.
-#
-# Return code set to 0 if the specified PPD label is valid, otherwise 1.
-#
-# $1 - PPD label
-#
-valid_specified_label()
-{
- if debugger ; then
- set -x
- fi
-
- # Verify the specified label
- vsl_rc=0
- case "${1}" in
- "all")
- # Reserved label name with -a or -g options
- if [[ "${action}" = "${ADD}" || \
- "${action}" = "${GENERATEENTRY}" ]] ; then
- print -n "$myprog: " 1>&2
- gettext "reserved PPD label name: ${1}\n" 1>&2
- vsl_rc=1
- else
- echo "${1}"
- fi
- ;;
-
- "ppdcache" | "caches" | "manufaliases")
- # Reserved label names with any option
- print -n "$myprog: " 1>&2
- gettext "reserved PPD label name: ${1}\n" 1>&2
- vsl_rc=1
- ;;
-
- "" | "${UNSET}")
- # Label name not specified. Set the default label name.
- # For -g and -a, default is "user", otherwise, default
- # is "all".
- if [[ "${action}" = "${ADD}" || \
- "${action}" = "${GENERATEENTRY}" ]] ; then
- echo "${USER}"
- else
- echo "all"
- fi
- ;;
-
- *)
- # label cannot be "." or ".."
- if [[ "${1}" = "." || "${1}" = ".." ]] ; then
- print -n "$myprog: " 1>&2
- gettext "PPD label name cannot be " 1>&2
- gettext "\".\" or \"..\"\n" 1>&2
- vsl_rc=1
- fi
-
- # Label name cannot contain special characters
- echo "${1}" | /bin/egrep "${SPECIALCHARS}" >/dev/null
- if [[ $? -eq 0 ]] ; then
- print -n "$myprog: " 1>&2
- gettext "PPD label name contains " 1>&2
- gettext "an invalid character: ${1}\n" 1>&2
- vsl_rc=1
- else
- echo "${1}"
- fi
- ;;
- esac
- return ${vsl_rc}
-}
-
-#
-# Returns the full path of any variant copy of the source file in
-# the destination label/repository.
-#
-# $1 - Full path to source PPD file
-# $2 - Full path to destination PPD file
-#
-# Return code set to
-# 0 - Copy doesn't exist
-# 1 - Duplicate copy exists
-# 2 - Variant copy exists
-#
-variant_copy()
-{
- if debugger ; then
- set -x
- fi
-
- #
- # First make sure there is not a .ppd and a .ppd.gz version
- # of the destination file; users should know not to do this.
- #
- if [[ -e "${2%.gz}" && -e "${2%.gz}.gz" ]] ; then
- /bin/rm -f "${2%.gz}" >/dev/null 2>&1
- fi
-
- # Use gzcmp to compare PPD files as it can deal with
- # gzipped or regular files.
- if $(${GZCMP} "${1}" "${2}"* >/dev/null 2>&1) ; then
- echo "${2}"*
- return 1
- elif [[ -e "${2%.gz}" ]] ; then
- echo "${2%.gz}"
- return 2
- elif [[ -e "${2%.gz}.gz" ]] ; then
- echo "${2%.gz}.gz"
- return 2
- else
- #
- # A PPD file doesn't exist in the destination
- # repository under the destination label.
- # Just display the source PPD file, ensuring
- # it has a gzip extension as we will always
- # try to gzip the copy in the destination.
- #
- if [[ "${1#*.ppd}" = ".gz" ]] ; then
- echo "${2}"
- else
- echo "${2}.gz"
- fi
- return 0
- fi
-}
-
-#
-# $1 - Directory mode
-# $2 - Directory owner (i.e., root:lp)
-# $3 - Directory to create
-#
-make_dir()
-{
- if debugger "make_dir" ; then
- set -x
- fi
-
- [[ ! -d "${3}" ]] || return 0
- /bin/mkdir "${3}" >/dev/null 2>&1 || return 1
- set_perms ${1} ${2} "${3}"
- return 0
-}
-
-#
-# Remove a ppdmgr generated cache (in /var/lp/ppd/cache)
-# if it doesn't have an associated label in the repository.
-#
-# $1 - Full path to label
-# $2 - Cache name
-#
-remove_unassociated_cache()
-{
- if debugger "remove_unassociated_cache" ; then
- set -x
- fi
-
- if [[ "${1}" != "${UNSET}" ]] ; then
- if [[ -n "${1}" && ! -d "${1}" ]] ; then
- #
- # The label doesn't exist, so delete
- # the associated cache file.
- #
- /bin/rm -f "${VARCACHES}/${2}" >/dev/null 2>&1
- fi
- fi
-}
-
-#
-# Sorted copies of cache files for each label in each PPD repository
-# are maintained in /var/lp/ppd/caches/<PPD respository>-<label>.
-# This is done so that changes in delivered cache files can be
-# detected. If a difference in cache files is detected, or a
-# cache file is either added or removed, then we know that
-# the ppdcache file needs to be updated.
-#
-# Get a list of all cache files and compare against the list
-# of labels in all of the PPD file repositories. They should
-# be the same. If there is a label in one of the PPD file
-# repositories that doesn't have an associated cache file, then
-# we don't worry about it now, as that will be resolved when
-# we update the cache for that label. However, if there is
-# a cache file associated with a label that no longer exists, then
-# remove the cache file.
-#
-# $1 - Full path to repository (or "all")
-# $2 - Label name
-#
-update_cache()
-{
- if debugger ; then
- set -x
- fi
-
- #
- # Determine which labels in which PPD repository the
- # cache file will be updated for.
- #
- if [[ "${1}" = "all" ]] ; then
- rname="${REPOSITORIES}"
- else
- rname="${1}"
- fi
-
- uc_rc=0
- for dstreppath in ${rname} ; do
- labellist=
- if [[ "${2}" = "all" ]] ; then
- dstrepname=$(get_rep_name "${dstreppath}")
- labellist=$(get_rep_label_list "${dstreppath}" \
- "${dstrepname}")
- else
-
- # Ensure the label exists in the PPD file repository.
- if [[ -d "${dstreppath}/${2}" ]] ; then
- labellist="${2}"
- fi
- fi
-
- #
- # Update the cache for each label in the PPD repository
- #
- for dstlabel in ${labellist} ; do
- ulc_msg=$(update_label_cache "${dstreppath}" \
- "${dstrepname}" "${dstlabel}")
- if [[ $? -ne 0 ]] ; then
- echo "${ulc_msg}"
- uc_rc=1
- fi
- done
- done
-
- # Update the golden cache file.
- update_golden_cache
- return ${uc_rc}
-}
-
-# $1 - exit status
-ppdmgr_exit()
-{
- if debugger "ppdmgr_exit" ; then
- set -x
- fi
-
- /bin/rm -rf "${ppdmgrtmpdir}" >/dev/null 2>&1
- exit ${1}
-}
-
-
-usage()
-{
- gettext "usage:\n" 1>&2
- print -n "\t$myprog: " 1>&2
- gettext "-a <ppd_filename_path> [ -L <label> ]\n" 1>&2
- gettext "\t\t[ -R <ppd_repository> ] [-w]\n" 1>&2
- print -n "\t$myprog: " 1>&2
- gettext "-r [ -L <label> ] [ -R <ppd_repository> ]\n" 1>&2
- print -n "\t$myprog: " 1>&2
- gettext "-u [ -L <label> ] [ -R <ppd_repository> ]\n" 1>&2
-
- ppdmgr_exit ${FAIL}
-}
-
-##########################################################################
-# main
-##########################################################################
-
-myprog=$(/bin/basename $0)
-
-SaveIFS="$IFS"
-NoSpaceTabIFS='
-'
-
-# Updatable PPD repository
-VARDIR=/var/lp/ppd
-
-# Delivered PPD respository
-SYSTEMREP=/usr/share/ppd
-ADMINREP=/usr/local/share/ppd
-VENDORREP=/opt/share/ppd
-USERREP=${VARDIR}
-
-RESERVEDREPS="${SYSTEMREP} ${ADMINREP} ${VENDORREP}"
-REPOSITORIES="${USERREP} ${RESERVEDREPS}"
-RESERVEDLABELS="all caches ppdcache manufaliases"
-
-# Directory where system:SUNWfoomatic is delivered
-FOOCACHEDIR=/usr/lib/lp/caches
-
-# Deliveries
-SYSTEM=system
-VENDOR=vendor
-ADMIN=admin
-USER=user
-
-# Sytem PPD cache name used by printmgr
-GOLDCACHE=${USERREP}/ppdcache
-
-# Delivered caches directory
-CACHES=caches
-MANUFALIASES=manufaliases
-
-# Updated caches directory
-VARCACHES=${VARDIR}/${CACHES}
-
-# valid PPD file name extensions
-PEXT=ppd
-GEXT=gz
-FILEEXTS=".${PEXT} .${PEXT}.${GEXT}"
-
-# Default modes and owners
-DIRMODE=755
-DIROWNER=root:lp
-ADMINOWNER=root:root
-FILEMODE=444
-FILEOWNER=root:lp
-
-# ppdmgr actions
-ADD=add
-GENERATEENTRY=generateentry
-UPDATE=update
-REBUILD=rebuild
-
-SUCCESS=0
-FAIL=1
-WARN=2
-
-MAXLABELNAME=256
-GZIP="/bin/gzip -c"
-GZCMP="/bin/gzcmp -s"
-CMP="/bin/cmp -s"
-SPECIALCHARS=":"
-SEP=":"
-
-debug=0
-wflag=0
-status=${SUCCESS}
-
-UNSET=" "
-ppdlabel=${UNSET}
-ppdrepname=${UNSET}
-ppdreppath=${UNSET}
-modmanuf=
-model=
-nickn=
-devidmdl=
-devidmfg=
-
-ppdmgrtmpdir=$(/usr/bin/mktemp -t -d ppdmgr.XXXXXX)
-if [ -z "$ppdmgrtmpdir" ] ; then
- print -n "$myprog: " 1>&2
- gettext "Fatal error: could not create temporary directory\n" 1>&2
- exit 1
-fi
-
-aliasfile=${USERREP}/manufaliases
-tmpfilepath=
-
-
-OPTS=a:g:L:rR:uwZ
-while getopts "$OPTS" arg ; do
- case ${arg} in
- a) # add PPD file
- action=${ADD}
- origsrcppdpath=${OPTARG}
- ;;
-
- g) # create cache entry
- action=${GENERATEENTRY}
- origsrcppdpath=${OPTARG}
- ;;
-
- L) # PPD label name
- ppdlabel=${OPTARG}
- ;;
-
- r) # rebuild cache
- action=${REBUILD}
- ;;
-
- R) # PPD file repository to use
- ppdrepname=${OPTARG}
- ;;
-
- u) # update cache
- action=${UPDATE}
- ;;
-
- w) # display PPD file path
- wflag=1
- ;;
-
- Z) # debug
- debug=1
- ;;
-
- ?)
- usage
- ;;
- esac
-done
-
-if debugger "Main" ; then
- set -x
-fi
-
-if [[ $# -lt 1 || -z "${action}" ]] ; then
- usage
-fi
-
-# ignore wflag unless specified with -a
-if [[ ${wflag} -eq 1 && "${action}" != ${ADD} ]] ; then
- wflag=0
-fi
-
-#
-# Ensure the destination PPD repository directory is set
-# to match the specified repository. If the
-# destination PPD file repository was specified, then
-# it must be one of the following:
-# "user"
-# "admin"
-# "vendor"
-# "system"
-# "all"
-#
-case "${ppdrepname}" in
-"${SYSTEM}")
- ppdreppath="${SYSTEMREP}"
- ;;
-"${ADMIN}")
- ppdreppath="${ADMINREP}"
- ;;
-"${VENDOR}")
- ppdreppath="${VENDORREP}"
- ;;
-"${USER}")
- ppdreppath="${USERREP}"
- ;;
-"all")
- if [[ "${action}" = "${ADD}" || \
- "${action}" = "${GENERATEENTRY}" ]] ; then
- print -n "$myprog: " 1>&2
- gettext "reserved PPD repository name: " 1>&2
- gettext "${ppdrepname}\n" 1>&2
- ppdmgr_exit ${FAIL}
- fi
- ppdreppath="all"
- ;;
-"${UNSET}"|"")
- ppdreppath="${UNSET}"
- ;;
-
-*)
- print -n "$myprog: " 1>&2
- gettext "invalid PPD repository name: ${ppdrepname}\n" 1>&2
- ppdmgr_exit ${FAIL}
- ;;
-esac
-
-#
-# When a source PPD file's path is from a known repository, the
-# destination repository and desination label are assumed to be the
-# same as the source PPD file's unless a differing repository or label
-# was specified.
-#
-if [[ "${action}" = "${ADD}" || "${action}" = "${GENERATEENTRY}" ]] ; then
-
- srcppdpath=$(ppd_pathname "${origsrcppdpath}")
- ppd_pathname_rc=$?
- if [[ ${ppd_pathname_rc} -ne 0 ]] ; then
- print -n "$myprog: " 1>&2
- gettext "invalid PPD file: ${origsrcppdpath}\n" 1>&2
- ppdmgr_exit ${ppd_pathname_rc}
- fi
-
- # Path cannot contain special characters
- echo "${srcppdpath}" | /bin/egrep "${SPECIALCHARS}" >/dev/null
- if [[ $? -eq 0 ]] ; then
- print -n "$myprog: " 1>&2
- gettext "PPD path contains " 1>&2
- gettext "an invalid character: ${ppd_pathname}\n" 1>&2
- ppdmgr_exit ${FAIL}
- fi
- ppdfname=$(/bin/basename "${origsrcppdpath}")
-
- #
- # Check to see if there's any work to be done. If the source file
- # is already in the destination repository under the destination
- # label, then there's nothing left to do. We exit rather than
- # going on to do an update on the label in the repository as
- # it could possible take a long time to update. If an add was
- # requested, it could have come from an application, so we want
- # to return quickly.
- #
- if label_path_match "${srcppdpath}" "${ppdreppath}" "${ppdlabel}" ; then
- if [[ ${wflag} -eq 1 || \
- "${action}" = "${GENERATEENTRY}" ]] ; then
- echo "${srcppdpath}"
- fi
- ppdmgr_exit ${SUCCESS}
- fi
-fi
-
-ppdlabel=$(valid_specified_label "${ppdlabel}")
-if [[ $? -ne 0 ]] ; then
- ppdmgr_exit ${FAIL}
-fi
-
-if [[ "${ppdreppath}" = "${UNSET}" ]] ; then
- ppdreppath="${USERREP}"
-fi
-
-dstrepname=$(get_rep_name "${ppdreppath}")
-
-case "${action}" in
-"${ADD}")
- #
- # Attempt to add the PPD file to the repository under the
- # specified label. If any errors occur, final_dst_ppd_path
- # will contain the error message rather than the path to the
- # PPD file.
- #
- final_dst_ppd_path=$(add_ppd "${srcppdpath}" "${ppdfname}" \
- "${ppdreppath}" "${dstrepname}" "${ppdlabel}")
- add_ppd_rc=$?
- case ${add_ppd_rc} in
- 0) #
- # The PPD file was added. Update the specified
- # cache associated with the label if the PPD file
- # was added successfully and was not a duplicate.
- # Ensure any changes are also reflected in the
- # golden cache.
- #
- add_ppd_msg=$(update_label_cache "${ppdreppath}" \
- "${dstrepname}" "${ppdlabel}")
- apm_rc=$?
-
- echo "${add_ppd_msg}" | /bin/grep "${final_dst_ppd_path}"
- path_in_msg=$?
-
- #
- # Only report cache update errors if the file that was
- # added was one that was reported as not being added
- # to the cache. This really should happen as the file
- # was verified during the add.
- #
- if [[ ${apm_rc} -ne 0 && ${path_in_msg} -eq 0 ]] ; then
- print -n "$myprog: " 1>&2
- gettext "printer information does not reflect " 1>&2
- gettext "the\nfollowing PPD file(s):\n" 1>&2
- print "${add_ppd_msg}" 1>&2
- status=${FAIL}
- else
- update_golden_cache
-
- #
- # Display the full path to the added PPD file,
- # if requested (-w).
- #
- if [[ ${wflag} -eq 1 ]] ; then
- print "${final_dst_ppd_path}"
- fi
- fi
- ;;
-
- 1) # Duplicate copy exists
- if [[ ${wflag} -eq 1 ]] ; then
- print "${final_dst_ppd_path}"
- fi
- ;;
-
- 2) # Varying copy exists
- print -n "$myprog: " 1>&2
- gettext "differing variant of source PPD file " 1>&2
- gettext "already exists at\n" 1>&2
- gettext "${final_dst_ppd_path}\n" 1>&2
- status=${FAIL}
- ;;
- *) # The PPD file was not added as a problem occurred.
- # Display the error message.
- print -n "$myprog: " 1>&2
- print "${final_dst_ppd_path}" 1>&2
- status=${FAIL}
- ;;
-
- esac
- ;;
-
-"${GENERATEENTRY}")
- #
- # Create a cache file entry for the specified PPD file and
- # display it on standard out.
- #
- verify_ppd_file "${srcppdpath}"
- if [[ $? -eq 0 ]] ; then
- dstdir="${ppdreppath}/${ppdlabel}/${modmanuf}"
- final_dst_path="${dstdir}/$(/bin/basename ${srcppdpath})"
- verify_ppd_location "${final_dst_path}"
- if [[ $? -eq 0 ]] ; then
- # Generate the cache file entry
- print "$(generate_cache_file_entry "${modmanuf}" \
- "${model}" "${nickn}" "${devidmfg}" "${devidmdl}" \
- "${final_dst_path}")"
- else
- print -n "$myprog: " 1>&2
- gettext "PPD file not in valid location\n" 1>&2
- gettext \
- "(<repository>/<label>/<manufacturer>/<PPD file>):\n\t${1}\n" 1>&2
- status=${FAIL}
- fi
-
- else
- print -n "$myprog: " 1>&2
- gettext "invalid PPD file: ${1}\n" 1>&2
- status=${FAIL}
- fi
- ;;
-
-"${REBUILD}" | "${UPDATE}")
- update_msg=$(update_cache "${ppdreppath}" "${ppdlabel}")
- if [[ $? -ne 0 ]] ; then
- print -n "$myprog: " 1>&2
- gettext "printer information does not reflect " 1>&2
- gettext "the\nfollowing PPD file(s):\n" 1>&2
- print "${update_msg}" 1>&2
- status=${WARN}
- fi
- ;;
-
-*)
- usage
- ;;
-esac
-
-ppdmgr_exit ${status}
diff --git a/usr/src/cmd/print/scripts/printers.conf b/usr/src/cmd/print/scripts/printers.conf
deleted file mode 100644
index 69327e9915..0000000000
--- a/usr/src/cmd/print/scripts/printers.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 1996 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-
-#
-# If you hand edit this file, comments and structure may change.
-# The prefered method of modifying this file is though the use of
-# lpset(1M) or lpadmin(1M)
-#
diff --git a/usr/src/cmd/print/selector/Makefile b/usr/src/cmd/print/selector/Makefile
deleted file mode 100644
index 9cd5704869..0000000000
--- a/usr/src/cmd/print/selector/Makefile
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-include ../../Makefile.cmd
-
-SBINPROG = print-service
-BINPROG = desktop-print-management-applet
-LPBINLINKS = lp lpstat cancel enable disable
-LPRBINLINKS = lpr lpq lprm lpc
-DESKTOPLINKS = desktop-print-management desktop-print-management-prefs
-BINLINKS = $(LPBINLINKS) $(LPRBINLINKS) $(DESKTOPLINKS)
-SBINLINKS = accept reject lpmove lpadmin
-
-ROOTUSRSBINPROG = $(SBINPROG:%=$(ROOTUSRSBIN)/%)
-ROOTUSRBINPROG = $(BINPROG:%=$(ROOTBIN)/%)
-ROOTUSRBINLINKS = $(BINLINKS:%=$(ROOTBIN)/%)
-ROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
-
-FILEMODE = 0555
-
-$(ROOTUSRBINLINKS):
- $(RM) $@; $(SYMLINK) ../sbin/$(SBINPROG) $@
-
-$(ROOTUSRSBINLINKS):
- $(RM) $@; $(SYMLINK) $(SBINPROG) $@
-
-.KEEP_STATE:
-
-all check clean clobber lint:
-
-install: $(ROOTUSRSBINPROG) $(ROOTUSRBINPROG) $(ROOTUSRBINLINKS) $(ROOTUSRSBINLINKS)
-
diff --git a/usr/src/cmd/print/selector/desktop-print-management-applet b/usr/src/cmd/print/selector/desktop-print-management-applet
deleted file mode 100755
index 88dd74799d..0000000000
--- a/usr/src/cmd/print/selector/desktop-print-management-applet
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/perl5/bin/perl
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#
-use Errno qw(EINTR :POSIX);
-
-my $SVC_CUPS_SCHEDULER = 'cups/scheduler';
-my $SVCPROP = '/usr/bin/svcprop';
-my $reexec = 0;
-
-sub svcprop {
- local ($fmri, $property) = @_;
- my $FH;
-
- open($FH, "$SVCPROP -C -p $property $fmri 2>/dev/null |");
- $result = <$FH>;
- close($FH);
-
- return ($result);
-}
-
-sub print_service {
- my $service;
-
- $service = svcprop("$SVC_CUPS_SCHEDULER:default", "general/active");
- ($service =~ /true/) && ($service = 'cups') || ($service = 'lp');
-
- return ($service);
-}
-
-sub kill_running_applets {
- $reexec = 1;
- # cups applet daemon
- system("pkill -f '/system-config-printer/applet.py'");
- # lp applet daemon
- system("pkill ospm-applet");
-}
-
-sub handle_signal {
- kill_running_applets ();
-}
-
-$SIG{USR1} = \&handle_signal;
-
-my $pid = fork();
-if (! defined($pid)) {
- die "Error: fork() failed\n";
-}
-elsif ($pid == 0) {
- my $service = print_service();
- if ($service eq 'lp') {
- exec('/usr/lib/lp/bin/desktop-print-management-applet');
- }
- else {
- exec('/usr/lib/cups/bin/desktop-print-management-applet');
- }
-
-}
-else {
- my $retid;
- while ((($retid = waitpid($pid, 0)) < 0) && $!{EINTR}) {
- }
-
- if ($retid == $pid && $reexec) {
- exec('/usr/bin/desktop-print-management-applet');
- }
-}
-
-exit(0);
diff --git a/usr/src/cmd/print/selector/print-service b/usr/src/cmd/print/selector/print-service
deleted file mode 100755
index 7f90256aac..0000000000
--- a/usr/src/cmd/print/selector/print-service
+++ /dev/null
@@ -1,298 +0,0 @@
-#!/usr/perl5/bin/perl
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#
-
-#
-# This program manages the "active" print service selection.
-# If called as 'print-service', it takes one of four options.
-# Options:
-# [-s[et] service [-m]] Select the "active" print service, optionally
-# migrating basic print queue configuration.
-# [-q[uery]] Display the "active" print service.
-# [-e[xport] file] Export basic print queue configuration to
-# a file.
-# [-i[mport] file] Import basic print queue configuration from
-# a file.
-#
-# If called by any other name, it will look for a corresponding command
-# under /usr/lib/{active-service}/bin/{command} and execute that program
-# with the original arguments.
-#
-
-use Getopt::Long;
-use File::Basename;
-use File::Copy;
-use File::Temp qw/ :POSIX /;
-
-my $cmd = basename($0);
-
-my $LPSTAT = '/usr/bin/lpstat';
-my $LPADMIN = '/usr/sbin/lpadmin';
-my $ENABLE = '/usr/bin/enable';
-my $ACCEPT = '/usr/sbin/accept';
-my $SVCADM = '/usr/sbin/svcadm';
-my $SVCPROP = '/usr/bin/svcprop';
-my $SVCCFG = '/usr/sbin/svccfg';
-my $SVC_LP_SCHEDULER = 'print/server';
-my $SVC_LP_LPD = 'print/rfc1179';
-my $SVC_LP_IPP = 'print/ipp-listener';
-my $SVC_LP_PPD = 'print/ppd-cache-update';
-my $SVC_CUPS_SCHEDULER = 'cups/scheduler';
-my $SVC_CUPS_LPD = 'cups/in-lpd';
-
-sub fatal {
- ($ENV{"DESKTOP_LAUNCHED"}) &&
- exec("/bin/zenity", "--error", "--text=@_");
- print STDERR @_;
- exit(1);
-}
-
-sub usage {
- print STDERR <<EOF ;
-Usage:
- $cmd [-s[et] service [-m]] Select the \"active\" print service,
- optionally migrating basic print queue
- configuration.
- $cmd [-q[uery]] Display the "active" print service.
- $cmd [-e[xport] file] Export basic print queue configuration
- to a file.
- $cmd [-i[mport] file] Import basic print queue configuration
- from a file.
-EOF
- exit(1);
-}
-
-sub svcprop {
- local ($fmri, $property) = @_;
- my $FH;
-
- open($FH, "$SVCPROP -C -p $property $fmri 2>/dev/null |");
- $result = <$FH>;
- close($FH);
-
- return ($result);
-}
-
-sub svccfg {
- local ($fmri, $operation) = @_;
- my $FH;
-
- open($FH, "$SVCCFG -s $fmri \"$operation\" 2>/dev/null |");
- $result = <$FH>;
- close($FH);
-
- return ($result);
-}
-
-sub svcadm {
- local ($operation, @fmris) = @_;
-
- system("$SVCADM $operation -s @fmris");
-}
-
-
-sub print_service {
- my $service;
-
- $service = svcprop("$SVC_CUPS_SCHEDULER:default", "general/active");
- ($service =~ /true/) && ($service = 'cups') || ($service = 'lp');
-
- return ($service);
-}
-
-sub print_command {
- local($command, @av) = @_;
- my $service = print_service();
-
- if (!defined($service)) {
- fatal("failed to detect active print service: $!\n");
- }
-
- if (! -d "/usr/lib/$service/bin") {
- fatal("print service: $service is not installed\n");
- }
-
- my $executable = "/usr/lib/$service/bin/$command";
- # CUPS has it's own names for enable and disable
- ($command =~ /(en|dis)able/) && ($service eq 'cups') &&
- (! -x $executable) &&
- ($executable = "/usr/lib/$service/bin/$service$command");
-
- if (! -x $executable) {
- fatal("$command is not available from $service print service\n");
- }
-
- exec($executable, @ARGV);
-}
-
-sub export_print_queues {
- local ($path) = @_;
- my $service = print_service();
-
- if ($service eq 'lp') {
- my $FH, $DFH;
-
- open($FH, ">$path");
- open($DFH, "$LPSTAT -v|");
- while (<$DFH>) {
- if (/device for (.+): (.+)/) {
- my $EFH;
-
- print $FH "<Printer $1>\nDeviceURI $2\n";
- open($EFH, "$LPSTAT -p $1 -l |");
- while (<$EFH>) {
- (/Description: (.+)/) &&
- print $FH "Info $1\n";
- }
- close($EFH);
- print $FH "</Printer>\n";
- }
- }
- close($DFH);
- close($FH);
- } else {
- copy('/etc/cups/printers.conf', $path);
- }
-}
-
-sub psystem {
- print " @_\n";
- system(@_);
-}
-
-sub import_print_queues {
- local ($path) = @_;
- my $service = print_service();
- my $FH, %printer, @options;
-
- # store queue info in the 'active' print service
- open($FH, "<$path");
- while (<$FH>) {
- if (/<Printer (.+)>/) {
- $printer{'Printer'} = $1;
- @options = ();
- push(@options, "-p", $1);
- } elsif (/([^\s]+)\s(.+)/) {
- $printer{$1} = $2;
- my $value = $2;
- ($1 eq 'DeviceURI') &&
- push(@options, "-v", $value);
- ($1 eq 'Info') &&
- push(@options, "-D", $value);
- } elsif (/<\/Printer>/) {
- ($service eq 'lp') &&
- push(@options, "-m", "uri");
- print "importing $printer{'Printer'}...\n";
- # create a queue
- psystem($LPADMIN, @options);
- psystem($ENABLE, $printer{'Printer'});
- ($printer{'Accepting'} eq 'Yes') &&
- psystem($ACCEPT, $printer{'Printer'});
- $printer = ();
- }
- }
- close($FH);
-}
-
-sub select_service {
- my ($service, $migrate) = @_;
- my $FH, $queues;
-
- if (! -d "/usr/lib/$service/bin") {
- fatal("print service: $service is not installed\n");
- }
-
- if ($migrate == 1) {
- # export old print queue configuration (if migrating)
- $queues = tmpnam();
- export_print_queues($queues);
- }
-
- # enable/disable the services
- if ($service eq 'cups') {
- (-f '/etc/printers.conf') && (! -f '/etc/lp/printers.conf') &&
- rename('/etc/printers.conf', '/etc/lp/printers.conf');
- print("disabling LP services...\n");
- svcadm("disable", $SVC_LP_SCHEDULER, $SVC_LP_IPP, $SVC_LP_LPD,
- $SVC_LP_PPD);
- print("enabling CUPS services...\n");
- svcadm("enable", $SVC_CUPS_SCHEDULER, $SVC_CUPS_LPD);
- svccfg("cups/scheduler:default",
- "setprop general/active = boolean: true");
- system("pkill -USR1 -f '/desktop-print-management-applet'");
- } else {
- print("disabling CUPS services...\n");
- svcadm("disable", $SVC_CUPS_SCHEDULER, $SVC_CUPS_LPD);
- print("enabling LP services...\n");
- svcadm("enable", $SVC_LP_SCHEDULER, $SVC_LP_IPP, $SVC_LP_LPD,
- $SVC_LP_PPD);
- (-f '/etc/lp/printers.conf') &&
- rename('/etc/lp/printers.conf', '/etc/printers.conf');
- svccfg("cups/scheduler:default", "delprop general/active");
- system("pkill -USR1 -f '/desktop-print-management-applet'");
- }
-
- # import the new print queue configuration (if migrating)
- defined($queues) && import_print_queues($queues);
-}
-
-sub query_service {
- my $service = print_service();
-
- if (!defined($service)) {
- fatal("failed to detect active print service: $!\n");
- }
- print "active print service: $service\n";
-}
-
-if ($cmd eq 'print-service') {
- my ($import_path, $export_path, $svc_name, $query, $migrate) = ();
-
- my $res = GetOptions('q|query' => \$query, 's|set=s' => \$service,
- 'm|migrate' => \$migrate, 'e|export=s' => \$export_path,
- 'i|import=s' => \$import_path);
-
- ($res) || usage();
-
- if (defined($import_path) && !defined($export_path) &&
- !defined($query) && !defined($service) && !defined($migrate)) {
- import_print_queues($import_path);
- } elsif (!defined($import_path) && defined($export_path) &&
- !defined($query) && !defined($service) && !defined($migrate)) {
- export_print_queues($export_path);
- } elsif (!defined($import_path) && !defined($export_path) &&
- defined($query) && !defined($service) && !defined($migrate)) {
- query_service();
- } elsif (!defined($import_path) && !defined($export_path) &&
- !defined($query) && defined($service)) {
- select_service($service, $migrate);
- } else {
- usage();
- }
-} else {
- print_command($cmd, @ARGV);
-}
-
-exit(0);
diff --git a/usr/src/cmd/prstat/prsort.c b/usr/src/cmd/prstat/prsort.c
index cf7c250fe1..39ea28d893 100644
--- a/usr/src/cmd/prstat/prsort.c
+++ b/usr/src/cmd/prstat/prsort.c
@@ -22,10 +22,9 @@
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <libintl.h>
#include <stdlib.h>
#include <string.h>
@@ -38,10 +37,11 @@
void
list_alloc(list_t *list, int size)
{
- if (size > 0) {
- list->l_size = size;
+ list->l_size = size;
+ if (size > 0)
list->l_ptrs = Zalloc(sizeof (void *) * (size + 1));
- }
+ else
+ list->l_ptrs = NULL;
}
void
@@ -208,8 +208,11 @@ list_preinsert(list_t *list, void *ptr)
void
list_sort(list_t *list)
{
- (void) memset(list->l_ptrs, 0, sizeof (void *) * list->l_size);
list->l_used = 0;
+ if (list->l_size == 0)
+ return;
+
+ (void) memset(list->l_ptrs, 0, sizeof (void *) * list->l_size);
if (list->l_type == LT_LWPS) {
lwp_info_t *lwp = list->l_head;
diff --git a/usr/src/cmd/prstat/prstat.c b/usr/src/cmd/prstat/prstat.c
index 5942cce360..e14538a57e 100644
--- a/usr/src/cmd/prstat/prstat.c
+++ b/usr/src/cmd/prstat/prstat.c
@@ -24,6 +24,7 @@
* Use is subject to license terms.
*
* Portions Copyright 2009 Chad Mynhier
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -230,7 +231,12 @@ list_getsize(list_t *list)
size_t i;
uint_t flags = 0;
int ret;
- size_t physmem = sysconf(_SC_PHYS_PAGES) * pagesize;
+ size_t physmem;
+
+ if (!(opts.o_outpmode & OPT_VMUSAGE))
+ return;
+
+ physmem = sysconf(_SC_PHYS_PAGES) * pagesize;
/*
* Determine what swap/rss results to calculate. getvmusage() will
@@ -361,6 +367,9 @@ list_print(list_t *list)
double loadavg[3] = {0, 0, 0};
int i, lwpid;
+ if (list->l_size == 0)
+ return;
+
if (foreach_element(&set_tbl, &loadavg, psetloadavg) == 0) {
/*
* If processor sets aren't specified, we display system-wide
@@ -1144,7 +1153,10 @@ setmovecur()
return;
}
if (opts.o_outpmode & OPT_SPLIT) {
- n = opts.o_ntop + opts.o_nbottom + 2;
+ if (opts.o_ntop == 0)
+ n = opts.o_nbottom + 1;
+ else
+ n = opts.o_ntop + opts.o_nbottom + 2;
} else {
if (opts.o_outpmode & OPT_USERS)
n = opts.o_nbottom + 1;
@@ -1364,7 +1376,7 @@ main(int argc, char **argv)
pagesize = sysconf(_SC_PAGESIZE);
while ((opt = getopt(argc, argv,
- "vcd:HmarRLtu:U:n:p:C:P:h:s:S:j:k:TJz:Z")) != (int)EOF) {
+ "vVcd:HmarRLtu:U:n:p:C:P:h:s:S:j:k:TJz:Z")) != (int)EOF) {
switch (opt) {
case 'r':
opts.o_outpmode |= OPT_NORESOLVE;
@@ -1418,6 +1430,8 @@ main(int argc, char **argv)
opts.o_ntop = Atoi(p);
if (p = strtok(NULL, ","))
opts.o_nbottom = Atoi(p);
+ else if (opts.o_ntop == 0)
+ opts.o_nbottom = 5;
opts.o_outpmode &= ~OPT_FULLSCREEN;
break;
case 's':
@@ -1442,6 +1456,9 @@ main(int argc, char **argv)
while (p = strtok(NULL, ", "))
add_uid(&ruid_tbl, p);
break;
+ case 'V':
+ opts.o_outpmode |= OPT_VMUSAGE;
+ break;
case 'p':
fill_table(&pid_tbl, optarg, 'p');
break;
@@ -1480,7 +1497,9 @@ main(int argc, char **argv)
if ((opts.o_outpmode & OPT_USERS) &&
!(opts.o_outpmode & OPT_SPLIT))
opts.o_nbottom = opts.o_ntop;
- if (opts.o_ntop == 0 || opts.o_nbottom == 0)
+ if (!(opts.o_outpmode & OPT_SPLIT) && opts.o_ntop == 0)
+ Die(gettext("invalid argument for -n\n"));
+ if (opts.o_nbottom == 0)
Die(gettext("invalid argument for -n\n"));
if (!(opts.o_outpmode & OPT_SPLIT) && (opts.o_outpmode & OPT_USERS) &&
((opts.o_outpmode & (OPT_PSINFO | OPT_MSACCT))))
diff --git a/usr/src/cmd/prstat/prstat.h b/usr/src/cmd/prstat/prstat.h
index eefddcfcc3..f75bdaf412 100644
--- a/usr/src/cmd/prstat/prstat.h
+++ b/usr/src/cmd/prstat/prstat.h
@@ -24,6 +24,7 @@
* Use is subject to license terms.
*
* Portions Copyright 2009 Chad Mynhier
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
#ifndef _PRSTAT_H
@@ -70,6 +71,7 @@ extern "C" {
#define OPT_ZONES 0x2000 /* report about zones */
#define OPT_PSETS 0x4000 /* report for specified psets */
#define OPT_LGRP 0x8000 /* report home lgroups */
+#define OPT_VMUSAGE 0x10000 /* print accurate, but expensive RSS */
#define OPT_UDATE 0x20000 /* print unix timestamp */
#define OPT_DDATE 0x40000 /* print timestamp in date(1) format */
#define OPT_NORESOLVE 0x80000 /* no nsswitch lookups */
diff --git a/usr/src/cmd/prstat/prutil.c b/usr/src/cmd/prstat/prutil.c
index 75db7c3b3b..6ff4f5c49f 100644
--- a/usr/src/cmd/prstat/prutil.c
+++ b/usr/src/cmd/prstat/prutil.c
@@ -23,6 +23,7 @@
* Use is subject to license terms.
*
* Portions Copyright 2009 Chad Mynhier
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -106,7 +107,7 @@ void
Usage()
{
(void) fprintf(stderr, gettext(
- "Usage:\tprstat [-acHJLmrRtTvZ] [-u euidlist] [-U uidlist]\n"
+ "Usage:\tprstat [-acHJLmrRtTvVZ] [-u euidlist] [-U uidlist]\n"
"\t[-p pidlist] [-P cpulist] [-C psrsetlist] [-h lgrouplist]\n"
"\t[-j projidlist] [-k taskidlist] [-z zoneidlist]\n"
"\t[-s key | -S key] [-n nprocs[,nusers]] [-d d|u]\n"
diff --git a/usr/src/cmd/prtconf/prtconf.c b/usr/src/cmd/prtconf/prtconf.c
index 8b6c8f3a9a..0982f1d40b 100644
--- a/usr/src/cmd/prtconf/prtconf.c
+++ b/usr/src/cmd/prtconf/prtconf.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2011, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -168,7 +169,7 @@ cleanup_path(const char *input_path, char *path)
#ifdef DEBUG
static const char *optstring = "abcdDvVxpPFf:M:dLuC";
#else
-static const char *optstring = "abcdDvVxpPFf:uC";
+static const char *optstring = "abcdDvVxmpPFf:uC";
#endif /* DEBUG */
int
@@ -201,6 +202,9 @@ main(int argc, char *argv[])
case 'v':
++opts.o_verbose;
break;
+ case 'm':
+ ++opts.o_memory;
+ break;
case 'p':
++opts.o_prominfo;
break;
@@ -338,35 +342,42 @@ main(int argc, char *argv[])
return (0);
}
- ret = sysinfo(SI_HW_PROVIDER, hw_provider, sizeof (hw_provider));
- /*
- * If 0 bytes are returned (the system returns '1', for the \0),
- * we're probably on x86, and there has been no si-hw-provider
- * set in /etc/bootrc, default to Oracle.
- */
- if (ret <= 1) {
- (void) strncpy(hw_provider, "Oracle Corporation",
+ if (!opts.o_memory) {
+ ret = sysinfo(SI_HW_PROVIDER, hw_provider,
sizeof (hw_provider));
+ /*
+ * If 0 bytes are returned (the system returns '1', for the \0),
+ * we're probably on x86, and there has been no si-hw-provider
+ * set in /etc/bootrc, default to Joyent.
+ */
+ if (ret <= 1) {
+ (void) strncpy(hw_provider, "Joyent",
+ sizeof (hw_provider));
+ }
+ (void) printf("System Configuration: %s %s\n", hw_provider,
+ opts.o_uts.machine);
}
- (void) printf("System Configuration: %s %s\n", hw_provider,
- opts.o_uts.machine);
pagesize = sysconf(_SC_PAGESIZE);
npages = sysconf(_SC_PHYS_PAGES);
- (void) printf("Memory size: ");
- if (pagesize == -1 || npages == -1)
- (void) printf("unable to determine\n");
- else {
- const int64_t kbyte = 1024;
+ if (pagesize == -1 || npages == -1) {
+ if (opts.o_memory) {
+ (void) printf("0\n");
+ return (1);
+ } else {
+ (void) printf("Memory size: unable to determine\n");
+ }
+ } else {
const int64_t mbyte = 1024 * 1024;
int64_t ii = (int64_t)pagesize * npages;
- if (ii >= mbyte)
- (void) printf("%ld Megabytes\n",
+ if (opts.o_memory) {
+ (void) printf("%ld\n", (long)((ii+mbyte-1) / mbyte));
+ return (0);
+ } else {
+ (void) printf("Memory size: %ld Megabytes\n",
(long)((ii+mbyte-1) / mbyte));
- else
- (void) printf("%ld Kilobytes\n",
- (long)((ii+kbyte-1) / kbyte));
+ }
}
if (opts.o_prominfo) {
diff --git a/usr/src/cmd/prtconf/prtconf.h b/usr/src/cmd/prtconf/prtconf.h
index 5f9abe968c..0284cc8af1 100644
--- a/usr/src/cmd/prtconf/prtconf.h
+++ b/usr/src/cmd/prtconf/prtconf.h
@@ -54,6 +54,7 @@ struct prt_opts {
int o_drv_name;
int o_pseudodevs;
int o_fbname;
+ int o_memory;
int o_noheader;
int o_prominfo;
int o_productinfo;
diff --git a/usr/src/cmd/ps/ucbps.c b/usr/src/cmd/ps/ucbps.c
index 60235e2ae9..67ca1629d7 100644
--- a/usr/src/cmd/ps/ucbps.c
+++ b/usr/src/cmd/ps/ucbps.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -933,13 +934,13 @@ prcom(int found, psinfo_t *psinfo, char *psargs)
if (psinfo->pr_flag & SSYS) /* SZ */
(void) printf(" 0");
else if (psinfo->pr_size)
- (void) printf("%5lu", (ulong_t)psinfo->pr_size);
+ (void) printf(" %4lu", (ulong_t)psinfo->pr_size);
else
(void) printf(" ?");
if (psinfo->pr_flag & SSYS) /* RSS */
(void) printf(" 0");
else if (psinfo->pr_rssize)
- (void) printf("%5lu", (ulong_t)psinfo->pr_rssize);
+ (void) printf(" %4lu", (ulong_t)psinfo->pr_rssize);
else
(void) printf(" ?");
}
diff --git a/usr/src/cmd/psrset/psrset.c b/usr/src/cmd/psrset/psrset.c
index 35585499a9..41724137ef 100644
--- a/usr/src/cmd/psrset/psrset.c
+++ b/usr/src/cmd/psrset/psrset.c
@@ -22,6 +22,9 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* psrset - create and manage processor sets
@@ -41,6 +44,7 @@
#include <procfs.h>
#include <libproc.h>
#include <stdarg.h>
+#include <zone.h>
#if !defined(TEXT_DOMAIN) /* should be defined by cc -D */
#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it wasn't */
@@ -69,6 +73,8 @@ static char nflag;
static char fflag;
static char Fflag;
static char eflag;
+static char zflag;
+static const char *zname;
extern int pset_assign_forced(psetid_t, processorid_t, psetid_t *);
@@ -128,7 +134,7 @@ rele_proc(struct ps_prochandle *Pr)
}
static void
-bind_err(psetid_t pset, id_t pid, id_t lwpid, int err)
+bind_err(psetid_t pset, const char *zname, id_t pid, id_t lwpid, int err)
{
char *msg;
@@ -145,7 +151,9 @@ bind_err(psetid_t pset, id_t pid, id_t lwpid, int err)
}
errno = err;
- if (lwpid == -1)
+ if (zname != NULL)
+ warn(gettext("cannot %s zone %s"), msg, zname);
+ else if (lwpid == -1)
warn(gettext("cannot %s pid %d"), msg, pid);
else
warn(gettext("cannot %s lwpid %d/%d"), msg, pid, lwpid);
@@ -281,7 +289,7 @@ bind_lwp(id_t pid, id_t lwpid, psetid_t pset)
psetid_t old_pset;
if (pset_bind_lwp(pset, lwpid, pid, &old_pset) != 0) {
- bind_err(pset, pid, lwpid, errno);
+ bind_err(pset, NULL, pid, lwpid, errno);
errors = ERR_FAIL;
}
if (errors != ERR_FAIL) {
@@ -491,7 +499,7 @@ query_all_proc(psinfo_t *psinfo, lwpsinfo_t *lwpsinfo, void *arg)
*/
if (errno == ESRCH)
return (0);
- bind_err(PS_QUERY, pid, -1, errno);
+ bind_err(PS_QUERY, NULL, pid, -1, errno);
errors = ERR_FAIL;
return (0);
}
@@ -542,6 +550,7 @@ usage(void)
"\t%1$s -r [-F] processor_id ...\n"
"\t%1$s -p [processorid ...]\n"
"\t%1$s -b processor_set_id pid[/lwpids] ...\n"
+ "\t%1$s -b -z zonename processor_set_id\n"
"\t%1$s -u pid[/lwpids] ...\n"
"\t%1$s -q [pid[/lwpids] ...]\n"
"\t%1$s -U [processor_set_id] ...\n"
@@ -574,23 +583,23 @@ do_lwps(id_t pid, const char *range, psetid_t pset)
if ((fd = open(procfile, O_RDONLY)) < 0) {
if (errno == ENOENT)
errno = ESRCH;
- bind_err(pset, pid, -1, errno);
+ bind_err(pset, NULL, pid, -1, errno);
return (ERR_FAIL);
}
if (pread(fd, &header, sizeof (header), 0) != sizeof (header)) {
(void) close(fd);
- bind_err(pset, pid, -1, errno);
+ bind_err(pset, NULL, pid, -1, errno);
return (ERR_FAIL);
}
nent = header.pr_nent;
size = header.pr_entsize * nent;
ptr = lpsinfo = malloc(size);
if (lpsinfo == NULL) {
- bind_err(pset, pid, -1, errno);
+ bind_err(pset, NULL, pid, -1, errno);
return (ERR_FAIL);
}
if (pread(fd, lpsinfo, size, sizeof (header)) != size) {
- bind_err(pset, pid, -1, errno);
+ bind_err(pset, NULL, pid, -1, errno);
free(lpsinfo);
(void) close(fd);
return (ERR_FAIL);
@@ -635,6 +644,7 @@ main(int argc, char *argv[])
id_t pid;
processorid_t cpu;
psetid_t pset, old_pset;
+ zoneid_t zid;
char *errptr;
progname = argv[0]; /* put actual command name in messages */
@@ -642,7 +652,7 @@ main(int argc, char *argv[])
(void) setlocale(LC_ALL, ""); /* setup localization */
(void) textdomain(TEXT_DOMAIN);
- while ((c = getopt(argc, argv, "cdFarpibqQuUnfe")) != EOF) {
+ while ((c = getopt(argc, argv, "cdFarpibqQuUnfez:")) != EOF) {
switch (c) {
case 'c':
cflag = 1;
@@ -693,6 +703,19 @@ main(int argc, char *argv[])
case 'n':
nflag = 1;
break;
+ case 'z':
+ if (!bflag) {
+ warn(gettext("-z can only be used after -b\n"));
+ return (usage());
+ }
+ if (zflag) {
+ warn(gettext("-z can only be specified "
+ "once\n"));
+ return (usage());
+ }
+ zflag = 1;
+ zname = optarg;
+ break;
default:
return (usage());
}
@@ -859,9 +882,28 @@ main(int argc, char *argv[])
/*
* Perform function for each pid/lwpid specified.
*/
- if (argc == 0) {
+ if (argc == 0 && !zflag) {
warn(gettext("must specify at least one pid\n"));
return (usage());
+ } else if (argc > 0 && zflag) {
+ warn(gettext("cannot specify extra pids with -z\n"));
+ return (usage());
+ }
+
+ if (zflag) {
+ zid = getzoneidbyname(zname);
+ if (zid < 0) {
+ warn(gettext("invalid zone name: %s\n"),
+ zname);
+ errors = ERR_FAIL;
+ } else if (pset_bind(pset, P_ZONEID, zid,
+ &old_pset) < 0) {
+ bind_err(pset, zname, -1, -1, errno);
+ errors = ERR_FAIL;
+ } else {
+ (void) printf(gettext("zone %s: bound to %d\n"),
+ zname, pset);
+ }
}
/*
@@ -902,7 +944,7 @@ main(int argc, char *argv[])
*/
if (pset_bind(pset, P_PID, pid,
&old_pset) < 0) {
- bind_err(pset, pid, -1, errno);
+ bind_err(pset, NULL, pid, -1, errno);
errors = ERR_FAIL;
continue;
}
diff --git a/usr/src/cmd/ptools/pargs/pargs.c b/usr/src/cmd/ptools/pargs/pargs.c
index 30c60ca3c3..8c3cbba962 100644
--- a/usr/src/cmd/ptools/pargs/pargs.c
+++ b/usr/src/cmd/ptools/pargs/pargs.c
@@ -23,7 +23,7 @@
* Use is subject to license terms.
*/
/*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/*
@@ -1201,7 +1201,7 @@ print_cmdline(pargs_data_t *datap)
* an error message and bail.
*/
for (i = 0; i < datap->pd_argc; i++) {
- if (datap->pd_argv[i] == NULL ||
+ if (datap->pd_argv == NULL || datap->pd_argv[i] == NULL ||
datap->pd_argv_strs[i] == NULL) {
(void) fprintf(stderr, "%s: target has corrupted "
"argument list\n", command);
diff --git a/usr/src/cmd/ptools/pmap/pmap_common.c b/usr/src/cmd/ptools/pmap/pmap_common.c
index 7594fd30e3..fff55ffdbc 100644
--- a/usr/src/cmd/ptools/pmap/pmap_common.c
+++ b/usr/src/cmd/ptools/pmap/pmap_common.c
@@ -23,6 +23,9 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include <fcntl.h>
#include <libproc.h>
@@ -68,7 +71,7 @@ make_name(struct ps_prochandle *Pr, int lflag, uintptr_t addr,
char path[PATH_MAX];
int len;
- if (lflag) {
+ if (lflag || Pstate(Pr) == PS_DEAD) {
if (Pobjname(Pr, addr, buf, bufsz) != NULL)
return (buf);
} else {
diff --git a/usr/src/cmd/ptools/ptime/ptime.c b/usr/src/cmd/ptools/ptime/ptime.c
index bc862cddb8..c3a05ff51c 100644
--- a/usr/src/cmd/ptools/ptime/ptime.c
+++ b/usr/src/cmd/ptools/ptime/ptime.c
@@ -24,6 +24,9 @@
*
* Portions Copyright 2008 Chad Mynhier
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include <stdio.h>
#include <stdlib.h>
@@ -55,16 +58,39 @@ static char procname[64];
static int Fflag;
static int mflag;
static int errflg;
+static int pflag;
+
+static int
+ptime_pid(const char *pidstr)
+{
+ struct ps_prochandle *Pr;
+ pid_t pid;
+ int gret;
+
+ if ((Pr = proc_arg_grab(pidstr, PR_ARG_PIDS,
+ Fflag | PGRAB_RDONLY, &gret)) == NULL) {
+ (void) fprintf(stderr, "%s: cannot examine %s: %s\n",
+ command, pidstr, Pgrab_error(gret));
+ return (1);
+ }
+
+ pid = Pstatus(Pr)->pr_pid;
+ (void) sprintf(procname, "%d", (int)pid); /* for perr() */
+ (void) look(pid);
+ Prelease(Pr, 0);
+ return (0);
+}
int
main(int argc, char **argv)
{
- int opt;
+ int opt, exit;
pid_t pid;
struct siginfo info;
int status;
int gret;
struct ps_prochandle *Pr;
+ char *pp, *np;
if ((command = strrchr(argv[0], '/')) != NULL)
command++;
@@ -80,6 +106,7 @@ main(int argc, char **argv)
mflag = 1;
break;
case 'p':
+ pflag = 1;
pidarg = optarg;
break;
default:
@@ -93,63 +120,70 @@ main(int argc, char **argv)
if (((pidarg != NULL) ^ (argc < 1)) || errflg) {
(void) fprintf(stderr,
- "usage:\t%s [-mh] [-p pid | command [ args ... ]]\n",
+ "usage:\t%s [-mh] [-p pidlist | command [ args ... ]]\n",
command);
(void) fprintf(stderr,
" (time a command using microstate accounting)\n");
return (1);
}
- if (pidarg != NULL) {
- if ((Pr = proc_arg_grab(pidarg, PR_ARG_PIDS,
- Fflag | PGRAB_RDONLY, &gret)) == NULL) {
- (void) fprintf(stderr, "%s: cannot examine %s: %s\n",
- command, pidarg, Pgrab_error(gret));
- return (1);
- }
- } else {
- if ((Pr = Pcreate(argv[0], &argv[0], &gret, NULL, 0)) == NULL) {
- (void) fprintf(stderr, "%s: failed to exec %s: %s\n",
- command, argv[0], Pcreate_error(gret));
- return (1);
- }
- if (Psetrun(Pr, 0, 0) == -1) {
- (void) fprintf(stderr, "%s: failed to set running %s: "
- "%s\n", command, argv[0], strerror(errno));
- return (1);
+ if (pflag) {
+ exit = 0;
+ (void) signal(SIGINT, SIG_IGN);
+ (void) signal(SIGQUIT, SIG_IGN);
+ pp = pidarg;
+ if ((np = strchr(pp, ' ')) != NULL ||
+ (np = strchr(pp, ',')) != NULL)
+ pflag++;
+ while (np != NULL) {
+ *np = '\0';
+ exit |= ptime_pid(pp);
+ pp = np + 1;
+ np = strchr(pp, ' ');
+ if (np == NULL)
+ np = strchr(pp, ',');
}
+ exit |= ptime_pid(pp);
+ return (exit);
+ }
+
+
+ if ((Pr = Pcreate(argv[0], &argv[0], &gret, NULL, 0)) == NULL) {
+ (void) fprintf(stderr, "%s: failed to exec %s: %s\n",
+ command, argv[0], Pcreate_error(gret));
+ return (1);
+ }
+ if (Psetrun(Pr, 0, 0) == -1) {
+ (void) fprintf(stderr, "%s: failed to set running %s: "
+ "%s\n", command, argv[0], strerror(errno));
+ return (1);
}
pid = Pstatus(Pr)->pr_pid;
+
(void) sprintf(procname, "%d", (int)pid); /* for perr() */
(void) signal(SIGINT, SIG_IGN);
(void) signal(SIGQUIT, SIG_IGN);
- if (pidarg == NULL)
- (void) waitid(P_PID, pid, &info, WEXITED | WNOWAIT);
+ (void) waitid(P_PID, pid, &info, WEXITED | WNOWAIT);
(void) look(pid);
- if (pidarg != NULL) {
- Prelease(Pr, 0);
- return (0);
- } else {
- (void) waitpid(pid, &status, 0);
+ (void) waitpid(pid, &status, 0);
- if (WIFEXITED(status))
- return (WEXITSTATUS(status));
+ if (WIFEXITED(status))
+ return (WEXITSTATUS(status));
- if (WIFSIGNALED(status)) {
- int sig = WTERMSIG(status);
- char name[SIG2STR_MAX];
+ if (WIFSIGNALED(status)) {
+ int sig = WTERMSIG(status);
+ char name[SIG2STR_MAX];
- (void) fprintf(stderr, "%s: command terminated "
- "abnormally by %s\n", command,
- proc_signame(sig, name, sizeof (name)));
- }
-
- return (status | WCOREFLG); /* see time(1) */
+ (void) fprintf(stderr, "%s: command terminated "
+ "abnormally by %s\n", command,
+ proc_signame(sig, name, sizeof (name)));
}
+
+ return (status | WCOREFLG); /* see time(1) */
}
static int
@@ -187,6 +221,9 @@ look(pid_t pid)
tsadd(&sys, &sys, &pup->pr_ttime);
(void) fprintf(stderr, "\n");
+ if (pflag > 1)
+ (void) fprintf(stderr, "%d:\t%.70s\n",
+ (int)psinfo.pr_pid, psinfo.pr_psargs);
prtime("real", &real);
prtime("user", &user);
prtime("sys", &sys);
diff --git a/usr/src/cmd/rcap/common/utils.c b/usr/src/cmd/rcap/common/utils.c
index 799fdcef23..dd511c7c50 100644
--- a/usr/src/cmd/rcap/common/utils.c
+++ b/usr/src/cmd/rcap/common/utils.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#include <sys/param.h>
@@ -257,77 +258,3 @@ xatoi(char *p)
return (i);
}
}
-
-/*
- * get_running_zones() calls zone_list(2) to find out how many zones are
- * running. It then calls zone_list(2) again to fetch the list of running
- * zones (stored in *zents).
- */
-int
-get_running_zones(uint_t *nzents, zone_entry_t **zents)
-{
- zoneid_t *zids;
- uint_t nzents_saved;
- int i;
- zone_entry_t *zentp;
- zone_state_t zstate;
-
- *zents = NULL;
- if (zone_list(NULL, nzents) != 0) {
- warn(gettext("could not get zoneid list\n"));
- return (E_ERROR);
- }
-
-again:
- if (*nzents == 0)
- return (E_SUCCESS);
-
- if ((zids = (zoneid_t *)calloc(*nzents, sizeof (zoneid_t))) == NULL) {
- warn(gettext("out of memory: zones will not be capped\n"));
- return (E_ERROR);
- }
-
- nzents_saved = *nzents;
-
- if (zone_list(zids, nzents) != 0) {
- warn(gettext("could not get zone list\n"));
- free(zids);
- return (E_ERROR);
- }
- if (*nzents != nzents_saved) {
- /* list changed, try again */
- free(zids);
- goto again;
- }
-
- *zents = calloc(*nzents, sizeof (zone_entry_t));
- if (*zents == NULL) {
- warn(gettext("out of memory: zones will not be capped\n"));
- free(zids);
- return (E_ERROR);
- }
-
- zentp = *zents;
- for (i = 0; i < *nzents; i++) {
- char name[ZONENAME_MAX];
-
- if (getzonenamebyid(zids[i], name, sizeof (name)) < 0) {
- warn(gettext("could not get name for "
- "zoneid %d\n"), zids[i]);
- continue;
- }
-
- (void) strlcpy(zentp->zname, name, sizeof (zentp->zname));
- zentp->zid = zids[i];
- if (zone_get_state(name, &zstate) != Z_OK ||
- zstate != ZONE_STATE_RUNNING)
- continue;
-
-
- zentp++;
- }
- *nzents = zentp - *zents;
-
- free(zids);
- return (E_SUCCESS);
-}
diff --git a/usr/src/cmd/rcap/common/utils.h b/usr/src/cmd/rcap/common/utils.h
index 7196cfb4ce..cf2e17c080 100644
--- a/usr/src/cmd/rcap/common/utils.h
+++ b/usr/src/cmd/rcap/common/utils.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#ifndef _UTILS_H
@@ -98,7 +99,6 @@ extern void vdprintfe(int, const char *, va_list);
extern void dprintfe(int, char *, ...);
extern void hrt2ts(hrtime_t, timestruc_t *);
extern int xatoi(char *);
-extern int get_running_zones(uint_t *, zone_entry_t **);
#ifdef __cplusplus
}
diff --git a/usr/src/cmd/rcap/rcapadm/rcapadm.c b/usr/src/cmd/rcap/rcapadm/rcapadm.c
index 92888b2071..b92115469a 100644
--- a/usr/src/cmd/rcap/rcapadm/rcapadm.c
+++ b/usr/src/cmd/rcap/rcapadm/rcapadm.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -145,20 +146,29 @@ out:
scf_handle_destroy(h);
}
+static int
+set_zone_cap(char *zonename, uint64_t mcap)
+{
+ char cmd[128 + ZONENAME_MAX];
+
+ (void) snprintf(cmd, sizeof (cmd), "/usr/bin/prctl -r "
+ "-n zone.max-physical-memory -v %llu -i zone %s", mcap, zonename);
+ return (system(cmd));
+}
+
/*
* Update the in-kernel memory cap for the specified zone.
*/
static int
update_zone_mcap(char *zonename, char *maxrss)
{
- zoneid_t zone_id;
uint64_t num;
if (getzoneid() != GLOBAL_ZONEID || zonecfg_in_alt_root())
return (E_SUCCESS);
/* get the running zone from the kernel */
- if ((zone_id = getzoneidbyname(zonename)) == -1) {
+ if (getzoneidbyname(zonename) == -1) {
(void) fprintf(stderr, gettext("zone '%s' must be running\n"),
zonename);
return (E_ERROR);
@@ -169,7 +179,7 @@ update_zone_mcap(char *zonename, char *maxrss)
return (E_ERROR);
}
- if (zone_setattr(zone_id, ZONE_ATTR_PHYS_MCAP, &num, 0) == -1) {
+ if (set_zone_cap(zonename, num) == -1) {
(void) fprintf(stderr, gettext("could not set memory "
"cap for zone '%s'\n"), zonename);
return (E_ERROR);
diff --git a/usr/src/cmd/rcap/rcapd/rcapd_collection_zone.c b/usr/src/cmd/rcap/rcapd/rcapd_collection_zone.c
index db86aa6276..88403dda37 100644
--- a/usr/src/cmd/rcap/rcapd/rcapd_collection_zone.c
+++ b/usr/src/cmd/rcap/rcapd/rcapd_collection_zone.c
@@ -21,16 +21,17 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <procfs.h>
#include <project.h>
#include <stdlib.h>
#include <strings.h>
#include <zone.h>
#include <libzonecfg.h>
+#include <dirent.h>
+#include <libproc.h>
#include "rcapd.h"
#include "utils.h"
@@ -39,61 +40,117 @@ extern boolean_t gz_capped;
/* round up to next y = 2^n */
#define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
-static void
-update_zone(zone_entry_t *zent, void *walk_data)
+static struct ps_prochandle *
+grab_zone_proc(zoneid_t zid)
{
- void(*update_notification_cb)(char *, char *, int, uint64_t, int) =
- (void(*)(char *, char *, int, uint64_t, int))walk_data;
- int changes;
- int64_t max_rss;
+ DIR *dirp;
+ struct dirent *dentp;
+ int pid, pid_self, tmp;
+ psinfo_t psinfo;
+ struct ps_prochandle *pr = NULL;
+
+ pid_self = getpid();
+
+ if ((dirp = opendir("/proc")) == NULL)
+ return (NULL);
+
+ while (dentp = readdir(dirp)) {
+ pid = atoi(dentp->d_name);
+
+ /* Skip self */
+ if (pid == pid_self)
+ continue;
+
+ if (proc_get_psinfo(pid, &psinfo) != 0)
+ continue;
+
+ if (psinfo.pr_zoneid != zid)
+ continue;
+
+ /* attempt to grab process */
+ if ((pr = Pgrab(pid, 0, &tmp)) != NULL) {
+ if (Psetflags(pr, PR_RLC) != 0) {
+ Prelease(pr, 0);
+ }
+ if (Pcreate_agent(pr) == 0) {
+ if (pr_getzoneid(pr) != zid) {
+ Prelease(pr, 0);
+ continue;
+ }
+
+ (void) closedir(dirp);
+ return (pr);
+ } else {
+ Prelease(pr, 0);
+ }
+ }
+ }
+
+ (void) closedir(dirp);
+ return (NULL);
+}
+
+static uint64_t
+get_zone_cap(zoneid_t zid)
+{
+ rctlblk_t *rblk;
uint64_t mcap;
- lcollection_t *lcol;
- rcid_t colid;
+ struct ps_prochandle *pr;
- if (zone_getattr(zent->zid, ZONE_ATTR_PHYS_MCAP, &mcap,
- sizeof (mcap)) != -1 && mcap != 0)
- max_rss = ROUNDUP(mcap, 1024) / 1024;
- else
- max_rss = 0;
-
- if (zent->zid == GLOBAL_ZONEID) {
- if (max_rss > 0)
- gz_capped = B_TRUE;
- else
- gz_capped = B_FALSE;
+ if ((rblk = (rctlblk_t *)malloc(rctlblk_size())) == NULL)
+ return (UINT64_MAX);
+
+ if ((pr = grab_zone_proc(zid)) == NULL) {
+ free(rblk);
+ return (UINT64_MAX);
}
+ if (pr_getrctl(pr, "zone.max-physical-memory", NULL, rblk,
+ RCTL_FIRST)) {
+ Pdestroy_agent(pr);
+ Prelease(pr, 0);
+ free(rblk);
+ return (UINT64_MAX);
+ }
- colid.rcid_type = RCIDT_ZONE;
- colid.rcid_val = zent->zid;
+ Pdestroy_agent(pr);
+ Prelease(pr, 0);
- lcol = lcollection_insert_update(&colid, max_rss, zent->zname,
- &changes);
- if (update_notification_cb != NULL)
- update_notification_cb("zone", zent->zname, changes, max_rss,
- (lcol != NULL) ? lcol->lcol_mark : 0);
+ mcap = rctlblk_get_value(rblk);
+ free(rblk);
+ return (mcap);
}
-
+/*
+ * For zones, rcapd only caps the global zone, since each non-global zone
+ * caps itself.
+ */
/* ARGSUSED */
void
lcollection_update_zone(lcollection_update_type_t ut,
void(*update_notification_cb)(char *, char *, int, uint64_t, int))
{
- int i;
- uint_t nzents;
- zone_entry_t *zents;
-
- /*
- * Enumerate running zones.
- */
- if (get_running_zones(&nzents, &zents) != 0)
- return;
-
- for (i = 0; i < nzents; i++) {
- update_zone(&zents[i], (void *)update_notification_cb);
+ int changes;
+ int64_t max_rss;
+ uint64_t mcap;
+ lcollection_t *lcol;
+ rcid_t colid;
+ mcap = get_zone_cap(GLOBAL_ZONEID);
+ if (mcap != 0 && mcap != UINT64_MAX) {
+ max_rss = ROUNDUP(mcap, 1024) / 1024;
+ gz_capped = B_TRUE;
+ } else {
+ max_rss = UINT64_MAX / 1024;
+ gz_capped = B_FALSE;
}
- free(zents);
+ colid.rcid_type = RCIDT_ZONE;
+ colid.rcid_val = GLOBAL_ZONEID;
+
+ lcol = lcollection_insert_update(&colid, max_rss, GLOBAL_ZONENAME,
+ &changes);
+ if (update_notification_cb != NULL)
+ update_notification_cb("zone", GLOBAL_ZONENAME, changes,
+ max_rss, (lcol != NULL) ? lcol->lcol_mark : 0);
}
diff --git a/usr/src/cmd/rcap/rcapd/rcapd_scanner.c b/usr/src/cmd/rcap/rcapd/rcapd_scanner.c
index b39811b552..254bb9e922 100644
--- a/usr/src/cmd/rcap/rcapd/rcapd_scanner.c
+++ b/usr/src/cmd/rcap/rcapd/rcapd_scanner.c
@@ -21,6 +21,7 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -551,7 +552,7 @@ pageout(pid_t pid, struct ps_prochandle *Pr, caddr_t start, caddr_t end)
errno = 0;
res = pr_memcntl(Pr, start, (end - start), MC_SYNC,
- (caddr_t)(MS_ASYNC | MS_INVALIDATE), 0, 0);
+ (caddr_t)(MS_ASYNC | MS_INVALCURPROC), 0, 0);
debug_high("pr_memcntl [%p-%p): %d", (void *)start, (void *)end, res);
/*
diff --git a/usr/src/cmd/rcap/rcapstat/rcapstat.c b/usr/src/cmd/rcap/rcapstat/rcapstat.c
index fb83f861ae..c97b6a14f7 100644
--- a/usr/src/cmd/rcap/rcapstat/rcapstat.c
+++ b/usr/src/cmd/rcap/rcapstat/rcapstat.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -72,6 +73,8 @@ typedef struct col {
static col_t *col_head;
static int ncol;
+#define RCAPD_NA "rcapd is not active (try zonememstat)\n"
+
static col_t *
col_find(rcid_t id)
{
@@ -152,7 +155,7 @@ read_stats(rcid_type_t stat_type)
struct stat st;
if ((fd = open(STAT_FILE_DEFAULT, O_RDONLY)) < 0) {
- warn(gettext("rcapd is not active\n"));
+ warn(gettext(RCAPD_NA));
return (E_ERROR);
}
@@ -173,7 +176,7 @@ read_stats(rcid_type_t stat_type)
pid = hdr.rs_pid;
(void) snprintf(procfile, 20, "/proc/%lld/psinfo", pid);
if ((proc_fd = open(procfile, O_RDONLY)) < 0) {
- warn(gettext("rcapd is not active\n"));
+ warn(gettext(RCAPD_NA));
(void) close(fd);
return (E_ERROR);
}
diff --git a/usr/src/cmd/rcm_daemon/Makefile.com b/usr/src/cmd/rcm_daemon/Makefile.com
index e2e3ba9720..570da30bb1 100644
--- a/usr/src/cmd/rcm_daemon/Makefile.com
+++ b/usr/src/cmd/rcm_daemon/Makefile.com
@@ -56,7 +56,6 @@ COMMON_MOD_SRC = \
$(COMMON)/pool_rcm.c \
$(COMMON)/mpxio_rcm.c \
$(COMMON)/ip_anon_rcm.c \
- $(COMMON)/svm_rcm.c \
$(COMMON)/bridge_rcm.c
sparc_MOD_SRC = $(COMMON)/ttymux_rcm.c
@@ -82,7 +81,6 @@ COMMON_MOD_OBJ = \
pool_rcm.o \
mpxio_rcm.o \
ip_anon_rcm.o \
- svm_rcm.o \
bridge_rcm.o
sparc_MOD_OBJ = ttymux_rcm.o
@@ -103,7 +101,6 @@ COMMON_RCM_MODS = \
SUNW_pool_rcm.so \
SUNW_mpxio_rcm.so \
SUNW_ip_anon_rcm.so \
- SUNW_svm_rcm.so \
SUNW_bridge_rcm.so
sparc_RCM_MODS = SUNW_ttymux_rcm.so
@@ -132,7 +129,6 @@ LINTFLAGS += -u -erroff=E_FUNC_ARG_UNUSED
LDLIBS_MODULES =
SUNW_pool_rcm.so := LDLIBS_MODULES += -L$(ROOT)/usr/lib -lpool
-SUNW_svm_rcm.so := LDLIBS_MODULES += -L$(ROOT)/usr/lib -lmeta
SUNW_network_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -ldladm
SUNW_vlan_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -ldladm
SUNW_vnic_rcm.so := LDLIBS_MODULES += -L$(ROOT)/lib -ldladm
diff --git a/usr/src/cmd/refer/Makefile b/usr/src/cmd/refer/Makefile
index 4adb63a15d..1bd28a19b7 100644
--- a/usr/src/cmd/refer/Makefile
+++ b/usr/src/cmd/refer/Makefile
@@ -91,7 +91,7 @@ sortbib:= POBJS= sortbib.o
.PARALLEL: $(OBJS)
-all: $(PROG) $(PROG3) $(OTXTS) $(SUBDIRS)
+all: $(PROG) $(PROG3) $(OTXTS)
$(PROG1) $(PROG3): $$(POBJS)
$(LINK.c) -o $@ $(POBJS) $(LDFLAGS) $(LDLIBS)
diff --git a/usr/src/cmd/savecore/savecore.c b/usr/src/cmd/savecore/savecore.c
index e079c8807a..2bd0517055 100644
--- a/usr/src/cmd/savecore/savecore.c
+++ b/usr/src/cmd/savecore/savecore.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
@@ -1506,7 +1507,14 @@ getbounds(const char *f)
long b = -1;
const char *p = strrchr(f, '/');
- (void) sscanf(p ? p + 1 : f, "vmdump.%ld", &b);
+ if (p == NULL || strncmp(p, "vmdump", 6) != 0)
+ p = strstr(f, "vmdump");
+
+ if (p != NULL && *p == '/')
+ p++;
+
+ (void) sscanf(p ? p : f, "vmdump.%ld", &b);
+
return (b);
}
@@ -1640,6 +1648,7 @@ main(int argc, char *argv[])
struct rlimit rl;
long filebounds = -1;
char namelist[30], corefile[30], boundstr[30];
+ dumpfile = NULL;
startts = gethrtime();
@@ -1680,7 +1689,11 @@ main(int argc, char *argv[])
}
}
- if (geteuid() != 0 && filebounds < 0) {
+ /*
+ * If doing something other than extracting an existing dump (i.e.
+ * dumpfile has been provided as an option), the user must be root.
+ */
+ if (geteuid() != 0 && dumpfile == NULL) {
(void) fprintf(stderr, "%s: %s %s\n", progname,
gettext("you must be root to use"), progname);
exit(1);
diff --git a/usr/src/cmd/sed/main.c b/usr/src/cmd/sed/main.c
index 93e14bb09b..59a6da8e22 100644
--- a/usr/src/cmd/sed/main.c
+++ b/usr/src/cmd/sed/main.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Gary Mills
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1992 Diomidis Spinellis.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -41,9 +41,7 @@
#include <err.h>
#include <errno.h>
#include <fcntl.h>
-#include <getopt.h>
#include <libgen.h>
-#include <libintl.h>
#include <limits.h>
#include <locale.h>
#include <regex.h>
@@ -52,6 +50,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <libintl.h>
#include "defs.h"
#include "extern.h"
@@ -106,11 +105,6 @@ static char tmpfname[PATH_MAX]; /* Temporary file name (for in-place editing) */
static const char *inplace; /* Inplace edit file extension. */
ulong_t linenum;
-static const struct option lopts[] = {
- {"in-place", optional_argument, NULL, 'i'},
- {NULL, 0, NULL, 0}
-};
-
static void add_compunit(enum e_cut, char *);
static void add_file(char *);
static void usage(void);
@@ -133,18 +127,14 @@ main(int argc, char *argv[])
fflag = 0;
inplace = NULL;
- while ((c = getopt_long(argc, argv, "EI::ae:f:i::lnr", lopts, NULL)) !=
- -1)
+ while ((c = getopt(argc, argv, "EI:ae:f:i:lnr")) != -1)
switch (c) {
case 'r': /* Gnu sed compat */
case 'E':
rflags = REG_EXTENDED;
break;
case 'I':
- if (optarg != NULL)
- inplace = optarg;
- else
- inplace = "";
+ inplace = optarg;
ispan = 1; /* span across input files */
break;
case 'a':
@@ -161,10 +151,7 @@ main(int argc, char *argv[])
add_compunit(CU_FILE, optarg);
break;
case 'i':
- if (optarg != NULL)
- inplace = optarg;
- else
- inplace = "";
+ inplace = optarg;
ispan = 0; /* don't span across input files */
break;
case 'l':
@@ -205,8 +192,8 @@ main(int argc, char *argv[])
static void
usage(void)
{
- (void) fputs(_("usage: sed script [-Ealn] [-i[extension]] [file...]\n"
- " sed [-Ealn] [-i[extension]] [-e script]... "
+ (void) fputs(_("usage: sed script [-Ealn] [-i extension] [file...]\n"
+ " sed [-Ealn] [-i extension] [-e script]... "
"[-f script_file]... [file...]\n"),
stderr);
exit(1);
diff --git a/usr/src/cmd/sgs/elfdump/Makefile.targ b/usr/src/cmd/sgs/elfdump/Makefile.targ
index 5eda4d1b47..b763a3faf0 100644
--- a/usr/src/cmd/sgs/elfdump/Makefile.targ
+++ b/usr/src/cmd/sgs/elfdump/Makefile.targ
@@ -60,6 +60,8 @@ delete:
package \
install: all $(VAR_SGSBINPROG) $(VAR_SGSCCSLINK)
+ -$(RM) $(ROOTPROG)
+ -$(LN) $(ISAEXEC) $(ROOTPROG)
.PARALLEL: $(LINTOUT32) $(LINTOUT64)
diff --git a/usr/src/cmd/sgs/elfdump/amd64/Makefile b/usr/src/cmd/sgs/elfdump/amd64/Makefile
index 906b6b6754..fdcf09abed 100644
--- a/usr/src/cmd/sgs/elfdump/amd64/Makefile
+++ b/usr/src/cmd/sgs/elfdump/amd64/Makefile
@@ -39,6 +39,8 @@ LINTFLAGS64 += $(VAR_LINTFLAGS64)
VAR_SGSBINPROG= $(VAR_SGSBINPROG64)
VAR_SGSCCSLINK= $(VAR_SGSCCSLINK64)
+install: all $(ROOTPROG64)
+
include ../Makefile.targ
include ../../Makefile.sub.64
diff --git a/usr/src/cmd/sgs/elfdump/i386/Makefile b/usr/src/cmd/sgs/elfdump/i386/Makefile
index 607c8a31ce..31fd227274 100644
--- a/usr/src/cmd/sgs/elfdump/i386/Makefile
+++ b/usr/src/cmd/sgs/elfdump/i386/Makefile
@@ -30,4 +30,6 @@ include ../Makefile.com
.KEEP_STATE:
+install: all $(ROOTPROG32)
+
include ../Makefile.targ
diff --git a/usr/src/cmd/sgs/lex/common/main.c b/usr/src/cmd/sgs/lex/common/main.c
index 975827996a..bd9d242ffc 100644
--- a/usr/src/cmd/sgs/lex/common/main.c
+++ b/usr/src/cmd/sgs/lex/common/main.c
@@ -28,13 +28,15 @@
/* Copyright 1976, Bell Telephone Laboratories, Inc. */
-#pragma ident "%Z%%M% %I% %E% SMI"
+/* Copyright (c) 2013, joyent, Inc. All rights reserved. */
#include <string.h>
#include "once.h"
#include "sgs.h"
#include <locale.h>
#include <limits.h>
+#include <unistd.h>
+#include <libgen.h>
static wchar_t L_INITIAL[] = {'I', 'N', 'I', 'T', 'I', 'A', 'L', 0};
static void get1core(void);
@@ -46,12 +48,32 @@ static void get3core(void);
static void free3core(void);
#endif
+static int
+lex_construct_path(char *buf, size_t size, const char *file, int type)
+{
+ int ret;
+ char origin[PATH_MAX];
+
+ if (type != 0) {
+ ret = readlink("/proc/self/path/a.out", origin, PATH_MAX - 1);
+ if (ret < 0)
+ error(
+ "lex: failed to read origin from /proc\n");
+ origin[ret] = '\0';
+ return (snprintf(buf, size, "%s/../%s/%s", dirname(origin),
+ NBASE, file));
+ }
+
+ return (snprintf(buf, size, "%s/%s/%s", NPREFIX, NBASE, file));
+}
+
int
main(int argc, char **argv)
{
int i;
int c;
- char *path = NULL;
+ char *path = NULL, *bpath = NULL;
+ char pathbuf[PATH_MAX];
Boolean eoption = 0, woption = 0;
sargv = argv;
@@ -218,15 +240,31 @@ main(int argc, char **argv)
free3core();
#endif
+ /*
+ * Try to find the file relative to $ORIGIN. Note that we don't touch
+ * antyhing related to -Y. In fact, unfortunately it's always been
+ * ignored it seems.
+ */
if (handleeuc) {
if (ratfor)
error("Ratfor is not supported by -w or -e option.");
- path = EUCNAME;
+ bpath = EUCNAME;
}
else
- path = ratfor ? RATNAME : CNAME;
+ bpath = ratfor ? RATNAME : CNAME;
- fother = fopen(path, "r");
+ if (path == NULL) {
+ path = pathbuf;
+ (void) lex_construct_path(pathbuf, sizeof (pathbuf), bpath, 1);
+ fother = fopen(path, "r");
+ if (fother == NULL) {
+ (void) lex_construct_path(pathbuf, sizeof (pathbuf),
+ bpath, 0);
+ fother = fopen(path, "r");
+ }
+ } else {
+ fother = fopen(path, "r");
+ }
if (fother == NULL)
error("Lex driver missing, file %s", path);
while ((i = getc(fother)) != EOF)
diff --git a/usr/src/cmd/sgs/lex/common/once.h b/usr/src/cmd/sgs/lex/common/once.h
index 014ca00b17..9e4b0e5e00 100644
--- a/usr/src/cmd/sgs/lex/common/once.h
+++ b/usr/src/cmd/sgs/lex/common/once.h
@@ -26,11 +26,11 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
+/* Copyright (c) 2013, joyent, Inc. All rights reserved. */
+
#ifndef _ONCE_H
#define _ONCE_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ldefs.h"
/* once.c */
@@ -73,9 +73,11 @@ int peek = '\n'; /* next input character */
CHR *pushptr = pushc;
CHR *slptr = slist;
-#define CNAME "/usr/share/lib/ccs/ncform"
-#define RATNAME "/usr/share/lib/ccs/nrform"
-#define EUCNAME "/usr/share/lib/ccs/nceucform"
+#define NPREFIX "/usr"
+#define NBASE "/share/lib/ccs/"
+#define CNAME "ncform"
+#define RATNAME "nrform"
+#define EUCNAME "nceucform"
int ccount = 1;
int casecount = 1;
diff --git a/usr/src/cmd/sgs/libld/common/map_support.c b/usr/src/cmd/sgs/libld/common/map_support.c
index 5feaae04d9..683cb59102 100644
--- a/usr/src/cmd/sgs/libld/common/map_support.c
+++ b/usr/src/cmd/sgs/libld/common/map_support.c
@@ -28,6 +28,10 @@
*/
/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+/*
* Map file parsing (Shared Support Code).
*/
#include <stdio.h>
@@ -1075,34 +1079,33 @@ ld_map_sym_enter(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms)
hash = (Word)elf_hash(ms->ms_name);
DBG_CALL(Dbg_map_version(ofl->ofl_lml, mv->mv_name, ms->ms_name,
mv->mv_scope));
- if ((sdp = ld_sym_find(ms->ms_name, hash, &where, ofl)) == NULL) {
- if ((sym = libld_calloc(sizeof (Sym), 1)) == NULL)
- return (FALSE);
+ /*
+ * Make sure that any parent or external declarations fall back to
+ * references.
+ */
+ if (ms->ms_sdflags & (FLG_SY_PARENT | FLG_SY_EXTERN)) {
/*
- * Make sure any parent or external declarations
- * fall back to references.
+ * Turn it into a reference by setting the section index
+ * to UNDEF.
*/
- if (ms->ms_sdflags & (FLG_SY_PARENT | FLG_SY_EXTERN)) {
- /*
- * Turn it into a reference by setting
- * the section index to UNDEF.
- */
- sym->st_shndx = ms->ms_shndx = SHN_UNDEF;
+ ms->ms_shndx = SHN_UNDEF;
- /*
- * It is wrong to specify size or value for an
- * external symbol.
- */
- if (ms->ms_value_set || (ms->ms_size != 0)) {
- mf_fatal0(mf, MSG_INTL(MSG_MAP_NOEXVLSZ));
- mv->mv_errcnt++;
- return (TRUE);
- }
- } else {
- sym->st_shndx = (Half)ms->ms_shndx;
+ /*
+ * It is wrong to specify size or value for an external symbol.
+ */
+ if (ms->ms_value_set || (ms->ms_size != 0)) {
+ mf_fatal0(mf, MSG_INTL(MSG_MAP_NOEXVLSZ));
+ mv->mv_errcnt++;
+ return (TRUE);
}
+ }
+
+ if ((sdp = ld_sym_find(ms->ms_name, hash, &where, ofl)) == NULL) {
+ if ((sym = libld_calloc(sizeof (Sym), 1)) == NULL)
+ return (FALSE);
+ sym->st_shndx = (Half)ms->ms_shndx;
sym->st_value = ms->ms_value;
sym->st_size = ms->ms_size;
sym->st_info = ELF_ST_INFO(STB_GLOBAL, ms->ms_type);
@@ -1135,7 +1138,6 @@ ld_map_sym_enter(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms)
* from different mapfiles can augment each
* other.
*/
- /* BEGIN CSTYLED */
if (sym->st_value) {
if (ms->ms_value && (sym->st_value != ms->ms_value))
conflict = MSG_INTL(MSG_MAP_DIFF_SYMVAL);
@@ -1162,7 +1164,6 @@ ld_map_sym_enter(Mapfile *mf, ld_map_ver_t *mv, ld_map_sym_t *ms)
} else {
sym->st_shndx = sdp->sd_shndx = ms->ms_shndx;
}
- /* END CSTYLED */
if ((sdp->sd_flags & MSK_SY_GLOBAL) &&
(sdp->sd_aux->sa_overndx != VER_NDX_GLOBAL) &&
diff --git a/usr/src/cmd/sgs/lorder/lorder.sh b/usr/src/cmd/sgs/lorder/lorder.sh
index 4b518e3d61..bea4cd4804 100644
--- a/usr/src/cmd/sgs/lorder/lorder.sh
+++ b/usr/src/cmd/sgs/lorder/lorder.sh
@@ -36,7 +36,7 @@ else
fi
trap "rm -f $TDIR/$$symdef $TDIR/$$symref $TDIR/$$tmp; exit" 1 2 13 15
PFX=
-WHERE=/usr/ccs/bin
+WHERE=/usr/bin
USAGE="Usage: ${PFX}lorder file ..."
for i in "$@"
diff --git a/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c b/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c
index a6ac1a7c50..ddc44484a6 100644
--- a/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c
+++ b/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -297,7 +298,8 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from)
rtldexit(lml, 1);
}
- if ((lml->lm_tflags | AFLAGS(lmp)) & LML_TFLG_AUD_SYMBIND) {
+ if ((lml->lm_tflags | AFLAGS(lmp) | AFLAGS(nlmp)) &
+ LML_TFLG_AUD_SYMBIND) {
uint_t symndx = (((uintptr_t)nsym -
(uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp));
symval = audit_symbind(lmp, nlmp, nsym, symndx, symval,
diff --git a/usr/src/cmd/sgs/rtld/common/audit.c b/usr/src/cmd/sgs/rtld/common/audit.c
index 9d2fd0b9d8..7446e30b43 100644
--- a/usr/src/cmd/sgs/rtld/common/audit.c
+++ b/usr/src/cmd/sgs/rtld/common/audit.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*
* Audit interfaces. Auditing can be enabled in two ways:
*
@@ -986,19 +987,23 @@ _audit_symbind(APlist *list, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx,
if (alp->al_symbind == 0)
continue;
- if ((racp = _audit_client(AUDINFO(rlmp), almp)) == NULL)
+
+ if ((racp = _audit_client(AUDINFO(rlmp), almp)) != NULL &&
+ (racp->ac_flags & FLG_AC_BINDFROM) == 0)
continue;
+
if ((dacp = _audit_client(AUDINFO(dlmp), almp)) == NULL)
continue;
- if (((racp->ac_flags & FLG_AC_BINDFROM) == 0) ||
- ((dacp->ac_flags & FLG_AC_BINDTO) == 0))
+
+ if ((dacp->ac_flags & FLG_AC_BINDTO) == 0)
continue;
/*
- * The la_symbind interface is only called when the calling
- * object has been identified as BINDFROM, and the destination
- * object has been identified as BINDTO. Use a local version of
- * the flags, so that any user update can be collected.
+ * The la_symbind interface is only called when the destination
+ * object has been identified as BINDTO and either the
+ * destination object is being locally audited or the calling
+ * object has been identified as BINDFROM. Use a local version
+ * of the flags, so that any user update can be collected.
*/
(*called)++;
lflags = (oflags & ~(LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT));
@@ -1007,8 +1012,8 @@ _audit_symbind(APlist *list, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx,
alp->al_libname, name, ovalue, oflags));
leave(alml, thr_flg_reenter);
- sym->st_value = (*alp->al_symbind)(sym, ndx,
- &(racp->ac_cookie), &(dacp->ac_cookie),
+ sym->st_value = (*alp->al_symbind)(sym, ndx, racp == NULL ?
+ NULL : &(racp->ac_cookie), &(dacp->ac_cookie),
/* BEGIN CSTYLED */
#if defined(_ELF64)
&lflags, name);
@@ -1065,10 +1070,17 @@ audit_symbind(Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx, Addr value,
if (auditors && (auditors->ad_flags & LML_TFLG_AUD_SYMBIND))
nsym.st_value = _audit_symbind(auditors->ad_list,
rlmp, dlmp, &nsym, ndx, flags, &called);
- if (AUDITORS(rlmp) && (AUDITORS(rlmp)->ad_flags & LML_TFLG_AUD_SYMBIND))
+
+ if ((AUDITORS(rlmp) && AUDITORS(rlmp)->ad_flags & LML_TFLG_AUD_SYMBIND))
nsym.st_value = _audit_symbind(AUDITORS(rlmp)->ad_list,
rlmp, dlmp, &nsym, ndx, flags, &called);
+ if (dlmp != rlmp && (AUDITORS(dlmp) &&
+ (AUDITORS(dlmp)->ad_flags & LML_TFLG_AUD_SYMBIND))) {
+ nsym.st_value = _audit_symbind(AUDITORS(dlmp)->ad_list,
+ rlmp, dlmp, &nsym, ndx, flags, &called);
+ }
+
/*
* If no la_symbind() was called for this interface, fabricate that no
* la_pltenter, or la_pltexit is required. This helps reduce the glue
diff --git a/usr/src/cmd/sgs/rtld/common/dlfcns.c b/usr/src/cmd/sgs/rtld/common/dlfcns.c
index a8aaf3805e..74432c1686 100644
--- a/usr/src/cmd/sgs/rtld/common/dlfcns.c
+++ b/usr/src/cmd/sgs/rtld/common/dlfcns.c
@@ -24,6 +24,7 @@
* All Rights Reserved
*
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -1390,7 +1391,8 @@ dlsym_core(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp,
DBG_CALL(Dbg_bind_global(clmp, 0, 0, (Xword)-1, PLT_T_NONE,
*dlmp, addr, sym->st_value, sr.sr_name, binfo));
- if ((lml->lm_tflags | AFLAGS(clmp)) & LML_TFLG_AUD_SYMBIND) {
+ if ((lml->lm_tflags | AFLAGS(clmp) | AFLAGS(*dlmp)) &
+ LML_TFLG_AUD_SYMBIND) {
uint_t sb_flags = LA_SYMB_DLSYM;
/* LINTED */
uint_t symndx = (uint_t)(((Xword)sym -
diff --git a/usr/src/cmd/sgs/rtld/i386/i386_elf.c b/usr/src/cmd/sgs/rtld/i386/i386_elf.c
index f1320605dd..4bf825e4d9 100644
--- a/usr/src/cmd/sgs/rtld/i386/i386_elf.c
+++ b/usr/src/cmd/sgs/rtld/i386/i386_elf.c
@@ -24,6 +24,7 @@
* All Rights Reserved
*
* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -276,7 +277,8 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from)
rtldexit(lml, 1);
}
- if ((lml->lm_tflags | AFLAGS(lmp)) & LML_TFLG_AUD_SYMBIND) {
+ if ((lml->lm_tflags | AFLAGS(lmp) | AFLAGS(nlmp)) &
+ LML_TFLG_AUD_SYMBIND) {
uint_t symndx = (((uintptr_t)nsym -
(uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp));
symval = audit_symbind(lmp, nlmp, nsym, symndx, symval,
diff --git a/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c b/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c
index dff287349d..4387276e26 100644
--- a/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c
+++ b/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c
@@ -24,6 +24,7 @@
* All Rights Reserved
*
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -448,7 +449,8 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from)
rtldexit(lml, 1);
}
- if ((lml->lm_tflags | AFLAGS(lmp)) & LML_TFLG_AUD_SYMBIND) {
+ if ((lml->lm_tflags | AFLAGS(lmp) | AFLAGS(nlmp)) &
+ LML_TFLG_AUD_SYMBIND) {
ulong_t symndx = (((uintptr_t)nsym -
(uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp));
diff --git a/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c b/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c
index 66e30f2ba6..1a719329da 100644
--- a/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c
+++ b/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -589,7 +590,8 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from)
rtldexit(lml, 1);
}
- if ((lml->lm_tflags | AFLAGS(lmp)) & LML_TFLG_AUD_SYMBIND) {
+ if ((lml->lm_tflags | AFLAGS(lmp) | AFLAGS(nlmp)) &
+ LML_TFLG_AUD_SYMBIND) {
/* LINTED */
uint_t symndx = (uint_t)(((uintptr_t)nsym -
(uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp));
diff --git a/usr/src/cmd/sgs/yacc/common/dextern.h b/usr/src/cmd/sgs/yacc/common/dextern.h
index e90aa60468..54b441cac4 100644
--- a/usr/src/cmd/sgs/yacc/common/dextern.h
+++ b/usr/src/cmd/sgs/yacc/common/dextern.h
@@ -26,11 +26,13 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
#ifndef _DEXTERN_H
#define _DEXTERN_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <inttypes.h>
#include <ctype.h>
@@ -42,6 +44,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <wctype.h>
+#include <limits.h>
#ifdef __cplusplus
extern "C" {
@@ -301,6 +304,12 @@ extern int wscmp(const wchar_t *, const wchar_t *);
extern char *parser;
+#ifndef PBUFSIZE
+#define PBUFSIZE PATH_MAX
+#endif
+
+extern char pbuf[PBUFSIZE];
+
/* default settings for a number of macros */
/* name of yacc tempfiles */
@@ -324,7 +333,11 @@ extern char *parser;
#endif
#ifndef PARSER
-#define PARSER "/usr/share/lib/ccs/yaccpar"
+#define PARSER "/share/lib/ccs/yaccpar"
+#endif
+
+#ifndef PARSERPREFIX
+#define PARSERPREFIX "/usr"
#endif
/*
diff --git a/usr/src/cmd/sgs/yacc/common/y1.c b/usr/src/cmd/sgs/yacc/common/y1.c
index 845f82d367..0e67d9047b 100644
--- a/usr/src/cmd/sgs/yacc/common/y1.c
+++ b/usr/src/cmd/sgs/yacc/common/y1.c
@@ -26,7 +26,9 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include "dextern.h"
#include <sys/param.h>
@@ -34,6 +36,7 @@
#include <unistd.h>
#include <locale.h>
#include <stdarg.h> /* For error() */
+#include <libgen.h>
static void mktbls(void);
static void others(void);
@@ -236,6 +239,25 @@ mktbls()
lsetsize = INIT_LSIZE + 1;
}
+static int
+yacc_assemble_path(char *buf, size_t size, const char *file, int type)
+{
+ int ret;
+ char origin[PATH_MAX];
+
+ if (type != 0) {
+ ret = readlink("/proc/self/path/a.out", origin, PATH_MAX - 1);
+ if (ret < 0)
+ error(gettext(
+ "yacc: failed to read origin from /proc\n"));
+ origin[ret] = '\0';
+ return (snprintf(buf, size, "%s/../%s", dirname(origin),
+ file));
+ }
+
+ return (snprintf(buf, size, "%s/%s", PARSERPREFIX, file));
+}
+
/* put out other arrays, copy the parsers */
static void
others()
@@ -244,7 +266,17 @@ others()
int c, i, j;
int tmpline;
- finput = fopen(parser, "r");
+ if (parser == NULL) {
+ parser = pbuf;
+ (void) yacc_assemble_path(pbuf, PBUFSIZE, PARSER, 1);
+ finput = fopen(parser, "r");
+ if (finput == NULL) {
+ (void) yacc_assemble_path(pbuf, PBUFSIZE, PARSER, 0);
+ finput = fopen(parser, "r");
+ }
+ } else {
+ finput = fopen(parser, "r");
+ }
if (finput == NULL)
/*
* TRANSLATION_NOTE -- This is a message from yacc.
diff --git a/usr/src/cmd/sgs/yacc/common/y2.c b/usr/src/cmd/sgs/yacc/common/y2.c
index 3599d40904..ca8dcc61f5 100644
--- a/usr/src/cmd/sgs/yacc/common/y2.c
+++ b/usr/src/cmd/sgs/yacc/common/y2.c
@@ -26,7 +26,9 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include "dextern.h"
#include "sgs.h"
@@ -60,7 +62,8 @@ char *infile; /* input file name */
static int numbval; /* value of an input number */
static int toksize = NAMESIZE;
static wchar_t *tokname; /* input token name */
-char *parser = PARSER; /* location of common parser */
+char *parser = NULL; /* location of common parser */
+char pbuf[PBUFSIZE];
static void finact(void);
static wchar_t *cstash(wchar_t *);
diff --git a/usr/src/cmd/ssh/Makefile b/usr/src/cmd/ssh/Makefile
index 8a537946b7..c2b7ee0e03 100644
--- a/usr/src/cmd/ssh/Makefile
+++ b/usr/src/cmd/ssh/Makefile
@@ -75,7 +75,7 @@ check: $(CHECKHDRS)
_msg:
$(RM) $(POFILE)
$(TOUCH) $(POFILE)
- $(MAKE) $(POFILE) XGETTEXT=/usr/bin/gxgettext
+ $(MAKE) $(POFILE) XGETTEXT=$(GNUXGETTEXT)
$(CP) $(POFILE) $(MSGFILE)
$(CP) $(MSGFILE) $(MSGDOMAIN)
diff --git a/usr/src/cmd/ssh/include/key.h b/usr/src/cmd/ssh/include/key.h
index 862b2d81d4..ec4993a9c1 100644
--- a/usr/src/cmd/ssh/include/key.h
+++ b/usr/src/cmd/ssh/include/key.h
@@ -39,11 +39,17 @@ extern "C" {
typedef struct Key Key;
enum types {
- KEY_RSA1,
- KEY_RSA,
- KEY_DSA,
+ KEY_RSA1,
+ KEY_RSA,
+ KEY_DSA,
+ KEY_ECDSA,
+ KEY_RSA_CERT,
+ KEY_DSA_CERT,
+ KEY_ECDSA_CERT,
+ KEY_RSA_CERT_V00,
+ KEY_DSA_CERT_V00,
KEY_NULL,
- KEY_UNSPEC
+ KEY_UNSPEC
};
enum fp_type {
SSH_FP_SHA1,
@@ -87,6 +93,7 @@ int key_names_valid2(const char *);
int key_sign(Key *, u_char **, u_int *, u_char *, u_int);
int key_verify(Key *, u_char *, u_int, u_char *, u_int);
+int key_type_plain(int type);
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/cmd/ssh/include/servconf.h b/usr/src/cmd/ssh/include/servconf.h
index a66c6415cb..9a32544c2a 100644
--- a/usr/src/cmd/ssh/include/servconf.h
+++ b/usr/src/cmd/ssh/include/servconf.h
@@ -167,6 +167,7 @@ typedef struct {
char *pre_userauth_hook;
char *pam_service_prefix;
char *pam_service_name;
+ char *pubkey_plugin;
} ServerOptions;
diff --git a/usr/src/cmd/ssh/libssh/common/canohost.c b/usr/src/cmd/ssh/libssh/common/canohost.c
index 2d427b9e8d..87aab396cf 100644
--- a/usr/src/cmd/ssh/libssh/common/canohost.c
+++ b/usr/src/cmd/ssh/libssh/common/canohost.c
@@ -73,9 +73,6 @@ get_remote_hostname(int socket, int verify_reverse_mapping)
if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name),
NULL, 0, NI_NAMEREQD) != 0) {
/* Host name not found. Use ip address. */
-#if 0
- log("Could not reverse map address %.100s.", ntop);
-#endif
return xstrdup(ntop);
}
@@ -206,36 +203,6 @@ get_socket_address(int socket, int remote, int flags)
return (xstrdup(result));
}
-#if 0
-static char *
-get_socket_address(int socket, int remote, int flags)
-{
- struct sockaddr_storage addr;
- socklen_t addrlen;
- char ntop[NI_MAXHOST];
-
- /* Get IP address of client. */
- addrlen = sizeof(addr);
- memset(&addr, 0, sizeof(addr));
-
- if (remote) {
- if (getpeername(socket, (struct sockaddr *)&addr, &addrlen)
- < 0)
- return NULL;
- } else {
- if (getsockname(socket, (struct sockaddr *)&addr, &addrlen)
- < 0)
- return NULL;
- }
- /* Get the address in ascii. */
- if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop),
- NULL, 0, flags) != 0) {
- error("get_socket_ipaddr: getnameinfo %d failed", flags);
- return NULL;
- }
- return xstrdup(ntop);
-}
-#endif
char *
get_peer_ipaddr(int socket)
@@ -388,4 +355,4 @@ inet_ntop_native(int af, const void *src, char *dst, size_t size)
}
return (result);
-}
+}
diff --git a/usr/src/cmd/ssh/libssh/common/key.c b/usr/src/cmd/ssh/libssh/common/key.c
index f648d3b640..8ee2583d93 100644
--- a/usr/src/cmd/ssh/libssh/common/key.c
+++ b/usr/src/cmd/ssh/libssh/common/key.c
@@ -874,3 +874,20 @@ key_demote(Key *k)
return (pk);
}
+
+int
+key_type_plain(int type)
+{
+ switch (type) {
+ case KEY_RSA_CERT_V00:
+ case KEY_RSA_CERT:
+ return KEY_RSA;
+ case KEY_DSA_CERT_V00:
+ case KEY_DSA_CERT:
+ return KEY_DSA;
+ case KEY_ECDSA_CERT:
+ return KEY_ECDSA;
+ default:
+ return type;
+ }
+}
diff --git a/usr/src/cmd/ssh/ssh-keygen/ssh-keygen.c b/usr/src/cmd/ssh/ssh-keygen/ssh-keygen.c
index ebad79b0f8..c79e76ae36 100644
--- a/usr/src/cmd/ssh/ssh-keygen/ssh-keygen.c
+++ b/usr/src/cmd/ssh/ssh-keygen/ssh-keygen.c
@@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell".
*/
-/* $OpenBSD: ssh-keygen.c,v 1.160 2007/01/21 01:41:54 stevesk Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.205 2011/01/11 06:13:10 djm Exp $ */
#include "includes.h"
#include <openssl/evp.h>
@@ -76,9 +76,14 @@ char *identity_new_passphrase = NULL;
/* This is set to the new comment if given on the command line. */
char *identity_comment = NULL;
-/* Dump public key file in format used by real and the original SSH 2 */
-int convert_to_ssh2 = 0;
-int convert_from_ssh2 = 0;
+/* Conversion to/from various formats */
+int convert_to = 0;
+int convert_from = 0;
+enum {
+ FMT_RFC4716,
+ FMT_PKCS8,
+ FMT_PEM
+} convert_format = FMT_RFC4716;
int print_public = 0;
char *key_type_name = NULL;
@@ -154,41 +159,105 @@ load_identity(char *filename)
#define SSH_COM_PRIVATE_KEY_MAGIC 0x3f6ff9eb
static void
-do_convert_to_ssh2(struct passwd *pw)
+do_convert_to_ssh2(struct passwd *pw, Key *k)
{
- Key *k;
u_int len;
u_char *blob;
- struct stat st;
+ char comment[61];
- if (!have_identity)
- ask_filename(pw, gettext("Enter file in which the key is"));
- if (stat(identity_file, &st) < 0) {
- perror(identity_file);
+ if (key_to_blob(k, &blob, &len) <= 0) {
+ fprintf(stderr, "key_to_blob failed\n");
exit(1);
}
+ /* Comment + surrounds must fit into 72 chars (RFC 4716 sec 3.3) */
+ snprintf(comment, sizeof(comment),
+ "%u-bit %s, converted by %s@%s from OpenSSH",
+ key_size(k), key_type(k),
+ pw->pw_name, hostname);
+
+ fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN);
+ fprintf(stdout, "Comment: \"%s\"\n", comment);
+ dump_base64(stdout, blob, len);
+ fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END);
+ key_free(k);
+ xfree(blob);
+ exit(0);
+}
+
+static void
+do_convert_to_pkcs8(Key *k)
+{
+ switch (key_type_plain(k->type)) {
+ case KEY_RSA:
+ if (!PEM_write_RSA_PUBKEY(stdout, k->rsa))
+ fatal("PEM_write_RSA_PUBKEY failed");
+ break;
+ case KEY_DSA:
+ if (!PEM_write_DSA_PUBKEY(stdout, k->dsa))
+ fatal("PEM_write_DSA_PUBKEY failed");
+ break;
+ default:
+ fatal("%s: unsupported key type %s", __func__, key_type(k));
+ }
+ exit(0);
+}
+
+static void
+do_convert_to_pem(Key *k)
+{
+ switch (key_type_plain(k->type)) {
+ case KEY_RSA:
+ if (!PEM_write_RSAPublicKey(stdout, k->rsa))
+ fatal("PEM_write_RSAPublicKey failed");
+ break;
+ case KEY_DSA:
+ if (!PEM_write_DSA_PUBKEY(stdout, k->dsa))
+ fatal("PEM_write_DSAPublicKey failed");
+ break;
+ default:
+ fatal("%s: unsupported key type %s", __func__, key_type(k));
+ }
+ exit(0);
+}
+
+static void
+do_convert_to(struct passwd *pw)
+{
+ Key *k;
+ struct stat st;
+
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0)
+ fatal("%s: %s: %s", __progname, identity_file, strerror(errno));
if ((k = key_load_public(identity_file, NULL)) == NULL) {
if ((k = load_identity(identity_file)) == NULL) {
- fprintf(stderr, gettext("load failed\n"));
+ fprintf(stderr, "load failed\n");
exit(1);
}
}
- if (key_to_blob(k, &blob, &len) <= 0) {
- fprintf(stderr, gettext("key_to_blob failed\n"));
+ if (k->type == KEY_RSA1) {
+ fprintf(stderr, "version 1 keys are not supported\n");
exit(1);
}
- fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN);
- fprintf(stdout, gettext(
- "Comment: \"%u-bit %s, converted from OpenSSH by %s@%s\"\n"),
- key_size(k), key_type(k),
- pw->pw_name, hostname);
- dump_base64(stdout, blob, len);
- fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END);
- key_free(k);
- xfree(blob);
+
+ switch (convert_format) {
+ case FMT_RFC4716:
+ do_convert_to_ssh2(pw, k);
+ break;
+ case FMT_PKCS8:
+ do_convert_to_pkcs8(k);
+ break;
+ case FMT_PEM:
+ do_convert_to_pem(k);
+ break;
+ default:
+ fatal("%s: unknown key format %d", __func__, convert_format);
+ }
exit(0);
}
+
static void
buffer_get_bignum_bits(Buffer *b, BIGNUM *value)
{
@@ -327,24 +396,16 @@ get_line(FILE *fp, char *line, size_t len)
}
static void
-do_convert_from_ssh2(struct passwd *pw)
+do_convert_from_ssh2(struct passwd *pw, Key **k, int *private)
{
- Key *k;
int blen;
u_int len;
char line[1024];
u_char blob[8096];
char encoded[8096];
- struct stat st;
- int escaped = 0, private = 0, ok;
+ int escaped = 0;
FILE *fp;
- if (!have_identity)
- ask_filename(pw, gettext("Enter file in which the key is"));
- if (stat(identity_file, &st) < 0) {
- perror(identity_file);
- exit(1);
- }
fp = fopen(identity_file, "r");
if (fp == NULL) {
perror(identity_file);
@@ -357,7 +418,7 @@ do_convert_from_ssh2(struct passwd *pw)
if (strncmp(line, "----", 4) == 0 ||
strstr(line, ": ") != NULL) {
if (strstr(line, SSH_COM_PRIVATE_BEGIN) != NULL)
- private = 1;
+ *private = 1;
if (strstr(line, " END ") != NULL) {
break;
}
@@ -382,26 +443,117 @@ do_convert_from_ssh2(struct passwd *pw)
fprintf(stderr, gettext("uudecode failed.\n"));
exit(1);
}
- k = private ?
+ *k = *private ?
do_convert_private_ssh2_from_blob(blob, blen) :
key_from_blob(blob, blen);
- if (k == NULL) {
+ if (*k == NULL) {
fprintf(stderr, gettext("decode blob failed.\n"));
exit(1);
}
- ok = private ?
- (k->type == KEY_DSA ?
- PEM_write_DSAPrivateKey(stdout, k->dsa, NULL, NULL, 0, NULL, NULL) :
- PEM_write_RSAPrivateKey(stdout, k->rsa, NULL, NULL, 0, NULL, NULL)) :
- key_write(k, stdout);
+ fclose(fp);
+}
+
+static void
+do_convert_from_pkcs8(Key **k, int *private)
+{
+ EVP_PKEY *pubkey;
+ FILE *fp;
+
+ if ((fp = fopen(identity_file, "r")) == NULL)
+ fatal("%s: %s: %s", __progname, identity_file, strerror(errno));
+ if ((pubkey = PEM_read_PUBKEY(fp, NULL, NULL, NULL)) == NULL) {
+ fatal("%s: %s is not a recognised public key format", __func__,
+ identity_file);
+ }
+ fclose(fp);
+ switch (EVP_PKEY_type(pubkey->type)) {
+ case EVP_PKEY_RSA:
+ *k = key_new(KEY_UNSPEC);
+ (*k)->type = KEY_RSA;
+ (*k)->rsa = EVP_PKEY_get1_RSA(pubkey);
+ break;
+ case EVP_PKEY_DSA:
+ *k = key_new(KEY_UNSPEC);
+ (*k)->type = KEY_DSA;
+ (*k)->dsa = EVP_PKEY_get1_DSA(pubkey);
+ break;
+ default:
+ fatal("%s: unsupported pubkey type %d", __func__,
+ EVP_PKEY_type(pubkey->type));
+ }
+ EVP_PKEY_free(pubkey);
+ return;
+}
+
+static void
+do_convert_from_pem(Key **k, int *private)
+{
+ FILE *fp;
+ RSA *rsa;
+
+ if ((fp = fopen(identity_file, "r")) == NULL)
+ fatal("%s: %s: %s", __progname, identity_file, strerror(errno));
+ if ((rsa = PEM_read_RSAPublicKey(fp, NULL, NULL, NULL)) != NULL) {
+ *k = key_new(KEY_UNSPEC);
+ (*k)->type = KEY_RSA;
+ (*k)->rsa = rsa;
+ fclose(fp);
+ return;
+ }
+ fatal("%s: unrecognised raw private key format", __func__);
+}
+
+static void
+do_convert_from(struct passwd *pw)
+{
+ Key *k = NULL;
+ int private = 0, ok = 0;
+ struct stat st;
+
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0)
+ fatal("%s: %s: %s", __progname, identity_file, strerror(errno));
+
+ switch (convert_format) {
+ case FMT_RFC4716:
+ do_convert_from_ssh2(pw, &k, &private);
+ break;
+ case FMT_PKCS8:
+ do_convert_from_pkcs8(&k, &private);
+ break;
+ case FMT_PEM:
+ do_convert_from_pem(&k, &private);
+ break;
+ default:
+ fatal("%s: unknown key format %d", __func__, convert_format);
+ }
+
+ if (!private)
+ ok = key_write(k, stdout);
+ if (ok)
+ fprintf(stdout, "\n");
+ else {
+ switch (k->type) {
+ case KEY_DSA:
+ ok = PEM_write_DSAPrivateKey(stdout, k->dsa, NULL,
+ NULL, 0, NULL, NULL);
+ break;
+ case KEY_RSA:
+ ok = PEM_write_RSAPrivateKey(stdout, k->rsa, NULL,
+ NULL, 0, NULL, NULL);
+ break;
+ default:
+ fatal("%s: unsupported key type %s", __func__,
+ key_type(k));
+ }
+ }
+
if (!ok) {
- fprintf(stderr, gettext("key write failed"));
+ fprintf(stderr, "key write failed\n");
exit(1);
}
key_free(k);
- if (!private)
- fprintf(stdout, "\n");
- fclose(fp);
exit(0);
}
@@ -917,12 +1069,13 @@ usage(void)
" -B Show bubblebabble digest of key file.\n"
" -c Change comment in private and public key files.\n"
" -C comment Provide new comment.\n"
- " -e Convert OpenSSH to IETF SECSH key file.\n"
+ " -e Convert OpenSSH to foreign format key file.\n"
" -f filename Filename of the key file.\n"
" -F hostname Find hostname in known hosts file.\n"
" -H Hash names in known_hosts file.\n"
- " -i Convert IETF SECSH to OpenSSH key file.\n"
+ " -i Convert foreign format to OpenSSH key file.\n"
" -l Show fingerprint of key file.\n"
+ " -m key_fmt Conversion format for -e/-i (PEM|PKCS8|RFC4716).\n"
" -N phrase Provide new passphrase.\n"
" -p Change passphrase of private key file.\n"
" -P phrase Provide old passphrase.\n"
@@ -974,7 +1127,7 @@ main(int argc, char **argv)
exit(1);
}
-#define GETOPT_ARGS "BcdeHilpqxXyb:C:f:F:N:P:R:t:"
+#define GETOPT_ARGS "BcdeHilpqxXyb:C:f:F:m:N:P:R:t:"
while ((opt = getopt(argc, argv, GETOPT_ARGS)) != -1) {
switch (opt) {
@@ -1002,6 +1155,22 @@ main(int argc, char **argv)
case 'B':
print_bubblebabble = 1;
break;
+ case 'm':
+ if (strcasecmp(optarg, "RFC4716") == 0 ||
+ strcasecmp(optarg, "ssh2") == 0) {
+ convert_format = FMT_RFC4716;
+ break;
+ }
+ if (strcasecmp(optarg, "PKCS8") == 0) {
+ convert_format = FMT_PKCS8;
+ break;
+ }
+ if (strcasecmp(optarg, "PEM") == 0) {
+ convert_format = FMT_PEM;
+ break;
+ }
+ fatal("Unsupported conversion format \"%s\"", optarg);
+ /*NOTREACHED*/
case 'p':
change_passphrase = 1;
break;
@@ -1027,12 +1196,12 @@ main(int argc, char **argv)
case 'e':
case 'x':
/* export key */
- convert_to_ssh2 = 1;
+ convert_to = 1;
break;
case 'i':
case 'X':
/* import key */
- convert_from_ssh2 = 1;
+ convert_from = 1;
break;
case 'y':
print_public = 1;
@@ -1064,10 +1233,10 @@ main(int argc, char **argv)
do_change_passphrase(pw);
if (change_comment)
do_change_comment(pw);
- if (convert_to_ssh2)
- do_convert_to_ssh2(pw);
- if (convert_from_ssh2)
- do_convert_from_ssh2(pw);
+ if (convert_to)
+ do_convert_to(pw);
+ if (convert_from)
+ do_convert_from(pw);
if (print_public)
do_print_public(pw);
diff --git a/usr/src/cmd/ssh/sshd/auth2-pubkey.c b/usr/src/cmd/ssh/sshd/auth2-pubkey.c
index 658634c195..c1c5f540e4 100644
--- a/usr/src/cmd/ssh/sshd/auth2-pubkey.c
+++ b/usr/src/cmd/ssh/sshd/auth2-pubkey.c
@@ -26,6 +26,8 @@
* Use is subject to license terms.
*/
+#include <dlfcn.h>
+
#include "includes.h"
RCSID("$OpenBSD: auth2-pubkey.c,v 1.2 2002/05/31 11:35:15 markus Exp $");
@@ -54,6 +56,13 @@ extern ServerOptions options;
extern u_char *session_id2;
extern int session_id2_len;
+/* global plugin function requirements */
+static const char *RSA_SYM_NAME = "sshd_user_rsa_key_allowed";
+static const char *DSA_SYM_NAME = "sshd_user_rsa_key_allowed";
+typedef int (*RSA_SYM)(struct passwd *, RSA *, const char *);
+typedef int (*DSA_SYM)(struct passwd *, DSA *, const char *);
+
+
static void
userauth_pubkey(Authctxt *authctxt)
{
@@ -309,7 +318,98 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file)
return found_key;
}
-/* check whether given key is in .ssh/authorized_keys* */
+/**
+ * Checks whether or not access is allowed based on a plugin specified
+ * in sshd_config (PubKeyPlugin).
+ *
+ * Note that this expects a symbol in the loaded library that takes
+ * the current user (pwd entry), the current RSA key and it's fingerprint.
+ * The symbol is expected to return 1 on success and 0 on failure.
+ *
+ * While we could optimize this code to dlopen once in the process' lifetime,
+ * sshd is already a slow beast, so this is really not a concern.
+ * The overhead is basically a rounding error compared to everything else, and
+ * it keeps this code minimally invasive.
+ */
+static int
+user_key_allowed_from_plugin(struct passwd *pw, Key *key)
+{
+ RSA_SYM rsa_sym = NULL;
+ DSA_SYM dsa_sym = NULL;
+ char *fp = NULL;
+ void *handle = NULL;
+ int success = 0;
+
+ if (options.pubkey_plugin == NULL || pw == NULL || key == NULL ||
+ (key->type != KEY_RSA && key->type != KEY_RSA1 &&
+ key->type != KEY_DSA && key->type != KEY_ECDSA))
+ return success;
+
+ handle = dlopen(options.pubkey_plugin, RTLD_NOW);
+ if ((handle == NULL)) {
+ debug("Unable to open library %s: %s", options.pubkey_plugin,
+ dlerror());
+ goto out;
+ }
+
+ fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
+ if (fp == NULL) {
+ debug("failed to generate fingerprint");
+ goto out;
+ }
+
+ switch (key->type) {
+ case KEY_RSA1:
+ case KEY_RSA:
+ rsa_sym = (RSA_SYM)dlsym(handle, RSA_SYM_NAME);
+ if (rsa_sym == NULL) {
+ debug("Unable to resolve symbol %s: %s", RSA_SYM_NAME,
+ dlerror());
+ goto out;
+ }
+ debug2("Invoking %s from %s", RSA_SYM_NAME,
+ options.pubkey_plugin);
+ success = (*rsa_sym)(pw, key->rsa, fp);
+ break;
+ case KEY_DSA:
+ case KEY_ECDSA:
+ dsa_sym = (DSA_SYM)dlsym(handle, RSA_SYM_NAME);
+ if (dsa_sym == NULL) {
+ debug("Unable to resolve symbol %s: %s", DSA_SYM_NAME,
+ dlerror());
+ goto out;
+ }
+ debug2("Invoking %s from %s", DSA_SYM_NAME,
+ options.pubkey_plugin);
+ success = (*dsa_sym)(pw, key->dsa, fp);
+ break;
+ default:
+ debug2("user_key_plugins only support RSA keys");
+ }
+
+ debug("sshd_plugin returned: %d", success);
+
+out:
+ if (handle != NULL) {
+ dlclose(handle);
+ dsa_sym = NULL;
+ rsa_sym = NULL;
+ handle = NULL;
+ }
+
+ if (success)
+ verbose("Found matching %s key: %s", key_type(key), fp);
+
+ if (fp != NULL) {
+ xfree(fp);
+ fp = NULL;
+ }
+
+ return success;
+}
+
+
+/* check whether given key is in .ssh/authorized_keys or a plugin */
int
user_key_allowed(struct passwd *pw, Key *key)
{
@@ -329,6 +429,13 @@ user_key_allowed(struct passwd *pw, Key *key)
file = authorized_keys_file2(pw);
success = user_key_allowed2(pw, key, file);
xfree(file);
+
+ if (success)
+ return success;
+
+ /* try from a plugin */
+ success = user_key_allowed_from_plugin(pw, key);
+
return success;
}
diff --git a/usr/src/cmd/ssh/sshd/servconf.c b/usr/src/cmd/ssh/sshd/servconf.c
index 516466bbc1..16f1dcecf7 100644
--- a/usr/src/cmd/ssh/sshd/servconf.c
+++ b/usr/src/cmd/ssh/sshd/servconf.c
@@ -155,6 +155,7 @@ initialize_server_options(ServerOptions *options)
options->pre_userauth_hook = NULL;
options->pam_service_name = NULL;
options->pam_service_prefix = NULL;
+ options->pubkey_plugin = NULL;
}
#ifdef HAVE_DEFOPEN
@@ -419,13 +420,14 @@ typedef enum {
sPermitUserEnvironment, sUseLogin, sAllowTcpForwarding, sCompression,
sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
sIgnoreUserKnownHosts, sCiphers, sMacs, sProtocol, sPidFile,
- sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem, sMaxStartups,
+ sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem,
sBanner, sVerifyReverseMapping, sHostbasedAuthentication,
sHostbasedUsesNameFromPacketOnly, sClientAliveInterval,
sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2,
sMaxAuthTries, sMaxAuthTriesLog, sUsePrivilegeSeparation,
sLookupClientHostnames, sUseOpenSSLEngine, sChrootDirectory,
sPreUserauthHook, sMatch, sPAMServicePrefix, sPAMServiceName,
+ sMaxStartups, sPubKeyPlugin,
sDeprecated
} ServerOpCodes;
@@ -532,6 +534,7 @@ static struct {
{ "match", sMatch, SSHCFG_ALL },
{ "pamserviceprefix", sPAMServicePrefix, SSHCFG_GLOBAL },
{ "pamservicename", sPAMServiceName, SSHCFG_GLOBAL },
+ { "pubkeyplugin", sPubKeyPlugin, SSHCFG_ALL },
{ NULL, sBadOption, 0 }
};
@@ -1356,6 +1359,10 @@ parse_flag:
options->pam_service_name = xstrdup(arg);
break;
+ case sPubKeyPlugin:
+ charptr = &options->pubkey_plugin;
+ goto parse_filename;
+
default:
fatal("%s line %d: Missing handler for opcode %s (%d)",
filename, linenum, arg, opcode);
diff --git a/usr/src/cmd/ssh/sshd/sshlogin.c b/usr/src/cmd/ssh/sshd/sshlogin.c
index c21877355c..c2bd3bacb7 100644
--- a/usr/src/cmd/ssh/sshd/sshlogin.c
+++ b/usr/src/cmd/ssh/sshd/sshlogin.c
@@ -101,8 +101,7 @@ record_login(pid_t pid, const char *ttyname, const char *progname,
fatal_cleanup();
}
}
- remote_name_or_ip = get_remote_name_or_ip(utmp_len,
- options.verify_reverse_mapping);
+ remote_name_or_ip = get_remote_ipaddr();
initialized = 1;
}
diff --git a/usr/src/cmd/stat/Makefile b/usr/src/cmd/stat/Makefile
index d5356ae42d..faffc6a437 100644
--- a/usr/src/cmd/stat/Makefile
+++ b/usr/src/cmd/stat/Makefile
@@ -19,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2011, 2012, Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
# cmd/stat/Makefile
@@ -27,7 +27,14 @@
include ../Makefile.cmd
-SUBDIRS= iostat mpstat vmstat fsstat kstat
+SUBDIRS= arcstat \
+ fsstat \
+ iostat \
+ kstat \
+ mpstat \
+ vfsstat \
+ vmstat \
+ ziostat
all := TARGET = all
install := TARGET = install
diff --git a/usr/src/cmd/stat/arcstat/Makefile b/usr/src/cmd/stat/arcstat/Makefile
new file mode 100644
index 0000000000..3dc3630bc0
--- /dev/null
+++ b/usr/src/cmd/stat/arcstat/Makefile
@@ -0,0 +1,41 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
+#
+
+include $(SRC)/cmd/Makefile.cmd
+
+PROG= arcstat
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+install: all .WAIT $(ROOTPROG)
+
+clean:
+
+$(ROOTBINPROG): $(PROG)
+ $(INS.file)
+
+lint:
+
+include $(SRC)/cmd/Makefile.targ
diff --git a/usr/src/cmd/stat/arcstat/arcstat.pl b/usr/src/cmd/stat/arcstat/arcstat.pl
new file mode 100644
index 0000000000..19f85a6c31
--- /dev/null
+++ b/usr/src/cmd/stat/arcstat/arcstat.pl
@@ -0,0 +1,332 @@
+#!/usr/perl5/bin/perl -w
+#
+# Print out ZFS ARC Statistics exported via kstat(1)
+# For a definition of fields, or usage, use arctstat.pl -v
+#
+# This script is a fork of the original arcstat.pl (0.1) by
+# Neelakanth Nadgir, originally published on his Sun blog on
+# 09/18/2007
+# http://blogs.sun.com/realneel/entry/zfs_arc_statistics
+#
+# This version aims to improve upon the original by adding features
+# and fixing bugs as needed. This version is maintained by
+# Mike Harsch and is hosted in a public open source repository:
+# http://github.com/mharsch/arcstat
+#
+# Comments, Questions, or Suggestions are always welcome.
+# Contact the maintainer at ( mike at harschsystems dot com )
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Fields have a fixed width. Every interval, we fill the "v"
+# hash with its corresponding value (v[field]=value) using calculate().
+# @hdr is the array of fields that needs to be printed, so we
+# just iterate over this array and print the values using our pretty printer.
+
+use strict;
+use POSIX qw(strftime);
+use Sun::Solaris::Kstat;
+use Getopt::Long;
+use IO::Handle;
+
+my %cols = (# HDR => [Size, Scale, Description]
+ "time" =>[8, -1, "Time"],
+ "hits" =>[4, 1000, "ARC reads per second"],
+ "miss" =>[4, 1000, "ARC misses per second"],
+ "read" =>[4, 1000, "Total ARC accesses per second"],
+ "hit%" =>[4, 100, "ARC Hit percentage"],
+ "miss%" =>[5, 100, "ARC miss percentage"],
+ "dhit" =>[4, 1000, "Demand Data hits per second"],
+ "dmis" =>[4, 1000, "Demand Data misses per second"],
+ "dh%" =>[3, 100, "Demand Data hit percentage"],
+ "dm%" =>[3, 100, "Demand Data miss percentage"],
+ "phit" =>[4, 1000, "Prefetch hits per second"],
+ "pmis" =>[4, 1000, "Prefetch misses per second"],
+ "ph%" =>[3, 100, "Prefetch hits percentage"],
+ "pm%" =>[3, 100, "Prefetch miss percentage"],
+ "mhit" =>[4, 1000, "Metadata hits per second"],
+ "mmis" =>[4, 1000, "Metadata misses per second"],
+ "mread" =>[4, 1000, "Metadata accesses per second"],
+ "mh%" =>[3, 100, "Metadata hit percentage"],
+ "mm%" =>[3, 100, "Metadata miss percentage"],
+ "arcsz" =>[5, 1024, "ARC Size"],
+ "c" =>[4, 1024, "ARC Target Size"],
+ "mfu" =>[4, 1000, "MFU List hits per second"],
+ "mru" =>[4, 1000, "MRU List hits per second"],
+ "mfug" =>[4, 1000, "MFU Ghost List hits per second"],
+ "mrug" =>[4, 1000, "MRU Ghost List hits per second"],
+ "eskip" =>[5, 1000, "evict_skip per second"],
+ "mtxmis" =>[6, 1000, "mutex_miss per second"],
+ "rmis" =>[4, 1000, "recycle_miss per second"],
+ "dread" =>[5, 1000, "Demand data accesses per second"],
+ "pread" =>[5, 1000, "Prefetch accesses per second"],
+ "l2hits" =>[6, 1000, "L2ARC hits per second"],
+ "l2miss" =>[6, 1000, "L2ARC misses per second"],
+ "l2read" =>[6, 1000, "Total L2ARC accesses per second"],
+ "l2hit%" =>[6, 100, "L2ARC access hit percentage"],
+ "l2miss%" =>[7, 100, "L2ARC access miss percentage"],
+ "l2size" =>[6, 1024, "Size of the L2ARC"],
+ "l2bytes" =>[7, 1024, "bytes read per second from the L2ARC"],
+);
+my %v=();
+my @hdr = qw(time read miss miss% dmis dm% pmis pm% mmis mm% arcsz c);
+my @xhdr = qw(time mfu mru mfug mrug eskip mtxmis rmis dread pread read);
+my $int = 1; # Print stats every 1 second by default
+my $count = 1; # Print stats since boot and exit
+my $hdr_intr = 20; # Print header every 20 lines of output
+my $opfile = "";
+my $sep = " "; # Default seperator is 2 spaces
+my $version = "0.4";
+my $l2exist = 0;
+my $cmd = "Usage: arcstat [-hvx] [-f fields] [-o file] [interval [count]]\n";
+my %cur;
+my %d;
+my $out;
+my $kstat = Sun::Solaris::Kstat->new();
+STDOUT->autoflush;
+
+sub detailed_usage {
+ print STDERR "$cmd\n";
+ print STDERR "Field definitions are as follows:\n";
+ foreach my $hdr (keys %cols) {
+ print STDERR sprintf("%11s : %s\n", $hdr, $cols{$hdr}[2]);
+ }
+ exit(1);
+}
+
+sub usage {
+ print STDERR "$cmd\n";
+ print STDERR "\t -x : Print extended stats\n";
+ print STDERR "\t -v : Show field headers and definitions\n";
+ print STDERR "\t -f : Specify specific fields to print (see -v)\n";
+ print STDERR "\t -o : Print stats to file\n";
+ print STDERR "\t -s : Specify a seperator\n\nExamples:\n";
+ print STDERR "\tarcstat -o /tmp/a.log 2 10\n";
+ print STDERR "\tarcstat -s , -o /tmp/a.log 2 10\n";
+ print STDERR "\tarcstat -v\n";
+ print STDERR "\tarcstat -f time,hit%,dh%,ph%,mh%\n";
+ exit(1);
+}
+
+sub init {
+ my $desired_cols;
+ my $xflag = '';
+ my $hflag = '';
+ my $vflag;
+ my $res = GetOptions('x' => \$xflag,
+ 'o=s' => \$opfile,
+ 'help|h|?' => \$hflag,
+ 'v' => \$vflag,
+ 's=s' => \$sep,
+ 'f=s' => \$desired_cols);
+ if (defined $ARGV[0] && defined $ARGV[1]) {
+ $int = $ARGV[0];
+ $count = $ARGV[1];
+ } elsif (defined $ARGV[0]) {
+ $int = $ARGV[0];
+ $count = 0;
+ }
+ usage() if !$res or $hflag or ($xflag and $desired_cols);
+ detailed_usage() if $vflag;
+ @hdr = @xhdr if $xflag; #reset headers to xhdr
+
+ # check if L2ARC exists
+ snap_stats();
+ if (defined $cur{"l2_size"}) {
+ $l2exist = 1;
+ }
+
+ if ($desired_cols) {
+ @hdr = split(/[ ,]+/, $desired_cols);
+ # Now check if they are valid fields
+ my @invalid = ();
+ my @incompat = ();
+ foreach my $ele (@hdr) {
+ if (not exists($cols{$ele})) {
+ push(@invalid, $ele);
+ } elsif (($l2exist == 0) && ($ele =~ /^l2/)) {
+ printf("No L2ARC here\n", $ele);
+ push(@incompat, $ele);
+ }
+ }
+ if (scalar @invalid > 0) {
+ print STDERR "Invalid column definition! -- "
+ . "@invalid\n\n";
+ usage();
+ }
+
+ if (scalar @incompat > 0) {
+ print STDERR "Incompatible field specified -- "
+ . "@incompat\n\n";
+ usage();
+ }
+ }
+ if ($opfile) {
+ open($out, ">$opfile") ||die "Cannot open $opfile for writing";
+ $out->autoflush;
+ select $out;
+ }
+
+}
+
+# Capture kstat statistics. We maintain 3 hashes, prev, cur, and
+# d (delta). As their names imply they maintain the previous, current,
+# and delta (cur - prev) statistics.
+sub snap_stats {
+ my %prev = %cur;
+ if ($kstat->update()) {
+ printf("<State Changed>\n");
+ }
+ my $hashref_cur = $kstat->{"zfs"}{0}{"arcstats"};
+ %cur = %$hashref_cur;
+ foreach my $key (keys %cur) {
+ next if $key =~ /class/;
+ if (defined $prev{$key}) {
+ $d{$key} = $cur{$key} - $prev{$key};
+ } else {
+ $d{$key} = $cur{$key};
+ }
+ }
+}
+
+# Pretty print num. Arguments are width, scale, and num
+sub prettynum {
+ my @suffix=(' ','K', 'M', 'G', 'T');
+ my $num = $_[2] || 0;
+ my $scale = $_[1];
+ my $sz = $_[0];
+ my $index = 0;
+ my $save = 0;
+
+ if ($scale == -1) { #special case for date field
+ return sprintf("%s", $num);
+ } elsif (($num > 0) && ($num < 1)) { #rounding error. return 0
+ $num = 0;
+ }
+
+ while ($num > $scale and $index < 5) {
+ $save = $num;
+ $num = $num/$scale;
+ $index++;
+ }
+
+ return sprintf("%*d", $sz, $num) if ($index == 0);
+ if (($save / $scale) < 10) {
+ return sprintf("%*.1f%s", $sz - 1, $num,$suffix[$index]);
+ } else {
+ return sprintf("%*d%s", $sz - 1, $num,$suffix[$index]);
+ }
+}
+
+sub print_values {
+ foreach my $col (@hdr) {
+ printf("%s%s", prettynum($cols{$col}[0], $cols{$col}[1],
+ $v{$col}), $sep);
+ }
+ printf("\n");
+}
+
+sub print_header {
+ foreach my $col (@hdr) {
+ printf("%*s%s", $cols{$col}[0], $col, $sep);
+ }
+ printf("\n");
+}
+
+sub calculate {
+ %v=();
+ $v{"time"} = strftime("%H:%M:%S", localtime);
+ $v{"hits"} = $d{"hits"}/$int;
+ $v{"miss"} = $d{"misses"}/$int;
+ $v{"read"} = $v{"hits"} + $v{"miss"};
+ $v{"hit%"} = 100*$v{"hits"}/$v{"read"} if $v{"read"} > 0;
+ $v{"miss%"} = 100 - $v{"hit%"} if $v{"read"} > 0;
+
+ $v{"dhit"} = ($d{"demand_data_hits"} +
+ $d{"demand_metadata_hits"})/$int;
+ $v{"dmis"} = ($d{"demand_data_misses"} +
+ $d{"demand_metadata_misses"})/$int;
+
+ $v{"dread"} = $v{"dhit"} + $v{"dmis"};
+ $v{"dh%"} = 100 * $v{"dhit"}/$v{"dread"} if $v{"dread"} > 0;
+ $v{"dm%"} = 100 - $v{"dh%"} if $v{"dread"} > 0;
+
+ $v{"phit"}=($d{"prefetch_data_hits"} +
+ $d{"prefetch_metadata_hits"})/$int;
+ $v{"pmis"}=($d{"prefetch_data_misses"}
+ +$d{"prefetch_metadata_misses"})/$int;
+
+ $v{"pread"} = $v{"phit"} + $v{"pmis"};
+ $v{"ph%"} = 100 * $v{"phit"}/$v{"pread"} if $v{"pread"} > 0;
+ $v{"pm%"} = 100 - $v{"ph%"} if $v{"pread"} > 0;
+
+ $v{"mhit"}=($d{"prefetch_metadata_hits"} +
+ $d{"demand_metadata_hits"})/$int;
+ $v{"mmis"}=($d{"prefetch_metadata_misses"}
+ +$d{"demand_metadata_misses"})/$int;
+
+ $v{"mread"} = $v{"mhit"} + $v{"mmis"};
+ $v{"mh%"} = 100 * $v{"mhit"}/$v{"mread"} if $v{"mread"} > 0;
+ $v{"mm%"} = 100 - $v{"mh%"} if $v{"mread"} > 0;
+
+ $v{"arcsz"} = $cur{"size"};
+ $v{"c"} = $cur{"c"};
+ $v{"mfu"} = $d{"hits"}/$int;
+ $v{"mru"} = $d{"mru_hits"}/$int;
+ $v{"mrug"} = $d{"mru_ghost_hits"}/$int;
+ $v{"mfug"} = $d{"mru_ghost_hits"}/$int;
+ $v{"eskip"} = $d{"evict_skip"}/$int;
+ $v{"rmiss"} = $d{"recycle_miss"}/$int;
+ $v{"mtxmis"} = $d{"mutex_miss"}/$int;
+
+ if ($l2exist) {
+ $v{"l2hits"} = $d{"l2_hits"}/$int;
+ $v{"l2miss"} = $d{"l2_misses"}/$int;
+ $v{"l2read"} = $v{"l2hits"} + $v{"l2miss"};
+ $v{"l2hit%"} = 100 * $v{"l2hits"}/$v{"l2read"}
+ if $v{"l2read"} > 0;
+
+ $v{"l2miss%"} = 100 - $v{"l2hit%"} if $v{"l2read"} > 0;
+ $v{"l2size"} = $cur{"l2_size"};
+ $v{"l2bytes"} = $d{"l2_read_bytes"}/$int;
+ }
+}
+
+sub main {
+ my $i = 0;
+ my $count_flag = 0;
+
+ init();
+ if ($count > 0) { $count_flag = 1; }
+ while (1) {
+ print_header() if ($i == 0);
+ snap_stats();
+ calculate();
+ print_values();
+ last if ($count_flag == 1 && $count-- <= 1);
+ $i = ($i == $hdr_intr) ? 0 : $i+1;
+ sleep($int);
+ }
+ close($out) if defined $out;
+}
+
+&main;
diff --git a/usr/src/cmd/stat/vfsstat/Makefile b/usr/src/cmd/stat/vfsstat/Makefile
new file mode 100644
index 0000000000..04b5085243
--- /dev/null
+++ b/usr/src/cmd/stat/vfsstat/Makefile
@@ -0,0 +1,41 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
+#
+
+include $(SRC)/cmd/Makefile.cmd
+
+PROG= vfsstat
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+install: all .WAIT $(ROOTPROG)
+
+clean:
+
+$(ROOTBINPROG): $(PROG)
+ $(INS.file)
+
+lint:
+
+include $(SRC)/cmd/Makefile.targ
diff --git a/usr/src/cmd/stat/vfsstat/vfsstat.pl b/usr/src/cmd/stat/vfsstat/vfsstat.pl
new file mode 100644
index 0000000000..d9abc2701c
--- /dev/null
+++ b/usr/src/cmd/stat/vfsstat/vfsstat.pl
@@ -0,0 +1,226 @@
+#!/usr/perl5/bin/perl -w
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011 Joyent, Inc.
+#
+# vfsstat - report VFS statistics per zone
+#
+# USAGE: vfsstat [-hIMrzZ] [interval [count]]
+# -h # help
+# -I # print results per interval (where applicable)
+# -M # print results in MB/s
+# -r # print data in comma-separated format
+# -z # hide zones with no VFS activity
+# -Z # print data for all zones
+#
+# eg, vfsstat # print summary since zone boot
+# vfsstat 1 # print continually every 1 second
+# vfsstat 1 5 # print 5 times, every 1 second
+#
+# NOTES:
+#
+# - The calculations and output fields emulate those from iostat(1M) as closely
+# as possible. When only one zone is actively performing disk I/O, the
+# results from iostat(1M) in the global zone and vfsstat in the local zone
+# should be almost identical. Note that many VFS read operations are handled
+# by the ARC, so vfsstat and iostat(1M) will be similar only when most
+# requests are missing in the ARC.
+#
+# - As with iostat(1M), a result of 100% for VFS read and write utilization does
+# not mean that the syscall layer is fully saturated. Instead, that
+# measurement just shows that at least one operation was pending over the last
+# quanta of time examined. Since the VFS layer can process more than one
+# operation concurrently, this measurement will frequently be 100% but the VFS
+# layer can still accept additional requests.
+#
+# - This script is based on Brendan Gregg's K9Toolkit examples:
+#
+# http://www.brendangregg.com/k9toolkit.html
+#
+
+use Getopt::Std;
+use Sun::Solaris::Kstat;
+my $Kstat = Sun::Solaris::Kstat->new();
+
+# Process command line args
+usage() if defined $ARGV[0] and $ARGV[0] eq "--help";
+getopts('hIMrzZ') or usage();
+usage() if defined $main::opt_h;
+$main::opt_h = 0;
+
+my $USE_MB = defined $main::opt_M ? $main::opt_M : 0;
+my $USE_INTERVAL = defined $main::opt_I ? $main::opt_I : 0;
+my $USE_COMMA = defined $main::opt_r ? $main::opt_r : 0;
+my $HIDE_ZEROES = defined $main::opt_z ? $main::opt_z : 0;
+my $ALL_ZONES = defined $main::opt_Z ? $main::opt_Z : 0;
+
+my ($interval, $count);
+if ( defined($ARGV[0]) ) {
+ $interval = $ARGV[0];
+ $count = defined ($ARGV[1]) ? $ARGV[1] : 2**32;
+ usage() if ($interval == 0);
+} else {
+ $interval = 1;
+ $count = 1;
+}
+
+my $HEADER_FMT = $USE_COMMA ?
+ "r/%s,w/%s,%sr/%s,%sw/%s,ractv,wactv,read_t,writ_t,%%r,%%w," .
+ "d/%s,del_t,zone\n" :
+ " r/%s w/%s %sr/%s %sw/%s ractv wactv read_t writ_t " .
+ "%%r %%w d/%s del_t zone\n";
+my $DATA_FMT = $USE_COMMA ?
+ "%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%d,%d,%.1f,%.1f,%s,%d\n" :
+ "%5.1f %5.1f %5.1f %5.1f %5.1f %5.1f %6.1f %6.1f %3d %3d " .
+ "%5.1f %6.1f %s (%d)\n";
+
+my $BYTES_PREFIX = $USE_MB ? "M" : "k";
+my $BYTES_DIVISOR = $USE_MB ? 1024 * 1024 : 1024;
+my $INTERVAL_SUFFIX = $USE_INTERVAL ? "i" : "s";
+my $NANOSEC = 1000000000;
+
+my @fields = ( 'reads', 'writes', 'nread', 'nwritten', 'rtime', 'wtime',
+ 'rlentime', 'wlentime', 'delay_cnt', 'delay_time', 'snaptime' );
+
+chomp(my $curzone = (`/sbin/zonename`));
+
+my %old = ();
+my $rows_printed = 0;
+
+for (my $ii = 0; $ii < $count; $ii++) {
+ # Read list of visible zones and their zone IDs
+ my @zones = ();
+ my %zoneids = ();
+ my $zoneadm = `zoneadm list -p | cut -d: -f1,2`;
+ @lines = split(/\n/, $zoneadm);
+ foreach $line (@lines) {
+ @tok = split(/:/, $line);
+ $zoneids->{$tok[1]} = $tok[0];
+ push(@zones, $tok[1]);
+ }
+
+ $Kstat->update();
+
+ # Print the column header every 20 rows
+ if ($rows_printed == 0 || $ALL_ZONES) {
+ printf($HEADER_FMT, $INTERVAL_SUFFIX, $INTERVAL_SUFFIX,
+ $BYTES_PREFIX, $INTERVAL_SUFFIX, $BYTES_PREFIX,
+ $INTERVAL_SUFFIX, $INTERVAL_SUFFIX);
+ }
+
+ $rows_printed = $rows_printed >= 20 ? 0 : $rows_printed + 1;
+
+ foreach $zone (@zones) {
+ if ((!$ALL_ZONES) && ($zone ne $curzone)) {
+ next;
+ }
+
+ if (! defined $old->{$zone}) {
+ $old->{$zone} = ();
+ foreach $field (@fields) { $old->{$zone}->{$field} = 0; }
+ }
+
+ #
+ # Kstats have a 30-character limit (KSTAT_STRLEN) on their
+ # names, so if the zone name exceeds that limit, use the first
+ # 30 characters.
+ #
+ my $trimmed_zone = substr($zone, 0, 30);
+ my $zoneid = $zoneids->{$zone};
+
+ print_stats($zone, $zoneid,
+ $Kstat->{'zone_vfs'}{$zoneid}{$trimmed_zone}, $old->{$zone});
+ }
+
+ sleep ($interval);
+}
+
+exit(0);
+
+sub print_stats {
+ my $zone = $_[0];
+ my $zoneid = $_[1];
+ my $data = $_[2];
+ my $old = $_[3];
+
+ my $etime = $data->{'snaptime'} -
+ ($old->{'snaptime'} > 0 ? $old->{'snaptime'} : $data->{'crtime'});
+
+ # Calculate basic statistics
+ my $rate_divisor = $USE_INTERVAL ? 1 : $etime;
+ my $reads = ($data->{'reads'} - $old->{'reads'}) / $rate_divisor;
+ my $writes = ($data->{'writes'} - $old->{'writes'}) / $rate_divisor;
+ my $nread = ($data->{'nread'} - $old->{'nread'}) /
+ $rate_divisor / $BYTES_DIVISOR;
+ my $nwritten = ($data->{'nwritten'} - $old->{'nwritten'}) /
+ $rate_divisor / $BYTES_DIVISOR;
+
+ # Calculate transactions per second
+ my $r_tps = ($data->{'reads'} - $old->{'reads'}) / $etime;
+ my $w_tps = ($data->{'writes'} - $old->{'writes'}) / $etime;
+
+ # Calculate average length of active queue
+ my $r_actv = (($data->{'rlentime'} - $old->{'rlentime'}) / $NANOSEC) /
+ $etime;
+ my $w_actv = (($data->{'wlentime'} - $old->{'wlentime'}) / $NANOSEC) /
+ $etime;
+
+ # Calculate average service time
+ my $read_t = $r_tps > 0 ? $r_actv * (1000 / $r_tps) : 0.0;
+ my $writ_t = $w_tps > 0 ? $w_actv * (1000 / $w_tps) : 0.0;
+
+ # Calculate I/O throttle delay metrics
+ my $delays = $data->{'delay_cnt'} - $old->{'delay_cnt'};
+ my $d_tps = $delays / $etime;
+ my $del_t = $delays > 0 ?
+ ($data->{'delay_time'} - $old->{'delay_time'}) / $delays : 0.0;
+
+ # Calculate the % time the VFS layer is active
+ my $r_b_pct = ((($data->{'rtime'} - $old->{'rtime'}) / $NANOSEC) /
+ $etime) * 100;
+ my $w_b_pct = ((($data->{'wtime'} - $old->{'wtime'}) / $NANOSEC) /
+ $etime) * 100;
+
+ if (! $HIDE_ZEROES || $reads != 0.0 || $writes != 0.0 ||
+ $nread != 0.0 || $nwritten != 0.0) {
+ printf($DATA_FMT, $reads, $writes, $nread, $nwritten, $r_actv,
+ $w_actv, $read_t, $writ_t, $r_b_pct, $w_b_pct,
+ $d_tps, $del_t, substr($zone, 0, 8), $zoneid);
+ }
+
+ # Save current calculations for next loop
+ foreach (@fields) { $old->{$_} = $data->{$_}; }
+}
+
+sub usage {
+ print STDERR <<END;
+USAGE: vfsstat [-hIMrzZ] [interval [count]]
+ eg, vfsstat # print summary since zone boot
+ vfsstat 1 # print continually every 1 second
+ vfsstat 1 5 # print 5 times, every 1 second
+ vfsstat -I # print results per interval (where applicable)
+ vfsstat -M # print results in MB/s
+ vfsstat -r # print results in comma-separated format
+ vfsstat -z # hide zones with no VFS activity
+ vfsstat -Z # print results for all zones
+END
+ exit 1;
+}
diff --git a/usr/src/cmd/stat/ziostat/Makefile b/usr/src/cmd/stat/ziostat/Makefile
new file mode 100644
index 0000000000..c338b59678
--- /dev/null
+++ b/usr/src/cmd/stat/ziostat/Makefile
@@ -0,0 +1,41 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
+#
+
+include $(SRC)/cmd/Makefile.cmd
+
+PROG= ziostat
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+install: all .WAIT $(ROOTPROG)
+
+clean:
+
+$(ROOTBINPROG): $(PROG)
+ $(INS.file)
+
+lint:
+
+include $(SRC)/cmd/Makefile.targ
diff --git a/usr/src/cmd/stat/ziostat/ziostat.pl b/usr/src/cmd/stat/ziostat/ziostat.pl
new file mode 100755
index 0000000000..cf95d2f5a5
--- /dev/null
+++ b/usr/src/cmd/stat/ziostat/ziostat.pl
@@ -0,0 +1,204 @@
+#!/usr/perl5/bin/perl -w
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011 Joyent, Inc.
+#
+# ziostat - report I/O statistics per zone
+#
+# USAGE: ziostat [-hIMrzZ] [interval [count]]
+# -h # help
+# -I # print results per interval (where applicable)
+# -M # print results in MB/s
+# -r # print data in comma-separated format
+# -z # hide zones with no ZFS I/O activity
+# -Z # print data for all zones
+#
+# eg, ziostat # print summary since zone boot
+# ziostat 1 # print continually every 1 second
+# ziostat 1 5 # print 5 times, every 1 second
+#
+# NOTES:
+#
+# - The calculations and output fields emulate those from iostat(1M) as closely
+# as possible. When only one zone is actively performing disk I/O, the
+# results from iostat(1M) in the global zone and ziostat in the local zone
+# should be almost identical.
+#
+# - As with iostat(1M), a result of 100% for disk utilization does not mean that
+# the disk is fully saturated. Instead, that measurement just shows that at
+# least one operation was pending over the last quanta of time examined.
+# Since disk devices can process more than one operation concurrently, this
+# measurement will frequently be 100% but the disk can still offer higher
+# performance.
+#
+# - This script is based on Brendan Gregg's K9Toolkit examples:
+#
+# http://www.brendangregg.com/k9toolkit.html
+#
+
+use Getopt::Std;
+use Sun::Solaris::Kstat;
+my $Kstat = Sun::Solaris::Kstat->new();
+
+# Process command line args
+usage() if defined $ARGV[0] and $ARGV[0] eq "--help";
+getopts('hIMrzZ') or usage();
+usage() if defined $main::opt_h;
+$main::opt_h = 0;
+
+my $USE_MB = defined $main::opt_M ? $main::opt_M : 0;
+my $USE_INTERVAL = defined $main::opt_I ? $main::opt_I : 0;
+my $USE_COMMA = defined $main::opt_r ? $main::opt_r : 0;
+my $HIDE_ZEROES = defined $main::opt_z ? $main::opt_z : 0;
+my $ALL_ZONES = defined $main::opt_Z ? $main::opt_Z : 0;
+
+my ($interval, $count);
+if ( defined($ARGV[0]) ) {
+ $interval = $ARGV[0];
+ $count = defined ($ARGV[1]) ? $ARGV[1] : 2**32;
+ usage() if ($interval == 0);
+} else {
+ $interval = 1;
+ $count = 1;
+}
+
+my $HEADER_FMT = $USE_COMMA ?
+ "r/%s,%sr/%s,actv,wsvc_t,asvc_t,%%b,zone\n" :
+ " r/%s %sr/%s actv wsvc_t asvc_t %%b zone\n";
+my $DATA_FMT = $USE_COMMA ?
+ "%.1f,%.1f,%.1f,%.1f,%.1f,%d,%s,%d\n" :
+ " %6.1f %6.1f %6.1f %6.1f %6.1f %3d %s (%d)\n";
+
+my $BYTES_PREFIX = $USE_MB ? "M" : "k";
+my $BYTES_DIVISOR = $USE_MB ? 1024 * 1024 : 1024;
+my $INTERVAL_SUFFIX = $USE_INTERVAL ? "i" : "s";
+my $NANOSEC = 1000000000;
+
+my @fields = ( 'reads', 'nread', 'waittime', 'rtime', 'rlentime', 'snaptime' );
+
+chomp(my $curzone = (`/sbin/zonename`));
+
+# Read list of visible zones and their zone IDs
+my @zones = ();
+my %zoneids = ();
+my $zoneadm = `zoneadm list -p | cut -d: -f1,2`;
+@lines = split(/\n/, $zoneadm);
+foreach $line (@lines) {
+ @tok = split(/:/, $line);
+ $zoneids->{$tok[1]} = $tok[0];
+ push(@zones, $tok[1]);
+}
+
+my %old = ();
+my $rows_printed = 0;
+
+$Kstat->update();
+
+for (my $ii = 0; $ii < $count; $ii++) {
+ # Print the column header every 20 rows
+ if ($rows_printed == 0 || $ALL_ZONES) {
+ printf($HEADER_FMT, $INTERVAL_SUFFIX, $BYTES_PREFIX,
+ $INTERVAL_SUFFIX, $INTERVAL_SUFFIX);
+ }
+
+ $rows_printed = $rows_printed >= 20 ? 0 : $rows_printed + 1;
+
+ foreach $zone (@zones) {
+ if ((!$ALL_ZONES) && ($zone ne $curzone)) {
+ next;
+ }
+
+ if (! defined $old->{$zone}) {
+ $old->{$zone} = ();
+ foreach $field (@fields) { $old->{$zone}->{$field} = 0; }
+ }
+
+ #
+ # Kstats have a 30-character limit (KSTAT_STRLEN) on their
+ # names, so if the zone name exceeds that limit, use the first
+ # 30 characters.
+ #
+ my $trimmed_zone = substr($zone, 0, 30);
+ my $zoneid = $zoneids->{$zone};
+
+ print_stats($zone, $zoneid,
+ $Kstat->{'zone_zfs'}{$zoneid}{$trimmed_zone}, $old->{$zone});
+ }
+
+ sleep ($interval);
+ $Kstat->update();
+}
+
+sub print_stats {
+ my $zone = $_[0];
+ my $zoneid = $_[1];
+ my $data = $_[2];
+ my $old = $_[3];
+
+ my $etime = $data->{'snaptime'} -
+ ($old->{'snaptime'} > 0 ? $old->{'snaptime'} : $data->{'crtime'});
+
+ # Calculate basic statistics
+ my $rate_divisor = $USE_INTERVAL ? 1 : $etime;
+ my $reads = ($data->{'reads'} - $old->{'reads'}) / $rate_divisor;
+ my $nread = ($data->{'nread'} - $old->{'nread'}) /
+ $rate_divisor / $BYTES_DIVISOR;
+
+ # Calculate overall transactions per second
+ my $ops = $data->{'reads'} - $old->{'reads'};
+ my $tps = $ops / $etime;
+
+ # Calculate average length of disk run queue
+ my $actv = (($data->{'rlentime'} - $old->{'rlentime'}) / $NANOSEC) /
+ $etime;
+
+ # Calculate average disk wait and service times
+ my $wsvc = $ops > 0 ? (($data->{'waittime'} - $old->{'waittime'}) /
+ 1000000) / $ops : 0.0;
+ my $asvc = $tps > 0 ? $actv * (1000 / $tps) : 0.0;
+
+ # Calculate the % time the disk run queue is active
+ my $b_pct = ((($data->{'rtime'} - $old->{'rtime'}) / $NANOSEC) /
+ $etime) * 100;
+
+ if (! $HIDE_ZEROES || $reads != 0.0 || $nread != 0.0 ) {
+ printf($DATA_FMT, $reads, $nread, $actv, $wsvc, $asvc,
+ $b_pct, substr($zone, 0, 8), $zoneid);
+ }
+
+ # Save current calculations for next loop
+ foreach (@fields) { $old->{$_} = $data->{$_}; }
+}
+
+sub usage {
+ print STDERR <<END;
+USAGE: ziostat [-hIMrzZ] [interval [count]]
+ eg, ziostat # print summary since zone boot
+ ziostat 1 # print continually every 1 second
+ ziostat 1 5 # print 5 times, every 1 second
+ ziostat -I # print results per interval (where applicable)
+ ziostat -M # print results in MB/s
+ ziostat -r # print results in comma-separated format
+ ziostat -z # hide zones with no ZFS I/O activity
+ ziostat -Z # print results for all zones
+END
+ exit 1;
+}
diff --git a/usr/src/cmd/svc/configd/Makefile b/usr/src/cmd/svc/configd/Makefile
index 9b8ede22c5..c6f2000e8c 100644
--- a/usr/src/cmd/svc/configd/Makefile
+++ b/usr/src/cmd/svc/configd/Makefile
@@ -75,7 +75,8 @@ $(NATIVE_BUILD)CFLAGS = $(NATIVE_CFLAGS)
$(NATIVE_BUILD)CPPFLAGS = $(MYCPPFLAGS) -I$(LIBUUTIL)/common -I$(LIBSCF)/inc
$(NATIVE_BUILD)CPPFLAGS += -DNATIVE_BUILD
$(NATIVE_BUILD)LDFLAGS =
-$(NATIVE_BUILD)LDLIBS = -L$(LIBUUTIL)/native -R $(LIBUUTIL)/native $(MYLDLIBS)
+$(NATIVE_BUILD)LDLIBS = -L$(ADJUNCT_PROTO)/usr/lib -R$(ADJUNCT_PROTO)/usr/lib \
+ -L$(LIBUUTIL)/native -R $(LIBUUTIL)/native $(MYLDLIBS)
DIRMODE = 0755
FILEMODE = 0555
diff --git a/usr/src/cmd/svc/configd/rc_node.c b/usr/src/cmd/svc/configd/rc_node.c
index 57b7ebcc69..5479fcc7cf 100644
--- a/usr/src/cmd/svc/configd/rc_node.c
+++ b/usr/src/cmd/svc/configd/rc_node.c
@@ -22,6 +22,9 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* rc_node.c - In-memory SCF object management
@@ -6534,7 +6537,15 @@ rc_iter_next(rc_node_iter_t *iter, rc_node_ptr_t *out, uint32_t type)
}
if (pg == NULL) {
+ (void) pthread_mutex_unlock(&np->rn_lock);
rc_node_rele(res);
+ (void) pthread_mutex_lock(&np->rn_lock);
+ if (!rc_node_wait_flag(np, RC_NODE_DYING)) {
+ (void) pthread_mutex_unlock(&np->
+ rn_lock);
+ rc_node_clear(out, 1);
+ return (REP_PROTOCOL_FAIL_DELETED);
+ }
} else {
rc_node_t *cpg;
@@ -6557,9 +6568,21 @@ rc_iter_next(rc_node_iter_t *iter, rc_node_ptr_t *out, uint32_t type)
case REP_PROTOCOL_FAIL_TYPE_MISMATCH:
/* Nevermind. */
+ (void) pthread_mutex_unlock(&np->
+ rn_lock);
rc_node_destroy(cpg);
rc_node_rele(pg);
rc_node_rele(res);
+ (void) pthread_mutex_lock(&np->
+ rn_lock);
+ if (!rc_node_wait_flag(np,
+ RC_NODE_DYING)) {
+ (void) pthread_mutex_unlock(&
+ np->rn_lock);
+ rc_node_clear(out, 1);
+ return
+ (REP_PROTOCOL_FAIL_DELETED);
+ }
break;
case REP_PROTOCOL_FAIL_NO_RESOURCES:
diff --git a/usr/src/cmd/svc/milestone/net-routing-setup b/usr/src/cmd/svc/milestone/net-routing-setup
index 6ab1a6c7f0..b5a9c1a244 100644
--- a/usr/src/cmd/svc/milestone/net-routing-setup
+++ b/usr/src/cmd/svc/milestone/net-routing-setup
@@ -21,11 +21,15 @@
#
#
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
# This script configures IP routing.
. /lib/svc/share/smf_include.sh
+set -o xtrace
+
#
# In a shared-IP zone we need this service to be up, but all of the work
# it tries to do is irrelevant (and will actually lead to the service
@@ -210,5 +214,11 @@ if [ -f /etc/inet/static_routes ]; then
done
fi
+#
+# Log the result
+#
+echo "Routing setup complete:"
+/usr/bin/netstat -rn
+
# Clear exit status.
exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/svc/milestone/network-location.xml b/usr/src/cmd/svc/milestone/network-location.xml
index aad337f42f..709e9df8f3 100644
--- a/usr/src/cmd/svc/milestone/network-location.xml
+++ b/usr/src/cmd/svc/milestone/network-location.xml
@@ -106,7 +106,7 @@
-->
<dependency
name='manifest-import'
- grouping='require_all'
+ grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/manifest-import:default' />
diff --git a/usr/src/cmd/svc/milestone/single-user.xml b/usr/src/cmd/svc/milestone/single-user.xml
index cbb93fd3b3..a9eb0cfa7e 100644
--- a/usr/src/cmd/svc/milestone/single-user.xml
+++ b/usr/src/cmd/svc/milestone/single-user.xml
@@ -95,7 +95,7 @@
<dependency
name='manifests'
- grouping='require_all'
+ grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/manifest-import' />
diff --git a/usr/src/cmd/svc/shell/smf_include.sh b/usr/src/cmd/svc/shell/smf_include.sh
index d0dc387246..02c9532763 100644
--- a/usr/src/cmd/svc/shell/smf_include.sh
+++ b/usr/src/cmd/svc/shell/smf_include.sh
@@ -22,6 +22,7 @@
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2012 Joyent, Inc. All rights reserved.
#
smf_present () {
@@ -234,7 +235,12 @@ smf_kill_contract() {
# SMF_EXIT_ERR_OTHER, although not defined, encompasses all non-zero
# exit status values.
#
+# The SMF_EXIT_NODAEMON exit status should be used when a method does not
+# need to run any persistent process. This indicates success, abandons the
+# contract, and allows dependencies to be met.
+#
SMF_EXIT_OK=0
+SMF_EXIT_NODAEMON=94
SMF_EXIT_ERR_FATAL=95
SMF_EXIT_ERR_CONFIG=96
SMF_EXIT_MON_DEGRADE=97
diff --git a/usr/src/cmd/svc/startd/fork.c b/usr/src/cmd/svc/startd/fork.c
index 4717d491b3..7bce347854 100644
--- a/usr/src/cmd/svc/startd/fork.c
+++ b/usr/src/cmd/svc/startd/fork.c
@@ -25,6 +25,10 @@
*/
/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+/*
* fork.c - safe forking for svc.startd
*
* fork_configd() and fork_sulogin() are related, special cases that handle the
@@ -72,6 +76,7 @@ startd_fork1(int *forkerr)
* prefork stack
*/
wait_prefork();
+ utmpx_prefork();
p = fork1();
@@ -81,6 +86,7 @@ startd_fork1(int *forkerr)
/*
* postfork stack
*/
+ utmpx_postfork();
wait_postfork(p);
return (p);
@@ -169,6 +175,8 @@ fork_common(const char *name, const char *svc_fmri, int retries, ctid_t *ctidp,
/* NOTREACHED */
}
+ utmpx_prefork();
+
/*
* Attempt to fork "retries" times.
*/
@@ -181,6 +189,7 @@ fork_common(const char *name, const char *svc_fmri, int retries, ctid_t *ctidp,
err = errno;
(void) ct_tmpl_clear(ctfd);
(void) close(ctfd);
+ utmpx_postfork();
fork_sulogin(B_TRUE, "Could not fork to start %s: %s\n",
name, strerror(err));
/* NOTREACHED */
@@ -188,6 +197,8 @@ fork_common(const char *name, const char *svc_fmri, int retries, ctid_t *ctidp,
(void) sleep(tries);
}
+ utmpx_postfork();
+
/*
* Clean up, return pid and ctid.
*/
diff --git a/usr/src/cmd/svc/startd/graph.c b/usr/src/cmd/svc/startd/graph.c
index 7fbf17a6ec..c8e0872ff8 100644
--- a/usr/src/cmd/svc/startd/graph.c
+++ b/usr/src/cmd/svc/startd/graph.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2013, Joyent, Inc. All rights reserved.
*/
/*
@@ -141,6 +142,8 @@
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <fm/libfmevent.h>
#include <libscf.h>
#include <libscf_priv.h>
@@ -4875,6 +4878,20 @@ vertex_subgraph_dependencies_shutdown(scf_handle_t *h, graph_vertex_t *v,
was_up = up_state(old_state);
now_up = up_state(v->gv_state);
+ if (halting != -1 && old_state == RESTARTER_STATE_DISABLED &&
+ v->gv_state != RESTARTER_STATE_DISABLED) {
+ /*
+ * We're halting and we have a svc which is transitioning to
+ * offline in parallel. This leads to a race condition where
+ * gt_enter_offline might re-enable the svc after we disabled
+ * it. Since we're halting, we want to ensure no svc ever
+ * transitions out of the disabled state. In this case, modify
+ * the flags to keep us on the halting path.
+ */
+ was_up = 0;
+ now_up = 0;
+ }
+
if (!was_up && now_up) {
++non_subgraph_svcs;
} else if (was_up && !now_up) {
@@ -6827,6 +6844,7 @@ repository_event_thread(void *unused)
char *fmri = startd_alloc(max_scf_fmri_size);
char *pg_name = startd_alloc(max_scf_value_size);
int r;
+ int fd;
h = libscf_handle_create_bound_loop();
@@ -6849,6 +6867,14 @@ retry:
goto retry;
}
+ if ((fd = open("/etc/svc/volatile/startd.ready", O_RDONLY | O_CREAT,
+ S_IRUSR)) < 0) {
+ log_error(LOG_WARNING, "Couldn't create startd.ready file\n",
+ SCF_GROUP_FRAMEWORK, scf_strerror(scf_error()));
+ } else {
+ (void) close(fd);
+ }
+
/*CONSTCOND*/
while (1) {
ssize_t res;
diff --git a/usr/src/cmd/svc/startd/method.c b/usr/src/cmd/svc/startd/method.c
index 6fc05ed49a..dbe02ccec7 100644
--- a/usr/src/cmd/svc/startd/method.c
+++ b/usr/src/cmd/svc/startd/method.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2011 Joyent Inc.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/*
@@ -100,34 +100,18 @@ static uint_t method_events[] = {
* method_record_start(restarter_inst_t *)
* Record a service start for rate limiting. Place the current time
* in the circular array of instance starts.
+ *
+ * Save the critical_failure_period and critical_failure_allowed with either
+ * the defaults or the svc properties startd/critical_failure_count and
+ * startd/critical_failure_period.
+ * ri_crit_fail_allowed is capped at RINST_START_TIMES.
*/
static void
method_record_start(restarter_inst_t *inst)
{
- int index = inst->ri_start_index++ % RINST_START_TIMES;
-
- inst->ri_start_time[index] = gethrtime();
-}
-
-/*
- * method_rate_critical(restarter_inst_t *)
- * Return true if the average start interval is less than the permitted
- * interval. The implicit interval defaults to RINST_FAILURE_RATE_NS and
- * RINST_START_TIMES but may be overridden with the svc properties
- * startd/critical_failure_count and startd/critical_failure_period
- * which represent the number of failures to consider and the amount of
- * time in seconds in which that number may occur, respectively. Note that
- * this time is measured as of the transition to 'enabled' rather than wall
- * clock time.
- * Implicit success if insufficient measurements for an average exist.
- */
-static int
-method_rate_critical(restarter_inst_t *inst)
-{
- hrtime_t critical_failure_period = RINST_FAILURE_RATE_NS;
- uint_t critical_failure_count = RINST_START_TIMES;
- uint_t n = inst->ri_start_index;
- hrtime_t avg_ns = 0;
+ int index;
+ uint_t critical_failure_allowed = RINST_START_TIMES;
+ hrtime_t critical_failure_period;
uint64_t scf_fr, scf_st;
scf_propvec_t *prop = NULL;
scf_propvec_t restart_critical[] = {
@@ -136,6 +120,11 @@ method_rate_critical(restarter_inst_t *inst)
{ NULL }
};
+ if (instance_is_wait_style(inst))
+ critical_failure_period = RINST_WT_SVC_FAILURE_RATE_NS;
+ else
+ critical_failure_period = RINST_FAILURE_RATE_NS;
+
restart_critical[0].pv_ptr = &scf_fr;
restart_critical[1].pv_ptr = &scf_st;
@@ -146,17 +135,48 @@ method_rate_critical(restarter_inst_t *inst)
* in seconds but tracked in ns
*/
critical_failure_period = (hrtime_t)scf_fr * NANOSEC;
- critical_failure_count = (uint_t)scf_st;
+ critical_failure_allowed = (uint_t)scf_st;
+
+ if (critical_failure_allowed > RINST_START_TIMES)
+ critical_failure_allowed = RINST_START_TIMES;
+ if (critical_failure_allowed < 1)
+ critical_failure_allowed = 1;
+
}
- if (inst->ri_start_index < critical_failure_count)
+
+ inst->ri_crit_fail_allowed = critical_failure_allowed;
+ inst->ri_crit_fail_period = critical_failure_period;
+
+ index = inst->ri_start_index++ % critical_failure_allowed;
+ inst->ri_start_time[index] = gethrtime();
+}
+
+/*
+ * method_rate_critical(restarter_inst_t *)
+ * Return true if the number of failures within the interval
+ * ri_crit_fail_period exceeds ri_crit_fail_allowed. The allowed failure
+ * count defaults to RINST_START_TIMES and the implicit interval defaults
+ * to RINST_FAILURE_RATE_NS but may be overridden with the svc properties
+ * startd/critical_failure_count and startd/critical_failure_period which
+ * represent the acceptable number of failures and the amount of time in
+ * seconds in which that number may occur, respectively. Note that this time
+ * is measured as of the transition to 'enabled' rather than wall clock
+ * time. Implicitly not critical if insufficient failures have occured.
+ */
+int
+method_rate_critical(restarter_inst_t *inst)
+{
+ uint_t n = inst->ri_start_index;
+ uint_t fail_allowed = inst->ri_crit_fail_allowed;
+ hrtime_t diff_ns;
+
+ if (n < fail_allowed)
return (0);
- avg_ns =
- (inst->ri_start_time[(n - 1) % critical_failure_count] -
- inst->ri_start_time[n % critical_failure_count]) /
- (critical_failure_count - 1);
+ diff_ns = inst->ri_start_time[(n - 1) % fail_allowed] -
+ inst->ri_start_time[n % fail_allowed];
- return (avg_ns < critical_failure_period);
+ return (diff_ns < inst->ri_crit_fail_period);
}
/*
@@ -832,12 +852,39 @@ method_run(restarter_inst_t **instp, int type, int *exit_code)
"to root-accessible libraries\n", inst->ri_i.i_fmri);
/*
+ * For wait-style svc, sanity check that method exists to prevent an
+ * infinite loop.
+ */
+ if (instance_is_wait_style(inst) && type == METHOD_START) {
+ char *pend;
+ struct stat64 sbuf;
+
+ /*
+ * We need to handle start method strings that have arguments,
+ * such as '/lib/svc/method/console-login %i'.
+ */
+ if ((pend = strchr(method, ' ')) != NULL)
+ *pend = '\0';
+
+ if (stat64(method, &sbuf) == -1 && errno == ENOENT) {
+ log_instance(inst, B_TRUE, "Missing start method (%s), "
+ "changing state to maintenance.", method);
+ restarter_free_method_context(mcp);
+ result = ENOENT;
+ goto out;
+ }
+ if (pend != NULL)
+ *pend = ' ';
+ }
+
+ /*
* If the service is restarting too quickly, send it to
* maintenance.
*/
if (type == METHOD_START) {
method_record_start(inst);
- if (method_rate_critical(inst)) {
+ if (method_rate_critical(inst) &&
+ !instance_is_wait_style(inst)) {
log_instance(inst, B_TRUE, "Restarting too quickly, "
"changing state to maintenance.");
result = ELOOP;
@@ -956,7 +1003,8 @@ method_run(restarter_inst_t **instp, int type, int *exit_code)
goto contract_out;
}
- if (!WIFEXITED(ret_status)) {
+ if (!WIFEXITED(ret_status) &&
+ WEXITSTATUS(ret_status) != SMF_EXIT_NODAEMON) {
/*
* If method didn't exit itself (it was killed by an
* external entity, etc.), consider the entire
@@ -985,7 +1033,7 @@ method_run(restarter_inst_t **instp, int type, int *exit_code)
}
*exit_code = WEXITSTATUS(ret_status);
- if (*exit_code != 0) {
+ if (*exit_code != 0 && *exit_code != SMF_EXIT_NODAEMON) {
log_error(LOG_WARNING,
"%s: Method \"%s\" failed with exit status %d.\n",
inst->ri_i.i_fmri, method, WEXITSTATUS(ret_status));
@@ -994,6 +1042,7 @@ method_run(restarter_inst_t **instp, int type, int *exit_code)
log_instance(inst, B_TRUE, "Method \"%s\" exited with status "
"%d.", mname, *exit_code);
+ /* Note: we will take this path for SMF_EXIT_NODAEMON */
if (*exit_code != 0)
goto contract_out;
@@ -1040,7 +1089,10 @@ assured_kill:
}
contract_out:
- /* Abandon contracts for transient methods & methods that fail. */
+ /*
+ * Abandon contracts for transient methods, methods that exit with
+ * SMF_EXIT_NODAEMON & methods that fail.
+ */
transient = method_is_transient(inst, type);
if ((transient || *exit_code != 0 || result != 0) &&
(restarter_is_kill_method(method) < 0))
@@ -1136,7 +1188,7 @@ retry:
r = method_run(&inst, info->sf_method_type, &exit_code);
- if (r == 0 && exit_code == 0) {
+ if (r == 0 && (exit_code == 0 || exit_code == SMF_EXIT_NODAEMON)) {
/* Success! */
assert(inst->ri_i.i_next_state != RESTARTER_STATE_NONE);
@@ -1154,6 +1206,12 @@ retry:
else
method_remove_contract(inst, B_TRUE, B_TRUE);
}
+
+ /*
+ * For methods that exit with SMF_EXIT_NODAEMON, we already
+ * called method_remove_contract in method_run.
+ */
+
/*
* We don't care whether the handle was rebound because this is
* the last thing we do with it.
diff --git a/usr/src/cmd/svc/startd/restarter.c b/usr/src/cmd/svc/startd/restarter.c
index 203d6eba05..c485f1895f 100644
--- a/usr/src/cmd/svc/startd/restarter.c
+++ b/usr/src/cmd/svc/startd/restarter.c
@@ -140,6 +140,8 @@ static restarter_instance_list_t instance_list;
static uu_list_pool_t *restarter_queue_pool;
+#define WT_SVC_ERR_THROTTLE 1 /* 1 sec delay for erroring wait svc */
+
/*
* Function used to reset the restart times for an instance, when
* an administrative task comes along and essentially makes the times
@@ -1030,6 +1032,7 @@ stop_instance(scf_handle_t *local_handle, restarter_inst_t *inst,
int err;
restarter_error_t re;
restarter_str_t reason;
+ restarter_instance_state_t new_state;
assert(MUTEX_HELD(&inst->ri_lock));
assert(inst->ri_method_thread == 0);
@@ -1040,6 +1043,16 @@ stop_instance(scf_handle_t *local_handle, restarter_inst_t *inst,
reason = restarter_str_ct_ev_exit;
cp = "all processes in service exited";
break;
+ case RSTOP_ERR_CFG:
+ re = RERR_FAULT;
+ reason = restarter_str_method_failed;
+ cp = "service exited with a configuration error";
+ break;
+ case RSTOP_ERR_EXIT:
+ re = RERR_RESTART;
+ reason = restarter_str_ct_ev_exit;
+ cp = "service exited with an error";
+ break;
case RSTOP_CORE:
re = RERR_FAULT;
reason = restarter_str_ct_ev_core;
@@ -1107,7 +1120,10 @@ stop_instance(scf_handle_t *local_handle, restarter_inst_t *inst,
log_framework(re == RERR_FAULT ? LOG_INFO : LOG_DEBUG,
"%s: Instance stopping because %s.\n", inst->ri_i.i_fmri, cp);
- if (instance_is_wait_style(inst) && cause == RSTOP_EXIT) {
+ if (instance_is_wait_style(inst) &&
+ (cause == RSTOP_EXIT ||
+ cause == RSTOP_ERR_CFG ||
+ cause == RSTOP_ERR_EXIT)) {
/*
* No need to stop instance, as child has exited; remove
* contract and move the instance to the offline state.
@@ -1123,8 +1139,26 @@ stop_instance(scf_handle_t *local_handle, restarter_inst_t *inst,
bad_error("restarter_instance_update_states", err);
}
- (void) update_fault_count(inst, FAULT_COUNT_RESET);
- reset_start_times(inst);
+ if (cause == RSTOP_ERR_EXIT) {
+ /*
+ * The RSTOP_ERR_EXIT cause is set via the
+ * wait_thread -> wait_remove code path when we have
+ * a "wait" style svc that exited with an error. If
+ * the svc is failing too quickly, we throttle it so
+ * that we don't restart it more than once/second.
+ * Since we know we're running in the wait thread its
+ * ok to throttle it right here.
+ */
+ (void) update_fault_count(inst, FAULT_COUNT_INCR);
+ if (method_rate_critical(inst)) {
+ log_instance(inst, B_TRUE, "Failing too "
+ "quickly, throttling.");
+ sleep(WT_SVC_ERR_THROTTLE);
+ }
+ } else {
+ (void) update_fault_count(inst, FAULT_COUNT_RESET);
+ reset_start_times(inst);
+ }
if (inst->ri_i.i_primary_ctid != 0) {
inst->ri_m_inst =
@@ -1149,7 +1183,8 @@ stop_instance(scf_handle_t *local_handle, restarter_inst_t *inst,
bad_error("restarter_instance_update_states", err);
}
- return (0);
+ if (cause != RSTOP_ERR_CFG)
+ return (0);
} else if (instance_is_wait_style(inst) && re == RERR_RESTART) {
/*
* Stopping a wait service through means other than the pid
@@ -1161,9 +1196,23 @@ stop_instance(scf_handle_t *local_handle, restarter_inst_t *inst,
wait_ignore_by_fmri(inst->ri_i.i_fmri);
}
+ /*
+ * There are some configuration errors which we cannot detect until we
+ * try to run the method. For example, see exec_method() where the
+ * restarter_set_method_context() call can return SMF_EXIT_ERR_CONFIG
+ * in several cases. If this happens for a "wait-style" svc,
+ * wait_remove() sets the cause as RSTOP_ERR_CFG so that we can detect
+ * the configuration error and go into maintenance, even though it is
+ * a "wait-style" svc.
+ */
+ if (cause == RSTOP_ERR_CFG)
+ new_state = RESTARTER_STATE_MAINT;
+ else
+ new_state = inst->ri_i.i_enabled ?
+ RESTARTER_STATE_OFFLINE : RESTARTER_STATE_DISABLED;
+
switch (err = restarter_instance_update_states(local_handle, inst,
- inst->ri_i.i_state, inst->ri_i.i_enabled ? RESTARTER_STATE_OFFLINE :
- RESTARTER_STATE_DISABLED, RERR_NONE, reason)) {
+ inst->ri_i.i_state, new_state, RERR_NONE, reason)) {
case 0:
case ECONNRESET:
break;
diff --git a/usr/src/cmd/svc/startd/startd.c b/usr/src/cmd/svc/startd/startd.c
index 14180c5f54..ffb67afc60 100644
--- a/usr/src/cmd/svc/startd/startd.c
+++ b/usr/src/cmd/svc/startd/startd.c
@@ -42,6 +42,136 @@
* engine commands by executing methods, updating the repository, and sending
* feedback (mostly state updates) to the graph engine.
*
+ * Overview of the SMF Architecture
+ *
+ * There are a few different components that make up SMF and are responsible
+ * for different pieces of functionality that are used:
+ *
+ * svc.startd(1M): A daemon that is in charge of starting, stopping, and
+ * restarting services and instances
+ * svc.configd: A daemon that manages the repository that stores information,
+ * property groups, and state of the different services and instances
+ * libscf(3LIB): A C library that provides the glue for communicating,
+ * accessing, and updating information about services and instances
+ * svccfg(1M): A utility to add and remove services as well as change the
+ * properties associated with different services and instances.
+ * svcadm(1M): A utility to control the different instance of a service. You
+ * can use this to enable and disable them among some other useful things.
+ * svcs(1): A utility that reports on the status of various services on the
+ * system
+ *
+ * The following block diagram explains how these components communicate:
+ *
+ * The SMF Block Diagram
+ * Repository
+ * This attempts to show ___________ __________
+ * the relations between | | SQL | |
+ * the different pieces | configd |<----------->| SQLite |
+ * that make SMF work and | | Transaction | |
+ * users/administrators ----------- ----------
+ * call into. /|\ /|\
+ * | |
+ * door_call(3C)| | door_call(3C)
+ * | |
+ * \|/ \|/
+ * ____________ __________ __________ ____________
+ * | | | | | | | svccfg |
+ * | startd |<--->| libscf | | libscf |<---->| svcadm |
+ * | | | (3LIB) | | (3LIB) | | svcs |
+ * ------------ ---------- ---------- ------------
+ * /|\ /|\
+ * | | fork(2)/exec(2)
+ * | | libcontract(3LIB)
+ * \|/ \|/ Various System/User services
+ * ---------------------------------------------------------------------
+ * | system/filesystem/local:default system/coreadm:default |
+ * | network/lookpback:default system/zones:default |
+ * | network/ntp:default system/cron:default |
+ * | smartdc/agent/ca/cainstsvc:default network/ssh:default |
+ * | appliance/kit/akd:default system/svc/restarter:default |
+ * ---------------------------------------------------------------------
+ *
+ * Chatting with configd and sharing repository information
+ *
+ * As you run commands with svcs, svccfg, and svcadm, they are all creating a
+ * libscf handle to communicate with configd. As calls are made via libscf they
+ * ultimately go and talk to configd to get information. However, how we
+ * actually are talking to configd is not as straightforward as it appears.
+ *
+ * When configd starts up it creates a door located at
+ * /etc/svc/volatile/repository_door. This door runs the routine called
+ * main_switcher() from usr/src/cmd/svc/configd/maindoor.c. When you first
+ * invoke svc(cfg|s|adm), one of the first things that occurs is creating a
+ * scf_handle_t and binding it to configd by calling scf_handle_bind(). This
+ * function makes a door call to configd and gets returned a new file
+ * descriptor. This file descriptor is itself another door which calls into
+ * configd's client_switcher(). This is the door that is actually used when
+ * getting and fetching properties, and many other useful things.
+ *
+ * svc.startd needs a way to notice the changes that occur to the repository.
+ * For example, if you enabled a service that was not previously running, it's
+ * up to startd to notice that this has happened, check dependencies, and
+ * eventually start up the service. The way it gets these notifications is via
+ * a thread who's sole purpose in life is to call _scf_notify_wait(). This
+ * function acts like poll(2) but for changes that occur in the repository.
+ * Once this thread gets the event, it dispatches the event appropriately.
+ *
+ * The Events of svc.startd
+ *
+ * svc.startd has to handle a lot of complexity. Understanding how you go from
+ * getting the notification that a service was enabled to actually enabling it
+ * is not obvious from a cursory glance. The first thing to keep in mind is
+ * that startd maintains a graph of all the related services and instances so
+ * it can keep track of what is enabled, what dependencies exist, etc. all so
+ * that it can answer the question of what is affected by a change. Internally
+ * there are a lot of different queues for events, threads to process these
+ * queues, and different paths to have events enter these queues. What follows
+ * is a diagram that attempts to explain some of those paths, though it's
+ * important to note that for some of these pieces, such as the graph and
+ * vertex events, there are many additional ways and code paths these threads
+ * and functions can take. And yes, restarter_event_enqueue() is not the same
+ * thing as restarter_queue_event().
+ *
+ * Threads/Functions Queues Threads/Functions
+ *
+ * called by various
+ * ------------------ --------- ---------------
+ * --->| graph_protocol | graph_event | graph | graph_event_ | graph_event |
+ * --->| _send_event() |------------>| event |----------------->| _thread |
+ * ------------------ _enqueue() | queue | dequeue() ---------------
+ * --------- |
+ * _scf_notify_wait() vertex_send_event()|
+ * | \|/
+ * | -------------------- ----------------------
+ * |->| repository_event | vertex_send_event() | restarter_protocol |
+ * | _thread |----------------------------->| _send_event() |
+ * -------------------- ----------------------
+ * | | out to other
+ * restarter_ restarter_ | | restarters
+ * event_dequeue() ------------- event_ | | not startd
+ * |----------------| restarter |<------------| |------------->
+ * \|/ | event | enqueue()
+ * ------------------- | queue | |------------------>
+ * | restarter_event | ------------- ||----------------->
+ * | _thread | |||---------------->
+ * ------------------- ||| start/stop inst
+ * | ---------------- ----------------------
+ * | | instance | | restarter_process_ |
+ * |-------------->| event |------>| events |
+ * restarter_ | queue | | per-instance lwp |
+ * queue_event() ---------------- ----------------------
+ * ||| various funcs
+ * ||| controlling
+ * ||| instance state
+ * |||--------------->
+ * ||---------------->
+ * |----------------->
+ *
+ * What's important to take away is that there is a queue for each instance on
+ * the system that handles events related to dealing directly with that
+ * instance and that events can be added to it because of changes to properties
+ * that are made to configd and acted upon asynchronously by startd.
+ *
* Error handling
*
* In general, when svc.startd runs out of memory it reattempts a few times,
diff --git a/usr/src/cmd/svc/startd/startd.h b/usr/src/cmd/svc/startd/startd.h
index 35a8e1207b..e4f37a4213 100644
--- a/usr/src/cmd/svc/startd/startd.h
+++ b/usr/src/cmd/svc/startd/startd.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#ifndef _STARTD_H
@@ -378,7 +379,9 @@ typedef enum {
RSTOP_HWERR, /* uncorrectable hardware error */
RSTOP_DEPENDENCY, /* dependency activity caused stop */
RSTOP_DISABLE, /* disabled */
- RSTOP_RESTART /* restart requested */
+ RSTOP_RESTART, /* restart requested */
+ RSTOP_ERR_CFG, /* wait svc exited with a config. error */
+ RSTOP_ERR_EXIT /* wait svc exited with an error */
} stop_cause_t;
/*
@@ -402,8 +405,9 @@ typedef enum {
#define RINST_RETAKE_MASK 0x0f000000
-#define RINST_START_TIMES 5 /* failures to consider */
-#define RINST_FAILURE_RATE_NS 600000000000LL /* 1 failure/10 minutes */
+#define RINST_START_TIMES 10 /* up to 10 fails to consider */
+#define RINST_FAILURE_RATE_NS 600000000000LL /* N failures/10 minutes */
+#define RINST_WT_SVC_FAILURE_RATE_NS NANOSEC /* N failures/second */
/* Number of events in the queue when we start dropping ADMIN events. */
#define RINST_QUEUE_THRESHOLD 100
@@ -423,6 +427,8 @@ typedef struct restarter_inst {
hrtime_t ri_start_time[RINST_START_TIMES];
uint_t ri_start_index; /* times started */
+ uint_t ri_crit_fail_allowed;
+ hrtime_t ri_crit_fail_period;
uu_list_node_t ri_link;
pthread_mutex_t ri_lock;
@@ -716,6 +722,7 @@ void log_instance_fmri(const char *, const char *, boolean_t,
/* method.c */
void *method_thread(void *);
void method_remove_contract(restarter_inst_t *, boolean_t, boolean_t);
+int method_rate_critical(restarter_inst_t *);
/* misc.c */
void startd_close(int);
@@ -768,6 +775,8 @@ void utmpx_mark_dead(pid_t, int, boolean_t);
char utmpx_get_runlevel(void);
void utmpx_set_runlevel(char, char, boolean_t);
void utmpx_write_boottime(void);
+void utmpx_prefork(void);
+void utmpx_postfork(void);
/* wait.c */
void wait_init(void);
diff --git a/usr/src/cmd/svc/startd/utmpx.c b/usr/src/cmd/svc/startd/utmpx.c
index 83b9380271..1b3ca95010 100644
--- a/usr/src/cmd/svc/startd/utmpx.c
+++ b/usr/src/cmd/svc/startd/utmpx.c
@@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* utmpx.c - utmpx utility routines
@@ -418,3 +420,20 @@ utmpx_init()
{
(void) pthread_mutex_init(&utmpx_lock, &mutex_attrs);
}
+
+void
+utmpx_prefork()
+{
+ /*
+ * The libc utmpx routines are entirely MT-unsafe; we must assure
+ * that no other thread is in these routines when we fork lest we
+ * leave the child with inconsistent library state.
+ */
+ MUTEX_LOCK(&utmpx_lock);
+}
+
+void
+utmpx_postfork()
+{
+ MUTEX_UNLOCK(&utmpx_lock);
+}
diff --git a/usr/src/cmd/svc/startd/wait.c b/usr/src/cmd/svc/startd/wait.c
index 823f9241a0..ebd83be10e 100644
--- a/usr/src/cmd/svc/startd/wait.c
+++ b/usr/src/cmd/svc/startd/wait.c
@@ -21,10 +21,9 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012, Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* wait.c - asynchronous monitoring of "wait registered" start methods
*
@@ -90,6 +89,7 @@ static void
wait_remove(wait_info_t *wi, int direct)
{
int status;
+ stop_cause_t cause = RSTOP_EXIT;
if (waitpid(wi->wi_pid, &status, 0) == -1) {
if (wi->wi_parent)
@@ -101,6 +101,10 @@ wait_remove(wait_info_t *wi, int direct)
log_framework(LOG_NOTICE,
"instance %s exited with status %d\n", wi->wi_fmri,
WEXITSTATUS(status));
+ if (WEXITSTATUS(status) == SMF_EXIT_ERR_CONFIG)
+ cause = RSTOP_ERR_CFG;
+ else
+ cause = RSTOP_ERR_EXIT;
}
}
@@ -137,7 +141,7 @@ wait_remove(wait_info_t *wi, int direct)
log_framework(LOG_DEBUG,
"wait_remove requesting stop of %s\n", wi->wi_fmri);
- (void) stop_instance_fmri(wait_hndl, wi->wi_fmri, RSTOP_EXIT);
+ (void) stop_instance_fmri(wait_hndl, wi->wi_fmri, cause);
}
uu_list_node_fini(wi, &wi->wi_link, wait_info_pool);
diff --git a/usr/src/cmd/svc/svcadm/Makefile b/usr/src/cmd/svc/svcadm/Makefile
index cc0cc160bf..1a6a0dd35c 100644
--- a/usr/src/cmd/svc/svcadm/Makefile
+++ b/usr/src/cmd/svc/svcadm/Makefile
@@ -21,6 +21,7 @@
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2012, Joyent, Inc. All rights reserved.
#
PROG = svcadm
@@ -49,7 +50,11 @@ $(PROG): $(OBJS)
$(POFILE): $(POFILES)
cat $(POFILES) > $(POFILE)
-install: all $(ROOTUSRSBINPROG)
+install: all $(ROOTSBINPROG) $(ROOTUSRSBINPROG)
+
+$(ROOTUSRSBINPROG):
+ -$(RM) $@
+ -$(SYMLINK) ../../sbin/$(PROG) $@
clean:
$(RM) $(OBJS)
diff --git a/usr/src/cmd/svc/svccfg/Makefile b/usr/src/cmd/svc/svccfg/Makefile
index 723469fdc5..d5a6e434d6 100644
--- a/usr/src/cmd/svc/svccfg/Makefile
+++ b/usr/src/cmd/svc/svccfg/Makefile
@@ -69,7 +69,7 @@ $(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o)
MAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB)
MAPOPTS = $(MAPFILES:%=-M%)
-MYCPPFLAGS = -I ../common -I/usr/include/libxml2
+MYCPPFLAGS = -I ../common -I$(ADJUNCT_PROTO)/usr/include/libxml2
CPPFLAGS += $(MYCPPFLAGS)
LDFLAGS += $(MAPOPTS)
@@ -113,6 +113,7 @@ $(NATIVE_BUILD)LDFLAGS =
$(NATIVE_BUILD)LDLIBS = \
-L$(LIBUUTIL)/native -R $(LIBUUTIL)/native \
-L$(LIBSCF)/native -R $(LIBSCF)/native \
+ -L$(ADJUNCT_PROTO)/usr/lib -R$(ADJUNCT_PROTO)/usr/lib \
$(SVCCFG_EXTRA_LIBS)
svccfg_lex.o svccfg_grammar.o := CCVERBOSE =
diff --git a/usr/src/cmd/svc/svccfg/svccfg_libscf.c b/usr/src/cmd/svc/svccfg/svccfg_libscf.c
index b43dedbd81..077a77f114 100644
--- a/usr/src/cmd/svc/svccfg/svccfg_libscf.c
+++ b/usr/src/cmd/svc/svccfg/svccfg_libscf.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
*/
@@ -44,6 +45,7 @@
#include <stdarg.h>
#include <string.h>
#include <strings.h>
+#include <time.h>
#include <unistd.h>
#include <wait.h>
#include <poll.h>
@@ -241,6 +243,9 @@ static const char *emsg_dpt_no_dep;
static int li_only = 0;
static int no_refresh = 0;
+/* how long in ns we should wait between checks for a pg */
+static uint64_t pg_timeout = 100 * (NANOSEC / MILLISEC);
+
/* import globals, to minimize allocations */
static scf_scope_t *imp_scope = NULL;
static scf_service_t *imp_svc = NULL, *imp_tsvc = NULL;
@@ -6751,6 +6756,205 @@ connaborted:
}
/*
+ * When an instance is imported we end up telling configd about it. Once we tell
+ * configd about these changes, startd eventually notices. If this is a new
+ * instance, the manifest may not specify the SCF_PG_RESTARTER (restarter)
+ * property group. However, many of the other tools expect that this property
+ * group exists and has certain values.
+ *
+ * These values are added asynchronously by startd. We should not return from
+ * this routine until we can verify that the property group we need is there.
+ *
+ * Before we go ahead and verify this, we have to ask ourselves an
+ * important question: Is the early manifest service currently running?
+ * Because if is running and invoked us, then the service will never get
+ * a restarter property because svc.startd is blocked on EMI finishing
+ * before it lets itself fully connect to svc.configd. Of course, this
+ * means that this race condition is in fact impossible to 100%
+ * eliminate.
+ *
+ * svc.startd makes sure that EMI only runs once and has succeeded by
+ * checking the state of the EMI instance. If it is online it bails out
+ * and makes sure that it doesn't run again. In this case, we're going
+ * to do something similar, only if the state is online, then we're
+ * going to actually verify. EMI always has to be present, but it
+ * can be explicitly disabled to reduce the amount of damage it can cause. If
+ * EMI has been disabled then we no longer have to worry about the implicit race
+ * condition and can go ahead and check things. If EMI is in some tate that
+ * isn't online or disabled and isn't runinng, then we assume that things are
+ * rather bad and we're not going to get in your way, even if the rest of SMF
+ * does.
+ *
+ * Returns 0 on success or returns an errno.
+ */
+#ifndef NATIVE_BUILD
+static int
+lscf_instance_verify(scf_scope_t *scope, entity_t *svc, entity_t *inst)
+{
+ int ret, err;
+ struct timespec ts;
+ char *emi_state;
+
+ /*
+ * smf_get_state does not distinguish between its different failure
+ * modes: memory allocation failures and SMF internal failures.
+ */
+ if ((emi_state = smf_get_state(SCF_INSTANCE_EMI)) == NULL)
+ return (EAGAIN);
+
+ /*
+ * As per the block comment for this function check the state of EMI
+ */
+ if (strcmp(emi_state, SCF_STATE_STRING_ONLINE) != 0 &&
+ strcmp(emi_state, SCF_STATE_STRING_DISABLED) != 0) {
+ warn(gettext("Not validating instance %s:%s because EMI's "
+ "state is %s\n"), svc->sc_name, inst->sc_name, emi_state);
+ free(emi_state);
+ return (0);
+ }
+
+ free(emi_state);
+
+ /*
+ * First we have to get the property.
+ */
+ if ((ret = scf_scope_get_service(scope, svc->sc_name, imp_svc)) != 0) {
+ ret = scf_error();
+ warn(gettext("Failed to look up service: %s\n"), svc->sc_name);
+ return (ret);
+ }
+
+ /*
+ * We should always be able to get the instance. It should already
+ * exist because we just created it or got it. There probably is a
+ * slim chance that someone may have come in and deleted it though from
+ * under us.
+ */
+ if ((ret = scf_service_get_instance(imp_svc, inst->sc_name, imp_inst))
+ != 0) {
+ ret = scf_error();
+ warn(gettext("Failed to verify instance: %s\n"), inst->sc_name);
+ switch (ret) {
+ case SCF_ERROR_DELETED:
+ err = ENODEV;
+ break;
+ case SCF_ERROR_CONNECTION_BROKEN:
+ warn(gettext("Lost repository connection\n"));
+ err = ECONNABORTED;
+ break;
+ case SCF_ERROR_NOT_FOUND:
+ warn(gettext("Instance \"%s\" disappeared out from "
+ "under us.\n"), inst->sc_name);
+ err = ENOENT;
+ break;
+ default:
+ bad_error("scf_service_get_instance", ret);
+ }
+
+ return (err);
+ }
+
+ /*
+ * An astute observer may want to use _scf_wait_pg which would notify us
+ * of a property group change, unfortunately that does not work if the
+ * property group in question does not exist. So instead we have to
+ * manually poll and ask smf the best way to get to it.
+ */
+ while ((ret = scf_instance_get_pg(imp_inst, SCF_PG_RESTARTER, imp_pg))
+ != SCF_SUCCESS) {
+ ret = scf_error();
+ if (ret != SCF_ERROR_NOT_FOUND) {
+ warn(gettext("Failed to get restarter property "
+ "group for instance: %s\n"), inst->sc_name);
+ switch (ret) {
+ case SCF_ERROR_DELETED:
+ err = ENODEV;
+ break;
+ case SCF_ERROR_CONNECTION_BROKEN:
+ warn(gettext("Lost repository connection\n"));
+ err = ECONNABORTED;
+ break;
+ default:
+ bad_error("scf_service_get_instance", ret);
+ }
+
+ return (err);
+ }
+
+ ts.tv_sec = pg_timeout / NANOSEC;
+ ts.tv_nsec = pg_timeout % NANOSEC;
+
+ (void) nanosleep(&ts, NULL);
+ }
+
+ /*
+ * svcadm also expects that the SCF_PROPERTY_STATE property is present.
+ * So in addition to the property group being present, we need to wait
+ * for the property to be there in some form.
+ *
+ * Note that a property group is a frozen snapshot in time. To properly
+ * get beyond this, you have to refresh the property group each time.
+ */
+ while ((ret = scf_pg_get_property(imp_pg, SCF_PROPERTY_STATE,
+ imp_prop)) != 0) {
+
+ ret = scf_error();
+ if (ret != SCF_ERROR_NOT_FOUND) {
+ warn(gettext("Failed to get property %s from the "
+ "restarter property group of instance %s\n"),
+ SCF_PROPERTY_STATE, inst->sc_name);
+ switch (ret) {
+ case SCF_ERROR_CONNECTION_BROKEN:
+ warn(gettext("Lost repository connection\n"));
+ err = ECONNABORTED;
+ break;
+ case SCF_ERROR_DELETED:
+ err = ENODEV;
+ break;
+ default:
+ bad_error("scf_pg_get_property", ret);
+ }
+
+ return (err);
+ }
+
+ ts.tv_sec = pg_timeout / NANOSEC;
+ ts.tv_nsec = pg_timeout % NANOSEC;
+
+ (void) nanosleep(&ts, NULL);
+
+ ret = scf_instance_get_pg(imp_inst, SCF_PG_RESTARTER, imp_pg);
+ if (ret != SCF_SUCCESS) {
+ warn(gettext("Failed to get restarter property "
+ "group for instance: %s\n"), inst->sc_name);
+ switch (ret) {
+ case SCF_ERROR_DELETED:
+ err = ENODEV;
+ break;
+ case SCF_ERROR_CONNECTION_BROKEN:
+ warn(gettext("Lost repository connection\n"));
+ err = ECONNABORTED;
+ break;
+ default:
+ bad_error("scf_service_get_instance", ret);
+ }
+
+ return (err);
+ }
+ }
+
+ /*
+ * We don't have to free the property groups or other values that we got
+ * because we stored them in global variables that are allocated and
+ * freed by the routines that call into these functions. Unless of
+ * course the rest of the code here that we are basing this on is
+ * mistaken.
+ */
+ return (0);
+}
+#endif
+
+/*
* If the service is missing, create it, import its properties, and import the
* instances. Since the service is brand new, it should be empty, and if we
* run into any existing entities (SCF_ERROR_EXISTS), abort.
@@ -6834,6 +7038,7 @@ lscf_service_import(void *v, void *pvt)
int fresh = 0;
scf_snaplevel_t *running;
int have_ge = 0;
+ boolean_t retried = B_FALSE;
const char * const ts_deleted = gettext("Temporary service svc:/%s "
"was deleted unexpectedly.\n");
@@ -6889,6 +7094,7 @@ lscf_service_import(void *v, void *pvt)
return (UU_WALK_ERROR);
}
+retry:
if (scf_scope_add_service(imp_scope, imp_tsname, imp_tsvc) != 0) {
switch (scf_error()) {
case SCF_ERROR_CONNECTION_BROKEN:
@@ -6898,6 +7104,11 @@ lscf_service_import(void *v, void *pvt)
return (stash_scferror(lcbdata));
case SCF_ERROR_EXISTS:
+ if (!retried) {
+ lscf_delete(imp_tsname, 0);
+ retried = B_TRUE;
+ goto retry;
+ }
warn(gettext(
"Temporary service \"%s\" must be deleted before "
"this manifest can be imported.\n"), imp_tsname);
@@ -8122,7 +8333,36 @@ lscf_bundle_import(bundle_t *bndl, const char *filename, uint_t flags)
goto progress;
result = 0;
+
+ /*
+ * This snippet of code assumes that we are running svccfg as we
+ * normally do -- witih svc.startd running. Of course, that is
+ * not actually the case all the time because we also use a
+ * varient of svc.configd and svcccfg which are only meant to
+ * run during the build process. During this time we have no
+ * svc.startd, so this check would hang the build process.
+ */
+#ifndef NATIVE_BUILD
+ /*
+ * Verify that the restarter group is preset
+ */
+ for (svc = uu_list_first(bndl->sc_bundle_services);
+ svc != NULL;
+ svc = uu_list_next(bndl->sc_bundle_services, svc)) {
+
+ insts = svc->sc_u.sc_service.sc_service_instances;
+
+ for (inst = uu_list_first(insts);
+ inst != NULL;
+ inst = uu_list_next(insts, inst)) {
+ if (lscf_instance_verify(imp_scope, svc,
+ inst) != 0)
+ goto progress;
+ }
+ }
+#endif
goto out;
+
}
if (uu_error() != UU_ERROR_CALLBACK_FAILED)
@@ -10630,6 +10870,10 @@ int
lscf_service_export(char *fmri, const char *filename, int flags)
{
struct export_args args;
+ char *fmridup;
+ const char *scope, *svc, *inst;
+ size_t cblen = 3 * max_scf_name_len;
+ char *canonbuf = alloca(cblen);
int ret, err;
lscf_prep_hndl();
@@ -10638,6 +10882,29 @@ lscf_service_export(char *fmri, const char *filename, int flags)
args.filename = filename;
args.flags = flags;
+ /*
+ * If some poor user has passed an exact instance FMRI, of the sort
+ * one might cut and paste from svcs(1) or an error message, warn
+ * and chop off the instance instead of failing.
+ */
+ fmridup = alloca(strlen(fmri) + 1);
+ (void) strcpy(fmridup, fmri);
+ if (strncmp(fmridup, SCF_FMRI_SVC_PREFIX,
+ sizeof (SCF_FMRI_SVC_PREFIX) -1) == 0 &&
+ scf_parse_svc_fmri(fmridup, &scope, &svc, &inst, NULL, NULL) == 0 &&
+ inst != NULL) {
+ (void) strlcpy(canonbuf, "svc:/", cblen);
+ if (strcmp(scope, SCF_FMRI_LOCAL_SCOPE) != 0) {
+ (void) strlcat(canonbuf, "/", cblen);
+ (void) strlcat(canonbuf, scope, cblen);
+ }
+ (void) strlcat(canonbuf, svc, cblen);
+ fmri = canonbuf;
+
+ warn(gettext("Only services may be exported; ignoring "
+ "instance portion of argument.\n"));
+ }
+
err = 0;
if ((ret = scf_walk_fmri(g_hndl, 1, (char **)&fmri,
SCF_WALK_SERVICE | SCF_WALK_NOINSTANCE, export_callback,
diff --git a/usr/src/cmd/svc/svcs/svcs.c b/usr/src/cmd/svc/svcs/svcs.c
index 049dec9d30..88c9c2615e 100644
--- a/usr/src/cmd/svc/svcs/svcs.c
+++ b/usr/src/cmd/svc/svcs/svcs.c
@@ -240,7 +240,25 @@ ht_free(void)
static void
ht_init(void)
{
- assert(ht_buckets == NULL);
+ if (ht_buckets != NULL) {
+ /*
+ * If we already have a hash table (e.g., because we are
+ * processing multiple zones), destroy it before creating
+ * a new one.
+ */
+ struct ht_elem *elem, *next;
+ int i;
+
+ for (i = 0; i < ht_buckets_num; i++) {
+ for (elem = ht_buckets[i]; elem != NULL; elem = next) {
+ next = elem->next;
+ free((char *)elem->fmri);
+ free(elem);
+ }
+ }
+
+ free(ht_buckets);
+ }
ht_buckets_num = 8;
ht_buckets = safe_malloc(sizeof (*ht_buckets) * ht_buckets_num);
@@ -1002,13 +1020,14 @@ reverse_bytes(char *buf, size_t len)
/* CTID */
#define CTID_COLUMN_WIDTH 6
+#define CTID_COLUMN_BUFSIZE 20 /* max ctid_t + space + \0 */
static void
sprint_ctid(char **buf, scf_walkinfo_t *wip)
{
int r;
uint64_t c;
- size_t newsize = (*buf ? strlen(*buf) : 0) + CTID_COLUMN_WIDTH + 2;
+ size_t newsize = (*buf ? strlen(*buf) : 0) + CTID_COLUMN_BUFSIZE;
char *newbuf = safe_malloc(newsize);
int restarter_spec;
@@ -3662,6 +3681,24 @@ again:
assert(opt_zone == NULL || zids == NULL);
if (opt_zone == NULL) {
+ zone_status_t status;
+
+ if (zone_getattr(zids[zent], ZONE_ATTR_STATUS,
+ &status, sizeof (status)) < 0 ||
+ status != ZONE_IS_RUNNING) {
+ /*
+ * If this zone is not running or we cannot
+ * get its status, we do not want to attempt
+ * to bind an SCF handle to it, lest we
+ * accidentally interfere with a zone that
+ * is not yet running by looking up a door
+ * to its svc.configd (which could potentially
+ * block a mount with an EBUSY).
+ */
+ zent++;
+ goto nextzone;
+ }
+
if (getzonenamebyid(zids[zent++],
zonename, sizeof (zonename)) < 0) {
uu_warn(gettext("could not get name for "
@@ -3688,14 +3725,12 @@ again:
if (scf_handle_bind(h) == -1) {
if (g_zonename != NULL) {
- uu_warn(gettext("Could not bind to repository "
+ if (show_zones)
+ goto nextzone;
+
+ uu_die(gettext("Could not bind to repository "
"server for zone %s: %s\n"), g_zonename,
scf_strerror(scf_error()));
-
- if (!show_zones)
- return (UU_EXIT_FATAL);
-
- goto nextzone;
}
uu_die(gettext("Could not bind to repository server: %s. "
@@ -3754,7 +3789,7 @@ again:
if (opt_mode == 'L') {
if ((err = scf_walk_fmri(h, argc, argv, SCF_WALK_MULTIPLE,
- print_log, NULL, &exit_status, uu_warn)) != 0) {
+ print_log, NULL, errarg, errfunc)) != 0) {
uu_warn(gettext("failed to iterate over "
"instances: %s\n"), scf_strerror(err));
exit_status = UU_EXIT_FATAL;
diff --git a/usr/src/cmd/tail/extern.h b/usr/src/cmd/tail/extern.h
index 147a887272..c308fa88d8 100644
--- a/usr/src/cmd/tail/extern.h
+++ b/usr/src/cmd/tail/extern.h
@@ -28,6 +28,10 @@
*
*/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <port.h>
+
#define WR(p, size) do { \
if (write(STDOUT_FILENO, p, size) != (ssize_t)size) \
@@ -48,6 +52,7 @@ struct file_info {
FILE *fp;
char *file_name;
struct stat st;
+ file_obj_t fobj;
};
typedef struct file_info file_info_t;
diff --git a/usr/src/cmd/tail/forward.c b/usr/src/cmd/tail/forward.c
index e4f22582f3..d6ca780de1 100644
--- a/usr/src/cmd/tail/forward.c
+++ b/usr/src/cmd/tail/forward.c
@@ -31,9 +31,7 @@
*/
/*
- * Solaris porting notes: the original FreeBSD version made use of the
- * BSD kqueue event notification framework; this
- * was changed to use usleep()
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/param.h>
@@ -53,6 +51,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
#include <unistd.h>
#include "extern.h"
@@ -63,9 +62,11 @@ static void set_events(file_info_t *files);
/* defines for inner loop actions */
#define USE_SLEEP 0
+#define USE_PORT 1
#define ADD_EVENTS 2
-int action = USE_SLEEP;
+int port;
+int action = USE_PORT;
static const file_info_t *last;
@@ -261,6 +262,65 @@ show(file_info_t *file)
}
static void
+associate(file_info_t *file, boolean_t assoc)
+{
+ char buf[64];
+
+ if (action != USE_PORT || file->fp == NULL)
+ return;
+
+ if (!S_ISREG(file->st.st_mode)) {
+ /*
+ * For FIFOs, we use PORT_SOURCE_FD as our port event source.
+ */
+ if (assoc) {
+ (void) port_associate(port, PORT_SOURCE_FD,
+ fileno(file->fp), POLLIN, file);
+ } else {
+ (void) port_dissociate(port, PORT_SOURCE_FD,
+ fileno(file->fp));
+ }
+
+ return;
+ }
+
+ bzero(&file->fobj, sizeof (file->fobj));
+
+ /*
+ * We pull a bit of a stunt here. PORT_SOURCE_FILE only allows us to
+ * specify a file name -- not a file descriptor. If we were to specify
+ * the name of the file to port_associate() and that file were moved
+ * aside, we would not be able to reassociate an event because we would
+ * not know a name that would resolve to the new file (indeed, there
+ * might not be such a name -- the file may have been unlinked). But
+ * there _is_ a name that we know maps to the file and doesn't change:
+ * the name of the representation of the open file descriptor in /proc.
+ * We therefore associate with this name (and the underlying file),
+ * not the name of the file as specified at the command line.
+ */
+ (void) snprintf(buf,
+ sizeof (buf), "/proc/self/fd/%d", fileno(file->fp));
+
+ /*
+ * Note that portfs uses the address of the specified file_obj_t to
+ * tag an association; if one creates a different association with a
+ * (different) file_ob_t that happens to be at the same address,
+ * the first association will be implicitly removed. To assure that
+ * each file has a disjoint file_obj_t, we allocate the memory for it
+ * in the file_info, not on the stack.
+ */
+ file->fobj.fo_name = buf;
+
+ if (assoc) {
+ (void) port_associate(port, PORT_SOURCE_FILE,
+ (uintptr_t)&file->fobj, FILE_MODIFIED | FILE_TRUNC, file);
+ } else {
+ (void) port_dissociate(port, PORT_SOURCE_FILE,
+ (uintptr_t)&file->fobj);
+ }
+}
+
+static void
set_events(file_info_t *files)
{
int i;
@@ -271,6 +331,8 @@ set_events(file_info_t *files)
continue;
(void) fstat(fileno(file->fp), &file->st);
+
+ associate(file, B_TRUE);
}
}
@@ -284,6 +346,8 @@ follow(file_info_t *files, enum STYLE style, off_t off)
int active, ev_change, i, n = -1;
struct stat sb2;
file_info_t *file;
+ struct timespec ts;
+ port_event_t ev;
/* Position each of the files */
@@ -307,6 +371,12 @@ follow(file_info_t *files, enum STYLE style, off_t off)
return;
last = --file;
+
+ if (action == USE_PORT &&
+ (stat("/proc/self/fd", &sb2) == -1 || !S_ISDIR(sb2.st_mode) ||
+ (port = port_create()) == -1))
+ action = USE_SLEEP;
+
set_events(files);
for (;;) {
@@ -341,12 +411,13 @@ follow(file_info_t *files, enum STYLE style, off_t off)
sb2.st_dev != file->st.st_dev ||
sb2.st_nlink == 0) {
(void) show(file);
+ associate(file, B_FALSE);
file->fp = freopen(file->file_name, "r",
file->fp);
- if (file->fp != NULL)
+ if (file->fp != NULL) {
(void) memcpy(&file->st, &sb2,
sizeof (struct stat));
- else if (errno != ENOENT)
+ } else if (errno != ENOENT)
ierr(file->file_name);
ev_change++;
}
@@ -361,6 +432,26 @@ follow(file_info_t *files, enum STYLE style, off_t off)
set_events(files);
switch (action) {
+ case USE_PORT:
+ ts.tv_sec = 1;
+ ts.tv_nsec = 0;
+
+ /*
+ * In the -F case we set a timeout to ensure that
+ * we re-stat the file at least once every second.
+ */
+ n = port_get(port, &ev, Fflag ? &ts : NULL);
+
+ if (n == 0) {
+ file = (file_info_t *)ev.portev_user;
+ associate(file, B_TRUE);
+
+ if (ev.portev_events & FILE_TRUNC)
+ (void) fseek(file->fp, 0, SEEK_SET);
+ }
+
+ break;
+
case USE_SLEEP:
(void) usleep(250000);
break;
diff --git a/usr/src/cmd/tail/tests/tailtests.sh b/usr/src/cmd/tail/tests/tailtests.sh
index 57ec1c46cc..1ce5f5df02 100644
--- a/usr/src/cmd/tail/tests/tailtests.sh
+++ b/usr/src/cmd/tail/tests/tailtests.sh
@@ -13,129 +13,355 @@
#
# Copyright 2010 Chris Love. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
+checktest()
+{
+ local actual=$1
+ local output=$2
+ local test=$3
+
+ if [[ "$actual" != "$output" ]]; then
+ echo "$CMD: test $test: FAIL"
+ echo -e "$CMD: test $test: expected output:\n$o"
+ echo -e "$CMD: test $test: actual output:\n$a"
+ else
+ echo "$CMD: test $test: pass"
+ fi
+}
#
# Test cases for 'tail', some based on CoreUtils test cases (validated
-# with legacy Solaris 'tail' and/or xpg4 'tail')
+# with legacy Solaris 'tail' and/or xpg4 'tail'). Note that this is designed
+# to be able to run on BSD systems as well to check our behavior against
+# theirs (some behavior that is known to be idiosyncratic to illumos is
+# skipped on non-illumos systems).
#
PROG=/usr/bin/tail
+CMD=`basename $0`
+DIR=""
+
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ -x)
+ PROG=/usr/xpg4/bin/tail
+ shift
+ ;;
+ -o)
+ PROG=$2
+ shift 2
+ ;;
+ -d)
+ DIR=$2
+ shift 2
+ ;;
+ *)
+ echo "Usage: tailtests.sh" \
+ "[-x][-o <override tail executable>]" \
+ "[-d <override output directory>]"
+ exit 1
+ ;;
+ esac
+done
-case $1 in
- -x)
- PROG=/usr/xpg4/bin/tail
- ;;
- -o)
- PROG=$2
- ;;
- -?)
- echo "Usage: tailtests.sh [-x][-o <override tail executable>]"
- exit 1
- ;;
-esac
-
-echo "Using $PROG"
+#
+# Shut bash up upon receiving a term so we can drop it on our children
+# without disrupting the output.
+#
+trap "exit 0" TERM
+
+echo "$CMD: program is $PROG"
+
+if [[ $DIR != "" ]]; then
+ echo "$CMD: directory is $DIR"
+fi
o=`echo -e "bcd"`
a=`echo -e "abcd" | $PROG +2c`
-[[ "$a" != "$o" ]] && echo "Fail test 1 - $a"
+checktest "$a" "$o" 1
o=`echo -e ""`
a=`echo "abcd" | $PROG +8c`
-[[ "$a" != "$o" ]] && echo "Fail test 2 - $a"
+checktest "$a" "$o" 2
o=`echo -e "abcd"`
a=`echo "abcd" | $PROG -9c`
-[[ "$a" != "$o" ]] && echo "Fail test 3 - $a"
+checktest "$a" "$o" 3
o=`echo -e "x"`
a=`echo -e "x" | $PROG -1l`
-[[ "$a" != "x" ]] && echo "Fail test 4 - $a"
+checktest "$a" "$o" 4
o=`echo -e "\n"`
a=`echo -e "x\ny\n" | $PROG -1l`
-[[ "$a" != "$o" ]] && echo "Fail test 5 - $a"
+checktest "$a" "$o" 5
o=`echo -e "y\n"`
a=`echo -e "x\ny\n" | $PROG -2l`
-[[ "$a" != "$o" ]] && echo "Fail test 6 - $a"
+checktest "$a" "$o" 6
o=`echo -e "y"`
a=`echo -e "x\ny" | $PROG -1l`
-[[ "$a" != "$o" ]] && echo "Fail test 7 - $a"
+checktest "$a" "$o" 7
o=`echo -e "x\ny\n"`
a=`echo -e "x\ny\n" | $PROG +1l`
-[[ "$a" != "$o" ]] && echo "Fail test 8 - $a"
+checktest "$a" "$o" 8
o=`echo -e "y\n"`
a=`echo -e "x\ny\n" | $PROG +2l`
-[[ "$a" != "$o" ]] && echo "Fail test 9 - $a"
+checktest "$a" "$o" 9
o=`echo -e "x"`
a=`echo -e "x" | $PROG -1`
-[[ "$a" != "$o" ]] && echo "Fail test 10 - $a"
+checktest "$a" "$o" 10
o=`echo -e "\n"`
a=`echo -e "x\ny\n" | $PROG -1`
-[[ "$a" != "$o" ]] && echo "Fail test 11 - $a"
+checktest "$a" "$o" 11
o=`echo -e "y\n"`
a=`echo -e "x\ny\n" | $PROG -2`
-[[ "$a" != "$o" ]] && echo "Fail test 12 - $a"
+checktest "$a" "$o" 12
o=`echo -e "y"`
a=`echo -e "x\ny" | $PROG -1`
-[[ "$a" != "$o" ]] && echo "Fail test 13 - $a"
+checktest "$a" "$o" 13
o=`echo -e "x\ny\n"`
a=`echo -e "x\ny\n" | $PROG +1`
-[[ "$a" != "$o" ]] && echo "Fail test 14 - $a"
+checktest "$a" "$o" 14
o=`echo -e "y\n"`
a=`echo -e "x\ny\n" | $PROG +2`
-[[ "$a" != "$o" ]] && echo "Fail test 15 - $a"
+checktest "$a" "$o" 15
-# For compatibility with Legacy Solaris tail this should also work as '+c'
o=`echo -e "yyz"`
a=`echo -e "xyyyyyyyyyyz" | $PROG +10c`
-[[ "$a" != "$o" ]] && echo "Fail test 16 - $a"
-
-o=`echo -e "yyz"`
-a=`echo -e "xyyyyyyyyyyz" | $PROG +c`
-[[ "$a" != "$o" ]] && echo "Fail test 16a - $a"
-
+checktest "$a" "$o" 16
-# For compatibility with Legacy Solaris tail this should also work as '+l'
o=`echo -e "y\ny\nz"`
a=`echo -e "x\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\nz" | $PROG +10l`
-[[ "$a" != "$o" ]] && echo "Fail test 17 - $a"
-
-o=`echo -e "y\ny\nz"`
-a=`echo -e "x\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\nz" | $PROG +l`
-[[ "$a" != "$o" ]] && echo "Fail test 17a - $a"
-
+checktest "$a" "$o" 17
-# For compatibility with Legacy Solaris tail this should also work as '-l'
o=`echo -e "y\ny\ny\ny\ny\ny\ny\ny\ny\nz"`
a=`echo -e "x\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\nz" | $PROG -10l`
-[[ "$a" != "$o" ]] && echo "Fail test 18 - $a"
+checktest "$a" "$o" 18
-o=`echo -e "y\ny\ny\ny\ny\ny\ny\ny\ny\nz"`
-a=`echo -e "x\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\nz" | $PROG -l`
-[[ "$a" != "$o" ]] && echo "Fail test 18a - $a"
+#
+# For reasons that are presumably as accidental as they are ancient, legacy
+# (and closed) Solaris tail(1) allows +c, +l and -l to be aliases for +10c,
+# +10l and -10l, respectively. If we are on SunOS, verify that this silly
+# behavior is functional.
+#
+if [[ `uname -s` == "SunOS" ]]; then
+ o=`echo -e "yyz"`
+ a=`echo -e "xyyyyyyyyyyz" | $PROG +c`
+ checktest "$a" "$o" 16a
+
+ o=`echo -e "y\ny\nz"`
+ a=`echo -e "x\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\nz" | $PROG +l`
+ checktest "$a" "$o" 17a
+
+ o=`echo -e "y\ny\ny\ny\ny\ny\ny\ny\ny\nz"`
+ a=`echo -e "x\ny\ny\ny\ny\ny\ny\ny\ny\ny\ny\nz" | $PROG -l`
+ checktest "$a" "$o" 18a
+fi
o=`echo -e "c\nb\na"`
a=`echo -e "a\nb\nc" | $PROG -r`
-[[ "$a" != "$o" ]] && echo "Fail test 19 - $a"
+checktest "$a" "$o" 19
+
+#
+# Now we want to do a series of follow tests.
+#
+if [[ $DIR == "" ]]; then
+ tdir=$(mktemp -d -t tailtest.XXXXXXXX || exit 1)
+else
+ tdir=$(mktemp -d $DIR/tailtest.XXXXXXXX || exit 1)
+fi
+
+follow=$tdir/follow
+moved=$tdir/follow.moved
+out=$tdir/out
+
+#
+# First, verify that following works in its most basic sense.
+#
+echo -e "a\nb\nc" > $follow
+$PROG -f $follow > $out 2> /dev/null &
+child=$!
+sleep 2
+echo -e "d\ne\nf" >> $follow
+sleep 1
+kill $child
+sleep 1
+
+o=`echo -e "a\nb\nc\nd\ne\nf\n"`
+a=`cat $out`
+checktest "$a" "$o" 20
+rm $follow
+
+#
+# Now verify that following correctly follows the file being moved.
+#
+echo -e "a\nb\nc" > $follow
+$PROG -f $follow > $out 2> /dev/null &
+child=$!
+sleep 2
+mv $follow $moved
+
+echo -e "d\ne\nf" >> $moved
+sleep 1
+kill $child
+sleep 1
+
+o=`echo -e "a\nb\nc\nd\ne\nf\n"`
+a=`cat $out`
+checktest "$a" "$o" 21
+rm $moved
+
+#
+# And now truncation with the new offset being less than the old offset.
+#
+echo -e "a\nb\nc" > $follow
+$PROG -f $follow > $out 2> /dev/null &
+child=$!
+sleep 2
+echo -e "d\ne\nf" >> $follow
+sleep 1
+echo -e "g\nh\ni" > $follow
+sleep 1
+kill $child
+sleep 1
+
+o=`echo -e "a\nb\nc\nd\ne\nf\ng\nh\ni\n"`
+a=`cat $out`
+checktest "$a" "$o" 22
+rm $follow
+
+#
+# And truncation with the new offset being greater than the old offset.
+#
+echo -e "a\nb\nc" > $follow
+sleep 1
+$PROG -f $follow > $out 2> /dev/null &
+child=$!
+sleep 2
+echo -e "d\ne\nf" >> $follow
+sleep 1
+echo -e "g\nh\ni\nj\nk\nl\nm\no\np\nq" > $follow
+sleep 1
+kill $child
+sleep 1
+
+o=`echo -e "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\no\np\nq"`
+a=`cat $out`
+checktest "$a" "$o" 23
+rm $follow
+#
+# Verify that we can follow the moved file and correctly see a truncation.
+#
+echo -e "a\nb\nc" > $follow
+$PROG -f $follow > $out 2> /dev/null &
+child=$!
+sleep 2
+mv $follow $moved
+
+echo -e "d\ne\nf" >> $moved
+sleep 1
+echo -e "g\nh\ni\nj\nk\nl\nm\no\np\nq" > $moved
+sleep 1
+kill $child
+sleep 1
+
+o=`echo -e "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\no\np\nq"`
+a=`cat $out`
+checktest "$a" "$o" 24
+rm $moved
+
+#
+# Verify that capital-F follow properly deals with truncation
+#
+echo -e "a\nb\nc" > $follow
+$PROG -F $follow > $out 2> /dev/null &
+child=$!
+sleep 2
+echo -e "d\ne\nf" >> $follow
+sleep 1
+echo -e "g\nh\ni" > $follow
+sleep 1
+kill $child
+sleep 1
+
+o=`echo -e "a\nb\nc\nd\ne\nf\ng\nh\ni\n"`
+a=`cat $out`
+checktest "$a" "$o" 25
+rm $follow
-echo "Completed"
+#
+# Verify that capital-F follow _won't_ follow the moved file and will
+# correctly deal with recreation of the original file.
+#
+echo -e "a\nb\nc" > $follow
+$PROG -F $follow > $out 2> /dev/null &
+child=$!
+sleep 2
+mv $follow $moved
+
+echo -e "x\ny\nz" >> $moved
+echo -e "d\ne\nf" > $follow
+sleep 1
+kill $child
+sleep 1
+
+o=`echo -e "a\nb\nc\nd\ne\nf\n"`
+a=`cat $out`
+checktest "$a" "$o" 26
+rm $moved
-exit 0
+#
+# Verify that following two files works.
+#
+echo -e "one" > $follow
+echo -e "two" > $moved
+$PROG -f $follow $moved > $out 2> /dev/null &
+child=$!
+sleep 2
+echo -e "three" >> $follow
+sleep 1
+echo -e "four" >> $moved
+sleep 1
+echo -e "five" >> $follow
+sleep 1
+kill $child
+sleep 1
+
+# There is a bug where the content comes before the header lines,
+# where rlines/mapprint happens before the header. A pain to fix.
+# In this test, just make sure we see both files change.
+o="one
+
+==> $follow <==
+two
+
+==> $moved <==
+
+==> $follow <==
+three
+
+==> $moved <==
+four
+
+==> $follow <==
+five"
+a=`cat $out`
+checktest "$a" "$o" 27
+rm $follow $moved
+
+echo "$CMD: completed"
+
+exit $errs
-# Template for additional test cases
-#o=`echo -e ""`
-#a=`echo -e "" | $PROG `
-#[[ "$a" != "$o" ]] && echo "Fail test - $a"
diff --git a/usr/src/cmd/truss/print.c b/usr/src/cmd/truss/print.c
index 9006902849..fc236bd556 100644
--- a/usr/src/cmd/truss/print.c
+++ b/usr/src/cmd/truss/print.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -868,7 +869,9 @@ prt_mc4(private_t *pri, int raw, long val) /* print memcntl() (4th) argument */
return;
case MC_SYNC:
- if ((val & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) == 0) {
+ if ((val &
+ ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE|MS_INVALCURPROC))
+ == 0) {
*(s = pri->code_buf) = '\0';
if (val & MS_SYNC)
(void) strlcat(s, "|MS_SYNC", CBSIZE);
@@ -877,6 +880,9 @@ prt_mc4(private_t *pri, int raw, long val) /* print memcntl() (4th) argument */
if (val & MS_INVALIDATE)
(void) strlcat(s, "|MS_INVALIDATE",
CBSIZE);
+ if (val & MS_INVALCURPROC)
+ (void) strlcat(s, "|MS_INVALCURPROC",
+ CBSIZE);
}
break;
@@ -2438,7 +2444,10 @@ prt_zga(private_t *pri, int raw, long val)
case ZONE_ATTR_BOOTARGS: s = "ZONE_ATTR_BOOTARGS"; break;
case ZONE_ATTR_BRAND: s = "ZONE_ATTR_BRAND"; break;
case ZONE_ATTR_FLAGS: s = "ZONE_ATTR_FLAGS"; break;
- case ZONE_ATTR_PHYS_MCAP: s = "ZONE_ATTR_PHYS_MCAP"; break;
+ case ZONE_ATTR_DID: s = "ZONE_ATTR_DID"; break;
+ case ZONE_ATTR_PMCAP_NOVER: s = "ZONE_ATTR_PMCAP_NOVER"; break;
+ case ZONE_ATTR_PMCAP_PAGEOUT: s = "ZONE_ATTR_PMCAP_PAGEOUT";
+ break;
}
}
diff --git a/usr/src/cmd/vi/port/Makefile b/usr/src/cmd/vi/port/Makefile
index 268dd752a6..8e223d98e8 100644
--- a/usr/src/cmd/vi/port/Makefile
+++ b/usr/src/cmd/vi/port/Makefile
@@ -75,6 +75,9 @@ $(XPG6) := CFLAGS += -DXPG4 -DXPG6 -I$(SRC)/lib/libc/inc
CPPFLAGS += -DUSG -DSTDIO -DVMUNIX -DTABS=8 -DSINGLE -DTAG_STACK
+# vi intentionally uses foo[-1] as a sentinal value to q*column()
+$(__GNUC4)CERRWARN += -_gcc=-Wno-array-bounds
+
# vi maintains its own versions of various routines from libc and libcurses,
# so localize all symbols to avoid name space collisions.
LDFLAGS += $(MAPFILE.NGB:%=-M%)
diff --git a/usr/src/cmd/vi/port/ex_cmdsub.c b/usr/src/cmd/vi/port/ex_cmdsub.c
index 0260d334fe..00bdcefccb 100644
--- a/usr/src/cmd/vi/port/ex_cmdsub.c
+++ b/usr/src/cmd/vi/port/ex_cmdsub.c
@@ -1735,7 +1735,7 @@ char *prompt;
/* In ex mode, let the system hassle with setting no echo */
if (!inopen)
- return (unsigned char *)getpass(prompt);
+ return (unsigned char *)getpass((const char *)prompt);
viprintf("%s", prompt); flush();
for (p=pbuf; (c = getkey())!='\n' && c!=EOF && c!='\r';) {
if (p < &pbuf[8])
diff --git a/usr/src/cmd/yes/yes.c b/usr/src/cmd/yes/yes.c
index 0ce70a82be..320a760d5e 100644
--- a/usr/src/cmd/yes/yes.c
+++ b/usr/src/cmd/yes/yes.c
@@ -23,8 +23,9 @@
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include <stdio.h>
@@ -32,24 +33,24 @@ int
main(int argc, char **argv)
{
if (argc <= 1) {
- for (;;) {
- (void) putchar('y');
- (void) putchar('\n');
- }
+ while (puts("y") != EOF)
+ continue;
} else {
for (;;) {
int i;
for (i = 1; i < argc; i++) {
if (i > 1)
- (void) putchar(' ');
- (void) fputs(argv[i], stdout);
+ if (putchar(' ') == EOF)
+ goto err;
+ if (fputs(argv[i], stdout) == EOF)
+ goto err;
}
- (void) putchar('\n');
+ if (putchar('\n') == EOF)
+ goto err;
}
}
-#if defined(lint)
- /*NOTREACHED*/
- return (0);
-#endif
+
+err:
+ return (1);
}
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index 5e95aed88b..c7bb789570 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -23,6 +23,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
@@ -219,7 +220,7 @@ get_usage(zfs_help_t idx)
"\tdestroy [-dnpRrv] "
"<filesystem|volume>@<snap>[%<snap>][,...]\n"));
case HELP_GET:
- return (gettext("\tget [-rHp] [-d max] "
+ return (gettext("\tget [-crHp] [-d max] "
"[-o \"all\" | field[,...]] [-t type[,...]] "
"[-s source[,...]]\n"
"\t <\"all\" | property[,...]> "
@@ -231,7 +232,7 @@ get_usage(zfs_help_t idx)
return (gettext("\tupgrade [-v]\n"
"\tupgrade [-r] [-V version] <-a | filesystem ...>\n"));
case HELP_LIST:
- return (gettext("\tlist [-rH][-d max] "
+ return (gettext("\tlist [-rHp][-d max] "
"[-o property[,...]] [-t type[,...]] [-s property] ...\n"
"\t [-S property] ... "
"[filesystem|volume|snapshot] ...\n"));
@@ -563,8 +564,9 @@ finish_progress(char *done)
free(pt_header);
pt_header = NULL;
}
+
/*
- * zfs clone [-p] [-o prop=value] ... <snap> <fs | vol>
+ * zfs clone [-Fp] [-o prop=value] ... <snap> <fs | vol>
*
* Given an existing dataset, create a writable copy whose initial contents
* are the same as the source. The newly created dataset maintains a
@@ -572,12 +574,18 @@ finish_progress(char *done)
* the clone exists.
*
* The '-p' flag creates all the non-existing ancestors of the target first.
+ *
+ * The '-F' flag retries the zfs_mount() operation as long as zfs_mount() is
+ * still returning EBUSY. Any callers which specify -F should be careful to
+ * ensure that no other process has a persistent hold on the mountpoint's
+ * directory.
*/
static int
zfs_do_clone(int argc, char **argv)
{
zfs_handle_t *zhp = NULL;
boolean_t parents = B_FALSE;
+ boolean_t keeptrying = B_FALSE;
nvlist_t *props;
int ret = 0;
int c;
@@ -586,8 +594,11 @@ zfs_do_clone(int argc, char **argv)
nomem();
/* check options */
- while ((c = getopt(argc, argv, "o:p")) != -1) {
+ while ((c = getopt(argc, argv, "Fo:p")) != -1) {
switch (c) {
+ case 'F':
+ keeptrying = B_TRUE;
+ break;
case 'o':
if (parseprop(props))
return (1);
@@ -648,9 +659,14 @@ zfs_do_clone(int argc, char **argv)
clone = zfs_open(g_zfs, argv[1], ZFS_TYPE_DATASET);
if (clone != NULL) {
- if (zfs_get_type(clone) != ZFS_TYPE_VOLUME)
- if ((ret = zfs_mount(clone, NULL, 0)) == 0)
+ if (zfs_get_type(clone) != ZFS_TYPE_VOLUME) {
+ while ((ret = zfs_mount(clone, NULL, 0)) != 0) {
+ if (!keeptrying || errno != EBUSY)
+ break;
+ }
+ if (ret == 0)
ret = zfs_share(clone);
+ }
zfs_close(clone);
}
}
@@ -874,12 +890,13 @@ badusage:
}
/*
- * zfs destroy [-rRf] <fs, vol>
+ * zfs destroy [-rRfF] <fs, vol>
* zfs destroy [-rRd] <snap>
*
* -r Recursively destroy all children
* -R Recursively destroy all dependents, including clones
* -f Force unmounting of any dependents
+ * -F Continue retrying on seeing EBUSY
* -d If we can't destroy now, mark for deferred destruction
*
* Destroys the given dataset. By default, it will unmount any filesystems,
@@ -889,6 +906,7 @@ badusage:
typedef struct destroy_cbdata {
boolean_t cb_first;
boolean_t cb_force;
+ boolean_t cb_wait;
boolean_t cb_recurse;
boolean_t cb_error;
boolean_t cb_doclones;
@@ -971,13 +989,18 @@ out:
static int
destroy_callback(zfs_handle_t *zhp, void *data)
{
- destroy_cbdata_t *cb = data;
+ destroy_cbdata_t *cbp = data;
+ struct timespec ts;
+ int err = 0;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 500 * (NANOSEC / MILLISEC);
const char *name = zfs_get_name(zhp);
- if (cb->cb_verbose) {
- if (cb->cb_parsable) {
+ if (cbp->cb_verbose) {
+ if (cbp->cb_parsable) {
(void) printf("destroy\t%s\n", name);
- } else if (cb->cb_dryrun) {
+ } else if (cbp->cb_dryrun) {
(void) printf(gettext("would destroy %s\n"),
name);
} else {
@@ -992,13 +1015,10 @@ destroy_callback(zfs_handle_t *zhp, void *data)
*/
if (strchr(zfs_get_name(zhp), '/') == NULL &&
zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) {
- zfs_close(zhp);
- return (0);
- }
- if (cb->cb_dryrun) {
- zfs_close(zhp);
- return (0);
+ goto out;
}
+ if (cbp->cb_dryrun)
+ goto out;
/*
* We batch up all contiguous snapshots (even of different
@@ -1007,23 +1027,66 @@ destroy_callback(zfs_handle_t *zhp, void *data)
* because we must delete a clone before its origin.
*/
if (zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) {
- fnvlist_add_boolean(cb->cb_batchedsnaps, name);
- } else {
- int error = zfs_destroy_snaps_nvl(g_zfs,
- cb->cb_batchedsnaps, B_FALSE);
- fnvlist_free(cb->cb_batchedsnaps);
- cb->cb_batchedsnaps = fnvlist_alloc();
-
- if (error != 0 ||
- zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 ||
- zfs_destroy(zhp, cb->cb_defer_destroy) != 0) {
- zfs_close(zhp);
- return (-1);
+ fnvlist_add_boolean(cbp->cb_batchedsnaps, name);
+ goto out;
+ }
+
+ if (cbp->cb_wait)
+ libzfs_print_on_error(g_zfs, B_FALSE);
+
+ /*
+ * Unless instructed to retry on EBUSY, bail out on the first error.
+ * When retrying, try every 500ms until either succeeding or seeing a
+ * non-EBUSY error code.
+ */
+ while ((err = zfs_destroy_snaps_nvl(g_zfs,
+ cbp->cb_batchedsnaps, B_FALSE)) != 0) {
+ if (cbp->cb_wait && libzfs_errno(g_zfs) == EZFS_BUSY) {
+ nanosleep(&ts, NULL);
+ continue;
}
+ (void) fprintf(stderr, "%s: %s\n",
+ libzfs_error_action(g_zfs),
+ libzfs_error_description(g_zfs));
+ break;
}
+ fnvlist_free(cbp->cb_batchedsnaps);
+ cbp->cb_batchedsnaps = fnvlist_alloc();
+
+ if (err != 0)
+ goto out;
+
+ while ((err = zfs_unmount(zhp, NULL,
+ cbp->cb_force ? MS_FORCE : 0)) != 0) {
+ if (cbp->cb_wait && libzfs_errno(g_zfs) == EZFS_BUSY) {
+ (void) nanosleep(&ts, NULL);
+ continue;
+ }
+ (void) fprintf(stderr, "%s: %s\n",
+ libzfs_error_action(g_zfs),
+ libzfs_error_description(g_zfs));
+ break;
+ }
+
+ if (err != 0)
+ goto out;
+
+ while ((err = zfs_destroy(zhp, cbp->cb_defer_destroy)) != 0) {
+ if (cbp->cb_wait && libzfs_errno(g_zfs) == EZFS_BUSY) {
+ (void) nanosleep(&ts, NULL);
+ continue;
+ }
+ (void) fprintf(stderr, "%s: %s\n",
+ libzfs_error_action(g_zfs),
+ libzfs_error_description(g_zfs));
+ break;
+ }
+
+out:
+ libzfs_print_on_error(g_zfs, B_TRUE);
zfs_close(zhp);
- return (0);
+ return (err);
}
static int
@@ -1179,7 +1242,7 @@ zfs_do_destroy(int argc, char **argv)
zfs_type_t type = ZFS_TYPE_DATASET;
/* check options */
- while ((c = getopt(argc, argv, "vpndfrR")) != -1) {
+ while ((c = getopt(argc, argv, "vpndfFrR")) != -1) {
switch (c) {
case 'v':
cb.cb_verbose = B_TRUE;
@@ -1198,6 +1261,9 @@ zfs_do_destroy(int argc, char **argv)
case 'f':
cb.cb_force = B_TRUE;
break;
+ case 'F':
+ cb.cb_wait = B_TRUE;
+ break;
case 'r':
cb.cb_recurse = B_TRUE;
break;
@@ -1527,8 +1593,11 @@ zfs_do_get(int argc, char **argv)
cb.cb_type = ZFS_TYPE_DATASET;
/* check options */
- while ((c = getopt(argc, argv, ":d:o:s:rt:Hp")) != -1) {
+ while ((c = getopt(argc, argv, ":d:o:s:rt:Hcp")) != -1) {
switch (c) {
+ case 'c':
+ libzfs_set_cachedprops(g_zfs, B_TRUE);
+ break;
case 'p':
cb.cb_literal = B_TRUE;
break;
@@ -2781,11 +2850,12 @@ zfs_do_userspace(int argc, char **argv)
}
/*
- * list [-r][-d max] [-H] [-o property[,property]...] [-t type[,type]...]
+ * list [-r][-p][-d max] [-H] [-o property[,property]...] [-t type[,type]...]
* [-s property [-s property]...] [-S property [-S property]...]
* <dataset> ...
*
* -r Recurse over all children
+ * -p Display values in parsable (literal) format.
* -d Limit recursion by depth.
* -H Scripted mode; elide headers and separate columns by tabs
* -o Control which fields to display.
@@ -2800,6 +2870,7 @@ zfs_do_userspace(int argc, char **argv)
typedef struct list_cbdata {
boolean_t cb_first;
boolean_t cb_scripted;
+ boolean_t cb_literal;
zprop_list_t *cb_proplist;
} list_cbdata_t;
@@ -2849,7 +2920,8 @@ print_header(zprop_list_t *pl)
* to the described layout.
*/
static void
-print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
+print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted,
+ boolean_t literal)
{
boolean_t first = B_TRUE;
char property[ZFS_MAXPROPLEN];
@@ -2871,7 +2943,7 @@ print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
if (pl->pl_prop != ZPROP_INVAL) {
if (zfs_prop_get(zhp, pl->pl_prop, property,
- sizeof (property), NULL, NULL, 0, B_FALSE) != 0)
+ sizeof (property), NULL, NULL, 0, literal) != 0)
propstr = "-";
else
propstr = property;
@@ -2879,7 +2951,7 @@ print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
right_justify = zfs_prop_align_right(pl->pl_prop);
} else if (zfs_prop_userquota(pl->pl_user_prop)) {
if (zfs_prop_get_userquota(zhp, pl->pl_user_prop,
- property, sizeof (property), B_FALSE) != 0)
+ property, sizeof (property), literal) != 0)
propstr = "-";
else
propstr = property;
@@ -2933,7 +3005,7 @@ list_callback(zfs_handle_t *zhp, void *data)
cbp->cb_first = B_FALSE;
}
- print_dataset(zhp, cbp->cb_proplist, cbp->cb_scripted);
+ print_dataset(zhp, cbp->cb_proplist, cbp->cb_scripted, cbp->cb_literal);
return (0);
}
@@ -2948,6 +3020,7 @@ zfs_do_list(int argc, char **argv)
int types = ZFS_TYPE_DATASET;
boolean_t types_specified = B_FALSE;
char *fields = NULL;
+ zprop_list_t *pl;
list_cbdata_t cb = { 0 };
char *value;
int limit = 0;
@@ -2956,8 +3029,11 @@ zfs_do_list(int argc, char **argv)
int flags = ZFS_ITER_PROP_LISTSNAPS | ZFS_ITER_ARGS_CAN_BE_PATHS;
/* check options */
- while ((c = getopt(argc, argv, ":d:o:rt:Hs:S:")) != -1) {
+ while ((c = getopt(argc, argv, ":pd:o:rt:Hs:S:")) != -1) {
switch (c) {
+ case 'p':
+ cb.cb_literal = B_TRUE;
+ break;
case 'o':
fields = optarg;
break;
@@ -3050,6 +3126,18 @@ zfs_do_list(int argc, char **argv)
!= 0)
usage(B_FALSE);
+ /*
+ * The default set of properties contains only properties which can be
+ * retrieved from the set of cached properties. If any user-specfied
+ * properties cannot be retrieved from that set, unset the cachedprops
+ * flags on the ZFS handle.
+ */
+ libzfs_set_cachedprops(g_zfs, B_TRUE);
+ for (pl = cb.cb_proplist; pl != NULL; pl = pl->pl_next) {
+ if (zfs_prop_cacheable(pl->pl_prop))
+ libzfs_set_cachedprops(g_zfs, B_FALSE);
+ }
+
cb.cb_scripted = scripted;
cb.cb_first = B_TRUE;
diff --git a/usr/src/cmd/zic/africa b/usr/src/cmd/zic/africa
index 87f57c650a..98e0e73da3 100644
--- a/usr/src/cmd/zic/africa
+++ b/usr/src/cmd/zic/africa
@@ -1,5 +1,5 @@
# <pre>
-# @(#)africa 8.33
+# @(#)africa 8.35
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -768,6 +768,37 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# wall clock time (i.e. 11pm UTC), but that's what I would assume. It has
# also been like that in the past.
+# From Alexander Krivenyshev (2012-03-09):
+# According to Infom&eacute;diaire web site from Morocco (infomediaire.ma),
+# on March 9, 2012, (in French) Heure l&eacute;gale:
+# Le Maroc adopte officiellement l'heure d'&eacute;t&eacute;
+# <a href="http://www.infomediaire.ma/news/maroc/heure-l%C3%A9gale-le-maroc-adopte-officiellement-lheure-d%C3%A9t%C3%A9">
+# http://www.infomediaire.ma/news/maroc/heure-l%C3%A9gale-le-maroc-adopte-officiellement-lheure-d%C3%A9t%C3%A9
+# </a>
+# Governing Council adopted draft decree, that Morocco DST starts on
+# the last Sunday of March (March 25, 2012) and ends on
+# last Sunday of September (September 30, 2012)
+# except the month of Ramadan.
+# or (brief)
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_morocco06.html">
+# http://www.worldtimezone.com/dst_news/dst_news_morocco06.html
+# </a>
+
+# From Arthur David Olson (2012-03-10):
+# The infomediaire.ma source indicates that the system is to be in
+# effect every year. It gives 03H00 as the "fall back" time of day;
+# it lacks a "spring forward" time of day; assume 2:00 XXX.
+# Wait on specifying the Ramadan exception for details about
+# start date, start time of day, end date, and end time of day XXX.
+
+# From Christophe Tropamer (2012-03-16):
+# Seen Morocco change again:
+# <a href="http://www.le2uminutes.com/actualite.php">
+# http://www.le2uminutes.com/actualite.php
+# </a>
+# "...&agrave; partir du dernier dimance d'avril et non fins mars,
+# comme annonc&eacute; pr&eacute;c&eacute;demment."
+
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
@@ -793,6 +824,9 @@ Rule Morocco 2010 only - May 2 0:00 1:00 S
Rule Morocco 2010 only - Aug 8 0:00 0 -
Rule Morocco 2011 only - Apr 3 0:00 1:00 S
Rule Morocco 2011 only - Jul 31 0 0 -
+Rule Morocco 2012 max - Apr lastSun 2:00 1:00 S
+Rule Morocco 2012 max - Sep lastSun 3:00 0 -
+
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 Morocco WE%sT 1984 Mar 16
diff --git a/usr/src/cmd/zic/antarctica b/usr/src/cmd/zic/antarctica
index d19fbde0fc..2fca366d69 100644
--- a/usr/src/cmd/zic/antarctica
+++ b/usr/src/cmd/zic/antarctica
@@ -1,5 +1,5 @@
# <pre>
-# @(#)antarctica 8.9
+# @(#)antarctica 8.10
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -42,8 +42,19 @@ Rule ChileAQ 1997 only - Mar 30 3:00u 0 -
Rule ChileAQ 1998 only - Mar Sun>=9 3:00u 0 -
Rule ChileAQ 1998 only - Sep 27 4:00u 1:00 S
Rule ChileAQ 1999 only - Apr 4 3:00u 0 -
-Rule ChileAQ 1999 max - Oct Sun>=9 4:00u 1:00 S
-Rule ChileAQ 2000 max - Mar Sun>=9 3:00u 0 -
+Rule ChileAQ 1999 2010 - Oct Sun>=9 4:00u 1:00 S
+Rule ChileAQ 2000 2007 - Mar Sun>=9 3:00u 0 -
+# N.B.: the end of March 29 in Chile is March 30 in Universal time,
+# which is used below in specifying the transition.
+Rule ChileAQ 2008 only - Mar 30 3:00u 0 -
+Rule ChileAQ 2009 only - Mar Sun>=9 3:00u 0 -
+Rule ChileAQ 2010 only - Apr Sun>=1 3:00u 0 -
+Rule ChileAQ 2011 only - May Sun>=2 3:00u 0 -
+Rule ChileAQ 2011 only - Aug Sun>=16 4:00u 1:00 S
+Rule ChileAQ 2012 only - Apr Sun>=23 3:00u 0 -
+Rule ChileAQ 2012 only - Sep Sun>=2 4:00u 1:00 S
+Rule ChileAQ 2013 max - Mar Sun>=9 3:00u 0 -
+Rule ChileAQ 2013 max - Oct Sun>=9 4:00u 1:00 S
# These rules are stolen from the `australasia' file.
Rule AusAQ 1917 only - Jan 1 0:01 1:00 -
@@ -142,12 +153,16 @@ Zone Antarctica/Casey 0 - zzz 1969
# Western (Aus) Standard Time
11:00 - CAST 2010 Mar 5 2:00
# Casey Time
+ 8:00 - WST 2011 Oct 28 2:00
+ 11:00 - CAST 2012 Feb 21 17:00u
8:00 - WST
Zone Antarctica/Davis 0 - zzz 1957 Jan 13
7:00 - DAVT 1964 Nov # Davis Time
0 - zzz 1969 Feb
7:00 - DAVT 2009 Oct 18 2:00
5:00 - DAVT 2010 Mar 10 20:00u
+ 7:00 - DAVT 2011 Oct 28 2:00
+ 5:00 - DAVT 2012 Feb 21 20:00u
7:00 - DAVT
Zone Antarctica/Mawson 0 - zzz 1954 Feb 13
6:00 - MAWT 2009 Oct 18 2:00
diff --git a/usr/src/cmd/zic/asia b/usr/src/cmd/zic/asia
index 925cc36f0f..3be182e914 100644
--- a/usr/src/cmd/zic/asia
+++ b/usr/src/cmd/zic/asia
@@ -1,4 +1,5 @@
-# @(#)asia 8.69
+# <pre>
+# @(#)asia 8.73
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -77,10 +78,6 @@ Rule RussiaAsia 1993 max - Mar lastSun 2:00s 1:00 S
Rule RussiaAsia 1993 1995 - Sep lastSun 2:00s 0 -
Rule RussiaAsia 1996 max - Oct lastSun 2:00s 0 -
-# From Arthur David Olson (2011-06-15):
-# While Russia abandoned DST in 2011, Armenia may choose to
-# follow Russia's "old" rules.
-
# Afghanistan
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Kabul 4:36:48 - LMT 1890
@@ -97,6 +94,21 @@ Zone Asia/Kabul 4:36:48 - LMT 1890
# in 1996, though it did use DST in 1995. IATA SSIM (1991/1998) reports that
# Armenia switched from 3:00 to 4:00 in 1998 and observed DST after 1991,
# but started switching at 3:00s in 1998.
+
+# From Arthur David Olson (2011-06-15):
+# While Russia abandoned DST in 2011, Armenia may choose to
+# follow Russia's "old" rules.
+
+# From Alexander Krivenyshev (2012-02-10):
+# According to News Armenia, on Feb 9, 2012,
+# http://newsarmenia.ru/society/20120209/42609695.html
+#
+# The Armenia National Assembly adopted final reading of Amendments to the
+# Law "On procedure of calculation time on the territory of the Republic of
+# Armenia" according to which Armenia [is] abolishing Daylight Saving Time.
+# or
+# (brief)
+# http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2
3:00 - YERT 1957 Mar # Yerevan Time
@@ -104,7 +116,8 @@ Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2
3:00 1:00 YERST 1991 Sep 23 # independence
3:00 RussiaAsia AM%sT 1995 Sep 24 2:00s
4:00 - AMT 1997
- 4:00 RussiaAsia AM%sT
+ 4:00 RussiaAsia AM%sT 2012 Mar 25 2:00s
+ 4:00 - AMT
# Azerbaijan
# From Rustam Aliyev of the Azerbaijan Internet Forum (2005-10-23):
@@ -2235,6 +2248,29 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# http://www.maannews.net/eng/ViewDetails.aspx?ID=424808
# </a>
+# From Steffen Thorsen (2012-03-26):
+# Palestinian news sources tell that both Gaza and West Bank will start DST
+# on Friday (Thursday midnight, 2012-03-29 24:00).
+# Some of many sources in Arabic:
+# <a href="http://www.samanews.com/index.php?act=Show&id=122638">
+# http://www.samanews.com/index.php?act=Show&id=122638
+# </a>
+#
+# <a href="http://safa.ps/details/news/74352/%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-%D8%A8%D8%A7%D9%84%D8%B6%D9%81%D8%A9-%D9%88%D8%BA%D8%B2%D8%A9-%D9%84%D9%8A%D9%84%D8%A9-%D8%A7%D9%84%D8%AC%D9%85%D8%B9%D8%A9.html">
+# http://safa.ps/details/news/74352/%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-%D8%A8%D8%A7%D9%84%D8%B6%D9%81%D8%A9-%D9%88%D8%BA%D8%B2%D8%A9-%D9%84%D9%8A%D9%84%D8%A9-%D8%A7%D9%84%D8%AC%D9%85%D8%B9%D8%A9.html
+# </a>
+#
+# Our brief summary:
+# <a href="http://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html">
+# http://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html
+# </a>
+
+# From Arthur David Olson (2012-03-27):
+# The timeanddate article for 2012 says that "the end date has not yet been
+# announced" and that "Last year, both...paused daylight saving time during...
+# Ramadan. It is not yet known [for] 2012."
+# For now, assume both switch back on the last Friday in September. XXX
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 -
@@ -2267,6 +2303,8 @@ Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
2:00 Jordan EE%sT 1999
2:00 Palestine EE%sT 2011 Apr 2 12:01
2:00 1:00 EEST 2011 Aug 1
+ 2:00 - EET 2012 Mar 30
+ 2:00 1:00 EEST 2012 Sep 28
2:00 - EET
Zone Asia/Hebron 2:20:23 - LMT 1900 Oct
@@ -2280,6 +2318,8 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct
2:00 1:00 EEST 2011 Aug 1
2:00 - EET 2011 Aug 30
2:00 1:00 EEST 2011 Sep 30 3:00
+ 2:00 - EET 2012 Mar 30
+ 2:00 1:00 EEST 2012 Sep 28 3:00
2:00 - EET
# Paracel Is
@@ -2571,10 +2611,28 @@ Rule Syria 2007 only - Nov Fri>=1 0:00 0 -
# http://sns.sy/sns/?path=news/read/11421 (Arabic)
# </a>
+# From Steffen Thorsen (2012-03-26):
+# Today, Syria's government announced that they will start DST early on Friday
+# (00:00). This is a bit earlier than the past two years.
+#
+# From Syrian Arab News Agency, in Arabic:
+# <a href="http://www.sana.sy/ara/2/2012/03/26/408215.htm">
+# http://www.sana.sy/ara/2/2012/03/26/408215.htm
+# </a>
+#
+# Our brief summary:
+# <a href="http://www.timeanddate.com/news/time/syria-dst-2012.html">
+# http://www.timeanddate.com/news/time/syria-dst-2012.html
+# </a>
+
+# From Arthur David Olson (2012-03-27):
+# Assume last Friday in March going forward XXX.
+
Rule Syria 2008 only - Apr Fri>=1 0:00 1:00 S
Rule Syria 2008 only - Nov 1 0:00 0 -
Rule Syria 2009 only - Mar lastFri 0:00 1:00 S
-Rule Syria 2010 max - Apr Fri>=1 0:00 1:00 S
+Rule Syria 2010 2011 - Apr Fri>=1 0:00 1:00 S
+Rule Syria 2012 max - Mar lastFri 0:00 1:00 S
Rule Syria 2009 max - Oct lastFri 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
diff --git a/usr/src/cmd/zic/australasia b/usr/src/cmd/zic/australasia
index 930beed32e..07b55d4911 100644
--- a/usr/src/cmd/zic/australasia
+++ b/usr/src/cmd/zic/australasia
@@ -1,5 +1,5 @@
# <pre>
-# @(#)australasia 8.28
+# @(#)australasia 8.30
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -308,6 +308,20 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
# advance at 2am to 3am on October 23, 2011 and one hour back at 3am to
# 2am on February 26 next year.
+# From Ken Rylander (2011-10-24)
+# Another change to the Fiji DST end date. In the TZ database the end date for
+# Fiji DST 2012, is currently Feb 26. This has been changed to Jan 22.
+#
+# <a href="http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=5017:amendments-to-daylight-savings&catid=71:press-releases&Itemid=155">
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=5017:amendments-to-daylight-savings&catid=71:press-releases&Itemid=155
+# </a>
+# states:
+#
+# The end of daylight saving scheduled initially for the 26th of February 2012
+# has been brought forward to the 22nd of January 2012.
+# The commencement of daylight saving will remain unchanged and start
+# on the 23rd of October, 2011.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
Rule Fiji 1999 2000 - Feb lastSun 3:00 0 -
@@ -316,7 +330,7 @@ Rule Fiji 2010 only - Mar lastSun 3:00 0 -
Rule Fiji 2010 only - Oct 24 2:00 1:00 S
Rule Fiji 2011 only - Mar Sun>=1 3:00 0 -
Rule Fiji 2011 only - Oct 23 2:00 1:00 S
-Rule Fiji 2012 only - Feb 26 3:00 0 -
+Rule Fiji 2012 only - Jan 22 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:53:40 - LMT 1915 Oct 26 # Suva
12:00 Fiji FJ%sT # Fiji Time
@@ -602,6 +616,11 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5
# Dateline Change skip Friday 30th Dec 2011
# Thursday 29th December 2011 23:59:59 Hours
# Saturday 31st December 2011 00:00:00 Hours
+#
+# Clarification by Tim Parenti (2012-01-03):
+# Although Samoa has used Daylight Saving Time in the 2010-2011 and 2011-2012
+# seasons, there is not yet any indication that this trend will continue on
+# a regular basis. For now, we have explicitly listed the transitions below.
Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5
-11:26:56 - LMT 1911
-11:30 - SAMT 1950 # Samoa Time
@@ -619,9 +638,28 @@ Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Honiara
11:00 - SBT # Solomon Is Time
# Tokelau Is
+#
+# From Gwillim Law (2011-12-29)
+# A correspondent informed me that Tokelau, like Samoa, will be skipping
+# December 31 this year, thereby changing its time zone from UTC-10 to
+# UTC+14. When I tried to verify this statement, I found a confirming
+# article in Time magazine online
+# <a href="http://www.time.com/time/world/article/0,8599,2103243,00.html">
+# (http://www.time.com/time/world/article/0,8599,2103243,00.html).
+# </a>
+#
+# From Jonathan Leffler (2011-12-29)
+# Information from the BBC to the same effect:
+# <a href="http://www.bbc.co.uk/news/world-asia-16351377">
+# http://www.bbc.co.uk/news/world-asia-16351377
+# </a>
+#
+# Patch supplied by Tim Parenti (2011-12-29)
+
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fakaofo -11:24:56 - LMT 1901
- -10:00 - TKT # Tokelau Time
+ -10:00 - TKT 2011 Dec 30 # Tokelau Time
+ 14:00 - TKT
# Tonga
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
diff --git a/usr/src/cmd/zic/backward b/usr/src/cmd/zic/backward
index b8e5911651..b2d837d2f8 100644
--- a/usr/src/cmd/zic/backward
+++ b/usr/src/cmd/zic/backward
@@ -1,5 +1,5 @@
# <pre>
-# @(#)backward 8.10
+# @(#)backward 8.11
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -67,6 +67,7 @@ Link America/Havana Cuba
Link Africa/Cairo Egypt
Link Europe/Dublin Eire
Link Europe/London Europe/Belfast
+Link Europe/Chisinau Europe/Tiraspol
Link Europe/London GB
Link Europe/London GB-Eire
Link Etc/GMT GMT+0
diff --git a/usr/src/cmd/zic/europe b/usr/src/cmd/zic/europe
index 22bdd3648b..fceb410352 100644
--- a/usr/src/cmd/zic/europe
+++ b/usr/src/cmd/zic/europe
@@ -1,5 +1,5 @@
# <pre>
-# @(#)europe 8.39
+# @(#)europe 8.41
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -211,9 +211,15 @@
# the history of summer time legislation in the United Kingdom.
# Since 1998 Joseph S. Myers has been updating
# and extending this list, which can be found in
-# <a href="http://student.cusu.cam.ac.uk/~jsm28/british-time/">
+# http://student.cusu.cam.ac.uk/~jsm28/british-time/
+# <a href="http://www.polyomino.org.uk/british-time/">
# History of legal time in Britain
# </a>
+# Rob Crowther (2012-01-04) reports that that URL no longer
+# exists, and the article can now be found at:
+# <a href="http://www.polyomino.org.uk/british-time/">
+# http://www.polyomino.org.uk/british-time/
+# </a>
# From Joseph S. Myers (1998-01-06):
#
@@ -1151,10 +1157,10 @@ Rule France 1940 only - Feb 25 2:00 1:00 S
# write that they were used in Monaco and in many French locations.
# Le Corre writes that the upper limit of the free zone was Arneguy, Orthez,
# Mont-de-Marsan, Bazas, Langon, Lamotte-Montravel, Marouil, La
-# Rochefoucault, Champagne-Mouton, La Roche-Posay, La Haye-Decartes,
+# Rochefoucault, Champagne-Mouton, La Roche-Posay, La Haye-Descartes,
# Loches, Montrichard, Vierzon, Bourges, Moulins, Digoin,
# Paray-le-Monial, Montceau-les-Mines, Chalons-sur-Saone, Arbois,
-# Dole, Morez, St-Claude, and Collognes (Haute-Savioe).
+# Dole, Morez, St-Claude, and Collonges (Haute-Savoie).
Rule France 1941 only - May 5 0:00 2:00 M # Midsummer
# Shanks & Pottenger say this transition occurred at Oct 6 1:00,
# but go with Denis Excoffier (1997-12-12),
@@ -1678,6 +1684,18 @@ Zone Europe/Malta 0:58:04 - LMT 1893 Nov 2 0:00s # Valletta
# a pre-1880 LMT offset of 1:58:32.
#
# (which agrees with the earlier entry that had been removed)
+#
+# From Alexander Krivenyshev (2011-10-26)
+# NO need to divide Moldova into two timezones at this point.
+# As of today, Transnistria (Pridnestrovie)- Tiraspol reversed its own
+# decision to abolish DST this winter.
+# Following Moldova and neighboring Ukraine- Transnistria (Pridnestrovie)-
+# Tiraspol will go back to winter time on October 30, 2011.
+# News from Moldova (in russian):
+# <a href="http://ru.publika.md/link_317061.html">
+# http://ru.publika.md/link_317061.html
+# </a>
+
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Chisinau 1:55:20 - LMT 1880
@@ -1694,21 +1712,6 @@ Zone Europe/Chisinau 1:55:20 - LMT 1880
# See Romania commentary for the guessed 1997 transition to EU rules.
2:00 EU EE%sT
-Zone Europe/Tiraspol 1:58:32 - LMT 1880
- 1:55 - CMT 1918 Feb 15 # Chisinau MT
- 1:44:24 - BMT 1931 Jul 24 # Bucharest MT
- 2:00 Romania EE%sT 1940 Aug 15
- 2:00 1:00 EEST 1941 Jul 17
- 1:00 C-Eur CE%sT 1944 Aug 24
- 3:00 Russia MSK/MSD 1990
- 3:00 - MSK 1990 May 6
- 2:00 - EET 1991
- 2:00 Russia EE%sT 1992
- 2:00 E-Eur EE%sT 1997
-# See Romania commentary for the guessed 1997 transition to EU rules.
- 2:00 EU EE%sT 2011 Mar lastSun 1:00u
- 3:00 - FET # Further-eastern European Time
-
# Monaco
# Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
# more precise 0:09:21.
diff --git a/usr/src/cmd/zic/northamerica b/usr/src/cmd/zic/northamerica
index 68a7cd5191..605eb00941 100644
--- a/usr/src/cmd/zic/northamerica
+++ b/usr/src/cmd/zic/northamerica
@@ -1,5 +1,5 @@
# <pre>
-# @(#)northamerica 8.50
+# @(#)northamerica 8.54
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -1120,9 +1120,26 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00
# For now, assume all of DST-observing Canada will fall into line with the
# new US DST rules,
+# From Chris Walton (2011-12-01)
+# In the first of Tammy Hardwick's articles
+# <a href="http://www.ilovecreston.com/?p=articles&t=spec&ar=260">
+# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
+# </a>
+# she quotes the Friday November 1/1918 edition of the Creston Review.
+# The quote includes these two statements:
+# 'Sunday the CPR went back to the old system of time...'
+# '... The daylight saving scheme was dropped all over Canada at the same time,'
+# These statements refer to a transition from daylight time to standard time
+# that occurred nationally on Sunday October 27/1918. This transition was
+# also documented in the Saturday October 26/1918 edition of the Toronto Star.
+
+# In light of that evidence, we alter the date from the earlier believed
+# Oct 31, to Oct 27, 1918 (and Sunday is a more likely transition day
+# than Thursday) in all Canadian rulesets.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Canada 1918 only - Apr 14 2:00 1:00 D
-Rule Canada 1918 only - Oct 31 2:00 0 S
+Rule Canada 1918 only - Oct 27 2:00 0 S
Rule Canada 1942 only - Feb 9 2:00 1:00 W # War
Rule Canada 1945 only - Aug 14 23:00u 1:00 P # Peace
Rule Canada 1945 only - Sep 30 2:00 0 S
@@ -1645,7 +1662,7 @@ Zone America/Atikokan -6:06:28 - LMT 1895
Rule Winn 1916 only - Apr 23 0:00 1:00 D
Rule Winn 1916 only - Sep 17 0:00 0 S
Rule Winn 1918 only - Apr 14 2:00 1:00 D
-Rule Winn 1918 only - Oct 31 2:00 0 S
+Rule Winn 1918 only - Oct 27 2:00 0 S
Rule Winn 1937 only - May 16 2:00 1:00 D
Rule Winn 1937 only - Sep 26 2:00 0 S
Rule Winn 1942 only - Feb 9 2:00 1:00 W # War
@@ -1728,7 +1745,7 @@ Zone America/Winnipeg -6:28:36 - LMT 1887 Jul 16
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Regina 1918 only - Apr 14 2:00 1:00 D
-Rule Regina 1918 only - Oct 31 2:00 0 S
+Rule Regina 1918 only - Oct 27 2:00 0 S
Rule Regina 1930 1934 - May Sun>=1 0:00 1:00 D
Rule Regina 1930 1934 - Oct Sun>=1 0:00 0 S
Rule Regina 1937 1941 - Apr Sun>=8 0:00 1:00 D
@@ -1765,7 +1782,7 @@ Zone America/Swift_Current -7:11:20 - LMT 1905 Sep
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Edm 1918 1919 - Apr Sun>=8 2:00 1:00 D
-Rule Edm 1918 only - Oct 31 2:00 0 S
+Rule Edm 1918 only - Oct 27 2:00 0 S
Rule Edm 1919 only - May 27 2:00 0 S
Rule Edm 1920 1923 - Apr lastSun 2:00 1:00 D
Rule Edm 1920 only - Oct lastSun 2:00 0 S
@@ -1795,9 +1812,68 @@ Zone America/Edmonton -7:33:52 - LMT 1906 Sep
# Dawson Creek uses MST. Much of east BC is like Edmonton.
# Matthews and Vincent (1998) write that Creston is like Dawson Creek.
+# It seems though that (re: Creston) is not entirely correct:
+
+# From Chris Walton (2011-12-01):
+# There are two areas within the Canadian province of British Columbia
+# that do not currently observe daylight saving:
+# a) The Creston Valley (includes the town of Creston and surrounding area)
+# b) The eastern half of the Peace River Regional District
+# (includes the cities of Dawson Creek and Fort St. John)
+
+# Earlier this year I stumbled across a detailed article about the time
+# keeping history of Creston; it was written by Tammy Hardwick who is the
+# manager of the Creston & District Museum. The article was written in May 2009.
+# <a href="http://www.ilovecreston.com/?p=articles&t=spec&ar=260">
+# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
+# </a>
+# According to the article, Creston has not changed its clocks since June 1918.
+# i.e. Creston has been stuck on UTC-7 for 93 years.
+# Dawson Creek, on the other hand, changed its clocks as recently as April 1972.
+
+# Unfortunately the exact date for the time change in June 1918 remains
+# unknown and will be difficult to ascertain. I e-mailed Tammy a few months
+# ago to ask if Sunday June 2 was a reasonable guess. She said it was just
+# as plausible as any other date (in June). She also said that after writing the
+# article she had discovered another time change in 1916; this is the subject
+# of another article which she wrote in October 2010.
+# <a href="http://www.creston.museum.bc.ca/index.php?module=comments&uop=view_comment&cm+id=56">
+# http://www.creston.museum.bc.ca/index.php?module=comments&uop=view_comment&cm+id=56
+# </a>
+
+# Here is a summary of the three clock change events in Creston's history:
+# 1. 1884 or 1885: adoption of Mountain Standard Time (GMT-7)
+# Exact date unknown
+# 2. Oct 1916: switch to Pacific Standard Time (GMT-8)
+# Exact date in October unknown; Sunday October 1 is a reasonable guess.
+# 3. June 1918: switch to Pacific Daylight Time (GMT-7)
+# Exact date in June unknown; Sunday June 2 is a reasonable guess.
+# note#1:
+# On Oct 27/1918 when daylight saving ended in the rest of Canada,
+# Creston did not change its clocks.
+# note#2:
+# During WWII when the Federal Government legislated a mandatory clock change,
+# Creston did not oblige.
+# note#3:
+# There is no guarantee that Creston will remain on Mountain Standard Time
+# (UTC-7) forever.
+# The subject was debated at least once this year by the town Council.
+# <a href="http://www.bclocalnews.com/kootenay_rockies/crestonvalleyadvance/news/116760809.html">
+# http://www.bclocalnews.com/kootenay_rockies/crestonvalleyadvance/news/116760809.html
+# </a>
+
+# During a period WWII, summer time (Daylight saying) was mandatory in Canada.
+# In Creston, that was handled by shifting the area to PST (-8:00) then applying
+# summer time to cause the offset to be -7:00, the same as it had been before
+# the change. It can be argued that the timezone abbreviation during this
+# period should be PDT rather than MST, but that doesn't seem important enough
+# (to anyone) to further complicate the rules.
+
+# The transition dates (and times) are guesses.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Vanc 1918 only - Apr 14 2:00 1:00 D
-Rule Vanc 1918 only - Oct 31 2:00 0 S
+Rule Vanc 1918 only - Oct 27 2:00 0 S
Rule Vanc 1942 only - Feb 9 2:00 1:00 W # War
Rule Vanc 1945 only - Aug 14 23:00u 1:00 P # Peace
Rule Vanc 1945 only - Sep 30 2:00 0 S
@@ -1813,7 +1889,10 @@ Zone America/Dawson_Creek -8:00:56 - LMT 1884
-8:00 Canada P%sT 1947
-8:00 Vanc P%sT 1972 Aug 30 2:00
-7:00 - MST
-
+Zone America/Creston -7:46:04 - LMT 1884
+ -7:00 - MST 1916 Oct 1
+ -8:00 - PST 1918 Jun 2
+ -7:00 - MST
# Northwest Territories, Nunavut, Yukon
@@ -2690,6 +2769,34 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# <a href="http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html">
# http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
# </a>
+#
+# From Steffen Thorsen (2011-10-30)
+# Cuba will end DST two weeks later this year. Instead of going back
+# tonight, it has been delayed to 2011-11-13 at 01:00.
+#
+# One source (Spanish)
+# <a href="http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html">
+# http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html
+# </a>
+#
+# Our page:
+# <a href="http://www.timeanddate.com/news/time/cuba-time-changes-2011.html">
+# http://www.timeanddate.com/news/time/cuba-time-changes-2011.html
+# </a>
+#
+# From Steffen Thorsen (2012-03-01)
+# According to Radio Reloj, Cuba will start DST on Midnight between March
+# 31 and April 1.
+#
+# Radio Reloj has the following info (Spanish):
+# <a href="http://www.radioreloj.cu/index.php/noticias-radio-reloj/71-miscelaneas/7529-cuba-aplicara-el-horario-de-verano-desde-el-1-de-abril">
+# http://www.radioreloj.cu/index.php/noticias-radio-reloj/71-miscelaneas/7529-cuba-aplicara-el-horario-de-verano-desde-el-1-de-abril
+# </a>
+#
+# Our info on it:
+# <a href="http://www.timeanddate.com/news/time/cuba-starts-dst-2012.html">
+# http://www.timeanddate.com/news/time/cuba-starts-dst-2012.html
+# </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D
@@ -2721,12 +2828,15 @@ Rule Cuba 1997 only - Oct 12 0:00s 0 S
Rule Cuba 1998 1999 - Mar lastSun 0:00s 1:00 D
Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S
Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D
-Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
+Rule Cuba 2006 2010 - Oct lastSun 0:00s 0 S
Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2009 2010 - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2011 only - Mar Sun>=15 0:00s 1:00 D
-Rule Cuba 2012 max - Mar Sun>=8 0:00s 1:00 D
+Rule Cuba 2011 only - Nov 13 0:00s 0 S
+Rule Cuba 2012 only - Apr 1 0:00s 1:00 D
+Rule Cuba 2012 max - Oct lastSun 0:00s 0 S
+Rule Cuba 2013 max - Mar Sun>=8 0:00s 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890
@@ -2860,6 +2970,29 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5
# From Stephen Colebourne (2007-02-22):
# Some IATA info: Haiti won't be having DST in 2007.
+# From Steffen Thorsen (2012-03-11):
+# According to several news sources, Haiti will observe DST this year,
+# apparently using the same start and end date as USA/Canada.
+# So this means they have already changed their time.
+#
+# (Sources in French):
+# <a href="http://www.alterpresse.org/spip.php?article12510">
+# http://www.alterpresse.org/spip.php?article12510
+# </a>
+# <a href="http://radiovision2000haiti.net/home/?p=13253">
+# http://radiovision2000haiti.net/home/?p=13253
+# </a>
+#
+# Our coverage:
+# <a href="http://www.timeanddate.com/news/time/haiti-dst-2012.html">
+# http://www.timeanddate.com/news/time/haiti-dst-2012.html
+# </a>
+
+# From Arthur David Olson (2012-03-11):
+# The alterpresse.org source seems to show a US-style leap from 2:00 a.m. to
+# 3:00 a.m. rather than the traditional Haitian jump at midnight.
+# Assume a US-style fall back as well XXX.
+# Do not yet assume that the change carries forward past 2012 XXX.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Haiti 1983 only - May 8 0:00 1:00 D
@@ -2871,6 +3004,8 @@ Rule Haiti 1988 1997 - Apr Sun>=1 1:00s 1:00 D
Rule Haiti 1988 1997 - Oct lastSun 1:00s 0 S
Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D
Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S
+Rule Haiti 2012 only - Mar Sun>=8 2:00 1:00 D
+Rule Haiti 2012 only - Nov Sun>=1 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Port-au-Prince -4:49:20 - LMT 1890
-4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT
diff --git a/usr/src/cmd/zic/southamerica b/usr/src/cmd/zic/southamerica
index dc8fd3d447..45632b4cc6 100644
--- a/usr/src/cmd/zic/southamerica
+++ b/usr/src/cmd/zic/southamerica
@@ -1,5 +1,5 @@
# <pre>
-# @(#)southamerica 8.52
+# @(#)southamerica 8.53
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -813,7 +813,7 @@ Zone America/La_Paz -4:32:36 - LMT 1890
# From Guilherme Bernardes Rodrigues (2011-10-07):
# There is news in the media, however there is still no decree about it.
-# I just send a e-mail to Zulmira Brand�o at
+# I just send a e-mail to Zulmira Brandão at
# <a href="http://pcdsh01.on.br/">http://pcdsh01.on.br/</a> the
# oficial agency about time in Brazil, and she confirmed that the old rule is
# still in force.
@@ -1218,6 +1218,28 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# August, not in October as they have since 1968. This is a pilot plan
# which will be reevaluated in 2012.
+# From Mauricio Parada (2012-02-22), translated by Glenn Eychaner (2012-02-23):
+# As stated in the website of the Chilean Energy Ministry
+# http://www.minenergia.cl/ministerio/noticias/generales/gobierno-anuncia-fechas-de-cambio-de.html
+# The Chilean Government has decided to postpone the entrance into winter time
+# (to leave DST) from March 11 2012 to April 28th 2012. The decision has not
+# been yet formalized but it will within the next days.
+# Quote from the website communication:
+#
+# 6. For the year 2012, the dates of entry into winter time will be as follows:
+# a. Saturday April 28, 2012, clocks should go back 60 minutes; that is, at
+# 23:59:59, instead of passing to 0:00, the time should be adjusted to be 23:00
+# of the same day.
+# b. Saturday, September 1, 2012, clocks should go forward 60 minutes; that is,
+# at 23:59:59, instead of passing to 0:00, the time should be adjusted to be
+# 01:00 on September 2.
+#
+# Note that...this is yet another "temporary" change that will be reevaluated
+# AGAIN in 2013.
+
+# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
+# 'antarctica' file.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 1927 1932 - Sep 1 0:00 1:00 S
Rule Chile 1928 1932 - Apr 1 0:00 0 -
@@ -1248,8 +1270,6 @@ Rule Chile 1998 only - Mar Sun>=9 3:00u 0 -
Rule Chile 1998 only - Sep 27 4:00u 1:00 S
Rule Chile 1999 only - Apr 4 3:00u 0 -
Rule Chile 1999 2010 - Oct Sun>=9 4:00u 1:00 S
-Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 S
-Rule Chile 2012 max - Oct Sun>=9 4:00u 1:00 S
Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 -
# N.B.: the end of March 29 in Chile is March 30 in Universal time,
# which is used below in specifying the transition.
@@ -1257,7 +1277,11 @@ Rule Chile 2008 only - Mar 30 3:00u 0 -
Rule Chile 2009 only - Mar Sun>=9 3:00u 0 -
Rule Chile 2010 only - Apr Sun>=1 3:00u 0 -
Rule Chile 2011 only - May Sun>=2 3:00u 0 -
-Rule Chile 2012 max - Mar Sun>=9 3:00u 0 -
+Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 S
+Rule Chile 2012 only - Apr Sun>=23 3:00u 0 -
+Rule Chile 2012 only - Sep Sun>=2 4:00u 1:00 S
+Rule Chile 2013 max - Mar Sun>=9 3:00u 0 -
+Rule Chile 2013 max - Oct Sun>=9 4:00u 1:00 S
# IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -1403,6 +1427,21 @@ Zone Pacific/Galapagos -5:58:24 - LMT 1931 # Puerto Baquerizo Moreno
# will not revert to local mean time, but clocks will remain on Summer
# time (UTC/GMT - 3 hours) throughout the whole of 2011. Any long term
# change to local time following the trial period will be notified.
+#
+# From Andrew Newman (2012-02-24)
+# A letter from Justin McPhee, Chief Executive,
+# Cable & Wireless Falkland Islands (dated 2012-02-22)
+# states...
+# The current Atlantic/Stanley entry under South America expects the
+# clocks to go back to standard Falklands Time (FKT) on the 15th April.
+# The database entry states that in 2011 Stanley was staying on fixed
+# summer time on a trial basis only. FIG need to contact IANA and/or
+# the maintainers of the database to inform them we're adopting
+# the same policy this year and suggest recommendations for future years.
+#
+# For now we will assume permanent summer time for the Falklands
+# until advised differently (to apply for 2012 and beyond, after the 2011
+# experiment was apparently successful.)
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Falk 1937 1938 - Sep lastSun 0:00 1:00 S
Rule Falk 1938 1942 - Mar Sun>=19 0:00 0 -
@@ -1415,14 +1454,14 @@ Rule Falk 1984 only - Sep 16 0:00 1:00 S
Rule Falk 1985 2000 - Sep Sun>=9 0:00 1:00 S
Rule Falk 1986 2000 - Apr Sun>=16 0:00 0 -
Rule Falk 2001 2010 - Apr Sun>=15 2:00 0 -
-Rule Falk 2012 max - Apr Sun>=15 2:00 0 -
-Rule Falk 2001 max - Sep Sun>=1 2:00 1:00 S
+Rule Falk 2001 2010 - Sep Sun>=1 2:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Atlantic/Stanley -3:51:24 - LMT 1890
-3:51:24 - SMT 1912 Mar 12 # Stanley Mean Time
-4:00 Falk FK%sT 1983 May # Falkland Is Time
-3:00 Falk FK%sT 1985 Sep 15
- -4:00 Falk FK%sT
+ -4:00 Falk FK%sT 2010 Sep 5 02:00
+ -3:00 - FKST
# French Guiana
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
diff --git a/usr/src/cmd/zic/zone.tab.txt b/usr/src/cmd/zic/zone.tab.txt
index 2bdf923077..d0c2425376 100644
--- a/usr/src/cmd/zic/zone.tab.txt
+++ b/usr/src/cmd/zic/zone.tab.txt
@@ -1,5 +1,5 @@
# <pre>
-# @(#)zone.tab 8.38
+# @(#)zone.tab 8.55
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
@@ -32,7 +32,6 @@ AG +1703-06148 America/Antigua
AI +1812-06304 America/Anguilla
AL +4120+01950 Europe/Tirane
AM +4011+04430 Asia/Yerevan
-AN +1211-06900 America/Curacao
AO -0848+01314 Africa/Luanda
AQ -7750+16636 Antarctica/McMurdo McMurdo Station, Ross Island
AQ -9000+00000 Antarctica/South_Pole Amundsen-Scott Station, South Pole
@@ -87,6 +86,7 @@ BL +1753-06251 America/St_Barthelemy
BM +3217-06446 Atlantic/Bermuda
BN +0456+11455 Asia/Brunei
BO -1630-06809 America/La_Paz
+BQ +120903-0681636 America/Kralendijk
BR -0351-03225 America/Noronha Atlantic islands
BR -0127-04829 America/Belem Amapa, E Para
BR -0343-03830 America/Fortaleza NE Brazil (MA, PI, CE, RN, PB)
@@ -120,7 +120,7 @@ CA +4901-08816 America/Nipigon Eastern Time - Ontario & Quebec - places that did
CA +4823-08915 America/Thunder_Bay Eastern Time - Thunder Bay, Ontario
CA +6344-06828 America/Iqaluit Eastern Time - east Nunavut - most locations
CA +6608-06544 America/Pangnirtung Eastern Time - Pangnirtung, Nunavut
-CA +744144-0944945 America/Resolute Eastern Standard Time - Resolute, Nunavut
+CA +744144-0944945 America/Resolute Central Standard Time - Resolute, Nunavut
CA +484531-0913718 America/Atikokan Eastern Standard Time - Atikokan, Ontario and Southampton I, Nunavut
CA +624900-0920459 America/Rankin_Inlet Central Time - central Nunavut
CA +4953-09709 America/Winnipeg Central Time - Manitoba & west Ontario
@@ -131,6 +131,7 @@ CA +5333-11328 America/Edmonton Mountain Time - Alberta, east British Columbia &
CA +690650-1050310 America/Cambridge_Bay Mountain Time - west Nunavut
CA +6227-11421 America/Yellowknife Mountain Time - central Northwest Territories
CA +682059-1334300 America/Inuvik Mountain Time - west Northwest Territories
+CA +4906-11631 America/Creston Mountain Standard Time - Creston, British Columbia
CA +5946-12014 America/Dawson_Creek Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
CA +4916-12307 America/Vancouver Pacific Time - west British Columbia
CA +6043-13503 America/Whitehorse Pacific Time - south Yukon
@@ -155,6 +156,7 @@ CO +0436-07405 America/Bogota
CR +0956-08405 America/Costa_Rica
CU +2308-08222 America/Havana
CV +1455-02331 Atlantic/Cape_Verde
+CW +1211-06900 America/Curacao
CX -1025+10543 Indian/Christmas
CY +3510+03322 Asia/Nicosia
CZ +5005+01426 Europe/Prague
@@ -211,8 +213,8 @@ HT +1832-07220 America/Port-au-Prince
HU +4730+01905 Europe/Budapest
ID -0610+10648 Asia/Jakarta Java & Sumatra
ID -0002+10920 Asia/Pontianak west & central Borneo
-ID -0507+11924 Asia/Makassar east & south Borneo, Celebes, Bali, Nusa Tengarra, west Timor
-ID -0232+14042 Asia/Jayapura Irian Jaya & the Moluccas
+ID -0507+11924 Asia/Makassar east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
+ID -0232+14042 Asia/Jayapura west New Guinea (Irian Jaya) & Malukus (Moluccas)
IE +5320-00615 Europe/Dublin
IL +3146+03514 Asia/Jerusalem
IM +5409-00428 Europe/Isle_of_Man
@@ -318,7 +320,8 @@ PL +5215+02100 Europe/Warsaw
PM +4703-05620 America/Miquelon
PN -2504-13005 Pacific/Pitcairn
PR +182806-0660622 America/Puerto_Rico
-PS +3130+03428 Asia/Gaza
+PS +3130+03428 Asia/Gaza Gaza Strip
+PS +313200+0350542 Asia/Hebron West Bank
PT +3843-00908 Europe/Lisbon mainland
PT +3238-01654 Atlantic/Madeira Madeira Islands
PT +3744-02540 Atlantic/Azores Azores
@@ -331,7 +334,7 @@ RS +4450+02030 Europe/Belgrade
RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad
RU +5545+03735 Europe/Moscow Moscow+00 - west Russia
RU +4844+04425 Europe/Volgograd Moscow+00 - Caspian Sea
-RU +5312+05009 Europe/Samara Moscow - Samara, Udmurtia
+RU +5312+05009 Europe/Samara Moscow+00 - Samara, Udmurtia
RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals
RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia
RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk
@@ -360,8 +363,10 @@ SM +4355+01228 Europe/San_Marino
SN +1440-01726 Africa/Dakar
SO +0204+04522 Africa/Mogadishu
SR +0550-05510 America/Paramaribo
+SS +0451+03136 Africa/Juba
ST +0020+00644 Africa/Sao_Tome
SV +1342-08912 America/El_Salvador
+SX +180305-0630250 America/Lower_Princes
SY +3330+03618 Asia/Damascus
SZ -2618+03106 Africa/Mbabane
TC +2128-07108 America/Grand_Turk
@@ -404,6 +409,7 @@ US +411745-0863730 America/Indiana/Knox Central Time - Indiana - Starke County
US +450628-0873651 America/Menominee Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
US +470659-1011757 America/North_Dakota/Center Central Time - North Dakota - Oliver County
US +465042-1012439 America/North_Dakota/New_Salem Central Time - North Dakota - Morton County (except Mandan area)
+US +471551-1014640 America/North_Dakota/Beulah Central Time - North Dakota - Mercer County
US +394421-1045903 America/Denver Mountain Time
US +433649-1161209 America/Boise Mountain Time - south Idaho & east Oregon
US +364708-1084111 America/Shiprock Mountain Time - Navajo
@@ -411,9 +417,11 @@ US +332654-1120424 America/Phoenix Mountain Standard Time - Arizona
US +340308-1181434 America/Los_Angeles Pacific Time
US +611305-1495401 America/Anchorage Alaska Time
US +581807-1342511 America/Juneau Alaska Time - Alaska panhandle
+US +571035-1351807 America/Sitka Alaska Time - southeast Alaska panhandle
US +593249-1394338 America/Yakutat Alaska Time - Alaska panhandle neck
US +643004-1652423 America/Nome Alaska Time - west Alaska
US +515248-1763929 America/Adak Aleutian Islands
+US +550737-1313435 America/Metlakatla Metlakatla Time - Annette Island
US +211825-1575130 Pacific/Honolulu Hawaii
UY -3453-05611 America/Montevideo
UZ +3940+06648 Asia/Samarkand west Uzbekistan
diff --git a/usr/src/cmd/zic/zone_sun.tab b/usr/src/cmd/zic/zone_sun.tab
index 4e22a6f5ff..b42600d855 100644
--- a/usr/src/cmd/zic/zone_sun.tab
+++ b/usr/src/cmd/zic/zone_sun.tab
@@ -1,5 +1,5 @@
# <pre>
-# @(#)zone.tab 8.50
+# @(#)zone.tab 8.55
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
@@ -131,6 +131,7 @@ CA +5333-11328 America/Edmonton Canada/Mountain Mountain Time - Alberta, east Br
CA +690650-1050310 America/Cambridge_Bay - Mountain Time - west Nunavut
CA +6227-11421 America/Yellowknife - Mountain Time - central Northwest Territories
CA +682059-1334300 America/Inuvik - Mountain Time - west Northwest Territories
+CA +4906-11631 America/Creston - Mountain Standard Time - Creston, British Columbia
CA +5946-12014 America/Dawson_Creek - Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
CA +4916-12307 America/Vancouver Canada/Pacific Pacific Time - west British Columbia
CA +6043-13503 America/Whitehorse Canada/Yukon Pacific Time - south Yukon
@@ -334,7 +335,7 @@ RS +4450+02030 Europe/Belgrade -
RU +5443+02030 Europe/Kaliningrad - Moscow-01 - Kaliningrad
RU +5545+03735 Europe/Moscow - Moscow+00 - west Russia
RU +4844+04425 Europe/Volgograd - Moscow+00 - Caspian Sea
-RU +5312+05009 Europe/Samara - Moscow - Samara, Udmurtia
+RU +5312+05009 Europe/Samara - Moscow+00 - Samara, Udmurtia
RU +5651+06036 Asia/Yekaterinburg - Moscow+02 - Urals
RU +5500+07324 Asia/Omsk - Moscow+03 - west Siberia
RU +5502+08255 Asia/Novosibirsk - Moscow+03 - Novosibirsk
diff --git a/usr/src/cmd/zoneadm/Makefile b/usr/src/cmd/zoneadm/Makefile
index 2b01078aec..15cbf5c68e 100644
--- a/usr/src/cmd/zoneadm/Makefile
+++ b/usr/src/cmd/zoneadm/Makefile
@@ -21,14 +21,17 @@
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
#
PROG= zoneadm
+SCRIPTS=
MANIFEST= zones.xml resource-mgmt.xml
SVCMETHOD= svc-zones svc-resource-mgmt
include ../Makefile.cmd
+ROOTUSRSBINSCRIPTS= $(SCRIPTS:%=$(ROOTUSRSBIN)/%)
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
OBJS= zoneadm.o zfs.o
@@ -42,13 +45,14 @@ CERRWARN += -_gcc=-Wno-uninitialized
.KEEP_STATE:
-all: $(PROG)
+all: $(PROG) $(SCRIPTS)
$(PROG): $(OBJS)
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
$(POST_PROCESS)
-install: all $(ROOTUSRSBINPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
+install: all $(ROOTUSRSBINPROG) $(ROOTUSRSBINSCRIPTS) $(ROOTMANIFEST) \
+ $(ROOTSVCMETHOD)
check: $(PROG).c $(CHKMANIFEST)
$(CSTYLE) -pP $(SRCS:%=%)
@@ -58,7 +62,7 @@ $(POFILE): $(POFILES)
$(CAT) $(POFILES) > $@
clean:
- $(RM) $(OBJS) $(POFILES)
+ $(RM) $(OBJS) $(POFILES) $(SCRIPTS)
lint: lint_SRCS
diff --git a/usr/src/cmd/zoneadm/zfs.c b/usr/src/cmd/zoneadm/zfs.c
index 78c4583465..d27b9c4678 100644
--- a/usr/src/cmd/zoneadm/zfs.c
+++ b/usr/src/cmd/zoneadm/zfs.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -71,34 +72,6 @@ typedef struct clone_data {
} clone_data_t;
/*
- * A ZFS file system iterator call-back function which is used to validate
- * datasets imported into the zone.
- */
-/* ARGSUSED */
-static int
-check_zvol(zfs_handle_t *zhp, void *unused)
-{
- int ret;
-
- if (zfs_get_type(zhp) == ZFS_TYPE_VOLUME) {
- /*
- * TRANSLATION_NOTE
- * zfs and dataset are literals that should not be translated.
- */
- (void) fprintf(stderr, gettext("cannot verify zfs dataset %s: "
- "volumes cannot be specified as a zone dataset resource\n"),
- zfs_get_name(zhp));
- ret = -1;
- } else {
- ret = zfs_iter_children(zhp, check_zvol, NULL);
- }
-
- zfs_close(zhp);
-
- return (ret);
-}
-
-/*
* A ZFS file system iterator call-back function which returns the
* zfs_handle_t for a ZFS file system on the specified mount point.
*/
@@ -1259,17 +1232,6 @@ verify_datasets(zone_dochandle_t handle)
continue;
}
- if (zfs_get_type(zhp) == ZFS_TYPE_VOLUME) {
- (void) fprintf(stderr, gettext("cannot verify zfs "
- "dataset %s: volumes cannot be specified as a "
- "zone dataset resource\n"),
- dstab.zone_dataset_name);
- return_code = Z_ERR;
- }
-
- if (zfs_iter_children(zhp, check_zvol, NULL) != 0)
- return_code = Z_ERR;
-
zfs_close(zhp);
}
(void) zonecfg_enddsent(handle);
diff --git a/usr/src/cmd/zoneadm/zoneadm.c b/usr/src/cmd/zoneadm/zoneadm.c
index d0305b48a8..7e5ba5bbfb 100644
--- a/usr/src/cmd/zoneadm/zoneadm.c
+++ b/usr/src/cmd/zoneadm/zoneadm.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
/*
@@ -99,6 +100,7 @@ typedef struct zone_entry {
char zroot[MAXPATHLEN];
char zuuid[UUID_PRINTABLE_STRING_LENGTH];
zone_iptype_t ziptype;
+ zoneid_t zdid;
} zone_entry_t;
#define CLUSTER_BRAND_NAME "cluster"
@@ -434,6 +436,7 @@ zone_print(zone_entry_t *zent, boolean_t verbose, boolean_t parsable)
}
if (!verbose) {
char *cp, *clim;
+ char zdid[80];
if (!parsable) {
(void) printf("%s\n", zent->zname);
@@ -449,8 +452,12 @@ zone_print(zone_entry_t *zent, boolean_t verbose, boolean_t parsable)
(void) printf("%.*s\\:", clim - cp, cp);
cp = clim + 1;
}
- (void) printf("%s:%s:%s:%s\n", cp, zent->zuuid, zent->zbrand,
- ip_type_str);
+ if (zent->zdid == -1)
+ zdid[0] = '\0';
+ else
+ (void) snprintf(zdid, sizeof (zdid), "%d", zent->zdid);
+ (void) printf("%s:%s:%s:%s:%s\n", cp, zent->zuuid, zent->zbrand,
+ ip_type_str, zdid);
return;
}
if (zent->zstate_str != NULL) {
@@ -545,6 +552,22 @@ lookup_zone_info(const char *zone_name, zoneid_t zid, zone_entry_t *zent)
return (Z_OK);
}
+ if ((handle = zonecfg_init_handle()) == NULL) {
+ zperror2(zent->zname, gettext("could not init handle"));
+ return (Z_ERR);
+ }
+ if ((err = zonecfg_get_handle(zent->zname, handle)) != Z_OK) {
+ zperror2(zent->zname, gettext("could not get handle"));
+ zonecfg_fini_handle(handle);
+ return (Z_ERR);
+ }
+
+ if ((err = zonecfg_get_iptype(handle, &zent->ziptype)) != Z_OK) {
+ zperror2(zent->zname, gettext("could not get ip-type"));
+ zonecfg_fini_handle(handle);
+ return (Z_ERR);
+ }
+
/*
* There is a race condition where the zone could boot while
* we're walking the index file. In this case the zone state
@@ -565,25 +588,11 @@ lookup_zone_info(const char *zone_name, zoneid_t zid, zone_entry_t *zent)
zent->ziptype = ZS_EXCLUSIVE;
else
zent->ziptype = ZS_SHARED;
- return (Z_OK);
}
}
- if ((handle = zonecfg_init_handle()) == NULL) {
- zperror2(zent->zname, gettext("could not init handle"));
- return (Z_ERR);
- }
- if ((err = zonecfg_get_handle(zent->zname, handle)) != Z_OK) {
- zperror2(zent->zname, gettext("could not get handle"));
- zonecfg_fini_handle(handle);
- return (Z_ERR);
- }
+ zent->zdid = zonecfg_get_did(handle);
- if ((err = zonecfg_get_iptype(handle, &zent->ziptype)) != Z_OK) {
- zperror2(zent->zname, gettext("could not get ip-type"));
- zonecfg_fini_handle(handle);
- return (Z_ERR);
- }
zonecfg_fini_handle(handle);
return (Z_OK);
@@ -1169,6 +1178,7 @@ static int
ready_func(int argc, char *argv[])
{
zone_cmd_arg_t zarg;
+ boolean_t debug = B_FALSE;
int arg;
if (zonecfg_in_alt_root()) {
@@ -1177,11 +1187,14 @@ ready_func(int argc, char *argv[])
}
optind = 0;
- if ((arg = getopt(argc, argv, "?")) != EOF) {
+ if ((arg = getopt(argc, argv, "?X")) != EOF) {
switch (arg) {
case '?':
sub_usage(SHELP_READY, CMD_READY);
return (optopt == '?' ? Z_OK : Z_USAGE);
+ case 'X':
+ debug = B_TRUE;
+ break;
default:
sub_usage(SHELP_READY, CMD_READY);
return (Z_USAGE);
@@ -1198,6 +1211,7 @@ ready_func(int argc, char *argv[])
return (Z_ERR);
zarg.cmd = Z_READY;
+ zarg.debug = debug;
if (zonecfg_call_zoneadmd(target_zone, &zarg, locale, B_TRUE) != 0) {
zerror(gettext("call to %s failed"), "zoneadmd");
return (Z_ERR);
@@ -1210,6 +1224,7 @@ boot_func(int argc, char *argv[])
{
zone_cmd_arg_t zarg;
boolean_t force = B_FALSE;
+ boolean_t debug = B_FALSE;
int arg;
if (zonecfg_in_alt_root()) {
@@ -1236,7 +1251,7 @@ boot_func(int argc, char *argv[])
* zoneadm -z myzone boot -- -s -v -m verbose.
*/
optind = 0;
- while ((arg = getopt(argc, argv, "?fs")) != EOF) {
+ while ((arg = getopt(argc, argv, "?fsX")) != EOF) {
switch (arg) {
case '?':
sub_usage(SHELP_BOOT, CMD_BOOT);
@@ -1248,6 +1263,9 @@ boot_func(int argc, char *argv[])
case 'f':
force = B_TRUE;
break;
+ case 'X':
+ debug = B_TRUE;
+ break;
default:
sub_usage(SHELP_BOOT, CMD_BOOT);
return (Z_USAGE);
@@ -1273,6 +1291,7 @@ boot_func(int argc, char *argv[])
if (verify_details(CMD_BOOT, argv) != Z_OK)
return (Z_ERR);
zarg.cmd = force ? Z_FORCEBOOT : Z_BOOT;
+ zarg.debug = debug;
if (zonecfg_call_zoneadmd(target_zone, &zarg, locale, B_TRUE) != 0) {
zerror(gettext("call to %s failed"), "zoneadmd");
return (Z_ERR);
@@ -1783,6 +1802,7 @@ static int
halt_func(int argc, char *argv[])
{
zone_cmd_arg_t zarg;
+ boolean_t debug = B_FALSE;
int arg;
if (zonecfg_in_alt_root()) {
@@ -1791,11 +1811,14 @@ halt_func(int argc, char *argv[])
}
optind = 0;
- if ((arg = getopt(argc, argv, "?")) != EOF) {
+ if ((arg = getopt(argc, argv, "?X")) != EOF) {
switch (arg) {
case '?':
sub_usage(SHELP_HALT, CMD_HALT);
return (optopt == '?' ? Z_OK : Z_USAGE);
+ case 'X':
+ debug = B_TRUE;
+ break;
default:
sub_usage(SHELP_HALT, CMD_HALT);
return (Z_USAGE);
@@ -1821,6 +1844,7 @@ halt_func(int argc, char *argv[])
return (Z_ERR);
zarg.cmd = Z_HALT;
+ zarg.debug = debug;
return ((zonecfg_call_zoneadmd(target_zone, &zarg, locale,
B_TRUE) == 0) ? Z_OK : Z_ERR);
}
@@ -1829,6 +1853,7 @@ static int
reboot_func(int argc, char *argv[])
{
zone_cmd_arg_t zarg;
+ boolean_t debug = B_FALSE;
int arg;
if (zonecfg_in_alt_root()) {
@@ -1837,11 +1862,14 @@ reboot_func(int argc, char *argv[])
}
optind = 0;
- if ((arg = getopt(argc, argv, "?")) != EOF) {
+ if ((arg = getopt(argc, argv, "?X")) != EOF) {
switch (arg) {
case '?':
sub_usage(SHELP_REBOOT, CMD_REBOOT);
return (optopt == '?' ? Z_OK : Z_USAGE);
+ case 'X':
+ debug = B_TRUE;
+ break;
default:
sub_usage(SHELP_REBOOT, CMD_REBOOT);
return (Z_USAGE);
@@ -1876,6 +1904,7 @@ reboot_func(int argc, char *argv[])
return (Z_ERR);
zarg.cmd = Z_REBOOT;
+ zarg.debug = debug;
return ((zonecfg_call_zoneadmd(target_zone, &zarg, locale, B_TRUE) == 0)
? Z_OK : Z_ERR);
}
@@ -2103,6 +2132,10 @@ verify_fs_special(struct zone_fstab *fstab)
if (strcmp(fstab->zone_fs_type, MNTTYPE_ZFS) == 0)
return (verify_fs_zfs(fstab));
+ if (strcmp(fstab->zone_fs_type, MNTTYPE_HYPRLOFS) == 0 &&
+ strcmp(fstab->zone_fs_special, "swap") == 0)
+ return (Z_OK);
+
if (stat64(fstab->zone_fs_special, &st) != 0) {
(void) fprintf(stderr, gettext("could not verify fs "
"%s: could not access %s: %s\n"), fstab->zone_fs_dir,
@@ -2506,7 +2539,6 @@ verify_handle(int cmd_num, zone_dochandle_t handle, char *argv[])
dladm_handle_t dh;
dladm_status_t status;
datalink_id_t linkid;
- char errmsg[DLADM_STRSIZE];
in_alt_root = zonecfg_in_alt_root();
if (in_alt_root)
@@ -2589,11 +2621,6 @@ verify_handle(int cmd_num, zone_dochandle_t handle, char *argv[])
dladm_close(dh);
}
if (status != DLADM_STATUS_OK) {
- (void) fprintf(stderr,
- gettext("WARNING: skipping network "
- "interface '%s': %s\n"),
- nwiftab.zone_nwif_physical,
- dladm_status2str(status, errmsg));
break;
}
dl_owner_zid = ALL_ZONES;
@@ -2677,6 +2704,61 @@ no_net:
return (return_code);
}
+/*
+ * Called when readying or booting a zone. We double check that the zone's
+ * debug ID is set and is unique. This covers the case of pre-existing zones
+ * with no ID. Also, its possible that a zone was migrated to this host
+ * and as a result it has a duplicate ID. In this case we preserve the ID
+ * of the first zone we match on in the index file (since it was there before
+ * the current zone) and we assign a new unique ID to the current zone.
+ * Return true if we assigned a new ID, indicating that the zone configuration
+ * needs to be saved.
+ */
+static boolean_t
+verify_fix_did(zone_dochandle_t handle)
+{
+ zoneid_t mydid;
+ zone_entry_t zent;
+ FILE *cookie;
+ char *name;
+ boolean_t fix = B_FALSE;
+
+ mydid = zonecfg_get_did(handle);
+ if (mydid == -1) {
+ zonecfg_set_did(handle);
+ return (B_TRUE);
+ }
+
+ /* Get the full list of zones from the configuration. */
+ cookie = setzoneent();
+ while ((name = getzoneent(cookie)) != NULL) {
+ if (strcmp(target_zone, name) == 0) {
+ free(name);
+ break; /* Once we find our entry, stop. */
+ }
+
+ if (strcmp(name, "global") == 0 ||
+ lookup_zone_info(name, ZONE_ID_UNDEFINED, &zent) != Z_OK) {
+ free(name);
+ continue;
+ }
+
+ free(name);
+ if (zent.zdid == mydid) {
+ fix = B_TRUE;
+ break;
+ }
+ }
+ endzoneent(cookie);
+
+ if (fix) {
+ zonecfg_set_did(handle);
+ return (B_TRUE);
+ }
+
+ return (B_FALSE);
+}
+
static int
verify_details(int cmd_num, char *argv[])
{
@@ -2736,6 +2818,18 @@ verify_details(int cmd_num, char *argv[])
if (verify_handle(cmd_num, handle, argv) != Z_OK)
return_code = Z_ERR;
+ if (cmd_num == CMD_READY || cmd_num == CMD_BOOT) {
+ int vcommit = 0, obscommit = 0;
+
+ vcommit = verify_fix_did(handle);
+ obscommit = zonecfg_fix_obsolete(handle);
+
+ if (vcommit || obscommit)
+ if (zonecfg_save(handle) != Z_OK)
+ (void) fprintf(stderr, gettext("Could not save "
+ "updated configuration.\n"));
+ }
+
zonecfg_fini_handle(handle);
if (return_code == Z_ERR)
(void) fprintf(stderr,
@@ -2821,6 +2915,7 @@ install_func(int argc, char *argv[])
int status;
boolean_t do_postinstall = B_FALSE;
boolean_t brand_help = B_FALSE;
+ boolean_t do_dataset = B_TRUE;
char opts[128];
if (target_zone == NULL) {
@@ -2896,6 +2991,12 @@ install_func(int argc, char *argv[])
}
/* Ignore unknown options - may be brand specific. */
break;
+ case 'x':
+ if (strcmp(optarg, "nodataset") == 0) {
+ do_dataset = B_FALSE;
+ continue; /* internal arg, don't pass thru */
+ }
+ break;
default:
/* Ignore unknown options - may be brand specific. */
break;
@@ -2948,7 +3049,8 @@ install_func(int argc, char *argv[])
goto done;
}
- create_zfs_zonepath(zonepath);
+ if (do_dataset)
+ create_zfs_zonepath(zonepath);
}
status = do_subproc(cmdbuf);
@@ -4911,6 +5013,7 @@ uninstall_func(int argc, char *argv[])
if (zonecfg_ping_zoneadmd(target_zone) == Z_OK) {
zone_cmd_arg_t zarg;
zarg.cmd = Z_NOTE_UNINSTALLING;
+ zarg.debug = B_FALSE;
/* we don't care too much if this fails, just plow on */
(void) zonecfg_call_zoneadmd(target_zone, &zarg, locale,
B_TRUE);
@@ -5026,6 +5129,7 @@ mount_func(int argc, char *argv[])
return (Z_ERR);
zarg.cmd = force ? Z_FORCEMOUNT : Z_MOUNT;
+ zarg.debug = B_FALSE;
zarg.bootbuf[0] = '\0';
if (zonecfg_call_zoneadmd(target_zone, &zarg, locale, B_TRUE) != 0) {
zerror(gettext("call to %s failed"), "zoneadmd");
@@ -5047,6 +5151,7 @@ unmount_func(int argc, char *argv[])
return (Z_ERR);
zarg.cmd = Z_UNMOUNT;
+ zarg.debug = B_FALSE;
if (zonecfg_call_zoneadmd(target_zone, &zarg, locale, B_TRUE) != 0) {
zerror(gettext("call to %s failed"), "zoneadmd");
return (Z_ERR);
@@ -5268,7 +5373,7 @@ apply_func(int argc, char *argv[])
priv_set_t *privset;
zoneid_t zoneid;
zone_dochandle_t handle;
- struct zone_mcaptab mcap;
+ uint64_t mcap;
char pool_err[128];
zoneid = getzoneid();
@@ -5359,19 +5464,12 @@ apply_func(int argc, char *argv[])
}
/*
- * If a memory cap is configured, set the cap in the kernel using
- * zone_setattr() and make sure the rcapd SMF service is enabled.
+ * If a memory cap is configured, make sure the rcapd SMF service is
+ * enabled.
*/
- if (zonecfg_getmcapent(handle, &mcap) == Z_OK) {
- uint64_t num;
+ if (zonecfg_get_aliased_rctl(handle, ALIAS_MAXPHYSMEM, &mcap) == Z_OK) {
char smf_err[128];
- num = (uint64_t)strtoll(mcap.zone_physmem_cap, NULL, 10);
- if (zone_setattr(zoneid, ZONE_ATTR_PHYS_MCAP, &num, 0) == -1) {
- zerror(gettext("could not set zone memory cap"));
- res = Z_ERR;
- }
-
if (zonecfg_enable_rcapd(smf_err, sizeof (smf_err)) != Z_OK) {
zerror(gettext("enabling system/rcap service failed: "
"%s"), smf_err);
diff --git a/usr/src/cmd/zoneadm/zones.xml b/usr/src/cmd/zoneadm/zones.xml
index e14424ac26..33ba71cd3e 100644
--- a/usr/src/cmd/zoneadm/zones.xml
+++ b/usr/src/cmd/zoneadm/zones.xml
@@ -23,8 +23,6 @@
CDDL HEADER END
- ident "%Z%%M% %I% %E% SMI"
-
NOTE: This service manifest is not editable; its contents will
be overwritten by package or patch operations, including
operating system upgrade. Make customizations in a different
@@ -54,11 +52,19 @@
<service_fmri value='svc:/milestone/multi-user-server' />
</dependency>
+ <dependency
+ name='metadata'
+ type='service'
+ grouping='require_all'
+ restart_on='none'>
+ <service_fmri value='svc:/system/smartdc/metadata' />
+ </dependency>
+
<exec_method
type='method'
name='start'
exec='/lib/svc/method/svc-zones %m'
- timeout_seconds='60'>
+ timeout_seconds='0'>
</exec_method>
<!--
diff --git a/usr/src/cmd/zoneadmd/Makefile b/usr/src/cmd/zoneadmd/Makefile
index 078d6c7b39..4c3c697a9d 100644
--- a/usr/src/cmd/zoneadmd/Makefile
+++ b/usr/src/cmd/zoneadmd/Makefile
@@ -18,56 +18,52 @@
#
# CDDL HEADER END
-
-#
-
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
#
PROG= zoneadmd
include ../Makefile.cmd
-ROOTCMDDIR= $(ROOTLIB)/zones
-
-OBJS= zoneadmd.o zcons.o vplat.o
-SRCS = $(OBJS:.o=.c)
-POFILE=zoneadmd_all.po
-POFILES= $(OBJS:%.o=%.po)
+$(64ONLY)SUBDIRS= $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
-CFLAGS += $(CCVERBOSE)
-CERRWARN += -_gcc=-Wno-switch
-CERRWARN += -_gcc=-Wno-parentheses
-CERRWARN += -_gcc=-Wno-uninitialized
+all := TARGET = all
+install := TARGET = install
+clean := TARGET = clean
+clobber := TARGET = clobber
+lint := TARGET = lint
-LDLIBS += -lsocket -lzonecfg -lnsl -ldevinfo -ldevice -lnvpair \
- -lgen -lbsm -lcontract -lzfs -luuid -lbrand -ldladm -ltsnet -ltsol \
- -linetutil
XGETFLAGS += -a -x zoneadmd.xcl
+ROOTUSRLIBZONES = $(ROOT)/usr/lib/zones
+
.KEEP_STATE:
.PARALLEL:
-all: $(PROG)
+all: $(SUBDIRS)
$(PROG): $(OBJS)
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
$(POST_PROCESS)
-install: all $(ROOTCMD)
-
-$(POFILE): $(POFILES)
- $(RM) $@
- $(CAT) $(POFILES) > $@
+install: $(SUBDIRS)
+ -$(RM) $(ROOTUSRLIBZONES)/$(PROG)
+ -$(LN) $(ISAEXEC) $(ROOTUSRLIBZONES)/$(PROG)
-clean:
- $(RM) $(OBJS)
+$(POFILE):
-lint: lint_SRCS
+clean clobebr lint: $(SUBDIRS)
check:
- $(CSTYLE) -p -P $(SRCS:%=%)
+ $(CSTYLE) -p -P *.c
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
include ../Makefile.targ
diff --git a/usr/src/cmd/zoneadmd/Makefile.com b/usr/src/cmd/zoneadmd/Makefile.com
new file mode 100644
index 0000000000..ae00564d95
--- /dev/null
+++ b/usr/src/cmd/zoneadmd/Makefile.com
@@ -0,0 +1,68 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
+#
+
+PROG= zoneadmd
+
+include ../../Makefile.cmd
+
+ROOTCMDDIR= $(ROOTLIB)/zones
+
+OBJS= zoneadmd.o zcons.o vplat.o mcap.o
+
+CFLAGS += $(CCVERBOSE)
+LDLIBS += -lsocket -lzonecfg -lnsl -ldevinfo -ldevice -lnvpair \
+ -lgen -lbsm -lcontract -lzfs -luuid -lbrand -ldladm -ltsnet -ltsol \
+ -linetutil -lproc
+
+.KEEP_STATE:
+
+%.o: ../%.c
+ $(COMPILE.c) $<
+
+ROOTUSRLIBZONES = $(ROOT)/usr/lib/zones
+ROOTUSRLIBZONES32 = $(ROOTUSRLIBZONES)/$(MACH32)
+ROOTUSRLIBZONES64 = $(ROOTUSRLIBZONES)/$(MACH64)
+ROOTUSRLIBZONESPROG32 = $(ROOTUSRLIBZONES32)/$(PROG)
+ROOTUSRLIBZONESPROG64 = $(ROOTUSRLIBZONES64)/$(PROG)
+$(ROOTUSRLIBZONES32)/%: $(ROOTUSRLIBZONES32) %
+ $(INS.file)
+$(ROOTUSRLIBZONES64)/%: $(ROOTUSRLIBZONES64) %
+ $(INS.file)
+$(ROOTUSRLIBZONES32):
+ $(INS.dir)
+
+all: $(PROG)
+
+$(PROG): $(OBJS)
+ $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
+ $(POST_PROCESS)
+
+clean:
+ $(RM) $(OBJS)
+
+lint:
+ $(LINT.c) ../*.c $(LDLIBS)
+
+include ../../Makefile.targ
diff --git a/usr/src/cmd/zoneadmd/amd64/Makefile b/usr/src/cmd/zoneadmd/amd64/Makefile
new file mode 100644
index 0000000000..75ac51db32
--- /dev/null
+++ b/usr/src/cmd/zoneadmd/amd64/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
+#
+
+.KEEP_STATE:
+
+include ../Makefile.com
+include ../../Makefile.cmd.64
+
+install: all $(ROOTUSRLIBZONES64) $(ROOTUSRLIBZONESPROG64)
diff --git a/usr/src/cmd/lp/filter/postscript/dpost/ps_include.awk b/usr/src/cmd/zoneadmd/i386/Makefile
index fe51c946e0..a8764e0638 100644
--- a/usr/src/cmd/lp/filter/postscript/dpost/ps_include.awk
+++ b/usr/src/cmd/zoneadmd/i386/Makefile
@@ -19,13 +19,12 @@
#
# CDDL HEADER END
#
-/^->/ {
- if(ndef)
- printf("\t0\n};\n\n")
- printf("static char *%s[] = {\n", $2)
- ndef++
- next
-}
-/^#/ {next}
-$0 != "" {printf("\t\"%s\",\n", $0); next}
-END {printf("\t0\n};\n")}
+#
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
+#
+
+.KEEP_STATE:
+
+include ../Makefile.com
+
+install: all $(ROOTUSRLIBZONES32) $(ROOTUSRLIBZONESPROG32)
diff --git a/usr/src/cmd/zoneadmd/mcap.c b/usr/src/cmd/zoneadmd/mcap.c
new file mode 100644
index 0000000000..e0c2683e4a
--- /dev/null
+++ b/usr/src/cmd/zoneadmd/mcap.c
@@ -0,0 +1,1090 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2011, 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * This file implements the code which runs a thread inside zoneadmd to cap
+ * the associated zone's physical memory. A thread to do this is started
+ * when the zone boots and is halted when the zone shuts down.
+ *
+ * Because of the way that the VM system is currently implemented, there is no
+ * way to go from the bottom up (page to process to zone). Thus, there is no
+ * obvious way to hook an rctl into the kernel's paging code to enforce a hard
+ * memory cap. Instead, we implement a soft physical memory cap which looks
+ * at the zone's overall rss and once it is over the cap, works from the top
+ * down (zone to process to page), looking at zone processes, to determine
+ * what to try to pageout to get the zone under its memory cap.
+ *
+ * The code uses the vm_getusage syscall to determine the zone's rss and
+ * checks that against the zone's zone.max-physical-memory rctl. Once the
+ * zone goes over its cap, then this thread will work through the zone's
+ * /proc process list, Pgrab-bing each process and stepping through the
+ * address space segments attempting to use pr_memcntl(...MS_INVALCURPROC...)
+ * to pageout pages, until the zone is again under its cap.
+ *
+ * Although zone memory capping is implemented as a soft cap by this user-level
+ * thread, the interfaces around memory caps that are exposed to the user are
+ * the standard ones; an rctl and kstats. This thread uses the rctl value
+ * to obtain the cap and works with the zone kernel code to update the kstats.
+ * If the implementation ever moves into the kernel, these exposed interfaces
+ * do not need to change.
+ *
+ * The thread adaptively sleeps, periodically checking the state of the
+ * zone. As the zone's rss gets closer to the cap, the thread will wake up
+ * more often to check the zone's status. Once the zone is over the cap,
+ * the thread will work to pageout until the zone is under the cap, as shown
+ * by updated vm_usage data.
+ *
+ * NOTE: The pagedata page maps (at least on x86) are not useful. Those flags
+ * are set by hrm_setbits() and on x86 that code path is only executed by
+ * segvn_pagelock -> hat_setstat -> hrm_setbits
+ * segvn_softunlock -^
+ * On SPARC there is an additional code path which may make this data
+ * useful (sfmmu_ttesync), but since it is not generic, we ignore the page
+ * maps. If we ever fix this issue, then we could generalize this mcap code to
+ * do more with the data on active pages.
+ *
+ * For debugging, touch the file {zonepath}/mcap_debug.log. This will
+ * cause the thread to start logging its actions into that file (it may take
+ * a minute or two if the thread is currently sleeping). Removing that
+ * file will cause logging to stop.
+ */
+
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libproc.h>
+#include <limits.h>
+#include <procfs.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/priocntl.h>
+#include <dirent.h>
+#include <zone.h>
+#include <libzonecfg.h>
+#include <thread.h>
+#include <values.h>
+#include <sys/vm_usage.h>
+#include <sys/resource.h>
+#include <sys/debug.h>
+#include <synch.h>
+#include <wait.h>
+#include <libcontract.h>
+#include <libcontract_priv.h>
+#include <sys/contract/process.h>
+#include "zoneadmd.h"
+
+ /* round up to next y = 2^n */
+#define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
+
+#define CAP_REFRESH ((uint64_t)300 * NANOSEC) /* every 5 minutes */
+
+/*
+ * zonecfg attribute tunables for memory capping.
+ * phys-mcap-cmd
+ * type: string
+ * specifies a command that can be run when over the cap
+ * phys-mcap-no-vmusage
+ * type: boolean
+ * true disables vm_getusage and just uses zone's proc. rss sum
+ * phys-mcap-no-pageout
+ * type: boolean
+ * true disables pageout when over
+ */
+#define TUNE_CMD "phys-mcap-cmd"
+#define TUNE_NVMU "phys-mcap-no-vmusage"
+#define TUNE_NPAGE "phys-mcap-no-pageout"
+
+static char zonename[ZONENAME_MAX];
+static char zonepath[MAXPATHLEN];
+static char zoneproc[MAXPATHLEN];
+static char debug_log[MAXPATHLEN];
+static zoneid_t zid;
+static mutex_t shutdown_mx;
+static cond_t shutdown_cv;
+static int shutting_down = 0;
+static thread_t mcap_tid;
+static FILE *debug_log_fp = NULL;
+static uint64_t zone_rss_cap; /* RSS cap(KB) */
+static char over_cmd[2 * BUFSIZ]; /* same size as zone_attr_value */
+static boolean_t skip_vmusage = B_FALSE;
+static boolean_t skip_pageout = B_FALSE;
+
+/*
+ * Structure to hold current state about a process address space that we're
+ * working on.
+ */
+typedef struct {
+ int pr_curr; /* the # of the mapping we're working on */
+ int pr_nmap; /* number of mappings in address space */
+ prxmap_t *pr_xmapp; /* process's xmap array */
+} proc_map_t;
+
+typedef struct zsd_vmusage64 {
+ id_t vmu_zoneid;
+ uint_t vmu_type;
+ id_t vmu_id;
+ /*
+ * An amd64 kernel will align the following uint64_t members, but a
+ * 32bit i386 process will not without help.
+ */
+ int vmu_align_next_members_on_8_bytes;
+ uint64_t vmu_rss_all;
+ uint64_t vmu_rss_private;
+ uint64_t vmu_rss_shared;
+ uint64_t vmu_swap_all;
+ uint64_t vmu_swap_private;
+ uint64_t vmu_swap_shared;
+} zsd_vmusage64_t;
+
+/*
+ * Output a debug log message.
+ */
+/*PRINTFLIKE1*/
+static void
+debug(char *fmt, ...)
+{
+ va_list ap;
+
+ if (debug_log_fp == NULL)
+ return;
+
+ va_start(ap, fmt);
+ (void) vfprintf(debug_log_fp, fmt, ap);
+ va_end(ap);
+ (void) fflush(debug_log_fp);
+}
+
+/*
+ * Like sleep(3C) but can be interupted by cond_signal which is posted when
+ * we're shutting down the mcap thread.
+ */
+static void
+sleep_shutdown(int secs)
+{
+ timestruc_t to;
+
+ to.tv_sec = secs;
+ to.tv_nsec = 0;
+
+ (void) mutex_lock(&shutdown_mx);
+ if (!shutting_down)
+ (void) cond_reltimedwait(&shutdown_cv, &shutdown_mx, &to);
+ (void) mutex_unlock(&shutdown_mx);
+}
+
+static boolean_t
+proc_issystem(pid_t pid)
+{
+ char pc_clname[PC_CLNMSZ];
+
+ if (priocntl(P_PID, pid, PC_GETXPARMS, NULL, PC_KY_CLNAME, pc_clname,
+ PC_KY_NULL) != -1)
+ return (strcmp(pc_clname, "SYS") == 0);
+
+ return (B_TRUE);
+}
+
+/*
+ * Fork a child that enters the zone and runs the "phys-mcap-cmd" command.
+ */
+static void
+run_over_cmd()
+{
+ int ctfd;
+ int err;
+ pid_t childpid;
+ siginfo_t info;
+ ctid_t ct;
+
+ /*
+ * Before we enter the zone, we need to create a new process contract
+ * for the child, as required by zone_enter().
+ */
+ if ((ctfd = open64("/system/contract/process/template", O_RDWR)) == -1)
+ return;
+ if (ct_tmpl_set_critical(ctfd, 0) != 0 ||
+ ct_tmpl_set_informative(ctfd, 0) != 0 ||
+ ct_pr_tmpl_set_fatal(ctfd, CT_PR_EV_HWERR) != 0 ||
+ ct_pr_tmpl_set_param(ctfd, CT_PR_PGRPONLY) != 0 ||
+ ct_tmpl_activate(ctfd) != 0) {
+ (void) close(ctfd);
+ return;
+ }
+
+ childpid = fork();
+ switch (childpid) {
+ case -1:
+ (void) ct_tmpl_clear(ctfd);
+ (void) close(ctfd);
+ break;
+ case 0: /* Child */
+ (void) ct_tmpl_clear(ctfd);
+ (void) close(ctfd);
+ if (zone_enter(zid) == -1)
+ _exit(errno);
+ err = system(over_cmd);
+ _exit(err);
+ break;
+ default: /* Parent */
+ if (contract_latest(&ct) == -1)
+ ct = -1;
+ (void) ct_tmpl_clear(ctfd);
+ (void) close(ctfd);
+ err = waitid(P_PID, childpid, &info, WEXITED);
+ (void) contract_abandon_id(ct);
+ if (err == -1 || info.si_status != 0)
+ debug("over_cmd failed");
+ break;
+ }
+}
+
+static struct ps_prochandle *
+control_proc(pid_t pid)
+{
+ int res;
+ struct ps_prochandle *ph;
+
+ /* Take control of the process. */
+ if ((ph = Pgrab(pid, 0, &res)) == NULL)
+ return (NULL);
+
+ if (Pcreate_agent(ph) != 0) {
+ (void) Prelease(ph, 0);
+ return (NULL);
+ }
+
+ /* Verify agent LWP is actually stopped. */
+ errno = 0;
+ while (Pstate(ph) == PS_RUN)
+ (void) Pwait(ph, 0);
+
+ if (Pstate(ph) != PS_STOP) {
+ Pdestroy_agent(ph);
+ (void) Prelease(ph, 0);
+ return (NULL);
+ }
+
+ return (ph);
+}
+
+/*
+ * Get the next mapping.
+ */
+static prxmap_t *
+nextmapping(proc_map_t *pmp)
+{
+ if (pmp->pr_xmapp == NULL || pmp->pr_curr >= pmp->pr_nmap)
+ return (NULL);
+
+ return (&pmp->pr_xmapp[pmp->pr_curr++]);
+}
+
+/*
+ * Initialize the proc_map_t to access the first mapping of an address space.
+ */
+static prxmap_t *
+init_map(proc_map_t *pmp, pid_t pid)
+{
+ int fd;
+ int res;
+ struct stat st;
+ char pathbuf[MAXPATHLEN];
+
+ bzero(pmp, sizeof (proc_map_t));
+ pmp->pr_nmap = -1;
+
+ (void) snprintf(pathbuf, sizeof (pathbuf), "%s/%d/xmap", zoneproc, pid);
+ if ((fd = open(pathbuf, O_RDONLY, 0)) < 0)
+ return (NULL);
+
+redo:
+ errno = 0;
+ if (fstat(fd, &st) != 0)
+ goto done;
+
+ if ((pmp->pr_xmapp = malloc(st.st_size)) == NULL) {
+ debug("cannot malloc() %ld bytes for xmap", st.st_size);
+ goto done;
+ }
+ (void) bzero(pmp->pr_xmapp, st.st_size);
+
+ errno = 0;
+ if ((res = read(fd, pmp->pr_xmapp, st.st_size)) != st.st_size) {
+ free(pmp->pr_xmapp);
+ pmp->pr_xmapp = NULL;
+ if (res > 0 || errno == E2BIG) {
+ goto redo;
+ } else {
+ debug("pid %ld cannot read xmap\n", pid);
+ goto done;
+ }
+ }
+
+ pmp->pr_nmap = st.st_size / sizeof (prxmap_t);
+done:
+ (void) close(fd);
+ return (nextmapping(pmp));
+}
+
+/*
+ * Attempt to page out a region of the given process's address space. May
+ * return nonzero if not all of the pages may are pageable, for any reason.
+ */
+static int
+pageout_mapping(struct ps_prochandle *Pr, prxmap_t *pmp)
+{
+ int res;
+
+ /*
+ * We particularly want to avoid the pr_memcntl on anonymous mappings
+ * which show 0 since that will pull them back off of the free list
+ * and increase the zone's RSS, even though the process itself has
+ * them freed up.
+ */
+ if (pmp->pr_mflags & MA_ANON && pmp->pr_anon == 0)
+ return (0);
+ else if (pmp->pr_mflags & MA_ISM || pmp->pr_mflags & MA_SHM)
+ return (0);
+
+ errno = 0;
+ res = pr_memcntl(Pr, (caddr_t)pmp->pr_vaddr, pmp->pr_size, MC_SYNC,
+ (caddr_t)(MS_ASYNC | MS_INVALCURPROC), 0, 0);
+
+ /*
+ * EBUSY indicates none of the pages have backing store allocated, or
+ * some pages were locked. Don't care about this.
+ */
+ if (res != 0 && errno == EBUSY)
+ res = 0;
+
+ return (res);
+}
+
+/*
+ * Compute the delta of the process RSS since the last call. If the
+ * psinfo cannot be obtained, no error is returned; its up to the caller to
+ * detect the process termination via other means.
+ */
+static int64_t
+rss_delta(int64_t *old_rss, int psfd)
+{
+ int64_t d_rss = 0;
+ psinfo_t psinfo;
+
+ if (pread(psfd, &psinfo, sizeof (psinfo_t), 0) == sizeof (psinfo_t)) {
+ d_rss = (int64_t)psinfo.pr_rssize - *old_rss;
+ *old_rss = (int64_t)psinfo.pr_rssize;
+ }
+
+ return (d_rss);
+}
+
+
+/*
+ * Work through a process paging out mappings until the whole address space was
+ * examined or the excess is < 0. Return our estimate of the updated excess.
+ */
+static int64_t
+pageout_process(pid_t pid, int64_t excess)
+{
+ int psfd;
+ prxmap_t *pxmap;
+ proc_map_t cur;
+ struct ps_prochandle *ph = NULL;
+ int unpageable_mappings;
+ int64_t sum_d_rss, sum_att, d_rss;
+ int64_t old_rss;
+ psinfo_t psinfo;
+ int incr_rss_check = 0;
+ char pathbuf[MAXPATHLEN];
+
+ (void) snprintf(pathbuf, sizeof (pathbuf), "%s/%d/psinfo", zoneproc,
+ pid);
+ if ((psfd = open(pathbuf, O_RDONLY, 0000)) < 0)
+ return (excess);
+
+ cur.pr_xmapp = NULL;
+
+ if (pread(psfd, &psinfo, sizeof (psinfo), 0) != sizeof (psinfo))
+ goto done;
+
+ old_rss = (int64_t)psinfo.pr_rssize;
+
+ /* If unscannable, skip it. */
+ if (psinfo.pr_nlwp == 0 || proc_issystem(pid)) {
+ debug("pid: %ld system process, skipping %s\n",
+ pid, psinfo.pr_psargs);
+ goto done;
+ }
+
+ /* If tiny RSS (16KB), skip it. */
+ if (old_rss <= 16) {
+ debug("pid: %ld skipping, RSS %lldKB %s\n",
+ pid, old_rss, psinfo.pr_psargs);
+ goto done;
+ }
+
+ /* Get segment residency information. */
+ pxmap = init_map(&cur, pid);
+
+ /* Skip process if it has no mappings. */
+ if (pxmap == NULL) {
+ debug("%ld: xmap unreadable; ignoring\n", pid);
+ goto done;
+ }
+
+ debug("pid %ld: nmap %d sz %dKB rss %lldKB %s\n",
+ pid, cur.pr_nmap, psinfo.pr_size, old_rss, psinfo.pr_psargs);
+
+ /* Take control of the process. */
+ if ((ph = control_proc(pid)) == NULL) {
+ debug("%ld: cannot control\n", pid);
+ goto done;
+ }
+
+ /*
+ * If the process RSS is not enough to erase the excess then no need
+ * to incrementally check the RSS delta after each pageout attempt.
+ * Instead check it after we've tried all of the segements.
+ */
+ if (excess - old_rss < 0)
+ incr_rss_check = 1;
+
+ /*
+ * Within the process's address space, attempt to page out mappings.
+ */
+ sum_att = sum_d_rss = 0;
+ unpageable_mappings = 0;
+ while (excess > 0 && pxmap != NULL && !shutting_down) {
+ /* Try to page out the mapping. */
+ if (pageout_mapping(ph, pxmap) < 0) {
+ debug("pid %ld: exited or unpageable\n", pid);
+ break;
+ }
+
+ /* attempted is the size of the mapping */
+ sum_att += pxmap->pr_size / 1024;
+
+ /*
+ * This processes RSS is potentially enough to clear the
+ * excess so check as we go along to see if we can stop
+ * paging out partway through the process.
+ */
+ if (incr_rss_check) {
+ d_rss = rss_delta(&old_rss, psfd);
+
+ /*
+ * If this pageout attempt was unsuccessful (the
+ * resident portion was not affected), then note it was
+ * unpageable. Mappings are unpageable when none of the
+ * pages paged out, such as when they are locked, or
+ * involved in asynchronous I/O.
+ */
+ if (d_rss >= 0) {
+ unpageable_mappings++;
+ } else {
+ excess += d_rss;
+ sum_d_rss += d_rss;
+ }
+ }
+
+ pxmap = nextmapping(&cur);
+ }
+
+ if (!incr_rss_check) {
+ d_rss = rss_delta(&old_rss, psfd);
+ if (d_rss < 0) {
+ excess += d_rss;
+ sum_d_rss += d_rss;
+ }
+ }
+
+ debug("pid %ld: unp %d att %lluKB drss %lldKB excess %lldKB\n",
+ pid, unpageable_mappings, (unsigned long long)sum_att,
+ (unsigned long long)sum_d_rss, (long long)excess);
+
+done:
+ /* If a process was grabbed, release it, destroying its agent. */
+ if (ph != NULL) {
+ Pdestroy_agent(ph);
+ (void) Prelease(ph, 0);
+ }
+
+ if (cur.pr_xmapp != NULL)
+ free(cur.pr_xmapp);
+
+ (void) close(psfd);
+
+ if (shutting_down)
+ return (0);
+
+ return (excess);
+}
+
+/*
+ * Get the zone's RSS data.
+ */
+static uint64_t
+get_mem_info(int age)
+{
+ uint64_t n = 1;
+ zsd_vmusage64_t buf;
+ uint64_t zone_rss;
+ DIR *pdir = NULL;
+ struct dirent *dent;
+
+ /*
+ * Start by doing the fast, cheap RSS calculation using the rss value
+ * in psinfo_t. Because that's per-process, it can lead to double
+ * counting some memory and overestimating how much is being used, but
+ * as long as that's not over the cap, then we don't need do the
+ * expensive calculation.
+ */
+ if (shutting_down)
+ return (0);
+
+ if ((pdir = opendir(zoneproc)) == NULL)
+ return (0);
+
+ zone_rss = 0;
+ while (!shutting_down && (dent = readdir(pdir)) != NULL) {
+ pid_t pid;
+ int psfd;
+ int64_t rss;
+ char pathbuf[MAXPATHLEN];
+ psinfo_t psinfo;
+
+ if (strcmp(".", dent->d_name) == 0 ||
+ strcmp("..", dent->d_name) == 0)
+ continue;
+
+ pid = atoi(dent->d_name);
+ if (pid == 0 || pid == 1)
+ continue;
+
+ (void) snprintf(pathbuf, sizeof (pathbuf), "%s/%d/psinfo",
+ zoneproc, pid);
+
+ rss = 0;
+ if ((psfd = open(pathbuf, O_RDONLY, 0000)) != -1) {
+ if (pread(psfd, &psinfo, sizeof (psinfo), 0) ==
+ sizeof (psinfo))
+ rss = (int64_t)psinfo.pr_rssize;
+
+ (void) close(psfd);
+ }
+
+ zone_rss += rss;
+ }
+
+ (void) closedir(pdir);
+
+ if (shutting_down)
+ return (0);
+
+ debug("fast rss %lluKB\n", zone_rss);
+ if (zone_rss <= zone_rss_cap || skip_vmusage) {
+ uint64_t zone_rss_bytes;
+
+ zone_rss_bytes = zone_rss * 1024;
+ /* Use the zone's approx. RSS in the kernel */
+ (void) zone_setattr(zid, ZONE_ATTR_RSS, &zone_rss_bytes, 0);
+ return (zone_rss);
+ }
+
+ buf.vmu_id = zid;
+
+ if (syscall(SYS_rusagesys, _RUSAGESYS_GETVMUSAGE, VMUSAGE_A_ZONE,
+ age, (uintptr_t)&buf, (uintptr_t)&n) != 0) {
+ debug("vmusage failed\n");
+ (void) sleep_shutdown(1);
+ return (0);
+ }
+
+ if (n > 1) {
+ /* This should never happen */
+ debug("vmusage returned more than one result\n");
+ (void) sleep_shutdown(1);
+ return (0);
+ }
+
+ if (buf.vmu_id != zid) {
+ /* This should never happen */
+ debug("vmusage returned the incorrect zone\n");
+ (void) sleep_shutdown(1);
+ return (0);
+ }
+
+ zone_rss = buf.vmu_rss_all / 1024;
+ return (zone_rss);
+}
+
+/*
+ * Needed to read the zones physical-memory-cap rctl.
+ */
+static struct ps_prochandle *
+grab_zone_proc()
+{
+ DIR *dirp;
+ struct dirent *dentp;
+ struct ps_prochandle *ph = NULL;
+ int tmp;
+
+ if ((dirp = opendir(zoneproc)) == NULL)
+ return (NULL);
+
+ while (!shutting_down && (dentp = readdir(dirp))) {
+ int pid;
+
+ if (strcmp(".", dentp->d_name) == 0 ||
+ strcmp("..", dentp->d_name) == 0)
+ continue;
+
+ pid = atoi(dentp->d_name);
+ /* attempt to grab process */
+ if ((ph = Pgrab(pid, 0, &tmp)) != NULL) {
+ if (Psetflags(ph, PR_RLC) == 0) {
+ if (Pcreate_agent(ph) == 0) {
+ (void) closedir(dirp);
+ return (ph);
+ }
+ }
+ Prelease(ph, 0);
+ }
+ }
+
+ (void) closedir(dirp);
+ return (NULL);
+}
+
+static uint64_t
+get_zone_cap()
+{
+ rctlblk_t *rblk;
+ uint64_t mcap;
+ struct ps_prochandle *ph;
+
+ if ((rblk = (rctlblk_t *)malloc(rctlblk_size())) == NULL)
+ return (UINT64_MAX);
+
+ if ((ph = grab_zone_proc()) == NULL) {
+ free(rblk);
+ return (UINT64_MAX);
+ }
+
+ if (pr_getrctl(ph, "zone.max-physical-memory", NULL, rblk,
+ RCTL_FIRST)) {
+ Pdestroy_agent(ph);
+ Prelease(ph, 0);
+ free(rblk);
+ return (UINT64_MAX);
+ }
+
+ Pdestroy_agent(ph);
+ Prelease(ph, 0);
+
+ mcap = rctlblk_get_value(rblk);
+ free(rblk);
+ return (mcap);
+}
+
+/*
+ * check_suspend is invoked at the beginning of every pass through the process
+ * list or after we've paged out enough so that we think the excess is under
+ * the cap. The purpose is to periodically check the zone's rss and return
+ * the excess when the zone is over the cap. The rest of the time this
+ * function will sleep, periodically waking up to check the current rss.
+ *
+ * The age parameter is used to tell us how old the cached rss data can be.
+ * When first starting up, the cached data can be older, but after we
+ * start paging out, we want current data.
+ *
+ * Depending on the percentage of penetration of the zone's rss into the
+ * cap we sleep for longer or shorter amounts and accept older cached
+ * vmusage data. This reduces the impact of this work on the system, which
+ * is important considering that each zone will be monitoring its rss.
+ */
+static int64_t
+check_suspend(int age, boolean_t new_cycle)
+{
+ static hrtime_t last_cap_read = 0;
+ static uint64_t addon;
+ static uint64_t lo_thresh; /* Thresholds for how long to sleep */
+ static uint64_t hi_thresh; /* when under the cap (80% & 90%). */
+ static uint64_t prev_zone_rss = 0;
+ static uint32_t pfdelay = 0; /* usec page fault delay when over */
+
+ /* Wait a second to give the async pageout a chance to catch up. */
+ (void) sleep_shutdown(1);
+
+ while (!shutting_down) {
+ int64_t new_excess;
+ int sleep_time;
+ hrtime_t now;
+ struct stat st;
+ uint64_t zone_rss; /* total RSS(KB) */
+
+ /*
+ * Check if the debug log files exists and enable or disable
+ * debug.
+ */
+ if (debug_log_fp == NULL) {
+ if (stat(debug_log, &st) == 0)
+ debug_log_fp = fopen(debug_log, "w");
+ } else {
+ if (stat(debug_log, &st) == -1) {
+ (void) fclose(debug_log_fp);
+ debug_log_fp = NULL;
+ }
+ }
+
+ /*
+ * If the CAP_REFRESH interval has passed, re-get the current
+ * cap in case it has been dynamically updated.
+ */
+ now = gethrtime();
+ if (now - last_cap_read > CAP_REFRESH) {
+ uint64_t mcap;
+
+ last_cap_read = now;
+
+ mcap = get_zone_cap();
+ if (mcap != 0 && mcap != UINT64_MAX)
+ zone_rss_cap = ROUNDUP(mcap, 1024) / 1024;
+ else
+ zone_rss_cap = UINT64_MAX;
+
+ lo_thresh = (uint64_t)(zone_rss_cap * .8);
+ hi_thresh = (uint64_t)(zone_rss_cap * .9);
+ addon = (uint64_t)(zone_rss_cap * 0.05);
+
+ debug("%s: %s\n", TUNE_CMD, over_cmd);
+ debug("%s: %d\n", TUNE_NVMU, skip_vmusage);
+ debug("%s: %d\n", TUNE_NPAGE, skip_pageout);
+ debug("current cap %lluKB lo %lluKB hi %lluKB\n",
+ zone_rss_cap, lo_thresh, hi_thresh);
+ }
+
+ /* No cap, nothing to do. */
+ if (zone_rss_cap == 0 || zone_rss_cap == UINT64_MAX) {
+ debug("no cap, sleep 120 seconds\n");
+ (void) sleep_shutdown(120);
+ continue;
+ }
+
+ zone_rss = get_mem_info(age);
+
+ /* calculate excess */
+ new_excess = zone_rss - zone_rss_cap;
+
+ debug("rss %lluKB, cap %lluKB, excess %lldKB\n",
+ zone_rss, zone_rss_cap, new_excess);
+
+ /*
+ * If necessary, updates stats.
+ */
+
+ /*
+ * If it looks like we did some paging out since last over the
+ * cap then update the kstat so we can approximate how much was
+ * paged out.
+ */
+ if (prev_zone_rss > zone_rss_cap && zone_rss < prev_zone_rss) {
+ uint64_t diff;
+
+ /* assume diff is num bytes we paged out */
+ diff = (prev_zone_rss - zone_rss) * 1024;
+
+ (void) zone_setattr(zid, ZONE_ATTR_PMCAP_PAGEOUT,
+ &diff, 0);
+ }
+ prev_zone_rss = zone_rss;
+
+ if (new_excess > 0) {
+ if (new_cycle) {
+ uint64_t n = 1;
+
+ /* Increment "nover" kstat. */
+ (void) zone_setattr(zid, ZONE_ATTR_PMCAP_NOVER,
+ &n, 0);
+ }
+
+ if (!skip_pageout) {
+ /*
+ * Tell the kernel to start throttling page
+ * faults by some number of usecs to help us
+ * catch up. If we are persistently over the
+ * cap the delay ramps up to a max of 2000usecs.
+ * Note that for delays less than 1 tick
+ * (i.e. all of these) we busy-wait in as_fault.
+ * delay faults/sec
+ * 125 8000
+ * 250 4000
+ * 500 2000
+ * 1000 1000
+ * 2000 500
+ */
+ if (pfdelay == 0)
+ pfdelay = 125;
+ else if (pfdelay < 2000)
+ pfdelay *= 2;
+
+ (void) zone_setattr(zid, ZONE_ATTR_PG_FLT_DELAY,
+ &pfdelay, 0);
+ }
+
+ /*
+ * Once we go over the cap, then we want to
+ * page out a little extra instead of stopping
+ * right at the cap. To do this we add 5% to
+ * the excess so that pageout_proces will work
+ * a little longer before stopping.
+ */
+ return ((int64_t)(new_excess + addon));
+ }
+
+ /*
+ * At this point we are under the cap.
+ *
+ * Tell the kernel to stop throttling page faults.
+ *
+ * Scale the amount of time we sleep before rechecking the
+ * zone's memory usage. Also, scale the accpetable age of
+ * cached results from vm_getusage. We do this based on the
+ * penetration into the capped limit.
+ */
+ if (pfdelay > 0) {
+ pfdelay = 0;
+ (void) zone_setattr(zid, ZONE_ATTR_PG_FLT_DELAY,
+ &pfdelay, 0);
+ }
+
+ if (zone_rss <= lo_thresh) {
+ sleep_time = 120;
+ age = 15;
+ } else if (zone_rss <= hi_thresh) {
+ sleep_time = 60;
+ age = 10;
+ } else {
+ sleep_time = 30;
+ age = 5;
+ }
+
+ debug("sleep %d seconds\n", sleep_time);
+ (void) sleep_shutdown(sleep_time);
+ }
+
+ /* Shutting down, tell the kernel so it doesn't throttle */
+ if (pfdelay > 0) {
+ pfdelay = 0;
+ (void) zone_setattr(zid, ZONE_ATTR_PG_FLT_DELAY, &pfdelay, 0);
+ }
+
+ return (0);
+}
+
+static void
+get_mcap_tunables()
+{
+ zone_dochandle_t handle;
+ struct zone_attrtab attr;
+
+ over_cmd[0] = '\0';
+ if ((handle = zonecfg_init_handle()) == NULL)
+ return;
+
+ if (zonecfg_get_handle(zonename, handle) != Z_OK)
+ goto done;
+
+ /* Reset to defaults in case rebooting and settings have changed */
+ over_cmd[0] = '\0';
+ skip_vmusage = B_FALSE;
+ skip_pageout = B_FALSE;
+
+ if (zonecfg_setattrent(handle) != Z_OK)
+ goto done;
+ while (zonecfg_getattrent(handle, &attr) == Z_OK) {
+ if (strcmp(TUNE_CMD, attr.zone_attr_name) == 0) {
+ (void) strlcpy(over_cmd, attr.zone_attr_value,
+ sizeof (over_cmd));
+ } else if (strcmp(TUNE_NVMU, attr.zone_attr_name) == 0) {
+ if (strcmp("true", attr.zone_attr_value) == 0)
+ skip_vmusage = B_TRUE;
+ } else if (strcmp(TUNE_NPAGE, attr.zone_attr_name) == 0) {
+ if (strcmp("true", attr.zone_attr_value) == 0)
+ skip_pageout = B_TRUE;
+ }
+ }
+ (void) zonecfg_endattrent(handle);
+
+done:
+ zonecfg_fini_handle(handle);
+}
+
+/*
+ * Thread that checks zone's memory usage and when over the cap, goes through
+ * the zone's process list trying to pageout processes to get under the cap.
+ */
+static void
+mcap_zone()
+{
+ DIR *pdir = NULL;
+ int age = 10; /* initial cached vmusage can be 10 secs. old */
+ int64_t excess;
+
+ debug("thread startup\n");
+
+ get_mcap_tunables();
+
+ /*
+ * When first starting it is likely lots of other zones are starting
+ * too because the system is booting. Since we just started the zone
+ * we're not worried about being over the cap right away, so we let
+ * things settle a bit and tolerate some older data here to minimize
+ * the load on the system.
+ */
+ (void) sleep_shutdown(15); /* wait 15 secs. so the zone can get going */
+
+ /* Wait until zone's /proc is mounted */
+ while (!shutting_down) {
+ struct stat st;
+
+ if (stat(zoneproc, &st) == 0 &&
+ strcmp(st.st_fstype, "proc") == 0)
+ break;
+ sleep_shutdown(5);
+ }
+
+ /* Open zone's /proc and walk entries. */
+ while (!shutting_down) {
+ if ((pdir = opendir(zoneproc)) != NULL)
+ break;
+ sleep_shutdown(5);
+ }
+
+ while (!shutting_down) {
+ struct dirent *dirent;
+
+ /* Wait until we've gone over the cap. */
+ excess = check_suspend(age, B_TRUE);
+
+ debug("starting to scan, excess %lldk\n", (long long)excess);
+
+ /*
+ * After the initial startup, we want the age of the cached
+ * vmusage to be only 1 second old since we are checking
+ * the current state after we've gone over the cap and have
+ * paged out some processes.
+ */
+ age = 1;
+
+ if (over_cmd[0] != '\0') {
+ uint64_t zone_rss; /* total RSS(KB) */
+
+ debug("run phys_mcap_cmd: %s\n", over_cmd);
+ run_over_cmd();
+
+ zone_rss = get_mem_info(0);
+ excess = zone_rss - zone_rss_cap;
+ debug("rss %lluKB, cap %lluKB, excess %lldKB\n",
+ zone_rss, zone_rss_cap, excess);
+ if (excess <= 0)
+ continue;
+ }
+
+ while (!shutting_down && (dirent = readdir(pdir)) != NULL) {
+ pid_t pid;
+
+ if (strcmp(".", dirent->d_name) == 0 ||
+ strcmp("..", dirent->d_name) == 0)
+ continue;
+
+ pid = atoi(dirent->d_name);
+ if (pid == 0 || pid == 1)
+ continue;
+
+ if (skip_pageout)
+ (void) sleep_shutdown(2);
+ else
+ excess = pageout_process(pid, excess);
+
+ if (excess <= 0) {
+ debug("apparently under; excess %lld\n",
+ (long long)excess);
+ /* Double check the current excess */
+ excess = check_suspend(1, B_FALSE);
+ }
+ }
+
+ debug("process pass done; excess %lld\n", (long long)excess);
+ rewinddir(pdir);
+ }
+
+ if (pdir != NULL)
+ (void) closedir(pdir);
+ debug("thread shutdown\n");
+}
+
+void
+create_mcap_thread(zlog_t *zlogp, zoneid_t id)
+{
+ int res;
+
+ shutting_down = 0;
+ zid = id;
+ (void) getzonenamebyid(zid, zonename, sizeof (zonename));
+
+ if (zone_get_zonepath(zonename, zonepath, sizeof (zonepath)) != 0)
+ zerror(zlogp, B_FALSE, "zone %s missing zonepath", zonename);
+ (void) snprintf(zoneproc, sizeof (zoneproc), "%s/root/proc", zonepath);
+ (void) snprintf(debug_log, sizeof (debug_log), "%s/mcap_debug.log",
+ zonepath);
+
+ res = thr_create(NULL, NULL, (void *(*)(void *))mcap_zone, NULL, NULL,
+ &mcap_tid);
+ if (res != 0) {
+ zerror(zlogp, B_FALSE, "error %d creating memory cap thread",
+ res);
+ mcap_tid = 0;
+ }
+}
+
+void
+destroy_mcap_thread()
+{
+ if (mcap_tid != 0) {
+ shutting_down = 1;
+ (void) cond_signal(&shutdown_cv);
+ (void) thr_join(mcap_tid, NULL, NULL);
+ mcap_tid = 0;
+ }
+}
diff --git a/usr/src/cmd/zoneadmd/vplat.c b/usr/src/cmd/zoneadmd/vplat.c
index df81c54c96..415920acb4 100644
--- a/usr/src/cmd/zoneadmd/vplat.c
+++ b/usr/src/cmd/zoneadmd/vplat.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent Inc. All rights reserved.
*/
/*
@@ -136,6 +137,9 @@
#define ALT_MOUNT(mount_cmd) ((mount_cmd) != Z_MNT_BOOT)
+/* Number of times to retry unmounting if it fails */
+#define UMOUNT_RETRIES 30
+
/* a reasonable estimate for the number of lwps per process */
#define LWPS_PER_PROCESS 10
@@ -162,6 +166,7 @@ extern int getnetmaskbyaddr(struct in_addr, struct in_addr *);
/* from zoneadmd */
extern char query_hook[];
+extern char post_statechg_hook[];
/*
* For each "net" resource configured in zonecfg, we track a zone_addr_list_t
@@ -198,7 +203,7 @@ autofs_cleanup(zoneid_t zoneid)
/*
* Ask autofs to unmount all trigger nodes in the given zone.
*/
- return (_autofssys(AUTOFS_UNMOUNTALL, (void *)zoneid));
+ return (_autofssys(AUTOFS_UNMOUNTALL, (void *)((uintptr_t)zoneid)));
}
static void
@@ -589,6 +594,24 @@ root_to_lu(zlog_t *zlogp, char *zroot, size_t zrootlen, boolean_t isresolved)
}
/*
+ * Perform brand-specific cleanup if we are unable to unmount a FS.
+ */
+static void
+brand_umount_cleanup(zlog_t *zlogp, char *path)
+{
+ char cmdbuf[2 * MAXPATHLEN];
+
+ if (post_statechg_hook[0] == '\0')
+ return;
+
+ if (snprintf(cmdbuf, sizeof (cmdbuf), "%s %d %d %s", post_statechg_hook,
+ ZONE_STATE_DOWN, Z_UNMOUNT, path) > sizeof (cmdbuf))
+ return;
+
+ (void) do_subproc(zlogp, cmdbuf, NULL, B_FALSE);
+}
+
+/*
* The general strategy for unmounting filesystems is as follows:
*
* - Remote filesystems may be dead, and attempting to contact them as
@@ -621,6 +644,7 @@ static int
unmount_filesystems(zlog_t *zlogp, zoneid_t zoneid, boolean_t unmount_cmd)
{
int error = 0;
+ int fail = 0;
FILE *mnttab;
struct mnttab *mnts;
uint_t nmnt;
@@ -708,18 +732,39 @@ unmount_filesystems(zlog_t *zlogp, zoneid_t zoneid, boolean_t unmount_cmd)
if (umount2(path, MS_FORCE) == 0) {
unmounted = B_TRUE;
stuck = B_FALSE;
+ fail = 0;
} else {
/*
- * The first failure indicates a
- * mount we won't be able to get
- * rid of automatically, so we
- * bail.
+ * We may hit a failure here if there
+ * is an app in the GZ with an open
+ * pipe into the zone (commonly into
+ * the zone's /var/run). This type
+ * of app will notice the closed
+ * connection and cleanup, but it may
+ * take a while and we have no easy
+ * way to notice that. To deal with
+ * this case, we will wait and retry
+ * a few times before we give up.
*/
- error++;
- zerror(zlogp, B_FALSE,
- "unable to unmount '%s'", path);
- free_mnttable(mnts, nmnt);
- goto out;
+ fail++;
+ if (fail < (UMOUNT_RETRIES - 1)) {
+ zerror(zlogp, B_FALSE,
+ "unable to unmount '%s', "
+ "retrying in 2 seconds",
+ path);
+ (void) sleep(2);
+ } else if (fail > UMOUNT_RETRIES) {
+ error++;
+ zerror(zlogp, B_FALSE,
+ "unmount of '%s' failed",
+ path);
+ free_mnttable(mnts, nmnt);
+ goto out;
+ } else {
+ /* Try the hook 2 times */
+ brand_umount_cleanup(zlogp,
+ path);
+ }
}
}
/*
@@ -1057,23 +1102,10 @@ mount_one_dev_symlink_cb(void *arg, const char *source, const char *target)
int
vplat_get_iptype(zlog_t *zlogp, zone_iptype_t *iptypep)
{
- zone_dochandle_t handle;
-
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (-1);
- }
- if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
- return (-1);
- }
- if (zonecfg_get_iptype(handle, iptypep) != Z_OK) {
+ if (zonecfg_get_iptype(snap_hndl, iptypep) != Z_OK) {
zerror(zlogp, B_FALSE, "invalid ip-type configuration");
- zonecfg_fini_handle(handle);
return (-1);
}
- zonecfg_fini_handle(handle);
return (0);
}
@@ -1086,14 +1118,13 @@ static int
mount_one_dev(zlog_t *zlogp, char *devpath, zone_mnt_t mount_cmd)
{
char brand[MAXNAMELEN];
- zone_dochandle_t handle = NULL;
brand_handle_t bh = NULL;
struct zone_devtab ztab;
di_prof_t prof = NULL;
int err;
int retval = -1;
zone_iptype_t iptype;
- const char *curr_iptype;
+ const char *curr_iptype = NULL;
if (di_prof_init(devpath, &prof)) {
zerror(zlogp, B_TRUE, "failed to initialize profile");
@@ -1128,6 +1159,8 @@ mount_one_dev(zlog_t *zlogp, char *devpath, zone_mnt_t mount_cmd)
curr_iptype = "exclusive";
break;
}
+ if (curr_iptype == NULL)
+ abort();
if (brand_platform_iter_devices(bh, zone_name,
mount_one_dev_device_cb, prof, curr_iptype) != 0) {
@@ -1142,28 +1175,19 @@ mount_one_dev(zlog_t *zlogp, char *devpath, zone_mnt_t mount_cmd)
}
/* Add user-specified devices and directories */
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_FALSE, "can't initialize zone handle");
- goto cleanup;
- }
- if (err = zonecfg_get_handle(zone_name, handle)) {
- zerror(zlogp, B_FALSE, "can't get handle for zone "
- "%s: %s", zone_name, zonecfg_strerror(err));
- goto cleanup;
- }
- if (err = zonecfg_setdevent(handle)) {
+ if ((err = zonecfg_setdevent(snap_hndl)) != 0) {
zerror(zlogp, B_FALSE, "%s: %s", zone_name,
zonecfg_strerror(err));
goto cleanup;
}
- while (zonecfg_getdevent(handle, &ztab) == Z_OK) {
+ while (zonecfg_getdevent(snap_hndl, &ztab) == Z_OK) {
if (di_prof_add_dev(prof, ztab.zone_dev_match)) {
zerror(zlogp, B_TRUE, "failed to add "
"user-specified device");
goto cleanup;
}
}
- (void) zonecfg_enddevent(handle);
+ (void) zonecfg_enddevent(snap_hndl);
/* Send profile to kernel */
if (di_prof_commit(prof)) {
@@ -1176,8 +1200,6 @@ mount_one_dev(zlog_t *zlogp, char *devpath, zone_mnt_t mount_cmd)
cleanup:
if (bh != NULL)
brand_close(bh);
- if (handle != NULL)
- zonecfg_fini_handle(handle);
if (prof)
di_prof_fini(prof);
return (retval);
@@ -1672,7 +1694,6 @@ mount_filesystems(zlog_t *zlogp, zone_mnt_t mount_cmd)
char luroot[MAXPATHLEN];
int i, num_fs = 0;
struct zone_fstab *fs_ptr = NULL;
- zone_dochandle_t handle = NULL;
zone_state_t zstate;
brand_handle_t bh;
plat_gmount_cb_data_t cb;
@@ -1696,12 +1717,7 @@ mount_filesystems(zlog_t *zlogp, zone_mnt_t mount_cmd)
goto bad;
}
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- goto bad;
- }
- if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK ||
- zonecfg_setfsent(handle) != Z_OK) {
+ if (zonecfg_setfsent(snap_hndl) != Z_OK) {
zerror(zlogp, B_FALSE, "invalid configuration");
goto bad;
}
@@ -1719,7 +1735,6 @@ mount_filesystems(zlog_t *zlogp, zone_mnt_t mount_cmd)
/* Get a handle to the brand info for this zone */
if ((bh = brand_open(brand)) == NULL) {
zerror(zlogp, B_FALSE, "unable to determine zone brand");
- zonecfg_fini_handle(handle);
return (-1);
}
@@ -1734,7 +1749,6 @@ mount_filesystems(zlog_t *zlogp, zone_mnt_t mount_cmd)
plat_gmount_cb, &cb) != 0) {
zerror(zlogp, B_FALSE, "unable to mount filesystems");
brand_close(bh);
- zonecfg_fini_handle(handle);
return (-1);
}
brand_close(bh);
@@ -1745,13 +1759,10 @@ mount_filesystems(zlog_t *zlogp, zone_mnt_t mount_cmd)
* higher level directories (e.g., /usr) get mounted before
* any beneath them (e.g., /usr/local).
*/
- if (mount_filesystems_fsent(handle, zlogp, &fs_ptr, &num_fs,
+ if (mount_filesystems_fsent(snap_hndl, zlogp, &fs_ptr, &num_fs,
mount_cmd) != 0)
goto bad;
- zonecfg_fini_handle(handle);
- handle = NULL;
-
/*
* Normally when we mount a zone all the zone filesystems
* get mounted relative to rootpath, which is usually
@@ -1830,8 +1841,6 @@ mount_filesystems(zlog_t *zlogp, zone_mnt_t mount_cmd)
return (0);
bad:
- if (handle != NULL)
- zonecfg_fini_handle(handle);
free_fs_data(fs_ptr, num_fs);
return (-1);
}
@@ -2187,13 +2196,7 @@ configure_one_interface(zlog_t *zlogp, zoneid_t zone_id,
if (ioctl(s, SIOCLIFADDIF, (caddr_t)&lifr) < 0) {
/*
* Here, we know that the interface can't be brought up.
- * A similar warning message was already printed out to
- * the console by zoneadm(1M) so instead we log the
- * message to syslog and continue.
*/
- zerror(&logsys, B_TRUE, "WARNING: skipping network interface "
- "'%s' which may not be present/plumbed in the "
- "global zone.", lifr.lifr_name);
(void) close(s);
return (Z_OK);
}
@@ -2406,7 +2409,6 @@ bad:
static int
configure_shared_network_interfaces(zlog_t *zlogp)
{
- zone_dochandle_t handle;
struct zone_nwiftab nwiftab, loopback_iftab;
zoneid_t zoneid;
@@ -2415,29 +2417,19 @@ configure_shared_network_interfaces(zlog_t *zlogp)
return (-1);
}
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (-1);
- }
- if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
- return (-1);
- }
- if (zonecfg_setnwifent(handle) == Z_OK) {
+ if (zonecfg_setnwifent(snap_hndl) == Z_OK) {
for (;;) {
- if (zonecfg_getnwifent(handle, &nwiftab) != Z_OK)
+ if (zonecfg_getnwifent(snap_hndl, &nwiftab) != Z_OK)
break;
+ nwifent_free_attrs(&nwiftab);
if (configure_one_interface(zlogp, zoneid, &nwiftab) !=
Z_OK) {
- (void) zonecfg_endnwifent(handle);
- zonecfg_fini_handle(handle);
+ (void) zonecfg_endnwifent(snap_hndl);
return (-1);
}
}
- (void) zonecfg_endnwifent(handle);
+ (void) zonecfg_endnwifent(snap_hndl);
}
- zonecfg_fini_handle(handle);
if (is_system_labeled()) {
/*
* Labeled zones share the loopback interface
@@ -2891,7 +2883,6 @@ free_ip_interface(zone_addr_list_t *zalist)
static int
configure_exclusive_network_interfaces(zlog_t *zlogp, zoneid_t zoneid)
{
- zone_dochandle_t handle;
struct zone_nwiftab nwiftab;
char rootpath[MAXPATHLEN];
char path[MAXPATHLEN];
@@ -2900,30 +2891,18 @@ configure_exclusive_network_interfaces(zlog_t *zlogp, zoneid_t zoneid)
boolean_t added = B_FALSE;
zone_addr_list_t *zalist = NULL, *new;
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (-1);
- }
- if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
- return (-1);
- }
-
- if (zonecfg_setnwifent(handle) != Z_OK) {
- zonecfg_fini_handle(handle);
+ if (zonecfg_setnwifent(snap_hndl) != Z_OK)
return (0);
- }
for (;;) {
- if (zonecfg_getnwifent(handle, &nwiftab) != Z_OK)
+ if (zonecfg_getnwifent(snap_hndl, &nwiftab) != Z_OK)
break;
+ nwifent_free_attrs(&nwiftab);
if (prof == NULL) {
if (zone_get_devroot(zone_name, rootpath,
sizeof (rootpath)) != Z_OK) {
- (void) zonecfg_endnwifent(handle);
- zonecfg_fini_handle(handle);
+ (void) zonecfg_endnwifent(snap_hndl);
zerror(zlogp, B_TRUE,
"unable to determine dev root");
return (-1);
@@ -2931,8 +2910,7 @@ configure_exclusive_network_interfaces(zlog_t *zlogp, zoneid_t zoneid)
(void) snprintf(path, sizeof (path), "%s%s", rootpath,
"/dev");
if (di_prof_init(path, &prof) != 0) {
- (void) zonecfg_endnwifent(handle);
- zonecfg_fini_handle(handle);
+ (void) zonecfg_endnwifent(snap_hndl);
zerror(zlogp, B_TRUE,
"failed to initialize profile");
return (-1);
@@ -2956,17 +2934,17 @@ configure_exclusive_network_interfaces(zlog_t *zlogp, zoneid_t zoneid)
nwiftab.zone_nwif_physical) == 0) {
added = B_TRUE;
} else {
- (void) zonecfg_endnwifent(handle);
- zonecfg_fini_handle(handle);
- zerror(zlogp, B_TRUE, "failed to add network device");
- return (-1);
+ /*
+ * Failed to add network device, but the brand hook
+ * might be doing this for us, so keep silent.
+ */
+ continue;
}
/* set up the new IP interface, and add them all later */
new = malloc(sizeof (*new));
if (new == NULL) {
zerror(zlogp, B_TRUE, "no memory for %s",
nwiftab.zone_nwif_physical);
- zonecfg_fini_handle(handle);
free_ip_interface(zalist);
}
bzero(new, sizeof (*new));
@@ -2976,16 +2954,14 @@ configure_exclusive_network_interfaces(zlog_t *zlogp, zoneid_t zoneid)
}
if (zalist != NULL) {
if ((errno = add_net(zlogp, zoneid, zalist)) != 0) {
- (void) zonecfg_endnwifent(handle);
- zonecfg_fini_handle(handle);
+ (void) zonecfg_endnwifent(snap_hndl);
zerror(zlogp, B_TRUE, "failed to add address");
free_ip_interface(zalist);
return (-1);
}
free_ip_interface(zalist);
}
- (void) zonecfg_endnwifent(handle);
- zonecfg_fini_handle(handle);
+ (void) zonecfg_endnwifent(snap_hndl);
if (prof != NULL && added) {
if (di_prof_commit(prof) != 0) {
@@ -3121,48 +3097,23 @@ remove_datalink_protect(zlog_t *zlogp, zoneid_t zoneid)
/* datalink does not belong to the GZ */
continue;
}
- if (dlstatus != DLADM_STATUS_OK) {
+ if (dlstatus != DLADM_STATUS_OK)
zerror(zlogp, B_FALSE,
+ "clear 'protection' link property: %s",
dladm_status2str(dlstatus, dlerr));
- free(dllinks);
- return (-1);
- }
+
dlstatus = dladm_set_linkprop(dld_handle, *dllink,
"allowed-ips", NULL, 0, DLADM_OPT_ACTIVE);
- if (dlstatus != DLADM_STATUS_OK) {
+ if (dlstatus != DLADM_STATUS_OK)
zerror(zlogp, B_FALSE,
+ "clear 'allowed-ips' link property: %s",
dladm_status2str(dlstatus, dlerr));
- free(dllinks);
- return (-1);
- }
}
free(dllinks);
return (0);
}
static int
-unconfigure_exclusive_network_interfaces(zlog_t *zlogp, zoneid_t zoneid)
-{
- int dlnum = 0;
-
- /*
- * The kernel shutdown callback for the dls module should have removed
- * all datalinks from this zone. If any remain, then there's a
- * problem.
- */
- if (zone_list_datalink(zoneid, &dlnum, NULL) != 0) {
- zerror(zlogp, B_TRUE, "unable to list network interfaces");
- return (-1);
- }
- if (dlnum != 0) {
- zerror(zlogp, B_FALSE,
- "datalinks remain in zone after shutdown");
- return (-1);
- }
- return (0);
-}
-
-static int
tcp_abort_conn(zlog_t *zlogp, zoneid_t zoneid,
const struct sockaddr_storage *local, const struct sockaddr_storage *remote)
{
@@ -3244,26 +3195,14 @@ static int
get_privset(zlog_t *zlogp, priv_set_t *privs, zone_mnt_t mount_cmd)
{
int error = -1;
- zone_dochandle_t handle;
char *privname = NULL;
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (-1);
- }
- if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
- return (-1);
- }
-
if (ALT_MOUNT(mount_cmd)) {
zone_iptype_t iptype;
- const char *curr_iptype;
+ const char *curr_iptype = NULL;
- if (zonecfg_get_iptype(handle, &iptype) != Z_OK) {
+ if (zonecfg_get_iptype(snap_hndl, &iptype) != Z_OK) {
zerror(zlogp, B_TRUE, "unable to determine ip-type");
- zonecfg_fini_handle(handle);
return (-1);
}
@@ -3276,17 +3215,15 @@ get_privset(zlog_t *zlogp, priv_set_t *privs, zone_mnt_t mount_cmd)
break;
}
- if (zonecfg_default_privset(privs, curr_iptype) == Z_OK) {
- zonecfg_fini_handle(handle);
+ if (zonecfg_default_privset(privs, curr_iptype) == Z_OK)
return (0);
- }
+
zerror(zlogp, B_FALSE,
"failed to determine the zone's default privilege set");
- zonecfg_fini_handle(handle);
return (-1);
}
- switch (zonecfg_get_privset(handle, privs, &privname)) {
+ switch (zonecfg_get_privset(snap_hndl, privs, &privname)) {
case Z_OK:
error = 0;
break;
@@ -3309,7 +3246,6 @@ get_privset(zlog_t *zlogp, priv_set_t *privs, zone_mnt_t mount_cmd)
}
free(privname);
- zonecfg_fini_handle(handle);
return (error);
}
@@ -3322,7 +3258,6 @@ get_rctls(zlog_t *zlogp, char **bufp, size_t *bufsizep)
nvlist_t **nvlv = NULL;
int rctlcount = 0;
int error = -1;
- zone_dochandle_t handle;
struct zone_rctltab rctltab;
rctlblk_t *rctlblk = NULL;
uint64_t maxlwps;
@@ -3331,16 +3266,6 @@ get_rctls(zlog_t *zlogp, char **bufp, size_t *bufsizep)
*bufp = NULL;
*bufsizep = 0;
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (-1);
- }
- if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
- return (-1);
- }
-
rctltab.zone_rctl_valptr = NULL;
if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0) {
zerror(zlogp, B_TRUE, "%s failed", "nvlist_alloc");
@@ -3353,18 +3278,18 @@ get_rctls(zlog_t *zlogp, char **bufp, size_t *bufsizep)
* max-processes property. If only the max-processes property is set,
* we add a max-lwps property with a limit derived from max-processes.
*/
- if (zonecfg_get_aliased_rctl(handle, ALIAS_MAXPROCS, &maxprocs)
+ if (zonecfg_get_aliased_rctl(snap_hndl, ALIAS_MAXPROCS, &maxprocs)
== Z_OK &&
- zonecfg_get_aliased_rctl(handle, ALIAS_MAXLWPS, &maxlwps)
+ zonecfg_get_aliased_rctl(snap_hndl, ALIAS_MAXLWPS, &maxlwps)
== Z_NO_ENTRY) {
- if (zonecfg_set_aliased_rctl(handle, ALIAS_MAXLWPS,
+ if (zonecfg_set_aliased_rctl(snap_hndl, ALIAS_MAXLWPS,
maxprocs * LWPS_PER_PROCESS) != Z_OK) {
zerror(zlogp, B_FALSE, "unable to set max-lwps alias");
goto out;
}
}
- if (zonecfg_setrctlent(handle) != Z_OK) {
+ if (zonecfg_setrctlent(snap_hndl) != Z_OK) {
zerror(zlogp, B_FALSE, "%s failed", "zonecfg_setrctlent");
goto out;
}
@@ -3373,7 +3298,7 @@ get_rctls(zlog_t *zlogp, char **bufp, size_t *bufsizep)
zerror(zlogp, B_TRUE, "memory allocation failed");
goto out;
}
- while (zonecfg_getrctlent(handle, &rctltab) == Z_OK) {
+ while (zonecfg_getrctlent(snap_hndl, &rctltab) == Z_OK) {
struct zone_rctlvaltab *rctlval;
uint_t i, count;
const char *name = rctltab.zone_rctl_name;
@@ -3455,7 +3380,7 @@ get_rctls(zlog_t *zlogp, char **bufp, size_t *bufsizep)
nvlv = NULL;
rctlcount++;
}
- (void) zonecfg_endrctlent(handle);
+ (void) zonecfg_endrctlent(snap_hndl);
if (rctlcount == 0) {
error = 0;
@@ -3480,8 +3405,6 @@ out:
nvlist_free(nvl);
if (nvlv != NULL)
free(nvlv);
- if (handle != NULL)
- zonecfg_fini_handle(handle);
return (error);
}
@@ -3497,7 +3420,7 @@ get_implicit_datasets(zlog_t *zlogp, char **retstr)
> sizeof (cmdbuf))
return (-1);
- if (do_subproc(zlogp, cmdbuf, retstr) != 0)
+ if (do_subproc(zlogp, cmdbuf, retstr, B_FALSE) != 0)
return (-1);
return (0);
@@ -3506,7 +3429,6 @@ get_implicit_datasets(zlog_t *zlogp, char **retstr)
static int
get_datasets(zlog_t *zlogp, char **bufp, size_t *bufsizep)
{
- zone_dochandle_t handle;
struct zone_dstab dstab;
size_t total, offset, len;
int error = -1;
@@ -3517,30 +3439,20 @@ get_datasets(zlog_t *zlogp, char **bufp, size_t *bufsizep)
*bufp = NULL;
*bufsizep = 0;
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (-1);
- }
- if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
- return (-1);
- }
-
if (get_implicit_datasets(zlogp, &implicit_datasets) != 0) {
zerror(zlogp, B_FALSE, "getting implicit datasets failed");
goto out;
}
- if (zonecfg_setdsent(handle) != Z_OK) {
+ if (zonecfg_setdsent(snap_hndl) != Z_OK) {
zerror(zlogp, B_FALSE, "%s failed", "zonecfg_setdsent");
goto out;
}
total = 0;
- while (zonecfg_getdsent(handle, &dstab) == Z_OK)
+ while (zonecfg_getdsent(snap_hndl, &dstab) == Z_OK)
total += strlen(dstab.zone_dataset_name) + 1;
- (void) zonecfg_enddsent(handle);
+ (void) zonecfg_enddsent(snap_hndl);
if (implicit_datasets != NULL)
implicit_len = strlen(implicit_datasets);
@@ -3557,12 +3469,12 @@ get_datasets(zlog_t *zlogp, char **bufp, size_t *bufsizep)
goto out;
}
- if (zonecfg_setdsent(handle) != Z_OK) {
+ if (zonecfg_setdsent(snap_hndl) != Z_OK) {
zerror(zlogp, B_FALSE, "%s failed", "zonecfg_setdsent");
goto out;
}
offset = 0;
- while (zonecfg_getdsent(handle, &dstab) == Z_OK) {
+ while (zonecfg_getdsent(snap_hndl, &dstab) == Z_OK) {
len = strlen(dstab.zone_dataset_name);
(void) strlcpy(str + offset, dstab.zone_dataset_name,
total - offset);
@@ -3570,7 +3482,7 @@ get_datasets(zlog_t *zlogp, char **bufp, size_t *bufsizep)
if (offset < total - 1)
str[offset++] = ',';
}
- (void) zonecfg_enddsent(handle);
+ (void) zonecfg_enddsent(snap_hndl);
if (implicit_len > 0)
(void) strlcpy(str + offset, implicit_datasets, total - offset);
@@ -3582,8 +3494,6 @@ get_datasets(zlog_t *zlogp, char **bufp, size_t *bufsizep)
out:
if (error != 0 && str != NULL)
free(str);
- if (handle != NULL)
- zonecfg_fini_handle(handle);
if (implicit_datasets != NULL)
free(implicit_datasets);
@@ -3593,40 +3503,26 @@ out:
static int
validate_datasets(zlog_t *zlogp)
{
- zone_dochandle_t handle;
struct zone_dstab dstab;
zfs_handle_t *zhp;
libzfs_handle_t *hdl;
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (-1);
- }
- if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) {
+ if (zonecfg_setdsent(snap_hndl) != Z_OK) {
zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
- return (-1);
- }
-
- if (zonecfg_setdsent(handle) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
return (-1);
}
if ((hdl = libzfs_init()) == NULL) {
zerror(zlogp, B_FALSE, "opening ZFS library");
- zonecfg_fini_handle(handle);
return (-1);
}
- while (zonecfg_getdsent(handle, &dstab) == Z_OK) {
+ while (zonecfg_getdsent(snap_hndl, &dstab) == Z_OK) {
if ((zhp = zfs_open(hdl, dstab.zone_dataset_name,
ZFS_TYPE_FILESYSTEM)) == NULL) {
zerror(zlogp, B_FALSE, "cannot open ZFS dataset '%s'",
dstab.zone_dataset_name);
- zonecfg_fini_handle(handle);
libzfs_fini(hdl);
return (-1);
}
@@ -3641,7 +3537,6 @@ validate_datasets(zlog_t *zlogp)
zerror(zlogp, B_FALSE, "cannot set 'zoned' "
"property for ZFS dataset '%s'\n",
dstab.zone_dataset_name);
- zonecfg_fini_handle(handle);
zfs_close(zhp);
libzfs_fini(hdl);
return (-1);
@@ -3649,9 +3544,8 @@ validate_datasets(zlog_t *zlogp)
zfs_close(zhp);
}
- (void) zonecfg_enddsent(handle);
+ (void) zonecfg_enddsent(snap_hndl);
- zonecfg_fini_handle(handle);
libzfs_fini(hdl);
return (0);
@@ -4385,62 +4279,25 @@ duplicate_reachable_path(zlog_t *zlogp, const char *rootpath)
}
/*
- * Set memory cap and pool info for the zone's resource management
- * configuration.
+ * Set pool info for the zone's resource management configuration.
*/
static int
setup_zone_rm(zlog_t *zlogp, char *zone_name, zoneid_t zoneid)
{
int res;
uint64_t tmp;
- struct zone_mcaptab mcap;
char sched[MAXNAMELEN];
- zone_dochandle_t handle = NULL;
char pool_err[128];
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (Z_BAD_HANDLE);
- }
-
- if ((res = zonecfg_get_snapshot_handle(zone_name, handle)) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
- zonecfg_fini_handle(handle);
- return (res);
- }
-
- /*
- * If a memory cap is configured, set the cap in the kernel using
- * zone_setattr() and make sure the rcapd SMF service is enabled.
- */
- if (zonecfg_getmcapent(handle, &mcap) == Z_OK) {
- uint64_t num;
- char smf_err[128];
-
- num = (uint64_t)strtoull(mcap.zone_physmem_cap, NULL, 10);
- if (zone_setattr(zoneid, ZONE_ATTR_PHYS_MCAP, &num, 0) == -1) {
- zerror(zlogp, B_TRUE, "could not set zone memory cap");
- zonecfg_fini_handle(handle);
- return (Z_INVAL);
- }
-
- if (zonecfg_enable_rcapd(smf_err, sizeof (smf_err)) != Z_OK) {
- zerror(zlogp, B_FALSE, "enabling system/rcap service "
- "failed: %s", smf_err);
- zonecfg_fini_handle(handle);
- return (Z_INVAL);
- }
- }
-
/* Get the scheduling class set in the zone configuration. */
- if (zonecfg_get_sched_class(handle, sched, sizeof (sched)) == Z_OK &&
+ if (zonecfg_get_sched_class(snap_hndl, sched, sizeof (sched)) == Z_OK &&
strlen(sched) > 0) {
if (zone_setattr(zoneid, ZONE_ATTR_SCHED_CLASS, sched,
strlen(sched)) == -1)
zerror(zlogp, B_TRUE, "WARNING: unable to set the "
"default scheduling class");
- } else if (zonecfg_get_aliased_rctl(handle, ALIAS_SHARES, &tmp)
+ } else if (zonecfg_get_aliased_rctl(snap_hndl, ALIAS_SHARES, &tmp)
== Z_OK) {
/*
* If the zone has the zone.cpu-shares rctl set then we want to
@@ -4451,7 +4308,7 @@ setup_zone_rm(zlog_t *zlogp, char *zone_name, zoneid_t zoneid)
*/
char class_name[PC_CLNMSZ];
- if (zonecfg_get_dflt_sched_class(handle, class_name,
+ if (zonecfg_get_dflt_sched_class(snap_hndl, class_name,
sizeof (class_name)) != Z_OK) {
zerror(zlogp, B_FALSE, "WARNING: unable to determine "
"the zone's scheduling class");
@@ -4484,7 +4341,7 @@ setup_zone_rm(zlog_t *zlogp, char *zone_name, zoneid_t zoneid)
* right thing in all cases (reuse or create) based on the current
* zonecfg.
*/
- if ((res = zonecfg_bind_tmp_pool(handle, zoneid, pool_err,
+ if ((res = zonecfg_bind_tmp_pool(snap_hndl, zoneid, pool_err,
sizeof (pool_err))) != Z_OK) {
if (res == Z_POOL || res == Z_POOL_CREATE || res == Z_POOL_BIND)
zerror(zlogp, B_FALSE, "%s: %s\ndedicated-cpu setting "
@@ -4493,14 +4350,13 @@ setup_zone_rm(zlog_t *zlogp, char *zone_name, zoneid_t zoneid)
else
zerror(zlogp, B_FALSE, "could not bind zone to "
"temporary pool: %s", zonecfg_strerror(res));
- zonecfg_fini_handle(handle);
return (Z_POOL_BIND);
}
/*
* Check if we need to warn about poold not being enabled.
*/
- if (zonecfg_warn_poold(handle)) {
+ if (zonecfg_warn_poold(snap_hndl)) {
zerror(zlogp, B_FALSE, "WARNING: A range of dedicated-cpus has "
"been specified\nbut the dynamic pool service is not "
"enabled.\nThe system will not dynamically adjust the\n"
@@ -4510,7 +4366,7 @@ setup_zone_rm(zlog_t *zlogp, char *zone_name, zoneid_t zoneid)
}
/* The following is a warning, not an error. */
- if ((res = zonecfg_bind_pool(handle, zoneid, pool_err,
+ if ((res = zonecfg_bind_pool(snap_hndl, zoneid, pool_err,
sizeof (pool_err))) != Z_OK) {
if (res == Z_POOL_BIND)
zerror(zlogp, B_FALSE, "WARNING: unable to bind to "
@@ -4524,10 +4380,9 @@ setup_zone_rm(zlog_t *zlogp, char *zone_name, zoneid_t zoneid)
}
/* Update saved pool name in case it has changed */
- (void) zonecfg_get_poolname(handle, zone_name, pool_name,
+ (void) zonecfg_get_poolname(snap_hndl, zone_name, pool_name,
sizeof (pool_name));
- zonecfg_fini_handle(handle);
return (Z_OK);
}
@@ -4612,33 +4467,28 @@ setup_zone_fs_allowed(zone_dochandle_t handle, zlog_t *zlogp, zoneid_t zoneid)
}
static int
-setup_zone_attrs(zlog_t *zlogp, char *zone_namep, zoneid_t zoneid)
+setup_zone_attrs(zlog_t *zlogp, zoneid_t zoneid)
{
- zone_dochandle_t handle;
int res = Z_OK;
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE, "getting zone configuration handle");
- return (Z_BAD_HANDLE);
- }
- if ((res = zonecfg_get_snapshot_handle(zone_namep, handle)) != Z_OK) {
- zerror(zlogp, B_FALSE, "invalid configuration");
+ if ((res = setup_zone_hostid(snap_hndl, zlogp, zoneid)) != Z_OK)
goto out;
- }
- if ((res = setup_zone_hostid(handle, zlogp, zoneid)) != Z_OK)
- goto out;
-
- if ((res = setup_zone_fs_allowed(handle, zlogp, zoneid)) != Z_OK)
+ if ((res = setup_zone_fs_allowed(snap_hndl, zlogp, zoneid)) != Z_OK)
goto out;
out:
- zonecfg_fini_handle(handle);
return (res);
}
+/*
+ * The zone_did is a persistent debug ID. Each zone should have a unique ID
+ * in the kernel. This is used for things like DTrace which want to monitor
+ * zones across reboots. They can't use the zoneid since that changes on
+ * each boot.
+ */
zoneid_t
-vplat_create(zlog_t *zlogp, zone_mnt_t mount_cmd)
+vplat_create(zlog_t *zlogp, zone_mnt_t mount_cmd, zoneid_t zone_did)
{
zoneid_t rval = -1;
priv_set_t *privs;
@@ -4654,7 +4504,7 @@ vplat_create(zlog_t *zlogp, zone_mnt_t mount_cmd)
tsol_zcent_t *zcent = NULL;
int match = 0;
int doi = 0;
- int flags;
+ int flags = -1;
zone_iptype_t iptype;
if (zone_get_rootpath(zone_name, rootpath, sizeof (rootpath)) != Z_OK) {
@@ -4676,6 +4526,8 @@ vplat_create(zlog_t *zlogp, zone_mnt_t mount_cmd)
flags = ZCF_NET_EXCL;
break;
}
+ if (flags == -1)
+ abort();
if ((privs = priv_allocset()) == NULL) {
zerror(zlogp, B_TRUE, "%s failed", "priv_allocset");
@@ -4779,7 +4631,7 @@ vplat_create(zlog_t *zlogp, zone_mnt_t mount_cmd)
xerr = 0;
if ((zoneid = zone_create(kzone, rootpath, privs, rctlbuf,
rctlbufsz, zfsbuf, zfsbufsz, &xerr, match, doi, zlabel,
- flags)) == -1) {
+ flags, zone_did)) == -1) {
if (xerr == ZE_AREMOUNTS) {
if (zonecfg_find_mounts(rootpath, NULL, NULL) < 1) {
zerror(zlogp, B_FALSE,
@@ -4825,7 +4677,7 @@ vplat_create(zlog_t *zlogp, zone_mnt_t mount_cmd)
struct brand_attr attr;
char modname[MAXPATHLEN];
- if (setup_zone_attrs(zlogp, zone_name, zoneid) != Z_OK)
+ if (setup_zone_attrs(zlogp, zoneid) != Z_OK)
goto error;
if ((bh = brand_open(brand_name)) == NULL) {
@@ -4883,6 +4735,8 @@ error:
}
if (rctlbuf != NULL)
free(rctlbuf);
+ if (zfsbuf != NULL)
+ free(zfsbuf);
priv_freeset(privs);
if (fp != NULL)
zonecfg_close_scratch(fp);
@@ -5025,6 +4879,8 @@ vplat_bringup(zlog_t *zlogp, zone_mnt_t mount_cmd, zoneid_t zoneid)
return (-1);
}
break;
+ default:
+ abort();
}
}
@@ -5100,7 +4956,8 @@ unmounted:
}
int
-vplat_teardown(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting)
+vplat_teardown(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting,
+ boolean_t debug)
{
char *kzone;
zoneid_t zoneid;
@@ -5139,16 +4996,12 @@ vplat_teardown(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting)
goto error;
}
- if (remove_datalink_pool(zlogp, zoneid) != 0) {
+ if (remove_datalink_pool(zlogp, zoneid) != 0)
zerror(zlogp, B_FALSE, "unable clear datalink pool property");
- goto error;
- }
- if (remove_datalink_protect(zlogp, zoneid) != 0) {
+ if (remove_datalink_protect(zlogp, zoneid) != 0)
zerror(zlogp, B_FALSE,
"unable clear datalink protect property");
- goto error;
- }
/*
* The datalinks assigned to the zone will be removed from the NGZ as
@@ -5188,7 +5041,7 @@ vplat_teardown(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting)
brand_close(bh);
if ((strlen(cmdbuf) > EXEC_LEN) &&
- (do_subproc(zlogp, cmdbuf, NULL) != Z_OK)) {
+ (do_subproc(zlogp, cmdbuf, NULL, debug) != Z_OK)) {
zerror(zlogp, B_FALSE, "%s failed", cmdbuf);
goto error;
}
@@ -5220,12 +5073,6 @@ vplat_teardown(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting)
}
break;
case ZS_EXCLUSIVE:
- if (unconfigure_exclusive_network_interfaces(zlogp,
- zoneid) != 0) {
- zerror(zlogp, B_FALSE, "unable to unconfigure "
- "network interfaces in zone");
- goto error;
- }
status = dladm_zone_halt(dld_handle, zoneid);
if (status != DLADM_STATUS_OK) {
zerror(zlogp, B_FALSE, "unable to notify "
@@ -5262,14 +5109,9 @@ vplat_teardown(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting)
if (rebooting) {
struct zone_psettab pset_tab;
- zone_dochandle_t handle;
- if ((handle = zonecfg_init_handle()) != NULL &&
- zonecfg_get_handle(zone_name, handle) == Z_OK &&
- zonecfg_lookup_pset(handle, &pset_tab) == Z_OK)
+ if (zonecfg_lookup_pset(snap_hndl, &pset_tab) == Z_OK)
destroy_tmp_pool = B_FALSE;
-
- zonecfg_fini_handle(handle);
}
if (destroy_tmp_pool) {
diff --git a/usr/src/cmd/zoneadmd/zcons.c b/usr/src/cmd/zoneadmd/zcons.c
index 963bfd3100..70b2f614c8 100644
--- a/usr/src/cmd/zoneadmd/zcons.c
+++ b/usr/src/cmd/zoneadmd/zcons.c
@@ -22,7 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2012 Joyent, Inc. All rights reserved.
+ * Copyright 2013 Joyent, Inc. All rights reserved.
*/
/*
@@ -321,7 +321,7 @@ destroy_console_devs(zlog_t *zlogp)
* interfaces to instantiate a new zone console node. We do a lot of
* sanity checking, and are careful to reuse a console if one exists.
*
- * Once the device is in the device tree, we kick devfsadm via di_init_devs()
+ * Once the device is in the device tree, we kick devfsadm via di_devlink_init()
* to ensure that the appropriate symlinks (to the master and slave console
* devices) are placed in /dev in the global zone.
*/
@@ -407,17 +407,34 @@ devlinks:
* Open the master side of the console and issue the ZC_HOLDSLAVE ioctl,
* which will cause the master to retain a reference to the slave.
* This prevents ttymon from blowing through the slave's STREAMS anchor.
+ *
+ * In very rare cases the open returns ENOENT if devfs doesn't have
+ * everything setup yet due to heavy zone startup load. Wait for
+ * 1 sec. and retry a few times before we fail to boot the zone.
*/
(void) snprintf(conspath, sizeof (conspath), "/dev/zcons/%s/%s",
zone_name, ZCONS_MASTER_NAME);
- if ((masterfd = open(conspath, O_RDWR | O_NOCTTY)) == -1) {
+ for (i = 0; i < 5; i++) {
+ masterfd = open(conspath, O_RDWR | O_NOCTTY);
+ if (masterfd >= 0 || errno != ENOENT)
+ break;
+ (void) sleep(1);
+ }
+ if (masterfd == -1) {
zerror(zlogp, B_TRUE, "ERROR: could not open master side of "
"zone console for %s to acquire slave handle", zone_name);
goto error;
}
+
(void) snprintf(conspath, sizeof (conspath), "/dev/zcons/%s/%s",
zone_name, ZCONS_SLAVE_NAME);
- if ((slavefd = open(conspath, O_RDWR | O_NOCTTY)) == -1) {
+ for (i = 0; i < 5; i++) {
+ slavefd = open(conspath, O_RDWR | O_NOCTTY);
+ if (slavefd >= 0 || errno != ENOENT)
+ break;
+ (void) sleep(1);
+ }
+ if (slavefd == -1) {
zerror(zlogp, B_TRUE, "ERROR: could not open slave side of zone"
" console for %s to acquire slave handle", zone_name);
(void) close(masterfd);
diff --git a/usr/src/cmd/zoneadmd/zoneadmd.c b/usr/src/cmd/zoneadmd/zoneadmd.c
index 94ab464193..bfa3b937ca 100644
--- a/usr/src/cmd/zoneadmd/zoneadmd.c
+++ b/usr/src/cmd/zoneadmd/zoneadmd.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent Inc. All rights reserved.
*/
/*
@@ -106,6 +107,7 @@
static char *progname;
char *zone_name; /* zone which we are managing */
+zone_dochandle_t snap_hndl; /* handle for snapshot created when ready */
char pool_name[MAXNAMELEN];
char default_brand[MAXNAMELEN];
char brand_name[MAXNAMELEN];
@@ -113,10 +115,11 @@ boolean_t zone_isnative;
boolean_t zone_iscluster;
boolean_t zone_islabeled;
static zoneid_t zone_id;
+static zoneid_t zone_did = 0;
dladm_handle_t dld_handle = NULL;
-static char pre_statechg_hook[2 * MAXPATHLEN];
-static char post_statechg_hook[2 * MAXPATHLEN];
+char pre_statechg_hook[2 * MAXPATHLEN];
+char post_statechg_hook[2 * MAXPATHLEN];
char query_hook[2 * MAXPATHLEN];
zlog_t logsys;
@@ -138,6 +141,9 @@ boolean_t bringup_failure_recovery = B_FALSE; /* ignore certain failures */
#define DEFAULT_LOCALE "C"
+#define RSRC_NET "net"
+#define RSRC_DEV "device"
+
static const char *
z_cmd_name(zone_cmd_t zcmd)
{
@@ -273,7 +279,7 @@ filter_bootargs(zlog_t *zlogp, const char *inargs, char *outargs,
{
int argc = 0, argc_save;
int i;
- int err;
+ int err = Z_OK;
char *arg, *lasts, **argv = NULL, **argv_save;
char zonecfg_args[BOOTARGS_MAX];
char scratchargs[BOOTARGS_MAX], *sargs;
@@ -288,25 +294,10 @@ filter_bootargs(zlog_t *zlogp, const char *inargs, char *outargs,
* and use them if applicable.
*/
if (inargs == NULL || inargs[0] == '\0') {
- zone_dochandle_t handle;
- if ((handle = zonecfg_init_handle()) == NULL) {
- zerror(zlogp, B_TRUE,
- "getting zone configuration handle");
- return (Z_BAD_HANDLE);
- }
- err = zonecfg_get_snapshot_handle(zone_name, handle);
- if (err != Z_OK) {
- zerror(zlogp, B_FALSE,
- "invalid configuration snapshot");
- zonecfg_fini_handle(handle);
- return (Z_BAD_HANDLE);
- }
-
bzero(zonecfg_args, sizeof (zonecfg_args));
- (void) zonecfg_get_bootargs(handle, zonecfg_args,
+ (void) zonecfg_get_bootargs(snap_hndl, zonecfg_args,
sizeof (zonecfg_args));
inargs = zonecfg_args;
- zonecfg_fini_handle(handle);
}
if (strlen(inargs) >= BOOTARGS_MAX) {
@@ -454,7 +445,7 @@ mkzonedir(zlog_t *zlogp)
* Run the brand's pre-state change callback, if it exists.
*/
static int
-brand_prestatechg(zlog_t *zlogp, int state, int cmd)
+brand_prestatechg(zlog_t *zlogp, int state, int cmd, boolean_t debug)
{
char cmdbuf[2 * MAXPATHLEN];
const char *altroot;
@@ -467,7 +458,7 @@ brand_prestatechg(zlog_t *zlogp, int state, int cmd)
state, cmd, altroot) > sizeof (cmdbuf))
return (-1);
- if (do_subproc(zlogp, cmdbuf, NULL) != 0)
+ if (do_subproc(zlogp, cmdbuf, NULL, debug) != 0)
return (-1);
return (0);
@@ -477,7 +468,7 @@ brand_prestatechg(zlog_t *zlogp, int state, int cmd)
* Run the brand's post-state change callback, if it exists.
*/
static int
-brand_poststatechg(zlog_t *zlogp, int state, int cmd)
+brand_poststatechg(zlog_t *zlogp, int state, int cmd, boolean_t debug)
{
char cmdbuf[2 * MAXPATHLEN];
const char *altroot;
@@ -490,7 +481,7 @@ brand_poststatechg(zlog_t *zlogp, int state, int cmd)
state, cmd, altroot) > sizeof (cmdbuf))
return (-1);
- if (do_subproc(zlogp, cmdbuf, NULL) != 0)
+ if (do_subproc(zlogp, cmdbuf, NULL, debug) != 0)
return (-1);
return (0);
@@ -529,35 +520,44 @@ notify_zonestatd(zoneid_t zoneid)
* subcommand.
*/
static int
-zone_ready(zlog_t *zlogp, zone_mnt_t mount_cmd, int zstate)
+zone_ready(zlog_t *zlogp, zone_mnt_t mount_cmd, int zstate, boolean_t debug)
{
int err;
+ boolean_t snapped = B_FALSE;
- if (brand_prestatechg(zlogp, zstate, Z_READY) != 0)
- return (-1);
-
+ if ((snap_hndl = zonecfg_init_handle()) == NULL) {
+ zerror(zlogp, B_TRUE, "getting zone configuration handle");
+ goto bad;
+ }
if ((err = zonecfg_create_snapshot(zone_name)) != Z_OK) {
zerror(zlogp, B_FALSE, "unable to create snapshot: %s",
zonecfg_strerror(err));
goto bad;
}
+ snapped = B_TRUE;
- if ((zone_id = vplat_create(zlogp, mount_cmd)) == -1) {
- if ((err = zonecfg_destroy_snapshot(zone_name)) != Z_OK)
- zerror(zlogp, B_FALSE, "destroying snapshot: %s",
- zonecfg_strerror(err));
+ if (zonecfg_get_snapshot_handle(zone_name, snap_hndl) != Z_OK) {
+ zerror(zlogp, B_FALSE, "invalid configuration snapshot");
goto bad;
}
+
+ if (zone_did == 0)
+ zone_did = zone_get_did(zone_name);
+
+ if (brand_prestatechg(zlogp, zstate, Z_READY, debug) != 0)
+ goto bad;
+
+ if ((zone_id = vplat_create(zlogp, mount_cmd, zone_did)) == -1)
+ goto bad;
+
if (vplat_bringup(zlogp, mount_cmd, zone_id) != 0) {
bringup_failure_recovery = B_TRUE;
- (void) vplat_teardown(NULL, (mount_cmd != Z_MNT_BOOT), B_FALSE);
- if ((err = zonecfg_destroy_snapshot(zone_name)) != Z_OK)
- zerror(zlogp, B_FALSE, "destroying snapshot: %s",
- zonecfg_strerror(err));
+ (void) vplat_teardown(NULL, (mount_cmd != Z_MNT_BOOT), B_FALSE,
+ debug);
goto bad;
}
- if (brand_poststatechg(zlogp, zstate, Z_READY) != 0)
+ if (brand_poststatechg(zlogp, zstate, Z_READY, debug) != 0)
goto bad;
return (0);
@@ -567,7 +567,13 @@ bad:
* If something goes wrong, we up the zones's state to the target
* state, READY, and then invoke the hook as if we're halting.
*/
- (void) brand_poststatechg(zlogp, ZONE_STATE_READY, Z_HALT);
+ (void) brand_poststatechg(zlogp, ZONE_STATE_READY, Z_HALT, debug);
+ if (snapped)
+ if ((err = zonecfg_destroy_snapshot(zone_name)) != Z_OK)
+ zerror(zlogp, B_FALSE, "destroying snapshot: %s",
+ zonecfg_strerror(err));
+ zonecfg_fini_handle(snap_hndl);
+ snap_hndl = NULL;
return (-1);
}
@@ -682,6 +688,8 @@ mount_early_fs(void *data, const char *spec, const char *dir,
char opt_buf[MAX_MNTOPT_STR];
int optlen = 0;
int mflag = MS_DATA;
+ int i;
+ int ret;
(void) ct_tmpl_clear(tmpl_fd);
/*
@@ -709,9 +717,26 @@ mount_early_fs(void *data, const char *spec, const char *dir,
optlen = MAX_MNTOPT_STR;
mflag = MS_OPTIONSTR;
}
- if (mount(spec, dir, mflag, fstype, NULL, 0, opt, optlen) != 0)
- _exit(errno);
- _exit(0);
+
+ /*
+ * There is an obscure race condition which can cause mount
+ * to return EBUSY. This happens for example on the mount
+ * of the zone's /etc/svc/volatile file system if there is
+ * a GZ process running svcs -Z, which will touch the
+ * mountpoint, just as we're trying to do the mount. To cope
+ * with this, we retry up to 3 times to let this transient
+ * process get out of the way.
+ */
+ for (i = 0; i < 3; i++) {
+ ret = 0;
+ if (mount(spec, dir, mflag, fstype, NULL, 0, opt,
+ optlen) != 0)
+ ret = errno;
+ if (ret != EBUSY)
+ break;
+ (void) sleep(1);
+ }
+ _exit(ret);
}
/* parent */
@@ -735,12 +760,150 @@ mount_early_fs(void *data, const char *spec, const char *dir,
}
/*
+ * env variable name format
+ * _ZONECFG_{resource name}_{identifying attr. name}_{property name}
+ * Any dashes (-) in the property names are replaced with underscore (_).
+ */
+static void
+set_zonecfg_env(char *rsrc, char *attr, char *name, char *val)
+{
+ char *p;
+ char nm[MAXNAMELEN];
+
+ if (attr == NULL)
+ (void) snprintf(nm, sizeof (nm), "_ZONECFG_%s_%s", rsrc,
+ name);
+ else
+ (void) snprintf(nm, sizeof (nm), "_ZONECFG_%s_%s_%s", rsrc,
+ attr, name);
+
+ p = nm;
+ while ((p = strchr(p, '-')) != NULL)
+ *p++ = '_';
+
+ (void) setenv(nm, val, 1);
+}
+
+/*
+ * Export zonecfg network and device properties into environment for the boot
+ * and state change hooks.
+ * If debug is true, export the brand hook debug env. variable as well.
+ *
+ * We could export more of the config in the future, as necessary.
+ */
+static int
+setup_subproc_env(boolean_t debug)
+{
+ int res;
+ struct zone_nwiftab ntab;
+ struct zone_devtab dtab;
+ struct zone_attrtab atab;
+ char net_resources[MAXNAMELEN * 2];
+ char dev_resources[MAXNAMELEN * 2];
+
+ /* snap_hndl is null when called through the set_brand_env code path */
+ if (snap_hndl == NULL)
+ return (Z_OK);
+
+ net_resources[0] = '\0';
+ if ((res = zonecfg_setnwifent(snap_hndl)) != Z_OK)
+ goto done;
+
+ while (zonecfg_getnwifent(snap_hndl, &ntab) == Z_OK) {
+ struct zone_res_attrtab *rap;
+ char *phys;
+
+ phys = ntab.zone_nwif_physical;
+
+ (void) strlcat(net_resources, phys, sizeof (net_resources));
+ (void) strlcat(net_resources, " ", sizeof (net_resources));
+
+ set_zonecfg_env(RSRC_NET, phys, "physical", phys);
+
+ set_zonecfg_env(RSRC_NET, phys, "address",
+ ntab.zone_nwif_address);
+ set_zonecfg_env(RSRC_NET, phys, "allowed-address",
+ ntab.zone_nwif_allowed_address);
+ set_zonecfg_env(RSRC_NET, phys, "defrouter",
+ ntab.zone_nwif_defrouter);
+ set_zonecfg_env(RSRC_NET, phys, "global-nic",
+ ntab.zone_nwif_gnic);
+ set_zonecfg_env(RSRC_NET, phys, "mac-addr", ntab.zone_nwif_mac);
+ set_zonecfg_env(RSRC_NET, phys, "vlan-id",
+ ntab.zone_nwif_vlan_id);
+
+ for (rap = ntab.zone_nwif_attrp; rap != NULL;
+ rap = rap->zone_res_attr_next)
+ set_zonecfg_env(RSRC_NET, phys, rap->zone_res_attr_name,
+ rap->zone_res_attr_value);
+ nwifent_free_attrs(&ntab);
+ }
+
+ (void) setenv("_ZONECFG_net_resources", net_resources, 1);
+
+ (void) zonecfg_endnwifent(snap_hndl);
+
+ if ((res = zonecfg_setdevent(snap_hndl)) != Z_OK)
+ goto done;
+
+ while (zonecfg_getdevent(snap_hndl, &dtab) == Z_OK) {
+ struct zone_res_attrtab *rap;
+ char *match;
+
+ match = dtab.zone_dev_match;
+
+ (void) strlcat(dev_resources, match, sizeof (dev_resources));
+ (void) strlcat(dev_resources, " ", sizeof (dev_resources));
+
+ for (rap = dtab.zone_dev_attrp; rap != NULL;
+ rap = rap->zone_res_attr_next)
+ set_zonecfg_env(RSRC_DEV, match,
+ rap->zone_res_attr_name, rap->zone_res_attr_value);
+ }
+
+ (void) zonecfg_enddevent(snap_hndl);
+
+ if ((res = zonecfg_setattrent(snap_hndl)) != Z_OK)
+ goto done;
+
+ while (zonecfg_getattrent(snap_hndl, &atab) == Z_OK) {
+ set_zonecfg_env("attr", NULL, atab.zone_attr_name,
+ atab.zone_attr_value);
+ }
+
+ (void) zonecfg_endattrent(snap_hndl);
+
+ if (debug)
+ (void) setenv("_ZONEADMD_brand_debug", "1", 1);
+ else
+ (void) setenv("_ZONEADMD_brand_debug", "", 1);
+
+ res = Z_OK;
+
+done:
+ return (res);
+}
+
+void
+nwifent_free_attrs(struct zone_nwiftab *np)
+{
+ struct zone_res_attrtab *rap;
+
+ for (rap = np->zone_nwif_attrp; rap != NULL; ) {
+ struct zone_res_attrtab *tp = rap;
+
+ rap = rap->zone_res_attr_next;
+ free(tp);
+ }
+}
+
+/*
* If retstr is not NULL, the output of the subproc is returned in the str,
* otherwise it is output using zerror(). Any memory allocated for retstr
* should be freed by the caller.
*/
int
-do_subproc(zlog_t *zlogp, char *cmdbuf, char **retstr)
+do_subproc(zlog_t *zlogp, char *cmdbuf, char **retstr, boolean_t debug)
{
char buf[1024]; /* arbitrary large amount */
char *inbuf;
@@ -759,6 +922,11 @@ do_subproc(zlog_t *zlogp, char *cmdbuf, char **retstr)
inbuf = buf;
}
+ if (setup_subproc_env(debug) != Z_OK) {
+ zerror(zlogp, B_FALSE, "failed to setup environment");
+ return (-1);
+ }
+
file = popen(cmdbuf, "r");
if (file == NULL) {
zerror(zlogp, B_TRUE, "could not launch: %s", cmdbuf);
@@ -767,8 +935,13 @@ do_subproc(zlog_t *zlogp, char *cmdbuf, char **retstr)
while (fgets(inbuf, 1024, file) != NULL) {
if (retstr == NULL) {
- if (zlogp != &logsys)
+ if (zlogp != &logsys) {
+ int last = strlen(inbuf) - 1;
+
+ if (inbuf[last] == '\n')
+ inbuf[last] = '\0';
zerror(zlogp, B_FALSE, "%s", inbuf);
+ }
} else {
char *p;
@@ -798,8 +971,51 @@ do_subproc(zlog_t *zlogp, char *cmdbuf, char **retstr)
return (WEXITSTATUS(status));
}
+/*
+ * Get the path for this zone's init(1M) (or equivalent) process. First look
+ * for a zone-specific init-name attr, then get it from the brand.
+ */
static int
-zone_bootup(zlog_t *zlogp, const char *bootargs, int zstate)
+get_initname(brand_handle_t bh, char *initname, int len)
+{
+ struct zone_attrtab a;
+
+ bzero(&a, sizeof (a));
+ (void) strlcpy(a.zone_attr_name, "init-name",
+ sizeof (a.zone_attr_name));
+
+ if (zonecfg_lookup_attr(snap_hndl, &a) == Z_OK) {
+ (void) strlcpy(initname, a.zone_attr_value, len);
+ return (0);
+ }
+
+ return (brand_get_initname(bh, initname, len));
+}
+
+/*
+ * Get the restart-init flag for this zone's init(1M) (or equivalent) process.
+ * First look for a zone-specific restart-init attr, then get it from the brand.
+ */
+static boolean_t
+restartinit(brand_handle_t bh)
+{
+ struct zone_attrtab a;
+
+ bzero(&a, sizeof (a));
+ (void) strlcpy(a.zone_attr_name, "restart-init",
+ sizeof (a.zone_attr_name));
+
+ if (zonecfg_lookup_attr(snap_hndl, &a) == Z_OK) {
+ if (strcmp(a.zone_attr_value, "false") == 0)
+ return (B_FALSE);
+ return (B_TRUE);
+ }
+
+ return (brand_restartinit(bh));
+}
+
+static int
+zone_bootup(zlog_t *zlogp, const char *bootargs, int zstate, boolean_t debug)
{
zoneid_t zoneid;
struct stat st;
@@ -813,8 +1029,9 @@ zone_bootup(zlog_t *zlogp, const char *bootargs, int zstate)
dladm_status_t status;
char errmsg[DLADM_STRSIZE];
int err;
+ boolean_t restart_init;
- if (brand_prestatechg(zlogp, zstate, Z_BOOT) != 0)
+ if (brand_prestatechg(zlogp, zstate, Z_BOOT, debug) != 0)
return (-1);
if ((zoneid = getzoneidbyname(zone_name)) == -1) {
@@ -862,13 +1079,16 @@ zone_bootup(zlog_t *zlogp, const char *bootargs, int zstate)
}
/* Get the path for this zone's init(1M) (or equivalent) process. */
- if (brand_get_initname(bh, init_file, MAXPATHLEN) != 0) {
+ if (get_initname(bh, init_file, MAXPATHLEN) != 0) {
zerror(zlogp, B_FALSE,
"unable to determine zone's init(1M) location");
brand_close(bh);
goto bad;
}
+ /* See if we should restart init if it dies. */
+ restart_init = restartinit(bh);
+
brand_close(bh);
err = filter_bootargs(zlogp, bootargs, nbootargs, init_file,
@@ -920,7 +1140,7 @@ zone_bootup(zlog_t *zlogp, const char *bootargs, int zstate)
* is booted.
*/
if ((strlen(cmdbuf) > EXEC_LEN) &&
- (do_subproc(zlogp, cmdbuf, NULL) != Z_OK)) {
+ (do_subproc(zlogp, cmdbuf, NULL, debug) != Z_OK)) {
zerror(zlogp, B_FALSE, "%s failed", cmdbuf);
goto bad;
}
@@ -935,6 +1155,12 @@ zone_bootup(zlog_t *zlogp, const char *bootargs, int zstate)
goto bad;
}
+ if (!restart_init && zone_setattr(zoneid, ZONE_ATTR_INITNORESTART,
+ NULL, 0) == -1) {
+ zerror(zlogp, B_TRUE, "could not set zone init-no-restart");
+ goto bad;
+ }
+
/*
* Inform zonestatd of a new zone so that it can install a door for
* the zone to contact it.
@@ -946,9 +1172,12 @@ zone_bootup(zlog_t *zlogp, const char *bootargs, int zstate)
goto bad;
}
- if (brand_poststatechg(zlogp, zstate, Z_BOOT) != 0)
+ if (brand_poststatechg(zlogp, zstate, Z_BOOT, debug) != 0)
goto bad;
+ /* Startup a thread to perform memory capping for the zone. */
+ create_mcap_thread(zlogp, zone_id);
+
return (0);
bad:
@@ -956,32 +1185,39 @@ bad:
* If something goes wrong, we up the zones's state to the target
* state, RUNNING, and then invoke the hook as if we're halting.
*/
- (void) brand_poststatechg(zlogp, ZONE_STATE_RUNNING, Z_HALT);
+ (void) brand_poststatechg(zlogp, ZONE_STATE_RUNNING, Z_HALT, debug);
if (links_loaded)
(void) dladm_zone_halt(dld_handle, zoneid);
return (-1);
}
static int
-zone_halt(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting, int zstate)
+zone_halt(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting, int zstate,
+ boolean_t debug)
{
int err;
- if (brand_prestatechg(zlogp, zstate, Z_HALT) != 0)
+ if (brand_prestatechg(zlogp, zstate, Z_HALT, debug) != 0)
return (-1);
- if (vplat_teardown(zlogp, unmount_cmd, rebooting) != 0) {
+ /* Shutting down, stop the memcap thread */
+ destroy_mcap_thread();
+
+ if (vplat_teardown(zlogp, unmount_cmd, rebooting, debug) != 0) {
if (!bringup_failure_recovery)
zerror(zlogp, B_FALSE, "unable to destroy zone");
return (-1);
}
+ if (brand_poststatechg(zlogp, zstate, Z_HALT, debug) != 0)
+ return (-1);
+
if ((err = zonecfg_destroy_snapshot(zone_name)) != Z_OK)
zerror(zlogp, B_FALSE, "destroying snapshot: %s",
zonecfg_strerror(err));
- if (brand_poststatechg(zlogp, zstate, Z_HALT) != 0)
- return (-1);
+ zonecfg_fini_handle(snap_hndl);
+ snap_hndl = NULL;
return (0);
}
@@ -1048,9 +1284,10 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
zone_state_t zstate;
zone_cmd_t cmd;
+ boolean_t debug;
zone_cmd_arg_t *zargp;
- boolean_t kernelcall;
+ boolean_t kernelcall = B_TRUE;
int rval = -1;
uint64_t uniqid;
@@ -1099,6 +1336,7 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
goto out;
}
cmd = zargp->cmd;
+ debug = zargp->debug;
if (door_ucred(&uc) != 0) {
zerror(&logsys, B_TRUE, "door_ucred");
@@ -1204,23 +1442,23 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
case ZONE_STATE_INSTALLED:
switch (cmd) {
case Z_READY:
- rval = zone_ready(zlogp, Z_MNT_BOOT, zstate);
+ rval = zone_ready(zlogp, Z_MNT_BOOT, zstate, debug);
if (rval == 0)
eventstream_write(Z_EVT_ZONE_READIED);
break;
case Z_BOOT:
case Z_FORCEBOOT:
eventstream_write(Z_EVT_ZONE_BOOTING);
- if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate))
- == 0) {
+ if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate,
+ debug)) == 0) {
rval = zone_bootup(zlogp, zargp->bootbuf,
- zstate);
+ zstate, debug);
}
audit_put_record(zlogp, uc, rval, "boot");
if (rval != 0) {
bringup_failure_recovery = B_TRUE;
(void) zone_halt(zlogp, B_FALSE, B_FALSE,
- zstate);
+ zstate, debug);
eventstream_write(Z_EVT_ZONE_BOOTFAILED);
}
break;
@@ -1271,7 +1509,7 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
rval = zone_ready(zlogp,
strcmp(zargp->bootbuf, "-U") == 0 ?
- Z_MNT_UPDATE : Z_MNT_SCRATCH, zstate);
+ Z_MNT_UPDATE : Z_MNT_SCRATCH, zstate, debug);
if (rval != 0)
break;
@@ -1333,15 +1571,17 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
rval = 0;
break;
case Z_BOOT:
+ case Z_FORCEBOOT:
(void) strlcpy(boot_args, zargp->bootbuf,
sizeof (boot_args));
eventstream_write(Z_EVT_ZONE_BOOTING);
- rval = zone_bootup(zlogp, zargp->bootbuf, zstate);
+ rval = zone_bootup(zlogp, zargp->bootbuf, zstate,
+ debug);
audit_put_record(zlogp, uc, rval, "boot");
if (rval != 0) {
bringup_failure_recovery = B_TRUE;
(void) zone_halt(zlogp, B_FALSE, B_TRUE,
- zstate);
+ zstate, debug);
eventstream_write(Z_EVT_ZONE_BOOTFAILED);
}
boot_args[0] = '\0';
@@ -1349,14 +1589,15 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
case Z_HALT:
if (kernelcall) /* Invalid; can't happen */
abort();
- if ((rval = zone_halt(zlogp, B_FALSE, B_FALSE, zstate))
- != 0)
+ if ((rval = zone_halt(zlogp, B_FALSE, B_FALSE, zstate,
+ debug)) != 0)
break;
eventstream_write(Z_EVT_ZONE_HALTED);
break;
case Z_REBOOT:
case Z_NOTE_UNINSTALLING:
case Z_MOUNT:
+ case Z_FORCEMOUNT:
case Z_UNMOUNT:
if (kernelcall) /* Invalid; can't happen */
abort();
@@ -1373,7 +1614,7 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
case Z_UNMOUNT:
if (kernelcall) /* Invalid; can't happen */
abort();
- rval = zone_halt(zlogp, B_TRUE, B_FALSE, zstate);
+ rval = zone_halt(zlogp, B_TRUE, B_FALSE, zstate, debug);
if (rval == 0) {
eventstream_write(Z_EVT_ZONE_HALTED);
(void) sema_post(&scratch_sem);
@@ -1395,15 +1636,17 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
case ZONE_STATE_DOWN:
switch (cmd) {
case Z_READY:
- if ((rval = zone_halt(zlogp, B_FALSE, B_TRUE, zstate))
- != 0)
+ if ((rval = zone_halt(zlogp, B_FALSE, B_TRUE, zstate,
+ debug)) != 0)
break;
- if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate)) == 0)
+ if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate,
+ debug)) == 0)
eventstream_write(Z_EVT_ZONE_READIED);
else
eventstream_write(Z_EVT_ZONE_HALTED);
break;
case Z_BOOT:
+ case Z_FORCEBOOT:
/*
* We could have two clients racing to boot this
* zone; the second client loses, but his request
@@ -1414,8 +1657,8 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
rval = 0;
break;
case Z_HALT:
- if ((rval = zone_halt(zlogp, B_FALSE, B_FALSE, zstate))
- != 0)
+ if ((rval = zone_halt(zlogp, B_FALSE, B_FALSE, zstate,
+ debug)) != 0)
break;
eventstream_write(Z_EVT_ZONE_HALTED);
break;
@@ -1423,29 +1666,31 @@ server(void *cookie, char *args, size_t alen, door_desc_t *dp,
(void) strlcpy(boot_args, zargp->bootbuf,
sizeof (boot_args));
eventstream_write(Z_EVT_ZONE_REBOOTING);
- if ((rval = zone_halt(zlogp, B_FALSE, B_TRUE, zstate))
- != 0) {
+ if ((rval = zone_halt(zlogp, B_FALSE, B_TRUE, zstate,
+ debug)) != 0) {
eventstream_write(Z_EVT_ZONE_BOOTFAILED);
boot_args[0] = '\0';
break;
}
- if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate))
- != 0) {
+ if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate,
+ debug)) != 0) {
eventstream_write(Z_EVT_ZONE_BOOTFAILED);
boot_args[0] = '\0';
break;
}
- rval = zone_bootup(zlogp, zargp->bootbuf, zstate);
+ rval = zone_bootup(zlogp, zargp->bootbuf, zstate,
+ debug);
audit_put_record(zlogp, uc, rval, "reboot");
if (rval != 0) {
(void) zone_halt(zlogp, B_FALSE, B_TRUE,
- zstate);
+ zstate, debug);
eventstream_write(Z_EVT_ZONE_BOOTFAILED);
}
boot_args[0] = '\0';
break;
case Z_NOTE_UNINSTALLING:
case Z_MOUNT:
+ case Z_FORCEMOUNT:
case Z_UNMOUNT:
zerror(zlogp, B_FALSE, "%s operation is invalid "
"for zones in state '%s'", z_cmd_name(cmd),
@@ -1604,11 +1849,34 @@ top:
* state.
*/
if (zstate > ZONE_STATE_INSTALLED) {
+ static zoneid_t zid;
+
zerror(zlogp, B_FALSE,
"zone '%s': WARNING: zone is in state '%s', but "
"zoneadmd does not appear to be available; "
"restarted zoneadmd to recover.",
zone_name, zone_state_str(zstate));
+
+ /*
+ * Startup a thread to perform memory capping for the
+ * zone.
+ */
+ if ((zid = getzoneidbyname(zone_name)) != -1)
+ create_mcap_thread(zlogp, zid);
+
+ /* recover the global configuration snapshot */
+ if (snap_hndl == NULL) {
+ if ((snap_hndl = zonecfg_init_handle())
+ == NULL ||
+ zonecfg_create_snapshot(zone_name)
+ != Z_OK ||
+ zonecfg_get_snapshot_handle(zone_name,
+ snap_hndl) != Z_OK) {
+ zerror(zlogp, B_FALSE, "recovering "
+ "zone configuration handle");
+ goto out;
+ }
+ }
}
(void) fdetach(zone_door_path);
@@ -1622,6 +1890,52 @@ out:
}
/*
+ * Run the query hook with the 'env' parameter. It should return a
+ * string of tab-delimited key-value pairs, each of which should be set
+ * in the environment.
+ *
+ * Because the env_vars string values become part of the environment, the
+ * string is static and we don't free it.
+ *
+ * This function is always called before zoneadmd forks and makes itself
+ * exclusive, so it is possible there could more than one instance of zoneadmd
+ * running in parallel at this point. Thus, we have no zonecfg snapshot and
+ * shouldn't take one yet (i.e. snap_hndl is NULL). Thats ok, since we don't
+ * need any zonecfg info to query for a brand-specific env value.
+ */
+static int
+set_brand_env(zlog_t *zlogp)
+{
+ int ret = 0;
+ static char *env_vars = NULL;
+ char buf[2 * MAXPATHLEN];
+
+ if (query_hook[0] == '\0' || env_vars != NULL)
+ return (0);
+
+ if (snprintf(buf, sizeof (buf), "%s env", query_hook) > sizeof (buf))
+ return (-1);
+
+ if (do_subproc(zlogp, buf, &env_vars, B_FALSE) != 0)
+ return (-1);
+
+ if (env_vars != NULL) {
+ char *sp;
+
+ sp = strtok(env_vars, "\t");
+ while (sp != NULL) {
+ if (putenv(sp) != 0) {
+ ret = -1;
+ break;
+ }
+ sp = strtok(NULL, "\t");
+ }
+ }
+
+ return (ret);
+}
+
+/*
* Setup the brand's pre and post state change callbacks, as well as the
* query callback, if any of these exist.
*/
@@ -1857,6 +2171,11 @@ main(int argc, char *argv[])
}
priv_freeset(privset);
+ if (set_brand_env(zlogp) != 0) {
+ zerror(zlogp, B_FALSE, "Unable to setup brand's environment");
+ return (1);
+ }
+
if (mkzonedir(zlogp) != 0)
return (1);
@@ -1897,6 +2216,13 @@ main(int argc, char *argv[])
(void) sigaddset(&block_cld, SIGCHLD);
(void) sigprocmask(SIG_BLOCK, &block_cld, NULL);
+ /*
+ * The parent only needs stderr after the fork, so close other fd's
+ * that we inherited from zoneadm so that the parent doesn't have those
+ * open while waiting. The child will close the rest after the fork.
+ */
+ closefrom(3);
+
if ((ctfd = init_template()) == -1) {
zerror(zlogp, B_TRUE, "failed to create contract");
return (1);
diff --git a/usr/src/cmd/zoneadmd/zoneadmd.h b/usr/src/cmd/zoneadmd/zoneadmd.h
index 63b23481d2..58ec1516fa 100644
--- a/usr/src/cmd/zoneadmd/zoneadmd.h
+++ b/usr/src/cmd/zoneadmd/zoneadmd.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent Inc. All rights reserved.
*/
#ifndef _ZONEADMD_H
@@ -85,6 +86,7 @@ extern mutex_t msglock;
extern boolean_t in_death_throes;
extern boolean_t bringup_failure_recovery;
extern char *zone_name;
+extern zone_dochandle_t snap_hndl;
extern char pool_name[MAXNAMELEN];
extern char brand_name[MAXNAMELEN];
extern char default_brand[MAXNAMELEN];
@@ -96,6 +98,7 @@ extern dladm_handle_t dld_handle;
extern void zerror(zlog_t *, boolean_t, const char *, ...);
extern char *localize_msg(char *locale, const char *msg);
+extern void nwifent_free_attrs(struct zone_nwiftab *);
/*
* Eventstream interfaces.
@@ -130,9 +133,9 @@ typedef enum {
/*
* Virtual platform interfaces.
*/
-extern zoneid_t vplat_create(zlog_t *, zone_mnt_t);
+extern zoneid_t vplat_create(zlog_t *, zone_mnt_t, zoneid_t);
extern int vplat_bringup(zlog_t *, zone_mnt_t, zoneid_t);
-extern int vplat_teardown(zlog_t *, boolean_t, boolean_t);
+extern int vplat_teardown(zlog_t *, boolean_t, boolean_t, boolean_t);
extern int vplat_get_iptype(zlog_t *, zone_iptype_t *);
/*
@@ -151,6 +154,12 @@ extern int init_console(zlog_t *);
extern void serve_console(zlog_t *);
/*
+ * Memory capping thread creation.
+ */
+extern void create_mcap_thread(zlog_t *, zoneid_t);
+extern void destroy_mcap_thread();
+
+/*
* Contract handling.
*/
extern int init_template(void);
@@ -158,7 +167,7 @@ extern int init_template(void);
/*
* Routine to manage child processes.
*/
-extern int do_subproc(zlog_t *, char *, char **);
+extern int do_subproc(zlog_t *, char *, char **, boolean_t);
#ifdef __cplusplus
}
diff --git a/usr/src/cmd/zonecfg/Makefile b/usr/src/cmd/zonecfg/Makefile
index f1de4ac512..3efc6bb40b 100644
--- a/usr/src/cmd/zonecfg/Makefile
+++ b/usr/src/cmd/zonecfg/Makefile
@@ -36,7 +36,7 @@ MAPOPTS = $(MAPFILES:%=-M%)
LFLAGS = -t
YFLAGS = -d -b zonecfg_grammar
-LDLIBS += -lzonecfg -ll -lnsl -ltecla -lzfs -lbrand -ldladm -linetutil
+LDLIBS += -lzonecfg -ll -lnsl -ltecla -lzfs -lbrand -ldladm -linetutil -luuid
CPPFLAGS += -I.
LDFLAGS += $(MAPOPTS)
CLEANFILES += zonecfg_lex.c zonecfg_grammar.tab.c zonecfg_grammar.tab.h
diff --git a/usr/src/cmd/zonecfg/zonecfg.c b/usr/src/cmd/zonecfg/zonecfg.c
index 7a6e3cdcef..931acbcdbf 100644
--- a/usr/src/cmd/zonecfg/zonecfg.c
+++ b/usr/src/cmd/zonecfg/zonecfg.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent Inc. All rights reserved.
*/
/*
@@ -77,6 +78,7 @@
#include <libinetutil.h>
#include <pwd.h>
#include <inet/ip.h>
+#include <uuid/uuid.h>
#include <libzonecfg.h>
#include "zonecfg.h"
@@ -185,6 +187,8 @@ char *res_types[] = {
"admin",
"fs-allowed",
ALIAS_MAXPROCS,
+ ALIAS_ZFSPRI,
+ "uuid",
NULL
};
@@ -232,6 +236,12 @@ char *prop_types[] = {
"fs-allowed",
ALIAS_MAXPROCS,
"allowed-address",
+ ALIAS_ZFSPRI,
+ "mac-addr",
+ "vlan-id",
+ "global-nic",
+ "property",
+ "uuid",
NULL
};
@@ -297,6 +307,7 @@ static const char *clear_cmds[] = {
"clear " ALIAS_MAXSEMIDS,
"clear " ALIAS_SHARES,
"clear " ALIAS_MAXPROCS,
+ "clear " ALIAS_ZFSPRI,
NULL
};
@@ -347,6 +358,8 @@ static const char *set_cmds[] = {
"set hostid=",
"set fs-allowed=",
"set " ALIAS_MAXPROCS "=",
+ "set " ALIAS_ZFSPRI "=",
+ "set uuid=",
NULL
};
@@ -379,6 +392,7 @@ static const char *info_cmds[] = {
"info admin",
"info fs-allowed",
"info max-processes",
+ "info uuid",
NULL
};
@@ -404,9 +418,20 @@ static const char *net_res_scope_cmds[] = {
"exit",
"help",
"info",
+ "add property ",
+ "clear allowed-address",
+ "clear defrouter",
+ "clear global-nic",
+ "clear mac-addr",
+ "clear vlan-id",
+ "remove property ",
"set address=",
- "set physical=",
+ "set allowed-address=",
"set defrouter=",
+ "set global-nic=",
+ "set mac-addr=",
+ "set physical=",
+ "set vlan-id=",
NULL
};
@@ -416,6 +441,7 @@ static const char *device_res_scope_cmds[] = {
"exit",
"help",
"info",
+ "add property ",
"set match=",
NULL
};
@@ -523,6 +549,7 @@ static zone_dochandle_t handle;
/* used all over the place */
static char zone[ZONENAME_MAX];
static char revert_zone[ZONENAME_MAX];
+static char new_uuid[UUID_PRINTABLE_STRING_LENGTH];
/* global brand operations */
static brand_handle_t brand;
@@ -577,7 +604,6 @@ static struct zone_rctltab old_rctltab, in_progress_rctltab;
static struct zone_attrtab old_attrtab, in_progress_attrtab;
static struct zone_dstab old_dstab, in_progress_dstab;
static struct zone_psettab old_psettab, in_progress_psettab;
-static struct zone_mcaptab old_mcaptab, in_progress_mcaptab;
static struct zone_admintab old_admintab, in_progress_admintab;
static GetLine *gl; /* The gl_get_line() resource object */
@@ -992,11 +1018,20 @@ usage(boolean_t verbose, uint_t flags)
(void) fprintf(fp, gettext("Valid commands:\n"));
(void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET),
pt_to_str(PT_ADDRESS), gettext("<IP-address>"));
+ (void) fprintf(fp, "\t%s %s (%s=<value>,%s=<value>)\n",
+ cmd_to_str(CMD_ADD), pt_to_str(PT_NPROP),
+ pt_to_str(PT_NAME), pt_to_str(PT_VALUE));
(void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET),
pt_to_str(PT_ALLOWED_ADDRESS),
gettext("<IP-address>"));
(void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET),
pt_to_str(PT_PHYSICAL), gettext("<interface>"));
+ (void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET),
+ pt_to_str(PT_MAC), gettext("<mac-address>"));
+ (void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET),
+ pt_to_str(PT_GNIC), gettext("<global zone NIC>"));
+ (void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET),
+ pt_to_str(PT_VLANID), gettext("<vlan ID>"));
(void) fprintf(fp, gettext("See ifconfig(1M) for "
"details of the <interface> string.\n"));
(void) fprintf(fp, gettext("%s %s is valid "
@@ -1004,10 +1039,12 @@ usage(boolean_t verbose, uint_t flags)
"must not be set.\n"),
cmd_to_str(CMD_SET), pt_to_str(PT_ADDRESS),
pt_to_str(PT_IPTYPE), gettext("shared"));
- (void) fprintf(fp, gettext("%s %s is valid "
- "if the %s property is set to %s, otherwise it "
- "must not be set.\n"),
- cmd_to_str(CMD_SET), pt_to_str(PT_ALLOWED_ADDRESS),
+ (void) fprintf(fp, gettext("%s (%s, %s, %s, %s) are "
+ "valid if the %s property is set to %s, otherwise "
+ "they must not be set.\n"),
+ cmd_to_str(CMD_SET),
+ pt_to_str(PT_ALLOWED_ADDRESS), pt_to_str(PT_MAC),
+ pt_to_str(PT_VLANID), pt_to_str(PT_GNIC),
pt_to_str(PT_IPTYPE), gettext("exclusive"));
(void) fprintf(fp, gettext("\t%s %s=%s\n%s %s "
"is valid if the %s or %s property is set, "
@@ -1023,6 +1060,9 @@ usage(boolean_t verbose, uint_t flags)
"used to configure a device node.\n"),
rt_to_str(resource_scope));
(void) fprintf(fp, gettext("Valid commands:\n"));
+ (void) fprintf(fp, "\t%s %s (%s=<value>,%s=<value>)\n",
+ cmd_to_str(CMD_ADD), pt_to_str(PT_NPROP),
+ pt_to_str(PT_NAME), pt_to_str(PT_VALUE));
(void) fprintf(fp, "\t%s %s=%s\n", cmd_to_str(CMD_SET),
pt_to_str(PT_MATCH), gettext("<device-path>"));
break;
@@ -1154,10 +1194,12 @@ usage(boolean_t verbose, uint_t flags)
if (flags & HELP_USAGE) {
(void) fprintf(fp, "%s:\t%s %s\n", gettext("usage"),
execname, cmd_to_str(CMD_HELP));
- (void) fprintf(fp, "\t%s -z <zone>\t\t\t(%s)\n",
+ (void) fprintf(fp, "\t%s {-z <zone>|-u <uuid>}\t\t\t(%s)\n",
execname, gettext("interactive"));
- (void) fprintf(fp, "\t%s -z <zone> <command>\n", execname);
- (void) fprintf(fp, "\t%s -z <zone> -f <command-file>\n",
+ (void) fprintf(fp, "\t%s {-z <zone>|-u <uuid>} <command>\n",
+ execname);
+ (void) fprintf(fp,
+ "\t%s {-z <zone>|-u <uuid>} -f <command-file>\n",
execname);
}
if (flags & HELP_SUBCMDS) {
@@ -1246,15 +1288,22 @@ usage(boolean_t verbose, uint_t flags)
pt_to_str(PT_MAXSEMIDS));
(void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"),
pt_to_str(PT_SHARES));
+ (void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"),
+ pt_to_str(PT_UUID));
+ (void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"),
+ pt_to_str(PT_ZFSPRI));
(void) fprintf(fp, "\t%s\t\t%s, %s, %s, %s, %s\n",
rt_to_str(RT_FS), pt_to_str(PT_DIR),
pt_to_str(PT_SPECIAL), pt_to_str(PT_RAW),
pt_to_str(PT_TYPE), pt_to_str(PT_OPTIONS));
- (void) fprintf(fp, "\t%s\t\t%s, %s, %s|%s\n", rt_to_str(RT_NET),
+ (void) fprintf(fp, "\t%s\t\t%s, %s, %s, %s, %s, %s, %s %s\n",
+ rt_to_str(RT_NET),
pt_to_str(PT_ADDRESS), pt_to_str(PT_ALLOWED_ADDRESS),
- pt_to_str(PT_PHYSICAL), pt_to_str(PT_DEFROUTER));
- (void) fprintf(fp, "\t%s\t\t%s\n", rt_to_str(RT_DEVICE),
- pt_to_str(PT_MATCH));
+ pt_to_str(PT_GNIC), pt_to_str(PT_MAC),
+ pt_to_str(PT_PHYSICAL), pt_to_str(PT_NPROP),
+ pt_to_str(PT_VLANID), pt_to_str(PT_DEFROUTER));
+ (void) fprintf(fp, "\t%s\t\t%s, %s\n", rt_to_str(RT_DEVICE),
+ pt_to_str(PT_MATCH), pt_to_str(PT_NPROP));
(void) fprintf(fp, "\t%s\t\t%s, %s\n", rt_to_str(RT_RCTL),
pt_to_str(PT_NAME), pt_to_str(PT_VALUE));
(void) fprintf(fp, "\t%s\t\t%s, %s, %s\n", rt_to_str(RT_ATTR),
@@ -1309,6 +1358,9 @@ initialize(boolean_t handle_expected)
if (zonecfg_check_handle(handle) != Z_OK) {
if ((err = zonecfg_get_handle(zone, handle)) == Z_OK) {
got_handle = B_TRUE;
+
+ (void) zonecfg_fix_obsolete(handle);
+
if (zonecfg_get_brand(handle, brandname,
sizeof (brandname)) != Z_OK) {
zerr("Zone %s is inconsistent: missing "
@@ -1576,6 +1628,7 @@ create_func(cmd_t *cmd)
boolean_t force = B_FALSE;
boolean_t attach = B_FALSE;
boolean_t arg_err = B_FALSE;
+ uuid_t uuid;
assert(cmd != NULL);
@@ -1583,7 +1636,7 @@ create_func(cmd_t *cmd)
(void) strlcpy(zone_template, "SUNWdefault", sizeof (zone_template));
optind = 0;
- while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?a:bFt:"))
+ while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?a:bFt:X"))
!= EOF) {
switch (arg) {
case '?':
@@ -1609,6 +1662,17 @@ create_func(cmd_t *cmd)
(void) strlcpy(zone_template, optarg,
sizeof (zone_template));
break;
+ case 'X':
+ (void) snprintf(zone_template, sizeof (zone_template),
+ "%s/%s.xml", ZONE_CONFIG_ROOT, zone);
+ err = zonecfg_get_xml_handle(zone_template, handle);
+ if (err != Z_OK) {
+ zone_perror(execname, err, B_TRUE);
+ exit(Z_ERR);
+ }
+ got_handle = B_TRUE;
+ need_to_commit = B_TRUE;
+ return;
default:
short_usage(CMD_CREATE);
arg_err = B_TRUE;
@@ -1665,6 +1729,10 @@ create_func(cmd_t *cmd)
zonecfg_fini_handle(handle);
handle = tmphandle;
got_handle = B_TRUE;
+
+ /* Allocate a new uuid for this new zone */
+ uuid_generate(uuid);
+ uuid_unparse(uuid, new_uuid);
}
/*
@@ -1711,8 +1779,8 @@ export_func(cmd_t *cmd)
struct zone_rctltab rctltab;
struct zone_dstab dstab;
struct zone_psettab psettab;
- struct zone_mcaptab mcaptab;
struct zone_rctlvaltab *valptr;
+ struct zone_res_attrtab *rap;
struct zone_admintab admintab;
int err, arg;
char zonepath[MAXPATHLEN], outfile[MAXPATHLEN], pool[MAXNAMELEN];
@@ -1725,6 +1793,7 @@ export_func(cmd_t *cmd)
FILE *of;
boolean_t autoboot;
zone_iptype_t iptype;
+ uuid_t uuid;
boolean_t need_to_close = B_FALSE;
boolean_t arg_err = B_FALSE;
@@ -1835,6 +1904,14 @@ export_func(cmd_t *cmd)
pt_to_str(PT_FS_ALLOWED), fsallowedp);
}
+ if (zonecfg_get_uuid(zone, uuid) == Z_OK && !uuid_is_null(uuid)) {
+ char suuid[UUID_PRINTABLE_STRING_LENGTH];
+
+ uuid_unparse(uuid, suuid);
+ (void) fprintf(of, "%s %s=%s\n", cmd_to_str(CMD_SET),
+ pt_to_str(PT_UUID), suuid);
+ }
+
if ((err = zonecfg_setfsent(handle)) != Z_OK) {
zone_perror(zone, err, B_FALSE);
goto done;
@@ -1882,7 +1959,17 @@ export_func(cmd_t *cmd)
export_prop(of, PT_ALLOWED_ADDRESS,
nwiftab.zone_nwif_allowed_address);
export_prop(of, PT_PHYSICAL, nwiftab.zone_nwif_physical);
+ export_prop(of, PT_MAC, nwiftab.zone_nwif_mac);
+ export_prop(of, PT_VLANID, nwiftab.zone_nwif_vlan_id);
+ export_prop(of, PT_GNIC, nwiftab.zone_nwif_gnic);
export_prop(of, PT_DEFROUTER, nwiftab.zone_nwif_defrouter);
+ for (rap = nwiftab.zone_nwif_attrp; rap != NULL;
+ rap = rap->zone_res_attr_next) {
+ fprintf(of, "%s %s (%s=%s,%s=\"%s\")\n",
+ cmd_to_str(CMD_ADD), pt_to_str(PT_NPROP),
+ pt_to_str(PT_NAME), rap->zone_res_attr_name,
+ pt_to_str(PT_VALUE), rap->zone_res_attr_value);
+ }
(void) fprintf(of, "%s\n", cmd_to_str(CMD_END));
}
(void) zonecfg_endnwifent(handle);
@@ -1895,21 +1982,17 @@ export_func(cmd_t *cmd)
(void) fprintf(of, "%s %s\n", cmd_to_str(CMD_ADD),
rt_to_str(RT_DEVICE));
export_prop(of, PT_MATCH, devtab.zone_dev_match);
+ for (rap = devtab.zone_dev_attrp; rap != NULL;
+ rap = rap->zone_res_attr_next) {
+ fprintf(of, "%s %s (%s=%s,%s=\"%s\")\n",
+ cmd_to_str(CMD_ADD), pt_to_str(PT_NPROP),
+ pt_to_str(PT_NAME), rap->zone_res_attr_name,
+ pt_to_str(PT_VALUE), rap->zone_res_attr_value);
+ }
(void) fprintf(of, "%s\n", cmd_to_str(CMD_END));
}
(void) zonecfg_enddevent(handle);
- if (zonecfg_getmcapent(handle, &mcaptab) == Z_OK) {
- char buf[128];
-
- (void) fprintf(of, "%s %s\n", cmd_to_str(CMD_ADD),
- rt_to_str(RT_MCAP));
- bytes_to_units(mcaptab.zone_physmem_cap, buf, sizeof (buf));
- (void) fprintf(of, "%s %s=%s\n", cmd_to_str(CMD_SET),
- pt_to_str(PT_PHYSICAL), buf);
- (void) fprintf(of, "%s\n", cmd_to_str(CMD_END));
- }
-
if ((err = zonecfg_setrctlent(handle)) != Z_OK) {
zone_perror(zone, err, B_FALSE);
goto done;
@@ -2063,7 +2146,6 @@ add_resource(cmd_t *cmd)
{
int type;
struct zone_psettab tmp_psettab;
- struct zone_mcaptab tmp_mcaptab;
uint64_t tmp;
uint64_t tmp_mcap;
char pool[MAXNAMELEN];
@@ -2155,9 +2237,10 @@ add_resource(cmd_t *cmd)
* Make sure there isn't already a mem-cap entry or max-swap
* or max-locked rctl.
*/
- if (zonecfg_lookup_mcap(handle, &tmp_mcaptab) == Z_OK ||
- zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, &tmp_mcap)
- == Z_OK ||
+ if (zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP,
+ &tmp_mcap) == Z_OK ||
+ zonecfg_get_aliased_rctl(handle, ALIAS_MAXPHYSMEM,
+ &tmp_mcap) == Z_OK ||
zonecfg_get_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM,
&tmp_mcap) == Z_OK) {
zerr(gettext("The %s resource or a related resource "
@@ -2170,7 +2253,6 @@ add_resource(cmd_t *cmd)
"to even the root user; "
"this could render the system impossible\n"
"to administer. Please use caution."));
- bzero(&in_progress_mcaptab, sizeof (in_progress_mcaptab));
return;
case RT_ADMIN:
bzero(&in_progress_admintab, sizeof (in_progress_admintab));
@@ -2273,6 +2355,68 @@ bad:
zonecfg_free_rctl_value_list(rctlvaltab);
}
+/*
+ * Resource attribute ("property" resource embedded on net or dev resource)
+ */
+static void
+do_res_attr(struct zone_res_attrtab **headp, complex_property_ptr_t cpp)
+{
+ complex_property_ptr_t cp;
+ struct zone_res_attrtab *np;
+ int err;
+ boolean_t seen_name = B_FALSE, seen_value = B_FALSE;
+
+ if ((np = calloc(1, sizeof (struct zone_res_attrtab))) == NULL) {
+ zone_perror(zone, Z_NOMEM, B_TRUE);
+ exit(Z_ERR);
+ }
+
+ for (cp = cpp; cp != NULL; cp = cp->cp_next) {
+ switch (cp->cp_type) {
+ case PT_NAME:
+ if (seen_name) {
+ zerr(gettext("%s already specified"),
+ pt_to_str(PT_NAME));
+ goto bad;
+ }
+ (void) strlcpy(np->zone_res_attr_name, cp->cp_value,
+ sizeof (np->zone_res_attr_name));
+ seen_name = B_TRUE;
+ break;
+ case PT_VALUE:
+ if (seen_value) {
+ zerr(gettext("%s already specified"),
+ pt_to_str(PT_VALUE));
+ goto bad;
+ }
+ (void) strlcpy(np->zone_res_attr_value, cp->cp_value,
+ sizeof (np->zone_res_attr_value));
+ seen_value = B_TRUE;
+ break;
+ default:
+ zone_perror(pt_to_str(PT_NPROP), Z_NO_PROPERTY_TYPE,
+ B_TRUE);
+ long_usage(CMD_ADD, B_TRUE);
+ usage(B_FALSE, HELP_PROPS);
+ zonecfg_free_res_attr_list(np);
+ return;
+ }
+ }
+
+ if (!seen_name)
+ zerr(gettext("%s not specified"), pt_to_str(PT_NAME));
+ if (!seen_value)
+ zerr(gettext("%s not specified"), pt_to_str(PT_VALUE));
+
+ err = zonecfg_add_res_attr(headp, np);
+ if (err != Z_OK)
+ zone_perror(pt_to_str(PT_NPROP), err, B_TRUE);
+ return;
+
+bad:
+ zonecfg_free_res_attr_list(np);
+}
+
static void
add_property(cmd_t *cmd)
{
@@ -2340,6 +2484,44 @@ add_property(cmd_t *cmd)
}
}
return;
+ case RT_NET:
+ if (prop_type != PT_NPROP) {
+ zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
+ B_TRUE);
+ long_usage(CMD_ADD, B_TRUE);
+ usage(B_FALSE, HELP_PROPS);
+ return;
+ }
+ pp = cmd->cmd_property_ptr[0];
+ if (pp->pv_type != PROP_VAL_COMPLEX) {
+ zerr(gettext("A %s value was expected here."),
+ pvt_to_str(PROP_VAL_COMPLEX));
+ saw_error = B_TRUE;
+ return;
+ }
+
+ do_res_attr(&(in_progress_nwiftab.zone_nwif_attrp),
+ pp->pv_complex);
+ return;
+ case RT_DEVICE:
+ if (prop_type != PT_NPROP) {
+ zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
+ B_TRUE);
+ long_usage(CMD_ADD, B_TRUE);
+ usage(B_FALSE, HELP_PROPS);
+ return;
+ }
+ pp = cmd->cmd_property_ptr[0];
+ if (pp->pv_type != PROP_VAL_COMPLEX) {
+ zerr(gettext("A %s value was expected here."),
+ pvt_to_str(PROP_VAL_COMPLEX));
+ saw_error = B_TRUE;
+ return;
+ }
+
+ do_res_attr(&(in_progress_devtab.zone_dev_attrp),
+ pp->pv_complex);
+ return;
case RT_RCTL:
if (prop_type != PT_VALUE) {
zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
@@ -2384,7 +2566,7 @@ static boolean_t
gz_invalid_rt_property(int type)
{
return (global_zone && (type == RT_ZONENAME || type == RT_ZONEPATH ||
- type == RT_AUTOBOOT || type == RT_LIMITPRIV ||
+ type == RT_AUTOBOOT || type == RT_LIMITPRIV || type == RT_UUID ||
type == RT_BOOTARGS || type == RT_BRAND || type == RT_SCHED ||
type == RT_IPTYPE || type == RT_HOSTID || type == RT_FS_ALLOWED));
}
@@ -2393,7 +2575,7 @@ static boolean_t
gz_invalid_property(int type)
{
return (global_zone && (type == PT_ZONENAME || type == PT_ZONEPATH ||
- type == PT_AUTOBOOT || type == PT_LIMITPRIV ||
+ type == PT_AUTOBOOT || type == PT_LIMITPRIV || type == PT_UUID ||
type == PT_BOOTARGS || type == PT_BRAND || type == PT_SCHED ||
type == PT_IPTYPE || type == PT_HOSTID || type == PT_FS_ALLOWED));
}
@@ -2444,8 +2626,9 @@ add_func(cmd_t *cmd)
resource_scope = cmd->cmd_res_type;
end_op = CMD_ADD;
add_resource(cmd);
- } else
+ } else {
add_property(cmd);
+ }
}
/*
@@ -2610,6 +2793,32 @@ fill_in_fstab(cmd_t *cmd, struct zone_fstab *fstab, boolean_t fill_in_only)
return (zonecfg_lookup_filesystem(handle, fstab));
}
+/*
+ * Turn an addr that looks like f:2:0:44:5:6C into 0f:02:00:44:05:6c
+ * We're expecting a dst of at least MAXMACADDRLEN size here.
+ */
+static void
+normalize_mac_addr(char *dst, const char *src, int len)
+{
+ char *p, *e, *sep = "";
+ long n;
+ char buf[MAXMACADDRLEN], tmp[4];
+
+ *dst = '\0';
+ (void) strlcpy(buf, src, sizeof (buf));
+ p = strtok(buf, ":");
+ while (p != NULL) {
+ n = strtol(p, &e, 16);
+ if (*e != NULL || n > 0xff)
+ return;
+ (void) snprintf(tmp, sizeof (tmp), "%s%02x", sep, n);
+ (void) strlcat(dst, tmp, len);
+
+ sep = ":";
+ p = strtok(NULL, ":");
+ }
+}
+
static int
fill_in_nwiftab(cmd_t *cmd, struct zone_nwiftab *nwiftab,
boolean_t fill_in_only)
@@ -2643,6 +2852,21 @@ fill_in_nwiftab(cmd_t *cmd, struct zone_nwiftab *nwiftab,
pp->pv_simple,
sizeof (nwiftab->zone_nwif_physical));
break;
+ case PT_MAC:
+ normalize_mac_addr(nwiftab->zone_nwif_mac,
+ pp->pv_simple,
+ sizeof (nwiftab->zone_nwif_mac));
+ break;
+ case PT_VLANID:
+ (void) strlcpy(nwiftab->zone_nwif_vlan_id,
+ pp->pv_simple,
+ sizeof (nwiftab->zone_nwif_vlan_id));
+ break;
+ case PT_GNIC:
+ (void) strlcpy(nwiftab->zone_nwif_gnic,
+ pp->pv_simple,
+ sizeof (nwiftab->zone_nwif_gnic));
+ break;
case PT_DEFROUTER:
(void) strlcpy(nwiftab->zone_nwif_defrouter,
pp->pv_simple,
@@ -3160,10 +3384,9 @@ remove_mcap()
{
int err, res1, res2, res3;
uint64_t tmp;
- struct zone_mcaptab mcaptab;
boolean_t revert = B_FALSE;
- res1 = zonecfg_lookup_mcap(handle, &mcaptab);
+ res1 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXPHYSMEM, &tmp);
res2 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, &tmp);
res3 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM, &tmp);
@@ -3175,13 +3398,15 @@ remove_mcap()
return;
}
if (res1 == Z_OK) {
- if ((err = zonecfg_delete_mcap(handle)) != Z_OK) {
+ if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_MAXPHYSMEM))
+ != Z_OK) {
z_cmd_rt_perror(CMD_REMOVE, RT_MCAP, err, B_TRUE);
revert = B_TRUE;
} else {
need_to_commit = B_TRUE;
}
}
+
if (res2 == Z_OK) {
if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_MAXSWAP))
!= Z_OK) {
@@ -3324,6 +3549,7 @@ remove_property(cmd_t *cmd)
int err, res_type, prop_type;
property_value_ptr_t pp;
struct zone_rctlvaltab *rctlvaltab;
+ struct zone_res_attrtab *np;
complex_property_ptr_t cx;
res_type = resource_scope;
@@ -3384,6 +3610,56 @@ remove_property(cmd_t *cmd)
}
}
return;
+ case RT_NET: /* FALLTHRU */
+ case RT_DEVICE:
+ if (prop_type != PT_NPROP) {
+ zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
+ B_TRUE);
+ long_usage(CMD_REMOVE, B_TRUE);
+ usage(B_FALSE, HELP_PROPS);
+ return;
+ }
+ pp = cmd->cmd_property_ptr[0];
+ if (pp->pv_type != PROP_VAL_COMPLEX) {
+ zerr(gettext("A %s value was expected here."),
+ pvt_to_str(PROP_VAL_COMPLEX));
+ saw_error = B_TRUE;
+ return;
+ }
+
+ np = alloca(sizeof (struct zone_res_attrtab));
+ for (cx = pp->pv_complex; cx != NULL; cx = cx->cp_next) {
+ switch (cx->cp_type) {
+ case PT_NAME:
+ (void) strlcpy(np->zone_res_attr_name,
+ cx->cp_value,
+ sizeof (np->zone_res_attr_name));
+ break;
+ case PT_VALUE:
+ (void) strlcpy(np->zone_res_attr_value,
+ cx->cp_value,
+ sizeof (np->zone_res_attr_value));
+ break;
+ default:
+ zone_perror(pt_to_str(prop_type),
+ Z_NO_PROPERTY_TYPE, B_TRUE);
+ long_usage(CMD_REMOVE, B_TRUE);
+ usage(B_FALSE, HELP_PROPS);
+ return;
+ }
+ }
+ np->zone_res_attr_next = NULL;
+
+ if (res_type == RT_NET) {
+ err = zonecfg_remove_res_attr(
+ &(in_progress_nwiftab.zone_nwif_attrp), np);
+ } else { /* RT_DEVICE */
+ err = zonecfg_remove_res_attr(
+ &(in_progress_devtab.zone_dev_attrp), np);
+ }
+ if (err != Z_OK)
+ zone_perror(pt_to_str(prop_type), err, B_TRUE);
+ return;
case RT_RCTL:
if (prop_type != PT_VALUE) {
zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
@@ -3436,18 +3712,6 @@ remove_property(cmd_t *cmd)
zone_perror(pt_to_str(prop_type), err, B_TRUE);
zonecfg_free_rctl_value_list(rctlvaltab);
return;
- case RT_NET:
- if (prop_type != PT_DEFROUTER) {
- zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
- B_TRUE);
- long_usage(CMD_REMOVE, B_TRUE);
- usage(B_FALSE, HELP_PROPS);
- return;
- } else {
- bzero(&in_progress_nwiftab.zone_nwif_defrouter,
- sizeof (in_progress_nwiftab.zone_nwif_defrouter));
- return;
- }
default:
zone_perror(rt_to_str(res_type), Z_NO_RESOURCE_TYPE, B_TRUE);
long_usage(CMD_REMOVE, B_TRUE);
@@ -3510,8 +3774,7 @@ clear_property(cmd_t *cmd)
case RT_MCAP:
switch (prop_type) {
case PT_PHYSICAL:
- in_progress_mcaptab.zone_physmem_cap[0] = '\0';
- need_to_commit = B_TRUE;
+ remove_aliased_rctl(PT_PHYSICAL, ALIAS_MAXPHYSMEM);
return;
case PT_SWAP:
remove_aliased_rctl(PT_SWAP, ALIAS_MAXSWAP);
@@ -3521,6 +3784,30 @@ clear_property(cmd_t *cmd)
return;
}
break;
+ case RT_NET:
+ switch (prop_type) {
+ case PT_ALLOWED_ADDRESS:
+ in_progress_nwiftab.zone_nwif_allowed_address[0] = '\0';
+ need_to_commit = B_TRUE;
+ return;
+ case PT_DEFROUTER:
+ in_progress_nwiftab.zone_nwif_defrouter[0] = '\0';
+ need_to_commit = B_TRUE;
+ return;
+ case PT_GNIC:
+ in_progress_nwiftab.zone_nwif_gnic[0] = '\0';
+ need_to_commit = B_TRUE;
+ return;
+ case PT_MAC:
+ in_progress_nwiftab.zone_nwif_mac[0] = '\0';
+ need_to_commit = B_TRUE;
+ return;
+ case PT_VLANID:
+ in_progress_nwiftab.zone_nwif_vlan_id[0] = '\0';
+ need_to_commit = B_TRUE;
+ return;
+ }
+ break;
default:
break;
}
@@ -3546,6 +3833,8 @@ clear_global(cmd_t *cmd)
/* FALLTHRU */
case PT_ZONEPATH:
/* FALLTHRU */
+ case PT_UUID:
+ /* FALLTHRU */
case PT_BRAND:
zone_perror(pt_to_str(type), Z_CLEAR_DISALLOW, B_TRUE);
return;
@@ -3608,6 +3897,9 @@ clear_global(cmd_t *cmd)
case PT_SHARES:
remove_aliased_rctl(PT_SHARES, ALIAS_SHARES);
return;
+ case PT_ZFSPRI:
+ remove_aliased_rctl(PT_ZFSPRI, ALIAS_ZFSPRI);
+ return;
case PT_HOSTID:
if ((err = zonecfg_set_hostid(handle, NULL)) != Z_OK)
z_cmd_rt_perror(CMD_CLEAR, RT_HOSTID, err, B_TRUE);
@@ -3653,7 +3945,7 @@ clear_func(cmd_t *cmd)
void
select_func(cmd_t *cmd)
{
- int type, err, res;
+ int type, err;
uint64_t limit;
uint64_t tmp;
@@ -3748,7 +4040,8 @@ select_func(cmd_t *cmd)
return;
case RT_MCAP:
/* if none of these exist, there is no resource to select */
- if ((res = zonecfg_lookup_mcap(handle, &old_mcaptab)) != Z_OK &&
+ if (zonecfg_get_aliased_rctl(handle, ALIAS_MAXPHYSMEM, &limit)
+ != Z_OK &&
zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, &limit)
!= Z_OK &&
zonecfg_get_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM, &limit)
@@ -3757,12 +4050,6 @@ select_func(cmd_t *cmd)
B_TRUE);
global_scope = B_TRUE;
}
- if (res == Z_OK)
- bcopy(&old_mcaptab, &in_progress_mcaptab,
- sizeof (struct zone_mcaptab));
- else
- bzero(&in_progress_mcaptab,
- sizeof (in_progress_mcaptab));
return;
case RT_ADMIN:
if ((err = fill_in_admintab(cmd, &old_admintab, B_FALSE))
@@ -4029,7 +4316,6 @@ set_func(cmd_t *cmd)
boolean_t autoboot;
zone_iptype_t iptype;
boolean_t force_set = B_FALSE;
- size_t physmem_size = sizeof (in_progress_mcaptab.zone_physmem_cap);
uint64_t mem_cap, mem_limit;
float cap;
char *unitp;
@@ -4104,6 +4390,10 @@ set_func(cmd_t *cmd)
res_type = RT_HOSTID;
} else if (prop_type == PT_FS_ALLOWED) {
res_type = RT_FS_ALLOWED;
+ } else if (prop_type == PT_ZFSPRI) {
+ res_type = RT_ZFSPRI;
+ } else if (prop_type == PT_UUID) {
+ res_type = RT_UUID;
} else {
zerr(gettext("Cannot set a resource-specific property "
"from the global scope."));
@@ -4133,10 +4423,12 @@ set_func(cmd_t *cmd)
* A nasty expression but not that complicated:
* 1. fs options are simple or list (tested below)
* 2. rctl value's are complex or list (tested below)
+ * 3. net attr's are complex (tested below)
* Anything else should be simple.
*/
if (!(res_type == RT_FS && prop_type == PT_OPTIONS) &&
!(res_type == RT_RCTL && prop_type == PT_VALUE) &&
+ !(res_type == RT_NET && prop_type == PT_NPROP) &&
(pp->pv_type != PROP_VAL_SIMPLE ||
(prop_id = pp->pv_simple) == NULL)) {
zerr(gettext("A %s value was expected here."),
@@ -4309,6 +4601,9 @@ set_func(cmd_t *cmd)
case RT_SHARES:
set_aliased_rctl(ALIAS_SHARES, prop_type, prop_id);
return;
+ case RT_ZFSPRI:
+ set_aliased_rctl(ALIAS_ZFSPRI, prop_type, prop_id);
+ return;
case RT_HOSTID:
if ((err = zonecfg_set_hostid(handle, prop_id)) != Z_OK) {
if (err == Z_TOO_BIG) {
@@ -4322,6 +4617,15 @@ set_func(cmd_t *cmd)
}
need_to_commit = B_TRUE;
return;
+ case RT_UUID:
+ /*
+ * We can't set here. We have to wait until commit since the
+ * uuid will be updating the index file and we may not have
+ * created the zone yet.
+ */
+ (void) strlcpy(new_uuid, prop_id, sizeof (new_uuid));
+ need_to_commit = B_TRUE;
+ return;
case RT_FS_ALLOWED:
if ((err = zonecfg_set_fs_allowed(handle, prop_id)) != Z_OK)
zone_perror(zone, err, B_TRUE);
@@ -4396,6 +4700,21 @@ set_func(cmd_t *cmd)
prop_id,
sizeof (in_progress_nwiftab.zone_nwif_physical));
break;
+ case PT_MAC:
+ normalize_mac_addr(in_progress_nwiftab.zone_nwif_mac,
+ prop_id,
+ sizeof (in_progress_nwiftab.zone_nwif_mac));
+ break;
+ case PT_VLANID:
+ (void) strlcpy(in_progress_nwiftab.zone_nwif_vlan_id,
+ prop_id,
+ sizeof (in_progress_nwiftab.zone_nwif_vlan_id));
+ break;
+ case PT_GNIC:
+ (void) strlcpy(in_progress_nwiftab.zone_nwif_gnic,
+ prop_id,
+ sizeof (in_progress_nwiftab.zone_nwif_gnic));
+ break;
case PT_DEFROUTER:
if (validate_net_address_syntax(prop_id, B_TRUE)
!= Z_OK) {
@@ -4406,6 +4725,20 @@ set_func(cmd_t *cmd)
prop_id,
sizeof (in_progress_nwiftab.zone_nwif_defrouter));
break;
+ case PT_NPROP:
+ if (pp->pv_type != PROP_VAL_COMPLEX) {
+ zerr(gettext("A %s value was expected here."),
+ pvt_to_str(PROP_VAL_COMPLEX));
+ saw_error = B_TRUE;
+ return;
+ }
+ zonecfg_free_res_attr_list(
+ in_progress_nwiftab.zone_nwif_attrp);
+ in_progress_nwiftab.zone_nwif_attrp = NULL;
+ if (!(pp->pv_type == PROP_VAL_LIST &&
+ pp->pv_list == NULL))
+ add_property(cmd);
+ break;
default:
zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
B_TRUE);
@@ -4421,6 +4754,20 @@ set_func(cmd_t *cmd)
prop_id,
sizeof (in_progress_devtab.zone_dev_match));
break;
+ case PT_NPROP:
+ if (pp->pv_type != PROP_VAL_COMPLEX) {
+ zerr(gettext("A %s value was expected here."),
+ pvt_to_str(PROP_VAL_COMPLEX));
+ saw_error = B_TRUE;
+ return;
+ }
+ zonecfg_free_res_attr_list(
+ in_progress_devtab.zone_dev_attrp);
+ in_progress_devtab.zone_dev_attrp = NULL;
+ if (!(pp->pv_type == PROP_VAL_LIST &&
+ pp->pv_list == NULL))
+ add_property(cmd);
+ break;
default:
zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
B_TRUE);
@@ -4581,18 +4928,30 @@ set_func(cmd_t *cmd)
case RT_MCAP:
switch (prop_type) {
case PT_PHYSICAL:
+ /*
+ * We have to check if an rctl is allowed here since
+ * there might already be a rctl defined that blocks
+ * the alias.
+ */
+ if (!zonecfg_aliased_rctl_ok(handle,
+ ALIAS_MAXPHYSMEM)) {
+ zone_perror(pt_to_str(PT_LOCKED),
+ Z_ALIAS_DISALLOW, B_FALSE);
+ saw_error = B_TRUE;
+ return;
+ }
+
if (!zonecfg_valid_memlimit(prop_id, &mem_cap)) {
- zerr(gettext("A positive number with a "
+ zerr(gettext("A non-negative number with a "
"required scale suffix (K, M, G or T) was "
- "expected here."));
- saw_error = B_TRUE;
- } else if (mem_cap < ONE_MB) {
- zerr(gettext("%s value is too small. It must "
- "be at least 1M."), pt_to_str(PT_PHYSICAL));
+ "expected\nhere."));
saw_error = B_TRUE;
} else {
- snprintf(in_progress_mcaptab.zone_physmem_cap,
- physmem_size, "%llu", mem_cap);
+ if ((err = zonecfg_set_aliased_rctl(handle,
+ ALIAS_MAXPHYSMEM, mem_cap)) != Z_OK)
+ zone_perror(zone, err, B_TRUE);
+ else
+ need_to_commit = B_TRUE;
}
break;
case PT_SWAP:
@@ -4864,6 +5223,23 @@ info_hostid(zone_dochandle_t handle, FILE *fp)
}
static void
+info_uuid(FILE *fp)
+{
+ uuid_t uuid;
+ char suuid[UUID_PRINTABLE_STRING_LENGTH];
+
+ if (new_uuid[0] != '\0') {
+ (void) fprintf(fp, "%s: %s\n", pt_to_str(PT_UUID), new_uuid);
+ } else if (zonecfg_get_uuid(zone, uuid) == Z_OK &&
+ !uuid_is_null(uuid)) {
+ uuid_unparse(uuid, suuid);
+ (void) fprintf(fp, "%s: %s\n", pt_to_str(PT_UUID), suuid);
+ } else {
+ (void) fprintf(fp, "%s:\n", pt_to_str(PT_UUID));
+ }
+}
+
+static void
info_fs_allowed(zone_dochandle_t handle, FILE *fp)
{
char fsallowedp[ZONE_FS_ALLOWED_MAX];
@@ -4945,12 +5321,25 @@ loopend:
static void
output_net(FILE *fp, struct zone_nwiftab *nwiftab)
{
+ struct zone_res_attrtab *np;
+
(void) fprintf(fp, "%s:\n", rt_to_str(RT_NET));
output_prop(fp, PT_ADDRESS, nwiftab->zone_nwif_address, B_TRUE);
output_prop(fp, PT_ALLOWED_ADDRESS,
nwiftab->zone_nwif_allowed_address, B_TRUE);
- output_prop(fp, PT_PHYSICAL, nwiftab->zone_nwif_physical, B_TRUE);
output_prop(fp, PT_DEFROUTER, nwiftab->zone_nwif_defrouter, B_TRUE);
+ output_prop(fp, PT_GNIC, nwiftab->zone_nwif_gnic, B_TRUE);
+ output_prop(fp, PT_MAC, nwiftab->zone_nwif_mac, B_TRUE);
+ output_prop(fp, PT_PHYSICAL, nwiftab->zone_nwif_physical, B_TRUE);
+ output_prop(fp, PT_VLANID, nwiftab->zone_nwif_vlan_id, B_TRUE);
+
+ for (np = nwiftab->zone_nwif_attrp; np != NULL;
+ np = np->zone_res_attr_next) {
+ fprintf(fp, "\t%s: (%s=%s,%s=\"%s\")\n",
+ pt_to_str(PT_NPROP),
+ pt_to_str(PT_NAME), np->zone_res_attr_name,
+ pt_to_str(PT_VALUE), np->zone_res_attr_value);
+ }
}
static void
@@ -4993,8 +5382,18 @@ info_net(zone_dochandle_t handle, FILE *fp, cmd_t *cmd)
static void
output_dev(FILE *fp, struct zone_devtab *devtab)
{
+ struct zone_res_attrtab *np;
+
(void) fprintf(fp, "%s:\n", rt_to_str(RT_DEVICE));
output_prop(fp, PT_MATCH, devtab->zone_dev_match, B_TRUE);
+
+ for (np = devtab->zone_dev_attrp; np != NULL;
+ np = np->zone_res_attr_next) {
+ fprintf(fp, "\t%s: (%s=%s,%s=\"%s\")\n",
+ pt_to_str(PT_NPROP),
+ pt_to_str(PT_NAME), np->zone_res_attr_name,
+ pt_to_str(PT_VALUE), np->zone_res_attr_value);
+ }
}
static void
@@ -5253,15 +5652,18 @@ bytes_to_units(char *str, char *buf, int bufsize)
}
static void
-output_mcap(FILE *fp, struct zone_mcaptab *mcaptab, int showswap,
+output_mcap(FILE *fp, int showphys, uint64_t maxphys, int showswap,
uint64_t maxswap, int showlocked, uint64_t maxlocked)
{
char buf[128];
(void) fprintf(fp, "%s:\n", rt_to_str(RT_MCAP));
- if (mcaptab->zone_physmem_cap[0] != '\0') {
- bytes_to_units(mcaptab->zone_physmem_cap, buf, sizeof (buf));
- output_prop(fp, PT_PHYSICAL, buf, B_TRUE);
+
+ if (showphys == Z_OK) {
+ (void) snprintf(buf, sizeof (buf), "%llu", maxphys);
+ bytes_to_units(buf, buf, sizeof (buf));
+ /* Print directly since "physical" also is a net property. */
+ (void) fprintf(fp, "\t[%s: %s]\n", pt_to_str(PT_PHYSICAL), buf);
}
if (showswap == Z_OK) {
@@ -5283,16 +5685,16 @@ info_mcap(zone_dochandle_t handle, FILE *fp)
int res1, res2, res3;
uint64_t swap_limit;
uint64_t locked_limit;
- struct zone_mcaptab lookup;
+ uint64_t phys_limit;
- bzero(&lookup, sizeof (lookup));
- res1 = zonecfg_getmcapent(handle, &lookup);
+ res1 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXPHYSMEM, &phys_limit);
res2 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, &swap_limit);
res3 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM,
&locked_limit);
if (res1 == Z_OK || res2 == Z_OK || res3 == Z_OK)
- output_mcap(fp, &lookup, res2, swap_limit, res3, locked_limit);
+ output_mcap(fp, res1, phys_limit, res2, swap_limit,
+ res3, locked_limit);
}
static void
@@ -5344,9 +5746,10 @@ info_func(cmd_t *cmd)
boolean_t need_to_close = B_FALSE;
char *pager, *space;
int type;
- int res1, res2;
+ int res1, res2, res3;
uint64_t swap_limit;
uint64_t locked_limit;
+ uint64_t phys_limit;
struct stat statbuf;
assert(cmd != NULL);
@@ -5407,7 +5810,9 @@ info_func(cmd_t *cmd)
&swap_limit);
res2 = zonecfg_get_aliased_rctl(handle,
ALIAS_MAXLOCKEDMEM, &locked_limit);
- output_mcap(fp, &in_progress_mcaptab, res1, swap_limit,
+ res3 = zonecfg_get_aliased_rctl(handle,
+ ALIAS_MAXPHYSMEM, &phys_limit);
+ output_mcap(fp, res3, phys_limit, res1, swap_limit,
res2, locked_limit);
break;
case RT_ADMIN:
@@ -5447,6 +5852,7 @@ info_func(cmd_t *cmd)
info_iptype(handle, fp);
info_hostid(handle, fp);
info_fs_allowed(handle, fp);
+ info_uuid(fp);
}
info_aliased_rctl(handle, fp, ALIAS_MAXLWPS);
info_aliased_rctl(handle, fp, ALIAS_MAXPROCS);
@@ -5455,6 +5861,7 @@ info_func(cmd_t *cmd)
info_aliased_rctl(handle, fp, ALIAS_MAXMSGIDS);
info_aliased_rctl(handle, fp, ALIAS_MAXSEMIDS);
info_aliased_rctl(handle, fp, ALIAS_SHARES);
+ info_aliased_rctl(handle, fp, ALIAS_ZFSPRI);
if (!global_zone) {
info_fs(handle, fp, cmd);
info_net(handle, fp, cmd);
@@ -5518,6 +5925,9 @@ info_func(cmd_t *cmd)
case RT_SHARES:
info_aliased_rctl(handle, fp, ALIAS_SHARES);
break;
+ case RT_ZFSPRI:
+ info_aliased_rctl(handle, fp, ALIAS_ZFSPRI);
+ break;
case RT_FS:
info_fs(handle, fp, cmd);
break;
@@ -5548,6 +5958,9 @@ info_func(cmd_t *cmd)
case RT_HOSTID:
info_hostid(handle, fp);
break;
+ case RT_UUID:
+ info_uuid(fp);
+ break;
case RT_ADMIN:
info_auth(handle, fp, cmd);
break;
@@ -6015,11 +6428,29 @@ verify_func(cmd_t *cmd)
if (save) {
if (ret_val == Z_OK) {
+ /*
+ * If the zone doesn't yet have a debug ID, set one now.
+ */
+ if (zonecfg_get_did(handle) == -1)
+ zonecfg_set_did(handle);
+
if ((ret_val = zonecfg_save(handle)) == Z_OK) {
need_to_commit = B_FALSE;
(void) strlcpy(revert_zone, zone,
sizeof (revert_zone));
}
+
+ /*
+ * Commit a new uuid at this point since we now know the
+ * zone index entry will exist.
+ */
+ if (new_uuid[0] != '\0') {
+ if ((err = zonecfg_set_uuid(zone, zonepath,
+ new_uuid)) != Z_OK)
+ zone_perror(zone, err, B_FALSE);
+ else
+ new_uuid[0] = '\0';
+ }
} else {
zerr(gettext("Zone %s failed to verify"), zone);
}
@@ -6189,6 +6620,7 @@ end_func(cmd_t *cmd)
int err, arg, res1, res2, res3;
uint64_t swap_limit;
uint64_t locked_limit;
+ uint64_t phys_limit;
uint64_t proc_cap;
assert(cmd != NULL);
@@ -6492,8 +6924,8 @@ end_func(cmd_t *cmd)
break;
case RT_MCAP:
/* Make sure everything was filled in. */
- res1 = strlen(in_progress_mcaptab.zone_physmem_cap) == 0 ?
- Z_ERR : Z_OK;
+ res1 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXPHYSMEM,
+ &phys_limit);
res2 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP,
&swap_limit);
res3 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM,
@@ -6509,11 +6941,6 @@ end_func(cmd_t *cmd)
/* if phys & locked are both set, verify locked <= phys */
if (res1 == Z_OK && res3 == Z_OK) {
- uint64_t phys_limit;
- char *endp;
-
- phys_limit = strtoull(
- in_progress_mcaptab.zone_physmem_cap, &endp, 10);
if (phys_limit < locked_limit) {
zerr(gettext("The %s cap must be less than or "
"equal to the %s cap."),
@@ -6525,23 +6952,6 @@ end_func(cmd_t *cmd)
}
err = Z_OK;
- if (res1 == Z_OK) {
- /*
- * We could be ending from either an add operation
- * or a select operation. Since all of the properties
- * within this resource are optional, we always use
- * modify on the mcap entry. zonecfg_modify_mcap()
- * will handle both adding and modifying a memory cap.
- */
- err = zonecfg_modify_mcap(handle, &in_progress_mcaptab);
- } else if (end_op == CMD_SELECT) {
- /*
- * If we're ending from a select and the physical
- * memory cap is empty then the user could have cleared
- * the physical cap value, so try to delete the entry.
- */
- (void) zonecfg_delete_mcap(handle);
- }
break;
case RT_ADMIN:
/* First make sure everything was filled in. */
@@ -7090,8 +7500,10 @@ get_execbasename(char *execfullname)
int
main(int argc, char *argv[])
{
- int err, arg;
+ int err, arg, uflag = 0, zflag = 0;
struct stat st;
+ uuid_t uuidin;
+ char zonename[ZONENAME_MAX + 1];
/* This must be before anything goes to stdout. */
setbuf(stdout, NULL);
@@ -7118,7 +7530,7 @@ main(int argc, char *argv[])
exit(Z_OK);
}
- while ((arg = getopt(argc, argv, "?f:R:z:")) != EOF) {
+ while ((arg = getopt(argc, argv, "?f:R:z:u:")) != EOF) {
switch (arg) {
case '?':
if (optopt == '?')
@@ -7145,6 +7557,21 @@ main(int argc, char *argv[])
}
zonecfg_set_root(optarg);
break;
+ case 'u':
+ if (uuid_parse((char *)optarg, uuidin) == -1)
+ return (Z_INVALID_PROPERTY);
+
+ if (zonecfg_get_name_by_uuid(uuidin, zonename,
+ ZONENAME_MAX) != Z_OK) {
+ zone_perror(optarg, Z_BOGUS_ZONE_NAME, B_TRUE);
+ usage(B_FALSE, HELP_SYNTAX);
+ exit(Z_USAGE);
+ }
+
+ (void) strlcpy(zone, zonename, sizeof (zone));
+ (void) strlcpy(revert_zone, zonename, sizeof (zone));
+ uflag = 1;
+ break;
case 'z':
if (strcmp(optarg, GLOBAL_ZONENAME) == 0) {
global_zone = B_TRUE;
@@ -7155,6 +7582,7 @@ main(int argc, char *argv[])
}
(void) strlcpy(zone, optarg, sizeof (zone));
(void) strlcpy(revert_zone, optarg, sizeof (zone));
+ zflag = 1;
break;
default:
usage(B_FALSE, HELP_USAGE);
@@ -7162,7 +7590,7 @@ main(int argc, char *argv[])
}
}
- if (optind > argc || strcmp(zone, "") == 0) {
+ if (optind > argc || strcmp(zone, "") == 0 || (uflag && zflag)) {
usage(B_FALSE, HELP_USAGE);
exit(Z_USAGE);
}
diff --git a/usr/src/cmd/zonecfg/zonecfg.h b/usr/src/cmd/zonecfg/zonecfg.h
index d8f8b14ce8..f8c78437ad 100644
--- a/usr/src/cmd/zonecfg/zonecfg.h
+++ b/usr/src/cmd/zonecfg/zonecfg.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#ifndef _ZONECFG_H
@@ -90,9 +91,11 @@ extern "C" {
#define RT_ADMIN 26
#define RT_FS_ALLOWED 27
#define RT_MAXPROCS 28 /* really a rctl alias property, but for info */
+#define RT_ZFSPRI 29 /* really a rctl alias property, but for info */
+#define RT_UUID 30 /* really a property, but for info */
#define RT_MIN RT_UNKNOWN
-#define RT_MAX RT_MAXPROCS
+#define RT_MAX RT_UUID
/* property types: increment PT_MAX when expanding this list */
#define PT_UNKNOWN 0
@@ -137,9 +140,15 @@ extern "C" {
#define PT_FS_ALLOWED 39
#define PT_MAXPROCS 40
#define PT_ALLOWED_ADDRESS 41
+#define PT_ZFSPRI 42
+#define PT_MAC 43
+#define PT_VLANID 44
+#define PT_GNIC 45
+#define PT_NPROP 46
+#define PT_UUID 47
#define PT_MIN PT_UNKNOWN
-#define PT_MAX PT_ALLOWED_ADDRESS
+#define PT_MAX PT_UUID
#define MAX_EQ_PROP_PAIRS 3
diff --git a/usr/src/cmd/zonecfg/zonecfg_grammar.y b/usr/src/cmd/zonecfg/zonecfg_grammar.y
index d7f11b6a46..4e82c75e66 100644
--- a/usr/src/cmd/zonecfg/zonecfg_grammar.y
+++ b/usr/src/cmd/zonecfg/zonecfg_grammar.y
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
/*
@@ -136,6 +137,7 @@ complex_piece_func(int cp_type, const char *str, complex_property_ptr_t cp_next)
%token OPEN_PAREN CLOSE_PAREN COMMA DATASET LIMITPRIV BOOTARGS BRAND PSET PCAP
%token MCAP NCPUS IMPORTANCE SHARES MAXLWPS MAXSHMMEM MAXSHMIDS MAXMSGIDS
%token MAXSEMIDS LOCKED SWAP SCHED CLEAR DEFROUTER ADMIN USER AUTHS MAXPROCS
+%token ZFSPRI MAC VLANID GNIC NPROP UUID
%type <strval> TOKEN EQUAL OPEN_SQ_BRACKET CLOSE_SQ_BRACKET
property_value OPEN_PAREN CLOSE_PAREN COMMA simple_prop_val
@@ -145,7 +147,7 @@ complex_piece_func(int cp_type, const char *str, complex_property_ptr_t cp_next)
%type <ival> property_name SPECIAL RAW DIR OPTIONS TYPE ADDRESS PHYSICAL NAME
MATCH ZONENAME ZONEPATH AUTOBOOT POOL LIMITPRIV BOOTARGS VALUE PRIV LIMIT
ACTION BRAND SCHED IPTYPE DEFROUTER HOSTID USER AUTHS FS_ALLOWED
- ALLOWED_ADDRESS
+ ALLOWED_ADDRESS MAC VLANID GNIC NPROP UUID
%type <cmd> command
%type <cmd> add_command ADD
%type <cmd> cancel_command CANCEL
@@ -650,6 +652,24 @@ info_command: INFO
$$->cmd_res_type = RT_FS_ALLOWED;
$$->cmd_prop_nv_pairs = 0;
}
+ | INFO UUID
+ {
+ if (($$ = alloc_cmd()) == NULL)
+ YYERROR;
+ cmd = $$;
+ $$->cmd_handler = &info_func;
+ $$->cmd_res_type = RT_UUID;
+ $$->cmd_prop_nv_pairs = 0;
+ }
+ | INFO ZFSPRI
+ {
+ if (($$ = alloc_cmd()) == NULL)
+ YYERROR;
+ cmd = $$;
+ $$->cmd_handler = &info_func;
+ $$->cmd_res_type = RT_ZFSPRI;
+ $$->cmd_prop_nv_pairs = 0;
+ }
| INFO resource_type property_name EQUAL property_value
{
if (($$ = alloc_cmd()) == NULL)
@@ -976,6 +996,10 @@ property_name: SPECIAL { $$ = PT_SPECIAL; }
| ALLOWED_ADDRESS { $$ = PT_ALLOWED_ADDRESS; }
| PHYSICAL { $$ = PT_PHYSICAL; }
| DEFROUTER { $$ = PT_DEFROUTER; }
+ | MAC { $$ = PT_MAC; }
+ | VLANID { $$ = PT_VLANID; }
+ | GNIC { $$ = PT_GNIC; }
+ | NPROP { $$ = PT_NPROP; }
| NAME { $$ = PT_NAME; }
| VALUE { $$ = PT_VALUE; }
| MATCH { $$ = PT_MATCH; }
@@ -999,6 +1023,8 @@ property_name: SPECIAL { $$ = PT_SPECIAL; }
| USER { $$ = PT_USER; }
| AUTHS { $$ = PT_AUTHS; }
| FS_ALLOWED { $$ = PT_FS_ALLOWED; }
+ | UUID { $$ = PT_UUID; }
+ | ZFSPRI { $$ = PT_ZFSPRI; }
/*
* The grammar builds data structures from the bottom up. Thus various
diff --git a/usr/src/cmd/zonecfg/zonecfg_lex.l b/usr/src/cmd/zonecfg/zonecfg_lex.l
index 6a0b577b75..328a75c922 100644
--- a/usr/src/cmd/zonecfg/zonecfg_lex.l
+++ b/usr/src/cmd/zonecfg/zonecfg_lex.l
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#include <assert.h>
@@ -57,10 +58,11 @@ extern void yyerror(char *s);
static char *create_token(char *s);
%}
-%a 7000
+%a 8000
%p 5000
%e 2000
%n 1000
+%o 13000
%{
/*
@@ -236,6 +238,18 @@ static char *create_token(char *s);
<TSTATE>defrouter { return DEFROUTER; }
<CSTATE>defrouter { return DEFROUTER; }
+<TSTATE>mac-addr { return MAC; }
+<CSTATE>mac-addr { return MAC; }
+
+<TSTATE>vlan-id { return VLANID; }
+<CSTATE>vlan-id { return VLANID; }
+
+<TSTATE>global-nic { return GNIC; }
+<CSTATE>global-nic { return GNIC; }
+
+<TSTATE>property { return NPROP; }
+<CSTATE>property { return NPROP; }
+
<TSTATE>dir { return DIR; }
<CSTATE>dir { return DIR; }
@@ -308,6 +322,12 @@ static char *create_token(char *s);
<TSTATE>fs-allowed { return FS_ALLOWED; }
<CSTATE>fs-allowed { return FS_ALLOWED; }
+<TSTATE>uuid { return UUID; }
+<CSTATE>uuid { return UUID; }
+
+<TSTATE>zfs-io-priority { return ZFSPRI; }
+<CSTATE>zfs-io-priority { return ZFSPRI; }
+
<TSTATE>= { return EQUAL; }
<LSTATE>= { return EQUAL; }
<CSTATE>= { return EQUAL; }
@@ -357,6 +377,13 @@ static char *create_token(char *s);
return TOKEN;
}
+<CSTATE>\"[^\"\n]*[\"\n] {
+ yylval.strval = create_token(yytext + 1);
+ if (yylval.strval[yyleng - 2] == '"')
+ yylval.strval[yyleng - 2] = 0;
+ return TOKEN;
+ }
+
<TSTATE>\"[^\"\n]*[\"\n] {
yylval.strval = create_token(yytext + 1);
if (yylval.strval[yyleng - 2] == '"')
diff --git a/usr/src/cmd/zonestat/zonestatd/Makefile b/usr/src/cmd/zonestat/zonestatd/Makefile
index 656ba2e95b..833103e197 100644
--- a/usr/src/cmd/zonestat/zonestatd/Makefile
+++ b/usr/src/cmd/zonestat/zonestatd/Makefile
@@ -33,9 +33,10 @@ ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
SRCS = zonestatd.c
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/libxml2
+LDLIBS += -lkstat -lpool -lexacct -lscf \
+ -lcontract -lcmdutils -lumem
CPPFLAGS += -I/usr/include/libxml2
-LDLIBS += -lkstat -lpool -lexacct -lscf \
- -lcontract -lcmdutils -lumem
LINTFLAGS += -u
CERRWARN += -_gcc=-Wno-parentheses
diff --git a/usr/src/cmd/zonestat/zonestatd/zonestatd.c b/usr/src/cmd/zonestat/zonestatd/zonestatd.c
index b764551131..6c293bcc0e 100644
--- a/usr/src/cmd/zonestat/zonestatd/zonestatd.c
+++ b/usr/src/cmd/zonestat/zonestatd/zonestatd.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#include <alloca.h>
#include <assert.h>
@@ -2190,7 +2191,7 @@ zsd_get_zone_rctl_usage(char *name)
return (rctlblk_get_value(rblk));
}
-#define ZSD_NUM_RCTL_VALS 19
+#define ZSD_NUM_RCTL_VALS 20
/*
* Fetch the limit information for a zone. This uses zone_enter() as the
@@ -2237,12 +2238,6 @@ zsd_get_zone_caps(zsd_ctl_t *ctl, zsd_zone_t *zone, uint64_t *cpu_shares,
*msgids = 0;
*lofi = 0;
- /* Get the ram cap first since it is a zone attr */
- ret = zone_getattr(zone->zsz_id, ZONE_ATTR_PHYS_MCAP,
- ram_cap, sizeof (*ram_cap));
- if (ret < 0 || *ram_cap == 0)
- *ram_cap = ZS_LIMIT_NONE;
-
/* Get the zone's default scheduling class */
ret = zone_getattr(zone->zsz_id, ZONE_ATTR_SCHED_CLASS,
class, sizeof (class));
@@ -2298,6 +2293,7 @@ zsd_get_zone_caps(zsd_ctl_t *ctl, zsd_zone_t *zone, uint64_t *cpu_shares,
vals[i++] = zsd_get_zone_rctl_usage("zone.max-msg-ids");
vals[i++] = zsd_get_zone_rctl_limit("zone.max-lofi");
vals[i++] = zsd_get_zone_rctl_usage("zone.max-lofi");
+ vals[i++] = zsd_get_zone_rctl_usage("zone.max-physical-memory");
if (write(p[1], vals, ZSD_NUM_RCTL_VALS * sizeof (uint64_t)) !=
ZSD_NUM_RCTL_VALS * sizeof (uint64_t)) {
@@ -2342,6 +2338,7 @@ zsd_get_zone_caps(zsd_ctl_t *ctl, zsd_zone_t *zone, uint64_t *cpu_shares,
*msgids = vals[i++];
*lofi_cap = vals[i++];
*lofi = vals[i++];
+ *ram_cap = vals[i++];
/* Interpret maximum values as no cap */
if (*cpu_cap == UINT32_MAX || *cpu_cap == 0)
diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c
index b1326e962f..310c33462a 100644
--- a/usr/src/cmd/zpool/zpool_main.c
+++ b/usr/src/cmd/zpool/zpool_main.c
@@ -24,6 +24,7 @@
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2012 by Frederik Wessels. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <assert.h>
@@ -226,7 +227,7 @@ get_usage(zpool_help_t idx) {
return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval "
"[count]]\n"));
case HELP_LIST:
- return (gettext("\tlist [-H] [-o property[,...]] "
+ return (gettext("\tlist [-Hp] [-o property[,...]] "
"[-T d|u] [pool] ... [interval [count]]\n"));
case HELP_OFFLINE:
return (gettext("\toffline [-t] <pool> <device> ...\n"));
@@ -249,7 +250,7 @@ get_usage(zpool_help_t idx) {
"\tupgrade -v\n"
"\tupgrade [-V version] <-a | pool ...>\n"));
case HELP_GET:
- return (gettext("\tget <\"all\" | property[,...]> "
+ return (gettext("\tget [-p] <\"all\" | property[,...]> "
"<pool> ...\n"));
case HELP_SET:
return (gettext("\tset <property=value> <pool> \n"));
@@ -2592,8 +2593,9 @@ zpool_do_iostat(int argc, char **argv)
typedef struct list_cbdata {
boolean_t cb_verbose;
- int cb_namewidth;
+ boolean_t cb_namewidth;
boolean_t cb_scripted;
+ boolean_t cb_literal;
zprop_list_t *cb_proplist;
} list_cbdata_t;
@@ -2690,7 +2692,7 @@ print_pool(zpool_handle_t *zhp, list_cbdata_t *cb)
zpool_get_prop_int(zhp, pl->pl_prop, NULL) == 0)
propstr = "-";
else if (zpool_get_prop(zhp, pl->pl_prop, property,
- sizeof (property), NULL) != 0)
+ sizeof (property), NULL, cb->cb_literal) != 0)
propstr = "-";
else
propstr = property;
@@ -2841,12 +2843,13 @@ list_callback(zpool_handle_t *zhp, void *data)
}
/*
- * zpool list [-H] [-o prop[,prop]*] [-T d|u] [pool] ... [interval [count]]
+ * zpool list [-Hp] [-o prop[,prop]*] [-T d|u] [pool] ... [interval [count]]
*
* -H Scripted mode. Don't display headers, and separate properties
* by a single tab.
* -o List of properties to display. Defaults to
* "name,size,allocated,free,capacity,health,altroot"
+ * -p Display values in parsable (literal) format.
* -T Display a timestamp in date(1) or Unix format
*
* List all pools in the system, whether or not they're healthy. Output space
@@ -2867,7 +2870,7 @@ zpool_do_list(int argc, char **argv)
boolean_t first = B_TRUE;
/* check options */
- while ((c = getopt(argc, argv, ":Ho:T:v")) != -1) {
+ while ((c = getopt(argc, argv, ":Hpo:T:v")) != -1) {
switch (c) {
case 'H':
cb.cb_scripted = B_TRUE;
@@ -2875,6 +2878,9 @@ zpool_do_list(int argc, char **argv)
case 'o':
props = optarg;
break;
+ case 'p':
+ cb.cb_literal = B_TRUE;
+ break;
case 'T':
get_timestamp_arg(*optarg);
break;
@@ -4953,7 +4959,7 @@ get_callback(zpool_handle_t *zhp, void *data)
}
} else {
if (zpool_get_prop(zhp, pl->pl_prop, value,
- sizeof (value), &srctype) != 0)
+ sizeof (value), &srctype, cbp->cb_literal) != 0)
continue;
zprop_print_one_property(zpool_get_name(zhp), cbp,
@@ -4970,6 +4976,20 @@ zpool_do_get(int argc, char **argv)
zprop_get_cbdata_t cb = { 0 };
zprop_list_t fake_name = { 0 };
int ret;
+ char c;
+
+ /* check options */
+ while ((c = getopt(argc, argv, ":p")) != -1) {
+ switch (c) {
+ case 'p':
+ cb.cb_literal = B_TRUE;
+ break;
+ case '?':
+ (void) fprintf(stderr, gettext("invalid option '%c'\n"),
+ optopt);
+ usage(B_FALSE);
+ }
+ }
if (argc < 2) {
(void) fprintf(stderr, gettext("missing property "
diff --git a/usr/src/common/ctf/ctf_create.c b/usr/src/common/ctf/ctf_create.c
index a4f3df34e8..5b847c9d01 100644
--- a/usr/src/common/ctf/ctf_create.c
+++ b/usr/src/common/ctf/ctf_create.c
@@ -24,13 +24,15 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#include <sys/sysmacros.h>
#include <sys/param.h>
#include <sys/mman.h>
#include <ctf_impl.h>
+#include <sys/debug.h>
/*
* This static string is used as the template for initially populating a
@@ -167,6 +169,51 @@ ctf_copy_membnames(ctf_dtdef_t *dtd, uchar_t *s)
}
/*
+ * Only types of dyanmic CTF containers contain reference counts. These
+ * containers are marked RD/WR. Because of that we basically make this a no-op
+ * for compatability with non-dynamic CTF sections. This is also a no-op for
+ * types which are not dynamic types. It is the responsibility of the caller to
+ * make sure it is a valid type. We help that caller out on debug builds.
+ *
+ * Note that the reference counts are not maintained for types that are not
+ * within this container. In other words if we have a type in a parent, that
+ * will not have its reference count increased. On the flip side, the parent
+ * will not be allowed to remove dynamic types if it has children.
+ */
+static void
+ctf_ref_inc(ctf_file_t *fp, ctf_id_t tid)
+{
+ ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid);
+
+ if (dtd == NULL)
+ return;
+
+ if (!(fp->ctf_flags & LCTF_RDWR))
+ return;
+
+ dtd->dtd_ref++;
+}
+
+/*
+ * Just as with ctf_ref_inc, this is a no-op on non-writeable containers and the
+ * caller should ensure that this is already a valid type.
+ */
+static void
+ctf_ref_dec(ctf_file_t *fp, ctf_id_t tid)
+{
+ ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid);
+
+ if (dtd == NULL)
+ return;
+
+ if (!(fp->ctf_flags & LCTF_RDWR))
+ return;
+
+ ASSERT(dtd->dtd_ref >= 1);
+ dtd->dtd_ref--;
+}
+
+/*
* If the specified CTF container is writable and has been modified, reload
* this container with the updated type definitions. In order to make this
* code and the rest of libctf as simple as possible, we perform updates by
@@ -180,6 +227,10 @@ ctf_copy_membnames(ctf_dtdef_t *dtd, uchar_t *s)
* ctf_bufopen() will return a new ctf_file_t, but we want to keep the fp
* constant for the caller, so after ctf_bufopen() returns, we use bcopy to
* swap the interior of the old and new ctf_file_t's, and then free the old.
+ *
+ * Note that the lists of dynamic types stays around and the resulting container
+ * is still writeable. Furthermore, the reference counts that are on the dtd's
+ * are still valid.
*/
int
ctf_update(ctf_file_t *fp)
@@ -432,6 +483,7 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef_t *dtd)
ctf_dtdef_t *p, **q = &fp->ctf_dthash[h];
ctf_dmdef_t *dmd, *nmd;
size_t len;
+ int kind, i;
for (p = *q; p != NULL; p = p->dtd_hash) {
if (p != dtd)
@@ -443,7 +495,8 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef_t *dtd)
if (p != NULL)
*q = p->dtd_hash;
- switch (CTF_INFO_KIND(dtd->dtd_data.ctt_info)) {
+ kind = CTF_INFO_KIND(dtd->dtd_data.ctt_info);
+ switch (kind) {
case CTF_K_STRUCT:
case CTF_K_UNION:
case CTF_K_ENUM:
@@ -454,14 +507,33 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef_t *dtd)
ctf_free(dmd->dmd_name, len);
fp->ctf_dtstrlen -= len;
}
+ if (kind != CTF_K_ENUM)
+ ctf_ref_dec(fp, dmd->dmd_type);
nmd = ctf_list_next(dmd);
ctf_free(dmd, sizeof (ctf_dmdef_t));
}
break;
case CTF_K_FUNCTION:
+ ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
+ for (i = 0; i < CTF_INFO_VLEN(dtd->dtd_data.ctt_info); i++)
+ if (dtd->dtd_u.dtu_argv[i] != 0)
+ ctf_ref_dec(fp, dtd->dtd_u.dtu_argv[i]);
ctf_free(dtd->dtd_u.dtu_argv, sizeof (ctf_id_t) *
CTF_INFO_VLEN(dtd->dtd_data.ctt_info));
break;
+ case CTF_K_ARRAY:
+ ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_contents);
+ ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_index);
+ break;
+ case CTF_K_TYPEDEF:
+ ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
+ break;
+ case CTF_K_POINTER:
+ case CTF_K_VOLATILE:
+ case CTF_K_CONST:
+ case CTF_K_RESTRICT:
+ ctf_ref_dec(fp, dtd->dtd_data.ctt_type);
+ break;
}
if (dtd->dtd_name) {
@@ -495,7 +567,9 @@ ctf_dtd_lookup(ctf_file_t *fp, ctf_id_t type)
* Discard all of the dynamic type definitions that have been added to the
* container since the last call to ctf_update(). We locate such types by
* scanning the list and deleting elements that have type IDs greater than
- * ctf_dtoldid, which is set by ctf_update(), above.
+ * ctf_dtoldid, which is set by ctf_update(), above. Note that to work properly
+ * with our reference counting schemes, we must delete the dynamic list in
+ * reverse.
*/
int
ctf_discard(ctf_file_t *fp)
@@ -508,11 +582,11 @@ ctf_discard(ctf_file_t *fp)
if (!(fp->ctf_flags & LCTF_DIRTY))
return (0); /* no update required */
- for (dtd = ctf_list_next(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
+ for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
if (dtd->dtd_type <= fp->ctf_dtoldid)
continue; /* skip types that have been committed */
- ntd = ctf_list_next(dtd);
+ ntd = ctf_list_prev(dtd);
ctf_dtd_delete(fp, dtd);
}
@@ -614,6 +688,8 @@ ctf_add_reftype(ctf_file_t *fp, uint_t flag, ctf_id_t ref, uint_t kind)
if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR)
return (CTF_ERR); /* errno is set for us */
+ ctf_ref_inc(fp, ref);
+
dtd->dtd_data.ctt_info = CTF_TYPE_INFO(kind, flag, 0);
dtd->dtd_data.ctt_type = (ushort_t)ref;
@@ -645,16 +721,29 @@ ctf_add_array(ctf_file_t *fp, uint_t flag, const ctf_arinfo_t *arp)
{
ctf_dtdef_t *dtd;
ctf_id_t type;
+ ctf_file_t *fpd;
if (arp == NULL)
return (ctf_set_errno(fp, EINVAL));
+ fpd = fp;
+ if (ctf_lookup_by_id(&fpd, arp->ctr_contents) == NULL &&
+ ctf_dtd_lookup(fp, arp->ctr_contents) == NULL)
+ return (ctf_set_errno(fp, ECTF_BADID));
+
+ fpd = fp;
+ if (ctf_lookup_by_id(&fpd, arp->ctr_index) == NULL &&
+ ctf_dtd_lookup(fp, arp->ctr_index) == NULL)
+ return (ctf_set_errno(fp, ECTF_BADID));
+
if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR)
return (CTF_ERR); /* errno is set for us */
dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_ARRAY, flag, 0);
dtd->dtd_data.ctt_size = 0;
dtd->dtd_u.dtu_arr = *arp;
+ ctf_ref_inc(fp, arp->ctr_contents);
+ ctf_ref_inc(fp, arp->ctr_index);
return (type);
}
@@ -662,6 +751,7 @@ ctf_add_array(ctf_file_t *fp, uint_t flag, const ctf_arinfo_t *arp)
int
ctf_set_array(ctf_file_t *fp, ctf_id_t type, const ctf_arinfo_t *arp)
{
+ ctf_file_t *fpd;
ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type);
if (!(fp->ctf_flags & LCTF_RDWR))
@@ -670,8 +760,22 @@ ctf_set_array(ctf_file_t *fp, ctf_id_t type, const ctf_arinfo_t *arp)
if (dtd == NULL || CTF_INFO_KIND(dtd->dtd_data.ctt_info) != CTF_K_ARRAY)
return (ctf_set_errno(fp, ECTF_BADID));
+ fpd = fp;
+ if (ctf_lookup_by_id(&fpd, arp->ctr_contents) == NULL &&
+ ctf_dtd_lookup(fp, arp->ctr_contents) == NULL)
+ return (ctf_set_errno(fp, ECTF_BADID));
+
+ fpd = fp;
+ if (ctf_lookup_by_id(&fpd, arp->ctr_index) == NULL &&
+ ctf_dtd_lookup(fp, arp->ctr_index) == NULL)
+ return (ctf_set_errno(fp, ECTF_BADID));
+
+ ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_contents);
+ ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_index);
fp->ctf_flags |= LCTF_DIRTY;
dtd->dtd_u.dtu_arr = *arp;
+ ctf_ref_inc(fp, arp->ctr_contents);
+ ctf_ref_inc(fp, arp->ctr_index);
return (0);
}
@@ -683,7 +787,9 @@ ctf_add_function(ctf_file_t *fp, uint_t flag,
ctf_dtdef_t *dtd;
ctf_id_t type;
uint_t vlen;
+ int i;
ctf_id_t *vdat = NULL;
+ ctf_file_t *fpd;
if (ctc == NULL || (ctc->ctc_flags & ~CTF_FUNC_VARARG) != 0 ||
(ctc->ctc_argc != 0 && argv == NULL))
@@ -696,6 +802,18 @@ ctf_add_function(ctf_file_t *fp, uint_t flag,
if (vlen > CTF_MAX_VLEN)
return (ctf_set_errno(fp, EOVERFLOW));
+ fpd = fp;
+ if (ctf_lookup_by_id(&fpd, ctc->ctc_return) == NULL &&
+ ctf_dtd_lookup(fp, ctc->ctc_return) == NULL)
+ return (ctf_set_errno(fp, ECTF_BADID));
+
+ for (i = 0; i < ctc->ctc_argc; i++) {
+ fpd = fp;
+ if (ctf_lookup_by_id(&fpd, argv[i]) == NULL &&
+ ctf_dtd_lookup(fp, argv[i]) == NULL)
+ return (ctf_set_errno(fp, ECTF_BADID));
+ }
+
if (vlen != 0 && (vdat = ctf_alloc(sizeof (ctf_id_t) * vlen)) == NULL)
return (ctf_set_errno(fp, EAGAIN));
@@ -707,6 +825,10 @@ ctf_add_function(ctf_file_t *fp, uint_t flag,
dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_FUNCTION, flag, vlen);
dtd->dtd_data.ctt_type = (ushort_t)ctc->ctc_return;
+ ctf_ref_inc(fp, ctc->ctc_return);
+ for (i = 0; i < ctc->ctc_argc; i++)
+ ctf_ref_inc(fp, argv[i]);
+
bcopy(argv, vdat, sizeof (ctf_id_t) * ctc->ctc_argc);
if (ctc->ctc_flags & CTF_FUNC_VARARG)
vdat[vlen - 1] = 0; /* add trailing zero to indicate varargs */
@@ -825,8 +947,11 @@ ctf_add_typedef(ctf_file_t *fp, uint_t flag, const char *name, ctf_id_t ref)
{
ctf_dtdef_t *dtd;
ctf_id_t type;
+ ctf_file_t *fpd;
- if (ref == CTF_ERR || ref < 0 || ref > CTF_MAX_TYPE)
+ fpd = fp;
+ if (ref == CTF_ERR || (ctf_lookup_by_id(&fpd, ref) == NULL &&
+ ctf_dtd_lookup(fp, ref) == NULL))
return (ctf_set_errno(fp, EINVAL));
if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
@@ -834,6 +959,7 @@ ctf_add_typedef(ctf_file_t *fp, uint_t flag, const char *name, ctf_id_t ref)
dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_TYPEDEF, flag, 0);
dtd->dtd_data.ctt_type = (ushort_t)ref;
+ ctf_ref_inc(fp, ref);
return (type);
}
@@ -1008,6 +1134,45 @@ ctf_add_member(ctf_file_t *fp, ctf_id_t souid, const char *name, ctf_id_t type)
if (s != NULL)
fp->ctf_dtstrlen += strlen(s) + 1;
+ ctf_ref_inc(fp, type);
+ fp->ctf_flags |= LCTF_DIRTY;
+ return (0);
+}
+
+/*
+ * This removes a type from the dynamic section. This will fail if the type is
+ * referenced by another type. Note that the CTF ID is never reused currently by
+ * CTF. Note that if this container is a parent container then we just outright
+ * refuse to remove the type. There currently is no notion of searching for the
+ * ctf_dtdef_t in parent containers. If there is, then this constraint could
+ * become finer grained.
+ */
+int
+ctf_delete_type(ctf_file_t *fp, ctf_id_t type)
+{
+ ctf_file_t *fpd;
+ ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type);
+
+ if (!(fp->ctf_flags & LCTF_RDWR))
+ return (ctf_set_errno(fp, ECTF_RDONLY));
+
+ /*
+ * We want to give as useful an errno as possible. That means that we
+ * want to distinguish between a type which does not exist and one for
+ * which the type is not dynamic.
+ */
+ fpd = fp;
+ if (ctf_lookup_by_id(&fpd, type) == NULL &&
+ ctf_dtd_lookup(fp, type) == NULL)
+ return (CTF_ERR); /* errno is set for us */
+
+ if (dtd == NULL)
+ return (ctf_set_errno(fp, ECTF_NOTDYN));
+
+ if (dtd->dtd_ref != 0 || fp->ctf_refcnt > 1)
+ return (ctf_set_errno(fp, ECTF_REFERENCED));
+
+ ctf_dtd_delete(fp, dtd);
fp->ctf_flags |= LCTF_DIRTY;
return (0);
}
@@ -1313,6 +1478,14 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_file_t *src_fp, ctf_id_t src_type)
if (errs)
return (CTF_ERR); /* errno is set for us */
+
+ /*
+ * Now that we know that we can't fail, we go through and bump
+ * all the reference counts on the member types.
+ */
+ for (dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+ dmd != NULL; dmd = ctf_list_next(dmd))
+ ctf_ref_inc(dst_fp, dmd->dmd_type);
break;
}
diff --git a/usr/src/common/ctf/ctf_error.c b/usr/src/common/ctf/ctf_error.c
index 888c6c848b..fe3d0de0cb 100644
--- a/usr/src/common/ctf/ctf_error.c
+++ b/usr/src/common/ctf/ctf_error.c
@@ -23,8 +23,9 @@
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc.
+ */
#include <ctf_impl.h>
@@ -73,6 +74,8 @@ static const char *const _ctf_errlist[] = {
"Limit on number of dynamic types reached", /* ECTF_FULL */
"Duplicate member name definition", /* ECTF_DUPMEMBER */
"Conflicting type is already defined", /* ECTF_CONFLICT */
+ "Type has outstanding references", /* ECTF_REFERENCED */
+ "Type is not a dynamic type" /* ECTF_NOTDYN */
};
static const int _ctf_nerr = sizeof (_ctf_errlist) / sizeof (_ctf_errlist[0]);
diff --git a/usr/src/common/ctf/ctf_impl.h b/usr/src/common/ctf/ctf_impl.h
index 99990806a3..f56fa6a005 100644
--- a/usr/src/common/ctf/ctf_impl.h
+++ b/usr/src/common/ctf/ctf_impl.h
@@ -24,12 +24,13 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#ifndef _CTF_IMPL_H
#define _CTF_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/sysmacros.h>
@@ -149,6 +150,7 @@ typedef struct ctf_dtdef {
char *dtd_name; /* name associated with definition (if any) */
ctf_id_t dtd_type; /* type identifier for this definition */
ctf_type_t dtd_data; /* type node (see <sys/ctf.h>) */
+ int dtd_ref; /* recfount for dyanmic types */
union {
ctf_list_t dtu_members; /* struct, union, or enum */
ctf_arinfo_t dtu_arr; /* array */
@@ -269,7 +271,9 @@ enum {
ECTF_DTFULL, /* CTF type is full (no more members allowed) */
ECTF_FULL, /* CTF container is full */
ECTF_DUPMEMBER, /* duplicate member name definition */
- ECTF_CONFLICT /* conflicting type definition present */
+ ECTF_CONFLICT, /* conflicting type definition present */
+ ECTF_REFERENCED, /* type has outstanding references */
+ ECTF_NOTDYN /* type is not a dynamic type */
};
extern ssize_t ctf_get_ctt_size(const ctf_file_t *, const ctf_type_t *,
diff --git a/usr/src/common/ctf/ctf_open.c b/usr/src/common/ctf/ctf_open.c
index e49a4cb329..2148389fff 100644
--- a/usr/src/common/ctf/ctf_open.c
+++ b/usr/src/common/ctf/ctf_open.c
@@ -24,8 +24,9 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#include <ctf_impl.h>
#include <sys/mman.h>
@@ -810,8 +811,12 @@ ctf_close(ctf_file_t *fp)
if (fp->ctf_parent != NULL)
ctf_close(fp->ctf_parent);
- for (dtd = ctf_list_next(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
- ntd = ctf_list_next(dtd);
+ /*
+ * Note, to work properly with reference counting on the dynamic
+ * section, we must delete the list in reverse.
+ */
+ for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
+ ntd = ctf_list_prev(dtd);
ctf_dtd_delete(fp, dtd);
}
diff --git a/usr/src/common/util/strtolctype.h b/usr/src/common/util/strtolctype.h
index 7b7afc6e30..5675e42be7 100644
--- a/usr/src/common/util/strtolctype.h
+++ b/usr/src/common/util/strtolctype.h
@@ -38,6 +38,10 @@ extern "C" {
* This header file contains a collection of macros that the strtou?ll?
* functions in common/util use to test characters. What we need is a kernel
* version of ctype.h.
+ *
+ * NOTE: These macros are used within several DTrace probe context functions.
+ * They must not be altered to make function calls or perform actions not
+ * safe in probe context.
*/
#if defined(_KERNEL) && !defined(_BOOT)
diff --git a/usr/src/common/zfs/zfeature_common.c b/usr/src/common/zfs/zfeature_common.c
index bb552ac14b..19afefe90f 100644
--- a/usr/src/common/zfs/zfeature_common.c
+++ b/usr/src/common/zfs/zfeature_common.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#ifdef _KERNEL
@@ -160,4 +161,7 @@ zpool_feature_init(void)
zfeature_register(SPA_FEATURE_LZ4_COMPRESS,
"org.illumos:lz4_compress", "lz4_compress",
"LZ4 compression algorithm support.", B_FALSE, B_FALSE, NULL);
+ zfeature_register(SPA_FEATURE_FS_SS_LIMIT,
+ "com.joyent:filesystem_limits", "filesystem_limits",
+ "Filesystem and snapshot limits.", B_TRUE, B_FALSE, NULL);
}
diff --git a/usr/src/common/zfs/zfeature_common.h b/usr/src/common/zfs/zfeature_common.h
index f3a137fb3e..2223f48c66 100644
--- a/usr/src/common/zfs/zfeature_common.h
+++ b/usr/src/common/zfs/zfeature_common.h
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#ifndef _ZFEATURE_COMMON_H
@@ -54,6 +55,7 @@ enum spa_feature {
SPA_FEATURE_ASYNC_DESTROY,
SPA_FEATURE_EMPTY_BPOBJ,
SPA_FEATURE_LZ4_COMPRESS,
+ SPA_FEATURE_FS_SS_LIMIT,
SPA_FEATURES
} spa_feature_t;
diff --git a/usr/src/common/zfs/zfs_prop.c b/usr/src/common/zfs/zfs_prop.c
index ebb267965a..5d99f3f26c 100644
--- a/usr/src/common/zfs/zfs_prop.c
+++ b/usr/src/common/zfs/zfs_prop.c
@@ -22,6 +22,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/* Portions Copyright 2010 Robert Milkowski */
@@ -69,6 +70,7 @@ zfs_prop_init(void)
{ "fletcher2", ZIO_CHECKSUM_FLETCHER_2 },
{ "fletcher4", ZIO_CHECKSUM_FLETCHER_4 },
{ "sha256", ZIO_CHECKSUM_SHA256 },
+ { "noparity", ZIO_CHECKSUM_NOPARITY },
{ NULL }
};
@@ -414,6 +416,23 @@ zfs_prop_delegatable(zfs_prop_t prop)
return (pd->pd_attr != PROP_READONLY);
}
+boolean_t
+zfs_prop_cacheable(zfs_prop_t prop)
+{
+ /*
+ * It'd be nice if each prop had a flags field which could have flag
+ * like PROP_CACHEABLE, but since zprop_attr_t is an enum and this
+ * setting is orthogonal to the concepts of PROP_READONLY, etc., we have
+ * this function.
+ */
+ return (prop == ZFS_PROP_VERSION ||
+ prop == ZFS_PROP_NORMALIZE ||
+ prop == ZFS_PROP_UTF8ONLY ||
+ prop == ZFS_PROP_CASE ||
+ prop == ZFS_PROP_VOLSIZE ||
+ prop == ZFS_PROP_VOLBLOCKSIZE);
+}
+
/*
* Given a zfs dataset property name, returns the corresponding property ID.
*/
diff --git a/usr/src/common/zfs/zfs_prop.h b/usr/src/common/zfs/zfs_prop.h
index a63262311b..1796642c68 100644
--- a/usr/src/common/zfs/zfs_prop.h
+++ b/usr/src/common/zfs/zfs_prop.h
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _ZFS_PROP_H
@@ -86,6 +87,7 @@ typedef struct {
void zfs_prop_init(void);
zprop_type_t zfs_prop_get_type(zfs_prop_t);
boolean_t zfs_prop_delegatable(zfs_prop_t prop);
+boolean_t zfs_prop_cacheable(zfs_prop_t prop);
zprop_desc_t *zfs_prop_get_table(void);
/*
diff --git a/usr/src/grub/Makefile b/usr/src/grub/Makefile
index 28c2eca2ff..c31e9a802c 100644
--- a/usr/src/grub/Makefile
+++ b/usr/src/grub/Makefile
@@ -29,6 +29,7 @@ INST_TARGETS += $(ROOT_BOOT_GRUB)/$(GRUB_MENU)
INST_TARGETS += $(ROOT_BOOT_GRUB)/$(INSTALL_MENU)
INST_TARGETS += $(ROOT_BOOT_GRUB)/$(GRUB_DEFAULT)
INST_TARGETS += $(ROOT_BOOT_GRUB)/$(CAPABILITY)
+INST_TARGETS += $(ROOT_USR_SBIN)/grub
$(ROOT_BOOT_GRUB)/$(GRUB_DEFAULT) := FILEMODE = 444
$(ROOT_BOOT_GRUB)/$(CAPABILITY) := FILEMODE = 444
@@ -45,9 +46,14 @@ $(GRUB): FRC
$(ROOT_BOOT_GRUB)/%: $(ROOT_BOOT_GRUB) %
$(INS.file)
+$(ROOT_USR_SBIN)/%: $(GRUB)/grub/grub $(ROOT_USR_SBIN)
+ $(INS.file)
+
$(ROOT_BOOT_GRUB):
$(INS.dir)
+$(ROOT_USR_SBIN):
+ $(INS.dir)
clean clobber: $(SUBDIRS)
diff --git a/usr/src/grub/Makefile.grub b/usr/src/grub/Makefile.grub
index 18354324ae..99942fa2ed 100644
--- a/usr/src/grub/Makefile.grub
+++ b/usr/src/grub/Makefile.grub
@@ -10,3 +10,4 @@ PLATFORM = i86pc
ROOT_BOOT_GRUB = $(ROOT)/boot/grub
ROOT_PLAT_GRUB = $(ROOT)/platform/$(PLATFORM)/boot/grub
ROOT_SRC = $(ROOT)/usr/share/src/grub
+ROOT_USR_SBIN = $(ROOT)/usr/sbin
diff --git a/usr/src/grub/grub-0.97/stage2/Makefile.solaris b/usr/src/grub/grub-0.97/stage2/Makefile.solaris
index 94b168f43d..bb737888cd 100644
--- a/usr/src/grub/grub-0.97/stage2/Makefile.solaris
+++ b/usr/src/grub/grub-0.97/stage2/Makefile.solaris
@@ -65,6 +65,7 @@ LIBGRUB_OBJS = libgrub_a-boot.o \
libgrub_a-cmdline.o \
libgrub_a-common.o \
libgrub_a-disk_io.o \
+ libgrub_a-expand.o \
libgrub_a-fsys_ext2fs.o \
libgrub_a-fsys_fat.o \
libgrub_a-fsys_ffs.o \
@@ -155,6 +156,7 @@ DISKLESS_OBJS = diskless_exec-bios.o \
diskless_exec-common.o \
diskless_exec-console.o \
diskless_exec-disk_io.o \
+ diskless_exec-expand.o \
diskless_exec-fsys_ext2fs.o \
diskless_exec-fsys_fat.o \
diskless_exec-fsys_ffs.o \
@@ -198,8 +200,8 @@ $(DISKLESS_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE2_CFLAGS) \
E2FS_STAGE1_5_DATA = e2fs_stage1_5
E2FS_STAGE1_5_EXEC = e2fs_stage1_5.exec
-E2FS_STAGE1_5_ASMOBJS = e2fs_stage1_5_exec-asm.o \
- e2fs_stage1_5_exec-start.o
+E2FS_STAGE1_5_ASMOBJS = e2fs_stage1_5_exec-start.o \
+ e2fs_stage1_5_exec-asm.o
E2FS_STAGE1_5_OBJS = e2fs_stage1_5_exec-bios.o \
e2fs_stage1_5_exec-char_io.o \
@@ -222,8 +224,8 @@ $(E2FS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
FAT_STAGE1_5_DATA = fat_stage1_5
FAT_STAGE1_5_EXEC = fat_stage1_5.exec
-FAT_STAGE1_5_ASMOBJS = fat_stage1_5_exec-asm.o \
- fat_stage1_5_exec-start.o
+FAT_STAGE1_5_ASMOBJS = fat_stage1_5_exec-start.o \
+ fat_stage1_5_exec-asm.o
FAT_STAGE1_5_OBJS = fat_stage1_5_exec-bios.o \
fat_stage1_5_exec-char_io.o \
@@ -246,8 +248,8 @@ $(FAT_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
FFS_STAGE1_5_DATA = ffs_stage1_5
FFS_STAGE1_5_EXEC = ffs_stage1_5.exec
-FFS_STAGE1_5_ASMOBJS = ffs_stage1_5_exec-asm.o \
- ffs_stage1_5_exec-start.o
+FFS_STAGE1_5_ASMOBJS = ffs_stage1_5_exec-start.o \
+ ffs_stage1_5_exec-asm.o
FFS_STAGE1_5_OBJS = ffs_stage1_5_exec-bios.o \
ffs_stage1_5_exec-char_io.o \
@@ -270,8 +272,8 @@ $(FFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
ISO9660_STAGE1_5_DATA = iso9660_stage1_5
ISO9660_STAGE1_5_EXEC = iso9660_stage1_5.exec
-ISO9660_STAGE1_5_ASMOBJS = iso9660_stage1_5_exec-asm.o \
- iso9660_stage1_5_exec-start_eltorito.o
+ISO9660_STAGE1_5_ASMOBJS = iso9660_stage1_5_exec-start_eltorito.o \
+ iso9660_stage1_5_exec-asm.o
ISO9660_STAGE1_5_OBJS = iso9660_stage1_5_exec-bios.o \
iso9660_stage1_5_exec-char_io.o \
@@ -295,8 +297,8 @@ $(ISO9660_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
JFS_STAGE1_5_DATA = jfs_stage1_5
JFS_STAGE1_5_EXEC = jfs_stage1_5.exec
-JFS_STAGE1_5_ASMOBJS = jfs_stage1_5_exec-asm.o \
- jfs_stage1_5_exec-start.o
+JFS_STAGE1_5_ASMOBJS = jfs_stage1_5_exec-start.o \
+ jfs_stage1_5_exec-asm.o
JFS_STAGE1_5_OBJS = jfs_stage1_5_exec-bios.o \
jfs_stage1_5_exec-char_io.o \
@@ -319,8 +321,8 @@ $(JFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
MINIX_STAGE1_5_DATA = minix_stage1_5
MINIX_STAGE1_5_EXEC = minix_stage1_5.exec
-MINIX_STAGE1_5_ASMOBJS = minix_stage1_5_exec-asm.o \
- minix_stage1_5_exec-start.o
+MINIX_STAGE1_5_ASMOBJS = minix_stage1_5_exec-start.o \
+ minix_stage1_5_exec-asm.o
MINIX_STAGE1_5_OBJS = minix_stage1_5_exec-bios.o \
minix_stage1_5_exec-char_io.o \
@@ -367,6 +369,7 @@ PRE_STAGE2_OBJS = pre_stage2_exec-bios.o \
pre_stage2_exec-common.o \
pre_stage2_exec-console.o \
pre_stage2_exec-disk_io.o \
+ pre_stage2_exec-expand.o \
pre_stage2_exec-fsys_ext2fs.o \
pre_stage2_exec-fsys_fat.o \
pre_stage2_exec-fsys_ffs.o \
@@ -423,8 +426,8 @@ $(PXELOADER_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS)
REISERFS_STAGE1_5_DATA = reiserfs_stage1_5
REISERFS_STAGE1_5_EXEC = reiserfs_stage1_5.exec
-REISERFS_STAGE1_5_ASMOBJS = reiserfs_stage1_5_exec-asm.o \
- reiserfs_stage1_5_exec-start.o
+REISERFS_STAGE1_5_ASMOBJS = reiserfs_stage1_5_exec-start.o \
+ reiserfs_stage1_5_exec-asm.o
REISERFS_STAGE1_5_OBJS = reiserfs_stage1_5_exec-bios.o \
reiserfs_stage1_5_exec-char_io.o \
@@ -478,8 +481,8 @@ $(START_ELTORITO_ASMOBJS) := CCASFLAGS = $(BASE_CCASFLAGS) $(STAGE2_CFLAGS)
UFS2_STAGE1_5_DATA = ufs2_stage1_5
UFS2_STAGE1_5_EXEC = ufs2_stage1_5.exec
-UFS2_STAGE1_5_ASMOBJS = ufs2_stage1_5_exec-asm.o \
- ufs2_stage1_5_exec-start.o
+UFS2_STAGE1_5_ASMOBJS = ufs2_stage1_5_exec-start.o \
+ ufs2_stage1_5_exec-asm.o
UFS2_STAGE1_5_OBJS = ufs2_stage1_5_exec-bios.o \
ufs2_stage1_5_exec-char_io.o \
@@ -502,8 +505,8 @@ $(UFS2_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
UFS_STAGE1_5_DATA = ufs_stage1_5
UFS_STAGE1_5_EXEC = ufs_stage1_5.exec
-UFS_STAGE1_5_ASMOBJS = ufs_stage1_5_exec-asm.o \
- ufs_stage1_5_exec-start.o
+UFS_STAGE1_5_ASMOBJS = ufs_stage1_5_exec-start.o \
+ ufs_stage1_5_exec-asm.o
UFS_STAGE1_5_OBJS = ufs_stage1_5_exec-bios.o \
ufs_stage1_5_exec-char_io.o \
@@ -526,8 +529,8 @@ $(UFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
ZFS_STAGE1_5_DATA = zfs_stage1_5
ZFS_STAGE1_5_EXEC = zfs_stage1_5.exec
-ZFS_STAGE1_5_ASMOBJS = zfs_stage1_5_exec-asm.o \
- zfs_stage1_5_exec-start.o
+ZFS_STAGE1_5_ASMOBJS = zfs_stage1_5_exec-start.o \
+ zfs_stage1_5_exec-asm.o
ZFS_STAGE1_5_OBJS = zfs_stage1_5_exec-bios.o \
zfs_stage1_5_exec-char_io.o \
@@ -554,8 +557,8 @@ $(ZFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
VSTAFS_STAGE1_5_DATA = vstafs_stage1_5
VSTAFS_STAGE1_5_EXEC = vstafs_stage1_5.exec
-VSTAFS_STAGE1_5_ASMOBJS = vstafs_stage1_5_exec-asm.o \
- vstafs_stage1_5_exec-start.o
+VSTAFS_STAGE1_5_ASMOBJS = vstafs_stage1_5_exec-start.o \
+ vstafs_stage1_5_exec-asm.o
VSTAFS_STAGE1_5_OBJS = vstafs_stage1_5_exec-bios.o \
vstafs_stage1_5_exec-char_io.o \
@@ -578,8 +581,8 @@ $(VSTAFS_STAGE1_5_OBJS) := CFLAGS = $(BASE_CFLAGS) $(STAGE1_5_CFLAGS) \
XFS_STAGE1_5_DATA = xfs_stage1_5
XFS_STAGE1_5_EXEC = xfs_stage1_5.exec
-XFS_STAGE1_5_ASMOBJS = xfs_stage1_5_exec-asm.o \
- xfs_stage1_5_exec-start.o
+XFS_STAGE1_5_ASMOBJS = xfs_stage1_5_exec-start.o \
+ xfs_stage1_5_exec-asm.o
XFS_STAGE1_5_OBJS = xfs_stage1_5_exec-bios.o \
xfs_stage1_5_exec-char_io.o \
@@ -607,7 +610,8 @@ SRC_DIR = $(ROOT_SRC)/stage2
SRC_ZFSINC_DIR = $(SRC_DIR)/zfs-include
SRC_FILES = Makefile.am Makefile.in apic.h apm.S asm.S bios.c boot.c \
builtins.c char_io.c cmdline.c common.c console.c defs.h \
- dir.h disk_inode.h disk_inode_ffs.h disk_io.c fat.h \
+ dir.h disk_inode.h disk_inode_ffs.h disk_io.c expand.c \
+ expand.h fat.h \
filesys.h freebsd.h fs.h fsys_ext2fs.c fsys_fat.c \
fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
zfs_sha256.c zfs_lzjb.c zfs_lz4.c zfs_fletcher.c fsys_zfs.c \
diff --git a/usr/src/grub/grub-0.97/stage2/asm.S b/usr/src/grub/grub-0.97/stage2/asm.S
index 3e9986c0df..5d6faf7010 100644
--- a/usr/src/grub/grub-0.97/stage2/asm.S
+++ b/usr/src/grub/grub-0.97/stage2/asm.S
@@ -2664,8 +2664,8 @@ ENTRY(get_target_operating_mode)
movw $0xec00, %ax
movw $0x03, %bx
int $0x15
-/* XXX still need to pass back return */
+ setc %al
movw %ax, %cx
DATA32 call EXT_C(real_to_prot)
@@ -2673,6 +2673,7 @@ ENTRY(get_target_operating_mode)
xorl %eax, %eax
movw %cx, %ax
+ movl %eax, 0x1c(%esp)
popa
ret
diff --git a/usr/src/grub/grub-0.97/stage2/boot.c b/usr/src/grub/grub-0.97/stage2/boot.c
index cfc2336a4c..027de7709b 100644
--- a/usr/src/grub/grub-0.97/stage2/boot.c
+++ b/usr/src/grub/grub-0.97/stage2/boot.c
@@ -25,6 +25,8 @@
#include "imgact_aout.h"
#include "i386-elf.h"
+#define SAFE_LOAD_BASE 0xc800000
+
static int cur_addr;
entry_func entry_addr;
static struct mod_list mll[99];
@@ -773,6 +775,17 @@ load_module (char *module, char *arg)
{
int len;
+ /*
+ * XXX Workaround for RICHMOND-16: on some systems, the region
+ * [c700000, c800000) is corrupted by an unknown external (off-CPU) actor(s)
+ * during boot. To be on the safe side, we will simply ensure that every
+ * module is loaded above this region. Note that this means this particular
+ * boot loader supports only systems with at least 200 MB of DRAM plus the
+ * amount of space used by any modules.
+ */
+ if (cur_addr < SAFE_LOAD_BASE)
+ cur_addr = SAFE_LOAD_BASE;
+
/* if we are supposed to load on 4K boundaries */
cur_addr = (cur_addr + 0xFFF) & 0xFFFFF000;
diff --git a/usr/src/grub/grub-0.97/stage2/builtins.c b/usr/src/grub/grub-0.97/stage2/builtins.c
index af4a6f28bb..a6f5acd011 100644
--- a/usr/src/grub/grub-0.97/stage2/builtins.c
+++ b/usr/src/grub/grub-0.97/stage2/builtins.c
@@ -49,6 +49,7 @@
#endif
#include <cpu.h>
+#include <expand.h>
/* The type of kernel loaded. */
kernel_t kernel_type;
@@ -86,7 +87,7 @@ static int configfile_func (char *arg, int flags);
static void solaris_config_file (void);
#endif
-static unsigned int min_mem64 = 0;
+unsigned int min_mem64 = 0;
#if defined(__sun) && !defined(GRUB_UTIL)
extern void __enable_execute_stack (void *);
@@ -2791,117 +2792,6 @@ static struct builtin builtin_ioprobe =
};
-/*
- * To boot from a ZFS root filesystem, the kernel$ or module$ commands
- * must include "-B $ZFS-BOOTFS" to expand to the zfs-bootfs, bootpath,
- * and diskdevid boot property values for passing to the kernel:
- *
- * e.g.
- * kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=ttya
- *
- * $ZFS-BOOTFS is expanded to
- *
- * zfs-bootfs=<rootpool-name/zfs-rootfilesystem-object-num>,
- * bootpath=<device phys path>,
- * diskdevid=<device id>
- *
- * if both bootpath and diskdevid can be found.
- * e.g
- * zfs-bootfs=rpool/85,
- * bootpath="/pci@0,0/pci1022,7450@a/pci17c2,10@4/sd@0,0:a",
- * diskdevid="id1,sd@SSEAGATE_ST336607LC______3JA0LNHE0000741326W6/a"
- */
-static int
-expand_dollar_bootfs(char *in, char *out)
-{
- char *token, *tmpout = out;
- int outlen, blen;
- int postcomma = 0;
-
- /* no op if this is not zfs */
- if (is_zfs_mount == 0)
- return (0);
-
- if (current_bootpath[0] == '\0' && current_devid[0] == '\0') {
- errnum = ERR_NO_BOOTPATH;
- return (1);
- }
-
- outlen = strlen(in);
- blen = current_bootfs_obj == 0 ? strlen(current_rootpool) :
- strlen(current_rootpool) + 11;
-
- out[0] = '\0';
- while (token = strstr(in, "$ZFS-BOOTFS")) {
-
- if ((outlen += blen) >= MAX_CMDLINE) {
- errnum = ERR_WONT_FIT;
- return (1);
- }
-
- token[0] = '\0';
- grub_sprintf(tmpout, "%s", in);
- token[0] = '$';
- in = token + 11; /* skip over $ZFS-BOOTFS */
- tmpout = out + strlen(out);
-
- /* Note: %u only fits 32 bit integer; */
- if (current_bootfs_obj > 0)
- grub_sprintf(tmpout, "zfs-bootfs=%s/%u",
- current_rootpool, current_bootfs_obj);
- else
- grub_sprintf(tmpout, "zfs-bootfs=%s",
- current_rootpool);
- tmpout = out + strlen(out);
- }
-
- /*
- * Check to see if 'zfs-bootfs' was explicitly specified on the command
- * line so that we can insert the 'bootpath' property.
- */
- if ((tmpout == out) && (token = strstr(in, "zfs-bootfs")) != NULL) {
- token[0] = '\0';
- grub_strcpy(tmpout, in);
- token[0] = 'z';
- in = token;
-
- tmpout = out + strlen(out);
- postcomma = 1;
- }
-
- /*
- * Set the 'bootpath' property if a ZFS dataset was specified, either
- * through '$ZFS-BOOTFS' or an explicit 'zfs-bootfs' setting.
- */
- if (tmpout != out) {
- if (current_bootpath[0] != '\0') {
- if ((outlen += 12 + strlen(current_bootpath))
- >= MAX_CMDLINE) {
- errnum = ERR_WONT_FIT;
- return (1);
- }
- grub_sprintf(tmpout,
- postcomma ? "bootpath=\"%s\"," : ",bootpath=\"%s\"",
- current_bootpath);
- tmpout = out + strlen(out);
- }
-
- if (current_devid[0] != '\0') {
- if ((outlen += 13 + strlen(current_devid))
- >= MAX_CMDLINE) {
- errnum = ERR_WONT_FIT;
- return (1);
- }
- grub_sprintf(tmpout,
- postcomma ? "diskdevid=\"%s\"," : ",diskdevid=\"%s\"",
- current_devid);
- }
- }
-
- strncat(out, in, MAX_CMDLINE);
- return (0);
-}
-
/* kernel */
static int
kernel_func (char *arg, int flags)
@@ -3007,289 +2897,17 @@ static struct builtin builtin_min_mem64 =
"even on 64-bit capable hardware."
};
-int
-check_min_mem64()
-{
- if (min_mem64 == 0)
- return (1);
-
- if ((mbi.mem_upper / 10240) * 11 >= min_mem64)
- return (1);
-
- return (0);
-}
-
-static int detect_target_operating_mode();
-
-int
-amd64_config_cpu(void)
-{
- struct amd64_cpuid_regs __vcr, *vcr = &__vcr;
- uint32_t maxeax;
- uint32_t max_maxeax = 0x100;
- char vendor[13];
- int isamd64 = 0;
- uint32_t stdfeatures = 0, xtdfeatures = 0;
- uint64_t efer;
-
- /*
- * This check may seem silly, but if the C preprocesor symbol __amd64
- * is #defined during compilation, something that may outwardly seem
- * like a good idea, uts/common/sys/isa_defs.h will #define _LP64,
- * which will cause uts/common/sys/int_types.h to typedef uint64_t as
- * an unsigned long - which is only 4 bytes in size when using a 32-bit
- * compiler.
- *
- * If that happens, all the page table translation routines will fail
- * horribly, so check the size of uint64_t just to insure some degree
- * of sanity in future operations.
- */
- /*LINTED [sizeof result is invarient]*/
- if (sizeof (uint64_t) != 8)
- prom_panic("grub compiled improperly, unable to boot "
- "64-bit AMD64 executables");
-
- /*
- * If the CPU doesn't support the CPUID instruction, it's definitely
- * not an AMD64.
- */
- if (amd64_cpuid_supported() == 0)
- return (0);
-
- amd64_cpuid_insn(0, vcr);
-
- maxeax = vcr->r_eax;
- {
- /*LINTED [vendor string from cpuid data]*/
- uint32_t *iptr = (uint32_t *)vendor;
-
- *iptr++ = vcr->r_ebx;
- *iptr++ = vcr->r_edx;
- *iptr++ = vcr->r_ecx;
-
- vendor[12] = '\0';
- }
-
- if (maxeax > max_maxeax) {
- grub_printf("cpu: warning, maxeax was 0x%x -> 0x%x\n",
- maxeax, max_maxeax);
- maxeax = max_maxeax;
- }
-
- if (maxeax < 1)
- return (0); /* no additional functions, not an AMD64 */
- else {
- uint_t family, model, step;
-
- amd64_cpuid_insn(1, vcr);
-
- /*
- * All AMD64/IA32e processors technically SHOULD report
- * themselves as being in family 0xf, but for some reason
- * Simics doesn't, and this may change in the future, so
- * don't error out if it's not true.
- */
- if ((family = BITX(vcr->r_eax, 11, 8)) == 0xf)
- family += BITX(vcr->r_eax, 27, 20);
-
- if ((model = BITX(vcr->r_eax, 7, 4)) == 0xf)
- model += BITX(vcr->r_eax, 19, 16) << 4;
- step = BITX(vcr->r_eax, 3, 0);
-
- grub_printf("cpu: '%s' family %d model %d step %d\n",
- vendor, family, model, step);
- stdfeatures = vcr->r_edx;
- }
-
- amd64_cpuid_insn(0x80000000, vcr);
-
- if (vcr->r_eax & 0x80000000) {
- uint32_t xmaxeax = vcr->r_eax;
- const uint32_t max_xmaxeax = 0x80000100;
-
- if (xmaxeax > max_xmaxeax) {
- grub_printf("amd64: warning, xmaxeax was "
- "0x%x -> 0x%x\n", xmaxeax, max_xmaxeax);
- xmaxeax = max_xmaxeax;
- }
-
- if (xmaxeax >= 0x80000001) {
- amd64_cpuid_insn(0x80000001, vcr);
- xtdfeatures = vcr->r_edx;
- }
- }
-
- if (BITX(xtdfeatures, 29, 29)) /* long mode */
- isamd64++;
- else
- grub_printf("amd64: CPU does NOT support long mode\n");
-
- if (!BITX(stdfeatures, 0, 0)) {
- grub_printf("amd64: CPU does NOT support FPU\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 4, 4)) {
- grub_printf("amd64: CPU does NOT support TSC\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 5, 5)) {
- grub_printf("amd64: CPU does NOT support MSRs\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 6, 6)) {
- grub_printf("amd64: CPU does NOT support PAE\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 8, 8)) {
- grub_printf("amd64: CPU does NOT support CX8\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 13, 13)) {
- grub_printf("amd64: CPU does NOT support PGE\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 19, 19)) {
- grub_printf("amd64: CPU does NOT support CLFSH\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 23, 23)) {
- grub_printf("amd64: CPU does NOT support MMX\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 24, 24)) {
- grub_printf("amd64: CPU does NOT support FXSR\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 25, 25)) {
- grub_printf("amd64: CPU does NOT support SSE\n");
- isamd64--;
- }
-
- if (!BITX(stdfeatures, 26, 26)) {
- grub_printf("amd64: CPU does NOT support SSE2\n");
- isamd64--;
- }
-
- if (isamd64 < 1) {
- grub_printf("amd64: CPU does not support amd64 executables.\n");
- return (0);
- }
-
- amd64_rdmsr(MSR_AMD_EFER, &efer);
- if (efer & AMD_EFER_SCE)
- grub_printf("amd64: EFER_SCE (syscall/sysret) already "
- "enabled\n");
- if (efer & AMD_EFER_NXE)
- grub_printf("amd64: EFER_NXE (no-exec prot) already enabled\n");
- if (efer & AMD_EFER_LME)
- grub_printf("amd64: EFER_LME (long mode) already enabled\n");
-
- return (detect_target_operating_mode());
-}
-
-static int
-detect_target_operating_mode()
-{
- int ret, ah;
-
- ah = get_target_operating_mode();
-
- ah = ah >> 8;
-
- /* XXX still need to pass back the return from the call */
- ret = 0;
-
- if (ah == 0x86 && (ret & CB) != 0) {
- grub_printf("[BIOS 'Detect Target Operating Mode' "
- "callback unsupported on this platform]\n");
- return (1); /* unsupported, ignore */
- }
-
- if (ah == 0x0 && (ret & CB) == 0) {
- grub_printf("[BIOS accepted mixed-mode target setting!]\n");
- return (1); /* told the bios what we're up to */
- }
-
- if (ah == 0 && ret & CB) {
- grub_printf("fatal: BIOS reports this machine CANNOT run in "
- "mixed 32/64-bit mode!\n");
- return (0);
- }
-
- grub_printf("warning: BIOS Detect Target Operating Mode callback "
- "confused.\n %%ax >> 8 = 0x%x, carry = %d\n", ah,
- ret & CB ? 1 : 0);
-
- return (1);
-}
-
-
-int
-isamd64()
-{
- static int ret = -1;
-
- if (ret == -1)
- ret = amd64_config_cpu();
-
- return (ret);
-}
-
-static void
-expand_arch (char *arg, char *newarg)
-{
- char *index;
-
- newarg[0] = '\0';
-
- while ((index = strstr(arg, "$ISADIR")) != NULL) {
-
- index[0] = '\0';
- strncat(newarg, arg, MAX_CMDLINE);
- index[0] = '$';
-
- if (isamd64() && check_min_mem64())
- strncat(newarg, "amd64", MAX_CMDLINE);
-
- arg = index + 7;
- }
-
- strncat(newarg, arg, MAX_CMDLINE);
- return;
-}
-
-/* kernel$ */
static int
kernel_dollar_func (char *arg, int flags)
{
char newarg[MAX_CMDLINE]; /* everything boils down to MAX_CMDLINE */
grub_printf("loading '%s' ...\n", arg);
- expand_arch(arg, newarg);
-
- if (kernel_func(newarg, flags))
- return (1);
+ expand_string(arg, newarg, MAX_CMDLINE);
- mb_cmdline = (char *)MB_CMDLINE_BUF;
- if (expand_dollar_bootfs(newarg, mb_cmdline)) {
- grub_printf("cannot expand $ZFS-BOOTFS for dataset %s\n",
- current_bootfs);
- return (1);
- }
+ grub_printf("loading '%s' ...\n", newarg);
- grub_printf("'%s' is loaded\n", mb_cmdline);
- mb_cmdline += grub_strlen(mb_cmdline) + 1;
-
- return (0);
+ return (kernel_func(newarg, flags));
}
static struct builtin builtin_kernel_dollar =
@@ -3298,7 +2916,8 @@ static struct builtin builtin_kernel_dollar =
kernel_dollar_func,
BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
"kernel$ [--no-mem-option] [--type=TYPE] FILE [ARG ...]",
- " Just like kernel, but with $ISADIR expansion."
+ " Just like kernel, but with variable expansion, including the legacy"
+ " (and nonconforming) variables $ISADIR and $ZFS-BOOTFS."
};
@@ -3521,26 +3140,14 @@ static struct builtin builtin_module =
static int
module_dollar_func (char *arg, int flags)
{
- char newarg[MAX_CMDLINE]; /* everything boils down to MAX_CMDLINE */
- char *cmdline_sav;
+ char newarg[MAX_CMDLINE]; /* everything boils down to MAX_CMDLINE */
+ char *cmdline_sav;
- grub_printf("loading '%s' ...\n", arg);
- expand_arch(arg, newarg);
-
- cmdline_sav = (char *)mb_cmdline;
- if (module_func(newarg, flags))
- return (1);
+ grub_printf("loading '%s' ...\n", arg);
+ expand_string(arg, newarg, MAX_CMDLINE);
+ grub_printf("loading '%s' ...\n", newarg);
- if (expand_dollar_bootfs(newarg, cmdline_sav)) {
- grub_printf("cannot expand $ZFS-BOOTFS for dataset %s\n",
- current_bootfs);
- return (1);
- }
-
- grub_printf("'%s' is loaded\n", (char *)cmdline_sav);
- mb_cmdline += grub_strlen(cmdline_sav) + 1;
-
- return (0);
+ return (module_func(newarg, flags));
}
static struct builtin builtin_module_dollar =
@@ -4850,15 +4457,15 @@ setup_func (char *arg, int flags)
{
char tmp[16];
grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF);
- grub_strncat (device, tmp, 256);
+ grub_strncat (device, tmp, sizeof (device));
}
if ((partition & 0x00FF00) != 0x00FF00)
{
char tmp[16];
grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF));
- grub_strncat (device, tmp, 256);
+ grub_strncat (device, tmp, sizeof (device));
}
- grub_strncat (device, ")", 256);
+ grub_strncat (device, ")", sizeof (device));
}
int embed_stage1_5 (char *stage1_5, int drive, int partition)
@@ -5289,11 +4896,14 @@ static struct builtin builtin_terminal =
"terminal",
terminal_func,
BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
- "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]",
+ "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics] [composite]",
"Select a terminal. When multiple terminals are specified, wait until"
" you push any key to continue. If both console and serial are specified,"
" the terminal to which you input a key first will be selected. If no"
- " argument is specified, print current setting. The option --dumb"
+ " argument is specified, print current setting. To accomodate systems"
+ " where console redirection may or may not be present, the composite"
+ " console will direct output to the serial and BIOS consoles, and accept"
+ " input from either one, without requiring selection. The option --dumb"
" specifies that your terminal is dumb, otherwise, vt100-compatibility"
" is assumed. If you specify --no-echo, input characters won't be echoed."
" If you specify --no-edit, the BASH-like editing feature will be disabled."
@@ -5815,6 +5425,54 @@ static struct builtin builtin_vbeprobe =
"Probe VBE information. If the mode number MODE is specified, show only"
" the information about only the mode."
};
+
+static int
+variable_func(char *arg, int flags)
+{
+ char name[EV_NAMELEN];
+ char *val;
+ int err;
+
+ if (*arg == '\0') {
+ dump_variables();
+ return (0);
+ }
+
+ if ((val = grub_strchr(arg, ' ')) != NULL) {
+ if (val - arg >= sizeof (name)) {
+ errnum = ERR_WONT_FIT;
+ return (1);
+ }
+ (void) grub_memcpy(name, arg, (val - arg));
+ name[val - arg] = '\0';
+ val = skip_to(0, arg);
+ } else {
+ if (grub_strlen(arg) >= sizeof (name)) {
+ errnum = ERR_WONT_FIT;
+ return (1);
+ }
+ (void) grub_strcpy(name, arg);
+ }
+
+ if ((err = set_variable(name, val)) != 0) {
+ errnum = err;
+ return (1);
+ }
+
+ return (0);
+}
+
+static struct builtin builtin_variable =
+{
+ "variable",
+ variable_func,
+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_SCRIPT | BUILTIN_HELP_LIST,
+ "variable NAME [VALUE]",
+ "Set the variable NAME to VALUE, or to the empty string if no value is"
+ " given. NAME must contain no spaces. There is no quoting mechanism"
+ " and nested variable references are not allowed. Variable values may"
+ " be substituted into the kernel$ and module$ commands using ${NAME}."
+};
/* The table of builtin commands. Sorted in dictionary order. */
@@ -5922,6 +5580,7 @@ struct builtin *builtin_table[] =
&builtin_title,
&builtin_unhide,
&builtin_uppermem,
+ &builtin_variable,
&builtin_vbeprobe,
&builtin_verbose,
0
diff --git a/usr/src/grub/grub-0.97/stage2/char_io.c b/usr/src/grub/grub-0.97/stage2/char_io.c
index d73bc71001..3557552e01 100644
--- a/usr/src/grub/grub-0.97/stage2/char_io.c
+++ b/usr/src/grub/grub-0.97/stage2/char_io.c
@@ -71,6 +71,22 @@ struct term_entry term_table[] =
0,
0
},
+ {
+ "composite",
+ TERM_NEED_INIT,
+ 24,
+ composite_putchar,
+ composite_checkkey,
+ composite_getkey,
+ serial_getxy,
+ composite_gotoxy,
+ composite_cls,
+ composite_setcolorstate,
+ console_setcolor,
+ console_setcursor,
+ 0,
+ 0
+ },
#endif /* SUPPORT_SERIAL */
#ifdef SUPPORT_HERCULES
{
@@ -1047,10 +1063,10 @@ grub_strncat (char *s1, const char *s2, int n)
while (i < n && (s1[i++] = *(s2++)) != 0);
- s1[n - 1] = 0;
-
- if (i >= n)
+ if (i >= n) {
+ s1[n - 1] = 0;
return 0;
+ }
s1[i] = 0;
diff --git a/usr/src/grub/grub-0.97/stage2/cmdline.c b/usr/src/grub/grub-0.97/stage2/cmdline.c
index 46c5fda027..6d5591e1de 100644
--- a/usr/src/grub/grub-0.97/stage2/cmdline.c
+++ b/usr/src/grub/grub-0.97/stage2/cmdline.c
@@ -212,8 +212,27 @@ run_script (char *script, char *heap)
intervention. */
if (fallback_entryno < 0)
{
- grub_printf ("\nPress any key to continue...");
- (void) getkey ();
+ int time1, time2 = -1;
+
+ grub_printf (
+ "\nRebooting in 2 minutes (press any key to continue)...");
+ grub_timeout = 120;
+
+ /* using RT clock now, need to initialize value */
+ while ((time1 = getrtsecs()) == 0xFF);
+
+ while (grub_timeout >= 0) {
+ if ((time1 = getrtsecs()) != time2 && time1 != 0xFF) {
+ time2 = time1;
+ grub_timeout--;
+ }
+
+ if (checkkey() >= 0)
+ break;
+ }
+
+ grub_printf ("\nresetting...");
+ grub_reboot();
}
return 1;
diff --git a/usr/src/grub/grub-0.97/stage2/common.c b/usr/src/grub/grub-0.97/stage2/common.c
index b4bb696641..3ca5340206 100644
--- a/usr/src/grub/grub-0.97/stage2/common.c
+++ b/usr/src/grub/grub-0.97/stage2/common.c
@@ -99,7 +99,8 @@ char *err_list[] =
[ERR_NEWER_VERSION] = "Newer on-disk pool version",
[ERR_NOTXPM] = "Image not in XPM graphics format",
[ERR_TOOMANYCOLORS] = "Image cannot use more than 14 colors",
- [ERR_CORRUPTXPM] = "File contains corrupt XPM image data"
+ [ERR_CORRUPTXPM] = "File contains corrupt XPM image data",
+ [ERR_NOVAR] = "Unknown variable reference",
};
diff --git a/usr/src/grub/grub-0.97/stage2/cpu.h b/usr/src/grub/grub-0.97/stage2/cpu.h
index 34180727d9..ad2948978f 100644
--- a/usr/src/grub/grub-0.97/stage2/cpu.h
+++ b/usr/src/grub/grub-0.97/stage2/cpu.h
@@ -30,6 +30,8 @@
extern "C" {
#endif
+#include <shared.h>
+
typedef unsigned int uint_t;
typedef unsigned long ulong_t;
@@ -37,11 +39,6 @@ typedef unsigned long ulong_t;
#include <controlregs.h>
-#define CB 0x0001
-
-extern void amd64_flush_tlb(void);
-extern void amd64_flush_tlbentry(caddr_t);
-
extern ulong_t amd64_get_cr2(void);
extern ulong_t amd64_get_cr0(void);
extern ulong_t amd64_get_cr3(void);
diff --git a/usr/src/grub/grub-0.97/stage2/expand.c b/usr/src/grub/grub-0.97/stage2/expand.c
new file mode 100644
index 0000000000..43f8b1f0d7
--- /dev/null
+++ b/usr/src/grub/grub-0.97/stage2/expand.c
@@ -0,0 +1,465 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <expand.h>
+#include <shared.h>
+
+#ifdef SUPPORT_NETBOOT
+#include <grub.h>
+#endif
+
+#include <cpu.h>
+
+#define EVF_DEFINED 0x01
+#define EVF_VALUESET 0x02
+
+typedef struct variable {
+ char v_name[EV_NAMELEN];
+ unsigned int v_flags;
+ char v_value[220]; /* 256 - EV_NAMELEN - sizeof (fields) */
+} variable_t;
+
+static variable_t expvars[32];
+static const unsigned int nexpvars = 32;
+
+int
+set_variable(const char *name, const char *value)
+{
+ unsigned int i;
+ unsigned int avail = nexpvars;
+
+ if (strlen(name) >= sizeof (expvars[0].v_name))
+ return (ERR_WONT_FIT);
+
+ if (value != NULL && strlen(value) >= sizeof (expvars[0].v_value))
+ return (ERR_WONT_FIT);
+
+ for (i = 0; i < nexpvars; i++) {
+ if (expvars[i].v_flags & EVF_DEFINED) {
+ if (grub_strcmp(expvars[i].v_name, name) == 0)
+ break;
+ } else if (i < avail) {
+ avail = i;
+ }
+ }
+
+ if (i == nexpvars) {
+ if (avail == nexpvars)
+ return (ERR_WONT_FIT);
+
+ i = avail;
+ (void) grub_strcpy(expvars[i].v_name, name);
+ expvars[i].v_flags = EVF_DEFINED;
+ }
+
+ if (value != NULL) {
+ (void) grub_strcpy(expvars[i].v_value, value);
+ expvars[i].v_flags |= EVF_VALUESET;
+ } else {
+ expvars[i].v_flags &= ~EVF_VALUESET;
+ }
+
+ return (0);
+}
+
+const char *
+get_variable(const char *name)
+{
+ unsigned int i;
+
+ for (i = 0; i < nexpvars; i++) {
+ if (!(expvars[i].v_flags & EVF_DEFINED))
+ continue;
+ if (grub_strcmp(expvars[i].v_name, name) == 0) {
+ if (expvars[i].v_flags & EVF_VALUESET)
+ return (expvars[i].v_value);
+ return ("");
+ }
+ }
+
+ return (NULL);
+}
+
+static int
+detect_target_operating_mode(void)
+{
+ int ret, ah;
+
+ /*
+ * This function returns 16 bits. The upper 8 are the value of %ah
+ * after calling int 15/ec00. The lower 8 bits are zero if the BIOS
+ * call left CF clear, nonzero otherwise.
+ */
+ ret = get_target_operating_mode();
+ ah = ret & 0xff;
+ ret >>= 8;
+
+ if (ah == 0x86 && ret != 0) {
+ grub_printf("[BIOS 'Detect Target Operating Mode' "
+ "callback unsupported on this platform]\n");
+ return (1); /* unsupported, ignore */
+ }
+
+ if (ah == 0 && ret == 0) {
+ grub_printf("[BIOS accepted mixed-mode target setting!]\n");
+ return (1); /* told the bios what we're up to */
+ }
+
+ if (ah == 0 && ret != 0) {
+ grub_printf("fatal: BIOS reports this machine CANNOT run in "
+ "mixed 32/64-bit mode!\n");
+ return (0);
+ }
+
+ grub_printf("warning: BIOS Detect Target Operating Mode callback "
+ "confused.\n %%ax >> 8 = 0x%x, carry = %d\n", ah, ret);
+
+ return (1);
+}
+
+static int
+amd64_config_cpu(void)
+{
+ struct amd64_cpuid_regs __vcr, *vcr = &__vcr;
+ uint32_t maxeax;
+ uint32_t max_maxeax = 0x100;
+ char vendor[13];
+ int isamd64 = 0;
+ uint32_t stdfeatures = 0, xtdfeatures = 0;
+ uint64_t efer;
+
+ /*
+ * This check may seem silly, but if the C preprocesor symbol __amd64
+ * is #defined during compilation, something that may outwardly seem
+ * like a good idea, uts/common/sys/isa_defs.h will #define _LP64,
+ * which will cause uts/common/sys/int_types.h to typedef uint64_t as
+ * an unsigned long - which is only 4 bytes in size when using a 32-bit
+ * compiler.
+ *
+ * If that happens, all the page table translation routines will fail
+ * horribly, so check the size of uint64_t just to insure some degree
+ * of sanity in future operations.
+ */
+ /*LINTED [sizeof result is invarient]*/
+ if (sizeof (uint64_t) != 8)
+ prom_panic("grub compiled improperly, unable to boot "
+ "64-bit AMD64 executables");
+
+ /*
+ * If the CPU doesn't support the CPUID instruction, it's definitely
+ * not an AMD64.
+ */
+ if (amd64_cpuid_supported() == 0)
+ return (0);
+
+ amd64_cpuid_insn(0, vcr);
+
+ maxeax = vcr->r_eax;
+ {
+ /*LINTED [vendor string from cpuid data]*/
+ uint32_t *iptr = (uint32_t *)vendor;
+
+ *iptr++ = vcr->r_ebx;
+ *iptr++ = vcr->r_edx;
+ *iptr++ = vcr->r_ecx;
+
+ vendor[12] = '\0';
+ }
+
+ if (maxeax > max_maxeax) {
+ grub_printf("cpu: warning, maxeax was 0x%x -> 0x%x\n",
+ maxeax, max_maxeax);
+ maxeax = max_maxeax;
+ }
+
+ if (maxeax < 1)
+ return (0); /* no additional functions, not an AMD64 */
+ else {
+ uint_t family, model, step;
+
+ amd64_cpuid_insn(1, vcr);
+
+ /*
+ * All AMD64/IA32e processors technically SHOULD report
+ * themselves as being in family 0xf, but for some reason
+ * Simics doesn't, and this may change in the future, so
+ * don't error out if it's not true.
+ */
+ if ((family = BITX(vcr->r_eax, 11, 8)) == 0xf)
+ family += BITX(vcr->r_eax, 27, 20);
+
+ if ((model = BITX(vcr->r_eax, 7, 4)) == 0xf)
+ model += BITX(vcr->r_eax, 19, 16) << 4;
+ step = BITX(vcr->r_eax, 3, 0);
+
+ grub_printf("cpu: '%s' family %d model %d step %d\n",
+ vendor, family, model, step);
+ stdfeatures = vcr->r_edx;
+ }
+
+ amd64_cpuid_insn(0x80000000, vcr);
+
+ if (vcr->r_eax & 0x80000000) {
+ uint32_t xmaxeax = vcr->r_eax;
+ const uint32_t max_xmaxeax = 0x80000100;
+
+ if (xmaxeax > max_xmaxeax) {
+ grub_printf("amd64: warning, xmaxeax was "
+ "0x%x -> 0x%x\n", xmaxeax, max_xmaxeax);
+ xmaxeax = max_xmaxeax;
+ }
+
+ if (xmaxeax >= 0x80000001) {
+ amd64_cpuid_insn(0x80000001, vcr);
+ xtdfeatures = vcr->r_edx;
+ }
+ }
+
+ if (BITX(xtdfeatures, 29, 29)) /* long mode */
+ isamd64++;
+ else
+ grub_printf("amd64: CPU does NOT support long mode\n");
+
+ if (!BITX(stdfeatures, 0, 0)) {
+ grub_printf("amd64: CPU does NOT support FPU\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 4, 4)) {
+ grub_printf("amd64: CPU does NOT support TSC\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 5, 5)) {
+ grub_printf("amd64: CPU does NOT support MSRs\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 6, 6)) {
+ grub_printf("amd64: CPU does NOT support PAE\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 8, 8)) {
+ grub_printf("amd64: CPU does NOT support CX8\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 13, 13)) {
+ grub_printf("amd64: CPU does NOT support PGE\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 19, 19)) {
+ grub_printf("amd64: CPU does NOT support CLFSH\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 23, 23)) {
+ grub_printf("amd64: CPU does NOT support MMX\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 24, 24)) {
+ grub_printf("amd64: CPU does NOT support FXSR\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 25, 25)) {
+ grub_printf("amd64: CPU does NOT support SSE\n");
+ isamd64--;
+ }
+
+ if (!BITX(stdfeatures, 26, 26)) {
+ grub_printf("amd64: CPU does NOT support SSE2\n");
+ isamd64--;
+ }
+
+ if (isamd64 < 1) {
+ grub_printf("amd64: CPU does not support amd64 executables.\n");
+ return (0);
+ }
+
+ amd64_rdmsr(MSR_AMD_EFER, &efer);
+ if (efer & AMD_EFER_SCE)
+ grub_printf("amd64: EFER_SCE (syscall/sysret) already "
+ "enabled\n");
+ if (efer & AMD_EFER_NXE)
+ grub_printf("amd64: EFER_NXE (no-exec prot) already enabled\n");
+ if (efer & AMD_EFER_LME)
+ grub_printf("amd64: EFER_LME (long mode) already enabled\n");
+
+ return (detect_target_operating_mode());
+}
+
+static int
+isamd64()
+{
+ static int ret = -1;
+
+ if (ret == -1)
+ ret = amd64_config_cpu();
+
+ return (ret);
+}
+
+static int
+check_min_mem64(void)
+{
+ if (min_mem64 == 0)
+ return (1);
+
+ if ((mbi.mem_upper / 10240) * 11 >= min_mem64)
+ return (1);
+
+ return (0);
+}
+
+/*
+ * Given the nul-terminated input string s, expand all variable references
+ * within that string into the buffer pointed to by d, which must be of length
+ * not less than len bytes.
+ *
+ * We also expand the special case tokens "$ISADIR" and "$ZFS-BOOTFS" here.
+ *
+ * If the string will not fit, returns ERR_WONT_FIT.
+ * If a nonexistent variable is referenced, returns ERR_NOVAR.
+ * Otherwise, returns 0. The resulting string is nul-terminated. On error,
+ * the contents of the destination buffer are undefined.
+ */
+int
+expand_string(const char *s, char *d, unsigned int len)
+{
+ unsigned int i;
+ int vlen;
+ const char *p;
+ char *q;
+ const char *start;
+ char name[EV_NAMELEN];
+ const char *val;
+
+ for (p = s, q = d; *p != '\0' && q < d + len; ) {
+ /* Special case: $ISADIR */
+ if (grub_strncmp(p, "$ISADIR", 7) == 0) {
+ if (isamd64() && check_min_mem64()) {
+ if (q + 5 >= d + len)
+ return (ERR_WONT_FIT);
+ (void) grub_memcpy(q, "amd64", 5);
+ q += 5; /* amd64 */
+ }
+ p += 7; /* $ISADIR */
+ continue;
+ }
+ /* Special case: $ZFS-BOOTFS */
+ if (grub_strncmp(p, "$ZFS-BOOTFS", 11) == 0 &&
+ is_zfs_mount != 0) {
+ if (current_bootpath[0] == '\0' &&
+ current_devid[0] == '\0') {
+ return (ERR_NO_BOOTPATH);
+ }
+
+ /* zfs-bootfs=%s/%u */
+ vlen = (current_bootfs_obj > 0) ? 10 : 0;
+ vlen += 11;
+ vlen += strlen(current_rootpool);
+
+ /* ,bootpath=\"%s\" */
+ if (current_bootpath[0] != '\0')
+ vlen += 12 + strlen(current_bootpath);
+
+ /* ,diskdevid=\"%s\" */
+ if (current_devid[0] != '\0')
+ vlen += 13 + strlen(current_devid);
+
+ if (q + vlen >= d + len)
+ return (ERR_WONT_FIT);
+
+ if (current_bootfs_obj > 0) {
+ q += grub_sprintf(q, "zfs-bootfs=%s/%u",
+ current_rootpool, current_bootfs_obj);
+ } else {
+ q += grub_sprintf(q, "zfs-bootfs=%s",
+ current_rootpool);
+ }
+ if (current_bootpath[0] != '\0') {
+ q += grub_sprintf(q, ",bootpath=\"%s\"",
+ current_bootpath);
+ }
+ if (current_devid[0] != '\0') {
+ q += grub_sprintf(q, ",diskdevid=\"%s\"",
+ current_devid);
+ }
+
+ p += 11; /* $ZFS-BOOTFS */
+ continue;
+ }
+ if (*p == '$' && *(p + 1) == '{') {
+ start = p + 2;
+ for (p = start; *p != '\0' && *p != '}' &&
+ p - start < sizeof (name) - 1; p++) {
+ name[p - start] = *p;
+ }
+ /*
+ * Unterminated reference. Copy verbatim.
+ */
+ if (p - start >= sizeof (name) - 1 || *p != '}') {
+ p = start;
+ *q++ = '$';
+ *q++ = '{';
+ continue;
+ }
+
+ name[p - start] = '\0';
+ val = get_variable(name);
+ if (val == NULL)
+ return (ERR_NOVAR);
+
+ if ((vlen = grub_strlen(val)) >= q + len - d)
+ return (ERR_WONT_FIT);
+
+ (void) grub_memcpy(q, val, vlen);
+ q += vlen;
+ p++;
+ } else {
+ *q++ = *p++;
+ }
+ }
+
+ if (q >= d + len)
+ return (ERR_WONT_FIT);
+
+ *q = '\0';
+
+ return (0);
+}
+
+void
+dump_variables(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < nexpvars; i++) {
+ if (!(expvars[i].v_flags & EVF_DEFINED))
+ continue;
+ (void) grub_printf("[%u] '%s' => '%s'\n", i, expvars[i].v_name,
+ (expvars[i].v_flags & EVF_VALUESET) ?
+ expvars[i].v_value : "");
+ }
+}
diff --git a/usr/src/grub/grub-0.97/stage2/expand.h b/usr/src/grub/grub-0.97/stage2/expand.h
new file mode 100644
index 0000000000..ed8344e8af
--- /dev/null
+++ b/usr/src/grub/grub-0.97/stage2/expand.h
@@ -0,0 +1,31 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _GRUB_EXPAND_H
+#define _GRUB_EXPAND_H
+
+#define EV_NAMELEN 32
+
+extern void init_variables(void);
+extern int set_variable(const char *, const char *);
+extern const char *get_variable(const char *);
+extern int expand_string(const char *, char *, unsigned int);
+extern void dump_variables(void);
+
+#endif
diff --git a/usr/src/grub/grub-0.97/stage2/serial.c b/usr/src/grub/grub-0.97/stage2/serial.c
index 16c376fa7d..4e120e000d 100644
--- a/usr/src/grub/grub-0.97/stage2/serial.c
+++ b/usr/src/grub/grub-0.97/stage2/serial.c
@@ -25,6 +25,9 @@
#include <term.h>
#include <terminfo.h>
+#define COMP_BS_SERIAL 0x01
+#define COMP_BS_BIOS 0x02
+
/* An input buffer. */
static char input_buf[8];
static int npending = 0;
@@ -33,6 +36,7 @@ static int serial_x;
static int serial_y;
static int keep_track = 1;
+static int composite_bitset = COMP_BS_SERIAL | COMP_BS_BIOS;
/* Hardware-dependent definitions. */
@@ -177,10 +181,10 @@ serial_hw_init (unsigned short port, unsigned int speed,
/* Get rid of TERM_NEED_INIT from the serial terminal. */
for (i = 0; term_table[i].name; i++)
- if (grub_strcmp (term_table[i].name, "serial") == 0)
+ if (grub_strcmp (term_table[i].name, "serial") == 0 ||
+ grub_strcmp (term_table[i].name, "composite") == 0)
{
term_table[i].flags &= ~TERM_NEED_INIT;
- break;
}
/* FIXME: should check if the serial terminal was found. */
@@ -402,8 +406,12 @@ serial_getxy (void)
void
serial_gotoxy (int x, int y)
{
+ int saved_cbs = composite_bitset;
+
keep_track = 0;
+ composite_bitset &= ~COMP_BS_BIOS;
ti_cursor_address (x, y);
+ composite_bitset = saved_cbs;
keep_track = 1;
serial_x = x;
@@ -413,8 +421,12 @@ serial_gotoxy (int x, int y)
void
serial_cls (void)
{
+ int saved_cbs = composite_bitset;
+
keep_track = 0;
+ composite_bitset &= ~COMP_BS_BIOS;
ti_clear_screen ();
+ composite_bitset = saved_cbs;
keep_track = 1;
serial_x = serial_y = 0;
@@ -423,12 +435,67 @@ serial_cls (void)
void
serial_setcolorstate (color_state state)
{
+ int saved_cbs = composite_bitset;
+
keep_track = 0;
+ composite_bitset &= ~COMP_BS_BIOS;
if (state == COLOR_STATE_HIGHLIGHT)
ti_enter_standout_mode ();
else
ti_exit_standout_mode ();
+ composite_bitset = saved_cbs;
keep_track = 1;
}
+void
+composite_putchar (int c)
+{
+ if (composite_bitset & COMP_BS_SERIAL)
+ serial_putchar (c);
+ if (composite_bitset & COMP_BS_BIOS)
+ console_putchar (c);
+}
+
+int
+composite_getkey (void)
+{
+ for (;;) {
+ if (serial_checkkey () != -1)
+ return (serial_getkey ());
+ if (console_checkkey () != -1)
+ return (console_getkey ());
+ }
+}
+
+int
+composite_checkkey (void)
+{
+ int ch;
+
+ if ((ch = serial_checkkey ()) != -1)
+ return (ch);
+ return (console_checkkey ());
+}
+
+void
+composite_gotoxy (int x, int y)
+{
+ serial_gotoxy (x, y);
+ console_gotoxy (x, y);
+}
+
+void
+composite_cls (void)
+{
+ serial_cls();
+ console_cls();
+}
+
+void
+composite_setcolorstate (color_state state)
+{
+ serial_setcolorstate (state);
+ console_setcolorstate (state);
+}
+
#endif /* SUPPORT_SERIAL */
diff --git a/usr/src/grub/grub-0.97/stage2/shared.h b/usr/src/grub/grub-0.97/stage2/shared.h
index 205715b021..cb41978ce3 100644
--- a/usr/src/grub/grub-0.97/stage2/shared.h
+++ b/usr/src/grub/grub-0.97/stage2/shared.h
@@ -579,7 +579,7 @@ typedef enum
ERR_NOTXPM,
ERR_TOOMANYCOLORS,
ERR_CORRUPTXPM,
-
+ ERR_NOVAR,
MAX_ERR_NUM
} grub_error_t;
@@ -639,6 +639,8 @@ extern int fallback_entryno;
extern int default_entry;
extern int current_entryno;
+extern unsigned int min_mem64;
+
/* The constants for password types. */
typedef enum
{
diff --git a/usr/src/grub/grub-0.97/stage2/stage2.c b/usr/src/grub/grub-0.97/stage2/stage2.c
index 896635b62d..c02e9ef2e4 100644
--- a/usr/src/grub/grub-0.97/stage2/stage2.c
+++ b/usr/src/grub/grub-0.97/stage2/stage2.c
@@ -19,6 +19,9 @@
#include <shared.h>
#include <term.h>
+#include <expand.h>
+
+#define MENU_ROWS 7
grub_jmp_buf restart_env;
@@ -237,6 +240,7 @@ run_menu (char *menu_entries, char *config_entries, int num_entries,
int c, time1, time2 = -1, first_entry = 0;
char *cur_entry = 0;
struct term_entry *prev_term = NULL;
+ const char *console = NULL;
/*
* Main loop for menu UI.
@@ -247,7 +251,7 @@ restart:
invariant for TERM_DUMB: first_entry == 0 */
if (! (current_term->flags & TERM_DUMB))
{
- while (entryno > 11)
+ while (entryno > MENU_ROWS - 1)
{
first_entry++;
entryno--;
@@ -306,7 +310,7 @@ restart:
if (current_term->flags & TERM_DUMB)
print_entries_raw (num_entries, first_entry, menu_entries);
else
- print_border (3, 12);
+ print_border (3, MENU_ROWS);
grub_printf ("\n\
Use the %c and %c keys to select which entry is highlighted.\n",
@@ -332,10 +336,20 @@ restart:
selected line, or escape to go back to the main menu.");
}
+ /* The selected OS console is special; if it's in use, tell the user. */
+ console = get_variable("os_console");
+ if (console != NULL) {
+ printf("\n\n Selected OS console device is '%s'."
+ "\n To change OS console device, enter command-line mode"
+ "\n and use 'variable os_console <dev>', then Esc to return."
+ "\n Valid <dev> values are: ttya, ttyb, ttyc, ttyd, vga",
+ console);
+ }
+
if (current_term->flags & TERM_DUMB)
grub_printf ("\n\nThe selected entry is %d ", entryno);
else
- print_entries (3, 12, first_entry, entryno, menu_entries);
+ print_entries (3, MENU_ROWS, first_entry, entryno, menu_entries);
}
/* XX using RT clock now, need to initialize value */
@@ -425,7 +439,7 @@ restart:
else if (first_entry > 0)
{
first_entry--;
- print_entries (3, 12, first_entry, entryno,
+ print_entries (3, MENU_ROWS, first_entry, entryno,
menu_entries);
}
}
@@ -437,7 +451,7 @@ restart:
entryno++;
else
{
- if (entryno < 11)
+ if (entryno < MENU_ROWS - 1)
{
print_entry (4 + entryno, 0,
get_entry (menu_entries,
@@ -449,17 +463,17 @@ restart:
first_entry + entryno,
0));
}
- else if (num_entries > 12 + first_entry)
+ else if (num_entries > MENU_ROWS + first_entry)
{
first_entry++;
- print_entries (3, 12, first_entry, entryno, menu_entries);
+ print_entries (3, MENU_ROWS, first_entry, entryno, menu_entries);
}
}
}
else if (c == 7)
{
/* Page Up */
- first_entry -= 12;
+ first_entry -= MENU_ROWS;
if (first_entry < 0)
{
entryno += first_entry;
@@ -467,20 +481,20 @@ restart:
if (entryno < 0)
entryno = 0;
}
- print_entries (3, 12, first_entry, entryno, menu_entries);
+ print_entries (3, MENU_ROWS, first_entry, entryno, menu_entries);
}
else if (c == 3)
{
/* Page Down */
- first_entry += 12;
+ first_entry += MENU_ROWS;
if (first_entry + entryno + 1 >= num_entries)
{
- first_entry = num_entries - 12;
+ first_entry = num_entries - MENU_ROWS;
if (first_entry < 0)
first_entry = 0;
entryno = num_entries - first_entry - 1;
}
- print_entries (3, 12, first_entry, entryno, menu_entries);
+ print_entries (3, MENU_ROWS, first_entry, entryno, menu_entries);
}
if (config_entries)
@@ -503,7 +517,8 @@ restart:
{
/* But `o' differs from `O', since it may causes
the menu screen to scroll up. */
- if (entryno < 11 || (current_term->flags & TERM_DUMB))
+ if (entryno < MENU_ROWS - 1 ||
+ (current_term->flags & TERM_DUMB))
entryno++;
else
first_entry++;
@@ -541,7 +556,7 @@ restart:
if (entryno >= num_entries)
entryno--;
- if (first_entry && num_entries < 12 + first_entry)
+ if (first_entry && num_entries < MENU_ROWS + first_entry)
first_entry--;
}
@@ -553,7 +568,7 @@ restart:
grub_printf ("\n");
}
else
- print_entries (3, 12, first_entry, entryno, menu_entries);
+ print_entries (3, MENU_ROWS, first_entry, entryno, menu_entries);
}
cur_entry = menu_entries;
diff --git a/usr/src/grub/grub-0.97/stage2/term.h b/usr/src/grub/grub-0.97/stage2/term.h
index 8ed8b9dc86..65d4220669 100644
--- a/usr/src/grub/grub-0.97/stage2/term.h
+++ b/usr/src/grub/grub-0.97/stage2/term.h
@@ -119,6 +119,14 @@ int serial_getxy (void);
void serial_gotoxy (int x, int y);
void serial_cls (void);
void serial_setcolorstate (color_state state);
+
+void composite_putchar (int c);
+int composite_checkkey (void);
+int composite_getkey (void);
+int composite_getxy (void);
+void composite_gotoxy (int x, int y);
+void composite_cls (void);
+void composite_setcolorstate (color_state state);
#endif
#ifdef SUPPORT_HERCULES
diff --git a/usr/src/head/Makefile b/usr/src/head/Makefile
index 62f8ee08d7..2662aa1d81 100644
--- a/usr/src/head/Makefile
+++ b/usr/src/head/Makefile
@@ -146,6 +146,7 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
regex.h \
regexp.h \
resolv.h \
+ resolv_joy.h \
rje.h \
rtld_db.h \
sac.h \
@@ -205,6 +206,7 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
wordexp.h \
xti.h \
xti_inet.h \
+ zdoor.h \
zone.h
ISOHDRS = \
diff --git a/usr/src/head/libzonecfg.h b/usr/src/head/libzonecfg.h
index d41dbb0520..0212224de5 100644
--- a/usr/src/head/libzonecfg.h
+++ b/usr/src/head/libzonecfg.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#ifndef _LIBZONECFG_H
@@ -42,6 +43,7 @@ extern "C" {
#include <netinet/in.h>
#include <sys/socket.h>
#include <net/if.h>
+#include <sys/mac.h>
#include <stdio.h>
#include <rctl.h>
#include <zone.h>
@@ -127,6 +129,8 @@ extern "C" {
#define MAXAUTHS 4096
#define ZONE_MGMT_PROF "Zone Management"
+#define ZONE_INT32SZ 11 /* string to hold 32bit int. */
+
/* Owner, group, and mode (defined by packaging) for the config directory */
#define ZONE_CONFIG_UID 0 /* root */
#define ZONE_CONFIG_GID 3 /* sys */
@@ -150,9 +154,11 @@ extern "C" {
#define ALIAS_MAXSEMIDS "max-sem-ids"
#define ALIAS_MAXLOCKEDMEM "locked"
#define ALIAS_MAXSWAP "swap"
+#define ALIAS_MAXPHYSMEM "physical"
#define ALIAS_SHARES "cpu-shares"
#define ALIAS_CPUCAP "cpu-cap"
#define ALIAS_MAXPROCS "max-processes"
+#define ALIAS_ZFSPRI "zfs-io-priority"
/* Default name for zone detached manifest */
#define ZONE_DETACHED "SUNWdetached.xml"
@@ -191,15 +197,30 @@ struct zone_fstab {
char zone_fs_raw[MAXPATHLEN]; /* device to fsck */
};
+/*
+ * Generic resource attribute list.
+ * Key/value resource that can be attached to net or device.
+ */
+struct zone_res_attrtab {
+ char zone_res_attr_name[MAXNAMELEN];
+ char zone_res_attr_value[MAXNAMELEN];
+ struct zone_res_attrtab *zone_res_attr_next;
+};
+
struct zone_nwiftab {
char zone_nwif_address[INET6_ADDRSTRLEN]; /* shared-ip only */
char zone_nwif_allowed_address[INET6_ADDRSTRLEN]; /* excl-ip only */
char zone_nwif_physical[LIFNAMSIZ];
+ char zone_nwif_mac[MAXMACADDRLEN]; /* excl-ip only */
+ char zone_nwif_vlan_id[ZONE_INT32SZ]; /* excl-ip only */
+ char zone_nwif_gnic[LIFNAMSIZ]; /* excl-ip only */
char zone_nwif_defrouter[INET6_ADDRSTRLEN];
+ struct zone_res_attrtab *zone_nwif_attrp;
};
struct zone_devtab {
char zone_dev_match[MAXPATHLEN];
+ struct zone_res_attrtab *zone_dev_attrp;
};
struct zone_rctlvaltab {
@@ -230,10 +251,6 @@ struct zone_psettab {
char zone_importance[MAXNAMELEN];
};
-struct zone_mcaptab {
- char zone_physmem_cap[MAXNAMELEN];
-};
-
struct zone_pkgtab {
char zone_pkg_name[MAXNAMELEN];
char zone_pkg_version[ZONE_PKG_VERSMAX];
@@ -317,6 +334,8 @@ extern int zonecfg_set_bootargs(zone_dochandle_t, char *);
extern int zonecfg_get_sched_class(zone_dochandle_t, char *, size_t);
extern int zonecfg_set_sched(zone_dochandle_t, char *);
extern int zonecfg_get_dflt_sched_class(zone_dochandle_t, char *, int);
+extern zoneid_t zonecfg_get_did(zone_dochandle_t);
+extern void zonecfg_set_did(zone_dochandle_t);
/*
* Set/retrieve the brand for the zone
@@ -341,6 +360,15 @@ extern int zonecfg_find_mounts(char *, int(*)(const struct mnttab *,
void *), void *);
/*
+ * Resource key/value attributes (properties).
+ */
+extern int zonecfg_add_res_attr(struct zone_res_attrtab **,
+ struct zone_res_attrtab *);
+extern void zonecfg_free_res_attr_list(struct zone_res_attrtab *);
+extern int zonecfg_remove_res_attr(struct zone_res_attrtab **,
+ struct zone_res_attrtab *);
+
+/*
* Network interface configuration.
*/
extern int zonecfg_add_nwif(zone_dochandle_t, struct zone_nwiftab *);
@@ -422,13 +450,6 @@ extern int zonecfg_modify_pset(zone_dochandle_t, struct zone_psettab *);
extern int zonecfg_lookup_pset(zone_dochandle_t, struct zone_psettab *);
/*
- * mem-cap configuration.
- */
-extern int zonecfg_delete_mcap(zone_dochandle_t);
-extern int zonecfg_modify_mcap(zone_dochandle_t, struct zone_mcaptab *);
-extern int zonecfg_lookup_mcap(zone_dochandle_t, struct zone_mcaptab *);
-
-/*
* Temporary pool support functions.
*/
extern int zonecfg_destroy_tmp_pool(char *, char *, int);
@@ -485,7 +506,6 @@ extern int zonecfg_setdsent(zone_dochandle_t);
extern int zonecfg_getdsent(zone_dochandle_t, struct zone_dstab *);
extern int zonecfg_enddsent(zone_dochandle_t);
extern int zonecfg_getpsetent(zone_dochandle_t, struct zone_psettab *);
-extern int zonecfg_getmcapent(zone_dochandle_t, struct zone_mcaptab *);
extern int zonecfg_getpkgdata(zone_dochandle_t, uu_avl_pool_t *,
uu_avl_t *);
extern int zonecfg_setdevperment(zone_dochandle_t);
@@ -509,6 +529,7 @@ extern int zonecfg_set_limitpriv(zone_dochandle_t, char *);
* Higher-level routines.
*/
extern int zone_get_brand(char *, char *, size_t);
+extern zoneid_t zone_get_did(char *);
extern int zone_get_rootpath(char *, char *, size_t);
extern int zone_get_devroot(char *, char *, size_t);
extern int zone_get_zonepath(char *, char *, size_t);
@@ -517,7 +538,9 @@ extern int zone_set_state(char *, zone_state_t);
extern char *zone_state_str(zone_state_t);
extern int zonecfg_get_name_by_uuid(const uuid_t, char *, size_t);
extern int zonecfg_get_uuid(const char *, uuid_t);
+extern int zonecfg_set_uuid(const char *, const char *, const char *);
extern int zonecfg_default_brand(char *, size_t);
+extern int zonecfg_fix_obsolete(zone_dochandle_t);
/*
* Iterator for configured zones.
diff --git a/usr/src/head/resolv_joy.h b/usr/src/head/resolv_joy.h
new file mode 100644
index 0000000000..262cf6121d
--- /dev/null
+++ b/usr/src/head/resolv_joy.h
@@ -0,0 +1,472 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
+ * All Rights Reserved
+ *
+ * Portions of this source code were derived from Berkeley
+ * 4.3 BSD under license from the regents of the University of
+ * California.
+ */
+
+/*
+ * BIND 4.9.4:
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * --Copyright--
+ *
+ * End BIND 4.9.4
+ */
+
+/*
+ * Copyright (c) 1983, 1987, 1989
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * @(#)resolv.h 8.1 (Berkeley) 6/2/93
+ * $Id: resolv.h,v 8.52 2003/04/29 02:27:03 marka Exp $
+ */
+
+#ifndef _RESOLV_JOY_H
+#define _RESOLV_JOY_H
+
+#ifdef _RESOLV_H_
+#error "resolv.h and resolv_joy.h should not be used together"
+#endif
+
+#include <sys/param.h>
+
+#include <stdio.h>
+#include <arpa/nameser.h>
+#include <sys/socket.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Revision information. This is the release date in YYYYMMDD format.
+ * It can change every day so the right thing to do with it is use it
+ * in preprocessor commands such as "#if (__RES > 19931104)". Do not
+ * compare for equality; rather, use it to determine whether your resolver
+ * is new enough to contain a certain feature.
+ */
+
+#define __RES 20090302
+
+#pragma redefine_extname dn_expand joy_dn_expand
+#pragma redefine_extname res_nsearch joy_res_nsearch
+#pragma redefine_extname res_ninit joy_res_ninit
+#pragma redefine_extname res_ndestroy joy_res_ndestroy
+#pragma redefine_extname res_gethostbyaddr joy_res_gethostbyaddr
+#pragma redefine_extname res_gethostbyname joy_res_gethostbyname
+#pragma redefine_extname res_gethostbyname2 joy_res_gethostbyname2
+#pragma redefine_extname res_endhostent joy_res_endhostent
+#pragma redefine_extname res_sethostent joy_res_sethostent
+#pragma redefine_extname __res_override_retry __joy_res_override_retry
+#pragma redefine_extname __res_unset_no_hosts_fallback \
+ __joy_res_unset_no_hosts_fallback
+#pragma redefine_extname __res_set_no_hosts_fallback \
+ __joy_res_set_no_hosts_fallback
+#pragma redefine_extname __h_errno __joy_h_errno
+#pragma redefine_extname __ns_get16 __joy_ns_get16
+#pragma redefine_extname __ns_get32 __joy_ns_get32
+
+
+#define RES_SET_H_ERRNO(r, x) __h_errno_set(r, x)
+struct __res_state; /* forward */
+
+void __h_errno_set(struct __res_state *res, int err);
+
+/*
+ * Resolver configuration file.
+ * Normally not present, but may contain the address of the
+ * initial name server(s) to query and the domain search list.
+ */
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF "/etc/resolv.conf"
+#endif
+
+#ifdef __STDC__
+#ifndef __P
+#define __P(x) x
+#endif
+#else
+#ifndef __P
+#define __P(x) ()
+#endif
+#endif /* __STDC__ */
+
+typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
+ res_sendhookact;
+
+typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr * const *ns,
+ const uchar_t **query,
+ int *querylen,
+ uchar_t *ans,
+ int anssiz,
+ int *resplen));
+
+typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr *ns,
+ const uchar_t *query,
+ int querylen,
+ uchar_t *ans,
+ int anssiz,
+ int *resplen));
+
+struct res_sym {
+ int number; /* Identifying number, like T_MX */
+ const char *name; /* Its symbolic name, like "MX" */
+ const char *humanname; /* Its fun name, like "mail exchanger" */
+};
+
+/*
+ * Global defines and variables for resolver stub.
+ */
+/* ADDRSORT and MAXADDR retained for compatibility; not used */
+#define ADDRSORT 1 /* enable the address-sorting option */
+#define MAXADDR 10 /* max # addresses to sort by */
+
+#define MAXNS 32 /* max # name servers we'll track */
+#define MAXDFLSRCH 3 /* # default domain levels to try */
+#define MAXDNSRCH 6 /* max # domains in search path */
+#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
+
+#define RES_TIMEOUT 5 /* min. seconds between retries */
+#define MAXRESOLVSORT 10 /* number of net to sort on */
+#define RES_MAXNDOTS 15 /* should reflect bit field size */
+#define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */
+#define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */
+#define RES_DFLRETRY 2 /* Default #/tries. */
+#define RES_MAXTIME 65535 /* Infinity, in milliseconds. */
+
+struct __res_state_ext;
+
+struct __res_state {
+ int retrans; /* retransmission time interval */
+ int retry; /* number of times to retransmit */
+#ifdef __sun
+ uint_t options; /* option flags - see below. */
+#else
+ ulong_t options; /* option flags - see below. */
+#endif
+ int nscount; /* number of name servers */
+ struct sockaddr_in
+ nsaddr_list[MAXNS]; /* address of name server */
+#define nsaddr nsaddr_list[0] /* for backward compatibility */
+ ushort_t id; /* current packet id */
+ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
+ char defdname[256]; /* default domain (deprecated) */
+#ifdef __sun
+ uint_t pfcode; /* RES_PRF_ flags - see below. */
+#else
+ ulong_t pfcode; /* RES_PRF_ flags - see below. */
+#endif
+ unsigned ndots:4; /* threshold for initial abs. query */
+ unsigned nsort:4; /* number of elements in sort_list[] */
+ char unused[3];
+ struct {
+ struct in_addr addr;
+ unsigned int mask;
+ } sort_list[MAXRESOLVSORT];
+ res_send_qhook qhook; /* query hook */
+ res_send_rhook rhook; /* response hook */
+ int res_h_errno; /* last one set for this context */
+ int _vcsock; /* PRIVATE: for res_send VC i/o */
+ uint_t _flags; /* PRIVATE: see below */
+ uint_t _pad; /* make _u 64 bit aligned */
+ union {
+ /* On an 32-bit arch this means 512b total. */
+ char pad[72 - 4*sizeof (int) - 2*sizeof (void *)];
+ struct {
+ uint16_t nscount;
+ uint16_t nstimes[MAXNS]; /* ms. */
+ int nssocks[MAXNS];
+ struct __res_state_ext *ext; /* extention for IPv6 */
+ uchar_t _rnd[16]; /* PRIVATE: random state */
+ } _ext;
+ } _u;
+};
+
+typedef struct __res_state *res_state;
+
+union res_sockaddr_union {
+ struct sockaddr_in sin;
+#ifdef IN6ADDR_ANY_INIT
+ struct sockaddr_in6 sin6;
+#endif
+#ifdef ISC_ALIGN64
+ int64_t __align64; /* 64bit alignment */
+#else
+ int32_t __align32; /* 32bit alignment */
+#endif
+ char __space[128]; /* max size */
+};
+
+/*
+ * Resolver flags (used to be discrete per-module statics ints).
+ */
+#define RES_F_VC 0x00000001 /* socket is TCP */
+#define RES_F_CONN 0x00000002 /* socket is connected */
+#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */
+#define RES_F__UNUSED 0x00000008 /* (unused) */
+#define RES_F_LASTMASK 0x000000F0 /* ordinal server of last res_nsend */
+#define RES_F_LASTSHIFT 4 /* bit position of LASTMASK "flag" */
+#define RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)
+
+/* res_findzonecut2() options */
+#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */
+#define RES_IPV4ONLY 0x00000002 /* IPv4 only */
+#define RES_IPV6ONLY 0x00000004 /* IPv6 only */
+
+/*
+ * Resolver options (keep these in synch with res_debug.c, please)
+ */
+#define RES_INIT 0x00000001 /* address initialized */
+#define RES_DEBUG 0x00000002 /* print debug messages */
+#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL) */
+#define RES_USEVC 0x00000008 /* use virtual circuit */
+#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
+#define RES_IGNTC 0x00000020 /* ignore trucation errors */
+#define RES_RECURSE 0x00000040 /* recursion desired */
+#define RES_DEFNAMES 0x00000080 /* use default domain name */
+#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
+#define RES_DNSRCH 0x00000200 /* search up local domain tree */
+#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
+#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
+#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
+#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
+#define RES_ROTATE 0x00004000 /* rotate ns list after each query */
+#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */
+#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */
+#define RES_BLAST 0x00020000 /* blast all recursive servers */
+#define RES_NO_NIBBLE 0x00040000 /* disable IPv6 nibble mode reverse */
+#define RES_NO_BITSTRING 0x00080000 /* disable IPv6 bitstring mode revrse */
+#define RES_NOTLDQUERY 0x00100000 /* don't unqualified name as a tld */
+#define RES_USE_DNSSEC 0x00200000 /* use DNSSEC using OK bit in OPT */
+/* KAME extensions: use higher bit to avoid conflict with ISC use */
+#define RES_USE_DNAME 0x10000000 /* use DNAME */
+#define RES_USE_EDNS0 0x40000000 /* use EDNS0 if configured */
+#define RES_NO_NIBBLE2 0x80000000 /* disable alternate nibble lookup */
+
+#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
+
+/*
+ * Resolver "pfcode" values. Used by dig.
+ */
+#define RES_PRF_STATS 0x00000001
+#define RES_PRF_UPDATE 0x00000002
+#define RES_PRF_CLASS 0x00000004
+#define RES_PRF_CMD 0x00000008
+#define RES_PRF_QUES 0x00000010
+#define RES_PRF_ANS 0x00000020
+#define RES_PRF_AUTH 0x00000040
+#define RES_PRF_ADD 0x00000080
+#define RES_PRF_HEAD1 0x00000100
+#define RES_PRF_HEAD2 0x00000200
+#define RES_PRF_TTLID 0x00000400
+#define RES_PRF_HEADX 0x00000800
+#define RES_PRF_QUERY 0x00001000
+#define RES_PRF_REPLY 0x00002000
+#define RES_PRF_INIT 0x00004000
+#define RES_PRF_TRUNC 0x00008000
+/* 0x00010000 */
+
+/* Things involving an internal (static) resolver context. */
+#ifdef _REENTRANT
+extern struct __res_state *__res_state(void);
+#define _res (*__res_state())
+#else
+#ifndef __BIND_NOSTATIC
+extern struct __res_state _res;
+#endif
+#endif
+
+#ifndef __BIND_NOSTATIC
+void fp_nquery __P((const uchar_t *, int, FILE *));
+void fp_query __P((const uchar_t *, FILE *));
+const char *hostalias __P((const char *));
+void p_query __P((const uchar_t *));
+void res_close __P((void));
+int res_init __P((void));
+int res_isourserver __P((const struct sockaddr_in *));
+int res_mkquery __P((int, const char *, int, int, const uchar_t *,
+ int, const uchar_t *, uchar_t *, int));
+int res_query __P((const char *, int, int, uchar_t *, int));
+int res_querydomain __P((const char *, const char *, int, int,
+ uchar_t *, int));
+int res_search __P((const char *, int, int, uchar_t *, int));
+int res_send __P((const uchar_t *, int, uchar_t *, int));
+int res_sendsigned __P((const uchar_t *, int, ns_tsig_key *,
+ uchar_t *, int));
+#endif /* __BIND_NOSTATIC */
+
+extern const struct res_sym __p_key_syms[];
+extern const struct res_sym __p_cert_syms[];
+extern const struct res_sym __p_class_syms[];
+extern const struct res_sym __p_type_syms[];
+extern const struct res_sym __p_rcode_syms[];
+
+int res_hnok __P((const char *));
+int res_ownok __P((const char *));
+int res_mailok __P((const char *));
+int res_dnok __P((const char *));
+int sym_ston __P((const struct res_sym *, const char *, int *));
+const char *sym_ntos __P((const struct res_sym *, int, int *));
+const char *sym_ntop __P((const struct res_sym *, int, int *));
+int b64_ntop __P((uchar_t const *, size_t, char *, size_t));
+int b64_pton __P((char const *, uchar_t *, size_t));
+int loc_aton __P((const char *ascii, uchar_t *binary));
+const char *loc_ntoa __P((const uchar_t *binary, char *ascii));
+int dn_skipname __P((const uchar_t *, const uchar_t *));
+void putlong __P((unsigned int, uchar_t *));
+void putshort __P((unsigned short, uchar_t *));
+const char *p_class __P((int));
+const char *p_time __P((unsigned int));
+const char *p_type __P((int));
+const char *p_rcode __P((int));
+const char *p_sockun __P((union res_sockaddr_union, char *, size_t));
+const uchar_t *p_cdnname __P((const uchar_t *, const uchar_t *, int,
+ FILE *));
+const uchar_t *p_cdname __P((const uchar_t *, const uchar_t *, FILE *));
+const uchar_t *p_fqnname __P((const uchar_t *cp, const uchar_t *msg,
+ int, char *, int));
+const uchar_t *p_fqname __P((const uchar_t *, const uchar_t *, FILE *));
+const char *p_option __P((uint_t option));
+char *p_secstodate __P((uint_t));
+int dn_count_labels __P((const char *));
+int dn_comp __P((const char *, uchar_t *, int,
+ uchar_t **, uchar_t **));
+int dn_expand __P((const uchar_t *, const uchar_t *,
+ const uchar_t *, char *, int));
+void res_rndinit __P((res_state));
+uint_t res_randomid __P((void));
+uint_t res_nrandomid __P((res_state));
+int res_nameinquery __P((const char *, int, int,
+ const uchar_t *, const uchar_t *));
+int res_queriesmatch __P((const uchar_t *, const uchar_t *,
+ const uchar_t *, const uchar_t *));
+const char *p_section __P((int section, int opcode));
+
+
+/* Things involving a resolver context. */
+int res_ninit __P((res_state));
+int res_nisourserver __P((const res_state,
+ const struct sockaddr_in *));
+void fp_resstat __P((const res_state, FILE *));
+void res_pquery __P((const res_state, const uchar_t *, int, FILE *));
+const char *res_hostalias __P((const res_state, const char *,
+ char *, size_t));
+int res_nquery __P((res_state,
+ const char *, int, int, uchar_t *, int));
+int res_nsearch __P((res_state, const char *, int,
+ int, uchar_t *, int));
+int res_nquerydomain __P((res_state,
+ const char *, const char *, int, int,
+ uchar_t *, int));
+int res_nmkquery __P((res_state,
+ int, const char *, int, int, const uchar_t *,
+ int, const uchar_t *, uchar_t *, int));
+int res_nsend __P((res_state, const uchar_t *, int, uchar_t *,
+ int));
+int res_nsendsigned __P((res_state, const uchar_t *, int,
+ ns_tsig_key *, uchar_t *, int));
+int res_findzonecut __P((res_state, const char *, ns_class, int,
+ char *, size_t, struct in_addr *, int));
+int res_findzonecut2 __P((res_state, const char *, ns_class, int,
+ char *, size_t, union res_sockaddr_union *,
+ int));
+void res_nclose __P((res_state));
+int res_nopt __P((res_state, int, uchar_t *, int, int));
+int res_nopt_rdata __P((res_state, int, uchar_t *, int, uchar_t *,
+ ushort_t, ushort_t, uchar_t *));
+void res_send_setqhook __P((res_send_qhook hook));
+void res_send_setrhook __P((res_send_rhook hook));
+int __res_vinit __P((res_state, int));
+void res_destroyservicelist __P((void));
+const char *res_servicename __P((uint16_t port, const char *proto));
+const char *res_protocolname __P((int num));
+void res_destroyprotolist __P((void));
+void res_buildprotolist __P((void));
+const char *res_get_nibblesuffix __P((res_state));
+const char *res_get_nibblesuffix2 __P((res_state));
+void res_ndestroy __P((res_state));
+uint16_t res_nametoclass __P((const char *buf, int *success));
+uint16_t res_nametotype __P((const char *buf, int *success));
+void res_setservers __P((res_state,
+ const union res_sockaddr_union *, int));
+int res_getservers __P((res_state,
+ union res_sockaddr_union *, int));
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_RESOLV_JOY_H */
diff --git a/usr/src/head/unistd.h b/usr/src/head/unistd.h
index 04725ea56f..43b34fa303 100644
--- a/usr/src/head/unistd.h
+++ b/usr/src/head/unistd.h
@@ -351,6 +351,9 @@ extern int gethostname(char *, size_t);
extern int gethostname(char *, int);
#endif
extern char *getlogin(void);
+#if defined(__EXTENSIONS__)
+extern char *getxlogin(void);
+#endif
#if defined(_XPG4) || defined(__EXTENSIONS__)
extern int getopt(int, char *const *, const char *);
extern char *optarg;
diff --git a/usr/src/head/zdoor.h b/usr/src/head/zdoor.h
new file mode 100644
index 0000000000..f2d204042d
--- /dev/null
+++ b/usr/src/head/zdoor.h
@@ -0,0 +1,74 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _ZDOOR_H
+#define _ZDOOR_H
+
+#include <sys/types.h>
+#include <zone.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct zdoor_handle *zdoor_handle_t;
+
+typedef struct zdoor_cookie {
+ char *zdc_zonename;
+ char *zdc_service;
+ void *zdc_biscuit;
+} zdoor_cookie_t;
+
+typedef struct zdoor_result {
+ char *zdr_data;
+ size_t zdr_size;
+} zdoor_result_t;
+
+typedef zdoor_result_t *(*zdoor_callback) (zdoor_cookie_t *cookie,
+ char *argp, size_t arpg_sz);
+
+#define ZDOOR_OK 0
+#define ZDOOR_ERROR -1
+#define ZDOOR_NOT_GLOBAL_ZONE -2
+#define ZDOOR_ZONE_NOT_RUNNING -3
+#define ZDOOR_ZONE_FORBIDDEN -4
+#define ZDOOR_ARGS_ERROR -5
+#define ZDOOR_OUT_OF_MEMORY -6
+
+extern zdoor_handle_t zdoor_handle_init();
+
+extern int zdoor_open(zdoor_handle_t handle, const char *zonename,
+ const char *service, void *biscuit, zdoor_callback callback);
+
+extern void * zdoor_close(zdoor_handle_t handle, const char *zonename,
+ const char *service);
+
+extern void zdoor_handle_destroy(zdoor_handle_t handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZDOOR_H */
diff --git a/usr/src/head/zone.h b/usr/src/head/zone.h
index 34528a27f5..ae03d2453c 100644
--- a/usr/src/head/zone.h
+++ b/usr/src/head/zone.h
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent Inc. All rights reserved.
*/
#ifndef _ZONE_H
@@ -56,7 +57,7 @@ extern int zone_get_id(const char *, zoneid_t *);
/* System call API */
extern zoneid_t zone_create(const char *, const char *,
const struct priv_set *, const char *, size_t, const char *, size_t, int *,
- int, int, const bslabel_t *, int);
+ int, int, const bslabel_t *, int, zoneid_t);
extern int zone_boot(zoneid_t);
extern int zone_destroy(zoneid_t);
extern ssize_t zone_getattr(zoneid_t, int, void *, size_t);
diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile
index bae90c4045..9162656666 100644
--- a/usr/src/lib/Makefile
+++ b/usr/src/lib/Makefile
@@ -73,6 +73,7 @@ SUBDIRS += \
libcommputil \
libresolv \
libresolv2 .WAIT \
+ libresolv2_joy .WAIT \
libw .WAIT \
libintl .WAIT \
../cmd/sgs/librtld_db \
@@ -85,6 +86,8 @@ SUBDIRS += \
librt \
libadm \
libctf \
+ libbrand .WAIT \
+ libzonecfg .WAIT \
libdtrace \
libdtrace_jni \
libcurses \
@@ -111,6 +114,7 @@ SUBDIRS += \
libcryptoutil \
libinetutil \
libipadm \
+ libipd \
libipmp \
libiscsit \
libkmf \
@@ -159,7 +163,8 @@ SUBDIRS += \
librdc \
libinstzones \
libpkg \
- libpcidb
+ libpcidb \
+ libumem_trampoline
SUBDIRS += \
passwdutil \
@@ -187,7 +192,6 @@ $(CLOSED_BUILD)SUBDIRS += \
$(CLOSED)/lib/libike
SUBDIRS += \
nsswitch \
- print \
libuutil \
libscf \
libinetsvc \
@@ -205,10 +209,10 @@ SUBDIRS += \
libwrap \
libxcurses \
libxcurses2 \
- libbrand .WAIT \
- libzonecfg \
+ libzdoor \
libzoneinfo \
libzonestat \
+ libsmartsshd \
libtsnet \
libtsol \
gss_mechs/mech_spnego \
@@ -223,7 +227,6 @@ SUBDIRS += \
raidcfg_plugins \
cfgadm_plugins \
libmail \
- lvm \
libsmedia \
libipp \
libdiskmgt \
@@ -240,10 +243,7 @@ SUBDIRS += \
libzfs_core \
libzfs \
libbe \
- pylibbe \
libzfs_jni \
- pyzfs \
- pysolaris \
libmapid \
brand \
policykit \
@@ -304,9 +304,6 @@ fm: \
#
NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
-DCSUBDIRS = \
- lvm
-
MSGSUBDIRS= \
abi \
auditd_plugins \
@@ -362,12 +359,11 @@ MSGSUBDIRS= \
libwanbootutil \
libzfs \
libzonecfg \
- lvm \
+ libzdoor \
+ libsmartsshd \
madv \
mpss \
pam_modules \
- pyzfs \
- pysolaris \
rpcsec_gss \
libreparse
MSGSUBDIRS += \
@@ -415,6 +411,7 @@ HDRSUBDIRS= \
libfstyp \
libgen \
libipadm \
+ libipd \
libipsecutil \
libinetsvc \
libinetutil \
@@ -486,7 +483,6 @@ HDRSUBDIRS= \
libzonestat \
hal \
policykit \
- lvm \
pkcs11 \
passwdutil \
../cmd/sendmail/libmilter \
@@ -574,7 +570,7 @@ gss_mechs/mech_krb5: libgss libnsl libsocket libresolv pkcs11
libadt_jni: libbsm
libast: libsocket
libadutils: libldap5 libresolv libsocket libnsl
-nsswitch: libadutils libidmap
+nsswitch: libadutils libidmap libresolv2_joy
libbe: libzfs
libbsm: libtsol
libcmd: libsum libast libsocket libnsl
@@ -628,6 +624,8 @@ libpool: libnvpair libexacct
libpp: libast
libzonecfg: libc libsocket libnsl libuuid libnvpair libsysevent libsec \
libbrand libpool libscf
+libzdoor: libc libzonecfg libcontract
+libsmartsshd: libc libcontract
libproc: ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
libproject: libpool libproc libsecdb
libtermcap: libcurses
@@ -643,8 +641,6 @@ librestart: libuutil libscf
libsaveargs: libdisasm
../cmd/sgs/libdl: ../cmd/sgs/libconv
../cmd/sgs/libelf: ../cmd/sgs/libconv
-pkcs11: libcryptoutil
-print: libldap5
udapl/udapl_tavor: udapl/libdat
libzfs: libdevid libgen libnvpair libuutil \
libadm libavl libefi libidmap libmd libzfs_core
@@ -669,9 +665,6 @@ sun_fc: libdevinfo libsysevent libnvpair
libsun_ima: libdevinfo libsysevent libnsl
sun_sas: libdevinfo libsysevent libnvpair libkstat libdevid
libgrubmgmt: libdevinfo libzfs libfstyp
-pylibbe: libbe libzfs
-pyzfs: libnvpair libzfs
-pysolaris: libsec libidmap
libreparse: libnvpair
libhotplug: libnvpair
cfgadm_plugins: libhotplug
diff --git a/usr/src/lib/Makefile.astmsg b/usr/src/lib/Makefile.astmsg
index 096805e825..ff8202d03a 100644
--- a/usr/src/lib/Makefile.astmsg
+++ b/usr/src/lib/Makefile.astmsg
@@ -47,8 +47,8 @@ MSGLIBNAME= $(LIBRARY:.a=)
ASTMSGCATALOG= $(ROOT)/usr/lib/locale/C/LC_MESSAGES/$(MSGLIBNAME)
$(DO_BUILD_AST_CATALOGS)ASTMSGCC= \
- PATH="/usr/ast/bin/:/bin:/usr/bin" \
- /usr/bin/ksh93 /usr/ast/bin/msgcc >>msgcc.out 2>&1
+ PATH="$(ASTBINDIR):/bin:/usr/bin" \
+ /usr/bin/ksh93 $(MSGCC) >>msgcc.out 2>&1
ASTMSGS= $(OBJECTS:%.o=msgs/%.mso)
diff --git a/usr/src/lib/brand/Makefile b/usr/src/lib/brand/Makefile
index 05bfc54764..db59df2efc 100644
--- a/usr/src/lib/brand/Makefile
+++ b/usr/src/lib/brand/Makefile
@@ -30,7 +30,7 @@ include ../../Makefile.master
# Build everything in parallel; use .WAIT for dependencies
.PARALLEL:
-SUBDIRS= shared .WAIT sn1 solaris10 ipkg labeled $($(MACH)_SUBDIRS)
+SUBDIRS= shared .WAIT sn1 sngl solaris10 ipkg labeled $($(MACH)_SUBDIRS)
MSGSUBDIRS= solaris10 shared $($(MACH)_MSGSUBDIRS)
all := TARGET= all
diff --git a/usr/src/lib/brand/sngl/Makefile b/usr/src/lib/brand/sngl/Makefile
new file mode 100644
index 0000000000..780acc21e1
--- /dev/null
+++ b/usr/src/lib/brand/sngl/Makefile
@@ -0,0 +1,51 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2012, Joyent, Inc. All rights reserved.
+#
+
+default: all
+
+include Makefile.sngl
+
+# Build everything in parallel; use .WAIT for dependencies
+.PARALLEL:
+
+SUBDIRS = sngl_brand zone
+MSGSUBDIRS = zone
+
+all := TARGET= all
+install := TARGET= install
+clean := TARGET= clean
+clobber := TARGET= clobber
+lint := TARGET= lint
+_msg := TARGET= _msg
+
+.KEEP_STATE:
+
+all install clean clobber lint: $(SUBDIRS)
+
+_msg: $(MSGSUBDIRS)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
diff --git a/usr/src/pkg/manifests/SUNWlp-cmds.mf b/usr/src/lib/brand/sngl/Makefile.sngl
index 4f2da711e4..0c7a280696 100644
--- a/usr/src/pkg/manifests/SUNWlp-cmds.mf
+++ b/usr/src/lib/brand/sngl/Makefile.sngl
@@ -18,11 +18,11 @@
#
# CDDL HEADER END
#
-
#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2012 Joyent, Inc. All rights reserved.
#
-set name=pkg.fmri value=pkg:/SUNWlp-cmds@0.5.11,5.11-0.130
-set name=pkg.obsolete value=true
-set name=variant.arch value=$(ARCH)
+BRAND = sngl
+
+include $(SRC)/lib/brand/Makefile.brand
+
diff --git a/usr/src/cmd/lp/crontab/Makefile b/usr/src/lib/brand/sngl/sngl_brand/Makefile
index 8dab8c1ab5..4b667e1fa8 100644
--- a/usr/src/cmd/lp/crontab/Makefile
+++ b/usr/src/lib/brand/sngl/sngl_brand/Makefile
@@ -18,29 +18,30 @@
#
# CDDL HEADER END
#
+#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# cmd/lp/crontab/Makefile
-#
-include ../Makefile.lp
+include $(SRC)/lib/Makefile.lib
-ROOTCRONTABS = $(ROOT)/var/spool/cron/crontabs
+default: all
-PROG = lp
-ROOTCRONTABPROG = $(PROG:%=$(ROOTCRONTABS)/%)
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
-
-FILEMODE = 400
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+_msg := TARGET= _msg
.KEEP_STATE:
-all : $(PROG)
-
-install: all $(ROOTCRONTABPROG)
+all install clean clobber lint _msg: $(SUBDIRS)
-$(ROOTCRONTABS)/% : %
- $(INS.file)
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
-clobber clean strip lint:
+FRC:
diff --git a/usr/src/lib/brand/sngl/sngl_brand/Makefile.com b/usr/src/lib/brand/sngl/sngl_brand/Makefile.com
new file mode 100644
index 0000000000..070a03dcb5
--- /dev/null
+++ b/usr/src/lib/brand/sngl/sngl_brand/Makefile.com
@@ -0,0 +1,76 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2012, Joyent, Inc. All rights reserved.
+#
+
+LIBRARY = sngl_brand.a
+VERS = .1
+COBJS = sngl_brand.o
+ASOBJS = crt.o handler.o runexe.o brand_util.o
+OBJECTS = $(COBJS)
+
+include ../../Makefile.sngl
+include $(SRC)/lib/Makefile.lib
+
+SRCDIR = ../common
+UTSBASE = $(SRC)/uts
+
+LIBS = $(DYNLIB)
+CSRCS = $(COBJS:%o=../common/%c)
+SHAREDOBJS = $(ASOBJS:%o=$(ISAOBJDIR)/%o)
+SRCS = $(CSRCS)
+
+#
+# Note that the architecture specific makefiles MUST update DYNFLAGS to
+# explicitly specify an interpreter for the brand emulation library so that we
+# use /lib/ld.so.1 or /lib/64/ld.so.1, which in a sngl zone is the system
+# linker.
+#
+# Note that since the linker is used to setup processes before libc is loaded,
+# it makes system calls directly (ie avoiding libc), and it makes these system
+# calls before our library has been initialized. Since our library hasn't been
+# initialized yet, there's no way for us to intercept and emulate any of those
+# system calls. Luckily we don't have to.
+#
+# Note that we make sure to link our brand emulation library to libmapmalloc.
+# This is required because in most cases there will be two copies of libc in
+# the same process and we don't want them to fight over the heap. So for our
+# brand library we link against libmapmalloc so that if we (our or copy of
+# libc) try to allocate any memory it will be done via mmap() instead of brk().
+#
+CPPFLAGS += -D_REENTRANT -U_ASM \
+ -I. -I$(BRAND_SHARED)/brand/sys -I$(UTSBASE)/common/brand/sngl
+CFLAGS += $(CCVERBOSE)
+DYNFLAGS += $(DYNFLAGS_$(CLASS))
+DYNFLAGS += $(BLOCAL) $(ZNOVERSION) -Wl,-e_start
+LDLIBS += -lc -lmapmalloc
+
+$(LIBS):= PICS += $(SHAREDOBJS)
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: lintcheck
+
+include $(SRC)/lib/Makefile.targ
diff --git a/usr/src/lib/brand/sngl/sngl_brand/amd64/Makefile b/usr/src/lib/brand/sngl/sngl_brand/amd64/Makefile
new file mode 100644
index 0000000000..d019eaf841
--- /dev/null
+++ b/usr/src/lib/brand/sngl/sngl_brand/amd64/Makefile
@@ -0,0 +1,48 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2012, Joyent, Inc. All rights reserved.
+#
+
+ISAOBJDIR = $(BRAND_SHARED)/brand/amd64/pics/
+
+include ../Makefile.com
+include $(SRC)/lib/Makefile.lib.64
+
+CPPFLAGS += -I$(BRAND_SHARED)/brand/amd64
+
+#
+# see ../Makefile.com for why we MUST explicity make ld.so.1 our interpreter
+#
+DYNFLAGS += -Wl,-I/lib/64/ld.so.1
+CPPFLAGS += -D_SYSCALL32
+
+# Note that we also set the runtime path for the emulation library to point
+# into /system. This is an attempt to ensure that our brand library get's the
+# native version of libmapmallc.
+#
+DYNFLAGS += -R/lib/64 -R/system/usr/lib/64
+
+CLEANFILES += $(DYNLIB)
+CLOBBERFILES += $(ROOTLIBS64)
+
+install: all $(ROOTLIBS64)
diff --git a/usr/src/lib/print/mod_ipp/mapfile b/usr/src/lib/brand/sngl/sngl_brand/common/mapfile-vers
index ffdec222b5..29800204f8 100644
--- a/usr/src/lib/print/mod_ipp/mapfile
+++ b/usr/src/lib/brand/sngl/sngl_brand/common/mapfile-vers
@@ -24,10 +24,6 @@
#
#
-# $Id: mapfile 149 2006-04-25 16:55:01Z njacobs $
-#
-
-#
# MAPFILE HEADER START
#
# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
@@ -43,10 +39,10 @@
$mapfile_version 2
-SYMBOL_VERSION SUNWprivate_1.0 {
- global:
- ipp_module;
-
+#
+# Scope everything local -- our .init section is our only public interface.
+#
+SYMBOL_SCOPE {
local:
*;
};
diff --git a/usr/src/lib/brand/sngl/sngl_brand/common/sngl_brand.c b/usr/src/lib/brand/sngl/sngl_brand/common/sngl_brand.c
new file mode 100644
index 0000000000..d2b8d8702d
--- /dev/null
+++ b/usr/src/lib/brand/sngl/sngl_brand/common/sngl_brand.c
@@ -0,0 +1,429 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <unistd.h>
+#include <sys/brand.h>
+#include <sys/syscall.h>
+#include <sys/systm.h>
+#include <sys/stat.h>
+#include <libgen.h>
+#include <sys/auxv.h>
+
+#include <sngl_brand.h>
+#include <brand_misc.h>
+
+/*
+ * See usr/src/lib/brand/shared/brand/common/brand_util.c for general
+ * emulation notes.
+ */
+
+#define CONF32_PATH "/system/usr/lib/brand/sngl/ld.sys.config"
+#define CONF64_PATH "/system/usr/lib/brand/sngl/ld.sys64.config"
+
+brand_sysent_table_t brand_sysent_table[];
+
+static boolean_t is_sys = B_FALSE;
+static boolean_t is_crle = B_FALSE;
+
+typedef struct {
+ char *mnt_name;
+ dev_t mnt_id;
+} sys_mnt_dev_t;
+
+/*
+ * The brand platform mounts several GZ file systems into the zone. We know
+ * which ones can actually be on seperate file systems, so we only stat those
+ * when checking for system commands. This reduces the number of stats needed
+ * when we start up.
+ */
+static sys_mnt_dev_t sys_mounts[] = {
+ {"/system/usr", 0},
+ {"/lib", 0},
+ {NULL, 0}
+};
+
+/*
+ * If this is a /sytem binary and ld.so is opening the default config file,
+ * then redirect so it opens the /system config file instead. We need to do it
+ * this way, instead of setting one of the LD_CONFIG env vars, since those
+ * are ignored for secure binaries.
+ *
+ * We don't redirect if we're crle so that it can still be used on the default
+ * config files.
+ */
+int
+sngl_open(sysret_t *rval, char *path, int oflag, mode_t mode)
+{
+ char tstr[MAXPATHLEN];
+
+ if (is_sys && !is_crle) {
+ /* Get a copy of the path we're trying to open */
+ bzero(tstr, sizeof (tstr));
+ (void) brand_uucopystr(path, tstr, sizeof (tstr));
+
+ if (strcmp(tstr, "/var/ld/ld.config") == 0)
+ return (__systemcall(rval, SYS_open + 1024,
+ CONF32_PATH, oflag, mode));
+
+ if (strcmp(tstr, "/var/ld/64/ld.config") == 0)
+ return (__systemcall(rval, SYS_open + 1024,
+ CONF64_PATH, oflag, mode));
+ }
+
+ return (__systemcall(rval, SYS_open + 1024, path, oflag, mode));
+}
+
+/*ARGSUSED*/
+int
+brand_init(int argc, char *argv[], char *envp[])
+{
+ ulong_t ldentry;
+ int i;
+ uintptr_t *p;
+ auxv_t *ap;
+ struct stat64 buf;
+ char *bname;
+
+ brand_pre_init();
+
+ /*
+ * Check if we're trying to run a system binary.
+ *
+ * We haven't installed our emulation table yet, so its safe to make
+ * system calls directly.
+ *
+ * First, get the /system devices, then stat the executable to see if
+ * its on one of the /system devs.
+ */
+ for (i = 0; sys_mounts[i].mnt_name != NULL; i++) {
+ if (stat64(sys_mounts[i].mnt_name, &buf) != -1)
+ sys_mounts[i].mnt_id = buf.st_dev;
+ }
+
+ /* Find the aux vector on the stack. */
+ p = (uintptr_t *)envp;
+ while (*p != NULL)
+ p++;
+ p++;
+
+ /* Find AT_SUN_EXECNAME */
+ for (ap = (auxv_t *)p; ap->a_type != AT_NULL; ap++) {
+ if (ap->a_type != AT_SUN_EXECNAME)
+ continue;
+ if (stat64(ap->a_un.a_ptr, &buf) != -1) {
+ for (i = 0; sys_mounts[i].mnt_name != NULL; i++) {
+ if (sys_mounts[i].mnt_id == buf.st_dev) {
+ is_sys = B_TRUE;
+ bname = basename(ap->a_un.a_ptr);
+ if (strcmp("crle", bname) == 0)
+ is_crle = B_TRUE;
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ ldentry = brand_post_init(SNGL_VERSION, argc, argv, envp);
+
+ brand_runexe(argv, ldentry);
+ /*NOTREACHED*/
+ brand_abort(0, "brand_runexe() returned");
+ return (-1);
+}
+
+/*
+ * This table must have at least NSYSCALL entries in it.
+ *
+ * The second parameter of each entry in the brand_sysent_table
+ * contains the number of parameters and flags that describe the
+ * syscall return value encoding. See the block comments at the
+ * top of this file for more information about the syscall return
+ * value flags and when they should be used.
+ */
+brand_sysent_table_t brand_sysent_table[] = {
+ NOSYS, /* 0 */
+ NOSYS, /* 1 */
+ NOSYS, /* 2 */
+ NOSYS, /* 3 */
+ NOSYS, /* 4 */
+ EMULATE(sngl_open, 3 | RV_DEFAULT), /* 5 */
+ NOSYS, /* 6 */
+ NOSYS, /* 7 */
+ NOSYS, /* 8 */
+ NOSYS, /* 9 */
+ NOSYS, /* 10 */
+ NOSYS, /* 11 */
+ NOSYS, /* 12 */
+ NOSYS, /* 13 */
+ NOSYS, /* 14 */
+ NOSYS, /* 15 */
+ NOSYS, /* 16 */
+ NOSYS, /* 17 */
+ NOSYS, /* 18 */
+ NOSYS, /* 19 */
+ NOSYS, /* 20 */
+ NOSYS, /* 21 */
+ NOSYS, /* 22 */
+ NOSYS, /* 23 */
+ NOSYS, /* 24 */
+ NOSYS, /* 25 */
+ NOSYS, /* 26 */
+ NOSYS, /* 27 */
+ NOSYS, /* 28 */
+ NOSYS, /* 29 */
+ NOSYS, /* 30 */
+ NOSYS, /* 31 */
+ NOSYS, /* 32 */
+ NOSYS, /* 33 */
+ NOSYS, /* 34 */
+ NOSYS, /* 35 */
+ NOSYS, /* 36 */
+ NOSYS, /* 37 */
+ NOSYS, /* 38 */
+ NOSYS, /* 39 */
+ NOSYS, /* 40 */
+ NOSYS, /* 41 */
+ NOSYS, /* 42 */
+ NOSYS, /* 43 */
+ NOSYS, /* 44 */
+ NOSYS, /* 45 */
+ NOSYS, /* 46 */
+ NOSYS, /* 47 */
+ NOSYS, /* 48 */
+ NOSYS, /* 49 */
+ NOSYS, /* 50 */
+ NOSYS, /* 51 */
+ NOSYS, /* 52 */
+ NOSYS, /* 53 */
+ NOSYS, /* 54 */
+ NOSYS, /* 55 */
+ NOSYS, /* 56 */
+ NOSYS, /* 57 */
+ NOSYS, /* 58 */
+ NOSYS, /* 59 */
+ NOSYS, /* 60 */
+ NOSYS, /* 61 */
+ NOSYS, /* 62 */
+ NOSYS, /* 63 */
+ NOSYS, /* 64 */
+ NOSYS, /* 65 */
+ NOSYS, /* 66 */
+ NOSYS, /* 67 */
+ NOSYS, /* 68 */
+ NOSYS, /* 69 */
+ NOSYS, /* 70 */
+ NOSYS, /* 71 */
+ NOSYS, /* 72 */
+ NOSYS, /* 73 */
+ NOSYS, /* 74 */
+ NOSYS, /* 75 */
+ NOSYS, /* 76 */
+ NOSYS, /* 77 */
+ NOSYS, /* 78 */
+ NOSYS, /* 79 */
+ NOSYS, /* 80 */
+ NOSYS, /* 81 */
+ NOSYS, /* 82 */
+ NOSYS, /* 83 */
+ NOSYS, /* 84 */
+ NOSYS, /* 85 */
+ NOSYS, /* 86 */
+ NOSYS, /* 87 */
+ NOSYS, /* 88 */
+ NOSYS, /* 89 */
+ NOSYS, /* 90 */
+ NOSYS, /* 91 */
+ NOSYS, /* 92 */
+ NOSYS, /* 93 */
+ NOSYS, /* 94 */
+ NOSYS, /* 95 */
+ NOSYS, /* 96 */
+ NOSYS, /* 97 */
+ NOSYS, /* 98 */
+ NOSYS, /* 99 */
+ NOSYS, /* 100 */
+ NOSYS, /* 101 */
+ NOSYS, /* 102 */
+ NOSYS, /* 103 */
+ NOSYS, /* 104 */
+ NOSYS, /* 105 */
+ NOSYS, /* 106 */
+ NOSYS, /* 107 */
+ NOSYS, /* 108 */
+ NOSYS, /* 109 */
+ NOSYS, /* 110 */
+ NOSYS, /* 111 */
+ NOSYS, /* 112 */
+ NOSYS, /* 113 */
+ NOSYS, /* 114 */
+ NOSYS, /* 115 */
+ NOSYS, /* 116 */
+ NOSYS, /* 117 */
+ NOSYS, /* 118 */
+ NOSYS, /* 119 */
+ NOSYS, /* 120 */
+ NOSYS, /* 121 */
+ NOSYS, /* 122 */
+ NOSYS, /* 123 */
+ NOSYS, /* 124 */
+ NOSYS, /* 125 */
+ NOSYS, /* 126 */
+ NOSYS, /* 127 */
+ NOSYS, /* 128 */
+ NOSYS, /* 129 */
+ NOSYS, /* 130 */
+ NOSYS, /* 131 */
+ NOSYS, /* 132 */
+ NOSYS, /* 133 */
+ NOSYS, /* 134 */
+ NOSYS, /* 135 */
+ NOSYS, /* 136 */
+ NOSYS, /* 137 */
+ NOSYS, /* 138 */
+ NOSYS, /* 139 */
+ NOSYS, /* 140 */
+ NOSYS, /* 141 */
+ NOSYS, /* 142 */
+ NOSYS, /* 143 */
+ NOSYS, /* 144 */
+ NOSYS, /* 145 */
+ NOSYS, /* 146 */
+ NOSYS, /* 147 */
+ NOSYS, /* 148 */
+ NOSYS, /* 149 */
+ NOSYS, /* 150 */
+ NOSYS, /* 151 */
+ NOSYS, /* 152 */
+ NOSYS, /* 153 */
+ NOSYS, /* 154 */
+ NOSYS, /* 155 */
+ NOSYS, /* 156 */
+ NOSYS, /* 157 */
+ NOSYS, /* 158 */
+ NOSYS, /* 159 */
+ NOSYS, /* 160 */
+ NOSYS, /* 161 */
+ NOSYS, /* 162 */
+ NOSYS, /* 163 */
+ NOSYS, /* 164 */
+ NOSYS, /* 165 */
+ NOSYS, /* 166 */
+ NOSYS, /* 167 */
+ NOSYS, /* 168 */
+ NOSYS, /* 169 */
+ NOSYS, /* 170 */
+ NOSYS, /* 171 */
+ NOSYS, /* 172 */
+ NOSYS, /* 173 */
+ NOSYS, /* 174 */
+ NOSYS, /* 175 */
+ NOSYS, /* 176 */
+ NOSYS, /* 177 */
+ NOSYS, /* 178 */
+ NOSYS, /* 179 */
+ NOSYS, /* 180 */
+ NOSYS, /* 181 */
+ NOSYS, /* 182 */
+ NOSYS, /* 183 */
+ NOSYS, /* 184 */
+ NOSYS, /* 185 */
+ NOSYS, /* 186 */
+ NOSYS, /* 187 */
+ NOSYS, /* 188 */
+ NOSYS, /* 189 */
+ NOSYS, /* 190 */
+ NOSYS, /* 191 */
+ NOSYS, /* 192 */
+ NOSYS, /* 193 */
+ NOSYS, /* 194 */
+ NOSYS, /* 195 */
+ NOSYS, /* 196 */
+ NOSYS, /* 197 */
+ NOSYS, /* 198 */
+ NOSYS, /* 199 */
+ NOSYS, /* 200 */
+ NOSYS, /* 201 */
+ NOSYS, /* 202 */
+ NOSYS, /* 203 */
+ NOSYS, /* 204 */
+ NOSYS, /* 205 */
+ NOSYS, /* 206 */
+ NOSYS, /* 207 */
+ NOSYS, /* 208 */
+ NOSYS, /* 209 */
+ NOSYS, /* 210 */
+ NOSYS, /* 211 */
+ NOSYS, /* 212 */
+ NOSYS, /* 213 */
+ NOSYS, /* 214 */
+ NOSYS, /* 215 */
+ NOSYS, /* 216 */
+ NOSYS, /* 217 */
+ NOSYS, /* 218 */
+ NOSYS, /* 219 */
+ NOSYS, /* 220 */
+ NOSYS, /* 221 */
+ NOSYS, /* 222 */
+ NOSYS, /* 223 */
+ NOSYS, /* 224 */
+ NOSYS, /* 225 */
+ NOSYS, /* 226 */
+ NOSYS, /* 227 */
+ NOSYS, /* 228 */
+ NOSYS, /* 229 */
+ NOSYS, /* 230 */
+ NOSYS, /* 231 */
+ NOSYS, /* 232 */
+ NOSYS, /* 233 */
+ NOSYS, /* 234 */
+ NOSYS, /* 235 */
+ NOSYS, /* 236 */
+ NOSYS, /* 237 */
+ NOSYS, /* 238 */
+ NOSYS, /* 239 */
+ NOSYS, /* 240 */
+ NOSYS, /* 241 */
+ NOSYS, /* 242 */
+ NOSYS, /* 243 */
+ NOSYS, /* 244 */
+ NOSYS, /* 245 */
+ NOSYS, /* 246 */
+ NOSYS, /* 247 */
+ NOSYS, /* 248 */
+ NOSYS, /* 249 */
+ NOSYS, /* 250 */
+ NOSYS, /* 251 */
+ NOSYS, /* 252 */
+ NOSYS, /* 253 */
+ NOSYS, /* 254 */
+ NOSYS /* 255 */
+};
diff --git a/usr/src/lib/brand/sngl/sngl_brand/i386/Makefile b/usr/src/lib/brand/sngl/sngl_brand/i386/Makefile
new file mode 100644
index 0000000000..a0c4927252
--- /dev/null
+++ b/usr/src/lib/brand/sngl/sngl_brand/i386/Makefile
@@ -0,0 +1,46 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2012, Joyent, Inc. All rights reserved.
+#
+
+ISAOBJDIR = $(BRAND_SHARED)/brand/i386/pics
+
+include ../Makefile.com
+
+CPPFLAGS += -I$(BRAND_SHARED)/brand/i386
+
+#
+# see ../Makefile.com for why we explicity make ld.so.1 our interpreter
+#
+DYNFLAGS += -Wl,-I/lib/ld.so.1
+
+# Note that we also set the runtime path for the emulation library to point
+# into /system. This is an attempt to ensure that our brand library get's the
+# native version of libmapmallc.
+#
+DYNFLAGS += -R/lib -R/system/usr/lib
+
+CLEANFILES += $(DYNLIB)
+CLOBBERFILES += $(ROOTLIBS)
+
+install: all $(ROOTLIBS)
diff --git a/usr/src/cmd/print/lpget/Makefile b/usr/src/lib/brand/sngl/zone/Makefile
index db4d15b2b1..42785deab3 100644
--- a/usr/src/cmd/print/lpget/Makefile
+++ b/usr/src/lib/brand/sngl/zone/Makefile
@@ -18,51 +18,36 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/lp/client/lpget/Makefile
+# Copyright 2012 Joyent, Inc. All rights reserved.
#
-include ../Makefile.sp
-
-PROG= lpget
-
-SRCS= $(PROG).c
-
-OBJS= $(SRCS:.c=.o)
+PROGS = sinstall
+XMLDOCS= config.xml platform.xml
+CLOBBERFILES= $(ROOTPROGS) $(ROOTXMLDOCS)
-ROOTBINPROG= $(PROG:%=$(ROOTBIN)/%)
-
-FILEMODE= 0511
-
-CPPFLAGS += -I$(NPRTINC)
-LDLIBS += $(LIBNPRT)
+include $(SRC)/cmd/Makefile.cmd
+include ../Makefile.sngl
.KEEP_STATE:
-all: $(PROG)
-
-install: all $(ROOTBIN) $(ROOTBINPROG)
+all: $(PROGS)
-$(ROOTBIN):
- $(INS.dir)
+POFILES =
+POFILE =
-strip:
- $(STRIP) $(PROG)
+install: $(PROGS) $(ROOTPROGS) $(ROOTXMLDOCS)
+ crle -c $(ROOTBRANDDIR)/ld.sys.config \
+ -l /lib:/system/usr/lib \
+ -s /lib/secure:/system/usr/lib/secure
+ crle -64 -c $(ROOTBRANDDIR)/ld.sys64.config \
+ -l /lib/64:/system/usr/lib/64 \
+ -s /lib/secure/64:/system/usr/lib/secure/64
lint:
- $(LINT.c) $(PROG).c $(LDLIBS)
-
-cstyle:
- cstyle $(SRCS)
-
-_msg:
- @echo "Messages are made in usr/src/cmd/print"
clean:
- $(RM) $(OBJS)
+ -$(RM) $(PROGS)
-clobber: clean
- -$(RM) $(PROG) $(CLOBBERFILES)
+include $(SRC)/cmd/Makefile.targ
diff --git a/usr/src/lib/brand/sngl/zone/config.xml b/usr/src/lib/brand/sngl/zone/config.xml
new file mode 100644
index 0000000000..86e58b6f8b
--- /dev/null
+++ b/usr/src/lib/brand/sngl/zone/config.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0"?>
+
+<!--
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ Copyright 2012 Joyent, Inc. All rights reserved.
+ Use is subject to license terms.
+
+ DO NOT EDIT THIS FILE.
+-->
+
+<!DOCTYPE brand PUBLIC "-//Joyent Inc//DTD Brands//EN"
+ "file:///usr/share/lib/xml/dtd/brand.dtd.1">
+
+<brand name="sngl">
+ <modname>sngl_brand</modname>
+
+ <initname>/system/sbin/init</initname>
+ <login_cmd>/system/usr/bin/login -z %Z %u</login_cmd>
+ <forcedlogin_cmd>/system/usr/bin/login -z %Z -f %u</forcedlogin_cmd>
+ <user_cmd>/system/usr/bin/getent passwd %u</user_cmd>
+
+ <install>/usr/lib/brand/sngl/sinstall -z %z -R %R</install>
+ <installopts>R:t:U:q:z:</installopts>
+ <boot></boot>
+ <halt></halt>
+ <verify_cfg></verify_cfg>
+ <verify_adm></verify_adm>
+ <postclone></postclone>
+ <postinstall></postinstall>
+ <attach>/bin/true</attach>
+ <detach>/bin/true</detach>
+ <clone></clone>
+ <uninstall>/usr/lib/brand/joyent/juninstall -z %z -R %R</uninstall>
+ <prestatechange>/usr/lib/brand/joyent/prestate %z %R</prestatechange>
+ <poststatechange>/usr/lib/brand/joyent/poststate %z %R</poststatechange>
+ <query>/usr/lib/brand/joyent/query %z %R</query>
+
+ <privilege set="default" name="contract_event" />
+ <privilege set="default" name="contract_identity" />
+ <privilege set="default" name="contract_observer" />
+ <privilege set="default" name="dtrace_proc" />
+ <privilege set="default" name="dtrace_user" />
+ <privilege set="default" name="file_chown" />
+ <privilege set="default" name="file_chown_self" />
+ <privilege set="default" name="file_dac_execute" />
+ <privilege set="default" name="file_dac_read" />
+ <privilege set="default" name="file_dac_search" />
+ <privilege set="default" name="file_dac_write" />
+ <privilege set="default" name="file_owner" />
+ <privilege set="default" name="file_setid" />
+ <privilege set="default" name="ipc_dac_read" />
+ <privilege set="default" name="ipc_dac_write" />
+ <privilege set="default" name="ipc_owner" />
+ <privilege set="default" name="net_bindmlp" />
+ <privilege set="default" name="net_icmpaccess" />
+ <privilege set="default" name="net_mac_aware" />
+ <privilege set="default" name="net_observability" />
+ <privilege set="default" name="net_privaddr" />
+ <privilege set="default" name="net_rawaccess" ip-type="exclusive" />
+ <privilege set="default" name="proc_chroot" />
+ <privilege set="default" name="sys_audit" />
+ <privilege set="default" name="proc_audit" />
+ <privilege set="default" name="proc_lock_memory" />
+ <privilege set="default" name="proc_owner" />
+ <privilege set="default" name="proc_setid" />
+ <privilege set="default" name="proc_taskid" />
+ <privilege set="default" name="sys_acct" />
+ <privilege set="default" name="sys_admin" />
+ <privilege set="default" name="sys_ip_config" ip-type="exclusive" />
+ <privilege set="default" name="sys_iptun_config" ip-type="exclusive" />
+ <privilege set="default" name="sys_mount" />
+ <privilege set="default" name="sys_nfs" />
+ <privilege set="default" name="sys_resource" />
+ <privilege set="default" name="sys_ppp_config" ip-type="exclusive" />
+
+ <privilege set="prohibited" name="dtrace_kernel" />
+ <privilege set="prohibited" name="proc_zone" />
+ <privilege set="prohibited" name="sys_config" />
+ <privilege set="prohibited" name="sys_devices" />
+ <privilege set="prohibited" name="sys_ip_config" ip-type="shared" />
+ <privilege set="prohibited" name="sys_linkdir" />
+ <privilege set="prohibited" name="sys_net_config" />
+ <privilege set="prohibited" name="sys_res_config" />
+ <privilege set="prohibited" name="sys_suser_compat" />
+ <privilege set="prohibited" name="xvm_control" />
+ <privilege set="prohibited" name="virt_manage" />
+ <privilege set="prohibited" name="sys_ppp_config" ip-type="shared" />
+
+ <privilege set="required" name="proc_exec" />
+ <privilege set="required" name="proc_fork" />
+ <privilege set="required" name="sys_ip_config" ip-type="exclusive" />
+ <privilege set="required" name="sys_mount" />
+</brand>
diff --git a/usr/src/lib/brand/sngl/zone/platform.xml b/usr/src/lib/brand/sngl/zone/platform.xml
new file mode 100644
index 0000000000..d9313f8b5c
--- /dev/null
+++ b/usr/src/lib/brand/sngl/zone/platform.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0"?>
+
+<!--
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ Use is subject to license terms.
+
+ DO NOT EDIT THIS FILE.
+-->
+
+<!DOCTYPE platform PUBLIC "-//Joyent Inc//Zones Platform//EN"
+ "file:///usr/share/lib/xml/dtd/zone_platform.dtd.1">
+
+<platform name="sngl" allow-exclusive-ip="true">
+
+ <!-- Global filesystems to mount when booting the zone -->
+ <global_mount special="/dev" directory="/dev" type="dev"
+ opt="attrdir=%R/root/dev"/>
+
+ <global_mount special="/lib" directory="/lib"
+ opt="ro,nodevices" type="lofs" />
+ <global_mount special="%P/manifests/joyent"
+ directory="/lib/svc/manifest"
+ opt="ro,nodevices" type="lofs" />
+ <global_mount special="%R/site" directory="/lib/svc/manifest/site"
+ opt="nodevices" type="lofs" />
+ <global_mount special="/sbin" directory="/sbin"
+ opt="ro,nodevices" type="lofs" />
+ <global_mount special="/lib" directory="/system/lib"
+ opt="ro,nodevices" type="lofs" />
+ <global_mount special="/sbin" directory="/system/sbin"
+ opt="ro,nodevices" type="lofs" />
+ <global_mount special="/usr" directory="/system/usr"
+ opt="ro,nodevices" type="lofs" />
+
+ <!-- Local filesystems to mount when booting the zone -->
+ <mount special="/proc" directory="/proc" type="proc" />
+ <mount special="ctfs" directory="/system/contract" type="ctfs" />
+ <mount special="mnttab" directory="/etc/mnttab" type="mntfs" />
+ <mount special="objfs" directory="/system/object" type="objfs" />
+ <mount special="lxproc" directory="/system/lxproc" type="lxproc" />
+ <mount special="swap" directory="/etc/svc/volatile" type="tmpfs" />
+
+ <!-- Devices to create under /dev -->
+ <device match="arp" />
+ <device match="bpf" />
+ <device match="conslog" />
+ <device match="cpu/self/cpuid" />
+ <device match="crypto" />
+ <device match="cryptoadm" />
+ <device match="dsk" />
+ <device match="dtrace/*" />
+ <device match="dtrace/provider/*" />
+ <device match="fd" />
+ <device match="ipnet" />
+ <device match="kstat" />
+ <device match="lo0" />
+ <device match="lofictl" />
+ <device match="lofi" />
+ <device match="log" />
+ <device match="logindmux" />
+ <device match="nsmb" />
+ <device match="net/*" />
+ <device match="null" />
+ <device match="openprom" arch="sparc" />
+ <device match="poll" />
+ <device match="pool" />
+ <device match="ptmx" />
+ <device match="pts/*" />
+ <device match="random" />
+ <device match="rdsk" />
+ <device match="rlofi" />
+ <device match="rmt" />
+ <device match="sad/user" />
+ <device match="svvslo0" />
+ <device match="svvslo1" />
+ <device match="svvslo2" />
+ <device match="svvslo3" />
+ <device match="swap" />
+ <device match="sysevent" />
+ <device match="tap" />
+ <device match="tcp" />
+ <device match="tcp6" />
+ <device match="term" />
+ <device match="ticlts" />
+ <device match="ticots" />
+ <device match="ticotsord" />
+ <device match="tty" />
+ <device match="tun" />
+ <device match="udp" />
+ <device match="udp6" />
+ <device match="urandom" />
+ <device match="zero" />
+ <device match="zfs" />
+ <device match="zvol/dsk/%P/%z/*" />
+ <device match="zvol/rdsk/%P/%z/*" />
+
+ <!-- Devices to create in exclusive IP zone only -->
+ <device match="dld" ip-type="exclusive" />
+ <device match="icmp" ip-type="exclusive" />
+ <device match="icmp6" ip-type="exclusive" />
+ <device match="ip" ip-type="exclusive" />
+ <device match="ip6" ip-type="exclusive" />
+ <device match="ipauth" ip-type="exclusive" />
+ <device match="ipd" ip-type="exclusive" />
+ <device match="ipf" ip-type="exclusive" />
+ <device match="ipl" ip-type="exclusive" />
+ <device match="iplookup" ip-type="exclusive" />
+ <device match="ipmpstub" ip-type="exclusive" />
+ <device match="ipnat" ip-type="exclusive" />
+ <device match="ipscan" ip-type="exclusive" />
+ <device match="ipsecah" ip-type="exclusive" />
+ <device match="ipsecesp" ip-type="exclusive" />
+ <device match="ipstate" ip-type="exclusive" />
+ <device match="ipsync" ip-type="exclusive" />
+ <device match="keysock" ip-type="exclusive" />
+ <device match="rawip" ip-type="exclusive" />
+ <device match="rawip6" ip-type="exclusive" />
+ <device match="rts" ip-type="exclusive" />
+ <device match="sad/admin" ip-type="exclusive" />
+ <device match="sctp" ip-type="exclusive" />
+ <device match="sctp6" ip-type="exclusive" />
+ <device match="spdsock" ip-type="exclusive" />
+ <device match="sppp" ip-type="exclusive" />
+ <device match="sppptun" ip-type="exclusive" />
+ <device match="vni" ip-type="exclusive" />
+
+ <!-- Renamed devices to create under /dev -->
+ <device match="zcons/%z/zoneconsole" name="zconsole" />
+
+ <!-- Symlinks to create under /dev -->
+ <symlink source="console" target="zconsole" />
+ <symlink source="dtremote" target="/dev/null" />
+ <symlink source="msglog" target="zconsole" />
+ <symlink source="stderr" target="./fd/2" />
+ <symlink source="stdin" target="./fd/0" />
+ <symlink source="stdout" target="./fd/1" />
+ <symlink source="syscon" target="zconsole" />
+ <symlink source="sysmsg" target="zconsole" />
+ <symlink source="systty" target="zconsole" />
+
+</platform>
diff --git a/usr/src/lib/brand/sngl/zone/sinstall.sh b/usr/src/lib/brand/sngl/zone/sinstall.sh
new file mode 100644
index 0000000000..d0633a7525
--- /dev/null
+++ b/usr/src/lib/brand/sngl/zone/sinstall.sh
@@ -0,0 +1,118 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+unset LD_LIBRARY_PATH
+PATH=/usr/bin:/usr/sbin
+export PATH
+
+. /usr/lib/brand/shared/common.ksh
+. /usr/lib/brand/joyent/common.ksh
+
+ZONENAME=""
+ZONEPATH=""
+# Default to 10GB diskset quota
+ZQUOTA=10
+
+while getopts "R:t:U:q:z:" opt
+do
+ case "$opt" in
+ R) ZONEPATH="$OPTARG";;
+ t) TMPLZONE="$OPTARG";;
+ # UUID is only used in the postinstall script
+ U) UUID="$OPTARG";;
+ q) ZQUOTA="$OPTARG";;
+ z) ZONENAME="$OPTARG";;
+ *) printf "$m_usage\n"
+ exit $ZONE_SUBPROC_USAGE;;
+ esac
+done
+shift OPTIND-1
+
+if [[ -n $(zonecfg -z "${ZONENAME}" info attr name=transition \
+ | grep "value: receiving:") ]]; then
+
+ # Here we're doing an install for a received zone, the dataset should have
+ # already been created.
+ exit $ZONE_SUBPROC_OK
+fi
+
+if [[ -z $ZONEPATH || -z $ZONENAME ]]; then
+ print -u2 "Brand error: No zone path or name"
+ exit $ZONE_SUBPROC_USAGE
+fi
+
+# The install requires a template zone.
+if [[ -z $TMPLZONE ]]; then
+ print -u2 "Brand error: a zone template is required"
+ exit $ZONE_SUBPROC_USAGE
+fi
+
+# The dataset quota must be a number.
+case $ZQUOTA in *[!0-9]*)
+ print -u2 "Brand error: The quota $ZQUOTA is not a number"
+ exit $ZONE_SUBPROC_USAGE;;
+esac
+
+ZROOT=$ZONEPATH/root
+
+# Get the dataset of the parent directory of the zonepath.
+dname=${ZONEPATH%/*}
+bname=${ZONEPATH##*/}
+PDS_NAME=`mount | nawk -v p=$dname '{if ($1 == p) print $3}'`
+[ -z "$PDS_NAME" ] && \
+ print -u2 "Brand error: missing parent ZFS dataset for $dname"
+
+# We expect that zoneadm was invoked with '-x nodataset', so it won't have
+# created the dataset.
+
+QUOTA_ARG=
+if [[ ${ZQUOTA} != "0" ]]; then
+ QUOTA_ARG="-o quota=${ZQUOTA}g"
+fi
+
+# New imgadm renames the dataset's snapshot at import to @final for us
+# and when it exists, we use that. However, when it does not exist we
+# still use the old method of creating a zones/<uuid>@<uuid> snapshot
+# so we can support old datasets.
+exists=$(zfs list -Ho name ${PDS_NAME}/${TMPLZONE}@final 2>&1)
+if [[ $? == 0 && ${exists} == "${PDS_NAME}/${TMPLZONE}@final" ]]; then
+ zfs clone -F ${QUOTA_ARG} ${PDS_NAME}/${TMPLZONE}@final \
+ ${PDS_NAME}/${bname} || fatal "failed to clone zone dataset"
+elif [[ ${exists} =~ "dataset does not exist" ]]; then
+ zfs snapshot ${PDS_NAME}/${TMPLZONE}@${bname}
+ zfs clone -F ${QUOTA_ARG} ${PDS_NAME}/${TMPLZONE}@${bname} \
+ ${PDS_NAME}/${bname} || fatal "failed to clone zone dataset"
+else
+ fatal "Unable to determine snapshot for ${PDS_NAME}/${TMPLZONE}"
+fi
+
+if [ ! -d ${ZONEPATH}/config ]; then
+ mkdir -p ${ZONEPATH}/config
+ chmod 755 ${ZONEPATH}/config
+fi
+
+final_setup
+
+exit $ZONE_SUBPROC_OK
diff --git a/usr/src/lib/efcode/interpreter/Makefile b/usr/src/lib/efcode/interpreter/Makefile
index 82c44bbdc2..d7475b45bb 100644
--- a/usr/src/lib/efcode/interpreter/Makefile
+++ b/usr/src/lib/efcode/interpreter/Makefile
@@ -39,7 +39,8 @@ CERRWARN += -_gcc=-Wno-uninitialized
LDFLAGS += -R/usr/lib/efcode/$(MACH64) -M mapfile64
LIBS = fcode.so fcdriver.so
-$(PROG) := LDLIBS += -L/usr/lib/efcode/$(MACH64) $(LIBS:%=$(EFCODEDIR64)/%)
+$(PROG) := LDLIBS += -L$(ADJUNCT_PROTO)/usr/lib/efcode/$(MACH64) \
+ $(LIBS:%=$(EFCODEDIR64)/%)
all: $(PROG)
diff --git a/usr/src/lib/fm/libldom/Makefile.com b/usr/src/lib/fm/libldom/Makefile.com
index 931961fe4a..859a177363 100644
--- a/usr/src/lib/fm/libldom/Makefile.com
+++ b/usr/src/lib/fm/libldom/Makefile.com
@@ -38,7 +38,7 @@ SRCDIR = ../sparc
LIBS = $(DYNLIB) $(LINTLIB)
CPPFLAGS += -I. -I$(SRC)/uts/sun4v -I$(ROOT)/usr/platform/sun4v/include \
- -I/usr/include/libxml2 -I/usr/sfw/include
+ -I$(ADJUNCT_PROTO)/usr/include/libxml2
CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
diff --git a/usr/src/lib/fm/topo/libtopo/Makefile.com b/usr/src/lib/fm/topo/libtopo/Makefile.com
index 0b7dc59c6d..56871dd6d4 100644
--- a/usr/src/lib/fm/topo/libtopo/Makefile.com
+++ b/usr/src/lib/fm/topo/libtopo/Makefile.com
@@ -74,7 +74,7 @@ SRCDIR = ../common
CLEANFILES += $(SRCDIR)/topo_error.c $(SRCDIR)/topo_tables.c
-CPPFLAGS += -I../common -I/usr/include/libxml2 -I.
+CPPFLAGS += -I../common -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I.
CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
CFLAGS += -D_POSIX_PTHREAD_SEMANTICS
CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
diff --git a/usr/src/lib/fm/topo/libtopo/common/libtopo.h b/usr/src/lib/fm/topo/libtopo/common/libtopo.h
index 9b7102f882..3ea35cdddd 100644
--- a/usr/src/lib/fm/topo/libtopo/common/libtopo.h
+++ b/usr/src/lib/fm/topo/libtopo/common/libtopo.h
@@ -137,6 +137,8 @@ extern boolean_t topo_method_supported(tnode_t *, const char *,
topo_version_t);
extern int topo_node_facility(topo_hdl_t *, tnode_t *, const char *,
uint32_t, topo_faclist_t *, int *);
+extern int topo_node_child_walk(topo_hdl_t *, tnode_t *, topo_walk_cb_t,
+ void *, int *);
/*
* Node flags: denotes type of node
diff --git a/usr/src/lib/fm/topo/libtopo/common/mapfile-vers b/usr/src/lib/fm/topo/libtopo/common/mapfile-vers
index 1cde0dee1f..b81f4fd7c6 100644
--- a/usr/src/lib/fm/topo/libtopo/common/mapfile-vers
+++ b/usr/src/lib/fm/topo/libtopo/common/mapfile-vers
@@ -126,6 +126,7 @@ SYMBOL_VERSION SUNWprivate {
topo_node_asru;
topo_node_asru_set;
topo_node_bind;
+ topo_node_child_walk;
topo_node_facility;
topo_node_facbind;
topo_node_flags;
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_hc.h b/usr/src/lib/fm/topo/libtopo/common/topo_hc.h
index 1c3a92f804..7b29adad69 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_hc.h
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_hc.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#ifndef _TOPO_HC_H
@@ -115,6 +116,10 @@ extern "C" {
#define TOPO_PGROUP_BINDING "binding"
#define TOPO_BINDING_OCCUPANT "occupant-path"
+#define TOPO_BINDING_DRIVER "driver"
+#define TOPO_BINDING_DEVCTL "devctl"
+#define TOPO_BINDING_ENCLOSURE "enclosure"
+#define TOPO_BINDING_SLOT "slot"
#define TOPO_PGROUP_STORAGE "storage"
#define TOPO_STORAGE_INITIATOR_PORT "initiator-port"
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_node.c b/usr/src/lib/fm/topo/libtopo/common/topo_node.c
index 553bc851f0..00b828c49c 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_node.c
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_node.c
@@ -837,3 +837,55 @@ topo_node_walk_init(topo_hdl_t *thp, topo_mod_t *mod, tnode_t *node,
return (wp);
}
+
+/*
+ * Walk the direct children of the given node.
+ */
+int
+topo_node_child_walk(topo_hdl_t *thp, tnode_t *pnode, topo_walk_cb_t cb_f,
+ void *arg, int *errp)
+{
+ int ret = TOPO_WALK_TERMINATE;
+ tnode_t *cnode;
+
+ topo_node_hold(pnode);
+
+ /*
+ * First Child:
+ */
+ topo_node_lock(pnode);
+ cnode = topo_child_first(pnode);
+ topo_node_unlock(pnode);
+
+ if (cnode == NULL) {
+ *errp = ETOPO_WALK_EMPTY;
+ ret = TOPO_WALK_ERR;
+ goto out;
+ }
+
+ while (cnode != NULL) {
+ int iret;
+
+ /*
+ * Call the walker callback:
+ */
+ topo_node_hold(cnode);
+ iret = cb_f(thp, cnode, arg);
+ topo_node_rele(cnode);
+ if (iret != TOPO_WALK_NEXT) {
+ ret = iret;
+ break;
+ }
+
+ /*
+ * Next child:
+ */
+ topo_node_lock(pnode);
+ cnode = topo_child_next(pnode, cnode);
+ topo_node_unlock(pnode);
+ }
+
+out:
+ topo_node_rele(pnode);
+ return (ret);
+}
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_xml.c b/usr/src/lib/fm/topo/libtopo/common/topo_xml.c
index 9e4c18c250..f26d5f6ef9 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_xml.c
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_xml.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <libxml/parser.h>
@@ -1376,16 +1377,10 @@ fac_enum_process(topo_mod_t *mp, xmlNodePtr pn, tnode_t *ptn)
if ((fprov = xmlGetProp(cn, (xmlChar *)Provider)) == NULL)
goto fenumdone;
-
- if (xmlStrcmp(fprov, (xmlChar *)"fac_prov_ipmi") != 0) {
- topo_dprintf(mp->tm_hdl, TOPO_DBG_XML,
- "Invalid provider specified: %s\n", fprov);
- goto fenumdone;
- }
-
/*
- * Invoke enum entry point in fac provider which will cause the
- * facility enumeration node method to be registered.
+ * Invoke enum entry point in facility provider which will
+ * cause the facility enumeration node method to be
+ * registered.
*/
if (fac_enum_run(mp, ptn, (const char *)fprov) != 0) {
topo_dprintf(mp->tm_hdl, TOPO_DBG_ERR,
@@ -1440,12 +1435,6 @@ fac_process(topo_mod_t *mp, xmlNodePtr pn, tf_rdata_t *rd, tnode_t *ptn)
xmlStrcmp(ftype, (xmlChar *)Indicator) != 0)
goto facdone;
- if (xmlStrcmp(provider, (xmlChar *)"fac_prov_ipmi") != 0) {
- topo_dprintf(mp->tm_hdl, TOPO_DBG_XML, "fac_process: "
- "Invalid provider attr value: %s\n", provider);
- goto facdone;
- }
-
if ((ntn = topo_node_facbind(mp, ptn, (char *)fname,
(char *)ftype)) == NULL)
goto facdone;
@@ -1463,8 +1452,9 @@ fac_process(topo_mod_t *mp, xmlNodePtr pn, tf_rdata_t *rd, tnode_t *ptn)
}
}
/*
- * Invoke enum entry point in fac_prov_ipmi module, which will
- * cause the provider methods to be registered on this node
+ * Invoke enum entry point in the facility provider module,
+ * which will cause the provider methods to be registered on
+ * this node
*/
if (fac_enum_run(mp, ntn, (const char *)provider) != 0) {
topo_dprintf(mp->tm_hdl, TOPO_DBG_ERR, "fac_process: "
diff --git a/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xmlgenksh b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xmlgenksh
new file mode 100755
index 0000000000..000742db71
--- /dev/null
+++ b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Joyent-Compute-Platform-1101-disk-hc-topology.xmlgenksh
@@ -0,0 +1,95 @@
+#!/bin/ksh
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
+#
+
+function do_node
+{
+ cat <<EOF
+ <node instance='${1}'>
+ <propgroup name='protocol' version='1' name-stability='Private'
+ data-stability='Private'>
+ <propval name='label' type='string' value='${2}' />
+ </propgroup>
+ <propgroup name='binding' version='1' name-stability='Private'
+ data-stability='Private'>
+ <propval name='driver' type='string' value='mpt_sas' />
+ <propval name='devctl' type='string' value='${3}' />
+ <propval name='enclosure' type='uint32' value='${4}' />
+ <propval name='slot' type='uint32' value='${5}' />
+ </propgroup>
+ </node>
+EOF
+}
+
+
+cat <<EOF
+<topology name='disk' scheme='hc'>
+ <range name='bay' min='0' max='15'>
+ <facility name='fail' type='indicator' provider='fac_prov_mptsas' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='0' />
+ <propmethod name='mptsas_led_mode' version='0' propname='mode'
+ proptype='uint32' mutable='1'>
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='ident' type='indicator' provider='fac_prov_mptsas' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='1' />
+ <propmethod name='mptsas_led_mode' version='0' propname='mode'
+ proptype='uint32' mutable='1'>
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='ok2rm' type='indicator' provider='fac_prov_mptsas' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='2' />
+ <propmethod name='mptsas_led_mode' version='0' propname='mode'
+ proptype='uint32' mutable='1'>
+ </propmethod>
+ </propgroup>
+ </facility>
+EOF
+
+enclosure=1
+bay=0
+slot=0
+devctl='/devices/pci@0,0/pci8086,3c02@1/pci15d9,691@0:devctl'
+while (( slot <= 7 )); do
+ do_node $bay "Front Disk $bay" "$devctl" $enclosure $slot
+ (( bay = bay + 1 ))
+ (( slot = slot + 1 ))
+done
+
+slot=0
+devctl='/devices/pci@0,0/pci8086,3c06@2,2/pci15d9,691@0:devctl'
+while (( slot <= 7 )); do
+ do_node $bay "Front Disk $bay" "$devctl" $enclosure $slot
+ (( bay = bay + 1 ))
+ (( slot = slot + 1 ))
+done
+
+cat <<EOF
+ <dependents grouping='children'>
+ <range name='disk' min='0' max='0'>
+ <enum-method name='disk' version='1' />
+ </range>
+ </dependents>
+ </range>
+</topology>
+EOF
diff --git a/usr/src/cmd/print/printer-info/Makefile b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Makefile
index 1aed6ba8f5..072ea71be7 100644
--- a/usr/src/cmd/print/printer-info/Makefile
+++ b/usr/src/lib/fm/topo/maps/Joyent,Joyent-Compute-Platform-1101/Makefile
@@ -18,51 +18,24 @@
#
# CDDL HEADER END
#
+
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
-include ../Makefile.sp
-
-ROOTLIBLPBIN = $(ROOTLIBLP)/bin
-
-PROG = printer-info
-SRCS = $(PROG).c
-OBJECTS = $(PROG).o
-
-ROOTPROG= $(PROG:%=$(ROOTLIBLPBIN)/%)
-$(ROOTPROG) := FILEMODE=555
-
-CERRWARN += -_gcc=-Wno-implicit-function-declaration
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-$(ROOTLIBLPBIN):
- $(INS.dir)
-
-$(ROOTLIBLPBIN)/%: %
- $(INS.file)
-
-install: all $(ROOTLIBLPBIN) $(ROOTPROG)
-
-$(PROGRAM): $(OBJECTS)
- $(CC) $(CFLAGS) -o $@ $(OBJECTS)
-
-clean:
- $(RM) $(PROG) *.o
-
-cstyle:
- cstyle $(SRCS)
-
-clobber: clean
-
-strip lint:
-
-
-
+# NOTE: The name of the xml file we are building is 'platform'
+# specific, but its build is structured as 'arch' specific since
+# 'uname -i' on all x86 platforms returns i86pc.
+ARCH = i86pc
+CLASS = arch
+DTDFILE = topology.dtd.1
+TOPOFILE = Joyent-Compute-Platform-1101-disk-hc-topology.xml
+SRCDIR = ../Joyent,Joyent-Compute-Platform-1101
+PLATFORM = Joyent-Compute-Platform-1101
+TOPOBASE = ../i86pc/i86pc-hc-topology.xml
+include ../Makefile.map
diff --git a/usr/src/lib/fm/topo/maps/Makefile b/usr/src/lib/fm/topo/maps/Makefile
index de6d9f5e0f..a01b016ebe 100644
--- a/usr/src/lib/fm/topo/maps/Makefile
+++ b/usr/src/lib/fm/topo/maps/Makefile
@@ -48,7 +48,8 @@ i386_SUBDIRS = i86pc \
SUNW,Netra-X4200-M2 \
SUNW,Sun-Fire-X4500 \
SUNW,Sun-Fire-X4540 \
- SUNW,Sun-Fire-X4600-M2
+ SUNW,Sun-Fire-X4600-M2 \
+ Joyent,Joyent-Compute-Platform-1101
SUBDIRS = $($(MACH)_SUBDIRS)
diff --git a/usr/src/lib/fm/topo/maps/Makefile.map b/usr/src/lib/fm/topo/maps/Makefile.map
index b72cd29d74..25577f6b26 100644
--- a/usr/src/lib/fm/topo/maps/Makefile.map
+++ b/usr/src/lib/fm/topo/maps/Makefile.map
@@ -22,12 +22,12 @@
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
-# ident "%Z%%M% %I% %E% SMI"
.KEEP_STATE:
.SUFFIXES:
-.SUFFIXES: .xml .xmlgen $(SUFFIXES)
+.SUFFIXES: .xml .xmlgen .xmlgenksh $(SUFFIXES)
MODCLASS = maps
@@ -54,6 +54,11 @@ install:= FILEMODE = 0444
$(RM) $@
$(CAT) ../common/xmlgen-header.xml > $@
$(PERL) $< >> $@
+
+.xmlgenksh.xml:
+ $(RM) $@
+ $(CAT) ../common/xmlgen-header-new.xml > $@
+ $(KSH93) $< >> $@
%.xml: ../common/%.xml
$(RM) $@
diff --git a/usr/src/lib/fm/topo/maps/common/xmlgen-header-new.xml b/usr/src/lib/fm/topo/maps/common/xmlgen-header-new.xml
new file mode 100644
index 0000000000..14cf1ff1e8
--- /dev/null
+++ b/usr/src/lib/fm/topo/maps/common/xmlgen-header-new.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<!DOCTYPE topology SYSTEM "/usr/share/lib/xml/dtd/topology.dtd.1">
diff --git a/usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml b/usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml
index 54021a7a5f..fda43bca6c 100644
--- a/usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml
+++ b/usr/src/lib/fm/topo/maps/i86pc/i86pc-legacy-hc-topology.xml
@@ -2,6 +2,7 @@
<!DOCTYPE topology SYSTEM "/usr/share/lib/xml/dtd/topology.dtd.1">
<!--
Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2013, Joyent, Inc. All rights reserved.
CDDL HEADER START
@@ -151,6 +152,18 @@ Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
</range>
</set>
+ <set type='product' setlist='Joyent-Compute-Platform-1101|Joyent-Compute-Platform-1102'>
+ <range name='psu' min='0' max='1'>
+ <enum-method name='ipmi' version='1' />
+ </range>
+ <range name='fan' min='0' max='100'>
+ <enum-method name='ipmi' version='1' />
+ </range>
+ <range name='bay' min='0' max='15'>
+ <propmap name='Joyent-Compute-Platform-1101-disk' />
+ </range>
+ </set>
+
<set type='product' setlist='default'>
<range name='psu' min='0' max='100'>
<enum-method name='ipmi' version='1' />
diff --git a/usr/src/lib/fm/topo/modules/common/Makefile b/usr/src/lib/fm/topo/modules/common/Makefile
index 0b0f965a70..fa38496755 100644
--- a/usr/src/lib/fm/topo/modules/common/Makefile
+++ b/usr/src/lib/fm/topo/modules/common/Makefile
@@ -23,11 +23,11 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
SUBDIRS = \
disk \
fac_prov_ipmi \
+ fac_prov_mptsas \
ipmi \
ses \
xfp
diff --git a/usr/src/lib/fm/topo/modules/common/disk/Makefile b/usr/src/lib/fm/topo/modules/common/disk/Makefile
index b4821a6a82..4b4c965050 100644
--- a/usr/src/lib/fm/topo/modules/common/disk/Makefile
+++ b/usr/src/lib/fm/topo/modules/common/disk/Makefile
@@ -22,14 +22,15 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-#pragma ident "%Z%%M% %I% %E% SMI"
MODULE = disk
CLASS = common
-MODULESRCS = disk.c disk_common.c
+MODULESRCS = disk.c disk_common.c disk_mptsas.c
include ../../Makefile.plugin
+CPPFLAGS += -I$(SRC)/uts/common
+
LDLIBS += -ldevinfo -ldevid -lcfgadm -ldiskstatus
diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk.c b/usr/src/lib/fm/topo/modules/common/disk/disk.c
index 427402c934..ec53198906 100644
--- a/usr/src/lib/fm/topo/modules/common/disk/disk.c
+++ b/usr/src/lib/fm/topo/modules/common/disk/disk.c
@@ -21,6 +21,9 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include <strings.h>
#include <devid.h>
@@ -33,6 +36,7 @@
#include <fm/libdiskstatus.h>
#include <sys/fm/protocol.h>
#include "disk.h"
+#include "disk_drivers.h"
static int disk_enum(topo_mod_t *, tnode_t *, const char *,
topo_instance_t, topo_instance_t, void *, void *);
@@ -43,13 +47,38 @@ static const topo_modops_t disk_ops =
static const topo_modinfo_t disk_info =
{DISK, FM_FMRI_SCHEME_HC, DISK_VERSION, &disk_ops};
+static int
+disk_declare_driver(topo_mod_t *mod, tnode_t *baynode, topo_list_t *dlistp,
+ char *driver)
+{
+ int err;
+
+ if (strcmp("mpt_sas", driver) == 0) {
+ char *sas_address = NULL;
+ tnode_t *child = NULL;
+
+ if ((err = disk_mptsas_find_disk(mod, baynode,
+ &sas_address)) != 0)
+ return (err);
+
+ err = disk_declare_addr(mod, baynode, dlistp,
+ sas_address, &child);
+ topo_mod_strfree(mod, sas_address);
+
+ return (err);
+ }
+
+ topo_mod_dprintf(mod, "unknown disk driver '%s'\n", driver);
+ return (-1);
+}
+
/*ARGSUSED*/
static int
disk_enum(topo_mod_t *mod, tnode_t *baynode,
const char *name, topo_instance_t min, topo_instance_t max,
void *arg, void *notused)
{
- char *device;
+ char *device, *driver;
int err;
nvlist_t *fmri;
topo_list_t *dlistp = topo_mod_getspecific(mod);
@@ -75,6 +104,22 @@ disk_enum(topo_mod_t *mod, tnode_t *baynode,
nvlist_free(fmri);
/*
+ * For internal storage, first check to see if we need to
+ * request more detail from an HBA driver.
+ */
+ if (topo_prop_get_string(baynode, TOPO_PGROUP_BINDING,
+ TOPO_BINDING_DRIVER, &driver, &err) == 0) {
+ err = disk_declare_driver(mod, baynode, dlistp, driver);
+
+ topo_mod_strfree(mod, driver);
+ return (err);
+ } else if (err != ETOPO_PROP_NOENT) {
+ topo_mod_dprintf(mod, "disk_enum: "
+ "binding error %s\n", topo_strerror(err));
+ return (-1);
+ }
+
+ /*
* For internal storage, get the path to the occupant from the
* binding group of the bay node
*/
diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk.h b/usr/src/lib/fm/topo/modules/common/disk/disk.h
index 3fabc4c334..e61a54974b 100644
--- a/usr/src/lib/fm/topo/modules/common/disk/disk.h
+++ b/usr/src/lib/fm/topo/modules/common/disk/disk.h
@@ -22,6 +22,9 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#ifndef _DISK_H
#define _DISK_H
@@ -54,6 +57,15 @@ extern "C" {
*/
#define TOPO_PGROUP_BINDING "binding"
#define TOPO_BINDING_OCCUPANT "occupant-path"
+#define TOPO_BINDING_DRIVER "driver"
+
+/*
+ * The binding group required in platform specific xml that describes 'bay'
+ * nodes containing disks attached to an HBA using the 'mpt_sas' driver.
+ */
+#define TOPO_BINDING_DEVCTL "devctl"
+#define TOPO_BINDING_ENCLOSURE "enclosure"
+#define TOPO_BINDING_SLOT "slot"
/*
* device node information.
diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk_drivers.h b/usr/src/lib/fm/topo/modules/common/disk/disk_drivers.h
new file mode 100644
index 0000000000..6851e2fe27
--- /dev/null
+++ b/usr/src/lib/fm/topo/modules/common/disk/disk_drivers.h
@@ -0,0 +1,31 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+#ifndef _DISK_DRIVERS_H
+#define _DISK_DRIVERS_H
+
+#include <fm/topo_mod.h>
+#include <libdevinfo.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int disk_mptsas_find_disk(topo_mod_t *, tnode_t *, char **);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DISK_DRIVERS_H */
diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk_mptsas.c b/usr/src/lib/fm/topo/modules/common/disk/disk_mptsas.c
new file mode 100644
index 0000000000..db853c6695
--- /dev/null
+++ b/usr/src/lib/fm/topo/modules/common/disk/disk_mptsas.c
@@ -0,0 +1,120 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stropts.h>
+#include <string.h>
+#include <strings.h>
+
+#include <fm/topo_mod.h>
+#include <fm/topo_list.h>
+
+#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_type.h>
+#include <sys/scsi/adapters/mpt_sas/mpi/mpi2.h>
+#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_init.h>
+#include <sys/scsi/adapters/mpt_sas/mptsas_ioctl.h>
+
+#include "disk.h"
+#include "disk_drivers.h"
+
+static int
+get_sas_address(topo_mod_t *mod, char *devctl, uint32_t enclosure,
+ uint32_t slot, char **sas_address)
+{
+ int fd, err, i;
+ mptsas_get_disk_info_t gdi;
+ mptsas_disk_info_t *di;
+ size_t disz;
+
+ bzero(&gdi, sizeof (gdi));
+
+ if ((fd = open(devctl, O_RDWR)) == -1) {
+ topo_mod_dprintf(mod, "could not open '%s' for ioctl: %s\n",
+ devctl, strerror(errno));
+ return (-1);
+ }
+
+ if (ioctl(fd, MPTIOCTL_GET_DISK_INFO, &gdi) == -1) {
+ topo_mod_dprintf(mod, "ioctl 1 on '%s' failed: %s\n", devctl,
+ strerror(errno));
+ (void) close(fd);
+ return (-1);
+ }
+
+ gdi.DiskInfoArraySize = disz = sizeof (mptsas_disk_info_t) *
+ gdi.DiskCount;
+ gdi.PtrDiskInfoArray = di = topo_mod_alloc(mod, disz);
+ if (di == NULL) {
+ topo_mod_dprintf(mod, "memory allocation failed\n");
+ (void) close(fd);
+ return (-1);
+ }
+
+ if (ioctl(fd, MPTIOCTL_GET_DISK_INFO, &gdi) == -1) {
+ topo_mod_dprintf(mod, "ioctl 2 on '%s' failed: %s\n", devctl,
+ strerror(errno));
+ topo_mod_free(mod, di, disz);
+ (void) close(fd);
+ return (-1);
+ }
+
+ err = -1;
+ for (i = 0; i < gdi.DiskCount; i++) {
+ if (di[i].Enclosure == enclosure && di[i].Slot == slot) {
+ char sas[17]; /* 16 hex digits and NUL */
+ (void) snprintf(sas, 17, "%llx", di[i].SasAddress);
+ topo_mod_dprintf(mod, "found mpt_sas disk (%d/%d) "
+ "with adddress %s\n", enclosure, slot, sas);
+ *sas_address = topo_mod_strdup(mod, sas);
+ err = 0;
+ break;
+ }
+ }
+
+ topo_mod_free(mod, di, disz);
+ (void) close(fd);
+ return (err);
+}
+
+int
+disk_mptsas_find_disk(topo_mod_t *mod, tnode_t *baynode, char **sas_address)
+{
+ char *devctl = NULL;
+ uint32_t enclosure, slot;
+ int err;
+
+ /*
+ * Get the required properties from the node. These come from
+ * the static XML mapping.
+ */
+ if (topo_prop_get_string(baynode, TOPO_PGROUP_BINDING,
+ TOPO_BINDING_DEVCTL, &devctl, &err) != 0 ||
+ topo_prop_get_uint32(baynode, TOPO_PGROUP_BINDING,
+ TOPO_BINDING_ENCLOSURE, &enclosure, &err) != 0 ||
+ topo_prop_get_uint32(baynode, TOPO_PGROUP_BINDING,
+ TOPO_BINDING_SLOT, &slot, &err) != 0) {
+ if (devctl != NULL)
+ topo_mod_strfree(mod, devctl);
+ topo_mod_dprintf(mod, "bay node was missing mpt_sas binding "
+ "properties\n");
+ return (-1);
+ }
+
+ return (get_sas_address(mod, devctl, enclosure, slot, sas_address));
+
+}
diff --git a/usr/src/cmd/print/scripts/desktop-print-management-applet b/usr/src/lib/fm/topo/modules/common/fac_prov_mptsas/Makefile
index 6a4932c8cf..31838e1bc0 100644
--- a/usr/src/cmd/print/scripts/desktop-print-management-applet
+++ b/usr/src/lib/fm/topo/modules/common/fac_prov_mptsas/Makefile
@@ -1,4 +1,3 @@
-#!/bin/sh
#
# CDDL HEADER START
#
@@ -19,14 +18,17 @@
#
# CDDL HEADER END
#
-
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
-# This interface launches any background desktop session service associated
-# with the configuration management app for the LP service.
-#
-exec /usr/lib/ospm/ospm-applet
-exit 0
+MODULE = fac_prov_mptsas
+CLASS = common
+
+MODULESRCS = fac_prov_mptsas.c
+
+include ../../Makefile.plugin
+
+CPPFLAGS += -I$(SRC)/uts/common
diff --git a/usr/src/lib/fm/topo/modules/common/fac_prov_mptsas/fac_prov_mptsas.c b/usr/src/lib/fm/topo/modules/common/fac_prov_mptsas/fac_prov_mptsas.c
new file mode 100644
index 0000000000..a49a131811
--- /dev/null
+++ b/usr/src/lib/fm/topo/modules/common/fac_prov_mptsas/fac_prov_mptsas.c
@@ -0,0 +1,244 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <string.h>
+#include <strings.h>
+#include <limits.h>
+#include <alloca.h>
+#include <errno.h>
+#include <libnvpair.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/fm/protocol.h>
+#include <fm/libtopo.h>
+#include <fm/topo_mod.h>
+
+#include "sys/scsi/adapters/mpt_sas/mptsas_ioctl.h"
+
+#define TOPO_METH_MPTSAS_LED_MODE_VERSION 0
+
+static int fac_prov_mptsas_enum(topo_mod_t *, tnode_t *, const char *,
+ topo_instance_t, topo_instance_t, void *, void *);
+
+/*
+ * mpt_sas facility provider methods
+ */
+static int mptsas_led_mode(topo_mod_t *, tnode_t *, topo_version_t,
+ nvlist_t *, nvlist_t **);
+
+const topo_modops_t mptsas_ops = { fac_prov_mptsas_enum, NULL };
+
+const topo_modinfo_t mptsas_info =
+ { "mpt_sas facility provider", FM_FMRI_SCHEME_HC, TOPO_VERSION,
+ &mptsas_ops };
+
+static const topo_method_t mptsas_fac_methods[] = {
+ { "mptsas_led_mode", TOPO_PROP_METH_DESC,
+ TOPO_METH_MPTSAS_LED_MODE_VERSION,
+ TOPO_STABILITY_INTERNAL, mptsas_led_mode },
+ { NULL }
+};
+
+/*ARGSUSED*/
+int
+_topo_init(topo_mod_t *mod, topo_version_t version)
+{
+ if (getenv("TOPOFACMPTSASDEBUG") != NULL)
+ topo_mod_setdebug(mod);
+
+ return (topo_mod_register(mod, &mptsas_info, TOPO_VERSION));
+}
+
+void
+_topo_fini(topo_mod_t *mod)
+{
+ topo_mod_unregister(mod);
+}
+
+static int
+do_led_control(topo_mod_t *mod, char *devctl, uint16_t enclosure,
+ uint16_t slot, uint8_t led, uint32_t *ledmode, boolean_t set)
+{
+ int fd;
+ mptsas_led_control_t lc;
+
+ bzero(&lc, sizeof (lc));
+
+ lc.Command = set ? MPTSAS_LEDCTL_FLAG_SET : MPTSAS_LEDCTL_FLAG_GET;
+ lc.Enclosure = enclosure;
+ lc.Slot = slot;
+ lc.Led = led;
+ lc.LedStatus = *ledmode;
+
+ if ((fd = open(devctl, (set ? O_RDWR : O_RDONLY))) == -1) {
+ topo_mod_dprintf(mod, "devctl open failed: %s",
+ strerror(errno));
+ return (-1);
+ }
+
+ if (ioctl(fd, MPTIOCTL_LED_CONTROL, &lc) == -1) {
+ if (errno == ENOENT) {
+ /*
+ * If there is not presently a target attached for
+ * a particular enclosure/slot pair then the driver
+ * does not track LED status for this bay. Assume
+ * all LEDs are off.
+ */
+ lc.LedStatus = 0;
+ } else {
+ topo_mod_dprintf(mod, "led control ioctl failed: %s",
+ strerror(errno));
+ (void) close(fd);
+ return (-1);
+ }
+ }
+
+ *ledmode = lc.LedStatus ? TOPO_LED_STATE_ON : TOPO_LED_STATE_OFF;
+
+ (void) close(fd);
+ return (0);
+}
+
+static int
+mptsas_led_mode(topo_mod_t *mod, tnode_t *node, topo_version_t vers,
+ nvlist_t *in, nvlist_t **nvout)
+{
+ int err, ret = 0;
+ tnode_t *pnode = topo_node_parent(node);
+ uint32_t type, ledmode = 0;
+ nvlist_t *pargs, *nvl;
+ char *driver = NULL, *devctl = NULL;
+ uint32_t enclosure, slot;
+ uint8_t mptsas_led;
+ boolean_t set;
+
+ if (vers > TOPO_METH_MPTSAS_LED_MODE_VERSION)
+ return (topo_mod_seterrno(mod, ETOPO_METHOD_VERNEW));
+
+ if (topo_prop_get_string(pnode, TOPO_PGROUP_BINDING,
+ TOPO_BINDING_DRIVER, &driver, &err) != 0 ||
+ strcmp("mpt_sas", driver) != 0) {
+ topo_mod_dprintf(mod, "%s: Facility driver was not mpt_sas",
+ __func__);
+ ret = topo_mod_seterrno(mod, EMOD_NVL_INVAL);
+ goto out;
+ }
+ if (topo_prop_get_uint32(node, TOPO_PGROUP_FACILITY, TOPO_FACILITY_TYPE,
+ &type, &err) != 0) {
+ topo_mod_dprintf(mod, "%s: Failed to lookup %s property "
+ "(%s)", __func__, TOPO_FACILITY_TYPE, topo_strerror(err));
+ return (topo_mod_seterrno(mod, EMOD_NVL_INVAL));
+ }
+ switch (type) {
+ case (TOPO_LED_TYPE_SERVICE):
+ mptsas_led = MPTSAS_LEDCTL_LED_FAIL;
+ break;
+ case (TOPO_LED_TYPE_LOCATE):
+ mptsas_led = MPTSAS_LEDCTL_LED_IDENT;
+ break;
+ case (TOPO_LED_TYPE_OK2RM):
+ mptsas_led = MPTSAS_LEDCTL_LED_OK2RM;
+ break;
+ default:
+ topo_mod_dprintf(mod, "%s: Invalid LED type: 0x%x\n", __func__,
+ type);
+ return (topo_mod_seterrno(mod, EMOD_NVL_INVAL));
+ }
+ if (topo_prop_get_string(pnode, TOPO_PGROUP_BINDING,
+ TOPO_BINDING_DEVCTL, &devctl, &err) != 0 ||
+ topo_prop_get_uint32(pnode, TOPO_PGROUP_BINDING,
+ TOPO_BINDING_ENCLOSURE, &enclosure, &err) != 0 ||
+ topo_prop_get_uint32(pnode, TOPO_PGROUP_BINDING,
+ TOPO_BINDING_SLOT, &slot, &err) != 0) {
+ topo_mod_dprintf(mod, "%s: Facility was missing mpt_sas binding"
+ " properties\n", __func__);
+ ret = topo_mod_seterrno(mod, EMOD_NVL_INVAL);
+ goto out;
+ }
+
+ if ((nvlist_lookup_nvlist(in, TOPO_PROP_PARGS, &pargs) == 0) &&
+ nvlist_exists(pargs, TOPO_PROP_VAL_VAL)) {
+ /*
+ * Set the LED mode
+ */
+ set = B_TRUE;
+ if ((ret = nvlist_lookup_uint32(pargs, TOPO_PROP_VAL_VAL,
+ &ledmode)) != 0) {
+ topo_mod_dprintf(mod, "%s: Failed to lookup %s nvpair "
+ "(%s)\n", __func__, TOPO_PROP_VAL_VAL,
+ strerror(ret));
+ ret = topo_mod_seterrno(mod, EMOD_NVL_INVAL);
+ goto out;
+ }
+ topo_mod_dprintf(mod, "%s: Setting LED mode to %s\n", __func__,
+ ledmode ? "ON" : "OFF");
+ } else {
+ /*
+ * Get the LED mode
+ */
+ set = B_FALSE;
+ topo_mod_dprintf(mod, "%s: Getting LED mode\n", __func__);
+ }
+
+ if (do_led_control(mod, devctl, enclosure, slot, mptsas_led, &ledmode,
+ set) != 0) {
+ topo_mod_dprintf(mod, "%s: do_led_control failed", __func__);
+ ret = topo_mod_seterrno(mod, EMOD_UNKNOWN);
+ goto out;
+ }
+
+ if (topo_mod_nvalloc(mod, &nvl, NV_UNIQUE_NAME) != 0 ||
+ nvlist_add_string(nvl, TOPO_PROP_VAL_NAME, TOPO_LED_MODE) != 0 ||
+ nvlist_add_uint32(nvl, TOPO_PROP_VAL_TYPE, TOPO_TYPE_UINT32) != 0 ||
+ nvlist_add_uint32(nvl, TOPO_PROP_VAL_VAL, ledmode) != 0) {
+ topo_mod_dprintf(mod, "%s: Failed to allocate 'out' nvlist\n",
+ __func__);
+ nvlist_free(nvl);
+ ret = topo_mod_seterrno(mod, EMOD_NOMEM);
+ goto out;
+ }
+ *nvout = nvl;
+
+out:
+ if (driver != NULL)
+ topo_mod_strfree(mod, driver);
+ if (devctl != NULL)
+ topo_mod_strfree(mod, devctl);
+ return (ret);
+}
+
+/*ARGSUSED*/
+static int
+fac_prov_mptsas_enum(topo_mod_t *mod, tnode_t *rnode, const char *name,
+ topo_instance_t min, topo_instance_t max, void *arg, void *unused)
+{
+ if (topo_node_flags(rnode) == TOPO_NODE_FACILITY) {
+ if (topo_method_register(mod, rnode, mptsas_fac_methods) != 0) {
+ topo_mod_dprintf(mod, "%s: topo_method_register() "
+ "failed: %s", __func__, topo_mod_errmsg(mod));
+ return (-1);
+ }
+ return (0);
+ }
+
+ topo_mod_dprintf(mod, "%s: unexpected node flags %x", __func__,
+ topo_node_flags(rnode));
+ return (-1);
+}
diff --git a/usr/src/lib/libbe/common/be_list.c b/usr/src/lib/libbe/common/be_list.c
index b9c7882d18..e669f24cc8 100644
--- a/usr/src/lib/libbe/common/be_list.c
+++ b/usr/src/lib/libbe/common/be_list.c
@@ -25,6 +25,7 @@
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
#include <assert.h>
@@ -872,7 +873,7 @@ be_get_node_data(
}
(void) zpool_get_prop(zphp, ZPOOL_PROP_BOOTFS, prop_buf, ZFS_MAXPROPLEN,
- NULL);
+ NULL, B_FALSE);
if (be_has_grub() &&
(be_default_grub_bootfs(rpool, &grub_default_bootfs)
== BE_SUCCESS) && grub_default_bootfs != NULL)
diff --git a/usr/src/lib/libbrand/Makefile.com b/usr/src/lib/libbrand/Makefile.com
index cd7d83371a..0fceb70aac 100644
--- a/usr/src/lib/libbrand/Makefile.com
+++ b/usr/src/lib/libbrand/Makefile.com
@@ -34,7 +34,7 @@ include ../../Makefile.lib
LIBS= $(DYNLIB) $(LINTLIB)
LDLIBS += -lc
$(LINTLIB) := SRCS= $(SRCDIR)/$(LINTSRC)
-CPPFLAGS += -I/usr/include/libxml2 -I$(SRCDIR) -D_REENTRANT
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I$(SRCDIR) -D_REENTRANT
$(DYNLIB) := LDLIBS += -lxml2
SRCDIR= ../common
diff --git a/usr/src/lib/libbrand/common/libbrand.c b/usr/src/lib/libbrand/common/libbrand.c
index 5034715a7e..baaaf33120 100644
--- a/usr/src/lib/libbrand/common/libbrand.c
+++ b/usr/src/lib/libbrand/common/libbrand.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#include <assert.h>
@@ -60,6 +61,7 @@
#define DTD_ELEM_FORCELOGIN_CMD ((const xmlChar *) "forcedlogin_cmd")
#define DTD_ELEM_MODNAME ((const xmlChar *) "modname")
#define DTD_ELEM_MOUNT ((const xmlChar *) "mount")
+#define DTD_ELEM_RESTARTINIT ((const xmlChar *) "restartinit")
#define DTD_ELEM_POSTATTACH ((const xmlChar *) "postattach")
#define DTD_ELEM_POSTCLONE ((const xmlChar *) "postclone")
#define DTD_ELEM_POSTINSTALL ((const xmlChar *) "postinstall")
@@ -319,6 +321,7 @@ i_substitute_tokens(const char *sbuf, char *dbuf, int dbuf_size,
const char *curr_zone)
{
int dst, src;
+ static char *env_pool = NULL;
/*
* Walk through the characters, substituting values as needed.
@@ -335,6 +338,13 @@ i_substitute_tokens(const char *sbuf, char *dbuf, int dbuf_size,
case '%':
dst += strlcpy(dbuf + dst, "%", dbuf_size - dst);
break;
+ case 'P':
+ if (env_pool == NULL)
+ env_pool = getenv("_ZONEADMD_ZPOOL");
+ if (env_pool == NULL)
+ break;
+ dst += strlcpy(dbuf + dst, env_pool, dbuf_size - dst);
+ break;
case 'R':
if (zonepath == NULL)
break;
@@ -509,6 +519,21 @@ brand_get_initname(brand_handle_t bh, char *buf, size_t len)
buf, len, DTD_ELEM_INITNAME, B_FALSE, B_FALSE));
}
+boolean_t
+brand_restartinit(brand_handle_t bh)
+{
+ struct brand_handle *bhp = (struct brand_handle *)bh;
+ char val[80];
+
+ if (brand_get_value(bhp, NULL, NULL, NULL, NULL,
+ val, 80, DTD_ELEM_RESTARTINIT, B_FALSE, B_FALSE) != 0)
+ return (B_TRUE);
+
+ if (strcmp(val, "false") == 0)
+ return (B_FALSE);
+ return (B_TRUE);
+}
+
int
brand_get_login_cmd(brand_handle_t bh, const char *username,
char *buf, size_t len)
diff --git a/usr/src/lib/libbrand/common/libbrand.h b/usr/src/lib/libbrand/common/libbrand.h
index 19231604a5..1ca9e9f36d 100644
--- a/usr/src/lib/libbrand/common/libbrand.h
+++ b/usr/src/lib/libbrand/common/libbrand.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#ifndef _LIBBRAND_H
@@ -57,6 +58,7 @@ extern int brand_get_detach(brand_handle_t, const char *, const char *,
extern int brand_get_halt(brand_handle_t, const char *, const char *,
char *, size_t);
extern int brand_get_initname(brand_handle_t, char *, size_t);
+extern boolean_t brand_restartinit(brand_handle_t);
extern int brand_get_install(brand_handle_t, const char *, const char *,
char *, size_t);
extern int brand_get_installopts(brand_handle_t, char *, size_t);
diff --git a/usr/src/lib/libbrand/common/mapfile-vers b/usr/src/lib/libbrand/common/mapfile-vers
index 7b961c3c18..9bf21d2d26 100644
--- a/usr/src/lib/libbrand/common/mapfile-vers
+++ b/usr/src/lib/libbrand/common/mapfile-vers
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, Joyent, Inc. All rights reserved.
#
#
@@ -76,6 +77,7 @@ SYMBOL_VERSION SUNWprivate {
brand_platform_iter_gmounts;
brand_platform_iter_link;
brand_platform_iter_mounts;
+ brand_restartinit;
local:
*;
};
diff --git a/usr/src/lib/libbrand/dtd/brand.dtd.1 b/usr/src/lib/libbrand/dtd/brand.dtd.1
index 15542102db..89719a6ae6 100644
--- a/usr/src/lib/libbrand/dtd/brand.dtd.1
+++ b/usr/src/lib/libbrand/dtd/brand.dtd.1
@@ -21,6 +21,7 @@
CDDL HEADER END
Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2011, Joyent, Inc. All rights reserved.
DO NOT EDIT THIS FILE.
-->
@@ -188,6 +189,19 @@
<!ATTLIST initname>
<!--
+ restartinit
+
+ Boolean indicating that the program specified by the initname attr
+ should be restarted, or not, if it exits. By default, the init program
+ will be restarted if this attribute is not provided. Specifying false
+ for this attr will prevent that.
+
+ It has no attributes.
+-->
+<!ELEMENT restartinit (#PCDATA) >
+<!ATTLIST restartinit>
+
+<!--
login_cmd
Path to the initial login binary that should be executed when
@@ -605,8 +619,8 @@
directory in which the configuration file is stored.
-->
-<!ELEMENT brand (modname?, initname, login_cmd, forcedlogin_cmd,
- user_cmd, install,
+<!ELEMENT brand (modname?, initname, restartinit?, login_cmd,
+ forcedlogin_cmd, user_cmd, install,
installopts?, boot?, sysboot?, halt?, verify_cfg?,
verify_adm?, postattach?, postclone?, postinstall?,
predetach?, attach?, detach?, clone?,
diff --git a/usr/src/lib/libbsm/common/adt.c b/usr/src/lib/libbsm/common/adt.c
index 8c7b299e32..4cf0dd7566 100644
--- a/usr/src/lib/libbsm/common/adt.c
+++ b/usr/src/lib/libbsm/common/adt.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2013, Joyent, Inc. All rights reserved.
*/
#include <bsm/adt.h>
@@ -702,7 +703,37 @@ adt_get_hostIP(const char *hostname, au_tid_addr_t *p_term)
int tries = 3;
char msg[512];
int eai_err;
+ struct ifaddrlist al;
+ int family;
+ boolean_t found = B_FALSE;
+ /*
+ * getaddrinfo can take a long time to timeout if it can't map the
+ * hostname to an IP address so try to get an IP address from a local
+ * interface first.
+ */
+ family = AF_INET6;
+ if (adt_get_local_address(family, &al) == 0) {
+ found = B_TRUE;
+ } else {
+ family = AF_INET;
+ if (adt_get_local_address(family, &al) == 0)
+ found = B_TRUE;
+ }
+
+ if (found) {
+ if (family == AF_INET) {
+ p_term->at_type = AU_IPv4;
+ (void) memcpy(p_term->at_addr, &al.addr.addr, AU_IPv4);
+ } else {
+ p_term->at_type = AU_IPv6;
+ (void) memcpy(p_term->at_addr, &al.addr.addr6, AU_IPv6);
+ }
+
+ return (0);
+ }
+
+ /* Now try getaddrinfo */
while ((tries-- > 0) &&
((eai_err = getaddrinfo(hostname, NULL, NULL, &ai)) != 0)) {
/*
@@ -739,7 +770,9 @@ adt_get_hostIP(const char *hostname, au_tid_addr_t *p_term)
}
freeaddrinfo(ai);
return (0);
- } else if (auditstate & (AUC_AUDITING | AUC_NOSPACE)) {
+ }
+
+ if (auditstate & (AUC_AUDITING | AUC_NOSPACE)) {
auditinfo_addr_t audit_info;
/*
@@ -747,58 +780,23 @@ adt_get_hostIP(const char *hostname, au_tid_addr_t *p_term)
* kernel audit context
*/
if (auditon(A_GETKAUDIT, (caddr_t)&audit_info,
- sizeof (audit_info)) < 0) {
- adt_write_syslog("unable to get kernel audit context",
- errno);
- goto try_interface;
+ sizeof (audit_info)) >= 0) {
+ adt_write_syslog("setting Audit IP address to kernel",
+ 0);
+ *p_term = audit_info.ai_termid;
+ return (0);
}
- adt_write_syslog("setting Audit IP address to kernel", 0);
- *p_term = audit_info.ai_termid;
- return (0);
+ adt_write_syslog("unable to get kernel audit context", errno);
}
-try_interface:
- {
- struct ifaddrlist al;
- int family;
- char ntop[INET6_ADDRSTRLEN];
-
- /*
- * getaddrinfo has failed to map the hostname
- * to an IP address, try to get an IP address
- * from a local interface. If none up, default
- * to loopback.
- */
- family = AF_INET6;
- if (adt_get_local_address(family, &al) != 0) {
- family = AF_INET;
-
- if (adt_get_local_address(family, &al) != 0) {
- adt_write_syslog("adt_get_local_address "
- "failed, no Audit IP address available, "
- "faking loopback and error",
- errno);
- IN_SET_LOOPBACK_ADDR(
- (struct sockaddr_in *)&(al.addr.addr));
- (void) memcpy(p_term->at_addr, &al.addr.addr,
- AU_IPv4);
- p_term->at_type = AU_IPv4;
- return (-1);
- }
- }
- if (family == AF_INET) {
- p_term->at_type = AU_IPv4;
- (void) memcpy(p_term->at_addr, &al.addr.addr, AU_IPv4);
- } else {
- p_term->at_type = AU_IPv6;
- (void) memcpy(p_term->at_addr, &al.addr.addr6, AU_IPv6);
- }
- (void) snprintf(msg, sizeof (msg), "mapping %s to %s",
- hostname, inet_ntop(family, &(al.addr), ntop,
- sizeof (ntop)));
- adt_write_syslog(msg, 0);
- return (0);
- }
+ /* No mapping, default to loopback. */
+ errno = ENETDOWN;
+ adt_write_syslog("adt_get_local_address failed, no Audit IP address "
+ "available, faking loopback and error", errno);
+ IN_SET_LOOPBACK_ADDR((struct sockaddr_in *)&(al.addr.addr));
+ (void) memcpy(p_term->at_addr, &al.addr.addr, AU_IPv4);
+ p_term->at_type = AU_IPv4;
+ return (-1);
}
/*
@@ -2093,8 +2091,8 @@ adt_selected(struct adt_event_state *event, au_event_t actual_id, int status)
}
/*
- * Can't map the host name to an IP address in
- * adt_get_hostIP. Get something off an interface
+ * Before trying to map the host name to an IP address in
+ * adt_get_hostIP, get something off an interface
* to act as the hosts IP address for auditing.
*/
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index 9ddd748eb6..396c536387 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
@@ -798,6 +799,7 @@ THREADSOBJS= \
assfail.o \
cancel.o \
door_calls.o \
+ tmem.o \
pthr_attr.o \
pthr_barrier.o \
pthr_cond.o \
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index 31a7bc945f..d5826d8e45 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -21,6 +21,7 @@
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Use is subject to license terms.
@@ -840,6 +841,7 @@ THREADSOBJS= \
assfail.o \
cancel.o \
door_calls.o \
+ tmem.o \
pthr_attr.o \
pthr_barrier.o \
pthr_cond.o \
diff --git a/usr/src/lib/libc/inc/thr_inlines.h b/usr/src/lib/libc/inc/thr_inlines.h
index f7cdc6a6bd..66d811f25b 100644
--- a/usr/src/lib/libc/inc/thr_inlines.h
+++ b/usr/src/lib/libc/inc/thr_inlines.h
@@ -47,17 +47,19 @@
extern __GNU_INLINE ulwp_t *
_curthread(void)
{
-#if defined(__amd64)
ulwp_t *__value;
- __asm__ __volatile__("movq %%fs:0, %0" : "=r" (__value));
+ __asm__ __volatile__(
+#if defined(__amd64)
+ "movq %%fs:0, %0\n\t"
#elif defined(__i386)
- ulwp_t *__value;
- __asm__ __volatile__("movl %%gs:0, %0" : "=r" (__value));
+ "movl %%gs:0, %0\n\t"
#elif defined(__sparc)
- register ulwp_t *__value __asm__("g7");
+ ".register %%g7, #scratch\n\t"
+ "mov %%g7, %0\n\t"
#else
#error "port me"
#endif
+ : "=r" (__value));
return (__value);
}
diff --git a/usr/src/lib/libc/inc/thr_uberdata.h b/usr/src/lib/libc/inc/thr_uberdata.h
index af3083138d..2b8d000b29 100644
--- a/usr/src/lib/libc/inc/thr_uberdata.h
+++ b/usr/src/lib/libc/inc/thr_uberdata.h
@@ -22,6 +22,9 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#ifndef _THR_UBERDATA_H
#define _THR_UBERDATA_H
@@ -488,6 +491,28 @@ typedef struct {
#endif /* _SYSCALL32 */
/*
+ * As part of per-thread caching libumem (ptcumem), we add a small amount to the
+ * thread's uberdata to facilitate it. The tm_roots are the roots of linked
+ * lists which is used by libumem to chain together allocations. tm_size is used
+ * to track the total amount of data stored across those linked lists.
+ */
+#define NTMEMBASE 16
+
+typedef struct {
+ size_t tm_size;
+ void *tm_roots[NTMEMBASE];
+} tumem_t;
+
+#ifdef _SYSCALL32
+typedef struct {
+ uint32_t tm_size;
+ caddr32_t tm_roots[NTMEMBASE];
+} tumem32_t;
+#endif
+
+typedef void (*tmem_func_t)(void *, int);
+
+/*
* Maximum number of read locks allowed for one thread on one rwlock.
* This could be as large as INT_MAX, but the SUSV3 test suite would
* take an inordinately long time to complete. This is big enough.
@@ -653,6 +678,7 @@ typedef struct ulwp {
#if defined(sparc)
void *ul_unwind_ret; /* used only by _ex_clnup_handler() */
#endif
+ tumem_t ul_tmem; /* used only by umem */
} ulwp_t;
#define ul_cursig ul_cp.s.cursig /* deferred signal number */
@@ -1074,6 +1100,7 @@ typedef struct ulwp32 {
#if defined(sparc)
caddr32_t ul_unwind_ret; /* used only by _ex_clnup_handler() */
#endif
+ tumem32_t ul_tmem; /* used only by umem */
} ulwp32_t;
#define REPLACEMENT_SIZE32 ((size_t)&((ulwp32_t *)NULL)->ul_sigmask)
@@ -1196,6 +1223,7 @@ extern ulwp_t *find_lwp(thread_t);
extern void finish_init(void);
extern void update_sched(ulwp_t *);
extern void queue_alloc(void);
+extern void tmem_exit(void);
extern void tsd_exit(void);
extern void tsd_free(ulwp_t *);
extern void tls_setup(void);
diff --git a/usr/src/lib/libc/port/gen/getlogin.c b/usr/src/lib/libc/port/gen/getlogin.c
index a3d7b4cf3b..e96d294fd0 100644
--- a/usr/src/lib/libc/port/gen/getlogin.c
+++ b/usr/src/lib/libc/port/gen/getlogin.c
@@ -27,7 +27,9 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
+ */
#pragma weak _getlogin = getlogin
#pragma weak _getlogin_r = getlogin_r
@@ -35,6 +37,7 @@
#include "lint.h"
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
@@ -51,40 +54,55 @@
* XXX - _POSIX_LOGIN_NAME_MAX limits the length of a login name. The utmpx
* interface provides for a 32 character login name, but for the sake of
* compatibility, we are still using the old utmp-imposed limit.
+ *
+ * If you want the full name, use the Consolidation Private getxlogin().
*/
-/*
- * POSIX.1c Draft-6 version of the function getlogin_r.
- * It was implemented by Solaris 2.3.
- */
-char *
-getlogin_r(char *answer, int namelen)
+static int
+generic_getlogin(char *answer, int namelen, boolean_t truncate)
{
int uf;
off64_t me;
struct futmpx ubuf;
- if (namelen < _POSIX_LOGIN_NAME_MAX) {
- errno = ERANGE;
- return (NULL);
- }
-
if ((me = (off64_t)ttyslot()) < 0)
- return (NULL);
+ return (-1);
if ((uf = open64(UTMPX_FILE, 0)) < 0)
- return (NULL);
+ return (-1);
(void) lseek64(uf, me * sizeof (ubuf), SEEK_SET);
if (read(uf, &ubuf, sizeof (ubuf)) != sizeof (ubuf)) {
(void) close(uf);
- return (NULL);
+ return (-1);
}
(void) close(uf);
if (ubuf.ut_user[0] == '\0')
+ return (-1);
+ if (strnlen(ubuf.ut_user, sizeof (ubuf.ut_user)) >= namelen &&
+ !truncate) {
+ errno = ERANGE;
+ return (-1);
+ }
+ (void) strlcpy(answer, ubuf.ut_user, namelen);
+
+ return (0);
+}
+
+/*
+ * POSIX.1c Draft-6 version of the function getlogin_r.
+ * It was implemented by Solaris 2.3.
+ */
+char *
+getlogin_r(char *answer, int namelen)
+{
+ if (namelen < _POSIX_LOGIN_NAME_MAX) {
+ errno = ERANGE;
return (NULL);
- (void) strncpy(&answer[0], &ubuf.ut_user[0],
- _POSIX_LOGIN_NAME_MAX - 1);
- answer[_POSIX_LOGIN_NAME_MAX - 1] = '\0';
- return (&answer[0]);
+ }
+
+ if (generic_getlogin(answer, _POSIX_LOGIN_NAME_MAX, B_TRUE) == 0)
+ return (answer);
+
+ return (NULL);
}
/*
@@ -98,7 +116,7 @@ __posix_getlogin_r(char *name, int namelen)
int oerrno = errno;
errno = 0;
- if (getlogin_r(name, namelen) == NULL) {
+ if (getlogin_r(name, namelen) != 0) {
if (errno == 0)
nerrno = EINVAL;
else
@@ -111,9 +129,28 @@ __posix_getlogin_r(char *name, int namelen)
char *
getlogin(void)
{
- char *answer = tsdalloc(_T_LOGIN, _POSIX_LOGIN_NAME_MAX, NULL);
+ struct futmpx fu;
+ char *answer = tsdalloc(_T_LOGIN,
+ MAX(sizeof (fu.ut_user), _POSIX_LOGIN_NAME_MAX), NULL);
if (answer == NULL)
return (NULL);
return (getlogin_r(answer, _POSIX_LOGIN_NAME_MAX));
}
+
+char *
+getxlogin(void)
+{
+ struct futmpx fu;
+ char *answer = tsdalloc(_T_LOGIN,
+ MAX(sizeof (fu.ut_user), _POSIX_LOGIN_NAME_MAX), NULL);
+
+ if (answer == NULL)
+ return (NULL);
+
+ if (generic_getlogin(answer,
+ MAX(sizeof (fu.ut_user), _POSIX_LOGIN_NAME_MAX), B_FALSE) != 0)
+ return (NULL);
+
+ return (answer);
+}
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index fccca8b44f..469b73e9ca 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -24,6 +24,7 @@
# Copyright 2010 Nexenta Systems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
@@ -2737,6 +2738,7 @@ $endif
getvmusage;
__getwchar_xpg5;
__getwc_xpg5;
+ getxlogin;
gtty;
__idmap_flush_kcache;
__idmap_reg;
@@ -2882,6 +2884,9 @@ $endif
thr_wait_mutator;
_thr_wait_mutator;
__tls_get_addr;
+ _tmem_get_base;
+ _tmem_get_nentries;
+ _tmem_set_cleanup;
tpool_create;
tpool_dispatch;
tpool_destroy;
diff --git a/usr/src/lib/libc/port/sys/zone.c b/usr/src/lib/libc/port/sys/zone.c
index 4a4c70043d..182a7f22f7 100644
--- a/usr/src/lib/libc/port/sys/zone.c
+++ b/usr/src/lib/libc/port/sys/zone.c
@@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent Inc. All rights reserved.
*/
#include "lint.h"
@@ -39,7 +40,8 @@
zoneid_t
zone_create(const char *name, const char *root, const struct priv_set *privs,
const char *rctls, size_t rctlsz, const char *zfs, size_t zfssz,
- int *extended_error, int match, int doi, const bslabel_t *label, int flags)
+ int *extended_error, int match, int doi, const bslabel_t *label, int flags,
+ zoneid_t req_zoneid)
{
zone_def zd;
priv_data_t *d;
@@ -59,6 +61,7 @@ zone_create(const char *name, const char *root, const struct priv_set *privs,
zd.doi = doi;
zd.label = label;
zd.flags = flags;
+ zd.zoneid = req_zoneid;
return ((zoneid_t)syscall(SYS_zone, ZONE_CREATE, &zd));
}
diff --git a/usr/src/lib/libc/port/threads/thr.c b/usr/src/lib/libc/port/threads/thr.c
index ae55fbddf5..b5d848449d 100644
--- a/usr/src/lib/libc/port/threads/thr.c
+++ b/usr/src/lib/libc/port/threads/thr.c
@@ -22,6 +22,9 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#include "lint.h"
#include "thr_uberdata.h"
@@ -771,6 +774,7 @@ _thrp_exit()
}
lmutex_unlock(&udp->link_lock);
+ tmem_exit(); /* deallocate tmem allocations */
tsd_exit(); /* deallocate thread-specific data */
tls_exit(); /* deallocate thread-local storage */
heldlock_exit(); /* deal with left-over held locks */
diff --git a/usr/src/lib/libc/port/threads/tmem.c b/usr/src/lib/libc/port/threads/tmem.c
new file mode 100644
index 0000000000..00203de593
--- /dev/null
+++ b/usr/src/lib/libc/port/threads/tmem.c
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+#include "lint.h"
+#include "thr_uberdata.h"
+
+/*
+ * This file implements the private interface with libumem for per-thread
+ * caching umem (ptcumem). For the full details on how tcumem works and how
+ * these functions work, see section 8.4 of the big theory statement in
+ * lib/libumem/common/umem.c.
+ */
+static tmem_func_t tmem_cleanup = NULL;
+
+uintptr_t
+_tmem_get_base(void)
+{
+ return ((uintptr_t)&curthread->ul_tmem - (uintptr_t)curthread);
+}
+
+int
+_tmem_get_nentries(void)
+{
+ return (NTMEMBASE);
+}
+
+void
+_tmem_set_cleanup(tmem_func_t f)
+{
+ tmem_cleanup = f;
+}
+
+/*
+ * This is called by _thrp_exit() to clean up any per-thread allocations that
+ * are still hanging around and haven't been cleaned up.
+ */
+void
+tmem_exit(void)
+{
+ int ii;
+ void *buf, *next;
+ tumem_t *tp = &curthread->ul_tmem;
+
+
+ if (tp->tm_size == 0)
+ return;
+
+ /*
+ * Since we have something stored here, we need to ensure we declared a
+ * clean up handler. If we haven't that's broken and our single private
+ * consumer should be shot.
+ */
+ if (tmem_cleanup == NULL)
+ abort();
+ for (ii = 0; ii < NTMEMBASE; ii++) {
+ buf = tp->tm_roots[ii];
+ while (buf != NULL) {
+ next = *(void **)buf;
+ tmem_cleanup(buf, ii);
+ buf = next;
+ }
+ }
+}
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index cc6bae0df4..4840990414 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -21,6 +21,7 @@
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Use is subject to license terms.
@@ -875,6 +876,7 @@ THREADSOBJS= \
assfail.o \
cancel.o \
door_calls.o \
+ tmem.o \
pthr_attr.o \
pthr_barrier.o \
pthr_cond.o \
diff --git a/usr/src/lib/libc/sparc/crt/_rtld.c b/usr/src/lib/libc/sparc/crt/_rtld.c
index a9e9c6d98a..843cfe03a5 100644
--- a/usr/src/lib/libc/sparc/crt/_rtld.c
+++ b/usr/src/lib/libc/sparc/crt/_rtld.c
@@ -62,6 +62,15 @@
#define SYSCONFIG (*(funcs[SYSCONFIG_F]))
/*
+ * GCC will not emit unused static functions unless specifically told it must
+ */
+#ifdef __GNUC__
+#define __USED __attribute__((used))
+#else
+#define __USED
+#endif
+
+/*
* Alias ld.so entry point -- receives a bootstrap structure and a vector
* of strings. The vector is "well-known" to us, and consists of pointers
* to string constants. This aliasing bootstrap requires no relocation in
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index 54b3258fe9..669e06395c 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -21,6 +21,7 @@
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Use is subject to license terms.
@@ -822,6 +823,7 @@ THREADSOBJS= \
assfail.o \
cancel.o \
door_calls.o \
+ tmem.o \
pthr_attr.o \
pthr_barrier.o \
pthr_cond.o \
diff --git a/usr/src/lib/libctf/common/mapfile-vers b/usr/src/lib/libctf/common/mapfile-vers
index c218edc37c..0873de319e 100644
--- a/usr/src/lib/libctf/common/mapfile-vers
+++ b/usr/src/lib/libctf/common/mapfile-vers
@@ -60,6 +60,7 @@ SYMBOL_VERSION SUNWprivate_1.2 {
ctf_add_union;
ctf_add_volatile;
ctf_create;
+ ctf_delete_type;
ctf_discard;
ctf_enum_value;
ctf_label_info;
diff --git a/usr/src/lib/libdiskmgt/common/disks_private.h b/usr/src/lib/libdiskmgt/common/disks_private.h
index 0f782bc383..5e44ba437a 100644
--- a/usr/src/lib/libdiskmgt/common/disks_private.h
+++ b/usr/src/lib/libdiskmgt/common/disks_private.h
@@ -109,6 +109,7 @@ typedef struct disk {
int rpm;
int wide;
int cd_rom;
+ int solid_state;
} disk_t;
typedef struct descriptor {
diff --git a/usr/src/lib/libdiskmgt/common/drive.c b/usr/src/lib/libdiskmgt/common/drive.c
index 825348ce9f..f1b2d49961 100644
--- a/usr/src/lib/libdiskmgt/common/drive.c
+++ b/usr/src/lib/libdiskmgt/common/drive.c
@@ -350,6 +350,7 @@ static int get_io_kstats(kstat_ctl_t *kc, char *diskname,
static int get_kstat_vals(kstat_t *ksp, nvlist_t *stats);
static char *get_err_attr_name(char *kstat_name);
static int get_rpm(disk_t *dp, int fd);
+static int get_solidstate(disk_t *dp, int fd);
static int update_stat64(nvlist_t *stats, char *attr,
uint64_t value);
static int update_stat32(nvlist_t *stats, char *attr,
@@ -943,6 +944,16 @@ get_attrs(disk_t *diskp, int fd, char *opath, nvlist_t *attrs)
}
}
+ if (diskp->solid_state < 0) {
+ diskp->solid_state = get_solidstate(diskp, fd);
+ }
+
+ if (diskp->solid_state > 0) {
+ if (nvlist_add_boolean(attrs, DM_SOLIDSTATE) != 0) {
+ return (ENOMEM);
+ }
+ }
+
return (0);
}
@@ -1197,6 +1208,31 @@ get_rpm(disk_t *dp, int fd)
return (rpm);
}
+static int
+get_solidstate(disk_t *dp, int fd)
+{
+ int opened_here = 0;
+ int solid_state = -1;
+
+ /* We may have already opened the device. */
+ if (fd < 0) {
+ fd = drive_open_disk(dp, NULL, 0);
+ opened_here = 1;
+ }
+
+ if (fd >= 0) {
+ if (ioctl(fd, DKIOCSOLIDSTATE, &solid_state) < 0) {
+ solid_state = -1;
+ }
+ }
+
+ if (opened_here) {
+ (void) close(fd);
+ }
+
+ return (solid_state);
+}
+
/*
* ******** the rest of this is uscsi stuff for the drv type ********
*/
diff --git a/usr/src/lib/libdiskmgt/common/findevs.c b/usr/src/lib/libdiskmgt/common/findevs.c
index 9728eab65e..19089e8531 100644
--- a/usr/src/lib/libdiskmgt/common/findevs.c
+++ b/usr/src/lib/libdiskmgt/common/findevs.c
@@ -997,6 +997,7 @@ create_disk(char *deviceid, char *kernel_name, struct search_args *args)
diskp->cd_rom = 0;
diskp->rpm = 0;
+ diskp->solid_state = -1;
type = di_minor_nodetype(args->minor);
prod_id = get_str_prop(PROD_ID_PROP, args->node);
diff --git a/usr/src/lib/libdiskmgt/common/libdiskmgt.h b/usr/src/lib/libdiskmgt/common/libdiskmgt.h
index d075746122..2c42f6e8cc 100644
--- a/usr/src/lib/libdiskmgt/common/libdiskmgt.h
+++ b/usr/src/lib/libdiskmgt/common/libdiskmgt.h
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _LIBDISKMGT_H
@@ -35,6 +36,144 @@ extern "C" {
/*
+ * Disk Management Library
+ *
+ * This library provides a common way to gather information about a system's
+ * disks, controllers, and related components.
+ *
+ *
+ * THREADS
+ * -------
+ *
+ * In general all of the functions are thread safe, however there are some
+ * specific considerations for getting events. The dm_get_event function may
+ * block the calling thread if no event is currently available. If another
+ * thread calls dm_get_event while a thread is already blocked in this function,
+ * the second thread will also block. When an event arrives and multiple
+ * threads are waiting for events, it is undefined which thread will be
+ * unblocked and receive the event. If a callback is used for handling events,
+ * this is equivalent to the dm_get_event function, so mixing callbacks and
+ * dm_get_event is also nondeterministic.
+ *
+ *
+ * ERRORS
+ * ------
+ *
+ * In general all of the functions take an errno pointer. This is an integer
+ * that will contain 0 if the function succeeded or contains an errno (see
+ * errno.h) if there was an error. If the function returns some data, that
+ * return data will generally be null if an error occured (see the API comment
+ * for the specific function for details). Many of the functions take a
+ * descriptor and provide more information for that descriptor. These functions
+ * may return an error if the object was removed between the call which obtained
+ * the descriptor and the call to get more information about the object (errno
+ * will be ENODEV). Only a few of the possible errno values will be returned;
+ * typically:
+ * EPERM not super-user
+ * ENOMEM not enough memory
+ * ENODEV no such device
+ * EINVAL invalid argument
+ * ENOENT no event queue has been created
+ *
+ * Many of the functions require the application to be running as root in order
+ * to get complete information. EPERM will be returned if the application is
+ * not running as root. However, not all of the functions have this requirement
+ * (i.e. event handling).
+ *
+ * It is possible for the system to run out of memory while receiving events.
+ * Since event receipt is asyncronous from the dm_get_event call there may not
+ * be a thread waiting when the event occurs and ENOMEM is detected. In this
+ * case the event will be lost. The first call to dm_get_event following this
+ * condition will immediately return ENOMEM, even if events are queued.
+ * Subsequent calls can return events. The dm_get_event call will clear the
+ * pending ENOMEM condition. There is no way to know how many events were lost
+ * when this situation occurs. If a thread is waiting when the event arrives
+ * and the ENOMEM condition occurs, the call will also return with ENOMEM.
+ * There is no way to determine if the system ran out of memory before the
+ * dm_get_event call or while the thread was blocked in the dm_get_event call
+ * since both conditions cause dm_get_event to return ENOMEM.
+ *
+ *
+ * MEMORY MANAGEMENT
+ * -----------------
+ *
+ * Most of the functions that return data are returning memory that has been
+ * allocated and must be freed by the application when no longer needed. The
+ * application should call the proper free function to free the memory. Most of
+ * the functions return either a nvlist or an array of descriptors. The normal
+ * nvlist function (nvlist_free; see libnvpair(3LIB)) can be used to free the
+ * simple nvlists. Other functions are provided to free the more complex data
+ * structures.
+ *
+ * The following list shows the functions that return allocated memory and the
+ * corresponding function to free the memory:
+ * dm_get_descriptors dm_free_descriptors
+ * dm_get_associated_descriptors dm_free_descriptors
+ * dm_get_descriptor_by_name dm_free_descriptor
+ * dm_get_name dm_free_name
+ * dm_get_attributes nvlist_free
+ * dm_get_stats nvlist_free
+ * dm_get_event nvlist_free
+ *
+ *
+ * EVENTS
+ * ------
+ *
+ * Event information is returned as a nvlist. It may be possible to return more
+ * information about events over time, especially information about what has
+ * changed. However, that may not always be the case, so by using an nvlist we
+ * have a very generic event indication. At a minimum the event will return the
+ * name of the device, the type of device (see dm_desc_type_t) and the type of
+ * event. The event type is a string which can currently be; add, remove,
+ * change.
+ *
+ * If a drive goes up or down this could be returned as event type "change".
+ * The application could get the drive information to see that the "status"
+ * attribute has changed value (ideally the event would include an attribute
+ * with the name of the changed attribute as the value). Although the API can
+ * return events for all drive related changes, events will not necessarily be
+ * delivered for all changes unless the system generates those events.
+ *
+ *
+ * Controller/HBAs
+ * ---------------
+ *
+ * In general the API means "the parent node of the drive in the device tree"
+ * where the word "controller" is used. This can actually be either the HBA or
+ * the drive controller depending on the type of the drive.
+ *
+ * Drives can be connected to their controller(s) in three different ways:
+ * single controller
+ * multiple controllers
+ * multiple controllers with mpxio
+ * These cases will lead to different information being available for the
+ * configuration. The two interesting cases are multi-path with and without
+ * mpxio. With mpxio the drive will have a unique name and a single controller
+ * (scsi_vhci). The physical controllers, the paths to the drive, can be
+ * obtained by calling dm_get_associated_descriptors with a drive descriptor and
+ * a type of DM_PATH. This will only return these physical paths when MPXIO, or
+ * possibly some future similar feature, is controlling the drive.
+ *
+ * Without mpxio the drive does not have a unique public name (in all cases the
+ * alias(es) of the drive can be determined by calling
+ * dm_get_associated_descriptors to get the DM_ALIAS descriptors. There will be
+ * more than one controller returned from dm_get_associated_descriptors when
+ * called with a type of DM_CONTROLLER. The controllers for each of the aliases
+ * will be returned in the same order as the aliases descriptors. For example,
+ * a drive with two paths has the aliases c5t3d2 and c7t1d0. There will be two
+ * controllers returned; the first corresponds to c5 and the second corresponds
+ * to c7.
+ *
+ * In the multi-path, non-mpxio case the drive has more than one alias.
+ * Although most of the drive attributes are represented on the drive (see
+ * dm_get_attributes) there can be some different attributes for the different
+ * aliases for the drive. Use dm_get_associated_descriptors to get the DM_ALIAS
+ * descriptors which can then be used to obtain these attributes. Use of this
+ * algorithm is not restricted to the multi-path, non-mpxio case. For example,
+ * it can be used to get the target/lun for a SCSI drive with a single path.
+ */
+
+/*
* Holds all the data regarding the device.
* Private to libdiskmgt. Must use dm_xxx functions to set/get data.
*/
@@ -50,6 +189,17 @@ typedef enum {
DM_WHO_ZPOOL_SPARE
} dm_who_type_t;
+/*
+ * The API uses a "descriptor" to identify the managed objects such as drives,
+ * controllers, media, slices, partitions, paths and buses. The descriptors are
+ * opaque and are only returned or used as parameters to the other functions in
+ * the API. The descriptor definition is a typedef to dm_descriptor_t.
+ *
+ * Applications call either the dm_get_descriptors or
+ * dm_get_associated_descriptors function to obtain a list of descriptors of a
+ * specific type. The application specifies the desired type from the following
+ * enumeration:
+ */
typedef enum {
DM_DRIVE = 0,
DM_CONTROLLER,
@@ -61,6 +211,31 @@ typedef enum {
DM_BUS
} dm_desc_type_t;
+/*
+ * These descriptors are associated with each other in the following way:
+ *
+ * alias partition
+ * _ \ / |
+ * / \ \ / |
+ * \ / \ / |
+ * bus --- controller --- drive --- media |
+ * | / \ |
+ * | / \ |
+ * | / \ |
+ * path slice
+ *
+ * The dm_get_associated_descriptors function can be used get the descriptors
+ * associated with a given descriptor. The dm_get_associated_types function can
+ * be used to find the types that can be associated with a given type.
+ *
+ * The attributes and values for these objects are described using a list of
+ * name/value pairs (see libnvpair(3LIB) and the specific comments for each
+ * function in the API section of this document).
+ *
+ * Drives and media have a type which are defined as the following enumerations.
+ * There could be additional types added to these enumerations as new drive and
+ * media types are supported by the system.
+ */
typedef enum {
DM_DT_UNKNOWN = 0,
@@ -102,6 +277,11 @@ typedef enum {
#define DM_FILTER_END -1
+/*
+ * The dm_get_stats function takes a stat_type argument for the specific sample
+ * to get for the descriptor. The following enums specify the drive and slice
+ * stat types.
+ */
/* drive stat name */
typedef enum {
DM_DRV_STAT_PERFORMANCE = 0,
@@ -147,6 +327,7 @@ typedef enum {
#define DM_PRODUCT_ID "product_id"
#define DM_REMOVABLE "removable" /* also in media */
#define DM_RPM "rpm"
+#define DM_SOLIDSTATE "solid_state"
#define DM_STATUS "status"
#define DM_SYNC_SPEED "sync_speed"
#define DM_TEMPERATURE "temperature"
diff --git a/usr/src/lib/libdladm/common/libdladm.h b/usr/src/lib/libdladm/common/libdladm.h
index f0811ae5df..1cfb927a41 100644
--- a/usr/src/lib/libdladm/common/libdladm.h
+++ b/usr/src/lib/libdladm/common/libdladm.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#ifndef _LIBDLADM_H
@@ -71,6 +72,10 @@ extern "C" {
* - DLADM_OPT_BOOT:
* Bypass check functions during boot (used by pool property since pools
* can come up after link properties are set)
+ *
+ * - DLADM_OPT_TRANSIENT:
+ * Indicates that the link assigned to a zone is transient and will be
+ * removed when the zone shuts down.
*/
#define DLADM_OPT_ACTIVE 0x00000001
#define DLADM_OPT_PERSIST 0x00000002
@@ -81,6 +86,7 @@ extern "C" {
#define DLADM_OPT_VLAN 0x00000040
#define DLADM_OPT_NOREFRESH 0x00000080
#define DLADM_OPT_BOOT 0x00000100
+#define DLADM_OPT_TRANSIENT 0x00000200
#define DLADM_WALK_TERMINATE 0
#define DLADM_WALK_CONTINUE -1
diff --git a/usr/src/lib/libdladm/common/libdllink.c b/usr/src/lib/libdladm/common/libdllink.c
index 8a3c5759ee..303885e929 100644
--- a/usr/src/lib/libdladm/common/libdllink.c
+++ b/usr/src/lib/libdladm/common/libdllink.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -386,10 +387,14 @@ dladm_linkduplex2str(link_duplex_t duplex, char *buf)
/*
* Case 1: rename an existing link1 to a link2 that does not exist.
* Result: <linkid1, link2>
+ * The zonename parameter is used to allow us to create a VNIC in the global
+ * zone which is assigned to a non-global zone. Since there is a race condition
+ * in the create process if two VNICs have the same name, we need to rename it
+ * after it has been assigned to the zone.
*/
static dladm_status_t
i_dladm_rename_link_c1(dladm_handle_t handle, datalink_id_t linkid1,
- const char *link1, const char *link2, uint32_t flags)
+ const char *link1, const char *link2, uint32_t flags, const char *zonename)
{
dld_ioc_rename_t dir;
dladm_status_t status = DLADM_STATUS_OK;
@@ -402,6 +407,10 @@ i_dladm_rename_link_c1(dladm_handle_t handle, datalink_id_t linkid1,
dir.dir_linkid1 = linkid1;
dir.dir_linkid2 = DATALINK_INVALID_LINKID;
(void) strlcpy(dir.dir_link, link2, MAXLINKNAMELEN);
+ if (zonename != NULL)
+ dir.dir_zoneinit = B_TRUE;
+ else
+ dir.dir_zoneinit = B_FALSE;
if (ioctl(dladm_dld_fd(handle), DLDIOC_RENAME, &dir) < 0) {
status = dladm_errno2status(errno);
@@ -412,6 +421,7 @@ i_dladm_rename_link_c1(dladm_handle_t handle, datalink_id_t linkid1,
status = dladm_remap_datalink_id(handle, linkid1, link2);
if (status != DLADM_STATUS_OK && (flags & DLADM_OPT_ACTIVE)) {
(void) strlcpy(dir.dir_link, link1, MAXLINKNAMELEN);
+ dir.dir_zoneinit = B_FALSE;
(void) ioctl(dladm_dld_fd(handle), DLDIOC_RENAME, &dir);
}
return (status);
@@ -508,6 +518,7 @@ i_dladm_rename_link_c2(dladm_handle_t handle, datalink_id_t linkid1,
*/
dir.dir_linkid1 = linkid1;
dir.dir_linkid2 = linkid2;
+ dir.dir_zoneinit = B_FALSE;
if (ioctl(dladm_dld_fd(handle), DLDIOC_RENAME, &dir) < 0)
status = dladm_errno2status(errno);
@@ -617,7 +628,8 @@ done:
}
dladm_status_t
-dladm_rename_link(dladm_handle_t handle, const char *link1, const char *link2)
+dladm_rename_link(dladm_handle_t handle, const char *zonename,
+ const char *link1, const char *link2)
{
datalink_id_t linkid1 = DATALINK_INVALID_LINKID;
datalink_id_t linkid2 = DATALINK_INVALID_LINKID;
@@ -627,11 +639,11 @@ dladm_rename_link(dladm_handle_t handle, const char *link1, const char *link2)
boolean_t remphy2 = B_FALSE;
dladm_status_t status;
- (void) dladm_name2info(handle, link1, &linkid1, &flags1, &class1,
- &media1);
- if ((dladm_name2info(handle, link2, &linkid2, &flags2, &class2,
- &media2) == DLADM_STATUS_OK) && (class2 == DATALINK_CLASS_PHYS) &&
- (flags2 == DLADM_OPT_PERSIST)) {
+ (void) dladm_zname2info(handle, zonename, link1, &linkid1, &flags1,
+ &class1, &media1);
+ if ((dladm_zname2info(handle, zonename, link2, &linkid2, &flags2,
+ &class2, &media2) == DLADM_STATUS_OK) &&
+ (class2 == DATALINK_CLASS_PHYS) && (flags2 == DLADM_OPT_PERSIST)) {
/*
* see whether link2 is a removed physical link.
*/
@@ -645,7 +657,7 @@ dladm_rename_link(dladm_handle_t handle, const char *link1, const char *link2)
* does not exist.
*/
status = i_dladm_rename_link_c1(handle, linkid1, link1,
- link2, flags1);
+ link2, flags1, zonename);
} else if (remphy2) {
/*
* case 2: rename an available link to a REMOVED
diff --git a/usr/src/lib/libdladm/common/libdllink.h b/usr/src/lib/libdladm/common/libdllink.h
index a2830b5e37..a858e78aa3 100644
--- a/usr/src/lib/libdladm/common/libdllink.h
+++ b/usr/src/lib/libdladm/common/libdllink.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#ifndef _LIBDLLINK_H
@@ -121,7 +122,7 @@ extern dladm_status_t dladm_info(dladm_handle_t, datalink_id_t,
dladm_attr_t *);
extern dladm_status_t dladm_rename_link(dladm_handle_t, const char *,
- const char *);
+ const char *, const char *);
extern dladm_status_t dladm_set_linkprop(dladm_handle_t, datalink_id_t,
const char *, char **, uint_t, uint_t);
@@ -170,6 +171,9 @@ extern dladm_status_t dladm_up_datalink_id(dladm_handle_t, datalink_id_t);
extern dladm_status_t dladm_name2info(dladm_handle_t, const char *,
datalink_id_t *, uint32_t *, datalink_class_t *,
uint32_t *);
+extern dladm_status_t dladm_zname2info(dladm_handle_t, const char *,
+ const char *, datalink_id_t *, uint32_t *,
+ datalink_class_t *, uint32_t *);
extern dladm_status_t dladm_datalink_id2info(dladm_handle_t, datalink_id_t,
uint32_t *, datalink_class_t *, uint32_t *, char *,
size_t);
diff --git a/usr/src/lib/libdladm/common/libdlmgmt.c b/usr/src/lib/libdladm/common/libdlmgmt.c
index 4b0753417c..c9c7906934 100644
--- a/usr/src/lib/libdladm/common/libdlmgmt.c
+++ b/usr/src/lib/libdladm/common/libdlmgmt.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#include <door.h>
@@ -528,12 +529,24 @@ dladm_getnext_conf_linkprop(dladm_handle_t handle, dladm_conf_t conf,
}
/*
- * Get the link ID that is associated with the given name.
+ * Get the link ID that is associated with the given name in the current zone.
*/
dladm_status_t
dladm_name2info(dladm_handle_t handle, const char *link, datalink_id_t *linkidp,
uint32_t *flagp, datalink_class_t *classp, uint32_t *mediap)
{
+ return (dladm_zname2info(handle, NULL, link, linkidp, flagp, classp,
+ mediap));
+}
+
+/*
+ * Get the link ID that is associated with the given zone/name pair.
+ */
+dladm_status_t
+dladm_zname2info(dladm_handle_t handle, const char *zonename, const char *link,
+ datalink_id_t *linkidp, uint32_t *flagp, datalink_class_t *classp,
+ uint32_t *mediap)
+{
dlmgmt_door_getlinkid_t getlinkid;
dlmgmt_getlinkid_retval_t retval;
datalink_id_t linkid;
@@ -542,6 +555,10 @@ dladm_name2info(dladm_handle_t handle, const char *link, datalink_id_t *linkidp,
getlinkid.ld_cmd = DLMGMT_CMD_GETLINKID;
(void) strlcpy(getlinkid.ld_link, link, MAXLINKNAMELEN);
+ if (zonename != NULL)
+ getlinkid.ld_zoneid = getzoneidbyname(zonename);
+ else
+ getlinkid.ld_zoneid = -1;
if ((status = dladm_door_call(handle, &getlinkid, sizeof (getlinkid),
&retval, &sz)) != DLADM_STATUS_OK) {
diff --git a/usr/src/lib/libdladm/common/libdlvnic.c b/usr/src/lib/libdladm/common/libdlvnic.c
index 6dba8d6fad..1a866dcb06 100644
--- a/usr/src/lib/libdladm/common/libdlvnic.c
+++ b/usr/src/lib/libdladm/common/libdlvnic.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#include <stdio.h>
@@ -537,27 +538,35 @@ dladm_vnic_create(dladm_handle_t handle, const char *vnic, datalink_id_t linkid,
vnic_created = B_TRUE;
/* Save vnic configuration and its properties */
- if (!(flags & DLADM_OPT_PERSIST))
- goto done;
+ if (flags & DLADM_OPT_PERSIST) {
+ status = dladm_vnic_persist_conf(handle, name, &attr, class);
+ if (status == DLADM_STATUS_OK)
+ conf_set = B_TRUE;
+ }
- status = dladm_vnic_persist_conf(handle, name, &attr, class);
- if (status != DLADM_STATUS_OK)
- goto done;
- conf_set = B_TRUE;
+done:
+ if (status == DLADM_STATUS_OK && proplist != NULL) {
+ uint32_t flg;
+
+ flg = (flags & DLADM_OPT_PERSIST) ?
+ DLADM_OPT_PERSIST : DLADM_OPT_ACTIVE;
- if (proplist != NULL) {
for (i = 0; i < proplist->al_count; i++) {
dladm_arg_info_t *aip = &proplist->al_info[i];
+ if (strcmp(aip->ai_name, "zone") == 0 &&
+ flags & DLADM_OPT_TRANSIENT)
+ flg |= DLADM_OPT_TRANSIENT;
+ else
+ flg &= ~DLADM_OPT_TRANSIENT;
+
status = dladm_set_linkprop(handle, vnic_id,
- aip->ai_name, aip->ai_val, aip->ai_count,
- DLADM_OPT_PERSIST);
+ aip->ai_name, aip->ai_val, aip->ai_count, flg);
if (status != DLADM_STATUS_OK)
break;
}
}
-done:
if (status != DLADM_STATUS_OK) {
if (conf_set)
(void) dladm_remove_conf(handle, vnic_id);
diff --git a/usr/src/lib/libdladm/common/linkprop.c b/usr/src/lib/libdladm/common/linkprop.c
index 229a5fd83f..d46054e686 100644
--- a/usr/src/lib/libdladm/common/linkprop.c
+++ b/usr/src/lib/libdladm/common/linkprop.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <stdlib.h>
@@ -151,11 +152,13 @@ static pd_getf_t get_zone, get_autopush, get_rate_mod, get_rate,
get_bridge_pvid, get_protection, get_rxrings,
get_txrings, get_cntavail,
get_allowedips, get_allowedcids, get_pool,
- get_rings_range, get_linkmode_prop;
+ get_rings_range, get_linkmode_prop,
+ get_promisc_filtered;
static pd_setf_t set_zone, set_rate, set_powermode, set_radio,
set_public_prop, set_resource, set_stp_prop,
- set_bridge_forward, set_bridge_pvid;
+ set_bridge_forward, set_bridge_pvid,
+ set_promisc_filtered;
static pd_checkf_t check_zone, check_autopush, check_rate, check_hoplimit,
check_encaplim, check_uint32, check_maxbw, check_cpus,
@@ -363,6 +366,8 @@ static link_attr_t link_attr[] = {
{ MAC_PROP_IB_LINKMODE, sizeof (uint32_t), "linkmode"},
+ { MAC_PROP_VN_PROMISC_FILTERED, sizeof (boolean_t), "promisc-filtered"},
+
{ MAC_PROP_PRIVATE, 0, "driver-private"}
};
@@ -417,6 +422,11 @@ static val_desc_t link_protect_vals[] = {
{ "dhcp-nospoof", MPT_DHCPNOSPOOF },
};
+static val_desc_t link_promisc_filtered_vals[] = {
+ { "off", B_FALSE },
+ { "on", B_TRUE },
+};
+
static val_desc_t dladm_wlan_radio_vals[] = {
{ "on", DLADM_WLAN_RADIO_ON },
{ "off", DLADM_WLAN_RADIO_OFF }
@@ -682,6 +692,12 @@ static prop_desc_t prop_table[] = {
set_resource, NULL, get_protection, check_prop, 0,
DATALINK_CLASS_ALL, DATALINK_ANY_MEDIATYPE },
+ { "promisc-filtered", { "on", 1 },
+ link_promisc_filtered_vals, VALCNT(link_promisc_filtered_vals),
+ set_promisc_filtered, NULL, get_promisc_filtered, check_prop, 0,
+ DATALINK_CLASS_VNIC, DATALINK_ANY_MEDIATYPE },
+
+
{ "allowed-ips", { "--", 0 },
NULL, 0, set_resource, NULL,
get_allowedips, check_allowedips, PD_CHECK_ALLOC,
@@ -1513,6 +1529,9 @@ set_zone(dladm_handle_t handle, prop_desc_t *pdp, datalink_id_t linkid,
if (zid_new == zid_old)
return (DLADM_STATUS_OK);
+ if (flags & DLADM_OPT_TRANSIENT)
+ dzp->diz_transient = B_TRUE;
+
if ((status = set_public_prop(handle, pdp, linkid, vdp, val_cnt,
flags, media)) != DLADM_STATUS_OK)
return (status);
@@ -4583,3 +4602,50 @@ get_linkmode_prop(dladm_handle_t handle, prop_desc_t *pdp,
*val_cnt = 1;
return (DLADM_STATUS_OK);
}
+
+/*ARGSUSED*/
+static dladm_status_t
+get_promisc_filtered(dladm_handle_t handle, prop_desc_t *pdp,
+ datalink_id_t linkid, char **prop_val, uint_t *val_cnt,
+ datalink_media_t media, uint_t flags, uint_t *perm_flags)
+{
+ char *s;
+ dladm_status_t status;
+ boolean_t filt;
+
+ status = i_dladm_get_public_prop(handle, linkid, pdp->pd_name, flags,
+ perm_flags, &filt, sizeof (filt));
+ if (status != DLADM_STATUS_OK)
+ return (status);
+
+ if (filt != 0)
+ s = link_promisc_filtered_vals[1].vd_name;
+ else
+ s = link_promisc_filtered_vals[0].vd_name;
+ (void) snprintf(prop_val[0], DLADM_STRSIZE, "%s", s);
+
+ *val_cnt = 1;
+ return (DLADM_STATUS_OK);
+}
+
+/* ARGSUSED */
+static dladm_status_t
+set_promisc_filtered(dladm_handle_t handle, prop_desc_t *pdp,
+ datalink_id_t linkid, val_desc_t *vdp, uint_t val_cnt, uint_t flags,
+ datalink_media_t media)
+{
+ dld_ioc_macprop_t *dip;
+ dladm_status_t status = DLADM_STATUS_OK;
+
+ dip = i_dladm_buf_alloc_by_name(0, linkid, pdp->pd_name,
+ 0, &status);
+
+ if (dip == NULL)
+ return (status);
+
+ (void) memcpy(dip->pr_val, &vdp->vd_val, dip->pr_valsize);
+ status = i_dladm_macprop(handle, dip, B_TRUE);
+
+ free(dip);
+ return (status);
+}
diff --git a/usr/src/lib/libdladm/common/mapfile-vers b/usr/src/lib/libdladm/common/mapfile-vers
index b781c93aff..3eaeea656e 100644
--- a/usr/src/lib/libdladm/common/mapfile-vers
+++ b/usr/src/lib/libdladm/common/mapfile-vers
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, Joyent Inc. All rights reserved.
#
#
@@ -134,6 +135,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
dladm_remap_datalink_id;
dladm_up_datalink_id;
dladm_name2info;
+ dladm_zname2info;
dladm_datalink_id2info;
dladm_walk_datalink_id;
dladm_create_conf;
diff --git a/usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDRecordRegistrar.java b/usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDRecordRegistrar.java
index 366d83476b..6983e279fa 100644
--- a/usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDRecordRegistrar.java
+++ b/usr/src/lib/libdns_sd/java/com/apple/dnssd/DNSSDRecordRegistrar.java
@@ -5,9 +5,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,9 +25,6 @@ Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
Revision 1.1 2006/06/20 23:00:12 rpantos
<rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
-
-ident "%Z%%M% %I% %E% SMI"
-
*/
@@ -38,7 +35,7 @@ package com.apple.dnssd;
public interface DNSSDRecordRegistrar extends DNSSDService
{
- /** Register an independent {@link DNSRecord}.<P>
+ /** Register an independent {@link DNSRecord}.<P>
@param flags
Possible values are SHARED or UNIQUE (see flag type definitions for details).
<P>
@@ -55,25 +52,22 @@ public interface DNSSDRecordRegistrar extends DNSSDService
as defined in nameser.h.
<P>
@param rrclass
- The class of the resource record, as defined in nameser.h
+ The class of the resource record, as defined in nameser.h
(usually 1 for the Internet class).
<P>
- @param rData
+ @param rdata
The new rdata as it is to appear in the DNS record.
<P>
@param ttl
The time to live of the resource record, in seconds. Pass 0 to use a default value.
<P>
- @param listener
- This object will get called when the service is registered.
- <P>
@return A {@link DNSSDService} that can be used to abort the record registration.
@throws SecurityException If a security manager is present and denies <tt>RuntimePermission("getDNSSDInstance")</tt>.
@see RuntimePermission
*/
- public DNSRecord registerRecord( int flags, int ifIndex, String fullname, int rrtype,
+ public DNSRecord registerRecord( int flags, int ifIndex, String fullname, int rrtype,
int rrclass, byte[] rdata, int ttl)
throws DNSSDException;
-}
+}
diff --git a/usr/src/lib/libdtrace/Makefile.com b/usr/src/lib/libdtrace/Makefile.com
index 8952f8db06..d92d33dff7 100644
--- a/usr/src/lib/libdtrace/Makefile.com
+++ b/usr/src/lib/libdtrace/Makefile.com
@@ -131,7 +131,7 @@ CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-switch
YYCFLAGS =
-LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc
+LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc -lzonecfg
DRTILDLIBS = $(LDLIBS.lib) -lc
yydebug := YYCFLAGS += -DYYDEBUG
diff --git a/usr/src/lib/libdtrace/common/dt_cc.c b/usr/src/lib/libdtrace/common/dt_cc.c
index 9661ad9d0b..f4b0509b4a 100644
--- a/usr/src/lib/libdtrace/common/dt_cc.c
+++ b/usr/src/lib/libdtrace/common/dt_cc.c
@@ -2149,7 +2149,7 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path)
(void) snprintf(fname, sizeof (fname),
"%s/%s", path, dp->d_name);
- if ((fp = fopen(fname, "r")) == NULL) {
+ if ((fp = fopen(fname, "rF")) == NULL) {
dt_dprintf("skipping library %s: %s\n",
fname, strerror(errno));
continue;
@@ -2171,12 +2171,15 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path)
dt_dprintf("skipping library %s, already processed "
"library with the same name: %s", dp->d_name,
dld->dtld_library);
+ (void) fclose(fp);
continue;
}
dtp->dt_filetag = fname;
- if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0)
+ if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) {
+ (void) fclose(fp);
return (-1); /* preserve dt_errno */
+ }
rv = dt_compile(dtp, DT_CTX_DPROG,
DTRACE_PROBESPEC_NAME, NULL,
@@ -2184,8 +2187,10 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path)
if (rv != NULL && dtp->dt_errno &&
(dtp->dt_errno != EDT_COMPILER ||
- dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND)))
+ dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) {
+ (void) fclose(fp);
return (-1); /* preserve dt_errno */
+ }
if (dtp->dt_errno)
dt_dprintf("error parsing library %s: %s\n",
diff --git a/usr/src/lib/libdtrace/common/dt_cg.c b/usr/src/lib/libdtrace/common/dt_cg.c
index 3103106d27..28db9b2262 100644
--- a/usr/src/lib/libdtrace/common/dt_cg.c
+++ b/usr/src/lib/libdtrace/common/dt_cg.c
@@ -476,7 +476,7 @@ dt_cg_typecast(const dt_node_t *src, const dt_node_t *dst,
if (!dt_node_is_scalar(dst))
return; /* not a scalar */
if (dstsize == srcsize &&
- ((src->dn_flags ^ dst->dn_flags) & DT_NF_SIGNED) != 0)
+ ((src->dn_flags ^ dst->dn_flags) & DT_NF_SIGNED) == 0)
return; /* not narrowing or changing signed-ness */
if (dstsize > srcsize && (src->dn_flags & DT_NF_SIGNED) == 0)
return; /* nothing to do in this case */
diff --git a/usr/src/lib/libdtrace/common/dt_dof.c b/usr/src/lib/libdtrace/common/dt_dof.c
index 04c4c89cdb..c1f5dc827e 100644
--- a/usr/src/lib/libdtrace/common/dt_dof.c
+++ b/usr/src/lib/libdtrace/common/dt_dof.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -482,7 +483,7 @@ dof_add_probe(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
return (0);
}
-static void
+static int
dof_add_provider(dt_dof_t *ddo, const dt_provider_t *pvp)
{
dtrace_hdl_t *dtp = ddo->ddo_hdl;
@@ -493,8 +494,12 @@ dof_add_provider(dt_dof_t *ddo, const dt_provider_t *pvp)
size_t sz;
id_t i;
- if (pvp->pv_flags & DT_PROVIDER_IMPL)
- return; /* ignore providers that are exported by dtrace(7D) */
+ if (pvp->pv_flags & DT_PROVIDER_IMPL) {
+ /*
+ * ignore providers that are exported by dtrace(7D)
+ */
+ return (0);
+ }
nxr = dt_popcb(pvp->pv_xrefs, pvp->pv_xrmax);
dofs = alloca(sizeof (dof_secidx_t) * (nxr + 1));
@@ -521,6 +526,9 @@ dof_add_provider(dt_dof_t *ddo, const dt_provider_t *pvp)
(void) dt_idhash_iter(pvp->pv_probes, dof_add_probe, ddo);
+ if (dt_buf_len(&ddo->ddo_probes) == 0)
+ return (dt_set_errno(dtp, EDT_NOPROBES));
+
dofpv.dofpv_probes = dof_add_lsect(ddo, NULL, DOF_SECT_PROBES,
sizeof (uint64_t), 0, sizeof (dof_probe_t),
dt_buf_len(&ddo->ddo_probes));
@@ -575,6 +583,8 @@ dof_add_provider(dt_dof_t *ddo, const dt_provider_t *pvp)
sizeof (dof_secidx_t), 0, sizeof (dof_secidx_t),
sizeof (dof_secidx_t) * (nxr + 1));
}
+
+ return (0);
}
static int
@@ -818,8 +828,10 @@ dtrace_dof_create(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t flags)
*/
if (flags & DTRACE_D_PROBES) {
for (pvp = dt_list_next(&dtp->dt_provlist);
- pvp != NULL; pvp = dt_list_next(pvp))
- dof_add_provider(ddo, pvp);
+ pvp != NULL; pvp = dt_list_next(pvp)) {
+ if (dof_add_provider(ddo, pvp) != 0)
+ return (NULL);
+ }
}
/*
diff --git a/usr/src/lib/libdtrace/common/dt_error.c b/usr/src/lib/libdtrace/common/dt_error.c
index 9c1cbd73bc..f7ad28ebae 100644
--- a/usr/src/lib/libdtrace/common/dt_error.c
+++ b/usr/src/lib/libdtrace/common/dt_error.c
@@ -26,6 +26,7 @@
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <strings.h>
@@ -108,7 +109,8 @@ static const struct {
{ EDT_BADSTACKPC, "Invalid stack program counter size" },
{ EDT_BADAGGVAR, "Invalid aggregation variable identifier" },
{ EDT_OVERSION, "Client requested deprecated version of library" },
- { EDT_ENABLING_ERR, "Failed to enable probe" }
+ { EDT_ENABLING_ERR, "Failed to enable probe" },
+ { EDT_NOPROBES, "No probe sites found for declared provider" }
};
static const int _dt_nerr = sizeof (_dt_errlist) / sizeof (_dt_errlist[0]);
diff --git a/usr/src/lib/libdtrace/common/dt_impl.h b/usr/src/lib/libdtrace/common/dt_impl.h
index fa4c66540d..6420524701 100644
--- a/usr/src/lib/libdtrace/common/dt_impl.h
+++ b/usr/src/lib/libdtrace/common/dt_impl.h
@@ -25,7 +25,7 @@
*/
/*
- * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -260,6 +260,7 @@ struct dtrace_hdl {
uint_t dt_droptags; /* boolean: set via -xdroptags */
uint_t dt_active; /* boolean: set once tracing is active */
uint_t dt_stopped; /* boolean: set once tracing is stopped */
+ uint_t dt_optset; /* boolean: set once options have been set */
processorid_t dt_beganon; /* CPU that executed BEGIN probe (if any) */
processorid_t dt_endedon; /* CPU that executed END probe (if any) */
uint_t dt_oflags; /* dtrace open-time options (see dtrace.h) */
@@ -512,7 +513,8 @@ enum {
EDT_BADSTACKPC, /* invalid stack program counter size */
EDT_BADAGGVAR, /* invalid aggregation variable identifier */
EDT_OVERSION, /* client is requesting deprecated version */
- EDT_ENABLING_ERR /* failed to enable probe */
+ EDT_ENABLING_ERR, /* failed to enable probe */
+ EDT_NOPROBES /* no probes sites for declared provider */
};
/*
diff --git a/usr/src/lib/libdtrace/common/dt_open.c b/usr/src/lib/libdtrace/common/dt_open.c
index dd83370ee8..af3bc17b2c 100644
--- a/usr/src/lib/libdtrace/common/dt_open.c
+++ b/usr/src/lib/libdtrace/common/dt_open.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -110,9 +110,10 @@
#define DT_VERS_1_8 DT_VERSION_NUMBER(1, 8, 0)
#define DT_VERS_1_8_1 DT_VERSION_NUMBER(1, 8, 1)
#define DT_VERS_1_9 DT_VERSION_NUMBER(1, 9, 0)
-#define DT_VERS_1_9_1 DT_VERSION_NUMBER(1, 9, 1)
-#define DT_VERS_LATEST DT_VERS_1_9_1
-#define DT_VERS_STRING "Sun D 1.9.1"
+#define DT_VERS_1_10 DT_VERSION_NUMBER(1, 10, 0)
+#define DT_VERS_1_11 DT_VERSION_NUMBER(1, 11, 0)
+#define DT_VERS_LATEST DT_VERS_1_11
+#define DT_VERS_STRING "Sun D 1.11"
const dt_version_t _dtrace_versions[] = {
DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */
@@ -133,7 +134,8 @@ const dt_version_t _dtrace_versions[] = {
DT_VERS_1_8, /* D API 1.8 */
DT_VERS_1_8_1, /* D API 1.8.1 */
DT_VERS_1_9, /* D API 1.9 */
- DT_VERS_1_9_1, /* D API 1.9.1 */
+ DT_VERS_1_10, /* D API 1.10 */
+ DT_VERS_1_11, /* D API 1.11 */
0
};
@@ -247,6 +249,8 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "uint64_t(uint64_t)" },
{ "htons", DT_IDENT_FUNC, 0, DIF_SUBR_HTONS, DT_ATTR_EVOLCMN, DT_VERS_1_3,
&dt_idops_func, "uint16_t(uint16_t)" },
+{ "getf", DT_IDENT_FUNC, 0, DIF_SUBR_GETF, DT_ATTR_STABCMN, DT_VERS_1_10,
+ &dt_idops_func, "file_t *(int)" },
{ "gid", DT_IDENT_SCALAR, 0, DIF_VAR_GID, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "gid_t" },
{ "id", DT_IDENT_SCALAR, 0, DIF_VAR_ID, DT_ATTR_STABCMN, DT_VERS_1_0,
@@ -261,6 +265,8 @@ static const dt_ident_t _dtrace_globals[] = {
DT_VERS_1_5, &dt_idops_func, "string(int, void *)" },
{ "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "uint_t" },
+{ "json", DT_IDENT_FUNC, 0, DIF_SUBR_JSON, DT_ATTR_STABCMN, DT_VERS_1_11,
+ &dt_idops_func, "string(const char *, const char *)" },
{ "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "stack(...)" },
{ "lltostr", DT_IDENT_FUNC, 0, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
@@ -375,6 +381,8 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "string(const char *, const char *)" },
{ "strtok", DT_IDENT_FUNC, 0, DIF_SUBR_STRTOK, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "string(const char *, const char *)" },
+{ "strtoll", DT_IDENT_FUNC, 0, DIF_SUBR_STRTOLL, DT_ATTR_STABCMN, DT_VERS_1_11,
+ &dt_idops_func, "int64_t(const char *, [int])" },
{ "substr", DT_IDENT_FUNC, 0, DIF_SUBR_SUBSTR, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "string(const char *, int, [int])" },
{ "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0,
diff --git a/usr/src/lib/libdtrace/common/dt_options.c b/usr/src/lib/libdtrace/common/dt_options.c
index cc3ae7b9d3..71bd508ecd 100644
--- a/usr/src/lib/libdtrace/common/dt_options.c
+++ b/usr/src/lib/libdtrace/common/dt_options.c
@@ -25,6 +25,7 @@
*/
/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -40,6 +41,8 @@
#include <alloca.h>
#include <errno.h>
#include <fcntl.h>
+#include <zone.h>
+#include <libzonecfg.h>
#include <dt_impl.h>
#include <dt_string.h>
@@ -836,6 +839,44 @@ dt_opt_bufresize(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
return (0);
}
+/*ARGSUSED*/
+static int
+dt_opt_zone(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+ zoneid_t z, did;
+
+ if (arg == NULL)
+ return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+ /*
+ * If the specified zone is currently running, we'll query the kernel
+ * for its debugger ID. If it doesn't appear to be running, we'll look
+ * for it for among all installed zones (thereby allowing a zdefs
+ * enabling against a halted zone).
+ */
+ if ((z = getzoneidbyname(arg)) != -1) {
+ if (zone_getattr(z, ZONE_ATTR_DID, &did, sizeof (did)) < 0)
+ return (dt_set_errno(dtp, EDT_BADOPTVAL));
+ } else {
+ zone_dochandle_t handle;
+
+ if ((handle = zonecfg_init_handle()) == NULL)
+ return (dt_set_errno(dtp, errno));
+
+ if (zonecfg_get_handle(arg, handle) != Z_OK) {
+ zonecfg_fini_handle(handle);
+ return (dt_set_errno(dtp, EDT_BADOPTVAL));
+ }
+
+ did = zonecfg_get_did(handle);
+ zonecfg_fini_handle(handle);
+ }
+
+ dtp->dt_options[DTRACEOPT_ZONE] = did;
+
+ return (0);
+}
+
int
dt_options_load(dtrace_hdl_t *dtp)
{
@@ -969,6 +1010,7 @@ static const dt_option_t _dtrace_rtoptions[] = {
{ "statusrate", dt_opt_rate, DTRACEOPT_STATUSRATE },
{ "strsize", dt_opt_strsize, DTRACEOPT_STRSIZE },
{ "ustackframes", dt_opt_runtime, DTRACEOPT_USTACKFRAMES },
+ { "zone", dt_opt_zone, DTRACEOPT_ZONE },
{ "temporal", dt_opt_runtime, DTRACEOPT_TEMPORAL },
{ NULL }
};
@@ -1046,9 +1088,41 @@ dtrace_setopt(dtrace_hdl_t *dtp, const char *opt, const char *val)
if (dtp->dt_active)
return (dt_set_errno(dtp, EDT_ACTIVE));
+ /*
+ * If our options had been previously ioctl'd down,
+ * clear dt_optset to indicate that a run-time option
+ * has since been set.
+ */
+ dtp->dt_optset = B_FALSE;
+
return (op->o_func(dtp, val, op->o_option));
}
}
return (dt_set_errno(dtp, EDT_BADOPTNAME));
}
+
+int
+dtrace_setopts(dtrace_hdl_t *dtp)
+{
+ void *dof;
+ int err;
+
+ if (dtp->dt_optset)
+ return (0);
+
+ if ((dof = dtrace_getopt_dof(dtp)) == NULL)
+ return (-1); /* dt_errno has been set for us */
+
+ if ((err = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof)) == -1)
+ (void) dt_set_errno(dtp, errno);
+
+ dtrace_dof_destroy(dtp, dof);
+
+ if (err == -1)
+ return (-1);
+
+ dtp->dt_optset = B_TRUE;
+
+ return (0);
+}
diff --git a/usr/src/lib/libdtrace/common/dt_program.c b/usr/src/lib/libdtrace/common/dt_program.c
index 7d725bd0af..e4f9d8dd1c 100644
--- a/usr/src/lib/libdtrace/common/dt_program.c
+++ b/usr/src/lib/libdtrace/common/dt_program.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
*/
@@ -154,6 +155,14 @@ dtrace_program_exec(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
void *dof;
int n, err;
+ /*
+ * If we have not yet ioctl'd down our options DOF, we'll do that
+ * before enabling any probes (some options will affect which probes
+ * we match).
+ */
+ if (dtrace_setopts(dtp) != 0)
+ return (-1);
+
dtrace_program_info(dtp, pgp, pip);
if ((dof = dtrace_dof_create(dtp, pgp, DTRACE_D_STRIP)) == NULL)
diff --git a/usr/src/lib/libdtrace/common/dt_work.c b/usr/src/lib/libdtrace/common/dt_work.c
index 97a7f62d69..c330394027 100644
--- a/usr/src/lib/libdtrace/common/dt_work.c
+++ b/usr/src/lib/libdtrace/common/dt_work.c
@@ -25,7 +25,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
#include <dt_impl.h>
#include <stddef.h>
@@ -164,13 +166,22 @@ dtrace_status(dtrace_hdl_t *dtp)
int
dtrace_go(dtrace_hdl_t *dtp)
{
- void *dof;
- int err;
-
if (dtp->dt_active)
return (dt_set_errno(dtp, EINVAL));
/*
+ * In most cases, we will have already ioctl'd down our options DOF
+ * by this point -- but if a libdtrace does a dtrace_setopt() after
+ * calling dtrace_program_exec() but before calling dtrace_go(),
+ * dt_optset will be cleared and we need to ioctl down the options
+ * DOF now.
+ */
+ if (dtrace_setopts(dtp) != 0 &&
+ (dtp->dt_errno != ENOTTY || dtp->dt_vector == NULL)) {
+ return (-1);
+ }
+
+ /*
* If a dtrace:::ERROR program and callback are registered, enable the
* program before we start tracing. If this fails for a vector open
* with ENOTTY, we permit dtrace_go() to succeed so that vector clients
@@ -178,19 +189,10 @@ dtrace_go(dtrace_hdl_t *dtp)
* though they do not provide support for the DTRACEIOC_ENABLE ioctl.
*/
if (dtp->dt_errprog != NULL &&
- dtrace_program_exec(dtp, dtp->dt_errprog, NULL) == -1 && (
- dtp->dt_errno != ENOTTY || dtp->dt_vector == NULL))
- return (-1); /* dt_errno has been set for us */
-
- if ((dof = dtrace_getopt_dof(dtp)) == NULL)
+ dtrace_program_exec(dtp, dtp->dt_errprog, NULL) == -1 &&
+ (dtp->dt_errno != ENOTTY || dtp->dt_vector == NULL))
return (-1); /* dt_errno has been set for us */
- err = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
- dtrace_dof_destroy(dtp, dof);
-
- if (err == -1 && (errno != ENOTTY || dtp->dt_vector == NULL))
- return (dt_set_errno(dtp, errno));
-
if (dt_ioctl(dtp, DTRACEIOC_GO, &dtp->dt_beganon) == -1) {
if (errno == EACCES)
return (dt_set_errno(dtp, EDT_DESTRUCTIVE));
diff --git a/usr/src/lib/libdtrace/common/dtrace.h b/usr/src/lib/libdtrace/common/dtrace.h
index 87df1ca440..d3031d8c4c 100644
--- a/usr/src/lib/libdtrace/common/dtrace.h
+++ b/usr/src/lib/libdtrace/common/dtrace.h
@@ -81,6 +81,7 @@ extern const char *dtrace_subrstr(dtrace_hdl_t *, int);
extern int dtrace_setopt(dtrace_hdl_t *, const char *, const char *);
extern int dtrace_getopt(dtrace_hdl_t *, const char *, dtrace_optval_t *);
+extern int dtrace_setopts(dtrace_hdl_t *);
extern void dtrace_update(dtrace_hdl_t *);
extern int dtrace_ctlfd(dtrace_hdl_t *);
diff --git a/usr/src/lib/libdtrace/common/io.d.in b/usr/src/lib/libdtrace/common/io.d.in
index cb1e32cffe..5f676b9546 100644
--- a/usr/src/lib/libdtrace/common/io.d.in
+++ b/usr/src/lib/libdtrace/common/io.d.in
@@ -23,7 +23,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#pragma D depends_on module unix
#pragma D depends_on provider io
@@ -197,9 +199,7 @@ translator fileinfo_t < struct file *F > {
fi_oflags = F == NULL ? 0 : F->f_flag + (int)@FOPEN@;
};
-inline fileinfo_t fds[int fd] = xlate <fileinfo_t> (
- fd >= 0 && fd < curthread->t_procp->p_user.u_finfo.fi_nfiles ?
- curthread->t_procp->p_user.u_finfo.fi_list[fd].uf_file : NULL);
+inline fileinfo_t fds[int fd] = xlate <fileinfo_t> (getf(fd));
#pragma D attributes Stable/Stable/Common fds
#pragma D binding "1.1" fds
diff --git a/usr/src/lib/libgrubmgmt/common/libgrub_fs.c b/usr/src/lib/libgrubmgmt/common/libgrub_fs.c
index 51f7cc0e17..db1576b828 100644
--- a/usr/src/lib/libgrubmgmt/common/libgrub_fs.c
+++ b/usr/src/lib/libgrubmgmt/common/libgrub_fs.c
@@ -21,6 +21,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
/*
@@ -129,7 +131,8 @@ get_zfs_root(zfs_handle_t *zfh, grub_fs_t *fs, grub_root_t *root)
sizeof (root->gr_physpath))) == 0 &&
(ret = zpool_get_prop(zph, ZPOOL_PROP_BOOTFS,
root->gr_fs[GRBM_ZFS_BOOTFS].gfs_dev,
- sizeof (root->gr_fs[GRBM_ZFS_BOOTFS].gfs_dev), NULL)) == 0) {
+ sizeof (root->gr_fs[GRBM_ZFS_BOOTFS].gfs_dev), NULL,
+ B_FALSE)) == 0) {
(void) strlcpy(root->gr_fs[GRBM_ZFS_TOPFS].gfs_dev, name,
sizeof (root->gr_fs[GRBM_ZFS_TOPFS].gfs_dev));
diff --git a/usr/src/lib/libipd/Makefile b/usr/src/lib/libipd/Makefile
new file mode 100644
index 0000000000..feab972218
--- /dev/null
+++ b/usr/src/lib/libipd/Makefile
@@ -0,0 +1,42 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2012 Joyent, Inc. All rights reserved.
+#
+
+include ../Makefile.lib
+
+HDRS = libipd.h
+HDRDIR = common
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET = all
+clean := TARGET = clean
+clobber := TARGET = clobber
+install := TARGET = install
+lint := TARGET = lint
+
+.KEEP_STATE:
+
+all clean clobber install lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+check: $(CHECKHDRS)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/libipd/Makefile.com b/usr/src/lib/libipd/Makefile.com
new file mode 100644
index 0000000000..f118aa6cc3
--- /dev/null
+++ b/usr/src/lib/libipd/Makefile.com
@@ -0,0 +1,36 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2012 Joyent, Inc. All rights reserved.
+#
+
+include ../../Makefile.lib
+
+LIBRARY = libipd.a
+VERS = .1
+OBJECTS = libipd.o
+
+include ../../Makefile.lib
+
+LIBS = $(DYNLIB) $(LINTLIB)
+LDLIBS += -lc
+CPPFLAGS += -I../common
+
+SRCDIR = ../common
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: lintcheck
+
+include ../../Makefile.targ
diff --git a/usr/src/lib/libipd/amd64/Makefile b/usr/src/lib/libipd/amd64/Makefile
new file mode 100644
index 0000000000..0ff7206916
--- /dev/null
+++ b/usr/src/lib/libipd/amd64/Makefile
@@ -0,0 +1,19 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2012 Joyent, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/usr/src/lib/libipd/common/libipd.c b/usr/src/lib/libipd/common/libipd.c
new file mode 100644
index 0000000000..c580fdf61e
--- /dev/null
+++ b/usr/src/lib/libipd/common/libipd.c
@@ -0,0 +1,303 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdarg.h>
+
+#include <libipd.h>
+#include <sys/ipd.h>
+
+__thread ipd_errno_t ipd_errno = 0;
+__thread char ipd_errmsg[512];
+
+struct ipd_stat {
+ uint_t is_nzones;
+ zoneid_t *is_zoneids;
+ struct ipd_config *is_configs;
+};
+
+static ipd_errno_t
+xlate_errno(int e)
+{
+ switch (e) {
+ case 0:
+ return (EIPD_NOERROR);
+ case ENOMEM:
+ case EAGAIN:
+ return (EIPD_NOMEM);
+ case ERANGE:
+ return (EIPD_RANGE);
+ case EPERM:
+ return (EIPD_PERM);
+ case EFAULT:
+ return (EIPD_FAULT);
+ case ENOTTY:
+ return (EIPD_INTERNAL);
+ default:
+ return (EIPD_UNKNOWN);
+ }
+}
+
+const char *
+ipd_strerror(ipd_errno_t e)
+{
+ switch (e) {
+ case EIPD_NOERROR:
+ return ("no error");
+ case EIPD_NOMEM:
+ return ("out of memory");
+ case EIPD_ZC_NOENT:
+ return ("zone does not exist or is not using ipd");
+ case EIPD_RANGE:
+ return ("argument out of range");
+ case EIPD_PERM:
+ return ("permission denied");
+ case EIPD_FAULT:
+ return ("bad pointer");
+ case EIPD_INTERNAL:
+ return ("internal library error");
+ case EIPD_UNKNOWN:
+ default:
+ return ("unknown error");
+ }
+}
+
+static int
+ipd_set_errno(ipd_errno_t e, const char *fmt, ...)
+{
+ va_list ap;
+
+ ipd_errno = e;
+ if (fmt != NULL) {
+ va_start(ap, fmt);
+ (void) vsnprintf(ipd_errmsg, sizeof (ipd_errmsg), fmt, ap);
+ va_end(ap);
+ } else {
+ (void) strlcpy(ipd_errmsg,
+ ipd_strerror(e), sizeof (ipd_errmsg));
+ }
+
+ return (-1);
+}
+
+int
+ipd_open(const char *path)
+{
+ int fd;
+
+ if (path == NULL)
+ path = IPD_DEV_PATH;
+
+ fd = open(path, O_RDWR);
+ if (fd < 0) {
+ return (ipd_set_errno(xlate_errno(errno),
+ "unable to open %s: %s", path, strerror(errno)));
+ }
+
+ return (fd);
+}
+
+int
+ipd_close(int fd)
+{
+ (void) close(fd);
+ return (0);
+}
+
+int
+ipd_status_read(int fd, ipd_stathdl_t *ispp)
+{
+ struct ipd_stat *isp = NULL;
+ ipd_ioc_list_t ipil;
+ uint_t rzones;
+ uint_t i;
+
+ bzero(&ipil, sizeof (ipil));
+ if (ioctl(fd, IPDIOC_LIST, &ipil) != 0) {
+ return (ipd_set_errno(xlate_errno(errno),
+ "unable to retrieve ipd zone list: %s", strerror(errno)));
+ }
+
+ for (;;) {
+ if ((rzones = ipil.ipil_nzones) == 0)
+ break;
+
+ ipil.ipil_info =
+ malloc(sizeof (ipd_ioc_info_t) * ipil.ipil_nzones);
+ if (ipil.ipil_info == NULL)
+ return (ipd_set_errno(EIPD_NOMEM, NULL));
+
+ if (ioctl(fd, IPDIOC_LIST, &ipil) != 0) {
+ free(ipil.ipil_info);
+ return (ipd_set_errno(xlate_errno(errno),
+ "unable to retrieve ipd zone list: %s",
+ strerror(errno)));
+ }
+
+ if (ipil.ipil_nzones <= rzones)
+ break;
+
+ free(ipil.ipil_info);
+ }
+
+ if ((isp = malloc(sizeof (struct ipd_stat))) == NULL) {
+ free(ipil.ipil_info);
+ return (ipd_set_errno(EIPD_NOMEM, NULL));
+ }
+
+ isp->is_nzones = ipil.ipil_nzones;
+
+ if (isp->is_nzones == 0) {
+ isp->is_zoneids = NULL;
+ isp->is_configs = NULL;
+ *ispp = isp;
+ return (0);
+ }
+
+ isp->is_zoneids = malloc(sizeof (zoneid_t) * ipil.ipil_nzones);
+ if (isp->is_zoneids == NULL) {
+ free(ipil.ipil_info);
+ free(isp);
+ return (ipd_set_errno(EIPD_NOMEM, NULL));
+ }
+ isp->is_configs = malloc(sizeof (struct ipd_config) * ipil.ipil_nzones);
+ if (isp->is_configs == NULL) {
+ free(ipil.ipil_info);
+ free(isp->is_zoneids);
+ free(isp);
+ return (ipd_set_errno(EIPD_NOMEM, NULL));
+ }
+
+ for (i = 0; i < isp->is_nzones; i++) {
+ isp->is_zoneids[i] = ipil.ipil_info[i].ipii_zoneid;
+
+ isp->is_configs[i].ic_corrupt = ipil.ipil_info[i].ipii_corrupt;
+ isp->is_configs[i].ic_drop = ipil.ipil_info[i].ipii_drop;
+ isp->is_configs[i].ic_delay = ipil.ipil_info[i].ipii_delay;
+
+ isp->is_configs[i].ic_mask =
+ ((!!isp->is_configs[i].ic_corrupt) * IPDM_CORRUPT) |
+ ((!!isp->is_configs[i].ic_drop) * IPDM_DROP) |
+ ((!!isp->is_configs[i].ic_delay) * IPDM_DELAY);
+ }
+
+ *ispp = isp;
+ return (0);
+}
+
+void
+ipd_status_foreach_zone(const ipd_stathdl_t hdl, ipd_status_cb_f f, void *arg)
+{
+ const struct ipd_stat *isp = hdl;
+ uint_t i;
+
+ for (i = 0; i < isp->is_nzones; i++)
+ f(isp->is_zoneids[i], &isp->is_configs[i], arg);
+}
+
+int
+ipd_status_get_config(const ipd_stathdl_t hdl, zoneid_t z, ipd_config_t **icpp)
+{
+ const struct ipd_stat *isp = hdl;
+ uint_t i;
+
+ for (i = 0; i < isp->is_nzones; i++) {
+ if (isp->is_zoneids[i] == z) {
+ *icpp = &isp->is_configs[i];
+ return (0);
+ }
+ }
+
+ return (ipd_set_errno(EIPD_ZC_NOENT,
+ "zone %d does not exist or has no ipd configuration", z));
+}
+
+void
+ipd_status_free(ipd_stathdl_t hdl)
+{
+ struct ipd_stat *isp = hdl;
+
+ if (isp != NULL) {
+ free(isp->is_zoneids);
+ free(isp->is_configs);
+ }
+ free(isp);
+}
+
+int
+ipd_ctl(int fd, zoneid_t z, const ipd_config_t *icp)
+{
+ ipd_ioc_perturb_t ipip;
+
+ bzero(&ipip, sizeof (ipd_ioc_perturb_t));
+ ipip.ipip_zoneid = z;
+
+ if (icp->ic_mask & IPDM_CORRUPT) {
+ if (icp->ic_corrupt == 0)
+ ipip.ipip_arg |= IPD_CORRUPT;
+ }
+ if (icp->ic_mask & IPDM_DELAY) {
+ if (icp->ic_delay == 0)
+ ipip.ipip_arg |= IPD_DELAY;
+ }
+ if (icp->ic_mask & IPDM_DROP) {
+ if (icp->ic_drop == 0)
+ ipip.ipip_arg |= IPD_DROP;
+ }
+
+ if (ipip.ipip_arg != 0 && ioctl(fd, IPDIOC_REMOVE, &ipip) != 0) {
+ return (ipd_set_errno(xlate_errno(errno),
+ "unable to remove cleared ipd settings: %s",
+ strerror(errno)));
+ }
+
+ if ((icp->ic_mask & IPDM_CORRUPT) && icp->ic_corrupt != 0) {
+ ipip.ipip_zoneid = z;
+ ipip.ipip_arg = icp->ic_corrupt;
+ if (ioctl(fd, IPDIOC_CORRUPT, &ipip) != 0) {
+ return (ipd_set_errno(xlate_errno(errno),
+ "unable to set corruption rate to %d: %s",
+ ipip.ipip_arg, strerror(errno)));
+ }
+ }
+ if ((icp->ic_mask & IPDM_DELAY) && icp->ic_delay != 0) {
+ ipip.ipip_zoneid = z;
+ ipip.ipip_arg = icp->ic_delay;
+ if (ioctl(fd, IPDIOC_DELAY, &ipip) != 0) {
+ return (ipd_set_errno(xlate_errno(errno),
+ "unable to set delay time to %d: %s",
+ ipip.ipip_arg, strerror(errno)));
+ }
+ }
+ if ((icp->ic_mask & IPDM_DROP) && icp->ic_drop != 0) {
+ ipip.ipip_zoneid = z;
+ ipip.ipip_arg = icp->ic_drop;
+ if (ioctl(fd, IPDIOC_DROP, &ipip) != 0) {
+ return (ipd_set_errno(xlate_errno(errno),
+ "unable to set drop probability to %d: %s",
+ ipip.ipip_arg, strerror(errno)));
+ }
+ }
+
+ return (0);
+}
diff --git a/usr/src/lib/libipd/common/libipd.h b/usr/src/lib/libipd/common/libipd.h
new file mode 100644
index 0000000000..ebf56aea1e
--- /dev/null
+++ b/usr/src/lib/libipd/common/libipd.h
@@ -0,0 +1,74 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _LIBIPD_H
+#define _LIBIPD_H
+
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Bitmask values for ic_mask.
+ */
+#define IPDM_CORRUPT 0x1000
+#define IPDM_DELAY 0x2000
+#define IPDM_DROP 0x4000
+
+typedef enum ipd_errno {
+ EIPD_NOERROR = 0,
+ EIPD_NOMEM,
+ EIPD_ZC_NOENT,
+ EIPD_RANGE,
+ EIPD_PERM,
+ EIPD_FAULT,
+ EIPD_INTERNAL,
+ EIPD_UNKNOWN
+} ipd_errno_t;
+
+typedef struct ipd_config {
+ uint32_t ic_mask;
+ uint32_t ic_corrupt;
+ uint32_t ic_drop;
+ uint32_t ic_delay;
+} ipd_config_t;
+
+struct ipd_stat;
+typedef struct ipd_stat *ipd_stathdl_t;
+
+typedef void (*ipd_status_cb_f)(zoneid_t, const ipd_config_t *, void *);
+
+extern __thread ipd_errno_t ipd_errno;
+extern __thread char ipd_errmsg[];
+
+extern const char *ipd_strerror(ipd_errno_t);
+extern int ipd_open(const char *);
+extern int ipd_close(int);
+extern int ipd_status_read(int, ipd_stathdl_t *);
+extern void ipd_status_foreach_zone(const ipd_stathdl_t,
+ ipd_status_cb_f, void *);
+extern int ipd_status_get_config(const ipd_stathdl_t,
+ zoneid_t, ipd_config_t **);
+extern void ipd_status_free(ipd_stathdl_t);
+extern int ipd_ctl(int, zoneid_t, const ipd_config_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LIBIPD_H */
diff --git a/usr/src/lib/libipd/common/llib-lipd b/usr/src/lib/libipd/common/llib-lipd
new file mode 100644
index 0000000000..79a3521301
--- /dev/null
+++ b/usr/src/lib/libipd/common/llib-lipd
@@ -0,0 +1,20 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/* LINTLIBRARY */
+/* PROTOLIB1 */
+
+#include <libipd.h>
diff --git a/usr/src/lib/libipd/common/mapfile-vers b/usr/src/lib/libipd/common/mapfile-vers
new file mode 100644
index 0000000000..fec8c56859
--- /dev/null
+++ b/usr/src/lib/libipd/common/mapfile-vers
@@ -0,0 +1,46 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2011 <contributor>. All rights reserved.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+# usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+SYMBOL_VERSION SUNWprivate_1.1 {
+ global:
+ ipd_errno;
+ ipd_errmsg;
+ ipd_strerror;
+ ipd_open;
+ ipd_close;
+ ipd_status_read;
+ ipd_status_foreach_zone;
+ ipd_status_get_config;
+ ipd_status_free;
+ ipd_ctl;
+ local:
+ *;
+};
diff --git a/usr/src/lib/libipd/i386/Makefile b/usr/src/lib/libipd/i386/Makefile
new file mode 100644
index 0000000000..6a668fb98f
--- /dev/null
+++ b/usr/src/lib/libipd/i386/Makefile
@@ -0,0 +1,18 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2012 Joyent, Inc. All rights reserved.
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libkmf/ber_der/Makefile.com b/usr/src/lib/libkmf/ber_der/Makefile.com
index e056b6cfa7..6654e7cfde 100644
--- a/usr/src/lib/libkmf/ber_der/Makefile.com
+++ b/usr/src/lib/libkmf/ber_der/Makefile.com
@@ -43,8 +43,10 @@ $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
CFLAGS += $(CCVERBOSE) -xCC
CFLAGS64 += $(CCVERBOSE) -xCC
-CPPFLAGS += -I/usr/include/libxml2 -I$(INCDIR) -I../../include
-CPPFLAGS64 += -I/usr/include/libxml2 -I$(INCDIR) -I../../include
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/libxml2 \
+ -I$(INCDIR) -I../../include
+CPPFLAGS64 += -I$(ADJUNCT_PROTO)/usr/include/libxml2 \
+ -I$(INCDIR) -I../../include
LDLIBS += -lc
CERRWARN += -_gcc=-Wno-unused-label
diff --git a/usr/src/lib/libkmf/libkmf/Makefile.com b/usr/src/lib/libkmf/libkmf/Makefile.com
index 4091ae09c1..a704d1e5a8 100644
--- a/usr/src/lib/libkmf/libkmf/Makefile.com
+++ b/usr/src/lib/libkmf/libkmf/Makefile.com
@@ -63,7 +63,8 @@ LDLIBS6 += $(BERDERLIB64) $(CRYPTOUTILLIB64) -lmd -lpkcs11 -lnsl -lsocket -lc
$(DYNLIB) := LDLIBS += -lxml2
$(DYNLIB64) := LDLIBS64 += -lxml2
-CPPFLAGS += -I$(INCDIR) -I/usr/include/libxml2 -I../../ber_der/inc -I$(SRCDIR)
+CPPFLAGS += -I$(INCDIR) -I$(ADJUNCT_PROTO)/usr/include/libxml2 \
+ -I../../ber_der/inc -I$(SRCDIR)
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/lib/libkmf/plugins/kmf_nss/Makefile.com b/usr/src/lib/libkmf/plugins/kmf_nss/Makefile.com
index a3ab702811..3b5f23aa92 100644
--- a/usr/src/lib/libkmf/plugins/kmf_nss/Makefile.com
+++ b/usr/src/lib/libkmf/plugins/kmf_nss/Makefile.com
@@ -34,19 +34,21 @@ include $(SRC)/lib/Makefile.lib
MPSDIR= /usr/lib/mps
KMFINC= -I../../../include -I../../../ber_der/inc
-NSSINC= -I/usr/include/mps
+NSSINC= -I$(ADJUNCT_PROTO)/usr/include/mps
BERLIB= -lkmf -lkmfberder
BERLIB64= $(BERLIB)
-NSSLIBS= $(BERLIB) -L$(MPSDIR) -R$(MPSDIR) -lnss3 -lnspr4 -lsmime3 -lc
-NSSLIBS64= $(BERLIB64) -L$(MPSDIR)/$(MACH64) -R$(MPSDIR)/$(MACH64) -lnss3 -lnspr4 -lsmime3 -lc
+NSSLIBS= $(BERLIB) -L$(ADJUNCT_PROTO)$(MPSDIR) -R$(MPSDIR) \
+ -lnss3 -lnspr4 -lsmime3 -lc
+NSSLIBS64= $(BERLIB64) -L$(ADJUNCT_PROTO)$(MPSDIR)/$(MACH64) \
+ -R$(MPSDIR)/$(MACH64) -lnss3 -lnspr4 -lsmime3 -lc
SRCDIR= ../common
INCDIR= ../../include
CFLAGS += $(CCVERBOSE)
CPPFLAGS += -D_REENTRANT $(KMFINC) $(NSSINC) \
- -I$(SFWDIR)/include -I$(INCDIR) -I/usr/include/libxml2
+ -I$(INCDIR) -I$(ADJUNCT_PROTO)/usr/include/libxml2
PICS= $(OBJECTS:%=pics/%)
diff --git a/usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com b/usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com
index e44eb0a87c..76ecd38479 100644
--- a/usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com
+++ b/usr/src/lib/libkmf/plugins/kmf_openssl/Makefile.com
@@ -48,7 +48,7 @@ INCDIR= ../../include
CFLAGS += $(CCVERBOSE)
CPPFLAGS += -D_REENTRANT $(KMFINC) \
- -I$(INCDIR) -I/usr/include/libxml2
+ -I$(INCDIR) -I$(ADJUNCT_PROTO)/usr/include/libxml2
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += -_gcc=-Wno-unused-value
diff --git a/usr/src/lib/libkmf/plugins/kmf_pkcs11/Makefile.com b/usr/src/lib/libkmf/plugins/kmf_pkcs11/Makefile.com
index ae97ef8e8f..0b69e23fd6 100644
--- a/usr/src/lib/libkmf/plugins/kmf_pkcs11/Makefile.com
+++ b/usr/src/lib/libkmf/plugins/kmf_pkcs11/Makefile.com
@@ -49,7 +49,8 @@ SRCS = \
CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -D_REENTRANT $(KMFINC) -I$(INCDIR) -I/usr/include/libxml2 -I$(BIGNUMDIR)
+CPPFLAGS += -D_REENTRANT $(KMFINC) -I$(INCDIR) \
+ -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I$(BIGNUMDIR)
LINTFLAGS64 += -errchk=longptr64
CERRWARN += -_gcc=-Wno-unused-label
diff --git a/usr/src/lib/libldap5/Makefile.com b/usr/src/lib/libldap5/Makefile.com
index 9c28fae337..ee48739eea 100644
--- a/usr/src/lib/libldap5/Makefile.com
+++ b/usr/src/lib/libldap5/Makefile.com
@@ -57,7 +57,7 @@ OBJECTS= $(BEROBJS) $(LDAPOBJS) $(SSLDAPOBJS) $(PRLDAPOBJS) \
include ../../Makefile.lib
NSS_LIBS= -lnspr4 -lplc4 -lnss3 -lssl3
-NSS_HDRS= /usr/include/mps
+NSS_HDRS= $(ADJUNCT_PROTO)/usr/include/mps
NSS_LDPATH= /usr/lib/mps
NSS_LDPATH64= $(NSS_LDPATH)/64
diff --git a/usr/src/lib/libldap5/amd64/Makefile b/usr/src/lib/libldap5/amd64/Makefile
index 680f2fb7c6..abf5a7d5f8 100644
--- a/usr/src/lib/libldap5/amd64/Makefile
+++ b/usr/src/lib/libldap5/amd64/Makefile
@@ -10,7 +10,7 @@ PR_MDUSOBJS = os_SunOS_x86.o
include ../Makefile.com
include ../../Makefile.lib.64
-LDLIBS += -L$(NSS_LDPATH64) $(NSS_LIBS)
+LDLIBS += -L$(ADJUNCT_PROTO)$(NSS_LDPATH64) $(NSS_LIBS)
DYNFLAGS += -R$(NSS_LDPATH64)
all: $(LIBS)
diff --git a/usr/src/lib/libldap5/i386/Makefile b/usr/src/lib/libldap5/i386/Makefile
index d0eba36ca2..b9e154c6fc 100644
--- a/usr/src/lib/libldap5/i386/Makefile
+++ b/usr/src/lib/libldap5/i386/Makefile
@@ -11,7 +11,7 @@ PR_MDUSOBJS = os_SunOS_x86.o
include ../Makefile.com
-LDLIBS += -L$(NSS_LDPATH) $(NSS_LIBS)
+LDLIBS += -L$(ADJUNCT_PROTO)$(NSS_LDPATH) $(NSS_LIBS)
DYNFLAGS += -R$(NSS_LDPATH)
all: $(LIBS)
diff --git a/usr/src/lib/libldap5/sparc/Makefile b/usr/src/lib/libldap5/sparc/Makefile
index e5e0562484..dcfe21adce 100644
--- a/usr/src/lib/libldap5/sparc/Makefile
+++ b/usr/src/lib/libldap5/sparc/Makefile
@@ -11,7 +11,7 @@ PR_MDUSOBJS = os_SunOS.o
include ../Makefile.com
-LDLIBS += -L$(NSS_LDPATH) $(NSS_LIBS)
+LDLIBS += -L$(ADJUNCT_PROTO)$(NSS_LDPATH) $(NSS_LIBS)
DYNFLAGS += -R$(NSS_LDPATH)
diff --git a/usr/src/lib/libldap5/sparcv9/Makefile b/usr/src/lib/libldap5/sparcv9/Makefile
index e1ac900b72..b3b78410e5 100644
--- a/usr/src/lib/libldap5/sparcv9/Makefile
+++ b/usr/src/lib/libldap5/sparcv9/Makefile
@@ -12,7 +12,7 @@ PR_MDUSOBJS = os_SunOS.o
include ../Makefile.com
include ../../Makefile.lib.64
-LDLIBS += -L$(NSS_LDPATH64) $(NSS_LIBS)
+LDLIBS += -L$(ADJUNCT_PROTO)$(NSS_LDPATH64) $(NSS_LIBS)
DYNFLAGS += -R$(NSS_LDPATH64)
all: $(LIBS)
diff --git a/usr/src/lib/libnisdb/db_mindex3.cc b/usr/src/lib/libnisdb/db_mindex3.cc
index 886487f8c5..28182544a4 100644
--- a/usr/src/lib/libnisdb/db_mindex3.cc
+++ b/usr/src/lib/libnisdb/db_mindex3.cc
@@ -282,7 +282,7 @@ entriesFromLDAPthread(void *voidarg) {
/* Lock to prevent removal */
(void) __nis_lock_db_table(arg->tableName, 1, 0,
- "entriesFromLDAPthread");
+ (char *)"entriesFromLDAPthread");
/*
* It's possible that the db_mindex for the table has changed,
@@ -314,7 +314,7 @@ entriesFromLDAPthread(void *voidarg) {
stat = entriesFromLDAPreal(arg);
(void) __nis_ulock_db_table(arg->tableName, 1, 0,
- "entriesFromLDAPthread");
+ (char *)"entriesFromLDAPthread");
freeQuery(arg->q);
if (arg->dirObj != 0)
diff --git a/usr/src/lib/libnisdb/db_table.cc b/usr/src/lib/libnisdb/db_table.cc
index 2995f1a9c9..8044148355 100644
--- a/usr/src/lib/libnisdb/db_table.cc
+++ b/usr/src/lib/libnisdb/db_table.cc
@@ -599,7 +599,7 @@ db_table::setEntryExp(entryp where, entry_obj *obj, int initialLoad) {
if (o != 0) {
__nis_buffer_t b = {0, 0};
- bp2buf(myself, &b, "%s.%s",
+ bp2buf(myself, &b, (char *)"%s.%s",
o->zo_name, o->zo_domain);
t = getObjMapping(b.buf, 0, 1, 0, 0);
sfree(b.buf);
@@ -967,7 +967,7 @@ db_table::setEnumMode(long enumNum) {
if (stat != DB_SUCCESS) {
enumMode.flag = 0;
enumCount.flag = 0;
- logmsg(MSG_NOTIMECHECK, LOG_ERR,
+ logmsg(MSG_NOTIMECHECK, LOG_ERR, (char *)
"%s: No memory for enum check array; entry removal disabled",
myself);
}
diff --git a/usr/src/lib/libnisdb/nis_db.cc b/usr/src/lib/libnisdb/nis_db.cc
index 2908cc99b0..b27889b147 100644
--- a/usr/src/lib/libnisdb/nis_db.cc
+++ b/usr/src/lib/libnisdb/nis_db.cc
@@ -527,7 +527,7 @@ dbFindObject(char *objName, db_status *statP) {
/* If not the root dir, find the directory where the entry lives */
sfree(table);
- name = entryName(myself, objName, &table);
+ name = entryName((char *)myself, objName, &table);
if (name == 0 || table == 0) {
sfree(name);
RETSTAT(0, DB_MEMORY_LIMIT);
@@ -737,7 +737,7 @@ dbDeleteObj(char *objName) {
nod->objType = o->zo_data.zo_type;
nis_destroy_object(o);
- nod->objName = sdup(myself, T, objName);
+ nod->objName = sdup((char *)myself, T, objName);
if (nod->objName == 0) {
sfree(nod);
return (DB_MEMORY_LIMIT);
@@ -789,7 +789,7 @@ dbTouchObj(char *objName) {
sfree(table);
table = 0;
- ent = entryName(myself, objName, &table);
+ ent = entryName((char *)myself, objName, &table);
if (ent == 0 || table == 0) {
sfree(ent);
return (DB_MEMORY_LIMIT);
@@ -989,7 +989,7 @@ dbRefreshObj(char *name, nis_object *o) {
int lstat;
/* Find parent */
- ent = entryName(myself, objName, &table);
+ ent = entryName((char *)myself, objName, &table);
if (ent == 0 || table == 0) {
sfree(b.buf);
sfree(objTable);
diff --git a/usr/src/lib/libnvpair/Makefile.com b/usr/src/lib/libnvpair/Makefile.com
index 6a21376eb3..056d967554 100644
--- a/usr/src/lib/libnvpair/Makefile.com
+++ b/usr/src/lib/libnvpair/Makefile.com
@@ -23,6 +23,7 @@
# Use is subject to license terms.
#
# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
LIBRARY= libnvpair.a
@@ -32,13 +33,15 @@ OBJECTS= libnvpair.o \
nvpair_alloc_system.o \
nvpair_alloc_fixed.o \
nvpair.o \
- fnvpair.o
+ fnvpair.o \
+ nvpair_json.o
include ../../Makefile.lib
include ../../Makefile.rootfs
SRCS= ../libnvpair.c \
../nvpair_alloc_system.c \
+ ../nvpair_json.c \
$(SRC)/common/nvpair/nvpair_alloc_fixed.c \
$(SRC)/common/nvpair/nvpair.c \
$(SRC)/common/nvpair/fnvpair.c
@@ -54,7 +57,13 @@ LINTFLAGS64 += -erroff=E_BAD_PTR_CAST_ALIGN
# turn off warning caused by lint bug: not understanding SCNi8 "hhi"
LINTFLAGS += -erroff=E_BAD_FORMAT_STR2
+LINTFLAGS += -erroff=E_INVALID_TOKEN_IN_DEFINE_MACRO
+LINTFLAGS += -erroff=E_RET_INT_IMPLICITLY
+LINTFLAGS += -erroff=E_FUNC_USED_VAR_ARG2
LINTFLAGS64 += -erroff=E_BAD_FORMAT_STR2
+LINTFLAGS64 += -erroff=E_INVALID_TOKEN_IN_DEFINE_MACRO
+LINTFLAGS64 += -erroff=E_RET_INT_IMPLICITLY
+LINTFLAGS64 += -erroff=E_FUNC_USED_VAR_ARG2
CERRWARN += -_gcc=-Wno-type-limits
CERRWARN += -_gcc=-Wno-parentheses
diff --git a/usr/src/lib/libnvpair/libnvpair.h b/usr/src/lib/libnvpair/libnvpair.h
index 4c2615d924..b05669e506 100644
--- a/usr/src/lib/libnvpair/libnvpair.h
+++ b/usr/src/lib/libnvpair/libnvpair.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#ifndef _LIBNVPAIR_H
@@ -46,6 +47,7 @@ extern int nvpair_value_match_regex(nvpair_t *, int, char *, regex_t *,
char **);
extern void nvlist_print(FILE *, nvlist_t *);
+extern int nvlist_print_json(FILE *, nvlist_t *);
extern void dump_nvlist(nvlist_t *, int);
/*
diff --git a/usr/src/lib/libnvpair/mapfile-vers b/usr/src/lib/libnvpair/mapfile-vers
index a014835447..0403964e05 100644
--- a/usr/src/lib/libnvpair/mapfile-vers
+++ b/usr/src/lib/libnvpair/mapfile-vers
@@ -21,6 +21,7 @@
#
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
#
@@ -244,6 +245,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
nvlist_add_hrtime;
nvlist_lookup_hrtime;
nvlist_print;
+ nvlist_print_json;
nvlist_prt;
nvlist_prtctl_alloc;
nvlist_prtctl_free;
diff --git a/usr/src/lib/libnvpair/nvpair_json.c b/usr/src/lib/libnvpair/nvpair_json.c
new file mode 100644
index 0000000000..77348041ab
--- /dev/null
+++ b/usr/src/lib/libnvpair/nvpair_json.c
@@ -0,0 +1,400 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <wchar.h>
+#include <sys/debug.h>
+
+#include "libnvpair.h"
+
+#define FPRINTF(fp, ...) \
+ do { \
+ if (fprintf(fp, __VA_ARGS__) < 0) \
+ return (-1); \
+ } while (0)
+
+/*
+ * When formatting a string for JSON output we must escape certain characters,
+ * as described in RFC4627. This applies to both member names and
+ * DATA_TYPE_STRING values.
+ *
+ * This function will only operate correctly if the following conditions are
+ * met:
+ *
+ * 1. The input String is encoded in the current locale.
+ *
+ * 2. The current locale includes the Basic Multilingual Plane (plane 0)
+ * as defined in the Unicode standard.
+ *
+ * The output will be entirely 7-bit ASCII (as a subset of UTF-8) with all
+ * representable Unicode characters included in their escaped numeric form.
+ */
+static int
+nvlist_print_json_string(FILE *fp, const char *input)
+{
+ mbstate_t mbr;
+ wchar_t c;
+ size_t sz;
+
+ bzero(&mbr, sizeof (mbr));
+
+ FPRINTF(fp, "\"");
+ while ((sz = mbrtowc(&c, input, MB_CUR_MAX, &mbr)) > 0) {
+ switch (c) {
+ case '"':
+ FPRINTF(fp, "\\\"");
+ break;
+ case '\n':
+ FPRINTF(fp, "\\n");
+ break;
+ case '\r':
+ FPRINTF(fp, "\\r");
+ break;
+ case '\\':
+ FPRINTF(fp, "\\\\");
+ break;
+ case '\f':
+ FPRINTF(fp, "\\f");
+ break;
+ case '\t':
+ FPRINTF(fp, "\\t");
+ break;
+ case '\b':
+ FPRINTF(fp, "\\b");
+ break;
+ default:
+ if ((c >= 0x00 && c <= 0x1f) ||
+ (c > 0x7f && c <= 0xffff)) {
+ /*
+ * Render both Control Characters and Unicode
+ * characters in the Basic Multilingual Plane
+ * as JSON-escaped multibyte characters.
+ */
+ FPRINTF(fp, "\\u%04x", 0xffff & c);
+ } else if (c >= 0x20 && c <= 0x7f) {
+ /*
+ * Render other 7-bit ASCII characters directly
+ * and drop other, unrepresentable characters.
+ */
+ FPRINTF(fp, "%c", 0xff & c);
+ }
+ break;
+ }
+ input += sz;
+ }
+
+ if (sz == (size_t)-1 || sz == (size_t)-2) {
+ /*
+ * We last read an invalid multibyte character sequence,
+ * so return an error.
+ */
+ return (-1);
+ }
+
+ FPRINTF(fp, "\"");
+ return (0);
+}
+
+/*
+ * Dump a JSON-formatted representation of an nvlist to the provided FILE *.
+ * This routine does not output any new-lines or additional whitespace other
+ * than that contained in strings, nor does it call fflush(3C).
+ */
+int
+nvlist_print_json(FILE *fp, nvlist_t *nvl)
+{
+ nvpair_t *curr;
+ boolean_t first = B_TRUE;
+
+ FPRINTF(fp, "{");
+
+ for (curr = nvlist_next_nvpair(nvl, NULL); curr;
+ curr = nvlist_next_nvpair(nvl, curr)) {
+ data_type_t type = nvpair_type(curr);
+
+ if (!first)
+ FPRINTF(fp, ",");
+ else
+ first = B_FALSE;
+
+ if (nvlist_print_json_string(fp, nvpair_name(curr)) == -1)
+ return (-1);
+ FPRINTF(fp, ":");
+
+ switch (type) {
+ case DATA_TYPE_STRING: {
+ char *string = fnvpair_value_string(curr);
+ if (nvlist_print_json_string(fp, string) == -1)
+ return (-1);
+ break;
+ }
+
+ case DATA_TYPE_BOOLEAN: {
+ FPRINTF(fp, "true");
+ break;
+ }
+
+ case DATA_TYPE_BOOLEAN_VALUE: {
+ FPRINTF(fp, "%s", fnvpair_value_boolean_value(curr) ==
+ B_TRUE ? "true" : "false");
+ break;
+ }
+
+ case DATA_TYPE_BYTE: {
+ FPRINTF(fp, "%hhu", fnvpair_value_byte(curr));
+ break;
+ }
+
+ case DATA_TYPE_INT8: {
+ FPRINTF(fp, "%hhd", fnvpair_value_int8(curr));
+ break;
+ }
+
+ case DATA_TYPE_UINT8: {
+ FPRINTF(fp, "%hhu", fnvpair_value_uint8_t(curr));
+ break;
+ }
+
+ case DATA_TYPE_INT16: {
+ FPRINTF(fp, "%hd", fnvpair_value_int16(curr));
+ break;
+ }
+
+ case DATA_TYPE_UINT16: {
+ FPRINTF(fp, "%hu", fnvpair_value_uint16(curr));
+ break;
+ }
+
+ case DATA_TYPE_INT32: {
+ FPRINTF(fp, "%d", fnvpair_value_int32(curr));
+ break;
+ }
+
+ case DATA_TYPE_UINT32: {
+ FPRINTF(fp, "%u", fnvpair_value_uint32(curr));
+ break;
+ }
+
+ case DATA_TYPE_INT64: {
+ FPRINTF(fp, "%lld", fnvpair_value_int64(curr));
+ break;
+ }
+
+ case DATA_TYPE_UINT64: {
+ FPRINTF(fp, "%llu", fnvpair_value_uint64(curr));
+ break;
+ }
+
+ case DATA_TYPE_HRTIME: {
+ hrtime_t val;
+ VERIFY0(nvpair_value_hrtime(curr, &val));
+ FPRINTF(fp, "%llu", val);
+ break;
+ }
+
+ case DATA_TYPE_DOUBLE: {
+ double val;
+ VERIFY0(nvpair_value_double(curr, &val));
+ FPRINTF(fp, "%f", val);
+ break;
+ }
+
+ case DATA_TYPE_NVLIST: {
+ if (nvlist_print_json(fp,
+ fnvpair_value_nvlist(curr)) == -1)
+ return (-1);
+ break;
+ }
+
+ case DATA_TYPE_STRING_ARRAY: {
+ char **val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_string_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ if (nvlist_print_json_string(fp, val[i]) == -1)
+ return (-1);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_NVLIST_ARRAY: {
+ nvlist_t **val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_nvlist_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ if (nvlist_print_json(fp, val[i]) == -1)
+ return (-1);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_BOOLEAN_ARRAY: {
+ boolean_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_boolean_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, val[i] == B_TRUE ?
+ "true" : "false");
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_BYTE_ARRAY: {
+ uchar_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_byte_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hhu", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UINT8_ARRAY: {
+ uint8_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_uint8_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hhu", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_INT8_ARRAY: {
+ int8_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_int8_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hd", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UINT16_ARRAY: {
+ uint16_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_uint16_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hu", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_INT16_ARRAY: {
+ int16_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_int16_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%hhd", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UINT32_ARRAY: {
+ uint32_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_uint32_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%u", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_INT32_ARRAY: {
+ int32_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_int32_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%d", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UINT64_ARRAY: {
+ uint64_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_uint64_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%llu", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_INT64_ARRAY: {
+ int64_t *val;
+ uint_t valsz, i;
+ VERIFY0(nvpair_value_int64_array(curr, &val, &valsz));
+ FPRINTF(fp, "[");
+ for (i = 0; i < valsz; i++) {
+ if (i > 0)
+ FPRINTF(fp, ",");
+ FPRINTF(fp, "%lld", val[i]);
+ }
+ FPRINTF(fp, "]");
+ break;
+ }
+
+ case DATA_TYPE_UNKNOWN:
+ return (-1);
+ }
+ }
+
+ FPRINTF(fp, "}");
+ return (0);
+}
diff --git a/usr/src/lib/libpool/Makefile.com b/usr/src/lib/libpool/Makefile.com
index 493e442d0d..13b8a05cc1 100644
--- a/usr/src/lib/libpool/Makefile.com
+++ b/usr/src/lib/libpool/Makefile.com
@@ -48,7 +48,8 @@ SRCDIR = ../common
$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -D_REENTRANT -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2
+CPPFLAGS += -D_REENTRANT -D_FILE_OFFSET_BITS=64 \
+ -I$(ADJUNCT_PROTO)/usr/include/libxml2
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/lib/libproc/common/Pzone.c b/usr/src/lib/libproc/common/Pzone.c
index c478b41624..31319674b2 100644
--- a/usr/src/lib/libproc/common/Pzone.c
+++ b/usr/src/lib/libproc/common/Pzone.c
@@ -24,6 +24,9 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
@@ -792,9 +795,10 @@ Pfindmap(struct ps_prochandle *P, map_info_t *mptr, char *s, size_t n)
(strcmp(mptr->map_pmap.pr_mapname, "a.out") == 0) ||
((fptr != NULL) && (fptr->file_lname != NULL) &&
(strcmp(fptr->file_lname, "a.out") == 0))) {
- (void) Pexecname(P, buf, sizeof (buf));
- (void) strlcpy(s, buf, n);
- return (s);
+ if (Pexecname(P, buf, sizeof (buf)) != NULL) {
+ (void) strlcpy(s, buf, n);
+ return (s);
+ }
}
/* Try /proc first to get the real object name */
diff --git a/usr/src/lib/libproject/common/setproject.c b/usr/src/lib/libproject/common/setproject.c
index e24a8b78c6..ef208845a1 100644
--- a/usr/src/lib/libproject/common/setproject.c
+++ b/usr/src/lib/libproject/common/setproject.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
@@ -199,9 +200,7 @@ rctl_set(char *ctl_name, char *val, struct ps_prochandle *Pr, int flags)
int count = 0;
char *tmp;
int local_act;
- rctlblk_t *rlast;
rctlblk_t *rnext;
- rctlblk_t *rtmp;
int teardown_basic = 0;
int teardown_priv = 0;
@@ -358,44 +357,35 @@ rctl_set(char *ctl_name, char *val, struct ps_prochandle *Pr, int flags)
/* teardown rctls if required */
if (!project_entity) {
- if ((rlast = (rctlblk_t *)malloc(rctlblk_size())) == NULL) {
- free(ablk);
- return (SETFAILED);
- }
if ((rnext = (rctlblk_t *)malloc(rctlblk_size())) == NULL) {
free(ablk);
- free(rlast);
return (SETFAILED);
}
+restart:
if (pr_getrctl(Pr, ctl_name, NULL, rnext, RCTL_FIRST) == 0) {
-
while (1) {
if ((rctlblk_get_privilege(rnext) ==
RCPRIV_PRIVILEGED) &&
(teardown_priv == 1)) {
(void) pr_setrctl(Pr, ctl_name, NULL,
rnext, RCTL_DELETE);
+ goto restart;
}
if ((rctlblk_get_privilege(rnext) ==
RCPRIV_BASIC) && (teardown_basic == 1)) {
(void) pr_setrctl(Pr, ctl_name, NULL,
rnext, RCTL_DELETE);
+ goto restart;
}
- rtmp = rnext;
- rnext = rlast;
- rlast = rtmp;
- if (pr_getrctl(Pr, ctl_name, rlast, rnext,
+ if (pr_getrctl(Pr, ctl_name, rnext, rnext,
RCTL_NEXT) == -1)
break;
}
-
}
free(rnext);
- free(rlast);
-
}
/* set rctls */
diff --git a/usr/src/lib/libresolv2_joy/Makefile b/usr/src/lib/libresolv2_joy/Makefile
new file mode 100644
index 0000000000..052dfdd092
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/Makefile
@@ -0,0 +1,76 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+
+include ../../Makefile.master
+include ../Makefile.lib
+
+$(ROOTSVCMETHOD) := FILEMODE = 0555
+
+SUBDIRS= include $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
+_msg := TARGET= _msg
+
+LIBRARY= libresolv_joy.a
+TEXT_DOMAIN= SUNW_OST_OSLIB
+XGETFLAGS= -a
+POFILE= $(LIBRARY:.a=.po)
+POFILES= generic.po
+
+SED= sed
+GREP= grep
+
+.KEEP_STATE:
+
+all clean clobber lint: $(SUBDIRS)
+
+install: $(SUBDIRS)
+
+check: $(CHECKHDRS) $(CHKMANIFEST)
+
+_msg: $(MSGDOMAIN) $(POFILE)
+ $(RM) $(MSGDOMAIN)/$(POFILE)
+ $(CP) $(POFILE) $(MSGDOMAIN)
+
+$(POFILE): $(POFILES)
+ $(RM) $@
+ $(CAT) $(POFILES) > $@
+
+$(POFILES):
+ $(RM) messages.po
+ $(XGETTEXT) $(XGETFLAGS) *.[ch]* */*.[ch]*
+ $(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@
+ $(RM) messages.po
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET); echo
+
+FRC:
+
diff --git a/usr/src/lib/libresolv2_joy/Makefile.com b/usr/src/lib/libresolv2_joy/Makefile.com
new file mode 100644
index 0000000000..bbabcbcede
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/Makefile.com
@@ -0,0 +1,162 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#
+
+LIBRARY= libresolv_joy.a
+VERS= .2
+
+BSDOBJS= daemon.o putenv.o strcasecmp.o strsep.o \
+ ftruncate.o readv.o strdup.o strtoul.o \
+ gettimeofday.o setenv.o strerror.o utimes.o \
+ mktemp.o setitimer.o strpbrk.o writev.o
+
+DSTOBJS= dst_api.o support.o hmac_link.o
+
+# inet_addr, inet_pton, inet_ntop, and inet_ntoa removed due to overlap with
+# libnsl
+INETOBJS= inet_net_pton.o inet_neta.o inet_lnaof.o \
+ inet_netof.o nsap_addr.o inet_makeaddr.o \
+ inet_network.o inet_net_ntop.o inet_cidr_ntop.o \
+ inet_cidr_pton.o inet_data.o
+
+# build only the IRS objects that the ISC libbind's make would
+IRSTHROBJS= gethostent_r.o getnetent_r.o getnetgrent_r.o \
+ getprotoent_r.o getservent_r.o
+IRSOBJS= ${IRSTHROBJS} \
+ dns.o dns_ho.o dns_nw.o dns_pr.o \
+ dns_sv.o gai_strerror.o gen.o gen_ho.o \
+ gen_ng.o gen_nw.o gen_pr.o gen_sv.o \
+ getaddrinfo.o gethostent.o getnameinfo.o getnetent.o \
+ getnetgrent.o getprotoent.o getservent.o hesiod.o \
+ irp.o irp_ho.o irp_ng.o irp_nw.o \
+ irp_pr.o irp_sv.o irpmarshall.o irs_data.o \
+ lcl.o lcl_ho.o lcl_ng.o lcl_nw.o \
+ lcl_pr.o lcl_sv.o nis.o nul_ng.o \
+ util.o
+
+ISCOBJS= assertions.o base64.o bitncmp.o ctl_clnt.o \
+ ctl_p.o ctl_srvr.o ev_connects.o ev_files.o \
+ ev_streams.o ev_timers.o ev_waits.o eventlib.o \
+ heap.o hex.o logging.o memcluster.o \
+ movefile.o tree.o
+
+NAMESEROBJS= ns_date.o ns_name.o ns_netint.o ns_parse.o \
+ ns_print.o ns_samedomain.o ns_sign.o ns_ttl.o \
+ ns_verify.o ns_rdata.o ns_newmsg.o
+
+RESOLVOBJS= herror.o mtctxres.o res_comp.o res_data.o \
+ res_debug.o res_findzonecut.o res_init.o \
+ res_mkquery.o res_mkupdate.o res_query.o res_send.o \
+ res_sendsigned.o res_update.o
+
+SUNWOBJS= sunw_mtctxres.o sunw_updrec.o sunw_wrappers.o
+
+OBJECTS= $(BSDOBJS) $(DSTOBJS) $(INETOBJS) $(IRSOBJS) $(ISCOBJS) \
+ $(NAMESEROBJS) $(RESOLVOBJS) $(SUNWOBJS)
+
+# include library definitions
+include ../../Makefile.lib
+
+# install this library in the root filesystem
+include ../../Makefile.rootfs
+
+# CC -v complains about things we aren't going to change in the ISC code
+CCVERBOSE=
+
+SRCDIR = ../common
+SRCS= $(BSDOBJS:%.o=../common/bsd/%.c) \
+ $(DSTOBJS:%.o=../common/dst/%.c) \
+ $(INETOBJS:%.o=../common/inet/%.c) \
+ $(IRSOBJS:%.o=../common/irs/%.c) \
+ $(ISCOBJS:%.o=../common/isc/%.c) \
+ $(NAMESEROBJS:%.o=../common/nameser/%.c) \
+ $(RESOLVOBJS:%.o=../common/resolv/%.c) \
+ $(SUNWOBJS:%.o=../common/sunw/%.c)
+
+LIBS = $(DYNLIB) $(LINTLIB)
+
+$(LINTLIB):= SRCS = ../common/llib-lresolv_joy
+
+# Local Libresolv definitions
+
+SOLCOMPAT = -Dsocket=_socket
+CRYPTFLAGS= -DHMAC_MD5 -DUSE_MD5
+
+LOCFLAGS += $(CRYPTFLAGS)
+LOCFLAGS += -D_SYS_STREAM_H -D_REENTRANT -DSVR4 -DSUNW_OPTIONS \
+ $(SOLCOMPAT) -I../include -I../../common/inc
+
+CPPFLAGS += $(LOCFLAGS)
+
+CERRWARN += -_gcc=-Wno-implicit-function-declaration
+
+DYNFLAGS += $(ZNODELETE)
+
+LDLIBS += -lsocket -lnsl -lc -lmd
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: lintcheck
+
+# include library targets
+include ../../Makefile.targ
+
+pics/%.o: ../common/bsd/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+pics/%.o: ../common/dst/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+pics/%.o: ../common/inet/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+pics/%.o: ../common/irs/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+pics/%.o: ../common/isc/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+pics/%.o: ../common/nameser/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+pics/%.o: ../common/resolv/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+pics/%.o: ../common/sunw/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
+
+# install rule for lint library target
+$(ROOTLINTDIR)/%: ../common/%
+ $(INS.file)
diff --git a/usr/src/lib/libresolv2_joy/THIRDPARTYLICENSE b/usr/src/lib/libresolv2_joy/THIRDPARTYLICENSE
new file mode 100644
index 0000000000..719d77fea2
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/THIRDPARTYLICENSE
@@ -0,0 +1,185 @@
+ * Copyright (c) 1995-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+
+ * Copyright (c) 1983, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+
+/* Copyright (C) RSA Data Security, Inc. created 1986-1987, 1990,
+ 1992-1994, 1996. This is an
+ unpublished work protected as such under copyright law. This work
+ contains proprietary, confidential, and trade secret information of
+ RSA Data Security, Inc. Use, disclosure or reproduction without the
+ express written authorization of RSA Data Security, Inc. is
+ prohibited.
+ */
+
+ DNSSAFE LICENSE TERMS
+
+ This BIND software includes the DNSsafe software from RSA Data
+ Security, Inc., which is copyrighted software that can only be
+ distributed under the terms of this license agreement.
+
+ The DNSsafe software cannot be used or distributed separately from the
+ BIND software. You only have the right to use it or distribute it as
+ a bundled, integrated product.
+
+ The DNSsafe software can ONLY be used to provide authentication for
+ resource records in the Domain Name System, as specified in RFC 2065
+ and successors. You cannot modify the BIND software to use the
+ DNSsafe software for other purposes, or to make its cryptographic
+ functions available to end-users for other uses.
+
+ If you modify the DNSsafe software itself, you cannot modify its
+ documented API, and you must grant RSA Data Security the right to use,
+ modify, and distribute your modifications, including the right to use
+ any patents or other intellectual property that your modifications
+ depend upon.
+
+ You must not remove, alter, or destroy any of RSA's copyright notices
+ or license information. When distributing the software to the Federal
+ Government, it must be licensed to them as "commercial computer
+ software" protected under 48 CFR 12.212 of the FAR, or 48 CFR
+ 227.7202.1 of the DFARS.
+
+ You must not violate United States export control laws by distributing
+ the DNSsafe software or information about it, when such distribution
+ is prohibited by law.
+
+ THE DNSSAFE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY
+ WHATSOEVER. RSA HAS NO OBLIGATION TO SUPPORT, CORRECT, UPDATE OR
+ MAINTAIN THE RSA SOFTWARE. RSA DISCLAIMS ALL WARRANTIES, EXPRESS,
+ IMPLIED OR STATUTORY, AS TO ANY MATTER WHATSOEVER, INCLUDING ALL
+ IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS.
+
+ If you desire to use DNSsafe in ways that these terms do not permit,
+ please contact RSA Data Security, Inc., 100 Marine Parkway, Redwood
+ City, California 94065, USA, to discuss alternate licensing
+ arrangements.
+
+ * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
+ *
+ * Permission to use, copy modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TRUSTED INFORMATION SYSTEMS
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * TRUSTED INFORMATION SYSTEMS BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
+
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by WIDE Project and
+ * its contributors.
+ * 4. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
diff --git a/usr/src/lib/libresolv2_joy/THIRDPARTYLICENSE.descrip b/usr/src/lib/libresolv2_joy/THIRDPARTYLICENSE.descrip
new file mode 100644
index 0000000000..67315d8f33
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/THIRDPARTYLICENSE.descrip
@@ -0,0 +1 @@
+BIND SOFTWARE
diff --git a/usr/src/lib/print/libipp-core/i386/Makefile b/usr/src/lib/libresolv2_joy/amd64/Makefile
index 3b985583a4..2e8cdecf75 100644
--- a/usr/src/lib/print/libipp-core/i386/Makefile
+++ b/usr/src/lib/libresolv2_joy/amd64/Makefile
@@ -26,5 +26,6 @@
#
include ../Makefile.com
+include ../../Makefile.lib.64
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/daemon.c b/usr/src/lib/libresolv2_joy/common/bsd/daemon.c
new file mode 100644
index 0000000000..54ff83b753
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/daemon.c
@@ -0,0 +1,81 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: daemon.c,v 1.2 2005/04/27 04:56:10 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "port_before.h"
+
+#include <fcntl.h>
+#include <paths.h>
+#include <unistd.h>
+
+#include "port_after.h"
+
+#ifndef NEED_DAEMON
+int __bind_daemon__;
+#else
+
+int
+daemon(int nochdir, int noclose) {
+ int fd;
+
+ switch (fork()) {
+ case -1:
+ return (-1);
+ case 0:
+ break;
+ default:
+ _exit(0);
+ }
+
+ if (setsid() == -1)
+ return (-1);
+
+ if (!nochdir)
+ (void)chdir("/");
+
+ if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ (void)dup2(fd, STDIN_FILENO);
+ (void)dup2(fd, STDOUT_FILENO);
+ (void)dup2(fd, STDERR_FILENO);
+ if (fd > 2)
+ (void)close (fd);
+ }
+ return (0);
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/ftruncate.c b/usr/src/lib/libresolv2_joy/common/bsd/ftruncate.c
new file mode 100644
index 0000000000..5ac4ebac9b
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/ftruncate.c
@@ -0,0 +1,64 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: ftruncate.c,v 1.3 2005/04/27 18:16:45 sra Exp $";
+#endif
+
+/*! \file
+ * \brief
+ * ftruncate - set file size, BSD Style
+ *
+ * shortens or enlarges the file as neeeded
+ * uses some undocumented locking call. It is known to work on SCO unix,
+ * other vendors should try.
+ * The #error directive prevents unsupported OSes
+ */
+
+#include "port_before.h"
+
+#if defined(M_UNIX)
+#define OWN_FTRUNCATE
+#include <stdio.h>
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+#ifdef _POSIX_SOURCE
+#undef _POSIX_SOURCE
+#endif
+
+#include <fcntl.h>
+
+#include "port_after.h"
+
+int
+__ftruncate(int fd, long wantsize) {
+ long cursize;
+
+ /* determine current file size */
+ if ((cursize = lseek(fd, 0L, 2)) == -1)
+ return (-1);
+
+ /* maybe lengthen... */
+ if (cursize < wantsize) {
+ if (lseek(fd, wantsize - 1, 0) == -1 ||
+ write(fd, "", 1) == -1) {
+ return (-1);
+ }
+ return (0);
+ }
+
+ /* maybe shorten... */
+ if (wantsize < cursize) {
+ struct flock fl;
+
+ fl.l_whence = 0;
+ fl.l_len = 0;
+ fl.l_start = wantsize;
+ fl.l_type = F_WRLCK;
+ return (fcntl(fd, F_FREESP, &fl));
+ }
+ return (0);
+}
+#endif
+
+#ifndef OWN_FTRUNCATE
+int __bindcompat_ftruncate;
+#endif
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/gettimeofday.c b/usr/src/lib/libresolv2_joy/common/bsd/gettimeofday.c
new file mode 100644
index 0000000000..2926a3575e
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/gettimeofday.c
@@ -0,0 +1,62 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: gettimeofday.c,v 1.4 2005/04/27 04:56:11 sra Exp $";
+#endif
+
+#include "port_before.h"
+#include <stdio.h>
+#include <syslog.h>
+#include <sys/time.h>
+#include "port_after.h"
+
+#if !defined(NEED_GETTIMEOFDAY)
+/*%
+ * gettimeofday() occasionally returns invalid tv_usec on some platforms.
+ */
+#define MILLION 1000000
+#undef gettimeofday
+
+int
+isc__gettimeofday(struct timeval *tp, struct timezone *tzp) {
+ int res;
+
+ res = gettimeofday(tp, tzp);
+ if (res < 0)
+ return (res);
+ if (tp == NULL)
+ return (res);
+ if (tp->tv_usec < 0) {
+ do {
+ tp->tv_usec += MILLION;
+ tp->tv_sec--;
+ } while (tp->tv_usec < 0);
+ goto log;
+ } else if (tp->tv_usec > MILLION) {
+ do {
+ tp->tv_usec -= MILLION;
+ tp->tv_sec++;
+ } while (tp->tv_usec > MILLION);
+ goto log;
+ }
+ return (res);
+ log:
+ syslog(LOG_ERR, "gettimeofday: tv_usec out of range\n");
+ return (res);
+}
+#else
+int
+gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp) {
+ time_t clock, time(time_t *);
+
+ if (time(&clock) == (time_t) -1)
+ return (-1);
+ if (tvp) {
+ tvp->tv_sec = clock;
+ tvp->tv_usec = 0;
+ }
+ if (tzp) {
+ tzp->tz_minuteswest = 0;
+ tzp->tz_dsttime = 0;
+ }
+ return (0);
+}
+#endif /*NEED_GETTIMEOFDAY*/
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/mktemp.c b/usr/src/lib/libresolv2_joy/common/bsd/mktemp.c
new file mode 100644
index 0000000000..001b24b58f
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/mktemp.c
@@ -0,0 +1,156 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: mktemp.c,v 1.2 2005/04/27 04:56:11 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 1987, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+#include "port_after.h"
+
+#if (!defined(NEED_MKTEMP)) && (!defined(NEED_MKSTEMP))
+int __mktemp_unneeded__;
+#else
+
+static int gettemp(char *path, int *doopen);
+
+#ifdef NEED_MKSTEMP
+mkstemp(char *path) {
+ int fd;
+
+ return (gettemp(path, &fd) ? fd : -1);
+}
+#endif
+
+#ifdef NEED_MKTEMP
+char *
+mktemp(char *path) {
+ return(gettemp(path, (int *)NULL) ? path : (char *)NULL);
+}
+#endif
+
+static int
+gettemp(char *path, int *doopen) {
+ char *start, *trv;
+ struct stat sbuf;
+ u_int pid;
+
+ pid = getpid();
+ for (trv = path; *trv; ++trv); /*%< extra X's get set to 0's */
+ while (*--trv == 'X') {
+ *trv = (pid % 10) + '0';
+ pid /= 10;
+ }
+
+ /*
+ * check the target directory; if you have six X's and it
+ * doesn't exist this runs for a *very* long time.
+ */
+ for (start = trv + 1;; --trv) {
+ if (trv <= path)
+ break;
+ if (*trv == '/') {
+ *trv = '\0';
+ if (stat(path, &sbuf))
+ return(0);
+ if (!S_ISDIR(sbuf.st_mode)) {
+ errno = ENOTDIR;
+ return(0);
+ }
+ *trv = '/';
+ break;
+ }
+ }
+
+ for (;;) {
+ if (doopen) {
+ if ((*doopen =
+ open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0)
+ return(1);
+ if (errno != EEXIST)
+ return(0);
+ }
+ else if (stat(path, &sbuf))
+ return(errno == ENOENT ? 1 : 0);
+
+ /* tricky little algorithm for backward compatibility */
+ for (trv = start;;) {
+ if (!*trv)
+ return(0);
+ if (*trv == 'z')
+ *trv++ = 'a';
+ else {
+ if (isdigit(*trv))
+ *trv = 'a';
+ else
+ ++*trv;
+ break;
+ }
+ }
+ }
+ /*NOTREACHED*/
+}
+
+#endif /*NEED_MKTEMP*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/putenv.c b/usr/src/lib/libresolv2_joy/common/bsd/putenv.c
new file mode 100644
index 0000000000..2dcbc57e6c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/putenv.c
@@ -0,0 +1,27 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: putenv.c,v 1.2 2005/04/27 04:56:11 sra Exp $";
+#endif
+
+#include "port_before.h"
+#include "port_after.h"
+
+/*%
+ * To give a little credit to Sun, SGI,
+ * and many vendors in the SysV world.
+ */
+
+#if !defined(NEED_PUTENV)
+int __bindcompat_putenv;
+#else
+int
+putenv(char *str) {
+ char *tmp;
+
+ for (tmp = str; *tmp && (*tmp != '='); tmp++)
+ ;
+
+ return (setenv(str, tmp, 1));
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/readv.c b/usr/src/lib/libresolv2_joy/common/bsd/readv.c
new file mode 100644
index 0000000000..5fa691a92f
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/readv.c
@@ -0,0 +1,39 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: readv.c,v 1.2 2005/04/27 04:56:11 sra Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+
+#include "port_after.h"
+
+#ifndef NEED_READV
+int __bindcompat_readv;
+#else
+
+int
+__readv(fd, vp, vpcount)
+ int fd;
+ const struct iovec *vp;
+ int vpcount;
+{
+ int count = 0;
+
+ while (vpcount-- > 0) {
+ int bytes = read(fd, vp->iov_base, vp->iov_len);
+
+ if (bytes < 0)
+ return (-1);
+ count += bytes;
+ if (bytes != vp->iov_len)
+ break;
+ vp++;
+ }
+ return (count);
+}
+#endif /* NEED_READV */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/setenv.c b/usr/src/lib/libresolv2_joy/common/bsd/setenv.c
new file mode 100644
index 0000000000..baf00f6ff2
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/setenv.c
@@ -0,0 +1,151 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)setenv.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: setenv.c,v 1.2 2005/04/27 04:56:11 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 1987, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "port_before.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "port_after.h"
+
+#if !defined(NEED_SETENV)
+int __bindcompat_setenv;
+#else
+
+extern char **environ;
+
+static char *findenv(const char *name, int *offset);
+
+/*%
+ * setenv --
+ * Set the value of the environmental variable "name" to be
+ * "value". If rewrite is set, replace any current value.
+ */
+setenv(const char *name, const char *value, int rewrite) {
+ extern char **environ;
+ static int alloced; /*%< if allocated space before */
+ char *c;
+ int l_value, offset;
+
+ if (*value == '=') /*%< no `=' in value */
+ ++value;
+ l_value = strlen(value);
+ if ((c = findenv(name, &offset))) { /*%< find if already exists */
+ if (!rewrite)
+ return (0);
+ if (strlen(c) >= l_value) { /*%< old larger; copy over */
+ while (*c++ = *value++);
+ return (0);
+ }
+ } else { /*%< create new slot */
+ int cnt;
+ char **p;
+
+ for (p = environ, cnt = 0; *p; ++p, ++cnt);
+ if (alloced) { /*%< just increase size */
+ environ = (char **)realloc((char *)environ,
+ (size_t)(sizeof(char *) * (cnt + 2)));
+ if (!environ)
+ return (-1);
+ }
+ else { /*%< get new space */
+ alloced = 1; /*%< copy old entries into it */
+ p = malloc((size_t)(sizeof(char *) * (cnt + 2)));
+ if (!p)
+ return (-1);
+ memcpy(p, environ, cnt * sizeof(char *));
+ environ = p;
+ }
+ environ[cnt + 1] = NULL;
+ offset = cnt;
+ }
+ for (c = (char *)name; *c && *c != '='; ++c); /*%< no `=' in name */
+ if (!(environ[offset] = /*%< name + `=' + value */
+ malloc((size_t)((int)(c - name) + l_value + 2))))
+ return (-1);
+ for (c = environ[offset]; (*c = *name++) && *c != '='; ++c);
+ for (*c++ = '='; *c++ = *value++;);
+ return (0);
+}
+
+/*%
+ * unsetenv(name) --
+ * Delete environmental variable "name".
+ */
+void
+unsetenv(const char *name) {
+ char **p;
+ int offset;
+
+ while (findenv(name, &offset)) /*%< if set multiple times */
+ for (p = &environ[offset];; ++p)
+ if (!(*p = *(p + 1)))
+ break;
+}
+
+/*%
+ * findenv --
+ * Returns pointer to value associated with name, if any, else NULL.
+ * Sets offset to be the offset of the name/value combination in the
+ * environmental array, for use by setenv(3) and unsetenv(3).
+ * Explicitly removes '=' in argument name.
+ *
+ * This routine *should* be a static; don't use it.
+ */
+static char *
+findenv(const char *name, int *offset) {
+ const char *np;
+ char **p, *c;
+ int len;
+
+ if (name == NULL || environ == NULL)
+ return (NULL);
+ for (np = name; *np && *np != '='; ++np)
+ continue;
+ len = np - name;
+ for (p = environ; (c = *p) != NULL; ++p)
+ if (strncmp(c, name, len) == 0 && c[len] == '=') {
+ *offset = p - environ;
+ return (c + len + 1);
+ }
+ return (NULL);
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/setitimer.c b/usr/src/lib/libresolv2_joy/common/bsd/setitimer.c
new file mode 100644
index 0000000000..67881d7ca8
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/setitimer.c
@@ -0,0 +1,29 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: setitimer.c,v 1.2 2005/04/27 04:56:12 sra Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/time.h>
+
+#include "port_after.h"
+
+/*%
+ * Setitimer emulation routine.
+ */
+#ifndef NEED_SETITIMER
+int __bindcompat_setitimer;
+#else
+
+int
+__setitimer(int which, const struct itimerval *value,
+ struct itimerval *ovalue)
+{
+ if (alarm(value->it_value.tv_sec) >= 0)
+ return (0);
+ else
+ return (-1);
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/strcasecmp.c b/usr/src/lib/libresolv2_joy/common/bsd/strcasecmp.c
new file mode 100644
index 0000000000..0c9f0dccf0
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/strcasecmp.c
@@ -0,0 +1,124 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: strcasecmp.c,v 1.2 2005/04/27 04:56:12 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 1987, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+#include <string.h>
+
+#include "port_after.h"
+
+#ifndef NEED_STRCASECMP
+int __strcasecmp_unneeded__;
+#else
+
+/*%
+ * This array is designed for mapping upper and lower case letter
+ * together for a case independent comparison. The mappings are
+ * based upon ascii character sequences.
+ */
+static const u_char charmap[] = {
+ 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007,
+ 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017,
+ 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027,
+ 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037,
+ 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047,
+ 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057,
+ 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067,
+ 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077,
+ 0100, 0141, 0142, 0143, 0144, 0145, 0146, 0147,
+ 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
+ 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167,
+ 0170, 0171, 0172, 0133, 0134, 0135, 0136, 0137,
+ 0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147,
+ 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
+ 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167,
+ 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177,
+ 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
+ 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
+ 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
+ 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
+ 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
+ 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
+ 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
+ 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
+ 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
+ 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
+ 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
+ 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
+ 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
+ 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
+ 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
+ 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
+};
+
+int
+strcasecmp(const char *s1, const char *s2) {
+ const u_char *cm = charmap,
+ *us1 = (const u_char *)s1,
+ *us2 = (const u_char *)s2;
+
+ while (cm[*us1] == cm[*us2++])
+ if (*us1++ == '\0')
+ return (0);
+ return (cm[*us1] - cm[*--us2]);
+}
+
+int
+strncasecmp(const char *s1, const char *s2, size_t n) {
+ if (n != 0) {
+ const u_char *cm = charmap,
+ *us1 = (const u_char *)s1,
+ *us2 = (const u_char *)s2;
+
+ do {
+ if (cm[*us1] != cm[*us2++])
+ return (cm[*us1] - cm[*--us2]);
+ if (*us1++ == '\0')
+ break;
+ } while (--n != 0);
+ }
+ return (0);
+}
+
+#endif /*NEED_STRCASECMP*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/strdup.c b/usr/src/lib/libresolv2_joy/common/bsd/strdup.c
new file mode 100644
index 0000000000..a8d31e9587
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/strdup.c
@@ -0,0 +1,20 @@
+#include "port_before.h"
+
+#include <stdlib.h>
+
+#include "port_after.h"
+
+#ifndef NEED_STRDUP
+int __bind_strdup_unneeded;
+#else
+char *
+strdup(const char *src) {
+ char *dst = malloc(strlen(src) + 1);
+
+ if (dst)
+ strcpy(dst, src);
+ return (dst);
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/strerror.c b/usr/src/lib/libresolv2_joy/common/bsd/strerror.c
new file mode 100644
index 0000000000..5973e63d5b
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/strerror.c
@@ -0,0 +1,94 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: strerror.c,v 1.6 2008/02/18 03:49:08 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "port_after.h"
+
+#ifndef NEED_STRERROR
+int __strerror_unneeded__;
+#else
+
+#ifdef USE_SYSERROR_LIST
+extern int sys_nerr;
+extern char *sys_errlist[];
+#endif
+
+const char *
+isc_strerror(int num) {
+#define UPREFIX "Unknown error: "
+ static char ebuf[40] = UPREFIX; /*%< 64-bit number + slop */
+ u_int errnum;
+ char *p, *t;
+#ifndef USE_SYSERROR_LIST
+ const char *ret;
+#endif
+ char tmp[40];
+
+ errnum = num; /*%< convert to unsigned */
+#ifdef USE_SYSERROR_LIST
+ if (errnum < (u_int)sys_nerr)
+ return (sys_errlist[errnum]);
+#else
+#undef strerror
+ ret = strerror(num); /*%< call strerror() in libc */
+ if (ret != NULL)
+ return(ret);
+#endif
+
+ /* Do this by hand, so we don't include stdio(3). */
+ t = tmp;
+ do {
+ *t++ = "0123456789"[errnum % 10];
+ } while (errnum /= 10);
+ for (p = ebuf + sizeof(UPREFIX) - 1;;) {
+ *p++ = *--t;
+ if (t <= tmp)
+ break;
+ }
+ return (ebuf);
+}
+
+#endif /*NEED_STRERROR*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/strpbrk.c b/usr/src/lib/libresolv2_joy/common/bsd/strpbrk.c
new file mode 100644
index 0000000000..4c12d88e1c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/strpbrk.c
@@ -0,0 +1,70 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)strpbrk.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: strpbrk.c,v 1.2 2005/04/27 04:56:12 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 1985, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/cdefs.h>
+
+#include <string.h>
+
+#include "port_after.h"
+
+#ifndef NEED_STRPBRK
+int __strpbrk_unneeded__;
+#else
+
+/*%
+ * Find the first occurrence in s1 of a character in s2 (excluding NUL).
+ */
+char *
+strpbrk(const char *s1, const char *s2) {
+ const char *scanp;
+ int c, sc;
+
+ while ((c = *s1++) != 0) {
+ for (scanp = s2; (sc = *scanp++) != 0;)
+ if (sc == c)
+ return ((char *)(s1 - 1));
+ }
+ return (NULL);
+}
+
+#endif /*NEED_STRPBRK*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/strsep.c b/usr/src/lib/libresolv2_joy/common/bsd/strsep.c
new file mode 100644
index 0000000000..c7969f0028
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/strsep.c
@@ -0,0 +1,88 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "strsep.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: strsep.c,v 1.2 2005/04/27 04:56:12 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "port_before.h"
+#include <sys/cdefs.h>
+#include <string.h>
+#include <stdio.h>
+#include "port_after.h"
+
+#ifndef NEED_STRSEP
+int __strsep_unneeded__;
+#else
+
+/*%
+ * Get next token from string *stringp, where tokens are possibly-empty
+ * strings separated by characters from delim.
+ *
+ * Writes NULs into the string at *stringp to end tokens.
+ * delim need not remain constant from call to call.
+ * On return, *stringp points past the last NUL written (if there might
+ * be further tokens), or is NULL (if there are definitely no more tokens).
+ *
+ * If *stringp is NULL, strsep returns NULL.
+ */
+char *
+strsep(char **stringp, const char *delim) {
+ char *s;
+ const char *spanp;
+ int c, sc;
+ char *tok;
+
+ if ((s = *stringp) == NULL)
+ return (NULL);
+ for (tok = s;;) {
+ c = *s++;
+ spanp = delim;
+ do {
+ if ((sc = *spanp++) == c) {
+ if (c == 0)
+ s = NULL;
+ else
+ s[-1] = 0;
+ *stringp = s;
+ return (tok);
+ }
+ } while (sc != 0);
+ }
+ /* NOTREACHED */
+}
+
+#endif /*NEED_STRSEP*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/strtoul.c b/usr/src/lib/libresolv2_joy/common/bsd/strtoul.c
new file mode 100644
index 0000000000..b37ff72729
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/strtoul.c
@@ -0,0 +1,119 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: strtoul.c,v 1.4 2008/02/18 03:49:08 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "port_after.h"
+
+#ifndef NEED_STRTOUL
+int __strtoul_unneeded__;
+#else
+
+/*%
+ * Convert a string to an unsigned long integer.
+ *
+ * Ignores `locale' stuff. Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+u_long
+strtoul(const char *nptr, char **endptr, int base) {
+ const char *s = nptr;
+ u_long acc, cutoff;
+ int neg, c, any, cutlim;
+
+ neg = 0;
+
+ /*
+ * See strtol for comments as to the logic used.
+ */
+ do {
+ c = *(const unsigned char *)s++;
+ } while (isspace(c));
+ if (c == '-') {
+ neg = 1;
+ c = *s++;
+ } else if (c == '+')
+ c = *s++;
+ if ((base == 0 || base == 16) &&
+ c == '0' && (*s == 'x' || *s == 'X')) {
+ c = s[1];
+ s += 2;
+ base = 16;
+ }
+ if (base == 0)
+ base = c == '0' ? 8 : 10;
+ cutoff = (u_long)ULONG_MAX / (u_long)base;
+ cutlim = (u_long)ULONG_MAX % (u_long)base;
+ for (acc = 0, any = 0;; c = *(const unsigned char*)s++) {
+ if (isdigit(c))
+ c -= '0';
+ else if (isalpha(c))
+ c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+ else
+ break;
+ if (c >= base)
+ break;
+ if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+ any = -1;
+ else {
+ any = 1;
+ acc *= base;
+ acc += c;
+ }
+ }
+ if (any < 0) {
+ acc = ULONG_MAX;
+ errno = ERANGE;
+ } else if (neg)
+ acc = -acc;
+ if (endptr != 0)
+ DE_CONST((any ? s - 1 : nptr), *endptr);
+ return (acc);
+}
+
+#endif /*NEED_STRTOUL*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/utimes.c b/usr/src/lib/libresolv2_joy/common/bsd/utimes.c
new file mode 100644
index 0000000000..2f65cffe25
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/utimes.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1997,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <utime.h>
+
+#include "port_after.h"
+
+#ifndef NEED_UTIMES
+int __bind_utimes_unneeded;
+#else
+
+int
+__utimes(char *filename, struct timeval *tvp) {
+ struct utimbuf utb;
+
+ utb.actime = (time_t)tvp[0].tv_sec;
+ utb.modtime = (time_t)tvp[1].tv_sec;
+ return (utime(filename, &utb));
+}
+
+#endif /* NEED_UTIMES */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/bsd/writev.c b/usr/src/lib/libresolv2_joy/common/bsd/writev.c
new file mode 100644
index 0000000000..65baa71cfc
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/bsd/writev.c
@@ -0,0 +1,89 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: writev.c,v 1.3 2005/04/27 04:56:13 sra Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+
+#include "port_after.h"
+
+#ifndef NEED_WRITEV
+int __bindcompat_writev;
+#else
+
+#ifdef _CRAY
+#define OWN_WRITEV
+int
+__writev(int fd, struct iovec *iov, int iovlen)
+{
+ struct stat statbuf;
+
+ if (fstat(fd, &statbuf) < 0)
+ return (-1);
+
+ /*
+ * Allow for atomic writes to network.
+ */
+ if (statbuf.st_mode & S_IFSOCK) {
+ struct msghdr mesg;
+
+ memset(&mesg, 0, sizeof(mesg));
+ mesg.msg_name = 0;
+ mesg.msg_namelen = 0;
+ mesg.msg_iov = iov;
+ mesg.msg_iovlen = iovlen;
+ mesg.msg_accrights = 0;
+ mesg.msg_accrightslen = 0;
+ return (sendmsg(fd, &mesg, 0));
+ } else {
+ struct iovec *tv;
+ int i, rcode = 0, count = 0;
+
+ for (i = 0, tv = iov; i <= iovlen; tv++) {
+ rcode = write(fd, tv->iov_base, tv->iov_len);
+
+ if (rcode < 0)
+ break;
+
+ count += rcode;
+ }
+
+ if (count == 0)
+ return (rcode);
+ else
+ return (count);
+ }
+}
+
+#else /*_CRAY*/
+
+int
+__writev(fd, vp, vpcount)
+ int fd;
+ const struct iovec *vp;
+ int vpcount;
+{
+ int count = 0;
+
+ while (vpcount-- > 0) {
+ int written = write(fd, vp->iov_base, vp->iov_len);
+
+ if (written < 0)
+ return (-1);
+ count += written;
+ if (written != vp->iov_len)
+ break;
+ vp++;
+ }
+ return (count);
+}
+
+#endif /*_CRAY*/
+
+#endif /*NEED_WRITEV*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/dst/dst_api.c b/usr/src/lib/libresolv2_joy/common/dst/dst_api.c
new file mode 100644
index 0000000000..a3e48077ad
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/dst/dst_api.c
@@ -0,0 +1,1048 @@
+#ifndef LINT
+static const char rcsid[] = "$Header: /proj/cvs/prod/libbind/dst/dst_api.c,v 1.17 2007/09/24 17:18:25 each Exp $";
+#endif
+
+/*
+ * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
+ *
+ * Permission to use, copy modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TRUSTED INFORMATION SYSTEMS
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * TRUSTED INFORMATION SYSTEMS BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
+ */
+/*
+ * This file contains the interface between the DST API and the crypto API.
+ * This is the only file that needs to be changed if the crypto system is
+ * changed. Exported functions are:
+ * void dst_init() Initialize the toolkit
+ * int dst_check_algorithm() Function to determines if alg is suppored.
+ * int dst_compare_keys() Function to compare two keys for equality.
+ * int dst_sign_data() Incremental signing routine.
+ * int dst_verify_data() Incremental verify routine.
+ * int dst_generate_key() Function to generate new KEY
+ * DST_KEY *dst_read_key() Function to retrieve private/public KEY.
+ * void dst_write_key() Function to write out a key.
+ * DST_KEY *dst_dnskey_to_key() Function to convert DNS KEY RR to a DST
+ * KEY structure.
+ * int dst_key_to_dnskey() Function to return a public key in DNS
+ * format binary
+ * DST_KEY *dst_buffer_to_key() Converst a data in buffer to KEY
+ * int *dst_key_to_buffer() Writes out DST_KEY key matterial in buffer
+ * void dst_free_key() Releases all memory referenced by key structure
+ */
+
+#include "port_before.h"
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <ctype.h>
+#include <time.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include "dst_internal.h"
+#include "port_after.h"
+
+/* static variables */
+static int done_init = 0;
+dst_func *dst_t_func[DST_MAX_ALGS];
+const char *key_file_fmt_str = "Private-key-format: v%s\nAlgorithm: %d (%s)\n";
+const char *dst_path = "";
+
+/* internal I/O functions */
+static DST_KEY *dst_s_read_public_key(const char *in_name,
+ const u_int16_t in_id, int in_alg);
+static int dst_s_read_private_key_file(char *name, DST_KEY *pk_key,
+ u_int16_t in_id, int in_alg);
+static int dst_s_write_public_key(const DST_KEY *key);
+static int dst_s_write_private_key(const DST_KEY *key);
+
+/* internal function to set up data structure */
+static DST_KEY *dst_s_get_key_struct(const char *name, const int alg,
+ const int flags, const int protocol,
+ const int bits);
+
+/*%
+ * dst_init
+ * This function initializes the Digital Signature Toolkit.
+ * Right now, it just checks the DSTKEYPATH environment variable.
+ * Parameters
+ * none
+ * Returns
+ * none
+ */
+void
+dst_init()
+{
+ char *s;
+ int len;
+
+ if (done_init != 0)
+ return;
+ done_init = 1;
+
+ s = getenv("DSTKEYPATH");
+ len = 0;
+ if (s) {
+ struct stat statbuf;
+
+ len = strlen(s);
+ if (len > PATH_MAX) {
+ EREPORT(("%s is longer than %d characters, ignoring\n",
+ s, PATH_MAX));
+ } else if (stat(s, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) {
+ EREPORT(("%s is not a valid directory\n", s));
+ } else {
+ char *tmp;
+ tmp = (char *) malloc(len + 2);
+ memcpy(tmp, s, len + 1);
+ if (tmp[strlen(tmp) - 1] != '/') {
+ tmp[strlen(tmp) + 1] = 0;
+ tmp[strlen(tmp)] = '/';
+ }
+ dst_path = tmp;
+ }
+ }
+ memset(dst_t_func, 0, sizeof(dst_t_func));
+ /* first one is selected */
+ dst_hmac_md5_init();
+}
+
+/*%
+ * dst_check_algorithm
+ * This function determines if the crypto system for the specified
+ * algorithm is present.
+ * Parameters
+ * alg 1 KEY_RSA
+ * 3 KEY_DSA
+ * 157 KEY_HMAC_MD5
+ * future algorithms TBD and registered with IANA.
+ * Returns
+ * 1 - The algorithm is available.
+ * 0 - The algorithm is not available.
+ */
+int
+dst_check_algorithm(const int alg)
+{
+ return (dst_t_func[alg] != NULL);
+}
+
+/*%
+ * dst_s_get_key_struct
+ * This function allocates key structure and fills in some of the
+ * fields of the structure.
+ * Parameters:
+ * name: the name of the key
+ * alg: the algorithm number
+ * flags: the dns flags of the key
+ * protocol: the dns protocol of the key
+ * bits: the size of the key
+ * Returns:
+ * NULL if error
+ * valid pointer otherwise
+ */
+static DST_KEY *
+dst_s_get_key_struct(const char *name, const int alg, const int flags,
+ const int protocol, const int bits)
+{
+ DST_KEY *new_key = NULL;
+
+ if (dst_check_algorithm(alg)) /*%< make sure alg is available */
+ new_key = (DST_KEY *) malloc(sizeof(*new_key));
+ if (new_key == NULL)
+ return (NULL);
+
+ memset(new_key, 0, sizeof(*new_key));
+ new_key->dk_key_name = strdup(name);
+ if (new_key->dk_key_name == NULL) {
+ free(new_key);
+ return (NULL);
+ }
+ new_key->dk_alg = alg;
+ new_key->dk_flags = flags;
+ new_key->dk_proto = protocol;
+ new_key->dk_KEY_struct = NULL;
+ new_key->dk_key_size = bits;
+ new_key->dk_func = dst_t_func[alg];
+ return (new_key);
+}
+
+/*%
+ * dst_compare_keys
+ * Compares two keys for equality.
+ * Parameters
+ * key1, key2 Two keys to be compared.
+ * Returns
+ * 0 The keys are equal.
+ * non-zero The keys are not equal.
+ */
+
+int
+dst_compare_keys(const DST_KEY *key1, const DST_KEY *key2)
+{
+ if (key1 == key2)
+ return (0);
+ if (key1 == NULL || key2 == NULL)
+ return (4);
+ if (key1->dk_alg != key2->dk_alg)
+ return (1);
+ if (key1->dk_key_size != key2->dk_key_size)
+ return (2);
+ if (key1->dk_id != key2->dk_id)
+ return (3);
+ return (key1->dk_func->compare(key1, key2));
+}
+
+/*%
+ * dst_sign_data
+ * An incremental signing function. Data is signed in steps.
+ * First the context must be initialized (SIG_MODE_INIT).
+ * Then data is hashed (SIG_MODE_UPDATE). Finally the signature
+ * itself is created (SIG_MODE_FINAL). This function can be called
+ * once with INIT, UPDATE and FINAL modes all set, or it can be
+ * called separately with a different mode set for each step. The
+ * UPDATE step can be repeated.
+ * Parameters
+ * mode A bit mask used to specify operation(s) to be performed.
+ * SIG_MODE_INIT 1 Initialize digest
+ * SIG_MODE_UPDATE 2 Add data to digest
+ * SIG_MODE_FINAL 4 Generate signature
+ * from signature
+ * SIG_MODE_ALL (SIG_MODE_INIT,SIG_MODE_UPDATE,SIG_MODE_FINAL
+ * data Data to be signed.
+ * len The length in bytes of data to be signed.
+ * in_key Contains a private key to sign with.
+ * KEY structures should be handled (created, converted,
+ * compared, stored, freed) by the DST.
+ * signature
+ * The location to which the signature will be written.
+ * sig_len Length of the signature field in bytes.
+ * Return
+ * 0 Successfull INIT or Update operation
+ * &gt;0 success FINAL (sign) operation
+ * &lt;0 failure
+ */
+
+int
+dst_sign_data(const int mode, DST_KEY *in_key, void **context,
+ const u_char *data, const int len,
+ u_char *signature, const int sig_len)
+{
+ DUMP(data, mode, len, "dst_sign_data()");
+
+ if (mode & SIG_MODE_FINAL &&
+ (in_key->dk_KEY_struct == NULL || signature == NULL))
+ return (MISSING_KEY_OR_SIGNATURE);
+
+ if (in_key->dk_func && in_key->dk_func->sign)
+ return (in_key->dk_func->sign(mode, in_key, context, data, len,
+ signature, sig_len));
+ return (UNKNOWN_KEYALG);
+}
+
+/*%
+ * dst_verify_data
+ * An incremental verify function. Data is verified in steps.
+ * First the context must be initialized (SIG_MODE_INIT).
+ * Then data is hashed (SIG_MODE_UPDATE). Finally the signature
+ * is verified (SIG_MODE_FINAL). This function can be called
+ * once with INIT, UPDATE and FINAL modes all set, or it can be
+ * called separately with a different mode set for each step. The
+ * UPDATE step can be repeated.
+ * Parameters
+ * mode Operations to perform this time.
+ * SIG_MODE_INIT 1 Initialize digest
+ * SIG_MODE_UPDATE 2 add data to digest
+ * SIG_MODE_FINAL 4 verify signature
+ * SIG_MODE_ALL
+ * (SIG_MODE_INIT,SIG_MODE_UPDATE,SIG_MODE_FINAL)
+ * data Data to pass through the hash function.
+ * len Length of the data in bytes.
+ * in_key Key for verification.
+ * signature Location of signature.
+ * sig_len Length of the signature in bytes.
+ * Returns
+ * 0 Verify success
+ * Non-Zero Verify Failure
+ */
+
+int
+dst_verify_data(const int mode, DST_KEY *in_key, void **context,
+ const u_char *data, const int len,
+ const u_char *signature, const int sig_len)
+{
+ DUMP(data, mode, len, "dst_verify_data()");
+ if (mode & SIG_MODE_FINAL &&
+ (in_key->dk_KEY_struct == NULL || signature == NULL))
+ return (MISSING_KEY_OR_SIGNATURE);
+
+ if (in_key->dk_func == NULL || in_key->dk_func->verify == NULL)
+ return (UNSUPPORTED_KEYALG);
+ return (in_key->dk_func->verify(mode, in_key, context, data, len,
+ signature, sig_len));
+}
+
+/*%
+ * dst_read_private_key
+ * Access a private key. First the list of private keys that have
+ * already been read in is searched, then the key accessed on disk.
+ * If the private key can be found, it is returned. If the key cannot
+ * be found, a null pointer is returned. The options specify required
+ * key characteristics. If the private key requested does not have
+ * these characteristics, it will not be read.
+ * Parameters
+ * in_keyname The private key name.
+ * in_id The id of the private key.
+ * options DST_FORCE_READ Read from disk - don't use a previously
+ * read key.
+ * DST_CAN_SIGN The key must be useable for signing.
+ * DST_NO_AUTHEN The key must be useable for authentication.
+ * DST_STANDARD Return any key
+ * Returns
+ * NULL If there is no key found in the current directory or
+ * this key has not been loaded before.
+ * !NULL Success - KEY structure returned.
+ */
+
+DST_KEY *
+dst_read_key(const char *in_keyname, const u_int16_t in_id,
+ const int in_alg, const int type)
+{
+ char keyname[PATH_MAX];
+ DST_KEY *dg_key = NULL, *pubkey = NULL;
+
+ if (!dst_check_algorithm(in_alg)) { /*%< make sure alg is available */
+ EREPORT(("dst_read_private_key(): Algorithm %d not suppored\n",
+ in_alg));
+ return (NULL);
+ }
+ if ((type & (DST_PUBLIC | DST_PRIVATE)) == 0)
+ return (NULL);
+ if (in_keyname == NULL) {
+ EREPORT(("dst_read_private_key(): Null key name passed in\n"));
+ return (NULL);
+ } else if (strlen(in_keyname) >= sizeof(keyname)) {
+ EREPORT(("dst_read_private_key(): keyname too big\n"));
+ return (NULL);
+ } else
+ strcpy(keyname, in_keyname);
+
+ /* before I read in the public key, check if it is allowed to sign */
+ if ((pubkey = dst_s_read_public_key(keyname, in_id, in_alg)) == NULL)
+ return (NULL);
+
+ if (type == DST_PUBLIC)
+ return pubkey;
+
+ if (!(dg_key = dst_s_get_key_struct(keyname, pubkey->dk_alg,
+ pubkey->dk_flags, pubkey->dk_proto,
+ 0)))
+ return (dg_key);
+ /* Fill in private key and some fields in the general key structure */
+ if (dst_s_read_private_key_file(keyname, dg_key, pubkey->dk_id,
+ pubkey->dk_alg) == 0)
+ dg_key = dst_free_key(dg_key);
+
+ (void)dst_free_key(pubkey);
+ return (dg_key);
+}
+
+int
+dst_write_key(const DST_KEY *key, const int type)
+{
+ int pub = 0, priv = 0;
+
+ if (key == NULL)
+ return (0);
+ if (!dst_check_algorithm(key->dk_alg)) { /*%< make sure alg is available */
+ EREPORT(("dst_write_key(): Algorithm %d not suppored\n",
+ key->dk_alg));
+ return (UNSUPPORTED_KEYALG);
+ }
+ if ((type & (DST_PRIVATE|DST_PUBLIC)) == 0)
+ return (0);
+
+ if (type & DST_PUBLIC)
+ if ((pub = dst_s_write_public_key(key)) < 0)
+ return (pub);
+ if (type & DST_PRIVATE)
+ if ((priv = dst_s_write_private_key(key)) < 0)
+ return (priv);
+ return (priv+pub);
+}
+
+/*%
+ * dst_write_private_key
+ * Write a private key to disk. The filename will be of the form:
+ * K&lt;key-&gt;dk_name&gt;+&lt;key-&gt;dk_alg+&gt;&lt;key-d&gt;k_id.&gt;&lt;private key suffix&gt;.
+ * If there is already a file with this name, an error is returned.
+ *
+ * Parameters
+ * key A DST managed key structure that contains
+ * all information needed about a key.
+ * Return
+ * &gt;= 0 Correct behavior. Returns length of encoded key value
+ * written to disk.
+ * &lt; 0 error.
+ */
+
+static int
+dst_s_write_private_key(const DST_KEY *key)
+{
+ u_char encoded_block[RAW_KEY_SIZE];
+ char file[PATH_MAX];
+ int len;
+ FILE *fp;
+
+ /* First encode the key into the portable key format */
+ if (key == NULL)
+ return (-1);
+ if (key->dk_KEY_struct == NULL)
+ return (0); /*%< null key has no private key */
+ if (key->dk_func == NULL || key->dk_func->to_file_fmt == NULL) {
+ EREPORT(("dst_write_private_key(): Unsupported operation %d\n",
+ key->dk_alg));
+ return (-5);
+ } else if ((len = key->dk_func->to_file_fmt(key, (char *)encoded_block,
+ sizeof(encoded_block))) <= 0) {
+ EREPORT(("dst_write_private_key(): Failed encoding private RSA bsafe key %d\n", len));
+ return (-8);
+ }
+ /* Now I can create the file I want to use */
+ dst_s_build_filename(file, key->dk_key_name, key->dk_id, key->dk_alg,
+ PRIVATE_KEY, PATH_MAX);
+
+ /* Do not overwrite an existing file */
+ if ((fp = dst_s_fopen(file, "w", 0600)) != NULL) {
+ int nn;
+ if ((nn = fwrite(encoded_block, 1, len, fp)) != len) {
+ EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n",
+ file, len, nn, errno));
+ fclose(fp);
+ return (-5);
+ }
+ fclose(fp);
+ } else {
+ EREPORT(("dst_write_private_key(): Can not create file %s\n"
+ ,file));
+ return (-6);
+ }
+ memset(encoded_block, 0, len);
+ return (len);
+}
+
+/*%
+*
+ * dst_read_public_key
+ * Read a public key from disk and store in a DST key structure.
+ * Parameters
+ * in_name K&lt;in_name&gt;&lt;in_id&gt;.&lt;public key suffix&gt; is the
+ * filename of the key file to be read.
+ * Returns
+ * NULL If the key does not exist or no name is supplied.
+ * NON-NULL Initialized key structure if the key exists.
+ */
+
+static DST_KEY *
+dst_s_read_public_key(const char *in_name, const u_int16_t in_id, int in_alg)
+{
+ int flags, proto, alg, len, dlen;
+ int c;
+ char name[PATH_MAX], enckey[RAW_KEY_SIZE], *notspace;
+ u_char deckey[RAW_KEY_SIZE];
+ FILE *fp;
+
+ if (in_name == NULL) {
+ EREPORT(("dst_read_public_key(): No key name given\n"));
+ return (NULL);
+ }
+ if (dst_s_build_filename(name, in_name, in_id, in_alg, PUBLIC_KEY,
+ PATH_MAX) == -1) {
+ EREPORT(("dst_read_public_key(): Cannot make filename from %s, %d, and %s\n",
+ in_name, in_id, PUBLIC_KEY));
+ return (NULL);
+ }
+ /*
+ * Open the file and read it's formatted contents up to key
+ * File format:
+ * domain.name [ttl] [IN] KEY &lt;flags&gt; &lt;protocol&gt; &lt;algorithm&gt; &lt;key&gt;
+ * flags, proto, alg stored as decimal (or hex numbers FIXME).
+ * (FIXME: handle parentheses for line continuation.)
+ */
+ if ((fp = dst_s_fopen(name, "r", 0)) == NULL) {
+ EREPORT(("dst_read_public_key(): Public Key not found %s\n",
+ name));
+ return (NULL);
+ }
+ /* Skip domain name, which ends at first blank */
+ while ((c = getc(fp)) != EOF)
+ if (isspace(c))
+ break;
+ /* Skip blank to get to next field */
+ while ((c = getc(fp)) != EOF)
+ if (!isspace(c))
+ break;
+
+ /* Skip optional TTL -- if initial digit, skip whole word. */
+ if (isdigit(c)) {
+ while ((c = getc(fp)) != EOF)
+ if (isspace(c))
+ break;
+ while ((c = getc(fp)) != EOF)
+ if (!isspace(c))
+ break;
+ }
+ /* Skip optional "IN" */
+ if (c == 'I' || c == 'i') {
+ while ((c = getc(fp)) != EOF)
+ if (isspace(c))
+ break;
+ while ((c = getc(fp)) != EOF)
+ if (!isspace(c))
+ break;
+ }
+ /* Locate and skip "KEY" */
+ if (c != 'K' && c != 'k') {
+ EREPORT(("\"KEY\" doesn't appear in file: %s", name));
+ return NULL;
+ }
+ while ((c = getc(fp)) != EOF)
+ if (isspace(c))
+ break;
+ while ((c = getc(fp)) != EOF)
+ if (!isspace(c))
+ break;
+ ungetc(c, fp); /*%< return the charcter to the input field */
+ /* Handle hex!! FIXME. */
+
+ if (fscanf(fp, "%d %d %d", &flags, &proto, &alg) != 3) {
+ EREPORT(("dst_read_public_key(): Can not read flag/proto/alg field from %s\n"
+ ,name));
+ return (NULL);
+ }
+ /* read in the key string */
+ fgets(enckey, sizeof(enckey), fp);
+
+ /* If we aren't at end-of-file, something is wrong. */
+ while ((c = getc(fp)) != EOF)
+ if (!isspace(c))
+ break;
+ if (!feof(fp)) {
+ EREPORT(("Key too long in file: %s", name));
+ return NULL;
+ }
+ fclose(fp);
+
+ if ((len = strlen(enckey)) <= 0)
+ return (NULL);
+
+ /* discard \n */
+ enckey[--len] = '\0';
+
+ /* remove leading spaces */
+ for (notspace = (char *) enckey; isspace((*notspace)&0xff); len--)
+ notspace++;
+
+ dlen = b64_pton(notspace, deckey, sizeof(deckey));
+ if (dlen < 0) {
+ EREPORT(("dst_read_public_key: bad return from b64_pton = %d",
+ dlen));
+ return (NULL);
+ }
+ /* store key and info in a key structure that is returned */
+/* return dst_store_public_key(in_name, alg, proto, 666, flags, deckey,
+ dlen);*/
+ return dst_buffer_to_key(in_name, alg, flags, proto, deckey, dlen);
+}
+
+/*%
+ * dst_write_public_key
+ * Write a key to disk in DNS format.
+ * Parameters
+ * key Pointer to a DST key structure.
+ * Returns
+ * 0 Failure
+ * 1 Success
+ */
+
+static int
+dst_s_write_public_key(const DST_KEY *key)
+{
+ FILE *fp;
+ char filename[PATH_MAX];
+ u_char out_key[RAW_KEY_SIZE];
+ char enc_key[RAW_KEY_SIZE];
+ int len = 0;
+ int mode;
+
+ memset(out_key, 0, sizeof(out_key));
+ if (key == NULL) {
+ EREPORT(("dst_write_public_key(): No key specified \n"));
+ return (0);
+ } else if ((len = dst_key_to_dnskey(key, out_key, sizeof(out_key)))< 0)
+ return (0);
+
+ /* Make the filename */
+ if (dst_s_build_filename(filename, key->dk_key_name, key->dk_id,
+ key->dk_alg, PUBLIC_KEY, PATH_MAX) == -1) {
+ EREPORT(("dst_write_public_key(): Cannot make filename from %s, %d, and %s\n",
+ key->dk_key_name, key->dk_id, PUBLIC_KEY));
+ return (0);
+ }
+ /* XXX in general this should be a check for symmetric keys */
+ mode = (key->dk_alg == KEY_HMAC_MD5) ? 0600 : 0644;
+ /* create public key file */
+ if ((fp = dst_s_fopen(filename, "w+", mode)) == NULL) {
+ EREPORT(("DST_write_public_key: open of file:%s failed (errno=%d)\n",
+ filename, errno));
+ return (0);
+ }
+ /*write out key first base64 the key data */
+ if (key->dk_flags & DST_EXTEND_FLAG)
+ b64_ntop(&out_key[6], len - 6, enc_key, sizeof(enc_key));
+ else
+ b64_ntop(&out_key[4], len - 4, enc_key, sizeof(enc_key));
+ fprintf(fp, "%s IN KEY %d %d %d %s\n",
+ key->dk_key_name,
+ key->dk_flags, key->dk_proto, key->dk_alg, enc_key);
+ fclose(fp);
+ return (1);
+}
+
+/*%
+ * dst_dnskey_to_public_key
+ * This function converts the contents of a DNS KEY RR into a DST
+ * key structure.
+ * Paramters
+ * len Length of the RDATA of the KEY RR RDATA
+ * rdata A pointer to the the KEY RR RDATA.
+ * in_name Key name to be stored in key structure.
+ * Returns
+ * NULL Failure
+ * NON-NULL Success. Pointer to key structure.
+ * Caller's responsibility to free() it.
+ */
+
+DST_KEY *
+dst_dnskey_to_key(const char *in_name, const u_char *rdata, const int len)
+{
+ DST_KEY *key_st;
+ int alg ;
+ int start = DST_KEY_START;
+
+ if (rdata == NULL || len <= DST_KEY_ALG) /*%< no data */
+ return (NULL);
+ alg = (u_int8_t) rdata[DST_KEY_ALG];
+ if (!dst_check_algorithm(alg)) { /*%< make sure alg is available */
+ EREPORT(("dst_dnskey_to_key(): Algorithm %d not suppored\n",
+ alg));
+ return (NULL);
+ }
+
+ if (in_name == NULL)
+ return (NULL);
+
+ if ((key_st = dst_s_get_key_struct(in_name, alg, 0, 0, 0)) == NULL)
+ return (NULL);
+
+ key_st->dk_id = dst_s_dns_key_id(rdata, len);
+ key_st->dk_flags = dst_s_get_int16(rdata);
+ key_st->dk_proto = (u_int16_t) rdata[DST_KEY_PROT];
+ if (key_st->dk_flags & DST_EXTEND_FLAG) {
+ u_int32_t ext_flags;
+ ext_flags = (u_int32_t) dst_s_get_int16(&rdata[DST_EXT_FLAG]);
+ key_st->dk_flags = key_st->dk_flags | (ext_flags << 16);
+ start += 2;
+ }
+ /*
+ * now point to the begining of the data representing the encoding
+ * of the key
+ */
+ if (key_st->dk_func && key_st->dk_func->from_dns_key) {
+ if (key_st->dk_func->from_dns_key(key_st, &rdata[start],
+ len - start) > 0)
+ return (key_st);
+ } else
+ EREPORT(("dst_dnskey_to_public_key(): unsuppored alg %d\n",
+ alg));
+
+ SAFE_FREE(key_st);
+ return (key_st);
+}
+
+/*%
+ * dst_public_key_to_dnskey
+ * Function to encode a public key into DNS KEY wire format
+ * Parameters
+ * key Key structure to encode.
+ * out_storage Location to write the encoded key to.
+ * out_len Size of the output array.
+ * Returns
+ * <0 Failure
+ * >=0 Number of bytes written to out_storage
+ */
+
+int
+dst_key_to_dnskey(const DST_KEY *key, u_char *out_storage,
+ const int out_len)
+{
+ u_int16_t val;
+ int loc = 0;
+ int enc_len = 0;
+ if (key == NULL)
+ return (-1);
+
+ if (!dst_check_algorithm(key->dk_alg)) { /*%< make sure alg is available */
+ EREPORT(("dst_key_to_dnskey(): Algorithm %d not suppored\n",
+ key->dk_alg));
+ return (UNSUPPORTED_KEYALG);
+ }
+ memset(out_storage, 0, out_len);
+ val = (u_int16_t)(key->dk_flags & 0xffff);
+ dst_s_put_int16(out_storage, val);
+ loc += 2;
+
+ out_storage[loc++] = (u_char) key->dk_proto;
+ out_storage[loc++] = (u_char) key->dk_alg;
+
+ if (key->dk_flags > 0xffff) { /*%< Extended flags */
+ val = (u_int16_t)((key->dk_flags >> 16) & 0xffff);
+ dst_s_put_int16(&out_storage[loc], val);
+ loc += 2;
+ }
+ if (key->dk_KEY_struct == NULL)
+ return (loc);
+ if (key->dk_func && key->dk_func->to_dns_key) {
+ enc_len = key->dk_func->to_dns_key(key,
+ (u_char *) &out_storage[loc],
+ out_len - loc);
+ if (enc_len > 0)
+ return (enc_len + loc);
+ else
+ return (-1);
+ } else
+ EREPORT(("dst_key_to_dnskey(): Unsupported ALG %d\n",
+ key->dk_alg));
+ return (-1);
+}
+
+/*%
+ * dst_buffer_to_key
+ * Function to encode a string of raw data into a DST key
+ * Parameters
+ * alg The algorithm (HMAC only)
+ * key A pointer to the data
+ * keylen The length of the data
+ * Returns
+ * NULL an error occurred
+ * NON-NULL the DST key
+ */
+DST_KEY *
+dst_buffer_to_key(const char *key_name, /*!< name of the key */
+ const int alg, /*!< algorithm */
+ const int flags, /*!< dns flags */
+ const int protocol, /*!< dns protocol */
+ const u_char *key_buf, /*!< key in dns wire fmt */
+ const int key_len) /*!< size of key */
+{
+
+ DST_KEY *dkey = NULL;
+ int dnslen;
+ u_char dns[2048];
+
+ if (!dst_check_algorithm(alg)) { /*%< make sure alg is available */
+ EREPORT(("dst_buffer_to_key(): Algorithm %d not suppored\n", alg));
+ return (NULL);
+ }
+
+ dkey = dst_s_get_key_struct(key_name, alg, flags, protocol, -1);
+
+ if (dkey == NULL || dkey->dk_func == NULL ||
+ dkey->dk_func->from_dns_key == NULL)
+ return (dst_free_key(dkey));
+
+ if (dkey->dk_func->from_dns_key(dkey, key_buf, key_len) < 0) {
+ EREPORT(("dst_buffer_to_key(): dst_buffer_to_hmac failed\n"));
+ return (dst_free_key(dkey));
+ }
+
+ dnslen = dst_key_to_dnskey(dkey, dns, sizeof(dns));
+ dkey->dk_id = dst_s_dns_key_id(dns, dnslen);
+ return (dkey);
+}
+
+int
+dst_key_to_buffer(DST_KEY *key, u_char *out_buff, int buf_len)
+{
+ int len;
+ /* this function will extrac the secret of HMAC into a buffer */
+ if (key == NULL)
+ return (0);
+ if (key->dk_func != NULL && key->dk_func->to_dns_key != NULL) {
+ len = key->dk_func->to_dns_key(key, out_buff, buf_len);
+ if (len < 0)
+ return (0);
+ return (len);
+ }
+ return (0);
+}
+
+/*%
+ * dst_s_read_private_key_file
+ * Function reads in private key from a file.
+ * Fills out the KEY structure.
+ * Parameters
+ * name Name of the key to be read.
+ * pk_key Structure that the key is returned in.
+ * in_id Key identifier (tag)
+ * Return
+ * 1 if everthing works
+ * 0 if there is any problem
+ */
+
+static int
+dst_s_read_private_key_file(char *name, DST_KEY *pk_key, u_int16_t in_id,
+ int in_alg)
+{
+ int cnt, alg, len, major, minor, file_major, file_minor;
+ int ret, id;
+ char filename[PATH_MAX];
+ u_char in_buff[RAW_KEY_SIZE], *p;
+ FILE *fp;
+ int dnslen;
+ u_char dns[2048];
+
+ if (name == NULL || pk_key == NULL) {
+ EREPORT(("dst_read_private_key_file(): No key name given\n"));
+ return (0);
+ }
+ /* Make the filename */
+ if (dst_s_build_filename(filename, name, in_id, in_alg, PRIVATE_KEY,
+ PATH_MAX) == -1) {
+ EREPORT(("dst_read_private_key(): Cannot make filename from %s, %d, and %s\n",
+ name, in_id, PRIVATE_KEY));
+ return (0);
+ }
+ /* first check if we can find the key file */
+ if ((fp = dst_s_fopen(filename, "r", 0)) == NULL) {
+ EREPORT(("dst_s_read_private_key_file: Could not open file %s in directory %s\n",
+ filename, dst_path[0] ? dst_path :
+ (char *) getcwd(NULL, PATH_MAX - 1)));
+ return (0);
+ }
+ /* now read the header info from the file */
+ if ((cnt = fread(in_buff, 1, sizeof(in_buff), fp)) < 5) {
+ fclose(fp);
+ EREPORT(("dst_s_read_private_key_file: error reading file %s (empty file)\n",
+ filename));
+ return (0);
+ }
+ /* decrypt key */
+ fclose(fp);
+ if (memcmp(in_buff, "Private-key-format: v", 20) != 0)
+ goto fail;
+ len = cnt;
+ p = in_buff;
+
+ if (!dst_s_verify_str((const char **) (void *)&p,
+ "Private-key-format: v")) {
+ EREPORT(("dst_s_read_private_key_file(): Not a Key file/Decrypt failed %s\n", name));
+ goto fail;
+ }
+ /* read in file format */
+ sscanf((char *)p, "%d.%d", &file_major, &file_minor);
+ sscanf(KEY_FILE_FORMAT, "%d.%d", &major, &minor);
+ if (file_major < 1) {
+ EREPORT(("dst_s_read_private_key_file(): Unknown keyfile %d.%d version for %s\n",
+ file_major, file_minor, name));
+ goto fail;
+ } else if (file_major > major || file_minor > minor)
+ EREPORT((
+ "dst_s_read_private_key_file(): Keyfile %s version higher than mine %d.%d MAY FAIL\n",
+ name, file_major, file_minor));
+
+ while (*p++ != '\n') ; /*%< skip to end of line */
+
+ if (!dst_s_verify_str((const char **) (void *)&p, "Algorithm: "))
+ goto fail;
+
+ if (sscanf((char *)p, "%d", &alg) != 1)
+ goto fail;
+ while (*p++ != '\n') ; /*%< skip to end of line */
+
+ if (pk_key->dk_key_name && !strcmp(pk_key->dk_key_name, name))
+ SAFE_FREE2(pk_key->dk_key_name, strlen(pk_key->dk_key_name));
+ pk_key->dk_key_name = (char *) strdup(name);
+
+ /* allocate and fill in key structure */
+ if (pk_key->dk_func == NULL || pk_key->dk_func->from_file_fmt == NULL)
+ goto fail;
+
+ ret = pk_key->dk_func->from_file_fmt(pk_key, (char *)p, &in_buff[len] - p);
+ if (ret < 0)
+ goto fail;
+
+ dnslen = dst_key_to_dnskey(pk_key, dns, sizeof(dns));
+ id = dst_s_dns_key_id(dns, dnslen);
+
+ /* Make sure the actual key tag matches the input tag used in the filename
+ */
+ if (id != in_id) {
+ EREPORT(("dst_s_read_private_key_file(): actual tag of key read %d != input tag used to build filename %d.\n", id, in_id));
+ goto fail;
+ }
+ pk_key->dk_id = (u_int16_t) id;
+ pk_key->dk_alg = alg;
+ memset(in_buff, 0, cnt);
+ return (1);
+
+ fail:
+ memset(in_buff, 0, cnt);
+ return (0);
+}
+
+/*%
+ * Generate and store a public/private keypair.
+ * Keys will be stored in formatted files.
+ *
+ * Parameters
+ &
+ *\par name Name of the new key. Used to create key files
+ *\li K&lt;name&gt;+&lt;alg&gt;+&lt;id&gt;.public and K&lt;name&gt;+&lt;alg&gt;+&lt;id&gt;.private.
+ *\par bits Size of the new key in bits.
+ *\par exp What exponent to use:
+ *\li 0 use exponent 3
+ *\li non-zero use Fermant4
+ *\par flags The default value of the DNS Key flags.
+ *\li The DNS Key RR Flag field is defined in RFC2065,
+ * section 3.3. The field has 16 bits.
+ *\par protocol
+ *\li Default value of the DNS Key protocol field.
+ *\li The DNS Key protocol field is defined in RFC2065,
+ * section 3.4. The field has 8 bits.
+ *\par alg What algorithm to use. Currently defined:
+ *\li KEY_RSA 1
+ *\li KEY_DSA 3
+ *\li KEY_HMAC 157
+ *\par out_id The key tag is returned.
+ *
+ * Return
+ *\li NULL Failure
+ *\li non-NULL the generated key pair
+ * Caller frees the result, and its dk_name pointer.
+ */
+DST_KEY *
+dst_generate_key(const char *name, const int bits, const int exp,
+ const int flags, const int protocol, const int alg)
+{
+ DST_KEY *new_key = NULL;
+ int dnslen;
+ u_char dns[2048];
+
+ if (name == NULL)
+ return (NULL);
+
+ if (!dst_check_algorithm(alg)) { /*%< make sure alg is available */
+ EREPORT(("dst_generate_key(): Algorithm %d not suppored\n", alg));
+ return (NULL);
+ }
+
+ new_key = dst_s_get_key_struct(name, alg, flags, protocol, bits);
+ if (new_key == NULL)
+ return (NULL);
+ if (bits == 0) /*%< null key we are done */
+ return (new_key);
+ if (new_key->dk_func == NULL || new_key->dk_func->generate == NULL) {
+ EREPORT(("dst_generate_key_pair():Unsupported algorithm %d\n",
+ alg));
+ return (dst_free_key(new_key));
+ }
+ if (new_key->dk_func->generate(new_key, exp) <= 0) {
+ EREPORT(("dst_generate_key_pair(): Key generation failure %s %d %d %d\n",
+ new_key->dk_key_name, new_key->dk_alg,
+ new_key->dk_key_size, exp));
+ return (dst_free_key(new_key));
+ }
+
+ dnslen = dst_key_to_dnskey(new_key, dns, sizeof(dns));
+ if (dnslen != UNSUPPORTED_KEYALG)
+ new_key->dk_id = dst_s_dns_key_id(dns, dnslen);
+ else
+ new_key->dk_id = 0;
+
+ return (new_key);
+}
+
+/*%
+ * Release all data structures pointed to by a key structure.
+ *
+ * Parameters
+ *\li f_key Key structure to be freed.
+ */
+
+DST_KEY *
+dst_free_key(DST_KEY *f_key)
+{
+
+ if (f_key == NULL)
+ return (f_key);
+ if (f_key->dk_func && f_key->dk_func->destroy)
+ f_key->dk_KEY_struct =
+ f_key->dk_func->destroy(f_key->dk_KEY_struct);
+ else {
+ EREPORT(("dst_free_key(): Unknown key alg %d\n",
+ f_key->dk_alg));
+ }
+ if (f_key->dk_KEY_struct) {
+ free(f_key->dk_KEY_struct);
+ f_key->dk_KEY_struct = NULL;
+ }
+ if (f_key->dk_key_name)
+ SAFE_FREE(f_key->dk_key_name);
+ SAFE_FREE(f_key);
+ return (NULL);
+}
+
+/*%
+ * Return the maximim size of signature from the key specified in bytes
+ *
+ * Parameters
+ *\li key
+ *
+ * Returns
+ * \li bytes
+ */
+int
+dst_sig_size(DST_KEY *key) {
+ switch (key->dk_alg) {
+ case KEY_HMAC_MD5:
+ return (16);
+ case KEY_HMAC_SHA1:
+ return (20);
+ case KEY_RSA:
+ return (key->dk_key_size + 7) / 8;
+ case KEY_DSA:
+ return (40);
+ default:
+ EREPORT(("dst_sig_size(): Unknown key alg %d\n", key->dk_alg));
+ return -1;
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/dst/dst_internal.h b/usr/src/lib/libresolv2_joy/common/dst/dst_internal.h
new file mode 100644
index 0000000000..e9bc6fc08d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/dst/dst_internal.h
@@ -0,0 +1,155 @@
+#ifndef DST_INTERNAL_H
+#define DST_INTERNAL_H
+
+/*
+ * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
+ *
+ * Permission to use, copy modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TRUSTED INFORMATION SYSTEMS
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * TRUSTED INFORMATION SYSTEMS BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
+ */
+#include <limits.h>
+#include <sys/param.h>
+#if (!defined(BSD)) || (BSD < 199306)
+# include <sys/bitypes.h>
+#else
+# include <sys/types.h>
+#endif
+
+#ifndef PATH_MAX
+# ifdef POSIX_PATH_MAX
+# define PATH_MAX POSIX_PATH_MAX
+# else
+# define PATH_MAX 255 /*%< this is the value of POSIX_PATH_MAX */
+# endif
+#endif
+
+typedef struct dst_key {
+ char *dk_key_name; /*%< name of the key */
+ int dk_key_size; /*%< this is the size of the key in bits */
+ int dk_proto; /*%< what protocols this key can be used for */
+ int dk_alg; /*%< algorithm number from key record */
+ u_int32_t dk_flags; /*%< and the flags of the public key */
+ u_int16_t dk_id; /*%< identifier of the key */
+ void *dk_KEY_struct; /*%< pointer to key in crypto pkg fmt */
+ struct dst_func *dk_func; /*%< point to cryptto pgk specific function table */
+} DST_KEY;
+#define HAS_DST_KEY
+
+#include <isc/dst.h>
+/*
+ * define what crypto systems are supported for RSA,
+ * BSAFE is prefered over RSAREF; only one can be set at any time
+ */
+#if defined(BSAFE) && defined(RSAREF)
+# error "Cannot have both BSAFE and RSAREF defined"
+#endif
+
+/* Declare dst_lib specific constants */
+#define KEY_FILE_FORMAT "1.2"
+
+/* suffixes for key file names */
+#define PRIVATE_KEY "private"
+#define PUBLIC_KEY "key"
+
+/* error handling */
+#ifdef REPORT_ERRORS
+#define EREPORT(str) printf str
+#else
+#define EREPORT(str) (void)0
+#endif
+
+/* use our own special macro to FRRE memory */
+
+#ifndef SAFE_FREE
+#define SAFE_FREE(a) \
+do{if(a != NULL){memset(a,0, sizeof(*a)); free(a); a=NULL;}} while (0)
+#define SAFE_FREE2(a,s) if (a != NULL && (long)s > 0){memset(a,0, s);free(a); a=NULL;}
+#endif
+
+typedef struct dst_func {
+ int (*sign)(const int mode, DST_KEY *key, void **context,
+ const u_int8_t *data, const int len,
+ u_int8_t *signature, const int sig_len);
+ int (*verify)(const int mode, DST_KEY *key, void **context,
+ const u_int8_t *data, const int len,
+ const u_int8_t *signature, const int sig_len);
+ int (*compare)(const DST_KEY *key1, const DST_KEY *key2);
+ int (*generate)(DST_KEY *key, int parms);
+ void *(*destroy)(void *key);
+ /* conversion functions */
+ int (*to_dns_key)(const DST_KEY *key, u_int8_t *out,
+ const int out_len);
+ int (*from_dns_key)(DST_KEY *key, const u_int8_t *str,
+ const int str_len);
+ int (*to_file_fmt)(const DST_KEY *key, char *out,
+ const int out_len);
+ int (*from_file_fmt)(DST_KEY *key, const char *out,
+ const int out_len);
+
+} dst_func;
+
+extern dst_func *dst_t_func[DST_MAX_ALGS];
+extern const char *key_file_fmt_str;
+extern const char *dst_path;
+
+#ifndef DST_HASH_SIZE
+#define DST_HASH_SIZE 20 /*%< RIPEMD160 and SHA-1 are 20 bytes MD5 is 16 */
+#endif
+
+int dst_bsafe_init(void);
+
+int dst_rsaref_init(void);
+
+int dst_hmac_md5_init(void);
+
+int dst_cylink_init(void);
+
+int dst_eay_dss_init(void);
+
+/* from higher level support routines */
+int dst_s_calculate_bits( const u_int8_t *str, const int max_bits);
+int dst_s_verify_str( const char **buf, const char *str);
+
+
+/* conversion between dns names and key file names */
+size_t dst_s_filename_length( const char *name, const char *suffix);
+int dst_s_build_filename( char *filename, const char *name,
+ u_int16_t id, int alg, const char *suffix,
+ size_t filename_length);
+
+FILE *dst_s_fopen (const char *filename, const char *mode, int perm);
+
+/*%
+ * read and write network byte order into u_int?_t
+ * all of these should be retired
+ */
+u_int16_t dst_s_get_int16( const u_int8_t *buf);
+void dst_s_put_int16( u_int8_t *buf, const u_int16_t val);
+
+u_int32_t dst_s_get_int32( const u_int8_t *buf);
+void dst_s_put_int32( u_int8_t *buf, const u_int32_t val);
+
+#ifdef DUMP
+# undef DUMP
+# define DUMP(a,b,c,d) dst_s_dump(a,b,c,d)
+#else
+# define DUMP(a,b,c,d)
+#endif
+void
+dst_s_dump(const int mode, const u_char *data, const int size,
+ const char *msg);
+
+
+
+#endif /* DST_INTERNAL_H */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/dst/hmac_link.c b/usr/src/lib/libresolv2_joy/common/dst/hmac_link.c
new file mode 100644
index 0000000000..23925e4269
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/dst/hmac_link.c
@@ -0,0 +1,491 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#ifdef HMAC_MD5
+#ifndef LINT
+static const char rcsid[] = "$Header: /proj/cvs/prod/libbind/dst/hmac_link.c,v 1.8 2007/09/24 17:18:25 each Exp $";
+#endif
+/*
+ * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
+ *
+ * Permission to use, copy modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TRUSTED INFORMATION SYSTEMS
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * TRUSTED INFORMATION SYSTEMS BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
+ */
+
+/*%
+ * This file contains an implementation of the HMAC-MD5 algorithm.
+ */
+#include "port_before.h"
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include "dst_internal.h"
+
+#ifdef USE_MD5
+# ifndef HAVE_MD5
+# include "md5.h"
+# else
+# ifdef SOLARIS2
+# include <sys/md5.h>
+# endif
+# endif
+# ifndef _MD5_H_
+# define _MD5_H_ 1 /*%< make sure we do not include rsaref md5.h file */
+# endif
+#endif
+
+#include "port_after.h"
+
+
+#define HMAC_LEN 64
+#define HMAC_IPAD 0x36
+#define HMAC_OPAD 0x5c
+#define MD5_LEN 16
+
+
+typedef struct hmackey {
+ u_char hk_ipad[64], hk_opad[64];
+} HMAC_Key;
+
+
+/**************************************************************************
+ * dst_hmac_md5_sign
+ * Call HMAC signing functions to sign a block of data.
+ * There are three steps to signing, INIT (initialize structures),
+ * UPDATE (hash (more) data), FINAL (generate a signature). This
+ * routine performs one or more of these steps.
+ * Parameters
+ * mode SIG_MODE_INIT, SIG_MODE_UPDATE and/or SIG_MODE_FINAL.
+ * priv_key key to use for signing.
+ * context the context to be used in this digest
+ * data data to be signed.
+ * len length in bytes of data.
+ * signature location to store signature.
+ * sig_len size of the signature location
+ * returns
+ * N Success on SIG_MODE_FINAL = returns signature length in bytes
+ * 0 Success on SIG_MODE_INIT and UPDATE
+ * <0 Failure
+ */
+
+static int
+dst_hmac_md5_sign(const int mode, DST_KEY *d_key, void **context,
+ const u_char *data, const int len,
+ u_char *signature, const int sig_len)
+{
+ HMAC_Key *key;
+ int sign_len = 0;
+ MD5_CTX *ctx = NULL;
+
+ if (d_key == NULL || d_key->dk_KEY_struct == NULL)
+ return (-1);
+
+ if (mode & SIG_MODE_INIT)
+ ctx = (MD5_CTX *) malloc(sizeof(*ctx));
+ else if (context)
+ ctx = (MD5_CTX *) *context;
+ if (ctx == NULL)
+ return (-1);
+
+ key = (HMAC_Key *) d_key->dk_KEY_struct;
+
+ if (mode & SIG_MODE_INIT) {
+ MD5Init(ctx);
+ MD5Update(ctx, key->hk_ipad, HMAC_LEN);
+ }
+
+ if ((mode & SIG_MODE_UPDATE) && (data && len > 0))
+ MD5Update(ctx, data, len);
+
+ if (mode & SIG_MODE_FINAL) {
+ if (signature == NULL || sig_len < MD5_LEN)
+ return (SIGN_FINAL_FAILURE);
+ MD5Final(signature, ctx);
+
+ /* perform outer MD5 */
+ MD5Init(ctx);
+ MD5Update(ctx, key->hk_opad, HMAC_LEN);
+ MD5Update(ctx, signature, MD5_LEN);
+ MD5Final(signature, ctx);
+ sign_len = MD5_LEN;
+ SAFE_FREE(ctx);
+ }
+ else {
+ if (context == NULL)
+ return (-1);
+ *context = (void *) ctx;
+ }
+ return (sign_len);
+}
+
+
+/**************************************************************************
+ * dst_hmac_md5_verify()
+ * Calls HMAC verification routines. There are three steps to
+ * verification, INIT (initialize structures), UPDATE (hash (more) data),
+ * FINAL (generate a signature). This routine performs one or more of
+ * these steps.
+ * Parameters
+ * mode SIG_MODE_INIT, SIG_MODE_UPDATE and/or SIG_MODE_FINAL.
+ * dkey key to use for verify.
+ * data data signed.
+ * len length in bytes of data.
+ * signature signature.
+ * sig_len length in bytes of signature.
+ * returns
+ * 0 Success
+ * <0 Failure
+ */
+
+static int
+dst_hmac_md5_verify(const int mode, DST_KEY *d_key, void **context,
+ const u_char *data, const int len,
+ const u_char *signature, const int sig_len)
+{
+ HMAC_Key *key;
+ MD5_CTX *ctx = NULL;
+
+ if (d_key == NULL || d_key->dk_KEY_struct == NULL)
+ return (-1);
+
+ if (mode & SIG_MODE_INIT)
+ ctx = (MD5_CTX *) malloc(sizeof(*ctx));
+ else if (context)
+ ctx = (MD5_CTX *) *context;
+ if (ctx == NULL)
+ return (-1);
+
+ key = (HMAC_Key *) d_key->dk_KEY_struct;
+ if (mode & SIG_MODE_INIT) {
+ MD5Init(ctx);
+ MD5Update(ctx, key->hk_ipad, HMAC_LEN);
+ }
+ if ((mode & SIG_MODE_UPDATE) && (data && len > 0))
+ MD5Update(ctx, data, len);
+
+ if (mode & SIG_MODE_FINAL) {
+ u_char digest[MD5_LEN];
+ if (signature == NULL || key == NULL || sig_len != MD5_LEN)
+ return (VERIFY_FINAL_FAILURE);
+ MD5Final(digest, ctx);
+
+ /* perform outer MD5 */
+ MD5Init(ctx);
+ MD5Update(ctx, key->hk_opad, HMAC_LEN);
+ MD5Update(ctx, digest, MD5_LEN);
+ MD5Final(digest, ctx);
+
+ SAFE_FREE(ctx);
+ if (memcmp(digest, signature, MD5_LEN) != 0)
+ return (VERIFY_FINAL_FAILURE);
+ }
+ else {
+ if (context == NULL)
+ return (-1);
+ *context = (void *) ctx;
+ }
+ return (0);
+}
+
+
+/**************************************************************************
+ * dst_buffer_to_hmac_md5
+ * Converts key from raw data to an HMAC Key
+ * This function gets in a pointer to the data
+ * Parameters
+ * hkey the HMAC key to be filled in
+ * key the key in raw format
+ * keylen the length of the key
+ * Return
+ * 0 Success
+ * <0 Failure
+ */
+static int
+dst_buffer_to_hmac_md5(DST_KEY *dkey, const u_char *key, const int keylen)
+{
+ int i;
+ HMAC_Key *hkey = NULL;
+ MD5_CTX ctx;
+ int local_keylen = keylen;
+ u_char tk[MD5_LEN];
+
+ if (dkey == NULL || key == NULL || keylen < 0)
+ return (-1);
+
+ if ((hkey = (HMAC_Key *) malloc(sizeof(HMAC_Key))) == NULL)
+ return (-2);
+
+ memset(hkey->hk_ipad, 0, sizeof(hkey->hk_ipad));
+ memset(hkey->hk_opad, 0, sizeof(hkey->hk_opad));
+
+ /* if key is longer than HMAC_LEN bytes reset it to key=MD5(key) */
+ if (keylen > HMAC_LEN) {
+ MD5Init(&ctx);
+ MD5Update(&ctx, key, keylen);
+ MD5Final(tk, &ctx);
+ memset((void *) &ctx, 0, sizeof(ctx));
+ key = tk;
+ local_keylen = MD5_LEN;
+ }
+ /* start out by storing key in pads */
+ memcpy(hkey->hk_ipad, key, local_keylen);
+ memcpy(hkey->hk_opad, key, local_keylen);
+
+ /* XOR key with hk_ipad and opad values */
+ for (i = 0; i < HMAC_LEN; i++) {
+ hkey->hk_ipad[i] ^= HMAC_IPAD;
+ hkey->hk_opad[i] ^= HMAC_OPAD;
+ }
+ dkey->dk_key_size = local_keylen;
+ dkey->dk_KEY_struct = (void *) hkey;
+ return (1);
+}
+
+
+/**************************************************************************
+ * dst_hmac_md5_key_to_file_format
+ * Encodes an HMAC Key into the portable file format.
+ * Parameters
+ * hkey HMAC KEY structure
+ * buff output buffer
+ * buff_len size of output buffer
+ * Return
+ * 0 Failure - null input hkey
+ * -1 Failure - not enough space in output area
+ * N Success - Length of data returned in buff
+ */
+
+static int
+dst_hmac_md5_key_to_file_format(const DST_KEY *dkey, char *buff,
+ const int buff_len)
+{
+ char *bp;
+ int len, i, key_len;
+ u_char key[HMAC_LEN];
+ HMAC_Key *hkey;
+
+ if (dkey == NULL || dkey->dk_KEY_struct == NULL)
+ return (0);
+ /*
+ * Using snprintf() would be so much simpler here.
+ */
+ if (buff == NULL ||
+ buff_len <= (int)(strlen(key_file_fmt_str) +
+ strlen(KEY_FILE_FORMAT) + 4))
+ return (-1); /*%< no OR not enough space in output area */
+ hkey = (HMAC_Key *) dkey->dk_KEY_struct;
+ memset(buff, 0, buff_len); /*%< just in case */
+ /* write file header */
+ sprintf(buff, key_file_fmt_str, KEY_FILE_FORMAT, KEY_HMAC_MD5, "HMAC");
+
+ bp = buff + strlen(buff);
+
+ memset(key, 0, HMAC_LEN);
+ for (i = 0; i < HMAC_LEN; i++)
+ key[i] = hkey->hk_ipad[i] ^ HMAC_IPAD;
+ for (i = HMAC_LEN - 1; i >= 0; i--)
+ if (key[i] != 0)
+ break;
+ key_len = i + 1;
+
+ if (buff_len - (bp - buff) < 6)
+ return (-1);
+ strcat(bp, "Key: ");
+ bp += strlen("Key: ");
+
+ len = b64_ntop(key, key_len, bp, buff_len - (bp - buff));
+ if (len < 0)
+ return (-1);
+ bp += len;
+ if (buff_len - (bp - buff) < 2)
+ return (-1);
+ *(bp++) = '\n';
+ *bp = '\0';
+
+ return (bp - buff);
+}
+
+
+/**************************************************************************
+ * dst_hmac_md5_key_from_file_format
+ * Converts contents of a key file into an HMAC key.
+ * Parameters
+ * hkey structure to put key into
+ * buff buffer containing the encoded key
+ * buff_len the length of the buffer
+ * Return
+ * n >= 0 Foot print of the key converted
+ * n < 0 Error in conversion
+ */
+
+static int
+dst_hmac_md5_key_from_file_format(DST_KEY *dkey, const char *buff,
+ const int buff_len)
+{
+ const char *p = buff, *eol;
+ u_char key[HMAC_LEN+1]; /* b64_pton needs more than 64 bytes do decode
+ * it should probably be fixed rather than doing
+ * this
+ */
+ u_char *tmp;
+ int key_len, len;
+
+ if (dkey == NULL)
+ return (-2);
+ if (buff == NULL || buff_len < 0)
+ return (-1);
+
+ memset(key, 0, sizeof(key));
+
+ if (!dst_s_verify_str(&p, "Key: "))
+ return (-3);
+
+ eol = strchr(p, '\n');
+ if (eol == NULL)
+ return (-4);
+ len = eol - p;
+ tmp = malloc(len + 2);
+ if (tmp == NULL)
+ return (-5);
+ memcpy(tmp, p, len);
+ *(tmp + len) = 0x0;
+ key_len = b64_pton((char *)tmp, key, HMAC_LEN+1); /*%< see above */
+ SAFE_FREE2(tmp, len + 2);
+
+ if (dst_buffer_to_hmac_md5(dkey, key, key_len) < 0) {
+ return (-6);
+ }
+ return (0);
+}
+
+/*%
+ * dst_hmac_md5_to_dns_key()
+ * function to extract hmac key from DST_KEY structure
+ * intput:
+ * in_key: HMAC-MD5 key
+ * output:
+ * out_str: buffer to write ot
+ * out_len: size of output buffer
+ * returns:
+ * number of bytes written to output buffer
+ */
+static int
+dst_hmac_md5_to_dns_key(const DST_KEY *in_key, u_char *out_str,
+ const int out_len)
+{
+
+ HMAC_Key *hkey;
+ int i;
+
+ if (in_key == NULL || in_key->dk_KEY_struct == NULL ||
+ out_len <= in_key->dk_key_size || out_str == NULL)
+ return (-1);
+
+ hkey = (HMAC_Key *) in_key->dk_KEY_struct;
+ for (i = 0; i < in_key->dk_key_size; i++)
+ out_str[i] = hkey->hk_ipad[i] ^ HMAC_IPAD;
+ return (i);
+}
+
+/**************************************************************************
+ * dst_hmac_md5_compare_keys
+ * Compare two keys for equality.
+ * Return
+ * 0 The keys are equal
+ * NON-ZERO The keys are not equal
+ */
+
+static int
+dst_hmac_md5_compare_keys(const DST_KEY *key1, const DST_KEY *key2)
+{
+ HMAC_Key *hkey1 = (HMAC_Key *) key1->dk_KEY_struct;
+ HMAC_Key *hkey2 = (HMAC_Key *) key2->dk_KEY_struct;
+ return memcmp(hkey1->hk_ipad, hkey2->hk_ipad, HMAC_LEN);
+}
+
+/**************************************************************************
+ * dst_hmac_md5_free_key_structure
+ * Frees all (none) dynamically allocated structures in hkey
+ */
+
+static void *
+dst_hmac_md5_free_key_structure(void *key)
+{
+ HMAC_Key *hkey = key;
+ SAFE_FREE(hkey);
+ return (NULL);
+}
+
+
+/***************************************************************************
+ * dst_hmac_md5_generate_key
+ * Creates a HMAC key of size size with a maximum size of 63 bytes
+ * generating a HMAC key larger than 63 bytes makes no sense as that key
+ * is digested before use.
+ */
+
+static int
+dst_hmac_md5_generate_key(DST_KEY *key, const int nothing)
+{
+ (void)key;
+ (void)nothing;
+ return (-1);
+}
+
+/*%
+ * dst_hmac_md5_init() Function to answer set up function pointers for HMAC
+ * related functions
+ */
+int
+dst_hmac_md5_init()
+{
+ if (dst_t_func[KEY_HMAC_MD5] != NULL)
+ return (1);
+ dst_t_func[KEY_HMAC_MD5] = malloc(sizeof(struct dst_func));
+ if (dst_t_func[KEY_HMAC_MD5] == NULL)
+ return (0);
+ memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func));
+ dst_t_func[KEY_HMAC_MD5]->sign = dst_hmac_md5_sign;
+ dst_t_func[KEY_HMAC_MD5]->verify = dst_hmac_md5_verify;
+ dst_t_func[KEY_HMAC_MD5]->compare = dst_hmac_md5_compare_keys;
+ dst_t_func[KEY_HMAC_MD5]->generate = dst_hmac_md5_generate_key;
+ dst_t_func[KEY_HMAC_MD5]->destroy = dst_hmac_md5_free_key_structure;
+ dst_t_func[KEY_HMAC_MD5]->to_dns_key = dst_hmac_md5_to_dns_key;
+ dst_t_func[KEY_HMAC_MD5]->from_dns_key = dst_buffer_to_hmac_md5;
+ dst_t_func[KEY_HMAC_MD5]->to_file_fmt = dst_hmac_md5_key_to_file_format;
+ dst_t_func[KEY_HMAC_MD5]->from_file_fmt = dst_hmac_md5_key_from_file_format;
+ return (1);
+}
+
+#else
+#define dst_hmac_md5_init __dst_hmac_md5_init
+
+int
+dst_hmac_md5_init(){
+ return (0);
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/dst/support.c b/usr/src/lib/libresolv2_joy/common/dst/support.c
new file mode 100644
index 0000000000..8f827667d6
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/dst/support.c
@@ -0,0 +1,342 @@
+static const char rcsid[] = "$Header: /proj/cvs/prod/libbind/dst/support.c,v 1.6 2005/10/11 00:10:13 marka Exp $";
+
+
+/*
+ * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
+ *
+ * Permission to use, copy modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TRUSTED INFORMATION SYSTEMS
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * TRUSTED INFORMATION SYSTEMS BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
+ */
+
+#include "port_before.h"
+
+#include <stdio.h>
+#include <unistd.h>
+#include <memory.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include "dst_internal.h"
+
+#include "port_after.h"
+
+/*%
+ * dst_s_verify_str()
+ * Validate that the input string(*str) is at the head of the input
+ * buffer(**buf). If so, move the buffer head pointer (*buf) to
+ * the first byte of data following the string(*str).
+ * Parameters
+ * buf Input buffer.
+ * str Input string.
+ * Return
+ * 0 *str is not the head of **buff
+ * 1 *str is the head of **buff, *buf is is advanced to
+ * the tail of **buf.
+ */
+
+int
+dst_s_verify_str(const char **buf, const char *str)
+{
+ int b, s;
+ if (*buf == NULL) /*%< error checks */
+ return (0);
+ if (str == NULL || *str == '\0')
+ return (1);
+
+ b = strlen(*buf); /*%< get length of strings */
+ s = strlen(str);
+ if (s > b || strncmp(*buf, str, s)) /*%< check if same */
+ return (0); /*%< not a match */
+ (*buf) += s; /*%< advance pointer */
+ return (1);
+}
+
+/*%
+ * dst_s_calculate_bits
+ * Given a binary number represented in a u_char[], determine
+ * the number of significant bits used.
+ * Parameters
+ * str An input character string containing a binary number.
+ * max_bits The maximum possible significant bits.
+ * Return
+ * N The number of significant bits in str.
+ */
+
+int
+dst_s_calculate_bits(const u_char *str, const int max_bits)
+{
+ const u_char *p = str;
+ u_char i, j = 0x80;
+ int bits;
+ for (bits = max_bits; *p == 0x00 && bits > 0; p++)
+ bits -= 8;
+ for (i = *p; (i & j) != j; j >>= 1)
+ bits--;
+ return (bits);
+}
+
+/*%
+ * calculates a checksum used in dst for an id.
+ * takes an array of bytes and a length.
+ * returns a 16 bit checksum.
+ */
+u_int16_t
+dst_s_id_calc(const u_char *key, const int keysize)
+{
+ u_int32_t ac;
+ const u_char *kp = key;
+ int size = keysize;
+
+ if (!key || (keysize <= 0))
+ return (0xffffU);
+
+ for (ac = 0; size > 1; size -= 2, kp += 2)
+ ac += ((*kp) << 8) + *(kp + 1);
+
+ if (size > 0)
+ ac += ((*kp) << 8);
+ ac += (ac >> 16) & 0xffff;
+
+ return (ac & 0xffff);
+}
+
+/*%
+ * dst_s_dns_key_id() Function to calculate DNSSEC footprint from KEY record
+ * rdata
+ * Input:
+ * dns_key_rdata: the raw data in wire format
+ * rdata_len: the size of the input data
+ * Output:
+ * the key footprint/id calculated from the key data
+ */
+u_int16_t
+dst_s_dns_key_id(const u_char *dns_key_rdata, const int rdata_len)
+{
+ if (!dns_key_rdata)
+ return 0;
+
+ /* compute id */
+ if (dns_key_rdata[3] == KEY_RSA) /*%< Algorithm RSA */
+ return dst_s_get_int16((const u_char *)
+ &dns_key_rdata[rdata_len - 3]);
+ else if (dns_key_rdata[3] == KEY_HMAC_MD5)
+ /* compatibility */
+ return 0;
+ else
+ /* compute a checksum on the key part of the key rr */
+ return dst_s_id_calc(dns_key_rdata, rdata_len);
+}
+
+/*%
+ * dst_s_get_int16
+ * This routine extracts a 16 bit integer from a two byte character
+ * string. The character string is assumed to be in network byte
+ * order and may be unaligned. The number returned is in host order.
+ * Parameter
+ * buf A two byte character string.
+ * Return
+ * The converted integer value.
+ */
+
+u_int16_t
+dst_s_get_int16(const u_char *buf)
+{
+ register u_int16_t a = 0;
+ a = ((u_int16_t)(buf[0] << 8)) | ((u_int16_t)(buf[1]));
+ return (a);
+}
+
+/*%
+ * dst_s_get_int32
+ * This routine extracts a 32 bit integer from a four byte character
+ * string. The character string is assumed to be in network byte
+ * order and may be unaligned. The number returned is in host order.
+ * Parameter
+ * buf A four byte character string.
+ * Return
+ * The converted integer value.
+ */
+
+u_int32_t
+dst_s_get_int32(const u_char *buf)
+{
+ register u_int32_t a = 0;
+ a = ((u_int32_t)(buf[0] << 24)) | ((u_int32_t)(buf[1] << 16)) |
+ ((u_int32_t)(buf[2] << 8)) | ((u_int32_t)(buf[3]));
+ return (a);
+}
+
+/*%
+ * dst_s_put_int16
+ * Take a 16 bit integer and store the value in a two byte
+ * character string. The integer is assumed to be in network
+ * order and the string is returned in host order.
+ *
+ * Parameters
+ * buf Storage for a two byte character string.
+ * val 16 bit integer.
+ */
+
+void
+dst_s_put_int16(u_int8_t *buf, const u_int16_t val)
+{
+ buf[0] = (u_int8_t)(val >> 8);
+ buf[1] = (u_int8_t)(val);
+}
+
+/*%
+ * dst_s_put_int32
+ * Take a 32 bit integer and store the value in a four byte
+ * character string. The integer is assumed to be in network
+ * order and the string is returned in host order.
+ *
+ * Parameters
+ * buf Storage for a four byte character string.
+ * val 32 bit integer.
+ */
+
+void
+dst_s_put_int32(u_int8_t *buf, const u_int32_t val)
+{
+ buf[0] = (u_int8_t)(val >> 24);
+ buf[1] = (u_int8_t)(val >> 16);
+ buf[2] = (u_int8_t)(val >> 8);
+ buf[3] = (u_int8_t)(val);
+}
+
+/*%
+ * dst_s_filename_length
+ *
+ * This function returns the number of bytes needed to hold the
+ * filename for a key file. '/', '\' and ':' are not allowed.
+ * form: K&lt;keyname&gt;+&lt;alg&gt;+&lt;id&gt;.&lt;suffix&gt;
+ *
+ * Returns 0 if the filename would contain either '\', '/' or ':'
+ */
+size_t
+dst_s_filename_length(const char *name, const char *suffix)
+{
+ if (name == NULL)
+ return (0);
+ if (strrchr(name, '\\'))
+ return (0);
+ if (strrchr(name, '/'))
+ return (0);
+ if (strrchr(name, ':'))
+ return (0);
+ if (suffix == NULL)
+ return (0);
+ if (strrchr(suffix, '\\'))
+ return (0);
+ if (strrchr(suffix, '/'))
+ return (0);
+ if (strrchr(suffix, ':'))
+ return (0);
+ return (1 + strlen(name) + 6 + strlen(suffix));
+}
+
+/*%
+ * dst_s_build_filename ()
+ * Builds a key filename from the key name, it's id, and a
+ * suffix. '\', '/' and ':' are not allowed. fA filename is of the
+ * form: K&lt;keyname&gt;&lt;id&gt;.&lt;suffix&gt;
+ * form: K&lt;keyname&gt;+&lt;alg&gt;+&lt;id&gt;.&lt;suffix&gt;
+ *
+ * Returns -1 if the conversion fails:
+ * if the filename would be too long for space allotted
+ * if the filename would contain a '\', '/' or ':'
+ * Returns 0 on success
+ */
+
+int
+dst_s_build_filename(char *filename, const char *name, u_int16_t id,
+ int alg, const char *suffix, size_t filename_length)
+{
+ u_int32_t my_id;
+ if (filename == NULL)
+ return (-1);
+ memset(filename, 0, filename_length);
+ if (name == NULL)
+ return (-1);
+ if (suffix == NULL)
+ return (-1);
+ if (filename_length < 1 + strlen(name) + 4 + 6 + 1 + strlen(suffix))
+ return (-1);
+ my_id = id;
+ sprintf(filename, "K%s+%03d+%05d.%s", name, alg, my_id,
+ (const char *) suffix);
+ if (strrchr(filename, '/'))
+ return (-1);
+ if (strrchr(filename, '\\'))
+ return (-1);
+ if (strrchr(filename, ':'))
+ return (-1);
+ return (0);
+}
+
+/*%
+ * dst_s_fopen ()
+ * Open a file in the dst_path directory. If perm is specified, the
+ * file is checked for existence first, and not opened if it exists.
+ * Parameters
+ * filename File to open
+ * mode Mode to open the file (passed directly to fopen)
+ * perm File permission, if creating a new file.
+ * Returns
+ * NULL Failure
+ * NON-NULL (FILE *) of opened file.
+ */
+FILE *
+dst_s_fopen(const char *filename, const char *mode, int perm)
+{
+ FILE *fp;
+ char pathname[PATH_MAX];
+
+ if (strlen(filename) + strlen(dst_path) >= sizeof(pathname))
+ return (NULL);
+
+ if (*dst_path != '\0') {
+ strcpy(pathname, dst_path);
+ strcat(pathname, filename);
+ } else
+ strcpy(pathname, filename);
+
+ fp = fopen(pathname, mode);
+ if (perm)
+ chmod(pathname, perm);
+ return (fp);
+}
+
+void
+dst_s_dump(const int mode, const u_char *data, const int size,
+ const char *msg)
+{
+ UNUSED(data);
+
+ if (size > 0) {
+#ifdef LONG_TEST
+ static u_char scratch[1000];
+ int n ;
+ n = b64_ntop(data, scratch, size, sizeof(scratch));
+ printf("%s: %x %d %s\n", msg, mode, n, scratch);
+#else
+ printf("%s,%x %d\n", msg, mode, size);
+#endif
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_cidr_ntop.c b/usr/src/lib/libresolv2_joy/common/inet/inet_cidr_ntop.c
new file mode 100644
index 0000000000..bf960a8acc
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_cidr_ntop.c
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: inet_cidr_ntop.c,v 1.7 2006/10/11 02:18:18 marka Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+static char *
+inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size);
+static char *
+inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size);
+
+/*%
+ * char *
+ * inet_cidr_ntop(af, src, bits, dst, size)
+ * convert network address from network to presentation format.
+ * "src"'s size is determined from its "af".
+ * return:
+ * pointer to dst, or NULL if an error occurred (check errno).
+ * note:
+ * 192.5.5.1/28 has a nonzero host part, which means it isn't a network
+ * as called for by inet_net_ntop() but it can be a host address with
+ * an included netmask.
+ * author:
+ * Paul Vixie (ISC), October 1998
+ */
+char *
+inet_cidr_ntop(int af, const void *src, int bits, char *dst, size_t size) {
+ switch (af) {
+ case AF_INET:
+ return (inet_cidr_ntop_ipv4(src, bits, dst, size));
+ case AF_INET6:
+ return (inet_cidr_ntop_ipv6(src, bits, dst, size));
+ default:
+ errno = EAFNOSUPPORT;
+ return (NULL);
+ }
+}
+
+static int
+decoct(const u_char *src, int bytes, char *dst, size_t size) {
+ char *odst = dst;
+ char *t;
+ int b;
+
+ for (b = 1; b <= bytes; b++) {
+ if (size < sizeof "255.")
+ return (0);
+ t = dst;
+ dst += SPRINTF((dst, "%u", *src++));
+ if (b != bytes) {
+ *dst++ = '.';
+ *dst = '\0';
+ }
+ size -= (size_t)(dst - t);
+ }
+ return (dst - odst);
+}
+
+/*%
+ * static char *
+ * inet_cidr_ntop_ipv4(src, bits, dst, size)
+ * convert IPv4 network address from network to presentation format.
+ * "src"'s size is determined from its "af".
+ * return:
+ * pointer to dst, or NULL if an error occurred (check errno).
+ * note:
+ * network byte order assumed. this means 192.5.5.240/28 has
+ * 0b11110000 in its fourth octet.
+ * author:
+ * Paul Vixie (ISC), October 1998
+ */
+static char *
+inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size) {
+ char *odst = dst;
+ size_t len = 4;
+ size_t b;
+ size_t bytes;
+
+ if ((bits < -1) || (bits > 32)) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ /* Find number of significant bytes in address. */
+ if (bits == -1)
+ len = 4;
+ else
+ for (len = 1, b = 1 ; b < 4U; b++)
+ if (*(src + b))
+ len = b + 1;
+
+ /* Format whole octets plus nonzero trailing octets. */
+ bytes = (((bits <= 0) ? 1 : bits) + 7) / 8;
+ if (len > bytes)
+ bytes = len;
+ b = decoct(src, bytes, dst, size);
+ if (b == 0U)
+ goto emsgsize;
+ dst += b;
+ size -= b;
+
+ if (bits != -1) {
+ /* Format CIDR /width. */
+ if (size < sizeof "/32")
+ goto emsgsize;
+ dst += SPRINTF((dst, "/%u", bits));
+ }
+
+ return (odst);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (NULL);
+}
+
+static char *
+inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) {
+ /*
+ * Note that int32_t and int16_t need only be "at least" large enough
+ * to contain a value of the specified size. On some systems, like
+ * Crays, there is no such thing as an integer variable with 16 bits.
+ * Keep this in mind if you think this function should have been coded
+ * to use pointer overlays. All the world's not a VAX.
+ */
+ char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255/128"];
+ char *tp;
+ struct { int base, len; } best, cur;
+ u_int words[NS_IN6ADDRSZ / NS_INT16SZ];
+ int i;
+
+ if ((bits < -1) || (bits > 128)) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ /*
+ * Preprocess:
+ * Copy the input (bytewise) array into a wordwise array.
+ * Find the longest run of 0x00's in src[] for :: shorthanding.
+ */
+ memset(words, '\0', sizeof words);
+ for (i = 0; i < NS_IN6ADDRSZ; i++)
+ words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
+ best.base = -1;
+ best.len = 0;
+ cur.base = -1;
+ cur.len = 0;
+ for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
+ if (words[i] == 0) {
+ if (cur.base == -1)
+ cur.base = i, cur.len = 1;
+ else
+ cur.len++;
+ } else {
+ if (cur.base != -1) {
+ if (best.base == -1 || cur.len > best.len)
+ best = cur;
+ cur.base = -1;
+ }
+ }
+ }
+ if (cur.base != -1) {
+ if (best.base == -1 || cur.len > best.len)
+ best = cur;
+ }
+ if (best.base != -1 && best.len < 2)
+ best.base = -1;
+
+ /*
+ * Format the result.
+ */
+ tp = tmp;
+ for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
+ /* Are we inside the best run of 0x00's? */
+ if (best.base != -1 && i >= best.base &&
+ i < (best.base + best.len)) {
+ if (i == best.base)
+ *tp++ = ':';
+ continue;
+ }
+ /* Are we following an initial run of 0x00s or any real hex? */
+ if (i != 0)
+ *tp++ = ':';
+ /* Is this address an encapsulated IPv4? */
+ if (i == 6 && best.base == 0 && (best.len == 6 ||
+ (best.len == 7 && words[7] != 0x0001) ||
+ (best.len == 5 && words[5] == 0xffff))) {
+ int n;
+
+ if (src[15] || bits == -1 || bits > 120)
+ n = 4;
+ else if (src[14] || bits > 112)
+ n = 3;
+ else
+ n = 2;
+ n = decoct(src+12, n, tp, sizeof tmp - (tp - tmp));
+ if (n == 0) {
+ errno = EMSGSIZE;
+ return (NULL);
+ }
+ tp += strlen(tp);
+ break;
+ }
+ tp += SPRINTF((tp, "%x", words[i]));
+ }
+
+ /* Was it a trailing run of 0x00's? */
+ if (best.base != -1 && (best.base + best.len) ==
+ (NS_IN6ADDRSZ / NS_INT16SZ))
+ *tp++ = ':';
+ *tp = '\0';
+
+ if (bits != -1)
+ tp += SPRINTF((tp, "/%u", bits));
+
+ /*
+ * Check for overflow, copy, and we're done.
+ */
+ if ((size_t)(tp - tmp) > size) {
+ errno = EMSGSIZE;
+ return (NULL);
+ }
+ strcpy(dst, tmp);
+ return (dst);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_cidr_pton.c b/usr/src/lib/libresolv2_joy/common/inet/inet_cidr_pton.c
new file mode 100644
index 0000000000..07652af463
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_cidr_pton.c
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: inet_cidr_pton.c,v 1.6 2005/04/27 04:56:19 sra Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <isc/assertions.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+static int inet_cidr_pton_ipv4 __P((const char *src, u_char *dst,
+ int *bits, int ipv6));
+static int inet_cidr_pton_ipv6 __P((const char *src, u_char *dst,
+ int *bits));
+
+static int getbits(const char *, int ipv6);
+
+/*%
+ * int
+ * inet_cidr_pton(af, src, dst, *bits)
+ * convert network address from presentation to network format.
+ * accepts inet_pton()'s input for this "af" plus trailing "/CIDR".
+ * "dst" is assumed large enough for its "af". "bits" is set to the
+ * /CIDR prefix length, which can have defaults (like /32 for IPv4).
+ * return:
+ * -1 if an error occurred (inspect errno; ENOENT means bad format).
+ * 0 if successful conversion occurred.
+ * note:
+ * 192.5.5.1/28 has a nonzero host part, which means it isn't a network
+ * as called for by inet_net_pton() but it can be a host address with
+ * an included netmask.
+ * author:
+ * Paul Vixie (ISC), October 1998
+ */
+int
+inet_cidr_pton(int af, const char *src, void *dst, int *bits) {
+ switch (af) {
+ case AF_INET:
+ return (inet_cidr_pton_ipv4(src, dst, bits, 0));
+ case AF_INET6:
+ return (inet_cidr_pton_ipv6(src, dst, bits));
+ default:
+ errno = EAFNOSUPPORT;
+ return (-1);
+ }
+}
+
+static const char digits[] = "0123456789";
+
+static int
+inet_cidr_pton_ipv4(const char *src, u_char *dst, int *pbits, int ipv6) {
+ const u_char *odst = dst;
+ int n, ch, tmp, bits;
+ size_t size = 4;
+
+ /* Get the mantissa. */
+ while (ch = *src++, (isascii(ch) && isdigit(ch))) {
+ tmp = 0;
+ do {
+ n = strchr(digits, ch) - digits;
+ INSIST(n >= 0 && n <= 9);
+ tmp *= 10;
+ tmp += n;
+ if (tmp > 255)
+ goto enoent;
+ } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
+ if (size-- == 0U)
+ goto emsgsize;
+ *dst++ = (u_char) tmp;
+ if (ch == '\0' || ch == '/')
+ break;
+ if (ch != '.')
+ goto enoent;
+ }
+
+ /* Get the prefix length if any. */
+ bits = -1;
+ if (ch == '/' && dst > odst) {
+ bits = getbits(src, ipv6);
+ if (bits == -2)
+ goto enoent;
+ } else if (ch != '\0')
+ goto enoent;
+
+ /* Prefix length can default to /32 only if all four octets spec'd. */
+ if (bits == -1) {
+ if (dst - odst == 4)
+ bits = ipv6 ? 128 : 32;
+ else
+ goto enoent;
+ }
+
+ /* If nothing was written to the destination, we found no address. */
+ if (dst == odst)
+ goto enoent;
+
+ /* If prefix length overspecifies mantissa, life is bad. */
+ if (((bits - (ipv6 ? 96 : 0)) / 8) > (dst - odst))
+ goto enoent;
+
+ /* Extend address to four octets. */
+ while (size-- > 0U)
+ *dst++ = 0;
+
+ *pbits = bits;
+ return (0);
+
+ enoent:
+ errno = ENOENT;
+ return (-1);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
+}
+
+static int
+inet_cidr_pton_ipv6(const char *src, u_char *dst, int *pbits) {
+ static const char xdigits_l[] = "0123456789abcdef",
+ xdigits_u[] = "0123456789ABCDEF";
+ u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
+ const char *xdigits, *curtok;
+ int ch, saw_xdigit;
+ u_int val;
+ int bits;
+
+ memset((tp = tmp), '\0', NS_IN6ADDRSZ);
+ endp = tp + NS_IN6ADDRSZ;
+ colonp = NULL;
+ /* Leading :: requires some special handling. */
+ if (*src == ':')
+ if (*++src != ':')
+ return (0);
+ curtok = src;
+ saw_xdigit = 0;
+ val = 0;
+ bits = -1;
+ while ((ch = *src++) != '\0') {
+ const char *pch;
+
+ if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
+ pch = strchr((xdigits = xdigits_u), ch);
+ if (pch != NULL) {
+ val <<= 4;
+ val |= (pch - xdigits);
+ if (val > 0xffff)
+ return (0);
+ saw_xdigit = 1;
+ continue;
+ }
+ if (ch == ':') {
+ curtok = src;
+ if (!saw_xdigit) {
+ if (colonp)
+ return (0);
+ colonp = tp;
+ continue;
+ } else if (*src == '\0') {
+ return (0);
+ }
+ if (tp + NS_INT16SZ > endp)
+ return (0);
+ *tp++ = (u_char) (val >> 8) & 0xff;
+ *tp++ = (u_char) val & 0xff;
+ saw_xdigit = 0;
+ val = 0;
+ continue;
+ }
+ if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
+ inet_cidr_pton_ipv4(curtok, tp, &bits, 1) == 0) {
+ tp += NS_INADDRSZ;
+ saw_xdigit = 0;
+ break; /*%< '\\0' was seen by inet_pton4(). */
+ }
+ if (ch == '/') {
+ bits = getbits(src, 1);
+ if (bits == -2)
+ goto enoent;
+ break;
+ }
+ goto enoent;
+ }
+ if (saw_xdigit) {
+ if (tp + NS_INT16SZ > endp)
+ goto emsgsize;
+ *tp++ = (u_char) (val >> 8) & 0xff;
+ *tp++ = (u_char) val & 0xff;
+ }
+ if (colonp != NULL) {
+ /*
+ * Since some memmove()'s erroneously fail to handle
+ * overlapping regions, we'll do the shift by hand.
+ */
+ const int n = tp - colonp;
+ int i;
+
+ if (tp == endp)
+ goto enoent;
+ for (i = 1; i <= n; i++) {
+ endp[- i] = colonp[n - i];
+ colonp[n - i] = 0;
+ }
+ tp = endp;
+ }
+
+ memcpy(dst, tmp, NS_IN6ADDRSZ);
+
+ *pbits = bits;
+ return (0);
+
+ enoent:
+ errno = ENOENT;
+ return (-1);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
+}
+
+static int
+getbits(const char *src, int ipv6) {
+ int bits = 0;
+ char *cp, ch;
+
+ if (*src == '\0') /*%< syntax */
+ return (-2);
+ do {
+ ch = *src++;
+ cp = strchr(digits, ch);
+ if (cp == NULL) /*%< syntax */
+ return (-2);
+ bits *= 10;
+ bits += cp - digits;
+ if (bits == 0 && *src != '\0') /*%< no leading zeros */
+ return (-2);
+ if (bits > (ipv6 ? 128 : 32)) /*%< range error */
+ return (-2);
+ } while (*src != '\0');
+
+ return (bits);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_data.c b/usr/src/lib/libresolv2_joy/common/inet/inet_data.c
new file mode 100644
index 0000000000..58b8c4342d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_data.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char rcsid[] = "$Id: inet_data.c,v 1.4 2005/04/27 04:56:19 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "port_after.h"
+
+const struct in6_addr isc_in6addr_any = IN6ADDR_ANY_INIT;
+const struct in6_addr isc_in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_lnaof.c b/usr/src/lib/libresolv2_joy/common/inet/inet_lnaof.c
new file mode 100644
index 0000000000..70ac409512
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_lnaof.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "port_after.h"
+
+/*%
+ * Return the local network address portion of an
+ * internet address; handles class a/b/c network
+ * number formats.
+ */
+u_long
+inet_lnaof(in)
+ struct in_addr in;
+{
+ register u_long i = ntohl(in.s_addr);
+
+ if (IN_CLASSA(i))
+ return ((i)&IN_CLASSA_HOST);
+ else if (IN_CLASSB(i))
+ return ((i)&IN_CLASSB_HOST);
+ else
+ return ((i)&IN_CLASSC_HOST);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_makeaddr.c b/usr/src/lib/libresolv2_joy/common/inet/inet_makeaddr.c
new file mode 100644
index 0000000000..c56cb3eaeb
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_makeaddr.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "port_after.h"
+
+/*%
+ * Formulate an Internet address from network + host. Used in
+ * building addresses stored in the ifnet structure.
+ */
+struct in_addr
+inet_makeaddr(net, host)
+ u_long net, host;
+{
+ struct in_addr a;
+
+ if (net < 128U)
+ a.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
+ else if (net < 65536U)
+ a.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
+ else if (net < 16777216L)
+ a.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
+ else
+ a.s_addr = net | host;
+ a.s_addr = htonl(a.s_addr);
+ return (a);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_net_ntop.c b/usr/src/lib/libresolv2_joy/common/inet/inet_net_ntop.c
new file mode 100644
index 0000000000..fb28e3cbe5
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_net_ntop.c
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.5 2006/06/20 02:50:14 marka Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
+ char *dst, size_t size));
+static char * inet_net_ntop_ipv6 __P((const u_char *src, int bits,
+ char *dst, size_t size));
+
+/*%
+ * char *
+ * inet_net_ntop(af, src, bits, dst, size)
+ * convert network number from network to presentation format.
+ * generates CIDR style result always.
+ * return:
+ * pointer to dst, or NULL if an error occurred (check errno).
+ * author:
+ * Paul Vixie (ISC), July 1996
+ */
+char *
+inet_net_ntop(af, src, bits, dst, size)
+ int af;
+ const void *src;
+ int bits;
+ char *dst;
+ size_t size;
+{
+ switch (af) {
+ case AF_INET:
+ return (inet_net_ntop_ipv4(src, bits, dst, size));
+ case AF_INET6:
+ return (inet_net_ntop_ipv6(src, bits, dst, size));
+ default:
+ errno = EAFNOSUPPORT;
+ return (NULL);
+ }
+}
+
+/*%
+ * static char *
+ * inet_net_ntop_ipv4(src, bits, dst, size)
+ * convert IPv4 network number from network to presentation format.
+ * generates CIDR style result always.
+ * return:
+ * pointer to dst, or NULL if an error occurred (check errno).
+ * note:
+ * network byte order assumed. this means 192.5.5.240/28 has
+ * 0b11110000 in its fourth octet.
+ * author:
+ * Paul Vixie (ISC), July 1996
+ */
+static char *
+inet_net_ntop_ipv4(src, bits, dst, size)
+ const u_char *src;
+ int bits;
+ char *dst;
+ size_t size;
+{
+ char *odst = dst;
+ char *t;
+ u_int m;
+ int b;
+
+ if (bits < 0 || bits > 32) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ if (bits == 0) {
+ if (size < sizeof "0")
+ goto emsgsize;
+ *dst++ = '0';
+ size--;
+ *dst = '\0';
+ }
+
+ /* Format whole octets. */
+ for (b = bits / 8; b > 0; b--) {
+ if (size <= sizeof "255.")
+ goto emsgsize;
+ t = dst;
+ dst += SPRINTF((dst, "%u", *src++));
+ if (b > 1) {
+ *dst++ = '.';
+ *dst = '\0';
+ }
+ size -= (size_t)(dst - t);
+ }
+
+ /* Format partial octet. */
+ b = bits % 8;
+ if (b > 0) {
+ if (size <= sizeof ".255")
+ goto emsgsize;
+ t = dst;
+ if (dst != odst)
+ *dst++ = '.';
+ m = ((1 << b) - 1) << (8 - b);
+ dst += SPRINTF((dst, "%u", *src & m));
+ size -= (size_t)(dst - t);
+ }
+
+ /* Format CIDR /width. */
+ if (size <= sizeof "/32")
+ goto emsgsize;
+ dst += SPRINTF((dst, "/%u", bits));
+ return (odst);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (NULL);
+}
+
+/*%
+ * static char *
+ * inet_net_ntop_ipv6(src, bits, fakebits, dst, size)
+ * convert IPv6 network number from network to presentation format.
+ * generates CIDR style result always. Picks the shortest representation
+ * unless the IP is really IPv4.
+ * always prints specified number of bits (bits).
+ * return:
+ * pointer to dst, or NULL if an error occurred (check errno).
+ * note:
+ * network byte order assumed. this means 192.5.5.240/28 has
+ * 0x11110000 in its fourth octet.
+ * author:
+ * Vadim Kogan (UCB), June 2001
+ * Original version (IPv4) by Paul Vixie (ISC), July 1996
+ */
+
+static char *
+inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) {
+ u_int m;
+ int b;
+ int p;
+ int zero_s, zero_l, tmp_zero_s, tmp_zero_l;
+ int i;
+ int is_ipv4 = 0;
+ unsigned char inbuf[16];
+ char outbuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255/128")];
+ char *cp;
+ int words;
+ u_char *s;
+
+ if (bits < 0 || bits > 128) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ cp = outbuf;
+
+ if (bits == 0) {
+ *cp++ = ':';
+ *cp++ = ':';
+ *cp = '\0';
+ } else {
+ /* Copy src to private buffer. Zero host part. */
+ p = (bits + 7) / 8;
+ memcpy(inbuf, src, p);
+ memset(inbuf + p, 0, 16 - p);
+ b = bits % 8;
+ if (b != 0) {
+ m = ~0 << (8 - b);
+ inbuf[p-1] &= m;
+ }
+
+ s = inbuf;
+
+ /* how many words need to be displayed in output */
+ words = (bits + 15) / 16;
+ if (words == 1)
+ words = 2;
+
+ /* Find the longest substring of zero's */
+ zero_s = zero_l = tmp_zero_s = tmp_zero_l = 0;
+ for (i = 0; i < (words * 2); i += 2) {
+ if ((s[i] | s[i+1]) == 0) {
+ if (tmp_zero_l == 0)
+ tmp_zero_s = i / 2;
+ tmp_zero_l++;
+ } else {
+ if (tmp_zero_l && zero_l < tmp_zero_l) {
+ zero_s = tmp_zero_s;
+ zero_l = tmp_zero_l;
+ tmp_zero_l = 0;
+ }
+ }
+ }
+
+ if (tmp_zero_l && zero_l < tmp_zero_l) {
+ zero_s = tmp_zero_s;
+ zero_l = tmp_zero_l;
+ }
+
+ if (zero_l != words && zero_s == 0 && ((zero_l == 6) ||
+ ((zero_l == 5 && s[10] == 0xff && s[11] == 0xff) ||
+ ((zero_l == 7 && s[14] != 0 && s[15] != 1)))))
+ is_ipv4 = 1;
+
+ /* Format whole words. */
+ for (p = 0; p < words; p++) {
+ if (zero_l != 0 && p >= zero_s && p < zero_s + zero_l) {
+ /* Time to skip some zeros */
+ if (p == zero_s)
+ *cp++ = ':';
+ if (p == words - 1)
+ *cp++ = ':';
+ s++;
+ s++;
+ continue;
+ }
+
+ if (is_ipv4 && p > 5 ) {
+ *cp++ = (p == 6) ? ':' : '.';
+ cp += SPRINTF((cp, "%u", *s++));
+ /* we can potentially drop the last octet */
+ if (p != 7 || bits > 120) {
+ *cp++ = '.';
+ cp += SPRINTF((cp, "%u", *s++));
+ }
+ } else {
+ if (cp != outbuf)
+ *cp++ = ':';
+ cp += SPRINTF((cp, "%x", *s * 256 + s[1]));
+ s += 2;
+ }
+ }
+ }
+ /* Format CIDR /width. */
+ sprintf(cp, "/%u", bits);
+ if (strlen(outbuf) + 1 > size)
+ goto emsgsize;
+ strcpy(dst, outbuf);
+
+ return (dst);
+
+emsgsize:
+ errno = EMSGSIZE;
+ return (NULL);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_net_pton.c b/usr/src/lib/libresolv2_joy/common/inet/inet_net_pton.c
new file mode 100644
index 0000000000..8d8bfb1f64
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_net_pton.c
@@ -0,0 +1,407 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1996, 1998, 1999, 2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: inet_net_pton.c,v 1.10 2008/11/14 02:36:51 marka Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <isc/assertions.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+/*%
+ * static int
+ * inet_net_pton_ipv4(src, dst, size)
+ * convert IPv4 network number from presentation to network format.
+ * accepts hex octets, hex strings, decimal octets, and /CIDR.
+ * "size" is in bytes and describes "dst".
+ * return:
+ * number of bits, either imputed classfully or specified with /CIDR,
+ * or -1 if some failure occurred (check errno). ENOENT means it was
+ * not an IPv4 network specification.
+ * note:
+ * network byte order assumed. this means 192.5.5.240/28 has
+ * 0b11110000 in its fourth octet.
+ * author:
+ * Paul Vixie (ISC), June 1996
+ */
+static int
+inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) {
+ static const char xdigits[] = "0123456789abcdef";
+ static const char digits[] = "0123456789";
+ int n, ch, tmp = 0, dirty, bits;
+ const u_char *odst = dst;
+
+ ch = *src++;
+ if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
+ && isascii((unsigned char)(src[1]))
+ && isxdigit((unsigned char)(src[1]))) {
+ /* Hexadecimal: Eat nybble string. */
+ if (size <= 0U)
+ goto emsgsize;
+ dirty = 0;
+ src++; /*%< skip x or X. */
+ while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) {
+ if (isupper(ch))
+ ch = tolower(ch);
+ n = strchr(xdigits, ch) - xdigits;
+ INSIST(n >= 0 && n <= 15);
+ if (dirty == 0)
+ tmp = n;
+ else
+ tmp = (tmp << 4) | n;
+ if (++dirty == 2) {
+ if (size-- <= 0U)
+ goto emsgsize;
+ *dst++ = (u_char) tmp;
+ dirty = 0;
+ }
+ }
+ if (dirty) { /*%< Odd trailing nybble? */
+ if (size-- <= 0U)
+ goto emsgsize;
+ *dst++ = (u_char) (tmp << 4);
+ }
+ } else if (isascii(ch) && isdigit(ch)) {
+ /* Decimal: eat dotted digit string. */
+ for (;;) {
+ tmp = 0;
+ do {
+ n = strchr(digits, ch) - digits;
+ INSIST(n >= 0 && n <= 9);
+ tmp *= 10;
+ tmp += n;
+ if (tmp > 255)
+ goto enoent;
+ } while ((ch = *src++) != '\0' &&
+ isascii(ch) && isdigit(ch));
+ if (size-- <= 0U)
+ goto emsgsize;
+ *dst++ = (u_char) tmp;
+ if (ch == '\0' || ch == '/')
+ break;
+ if (ch != '.')
+ goto enoent;
+ ch = *src++;
+ if (!isascii(ch) || !isdigit(ch))
+ goto enoent;
+ }
+ } else
+ goto enoent;
+
+ bits = -1;
+ if (ch == '/' && isascii((unsigned char)(src[0])) &&
+ isdigit((unsigned char)(src[0])) && dst > odst) {
+ /* CIDR width specifier. Nothing can follow it. */
+ ch = *src++; /*%< Skip over the /. */
+ bits = 0;
+ do {
+ n = strchr(digits, ch) - digits;
+ INSIST(n >= 0 && n <= 9);
+ bits *= 10;
+ bits += n;
+ if (bits > 32)
+ goto enoent;
+ } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
+ if (ch != '\0')
+ goto enoent;
+ }
+
+ /* Firey death and destruction unless we prefetched EOS. */
+ if (ch != '\0')
+ goto enoent;
+
+ /* If nothing was written to the destination, we found no address. */
+ if (dst == odst)
+ goto enoent;
+ /* If no CIDR spec was given, infer width from net class. */
+ if (bits == -1) {
+ if (*odst >= 240) /*%< Class E */
+ bits = 32;
+ else if (*odst >= 224) /*%< Class D */
+ bits = 8;
+ else if (*odst >= 192) /*%< Class C */
+ bits = 24;
+ else if (*odst >= 128) /*%< Class B */
+ bits = 16;
+ else /*%< Class A */
+ bits = 8;
+ /* If imputed mask is narrower than specified octets, widen. */
+ if (bits < ((dst - odst) * 8))
+ bits = (dst - odst) * 8;
+ /*
+ * If there are no additional bits specified for a class D
+ * address adjust bits to 4.
+ */
+ if (bits == 8 && *odst == 224)
+ bits = 4;
+ }
+ /* Extend network to cover the actual mask. */
+ while (bits > ((dst - odst) * 8)) {
+ if (size-- <= 0U)
+ goto emsgsize;
+ *dst++ = '\0';
+ }
+ return (bits);
+
+ enoent:
+ errno = ENOENT;
+ return (-1);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
+}
+
+static int
+getbits(const char *src, int *bitsp) {
+ static const char digits[] = "0123456789";
+ int n;
+ int val;
+ char ch;
+
+ val = 0;
+ n = 0;
+ while ((ch = *src++) != '\0') {
+ const char *pch;
+
+ pch = strchr(digits, ch);
+ if (pch != NULL) {
+ if (n++ != 0 && val == 0) /*%< no leading zeros */
+ return (0);
+ val *= 10;
+ val += (pch - digits);
+ if (val > 128) /*%< range */
+ return (0);
+ continue;
+ }
+ return (0);
+ }
+ if (n == 0)
+ return (0);
+ *bitsp = val;
+ return (1);
+}
+
+static int
+getv4(const char *src, u_char *dst, int *bitsp) {
+ static const char digits[] = "0123456789";
+ u_char *odst = dst;
+ int n;
+ u_int val;
+ char ch;
+
+ val = 0;
+ n = 0;
+ while ((ch = *src++) != '\0') {
+ const char *pch;
+
+ pch = strchr(digits, ch);
+ if (pch != NULL) {
+ if (n++ != 0 && val == 0) /*%< no leading zeros */
+ return (0);
+ val *= 10;
+ val += (pch - digits);
+ if (val > 255) /*%< range */
+ return (0);
+ continue;
+ }
+ if (ch == '.' || ch == '/') {
+ if (dst - odst > 3) /*%< too many octets? */
+ return (0);
+ *dst++ = val;
+ if (ch == '/')
+ return (getbits(src, bitsp));
+ val = 0;
+ n = 0;
+ continue;
+ }
+ return (0);
+ }
+ if (n == 0)
+ return (0);
+ if (dst - odst > 3) /*%< too many octets? */
+ return (0);
+ *dst++ = val;
+ return (1);
+}
+
+static int
+inet_net_pton_ipv6(const char *src, u_char *dst, size_t size) {
+ static const char xdigits_l[] = "0123456789abcdef",
+ xdigits_u[] = "0123456789ABCDEF";
+ u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
+ const char *xdigits, *curtok;
+ int ch, saw_xdigit;
+ u_int val;
+ int digits;
+ int bits;
+ size_t bytes;
+ int words;
+ int ipv4;
+
+ memset((tp = tmp), '\0', NS_IN6ADDRSZ);
+ endp = tp + NS_IN6ADDRSZ;
+ colonp = NULL;
+ /* Leading :: requires some special handling. */
+ if (*src == ':')
+ if (*++src != ':')
+ goto enoent;
+ curtok = src;
+ saw_xdigit = 0;
+ val = 0;
+ digits = 0;
+ bits = -1;
+ ipv4 = 0;
+ while ((ch = *src++) != '\0') {
+ const char *pch;
+
+ if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
+ pch = strchr((xdigits = xdigits_u), ch);
+ if (pch != NULL) {
+ val <<= 4;
+ val |= (pch - xdigits);
+ if (++digits > 4)
+ goto enoent;
+ saw_xdigit = 1;
+ continue;
+ }
+ if (ch == ':') {
+ curtok = src;
+ if (!saw_xdigit) {
+ if (colonp)
+ goto enoent;
+ colonp = tp;
+ continue;
+ } else if (*src == '\0')
+ goto enoent;
+ if (tp + NS_INT16SZ > endp)
+ return (0);
+ *tp++ = (u_char) (val >> 8) & 0xff;
+ *tp++ = (u_char) val & 0xff;
+ saw_xdigit = 0;
+ digits = 0;
+ val = 0;
+ continue;
+ }
+ if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
+ getv4(curtok, tp, &bits) > 0) {
+ tp += NS_INADDRSZ;
+ saw_xdigit = 0;
+ ipv4 = 1;
+ break; /*%< '\\0' was seen by inet_pton4(). */
+ }
+ if (ch == '/' && getbits(src, &bits) > 0)
+ break;
+ goto enoent;
+ }
+ if (saw_xdigit) {
+ if (tp + NS_INT16SZ > endp)
+ goto enoent;
+ *tp++ = (u_char) (val >> 8) & 0xff;
+ *tp++ = (u_char) val & 0xff;
+ }
+ if (bits == -1)
+ bits = 128;
+
+ words = (bits + 15) / 16;
+ if (words < 2)
+ words = 2;
+ if (ipv4)
+ words = 8;
+ endp = tmp + 2 * words;
+
+ if (colonp != NULL) {
+ /*
+ * Since some memmove()'s erroneously fail to handle
+ * overlapping regions, we'll do the shift by hand.
+ */
+ const int n = tp - colonp;
+ int i;
+
+ if (tp == endp)
+ goto enoent;
+ for (i = 1; i <= n; i++) {
+ endp[- i] = colonp[n - i];
+ colonp[n - i] = 0;
+ }
+ tp = endp;
+ }
+ if (tp != endp)
+ goto enoent;
+
+ bytes = (bits + 7) / 8;
+ if (bytes > size)
+ goto emsgsize;
+ memcpy(dst, tmp, bytes);
+ return (bits);
+
+ enoent:
+ errno = ENOENT;
+ return (-1);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
+}
+
+/*%
+ * int
+ * inet_net_pton(af, src, dst, size)
+ * convert network number from presentation to network format.
+ * accepts hex octets, hex strings, decimal octets, and /CIDR.
+ * "size" is in bytes and describes "dst".
+ * return:
+ * number of bits, either imputed classfully or specified with /CIDR,
+ * or -1 if some failure occurred (check errno). ENOENT means it was
+ * not a valid network specification.
+ * author:
+ * Paul Vixie (ISC), June 1996
+ */
+int
+inet_net_pton(int af, const char *src, void *dst, size_t size) {
+ switch (af) {
+ case AF_INET:
+ return (inet_net_pton_ipv4(src, dst, size));
+ case AF_INET6:
+ return (inet_net_pton_ipv6(src, dst, size));
+ default:
+ errno = EAFNOSUPPORT;
+ return (-1);
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_neta.c b/usr/src/lib/libresolv2_joy/common/inet/inet_neta.c
new file mode 100644
index 0000000000..63a6c201a4
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_neta.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: inet_neta.c,v 1.3 2005/04/27 04:56:20 sra Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+/*%
+ * char *
+ * inet_neta(src, dst, size)
+ * format a u_long network number into presentation format.
+ * return:
+ * pointer to dst, or NULL if an error occurred (check errno).
+ * note:
+ * format of ``src'' is as for inet_network().
+ * author:
+ * Paul Vixie (ISC), July 1996
+ */
+char *
+inet_neta(src, dst, size)
+ u_long src;
+ char *dst;
+ size_t size;
+{
+ char *odst = dst;
+ char *tp;
+
+ while (src & 0xffffffff) {
+ u_char b = (src & 0xff000000) >> 24;
+
+ src <<= 8;
+ if (b) {
+ if (size < sizeof "255.")
+ goto emsgsize;
+ tp = dst;
+ dst += SPRINTF((dst, "%u", b));
+ if (src != 0L) {
+ *dst++ = '.';
+ *dst = '\0';
+ }
+ size -= (size_t)(dst - tp);
+ }
+ }
+ if (dst == odst) {
+ if (size < sizeof "0.0.0.0")
+ goto emsgsize;
+ strcpy(dst, "0.0.0.0");
+ }
+ return (odst);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (NULL);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_netof.c b/usr/src/lib/libresolv2_joy/common/inet/inet_netof.c
new file mode 100644
index 0000000000..c228e3d818
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_netof.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "port_after.h"
+
+/*%
+ * Return the network number from an internet
+ * address; handles class a/b/c network #'s.
+ */
+u_long
+inet_netof(in)
+ struct in_addr in;
+{
+ register u_long i = ntohl(in.s_addr);
+
+ if (IN_CLASSA(i))
+ return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
+ else if (IN_CLASSB(i))
+ return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT);
+ else
+ return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/inet_network.c b/usr/src/lib/libresolv2_joy/common/inet/inet_network.c
new file mode 100644
index 0000000000..47976cff68
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/inet_network.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <ctype.h>
+
+#include "port_after.h"
+
+/*%
+ * Internet network address interpretation routine.
+ * The library routines call this routine to interpret
+ * network numbers.
+ */
+u_long
+inet_network(cp)
+ register const char *cp;
+{
+ register u_long val, base, n, i;
+ register char c;
+ u_long parts[4], *pp = parts;
+ int digit;
+
+again:
+ val = 0; base = 10; digit = 0;
+ if (*cp == '0')
+ digit = 1, base = 8, cp++;
+ if (*cp == 'x' || *cp == 'X')
+ base = 16, cp++;
+ while ((c = *cp) != 0) {
+ if (isdigit((unsigned char)c)) {
+ if (base == 8U && (c == '8' || c == '9'))
+ return (INADDR_NONE);
+ val = (val * base) + (c - '0');
+ cp++;
+ digit = 1;
+ continue;
+ }
+ if (base == 16U && isxdigit((unsigned char)c)) {
+ val = (val << 4) +
+ (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
+ cp++;
+ digit = 1;
+ continue;
+ }
+ break;
+ }
+ if (!digit)
+ return (INADDR_NONE);
+ if (pp >= parts + 4 || val > 0xffU)
+ return (INADDR_NONE);
+ if (*cp == '.') {
+ *pp++ = val, cp++;
+ goto again;
+ }
+ if (*cp && !isspace(*cp&0xff))
+ return (INADDR_NONE);
+ *pp++ = val;
+ n = pp - parts;
+ if (n > 4U)
+ return (INADDR_NONE);
+ for (val = 0, i = 0; i < n; i++) {
+ val <<= 8;
+ val |= parts[i] & 0xff;
+ }
+ return (val);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/inet/nsap_addr.c b/usr/src/lib/libresolv2_joy/common/inet/nsap_addr.c
new file mode 100644
index 0000000000..a9972e6e32
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/inet/nsap_addr.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: nsap_addr.c,v 1.5 2005/07/28 06:51:48 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <resolv_joy.h>
+#include <resolv_mt.h>
+
+#include "port_after.h"
+
+static char
+xtob(int c) {
+ return (c - (((c >= '0') && (c <= '9')) ? '0' : '7'));
+}
+
+u_int
+inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) {
+ u_char c, nib;
+ u_int len = 0;
+
+ if (ascii[0] != '0' || (ascii[1] != 'x' && ascii[1] != 'X'))
+ return (0);
+ ascii += 2;
+
+ while ((c = *ascii++) != '\0' && len < (u_int)maxlen) {
+ if (c == '.' || c == '+' || c == '/')
+ continue;
+ if (!isascii(c))
+ return (0);
+ if (islower(c))
+ c = toupper(c);
+ if (isxdigit(c)) {
+ nib = xtob(c);
+ c = *ascii++;
+ if (c != '\0') {
+ c = toupper(c);
+ if (isxdigit(c)) {
+ *binary++ = (nib << 4) | xtob(c);
+ len++;
+ } else
+ return (0);
+ }
+ else
+ return (0);
+ }
+ else
+ return (0);
+ }
+ return (len);
+}
+
+char *
+inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
+ int nib;
+ int i;
+ char *tmpbuf = inet_nsap_ntoa_tmpbuf;
+ char *start;
+
+ if (ascii)
+ start = ascii;
+ else {
+ ascii = tmpbuf;
+ start = tmpbuf;
+ }
+
+ *ascii++ = '0';
+ *ascii++ = 'x';
+
+ if (binlen > 255)
+ binlen = 255;
+
+ for (i = 0; i < binlen; i++) {
+ nib = *binary >> 4;
+ *ascii++ = nib + (nib < 10 ? '0' : '7');
+ nib = *binary++ & 0x0f;
+ *ascii++ = nib + (nib < 10 ? '0' : '7');
+ if (((i % 2) == 0 && (i + 1) < binlen))
+ *ascii++ = '.';
+ }
+ *ascii = '\0';
+ return (start);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/dns.c b/usr/src/lib/libresolv2_joy/common/irs/dns.c
new file mode 100644
index 0000000000..7c50320ae7
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/dns.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: dns.c,v 1.5 2006/03/09 23:57:56 marka Exp $";
+#endif
+
+/*! \file
+ * \brief
+ * dns.c --- this is the top-level accessor function for the dns
+ */
+
+#include "port_before.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <resolv_joy.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "hesiod.h"
+#include "dns_p.h"
+
+/* forward */
+
+static void dns_close(struct irs_acc *);
+static struct __res_state * dns_res_get(struct irs_acc *);
+static void dns_res_set(struct irs_acc *, struct __res_state *,
+ void (*)(void *));
+
+/* public */
+
+struct irs_acc *
+irs_dns_acc(const char *options) {
+ struct irs_acc *acc;
+ struct dns_p *dns;
+
+ UNUSED(options);
+
+ if (!(acc = memget(sizeof *acc))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(acc, 0x5e, sizeof *acc);
+ if (!(dns = memget(sizeof *dns))) {
+ errno = ENOMEM;
+ memput(acc, sizeof *acc);
+ return (NULL);
+ }
+ memset(dns, 0x5e, sizeof *dns);
+ dns->res = NULL;
+ dns->free_res = NULL;
+ if (hesiod_init(&dns->hes_ctx) < 0) {
+ /*
+ * We allow the dns accessor class to initialize
+ * despite hesiod failing to initialize correctly,
+ * since dns host queries don't depend on hesiod.
+ */
+ dns->hes_ctx = NULL;
+ }
+ acc->private = dns;
+#ifdef WANT_IRS_GR
+ acc->gr_map = irs_dns_gr;
+#else
+ acc->gr_map = NULL;
+#endif
+#ifdef WANT_IRS_PW
+ acc->pw_map = irs_dns_pw;
+#else
+ acc->pw_map = NULL;
+#endif
+ acc->sv_map = irs_dns_sv;
+ acc->pr_map = irs_dns_pr;
+ acc->ho_map = irs_dns_ho;
+ acc->nw_map = irs_dns_nw;
+ acc->ng_map = irs_nul_ng;
+ acc->res_get = dns_res_get;
+ acc->res_set = dns_res_set;
+ acc->close = dns_close;
+ return (acc);
+}
+
+/* methods */
+static struct __res_state *
+dns_res_get(struct irs_acc *this) {
+ struct dns_p *dns = (struct dns_p *)this->private;
+
+ if (dns->res == NULL) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (res == NULL)
+ return (NULL);
+ memset(res, 0, sizeof *res);
+ dns_res_set(this, res, free);
+ }
+
+ if ((dns->res->options & RES_INIT) == 0U &&
+ res_ninit(dns->res) < 0)
+ return (NULL);
+
+ return (dns->res);
+}
+
+static void
+dns_res_set(struct irs_acc *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct dns_p *dns = (struct dns_p *)this->private;
+
+ if (dns->res && dns->free_res) {
+ res_nclose(dns->res);
+ (*dns->free_res)(dns->res);
+ }
+ dns->res = res;
+ dns->free_res = free_res;
+}
+
+static void
+dns_close(struct irs_acc *this) {
+ struct dns_p *dns;
+
+ dns = (struct dns_p *)this->private;
+ if (dns->res && dns->free_res)
+ (*dns->free_res)(dns->res);
+ if (dns->hes_ctx)
+ hesiod_end(dns->hes_ctx);
+ memput(dns, sizeof *dns);
+ memput(this, sizeof *this);
+}
+
diff --git a/usr/src/lib/libresolv2_joy/common/irs/dns_ho.c b/usr/src/lib/libresolv2_joy/common/irs/dns_ho.c
new file mode 100644
index 0000000000..67812717fb
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/dns_ho.c
@@ -0,0 +1,1143 @@
+/*
+ * Portions Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1996-2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1985, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* from gethostnamadr.c 8.1 (Berkeley) 6/4/93 */
+/* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: dns_ho.c,v 1.23 2008/11/14 02:36:51 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* Imports. */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <string.h>
+#include <syslog.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "dns_p.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) sprintf x
+#endif
+
+/* Definitions. */
+
+#define MAXALIASES 35
+#define MAXADDRS 35
+
+#define MAXPACKET (65535) /*%< Maximum TCP message size */
+#define BOUNDS_CHECK(ptr, count) \
+ if ((ptr) + (count) > eom) { \
+ had_error++; \
+ continue; \
+ } else (void)0
+
+typedef union {
+ HEADER hdr;
+ u_char buf[MAXPACKET];
+} querybuf;
+
+struct dns_res_target {
+ struct dns_res_target *next;
+ querybuf qbuf; /*%< query buffer */
+ u_char *answer; /*%< buffer to put answer */
+ int anslen; /*%< size of answer buffer */
+ int qclass, qtype; /*%< class and type of query */
+ int action; /*%< condition whether query is really issued */
+ char qname[MAXDNAME +1]; /*%< domain name */
+#if 0
+ int n; /*%< result length */
+#endif
+};
+enum {RESTGT_DOALWAYS, RESTGT_AFTERFAILURE, RESTGT_IGNORE};
+enum {RESQRY_SUCCESS, RESQRY_FAIL};
+
+struct pvt {
+ struct hostent host;
+ char * h_addr_ptrs[MAXADDRS + 1];
+ char * host_aliases[MAXALIASES];
+ char hostbuf[8*1024];
+ u_char host_addr[16]; /*%< IPv4 or IPv6 */
+ struct __res_state *res;
+ void (*free_res)(void *);
+};
+
+typedef union {
+ int32_t al;
+ char ac;
+} align;
+
+static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
+static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
+/* Note: the IPv6 loopback address is in the "tunnel" space */
+static const u_char v6local[] = { 0,0, 0,1 }; /*%< last 4 bytes of IPv6 addr */
+/* Forwards. */
+
+static void ho_close(struct irs_ho *this);
+static struct hostent * ho_byname(struct irs_ho *this, const char *name);
+static struct hostent * ho_byname2(struct irs_ho *this, const char *name,
+ int af);
+static struct hostent * ho_byaddr(struct irs_ho *this, const void *addr,
+ int len, int af);
+static struct hostent * ho_next(struct irs_ho *this);
+static void ho_rewind(struct irs_ho *this);
+static void ho_minimize(struct irs_ho *this);
+static struct __res_state * ho_res_get(struct irs_ho *this);
+static void ho_res_set(struct irs_ho *this,
+ struct __res_state *res,
+ void (*free_res)(void *));
+static struct addrinfo * ho_addrinfo(struct irs_ho *this, const char *name,
+ const struct addrinfo *pai);
+
+static void map_v4v6_hostent(struct hostent *hp, char **bp,
+ char *ep);
+static void addrsort(res_state, char **, int);
+static struct hostent * gethostans(struct irs_ho *this,
+ const u_char *ansbuf, int anslen,
+ const char *qname, int qtype,
+ int af, int size,
+ struct addrinfo **ret_aip,
+ const struct addrinfo *pai);
+static int add_hostent(struct pvt *pvt, char *bp, char **hap,
+ struct addrinfo *ai);
+static int init(struct irs_ho *this);
+
+/* Exports. */
+
+struct irs_ho *
+irs_dns_ho(struct irs_acc *this) {
+ struct irs_ho *ho;
+ struct pvt *pvt;
+
+ UNUSED(this);
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+
+ if (!(ho = memget(sizeof *ho))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(ho, 0x5e, sizeof *ho);
+ ho->private = pvt;
+ ho->close = ho_close;
+ ho->byname = ho_byname;
+ ho->byname2 = ho_byname2;
+ ho->byaddr = ho_byaddr;
+ ho->next = ho_next;
+ ho->rewind = ho_rewind;
+ ho->minimize = ho_minimize;
+ ho->res_get = ho_res_get;
+ ho->res_set = ho_res_set;
+ ho->addrinfo = ho_addrinfo;
+ return (ho);
+}
+
+/* Methods. */
+
+static void
+ho_close(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ ho_minimize(this);
+ if (pvt->res && pvt->free_res)
+ (*pvt->free_res)(pvt->res);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct hostent *
+ho_byname(struct irs_ho *this, const char *name) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *hp;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ if (pvt->res->options & RES_USE_INET6) {
+ hp = ho_byname2(this, name, AF_INET6);
+ if (hp)
+ return (hp);
+ }
+ return (ho_byname2(this, name, AF_INET));
+}
+
+static struct hostent *
+ho_byname2(struct irs_ho *this, const char *name, int af)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *hp = NULL;
+ int n, size;
+ char tmp[NS_MAXDNAME];
+ const char *cp;
+ struct addrinfo ai;
+ struct dns_res_target *q, *p;
+ int querystate = RESQRY_FAIL;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ q = memget(sizeof(*q));
+ if (q == NULL) {
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ memset(q, 0, sizeof(*q));
+
+ switch (af) {
+ case AF_INET:
+ size = INADDRSZ;
+ q->qclass = C_IN;
+ q->qtype = T_A;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->action = RESTGT_DOALWAYS;
+ break;
+ case AF_INET6:
+ size = IN6ADDRSZ;
+ q->qclass = C_IN;
+ q->qtype = T_AAAA;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->action = RESTGT_DOALWAYS;
+ break;
+ default:
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = EAFNOSUPPORT;
+ hp = NULL;
+ goto cleanup;
+ }
+
+ /*
+ * if there aren't any dots, it could be a user-level alias.
+ * this is also done in res_nquery() since we are not the only
+ * function that looks up host names.
+ */
+ if (!strchr(name, '.') && (cp = res_hostalias(pvt->res, name,
+ tmp, sizeof tmp)))
+ name = cp;
+
+ for (p = q; p; p = p->next) {
+ switch(p->action) {
+ case RESTGT_DOALWAYS:
+ break;
+ case RESTGT_AFTERFAILURE:
+ if (querystate == RESQRY_SUCCESS)
+ continue;
+ break;
+ case RESTGT_IGNORE:
+ continue;
+ }
+
+ if ((n = res_nsearch(pvt->res, name, p->qclass, p->qtype,
+ p->answer, p->anslen)) < 0) {
+ querystate = RESQRY_FAIL;
+ continue;
+ }
+
+ memset(&ai, 0, sizeof(ai));
+ ai.ai_family = af;
+ if ((hp = gethostans(this, p->answer, n, name, p->qtype,
+ af, size, NULL,
+ (const struct addrinfo *)&ai)) != NULL)
+ goto cleanup; /*%< no more loop is necessary */
+ querystate = RESQRY_FAIL;
+ continue;
+ }
+
+ cleanup:
+ if (q != NULL)
+ memput(q, sizeof(*q));
+ return(hp);
+}
+
+static struct hostent *
+ho_byaddr(struct irs_ho *this, const void *addr, int len, int af)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ const u_char *uaddr = addr;
+ char *qp;
+ struct hostent *hp = NULL;
+ struct addrinfo ai;
+ struct dns_res_target *q, *q2, *p;
+ int n, size, i;
+ int querystate = RESQRY_FAIL;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ q = memget(sizeof(*q));
+ q2 = memget(sizeof(*q2));
+ if (q == NULL || q2 == NULL) {
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ memset(q, 0, sizeof(*q));
+ memset(q2, 0, sizeof(*q2));
+
+ if (af == AF_INET6 && len == IN6ADDRSZ &&
+ (!memcmp(uaddr, mapped, sizeof mapped) ||
+ (!memcmp(uaddr, tunnelled, sizeof tunnelled) &&
+ memcmp(&uaddr[sizeof tunnelled], v6local, sizeof(v6local))))) {
+ /* Unmap. */
+ addr = (const char *)addr + sizeof mapped;
+ uaddr += sizeof mapped;
+ af = AF_INET;
+ len = INADDRSZ;
+ }
+ switch (af) {
+ case AF_INET:
+ size = INADDRSZ;
+ q->qclass = C_IN;
+ q->qtype = T_PTR;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->action = RESTGT_DOALWAYS;
+ break;
+ case AF_INET6:
+ size = IN6ADDRSZ;
+ q->qclass = C_IN;
+ q->qtype = T_PTR;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->next = q2;
+ q->action = RESTGT_DOALWAYS;
+ q2->qclass = C_IN;
+ q2->qtype = T_PTR;
+ q2->answer = q2->qbuf.buf;
+ q2->anslen = sizeof(q2->qbuf);
+ if ((pvt->res->options & RES_NO_NIBBLE2) != 0U)
+ q2->action = RESTGT_IGNORE;
+ else
+ q2->action = RESTGT_AFTERFAILURE;
+ break;
+ default:
+ errno = EAFNOSUPPORT;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ hp = NULL;
+ goto cleanup;
+ }
+ if (size > len) {
+ errno = EINVAL;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ hp = NULL;
+ goto cleanup;
+ }
+ switch (af) {
+ case AF_INET:
+ qp = q->qname;
+ (void) sprintf(qp, "%u.%u.%u.%u.in-addr.arpa",
+ (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff),
+ (uaddr[1] & 0xff),
+ (uaddr[0] & 0xff));
+ break;
+ case AF_INET6:
+ if (q->action != RESTGT_IGNORE) {
+ const char *nibsuff = res_get_nibblesuffix(pvt->res);
+ qp = q->qname;
+ for (n = IN6ADDRSZ - 1; n >= 0; n--) {
+ i = SPRINTF((qp, "%x.%x.",
+ uaddr[n] & 0xf,
+ (uaddr[n] >> 4) & 0xf));
+ if (i != 4)
+ abort();
+ qp += i;
+ }
+ if (strlen(q->qname) + strlen(nibsuff) + 1 >
+ sizeof q->qname) {
+ errno = ENAMETOOLONG;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ hp = NULL;
+ goto cleanup;
+ }
+ strcpy(qp, nibsuff); /* (checked) */
+ }
+ if (q2->action != RESTGT_IGNORE) {
+ const char *nibsuff2 = res_get_nibblesuffix2(pvt->res);
+ qp = q2->qname;
+ for (n = IN6ADDRSZ - 1; n >= 0; n--) {
+ i = SPRINTF((qp, "%x.%x.",
+ uaddr[n] & 0xf,
+ (uaddr[n] >> 4) & 0xf));
+ if (i != 4)
+ abort();
+ qp += i;
+ }
+ if (strlen(q2->qname) + strlen(nibsuff2) + 1 >
+ sizeof q2->qname) {
+ errno = ENAMETOOLONG;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ hp = NULL;
+ goto cleanup;
+ }
+ strcpy(qp, nibsuff2); /* (checked) */
+ }
+ break;
+ default:
+ abort();
+ }
+
+ for (p = q; p; p = p->next) {
+ switch(p->action) {
+ case RESTGT_DOALWAYS:
+ break;
+ case RESTGT_AFTERFAILURE:
+ if (querystate == RESQRY_SUCCESS)
+ continue;
+ break;
+ case RESTGT_IGNORE:
+ continue;
+ }
+
+ if ((n = res_nquery(pvt->res, p->qname, p->qclass, p->qtype,
+ p->answer, p->anslen)) < 0) {
+ querystate = RESQRY_FAIL;
+ continue;
+ }
+
+ memset(&ai, 0, sizeof(ai));
+ ai.ai_family = af;
+ hp = gethostans(this, p->answer, n, p->qname, T_PTR, af, size,
+ NULL, (const struct addrinfo *)&ai);
+ if (!hp) {
+ querystate = RESQRY_FAIL;
+ continue;
+ }
+
+ memcpy(pvt->host_addr, addr, len);
+ pvt->h_addr_ptrs[0] = (char *)pvt->host_addr;
+ pvt->h_addr_ptrs[1] = NULL;
+ if (af == AF_INET && (pvt->res->options & RES_USE_INET6)) {
+ map_v4v6_address((char*)pvt->host_addr,
+ (char*)pvt->host_addr);
+ pvt->host.h_addrtype = AF_INET6;
+ pvt->host.h_length = IN6ADDRSZ;
+ }
+
+ RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
+ goto cleanup; /*%< no more loop is necessary. */
+ }
+ hp = NULL; /*%< H_ERRNO was set by subroutines */
+ cleanup:
+ if (q != NULL)
+ memput(q, sizeof(*q));
+ if (q2 != NULL)
+ memput(q2, sizeof(*q2));
+ return(hp);
+}
+
+static struct hostent *
+ho_next(struct irs_ho *this) {
+
+ UNUSED(this);
+
+ return (NULL);
+}
+
+static void
+ho_rewind(struct irs_ho *this) {
+
+ UNUSED(this);
+
+ /* NOOP */
+}
+
+static void
+ho_minimize(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->res)
+ res_nclose(pvt->res);
+}
+
+static struct __res_state *
+ho_res_get(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (!res) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ ho_res_set(this, res, free);
+ }
+
+ return (pvt->res);
+}
+
+/* XXX */
+extern struct addrinfo *addr2addrinfo __P((const struct addrinfo *,
+ const char *));
+
+static struct addrinfo *
+ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ int n;
+ char tmp[NS_MAXDNAME];
+ const char *cp;
+ struct dns_res_target *q, *q2, *p;
+ struct addrinfo sentinel, *cur;
+ int querystate = RESQRY_FAIL;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ q = memget(sizeof(*q));
+ q2 = memget(sizeof(*q2));
+ if (q == NULL || q2 == NULL) {
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ memset(q, 0, sizeof(*q2));
+ memset(q2, 0, sizeof(*q2));
+
+ switch (pai->ai_family) {
+ case AF_UNSPEC:
+ /* prefer IPv6 */
+ q->qclass = C_IN;
+ q->qtype = T_AAAA;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->next = q2;
+ q->action = RESTGT_DOALWAYS;
+ q2->qclass = C_IN;
+ q2->qtype = T_A;
+ q2->answer = q2->qbuf.buf;
+ q2->anslen = sizeof(q2->qbuf);
+ q2->action = RESTGT_DOALWAYS;
+ break;
+ case AF_INET:
+ q->qclass = C_IN;
+ q->qtype = T_A;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->action = RESTGT_DOALWAYS;
+ break;
+ case AF_INET6:
+ q->qclass = C_IN;
+ q->qtype = T_AAAA;
+ q->answer = q->qbuf.buf;
+ q->anslen = sizeof(q->qbuf);
+ q->action = RESTGT_DOALWAYS;
+ break;
+ default:
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY); /*%< better error? */
+ goto cleanup;
+ }
+
+ /*
+ * if there aren't any dots, it could be a user-level alias.
+ * this is also done in res_nquery() since we are not the only
+ * function that looks up host names.
+ */
+ if (!strchr(name, '.') && (cp = res_hostalias(pvt->res, name,
+ tmp, sizeof tmp)))
+ name = cp;
+
+ for (p = q; p; p = p->next) {
+ struct addrinfo *ai;
+
+ switch(p->action) {
+ case RESTGT_DOALWAYS:
+ break;
+ case RESTGT_AFTERFAILURE:
+ if (querystate == RESQRY_SUCCESS)
+ continue;
+ break;
+ case RESTGT_IGNORE:
+ continue;
+ }
+
+ if ((n = res_nsearch(pvt->res, name, p->qclass, p->qtype,
+ p->answer, p->anslen)) < 0) {
+ querystate = RESQRY_FAIL;
+ continue;
+ }
+ (void)gethostans(this, p->answer, n, name, p->qtype,
+ pai->ai_family, /*%< XXX: meaningless */
+ 0, &ai, pai);
+ if (ai) {
+ querystate = RESQRY_SUCCESS;
+ cur->ai_next = ai;
+ while (cur->ai_next)
+ cur = cur->ai_next;
+ } else
+ querystate = RESQRY_FAIL;
+ }
+
+ cleanup:
+ if (q != NULL)
+ memput(q, sizeof(*q));
+ if (q2 != NULL)
+ memput(q2, sizeof(*q2));
+ return(sentinel.ai_next);
+}
+
+static void
+ho_res_set(struct irs_ho *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->res && pvt->free_res) {
+ res_nclose(pvt->res);
+ (*pvt->free_res)(pvt->res);
+ }
+
+ pvt->res = res;
+ pvt->free_res = free_res;
+}
+
+/* Private. */
+
+static struct hostent *
+gethostans(struct irs_ho *this,
+ const u_char *ansbuf, int anslen, const char *qname, int qtype,
+ int af, int size, /*!< meaningless for addrinfo cases */
+ struct addrinfo **ret_aip, const struct addrinfo *pai)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ int type, class, ancount, qdcount, n, haveanswer, had_error;
+ int error = NETDB_SUCCESS;
+ int (*name_ok)(const char *);
+ const HEADER *hp;
+ const u_char *eom;
+ const u_char *eor;
+ const u_char *cp;
+ const char *tname;
+ const char *hname;
+ char *bp, *ep, **ap, **hap;
+ char tbuf[MAXDNAME+1];
+ struct addrinfo sentinel, *cur, ai;
+
+ if (pai == NULL) abort();
+ if (ret_aip != NULL)
+ *ret_aip = NULL;
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ tname = qname;
+ eom = ansbuf + anslen;
+ switch (qtype) {
+ case T_A:
+ case T_AAAA:
+ case T_ANY: /*%< use T_ANY only for T_A/T_AAAA lookup */
+ name_ok = res_hnok;
+ break;
+ case T_PTR:
+ name_ok = res_dnok;
+ break;
+ default:
+ abort();
+ }
+
+ pvt->host.h_addrtype = af;
+ pvt->host.h_length = size;
+ hname = pvt->host.h_name = NULL;
+
+ /*
+ * Find first satisfactory answer.
+ */
+ if (ansbuf + HFIXEDSZ > eom) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ hp = (const HEADER *)ansbuf;
+ ancount = ntohs(hp->ancount);
+ qdcount = ntohs(hp->qdcount);
+ bp = pvt->hostbuf;
+ ep = pvt->hostbuf + sizeof(pvt->hostbuf);
+ cp = ansbuf + HFIXEDSZ;
+ if (qdcount != 1) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
+ if (n < 0 || !maybe_ok(pvt->res, bp, name_ok)) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ cp += n + QFIXEDSZ;
+ if (cp > eom) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ if (qtype == T_A || qtype == T_AAAA || qtype == T_ANY) {
+ /* res_nsend() has already verified that the query name is the
+ * same as the one we sent; this just gets the expanded name
+ * (i.e., with the succeeding search-domain tacked on).
+ */
+ n = strlen(bp) + 1; /*%< for the \\0 */
+ if (n > MAXHOSTNAMELEN) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ pvt->host.h_name = bp;
+ hname = bp;
+ bp += n;
+ /* The qname can be abbreviated, but hname is now absolute. */
+ qname = pvt->host.h_name;
+ }
+ ap = pvt->host_aliases;
+ *ap = NULL;
+ pvt->host.h_aliases = pvt->host_aliases;
+ hap = pvt->h_addr_ptrs;
+ *hap = NULL;
+ pvt->host.h_addr_list = pvt->h_addr_ptrs;
+ haveanswer = 0;
+ had_error = 0;
+ while (ancount-- > 0 && cp < eom && !had_error) {
+ n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
+ if (n < 0 || !maybe_ok(pvt->res, bp, name_ok)) {
+ had_error++;
+ continue;
+ }
+ cp += n; /*%< name */
+ BOUNDS_CHECK(cp, 3 * INT16SZ + INT32SZ);
+ type = ns_get16(cp);
+ cp += INT16SZ; /*%< type */
+ class = ns_get16(cp);
+ cp += INT16SZ + INT32SZ; /*%< class, TTL */
+ n = ns_get16(cp);
+ cp += INT16SZ; /*%< len */
+ BOUNDS_CHECK(cp, n);
+ if (class != C_IN) {
+ cp += n;
+ continue;
+ }
+ eor = cp + n;
+ if ((qtype == T_A || qtype == T_AAAA || qtype == T_ANY) &&
+ type == T_CNAME) {
+ if (haveanswer) {
+ int level = LOG_CRIT;
+#ifdef LOG_SECURITY
+ level |= LOG_SECURITY;
+#endif
+ syslog(level,
+ "gethostans: possible attempt to exploit buffer overflow while looking up %s",
+ *qname ? qname : ".");
+ }
+ n = dn_expand(ansbuf, eor, cp, tbuf, sizeof tbuf);
+ if (n < 0 || !maybe_ok(pvt->res, tbuf, name_ok)) {
+ had_error++;
+ continue;
+ }
+ cp += n;
+ /* Store alias. */
+ if (ap >= &pvt->host_aliases[MAXALIASES-1])
+ continue;
+ *ap++ = bp;
+ n = strlen(bp) + 1; /*%< for the \\0 */
+ bp += n;
+ /* Get canonical name. */
+ n = strlen(tbuf) + 1; /*%< for the \\0 */
+ if (n > (ep - bp) || n > MAXHOSTNAMELEN) {
+ had_error++;
+ continue;
+ }
+ strcpy(bp, tbuf); /* (checked) */
+ pvt->host.h_name = bp;
+ hname = bp;
+ bp += n;
+ continue;
+ }
+ if (qtype == T_PTR && type == T_CNAME) {
+ n = dn_expand(ansbuf, eor, cp, tbuf, sizeof tbuf);
+ if (n < 0 || !maybe_dnok(pvt->res, tbuf)) {
+ had_error++;
+ continue;
+ }
+ cp += n;
+#ifdef RES_USE_DNAME
+ if ((pvt->res->options & RES_USE_DNAME) != 0U)
+#endif
+ {
+ /*
+ * We may be able to check this regardless
+ * of the USE_DNAME bit, but we add the check
+ * for now since the DNAME support is
+ * experimental.
+ */
+ if (ns_samename(tname, bp) != 1)
+ continue;
+ }
+ /* Get canonical name. */
+ n = strlen(tbuf) + 1; /*%< for the \\0 */
+ if (n > (ep - bp)) {
+ had_error++;
+ continue;
+ }
+ strcpy(bp, tbuf); /* (checked) */
+ tname = bp;
+ bp += n;
+ continue;
+ }
+ if (qtype == T_ANY) {
+ if (!(type == T_A || type == T_AAAA)) {
+ cp += n;
+ continue;
+ }
+ } else if (type != qtype) {
+ cp += n;
+ continue;
+ }
+ switch (type) {
+ case T_PTR:
+ if (ret_aip != NULL) {
+ /* addrinfo never needs T_PTR */
+ cp += n;
+ continue;
+ }
+ if (ns_samename(tname, bp) != 1) {
+ cp += n;
+ continue;
+ }
+ n = dn_expand(ansbuf, eor, cp, bp, ep - bp);
+ if (n < 0 || !maybe_hnok(pvt->res, bp) ||
+ n >= MAXHOSTNAMELEN) {
+ had_error++;
+ break;
+ }
+ cp += n;
+ if (!haveanswer) {
+ pvt->host.h_name = bp;
+ hname = bp;
+ }
+ else if (ap < &pvt->host_aliases[MAXALIASES-1])
+ *ap++ = bp;
+ else
+ n = -1;
+ if (n != -1) {
+ n = strlen(bp) + 1; /*%< for the \\0 */
+ bp += n;
+ }
+ break;
+ case T_A:
+ case T_AAAA:
+ if (ns_samename(hname, bp) != 1) {
+ cp += n;
+ continue;
+ }
+ if (type == T_A && n != INADDRSZ) {
+ cp += n;
+ continue;
+ }
+ if (type == T_AAAA && n != IN6ADDRSZ) {
+ cp += n;
+ continue;
+ }
+
+ /* make addrinfo. don't overwrite constant PAI */
+ ai = *pai;
+ ai.ai_family = (type == T_AAAA) ? AF_INET6 : AF_INET;
+ cur->ai_next = addr2addrinfo(
+ (const struct addrinfo *)&ai,
+ (const char *)cp);
+ if (cur->ai_next == NULL)
+ had_error++;
+
+ if (!haveanswer) {
+ int nn;
+
+ nn = strlen(bp) + 1; /*%< for the \\0 */
+ if (nn >= MAXHOSTNAMELEN) {
+ cp += n;
+ had_error++;
+ continue;
+ }
+ pvt->host.h_name = bp;
+ hname = bp;
+ bp += nn;
+ }
+ /* Ensure alignment. */
+ bp = (char *)(((u_long)bp + (sizeof(align) - 1)) &
+ ~(sizeof(align) - 1));
+ /* Avoid overflows. */
+ if (bp + n > &pvt->hostbuf[sizeof(pvt->hostbuf) - 1]) {
+ had_error++;
+ continue;
+ }
+ if (ret_aip) { /*%< need addrinfo. keep it. */
+ while (cur->ai_next)
+ cur = cur->ai_next;
+ } else if (cur->ai_next) { /*%< need hostent */
+ struct addrinfo *aip = cur->ai_next;
+
+ for (aip = cur->ai_next; aip;
+ aip = aip->ai_next) {
+ int m;
+
+ m = add_hostent(pvt, bp, hap, aip);
+ if (m < 0) {
+ had_error++;
+ break;
+ }
+ if (m == 0)
+ continue;
+ if (hap < &pvt->h_addr_ptrs[MAXADDRS])
+ hap++;
+ *hap = NULL;
+ bp += m;
+ }
+
+ freeaddrinfo(cur->ai_next);
+ cur->ai_next = NULL;
+ }
+ cp += n;
+ break;
+ default:
+ abort();
+ }
+ if (!had_error)
+ haveanswer++;
+ }
+ if (haveanswer) {
+ if (ret_aip == NULL) {
+ *ap = NULL;
+ *hap = NULL;
+
+ if (pvt->res->nsort && hap != pvt->h_addr_ptrs &&
+ qtype == T_A)
+ addrsort(pvt->res, pvt->h_addr_ptrs,
+ hap - pvt->h_addr_ptrs);
+ if (pvt->host.h_name == NULL) {
+ n = strlen(qname) + 1; /*%< for the \\0 */
+ if (n > (ep - bp) || n >= MAXHOSTNAMELEN)
+ goto no_recovery;
+ strcpy(bp, qname); /* (checked) */
+ pvt->host.h_name = bp;
+ bp += n;
+ }
+ if (pvt->res->options & RES_USE_INET6)
+ map_v4v6_hostent(&pvt->host, &bp, ep);
+ RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
+ return (&pvt->host);
+ } else {
+ if ((pai->ai_flags & AI_CANONNAME) != 0) {
+ if (pvt->host.h_name == NULL) {
+ sentinel.ai_next->ai_canonname =
+ strdup(qname);
+ }
+ else {
+ sentinel.ai_next->ai_canonname =
+ strdup(pvt->host.h_name);
+ }
+ }
+ *ret_aip = sentinel.ai_next;
+ return(NULL);
+ }
+ }
+ no_recovery:
+ if (sentinel.ai_next) {
+ /* this should be impossible, but check it for safety */
+ freeaddrinfo(sentinel.ai_next);
+ }
+ if (error == NETDB_SUCCESS)
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ else
+ RES_SET_H_ERRNO(pvt->res, error);
+ return(NULL);
+}
+
+static int
+add_hostent(struct pvt *pvt, char *bp, char **hap, struct addrinfo *ai)
+{
+ int addrlen;
+ char *addrp;
+ const char **tap;
+ char *obp = bp;
+
+ switch(ai->ai_addr->sa_family) {
+ case AF_INET6:
+ addrlen = IN6ADDRSZ;
+ addrp = (char *)&((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
+ break;
+ case AF_INET:
+ addrlen = INADDRSZ;
+ addrp = (char *)&((struct sockaddr_in *)ai->ai_addr)->sin_addr;
+ break;
+ default:
+ return(-1); /*%< abort? */
+ }
+
+ /* Ensure alignment. */
+ bp = (char *)(((u_long)bp + (sizeof(align) - 1)) &
+ ~(sizeof(align) - 1));
+ /* Avoid overflows. */
+ if (bp + addrlen > &pvt->hostbuf[sizeof(pvt->hostbuf) - 1])
+ return(-1);
+ if (hap >= &pvt->h_addr_ptrs[MAXADDRS])
+ return(0); /*%< fail, but not treat it as an error. */
+ /* Suppress duplicates. */
+ for (tap = (const char **)pvt->h_addr_ptrs;
+ *tap != NULL;
+ tap++)
+ if (memcmp(*tap, addrp, addrlen) == 0)
+ break;
+ if (*tap != NULL)
+ return (0);
+
+ memcpy(*hap = bp, addrp, addrlen);
+ return((bp + addrlen) - obp);
+}
+
+static void
+map_v4v6_hostent(struct hostent *hp, char **bpp, char *ep) {
+ char **ap;
+
+ if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
+ return;
+ hp->h_addrtype = AF_INET6;
+ hp->h_length = IN6ADDRSZ;
+ for (ap = hp->h_addr_list; *ap; ap++) {
+ int i = (u_long)*bpp % sizeof(align);
+
+ if (i != 0)
+ i = sizeof(align) - i;
+
+ if ((ep - *bpp) < (i + IN6ADDRSZ)) {
+ /* Out of memory. Truncate address list here. */
+ *ap = NULL;
+ return;
+ }
+ *bpp += i;
+ map_v4v6_address(*ap, *bpp);
+ *ap = *bpp;
+ *bpp += IN6ADDRSZ;
+ }
+}
+
+static void
+addrsort(res_state statp, char **ap, int num) {
+ int i, j, needsort = 0, aval[MAXADDRS];
+ char **p;
+
+ p = ap;
+ for (i = 0; i < num; i++, p++) {
+ for (j = 0 ; (unsigned)j < statp->nsort; j++)
+ if (statp->sort_list[j].addr.s_addr ==
+ (((struct in_addr *)(*p))->s_addr &
+ statp->sort_list[j].mask))
+ break;
+ aval[i] = j;
+ if (needsort == 0 && i > 0 && j < aval[i-1])
+ needsort = i;
+ }
+ if (!needsort)
+ return;
+
+ while (needsort < num) {
+ for (j = needsort - 1; j >= 0; j--) {
+ if (aval[j] > aval[j+1]) {
+ char *hp;
+
+ i = aval[j];
+ aval[j] = aval[j+1];
+ aval[j+1] = i;
+
+ hp = ap[j];
+ ap[j] = ap[j+1];
+ ap[j+1] = hp;
+
+ } else
+ break;
+ }
+ needsort++;
+ }
+}
+
+static int
+init(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res && !ho_res_get(this))
+ return (-1);
+ if (((pvt->res->options & RES_INIT) == 0U) &&
+ res_ninit(pvt->res) == -1)
+ return (-1);
+ return (0);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/irs/dns_nw.c b/usr/src/lib/libresolv2_joy/common/irs/dns_nw.c
new file mode 100644
index 0000000000..e9acfd39c7
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/dns_nw.c
@@ -0,0 +1,591 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: dns_nw.c,v 1.12 2005/04/27 04:56:22 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* Imports. */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "dns_p.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) sprintf x
+#endif
+
+/* Definitions. */
+
+#define MAXALIASES 35
+
+#define MAXPACKET (64*1024)
+
+struct pvt {
+ struct nwent net;
+ char * ali[MAXALIASES];
+ char buf[BUFSIZ+1];
+ struct __res_state * res;
+ void (*free_res)(void *);
+};
+
+typedef union {
+ long al;
+ char ac;
+} align;
+
+enum by_what { by_addr, by_name };
+
+/* Forwards. */
+
+static void nw_close(struct irs_nw *);
+static struct nwent * nw_byname(struct irs_nw *, const char *, int);
+static struct nwent * nw_byaddr(struct irs_nw *, void *, int, int);
+static struct nwent * nw_next(struct irs_nw *);
+static void nw_rewind(struct irs_nw *);
+static void nw_minimize(struct irs_nw *);
+static struct __res_state * nw_res_get(struct irs_nw *this);
+static void nw_res_set(struct irs_nw *this,
+ struct __res_state *res,
+ void (*free_res)(void *));
+
+static struct nwent * get1101byaddr(struct irs_nw *, u_char *, int);
+static struct nwent * get1101byname(struct irs_nw *, const char *);
+static struct nwent * get1101answer(struct irs_nw *,
+ u_char *ansbuf, int anslen,
+ enum by_what by_what,
+ int af, const char *name,
+ const u_char *addr, int addrlen);
+static struct nwent * get1101mask(struct irs_nw *this, struct nwent *);
+static int make1101inaddr(const u_char *, int, char *, int);
+static void normalize_name(char *name);
+static int init(struct irs_nw *this);
+
+/* Exports. */
+
+struct irs_nw *
+irs_dns_nw(struct irs_acc *this) {
+ struct irs_nw *nw;
+ struct pvt *pvt;
+
+ UNUSED(this);
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ if (!(nw = memget(sizeof *nw))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(nw, 0x5e, sizeof *nw);
+ nw->private = pvt;
+ nw->close = nw_close;
+ nw->byname = nw_byname;
+ nw->byaddr = nw_byaddr;
+ nw->next = nw_next;
+ nw->rewind = nw_rewind;
+ nw->minimize = nw_minimize;
+ nw->res_get = nw_res_get;
+ nw->res_set = nw_res_set;
+ return (nw);
+}
+
+/* Methods. */
+
+static void
+nw_close(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ nw_minimize(this);
+
+ if (pvt->res && pvt->free_res)
+ (*pvt->free_res)(pvt->res);
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct nwent *
+nw_byname(struct irs_nw *this, const char *name, int af) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ switch (af) {
+ case AF_INET:
+ return (get1101byname(this, name));
+ default:
+ (void)NULL;
+ }
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = EAFNOSUPPORT;
+ return (NULL);
+}
+
+static struct nwent *
+nw_byaddr(struct irs_nw *this, void *net, int len, int af) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ switch (af) {
+ case AF_INET:
+ return (get1101byaddr(this, net, len));
+ default:
+ (void)NULL;
+ }
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = EAFNOSUPPORT;
+ return (NULL);
+}
+
+static struct nwent *
+nw_next(struct irs_nw *this) {
+
+ UNUSED(this);
+
+ return (NULL);
+}
+
+static void
+nw_rewind(struct irs_nw *this) {
+ UNUSED(this);
+ /* NOOP */
+}
+
+static void
+nw_minimize(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->res)
+ res_nclose(pvt->res);
+}
+
+static struct __res_state *
+nw_res_get(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (!res) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ nw_res_set(this, res, free);
+ }
+
+ return (pvt->res);
+}
+
+static void
+nw_res_set(struct irs_nw *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->res && pvt->free_res) {
+ res_nclose(pvt->res);
+ (*pvt->free_res)(pvt->res);
+ }
+
+ pvt->res = res;
+ pvt->free_res = free_res;
+}
+
+/* Private. */
+
+static struct nwent *
+get1101byname(struct irs_nw *this, const char *name) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ u_char *ansbuf;
+ int anslen;
+ struct nwent *result;
+
+ ansbuf = memget(MAXPACKET);
+ if (ansbuf == NULL) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ anslen = res_nsearch(pvt->res, name, C_IN, T_PTR, ansbuf, MAXPACKET);
+ if (anslen < 0) {
+ memput(ansbuf, MAXPACKET);
+ return (NULL);
+ }
+ result = get1101mask(this, get1101answer(this, ansbuf, anslen, by_name,
+ AF_INET, name, NULL, 0));
+ memput(ansbuf, MAXPACKET);
+ return (result);
+}
+
+static struct nwent *
+get1101byaddr(struct irs_nw *this, u_char *net, int len) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char qbuf[sizeof "255.255.255.255.in-addr.arpa"];
+ struct nwent *result;
+ u_char *ansbuf;
+ int anslen;
+
+ if (len < 1 || len > 32) {
+ errno = EINVAL;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ if (make1101inaddr(net, len, qbuf, sizeof qbuf) < 0)
+ return (NULL);
+ ansbuf = memget(MAXPACKET);
+ if (ansbuf == NULL) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ anslen = res_nquery(pvt->res, qbuf, C_IN, T_PTR, ansbuf, MAXPACKET);
+ if (anslen < 0) {
+ memput(ansbuf, MAXPACKET);
+ return (NULL);
+ }
+ result = get1101mask(this, get1101answer(this, ansbuf, anslen, by_addr,
+ AF_INET, NULL, net, len));
+ memput(ansbuf, MAXPACKET);
+ return (result);
+}
+
+static struct nwent *
+get1101answer(struct irs_nw *this,
+ u_char *ansbuf, int anslen, enum by_what by_what,
+ int af, const char *name, const u_char *addr, int addrlen)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ int type, class, ancount, qdcount, haveanswer;
+ char *bp, *ep, **ap;
+ u_char *cp, *eom;
+ HEADER *hp;
+
+ /* Initialize, and parse header. */
+ eom = ansbuf + anslen;
+ if (ansbuf + HFIXEDSZ > eom) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ hp = (HEADER *)ansbuf;
+ cp = ansbuf + HFIXEDSZ;
+ qdcount = ntohs(hp->qdcount);
+ while (qdcount-- > 0) {
+ int n = dn_skipname(cp, eom);
+ cp += n + QFIXEDSZ;
+ if (n < 0 || cp > eom) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ }
+ ancount = ntohs(hp->ancount);
+ if (!ancount) {
+ if (hp->aa)
+ RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);
+ else
+ RES_SET_H_ERRNO(pvt->res, TRY_AGAIN);
+ return (NULL);
+ }
+
+ /* Prepare a return structure. */
+ bp = pvt->buf;
+ ep = pvt->buf + sizeof(pvt->buf);
+ pvt->net.n_name = NULL;
+ pvt->net.n_aliases = pvt->ali;
+ pvt->net.n_addrtype = af;
+ pvt->net.n_addr = NULL;
+ pvt->net.n_length = addrlen;
+
+ /* Save input key if given. */
+ switch (by_what) {
+ case by_name:
+ if (name != NULL) {
+ int n = strlen(name) + 1;
+
+ if (n > (ep - bp)) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ pvt->net.n_name = strcpy(bp, name); /* (checked) */
+ bp += n;
+ }
+ break;
+ case by_addr:
+ if (addr != NULL && addrlen != 0) {
+ int n = addrlen / 8 + ((addrlen % 8) != 0);
+
+ if (INADDRSZ > (ep - bp)) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ memset(bp, 0, INADDRSZ);
+ memcpy(bp, addr, n);
+ pvt->net.n_addr = bp;
+ bp += INADDRSZ;
+ }
+ break;
+ default:
+ abort();
+ }
+
+ /* Parse the answer, collect aliases. */
+ ap = pvt->ali;
+ haveanswer = 0;
+ while (--ancount >= 0 && cp < eom) {
+ int n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
+
+ cp += n; /*%< Owner */
+ if (n < 0 || !maybe_dnok(pvt->res, bp) ||
+ cp + 3 * INT16SZ + INT32SZ > eom) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ GETSHORT(type, cp); /*%< Type */
+ GETSHORT(class, cp); /*%< Class */
+ cp += INT32SZ; /*%< TTL */
+ GETSHORT(n, cp); /*%< RDLENGTH */
+ if (class == C_IN && type == T_PTR) {
+ int nn;
+
+ nn = dn_expand(ansbuf, eom, cp, bp, ep - bp);
+ if (nn < 0 || !maybe_hnok(pvt->res, bp) || nn != n) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ normalize_name(bp);
+ switch (by_what) {
+ case by_addr: {
+ if (pvt->net.n_name == NULL)
+ pvt->net.n_name = bp;
+ else if (ns_samename(pvt->net.n_name, bp) == 1)
+ break;
+ else
+ *ap++ = bp;
+ nn = strlen(bp) + 1;
+ bp += nn;
+ haveanswer++;
+ break;
+ }
+ case by_name: {
+ u_int b1, b2, b3, b4;
+
+ if (pvt->net.n_addr != NULL ||
+ sscanf(bp, "%u.%u.%u.%u.in-addr.arpa",
+ &b1, &b2, &b3, &b4) != 4)
+ break;
+ if ((ep - bp) < INADDRSZ) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ return (NULL);
+ }
+ pvt->net.n_addr = bp;
+ *bp++ = b4;
+ *bp++ = b3;
+ *bp++ = b2;
+ *bp++ = b1;
+ pvt->net.n_length = INADDRSZ * 8;
+ haveanswer++;
+ }
+ }
+ }
+ cp += n; /*%< RDATA */
+ }
+ if (!haveanswer) {
+ RES_SET_H_ERRNO(pvt->res, TRY_AGAIN);
+ return (NULL);
+ }
+ *ap = NULL;
+
+ return (&pvt->net);
+}
+
+static struct nwent *
+get1101mask(struct irs_nw *this, struct nwent *nwent) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char qbuf[sizeof "255.255.255.255.in-addr.arpa"], owner[MAXDNAME];
+ int anslen, type, class, ancount, qdcount;
+ u_char *ansbuf, *cp, *eom;
+ HEADER *hp;
+
+ if (!nwent)
+ return (NULL);
+ if (make1101inaddr(nwent->n_addr, nwent->n_length, qbuf, sizeof qbuf)
+ < 0) {
+ /* "First, do no harm." */
+ return (nwent);
+ }
+
+ ansbuf = memget(MAXPACKET);
+ if (ansbuf == NULL) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ /* Query for the A RR that would hold this network's mask. */
+ anslen = res_nquery(pvt->res, qbuf, C_IN, T_A, ansbuf, MAXPACKET);
+ if (anslen < HFIXEDSZ) {
+ memput(ansbuf, MAXPACKET);
+ return (nwent);
+ }
+
+ /* Initialize, and parse header. */
+ hp = (HEADER *)ansbuf;
+ cp = ansbuf + HFIXEDSZ;
+ eom = ansbuf + anslen;
+ qdcount = ntohs(hp->qdcount);
+ while (qdcount-- > 0) {
+ int n = dn_skipname(cp, eom);
+ cp += n + QFIXEDSZ;
+ if (n < 0 || cp > eom) {
+ memput(ansbuf, MAXPACKET);
+ return (nwent);
+ }
+ }
+ ancount = ntohs(hp->ancount);
+
+ /* Parse the answer, collect aliases. */
+ while (--ancount >= 0 && cp < eom) {
+ int n = dn_expand(ansbuf, eom, cp, owner, sizeof owner);
+
+ if (n < 0 || !maybe_dnok(pvt->res, owner))
+ break;
+ cp += n; /*%< Owner */
+ if (cp + 3 * INT16SZ + INT32SZ > eom)
+ break;
+ GETSHORT(type, cp); /*%< Type */
+ GETSHORT(class, cp); /*%< Class */
+ cp += INT32SZ; /*%< TTL */
+ GETSHORT(n, cp); /*%< RDLENGTH */
+ if (cp + n > eom)
+ break;
+ if (n == INADDRSZ && class == C_IN && type == T_A &&
+ ns_samename(qbuf, owner) == 1) {
+ /* This A RR indicates the actual netmask. */
+ int nn, mm;
+
+ nwent->n_length = 0;
+ for (nn = 0; nn < INADDRSZ; nn++)
+ for (mm = 7; mm >= 0; mm--)
+ if (cp[nn] & (1 << mm))
+ nwent->n_length++;
+ else
+ break;
+ }
+ cp += n; /*%< RDATA */
+ }
+ memput(ansbuf, MAXPACKET);
+ return (nwent);
+}
+
+static int
+make1101inaddr(const u_char *net, int bits, char *name, int size) {
+ int n, m;
+ char *ep;
+
+ ep = name + size;
+
+ /* Zero fill any whole bytes left out of the prefix. */
+ for (n = (32 - bits) / 8; n > 0; n--) {
+ if (ep - name < (int)(sizeof "0."))
+ goto emsgsize;
+ m = SPRINTF((name, "0."));
+ name += m;
+ }
+
+ /* Format the partial byte, if any, within the prefix. */
+ if ((n = bits % 8) != 0) {
+ if (ep - name < (int)(sizeof "255."))
+ goto emsgsize;
+ m = SPRINTF((name, "%u.",
+ net[bits / 8] & ~((1 << (8 - n)) - 1)));
+ name += m;
+ }
+
+ /* Format the whole bytes within the prefix. */
+ for (n = bits / 8; n > 0; n--) {
+ if (ep - name < (int)(sizeof "255."))
+ goto emsgsize;
+ m = SPRINTF((name, "%u.", net[n - 1]));
+ name += m;
+ }
+
+ /* Add the static text. */
+ if (ep - name < (int)(sizeof "in-addr.arpa"))
+ goto emsgsize;
+ (void) SPRINTF((name, "in-addr.arpa"));
+ return (0);
+
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
+}
+
+static void
+normalize_name(char *name) {
+ char *t;
+
+ /* Make lower case. */
+ for (t = name; *t; t++)
+ if (isascii((unsigned char)*t) && isupper((unsigned char)*t))
+ *t = tolower((*t)&0xff);
+
+ /* Remove trailing dots. */
+ while (t > name && t[-1] == '.')
+ *--t = '\0';
+}
+
+static int
+init(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res && !nw_res_get(this))
+ return (-1);
+ if (((pvt->res->options & RES_INIT) == 0U) &&
+ res_ninit(pvt->res) == -1)
+ return (-1);
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/dns_p.h b/usr/src/lib/libresolv2_joy/common/irs/dns_p.h
new file mode 100644
index 0000000000..d85ae2a238
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/dns_p.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: dns_p.h,v 1.4 2005/04/27 04:56:22 sra Exp $
+ */
+
+#ifndef _DNS_P_H_INCLUDED
+#define _DNS_P_H_INCLUDED
+
+#define maybe_ok(res, nm, ok) (((res)->options & RES_NOCHECKNAME) != 0U || \
+ (ok)(nm) != 0)
+#define maybe_hnok(res, hn) maybe_ok((res), (hn), res_hnok)
+#define maybe_dnok(res, dn) maybe_ok((res), (dn), res_dnok)
+
+/*%
+ * Object state.
+ */
+struct dns_p {
+ void *hes_ctx;
+ struct __res_state *res;
+ void (*free_res) __P((void *));
+};
+
+/*
+ * Methods.
+ */
+
+extern struct irs_gr * irs_dns_gr __P((struct irs_acc *));
+extern struct irs_pw * irs_dns_pw __P((struct irs_acc *));
+extern struct irs_sv * irs_dns_sv __P((struct irs_acc *));
+extern struct irs_pr * irs_dns_pr __P((struct irs_acc *));
+extern struct irs_ho * irs_dns_ho __P((struct irs_acc *));
+extern struct irs_nw * irs_dns_nw __P((struct irs_acc *));
+
+#endif /*_DNS_P_H_INCLUDED*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/dns_pr.c b/usr/src/lib/libresolv2_joy/common/irs/dns_pr.c
new file mode 100644
index 0000000000..c281be432c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/dns_pr.c
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: dns_pr.c,v 1.5 2005/04/27 04:56:22 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <netdb.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "hesiod.h"
+#include "dns_p.h"
+
+/* Types. */
+
+struct pvt {
+ struct dns_p * dns;
+ struct protoent proto;
+ char * prbuf;
+};
+
+/* Forward. */
+
+static void pr_close(struct irs_pr *);
+static struct protoent * pr_byname(struct irs_pr *, const char *);
+static struct protoent * pr_bynumber(struct irs_pr *, int);
+static struct protoent * pr_next(struct irs_pr *);
+static void pr_rewind(struct irs_pr *);
+static void pr_minimize(struct irs_pr *);
+static struct __res_state * pr_res_get(struct irs_pr *);
+static void pr_res_set(struct irs_pr *,
+ struct __res_state *,
+ void (*)(void *));
+
+static struct protoent * parse_hes_list(struct irs_pr *, char **);
+
+/* Public. */
+
+struct irs_pr *
+irs_dns_pr(struct irs_acc *this) {
+ struct dns_p *dns = (struct dns_p *)this->private;
+ struct pvt *pvt;
+ struct irs_pr *pr;
+
+ if (!dns->hes_ctx) {
+ errno = ENODEV;
+ return (NULL);
+ }
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ if (!(pr = memget(sizeof *pr))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pr, 0x5e, sizeof *pr);
+ pvt->dns = dns;
+ pr->private = pvt;
+ pr->byname = pr_byname;
+ pr->bynumber = pr_bynumber;
+ pr->next = pr_next;
+ pr->rewind = pr_rewind;
+ pr->close = pr_close;
+ pr->minimize = pr_minimize;
+ pr->res_get = pr_res_get;
+ pr->res_set = pr_res_set;
+ return (pr);
+}
+
+/* Methods. */
+
+static void
+pr_close(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->proto.p_aliases)
+ free(pvt->proto.p_aliases);
+ if (pvt->prbuf)
+ free(pvt->prbuf);
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct protoent *
+pr_byname(struct irs_pr *this, const char *name) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct dns_p *dns = pvt->dns;
+ struct protoent *proto;
+ char **hes_list;
+
+ if (!(hes_list = hesiod_resolve(dns->hes_ctx, name, "protocol")))
+ return (NULL);
+
+ proto = parse_hes_list(this, hes_list);
+ hesiod_free_list(dns->hes_ctx, hes_list);
+ return (proto);
+}
+
+static struct protoent *
+pr_bynumber(struct irs_pr *this, int num) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct dns_p *dns = pvt->dns;
+ struct protoent *proto;
+ char numstr[16];
+ char **hes_list;
+
+ sprintf(numstr, "%d", num);
+ if (!(hes_list = hesiod_resolve(dns->hes_ctx, numstr, "protonum")))
+ return (NULL);
+
+ proto = parse_hes_list(this, hes_list);
+ hesiod_free_list(dns->hes_ctx, hes_list);
+ return (proto);
+}
+
+static struct protoent *
+pr_next(struct irs_pr *this) {
+ UNUSED(this);
+ errno = ENODEV;
+ return (NULL);
+}
+
+static void
+pr_rewind(struct irs_pr *this) {
+ UNUSED(this);
+ /* NOOP */
+}
+
+static void
+pr_minimize(struct irs_pr *this) {
+ UNUSED(this);
+ /* NOOP */
+}
+
+static struct __res_state *
+pr_res_get(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct dns_p *dns = pvt->dns;
+
+ return (__hesiod_res_get(dns->hes_ctx));
+}
+
+static void
+pr_res_set(struct irs_pr *this, struct __res_state * res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct dns_p *dns = pvt->dns;
+
+ __hesiod_res_set(dns->hes_ctx, res, free_res);
+}
+
+/* Private. */
+
+static struct protoent *
+parse_hes_list(struct irs_pr *this, char **hes_list) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char *p, *cp, **cpp, **new;
+ int num = 0;
+ int max = 0;
+
+ for (cpp = hes_list; *cpp; cpp++) {
+ cp = *cpp;
+
+ /* Strip away comments, if any. */
+ if ((p = strchr(cp, '#')))
+ *p = 0;
+
+ /* Skip blank lines. */
+ p = cp;
+ while (*p && !isspace((unsigned char)*p))
+ p++;
+ if (!*p)
+ continue;
+
+ /* OK, we've got a live one. Let's parse it for real. */
+ if (pvt->prbuf)
+ free(pvt->prbuf);
+ pvt->prbuf = strdup(cp);
+
+ p = pvt->prbuf;
+ pvt->proto.p_name = p;
+ while (*p && !isspace((unsigned char)*p))
+ p++;
+ if (!*p)
+ continue;
+ *p++ = '\0';
+
+ pvt->proto.p_proto = atoi(p);
+ while (*p && !isspace((unsigned char)*p))
+ p++;
+ if (*p)
+ *p++ = '\0';
+
+ while (*p) {
+ if ((num + 1) >= max || !pvt->proto.p_aliases) {
+ max += 10;
+ new = realloc(pvt->proto.p_aliases,
+ max * sizeof(char *));
+ if (!new) {
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ pvt->proto.p_aliases = new;
+ }
+ pvt->proto.p_aliases[num++] = p;
+ while (*p && !isspace((unsigned char)*p))
+ p++;
+ if (*p)
+ *p++ = '\0';
+ }
+ if (!pvt->proto.p_aliases)
+ pvt->proto.p_aliases = malloc(sizeof(char *));
+ if (!pvt->proto.p_aliases)
+ goto cleanup;
+ pvt->proto.p_aliases[num] = NULL;
+ return (&pvt->proto);
+ }
+
+ cleanup:
+ if (pvt->proto.p_aliases) {
+ free(pvt->proto.p_aliases);
+ pvt->proto.p_aliases = NULL;
+ }
+ if (pvt->prbuf) {
+ free(pvt->prbuf);
+ pvt->prbuf = NULL;
+ }
+ return (NULL);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/dns_sv.c b/usr/src/lib/libresolv2_joy/common/irs/dns_sv.c
new file mode 100644
index 0000000000..1001dc1051
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/dns_sv.c
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: dns_sv.c,v 1.5 2005/04/27 04:56:23 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <netdb.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "hesiod.h"
+#include "dns_p.h"
+
+/* Definitions */
+
+struct pvt {
+ struct dns_p * dns;
+ struct servent serv;
+ char * svbuf;
+ struct __res_state * res;
+ void (*free_res)(void *);
+};
+
+/* Forward. */
+
+static void sv_close(struct irs_sv *);
+static struct servent * sv_byname(struct irs_sv *,
+ const char *, const char *);
+static struct servent * sv_byport(struct irs_sv *, int, const char *);
+static struct servent * sv_next(struct irs_sv *);
+static void sv_rewind(struct irs_sv *);
+static void sv_minimize(struct irs_sv *);
+#ifdef SV_RES_SETGET
+static struct __res_state * sv_res_get(struct irs_sv *);
+static void sv_res_set(struct irs_sv *,
+ struct __res_state *,
+ void (*)(void *));
+#endif
+
+static struct servent * parse_hes_list(struct irs_sv *,
+ char **, const char *);
+
+/* Public */
+
+struct irs_sv *
+irs_dns_sv(struct irs_acc *this) {
+ struct dns_p *dns = (struct dns_p *)this->private;
+ struct irs_sv *sv;
+ struct pvt *pvt;
+
+ if (!dns || !dns->hes_ctx) {
+ errno = ENODEV;
+ return (NULL);
+ }
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pvt->dns = dns;
+ if (!(sv = memget(sizeof *sv))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(sv, 0x5e, sizeof *sv);
+ sv->private = pvt;
+ sv->byname = sv_byname;
+ sv->byport = sv_byport;
+ sv->next = sv_next;
+ sv->rewind = sv_rewind;
+ sv->close = sv_close;
+ sv->minimize = sv_minimize;
+#ifdef SV_RES_SETGET
+ sv->res_get = sv_res_get;
+ sv->res_set = sv_res_set;
+#else
+ sv->res_get = NULL; /*%< sv_res_get; */
+ sv->res_set = NULL; /*%< sv_res_set; */
+#endif
+ return (sv);
+}
+
+/* Methods */
+
+static void
+sv_close(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->serv.s_aliases)
+ free(pvt->serv.s_aliases);
+ if (pvt->svbuf)
+ free(pvt->svbuf);
+
+ if (pvt->res && pvt->free_res)
+ (*pvt->free_res)(pvt->res);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct servent *
+sv_byname(struct irs_sv *this, const char *name, const char *proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct dns_p *dns = pvt->dns;
+ struct servent *s;
+ char **hes_list;
+
+ if (!(hes_list = hesiod_resolve(dns->hes_ctx, name, "service")))
+ return (NULL);
+
+ s = parse_hes_list(this, hes_list, proto);
+ hesiod_free_list(dns->hes_ctx, hes_list);
+ return (s);
+}
+
+static struct servent *
+sv_byport(struct irs_sv *this, int port, const char *proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct dns_p *dns = pvt->dns;
+ struct servent *s;
+ char portstr[16];
+ char **hes_list;
+
+ sprintf(portstr, "%d", ntohs(port));
+ if (!(hes_list = hesiod_resolve(dns->hes_ctx, portstr, "port")))
+ return (NULL);
+
+ s = parse_hes_list(this, hes_list, proto);
+ hesiod_free_list(dns->hes_ctx, hes_list);
+ return (s);
+}
+
+static struct servent *
+sv_next(struct irs_sv *this) {
+ UNUSED(this);
+ errno = ENODEV;
+ return (NULL);
+}
+
+static void
+sv_rewind(struct irs_sv *this) {
+ UNUSED(this);
+ /* NOOP */
+}
+
+/* Private */
+
+static struct servent *
+parse_hes_list(struct irs_sv *this, char **hes_list, const char *proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char *p, *cp, **cpp, **new;
+ int proto_len;
+ int num = 0;
+ int max = 0;
+
+ for (cpp = hes_list; *cpp; cpp++) {
+ cp = *cpp;
+
+ /* Strip away comments, if any. */
+ if ((p = strchr(cp, '#')))
+ *p = 0;
+
+ /* Check to make sure the protocol matches. */
+ p = cp;
+ while (*p && !isspace((unsigned char)*p))
+ p++;
+ if (!*p)
+ continue;
+ if (proto) {
+ proto_len = strlen(proto);
+ if (strncasecmp(++p, proto, proto_len) != 0)
+ continue;
+ if (p[proto_len] && !isspace(p[proto_len]&0xff))
+ continue;
+ }
+ /* OK, we've got a live one. Let's parse it for real. */
+ if (pvt->svbuf)
+ free(pvt->svbuf);
+ pvt->svbuf = strdup(cp);
+
+ p = pvt->svbuf;
+ pvt->serv.s_name = p;
+ while (*p && !isspace(*p&0xff))
+ p++;
+ if (!*p)
+ continue;
+ *p++ = '\0';
+
+ pvt->serv.s_proto = p;
+ while (*p && !isspace(*p&0xff))
+ p++;
+ if (!*p)
+ continue;
+ *p++ = '\0';
+
+ pvt->serv.s_port = htons((u_short) atoi(p));
+ while (*p && !isspace(*p&0xff))
+ p++;
+ if (*p)
+ *p++ = '\0';
+
+ while (*p) {
+ if ((num + 1) >= max || !pvt->serv.s_aliases) {
+ max += 10;
+ new = realloc(pvt->serv.s_aliases,
+ max * sizeof(char *));
+ if (!new) {
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ pvt->serv.s_aliases = new;
+ }
+ pvt->serv.s_aliases[num++] = p;
+ while (*p && !isspace(*p&0xff))
+ p++;
+ if (*p)
+ *p++ = '\0';
+ }
+ if (!pvt->serv.s_aliases)
+ pvt->serv.s_aliases = malloc(sizeof(char *));
+ if (!pvt->serv.s_aliases)
+ goto cleanup;
+ pvt->serv.s_aliases[num] = NULL;
+ return (&pvt->serv);
+ }
+
+ cleanup:
+ if (pvt->serv.s_aliases) {
+ free(pvt->serv.s_aliases);
+ pvt->serv.s_aliases = NULL;
+ }
+ if (pvt->svbuf) {
+ free(pvt->svbuf);
+ pvt->svbuf = NULL;
+ }
+ return (NULL);
+}
+
+static void
+sv_minimize(struct irs_sv *this) {
+ UNUSED(this);
+ /* NOOP */
+}
+
+#ifdef SV_RES_SETGET
+static struct __res_state *
+sv_res_get(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct dns_p *dns = pvt->dns;
+
+ return (__hesiod_res_get(dns->hes_ctx));
+}
+
+static void
+sv_res_set(struct irs_sv *this, struct __res_state * res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct dns_p *dns = pvt->dns;
+
+ __hesiod_res_set(dns->hes_ctx, res, free_res);
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gai_strerror.c b/usr/src/lib/libresolv2_joy/common/irs/gai_strerror.c
new file mode 100644
index 0000000000..9ca1c4bfe1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gai_strerror.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2001 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <port_before.h>
+#include <netdb.h>
+#include <port_after.h>
+
+#ifdef DO_PTHREADS
+#include <pthread.h>
+#include <stdlib.h>
+#endif
+
+static const char *gai_errlist[] = {
+ "no error",
+ "address family not supported for name",/*%< EAI_ADDRFAMILY */
+ "temporary failure", /*%< EAI_AGAIN */
+ "invalid flags", /*%< EAI_BADFLAGS */
+ "permanent failure", /*%< EAI_FAIL */
+ "address family not supported", /*%< EAI_FAMILY */
+ "memory failure", /*%< EAI_MEMORY */
+ "no address", /*%< EAI_NODATA */
+ "unknown name or service", /*%< EAI_NONAME */
+ "service not supported for socktype", /*%< EAI_SERVICE */
+ "socktype not supported", /*%< EAI_SOCKTYPE */
+ "system failure", /*%< EAI_SYSTEM */
+ "bad hints", /*%< EAI_BADHINTS */
+ "bad protocol", /*%< EAI_PROTOCOL */
+ "unknown error" /*%< Must be last. */
+};
+
+static const int gai_nerr = (sizeof(gai_errlist)/sizeof(*gai_errlist));
+
+#define EAI_BUFSIZE 128
+
+const char *
+gai_strerror(int ecode) {
+#ifndef DO_PTHREADS
+ static char buf[EAI_BUFSIZE];
+#else /* DO_PTHREADS */
+#ifndef LIBBIND_MUTEX_INITIALIZER
+#define LIBBIND_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#endif
+ static pthread_mutex_t lock = LIBBIND_MUTEX_INITIALIZER;
+ static pthread_key_t key;
+ static int once = 0;
+ char *buf;
+#endif
+
+ if (ecode >= 0 && ecode < (gai_nerr - 1))
+ return (gai_errlist[ecode]);
+
+#ifdef DO_PTHREADS
+ if (!once) {
+ if (pthread_mutex_lock(&lock) != 0)
+ goto unknown;
+ if (!once) {
+ if (pthread_key_create(&key, free) != 0) {
+ (void)pthread_mutex_unlock(&lock);
+ goto unknown;
+ }
+ once = 1;
+ }
+ if (pthread_mutex_unlock(&lock) != 0)
+ goto unknown;
+ }
+
+ buf = pthread_getspecific(key);
+ if (buf == NULL) {
+ buf = malloc(EAI_BUFSIZE);
+ if (buf == NULL)
+ goto unknown;
+ if (pthread_setspecific(key, buf) != 0) {
+ free(buf);
+ goto unknown;
+ }
+ }
+#endif
+ /*
+ * XXX This really should be snprintf(buf, EAI_BUFSIZE, ...).
+ * It is safe until message catalogs are used.
+ */
+ sprintf(buf, "%s: %d", gai_errlist[gai_nerr - 1], ecode);
+ return (buf);
+
+#ifdef DO_PTHREADS
+ unknown:
+ return ("unknown error");
+#endif
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gen.c b/usr/src/lib/libresolv2_joy/common/irs/gen.c
new file mode 100644
index 0000000000..7da01f5b09
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gen.c
@@ -0,0 +1,459 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: gen.c,v 1.7 2005/04/27 04:56:23 sra Exp $";
+#endif
+
+/*! \file
+ * \brief
+ * this is the top level dispatcher
+ *
+ * The dispatcher is implemented as an accessor class; it is an
+ * accessor class that calls other accessor classes, as controlled by a
+ * configuration file.
+ *
+ * A big difference between this accessor class and others is that the
+ * map class initializers are NULL, and the map classes are already
+ * filled in with method functions that will do the right thing.
+ */
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <isc/assertions.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "gen_p.h"
+
+#ifdef SUNW_HOSTS_FALLBACK
+extern int __res_no_hosts_fallback(void);
+#endif /* SUNW_HOSTS_FALLBACK */
+
+/* Definitions */
+
+struct nameval {
+ const char * name;
+ int val;
+};
+
+static const struct nameval acc_names[irs_nacc+1] = {
+ { "local", irs_lcl },
+ { "dns", irs_dns },
+ { "nis", irs_nis },
+ { "irp", irs_irp },
+ { NULL, irs_nacc }
+};
+
+typedef struct irs_acc *(*accinit) __P((const char *options));
+
+static const accinit accs[irs_nacc+1] = {
+ irs_lcl_acc,
+ irs_dns_acc,
+#ifdef WANT_IRS_NIS
+ irs_nis_acc,
+#else
+ NULL,
+#endif
+ irs_irp_acc,
+ NULL
+};
+
+static const struct nameval map_names[irs_nmap+1] = {
+ { "group", irs_gr },
+ { "passwd", irs_pw },
+ { "services", irs_sv },
+ { "protocols", irs_pr },
+ { "hosts", irs_ho },
+ { "networks", irs_nw },
+ { "netgroup", irs_ng },
+ { NULL, irs_nmap }
+};
+
+static const struct nameval option_names[] = {
+ { "merge", IRS_MERGE },
+ { "continue", IRS_CONTINUE },
+ { NULL, 0 }
+};
+
+/* Forward */
+
+static void gen_close(struct irs_acc *);
+static struct __res_state * gen_res_get(struct irs_acc *);
+static void gen_res_set(struct irs_acc *, struct __res_state *,
+ void (*)(void *));
+static int find_name(const char *, const struct nameval nv[]);
+static void init_map_rules(struct gen_p *, const char *conf_file);
+static struct irs_rule *release_rule(struct irs_rule *);
+static int add_rule(struct gen_p *,
+ enum irs_map_id, enum irs_acc_id,
+ const char *);
+
+/* Public */
+
+struct irs_acc *
+irs_gen_acc(const char *options, const char *conf_file) {
+ struct irs_acc *acc;
+ struct gen_p *irs;
+
+ if (!(acc = memget(sizeof *acc))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(acc, 0x5e, sizeof *acc);
+ if (!(irs = memget(sizeof *irs))) {
+ errno = ENOMEM;
+ memput(acc, sizeof *acc);
+ return (NULL);
+ }
+ memset(irs, 0x5e, sizeof *irs);
+ irs->options = strdup(options);
+ irs->res = NULL;
+ irs->free_res = NULL;
+ memset(irs->accessors, 0, sizeof irs->accessors);
+ memset(irs->map_rules, 0, sizeof irs->map_rules);
+ init_map_rules(irs, conf_file);
+ acc->private = irs;
+#ifdef WANT_IRS_GR
+ acc->gr_map = irs_gen_gr;
+#else
+ acc->gr_map = NULL;
+#endif
+#ifdef WANT_IRS_PW
+ acc->pw_map = irs_gen_pw;
+#else
+ acc->pw_map = NULL;
+#endif
+ acc->sv_map = irs_gen_sv;
+ acc->pr_map = irs_gen_pr;
+ acc->ho_map = irs_gen_ho;
+ acc->nw_map = irs_gen_nw;
+ acc->ng_map = irs_gen_ng;
+ acc->res_get = gen_res_get;
+ acc->res_set = gen_res_set;
+ acc->close = gen_close;
+ return (acc);
+}
+
+/* Methods */
+
+static struct __res_state *
+gen_res_get(struct irs_acc *this) {
+ struct gen_p *irs = (struct gen_p *)this->private;
+
+ if (irs->res == NULL) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (res == NULL)
+ return (NULL);
+ memset(res, 0, sizeof *res);
+ gen_res_set(this, res, free);
+ }
+
+ if (((irs->res->options & RES_INIT) == 0U) && res_ninit(irs->res) < 0)
+ return (NULL);
+
+ return (irs->res);
+}
+
+static void
+gen_res_set(struct irs_acc *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct gen_p *irs = (struct gen_p *)this->private;
+#if 0
+ struct irs_rule *rule;
+ struct irs_ho *ho;
+ struct irs_nw *nw;
+#endif
+
+ if (irs->res && irs->free_res) {
+ res_nclose(irs->res);
+ (*irs->free_res)(irs->res);
+ }
+
+ irs->res = res;
+ irs->free_res = free_res;
+
+#if 0
+ for (rule = irs->map_rules[irs_ho]; rule; rule = rule->next) {
+ ho = rule->inst->ho;
+
+ (*ho->res_set)(ho, res, NULL);
+ }
+ for (rule = irs->map_rules[irs_nw]; rule; rule = rule->next) {
+ nw = rule->inst->nw;
+
+ (*nw->res_set)(nw, res, NULL);
+ }
+#endif
+}
+
+static void
+gen_close(struct irs_acc *this) {
+ struct gen_p *irs = (struct gen_p *)this->private;
+ int n;
+
+ /* Search rules. */
+ for (n = 0; n < irs_nmap; n++)
+ while (irs->map_rules[n] != NULL)
+ irs->map_rules[n] = release_rule(irs->map_rules[n]);
+
+ /* Access methods. */
+ for (n = 0; n < irs_nacc; n++) {
+ /* Map objects. */
+ if (irs->accessors[n].gr != NULL)
+ (*irs->accessors[n].gr->close)(irs->accessors[n].gr);
+ if (irs->accessors[n].pw != NULL)
+ (*irs->accessors[n].pw->close)(irs->accessors[n].pw);
+ if (irs->accessors[n].sv != NULL)
+ (*irs->accessors[n].sv->close)(irs->accessors[n].sv);
+ if (irs->accessors[n].pr != NULL)
+ (*irs->accessors[n].pr->close)(irs->accessors[n].pr);
+ if (irs->accessors[n].ho != NULL)
+ (*irs->accessors[n].ho->close)(irs->accessors[n].ho);
+ if (irs->accessors[n].nw != NULL)
+ (*irs->accessors[n].nw->close)(irs->accessors[n].nw);
+ if (irs->accessors[n].ng != NULL)
+ (*irs->accessors[n].ng->close)(irs->accessors[n].ng);
+ /* Enclosing accessor. */
+ if (irs->accessors[n].acc != NULL)
+ (*irs->accessors[n].acc->close)(irs->accessors[n].acc);
+ }
+
+ /* The options string was strdup'd. */
+ free((void*)irs->options);
+
+ if (irs->res && irs->free_res)
+ (*irs->free_res)(irs->res);
+
+ /* The private data container. */
+ memput(irs, sizeof *irs);
+
+ /* The object. */
+ memput(this, sizeof *this);
+}
+
+/* Private */
+
+static int
+find_name(const char *name, const struct nameval names[]) {
+ int n;
+
+ for (n = 0; names[n].name != NULL; n++)
+ if (strcmp(name, names[n].name) == 0)
+ return (names[n].val);
+ return (-1);
+}
+
+static struct irs_rule *
+release_rule(struct irs_rule *rule) {
+ struct irs_rule *next = rule->next;
+
+ memput(rule, sizeof *rule);
+ return (next);
+}
+
+static int
+add_rule(struct gen_p *irs,
+ enum irs_map_id map, enum irs_acc_id acc,
+ const char *options)
+{
+ struct irs_rule **rules, *last, *tmp, *new;
+ struct irs_inst *inst;
+ const char *cp;
+ int n;
+
+#ifndef WANT_IRS_GR
+ if (map == irs_gr)
+ return (-1);
+#endif
+#ifndef WANT_IRS_PW
+ if (map == irs_pw)
+ return (-1);
+#endif
+#ifndef WANT_IRS_NIS
+ if (acc == irs_nis)
+ return (-1);
+#endif
+ new = memget(sizeof *new);
+ if (new == NULL)
+ return (-1);
+ memset(new, 0x5e, sizeof *new);
+ new->next = NULL;
+
+ new->inst = &irs->accessors[acc];
+
+ new->flags = 0;
+ cp = options;
+ while (cp && *cp) {
+ char option[50], *next;
+
+ next = strchr(cp, ',');
+ if (next)
+ n = next++ - cp;
+ else
+ n = strlen(cp);
+ if ((size_t)n > sizeof option - 1)
+ n = sizeof option - 1;
+ strncpy(option, cp, n);
+ option[n] = '\0';
+
+ n = find_name(option, option_names);
+ if (n >= 0)
+ new->flags |= n;
+
+ cp = next;
+ }
+
+ rules = &irs->map_rules[map];
+ for (last = NULL, tmp = *rules;
+ tmp != NULL;
+ last = tmp, tmp = tmp->next)
+ (void)NULL;
+ if (last == NULL)
+ *rules = new;
+ else
+ last->next = new;
+
+ /* Try to instantiate map accessors for this if necessary & approp. */
+ inst = &irs->accessors[acc];
+ if (inst->acc == NULL && accs[acc] != NULL)
+ inst->acc = (*accs[acc])(irs->options);
+ if (inst->acc != NULL) {
+ if (inst->gr == NULL && inst->acc->gr_map != NULL)
+ inst->gr = (*inst->acc->gr_map)(inst->acc);
+ if (inst->pw == NULL && inst->acc->pw_map != NULL)
+ inst->pw = (*inst->acc->pw_map)(inst->acc);
+ if (inst->sv == NULL && inst->acc->sv_map != NULL)
+ inst->sv = (*inst->acc->sv_map)(inst->acc);
+ if (inst->pr == NULL && inst->acc->pr_map != NULL)
+ inst->pr = (*inst->acc->pr_map)(inst->acc);
+ if (inst->ho == NULL && inst->acc->ho_map != NULL)
+ inst->ho = (*inst->acc->ho_map)(inst->acc);
+ if (inst->nw == NULL && inst->acc->nw_map != NULL)
+ inst->nw = (*inst->acc->nw_map)(inst->acc);
+ if (inst->ng == NULL && inst->acc->ng_map != NULL)
+ inst->ng = (*inst->acc->ng_map)(inst->acc);
+ }
+
+ return (0);
+}
+
+static void
+default_map_rules(struct gen_p *irs) {
+ /* Install time honoured and proved BSD style rules as default. */
+ add_rule(irs, irs_gr, irs_lcl, "");
+ add_rule(irs, irs_pw, irs_lcl, "");
+ add_rule(irs, irs_sv, irs_lcl, "");
+ add_rule(irs, irs_pr, irs_lcl, "");
+#ifdef SUNW_HOSTS_FALLBACK
+ if (__res_no_hosts_fallback())
+ add_rule(irs, irs_ho, irs_dns, "");
+ else {
+ add_rule(irs, irs_ho, irs_dns, "continue");
+ add_rule(irs, irs_ho, irs_lcl, "");
+ }
+#else /* SUNW_HOSTS_FALLBACK */
+ add_rule(irs, irs_ho, irs_dns, "continue");
+ add_rule(irs, irs_ho, irs_lcl, "");
+#endif /* SUNW_HOSTS_FALLBACK */
+ add_rule(irs, irs_nw, irs_dns, "continue");
+ add_rule(irs, irs_nw, irs_lcl, "");
+ add_rule(irs, irs_ng, irs_lcl, "");
+}
+
+static void
+init_map_rules(struct gen_p *irs, const char *conf_file) {
+ char line[1024], pattern[40], mapname[20], accname[20], options[100];
+ FILE *conf;
+
+#ifdef SUNW_HOSTS_FALLBACK
+ if (__res_no_hosts_fallback()) {
+ default_map_rules(irs);
+ return;
+ }
+#endif /* SUNW_HOSTS_FALLBACK */
+
+ if (conf_file == NULL)
+ conf_file = _PATH_IRS_CONF ;
+
+ /* A conf file of "" means compiled in defaults. Irpd wants this */
+ if (conf_file[0] == '\0' || (conf = fopen(conf_file, "r")) == NULL) {
+ default_map_rules(irs);
+ return;
+ }
+ (void) sprintf(pattern, "%%%lus %%%lus %%%lus\n",
+ (unsigned long)sizeof mapname,
+ (unsigned long)sizeof accname,
+ (unsigned long)sizeof options);
+ while (fgets(line, sizeof line, conf)) {
+ enum irs_map_id map;
+ enum irs_acc_id acc;
+ char *tmp;
+ int n;
+
+ for (tmp = line;
+ isascii((unsigned char)*tmp) &&
+ isspace((unsigned char)*tmp);
+ tmp++)
+ (void)NULL;
+ if (*tmp == '#' || *tmp == '\n' || *tmp == '\0')
+ continue;
+ n = sscanf(tmp, pattern, mapname, accname, options);
+ if (n < 2)
+ continue;
+ if (n < 3)
+ options[0] = '\0';
+
+ n = find_name(mapname, map_names);
+ INSIST(n < irs_nmap);
+ if (n < 0)
+ continue;
+ map = (enum irs_map_id) n;
+
+ n = find_name(accname, acc_names);
+ INSIST(n < irs_nacc);
+ if (n < 0)
+ continue;
+ acc = (enum irs_acc_id) n;
+
+ add_rule(irs, map, acc, options);
+ }
+ fclose(conf);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gen_ho.c b/usr/src/lib/libresolv2_joy/common/irs/gen_ho.c
new file mode 100644
index 0000000000..8e41d7d610
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gen_ho.c
@@ -0,0 +1,391 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: gen_ho.c,v 1.5 2006/03/09 23:57:56 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "gen_p.h"
+
+/* Definitions */
+
+struct pvt {
+ struct irs_rule * rules;
+ struct irs_rule * rule;
+ struct irs_ho * ho;
+ struct __res_state * res;
+ void (*free_res)(void *);
+};
+
+/* Forwards */
+
+static void ho_close(struct irs_ho *this);
+static struct hostent * ho_byname(struct irs_ho *this, const char *name);
+static struct hostent * ho_byname2(struct irs_ho *this, const char *name,
+ int af);
+static struct hostent * ho_byaddr(struct irs_ho *this, const void *addr,
+ int len, int af);
+static struct hostent * ho_next(struct irs_ho *this);
+static void ho_rewind(struct irs_ho *this);
+static void ho_minimize(struct irs_ho *this);
+static struct __res_state * ho_res_get(struct irs_ho *this);
+static void ho_res_set(struct irs_ho *this,
+ struct __res_state *res,
+ void (*free_res)(void *));
+static struct addrinfo * ho_addrinfo(struct irs_ho *this, const char *name,
+ const struct addrinfo *pai);
+
+static int init(struct irs_ho *this);
+
+/* Exports */
+
+struct irs_ho *
+irs_gen_ho(struct irs_acc *this) {
+ struct gen_p *accpvt = (struct gen_p *)this->private;
+ struct irs_ho *ho;
+ struct pvt *pvt;
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ if (!(ho = memget(sizeof *ho))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(ho, 0x5e, sizeof *ho);
+ pvt->rules = accpvt->map_rules[irs_ho];
+ pvt->rule = pvt->rules;
+ ho->private = pvt;
+ ho->close = ho_close;
+ ho->byname = ho_byname;
+ ho->byname2 = ho_byname2;
+ ho->byaddr = ho_byaddr;
+ ho->next = ho_next;
+ ho->rewind = ho_rewind;
+ ho->minimize = ho_minimize;
+ ho->res_get = ho_res_get;
+ ho->res_set = ho_res_set;
+ ho->addrinfo = ho_addrinfo;
+ return (ho);
+}
+
+/* Methods. */
+
+static void
+ho_close(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ ho_minimize(this);
+ if (pvt->res && pvt->free_res)
+ (*pvt->free_res)(pvt->res);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct hostent *
+ho_byname(struct irs_ho *this, const char *name) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct hostent *rval;
+ struct irs_ho *ho;
+ int therrno = NETDB_INTERNAL;
+ int softerror = 0;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ ho = rule->inst->ho;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = 0;
+ rval = (*ho->byname)(ho, name);
+ if (rval != NULL)
+ return (rval);
+ if (softerror == 0 &&
+ pvt->res->res_h_errno != HOST_NOT_FOUND &&
+ pvt->res->res_h_errno != NETDB_INTERNAL) {
+ softerror = 1;
+ therrno = pvt->res->res_h_errno;
+ }
+ if (rule->flags & IRS_CONTINUE)
+ continue;
+ /*
+ * The value TRY_AGAIN can mean that the service
+ * is not available, or just that this particular name
+ * cannot be resolved now. We use the errno ECONNREFUSED
+ * to distinguish. If a lookup sets that errno when
+ * H_ERRNO is TRY_AGAIN, we continue to try other lookup
+ * functions, otherwise we return the TRY_AGAIN error.
+ */
+ if (pvt->res->res_h_errno != TRY_AGAIN || errno != ECONNREFUSED)
+ break;
+ }
+ if (softerror != 0 && pvt->res->res_h_errno == HOST_NOT_FOUND)
+ RES_SET_H_ERRNO(pvt->res, therrno);
+ return (NULL);
+}
+
+static struct hostent *
+ho_byname2(struct irs_ho *this, const char *name, int af) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct hostent *rval;
+ struct irs_ho *ho;
+ int therrno = NETDB_INTERNAL;
+ int softerror = 0;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ ho = rule->inst->ho;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = 0;
+ rval = (*ho->byname2)(ho, name, af);
+ if (rval != NULL)
+ return (rval);
+ if (softerror == 0 &&
+ pvt->res->res_h_errno != HOST_NOT_FOUND &&
+ pvt->res->res_h_errno != NETDB_INTERNAL) {
+ softerror = 1;
+ therrno = pvt->res->res_h_errno;
+ }
+ if (rule->flags & IRS_CONTINUE)
+ continue;
+ /*
+ * See the comments in ho_byname() explaining
+ * the interpretation of TRY_AGAIN and ECONNREFUSED.
+ */
+ if (pvt->res->res_h_errno != TRY_AGAIN || errno != ECONNREFUSED)
+ break;
+ }
+ if (softerror != 0 && pvt->res->res_h_errno == HOST_NOT_FOUND)
+ RES_SET_H_ERRNO(pvt->res, therrno);
+ return (NULL);
+}
+
+static struct hostent *
+ho_byaddr(struct irs_ho *this, const void *addr, int len, int af) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct hostent *rval;
+ struct irs_ho *ho;
+ int therrno = NETDB_INTERNAL;
+ int softerror = 0;
+
+
+ if (init(this) == -1)
+ return (NULL);
+
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ ho = rule->inst->ho;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = 0;
+ rval = (*ho->byaddr)(ho, addr, len, af);
+ if (rval != NULL)
+ return (rval);
+ if (softerror == 0 &&
+ pvt->res->res_h_errno != HOST_NOT_FOUND &&
+ pvt->res->res_h_errno != NETDB_INTERNAL) {
+ softerror = 1;
+ therrno = pvt->res->res_h_errno;
+ }
+
+ if (rule->flags & IRS_CONTINUE)
+ continue;
+ /*
+ * See the comments in ho_byname() explaining
+ * the interpretation of TRY_AGAIN and ECONNREFUSED.
+ */
+ if (pvt->res->res_h_errno != TRY_AGAIN || errno != ECONNREFUSED)
+ break;
+ }
+ if (softerror != 0 && pvt->res->res_h_errno == HOST_NOT_FOUND)
+ RES_SET_H_ERRNO(pvt->res, therrno);
+ return (NULL);
+}
+
+static struct hostent *
+ho_next(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *rval;
+ struct irs_ho *ho;
+
+ while (pvt->rule) {
+ ho = pvt->rule->inst->ho;
+ rval = (*ho->next)(ho);
+ if (rval)
+ return (rval);
+ if (!(pvt->rule->flags & IRS_CONTINUE))
+ break;
+ pvt->rule = pvt->rule->next;
+ if (pvt->rule) {
+ ho = pvt->rule->inst->ho;
+ (*ho->rewind)(ho);
+ }
+ }
+ return (NULL);
+}
+
+static void
+ho_rewind(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_ho *ho;
+
+ pvt->rule = pvt->rules;
+ if (pvt->rule) {
+ ho = pvt->rule->inst->ho;
+ (*ho->rewind)(ho);
+ }
+}
+
+static void
+ho_minimize(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ if (pvt->res)
+ res_nclose(pvt->res);
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_ho *ho = rule->inst->ho;
+
+ (*ho->minimize)(ho);
+ }
+}
+
+static struct __res_state *
+ho_res_get(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (!res) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ ho_res_set(this, res, free);
+ }
+
+ return (pvt->res);
+}
+
+static void
+ho_res_set(struct irs_ho *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ if (pvt->res && pvt->free_res) {
+ res_nclose(pvt->res);
+ (*pvt->free_res)(pvt->res);
+ }
+
+ pvt->res = res;
+ pvt->free_res = free_res;
+
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_ho *ho = rule->inst->ho;
+
+ (*ho->res_set)(ho, pvt->res, NULL);
+ }
+}
+
+static struct addrinfo *
+ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct addrinfo *rval = NULL;
+ struct irs_ho *ho;
+ int therrno = NETDB_INTERNAL;
+ int softerror = 0;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ ho = rule->inst->ho;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ errno = 0;
+ if (ho->addrinfo == NULL) /*%< for safety */
+ continue;
+ rval = (*ho->addrinfo)(ho, name, pai);
+ if (rval != NULL)
+ return (rval);
+ if (softerror == 0 &&
+ pvt->res->res_h_errno != HOST_NOT_FOUND &&
+ pvt->res->res_h_errno != NETDB_INTERNAL) {
+ softerror = 1;
+ therrno = pvt->res->res_h_errno;
+ }
+ if (rule->flags & IRS_CONTINUE)
+ continue;
+ /*
+ * See the comments in ho_byname() explaining
+ * the interpretation of TRY_AGAIN and ECONNREFUSED.
+ */
+ if (pvt->res->res_h_errno != TRY_AGAIN ||
+ errno != ECONNREFUSED)
+ break;
+ }
+ if (softerror != 0 && pvt->res->res_h_errno == HOST_NOT_FOUND)
+ RES_SET_H_ERRNO(pvt->res, therrno);
+ return (NULL);
+}
+
+static int
+init(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res && !ho_res_get(this))
+ return (-1);
+
+ if (((pvt->res->options & RES_INIT) == 0U) &&
+ (res_ninit(pvt->res) == -1))
+ return (-1);
+
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gen_ng.c b/usr/src/lib/libresolv2_joy/common/irs/gen_ng.c
new file mode 100644
index 0000000000..e3c874ee68
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gen_ng.c
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: gen_ng.c,v 1.3 2005/04/27 04:56:23 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "gen_p.h"
+
+/* Types */
+
+struct pvt {
+ struct irs_rule * rules;
+ struct irs_rule * rule;
+ char * curgroup;
+};
+
+/* Forward */
+
+static void ng_close(struct irs_ng *);
+static int ng_next(struct irs_ng *, const char **,
+ const char **, const char **);
+static int ng_test(struct irs_ng *, const char *,
+ const char *, const char *,
+ const char *);
+static void ng_rewind(struct irs_ng *, const char *);
+static void ng_minimize(struct irs_ng *);
+
+/* Public */
+
+struct irs_ng *
+irs_gen_ng(struct irs_acc *this) {
+ struct gen_p *accpvt = (struct gen_p *)this->private;
+ struct irs_ng *ng;
+ struct pvt *pvt;
+
+ if (!(ng = memget(sizeof *ng))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(ng, 0x5e, sizeof *ng);
+ if (!(pvt = memget(sizeof *pvt))) {
+ memput(ng, sizeof *ng);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pvt->rules = accpvt->map_rules[irs_ng];
+ pvt->rule = pvt->rules;
+ ng->private = pvt;
+ ng->close = ng_close;
+ ng->next = ng_next;
+ ng->test = ng_test;
+ ng->rewind = ng_rewind;
+ ng->minimize = ng_minimize;
+ return (ng);
+}
+
+/* Methods */
+
+static void
+ng_close(struct irs_ng *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ ng_minimize(this);
+ if (pvt->curgroup)
+ free(pvt->curgroup);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static int
+ng_next(struct irs_ng *this, const char **host, const char **user,
+ const char **domain)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_ng *ng;
+
+ while (pvt->rule) {
+ ng = pvt->rule->inst->ng;
+ if ((*ng->next)(ng, host, user, domain) == 1)
+ return (1);
+ if (!(pvt->rule->flags & IRS_CONTINUE))
+ break;
+ pvt->rule = pvt->rule->next;
+ if (pvt->rule) {
+ ng = pvt->rule->inst->ng;
+ (*ng->rewind)(ng, pvt->curgroup);
+ }
+ }
+ return (0);
+}
+
+static int
+ng_test(struct irs_ng *this, const char *name,
+ const char *user, const char *host, const char *domain)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct irs_ng *ng;
+ int rval;
+
+ rval = 0;
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ ng = rule->inst->ng;
+ rval = (*ng->test)(ng, name, user, host, domain);
+ if (rval || !(rule->flags & IRS_CONTINUE))
+ break;
+ }
+ return (rval);
+}
+
+static void
+ng_rewind(struct irs_ng *this, const char *group) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_ng *ng;
+
+ pvt->rule = pvt->rules;
+ if (pvt->rule) {
+ if (pvt->curgroup)
+ free(pvt->curgroup);
+ pvt->curgroup = strdup(group);
+ ng = pvt->rule->inst->ng;
+ (*ng->rewind)(ng, pvt->curgroup);
+ }
+}
+
+static void
+ng_minimize(struct irs_ng *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_ng *ng = rule->inst->ng;
+
+ (*ng->minimize)(ng);
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gen_nw.c b/usr/src/lib/libresolv2_joy/common/irs/gen_nw.c
new file mode 100644
index 0000000000..12bd0e0f6d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gen_nw.c
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: gen_nw.c,v 1.4 2005/04/27 04:56:23 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv_joy.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "gen_p.h"
+
+/* Types */
+
+struct pvt {
+ struct irs_rule * rules;
+ struct irs_rule * rule;
+ struct __res_state * res;
+ void (*free_res)(void *);
+};
+
+/* Forward */
+
+static void nw_close(struct irs_nw*);
+static struct nwent * nw_next(struct irs_nw *);
+static struct nwent * nw_byname(struct irs_nw *, const char *, int);
+static struct nwent * nw_byaddr(struct irs_nw *, void *, int, int);
+static void nw_rewind(struct irs_nw *);
+static void nw_minimize(struct irs_nw *);
+static struct __res_state * nw_res_get(struct irs_nw *this);
+static void nw_res_set(struct irs_nw *this,
+ struct __res_state *res,
+ void (*free_res)(void *));
+
+static int init(struct irs_nw *this);
+
+/* Public */
+
+struct irs_nw *
+irs_gen_nw(struct irs_acc *this) {
+ struct gen_p *accpvt = (struct gen_p *)this->private;
+ struct irs_nw *nw;
+ struct pvt *pvt;
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ if (!(nw = memget(sizeof *nw))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(nw, 0x5e, sizeof *nw);
+ pvt->rules = accpvt->map_rules[irs_nw];
+ pvt->rule = pvt->rules;
+ nw->private = pvt;
+ nw->close = nw_close;
+ nw->next = nw_next;
+ nw->byname = nw_byname;
+ nw->byaddr = nw_byaddr;
+ nw->rewind = nw_rewind;
+ nw->minimize = nw_minimize;
+ nw->res_get = nw_res_get;
+ nw->res_set = nw_res_set;
+ return (nw);
+}
+
+/* Methods */
+
+static void
+nw_close(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ nw_minimize(this);
+
+ if (pvt->res && pvt->free_res)
+ (*pvt->free_res)(pvt->res);
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct nwent *
+nw_next(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct nwent *rval;
+ struct irs_nw *nw;
+
+ if (init(this) == -1)
+ return(NULL);
+
+ while (pvt->rule) {
+ nw = pvt->rule->inst->nw;
+ rval = (*nw->next)(nw);
+ if (rval)
+ return (rval);
+ if (!(pvt->rules->flags & IRS_CONTINUE))
+ break;
+ pvt->rule = pvt->rule->next;
+ if (pvt->rule) {
+ nw = pvt->rule->inst->nw;
+ (*nw->rewind)(nw);
+ }
+ }
+ return (NULL);
+}
+
+static struct nwent *
+nw_byname(struct irs_nw *this, const char *name, int type) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct nwent *rval;
+ struct irs_nw *nw;
+
+ if (init(this) == -1)
+ return(NULL);
+
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ nw = rule->inst->nw;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ rval = (*nw->byname)(nw, name, type);
+ if (rval != NULL)
+ return (rval);
+ if (pvt->res->res_h_errno != TRY_AGAIN &&
+ !(rule->flags & IRS_CONTINUE))
+ break;
+ }
+ return (NULL);
+}
+
+static struct nwent *
+nw_byaddr(struct irs_nw *this, void *net, int length, int type) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct nwent *rval;
+ struct irs_nw *nw;
+
+ if (init(this) == -1)
+ return(NULL);
+
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ nw = rule->inst->nw;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ rval = (*nw->byaddr)(nw, net, length, type);
+ if (rval != NULL)
+ return (rval);
+ if (pvt->res->res_h_errno != TRY_AGAIN &&
+ !(rule->flags & IRS_CONTINUE))
+ break;
+ }
+ return (NULL);
+}
+
+static void
+nw_rewind(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_nw *nw;
+
+ pvt->rule = pvt->rules;
+ if (pvt->rule) {
+ nw = pvt->rule->inst->nw;
+ (*nw->rewind)(nw);
+ }
+}
+
+static void
+nw_minimize(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ if (pvt->res)
+ res_nclose(pvt->res);
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_nw *nw = rule->inst->nw;
+
+ (*nw->minimize)(nw);
+ }
+}
+
+static struct __res_state *
+nw_res_get(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (!res) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ nw_res_set(this, res, free);
+ }
+
+ return (pvt->res);
+}
+
+static void
+nw_res_set(struct irs_nw *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ if (pvt->res && pvt->free_res) {
+ res_nclose(pvt->res);
+ (*pvt->free_res)(pvt->res);
+ }
+
+ pvt->res = res;
+ pvt->free_res = free_res;
+
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_nw *nw = rule->inst->nw;
+
+ (*nw->res_set)(nw, pvt->res, NULL);
+ }
+}
+
+static int
+init(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res && !nw_res_get(this))
+ return (-1);
+ if (((pvt->res->options & RES_INIT) == 0U) &&
+ res_ninit(pvt->res) == -1)
+ return (-1);
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gen_p.h b/usr/src/lib/libresolv2_joy/common/irs/gen_p.h
new file mode 100644
index 0000000000..1adc5909bb
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gen_p.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: gen_p.h,v 1.3 2005/04/27 04:56:23 sra Exp $
+ */
+
+/*! \file
+ * Notes:
+ * We hope to create a complete set of thread-safe entry points someday,
+ * which will mean a set of getXbyY() functions that take as an argument
+ * a pointer to the map class, which will have a pointer to the private
+ * data, which will be used preferentially to the static variables that
+ * are necessary to support the "classic" interface. This "classic"
+ * interface will then be reimplemented as stubs on top of the thread
+ * safe modules, and will keep the map class pointers as their only
+ * static data. HOWEVER, we are not there yet. So while we will call
+ * the just-barely-converted map class methods with map class pointers,
+ * right now they probably all still use statics. We're not fooling
+ * anybody, and we're not trying to (yet).
+ */
+
+#ifndef _GEN_P_H_INCLUDED
+#define _GEN_P_H_INCLUDED
+
+/*%
+ * These are the access methods.
+ */
+enum irs_acc_id {
+ irs_lcl, /*%< Local. */
+ irs_dns, /*%< DNS or Hesiod. */
+ irs_nis, /*%< Sun NIS ("YP"). */
+ irs_irp, /*%< IR protocol. */
+ irs_nacc
+};
+
+/*%
+ * These are the map types.
+ */
+enum irs_map_id {
+ irs_gr, /*%< "group" */
+ irs_pw, /*%< "passwd" */
+ irs_sv, /*%< "services" */
+ irs_pr, /*%< "protocols" */
+ irs_ho, /*%< "hosts" */
+ irs_nw, /*%< "networks" */
+ irs_ng, /*%< "netgroup" */
+ irs_nmap
+};
+
+/*%
+ * This is an accessor instance.
+ */
+struct irs_inst {
+ struct irs_acc *acc;
+ struct irs_gr * gr;
+ struct irs_pw * pw;
+ struct irs_sv * sv;
+ struct irs_pr * pr;
+ struct irs_ho * ho;
+ struct irs_nw * nw;
+ struct irs_ng * ng;
+};
+
+/*%
+ * This is a search rule for some map type.
+ */
+struct irs_rule {
+ struct irs_rule * next;
+ struct irs_inst * inst;
+ int flags;
+};
+#define IRS_MERGE 0x0001 /*%< Don't stop if acc. has data? */
+#define IRS_CONTINUE 0x0002 /*%< Don't stop if acc. has no data? */
+/*
+ * This is the private data for a search access class.
+ */
+struct gen_p {
+ char * options;
+ struct irs_rule * map_rules[(int)irs_nmap];
+ struct irs_inst accessors[(int)irs_nacc];
+ struct __res_state * res;
+ void (*free_res) __P((void *));
+};
+
+/*
+ * Externs.
+ */
+
+extern struct irs_acc * irs_gen_acc __P((const char *, const char *conf_file));
+extern struct irs_gr * irs_gen_gr __P((struct irs_acc *));
+extern struct irs_pw * irs_gen_pw __P((struct irs_acc *));
+extern struct irs_sv * irs_gen_sv __P((struct irs_acc *));
+extern struct irs_pr * irs_gen_pr __P((struct irs_acc *));
+extern struct irs_ho * irs_gen_ho __P((struct irs_acc *));
+extern struct irs_nw * irs_gen_nw __P((struct irs_acc *));
+extern struct irs_ng * irs_gen_ng __P((struct irs_acc *));
+
+#endif /*_IRS_P_H_INCLUDED*/
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gen_pr.c b/usr/src/lib/libresolv2_joy/common/irs/gen_pr.c
new file mode 100644
index 0000000000..9fd32c4dd9
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gen_pr.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: gen_pr.c,v 1.3 2005/04/27 04:56:24 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv_joy.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "gen_p.h"
+
+/* Types */
+
+struct pvt {
+ struct irs_rule * rules;
+ struct irs_rule * rule;
+ struct __res_state * res;
+ void (*free_res)(void *);
+};
+
+/* Forward */
+
+static void pr_close(struct irs_pr*);
+static struct protoent * pr_next(struct irs_pr *);
+static struct protoent * pr_byname(struct irs_pr *, const char *);
+static struct protoent * pr_bynumber(struct irs_pr *, int);
+static void pr_rewind(struct irs_pr *);
+static void pr_minimize(struct irs_pr *);
+static struct __res_state * pr_res_get(struct irs_pr *);
+static void pr_res_set(struct irs_pr *,
+ struct __res_state *,
+ void (*)(void *));
+
+/* Public */
+
+struct irs_pr *
+irs_gen_pr(struct irs_acc *this) {
+ struct gen_p *accpvt = (struct gen_p *)this->private;
+ struct irs_pr *pr;
+ struct pvt *pvt;
+
+ if (!(pr = memget(sizeof *pr))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pr, 0x5e, sizeof *pr);
+ if (!(pvt = memget(sizeof *pvt))) {
+ memput(pr, sizeof *pr);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pvt->rules = accpvt->map_rules[irs_pr];
+ pvt->rule = pvt->rules;
+ pr->private = pvt;
+ pr->close = pr_close;
+ pr->next = pr_next;
+ pr->byname = pr_byname;
+ pr->bynumber = pr_bynumber;
+ pr->rewind = pr_rewind;
+ pr->minimize = pr_minimize;
+ pr->res_get = pr_res_get;
+ pr->res_set = pr_res_set;
+ return (pr);
+}
+
+/* Methods */
+
+static void
+pr_close(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct protoent *
+pr_next(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct protoent *rval;
+ struct irs_pr *pr;
+
+ while (pvt->rule) {
+ pr = pvt->rule->inst->pr;
+ rval = (*pr->next)(pr);
+ if (rval)
+ return (rval);
+ if (!(pvt->rules->flags & IRS_CONTINUE))
+ break;
+ pvt->rule = pvt->rule->next;
+ if (pvt->rule) {
+ pr = pvt->rule->inst->pr;
+ (*pr->rewind)(pr);
+ }
+ }
+ return (NULL);
+}
+
+static struct protoent *
+pr_byname(struct irs_pr *this, const char *name) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct protoent *rval;
+ struct irs_pr *pr;
+
+ rval = NULL;
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ pr = rule->inst->pr;
+ rval = (*pr->byname)(pr, name);
+ if (rval || !(rule->flags & IRS_CONTINUE))
+ break;
+ }
+ return (rval);
+}
+
+static struct protoent *
+pr_bynumber(struct irs_pr *this, int proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct protoent *rval;
+ struct irs_pr *pr;
+
+ rval = NULL;
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ pr = rule->inst->pr;
+ rval = (*pr->bynumber)(pr, proto);
+ if (rval || !(rule->flags & IRS_CONTINUE))
+ break;
+ }
+ return (rval);
+}
+
+static void
+pr_rewind(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_pr *pr;
+
+ pvt->rule = pvt->rules;
+ if (pvt->rule) {
+ pr = pvt->rule->inst->pr;
+ (*pr->rewind)(pr);
+ }
+}
+
+static void
+pr_minimize(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_pr *pr = rule->inst->pr;
+
+ (*pr->minimize)(pr);
+ }
+}
+
+static struct __res_state *
+pr_res_get(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (!res) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ pr_res_set(this, res, free);
+ }
+
+ return (pvt->res);
+}
+
+static void
+pr_res_set(struct irs_pr *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ if (pvt->res && pvt->free_res) {
+ res_nclose(pvt->res);
+ (*pvt->free_res)(pvt->res);
+ }
+
+ pvt->res = res;
+ pvt->free_res = free_res;
+
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_pr *pr = rule->inst->pr;
+
+ if (pr->res_set)
+ (*pr->res_set)(pr, pvt->res, NULL);
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gen_sv.c b/usr/src/lib/libresolv2_joy/common/irs/gen_sv.c
new file mode 100644
index 0000000000..93b70e57ec
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gen_sv.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: gen_sv.c,v 1.3 2005/04/27 04:56:24 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "gen_p.h"
+
+/* Types */
+
+struct pvt {
+ struct irs_rule * rules;
+ struct irs_rule * rule;
+ struct __res_state * res;
+ void (*free_res)(void *);
+};
+
+/* Forward */
+
+static void sv_close(struct irs_sv*);
+static struct servent * sv_next(struct irs_sv *);
+static struct servent * sv_byname(struct irs_sv *, const char *,
+ const char *);
+static struct servent * sv_byport(struct irs_sv *, int, const char *);
+static void sv_rewind(struct irs_sv *);
+static void sv_minimize(struct irs_sv *);
+static struct __res_state * sv_res_get(struct irs_sv *);
+static void sv_res_set(struct irs_sv *,
+ struct __res_state *,
+ void (*)(void *));
+
+/* Public */
+
+struct irs_sv *
+irs_gen_sv(struct irs_acc *this) {
+ struct gen_p *accpvt = (struct gen_p *)this->private;
+ struct irs_sv *sv;
+ struct pvt *pvt;
+
+ if (!(sv = memget(sizeof *sv))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(sv, 0x5e, sizeof *sv);
+ if (!(pvt = memget(sizeof *pvt))) {
+ memput(sv, sizeof *sv);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pvt->rules = accpvt->map_rules[irs_sv];
+ pvt->rule = pvt->rules;
+ sv->private = pvt;
+ sv->close = sv_close;
+ sv->next = sv_next;
+ sv->byname = sv_byname;
+ sv->byport = sv_byport;
+ sv->rewind = sv_rewind;
+ sv->minimize = sv_minimize;
+ sv->res_get = sv_res_get;
+ sv->res_set = sv_res_set;
+ return (sv);
+}
+
+/* Methods */
+
+static void
+sv_close(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct servent *
+sv_next(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct servent *rval;
+ struct irs_sv *sv;
+
+ while (pvt->rule) {
+ sv = pvt->rule->inst->sv;
+ rval = (*sv->next)(sv);
+ if (rval)
+ return (rval);
+ if (!(pvt->rule->flags & IRS_CONTINUE))
+ break;
+ pvt->rule = pvt->rule->next;
+ if (pvt->rule) {
+ sv = pvt->rule->inst->sv;
+ (*sv->rewind)(sv);
+ }
+ }
+ return (NULL);
+}
+
+static struct servent *
+sv_byname(struct irs_sv *this, const char *name, const char *proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct servent *rval;
+ struct irs_sv *sv;
+
+ rval = NULL;
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ sv = rule->inst->sv;
+ rval = (*sv->byname)(sv, name, proto);
+ if (rval || !(rule->flags & IRS_CONTINUE))
+ break;
+ }
+ return (rval);
+}
+
+static struct servent *
+sv_byport(struct irs_sv *this, int port, const char *proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+ struct servent *rval;
+ struct irs_sv *sv;
+
+ rval = NULL;
+ for (rule = pvt->rules; rule; rule = rule->next) {
+ sv = rule->inst->sv;
+ rval = (*sv->byport)(sv, port, proto);
+ if (rval || !(rule->flags & IRS_CONTINUE))
+ break;
+ }
+ return (rval);
+}
+
+static void
+sv_rewind(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_sv *sv;
+
+ pvt->rule = pvt->rules;
+ if (pvt->rule) {
+ sv = pvt->rule->inst->sv;
+ (*sv->rewind)(sv);
+ }
+}
+
+static void
+sv_minimize(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_sv *sv = rule->inst->sv;
+
+ (*sv->minimize)(sv);
+ }
+}
+
+static struct __res_state *
+sv_res_get(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (!res) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ sv_res_set(this, res, free);
+ }
+
+ return (pvt->res);
+}
+
+static void
+sv_res_set(struct irs_sv *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct irs_rule *rule;
+
+ if (pvt->res && pvt->free_res) {
+ res_nclose(pvt->res);
+ (*pvt->free_res)(pvt->res);
+ }
+
+ pvt->res = res;
+ pvt->free_res = free_res;
+
+ for (rule = pvt->rules; rule != NULL; rule = rule->next) {
+ struct irs_sv *sv = rule->inst->sv;
+
+ if (sv->res_set)
+ (*sv->res_set)(sv, pvt->res, NULL);
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getaddrinfo.c b/usr/src/lib/libresolv2_joy/common/irs/getaddrinfo.c
new file mode 100644
index 0000000000..19bbbea854
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getaddrinfo.c
@@ -0,0 +1,1253 @@
+/* $KAME: getaddrinfo.c,v 1.14 2001/01/06 09:41:15 jinmei Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*! \file
+ * Issues to be discussed:
+ *\li Thread safe-ness must be checked.
+ *\li Return values. There are nonstandard return values defined and used
+ * in the source code. This is because RFC2553 is silent about which error
+ * code must be returned for which situation.
+ *\li IPv4 classful (shortened) form. RFC2553 is silent about it. XNET 5.2
+ * says to use inet_aton() to convert IPv4 numeric to binary (allows
+ * classful form as a result).
+ * current code - disallow classful form for IPv4 (due to use of inet_pton).
+ *\li freeaddrinfo(NULL). RFC2553 is silent about it. XNET 5.2 says it is
+ * invalid.
+ * current code - SEGV on freeaddrinfo(NULL)
+ * Note:
+ *\li We use getipnodebyname() just for thread-safeness. There's no intent
+ * to let it do PF_UNSPEC (actually we never pass PF_UNSPEC to
+ * getipnodebyname().
+ *\li The code filters out AFs that are not supported by the kernel,
+ * when globbing NULL hostname (to loopback, or wildcard). Is it the right
+ * thing to do? What is the relationship with post-RFC2553 AI_ADDRCONFIG
+ * in ai_flags?
+ *\li (post-2553) semantics of AI_ADDRCONFIG itself is too vague.
+ * (1) what should we do against numeric hostname (2) what should we do
+ * against NULL hostname (3) what is AI_ADDRCONFIG itself. AF not ready?
+ * non-loopback address configured? global address configured?
+ * \par Additional Issue:
+ * To avoid search order issue, we have a big amount of code duplicate
+ * from gethnamaddr.c and some other places. The issues that there's no
+ * lower layer function to lookup "IPv4 or IPv6" record. Calling
+ * gethostbyname2 from getaddrinfo will end up in wrong search order, as
+ * follows:
+ * \li The code makes use of following calls when asked to resolver with
+ * ai_family = PF_UNSPEC:
+ *\code getipnodebyname(host, AF_INET6);
+ * getipnodebyname(host, AF_INET);
+ *\endcode
+ * \li This will result in the following queries if the node is configure to
+ * prefer /etc/hosts than DNS:
+ *\code
+ * lookup /etc/hosts for IPv6 address
+ * lookup DNS for IPv6 address
+ * lookup /etc/hosts for IPv4 address
+ * lookup DNS for IPv4 address
+ *\endcode
+ * which may not meet people's requirement.
+ * \li The right thing to happen is to have underlying layer which does
+ * PF_UNSPEC lookup (lookup both) and return chain of addrinfos.
+ * This would result in a bit of code duplicate with _dns_ghbyname() and
+ * friends.
+ */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+#include <netinet/in.h>
+
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <stdarg.h>
+
+#include <irs.h>
+#include <isc/assertions.h>
+
+#include "port_after.h"
+
+#include "irs_data.h"
+
+#define SUCCESS 0
+#define ANY 0
+#define YES 1
+#define NO 0
+
+static const char in_addrany[] = { 0, 0, 0, 0 };
+static const char in6_addrany[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+static const char in_loopback[] = { 127, 0, 0, 1 };
+static const char in6_loopback[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
+};
+
+static const struct afd {
+ int a_af;
+ int a_addrlen;
+ int a_socklen;
+ int a_off;
+ const char *a_addrany;
+ const char *a_loopback;
+ int a_scoped;
+} afdl [] = {
+ {PF_INET6, sizeof(struct in6_addr),
+ sizeof(struct sockaddr_in6),
+ offsetof(struct sockaddr_in6, sin6_addr),
+ in6_addrany, in6_loopback, 1},
+ {PF_INET, sizeof(struct in_addr),
+ sizeof(struct sockaddr_in),
+ offsetof(struct sockaddr_in, sin_addr),
+ in_addrany, in_loopback, 0},
+ {0, 0, 0, 0, NULL, NULL, 0},
+};
+
+struct explore {
+ int e_af;
+ int e_socktype;
+ int e_protocol;
+ const char *e_protostr;
+ int e_wild;
+#define WILD_AF(ex) ((ex)->e_wild & 0x01)
+#define WILD_SOCKTYPE(ex) ((ex)->e_wild & 0x02)
+#define WILD_PROTOCOL(ex) ((ex)->e_wild & 0x04)
+};
+
+static const struct explore explore[] = {
+#if 0
+ { PF_LOCAL, 0, ANY, ANY, NULL, 0x01 },
+#endif
+ { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
+ { PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
+ { PF_INET6, SOCK_RAW, ANY, NULL, 0x05 },
+ { PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
+ { PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
+ { PF_INET, SOCK_RAW, ANY, NULL, 0x05 },
+ { -1, 0, 0, NULL, 0 },
+};
+
+#define PTON_MAX 16
+
+static int str_isnumber __P((const char *));
+static int explore_fqdn __P((const struct addrinfo *, const char *,
+ const char *, struct addrinfo **));
+static int explore_copy __P((const struct addrinfo *, const struct addrinfo *,
+ struct addrinfo **));
+static int explore_null __P((const struct addrinfo *,
+ const char *, struct addrinfo **));
+static int explore_numeric __P((const struct addrinfo *, const char *,
+ const char *, struct addrinfo **));
+static int explore_numeric_scope __P((const struct addrinfo *, const char *,
+ const char *, struct addrinfo **));
+static int get_canonname __P((const struct addrinfo *,
+ struct addrinfo *, const char *));
+static struct addrinfo *get_ai __P((const struct addrinfo *,
+ const struct afd *, const char *));
+static struct addrinfo *copy_ai __P((const struct addrinfo *));
+static int get_portmatch __P((const struct addrinfo *, const char *));
+static int get_port __P((const struct addrinfo *, const char *, int));
+static const struct afd *find_afd __P((int));
+static int addrconfig __P((int));
+static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *,
+ u_int32_t *scopeidp));
+static struct net_data *init __P((void));
+
+struct addrinfo *hostent2addrinfo __P((struct hostent *,
+ const struct addrinfo *));
+struct addrinfo *addr2addrinfo __P((const struct addrinfo *,
+ const char *));
+
+#if 0
+static const char *ai_errlist[] = {
+ "Success",
+ "Address family for hostname not supported", /*%< EAI_ADDRFAMILY */
+ "Temporary failure in name resolution", /*%< EAI_AGAIN */
+ "Invalid value for ai_flags", /*%< EAI_BADFLAGS */
+ "Non-recoverable failure in name resolution", /*%< EAI_FAIL */
+ "ai_family not supported", /*%< EAI_FAMILY */
+ "Memory allocation failure", /*%< EAI_MEMORY */
+ "No address associated with hostname", /*%< EAI_NODATA */
+ "hostname nor servname provided, or not known", /*%< EAI_NONAME */
+ "servname not supported for ai_socktype", /*%< EAI_SERVICE */
+ "ai_socktype not supported", /*%< EAI_SOCKTYPE */
+ "System error returned in errno", /*%< EAI_SYSTEM */
+ "Invalid value for hints", /*%< EAI_BADHINTS */
+ "Resolved protocol is unknown", /*%< EAI_PROTOCOL */
+ "Unknown error", /*%< EAI_MAX */
+};
+#endif
+
+/* XXX macros that make external reference is BAD. */
+
+#define GET_AI(ai, afd, addr) \
+do { \
+ /* external reference: pai, error, and label free */ \
+ (ai) = get_ai(pai, (afd), (addr)); \
+ if ((ai) == NULL) { \
+ error = EAI_MEMORY; \
+ goto free; \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define GET_PORT(ai, serv) \
+do { \
+ /* external reference: error and label free */ \
+ error = get_port((ai), (serv), 0); \
+ if (error != 0) \
+ goto free; \
+} while (/*CONSTCOND*/0)
+
+#define GET_CANONNAME(ai, str) \
+do { \
+ /* external reference: pai, error and label free */ \
+ error = get_canonname(pai, (ai), (str)); \
+ if (error != 0) \
+ goto free; \
+} while (/*CONSTCOND*/0)
+
+#ifndef SOLARIS2
+#define SETERROR(err) \
+do { \
+ /* external reference: error, and label bad */ \
+ error = (err); \
+ goto bad; \
+ /*NOTREACHED*/ \
+} while (/*CONSTCOND*/0)
+#else
+#define SETERROR(err) \
+do { \
+ /* external reference: error, and label bad */ \
+ error = (err); \
+ if (error == error) \
+ goto bad; \
+} while (/*CONSTCOND*/0)
+#endif
+
+
+#define MATCH_FAMILY(x, y, w) \
+ ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == PF_UNSPEC || (y) == PF_UNSPEC)))
+#define MATCH(x, y, w) \
+ ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
+
+#if 0 /*%< bind8 has its own version */
+char *
+gai_strerror(ecode)
+ int ecode;
+{
+ if (ecode < 0 || ecode > EAI_MAX)
+ ecode = EAI_MAX;
+ return ai_errlist[ecode];
+}
+#endif
+
+void
+freeaddrinfo(ai)
+ struct addrinfo *ai;
+{
+ struct addrinfo *next;
+
+ do {
+ next = ai->ai_next;
+ if (ai->ai_canonname)
+ free(ai->ai_canonname);
+ /* no need to free(ai->ai_addr) */
+ free(ai);
+ ai = next;
+ } while (ai);
+}
+
+static int
+str_isnumber(p)
+ const char *p;
+{
+ char *ep;
+
+ if (*p == '\0')
+ return NO;
+ ep = NULL;
+ errno = 0;
+ (void)strtoul(p, &ep, 10);
+ if (errno == 0 && ep && *ep == '\0')
+ return YES;
+ else
+ return NO;
+}
+
+int
+getaddrinfo(hostname, servname, hints, res)
+ const char *hostname, *servname;
+ const struct addrinfo *hints;
+ struct addrinfo **res;
+{
+ struct addrinfo sentinel;
+ struct addrinfo *cur;
+ int error = 0;
+ struct addrinfo ai, ai0, *afai = NULL;
+ struct addrinfo *pai;
+ const struct explore *ex;
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+ pai = &ai;
+ pai->ai_flags = 0;
+ pai->ai_family = PF_UNSPEC;
+ pai->ai_socktype = ANY;
+ pai->ai_protocol = ANY;
+#if defined(sun) && defined(_SOCKLEN_T) && defined(__sparcv9)
+ /*
+ * clear _ai_pad to preserve binary
+ * compatibility with previously compiled 64-bit
+ * applications in a pre-SUSv3 environment by
+ * guaranteeing the upper 32-bits are empty.
+ */
+ pai->_ai_pad = 0;
+#endif
+ pai->ai_addrlen = 0;
+ pai->ai_canonname = NULL;
+ pai->ai_addr = NULL;
+ pai->ai_next = NULL;
+
+ if (hostname == NULL && servname == NULL)
+ return EAI_NONAME;
+ if (hints) {
+ /* error check for hints */
+ if (hints->ai_addrlen || hints->ai_canonname ||
+ hints->ai_addr || hints->ai_next)
+ SETERROR(EAI_BADHINTS); /*%< xxx */
+ if (hints->ai_flags & ~AI_MASK)
+ SETERROR(EAI_BADFLAGS);
+ switch (hints->ai_family) {
+ case PF_UNSPEC:
+ case PF_INET:
+ case PF_INET6:
+ break;
+ default:
+ SETERROR(EAI_FAMILY);
+ }
+ memcpy(pai, hints, sizeof(*pai));
+
+#if defined(sun) && defined(_SOCKLEN_T) && defined(__sparcv9)
+ /*
+ * We need to clear _ai_pad to preserve binary
+ * compatibility. See prior comment.
+ */
+ pai->_ai_pad = 0;
+#endif
+ /*
+ * if both socktype/protocol are specified, check if they
+ * are meaningful combination.
+ */
+ if (pai->ai_socktype != ANY && pai->ai_protocol != ANY) {
+ for (ex = explore; ex->e_af >= 0; ex++) {
+ if (pai->ai_family != ex->e_af)
+ continue;
+ if (ex->e_socktype == ANY)
+ continue;
+ if (ex->e_protocol == ANY)
+ continue;
+ if (pai->ai_socktype == ex->e_socktype &&
+ pai->ai_protocol != ex->e_protocol) {
+ SETERROR(EAI_BADHINTS);
+ }
+ }
+ }
+ }
+
+ /*
+ * post-2553: AI_ALL and AI_V4MAPPED are effective only against
+ * AF_INET6 query. They needs to be ignored if specified in other
+ * occassions.
+ */
+ switch (pai->ai_flags & (AI_ALL | AI_V4MAPPED)) {
+ case AI_V4MAPPED:
+ case AI_ALL | AI_V4MAPPED:
+ if (pai->ai_family != AF_INET6)
+ pai->ai_flags &= ~(AI_ALL | AI_V4MAPPED);
+ break;
+ case AI_ALL:
+#if 1
+ /* illegal */
+ SETERROR(EAI_BADFLAGS);
+#else
+ pai->ai_flags &= ~(AI_ALL | AI_V4MAPPED);
+ break;
+#endif
+ }
+
+ /*
+ * check for special cases. (1) numeric servname is disallowed if
+ * socktype/protocol are left unspecified. (2) servname is disallowed
+ * for raw and other inet{,6} sockets.
+ */
+ if (MATCH_FAMILY(pai->ai_family, PF_INET, 1)
+#ifdef PF_INET6
+ || MATCH_FAMILY(pai->ai_family, PF_INET6, 1)
+#endif
+ ) {
+ ai0 = *pai; /* backup *pai */
+
+ if (pai->ai_family == PF_UNSPEC) {
+#ifdef PF_INET6
+ pai->ai_family = PF_INET6;
+#else
+ pai->ai_family = PF_INET;
+#endif
+ }
+ error = get_portmatch(pai, servname);
+ if (error)
+ SETERROR(error);
+
+ *pai = ai0;
+ }
+
+ ai0 = *pai;
+
+ /* NULL hostname, or numeric hostname */
+ for (ex = explore; ex->e_af >= 0; ex++) {
+ *pai = ai0;
+
+ if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex)))
+ continue;
+ if (!MATCH(pai->ai_socktype, ex->e_socktype, WILD_SOCKTYPE(ex)))
+ continue;
+ if (!MATCH(pai->ai_protocol, ex->e_protocol, WILD_PROTOCOL(ex)))
+ continue;
+
+ if (pai->ai_family == PF_UNSPEC)
+ pai->ai_family = ex->e_af;
+ if (pai->ai_socktype == ANY && ex->e_socktype != ANY)
+ pai->ai_socktype = ex->e_socktype;
+ if (pai->ai_protocol == ANY && ex->e_protocol != ANY)
+ pai->ai_protocol = ex->e_protocol;
+
+ /*
+ * if the servname does not match socktype/protocol, ignore it.
+ */
+ if (get_portmatch(pai, servname) != 0)
+ continue;
+
+ if (hostname == NULL) {
+ /*
+ * filter out AFs that are not supported by the kernel
+ * XXX errno?
+ */
+ if (!addrconfig(pai->ai_family))
+ continue;
+ error = explore_null(pai, servname, &cur->ai_next);
+ } else
+ error = explore_numeric_scope(pai, hostname, servname,
+ &cur->ai_next);
+
+ if (error)
+ goto free;
+
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ }
+
+ /*
+ * XXX
+ * If numreic representation of AF1 can be interpreted as FQDN
+ * representation of AF2, we need to think again about the code below.
+ */
+ if (sentinel.ai_next)
+ goto good;
+
+ if (pai->ai_flags & AI_NUMERICHOST)
+ SETERROR(EAI_NONAME);
+ if (hostname == NULL)
+ SETERROR(EAI_NONAME);
+
+ /*
+ * hostname as alphabetical name.
+ * We'll make sure that
+ * - if returning addrinfo list is empty, return non-zero error
+ * value (already known one or EAI_NONAME).
+ * - otherwise,
+ * + if we haven't had any errors, return 0 (i.e. success).
+ * + if we've had an error, free the list and return the error.
+ * without any assumption on the behavior of explore_fqdn().
+ */
+
+ /* first, try to query DNS for all possible address families. */
+ *pai = ai0;
+ error = explore_fqdn(pai, hostname, servname, &afai);
+ if (error) {
+ if (afai != NULL)
+ freeaddrinfo(afai);
+ goto free;
+ }
+ if (afai == NULL) {
+ error = EAI_NONAME; /*%< we've had no errors. */
+ goto free;
+ }
+
+ /*
+ * we would like to prefer AF_INET6 than AF_INET, so we'll make an
+ * outer loop by AFs.
+ */
+ for (ex = explore; ex->e_af >= 0; ex++) {
+ *pai = ai0;
+
+ if (pai->ai_family == PF_UNSPEC)
+ pai->ai_family = ex->e_af;
+
+ if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex)))
+ continue;
+ if (!MATCH(pai->ai_socktype, ex->e_socktype,
+ WILD_SOCKTYPE(ex))) {
+ continue;
+ }
+ if (!MATCH(pai->ai_protocol, ex->e_protocol,
+ WILD_PROTOCOL(ex))) {
+ continue;
+ }
+
+#ifdef AI_ADDRCONFIG
+ /*
+ * If AI_ADDRCONFIG is specified, check if we are
+ * expected to return the address family or not.
+ */
+ if ((pai->ai_flags & AI_ADDRCONFIG) != 0 &&
+ !addrconfig(pai->ai_family))
+ continue;
+#endif
+
+ if (pai->ai_family == PF_UNSPEC)
+ pai->ai_family = ex->e_af;
+ if (pai->ai_socktype == ANY && ex->e_socktype != ANY)
+ pai->ai_socktype = ex->e_socktype;
+ if (pai->ai_protocol == ANY && ex->e_protocol != ANY)
+ pai->ai_protocol = ex->e_protocol;
+
+ /*
+ * if the servname does not match socktype/protocol, ignore it.
+ */
+ if (get_portmatch(pai, servname) != 0)
+ continue;
+
+ if ((error = explore_copy(pai, afai, &cur->ai_next)) != 0) {
+ freeaddrinfo(afai);
+ goto free;
+ }
+
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ }
+
+ freeaddrinfo(afai); /*%< afai must not be NULL at this point. */
+
+ if (sentinel.ai_next) {
+good:
+ *res = sentinel.ai_next;
+ return(SUCCESS);
+ } else {
+ /*
+ * All the process succeeded, but we've had an empty list.
+ * This can happen if the given hints do not match our
+ * candidates.
+ */
+ error = EAI_NONAME;
+ }
+
+free:
+bad:
+ if (sentinel.ai_next)
+ freeaddrinfo(sentinel.ai_next);
+ *res = NULL;
+ return(error);
+}
+
+/*%
+ * FQDN hostname, DNS lookup
+ */
+static int
+explore_fqdn(pai, hostname, servname, res)
+ const struct addrinfo *pai;
+ const char *hostname;
+ const char *servname;
+ struct addrinfo **res;
+{
+ struct addrinfo *result;
+ struct addrinfo *cur;
+ struct net_data *net_data = init();
+ struct irs_ho *ho;
+ int error = 0;
+ char tmp[NS_MAXDNAME];
+ const char *cp;
+
+ INSIST(res != NULL && *res == NULL);
+
+ /*
+ * if the servname does not match socktype/protocol, ignore it.
+ */
+ if (get_portmatch(pai, servname) != 0)
+ return(0);
+
+ if (!net_data || !(ho = net_data->ho))
+ return(0);
+#if 0 /*%< XXX (notyet) */
+ if (net_data->ho_stayopen && net_data->ho_last &&
+ net_data->ho_last->h_addrtype == af) {
+ if (ns_samename(name, net_data->ho_last->h_name) == 1)
+ return (net_data->ho_last);
+ for (hap = net_data->ho_last->h_aliases; hap && *hap; hap++)
+ if (ns_samename(name, *hap) == 1)
+ return (net_data->ho_last);
+ }
+#endif
+ if (!strchr(hostname, '.') &&
+ (cp = res_hostalias(net_data->res, hostname,
+ tmp, sizeof(tmp))))
+ hostname = cp;
+ result = (*ho->addrinfo)(ho, hostname, pai);
+ if (!net_data->ho_stayopen) {
+ (*ho->minimize)(ho);
+ }
+ if (result == NULL) {
+ int e = h_errno;
+
+ switch(e) {
+ case NETDB_INTERNAL:
+ error = EAI_SYSTEM;
+ break;
+ case TRY_AGAIN:
+ error = EAI_AGAIN;
+ break;
+ case NO_RECOVERY:
+ error = EAI_FAIL;
+ break;
+ case HOST_NOT_FOUND:
+ case NO_DATA:
+ error = EAI_NONAME;
+ break;
+ default:
+ case NETDB_SUCCESS: /*%< should be impossible... */
+ error = EAI_NONAME;
+ break;
+ }
+ goto free;
+ }
+
+ for (cur = result; cur; cur = cur->ai_next) {
+ GET_PORT(cur, servname); /*%< XXX: redundant lookups... */
+ /* canonname should already be filled. */
+ }
+
+ *res = result;
+
+ return(0);
+
+free:
+ if (result)
+ freeaddrinfo(result);
+ return error;
+}
+
+static int
+explore_copy(pai, src0, res)
+ const struct addrinfo *pai; /*%< seed */
+ const struct addrinfo *src0; /*%< source */
+ struct addrinfo **res;
+{
+ int error;
+ struct addrinfo sentinel, *cur;
+ const struct addrinfo *src;
+
+ error = 0;
+ sentinel.ai_next = NULL;
+ cur = &sentinel;
+
+ for (src = src0; src != NULL; src = src->ai_next) {
+ if (src->ai_family != pai->ai_family)
+ continue;
+
+ cur->ai_next = copy_ai(src);
+ if (!cur->ai_next) {
+ error = EAI_MEMORY;
+ goto fail;
+ }
+
+ cur->ai_next->ai_socktype = pai->ai_socktype;
+ cur->ai_next->ai_protocol = pai->ai_protocol;
+ cur = cur->ai_next;
+ }
+
+ *res = sentinel.ai_next;
+ return 0;
+
+fail:
+ freeaddrinfo(sentinel.ai_next);
+ return error;
+}
+
+/*%
+ * hostname == NULL.
+ * passive socket -> anyaddr (0.0.0.0 or ::)
+ * non-passive socket -> localhost (127.0.0.1 or ::1)
+ */
+static int
+explore_null(pai, servname, res)
+ const struct addrinfo *pai;
+ const char *servname;
+ struct addrinfo **res;
+{
+ const struct afd *afd;
+ struct addrinfo *cur;
+ struct addrinfo sentinel;
+ int error;
+
+ *res = NULL;
+ sentinel.ai_next = NULL;
+ cur = &sentinel;
+
+ afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
+
+ if (pai->ai_flags & AI_PASSIVE) {
+ GET_AI(cur->ai_next, afd, afd->a_addrany);
+ /* xxx meaningless?
+ * GET_CANONNAME(cur->ai_next, "anyaddr");
+ */
+ GET_PORT(cur->ai_next, servname);
+ } else {
+ GET_AI(cur->ai_next, afd, afd->a_loopback);
+ /* xxx meaningless?
+ * GET_CANONNAME(cur->ai_next, "localhost");
+ */
+ GET_PORT(cur->ai_next, servname);
+ }
+ cur = cur->ai_next;
+
+ *res = sentinel.ai_next;
+ return 0;
+
+free:
+ if (sentinel.ai_next)
+ freeaddrinfo(sentinel.ai_next);
+ return error;
+}
+
+/*%
+ * numeric hostname
+ */
+static int
+explore_numeric(pai, hostname, servname, res)
+ const struct addrinfo *pai;
+ const char *hostname;
+ const char *servname;
+ struct addrinfo **res;
+{
+ const struct afd *afd;
+ struct addrinfo *cur;
+ struct addrinfo sentinel;
+ int error;
+ char pton[PTON_MAX];
+
+ *res = NULL;
+ sentinel.ai_next = NULL;
+ cur = &sentinel;
+
+ afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
+
+ switch (afd->a_af) {
+#if 0 /*X/Open spec*/
+ case AF_INET:
+ if (inet_aton(hostname, (struct in_addr *)pton) == 1) {
+ if (pai->ai_family == afd->a_af ||
+ pai->ai_family == PF_UNSPEC /*?*/) {
+ GET_AI(cur->ai_next, afd, pton);
+ GET_PORT(cur->ai_next, servname);
+ while (cur->ai_next)
+ cur = cur->ai_next;
+ } else
+ SETERROR(EAI_FAMILY); /*xxx*/
+ }
+ break;
+#endif
+ default:
+ if (inet_pton(afd->a_af, hostname, pton) == 1) {
+ if (pai->ai_family == afd->a_af ||
+ pai->ai_family == PF_UNSPEC /*?*/) {
+ GET_AI(cur->ai_next, afd, pton);
+ GET_PORT(cur->ai_next, servname);
+ while (cur->ai_next)
+ cur = cur->ai_next;
+ } else
+ SETERROR(EAI_FAMILY); /*xxx*/
+ }
+ break;
+ }
+
+ *res = sentinel.ai_next;
+ return 0;
+
+free:
+bad:
+ if (sentinel.ai_next)
+ freeaddrinfo(sentinel.ai_next);
+ return error;
+}
+
+/*%
+ * numeric hostname with scope
+ */
+static int
+explore_numeric_scope(pai, hostname, servname, res)
+ const struct addrinfo *pai;
+ const char *hostname;
+ const char *servname;
+ struct addrinfo **res;
+{
+#ifndef SCOPE_DELIMITER
+ return explore_numeric(pai, hostname, servname, res);
+#else
+ const struct afd *afd;
+ struct addrinfo *cur;
+ int error;
+ char *cp, *hostname2 = NULL, *scope, *addr;
+ struct sockaddr_in6 *sin6;
+
+ afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
+
+ if (!afd->a_scoped)
+ return explore_numeric(pai, hostname, servname, res);
+
+ cp = strchr(hostname, SCOPE_DELIMITER);
+ if (cp == NULL)
+ return explore_numeric(pai, hostname, servname, res);
+
+ /*
+ * Handle special case of <scoped_address><delimiter><scope id>
+ */
+ hostname2 = strdup(hostname);
+ if (hostname2 == NULL)
+ return EAI_MEMORY;
+ /* terminate at the delimiter */
+ hostname2[cp - hostname] = '\0';
+ addr = hostname2;
+ scope = cp + 1;
+
+ error = explore_numeric(pai, addr, servname, res);
+ if (error == 0) {
+ u_int32_t scopeid = 0;
+
+ for (cur = *res; cur; cur = cur->ai_next) {
+ if (cur->ai_family != AF_INET6)
+ continue;
+ sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr;
+ if (!ip6_str2scopeid(scope, sin6, &scopeid)) {
+ free(hostname2);
+ return(EAI_NONAME); /*%< XXX: is return OK? */
+ }
+#ifdef HAVE_SIN6_SCOPE_ID
+ sin6->sin6_scope_id = scopeid;
+#endif
+ }
+ }
+
+ free(hostname2);
+
+ return error;
+#endif
+}
+
+static int
+get_canonname(pai, ai, str)
+ const struct addrinfo *pai;
+ struct addrinfo *ai;
+ const char *str;
+{
+ if ((pai->ai_flags & AI_CANONNAME) != 0) {
+ ai->ai_canonname = (char *)malloc(strlen(str) + 1);
+ if (ai->ai_canonname == NULL)
+ return EAI_MEMORY;
+ strcpy(ai->ai_canonname, str);
+ }
+ return 0;
+}
+
+static struct addrinfo *
+get_ai(pai, afd, addr)
+ const struct addrinfo *pai;
+ const struct afd *afd;
+ const char *addr;
+{
+ char *p;
+ struct addrinfo *ai;
+
+ ai = (struct addrinfo *)malloc(sizeof(struct addrinfo)
+ + (afd->a_socklen));
+ if (ai == NULL)
+ return NULL;
+
+ memcpy(ai, pai, sizeof(struct addrinfo));
+ ai->ai_addr = (struct sockaddr *)(void *)(ai + 1);
+ memset(ai->ai_addr, 0, (size_t)afd->a_socklen);
+#ifdef HAVE_SA_LEN
+ ai->ai_addr->sa_len = afd->a_socklen;
+#endif
+ ai->ai_addrlen = afd->a_socklen;
+ ai->ai_addr->sa_family = ai->ai_family = afd->a_af;
+ p = (char *)(void *)(ai->ai_addr);
+ memcpy(p + afd->a_off, addr, (size_t)afd->a_addrlen);
+ return ai;
+}
+
+/* XXX need to malloc() the same way we do from other functions! */
+static struct addrinfo *
+copy_ai(pai)
+ const struct addrinfo *pai;
+{
+ struct addrinfo *ai;
+ size_t l;
+
+ l = sizeof(*ai) + pai->ai_addrlen;
+ if ((ai = (struct addrinfo *)malloc(l)) == NULL)
+ return NULL;
+ memset(ai, 0, l);
+ memcpy(ai, pai, sizeof(*ai));
+ ai->ai_addr = (struct sockaddr *)(void *)(ai + 1);
+ memcpy(ai->ai_addr, pai->ai_addr, pai->ai_addrlen);
+
+ if (pai->ai_canonname) {
+ l = strlen(pai->ai_canonname) + 1;
+ if ((ai->ai_canonname = malloc(l)) == NULL) {
+ free(ai);
+ return NULL;
+ }
+ strcpy(ai->ai_canonname, pai->ai_canonname); /* (checked) */
+ } else {
+ /* just to make sure */
+ ai->ai_canonname = NULL;
+ }
+
+ ai->ai_next = NULL;
+
+ return ai;
+}
+
+static int
+get_portmatch(const struct addrinfo *ai, const char *servname) {
+
+ /* get_port does not touch first argument. when matchonly == 1. */
+ /* LINTED const cast */
+ return get_port((const struct addrinfo *)ai, servname, 1);
+}
+
+static int
+get_port(const struct addrinfo *ai, const char *servname, int matchonly) {
+ const char *proto;
+ struct servent *sp;
+ int port;
+ int allownumeric;
+
+ if (servname == NULL)
+ return 0;
+ switch (ai->ai_family) {
+ case AF_INET:
+#ifdef AF_INET6
+ case AF_INET6:
+#endif
+ break;
+ default:
+ return 0;
+ }
+
+ switch (ai->ai_socktype) {
+ case SOCK_RAW:
+ return EAI_SERVICE;
+ case SOCK_DGRAM:
+ case SOCK_STREAM:
+ allownumeric = 1;
+ break;
+ case ANY:
+ switch (ai->ai_family) {
+ case AF_INET:
+#ifdef AF_INET6
+ case AF_INET6:
+#endif
+ allownumeric = 1;
+ break;
+ default:
+ allownumeric = 0;
+ break;
+ }
+ break;
+ default:
+ return EAI_SOCKTYPE;
+ }
+
+ if (str_isnumber(servname)) {
+ if (!allownumeric)
+ return EAI_SERVICE;
+ port = atoi(servname);
+ if (port < 0 || port > 65535)
+ return EAI_SERVICE;
+ port = htons(port);
+ } else {
+ switch (ai->ai_socktype) {
+ case SOCK_DGRAM:
+ proto = "udp";
+ break;
+ case SOCK_STREAM:
+ proto = "tcp";
+ break;
+ default:
+ proto = NULL;
+ break;
+ }
+
+ if ((sp = getservbyname(servname, proto)) == NULL)
+ return EAI_SERVICE;
+ port = sp->s_port;
+ }
+
+ if (!matchonly) {
+ switch (ai->ai_family) {
+ case AF_INET:
+ ((struct sockaddr_in *)(void *)
+ ai->ai_addr)->sin_port = port;
+ break;
+ case AF_INET6:
+ ((struct sockaddr_in6 *)(void *)
+ ai->ai_addr)->sin6_port = port;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static const struct afd *
+find_afd(af)
+ int af;
+{
+ const struct afd *afd;
+
+ if (af == PF_UNSPEC)
+ return NULL;
+ for (afd = afdl; afd->a_af; afd++) {
+ if (afd->a_af == af)
+ return afd;
+ }
+ return NULL;
+}
+
+/*%
+ * post-2553: AI_ADDRCONFIG check. if we use getipnodeby* as backend, backend
+ * will take care of it.
+ * the semantics of AI_ADDRCONFIG is not defined well. we are not sure
+ * if the code is right or not.
+ */
+static int
+addrconfig(af)
+ int af;
+{
+ int s;
+
+ /* XXX errno */
+ s = socket(af, SOCK_DGRAM, 0);
+ if (s < 0) {
+ if (errno != EMFILE)
+ return 0;
+ } else
+ close(s);
+ return 1;
+}
+
+/* convert a string to a scope identifier. XXX: IPv6 specific */
+static int
+ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6,
+ u_int32_t *scopeidp)
+{
+ u_int32_t scopeid;
+ u_long lscopeid;
+ struct in6_addr *a6 = &sin6->sin6_addr;
+ char *ep;
+
+ /* empty scopeid portion is invalid */
+ if (*scope == '\0')
+ return (0);
+
+#ifdef USE_IFNAMELINKID
+ if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6) ||
+ IN6_IS_ADDR_MC_NODELOCAL(a6)) {
+ /*
+ * Using interface names as link indices can be allowed
+ * only when we can assume a one-to-one mappings between
+ * links and interfaces. See comments in getnameinfo.c.
+ */
+ scopeid = if_nametoindex(scope);
+ if (scopeid == 0)
+ goto trynumeric;
+ *scopeidp = scopeid;
+ return (1);
+ }
+#endif
+
+ /* still unclear about literal, allow numeric only - placeholder */
+ if (IN6_IS_ADDR_SITELOCAL(a6) || IN6_IS_ADDR_MC_SITELOCAL(a6))
+ goto trynumeric;
+ if (IN6_IS_ADDR_MC_ORGLOCAL(a6))
+ goto trynumeric;
+ else
+ goto trynumeric; /*%< global */
+ /* try to convert to a numeric id as a last resort */
+trynumeric:
+ errno = 0;
+ lscopeid = strtoul(scope, &ep, 10);
+ scopeid = lscopeid & 0xffffffff;
+ if (errno == 0 && ep && *ep == '\0' && scopeid == lscopeid) {
+ *scopeidp = scopeid;
+ return (1);
+ } else
+ return (0);
+}
+
+struct addrinfo *
+hostent2addrinfo(hp, pai)
+ struct hostent *hp;
+ const struct addrinfo *pai;
+{
+ int i, af, error = 0;
+ char **aplist = NULL, *ap;
+ struct addrinfo sentinel, *cur;
+ const struct afd *afd;
+
+ af = hp->h_addrtype;
+ if (pai->ai_family != AF_UNSPEC && af != pai->ai_family)
+ return(NULL);
+
+ afd = find_afd(af);
+ if (afd == NULL)
+ return(NULL);
+
+ aplist = hp->h_addr_list;
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ for (i = 0; (ap = aplist[i]) != NULL; i++) {
+#if 0 /*%< the trick seems too much */
+ af = hp->h_addr_list;
+ if (af == AF_INET6 &&
+ IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) {
+ af = AF_INET;
+ ap = ap + sizeof(struct in6_addr)
+ - sizeof(struct in_addr);
+ }
+ afd = find_afd(af);
+ if (afd == NULL)
+ continue;
+#endif /* 0 */
+
+ GET_AI(cur->ai_next, afd, ap);
+
+ /* GET_PORT(cur->ai_next, servname); */
+ if ((pai->ai_flags & AI_CANONNAME) != 0) {
+ /*
+ * RFC2553 says that ai_canonname will be set only for
+ * the first element. we do it for all the elements,
+ * just for convenience.
+ */
+ GET_CANONNAME(cur->ai_next, hp->h_name);
+ }
+ while (cur->ai_next) /*%< no need to loop, actually. */
+ cur = cur->ai_next;
+ continue;
+
+ free:
+ if (cur->ai_next)
+ freeaddrinfo(cur->ai_next);
+ cur->ai_next = NULL;
+ /* continue, without tht pointer CUR advanced. */
+ }
+
+ return(sentinel.ai_next);
+}
+
+struct addrinfo *
+addr2addrinfo(pai, cp)
+ const struct addrinfo *pai;
+ const char *cp;
+{
+ const struct afd *afd;
+
+ afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return(NULL);
+
+ return(get_ai(pai, afd, cp));
+}
+
+static struct net_data *
+init()
+{
+ struct net_data *net_data;
+
+ if (!(net_data = net_data_init(NULL)))
+ goto error;
+ if (!net_data->ho) {
+ net_data->ho = (*net_data->irs->ho_map)(net_data->irs);
+ if (!net_data->ho || !net_data->res) {
+error:
+ errno = EIO;
+ if (net_data && net_data->res)
+ RES_SET_H_ERRNO(net_data->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+
+ (*net_data->ho->res_set)(net_data->ho, net_data->res, NULL);
+ }
+
+ return (net_data);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gethostent.c b/usr/src/lib/libresolv2_joy/common/irs/gethostent.c
new file mode 100644
index 0000000000..c4751c2c80
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gethostent.c
@@ -0,0 +1,1096 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: gethostent.c,v 1.8 2006/01/10 05:06:00 marka Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#if !defined(__BIND_NOSTATIC)
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <irs.h>
+#include <isc/memcluster.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "irs_data.h"
+
+/* Definitions */
+
+struct pvt {
+ char * aliases[1];
+ char * addrs[2];
+ char addr[NS_IN6ADDRSZ];
+ char name[NS_MAXDNAME + 1];
+ struct hostent host;
+};
+
+/* Forward */
+
+static struct net_data *init(void);
+static void freepvt(struct net_data *);
+static struct hostent *fakeaddr(const char *, int, struct net_data *);
+
+#ifdef SUNW_OVERRIDE_RETRY
+extern int __res_retry(int);
+extern int __res_retry_reset(void);
+#endif /* SUNW_OVERRIDE_RETRY */
+
+
+/* Public */
+
+struct hostent *
+gethostbyname(const char *name) {
+ struct net_data *net_data = init();
+
+ return (gethostbyname_p(name, net_data));
+}
+
+struct hostent *
+gethostbyname2(const char *name, int af) {
+ struct net_data *net_data = init();
+
+ return (gethostbyname2_p(name, af, net_data));
+}
+
+struct hostent *
+gethostbyaddr(const char *addr, int len, int af) {
+ struct net_data *net_data = init();
+
+ return (gethostbyaddr_p(addr, len, af, net_data));
+}
+
+struct hostent *
+gethostent() {
+ struct net_data *net_data = init();
+
+ return (gethostent_p(net_data));
+}
+
+void
+sethostent(int stayopen) {
+ struct net_data *net_data = init();
+ sethostent_p(stayopen, net_data);
+}
+
+
+void
+endhostent() {
+ struct net_data *net_data = init();
+ endhostent_p(net_data);
+}
+
+/* Shared private. */
+
+struct hostent *
+gethostbyname_p(const char *name, struct net_data *net_data) {
+ struct hostent *hp;
+
+ if (!net_data)
+ return (NULL);
+
+ if (net_data->res->options & RES_USE_INET6) {
+ hp = gethostbyname2_p(name, AF_INET6, net_data);
+ if (hp)
+ return (hp);
+ }
+ return (gethostbyname2_p(name, AF_INET, net_data));
+}
+
+struct hostent *
+gethostbyname2_p(const char *name, int af, struct net_data *net_data) {
+ struct irs_ho *ho;
+ char tmp[NS_MAXDNAME];
+ struct hostent *hp;
+ const char *cp;
+ char **hap;
+
+ if (!net_data || !(ho = net_data->ho))
+ return (NULL);
+ if (net_data->ho_stayopen && net_data->ho_last &&
+ net_data->ho_last->h_addrtype == af) {
+ if (ns_samename(name, net_data->ho_last->h_name) == 1)
+ return (net_data->ho_last);
+ for (hap = net_data->ho_last->h_aliases; hap && *hap; hap++)
+ if (ns_samename(name, *hap) == 1)
+ return (net_data->ho_last);
+ }
+ if (!strchr(name, '.') && (cp = res_hostalias(net_data->res, name,
+ tmp, sizeof tmp)))
+ name = cp;
+ if ((hp = fakeaddr(name, af, net_data)) != NULL)
+ return (hp);
+#ifdef SUNW_OVERRIDE_RETRY
+ net_data->res->retry = __res_retry(net_data->res->retry);
+#endif /* SUNW_OVERRIDE_RETRY */
+ net_data->ho_last = (*ho->byname2)(ho, name, af);
+#ifdef SUNW_OVERRIDE_RETRY
+ net_data->res->retry = __res_retry_reset();
+#endif /* SUNW_OVERRIDE_RETRY */
+ if (!net_data->ho_stayopen)
+ endhostent();
+ return (net_data->ho_last);
+}
+
+struct hostent *
+gethostbyaddr_p(const char *addr, int len, int af, struct net_data *net_data) {
+ struct irs_ho *ho;
+ char **hap;
+
+ if (!net_data || !(ho = net_data->ho))
+ return (NULL);
+ if (net_data->ho_stayopen && net_data->ho_last &&
+ net_data->ho_last->h_length == len)
+ for (hap = net_data->ho_last->h_addr_list;
+ hap && *hap;
+ hap++)
+ if (!memcmp(addr, *hap, len))
+ return (net_data->ho_last);
+ net_data->ho_last = (*ho->byaddr)(ho, addr, len, af);
+ if (!net_data->ho_stayopen)
+ endhostent();
+ return (net_data->ho_last);
+}
+
+
+struct hostent *
+gethostent_p(struct net_data *net_data) {
+ struct irs_ho *ho;
+ struct hostent *hp;
+
+ if (!net_data || !(ho = net_data->ho))
+ return (NULL);
+ while ((hp = (*ho->next)(ho)) != NULL &&
+ hp->h_addrtype == AF_INET6 &&
+ (net_data->res->options & RES_USE_INET6) == 0U)
+ continue;
+ net_data->ho_last = hp;
+ return (net_data->ho_last);
+}
+
+
+void
+sethostent_p(int stayopen, struct net_data *net_data) {
+ struct irs_ho *ho;
+
+ if (!net_data || !(ho = net_data->ho))
+ return;
+ freepvt(net_data);
+ (*ho->rewind)(ho);
+ net_data->ho_stayopen = (stayopen != 0);
+ if (stayopen == 0)
+ net_data_minimize(net_data);
+}
+
+void
+endhostent_p(struct net_data *net_data) {
+ struct irs_ho *ho;
+
+ if ((net_data != NULL) && ((ho = net_data->ho) != NULL))
+ (*ho->minimize)(ho);
+}
+
+#ifndef IN6_IS_ADDR_V4COMPAT
+static const unsigned char in6addr_compat[12] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+#define IN6_IS_ADDR_V4COMPAT(x) (!memcmp((x)->s6_addr, in6addr_compat, 12) && \
+ ((x)->s6_addr[12] != 0 || \
+ (x)->s6_addr[13] != 0 || \
+ (x)->s6_addr[14] != 0 || \
+ ((x)->s6_addr[15] != 0 && \
+ (x)->s6_addr[15] != 1)))
+#endif
+#ifndef IN6_IS_ADDR_V4MAPPED
+#define IN6_IS_ADDR_V4MAPPED(x) (!memcmp((x)->s6_addr, in6addr_mapped, 12))
+#endif
+
+static const unsigned char in6addr_mapped[12] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
+
+static int scan_interfaces(int *, int *);
+static struct hostent *copyandmerge(struct hostent *, struct hostent *, int, int *);
+
+/*%
+ * Public functions
+ */
+
+/*%
+ * AI_V4MAPPED + AF_INET6
+ * If no IPv6 address then a query for IPv4 and map returned values.
+ *
+ * AI_ALL + AI_V4MAPPED + AF_INET6
+ * Return IPv6 and IPv4 mapped.
+ *
+ * AI_ADDRCONFIG
+ * Only return IPv6 / IPv4 address if there is an interface of that
+ * type active.
+ */
+
+struct hostent *
+getipnodebyname(const char *name, int af, int flags, int *error_num) {
+ int have_v4 = 1, have_v6 = 1;
+ struct in_addr in4;
+ struct in6_addr in6;
+ struct hostent he, *he1 = NULL, *he2 = NULL, *he3;
+ int v4 = 0, v6 = 0;
+ struct net_data *net_data = init();
+ u_long options;
+ int tmp_err;
+
+ if (net_data == NULL) {
+ *error_num = NO_RECOVERY;
+ return (NULL);
+ }
+
+ /* If we care about active interfaces then check. */
+ if ((flags & AI_ADDRCONFIG) != 0)
+ if (scan_interfaces(&have_v4, &have_v6) == -1) {
+ *error_num = NO_RECOVERY;
+ return (NULL);
+ }
+
+ /* Check for literal address. */
+ if ((v4 = inet_pton(AF_INET, name, &in4)) != 1)
+ v6 = inet_pton(AF_INET6, name, &in6);
+
+ /* Impossible combination? */
+
+ if ((af == AF_INET6 && (flags & AI_V4MAPPED) == 0 && v4 == 1) ||
+ (af == AF_INET && v6 == 1) ||
+ (have_v4 == 0 && v4 == 1) ||
+ (have_v6 == 0 && v6 == 1) ||
+ (have_v4 == 0 && af == AF_INET) ||
+ (have_v6 == 0 && af == AF_INET6)) {
+ *error_num = HOST_NOT_FOUND;
+ return (NULL);
+ }
+
+ /* Literal address? */
+ if (v4 == 1 || v6 == 1) {
+ char *addr_list[2];
+ char *aliases[1];
+
+ DE_CONST(name, he.h_name);
+ he.h_addr_list = addr_list;
+ he.h_addr_list[0] = (v4 == 1) ? (char *)&in4 : (char *)&in6;
+ he.h_addr_list[1] = NULL;
+ he.h_aliases = aliases;
+ he.h_aliases[0] = NULL;
+ he.h_length = (v4 == 1) ? INADDRSZ : IN6ADDRSZ;
+ he.h_addrtype = (v4 == 1) ? AF_INET : AF_INET6;
+ return (copyandmerge(&he, NULL, af, error_num));
+ }
+
+ options = net_data->res->options;
+ net_data->res->options &= ~RES_USE_INET6;
+
+ tmp_err = NO_RECOVERY;
+ if (have_v6 && af == AF_INET6) {
+ he2 = gethostbyname2_p(name, AF_INET6, net_data);
+ if (he2 != NULL) {
+ he1 = copyandmerge(he2, NULL, af, error_num);
+ if (he1 == NULL)
+ return (NULL);
+ he2 = NULL;
+ } else {
+ tmp_err = net_data->res->res_h_errno;
+ }
+ }
+
+ if (have_v4 &&
+ ((af == AF_INET) ||
+ (af == AF_INET6 && (flags & AI_V4MAPPED) != 0 &&
+ (he1 == NULL || (flags & AI_ALL) != 0)))) {
+ he2 = gethostbyname2_p(name, AF_INET, net_data);
+ if (he1 == NULL && he2 == NULL) {
+ *error_num = net_data->res->res_h_errno;
+ return (NULL);
+ }
+ } else
+ *error_num = tmp_err;
+
+ net_data->res->options = options;
+
+ he3 = copyandmerge(he1, he2, af, error_num);
+
+ if (he1 != NULL)
+ freehostent(he1);
+ return (he3);
+}
+
+struct hostent *
+getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
+ struct hostent *he1, *he2;
+ struct net_data *net_data = init();
+
+ /* Sanity Checks. */
+#ifdef ORIGINAL_ISC_CODE
+ if (src == NULL) {
+#else
+ /* this change was added circa May 2009, but not in ISC libbind 6.0 */
+ if (src == NULL|| net_data == NULL) {
+#endif /* ORIGINAL_ISC_CODE */
+ *error_num = NO_RECOVERY;
+ return (NULL);
+ }
+
+ switch (af) {
+ case AF_INET:
+ if (len != (size_t)INADDRSZ) {
+ *error_num = NO_RECOVERY;
+ return (NULL);
+ }
+ break;
+ case AF_INET6:
+ if (len != (size_t)IN6ADDRSZ) {
+ *error_num = NO_RECOVERY;
+ return (NULL);
+ }
+ break;
+ default:
+ *error_num = NO_RECOVERY;
+ return (NULL);
+ }
+
+ /*
+ * Lookup IPv4 and IPv4 mapped/compatible addresses
+ */
+ if ((af == AF_INET6 &&
+ IN6_IS_ADDR_V4COMPAT((const struct in6_addr *)src)) ||
+ (af == AF_INET6 &&
+ IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src)) ||
+ (af == AF_INET)) {
+ const char *cp = src;
+
+ if (af == AF_INET6)
+ cp += 12;
+ he1 = gethostbyaddr_p(cp, 4, AF_INET, net_data);
+ if (he1 == NULL) {
+ *error_num = net_data->res->res_h_errno;
+ return (NULL);
+ }
+ he2 = copyandmerge(he1, NULL, af, error_num);
+ if (he2 == NULL)
+ return (NULL);
+ /*
+ * Restore original address if mapped/compatible.
+ */
+ if (af == AF_INET6)
+ memcpy(he1->h_addr, src, len);
+ return (he2);
+ }
+
+ /*
+ * Lookup IPv6 address.
+ */
+ if (memcmp((const struct in6_addr *)src, &in6addr_any, 16) == 0) {
+ *error_num = HOST_NOT_FOUND;
+ return (NULL);
+ }
+
+ he1 = gethostbyaddr_p(src, 16, AF_INET6, net_data);
+ if (he1 == NULL) {
+ *error_num = net_data->res->res_h_errno;
+ return (NULL);
+ }
+ return (copyandmerge(he1, NULL, af, error_num));
+}
+
+void
+freehostent(struct hostent *he) {
+ char **cpp;
+ int names = 1;
+ int addresses = 1;
+
+ memput(he->h_name, strlen(he->h_name) + 1);
+
+ cpp = he->h_addr_list;
+ while (*cpp != NULL) {
+ memput(*cpp, (he->h_addrtype == AF_INET) ?
+ INADDRSZ : IN6ADDRSZ);
+ *cpp = NULL;
+ cpp++;
+ addresses++;
+ }
+
+ cpp = he->h_aliases;
+ while (*cpp != NULL) {
+ memput(*cpp, strlen(*cpp) + 1);
+ cpp++;
+ names++;
+ }
+
+ memput(he->h_aliases, sizeof(char *) * (names));
+ memput(he->h_addr_list, sizeof(char *) * (addresses));
+ memput(he, sizeof *he);
+}
+
+/*%
+ * Private
+ */
+
+/*%
+ * Scan the interface table and set have_v4 and have_v6 depending
+ * upon whether there are IPv4 and IPv6 interface addresses.
+ *
+ * Returns:
+ * 0 on success
+ * -1 on failure.
+ */
+
+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
+ !defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
+
+#ifdef __hpux
+#define lifc_len iflc_len
+#define lifc_buf iflc_buf
+#define lifc_req iflc_req
+#define LIFCONF if_laddrconf
+#else
+#define SETFAMILYFLAGS
+#define LIFCONF lifconf
+#endif
+
+#ifdef __hpux
+#define lifr_addr iflr_addr
+#define lifr_name iflr_name
+#define lifr_dstaddr iflr_dstaddr
+#define lifr_flags iflr_flags
+#define ss_family sa_family
+#define LIFREQ if_laddrreq
+#else
+#define LIFREQ lifreq
+#endif
+
+static void
+scan_interfaces6(int *have_v4, int *have_v6) {
+ struct LIFCONF lifc;
+ struct LIFREQ lifreq;
+ struct in_addr in4;
+ struct in6_addr in6;
+ char *buf = NULL, *cp, *cplim;
+ static unsigned int bufsiz = 4095;
+ int s, cpsize, n;
+
+ /* Get interface list from system. */
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1)
+ goto cleanup;
+
+ /*
+ * Grow buffer until large enough to contain all interface
+ * descriptions.
+ */
+ for (;;) {
+ buf = memget(bufsiz);
+ if (buf == NULL)
+ goto cleanup;
+#ifdef SETFAMILYFLAGS
+ lifc.lifc_family = AF_UNSPEC; /*%< request all families */
+ lifc.lifc_flags = 0;
+#endif
+ lifc.lifc_len = bufsiz;
+ lifc.lifc_buf = buf;
+ if ((n = ioctl(s, SIOCGLIFCONF, (char *)&lifc)) != -1) {
+ /*
+ * Some OS's just return what will fit rather
+ * than set EINVAL if the buffer is too small
+ * to fit all the interfaces in. If
+ * lifc.lifc_len is too near to the end of the
+ * buffer we will grow it just in case and
+ * retry.
+ */
+ if (lifc.lifc_len + 2 * sizeof(lifreq) < bufsiz)
+ break;
+ }
+ if ((n == -1) && errno != EINVAL)
+ goto cleanup;
+
+ if (bufsiz > 1000000)
+ goto cleanup;
+
+ memput(buf, bufsiz);
+ bufsiz += 4096;
+ }
+
+ /* Parse system's interface list. */
+ cplim = buf + lifc.lifc_len; /*%< skip over if's with big ifr_addr's */
+ for (cp = buf;
+ (*have_v4 == 0 || *have_v6 == 0) && cp < cplim;
+ cp += cpsize) {
+ memcpy(&lifreq, cp, sizeof lifreq);
+#ifdef HAVE_SA_LEN
+#ifdef FIX_ZERO_SA_LEN
+ if (lifreq.lifr_addr.sa_len == 0)
+ lifreq.lifr_addr.sa_len = 16;
+#endif
+#ifdef HAVE_MINIMUM_IFREQ
+ cpsize = sizeof lifreq;
+ if (lifreq.lifr_addr.sa_len > sizeof (struct sockaddr))
+ cpsize += (int)lifreq.lifr_addr.sa_len -
+ (int)(sizeof (struct sockaddr));
+#else
+ cpsize = sizeof lifreq.lifr_name + lifreq.lifr_addr.sa_len;
+#endif /* HAVE_MINIMUM_IFREQ */
+#elif defined SIOCGIFCONF_ADDR
+ cpsize = sizeof lifreq;
+#else
+ cpsize = sizeof lifreq.lifr_name;
+ /* XXX maybe this should be a hard error? */
+ if (ioctl(s, SIOCGLIFADDR, (char *)&lifreq) < 0)
+ continue;
+#endif
+ switch (lifreq.lifr_addr.ss_family) {
+ case AF_INET:
+ if (*have_v4 == 0) {
+ memcpy(&in4,
+ &((struct sockaddr_in *)
+ &lifreq.lifr_addr)->sin_addr,
+ sizeof in4);
+ if (in4.s_addr == INADDR_ANY)
+ break;
+ n = ioctl(s, SIOCGLIFFLAGS, (char *)&lifreq);
+ if (n < 0)
+ break;
+ if ((lifreq.lifr_flags & IFF_UP) == 0)
+ break;
+ *have_v4 = 1;
+ }
+ break;
+ case AF_INET6:
+ if (*have_v6 == 0) {
+ memcpy(&in6,
+ &((struct sockaddr_in6 *)
+ &lifreq.lifr_addr)->sin6_addr, sizeof in6);
+ if (memcmp(&in6, &in6addr_any, sizeof in6) == 0)
+ break;
+ n = ioctl(s, SIOCGLIFFLAGS, (char *)&lifreq);
+ if (n < 0)
+ break;
+ if ((lifreq.lifr_flags & IFF_UP) == 0)
+ break;
+ *have_v6 = 1;
+ }
+ break;
+ }
+ }
+ if (buf != NULL)
+ memput(buf, bufsiz);
+ close(s);
+ /* printf("scan interface -> 4=%d 6=%d\n", *have_v4, *have_v6); */
+ return;
+ cleanup:
+ if (buf != NULL)
+ memput(buf, bufsiz);
+ if (s != -1)
+ close(s);
+ /* printf("scan interface -> 4=%d 6=%d\n", *have_v4, *have_v6); */
+ return;
+}
+#endif
+
+#if ( defined(__linux__) || defined(__linux) || defined(LINUX) )
+#ifndef IF_NAMESIZE
+# ifdef IFNAMSIZ
+# define IF_NAMESIZE IFNAMSIZ
+# else
+# define IF_NAMESIZE 16
+# endif
+#endif
+static void
+scan_linux6(int *have_v6) {
+ FILE *proc = NULL;
+ char address[33];
+ char name[IF_NAMESIZE+1];
+ int ifindex, prefix, flag3, flag4;
+
+ proc = fopen("/proc/net/if_inet6", "r");
+ if (proc == NULL)
+ return;
+
+ if (fscanf(proc, "%32[a-f0-9] %x %x %x %x %16s\n",
+ address, &ifindex, &prefix, &flag3, &flag4, name) == 6)
+ *have_v6 = 1;
+ fclose(proc);
+ return;
+}
+#endif
+
+static int
+scan_interfaces(int *have_v4, int *have_v6) {
+ struct ifconf ifc;
+ union {
+ char _pad[256]; /*%< leave space for IPv6 addresses */
+ struct ifreq ifreq;
+ } u;
+ struct in_addr in4;
+ struct in6_addr in6;
+ char *buf = NULL, *cp, *cplim;
+ static unsigned int bufsiz = 4095;
+ int s, n;
+ size_t cpsize;
+
+ /* Set to zero. Used as loop terminators below. */
+ *have_v4 = *have_v6 = 0;
+
+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
+ !defined(IRIX_EMUL_IOCTL_SIOCGIFCONF)
+ /*
+ * Try to scan the interfaces using IPv6 ioctls().
+ */
+ scan_interfaces6(have_v4, have_v6);
+ if (*have_v4 != 0 && *have_v6 != 0)
+ return (0);
+#endif
+#ifdef __linux
+ scan_linux6(have_v6);
+#endif
+
+ /* Get interface list from system. */
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+ goto err_ret;
+
+ /*
+ * Grow buffer until large enough to contain all interface
+ * descriptions.
+ */
+ for (;;) {
+ buf = memget(bufsiz);
+ if (buf == NULL)
+ goto err_ret;
+ ifc.ifc_len = bufsiz;
+ ifc.ifc_buf = buf;
+#ifdef IRIX_EMUL_IOCTL_SIOCGIFCONF
+ /*
+ * This is a fix for IRIX OS in which the call to ioctl with
+ * the flag SIOCGIFCONF may not return an entry for all the
+ * interfaces like most flavors of Unix.
+ */
+ if (emul_ioctl(&ifc) >= 0)
+ break;
+#else
+ if ((n = ioctl(s, SIOCGIFCONF, (char *)&ifc)) != -1) {
+ /*
+ * Some OS's just return what will fit rather
+ * than set EINVAL if the buffer is too small
+ * to fit all the interfaces in. If
+ * ifc.ifc_len is too near to the end of the
+ * buffer we will grow it just in case and
+ * retry.
+ */
+ if (ifc.ifc_len + 2 * sizeof(u.ifreq) < bufsiz)
+ break;
+ }
+#endif
+ if ((n == -1) && errno != EINVAL)
+ goto err_ret;
+
+ if (bufsiz > 1000000)
+ goto err_ret;
+
+ memput(buf, bufsiz);
+ bufsiz += 4096;
+ }
+
+ /* Parse system's interface list. */
+ cplim = buf + ifc.ifc_len; /*%< skip over if's with big ifr_addr's */
+ for (cp = buf;
+ (*have_v4 == 0 || *have_v6 == 0) && cp < cplim;
+ cp += cpsize) {
+ memcpy(&u.ifreq, cp, sizeof u.ifreq);
+#ifdef HAVE_SA_LEN
+#ifdef FIX_ZERO_SA_LEN
+ if (u.ifreq.ifr_addr.sa_len == 0)
+ u.ifreq.ifr_addr.sa_len = 16;
+#endif
+#ifdef HAVE_MINIMUM_IFREQ
+ cpsize = sizeof u.ifreq;
+ if (u.ifreq.ifr_addr.sa_len > sizeof (struct sockaddr))
+ cpsize += (int)u.ifreq.ifr_addr.sa_len -
+ (int)(sizeof (struct sockaddr));
+#else
+ cpsize = sizeof u.ifreq.ifr_name + u.ifreq.ifr_addr.sa_len;
+#endif /* HAVE_MINIMUM_IFREQ */
+ if (cpsize > sizeof u.ifreq && cpsize <= sizeof u)
+ memcpy(&u.ifreq, cp, cpsize);
+#elif defined SIOCGIFCONF_ADDR
+ cpsize = sizeof u.ifreq;
+#else
+ cpsize = sizeof u.ifreq.ifr_name;
+ /* XXX maybe this should be a hard error? */
+ if (ioctl(s, SIOCGIFADDR, (char *)&u.ifreq) < 0)
+ continue;
+#endif
+ switch (u.ifreq.ifr_addr.sa_family) {
+ case AF_INET:
+ if (*have_v4 == 0) {
+ memcpy(&in4,
+ &((struct sockaddr_in *)
+ &u.ifreq.ifr_addr)->sin_addr,
+ sizeof in4);
+ if (in4.s_addr == INADDR_ANY)
+ break;
+ n = ioctl(s, SIOCGIFFLAGS, (char *)&u.ifreq);
+ if (n < 0)
+ break;
+ if ((u.ifreq.ifr_flags & IFF_UP) == 0)
+ break;
+ *have_v4 = 1;
+ }
+ break;
+ case AF_INET6:
+ if (*have_v6 == 0) {
+ memcpy(&in6,
+ &((struct sockaddr_in6 *)
+ &u.ifreq.ifr_addr)->sin6_addr,
+ sizeof in6);
+ if (memcmp(&in6, &in6addr_any, sizeof in6) == 0)
+ break;
+ n = ioctl(s, SIOCGIFFLAGS, (char *)&u.ifreq);
+ if (n < 0)
+ break;
+ if ((u.ifreq.ifr_flags & IFF_UP) == 0)
+ break;
+ *have_v6 = 1;
+ }
+ break;
+ }
+ }
+ if (buf != NULL)
+ memput(buf, bufsiz);
+ close(s);
+ /* printf("scan interface -> 4=%d 6=%d\n", *have_v4, *have_v6); */
+ return (0);
+ err_ret:
+ if (buf != NULL)
+ memput(buf, bufsiz);
+ if (s != -1)
+ close(s);
+ /* printf("scan interface -> 4=%d 6=%d\n", *have_v4, *have_v6); */
+ return (-1);
+}
+
+static struct hostent *
+copyandmerge(struct hostent *he1, struct hostent *he2, int af, int *error_num) {
+ struct hostent *he = NULL;
+ int addresses = 1; /*%< NULL terminator */
+ int names = 1; /*%< NULL terminator */
+ int len = 0;
+ char **cpp, **npp;
+
+ /*
+ * Work out array sizes;
+ */
+ if (he1 != NULL) {
+ cpp = he1->h_addr_list;
+ while (*cpp != NULL) {
+ addresses++;
+ cpp++;
+ }
+ cpp = he1->h_aliases;
+ while (*cpp != NULL) {
+ names++;
+ cpp++;
+ }
+ }
+
+ if (he2 != NULL) {
+ cpp = he2->h_addr_list;
+ while (*cpp != NULL) {
+ addresses++;
+ cpp++;
+ }
+ if (he1 == NULL) {
+ cpp = he2->h_aliases;
+ while (*cpp != NULL) {
+ names++;
+ cpp++;
+ }
+ }
+ }
+
+ if (addresses == 1) {
+ *error_num = NO_ADDRESS;
+ return (NULL);
+ }
+
+ he = memget(sizeof *he);
+ if (he == NULL)
+ goto no_recovery;
+
+ he->h_addr_list = memget(sizeof(char *) * (addresses));
+ if (he->h_addr_list == NULL)
+ goto cleanup0;
+ memset(he->h_addr_list, 0, sizeof(char *) * (addresses));
+
+ /* copy addresses */
+ npp = he->h_addr_list;
+ if (he1 != NULL) {
+ cpp = he1->h_addr_list;
+ while (*cpp != NULL) {
+ *npp = memget((af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
+ if (*npp == NULL)
+ goto cleanup1;
+ /* convert to mapped if required */
+ if (af == AF_INET6 && he1->h_addrtype == AF_INET) {
+ memcpy(*npp, in6addr_mapped,
+ sizeof in6addr_mapped);
+ memcpy(*npp + sizeof in6addr_mapped, *cpp,
+ INADDRSZ);
+ } else {
+ memcpy(*npp, *cpp,
+ (af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
+ }
+ cpp++;
+ npp++;
+ }
+ }
+
+ if (he2 != NULL) {
+ cpp = he2->h_addr_list;
+ while (*cpp != NULL) {
+ *npp = memget((af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
+ if (*npp == NULL)
+ goto cleanup1;
+ /* convert to mapped if required */
+ if (af == AF_INET6 && he2->h_addrtype == AF_INET) {
+ memcpy(*npp, in6addr_mapped,
+ sizeof in6addr_mapped);
+ memcpy(*npp + sizeof in6addr_mapped, *cpp,
+ INADDRSZ);
+ } else {
+ memcpy(*npp, *cpp,
+ (af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
+ }
+ cpp++;
+ npp++;
+ }
+ }
+
+ he->h_aliases = memget(sizeof(char *) * (names));
+ if (he->h_aliases == NULL)
+ goto cleanup1;
+ memset(he->h_aliases, 0, sizeof(char *) * (names));
+
+ /* copy aliases */
+ npp = he->h_aliases;
+ cpp = (he1 != NULL) ? he1->h_aliases : he2->h_aliases;
+ while (*cpp != NULL) {
+ len = strlen (*cpp) + 1;
+ *npp = memget(len);
+ if (*npp == NULL)
+ goto cleanup2;
+ strcpy(*npp, *cpp);
+ npp++;
+ cpp++;
+ }
+
+ /* copy hostname */
+ he->h_name = memget(strlen((he1 != NULL) ?
+ he1->h_name : he2->h_name) + 1);
+ if (he->h_name == NULL)
+ goto cleanup2;
+ strcpy(he->h_name, (he1 != NULL) ? he1->h_name : he2->h_name);
+
+ /* set address type and length */
+ he->h_addrtype = af;
+ he->h_length = (af == AF_INET) ? INADDRSZ : IN6ADDRSZ;
+ return(he);
+
+ cleanup2:
+ cpp = he->h_aliases;
+ while (*cpp != NULL) {
+ memput(*cpp, strlen(*cpp) + 1);
+ cpp++;
+ }
+ memput(he->h_aliases, sizeof(char *) * (names));
+
+ cleanup1:
+ cpp = he->h_addr_list;
+ while (*cpp != NULL) {
+ memput(*cpp, (af == AF_INET) ? INADDRSZ : IN6ADDRSZ);
+ *cpp = NULL;
+ cpp++;
+ }
+ memput(he->h_addr_list, sizeof(char *) * (addresses));
+
+ cleanup0:
+ memput(he, sizeof *he);
+
+ no_recovery:
+ *error_num = NO_RECOVERY;
+ return (NULL);
+}
+
+static struct net_data *
+init() {
+ struct net_data *net_data;
+
+ if (!(net_data = net_data_init(NULL)))
+ goto error;
+ if (!net_data->ho) {
+ net_data->ho = (*net_data->irs->ho_map)(net_data->irs);
+ if (!net_data->ho || !net_data->res) {
+ error:
+ errno = EIO;
+
+#ifdef SUNW_SETHERRNO
+ h_errno = NETDB_INTERNAL;
+#endif /* SUNW_SETHERRNO */
+ if (net_data && net_data->res)
+ RES_SET_H_ERRNO(net_data->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+
+ (*net_data->ho->res_set)(net_data->ho, net_data->res, NULL);
+ }
+
+ return (net_data);
+}
+
+static void
+freepvt(struct net_data *net_data) {
+ if (net_data->ho_data) {
+ free(net_data->ho_data);
+ net_data->ho_data = NULL;
+ }
+}
+
+static struct hostent *
+fakeaddr(const char *name, int af, struct net_data *net_data) {
+ struct pvt *pvt;
+
+ freepvt(net_data);
+ net_data->ho_data = malloc(sizeof (struct pvt));
+ if (!net_data->ho_data) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(net_data->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ pvt = net_data->ho_data;
+#ifndef __bsdi__
+ /*
+ * Unlike its forebear(inet_aton), our friendly inet_pton() is strict
+ * in its interpretation of its input, and it will only return "1" if
+ * the input string is a formally valid(and thus unambiguous with
+ * respect to host names) internet address specification for this AF.
+ *
+ * This means "telnet 0xdeadbeef" and "telnet 127.1" are dead now.
+ */
+ if (inet_pton(af, name, pvt->addr) != 1) {
+#else
+ /* BSDI XXX
+ * We put this back to inet_aton -- we really want the old behavior
+ * Long live 127.1...
+ */
+ if ((af != AF_INET ||
+ inet_aton(name, (struct in_addr *)pvt->addr) != 1) &&
+ inet_pton(af, name, pvt->addr) != 1) {
+#endif
+ RES_SET_H_ERRNO(net_data->res, HOST_NOT_FOUND);
+ return (NULL);
+ }
+ strncpy(pvt->name, name, NS_MAXDNAME);
+ pvt->name[NS_MAXDNAME] = '\0';
+ if (af == AF_INET && (net_data->res->options & RES_USE_INET6) != 0U) {
+ map_v4v6_address(pvt->addr, pvt->addr);
+ af = AF_INET6;
+ }
+ pvt->host.h_addrtype = af;
+ switch(af) {
+ case AF_INET:
+ pvt->host.h_length = NS_INADDRSZ;
+ break;
+ case AF_INET6:
+ pvt->host.h_length = NS_IN6ADDRSZ;
+ break;
+ default:
+ errno = EAFNOSUPPORT;
+ RES_SET_H_ERRNO(net_data->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ pvt->host.h_name = pvt->name;
+ pvt->host.h_aliases = pvt->aliases;
+ pvt->aliases[0] = NULL;
+ pvt->addrs[0] = (char *)pvt->addr;
+ pvt->addrs[1] = NULL;
+ pvt->host.h_addr_list = pvt->addrs;
+ RES_SET_H_ERRNO(net_data->res, NETDB_SUCCESS);
+ return (&pvt->host);
+}
+
+#ifdef grot /*%< for future use in gethostbyaddr(), for "SUNSECURITY" */
+ struct hostent *rhp;
+ char **haddr;
+ u_long old_options;
+ char hname2[MAXDNAME+1];
+
+ if (af == AF_INET) {
+ /*
+ * turn off search as the name should be absolute,
+ * 'localhost' should be matched by defnames
+ */
+ strncpy(hname2, hp->h_name, MAXDNAME);
+ hname2[MAXDNAME] = '\0';
+ old_options = net_data->res->options;
+ net_data->res->options &= ~RES_DNSRCH;
+ net_data->res->options |= RES_DEFNAMES;
+ if (!(rhp = gethostbyname(hname2))) {
+ net_data->res->options = old_options;
+ RES_SET_H_ERRNO(net_data->res, HOST_NOT_FOUND);
+ return (NULL);
+ }
+ net_data->res->options = old_options;
+ for (haddr = rhp->h_addr_list; *haddr; haddr++)
+ if (!memcmp(*haddr, addr, INADDRSZ))
+ break;
+ if (!*haddr) {
+ RES_SET_H_ERRNO(net_data->res, HOST_NOT_FOUND);
+ return (NULL);
+ }
+ }
+#endif /* grot */
+#endif /*__BIND_NOSTATIC*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/gethostent_r.c b/usr/src/lib/libresolv2_joy/common/irs/gethostent_r.c
new file mode 100644
index 0000000000..1971677c5d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/gethostent_r.c
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: gethostent_r.c,v 1.9 2005/09/03 12:41:37 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <port_before.h>
+#if !defined(_REENTRANT) || !defined(DO_PTHREADS)
+ static int gethostent_r_not_required = 0;
+#else
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/param.h>
+#include <port_after.h>
+
+#pragma redefine extname res_gethostbyname joy_res_gethostbyname
+#pragma redefine extname res_gethostbyaddr joy_res_gethostbyaddr
+
+#ifdef HOST_R_RETURN
+
+static HOST_R_RETURN
+copy_hostent(struct hostent *, struct hostent *, HOST_R_COPY_ARGS);
+
+HOST_R_RETURN
+gethostbyname_r(const char *name, struct hostent *hptr, HOST_R_ARGS) {
+ struct hostent *he = gethostbyname(name);
+#ifdef HOST_R_SETANSWER
+ int n = 0;
+#endif
+
+#ifdef HOST_R_ERRNO
+ HOST_R_ERRNO;
+#endif
+
+#ifdef HOST_R_SETANSWER
+ if (he == NULL || (n = copy_hostent(he, hptr, HOST_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = hptr;
+
+ return (n);
+#else
+ if (he == NULL)
+ return (HOST_R_BAD);
+
+ return (copy_hostent(he, hptr, HOST_R_COPY));
+#endif
+}
+
+HOST_R_RETURN
+gethostbyaddr_r(const char *addr, int len, int type,
+ struct hostent *hptr, HOST_R_ARGS) {
+ struct hostent *he = gethostbyaddr(addr, len, type);
+#ifdef HOST_R_SETANSWER
+ int n = 0;
+#endif
+
+#ifdef HOST_R_ERRNO
+ HOST_R_ERRNO;
+#endif
+
+#ifdef HOST_R_SETANSWER
+ if (he == NULL || (n = copy_hostent(he, hptr, HOST_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = hptr;
+
+ return (n);
+#else
+ if (he == NULL)
+ return (HOST_R_BAD);
+
+ return (copy_hostent(he, hptr, HOST_R_COPY));
+#endif
+}
+
+/*%
+ * These assume a single context is in operation per thread.
+ * If this is not the case we will need to call irs directly
+ * rather than through the base functions.
+ */
+
+HOST_R_RETURN
+gethostent_r(struct hostent *hptr, HOST_R_ARGS) {
+ struct hostent *he = gethostent();
+#ifdef HOST_R_SETANSWER
+ int n = 0;
+#endif
+
+#ifdef HOST_R_ERRNO
+ HOST_R_ERRNO;
+#endif
+
+#ifdef HOST_R_SETANSWER
+ if (he == NULL || (n = copy_hostent(he, hptr, HOST_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = hptr;
+
+ return (n);
+#else
+ if (he == NULL)
+ return (HOST_R_BAD);
+
+ return (copy_hostent(he, hptr, HOST_R_COPY));
+#endif
+}
+
+HOST_R_SET_RETURN
+#ifdef HOST_R_ENT_ARGS
+sethostent_r(int stay_open, HOST_R_ENT_ARGS)
+#else
+sethostent_r(int stay_open)
+#endif
+{
+#ifdef HOST_R_ENT_ARGS
+ UNUSED(hdptr);
+#endif
+ sethostent(stay_open);
+#ifdef HOST_R_SET_RESULT
+ return (HOST_R_SET_RESULT);
+#endif
+}
+
+HOST_R_END_RETURN
+#ifdef HOST_R_ENT_ARGS
+endhostent_r(HOST_R_ENT_ARGS)
+#else
+endhostent_r(void)
+#endif
+{
+#ifdef HOST_R_ENT_ARGS
+ UNUSED(hdptr);
+#endif
+ endhostent();
+ HOST_R_END_RESULT(HOST_R_OK);
+}
+
+/* Private */
+
+#ifndef HOSTENT_DATA
+static HOST_R_RETURN
+copy_hostent(struct hostent *he, struct hostent *hptr, HOST_R_COPY_ARGS) {
+ char *cp;
+ char **ptr;
+ int i, n;
+ int nptr, len;
+
+ /* Find out the amount of space required to store the answer. */
+ nptr = 2; /*%< NULL ptrs */
+ len = (char *)ALIGN(buf) - buf;
+ for (i = 0; he->h_addr_list[i]; i++, nptr++) {
+ len += he->h_length;
+ }
+ for (i = 0; he->h_aliases[i]; i++, nptr++) {
+ len += strlen(he->h_aliases[i]) + 1;
+ }
+ len += strlen(he->h_name) + 1;
+ len += nptr * sizeof(char*);
+
+ if (len > buflen) {
+ errno = ERANGE;
+ return (HOST_R_BAD);
+ }
+
+ /* copy address size and type */
+ hptr->h_addrtype = he->h_addrtype;
+ n = hptr->h_length = he->h_length;
+
+ ptr = (char **)ALIGN(buf);
+ cp = (char *)ALIGN(buf) + nptr * sizeof(char *);
+
+ /* copy address list */
+ hptr->h_addr_list = ptr;
+ for (i = 0; he->h_addr_list[i]; i++ , ptr++) {
+ memcpy(cp, he->h_addr_list[i], n);
+ hptr->h_addr_list[i] = cp;
+ cp += n;
+ }
+ hptr->h_addr_list[i] = NULL;
+ ptr++;
+
+ /* copy official name */
+ n = strlen(he->h_name) + 1;
+ strcpy(cp, he->h_name);
+ hptr->h_name = cp;
+ cp += n;
+
+ /* copy aliases */
+ hptr->h_aliases = ptr;
+ for (i = 0 ; he->h_aliases[i]; i++) {
+ n = strlen(he->h_aliases[i]) + 1;
+ strcpy(cp, he->h_aliases[i]);
+ hptr->h_aliases[i] = cp;
+ cp += n;
+ }
+ hptr->h_aliases[i] = NULL;
+
+ return (HOST_R_OK);
+}
+#else /* !HOSTENT_DATA */
+static int
+copy_hostent(struct hostent *he, struct hostent *hptr, HOST_R_COPY_ARGS) {
+ char *cp, *eob;
+ int i, n;
+
+ /* copy address size and type */
+ hptr->h_addrtype = he->h_addrtype;
+ n = hptr->h_length = he->h_length;
+
+ /* copy up to first 35 addresses */
+ i = 0;
+ cp = hdptr->hostbuf;
+ eob = hdptr->hostbuf + sizeof(hdptr->hostbuf);
+ hptr->h_addr_list = hdptr->h_addr_ptrs;
+ while (he->h_addr_list[i] && i < (_MAXADDRS)) {
+ if (n < (eob - cp)) {
+ memcpy(cp, he->h_addr_list[i], n);
+ hptr->h_addr_list[i] = cp;
+ cp += n;
+ } else {
+ break;
+ }
+ i++;
+ }
+ hptr->h_addr_list[i] = NULL;
+
+ /* copy official name */
+ if ((n = strlen(he->h_name) + 1) < (eob - cp)) {
+ strcpy(cp, he->h_name);
+ hptr->h_name = cp;
+ cp += n;
+ } else {
+ return (-1);
+ }
+
+ /* copy aliases */
+ i = 0;
+ hptr->h_aliases = hdptr->host_aliases;
+ while (he->h_aliases[i] && i < (_MAXALIASES-1)) {
+ if ((n = strlen(he->h_aliases[i]) + 1) < (eob - cp)) {
+ strcpy(cp, he->h_aliases[i]);
+ hptr->h_aliases[i] = cp;
+ cp += n;
+ } else {
+ break;
+ }
+ i++;
+ }
+ hptr->h_aliases[i] = NULL;
+
+ return (HOST_R_OK);
+}
+#endif /* !HOSTENT_DATA */
+#else /* HOST_R_RETURN */
+ static int gethostent_r_unknown_system = 0;
+#endif /* HOST_R_RETURN */
+#endif /* !defined(_REENTRANT) || !defined(DO_PTHREADS) */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getnameinfo.c b/usr/src/lib/libresolv2_joy/common/irs/getnameinfo.c
new file mode 100644
index 0000000000..360bda8bfe
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getnameinfo.c
@@ -0,0 +1,334 @@
+/*
+ * Issues to be discussed:
+ * - Thread safe-ness must be checked
+ */
+
+#if ( defined(__linux__) || defined(__linux) || defined(LINUX) )
+#ifndef IF_NAMESIZE
+# ifdef IFNAMSIZ
+# define IF_NAMESIZE IFNAMSIZ
+# else
+# define IF_NAMESIZE 16
+# endif
+#endif
+#endif
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by WIDE Project and
+ * its contributors.
+ * 4. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <port_before.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <string.h>
+#include <stddef.h>
+
+#include <port_after.h>
+
+/*%
+ * Note that a_off will be dynamically adjusted so that to be consistent
+ * with the definition of sockaddr_in{,6}.
+ * The value presented below is just a guess.
+ */
+static struct afd {
+ int a_af;
+ int a_addrlen;
+ size_t a_socklen;
+ int a_off;
+} afdl [] = {
+ /* first entry is linked last... */
+ {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in),
+ offsetof(struct sockaddr_in, sin_addr)},
+ {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6),
+ offsetof(struct sockaddr_in6, sin6_addr)},
+ {0, 0, 0, 0},
+};
+
+struct sockinet {
+#ifdef HAVE_SA_LEN
+ u_char si_len;
+#endif
+ u_char si_family;
+ u_short si_port;
+};
+
+static int ip6_parsenumeric __P((const struct sockaddr *, const char *, char *,
+ size_t, int));
+#ifdef HAVE_SIN6_SCOPE_ID
+static int ip6_sa2str __P((const struct sockaddr_in6 *, char *, size_t, int));
+#endif
+
+int
+getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
+ const struct sockaddr *sa;
+ size_t salen;
+ char *host;
+ size_t hostlen;
+ char *serv;
+ size_t servlen;
+ int flags;
+{
+ struct afd *afd;
+ struct servent *sp;
+ struct hostent *hp;
+ u_short port;
+#ifdef HAVE_SA_LEN
+ size_t len;
+#endif
+ int family, i;
+ const char *addr;
+ char *p;
+ char numserv[512];
+ char numaddr[512];
+ const struct sockaddr_in6 *sin6;
+
+ if (sa == NULL)
+ return EAI_FAIL;
+
+#ifdef HAVE_SA_LEN
+ len = sa->sa_len;
+ if (len != salen) return EAI_FAIL;
+#endif
+
+ family = sa->sa_family;
+ for (i = 0; afdl[i].a_af; i++)
+ if (afdl[i].a_af == family) {
+ afd = &afdl[i];
+ goto found;
+ }
+ return EAI_FAMILY;
+
+ found:
+ if (salen != afd->a_socklen) return EAI_FAIL;
+
+ port = ((const struct sockinet *)sa)->si_port; /*%< network byte order */
+ addr = (const char *)sa + afd->a_off;
+
+ if (serv == NULL || servlen == 0U) {
+ /*
+ * rfc2553bis says that serv == NULL or servlen == 0 means that
+ * the caller does not want the result.
+ */
+ } else if (flags & NI_NUMERICSERV) {
+ sprintf(numserv, "%d", ntohs(port));
+ if (strlen(numserv) > servlen)
+ return EAI_MEMORY;
+ strcpy(serv, numserv);
+ } else {
+ sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp");
+ if (sp) {
+ if (strlen(sp->s_name) + 1 > servlen)
+ return EAI_MEMORY;
+ strcpy(serv, sp->s_name);
+ } else
+ return EAI_NONAME;
+ }
+
+ switch (sa->sa_family) {
+ case AF_INET:
+ if (ntohl(*(const u_int32_t *)addr) >> IN_CLASSA_NSHIFT == 0)
+ flags |= NI_NUMERICHOST;
+ break;
+ case AF_INET6:
+ sin6 = (const struct sockaddr_in6 *)sa;
+ switch (sin6->sin6_addr.s6_addr[0]) {
+ case 0x00:
+ if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
+ ;
+ else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
+ ;
+ else
+ flags |= NI_NUMERICHOST;
+ break;
+ default:
+ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
+ flags |= NI_NUMERICHOST;
+ else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
+ flags |= NI_NUMERICHOST;
+ break;
+ }
+ break;
+ }
+ if (host == NULL || hostlen == 0U) {
+ /*
+ * rfc2553bis says that host == NULL or hostlen == 0 means that
+ * the caller does not want the result.
+ */
+ } else if (flags & NI_NUMERICHOST) {
+ goto numeric;
+ } else {
+ hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
+
+ if (hp) {
+ if (flags & NI_NOFQDN) {
+ p = strchr(hp->h_name, '.');
+ if (p) *p = '\0';
+ }
+ if (strlen(hp->h_name) + 1 > hostlen)
+ return EAI_MEMORY;
+ strcpy(host, hp->h_name);
+ } else {
+ if (flags & NI_NAMEREQD)
+ return EAI_NONAME;
+ numeric:
+ switch(afd->a_af) {
+ case AF_INET6:
+ {
+ int error;
+
+ if ((error = ip6_parsenumeric(sa, addr, host,
+ hostlen,
+ flags)) != 0)
+ return(error);
+ break;
+ }
+
+ default:
+ if (inet_ntop(afd->a_af, addr, numaddr,
+ sizeof(numaddr)) == NULL)
+ return EAI_NONAME;
+ if (strlen(numaddr) + 1 > hostlen)
+ return EAI_MEMORY;
+ strcpy(host, numaddr);
+ }
+ }
+ }
+ return(0);
+}
+
+static int
+ip6_parsenumeric(const struct sockaddr *sa, const char *addr, char *host,
+ size_t hostlen, int flags)
+{
+ size_t numaddrlen;
+ char numaddr[512];
+
+#ifndef HAVE_SIN6_SCOPE_ID
+ UNUSED(sa);
+ UNUSED(flags);
+#endif
+
+ if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr))
+ == NULL)
+ return EAI_SYSTEM;
+
+ numaddrlen = strlen(numaddr);
+ if (numaddrlen + 1 > hostlen) /*%< don't forget terminator */
+ return EAI_MEMORY;
+ strcpy(host, numaddr);
+
+#ifdef HAVE_SIN6_SCOPE_ID
+ if (((const struct sockaddr_in6 *)sa)->sin6_scope_id) {
+ char scopebuf[MAXHOSTNAMELEN]; /*%< XXX */
+ int scopelen;
+
+ /* ip6_sa2str never fails */
+ scopelen = ip6_sa2str((const struct sockaddr_in6 *)sa,
+ scopebuf, sizeof(scopebuf), flags);
+
+ if (scopelen + 1 + numaddrlen + 1 > hostlen)
+ return EAI_MEMORY;
+
+ /* construct <numeric-addr><delim><scopeid> */
+ memcpy(host + numaddrlen + 1, scopebuf,
+ scopelen);
+ host[numaddrlen] = SCOPE_DELIMITER;
+ host[numaddrlen + 1 + scopelen] = '\0';
+ }
+#endif
+
+ return 0;
+}
+
+#ifdef HAVE_SIN6_SCOPE_ID
+/* ARGSUSED */
+static int
+ip6_sa2str(const struct sockaddr_in6 *sa6, char *buf,
+ size_t bufsiz, int flags)
+{
+#ifdef USE_IFNAMELINKID
+ unsigned int ifindex = (unsigned int)sa6->sin6_scope_id;
+ const struct in6_addr *a6 = &sa6->sin6_addr;
+#endif
+ char tmp[64];
+
+#ifdef NI_NUMERICSCOPE
+ if (flags & NI_NUMERICSCOPE) {
+ sprintf(tmp, "%u", sa6->sin6_scope_id);
+ if (bufsiz != 0U) {
+ strncpy(buf, tmp, bufsiz - 1);
+ buf[bufsiz - 1] = '\0';
+ }
+ return(strlen(tmp));
+ }
+#endif
+
+#ifdef USE_IFNAMELINKID
+ /*
+ * For a link-local address, convert the index to an interface
+ * name, assuming a one-to-one mapping between links and interfaces.
+ * Note, however, that this assumption is stronger than the
+ * specification of the scoped address architecture; the
+ * specficication says that more than one interfaces can belong to
+ * a single link.
+ */
+
+ /* if_indextoname() does not take buffer size. not a good api... */
+ if ((IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) &&
+ bufsiz >= IF_NAMESIZE) {
+ char *p = if_indextoname(ifindex, buf);
+ if (p) {
+ return(strlen(p));
+ }
+ }
+#endif
+
+ /* last resort */
+ sprintf(tmp, "%u", sa6->sin6_scope_id);
+ if (bufsiz != 0U) {
+ strncpy(buf, tmp, bufsiz - 1);
+ buf[bufsiz - 1] = '\0';
+ }
+ return(strlen(tmp));
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getnetent.c b/usr/src/lib/libresolv2_joy/common/irs/getnetent.c
new file mode 100644
index 0000000000..0d00699e81
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getnetent.c
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: getnetent.c,v 1.7 2005/04/27 04:56:25 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#if !defined(__BIND_NOSTATIC)
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "irs_data.h"
+
+/* Definitions */
+
+struct pvt {
+ struct netent netent;
+ char * aliases[1];
+ char name[MAXDNAME + 1];
+};
+
+/* Forward */
+
+static struct net_data *init(void);
+static struct netent *nw_to_net(struct nwent *, struct net_data *);
+static void freepvt(struct net_data *);
+static struct netent *fakeaddr(const char *, int af, struct net_data *);
+
+/* Portability */
+
+#ifndef INADDR_NONE
+# define INADDR_NONE 0xffffffff
+#endif
+
+/* Public */
+
+struct netent *
+getnetent() {
+ struct net_data *net_data = init();
+
+ return (getnetent_p(net_data));
+}
+
+struct netent *
+getnetbyname(const char *name) {
+ struct net_data *net_data = init();
+
+ return (getnetbyname_p(name, net_data));
+}
+
+struct netent *
+getnetbyaddr(unsigned long net, int type) {
+ struct net_data *net_data = init();
+
+ return (getnetbyaddr_p(net, type, net_data));
+}
+
+void
+setnetent(int stayopen) {
+ struct net_data *net_data = init();
+
+ setnetent_p(stayopen, net_data);
+}
+
+
+void
+endnetent() {
+ struct net_data *net_data = init();
+
+ endnetent_p(net_data);
+}
+
+/* Shared private. */
+
+struct netent *
+getnetent_p(struct net_data *net_data) {
+ struct irs_nw *nw;
+
+ if (!net_data || !(nw = net_data->nw))
+ return (NULL);
+ net_data->nww_last = (*nw->next)(nw);
+ net_data->nw_last = nw_to_net(net_data->nww_last, net_data);
+ return (net_data->nw_last);
+}
+
+struct netent *
+getnetbyname_p(const char *name, struct net_data *net_data) {
+ struct irs_nw *nw;
+ struct netent *np;
+ char **nap;
+
+ if (!net_data || !(nw = net_data->nw))
+ return (NULL);
+ if (net_data->nw_stayopen && net_data->nw_last) {
+ if (!strcmp(net_data->nw_last->n_name, name))
+ return (net_data->nw_last);
+ for (nap = net_data->nw_last->n_aliases; nap && *nap; nap++)
+ if (!strcmp(name, *nap))
+ return (net_data->nw_last);
+ }
+ if ((np = fakeaddr(name, AF_INET, net_data)) != NULL)
+ return (np);
+ net_data->nww_last = (*nw->byname)(nw, name, AF_INET);
+ net_data->nw_last = nw_to_net(net_data->nww_last, net_data);
+ if (!net_data->nw_stayopen)
+ endnetent();
+ return (net_data->nw_last);
+}
+
+struct netent *
+getnetbyaddr_p(unsigned long net, int type, struct net_data *net_data) {
+ struct irs_nw *nw;
+ u_char addr[4];
+ int bits;
+
+ if (!net_data || !(nw = net_data->nw))
+ return (NULL);
+ if (net_data->nw_stayopen && net_data->nw_last)
+ if (type == net_data->nw_last->n_addrtype &&
+ net == net_data->nw_last->n_net)
+ return (net_data->nw_last);
+
+ /* cannonize net(host order) */
+ if (net < 256UL) {
+ net <<= 24;
+ bits = 8;
+ } else if (net < 65536UL) {
+ net <<= 16;
+ bits = 16;
+ } else if (net < 16777216UL) {
+ net <<= 8;
+ bits = 24;
+ } else
+ bits = 32;
+
+ /* convert to net order */
+ addr[0] = (0xFF000000 & net) >> 24;
+ addr[1] = (0x00FF0000 & net) >> 16;
+ addr[2] = (0x0000FF00 & net) >> 8;
+ addr[3] = (0x000000FF & net);
+
+ /* reduce bits to as close to natural number as possible */
+ if ((bits == 32) && (addr[0] < 224) && (addr[3] == 0)) {
+ if ((addr[0] < 192) && (addr[2] == 0)) {
+ if ((addr[0] < 128) && (addr[1] == 0))
+ bits = 8;
+ else
+ bits = 16;
+ } else {
+ bits = 24;
+ }
+ }
+
+ net_data->nww_last = (*nw->byaddr)(nw, addr, bits, AF_INET);
+ net_data->nw_last = nw_to_net(net_data->nww_last, net_data);
+ if (!net_data->nw_stayopen)
+ endnetent();
+ return (net_data->nw_last);
+}
+
+
+
+
+void
+setnetent_p(int stayopen, struct net_data *net_data) {
+ struct irs_nw *nw;
+
+ if (!net_data || !(nw = net_data->nw))
+ return;
+ freepvt(net_data);
+ (*nw->rewind)(nw);
+ net_data->nw_stayopen = (stayopen != 0);
+ if (stayopen == 0)
+ net_data_minimize(net_data);
+}
+
+void
+endnetent_p(struct net_data *net_data) {
+ struct irs_nw *nw;
+
+ if ((net_data != NULL) && ((nw = net_data->nw) != NULL))
+ (*nw->minimize)(nw);
+}
+
+/* Private */
+
+static struct net_data *
+init() {
+ struct net_data *net_data;
+
+ if (!(net_data = net_data_init(NULL)))
+ goto error;
+ if (!net_data->nw) {
+ net_data->nw = (*net_data->irs->nw_map)(net_data->irs);
+
+ if (!net_data->nw || !net_data->res) {
+ error:
+ errno = EIO;
+ return (NULL);
+ }
+ (*net_data->nw->res_set)(net_data->nw, net_data->res, NULL);
+ }
+
+ return (net_data);
+}
+
+static void
+freepvt(struct net_data *net_data) {
+ if (net_data->nw_data) {
+ free(net_data->nw_data);
+ net_data->nw_data = NULL;
+ }
+}
+
+static struct netent *
+fakeaddr(const char *name, int af, struct net_data *net_data) {
+ struct pvt *pvt;
+ const char *cp;
+ u_long tmp;
+
+ if (af != AF_INET) {
+ /* XXX should support IPv6 some day */
+ errno = EAFNOSUPPORT;
+ RES_SET_H_ERRNO(net_data->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ if (!isascii((unsigned char)(name[0])) ||
+ !isdigit((unsigned char)(name[0])))
+ return (NULL);
+ for (cp = name; *cp; ++cp)
+ if (!isascii(*cp) || (!isdigit((unsigned char)*cp) && *cp != '.'))
+ return (NULL);
+ if (*--cp == '.')
+ return (NULL);
+
+ /* All-numeric, no dot at the end. */
+
+ tmp = inet_network(name);
+ if (tmp == INADDR_NONE) {
+ RES_SET_H_ERRNO(net_data->res, HOST_NOT_FOUND);
+ return (NULL);
+ }
+
+ /* Valid network number specified.
+ * Fake up a netent as if we'd actually
+ * done a lookup.
+ */
+ freepvt(net_data);
+ net_data->nw_data = malloc(sizeof (struct pvt));
+ if (!net_data->nw_data) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(net_data->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ pvt = net_data->nw_data;
+
+ strncpy(pvt->name, name, MAXDNAME);
+ pvt->name[MAXDNAME] = '\0';
+ pvt->netent.n_name = pvt->name;
+ pvt->netent.n_addrtype = AF_INET;
+ pvt->netent.n_aliases = pvt->aliases;
+ pvt->aliases[0] = NULL;
+ pvt->netent.n_net = tmp;
+
+ return (&pvt->netent);
+}
+
+static struct netent *
+nw_to_net(struct nwent *nwent, struct net_data *net_data) {
+ struct pvt *pvt;
+ u_long addr = 0;
+ int i;
+ int msbyte;
+
+ if (!nwent || nwent->n_addrtype != AF_INET)
+ return (NULL);
+ freepvt(net_data);
+ net_data->nw_data = malloc(sizeof (struct pvt));
+ if (!net_data->nw_data) {
+ errno = ENOMEM;
+ RES_SET_H_ERRNO(net_data->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ pvt = net_data->nw_data;
+ pvt->netent.n_name = nwent->n_name;
+ pvt->netent.n_aliases = nwent->n_aliases;
+ pvt->netent.n_addrtype = nwent->n_addrtype;
+
+/*%
+ * What this code does: Converts net addresses from network to host form.
+ *
+ * msbyte: the index of the most significant byte in the n_addr array.
+ *
+ * Shift bytes in significant order into addr. When all signicant
+ * bytes are in, zero out bits in the LSB that are not part of the network.
+ */
+ msbyte = nwent->n_length / 8 +
+ ((nwent->n_length % 8) != 0 ? 1 : 0) - 1;
+ for (i = 0; i <= msbyte; i++)
+ addr = (addr << 8) | ((unsigned char *)nwent->n_addr)[i];
+ i = (32 - nwent->n_length) % 8;
+ if (i != 0)
+ addr &= ~((1 << (i + 1)) - 1);
+ pvt->netent.n_net = addr;
+ return (&pvt->netent);
+}
+
+#endif /*__BIND_NOSTATIC*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getnetent_r.c b/usr/src/lib/libresolv2_joy/common/irs/getnetent_r.c
new file mode 100644
index 0000000000..9fb52bc394
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getnetent_r.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: getnetent_r.c,v 1.6 2005/09/03 12:41:38 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <port_before.h>
+#if !defined(_REENTRANT) || !defined(DO_PTHREADS)
+ static int getnetent_r_not_required = 0;
+#else
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/param.h>
+#include <port_after.h>
+
+#ifdef NET_R_RETURN
+
+static NET_R_RETURN
+copy_netent(struct netent *, struct netent *, NET_R_COPY_ARGS);
+
+NET_R_RETURN
+getnetbyname_r(const char *name, struct netent *nptr, NET_R_ARGS) {
+ struct netent *ne = getnetbyname(name);
+#ifdef NET_R_SETANSWER
+ int n = 0;
+
+ if (ne == NULL || (n = copy_netent(ne, nptr, NET_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = ne;
+ if (ne == NULL)
+ *h_errnop = h_errno;
+ return (n);
+#else
+ if (ne == NULL)
+ return (NET_R_BAD);
+
+ return (copy_netent(ne, nptr, NET_R_COPY));
+#endif
+}
+
+#ifndef GETNETBYADDR_ADDR_T
+#define GETNETBYADDR_ADDR_T long
+#endif
+NET_R_RETURN
+getnetbyaddr_r(GETNETBYADDR_ADDR_T addr, int type, struct netent *nptr, NET_R_ARGS) {
+ struct netent *ne = getnetbyaddr(addr, type);
+#ifdef NET_R_SETANSWER
+ int n = 0;
+
+ if (ne == NULL || (n = copy_netent(ne, nptr, NET_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = ne;
+ if (ne == NULL)
+ *h_errnop = h_errno;
+ return (n);
+#else
+
+ if (ne == NULL)
+ return (NET_R_BAD);
+
+ return (copy_netent(ne, nptr, NET_R_COPY));
+#endif
+}
+
+/*%
+ * These assume a single context is in operation per thread.
+ * If this is not the case we will need to call irs directly
+ * rather than through the base functions.
+ */
+
+NET_R_RETURN
+getnetent_r(struct netent *nptr, NET_R_ARGS) {
+ struct netent *ne = getnetent();
+#ifdef NET_R_SETANSWER
+ int n = 0;
+
+ if (ne == NULL || (n = copy_netent(ne, nptr, NET_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = ne;
+ if (ne == NULL)
+ *h_errnop = h_errno;
+ return (n);
+#else
+
+ if (ne == NULL)
+ return (NET_R_BAD);
+
+ return (copy_netent(ne, nptr, NET_R_COPY));
+#endif
+}
+
+NET_R_SET_RETURN
+#ifdef NET_R_ENT_ARGS
+setnetent_r(int stay_open, NET_R_ENT_ARGS)
+#else
+setnetent_r(int stay_open)
+#endif
+{
+#ifdef NET_R_ENT_ARGS
+ UNUSED(ndptr);
+#endif
+ setnetent(stay_open);
+#ifdef NET_R_SET_RESULT
+ return (NET_R_SET_RESULT);
+#endif
+}
+
+NET_R_END_RETURN
+#ifdef NET_R_ENT_ARGS
+endnetent_r(NET_R_ENT_ARGS)
+#else
+endnetent_r()
+#endif
+{
+#ifdef NET_R_ENT_ARGS
+ UNUSED(ndptr);
+#endif
+ endnetent();
+ NET_R_END_RESULT(NET_R_OK);
+}
+
+/* Private */
+
+#ifndef NETENT_DATA
+static NET_R_RETURN
+copy_netent(struct netent *ne, struct netent *nptr, NET_R_COPY_ARGS) {
+ char *cp;
+ int i, n;
+ int numptr, len;
+
+ /* Find out the amount of space required to store the answer. */
+ numptr = 1; /*%< NULL ptr */
+ len = (char *)ALIGN(buf) - buf;
+ for (i = 0; ne->n_aliases[i]; i++, numptr++) {
+ len += strlen(ne->n_aliases[i]) + 1;
+ }
+ len += strlen(ne->n_name) + 1;
+ len += numptr * sizeof(char*);
+
+ if (len > (int)buflen) {
+ errno = ERANGE;
+ return (NET_R_BAD);
+ }
+
+ /* copy net value and type */
+ nptr->n_addrtype = ne->n_addrtype;
+ nptr->n_net = ne->n_net;
+
+ cp = (char *)ALIGN(buf) + numptr * sizeof(char *);
+
+ /* copy official name */
+ n = strlen(ne->n_name) + 1;
+ strcpy(cp, ne->n_name);
+ nptr->n_name = cp;
+ cp += n;
+
+ /* copy aliases */
+ nptr->n_aliases = (char **)ALIGN(buf);
+ for (i = 0 ; ne->n_aliases[i]; i++) {
+ n = strlen(ne->n_aliases[i]) + 1;
+ strcpy(cp, ne->n_aliases[i]);
+ nptr->n_aliases[i] = cp;
+ cp += n;
+ }
+ nptr->n_aliases[i] = NULL;
+
+ return (NET_R_OK);
+}
+#else /* !NETENT_DATA */
+static int
+copy_netent(struct netent *ne, struct netent *nptr, NET_R_COPY_ARGS) {
+ char *cp, *eob;
+ int i, n;
+
+ /* copy net value and type */
+ nptr->n_addrtype = ne->n_addrtype;
+ nptr->n_net = ne->n_net;
+
+ /* copy official name */
+ cp = ndptr->line;
+ eob = ndptr->line + sizeof(ndptr->line);
+ if ((n = strlen(ne->n_name) + 1) < (eob - cp)) {
+ strcpy(cp, ne->n_name);
+ nptr->n_name = cp;
+ cp += n;
+ } else {
+ return (-1);
+ }
+
+ /* copy aliases */
+ i = 0;
+ nptr->n_aliases = ndptr->net_aliases;
+ while (ne->n_aliases[i] && i < (_MAXALIASES-1)) {
+ if ((n = strlen(ne->n_aliases[i]) + 1) < (eob - cp)) {
+ strcpy(cp, ne->n_aliases[i]);
+ nptr->n_aliases[i] = cp;
+ cp += n;
+ } else {
+ break;
+ }
+ i++;
+ }
+ nptr->n_aliases[i] = NULL;
+
+ return (NET_R_OK);
+}
+#endif /* !NETENT_DATA */
+#else /* NET_R_RETURN */
+ static int getnetent_r_unknown_system = 0;
+#endif /* NET_R_RETURN */
+#endif /* !defined(_REENTRANT) || !defined(DO_PTHREADS) */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getnetgrent.c b/usr/src/lib/libresolv2_joy/common/irs/getnetgrent.c
new file mode 100644
index 0000000000..40b3e5a8ad
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getnetgrent.c
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1996-1999, 2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: getnetgrent.c,v 1.6 2008/11/14 02:36:51 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* Imports */
+
+#include "port_before.h"
+
+#if !defined(__BIND_NOSTATIC)
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_data.h"
+
+/* Forward */
+
+static struct net_data *init(void);
+
+
+/* Public */
+
+#ifndef SETNETGRENT_ARGS
+#define SETNETGRENT_ARGS const char *netgroup
+#endif
+void
+setnetgrent(SETNETGRENT_ARGS) {
+ struct net_data *net_data = init();
+
+ setnetgrent_p(netgroup, net_data);
+}
+
+void
+endnetgrent(void) {
+ struct net_data *net_data = init();
+
+ endnetgrent_p(net_data);
+}
+
+#ifndef INNETGR_ARGS
+#define INNETGR_ARGS const char *netgroup, const char *host, \
+ const char *user, const char *domain
+#endif
+int
+innetgr(INNETGR_ARGS) {
+ struct net_data *net_data = init();
+
+ return (innetgr_p(netgroup, host, user, domain, net_data));
+}
+
+int
+getnetgrent(NGR_R_CONST char **host, NGR_R_CONST char **user,
+ NGR_R_CONST char **domain)
+{
+ struct net_data *net_data = init();
+ const char *ch, *cu, *cd;
+ int ret;
+
+ ret = getnetgrent_p(&ch, &cu, &cd, net_data);
+ if (ret != 1)
+ return (ret);
+
+ DE_CONST(ch, *host);
+ DE_CONST(cu, *user);
+ DE_CONST(cd, *domain);
+ return (ret);
+}
+
+/* Shared private. */
+
+void
+setnetgrent_p(const char *netgroup, struct net_data *net_data) {
+ struct irs_ng *ng;
+
+ if ((net_data != NULL) && ((ng = net_data->ng) != NULL))
+ (*ng->rewind)(ng, netgroup);
+}
+
+void
+endnetgrent_p(struct net_data *net_data) {
+ struct irs_ng *ng;
+
+ if (!net_data)
+ return;
+ if ((ng = net_data->ng) != NULL)
+ (*ng->close)(ng);
+ net_data->ng = NULL;
+}
+
+int
+innetgr_p(const char *netgroup, const char *host,
+ const char *user, const char *domain,
+ struct net_data *net_data) {
+ struct irs_ng *ng;
+
+ if (!net_data || !(ng = net_data->ng))
+ return (0);
+ return ((*ng->test)(ng, netgroup, host, user, domain));
+}
+
+int
+getnetgrent_p(const char **host, const char **user, const char **domain,
+ struct net_data *net_data ) {
+ struct irs_ng *ng;
+
+ if (!net_data || !(ng = net_data->ng))
+ return (0);
+ return ((*ng->next)(ng, host, user, domain));
+}
+
+/* Private */
+
+static struct net_data *
+init(void) {
+ struct net_data *net_data;
+
+ if (!(net_data = net_data_init(NULL)))
+ goto error;
+ if (!net_data->ng) {
+ net_data->ng = (*net_data->irs->ng_map)(net_data->irs);
+ if (!net_data->ng) {
+ error:
+ errno = EIO;
+ return (NULL);
+ }
+ }
+
+ return (net_data);
+}
+
+#endif /*__BIND_NOSTATIC*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getnetgrent_r.c b/usr/src/lib/libresolv2_joy/common/irs/getnetgrent_r.c
new file mode 100644
index 0000000000..aa8810320d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getnetgrent_r.c
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1998, 1999, 2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.14 2008/11/14 02:36:51 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <port_before.h>
+#if !defined(_REENTRANT) || !defined(DO_PTHREADS)
+ static int getnetgrent_r_not_required = 0;
+#else
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <stdlib.h>
+#include <port_after.h>
+
+#ifdef NGR_R_RETURN
+#ifndef NGR_R_PRIVATE
+#define NGR_R_PRIVATE 0
+#endif
+
+static NGR_R_RETURN
+copy_protoent(NGR_R_CONST char **, NGR_R_CONST char **, NGR_R_CONST char **,
+ const char *, const char *, const char *, NGR_R_COPY_ARGS);
+
+NGR_R_RETURN
+innetgr_r(const char *netgroup, const char *host, const char *user,
+ const char *domain) {
+ char *ng, *ho, *us, *dom;
+
+ DE_CONST(netgroup, ng);
+ DE_CONST(host, ho);
+ DE_CONST(user, us);
+ DE_CONST(domain, dom);
+
+ return (innetgr(ng, ho, us, dom));
+}
+
+/*%
+ * These assume a single context is in operation per thread.
+ * If this is not the case we will need to call irs directly
+ * rather than through the base functions.
+ */
+
+NGR_R_RETURN
+getnetgrent_r(NGR_R_CONST char **machinep, NGR_R_CONST char **userp,
+ NGR_R_CONST char **domainp, NGR_R_ARGS)
+{
+ NGR_R_CONST char *mp, *up, *dp;
+ int res = getnetgrent(&mp, &up, &dp);
+
+ if (res != 1)
+ return (res);
+
+ return (copy_protoent(machinep, userp, domainp,
+ mp, up, dp, NGR_R_COPY));
+}
+
+#if NGR_R_PRIVATE == 2
+struct private {
+ char *buf;
+};
+
+#endif
+NGR_R_SET_RETURN
+#ifdef NGR_R_SET_ARGS
+setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS)
+#else
+setnetgrent_r(NGR_R_SET_CONST char *netgroup)
+#endif
+{
+#if NGR_R_PRIVATE == 2
+ struct private *p;
+#endif
+ char *tmp;
+#if defined(NGR_R_SET_ARGS) && NGR_R_PRIVATE == 0
+ UNUSED(buf);
+ UNUSED(buflen);
+#endif
+
+ DE_CONST(netgroup, tmp);
+ setnetgrent(tmp);
+
+#if NGR_R_PRIVATE == 1
+ *buf = NULL;
+#elif NGR_R_PRIVATE == 2
+ *buf = p = malloc(sizeof(struct private));
+ if (p == NULL)
+#ifdef NGR_R_SET_RESULT
+ return (NGR_R_BAD);
+#else
+ return;
+#endif
+ p->buf = NULL;
+#endif
+#ifdef NGR_R_SET_RESULT
+ return (NGR_R_SET_RESULT);
+#endif
+}
+
+NGR_R_END_RETURN
+#ifdef NGR_R_END_ARGS
+endnetgrent_r(NGR_R_END_ARGS)
+#else
+endnetgrent_r(void)
+#endif
+{
+#if NGR_R_PRIVATE == 2
+ struct private *p = buf;
+#endif
+#if defined(NGR_R_SET_ARGS) && NGR_R_PRIVATE == 0
+ UNUSED(buf);
+ UNUSED(buflen);
+#endif
+
+ endnetgrent();
+#if NGR_R_PRIVATE == 1
+ if (*buf != NULL)
+ free(*buf);
+ *buf = NULL;
+#elif NGR_R_PRIVATE == 2
+ if (p->buf != NULL)
+ free(p->buf);
+ free(p);
+#endif
+ NGR_R_END_RESULT(NGR_R_OK);
+}
+
+/* Private */
+
+static int
+copy_protoent(NGR_R_CONST char **machinep, NGR_R_CONST char **userp,
+ NGR_R_CONST char **domainp, const char *mp, const char *up,
+ const char *dp, NGR_R_COPY_ARGS)
+{
+#if NGR_R_PRIVATE == 2
+ struct private *p = buf;
+#endif
+ char *cp;
+ int n;
+ int len;
+
+ /* Find out the amount of space required to store the answer. */
+ len = 0;
+ if (mp != NULL) len += strlen(mp) + 1;
+ if (up != NULL) len += strlen(up) + 1;
+ if (dp != NULL) len += strlen(dp) + 1;
+
+#if NGR_R_PRIVATE == 1
+ if (*buf != NULL)
+ free(*buf);
+ *buf = malloc(len);
+ if (*buf == NULL)
+ return(NGR_R_BAD);
+ cp = *buf;
+#elif NGR_R_PRIVATE == 2
+ if (p->buf)
+ free(p->buf);
+ p->buf = malloc(len);
+ if (p->buf == NULL)
+ return(NGR_R_BAD);
+ cp = p->buf;
+#else
+ if (len > (int)buflen) {
+ errno = ERANGE;
+ return (NGR_R_BAD);
+ }
+ cp = buf;
+#endif
+
+ if (mp != NULL) {
+ n = strlen(mp) + 1;
+ strcpy(cp, mp);
+ *machinep = cp;
+ cp += n;
+ } else
+ *machinep = NULL;
+
+ if (up != NULL) {
+ n = strlen(up) + 1;
+ strcpy(cp, up);
+ *userp = cp;
+ cp += n;
+ } else
+ *userp = NULL;
+
+ if (dp != NULL) {
+ n = strlen(dp) + 1;
+ strcpy(cp, dp);
+ *domainp = cp;
+ cp += n;
+ } else
+ *domainp = NULL;
+
+ return (NGR_R_OK);
+}
+#else /* NGR_R_RETURN */
+ static int getnetgrent_r_unknown_system = 0;
+#endif /* NGR_R_RETURN */
+#endif /* !defined(_REENTRANT) || !defined(DO_PTHREADS) */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getprotoent.c b/usr/src/lib/libresolv2_joy/common/irs/getprotoent.c
new file mode 100644
index 0000000000..32a1040916
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getprotoent.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: getprotoent.c,v 1.4 2005/04/27 04:56:26 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#if !defined(__BIND_NOSTATIC)
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_data.h"
+
+/* Forward */
+
+static struct net_data *init(void);
+
+/* Public */
+
+struct protoent *
+getprotoent() {
+ struct net_data *net_data = init();
+
+ return (getprotoent_p(net_data));
+}
+
+struct protoent *
+getprotobyname(const char *name) {
+ struct net_data *net_data = init();
+
+ return (getprotobyname_p(name, net_data));
+}
+
+struct protoent *
+getprotobynumber(int proto) {
+ struct net_data *net_data = init();
+
+ return (getprotobynumber_p(proto, net_data));
+}
+
+void
+setprotoent(int stayopen) {
+ struct net_data *net_data = init();
+
+ setprotoent_p(stayopen, net_data);
+}
+
+void
+endprotoent() {
+ struct net_data *net_data = init();
+
+ endprotoent_p(net_data);
+}
+
+/* Shared private. */
+
+struct protoent *
+getprotoent_p(struct net_data *net_data) {
+ struct irs_pr *pr;
+
+ if (!net_data || !(pr = net_data->pr))
+ return (NULL);
+ net_data->pr_last = (*pr->next)(pr);
+ return (net_data->pr_last);
+}
+
+struct protoent *
+getprotobyname_p(const char *name, struct net_data *net_data) {
+ struct irs_pr *pr;
+ char **pap;
+
+ if (!net_data || !(pr = net_data->pr))
+ return (NULL);
+ if (net_data->pr_stayopen && net_data->pr_last) {
+ if (!strcmp(net_data->pr_last->p_name, name))
+ return (net_data->pr_last);
+ for (pap = net_data->pr_last->p_aliases; pap && *pap; pap++)
+ if (!strcmp(name, *pap))
+ return (net_data->pr_last);
+ }
+ net_data->pr_last = (*pr->byname)(pr, name);
+ if (!net_data->pr_stayopen)
+ endprotoent();
+ return (net_data->pr_last);
+}
+
+struct protoent *
+getprotobynumber_p(int proto, struct net_data *net_data) {
+ struct irs_pr *pr;
+
+ if (!net_data || !(pr = net_data->pr))
+ return (NULL);
+ if (net_data->pr_stayopen && net_data->pr_last)
+ if (net_data->pr_last->p_proto == proto)
+ return (net_data->pr_last);
+ net_data->pr_last = (*pr->bynumber)(pr, proto);
+ if (!net_data->pr_stayopen)
+ endprotoent();
+ return (net_data->pr_last);
+}
+
+void
+setprotoent_p(int stayopen, struct net_data *net_data) {
+ struct irs_pr *pr;
+
+ if (!net_data || !(pr = net_data->pr))
+ return;
+ (*pr->rewind)(pr);
+ net_data->pr_stayopen = (stayopen != 0);
+ if (stayopen == 0)
+ net_data_minimize(net_data);
+}
+
+void
+endprotoent_p(struct net_data *net_data) {
+ struct irs_pr *pr;
+
+ if ((net_data != NULL) && ((pr = net_data->pr) != NULL))
+ (*pr->minimize)(pr);
+}
+
+/* Private */
+
+static struct net_data *
+init() {
+ struct net_data *net_data;
+
+ if (!(net_data = net_data_init(NULL)))
+ goto error;
+ if (!net_data->pr) {
+ net_data->pr = (*net_data->irs->pr_map)(net_data->irs);
+
+ if (!net_data->pr || !net_data->res) {
+ error:
+ errno = EIO;
+ return (NULL);
+ }
+ (*net_data->pr->res_set)(net_data->pr, net_data->res, NULL);
+ }
+
+ return (net_data);
+}
+
+#endif /*__BIND_NOSTATIC*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getprotoent_r.c b/usr/src/lib/libresolv2_joy/common/irs/getprotoent_r.c
new file mode 100644
index 0000000000..d5d9ae53b6
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getprotoent_r.c
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: getprotoent_r.c,v 1.6 2006/08/01 01:14:16 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <port_before.h>
+#if !defined(_REENTRANT) || !defined(DO_PTHREADS)
+ static int getprotoent_r_not_required = 0;
+#else
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <port_after.h>
+
+#ifdef PROTO_R_RETURN
+
+static PROTO_R_RETURN
+copy_protoent(struct protoent *, struct protoent *, PROTO_R_COPY_ARGS);
+
+PROTO_R_RETURN
+getprotobyname_r(const char *name, struct protoent *pptr, PROTO_R_ARGS) {
+ struct protoent *pe = getprotobyname(name);
+#ifdef PROTO_R_SETANSWER
+ int n = 0;
+
+ if (pe == NULL || (n = copy_protoent(pe, pptr, PROTO_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = pptr;
+
+ return (n);
+#else
+ if (pe == NULL)
+ return (PROTO_R_BAD);
+
+ return (copy_protoent(pe, pptr, PROTO_R_COPY));
+#endif
+}
+
+PROTO_R_RETURN
+getprotobynumber_r(int proto, struct protoent *pptr, PROTO_R_ARGS) {
+ struct protoent *pe = getprotobynumber(proto);
+#ifdef PROTO_R_SETANSWER
+ int n = 0;
+
+ if (pe == NULL || (n = copy_protoent(pe, pptr, PROTO_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = pptr;
+
+ return (n);
+#else
+ if (pe == NULL)
+ return (PROTO_R_BAD);
+
+ return (copy_protoent(pe, pptr, PROTO_R_COPY));
+#endif
+}
+
+/*%
+ * These assume a single context is in operation per thread.
+ * If this is not the case we will need to call irs directly
+ * rather than through the base functions.
+ */
+
+PROTO_R_RETURN
+getprotoent_r(struct protoent *pptr, PROTO_R_ARGS) {
+ struct protoent *pe = getprotoent();
+#ifdef PROTO_R_SETANSWER
+ int n = 0;
+
+ if (pe == NULL || (n = copy_protoent(pe, pptr, PROTO_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = pptr;
+
+ return (n);
+#else
+ if (pe == NULL)
+ return (PROTO_R_BAD);
+
+ return (copy_protoent(pe, pptr, PROTO_R_COPY));
+#endif
+}
+
+PROTO_R_SET_RETURN
+#ifdef PROTO_R_ENT_ARGS
+setprotoent_r(int stay_open, PROTO_R_ENT_ARGS)
+#else
+setprotoent_r(int stay_open)
+#endif
+{
+#ifdef PROTO_R_ENT_UNUSED
+ PROTO_R_ENT_UNUSED;
+#endif
+ setprotoent(stay_open);
+#ifdef PROTO_R_SET_RESULT
+ return (PROTO_R_SET_RESULT);
+#endif
+}
+
+PROTO_R_END_RETURN
+#ifdef PROTO_R_ENT_ARGS
+endprotoent_r(PROTO_R_ENT_ARGS)
+#else
+endprotoent_r()
+#endif
+{
+#ifdef PROTO_R_ENT_UNUSED
+ PROTO_R_ENT_UNUSED;
+#endif
+ endprotoent();
+ PROTO_R_END_RESULT(PROTO_R_OK);
+}
+
+/* Private */
+
+#ifndef PROTOENT_DATA
+static PROTO_R_RETURN
+copy_protoent(struct protoent *pe, struct protoent *pptr, PROTO_R_COPY_ARGS) {
+ char *cp;
+ int i, n;
+ int numptr, len;
+
+ /* Find out the amount of space required to store the answer. */
+ numptr = 1; /*%< NULL ptr */
+ len = (char *)ALIGN(buf) - buf;
+ for (i = 0; pe->p_aliases[i]; i++, numptr++) {
+ len += strlen(pe->p_aliases[i]) + 1;
+ }
+ len += strlen(pe->p_name) + 1;
+ len += numptr * sizeof(char*);
+
+ if (len > (int)buflen) {
+ errno = ERANGE;
+ return (PROTO_R_BAD);
+ }
+
+ /* copy protocol value*/
+ pptr->p_proto = pe->p_proto;
+
+ cp = (char *)ALIGN(buf) + numptr * sizeof(char *);
+
+ /* copy official name */
+ n = strlen(pe->p_name) + 1;
+ strcpy(cp, pe->p_name);
+ pptr->p_name = cp;
+ cp += n;
+
+ /* copy aliases */
+ pptr->p_aliases = (char **)ALIGN(buf);
+ for (i = 0 ; pe->p_aliases[i]; i++) {
+ n = strlen(pe->p_aliases[i]) + 1;
+ strcpy(cp, pe->p_aliases[i]);
+ pptr->p_aliases[i] = cp;
+ cp += n;
+ }
+ pptr->p_aliases[i] = NULL;
+
+ return (PROTO_R_OK);
+}
+#else /* !PROTOENT_DATA */
+static int
+copy_protoent(struct protoent *pe, struct protoent *pptr, PROTO_R_COPY_ARGS) {
+ char *cp, *eob;
+ int i, n;
+
+ /* copy protocol value */
+ pptr->p_proto = pe->p_proto;
+
+ /* copy official name */
+ cp = pdptr->line;
+ eob = pdptr->line + sizeof(pdptr->line);
+ if ((n = strlen(pe->p_name) + 1) < (eob - cp)) {
+ strcpy(cp, pe->p_name);
+ pptr->p_name = cp;
+ cp += n;
+ } else {
+ return (-1);
+ }
+
+ /* copy aliases */
+ i = 0;
+ pptr->p_aliases = pdptr->proto_aliases;
+ while (pe->p_aliases[i] && i < (_MAXALIASES-1)) {
+ if ((n = strlen(pe->p_aliases[i]) + 1) < (eob - cp)) {
+ strcpy(cp, pe->p_aliases[i]);
+ pptr->p_aliases[i] = cp;
+ cp += n;
+ } else {
+ break;
+ }
+ i++;
+ }
+ pptr->p_aliases[i] = NULL;
+
+ return (PROTO_R_OK);
+}
+#endif /* PROTOENT_DATA */
+#else /* PROTO_R_RETURN */
+ static int getprotoent_r_unknown_system = 0;
+#endif /* PROTO_R_RETURN */
+#endif /* !defined(_REENTRANT) || !defined(DO_PTHREADS) */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getservent.c b/usr/src/lib/libresolv2_joy/common/irs/getservent.c
new file mode 100644
index 0000000000..31af67e659
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getservent.c
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: getservent.c,v 1.4 2005/04/27 04:56:26 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#if !defined(__BIND_NOSTATIC)
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_data.h"
+
+/* Forward */
+
+static struct net_data *init(void);
+
+/* Public */
+
+struct servent *
+getservent(void) {
+ struct net_data *net_data = init();
+
+ return (getservent_p(net_data));
+}
+
+struct servent *
+getservbyname(const char *name, const char *proto) {
+ struct net_data *net_data = init();
+
+ return (getservbyname_p(name, proto, net_data));
+}
+
+struct servent *
+getservbyport(int port, const char *proto) {
+ struct net_data *net_data = init();
+
+ return (getservbyport_p(port, proto, net_data));
+}
+
+void
+setservent(int stayopen) {
+ struct net_data *net_data = init();
+
+ setservent_p(stayopen, net_data);
+}
+
+void
+endservent() {
+ struct net_data *net_data = init();
+
+ endservent_p(net_data);
+}
+
+/* Shared private. */
+
+struct servent *
+getservent_p(struct net_data *net_data) {
+ struct irs_sv *sv;
+
+ if (!net_data || !(sv = net_data->sv))
+ return (NULL);
+ net_data->sv_last = (*sv->next)(sv);
+ return (net_data->sv_last);
+}
+
+struct servent *
+getservbyname_p(const char *name, const char *proto,
+ struct net_data *net_data) {
+ struct irs_sv *sv;
+ char **sap;
+
+ if (!net_data || !(sv = net_data->sv))
+ return (NULL);
+ if (net_data->sv_stayopen && net_data->sv_last)
+ if (!proto || !strcmp(net_data->sv_last->s_proto, proto)) {
+ if (!strcmp(net_data->sv_last->s_name, name))
+ return (net_data->sv_last);
+ for (sap = net_data->sv_last->s_aliases;
+ sap && *sap; sap++)
+ if (!strcmp(name, *sap))
+ return (net_data->sv_last);
+ }
+ net_data->sv_last = (*sv->byname)(sv, name, proto);
+ if (!net_data->sv_stayopen)
+ endservent();
+ return (net_data->sv_last);
+}
+
+struct servent *
+getservbyport_p(int port, const char *proto, struct net_data *net_data) {
+ struct irs_sv *sv;
+
+ if (!net_data || !(sv = net_data->sv))
+ return (NULL);
+ if (net_data->sv_stayopen && net_data->sv_last)
+ if (port == net_data->sv_last->s_port &&
+ ( !proto ||
+ !strcmp(net_data->sv_last->s_proto, proto)))
+ return (net_data->sv_last);
+ net_data->sv_last = (*sv->byport)(sv, port, proto);
+ return (net_data->sv_last);
+}
+
+void
+setservent_p(int stayopen, struct net_data *net_data) {
+ struct irs_sv *sv;
+
+ if (!net_data || !(sv = net_data->sv))
+ return;
+ (*sv->rewind)(sv);
+ net_data->sv_stayopen = (stayopen != 0);
+ if (stayopen == 0)
+ net_data_minimize(net_data);
+}
+
+void
+endservent_p(struct net_data *net_data) {
+ struct irs_sv *sv;
+
+ if ((net_data != NULL) && ((sv = net_data->sv) != NULL))
+ (*sv->minimize)(sv);
+}
+
+/* Private */
+
+static struct net_data *
+init() {
+ struct net_data *net_data;
+
+ if (!(net_data = net_data_init(NULL)))
+ goto error;
+ if (!net_data->sv) {
+ net_data->sv = (*net_data->irs->sv_map)(net_data->irs);
+
+ if (!net_data->sv || !net_data->res) {
+ error:
+ errno = EIO;
+ return (NULL);
+ }
+ (*net_data->sv->res_set)(net_data->sv, net_data->res, NULL);
+ }
+
+ return (net_data);
+}
+
+#endif /*__BIND_NOSTATIC*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/getservent_r.c b/usr/src/lib/libresolv2_joy/common/irs/getservent_r.c
new file mode 100644
index 0000000000..42d1e46163
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/getservent_r.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: getservent_r.c,v 1.6 2006/08/01 01:14:16 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <port_before.h>
+#if !defined(_REENTRANT) || !defined(DO_PTHREADS)
+ static int getservent_r_not_required = 0;
+#else
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/param.h>
+#include <port_after.h>
+
+#ifdef SERV_R_RETURN
+
+static SERV_R_RETURN
+copy_servent(struct servent *, struct servent *, SERV_R_COPY_ARGS);
+
+SERV_R_RETURN
+getservbyname_r(const char *name, const char *proto,
+ struct servent *sptr, SERV_R_ARGS) {
+ struct servent *se = getservbyname(name, proto);
+#ifdef SERV_R_SETANSWER
+ int n = 0;
+
+ if (se == NULL || (n = copy_servent(se, sptr, SERV_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = sptr;
+
+ return (n);
+#else
+ if (se == NULL)
+ return (SERV_R_BAD);
+
+ return (copy_servent(se, sptr, SERV_R_COPY));
+#endif
+}
+
+SERV_R_RETURN
+getservbyport_r(int port, const char *proto,
+ struct servent *sptr, SERV_R_ARGS) {
+ struct servent *se = getservbyport(port, proto);
+#ifdef SERV_R_SETANSWER
+ int n = 0;
+
+ if (se == NULL || (n = copy_servent(se, sptr, SERV_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = sptr;
+
+ return (n);
+#else
+ if (se == NULL)
+ return (SERV_R_BAD);
+
+ return (copy_servent(se, sptr, SERV_R_COPY));
+#endif
+}
+
+/*%
+ * These assume a single context is in operation per thread.
+ * If this is not the case we will need to call irs directly
+ * rather than through the base functions.
+ */
+
+SERV_R_RETURN
+getservent_r(struct servent *sptr, SERV_R_ARGS) {
+ struct servent *se = getservent();
+#ifdef SERV_R_SETANSWER
+ int n = 0;
+
+ if (se == NULL || (n = copy_servent(se, sptr, SERV_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = sptr;
+
+ return (n);
+#else
+ if (se == NULL)
+ return (SERV_R_BAD);
+
+ return (copy_servent(se, sptr, SERV_R_COPY));
+#endif
+}
+
+SERV_R_SET_RETURN
+#ifdef SERV_R_ENT_ARGS
+setservent_r(int stay_open, SERV_R_ENT_ARGS)
+#else
+setservent_r(int stay_open)
+#endif
+{
+#ifdef SERV_R_ENT_UNUSED
+ SERV_R_ENT_UNUSED;
+#endif
+ setservent(stay_open);
+#ifdef SERV_R_SET_RESULT
+ return (SERV_R_SET_RESULT);
+#endif
+}
+
+SERV_R_END_RETURN
+#ifdef SERV_R_ENT_ARGS
+endservent_r(SERV_R_ENT_ARGS)
+#else
+endservent_r()
+#endif
+{
+#ifdef SERV_R_ENT_UNUSED
+ SERV_R_ENT_UNUSED;
+#endif
+ endservent();
+ SERV_R_END_RESULT(SERV_R_OK);
+}
+
+/* Private */
+
+#ifndef SERVENT_DATA
+static SERV_R_RETURN
+copy_servent(struct servent *se, struct servent *sptr, SERV_R_COPY_ARGS) {
+ char *cp;
+ int i, n;
+ int numptr, len;
+
+ /* Find out the amount of space required to store the answer. */
+ numptr = 1; /*%< NULL ptr */
+ len = (char *)ALIGN(buf) - buf;
+ for (i = 0; se->s_aliases[i]; i++, numptr++) {
+ len += strlen(se->s_aliases[i]) + 1;
+ }
+ len += strlen(se->s_name) + 1;
+ len += strlen(se->s_proto) + 1;
+ len += numptr * sizeof(char*);
+
+ if (len > (int)buflen) {
+ errno = ERANGE;
+ return (SERV_R_BAD);
+ }
+
+ /* copy port value */
+ sptr->s_port = se->s_port;
+
+ cp = (char *)ALIGN(buf) + numptr * sizeof(char *);
+
+ /* copy official name */
+ n = strlen(se->s_name) + 1;
+ strcpy(cp, se->s_name);
+ sptr->s_name = cp;
+ cp += n;
+
+ /* copy aliases */
+ sptr->s_aliases = (char **)ALIGN(buf);
+ for (i = 0 ; se->s_aliases[i]; i++) {
+ n = strlen(se->s_aliases[i]) + 1;
+ strcpy(cp, se->s_aliases[i]);
+ sptr->s_aliases[i] = cp;
+ cp += n;
+ }
+ sptr->s_aliases[i] = NULL;
+
+ /* copy proto */
+ n = strlen(se->s_proto) + 1;
+ strcpy(cp, se->s_proto);
+ sptr->s_proto = cp;
+ cp += n;
+
+ return (SERV_R_OK);
+}
+#else /* !SERVENT_DATA */
+static int
+copy_servent(struct servent *se, struct servent *sptr, SERV_R_COPY_ARGS) {
+ char *cp, *eob;
+ int i, n;
+
+ /* copy port value */
+ sptr->s_port = se->s_port;
+
+ /* copy official name */
+ cp = sdptr->line;
+ eob = sdptr->line + sizeof(sdptr->line);
+ if ((n = strlen(se->s_name) + 1) < (eob - cp)) {
+ strcpy(cp, se->s_name);
+ sptr->s_name = cp;
+ cp += n;
+ } else {
+ return (-1);
+ }
+
+ /* copy aliases */
+ i = 0;
+ sptr->s_aliases = sdptr->serv_aliases;
+ while (se->s_aliases[i] && i < (_MAXALIASES-1)) {
+ if ((n = strlen(se->s_aliases[i]) + 1) < (eob - cp)) {
+ strcpy(cp, se->s_aliases[i]);
+ sptr->s_aliases[i] = cp;
+ cp += n;
+ } else {
+ break;
+ }
+ i++;
+ }
+ sptr->s_aliases[i] = NULL;
+
+ /* copy proto */
+ if ((n = strlen(se->s_proto) + 1) < (eob - cp)) {
+ strcpy(cp, se->s_proto);
+ sptr->s_proto = cp;
+ cp += n;
+ } else {
+ return (-1);
+ }
+
+ return (SERV_R_OK);
+}
+#endif /* !SERVENT_DATA */
+#else /*SERV_R_RETURN */
+ static int getservent_r_unknown_system = 0;
+#endif /*SERV_R_RETURN */
+#endif /* !defined(_REENTRANT) || !defined(DO_PTHREADS) */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/hesiod.c b/usr/src/lib/libresolv2_joy/common/irs/hesiod.c
new file mode 100644
index 0000000000..7641bf80ac
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/hesiod.c
@@ -0,0 +1,505 @@
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: hesiod.c,v 1.7 2005/07/28 06:51:48 marka Exp $";
+#endif
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/*! \file
+ * \brief
+ * hesiod.c --- the core portion of the hesiod resolver.
+ *
+ * This file is derived from the hesiod library from Project Athena;
+ * It has been extensively rewritten by Theodore Ts'o to have a more
+ * thread-safe interface.
+ * \author
+ * This file is primarily maintained by &lt;tytso@mit.edu&gt; and &lt;ghudson@mit.edu&gt;.
+ */
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "port_after.h"
+
+#include "pathnames.h"
+#include "hesiod.h"
+#include "hesiod_p.h"
+
+/* Forward */
+
+int hesiod_init(void **context);
+void hesiod_end(void *context);
+char * hesiod_to_bind(void *context, const char *name,
+ const char *type);
+char ** hesiod_resolve(void *context, const char *name,
+ const char *type);
+void hesiod_free_list(void *context, char **list);
+
+static int parse_config_file(struct hesiod_p *ctx, const char *filename);
+static char ** get_txt_records(struct hesiod_p *ctx, int class,
+ const char *name);
+static int init(struct hesiod_p *ctx);
+
+/* Public */
+
+/*%
+ * This function is called to initialize a hesiod_p.
+ */
+int
+hesiod_init(void **context) {
+ struct hesiod_p *ctx;
+ char *cp;
+
+ ctx = malloc(sizeof(struct hesiod_p));
+ if (ctx == 0) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ memset(ctx, 0, sizeof (*ctx));
+
+ if (parse_config_file(ctx, _PATH_HESIOD_CONF) < 0) {
+#ifdef DEF_RHS
+ /*
+ * Use compiled in defaults.
+ */
+ ctx->LHS = malloc(strlen(DEF_LHS) + 1);
+ ctx->RHS = malloc(strlen(DEF_RHS) + 1);
+ if (ctx->LHS == NULL || ctx->RHS == NULL) {
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ strcpy(ctx->LHS, DEF_LHS); /* (checked) */
+ strcpy(ctx->RHS, DEF_RHS); /* (checked) */
+#else
+ goto cleanup;
+#endif
+ }
+ /*
+ * The default RHS can be overridden by an environment
+ * variable.
+ */
+ if ((cp = getenv("HES_DOMAIN")) != NULL) {
+ size_t RHSlen = strlen(cp) + 2;
+ if (ctx->RHS)
+ free(ctx->RHS);
+ ctx->RHS = malloc(RHSlen);
+ if (!ctx->RHS) {
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ if (cp[0] == '.') {
+ strcpy(ctx->RHS, cp); /* (checked) */
+ } else {
+ strcpy(ctx->RHS, "."); /* (checked) */
+ strcat(ctx->RHS, cp); /* (checked) */
+ }
+ }
+
+ /*
+ * If there is no default hesiod realm set, we return an
+ * error.
+ */
+ if (!ctx->RHS) {
+ errno = ENOEXEC;
+ goto cleanup;
+ }
+
+#if 0
+ if (res_ninit(ctx->res) < 0)
+ goto cleanup;
+#endif
+
+ *context = ctx;
+ return (0);
+
+ cleanup:
+ hesiod_end(ctx);
+ return (-1);
+}
+
+/*%
+ * This function deallocates the hesiod_p
+ */
+void
+hesiod_end(void *context) {
+ struct hesiod_p *ctx = (struct hesiod_p *) context;
+ int save_errno = errno;
+
+ if (ctx->res)
+ res_nclose(ctx->res);
+ if (ctx->RHS)
+ free(ctx->RHS);
+ if (ctx->LHS)
+ free(ctx->LHS);
+ if (ctx->res && ctx->free_res)
+ (*ctx->free_res)(ctx->res);
+ free(ctx);
+ errno = save_errno;
+}
+
+/*%
+ * This function takes a hesiod (name, type) and returns a DNS
+ * name which is to be resolved.
+ */
+char *
+hesiod_to_bind(void *context, const char *name, const char *type) {
+ struct hesiod_p *ctx = (struct hesiod_p *) context;
+ char *bindname;
+ char **rhs_list = NULL;
+ const char *RHS, *cp;
+
+ /* Decide what our RHS is, and set cp to the end of the actual name. */
+ if ((cp = strchr(name, '@')) != NULL) {
+ if (strchr(cp + 1, '.'))
+ RHS = cp + 1;
+ else if ((rhs_list = hesiod_resolve(context, cp + 1,
+ "rhs-extension")) != NULL)
+ RHS = *rhs_list;
+ else {
+ errno = ENOENT;
+ return (NULL);
+ }
+ } else {
+ RHS = ctx->RHS;
+ cp = name + strlen(name);
+ }
+
+ /*
+ * Allocate the space we need, including up to three periods and
+ * the terminating NUL.
+ */
+ if ((bindname = malloc((cp - name) + strlen(type) + strlen(RHS) +
+ (ctx->LHS ? strlen(ctx->LHS) : 0) + 4)) == NULL) {
+ errno = ENOMEM;
+ if (rhs_list)
+ hesiod_free_list(context, rhs_list);
+ return NULL;
+ }
+
+ /* Now put together the DNS name. */
+ memcpy(bindname, name, cp - name);
+ bindname[cp - name] = '\0';
+ strcat(bindname, ".");
+ strcat(bindname, type);
+ if (ctx->LHS) {
+ if (ctx->LHS[0] != '.')
+ strcat(bindname, ".");
+ strcat(bindname, ctx->LHS);
+ }
+ if (RHS[0] != '.')
+ strcat(bindname, ".");
+ strcat(bindname, RHS);
+
+ if (rhs_list)
+ hesiod_free_list(context, rhs_list);
+
+ return (bindname);
+}
+
+/*%
+ * This is the core function. Given a hesiod (name, type), it
+ * returns an array of strings returned by the resolver.
+ */
+char **
+hesiod_resolve(void *context, const char *name, const char *type) {
+ struct hesiod_p *ctx = (struct hesiod_p *) context;
+ char *bindname = hesiod_to_bind(context, name, type);
+ char **retvec;
+
+ if (bindname == NULL)
+ return (NULL);
+ if (init(ctx) == -1) {
+ free(bindname);
+ return (NULL);
+ }
+
+ if ((retvec = get_txt_records(ctx, C_IN, bindname))) {
+ free(bindname);
+ return (retvec);
+ }
+
+ if (errno != ENOENT)
+ return (NULL);
+
+ retvec = get_txt_records(ctx, C_HS, bindname);
+ free(bindname);
+ return (retvec);
+}
+
+void
+hesiod_free_list(void *context, char **list) {
+ char **p;
+
+ UNUSED(context);
+
+ for (p = list; *p; p++)
+ free(*p);
+ free(list);
+}
+
+/*%
+ * This function parses the /etc/hesiod.conf file
+ */
+static int
+parse_config_file(struct hesiod_p *ctx, const char *filename) {
+ char *key, *data, *cp, **cpp;
+ char buf[MAXDNAME+7];
+ FILE *fp;
+
+ /*
+ * Clear the existing configuration variable, just in case
+ * they're set.
+ */
+ if (ctx->RHS)
+ free(ctx->RHS);
+ if (ctx->LHS)
+ free(ctx->LHS);
+ ctx->RHS = ctx->LHS = 0;
+
+ /*
+ * Now open and parse the file...
+ */
+ if (!(fp = fopen(filename, "r")))
+ return (-1);
+
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ cp = buf;
+ if (*cp == '#' || *cp == '\n' || *cp == '\r')
+ continue;
+ while(*cp == ' ' || *cp == '\t')
+ cp++;
+ key = cp;
+ while(*cp != ' ' && *cp != '\t' && *cp != '=')
+ cp++;
+ *cp++ = '\0';
+
+ while(*cp == ' ' || *cp == '\t' || *cp == '=')
+ cp++;
+ data = cp;
+ while(*cp != ' ' && *cp != '\n' && *cp != '\r')
+ cp++;
+ *cp++ = '\0';
+
+ if (strcmp(key, "lhs") == 0)
+ cpp = &ctx->LHS;
+ else if (strcmp(key, "rhs") == 0)
+ cpp = &ctx->RHS;
+ else
+ continue;
+
+ *cpp = malloc(strlen(data) + 1);
+ if (!*cpp) {
+ errno = ENOMEM;
+ goto cleanup;
+ }
+ strcpy(*cpp, data);
+ }
+ fclose(fp);
+ return (0);
+
+ cleanup:
+ fclose(fp);
+ if (ctx->RHS)
+ free(ctx->RHS);
+ if (ctx->LHS)
+ free(ctx->LHS);
+ ctx->RHS = ctx->LHS = 0;
+ return (-1);
+}
+
+/*%
+ * Given a DNS class and a DNS name, do a lookup for TXT records, and
+ * return a list of them.
+ */
+static char **
+get_txt_records(struct hesiod_p *ctx, int class, const char *name) {
+ struct {
+ int type; /*%< RR type */
+ int class; /*%< RR class */
+ int dlen; /*%< len of data section */
+ u_char *data; /*%< pointer to data */
+ } rr;
+ HEADER *hp;
+ u_char qbuf[MAX_HESRESP], abuf[MAX_HESRESP];
+ u_char *cp, *erdata, *eom;
+ char *dst, *edst, **list;
+ int ancount, qdcount;
+ int i, j, n, skip;
+
+ /*
+ * Construct the query and send it.
+ */
+ n = res_nmkquery(ctx->res, QUERY, name, class, T_TXT, NULL, 0,
+ NULL, qbuf, MAX_HESRESP);
+ if (n < 0) {
+ errno = EMSGSIZE;
+ return (NULL);
+ }
+ n = res_nsend(ctx->res, qbuf, n, abuf, MAX_HESRESP);
+ if (n < 0) {
+ errno = ECONNREFUSED;
+ return (NULL);
+ }
+ if (n < HFIXEDSZ) {
+ errno = EMSGSIZE;
+ return (NULL);
+ }
+
+ /*
+ * OK, parse the result.
+ */
+ hp = (HEADER *) abuf;
+ ancount = ntohs(hp->ancount);
+ qdcount = ntohs(hp->qdcount);
+ cp = abuf + sizeof(HEADER);
+ eom = abuf + n;
+
+ /* Skip query, trying to get to the answer section which follows. */
+ for (i = 0; i < qdcount; i++) {
+ skip = dn_skipname(cp, eom);
+ if (skip < 0 || cp + skip + QFIXEDSZ > eom) {
+ errno = EMSGSIZE;
+ return (NULL);
+ }
+ cp += skip + QFIXEDSZ;
+ }
+
+ list = malloc((ancount + 1) * sizeof(char *));
+ if (!list) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ j = 0;
+ for (i = 0; i < ancount; i++) {
+ skip = dn_skipname(cp, eom);
+ if (skip < 0) {
+ errno = EMSGSIZE;
+ goto cleanup;
+ }
+ cp += skip;
+ if (cp + 3 * INT16SZ + INT32SZ > eom) {
+ errno = EMSGSIZE;
+ goto cleanup;
+ }
+ rr.type = ns_get16(cp);
+ cp += INT16SZ;
+ rr.class = ns_get16(cp);
+ cp += INT16SZ + INT32SZ; /*%< skip the ttl, too */
+ rr.dlen = ns_get16(cp);
+ cp += INT16SZ;
+ if (cp + rr.dlen > eom) {
+ errno = EMSGSIZE;
+ goto cleanup;
+ }
+ rr.data = cp;
+ cp += rr.dlen;
+ if (rr.class != class || rr.type != T_TXT)
+ continue;
+ if (!(list[j] = malloc(rr.dlen)))
+ goto cleanup;
+ dst = list[j++];
+ edst = dst + rr.dlen;
+ erdata = rr.data + rr.dlen;
+ cp = rr.data;
+ while (cp < erdata) {
+ n = (unsigned char) *cp++;
+ if (cp + n > eom || dst + n > edst) {
+ errno = EMSGSIZE;
+ goto cleanup;
+ }
+ memcpy(dst, cp, n);
+ cp += n;
+ dst += n;
+ }
+ if (cp != erdata) {
+ errno = EMSGSIZE;
+ goto cleanup;
+ }
+ *dst = '\0';
+ }
+ list[j] = NULL;
+ if (j == 0) {
+ errno = ENOENT;
+ goto cleanup;
+ }
+ return (list);
+
+ cleanup:
+ for (i = 0; i < j; i++)
+ free(list[i]);
+ free(list);
+ return (NULL);
+}
+
+struct __res_state *
+__hesiod_res_get(void *context) {
+ struct hesiod_p *ctx = context;
+
+ if (!ctx->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (res == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ __hesiod_res_set(ctx, res, free);
+ }
+
+ return (ctx->res);
+}
+
+void
+__hesiod_res_set(void *context, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct hesiod_p *ctx = context;
+
+ if (ctx->res && ctx->free_res) {
+ res_nclose(ctx->res);
+ (*ctx->free_res)(ctx->res);
+ }
+
+ ctx->res = res;
+ ctx->free_res = free_res;
+}
+
+static int
+init(struct hesiod_p *ctx) {
+
+ if (!ctx->res && !__hesiod_res_get(ctx))
+ return (-1);
+
+ if (((ctx->res->options & RES_INIT) == 0U) &&
+ (res_ninit(ctx->res) == -1))
+ return (-1);
+
+ return (0);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/irs/hesiod_p.h b/usr/src/lib/libresolv2_joy/common/irs/hesiod_p.h
new file mode 100644
index 0000000000..99da15d0cd
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/hesiod_p.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: hesiod_p.h,v 1.3 2005/04/27 04:56:27 sra Exp $
+ */
+
+#ifndef _HESIOD_P_H_INCLUDED
+#define _HESIOD_P_H_INCLUDED
+
+/** \file
+ * \brief
+ * hesiod_p.h -- private definitions for the hesiod library.
+ *
+ * \author
+ * This file is primarily maintained by tytso@mit.edu and ghudson@mit.edu.
+ */
+
+#define DEF_RHS ".Athena.MIT.EDU" /*%< Defaults if HESIOD_CONF */
+#define DEF_LHS ".ns" /*%< file is not */
+ /*%< present. */
+struct hesiod_p {
+ char * LHS; /*%< normally ".ns" */
+ char * RHS; /*%< AKA the default hesiod domain */
+ struct __res_state * res; /*%< resolver context */
+ void (*free_res)(void *);
+ void (*res_set)(struct hesiod_p *, struct __res_state *,
+ void (*)(void *));
+ struct __res_state * (*res_get)(struct hesiod_p *);
+};
+
+#define MAX_HESRESP 1024
+
+#endif /*_HESIOD_P_H_INCLUDED*/
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irp.c b/usr/src/lib/libresolv2_joy/common/irs/irp.c
new file mode 100644
index 0000000000..ef10631c22
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irp.c
@@ -0,0 +1,583 @@
+/*
+ * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1996, 1998-2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: irp.c,v 1.12 2008/11/14 02:36:51 marka Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <syslog.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <syslog.h>
+#include <ctype.h>
+#include <unistd.h>
+
+#include <isc/memcluster.h>
+
+#include <irs.h>
+#include <irp.h>
+
+#include "irs_p.h"
+#include "irp_p.h"
+
+#include "port_after.h"
+
+/* Forward. */
+
+static void irp_close(struct irs_acc *);
+
+#define LINEINCR 128
+
+#if !defined(SUN_LEN)
+#define SUN_LEN(su) \
+ (sizeof (*(su)) - sizeof ((su)->sun_path) + strlen((su)->sun_path))
+#endif
+
+
+/* Public */
+
+
+/* send errors to syslog if true. */
+int irp_log_errors = 1;
+
+/*%
+ * This module handles the irp module connection to irpd.
+ *
+ * The client expects a synchronous interface to functions like
+ * getpwnam(3), so we can't use the ctl_* i/o library on this end of
+ * the wire (it's used in the server).
+ */
+
+/*%
+ * irs_acc *irs_irp_acc(const char *options);
+ *
+ * Initialize the irp module.
+ */
+struct irs_acc *
+irs_irp_acc(const char *options) {
+ struct irs_acc *acc;
+ struct irp_p *irp;
+
+ UNUSED(options);
+
+ if (!(acc = memget(sizeof *acc))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(acc, 0x5e, sizeof *acc);
+ if (!(irp = memget(sizeof *irp))) {
+ errno = ENOMEM;
+ free(acc);
+ return (NULL);
+ }
+ irp->inlast = 0;
+ irp->incurr = 0;
+ irp->fdCxn = -1;
+ acc->private = irp;
+
+#ifdef WANT_IRS_GR
+ acc->gr_map = irs_irp_gr;
+#else
+ acc->gr_map = NULL;
+#endif
+#ifdef WANT_IRS_PW
+ acc->pw_map = irs_irp_pw;
+#else
+ acc->pw_map = NULL;
+#endif
+ acc->sv_map = irs_irp_sv;
+ acc->pr_map = irs_irp_pr;
+ acc->ho_map = irs_irp_ho;
+ acc->nw_map = irs_irp_nw;
+ acc->ng_map = irs_irp_ng;
+ acc->close = irp_close;
+ return (acc);
+}
+
+
+int
+irs_irp_connection_setup(struct irp_p *cxndata, int *warned) {
+ if (irs_irp_is_connected(cxndata)) {
+ return (0);
+ } else if (irs_irp_connect(cxndata) != 0) {
+ if (warned != NULL && !*warned) {
+ syslog(LOG_ERR, "irpd connection failed: %m\n");
+ (*warned)++;
+ }
+
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*%
+ * int irs_irp_connect(void);
+ *
+ * Sets up the connection to the remote irpd server.
+ *
+ * Returns:
+ *
+ * 0 on success, -1 on failure.
+ *
+ */
+int
+irs_irp_connect(struct irp_p *pvt) {
+ int flags;
+ struct sockaddr *addr;
+ struct sockaddr_in iaddr;
+#ifndef NO_SOCKADDR_UN
+ struct sockaddr_un uaddr;
+#endif
+ long ipaddr;
+ const char *irphost;
+ int code;
+ char text[256];
+ int socklen = 0;
+
+ if (pvt->fdCxn != -1) {
+ perror("fd != 1");
+ return (-1);
+ }
+
+#ifndef NO_SOCKADDR_UN
+ memset(&uaddr, 0, sizeof uaddr);
+#endif
+ memset(&iaddr, 0, sizeof iaddr);
+
+ irphost = getenv(IRPD_HOST_ENV);
+ if (irphost == NULL) {
+ irphost = "127.0.0.1";
+ }
+
+#ifndef NO_SOCKADDR_UN
+ if (irphost[0] == '/') {
+ addr = (struct sockaddr *)&uaddr;
+ strncpy(uaddr.sun_path, irphost, sizeof uaddr.sun_path);
+ uaddr.sun_family = AF_UNIX;
+ socklen = SUN_LEN(&uaddr);
+#ifdef HAVE_SA_LEN
+ uaddr.sun_len = socklen;
+#endif
+ } else
+#endif
+ {
+ if (inet_pton(AF_INET, irphost, &ipaddr) != 1) {
+ errno = EADDRNOTAVAIL;
+ perror("inet_pton");
+ return (-1);
+ }
+
+ addr = (struct sockaddr *)&iaddr;
+ socklen = sizeof iaddr;
+#ifdef HAVE_SA_LEN
+ iaddr.sin_len = socklen;
+#endif
+ iaddr.sin_family = AF_INET;
+ iaddr.sin_port = htons(IRPD_PORT);
+ iaddr.sin_addr.s_addr = ipaddr;
+ }
+
+
+ pvt->fdCxn = socket(addr->sa_family, SOCK_STREAM, PF_UNSPEC);
+ if (pvt->fdCxn < 0) {
+ perror("socket");
+ return (-1);
+ }
+
+ if (connect(pvt->fdCxn, addr, socklen) != 0) {
+ perror("connect");
+ return (-1);
+ }
+
+ flags = fcntl(pvt->fdCxn, F_GETFL, 0);
+ if (flags < 0) {
+ close(pvt->fdCxn);
+ perror("close");
+ return (-1);
+ }
+
+#if 0
+ flags |= O_NONBLOCK;
+ if (fcntl(pvt->fdCxn, F_SETFL, flags) < 0) {
+ close(pvt->fdCxn);
+ perror("fcntl");
+ return (-1);
+ }
+#endif
+
+ code = irs_irp_read_response(pvt, text, sizeof text);
+ if (code != IRPD_WELCOME_CODE) {
+ if (irp_log_errors) {
+ syslog(LOG_WARNING, "Connection failed: %s", text);
+ }
+ irs_irp_disconnect(pvt);
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*%
+ * int irs_irp_is_connected(struct irp_p *pvt);
+ *
+ * Returns:
+ *
+ * Non-zero if streams are setup to remote.
+ *
+ */
+
+int
+irs_irp_is_connected(struct irp_p *pvt) {
+ return (pvt->fdCxn >= 0);
+}
+
+/*%
+ * void
+ * irs_irp_disconnect(struct irp_p *pvt);
+ *
+ * Closes streams to remote.
+ */
+
+void
+irs_irp_disconnect(struct irp_p *pvt) {
+ if (pvt->fdCxn != -1) {
+ close(pvt->fdCxn);
+ pvt->fdCxn = -1;
+ }
+}
+
+
+
+int
+irs_irp_read_line(struct irp_p *pvt, char *buffer, int len) {
+ char *realstart = &pvt->inbuffer[0];
+ char *p, *start, *end;
+ int spare;
+ int i;
+ int buffpos = 0;
+ int left = len - 1;
+
+ while (left > 0) {
+ start = p = &pvt->inbuffer[pvt->incurr];
+ end = &pvt->inbuffer[pvt->inlast];
+
+ while (p != end && *p != '\n')
+ p++;
+
+ if (p == end) {
+ /* Found no newline so shift data down if necessary
+ * and append new data to buffer
+ */
+ if (start > realstart) {
+ memmove(realstart, start, end - start);
+ pvt->inlast = end - start;
+ start = realstart;
+ pvt->incurr = 0;
+ end = &pvt->inbuffer[pvt->inlast];
+ }
+
+ spare = sizeof (pvt->inbuffer) - pvt->inlast;
+
+ p = end;
+ i = read(pvt->fdCxn, end, spare);
+ if (i < 0) {
+ close(pvt->fdCxn);
+ pvt->fdCxn = -1;
+ return (buffpos > 0 ? buffpos : -1);
+ } else if (i == 0) {
+ return (buffpos);
+ }
+
+ end += i;
+ pvt->inlast += i;
+
+ while (p != end && *p != '\n')
+ p++;
+ }
+
+ if (p == end) {
+ /* full buffer and still no newline */
+ i = sizeof pvt->inbuffer;
+ } else {
+ /* include newline */
+ i = p - start + 1;
+ }
+
+ if (i > left)
+ i = left;
+ memcpy(buffer + buffpos, start, i);
+ pvt->incurr += i;
+ buffpos += i;
+ buffer[buffpos] = '\0';
+
+ if (p != end) {
+ left = 0;
+ } else {
+ left -= i;
+ }
+ }
+
+#if 0
+ fprintf(stderr, "read line: %s\n", buffer);
+#endif
+ return (buffpos);
+}
+
+/*%
+ * int irp_read_response(struct irp_p *pvt);
+ *
+ * Returns:
+ *
+ * The number found at the beginning of the line read from
+ * FP. 0 on failure(0 is not a legal response code). The
+ * rest of the line is discarded.
+ *
+ */
+
+int
+irs_irp_read_response(struct irp_p *pvt, char *text, size_t textlen) {
+ char line[1024];
+ int code;
+ char *p;
+
+ if (irs_irp_read_line(pvt, line, sizeof line) <= 0) {
+ return (0);
+ }
+
+ p = strchr(line, '\n');
+ if (p == NULL) {
+ return (0);
+ }
+
+ if (sscanf(line, "%d", &code) != 1) {
+ code = 0;
+ } else if (text != NULL && textlen > 0U) {
+ p = line;
+ while (isspace((unsigned char)*p)) p++;
+ while (isdigit((unsigned char)*p)) p++;
+ while (isspace((unsigned char)*p)) p++;
+ strncpy(text, p, textlen - 1);
+ p[textlen - 1] = '\0';
+ }
+
+ return (code);
+}
+
+/*%
+ * char *irp_read_body(struct irp_p *pvt, size_t *size);
+ *
+ * Read in the body of a response. Terminated by a line with
+ * just a dot on it. Lines should be terminated with a CR-LF
+ * sequence, but we're nt piccky if the CR is missing.
+ * No leading dot escaping is done as the protcol doesn't
+ * use leading dots anywhere.
+ *
+ * Returns:
+ *
+ * Pointer to null-terminated buffer allocated by memget.
+ * *SIZE is set to the length of the buffer.
+ *
+ */
+
+char *
+irs_irp_read_body(struct irp_p *pvt, size_t *size) {
+ char line[1024];
+ u_int linelen;
+ size_t len = LINEINCR;
+ char *buffer = memget(len);
+ int idx = 0;
+
+ if (buffer == NULL)
+ return (NULL);
+
+ for (;;) {
+ if (irs_irp_read_line(pvt, line, sizeof line) <= 0 ||
+ strchr(line, '\n') == NULL)
+ goto death;
+
+ linelen = strlen(line);
+
+ if (line[linelen - 1] != '\n')
+ goto death;
+
+ /* We're not strict about missing \r. Should we be?? */
+ if (linelen > 2 && line[linelen - 2] == '\r') {
+ line[linelen - 2] = '\n';
+ line[linelen - 1] = '\0';
+ linelen--;
+ }
+
+ if (linelen == 2 && line[0] == '.') {
+ *size = len;
+ buffer[idx] = '\0';
+
+ return (buffer);
+ }
+
+ if (linelen > (len - (idx + 1))) {
+ char *p = memget(len + LINEINCR);
+
+ if (p == NULL)
+ goto death;
+ memcpy(p, buffer, len);
+ memput(buffer, len);
+ buffer = p;
+ len += LINEINCR;
+ }
+
+ memcpy(buffer + idx, line, linelen);
+ idx += linelen;
+ }
+ death:
+ memput(buffer, len);
+ return (NULL);
+}
+
+/*%
+ * int irs_irp_get_full_response(struct irp_p *pvt, int *code,
+ * char **body, size_t *bodylen);
+ *
+ * Gets the response to a command. If the response indicates
+ * there's a body to follow(code % 10 == 1), then the
+ * body buffer is allcoated with memget and stored in
+ * *BODY. The length of the allocated body buffer is stored
+ * in *BODY. The caller must give the body buffer back to
+ * memput when done. The results code is stored in *CODE.
+ *
+ * Returns:
+ *
+ * 0 if a result was read. -1 on some sort of failure.
+ *
+ */
+
+int
+irs_irp_get_full_response(struct irp_p *pvt, int *code, char *text,
+ size_t textlen, char **body, size_t *bodylen) {
+ int result = irs_irp_read_response(pvt, text, textlen);
+
+ *body = NULL;
+
+ if (result == 0) {
+ return (-1);
+ }
+
+ *code = result;
+
+ /* Code that matches 2xx is a good result code.
+ * Code that matches xx1 means there's a response body coming.
+ */
+ if ((result / 100) == 2 && (result % 10) == 1) {
+ *body = irs_irp_read_body(pvt, bodylen);
+ if (*body == NULL) {
+ return (-1);
+ }
+ }
+
+ return (0);
+}
+
+/*%
+ * int irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...);
+ *
+ * Sends command to remote connected via the PVT
+ * structure. FMT and args after it are fprintf-like
+ * arguments for formatting.
+ *
+ * Returns:
+ *
+ * 0 on success, -1 on failure.
+ */
+
+int
+irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...) {
+ va_list ap;
+ char buffer[1024];
+ int pos = 0;
+ int i, todo;
+
+
+ if (pvt->fdCxn < 0) {
+ return (-1);
+ }
+
+ va_start(ap, fmt);
+ (void) vsprintf(buffer, fmt, ap);
+ todo = strlen(buffer);
+ va_end(ap);
+ if (todo > (int)sizeof(buffer) - 3) {
+ syslog(LOG_CRIT, "memory overrun in irs_irp_send_command()");
+ exit(1);
+ }
+ strcat(buffer, "\r\n");
+ todo = strlen(buffer);
+
+ while (todo > 0) {
+ i = write(pvt->fdCxn, buffer + pos, todo);
+#if 0
+ /* XXX brister */
+ fprintf(stderr, "Wrote: \"");
+ fwrite(buffer + pos, sizeof (char), todo, stderr);
+ fprintf(stderr, "\"\n");
+#endif
+ if (i < 0) {
+ close(pvt->fdCxn);
+ pvt->fdCxn = -1;
+ return (-1);
+ }
+ todo -= i;
+ }
+
+ return (0);
+}
+
+
+/* Methods */
+
+/*%
+ * void irp_close(struct irs_acc *this)
+ *
+ */
+
+static void
+irp_close(struct irs_acc *this) {
+ struct irp_p *irp = (struct irp_p *)this->private;
+
+ if (irp != NULL) {
+ irs_irp_disconnect(irp);
+ memput(irp, sizeof *irp);
+ }
+
+ memput(this, sizeof *this);
+}
+
+
+
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irp_ho.c b/usr/src/lib/libresolv2_joy/common/irs/irp_ho.c
new file mode 100644
index 0000000000..b0de31dc89
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irp_ho.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996,1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: irp_ho.c,v 1.3 2005/04/27 04:56:28 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* Imports. */
+
+#include "port_before.h"
+
+#include <syslog.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+
+#include <irs.h>
+#include <irp.h>
+#include <isc/irpmarshall.h>
+#include <isc/memcluster.h>
+
+#include "irs_p.h"
+#include "dns_p.h"
+#include "irp_p.h"
+
+#include "port_after.h"
+
+/* Definitions. */
+
+#define MAXALIASES 35
+#define MAXADDRS 35
+#define Max(a,b) ((a) > (b) ? (a) : (b))
+
+
+struct pvt {
+ struct irp_p *girpdata;
+ int warned;
+ struct hostent host;
+};
+
+/* Forward. */
+
+static void ho_close(struct irs_ho *this);
+static struct hostent * ho_byname(struct irs_ho *this, const char *name);
+static struct hostent * ho_byname2(struct irs_ho *this, const char *name,
+ int af);
+static struct hostent * ho_byaddr(struct irs_ho *this, const void *addr,
+ int len, int af);
+static struct hostent * ho_next(struct irs_ho *this);
+static void ho_rewind(struct irs_ho *this);
+static void ho_minimize(struct irs_ho *this);
+
+static void free_host(struct hostent *ho);
+static struct addrinfo * ho_addrinfo(struct irs_ho *this, const char *name,
+ const struct addrinfo *pai);
+
+/* Public. */
+
+/*%
+ * struct irs_ho * irs_irp_ho(struct irs_acc *this)
+ *
+ * Notes:
+ *
+ * Initializes the irp_ho module.
+ *
+ */
+
+struct irs_ho *
+irs_irp_ho(struct irs_acc *this) {
+ struct irs_ho *ho;
+ struct pvt *pvt;
+
+ if (!(ho = memget(sizeof *ho))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(ho, 0x0, sizeof *ho);
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ memput(ho, sizeof *ho);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pvt->girpdata = this->private;
+
+ ho->private = pvt;
+ ho->close = ho_close;
+ ho->byname = ho_byname;
+ ho->byname2 = ho_byname2;
+ ho->byaddr = ho_byaddr;
+ ho->next = ho_next;
+ ho->rewind = ho_rewind;
+ ho->minimize = ho_minimize;
+ ho->addrinfo = ho_addrinfo;
+
+ return (ho);
+}
+
+/* Methods. */
+
+/*%
+ * Closes down the module.
+ *
+ */
+
+static void
+ho_close(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ ho_minimize(this);
+
+ free_host(&pvt->host);
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+
+
+/*
+ * struct hostent * ho_byname(struct irs_ho *this, const char *name)
+ *
+ */
+
+static struct hostent *
+ho_byname(struct irs_ho *this, const char *name) {
+ return (ho_byname2(this, name, AF_INET));
+}
+
+
+
+
+
+/*
+ * struct hostent * ho_byname2(struct irs_ho *this, const char *name, int af)
+ *
+ */
+
+static struct hostent *
+ho_byname2(struct irs_ho *this, const char *name, int af) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *ho = &pvt->host;
+ char *body = NULL;
+ size_t bodylen;
+ int code;
+ char text[256];
+
+ if (ho->h_name != NULL &&
+ strcmp(name, ho->h_name) == 0 &&
+ af == ho->h_addrtype) {
+ return (ho);
+ }
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "gethostbyname2 %s %s",
+ name, ADDR_T_STR(af)) != 0)
+ return (NULL);
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETHOST_OK) {
+ free_host(ho);
+ if (irp_unmarshall_ho(ho, body) != 0) {
+ ho = NULL;
+ }
+ } else {
+ ho = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (ho);
+}
+
+
+
+/*
+ * struct hostent * ho_byaddr(struct irs_ho *this, const void *addr,
+ * int len, int af)
+ *
+ */
+
+static struct hostent *
+ho_byaddr(struct irs_ho *this, const void *addr, int len, int af) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *ho = &pvt->host;
+ char *body = NULL;
+ size_t bodylen;
+ int code;
+ char **p;
+ char paddr[MAXPADDRSIZE];
+ char text[256];
+
+ if (ho->h_name != NULL &&
+ af == ho->h_addrtype &&
+ len == ho->h_length) {
+ for (p = ho->h_addr_list ; *p != NULL ; p++) {
+ if (memcmp(*p, addr, len) == 0)
+ return (ho);
+ }
+ }
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (inet_ntop(af, addr, paddr, sizeof paddr) == NULL) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "gethostbyaddr %s %s",
+ paddr, ADDR_T_STR(af)) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETHOST_OK) {
+ free_host(ho);
+ if (irp_unmarshall_ho(ho, body) != 0) {
+ ho = NULL;
+ }
+ } else {
+ ho = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (ho);
+}
+
+/*%
+ * The implementation for gethostent(3). The first time it's
+ * called all the data is pulled from the remote(i.e. what
+ * the maximum number of gethostent(3) calls would return)
+ * and that data is cached.
+ *
+ */
+
+static struct hostent *
+ho_next(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *ho = &pvt->host;
+ char *body;
+ size_t bodylen;
+ int code;
+ char text[256];
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "gethostent") != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETHOST_OK) {
+ free_host(ho);
+ if (irp_unmarshall_ho(ho, body) != 0) {
+ ho = NULL;
+ }
+ } else {
+ ho = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (ho);
+}
+
+/*%
+ * void ho_rewind(struct irs_ho *this)
+ *
+ */
+
+static void
+ho_rewind(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char text[256];
+ int code;
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return;
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "sethostent") != 0) {
+ return;
+ }
+
+ code = irs_irp_read_response(pvt->girpdata, text, sizeof text);
+ if (code != IRPD_GETHOST_SETOK) {
+ if (irp_log_errors) {
+ syslog(LOG_WARNING, "sethostent failed: %s", text);
+ }
+ }
+
+ return;
+}
+
+/*%
+ * void ho_minimize(struct irs_ho *this)
+ *
+ */
+
+static void
+ho_minimize(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ free_host(&pvt->host);
+
+ irs_irp_disconnect(pvt->girpdata);
+}
+
+/*%
+ * void free_host(struct hostent *ho)
+ *
+ */
+
+static void
+free_host(struct hostent *ho) {
+ char **p;
+
+ if (ho == NULL) {
+ return;
+ }
+
+ if (ho->h_name != NULL)
+ free(ho->h_name);
+
+ if (ho->h_aliases != NULL) {
+ for (p = ho->h_aliases ; *p != NULL ; p++)
+ free(*p);
+ free(ho->h_aliases);
+ }
+
+ if (ho->h_addr_list != NULL) {
+ for (p = ho->h_addr_list ; *p != NULL ; p++)
+ free(*p);
+ free(ho->h_addr_list);
+ }
+}
+
+/* dummy */
+static struct addrinfo *
+ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
+{
+ UNUSED(this);
+ UNUSED(name);
+ UNUSED(pai);
+ return(NULL);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irp_ng.c b/usr/src/lib/libresolv2_joy/common/irs/irp_ng.c
new file mode 100644
index 0000000000..1af862cab4
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irp_ng.c
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: irp_ng.c,v 1.4 2006/12/07 04:46:27 marka Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <syslog.h>
+
+#include <irs.h>
+#include <irp.h>
+#include <isc/memcluster.h>
+#include <isc/irpmarshall.h>
+
+#include "irs_p.h"
+#include "irp_p.h"
+
+#include "port_after.h"
+
+/* Definitions */
+
+struct pvt {
+ struct irp_p *girpdata;
+ int warned;
+};
+
+
+/* Forward */
+
+static void ng_rewind(struct irs_ng *, const char*);
+static void ng_close(struct irs_ng *);
+static int ng_next(struct irs_ng *, const char **, const char **,
+ const char **);
+static int ng_test(struct irs_ng *, const char *,
+ const char *, const char *,
+ const char *);
+static void ng_minimize(struct irs_ng *);
+
+
+/* Public */
+
+/*%
+ * Intialize the irp netgroup module.
+ *
+ */
+
+struct irs_ng *
+irs_irp_ng(struct irs_acc *this) {
+ struct irs_ng *ng;
+ struct pvt *pvt;
+
+ if (!(ng = memget(sizeof *ng))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(ng, 0x5e, sizeof *ng);
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ memput(ng, sizeof *ng);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pvt->girpdata = this->private;
+
+ ng->private = pvt;
+ ng->close = ng_close;
+ ng->next = ng_next;
+ ng->test = ng_test;
+ ng->rewind = ng_rewind;
+ ng->minimize = ng_minimize;
+ return (ng);
+}
+
+/* Methods */
+
+
+
+/*
+ * void ng_close(struct irs_ng *this)
+ *
+ */
+
+static void
+ng_close(struct irs_ng *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ ng_minimize(this);
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+
+
+
+/*
+ * void ng_rewind(struct irs_ng *this, const char *group)
+ *
+ *
+ */
+
+static void
+ng_rewind(struct irs_ng *this, const char *group) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char text[256];
+ int code;
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return;
+ }
+
+ if (irs_irp_send_command(pvt->girpdata,
+ "setnetgrent %s", group) != 0) {
+ return;
+ }
+
+ code = irs_irp_read_response(pvt->girpdata, text, sizeof text);
+ if (code != IRPD_GETNETGR_SETOK) {
+ if (irp_log_errors) {
+ syslog(LOG_WARNING, "setnetgrent(%s) failed: %s",
+ group, text);
+ }
+ }
+
+ return;
+}
+
+/*
+ * Get the next netgroup item from the cache.
+ *
+ */
+
+static int
+ng_next(struct irs_ng *this, const char **host, const char **user,
+ const char **domain)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ int code;
+ char *body = NULL;
+ size_t bodylen;
+ int rval = 0;
+ char text[256];
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (0);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "getnetgrent") != 0)
+ return (0);
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (0);
+ }
+
+ if (code == IRPD_GETNETGR_OK) {
+ if (irp_unmarshall_ng(host, user, domain, body) == 0) {
+ rval = 1;
+ }
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (rval);
+}
+
+/*
+ * Search for a match in a netgroup.
+ *
+ */
+
+static int
+ng_test(struct irs_ng *this, const char *name,
+ const char *host, const char *user, const char *domain)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ char *body = NULL;
+ size_t bodylen = 0;
+ int code;
+ char text[256];
+ int rval = 0;
+
+ UNUSED(name);
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (0);
+ }
+
+ if (irp_marshall_ng(host, user, domain, &body, &bodylen) != 0) {
+ return (0);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "innetgr %s", body) == 0) {
+ code = irs_irp_read_response(pvt->girpdata, text, sizeof text);
+ if (code == IRPD_GETNETGR_MATCHES) {
+ rval = 1;
+ }
+ }
+
+ memput(body, bodylen);
+
+ return (rval);
+}
+
+
+
+
+/*
+ * void ng_minimize(struct irs_ng *this)
+ *
+ */
+
+static void
+ng_minimize(struct irs_ng *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ irs_irp_disconnect(pvt->girpdata);
+}
+
+
+
+
+/* Private */
+
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irp_nw.c b/usr/src/lib/libresolv2_joy/common/irs/irp_nw.c
new file mode 100644
index 0000000000..3f2381f95d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irp_nw.c
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996,1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: irp_nw.c,v 1.4 2006/03/09 23:57:56 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#if 0
+
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <syslog.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+
+#include <irs.h>
+#include <irp.h>
+#include <isc/irpmarshall.h>
+
+#include <isc/memcluster.h>
+#include <isc/misc.h>
+
+#include "irs_p.h"
+#include "lcl_p.h"
+#include "irp_p.h"
+
+#include "port_after.h"
+
+#define MAXALIASES 35
+#define MAXADDRSIZE 4
+
+struct pvt {
+ struct irp_p *girpdata;
+ int warned;
+ struct nwent net;
+};
+
+/* Forward */
+
+static void nw_close(struct irs_nw *);
+static struct nwent * nw_byname(struct irs_nw *, const char *, int);
+static struct nwent * nw_byaddr(struct irs_nw *, void *, int, int);
+static struct nwent * nw_next(struct irs_nw *);
+static void nw_rewind(struct irs_nw *);
+static void nw_minimize(struct irs_nw *);
+
+static void free_nw(struct nwent *nw);
+
+
+/* Public */
+
+/*%
+ * struct irs_nw * irs_irp_nw(struct irs_acc *this)
+ *
+ */
+
+struct irs_nw *
+irs_irp_nw(struct irs_acc *this) {
+ struct irs_nw *nw;
+ struct pvt *pvt;
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+
+ if (!(nw = memget(sizeof *nw))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(nw, 0x0, sizeof *nw);
+ pvt->girpdata = this->private;
+
+ nw->private = pvt;
+ nw->close = nw_close;
+ nw->byname = nw_byname;
+ nw->byaddr = nw_byaddr;
+ nw->next = nw_next;
+ nw->rewind = nw_rewind;
+ nw->minimize = nw_minimize;
+ return (nw);
+}
+
+/* Methods */
+
+/*%
+ * void nw_close(struct irs_nw *this)
+ *
+ */
+
+static void
+nw_close(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ nw_minimize(this);
+
+ free_nw(&pvt->net);
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+/*%
+ * struct nwent * nw_byaddr(struct irs_nw *this, void *net,
+ * int length, int type)
+ *
+ */
+
+static struct nwent *
+nw_byaddr(struct irs_nw *this, void *net, int length, int type) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct nwent *nw = &pvt->net;
+ char *body = NULL;
+ size_t bodylen;
+ int code;
+ char paddr[24]; /*%< bigenough for ip4 w/ cidr spec. */
+ char text[256];
+
+ if (inet_net_ntop(type, net, length, paddr, sizeof paddr) == NULL) {
+ return (NULL);
+ }
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "getnetbyaddr %s %s",
+ paddr, ADDR_T_STR(type)) != 0)
+ return (NULL);
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETNET_OK) {
+ free_nw(nw);
+ if (irp_unmarshall_nw(nw, body) != 0) {
+ nw = NULL;
+ }
+ } else {
+ nw = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (nw);
+}
+
+/*%
+ * struct nwent * nw_byname(struct irs_nw *this, const char *name, int type)
+ *
+ */
+
+static struct nwent *
+nw_byname(struct irs_nw *this, const char *name, int type) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct nwent *nw = &pvt->net;
+ char *body = NULL;
+ size_t bodylen;
+ int code;
+ char text[256];
+
+ if (nw->n_name != NULL &&
+ strcmp(name, nw->n_name) == 0 &&
+ nw->n_addrtype == type) {
+ return (nw);
+ }
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "getnetbyname %s", name) != 0)
+ return (NULL);
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETNET_OK) {
+ free_nw(nw);
+ if (irp_unmarshall_nw(nw, body) != 0) {
+ nw = NULL;
+ }
+ } else {
+ nw = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (nw);
+}
+
+/*%
+ * void nw_rewind(struct irs_nw *this)
+ *
+ */
+
+static void
+nw_rewind(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char text[256];
+ int code;
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return;
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "setnetent") != 0) {
+ return;
+ }
+
+ code = irs_irp_read_response(pvt->girpdata, text, sizeof text);
+ if (code != IRPD_GETNET_SETOK) {
+ if (irp_log_errors) {
+ syslog(LOG_WARNING, "setnetent failed: %s", text);
+ }
+ }
+
+ return;
+}
+
+/*%
+ * Prepares the cache if necessary and returns the first, or
+ * next item from it.
+ */
+
+static struct nwent *
+nw_next(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct nwent *nw = &pvt->net;
+ char *body;
+ size_t bodylen;
+ int code;
+ char text[256];
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "getnetent") != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETNET_OK) {
+ free_nw(nw);
+ if (irp_unmarshall_nw(nw, body) != 0) {
+ nw = NULL;
+ }
+ } else {
+ nw = NULL;
+ }
+
+ if (body != NULL)
+ memput(body, bodylen);
+ return (nw);
+}
+
+/*%
+ * void nw_minimize(struct irs_nw *this)
+ *
+ */
+
+static void
+nw_minimize(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ irs_irp_disconnect(pvt->girpdata);
+}
+
+
+
+
+/* private. */
+
+/*%
+ * deallocate all the memory irp_unmarshall_pw allocated.
+ *
+ */
+
+static void
+free_nw(struct nwent *nw) {
+ char **p;
+
+ if (nw == NULL)
+ return;
+
+ if (nw->n_name != NULL)
+ free(nw->n_name);
+
+ if (nw->n_aliases != NULL) {
+ for (p = nw->n_aliases ; *p != NULL ; p++) {
+ free(*p);
+ }
+ free(nw->n_aliases);
+ }
+
+ if (nw->n_addr != NULL)
+ free(nw->n_addr);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irp_p.h b/usr/src/lib/libresolv2_joy/common/irs/irp_p.h
new file mode 100644
index 0000000000..4f943f81bd
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irp_p.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: irp_p.h,v 1.5 2005/04/27 04:56:28 sra Exp $
+ */
+
+#ifndef _IRP_P_H_INCLUDED
+#define _IRP_P_H_INCLUDED
+
+#include <stdio.h>
+
+struct irp_p {
+ char inbuffer[1024];
+ int inlast; /*%< index of one past the last char in buffer */
+ int incurr; /*%< index of the next char to be read from buffer */
+ int fdCxn;
+};
+
+/*
+ * Externs.
+ */
+
+extern struct irs_acc * irs_irp_acc __P((const char *));
+extern struct irs_gr * irs_irp_gr __P((struct irs_acc *));
+extern struct irs_pw * irs_irp_pw __P((struct irs_acc *));
+extern struct irs_sv * irs_irp_sv __P((struct irs_acc *));
+extern struct irs_pr * irs_irp_pr __P((struct irs_acc *));
+extern struct irs_ho * irs_irp_ho __P((struct irs_acc *));
+extern struct irs_nw * irs_irp_nw __P((struct irs_acc *));
+extern struct irs_ng * irs_irp_ng __P((struct irs_acc *));
+
+int irs_irp_connect(struct irp_p *pvt);
+int irs_irp_is_connected(struct irp_p *pvt);
+void irs_irp_disconnect(struct irp_p *pvt);
+int irs_irp_read_response(struct irp_p *pvt, char *text, size_t textlen);
+char *irs_irp_read_body(struct irp_p *pvt, size_t *size);
+int irs_irp_get_full_response(struct irp_p *pvt, int *code,
+ char *text, size_t textlen,
+ char **body, size_t *bodylen);
+
+extern int irp_log_errors;
+
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irp_pr.c b/usr/src/lib/libresolv2_joy/common/irs/irp_pr.c
new file mode 100644
index 0000000000..ea876e8281
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irp_pr.c
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: irp_pr.c,v 1.3 2005/04/27 04:56:29 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* extern */
+
+#include "port_before.h"
+
+#include <syslog.h>
+#include <sys/types.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <netdb.h>
+#include <syslog.h>
+
+#include <irs.h>
+#include <irp.h>
+#include <isc/memcluster.h>
+#include <isc/irpmarshall.h>
+
+#include "irs_p.h"
+#include "lcl_p.h"
+#include "irp_p.h"
+
+#include "port_after.h"
+
+
+#define MAXALIASES 35
+
+/* Types */
+
+struct pvt {
+ struct irp_p *girpdata;
+ int warned;
+ struct protoent proto;
+};
+
+/* Forward */
+
+static void pr_close(struct irs_pr *);
+static struct protoent * pr_next(struct irs_pr *);
+static struct protoent * pr_byname(struct irs_pr *, const char *);
+static struct protoent * pr_bynumber(struct irs_pr *, int);
+static void pr_rewind(struct irs_pr *);
+static void pr_minimize(struct irs_pr *);
+
+static void free_proto(struct protoent *pr);
+
+/* Public */
+
+/*%
+ * struct irs_pr * irs_irp_pr(struct irs_acc *this)
+ *
+ */
+
+struct irs_pr *
+irs_irp_pr(struct irs_acc *this) {
+ struct irs_pr *pr;
+ struct pvt *pvt;
+
+ if (!(pr = memget(sizeof *pr))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pr, 0x0, sizeof *pr);
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ memput(pr, sizeof *pr);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pvt->girpdata = this->private;
+
+ pr->private = pvt;
+ pr->close = pr_close;
+ pr->byname = pr_byname;
+ pr->bynumber = pr_bynumber;
+ pr->next = pr_next;
+ pr->rewind = pr_rewind;
+ pr->minimize = pr_minimize;
+ return (pr);
+}
+
+/* Methods */
+
+/*%
+ * void pr_close(struct irs_pr *this)
+ *
+ */
+
+static void
+pr_close(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ pr_minimize(this);
+
+ free_proto(&pvt->proto);
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+/*%
+ * struct protoent * pr_byname(struct irs_pr *this, const char *name)
+ *
+ */
+
+static struct protoent *
+pr_byname(struct irs_pr *this, const char *name) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct protoent *pr = &pvt->proto;
+ char *body = NULL;
+ size_t bodylen;
+ int code;
+ int i;
+ char text[256];
+
+ if (pr->p_name != NULL && strcmp(name, pr->p_name) == 0) {
+ return (pr);
+ }
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ i = irs_irp_send_command(pvt->girpdata, "getprotobyname %s", name);
+ if (i != 0)
+ return (NULL);
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETPROTO_OK) {
+ free_proto(pr);
+ if (irp_unmarshall_pr(pr, body) != 0) {
+ pr = NULL;
+ }
+ } else {
+ pr = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (pr);
+}
+
+/*%
+ * struct protoent * pr_bynumber(struct irs_pr *this, int proto)
+ *
+ */
+
+static struct protoent *
+pr_bynumber(struct irs_pr *this, int proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct protoent *pr = &pvt->proto;
+ char *body = NULL;
+ size_t bodylen;
+ int code;
+ int i;
+ char text[256];
+
+ if (pr->p_name != NULL && proto == pr->p_proto) {
+ return (pr);
+ }
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ i = irs_irp_send_command(pvt->girpdata, "getprotobynumber %d", proto);
+ if (i != 0)
+ return (NULL);
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETPROTO_OK) {
+ free_proto(pr);
+ if (irp_unmarshall_pr(pr, body) != 0) {
+ pr = NULL;
+ }
+ } else {
+ pr = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (pr);
+}
+
+/*%
+ * void pr_rewind(struct irs_pr *this)
+ *
+ */
+
+static void
+pr_rewind(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char text[256];
+ int code;
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return;
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "setprotoent") != 0) {
+ return;
+ }
+
+ code = irs_irp_read_response(pvt->girpdata, text, sizeof text);
+ if (code != IRPD_GETPROTO_SETOK) {
+ if (irp_log_errors) {
+ syslog(LOG_WARNING, "setprotoent failed: %s", text);
+ }
+ }
+
+ return;
+}
+
+/*%
+ * Prepares the cache if necessary and returns the next item in it.
+ *
+ */
+
+static struct protoent *
+pr_next(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct protoent *pr = &pvt->proto;
+ char *body;
+ size_t bodylen;
+ int code;
+ char text[256];
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "getprotoent") != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETPROTO_OK) {
+ free_proto(pr);
+ if (irp_unmarshall_pr(pr, body) != 0) {
+ pr = NULL;
+ }
+ } else {
+ pr = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (pr);
+}
+
+/*%
+ * void pr_minimize(struct irs_pr *this)
+ *
+ */
+
+static void
+pr_minimize(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ irs_irp_disconnect(pvt->girpdata);
+}
+
+/*%
+ * Deallocate all the memory irp_unmarshall_pr allocated.
+ *
+ */
+
+static void
+free_proto(struct protoent *pr) {
+ char **p;
+
+ if (pr == NULL)
+ return;
+
+ if (pr->p_name != NULL)
+ free(pr->p_name);
+
+ for (p = pr->p_aliases ; p != NULL && *p != NULL ; p++)
+ free(*p);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irp_sv.c b/usr/src/lib/libresolv2_joy/common/irs/irp_sv.c
new file mode 100644
index 0000000000..577e697fe6
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irp_sv.c
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996,1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: irp_sv.c,v 1.3 2005/04/27 04:56:29 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* extern */
+
+#include "port_before.h"
+
+#include <syslog.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#ifdef IRS_LCL_SV_DB
+#include <db.h>
+#endif
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <syslog.h>
+
+#include <irs.h>
+#include <irp.h>
+#include <isc/irpmarshall.h>
+#include <isc/memcluster.h>
+
+#include "irs_p.h"
+#include "lcl_p.h"
+#include "irp_p.h"
+
+#include "port_after.h"
+
+/* Types */
+
+struct pvt {
+ struct irp_p *girpdata;
+ int warned;
+ struct servent service;
+};
+
+/* Forward */
+
+static void sv_close(struct irs_sv*);
+static struct servent * sv_next(struct irs_sv *);
+static struct servent * sv_byname(struct irs_sv *, const char *,
+ const char *);
+static struct servent * sv_byport(struct irs_sv *, int, const char *);
+static void sv_rewind(struct irs_sv *);
+static void sv_minimize(struct irs_sv *);
+
+static void free_service(struct servent *sv);
+
+
+
+/* Public */
+
+/*%
+ * struct irs_sv * irs_irp_sv(struct irs_acc *this)
+ *
+ */
+
+struct irs_sv *
+irs_irp_sv(struct irs_acc *this) {
+ struct irs_sv *sv;
+ struct pvt *pvt;
+
+ if ((sv = memget(sizeof *sv)) == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(sv, 0x0, sizeof *sv);
+
+ if ((pvt = memget(sizeof *pvt)) == NULL) {
+ memput(sv, sizeof *sv);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pvt->girpdata = this->private;
+
+ sv->private = pvt;
+ sv->close = sv_close;
+ sv->next = sv_next;
+ sv->byname = sv_byname;
+ sv->byport = sv_byport;
+ sv->rewind = sv_rewind;
+ sv->minimize = sv_minimize;
+
+ return (sv);
+}
+
+/* Methods */
+
+/*%
+ * void sv_close(struct irs_sv *this)
+ *
+ */
+
+static void
+sv_close(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ sv_minimize(this);
+
+ free_service(&pvt->service);
+
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+/*%
+ * Fills the cache if necessary and returns the next item from it.
+ *
+ */
+
+static struct servent *
+sv_next(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct servent *sv = &pvt->service;
+ char *body;
+ size_t bodylen;
+ int code;
+ char text[256];
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "getservent") != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETSERVICE_OK) {
+ free_service(sv);
+ if (irp_unmarshall_sv(sv, body) != 0) {
+ sv = NULL;
+ }
+ } else {
+ sv = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (sv);
+}
+
+/*%
+ * struct servent * sv_byname(struct irs_sv *this, const char *name,
+ * const char *proto)
+ *
+ */
+
+static struct servent *
+sv_byname(struct irs_sv *this, const char *name, const char *proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct servent *sv = &pvt->service;
+ char *body;
+ char text[256];
+ size_t bodylen;
+ int code;
+
+ if (sv->s_name != NULL &&
+ strcmp(name, sv->s_name) == 0 &&
+ strcasecmp(proto, sv->s_proto) == 0) {
+ return (sv);
+ }
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "getservbyname %s %s",
+ name, proto) != 0)
+ return (NULL);
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETSERVICE_OK) {
+ free_service(sv);
+ if (irp_unmarshall_sv(sv, body) != 0) {
+ sv = NULL;
+ }
+ } else {
+ sv = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (sv);
+}
+
+/*%
+ * struct servent * sv_byport(struct irs_sv *this, int port,
+ * const char *proto)
+ *
+ */
+
+static struct servent *
+sv_byport(struct irs_sv *this, int port, const char *proto) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct servent *sv = &pvt->service;
+ char *body;
+ size_t bodylen;
+ char text[256];
+ int code;
+
+ if (sv->s_name != NULL &&
+ port == sv->s_port &&
+ strcasecmp(proto, sv->s_proto) == 0) {
+ return (sv);
+ }
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "getservbyport %d %s",
+ ntohs((short)port), proto) != 0) {
+ return (NULL);
+ }
+
+ if (irs_irp_get_full_response(pvt->girpdata, &code,
+ text, sizeof text,
+ &body, &bodylen) != 0) {
+ return (NULL);
+ }
+
+ if (code == IRPD_GETSERVICE_OK) {
+ free_service(sv);
+ if (irp_unmarshall_sv(sv, body) != 0) {
+ sv = NULL;
+ }
+ } else {
+ sv = NULL;
+ }
+
+ if (body != NULL) {
+ memput(body, bodylen);
+ }
+
+ return (sv);
+}
+
+/*%
+ * void sv_rewind(struct irs_sv *this)
+ *
+ */
+
+static void
+sv_rewind(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char text[256];
+ int code;
+
+ if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) {
+ return;
+ }
+
+ if (irs_irp_send_command(pvt->girpdata, "setservent") != 0) {
+ return;
+ }
+
+ code = irs_irp_read_response(pvt->girpdata, text, sizeof text);
+ if (code != IRPD_GETSERVICE_SETOK) {
+ if (irp_log_errors) {
+ syslog(LOG_WARNING, "setservent failed: %s", text);
+ }
+ }
+
+ return;
+}
+
+/*%
+ * void sv_minimize(struct irs_sv *this)
+ *
+ */
+
+static void
+sv_minimize(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ irs_irp_disconnect(pvt->girpdata);
+}
+
+
+
+
+
+
+static void
+free_service(struct servent *sv) {
+ char **p;
+
+ if (sv == NULL) {
+ return;
+ }
+
+ if (sv->s_name != NULL) {
+ free(sv->s_name);
+ }
+
+ for (p = sv->s_aliases ; p != NULL && *p != NULL ; p++) {
+ free(*p);
+ }
+
+ if (sv->s_proto != NULL) {
+ free(sv->s_proto);
+ }
+}
+
+
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irpmarshall.c b/usr/src/lib/libresolv2_joy/common/irs/irpmarshall.c
new file mode 100644
index 0000000000..85ffff1866
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irpmarshall.c
@@ -0,0 +1,2301 @@
+/*
+ * Copyright(c) 1989, 1993, 1995
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: irpmarshall.c,v 1.7 2006/03/09 23:57:56 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#if 0
+
+Check values are in approrpriate endian order.
+
+Double check memory allocations on unmarhsalling
+
+#endif
+
+
+/* Extern */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <stdio.h>
+#include <ctype.h>
+#include <pwd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <utmp.h>
+#include <unistd.h>
+#include <assert.h>
+#include <errno.h>
+
+#include <irs.h>
+#include <isc/memcluster.h>
+#include <isc/irpmarshall.h>
+
+#include "port_after.h"
+
+
+#ifndef HAVE_STRNDUP
+static char *strndup(const char *str, size_t len);
+#endif
+
+static char **splitarray(const char *buffer, const char *buffend, char delim);
+static int joinarray(char * const * argv, char *buffer, char delim);
+static char *getfield(char **res, size_t reslen, char **buffer, char delim);
+static size_t joinlength(char * const *argv);
+static void free_array(char **argv, size_t entries);
+
+#define ADDR_T_STR(x) (x == AF_INET ? "AF_INET" :\
+ (x == AF_INET6 ? "AF_INET6" : "UNKNOWN"))
+
+#define MAXPADDRSIZE (sizeof "255.255.255.255" + 1)
+
+static char COMMA = ',';
+
+static const char *COMMASTR = ",";
+static const char *COLONSTR = ":";
+
+
+
+/* See big comment at bottom of irpmarshall.h for description. */
+
+
+#ifdef WANT_IRS_PW
+/* +++++++++++++++++++++++++ struct passwd +++++++++++++++++++++++++ */
+
+/*%
+ * int irp_marshall_pw(const struct passwd *pw, char **buffer, size_t *len)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h
+ *
+ * return: \li
+ *
+ * 0 on sucess, -1 on failure.
+ *
+ */
+
+int
+irp_marshall_pw(const struct passwd *pw, char **buffer, size_t *len) {
+ size_t need = 1 ; /*%< for null byte */
+ char pwUid[24];
+ char pwGid[24];
+ char pwChange[24];
+ char pwExpire[24];
+ const char *pwClass;
+ const char *fieldsep = COLONSTR;
+
+ if (pw == NULL || len == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ sprintf(pwUid, "%ld", (long)pw->pw_uid);
+ sprintf(pwGid, "%ld", (long)pw->pw_gid);
+
+#ifdef HAVE_PW_CHANGE
+ sprintf(pwChange, "%ld", (long)pw->pw_change);
+#else
+ pwChange[0] = '0';
+ pwChange[1] = '\0';
+#endif
+
+#ifdef HAVE_PW_EXPIRE
+ sprintf(pwExpire, "%ld", (long)pw->pw_expire);
+#else
+ pwExpire[0] = '0';
+ pwExpire[1] = '\0';
+#endif
+
+#ifdef HAVE_PW_CLASS
+ pwClass = pw->pw_class;
+#else
+ pwClass = "";
+#endif
+
+ need += strlen(pw->pw_name) + 1; /*%< one for fieldsep */
+ need += strlen(pw->pw_passwd) + 1;
+ need += strlen(pwUid) + 1;
+ need += strlen(pwGid) + 1;
+ need += strlen(pwClass) + 1;
+ need += strlen(pwChange) + 1;
+ need += strlen(pwExpire) + 1;
+ need += strlen(pw->pw_gecos) + 1;
+ need += strlen(pw->pw_dir) + 1;
+ need += strlen(pw->pw_shell) + 1;
+
+ if (buffer == NULL) {
+ *len = need;
+ return (0);
+ }
+
+ if (*buffer != NULL && need > *len) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (*buffer == NULL) {
+ need += 2; /*%< for CRLF */
+ *buffer = memget(need);
+ if (*buffer == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ *len = need;
+ }
+
+ strcpy(*buffer, pw->pw_name); strcat(*buffer, fieldsep);
+ strcat(*buffer, pw->pw_passwd); strcat(*buffer, fieldsep);
+ strcat(*buffer, pwUid); strcat(*buffer, fieldsep);
+ strcat(*buffer, pwGid); strcat(*buffer, fieldsep);
+ strcat(*buffer, pwClass); strcat(*buffer, fieldsep);
+ strcat(*buffer, pwChange); strcat(*buffer, fieldsep);
+ strcat(*buffer, pwExpire); strcat(*buffer, fieldsep);
+ strcat(*buffer, pw->pw_gecos); strcat(*buffer, fieldsep);
+ strcat(*buffer, pw->pw_dir); strcat(*buffer, fieldsep);
+ strcat(*buffer, pw->pw_shell); strcat(*buffer, fieldsep);
+
+ return (0);
+}
+
+/*%
+ * int irp_unmarshall_pw(struct passwd *pw, char *buffer)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h
+ *
+ * return: \li
+ *
+ * 0 on success, -1 on failure
+ *
+ */
+
+int
+irp_unmarshall_pw(struct passwd *pw, char *buffer) {
+ char *name, *pass, *class, *gecos, *dir, *shell;
+ uid_t pwuid;
+ gid_t pwgid;
+ time_t pwchange;
+ time_t pwexpire;
+ char *p;
+ long t;
+ char tmpbuf[24];
+ char *tb = &tmpbuf[0];
+ char fieldsep = ':';
+ int myerrno = EINVAL;
+
+ name = pass = class = gecos = dir = shell = NULL;
+ p = buffer;
+
+ /* pw_name field */
+ name = NULL;
+ if (getfield(&name, 0, &p, fieldsep) == NULL || strlen(name) == 0) {
+ goto error;
+ }
+
+ /* pw_passwd field */
+ pass = NULL;
+ if (getfield(&pass, 0, &p, fieldsep) == NULL) { /*%< field can be empty */
+ goto error;
+ }
+
+
+ /* pw_uid field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0) {
+ goto error;
+ }
+ t = strtol(tmpbuf, &tb, 10);
+ if (*tb) {
+ goto error; /*%< junk in value */
+ }
+ pwuid = (uid_t)t;
+ if ((long) pwuid != t) { /*%< value must have been too big. */
+ goto error;
+ }
+
+
+
+ /* pw_gid field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0) {
+ goto error;
+ }
+ t = strtol(tmpbuf, &tb, 10);
+ if (*tb) {
+ goto error; /*%< junk in value */
+ }
+ pwgid = (gid_t)t;
+ if ((long)pwgid != t) { /*%< value must have been too big. */
+ goto error;
+ }
+
+
+
+ /* pw_class field */
+ class = NULL;
+ if (getfield(&class, 0, &p, fieldsep) == NULL) {
+ goto error;
+ }
+
+
+
+ /* pw_change field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0) {
+ goto error;
+ }
+ t = strtol(tmpbuf, &tb, 10);
+ if (*tb) {
+ goto error; /*%< junk in value */
+ }
+ pwchange = (time_t)t;
+ if ((long)pwchange != t) { /*%< value must have been too big. */
+ goto error;
+ }
+
+
+
+ /* pw_expire field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0) {
+ goto error;
+ }
+ t = strtol(tmpbuf, &tb, 10);
+ if (*tb) {
+ goto error; /*%< junk in value */
+ }
+ pwexpire = (time_t)t;
+ if ((long) pwexpire != t) { /*%< value must have been too big. */
+ goto error;
+ }
+
+
+
+ /* pw_gecos field */
+ gecos = NULL;
+ if (getfield(&gecos, 0, &p, fieldsep) == NULL) {
+ goto error;
+ }
+
+
+
+ /* pw_dir field */
+ dir = NULL;
+ if (getfield(&dir, 0, &p, fieldsep) == NULL) {
+ goto error;
+ }
+
+
+
+ /* pw_shell field */
+ shell = NULL;
+ if (getfield(&shell, 0, &p, fieldsep) == NULL) {
+ goto error;
+ }
+
+
+
+ pw->pw_name = name;
+ pw->pw_passwd = pass;
+ pw->pw_uid = pwuid;
+ pw->pw_gid = pwgid;
+ pw->pw_gecos = gecos;
+ pw->pw_dir = dir;
+ pw->pw_shell = shell;
+
+#ifdef HAVE_PW_CHANGE
+ pw->pw_change = pwchange;
+#endif
+#ifdef HAVE_PW_CLASS
+ pw->pw_class = class;
+#endif
+#ifdef HAVE_PW_EXPIRE
+ pw->pw_expire = pwexpire;
+#endif
+
+ return (0);
+
+ error:
+ errno = myerrno;
+
+ if (name != NULL) free(name);
+ if (pass != NULL) free(pass);
+ if (gecos != NULL) free(gecos);
+ if (dir != NULL) free(dir);
+ if (shell != NULL) free(shell);
+
+ return (-1);
+}
+
+/* ------------------------- struct passwd ------------------------- */
+#endif /* WANT_IRS_PW */
+/* +++++++++++++++++++++++++ struct group +++++++++++++++++++++++++ */
+
+/*%
+ * int irp_marshall_gr(const struct group *gr, char **buffer, size_t *len)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h.
+ *
+ * return: \li
+ *
+ * 0 on success, -1 on failure
+ */
+
+int
+irp_marshall_gr(const struct group *gr, char **buffer, size_t *len) {
+ size_t need = 1; /*%< for null byte */
+ char grGid[24];
+ const char *fieldsep = COLONSTR;
+
+ if (gr == NULL || len == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ sprintf(grGid, "%ld", (long)gr->gr_gid);
+
+ need += strlen(gr->gr_name) + 1;
+#ifndef MISSING_GR_PASSWD
+ need += strlen(gr->gr_passwd) + 1;
+#else
+ need++;
+#endif
+ need += strlen(grGid) + 1;
+ need += joinlength(gr->gr_mem) + 1;
+
+ if (buffer == NULL) {
+ *len = need;
+ return (0);
+ }
+
+ if (*buffer != NULL && need > *len) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (*buffer == NULL) {
+ need += 2; /*%< for CRLF */
+ *buffer = memget(need);
+ if (*buffer == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ *len = need;
+ }
+
+ strcpy(*buffer, gr->gr_name); strcat(*buffer, fieldsep);
+#ifndef MISSING_GR_PASSWD
+ strcat(*buffer, gr->gr_passwd);
+#endif
+ strcat(*buffer, fieldsep);
+ strcat(*buffer, grGid); strcat(*buffer, fieldsep);
+ joinarray(gr->gr_mem, *buffer, COMMA) ; strcat(*buffer, fieldsep);
+
+ return (0);
+}
+
+/*%
+ * int irp_unmarshall_gr(struct group *gr, char *buffer)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h
+ *
+ * return: \li
+ *
+ * 0 on success and -1 on failure.
+ *
+ */
+
+int
+irp_unmarshall_gr(struct group *gr, char *buffer) {
+ char *p, *q;
+ gid_t grgid;
+ long t;
+ char *name = NULL;
+ char *pass = NULL;
+ char **members = NULL;
+ char tmpbuf[24];
+ char *tb;
+ char fieldsep = ':';
+ int myerrno = EINVAL;
+
+ if (gr == NULL || buffer == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ p = buffer;
+
+ /* gr_name field */
+ name = NULL;
+ if (getfield(&name, 0, &p, fieldsep) == NULL || strlen(name) == 0U) {
+ goto error;
+ }
+
+
+ /* gr_passwd field */
+ pass = NULL;
+ if (getfield(&pass, 0, &p, fieldsep) == NULL) {
+ goto error;
+ }
+
+
+ /* gr_gid field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ t = strtol(tmpbuf, &tb, 10);
+ if (*tb) {
+ goto error; /*%< junk in value */
+ }
+ grgid = (gid_t)t;
+ if ((long) grgid != t) { /*%< value must have been too big. */
+ goto error;
+ }
+
+
+ /* gr_mem field. Member names are separated by commas */
+ q = strchr(p, fieldsep);
+ if (q == NULL) {
+ goto error;
+ }
+ members = splitarray(p, q, COMMA);
+ if (members == NULL) {
+ myerrno = errno;
+ goto error;
+ }
+ p = q + 1;
+
+
+ gr->gr_name = name;
+#ifndef MISSING_GR_PASSWD
+ gr->gr_passwd = pass;
+#endif
+ gr->gr_gid = grgid;
+ gr->gr_mem = members;
+
+ return (0);
+
+ error:
+ errno = myerrno;
+
+ if (name != NULL) free(name);
+ if (pass != NULL) free(pass);
+
+ return (-1);
+}
+
+
+/* ------------------------- struct group ------------------------- */
+
+
+
+
+/* +++++++++++++++++++++++++ struct servent +++++++++++++++++++++++++ */
+
+/*%
+ * int irp_marshall_sv(const struct servent *sv, char **buffer, size_t *len)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h
+ *
+ * return: \li
+ *
+ * 0 on success, -1 on failure.
+ *
+ */
+
+int
+irp_marshall_sv(const struct servent *sv, char **buffer, size_t *len) {
+ size_t need = 1; /*%< for null byte */
+ char svPort[24];
+ const char *fieldsep = COLONSTR;
+ short realport;
+
+ if (sv == NULL || len == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ /* the int s_port field is actually a short in network order. We
+ want host order to make the marshalled data look correct */
+ realport = ntohs((short)sv->s_port);
+ sprintf(svPort, "%d", realport);
+
+ need += strlen(sv->s_name) + 1;
+ need += joinlength(sv->s_aliases) + 1;
+ need += strlen(svPort) + 1;
+ need += strlen(sv->s_proto) + 1;
+
+ if (buffer == NULL) {
+ *len = need;
+ return (0);
+ }
+
+ if (*buffer != NULL && need > *len) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (*buffer == NULL) {
+ need += 2; /*%< for CRLF */
+ *buffer = memget(need);
+ if (*buffer == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ *len = need;
+ }
+
+ strcpy(*buffer, sv->s_name); strcat(*buffer, fieldsep);
+ joinarray(sv->s_aliases, *buffer, COMMA); strcat(*buffer, fieldsep);
+ strcat(*buffer, svPort); strcat(*buffer, fieldsep);
+ strcat(*buffer, sv->s_proto); strcat(*buffer, fieldsep);
+
+ return (0);
+}
+
+/*%
+ * int irp_unmarshall_sv(struct servent *sv, char *buffer)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h
+ *
+ * return: \li
+ *
+ * 0 on success, -1 on failure.
+ *
+ */
+
+int
+irp_unmarshall_sv(struct servent *sv, char *buffer) {
+ char *p, *q;
+ short svport;
+ long t;
+ char *name = NULL;
+ char *proto = NULL;
+ char **aliases = NULL;
+ char tmpbuf[24];
+ char *tb;
+ char fieldsep = ':';
+ int myerrno = EINVAL;
+
+ if (sv == NULL || buffer == NULL)
+ return (-1);
+
+ p = buffer;
+
+
+ /* s_name field */
+ name = NULL;
+ if (getfield(&name, 0, &p, fieldsep) == NULL || strlen(name) == 0U) {
+ goto error;
+ }
+
+
+ /* s_aliases field */
+ q = strchr(p, fieldsep);
+ if (q == NULL) {
+ goto error;
+ }
+ aliases = splitarray(p, q, COMMA);
+ if (aliases == NULL) {
+ myerrno = errno;
+ goto error;
+ }
+ p = q + 1;
+
+
+ /* s_port field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ t = strtol(tmpbuf, &tb, 10);
+ if (*tb) {
+ goto error; /*%< junk in value */
+ }
+ svport = (short)t;
+ if ((long) svport != t) { /*%< value must have been too big. */
+ goto error;
+ }
+ svport = htons(svport);
+
+ /* s_proto field */
+ proto = NULL;
+ if (getfield(&proto, 0, &p, fieldsep) == NULL) {
+ goto error;
+ }
+
+ sv->s_name = name;
+ sv->s_aliases = aliases;
+ sv->s_port = svport;
+ sv->s_proto = proto;
+
+ return (0);
+
+ error:
+ errno = myerrno;
+
+ if (name != NULL) free(name);
+ if (proto != NULL) free(proto);
+ free_array(aliases, 0);
+
+ return (-1);
+}
+
+
+/* ------------------------- struct servent ------------------------- */
+
+/* +++++++++++++++++++++++++ struct protoent +++++++++++++++++++++++++ */
+
+/*%
+ * int irp_marshall_pr(struct protoent *pr, char **buffer, size_t *len)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h
+ *
+ * return: \li
+ *
+ * 0 on success and -1 on failure.
+ *
+ */
+
+int
+irp_marshall_pr(struct protoent *pr, char **buffer, size_t *len) {
+ size_t need = 1; /*%< for null byte */
+ char prProto[24];
+ const char *fieldsep = COLONSTR;
+
+ if (pr == NULL || len == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ sprintf(prProto, "%d", (int)pr->p_proto);
+
+ need += strlen(pr->p_name) + 1;
+ need += joinlength(pr->p_aliases) + 1;
+ need += strlen(prProto) + 1;
+
+ if (buffer == NULL) {
+ *len = need;
+ return (0);
+ }
+
+ if (*buffer != NULL && need > *len) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (*buffer == NULL) {
+ need += 2; /*%< for CRLF */
+ *buffer = memget(need);
+ if (*buffer == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ *len = need;
+ }
+
+ strcpy(*buffer, pr->p_name); strcat(*buffer, fieldsep);
+ joinarray(pr->p_aliases, *buffer, COMMA); strcat(*buffer, fieldsep);
+ strcat(*buffer, prProto); strcat(*buffer, fieldsep);
+
+ return (0);
+
+}
+
+/*%
+ * int irp_unmarshall_pr(struct protoent *pr, char *buffer)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h
+ *
+ * return: \li
+ *
+ * 0 on success, -1 on failure
+ *
+ */
+
+int irp_unmarshall_pr(struct protoent *pr, char *buffer) {
+ char *p, *q;
+ int prproto;
+ long t;
+ char *name = NULL;
+ char **aliases = NULL;
+ char tmpbuf[24];
+ char *tb;
+ char fieldsep = ':';
+ int myerrno = EINVAL;
+
+ if (pr == NULL || buffer == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ p = buffer;
+
+ /* p_name field */
+ name = NULL;
+ if (getfield(&name, 0, &p, fieldsep) == NULL || strlen(name) == 0U) {
+ goto error;
+ }
+
+
+ /* p_aliases field */
+ q = strchr(p, fieldsep);
+ if (q == NULL) {
+ goto error;
+ }
+ aliases = splitarray(p, q, COMMA);
+ if (aliases == NULL) {
+ myerrno = errno;
+ goto error;
+ }
+ p = q + 1;
+
+
+ /* p_proto field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ t = strtol(tmpbuf, &tb, 10);
+ if (*tb) {
+ goto error; /*%< junk in value */
+ }
+ prproto = (int)t;
+ if ((long) prproto != t) { /*%< value must have been too big. */
+ goto error;
+ }
+
+ pr->p_name = name;
+ pr->p_aliases = aliases;
+ pr->p_proto = prproto;
+
+ return (0);
+
+ error:
+ errno = myerrno;
+
+ if (name != NULL) free(name);
+ free_array(aliases, 0);
+
+ return (-1);
+}
+
+/* ------------------------- struct protoent ------------------------- */
+
+
+
+/* +++++++++++++++++++++++++ struct hostent +++++++++++++++++++++++++ */
+
+/*%
+ * int irp_marshall_ho(struct hostent *ho, char **buffer, size_t *len)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h.
+ *
+ * return: \li
+ *
+ * 0 on success, -1 on failure.
+ *
+ */
+
+int
+irp_marshall_ho(struct hostent *ho, char **buffer, size_t *len) {
+ size_t need = 1; /*%< for null byte */
+ char hoaddrtype[24];
+ char holength[24];
+ char **av;
+ char *p;
+ int addrlen;
+ int malloced = 0;
+ size_t remlen;
+ const char *fieldsep = "@";
+
+ if (ho == NULL || len == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ switch(ho->h_addrtype) {
+ case AF_INET:
+ strcpy(hoaddrtype, "AF_INET");
+ break;
+
+ case AF_INET6:
+ strcpy(hoaddrtype, "AF_INET6");
+ break;
+
+ default:
+ errno = EINVAL;
+ return (-1);
+ }
+
+ sprintf(holength, "%d", ho->h_length);
+
+ need += strlen(ho->h_name) + 1;
+ need += joinlength(ho->h_aliases) + 1;
+ need += strlen(hoaddrtype) + 1;
+ need += strlen(holength) + 1;
+
+ /* we determine an upper bound on the string length needed, not an
+ exact length. */
+ addrlen = (ho->h_addrtype == AF_INET ? 16 : 46) ; /*%< XX other AF's?? */
+ for (av = ho->h_addr_list; av != NULL && *av != NULL ; av++)
+ need += addrlen;
+
+ if (buffer == NULL) {
+ *len = need;
+ return (0);
+ }
+
+ if (*buffer != NULL && need > *len) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (*buffer == NULL) {
+ need += 2; /*%< for CRLF */
+ *buffer = memget(need);
+ if (*buffer == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ *len = need;
+ malloced = 1;
+ }
+
+ strcpy(*buffer, ho->h_name); strcat(*buffer, fieldsep);
+ joinarray(ho->h_aliases, *buffer, COMMA); strcat(*buffer, fieldsep);
+ strcat(*buffer, hoaddrtype); strcat(*buffer, fieldsep);
+ strcat(*buffer, holength); strcat(*buffer, fieldsep);
+
+ p = *buffer + strlen(*buffer);
+ remlen = need - strlen(*buffer);
+ for (av = ho->h_addr_list ; av != NULL && *av != NULL ; av++) {
+ if (inet_ntop(ho->h_addrtype, *av, p, remlen) == NULL) {
+ goto error;
+ }
+ if (*(av + 1) != NULL)
+ strcat(p, COMMASTR);
+ remlen -= strlen(p);
+ p += strlen(p);
+ }
+ strcat(*buffer, fieldsep);
+
+ return (0);
+
+ error:
+ if (malloced) {
+ memput(*buffer, need);
+ }
+
+ return (-1);
+}
+
+/*%
+ * int irp_unmarshall_ho(struct hostent *ho, char *buffer)
+ *
+ * notes: \li
+ *
+ * See irpmarshall.h.
+ *
+ * return: \li
+ *
+ * 0 on success, -1 on failure.
+ *
+ */
+
+int
+irp_unmarshall_ho(struct hostent *ho, char *buffer) {
+ char *p, *q, *r;
+ int hoaddrtype;
+ int holength;
+ long t;
+ char *name;
+ char **aliases = NULL;
+ char **hohaddrlist = NULL;
+ size_t hoaddrsize;
+ char tmpbuf[24];
+ char *tb;
+ char **alist;
+ int addrcount;
+ char fieldsep = '@';
+ int myerrno = EINVAL;
+
+ if (ho == NULL || buffer == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ p = buffer;
+
+ /* h_name field */
+ name = NULL;
+ if (getfield(&name, 0, &p, fieldsep) == NULL || strlen(name) == 0U) {
+ goto error;
+ }
+
+
+ /* h_aliases field */
+ q = strchr(p, fieldsep);
+ if (q == NULL) {
+ goto error;
+ }
+ aliases = splitarray(p, q, COMMA);
+ if (aliases == NULL) {
+ myerrno = errno;
+ goto error;
+ }
+ p = q + 1;
+
+
+ /* h_addrtype field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ if (strcmp(tmpbuf, "AF_INET") == 0)
+ hoaddrtype = AF_INET;
+ else if (strcmp(tmpbuf, "AF_INET6") == 0)
+ hoaddrtype = AF_INET6;
+ else
+ goto error;
+
+
+ /* h_length field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ t = strtol(tmpbuf, &tb, 10);
+ if (*tb) {
+ goto error; /*%< junk in value */
+ }
+ holength = (int)t;
+ if ((long) holength != t) { /*%< value must have been too big. */
+ goto error;
+ }
+
+
+ /* h_addr_list field */
+ q = strchr(p, fieldsep);
+ if (q == NULL)
+ goto error;
+
+ /* count how many addresss are in there */
+ if (q > p + 1) {
+ for (addrcount = 1, r = p ; r != q ; r++) {
+ if (*r == COMMA)
+ addrcount++;
+ }
+ } else {
+ addrcount = 0;
+ }
+
+ hoaddrsize = (addrcount + 1) * sizeof (char *);
+ hohaddrlist = malloc(hoaddrsize);
+ if (hohaddrlist == NULL) {
+ myerrno = ENOMEM;
+ goto error;
+ }
+
+ memset(hohaddrlist, 0x0, hoaddrsize);
+
+ alist = hohaddrlist;
+ for (t = 0, r = p ; r != q ; p = r + 1, t++) {
+ char saved;
+ while (r != q && *r != COMMA) r++;
+ saved = *r;
+ *r = 0x0;
+
+ alist[t] = malloc(hoaddrtype == AF_INET ? 4 : 16);
+ if (alist[t] == NULL) {
+ myerrno = ENOMEM;
+ goto error;
+ }
+
+ if (inet_pton(hoaddrtype, p, alist[t]) == -1)
+ goto error;
+ *r = saved;
+ }
+ alist[t] = NULL;
+
+ ho->h_name = name;
+ ho->h_aliases = aliases;
+ ho->h_addrtype = hoaddrtype;
+ ho->h_length = holength;
+ ho->h_addr_list = hohaddrlist;
+
+ return (0);
+
+ error:
+ errno = myerrno;
+
+ if (name != NULL) free(name);
+ free_array(hohaddrlist, 0);
+ free_array(aliases, 0);
+
+ return (-1);
+}
+
+/* ------------------------- struct hostent------------------------- */
+
+
+
+/* +++++++++++++++++++++++++ struct netgrp +++++++++++++++++++++++++ */
+
+/*%
+ * int irp_marshall_ng(const char *host, const char *user,
+ * const char *domain, char *buffer, size_t *len)
+ *
+ * notes: \li
+ *
+ * See note for irp_marshall_ng_start
+ *
+ * return: \li
+ *
+ * 0 on success, 0 on failure.
+ *
+ */
+
+int
+irp_marshall_ng(const char *host, const char *user, const char *domain,
+ char **buffer, size_t *len) {
+ size_t need = 1; /*%< for nul byte */
+ const char *fieldsep = ",";
+
+ if (len == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ need += 4; /*%< two parens and two commas */
+ need += (host == NULL ? 0 : strlen(host));
+ need += (user == NULL ? 0 : strlen(user));
+ need += (domain == NULL ? 0 : strlen(domain));
+
+ if (buffer == NULL) {
+ *len = need;
+ return (0);
+ } else if (*buffer != NULL && need > *len) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (*buffer == NULL) {
+ need += 2; /*%< for CRLF */
+ *buffer = memget(need);
+ if (*buffer == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ *len = need;
+ }
+
+ (*buffer)[0] = '(';
+ (*buffer)[1] = '\0';
+
+ if (host != NULL)
+ strcat(*buffer, host);
+ strcat(*buffer, fieldsep);
+
+ if (user != NULL)
+ strcat(*buffer, user);
+ strcat(*buffer, fieldsep);
+
+ if (domain != NULL)
+ strcat(*buffer, domain);
+ strcat(*buffer, ")");
+
+ return (0);
+}
+
+
+
+/* ---------- */
+
+/*%
+ * int irp_unmarshall_ng(const char **host, const char **user,
+ * const char **domain, char *buffer)
+ *
+ * notes: \li
+ *
+ * Unpacks the BUFFER into 3 character arrays it allocates and assigns
+ * to *HOST, *USER and *DOMAIN. If any field of the value is empty,
+ * then the corresponding paramater value will be set to NULL.
+ *
+ * return: \li
+ *
+ * 0 on success and -1 on failure.
+ */
+
+int
+irp_unmarshall_ng(const char **hostp, const char **userp, const char **domainp,
+ char *buffer)
+{
+ char *p, *q;
+ char fieldsep = ',';
+ int myerrno = EINVAL;
+ char *host, *user, *domain;
+
+ if (userp == NULL || hostp == NULL ||
+ domainp == NULL || buffer == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ host = user = domain = NULL;
+
+ p = buffer;
+ while (isspace((unsigned char)*p)) {
+ p++;
+ }
+ if (*p != '(') {
+ goto error;
+ }
+
+ q = p + 1;
+ while (*q && *q != fieldsep)
+ q++;
+ if (!*q) {
+ goto error;
+ } else if (q > p + 1) {
+ host = strndup(p, q - p);
+ }
+
+ p = q + 1;
+ if (!*p) {
+ goto error;
+ } else if (*p != fieldsep) {
+ q = p + 1;
+ while (*q && *q != fieldsep)
+ q++;
+ if (!*q) {
+ goto error;
+ }
+ user = strndup(p, q - p);
+ } else {
+ p++;
+ }
+
+ if (!*p) {
+ goto error;
+ } else if (*p != ')') {
+ q = p + 1;
+ while (*q && *q != ')')
+ q++;
+ if (!*q) {
+ goto error;
+ }
+ domain = strndup(p, q - p);
+ }
+ *hostp = host;
+ *userp = user;
+ *domainp = domain;
+
+ return (0);
+
+ error:
+ errno = myerrno;
+
+ if (host != NULL) free(host);
+ if (user != NULL) free(user);
+
+ return (-1);
+}
+
+/* ------------------------- struct netgrp ------------------------- */
+
+
+
+
+/* +++++++++++++++++++++++++ struct nwent +++++++++++++++++++++++++ */
+
+/*%
+ * int irp_marshall_nw(struct nwent *ne, char **buffer, size_t *len)
+ *
+ * notes: \li
+ *
+ * See at top.
+ *
+ * return: \li
+ *
+ * 0 on success and -1 on failure.
+ *
+ */
+
+int
+irp_marshall_nw(struct nwent *ne, char **buffer, size_t *len) {
+ size_t need = 1; /*%< for null byte */
+ char nAddrType[24];
+ char nNet[MAXPADDRSIZE];
+ const char *fieldsep = COLONSTR;
+
+ if (ne == NULL || len == NULL) {
+ return (-1);
+ }
+
+ strcpy(nAddrType, ADDR_T_STR(ne->n_addrtype));
+
+ if (inet_net_ntop(ne->n_addrtype, ne->n_addr, ne->n_length,
+ nNet, sizeof nNet) == NULL) {
+ return (-1);
+ }
+
+
+ need += strlen(ne->n_name) + 1;
+ need += joinlength(ne->n_aliases) + 1;
+ need += strlen(nAddrType) + 1;
+ need += strlen(nNet) + 1;
+
+ if (buffer == NULL) {
+ *len = need;
+ return (0);
+ }
+
+ if (*buffer != NULL && need > *len) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (*buffer == NULL) {
+ need += 2; /*%< for CRLF */
+ *buffer = memget(need);
+ if (*buffer == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ *len = need;
+ }
+
+ strcpy(*buffer, ne->n_name); strcat(*buffer, fieldsep);
+ joinarray(ne->n_aliases, *buffer, COMMA) ; strcat(*buffer, fieldsep);
+ strcat(*buffer, nAddrType); strcat(*buffer, fieldsep);
+ strcat(*buffer, nNet); strcat(*buffer, fieldsep);
+
+ return (0);
+}
+
+/*%
+ * int irp_unmarshall_nw(struct nwent *ne, char *buffer)
+ *
+ * notes: \li
+ *
+ * See note up top.
+ *
+ * return: \li
+ *
+ * 0 on success and -1 on failure.
+ *
+ */
+
+int
+irp_unmarshall_nw(struct nwent *ne, char *buffer) {
+ char *p, *q;
+ int naddrtype;
+ long nnet;
+ int bits;
+ char *name = NULL;
+ char **aliases = NULL;
+ char tmpbuf[24];
+ char *tb;
+ char fieldsep = ':';
+ int myerrno = EINVAL;
+
+ if (ne == NULL || buffer == NULL) {
+ goto error;
+ }
+
+ p = buffer;
+
+ /* n_name field */
+ name = NULL;
+ if (getfield(&name, 0, &p, fieldsep) == NULL || strlen(name) == 0U) {
+ goto error;
+ }
+
+
+ /* n_aliases field. Aliases are separated by commas */
+ q = strchr(p, fieldsep);
+ if (q == NULL) {
+ goto error;
+ }
+ aliases = splitarray(p, q, COMMA);
+ if (aliases == NULL) {
+ myerrno = errno;
+ goto error;
+ }
+ p = q + 1;
+
+
+ /* h_addrtype field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ if (strcmp(tmpbuf, "AF_INET") == 0)
+ naddrtype = AF_INET;
+ else if (strcmp(tmpbuf, "AF_INET6") == 0)
+ naddrtype = AF_INET6;
+ else
+ goto error;
+
+
+ /* n_net field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ nnet = 0;
+ bits = inet_net_pton(naddrtype, tmpbuf, &nnet, sizeof nnet);
+ if (bits < 0) {
+ goto error;
+ }
+
+ /* nnet = ntohl(nnet); */ /* keep in network order for nwent */
+
+ ne->n_name = name;
+ ne->n_aliases = aliases;
+ ne->n_addrtype = naddrtype;
+ ne->n_length = bits;
+ ne->n_addr = malloc(sizeof nnet);
+ if (ne->n_addr == NULL) {
+ goto error;
+ }
+
+ memcpy(ne->n_addr, &nnet, sizeof nnet);
+
+ return (0);
+
+ error:
+ errno = myerrno;
+
+ if (name != NULL) free(name);
+ free_array(aliases, 0);
+
+ return (-1);
+}
+
+
+/* ------------------------- struct nwent ------------------------- */
+
+
+/* +++++++++++++++++++++++++ struct netent +++++++++++++++++++++++++ */
+
+/*%
+ * int irp_marshall_ne(struct netent *ne, char **buffer, size_t *len)
+ *
+ * notes: \li
+ *
+ * See at top.
+ *
+ * return: \li
+ *
+ * 0 on success and -1 on failure.
+ *
+ */
+
+int
+irp_marshall_ne(struct netent *ne, char **buffer, size_t *len) {
+ size_t need = 1; /*%< for null byte */
+ char nAddrType[24];
+ char nNet[MAXPADDRSIZE];
+ const char *fieldsep = COLONSTR;
+ long nval;
+
+ if (ne == NULL || len == NULL) {
+ return (-1);
+ }
+
+ strcpy(nAddrType, ADDR_T_STR(ne->n_addrtype));
+
+ nval = htonl(ne->n_net);
+ if (inet_ntop(ne->n_addrtype, &nval, nNet, sizeof nNet) == NULL) {
+ return (-1);
+ }
+
+ need += strlen(ne->n_name) + 1;
+ need += joinlength(ne->n_aliases) + 1;
+ need += strlen(nAddrType) + 1;
+ need += strlen(nNet) + 1;
+
+ if (buffer == NULL) {
+ *len = need;
+ return (0);
+ }
+
+ if (*buffer != NULL && need > *len) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (*buffer == NULL) {
+ need += 2; /*%< for CRLF */
+ *buffer = memget(need);
+ if (*buffer == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ *len = need;
+ }
+
+ strcpy(*buffer, ne->n_name); strcat(*buffer, fieldsep);
+ joinarray(ne->n_aliases, *buffer, COMMA) ; strcat(*buffer, fieldsep);
+ strcat(*buffer, nAddrType); strcat(*buffer, fieldsep);
+ strcat(*buffer, nNet); strcat(*buffer, fieldsep);
+
+ return (0);
+}
+
+/*%
+ * int irp_unmarshall_ne(struct netent *ne, char *buffer)
+ *
+ * notes: \li
+ *
+ * See note up top.
+ *
+ * return: \li
+ *
+ * 0 on success and -1 on failure.
+ *
+ */
+
+int
+irp_unmarshall_ne(struct netent *ne, char *buffer) {
+ char *p, *q;
+ int naddrtype;
+ long nnet;
+ int bits;
+ char *name = NULL;
+ char **aliases = NULL;
+ char tmpbuf[24];
+ char *tb;
+ char fieldsep = ':';
+ int myerrno = EINVAL;
+
+ if (ne == NULL || buffer == NULL) {
+ goto error;
+ }
+
+ p = buffer;
+
+ /* n_name field */
+ name = NULL;
+ if (getfield(&name, 0, &p, fieldsep) == NULL || strlen(name) == 0U) {
+ goto error;
+ }
+
+
+ /* n_aliases field. Aliases are separated by commas */
+ q = strchr(p, fieldsep);
+ if (q == NULL) {
+ goto error;
+ }
+ aliases = splitarray(p, q, COMMA);
+ if (aliases == NULL) {
+ myerrno = errno;
+ goto error;
+ }
+ p = q + 1;
+
+
+ /* h_addrtype field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ if (strcmp(tmpbuf, "AF_INET") == 0)
+ naddrtype = AF_INET;
+ else if (strcmp(tmpbuf, "AF_INET6") == 0)
+ naddrtype = AF_INET6;
+ else
+ goto error;
+
+
+ /* n_net field */
+ tb = tmpbuf;
+ if (getfield(&tb, sizeof tmpbuf, &p, fieldsep) == NULL ||
+ strlen(tb) == 0U) {
+ goto error;
+ }
+ bits = inet_net_pton(naddrtype, tmpbuf, &nnet, sizeof nnet);
+ if (bits < 0) {
+ goto error;
+ }
+ nnet = ntohl(nnet);
+
+ ne->n_name = name;
+ ne->n_aliases = aliases;
+ ne->n_addrtype = naddrtype;
+ ne->n_net = nnet;
+
+ return (0);
+
+ error:
+ errno = myerrno;
+
+ if (name != NULL) free(name);
+ free_array(aliases, 0);
+
+ return (-1);
+}
+
+
+/* ------------------------- struct netent ------------------------- */
+
+
+/* =========================================================================== */
+
+/*%
+ * static char ** splitarray(const char *buffer, const char *buffend, char delim)
+ *
+ * notes: \li
+ *
+ * Split a delim separated astring. Not allowed
+ * to have two delims next to each other. BUFFER points to begining of
+ * string, BUFFEND points to one past the end of the string
+ * (i.e. points at where the null byte would be if null
+ * terminated).
+ *
+ * return: \li
+ *
+ * Returns a malloced array of pointers, each pointer pointing to a
+ * malloced string. If BUFEER is an empty string, then return values is
+ * array of 1 pointer that is NULL. Returns NULL on failure.
+ *
+ */
+
+static char **
+splitarray(const char *buffer, const char *buffend, char delim) {
+ const char *p, *q;
+ int count = 0;
+ char **arr = NULL;
+ char **aptr;
+
+ if (buffend < buffer)
+ return (NULL);
+ else if (buffend > buffer && *buffer == delim)
+ return (NULL);
+ else if (buffend > buffer && *(buffend - 1) == delim)
+ return (NULL);
+
+ /* count the number of field and make sure none are empty */
+ if (buffend > buffer + 1) {
+ for (count = 1, q = buffer ; q != buffend ; q++) {
+ if (*q == delim) {
+ if (q > buffer && (*(q - 1) == delim)) {
+ errno = EINVAL;
+ return (NULL);
+ }
+ count++;
+ }
+ }
+ }
+
+ if (count > 0) {
+ count++ ; /*%< for NULL at end */
+ aptr = arr = malloc(count * sizeof (char *));
+ if (aptr == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+
+ memset(arr, 0x0, count * sizeof (char *));
+ for (p = buffer ; p < buffend ; p++) {
+ for (q = p ; *q != delim && q != buffend ; q++)
+ /* nothing */;
+ *aptr = strndup(p, q - p);
+
+ p = q;
+ aptr++;
+ }
+ *aptr = NULL;
+ } else {
+ arr = malloc(sizeof (char *));
+ if (arr == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+
+ *arr = NULL;
+ }
+
+ return (arr);
+}
+
+/*%
+ * static size_t joinlength(char * const *argv)
+ *
+ * return: \li
+ *
+ * the number of bytes in all the arrays pointed at
+ * by argv, including their null bytes(which will usually be turned
+ * into commas).
+ *
+ *
+ */
+
+static size_t
+joinlength(char * const *argv) {
+ int len = 0;
+
+ while (argv && *argv) {
+ len += (strlen(*argv) + 1);
+ argv++;
+ }
+
+ return (len);
+}
+
+/*%
+ * int joinarray(char * const *argv, char *buffer, char delim)
+ *
+ * notes: \li
+ *
+ * Copy all the ARGV strings into the end of BUFFER
+ * separating them with DELIM. BUFFER is assumed to have
+ * enough space to hold everything and to be already null-terminated.
+ *
+ * return: \li
+ *
+ * 0 unless argv or buffer is NULL.
+ *
+ *
+ */
+
+static int
+joinarray(char * const *argv, char *buffer, char delim) {
+ char * const *p;
+ char sep[2];
+
+ if (argv == NULL || buffer == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ sep[0] = delim;
+ sep[1] = 0x0;
+
+ for (p = argv ; *p != NULL ; p++) {
+ strcat(buffer, *p);
+ if (*(p + 1) != NULL) {
+ strcat(buffer, sep);
+ }
+ }
+
+ return (0);
+}
+
+/*%
+ * static char * getfield(char **res, size_t reslen, char **ptr, char delim)
+ *
+ * notes: \li
+ *
+ * Stores in *RES, which is a buffer of length RESLEN, a
+ * copy of the bytes from *PTR up to and including the first
+ * instance of DELIM. If *RES is NULL, then it will be
+ * assigned a malloced buffer to hold the copy. *PTR is
+ * modified to point at the found delimiter.
+ *
+ * return: \li
+ *
+ * If there was no delimiter, then NULL is returned,
+ * otherewise *RES is returned.
+ *
+ */
+
+static char *
+getfield(char **res, size_t reslen, char **ptr, char delim) {
+ char *q;
+
+ if (res == NULL || ptr == NULL || *ptr == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ q = strchr(*ptr, delim);
+
+ if (q == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ } else {
+ if (*res == NULL) {
+ *res = strndup(*ptr, q - *ptr);
+ } else {
+ if ((size_t)(q - *ptr + 1) > reslen) { /*%< to big for res */
+ errno = EINVAL;
+ return (NULL);
+ } else {
+ strncpy(*res, *ptr, q - *ptr);
+ (*res)[q - *ptr] = 0x0;
+ }
+ }
+ *ptr = q + 1;
+ }
+
+ return (*res);
+}
+
+
+
+
+
+#ifndef HAVE_STRNDUP
+/*
+ * static char * strndup(const char *str, size_t len)
+ *
+ * notes: \li
+ *
+ * like strdup, except do len bytes instead of the whole string. Always
+ * null-terminates.
+ *
+ * return: \li
+ *
+ * The newly malloced string.
+ *
+ */
+
+static char *
+strndup(const char *str, size_t len) {
+ char *p = malloc(len + 1);
+
+ if (p == NULL)
+ return (NULL);
+ strncpy(p, str, len);
+ p[len] = 0x0;
+ return (p);
+}
+#endif
+
+#if WANT_MAIN
+
+/*%
+ * static int strcmp_nws(const char *a, const char *b)
+ *
+ * notes: \li
+ *
+ * do a strcmp, except uneven lengths of whitespace compare the same
+ *
+ * return: \li
+ *
+ */
+
+static int
+strcmp_nws(const char *a, const char *b) {
+ while (*a && *b) {
+ if (isspace(*a) && isspace(*b)) {
+ do {
+ a++;
+ } while (isspace(*a));
+ do {
+ b++;
+ } while (isspace(*b));
+ }
+ if (*a < *b)
+ return (-1);
+ else if (*a > *b)
+ return (1);
+
+ a++;
+ b++;;
+ }
+
+ if (*a == *b)
+ return (0);
+ else if (*a > *b)
+ return (1);
+ else
+ return (-1);
+}
+
+#endif
+
+/*%
+ * static void free_array(char **argv, size_t entries)
+ *
+ * notes: \li
+ *
+ * Free argv and each of the pointers inside it. The end of
+ * the array is when a NULL pointer is found inside. If
+ * entries is > 0, then NULL pointers inside the array do
+ * not indicate the end of the array.
+ *
+ */
+
+static void
+free_array(char **argv, size_t entries) {
+ char **p = argv;
+ int useEntries = (entries > 0U);
+
+ if (argv == NULL)
+ return;
+
+ while ((useEntries && entries > 0U) || *p) {
+ if (*p)
+ free(*p);
+ p++;
+ if (useEntries)
+ entries--;
+ }
+ free(argv);
+}
+
+
+
+
+
+/* ************************************************** */
+
+#if WANT_MAIN
+
+/*% takes an option to indicate what sort of marshalling(read the code) and
+ an argument. If the argument looks like a marshalled buffer(has a ':'
+ embedded) then it's unmarshalled and the remarshalled and the new string
+ is compared to the old one.
+*/
+
+int
+main(int argc, char **argv) {
+ char buffer[1024];
+ char *b = &buffer[0];
+ size_t len = sizeof buffer;
+ char option;
+
+ if (argc < 2 || argv[1][0] != '-')
+ exit(1);
+
+ option = argv[1][1];
+ argv++;
+ argc--;
+
+
+#if 0
+ {
+ char buff[10];
+ char *p = argv[1], *q = &buff[0];
+
+ while (getfield(&q, sizeof buff, &p, ':') != NULL) {
+ printf("field: \"%s\"\n", q);
+ p++;
+ }
+ printf("p is now \"%s\"\n", p);
+ }
+#endif
+
+#if 0
+ {
+ char **x = splitarray(argv[1], argv[1] + strlen(argv[1]),
+ argv[2][0]);
+ char **p;
+
+ if (x == NULL)
+ printf("split failed\n");
+
+ for (p = x ; p != NULL && *p != NULL ; p++) {
+ printf("\"%s\"\n", *p);
+ }
+ }
+#endif
+
+#if 1
+ switch(option) {
+ case 'n': {
+ struct nwent ne;
+ int i;
+
+ if (strchr(argv[1], ':') != NULL) {
+ if (irp_unmarshall_nw(&ne, argv[1]) != 0) {
+ printf("Unmarhsalling failed\n");
+ exit(1);
+ }
+
+ printf("Name: \"%s\"\n", ne.n_name);
+ printf("Aliases:");
+ for (i = 0 ; ne.n_aliases[i] != NULL ; i++)
+ printf("\n\t\"%s\"", ne.n_aliases[i]);
+ printf("\nAddrtype: %s\n", ADDR_T_STR(ne.n_addrtype));
+ inet_net_ntop(ne.n_addrtype, ne.n_addr, ne.n_length,
+ buffer, sizeof buffer);
+ printf("Net: \"%s\"\n", buffer);
+ *((long*)ne.n_addr) = htonl(*((long*)ne.n_addr));
+ inet_net_ntop(ne.n_addrtype, ne.n_addr, ne.n_length,
+ buffer, sizeof buffer);
+ printf("Corrected Net: \"%s\"\n", buffer);
+ } else {
+ struct netent *np1 = getnetbyname(argv[1]);
+ ne.n_name = np1->n_name;
+ ne.n_aliases = np1->n_aliases;
+ ne.n_addrtype = np1->n_addrtype;
+ ne.n_addr = &np1->n_net;
+ ne.n_length = (IN_CLASSA(np1->n_net) ?
+ 8 :
+ (IN_CLASSB(np1->n_net) ?
+ 16 :
+ (IN_CLASSC(np1->n_net) ?
+ 24 : -1)));
+ np1->n_net = htonl(np1->n_net);
+ if (irp_marshall_nw(&ne, &b, &len) != 0) {
+ printf("Marshalling failed\n");
+ }
+ printf("%s\n", b);
+ }
+ break;
+ }
+
+
+ case 'r': {
+ char **hosts, **users, **domains;
+ size_t entries;
+ int i;
+ char *buff;
+ size_t size;
+ char *ngname;
+
+ if (strchr(argv[1], '(') != NULL) {
+ if (irp_unmarshall_ng(&ngname, &entries,
+ &hosts, &users, &domains,
+ argv[1]) != 0) {
+ printf("unmarshall failed\n");
+ exit(1);
+ }
+
+#define STRVAL(x) (x == NULL ? "*" : x)
+
+ printf("%s {\n", ngname);
+ for (i = 0 ; i < entries ; i++)
+ printf("\t\"%s\" : \"%s\" : \"%s\"\n",
+ STRVAL(hosts[i]),
+ STRVAL(users[i]),
+ STRVAL(domains[i]));
+ printf("}\n\n\n");
+
+
+ irp_marshall_ng_start(ngname, NULL, &size);
+ for (i = 0 ; i < entries ; i++)
+ irp_marshall_ng_next(hosts[i], users[i],
+ domains[i], NULL, &size);
+ irp_marshall_ng_end(NULL, &size);
+
+ buff = malloc(size);
+
+ irp_marshall_ng_start(ngname, buff, &size);
+ for (i = 0 ; i < entries ; i++) {
+ if (irp_marshall_ng_next(hosts[i], users[i],
+ domains[i], buff,
+ &size) != 0)
+ printf("next marshalling failed.\n");
+ }
+ irp_marshall_ng_end(buff, &size);
+
+ if (strcmp_nws(argv[1], buff) != 0) {
+ printf("compare failed:\n\t%s\n\t%s\n",
+ buffer, argv[1]);
+ } else {
+ printf("compare ok\n");
+ }
+ } else {
+ char *h, *u, *d, *buff;
+ size_t size;
+
+ /* run through two times. First to figure out how
+ much of a buffer we need. Second to do the
+ actual marshalling */
+
+ setnetgrent(argv[1]);
+ irp_marshall_ng_start(argv[1], NULL, &size);
+ while (getnetgrent(&h, &u, &d) == 1)
+ irp_marshall_ng_next(h, u, d, NULL, &size);
+ irp_marshall_ng_end(NULL, &size);
+ endnetgrent(argv[1]);
+
+ buff = malloc(size);
+
+ setnetgrent(argv[1]);
+ if (irp_marshall_ng_start(argv[1], buff, &size) != 0)
+ printf("Marshalling start failed\n");
+
+ while (getnetgrent(&h, &u, &d) == 1) {
+ if (irp_marshall_ng_next(h, u, d, buff, &size)
+ != 0) {
+ printf("Marshalling failed\n");
+ }
+ }
+
+ irp_marshall_ng_end(buff, &size);
+ endnetgrent();
+
+ printf("success: %s\n", buff);
+ }
+ break;
+ }
+
+
+
+ case 'h': {
+ struct hostent he, *hp;
+ int i;
+
+
+ if (strchr(argv[1], '@') != NULL) {
+ if (irp_unmarshall_ho(&he, argv[1]) != 0) {
+ printf("unmarshall failed\n");
+ exit(1);
+ }
+
+ printf("Host: \"%s\"\nAliases:", he.h_name);
+ for (i = 0 ; he.h_aliases[i] != NULL ; i++)
+ printf("\n\t\t\"%s\"", he.h_aliases[i]);
+ printf("\nAddr Type: \"%s\"\n",
+ ADDR_T_STR(he.h_addrtype));
+ printf("Length: %d\nAddresses:", he.h_length);
+ for (i = 0 ; he.h_addr_list[i] != 0 ; i++) {
+ inet_ntop(he.h_addrtype, he.h_addr_list[i],
+ buffer, sizeof buffer);
+ printf("\n\t\"%s\"\n", buffer);
+ }
+ printf("\n\n");
+
+ irp_marshall_ho(&he, &b, &len);
+ if (strcmp(argv[1], buffer) != 0) {
+ printf("compare failed:\n\t\"%s\"\n\t\"%s\"\n",
+ buffer, argv[1]);
+ } else {
+ printf("compare ok\n");
+ }
+ } else {
+ if ((hp = gethostbyname(argv[1])) == NULL) {
+ perror("gethostbyname");
+ printf("\"%s\"\n", argv[1]);
+ exit(1);
+ }
+
+ if (irp_marshall_ho(hp, &b, &len) != 0) {
+ printf("irp_marshall_ho failed\n");
+ exit(1);
+ }
+
+ printf("success: \"%s\"\n", buffer);
+ }
+ break;
+ }
+
+
+ case 's': {
+ struct servent *sv;
+ struct servent sv1;
+
+ if (strchr(argv[1], ':') != NULL) {
+ sv = &sv1;
+ memset(sv, 0xef, sizeof (struct servent));
+ if (irp_unmarshall_sv(sv, argv[1]) != 0) {
+ printf("unmarshall failed\n");
+
+ }
+
+ irp_marshall_sv(sv, &b, &len);
+ if (strcmp(argv[1], buffer) != 0) {
+ printf("compare failed:\n\t\"%s\"\n\t\"%s\"\n",
+ buffer, argv[1]);
+ } else {
+ printf("compare ok\n");
+ }
+ } else {
+ if ((sv = getservbyname(argv[1], argv[2])) == NULL) {
+ perror("getservent");
+ exit(1);
+ }
+
+ if (irp_marshall_sv(sv, &b, &len) != 0) {
+ printf("irp_marshall_sv failed\n");
+ exit(1);
+ }
+
+ printf("success: \"%s\"\n", buffer);
+ }
+ break;
+ }
+
+ case 'g': {
+ struct group *gr;
+ struct group gr1;
+
+ if (strchr(argv[1], ':') != NULL) {
+ gr = &gr1;
+ memset(gr, 0xef, sizeof (struct group));
+ if (irp_unmarshall_gr(gr, argv[1]) != 0) {
+ printf("unmarshall failed\n");
+
+ }
+
+ irp_marshall_gr(gr, &b, &len);
+ if (strcmp(argv[1], buffer) != 0) {
+ printf("compare failed:\n\t\"%s\"\n\t\"%s\"\n",
+ buffer, argv[1]);
+ } else {
+ printf("compare ok\n");
+ }
+ } else {
+ if ((gr = getgrnam(argv[1])) == NULL) {
+ perror("getgrnam");
+ exit(1);
+ }
+
+ if (irp_marshall_gr(gr, &b, &len) != 0) {
+ printf("irp_marshall_gr failed\n");
+ exit(1);
+ }
+
+ printf("success: \"%s\"\n", buffer);
+ }
+ break;
+ }
+
+
+ case 'p': {
+ struct passwd *pw;
+ struct passwd pw1;
+
+ if (strchr(argv[1], ':') != NULL) {
+ pw = &pw1;
+ memset(pw, 0xef, sizeof (*pw));
+ if (irp_unmarshall_pw(pw, argv[1]) != 0) {
+ printf("unmarshall failed\n");
+ exit(1);
+ }
+
+ printf("User: \"%s\"\nPasswd: \"%s\"\nUid: %ld\nGid: %ld\n",
+ pw->pw_name, pw->pw_passwd, (long)pw->pw_uid,
+ (long)pw->pw_gid);
+ printf("Class: \"%s\"\nChange: %ld\nGecos: \"%s\"\n",
+ pw->pw_class, (long)pw->pw_change, pw->pw_gecos);
+ printf("Shell: \"%s\"\nDirectory: \"%s\"\n",
+ pw->pw_shell, pw->pw_dir);
+
+ pw = getpwnam(pw->pw_name);
+ irp_marshall_pw(pw, &b, &len);
+ if (strcmp(argv[1], buffer) != 0) {
+ printf("compare failed:\n\t\"%s\"\n\t\"%s\"\n",
+ buffer, argv[1]);
+ } else {
+ printf("compare ok\n");
+ }
+ } else {
+ if ((pw = getpwnam(argv[1])) == NULL) {
+ perror("getpwnam");
+ exit(1);
+ }
+
+ if (irp_marshall_pw(pw, &b, &len) != 0) {
+ printf("irp_marshall_pw failed\n");
+ exit(1);
+ }
+
+ printf("success: \"%s\"\n", buffer);
+ }
+ break;
+ }
+
+ default:
+ printf("Wrong option: %c\n", option);
+ break;
+ }
+
+#endif
+
+ return (0);
+}
+
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irs_data.c b/usr/src/lib/libresolv2_joy/common/irs/irs_data.c
new file mode 100644
index 0000000000..f12ca20f38
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irs_data.c
@@ -0,0 +1,254 @@
+/*
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: irs_data.c,v 1.12 2007/08/27 03:32:26 marka Exp $";
+#endif
+
+#include "port_before.h"
+
+#ifndef __BIND_NOSTATIC
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <string.h>
+#include <isc/memcluster.h>
+
+#ifdef DO_PTHREADS
+#include <pthread.h>
+#endif
+
+#include <irs.h>
+#include <stdlib.h>
+
+#include "port_after.h"
+
+#include "irs_data.h"
+#undef _res
+#if !(__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
+#undef h_errno
+extern int h_errno;
+#endif
+
+extern struct __res_state _res;
+
+#ifdef DO_PTHREADS
+static pthread_key_t key;
+static int once = 0;
+#else
+static struct net_data *net_data;
+#endif
+
+void
+irs_destroy(void) {
+#ifndef DO_PTHREADS
+ if (net_data != NULL)
+ net_data_destroy(net_data);
+ net_data = NULL;
+#endif
+}
+
+void
+net_data_destroy(void *p) {
+ struct net_data *net_data = p;
+
+ res_ndestroy(net_data->res);
+ if (net_data->gr != NULL) {
+ (*net_data->gr->close)(net_data->gr);
+ net_data->gr = NULL;
+ }
+ if (net_data->pw != NULL) {
+ (*net_data->pw->close)(net_data->pw);
+ net_data->pw = NULL;
+ }
+ if (net_data->sv != NULL) {
+ (*net_data->sv->close)(net_data->sv);
+ net_data->sv = NULL;
+ }
+ if (net_data->pr != NULL) {
+ (*net_data->pr->close)(net_data->pr);
+ net_data->pr = NULL;
+ }
+ if (net_data->ho != NULL) {
+ (*net_data->ho->close)(net_data->ho);
+ net_data->ho = NULL;
+ }
+ if (net_data->nw != NULL) {
+ (*net_data->nw->close)(net_data->nw);
+ net_data->nw = NULL;
+ }
+ if (net_data->ng != NULL) {
+ (*net_data->ng->close)(net_data->ng);
+ net_data->ng = NULL;
+ }
+ if (net_data->ho_data != NULL) {
+ free(net_data->ho_data);
+ net_data->ho_data = NULL;
+ }
+ if (net_data->nw_data != NULL) {
+ free(net_data->nw_data);
+ net_data->nw_data = NULL;
+ }
+
+ (*net_data->irs->close)(net_data->irs);
+ memput(net_data, sizeof *net_data);
+}
+
+/*%
+ * applications that need a specific config file other than
+ * _PATH_IRS_CONF should call net_data_init directly rather than letting
+ * the various wrapper functions make the first call. - brister
+ */
+
+struct net_data *
+net_data_init(const char *conf_file) {
+#ifdef DO_PTHREADS
+#ifndef LIBBIND_MUTEX_INITIALIZER
+#define LIBBIND_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#endif
+ static pthread_mutex_t keylock = LIBBIND_MUTEX_INITIALIZER;
+ struct net_data *net_data;
+
+ if (!once) {
+ if (pthread_mutex_lock(&keylock) != 0)
+ return (NULL);
+ if (!once) {
+ if (pthread_key_create(&key, net_data_destroy) != 0) {
+ (void)pthread_mutex_unlock(&keylock);
+ return (NULL);
+ }
+ once = 1;
+ }
+ if (pthread_mutex_unlock(&keylock) != 0)
+ return (NULL);
+ }
+ net_data = pthread_getspecific(key);
+#endif
+
+ if (net_data == NULL) {
+ net_data = net_data_create(conf_file);
+ if (net_data == NULL)
+ return (NULL);
+#ifdef DO_PTHREADS
+ if (pthread_setspecific(key, net_data) != 0) {
+ net_data_destroy(net_data);
+ return (NULL);
+ }
+#endif
+ }
+
+ return (net_data);
+}
+
+struct net_data *
+net_data_create(const char *conf_file) {
+ struct net_data *net_data;
+
+ net_data = memget(sizeof (struct net_data));
+ if (net_data == NULL)
+ return (NULL);
+ memset(net_data, 0, sizeof (struct net_data));
+
+ if ((net_data->irs = irs_gen_acc("", conf_file)) == NULL) {
+ memput(net_data, sizeof (struct net_data));
+ return (NULL);
+ }
+#ifndef DO_PTHREADS
+ (*net_data->irs->res_set)(net_data->irs, &_res, NULL);
+#endif
+
+ net_data->res = (*net_data->irs->res_get)(net_data->irs);
+ if (net_data->res == NULL) {
+ (*net_data->irs->close)(net_data->irs);
+ memput(net_data, sizeof (struct net_data));
+ return (NULL);
+ }
+
+ if ((net_data->res->options & RES_INIT) == 0U &&
+ res_ninit(net_data->res) == -1) {
+ (*net_data->irs->close)(net_data->irs);
+ memput(net_data, sizeof (struct net_data));
+ return (NULL);
+ }
+
+ return (net_data);
+}
+
+void
+net_data_minimize(struct net_data *net_data) {
+ res_nclose(net_data->res);
+}
+
+#ifdef _REENTRANT
+struct __res_state *
+__res_state(void) {
+ /* NULL param here means use the default config file. */
+ struct net_data *net_data = net_data_init(NULL);
+ if (net_data && net_data->res)
+ return (net_data->res);
+
+ return (&_res);
+}
+#else
+#ifdef __linux
+struct __res_state *
+__res_state(void) {
+ return (&_res);
+}
+#endif
+#endif
+
+int *
+__h_errno(void) {
+ /* NULL param here means use the default config file. */
+ struct net_data *net_data = net_data_init(NULL);
+ if (net_data && net_data->res)
+ return (&net_data->res->res_h_errno);
+#ifdef ORIGINAL_ISC_CODE
+#if !(__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
+ return(&_res.res_h_errno);
+#else
+ return (&h_errno);
+#endif
+#else
+ return (&h_errno);
+#endif /* ORIGINAL_ISC_CODE */
+}
+
+void
+__h_errno_set(struct __res_state *res, int err) {
+
+
+#if (__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
+ res->res_h_errno = err;
+#else
+ h_errno = res->res_h_errno = err;
+#endif
+}
+
+#endif /*__BIND_NOSTATIC*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irs_data.h b/usr/src/lib/libresolv2_joy/common/irs/irs_data.h
new file mode 100644
index 0000000000..cb814fd8b1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irs_data.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: irs_data.h,v 1.3 2005/04/27 04:56:30 sra Exp $
+ */
+
+#ifndef __BIND_NOSTATIC
+
+#define net_data_init __net_data_init
+
+struct net_data {
+ struct irs_acc * irs;
+
+ struct irs_gr * gr;
+ struct irs_pw * pw;
+ struct irs_sv * sv;
+ struct irs_pr * pr;
+ struct irs_ho * ho;
+ struct irs_nw * nw;
+ struct irs_ng * ng;
+
+ struct group * gr_last;
+ struct passwd * pw_last;
+ struct servent * sv_last;
+ struct protoent * pr_last;
+ struct netent * nw_last; /*%< should have been ne_last */
+ struct nwent * nww_last;
+ struct hostent * ho_last;
+
+ unsigned int gr_stayopen :1;
+ unsigned int pw_stayopen :1;
+ unsigned int sv_stayopen :1;
+ unsigned int pr_stayopen :1;
+ unsigned int ho_stayopen :1;
+ unsigned int nw_stayopen :1;
+
+ void * nw_data;
+ void * ho_data;
+
+ struct __res_state * res; /*%< for gethostent.c */
+};
+
+extern struct net_data * net_data_init(const char *conf_file);
+extern void net_data_minimize(struct net_data *);
+
+#endif /*__BIND_NOSTATIC*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/irs_p.h b/usr/src/lib/libresolv2_joy/common/irs/irs_p.h
new file mode 100644
index 0000000000..2a0a933fce
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/irs_p.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: irs_p.h,v 1.3 2005/04/27 04:56:30 sra Exp $
+ */
+
+#ifndef _IRS_P_H_INCLUDED
+#define _IRS_P_H_INCLUDED
+
+#include <stdio.h>
+
+#include "pathnames.h"
+
+#define IRS_SV_MAXALIASES 35
+
+struct lcl_sv {
+ FILE * fp;
+ char line[BUFSIZ+1];
+ struct servent serv;
+ char * serv_aliases[IRS_SV_MAXALIASES];
+};
+
+#define irs_nul_ng __irs_nul_ng
+#define map_v4v6_address __map_v4v6_address
+#define make_group_list __make_group_list
+#define irs_lclsv_fnxt __irs_lclsv_fnxt
+
+extern void map_v4v6_address(const char *src, char *dst);
+extern int make_group_list(struct irs_gr *, const char *,
+ gid_t, gid_t *, int *);
+extern struct irs_ng * irs_nul_ng(struct irs_acc *);
+extern struct servent * irs_lclsv_fnxt(struct lcl_sv *);
+
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/lcl.c b/usr/src/lib/libresolv2_joy/common/irs/lcl.c
new file mode 100644
index 0000000000..9dd6967b87
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/lcl.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: lcl.c,v 1.4 2005/04/27 04:56:30 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <isc/memcluster.h>
+
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "lcl_p.h"
+
+/* Forward. */
+
+static void lcl_close(struct irs_acc *);
+static struct __res_state * lcl_res_get(struct irs_acc *);
+static void lcl_res_set(struct irs_acc *, struct __res_state *,
+ void (*)(void *));
+
+/* Public */
+
+struct irs_acc *
+irs_lcl_acc(const char *options) {
+ struct irs_acc *acc;
+ struct lcl_p *lcl;
+
+ UNUSED(options);
+
+ if (!(acc = memget(sizeof *acc))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(acc, 0x5e, sizeof *acc);
+ if (!(lcl = memget(sizeof *lcl))) {
+ errno = ENOMEM;
+ free(acc);
+ return (NULL);
+ }
+ memset(lcl, 0x5e, sizeof *lcl);
+ lcl->res = NULL;
+ lcl->free_res = NULL;
+ acc->private = lcl;
+#ifdef WANT_IRS_GR
+ acc->gr_map = irs_lcl_gr;
+#else
+ acc->gr_map = NULL;
+#endif
+#ifdef WANT_IRS_PW
+ acc->pw_map = irs_lcl_pw;
+#else
+ acc->pw_map = NULL;
+#endif
+ acc->sv_map = irs_lcl_sv;
+ acc->pr_map = irs_lcl_pr;
+ acc->ho_map = irs_lcl_ho;
+ acc->nw_map = irs_lcl_nw;
+ acc->ng_map = irs_lcl_ng;
+ acc->res_get = lcl_res_get;
+ acc->res_set = lcl_res_set;
+ acc->close = lcl_close;
+ return (acc);
+}
+
+/* Methods */
+static struct __res_state *
+lcl_res_get(struct irs_acc *this) {
+ struct lcl_p *lcl = (struct lcl_p *)this->private;
+
+ if (lcl->res == NULL) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (res == NULL)
+ return (NULL);
+ memset(res, 0, sizeof *res);
+ lcl_res_set(this, res, free);
+ }
+
+ if ((lcl->res->options & RES_INIT) == 0U &&
+ res_ninit(lcl->res) < 0)
+ return (NULL);
+
+ return (lcl->res);
+}
+
+static void
+lcl_res_set(struct irs_acc *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct lcl_p *lcl = (struct lcl_p *)this->private;
+
+ if (lcl->res && lcl->free_res) {
+ res_nclose(lcl->res);
+ (*lcl->free_res)(lcl->res);
+ }
+
+ lcl->res = res;
+ lcl->free_res = free_res;
+}
+
+static void
+lcl_close(struct irs_acc *this) {
+ struct lcl_p *lcl = (struct lcl_p *)this->private;
+
+ if (lcl) {
+ if (lcl->free_res)
+ (*lcl->free_res)(lcl->res);
+ memput(lcl, sizeof *lcl);
+ }
+ memput(this, sizeof *this);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/lcl_ho.c b/usr/src/lib/libresolv2_joy/common/irs/lcl_ho.c
new file mode 100644
index 0000000000..17c9a5e725
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/lcl_ho.c
@@ -0,0 +1,578 @@
+/*
+ * Copyright (c) 1985, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* from gethostnamadr.c 8.1 (Berkeley) 6/4/93 */
+/* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: lcl_ho.c,v 1.5 2006/03/09 23:57:56 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* Imports. */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <irs.h>
+#include <isc/memcluster.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "dns_p.h"
+#include "lcl_p.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) sprintf x
+#endif
+
+/* Definitions. */
+
+#define MAXALIASES 35
+#define MAXADDRS 35
+#define Max(a,b) ((a) > (b) ? (a) : (b))
+
+#if PACKETSZ > 1024
+#define MAXPACKET PACKETSZ
+#else
+#define MAXPACKET 1024
+#endif
+
+struct pvt {
+ FILE * fp;
+ struct hostent host;
+ char * h_addr_ptrs[MAXADDRS + 1];
+ char * host_aliases[MAXALIASES];
+ char hostbuf[8*1024];
+ u_char host_addr[16]; /*%< IPv4 or IPv6 */
+ struct __res_state *res;
+ void (*free_res)(void *);
+};
+
+typedef union {
+ int32_t al;
+ char ac;
+} align;
+
+static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
+static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
+
+/* Forward. */
+
+static void ho_close(struct irs_ho *this);
+static struct hostent * ho_byname(struct irs_ho *this, const char *name);
+static struct hostent * ho_byname2(struct irs_ho *this, const char *name,
+ int af);
+static struct hostent * ho_byaddr(struct irs_ho *this, const void *addr,
+ int len, int af);
+static struct hostent * ho_next(struct irs_ho *this);
+static void ho_rewind(struct irs_ho *this);
+static void ho_minimize(struct irs_ho *this);
+static struct __res_state * ho_res_get(struct irs_ho *this);
+static void ho_res_set(struct irs_ho *this,
+ struct __res_state *res,
+ void (*free_res)(void *));
+static struct addrinfo * ho_addrinfo(struct irs_ho *this, const char *name,
+ const struct addrinfo *pai);
+
+static size_t ns_namelen(const char *);
+static int init(struct irs_ho *this);
+
+/* Portability. */
+
+#ifndef SEEK_SET
+# define SEEK_SET 0
+#endif
+
+/* Public. */
+
+struct irs_ho *
+irs_lcl_ho(struct irs_acc *this) {
+ struct irs_ho *ho;
+ struct pvt *pvt;
+
+ UNUSED(this);
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ if (!(ho = memget(sizeof *ho))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(ho, 0x5e, sizeof *ho);
+ ho->private = pvt;
+ ho->close = ho_close;
+ ho->byname = ho_byname;
+ ho->byname2 = ho_byname2;
+ ho->byaddr = ho_byaddr;
+ ho->next = ho_next;
+ ho->rewind = ho_rewind;
+ ho->minimize = ho_minimize;
+ ho->res_get = ho_res_get;
+ ho->res_set = ho_res_set;
+ ho->addrinfo = ho_addrinfo;
+ return (ho);
+}
+
+/* Methods. */
+
+static void
+ho_close(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ ho_minimize(this);
+ if (pvt->fp)
+ (void) fclose(pvt->fp);
+ if (pvt->res && pvt->free_res)
+ (*pvt->free_res)(pvt->res);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct hostent *
+ho_byname(struct irs_ho *this, const char *name) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *hp;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ if (pvt->res->options & RES_USE_INET6) {
+ hp = ho_byname2(this, name, AF_INET6);
+ if (hp)
+ return (hp);
+ }
+ return (ho_byname2(this, name, AF_INET));
+}
+
+static struct hostent *
+ho_byname2(struct irs_ho *this, const char *name, int af) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *hp;
+ char **hap;
+ size_t n;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ ho_rewind(this);
+ n = ns_namelen(name);
+ while ((hp = ho_next(this)) != NULL) {
+ size_t nn;
+
+ if (hp->h_addrtype != af)
+ continue;
+ nn = ns_namelen(hp->h_name);
+ if (strncasecmp(hp->h_name, name, Max(n, nn)) == 0)
+ goto found;
+ for (hap = hp->h_aliases; *hap; hap++) {
+ nn = ns_namelen(*hap);
+ if (strncasecmp(*hap, name, Max(n, nn)) == 0)
+ goto found;
+ }
+ }
+ found:
+ if (!hp) {
+ RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);
+ return (NULL);
+ }
+ RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
+ return (hp);
+}
+
+static struct hostent *
+ho_byaddr(struct irs_ho *this, const void *addr, int len, int af) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ const u_char *uaddr = addr;
+ struct hostent *hp;
+ int size;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ if (af == AF_INET6 && len == IN6ADDRSZ &&
+ (!memcmp(uaddr, mapped, sizeof mapped) ||
+ !memcmp(uaddr, tunnelled, sizeof tunnelled))) {
+ /* Unmap. */
+ addr = (const u_char *)addr + sizeof mapped;
+ uaddr += sizeof mapped;
+ af = AF_INET;
+ len = INADDRSZ;
+ }
+ switch (af) {
+ case AF_INET:
+ size = INADDRSZ;
+ break;
+ case AF_INET6:
+ size = IN6ADDRSZ;
+ break;
+ default:
+ errno = EAFNOSUPPORT;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ if (size > len) {
+ errno = EINVAL;
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+
+ /*
+ * Do the search.
+ */
+ ho_rewind(this);
+ while ((hp = ho_next(this)) != NULL) {
+ char **hap;
+
+ for (hap = hp->h_addr_list; *hap; hap++) {
+ const u_char *taddr = (const u_char *)*hap;
+ int taf = hp->h_addrtype;
+ int tlen = hp->h_length;
+
+ if (taf == AF_INET6 && tlen == IN6ADDRSZ &&
+ (!memcmp(taddr, mapped, sizeof mapped) ||
+ !memcmp(taddr, tunnelled, sizeof tunnelled))) {
+ /* Unmap. */
+ taddr += sizeof mapped;
+ taf = AF_INET;
+ tlen = INADDRSZ;
+ }
+ if (taf == af && tlen == len &&
+ !memcmp(taddr, uaddr, tlen))
+ goto found;
+ }
+ }
+ found:
+ if (!hp) {
+ RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);
+ return (NULL);
+ }
+ RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
+ return (hp);
+}
+
+static struct hostent *
+ho_next(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char *cp, **q, *p;
+ char *bufp, *ndbuf, *dbuf = NULL;
+ int c, af, len, bufsiz, offset;
+
+ if (init(this) == -1)
+ return (NULL);
+
+ if (!pvt->fp)
+ ho_rewind(this);
+ if (!pvt->fp) {
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ bufp = pvt->hostbuf;
+ bufsiz = sizeof pvt->hostbuf;
+ offset = 0;
+ again:
+ if (!(p = fgets(bufp + offset, bufsiz - offset, pvt->fp))) {
+ RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);
+ if (dbuf)
+ free(dbuf);
+ return (NULL);
+ }
+ if (!strchr(p, '\n') && !feof(pvt->fp)) {
+#define GROWBUF 1024
+ /* allocate space for longer line */
+ if (dbuf == NULL) {
+ if ((ndbuf = malloc(bufsiz + GROWBUF)) != NULL)
+ strcpy(ndbuf, bufp);
+ } else
+ ndbuf = realloc(dbuf, bufsiz + GROWBUF);
+ if (ndbuf) {
+ dbuf = ndbuf;
+ bufp = dbuf;
+ bufsiz += GROWBUF;
+ offset = strlen(dbuf);
+ } else {
+ /* allocation failed; skip this long line */
+ while ((c = getc(pvt->fp)) != EOF)
+ if (c == '\n')
+ break;
+ if (c != EOF)
+ ungetc(c, pvt->fp);
+ }
+ goto again;
+ }
+
+ p -= offset;
+ offset = 0;
+
+ if (*p == '#')
+ goto again;
+ if ((cp = strpbrk(p, "#\n")) != NULL)
+ *cp = '\0';
+ if (!(cp = strpbrk(p, " \t")))
+ goto again;
+ *cp++ = '\0';
+ if (inet_pton(AF_INET6, p, pvt->host_addr) > 0) {
+ af = AF_INET6;
+ len = IN6ADDRSZ;
+ } else if (inet_aton(p, (struct in_addr *)pvt->host_addr) > 0) {
+ if (pvt->res->options & RES_USE_INET6) {
+ map_v4v6_address((char*)pvt->host_addr,
+ (char*)pvt->host_addr);
+ af = AF_INET6;
+ len = IN6ADDRSZ;
+ } else {
+ af = AF_INET;
+ len = INADDRSZ;
+ }
+ } else {
+ goto again;
+ }
+ pvt->h_addr_ptrs[0] = (char *)pvt->host_addr;
+ pvt->h_addr_ptrs[1] = NULL;
+ pvt->host.h_addr_list = pvt->h_addr_ptrs;
+ pvt->host.h_length = len;
+ pvt->host.h_addrtype = af;
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ pvt->host.h_name = cp;
+ q = pvt->host.h_aliases = pvt->host_aliases;
+ if ((cp = strpbrk(cp, " \t")) != NULL)
+ *cp++ = '\0';
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &pvt->host_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ if ((cp = strpbrk(cp, " \t")) != NULL)
+ *cp++ = '\0';
+ }
+ *q = NULL;
+ if (dbuf)
+ free(dbuf);
+ RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
+ return (&pvt->host);
+}
+
+static void
+ho_rewind(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp) {
+ if (fseek(pvt->fp, 0L, SEEK_SET) == 0)
+ return;
+ (void)fclose(pvt->fp);
+ }
+ if (!(pvt->fp = fopen(_PATH_HOSTS, "r")))
+ return;
+ if (fcntl(fileno(pvt->fp), F_SETFD, 1) < 0) {
+ (void)fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+}
+
+static void
+ho_minimize(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp != NULL) {
+ (void)fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+ if (pvt->res)
+ res_nclose(pvt->res);
+}
+
+static struct __res_state *
+ho_res_get(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (!res) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ ho_res_set(this, res, free);
+ }
+
+ return (pvt->res);
+}
+
+static void
+ho_res_set(struct irs_ho *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->res && pvt->free_res) {
+ res_nclose(pvt->res);
+ (*pvt->free_res)(pvt->res);
+ }
+
+ pvt->res = res;
+ pvt->free_res = free_res;
+}
+
+struct lcl_res_target {
+ struct lcl_res_target *next;
+ int family;
+};
+
+/* XXX */
+extern struct addrinfo *hostent2addrinfo __P((struct hostent *,
+ const struct addrinfo *pai));
+
+static struct addrinfo *
+ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct hostent *hp;
+ struct lcl_res_target q, q2, *p;
+ struct addrinfo sentinel, *cur;
+
+ memset(&q, 0, sizeof(q2));
+ memset(&q2, 0, sizeof(q2));
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ switch(pai->ai_family) {
+ case AF_UNSPEC: /*%< INET6 then INET4 */
+ q.family = AF_INET6;
+ q.next = &q2;
+ q2.family = AF_INET;
+ break;
+ case AF_INET6:
+ q.family = AF_INET6;
+ break;
+ case AF_INET:
+ q.family = AF_INET;
+ break;
+ default:
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY); /*%< ??? */
+ return(NULL);
+ }
+
+ for (p = &q; p; p = p->next) {
+ struct addrinfo *ai;
+
+ hp = (*this->byname2)(this, name, p->family);
+ if (hp == NULL) {
+ /* byname2 should've set an appropriate error */
+ continue;
+ }
+ if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
+ (hp->h_addr_list[0] == NULL)) {
+ RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
+ continue;
+ }
+
+ ai = hostent2addrinfo(hp, pai);
+ if (ai) {
+ cur->ai_next = ai;
+ while (cur->ai_next)
+ cur = cur->ai_next;
+ }
+ }
+
+ if (sentinel.ai_next == NULL)
+ RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);
+
+ return(sentinel.ai_next);
+}
+
+/* Private. */
+
+static size_t
+ns_namelen(const char *s) {
+ int i;
+
+ for (i = strlen(s); i > 0 && s[i-1] == '.'; i--)
+ (void)NULL;
+ return ((size_t) i);
+}
+
+static int
+init(struct irs_ho *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res && !ho_res_get(this))
+ return (-1);
+ if (((pvt->res->options & RES_INIT) == 0U) &&
+ res_ninit(pvt->res) == -1)
+ return (-1);
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/lcl_ng.c b/usr/src/lib/libresolv2_joy/common/irs/lcl_ng.c
new file mode 100644
index 0000000000..319725ce70
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/lcl_ng.c
@@ -0,0 +1,446 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: lcl_ng.c,v 1.3 2005/04/27 04:56:31 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <irs.h>
+#include <isc/memcluster.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "lcl_p.h"
+
+/* Definitions */
+
+#define NG_HOST 0 /*%< Host name */
+#define NG_USER 1 /*%< User name */
+#define NG_DOM 2 /*%< and Domain name */
+#define LINSIZ 1024 /*%< Length of netgroup file line */
+/*
+ * XXX Warning XXX
+ * This code is a hack-and-slash special. It realy needs to be
+ * rewritten with things like strdup, and realloc in mind.
+ * More reasonable data structures would not be a bad thing.
+ */
+
+/*%
+ * Static Variables and functions used by setnetgrent(), getnetgrent() and
+ * endnetgrent().
+ *
+ * There are two linked lists:
+ * \li linelist is just used by setnetgrent() to parse the net group file via.
+ * parse_netgrp()
+ * \li netgrp is the list of entries for the current netgroup
+ */
+struct linelist {
+ struct linelist *l_next; /*%< Chain ptr. */
+ int l_parsed; /*%< Flag for cycles */
+ char * l_groupname; /*%< Name of netgroup */
+ char * l_line; /*%< Netgroup entrie(s) to be parsed */
+};
+
+struct ng_old_struct {
+ struct ng_old_struct *ng_next; /*%< Chain ptr */
+ char * ng_str[3]; /*%< Field pointers, see below */
+};
+
+struct pvt {
+ FILE *fp;
+ struct linelist *linehead;
+ struct ng_old_struct *nextgrp;
+ struct {
+ struct ng_old_struct *gr;
+ char *grname;
+ } grouphead;
+};
+
+/* Forward */
+
+static void ng_rewind(struct irs_ng *, const char*);
+static void ng_close(struct irs_ng *);
+static int ng_next(struct irs_ng *, const char **,
+ const char **, const char **);
+static int ng_test(struct irs_ng *, const char *,
+ const char *, const char *,
+ const char *);
+static void ng_minimize(struct irs_ng *);
+
+static int parse_netgrp(struct irs_ng *, const char*);
+static struct linelist *read_for_group(struct irs_ng *, const char *);
+static void freelists(struct irs_ng *);
+
+/* Public */
+
+struct irs_ng *
+irs_lcl_ng(struct irs_acc *this) {
+ struct irs_ng *ng;
+ struct pvt *pvt;
+
+ UNUSED(this);
+
+ if (!(ng = memget(sizeof *ng))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(ng, 0x5e, sizeof *ng);
+ if (!(pvt = memget(sizeof *pvt))) {
+ memput(ng, sizeof *ng);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ ng->private = pvt;
+ ng->close = ng_close;
+ ng->next = ng_next;
+ ng->test = ng_test;
+ ng->rewind = ng_rewind;
+ ng->minimize = ng_minimize;
+ return (ng);
+}
+
+/* Methods */
+
+static void
+ng_close(struct irs_ng *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp != NULL)
+ fclose(pvt->fp);
+ freelists(this);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+/*%
+ * Parse the netgroup file looking for the netgroup and build the list
+ * of netgrp structures. Let parse_netgrp() and read_for_group() do
+ * most of the work.
+ */
+static void
+ng_rewind(struct irs_ng *this, const char *group) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp != NULL && fseek(pvt->fp, SEEK_CUR, 0L) == -1) {
+ fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+
+ if (pvt->fp == NULL || pvt->grouphead.gr == NULL ||
+ strcmp(group, pvt->grouphead.grname)) {
+ freelists(this);
+ if (pvt->fp != NULL)
+ fclose(pvt->fp);
+ pvt->fp = fopen(_PATH_NETGROUP, "r");
+ if (pvt->fp != NULL) {
+ if (parse_netgrp(this, group))
+ freelists(this);
+ if (!(pvt->grouphead.grname = strdup(group)))
+ freelists(this);
+ fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+ }
+ pvt->nextgrp = pvt->grouphead.gr;
+}
+
+/*%
+ * Get the next netgroup off the list.
+ */
+static int
+ng_next(struct irs_ng *this, const char **host, const char **user,
+ const char **domain)
+{
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->nextgrp) {
+ *host = pvt->nextgrp->ng_str[NG_HOST];
+ *user = pvt->nextgrp->ng_str[NG_USER];
+ *domain = pvt->nextgrp->ng_str[NG_DOM];
+ pvt->nextgrp = pvt->nextgrp->ng_next;
+ return (1);
+ }
+ return (0);
+}
+
+/*%
+ * Search for a match in a netgroup.
+ */
+static int
+ng_test(struct irs_ng *this, const char *name,
+ const char *host, const char *user, const char *domain)
+{
+ const char *ng_host, *ng_user, *ng_domain;
+
+ ng_rewind(this, name);
+ while (ng_next(this, &ng_host, &ng_user, &ng_domain))
+ if ((host == NULL || ng_host == NULL ||
+ !strcmp(host, ng_host)) &&
+ (user == NULL || ng_user == NULL ||
+ !strcmp(user, ng_user)) &&
+ (domain == NULL || ng_domain == NULL ||
+ !strcmp(domain, ng_domain))) {
+ freelists(this);
+ return (1);
+ }
+ freelists(this);
+ return (0);
+}
+
+static void
+ng_minimize(struct irs_ng *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp != NULL) {
+ (void)fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+}
+
+/* Private */
+
+/*%
+ * endnetgrent() - cleanup
+ */
+static void
+freelists(struct irs_ng *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct linelist *lp, *olp;
+ struct ng_old_struct *gp, *ogp;
+
+ lp = pvt->linehead;
+ while (lp) {
+ olp = lp;
+ lp = lp->l_next;
+ free(olp->l_groupname);
+ free(olp->l_line);
+ free((char *)olp);
+ }
+ pvt->linehead = NULL;
+ if (pvt->grouphead.grname) {
+ free(pvt->grouphead.grname);
+ pvt->grouphead.grname = NULL;
+ }
+ gp = pvt->grouphead.gr;
+ while (gp) {
+ ogp = gp;
+ gp = gp->ng_next;
+ if (ogp->ng_str[NG_HOST])
+ free(ogp->ng_str[NG_HOST]);
+ if (ogp->ng_str[NG_USER])
+ free(ogp->ng_str[NG_USER]);
+ if (ogp->ng_str[NG_DOM])
+ free(ogp->ng_str[NG_DOM]);
+ free((char *)ogp);
+ }
+ pvt->grouphead.gr = NULL;
+}
+
+/*%
+ * Parse the netgroup file setting up the linked lists.
+ */
+static int
+parse_netgrp(struct irs_ng *this, const char *group) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char *spos, *epos;
+ int len, strpos;
+ char *pos, *gpos;
+ struct ng_old_struct *grp;
+ struct linelist *lp = pvt->linehead;
+
+ /*
+ * First, see if the line has already been read in.
+ */
+ while (lp) {
+ if (!strcmp(group, lp->l_groupname))
+ break;
+ lp = lp->l_next;
+ }
+ if (lp == NULL &&
+ (lp = read_for_group(this, group)) == NULL)
+ return (1);
+ if (lp->l_parsed) {
+ /*fprintf(stderr, "Cycle in netgroup %s\n", lp->l_groupname);*/
+ return (1);
+ } else
+ lp->l_parsed = 1;
+ pos = lp->l_line;
+ while (*pos != '\0') {
+ if (*pos == '(') {
+ if (!(grp = malloc(sizeof (struct ng_old_struct)))) {
+ freelists(this);
+ errno = ENOMEM;
+ return (1);
+ }
+ memset(grp, 0, sizeof (struct ng_old_struct));
+ grp->ng_next = pvt->grouphead.gr;
+ pvt->grouphead.gr = grp;
+ pos++;
+ gpos = strsep(&pos, ")");
+ for (strpos = 0; strpos < 3; strpos++) {
+ if ((spos = strsep(&gpos, ","))) {
+ while (*spos == ' ' || *spos == '\t')
+ spos++;
+ if ((epos = strpbrk(spos, " \t"))) {
+ *epos = '\0';
+ len = epos - spos;
+ } else
+ len = strlen(spos);
+ if (len > 0) {
+ if(!(grp->ng_str[strpos]
+ = (char *)
+ malloc(len + 1))) {
+ freelists(this);
+ return (1);
+ }
+ memcpy(grp->ng_str[strpos],
+ spos,
+ len + 1);
+ }
+ } else
+ goto errout;
+ }
+ } else {
+ spos = strsep(&pos, ", \t");
+ if (spos != NULL && parse_netgrp(this, spos)) {
+ freelists(this);
+ return (1);
+ }
+ }
+ if (pos == NULL)
+ break;
+ while (*pos == ' ' || *pos == ',' || *pos == '\t')
+ pos++;
+ }
+ return (0);
+ errout:
+ /*fprintf(stderr, "Bad netgroup %s at ..%s\n", lp->l_groupname,
+ spos);*/
+ return (1);
+}
+
+/*%
+ * Read the netgroup file and save lines until the line for the netgroup
+ * is found. Return 1 if eof is encountered.
+ */
+static struct linelist *
+read_for_group(struct irs_ng *this, const char *group) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char *pos, *spos, *linep = NULL, *olinep;
+ int len, olen, cont;
+ struct linelist *lp;
+ char line[LINSIZ + 1];
+
+ while (fgets(line, LINSIZ, pvt->fp) != NULL) {
+ pos = line;
+ if (*pos == '#')
+ continue;
+ while (*pos == ' ' || *pos == '\t')
+ pos++;
+ spos = pos;
+ while (*pos != ' ' && *pos != '\t' && *pos != '\n' &&
+ *pos != '\0')
+ pos++;
+ len = pos - spos;
+ while (*pos == ' ' || *pos == '\t')
+ pos++;
+ if (*pos != '\n' && *pos != '\0') {
+ if (!(lp = malloc(sizeof (*lp)))) {
+ freelists(this);
+ return (NULL);
+ }
+ lp->l_parsed = 0;
+ if (!(lp->l_groupname = malloc(len + 1))) {
+ free(lp);
+ freelists(this);
+ return (NULL);
+ }
+ memcpy(lp->l_groupname, spos, len);
+ *(lp->l_groupname + len) = '\0';
+ len = strlen(pos);
+ olen = 0;
+ olinep = NULL;
+
+ /*
+ * Loop around handling line continuations.
+ */
+ do {
+ if (*(pos + len - 1) == '\n')
+ len--;
+ if (*(pos + len - 1) == '\\') {
+ len--;
+ cont = 1;
+ } else
+ cont = 0;
+ if (len > 0) {
+ if (!(linep = malloc(olen + len + 1))){
+ if (olen > 0)
+ free(olinep);
+ free(lp->l_groupname);
+ free(lp);
+ freelists(this);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ if (olen > 0) {
+ memcpy(linep, olinep, olen);
+ free(olinep);
+ }
+ memcpy(linep + olen, pos, len);
+ olen += len;
+ *(linep + olen) = '\0';
+ olinep = linep;
+ }
+ if (cont) {
+ if (fgets(line, LINSIZ, pvt->fp)) {
+ pos = line;
+ len = strlen(pos);
+ } else
+ cont = 0;
+ }
+ } while (cont);
+ lp->l_line = linep;
+ lp->l_next = pvt->linehead;
+ pvt->linehead = lp;
+
+ /*
+ * If this is the one we wanted, we are done.
+ */
+ if (!strcmp(lp->l_groupname, group))
+ return (lp);
+ }
+ }
+ return (NULL);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/lcl_nw.c b/usr/src/lib/libresolv2_joy/common/irs/lcl_nw.c
new file mode 100644
index 0000000000..2e5cd55a6c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/lcl_nw.c
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 1989, 1993, 1995
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: lcl_nw.c,v 1.4 2005/04/27 04:56:31 sra Exp $";
+/* from getgrent.c 8.2 (Berkeley) 3/21/94"; */
+/* from BSDI Id: getgrent.c,v 2.8 1996/05/28 18:15:14 bostic Exp $ */
+#endif /* LIBC_SCCS and not lint */
+
+/* Imports */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <irs.h>
+#include <isc/memcluster.h>
+
+#include "port_after.h"
+
+#include <isc/misc.h>
+#include "irs_p.h"
+#include "lcl_p.h"
+
+#define MAXALIASES 35
+#define MAXADDRSIZE 4
+
+struct pvt {
+ FILE * fp;
+ char line[BUFSIZ+1];
+ struct nwent net;
+ char * aliases[MAXALIASES];
+ char addr[MAXADDRSIZE];
+ struct __res_state * res;
+ void (*free_res)(void *);
+};
+
+/* Forward */
+
+static void nw_close(struct irs_nw *);
+static struct nwent * nw_byname(struct irs_nw *, const char *, int);
+static struct nwent * nw_byaddr(struct irs_nw *, void *, int, int);
+static struct nwent * nw_next(struct irs_nw *);
+static void nw_rewind(struct irs_nw *);
+static void nw_minimize(struct irs_nw *);
+static struct __res_state * nw_res_get(struct irs_nw *this);
+static void nw_res_set(struct irs_nw *this,
+ struct __res_state *res,
+ void (*free_res)(void *));
+
+static int init(struct irs_nw *this);
+
+/* Portability. */
+
+#ifndef SEEK_SET
+# define SEEK_SET 0
+#endif
+
+/* Public */
+
+struct irs_nw *
+irs_lcl_nw(struct irs_acc *this) {
+ struct irs_nw *nw;
+ struct pvt *pvt;
+
+ UNUSED(this);
+
+ if (!(pvt = memget(sizeof *pvt))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ if (!(nw = memget(sizeof *nw))) {
+ memput(pvt, sizeof *pvt);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(nw, 0x5e, sizeof *nw);
+ nw->private = pvt;
+ nw->close = nw_close;
+ nw->byname = nw_byname;
+ nw->byaddr = nw_byaddr;
+ nw->next = nw_next;
+ nw->rewind = nw_rewind;
+ nw->minimize = nw_minimize;
+ nw->res_get = nw_res_get;
+ nw->res_set = nw_res_set;
+ return (nw);
+}
+
+/* Methods */
+
+static void
+nw_close(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ nw_minimize(this);
+ if (pvt->res && pvt->free_res)
+ (*pvt->free_res)(pvt->res);
+ if (pvt->fp)
+ (void)fclose(pvt->fp);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct nwent *
+nw_byaddr(struct irs_nw *this, void *net, int length, int type) {
+ struct nwent *p;
+
+ if (init(this) == -1)
+ return(NULL);
+
+ nw_rewind(this);
+ while ((p = nw_next(this)) != NULL)
+ if (p->n_addrtype == type && p->n_length == length)
+ if (bitncmp(p->n_addr, net, length) == 0)
+ break;
+ return (p);
+}
+
+static struct nwent *
+nw_byname(struct irs_nw *this, const char *name, int type) {
+ struct nwent *p;
+ char **ap;
+
+ if (init(this) == -1)
+ return(NULL);
+
+ nw_rewind(this);
+ while ((p = nw_next(this)) != NULL) {
+ if (ns_samename(p->n_name, name) == 1 &&
+ p->n_addrtype == type)
+ break;
+ for (ap = p->n_aliases; *ap; ap++)
+ if ((ns_samename(*ap, name) == 1) &&
+ (p->n_addrtype == type))
+ goto found;
+ }
+ found:
+ return (p);
+}
+
+static void
+nw_rewind(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp) {
+ if (fseek(pvt->fp, 0L, SEEK_SET) == 0)
+ return;
+ (void)fclose(pvt->fp);
+ }
+ if (!(pvt->fp = fopen(_PATH_NETWORKS, "r")))
+ return;
+ if (fcntl(fileno(pvt->fp), F_SETFD, 1) < 0) {
+ (void)fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+}
+
+static struct nwent *
+nw_next(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ struct nwent *ret = NULL;
+ char *p, *cp, **q;
+ char *bufp, *ndbuf, *dbuf = NULL;
+ int c, bufsiz, offset = 0;
+
+ if (init(this) == -1)
+ return(NULL);
+
+ if (pvt->fp == NULL)
+ nw_rewind(this);
+ if (pvt->fp == NULL) {
+ RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);
+ return (NULL);
+ }
+ bufp = pvt->line;
+ bufsiz = sizeof(pvt->line);
+
+ again:
+ p = fgets(bufp + offset, bufsiz - offset, pvt->fp);
+ if (p == NULL)
+ goto cleanup;
+ if (!strchr(p, '\n') && !feof(pvt->fp)) {
+#define GROWBUF 1024
+ /* allocate space for longer line */
+ if (dbuf == NULL) {
+ if ((ndbuf = malloc(bufsiz + GROWBUF)) != NULL)
+ strcpy(ndbuf, bufp);
+ } else
+ ndbuf = realloc(dbuf, bufsiz + GROWBUF);
+ if (ndbuf) {
+ dbuf = ndbuf;
+ bufp = dbuf;
+ bufsiz += GROWBUF;
+ offset = strlen(dbuf);
+ } else {
+ /* allocation failed; skip this long line */
+ while ((c = getc(pvt->fp)) != EOF)
+ if (c == '\n')
+ break;
+ if (c != EOF)
+ ungetc(c, pvt->fp);
+ }
+ goto again;
+ }
+
+ p -= offset;
+ offset = 0;
+
+ if (*p == '#')
+ goto again;
+
+ cp = strpbrk(p, "#\n");
+ if (cp != NULL)
+ *cp = '\0';
+ pvt->net.n_name = p;
+ cp = strpbrk(p, " \t");
+ if (cp == NULL)
+ goto again;
+ *cp++ = '\0';
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ p = strpbrk(cp, " \t");
+ if (p != NULL)
+ *p++ = '\0';
+ pvt->net.n_length = inet_net_pton(AF_INET, cp, pvt->addr,
+ sizeof pvt->addr);
+ if (pvt->net.n_length < 0)
+ goto again;
+ pvt->net.n_addrtype = AF_INET;
+ pvt->net.n_addr = pvt->addr;
+ q = pvt->net.n_aliases = pvt->aliases;
+ if (p != NULL) {
+ cp = p;
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &pvt->aliases[MAXALIASES - 1])
+ *q++ = cp;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ }
+ }
+ *q = NULL;
+ ret = &pvt->net;
+
+ cleanup:
+ if (dbuf)
+ free(dbuf);
+
+ return (ret);
+}
+
+static void
+nw_minimize(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->res)
+ res_nclose(pvt->res);
+ if (pvt->fp != NULL) {
+ (void)fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+}
+
+static struct __res_state *
+nw_res_get(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (!res) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(res, 0, sizeof *res);
+ nw_res_set(this, res, free);
+ }
+
+ return (pvt->res);
+}
+
+static void
+nw_res_set(struct irs_nw *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->res && pvt->free_res) {
+ res_nclose(pvt->res);
+ (*pvt->free_res)(pvt->res);
+ }
+
+ pvt->res = res;
+ pvt->free_res = free_res;
+}
+
+static int
+init(struct irs_nw *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (!pvt->res && !nw_res_get(this))
+ return (-1);
+ if (((pvt->res->options & RES_INIT) == 0U) &&
+ res_ninit(pvt->res) == -1)
+ return (-1);
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/lcl_p.h b/usr/src/lib/libresolv2_joy/common/irs/lcl_p.h
new file mode 100644
index 0000000000..e3f4f009cb
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/lcl_p.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: lcl_p.h,v 1.3 2005/04/27 04:56:31 sra Exp $
+ */
+
+/*! \file
+ * \brief
+ * lcl_p.h - private include file for the local accessor functions.
+ */
+
+#ifndef _LCL_P_H_INCLUDED
+#define _LCL_P_H_INCLUDED
+
+/*%
+ * Object state.
+ */
+struct lcl_p {
+ struct __res_state * res;
+ void (*free_res) __P((void *));
+};
+
+/*
+ * Externs.
+ */
+
+extern struct irs_acc * irs_lcl_acc __P((const char *));
+extern struct irs_gr * irs_lcl_gr __P((struct irs_acc *));
+extern struct irs_pw * irs_lcl_pw __P((struct irs_acc *));
+extern struct irs_sv * irs_lcl_sv __P((struct irs_acc *));
+extern struct irs_pr * irs_lcl_pr __P((struct irs_acc *));
+extern struct irs_ho * irs_lcl_ho __P((struct irs_acc *));
+extern struct irs_nw * irs_lcl_nw __P((struct irs_acc *));
+extern struct irs_ng * irs_lcl_ng __P((struct irs_acc *));
+
+#endif /*_LCL_P_H_INCLUDED*/
diff --git a/usr/src/lib/libresolv2_joy/common/irs/lcl_pr.c b/usr/src/lib/libresolv2_joy/common/irs/lcl_pr.c
new file mode 100644
index 0000000000..e1538530eb
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/lcl_pr.c
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 1989, 1993, 1995
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: lcl_pr.c,v 1.4 2006/03/09 23:57:56 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* extern */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <irs.h>
+#include <isc/memcluster.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "lcl_p.h"
+
+#ifndef _PATH_PROTOCOLS
+#define _PATH_PROTOCOLS "/etc/protocols"
+#endif
+#define MAXALIASES 35
+
+/* Types */
+
+struct pvt {
+ FILE * fp;
+ char line[BUFSIZ+1];
+ char * dbuf;
+ struct protoent proto;
+ char * proto_aliases[MAXALIASES];
+};
+
+/* Forward */
+
+static void pr_close(struct irs_pr *);
+static struct protoent * pr_next(struct irs_pr *);
+static struct protoent * pr_byname(struct irs_pr *, const char *);
+static struct protoent * pr_bynumber(struct irs_pr *, int);
+static void pr_rewind(struct irs_pr *);
+static void pr_minimize(struct irs_pr *);
+
+/* Portability. */
+
+#ifndef SEEK_SET
+# define SEEK_SET 0
+#endif
+
+/* Public */
+
+struct irs_pr *
+irs_lcl_pr(struct irs_acc *this) {
+ struct irs_pr *pr;
+ struct pvt *pvt;
+
+ if (!(pr = memget(sizeof *pr))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ if (!(pvt = memget(sizeof *pvt))) {
+ memput(pr, sizeof *this);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ pr->private = pvt;
+ pr->close = pr_close;
+ pr->byname = pr_byname;
+ pr->bynumber = pr_bynumber;
+ pr->next = pr_next;
+ pr->rewind = pr_rewind;
+ pr->minimize = pr_minimize;
+ pr->res_get = NULL;
+ pr->res_set = NULL;
+ return (pr);
+}
+
+/* Methods */
+
+static void
+pr_close(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp)
+ (void) fclose(pvt->fp);
+ if (pvt->dbuf)
+ free(pvt->dbuf);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct protoent *
+pr_byname(struct irs_pr *this, const char *name) {
+
+ struct protoent *p;
+ char **cp;
+
+ pr_rewind(this);
+ while ((p = pr_next(this))) {
+ if (!strcmp(p->p_name, name))
+ goto found;
+ for (cp = p->p_aliases; *cp; cp++)
+ if (!strcmp(*cp, name))
+ goto found;
+ }
+ found:
+ return (p);
+}
+
+static struct protoent *
+pr_bynumber(struct irs_pr *this, int proto) {
+ struct protoent *p;
+
+ pr_rewind(this);
+ while ((p = pr_next(this)))
+ if (p->p_proto == proto)
+ break;
+ return (p);
+}
+
+static void
+pr_rewind(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp) {
+ if (fseek(pvt->fp, 0L, SEEK_SET) == 0)
+ return;
+ (void)fclose(pvt->fp);
+ }
+ if (!(pvt->fp = fopen(_PATH_PROTOCOLS, "r" )))
+ return;
+ if (fcntl(fileno(pvt->fp), F_SETFD, 1) < 0) {
+ (void)fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+}
+
+static struct protoent *
+pr_next(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+ char *p, *cp, **q;
+ char *bufp, *ndbuf, *dbuf = NULL;
+ int c, bufsiz, offset;
+
+ if (!pvt->fp)
+ pr_rewind(this);
+ if (!pvt->fp)
+ return (NULL);
+ if (pvt->dbuf) {
+ free(pvt->dbuf);
+ pvt->dbuf = NULL;
+ }
+ bufp = pvt->line;
+ bufsiz = BUFSIZ;
+ offset = 0;
+ again:
+ if ((p = fgets(bufp + offset, bufsiz - offset, pvt->fp)) == NULL) {
+ if (dbuf)
+ free(dbuf);
+ return (NULL);
+ }
+ if (!strchr(p, '\n') && !feof(pvt->fp)) {
+#define GROWBUF 1024
+ /* allocate space for longer line */
+ if (dbuf == NULL) {
+ if ((ndbuf = malloc(bufsiz + GROWBUF)) != NULL)
+ strcpy(ndbuf, bufp);
+ } else
+ ndbuf = realloc(dbuf, bufsiz + GROWBUF);
+ if (ndbuf) {
+ dbuf = ndbuf;
+ bufp = dbuf;
+ bufsiz += GROWBUF;
+ offset = strlen(dbuf);
+ } else {
+ /* allocation failed; skip this long line */
+ while ((c = getc(pvt->fp)) != EOF)
+ if (c == '\n')
+ break;
+ if (c != EOF)
+ ungetc(c, pvt->fp);
+ }
+ goto again;
+ }
+
+ p -= offset;
+ offset = 0;
+
+ if (*p == '#')
+ goto again;
+ cp = strpbrk(p, "#\n");
+ if (cp != NULL)
+ *cp = '\0';
+ pvt->proto.p_name = p;
+ cp = strpbrk(p, " \t");
+ if (cp == NULL)
+ goto again;
+ *cp++ = '\0';
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ p = strpbrk(cp, " \t");
+ if (p != NULL)
+ *p++ = '\0';
+ pvt->proto.p_proto = atoi(cp);
+ q = pvt->proto.p_aliases = pvt->proto_aliases;
+ if (p != NULL) {
+ cp = p;
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &pvt->proto_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ }
+ }
+ *q = NULL;
+ pvt->dbuf = dbuf;
+ return (&pvt->proto);
+}
+
+static void
+pr_minimize(struct irs_pr *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->fp != NULL) {
+ (void)fclose(pvt->fp);
+ pvt->fp = NULL;
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/lcl_sv.c b/usr/src/lib/libresolv2_joy/common/irs/lcl_sv.c
new file mode 100644
index 0000000000..ad6526430c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/lcl_sv.c
@@ -0,0 +1,432 @@
+/*
+ * Copyright (c) 1989, 1993, 1995
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: lcl_sv.c,v 1.4 2005/04/27 04:56:31 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/* extern */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#ifdef IRS_LCL_SV_DB
+#include <db.h>
+#endif
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <irs.h>
+#include <isc/memcluster.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "lcl_p.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+/* Types */
+
+struct pvt {
+#ifdef IRS_LCL_SV_DB
+ DB * dbh;
+ int dbf;
+#endif
+ struct lcl_sv sv;
+};
+
+/* Forward */
+
+static void sv_close(struct irs_sv*);
+static struct servent * sv_next(struct irs_sv *);
+static struct servent * sv_byname(struct irs_sv *, const char *,
+ const char *);
+static struct servent * sv_byport(struct irs_sv *, int, const char *);
+static void sv_rewind(struct irs_sv *);
+static void sv_minimize(struct irs_sv *);
+/*global*/ struct servent * irs_lclsv_fnxt(struct lcl_sv *);
+#ifdef IRS_LCL_SV_DB
+static struct servent * sv_db_rec(struct lcl_sv *, DBT *, DBT *);
+#endif
+
+/* Portability */
+
+#ifndef SEEK_SET
+# define SEEK_SET 0
+#endif
+
+/* Public */
+
+struct irs_sv *
+irs_lcl_sv(struct irs_acc *this) {
+ struct irs_sv *sv;
+ struct pvt *pvt;
+
+ UNUSED(this);
+
+ if ((sv = memget(sizeof *sv)) == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(sv, 0x5e, sizeof *sv);
+ if ((pvt = memget(sizeof *pvt)) == NULL) {
+ memput(sv, sizeof *sv);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(pvt, 0, sizeof *pvt);
+ sv->private = pvt;
+ sv->close = sv_close;
+ sv->next = sv_next;
+ sv->byname = sv_byname;
+ sv->byport = sv_byport;
+ sv->rewind = sv_rewind;
+ sv->minimize = sv_minimize;
+ sv->res_get = NULL;
+ sv->res_set = NULL;
+#ifdef IRS_LCL_SV_DB
+ pvt->dbf = R_FIRST;
+#endif
+ return (sv);
+}
+
+/* Methods */
+
+static void
+sv_close(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+#ifdef IRS_LCL_SV_DB
+ if (pvt->dbh != NULL)
+ (*pvt->dbh->close)(pvt->dbh);
+#endif
+ if (pvt->sv.fp)
+ fclose(pvt->sv.fp);
+ memput(pvt, sizeof *pvt);
+ memput(this, sizeof *this);
+}
+
+static struct servent *
+sv_byname(struct irs_sv *this, const char *name, const char *proto) {
+#ifdef IRS_LCL_SV_DB
+ struct pvt *pvt = (struct pvt *)this->private;
+#endif
+ struct servent *p;
+ char **cp;
+
+ sv_rewind(this);
+#ifdef IRS_LCL_SV_DB
+ if (pvt->dbh != NULL) {
+ DBT key, data;
+
+ /* Note that (sizeof "/") == 2. */
+ if ((strlen(name) + sizeof "/" + proto ? strlen(proto) : 0)
+ > sizeof pvt->sv.line)
+ goto try_local;
+ key.data = pvt->sv.line;
+ key.size = SPRINTF((pvt->sv.line, "%s/%s", name,
+ proto ? proto : "")) + 1;
+ if (proto != NULL) {
+ if ((*pvt->dbh->get)(pvt->dbh, &key, &data, 0) != 0)
+ return (NULL);
+ } else if ((*pvt->dbh->seq)(pvt->dbh, &key, &data, R_CURSOR)
+ != 0)
+ return (NULL);
+ return (sv_db_rec(&pvt->sv, &key, &data));
+ }
+ try_local:
+#endif
+
+ while ((p = sv_next(this))) {
+ if (strcmp(name, p->s_name) == 0)
+ goto gotname;
+ for (cp = p->s_aliases; *cp; cp++)
+ if (strcmp(name, *cp) == 0)
+ goto gotname;
+ continue;
+ gotname:
+ if (proto == NULL || strcmp(p->s_proto, proto) == 0)
+ break;
+ }
+ return (p);
+}
+
+static struct servent *
+sv_byport(struct irs_sv *this, int port, const char *proto) {
+#ifdef IRS_LCL_SV_DB
+ struct pvt *pvt = (struct pvt *)this->private;
+#endif
+ struct servent *p;
+
+ sv_rewind(this);
+#ifdef IRS_LCL_SV_DB
+ if (pvt->dbh != NULL) {
+ DBT key, data;
+ u_short *ports;
+
+ ports = (u_short *)pvt->sv.line;
+ ports[0] = 0;
+ ports[1] = port;
+ key.data = ports;
+ key.size = sizeof(u_short) * 2;
+ if (proto && *proto) {
+ strncpy((char *)ports + key.size, proto,
+ BUFSIZ - key.size);
+ key.size += strlen((char *)ports + key.size) + 1;
+ if ((*pvt->dbh->get)(pvt->dbh, &key, &data, 0) != 0)
+ return (NULL);
+ } else {
+ if ((*pvt->dbh->seq)(pvt->dbh, &key, &data, R_CURSOR)
+ != 0)
+ return (NULL);
+ }
+ return (sv_db_rec(&pvt->sv, &key, &data));
+ }
+#endif
+ while ((p = sv_next(this))) {
+ if (p->s_port != port)
+ continue;
+ if (proto == NULL || strcmp(p->s_proto, proto) == 0)
+ break;
+ }
+ return (p);
+}
+
+static void
+sv_rewind(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+ if (pvt->sv.fp) {
+ if (fseek(pvt->sv.fp, 0L, SEEK_SET) == 0)
+ return;
+ (void)fclose(pvt->sv.fp);
+ pvt->sv.fp = NULL;
+ }
+#ifdef IRS_LCL_SV_DB
+ pvt->dbf = R_FIRST;
+ if (pvt->dbh != NULL)
+ return;
+ pvt->dbh = dbopen(_PATH_SERVICES_DB, O_RDONLY,O_RDONLY,DB_BTREE, NULL);
+ if (pvt->dbh != NULL) {
+ if (fcntl((*pvt->dbh->fd)(pvt->dbh), F_SETFD, 1) < 0) {
+ (*pvt->dbh->close)(pvt->dbh);
+ pvt->dbh = NULL;
+ }
+ return;
+ }
+#endif
+ if ((pvt->sv.fp = fopen(_PATH_SERVICES, "r")) == NULL)
+ return;
+ if (fcntl(fileno(pvt->sv.fp), F_SETFD, 1) < 0) {
+ (void)fclose(pvt->sv.fp);
+ pvt->sv.fp = NULL;
+ }
+}
+
+static struct servent *
+sv_next(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+#ifdef IRS_LCL_SV_DB
+ if (pvt->dbh == NULL && pvt->sv.fp == NULL)
+#else
+ if (pvt->sv.fp == NULL)
+#endif
+ sv_rewind(this);
+
+#ifdef IRS_LCL_SV_DB
+ if (pvt->dbh != NULL) {
+ DBT key, data;
+
+ while ((*pvt->dbh->seq)(pvt->dbh, &key, &data, pvt->dbf) == 0){
+ pvt->dbf = R_NEXT;
+ if (((char *)key.data)[0])
+ continue;
+ return (sv_db_rec(&pvt->sv, &key, &data));
+ }
+ }
+#endif
+
+ if (pvt->sv.fp == NULL)
+ return (NULL);
+ return (irs_lclsv_fnxt(&pvt->sv));
+}
+
+static void
+sv_minimize(struct irs_sv *this) {
+ struct pvt *pvt = (struct pvt *)this->private;
+
+#ifdef IRS_LCL_SV_DB
+ if (pvt->dbh != NULL) {
+ (*pvt->dbh->close)(pvt->dbh);
+ pvt->dbh = NULL;
+ }
+#endif
+ if (pvt->sv.fp != NULL) {
+ (void)fclose(pvt->sv.fp);
+ pvt->sv.fp = NULL;
+ }
+}
+
+/* Quasipublic. */
+
+struct servent *
+irs_lclsv_fnxt(struct lcl_sv *sv) {
+ char *p, *cp, **q;
+
+ again:
+ if ((p = fgets(sv->line, BUFSIZ, sv->fp)) == NULL)
+ return (NULL);
+ if (*p == '#')
+ goto again;
+ sv->serv.s_name = p;
+ while (*p && *p != '\n' && *p != ' ' && *p != '\t' && *p != '#')
+ ++p;
+ if (*p == '\0' || *p == '#' || *p == '\n')
+ goto again;
+ *p++ = '\0';
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (*p == '\0' || *p == '#' || *p == '\n')
+ goto again;
+ sv->serv.s_port = htons((u_short)strtol(p, &cp, 10));
+ if (cp == p || (*cp != '/' && *cp != ','))
+ goto again;
+ p = cp + 1;
+ sv->serv.s_proto = p;
+
+ q = sv->serv.s_aliases = sv->serv_aliases;
+
+ while (*p && *p != '\n' && *p != ' ' && *p != '\t' && *p != '#')
+ ++p;
+
+ while (*p == ' ' || *p == '\t') {
+ *p++ = '\0';
+ while (*p == ' ' || *p == '\t')
+ ++p;
+ if (*p == '\0' || *p == '#' || *p == '\n')
+ break;
+ if (q < &sv->serv_aliases[IRS_SV_MAXALIASES - 1])
+ *q++ = p;
+ while (*p && *p != '\n' && *p != ' ' && *p != '\t' && *p != '#')
+ ++p;
+ }
+
+ *p = '\0';
+ *q = NULL;
+ return (&sv->serv);
+}
+
+/* Private. */
+
+#ifdef IRS_LCL_SV_DB
+static struct servent *
+sv_db_rec(struct lcl_sv *sv, DBT *key, DBT *data) {
+ char *p, **q;
+ int n;
+
+ p = data->data;
+ p[data->size - 1] = '\0'; /*%< should be, but we depend on it */
+ if (((char *)key->data)[0] == '\0') {
+ if (key->size < sizeof(u_short)*2 || data->size < 2)
+ return (NULL);
+ sv->serv.s_port = ((u_short *)key->data)[1];
+ n = strlen(p) + 1;
+ if ((size_t)n > sizeof(sv->line)) {
+ n = sizeof(sv->line);
+ }
+ memcpy(sv->line, p, n);
+ sv->serv.s_name = sv->line;
+ if ((sv->serv.s_proto = strchr(sv->line, '/')) != NULL)
+ *(sv->serv.s_proto)++ = '\0';
+ p += n;
+ data->size -= n;
+ } else {
+ if (data->size < sizeof(u_short) + 1)
+ return (NULL);
+ if (key->size > sizeof(sv->line))
+ key->size = sizeof(sv->line);
+ ((char *)key->data)[key->size - 1] = '\0';
+ memcpy(sv->line, key->data, key->size);
+ sv->serv.s_name = sv->line;
+ if ((sv->serv.s_proto = strchr(sv->line, '/')) != NULL)
+ *(sv->serv.s_proto)++ = '\0';
+ sv->serv.s_port = *(u_short *)data->data;
+ p += sizeof(u_short);
+ data->size -= sizeof(u_short);
+ }
+ q = sv->serv.s_aliases = sv->serv_aliases;
+ while (data->size > 0 && q < &sv->serv_aliases[IRS_SV_MAXALIASES - 1]) {
+
+ *q++ = p;
+ n = strlen(p) + 1;
+ data->size -= n;
+ p += n;
+ }
+ *q = NULL;
+ return (&sv->serv);
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/nis.c b/usr/src/lib/libresolv2_joy/common/irs/nis.c
new file mode 100644
index 0000000000..ac1796543c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/nis.c
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: nis.c,v 1.3 2005/04/27 04:56:32 sra Exp $";
+#endif
+
+/* Imports */
+
+#include "port_before.h"
+
+#ifdef WANT_IRS_NIS
+
+#include <rpc/rpc.h>
+#include <rpc/xdr.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#ifdef T_NULL
+#undef T_NULL /* Silence re-definition warning of T_NULL. */
+#endif
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <isc/memcluster.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "hesiod.h"
+#include "nis_p.h"
+
+/* Forward */
+
+static void nis_close(struct irs_acc *);
+static struct __res_state * nis_res_get(struct irs_acc *);
+static void nis_res_set(struct irs_acc *, struct __res_state *,
+ void (*)(void *));
+
+/* Public */
+
+struct irs_acc *
+irs_nis_acc(const char *options) {
+ struct nis_p *nis;
+ struct irs_acc *acc;
+ char *domain;
+
+ UNUSED(options);
+
+ if (yp_get_default_domain(&domain) != 0)
+ return (NULL);
+ if (!(nis = memget(sizeof *nis))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(nis, 0, sizeof *nis);
+ if (!(acc = memget(sizeof *acc))) {
+ memput(nis, sizeof *nis);
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(acc, 0x5e, sizeof *acc);
+ acc->private = nis;
+ nis->domain = strdup(domain);
+#ifdef WANT_IRS_GR
+ acc->gr_map = irs_nis_gr;
+#else
+ acc->gr_map = NULL;
+#endif
+#ifdef WANT_IRS_PW
+ acc->pw_map = irs_nis_pw;
+#else
+ acc->pw_map = NULL;
+#endif
+ acc->sv_map = irs_nis_sv;
+ acc->pr_map = irs_nis_pr;
+ acc->ho_map = irs_nis_ho;
+ acc->nw_map = irs_nis_nw;
+ acc->ng_map = irs_nis_ng;
+ acc->res_get = nis_res_get;
+ acc->res_set = nis_res_set;
+ acc->close = nis_close;
+ return (acc);
+}
+
+/* Methods */
+
+static struct __res_state *
+nis_res_get(struct irs_acc *this) {
+ struct nis_p *nis = (struct nis_p *)this->private;
+
+ if (nis->res == NULL) {
+ struct __res_state *res;
+ res = (struct __res_state *)malloc(sizeof *res);
+ if (res == NULL)
+ return (NULL);
+ memset(res, 0, sizeof *res);
+ nis_res_set(this, res, free);
+ }
+
+ if ((nis->res->options & RES_INIT) == 0 &&
+ res_ninit(nis->res) < 0)
+ return (NULL);
+
+ return (nis->res);
+}
+
+static void
+nis_res_set(struct irs_acc *this, struct __res_state *res,
+ void (*free_res)(void *)) {
+ struct nis_p *nis = (struct nis_p *)this->private;
+
+ if (nis->res && nis->free_res) {
+ res_nclose(nis->res);
+ (*nis->free_res)(nis->res);
+ }
+
+ nis->res = res;
+ nis->free_res = free_res;
+}
+
+static void
+nis_close(struct irs_acc *this) {
+ struct nis_p *nis = (struct nis_p *)this->private;
+
+ if (nis->res && nis->free_res)
+ (*nis->free_res)(nis->res);
+ free(nis->domain);
+ memput(nis, sizeof *nis);
+ memput(this, sizeof *this);
+}
+
+#endif /*WANT_IRS_NIS*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/nis_p.h b/usr/src/lib/libresolv2_joy/common/irs/nis_p.h
new file mode 100644
index 0000000000..70e2948d67
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/nis_p.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: nis_p.h,v 1.3 2005/04/27 04:56:33 sra Exp $
+ */
+
+/*! \file
+ * \brief
+ * nis_p.h - private include file for the NIS functions.
+ */
+
+/*%
+ * Object state.
+ */
+struct nis_p {
+ char * domain;
+ struct __res_state * res;
+ void (*free_res) __P((void *));
+};
+
+
+/*
+ * Methods.
+ */
+
+extern struct irs_gr * irs_nis_gr __P((struct irs_acc *));
+extern struct irs_pw * irs_nis_pw __P((struct irs_acc *));
+extern struct irs_sv * irs_nis_sv __P((struct irs_acc *));
+extern struct irs_pr * irs_nis_pr __P((struct irs_acc *));
+extern struct irs_ho * irs_nis_ho __P((struct irs_acc *));
+extern struct irs_nw * irs_nis_nw __P((struct irs_acc *));
+extern struct irs_ng * irs_nis_ng __P((struct irs_acc *));
diff --git a/usr/src/lib/libresolv2_joy/common/irs/nul_ng.c b/usr/src/lib/libresolv2_joy/common/irs/nul_ng.c
new file mode 100644
index 0000000000..504813bde1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/nul_ng.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: nul_ng.c,v 1.3 2005/04/27 04:56:34 sra Exp $";
+#endif
+
+/*! \file
+ * \brief
+ * nul_ng.c - the netgroup accessor null map
+ */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <netdb.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <irs.h>
+#include <isc/memcluster.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+#include "hesiod.h"
+#include "dns_p.h"
+
+/* Forward. */
+
+static void ng_close(struct irs_ng *);
+static int ng_next(struct irs_ng *, const char **,
+ const char **, const char **);
+static int ng_test(struct irs_ng *,
+ const char *, const char *,
+ const char *, const char *);
+static void ng_rewind(struct irs_ng *, const char *);
+static void ng_minimize(struct irs_ng *);
+
+/* Public. */
+
+struct irs_ng *
+irs_nul_ng(struct irs_acc *this) {
+ struct irs_ng *ng;
+
+ UNUSED(this);
+
+ if (!(ng = memget(sizeof *ng))) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ memset(ng, 0x5e, sizeof *ng);
+ ng->private = NULL;
+ ng->close = ng_close;
+ ng->next = ng_next;
+ ng->test = ng_test;
+ ng->rewind = ng_rewind;
+ ng->minimize = ng_minimize;
+ return (ng);
+}
+
+/* Methods. */
+
+static void
+ng_close(struct irs_ng *this) {
+ memput(this, sizeof *this);
+}
+
+/* ARGSUSED */
+static int
+ng_next(struct irs_ng *this, const char **host, const char **user,
+ const char **domain)
+{
+ UNUSED(this);
+ UNUSED(host);
+ UNUSED(user);
+ UNUSED(domain);
+ errno = ENOENT;
+ return (-1);
+}
+
+static int
+ng_test(struct irs_ng *this, const char *name,
+ const char *user, const char *host, const char *domain)
+{
+ UNUSED(this);
+ UNUSED(name);
+ UNUSED(user);
+ UNUSED(host);
+ UNUSED(domain);
+ errno = ENODEV;
+ return (-1);
+}
+
+static void
+ng_rewind(struct irs_ng *this, const char *netgroup) {
+ UNUSED(this);
+ UNUSED(netgroup);
+ /* NOOP */
+}
+
+static void
+ng_minimize(struct irs_ng *this) {
+ UNUSED(this);
+ /* NOOP */
+}
diff --git a/usr/src/lib/libresolv2_joy/common/irs/pathnames.h b/usr/src/lib/libresolv2_joy/common/irs/pathnames.h
new file mode 100644
index 0000000000..1646842155
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/pathnames.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: pathnames.h,v 1.3 2005/04/27 04:56:34 sra Exp $
+ */
+
+#ifndef _PATH_IRS_CONF
+#define _PATH_IRS_CONF "/etc/irs.conf"
+#endif
+
+#ifndef _PATH_NETWORKS
+#define _PATH_NETWORKS "/etc/networks"
+#endif
+
+#ifndef _PATH_GROUP
+#define _PATH_GROUP "/etc/group"
+#endif
+
+#ifndef _PATH_NETGROUP
+#define _PATH_NETGROUP "/etc/netgroup"
+#endif
+
+#ifndef _PATH_SERVICES
+#define _PATH_SERVICES "/etc/services"
+#endif
+
+#ifdef IRS_LCL_SV_DB
+#ifndef _PATH_SERVICES_DB
+#define _PATH_SERVICES_DB _PATH_SERVICES ".db"
+#endif
+#endif
+
+#ifndef _PATH_HESIOD_CONF
+#define _PATH_HESIOD_CONF "/etc/hesiod.conf"
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/irs/util.c b/usr/src/lib/libresolv2_joy/common/irs/util.c
new file mode 100644
index 0000000000..9c70eabddc
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/irs/util.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: util.c,v 1.3 2005/04/27 04:56:34 sra Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <irs.h>
+
+#include "port_after.h"
+
+#include "irs_p.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) sprintf x
+#endif
+
+void
+map_v4v6_address(const char *src, char *dst) {
+ u_char *p = (u_char *)dst;
+ char tmp[NS_INADDRSZ];
+ int i;
+
+ /* Stash a temporary copy so our caller can update in place. */
+ memcpy(tmp, src, NS_INADDRSZ);
+ /* Mark this ipv6 addr as a mapped ipv4. */
+ for (i = 0; i < 10; i++)
+ *p++ = 0x00;
+ *p++ = 0xff;
+ *p++ = 0xff;
+ /* Retrieve the saved copy and we're done. */
+ memcpy((void*)p, tmp, NS_INADDRSZ);
+}
+
+int
+make_group_list(struct irs_gr *this, const char *name,
+ gid_t basegid, gid_t *groups, int *ngroups)
+{
+ struct group *grp;
+ int i, ng;
+ int ret, maxgroups;
+
+ ret = -1;
+ ng = 0;
+ maxgroups = *ngroups;
+ /*
+ * When installing primary group, duplicate it;
+ * the first element of groups is the effective gid
+ * and will be overwritten when a setgid file is executed.
+ */
+ if (ng >= maxgroups)
+ goto done;
+ groups[ng++] = basegid;
+ if (ng >= maxgroups)
+ goto done;
+ groups[ng++] = basegid;
+ /*
+ * Scan the group file to find additional groups.
+ */
+ (*this->rewind)(this);
+ while ((grp = (*this->next)(this)) != NULL) {
+ if ((gid_t)grp->gr_gid == basegid)
+ continue;
+ for (i = 0; grp->gr_mem[i]; i++) {
+ if (!strcmp(grp->gr_mem[i], name)) {
+ if (ng >= maxgroups)
+ goto done;
+ groups[ng++] = grp->gr_gid;
+ break;
+ }
+ }
+ }
+ ret = 0;
+ done:
+ *ngroups = ng;
+ return (ret);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/assertions.c b/usr/src/lib/libresolv2_joy/common/isc/assertions.c
new file mode 100644
index 0000000000..b71e5a32d3
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/assertions.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1997, 1999, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: assertions.c,v 1.5 2008/11/14 02:36:51 marka Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/assertions.h>
+
+#include "port_after.h"
+
+/*
+ * Forward.
+ */
+
+static void default_assertion_failed(const char *, int, assertion_type,
+ const char *, int);
+
+/*
+ * Public.
+ */
+
+assertion_failure_callback __assertion_failed = default_assertion_failed;
+
+void
+set_assertion_failure_callback(assertion_failure_callback f) {
+ if (f == NULL)
+ __assertion_failed = default_assertion_failed;
+ else
+ __assertion_failed = f;
+}
+
+const char *
+assertion_type_to_text(assertion_type type) {
+ const char *result;
+
+ switch (type) {
+ case assert_require:
+ result = "REQUIRE";
+ break;
+ case assert_ensure:
+ result = "ENSURE";
+ break;
+ case assert_insist:
+ result = "INSIST";
+ break;
+ case assert_invariant:
+ result = "INVARIANT";
+ break;
+ default:
+ result = NULL;
+ }
+ return (result);
+}
+
+/*
+ * Private.
+ */
+
+/* coverity[+kill] */
+static void
+default_assertion_failed(const char *file, int line, assertion_type type,
+ const char *cond, int print_errno)
+{
+ fprintf(stderr, "%s:%d: %s(%s)%s%s failed.\n",
+ file, line, assertion_type_to_text(type), cond,
+ (print_errno) ? ": " : "",
+ (print_errno) ? strerror(errno) : "");
+ abort();
+ /* NOTREACHED */
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/base64.c b/usr/src/lib/libresolv2_joy/common/isc/base64.c
new file mode 100644
index 0000000000..79c35722b1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/base64.c
@@ -0,0 +1,333 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: base64.c,v 1.4 2005/04/27 04:56:34 sra Exp $";
+#endif /* not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "port_after.h"
+
+#ifndef ORIGINAL_ISC_CODE
+#pragma weak __b64_ntop = b64_ntop
+#pragma weak __b64_pton = b64_pton
+#endif /* ORIGINAL_ISC_CODE */
+
+#define Assert(Cond) if (!(Cond)) abort()
+
+static const char Base64[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char Pad64 = '=';
+
+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
+ The following encoding technique is taken from RFC1521 by Borenstein
+ and Freed. It is reproduced here in a slightly edited form for
+ convenience.
+
+ A 65-character subset of US-ASCII is used, enabling 6 bits to be
+ represented per printable character. (The extra 65th character, "=",
+ is used to signify a special processing function.)
+
+ The encoding process represents 24-bit groups of input bits as output
+ strings of 4 encoded characters. Proceeding from left to right, a
+ 24-bit input group is formed by concatenating 3 8-bit input groups.
+ These 24 bits are then treated as 4 concatenated 6-bit groups, each
+ of which is translated into a single digit in the base64 alphabet.
+
+ Each 6-bit group is used as an index into an array of 64 printable
+ characters. The character referenced by the index is placed in the
+ output string.
+
+ Table 1: The Base64 Alphabet
+
+ Value Encoding Value Encoding Value Encoding Value Encoding
+ 0 A 17 R 34 i 51 z
+ 1 B 18 S 35 j 52 0
+ 2 C 19 T 36 k 53 1
+ 3 D 20 U 37 l 54 2
+ 4 E 21 V 38 m 55 3
+ 5 F 22 W 39 n 56 4
+ 6 G 23 X 40 o 57 5
+ 7 H 24 Y 41 p 58 6
+ 8 I 25 Z 42 q 59 7
+ 9 J 26 a 43 r 60 8
+ 10 K 27 b 44 s 61 9
+ 11 L 28 c 45 t 62 +
+ 12 M 29 d 46 u 63 /
+ 13 N 30 e 47 v
+ 14 O 31 f 48 w (pad) =
+ 15 P 32 g 49 x
+ 16 Q 33 h 50 y
+
+ Special processing is performed if fewer than 24 bits are available
+ at the end of the data being encoded. A full encoding quantum is
+ always completed at the end of a quantity. When fewer than 24 input
+ bits are available in an input group, zero bits are added (on the
+ right) to form an integral number of 6-bit groups. Padding at the
+ end of the data is performed using the '=' character.
+
+ Since all base64 input is an integral number of octets, only the
+ -------------------------------------------------
+ following cases can arise:
+
+ (1) the final quantum of encoding input is an integral
+ multiple of 24 bits; here, the final unit of encoded
+ output will be an integral multiple of 4 characters
+ with no "=" padding,
+ (2) the final quantum of encoding input is exactly 8 bits;
+ here, the final unit of encoded output will be two
+ characters followed by two "=" padding characters, or
+ (3) the final quantum of encoding input is exactly 16 bits;
+ here, the final unit of encoded output will be three
+ characters followed by one "=" padding character.
+ */
+
+int
+b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
+ size_t datalength = 0;
+ u_char input[3];
+ u_char output[4];
+ size_t i;
+
+ while (2U < srclength) {
+ input[0] = *src++;
+ input[1] = *src++;
+ input[2] = *src++;
+ srclength -= 3;
+
+ output[0] = input[0] >> 2;
+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+ output[3] = input[2] & 0x3f;
+ Assert(output[0] < 64);
+ Assert(output[1] < 64);
+ Assert(output[2] < 64);
+ Assert(output[3] < 64);
+
+ if (datalength + 4 > targsize)
+ return (-1);
+ target[datalength++] = Base64[output[0]];
+ target[datalength++] = Base64[output[1]];
+ target[datalength++] = Base64[output[2]];
+ target[datalength++] = Base64[output[3]];
+ }
+
+ /* Now we worry about padding. */
+ if (0U != srclength) {
+ /* Get what's left. */
+ input[0] = input[1] = input[2] = '\0';
+ for (i = 0; i < srclength; i++)
+ input[i] = *src++;
+
+ output[0] = input[0] >> 2;
+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+ Assert(output[0] < 64);
+ Assert(output[1] < 64);
+ Assert(output[2] < 64);
+
+ if (datalength + 4 > targsize)
+ return (-1);
+ target[datalength++] = Base64[output[0]];
+ target[datalength++] = Base64[output[1]];
+ if (srclength == 1U)
+ target[datalength++] = Pad64;
+ else
+ target[datalength++] = Base64[output[2]];
+ target[datalength++] = Pad64;
+ }
+ if (datalength >= targsize)
+ return (-1);
+ target[datalength] = '\0'; /*%< Returned value doesn't count \\0. */
+ return (datalength);
+}
+
+/* skips all whitespace anywhere.
+ converts characters, four at a time, starting at (or after)
+ src from base - 64 numbers into three 8 bit bytes in the target area.
+ it returns the number of data bytes stored at the target, or -1 on error.
+ */
+
+int
+b64_pton(src, target, targsize)
+ char const *src;
+ u_char *target;
+ size_t targsize;
+{
+ int tarindex, state, ch;
+ char *pos;
+
+ state = 0;
+ tarindex = 0;
+
+ while ((ch = *src++) != '\0') {
+ if (isspace(ch)) /*%< Skip whitespace anywhere. */
+ continue;
+
+ if (ch == Pad64)
+ break;
+
+ pos = strchr(Base64, ch);
+ if (pos == 0) /*%< A non-base64 character. */
+ return (-1);
+
+ switch (state) {
+ case 0:
+ if (target) {
+ if ((size_t)tarindex >= targsize)
+ return (-1);
+ target[tarindex] = (pos - Base64) << 2;
+ }
+ state = 1;
+ break;
+ case 1:
+ if (target) {
+ if ((size_t)tarindex + 1 >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64) >> 4;
+ target[tarindex+1] = ((pos - Base64) & 0x0f)
+ << 4 ;
+ }
+ tarindex++;
+ state = 2;
+ break;
+ case 2:
+ if (target) {
+ if ((size_t)tarindex + 1 >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64) >> 2;
+ target[tarindex+1] = ((pos - Base64) & 0x03)
+ << 6;
+ }
+ tarindex++;
+ state = 3;
+ break;
+ case 3:
+ if (target) {
+ if ((size_t)tarindex >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64);
+ }
+ tarindex++;
+ state = 0;
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /*
+ * We are done decoding Base-64 chars. Let's see if we ended
+ * on a byte boundary, and/or with erroneous trailing characters.
+ */
+
+ if (ch == Pad64) { /*%< We got a pad char. */
+ ch = *src++; /*%< Skip it, get next. */
+ switch (state) {
+ case 0: /*%< Invalid = in first position */
+ case 1: /*%< Invalid = in second position */
+ return (-1);
+
+ case 2: /*%< Valid, means one byte of info */
+ /* Skip any number of spaces. */
+ for ((void)NULL; ch != '\0'; ch = *src++)
+ if (!isspace(ch))
+ break;
+ /* Make sure there is another trailing = sign. */
+ if (ch != Pad64)
+ return (-1);
+ ch = *src++; /*%< Skip the = */
+ /* Fall through to "single trailing =" case. */
+ /* FALLTHROUGH */
+
+ case 3: /*%< Valid, means two bytes of info */
+ /*
+ * We know this char is an =. Is there anything but
+ * whitespace after it?
+ */
+ for ((void)NULL; ch != '\0'; ch = *src++)
+ if (!isspace(ch))
+ return (-1);
+
+ /*
+ * Now make sure for cases 2 and 3 that the "extra"
+ * bits that slopped past the last full byte were
+ * zeros. If we don't check them, they become a
+ * subliminal channel.
+ */
+ if (target && target[tarindex] != 0)
+ return (-1);
+ }
+ } else {
+ /*
+ * We ended by seeing the end of the string. Make sure we
+ * have no partial bytes lying around.
+ */
+ if (state != 0)
+ return (-1);
+ }
+
+ return (tarindex);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/bitncmp.c b/usr/src/lib/libresolv2_joy/common/isc/bitncmp.c
new file mode 100644
index 0000000000..efe5009292
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/bitncmp.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1996, 1999, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: bitncmp.c,v 1.5 2008/11/14 02:36:51 marka Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+
+#include <string.h>
+
+#include "port_after.h"
+
+#include <isc/misc.h>
+
+/*%
+ * int
+ * bitncmp(l, r, n)
+ * compare bit masks l and r, for n bits.
+ * return:
+ * -1, 1, or 0 in the libc tradition.
+ * note:
+ * network byte order assumed. this means 192.5.5.240/28 has
+ * 0x11110000 in its fourth octet.
+ * author:
+ * Paul Vixie (ISC), June 1996
+ */
+int
+bitncmp(const void *l, const void *r, int n) {
+ u_int lb, rb;
+ int x, b;
+
+ b = n / 8;
+ x = memcmp(l, r, b);
+ if (x || (n % 8) == 0)
+ return (x);
+
+ lb = ((const u_char *)l)[b];
+ rb = ((const u_char *)r)[b];
+ for (b = n % 8; b > 0; b--) {
+ if ((lb & 0x80) != (rb & 0x80)) {
+ if (lb & 0x80)
+ return (1);
+ return (-1);
+ }
+ lb <<= 1;
+ rb <<= 1;
+ }
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ctl_clnt.c b/usr/src/lib/libresolv2_joy/common/isc/ctl_clnt.c
new file mode 100644
index 0000000000..f71001a6d4
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ctl_clnt.c
@@ -0,0 +1,620 @@
+/*
+ * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1998-2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static const char rcsid[] = "$Id: ctl_clnt.c,v 1.11 2008/11/14 02:36:51 marka Exp $";
+#endif /* not lint */
+
+/* Extern. */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#include <isc/assertions.h>
+#include <isc/ctl.h>
+#include <isc/eventlib.h>
+#include <isc/list.h>
+#include <isc/memcluster.h>
+
+#include "ctl_p.h"
+
+#include "port_after.h"
+
+/* Constants. */
+
+
+/* Macros. */
+
+#define donefunc_p(ctx) ((ctx).donefunc != NULL)
+#define arpacode_p(line) (isdigit((unsigned char)(line[0])) && \
+ isdigit((unsigned char)(line[1])) && \
+ isdigit((unsigned char)(line[2])))
+#define arpacont_p(line) (line[3] == '-')
+#define arpadone_p(line) (line[3] == ' ' || line[3] == '\t' || \
+ line[3] == '\r' || line[3] == '\0')
+
+/* Types. */
+
+enum state {
+ initializing = 0, connecting, connected, destroyed
+};
+
+struct ctl_tran {
+ LINK(struct ctl_tran) link;
+ LINK(struct ctl_tran) wlink;
+ struct ctl_cctx * ctx;
+ struct ctl_buf outbuf;
+ ctl_clntdone donefunc;
+ void * uap;
+};
+
+struct ctl_cctx {
+ enum state state;
+ evContext ev;
+ int sock;
+ ctl_logfunc logger;
+ ctl_clntdone donefunc;
+ void * uap;
+ evConnID coID;
+ evTimerID tiID;
+ evFileID rdID;
+ evStreamID wrID;
+ struct ctl_buf inbuf;
+ struct timespec timeout;
+ LIST(struct ctl_tran) tran;
+ LIST(struct ctl_tran) wtran;
+};
+
+/* Forward. */
+
+static struct ctl_tran *new_tran(struct ctl_cctx *, ctl_clntdone, void *, int);
+static void start_write(struct ctl_cctx *);
+static void destroy(struct ctl_cctx *, int);
+static void error(struct ctl_cctx *);
+static void new_state(struct ctl_cctx *, enum state);
+static void conn_done(evContext, void *, int,
+ const void *, int,
+ const void *, int);
+static void write_done(evContext, void *, int, int);
+static void start_read(struct ctl_cctx *);
+static void stop_read(struct ctl_cctx *);
+static void readable(evContext, void *, int, int);
+static void start_timer(struct ctl_cctx *);
+static void stop_timer(struct ctl_cctx *);
+static void touch_timer(struct ctl_cctx *);
+static void timer(evContext, void *,
+ struct timespec, struct timespec);
+
+#ifndef HAVE_MEMCHR
+static void *
+memchr(const void *b, int c, size_t len) {
+ const unsigned char *p = b;
+ size_t i;
+
+ for (i = 0; i < len; i++, p++)
+ if (*p == (unsigned char)c)
+ return ((void *)p);
+ return (NULL);
+}
+#endif
+
+/* Private data. */
+
+static const char * const state_names[] = {
+ "initializing", "connecting", "connected", "destroyed"
+};
+
+/* Public. */
+
+/*%
+ * void
+ * ctl_client()
+ * create, condition, and connect to a listener on the control port.
+ */
+struct ctl_cctx *
+ctl_client(evContext lev, const struct sockaddr *cap, size_t cap_len,
+ const struct sockaddr *sap, size_t sap_len,
+ ctl_clntdone donefunc, void *uap,
+ u_int timeout, ctl_logfunc logger)
+{
+ static const char me[] = "ctl_client";
+ static const int on = 1;
+ struct ctl_cctx *ctx;
+ struct sockaddr *captmp;
+
+ if (logger == NULL)
+ logger = ctl_logger;
+ ctx = memget(sizeof *ctx);
+ if (ctx == NULL) {
+ (*logger)(ctl_error, "%s: getmem: %s", me, strerror(errno));
+ goto fatal;
+ }
+ ctx->state = initializing;
+ ctx->ev = lev;
+ ctx->logger = logger;
+ ctx->timeout = evConsTime(timeout, 0);
+ ctx->donefunc = donefunc;
+ ctx->uap = uap;
+ ctx->coID.opaque = NULL;
+ ctx->tiID.opaque = NULL;
+ ctx->rdID.opaque = NULL;
+ ctx->wrID.opaque = NULL;
+ buffer_init(ctx->inbuf);
+ INIT_LIST(ctx->tran);
+ INIT_LIST(ctx->wtran);
+ ctx->sock = socket(sap->sa_family, SOCK_STREAM, PF_UNSPEC);
+ if (ctx->sock > evHighestFD(ctx->ev)) {
+ ctx->sock = -1;
+ errno = ENOTSOCK;
+ }
+ if (ctx->sock < 0) {
+ (*ctx->logger)(ctl_error, "%s: socket: %s",
+ me, strerror(errno));
+ goto fatal;
+ }
+ if (cap != NULL) {
+ if (setsockopt(ctx->sock, SOL_SOCKET, SO_REUSEADDR,
+ (const char *)&on, sizeof on) != 0) {
+ (*ctx->logger)(ctl_warning,
+ "%s: setsockopt(REUSEADDR): %s",
+ me, strerror(errno));
+ }
+ DE_CONST(cap, captmp);
+ if (bind(ctx->sock, captmp, cap_len) < 0) {
+ (*ctx->logger)(ctl_error, "%s: bind: %s", me,
+ strerror(errno));
+ goto fatal;
+ }
+ }
+ if (evConnect(lev, ctx->sock, (const struct sockaddr *)sap, sap_len,
+ conn_done, ctx, &ctx->coID) < 0) {
+ (*ctx->logger)(ctl_error, "%s: evConnect(fd %d): %s",
+ me, ctx->sock, strerror(errno));
+ fatal:
+ if (ctx != NULL) {
+ if (ctx->sock >= 0)
+ close(ctx->sock);
+ memput(ctx, sizeof *ctx);
+ }
+ return (NULL);
+ }
+ new_state(ctx, connecting);
+ return (ctx);
+}
+
+/*%
+ * void
+ * ctl_endclient(ctx)
+ * close a client and release all of its resources.
+ */
+void
+ctl_endclient(struct ctl_cctx *ctx) {
+ if (ctx->state != destroyed)
+ destroy(ctx, 0);
+ memput(ctx, sizeof *ctx);
+}
+
+/*%
+ * int
+ * ctl_command(ctx, cmd, len, donefunc, uap)
+ * Queue a transaction, which will begin with sending cmd
+ * and complete by calling donefunc with the answer.
+ */
+int
+ctl_command(struct ctl_cctx *ctx, const char *cmd, size_t len,
+ ctl_clntdone donefunc, void *uap)
+{
+ struct ctl_tran *tran;
+ char *pc;
+ unsigned int n;
+
+ switch (ctx->state) {
+ case destroyed:
+ errno = ENOTCONN;
+ return (-1);
+ case connecting:
+ case connected:
+ break;
+ default:
+ abort();
+ }
+ if (len >= (size_t)MAX_LINELEN) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ tran = new_tran(ctx, donefunc, uap, 1);
+ if (tran == NULL)
+ return (-1);
+ if (ctl_bufget(&tran->outbuf, ctx->logger) < 0)
+ return (-1);
+ memcpy(tran->outbuf.text, cmd, len);
+ tran->outbuf.used = len;
+ for (pc = tran->outbuf.text, n = 0; n < tran->outbuf.used; pc++, n++)
+ if (!isascii((unsigned char)*pc) ||
+ !isprint((unsigned char)*pc))
+ *pc = '\040';
+ start_write(ctx);
+ return (0);
+}
+
+/* Private. */
+
+static struct ctl_tran *
+new_tran(struct ctl_cctx *ctx, ctl_clntdone donefunc, void *uap, int w) {
+ struct ctl_tran *new = memget(sizeof *new);
+
+ if (new == NULL)
+ return (NULL);
+ new->ctx = ctx;
+ buffer_init(new->outbuf);
+ new->donefunc = donefunc;
+ new->uap = uap;
+ INIT_LINK(new, link);
+ INIT_LINK(new, wlink);
+ APPEND(ctx->tran, new, link);
+ if (w)
+ APPEND(ctx->wtran, new, wlink);
+ return (new);
+}
+
+static void
+start_write(struct ctl_cctx *ctx) {
+ static const char me[] = "isc/ctl_clnt::start_write";
+ struct ctl_tran *tran;
+ struct iovec iov[2], *iovp = iov;
+ char * tmp;
+
+ REQUIRE(ctx->state == connecting || ctx->state == connected);
+ /* If there is a write in progress, don't try to write more yet. */
+ if (ctx->wrID.opaque != NULL)
+ return;
+ /* If there are no trans, make sure timer is off, and we're done. */
+ if (EMPTY(ctx->wtran)) {
+ if (ctx->tiID.opaque != NULL)
+ stop_timer(ctx);
+ return;
+ }
+ /* Pull it off the head of the write queue. */
+ tran = HEAD(ctx->wtran);
+ UNLINK(ctx->wtran, tran, wlink);
+ /* Since there are some trans, make sure timer is successfully "on". */
+ if (ctx->tiID.opaque != NULL)
+ touch_timer(ctx);
+ else
+ start_timer(ctx);
+ if (ctx->state == destroyed)
+ return;
+ /* Marshall a newline-terminated message and clock it out. */
+ *iovp++ = evConsIovec(tran->outbuf.text, tran->outbuf.used);
+ DE_CONST("\r\n", tmp);
+ *iovp++ = evConsIovec(tmp, 2);
+ if (evWrite(ctx->ev, ctx->sock, iov, iovp - iov,
+ write_done, tran, &ctx->wrID) < 0) {
+ (*ctx->logger)(ctl_error, "%s: evWrite: %s", me,
+ strerror(errno));
+ error(ctx);
+ return;
+ }
+ if (evTimeRW(ctx->ev, ctx->wrID, ctx->tiID) < 0) {
+ (*ctx->logger)(ctl_error, "%s: evTimeRW: %s", me,
+ strerror(errno));
+ error(ctx);
+ return;
+ }
+}
+
+static void
+destroy(struct ctl_cctx *ctx, int notify) {
+ struct ctl_tran *this, *next;
+
+ if (ctx->sock != -1) {
+ (void) close(ctx->sock);
+ ctx->sock = -1;
+ }
+ switch (ctx->state) {
+ case connecting:
+ REQUIRE(ctx->wrID.opaque == NULL);
+ REQUIRE(EMPTY(ctx->tran));
+ /*
+ * This test is nec'y since destroy() can be called from
+ * start_read() while the state is still "connecting".
+ */
+ if (ctx->coID.opaque != NULL) {
+ (void)evCancelConn(ctx->ev, ctx->coID);
+ ctx->coID.opaque = NULL;
+ }
+ break;
+ case connected:
+ REQUIRE(ctx->coID.opaque == NULL);
+ if (ctx->wrID.opaque != NULL) {
+ (void)evCancelRW(ctx->ev, ctx->wrID);
+ ctx->wrID.opaque = NULL;
+ }
+ if (ctx->rdID.opaque != NULL)
+ stop_read(ctx);
+ break;
+ case destroyed:
+ break;
+ default:
+ abort();
+ }
+ if (allocated_p(ctx->inbuf))
+ ctl_bufput(&ctx->inbuf);
+ for (this = HEAD(ctx->tran); this != NULL; this = next) {
+ next = NEXT(this, link);
+ if (allocated_p(this->outbuf))
+ ctl_bufput(&this->outbuf);
+ if (notify && this->donefunc != NULL)
+ (*this->donefunc)(ctx, this->uap, NULL, 0);
+ memput(this, sizeof *this);
+ }
+ if (ctx->tiID.opaque != NULL)
+ stop_timer(ctx);
+ new_state(ctx, destroyed);
+}
+
+static void
+error(struct ctl_cctx *ctx) {
+ REQUIRE(ctx->state != destroyed);
+ destroy(ctx, 1);
+}
+
+static void
+new_state(struct ctl_cctx *ctx, enum state new_state) {
+ static const char me[] = "isc/ctl_clnt::new_state";
+
+ (*ctx->logger)(ctl_debug, "%s: %s -> %s", me,
+ state_names[ctx->state], state_names[new_state]);
+ ctx->state = new_state;
+}
+
+static void
+conn_done(evContext ev, void *uap, int fd,
+ const void *la, int lalen,
+ const void *ra, int ralen)
+{
+ static const char me[] = "isc/ctl_clnt::conn_done";
+ struct ctl_cctx *ctx = uap;
+ struct ctl_tran *tran;
+
+ UNUSED(ev);
+ UNUSED(la);
+ UNUSED(lalen);
+ UNUSED(ra);
+ UNUSED(ralen);
+
+ ctx->coID.opaque = NULL;
+ if (fd < 0) {
+ (*ctx->logger)(ctl_error, "%s: evConnect: %s", me,
+ strerror(errno));
+ error(ctx);
+ return;
+ }
+ new_state(ctx, connected);
+ tran = new_tran(ctx, ctx->donefunc, ctx->uap, 0);
+ if (tran == NULL) {
+ (*ctx->logger)(ctl_error, "%s: new_tran failed: %s", me,
+ strerror(errno));
+ error(ctx);
+ return;
+ }
+ start_read(ctx);
+ if (ctx->state == destroyed) {
+ (*ctx->logger)(ctl_error, "%s: start_read failed: %s",
+ me, strerror(errno));
+ error(ctx);
+ return;
+ }
+}
+
+static void
+write_done(evContext lev, void *uap, int fd, int bytes) {
+ struct ctl_tran *tran = (struct ctl_tran *)uap;
+ struct ctl_cctx *ctx = tran->ctx;
+
+ UNUSED(lev);
+ UNUSED(fd);
+
+ ctx->wrID.opaque = NULL;
+ if (ctx->tiID.opaque != NULL)
+ touch_timer(ctx);
+ ctl_bufput(&tran->outbuf);
+ start_write(ctx);
+ if (bytes < 0)
+ destroy(ctx, 1);
+ else
+ start_read(ctx);
+}
+
+static void
+start_read(struct ctl_cctx *ctx) {
+ static const char me[] = "isc/ctl_clnt::start_read";
+
+ REQUIRE(ctx->state == connecting || ctx->state == connected);
+ REQUIRE(ctx->rdID.opaque == NULL);
+ if (evSelectFD(ctx->ev, ctx->sock, EV_READ, readable, ctx,
+ &ctx->rdID) < 0)
+ {
+ (*ctx->logger)(ctl_error, "%s: evSelect(fd %d): %s", me,
+ ctx->sock, strerror(errno));
+ error(ctx);
+ return;
+ }
+}
+
+static void
+stop_read(struct ctl_cctx *ctx) {
+ REQUIRE(ctx->coID.opaque == NULL);
+ REQUIRE(ctx->rdID.opaque != NULL);
+ (void)evDeselectFD(ctx->ev, ctx->rdID);
+ ctx->rdID.opaque = NULL;
+}
+
+static void
+readable(evContext ev, void *uap, int fd, int evmask) {
+ static const char me[] = "isc/ctl_clnt::readable";
+ struct ctl_cctx *ctx = uap;
+ struct ctl_tran *tran;
+ ssize_t n;
+ char *eos;
+
+ UNUSED(ev);
+
+ REQUIRE(ctx != NULL);
+ REQUIRE(fd >= 0);
+ REQUIRE(evmask == EV_READ);
+ REQUIRE(ctx->state == connected);
+ REQUIRE(!EMPTY(ctx->tran));
+ tran = HEAD(ctx->tran);
+ if (!allocated_p(ctx->inbuf) &&
+ ctl_bufget(&ctx->inbuf, ctx->logger) < 0) {
+ (*ctx->logger)(ctl_error, "%s: can't get an input buffer", me);
+ error(ctx);
+ return;
+ }
+ n = read(ctx->sock, ctx->inbuf.text + ctx->inbuf.used,
+ MAX_LINELEN - ctx->inbuf.used);
+ if (n <= 0) {
+ (*ctx->logger)(ctl_warning, "%s: read: %s", me,
+ (n == 0) ? "Unexpected EOF" : strerror(errno));
+ error(ctx);
+ return;
+ }
+ if (ctx->tiID.opaque != NULL)
+ touch_timer(ctx);
+ ctx->inbuf.used += n;
+ (*ctx->logger)(ctl_debug, "%s: read %d, used %d", me,
+ n, ctx->inbuf.used);
+ again:
+ eos = memchr(ctx->inbuf.text, '\n', ctx->inbuf.used);
+ if (eos != NULL && eos != ctx->inbuf.text && eos[-1] == '\r') {
+ int done = 0;
+
+ eos[-1] = '\0';
+ if (!arpacode_p(ctx->inbuf.text)) {
+ /* XXX Doesn't FTP do this sometimes? Is it legal? */
+ (*ctx->logger)(ctl_error, "%s: no arpa code (%s)", me,
+ ctx->inbuf.text);
+ error(ctx);
+ return;
+ }
+ if (arpadone_p(ctx->inbuf.text))
+ done = 1;
+ else if (arpacont_p(ctx->inbuf.text))
+ done = 0;
+ else {
+ /* XXX Doesn't FTP do this sometimes? Is it legal? */
+ (*ctx->logger)(ctl_error, "%s: no arpa flag (%s)", me,
+ ctx->inbuf.text);
+ error(ctx);
+ return;
+ }
+ (*tran->donefunc)(ctx, tran->uap, ctx->inbuf.text,
+ (done ? 0 : CTL_MORE));
+ ctx->inbuf.used -= ((eos - ctx->inbuf.text) + 1);
+ if (ctx->inbuf.used == 0U)
+ ctl_bufput(&ctx->inbuf);
+ else
+ memmove(ctx->inbuf.text, eos + 1, ctx->inbuf.used);
+ if (done) {
+ UNLINK(ctx->tran, tran, link);
+ memput(tran, sizeof *tran);
+ stop_read(ctx);
+ start_write(ctx);
+ return;
+ }
+ if (allocated_p(ctx->inbuf))
+ goto again;
+ return;
+ }
+ if (ctx->inbuf.used == (size_t)MAX_LINELEN) {
+ (*ctx->logger)(ctl_error, "%s: line too long (%-10s...)", me,
+ ctx->inbuf.text);
+ error(ctx);
+ }
+}
+
+/* Timer related stuff. */
+
+static void
+start_timer(struct ctl_cctx *ctx) {
+ static const char me[] = "isc/ctl_clnt::start_timer";
+
+ REQUIRE(ctx->tiID.opaque == NULL);
+ if (evSetIdleTimer(ctx->ev, timer, ctx, ctx->timeout, &ctx->tiID) < 0){
+ (*ctx->logger)(ctl_error, "%s: evSetIdleTimer: %s", me,
+ strerror(errno));
+ error(ctx);
+ return;
+ }
+}
+
+static void
+stop_timer(struct ctl_cctx *ctx) {
+ static const char me[] = "isc/ctl_clnt::stop_timer";
+
+ REQUIRE(ctx->tiID.opaque != NULL);
+ if (evClearIdleTimer(ctx->ev, ctx->tiID) < 0) {
+ (*ctx->logger)(ctl_error, "%s: evClearIdleTimer: %s", me,
+ strerror(errno));
+ error(ctx);
+ return;
+ }
+ ctx->tiID.opaque = NULL;
+}
+
+static void
+touch_timer(struct ctl_cctx *ctx) {
+ REQUIRE(ctx->tiID.opaque != NULL);
+
+ evTouchIdleTimer(ctx->ev, ctx->tiID);
+}
+
+static void
+timer(evContext ev, void *uap, struct timespec due, struct timespec itv) {
+ static const char me[] = "isc/ctl_clnt::timer";
+ struct ctl_cctx *ctx = uap;
+
+ UNUSED(ev);
+ UNUSED(due);
+ UNUSED(itv);
+
+ ctx->tiID.opaque = NULL;
+ (*ctx->logger)(ctl_error, "%s: timeout after %u seconds while %s", me,
+ ctx->timeout.tv_sec, state_names[ctx->state]);
+ error(ctx);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ctl_p.c b/usr/src/lib/libresolv2_joy/common/isc/ctl_p.c
new file mode 100644
index 0000000000..7ab719a5e6
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ctl_p.c
@@ -0,0 +1,188 @@
+#if !defined(lint) && !defined(SABER)
+static const char rcsid[] = "$Id: ctl_p.c,v 1.4 2005/04/27 04:56:35 sra Exp $";
+#endif /* not lint */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* Extern. */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include <isc/assertions.h>
+#include <isc/eventlib.h>
+#include <isc/logging.h>
+#include <isc/memcluster.h>
+#include <isc/ctl.h>
+
+#include "ctl_p.h"
+
+#include "port_after.h"
+
+/* Constants. */
+
+const char * const ctl_sevnames[] = {
+ "debug", "warning", "error"
+};
+
+/* Public. */
+
+/*%
+ * ctl_logger()
+ * if ctl_startup()'s caller didn't specify a logger, this one
+ * is used. this pollutes stderr with all kinds of trash so it will
+ * probably never be used in real applications.
+ */
+void
+ctl_logger(enum ctl_severity severity, const char *format, ...) {
+ va_list ap;
+ static const char me[] = "ctl_logger";
+
+ fprintf(stderr, "%s(%s): ", me, ctl_sevnames[severity]);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ fputc('\n', stderr);
+}
+
+int
+ctl_bufget(struct ctl_buf *buf, ctl_logfunc logger) {
+ static const char me[] = "ctl_bufget";
+
+ REQUIRE(!allocated_p(*buf) && buf->used == 0U);
+ buf->text = memget(MAX_LINELEN);
+ if (!allocated_p(*buf)) {
+ (*logger)(ctl_error, "%s: getmem: %s", me, strerror(errno));
+ return (-1);
+ }
+ buf->used = 0;
+ return (0);
+}
+
+void
+ctl_bufput(struct ctl_buf *buf) {
+
+ REQUIRE(allocated_p(*buf));
+ memput(buf->text, MAX_LINELEN);
+ buf->text = NULL;
+ buf->used = 0;
+}
+
+const char *
+ctl_sa_ntop(const struct sockaddr *sa,
+ char *buf, size_t size,
+ ctl_logfunc logger)
+{
+ static const char me[] = "ctl_sa_ntop";
+ static const char punt[] = "[0].-1";
+ char tmp[INET6_ADDRSTRLEN];
+
+ switch (sa->sa_family) {
+ case AF_INET6: {
+ const struct sockaddr_in6 *in6 =
+ (const struct sockaddr_in6 *) sa;
+
+ if (inet_ntop(in6->sin6_family, &in6->sin6_addr, tmp, sizeof tmp)
+ == NULL) {
+ (*logger)(ctl_error, "%s: inet_ntop(%u %04x): %s",
+ me, in6->sin6_family,
+ in6->sin6_port, strerror(errno));
+ return (punt);
+ }
+ if (strlen(tmp) + sizeof "[].65535" > size) {
+ (*logger)(ctl_error, "%s: buffer overflow", me);
+ return (punt);
+ }
+ (void) sprintf(buf, "[%s].%u", tmp, ntohs(in6->sin6_port));
+ return (buf);
+ }
+ case AF_INET: {
+ const struct sockaddr_in *in =
+ (const struct sockaddr_in *) sa;
+
+ if (inet_ntop(in->sin_family, &in->sin_addr, tmp, sizeof tmp)
+ == NULL) {
+ (*logger)(ctl_error, "%s: inet_ntop(%u %04x %08x): %s",
+ me, in->sin_family,
+ in->sin_port, in->sin_addr.s_addr,
+ strerror(errno));
+ return (punt);
+ }
+ if (strlen(tmp) + sizeof "[].65535" > size) {
+ (*logger)(ctl_error, "%s: buffer overflow", me);
+ return (punt);
+ }
+ (void) sprintf(buf, "[%s].%u", tmp, ntohs(in->sin_port));
+ return (buf);
+ }
+#ifndef NO_SOCKADDR_UN
+ case AF_UNIX: {
+ const struct sockaddr_un *un =
+ (const struct sockaddr_un *) sa;
+ unsigned int x = sizeof un->sun_path;
+
+ if (x > size)
+ x = size;
+ strncpy(buf, un->sun_path, x - 1);
+ buf[x - 1] = '\0';
+ return (buf);
+ }
+#endif
+ default:
+ return (punt);
+ }
+}
+
+void
+ctl_sa_copy(const struct sockaddr *src, struct sockaddr *dst) {
+ switch (src->sa_family) {
+ case AF_INET6:
+ *((struct sockaddr_in6 *)dst) =
+ *((const struct sockaddr_in6 *)src);
+ break;
+ case AF_INET:
+ *((struct sockaddr_in *)dst) =
+ *((const struct sockaddr_in *)src);
+ break;
+#ifndef NO_SOCKADDR_UN
+ case AF_UNIX:
+ *((struct sockaddr_un *)dst) =
+ *((const struct sockaddr_un *)src);
+ break;
+#endif
+ default:
+ *dst = *src;
+ break;
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ctl_p.h b/usr/src/lib/libresolv2_joy/common/isc/ctl_p.h
new file mode 100644
index 0000000000..18a52ae39c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ctl_p.h
@@ -0,0 +1,28 @@
+struct ctl_buf {
+ char * text;
+ size_t used;
+};
+
+#define MAX_LINELEN 990 /*%< Like SMTP. */
+#ifndef NO_SOCKADDR_UN
+#define MAX_NTOP PATH_MAX
+#else
+#define MAX_NTOP (sizeof "[255.255.255.255].65535")
+#endif
+
+#define allocated_p(Buf) ((Buf).text != NULL)
+#define buffer_init(Buf) ((Buf).text = 0, (Buf.used) = 0)
+
+#define ctl_bufget __ctl_bufget
+#define ctl_bufput __ctl_bufput
+#define ctl_sa_ntop __ctl_sa_ntop
+#define ctl_sa_copy __ctl_sa_copy
+
+int ctl_bufget(struct ctl_buf *, ctl_logfunc);
+void ctl_bufput(struct ctl_buf *);
+const char * ctl_sa_ntop(const struct sockaddr *, char *, size_t,
+ ctl_logfunc);
+void ctl_sa_copy(const struct sockaddr *,
+ struct sockaddr *);
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ctl_srvr.c b/usr/src/lib/libresolv2_joy/common/isc/ctl_srvr.c
new file mode 100644
index 0000000000..8fd7a21ffa
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ctl_srvr.c
@@ -0,0 +1,787 @@
+/*
+ * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1998-2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static const char rcsid[] = "$Id: ctl_srvr.c,v 1.10 2008/11/14 02:36:51 marka Exp $";
+#endif /* not lint */
+
+/* Extern. */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#include <isc/assertions.h>
+#include <isc/ctl.h>
+#include <isc/eventlib.h>
+#include <isc/list.h>
+#include <isc/logging.h>
+#include <isc/memcluster.h>
+
+#include "ctl_p.h"
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+/* Macros. */
+
+#define lastverb_p(verb) (verb->name == NULL || verb->func == NULL)
+#define address_expr ctl_sa_ntop((struct sockaddr *)&sess->sa, \
+ tmp, sizeof tmp, ctx->logger)
+
+/* Types. */
+
+enum state {
+ available = 0, initializing, writing, reading, reading_data,
+ processing, idling, quitting, closing
+};
+
+union sa_un {
+ struct sockaddr_in in;
+#ifndef NO_SOCKADDR_UN
+ struct sockaddr_un un;
+#endif
+};
+
+struct ctl_sess {
+ LINK(struct ctl_sess) link;
+ struct ctl_sctx * ctx;
+ enum state state;
+ int sock;
+ union sa_un sa;
+ evFileID rdID;
+ evStreamID wrID;
+ evTimerID rdtiID;
+ evTimerID wrtiID;
+ struct ctl_buf inbuf;
+ struct ctl_buf outbuf;
+ const struct ctl_verb * verb;
+ u_int helpcode;
+ const void * respctx;
+ u_int respflags;
+ ctl_srvrdone donefunc;
+ void * uap;
+ void * csctx;
+};
+
+struct ctl_sctx {
+ evContext ev;
+ void * uctx;
+ u_int unkncode;
+ u_int timeoutcode;
+ const struct ctl_verb * verbs;
+ const struct ctl_verb * connverb;
+ int sock;
+ int max_sess;
+ int cur_sess;
+ struct timespec timeout;
+ ctl_logfunc logger;
+ evConnID acID;
+ LIST(struct ctl_sess) sess;
+};
+
+/* Forward. */
+
+static void ctl_accept(evContext, void *, int,
+ const void *, int,
+ const void *, int);
+static void ctl_close(struct ctl_sess *);
+static void ctl_new_state(struct ctl_sess *,
+ enum state,
+ const char *);
+static void ctl_start_read(struct ctl_sess *);
+static void ctl_stop_read(struct ctl_sess *);
+static void ctl_readable(evContext, void *, int, int);
+static void ctl_rdtimeout(evContext, void *,
+ struct timespec,
+ struct timespec);
+static void ctl_wrtimeout(evContext, void *,
+ struct timespec,
+ struct timespec);
+static void ctl_docommand(struct ctl_sess *);
+static void ctl_writedone(evContext, void *, int, int);
+static void ctl_morehelp(struct ctl_sctx *,
+ struct ctl_sess *,
+ const struct ctl_verb *,
+ const char *,
+ u_int, const void *, void *);
+static void ctl_signal_done(struct ctl_sctx *,
+ struct ctl_sess *);
+
+/* Private data. */
+
+static const char * state_names[] = {
+ "available", "initializing", "writing", "reading",
+ "reading_data", "processing", "idling", "quitting", "closing"
+};
+
+static const char space[] = " ";
+
+static const struct ctl_verb fakehelpverb = {
+ "fakehelp", ctl_morehelp , NULL
+};
+
+/* Public. */
+
+/*%
+ * void
+ * ctl_server()
+ * create, condition, and start a listener on the control port.
+ */
+struct ctl_sctx *
+ctl_server(evContext lev, const struct sockaddr *sap, size_t sap_len,
+ const struct ctl_verb *verbs,
+ u_int unkncode, u_int timeoutcode,
+ u_int timeout, int backlog, int max_sess,
+ ctl_logfunc logger, void *uctx)
+{
+ static const char me[] = "ctl_server";
+ static const int on = 1;
+ const struct ctl_verb *connverb;
+ struct ctl_sctx *ctx;
+ int save_errno;
+
+ if (logger == NULL)
+ logger = ctl_logger;
+ for (connverb = verbs;
+ connverb->name != NULL && connverb->func != NULL;
+ connverb++)
+ if (connverb->name[0] == '\0')
+ break;
+ if (connverb->func == NULL) {
+ (*logger)(ctl_error, "%s: no connection verb found", me);
+ return (NULL);
+ }
+ ctx = memget(sizeof *ctx);
+ if (ctx == NULL) {
+ (*logger)(ctl_error, "%s: getmem: %s", me, strerror(errno));
+ return (NULL);
+ }
+ ctx->ev = lev;
+ ctx->uctx = uctx;
+ ctx->unkncode = unkncode;
+ ctx->timeoutcode = timeoutcode;
+ ctx->verbs = verbs;
+ ctx->timeout = evConsTime(timeout, 0);
+ ctx->logger = logger;
+ ctx->connverb = connverb;
+ ctx->max_sess = max_sess;
+ ctx->cur_sess = 0;
+ INIT_LIST(ctx->sess);
+ ctx->sock = socket(sap->sa_family, SOCK_STREAM, PF_UNSPEC);
+ if (ctx->sock > evHighestFD(ctx->ev)) {
+ ctx->sock = -1;
+ errno = ENOTSOCK;
+ }
+ if (ctx->sock < 0) {
+ save_errno = errno;
+ (*ctx->logger)(ctl_error, "%s: socket: %s",
+ me, strerror(errno));
+ memput(ctx, sizeof *ctx);
+ errno = save_errno;
+ return (NULL);
+ }
+ if (ctx->sock > evHighestFD(lev)) {
+ close(ctx->sock);
+ (*ctx->logger)(ctl_error, "%s: file descriptor > evHighestFD");
+ errno = ENFILE;
+ memput(ctx, sizeof *ctx);
+ return (NULL);
+ }
+#ifdef NO_UNIX_REUSEADDR
+ if (sap->sa_family != AF_UNIX)
+#endif
+ if (setsockopt(ctx->sock, SOL_SOCKET, SO_REUSEADDR,
+ (const char *)&on, sizeof on) != 0) {
+ (*ctx->logger)(ctl_warning,
+ "%s: setsockopt(REUSEADDR): %s",
+ me, strerror(errno));
+ }
+ if (bind(ctx->sock, sap, sap_len) < 0) {
+ char tmp[MAX_NTOP];
+ save_errno = errno;
+ (*ctx->logger)(ctl_error, "%s: bind: %s: %s",
+ me, ctl_sa_ntop((const struct sockaddr *)sap,
+ tmp, sizeof tmp, ctx->logger),
+ strerror(save_errno));
+ close(ctx->sock);
+ memput(ctx, sizeof *ctx);
+ errno = save_errno;
+ return (NULL);
+ }
+ if (fcntl(ctx->sock, F_SETFD, 1) < 0) {
+ (*ctx->logger)(ctl_warning, "%s: fcntl: %s", me,
+ strerror(errno));
+ }
+ if (evListen(lev, ctx->sock, backlog, ctl_accept, ctx,
+ &ctx->acID) < 0) {
+ save_errno = errno;
+ (*ctx->logger)(ctl_error, "%s: evListen(fd %d): %s",
+ me, ctx->sock, strerror(errno));
+ close(ctx->sock);
+ memput(ctx, sizeof *ctx);
+ errno = save_errno;
+ return (NULL);
+ }
+ (*ctx->logger)(ctl_debug, "%s: new ctx %p, sock %d",
+ me, ctx, ctx->sock);
+ return (ctx);
+}
+
+/*%
+ * void
+ * ctl_endserver(ctx)
+ * if the control listener is open, close it. clean out all eventlib
+ * stuff. close all active sessions.
+ */
+void
+ctl_endserver(struct ctl_sctx *ctx) {
+ static const char me[] = "ctl_endserver";
+ struct ctl_sess *this, *next;
+
+ (*ctx->logger)(ctl_debug, "%s: ctx %p, sock %d, acID %p, sess %p",
+ me, ctx, ctx->sock, ctx->acID.opaque, ctx->sess);
+ if (ctx->acID.opaque != NULL) {
+ (void)evCancelConn(ctx->ev, ctx->acID);
+ ctx->acID.opaque = NULL;
+ }
+ if (ctx->sock != -1) {
+ (void) close(ctx->sock);
+ ctx->sock = -1;
+ }
+ for (this = HEAD(ctx->sess); this != NULL; this = next) {
+ next = NEXT(this, link);
+ ctl_close(this);
+ }
+ memput(ctx, sizeof *ctx);
+}
+
+/*%
+ * If body is non-NULL then it we add a "." line after it.
+ * Caller must have escaped lines with leading ".".
+ */
+void
+ctl_response(struct ctl_sess *sess, u_int code, const char *text,
+ u_int flags, const void *respctx, ctl_srvrdone donefunc,
+ void *uap, const char *body, size_t bodylen)
+{
+ static const char me[] = "ctl_response";
+ struct iovec iov[3], *iovp = iov;
+ struct ctl_sctx *ctx = sess->ctx;
+ char tmp[MAX_NTOP], *pc;
+ int n;
+
+ REQUIRE(sess->state == initializing ||
+ sess->state == processing ||
+ sess->state == reading_data ||
+ sess->state == writing);
+ REQUIRE(sess->wrtiID.opaque == NULL);
+ REQUIRE(sess->wrID.opaque == NULL);
+ ctl_new_state(sess, writing, me);
+ sess->donefunc = donefunc;
+ sess->uap = uap;
+ if (!allocated_p(sess->outbuf) &&
+ ctl_bufget(&sess->outbuf, ctx->logger) < 0) {
+ (*ctx->logger)(ctl_error, "%s: %s: cant get an output buffer",
+ me, address_expr);
+ goto untimely;
+ }
+ if (sizeof "000-\r\n" + strlen(text) > (size_t)MAX_LINELEN) {
+ (*ctx->logger)(ctl_error, "%s: %s: output buffer ovf, closing",
+ me, address_expr);
+ goto untimely;
+ }
+ sess->outbuf.used = SPRINTF((sess->outbuf.text, "%03d%c%s\r\n",
+ code, (flags & CTL_MORE) != 0 ? '-' : ' ',
+ text));
+ for (pc = sess->outbuf.text, n = 0;
+ n < (int)sess->outbuf.used-2; pc++, n++)
+ if (!isascii((unsigned char)*pc) ||
+ !isprint((unsigned char)*pc))
+ *pc = '\040';
+ *iovp++ = evConsIovec(sess->outbuf.text, sess->outbuf.used);
+ if (body != NULL) {
+ char *tmp;
+ DE_CONST(body, tmp);
+ *iovp++ = evConsIovec(tmp, bodylen);
+ DE_CONST(".\r\n", tmp);
+ *iovp++ = evConsIovec(tmp, 3);
+ }
+ (*ctx->logger)(ctl_debug, "%s: [%d] %s", me,
+ sess->outbuf.used, sess->outbuf.text);
+ if (evWrite(ctx->ev, sess->sock, iov, iovp - iov,
+ ctl_writedone, sess, &sess->wrID) < 0) {
+ (*ctx->logger)(ctl_error, "%s: %s: evWrite: %s", me,
+ address_expr, strerror(errno));
+ goto untimely;
+ }
+ if (evSetIdleTimer(ctx->ev, ctl_wrtimeout, sess, ctx->timeout,
+ &sess->wrtiID) < 0)
+ {
+ (*ctx->logger)(ctl_error, "%s: %s: evSetIdleTimer: %s", me,
+ address_expr, strerror(errno));
+ goto untimely;
+ }
+ if (evTimeRW(ctx->ev, sess->wrID, sess->wrtiID) < 0) {
+ (*ctx->logger)(ctl_error, "%s: %s: evTimeRW: %s", me,
+ address_expr, strerror(errno));
+ untimely:
+ ctl_signal_done(ctx, sess);
+ ctl_close(sess);
+ return;
+ }
+ sess->respctx = respctx;
+ sess->respflags = flags;
+}
+
+void
+ctl_sendhelp(struct ctl_sess *sess, u_int code) {
+ static const char me[] = "ctl_sendhelp";
+ struct ctl_sctx *ctx = sess->ctx;
+
+ sess->helpcode = code;
+ sess->verb = &fakehelpverb;
+ ctl_morehelp(ctx, sess, NULL, me, CTL_MORE,
+ (const void *)ctx->verbs, NULL);
+}
+
+void *
+ctl_getcsctx(struct ctl_sess *sess) {
+ return (sess->csctx);
+}
+
+void *
+ctl_setcsctx(struct ctl_sess *sess, void *csctx) {
+ void *old = sess->csctx;
+
+ sess->csctx = csctx;
+ return (old);
+}
+
+/* Private functions. */
+
+static void
+ctl_accept(evContext lev, void *uap, int fd,
+ const void *lav, int lalen,
+ const void *rav, int ralen)
+{
+ static const char me[] = "ctl_accept";
+ struct ctl_sctx *ctx = uap;
+ struct ctl_sess *sess = NULL;
+ char tmp[MAX_NTOP];
+
+ UNUSED(lev);
+ UNUSED(lalen);
+ UNUSED(ralen);
+
+ if (fd < 0) {
+ (*ctx->logger)(ctl_error, "%s: accept: %s",
+ me, strerror(errno));
+ return;
+ }
+ if (ctx->cur_sess == ctx->max_sess) {
+ (*ctx->logger)(ctl_error, "%s: %s: too many control sessions",
+ me, ctl_sa_ntop((const struct sockaddr *)rav,
+ tmp, sizeof tmp,
+ ctx->logger));
+ (void) close(fd);
+ return;
+ }
+ sess = memget(sizeof *sess);
+ if (sess == NULL) {
+ (*ctx->logger)(ctl_error, "%s: memget: %s", me,
+ strerror(errno));
+ (void) close(fd);
+ return;
+ }
+ if (fcntl(fd, F_SETFD, 1) < 0) {
+ (*ctx->logger)(ctl_warning, "%s: fcntl: %s", me,
+ strerror(errno));
+ }
+ ctx->cur_sess++;
+ INIT_LINK(sess, link);
+ APPEND(ctx->sess, sess, link);
+ sess->ctx = ctx;
+ sess->sock = fd;
+ sess->wrID.opaque = NULL;
+ sess->rdID.opaque = NULL;
+ sess->wrtiID.opaque = NULL;
+ sess->rdtiID.opaque = NULL;
+ sess->respctx = NULL;
+ sess->csctx = NULL;
+ if (((const struct sockaddr *)rav)->sa_family == AF_UNIX)
+ ctl_sa_copy((const struct sockaddr *)lav,
+ (struct sockaddr *)&sess->sa);
+ else
+ ctl_sa_copy((const struct sockaddr *)rav,
+ (struct sockaddr *)&sess->sa);
+ sess->donefunc = NULL;
+ buffer_init(sess->inbuf);
+ buffer_init(sess->outbuf);
+ sess->state = available;
+ ctl_new_state(sess, initializing, me);
+ sess->verb = ctx->connverb;
+ (*ctx->logger)(ctl_debug, "%s: %s: accepting (fd %d)",
+ me, address_expr, sess->sock);
+ (*ctx->connverb->func)(ctx, sess, ctx->connverb, "", 0,
+ (const struct sockaddr *)rav, ctx->uctx);
+}
+
+static void
+ctl_new_state(struct ctl_sess *sess, enum state new_state, const char *reason)
+{
+ static const char me[] = "ctl_new_state";
+ struct ctl_sctx *ctx = sess->ctx;
+ char tmp[MAX_NTOP];
+
+ (*ctx->logger)(ctl_debug, "%s: %s: %s -> %s (%s)",
+ me, address_expr,
+ state_names[sess->state],
+ state_names[new_state], reason);
+ sess->state = new_state;
+}
+
+static void
+ctl_close(struct ctl_sess *sess) {
+ static const char me[] = "ctl_close";
+ struct ctl_sctx *ctx = sess->ctx;
+ char tmp[MAX_NTOP];
+
+ REQUIRE(sess->state == initializing ||
+ sess->state == writing ||
+ sess->state == reading ||
+ sess->state == processing ||
+ sess->state == reading_data ||
+ sess->state == idling);
+ REQUIRE(sess->sock != -1);
+ if (sess->state == reading || sess->state == reading_data)
+ ctl_stop_read(sess);
+ else if (sess->state == writing) {
+ if (sess->wrID.opaque != NULL) {
+ (void) evCancelRW(ctx->ev, sess->wrID);
+ sess->wrID.opaque = NULL;
+ }
+ if (sess->wrtiID.opaque != NULL) {
+ (void) evClearIdleTimer(ctx->ev, sess->wrtiID);
+ sess->wrtiID.opaque = NULL;
+ }
+ }
+ ctl_new_state(sess, closing, me);
+ (void) close(sess->sock);
+ if (allocated_p(sess->inbuf))
+ ctl_bufput(&sess->inbuf);
+ if (allocated_p(sess->outbuf))
+ ctl_bufput(&sess->outbuf);
+ (*ctx->logger)(ctl_debug, "%s: %s: closed (fd %d)",
+ me, address_expr, sess->sock);
+ UNLINK(ctx->sess, sess, link);
+ memput(sess, sizeof *sess);
+ ctx->cur_sess--;
+}
+
+static void
+ctl_start_read(struct ctl_sess *sess) {
+ static const char me[] = "ctl_start_read";
+ struct ctl_sctx *ctx = sess->ctx;
+ char tmp[MAX_NTOP];
+
+ REQUIRE(sess->state == initializing ||
+ sess->state == writing ||
+ sess->state == processing ||
+ sess->state == idling);
+ REQUIRE(sess->rdtiID.opaque == NULL);
+ REQUIRE(sess->rdID.opaque == NULL);
+ sess->inbuf.used = 0;
+ if (evSetIdleTimer(ctx->ev, ctl_rdtimeout, sess, ctx->timeout,
+ &sess->rdtiID) < 0)
+ {
+ (*ctx->logger)(ctl_error, "%s: %s: evSetIdleTimer: %s", me,
+ address_expr, strerror(errno));
+ ctl_close(sess);
+ return;
+ }
+ if (evSelectFD(ctx->ev, sess->sock, EV_READ,
+ ctl_readable, sess, &sess->rdID) < 0) {
+ (*ctx->logger)(ctl_error, "%s: %s: evSelectFD: %s", me,
+ address_expr, strerror(errno));
+ return;
+ }
+ ctl_new_state(sess, reading, me);
+}
+
+static void
+ctl_stop_read(struct ctl_sess *sess) {
+ static const char me[] = "ctl_stop_read";
+ struct ctl_sctx *ctx = sess->ctx;
+
+ REQUIRE(sess->state == reading || sess->state == reading_data);
+ REQUIRE(sess->rdID.opaque != NULL);
+ (void) evDeselectFD(ctx->ev, sess->rdID);
+ sess->rdID.opaque = NULL;
+ if (sess->rdtiID.opaque != NULL) {
+ (void) evClearIdleTimer(ctx->ev, sess->rdtiID);
+ sess->rdtiID.opaque = NULL;
+ }
+ ctl_new_state(sess, idling, me);
+}
+
+static void
+ctl_readable(evContext lev, void *uap, int fd, int evmask) {
+ static const char me[] = "ctl_readable";
+ struct ctl_sess *sess = uap;
+ struct ctl_sctx *ctx;
+ char *eos, tmp[MAX_NTOP];
+ ssize_t n;
+
+ REQUIRE(sess != NULL);
+ REQUIRE(fd >= 0);
+ REQUIRE(evmask == EV_READ);
+ REQUIRE(sess->state == reading || sess->state == reading_data);
+
+ ctx = sess->ctx;
+ evTouchIdleTimer(lev, sess->rdtiID);
+ if (!allocated_p(sess->inbuf) &&
+ ctl_bufget(&sess->inbuf, ctx->logger) < 0) {
+ (*ctx->logger)(ctl_error, "%s: %s: cant get an input buffer",
+ me, address_expr);
+ ctl_close(sess);
+ return;
+ }
+ n = read(sess->sock, sess->inbuf.text + sess->inbuf.used,
+ MAX_LINELEN - sess->inbuf.used);
+ if (n <= 0) {
+ (*ctx->logger)(ctl_debug, "%s: %s: read: %s",
+ me, address_expr,
+ (n == 0) ? "Unexpected EOF" : strerror(errno));
+ ctl_close(sess);
+ return;
+ }
+ sess->inbuf.used += n;
+ eos = memchr(sess->inbuf.text, '\n', sess->inbuf.used);
+ if (eos != NULL && eos != sess->inbuf.text && eos[-1] == '\r') {
+ eos[-1] = '\0';
+ if ((sess->respflags & CTL_DATA) != 0) {
+ INSIST(sess->verb != NULL);
+ (*sess->verb->func)(sess->ctx, sess, sess->verb,
+ sess->inbuf.text,
+ CTL_DATA, sess->respctx,
+ sess->ctx->uctx);
+ } else {
+ ctl_stop_read(sess);
+ ctl_docommand(sess);
+ }
+ sess->inbuf.used -= ((eos - sess->inbuf.text) + 1);
+ if (sess->inbuf.used == 0U)
+ ctl_bufput(&sess->inbuf);
+ else
+ memmove(sess->inbuf.text, eos + 1, sess->inbuf.used);
+ return;
+ }
+ if (sess->inbuf.used == (size_t)MAX_LINELEN) {
+ (*ctx->logger)(ctl_error, "%s: %s: line too long, closing",
+ me, address_expr);
+ ctl_close(sess);
+ }
+}
+
+static void
+ctl_wrtimeout(evContext lev, void *uap,
+ struct timespec due,
+ struct timespec itv)
+{
+ static const char me[] = "ctl_wrtimeout";
+ struct ctl_sess *sess = uap;
+ struct ctl_sctx *ctx = sess->ctx;
+ char tmp[MAX_NTOP];
+
+ UNUSED(lev);
+ UNUSED(due);
+ UNUSED(itv);
+
+ REQUIRE(sess->state == writing);
+ sess->wrtiID.opaque = NULL;
+ (*ctx->logger)(ctl_warning, "%s: %s: write timeout, closing",
+ me, address_expr);
+ if (sess->wrID.opaque != NULL) {
+ (void) evCancelRW(ctx->ev, sess->wrID);
+ sess->wrID.opaque = NULL;
+ }
+ ctl_signal_done(ctx, sess);
+ ctl_new_state(sess, processing, me);
+ ctl_close(sess);
+}
+
+static void
+ctl_rdtimeout(evContext lev, void *uap,
+ struct timespec due,
+ struct timespec itv)
+{
+ static const char me[] = "ctl_rdtimeout";
+ struct ctl_sess *sess = uap;
+ struct ctl_sctx *ctx = sess->ctx;
+ char tmp[MAX_NTOP];
+
+ UNUSED(lev);
+ UNUSED(due);
+ UNUSED(itv);
+
+ REQUIRE(sess->state == reading);
+ sess->rdtiID.opaque = NULL;
+ (*ctx->logger)(ctl_warning, "%s: %s: timeout, closing",
+ me, address_expr);
+ if (sess->state == reading || sess->state == reading_data)
+ ctl_stop_read(sess);
+ ctl_signal_done(ctx, sess);
+ ctl_new_state(sess, processing, me);
+ ctl_response(sess, ctx->timeoutcode, "Timeout.", CTL_EXIT, NULL,
+ NULL, NULL, NULL, 0);
+}
+
+static void
+ctl_docommand(struct ctl_sess *sess) {
+ static const char me[] = "ctl_docommand";
+ char *name, *rest, tmp[MAX_NTOP];
+ struct ctl_sctx *ctx = sess->ctx;
+ const struct ctl_verb *verb;
+
+ REQUIRE(allocated_p(sess->inbuf));
+ (*ctx->logger)(ctl_debug, "%s: %s: \"%s\" [%u]",
+ me, address_expr,
+ sess->inbuf.text, (u_int)sess->inbuf.used);
+ ctl_new_state(sess, processing, me);
+ name = sess->inbuf.text + strspn(sess->inbuf.text, space);
+ rest = name + strcspn(name, space);
+ if (*rest != '\0') {
+ *rest++ = '\0';
+ rest += strspn(rest, space);
+ }
+ for (verb = ctx->verbs;
+ verb != NULL && verb->name != NULL && verb->func != NULL;
+ verb++)
+ if (verb->name[0] != '\0' && strcasecmp(name, verb->name) == 0)
+ break;
+ if (verb != NULL && verb->name != NULL && verb->func != NULL) {
+ sess->verb = verb;
+ (*verb->func)(ctx, sess, verb, rest, 0, NULL, ctx->uctx);
+ } else {
+ char buf[1100];
+
+ if (sizeof "Unrecognized command \"\" (args \"\")" +
+ strlen(name) + strlen(rest) > sizeof buf)
+ strcpy(buf, "Unrecognized command (buf ovf)");
+ else
+ sprintf(buf,
+ "Unrecognized command \"%s\" (args \"%s\")",
+ name, rest);
+ ctl_response(sess, ctx->unkncode, buf, 0, NULL, NULL, NULL,
+ NULL, 0);
+ }
+}
+
+static void
+ctl_writedone(evContext lev, void *uap, int fd, int bytes) {
+ static const char me[] = "ctl_writedone";
+ struct ctl_sess *sess = uap;
+ struct ctl_sctx *ctx = sess->ctx;
+ char tmp[MAX_NTOP];
+ int save_errno = errno;
+
+ UNUSED(lev);
+ UNUSED(uap);
+
+ REQUIRE(sess->state == writing);
+ REQUIRE(fd == sess->sock);
+ REQUIRE(sess->wrtiID.opaque != NULL);
+ sess->wrID.opaque = NULL;
+ (void) evClearIdleTimer(ctx->ev, sess->wrtiID);
+ sess->wrtiID.opaque = NULL;
+ if (bytes < 0) {
+ (*ctx->logger)(ctl_error, "%s: %s: %s",
+ me, address_expr, strerror(save_errno));
+ ctl_close(sess);
+ return;
+ }
+
+ INSIST(allocated_p(sess->outbuf));
+ ctl_bufput(&sess->outbuf);
+ if ((sess->respflags & CTL_EXIT) != 0) {
+ ctl_signal_done(ctx, sess);
+ ctl_close(sess);
+ return;
+ } else if ((sess->respflags & CTL_MORE) != 0) {
+ INSIST(sess->verb != NULL);
+ (*sess->verb->func)(sess->ctx, sess, sess->verb, "",
+ CTL_MORE, sess->respctx, sess->ctx->uctx);
+ } else {
+ ctl_signal_done(ctx, sess);
+ ctl_start_read(sess);
+ }
+}
+
+static void
+ctl_morehelp(struct ctl_sctx *ctx, struct ctl_sess *sess,
+ const struct ctl_verb *verb, const char *text,
+ u_int respflags, const void *respctx, void *uctx)
+{
+ const struct ctl_verb *this = respctx, *next = this + 1;
+
+ UNUSED(ctx);
+ UNUSED(verb);
+ UNUSED(text);
+ UNUSED(uctx);
+
+ REQUIRE(!lastverb_p(this));
+ REQUIRE((respflags & CTL_MORE) != 0);
+ if (lastverb_p(next))
+ respflags &= ~CTL_MORE;
+ ctl_response(sess, sess->helpcode, this->help, respflags, next,
+ NULL, NULL, NULL, 0);
+}
+
+static void
+ctl_signal_done(struct ctl_sctx *ctx, struct ctl_sess *sess) {
+ if (sess->donefunc != NULL) {
+ (*sess->donefunc)(ctx, sess, sess->uap);
+ sess->donefunc = NULL;
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ev_connects.c b/usr/src/lib/libresolv2_joy/common/isc/ev_connects.c
new file mode 100644
index 0000000000..38dfdbe512
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ev_connects.c
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995-1999 by Internet Software Consortium
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* ev_connects.c - implement asynch connect/accept for the eventlib
+ * vix 16sep96 [initial]
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: ev_connects.c,v 1.8 2006/03/09 23:57:56 marka Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+
+#include <unistd.h>
+
+#include <isc/eventlib.h>
+#include <isc/assertions.h>
+#include "eventlib_p.h"
+
+#include "port_after.h"
+
+/* Macros. */
+
+#define GETXXXNAME(f, s, sa, len) ( \
+ (f((s), (&sa), (&len)) >= 0) ? 0 : \
+ (errno != EAFNOSUPPORT && errno != EOPNOTSUPP) ? -1 : ( \
+ memset(&(sa), 0, sizeof (sa)), \
+ (len) = sizeof (sa), \
+ (sa).sa_family = AF_UNIX, \
+ 0 \
+ ) \
+ )
+
+/* Forward. */
+
+static void listener(evContext ctx, void *uap, int fd, int evmask);
+static void connector(evContext ctx, void *uap, int fd, int evmask);
+
+/* Public. */
+
+int
+evListen(evContext opaqueCtx, int fd, int maxconn,
+ evConnFunc func, void *uap, evConnID *id)
+{
+ evContext_p *ctx = opaqueCtx.opaque;
+ evConn *new;
+ int mode;
+
+ OKNEW(new);
+ new->flags = EV_CONN_LISTEN;
+ OKFREE(mode = fcntl(fd, F_GETFL, NULL), new); /*%< side effect: validate fd. */
+ /*
+ * Remember the nonblocking status. We assume that either evSelectFD
+ * has not been done to this fd, or that if it has then the caller
+ * will evCancelConn before they evDeselectFD. If our assumptions
+ * are not met, then we might restore the old nonblocking status
+ * incorrectly.
+ */
+ if ((mode & PORT_NONBLOCK) == 0) {
+#ifdef USE_FIONBIO_IOCTL
+ int on = 1;
+ OKFREE(ioctl(fd, FIONBIO, (char *)&on), new);
+#else
+ OKFREE(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK), new);
+#endif
+ new->flags |= EV_CONN_BLOCK;
+ }
+ OKFREE(listen(fd, maxconn), new);
+ if (evSelectFD(opaqueCtx, fd, EV_READ, listener, new, &new->file) < 0){
+ int save = errno;
+
+ FREE(new);
+ errno = save;
+ return (-1);
+ }
+ new->flags |= EV_CONN_SELECTED;
+ new->func = func;
+ new->uap = uap;
+ new->fd = fd;
+ if (ctx->conns != NULL)
+ ctx->conns->prev = new;
+ new->prev = NULL;
+ new->next = ctx->conns;
+ ctx->conns = new;
+ if (id)
+ id->opaque = new;
+ return (0);
+}
+
+int
+evConnect(evContext opaqueCtx, int fd, const void *ra, int ralen,
+ evConnFunc func, void *uap, evConnID *id)
+{
+ evContext_p *ctx = opaqueCtx.opaque;
+ evConn *new;
+
+ OKNEW(new);
+ new->flags = 0;
+ /* Do the select() first to get the socket into nonblocking mode. */
+ if (evSelectFD(opaqueCtx, fd, EV_MASK_ALL,
+ connector, new, &new->file) < 0) {
+ int save = errno;
+
+ FREE(new);
+ errno = save;
+ return (-1);
+ }
+ new->flags |= EV_CONN_SELECTED;
+ if (connect(fd, ra, ralen) < 0 &&
+ errno != EWOULDBLOCK &&
+ errno != EAGAIN &&
+ errno != EINPROGRESS) {
+ int save = errno;
+
+ (void) evDeselectFD(opaqueCtx, new->file);
+ FREE(new);
+ errno = save;
+ return (-1);
+ }
+ /* No error, or EWOULDBLOCK. select() tells when it's ready. */
+ new->func = func;
+ new->uap = uap;
+ new->fd = fd;
+ if (ctx->conns != NULL)
+ ctx->conns->prev = new;
+ new->prev = NULL;
+ new->next = ctx->conns;
+ ctx->conns = new;
+ if (id)
+ id->opaque = new;
+ return (0);
+}
+
+int
+evCancelConn(evContext opaqueCtx, evConnID id) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evConn *this = id.opaque;
+ evAccept *acc, *nxtacc;
+ int mode;
+
+ if ((this->flags & EV_CONN_SELECTED) != 0)
+ (void) evDeselectFD(opaqueCtx, this->file);
+ if ((this->flags & EV_CONN_BLOCK) != 0) {
+ mode = fcntl(this->fd, F_GETFL, NULL);
+ if (mode == -1) {
+ if (errno != EBADF)
+ return (-1);
+ } else {
+#ifdef USE_FIONBIO_IOCTL
+ int off = 0;
+ OK(ioctl(this->fd, FIONBIO, (char *)&off));
+#else
+ OK(fcntl(this->fd, F_SETFL, mode & ~PORT_NONBLOCK));
+#endif
+ }
+ }
+
+ /* Unlink from ctx->conns. */
+ if (this->prev != NULL)
+ this->prev->next = this->next;
+ else
+ ctx->conns = this->next;
+ if (this->next != NULL)
+ this->next->prev = this->prev;
+
+ /*
+ * Remove `this' from the ctx->accepts list (zero or more times).
+ */
+ for (acc = HEAD(ctx->accepts), nxtacc = NULL;
+ acc != NULL;
+ acc = nxtacc)
+ {
+ nxtacc = NEXT(acc, link);
+ if (acc->conn == this) {
+ UNLINK(ctx->accepts, acc, link);
+ close(acc->fd);
+ FREE(acc);
+ }
+ }
+
+ /* Wrap up and get out. */
+ FREE(this);
+ return (0);
+}
+
+int evHold(evContext opaqueCtx, evConnID id) {
+ evConn *this = id.opaque;
+
+ if ((this->flags & EV_CONN_LISTEN) == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if ((this->flags & EV_CONN_SELECTED) == 0)
+ return (0);
+ this->flags &= ~EV_CONN_SELECTED;
+ return (evDeselectFD(opaqueCtx, this->file));
+}
+
+int evUnhold(evContext opaqueCtx, evConnID id) {
+ evConn *this = id.opaque;
+ int ret;
+
+ if ((this->flags & EV_CONN_LISTEN) == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if ((this->flags & EV_CONN_SELECTED) != 0)
+ return (0);
+ ret = evSelectFD(opaqueCtx, this->fd, EV_READ, listener, this,
+ &this->file);
+ if (ret == 0)
+ this->flags |= EV_CONN_SELECTED;
+ return (ret);
+}
+
+int
+evTryAccept(evContext opaqueCtx, evConnID id, int *sys_errno) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evConn *conn = id.opaque;
+ evAccept *new;
+
+ if ((conn->flags & EV_CONN_LISTEN) == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ OKNEW(new);
+ new->conn = conn;
+ new->ralen = sizeof new->ra;
+ new->fd = accept(conn->fd, &new->ra.sa, &new->ralen);
+ if (new->fd > ctx->highestFD) {
+ close(new->fd);
+ new->fd = -1;
+ new->ioErrno = ENOTSOCK;
+ }
+ if (new->fd >= 0) {
+ new->lalen = sizeof new->la;
+ if (GETXXXNAME(getsockname, new->fd, new->la.sa, new->lalen) < 0) {
+ new->ioErrno = errno;
+ (void) close(new->fd);
+ new->fd = -1;
+ } else
+ new->ioErrno = 0;
+ } else {
+ new->ioErrno = errno;
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ FREE(new);
+ return (-1);
+ }
+ }
+ INIT_LINK(new, link);
+ APPEND(ctx->accepts, new, link);
+ *sys_errno = new->ioErrno;
+ return (0);
+}
+
+/* Private. */
+
+static void
+listener(evContext opaqueCtx, void *uap, int fd, int evmask) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evConn *conn = uap;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in in;
+#ifndef NO_SOCKADDR_UN
+ struct sockaddr_un un;
+#endif
+ } la, ra;
+ int new;
+ ISC_SOCKLEN_T lalen = 0, ralen;
+
+ REQUIRE((evmask & EV_READ) != 0);
+ ralen = sizeof ra;
+ new = accept(fd, &ra.sa, &ralen);
+ if (new > ctx->highestFD) {
+ close(new);
+ new = -1;
+ errno = ENOTSOCK;
+ }
+ if (new >= 0) {
+ lalen = sizeof la;
+ if (GETXXXNAME(getsockname, new, la.sa, lalen) < 0) {
+ int save = errno;
+
+ (void) close(new);
+ errno = save;
+ new = -1;
+ }
+ } else if (errno == EAGAIN || errno == EWOULDBLOCK)
+ return;
+ (*conn->func)(opaqueCtx, conn->uap, new, &la.sa, lalen, &ra.sa, ralen);
+}
+
+static void
+connector(evContext opaqueCtx, void *uap, int fd, int evmask) {
+ evConn *conn = uap;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in in;
+#ifndef NO_SOCKADDR_UN
+ struct sockaddr_un un;
+#endif
+ } la, ra;
+ ISC_SOCKLEN_T lalen, ralen;
+#ifndef NETREAD_BROKEN
+ char buf[1];
+#endif
+ void *conn_uap;
+ evConnFunc conn_func;
+ evConnID id;
+ int socket_errno = 0;
+ ISC_SOCKLEN_T optlen;
+
+ UNUSED(evmask);
+
+ lalen = sizeof la;
+ ralen = sizeof ra;
+ conn_uap = conn->uap;
+ conn_func = conn->func;
+ id.opaque = conn;
+#ifdef SO_ERROR
+ optlen = sizeof socket_errno;
+ if (fd < 0 &&
+ getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, (char *)&socket_errno,
+ &optlen) < 0)
+ socket_errno = errno;
+ else
+ errno = socket_errno;
+#endif
+ if (evCancelConn(opaqueCtx, id) < 0 ||
+ socket_errno ||
+#ifdef NETREAD_BROKEN
+ 0 ||
+#else
+ read(fd, buf, 0) < 0 ||
+#endif
+ GETXXXNAME(getsockname, fd, la.sa, lalen) < 0 ||
+ GETXXXNAME(getpeername, fd, ra.sa, ralen) < 0) {
+ int save = errno;
+
+ (void) close(fd); /*%< XXX closing caller's fd */
+ errno = save;
+ fd = -1;
+ }
+ (*conn_func)(opaqueCtx, conn_uap, fd, &la.sa, lalen, &ra.sa, ralen);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ev_files.c b/usr/src/lib/libresolv2_joy/common/isc/ev_files.c
new file mode 100644
index 0000000000..b12baf1aaa
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ev_files.c
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995-1999 by Internet Software Consortium
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* ev_files.c - implement asynch file IO for the eventlib
+ * vix 11sep95 [initial]
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: ev_files.c,v 1.8 2005/07/28 06:51:48 marka Exp $";
+#endif
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <isc/eventlib.h>
+#include "eventlib_p.h"
+
+#include "port_after.h"
+
+static evFile *FindFD(const evContext_p *ctx, int fd, int eventmask);
+
+int
+evSelectFD(evContext opaqueCtx,
+ int fd,
+ int eventmask,
+ evFileFunc func,
+ void *uap,
+ evFileID *opaqueID
+) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evFile *id;
+ int mode;
+
+ evPrintf(ctx, 1,
+ "evSelectFD(ctx %p, fd %d, mask 0x%x, func %p, uap %p)\n",
+ ctx, fd, eventmask, func, uap);
+ if (eventmask == 0 || (eventmask & ~EV_MASK_ALL) != 0)
+ EV_ERR(EINVAL);
+#ifndef USE_POLL
+ if (fd > ctx->highestFD)
+ EV_ERR(EINVAL);
+#endif
+ OK(mode = fcntl(fd, F_GETFL, NULL)); /*%< side effect: validate fd. */
+ /*
+ * The first time we touch a file descriptor, we need to check to see
+ * if the application already had it in O_NONBLOCK mode and if so, all
+ * of our deselect()'s have to leave it in O_NONBLOCK. If not, then
+ * all but our last deselect() has to leave it in O_NONBLOCK.
+ */
+#ifdef USE_POLL
+ /* Make sure both ctx->pollfds[] and ctx->fdTable[] are large enough */
+ if (fd >= ctx->maxnfds && evPollfdRealloc(ctx, 1, fd) != 0)
+ EV_ERR(ENOMEM);
+#endif /* USE_POLL */
+ id = FindFD(ctx, fd, EV_MASK_ALL);
+ if (id == NULL) {
+ if (mode & PORT_NONBLOCK)
+ FD_SET(fd, &ctx->nonblockBefore);
+ else {
+#ifdef USE_FIONBIO_IOCTL
+ int on = 1;
+ OK(ioctl(fd, FIONBIO, (char *)&on));
+#else
+ OK(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK));
+#endif
+ FD_CLR(fd, &ctx->nonblockBefore);
+ }
+ }
+
+ /*
+ * If this descriptor is already in use, search for it again to see
+ * if any of the eventmask bits we want to set are already captured.
+ * We cannot usefully capture the same fd event more than once in the
+ * same context.
+ */
+ if (id != NULL && FindFD(ctx, fd, eventmask) != NULL)
+ EV_ERR(ETOOMANYREFS);
+
+ /* Allocate and fill. */
+ OKNEW(id);
+ id->func = func;
+ id->uap = uap;
+ id->fd = fd;
+ id->eventmask = eventmask;
+
+ /*
+ * Insert at head. Order could be important for performance if we
+ * believe that evGetNext()'s accesses to the fd_sets will be more
+ * serial and therefore more cache-lucky if the list is ordered by
+ * ``fd.'' We do not believe these things, so we don't do it.
+ *
+ * The interesting sequence is where GetNext() has cached a select()
+ * result and the caller decides to evSelectFD() on some descriptor.
+ * Since GetNext() starts at the head, it can miss new entries we add
+ * at the head. This is not a serious problem since the event being
+ * evSelectFD()'d for has to occur before evSelectFD() is called for
+ * the file event to be considered "missed" -- a real corner case.
+ * Maintaining a "tail" pointer for ctx->files would fix this, but I'm
+ * not sure it would be ``more correct.''
+ */
+ if (ctx->files != NULL)
+ ctx->files->prev = id;
+ id->prev = NULL;
+ id->next = ctx->files;
+ ctx->files = id;
+
+ /* Insert into fd table. */
+ if (ctx->fdTable[fd] != NULL)
+ ctx->fdTable[fd]->fdprev = id;
+ id->fdprev = NULL;
+ id->fdnext = ctx->fdTable[fd];
+ ctx->fdTable[fd] = id;
+
+ /* Turn on the appropriate bits in the {rd,wr,ex}Next fd_set's. */
+ if (eventmask & EV_READ)
+ FD_SET(fd, &ctx->rdNext);
+ if (eventmask & EV_WRITE)
+ FD_SET(fd, &ctx->wrNext);
+ if (eventmask & EV_EXCEPT)
+ FD_SET(fd, &ctx->exNext);
+
+ /* Update fdMax. */
+ if (fd > ctx->fdMax)
+ ctx->fdMax = fd;
+
+ /* Remember the ID if the caller provided us a place for it. */
+ if (opaqueID)
+ opaqueID->opaque = id;
+
+ return (0);
+}
+
+int
+evDeselectFD(evContext opaqueCtx, evFileID opaqueID) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evFile *del = opaqueID.opaque;
+ evFile *cur;
+ int mode, eventmask;
+
+ if (!del) {
+ evPrintf(ctx, 11, "evDeselectFD(NULL) ignored\n");
+ errno = EINVAL;
+ return (-1);
+ }
+
+ evPrintf(ctx, 1, "evDeselectFD(fd %d, mask 0x%x)\n",
+ del->fd, del->eventmask);
+
+ /* Get the mode. Unless the file has been closed, errors are bad. */
+ mode = fcntl(del->fd, F_GETFL, NULL);
+ if (mode == -1 && errno != EBADF)
+ EV_ERR(errno);
+
+ /* Remove from the list of files. */
+ if (del->prev != NULL)
+ del->prev->next = del->next;
+ else
+ ctx->files = del->next;
+ if (del->next != NULL)
+ del->next->prev = del->prev;
+
+ /* Remove from the fd table. */
+ if (del->fdprev != NULL)
+ del->fdprev->fdnext = del->fdnext;
+ else
+ ctx->fdTable[del->fd] = del->fdnext;
+ if (del->fdnext != NULL)
+ del->fdnext->fdprev = del->fdprev;
+
+ /*
+ * If the file descriptor does not appear in any other select() entry,
+ * and if !EV_WASNONBLOCK, and if we got no EBADF when we got the mode
+ * earlier, then: restore the fd to blocking status.
+ */
+ if (!(cur = FindFD(ctx, del->fd, EV_MASK_ALL)) &&
+ !FD_ISSET(del->fd, &ctx->nonblockBefore) &&
+ mode != -1) {
+ /*
+ * Note that we won't return an error status to the caller if
+ * this fcntl() fails since (a) we've already done the work
+ * and (b) the caller didn't ask us anything about O_NONBLOCK.
+ */
+#ifdef USE_FIONBIO_IOCTL
+ int off = 0;
+ (void) ioctl(del->fd, FIONBIO, (char *)&off);
+#else
+ (void) fcntl(del->fd, F_SETFL, mode & ~PORT_NONBLOCK);
+#endif
+ }
+
+ /*
+ * Now find all other uses of this descriptor and OR together an event
+ * mask so that we don't turn off {rd,wr,ex}Next bits that some other
+ * file event is using. As an optimization, stop if the event mask
+ * fills.
+ */
+ eventmask = 0;
+ for ((void)NULL;
+ cur != NULL && eventmask != EV_MASK_ALL;
+ cur = cur->next)
+ if (cur->fd == del->fd)
+ eventmask |= cur->eventmask;
+
+ /* OK, now we know which bits we can clear out. */
+ if (!(eventmask & EV_READ)) {
+ FD_CLR(del->fd, &ctx->rdNext);
+ if (FD_ISSET(del->fd, &ctx->rdLast)) {
+ FD_CLR(del->fd, &ctx->rdLast);
+ ctx->fdCount--;
+ }
+ }
+ if (!(eventmask & EV_WRITE)) {
+ FD_CLR(del->fd, &ctx->wrNext);
+ if (FD_ISSET(del->fd, &ctx->wrLast)) {
+ FD_CLR(del->fd, &ctx->wrLast);
+ ctx->fdCount--;
+ }
+ }
+ if (!(eventmask & EV_EXCEPT)) {
+ FD_CLR(del->fd, &ctx->exNext);
+ if (FD_ISSET(del->fd, &ctx->exLast)) {
+ FD_CLR(del->fd, &ctx->exLast);
+ ctx->fdCount--;
+ }
+ }
+
+ /* If this was the maxFD, find the new one. */
+ if (del->fd == ctx->fdMax) {
+ ctx->fdMax = -1;
+ for (cur = ctx->files; cur; cur = cur->next)
+ if (cur->fd > ctx->fdMax)
+ ctx->fdMax = cur->fd;
+ }
+
+ /* If this was the fdNext, cycle that to the next entry. */
+ if (del == ctx->fdNext)
+ ctx->fdNext = del->next;
+
+ /* Couldn't free it before now since we were using fields out of it. */
+ FREE(del);
+
+ return (0);
+}
+
+static evFile *
+FindFD(const evContext_p *ctx, int fd, int eventmask) {
+ evFile *id;
+
+ for (id = ctx->fdTable[fd]; id != NULL; id = id->fdnext)
+ if (id->fd == fd && (id->eventmask & eventmask) != 0)
+ break;
+ return (id);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ev_streams.c b/usr/src/lib/libresolv2_joy/common/isc/ev_streams.c
new file mode 100644
index 0000000000..5dad36d04a
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ev_streams.c
@@ -0,0 +1,308 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* ev_streams.c - implement asynch stream file IO for the eventlib
+ * vix 04mar96 [initial]
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: ev_streams.c,v 1.5 2005/04/27 04:56:36 sra Exp $";
+#endif
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/uio.h>
+
+#include <errno.h>
+
+#include <isc/eventlib.h>
+#include <isc/assertions.h>
+#include "eventlib_p.h"
+
+#include "port_after.h"
+
+static int copyvec(evStream *str, const struct iovec *iov, int iocnt);
+static void consume(evStream *str, size_t bytes);
+static void done(evContext opaqueCtx, evStream *str);
+static void writable(evContext opaqueCtx, void *uap, int fd, int evmask);
+static void readable(evContext opaqueCtx, void *uap, int fd, int evmask);
+
+struct iovec
+evConsIovec(void *buf, size_t cnt) {
+ struct iovec ret;
+
+ memset(&ret, 0xf5, sizeof ret);
+ ret.iov_base = buf;
+ ret.iov_len = cnt;
+ return (ret);
+}
+
+int
+evWrite(evContext opaqueCtx, int fd, const struct iovec *iov, int iocnt,
+ evStreamFunc func, void *uap, evStreamID *id)
+{
+ evContext_p *ctx = opaqueCtx.opaque;
+ evStream *new;
+ int save;
+
+ OKNEW(new);
+ new->func = func;
+ new->uap = uap;
+ new->fd = fd;
+ new->flags = 0;
+ if (evSelectFD(opaqueCtx, fd, EV_WRITE, writable, new, &new->file) < 0)
+ goto free;
+ if (copyvec(new, iov, iocnt) < 0)
+ goto free;
+ new->prevDone = NULL;
+ new->nextDone = NULL;
+ if (ctx->streams != NULL)
+ ctx->streams->prev = new;
+ new->prev = NULL;
+ new->next = ctx->streams;
+ ctx->streams = new;
+ if (id != NULL)
+ id->opaque = new;
+ return (0);
+ free:
+ save = errno;
+ FREE(new);
+ errno = save;
+ return (-1);
+}
+
+int
+evRead(evContext opaqueCtx, int fd, const struct iovec *iov, int iocnt,
+ evStreamFunc func, void *uap, evStreamID *id)
+{
+ evContext_p *ctx = opaqueCtx.opaque;
+ evStream *new;
+ int save;
+
+ OKNEW(new);
+ new->func = func;
+ new->uap = uap;
+ new->fd = fd;
+ new->flags = 0;
+ if (evSelectFD(opaqueCtx, fd, EV_READ, readable, new, &new->file) < 0)
+ goto free;
+ if (copyvec(new, iov, iocnt) < 0)
+ goto free;
+ new->prevDone = NULL;
+ new->nextDone = NULL;
+ if (ctx->streams != NULL)
+ ctx->streams->prev = new;
+ new->prev = NULL;
+ new->next = ctx->streams;
+ ctx->streams = new;
+ if (id)
+ id->opaque = new;
+ return (0);
+ free:
+ save = errno;
+ FREE(new);
+ errno = save;
+ return (-1);
+}
+
+int
+evTimeRW(evContext opaqueCtx, evStreamID id, evTimerID timer) /*ARGSUSED*/ {
+ evStream *str = id.opaque;
+
+ UNUSED(opaqueCtx);
+
+ str->timer = timer;
+ str->flags |= EV_STR_TIMEROK;
+ return (0);
+}
+
+int
+evUntimeRW(evContext opaqueCtx, evStreamID id) /*ARGSUSED*/ {
+ evStream *str = id.opaque;
+
+ UNUSED(opaqueCtx);
+
+ str->flags &= ~EV_STR_TIMEROK;
+ return (0);
+}
+
+int
+evCancelRW(evContext opaqueCtx, evStreamID id) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evStream *old = id.opaque;
+
+ /*
+ * The streams list is doubly threaded. First, there's ctx->streams
+ * that's used by evDestroy() to find and cancel all streams. Second,
+ * there's ctx->strDone (head) and ctx->strLast (tail) which thread
+ * through the potentially smaller number of "IO completed" streams,
+ * used in evGetNext() to avoid scanning the entire list.
+ */
+
+ /* Unlink from ctx->streams. */
+ if (old->prev != NULL)
+ old->prev->next = old->next;
+ else
+ ctx->streams = old->next;
+ if (old->next != NULL)
+ old->next->prev = old->prev;
+
+ /*
+ * If 'old' is on the ctx->strDone list, remove it. Update
+ * ctx->strLast if necessary.
+ */
+ if (old->prevDone == NULL && old->nextDone == NULL) {
+ /*
+ * Either 'old' is the only item on the done list, or it's
+ * not on the done list. If the former, then we unlink it
+ * from the list. If the latter, we leave the list alone.
+ */
+ if (ctx->strDone == old) {
+ ctx->strDone = NULL;
+ ctx->strLast = NULL;
+ }
+ } else {
+ if (old->prevDone != NULL)
+ old->prevDone->nextDone = old->nextDone;
+ else
+ ctx->strDone = old->nextDone;
+ if (old->nextDone != NULL)
+ old->nextDone->prevDone = old->prevDone;
+ else
+ ctx->strLast = old->prevDone;
+ }
+
+ /* Deallocate the stream. */
+ if (old->file.opaque)
+ evDeselectFD(opaqueCtx, old->file);
+ memput(old->iovOrig, sizeof (struct iovec) * old->iovOrigCount);
+ FREE(old);
+ return (0);
+}
+
+/* Copy a scatter/gather vector and initialize a stream handler's IO. */
+static int
+copyvec(evStream *str, const struct iovec *iov, int iocnt) {
+ int i;
+
+ str->iovOrig = (struct iovec *)memget(sizeof(struct iovec) * iocnt);
+ if (str->iovOrig == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ str->ioTotal = 0;
+ for (i = 0; i < iocnt; i++) {
+ str->iovOrig[i] = iov[i];
+ str->ioTotal += iov[i].iov_len;
+ }
+ str->iovOrigCount = iocnt;
+ str->iovCur = str->iovOrig;
+ str->iovCurCount = str->iovOrigCount;
+ str->ioDone = 0;
+ return (0);
+}
+
+/* Pull off or truncate lead iovec(s). */
+static void
+consume(evStream *str, size_t bytes) {
+ while (bytes > 0U) {
+ if (bytes < (size_t)str->iovCur->iov_len) {
+ str->iovCur->iov_len -= bytes;
+ str->iovCur->iov_base = (void *)
+ ((u_char *)str->iovCur->iov_base + bytes);
+ str->ioDone += bytes;
+ bytes = 0;
+ } else {
+ bytes -= str->iovCur->iov_len;
+ str->ioDone += str->iovCur->iov_len;
+ str->iovCur++;
+ str->iovCurCount--;
+ }
+ }
+}
+
+/* Add a stream to Done list and deselect the FD. */
+static void
+done(evContext opaqueCtx, evStream *str) {
+ evContext_p *ctx = opaqueCtx.opaque;
+
+ if (ctx->strLast != NULL) {
+ str->prevDone = ctx->strLast;
+ ctx->strLast->nextDone = str;
+ ctx->strLast = str;
+ } else {
+ INSIST(ctx->strDone == NULL);
+ ctx->strDone = ctx->strLast = str;
+ }
+ evDeselectFD(opaqueCtx, str->file);
+ str->file.opaque = NULL;
+ /* evDrop() will call evCancelRW() on us. */
+}
+
+/* Dribble out some bytes on the stream. (Called by evDispatch().) */
+static void
+writable(evContext opaqueCtx, void *uap, int fd, int evmask) {
+ evStream *str = uap;
+ int bytes;
+
+ UNUSED(evmask);
+
+ bytes = writev(fd, str->iovCur, str->iovCurCount);
+ if (bytes > 0) {
+ if ((str->flags & EV_STR_TIMEROK) != 0)
+ evTouchIdleTimer(opaqueCtx, str->timer);
+ consume(str, bytes);
+ } else {
+ if (bytes < 0 && errno != EINTR) {
+ str->ioDone = -1;
+ str->ioErrno = errno;
+ }
+ }
+ if (str->ioDone == -1 || str->ioDone == str->ioTotal)
+ done(opaqueCtx, str);
+}
+
+/* Scoop up some bytes from the stream. (Called by evDispatch().) */
+static void
+readable(evContext opaqueCtx, void *uap, int fd, int evmask) {
+ evStream *str = uap;
+ int bytes;
+
+ UNUSED(evmask);
+
+ bytes = readv(fd, str->iovCur, str->iovCurCount);
+ if (bytes > 0) {
+ if ((str->flags & EV_STR_TIMEROK) != 0)
+ evTouchIdleTimer(opaqueCtx, str->timer);
+ consume(str, bytes);
+ } else {
+ if (bytes == 0)
+ str->ioDone = 0;
+ else {
+ if (errno != EINTR) {
+ str->ioDone = -1;
+ str->ioErrno = errno;
+ }
+ }
+ }
+ if (str->ioDone <= 0 || str->ioDone == str->ioTotal)
+ done(opaqueCtx, str);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ev_timers.c b/usr/src/lib/libresolv2_joy/common/isc/ev_timers.c
new file mode 100644
index 0000000000..12ac2cebca
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ev_timers.c
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995-1999 by Internet Software Consortium
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* ev_timers.c - implement timers for the eventlib
+ * vix 09sep95 [initial]
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: ev_timers.c,v 1.6 2005/04/27 04:56:36 sra Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <errno.h>
+
+#include <isc/assertions.h>
+#include <isc/eventlib.h>
+#include "eventlib_p.h"
+
+#include "port_after.h"
+
+/* Constants. */
+
+#define MILLION 1000000
+#define BILLION 1000000000
+
+/* Forward. */
+
+static int due_sooner(void *, void *);
+static void set_index(void *, int);
+static void free_timer(void *, void *);
+static void print_timer(void *, void *);
+static void idle_timeout(evContext, void *, struct timespec, struct timespec);
+
+/* Private type. */
+
+typedef struct {
+ evTimerFunc func;
+ void * uap;
+ struct timespec lastTouched;
+ struct timespec max_idle;
+ evTimer * timer;
+} idle_timer;
+
+/* Public. */
+
+struct timespec
+evConsTime(time_t sec, long nsec) {
+ struct timespec x;
+
+ x.tv_sec = sec;
+ x.tv_nsec = nsec;
+ return (x);
+}
+
+struct timespec
+evAddTime(struct timespec addend1, struct timespec addend2) {
+ struct timespec x;
+
+ x.tv_sec = addend1.tv_sec + addend2.tv_sec;
+ x.tv_nsec = addend1.tv_nsec + addend2.tv_nsec;
+ if (x.tv_nsec >= BILLION) {
+ x.tv_sec++;
+ x.tv_nsec -= BILLION;
+ }
+ return (x);
+}
+
+struct timespec
+evSubTime(struct timespec minuend, struct timespec subtrahend) {
+ struct timespec x;
+
+ x.tv_sec = minuend.tv_sec - subtrahend.tv_sec;
+ if (minuend.tv_nsec >= subtrahend.tv_nsec)
+ x.tv_nsec = minuend.tv_nsec - subtrahend.tv_nsec;
+ else {
+ x.tv_nsec = BILLION - subtrahend.tv_nsec + minuend.tv_nsec;
+ x.tv_sec--;
+ }
+ return (x);
+}
+
+int
+evCmpTime(struct timespec a, struct timespec b) {
+ long x = a.tv_sec - b.tv_sec;
+
+ if (x == 0L)
+ x = a.tv_nsec - b.tv_nsec;
+ return (x < 0L ? (-1) : x > 0L ? (1) : (0));
+}
+
+struct timespec
+evNowTime() {
+ struct timeval now;
+#ifdef CLOCK_REALTIME
+ struct timespec tsnow;
+ int m = CLOCK_REALTIME;
+
+#ifdef CLOCK_MONOTONIC
+ if (__evOptMonoTime)
+ m = CLOCK_MONOTONIC;
+#endif
+ if (clock_gettime(m, &tsnow) == 0)
+ return (tsnow);
+#endif
+ if (gettimeofday(&now, NULL) < 0)
+ return (evConsTime(0, 0));
+ return (evTimeSpec(now));
+}
+
+struct timespec
+evUTCTime() {
+ struct timeval now;
+#ifdef CLOCK_REALTIME
+ struct timespec tsnow;
+ if (clock_gettime(CLOCK_REALTIME, &tsnow) == 0)
+ return (tsnow);
+#endif
+ if (gettimeofday(&now, NULL) < 0)
+ return (evConsTime(0, 0));
+ return (evTimeSpec(now));
+}
+
+struct timespec
+evLastEventTime(evContext opaqueCtx) {
+ evContext_p *ctx = opaqueCtx.opaque;
+
+ return (ctx->lastEventTime);
+}
+
+struct timespec
+evTimeSpec(struct timeval tv) {
+ struct timespec ts;
+
+ ts.tv_sec = tv.tv_sec;
+ ts.tv_nsec = tv.tv_usec * 1000;
+ return (ts);
+}
+
+struct timeval
+evTimeVal(struct timespec ts) {
+ struct timeval tv;
+
+ tv.tv_sec = ts.tv_sec;
+ tv.tv_usec = ts.tv_nsec / 1000;
+ return (tv);
+}
+
+int
+evSetTimer(evContext opaqueCtx,
+ evTimerFunc func,
+ void *uap,
+ struct timespec due,
+ struct timespec inter,
+ evTimerID *opaqueID
+) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evTimer *id;
+
+ evPrintf(ctx, 1,
+"evSetTimer(ctx %p, func %p, uap %p, due %ld.%09ld, inter %ld.%09ld)\n",
+ ctx, func, uap,
+ (long)due.tv_sec, due.tv_nsec,
+ (long)inter.tv_sec, inter.tv_nsec);
+
+#ifdef __hpux
+ /*
+ * tv_sec and tv_nsec are unsigned.
+ */
+ if (due.tv_nsec >= BILLION)
+ EV_ERR(EINVAL);
+
+ if (inter.tv_nsec >= BILLION)
+ EV_ERR(EINVAL);
+#else
+ if (due.tv_sec < 0 || due.tv_nsec < 0 || due.tv_nsec >= BILLION)
+ EV_ERR(EINVAL);
+
+ if (inter.tv_sec < 0 || inter.tv_nsec < 0 || inter.tv_nsec >= BILLION)
+ EV_ERR(EINVAL);
+#endif
+
+ /* due={0,0} is a magic cookie meaning "now." */
+ if (due.tv_sec == (time_t)0 && due.tv_nsec == 0L)
+ due = evNowTime();
+
+ /* Allocate and fill. */
+ OKNEW(id);
+ id->func = func;
+ id->uap = uap;
+ id->due = due;
+ id->inter = inter;
+
+ if (heap_insert(ctx->timers, id) < 0)
+ return (-1);
+
+ /* Remember the ID if the caller provided us a place for it. */
+ if (opaqueID)
+ opaqueID->opaque = id;
+
+ if (ctx->debug > 7) {
+ evPrintf(ctx, 7, "timers after evSetTimer:\n");
+ (void) heap_for_each(ctx->timers, print_timer, (void *)ctx);
+ }
+
+ return (0);
+}
+
+int
+evClearTimer(evContext opaqueCtx, evTimerID id) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evTimer *del = id.opaque;
+
+ if (ctx->cur != NULL &&
+ ctx->cur->type == Timer &&
+ ctx->cur->u.timer.this == del) {
+ evPrintf(ctx, 8, "deferring delete of timer (executing)\n");
+ /*
+ * Setting the interval to zero ensures that evDrop() will
+ * clean up the timer.
+ */
+ del->inter = evConsTime(0, 0);
+ return (0);
+ }
+
+ if (heap_element(ctx->timers, del->index) != del)
+ EV_ERR(ENOENT);
+
+ if (heap_delete(ctx->timers, del->index) < 0)
+ return (-1);
+ FREE(del);
+
+ if (ctx->debug > 7) {
+ evPrintf(ctx, 7, "timers after evClearTimer:\n");
+ (void) heap_for_each(ctx->timers, print_timer, (void *)ctx);
+ }
+
+ return (0);
+}
+
+int
+evConfigTimer(evContext opaqueCtx,
+ evTimerID id,
+ const char *param,
+ int value
+) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evTimer *timer = id.opaque;
+ int result=0;
+
+ UNUSED(value);
+
+ if (heap_element(ctx->timers, timer->index) != timer)
+ EV_ERR(ENOENT);
+
+ if (strcmp(param, "rate") == 0)
+ timer->mode |= EV_TMR_RATE;
+ else if (strcmp(param, "interval") == 0)
+ timer->mode &= ~EV_TMR_RATE;
+ else
+ EV_ERR(EINVAL);
+
+ return (result);
+}
+
+int
+evResetTimer(evContext opaqueCtx,
+ evTimerID id,
+ evTimerFunc func,
+ void *uap,
+ struct timespec due,
+ struct timespec inter
+) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evTimer *timer = id.opaque;
+ struct timespec old_due;
+ int result=0;
+
+ if (heap_element(ctx->timers, timer->index) != timer)
+ EV_ERR(ENOENT);
+
+#ifdef __hpux
+ /*
+ * tv_sec and tv_nsec are unsigned.
+ */
+ if (due.tv_nsec >= BILLION)
+ EV_ERR(EINVAL);
+
+ if (inter.tv_nsec >= BILLION)
+ EV_ERR(EINVAL);
+#else
+ if (due.tv_sec < 0 || due.tv_nsec < 0 || due.tv_nsec >= BILLION)
+ EV_ERR(EINVAL);
+
+ if (inter.tv_sec < 0 || inter.tv_nsec < 0 || inter.tv_nsec >= BILLION)
+ EV_ERR(EINVAL);
+#endif
+
+ old_due = timer->due;
+
+ timer->func = func;
+ timer->uap = uap;
+ timer->due = due;
+ timer->inter = inter;
+
+ switch (evCmpTime(due, old_due)) {
+ case -1:
+ result = heap_increased(ctx->timers, timer->index);
+ break;
+ case 0:
+ result = 0;
+ break;
+ case 1:
+ result = heap_decreased(ctx->timers, timer->index);
+ break;
+ }
+
+ if (ctx->debug > 7) {
+ evPrintf(ctx, 7, "timers after evResetTimer:\n");
+ (void) heap_for_each(ctx->timers, print_timer, (void *)ctx);
+ }
+
+ return (result);
+}
+
+int
+evSetIdleTimer(evContext opaqueCtx,
+ evTimerFunc func,
+ void *uap,
+ struct timespec max_idle,
+ evTimerID *opaqueID
+) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ idle_timer *tt;
+
+ /* Allocate and fill. */
+ OKNEW(tt);
+ tt->func = func;
+ tt->uap = uap;
+ tt->lastTouched = ctx->lastEventTime;
+ tt->max_idle = max_idle;
+
+ if (evSetTimer(opaqueCtx, idle_timeout, tt,
+ evAddTime(ctx->lastEventTime, max_idle),
+ max_idle, opaqueID) < 0) {
+ FREE(tt);
+ return (-1);
+ }
+
+ tt->timer = opaqueID->opaque;
+
+ return (0);
+}
+
+int
+evClearIdleTimer(evContext opaqueCtx, evTimerID id) {
+ evTimer *del = id.opaque;
+ idle_timer *tt = del->uap;
+
+ FREE(tt);
+ return (evClearTimer(opaqueCtx, id));
+}
+
+int
+evResetIdleTimer(evContext opaqueCtx,
+ evTimerID opaqueID,
+ evTimerFunc func,
+ void *uap,
+ struct timespec max_idle
+) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evTimer *timer = opaqueID.opaque;
+ idle_timer *tt = timer->uap;
+
+ tt->func = func;
+ tt->uap = uap;
+ tt->lastTouched = ctx->lastEventTime;
+ tt->max_idle = max_idle;
+
+ return (evResetTimer(opaqueCtx, opaqueID, idle_timeout, tt,
+ evAddTime(ctx->lastEventTime, max_idle),
+ max_idle));
+}
+
+int
+evTouchIdleTimer(evContext opaqueCtx, evTimerID id) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evTimer *t = id.opaque;
+ idle_timer *tt = t->uap;
+
+ tt->lastTouched = ctx->lastEventTime;
+
+ return (0);
+}
+
+/* Public to the rest of eventlib. */
+
+heap_context
+evCreateTimers(const evContext_p *ctx) {
+
+ UNUSED(ctx);
+
+ return (heap_new(due_sooner, set_index, 2048));
+}
+
+void
+evDestroyTimers(const evContext_p *ctx) {
+ (void) heap_for_each(ctx->timers, free_timer, NULL);
+ (void) heap_free(ctx->timers);
+}
+
+/* Private. */
+
+static int
+due_sooner(void *a, void *b) {
+ evTimer *a_timer, *b_timer;
+
+ a_timer = a;
+ b_timer = b;
+ return (evCmpTime(a_timer->due, b_timer->due) < 0);
+}
+
+static void
+set_index(void *what, int index) {
+ evTimer *timer;
+
+ timer = what;
+ timer->index = index;
+}
+
+static void
+free_timer(void *what, void *uap) {
+ evTimer *t = what;
+
+ UNUSED(uap);
+
+ FREE(t);
+}
+
+static void
+print_timer(void *what, void *uap) {
+ evTimer *cur = what;
+ evContext_p *ctx = uap;
+
+ cur = what;
+ evPrintf(ctx, 7,
+ " func %p, uap %p, due %ld.%09ld, inter %ld.%09ld\n",
+ cur->func, cur->uap,
+ (long)cur->due.tv_sec, cur->due.tv_nsec,
+ (long)cur->inter.tv_sec, cur->inter.tv_nsec);
+}
+
+static void
+idle_timeout(evContext opaqueCtx,
+ void *uap,
+ struct timespec due,
+ struct timespec inter
+) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ idle_timer *this = uap;
+ struct timespec idle;
+
+ UNUSED(due);
+ UNUSED(inter);
+
+ idle = evSubTime(ctx->lastEventTime, this->lastTouched);
+ if (evCmpTime(idle, this->max_idle) >= 0) {
+ (this->func)(opaqueCtx, this->uap, this->timer->due,
+ this->max_idle);
+ /*
+ * Setting the interval to zero will cause the timer to
+ * be cleaned up in evDrop().
+ */
+ this->timer->inter = evConsTime(0, 0);
+ FREE(this);
+ } else {
+ /* evDrop() will reschedule the timer. */
+ this->timer->inter = evSubTime(this->max_idle, idle);
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/ev_waits.c b/usr/src/lib/libresolv2_joy/common/isc/ev_waits.c
new file mode 100644
index 0000000000..99da1526c7
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/ev_waits.c
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* ev_waits.c - implement deferred function calls for the eventlib
+ * vix 05dec95 [initial]
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: ev_waits.c,v 1.4 2005/04/27 04:56:36 sra Exp $";
+#endif
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <errno.h>
+
+#include <isc/eventlib.h>
+#include <isc/assertions.h>
+#include "eventlib_p.h"
+
+#include "port_after.h"
+
+/* Forward. */
+
+static void print_waits(evContext_p *ctx);
+static evWaitList * evNewWaitList(evContext_p *);
+static void evFreeWaitList(evContext_p *, evWaitList *);
+static evWaitList * evGetWaitList(evContext_p *, const void *, int);
+
+
+/* Public. */
+
+/*%
+ * Enter a new wait function on the queue.
+ */
+int
+evWaitFor(evContext opaqueCtx, const void *tag,
+ evWaitFunc func, void *uap, evWaitID *id)
+{
+ evContext_p *ctx = opaqueCtx.opaque;
+ evWait *new;
+ evWaitList *wl = evGetWaitList(ctx, tag, 1);
+
+ OKNEW(new);
+ new->func = func;
+ new->uap = uap;
+ new->tag = tag;
+ new->next = NULL;
+ if (wl->last != NULL)
+ wl->last->next = new;
+ else
+ wl->first = new;
+ wl->last = new;
+ if (id != NULL)
+ id->opaque = new;
+ if (ctx->debug >= 9)
+ print_waits(ctx);
+ return (0);
+}
+
+/*%
+ * Mark runnable all waiting functions having a certain tag.
+ */
+int
+evDo(evContext opaqueCtx, const void *tag) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evWaitList *wl = evGetWaitList(ctx, tag, 0);
+ evWait *first;
+
+ if (!wl) {
+ errno = ENOENT;
+ return (-1);
+ }
+
+ first = wl->first;
+ INSIST(first != NULL);
+
+ if (ctx->waitDone.last != NULL)
+ ctx->waitDone.last->next = first;
+ else
+ ctx->waitDone.first = first;
+ ctx->waitDone.last = wl->last;
+ evFreeWaitList(ctx, wl);
+
+ return (0);
+}
+
+/*%
+ * Remove a waiting (or ready to run) function from the queue.
+ */
+int
+evUnwait(evContext opaqueCtx, evWaitID id) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evWait *this, *prev;
+ evWaitList *wl;
+ int found = 0;
+
+ this = id.opaque;
+ INSIST(this != NULL);
+ wl = evGetWaitList(ctx, this->tag, 0);
+ if (wl != NULL) {
+ for (prev = NULL, this = wl->first;
+ this != NULL;
+ prev = this, this = this->next)
+ if (this == (evWait *)id.opaque) {
+ found = 1;
+ if (prev != NULL)
+ prev->next = this->next;
+ else
+ wl->first = this->next;
+ if (wl->last == this)
+ wl->last = prev;
+ if (wl->first == NULL)
+ evFreeWaitList(ctx, wl);
+ break;
+ }
+ }
+
+ if (!found) {
+ /* Maybe it's done */
+ for (prev = NULL, this = ctx->waitDone.first;
+ this != NULL;
+ prev = this, this = this->next)
+ if (this == (evWait *)id.opaque) {
+ found = 1;
+ if (prev != NULL)
+ prev->next = this->next;
+ else
+ ctx->waitDone.first = this->next;
+ if (ctx->waitDone.last == this)
+ ctx->waitDone.last = prev;
+ break;
+ }
+ }
+
+ if (!found) {
+ errno = ENOENT;
+ return (-1);
+ }
+
+ FREE(this);
+
+ if (ctx->debug >= 9)
+ print_waits(ctx);
+
+ return (0);
+}
+
+int
+evDefer(evContext opaqueCtx, evWaitFunc func, void *uap) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evWait *new;
+
+ OKNEW(new);
+ new->func = func;
+ new->uap = uap;
+ new->tag = NULL;
+ new->next = NULL;
+ if (ctx->waitDone.last != NULL)
+ ctx->waitDone.last->next = new;
+ else
+ ctx->waitDone.first = new;
+ ctx->waitDone.last = new;
+ if (ctx->debug >= 9)
+ print_waits(ctx);
+ return (0);
+}
+
+/* Private. */
+
+static void
+print_waits(evContext_p *ctx) {
+ evWaitList *wl;
+ evWait *this;
+
+ evPrintf(ctx, 9, "wait waiting:\n");
+ for (wl = ctx->waitLists; wl != NULL; wl = wl->next) {
+ INSIST(wl->first != NULL);
+ evPrintf(ctx, 9, " tag %p:", wl->first->tag);
+ for (this = wl->first; this != NULL; this = this->next)
+ evPrintf(ctx, 9, " %p", this);
+ evPrintf(ctx, 9, "\n");
+ }
+ evPrintf(ctx, 9, "wait done:");
+ for (this = ctx->waitDone.first; this != NULL; this = this->next)
+ evPrintf(ctx, 9, " %p", this);
+ evPrintf(ctx, 9, "\n");
+}
+
+static evWaitList *
+evNewWaitList(evContext_p *ctx) {
+ evWaitList *new;
+
+ NEW(new);
+ if (new == NULL)
+ return (NULL);
+ new->first = new->last = NULL;
+ new->prev = NULL;
+ new->next = ctx->waitLists;
+ if (new->next != NULL)
+ new->next->prev = new;
+ ctx->waitLists = new;
+ return (new);
+}
+
+static void
+evFreeWaitList(evContext_p *ctx, evWaitList *this) {
+
+ INSIST(this != NULL);
+
+ if (this->prev != NULL)
+ this->prev->next = this->next;
+ else
+ ctx->waitLists = this->next;
+ if (this->next != NULL)
+ this->next->prev = this->prev;
+ FREE(this);
+}
+
+static evWaitList *
+evGetWaitList(evContext_p *ctx, const void *tag, int should_create) {
+ evWaitList *this;
+
+ for (this = ctx->waitLists; this != NULL; this = this->next) {
+ if (this->first != NULL && this->first->tag == tag)
+ break;
+ }
+ if (this == NULL && should_create)
+ this = evNewWaitList(ctx);
+ return (this);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/eventlib.c b/usr/src/lib/libresolv2_joy/common/isc/eventlib.c
new file mode 100644
index 0000000000..be4a7848b9
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/eventlib.c
@@ -0,0 +1,933 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995-1999 by Internet Software Consortium
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* eventlib.c - implement glue for the eventlib
+ * vix 09sep95 [initial]
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: eventlib.c,v 1.10 2006/03/09 23:57:56 marka Exp $";
+#endif
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#ifdef SOLARIS2
+#include <limits.h>
+#endif /* SOLARIS2 */
+
+#include <errno.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <isc/eventlib.h>
+#include <isc/assertions.h>
+#include "eventlib_p.h"
+
+#include "port_after.h"
+
+int __evOptMonoTime;
+
+#ifdef USE_POLL
+#define pselect Pselect
+#endif /* USE_POLL */
+
+/* Forward. */
+
+#if defined(NEED_PSELECT) || defined(USE_POLL)
+static int pselect(int, void *, void *, void *,
+ struct timespec *,
+ const sigset_t *);
+#endif
+
+int __evOptMonoTime;
+
+/* Public. */
+
+int
+evCreate(evContext *opaqueCtx) {
+ evContext_p *ctx;
+
+ /* Make sure the memory heap is initialized. */
+ if (meminit(0, 0) < 0 && errno != EEXIST)
+ return (-1);
+
+ OKNEW(ctx);
+
+ /* Global. */
+ ctx->cur = NULL;
+
+ /* Debugging. */
+ ctx->debug = 0;
+ ctx->output = NULL;
+
+ /* Connections. */
+ ctx->conns = NULL;
+ INIT_LIST(ctx->accepts);
+
+ /* Files. */
+ ctx->files = NULL;
+#ifdef USE_POLL
+ ctx->pollfds = NULL;
+ ctx->maxnfds = 0;
+ ctx->firstfd = 0;
+ emulMaskInit(ctx, rdLast, EV_READ, 1);
+ emulMaskInit(ctx, rdNext, EV_READ, 0);
+ emulMaskInit(ctx, wrLast, EV_WRITE, 1);
+ emulMaskInit(ctx, wrNext, EV_WRITE, 0);
+ emulMaskInit(ctx, exLast, EV_EXCEPT, 1);
+ emulMaskInit(ctx, exNext, EV_EXCEPT, 0);
+ emulMaskInit(ctx, nonblockBefore, EV_WASNONBLOCKING, 0);
+#endif /* USE_POLL */
+ FD_ZERO(&ctx->rdNext);
+ FD_ZERO(&ctx->wrNext);
+ FD_ZERO(&ctx->exNext);
+ FD_ZERO(&ctx->nonblockBefore);
+ ctx->fdMax = -1;
+ ctx->fdNext = NULL;
+ ctx->fdCount = 0; /*%< Invalidate {rd,wr,ex}Last. */
+#ifndef USE_POLL
+ ctx->highestFD = FD_SETSIZE - 1;
+ memset(ctx->fdTable, 0, sizeof ctx->fdTable);
+#else
+ ctx->highestFD = INT_MAX / sizeof(struct pollfd);
+ ctx->fdTable = NULL;
+#endif /* USE_POLL */
+#ifdef EVENTLIB_TIME_CHECKS
+ ctx->lastFdCount = 0;
+#endif
+
+ /* Streams. */
+ ctx->streams = NULL;
+ ctx->strDone = NULL;
+ ctx->strLast = NULL;
+
+ /* Timers. */
+ ctx->lastEventTime = evNowTime();
+#ifdef EVENTLIB_TIME_CHECKS
+ ctx->lastSelectTime = ctx->lastEventTime;
+#endif
+ ctx->timers = evCreateTimers(ctx);
+ if (ctx->timers == NULL)
+ return (-1);
+
+ /* Waits. */
+ ctx->waitLists = NULL;
+ ctx->waitDone.first = ctx->waitDone.last = NULL;
+ ctx->waitDone.prev = ctx->waitDone.next = NULL;
+
+ opaqueCtx->opaque = ctx;
+ return (0);
+}
+
+void
+evSetDebug(evContext opaqueCtx, int level, FILE *output) {
+ evContext_p *ctx = opaqueCtx.opaque;
+
+ ctx->debug = level;
+ ctx->output = output;
+}
+
+int
+evDestroy(evContext opaqueCtx) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ int revs = 424242; /*%< Doug Adams. */
+ evWaitList *this_wl, *next_wl;
+ evWait *this_wait, *next_wait;
+
+ /* Connections. */
+ while (revs-- > 0 && ctx->conns != NULL) {
+ evConnID id;
+
+ id.opaque = ctx->conns;
+ (void) evCancelConn(opaqueCtx, id);
+ }
+ INSIST(revs >= 0);
+
+ /* Streams. */
+ while (revs-- > 0 && ctx->streams != NULL) {
+ evStreamID id;
+
+ id.opaque = ctx->streams;
+ (void) evCancelRW(opaqueCtx, id);
+ }
+
+ /* Files. */
+ while (revs-- > 0 && ctx->files != NULL) {
+ evFileID id;
+
+ id.opaque = ctx->files;
+ (void) evDeselectFD(opaqueCtx, id);
+ }
+ INSIST(revs >= 0);
+
+ /* Timers. */
+ evDestroyTimers(ctx);
+
+ /* Waits. */
+ for (this_wl = ctx->waitLists;
+ revs-- > 0 && this_wl != NULL;
+ this_wl = next_wl) {
+ next_wl = this_wl->next;
+ for (this_wait = this_wl->first;
+ revs-- > 0 && this_wait != NULL;
+ this_wait = next_wait) {
+ next_wait = this_wait->next;
+ FREE(this_wait);
+ }
+ FREE(this_wl);
+ }
+ for (this_wait = ctx->waitDone.first;
+ revs-- > 0 && this_wait != NULL;
+ this_wait = next_wait) {
+ next_wait = this_wait->next;
+ FREE(this_wait);
+ }
+
+ FREE(ctx);
+ return (0);
+}
+
+int
+evGetNext(evContext opaqueCtx, evEvent *opaqueEv, int options) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ struct timespec nextTime;
+ evTimer *nextTimer;
+ evEvent_p *new;
+ int x, pselect_errno, timerPast;
+#ifdef EVENTLIB_TIME_CHECKS
+ struct timespec interval;
+#endif
+
+ /* Ensure that exactly one of EV_POLL or EV_WAIT was specified. */
+ x = ((options & EV_POLL) != 0) + ((options & EV_WAIT) != 0);
+ if (x != 1)
+ EV_ERR(EINVAL);
+
+ /* Get the time of day. We'll do this again after select() blocks. */
+ ctx->lastEventTime = evNowTime();
+
+ again:
+ /* Finished accept()'s do not require a select(). */
+ if (!EMPTY(ctx->accepts)) {
+ OKNEW(new);
+ new->type = Accept;
+ new->u.accept.this = HEAD(ctx->accepts);
+ UNLINK(ctx->accepts, HEAD(ctx->accepts), link);
+ opaqueEv->opaque = new;
+ return (0);
+ }
+
+ /* Stream IO does not require a select(). */
+ if (ctx->strDone != NULL) {
+ OKNEW(new);
+ new->type = Stream;
+ new->u.stream.this = ctx->strDone;
+ ctx->strDone = ctx->strDone->nextDone;
+ if (ctx->strDone == NULL)
+ ctx->strLast = NULL;
+ opaqueEv->opaque = new;
+ return (0);
+ }
+
+ /* Waits do not require a select(). */
+ if (ctx->waitDone.first != NULL) {
+ OKNEW(new);
+ new->type = Wait;
+ new->u.wait.this = ctx->waitDone.first;
+ ctx->waitDone.first = ctx->waitDone.first->next;
+ if (ctx->waitDone.first == NULL)
+ ctx->waitDone.last = NULL;
+ opaqueEv->opaque = new;
+ return (0);
+ }
+
+ /* Get the status and content of the next timer. */
+ if ((nextTimer = heap_element(ctx->timers, 1)) != NULL) {
+ nextTime = nextTimer->due;
+ timerPast = (evCmpTime(nextTime, ctx->lastEventTime) <= 0);
+ } else
+ timerPast = 0; /*%< Make gcc happy. */
+ evPrintf(ctx, 9, "evGetNext: fdCount %d\n", ctx->fdCount);
+ if (ctx->fdCount == 0) {
+ static const struct timespec NoTime = {0, 0L};
+ enum { JustPoll, Block, Timer } m;
+ struct timespec t, *tp;
+
+ /* Are there any events at all? */
+ if ((options & EV_WAIT) != 0 && !nextTimer && ctx->fdMax == -1)
+ EV_ERR(ENOENT);
+
+ /* Figure out what select()'s timeout parameter should be. */
+ if ((options & EV_POLL) != 0) {
+ m = JustPoll;
+ t = NoTime;
+ tp = &t;
+ } else if (nextTimer == NULL) {
+ m = Block;
+ /* ``t'' unused. */
+ tp = NULL;
+ } else if (timerPast) {
+ m = JustPoll;
+ t = NoTime;
+ tp = &t;
+ } else {
+ m = Timer;
+ /* ``t'' filled in later. */
+ tp = &t;
+ }
+#ifdef EVENTLIB_TIME_CHECKS
+ if (ctx->debug > 0) {
+ interval = evSubTime(ctx->lastEventTime,
+ ctx->lastSelectTime);
+ if (interval.tv_sec > 0 || interval.tv_nsec > 0)
+ evPrintf(ctx, 1,
+ "time between pselect() %u.%09u count %d\n",
+ interval.tv_sec, interval.tv_nsec,
+ ctx->lastFdCount);
+ }
+#endif
+ do {
+#ifndef USE_POLL
+ /* XXX need to copy only the bits we are using. */
+ ctx->rdLast = ctx->rdNext;
+ ctx->wrLast = ctx->wrNext;
+ ctx->exLast = ctx->exNext;
+#else
+ /*
+ * The pollfd structure uses separate fields for
+ * the input and output events (corresponding to
+ * the ??Next and ??Last fd sets), so there's no
+ * need to copy one to the other.
+ */
+#endif /* USE_POLL */
+ if (m == Timer) {
+ INSIST(tp == &t);
+ t = evSubTime(nextTime, ctx->lastEventTime);
+ }
+
+ /* XXX should predict system's earliness and adjust. */
+ x = pselect(ctx->fdMax+1,
+ &ctx->rdLast, &ctx->wrLast, &ctx->exLast,
+ tp, NULL);
+ pselect_errno = errno;
+
+#ifndef USE_POLL
+ evPrintf(ctx, 4, "select() returns %d (err: %s)\n",
+ x, (x == -1) ? strerror(errno) : "none");
+#else
+ evPrintf(ctx, 4, "poll() returns %d (err: %s)\n",
+ x, (x == -1) ? strerror(errno) : "none");
+#endif /* USE_POLL */
+ /* Anything but a poll can change the time. */
+ if (m != JustPoll)
+ ctx->lastEventTime = evNowTime();
+
+ /* Select() likes to finish about 10ms early. */
+ } while (x == 0 && m == Timer &&
+ evCmpTime(ctx->lastEventTime, nextTime) < 0);
+#ifdef EVENTLIB_TIME_CHECKS
+ ctx->lastSelectTime = ctx->lastEventTime;
+#endif
+ if (x < 0) {
+ if (pselect_errno == EINTR) {
+ if ((options & EV_NULL) != 0)
+ goto again;
+ OKNEW(new);
+ new->type = Null;
+ /* No data. */
+ opaqueEv->opaque = new;
+ return (0);
+ }
+ if (pselect_errno == EBADF) {
+ for (x = 0; x <= ctx->fdMax; x++) {
+ struct stat sb;
+
+ if (FD_ISSET(x, &ctx->rdNext) == 0 &&
+ FD_ISSET(x, &ctx->wrNext) == 0 &&
+ FD_ISSET(x, &ctx->exNext) == 0)
+ continue;
+ if (fstat(x, &sb) == -1 &&
+ errno == EBADF)
+ evPrintf(ctx, 1, "EBADF: %d\n",
+ x);
+ }
+ abort();
+ }
+ EV_ERR(pselect_errno);
+ }
+ if (x == 0 && (nextTimer == NULL || !timerPast) &&
+ (options & EV_POLL))
+ EV_ERR(EWOULDBLOCK);
+ ctx->fdCount = x;
+#ifdef EVENTLIB_TIME_CHECKS
+ ctx->lastFdCount = x;
+#endif
+ }
+ INSIST(nextTimer || ctx->fdCount);
+
+ /* Timers go first since we'd like them to be accurate. */
+ if (nextTimer && !timerPast) {
+ /* Has anything happened since we blocked? */
+ timerPast = (evCmpTime(nextTime, ctx->lastEventTime) <= 0);
+ }
+ if (nextTimer && timerPast) {
+ OKNEW(new);
+ new->type = Timer;
+ new->u.timer.this = nextTimer;
+ opaqueEv->opaque = new;
+ return (0);
+ }
+
+ /* No timers, so there should be a ready file descriptor. */
+ x = 0;
+ while (ctx->fdCount > 0) {
+ evFile *fid;
+ int fd, eventmask;
+
+ if (ctx->fdNext == NULL) {
+ if (++x == 2) {
+ /*
+ * Hitting the end twice means that the last
+ * select() found some FD's which have since
+ * been deselected.
+ *
+ * On some systems, the count returned by
+ * selects is the total number of bits in
+ * all masks that are set, and on others it's
+ * the number of fd's that have some bit set,
+ * and on others, it's just broken. We
+ * always assume that it's the number of
+ * bits set in all masks, because that's what
+ * the man page says it should do, and
+ * the worst that can happen is we do an
+ * extra select().
+ */
+ ctx->fdCount = 0;
+ break;
+ }
+ ctx->fdNext = ctx->files;
+ }
+ fid = ctx->fdNext;
+ ctx->fdNext = fid->next;
+
+ fd = fid->fd;
+ eventmask = 0;
+ if (FD_ISSET(fd, &ctx->rdLast))
+ eventmask |= EV_READ;
+ if (FD_ISSET(fd, &ctx->wrLast))
+ eventmask |= EV_WRITE;
+ if (FD_ISSET(fd, &ctx->exLast))
+ eventmask |= EV_EXCEPT;
+ eventmask &= fid->eventmask;
+ if (eventmask != 0) {
+ if ((eventmask & EV_READ) != 0) {
+ FD_CLR(fd, &ctx->rdLast);
+ ctx->fdCount--;
+ }
+ if ((eventmask & EV_WRITE) != 0) {
+ FD_CLR(fd, &ctx->wrLast);
+ ctx->fdCount--;
+ }
+ if ((eventmask & EV_EXCEPT) != 0) {
+ FD_CLR(fd, &ctx->exLast);
+ ctx->fdCount--;
+ }
+ OKNEW(new);
+ new->type = File;
+ new->u.file.this = fid;
+ new->u.file.eventmask = eventmask;
+ opaqueEv->opaque = new;
+ return (0);
+ }
+ }
+ if (ctx->fdCount < 0) {
+ /*
+ * select()'s count is off on a number of systems, and
+ * can result in fdCount < 0.
+ */
+ evPrintf(ctx, 4, "fdCount < 0 (%d)\n", ctx->fdCount);
+ ctx->fdCount = 0;
+ }
+
+ /* We get here if the caller deselect()'s an FD. Gag me with a goto. */
+ goto again;
+}
+
+int
+evDispatch(evContext opaqueCtx, evEvent opaqueEv) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evEvent_p *ev = opaqueEv.opaque;
+#ifdef EVENTLIB_TIME_CHECKS
+ void *func;
+ struct timespec start_time;
+ struct timespec interval;
+#endif
+
+#ifdef EVENTLIB_TIME_CHECKS
+ if (ctx->debug > 0)
+ start_time = evNowTime();
+#endif
+ ctx->cur = ev;
+ switch (ev->type) {
+ case Accept: {
+ evAccept *this = ev->u.accept.this;
+
+ evPrintf(ctx, 5,
+ "Dispatch.Accept: fd %d -> %d, func %p, uap %p\n",
+ this->conn->fd, this->fd,
+ this->conn->func, this->conn->uap);
+ errno = this->ioErrno;
+ (this->conn->func)(opaqueCtx, this->conn->uap, this->fd,
+ &this->la, this->lalen,
+ &this->ra, this->ralen);
+#ifdef EVENTLIB_TIME_CHECKS
+ func = this->conn->func;
+#endif
+ break;
+ }
+ case File: {
+ evFile *this = ev->u.file.this;
+ int eventmask = ev->u.file.eventmask;
+
+ evPrintf(ctx, 5,
+ "Dispatch.File: fd %d, mask 0x%x, func %p, uap %p\n",
+ this->fd, this->eventmask, this->func, this->uap);
+ (this->func)(opaqueCtx, this->uap, this->fd, eventmask);
+#ifdef EVENTLIB_TIME_CHECKS
+ func = this->func;
+#endif
+ break;
+ }
+ case Stream: {
+ evStream *this = ev->u.stream.this;
+
+ evPrintf(ctx, 5,
+ "Dispatch.Stream: fd %d, func %p, uap %p\n",
+ this->fd, this->func, this->uap);
+ errno = this->ioErrno;
+ (this->func)(opaqueCtx, this->uap, this->fd, this->ioDone);
+#ifdef EVENTLIB_TIME_CHECKS
+ func = this->func;
+#endif
+ break;
+ }
+ case Timer: {
+ evTimer *this = ev->u.timer.this;
+
+ evPrintf(ctx, 5, "Dispatch.Timer: func %p, uap %p\n",
+ this->func, this->uap);
+ (this->func)(opaqueCtx, this->uap, this->due, this->inter);
+#ifdef EVENTLIB_TIME_CHECKS
+ func = this->func;
+#endif
+ break;
+ }
+ case Wait: {
+ evWait *this = ev->u.wait.this;
+
+ evPrintf(ctx, 5,
+ "Dispatch.Wait: tag %p, func %p, uap %p\n",
+ this->tag, this->func, this->uap);
+ (this->func)(opaqueCtx, this->uap, this->tag);
+#ifdef EVENTLIB_TIME_CHECKS
+ func = this->func;
+#endif
+ break;
+ }
+ case Null: {
+ /* No work. */
+#ifdef EVENTLIB_TIME_CHECKS
+ func = NULL;
+#endif
+ break;
+ }
+ default: {
+ abort();
+ }
+ }
+#ifdef EVENTLIB_TIME_CHECKS
+ if (ctx->debug > 0) {
+ interval = evSubTime(evNowTime(), start_time);
+ /*
+ * Complain if it took longer than 50 milliseconds.
+ *
+ * We call getuid() to make an easy to find mark in a kernel
+ * trace.
+ */
+ if (interval.tv_sec > 0 || interval.tv_nsec > 50000000)
+ evPrintf(ctx, 1,
+ "dispatch interval %u.%09u uid %d type %d func %p\n",
+ interval.tv_sec, interval.tv_nsec,
+ getuid(), ev->type, func);
+ }
+#endif
+ ctx->cur = NULL;
+ evDrop(opaqueCtx, opaqueEv);
+ return (0);
+}
+
+void
+evDrop(evContext opaqueCtx, evEvent opaqueEv) {
+ evContext_p *ctx = opaqueCtx.opaque;
+ evEvent_p *ev = opaqueEv.opaque;
+
+ switch (ev->type) {
+ case Accept: {
+ FREE(ev->u.accept.this);
+ break;
+ }
+ case File: {
+ /* No work. */
+ break;
+ }
+ case Stream: {
+ evStreamID id;
+
+ id.opaque = ev->u.stream.this;
+ (void) evCancelRW(opaqueCtx, id);
+ break;
+ }
+ case Timer: {
+ evTimer *this = ev->u.timer.this;
+ evTimerID opaque;
+
+ /* Check to see whether the user func cleared the timer. */
+ if (heap_element(ctx->timers, this->index) != this) {
+ evPrintf(ctx, 5, "Dispatch.Timer: timer rm'd?\n");
+ break;
+ }
+ /*
+ * Timer is still there. Delete it if it has expired,
+ * otherwise set it according to its next interval.
+ */
+ if (this->inter.tv_sec == (time_t)0 &&
+ this->inter.tv_nsec == 0L) {
+ opaque.opaque = this;
+ (void) evClearTimer(opaqueCtx, opaque);
+ } else {
+ opaque.opaque = this;
+ (void) evResetTimer(opaqueCtx, opaque, this->func,
+ this->uap,
+ evAddTime((this->mode & EV_TMR_RATE) ?
+ this->due :
+ ctx->lastEventTime,
+ this->inter),
+ this->inter);
+ }
+ break;
+ }
+ case Wait: {
+ FREE(ev->u.wait.this);
+ break;
+ }
+ case Null: {
+ /* No work. */
+ break;
+ }
+ default: {
+ abort();
+ }
+ }
+ FREE(ev);
+}
+
+int
+evMainLoop(evContext opaqueCtx) {
+ evEvent event;
+ int x;
+
+ while ((x = evGetNext(opaqueCtx, &event, EV_WAIT)) == 0)
+ if ((x = evDispatch(opaqueCtx, event)) < 0)
+ break;
+ return (x);
+}
+
+int
+evHighestFD(evContext opaqueCtx) {
+ evContext_p *ctx = opaqueCtx.opaque;
+
+ return (ctx->highestFD);
+}
+
+void
+evPrintf(const evContext_p *ctx, int level, const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ if (ctx->output != NULL && ctx->debug >= level) {
+ vfprintf(ctx->output, fmt, ap);
+ fflush(ctx->output);
+ }
+ va_end(ap);
+}
+
+int
+evSetOption(evContext *opaqueCtx, const char *option, int value) {
+ /* evContext_p *ctx = opaqueCtx->opaque; */
+
+ UNUSED(opaqueCtx);
+ UNUSED(value);
+#ifndef CLOCK_MONOTONIC
+ UNUSED(option);
+#endif
+
+#ifdef CLOCK_MONOTONIC
+ if (strcmp(option, "monotime") == 0) {
+ if (opaqueCtx != NULL)
+ errno = EINVAL;
+ if (value == 0 || value == 1) {
+ __evOptMonoTime = value;
+ return (0);
+ } else {
+ errno = EINVAL;
+ return (-1);
+ }
+ }
+#endif
+ errno = ENOENT;
+ return (-1);
+}
+
+int
+evGetOption(evContext *opaqueCtx, const char *option, int *value) {
+ /* evContext_p *ctx = opaqueCtx->opaque; */
+
+ UNUSED(opaqueCtx);
+#ifndef CLOCK_MONOTONIC
+ UNUSED(value);
+ UNUSED(option);
+#endif
+
+#ifdef CLOCK_MONOTONIC
+ if (strcmp(option, "monotime") == 0) {
+ if (opaqueCtx != NULL)
+ errno = EINVAL;
+ *value = __evOptMonoTime;
+ return (0);
+ }
+#endif
+ errno = ENOENT;
+ return (-1);
+}
+
+#if defined(NEED_PSELECT) || defined(USE_POLL)
+/* XXX needs to move to the porting library. */
+static int
+pselect(int nfds, void *rfds, void *wfds, void *efds,
+ struct timespec *tsp,
+ const sigset_t *sigmask)
+{
+ struct timeval tv, *tvp;
+ sigset_t sigs;
+ int n;
+#ifdef USE_POLL
+ int polltimeout = INFTIM;
+ evContext_p *ctx;
+ struct pollfd *fds;
+ nfds_t pnfds;
+
+ UNUSED(nfds);
+#endif /* USE_POLL */
+
+ if (tsp) {
+ tvp = &tv;
+ tv = evTimeVal(*tsp);
+#ifdef USE_POLL
+ polltimeout = 1000 * tv.tv_sec + tv.tv_usec / 1000;
+#endif /* USE_POLL */
+ } else
+ tvp = NULL;
+ if (sigmask)
+ sigprocmask(SIG_SETMASK, sigmask, &sigs);
+#ifndef USE_POLL
+ n = select(nfds, rfds, wfds, efds, tvp);
+#else
+ /*
+ * rfds, wfds, and efds should all be from the same evContext_p,
+ * so any of them will do. If they're all NULL, the caller is
+ * presumably calling us to block.
+ */
+ if (rfds != NULL)
+ ctx = ((__evEmulMask *)rfds)->ctx;
+ else if (wfds != NULL)
+ ctx = ((__evEmulMask *)wfds)->ctx;
+ else if (efds != NULL)
+ ctx = ((__evEmulMask *)efds)->ctx;
+ else
+ ctx = NULL;
+ if (ctx != NULL && ctx->fdMax != -1) {
+ fds = &(ctx->pollfds[ctx->firstfd]);
+ pnfds = ctx->fdMax - ctx->firstfd + 1;
+ } else {
+ fds = NULL;
+ pnfds = 0;
+ }
+ n = poll(fds, pnfds, polltimeout);
+ if (n > 0) {
+ int i, e;
+
+ INSIST(ctx != NULL);
+ for (e = 0, i = ctx->firstfd; i <= ctx->fdMax; i++) {
+ if (ctx->pollfds[i].fd < 0)
+ continue;
+ if (FD_ISSET(i, &ctx->rdLast))
+ e++;
+ if (FD_ISSET(i, &ctx->wrLast))
+ e++;
+ if (FD_ISSET(i, &ctx->exLast))
+ e++;
+ }
+ n = e;
+ }
+#endif /* USE_POLL */
+ if (sigmask)
+ sigprocmask(SIG_SETMASK, &sigs, NULL);
+ if (tsp)
+ *tsp = evTimeSpec(tv);
+ return (n);
+}
+#endif
+
+#ifdef USE_POLL
+int
+evPollfdRealloc(evContext_p *ctx, int pollfd_chunk_size, int fd) {
+
+ int i, maxnfds;
+ void *pollfds, *fdTable;
+
+ if (fd < ctx->maxnfds)
+ return (0);
+
+ /* Don't allow ridiculously small values for pollfd_chunk_size */
+ if (pollfd_chunk_size < 20)
+ pollfd_chunk_size = 20;
+
+ maxnfds = (1 + (fd/pollfd_chunk_size)) * pollfd_chunk_size;
+
+ pollfds = realloc(ctx->pollfds, maxnfds * sizeof(*ctx->pollfds));
+ if (pollfds != NULL)
+ ctx->pollfds = pollfds;
+ fdTable = realloc(ctx->fdTable, maxnfds * sizeof(*ctx->fdTable));
+ if (fdTable != NULL)
+ ctx->fdTable = fdTable;
+
+ if (pollfds == NULL || fdTable == NULL) {
+ evPrintf(ctx, 2, "pollfd() realloc (%ld) failed\n",
+ (long)maxnfds*sizeof(struct pollfd));
+ return (-1);
+ }
+
+ for (i = ctx->maxnfds; i < maxnfds; i++) {
+ ctx->pollfds[i].fd = -1;
+ ctx->pollfds[i].events = 0;
+ ctx->fdTable[i] = 0;
+ }
+
+ ctx->maxnfds = maxnfds;
+
+ return (0);
+}
+
+/* Find the appropriate 'events' or 'revents' field in the pollfds array */
+short *
+__fd_eventfield(int fd, __evEmulMask *maskp) {
+
+ evContext_p *ctx = (evContext_p *)maskp->ctx;
+
+ if (!maskp->result || maskp->type == EV_WASNONBLOCKING)
+ return (&(ctx->pollfds[fd].events));
+ else
+ return (&(ctx->pollfds[fd].revents));
+}
+
+/* Translate to poll(2) event */
+short
+__poll_event(__evEmulMask *maskp) {
+
+ switch ((maskp)->type) {
+ case EV_READ:
+ return (POLLRDNORM);
+ case EV_WRITE:
+ return (POLLWRNORM);
+ case EV_EXCEPT:
+ return (POLLRDBAND | POLLPRI | POLLWRBAND);
+ case EV_WASNONBLOCKING:
+ return (POLLHUP);
+ default:
+ return (0);
+ }
+}
+
+/*
+ * Clear the events corresponding to the specified mask. If this leaves
+ * the events mask empty (apart from the POLLHUP bit), set the fd field
+ * to -1 so that poll(2) will ignore this fd.
+ */
+void
+__fd_clr(int fd, __evEmulMask *maskp) {
+
+ evContext_p *ctx = maskp->ctx;
+
+ *__fd_eventfield(fd, maskp) &= ~__poll_event(maskp);
+ if ((ctx->pollfds[fd].events & ~POLLHUP) == 0) {
+ ctx->pollfds[fd].fd = -1;
+ if (fd == ctx->fdMax)
+ while (ctx->fdMax > ctx->firstfd &&
+ ctx->pollfds[ctx->fdMax].fd < 0)
+ ctx->fdMax--;
+ if (fd == ctx->firstfd)
+ while (ctx->firstfd <= ctx->fdMax &&
+ ctx->pollfds[ctx->firstfd].fd < 0)
+ ctx->firstfd++;
+ /*
+ * Do we have a empty set of descriptors?
+ */
+ if (ctx->firstfd > ctx->fdMax) {
+ ctx->fdMax = -1;
+ ctx->firstfd = 0;
+ }
+ }
+}
+
+/*
+ * Set the events bit(s) corresponding to the specified mask. If the events
+ * field has any other bits than POLLHUP set, also set the fd field so that
+ * poll(2) will watch this fd.
+ */
+void
+__fd_set(int fd, __evEmulMask *maskp) {
+
+ evContext_p *ctx = maskp->ctx;
+
+ *__fd_eventfield(fd, maskp) |= __poll_event(maskp);
+ if ((ctx->pollfds[fd].events & ~POLLHUP) != 0) {
+ ctx->pollfds[fd].fd = fd;
+ if (fd < ctx->firstfd || ctx->fdMax == -1)
+ ctx->firstfd = fd;
+ if (fd > ctx->fdMax)
+ ctx->fdMax = fd;
+ }
+}
+#endif /* USE_POLL */
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/eventlib_p.h b/usr/src/lib/libresolv2_joy/common/isc/eventlib_p.h
new file mode 100644
index 0000000000..0a3614ab23
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/eventlib_p.h
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995-1999 by Internet Software Consortium
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*! \file
+ * \brief private interfaces for eventlib
+ * \author vix 09sep95 [initial]
+ *
+ * $Id: eventlib_p.h,v 1.9 2006/03/09 23:57:56 marka Exp $
+ */
+
+#ifndef _EVENTLIB_P_H
+#define _EVENTLIB_P_H
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/un.h>
+
+#define EVENTLIB_DEBUG 1
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/heap.h>
+#include <isc/list.h>
+#include <isc/memcluster.h>
+
+#define EV_MASK_ALL (EV_READ | EV_WRITE | EV_EXCEPT)
+#define EV_ERR(e) return (errno = (e), -1)
+#define OK(x) if ((x) < 0) EV_ERR(errno); else (void)NULL
+#define OKFREE(x, y) if ((x) < 0) { FREE((y)); EV_ERR(errno); } \
+ else (void)NULL
+
+#define NEW(p) if (((p) = memget(sizeof *(p))) != NULL) \
+ FILL(p); \
+ else \
+ (void)NULL;
+#define OKNEW(p) if (!((p) = memget(sizeof *(p)))) { \
+ errno = ENOMEM; \
+ return (-1); \
+ } else \
+ FILL(p)
+#define FREE(p) memput((p), sizeof *(p))
+
+#if EVENTLIB_DEBUG
+#define FILL(p) memset((p), 0xF5, sizeof *(p))
+#else
+#define FILL(p)
+#endif
+
+#ifdef USE_POLL
+#ifdef HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+#include <poll.h>
+#endif /* USE_POLL */
+
+typedef struct evConn {
+ evConnFunc func;
+ void * uap;
+ int fd;
+ int flags;
+#define EV_CONN_LISTEN 0x0001 /*%< Connection is a listener. */
+#define EV_CONN_SELECTED 0x0002 /*%< evSelectFD(conn->file). */
+#define EV_CONN_BLOCK 0x0004 /*%< Listener fd was blocking. */
+ evFileID file;
+ struct evConn * prev;
+ struct evConn * next;
+} evConn;
+
+typedef struct evAccept {
+ int fd;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in in;
+#ifndef NO_SOCKADDR_UN
+ struct sockaddr_un un;
+#endif
+ } la;
+ ISC_SOCKLEN_T lalen;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in in;
+#ifndef NO_SOCKADDR_UN
+ struct sockaddr_un un;
+#endif
+ } ra;
+ ISC_SOCKLEN_T ralen;
+ int ioErrno;
+ evConn * conn;
+ LINK(struct evAccept) link;
+} evAccept;
+
+typedef struct evFile {
+ evFileFunc func;
+ void * uap;
+ int fd;
+ int eventmask;
+ int preemptive;
+ struct evFile * prev;
+ struct evFile * next;
+ struct evFile * fdprev;
+ struct evFile * fdnext;
+} evFile;
+
+typedef struct evStream {
+ evStreamFunc func;
+ void * uap;
+ evFileID file;
+ evTimerID timer;
+ int flags;
+#define EV_STR_TIMEROK 0x0001 /*%< IFF timer valid. */
+ int fd;
+ struct iovec * iovOrig;
+ int iovOrigCount;
+ struct iovec * iovCur;
+ int iovCurCount;
+ int ioTotal;
+ int ioDone;
+ int ioErrno;
+ struct evStream *prevDone, *nextDone;
+ struct evStream *prev, *next;
+} evStream;
+
+typedef struct evTimer {
+ evTimerFunc func;
+ void * uap;
+ struct timespec due, inter;
+ int index;
+ int mode;
+#define EV_TMR_RATE 1
+} evTimer;
+
+typedef struct evWait {
+ evWaitFunc func;
+ void * uap;
+ const void * tag;
+ struct evWait * next;
+} evWait;
+
+typedef struct evWaitList {
+ evWait * first;
+ evWait * last;
+ struct evWaitList * prev;
+ struct evWaitList * next;
+} evWaitList;
+
+typedef struct evEvent_p {
+ enum { Accept, File, Stream, Timer, Wait, Free, Null } type;
+ union {
+ struct { evAccept *this; } accept;
+ struct { evFile *this; int eventmask; } file;
+ struct { evStream *this; } stream;
+ struct { evTimer *this; } timer;
+ struct { evWait *this; } wait;
+ struct { struct evEvent_p *next; } free;
+ struct { const void *placeholder; } null;
+ } u;
+} evEvent_p;
+
+#ifdef USE_POLL
+typedef struct {
+ void *ctx; /* pointer to the evContext_p */
+ uint32_t type; /* READ, WRITE, EXCEPT, nonblk */
+ uint32_t result; /* 1 => revents, 0 => events */
+} __evEmulMask;
+
+#define emulMaskInit(ctx, field, ev, lastnext) \
+ ctx->field.ctx = ctx; \
+ ctx->field.type = ev; \
+ ctx->field.result = lastnext;
+
+extern short *__fd_eventfield(int fd, __evEmulMask *maskp);
+extern short __poll_event(__evEmulMask *maskp);
+extern void __fd_clr(int fd, __evEmulMask *maskp);
+extern void __fd_set(int fd, __evEmulMask *maskp);
+
+#undef FD_ZERO
+#define FD_ZERO(maskp)
+
+#undef FD_SET
+#define FD_SET(fd, maskp) \
+ __fd_set(fd, maskp)
+
+#undef FD_CLR
+#define FD_CLR(fd, maskp) \
+ __fd_clr(fd, maskp)
+
+#undef FD_ISSET
+#define FD_ISSET(fd, maskp) \
+ ((*__fd_eventfield(fd, maskp) & __poll_event(maskp)) != 0)
+
+#endif /* USE_POLL */
+
+typedef struct {
+ /* Global. */
+ const evEvent_p *cur;
+ /* Debugging. */
+ int debug;
+ FILE *output;
+ /* Connections. */
+ evConn *conns;
+ LIST(evAccept) accepts;
+ /* Files. */
+ evFile *files, *fdNext;
+#ifndef USE_POLL
+ fd_set rdLast, rdNext;
+ fd_set wrLast, wrNext;
+ fd_set exLast, exNext;
+ fd_set nonblockBefore;
+ int fdMax, fdCount, highestFD;
+ evFile *fdTable[FD_SETSIZE];
+#else
+ struct pollfd *pollfds; /* Allocated as needed */
+ evFile **fdTable; /* Ditto */
+ int maxnfds; /* # elements in above */
+ int firstfd; /* First active fd */
+ int fdMax; /* Last active fd */
+ int fdCount; /* # fd:s with I/O */
+ int highestFD; /* max fd allowed by OS */
+ __evEmulMask rdLast, rdNext;
+ __evEmulMask wrLast, wrNext;
+ __evEmulMask exLast, exNext;
+ __evEmulMask nonblockBefore;
+#endif /* USE_POLL */
+#ifdef EVENTLIB_TIME_CHECKS
+ struct timespec lastSelectTime;
+ int lastFdCount;
+#endif
+ /* Streams. */
+ evStream *streams;
+ evStream *strDone, *strLast;
+ /* Timers. */
+ struct timespec lastEventTime;
+ heap_context timers;
+ /* Waits. */
+ evWaitList *waitLists;
+ evWaitList waitDone;
+} evContext_p;
+
+/* eventlib.c */
+#define evPrintf __evPrintf
+void evPrintf(const evContext_p *ctx, int level, const char *fmt, ...)
+ ISC_FORMAT_PRINTF(3, 4);
+
+#ifdef USE_POLL
+extern int evPollfdRealloc(evContext_p *ctx, int pollfd_chunk_size, int fd);
+#endif /* USE_POLL */
+
+/* ev_timers.c */
+#define evCreateTimers __evCreateTimers
+heap_context evCreateTimers(const evContext_p *);
+#define evDestroyTimers __evDestroyTimers
+void evDestroyTimers(const evContext_p *);
+
+/* ev_waits.c */
+#define evFreeWait __evFreeWait
+evWait *evFreeWait(evContext_p *ctx, evWait *old);
+
+/* Global options */
+extern int __evOptMonoTime;
+
+#endif /*_EVENTLIB_P_H*/
diff --git a/usr/src/lib/libresolv2_joy/common/isc/heap.c b/usr/src/lib/libresolv2_joy/common/isc/heap.c
new file mode 100644
index 0000000000..3d22b6fc71
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/heap.c
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1997,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*%
+ * Heap implementation of priority queues adapted from the following:
+ *
+ * _Introduction to Algorithms_, Cormen, Leiserson, and Rivest,
+ * MIT Press / McGraw Hill, 1990, ISBN 0-262-03141-8, chapter 7.
+ *
+ * _Algorithms_, Second Edition, Sedgewick, Addison-Wesley, 1988,
+ * ISBN 0-201-06673-4, chapter 11.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: heap.c,v 1.4 2006/03/09 23:57:56 marka Exp $";
+#endif /* not lint */
+
+#include "port_before.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "port_after.h"
+
+#include <isc/heap.h>
+
+/*%
+ * Note: to make heap_parent and heap_left easy to compute, the first
+ * element of the heap array is not used; i.e. heap subscripts are 1-based,
+ * not 0-based.
+ */
+#define heap_parent(i) ((i) >> 1)
+#define heap_left(i) ((i) << 1)
+
+#define ARRAY_SIZE_INCREMENT 512
+
+heap_context
+heap_new(heap_higher_priority_func higher_priority, heap_index_func index,
+ int array_size_increment) {
+ heap_context ctx;
+
+ if (higher_priority == NULL)
+ return (NULL);
+
+ ctx = (heap_context)malloc(sizeof (struct heap_context));
+ if (ctx == NULL)
+ return (NULL);
+
+ ctx->array_size = 0;
+ if (array_size_increment == 0)
+ ctx->array_size_increment = ARRAY_SIZE_INCREMENT;
+ else
+ ctx->array_size_increment = array_size_increment;
+ ctx->heap_size = 0;
+ ctx->heap = NULL;
+ ctx->higher_priority = higher_priority;
+ ctx->index = index;
+ return (ctx);
+}
+
+int
+heap_free(heap_context ctx) {
+ if (ctx == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (ctx->heap != NULL)
+ free(ctx->heap);
+ free(ctx);
+
+ return (0);
+}
+
+static int
+heap_resize(heap_context ctx) {
+ void **new_heap;
+
+ ctx->array_size += ctx->array_size_increment;
+ new_heap = (void **)realloc(ctx->heap,
+ (ctx->array_size) * (sizeof (void *)));
+ if (new_heap == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ ctx->heap = new_heap;
+ return (0);
+}
+
+static void
+float_up(heap_context ctx, int i, void *elt) {
+ int p;
+
+ for ( p = heap_parent(i);
+ i > 1 && ctx->higher_priority(elt, ctx->heap[p]);
+ i = p, p = heap_parent(i) ) {
+ ctx->heap[i] = ctx->heap[p];
+ if (ctx->index != NULL)
+ (ctx->index)(ctx->heap[i], i);
+ }
+ ctx->heap[i] = elt;
+ if (ctx->index != NULL)
+ (ctx->index)(ctx->heap[i], i);
+}
+
+static void
+sink_down(heap_context ctx, int i, void *elt) {
+ int j, size, half_size;
+
+ size = ctx->heap_size;
+ half_size = size / 2;
+ while (i <= half_size) {
+ /* find smallest of the (at most) two children */
+ j = heap_left(i);
+ if (j < size && ctx->higher_priority(ctx->heap[j+1],
+ ctx->heap[j]))
+ j++;
+ if (ctx->higher_priority(elt, ctx->heap[j]))
+ break;
+ ctx->heap[i] = ctx->heap[j];
+ if (ctx->index != NULL)
+ (ctx->index)(ctx->heap[i], i);
+ i = j;
+ }
+ ctx->heap[i] = elt;
+ if (ctx->index != NULL)
+ (ctx->index)(ctx->heap[i], i);
+}
+
+int
+heap_insert(heap_context ctx, void *elt) {
+ int i;
+
+ if (ctx == NULL || elt == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ i = ++ctx->heap_size;
+ if (ctx->heap_size >= ctx->array_size && heap_resize(ctx) < 0)
+ return (-1);
+
+ float_up(ctx, i, elt);
+
+ return (0);
+}
+
+int
+heap_delete(heap_context ctx, int i) {
+ void *elt;
+ int less;
+
+ if (ctx == NULL || i < 1 || i > ctx->heap_size) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (i == ctx->heap_size) {
+ ctx->heap_size--;
+ } else {
+ elt = ctx->heap[ctx->heap_size--];
+ less = ctx->higher_priority(elt, ctx->heap[i]);
+ ctx->heap[i] = elt;
+ if (less)
+ float_up(ctx, i, ctx->heap[i]);
+ else
+ sink_down(ctx, i, ctx->heap[i]);
+ }
+
+ return (0);
+}
+
+int
+heap_increased(heap_context ctx, int i) {
+ if (ctx == NULL || i < 1 || i > ctx->heap_size) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ float_up(ctx, i, ctx->heap[i]);
+
+ return (0);
+}
+
+int
+heap_decreased(heap_context ctx, int i) {
+ if (ctx == NULL || i < 1 || i > ctx->heap_size) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ sink_down(ctx, i, ctx->heap[i]);
+
+ return (0);
+}
+
+void *
+heap_element(heap_context ctx, int i) {
+ if (ctx == NULL || i < 1 || i > ctx->heap_size) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ return (ctx->heap[i]);
+}
+
+int
+heap_for_each(heap_context ctx, heap_for_each_func action, void *uap) {
+ int i;
+
+ if (ctx == NULL || action == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ for (i = 1; i <= ctx->heap_size; i++)
+ (action)(ctx->heap[i], uap);
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/hex.c b/usr/src/lib/libresolv2_joy/common/isc/hex.c
new file mode 100644
index 0000000000..e43be4f3b5
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/hex.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2001 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <port_before.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <isc/misc.h>
+#include <port_after.h>
+
+static const char hex[17] = "0123456789abcdef";
+
+int
+isc_gethexstring(unsigned char *buf, size_t len, int count, FILE *fp,
+ int *multiline)
+{
+ int c, n;
+ unsigned char x;
+ char *s;
+ int result = count;
+
+ x = 0; /*%< silence compiler */
+ n = 0;
+ while (count > 0) {
+ c = fgetc(fp);
+
+ if ((c == EOF) ||
+ (c == '\n' && !*multiline) ||
+ (c == '(' && *multiline) ||
+ (c == ')' && !*multiline))
+ goto formerr;
+ /* comment */
+ if (c == ';') {
+ do {
+ c = fgetc(fp);
+ } while (c != EOF && c != '\n');
+ if (c == '\n' && *multiline)
+ continue;
+ goto formerr;
+ }
+ /* white space */
+ if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
+ continue;
+ /* multiline */
+ if ('(' == c || c == ')') {
+ *multiline = (c == '(' /*)*/);
+ continue;
+ }
+ if ((s = strchr(hex, tolower(c))) == NULL)
+ goto formerr;
+ x = (x<<4) | (s - hex);
+ if (++n == 2) {
+ if (len > 0U) {
+ *buf++ = x;
+ len--;
+ } else
+ result = -1;
+ count--;
+ n = 0;
+ }
+ }
+ return (result);
+
+ formerr:
+ if (c == '\n')
+ ungetc(c, fp);
+ return (-1);
+}
+
+void
+isc_puthexstring(FILE *fp, const unsigned char *buf, size_t buflen,
+ size_t len1, size_t len2, const char *sep)
+{
+ size_t i = 0;
+
+ if (len1 < 4U)
+ len1 = 4;
+ if (len2 < 4U)
+ len2 = 4;
+ while (buflen > 0U) {
+ fputc(hex[(buf[0]>>4)&0xf], fp);
+ fputc(hex[buf[0]&0xf], fp);
+ i += 2;
+ buflen--;
+ buf++;
+ if (i >= len1 && sep != NULL) {
+ fputs(sep, fp);
+ i = 0;
+ len1 = len2;
+ }
+ }
+}
+
+void
+isc_tohex(const unsigned char *buf, size_t buflen, char *t) {
+ while (buflen > 0U) {
+ *t++ = hex[(buf[0]>>4)&0xf];
+ *t++ = hex[buf[0]&0xf];
+ buf++;
+ buflen--;
+ }
+ *t = '\0';
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/logging.c b/usr/src/lib/libresolv2_joy/common/isc/logging.c
new file mode 100644
index 0000000000..8c2af2b9e3
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/logging.c
@@ -0,0 +1,716 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1996-1999, 2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: logging.c,v 1.9 2008/11/14 02:36:51 marka Exp $";
+#endif /* not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <syslog.h>
+#include <errno.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <isc/assertions.h>
+#include <isc/logging.h>
+#include <isc/memcluster.h>
+#include <isc/misc.h>
+
+#include "port_after.h"
+
+#include "logging_p.h"
+
+static const int syslog_priority[] = { LOG_DEBUG, LOG_INFO, LOG_NOTICE,
+ LOG_WARNING, LOG_ERR, LOG_CRIT };
+
+static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+static const char *level_text[] = {
+ "info: ", "notice: ", "warning: ", "error: ", "critical: "
+};
+
+static void
+version_rename(log_channel chan) {
+ unsigned int ver;
+ char old_name[PATH_MAX+1];
+ char new_name[PATH_MAX+1];
+
+ ver = chan->out.file.versions;
+ if (ver < 1)
+ return;
+ if (ver > LOG_MAX_VERSIONS)
+ ver = LOG_MAX_VERSIONS;
+ /*
+ * Need to have room for '.nn' (XXX assumes LOG_MAX_VERSIONS < 100)
+ */
+ if (strlen(chan->out.file.name) > (size_t)(PATH_MAX-3))
+ return;
+ for (ver--; ver > 0; ver--) {
+ sprintf(old_name, "%s.%d", chan->out.file.name, ver-1);
+ sprintf(new_name, "%s.%d", chan->out.file.name, ver);
+ (void)isc_movefile(old_name, new_name);
+ }
+ sprintf(new_name, "%s.0", chan->out.file.name);
+ (void)isc_movefile(chan->out.file.name, new_name);
+}
+
+FILE *
+log_open_stream(log_channel chan) {
+ FILE *stream;
+ int fd, flags;
+ struct stat sb;
+ int regular;
+
+ if (chan == NULL || chan->type != log_file) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ /*
+ * Don't open already open streams
+ */
+ if (chan->out.file.stream != NULL)
+ return (chan->out.file.stream);
+
+ if (stat(chan->out.file.name, &sb) < 0) {
+ if (errno != ENOENT) {
+ syslog(LOG_ERR,
+ "log_open_stream: stat of %s failed: %s",
+ chan->out.file.name, strerror(errno));
+ chan->flags |= LOG_CHANNEL_BROKEN;
+ return (NULL);
+ }
+ regular = 1;
+ } else
+ regular = (sb.st_mode & S_IFREG);
+
+ if (chan->out.file.versions) {
+ if (!regular) {
+ syslog(LOG_ERR,
+ "log_open_stream: want versions but %s isn't a regular file",
+ chan->out.file.name);
+ chan->flags |= LOG_CHANNEL_BROKEN;
+ errno = EINVAL;
+ return (NULL);
+ }
+ }
+
+ flags = O_WRONLY|O_CREAT|O_APPEND;
+
+ if ((chan->flags & LOG_TRUNCATE) != 0) {
+ if (regular) {
+ (void)unlink(chan->out.file.name);
+ flags |= O_EXCL;
+ } else {
+ syslog(LOG_ERR,
+ "log_open_stream: want truncation but %s isn't a regular file",
+ chan->out.file.name);
+ chan->flags |= LOG_CHANNEL_BROKEN;
+ errno = EINVAL;
+ return (NULL);
+ }
+ }
+
+ fd = open(chan->out.file.name, flags,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
+ if (fd < 0) {
+ syslog(LOG_ERR, "log_open_stream: open(%s) failed: %s",
+ chan->out.file.name, strerror(errno));
+ chan->flags |= LOG_CHANNEL_BROKEN;
+ return (NULL);
+ }
+ stream = fdopen(fd, "a");
+ if (stream == NULL) {
+ syslog(LOG_ERR, "log_open_stream: fdopen() failed");
+ chan->flags |= LOG_CHANNEL_BROKEN;
+ return (NULL);
+ }
+ (void) fchown(fd, chan->out.file.owner, chan->out.file.group);
+
+ chan->out.file.stream = stream;
+ return (stream);
+}
+
+int
+log_close_stream(log_channel chan) {
+ FILE *stream;
+
+ if (chan == NULL || chan->type != log_file) {
+ errno = EINVAL;
+ return (0);
+ }
+ stream = chan->out.file.stream;
+ chan->out.file.stream = NULL;
+ if (stream != NULL && fclose(stream) == EOF)
+ return (-1);
+ return (0);
+}
+
+void
+log_close_debug_channels(log_context lc) {
+ log_channel_list lcl;
+ int i;
+
+ for (i = 0; i < lc->num_categories; i++)
+ for (lcl = lc->categories[i]; lcl != NULL; lcl = lcl->next)
+ if (lcl->channel->type == log_file &&
+ lcl->channel->out.file.stream != NULL &&
+ lcl->channel->flags & LOG_REQUIRE_DEBUG)
+ (void)log_close_stream(lcl->channel);
+}
+
+FILE *
+log_get_stream(log_channel chan) {
+ if (chan == NULL || chan->type != log_file) {
+ errno = EINVAL;
+ return (NULL);
+ }
+ return (chan->out.file.stream);
+}
+
+char *
+log_get_filename(log_channel chan) {
+ if (chan == NULL || chan->type != log_file) {
+ errno = EINVAL;
+ return (NULL);
+ }
+ return (chan->out.file.name);
+}
+
+int
+log_check_channel(log_context lc, int level, log_channel chan) {
+ int debugging, chan_level;
+
+ REQUIRE(lc != NULL);
+
+ debugging = ((lc->flags & LOG_OPTION_DEBUG) != 0);
+
+ /*
+ * If not debugging, short circuit debugging messages very early.
+ */
+ if (level > 0 && !debugging)
+ return (0);
+
+ if ((chan->flags & (LOG_CHANNEL_BROKEN|LOG_CHANNEL_OFF)) != 0)
+ return (0);
+
+ /* Some channels only log when debugging is on. */
+ if ((chan->flags & LOG_REQUIRE_DEBUG) && !debugging)
+ return (0);
+
+ /* Some channels use the global level. */
+ if ((chan->flags & LOG_USE_CONTEXT_LEVEL) != 0) {
+ chan_level = lc->level;
+ } else
+ chan_level = chan->level;
+
+ if (level > chan_level)
+ return (0);
+
+ return (1);
+}
+
+int
+log_check(log_context lc, int category, int level) {
+ log_channel_list lcl;
+ int debugging;
+
+ REQUIRE(lc != NULL);
+
+ debugging = ((lc->flags & LOG_OPTION_DEBUG) != 0);
+
+ /*
+ * If not debugging, short circuit debugging messages very early.
+ */
+ if (level > 0 && !debugging)
+ return (0);
+
+ if (category < 0 || category > lc->num_categories)
+ category = 0; /*%< use default */
+ lcl = lc->categories[category];
+ if (lcl == NULL) {
+ category = 0;
+ lcl = lc->categories[0];
+ }
+
+ for ( /* nothing */; lcl != NULL; lcl = lcl->next) {
+ if (log_check_channel(lc, level, lcl->channel))
+ return (1);
+ }
+ return (0);
+}
+
+void
+log_vwrite(log_context lc, int category, int level, const char *format,
+ va_list args) {
+ log_channel_list lcl;
+ int pri, debugging, did_vsprintf = 0;
+ int original_category;
+ FILE *stream;
+ log_channel chan;
+ struct timeval tv;
+ struct tm *local_tm;
+#ifdef HAVE_TIME_R
+ struct tm tm_tmp;
+#endif
+ time_t tt;
+ const char *category_name;
+ const char *level_str;
+ char time_buf[256];
+ char level_buf[256];
+
+ REQUIRE(lc != NULL);
+
+ debugging = (lc->flags & LOG_OPTION_DEBUG);
+
+ /*
+ * If not debugging, short circuit debugging messages very early.
+ */
+ if (level > 0 && !debugging)
+ return;
+
+ if (category < 0 || category > lc->num_categories)
+ category = 0; /*%< use default */
+ original_category = category;
+ lcl = lc->categories[category];
+ if (lcl == NULL) {
+ category = 0;
+ lcl = lc->categories[0];
+ }
+
+ /*
+ * Get the current time and format it.
+ */
+ time_buf[0]='\0';
+ if (gettimeofday(&tv, NULL) < 0) {
+ syslog(LOG_INFO, "gettimeofday failed in log_vwrite()");
+ } else {
+ tt = tv.tv_sec;
+#ifdef HAVE_TIME_R
+ local_tm = localtime_r(&tt, &tm_tmp);
+#else
+ local_tm = localtime(&tt);
+#endif
+ if (local_tm != NULL) {
+ sprintf(time_buf, "%02d-%s-%4d %02d:%02d:%02d.%03ld ",
+ local_tm->tm_mday, months[local_tm->tm_mon],
+ local_tm->tm_year+1900, local_tm->tm_hour,
+ local_tm->tm_min, local_tm->tm_sec,
+ (long)tv.tv_usec/1000);
+ }
+ }
+
+ /*
+ * Make a string representation of the current category and level
+ */
+
+ if (lc->category_names != NULL &&
+ lc->category_names[original_category] != NULL)
+ category_name = lc->category_names[original_category];
+ else
+ category_name = "";
+
+ if (level >= log_critical) {
+ if (level >= 0) {
+ sprintf(level_buf, "debug %d: ", level);
+ level_str = level_buf;
+ } else
+ level_str = level_text[-level-1];
+ } else {
+ sprintf(level_buf, "level %d: ", level);
+ level_str = level_buf;
+ }
+
+ /*
+ * Write the message to channels.
+ */
+ for ( /* nothing */; lcl != NULL; lcl = lcl->next) {
+ chan = lcl->channel;
+
+ if (!log_check_channel(lc, level, chan))
+ continue;
+
+ if (!did_vsprintf) {
+ (void)vsprintf(lc->buffer, format, args);
+ if (strlen(lc->buffer) > (size_t)LOG_BUFFER_SIZE) {
+ syslog(LOG_CRIT,
+ "memory overrun in log_vwrite()");
+ exit(1);
+ }
+ did_vsprintf = 1;
+ }
+
+ switch (chan->type) {
+ case log_syslog:
+ if (level >= log_critical)
+ pri = (level >= 0) ? 0 : -level;
+ else
+ pri = -log_critical;
+ syslog(chan->out.facility|syslog_priority[pri],
+ "%s%s%s%s",
+ (chan->flags & LOG_TIMESTAMP) ? time_buf : "",
+ (chan->flags & LOG_PRINT_CATEGORY) ?
+ category_name : "",
+ (chan->flags & LOG_PRINT_LEVEL) ?
+ level_str : "",
+ lc->buffer);
+ break;
+ case log_file:
+ stream = chan->out.file.stream;
+ if (stream == NULL) {
+ stream = log_open_stream(chan);
+ if (stream == NULL)
+ break;
+ }
+ if (chan->out.file.max_size != ULONG_MAX) {
+ long pos;
+
+ pos = ftell(stream);
+ if (pos >= 0 &&
+ (unsigned long)pos >
+ chan->out.file.max_size) {
+ /*
+ * try to roll over the log files,
+ * ignoring all all return codes
+ * except the open (we don't want
+ * to write any more anyway)
+ */
+ log_close_stream(chan);
+ version_rename(chan);
+ stream = log_open_stream(chan);
+ if (stream == NULL)
+ break;
+ }
+ }
+ fprintf(stream, "%s%s%s%s\n",
+ (chan->flags & LOG_TIMESTAMP) ? time_buf : "",
+ (chan->flags & LOG_PRINT_CATEGORY) ?
+ category_name : "",
+ (chan->flags & LOG_PRINT_LEVEL) ?
+ level_str : "",
+ lc->buffer);
+ fflush(stream);
+ break;
+ case log_null:
+ break;
+ default:
+ syslog(LOG_ERR,
+ "unknown channel type in log_vwrite()");
+ }
+ }
+}
+
+void
+log_write(log_context lc, int category, int level, const char *format, ...) {
+ va_list args;
+
+ va_start(args, format);
+ log_vwrite(lc, category, level, format, args);
+ va_end(args);
+}
+
+/*%
+ * Functions to create, set, or destroy contexts
+ */
+
+int
+log_new_context(int num_categories, char **category_names, log_context *lc) {
+ log_context nlc;
+
+ nlc = memget(sizeof (struct log_context));
+ if (nlc == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ nlc->num_categories = num_categories;
+ nlc->category_names = category_names;
+ nlc->categories = memget(num_categories * sizeof (log_channel_list));
+ if (nlc->categories == NULL) {
+ memput(nlc, sizeof (struct log_context));
+ errno = ENOMEM;
+ return (-1);
+ }
+ memset(nlc->categories, '\0',
+ num_categories * sizeof (log_channel_list));
+ nlc->flags = 0U;
+ nlc->level = 0;
+ *lc = nlc;
+ return (0);
+}
+
+void
+log_free_context(log_context lc) {
+ log_channel_list lcl, lcl_next;
+ log_channel chan;
+ int i;
+
+ REQUIRE(lc != NULL);
+
+ for (i = 0; i < lc->num_categories; i++)
+ for (lcl = lc->categories[i]; lcl != NULL; lcl = lcl_next) {
+ lcl_next = lcl->next;
+ chan = lcl->channel;
+ (void)log_free_channel(chan);
+ memput(lcl, sizeof (struct log_channel_list));
+ }
+ memput(lc->categories,
+ lc->num_categories * sizeof (log_channel_list));
+ memput(lc, sizeof (struct log_context));
+}
+
+int
+log_add_channel(log_context lc, int category, log_channel chan) {
+ log_channel_list lcl;
+
+ if (lc == NULL || category < 0 || category >= lc->num_categories) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ lcl = memget(sizeof (struct log_channel_list));
+ if (lcl == NULL) {
+ errno = ENOMEM;
+ return(-1);
+ }
+ lcl->channel = chan;
+ lcl->next = lc->categories[category];
+ lc->categories[category] = lcl;
+ chan->references++;
+ return (0);
+}
+
+int
+log_remove_channel(log_context lc, int category, log_channel chan) {
+ log_channel_list lcl, prev_lcl, next_lcl;
+ int found = 0;
+
+ if (lc == NULL || category < 0 || category >= lc->num_categories) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ for (prev_lcl = NULL, lcl = lc->categories[category];
+ lcl != NULL;
+ lcl = next_lcl) {
+ next_lcl = lcl->next;
+ if (lcl->channel == chan) {
+ log_free_channel(chan);
+ if (prev_lcl != NULL)
+ prev_lcl->next = next_lcl;
+ else
+ lc->categories[category] = next_lcl;
+ memput(lcl, sizeof (struct log_channel_list));
+ /*
+ * We just set found instead of returning because
+ * the channel might be on the list more than once.
+ */
+ found = 1;
+ } else
+ prev_lcl = lcl;
+ }
+ if (!found) {
+ errno = ENOENT;
+ return (-1);
+ }
+ return (0);
+}
+
+int
+log_option(log_context lc, int option, int value) {
+ if (lc == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ switch (option) {
+ case LOG_OPTION_DEBUG:
+ if (value)
+ lc->flags |= option;
+ else
+ lc->flags &= ~option;
+ break;
+ case LOG_OPTION_LEVEL:
+ lc->level = value;
+ break;
+ default:
+ errno = EINVAL;
+ return (-1);
+ }
+ return (0);
+}
+
+int
+log_category_is_active(log_context lc, int category) {
+ if (lc == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if (category >= 0 && category < lc->num_categories &&
+ lc->categories[category] != NULL)
+ return (1);
+ return (0);
+}
+
+log_channel
+log_new_syslog_channel(unsigned int flags, int level, int facility) {
+ log_channel chan;
+
+ chan = memget(sizeof (struct log_channel));
+ if (chan == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ chan->type = log_syslog;
+ chan->flags = flags;
+ chan->level = level;
+ chan->out.facility = facility;
+ chan->references = 0;
+ return (chan);
+}
+
+log_channel
+log_new_file_channel(unsigned int flags, int level,
+ const char *name, FILE *stream, unsigned int versions,
+ unsigned long max_size) {
+ log_channel chan;
+
+ chan = memget(sizeof (struct log_channel));
+ if (chan == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ chan->type = log_file;
+ chan->flags = flags;
+ chan->level = level;
+ if (name != NULL) {
+ size_t len;
+
+ len = strlen(name);
+ /*
+ * Quantize length to a multiple of 256. There's space for the
+ * NUL, since if len is a multiple of 256, the size chosen will
+ * be the next multiple.
+ */
+ chan->out.file.name_size = ((len / 256) + 1) * 256;
+ chan->out.file.name = memget(chan->out.file.name_size);
+ if (chan->out.file.name == NULL) {
+ memput(chan, sizeof (struct log_channel));
+ errno = ENOMEM;
+ return (NULL);
+ }
+ /* This is safe. */
+ strcpy(chan->out.file.name, name);
+ } else {
+ chan->out.file.name_size = 0;
+ chan->out.file.name = NULL;
+ }
+ chan->out.file.stream = stream;
+ chan->out.file.versions = versions;
+ chan->out.file.max_size = max_size;
+ chan->out.file.owner = getuid();
+ chan->out.file.group = getgid();
+ chan->references = 0;
+ return (chan);
+}
+
+int
+log_set_file_owner(log_channel chan, uid_t owner, gid_t group) {
+ if (chan->type != log_file) {
+ errno = EBADF;
+ return (-1);
+ }
+ chan->out.file.owner = owner;
+ chan->out.file.group = group;
+ return (0);
+}
+
+log_channel
+log_new_null_channel() {
+ log_channel chan;
+
+ chan = memget(sizeof (struct log_channel));
+ if (chan == NULL) {
+ errno = ENOMEM;
+ return (NULL);
+ }
+ chan->type = log_null;
+ chan->flags = LOG_CHANNEL_OFF;
+ chan->level = log_info;
+ chan->references = 0;
+ return (chan);
+}
+
+int
+log_inc_references(log_channel chan) {
+ if (chan == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ chan->references++;
+ return (0);
+}
+
+int
+log_dec_references(log_channel chan) {
+ if (chan == NULL || chan->references <= 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ chan->references--;
+ return (0);
+}
+
+log_channel_type
+log_get_channel_type(log_channel chan) {
+ REQUIRE(chan != NULL);
+
+ return (chan->type);
+}
+
+int
+log_free_channel(log_channel chan) {
+ if (chan == NULL || chan->references <= 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ chan->references--;
+ if (chan->references == 0) {
+ if (chan->type == log_file) {
+ if ((chan->flags & LOG_CLOSE_STREAM) &&
+ chan->out.file.stream != NULL)
+ (void)fclose(chan->out.file.stream);
+ if (chan->out.file.name != NULL)
+ memput(chan->out.file.name,
+ chan->out.file.name_size);
+ }
+ memput(chan, sizeof (struct log_channel));
+ }
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/logging_p.h b/usr/src/lib/libresolv2_joy/common/isc/logging_p.h
new file mode 100644
index 0000000000..5e6314f190
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/logging_p.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef LOGGING_P_H
+#define LOGGING_P_H
+
+typedef struct log_file_desc {
+ char *name;
+ size_t name_size;
+ FILE *stream;
+ unsigned int versions;
+ unsigned long max_size;
+ uid_t owner;
+ gid_t group;
+} log_file_desc;
+
+typedef union log_output {
+ int facility;
+ log_file_desc file;
+} log_output;
+
+struct log_channel {
+ int level; /*%< don't log messages > level */
+ log_channel_type type;
+ log_output out;
+ unsigned int flags;
+ int references;
+};
+
+typedef struct log_channel_list {
+ log_channel channel;
+ struct log_channel_list *next;
+} *log_channel_list;
+
+#define LOG_BUFFER_SIZE 20480
+
+struct log_context {
+ int num_categories;
+ char **category_names;
+ log_channel_list *categories;
+ int flags;
+ int level;
+ char buffer[LOG_BUFFER_SIZE];
+};
+
+#endif /* !LOGGING_P_H */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/memcluster.c b/usr/src/lib/libresolv2_joy/common/isc/memcluster.c
new file mode 100644
index 0000000000..515793fd6a
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/memcluster.c
@@ -0,0 +1,588 @@
+/*
+ * Copyright (c) 2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1997,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/* When this symbol is defined allocations via memget are made slightly
+ bigger and some debugging info stuck before and after the region given
+ back to the caller. */
+/* #define DEBUGGING_MEMCLUSTER */
+#define MEMCLUSTER_ATEND
+
+
+#if !defined(LINT) && !defined(CODECENTER)
+static const char rcsid[] = "$Id: memcluster.c,v 1.11 2006/08/30 23:34:38 marka Exp $";
+#endif /* not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include <isc/memcluster.h>
+#include <isc/assertions.h>
+
+#include "port_after.h"
+
+#ifdef MEMCLUSTER_RECORD
+#ifndef DEBUGGING_MEMCLUSTER
+#define DEBUGGING_MEMCLUSTER
+#endif
+#endif
+
+#define DEF_MAX_SIZE 1100
+#define DEF_MEM_TARGET 4096
+
+typedef u_int32_t fence_t;
+
+typedef struct {
+ void * next;
+#if defined(DEBUGGING_MEMCLUSTER)
+#if defined(MEMCLUSTER_RECORD)
+ const char * file;
+ int line;
+#endif
+ size_t size;
+ fence_t fencepost;
+#endif
+} memcluster_element;
+
+#define SMALL_SIZE_LIMIT sizeof(memcluster_element)
+#define P_SIZE sizeof(void *)
+#define FRONT_FENCEPOST 0xfebafeba
+#define BACK_FENCEPOST 0xabefabef
+#define FENCEPOST_SIZE 4
+
+#ifndef MEMCLUSTER_LITTLE_MALLOC
+#define MEMCLUSTER_BIG_MALLOC 1
+#define NUM_BASIC_BLOCKS 64
+#endif
+
+struct stats {
+ u_long gets;
+ u_long totalgets;
+ u_long blocks;
+ u_long freefrags;
+};
+
+#ifdef DO_PTHREADS
+#include <pthread.h>
+static pthread_mutex_t memlock = PTHREAD_MUTEX_INITIALIZER;
+#define MEMLOCK (void)pthread_mutex_lock(&memlock)
+#define MEMUNLOCK (void)pthread_mutex_unlock(&memlock)
+#else
+/*
+ * Catch bad lock usage in non threaded build.
+ */
+static unsigned int memlock = 0;
+#define MEMLOCK do { INSIST(memlock == 0); memlock = 1; } while (0)
+#define MEMUNLOCK do { INSIST(memlock == 1); memlock = 0; } while (0)
+#endif /* DO_PTHEADS */
+
+/* Private data. */
+
+static size_t max_size;
+static size_t mem_target;
+#ifndef MEMCLUSTER_BIG_MALLOC
+static size_t mem_target_half;
+static size_t mem_target_fudge;
+#endif
+static memcluster_element ** freelists;
+#ifdef MEMCLUSTER_RECORD
+static memcluster_element ** activelists;
+#endif
+#ifdef MEMCLUSTER_BIG_MALLOC
+static memcluster_element * basic_blocks;
+#endif
+static struct stats * stats;
+
+/* Forward. */
+
+static size_t quantize(size_t);
+#if defined(DEBUGGING_MEMCLUSTER)
+static void check(unsigned char *, int, size_t);
+#endif
+
+/* Public. */
+
+int
+meminit(size_t init_max_size, size_t target_size) {
+
+#if defined(DEBUGGING_MEMCLUSTER)
+ INSIST(sizeof(fence_t) == FENCEPOST_SIZE);
+#endif
+ if (freelists != NULL) {
+ errno = EEXIST;
+ return (-1);
+ }
+ if (init_max_size == 0U)
+ max_size = DEF_MAX_SIZE;
+ else
+ max_size = init_max_size;
+ if (target_size == 0U)
+ mem_target = DEF_MEM_TARGET;
+ else
+ mem_target = target_size;
+#ifndef MEMCLUSTER_BIG_MALLOC
+ mem_target_half = mem_target / 2;
+ mem_target_fudge = mem_target + mem_target / 4;
+#endif
+ freelists = malloc(max_size * sizeof (memcluster_element *));
+ stats = malloc((max_size+1) * sizeof (struct stats));
+ if (freelists == NULL || stats == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ memset(freelists, 0,
+ max_size * sizeof (memcluster_element *));
+ memset(stats, 0, (max_size + 1) * sizeof (struct stats));
+#ifdef MEMCLUSTER_RECORD
+ activelists = malloc((max_size + 1) * sizeof (memcluster_element *));
+ if (activelists == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ memset(activelists, 0,
+ (max_size + 1) * sizeof (memcluster_element *));
+#endif
+#ifdef MEMCLUSTER_BIG_MALLOC
+ basic_blocks = NULL;
+#endif
+ return (0);
+}
+
+void *
+__memget(size_t size) {
+ return (__memget_record(size, NULL, 0));
+}
+
+void *
+__memget_record(size_t size, const char *file, int line) {
+ size_t new_size = quantize(size);
+#if defined(DEBUGGING_MEMCLUSTER)
+ memcluster_element *e;
+ char *p;
+ fence_t fp = BACK_FENCEPOST;
+#endif
+ void *ret;
+
+ MEMLOCK;
+
+#if !defined(MEMCLUSTER_RECORD)
+ UNUSED(file);
+ UNUSED(line);
+#endif
+ if (freelists == NULL) {
+ if (meminit(0, 0) == -1) {
+ MEMUNLOCK;
+ return (NULL);
+ }
+ }
+ if (size == 0U) {
+ MEMUNLOCK;
+ errno = EINVAL;
+ return (NULL);
+ }
+ if (size >= max_size || new_size >= max_size) {
+ /* memget() was called on something beyond our upper limit. */
+ stats[max_size].gets++;
+ stats[max_size].totalgets++;
+#if defined(DEBUGGING_MEMCLUSTER)
+ e = malloc(new_size);
+ if (e == NULL) {
+ MEMUNLOCK;
+ errno = ENOMEM;
+ return (NULL);
+ }
+ e->next = NULL;
+ e->size = size;
+#ifdef MEMCLUSTER_RECORD
+ e->file = file;
+ e->line = line;
+ e->next = activelists[max_size];
+ activelists[max_size] = e;
+#endif
+ MEMUNLOCK;
+ e->fencepost = FRONT_FENCEPOST;
+ p = (char *)e + sizeof *e + size;
+ memcpy(p, &fp, sizeof fp);
+ return ((char *)e + sizeof *e);
+#else
+ MEMUNLOCK;
+ return (malloc(size));
+#endif
+ }
+
+ /*
+ * If there are no blocks in the free list for this size, get a chunk
+ * of memory and then break it up into "new_size"-sized blocks, adding
+ * them to the free list.
+ */
+ if (freelists[new_size] == NULL) {
+ int i, frags;
+ size_t total_size;
+ void *new;
+ char *curr, *next;
+
+#ifdef MEMCLUSTER_BIG_MALLOC
+ if (basic_blocks == NULL) {
+ new = malloc(NUM_BASIC_BLOCKS * mem_target);
+ if (new == NULL) {
+ MEMUNLOCK;
+ errno = ENOMEM;
+ return (NULL);
+ }
+ curr = new;
+ next = curr + mem_target;
+ for (i = 0; i < (NUM_BASIC_BLOCKS - 1); i++) {
+ ((memcluster_element *)curr)->next = next;
+ curr = next;
+ next += mem_target;
+ }
+ /*
+ * curr is now pointing at the last block in the
+ * array.
+ */
+ ((memcluster_element *)curr)->next = NULL;
+ basic_blocks = new;
+ }
+ total_size = mem_target;
+ new = basic_blocks;
+ basic_blocks = basic_blocks->next;
+#else
+ if (new_size > mem_target_half)
+ total_size = mem_target_fudge;
+ else
+ total_size = mem_target;
+ new = malloc(total_size);
+ if (new == NULL) {
+ MEMUNLOCK;
+ errno = ENOMEM;
+ return (NULL);
+ }
+#endif
+ frags = total_size / new_size;
+ stats[new_size].blocks++;
+ stats[new_size].freefrags += frags;
+ /* Set up a linked-list of blocks of size "new_size". */
+ curr = new;
+ next = curr + new_size;
+ for (i = 0; i < (frags - 1); i++) {
+#if defined (DEBUGGING_MEMCLUSTER)
+ memset(curr, 0xa5, new_size);
+#endif
+ ((memcluster_element *)curr)->next = next;
+ curr = next;
+ next += new_size;
+ }
+ /* curr is now pointing at the last block in the array. */
+#if defined (DEBUGGING_MEMCLUSTER)
+ memset(curr, 0xa5, new_size);
+#endif
+ ((memcluster_element *)curr)->next = freelists[new_size];
+ freelists[new_size] = new;
+ }
+
+ /* The free list uses the "rounded-up" size "new_size". */
+#if defined (DEBUGGING_MEMCLUSTER)
+ e = freelists[new_size];
+ ret = (char *)e + sizeof *e;
+ /*
+ * Check to see if this buffer has been written to while on free list.
+ */
+ check(ret, 0xa5, new_size - sizeof *e);
+ /*
+ * Mark memory we are returning.
+ */
+ memset(ret, 0xe5, size);
+#else
+ ret = freelists[new_size];
+#endif
+ freelists[new_size] = freelists[new_size]->next;
+#if defined(DEBUGGING_MEMCLUSTER)
+ e->next = NULL;
+ e->size = size;
+ e->fencepost = FRONT_FENCEPOST;
+#ifdef MEMCLUSTER_RECORD
+ e->file = file;
+ e->line = line;
+ e->next = activelists[size];
+ activelists[size] = e;
+#endif
+ p = (char *)e + sizeof *e + size;
+ memcpy(p, &fp, sizeof fp);
+#endif
+
+ /*
+ * The stats[] uses the _actual_ "size" requested by the
+ * caller, with the caveat (in the code above) that "size" >= the
+ * max. size (max_size) ends up getting recorded as a call to
+ * max_size.
+ */
+ stats[size].gets++;
+ stats[size].totalgets++;
+ stats[new_size].freefrags--;
+ MEMUNLOCK;
+#if defined(DEBUGGING_MEMCLUSTER)
+ return ((char *)e + sizeof *e);
+#else
+ return (ret);
+#endif
+}
+
+/*%
+ * This is a call from an external caller,
+ * so we want to count this as a user "put".
+ */
+void
+__memput(void *mem, size_t size) {
+ __memput_record(mem, size, NULL, 0);
+}
+
+void
+__memput_record(void *mem, size_t size, const char *file, int line) {
+ size_t new_size = quantize(size);
+#if defined (DEBUGGING_MEMCLUSTER)
+ memcluster_element *e;
+ memcluster_element *el;
+#ifdef MEMCLUSTER_RECORD
+ memcluster_element *prev;
+#endif
+ fence_t fp;
+ char *p;
+#endif
+
+ MEMLOCK;
+
+#if !defined (MEMCLUSTER_RECORD)
+ UNUSED(file);
+ UNUSED(line);
+#endif
+
+ REQUIRE(freelists != NULL);
+
+ if (size == 0U) {
+ MEMUNLOCK;
+ errno = EINVAL;
+ return;
+ }
+
+#if defined (DEBUGGING_MEMCLUSTER)
+ e = (memcluster_element *) ((char *)mem - sizeof *e);
+ INSIST(e->fencepost == FRONT_FENCEPOST);
+ INSIST(e->size == size);
+ p = (char *)e + sizeof *e + size;
+ memcpy(&fp, p, sizeof fp);
+ INSIST(fp == BACK_FENCEPOST);
+ INSIST(((u_long)mem % 4) == 0);
+#ifdef MEMCLUSTER_RECORD
+ prev = NULL;
+ if (size == max_size || new_size >= max_size)
+ el = activelists[max_size];
+ else
+ el = activelists[size];
+ while (el != NULL && el != e) {
+ prev = el;
+ el = el->next;
+ }
+ INSIST(el != NULL); /*%< double free */
+ if (prev == NULL) {
+ if (size == max_size || new_size >= max_size)
+ activelists[max_size] = el->next;
+ else
+ activelists[size] = el->next;
+ } else
+ prev->next = el->next;
+#endif
+#endif
+
+ if (size == max_size || new_size >= max_size) {
+ /* memput() called on something beyond our upper limit */
+#if defined(DEBUGGING_MEMCLUSTER)
+ free(e);
+#else
+ free(mem);
+#endif
+
+ INSIST(stats[max_size].gets != 0U);
+ stats[max_size].gets--;
+ MEMUNLOCK;
+ return;
+ }
+
+ /* The free list uses the "rounded-up" size "new_size": */
+#if defined(DEBUGGING_MEMCLUSTER)
+ memset(mem, 0xa5, new_size - sizeof *e); /*%< catch write after free */
+ e->size = 0; /*%< catch double memput() */
+#ifdef MEMCLUSTER_RECORD
+ e->file = file;
+ e->line = line;
+#endif
+#ifdef MEMCLUSTER_ATEND
+ e->next = NULL;
+ el = freelists[new_size];
+ while (el != NULL && el->next != NULL)
+ el = el->next;
+ if (el)
+ el->next = e;
+ else
+ freelists[new_size] = e;
+#else
+ e->next = freelists[new_size];
+ freelists[new_size] = (void *)e;
+#endif
+#else
+ ((memcluster_element *)mem)->next = freelists[new_size];
+ freelists[new_size] = (memcluster_element *)mem;
+#endif
+
+ /*
+ * The stats[] uses the _actual_ "size" requested by the
+ * caller, with the caveat (in the code above) that "size" >= the
+ * max. size (max_size) ends up getting recorded as a call to
+ * max_size.
+ */
+ INSIST(stats[size].gets != 0U);
+ stats[size].gets--;
+ stats[new_size].freefrags++;
+ MEMUNLOCK;
+}
+
+void *
+__memget_debug(size_t size, const char *file, int line) {
+ void *ptr;
+ ptr = __memget_record(size, file, line);
+ fprintf(stderr, "%s:%d: memget(%lu) -> %p\n", file, line,
+ (u_long)size, ptr);
+ return (ptr);
+}
+
+void
+__memput_debug(void *ptr, size_t size, const char *file, int line) {
+ fprintf(stderr, "%s:%d: memput(%p, %lu)\n", file, line, ptr,
+ (u_long)size);
+ __memput_record(ptr, size, file, line);
+}
+
+/*%
+ * Print the stats[] on the stream "out" with suitable formatting.
+ */
+void
+memstats(FILE *out) {
+ size_t i;
+#ifdef MEMCLUSTER_RECORD
+ memcluster_element *e;
+#endif
+
+ MEMLOCK;
+
+ if (freelists == NULL) {
+ MEMUNLOCK;
+ return;
+ }
+ for (i = 1; i <= max_size; i++) {
+ const struct stats *s = &stats[i];
+
+ if (s->totalgets == 0U && s->gets == 0U)
+ continue;
+ fprintf(out, "%s%5lu: %11lu gets, %11lu rem",
+ (i == max_size) ? ">=" : " ",
+ (unsigned long)i, s->totalgets, s->gets);
+ if (s->blocks != 0U)
+ fprintf(out, " (%lu bl, %lu ff)",
+ s->blocks, s->freefrags);
+ fputc('\n', out);
+ }
+#ifdef MEMCLUSTER_RECORD
+ fprintf(out, "Active Memory:\n");
+ for (i = 1; i <= max_size; i++) {
+ if ((e = activelists[i]) != NULL)
+ while (e != NULL) {
+ fprintf(out, "%s:%d %p:%lu\n",
+ e->file != NULL ? e->file :
+ "<UNKNOWN>", e->line,
+ (char *)e + sizeof *e,
+ (u_long)e->size);
+ e = e->next;
+ }
+ }
+#endif
+ MEMUNLOCK;
+}
+
+int
+memactive(void) {
+ size_t i;
+
+ if (stats == NULL)
+ return (0);
+ for (i = 1; i <= max_size; i++)
+ if (stats[i].gets != 0U)
+ return (1);
+ return (0);
+}
+
+/* Private. */
+
+/*%
+ * Round up size to a multiple of sizeof(void *). This guarantees that a
+ * block is at least sizeof void *, and that we won't violate alignment
+ * restrictions, both of which are needed to make lists of blocks.
+ */
+static size_t
+quantize(size_t size) {
+ int remainder;
+ /*
+ * If there is no remainder for the integer division of
+ *
+ * (rightsize/P_SIZE)
+ *
+ * then we already have a good size; if not, then we need
+ * to round up the result in order to get a size big
+ * enough to satisfy the request _and_ aligned on P_SIZE boundaries.
+ */
+ remainder = size % P_SIZE;
+ if (remainder != 0)
+ size += P_SIZE - remainder;
+#if defined(DEBUGGING_MEMCLUSTER)
+ return (size + SMALL_SIZE_LIMIT + sizeof (int));
+#else
+ return (size);
+#endif
+}
+
+#if defined(DEBUGGING_MEMCLUSTER)
+static void
+check(unsigned char *a, int value, size_t len) {
+ size_t i;
+ for (i = 0; i < len; i++)
+ INSIST(a[i] == value);
+}
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/movefile.c b/usr/src/lib/libresolv2_joy/common/isc/movefile.c
new file mode 100644
index 0000000000..0ffc7047e2
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/movefile.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2000 by Internet Software Consortium, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include <port_before.h>
+#include <stdio.h>
+#include <isc/misc.h>
+#include <port_after.h>
+#ifndef HAVE_MOVEFILE
+/*
+ * rename() is lame (can't overwrite an existing file) on some systems.
+ * use movefile() instead, and let lame OS ports do what they need to.
+ */
+
+int
+isc_movefile(const char *oldname, const char *newname) {
+ return (rename(oldname, newname));
+}
+#else
+ static int os_port_has_isc_movefile = 1;
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/isc/tree.c b/usr/src/lib/libresolv2_joy/common/isc/tree.c
new file mode 100644
index 0000000000..8ba675fbe8
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/isc/tree.c
@@ -0,0 +1,534 @@
+#ifndef LINT
+static const char rcsid[] = "$Id: tree.c,v 1.4 2005/04/27 04:56:39 sra Exp $";
+#endif
+
+/*%
+ * tree - balanced binary tree library
+ *
+ * vix 05apr94 [removed vixie.h dependencies; cleaned up formatting, names]
+ * vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes]
+ * vix 23jun86 [added delete uar to add for replaced nodes]
+ * vix 20jun86 [added tree_delete per wirth a+ds (mod2 v.) p. 224]
+ * vix 06feb86 [added tree_mung()]
+ * vix 02feb86 [added tree balancing from wirth "a+ds=p" p. 220-221]
+ * vix 14dec85 [written]
+ */
+
+/*%
+ * This program text was created by Paul Vixie using examples from the book:
+ * "Algorithms & Data Structures," Niklaus Wirth, Prentice-Hall, 1986, ISBN
+ * 0-13-022005-1. Any errors in the conversion from Modula-2 to C are Paul
+ * Vixie's.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*#define DEBUG "tree"*/
+
+#include "port_before.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "port_after.h"
+
+#include <isc/memcluster.h>
+#include <isc/tree.h>
+
+#ifdef DEBUG
+static int debugDepth = 0;
+static char *debugFuncs[256];
+# define ENTER(proc) { \
+ debugFuncs[debugDepth] = proc; \
+ fprintf(stderr, "ENTER(%d:%s.%s)\n", \
+ debugDepth, DEBUG, \
+ debugFuncs[debugDepth]); \
+ debugDepth++; \
+ }
+# define RET(value) { \
+ debugDepth--; \
+ fprintf(stderr, "RET(%d:%s.%s)\n", \
+ debugDepth, DEBUG, \
+ debugFuncs[debugDepth]); \
+ return (value); \
+ }
+# define RETV { \
+ debugDepth--; \
+ fprintf(stderr, "RETV(%d:%s.%s)\n", \
+ debugDepth, DEBUG, \
+ debugFuncs[debugDepth]); \
+ return; \
+ }
+# define MSG(msg) fprintf(stderr, "MSG(%s)\n", msg);
+#else
+# define ENTER(proc) ;
+# define RET(value) return (value);
+# define RETV return;
+# define MSG(msg) ;
+#endif
+
+#ifndef TRUE
+# define TRUE 1
+# define FALSE 0
+#endif
+
+static tree * sprout(tree **, tree_t, int *, int (*)(), void (*)());
+static int delete(tree **, int (*)(), tree_t, void (*)(), int *, int *);
+static void del(tree **, int *, tree **, void (*)(), int *);
+static void bal_L(tree **, int *);
+static void bal_R(tree **, int *);
+
+void
+tree_init(tree **ppr_tree) {
+ ENTER("tree_init")
+ *ppr_tree = NULL;
+ RETV
+}
+
+tree_t
+tree_srch(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t), tree_t p_user) {
+ ENTER("tree_srch")
+
+ if (*ppr_tree) {
+ int i_comp = (*pfi_compare)(p_user, (**ppr_tree).data);
+
+ if (i_comp > 0)
+ RET(tree_srch(&(**ppr_tree).right,
+ pfi_compare,
+ p_user))
+
+ if (i_comp < 0)
+ RET(tree_srch(&(**ppr_tree).left,
+ pfi_compare,
+ p_user))
+
+ /* not higher, not lower... this must be the one.
+ */
+ RET((**ppr_tree).data)
+ }
+
+ /* grounded. NOT found.
+ */
+ RET(NULL)
+}
+
+tree_t
+tree_add(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t),
+ tree_t p_user, void (*pfv_uar)())
+{
+ int i_balance = FALSE;
+
+ ENTER("tree_add")
+ if (!sprout(ppr_tree, p_user, &i_balance, pfi_compare, pfv_uar))
+ RET(NULL)
+ RET(p_user)
+}
+
+int
+tree_delete(tree **ppr_p, int (*pfi_compare)(tree_t, tree_t),
+ tree_t p_user, void (*pfv_uar)())
+{
+ int i_balance = FALSE, i_uar_called = FALSE;
+
+ ENTER("tree_delete");
+ RET(delete(ppr_p, pfi_compare, p_user, pfv_uar,
+ &i_balance, &i_uar_called))
+}
+
+int
+tree_trav(tree **ppr_tree, int (*pfi_uar)(tree_t)) {
+ ENTER("tree_trav")
+
+ if (!*ppr_tree)
+ RET(TRUE)
+
+ if (!tree_trav(&(**ppr_tree).left, pfi_uar))
+ RET(FALSE)
+ if (!(*pfi_uar)((**ppr_tree).data))
+ RET(FALSE)
+ if (!tree_trav(&(**ppr_tree).right, pfi_uar))
+ RET(FALSE)
+ RET(TRUE)
+}
+
+void
+tree_mung(tree **ppr_tree, void (*pfv_uar)(tree_t)) {
+ ENTER("tree_mung")
+ if (*ppr_tree) {
+ tree_mung(&(**ppr_tree).left, pfv_uar);
+ tree_mung(&(**ppr_tree).right, pfv_uar);
+ if (pfv_uar)
+ (*pfv_uar)((**ppr_tree).data);
+ memput(*ppr_tree, sizeof(tree));
+ *ppr_tree = NULL;
+ }
+ RETV
+}
+
+static tree *
+sprout(tree **ppr, tree_t p_data, int *pi_balance,
+ int (*pfi_compare)(tree_t, tree_t), void (*pfv_delete)(tree_t))
+{
+ tree *p1, *p2, *sub;
+ int cmp;
+
+ ENTER("sprout")
+
+ /* are we grounded? if so, add the node "here" and set the rebalance
+ * flag, then exit.
+ */
+ if (!*ppr) {
+ MSG("grounded. adding new node, setting h=true")
+ *ppr = (tree *) memget(sizeof(tree));
+ if (*ppr) {
+ (*ppr)->left = NULL;
+ (*ppr)->right = NULL;
+ (*ppr)->bal = 0;
+ (*ppr)->data = p_data;
+ *pi_balance = TRUE;
+ }
+ RET(*ppr);
+ }
+
+ /* compare the data using routine passed by caller.
+ */
+ cmp = (*pfi_compare)(p_data, (*ppr)->data);
+
+ /* if LESS, prepare to move to the left.
+ */
+ if (cmp < 0) {
+ MSG("LESS. sprouting left.")
+ sub = sprout(&(*ppr)->left, p_data, pi_balance,
+ pfi_compare, pfv_delete);
+ if (sub && *pi_balance) { /*%< left branch has grown */
+ MSG("LESS: left branch has grown")
+ switch ((*ppr)->bal) {
+ case 1:
+ /* right branch WAS longer; bal is ok now */
+ MSG("LESS: case 1.. bal restored implicitly")
+ (*ppr)->bal = 0;
+ *pi_balance = FALSE;
+ break;
+ case 0:
+ /* balance WAS okay; now left branch longer */
+ MSG("LESS: case 0.. balnce bad but still ok")
+ (*ppr)->bal = -1;
+ break;
+ case -1:
+ /* left branch was already too long. rebal */
+ MSG("LESS: case -1: rebalancing")
+ p1 = (*ppr)->left;
+ if (p1->bal == -1) { /*%< LL */
+ MSG("LESS: single LL")
+ (*ppr)->left = p1->right;
+ p1->right = *ppr;
+ (*ppr)->bal = 0;
+ *ppr = p1;
+ } else { /*%< double LR */
+ MSG("LESS: double LR")
+
+ p2 = p1->right;
+ p1->right = p2->left;
+ p2->left = p1;
+
+ (*ppr)->left = p2->right;
+ p2->right = *ppr;
+
+ if (p2->bal == -1)
+ (*ppr)->bal = 1;
+ else
+ (*ppr)->bal = 0;
+
+ if (p2->bal == 1)
+ p1->bal = -1;
+ else
+ p1->bal = 0;
+ *ppr = p2;
+ } /*else*/
+ (*ppr)->bal = 0;
+ *pi_balance = FALSE;
+ } /*switch*/
+ } /*if*/
+ RET(sub)
+ } /*if*/
+
+ /* if MORE, prepare to move to the right.
+ */
+ if (cmp > 0) {
+ MSG("MORE: sprouting to the right")
+ sub = sprout(&(*ppr)->right, p_data, pi_balance,
+ pfi_compare, pfv_delete);
+ if (sub && *pi_balance) {
+ MSG("MORE: right branch has grown")
+
+ switch ((*ppr)->bal) {
+ case -1:
+ MSG("MORE: balance was off, fixed implicitly")
+ (*ppr)->bal = 0;
+ *pi_balance = FALSE;
+ break;
+ case 0:
+ MSG("MORE: balance was okay, now off but ok")
+ (*ppr)->bal = 1;
+ break;
+ case 1:
+ MSG("MORE: balance was off, need to rebalance")
+ p1 = (*ppr)->right;
+ if (p1->bal == 1) { /*%< RR */
+ MSG("MORE: single RR")
+ (*ppr)->right = p1->left;
+ p1->left = *ppr;
+ (*ppr)->bal = 0;
+ *ppr = p1;
+ } else { /*%< double RL */
+ MSG("MORE: double RL")
+
+ p2 = p1->left;
+ p1->left = p2->right;
+ p2->right = p1;
+
+ (*ppr)->right = p2->left;
+ p2->left = *ppr;
+
+ if (p2->bal == 1)
+ (*ppr)->bal = -1;
+ else
+ (*ppr)->bal = 0;
+
+ if (p2->bal == -1)
+ p1->bal = 1;
+ else
+ p1->bal = 0;
+
+ *ppr = p2;
+ } /*else*/
+ (*ppr)->bal = 0;
+ *pi_balance = FALSE;
+ } /*switch*/
+ } /*if*/
+ RET(sub)
+ } /*if*/
+
+ /* not less, not more: this is the same key! replace...
+ */
+ MSG("FOUND: Replacing data value")
+ *pi_balance = FALSE;
+ if (pfv_delete)
+ (*pfv_delete)((*ppr)->data);
+ (*ppr)->data = p_data;
+ RET(*ppr)
+}
+
+static int
+delete(tree **ppr_p, int (*pfi_compare)(tree_t, tree_t), tree_t p_user,
+ void (*pfv_uar)(tree_t), int *pi_balance, int *pi_uar_called)
+{
+ tree *pr_q;
+ int i_comp, i_ret;
+
+ ENTER("delete")
+
+ if (*ppr_p == NULL) {
+ MSG("key not in tree")
+ RET(FALSE)
+ }
+
+ i_comp = (*pfi_compare)((*ppr_p)->data, p_user);
+ if (i_comp > 0) {
+ MSG("too high - scan left")
+ i_ret = delete(&(*ppr_p)->left, pfi_compare, p_user, pfv_uar,
+ pi_balance, pi_uar_called);
+ if (*pi_balance)
+ bal_L(ppr_p, pi_balance);
+ } else if (i_comp < 0) {
+ MSG("too low - scan right")
+ i_ret = delete(&(*ppr_p)->right, pfi_compare, p_user, pfv_uar,
+ pi_balance, pi_uar_called);
+ if (*pi_balance)
+ bal_R(ppr_p, pi_balance);
+ } else {
+ MSG("equal")
+ pr_q = *ppr_p;
+ if (pr_q->right == NULL) {
+ MSG("right subtree null")
+ *ppr_p = pr_q->left;
+ *pi_balance = TRUE;
+ } else if (pr_q->left == NULL) {
+ MSG("right subtree non-null, left subtree null")
+ *ppr_p = pr_q->right;
+ *pi_balance = TRUE;
+ } else {
+ MSG("neither subtree null")
+ del(&pr_q->left, pi_balance, &pr_q,
+ pfv_uar, pi_uar_called);
+ if (*pi_balance)
+ bal_L(ppr_p, pi_balance);
+ }
+ if (!*pi_uar_called && pfv_uar)
+ (*pfv_uar)(pr_q->data);
+ /* Thanks to wuth@castrov.cuc.ab.ca for the following stmt. */
+ memput(pr_q, sizeof(tree));
+ i_ret = TRUE;
+ }
+ RET(i_ret)
+}
+
+static void
+del(tree **ppr_r, int *pi_balance, tree **ppr_q,
+ void (*pfv_uar)(tree_t), int *pi_uar_called)
+{
+ ENTER("del")
+
+ if ((*ppr_r)->right != NULL) {
+ del(&(*ppr_r)->right, pi_balance, ppr_q,
+ pfv_uar, pi_uar_called);
+ if (*pi_balance)
+ bal_R(ppr_r, pi_balance);
+ } else {
+ if (pfv_uar)
+ (*pfv_uar)((*ppr_q)->data);
+ *pi_uar_called = TRUE;
+ (*ppr_q)->data = (*ppr_r)->data;
+ *ppr_q = *ppr_r;
+ *ppr_r = (*ppr_r)->left;
+ *pi_balance = TRUE;
+ }
+
+ RETV
+}
+
+static void
+bal_L(tree **ppr_p, int *pi_balance) {
+ tree *p1, *p2;
+ int b1, b2;
+
+ ENTER("bal_L")
+ MSG("left branch has shrunk")
+
+ switch ((*ppr_p)->bal) {
+ case -1:
+ MSG("was imbalanced, fixed implicitly")
+ (*ppr_p)->bal = 0;
+ break;
+ case 0:
+ MSG("was okay, is now one off")
+ (*ppr_p)->bal = 1;
+ *pi_balance = FALSE;
+ break;
+ case 1:
+ MSG("was already off, this is too much")
+ p1 = (*ppr_p)->right;
+ b1 = p1->bal;
+ if (b1 >= 0) {
+ MSG("single RR")
+ (*ppr_p)->right = p1->left;
+ p1->left = *ppr_p;
+ if (b1 == 0) {
+ MSG("b1 == 0")
+ (*ppr_p)->bal = 1;
+ p1->bal = -1;
+ *pi_balance = FALSE;
+ } else {
+ MSG("b1 != 0")
+ (*ppr_p)->bal = 0;
+ p1->bal = 0;
+ }
+ *ppr_p = p1;
+ } else {
+ MSG("double RL")
+ p2 = p1->left;
+ b2 = p2->bal;
+ p1->left = p2->right;
+ p2->right = p1;
+ (*ppr_p)->right = p2->left;
+ p2->left = *ppr_p;
+ if (b2 == 1)
+ (*ppr_p)->bal = -1;
+ else
+ (*ppr_p)->bal = 0;
+ if (b2 == -1)
+ p1->bal = 1;
+ else
+ p1->bal = 0;
+ *ppr_p = p2;
+ p2->bal = 0;
+ }
+ }
+ RETV
+}
+
+static void
+bal_R(tree **ppr_p, int *pi_balance) {
+ tree *p1, *p2;
+ int b1, b2;
+
+ ENTER("bal_R")
+ MSG("right branch has shrunk")
+ switch ((*ppr_p)->bal) {
+ case 1:
+ MSG("was imbalanced, fixed implicitly")
+ (*ppr_p)->bal = 0;
+ break;
+ case 0:
+ MSG("was okay, is now one off")
+ (*ppr_p)->bal = -1;
+ *pi_balance = FALSE;
+ break;
+ case -1:
+ MSG("was already off, this is too much")
+ p1 = (*ppr_p)->left;
+ b1 = p1->bal;
+ if (b1 <= 0) {
+ MSG("single LL")
+ (*ppr_p)->left = p1->right;
+ p1->right = *ppr_p;
+ if (b1 == 0) {
+ MSG("b1 == 0")
+ (*ppr_p)->bal = -1;
+ p1->bal = 1;
+ *pi_balance = FALSE;
+ } else {
+ MSG("b1 != 0")
+ (*ppr_p)->bal = 0;
+ p1->bal = 0;
+ }
+ *ppr_p = p1;
+ } else {
+ MSG("double LR")
+ p2 = p1->right;
+ b2 = p2->bal;
+ p1->right = p2->left;
+ p2->left = p1;
+ (*ppr_p)->left = p2->right;
+ p2->right = *ppr_p;
+ if (b2 == -1)
+ (*ppr_p)->bal = 1;
+ else
+ (*ppr_p)->bal = 0;
+ if (b2 == 1)
+ p1->bal = -1;
+ else
+ p1->bal = 0;
+ *ppr_p = p2;
+ p2->bal = 0;
+ }
+ }
+ RETV
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/llib-lresolv_joy b/usr/src/lib/libresolv2_joy/common/llib-lresolv_joy
new file mode 100644
index 0000000000..aedd06a0fa
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/llib-lresolv_joy
@@ -0,0 +1,59 @@
+/* LINTLIBRARY */
+/* PROTOLIB1 */
+
+/*
+ * Copyright (c) 1997-1999 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
+/*
+ * usr/src/lib/libresolv2 routines
+ */
+
+int dn_skipname(const uchar_t *, const uchar_t *);
+void fp_query(const u_char *, FILE *);
+const uchar_t * p_cdname(const uchar_t *, const uchar_t *, FILE *);
+const char * p_class(int);
+void p_query(const u_char *);
+const char * p_time(unsigned int);
+const char * p_type(int);
+void putlong(unsigned int, uchar_t *);
+uint32_t _getlong(const u_char *);
+uint16_t _getshort(const u_char *);
+const char * hstrerror(int);
+int res_init(void);
+int res_mkquery(int, const char *, int, int, const u_char *,
+ int, const u_char *, u_char *, int);
+int res_query(const char *, int, int, u_char *, int);
+int res_querydomain(const char *, const char *, int, int,
+ u_char *, int);
+int res_search(const char *, int, int, u_char *, int);
+int res_send(const u_char *, int, u_char *, int);
+int res_update(ns_updrec *);
+int res_ninit(res_state);
+void fp_resstat(const res_state, FILE *);
+const char * res_hostalias(const res_state, const char *, char *, size_t);
+int res_nquery(res_state, const char *, int, int, u_char *, int);
+int res_nsearch(res_state, const char *, int, int, u_char *, int);
+int res_nquerydomain(res_state, const char *, const char *,
+ int, int, u_char *, int);
+int res_nmkquery(res_state, int, const char *, int, int,
+ const u_char *, int, const u_char *,
+ u_char *, int);
+int res_nsend(res_state, const u_char *, int, u_char *, int);
+int res_nmkupdate(res_state, ns_updrec *, u_char *, int);
+void res_nclose(res_state);
+int res_nsendsigned(res_state, const u_char *, int, ns_tsig_key *,
+ u_char *, int);
+int dn_comp(const char *, u_char *, int, u_char **, u_char **);
+int dn_expand(const u_char *, const u_char *, const u_char *,
+ char *, int);
diff --git a/usr/src/lib/print/libhttp-core/common/mapfile b/usr/src/lib/libresolv2_joy/common/mapfile-vers
index 1d641d73e1..e0c66a1c96 100644
--- a/usr/src/lib/print/libhttp-core/common/mapfile
+++ b/usr/src/lib/libresolv2_joy/common/mapfile-vers
@@ -18,13 +18,8 @@
#
# CDDL HEADER END
#
-
-#
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
#
-# $Id: mapfile.in,v 1.2 2006/03/02 06:31:36 njacobs Exp $
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#
#
@@ -41,31 +36,25 @@
# MAPFILE HEADER END
#
-#
-# Common interfaces that are most likely to be shared amongst the various
-# PAPI implementations.
-#
-
$mapfile_version 2
-SYMBOL_VERSION SUNWprivate_1.0 {
+SYMBOL_VERSION SUNWprivate {
global:
- httpCheck ;
- httpClose ;
- httpConnectEncrypt ;
- httpDumpData ;
- httpEncode64 ;
- httpEncryption ;
- httpFlush ;
- httpGetSubField ;
- httpPost ;
- httpRead ;
- httpReconnect ;
- httpSetField ;
- httpUpdate ;
- httpWait ;
- httpWrite ;
-
+ joy_dn_expand;
+ joy_res_nsearch;
+ joy_res_ninit;
+ joy_res_ndestroy;
+ joy_res_gethostbyaddr;
+ joy_res_gethostbyname;
+ joy_res_gethostbyname2;
+ joy_res_sethostent;
+ joy_res_endhostent;
+ __joy_res_override_retry;
+ __joy_res_unset_no_hosts_fallback;
+ __joy_res_set_no_hosts_fallback;
+ __joy_h_errno;
+ __joy_ns_get16;
+ __joy_ns_get32;
local:
- * ;
-} ;
+ *;
+};
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_date.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_date.c
new file mode 100644
index 0000000000..292375af63
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_date.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_date.c,v 1.6 2005/04/27 04:56:39 sra Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+/* Forward. */
+
+static int datepart(const char *, int, int, int, int *);
+
+/* Public. */
+
+/*%
+ * Convert a date in ASCII into the number of seconds since
+ * 1 January 1970 (GMT assumed). Format is yyyymmddhhmmss, all
+ * digits required, no spaces allowed.
+ */
+
+u_int32_t
+ns_datetosecs(const char *cp, int *errp) {
+ struct tm time;
+ u_int32_t result;
+ int mdays, i;
+ static const int days_per_month[12] =
+ {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+ if (strlen(cp) != 14U) {
+ *errp = 1;
+ return (0);
+ }
+ *errp = 0;
+
+ memset(&time, 0, sizeof time);
+ time.tm_year = datepart(cp + 0, 4, 1990, 9999, errp) - 1900;
+ time.tm_mon = datepart(cp + 4, 2, 01, 12, errp) - 1;
+ time.tm_mday = datepart(cp + 6, 2, 01, 31, errp);
+ time.tm_hour = datepart(cp + 8, 2, 00, 23, errp);
+ time.tm_min = datepart(cp + 10, 2, 00, 59, errp);
+ time.tm_sec = datepart(cp + 12, 2, 00, 59, errp);
+ if (*errp) /*%< Any parse errors? */
+ return (0);
+
+ /*
+ * OK, now because timegm() is not available in all environments,
+ * we will do it by hand. Roll up sleeves, curse the gods, begin!
+ */
+
+#define SECS_PER_DAY ((u_int32_t)24*60*60)
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
+
+ result = time.tm_sec; /*%< Seconds */
+ result += time.tm_min * 60; /*%< Minutes */
+ result += time.tm_hour * (60*60); /*%< Hours */
+ result += (time.tm_mday - 1) * SECS_PER_DAY; /*%< Days */
+ /* Months are trickier. Look without leaping, then leap */
+ mdays = 0;
+ for (i = 0; i < time.tm_mon; i++)
+ mdays += days_per_month[i];
+ result += mdays * SECS_PER_DAY; /*%< Months */
+ if (time.tm_mon > 1 && isleap(1900+time.tm_year))
+ result += SECS_PER_DAY; /*%< Add leapday for this year */
+ /* First figure years without leapdays, then add them in. */
+ /* The loop is slow, FIXME, but simple and accurate. */
+ result += (time.tm_year - 70) * (SECS_PER_DAY*365); /*%< Years */
+ for (i = 70; i < time.tm_year; i++)
+ if (isleap(1900+i))
+ result += SECS_PER_DAY; /*%< Add leapday for prev year */
+ return (result);
+}
+
+/* Private. */
+
+/*%
+ * Parse part of a date. Set error flag if any error.
+ * Don't reset the flag if there is no error.
+ */
+static int
+datepart(const char *buf, int size, int min, int max, int *errp) {
+ int result = 0;
+ int i;
+
+ for (i = 0; i < size; i++) {
+ if (!isdigit((unsigned char)(buf[i])))
+ *errp = 1;
+ result = (result * 10) + buf[i] - '0';
+ }
+ if (result < min)
+ *errp = 1;
+ if (result > max)
+ *errp = 1;
+ return (result);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_name.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_name.c
new file mode 100644
index 0000000000..f6b0accef1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_name.c
@@ -0,0 +1,1153 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_name.c,v 1.11 2009/01/23 19:59:16 each Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv_joy.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+#define NS_TYPE_ELT 0x40 /*%< EDNS0 extended label type */
+#define DNS_LABELTYPE_BITSTRING 0x41
+
+/* Data. */
+
+static const char digits[] = "0123456789";
+
+static const char digitvalue[256] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*16*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*32*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*48*/
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, /*64*/
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*80*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*96*/
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*112*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*128*/
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*256*/
+};
+
+/* Forward. */
+
+static int special(int);
+static int printable(int);
+static int dn_find(const u_char *, const u_char *,
+ const u_char * const *,
+ const u_char * const *);
+static int encode_bitsring(const char **, const char *,
+ unsigned char **, unsigned char **,
+ unsigned const char *);
+static int labellen(const u_char *);
+static int decode_bitstring(const unsigned char **,
+ char *, const char *);
+
+/* Public. */
+
+/*%
+ * Convert an encoded domain name to printable ascii as per RFC1035.
+
+ * return:
+ *\li Number of bytes written to buffer, or -1 (with errno set)
+ *
+ * notes:
+ *\li The root is returned as "."
+ *\li All other domains are returned in non absolute form
+ */
+int
+ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
+{
+ const u_char *cp;
+ char *dn, *eom;
+ u_char c;
+ u_int n;
+ int l;
+
+ cp = src;
+ dn = dst;
+ eom = dst + dstsiz;
+
+ while ((n = *cp++) != 0) {
+ if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+ /* Some kind of compression pointer. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (dn != dst) {
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '.';
+ }
+ if ((l = labellen(cp - 1)) < 0) {
+ errno = EMSGSIZE; /*%< XXX */
+ return (-1);
+ }
+ if (dn + l >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if ((n & NS_CMPRSFLGS) == NS_TYPE_ELT) {
+ int m;
+
+ if (n != DNS_LABELTYPE_BITSTRING) {
+ /* XXX: labellen should reject this case */
+ errno = EINVAL;
+ return (-1);
+ }
+ if ((m = decode_bitstring(&cp, dn, eom)) < 0)
+ {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ dn += m;
+ continue;
+ }
+ for ((void)NULL; l > 0; l--) {
+ c = *cp++;
+ if (special(c)) {
+ if (dn + 1 >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '\\';
+ *dn++ = (char)c;
+ } else if (!printable(c)) {
+ if (dn + 3 >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '\\';
+ *dn++ = digits[c / 100];
+ *dn++ = digits[(c % 100) / 10];
+ *dn++ = digits[c % 10];
+ } else {
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = (char)c;
+ }
+ }
+ }
+ if (dn == dst) {
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '.';
+ }
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = '\0';
+ return (dn - dst);
+}
+
+/*%
+ * Convert a ascii string into an encoded domain name as per RFC1035.
+ *
+ * return:
+ *
+ *\li -1 if it fails
+ *\li 1 if string was fully qualified
+ *\li 0 is string was not fully qualified
+ *
+ * notes:
+ *\li Enforces label and domain length limits.
+ */
+int
+ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
+ return (ns_name_pton2(src, dst, dstsiz, NULL));
+}
+
+/*
+ * ns_name_pton2(src, dst, dstsiz, *dstlen)
+ * Convert a ascii string into an encoded domain name as per RFC1035.
+ * return:
+ * -1 if it fails
+ * 1 if string was fully qualified
+ * 0 is string was not fully qualified
+ * side effects:
+ * fills in *dstlen (if non-NULL)
+ * notes:
+ * Enforces label and domain length limits.
+ */
+int
+ns_name_pton2(const char *src, u_char *dst, size_t dstsiz, size_t *dstlen) {
+ u_char *label, *bp, *eom;
+ int c, n, escaped, e = 0;
+ char *cp;
+
+ escaped = 0;
+ bp = dst;
+ eom = dst + dstsiz;
+ label = bp++;
+
+ while ((c = *src++) != 0) {
+ if (escaped) {
+ if (c == '[') { /*%< start a bit string label */
+ if ((cp = strchr(src, ']')) == NULL) {
+ errno = EINVAL; /*%< ??? */
+ return (-1);
+ }
+ if ((e = encode_bitsring(&src, cp + 2,
+ &label, &bp, eom))
+ != 0) {
+ errno = e;
+ return (-1);
+ }
+ escaped = 0;
+ label = bp++;
+ if ((c = *src++) == 0)
+ goto done;
+ else if (c != '.') {
+ errno = EINVAL;
+ return (-1);
+ }
+ continue;
+ }
+ else if ((cp = strchr(digits, c)) != NULL) {
+ n = (cp - digits) * 100;
+ if ((c = *src++) == 0 ||
+ (cp = strchr(digits, c)) == NULL) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ n += (cp - digits) * 10;
+ if ((c = *src++) == 0 ||
+ (cp = strchr(digits, c)) == NULL) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ n += (cp - digits);
+ if (n > 255) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ c = n;
+ }
+ escaped = 0;
+ } else if (c == '\\') {
+ escaped = 1;
+ continue;
+ } else if (c == '.') {
+ c = (bp - label - 1);
+ if ((c & NS_CMPRSFLGS) != 0) { /*%< Label too big. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (label >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *label = c;
+ /* Fully qualified ? */
+ if (*src == '\0') {
+ if (c != 0) {
+ if (bp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *bp++ = '\0';
+ }
+ if ((bp - dst) > MAXCDNAME) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (dstlen != NULL)
+ *dstlen = (bp - dst);
+ return (1);
+ }
+ if (c == 0 || *src == '.') {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ label = bp++;
+ continue;
+ }
+ if (bp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *bp++ = (u_char)c;
+ }
+ c = (bp - label - 1);
+ if ((c & NS_CMPRSFLGS) != 0) { /*%< Label too big. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ done:
+ if (label >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *label = c;
+ if (c != 0) {
+ if (bp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *bp++ = 0;
+ }
+ if ((bp - dst) > MAXCDNAME) { /*%< src too big */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (dstlen != NULL)
+ *dstlen = (bp - dst);
+ return (0);
+}
+
+/*%
+ * Convert a network strings labels into all lowercase.
+ *
+ * return:
+ *\li Number of bytes written to buffer, or -1 (with errno set)
+ *
+ * notes:
+ *\li Enforces label and domain length limits.
+ */
+
+int
+ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz)
+{
+ const u_char *cp;
+ u_char *dn, *eom;
+ u_char c;
+ u_int n;
+ int l;
+
+ cp = src;
+ dn = dst;
+ eom = dst + dstsiz;
+
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ while ((n = *cp++) != 0) {
+ if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+ /* Some kind of compression pointer. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *dn++ = n;
+ if ((l = labellen(cp - 1)) < 0) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (dn + l >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ for ((void)NULL; l > 0; l--) {
+ c = *cp++;
+ if (isascii(c) && isupper(c))
+ *dn++ = tolower(c);
+ else
+ *dn++ = c;
+ }
+ }
+ *dn++ = '\0';
+ return (dn - dst);
+}
+
+/*%
+ * Unpack a domain name from a message, source may be compressed.
+ *
+ * return:
+ *\li -1 if it fails, or consumed octets if it succeeds.
+ */
+int
+ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
+ u_char *dst, size_t dstsiz)
+{
+ return (ns_name_unpack2(msg, eom, src, dst, dstsiz, NULL));
+}
+
+/*
+ * ns_name_unpack2(msg, eom, src, dst, dstsiz, *dstlen)
+ * Unpack a domain name from a message, source may be compressed.
+ * return:
+ * -1 if it fails, or consumed octets if it succeeds.
+ * side effect:
+ * fills in *dstlen (if non-NULL).
+ */
+int
+ns_name_unpack2(const u_char *msg, const u_char *eom, const u_char *src,
+ u_char *dst, size_t dstsiz, size_t *dstlen)
+{
+ const u_char *srcp, *dstlim;
+ u_char *dstp;
+ int n, len, checked, l;
+
+ len = -1;
+ checked = 0;
+ dstp = dst;
+ srcp = src;
+ dstlim = dst + dstsiz;
+ if (srcp < msg || srcp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ /* Fetch next label in domain name. */
+ while ((n = *srcp++) != 0) {
+ /* Check for indirection. */
+ switch (n & NS_CMPRSFLGS) {
+ case 0:
+ case NS_TYPE_ELT:
+ /* Limit checks. */
+ if ((l = labellen(srcp - 1)) < 0) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (dstp + l + 1 >= dstlim || srcp + l >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ checked += l + 1;
+ *dstp++ = n;
+ memcpy(dstp, srcp, l);
+ dstp += l;
+ srcp += l;
+ break;
+
+ case NS_CMPRSFLGS:
+ if (srcp >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (len < 0)
+ len = srcp - src + 1;
+ srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff));
+ if (srcp < msg || srcp >= eom) { /*%< Out of range. */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ checked += 2;
+ /*
+ * Check for loops in the compressed name;
+ * if we've looked at the whole message,
+ * there must be a loop.
+ */
+ if (checked >= eom - msg) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ break;
+
+ default:
+ errno = EMSGSIZE;
+ return (-1); /*%< flag error */
+ }
+ }
+ *dstp++ = 0;
+ if (dstlen != NULL)
+ *dstlen = dstp - dst;
+ if (len < 0)
+ len = srcp - src;
+ return (len);
+}
+
+/*%
+ * Pack domain name 'domain' into 'comp_dn'.
+ *
+ * return:
+ *\li Size of the compressed name, or -1.
+ *
+ * notes:
+ *\li 'dnptrs' is an array of pointers to previous compressed names.
+ *\li dnptrs[0] is a pointer to the beginning of the message. The array
+ * ends with NULL.
+ *\li 'lastdnptr' is a pointer to the end of the array pointed to
+ * by 'dnptrs'.
+ *
+ * Side effects:
+ *\li The list of pointers in dnptrs is updated for labels inserted into
+ * the message as we compress the name. If 'dnptr' is NULL, we don't
+ * try to compress names. If 'lastdnptr' is NULL, we don't update the
+ * list.
+ */
+int
+ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
+ const u_char **dnptrs, const u_char **lastdnptr)
+{
+ u_char *dstp;
+ const u_char **cpp, **lpp, *eob, *msg;
+ const u_char *srcp;
+ int n, l, first = 1;
+
+ srcp = src;
+ dstp = dst;
+ eob = dstp + dstsiz;
+ lpp = cpp = NULL;
+ if (dnptrs != NULL) {
+ if ((msg = *dnptrs++) != NULL) {
+ for (cpp = dnptrs; *cpp != NULL; cpp++)
+ (void)NULL;
+ lpp = cpp; /*%< end of list to search */
+ }
+ } else
+ msg = NULL;
+
+ /* make sure the domain we are about to add is legal */
+ l = 0;
+ do {
+ int l0;
+
+ n = *srcp;
+ if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if ((l0 = labellen(srcp)) < 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ l += l0 + 1;
+ if (l > MAXCDNAME) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ srcp += l0 + 1;
+ } while (n != 0);
+
+ /* from here on we need to reset compression pointer array on error */
+ srcp = src;
+ do {
+ /* Look to see if we can use pointers. */
+ n = *srcp;
+ if (n != 0 && msg != NULL) {
+ l = dn_find(srcp, msg, (const u_char * const *)dnptrs,
+ (const u_char * const *)lpp);
+ if (l >= 0) {
+ if (dstp + 1 >= eob) {
+ goto cleanup;
+ }
+ *dstp++ = (l >> 8) | NS_CMPRSFLGS;
+ *dstp++ = l % 256;
+ return (dstp - dst);
+ }
+ /* Not found, save it. */
+ if (lastdnptr != NULL && cpp < lastdnptr - 1 &&
+ (dstp - msg) < 0x4000 && first) {
+ *cpp++ = dstp;
+ *cpp = NULL;
+ first = 0;
+ }
+ }
+ /* copy label to buffer */
+ if ((n & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+ /* Should not happen. */
+ goto cleanup;
+ }
+ n = labellen(srcp);
+ if (dstp + 1 + n >= eob) {
+ goto cleanup;
+ }
+ memcpy(dstp, srcp, n + 1);
+ srcp += n + 1;
+ dstp += n + 1;
+ } while (n != 0);
+
+ if (dstp > eob) {
+cleanup:
+ if (msg != NULL)
+ *lpp = NULL;
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ return (dstp - dst);
+}
+
+/*%
+ * Expand compressed domain name to presentation format.
+ *
+ * return:
+ *\li Number of bytes read out of `src', or -1 (with errno set).
+ *
+ * note:
+ *\li Root domain returns as "." not "".
+ */
+int
+ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src,
+ char *dst, size_t dstsiz)
+{
+ u_char tmp[NS_MAXCDNAME];
+ int n;
+
+ if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1)
+ return (-1);
+ if (ns_name_ntop(tmp, dst, dstsiz) == -1)
+ return (-1);
+ return (n);
+}
+
+/*%
+ * Compress a domain name into wire format, using compression pointers.
+ *
+ * return:
+ *\li Number of bytes consumed in `dst' or -1 (with errno set).
+ *
+ * notes:
+ *\li 'dnptrs' is an array of pointers to previous compressed names.
+ *\li dnptrs[0] is a pointer to the beginning of the message.
+ *\li The list ends with NULL. 'lastdnptr' is a pointer to the end of the
+ * array pointed to by 'dnptrs'. Side effect is to update the list of
+ * pointers for labels inserted into the message as we compress the name.
+ *\li If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr'
+ * is NULL, we don't update the list.
+ */
+int
+ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
+ const u_char **dnptrs, const u_char **lastdnptr)
+{
+ u_char tmp[NS_MAXCDNAME];
+
+ if (ns_name_pton(src, tmp, sizeof tmp) == -1)
+ return (-1);
+ return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr));
+}
+
+/*%
+ * Reset dnptrs so that there are no active references to pointers at or
+ * after src.
+ */
+void
+ns_name_rollback(const u_char *src, const u_char **dnptrs,
+ const u_char **lastdnptr)
+{
+ while (dnptrs < lastdnptr && *dnptrs != NULL) {
+ if (*dnptrs >= src) {
+ *dnptrs = NULL;
+ break;
+ }
+ dnptrs++;
+ }
+}
+
+/*%
+ * Advance *ptrptr to skip over the compressed name it points at.
+ *
+ * return:
+ *\li 0 on success, -1 (with errno set) on failure.
+ */
+int
+ns_name_skip(const u_char **ptrptr, const u_char *eom)
+{
+ const u_char *cp;
+ u_int n;
+ int l;
+
+ cp = *ptrptr;
+ while (cp < eom && (n = *cp++) != 0) {
+ /* Check for indirection. */
+ switch (n & NS_CMPRSFLGS) {
+ case 0: /*%< normal case, n == len */
+ cp += n;
+ continue;
+ case NS_TYPE_ELT: /*%< EDNS0 extended label */
+ if ((l = labellen(cp - 1)) < 0) {
+ errno = EMSGSIZE; /*%< XXX */
+ return (-1);
+ }
+ cp += l;
+ continue;
+ case NS_CMPRSFLGS: /*%< indirection */
+ cp++;
+ break;
+ default: /*%< illegal type */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ break;
+ }
+ if (cp > eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ *ptrptr = cp;
+ return (0);
+}
+
+/* Find the number of octets an nname takes up, including the root label.
+ * (This is basically ns_name_skip() without compression-pointer support.)
+ * ((NOTE: can only return zero if passed-in namesiz argument is zero.))
+ */
+ssize_t
+ns_name_length(ns_nname_ct nname, size_t namesiz) {
+ ns_nname_ct orig = nname;
+ u_int n;
+
+ while (namesiz-- > 0 && (n = *nname++) != 0) {
+ if ((n & NS_CMPRSFLGS) != 0) {
+ errno = EISDIR;
+ return (-1);
+ }
+ if (n > namesiz) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ nname += n;
+ namesiz -= n;
+ }
+ return (nname - orig);
+}
+
+/* Compare two nname's for equality. Return -1 on error (setting errno).
+ */
+int
+ns_name_eq(ns_nname_ct a, size_t as, ns_nname_ct b, size_t bs) {
+ ns_nname_ct ae = a + as, be = b + bs;
+ int ac, bc;
+
+ while (ac = *a, bc = *b, ac != 0 && bc != 0) {
+ if ((ac & NS_CMPRSFLGS) != 0 || (bc & NS_CMPRSFLGS) != 0) {
+ errno = EISDIR;
+ return (-1);
+ }
+ if (a + ac >= ae || b + bc >= be) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (ac != bc || strncasecmp((const char *) ++a,
+ (const char *) ++b, ac) != 0)
+ return (0);
+ a += ac, b += bc;
+ }
+ return (ac == 0 && bc == 0);
+}
+
+/* Is domain "A" owned by (at or below) domain "B"?
+ */
+int
+ns_name_owned(ns_namemap_ct a, int an, ns_namemap_ct b, int bn) {
+ /* If A is shorter, it cannot be owned by B. */
+ if (an < bn)
+ return (0);
+
+ /* If they are unequal before the length of the shorter, A cannot... */
+ while (bn > 0) {
+ if (a->len != b->len ||
+ strncasecmp((const char *) a->base,
+ (const char *) b->base, a->len) != 0)
+ return (0);
+ a++, an--;
+ b++, bn--;
+ }
+
+ /* A might be longer or not, but either way, B owns it. */
+ return (1);
+}
+
+/* Build an array of <base,len> tuples from an nname, top-down order.
+ * Return the number of tuples (labels) thus discovered.
+ */
+int
+ns_name_map(ns_nname_ct nname, size_t namelen, ns_namemap_t map, int mapsize) {
+ u_int n;
+ int l;
+
+ n = *nname++;
+ namelen--;
+
+ /* Root zone? */
+ if (n == 0) {
+ /* Extra data follows name? */
+ if (namelen > 0) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ return (0);
+ }
+
+ /* Compression pointer? */
+ if ((n & NS_CMPRSFLGS) != 0) {
+ errno = EISDIR;
+ return (-1);
+ }
+
+ /* Label too long? */
+ if (n > namelen) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+
+ /* Recurse to get rest of name done first. */
+ l = ns_name_map(nname + n, namelen - n, map, mapsize);
+ if (l < 0)
+ return (-1);
+
+ /* Too many labels? */
+ if (l >= mapsize) {
+ errno = ENAMETOOLONG;
+ return (-1);
+ }
+
+ /* We're on our way back up-stack, store current map data. */
+ map[l].base = nname;
+ map[l].len = n;
+ return (l + 1);
+}
+
+/* Count the labels in a domain name. Root counts, so COM. has two. This
+ * is to make the result comparable to the result of ns_name_map().
+ */
+int
+ns_name_labels(ns_nname_ct nname, size_t namesiz) {
+ int ret = 0;
+ u_int n;
+
+ while (namesiz-- > 0 && (n = *nname++) != 0) {
+ if ((n & NS_CMPRSFLGS) != 0) {
+ errno = EISDIR;
+ return (-1);
+ }
+ if (n > namesiz) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ nname += n;
+ namesiz -= n;
+ ret++;
+ }
+ return (ret + 1);
+}
+
+/* Private. */
+
+/*%
+ * Thinking in noninternationalized USASCII (per the DNS spec),
+ * is this characted special ("in need of quoting") ?
+ *
+ * return:
+ *\li boolean.
+ */
+static int
+special(int ch) {
+ switch (ch) {
+ case 0x22: /*%< '"' */
+ case 0x2E: /*%< '.' */
+ case 0x3B: /*%< ';' */
+ case 0x5C: /*%< '\\' */
+ case 0x28: /*%< '(' */
+ case 0x29: /*%< ')' */
+ /* Special modifiers in zone files. */
+ case 0x40: /*%< '@' */
+ case 0x24: /*%< '$' */
+ return (1);
+ default:
+ return (0);
+ }
+}
+
+/*%
+ * Thinking in noninternationalized USASCII (per the DNS spec),
+ * is this character visible and not a space when printed ?
+ *
+ * return:
+ *\li boolean.
+ */
+static int
+printable(int ch) {
+ return (ch > 0x20 && ch < 0x7f);
+}
+
+/*%
+ * Thinking in noninternationalized USASCII (per the DNS spec),
+ * convert this character to lower case if it's upper case.
+ */
+static int
+mklower(int ch) {
+ if (ch >= 0x41 && ch <= 0x5A)
+ return (ch + 0x20);
+ return (ch);
+}
+
+/*%
+ * Search for the counted-label name in an array of compressed names.
+ *
+ * return:
+ *\li offset from msg if found, or -1.
+ *
+ * notes:
+ *\li dnptrs is the pointer to the first name on the list,
+ *\li not the pointer to the start of the message.
+ */
+static int
+dn_find(const u_char *domain, const u_char *msg,
+ const u_char * const *dnptrs,
+ const u_char * const *lastdnptr)
+{
+ const u_char *dn, *cp, *sp;
+ const u_char * const *cpp;
+ u_int n;
+
+ for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
+ sp = *cpp;
+ /*
+ * terminate search on:
+ * root label
+ * compression pointer
+ * unusable offset
+ */
+ while (*sp != 0 && (*sp & NS_CMPRSFLGS) == 0 &&
+ (sp - msg) < 0x4000) {
+ dn = domain;
+ cp = sp;
+ while ((n = *cp++) != 0) {
+ /*
+ * check for indirection
+ */
+ switch (n & NS_CMPRSFLGS) {
+ case 0: /*%< normal case, n == len */
+ n = labellen(cp - 1); /*%< XXX */
+ if (n != *dn++)
+ goto next;
+
+ for ((void)NULL; n > 0; n--)
+ if (mklower(*dn++) !=
+ mklower(*cp++))
+ goto next;
+ /* Is next root for both ? */
+ if (*dn == '\0' && *cp == '\0')
+ return (sp - msg);
+ if (*dn)
+ continue;
+ goto next;
+ case NS_CMPRSFLGS: /*%< indirection */
+ cp = msg + (((n & 0x3f) << 8) | *cp);
+ break;
+
+ default: /*%< illegal type */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ }
+ next: ;
+ sp += *sp + 1;
+ }
+ }
+ errno = ENOENT;
+ return (-1);
+}
+
+static int
+decode_bitstring(const unsigned char **cpp, char *dn, const char *eom)
+{
+ const unsigned char *cp = *cpp;
+ char *beg = dn, tc;
+ int b, blen, plen, i;
+
+ if ((blen = (*cp & 0xff)) == 0)
+ blen = 256;
+ plen = (blen + 3) / 4;
+ plen += sizeof("\\[x/]") + (blen > 99 ? 3 : (blen > 9) ? 2 : 1);
+ if (dn + plen >= eom)
+ return (-1);
+
+ cp++;
+ i = SPRINTF((dn, "\\[x"));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ for (b = blen; b > 7; b -= 8, cp++) {
+ i = SPRINTF((dn, "%02x", *cp & 0xff));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ }
+ if (b > 4) {
+ tc = *cp++;
+ i = SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ } else if (b > 0) {
+ tc = *cp++;
+ i = SPRINTF((dn, "%1x",
+ ((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
+ if (i < 0)
+ return (-1);
+ dn += i;
+ }
+ i = SPRINTF((dn, "/%d]", blen));
+ if (i < 0)
+ return (-1);
+ dn += i;
+
+ *cpp = cp;
+ return (dn - beg);
+}
+
+static int
+encode_bitsring(const char **bp, const char *end, unsigned char **labelp,
+ unsigned char ** dst, unsigned const char *eom)
+{
+ int afterslash = 0;
+ const char *cp = *bp;
+ unsigned char *tp;
+ char c;
+ const char *beg_blen;
+ char *end_blen = NULL;
+ int value = 0, count = 0, tbcount = 0, blen = 0;
+
+ beg_blen = end_blen = NULL;
+
+ /* a bitstring must contain at least 2 characters */
+ if (end - cp < 2)
+ return (EINVAL);
+
+ /* XXX: currently, only hex strings are supported */
+ if (*cp++ != 'x')
+ return (EINVAL);
+ if (!isxdigit((*cp) & 0xff)) /*%< reject '\[x/BLEN]' */
+ return (EINVAL);
+
+ for (tp = *dst + 1; cp < end && tp < eom; cp++) {
+ switch((c = *cp)) {
+ case ']': /*%< end of the bitstring */
+ if (afterslash) {
+ if (beg_blen == NULL)
+ return (EINVAL);
+ blen = (int)strtol(beg_blen, &end_blen, 10);
+ if (*end_blen != ']')
+ return (EINVAL);
+ }
+ if (count)
+ *tp++ = ((value << 4) & 0xff);
+ cp++; /*%< skip ']' */
+ goto done;
+ case '/':
+ afterslash = 1;
+ break;
+ default:
+ if (afterslash) {
+ if (!isdigit(c&0xff))
+ return (EINVAL);
+ if (beg_blen == NULL) {
+
+ if (c == '0') {
+ /* blen never begings with 0 */
+ return (EINVAL);
+ }
+ beg_blen = cp;
+ }
+ } else {
+ if (!isxdigit(c&0xff))
+ return (EINVAL);
+ value <<= 4;
+ value += digitvalue[(int)c];
+ count += 4;
+ tbcount += 4;
+ if (tbcount > 256)
+ return (EINVAL);
+ if (count == 8) {
+ *tp++ = value;
+ count = 0;
+ }
+ }
+ break;
+ }
+ }
+ done:
+ if (cp >= end || tp >= eom)
+ return (EMSGSIZE);
+
+ /*
+ * bit length validation:
+ * If a <length> is present, the number of digits in the <bit-data>
+ * MUST be just sufficient to contain the number of bits specified
+ * by the <length>. If there are insignificant bits in a final
+ * hexadecimal or octal digit, they MUST be zero.
+ * RFC2673, Section 3.2.
+ */
+ if (blen > 0) {
+ int traillen;
+
+ if (((blen + 3) & ~3) != tbcount)
+ return (EINVAL);
+ traillen = tbcount - blen; /*%< between 0 and 3 */
+ if (((value << (8 - traillen)) & 0xff) != 0)
+ return (EINVAL);
+ }
+ else
+ blen = tbcount;
+ if (blen == 256)
+ blen = 0;
+
+ /* encode the type and the significant bit fields */
+ **labelp = DNS_LABELTYPE_BITSTRING;
+ **dst = blen;
+
+ *bp = cp;
+ *dst = tp;
+
+ return (0);
+}
+
+static int
+labellen(const u_char *lp)
+{
+ int bitlen;
+ u_char l = *lp;
+
+ if ((l & NS_CMPRSFLGS) == NS_CMPRSFLGS) {
+ /* should be avoided by the caller */
+ return (-1);
+ }
+
+ if ((l & NS_CMPRSFLGS) == NS_TYPE_ELT) {
+ if (l == DNS_LABELTYPE_BITSTRING) {
+ if ((bitlen = *(lp + 1)) == 0)
+ bitlen = 256;
+ return ((bitlen + 7 ) / 8 + 1);
+ }
+ return (-1); /*%< unknwon ELT */
+ }
+ return (l);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_netint.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_netint.c
new file mode 100644
index 0000000000..e196217f9b
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_netint.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_netint.c,v 1.3 2005/04/27 04:56:40 sra Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+
+#include <arpa/nameser.h>
+
+#include "port_after.h"
+
+#pragma redefine_extname __ns_get16 __joy_ns_get16
+#pragma redefine_extname __ns_get32 __joy_ns_get32
+
+/* Public. */
+
+u_int
+ns_get16(const u_char *src) {
+ u_int dst;
+
+ NS_GET16(dst, src);
+ return (dst);
+}
+
+u_long
+ns_get32(const u_char *src) {
+ u_long dst;
+
+ NS_GET32(dst, src);
+ return (dst);
+}
+
+void
+ns_put16(u_int src, u_char *dst) {
+ NS_PUT16(src, dst);
+}
+
+void
+ns_put32(u_long src, u_char *dst) {
+ NS_PUT32(src, dst);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_newmsg.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_newmsg.c
new file mode 100644
index 0000000000..c18dd060e1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_newmsg.c
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_newmsg.c,v 1.3 2009/02/26 10:48:57 marka Exp $";
+#endif
+
+#include <port_before.h>
+
+#include <arpa/nameser.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+
+#include <port_after.h>
+
+static int rdcpy(ns_newmsg *, ns_type, const u_char *, size_t);
+
+/* Initialize a "newmsg" object to empty.
+ */
+int
+ns_newmsg_init(u_char *buffer, size_t bufsiz, ns_newmsg *handle) {
+ ns_msg *msg = &handle->msg;
+
+ memset(handle, 0, sizeof *handle);
+ msg->_msg = buffer;
+ msg->_eom = buffer + bufsiz;
+ msg->_sect = ns_s_qd;
+ msg->_rrnum = 0;
+ msg->_msg_ptr = buffer + NS_HFIXEDSZ;
+ handle->dnptrs[0] = msg->_msg;
+ handle->dnptrs[1] = NULL;
+ handle->lastdnptr = &handle->dnptrs[sizeof handle->dnptrs /
+ sizeof handle->dnptrs[0] - 1];
+ return (0);
+}
+
+/* Initialize a "newmsg" object by copying an existing parsed message.
+ */
+int
+ns_newmsg_copy(ns_newmsg *handle, ns_msg *msg) {
+ ns_flag flag;
+ ns_sect sect;
+
+ ns_newmsg_id(handle, ns_msg_id(*msg));
+ for (flag = ns_f_qr; flag < ns_f_max; flag++)
+ ns_newmsg_flag(handle, flag, ns_msg_getflag(*msg, flag));
+ for (sect = ns_s_qd; sect < ns_s_max; sect++) {
+ int i, count;
+
+ count = ns_msg_count(*msg, sect);
+ for (i = 0; i < count; i++) {
+ ns_rr2 rr;
+ int x;
+
+ if (ns_parserr2(msg, sect, i, &rr) < 0)
+ return (-1);
+ if (sect == ns_s_qd)
+ x = ns_newmsg_q(handle,
+ ns_rr_nname(rr),
+ ns_rr_type(rr),
+ ns_rr_class(rr));
+ else
+ x = ns_newmsg_rr(handle, sect,
+ ns_rr_nname(rr),
+ ns_rr_type(rr),
+ ns_rr_class(rr),
+ ns_rr_ttl(rr),
+ ns_rr_rdlen(rr),
+ ns_rr_rdata(rr));
+ if (x < 0)
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+/* Set the message-ID in a "newmsg" object.
+ */
+void
+ns_newmsg_id(ns_newmsg *handle, u_int16_t id) {
+ ns_msg *msg = &handle->msg;
+
+ msg->_id = id;
+}
+
+/* Set a flag (including rcode or opcode) in a "newmsg" object.
+ */
+void
+ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, u_int value) {
+ extern struct _ns_flagdata _ns_flagdata[16];
+ struct _ns_flagdata *fd = &_ns_flagdata[flag];
+ ns_msg *msg = &handle->msg;
+
+ assert(flag < ns_f_max);
+ msg->_flags &= (~fd->mask);
+ msg->_flags |= (value << fd->shift);
+}
+
+/* Add a question (or zone, if it's an update) to a "newmsg" object.
+ */
+int
+ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname,
+ ns_type qtype, ns_class qclass)
+{
+ ns_msg *msg = &handle->msg;
+ u_char *t;
+ int n;
+
+ if (msg->_sect != ns_s_qd) {
+ errno = ENODEV;
+ return (-1);
+ }
+ t = (u_char *) (unsigned long) msg->_msg_ptr;
+ if (msg->_rrnum == 0)
+ msg->_sections[ns_s_qd] = t;
+ n = ns_name_pack(qname, t, msg->_eom - t,
+ handle->dnptrs, handle->lastdnptr);
+ if (n < 0)
+ return (-1);
+ t += n;
+ if (t + QFIXEDSZ >= msg->_eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ NS_PUT16(qtype, t);
+ NS_PUT16(qclass, t);
+ msg->_msg_ptr = t;
+ msg->_counts[ns_s_qd] = ++msg->_rrnum;
+ return (0);
+}
+
+/* Add an RR to a "newmsg" object.
+ */
+int
+ns_newmsg_rr(ns_newmsg *handle, ns_sect sect,
+ ns_nname_ct name, ns_type type,
+ ns_class rr_class, u_int32_t ttl,
+ u_int16_t rdlen, const u_char *rdata)
+{
+ ns_msg *msg = &handle->msg;
+ u_char *t;
+ int n;
+
+ if (sect < msg->_sect) {
+ errno = ENODEV;
+ return (-1);
+ }
+ t = (u_char *) (unsigned long) msg->_msg_ptr;
+ if (sect > msg->_sect) {
+ msg->_sect = sect;
+ msg->_sections[sect] = t;
+ msg->_rrnum = 0;
+ }
+ n = ns_name_pack(name, t, msg->_eom - t,
+ handle->dnptrs, handle->lastdnptr);
+ if (n < 0)
+ return (-1);
+ t += n;
+ if (t + RRFIXEDSZ + rdlen >= msg->_eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ NS_PUT16(type, t);
+ NS_PUT16(rr_class, t);
+ NS_PUT32(ttl, t);
+ msg->_msg_ptr = t;
+ if (rdcpy(handle, type, rdata, rdlen) < 0)
+ return (-1);
+ msg->_counts[sect] = ++msg->_rrnum;
+ return (0);
+}
+
+/* Complete a "newmsg" object and return its size for use in write().
+ * (Note: the "newmsg" object is also made ready for ns_parserr() etc.)
+ */
+size_t
+ns_newmsg_done(ns_newmsg *handle) {
+ ns_msg *msg = &handle->msg;
+ ns_sect sect;
+ u_char *t;
+
+ t = (u_char *) (unsigned long) msg->_msg;
+ NS_PUT16(msg->_id, t);
+ NS_PUT16(msg->_flags, t);
+ for (sect = 0; sect < ns_s_max; sect++)
+ NS_PUT16(msg->_counts[sect], t);
+ msg->_eom = msg->_msg_ptr;
+ msg->_sect = ns_s_max;
+ msg->_rrnum = -1;
+ msg->_msg_ptr = NULL;
+ return (msg->_eom - msg->_msg);
+}
+
+/* Private. */
+
+/* Copy an RDATA, using compression pointers where RFC1035 permits.
+ */
+static int
+rdcpy(ns_newmsg *handle, ns_type type, const u_char *rdata, size_t rdlen) {
+ ns_msg *msg = &handle->msg;
+ u_char *p = (u_char *) (unsigned long) msg->_msg_ptr;
+ u_char *t = p + NS_INT16SZ;
+ u_char *s = t;
+ int n;
+
+ switch (type) {
+ case ns_t_soa:
+ /* MNAME. */
+ n = ns_name_pack(rdata, t, msg->_eom - t,
+ handle->dnptrs, handle->lastdnptr);
+ if (n < 0)
+ return (-1);
+ t += n;
+ if (ns_name_skip(&rdata, msg->_eom) < 0)
+ return (-1);
+
+ /* ANAME. */
+ n = ns_name_pack(rdata, t, msg->_eom - t,
+ handle->dnptrs, handle->lastdnptr);
+ if (n < 0)
+ return (-1);
+ t += n;
+ if (ns_name_skip(&rdata, msg->_eom) < 0)
+ return (-1);
+
+ /* Serial, Refresh, Retry, Expiry, and Minimum. */
+ if ((msg->_eom - t) < (NS_INT32SZ * 5)) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ memcpy(t, rdata, NS_INT32SZ * 5);
+ t += (NS_INT32SZ * 5);
+ break;
+ case ns_t_ptr:
+ case ns_t_cname:
+ case ns_t_ns:
+ /* PTRDNAME, CNAME, or NSDNAME. */
+ n = ns_name_pack(rdata, t, msg->_eom - t,
+ handle->dnptrs, handle->lastdnptr);
+ if (n < 0)
+ return (-1);
+ t += n;
+ break;
+ default:
+ memcpy(t, rdata, rdlen);
+ t += rdlen;
+ }
+ NS_PUT16(t - s, p);
+ msg->_msg_ptr = t;
+ return (0);
+}
+
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_parse.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_parse.c
new file mode 100644
index 0000000000..ba11eea707
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_parse.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_parse.c,v 1.10 2009/01/23 19:59:16 each Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv_joy.h>
+#include <string.h>
+
+#include "port_after.h"
+
+/* Forward. */
+
+static void setsection(ns_msg *msg, ns_sect sect);
+
+/* Macros. */
+
+#if !defined(SOLARIS2) || defined(__COVERITY__)
+#define RETERR(err) do { errno = (err); return (-1); } while (0)
+#else
+#define RETERR(err) \
+ do { errno = (err); if (errno == errno) return (-1); } while (0)
+#endif
+
+#define PARSE_FMT_PRESO 0 /* Parse using presentation-format names */
+#define PARSE_FMT_WIRE 1 /* Parse using network-format names */
+
+/* Public. */
+
+/* These need to be in the same order as the nres.h:ns_flag enum. */
+struct _ns_flagdata _ns_flagdata[16] = {
+ { 0x8000, 15 }, /*%< qr. */
+ { 0x7800, 11 }, /*%< opcode. */
+ { 0x0400, 10 }, /*%< aa. */
+ { 0x0200, 9 }, /*%< tc. */
+ { 0x0100, 8 }, /*%< rd. */
+ { 0x0080, 7 }, /*%< ra. */
+ { 0x0040, 6 }, /*%< z. */
+ { 0x0020, 5 }, /*%< ad. */
+ { 0x0010, 4 }, /*%< cd. */
+ { 0x000f, 0 }, /*%< rcode. */
+ { 0x0000, 0 }, /*%< expansion (1/6). */
+ { 0x0000, 0 }, /*%< expansion (2/6). */
+ { 0x0000, 0 }, /*%< expansion (3/6). */
+ { 0x0000, 0 }, /*%< expansion (4/6). */
+ { 0x0000, 0 }, /*%< expansion (5/6). */
+ { 0x0000, 0 }, /*%< expansion (6/6). */
+};
+
+int ns_msg_getflag(ns_msg handle, int flag) {
+ return(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
+}
+
+int
+ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
+ const u_char *optr = ptr;
+
+ for ((void)NULL; count > 0; count--) {
+ int b, rdlength;
+
+ b = dn_skipname(ptr, eom);
+ if (b < 0)
+ RETERR(EMSGSIZE);
+ ptr += b/*Name*/ + NS_INT16SZ/*Type*/ + NS_INT16SZ/*Class*/;
+ if (section != ns_s_qd) {
+ if (ptr + NS_INT32SZ + NS_INT16SZ > eom)
+ RETERR(EMSGSIZE);
+ ptr += NS_INT32SZ/*TTL*/;
+ NS_GET16(rdlength, ptr);
+ ptr += rdlength/*RData*/;
+ }
+ }
+ if (ptr > eom)
+ RETERR(EMSGSIZE);
+ return (ptr - optr);
+}
+
+int
+ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
+ const u_char *eom = msg + msglen;
+ int i;
+
+ handle->_msg = msg;
+ handle->_eom = eom;
+ if (msg + NS_INT16SZ > eom)
+ RETERR(EMSGSIZE);
+ NS_GET16(handle->_id, msg);
+ if (msg + NS_INT16SZ > eom)
+ RETERR(EMSGSIZE);
+ NS_GET16(handle->_flags, msg);
+ for (i = 0; i < ns_s_max; i++) {
+ if (msg + NS_INT16SZ > eom)
+ RETERR(EMSGSIZE);
+ NS_GET16(handle->_counts[i], msg);
+ }
+ for (i = 0; i < ns_s_max; i++)
+ if (handle->_counts[i] == 0)
+ handle->_sections[i] = NULL;
+ else {
+ int b = ns_skiprr(msg, eom, (ns_sect)i,
+ handle->_counts[i]);
+
+ if (b < 0)
+ return (-1);
+ handle->_sections[i] = msg;
+ msg += b;
+ }
+ if (msg != eom)
+ RETERR(EMSGSIZE);
+ setsection(handle, ns_s_max);
+ return (0);
+}
+
+int
+ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
+ int b;
+ int tmp;
+
+ /* Make section right. */
+ tmp = section;
+ if (tmp < 0 || section >= ns_s_max)
+ RETERR(ENODEV);
+ if (section != handle->_sect)
+ setsection(handle, section);
+
+ /* Make rrnum right. */
+ if (rrnum == -1)
+ rrnum = handle->_rrnum;
+ if (rrnum < 0 || rrnum >= handle->_counts[(int)section])
+ RETERR(ENODEV);
+ if (rrnum < handle->_rrnum)
+ setsection(handle, section);
+ if (rrnum > handle->_rrnum) {
+ b = ns_skiprr(handle->_msg_ptr, handle->_eom, section,
+ rrnum - handle->_rrnum);
+
+ if (b < 0)
+ return (-1);
+ handle->_msg_ptr += b;
+ handle->_rrnum = rrnum;
+ }
+
+ /* Do the parse. */
+ b = dn_expand(handle->_msg, handle->_eom,
+ handle->_msg_ptr, rr->name, NS_MAXDNAME);
+ if (b < 0)
+ return (-1);
+ handle->_msg_ptr += b;
+ if (handle->_msg_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
+ RETERR(EMSGSIZE);
+ NS_GET16(rr->type, handle->_msg_ptr);
+ NS_GET16(rr->rr_class, handle->_msg_ptr);
+ if (section == ns_s_qd) {
+ rr->ttl = 0;
+ rr->rdlength = 0;
+ rr->rdata = NULL;
+ } else {
+ if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
+ RETERR(EMSGSIZE);
+ NS_GET32(rr->ttl, handle->_msg_ptr);
+ NS_GET16(rr->rdlength, handle->_msg_ptr);
+ if (handle->_msg_ptr + rr->rdlength > handle->_eom)
+ RETERR(EMSGSIZE);
+ rr->rdata = handle->_msg_ptr;
+ handle->_msg_ptr += rr->rdlength;
+ }
+ if (++handle->_rrnum > handle->_counts[(int)section])
+ setsection(handle, (ns_sect)((int)section + 1));
+
+ /* All done. */
+ return (0);
+}
+
+/*
+ * This is identical to the above but uses network-format (uncompressed) names.
+ */
+int
+ns_parserr2(ns_msg *handle, ns_sect section, int rrnum, ns_rr2 *rr) {
+ int b;
+ int tmp;
+
+ /* Make section right. */
+ if ((tmp = section) < 0 || section >= ns_s_max)
+ RETERR(ENODEV);
+ if (section != handle->_sect)
+ setsection(handle, section);
+
+ /* Make rrnum right. */
+ if (rrnum == -1)
+ rrnum = handle->_rrnum;
+ if (rrnum < 0 || rrnum >= handle->_counts[(int)section])
+ RETERR(ENODEV);
+ if (rrnum < handle->_rrnum)
+ setsection(handle, section);
+ if (rrnum > handle->_rrnum) {
+ b = ns_skiprr(handle->_msg_ptr, handle->_eom, section,
+ rrnum - handle->_rrnum);
+
+ if (b < 0)
+ return (-1);
+ handle->_msg_ptr += b;
+ handle->_rrnum = rrnum;
+ }
+
+ /* Do the parse. */
+ b = ns_name_unpack2(handle->_msg, handle->_eom, handle->_msg_ptr,
+ rr->nname, NS_MAXNNAME, &rr->nnamel);
+ if (b < 0)
+ return (-1);
+ handle->_msg_ptr += b;
+ if (handle->_msg_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
+ RETERR(EMSGSIZE);
+ NS_GET16(rr->type, handle->_msg_ptr);
+ NS_GET16(rr->rr_class, handle->_msg_ptr);
+ if (section == ns_s_qd) {
+ rr->ttl = 0;
+ rr->rdlength = 0;
+ rr->rdata = NULL;
+ } else {
+ if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
+ RETERR(EMSGSIZE);
+ NS_GET32(rr->ttl, handle->_msg_ptr);
+ NS_GET16(rr->rdlength, handle->_msg_ptr);
+ if (handle->_msg_ptr + rr->rdlength > handle->_eom)
+ RETERR(EMSGSIZE);
+ rr->rdata = handle->_msg_ptr;
+ handle->_msg_ptr += rr->rdlength;
+ }
+ if (++handle->_rrnum > handle->_counts[(int)section])
+ setsection(handle, (ns_sect)((int)section + 1));
+
+ /* All done. */
+ return (0);
+}
+
+/* Private. */
+
+static void
+setsection(ns_msg *msg, ns_sect sect) {
+ msg->_sect = sect;
+ if (sect == ns_s_max) {
+ msg->_rrnum = -1;
+ msg->_msg_ptr = NULL;
+ } else {
+ msg->_rrnum = 0;
+ msg->_msg_ptr = msg->_sections[(int)sect];
+ }
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_print.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_print.c
new file mode 100644
index 0000000000..e70df376c1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_print.c
@@ -0,0 +1,1242 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_print.c,v 1.12 2009/03/03 05:29:58 each Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <isc/assertions.h>
+#include <isc/dst.h>
+#include <errno.h>
+#include <resolv_joy.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+/* Forward. */
+
+static size_t prune_origin(const char *name, const char *origin);
+static int charstr(const u_char *rdata, const u_char *edata,
+ char **buf, size_t *buflen);
+static int addname(const u_char *msg, size_t msglen,
+ const u_char **p, const char *origin,
+ char **buf, size_t *buflen);
+static void addlen(size_t len, char **buf, size_t *buflen);
+static int addstr(const char *src, size_t len,
+ char **buf, size_t *buflen);
+static int addtab(size_t len, size_t target, int spaced,
+ char **buf, size_t *buflen);
+
+/* Macros. */
+
+#define T(x) \
+ do { \
+ if ((x) < 0) \
+ return (-1); \
+ } while (0)
+
+static const char base32hex[] =
+ "0123456789ABCDEFGHIJKLMNOPQRSTUV=0123456789abcdefghijklmnopqrstuv";
+
+/* Public. */
+
+/*%
+ * Convert an RR to presentation format.
+ *
+ * return:
+ *\li Number of characters written to buf, or -1 (check errno).
+ */
+int
+ns_sprintrr(const ns_msg *handle, const ns_rr *rr,
+ const char *name_ctx, const char *origin,
+ char *buf, size_t buflen)
+{
+ int n;
+
+ n = ns_sprintrrf(ns_msg_base(*handle), ns_msg_size(*handle),
+ ns_rr_name(*rr), ns_rr_class(*rr), ns_rr_type(*rr),
+ ns_rr_ttl(*rr), ns_rr_rdata(*rr), ns_rr_rdlen(*rr),
+ name_ctx, origin, buf, buflen);
+ return (n);
+}
+
+/*%
+ * Convert the fields of an RR into presentation format.
+ *
+ * return:
+ *\li Number of characters written to buf, or -1 (check errno).
+ */
+int
+ns_sprintrrf(const u_char *msg, size_t msglen,
+ const char *name, ns_class class, ns_type type,
+ u_long ttl, const u_char *rdata, size_t rdlen,
+ const char *name_ctx, const char *origin,
+ char *buf, size_t buflen)
+{
+ const char *obuf = buf;
+ const u_char *edata = rdata + rdlen;
+ int spaced = 0;
+
+ const char *comment;
+ char tmp[100];
+ int len, x;
+
+ /*
+ * Owner.
+ */
+ if (name_ctx != NULL && ns_samename(name_ctx, name) == 1) {
+ T(addstr("\t\t\t", 3, &buf, &buflen));
+ } else {
+ len = prune_origin(name, origin);
+ if (*name == '\0') {
+ goto root;
+ } else if (len == 0) {
+ T(addstr("@\t\t\t", 4, &buf, &buflen));
+ } else {
+ T(addstr(name, len, &buf, &buflen));
+ /* Origin not used or not root, and no trailing dot? */
+ if (((origin == NULL || origin[0] == '\0') ||
+ (origin[0] != '.' && origin[1] != '\0' &&
+ name[len] == '\0')) && name[len - 1] != '.') {
+ root:
+ T(addstr(".", 1, &buf, &buflen));
+ len++;
+ }
+ T(spaced = addtab(len, 24, spaced, &buf, &buflen));
+ }
+ }
+
+ /*
+ * TTL, Class, Type.
+ */
+ T(x = ns_format_ttl(ttl, buf, buflen));
+ addlen(x, &buf, &buflen);
+ len = SPRINTF((tmp, " %s %s", p_class(class), p_type(type)));
+ T(addstr(tmp, len, &buf, &buflen));
+ T(spaced = addtab(x + len, 16, spaced, &buf, &buflen));
+
+ /*
+ * RData.
+ */
+ switch (type) {
+ case ns_t_a:
+ if (rdlen != (size_t)NS_INADDRSZ)
+ goto formerr;
+ (void) inet_ntop(AF_INET, rdata, buf, buflen);
+ addlen(strlen(buf), &buf, &buflen);
+ break;
+
+ case ns_t_cname:
+ case ns_t_mb:
+ case ns_t_mg:
+ case ns_t_mr:
+ case ns_t_ns:
+ case ns_t_ptr:
+ case ns_t_dname:
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ break;
+
+ case ns_t_hinfo:
+ case ns_t_isdn:
+ /* First word. */
+ T(len = charstr(rdata, edata, &buf, &buflen));
+ if (len == 0)
+ goto formerr;
+ rdata += len;
+ T(addstr(" ", 1, &buf, &buflen));
+
+
+ /* Second word, optional in ISDN records. */
+ if (type == ns_t_isdn && rdata == edata)
+ break;
+
+ T(len = charstr(rdata, edata, &buf, &buflen));
+ if (len == 0)
+ goto formerr;
+ rdata += len;
+ break;
+
+ case ns_t_soa: {
+ u_long t;
+
+ /* Server name. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Administrator name. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ T(addstr(" (\n", 3, &buf, &buflen));
+ spaced = 0;
+
+ if ((edata - rdata) != 5*NS_INT32SZ)
+ goto formerr;
+
+ /* Serial number. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
+ len = SPRINTF((tmp, "%lu", t));
+ T(addstr(tmp, len, &buf, &buflen));
+ T(spaced = addtab(len, 16, spaced, &buf, &buflen));
+ T(addstr("; serial\n", 9, &buf, &buflen));
+ spaced = 0;
+
+ /* Refresh interval. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
+ T(len = ns_format_ttl(t, buf, buflen));
+ addlen(len, &buf, &buflen);
+ T(spaced = addtab(len, 16, spaced, &buf, &buflen));
+ T(addstr("; refresh\n", 10, &buf, &buflen));
+ spaced = 0;
+
+ /* Retry interval. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
+ T(len = ns_format_ttl(t, buf, buflen));
+ addlen(len, &buf, &buflen);
+ T(spaced = addtab(len, 16, spaced, &buf, &buflen));
+ T(addstr("; retry\n", 8, &buf, &buflen));
+ spaced = 0;
+
+ /* Expiry. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
+ T(len = ns_format_ttl(t, buf, buflen));
+ addlen(len, &buf, &buflen);
+ T(spaced = addtab(len, 16, spaced, &buf, &buflen));
+ T(addstr("; expiry\n", 9, &buf, &buflen));
+ spaced = 0;
+
+ /* Minimum TTL. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
+ T(len = ns_format_ttl(t, buf, buflen));
+ addlen(len, &buf, &buflen);
+ T(addstr(" )", 2, &buf, &buflen));
+ T(spaced = addtab(len, 16, spaced, &buf, &buflen));
+ T(addstr("; minimum\n", 10, &buf, &buflen));
+
+ break;
+ }
+
+ case ns_t_mx:
+ case ns_t_afsdb:
+ case ns_t_rt:
+ case ns_t_kx: {
+ u_int t;
+
+ if (rdlen < (size_t)NS_INT16SZ)
+ goto formerr;
+
+ /* Priority. */
+ t = ns_get16(rdata);
+ rdata += NS_INT16SZ;
+ len = SPRINTF((tmp, "%u ", t));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Target. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+
+ break;
+ }
+
+ case ns_t_px: {
+ u_int t;
+
+ if (rdlen < (size_t)NS_INT16SZ)
+ goto formerr;
+
+ /* Priority. */
+ t = ns_get16(rdata);
+ rdata += NS_INT16SZ;
+ len = SPRINTF((tmp, "%u ", t));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Name1. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Name2. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+
+ break;
+ }
+
+ case ns_t_x25:
+ T(len = charstr(rdata, edata, &buf, &buflen));
+ if (len == 0)
+ goto formerr;
+ rdata += len;
+ break;
+
+ case ns_t_txt:
+ case ns_t_spf:
+ while (rdata < edata) {
+ T(len = charstr(rdata, edata, &buf, &buflen));
+ if (len == 0)
+ goto formerr;
+ rdata += len;
+ if (rdata < edata)
+ T(addstr(" ", 1, &buf, &buflen));
+ }
+ break;
+
+ case ns_t_nsap: {
+ char t[2+255*3];
+
+ (void) inet_nsap_ntoa(rdlen, rdata, t);
+ T(addstr(t, strlen(t), &buf, &buflen));
+ break;
+ }
+
+ case ns_t_aaaa:
+ if (rdlen != (size_t)NS_IN6ADDRSZ)
+ goto formerr;
+ (void) inet_ntop(AF_INET6, rdata, buf, buflen);
+ addlen(strlen(buf), &buf, &buflen);
+ break;
+
+ case ns_t_loc: {
+ char t[255];
+
+ /* XXX protocol format checking? */
+ (void) loc_ntoa(rdata, t);
+ T(addstr(t, strlen(t), &buf, &buflen));
+ break;
+ }
+
+ case ns_t_naptr: {
+ u_int order, preference;
+ char t[50];
+
+ if (rdlen < 2U*NS_INT16SZ)
+ goto formerr;
+
+ /* Order, Precedence. */
+ order = ns_get16(rdata); rdata += NS_INT16SZ;
+ preference = ns_get16(rdata); rdata += NS_INT16SZ;
+ len = SPRINTF((t, "%u %u ", order, preference));
+ T(addstr(t, len, &buf, &buflen));
+
+ /* Flags. */
+ T(len = charstr(rdata, edata, &buf, &buflen));
+ if (len == 0)
+ goto formerr;
+ rdata += len;
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Service. */
+ T(len = charstr(rdata, edata, &buf, &buflen));
+ if (len == 0)
+ goto formerr;
+ rdata += len;
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Regexp. */
+ T(len = charstr(rdata, edata, &buf, &buflen));
+ if (len < 0)
+ return (-1);
+ if (len == 0)
+ goto formerr;
+ rdata += len;
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Server. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ break;
+ }
+
+ case ns_t_srv: {
+ u_int priority, weight, port;
+ char t[50];
+
+ if (rdlen < 3U*NS_INT16SZ)
+ goto formerr;
+
+ /* Priority, Weight, Port. */
+ priority = ns_get16(rdata); rdata += NS_INT16SZ;
+ weight = ns_get16(rdata); rdata += NS_INT16SZ;
+ port = ns_get16(rdata); rdata += NS_INT16SZ;
+ len = SPRINTF((t, "%u %u %u ", priority, weight, port));
+ T(addstr(t, len, &buf, &buflen));
+
+ /* Server. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ break;
+ }
+
+ case ns_t_minfo:
+ case ns_t_rp:
+ /* Name1. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Name2. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+
+ break;
+
+ case ns_t_wks: {
+ int n, lcnt;
+
+ if (rdlen < 1U + NS_INT32SZ)
+ goto formerr;
+
+ /* Address. */
+ (void) inet_ntop(AF_INET, rdata, buf, buflen);
+ addlen(strlen(buf), &buf, &buflen);
+ rdata += NS_INADDRSZ;
+
+ /* Protocol. */
+ len = SPRINTF((tmp, " %u ( ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata += NS_INT8SZ;
+
+ /* Bit map. */
+ n = 0;
+ lcnt = 0;
+ while (rdata < edata) {
+ u_int c = *rdata++;
+ do {
+ if (c & 0200) {
+ if (lcnt == 0) {
+ T(addstr("\n\t\t\t\t", 5,
+ &buf, &buflen));
+ lcnt = 10;
+ spaced = 0;
+ }
+ len = SPRINTF((tmp, "%d ", n));
+ T(addstr(tmp, len, &buf, &buflen));
+ lcnt--;
+ }
+ c <<= 1;
+ } while (++n & 07);
+ }
+ T(addstr(")", 1, &buf, &buflen));
+
+ break;
+ }
+
+ case ns_t_key:
+ case ns_t_dnskey: {
+ char base64_key[NS_MD5RSA_MAX_BASE64];
+ u_int keyflags, protocol, algorithm, key_id;
+ const char *leader;
+ int n;
+
+ if (rdlen < 0U + NS_INT16SZ + NS_INT8SZ + NS_INT8SZ)
+ goto formerr;
+
+ /* Key flags, Protocol, Algorithm. */
+ key_id = dst_s_dns_key_id(rdata, edata-rdata);
+ keyflags = ns_get16(rdata); rdata += NS_INT16SZ;
+ protocol = *rdata++;
+ algorithm = *rdata++;
+ len = SPRINTF((tmp, "0x%04x %u %u",
+ keyflags, protocol, algorithm));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Public key data. */
+ len = b64_ntop(rdata, edata - rdata,
+ base64_key, sizeof base64_key);
+ if (len < 0)
+ goto formerr;
+ if (len > 15) {
+ T(addstr(" (", 2, &buf, &buflen));
+ leader = "\n\t\t";
+ spaced = 0;
+ } else
+ leader = " ";
+ for (n = 0; n < len; n += 48) {
+ T(addstr(leader, strlen(leader), &buf, &buflen));
+ T(addstr(base64_key + n, MIN(len - n, 48),
+ &buf, &buflen));
+ }
+ if (len > 15)
+ T(addstr(" )", 2, &buf, &buflen));
+ n = SPRINTF((tmp, " ; key_tag= %u", key_id));
+ T(addstr(tmp, n, &buf, &buflen));
+
+ break;
+ }
+
+ case ns_t_sig:
+ case ns_t_rrsig: {
+ char base64_key[NS_MD5RSA_MAX_BASE64];
+ u_int type, algorithm, labels, footprint;
+ const char *leader;
+ u_long t;
+ int n;
+
+ if (rdlen < 22U)
+ goto formerr;
+
+ /* Type covered, Algorithm, Label count, Original TTL. */
+ type = ns_get16(rdata); rdata += NS_INT16SZ;
+ algorithm = *rdata++;
+ labels = *rdata++;
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s %d %d %lu ",
+ p_type(type), algorithm, labels, t));
+ T(addstr(tmp, len, &buf, &buflen));
+ if (labels > (u_int)dn_count_labels(name))
+ goto formerr;
+
+ /* Signature expiry. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s ", p_secstodate(t)));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Time signed. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s ", p_secstodate(t)));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Signature Footprint. */
+ footprint = ns_get16(rdata); rdata += NS_INT16SZ;
+ len = SPRINTF((tmp, "%u ", footprint));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Signer's name. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+
+ /* Signature. */
+ len = b64_ntop(rdata, edata - rdata,
+ base64_key, sizeof base64_key);
+ if (len > 15) {
+ T(addstr(" (", 2, &buf, &buflen));
+ leader = "\n\t\t";
+ spaced = 0;
+ } else
+ leader = " ";
+ if (len < 0)
+ goto formerr;
+ for (n = 0; n < len; n += 48) {
+ T(addstr(leader, strlen(leader), &buf, &buflen));
+ T(addstr(base64_key + n, MIN(len - n, 48),
+ &buf, &buflen));
+ }
+ if (len > 15)
+ T(addstr(" )", 2, &buf, &buflen));
+ break;
+ }
+
+ case ns_t_nxt: {
+ int n, c;
+
+ /* Next domain name. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+
+ /* Type bit map. */
+ n = edata - rdata;
+ for (c = 0; c < n*8; c++)
+ if (NS_NXT_BIT_ISSET(c, rdata)) {
+ len = SPRINTF((tmp, " %s", p_type(c)));
+ T(addstr(tmp, len, &buf, &buflen));
+ }
+ break;
+ }
+
+ case ns_t_cert: {
+ u_int c_type, key_tag, alg;
+ int n;
+ unsigned int siz;
+ char base64_cert[8192], tmp[40];
+ const char *leader;
+
+ c_type = ns_get16(rdata); rdata += NS_INT16SZ;
+ key_tag = ns_get16(rdata); rdata += NS_INT16SZ;
+ alg = (u_int) *rdata++;
+
+ len = SPRINTF((tmp, "%d %d %d ", c_type, key_tag, alg));
+ T(addstr(tmp, len, &buf, &buflen));
+ siz = (edata-rdata)*4/3 + 4; /* "+4" accounts for trailing \0 */
+ if (siz > sizeof(base64_cert) * 3/4) {
+ const char *str = "record too long to print";
+ T(addstr(str, strlen(str), &buf, &buflen));
+ }
+ else {
+ len = b64_ntop(rdata, edata-rdata, base64_cert, siz);
+
+ if (len < 0)
+ goto formerr;
+ else if (len > 15) {
+ T(addstr(" (", 2, &buf, &buflen));
+ leader = "\n\t\t";
+ spaced = 0;
+ }
+ else
+ leader = " ";
+
+ for (n = 0; n < len; n += 48) {
+ T(addstr(leader, strlen(leader),
+ &buf, &buflen));
+ T(addstr(base64_cert + n, MIN(len - n, 48),
+ &buf, &buflen));
+ }
+ if (len > 15)
+ T(addstr(" )", 2, &buf, &buflen));
+ }
+ break;
+ }
+
+ case ns_t_tkey: {
+ /* KJD - need to complete this */
+ u_long t;
+ int mode, err, keysize;
+
+ /* Algorithm name. */
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ T(addstr(" ", 1, &buf, &buflen));
+
+ /* Inception. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s ", p_secstodate(t)));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Experation. */
+ t = ns_get32(rdata); rdata += NS_INT32SZ;
+ len = SPRINTF((tmp, "%s ", p_secstodate(t)));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* Mode , Error, Key Size. */
+ /* Priority, Weight, Port. */
+ mode = ns_get16(rdata); rdata += NS_INT16SZ;
+ err = ns_get16(rdata); rdata += NS_INT16SZ;
+ keysize = ns_get16(rdata); rdata += NS_INT16SZ;
+ len = SPRINTF((tmp, "%u %u %u ", mode, err, keysize));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ /* XXX need to dump key, print otherdata length & other data */
+ break;
+ }
+
+ case ns_t_tsig: {
+ /* BEW - need to complete this */
+ int n;
+
+ T(len = addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ T(addstr(" ", 1, &buf, &buflen));
+ rdata += 8; /*%< time */
+ n = ns_get16(rdata); rdata += INT16SZ;
+ rdata += n; /*%< sig */
+ n = ns_get16(rdata); rdata += INT16SZ; /*%< original id */
+ sprintf(buf, "%d", ns_get16(rdata));
+ rdata += INT16SZ;
+ addlen(strlen(buf), &buf, &buflen);
+ break;
+ }
+
+ case ns_t_a6: {
+ struct in6_addr a;
+ int pbyte, pbit;
+
+ /* prefix length */
+ if (rdlen == 0U) goto formerr;
+ len = SPRINTF((tmp, "%d ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ pbit = *rdata;
+ if (pbit > 128) goto formerr;
+ pbyte = (pbit & ~7) / 8;
+ rdata++;
+
+ /* address suffix: provided only when prefix len != 128 */
+ if (pbit < 128) {
+ if (rdata + pbyte >= edata) goto formerr;
+ memset(&a, 0, sizeof(a));
+ memcpy(&a.s6_addr[pbyte], rdata, sizeof(a) - pbyte);
+ (void) inet_ntop(AF_INET6, &a, buf, buflen);
+ addlen(strlen(buf), &buf, &buflen);
+ rdata += sizeof(a) - pbyte;
+ }
+
+ /* prefix name: provided only when prefix len > 0 */
+ if (pbit == 0)
+ break;
+ if (rdata >= edata) goto formerr;
+ T(addstr(" ", 1, &buf, &buflen));
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+
+ break;
+ }
+
+ case ns_t_opt: {
+ len = SPRINTF((tmp, "%u bytes", class));
+ T(addstr(tmp, len, &buf, &buflen));
+ break;
+ }
+
+ case ns_t_ds:
+ case ns_t_dlv:
+ case ns_t_sshfp: {
+ u_int t;
+
+ if (type == ns_t_ds || type == ns_t_dlv) {
+ if (rdlen < 4U) goto formerr;
+ t = ns_get16(rdata);
+ rdata += NS_INT16SZ;
+ len = SPRINTF((tmp, "%u ", t));
+ T(addstr(tmp, len, &buf, &buflen));
+ } else
+ if (rdlen < 2U) goto formerr;
+
+ len = SPRINTF((tmp, "%u ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+
+ len = SPRINTF((tmp, "%u ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+
+ while (rdata < edata) {
+ len = SPRINTF((tmp, "%02X", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+ }
+ break;
+ }
+
+ case ns_t_nsec3:
+ case ns_t_nsec3param: {
+ u_int t, w, l, j, k, c;
+
+ len = SPRINTF((tmp, "%u ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+
+ len = SPRINTF((tmp, "%u ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+
+ t = ns_get16(rdata);
+ rdata += NS_INT16SZ;
+ len = SPRINTF((tmp, "%u ", t));
+ T(addstr(tmp, len, &buf, &buflen));
+
+ t = *rdata++;
+ if (t == 0) {
+ T(addstr("-", 1, &buf, &buflen));
+ } else {
+ while (t-- > 0) {
+ len = SPRINTF((tmp, "%02X", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+ }
+ }
+ if (type == ns_t_nsec3param)
+ break;
+ T(addstr(" ", 1, &buf, &buflen));
+
+ t = *rdata++;
+ while (t > 0) {
+ switch (t) {
+ case 1:
+ tmp[0] = base32hex[((rdata[0]>>3)&0x1f)];
+ tmp[1] = base32hex[((rdata[0]<<2)&0x1c)];
+ tmp[2] = tmp[3] = tmp[4] = '=';
+ tmp[5] = tmp[6] = tmp[7] = '=';
+ break;
+ case 2:
+ tmp[0] = base32hex[((rdata[0]>>3)&0x1f)];
+ tmp[1] = base32hex[((rdata[0]<<2)&0x1c)|
+ ((rdata[1]>>6)&0x03)];
+ tmp[2] = base32hex[((rdata[1]>>1)&0x1f)];
+ tmp[3] = base32hex[((rdata[1]<<4)&0x10)];
+ tmp[4] = tmp[5] = tmp[6] = tmp[7] = '=';
+ break;
+ case 3:
+ tmp[0] = base32hex[((rdata[0]>>3)&0x1f)];
+ tmp[1] = base32hex[((rdata[0]<<2)&0x1c)|
+ ((rdata[1]>>6)&0x03)];
+ tmp[2] = base32hex[((rdata[1]>>1)&0x1f)];
+ tmp[3] = base32hex[((rdata[1]<<4)&0x10)|
+ ((rdata[2]>>4)&0x0f)];
+ tmp[4] = base32hex[((rdata[2]<<1)&0x1e)];
+ tmp[5] = tmp[6] = tmp[7] = '=';
+ break;
+ case 4:
+ tmp[0] = base32hex[((rdata[0]>>3)&0x1f)];
+ tmp[1] = base32hex[((rdata[0]<<2)&0x1c)|
+ ((rdata[1]>>6)&0x03)];
+ tmp[2] = base32hex[((rdata[1]>>1)&0x1f)];
+ tmp[3] = base32hex[((rdata[1]<<4)&0x10)|
+ ((rdata[2]>>4)&0x0f)];
+ tmp[4] = base32hex[((rdata[2]<<1)&0x1e)|
+ ((rdata[3]>>7)&0x01)];
+ tmp[5] = base32hex[((rdata[3]>>2)&0x1f)];
+ tmp[6] = base32hex[(rdata[3]<<3)&0x18];
+ tmp[7] = '=';
+ break;
+ default:
+ tmp[0] = base32hex[((rdata[0]>>3)&0x1f)];
+ tmp[1] = base32hex[((rdata[0]<<2)&0x1c)|
+ ((rdata[1]>>6)&0x03)];
+ tmp[2] = base32hex[((rdata[1]>>1)&0x1f)];
+ tmp[3] = base32hex[((rdata[1]<<4)&0x10)|
+ ((rdata[2]>>4)&0x0f)];
+ tmp[4] = base32hex[((rdata[2]<<1)&0x1e)|
+ ((rdata[3]>>7)&0x01)];
+ tmp[5] = base32hex[((rdata[3]>>2)&0x1f)];
+ tmp[6] = base32hex[((rdata[3]<<3)&0x18)|
+ ((rdata[4]>>5)&0x07)];
+ tmp[7] = base32hex[(rdata[4]&0x1f)];
+ break;
+ }
+ T(addstr(tmp, 8, &buf, &buflen));
+ if (t >= 5) {
+ rdata += 5;
+ t -= 5;
+ } else {
+ rdata += t;
+ t -= t;
+ }
+ }
+
+ while (rdata < edata) {
+ w = *rdata++;
+ l = *rdata++;
+ for (j = 0; j < l; j++) {
+ if (rdata[j] == 0)
+ continue;
+ for (k = 0; k < 8; k++) {
+ if ((rdata[j] & (0x80 >> k)) == 0)
+ continue;
+ c = w * 256 + j * 8 + k;
+ len = SPRINTF((tmp, " %s", p_type(c)));
+ T(addstr(tmp, len, &buf, &buflen));
+ }
+ }
+ rdata += l;
+ }
+ break;
+ }
+
+ case ns_t_nsec: {
+ u_int w, l, j, k, c;
+
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+
+ while (rdata < edata) {
+ w = *rdata++;
+ l = *rdata++;
+ for (j = 0; j < l; j++) {
+ if (rdata[j] == 0)
+ continue;
+ for (k = 0; k < 8; k++) {
+ if ((rdata[j] & (0x80 >> k)) == 0)
+ continue;
+ c = w * 256 + j * 8 + k;
+ len = SPRINTF((tmp, " %s", p_type(c)));
+ T(addstr(tmp, len, &buf, &buflen));
+ }
+ }
+ rdata += l;
+ }
+ break;
+ }
+
+ case ns_t_dhcid: {
+ int n;
+ unsigned int siz;
+ char base64_dhcid[8192];
+ const char *leader;
+
+ siz = (edata-rdata)*4/3 + 4; /* "+4" accounts for trailing \0 */
+ if (siz > sizeof(base64_dhcid) * 3/4) {
+ const char *str = "record too long to print";
+ T(addstr(str, strlen(str), &buf, &buflen));
+ } else {
+ len = b64_ntop(rdata, edata-rdata, base64_dhcid, siz);
+
+ if (len < 0)
+ goto formerr;
+
+ else if (len > 15) {
+ T(addstr(" (", 2, &buf, &buflen));
+ leader = "\n\t\t";
+ spaced = 0;
+ }
+ else
+ leader = " ";
+
+ for (n = 0; n < len; n += 48) {
+ T(addstr(leader, strlen(leader),
+ &buf, &buflen));
+ T(addstr(base64_dhcid + n, MIN(len - n, 48),
+ &buf, &buflen));
+ }
+ if (len > 15)
+ T(addstr(" )", 2, &buf, &buflen));
+ }
+ }
+
+ case ns_t_ipseckey: {
+ int n;
+ unsigned int siz;
+ char base64_key[8192];
+ const char *leader;
+
+ if (rdlen < 2)
+ goto formerr;
+
+ switch (rdata[1]) {
+ case 0:
+ case 3:
+ if (rdlen < 3)
+ goto formerr;
+ break;
+ case 1:
+ if (rdlen < 7)
+ goto formerr;
+ break;
+ case 2:
+ if (rdlen < 19)
+ goto formerr;
+ break;
+ default:
+ comment = "unknown IPSECKEY gateway type";
+ goto hexify;
+ }
+
+ len = SPRINTF((tmp, "%u ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+
+ len = SPRINTF((tmp, "%u ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+
+ len = SPRINTF((tmp, "%u ", *rdata));
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+
+ switch (rdata[-2]) {
+ case 0:
+ T(addstr(".", 1, &buf, &buflen));
+ break;
+ case 1:
+ (void) inet_ntop(AF_INET, rdata, buf, buflen);
+ addlen(strlen(buf), &buf, &buflen);
+ rdata += 4;
+ break;
+ case 2:
+ (void) inet_ntop(AF_INET6, rdata, buf, buflen);
+ addlen(strlen(buf), &buf, &buflen);
+ rdata += 16;
+ break;
+ case 3:
+ T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
+ break;
+ }
+
+ if (rdata >= edata)
+ break;
+
+ siz = (edata-rdata)*4/3 + 4; /* "+4" accounts for trailing \0 */
+ if (siz > sizeof(base64_key) * 3/4) {
+ const char *str = "record too long to print";
+ T(addstr(str, strlen(str), &buf, &buflen));
+ } else {
+ len = b64_ntop(rdata, edata-rdata, base64_key, siz);
+
+ if (len < 0)
+ goto formerr;
+
+ else if (len > 15) {
+ T(addstr(" (", 2, &buf, &buflen));
+ leader = "\n\t\t";
+ spaced = 0;
+ }
+ else
+ leader = " ";
+
+ for (n = 0; n < len; n += 48) {
+ T(addstr(leader, strlen(leader),
+ &buf, &buflen));
+ T(addstr(base64_key + n, MIN(len - n, 48),
+ &buf, &buflen));
+ }
+ if (len > 15)
+ T(addstr(" )", 2, &buf, &buflen));
+ }
+ }
+
+ case ns_t_hip: {
+ unsigned int i, hip_len, algorithm, key_len;
+ char base64_key[NS_MD5RSA_MAX_BASE64];
+ unsigned int siz;
+ const char *leader = "\n\t\t\t\t\t";
+
+ hip_len = *rdata++;
+ algorithm = *rdata++;
+ key_len = ns_get16(rdata);
+ rdata += NS_INT16SZ;
+
+ siz = key_len*4/3 + 4; /* "+4" accounts for trailing \0 */
+ if (siz > sizeof(base64_key) * 3/4) {
+ const char *str = "record too long to print";
+ T(addstr(str, strlen(str), &buf, &buflen));
+ } else {
+ len = sprintf(tmp, "( %u ", algorithm);
+ T(addstr(tmp, len, &buf, &buflen));
+
+ for (i = 0; i < hip_len; i++) {
+ len = sprintf(tmp, "%02X", *rdata);
+ T(addstr(tmp, len, &buf, &buflen));
+ rdata++;
+ }
+ T(addstr(leader, strlen(leader), &buf, &buflen));
+
+ len = b64_ntop(rdata, key_len, base64_key, siz);
+ if (len < 0)
+ goto formerr;
+
+ T(addstr(base64_key, len, &buf, &buflen));
+
+ rdata += key_len;
+ while (rdata < edata) {
+ T(addstr(leader, strlen(leader), &buf, &buflen));
+ T(addname(msg, msglen, &rdata, origin,
+ &buf, &buflen));
+ }
+ T(addstr(" )", 2, &buf, &buflen));
+ }
+ break;
+ }
+
+ default:
+ comment = "unknown RR type";
+ goto hexify;
+ }
+ return (buf - obuf);
+ formerr:
+ comment = "RR format error";
+ hexify: {
+ int n, m;
+ char *p;
+
+ len = SPRINTF((tmp, "\\# %u%s\t; %s", (unsigned)(edata - rdata),
+ rdlen != 0U ? " (" : "", comment));
+ T(addstr(tmp, len, &buf, &buflen));
+ while (rdata < edata) {
+ p = tmp;
+ p += SPRINTF((p, "\n\t"));
+ spaced = 0;
+ n = MIN(16, edata - rdata);
+ for (m = 0; m < n; m++)
+ p += SPRINTF((p, "%02x ", rdata[m]));
+ T(addstr(tmp, p - tmp, &buf, &buflen));
+ if (n < 16) {
+ T(addstr(")", 1, &buf, &buflen));
+ T(addtab(p - tmp + 1, 48, spaced, &buf, &buflen));
+ }
+ p = tmp;
+ p += SPRINTF((p, "; "));
+ for (m = 0; m < n; m++)
+ *p++ = (isascii(rdata[m]) && isprint(rdata[m]))
+ ? rdata[m]
+ : '.';
+ T(addstr(tmp, p - tmp, &buf, &buflen));
+ rdata += n;
+ }
+ return (buf - obuf);
+ }
+}
+
+/* Private. */
+
+/*%
+ * size_t
+ * prune_origin(name, origin)
+ * Find out if the name is at or under the current origin.
+ * return:
+ * Number of characters in name before start of origin,
+ * or length of name if origin does not match.
+ * notes:
+ * This function should share code with samedomain().
+ */
+static size_t
+prune_origin(const char *name, const char *origin) {
+ const char *oname = name;
+
+ while (*name != '\0') {
+ if (origin != NULL && ns_samename(name, origin) == 1)
+ return (name - oname - (name > oname));
+ while (*name != '\0') {
+ if (*name == '\\') {
+ name++;
+ /* XXX need to handle \nnn form. */
+ if (*name == '\0')
+ break;
+ } else if (*name == '.') {
+ name++;
+ break;
+ }
+ name++;
+ }
+ }
+ return (name - oname);
+}
+
+/*%
+ * int
+ * charstr(rdata, edata, buf, buflen)
+ * Format a <character-string> into the presentation buffer.
+ * return:
+ * Number of rdata octets consumed
+ * 0 for protocol format error
+ * -1 for output buffer error
+ * side effects:
+ * buffer is advanced on success.
+ */
+static int
+charstr(const u_char *rdata, const u_char *edata, char **buf, size_t *buflen) {
+ const u_char *odata = rdata;
+ size_t save_buflen = *buflen;
+ char *save_buf = *buf;
+
+ if (addstr("\"", 1, buf, buflen) < 0)
+ goto enospc;
+ if (rdata < edata) {
+ int n = *rdata;
+
+ if (rdata + 1 + n <= edata) {
+ rdata++;
+ while (n-- > 0) {
+ if (strchr("\n\"\\", *rdata) != NULL)
+ if (addstr("\\", 1, buf, buflen) < 0)
+ goto enospc;
+ if (addstr((const char *)rdata, 1,
+ buf, buflen) < 0)
+ goto enospc;
+ rdata++;
+ }
+ }
+ }
+ if (addstr("\"", 1, buf, buflen) < 0)
+ goto enospc;
+ return (rdata - odata);
+ enospc:
+ errno = ENOSPC;
+ *buf = save_buf;
+ *buflen = save_buflen;
+ return (-1);
+}
+
+static int
+addname(const u_char *msg, size_t msglen,
+ const u_char **pp, const char *origin,
+ char **buf, size_t *buflen)
+{
+ size_t newlen, save_buflen = *buflen;
+ char *save_buf = *buf;
+ int n;
+
+ n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen);
+ if (n < 0)
+ goto enospc; /*%< Guess. */
+ newlen = prune_origin(*buf, origin);
+ if (**buf == '\0') {
+ goto root;
+ } else if (newlen == 0U) {
+ /* Use "@" instead of name. */
+ if (newlen + 2 > *buflen)
+ goto enospc; /* No room for "@\0". */
+ (*buf)[newlen++] = '@';
+ (*buf)[newlen] = '\0';
+ } else {
+ if (((origin == NULL || origin[0] == '\0') ||
+ (origin[0] != '.' && origin[1] != '\0' &&
+ (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') {
+ /* No trailing dot. */
+ root:
+ if (newlen + 2 > *buflen)
+ goto enospc; /* No room for ".\0". */
+ (*buf)[newlen++] = '.';
+ (*buf)[newlen] = '\0';
+ }
+ }
+ *pp += n;
+ addlen(newlen, buf, buflen);
+ **buf = '\0';
+ return (newlen);
+ enospc:
+ errno = ENOSPC;
+ *buf = save_buf;
+ *buflen = save_buflen;
+ return (-1);
+}
+
+static void
+addlen(size_t len, char **buf, size_t *buflen) {
+ INSIST(len <= *buflen);
+ *buf += len;
+ *buflen -= len;
+}
+
+static int
+addstr(const char *src, size_t len, char **buf, size_t *buflen) {
+ if (len >= *buflen) {
+ errno = ENOSPC;
+ return (-1);
+ }
+ memcpy(*buf, src, len);
+ addlen(len, buf, buflen);
+ **buf = '\0';
+ return (0);
+}
+
+static int
+addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) {
+ size_t save_buflen = *buflen;
+ char *save_buf = *buf;
+ int t;
+
+ if (spaced || len >= target - 1) {
+ T(addstr(" ", 2, buf, buflen));
+ spaced = 1;
+ } else {
+ for (t = (target - len - 1) / 8; t >= 0; t--)
+ if (addstr("\t", 1, buf, buflen) < 0) {
+ *buflen = save_buflen;
+ *buf = save_buf;
+ return (-1);
+ }
+ spaced = 0;
+ }
+ return (spaced);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_rdata.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_rdata.c
new file mode 100644
index 0000000000..eac4052278
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_rdata.c
@@ -0,0 +1,300 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_rdata.c,v 1.2 2009/01/23 23:49:15 tbox Exp $";
+#endif
+
+#include "port_before.h"
+
+#if __OpenBSD__
+#include <sys/types.h>
+#endif
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <resolv_joy.h>
+#include <string.h>
+
+#include "port_after.h"
+
+#define CONSUME_SRC \
+ do { \
+ rdata += n, rdlen -= n; \
+ } while (0)
+
+#define CONSUME_DST \
+ do { \
+ nrdata += n, nrdsiz -= n, nrdlen += n; \
+ } while (0)
+
+#define UNPACK_DNAME \
+ do { \
+ size_t t; \
+ \
+ if ((n = ns_name_unpack2(msg,eom,rdata,nrdata,nrdsiz,&t))<0) {\
+ errno = EMSGSIZE; \
+ return (-1); \
+ } \
+ CONSUME_SRC; \
+ n = t; \
+ CONSUME_DST; \
+ } while (0)
+
+#define UNPACK_SOME(x) \
+ do { \
+ n = (x); \
+ if ((size_t)n > rdlen || (size_t)n > nrdsiz) { \
+ errno = EMSGSIZE; \
+ return (-1); \
+ } \
+ memcpy(nrdata, rdata, n); \
+ CONSUME_SRC; CONSUME_DST; \
+ } while (0)
+
+#define UNPACK_REST(x) \
+ do { \
+ n = (x); \
+ if ((size_t)n != rdlen) { \
+ errno = EMSGSIZE; \
+ return (-1); \
+ } \
+ memcpy(nrdata, rdata, n); \
+ CONSUME_SRC; CONSUME_DST; \
+ } while (0)
+
+ssize_t
+ns_rdata_unpack(const u_char *msg, const u_char *eom,
+ ns_type type, const u_char *rdata, size_t rdlen,
+ u_char *nrdata, size_t nrdsiz)
+{
+ size_t nrdlen = 0;
+ int n;
+
+ switch (type) {
+ case ns_t_a:
+ UNPACK_REST(NS_INADDRSZ);
+ break;
+ case ns_t_aaaa:
+ UNPACK_REST(NS_IN6ADDRSZ);
+ break;
+ case ns_t_cname:
+ case ns_t_mb:
+ case ns_t_mg:
+ case ns_t_mr:
+ case ns_t_ns:
+ case ns_t_ptr:
+ case ns_t_dname:
+ UNPACK_DNAME;
+ break;
+ case ns_t_soa:
+ UNPACK_DNAME;
+ UNPACK_DNAME;
+ UNPACK_SOME(NS_INT32SZ * 5);
+ break;
+ case ns_t_mx:
+ case ns_t_afsdb:
+ case ns_t_rt:
+ UNPACK_SOME(NS_INT16SZ);
+ UNPACK_DNAME;
+ break;
+ case ns_t_px:
+ UNPACK_SOME(NS_INT16SZ);
+ UNPACK_DNAME;
+ UNPACK_DNAME;
+ break;
+ case ns_t_srv:
+ UNPACK_SOME(NS_INT16SZ * 3);
+ UNPACK_DNAME;
+ break;
+ case ns_t_minfo:
+ case ns_t_rp:
+ UNPACK_DNAME;
+ UNPACK_DNAME;
+ break;
+ default:
+ UNPACK_SOME(rdlen);
+ break;
+ }
+ if (rdlen > 0) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ return (nrdlen);
+}
+
+#define EQUAL_CONSUME \
+ do { \
+ rdata1 += n, rdlen1 -= n; \
+ rdata2 += n, rdlen2 -= n; \
+ } while (0)
+
+#define EQUAL_DNAME \
+ do { \
+ ssize_t n; \
+ \
+ if (rdlen1 != rdlen2) \
+ return (0); \
+ n = ns_name_eq(rdata1, rdlen1, rdata2, rdlen2); \
+ if (n <= 0) \
+ return (n); \
+ n = rdlen1; \
+ EQUAL_CONSUME; \
+ } while (0)
+
+#define EQUAL_SOME(x) \
+ do { \
+ size_t n = (x); \
+ \
+ if (n > rdlen1 || n > rdlen2) { \
+ errno = EMSGSIZE; \
+ return (-1); \
+ } \
+ if (memcmp(rdata1, rdata2, n) != 0) \
+ return (0); \
+ EQUAL_CONSUME; \
+ } while (0)
+
+int
+ns_rdata_equal(ns_type type,
+ const u_char *rdata1, size_t rdlen1,
+ const u_char *rdata2, size_t rdlen2)
+{
+ switch (type) {
+ case ns_t_cname:
+ case ns_t_mb:
+ case ns_t_mg:
+ case ns_t_mr:
+ case ns_t_ns:
+ case ns_t_ptr:
+ case ns_t_dname:
+ EQUAL_DNAME;
+ break;
+ case ns_t_soa:
+ /* "There can be only one." --Highlander */
+ break;
+ case ns_t_mx:
+ case ns_t_afsdb:
+ case ns_t_rt:
+ EQUAL_SOME(NS_INT16SZ);
+ EQUAL_DNAME;
+ break;
+ case ns_t_px:
+ EQUAL_SOME(NS_INT16SZ);
+ EQUAL_DNAME;
+ EQUAL_DNAME;
+ break;
+ case ns_t_srv:
+ EQUAL_SOME(NS_INT16SZ * 3);
+ EQUAL_DNAME;
+ break;
+ case ns_t_minfo:
+ case ns_t_rp:
+ EQUAL_DNAME;
+ EQUAL_DNAME;
+ break;
+ default:
+ EQUAL_SOME(rdlen1);
+ break;
+ }
+ if (rdlen1 != 0 || rdlen2 != 0)
+ return (0);
+ return (1);
+}
+
+#define REFERS_DNAME \
+ do { \
+ int n; \
+ \
+ n = ns_name_eq(rdata, rdlen, nname, NS_MAXNNAME); \
+ if (n < 0) \
+ return (-1); \
+ if (n > 0) \
+ return (1); \
+ n = dn_skipname(rdata, rdata + rdlen); \
+ if (n < 0) \
+ return (-1); \
+ CONSUME_SRC; \
+ } while (0)
+
+#define REFERS_SOME(x) \
+ do { \
+ size_t n = (x); \
+ \
+ if (n > rdlen) { \
+ errno = EMSGSIZE; \
+ return (-1); \
+ } \
+ CONSUME_SRC; \
+ } while (0)
+
+int
+ns_rdata_refers(ns_type type,
+ const u_char *rdata, size_t rdlen,
+ const u_char *nname)
+{
+ switch (type) {
+ case ns_t_cname:
+ case ns_t_mb:
+ case ns_t_mg:
+ case ns_t_mr:
+ case ns_t_ns:
+ case ns_t_ptr:
+ case ns_t_dname:
+ REFERS_DNAME;
+ break;
+ case ns_t_soa:
+ REFERS_DNAME;
+ REFERS_DNAME;
+ REFERS_SOME(NS_INT32SZ * 5);
+ break;
+ case ns_t_mx:
+ case ns_t_afsdb:
+ case ns_t_rt:
+ REFERS_SOME(NS_INT16SZ);
+ REFERS_DNAME;
+ break;
+ case ns_t_px:
+ REFERS_SOME(NS_INT16SZ);
+ REFERS_DNAME;
+ REFERS_DNAME;
+ break;
+ case ns_t_srv:
+ REFERS_SOME(NS_INT16SZ * 3);
+ REFERS_DNAME;
+ break;
+ case ns_t_minfo:
+ case ns_t_rp:
+ REFERS_DNAME;
+ REFERS_DNAME;
+ break;
+ default:
+ REFERS_SOME(rdlen);
+ break;
+ }
+ if (rdlen != 0) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ return (0);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_samedomain.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_samedomain.c
new file mode 100644
index 0000000000..5e9f5cab54
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_samedomain.c
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_samedomain.c,v 1.6 2005/04/27 04:56:40 sra Exp $";
+#endif
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <arpa/nameser.h>
+#include <errno.h>
+#include <string.h>
+
+#include "port_after.h"
+
+/*%
+ * Check whether a name belongs to a domain.
+ *
+ * Inputs:
+ *\li a - the domain whose ancestory is being verified
+ *\li b - the potential ancestor we're checking against
+ *
+ * Return:
+ *\li boolean - is a at or below b?
+ *
+ * Notes:
+ *\li Trailing dots are first removed from name and domain.
+ * Always compare complete subdomains, not only whether the
+ * domain name is the trailing string of the given name.
+ *
+ *\li "host.foobar.top" lies in "foobar.top" and in "top" and in ""
+ * but NOT in "bar.top"
+ */
+
+int
+ns_samedomain(const char *a, const char *b) {
+ size_t la, lb;
+ int diff, i, escaped;
+ const char *cp;
+
+ la = strlen(a);
+ lb = strlen(b);
+
+ /* Ignore a trailing label separator (i.e. an unescaped dot) in 'a'. */
+ if (la != 0U && a[la - 1] == '.') {
+ escaped = 0;
+ /* Note this loop doesn't get executed if la==1. */
+ for (i = la - 2; i >= 0; i--)
+ if (a[i] == '\\') {
+ if (escaped)
+ escaped = 0;
+ else
+ escaped = 1;
+ } else
+ break;
+ if (!escaped)
+ la--;
+ }
+
+ /* Ignore a trailing label separator (i.e. an unescaped dot) in 'b'. */
+ if (lb != 0U && b[lb - 1] == '.') {
+ escaped = 0;
+ /* note this loop doesn't get executed if lb==1 */
+ for (i = lb - 2; i >= 0; i--)
+ if (b[i] == '\\') {
+ if (escaped)
+ escaped = 0;
+ else
+ escaped = 1;
+ } else
+ break;
+ if (!escaped)
+ lb--;
+ }
+
+ /* lb == 0 means 'b' is the root domain, so 'a' must be in 'b'. */
+ if (lb == 0U)
+ return (1);
+
+ /* 'b' longer than 'a' means 'a' can't be in 'b'. */
+ if (lb > la)
+ return (0);
+
+ /* 'a' and 'b' being equal at this point indicates sameness. */
+ if (lb == la)
+ return (strncasecmp(a, b, lb) == 0);
+
+ /* Ok, we know la > lb. */
+
+ diff = la - lb;
+
+ /*
+ * If 'a' is only 1 character longer than 'b', then it can't be
+ * a subdomain of 'b' (because of the need for the '.' label
+ * separator).
+ */
+ if (diff < 2)
+ return (0);
+
+ /*
+ * If the character before the last 'lb' characters of 'b'
+ * isn't '.', then it can't be a match (this lets us avoid
+ * having "foobar.com" match "bar.com").
+ */
+ if (a[diff - 1] != '.')
+ return (0);
+
+ /*
+ * We're not sure about that '.', however. It could be escaped
+ * and thus not a really a label separator.
+ */
+ escaped = 0;
+ for (i = diff - 2; i >= 0; i--)
+ if (a[i] == '\\') {
+ if (escaped)
+ escaped = 0;
+ else
+ escaped = 1;
+ } else
+ break;
+ if (escaped)
+ return (0);
+
+ /* Now compare aligned trailing substring. */
+ cp = a + diff;
+ return (strncasecmp(cp, b, lb) == 0);
+}
+
+/*%
+ * is "a" a subdomain of "b"?
+ */
+int
+ns_subdomain(const char *a, const char *b) {
+ return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
+}
+
+/*%
+ * make a canonical copy of domain name "src"
+ *
+ * notes:
+ * \code
+ * foo -> foo.
+ * foo. -> foo.
+ * foo.. -> foo.
+ * foo\. -> foo\..
+ * foo\\. -> foo\\.
+ * \endcode
+ */
+
+int
+ns_makecanon(const char *src, char *dst, size_t dstsize) {
+ size_t n = strlen(src);
+
+ if (n + sizeof "." > dstsize) { /*%< Note: sizeof == 2 */
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ strcpy(dst, src);
+ while (n >= 1U && dst[n - 1] == '.') /*%< Ends in "." */
+ if (n >= 2U && dst[n - 2] == '\\' && /*%< Ends in "\." */
+ (n < 3U || dst[n - 3] != '\\')) /*%< But not "\\." */
+ break;
+ else
+ dst[--n] = '\0';
+ dst[n++] = '.';
+ dst[n] = '\0';
+ return (0);
+}
+
+/*%
+ * determine whether domain name "a" is the same as domain name "b"
+ *
+ * return:
+ *\li -1 on error
+ *\li 0 if names differ
+ *\li 1 if names are the same
+ */
+
+int
+ns_samename(const char *a, const char *b) {
+ char ta[NS_MAXDNAME], tb[NS_MAXDNAME];
+
+ if (ns_makecanon(a, ta, sizeof ta) < 0 ||
+ ns_makecanon(b, tb, sizeof tb) < 0)
+ return (-1);
+ if (strcasecmp(ta, tb) == 0)
+ return (1);
+ else
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_sign.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_sign.c
new file mode 100644
index 0000000000..fc7dd19f7b
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_sign.c
@@ -0,0 +1,387 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_sign.c,v 1.6 2006/03/09 23:57:56 marka Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <isc/dst.h>
+#include <isc/assertions.h>
+
+#include "port_after.h"
+
+#define BOUNDS_CHECK(ptr, count) \
+ do { \
+ if ((ptr) + (count) > eob) { \
+ errno = EMSGSIZE; \
+ return(NS_TSIG_ERROR_NO_SPACE); \
+ } \
+ } while (0)
+
+/*%
+ * ns_sign
+ *
+ * Parameters:
+ *\li msg message to be sent
+ *\li msglen input - length of message
+ * output - length of signed message
+ *\li msgsize length of buffer containing message
+ *\li error value to put in the error field
+ *\li key tsig key used for signing
+ *\li querysig (response), the signature in the query
+ *\li querysiglen (response), the length of the signature in the query
+ *\li sig a buffer to hold the generated signature
+ *\li siglen input - length of signature buffer
+ * output - length of signature
+ *
+ * Errors:
+ *\li - bad input data (-1)
+ *\li - bad key / sign failed (-BADKEY)
+ *\li - not enough space (NS_TSIG_ERROR_NO_SPACE)
+ */
+int
+ns_sign(u_char *msg, int *msglen, int msgsize, int error, void *k,
+ const u_char *querysig, int querysiglen, u_char *sig, int *siglen,
+ time_t in_timesigned)
+{
+ return(ns_sign2(msg, msglen, msgsize, error, k,
+ querysig, querysiglen, sig, siglen,
+ in_timesigned, NULL, NULL));
+}
+
+int
+ns_sign2(u_char *msg, int *msglen, int msgsize, int error, void *k,
+ const u_char *querysig, int querysiglen, u_char *sig, int *siglen,
+ time_t in_timesigned, u_char **dnptrs, u_char **lastdnptr)
+{
+ HEADER *hp = (HEADER *)msg;
+ DST_KEY *key = (DST_KEY *)k;
+ u_char *cp, *eob;
+ u_char *lenp;
+ u_char *alg;
+ int n;
+ time_t timesigned;
+ u_char name[NS_MAXCDNAME];
+
+ dst_init();
+ if (msg == NULL || msglen == NULL || sig == NULL || siglen == NULL)
+ return (-1);
+
+ cp = msg + *msglen;
+ eob = msg + msgsize;
+
+ /* Name. */
+ if (key != NULL && error != ns_r_badsig && error != ns_r_badkey) {
+ n = ns_name_pton(key->dk_key_name, name, sizeof name);
+ if (n != -1)
+ n = ns_name_pack(name, cp, eob - cp,
+ (const u_char **)dnptrs,
+ (const u_char **)lastdnptr);
+
+ } else {
+ n = ns_name_pton("", name, sizeof name);
+ if (n != -1)
+ n = ns_name_pack(name, cp, eob - cp, NULL, NULL);
+ }
+ if (n < 0)
+ return (NS_TSIG_ERROR_NO_SPACE);
+ cp += n;
+
+ /* Type, class, ttl, length (not filled in yet). */
+ BOUNDS_CHECK(cp, INT16SZ + INT16SZ + INT32SZ + INT16SZ);
+ PUTSHORT(ns_t_tsig, cp);
+ PUTSHORT(ns_c_any, cp);
+ PUTLONG(0, cp); /*%< TTL */
+ lenp = cp;
+ cp += 2;
+
+ /* Alg. */
+ if (key != NULL && error != ns_r_badsig && error != ns_r_badkey) {
+ if (key->dk_alg != KEY_HMAC_MD5)
+ return (-ns_r_badkey);
+ n = dn_comp(NS_TSIG_ALG_HMAC_MD5, cp, eob - cp, NULL, NULL);
+ }
+ else
+ n = dn_comp("", cp, eob - cp, NULL, NULL);
+ if (n < 0)
+ return (NS_TSIG_ERROR_NO_SPACE);
+ alg = cp;
+ cp += n;
+
+ /* Time. */
+ BOUNDS_CHECK(cp, INT16SZ + INT32SZ + INT16SZ);
+ PUTSHORT(0, cp);
+ timesigned = time(NULL);
+ if (error != ns_r_badtime)
+ PUTLONG(timesigned, cp);
+ else
+ PUTLONG(in_timesigned, cp);
+ PUTSHORT(NS_TSIG_FUDGE, cp);
+
+ /* Compute the signature. */
+ if (key != NULL && error != ns_r_badsig && error != ns_r_badkey) {
+ void *ctx;
+ u_char buf[NS_MAXCDNAME], *cp2;
+ int n;
+
+ dst_sign_data(SIG_MODE_INIT, key, &ctx, NULL, 0, NULL, 0);
+
+ /* Digest the query signature, if this is a response. */
+ if (querysiglen > 0 && querysig != NULL) {
+ u_int16_t len_n = htons(querysiglen);
+ dst_sign_data(SIG_MODE_UPDATE, key, &ctx,
+ (u_char *)&len_n, INT16SZ, NULL, 0);
+ dst_sign_data(SIG_MODE_UPDATE, key, &ctx,
+ querysig, querysiglen, NULL, 0);
+ }
+
+ /* Digest the message. */
+ dst_sign_data(SIG_MODE_UPDATE, key, &ctx, msg, *msglen,
+ NULL, 0);
+
+ /* Digest the key name. */
+ n = ns_name_ntol(name, buf, sizeof(buf));
+ INSIST(n > 0);
+ dst_sign_data(SIG_MODE_UPDATE, key, &ctx, buf, n, NULL, 0);
+
+ /* Digest the class and TTL. */
+ cp2 = buf;
+ PUTSHORT(ns_c_any, cp2);
+ PUTLONG(0, cp2);
+ dst_sign_data(SIG_MODE_UPDATE, key, &ctx, buf, cp2-buf,
+ NULL, 0);
+
+ /* Digest the algorithm. */
+ n = ns_name_ntol(alg, buf, sizeof(buf));
+ INSIST(n > 0);
+ dst_sign_data(SIG_MODE_UPDATE, key, &ctx, buf, n, NULL, 0);
+
+ /* Digest the time signed, fudge, error, and other data */
+ cp2 = buf;
+ PUTSHORT(0, cp2); /*%< Top 16 bits of time */
+ if (error != ns_r_badtime)
+ PUTLONG(timesigned, cp2);
+ else
+ PUTLONG(in_timesigned, cp2);
+ PUTSHORT(NS_TSIG_FUDGE, cp2);
+ PUTSHORT(error, cp2); /*%< Error */
+ if (error != ns_r_badtime)
+ PUTSHORT(0, cp2); /*%< Other data length */
+ else {
+ PUTSHORT(INT16SZ+INT32SZ, cp2); /*%< Other data length */
+ PUTSHORT(0, cp2); /*%< Top 16 bits of time */
+ PUTLONG(timesigned, cp2);
+ }
+ dst_sign_data(SIG_MODE_UPDATE, key, &ctx, buf, cp2-buf,
+ NULL, 0);
+
+ n = dst_sign_data(SIG_MODE_FINAL, key, &ctx, NULL, 0,
+ sig, *siglen);
+ if (n < 0)
+ return (-ns_r_badkey);
+ *siglen = n;
+ } else
+ *siglen = 0;
+
+ /* Add the signature. */
+ BOUNDS_CHECK(cp, INT16SZ + (*siglen));
+ PUTSHORT(*siglen, cp);
+ memcpy(cp, sig, *siglen);
+ cp += (*siglen);
+
+ /* The original message ID & error. */
+ BOUNDS_CHECK(cp, INT16SZ + INT16SZ);
+ PUTSHORT(ntohs(hp->id), cp); /*%< already in network order */
+ PUTSHORT(error, cp);
+
+ /* Other data. */
+ BOUNDS_CHECK(cp, INT16SZ);
+ if (error != ns_r_badtime)
+ PUTSHORT(0, cp); /*%< Other data length */
+ else {
+ PUTSHORT(INT16SZ+INT32SZ, cp); /*%< Other data length */
+ BOUNDS_CHECK(cp, INT32SZ+INT16SZ);
+ PUTSHORT(0, cp); /*%< Top 16 bits of time */
+ PUTLONG(timesigned, cp);
+ }
+
+ /* Go back and fill in the length. */
+ PUTSHORT(cp - lenp - INT16SZ, lenp);
+
+ hp->arcount = htons(ntohs(hp->arcount) + 1);
+ *msglen = (cp - msg);
+ return (0);
+}
+
+int
+ns_sign_tcp_init(void *k, const u_char *querysig, int querysiglen,
+ ns_tcp_tsig_state *state)
+{
+ dst_init();
+ if (state == NULL || k == NULL || querysig == NULL || querysiglen < 0)
+ return (-1);
+ state->counter = -1;
+ state->key = k;
+ if (state->key->dk_alg != KEY_HMAC_MD5)
+ return (-ns_r_badkey);
+ if (querysiglen > (int)sizeof(state->sig))
+ return (-1);
+ memcpy(state->sig, querysig, querysiglen);
+ state->siglen = querysiglen;
+ return (0);
+}
+
+int
+ns_sign_tcp(u_char *msg, int *msglen, int msgsize, int error,
+ ns_tcp_tsig_state *state, int done)
+{
+ return (ns_sign_tcp2(msg, msglen, msgsize, error, state,
+ done, NULL, NULL));
+}
+
+int
+ns_sign_tcp2(u_char *msg, int *msglen, int msgsize, int error,
+ ns_tcp_tsig_state *state, int done,
+ u_char **dnptrs, u_char **lastdnptr)
+{
+ u_char *cp, *eob, *lenp;
+ u_char buf[MAXDNAME], *cp2;
+ HEADER *hp = (HEADER *)msg;
+ time_t timesigned;
+ int n;
+
+ if (msg == NULL || msglen == NULL || state == NULL)
+ return (-1);
+
+ state->counter++;
+ if (state->counter == 0)
+ return (ns_sign2(msg, msglen, msgsize, error, state->key,
+ state->sig, state->siglen,
+ state->sig, &state->siglen, 0,
+ dnptrs, lastdnptr));
+
+ if (state->siglen > 0) {
+ u_int16_t siglen_n = htons(state->siglen);
+ dst_sign_data(SIG_MODE_INIT, state->key, &state->ctx,
+ NULL, 0, NULL, 0);
+ dst_sign_data(SIG_MODE_UPDATE, state->key, &state->ctx,
+ (u_char *)&siglen_n, INT16SZ, NULL, 0);
+ dst_sign_data(SIG_MODE_UPDATE, state->key, &state->ctx,
+ state->sig, state->siglen, NULL, 0);
+ state->siglen = 0;
+ }
+
+ dst_sign_data(SIG_MODE_UPDATE, state->key, &state->ctx, msg, *msglen,
+ NULL, 0);
+
+ if (done == 0 && (state->counter % 100 != 0))
+ return (0);
+
+ cp = msg + *msglen;
+ eob = msg + msgsize;
+
+ /* Name. */
+ n = dn_comp(state->key->dk_key_name, cp, eob - cp, dnptrs, lastdnptr);
+ if (n < 0)
+ return (NS_TSIG_ERROR_NO_SPACE);
+ cp += n;
+
+ /* Type, class, ttl, length (not filled in yet). */
+ BOUNDS_CHECK(cp, INT16SZ + INT16SZ + INT32SZ + INT16SZ);
+ PUTSHORT(ns_t_tsig, cp);
+ PUTSHORT(ns_c_any, cp);
+ PUTLONG(0, cp); /*%< TTL */
+ lenp = cp;
+ cp += 2;
+
+ /* Alg. */
+ n = dn_comp(NS_TSIG_ALG_HMAC_MD5, cp, eob - cp, NULL, NULL);
+ if (n < 0)
+ return (NS_TSIG_ERROR_NO_SPACE);
+ cp += n;
+
+ /* Time. */
+ BOUNDS_CHECK(cp, INT16SZ + INT32SZ + INT16SZ);
+ PUTSHORT(0, cp);
+ timesigned = time(NULL);
+ PUTLONG(timesigned, cp);
+ PUTSHORT(NS_TSIG_FUDGE, cp);
+
+ /*
+ * Compute the signature.
+ */
+
+ /* Digest the time signed and fudge. */
+ cp2 = buf;
+ PUTSHORT(0, cp2); /*%< Top 16 bits of time */
+ PUTLONG(timesigned, cp2);
+ PUTSHORT(NS_TSIG_FUDGE, cp2);
+
+ dst_sign_data(SIG_MODE_UPDATE, state->key, &state->ctx,
+ buf, cp2 - buf, NULL, 0);
+
+ n = dst_sign_data(SIG_MODE_FINAL, state->key, &state->ctx, NULL, 0,
+ state->sig, sizeof(state->sig));
+ if (n < 0)
+ return (-ns_r_badkey);
+ state->siglen = n;
+
+ /* Add the signature. */
+ BOUNDS_CHECK(cp, INT16SZ + state->siglen);
+ PUTSHORT(state->siglen, cp);
+ memcpy(cp, state->sig, state->siglen);
+ cp += state->siglen;
+
+ /* The original message ID & error. */
+ BOUNDS_CHECK(cp, INT16SZ + INT16SZ);
+ PUTSHORT(ntohs(hp->id), cp); /*%< already in network order */
+ PUTSHORT(error, cp);
+
+ /* Other data. */
+ BOUNDS_CHECK(cp, INT16SZ);
+ PUTSHORT(0, cp);
+
+ /* Go back and fill in the length. */
+ PUTSHORT(cp - lenp - INT16SZ, lenp);
+
+ hp->arcount = htons(ntohs(hp->arcount) + 1);
+ *msglen = (cp - msg);
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_ttl.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_ttl.c
new file mode 100644
index 0000000000..69c2f83f57
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_ttl.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_ttl.c,v 1.4 2005/07/28 06:51:49 marka Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+#endif
+
+/* Forward. */
+
+static int fmt1(int t, char s, char **buf, size_t *buflen);
+
+/* Macros. */
+
+#define T(x) if ((x) < 0) return (-1); else (void)NULL
+
+/* Public. */
+
+int
+ns_format_ttl(u_long src, char *dst, size_t dstlen) {
+ char *odst = dst;
+ int secs, mins, hours, days, weeks, x;
+ char *p;
+
+ secs = src % 60; src /= 60;
+ mins = src % 60; src /= 60;
+ hours = src % 24; src /= 24;
+ days = src % 7; src /= 7;
+ weeks = src; src = 0;
+
+ x = 0;
+ if (weeks) {
+ T(fmt1(weeks, 'W', &dst, &dstlen));
+ x++;
+ }
+ if (days) {
+ T(fmt1(days, 'D', &dst, &dstlen));
+ x++;
+ }
+ if (hours) {
+ T(fmt1(hours, 'H', &dst, &dstlen));
+ x++;
+ }
+ if (mins) {
+ T(fmt1(mins, 'M', &dst, &dstlen));
+ x++;
+ }
+ if (secs || !(weeks || days || hours || mins)) {
+ T(fmt1(secs, 'S', &dst, &dstlen));
+ x++;
+ }
+
+ if (x > 1) {
+ int ch;
+
+ for (p = odst; (ch = *p) != '\0'; p++)
+ if (isascii(ch) && isupper(ch))
+ *p = tolower(ch);
+ }
+
+ return (dst - odst);
+}
+
+int
+ns_parse_ttl(const char *src, u_long *dst) {
+ u_long ttl, tmp;
+ int ch, digits, dirty;
+
+ ttl = 0;
+ tmp = 0;
+ digits = 0;
+ dirty = 0;
+ while ((ch = *src++) != '\0') {
+ if (!isascii(ch) || !isprint(ch))
+ goto einval;
+ if (isdigit(ch)) {
+ tmp *= 10;
+ tmp += (ch - '0');
+ digits++;
+ continue;
+ }
+ if (digits == 0)
+ goto einval;
+ if (islower(ch))
+ ch = toupper(ch);
+ switch (ch) {
+ case 'W': tmp *= 7;
+ case 'D': tmp *= 24;
+ case 'H': tmp *= 60;
+ case 'M': tmp *= 60;
+ case 'S': break;
+ default: goto einval;
+ }
+ ttl += tmp;
+ tmp = 0;
+ digits = 0;
+ dirty = 1;
+ }
+ if (digits > 0) {
+ if (dirty)
+ goto einval;
+ else
+ ttl += tmp;
+ } else if (!dirty)
+ goto einval;
+ *dst = ttl;
+ return (0);
+
+ einval:
+ errno = EINVAL;
+ return (-1);
+}
+
+/* Private. */
+
+static int
+fmt1(int t, char s, char **buf, size_t *buflen) {
+ char tmp[50];
+ size_t len;
+
+ len = SPRINTF((tmp, "%d%c", t, s));
+ if (len + 1 > *buflen)
+ return (-1);
+ strcpy(*buf, tmp);
+ *buf += len;
+ *buflen -= len;
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/nameser/ns_verify.c b/usr/src/lib/libresolv2_joy/common/nameser/ns_verify.c
new file mode 100644
index 0000000000..b4b63d4641
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/nameser/ns_verify.c
@@ -0,0 +1,484 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef lint
+static const char rcsid[] = "$Id: ns_verify.c,v 1.5 2006/03/09 23:57:56 marka Exp $";
+#endif
+
+/* Import. */
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <isc/dst.h>
+
+#include "port_after.h"
+
+/* Private. */
+
+#define BOUNDS_CHECK(ptr, count) \
+ do { \
+ if ((ptr) + (count) > eom) { \
+ return (NS_TSIG_ERROR_FORMERR); \
+ } \
+ } while (0)
+
+/* Public. */
+
+u_char *
+ns_find_tsig(u_char *msg, u_char *eom) {
+ HEADER *hp = (HEADER *)msg;
+ int n, type;
+ u_char *cp = msg, *start;
+
+ if (msg == NULL || eom == NULL || msg > eom)
+ return (NULL);
+
+ if (cp + HFIXEDSZ >= eom)
+ return (NULL);
+
+ if (hp->arcount == 0)
+ return (NULL);
+
+ cp += HFIXEDSZ;
+
+ n = ns_skiprr(cp, eom, ns_s_qd, ntohs(hp->qdcount));
+ if (n < 0)
+ return (NULL);
+ cp += n;
+
+ n = ns_skiprr(cp, eom, ns_s_an, ntohs(hp->ancount));
+ if (n < 0)
+ return (NULL);
+ cp += n;
+
+ n = ns_skiprr(cp, eom, ns_s_ns, ntohs(hp->nscount));
+ if (n < 0)
+ return (NULL);
+ cp += n;
+
+ n = ns_skiprr(cp, eom, ns_s_ar, ntohs(hp->arcount) - 1);
+ if (n < 0)
+ return (NULL);
+ cp += n;
+
+ start = cp;
+ n = dn_skipname(cp, eom);
+ if (n < 0)
+ return (NULL);
+ cp += n;
+ if (cp + INT16SZ >= eom)
+ return (NULL);
+
+ GETSHORT(type, cp);
+ if (type != ns_t_tsig)
+ return (NULL);
+ return (start);
+}
+
+/* ns_verify
+ *
+ * Parameters:
+ *\li statp res stuff
+ *\li msg received message
+ *\li msglen length of message
+ *\li key tsig key used for verifying.
+ *\li querysig (response), the signature in the query
+ *\li querysiglen (response), the length of the signature in the query
+ *\li sig (query), a buffer to hold the signature
+ *\li siglen (query), input - length of signature buffer
+ * output - length of signature
+ *
+ * Errors:
+ *\li - bad input (-1)
+ *\li - invalid dns message (NS_TSIG_ERROR_FORMERR)
+ *\li - TSIG is not present (NS_TSIG_ERROR_NO_TSIG)
+ *\li - key doesn't match (-ns_r_badkey)
+ *\li - TSIG verification fails with BADKEY (-ns_r_badkey)
+ *\li - TSIG verification fails with BADSIG (-ns_r_badsig)
+ *\li - TSIG verification fails with BADTIME (-ns_r_badtime)
+ *\li - TSIG verification succeeds, error set to BAKEY (ns_r_badkey)
+ *\li - TSIG verification succeeds, error set to BADSIG (ns_r_badsig)
+ *\li - TSIG verification succeeds, error set to BADTIME (ns_r_badtime)
+ */
+int
+ns_verify(u_char *msg, int *msglen, void *k,
+ const u_char *querysig, int querysiglen, u_char *sig, int *siglen,
+ time_t *timesigned, int nostrip)
+{
+ HEADER *hp = (HEADER *)msg;
+ DST_KEY *key = (DST_KEY *)k;
+ u_char *cp = msg, *eom;
+ char name[MAXDNAME], alg[MAXDNAME];
+ u_char *recstart, *rdatastart;
+ u_char *sigstart, *otherstart;
+ int n;
+ int error;
+ u_int16_t type, length;
+ u_int16_t fudge, sigfieldlen, otherfieldlen;
+
+ dst_init();
+ if (msg == NULL || msglen == NULL || *msglen < 0)
+ return (-1);
+
+ eom = msg + *msglen;
+
+ recstart = ns_find_tsig(msg, eom);
+ if (recstart == NULL)
+ return (NS_TSIG_ERROR_NO_TSIG);
+
+ cp = recstart;
+
+ /* Read the key name. */
+ n = dn_expand(msg, eom, cp, name, MAXDNAME);
+ if (n < 0)
+ return (NS_TSIG_ERROR_FORMERR);
+ cp += n;
+
+ /* Read the type. */
+ BOUNDS_CHECK(cp, 2*INT16SZ + INT32SZ + INT16SZ);
+ GETSHORT(type, cp);
+ if (type != ns_t_tsig)
+ return (NS_TSIG_ERROR_NO_TSIG);
+
+ /* Skip the class and TTL, save the length. */
+ cp += INT16SZ + INT32SZ;
+ GETSHORT(length, cp);
+ if (eom - cp != length)
+ return (NS_TSIG_ERROR_FORMERR);
+
+ /* Read the algorithm name. */
+ rdatastart = cp;
+ n = dn_expand(msg, eom, cp, alg, MAXDNAME);
+ if (n < 0)
+ return (NS_TSIG_ERROR_FORMERR);
+ if (ns_samename(alg, NS_TSIG_ALG_HMAC_MD5) != 1)
+ return (-ns_r_badkey);
+ cp += n;
+
+ /* Read the time signed and fudge. */
+ BOUNDS_CHECK(cp, INT16SZ + INT32SZ + INT16SZ);
+ cp += INT16SZ;
+ GETLONG((*timesigned), cp);
+ GETSHORT(fudge, cp);
+
+ /* Read the signature. */
+ BOUNDS_CHECK(cp, INT16SZ);
+ GETSHORT(sigfieldlen, cp);
+ BOUNDS_CHECK(cp, sigfieldlen);
+ sigstart = cp;
+ cp += sigfieldlen;
+
+ /* Skip id and read error. */
+ BOUNDS_CHECK(cp, 2*INT16SZ);
+ cp += INT16SZ;
+ GETSHORT(error, cp);
+
+ /* Parse the other data. */
+ BOUNDS_CHECK(cp, INT16SZ);
+ GETSHORT(otherfieldlen, cp);
+ BOUNDS_CHECK(cp, otherfieldlen);
+ otherstart = cp;
+ cp += otherfieldlen;
+
+ if (cp != eom)
+ return (NS_TSIG_ERROR_FORMERR);
+
+ /* Verify that the key used is OK. */
+ if (key != NULL) {
+ if (key->dk_alg != KEY_HMAC_MD5)
+ return (-ns_r_badkey);
+ if (error != ns_r_badsig && error != ns_r_badkey) {
+ if (ns_samename(key->dk_key_name, name) != 1)
+ return (-ns_r_badkey);
+ }
+ }
+
+ hp->arcount = htons(ntohs(hp->arcount) - 1);
+
+ /*
+ * Do the verification.
+ */
+
+ if (key != NULL && error != ns_r_badsig && error != ns_r_badkey) {
+ void *ctx;
+ u_char buf[MAXDNAME];
+ u_char buf2[MAXDNAME];
+
+ /* Digest the query signature, if this is a response. */
+ dst_verify_data(SIG_MODE_INIT, key, &ctx, NULL, 0, NULL, 0);
+ if (querysiglen > 0 && querysig != NULL) {
+ u_int16_t len_n = htons(querysiglen);
+ dst_verify_data(SIG_MODE_UPDATE, key, &ctx,
+ (u_char *)&len_n, INT16SZ, NULL, 0);
+ dst_verify_data(SIG_MODE_UPDATE, key, &ctx,
+ querysig, querysiglen, NULL, 0);
+ }
+
+ /* Digest the message. */
+ dst_verify_data(SIG_MODE_UPDATE, key, &ctx, msg, recstart - msg,
+ NULL, 0);
+
+ /* Digest the key name. */
+ n = ns_name_pton(name, buf2, sizeof(buf2));
+ if (n < 0)
+ return (-1);
+ n = ns_name_ntol(buf2, buf, sizeof(buf));
+ if (n < 0)
+ return (-1);
+ dst_verify_data(SIG_MODE_UPDATE, key, &ctx, buf, n, NULL, 0);
+
+ /* Digest the class and TTL. */
+ dst_verify_data(SIG_MODE_UPDATE, key, &ctx,
+ recstart + dn_skipname(recstart, eom) + INT16SZ,
+ INT16SZ + INT32SZ, NULL, 0);
+
+ /* Digest the algorithm. */
+ n = ns_name_pton(alg, buf2, sizeof(buf2));
+ if (n < 0)
+ return (-1);
+ n = ns_name_ntol(buf2, buf, sizeof(buf));
+ if (n < 0)
+ return (-1);
+ dst_verify_data(SIG_MODE_UPDATE, key, &ctx, buf, n, NULL, 0);
+
+ /* Digest the time signed and fudge. */
+ dst_verify_data(SIG_MODE_UPDATE, key, &ctx,
+ rdatastart + dn_skipname(rdatastart, eom),
+ INT16SZ + INT32SZ + INT16SZ, NULL, 0);
+
+ /* Digest the error and other data. */
+ dst_verify_data(SIG_MODE_UPDATE, key, &ctx,
+ otherstart - INT16SZ - INT16SZ,
+ otherfieldlen + INT16SZ + INT16SZ, NULL, 0);
+
+ n = dst_verify_data(SIG_MODE_FINAL, key, &ctx, NULL, 0,
+ sigstart, sigfieldlen);
+
+ if (n < 0)
+ return (-ns_r_badsig);
+
+ if (sig != NULL && siglen != NULL) {
+ if (*siglen < sigfieldlen)
+ return (NS_TSIG_ERROR_NO_SPACE);
+ memcpy(sig, sigstart, sigfieldlen);
+ *siglen = sigfieldlen;
+ }
+ } else {
+ if (sigfieldlen > 0)
+ return (NS_TSIG_ERROR_FORMERR);
+ if (sig != NULL && siglen != NULL)
+ *siglen = 0;
+ }
+
+ /* Reset the counter, since we still need to check for badtime. */
+ hp->arcount = htons(ntohs(hp->arcount) + 1);
+
+ /* Verify the time. */
+ if (abs((*timesigned) - time(NULL)) > fudge)
+ return (-ns_r_badtime);
+
+ if (nostrip == 0) {
+ *msglen = recstart - msg;
+ hp->arcount = htons(ntohs(hp->arcount) - 1);
+ }
+
+ if (error != NOERROR)
+ return (error);
+
+ return (0);
+}
+
+int
+ns_verify_tcp_init(void *k, const u_char *querysig, int querysiglen,
+ ns_tcp_tsig_state *state)
+{
+ dst_init();
+ if (state == NULL || k == NULL || querysig == NULL || querysiglen < 0)
+ return (-1);
+ state->counter = -1;
+ state->key = k;
+ if (state->key->dk_alg != KEY_HMAC_MD5)
+ return (-ns_r_badkey);
+ if (querysiglen > (int)sizeof(state->sig))
+ return (-1);
+ memcpy(state->sig, querysig, querysiglen);
+ state->siglen = querysiglen;
+ return (0);
+}
+
+int
+ns_verify_tcp(u_char *msg, int *msglen, ns_tcp_tsig_state *state,
+ int required)
+{
+ HEADER *hp = (HEADER *)msg;
+ u_char *recstart, *sigstart;
+ unsigned int sigfieldlen, otherfieldlen;
+ u_char *cp, *eom, *cp2;
+ char name[MAXDNAME], alg[MAXDNAME];
+ u_char buf[MAXDNAME];
+ int n, type, length, fudge, error;
+ time_t timesigned;
+
+ if (msg == NULL || msglen == NULL || state == NULL)
+ return (-1);
+
+ eom = msg + *msglen;
+
+ state->counter++;
+ if (state->counter == 0)
+ return (ns_verify(msg, msglen, state->key,
+ state->sig, state->siglen,
+ state->sig, &state->siglen, &timesigned, 0));
+
+ if (state->siglen > 0) {
+ u_int16_t siglen_n = htons(state->siglen);
+
+ dst_verify_data(SIG_MODE_INIT, state->key, &state->ctx,
+ NULL, 0, NULL, 0);
+ dst_verify_data(SIG_MODE_UPDATE, state->key, &state->ctx,
+ (u_char *)&siglen_n, INT16SZ, NULL, 0);
+ dst_verify_data(SIG_MODE_UPDATE, state->key, &state->ctx,
+ state->sig, state->siglen, NULL, 0);
+ state->siglen = 0;
+ }
+
+ cp = recstart = ns_find_tsig(msg, eom);
+
+ if (recstart == NULL) {
+ if (required)
+ return (NS_TSIG_ERROR_NO_TSIG);
+ dst_verify_data(SIG_MODE_UPDATE, state->key, &state->ctx,
+ msg, *msglen, NULL, 0);
+ return (0);
+ }
+
+ hp->arcount = htons(ntohs(hp->arcount) - 1);
+ dst_verify_data(SIG_MODE_UPDATE, state->key, &state->ctx,
+ msg, recstart - msg, NULL, 0);
+
+ /* Read the key name. */
+ n = dn_expand(msg, eom, cp, name, MAXDNAME);
+ if (n < 0)
+ return (NS_TSIG_ERROR_FORMERR);
+ cp += n;
+
+ /* Read the type. */
+ BOUNDS_CHECK(cp, 2*INT16SZ + INT32SZ + INT16SZ);
+ GETSHORT(type, cp);
+ if (type != ns_t_tsig)
+ return (NS_TSIG_ERROR_NO_TSIG);
+
+ /* Skip the class and TTL, save the length. */
+ cp += INT16SZ + INT32SZ;
+ GETSHORT(length, cp);
+ if (eom - cp != length)
+ return (NS_TSIG_ERROR_FORMERR);
+
+ /* Read the algorithm name. */
+ n = dn_expand(msg, eom, cp, alg, MAXDNAME);
+ if (n < 0)
+ return (NS_TSIG_ERROR_FORMERR);
+ if (ns_samename(alg, NS_TSIG_ALG_HMAC_MD5) != 1)
+ return (-ns_r_badkey);
+ cp += n;
+
+ /* Verify that the key used is OK. */
+ if ((ns_samename(state->key->dk_key_name, name) != 1 ||
+ state->key->dk_alg != KEY_HMAC_MD5))
+ return (-ns_r_badkey);
+
+ /* Read the time signed and fudge. */
+ BOUNDS_CHECK(cp, INT16SZ + INT32SZ + INT16SZ);
+ cp += INT16SZ;
+ GETLONG(timesigned, cp);
+ GETSHORT(fudge, cp);
+
+ /* Read the signature. */
+ BOUNDS_CHECK(cp, INT16SZ);
+ GETSHORT(sigfieldlen, cp);
+ BOUNDS_CHECK(cp, sigfieldlen);
+ sigstart = cp;
+ cp += sigfieldlen;
+
+ /* Skip id and read error. */
+ BOUNDS_CHECK(cp, 2*INT16SZ);
+ cp += INT16SZ;
+ GETSHORT(error, cp);
+
+ /* Parse the other data. */
+ BOUNDS_CHECK(cp, INT16SZ);
+ GETSHORT(otherfieldlen, cp);
+ BOUNDS_CHECK(cp, otherfieldlen);
+ cp += otherfieldlen;
+
+ if (cp != eom)
+ return (NS_TSIG_ERROR_FORMERR);
+
+ /*
+ * Do the verification.
+ */
+
+ /* Digest the time signed and fudge. */
+ cp2 = buf;
+ PUTSHORT(0, cp2); /*%< Top 16 bits of time. */
+ PUTLONG(timesigned, cp2);
+ PUTSHORT(NS_TSIG_FUDGE, cp2);
+
+ dst_verify_data(SIG_MODE_UPDATE, state->key, &state->ctx,
+ buf, cp2 - buf, NULL, 0);
+
+ n = dst_verify_data(SIG_MODE_FINAL, state->key, &state->ctx, NULL, 0,
+ sigstart, sigfieldlen);
+ if (n < 0)
+ return (-ns_r_badsig);
+
+ if (sigfieldlen > sizeof(state->sig))
+ return (NS_TSIG_ERROR_NO_SPACE);
+
+ memcpy(state->sig, sigstart, sigfieldlen);
+ state->siglen = sigfieldlen;
+
+ /* Verify the time. */
+ if (abs(timesigned - time(NULL)) > fudge)
+ return (-ns_r_badtime);
+
+ *msglen = recstart - msg;
+
+ if (error != NOERROR)
+ return (error);
+
+ return (0);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/herror.c b/usr/src/lib/libresolv2_joy/common/resolv/herror.c
new file mode 100644
index 0000000000..568ce3ce68
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/herror.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 1987, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: herror.c,v 1.4 2005/04/27 04:56:41 sra Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/uio.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <string.h>
+#include <unistd.h>
+#include <irs.h>
+
+#include "port_after.h"
+
+const char *h_errlist[] = {
+ "Resolver Error 0 (no error)",
+ "Unknown host", /*%< 1 HOST_NOT_FOUND */
+ "Host name lookup failure", /*%< 2 TRY_AGAIN */
+ "Unknown server error", /*%< 3 NO_RECOVERY */
+ "No address associated with name", /*%< 4 NO_ADDRESS */
+};
+int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
+
+#if !(__GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
+#undef h_errno
+int h_errno;
+#endif
+
+/*%
+ * herror --
+ * print the error indicated by the h_errno value.
+ */
+void
+herror(const char *s) {
+ struct iovec iov[4], *v = iov;
+ char *t;
+
+ if (s != NULL && *s != '\0') {
+ DE_CONST(s, t);
+ v->iov_base = t;
+ v->iov_len = strlen(t);
+ v++;
+ DE_CONST(": ", t);
+ v->iov_base = t;
+ v->iov_len = 2;
+ v++;
+ }
+ DE_CONST(hstrerror(*__h_errno()), t);
+ v->iov_base = t;
+ v->iov_len = strlen(v->iov_base);
+ v++;
+ DE_CONST("\n", t);
+ v->iov_base = t;
+ v->iov_len = 1;
+ writev(STDERR_FILENO, iov, (v - iov) + 1);
+}
+
+/*%
+ * hstrerror --
+ * return the string associated with a given "host" errno value.
+ */
+const char *
+hstrerror(int err) {
+ if (err < 0)
+ return ("Resolver internal error");
+ else if (err < h_nerr)
+ return (h_errlist[err]);
+ return ("Unknown resolver error");
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/mtctxres.c b/usr/src/lib/libresolv2_joy/common/resolv/mtctxres.c
new file mode 100644
index 0000000000..2e79b1e7b4
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/mtctxres.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#include <port_before.h>
+#ifdef DO_PTHREADS
+#include <pthread.h>
+#endif
+#include <errno.h>
+#include <netdb.h>
+#include <stdlib.h>
+#include <string.h>
+#include <resolv_mt.h>
+#include <irs.h>
+#include <port_after.h>
+
+#ifdef DO_PTHREADS
+static pthread_key_t key;
+static int mt_key_initialized = 0;
+
+static int __res_init_ctx(void);
+static void __res_destroy_ctx(void *);
+
+#if defined(sun) && !defined(__GNUC__)
+#pragma init (_mtctxres_init)
+#endif
+#endif
+
+static mtctxres_t sharedctx;
+
+#ifdef DO_PTHREADS
+/*
+ * Initialize the TSD key. By doing this at library load time, we're
+ * implicitly running without interference from other threads, so there's
+ * no need for locking.
+ */
+static void
+_mtctxres_init(void) {
+ int pthread_keycreate_ret;
+
+ pthread_keycreate_ret = pthread_key_create(&key, __res_destroy_ctx);
+ if (pthread_keycreate_ret == 0)
+ mt_key_initialized = 1;
+}
+#endif
+
+/*
+ * To support binaries that used the private MT-safe interface in
+ * Solaris 8, we still need to provide the __res_enable_mt()
+ * and __res_disable_mt() entry points. They're do-nothing routines.
+ */
+int
+__res_enable_mt(void) {
+ return (-1);
+}
+
+int
+__res_disable_mt(void) {
+ return (0);
+}
+
+#ifdef DO_PTHREADS
+static int
+__res_init_ctx(void) {
+
+ mtctxres_t *mt;
+ int ret;
+
+
+ if (pthread_getspecific(key) != 0) {
+ /* Already exists */
+ return (0);
+ }
+
+ if ((mt = malloc(sizeof (mtctxres_t))) == 0) {
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ memset(mt, 0, sizeof (mtctxres_t));
+
+ if ((ret = pthread_setspecific(key, mt)) != 0) {
+ free(mt);
+ errno = ret;
+ return (-1);
+ }
+
+ return (0);
+}
+
+static void
+__res_destroy_ctx(void *value) {
+
+ mtctxres_t *mt = (mtctxres_t *)value;
+
+ if (mt != 0)
+ free(mt);
+}
+#endif
+
+mtctxres_t *
+___mtctxres(void) {
+#ifdef DO_PTHREADS
+ mtctxres_t *mt;
+
+ /*
+ * This if clause should only be executed if we are linking
+ * statically. When linked dynamically _mtctxres_init() should
+ * be called at binding time due the #pragma above.
+ */
+ if (!mt_key_initialized) {
+ static pthread_mutex_t keylock = PTHREAD_MUTEX_INITIALIZER;
+ if (pthread_mutex_lock(&keylock) == 0) {
+ _mtctxres_init();
+ (void) pthread_mutex_unlock(&keylock);
+ }
+ }
+
+ /*
+ * If we have already been called in this thread return the existing
+ * context. Otherwise recreat a new context and return it. If
+ * that fails return a global context.
+ */
+ if (mt_key_initialized) {
+ if (((mt = pthread_getspecific(key)) != 0) ||
+ (__res_init_ctx() == 0 &&
+ (mt = pthread_getspecific(key)) != 0)) {
+ return (mt);
+ }
+ }
+#endif
+ return (&sharedctx);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_comp.c b/usr/src/lib/libresolv2_joy/common/resolv/res_comp.c
new file mode 100644
index 0000000000..c82bf01eb8
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_comp.c
@@ -0,0 +1,287 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (c) 1985, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: res_comp.c,v 1.5 2005/07/28 06:51:50 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+#include <sys/types.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <ctype.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include "port_after.h"
+
+#ifndef ORIGINAL_ISC_CODE
+#pragma weak __dn_skipname = dn_skipname
+#pragma weak __res_dnok = res_dnok
+#pragma weak __res_hnok = res_hnok
+#pragma weak __res_mailok = res_mailok
+#pragma weak __res_ownok = res_ownok
+#endif /* ORIGINAL_ISC_CODE */
+
+/*%
+ * Expand compressed domain name 'src' to full domain name.
+ *
+ * \li 'msg' is a pointer to the begining of the message,
+ * \li 'eom' points to the first location after the message,
+ * \li 'dst' is a pointer to a buffer of size 'dstsiz' for the result.
+ * \li Return size of compressed name or -1 if there was an error.
+ */
+int
+dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
+ char *dst, int dstsiz)
+{
+ int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz);
+
+ if (n > 0 && dst[0] == '.')
+ dst[0] = '\0';
+ return (n);
+}
+
+/*%
+ * Pack domain name 'exp_dn' in presentation form into 'comp_dn'.
+ *
+ * \li Return the size of the compressed name or -1.
+ * \li 'length' is the size of the array pointed to by 'comp_dn'.
+ */
+int
+dn_comp(const char *src, u_char *dst, int dstsiz,
+ u_char **dnptrs, u_char **lastdnptr)
+{
+ return (ns_name_compress(src, dst, (size_t)dstsiz,
+ (const u_char **)dnptrs,
+ (const u_char **)lastdnptr));
+}
+
+
+/*%
+ * Skip over a compressed domain name. Return the size or -1.
+ */
+int
+dn_skipname(const u_char *ptr, const u_char *eom) {
+ const u_char *saveptr = ptr;
+
+ if (ns_name_skip(&ptr, eom) == -1)
+ return (-1);
+ return (ptr - saveptr);
+}
+
+/*%
+ * Verify that a domain name uses an acceptable character set.
+ *
+ * Note the conspicuous absence of ctype macros in these definitions. On
+ * non-ASCII hosts, we can't depend on string literals or ctype macros to
+ * tell us anything about network-format data. The rest of the BIND system
+ * is not careful about this, but for some reason, we're doing it right here.
+ */
+#define PERIOD 0x2e
+#define hyphenchar(c) ((c) == 0x2d)
+#define bslashchar(c) ((c) == 0x5c)
+#ifdef SUNW_HNOK_UNDERSCORE
+#define underscorechar(c) ((c) == 0x5f)
+#endif /* SUNW_HNOK_UNDERSCORE */
+#define periodchar(c) ((c) == PERIOD)
+#define asterchar(c) ((c) == 0x2a)
+#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \
+ || ((c) >= 0x61 && (c) <= 0x7a))
+#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
+
+#define borderchar(c) (alphachar(c) || digitchar(c))
+#ifdef SUNW_HNOK_UNDERSCORE
+#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
+#else
+#define middlechar(c) (borderchar(c) || hyphenchar(c))
+#endif /* SUNW_HNOK_UNDERSCORE */
+#define domainchar(c) ((c) > 0x20 && (c) < 0x7f)
+
+int
+res_hnok(const char *dn) {
+ int pch = PERIOD, ch = *dn++;
+
+ while (ch != '\0') {
+ int nch = *dn++;
+
+ if (periodchar(ch)) {
+ (void)NULL;
+ } else if (periodchar(pch)) {
+ if (!borderchar(ch))
+ return (0);
+ } else if (periodchar(nch) || nch == '\0') {
+ if (!borderchar(ch))
+ return (0);
+ } else {
+ if (!middlechar(ch))
+ return (0);
+ }
+ pch = ch, ch = nch;
+ }
+ return (1);
+}
+
+/*%
+ * hostname-like (A, MX, WKS) owners can have "*" as their first label
+ * but must otherwise be as a host name.
+ */
+int
+res_ownok(const char *dn) {
+ if (asterchar(dn[0])) {
+ if (periodchar(dn[1]))
+ return (res_hnok(dn+2));
+ if (dn[1] == '\0')
+ return (1);
+ }
+ return (res_hnok(dn));
+}
+
+/*%
+ * SOA RNAMEs and RP RNAMEs can have any printable character in their first
+ * label, but the rest of the name has to look like a host name.
+ */
+int
+res_mailok(const char *dn) {
+ int ch, escaped = 0;
+
+ /* "." is a valid missing representation */
+ if (*dn == '\0')
+ return (1);
+
+ /* otherwise <label>.<hostname> */
+ while ((ch = *dn++) != '\0') {
+ if (!domainchar(ch))
+ return (0);
+ if (!escaped && periodchar(ch))
+ break;
+ if (escaped)
+ escaped = 0;
+ else if (bslashchar(ch))
+ escaped = 1;
+ }
+ if (periodchar(ch))
+ return (res_hnok(dn));
+ return (0);
+}
+
+/*%
+ * This function is quite liberal, since RFC1034's character sets are only
+ * recommendations.
+ */
+int
+res_dnok(const char *dn) {
+ int ch;
+
+ while ((ch = *dn++) != '\0')
+ if (!domainchar(ch))
+ return (0);
+ return (1);
+}
+
+#ifdef BIND_4_COMPAT
+/*%
+ * This module must export the following externally-visible symbols:
+ * ___putlong
+ * ___putshort
+ * __getlong
+ * __getshort
+ * Note that one _ comes from C and the others come from us.
+ */
+
+#ifdef SOLARIS2
+#ifdef __putlong
+#undef __putlong
+#endif
+#ifdef __putshort
+#undef __putshort
+#endif
+#pragma weak putlong = __putlong
+#pragma weak putshort = __putshort
+#endif /* SOLARIS2 */
+
+void __putlong(u_int32_t src, u_char *dst) { ns_put32(src, dst); }
+void __putshort(u_int16_t src, u_char *dst) { ns_put16(src, dst); }
+#ifndef __ultrix__
+u_int32_t _getlong(const u_char *src) { return (ns_get32(src)); }
+u_int16_t _getshort(const u_char *src) { return (ns_get16(src)); }
+#endif /*__ultrix__*/
+#endif /*BIND_4_COMPAT*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_data.c b/usr/src/lib/libresolv2_joy/common/resolv/res_data.c
new file mode 100644
index 0000000000..f1e0dd030b
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_data.c
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] = "$Id: res_data.c,v 1.7 2008/12/11 09:59:00 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <res_update.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "port_after.h"
+
+#ifndef ORIGINAL_ISC_CODE
+#pragma weak __fp_nquery = fp_nquery
+#pragma weak __fp_query = fp_query
+#pragma weak __p_query = p_query
+#pragma weak __hostalias = hostalias
+#pragma weak __res_randomid = res_randomid
+#endif
+
+const char *_res_opcodes[] = {
+ "QUERY",
+ "IQUERY",
+ "CQUERYM",
+ "CQUERYU", /*%< experimental */
+ "NOTIFY", /*%< experimental */
+ "UPDATE",
+ "6",
+ "7",
+ "8",
+ "9",
+ "10",
+ "11",
+ "12",
+ "13",
+ "ZONEINIT",
+ "ZONEREF",
+};
+
+#ifdef BIND_UPDATE
+const char *_res_sectioncodes[] = {
+ "ZONE",
+ "PREREQUISITES",
+ "UPDATE",
+ "ADDITIONAL",
+};
+#endif
+
+#undef _res
+#ifndef __BIND_NOSTATIC
+struct __res_state _res
+# if defined(__BIND_RES_TEXT)
+ = { RES_TIMEOUT, } /*%< Motorola, et al. */
+# endif
+ ;
+
+#ifdef ORIGINAL_ISC_CODE
+#if defined(DO_PTHREADS) || defined(__linux)
+#define _res (*__res_state())
+#endif
+#endif
+
+/* Proto. */
+
+int res_ourserver_p(const res_state, const struct sockaddr_in *);
+
+int
+res_init(void) {
+ extern int __res_vinit(res_state, int);
+
+ /*
+ * These three fields used to be statically initialized. This made
+ * it hard to use this code in a shared library. It is necessary,
+ * now that we're doing dynamic initialization here, that we preserve
+ * the old semantics: if an application modifies one of these three
+ * fields of _res before res_init() is called, res_init() will not
+ * alter them. Of course, if an application is setting them to
+ * _zero_ before calling res_init(), hoping to override what used
+ * to be the static default, we can't detect it and unexpected results
+ * will follow. Zero for any of these fields would make no sense,
+ * so one can safely assume that the applications were already getting
+ * unexpected results.
+ *
+ * _res.options is tricky since some apps were known to diddle the bits
+ * before res_init() was first called. We can't replicate that semantic
+ * with dynamic initialization (they may have turned bits off that are
+ * set in RES_DEFAULT). Our solution is to declare such applications
+ * "broken". They could fool us by setting RES_INIT but none do (yet).
+ */
+ if (!_res.retrans)
+ _res.retrans = RES_TIMEOUT;
+ if (!_res.retry)
+ _res.retry = 4;
+ if (!(_res.options & RES_INIT))
+ _res.options = RES_DEFAULT;
+
+ /*
+ * This one used to initialize implicitly to zero, so unless the app
+ * has set it to something in particular, we can randomize it now.
+ */
+ if (!_res.id)
+ _res.id = res_nrandomid(&_res);
+
+ return (__res_vinit(&_res, 1));
+}
+
+void
+p_query(const u_char *msg) {
+ fp_query(msg, stdout);
+}
+
+void
+fp_query(const u_char *msg, FILE *file) {
+ fp_nquery(msg, PACKETSZ, file);
+}
+
+void
+fp_nquery(const u_char *msg, int len, FILE *file) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1)
+ return;
+
+ res_pquery(&_res, msg, len, file);
+}
+
+int
+res_mkquery(int op, /*!< opcode of query */
+ const char *dname, /*!< domain name */
+ int class, int type, /*!< class and type of query */
+ const u_char *data, /*!< resource record data */
+ int datalen, /*!< length of data */
+ const u_char *newrr_in, /*!< new rr for modify or append */
+ u_char *buf, /*!< buffer to put query */
+ int buflen) /*!< size of buffer */
+{
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
+ return (-1);
+ }
+ return (res_nmkquery(&_res, op, dname, class, type,
+ data, datalen,
+ newrr_in, buf, buflen));
+}
+
+int
+res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nmkupdate(&_res, rrecp_in, buf, buflen));
+}
+
+int
+res_query(const char *name, /*!< domain name */
+ int class, int type, /*!< class and type of query */
+ u_char *answer, /*!< buffer to put answer */
+ int anslen) /*!< size of answer buffer */
+{
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
+ return (-1);
+ }
+ return (res_nquery(&_res, name, class, type, answer, anslen));
+}
+
+void
+res_send_setqhook(res_send_qhook hook) {
+ _res.qhook = hook;
+}
+
+void
+res_send_setrhook(res_send_rhook hook) {
+ _res.rhook = hook;
+}
+
+int
+res_isourserver(const struct sockaddr_in *inp) {
+ return (res_ourserver_p(&_res, inp));
+}
+
+int
+res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ /* errno should have been set by res_init() in this case. */
+ return (-1);
+ }
+
+ return (res_nsend(&_res, buf, buflen, ans, anssiz));
+}
+
+int
+res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key,
+ u_char *ans, int anssiz)
+{
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ /* errno should have been set by res_init() in this case. */
+ return (-1);
+ }
+
+ return (res_nsendsigned(&_res, buf, buflen, key, ans, anssiz));
+}
+
+void
+res_close(void) {
+ res_nclose(&_res);
+}
+
+int
+res_update(ns_updrec *rrecp_in) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nupdate(&_res, rrecp_in, NULL));
+}
+
+int
+res_search(const char *name, /*!< domain name */
+ int class, int type, /*!< class and type of query */
+ u_char *answer, /*!< buffer to put answer */
+ int anslen) /*!< size of answer */
+{
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nsearch(&_res, name, class, type, answer, anslen));
+}
+
+int
+res_querydomain(const char *name,
+ const char *domain,
+ int class, int type, /*!< class and type of query */
+ u_char *answer, /*!< buffer to put answer */
+ int anslen) /*!< size of answer */
+{
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nquerydomain(&_res, name, domain,
+ class, type,
+ answer, anslen));
+}
+
+u_int
+res_randomid(void) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
+ RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nrandomid(&_res));
+}
+
+const char *
+hostalias(const char *name) {
+ static char abuf[MAXDNAME];
+
+ return (res_hostalias(&_res, name, abuf, sizeof abuf));
+}
+
+#ifdef ultrix
+int
+local_hostname_length(const char *hostname) {
+ int len_host, len_domain;
+
+ if (!*_res.defdname)
+ res_init();
+ len_host = strlen(hostname);
+ len_domain = strlen(_res.defdname);
+ if (len_host > len_domain &&
+ !strcasecmp(hostname + len_host - len_domain, _res.defdname) &&
+ hostname[len_host - len_domain - 1] == '.')
+ return (len_host - len_domain - 1);
+ return (0);
+}
+#endif /*ultrix*/
+
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_debug.c b/usr/src/lib/libresolv2_joy/common/resolv/res_debug.c
new file mode 100644
index 0000000000..e11fb29612
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_debug.c
@@ -0,0 +1,1252 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Portions Copyright (C) 2004, 2005, 2008, 2009 Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1996-2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1985
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: res_debug.c,v 1.19 2009/02/26 11:20:20 tbox Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <math.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <resolv_mt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "port_after.h"
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+#else
+# define SPRINTF(x) sprintf x
+#endif
+
+extern const char *_res_opcodes[];
+extern const char *_res_sectioncodes[];
+
+#ifndef ORIGINAL_ISC_CODE
+#pragma weak __dn_count_labels = dn_count_labels
+#pragma weak __fp_resstat = fp_resstat
+#pragma weak __loc_aton = loc_aton
+#pragma weak __loc_ntoa = loc_ntoa
+#pragma weak __p_cdname = p_cdname
+#pragma weak __p_class = p_class
+#pragma weak __p_section = p_section
+#pragma weak __p_time = p_time
+#pragma weak __p_type = p_type
+#pragma weak __sym_ntop = sym_ntop
+#pragma weak __sym_ntos = sym_ntos
+#pragma weak __sym_ston = sym_ston
+#endif /* ORIGINAL_ISC_CODE */
+
+/*%
+ * Print the current options.
+ */
+void
+fp_resstat(const res_state statp, FILE *file) {
+ u_long mask;
+
+ fprintf(file, ";; res options:");
+ for (mask = 1; mask != 0U; mask <<= 1)
+ if (statp->options & mask)
+ fprintf(file, " %s", p_option(mask));
+ putc('\n', file);
+}
+
+static void
+do_section(const res_state statp,
+ ns_msg *handle, ns_sect section,
+ int pflag, FILE *file)
+{
+ int n, sflag, rrnum;
+ static int buflen = 2048;
+ char *buf;
+ ns_opcode opcode;
+ ns_rr rr;
+
+ /*
+ * Print answer records.
+ */
+ sflag = (statp->pfcode & pflag);
+ if (statp->pfcode && !sflag)
+ return;
+
+ buf = malloc(buflen);
+ if (buf == NULL) {
+ fprintf(file, ";; memory allocation failure\n");
+ return;
+ }
+
+ opcode = (ns_opcode) ns_msg_getflag(*handle, ns_f_opcode);
+ rrnum = 0;
+ for (;;) {
+ if (ns_parserr(handle, section, rrnum, &rr)) {
+ if (errno != ENODEV)
+ fprintf(file, ";; ns_parserr: %s\n",
+ strerror(errno));
+ else if (rrnum > 0 && sflag != 0 &&
+ (statp->pfcode & RES_PRF_HEAD1))
+ putc('\n', file);
+ goto cleanup;
+ }
+ if (rrnum == 0 && sflag != 0 && (statp->pfcode & RES_PRF_HEAD1))
+ fprintf(file, ";; %s SECTION:\n",
+ p_section(section, opcode));
+ if (section == ns_s_qd)
+ fprintf(file, ";;\t%s, type = %s, class = %s\n",
+ ns_rr_name(rr),
+ p_type(ns_rr_type(rr)),
+ p_class(ns_rr_class(rr)));
+ else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) {
+ u_int16_t optcode, optlen, rdatalen = ns_rr_rdlen(rr);
+ u_int32_t ttl = ns_rr_ttl(rr);
+
+ fprintf(file,
+ "; EDNS: version: %u, udp=%u, flags=%04x\n",
+ (ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff);
+
+ while (rdatalen >= 4) {
+ const u_char *cp = ns_rr_rdata(rr);
+ int i;
+
+ GETSHORT(optcode, cp);
+ GETSHORT(optlen, cp);
+
+ if (optcode == NS_OPT_NSID) {
+ fputs("; NSID: ", file);
+ if (optlen == 0) {
+ fputs("; NSID\n", file);
+ } else {
+ fputs("; NSID: ", file);
+ for (i = 0; i < optlen; i++)
+ fprintf(file, "%02x ",
+ cp[i]);
+ fputs(" (",file);
+ for (i = 0; i < optlen; i++)
+ fprintf(file, "%c",
+ isprint(cp[i])?
+ cp[i] : '.');
+ fputs(")\n", file);
+ }
+ } else {
+ if (optlen == 0) {
+ fprintf(file, "; OPT=%u\n",
+ optcode);
+ } else {
+ fprintf(file, "; OPT=%u: ",
+ optcode);
+ for (i = 0; i < optlen; i++)
+ fprintf(file, "%02x ",
+ cp[i]);
+ fputs(" (",file);
+ for (i = 0; i < optlen; i++)
+ fprintf(file, "%c",
+ isprint(cp[i]) ?
+ cp[i] : '.');
+ fputs(")\n", file);
+ }
+ }
+ rdatalen -= 4 + optlen;
+ }
+ } else {
+ n = ns_sprintrr(handle, &rr, NULL, NULL,
+ buf, buflen);
+ if (n < 0) {
+ if (errno == ENOSPC) {
+ free(buf);
+ buf = NULL;
+ if (buflen < 131072)
+ buf = malloc(buflen += 1024);
+ if (buf == NULL) {
+ fprintf(file,
+ ";; memory allocation failure\n");
+ return;
+ }
+ continue;
+ }
+ fprintf(file, ";; ns_sprintrr: %s\n",
+ strerror(errno));
+ goto cleanup;
+ }
+ fputs(buf, file);
+ fputc('\n', file);
+ }
+ rrnum++;
+ }
+ cleanup:
+ if (buf != NULL)
+ free(buf);
+}
+
+/*%
+ * Print the contents of a query.
+ * This is intended to be primarily a debugging routine.
+ */
+void
+res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
+ ns_msg handle;
+ int qdcount, ancount, nscount, arcount;
+ u_int opcode, rcode, id;
+
+ if (ns_initparse(msg, len, &handle) < 0) {
+ fprintf(file, ";; ns_initparse: %s\n", strerror(errno));
+ return;
+ }
+ opcode = ns_msg_getflag(handle, ns_f_opcode);
+ rcode = ns_msg_getflag(handle, ns_f_rcode);
+ id = ns_msg_id(handle);
+ qdcount = ns_msg_count(handle, ns_s_qd);
+ ancount = ns_msg_count(handle, ns_s_an);
+ nscount = ns_msg_count(handle, ns_s_ns);
+ arcount = ns_msg_count(handle, ns_s_ar);
+
+ /*
+ * Print header fields.
+ */
+ if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEADX) || rcode)
+ fprintf(file,
+ ";; ->>HEADER<<- opcode: %s, status: %s, id: %d\n",
+ _res_opcodes[opcode], p_rcode(rcode), id);
+ if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEADX))
+ putc(';', file);
+ if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEAD2)) {
+ fprintf(file, "; flags:");
+ if (ns_msg_getflag(handle, ns_f_qr))
+ fprintf(file, " qr");
+ if (ns_msg_getflag(handle, ns_f_aa))
+ fprintf(file, " aa");
+ if (ns_msg_getflag(handle, ns_f_tc))
+ fprintf(file, " tc");
+ if (ns_msg_getflag(handle, ns_f_rd))
+ fprintf(file, " rd");
+ if (ns_msg_getflag(handle, ns_f_ra))
+ fprintf(file, " ra");
+ if (ns_msg_getflag(handle, ns_f_z))
+ fprintf(file, " ??");
+ if (ns_msg_getflag(handle, ns_f_ad))
+ fprintf(file, " ad");
+ if (ns_msg_getflag(handle, ns_f_cd))
+ fprintf(file, " cd");
+ }
+ if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEAD1)) {
+ fprintf(file, "; %s: %d",
+ p_section(ns_s_qd, opcode), qdcount);
+ fprintf(file, ", %s: %d",
+ p_section(ns_s_an, opcode), ancount);
+ fprintf(file, ", %s: %d",
+ p_section(ns_s_ns, opcode), nscount);
+ fprintf(file, ", %s: %d",
+ p_section(ns_s_ar, opcode), arcount);
+ }
+ if ((!statp->pfcode) || (statp->pfcode &
+ (RES_PRF_HEADX | RES_PRF_HEAD2 | RES_PRF_HEAD1))) {
+ putc('\n',file);
+ }
+ /*
+ * Print the various sections.
+ */
+ do_section(statp, &handle, ns_s_qd, RES_PRF_QUES, file);
+ do_section(statp, &handle, ns_s_an, RES_PRF_ANS, file);
+ do_section(statp, &handle, ns_s_ns, RES_PRF_AUTH, file);
+ do_section(statp, &handle, ns_s_ar, RES_PRF_ADD, file);
+ if (qdcount == 0 && ancount == 0 &&
+ nscount == 0 && arcount == 0)
+ putc('\n', file);
+}
+
+const u_char *
+p_cdnname(const u_char *cp, const u_char *msg, int len, FILE *file) {
+ char name[MAXDNAME];
+ int n;
+
+ if ((n = dn_expand(msg, msg + len, cp, name, sizeof name)) < 0)
+ return (NULL);
+ if (name[0] == '\0')
+ putc('.', file);
+ else
+ fputs(name, file);
+ return (cp + n);
+}
+
+const u_char *
+p_cdname(const u_char *cp, const u_char *msg, FILE *file) {
+ return (p_cdnname(cp, msg, PACKETSZ, file));
+}
+
+/*%
+ * Return a fully-qualified domain name from a compressed name (with
+ length supplied). */
+
+const u_char *
+p_fqnname(cp, msg, msglen, name, namelen)
+ const u_char *cp, *msg;
+ int msglen;
+ char *name;
+ int namelen;
+{
+ int n, newlen;
+
+ if ((n = dn_expand(msg, cp + msglen, cp, name, namelen)) < 0)
+ return (NULL);
+ newlen = strlen(name);
+ if (newlen == 0 || name[newlen - 1] != '.') {
+ if (newlen + 1 >= namelen) /*%< Lack space for final dot */
+ return (NULL);
+ else
+ strcpy(name + newlen, ".");
+ }
+ return (cp + n);
+}
+
+/* XXX: the rest of these functions need to become length-limited, too. */
+
+const u_char *
+p_fqname(const u_char *cp, const u_char *msg, FILE *file) {
+ char name[MAXDNAME];
+ const u_char *n;
+
+ n = p_fqnname(cp, msg, MAXCDNAME, name, sizeof name);
+ if (n == NULL)
+ return (NULL);
+ fputs(name, file);
+ return (n);
+}
+
+/*%
+ * Names of RR classes and qclasses. Classes and qclasses are the same, except
+ * that C_ANY is a qclass but not a class. (You can ask for records of class
+ * C_ANY, but you can't have any records of that class in the database.)
+ */
+const struct res_sym __p_class_syms[] = {
+ {C_IN, "IN", (char *)0},
+ {C_CHAOS, "CH", (char *)0},
+ {C_CHAOS, "CHAOS", (char *)0},
+ {C_HS, "HS", (char *)0},
+ {C_HS, "HESIOD", (char *)0},
+ {C_ANY, "ANY", (char *)0},
+ {C_NONE, "NONE", (char *)0},
+ {C_IN, (char *)0, (char *)0}
+};
+
+/*%
+ * Names of message sections.
+ */
+const struct res_sym __p_default_section_syms[] = {
+ {ns_s_qd, "QUERY", (char *)0},
+ {ns_s_an, "ANSWER", (char *)0},
+ {ns_s_ns, "AUTHORITY", (char *)0},
+ {ns_s_ar, "ADDITIONAL", (char *)0},
+ {0, (char *)0, (char *)0}
+};
+
+const struct res_sym __p_update_section_syms[] = {
+ {S_ZONE, "ZONE", (char *)0},
+ {S_PREREQ, "PREREQUISITE", (char *)0},
+ {S_UPDATE, "UPDATE", (char *)0},
+ {S_ADDT, "ADDITIONAL", (char *)0},
+ {0, (char *)0, (char *)0}
+};
+
+const struct res_sym __p_key_syms[] = {
+ {NS_ALG_MD5RSA, "RSA", "RSA KEY with MD5 hash"},
+ {NS_ALG_DH, "DH", "Diffie Hellman"},
+ {NS_ALG_DSA, "DSA", "Digital Signature Algorithm"},
+ {NS_ALG_EXPIRE_ONLY, "EXPIREONLY", "No algorithm"},
+ {NS_ALG_PRIVATE_OID, "PRIVATE", "Algorithm obtained from OID"},
+ {0, NULL, NULL}
+};
+
+const struct res_sym __p_cert_syms[] = {
+ {cert_t_pkix, "PKIX", "PKIX (X.509v3) Certificate"},
+ {cert_t_spki, "SPKI", "SPKI certificate"},
+ {cert_t_pgp, "PGP", "PGP certificate"},
+ {cert_t_url, "URL", "URL Private"},
+ {cert_t_oid, "OID", "OID Private"},
+ {0, NULL, NULL}
+};
+
+/*%
+ * Names of RR types and qtypes. Types and qtypes are the same, except
+ * that T_ANY is a qtype but not a type. (You can ask for records of type
+ * T_ANY, but you can't have any records of that type in the database.)
+ */
+const struct res_sym __p_type_syms[] = {
+ {ns_t_a, "A", "address"},
+ {ns_t_ns, "NS", "name server"},
+ {ns_t_md, "MD", "mail destination (deprecated)"},
+ {ns_t_mf, "MF", "mail forwarder (deprecated)"},
+ {ns_t_cname, "CNAME", "canonical name"},
+ {ns_t_soa, "SOA", "start of authority"},
+ {ns_t_mb, "MB", "mailbox"},
+ {ns_t_mg, "MG", "mail group member"},
+ {ns_t_mr, "MR", "mail rename"},
+ {ns_t_null, "NULL", "null"},
+ {ns_t_wks, "WKS", "well-known service (deprecated)"},
+ {ns_t_ptr, "PTR", "domain name pointer"},
+ {ns_t_hinfo, "HINFO", "host information"},
+ {ns_t_minfo, "MINFO", "mailbox information"},
+ {ns_t_mx, "MX", "mail exchanger"},
+ {ns_t_txt, "TXT", "text"},
+ {ns_t_rp, "RP", "responsible person"},
+ {ns_t_afsdb, "AFSDB", "DCE or AFS server"},
+ {ns_t_x25, "X25", "X25 address"},
+ {ns_t_isdn, "ISDN", "ISDN address"},
+ {ns_t_rt, "RT", "router"},
+ {ns_t_nsap, "NSAP", "nsap address"},
+ {ns_t_nsap_ptr, "NSAP_PTR", "domain name pointer"},
+ {ns_t_sig, "SIG", "signature"},
+ {ns_t_key, "KEY", "key"},
+ {ns_t_px, "PX", "mapping information"},
+ {ns_t_gpos, "GPOS", "geographical position (withdrawn)"},
+ {ns_t_aaaa, "AAAA", "IPv6 address"},
+ {ns_t_loc, "LOC", "location"},
+ {ns_t_nxt, "NXT", "next valid name (unimplemented)"},
+ {ns_t_eid, "EID", "endpoint identifier (unimplemented)"},
+ {ns_t_nimloc, "NIMLOC", "NIMROD locator (unimplemented)"},
+ {ns_t_srv, "SRV", "server selection"},
+ {ns_t_atma, "ATMA", "ATM address (unimplemented)"},
+ {ns_t_naptr, "NAPTR", "naptr"},
+ {ns_t_kx, "KX", "key exchange"},
+ {ns_t_cert, "CERT", "certificate"},
+ {ns_t_a6, "A", "IPv6 address (experminental)"},
+ {ns_t_dname, "DNAME", "non-terminal redirection"},
+ {ns_t_opt, "OPT", "opt"},
+ {ns_t_apl, "apl", "apl"},
+ {ns_t_ds, "DS", "delegation signer"},
+ {ns_t_sshfp, "SSFP", "SSH fingerprint"},
+ {ns_t_ipseckey, "IPSECKEY", "IPSEC key"},
+ {ns_t_rrsig, "RRSIG", "rrsig"},
+ {ns_t_nsec, "NSEC", "nsec"},
+ {ns_t_dnskey, "DNSKEY", "DNS key"},
+ {ns_t_dhcid, "DHCID", "dynamic host configuration identifier"},
+ {ns_t_nsec3, "NSEC3", "nsec3"},
+ {ns_t_nsec3param, "NSEC3PARAM", "NSEC3 parameters"},
+ {ns_t_hip, "HIP", "host identity protocol"},
+ {ns_t_spf, "SPF", "sender policy framework"},
+ {ns_t_tkey, "TKEY", "tkey"},
+ {ns_t_tsig, "TSIG", "transaction signature"},
+ {ns_t_ixfr, "IXFR", "incremental zone transfer"},
+ {ns_t_axfr, "AXFR", "zone transfer"},
+ {ns_t_zxfr, "ZXFR", "compressed zone transfer"},
+ {ns_t_mailb, "MAILB", "mailbox-related data (deprecated)"},
+ {ns_t_maila, "MAILA", "mail agent (deprecated)"},
+ {ns_t_naptr, "NAPTR", "URN Naming Authority"},
+ {ns_t_kx, "KX", "Key Exchange"},
+ {ns_t_cert, "CERT", "Certificate"},
+ {ns_t_a6, "A6", "IPv6 Address"},
+ {ns_t_dname, "DNAME", "dname"},
+ {ns_t_sink, "SINK", "Kitchen Sink (experimental)"},
+ {ns_t_opt, "OPT", "EDNS Options"},
+ {ns_t_any, "ANY", "\"any\""},
+ {ns_t_dlv, "DLV", "DNSSEC look-aside validation"},
+ {0, NULL, NULL}
+};
+
+/*%
+ * Names of DNS rcodes.
+ */
+const struct res_sym __p_rcode_syms[] = {
+ {ns_r_noerror, "NOERROR", "no error"},
+ {ns_r_formerr, "FORMERR", "format error"},
+ {ns_r_servfail, "SERVFAIL", "server failed"},
+ {ns_r_nxdomain, "NXDOMAIN", "no such domain name"},
+ {ns_r_notimpl, "NOTIMP", "not implemented"},
+ {ns_r_refused, "REFUSED", "refused"},
+ {ns_r_yxdomain, "YXDOMAIN", "domain name exists"},
+ {ns_r_yxrrset, "YXRRSET", "rrset exists"},
+ {ns_r_nxrrset, "NXRRSET", "rrset doesn't exist"},
+ {ns_r_notauth, "NOTAUTH", "not authoritative"},
+ {ns_r_notzone, "NOTZONE", "Not in zone"},
+ {ns_r_max, "", ""},
+ {ns_r_badsig, "BADSIG", "bad signature"},
+ {ns_r_badkey, "BADKEY", "bad key"},
+ {ns_r_badtime, "BADTIME", "bad time"},
+ {0, NULL, NULL}
+};
+
+int
+sym_ston(const struct res_sym *syms, const char *name, int *success) {
+ for ((void)NULL; syms->name != 0; syms++) {
+ if (strcasecmp (name, syms->name) == 0) {
+ if (success)
+ *success = 1;
+ return (syms->number);
+ }
+ }
+ if (success)
+ *success = 0;
+ return (syms->number); /*%< The default value. */
+}
+
+const char *
+sym_ntos(const struct res_sym *syms, int number, int *success) {
+ char *unname = sym_ntos_unname;
+
+ for ((void)NULL; syms->name != 0; syms++) {
+ if (number == syms->number) {
+ if (success)
+ *success = 1;
+ return (syms->name);
+ }
+ }
+
+ sprintf(unname, "%d", number); /*%< XXX nonreentrant */
+ if (success)
+ *success = 0;
+ return (unname);
+}
+
+const char *
+sym_ntop(const struct res_sym *syms, int number, int *success) {
+ char *unname = sym_ntop_unname;
+
+ for ((void)NULL; syms->name != 0; syms++) {
+ if (number == syms->number) {
+ if (success)
+ *success = 1;
+ return (syms->humanname);
+ }
+ }
+ sprintf(unname, "%d", number); /*%< XXX nonreentrant */
+ if (success)
+ *success = 0;
+ return (unname);
+}
+
+/*%
+ * Return a string for the type.
+ */
+const char *
+p_type(int type) {
+ int success;
+ const char *result;
+ static char typebuf[20];
+
+ result = sym_ntos(__p_type_syms, type, &success);
+ if (success)
+ return (result);
+ if (type < 0 || type > 0xffff)
+ return ("BADTYPE");
+ sprintf(typebuf, "TYPE%d", type);
+ return (typebuf);
+}
+
+/*%
+ * Return a string for the type.
+ */
+const char *
+p_section(int section, int opcode) {
+ const struct res_sym *symbols;
+
+ switch (opcode) {
+ case ns_o_update:
+ symbols = __p_update_section_syms;
+ break;
+ default:
+ symbols = __p_default_section_syms;
+ break;
+ }
+ return (sym_ntos(symbols, section, (int *)0));
+}
+
+/*%
+ * Return a mnemonic for class.
+ */
+const char *
+p_class(int class) {
+ int success;
+ const char *result;
+ static char classbuf[20];
+
+ result = sym_ntos(__p_class_syms, class, &success);
+ if (success)
+ return (result);
+ if (class < 0 || class > 0xffff)
+ return ("BADCLASS");
+ sprintf(classbuf, "CLASS%d", class);
+ return (classbuf);
+}
+
+/*%
+ * Return a mnemonic for an option
+ */
+const char *
+p_option(u_long option) {
+ char *nbuf = p_option_nbuf;
+
+ switch (option) {
+ case RES_INIT: return "init";
+ case RES_DEBUG: return "debug";
+ case RES_AAONLY: return "aaonly(unimpl)";
+ case RES_USEVC: return "usevc";
+ case RES_PRIMARY: return "primry(unimpl)";
+ case RES_IGNTC: return "igntc";
+ case RES_RECURSE: return "recurs";
+ case RES_DEFNAMES: return "defnam";
+ case RES_STAYOPEN: return "styopn";
+ case RES_DNSRCH: return "dnsrch";
+ case RES_INSECURE1: return "insecure1";
+ case RES_INSECURE2: return "insecure2";
+ case RES_NOALIASES: return "noaliases";
+ case RES_USE_INET6: return "inet6";
+#ifdef RES_USE_EDNS0 /*%< KAME extension */
+ case RES_USE_EDNS0: return "edns0";
+ case RES_NSID: return "nsid";
+#endif
+#ifdef RES_USE_DNAME
+ case RES_USE_DNAME: return "dname";
+#endif
+#ifdef RES_USE_DNSSEC
+ case RES_USE_DNSSEC: return "dnssec";
+#endif
+#ifdef RES_NOTLDQUERY
+ case RES_NOTLDQUERY: return "no-tld-query";
+#endif
+#ifdef RES_NO_NIBBLE2
+ case RES_NO_NIBBLE2: return "no-nibble2";
+#endif
+ /* XXX nonreentrant */
+ default: sprintf(nbuf, "?0x%lx?", (u_long)option);
+ return (nbuf);
+ }
+}
+
+/*%
+ * Return a mnemonic for a time to live.
+ */
+const char *
+p_time(u_int32_t value) {
+ char *nbuf = p_time_nbuf;
+
+ if (ns_format_ttl(value, nbuf, sizeof nbuf) < 0)
+ sprintf(nbuf, "%u", value);
+ return (nbuf);
+}
+
+/*%
+ * Return a string for the rcode.
+ */
+const char *
+p_rcode(int rcode) {
+ return (sym_ntos(__p_rcode_syms, rcode, (int *)0));
+}
+
+/*%
+ * Return a string for a res_sockaddr_union.
+ */
+const char *
+p_sockun(union res_sockaddr_union u, char *buf, size_t size) {
+ char ret[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:123.123.123.123"];
+
+ switch (u.sin.sin_family) {
+ case AF_INET:
+ inet_ntop(AF_INET, &u.sin.sin_addr, ret, sizeof ret);
+ break;
+#ifdef HAS_INET6_STRUCTS
+ case AF_INET6:
+ inet_ntop(AF_INET6, &u.sin6.sin6_addr, ret, sizeof ret);
+ break;
+#endif
+ default:
+ sprintf(ret, "[af%d]", u.sin.sin_family);
+ break;
+ }
+ if (size > 0U) {
+ strncpy(buf, ret, size - 1);
+ buf[size - 1] = '0';
+ }
+ return (buf);
+}
+
+/*%
+ * routines to convert between on-the-wire RR format and zone file format.
+ * Does not contain conversion to/from decimal degrees; divide or multiply
+ * by 60*60*1000 for that.
+ */
+
+static unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
+ 1000000,10000000,100000000,1000000000};
+
+/*% takes an XeY precision/size value, returns a string representation. */
+static const char *
+precsize_ntoa(prec)
+ u_int8_t prec;
+{
+ char *retbuf = precsize_ntoa_retbuf;
+ unsigned long val;
+ int mantissa, exponent;
+
+ mantissa = (int)((prec >> 4) & 0x0f) % 10;
+ exponent = (int)((prec >> 0) & 0x0f) % 10;
+
+ val = mantissa * poweroften[exponent];
+
+ (void) sprintf(retbuf, "%lu.%.2lu", val/100, val%100);
+ return (retbuf);
+}
+
+/*% converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
+static u_int8_t
+precsize_aton(const char **strptr) {
+ unsigned int mval = 0, cmval = 0;
+ u_int8_t retval = 0;
+ const char *cp;
+ int exponent;
+ int mantissa;
+
+ cp = *strptr;
+
+ while (isdigit((unsigned char)*cp))
+ mval = mval * 10 + (*cp++ - '0');
+
+ if (*cp == '.') { /*%< centimeters */
+ cp++;
+ if (isdigit((unsigned char)*cp)) {
+ cmval = (*cp++ - '0') * 10;
+ if (isdigit((unsigned char)*cp)) {
+ cmval += (*cp++ - '0');
+ }
+ }
+ }
+ cmval = (mval * 100) + cmval;
+
+ for (exponent = 0; exponent < 9; exponent++)
+ if (cmval < poweroften[exponent+1])
+ break;
+
+ mantissa = cmval / poweroften[exponent];
+ if (mantissa > 9)
+ mantissa = 9;
+
+ retval = (mantissa << 4) | exponent;
+
+ *strptr = cp;
+
+ return (retval);
+}
+
+/*% converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
+static u_int32_t
+latlon2ul(const char **latlonstrptr, int *which) {
+ const char *cp;
+ u_int32_t retval;
+ int deg = 0, min = 0, secs = 0, secsfrac = 0;
+
+ cp = *latlonstrptr;
+
+ while (isdigit((unsigned char)*cp))
+ deg = deg * 10 + (*cp++ - '0');
+
+ while (isspace((unsigned char)*cp))
+ cp++;
+
+ if (!(isdigit((unsigned char)*cp)))
+ goto fndhemi;
+
+ while (isdigit((unsigned char)*cp))
+ min = min * 10 + (*cp++ - '0');
+
+ while (isspace((unsigned char)*cp))
+ cp++;
+
+ if (!(isdigit((unsigned char)*cp)))
+ goto fndhemi;
+
+ while (isdigit((unsigned char)*cp))
+ secs = secs * 10 + (*cp++ - '0');
+
+ if (*cp == '.') { /*%< decimal seconds */
+ cp++;
+ if (isdigit((unsigned char)*cp)) {
+ secsfrac = (*cp++ - '0') * 100;
+ if (isdigit((unsigned char)*cp)) {
+ secsfrac += (*cp++ - '0') * 10;
+ if (isdigit((unsigned char)*cp)) {
+ secsfrac += (*cp++ - '0');
+ }
+ }
+ }
+ }
+
+ while (!isspace((unsigned char)*cp)) /*%< if any trailing garbage */
+ cp++;
+
+ while (isspace((unsigned char)*cp))
+ cp++;
+
+ fndhemi:
+ switch (*cp) {
+ case 'N': case 'n':
+ case 'E': case 'e':
+ retval = ((unsigned)1<<31)
+ + (((((deg * 60) + min) * 60) + secs) * 1000)
+ + secsfrac;
+ break;
+ case 'S': case 's':
+ case 'W': case 'w':
+ retval = ((unsigned)1<<31)
+ - (((((deg * 60) + min) * 60) + secs) * 1000)
+ - secsfrac;
+ break;
+ default:
+ retval = 0; /*%< invalid value -- indicates error */
+ break;
+ }
+
+ switch (*cp) {
+ case 'N': case 'n':
+ case 'S': case 's':
+ *which = 1; /*%< latitude */
+ break;
+ case 'E': case 'e':
+ case 'W': case 'w':
+ *which = 2; /*%< longitude */
+ break;
+ default:
+ *which = 0; /*%< error */
+ break;
+ }
+
+ cp++; /*%< skip the hemisphere */
+ while (!isspace((unsigned char)*cp)) /*%< if any trailing garbage */
+ cp++;
+
+ while (isspace((unsigned char)*cp)) /*%< move to next field */
+ cp++;
+
+ *latlonstrptr = cp;
+
+ return (retval);
+}
+
+/*%
+ * converts a zone file representation in a string to an RDATA on-the-wire
+ * representation. */
+int
+loc_aton(ascii, binary)
+ const char *ascii;
+ u_char *binary;
+{
+ const char *cp, *maxcp;
+ u_char *bcp;
+
+ u_int32_t latit = 0, longit = 0, alt = 0;
+ u_int32_t lltemp1 = 0, lltemp2 = 0;
+ int altmeters = 0, altfrac = 0, altsign = 1;
+ u_int8_t hp = 0x16; /*%< default = 1e6 cm = 10000.00m = 10km */
+ u_int8_t vp = 0x13; /*%< default = 1e3 cm = 10.00m */
+ u_int8_t siz = 0x12; /*%< default = 1e2 cm = 1.00m */
+ int which1 = 0, which2 = 0;
+
+ cp = ascii;
+ maxcp = cp + strlen(ascii);
+
+ lltemp1 = latlon2ul(&cp, &which1);
+
+ lltemp2 = latlon2ul(&cp, &which2);
+
+ switch (which1 + which2) {
+ case 3: /*%< 1 + 2, the only valid combination */
+ if ((which1 == 1) && (which2 == 2)) { /*%< normal case */
+ latit = lltemp1;
+ longit = lltemp2;
+ } else if ((which1 == 2) && (which2 == 1)) { /*%< reversed */
+ longit = lltemp1;
+ latit = lltemp2;
+ } else { /*%< some kind of brokenness */
+ return (0);
+ }
+ break;
+ default: /*%< we didn't get one of each */
+ return (0);
+ }
+
+ /* altitude */
+ if (*cp == '-') {
+ altsign = -1;
+ cp++;
+ }
+
+ if (*cp == '+')
+ cp++;
+
+ while (isdigit((unsigned char)*cp))
+ altmeters = altmeters * 10 + (*cp++ - '0');
+
+ if (*cp == '.') { /*%< decimal meters */
+ cp++;
+ if (isdigit((unsigned char)*cp)) {
+ altfrac = (*cp++ - '0') * 10;
+ if (isdigit((unsigned char)*cp)) {
+ altfrac += (*cp++ - '0');
+ }
+ }
+ }
+
+ alt = (10000000 + (altsign * (altmeters * 100 + altfrac)));
+
+ while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */
+ cp++;
+
+ while (isspace((unsigned char)*cp) && (cp < maxcp))
+ cp++;
+
+ if (cp >= maxcp)
+ goto defaults;
+
+ siz = precsize_aton(&cp);
+
+ while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */
+ cp++;
+
+ while (isspace((unsigned char)*cp) && (cp < maxcp))
+ cp++;
+
+ if (cp >= maxcp)
+ goto defaults;
+
+ hp = precsize_aton(&cp);
+
+ while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */
+ cp++;
+
+ while (isspace((unsigned char)*cp) && (cp < maxcp))
+ cp++;
+
+ if (cp >= maxcp)
+ goto defaults;
+
+ vp = precsize_aton(&cp);
+
+ defaults:
+
+ bcp = binary;
+ *bcp++ = (u_int8_t) 0; /*%< version byte */
+ *bcp++ = siz;
+ *bcp++ = hp;
+ *bcp++ = vp;
+ PUTLONG(latit,bcp);
+ PUTLONG(longit,bcp);
+ PUTLONG(alt,bcp);
+
+ return (16); /*%< size of RR in octets */
+}
+
+/*% takes an on-the-wire LOC RR and formats it in a human readable format. */
+const char *
+loc_ntoa(binary, ascii)
+ const u_char *binary;
+ char *ascii;
+{
+ static const char *error = "?";
+ static char tmpbuf[sizeof
+"1000 60 60.000 N 1000 60 60.000 W -12345678.00m 90000000.00m 90000000.00m 90000000.00m"];
+ const u_char *cp = binary;
+
+ int latdeg, latmin, latsec, latsecfrac;
+ int longdeg, longmin, longsec, longsecfrac;
+ char northsouth, eastwest;
+ const char *altsign;
+ int altmeters, altfrac;
+
+ const u_int32_t referencealt = 100000 * 100;
+
+ int32_t latval, longval, altval;
+ u_int32_t templ;
+ u_int8_t sizeval, hpval, vpval, versionval;
+
+ char *sizestr, *hpstr, *vpstr;
+
+ versionval = *cp++;
+
+ if (ascii == NULL)
+ ascii = tmpbuf;
+
+ if (versionval) {
+ (void) sprintf(ascii, "; error: unknown LOC RR version");
+ return (ascii);
+ }
+
+ sizeval = *cp++;
+
+ hpval = *cp++;
+ vpval = *cp++;
+
+ GETLONG(templ, cp);
+ latval = (templ - ((unsigned)1<<31));
+
+ GETLONG(templ, cp);
+ longval = (templ - ((unsigned)1<<31));
+
+ GETLONG(templ, cp);
+ if (templ < referencealt) { /*%< below WGS 84 spheroid */
+ altval = referencealt - templ;
+ altsign = "-";
+ } else {
+ altval = templ - referencealt;
+ altsign = "";
+ }
+
+ if (latval < 0) {
+ northsouth = 'S';
+ latval = -latval;
+ } else
+ northsouth = 'N';
+
+ latsecfrac = latval % 1000;
+ latval = latval / 1000;
+ latsec = latval % 60;
+ latval = latval / 60;
+ latmin = latval % 60;
+ latval = latval / 60;
+ latdeg = latval;
+
+ if (longval < 0) {
+ eastwest = 'W';
+ longval = -longval;
+ } else
+ eastwest = 'E';
+
+ longsecfrac = longval % 1000;
+ longval = longval / 1000;
+ longsec = longval % 60;
+ longval = longval / 60;
+ longmin = longval % 60;
+ longval = longval / 60;
+ longdeg = longval;
+
+ altfrac = altval % 100;
+ altmeters = (altval / 100);
+
+ sizestr = strdup(precsize_ntoa(sizeval));
+ hpstr = strdup(precsize_ntoa(hpval));
+ vpstr = strdup(precsize_ntoa(vpval));
+
+ sprintf(ascii,
+ "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %s%d.%.2dm %sm %sm %sm",
+ latdeg, latmin, latsec, latsecfrac, northsouth,
+ longdeg, longmin, longsec, longsecfrac, eastwest,
+ altsign, altmeters, altfrac,
+ (sizestr != NULL) ? sizestr : error,
+ (hpstr != NULL) ? hpstr : error,
+ (vpstr != NULL) ? vpstr : error);
+
+ if (sizestr != NULL)
+ free(sizestr);
+ if (hpstr != NULL)
+ free(hpstr);
+ if (vpstr != NULL)
+ free(vpstr);
+
+ return (ascii);
+}
+
+
+/*% Return the number of DNS hierarchy levels in the name. */
+int
+dn_count_labels(const char *name) {
+ int i, len, count;
+
+ len = strlen(name);
+ for (i = 0, count = 0; i < len; i++) {
+ /* XXX need to check for \. or use named's nlabels(). */
+ if (name[i] == '.')
+ count++;
+ }
+
+ /* don't count initial wildcard */
+ if (name[0] == '*')
+ if (count)
+ count--;
+
+ /* don't count the null label for root. */
+ /* if terminating '.' not found, must adjust */
+ /* count to include last label */
+ if (len > 0 && name[len-1] != '.')
+ count++;
+ return (count);
+}
+
+/*%
+ * Make dates expressed in seconds-since-Jan-1-1970 easy to read.
+ * SIG records are required to be printed like this, by the Secure DNS RFC.
+ */
+char *
+p_secstodate (u_long secs) {
+ char *output = p_secstodate_output;
+ time_t clock = secs;
+ struct tm *time;
+#ifdef HAVE_TIME_R
+ struct tm res;
+
+ time = gmtime_r(&clock, &res);
+#else
+ time = gmtime(&clock);
+#endif
+ time->tm_year += 1900;
+ time->tm_mon += 1;
+ sprintf(output, "%04d%02d%02d%02d%02d%02d",
+ time->tm_year, time->tm_mon, time->tm_mday,
+ time->tm_hour, time->tm_min, time->tm_sec);
+ return (output);
+}
+
+u_int16_t
+res_nametoclass(const char *buf, int *successp) {
+ unsigned long result;
+ char *endptr;
+ int success;
+
+ result = sym_ston(__p_class_syms, buf, &success);
+ if (success)
+ goto done;
+
+ if (strncasecmp(buf, "CLASS", 5) != 0 ||
+ !isdigit((unsigned char)buf[5]))
+ goto done;
+ errno = 0;
+ result = strtoul(buf + 5, &endptr, 10);
+ if (errno == 0 && *endptr == '\0' && result <= 0xffffU)
+ success = 1;
+ done:
+ if (successp)
+ *successp = success;
+ return (result);
+}
+
+u_int16_t
+res_nametotype(const char *buf, int *successp) {
+ unsigned long result;
+ char *endptr;
+ int success;
+
+ result = sym_ston(__p_type_syms, buf, &success);
+ if (success)
+ goto done;
+
+ if (strncasecmp(buf, "type", 4) != 0 ||
+ !isdigit((unsigned char)buf[4]))
+ goto done;
+ errno = 0;
+ result = strtoul(buf + 4, &endptr, 10);
+ if (errno == 0 && *endptr == '\0' && result <= 0xffffU)
+ success = 1;
+ done:
+ if (successp)
+ *successp = success;
+ return (result);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_debug.h b/usr/src/lib/libresolv2_joy/common/resolv/res_debug.h
new file mode 100644
index 0000000000..c28171d7c8
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_debug.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _RES_DEBUG_H_
+#define _RES_DEBUG_H_
+
+#ifndef DEBUG
+# define Dprint(cond, args) /*empty*/
+# define DprintQ(cond, args, query, size) /*empty*/
+# define Aerror(statp, file, string, error, address) /*empty*/
+# define Perror(statp, file, string, error) /*empty*/
+#else
+# define Dprint(cond, args) if (cond) {fprintf args;} else {}
+# define DprintQ(cond, args, query, size) if (cond) {\
+ fprintf args;\
+ res_pquery(statp, query, size, stdout);\
+ } else {}
+#endif
+
+#endif /* _RES_DEBUG_H_ */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_findzonecut.c b/usr/src/lib/libresolv2_joy/common/resolv/res_findzonecut.c
new file mode 100644
index 0000000000..431c0262c1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_findzonecut.c
@@ -0,0 +1,722 @@
+#if !defined(lint) && !defined(SABER)
+static const char rcsid[] = "$Id: res_findzonecut.c,v 1.10 2005/10/11 00:10:16 marka Exp $";
+#endif /* not lint */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* Import. */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <netdb.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/list.h>
+
+#include "port_after.h"
+
+#include <resolv_joy.h>
+
+/* Data structures. */
+
+typedef struct rr_a {
+ LINK(struct rr_a) link;
+ union res_sockaddr_union addr;
+} rr_a;
+typedef LIST(rr_a) rrset_a;
+
+typedef struct rr_ns {
+ LINK(struct rr_ns) link;
+ const char * name;
+ unsigned int flags;
+ rrset_a addrs;
+} rr_ns;
+typedef LIST(rr_ns) rrset_ns;
+
+#define RR_NS_HAVE_V4 0x01
+#define RR_NS_HAVE_V6 0x02
+
+/* Forward. */
+
+static int satisfy(res_state, const char *, rrset_ns *,
+ union res_sockaddr_union *, int);
+static int add_addrs(res_state, rr_ns *,
+ union res_sockaddr_union *, int);
+static int get_soa(res_state, const char *, ns_class, int,
+ char *, size_t, char *, size_t,
+ rrset_ns *);
+static int get_ns(res_state, const char *, ns_class, int, rrset_ns *);
+static int get_glue(res_state, ns_class, int, rrset_ns *);
+static int save_ns(res_state, ns_msg *, ns_sect,
+ const char *, ns_class, int, rrset_ns *);
+static int save_a(res_state, ns_msg *, ns_sect,
+ const char *, ns_class, int, rr_ns *);
+static void free_nsrrset(rrset_ns *);
+static void free_nsrr(rrset_ns *, rr_ns *);
+static rr_ns * find_ns(rrset_ns *, const char *);
+static int do_query(res_state, const char *, ns_class, ns_type,
+ u_char *, ns_msg *);
+static void res_dprintf(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
+
+/* Macros. */
+
+#define DPRINTF(x) do {\
+ int save_errno = errno; \
+ if ((statp->options & RES_DEBUG) != 0U) res_dprintf x; \
+ errno = save_errno; \
+ } while (0)
+
+/* Public. */
+
+/*%
+ * find enclosing zone for a <dname,class>, and some server addresses
+ *
+ * parameters:
+ *\li res - resolver context to work within (is modified)
+ *\li dname - domain name whose enclosing zone is desired
+ *\li class - class of dname (and its enclosing zone)
+ *\li zname - found zone name
+ *\li zsize - allocated size of zname
+ *\li addrs - found server addresses
+ *\li naddrs - max number of addrs
+ *
+ * return values:
+ *\li < 0 - an error occurred (check errno)
+ *\li = 0 - zname is now valid, but addrs[] wasn't changed
+ *\li > 0 - zname is now valid, and return value is number of addrs[] found
+ *
+ * notes:
+ *\li this function calls res_nsend() which means it depends on correctly
+ * functioning recursive nameservers (usually defined in /etc/resolv.conf
+ * or its local equivilent).
+ *
+ *\li we start by asking for an SOA<dname,class>. if we get one as an
+ * answer, that just means <dname,class> is a zone top, which is fine.
+ * more than likely we'll be told to go pound sand, in the form of a
+ * negative answer.
+ *
+ *\li note that we are not prepared to deal with referrals since that would
+ * only come from authority servers and our correctly functioning local
+ * recursive server would have followed the referral and got us something
+ * more definite.
+ *
+ *\li if the authority section contains an SOA, this SOA should also be the
+ * closest enclosing zone, since any intermediary zone cuts would've been
+ * returned as referrals and dealt with by our correctly functioning local
+ * recursive name server. but an SOA in the authority section should NOT
+ * match our dname (since that would have been returned in the answer
+ * section). an authority section SOA has to be "above" our dname.
+ *
+ *\li however, since authority section SOA's were once optional, it's
+ * possible that we'll have to go hunting for the enclosing SOA by
+ * ripping labels off the front of our dname -- this is known as "doing
+ * it the hard way."
+ *
+ *\li ultimately we want some server addresses, which are ideally the ones
+ * pertaining to the SOA.MNAME, but only if there is a matching NS RR.
+ * so the second phase (after we find an SOA) is to go looking for the
+ * NS RRset for that SOA's zone.
+ *
+ *\li no answer section processed by this code is allowed to contain CNAME
+ * or DNAME RR's. for the SOA query this means we strip a label and
+ * keep going. for the NS and A queries this means we just give up.
+ */
+
+int
+res_findzonecut(res_state statp, const char *dname, ns_class class, int opts,
+ char *zname, size_t zsize, struct in_addr *addrs, int naddrs)
+{
+ int result, i;
+ union res_sockaddr_union *u;
+
+
+ opts |= RES_IPV4ONLY;
+ opts &= ~RES_IPV6ONLY;
+
+ u = calloc(naddrs, sizeof(*u));
+ if (u == NULL)
+ return(-1);
+
+ result = res_findzonecut2(statp, dname, class, opts, zname, zsize,
+ u, naddrs);
+
+ for (i = 0; i < result; i++) {
+ addrs[i] = u[i].sin.sin_addr;
+ }
+ free(u);
+ return (result);
+}
+
+int
+res_findzonecut2(res_state statp, const char *dname, ns_class class, int opts,
+ char *zname, size_t zsize, union res_sockaddr_union *addrs,
+ int naddrs)
+{
+ char mname[NS_MAXDNAME];
+ u_long save_pfcode;
+ rrset_ns nsrrs;
+ int n;
+
+ DPRINTF(("START dname='%s' class=%s, zsize=%ld, naddrs=%d",
+ dname, p_class(class), (long)zsize, naddrs));
+ save_pfcode = statp->pfcode;
+ statp->pfcode |= RES_PRF_HEAD2 | RES_PRF_HEAD1 | RES_PRF_HEADX |
+ RES_PRF_QUES | RES_PRF_ANS |
+ RES_PRF_AUTH | RES_PRF_ADD;
+ INIT_LIST(nsrrs);
+
+ DPRINTF(("get the soa, and see if it has enough glue"));
+ if ((n = get_soa(statp, dname, class, opts, zname, zsize,
+ mname, sizeof mname, &nsrrs)) < 0 ||
+ ((opts & RES_EXHAUSTIVE) == 0 &&
+ (n = satisfy(statp, mname, &nsrrs, addrs, naddrs)) > 0))
+ goto done;
+
+ DPRINTF(("get the ns rrset and see if it has enough glue"));
+ if ((n = get_ns(statp, zname, class, opts, &nsrrs)) < 0 ||
+ ((opts & RES_EXHAUSTIVE) == 0 &&
+ (n = satisfy(statp, mname, &nsrrs, addrs, naddrs)) > 0))
+ goto done;
+
+ DPRINTF(("get the missing glue and see if it's finally enough"));
+ if ((n = get_glue(statp, class, opts, &nsrrs)) >= 0)
+ n = satisfy(statp, mname, &nsrrs, addrs, naddrs);
+
+ done:
+ DPRINTF(("FINISH n=%d (%s)", n, (n < 0) ? strerror(errno) : "OK"));
+ free_nsrrset(&nsrrs);
+ statp->pfcode = save_pfcode;
+ return (n);
+}
+
+/* Private. */
+
+static int
+satisfy(res_state statp, const char *mname, rrset_ns *nsrrsp,
+ union res_sockaddr_union *addrs, int naddrs)
+{
+ rr_ns *nsrr;
+ int n, x;
+
+ n = 0;
+ nsrr = find_ns(nsrrsp, mname);
+ if (nsrr != NULL) {
+ x = add_addrs(statp, nsrr, addrs, naddrs);
+ addrs += x;
+ naddrs -= x;
+ n += x;
+ }
+ for (nsrr = HEAD(*nsrrsp);
+ nsrr != NULL && naddrs > 0;
+ nsrr = NEXT(nsrr, link))
+ if (ns_samename(nsrr->name, mname) != 1) {
+ x = add_addrs(statp, nsrr, addrs, naddrs);
+ addrs += x;
+ naddrs -= x;
+ n += x;
+ }
+ DPRINTF(("satisfy(%s): %d", mname, n));
+ return (n);
+}
+
+static int
+add_addrs(res_state statp, rr_ns *nsrr,
+ union res_sockaddr_union *addrs, int naddrs)
+{
+ rr_a *arr;
+ int n = 0;
+
+ for (arr = HEAD(nsrr->addrs); arr != NULL; arr = NEXT(arr, link)) {
+ if (naddrs <= 0)
+ return (0);
+ *addrs++ = arr->addr;
+ naddrs--;
+ n++;
+ }
+ DPRINTF(("add_addrs: %d", n));
+ return (n);
+}
+
+static int
+get_soa(res_state statp, const char *dname, ns_class class, int opts,
+ char *zname, size_t zsize, char *mname, size_t msize,
+ rrset_ns *nsrrsp)
+{
+ char tname[NS_MAXDNAME];
+ u_char *resp = NULL;
+ int n, i, ancount, nscount;
+ ns_sect sect;
+ ns_msg msg;
+ u_int rcode;
+
+ /*
+ * Find closest enclosing SOA, even if it's for the root zone.
+ */
+
+ /* First canonicalize dname (exactly one unescaped trailing "."). */
+ if (ns_makecanon(dname, tname, sizeof tname) < 0)
+ goto cleanup;
+ dname = tname;
+
+ resp = malloc(NS_MAXMSG);
+ if (resp == NULL)
+ goto cleanup;
+
+ /* Now grovel the subdomains, hunting for an SOA answer or auth. */
+ for (;;) {
+ /* Leading or inter-label '.' are skipped here. */
+ while (*dname == '.')
+ dname++;
+
+ /* Is there an SOA? */
+ n = do_query(statp, dname, class, ns_t_soa, resp, &msg);
+ if (n < 0) {
+ DPRINTF(("get_soa: do_query('%s', %s) failed (%d)",
+ dname, p_class(class), n));
+ goto cleanup;
+ }
+ if (n > 0) {
+ DPRINTF(("get_soa: CNAME or DNAME found"));
+ sect = ns_s_max, n = 0;
+ } else {
+ rcode = ns_msg_getflag(msg, ns_f_rcode);
+ ancount = ns_msg_count(msg, ns_s_an);
+ nscount = ns_msg_count(msg, ns_s_ns);
+ if (ancount > 0 && rcode == ns_r_noerror)
+ sect = ns_s_an, n = ancount;
+ else if (nscount > 0)
+ sect = ns_s_ns, n = nscount;
+ else
+ sect = ns_s_max, n = 0;
+ }
+ for (i = 0; i < n; i++) {
+ const char *t;
+ const u_char *rdata;
+ ns_rr rr;
+
+ if (ns_parserr(&msg, sect, i, &rr) < 0) {
+ DPRINTF(("get_soa: ns_parserr(%s, %d) failed",
+ p_section(sect, ns_o_query), i));
+ goto cleanup;
+ }
+ if (ns_rr_type(rr) == ns_t_cname ||
+ ns_rr_type(rr) == ns_t_dname)
+ break;
+ if (ns_rr_type(rr) != ns_t_soa ||
+ ns_rr_class(rr) != class)
+ continue;
+ t = ns_rr_name(rr);
+ switch (sect) {
+ case ns_s_an:
+ if (ns_samedomain(dname, t) == 0) {
+ DPRINTF(
+ ("get_soa: ns_samedomain('%s', '%s') == 0",
+ dname, t)
+ );
+ errno = EPROTOTYPE;
+ goto cleanup;
+ }
+ break;
+ case ns_s_ns:
+ if (ns_samename(dname, t) == 1 ||
+ ns_samedomain(dname, t) == 0) {
+ DPRINTF(
+ ("get_soa: ns_samename() || !ns_samedomain('%s', '%s')",
+ dname, t)
+ );
+ errno = EPROTOTYPE;
+ goto cleanup;
+ }
+ break;
+ default:
+ abort();
+ }
+ if (strlen(t) + 1 > zsize) {
+ DPRINTF(("get_soa: zname(%lu) too small (%lu)",
+ (unsigned long)zsize,
+ (unsigned long)strlen(t) + 1));
+ errno = EMSGSIZE;
+ goto cleanup;
+ }
+ strcpy(zname, t);
+ rdata = ns_rr_rdata(rr);
+ if (ns_name_uncompress(resp, ns_msg_end(msg), rdata,
+ mname, msize) < 0) {
+ DPRINTF(("get_soa: ns_name_uncompress failed")
+ );
+ goto cleanup;
+ }
+ if (save_ns(statp, &msg, ns_s_ns,
+ zname, class, opts, nsrrsp) < 0) {
+ DPRINTF(("get_soa: save_ns failed"));
+ goto cleanup;
+ }
+ free(resp);
+ return (0);
+ }
+
+ /* If we're out of labels, then not even "." has an SOA! */
+ if (*dname == '\0')
+ break;
+
+ /* Find label-terminating "."; top of loop will skip it. */
+ while (*dname != '.') {
+ if (*dname == '\\')
+ if (*++dname == '\0') {
+ errno = EMSGSIZE;
+ goto cleanup;
+ }
+ dname++;
+ }
+ }
+ DPRINTF(("get_soa: out of labels"));
+ errno = EDESTADDRREQ;
+ cleanup:
+ if (resp != NULL)
+ free(resp);
+ return (-1);
+}
+
+static int
+get_ns(res_state statp, const char *zname, ns_class class, int opts,
+ rrset_ns *nsrrsp)
+{
+ u_char *resp;
+ ns_msg msg;
+ int n;
+
+ resp = malloc(NS_MAXMSG);
+ if (resp == NULL)
+ return (-1);
+
+ /* Go and get the NS RRs for this zone. */
+ n = do_query(statp, zname, class, ns_t_ns, resp, &msg);
+ if (n != 0) {
+ DPRINTF(("get_ns: do_query('%s', %s) failed (%d)",
+ zname, p_class(class), n));
+ free(resp);
+ return (-1);
+ }
+
+ /* Remember the NS RRs and associated A RRs that came back. */
+ if (save_ns(statp, &msg, ns_s_an, zname, class, opts, nsrrsp) < 0) {
+ DPRINTF(("get_ns save_ns('%s', %s) failed",
+ zname, p_class(class)));
+ free(resp);
+ return (-1);
+ }
+
+ free(resp);
+ return (0);
+}
+
+static int
+get_glue(res_state statp, ns_class class, int opts, rrset_ns *nsrrsp) {
+ rr_ns *nsrr, *nsrr_n;
+ u_char *resp;
+
+ resp = malloc(NS_MAXMSG);
+ if (resp == NULL)
+ return(-1);
+
+ /* Go and get the A RRs for each empty NS RR on our list. */
+ for (nsrr = HEAD(*nsrrsp); nsrr != NULL; nsrr = nsrr_n) {
+ ns_msg msg;
+ int n;
+
+ nsrr_n = NEXT(nsrr, link);
+
+ if ((nsrr->flags & RR_NS_HAVE_V4) == 0) {
+ n = do_query(statp, nsrr->name, class, ns_t_a,
+ resp, &msg);
+ if (n < 0) {
+ DPRINTF(
+ ("get_glue: do_query('%s', %s') failed",
+ nsrr->name, p_class(class)));
+ goto cleanup;
+ }
+ if (n > 0) {
+ DPRINTF((
+ "get_glue: do_query('%s', %s') CNAME or DNAME found",
+ nsrr->name, p_class(class)));
+ }
+ if (save_a(statp, &msg, ns_s_an, nsrr->name, class,
+ opts, nsrr) < 0) {
+ DPRINTF(("get_glue: save_r('%s', %s) failed",
+ nsrr->name, p_class(class)));
+ goto cleanup;
+ }
+ }
+
+ if ((nsrr->flags & RR_NS_HAVE_V6) == 0) {
+ n = do_query(statp, nsrr->name, class, ns_t_aaaa,
+ resp, &msg);
+ if (n < 0) {
+ DPRINTF(
+ ("get_glue: do_query('%s', %s') failed",
+ nsrr->name, p_class(class)));
+ goto cleanup;
+ }
+ if (n > 0) {
+ DPRINTF((
+ "get_glue: do_query('%s', %s') CNAME or DNAME found",
+ nsrr->name, p_class(class)));
+ }
+ if (save_a(statp, &msg, ns_s_an, nsrr->name, class,
+ opts, nsrr) < 0) {
+ DPRINTF(("get_glue: save_r('%s', %s) failed",
+ nsrr->name, p_class(class)));
+ goto cleanup;
+ }
+ }
+
+ /* If it's still empty, it's just chaff. */
+ if (EMPTY(nsrr->addrs)) {
+ DPRINTF(("get_glue: removing empty '%s' NS",
+ nsrr->name));
+ free_nsrr(nsrrsp, nsrr);
+ }
+ }
+ free(resp);
+ return (0);
+
+ cleanup:
+ free(resp);
+ return (-1);
+}
+
+static int
+save_ns(res_state statp, ns_msg *msg, ns_sect sect,
+ const char *owner, ns_class class, int opts,
+ rrset_ns *nsrrsp)
+{
+ int i;
+
+ for (i = 0; i < ns_msg_count(*msg, sect); i++) {
+ char tname[MAXDNAME];
+ const u_char *rdata;
+ rr_ns *nsrr;
+ ns_rr rr;
+
+ if (ns_parserr(msg, sect, i, &rr) < 0) {
+ DPRINTF(("save_ns: ns_parserr(%s, %d) failed",
+ p_section(sect, ns_o_query), i));
+ return (-1);
+ }
+ if (ns_rr_type(rr) != ns_t_ns ||
+ ns_rr_class(rr) != class ||
+ ns_samename(ns_rr_name(rr), owner) != 1)
+ continue;
+ nsrr = find_ns(nsrrsp, ns_rr_name(rr));
+ if (nsrr == NULL) {
+ nsrr = malloc(sizeof *nsrr);
+ if (nsrr == NULL) {
+ DPRINTF(("save_ns: malloc failed"));
+ return (-1);
+ }
+ rdata = ns_rr_rdata(rr);
+ if (ns_name_uncompress(ns_msg_base(*msg),
+ ns_msg_end(*msg), rdata,
+ tname, sizeof tname) < 0) {
+ DPRINTF(("save_ns: ns_name_uncompress failed")
+ );
+ free(nsrr);
+ return (-1);
+ }
+ nsrr->name = strdup(tname);
+ if (nsrr->name == NULL) {
+ DPRINTF(("save_ns: strdup failed"));
+ free(nsrr);
+ return (-1);
+ }
+ INIT_LINK(nsrr, link);
+ INIT_LIST(nsrr->addrs);
+ nsrr->flags = 0;
+ APPEND(*nsrrsp, nsrr, link);
+ }
+ if (save_a(statp, msg, ns_s_ar,
+ nsrr->name, class, opts, nsrr) < 0) {
+ DPRINTF(("save_ns: save_r('%s', %s) failed",
+ nsrr->name, p_class(class)));
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+static int
+save_a(res_state statp, ns_msg *msg, ns_sect sect,
+ const char *owner, ns_class class, int opts,
+ rr_ns *nsrr)
+{
+ int i;
+
+ for (i = 0; i < ns_msg_count(*msg, sect); i++) {
+ ns_rr rr;
+ rr_a *arr;
+
+ if (ns_parserr(msg, sect, i, &rr) < 0) {
+ DPRINTF(("save_a: ns_parserr(%s, %d) failed",
+ p_section(sect, ns_o_query), i));
+ return (-1);
+ }
+ if ((ns_rr_type(rr) != ns_t_a &&
+ ns_rr_type(rr) != ns_t_aaaa) ||
+ ns_rr_class(rr) != class ||
+ ns_samename(ns_rr_name(rr), owner) != 1 ||
+ ns_rr_rdlen(rr) != NS_INADDRSZ)
+ continue;
+ if ((opts & RES_IPV6ONLY) != 0 && ns_rr_type(rr) != ns_t_aaaa)
+ continue;
+ if ((opts & RES_IPV4ONLY) != 0 && ns_rr_type(rr) != ns_t_a)
+ continue;
+ arr = malloc(sizeof *arr);
+ if (arr == NULL) {
+ DPRINTF(("save_a: malloc failed"));
+ return (-1);
+ }
+ INIT_LINK(arr, link);
+ memset(&arr->addr, 0, sizeof(arr->addr));
+ switch (ns_rr_type(rr)) {
+ case ns_t_a:
+ arr->addr.sin.sin_family = AF_INET;
+#ifdef HAVE_SA_LEN
+ arr->addr.sin.sin_len = sizeof(arr->addr.sin);
+#endif
+ memcpy(&arr->addr.sin.sin_addr, ns_rr_rdata(rr),
+ NS_INADDRSZ);
+ arr->addr.sin.sin_port = htons(NAMESERVER_PORT);
+ nsrr->flags |= RR_NS_HAVE_V4;
+ break;
+ case ns_t_aaaa:
+ arr->addr.sin6.sin6_family = AF_INET6;
+#ifdef HAVE_SA_LEN
+ arr->addr.sin6.sin6_len = sizeof(arr->addr.sin6);
+#endif
+ memcpy(&arr->addr.sin6.sin6_addr, ns_rr_rdata(rr), 16);
+ arr->addr.sin.sin_port = htons(NAMESERVER_PORT);
+ nsrr->flags |= RR_NS_HAVE_V6;
+ break;
+ default:
+ abort();
+ }
+ APPEND(nsrr->addrs, arr, link);
+ }
+ return (0);
+}
+
+static void
+free_nsrrset(rrset_ns *nsrrsp) {
+ rr_ns *nsrr;
+
+ while ((nsrr = HEAD(*nsrrsp)) != NULL)
+ free_nsrr(nsrrsp, nsrr);
+}
+
+static void
+free_nsrr(rrset_ns *nsrrsp, rr_ns *nsrr) {
+ rr_a *arr;
+ char *tmp;
+
+ while ((arr = HEAD(nsrr->addrs)) != NULL) {
+ UNLINK(nsrr->addrs, arr, link);
+ free(arr);
+ }
+ DE_CONST(nsrr->name, tmp);
+ free(tmp);
+ UNLINK(*nsrrsp, nsrr, link);
+ free(nsrr);
+}
+
+static rr_ns *
+find_ns(rrset_ns *nsrrsp, const char *dname) {
+ rr_ns *nsrr;
+
+ for (nsrr = HEAD(*nsrrsp); nsrr != NULL; nsrr = NEXT(nsrr, link))
+ if (ns_samename(nsrr->name, dname) == 1)
+ return (nsrr);
+ return (NULL);
+}
+
+static int
+do_query(res_state statp, const char *dname, ns_class class, ns_type qtype,
+ u_char *resp, ns_msg *msg)
+{
+ u_char req[NS_PACKETSZ];
+ int i, n;
+
+ n = res_nmkquery(statp, ns_o_query, dname, class, qtype,
+ NULL, 0, NULL, req, NS_PACKETSZ);
+ if (n < 0) {
+ DPRINTF(("do_query: res_nmkquery failed"));
+ return (-1);
+ }
+ n = res_nsend(statp, req, n, resp, NS_MAXMSG);
+ if (n < 0) {
+ DPRINTF(("do_query: res_nsend failed"));
+ return (-1);
+ }
+ if (n == 0) {
+ DPRINTF(("do_query: res_nsend returned 0"));
+ errno = EMSGSIZE;
+ return (-1);
+ }
+ if (ns_initparse(resp, n, msg) < 0) {
+ DPRINTF(("do_query: ns_initparse failed"));
+ return (-1);
+ }
+ n = 0;
+ for (i = 0; i < ns_msg_count(*msg, ns_s_an); i++) {
+ ns_rr rr;
+
+ if (ns_parserr(msg, ns_s_an, i, &rr) < 0) {
+ DPRINTF(("do_query: ns_parserr failed"));
+ return (-1);
+ }
+ n += (ns_rr_class(rr) == class &&
+ (ns_rr_type(rr) == ns_t_cname ||
+ ns_rr_type(rr) == ns_t_dname));
+ }
+ return (n);
+}
+
+static void
+res_dprintf(const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ fputs(";; res_findzonecut: ", stderr);
+ vfprintf(stderr, fmt, ap);
+ fputc('\n', stderr);
+ va_end(ap);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_init.c b/usr/src/lib/libresolv2_joy/common/resolv/res_init.c
new file mode 100644
index 0000000000..10254d1931
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_init.c
@@ -0,0 +1,958 @@
+/*
+ * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+
+/*
+ * Copyright (c) 1985, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
+static const char rcsid[] = "$Id: res_init.c,v 1.26 2008/12/11 09:59:00 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <netdb.h>
+
+#ifndef HAVE_MD5
+# include "../dst/md5.h"
+#else
+# ifdef SOLARIS2
+# include <sys/md5.h>
+# endif
+#endif
+#ifndef _MD5_H_
+# define _MD5_H_ 1 /*%< make sure we do not include rsaref md5.h file */
+#endif
+
+
+#include "port_after.h"
+
+/* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */
+#include <resolv_joy.h>
+
+/* ISC purposely put port_after.h before <resolv.h> to force in6 stuff
+ * (above) so we explicitly include port_resolv.h here */
+#include "port_resolv.h"
+
+#include "res_private.h"
+
+/*% Options. Should all be left alone. */
+#define RESOLVSORT
+#define DEBUG
+
+#ifdef SUNW_INITCHKIF
+#include <net/if.h>
+#include <netinet/if_ether.h>
+#include <sys/sockio.h>
+#define MAXIFS 8192
+#endif /* SUNW_INITCHKIF */
+
+#ifdef SOLARIS2
+#include <sys/systeminfo.h>
+#endif
+
+static void res_setoptions __P((res_state, const char *, const char *));
+
+#ifdef RESOLVSORT
+static const char sort_mask[] = "/&";
+#define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL)
+static u_int32_t net_mask __P((struct in_addr));
+#endif
+
+#if !defined(isascii) /*%< XXX - could be a function */
+# define isascii(c) (!(c & 0200))
+#endif
+
+/*
+ * Resolver state default settings.
+ */
+
+/*%
+ * Set up default settings. If the configuration file exist, the values
+ * there will have precedence. Otherwise, the server address is set to
+ * INADDR_ANY and the default domain name comes from the gethostname().
+ *
+ * An interrim version of this code (BIND 4.9, pre-4.4BSD) used 127.0.0.1
+ * rather than INADDR_ANY ("0.0.0.0") as the default name server address
+ * since it was noted that INADDR_ANY actually meant ``the first interface
+ * you "ifconfig"'d at boot time'' and if this was a SLIP or PPP interface,
+ * it had to be "up" in order for you to reach your own name server. It
+ * was later decided that since the recommended practice is to always
+ * install local static routes through 127.0.0.1 for all your network
+ * interfaces, that we could solve this problem without a code change.
+ *
+ * The configuration file should always be used, since it is the only way
+ * to specify a default domain. If you are running a server on your local
+ * machine, you should say "nameserver 0.0.0.0" or "nameserver 127.0.0.1"
+ * in the configuration file.
+ *
+ * Return 0 if completes successfully, -1 on error
+ */
+int
+res_ninit(res_state statp) {
+ extern int __res_vinit(res_state, int);
+ return (__res_vinit(statp, 0));
+}
+
+/*% This function has to be reachable by res_data.c but not publically. */
+int
+__res_vinit(res_state statp, int preinit) {
+ register FILE *fp;
+ register char *cp, **pp;
+ register int n;
+ char buf[BUFSIZ];
+ int nserv = 0; /*%< number of nameserver records read from file */
+ int haveenv = 0;
+ int havesearch = 0;
+#ifdef RESOLVSORT
+ int nsort = 0;
+ char *net;
+#endif
+ int dots;
+ union res_sockaddr_union u[2];
+ int maxns = MAXNS;
+
+ RES_SET_H_ERRNO(statp, 0);
+ if (statp->_u._ext.ext != NULL)
+ res_ndestroy(statp);
+
+ if (!preinit) {
+ statp->retrans = RES_TIMEOUT;
+ statp->retry = RES_DFLRETRY;
+ statp->options = RES_DEFAULT;
+ res_rndinit(statp);
+ statp->id = res_nrandomid(statp);
+ }
+
+ memset(u, 0, sizeof(u));
+#ifdef USELOOPBACK
+ u[nserv].sin.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
+#else
+ u[nserv].sin.sin_addr.s_addr = INADDR_ANY;
+#endif
+ u[nserv].sin.sin_family = AF_INET;
+ u[nserv].sin.sin_port = htons(NAMESERVER_PORT);
+#ifdef HAVE_SA_LEN
+ u[nserv].sin.sin_len = sizeof(struct sockaddr_in);
+#endif
+ nserv++;
+#ifdef HAS_INET6_STRUCTS
+#ifdef USELOOPBACK
+ u[nserv].sin6.sin6_addr = in6addr_loopback;
+#else
+ u[nserv].sin6.sin6_addr = in6addr_any;
+#endif
+ u[nserv].sin6.sin6_family = AF_INET6;
+ u[nserv].sin6.sin6_port = htons(NAMESERVER_PORT);
+#ifdef HAVE_SA_LEN
+ u[nserv].sin6.sin6_len = sizeof(struct sockaddr_in6);
+#endif
+ nserv++;
+#endif
+ statp->nscount = 0;
+ statp->ndots = 1;
+ statp->pfcode = 0;
+ statp->_vcsock = -1;
+ statp->_flags = 0;
+ statp->qhook = NULL;
+ statp->rhook = NULL;
+ statp->_u._ext.nscount = 0;
+ statp->_u._ext.ext = malloc(sizeof(*statp->_u._ext.ext));
+ if (statp->_u._ext.ext != NULL) {
+ memset(statp->_u._ext.ext, 0, sizeof(*statp->_u._ext.ext));
+ statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
+ strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");
+ strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");
+ } else {
+ /*
+ * Historically res_init() rarely, if at all, failed.
+ * Examples and applications exist which do not check
+ * our return code. Furthermore several applications
+ * simply call us to get the systems domainname. So
+ * rather then immediately fail here we store the
+ * failure, which is returned later, in h_errno. And
+ * prevent the collection of 'nameserver' information
+ * by setting maxns to 0. Thus applications that fail
+ * to check our return code wont be able to make
+ * queries anyhow.
+ */
+ RES_SET_H_ERRNO(statp, NETDB_INTERNAL);
+ maxns = 0;
+ }
+#ifdef RESOLVSORT
+ statp->nsort = 0;
+#endif
+ res_setservers(statp, u, nserv);
+
+#ifdef SUNW_INITCHKIF
+/*
+ * Short circuit res_init() if no non-loopback interfaces are up. This is
+ * done to avoid boot delays if "dns" comes before "files" in nsswitch.conf.
+ * An additional fix has been added to this code, to count all external
+ * interfaces, which includes the IPv6 interfaces. If no external interfaces
+ * are found, an additional check is carried out to determine if any deprecated
+ * interfaces are up.
+ */
+ {
+ int s;
+ struct lifnum lifn;
+
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ perror("res_init: socket");
+ goto freedata;
+ }
+ lifn.lifn_family = AF_UNSPEC;
+ lifn.lifn_flags = LIFC_EXTERNAL_SOURCE;
+ if (ioctl(s, SIOCGLIFNUM, (char *)&lifn) < 0) {
+ close(s);
+ goto freedata;
+ }
+ if (lifn.lifn_count == 0) {
+ /*
+ * Check if there are any deprecated interfaces up
+ */
+ struct lifconf lifc;
+ uchar_t *buf;
+ int buflen, i, int_up = 0;
+
+ lifn.lifn_flags = 0;
+ if ((ioctl(s, SIOCGLIFNUM, (char *)&lifn) < 0) ||
+ (lifn.lifn_count < 1)) {
+ close(s);
+ goto freedata;
+ }
+
+ buflen = lifn.lifn_count * sizeof (struct lifreq);
+ buf = (uchar_t *)malloc(buflen);
+ if (buf == NULL) {
+ close(s);
+ goto freedata;
+ }
+
+ lifc.lifc_family = AF_UNSPEC;
+ lifc.lifc_flags = 0;
+ lifc.lifc_len = buflen;
+ lifc.lifc_lifcu.lifcu_buf = (caddr_t)buf;
+ if (ioctl(s, SIOCGLIFCONF, (char *)&lifc) < 0) {
+ close(s);
+ free(buf);
+ goto freedata;
+ }
+
+ for (i = 0; i < lifn.lifn_count; ++i) {
+ struct lifreq *lreqp, lreq;
+
+ lreqp = (struct lifreq *)&lifc.lifc_req[i];
+ strlcpy(lreq.lifr_name, lreqp->lifr_name,
+ sizeof (lreq.lifr_name));
+ if (ioctl(s, SIOCGLIFFLAGS, &lreq) < 0) {
+ close(s);
+ free(buf);
+ goto freedata;
+ }
+ if ((lreq.lifr_flags & IFF_UP) &&
+ !(lreq.lifr_flags & IFF_NOLOCAL) &&
+ !(lreq.lifr_flags & IFF_NOXMIT) &&
+ !(lreq.lifr_flags & IFF_LOOPBACK)) {
+ int_up = 1;
+ break;
+ }
+ }
+ free(buf);
+
+ if (!int_up) {
+ close(s);
+ goto freedata;
+ }
+ }
+ close(s);
+ }
+#endif /* SUNW_INITCHKIF */
+
+#ifdef SOLARIS2
+ /*
+ * The old libresolv derived the defaultdomain from NIS/NIS+.
+ * We want to keep this behaviour
+ */
+ {
+ char buf[sizeof(statp->defdname)], *cp;
+ int ret;
+
+ if ((ret = sysinfo(SI_SRPC_DOMAIN, buf, sizeof(buf))) > 0 &&
+ (unsigned int)ret <= sizeof(buf)) {
+ if (buf[0] == '+')
+ buf[0] = '.';
+ cp = strchr(buf, '.');
+ cp = (cp == NULL) ? buf : (cp + 1);
+ strncpy(statp->defdname, cp,
+ sizeof(statp->defdname) - 1);
+ statp->defdname[sizeof(statp->defdname) - 1] = '\0';
+ }
+ }
+#endif /* SOLARIS2 */
+
+ /* Allow user to override the local domain definition */
+ if ((cp = getenv("LOCALDOMAIN")) != NULL) {
+ (void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
+ statp->defdname[sizeof(statp->defdname) - 1] = '\0';
+ haveenv++;
+
+ /*
+ * Set search list to be blank-separated strings
+ * from rest of env value. Permits users of LOCALDOMAIN
+ * to still have a search list, and anyone to set the
+ * one that they want to use as an individual (even more
+ * important now that the rfc1535 stuff restricts searches)
+ */
+ cp = statp->defdname;
+ pp = statp->dnsrch;
+ *pp++ = cp;
+ for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) {
+ if (*cp == '\n') /*%< silly backwards compat */
+ break;
+ else if (*cp == ' ' || *cp == '\t') {
+ *cp = 0;
+ n = 1;
+ } else if (n) {
+ *pp++ = cp;
+ n = 0;
+ havesearch = 1;
+ }
+ }
+ /* null terminate last domain if there are excess */
+ while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n')
+ cp++;
+ *cp = '\0';
+ *pp++ = 0;
+ }
+
+#define MATCH(line, name) \
+ (!strncmp(line, name, sizeof(name) - 1) && \
+ (line[sizeof(name) - 1] == ' ' || \
+ line[sizeof(name) - 1] == '\t'))
+
+ nserv = 0;
+ if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
+ /* read the config file */
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ /* skip comments */
+ if (*buf == ';' || *buf == '#')
+ continue;
+ /* read default domain name */
+ if (MATCH(buf, "domain")) {
+ if (haveenv) /*%< skip if have from environ */
+ continue;
+ cp = buf + sizeof("domain") - 1;
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ if ((*cp == '\0') || (*cp == '\n'))
+ continue;
+ strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
+ statp->defdname[sizeof(statp->defdname) - 1] = '\0';
+ if ((cp = strpbrk(statp->defdname, " \t\n")) != NULL)
+ *cp = '\0';
+ havesearch = 0;
+ continue;
+ }
+ /* set search list */
+ if (MATCH(buf, "search")) {
+ if (haveenv) /*%< skip if have from environ */
+ continue;
+ cp = buf + sizeof("search") - 1;
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ if ((*cp == '\0') || (*cp == '\n'))
+ continue;
+ strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
+ statp->defdname[sizeof(statp->defdname) - 1] = '\0';
+ if ((cp = strchr(statp->defdname, '\n')) != NULL)
+ *cp = '\0';
+ /*
+ * Set search list to be blank-separated strings
+ * on rest of line.
+ */
+ cp = statp->defdname;
+ pp = statp->dnsrch;
+ *pp++ = cp;
+ for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) {
+ if (*cp == ' ' || *cp == '\t') {
+ *cp = 0;
+ n = 1;
+ } else if (n) {
+ *pp++ = cp;
+ n = 0;
+ }
+ }
+ /* null terminate last domain if there are excess */
+ while (*cp != '\0' && *cp != ' ' && *cp != '\t')
+ cp++;
+ *cp = '\0';
+ *pp++ = 0;
+ havesearch = 1;
+ continue;
+ }
+ /* read nameservers to query */
+ if (MATCH(buf, "nameserver") && nserv < maxns) {
+ struct addrinfo hints, *ai;
+ char sbuf[NI_MAXSERV];
+ const size_t minsiz =
+ sizeof(statp->_u._ext.ext->nsaddrs[0]);
+
+ cp = buf + sizeof("nameserver") - 1;
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ cp[strcspn(cp, ";# \t\n")] = '\0';
+ if ((*cp != '\0') && (*cp != '\n')) {
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = PF_UNSPEC;
+ hints.ai_socktype = SOCK_DGRAM; /*dummy*/
+ hints.ai_flags = AI_NUMERICHOST;
+ sprintf(sbuf, "%u", NAMESERVER_PORT);
+ if (getaddrinfo(cp, sbuf, &hints, &ai) == 0 &&
+ ai->ai_addrlen <= minsiz) {
+ if (statp->_u._ext.ext != NULL) {
+ memcpy(&statp->_u._ext.ext->nsaddrs[nserv],
+ ai->ai_addr, ai->ai_addrlen);
+ }
+ if (ai->ai_addrlen <=
+ sizeof(statp->nsaddr_list[nserv])) {
+ memcpy(&statp->nsaddr_list[nserv],
+ ai->ai_addr, ai->ai_addrlen);
+ } else
+ statp->nsaddr_list[nserv].sin_family = 0;
+ freeaddrinfo(ai);
+ nserv++;
+ }
+ }
+ continue;
+ }
+#ifdef RESOLVSORT
+ if (MATCH(buf, "sortlist")) {
+ struct in_addr a;
+
+ cp = buf + sizeof("sortlist") - 1;
+ while (nsort < MAXRESOLVSORT) {
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ if (*cp == '\0' || *cp == '\n' || *cp == ';')
+ break;
+ net = cp;
+ while (*cp && !ISSORTMASK(*cp) && *cp != ';' &&
+ isascii(*cp) && !isspace((unsigned char)*cp))
+ cp++;
+ n = *cp;
+ *cp = 0;
+ if (inet_aton(net, &a)) {
+ statp->sort_list[nsort].addr = a;
+ if (ISSORTMASK(n)) {
+ *cp++ = n;
+ net = cp;
+ while (*cp && *cp != ';' &&
+ isascii(*cp) &&
+ !isspace((unsigned char)*cp))
+ cp++;
+ n = *cp;
+ *cp = 0;
+ if (inet_aton(net, &a)) {
+ statp->sort_list[nsort].mask = a.s_addr;
+ } else {
+ statp->sort_list[nsort].mask =
+ net_mask(statp->sort_list[nsort].addr);
+ }
+ } else {
+ statp->sort_list[nsort].mask =
+ net_mask(statp->sort_list[nsort].addr);
+ }
+ nsort++;
+ }
+ *cp = n;
+ }
+ continue;
+ }
+#endif
+ if (MATCH(buf, "options")) {
+ res_setoptions(statp, buf + sizeof("options") - 1, "conf");
+ continue;
+ }
+ }
+ if (nserv > 0)
+ statp->nscount = nserv;
+#ifdef RESOLVSORT
+ statp->nsort = nsort;
+#endif
+ (void) fclose(fp);
+ }
+/*
+ * Last chance to get a nameserver. This should not normally
+ * be necessary
+ */
+#ifdef NO_RESOLV_CONF
+ if(nserv == 0)
+ nserv = get_nameservers(statp);
+#endif
+
+ if (statp->defdname[0] == 0 &&
+ gethostname(buf, sizeof(statp->defdname) - 1) == 0 &&
+ (cp = strchr(buf, '.')) != NULL)
+ strcpy(statp->defdname, cp + 1);
+
+ /* find components of local domain that might be searched */
+ if (havesearch == 0) {
+ pp = statp->dnsrch;
+ *pp++ = statp->defdname;
+ *pp = NULL;
+
+ dots = 0;
+ for (cp = statp->defdname; *cp; cp++)
+ dots += (*cp == '.');
+
+ cp = statp->defdname;
+ while (pp < statp->dnsrch + MAXDFLSRCH) {
+ if (dots < LOCALDOMAINPARTS)
+ break;
+ cp = strchr(cp, '.') + 1; /*%< we know there is one */
+ *pp++ = cp;
+ dots--;
+ }
+ *pp = NULL;
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG) {
+ printf(";; res_init()... default dnsrch list:\n");
+ for (pp = statp->dnsrch; *pp; pp++)
+ printf(";;\t%s\n", *pp);
+ printf(";;\t..END..\n");
+ }
+#endif
+ }
+
+ if ((cp = getenv("RES_OPTIONS")) != NULL)
+ res_setoptions(statp, cp, "env");
+ statp->options |= RES_INIT;
+ return (statp->res_h_errno);
+#ifdef SUNW_INITCHKIF
+freedata:
+ RES_SET_H_ERRNO(statp, NETDB_INTERNAL);
+ if (statp->_u._ext.ext != NULL) {
+ free(statp->_u._ext.ext);
+ statp->_u._ext.ext = NULL;
+ }
+ return (-1);
+#endif /* SUNW_INITCHKIF */
+
+}
+
+static void
+res_setoptions(res_state statp, const char *options, const char *source)
+{
+ const char *cp = options;
+ int i;
+ struct __res_state_ext *ext = statp->_u._ext.ext;
+
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";; res_setoptions(\"%s\", \"%s\")...\n",
+ options, source);
+#endif
+ while (*cp) {
+ /* skip leading and inner runs of spaces */
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ /* search for and process individual options */
+ if (!strncmp(cp, "ndots:", sizeof("ndots:") - 1)) {
+ i = atoi(cp + sizeof("ndots:") - 1);
+ if (i <= RES_MAXNDOTS)
+ statp->ndots = i;
+ else
+ statp->ndots = RES_MAXNDOTS;
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";;\tndots=%d\n", statp->ndots);
+#endif
+ } else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) {
+ i = atoi(cp + sizeof("timeout:") - 1);
+ if (i <= RES_MAXRETRANS)
+ statp->retrans = i;
+ else
+ statp->retrans = RES_MAXRETRANS;
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";;\ttimeout=%d\n", statp->retrans);
+#endif
+#ifdef SOLARIS2
+ } else if (!strncmp(cp, "retrans:", sizeof("retrans:") - 1)) {
+ /*
+ * For backward compatibility, 'retrans' is
+ * supported as an alias for 'timeout', though
+ * without an imposed maximum.
+ */
+ statp->retrans = atoi(cp + sizeof("retrans:") - 1);
+ } else if (!strncmp(cp, "retry:", sizeof("retry:") - 1)){
+ /*
+ * For backward compatibility, 'retry' is
+ * supported as an alias for 'attempts', though
+ * without an imposed maximum.
+ */
+ statp->retry = atoi(cp + sizeof("retry:") - 1);
+#endif /* SOLARIS2 */
+ } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){
+ i = atoi(cp + sizeof("attempts:") - 1);
+ if (i <= RES_MAXRETRY)
+ statp->retry = i;
+ else
+ statp->retry = RES_MAXRETRY;
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";;\tattempts=%d\n", statp->retry);
+#endif
+ } else if (!strncmp(cp, "debug", sizeof("debug") - 1)) {
+#ifdef DEBUG
+ if (!(statp->options & RES_DEBUG)) {
+ printf(";; res_setoptions(\"%s\", \"%s\")..\n",
+ options, source);
+ statp->options |= RES_DEBUG;
+ }
+ printf(";;\tdebug\n");
+#endif
+ } else if (!strncmp(cp, "no_tld_query",
+ sizeof("no_tld_query") - 1) ||
+ !strncmp(cp, "no-tld-query",
+ sizeof("no-tld-query") - 1)) {
+ statp->options |= RES_NOTLDQUERY;
+ } else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) {
+ statp->options |= RES_USE_INET6;
+ } else if (!strncmp(cp, "rotate", sizeof("rotate") - 1)) {
+ statp->options |= RES_ROTATE;
+ } else if (!strncmp(cp, "no-check-names",
+ sizeof("no-check-names") - 1)) {
+ statp->options |= RES_NOCHECKNAME;
+ }
+#ifdef RES_USE_EDNS0
+ else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
+ statp->options |= RES_USE_EDNS0;
+ }
+#endif
+ else if (!strncmp(cp, "dname", sizeof("dname") - 1)) {
+ statp->options |= RES_USE_DNAME;
+ }
+ else if (!strncmp(cp, "nibble:", sizeof("nibble:") - 1)) {
+ if (ext == NULL)
+ goto skip;
+ cp += sizeof("nibble:") - 1;
+ i = MIN(strcspn(cp, " \t"), sizeof(ext->nsuffix) - 1);
+ strncpy(ext->nsuffix, cp, i);
+ ext->nsuffix[i] = '\0';
+ }
+ else if (!strncmp(cp, "nibble2:", sizeof("nibble2:") - 1)) {
+ if (ext == NULL)
+ goto skip;
+ cp += sizeof("nibble2:") - 1;
+ i = MIN(strcspn(cp, " \t"), sizeof(ext->nsuffix2) - 1);
+ strncpy(ext->nsuffix2, cp, i);
+ ext->nsuffix2[i] = '\0';
+ }
+ else if (!strncmp(cp, "v6revmode:", sizeof("v6revmode:") - 1)) {
+ cp += sizeof("v6revmode:") - 1;
+ /* "nibble" and "bitstring" used to be valid */
+ if (!strncmp(cp, "single", sizeof("single") - 1)) {
+ statp->options |= RES_NO_NIBBLE2;
+ } else if (!strncmp(cp, "both", sizeof("both") - 1)) {
+ statp->options &=
+ ~RES_NO_NIBBLE2;
+ }
+ }
+ else {
+ /* XXX - print a warning here? */
+ }
+ skip:
+ /* skip to next run of spaces */
+ while (*cp && *cp != ' ' && *cp != '\t')
+ cp++;
+ }
+}
+
+#ifdef RESOLVSORT
+/* XXX - should really support CIDR which means explicit masks always. */
+static u_int32_t
+net_mask(in) /*!< XXX - should really use system's version of this */
+ struct in_addr in;
+{
+ register u_int32_t i = ntohl(in.s_addr);
+
+ if (IN_CLASSA(i))
+ return (htonl(IN_CLASSA_NET));
+ else if (IN_CLASSB(i))
+ return (htonl(IN_CLASSB_NET));
+ return (htonl(IN_CLASSC_NET));
+}
+#endif
+
+void
+res_rndinit(res_state statp)
+{
+ struct timeval now;
+ u_int32_t u32;
+ u_int16_t u16;
+
+ gettimeofday(&now, NULL);
+ u32 = now.tv_sec;
+ memcpy(statp->_u._ext._rnd, &u32, 4);
+ u32 = now.tv_usec;
+ memcpy(statp->_u._ext._rnd + 4, &u32, 4);
+ u32 += now.tv_sec;
+ memcpy(statp->_u._ext._rnd + 8, &u32, 4);
+ u16 = getpid();
+ memcpy(statp->_u._ext._rnd + 12, &u16, 2);
+
+}
+
+u_int
+res_nrandomid(res_state statp) {
+ struct timeval now;
+ u_int16_t u16;
+ MD5_CTX ctx;
+
+ gettimeofday(&now, NULL);
+ u16 = (u_int16_t) (now.tv_sec ^ now.tv_usec);
+
+ memcpy(statp->_u._ext._rnd + 14, &u16, 2);
+#ifndef HAVE_MD5
+ MD5_Init(&ctx);
+ MD5_Update(&ctx, statp->_u._ext._rnd, 16);
+ MD5_Final(statp->_u._ext._rnd, &ctx);
+#else
+ MD5Init(&ctx);
+ MD5Update(&ctx, statp->_u._ext._rnd, 16);
+ MD5Final(statp->_u._ext._rnd, &ctx);
+#endif
+ memcpy(&u16, statp->_u._ext._rnd + 14, 2);
+ return ((u_int) u16);
+}
+
+/*%
+ * This routine is for closing the socket if a virtual circuit is used and
+ * the program wants to close it. This provides support for endhostent()
+ * which expects to close the socket.
+ *
+ * This routine is not expected to be user visible.
+ */
+void
+res_nclose(res_state statp) {
+ int ns;
+
+ if (statp->_vcsock >= 0) {
+ (void) close(statp->_vcsock);
+ statp->_vcsock = -1;
+ statp->_flags &= ~(RES_F_VC | RES_F_CONN);
+ }
+ for (ns = 0; ns < statp->_u._ext.nscount; ns++) {
+ if (statp->_u._ext.nssocks[ns] != -1) {
+ (void) close(statp->_u._ext.nssocks[ns]);
+ statp->_u._ext.nssocks[ns] = -1;
+ }
+ }
+}
+
+void
+res_ndestroy(res_state statp) {
+ res_nclose(statp);
+ if (statp->_u._ext.ext != NULL)
+ free(statp->_u._ext.ext);
+ statp->options &= ~RES_INIT;
+ statp->_u._ext.ext = NULL;
+}
+
+const char *
+res_get_nibblesuffix(res_state statp) {
+ if (statp->_u._ext.ext)
+ return (statp->_u._ext.ext->nsuffix);
+ return ("ip6.arpa");
+}
+
+const char *
+res_get_nibblesuffix2(res_state statp) {
+ if (statp->_u._ext.ext)
+ return (statp->_u._ext.ext->nsuffix2);
+ return ("ip6.int");
+}
+
+void
+res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) {
+ int i, nserv;
+ size_t size;
+
+ /* close open servers */
+ res_nclose(statp);
+
+ /* cause rtt times to be forgotten */
+ statp->_u._ext.nscount = 0;
+
+ nserv = 0;
+ for (i = 0; i < cnt && nserv < MAXNS; i++) {
+ switch (set->sin.sin_family) {
+ case AF_INET:
+ size = sizeof(set->sin);
+ if (statp->_u._ext.ext)
+ memcpy(&statp->_u._ext.ext->nsaddrs[nserv],
+ &set->sin, size);
+ if (size <= sizeof(statp->nsaddr_list[nserv]))
+ memcpy(&statp->nsaddr_list[nserv],
+ &set->sin, size);
+ else
+ statp->nsaddr_list[nserv].sin_family = 0;
+ nserv++;
+ break;
+
+#ifdef HAS_INET6_STRUCTS
+ case AF_INET6:
+ size = sizeof(set->sin6);
+ if (statp->_u._ext.ext)
+ memcpy(&statp->_u._ext.ext->nsaddrs[nserv],
+ &set->sin6, size);
+ if (size <= sizeof(statp->nsaddr_list[nserv]))
+ memcpy(&statp->nsaddr_list[nserv],
+ &set->sin6, size);
+ else
+ statp->nsaddr_list[nserv].sin_family = 0;
+ nserv++;
+ break;
+#endif
+
+ default:
+ break;
+ }
+ set++;
+ }
+ statp->nscount = nserv;
+
+}
+
+int
+res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) {
+ int i;
+ size_t size;
+ u_int16_t family;
+
+ for (i = 0; i < statp->nscount && i < cnt; i++) {
+ if (statp->_u._ext.ext)
+ family = statp->_u._ext.ext->nsaddrs[i].sin.sin_family;
+ else
+ family = statp->nsaddr_list[i].sin_family;
+
+ switch (family) {
+ case AF_INET:
+ size = sizeof(set->sin);
+ if (statp->_u._ext.ext)
+ memcpy(&set->sin,
+ &statp->_u._ext.ext->nsaddrs[i],
+ size);
+ else
+ memcpy(&set->sin, &statp->nsaddr_list[i],
+ size);
+ break;
+
+#ifdef HAS_INET6_STRUCTS
+ case AF_INET6:
+ size = sizeof(set->sin6);
+ if (statp->_u._ext.ext)
+ memcpy(&set->sin6,
+ &statp->_u._ext.ext->nsaddrs[i],
+ size);
+ else
+ memcpy(&set->sin6, &statp->nsaddr_list[i],
+ size);
+ break;
+#endif
+
+ default:
+ set->sin.sin_family = 0;
+ break;
+ }
+ set++;
+ }
+ return (statp->nscount);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_mkquery.c b/usr/src/lib/libresolv2_joy/common/resolv/res_mkquery.c
new file mode 100644
index 0000000000..cf36855e9d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_mkquery.c
@@ -0,0 +1,386 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Portions Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1996, 1997, 1988, 1999, 2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1985, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: res_mkquery.c,v 1.10 2008/12/11 09:59:00 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+#include <sys/types.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#ifdef SUNW_CONFCHECK
+#include <sys/socket.h>
+#include <errno.h>
+#include <sys/stat.h>
+#endif /* SUNW_CONFCHECK */
+
+
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <string.h>
+#include "port_after.h"
+
+/* Options. Leave them on. */
+#define DEBUG
+
+extern const char *_res_opcodes[];
+
+#ifdef SUNW_CONFCHECK
+static int _confcheck(res_state statp);
+#endif /* SUNW_CONFCHECK */
+
+
+/*%
+ * Form all types of queries.
+ * Returns the size of the result or -1.
+ */
+int
+res_nmkquery(res_state statp,
+ int op, /*!< opcode of query */
+ const char *dname, /*!< domain name */
+ int class, int type, /*!< class and type of query */
+ const u_char *data, /*!< resource record data */
+ int datalen, /*!< length of data */
+ const u_char *newrr_in, /*!< new rr for modify or append */
+ u_char *buf, /*!< buffer to put query */
+ int buflen) /*!< size of buffer */
+{
+ register HEADER *hp;
+ register u_char *cp, *ep;
+ register int n;
+ u_char *dnptrs[20], **dpp, **lastdnptr;
+
+ UNUSED(newrr_in);
+
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";; res_nmkquery(%s, %s, %s, %s)\n",
+ _res_opcodes[op], dname, p_class(class), p_type(type));
+#endif
+
+#ifdef SUNW_CONFCHECK
+ /*
+ * 1247019, 1265838, and 4034368: Check to see if we can
+ * bailout quickly.
+ */
+ if (_confcheck(statp) == -1) {
+ RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ return(-1);
+ }
+#endif /* SUNW_CONFCHECK */
+
+ /*
+ * Initialize header fields.
+ */
+ if ((buf == NULL) || (buflen < HFIXEDSZ))
+ return (-1);
+ memset(buf, 0, HFIXEDSZ);
+ hp = (HEADER *) buf;
+ statp->id = res_nrandomid(statp);
+ hp->id = htons(statp->id);
+ hp->opcode = op;
+ hp->rd = (statp->options & RES_RECURSE) != 0U;
+ hp->rcode = NOERROR;
+ cp = buf + HFIXEDSZ;
+ ep = buf + buflen;
+ dpp = dnptrs;
+ *dpp++ = buf;
+ *dpp++ = NULL;
+ lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
+ /*
+ * perform opcode specific processing
+ */
+ switch (op) {
+ case QUERY: /*FALLTHROUGH*/
+ case NS_NOTIFY_OP:
+ if (ep - cp < QFIXEDSZ)
+ return (-1);
+ if ((n = dn_comp(dname, cp, ep - cp - QFIXEDSZ, dnptrs,
+ lastdnptr)) < 0)
+ return (-1);
+ cp += n;
+ ns_put16(type, cp);
+ cp += INT16SZ;
+ ns_put16(class, cp);
+ cp += INT16SZ;
+ hp->qdcount = htons(1);
+ if (op == QUERY || data == NULL)
+ break;
+ /*
+ * Make an additional record for completion domain.
+ */
+ if ((ep - cp) < RRFIXEDSZ)
+ return (-1);
+ n = dn_comp((const char *)data, cp, ep - cp - RRFIXEDSZ,
+ dnptrs, lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ns_put16(T_NULL, cp);
+ cp += INT16SZ;
+ ns_put16(class, cp);
+ cp += INT16SZ;
+ ns_put32(0, cp);
+ cp += INT32SZ;
+ ns_put16(0, cp);
+ cp += INT16SZ;
+ hp->arcount = htons(1);
+ break;
+
+ case IQUERY:
+ /*
+ * Initialize answer section
+ */
+ if (ep - cp < 1 + RRFIXEDSZ + datalen)
+ return (-1);
+ *cp++ = '\0'; /*%< no domain name */
+ ns_put16(type, cp);
+ cp += INT16SZ;
+ ns_put16(class, cp);
+ cp += INT16SZ;
+ ns_put32(0, cp);
+ cp += INT32SZ;
+ ns_put16(datalen, cp);
+ cp += INT16SZ;
+ if (datalen) {
+ memcpy(cp, data, datalen);
+ cp += datalen;
+ }
+ hp->ancount = htons(1);
+ break;
+
+ default:
+ return (-1);
+ }
+ return (cp - buf);
+}
+
+#ifdef RES_USE_EDNS0
+/* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */
+
+int
+res_nopt(res_state statp,
+ int n0, /*%< current offset in buffer */
+ u_char *buf, /*%< buffer to put query */
+ int buflen, /*%< size of buffer */
+ int anslen) /*%< UDP answer buffer size */
+{
+ register HEADER *hp;
+ register u_char *cp, *ep;
+ u_int16_t flags = 0;
+
+#ifdef DEBUG
+ if ((statp->options & RES_DEBUG) != 0U)
+ printf(";; res_nopt()\n");
+#endif
+
+ hp = (HEADER *) buf;
+ cp = buf + n0;
+ ep = buf + buflen;
+
+ if ((ep - cp) < 1 + RRFIXEDSZ)
+ return (-1);
+
+ *cp++ = 0; /*%< "." */
+ ns_put16(ns_t_opt, cp); /*%< TYPE */
+ cp += INT16SZ;
+ ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */
+ cp += INT16SZ;
+ *cp++ = NOERROR; /*%< extended RCODE */
+ *cp++ = 0; /*%< EDNS version */
+
+ if (statp->options & RES_USE_DNSSEC) {
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";; res_opt()... ENDS0 DNSSEC\n");
+#endif
+ flags |= NS_OPT_DNSSEC_OK;
+ }
+ ns_put16(flags, cp);
+ cp += INT16SZ;
+
+ ns_put16(0U, cp); /*%< RDLEN */
+ cp += INT16SZ;
+
+ hp->arcount = htons(ntohs(hp->arcount) + 1);
+
+ return (cp - buf);
+}
+
+/*
+ * Construct variable data (RDATA) block for OPT psuedo-RR, append it
+ * to the buffer, then update the RDLEN field (previously set to zero by
+ * res_nopt()) with the new RDATA length.
+ */
+int
+res_nopt_rdata(res_state statp,
+ int n0, /*%< current offset in buffer */
+ u_char *buf, /*%< buffer to put query */
+ int buflen, /*%< size of buffer */
+ u_char *rdata, /*%< ptr to start of opt rdata */
+ u_short code, /*%< OPTION-CODE */
+ u_short len, /*%< OPTION-LENGTH */
+ u_char *data) /*%< OPTION_DATA */
+{
+ register u_char *cp, *ep;
+
+#ifdef DEBUG
+ if ((statp->options & RES_DEBUG) != 0U)
+ printf(";; res_nopt_rdata()\n");
+#endif
+
+ cp = buf + n0;
+ ep = buf + buflen;
+
+ if ((ep - cp) < (4 + len))
+ return (-1);
+
+ if (rdata < (buf + 2) || rdata >= ep)
+ return (-1);
+
+ ns_put16(code, cp);
+ cp += INT16SZ;
+
+ ns_put16(len, cp);
+ cp += INT16SZ;
+
+ memcpy(cp, data, len);
+ cp += len;
+
+ len = cp - rdata;
+ ns_put16(len, rdata - 2); /* Update RDLEN field */
+
+ return (cp - buf);
+}
+#endif
+
+#ifdef SUNW_CONFCHECK
+
+/*
+ * Time out quickly if there is no /etc/resolv.conf and a TCP connection
+ * to the local DNS server fails.
+ */
+static int _confcheck(res_state statp)
+{
+ int ns;
+ struct stat rc_stat;
+ struct sockaddr_in ns_sin;
+
+ /* First, we check to see if /etc/resolv.conf exists.
+ * If it doesn't, then it is likely that the localhost is
+ * the nameserver.
+ */
+ if (stat(_PATH_RESCONF, &rc_stat) == -1 && errno == ENOENT) {
+
+ /* Next, we check to see if _res.nsaddr is set to loopback.
+ * If it isn't, it has been altered by the application
+ * explicitly and we then want to bail with success.
+ */
+ if (statp->nsaddr.sin_addr.S_un.S_addr ==
+ htonl(INADDR_LOOPBACK)) {
+
+ /* Lastly, we try to connect to the TCP port of the
+ * nameserver. If this fails, then we know that
+ * DNS is misconfigured and we can quickly exit.
+ */
+ ns = socket(AF_INET, SOCK_STREAM, 0);
+ IN_SET_LOOPBACK_ADDR(&ns_sin);
+ ns_sin.sin_port = htons(NAMESERVER_PORT);
+ if (connect(ns, (struct sockaddr *) &ns_sin,
+ sizeof ns_sin) == -1) {
+ close(ns);
+ return(-1);
+ }
+ else {
+ close(ns);
+
+ return(0);
+ }
+ }
+
+ return(0);
+ }
+
+ return (0);
+}
+#endif /* SUNW_CONFCHECK */
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_mkupdate.c b/usr/src/lib/libresolv2_joy/common/resolv/res_mkupdate.c
new file mode 100644
index 0000000000..8f73e281d0
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_mkupdate.c
@@ -0,0 +1,1163 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*! \file
+ * \brief
+ * Based on the Dynamic DNS reference implementation by Viraj Bais
+ * &lt;viraj_bais@ccm.fm.intel.com>
+ */
+
+#if !defined(lint) && !defined(SABER)
+static const char rcsid[] = "$Id: res_mkupdate.c,v 1.10 2008/12/11 09:59:00 marka Exp $";
+#endif /* not lint */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <res_update.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+
+#include "port_after.h"
+
+/* Options. Leave them on. */
+#define DEBUG
+#define MAXPORT 1024
+
+static int getnum_str(u_char **, u_char *);
+static int gethexnum_str(u_char **, u_char *);
+static int getword_str(char *, int, u_char **, u_char *);
+static int getstr_str(char *, int, u_char **, u_char *);
+
+#define ShrinkBuffer(x) if ((buflen -= x) < 0) return (-2);
+
+/* Forward. */
+
+int res_protocolnumber(const char *);
+int res_servicenumber(const char *);
+
+/*%
+ * Form update packets.
+ * Returns the size of the resulting packet if no error
+ *
+ * On error,
+ * returns
+ *\li -1 if error in reading a word/number in rdata
+ * portion for update packets
+ *\li -2 if length of buffer passed is insufficient
+ *\li -3 if zone section is not the first section in
+ * the linked list, or section order has a problem
+ *\li -4 on a number overflow
+ *\li -5 unknown operation or no records
+ */
+int
+res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
+ ns_updrec *rrecp_start = rrecp_in;
+ HEADER *hp;
+ u_char *cp, *sp2, *startp, *endp;
+ int n, i, soanum, multiline;
+ ns_updrec *rrecp;
+ struct in_addr ina;
+ struct in6_addr in6a;
+ char buf2[MAXDNAME];
+ u_char buf3[MAXDNAME];
+ int section, numrrs = 0, counts[ns_s_max];
+ u_int16_t rtype, rclass;
+ u_int32_t n1, rttl;
+ u_char *dnptrs[20], **dpp, **lastdnptr;
+ int siglen, keylen, certlen;
+
+ /*
+ * Initialize header fields.
+ */
+ if ((buf == NULL) || (buflen < HFIXEDSZ))
+ return (-1);
+ memset(buf, 0, HFIXEDSZ);
+ hp = (HEADER *) buf;
+ statp->id = res_nrandomid(statp);
+ hp->id = htons(statp->id);
+ hp->opcode = ns_o_update;
+ hp->rcode = NOERROR;
+ cp = buf + HFIXEDSZ;
+ buflen -= HFIXEDSZ;
+ dpp = dnptrs;
+ *dpp++ = buf;
+ *dpp++ = NULL;
+ lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
+
+ if (rrecp_start == NULL)
+ return (-5);
+ else if (rrecp_start->r_section != S_ZONE)
+ return (-3);
+
+ memset(counts, 0, sizeof counts);
+ for (rrecp = rrecp_start; rrecp; rrecp = NEXT(rrecp, r_glink)) {
+ numrrs++;
+ section = rrecp->r_section;
+ if (section < 0 || section >= ns_s_max)
+ return (-1);
+ counts[section]++;
+ for (i = section + 1; i < ns_s_max; i++)
+ if (counts[i])
+ return (-3);
+ rtype = rrecp->r_type;
+ rclass = rrecp->r_class;
+ rttl = rrecp->r_ttl;
+ /* overload class and type */
+ if (section == S_PREREQ) {
+ rttl = 0;
+ switch (rrecp->r_opcode) {
+ case YXDOMAIN:
+ rclass = C_ANY;
+ rtype = T_ANY;
+ rrecp->r_size = 0;
+ break;
+ case NXDOMAIN:
+ rclass = C_NONE;
+ rtype = T_ANY;
+ rrecp->r_size = 0;
+ break;
+ case NXRRSET:
+ rclass = C_NONE;
+ rrecp->r_size = 0;
+ break;
+ case YXRRSET:
+ if (rrecp->r_size == 0)
+ rclass = C_ANY;
+ break;
+ default:
+ fprintf(stderr,
+ "res_mkupdate: incorrect opcode: %d\n",
+ rrecp->r_opcode);
+ fflush(stderr);
+ return (-1);
+ }
+ } else if (section == S_UPDATE) {
+ switch (rrecp->r_opcode) {
+ case DELETE:
+ rclass = rrecp->r_size == 0 ? C_ANY : C_NONE;
+ break;
+ case ADD:
+ break;
+ default:
+ fprintf(stderr,
+ "res_mkupdate: incorrect opcode: %d\n",
+ rrecp->r_opcode);
+ fflush(stderr);
+ return (-1);
+ }
+ }
+
+ /*
+ * XXX appending default domain to owner name is omitted,
+ * fqdn must be provided
+ */
+ if ((n = dn_comp(rrecp->r_dname, cp, buflen, dnptrs,
+ lastdnptr)) < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n + 2*INT16SZ);
+ PUTSHORT(rtype, cp);
+ PUTSHORT(rclass, cp);
+ if (section == S_ZONE) {
+ if (numrrs != 1 || rrecp->r_type != T_SOA)
+ return (-3);
+ continue;
+ }
+ ShrinkBuffer(INT32SZ + INT16SZ);
+ PUTLONG(rttl, cp);
+ sp2 = cp; /*%< save pointer to length byte */
+ cp += INT16SZ;
+ if (rrecp->r_size == 0) {
+ if (section == S_UPDATE && rclass != C_ANY)
+ return (-1);
+ else {
+ PUTSHORT(0, sp2);
+ continue;
+ }
+ }
+ startp = rrecp->r_data;
+ endp = startp + rrecp->r_size - 1;
+ /* XXX this should be done centrally. */
+ switch (rrecp->r_type) {
+ case T_A:
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ if (!inet_aton(buf2, &ina))
+ return (-1);
+ n1 = ntohl(ina.s_addr);
+ ShrinkBuffer(INT32SZ);
+ PUTLONG(n1, cp);
+ break;
+ case T_CNAME:
+ case T_MB:
+ case T_MG:
+ case T_MR:
+ case T_NS:
+ case T_PTR:
+ case ns_t_dname:
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, dnptrs, lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ break;
+ case T_MINFO:
+ case T_SOA:
+ case T_RP:
+ for (i = 0; i < 2; i++) {
+ if (!getword_str(buf2, sizeof buf2, &startp,
+ endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen,
+ dnptrs, lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ }
+ if (rrecp->r_type == T_SOA) {
+ ShrinkBuffer(5 * INT32SZ);
+ while (isspace(*startp) || !*startp)
+ startp++;
+ if (*startp == '(') {
+ multiline = 1;
+ startp++;
+ } else
+ multiline = 0;
+ /* serial, refresh, retry, expire, minimum */
+ for (i = 0; i < 5; i++) {
+ soanum = getnum_str(&startp, endp);
+ if (soanum < 0)
+ return (-1);
+ PUTLONG(soanum, cp);
+ }
+ if (multiline) {
+ while (isspace(*startp) || !*startp)
+ startp++;
+ if (*startp != ')')
+ return (-1);
+ }
+ }
+ break;
+ case T_MX:
+ case T_AFSDB:
+ case T_RT:
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, dnptrs, lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ break;
+ case T_SRV:
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, NULL, NULL);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ break;
+ case T_PX:
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ PUTSHORT(n, cp);
+ ShrinkBuffer(INT16SZ);
+ for (i = 0; i < 2; i++) {
+ if (!getword_str(buf2, sizeof buf2, &startp,
+ endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, dnptrs,
+ lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ }
+ break;
+ case T_WKS: {
+ char bm[MAXPORT/8];
+ unsigned int maxbm = 0;
+
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ if (!inet_aton(buf2, &ina))
+ return (-1);
+ n1 = ntohl(ina.s_addr);
+ ShrinkBuffer(INT32SZ);
+ PUTLONG(n1, cp);
+
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ if ((i = res_protocolnumber(buf2)) < 0)
+ return (-1);
+ ShrinkBuffer(1);
+ *cp++ = i & 0xff;
+
+ for (i = 0; i < MAXPORT/8 ; i++)
+ bm[i] = 0;
+
+ while (getword_str(buf2, sizeof buf2, &startp, endp)) {
+ if ((n = res_servicenumber(buf2)) <= 0)
+ return (-1);
+
+ if (n < MAXPORT) {
+ bm[n/8] |= (0x80>>(n%8));
+ if ((unsigned)n > maxbm)
+ maxbm = n;
+ } else
+ return (-1);
+ }
+ maxbm = maxbm/8 + 1;
+ ShrinkBuffer(maxbm);
+ memcpy(cp, bm, maxbm);
+ cp += maxbm;
+ break;
+ }
+ case T_HINFO:
+ for (i = 0; i < 2; i++) {
+ if ((n = getstr_str(buf2, sizeof buf2,
+ &startp, endp)) < 0)
+ return (-1);
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ }
+ break;
+ case T_TXT:
+ for (;;) {
+ if ((n = getstr_str(buf2, sizeof buf2,
+ &startp, endp)) < 0) {
+ if (cp != (sp2 + INT16SZ))
+ break;
+ return (-1);
+ }
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ }
+ break;
+ case T_X25:
+ /* RFC1183 */
+ if ((n = getstr_str(buf2, sizeof buf2, &startp,
+ endp)) < 0)
+ return (-1);
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ break;
+ case T_ISDN:
+ /* RFC1183 */
+ if ((n = getstr_str(buf2, sizeof buf2, &startp,
+ endp)) < 0)
+ return (-1);
+ if ((n > 255) || (n == 0))
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ if ((n = getstr_str(buf2, sizeof buf2, &startp,
+ endp)) < 0)
+ n = 0;
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ break;
+ case T_NSAP:
+ if ((n = inet_nsap_addr((char *)startp, (u_char *)buf2, sizeof(buf2))) != 0) {
+ ShrinkBuffer(n);
+ memcpy(cp, buf2, n);
+ cp += n;
+ } else {
+ return (-1);
+ }
+ break;
+ case T_LOC:
+ if ((n = loc_aton((char *)startp, (u_char *)buf2)) != 0) {
+ ShrinkBuffer(n);
+ memcpy(cp, buf2, n);
+ cp += n;
+ } else
+ return (-1);
+ break;
+ case ns_t_sig:
+ {
+ int sig_type, success, dateerror;
+ u_int32_t exptime, timesigned;
+
+ /* type */
+ if ((n = getword_str(buf2, sizeof buf2,
+ &startp, endp)) < 0)
+ return (-1);
+ sig_type = sym_ston(__p_type_syms, buf2, &success);
+ if (!success || sig_type == ns_t_any)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(sig_type, cp);
+ /* alg */
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(1);
+ *cp++ = n;
+ /* labels */
+ n = getnum_str(&startp, endp);
+ if (n <= 0 || n > 255)
+ return (-1);
+ ShrinkBuffer(1);
+ *cp++ = n;
+ /* ottl & expire */
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ exptime = ns_datetosecs(buf2, &dateerror);
+ if (!dateerror) {
+ ShrinkBuffer(INT32SZ);
+ PUTLONG(rttl, cp);
+ }
+ else {
+ char *ulendp;
+ u_int32_t ottl;
+
+ errno = 0;
+ ottl = strtoul(buf2, &ulendp, 10);
+ if (errno != 0 ||
+ (ulendp != NULL && *ulendp != '\0'))
+ return (-1);
+ ShrinkBuffer(INT32SZ);
+ PUTLONG(ottl, cp);
+ if (!getword_str(buf2, sizeof buf2, &startp,
+ endp))
+ return (-1);
+ exptime = ns_datetosecs(buf2, &dateerror);
+ if (dateerror)
+ return (-1);
+ }
+ /* expire */
+ ShrinkBuffer(INT32SZ);
+ PUTLONG(exptime, cp);
+ /* timesigned */
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ timesigned = ns_datetosecs(buf2, &dateerror);
+ if (!dateerror) {
+ ShrinkBuffer(INT32SZ);
+ PUTLONG(timesigned, cp);
+ }
+ else
+ return (-1);
+ /* footprint */
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ /* signer name */
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, dnptrs, lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ /* sig */
+ if ((n = getword_str(buf2, sizeof buf2,
+ &startp, endp)) < 0)
+ return (-1);
+ siglen = b64_pton(buf2, buf3, sizeof(buf3));
+ if (siglen < 0)
+ return (-1);
+ ShrinkBuffer(siglen);
+ memcpy(cp, buf3, siglen);
+ cp += siglen;
+ break;
+ }
+ case ns_t_key:
+ /* flags */
+ n = gethexnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ /* proto */
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(1);
+ *cp++ = n;
+ /* alg */
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(1);
+ *cp++ = n;
+ /* key */
+ if ((n = getword_str(buf2, sizeof buf2,
+ &startp, endp)) < 0)
+ return (-1);
+ keylen = b64_pton(buf2, buf3, sizeof(buf3));
+ if (keylen < 0)
+ return (-1);
+ ShrinkBuffer(keylen);
+ memcpy(cp, buf3, keylen);
+ cp += keylen;
+ break;
+ case ns_t_nxt:
+ {
+ int success, nxt_type;
+ u_char data[32];
+ int maxtype;
+
+ /* next name */
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, NULL, NULL);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ maxtype = 0;
+ memset(data, 0, sizeof data);
+ for (;;) {
+ if (!getword_str(buf2, sizeof buf2, &startp,
+ endp))
+ break;
+ nxt_type = sym_ston(__p_type_syms, buf2,
+ &success);
+ if (!success || !ns_t_rr_p(nxt_type))
+ return (-1);
+ NS_NXT_BIT_SET(nxt_type, data);
+ if (nxt_type > maxtype)
+ maxtype = nxt_type;
+ }
+ n = maxtype/NS_NXT_BITS+1;
+ ShrinkBuffer(n);
+ memcpy(cp, data, n);
+ cp += n;
+ break;
+ }
+ case ns_t_cert:
+ /* type */
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ /* key tag */
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ /* alg */
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ ShrinkBuffer(1);
+ *cp++ = n;
+ /* cert */
+ if ((n = getword_str(buf2, sizeof buf2,
+ &startp, endp)) < 0)
+ return (-1);
+ certlen = b64_pton(buf2, buf3, sizeof(buf3));
+ if (certlen < 0)
+ return (-1);
+ ShrinkBuffer(certlen);
+ memcpy(cp, buf3, certlen);
+ cp += certlen;
+ break;
+ case ns_t_aaaa:
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ if (inet_pton(AF_INET6, buf2, &in6a) <= 0)
+ return (-1);
+ ShrinkBuffer(NS_IN6ADDRSZ);
+ memcpy(cp, &in6a, NS_IN6ADDRSZ);
+ cp += NS_IN6ADDRSZ;
+ break;
+ case ns_t_naptr:
+ /* Order Preference Flags Service Replacement Regexp */
+ /* Order */
+ n = getnum_str(&startp, endp);
+ if (n < 0 || n > 65535)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ /* Preference */
+ n = getnum_str(&startp, endp);
+ if (n < 0 || n > 65535)
+ return (-1);
+ ShrinkBuffer(INT16SZ);
+ PUTSHORT(n, cp);
+ /* Flags */
+ if ((n = getstr_str(buf2, sizeof buf2,
+ &startp, endp)) < 0) {
+ return (-1);
+ }
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ /* Service Classes */
+ if ((n = getstr_str(buf2, sizeof buf2,
+ &startp, endp)) < 0) {
+ return (-1);
+ }
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ /* Pattern */
+ if ((n = getstr_str(buf2, sizeof buf2,
+ &startp, endp)) < 0) {
+ return (-1);
+ }
+ if (n > 255)
+ return (-1);
+ ShrinkBuffer(n+1);
+ *cp++ = n;
+ memcpy(cp, buf2, n);
+ cp += n;
+ /* Replacement */
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, NULL, NULL);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ break;
+ default:
+ return (-1);
+ } /*switch*/
+ n = (u_int16_t)((cp - sp2) - INT16SZ);
+ PUTSHORT(n, sp2);
+ } /*for*/
+
+ hp->qdcount = htons(counts[0]);
+ hp->ancount = htons(counts[1]);
+ hp->nscount = htons(counts[2]);
+ hp->arcount = htons(counts[3]);
+ return (cp - buf);
+}
+
+/*%
+ * Get a whitespace delimited word from a string (not file)
+ * into buf. modify the start pointer to point after the
+ * word in the string.
+ */
+static int
+getword_str(char *buf, int size, u_char **startpp, u_char *endp) {
+ char *cp;
+ int c;
+
+ for (cp = buf; *startpp <= endp; ) {
+ c = **startpp;
+ if (isspace(c) || c == '\0') {
+ if (cp != buf) /*%< trailing whitespace */
+ break;
+ else { /*%< leading whitespace */
+ (*startpp)++;
+ continue;
+ }
+ }
+ (*startpp)++;
+ if (cp >= buf+size-1)
+ break;
+ *cp++ = (u_char)c;
+ }
+ *cp = '\0';
+ return (cp != buf);
+}
+
+/*%
+ * get a white spae delimited string from memory. Process quoted strings
+ * and \\DDD escapes. Return length or -1 on error. Returned string may
+ * contain nulls.
+ */
+static char digits[] = "0123456789";
+static int
+getstr_str(char *buf, int size, u_char **startpp, u_char *endp) {
+ char *cp;
+ int c, c1 = 0;
+ int inquote = 0;
+ int seen_quote = 0;
+ int escape = 0;
+ int dig = 0;
+
+ for (cp = buf; *startpp <= endp; ) {
+ if ((c = **startpp) == '\0')
+ break;
+ /* leading white space */
+ if ((cp == buf) && !seen_quote && isspace(c)) {
+ (*startpp)++;
+ continue;
+ }
+
+ switch (c) {
+ case '\\':
+ if (!escape) {
+ escape = 1;
+ dig = 0;
+ c1 = 0;
+ (*startpp)++;
+ continue;
+ }
+ goto do_escape;
+ case '"':
+ if (!escape) {
+ inquote = !inquote;
+ seen_quote = 1;
+ (*startpp)++;
+ continue;
+ }
+ /* fall through */
+ default:
+ do_escape:
+ if (escape) {
+ switch (c) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ c1 = c1 * 10 +
+ (strchr(digits, c) - digits);
+
+ if (++dig == 3) {
+ c = c1 &0xff;
+ break;
+ }
+ (*startpp)++;
+ continue;
+ }
+ escape = 0;
+ } else if (!inquote && isspace(c))
+ goto done;
+ if (cp >= buf+size-1)
+ goto done;
+ *cp++ = (u_char)c;
+ (*startpp)++;
+ }
+ }
+ done:
+ *cp = '\0';
+ return ((cp == buf)? (seen_quote? 0: -1): (cp - buf));
+}
+
+/*%
+ * Get a whitespace delimited base 16 number from a string (not file) into buf
+ * update the start pointer to point after the number in the string.
+ */
+static int
+gethexnum_str(u_char **startpp, u_char *endp) {
+ int c, n;
+ int seendigit = 0;
+ int m = 0;
+
+ if (*startpp + 2 >= endp || strncasecmp((char *)*startpp, "0x", 2) != 0)
+ return getnum_str(startpp, endp);
+ (*startpp)+=2;
+ for (n = 0; *startpp <= endp; ) {
+ c = **startpp;
+ if (isspace(c) || c == '\0') {
+ if (seendigit) /*%< trailing whitespace */
+ break;
+ else { /*%< leading whitespace */
+ (*startpp)++;
+ continue;
+ }
+ }
+ if (c == ';') {
+ while ((*startpp <= endp) &&
+ ((c = **startpp) != '\n'))
+ (*startpp)++;
+ if (seendigit)
+ break;
+ continue;
+ }
+ if (!isxdigit(c)) {
+ if (c == ')' && seendigit) {
+ (*startpp)--;
+ break;
+ }
+ return (-1);
+ }
+ (*startpp)++;
+ if (isdigit(c))
+ n = n * 16 + (c - '0');
+ else
+ n = n * 16 + (tolower(c) - 'a' + 10);
+ seendigit = 1;
+ }
+ return (n + m);
+}
+
+/*%
+ * Get a whitespace delimited base 10 number from a string (not file) into buf
+ * update the start pointer to point after the number in the string.
+ */
+static int
+getnum_str(u_char **startpp, u_char *endp) {
+ int c, n;
+ int seendigit = 0;
+ int m = 0;
+
+ for (n = 0; *startpp <= endp; ) {
+ c = **startpp;
+ if (isspace(c) || c == '\0') {
+ if (seendigit) /*%< trailing whitespace */
+ break;
+ else { /*%< leading whitespace */
+ (*startpp)++;
+ continue;
+ }
+ }
+ if (c == ';') {
+ while ((*startpp <= endp) &&
+ ((c = **startpp) != '\n'))
+ (*startpp)++;
+ if (seendigit)
+ break;
+ continue;
+ }
+ if (!isdigit(c)) {
+ if (c == ')' && seendigit) {
+ (*startpp)--;
+ break;
+ }
+ return (-1);
+ }
+ (*startpp)++;
+ n = n * 10 + (c - '0');
+ seendigit = 1;
+ }
+ return (n + m);
+}
+
+/*%
+ * Allocate a resource record buffer & save rr info.
+ */
+ns_updrec *
+res_mkupdrec(int section, const char *dname,
+ u_int class, u_int type, u_long ttl) {
+ ns_updrec *rrecp = (ns_updrec *)calloc(1, sizeof(ns_updrec));
+
+ if (!rrecp || !(rrecp->r_dname = strdup(dname))) {
+ if (rrecp)
+ free((char *)rrecp);
+ return (NULL);
+ }
+ INIT_LINK(rrecp, r_link);
+ INIT_LINK(rrecp, r_glink);
+ rrecp->r_class = (ns_class)class;
+ rrecp->r_type = (ns_type)type;
+ rrecp->r_ttl = ttl;
+ rrecp->r_section = (ns_sect)section;
+ return (rrecp);
+}
+
+/*%
+ * Free a resource record buffer created by res_mkupdrec.
+ */
+void
+res_freeupdrec(ns_updrec *rrecp) {
+ /* Note: freeing r_dp is the caller's responsibility. */
+ if (rrecp->r_dname != NULL)
+ free(rrecp->r_dname);
+ free(rrecp);
+}
+
+struct valuelist {
+ struct valuelist * next;
+ struct valuelist * prev;
+ char * name;
+ char * proto;
+ int port;
+};
+static struct valuelist *servicelist, *protolist;
+
+static void
+res_buildservicelist() {
+ struct servent *sp;
+ struct valuelist *slp;
+
+#ifdef MAYBE_HESIOD
+ setservent(0);
+#else
+ setservent(1);
+#endif
+ while ((sp = getservent()) != NULL) {
+ slp = (struct valuelist *)malloc(sizeof(struct valuelist));
+ if (!slp)
+ break;
+ slp->name = strdup(sp->s_name);
+ slp->proto = strdup(sp->s_proto);
+ if ((slp->name == NULL) || (slp->proto == NULL)) {
+ if (slp->name) free(slp->name);
+ if (slp->proto) free(slp->proto);
+ free(slp);
+ break;
+ }
+ slp->port = ntohs((u_int16_t)sp->s_port); /*%< host byt order */
+ slp->next = servicelist;
+ slp->prev = NULL;
+ if (servicelist)
+ servicelist->prev = slp;
+ servicelist = slp;
+ }
+ endservent();
+}
+
+void
+res_destroyservicelist() {
+ struct valuelist *slp, *slp_next;
+
+ for (slp = servicelist; slp != NULL; slp = slp_next) {
+ slp_next = slp->next;
+ free(slp->name);
+ free(slp->proto);
+ free(slp);
+ }
+ servicelist = (struct valuelist *)0;
+}
+
+void
+res_buildprotolist(void) {
+ struct protoent *pp;
+ struct valuelist *slp;
+
+#ifdef MAYBE_HESIOD
+ setprotoent(0);
+#else
+ setprotoent(1);
+#endif
+ while ((pp = getprotoent()) != NULL) {
+ slp = (struct valuelist *)malloc(sizeof(struct valuelist));
+ if (!slp)
+ break;
+ slp->name = strdup(pp->p_name);
+ if (slp->name == NULL) {
+ free(slp);
+ break;
+ }
+ slp->port = pp->p_proto; /*%< host byte order */
+ slp->next = protolist;
+ slp->prev = NULL;
+ if (protolist)
+ protolist->prev = slp;
+ protolist = slp;
+ }
+ endprotoent();
+}
+
+void
+res_destroyprotolist(void) {
+ struct valuelist *plp, *plp_next;
+
+ for (plp = protolist; plp != NULL; plp = plp_next) {
+ plp_next = plp->next;
+ free(plp->name);
+ free(plp);
+ }
+ protolist = (struct valuelist *)0;
+}
+
+static int
+findservice(const char *s, struct valuelist **list) {
+ struct valuelist *lp = *list;
+ int n;
+
+ for (; lp != NULL; lp = lp->next)
+ if (strcasecmp(lp->name, s) == 0) {
+ if (lp != *list) {
+ lp->prev->next = lp->next;
+ if (lp->next)
+ lp->next->prev = lp->prev;
+ (*list)->prev = lp;
+ lp->next = *list;
+ *list = lp;
+ }
+ return (lp->port); /*%< host byte order */
+ }
+ if (sscanf(s, "%d", &n) != 1 || n <= 0)
+ n = -1;
+ return (n);
+}
+
+/*%
+ * Convert service name or (ascii) number to int.
+ */
+int
+res_servicenumber(const char *p) {
+ if (servicelist == (struct valuelist *)0)
+ res_buildservicelist();
+ return (findservice(p, &servicelist));
+}
+
+/*%
+ * Convert protocol name or (ascii) number to int.
+ */
+int
+res_protocolnumber(const char *p) {
+ if (protolist == (struct valuelist *)0)
+ res_buildprotolist();
+ return (findservice(p, &protolist));
+}
+
+static struct servent *
+cgetservbyport(u_int16_t port, const char *proto) { /*%< Host byte order. */
+ struct valuelist **list = &servicelist;
+ struct valuelist *lp = *list;
+ static struct servent serv;
+
+ port = ntohs(port);
+ for (; lp != NULL; lp = lp->next) {
+ if (port != (u_int16_t)lp->port) /*%< Host byte order. */
+ continue;
+ if (strcasecmp(lp->proto, proto) == 0) {
+ if (lp != *list) {
+ lp->prev->next = lp->next;
+ if (lp->next)
+ lp->next->prev = lp->prev;
+ (*list)->prev = lp;
+ lp->next = *list;
+ *list = lp;
+ }
+ serv.s_name = lp->name;
+ serv.s_port = htons((u_int16_t)lp->port);
+ serv.s_proto = lp->proto;
+ return (&serv);
+ }
+ }
+ return (0);
+}
+
+static struct protoent *
+cgetprotobynumber(int proto) { /*%< Host byte order. */
+ struct valuelist **list = &protolist;
+ struct valuelist *lp = *list;
+ static struct protoent prot;
+
+ for (; lp != NULL; lp = lp->next)
+ if (lp->port == proto) { /*%< Host byte order. */
+ if (lp != *list) {
+ lp->prev->next = lp->next;
+ if (lp->next)
+ lp->next->prev = lp->prev;
+ (*list)->prev = lp;
+ lp->next = *list;
+ *list = lp;
+ }
+ prot.p_name = lp->name;
+ prot.p_proto = lp->port; /*%< Host byte order. */
+ return (&prot);
+ }
+ return (0);
+}
+
+const char *
+res_protocolname(int num) {
+ static char number[8];
+ struct protoent *pp;
+
+ if (protolist == (struct valuelist *)0)
+ res_buildprotolist();
+ pp = cgetprotobynumber(num);
+ if (pp == 0) {
+ (void) sprintf(number, "%d", num);
+ return (number);
+ }
+ return (pp->p_name);
+}
+
+const char *
+res_servicename(u_int16_t port, const char *proto) { /*%< Host byte order. */
+ static char number[8];
+ struct servent *ss;
+
+ if (servicelist == (struct valuelist *)0)
+ res_buildservicelist();
+ ss = cgetservbyport(htons(port), proto);
+ if (ss == 0) {
+ (void) sprintf(number, "%d", port);
+ return (number);
+ }
+ return (ss->s_name);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_mkupdate.h b/usr/src/lib/libresolv2_joy/common/resolv/res_mkupdate.h
new file mode 100644
index 0000000000..96c452d89e
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_mkupdate.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _RES_MKUPDATE_H_
+#define _RES_MKUPDATE_H_
+
+__BEGIN_DECLS
+__END_DECLS
+
+#endif /* _RES_MKUPDATE_H_ */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_private.h b/usr/src/lib/libresolv2_joy/common/resolv/res_private.h
new file mode 100644
index 0000000000..4e98157ced
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_private.h
@@ -0,0 +1,22 @@
+#ifndef res_private_h
+#define res_private_h
+
+struct __res_state_ext {
+ union res_sockaddr_union nsaddrs[MAXNS];
+ struct sort_list {
+ int af;
+ union {
+ struct in_addr ina;
+ struct in6_addr in6a;
+ } addr, mask;
+ } sort_list[MAXRESOLVSORT];
+ char nsuffix[64];
+ char nsuffix2[64];
+};
+
+extern int
+res_ourserver_p(const res_state statp, const struct sockaddr *sa);
+
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_query.c b/usr/src/lib/libresolv2_joy/common/resolv/res_query.c
new file mode 100644
index 0000000000..09df3da1fc
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_query.c
@@ -0,0 +1,440 @@
+/*
+ * Portions Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1996-2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: res_query.c,v 1.11 2008/11/14 02:36:51 marka Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include "port_before.h"
+#include <sys/types.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "port_after.h"
+
+/* Options. Leave them on. */
+#define DEBUG
+
+#if PACKETSZ > 1024
+#define MAXPACKET PACKETSZ
+#else
+#define MAXPACKET 1024
+#endif
+
+/*%
+ * Formulate a normal query, send, and await answer.
+ * Returned answer is placed in supplied buffer "answer".
+ * Perform preliminary check of answer, returning success only
+ * if no error is indicated and the answer count is nonzero.
+ * Return the size of the response on success, -1 on error.
+ * Error number is left in H_ERRNO.
+ *
+ * Caller must parse answer and determine whether it answers the question.
+ */
+int
+res_nquery(res_state statp,
+ const char *name, /*%< domain name */
+ int class, int type, /*%< class and type of query */
+ u_char *answer, /*%< buffer to put answer */
+ int anslen) /*%< size of answer buffer */
+{
+ u_char buf[MAXPACKET];
+ HEADER *hp = (HEADER *) answer;
+ u_int oflags;
+ u_char *rdata;
+ int n;
+
+ oflags = statp->_flags;
+
+again:
+ hp->rcode = NOERROR; /*%< default */
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";; res_query(%s, %d, %d)\n", name, class, type);
+#endif
+
+ n = res_nmkquery(statp, QUERY, name, class, type, NULL, 0, NULL,
+ buf, sizeof(buf));
+#ifdef RES_USE_EDNS0
+ if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 &&
+ (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) {
+ n = res_nopt(statp, n, buf, sizeof(buf), anslen);
+ rdata = &buf[n];
+ if (n > 0 && (statp->options & RES_NSID) != 0U) {
+ n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata,
+ NS_OPT_NSID, 0, NULL);
+ }
+ }
+#endif
+ if (n <= 0) {
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";; res_query: mkquery failed\n");
+#endif
+ RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ return (n);
+ }
+
+ n = res_nsend(statp, buf, n, answer, anslen);
+ if (n < 0) {
+#ifdef RES_USE_EDNS0
+ /* if the query choked with EDNS0, retry without EDNS0 */
+ if ((statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0U &&
+ ((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) {
+ statp->_flags |= RES_F_EDNS0ERR;
+ if (statp->options & RES_DEBUG)
+ printf(";; res_nquery: retry without EDNS0\n");
+ goto again;
+ }
+#endif
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";; res_query: send error\n");
+#endif
+ RES_SET_H_ERRNO(statp, TRY_AGAIN);
+ return (n);
+ }
+
+ if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";; rcode = (%s), counts = an:%d ns:%d ar:%d\n",
+ p_rcode(hp->rcode),
+ ntohs(hp->ancount),
+ ntohs(hp->nscount),
+ ntohs(hp->arcount));
+#endif
+ switch (hp->rcode) {
+ case NXDOMAIN:
+ RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);
+ break;
+ case SERVFAIL:
+ RES_SET_H_ERRNO(statp, TRY_AGAIN);
+ break;
+ case NOERROR:
+ RES_SET_H_ERRNO(statp, NO_DATA);
+ break;
+ case FORMERR:
+ case NOTIMP:
+ case REFUSED:
+ default:
+ RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ break;
+ }
+ return (-1);
+ }
+ return (n);
+}
+
+/*%
+ * Formulate a normal query, send, and retrieve answer in supplied buffer.
+ * Return the size of the response on success, -1 on error.
+ * If enabled, implement search rules until answer or unrecoverable failure
+ * is detected. Error code, if any, is left in H_ERRNO.
+ */
+int
+res_nsearch(res_state statp,
+ const char *name, /*%< domain name */
+ int class, int type, /*%< class and type of query */
+ u_char *answer, /*%< buffer to put answer */
+ int anslen) /*%< size of answer */
+{
+ const char *cp, * const *domain;
+ HEADER *hp = (HEADER *) answer;
+ char tmp[NS_MAXDNAME];
+ u_int dots;
+ int trailing_dot, ret, saved_herrno;
+ int got_nodata = 0, got_servfail = 0, root_on_list = 0;
+ int tried_as_is = 0;
+ int searched = 0;
+
+ errno = 0;
+ RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); /*%< True if we never query. */
+ dots = 0;
+ for (cp = name; *cp != '\0'; cp++)
+ dots += (*cp == '.');
+ trailing_dot = 0;
+ if (cp > name && *--cp == '.')
+ trailing_dot++;
+
+ /* If there aren't any dots, it could be a user-level alias. */
+ if (!dots && (cp = res_hostalias(statp, name, tmp, sizeof tmp))!= NULL)
+ return (res_nquery(statp, cp, class, type, answer, anslen));
+
+ /*
+ * If there are enough dots in the name, let's just give it a
+ * try 'as is'. The threshold can be set with the "ndots" option.
+ * Also, query 'as is', if there is a trailing dot in the name.
+ */
+ saved_herrno = -1;
+ if (dots >= statp->ndots || trailing_dot) {
+ ret = res_nquerydomain(statp, name, NULL, class, type,
+ answer, anslen);
+ if (ret > 0 || trailing_dot)
+ return (ret);
+ saved_herrno = statp->res_h_errno;
+ tried_as_is++;
+ }
+
+ /*
+ * We do at least one level of search if
+ * - there is no dot and RES_DEFNAME is set, or
+ * - there is at least one dot, there is no trailing dot,
+ * and RES_DNSRCH is set.
+ */
+ if ((!dots && (statp->options & RES_DEFNAMES) != 0U) ||
+ (dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0U)) {
+ int done = 0;
+
+ for (domain = (const char * const *)statp->dnsrch;
+ *domain && !done;
+ domain++) {
+ searched = 1;
+
+ if (domain[0][0] == '\0' ||
+ (domain[0][0] == '.' && domain[0][1] == '\0'))
+ root_on_list++;
+
+ ret = res_nquerydomain(statp, name, *domain,
+ class, type,
+ answer, anslen);
+ if (ret > 0)
+ return (ret);
+
+ /*
+ * If no server present, give up.
+ * If name isn't found in this domain,
+ * keep trying higher domains in the search list
+ * (if that's enabled).
+ * On a NO_DATA error, keep trying, otherwise
+ * a wildcard entry of another type could keep us
+ * from finding this entry higher in the domain.
+ * If we get some other error (negative answer or
+ * server failure), then stop searching up,
+ * but try the input name below in case it's
+ * fully-qualified.
+ */
+ if (errno == ECONNREFUSED) {
+ RES_SET_H_ERRNO(statp, TRY_AGAIN);
+ return (-1);
+ }
+
+ switch (statp->res_h_errno) {
+ case NO_DATA:
+ got_nodata++;
+ /* FALLTHROUGH */
+ case HOST_NOT_FOUND:
+ /* keep trying */
+ break;
+ case TRY_AGAIN:
+ if (hp->rcode == SERVFAIL) {
+ /* try next search element, if any */
+ got_servfail++;
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ /* anything else implies that we're done */
+ done++;
+ }
+
+ /* if we got here for some reason other than DNSRCH,
+ * we only wanted one iteration of the loop, so stop.
+ */
+ if ((statp->options & RES_DNSRCH) == 0U)
+ done++;
+ }
+ }
+
+ /*
+ * If the query has not already been tried as is then try it
+ * unless RES_NOTLDQUERY is set and there were no dots.
+ */
+ if ((dots || !searched || (statp->options & RES_NOTLDQUERY) == 0U) &&
+ !(tried_as_is || root_on_list)) {
+ ret = res_nquerydomain(statp, name, NULL, class, type,
+ answer, anslen);
+ if (ret > 0)
+ return (ret);
+ }
+
+ /* if we got here, we didn't satisfy the search.
+ * if we did an initial full query, return that query's H_ERRNO
+ * (note that we wouldn't be here if that query had succeeded).
+ * else if we ever got a nodata, send that back as the reason.
+ * else send back meaningless H_ERRNO, that being the one from
+ * the last DNSRCH we did.
+ */
+ if (saved_herrno != -1)
+ RES_SET_H_ERRNO(statp, saved_herrno);
+ else if (got_nodata)
+ RES_SET_H_ERRNO(statp, NO_DATA);
+ else if (got_servfail)
+ RES_SET_H_ERRNO(statp, TRY_AGAIN);
+ return (-1);
+}
+
+/*%
+ * Perform a call on res_query on the concatenation of name and domain,
+ * removing a trailing dot from name if domain is NULL.
+ */
+int
+res_nquerydomain(res_state statp,
+ const char *name,
+ const char *domain,
+ int class, int type, /*%< class and type of query */
+ u_char *answer, /*%< buffer to put answer */
+ int anslen) /*%< size of answer */
+{
+ char nbuf[MAXDNAME];
+ const char *longname = nbuf;
+ int n, d;
+
+#ifdef DEBUG
+ if (statp->options & RES_DEBUG)
+ printf(";; res_nquerydomain(%s, %s, %d, %d)\n",
+ name, domain?domain:"<Nil>", class, type);
+#endif
+ if (domain == NULL) {
+ /*
+ * Check for trailing '.';
+ * copy without '.' if present.
+ */
+ n = strlen(name);
+ if (n >= MAXDNAME) {
+ RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ return (-1);
+ }
+ n--;
+ if (n >= 0 && name[n] == '.') {
+ strncpy(nbuf, name, n);
+ nbuf[n] = '\0';
+ } else
+ longname = name;
+ } else {
+ n = strlen(name);
+ d = strlen(domain);
+ if (n + d + 1 >= MAXDNAME) {
+ RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ return (-1);
+ }
+ sprintf(nbuf, "%s.%s", name, domain);
+ }
+ return (res_nquery(statp, longname, class, type, answer, anslen));
+}
+
+const char *
+res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
+ char *file, *cp1, *cp2;
+ char buf[BUFSIZ];
+ FILE *fp;
+
+ if (statp->options & RES_NOALIASES)
+ return (NULL);
+ file = getenv("HOSTALIASES");
+ if (file == NULL || (fp = fopen(file, "r")) == NULL)
+ return (NULL);
+ setbuf(fp, NULL);
+ buf[sizeof(buf) - 1] = '\0';
+ while (fgets(buf, sizeof(buf), fp)) {
+ for (cp1 = buf; *cp1 && !isspace((unsigned char)*cp1); ++cp1)
+ ;
+ if (!*cp1)
+ break;
+ *cp1 = '\0';
+ if (ns_samename(buf, name) == 1) {
+ while (isspace((unsigned char)*++cp1))
+ ;
+ if (!*cp1)
+ break;
+ for (cp2 = cp1 + 1; *cp2 &&
+ !isspace((unsigned char)*cp2); ++cp2)
+ ;
+ *cp2 = '\0';
+ strncpy(dst, cp1, siz - 1);
+ dst[siz - 1] = '\0';
+ fclose(fp);
+ return (dst);
+ }
+ }
+ fclose(fp);
+ return (NULL);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_send.c b/usr/src/lib/libresolv2_joy/common/resolv/res_send.c
new file mode 100644
index 0000000000..289db4e77d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_send.c
@@ -0,0 +1,1120 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Portions Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1996-2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1985, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+/*! \file
+ * \brief
+ * Send query to name server and wait for reply.
+ */
+
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <errno.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <isc/eventlib.h>
+
+#include "port_after.h"
+
+#ifdef USE_POLL
+#ifdef HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+#include <poll.h>
+#endif /* USE_POLL */
+
+/* Options. Leave them on. */
+#define DEBUG
+#include "res_debug.h"
+#include "res_private.h"
+
+#define EXT(res) ((res)->_u._ext)
+
+#ifndef USE_POLL
+static const int highestFD = FD_SETSIZE - 1;
+#else
+static int highestFD = 0;
+#endif
+
+/* Forward. */
+
+static int get_salen __P((const struct sockaddr *));
+static struct sockaddr * get_nsaddr __P((res_state, size_t));
+static int send_vc(res_state, const u_char *, int,
+ u_char *, int, int *, int);
+static int send_dg(res_state, const u_char *, int,
+ u_char *, int, int *, int, int,
+ int *, int *);
+static void Aerror(const res_state, FILE *, const char *, int,
+ const struct sockaddr *, int);
+static void Perror(const res_state, FILE *, const char *, int);
+static int sock_eq(struct sockaddr *, struct sockaddr *);
+#if defined(NEED_PSELECT) && !defined(USE_POLL)
+static int pselect(int, void *, void *, void *,
+ struct timespec *,
+ const sigset_t *);
+#endif
+void res_pquery(const res_state, const u_char *, int, FILE *);
+
+#ifndef ORIGINAL_ISC_CODE
+#pragma weak __res_nameinquery = res_nameinquery
+#pragma weak __res_queriesmatch = res_queriesmatch
+#pragma weak res_nisourserver = res_ourserver_p
+#endif /* ORIGINAL_ISC_CODE */
+
+static const int niflags = NI_NUMERICHOST | NI_NUMERICSERV;
+
+/* Public. */
+
+/*%
+ * looks up "ina" in _res.ns_addr_list[]
+ *
+ * returns:
+ *\li 0 : not found
+ *\li >0 : found
+ *
+ * author:
+ *\li paul vixie, 29may94
+ */
+int
+res_ourserver_p(const res_state statp, const struct sockaddr *sa) {
+ const struct sockaddr_in *inp, *srv;
+ const struct sockaddr_in6 *in6p, *srv6;
+ int ns;
+
+ switch (sa->sa_family) {
+ case AF_INET:
+ inp = (const struct sockaddr_in *)sa;
+ for (ns = 0; ns < statp->nscount; ns++) {
+ srv = (struct sockaddr_in *)get_nsaddr(statp, ns);
+ if (srv->sin_family == inp->sin_family &&
+ srv->sin_port == inp->sin_port &&
+ (srv->sin_addr.s_addr == INADDR_ANY ||
+ srv->sin_addr.s_addr == inp->sin_addr.s_addr))
+ return (1);
+ }
+ break;
+ case AF_INET6:
+ if (EXT(statp).ext == NULL)
+ break;
+ in6p = (const struct sockaddr_in6 *)sa;
+ for (ns = 0; ns < statp->nscount; ns++) {
+ srv6 = (struct sockaddr_in6 *)get_nsaddr(statp, ns);
+ if (srv6->sin6_family == in6p->sin6_family &&
+ srv6->sin6_port == in6p->sin6_port &&
+#ifdef HAVE_SIN6_SCOPE_ID
+ (srv6->sin6_scope_id == 0 ||
+ srv6->sin6_scope_id == in6p->sin6_scope_id) &&
+#endif
+ (IN6_IS_ADDR_UNSPECIFIED(&srv6->sin6_addr) ||
+ IN6_ARE_ADDR_EQUAL(&srv6->sin6_addr, &in6p->sin6_addr)))
+ return (1);
+ }
+ break;
+ default:
+ break;
+ }
+ return (0);
+}
+
+/*%
+ * look for (name,type,class) in the query section of packet (buf,eom)
+ *
+ * requires:
+ *\li buf + HFIXEDSZ <= eom
+ *
+ * returns:
+ *\li -1 : format error
+ *\li 0 : not found
+ *\li >0 : found
+ *
+ * author:
+ *\li paul vixie, 29may94
+ */
+int
+res_nameinquery(const char *name, int type, int class,
+ const u_char *buf, const u_char *eom)
+{
+ const u_char *cp = buf + HFIXEDSZ;
+ int qdcount = ntohs(((const HEADER*)buf)->qdcount);
+
+ while (qdcount-- > 0) {
+ char tname[MAXDNAME+1];
+ int n, ttype, tclass;
+
+ n = dn_expand(buf, eom, cp, tname, sizeof tname);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ if (cp + 2 * INT16SZ > eom)
+ return (-1);
+ ttype = ns_get16(cp); cp += INT16SZ;
+ tclass = ns_get16(cp); cp += INT16SZ;
+ if (ttype == type && tclass == class &&
+ ns_samename(tname, name) == 1)
+ return (1);
+ }
+ return (0);
+}
+
+/*%
+ * is there a 1:1 mapping of (name,type,class)
+ * in (buf1,eom1) and (buf2,eom2)?
+ *
+ * returns:
+ *\li -1 : format error
+ *\li 0 : not a 1:1 mapping
+ *\li >0 : is a 1:1 mapping
+ *
+ * author:
+ *\li paul vixie, 29may94
+ */
+int
+res_queriesmatch(const u_char *buf1, const u_char *eom1,
+ const u_char *buf2, const u_char *eom2)
+{
+ const u_char *cp = buf1 + HFIXEDSZ;
+ int qdcount = ntohs(((const HEADER*)buf1)->qdcount);
+
+ if (buf1 + HFIXEDSZ > eom1 || buf2 + HFIXEDSZ > eom2)
+ return (-1);
+
+ /*
+ * Only header section present in replies to
+ * dynamic update packets.
+ */
+ if ((((const HEADER *)buf1)->opcode == ns_o_update) &&
+ (((const HEADER *)buf2)->opcode == ns_o_update))
+ return (1);
+
+ if (qdcount != ntohs(((const HEADER*)buf2)->qdcount))
+ return (0);
+ while (qdcount-- > 0) {
+ char tname[MAXDNAME+1];
+ int n, ttype, tclass;
+
+ n = dn_expand(buf1, eom1, cp, tname, sizeof tname);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ if (cp + 2 * INT16SZ > eom1)
+ return (-1);
+ ttype = ns_get16(cp); cp += INT16SZ;
+ tclass = ns_get16(cp); cp += INT16SZ;
+ if (!res_nameinquery(tname, ttype, tclass, buf2, eom2))
+ return (0);
+ }
+ return (1);
+}
+
+int
+res_nsend(res_state statp,
+ const u_char *buf, int buflen, u_char *ans, int anssiz)
+{
+ int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n;
+ char abuf[NI_MAXHOST];
+
+#ifdef USE_POLL
+ highestFD = sysconf(_SC_OPEN_MAX) - 1;
+#endif
+
+ /* No name servers or res_init() failure */
+ if (statp->nscount == 0 || EXT(statp).ext == NULL) {
+ errno = ESRCH;
+ return (-1);
+ }
+ if (anssiz < HFIXEDSZ) {
+ errno = EINVAL;
+ return (-1);
+ }
+ DprintQ((statp->options & RES_DEBUG) || (statp->pfcode & RES_PRF_QUERY),
+ (stdout, ";; res_send()\n"), buf, buflen);
+ v_circuit = (statp->options & RES_USEVC) || buflen > PACKETSZ;
+ gotsomewhere = 0;
+ terrno = ETIMEDOUT;
+
+ /*
+ * If the ns_addr_list in the resolver context has changed, then
+ * invalidate our cached copy and the associated timing data.
+ */
+ if (EXT(statp).nscount != 0) {
+ int needclose = 0;
+ struct sockaddr_storage peer;
+ ISC_SOCKLEN_T peerlen;
+
+ if (EXT(statp).nscount != statp->nscount)
+ needclose++;
+ else
+ for (ns = 0; ns < statp->nscount; ns++) {
+ if (statp->nsaddr_list[ns].sin_family &&
+ !sock_eq((struct sockaddr *)&statp->nsaddr_list[ns],
+ (struct sockaddr *)&EXT(statp).ext->nsaddrs[ns])) {
+ needclose++;
+ break;
+ }
+
+ if (EXT(statp).nssocks[ns] == -1)
+ continue;
+ peerlen = sizeof(peer);
+ if (getpeername(EXT(statp).nssocks[ns],
+ (struct sockaddr *)&peer, &peerlen) < 0) {
+ needclose++;
+ break;
+ }
+ if (!sock_eq((struct sockaddr *)&peer,
+ get_nsaddr(statp, ns))) {
+ needclose++;
+ break;
+ }
+ }
+ if (needclose) {
+ res_nclose(statp);
+ EXT(statp).nscount = 0;
+ }
+ }
+
+ /*
+ * Maybe initialize our private copy of the ns_addr_list.
+ */
+ if (EXT(statp).nscount == 0) {
+ for (ns = 0; ns < statp->nscount; ns++) {
+ EXT(statp).nstimes[ns] = RES_MAXTIME;
+ EXT(statp).nssocks[ns] = -1;
+ if (!statp->nsaddr_list[ns].sin_family)
+ continue;
+ EXT(statp).ext->nsaddrs[ns].sin =
+ statp->nsaddr_list[ns];
+ }
+ EXT(statp).nscount = statp->nscount;
+ }
+
+ /*
+ * Some resolvers want to even out the load on their nameservers.
+ * Note that RES_BLAST overrides RES_ROTATE.
+ */
+ if ((statp->options & RES_ROTATE) != 0U &&
+ (statp->options & RES_BLAST) == 0U) {
+ union res_sockaddr_union inu;
+ struct sockaddr_in ina;
+ int lastns = statp->nscount - 1;
+ int fd;
+ u_int16_t nstime;
+
+ if (EXT(statp).ext != NULL)
+ inu = EXT(statp).ext->nsaddrs[0];
+ ina = statp->nsaddr_list[0];
+ fd = EXT(statp).nssocks[0];
+ nstime = EXT(statp).nstimes[0];
+ for (ns = 0; ns < lastns; ns++) {
+ if (EXT(statp).ext != NULL)
+ EXT(statp).ext->nsaddrs[ns] =
+ EXT(statp).ext->nsaddrs[ns + 1];
+ statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1];
+ EXT(statp).nssocks[ns] = EXT(statp).nssocks[ns + 1];
+ EXT(statp).nstimes[ns] = EXT(statp).nstimes[ns + 1];
+ }
+ if (EXT(statp).ext != NULL)
+ EXT(statp).ext->nsaddrs[lastns] = inu;
+ statp->nsaddr_list[lastns] = ina;
+ EXT(statp).nssocks[lastns] = fd;
+ EXT(statp).nstimes[lastns] = nstime;
+ }
+
+ /*
+ * Send request, RETRY times, or until successful.
+ */
+ for (tries = 0; tries < statp->retry; tries++) {
+ for (ns = 0; ns < statp->nscount; ns++) {
+ struct sockaddr *nsap;
+ int nsaplen;
+ nsap = get_nsaddr(statp, ns);
+ nsaplen = get_salen(nsap);
+ statp->_flags &= ~RES_F_LASTMASK;
+ statp->_flags |= (ns << RES_F_LASTSHIFT);
+ same_ns:
+ if (statp->qhook) {
+ int done = 0, loops = 0;
+
+ do {
+ res_sendhookact act;
+
+ act = (*statp->qhook)(&nsap, &buf, &buflen,
+ ans, anssiz, &resplen);
+ switch (act) {
+ case res_goahead:
+ done = 1;
+ break;
+ case res_nextns:
+ res_nclose(statp);
+ goto next_ns;
+ case res_done:
+ return (resplen);
+ case res_modified:
+ /* give the hook another try */
+ if (++loops < 42) /*doug adams*/
+ break;
+ /*FALLTHROUGH*/
+ case res_error:
+ /*FALLTHROUGH*/
+ default:
+ goto fail;
+ }
+ } while (!done);
+ }
+
+ Dprint(((statp->options & RES_DEBUG) &&
+ getnameinfo(nsap, nsaplen, abuf, sizeof(abuf),
+ NULL, 0, niflags) == 0),
+ (stdout, ";; Querying server (# %d) address = %s\n",
+ ns + 1, abuf));
+
+
+ if (v_circuit) {
+ /* Use VC; at most one attempt per server. */
+ tries = statp->retry;
+ n = send_vc(statp, buf, buflen, ans, anssiz, &terrno,
+ ns);
+ if (n < 0)
+ goto fail;
+ if (n == 0)
+ goto next_ns;
+ resplen = n;
+ } else {
+ /* Use datagrams. */
+ n = send_dg(statp, buf, buflen, ans, anssiz, &terrno,
+ ns, tries, &v_circuit, &gotsomewhere);
+ if (n < 0)
+ goto fail;
+ if (n == 0)
+ goto next_ns;
+ if (v_circuit)
+ goto same_ns;
+ resplen = n;
+ }
+
+ Dprint((statp->options & RES_DEBUG) ||
+ ((statp->pfcode & RES_PRF_REPLY) &&
+ (statp->pfcode & RES_PRF_HEAD1)),
+ (stdout, ";; got answer:\n"));
+
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, "%s", ""),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+
+ /*
+ * If we have temporarily opened a virtual circuit,
+ * or if we haven't been asked to keep a socket open,
+ * close the socket.
+ */
+ if ((v_circuit && (statp->options & RES_USEVC) == 0U) ||
+ (statp->options & RES_STAYOPEN) == 0U) {
+ res_nclose(statp);
+ }
+ if (statp->rhook) {
+ int done = 0, loops = 0;
+
+ do {
+ res_sendhookact act;
+
+ act = (*statp->rhook)(nsap, buf, buflen,
+ ans, anssiz, &resplen);
+ switch (act) {
+ case res_goahead:
+ case res_done:
+ done = 1;
+ break;
+ case res_nextns:
+ res_nclose(statp);
+ goto next_ns;
+ case res_modified:
+ /* give the hook another try */
+ if (++loops < 42) /*doug adams*/
+ break;
+ /*FALLTHROUGH*/
+ case res_error:
+ /*FALLTHROUGH*/
+ default:
+ goto fail;
+ }
+ } while (!done);
+
+ }
+ return (resplen);
+ next_ns: ;
+ } /*foreach ns*/
+ } /*foreach retry*/
+ res_nclose(statp);
+ if (!v_circuit) {
+ if (!gotsomewhere)
+ errno = ECONNREFUSED; /*%< no nameservers found */
+ else
+ errno = ETIMEDOUT; /*%< no answer obtained */
+ } else
+ errno = terrno;
+ return (-1);
+ fail:
+ res_nclose(statp);
+ return (-1);
+}
+
+/* Private */
+
+static int
+get_salen(sa)
+ const struct sockaddr *sa;
+{
+
+#ifdef HAVE_SA_LEN
+ /* There are people do not set sa_len. Be forgiving to them. */
+ if (sa->sa_len)
+ return (sa->sa_len);
+#endif
+
+ if (sa->sa_family == AF_INET)
+ return (sizeof(struct sockaddr_in));
+ else if (sa->sa_family == AF_INET6)
+ return (sizeof(struct sockaddr_in6));
+ else
+ return (0); /*%< unknown, die on connect */
+}
+
+/*%
+ * pick appropriate nsaddr_list for use. see res_init() for initialization.
+ */
+static struct sockaddr *
+get_nsaddr(statp, n)
+ res_state statp;
+ size_t n;
+{
+
+ if (!statp->nsaddr_list[n].sin_family && EXT(statp).ext) {
+ /*
+ * - EXT(statp).ext->nsaddrs[n] holds an address that is larger
+ * than struct sockaddr, and
+ * - user code did not update statp->nsaddr_list[n].
+ */
+ return (struct sockaddr *)(void *)&EXT(statp).ext->nsaddrs[n];
+ } else {
+ /*
+ * - user code updated statp->nsaddr_list[n], or
+ * - statp->nsaddr_list[n] has the same content as
+ * EXT(statp).ext->nsaddrs[n].
+ */
+ return (struct sockaddr *)(void *)&statp->nsaddr_list[n];
+ }
+}
+
+static int
+send_vc(res_state statp,
+ const u_char *buf, int buflen, u_char *ans, int anssiz,
+ int *terrno, int ns)
+{
+ const HEADER *hp = (const HEADER *) buf;
+ HEADER *anhp = (HEADER *) ans;
+ struct sockaddr *nsap;
+ int nsaplen;
+ int truncating, connreset, resplen, n;
+ struct iovec iov[2];
+ u_short len;
+ u_char *cp;
+ void *tmp;
+#ifdef SO_NOSIGPIPE
+ int on = 1;
+#endif
+
+ nsap = get_nsaddr(statp, ns);
+ nsaplen = get_salen(nsap);
+
+ connreset = 0;
+ same_ns:
+ truncating = 0;
+
+ /* Are we still talking to whom we want to talk to? */
+ if (statp->_vcsock >= 0 && (statp->_flags & RES_F_VC) != 0) {
+ struct sockaddr_storage peer;
+ ISC_SOCKLEN_T size = sizeof peer;
+
+ if (getpeername(statp->_vcsock,
+ (struct sockaddr *)&peer, &size) < 0 ||
+ !sock_eq((struct sockaddr *)&peer, nsap)) {
+ res_nclose(statp);
+ statp->_flags &= ~RES_F_VC;
+ }
+ }
+
+ if (statp->_vcsock < 0 || (statp->_flags & RES_F_VC) == 0) {
+ if (statp->_vcsock >= 0)
+ res_nclose(statp);
+
+ statp->_vcsock = socket(nsap->sa_family, SOCK_STREAM, 0);
+ if (statp->_vcsock > highestFD) {
+ res_nclose(statp);
+ errno = ENOTSOCK;
+ }
+ if (statp->_vcsock < 0) {
+ switch (errno) {
+ case EPROTONOSUPPORT:
+#ifdef EPFNOSUPPORT
+ case EPFNOSUPPORT:
+#endif
+ case EAFNOSUPPORT:
+ Perror(statp, stderr, "socket(vc)", errno);
+ return (0);
+ default:
+ *terrno = errno;
+ Perror(statp, stderr, "socket(vc)", errno);
+ return (-1);
+ }
+ }
+#ifdef SO_NOSIGPIPE
+ /*
+ * Disable generation of SIGPIPE when writing to a closed
+ * socket. Write should return -1 and set errno to EPIPE
+ * instead.
+ *
+ * Push on even if setsockopt(SO_NOSIGPIPE) fails.
+ */
+ (void)setsockopt(statp->_vcsock, SOL_SOCKET, SO_NOSIGPIPE, &on,
+ sizeof(on));
+#endif
+ errno = 0;
+ if (connect(statp->_vcsock, nsap, nsaplen) < 0) {
+ *terrno = errno;
+ Aerror(statp, stderr, "connect/vc", errno, nsap,
+ nsaplen);
+ res_nclose(statp);
+ return (0);
+ }
+ statp->_flags |= RES_F_VC;
+ }
+
+ /*
+ * Send length & message
+ */
+ ns_put16((u_short)buflen, (u_char*)&len);
+ iov[0] = evConsIovec(&len, INT16SZ);
+ DE_CONST(buf, tmp);
+ iov[1] = evConsIovec(tmp, buflen);
+ if (writev(statp->_vcsock, iov, 2) != (INT16SZ + buflen)) {
+ *terrno = errno;
+ Perror(statp, stderr, "write failed", errno);
+ res_nclose(statp);
+ return (0);
+ }
+ /*
+ * Receive length & response
+ */
+ read_len:
+ cp = ans;
+ len = INT16SZ;
+ while ((n = read(statp->_vcsock, (char *)cp, (int)len)) > 0) {
+ cp += n;
+ if ((len -= n) == 0)
+ break;
+ }
+ if (n <= 0) {
+ *terrno = errno;
+ Perror(statp, stderr, "read failed", errno);
+ res_nclose(statp);
+ /*
+ * A long running process might get its TCP
+ * connection reset if the remote server was
+ * restarted. Requery the server instead of
+ * trying a new one. When there is only one
+ * server, this means that a query might work
+ * instead of failing. We only allow one reset
+ * per query to prevent looping.
+ */
+ if (*terrno == ECONNRESET && !connreset) {
+ connreset = 1;
+ res_nclose(statp);
+ goto same_ns;
+ }
+ res_nclose(statp);
+ return (0);
+ }
+ resplen = ns_get16(ans);
+ if (resplen > anssiz) {
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; response truncated\n")
+ );
+ truncating = 1;
+ len = anssiz;
+ } else
+ len = resplen;
+ if (len < HFIXEDSZ) {
+ /*
+ * Undersized message.
+ */
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; undersized: %d\n", len));
+ *terrno = EMSGSIZE;
+ res_nclose(statp);
+ return (0);
+ }
+ cp = ans;
+ while (len != 0 && (n = read(statp->_vcsock, (char *)cp, (int)len)) > 0){
+ cp += n;
+ len -= n;
+ }
+ if (n <= 0) {
+ *terrno = errno;
+ Perror(statp, stderr, "read(vc)", errno);
+ res_nclose(statp);
+ return (0);
+ }
+ if (truncating) {
+ /*
+ * Flush rest of answer so connection stays in synch.
+ */
+ anhp->tc = 1;
+ len = resplen - anssiz;
+ while (len != 0) {
+ char junk[PACKETSZ];
+
+ n = read(statp->_vcsock, junk,
+ (len > sizeof junk) ? sizeof junk : len);
+ if (n > 0)
+ len -= n;
+ else
+ break;
+ }
+ }
+ /*
+ * If the calling applicating has bailed out of
+ * a previous call and failed to arrange to have
+ * the circuit closed or the server has got
+ * itself confused, then drop the packet and
+ * wait for the correct one.
+ */
+ if (hp->id != anhp->id) {
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, ";; old answer (unexpected):\n"),
+ ans, (resplen > anssiz) ? anssiz: resplen);
+ goto read_len;
+ }
+
+ /*
+ * All is well, or the error is fatal. Signal that the
+ * next nameserver ought not be tried.
+ */
+ return (resplen);
+}
+
+static int
+send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans,
+ int anssiz, int *terrno, int ns, int tries, int *v_circuit,
+ int *gotsomewhere)
+{
+ const HEADER *hp = (const HEADER *) buf;
+ HEADER *anhp = (HEADER *) ans;
+ const struct sockaddr *nsap;
+ int nsaplen;
+ struct timespec now, timeout, finish;
+ struct sockaddr_storage from;
+ ISC_SOCKLEN_T fromlen;
+ int resplen, seconds, n, s;
+#ifdef USE_POLL
+ int polltimeout;
+ struct pollfd pollfd;
+#else
+ fd_set dsmask;
+#endif
+
+ nsap = get_nsaddr(statp, ns);
+ nsaplen = get_salen(nsap);
+ if (EXT(statp).nssocks[ns] == -1) {
+ EXT(statp).nssocks[ns] = socket(nsap->sa_family, SOCK_DGRAM, 0);
+ if (EXT(statp).nssocks[ns] > highestFD) {
+ res_nclose(statp);
+ errno = ENOTSOCK;
+ }
+ if (EXT(statp).nssocks[ns] < 0) {
+ switch (errno) {
+ case EPROTONOSUPPORT:
+#ifdef EPFNOSUPPORT
+ case EPFNOSUPPORT:
+#endif
+ case EAFNOSUPPORT:
+ Perror(statp, stderr, "socket(dg)", errno);
+ return (0);
+ default:
+ *terrno = errno;
+ Perror(statp, stderr, "socket(dg)", errno);
+ return (-1);
+ }
+ }
+#ifndef CANNOT_CONNECT_DGRAM
+ /*
+ * On a 4.3BSD+ machine (client and server,
+ * actually), sending to a nameserver datagram
+ * port with no nameserver will cause an
+ * ICMP port unreachable message to be returned.
+ * If our datagram socket is "connected" to the
+ * server, we get an ECONNREFUSED error on the next
+ * socket operation, and select returns if the
+ * error message is received. We can thus detect
+ * the absence of a nameserver without timing out.
+ */
+ if (connect(EXT(statp).nssocks[ns], nsap, nsaplen) < 0) {
+ Aerror(statp, stderr, "connect(dg)", errno, nsap,
+ nsaplen);
+ res_nclose(statp);
+ return (0);
+ }
+#endif /* !CANNOT_CONNECT_DGRAM */
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; new DG socket\n"))
+ }
+ s = EXT(statp).nssocks[ns];
+#ifndef CANNOT_CONNECT_DGRAM
+ if (send(s, (const char*)buf, buflen, 0) != buflen) {
+ Perror(statp, stderr, "send", errno);
+ res_nclose(statp);
+ return (0);
+ }
+#else /* !CANNOT_CONNECT_DGRAM */
+ if (sendto(s, (const char*)buf, buflen, 0, nsap, nsaplen) != buflen)
+ {
+ Aerror(statp, stderr, "sendto", errno, nsap, nsaplen);
+ res_nclose(statp);
+ return (0);
+ }
+#endif /* !CANNOT_CONNECT_DGRAM */
+
+ /*
+ * Wait for reply.
+ */
+ seconds = (statp->retrans << tries);
+ if (ns > 0)
+ seconds /= statp->nscount;
+ if (seconds <= 0)
+ seconds = 1;
+ now = evNowTime();
+ timeout = evConsTime(seconds, 0);
+ finish = evAddTime(now, timeout);
+ goto nonow;
+ wait:
+ now = evNowTime();
+ nonow:
+#ifndef USE_POLL
+ FD_ZERO(&dsmask);
+ FD_SET(s, &dsmask);
+ if (evCmpTime(finish, now) > 0)
+ timeout = evSubTime(finish, now);
+ else
+ timeout = evConsTime(0, 0);
+ n = pselect(s + 1, &dsmask, NULL, NULL, &timeout, NULL);
+#else
+ timeout = evSubTime(finish, now);
+ if (timeout.tv_sec < 0)
+ timeout = evConsTime(0, 0);
+ polltimeout = 1000*timeout.tv_sec +
+ timeout.tv_nsec/1000000;
+ pollfd.fd = s;
+ pollfd.events = POLLRDNORM;
+ n = poll(&pollfd, 1, polltimeout);
+#endif /* USE_POLL */
+
+ if (n == 0) {
+ Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
+ *gotsomewhere = 1;
+ return (0);
+ }
+ if (n < 0) {
+ if (errno == EINTR)
+ goto wait;
+#ifndef USE_POLL
+ Perror(statp, stderr, "select", errno);
+#else
+ Perror(statp, stderr, "poll", errno);
+#endif /* USE_POLL */
+ res_nclose(statp);
+ return (0);
+ }
+ errno = 0;
+ fromlen = sizeof(from);
+ resplen = recvfrom(s, (char*)ans, anssiz,0,
+ (struct sockaddr *)&from, &fromlen);
+ if (resplen <= 0) {
+ Perror(statp, stderr, "recvfrom", errno);
+ res_nclose(statp);
+ return (0);
+ }
+ *gotsomewhere = 1;
+ if (resplen < HFIXEDSZ) {
+ /*
+ * Undersized message.
+ */
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; undersized: %d\n",
+ resplen));
+ *terrno = EMSGSIZE;
+ res_nclose(statp);
+ return (0);
+ }
+ if (hp->id != anhp->id) {
+ /*
+ * response from old query, ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, ";; old answer:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+ if (!(statp->options & RES_INSECURE1) &&
+ !res_ourserver_p(statp, (struct sockaddr *)&from)) {
+ /*
+ * response from wrong server? ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, ";; not our server:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+#ifdef RES_USE_EDNS0
+ if (anhp->rcode == FORMERR && (statp->options & RES_USE_EDNS0) != 0U) {
+ /*
+ * Do not retry if the server do not understand EDNS0.
+ * The case has to be captured here, as FORMERR packet do not
+ * carry query section, hence res_queriesmatch() returns 0.
+ */
+ DprintQ(statp->options & RES_DEBUG,
+ (stdout, "server rejected query with EDNS0:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ /* record the error */
+ statp->_flags |= RES_F_EDNS0ERR;
+ res_nclose(statp);
+ return (0);
+ }
+#endif
+ if (!(statp->options & RES_INSECURE2) &&
+ !res_queriesmatch(buf, buf + buflen,
+ ans, ans + anssiz)) {
+ /*
+ * response contains wrong query? ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, ";; wrong query name:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ goto wait;
+ }
+ if (anhp->rcode == SERVFAIL ||
+ anhp->rcode == NOTIMP ||
+ anhp->rcode == REFUSED) {
+ DprintQ(statp->options & RES_DEBUG,
+ (stdout, "server rejected query:\n"),
+ ans, (resplen > anssiz) ? anssiz : resplen);
+ res_nclose(statp);
+ /* don't retry if called from dig */
+ if (!statp->pfcode)
+ return (0);
+ }
+ if (!(statp->options & RES_IGNTC) && anhp->tc) {
+ /*
+ * To get the rest of answer,
+ * use TCP with same server.
+ */
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; truncated answer\n"));
+ *v_circuit = 1;
+ res_nclose(statp);
+ return (1);
+ }
+ /*
+ * All is well, or the error is fatal. Signal that the
+ * next nameserver ought not be tried.
+ */
+ return (resplen);
+}
+
+static void
+Aerror(const res_state statp, FILE *file, const char *string, int error,
+ const struct sockaddr *address, int alen)
+{
+ int save = errno;
+ char hbuf[NI_MAXHOST];
+ char sbuf[NI_MAXSERV];
+
+ alen = alen;
+
+ if ((statp->options & RES_DEBUG) != 0U) {
+ if (getnameinfo(address, alen, hbuf, sizeof(hbuf),
+ sbuf, sizeof(sbuf), niflags)) {
+ strncpy(hbuf, "?", sizeof(hbuf) - 1);
+ hbuf[sizeof(hbuf) - 1] = '\0';
+ strncpy(sbuf, "?", sizeof(sbuf) - 1);
+ sbuf[sizeof(sbuf) - 1] = '\0';
+ }
+ fprintf(file, "res_send: %s ([%s].%s): %s\n",
+ string, hbuf, sbuf, strerror(error));
+ }
+ errno = save;
+}
+
+static void
+Perror(const res_state statp, FILE *file, const char *string, int error) {
+ int save = errno;
+
+ if ((statp->options & RES_DEBUG) != 0U)
+ fprintf(file, "res_send: %s: %s\n",
+ string, strerror(error));
+ errno = save;
+}
+
+static int
+sock_eq(struct sockaddr *a, struct sockaddr *b) {
+ struct sockaddr_in *a4, *b4;
+ struct sockaddr_in6 *a6, *b6;
+
+ if (a->sa_family != b->sa_family)
+ return 0;
+ switch (a->sa_family) {
+ case AF_INET:
+ a4 = (struct sockaddr_in *)a;
+ b4 = (struct sockaddr_in *)b;
+ return a4->sin_port == b4->sin_port &&
+ a4->sin_addr.s_addr == b4->sin_addr.s_addr;
+ case AF_INET6:
+ a6 = (struct sockaddr_in6 *)a;
+ b6 = (struct sockaddr_in6 *)b;
+ return a6->sin6_port == b6->sin6_port &&
+#ifdef HAVE_SIN6_SCOPE_ID
+ a6->sin6_scope_id == b6->sin6_scope_id &&
+#endif
+ IN6_ARE_ADDR_EQUAL(&a6->sin6_addr, &b6->sin6_addr);
+ default:
+ return 0;
+ }
+}
+
+#if defined(NEED_PSELECT) && !defined(USE_POLL)
+/* XXX needs to move to the porting library. */
+static int
+pselect(int nfds, void *rfds, void *wfds, void *efds,
+ struct timespec *tsp, const sigset_t *sigmask)
+{
+ struct timeval tv, *tvp;
+ sigset_t sigs;
+ int n;
+
+ if (tsp) {
+ tvp = &tv;
+ tv = evTimeVal(*tsp);
+ } else
+ tvp = NULL;
+ if (sigmask)
+ sigprocmask(SIG_SETMASK, sigmask, &sigs);
+ n = select(nfds, rfds, wfds, efds, tvp);
+ if (sigmask)
+ sigprocmask(SIG_SETMASK, &sigs, NULL);
+ if (tsp)
+ *tsp = evTimeSpec(tv);
+ return (n);
+}
+#endif
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_sendsigned.c b/usr/src/lib/libresolv2_joy/common/resolv/res_sendsigned.c
new file mode 100644
index 0000000000..5ebc1a70eb
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_sendsigned.c
@@ -0,0 +1,170 @@
+#include "port_before.h"
+#include "fd_setsize.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <isc/dst.h>
+
+#include <errno.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "port_after.h"
+
+#define DEBUG
+#include "res_debug.h"
+
+
+/*% res_nsendsigned */
+int
+res_nsendsigned(res_state statp, const u_char *msg, int msglen,
+ ns_tsig_key *key, u_char *answer, int anslen)
+{
+ res_state nstatp;
+ DST_KEY *dstkey;
+ int usingTCP = 0;
+ u_char *newmsg;
+ int newmsglen, bufsize, siglen;
+ u_char sig[64];
+ HEADER *hp;
+ time_t tsig_time;
+ int ret;
+ int len;
+
+ dst_init();
+
+ nstatp = (res_state) malloc(sizeof(*statp));
+ if (nstatp == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ memcpy(nstatp, statp, sizeof(*statp));
+
+ bufsize = msglen + 1024;
+ newmsg = (u_char *) malloc(bufsize);
+ if (newmsg == NULL) {
+ free(nstatp);
+ errno = ENOMEM;
+ return (-1);
+ }
+ memcpy(newmsg, msg, msglen);
+ newmsglen = msglen;
+
+ if (ns_samename(key->alg, NS_TSIG_ALG_HMAC_MD5) != 1)
+ dstkey = NULL;
+ else
+ dstkey = dst_buffer_to_key(key->name, KEY_HMAC_MD5,
+ NS_KEY_TYPE_AUTH_ONLY,
+ NS_KEY_PROT_ANY,
+ key->data, key->len);
+ if (dstkey == NULL) {
+ errno = EINVAL;
+ free(nstatp);
+ free(newmsg);
+ return (-1);
+ }
+
+ nstatp->nscount = 1;
+ siglen = sizeof(sig);
+ ret = ns_sign(newmsg, &newmsglen, bufsize, NOERROR, dstkey, NULL, 0,
+ sig, &siglen, 0);
+ if (ret < 0) {
+ free (nstatp);
+ free (newmsg);
+ dst_free_key(dstkey);
+ if (ret == NS_TSIG_ERROR_NO_SPACE)
+ errno = EMSGSIZE;
+ else if (ret == -1)
+ errno = EINVAL;
+ return (ret);
+ }
+
+ if (newmsglen > PACKETSZ || nstatp->options & RES_USEVC)
+ usingTCP = 1;
+ if (usingTCP == 0)
+ nstatp->options |= RES_IGNTC;
+ else
+ nstatp->options |= RES_USEVC;
+ /*
+ * Stop res_send printing the answer.
+ */
+ nstatp->options &= ~RES_DEBUG;
+ nstatp->pfcode &= ~RES_PRF_REPLY;
+
+retry:
+
+ len = res_nsend(nstatp, newmsg, newmsglen, answer, anslen);
+ if (len < 0) {
+ free (nstatp);
+ free (newmsg);
+ dst_free_key(dstkey);
+ return (len);
+ }
+
+ ret = ns_verify(answer, &len, dstkey, sig, siglen,
+ NULL, NULL, &tsig_time, nstatp->options & RES_KEEPTSIG);
+ if (ret != 0) {
+ Dprint((statp->options & RES_DEBUG) ||
+ ((statp->pfcode & RES_PRF_REPLY) &&
+ (statp->pfcode & RES_PRF_HEAD1)),
+ (stdout, ";; got answer:\n"));
+
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, "%s", ""),
+ answer, (anslen > len) ? len : anslen);
+
+ if (ret > 0) {
+ Dprint(statp->pfcode & RES_PRF_REPLY,
+ (stdout, ";; server rejected TSIG (%s)\n",
+ p_rcode(ret)));
+ } else {
+ Dprint(statp->pfcode & RES_PRF_REPLY,
+ (stdout, ";; TSIG invalid (%s)\n",
+ p_rcode(-ret)));
+ }
+
+ free (nstatp);
+ free (newmsg);
+ dst_free_key(dstkey);
+ if (ret == -1)
+ errno = EINVAL;
+ else
+ errno = ENOTTY;
+ return (-1);
+ }
+
+ hp = (HEADER *) answer;
+ if (hp->tc && !usingTCP && (statp->options & RES_IGNTC) == 0U) {
+ nstatp->options &= ~RES_IGNTC;
+ usingTCP = 1;
+ goto retry;
+ }
+ Dprint((statp->options & RES_DEBUG) ||
+ ((statp->pfcode & RES_PRF_REPLY) &&
+ (statp->pfcode & RES_PRF_HEAD1)),
+ (stdout, ";; got answer:\n"));
+
+ DprintQ((statp->options & RES_DEBUG) ||
+ (statp->pfcode & RES_PRF_REPLY),
+ (stdout, "%s", ""),
+ answer, (anslen > len) ? len : anslen);
+
+ Dprint(statp->pfcode & RES_PRF_REPLY, (stdout, ";; TSIG ok\n"));
+
+ free (nstatp);
+ free (newmsg);
+ dst_free_key(dstkey);
+ return (len);
+}
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/common/resolv/res_update.c b/usr/src/lib/libresolv2_joy/common/resolv/res_update.c
new file mode 100644
index 0000000000..df24aee3bd
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/resolv/res_update.c
@@ -0,0 +1,213 @@
+#if !defined(lint) && !defined(SABER)
+static const char rcsid[] = "$Id: res_update.c,v 1.13 2005/04/27 04:56:43 sra Exp $";
+#endif /* not lint */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*! \file
+ * \brief
+ * Based on the Dynamic DNS reference implementation by Viraj Bais
+ * &lt;viraj_bais@ccm.fm.intel.com>
+ */
+
+#include "port_before.h"
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <netdb.h>
+#include <res_update.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <isc/list.h>
+#include <resolv_joy.h>
+
+#include "port_after.h"
+#include "res_private.h"
+
+/*%
+ * Separate a linked list of records into groups so that all records
+ * in a group will belong to a single zone on the nameserver.
+ * Create a dynamic update packet for each zone and send it to the
+ * nameservers for that zone, and await answer.
+ * Abort if error occurs in updating any zone.
+ * Return the number of zones updated on success, < 0 on error.
+ *
+ * On error, caller must deal with the unsynchronized zones
+ * eg. an A record might have been successfully added to the forward
+ * zone but the corresponding PTR record would be missing if error
+ * was encountered while updating the reverse zone.
+ */
+
+struct zonegrp {
+ char z_origin[MAXDNAME];
+ ns_class z_class;
+ union res_sockaddr_union z_nsaddrs[MAXNS];
+ int z_nscount;
+ int z_flags;
+ LIST(ns_updrec) z_rrlist;
+ LINK(struct zonegrp) z_link;
+};
+
+#define ZG_F_ZONESECTADDED 0x0001
+
+/* Forward. */
+
+static void res_dprintf(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
+
+/* Macros. */
+
+#define DPRINTF(x) do {\
+ int save_errno = errno; \
+ if ((statp->options & RES_DEBUG) != 0U) res_dprintf x; \
+ errno = save_errno; \
+ } while (0)
+
+/* Public. */
+
+int
+res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
+ ns_updrec *rrecp;
+ u_char answer[PACKETSZ];
+ u_char *packet;
+ struct zonegrp *zptr, tgrp;
+ LIST(struct zonegrp) zgrps;
+ int nzones = 0, nscount = 0, n;
+ union res_sockaddr_union nsaddrs[MAXNS];
+
+ packet = malloc(NS_MAXMSG);
+ if (packet == NULL) {
+ DPRINTF(("malloc failed"));
+ return (0);
+ }
+ /* Thread all of the updates onto a list of groups. */
+ INIT_LIST(zgrps);
+ memset(&tgrp, 0, sizeof (tgrp));
+ for (rrecp = rrecp_in; rrecp;
+ rrecp = LINKED(rrecp, r_link) ? NEXT(rrecp, r_link) : NULL) {
+ int nscnt;
+ /* Find the origin for it if there is one. */
+ tgrp.z_class = rrecp->r_class;
+ nscnt = res_findzonecut2(statp, rrecp->r_dname, tgrp.z_class,
+ RES_EXHAUSTIVE, tgrp.z_origin,
+ sizeof tgrp.z_origin,
+ tgrp.z_nsaddrs, MAXNS);
+ if (nscnt <= 0) {
+ DPRINTF(("res_findzonecut failed (%d)", nscnt));
+ goto done;
+ }
+ tgrp.z_nscount = nscnt;
+ /* Find the group for it if there is one. */
+ for (zptr = HEAD(zgrps); zptr != NULL; zptr = NEXT(zptr, z_link))
+ if (ns_samename(tgrp.z_origin, zptr->z_origin) == 1 &&
+ tgrp.z_class == zptr->z_class)
+ break;
+ /* Make a group for it if there isn't one. */
+ if (zptr == NULL) {
+ zptr = malloc(sizeof *zptr);
+ if (zptr == NULL) {
+ DPRINTF(("malloc failed"));
+ goto done;
+ }
+ *zptr = tgrp;
+ zptr->z_flags = 0;
+ INIT_LINK(zptr, z_link);
+ INIT_LIST(zptr->z_rrlist);
+ APPEND(zgrps, zptr, z_link);
+ }
+ /* Thread this rrecp onto the right group. */
+ APPEND(zptr->z_rrlist, rrecp, r_glink);
+ }
+
+ for (zptr = HEAD(zgrps); zptr != NULL; zptr = NEXT(zptr, z_link)) {
+ /* Construct zone section and prepend it. */
+ rrecp = res_mkupdrec(ns_s_zn, zptr->z_origin,
+ zptr->z_class, ns_t_soa, 0);
+ if (rrecp == NULL) {
+ DPRINTF(("res_mkupdrec failed"));
+ goto done;
+ }
+ PREPEND(zptr->z_rrlist, rrecp, r_glink);
+ zptr->z_flags |= ZG_F_ZONESECTADDED;
+
+ /* Marshall the update message. */
+ n = res_nmkupdate(statp, HEAD(zptr->z_rrlist),
+ packet, NS_MAXMSG);
+ DPRINTF(("res_mkupdate -> %d", n));
+ if (n < 0)
+ goto done;
+
+ /* Temporarily replace the resolver's nameserver set. */
+ nscount = res_getservers(statp, nsaddrs, MAXNS);
+ res_setservers(statp, zptr->z_nsaddrs, zptr->z_nscount);
+
+ /* Send the update and remember the result. */
+ if (key != NULL)
+ n = res_nsendsigned(statp, packet, n, key,
+ answer, sizeof answer);
+ else
+ n = res_nsend(statp, packet, n, answer, sizeof answer);
+ if (n < 0) {
+ DPRINTF(("res_nsend: send error, n=%d (%s)\n",
+ n, strerror(errno)));
+ goto done;
+ }
+ if (((HEADER *)answer)->rcode == NOERROR)
+ nzones++;
+
+ /* Restore resolver's nameserver set. */
+ res_setservers(statp, nsaddrs, nscount);
+ nscount = 0;
+ }
+ done:
+ while (!EMPTY(zgrps)) {
+ zptr = HEAD(zgrps);
+ if ((zptr->z_flags & ZG_F_ZONESECTADDED) != 0)
+ res_freeupdrec(HEAD(zptr->z_rrlist));
+ UNLINK(zgrps, zptr, z_link);
+ free(zptr);
+ }
+ if (nscount != 0)
+ res_setservers(statp, nsaddrs, nscount);
+
+ free(packet);
+ return (nzones);
+}
+
+/* Private. */
+
+static void
+res_dprintf(const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ fputs(";; res_nupdate: ", stderr);
+ vfprintf(stderr, fmt, ap);
+ fputc('\n', stderr);
+ va_end(ap);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/sunw/sunw_mtctxres.c b/usr/src/lib/libresolv2_joy/common/sunw/sunw_mtctxres.c
new file mode 100644
index 0000000000..cc2a485ede
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/sunw/sunw_mtctxres.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <port_before.h>
+#include <thread.h>
+#include <errno.h>
+#include <netdb.h>
+#include <malloc.h>
+#include <string.h>
+#include <resolv_mt.h>
+#include <irs.h>
+#include <port_after.h>
+
+#pragma redefine_extname __h_errno __joy_h_errno
+
+/*
+ * much of the original version of sunw_mtxtxres.c was incorporated into
+ * ISC libbind as resolv/mtctxres.c. The following bits have not yet made
+ * it into ISC libbind.
+ */
+
+/*
+ * There used to be a private, MT-safe resolver interface that used TSD
+ * to store per-thread _res, h_errno, etc. We continue to provide the
+ * access functions __res_get_res() and __res_get_h_errno() so that binaries
+ * that used the private interface will continue to work.
+ */
+
+#ifdef _res
+#undef _res
+#endif
+
+extern struct __res_state *__res_state(void);
+
+struct __res_state *
+__res_get_res(void) {
+ return (__res_state());
+}
+
+
+#ifdef h_errno
+#undef h_errno
+#endif
+
+extern int *__h_errno(void);
+
+int *
+__res_get_h_errno(void) {
+ return (__h_errno());
+}
+
+
+#ifdef SUNW_HOSTS_FALLBACK
+
+/*
+ * When the name service switch calls libresolv, it doesn't want fallback
+ * to /etc/hosts, so we provide a method to turn it off.
+ */
+
+void
+__joy_res_set_no_hosts_fallback(void) {
+ ___mtctxres()->no_hosts_fallback_private = 1;
+}
+
+void
+__joy_res_unset_no_hosts_fallback(void) {
+ ___mtctxres()->no_hosts_fallback_private = 0;
+}
+
+int
+__res_no_hosts_fallback(void) {
+ return (___mtctxres()->no_hosts_fallback_private);
+}
+
+#endif /* SUNW_HOSTS_FALLBACK */
+
+#ifdef SUNW_OVERRIDE_RETRY
+
+/*
+ * The NS switch wants to be able to override the number of retries.
+ */
+
+int
+__joy_res_override_retry(int retry) {
+ ___mtctxres()->retry_private = retry;
+ /*
+ * This function doesn't really need a return value; saving the
+ * old retry setting, and restoring it, is handled by __res_retry()
+ * and __res_retry_reset() below. However, the nss_dns library
+ * must have a private version of this function to be used when
+ * running with an old libresolv. That private nss_dns function
+ * needs a return value, and a function pointer is used to select
+ * the right function at runtime. Thus, __res_override_retry
+ * must have a function prototype consistent with the private
+ * nss_dns function, i.e., one that returns an int.
+ *
+ * Given that we do have a return value, that value must be zero.
+ * That's because retry_private == 0 is used to indicate that
+ * no override retry value is in effect, and the way we expect
+ * nss_dns to call us is:
+ *
+ * int oldretry = __res_override_retry(N);
+ * <whatever>
+ * (void)__res_override_retry(old_retry);
+ */
+ return (0);
+}
+
+int
+__res_retry(int retry) {
+ mtctxres_t *mt = ___mtctxres();
+
+ mt->retry_save = retry;
+ return ((mt->retry_private != 0) ? mt->retry_private : retry);
+}
+
+int
+__res_retry_reset(void) {
+ mtctxres_t *mt = ___mtctxres();
+
+ return (mt->retry_save);
+}
+
+#endif /* SUNW_OVERRIDE_RETRY */
diff --git a/usr/src/lib/libresolv2_joy/common/sunw/sunw_updrec.c b/usr/src/lib/libresolv2_joy/common/sunw/sunw_updrec.c
new file mode 100644
index 0000000000..3b0ffc49df
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/sunw/sunw_updrec.c
@@ -0,0 +1,249 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * As of BIND 8.2.2, ISC (a) removed res_mkupdate(), res_update(), and
+ * res_mkupdrec() from what they consider the supported interface. The
+ * functions still exist, but their calling interface has changed, since
+ * the ns_updrec structure has changed.
+ *
+ * It seems probable that res_mkupdate() etc. will return, though possibly
+ * with other changes, in some future BIND release. In order to avoid
+ * going to PSARC twice (once to remove the functions, and then again to
+ * add them back), we retain the old interface as a wrapper around the
+ * new one.
+ */
+
+#include <port_before.h>
+
+#include <malloc.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+/* get the Solaris ns_updrec before any renaming happens */
+#include <arpa/nameser.h>
+
+/* get the __ISC_ns_updrec */
+#include <res_update.h>
+
+#include <port_after.h>
+
+/* un-rename ns_updrec and res_* functions so we can wrap them */
+#undef ns_updrec
+#undef res_mkupdate
+#undef res_update
+#undef res_mkupdrec
+#undef res_freeupdrec
+#undef res_nmkupdate
+#undef res_nupdate
+
+void res_freeupdrec(ns_updrec *);
+
+static int
+old2new(ns_updrec *old, __ISC_ns_updrec *new) {
+
+ if (old->r_dname != 0) {
+ if ((new->r_dname = strdup(old->r_dname)) == 0)
+ return (-1);
+ } else {
+ new->r_dname = 0;
+ }
+
+ new->r_glink.prev =
+ new->r_glink.next =
+ new->r_link.prev =
+ new->r_link.next = 0;
+
+ new->r_section = old->r_section;
+ new->r_class = old->r_class;
+ new->r_type = old->r_type;
+ new->r_ttl = old->r_ttl;
+ new->r_data = old->r_data;
+ new->r_size = old->r_size;
+ new->r_opcode = old->r_opcode;
+ new->r_dp = old->r_dp;
+ new->r_deldp = old->r_deldp;
+ new->r_zone = old->r_zone;
+
+ return (0);
+}
+
+
+static int
+new2old(__ISC_ns_updrec *new, ns_updrec *old) {
+ /* XXX r_prev and r_next unchanged */
+ if (new->r_dname != 0) {
+ if ((old->r_dname = strdup(new->r_dname)) == 0)
+ return (-1);
+ } else {
+ old->r_dname = 0;
+ }
+ old->r_section = new->r_section;
+ old->r_class = new->r_class;
+ old->r_type = new->r_type;
+ old->r_ttl = new->r_ttl;
+ old->r_data = new->r_data;
+ old->r_size = new->r_size;
+ old->r_opcode = new->r_opcode;
+ old->r_grpnext = 0; /* XXX */
+ old->r_dp = new->r_dp;
+ old->r_deldp = new->r_deldp;
+ old->r_zone = new->r_zone;
+
+ return (0);
+}
+
+
+static void
+delete_list(__ISC_ns_updrec *list) {
+
+ __ISC_ns_updrec *next;
+
+ for (; list != 0; list = next) {
+ next = list->r_link.next;
+ __ISC_res_freeupdrec(list);
+ }
+}
+
+
+static __ISC_ns_updrec *
+copy_list(ns_updrec *old, int do_glink) {
+
+ __ISC_ns_updrec *list = 0, *r, *p;
+
+ if (old == 0)
+ return (0);
+
+ for (p = 0; old != 0; old = old->r_next, p = r) {
+ if ((r = calloc(1, sizeof (*r))) == 0 ||
+ old2new(old, r) != 0) {
+ free(r);
+ delete_list(list);
+ return (0);
+ }
+ r->r_link.prev = p;
+ r->r_link.next = 0;
+ /* res_update and res_nupdate want r_glink set up like this */
+ if (do_glink) {
+ r->r_glink.prev = p;
+ r->r_glink.next = 0;
+ } else {
+ r->r_glink.prev = (void *)-1;
+ r->r_glink.next = (void *)-1;
+ }
+ if (p != 0) {
+ p->r_link.next = r;
+ if (do_glink) {
+ p->r_glink.next = r;
+ }
+ } else {
+ list = r;
+ }
+ }
+ return (list);
+}
+
+
+int
+res_mkupdate(ns_updrec *rrecp_in, uchar_t *buf, int length) {
+
+ __ISC_ns_updrec *r;
+ int ret;
+
+ if ((r = copy_list(rrecp_in, 1)) == 0)
+ return (-1);
+
+ ret = __ISC_res_mkupdate(r, buf, length);
+
+ delete_list(r);
+
+ return (ret);
+}
+
+int
+res_nmkupdate(res_state statp, ns_updrec *rrecp_in, uchar_t *buf, int length) {
+
+ __ISC_ns_updrec *r;
+ int ret;
+
+ if ((r = copy_list(rrecp_in, 1)) == 0)
+ return (-1);
+
+ ret = __ISC_res_nmkupdate(statp, r, buf, length);
+
+ delete_list(r);
+
+ return (ret);
+}
+
+
+int
+res_update(ns_updrec *rrecp_in) {
+
+ __ISC_ns_updrec *r;
+ int ret;
+
+ if ((r = copy_list(rrecp_in, 0)) == 0)
+ return (-1);
+
+ ret = __ISC_res_update(r);
+
+ delete_list(r);
+
+ return (ret);
+}
+
+int
+res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
+
+ __ISC_ns_updrec *r;
+ int ret;
+
+ if ((r = copy_list(rrecp_in, 0)) == 0)
+ return (-1);
+
+ ret = __ISC_res_nupdate(statp, r, key);
+
+ delete_list(r);
+
+ return (ret);
+}
+
+
+
+ns_updrec *
+res_mkupdrec(int section, const char *dname, uint_t class, uint_t type,
+ uint_t ttl) {
+
+ __ISC_ns_updrec *n;
+ ns_updrec *o;
+
+ n = __ISC_res_mkupdrec(section, dname, class, type, ttl);
+ if (n == 0)
+ return (0);
+
+ if ((o = calloc(1, sizeof (*o))) != 0) {
+ if (new2old(n, o) != 0) {
+ res_freeupdrec(o);
+ o = 0;
+ }
+ }
+
+ __ISC_res_freeupdrec(n);
+
+ return (o);
+}
+
+
+void
+res_freeupdrec(ns_updrec *rrecp) {
+ if (rrecp == 0)
+ return;
+ /* Note: freeing r_dp is the caller's responsibility. */
+ if (rrecp->r_dname != NULL)
+ free(rrecp->r_dname);
+ free(rrecp);
+}
diff --git a/usr/src/lib/libresolv2_joy/common/sunw/sunw_wrappers.c b/usr/src/lib/libresolv2_joy/common/sunw/sunw_wrappers.c
new file mode 100644
index 0000000000..55bbe07024
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/common/sunw/sunw_wrappers.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <port_before.h>
+#include <resolv_joy.h>
+#include <arpa/inet.h>
+#include <port_after.h>
+
+#undef p_option
+/* extern const char * isc_p_option(); */
+const char *p_option(uint_t option) {
+ return (isc_p_option((ulong_t)option));
+}
+#pragma weak __p_option = p_option
+
+#undef p_secstodate
+/* extern char * isc_p_secstodate (); */
+char *p_secstodate(uint_t secs) {
+ return (isc_p_secstodate((ulong_t)secs));
+}
+#pragma weak __p_secstodate = p_secstodate
diff --git a/usr/src/lib/print/libhttp-core/i386/Makefile b/usr/src/lib/libresolv2_joy/i386/Makefile
index 0bc3313291..a333224278 100644
--- a/usr/src/lib/print/libhttp-core/i386/Makefile
+++ b/usr/src/lib/libresolv2_joy/i386/Makefile
@@ -27,4 +27,4 @@
include ../Makefile.com
-install: all $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS)
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/cmd/lp/lib/Makefile b/usr/src/lib/libresolv2_joy/include/Makefile
index 05b200bfc9..8bff3c3188 100644
--- a/usr/src/cmd/lp/lib/Makefile
+++ b/usr/src/lib/libresolv2_joy/include/Makefile
@@ -26,49 +26,35 @@
# ident "%Z%%M% %I% %E% SMI"
#
-#
-# cmd/lp/lib/Makefile
-#
-
-SUBDIRS = \
- access \
- class \
- filters \
- forms \
- lp \
- msgs \
- oam \
- requests\
- secure \
- printers\
- users \
- papi
+include ../../../Makefile.master
+HDRS= os_version.h port_ipv6.h
+TMPHDRS= new_os_version.h new_port_ipv6.h
all := TARGET= all
-install := TARGET= install
clean := TARGET= clean
clobber := TARGET= clobber
-lint := TARGET= lint
-strip := TARGET= strip
-catalog := TARGET= catalog
+install := TARGET= install
.KEEP_STATE:
-all install: $(SUBDIRS)
+all lint: $(HDRS)
-clean lint: $(SUBDIRS)
+install: all
-clobber: $(SUBDIRS) local_clobber
+clean:
+ $(RM) $(HDRS) $(TMPHDRS)
-strip:
+clobber: clean
-local_clobber:
- $(RM) $(CLOBBERFILES)
+# os_version.h and port_ipv6.h should be rebuilt when you change OS
+# revision. Since that's not easily expressed as a dependency, we
+# rebuild them every time.
-catalog: $(SUBDIRS)
+os_version.h: make_os_version FRC
+ ./make_os_version
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
+port_ipv6.h: probe_ipv6 FRC
+ CC="$(CC)" ./probe_ipv6
FRC:
diff --git a/usr/src/lib/libresolv2_joy/include/arpa/port_inet.h b/usr/src/lib/libresolv2_joy/include/arpa/port_inet.h
new file mode 100644
index 0000000000..5eb1787f56
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/arpa/port_inet.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ *
+ * All rights reserved.
+ */
+
+#ifndef _ARPA_PORT_INET_H
+#define _ARPA_PORT_INET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * these are libresolv2 functions that were made local in previous versions
+ * we rename them res_* because they conflict with libnsl or libsocket
+ */
+
+#define inet_lnaof res_inet_lnaof /* libsocket */
+ulong_t inet_lnaof(struct in_addr in);
+
+#define inet_makeaddr res_inet_makeaddr /* libsocket */
+struct in_addr inet_makeaddr(ulong_t net, ulong_t host);
+
+#define inet_netof res_inet_netof /* libnsl */
+ulong_t inet_netof(struct in_addr in);
+
+#define inet_network res_inet_network /* libsocket */
+ulong_t inet_network(register const char *cp);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /* _ARPA_PORT_INET_H */
diff --git a/usr/src/lib/libresolv2_joy/include/arpa/port_nameser.h b/usr/src/lib/libresolv2_joy/include/arpa/port_nameser.h
new file mode 100644
index 0000000000..b40ea0d163
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/arpa/port_nameser.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _ARPA_PORT_NAMESER_H
+#define _ARPA_PORT_NAMESER_H
+
+/*
+ * ISC changed the ns_updrec structure. However, it's a public interface
+ * in Solaris, so we rename it here and wrap in sunw_updrec.c
+ */
+#define ns_updrec __ISC_ns_updrec
+
+
+/*
+ * Due to the above, the following functions need to be renamed and
+ * wrapped in sunw_updrec.c.
+ *
+ * For BIND 8.2.2, ISC removed the dynamic update functions, and the
+ * definition of the ns_updrec structure, from the public include files
+ * (<resolv.h>, <arpa/nameser.h>. However, res_update(), res_mkupdate(),
+ * and res_mkupdrec() are in the public libresolv interface in Solaris,
+ * so we can't easily remove them. Thus, ISC's new versions of res_mkupdate()
+ * etc. can't be exposed under their original names.
+ *
+ * res_nmkupdate() and res_nupdate are new. We could either change them
+ * to accept the <arpa/nameser.h> ns_updrec, or leave them unchanged and
+ * undocumented. Since ISC may change ns_updrec again, we pick the latter
+ * solution for now.
+ */
+#define res_mkupdate __ISC_res_mkupdate
+#define res_update __ISC_res_update
+#define res_mkupdrec __ISC_res_mkupdrec
+#define res_freeupdrec __ISC_res_freeupdrec
+#define res_nmkupdate __ISC_res_nmkupdate
+#define res_nupdate __ISC_res_nupdate
+
+
+#endif /* _ARPA_PORT_NAMESER_H */
diff --git a/usr/src/lib/libresolv2_joy/include/conf/sunoptions.h b/usr/src/lib/libresolv2_joy/include/conf/sunoptions.h
new file mode 100644
index 0000000000..b75ff9d878
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/conf/sunoptions.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SUNOPTIONS_H
+#define _SUNOPTIONS_H
+
+#define USELOOPBACK /* Resolver library defaults to 127.0.0.1 */
+
+/* Additions for Solaris 2 */
+
+#define SUNW_INITCHKIF /* Check if any non-loopback interface is up */
+#define SUNW_CONFCHECK /* Abort quickly if no /etc/resolv.conf or */
+ /* local named */
+#define SUNW_HOSTS_FALLBACK /* Configurable /etc/hosts fallback */
+#define SUNW_HNOK_UNDERSCORE /* Allow underscore in hostnames (libresolv) */
+#define SUNW_MT_RESOLVER /* MT hot extensions (libresolv) */
+#define SUNW_SETHERRNO /* ISC does not set h_errno in gethostbyname */
+#define SUNW_OVERRIDE_RETRY /* Allow NS switch to override res->retry */
+#define SUNW_LIBMD5 /* Use md5(3EXT) instead of internal implementation */
+
+/* If compiling an MT warm libresolv, we also need reentrancy */
+#if defined(SUNW_MT_RESOLVER) && !defined(_REENTRANT)
+#define _REENTRANT
+#endif
+
+/* End additions for Solaris 2 */
+
+#endif /* _SUNOPTIONS_H */
diff --git a/usr/src/lib/libresolv2_joy/include/config.h b/usr/src/lib/libresolv2_joy/include/config.h
new file mode 100644
index 0000000000..35fb115a0f
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/config.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/* config.h. Generated from config.h.in by configure. */
+/* #undef _SOCKADDR_LEN */
+#define HAVE_FCNTL_H 1
+/* #undef HAVE_PATHS_H */
+#define HAVE_INTTYPES_H 1
+#define HAVE_STROPTS_H 1
+/* #undef HAVE_SYS_TIMERS_H */
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_MEMORY_H 1
+/* #undef SYS_CDEFS_H */
+#define _POSIX_PTHREAD_SEMANTICS 1
+#define POSIX_GETPWUID_R 1
+#define POSIX_GETPWNAM_R 1
+#define POSIX_GETGRGID_R 1
+#define POSIX_GETGRNAM_R 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCHR 1
+/* #undef SPRINTF_CHAR */
+/* #undef VSPRINTF_CHAR */
+#define USE_SYSERROR_LIST 1
+/* #undef NEED_STRTOUL */
+/* #undef NEED_SUN4PROTOS */
+/* #undef REENABLE_SEND */
+
+#define NEED_SETGROUPENT 1
+#define NEED_GETGROUPLIST 1
+
+/* define if prototype for getgrnam_r() is required */
+/* #undef NEED_GETGRNAM_R */
+/* #undef NEED_GETGRGID_R */
+/* #undef NEED_GETGRENT_R */
+#define NEED_SETGRENT_R 1
+#define NEED_ENDGRENT_R 1
+
+#define NEED_INNETGR_R 1
+/* #undef NEED_SETNETGRENT_R */
+#define NEED_ENDNETGRENT_R 1
+
+/* #undef NEED_GETPWNAM_R */
+/* #undef NEED_GETPWUID_R */
+#define NEED_SETPWENT_R 1
+#define NEED_SETPASSENT_R 1
+#define NEED_SETPWENT_R 1
+/* #undef NEED_GETPWENT_R */
+#define NEED_ENDPWENT_R 1
+
+#define NEED_SETPASSENT 1
+
+/* #undef HAS_PW_CLASS */
+
+/* #undef ssize_t */
+/* #undef uintptr_t */
+
+/* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */
+/* #undef SHUTUP_SPUTAUX */
+#ifdef SHUTUP_SPUTAUX
+struct __sFILE;
+extern __inline int __sputaux(int _c, struct __sFILE *_p);
+#endif
+#define BROKEN_IN6ADDR_INIT_MACROS 1
+#define HAVE_STRLCAT 1
+/* Shut up warnings about missing braces */
+/* #undef SHUTUP_MUTEX_INITIALIZER */
+#ifdef SHUTUP_MUTEX_INITIALIZER
+#define LIBBIND_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
+#else
+#define LIBBIND_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#endif
+
diff --git a/usr/src/lib/libresolv2_joy/include/err.h b/usr/src/lib/libresolv2_joy/include/err.h
new file mode 100644
index 0000000000..45992ea336
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/err.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2001 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)err.h 8.1 (Berkeley) 6/2/93
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#ifndef _ERR_H_
+#define _ERR_H_
+
+#include <sys/cdefs.h>
+#include <stdarg.h>
+
+__BEGIN_DECLS
+__dead void err __P((int, const char *, ...)) __attribute__((__volatile));
+__dead void verr __P((int, const char *, va_list))
+ __attribute__((__volatile));
+__dead void errx __P((int, const char *, ...)) __attribute__((__volatile));
+__dead void verrx __P((int, const char *, va_list))
+ __attribute__((__volatile));
+void warn __P((const char *, ...));
+void vwarn __P((const char *, va_list));
+void warnx __P((const char *, ...));
+void vwarnx __P((const char *, va_list));
+__END_DECLS
+
+#endif /* !_ERR_H_ */
diff --git a/usr/src/lib/libresolv2_joy/include/fd_setsize.h b/usr/src/lib/libresolv2_joy/include/fd_setsize.h
new file mode 100644
index 0000000000..0e21049742
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/fd_setsize.h
@@ -0,0 +1,10 @@
+#ifndef _FD_SETSIZE_H
+#define _FD_SETSIZE_H
+
+/*%
+ * If you need a bigger FD_SETSIZE, this is NOT the place to set it.
+ * This file is a fallback for BIND ports which don't specify their own.
+ */
+
+#endif /* _FD_SETSIZE_H */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/hesiod.h b/usr/src/lib/libresolv2_joy/include/hesiod.h
new file mode 100644
index 0000000000..d64c0c5e80
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/hesiod.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*! \file
+ * \brief
+ * This file is primarily maintained by <tytso@mit.edu> and <ghudson@mit.edu>.
+ */
+
+/*
+ * $Id: hesiod.h,v 1.4 2005/04/27 04:56:14 sra Exp $
+ */
+
+#ifndef _HESIOD_H_INCLUDED
+#define _HESIOD_H_INCLUDED
+
+int hesiod_init __P((void **));
+void hesiod_end __P((void *));
+char * hesiod_to_bind __P((void *, const char *, const char *));
+char ** hesiod_resolve __P((void *, const char *, const char *));
+void hesiod_free_list __P((void *, char **));
+struct __res_state * __hesiod_res_get __P((void *));
+void __hesiod_res_set __P((void *, struct __res_state *,
+ void (*)(void *)));
+
+#endif /*_HESIOD_H_INCLUDED*/
diff --git a/usr/src/lib/libresolv2_joy/include/irp.h b/usr/src/lib/libresolv2_joy/include/irp.h
new file mode 100644
index 0000000000..1290bd068f
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/irp.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: irp.h,v 1.4 2005/04/27 04:56:15 sra Exp $
+ */
+
+#ifndef _IRP_H_INCLUDED
+#define _IRP_H_INCLUDED
+
+/*! \file */
+
+#define IRPD_TIMEOUT 30 /*%< seconds */
+#define IRPD_MAXSESS 50 /*%< number of simultaneous sessions. */
+#define IRPD_PORT 6660 /*%< 10 times the number of the beast. */
+#define IRPD_PATH "/var/run/irpd" /*%< af_unix socket path */
+
+/* If sets the environment variable IRPDSERVER to an IP address
+ (e.g. "192.5.5.1"), then that's the host the client expects irpd to be
+ running on. */
+#define IRPD_HOST_ENV "IRPDSERVER"
+
+/* Protocol response codes. */
+#define IRPD_WELCOME_CODE 200
+#define IRPD_NOT_WELCOME_CODE 500
+
+#define IRPD_GETHOST_ERROR 510
+#define IRPD_GETHOST_NONE 210
+#define IRPD_GETHOST_OK 211
+#define IRPD_GETHOST_SETOK 212
+
+#define IRPD_GETNET_ERROR 520
+#define IRPD_GETNET_NONE 220
+#define IRPD_GETNET_OK 221
+#define IRPD_GETNET_SETOK 222
+
+#define IRPD_GETUSER_ERROR 530
+#define IRPD_GETUSER_NONE 230
+#define IRPD_GETUSER_OK 231
+#define IRPD_GETUSER_SETOK 232
+
+#define IRPD_GETGROUP_ERROR 540
+#define IRPD_GETGROUP_NONE 240
+#define IRPD_GETGROUP_OK 241
+#define IRPD_GETGROUP_SETOK 242
+
+#define IRPD_GETSERVICE_ERROR 550
+#define IRPD_GETSERVICE_NONE 250
+#define IRPD_GETSERVICE_OK 251
+#define IRPD_GETSERVICE_SETOK 252
+
+#define IRPD_GETPROTO_ERROR 560
+#define IRPD_GETPROTO_NONE 260
+#define IRPD_GETPROTO_OK 261
+#define IRPD_GETPROTO_SETOK 262
+
+#define IRPD_GETNETGR_ERROR 570
+#define IRPD_GETNETGR_NONE 270
+#define IRPD_GETNETGR_OK 271
+#define IRPD_GETNETGR_NOMORE 272
+#define IRPD_GETNETGR_MATCHES 273
+#define IRPD_GETNETGR_NOMATCH 274
+#define IRPD_GETNETGR_SETOK 275
+#define IRPD_GETNETGR_SETERR 276
+
+#define irs_irp_read_body __irs_irp_read_body
+#define irs_irp_read_response __irs_irp_read_response
+#define irs_irp_disconnect __irs_irp_disconnect
+#define irs_irp_connect __irs_irp_connect
+#define irs_irp_connection_setup __irs_irp_connection_setup
+#define irs_irp_send_command __irs_irp_send_command
+
+struct irp_p;
+
+char *irs_irp_read_body(struct irp_p *, size_t *);
+int irs_irp_read_response(struct irp_p *, char *, size_t);
+void irs_irp_disconnect(struct irp_p *);
+int irs_irp_connect(struct irp_p *);
+int irs_irp_is_connected(struct irp_p *);
+int irs_irp_connection_setup(struct irp_p *, int *);
+#ifdef __GNUC__
+int irs_irp_send_command(struct irp_p *, const char *, ...)
+ __attribute__((__format__(__printf__, 2, 3)));
+#else
+int irs_irp_send_command(struct irp_p *, const char *, ...);
+#endif
+int irs_irp_get_full_response(struct irp_p *, int *, char *, size_t,
+ char **, size_t *);
+int irs_irp_read_line(struct irp_p *, char *, int);
+
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/irs.h b/usr/src/lib/libresolv2_joy/include/irs.h
new file mode 100644
index 0000000000..386e3cb3f6
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/irs.h
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: irs.h,v 1.5 2005/04/27 04:56:15 sra Exp $
+ */
+
+#ifndef _IRS_H_INCLUDED
+#define _IRS_H_INCLUDED
+
+/*! \file */
+
+#include <sys/types.h>
+
+#include <arpa/nameser.h>
+
+#include <grp.h>
+#include <netdb.h>
+#include <resolv_joy.h>
+#include <pwd.h>
+
+/*%
+ * This is the group map class.
+ */
+struct irs_gr {
+ void * private;
+ void (*close) __P((struct irs_gr *));
+ struct group * (*next) __P((struct irs_gr *));
+ struct group * (*byname) __P((struct irs_gr *, const char *));
+ struct group * (*bygid) __P((struct irs_gr *, gid_t));
+ int (*list) __P((struct irs_gr *, const char *,
+ gid_t, gid_t *, int *));
+ void (*rewind) __P((struct irs_gr *));
+ void (*minimize) __P((struct irs_gr *));
+ struct __res_state * (*res_get) __P((struct irs_gr *));
+ void (*res_set) __P((struct irs_gr *, res_state,
+ void (*)(void *)));
+};
+
+/*%
+ * This is the password map class.
+ */
+struct irs_pw {
+ void * private;
+ void (*close) __P((struct irs_pw *));
+ struct passwd * (*next) __P((struct irs_pw *));
+ struct passwd * (*byname) __P((struct irs_pw *, const char *));
+ struct passwd * (*byuid) __P((struct irs_pw *, uid_t));
+ void (*rewind) __P((struct irs_pw *));
+ void (*minimize) __P((struct irs_pw *));
+ struct __res_state * (*res_get) __P((struct irs_pw *));
+ void (*res_set) __P((struct irs_pw *, res_state,
+ void (*)(void *)));
+};
+
+/*%
+ * This is the service map class.
+ */
+struct irs_sv {
+ void * private;
+ void (*close) __P((struct irs_sv *));
+ struct servent *(*byname) __P((struct irs_sv *,
+ const char *, const char *));
+ struct servent *(*byport) __P((struct irs_sv *, int, const char *));
+ struct servent *(*next) __P((struct irs_sv *));
+ void (*rewind) __P((struct irs_sv *));
+ void (*minimize) __P((struct irs_sv *));
+ struct __res_state * (*res_get) __P((struct irs_sv *));
+ void (*res_set) __P((struct irs_sv *, res_state,
+ void (*)(void *)));
+};
+
+/*%
+ * This is the protocols map class.
+ */
+struct irs_pr {
+ void * private;
+ void (*close) __P((struct irs_pr *));
+ struct protoent *(*byname) __P((struct irs_pr *, const char *));
+ struct protoent *(*bynumber) __P((struct irs_pr *, int));
+ struct protoent *(*next) __P((struct irs_pr *));
+ void (*rewind) __P((struct irs_pr *));
+ void (*minimize) __P((struct irs_pr *));
+ struct __res_state * (*res_get) __P((struct irs_pr *));
+ void (*res_set) __P((struct irs_pr *, res_state,
+ void (*)(void *)));
+};
+
+/*%
+ * This is the hosts map class.
+ */
+struct irs_ho {
+ void * private;
+ void (*close) __P((struct irs_ho *));
+ struct hostent *(*byname) __P((struct irs_ho *, const char *));
+ struct hostent *(*byname2) __P((struct irs_ho *, const char *, int));
+ struct hostent *(*byaddr) __P((struct irs_ho *,
+ const void *, int, int));
+ struct hostent *(*next) __P((struct irs_ho *));
+ void (*rewind) __P((struct irs_ho *));
+ void (*minimize) __P((struct irs_ho *));
+ struct __res_state * (*res_get) __P((struct irs_ho *));
+ void (*res_set) __P((struct irs_ho *, res_state,
+ void (*)(void *)));
+ struct addrinfo *(*addrinfo) __P((struct irs_ho *, const char *,
+ const struct addrinfo *));
+};
+
+/*%
+ * This is the networks map class.
+ */
+struct irs_nw {
+ void * private;
+ void (*close) __P((struct irs_nw *));
+ struct nwent * (*byname) __P((struct irs_nw *, const char *, int));
+ struct nwent * (*byaddr) __P((struct irs_nw *, void *, int, int));
+ struct nwent * (*next) __P((struct irs_nw *));
+ void (*rewind) __P((struct irs_nw *));
+ void (*minimize) __P((struct irs_nw *));
+ struct __res_state * (*res_get) __P((struct irs_nw *));
+ void (*res_set) __P((struct irs_nw *, res_state,
+ void (*)(void *)));
+};
+
+/*%
+ * This is the netgroups map class.
+ */
+struct irs_ng {
+ void * private;
+ void (*close) __P((struct irs_ng *));
+ int (*next) __P((struct irs_ng *, const char **,
+ const char **, const char **));
+ int (*test) __P((struct irs_ng *, const char *,
+ const char *, const char *,
+ const char *));
+ void (*rewind) __P((struct irs_ng *, const char *));
+ void (*minimize) __P((struct irs_ng *));
+};
+
+/*%
+ * This is the generic map class, which copies the front of all others.
+ */
+struct irs_map {
+ void * private;
+ void (*close) __P((void *));
+};
+
+/*%
+ * This is the accessor class. It contains pointers to all of the
+ * initializers for the map classes for a particular accessor.
+ */
+struct irs_acc {
+ void * private;
+ void (*close) __P((struct irs_acc *));
+ struct irs_gr * (*gr_map) __P((struct irs_acc *));
+ struct irs_pw * (*pw_map) __P((struct irs_acc *));
+ struct irs_sv * (*sv_map) __P((struct irs_acc *));
+ struct irs_pr * (*pr_map) __P((struct irs_acc *));
+ struct irs_ho * (*ho_map) __P((struct irs_acc *));
+ struct irs_nw * (*nw_map) __P((struct irs_acc *));
+ struct irs_ng * (*ng_map) __P((struct irs_acc *));
+ struct __res_state * (*res_get) __P((struct irs_acc *));
+ void (*res_set) __P((struct irs_acc *, res_state,
+ void (*)(void *)));
+};
+
+/*%
+ * This is because the official definition of "struct netent" has no
+ * concept of CIDR even though it allows variant address families (on
+ * output but not input). The compatibility stubs convert the structs
+ * below into "struct netent"'s.
+ */
+struct nwent {
+ char *n_name; /*%< official name of net */
+ char **n_aliases; /*%< alias list */
+ int n_addrtype; /*%< net address type */
+ void *n_addr; /*%< network address */
+ int n_length; /*%< address length, in bits */
+};
+
+/*%
+ * Hide external function names from POSIX.
+ */
+#define irs_gen_acc __irs_gen_acc
+#define irs_lcl_acc __irs_lcl_acc
+#define irs_dns_acc __irs_dns_acc
+#define irs_nis_acc __irs_nis_acc
+#define irs_irp_acc __irs_irp_acc
+#define irs_destroy __irs_destroy
+#define irs_dns_gr __irs_dns_gr
+#define irs_dns_ho __irs_dns_ho
+#define irs_dns_nw __irs_dns_nw
+#define irs_dns_pr __irs_dns_pr
+#define irs_dns_pw __irs_dns_pw
+#define irs_dns_sv __irs_dns_sv
+#define irs_gen_gr __irs_gen_gr
+#define irs_gen_ho __irs_gen_ho
+#define irs_gen_ng __irs_gen_ng
+#define irs_gen_nw __irs_gen_nw
+#define irs_gen_pr __irs_gen_pr
+#define irs_gen_pw __irs_gen_pw
+#define irs_gen_sv __irs_gen_sv
+#define irs_irp_get_full_response __irs_irp_get_full_response
+#define irs_irp_gr __irs_irp_gr
+#define irs_irp_ho __irs_irp_ho
+#define irs_irp_is_connected __irs_irp_is_connected
+#define irs_irp_ng __irs_irp_ng
+#define irs_irp_nw __irs_irp_nw
+#define irs_irp_pr __irs_irp_pr
+#define irs_irp_pw __irs_irp_pw
+#define irs_irp_read_line __irs_irp_read_line
+#define irs_irp_sv __irs_irp_sv
+#define irs_lcl_gr __irs_lcl_gr
+#define irs_lcl_ho __irs_lcl_ho
+#define irs_lcl_ng __irs_lcl_ng
+#define irs_lcl_nw __irs_lcl_nw
+#define irs_lcl_pr __irs_lcl_pr
+#define irs_lcl_pw __irs_lcl_pw
+#define irs_lcl_sv __irs_lcl_sv
+#define irs_nis_gr __irs_nis_gr
+#define irs_nis_ho __irs_nis_ho
+#define irs_nis_ng __irs_nis_ng
+#define irs_nis_nw __irs_nis_nw
+#define irs_nis_pr __irs_nis_pr
+#define irs_nis_pw __irs_nis_pw
+#define irs_nis_sv __irs_nis_sv
+#define net_data_create __net_data_create
+#define net_data_destroy __net_data_destroy
+#define net_data_minimize __net_data_minimize
+
+/*%
+ * Externs.
+ */
+extern struct irs_acc * irs_gen_acc __P((const char *, const char *));
+extern struct irs_acc * irs_lcl_acc __P((const char *));
+extern struct irs_acc * irs_dns_acc __P((const char *));
+extern struct irs_acc * irs_nis_acc __P((const char *));
+extern struct irs_acc * irs_irp_acc __P((const char *));
+
+extern void irs_destroy __P((void));
+
+/*%
+ * These forward declarations are for the semi-private functions in
+ * the get*.c files. Each of these funcs implements the real get*
+ * functionality and the standard versions are just wrappers that
+ * call these. Apart from the wrappers, only irpd is expected to
+ * call these directly, hence these decls are put here and not in
+ * the /usr/include replacements.
+ */
+
+struct net_data; /*%< forward */
+/*
+ * net_data_create gets a singleton net_data object. net_data_init
+ * creates as many net_data objects as times it is called. Clients using
+ * the default interface will use net_data_create by default. Servers will
+ * probably want net_data_init (one call per client)
+ */
+struct net_data *net_data_create __P((const char *));
+struct net_data *net_data_init __P((const char *));
+void net_data_destroy __P((void *));
+
+extern struct group *getgrent_p __P((struct net_data *));
+extern struct group *getgrnam_p __P((const char *, struct net_data *));
+extern struct group *getgrgid_p __P((gid_t, struct net_data *));
+extern int setgroupent_p __P((int, struct net_data *));
+extern void endgrent_p __P((struct net_data *));
+extern int getgrouplist_p __P((const char *, gid_t, gid_t *, int *,
+ struct net_data *));
+
+#ifdef SETGRENT_VOID
+extern void setgrent_p __P((struct net_data *));
+#else
+extern int setgrent_p __P((struct net_data *));
+#endif
+
+extern struct hostent *gethostbyname_p __P((const char *,
+ struct net_data *));
+extern struct hostent *gethostbyname2_p __P((const char *, int,
+ struct net_data *));
+extern struct hostent *gethostbyaddr_p __P((const char *, int, int,
+ struct net_data *));
+extern struct hostent *gethostent_p __P((struct net_data *));
+extern void sethostent_p __P((int, struct net_data *));
+extern void endhostent_p __P((struct net_data *));
+extern struct hostent *getipnodebyname_p __P((const char *, int, int, int *,
+ struct net_data *));
+extern struct hostent *getipnodebyaddr_p __P((const void *, size_t,
+ int, int *, struct net_data *));
+
+extern struct netent *getnetent_p __P((struct net_data *));
+extern struct netent *getnetbyname_p __P((const char *, struct net_data *));
+extern struct netent *getnetbyaddr_p __P((unsigned long, int,
+ struct net_data *));
+extern void setnetent_p __P((int, struct net_data *));
+extern void endnetent_p __P((struct net_data *));
+
+extern void setnetgrent_p __P((const char *, struct net_data *));
+extern void endnetgrent_p __P((struct net_data *));
+extern int innetgr_p __P((const char *, const char *, const char *,
+ const char *, struct net_data *));
+extern int getnetgrent_p __P((const char **, const char **,
+ const char **, struct net_data *));
+
+extern struct protoent *getprotoent_p __P((struct net_data *));
+extern struct protoent *getprotobyname_p __P((const char *,
+ struct net_data *));
+extern struct protoent *getprotobynumber_p __P((int, struct net_data *));
+extern void setprotoent_p __P((int, struct net_data *));
+extern void endprotoent_p __P((struct net_data *));
+
+
+extern struct passwd *getpwent_p __P((struct net_data *));
+extern struct passwd *getpwnam_p __P((const char *, struct net_data *));
+extern struct passwd *getpwuid_p __P((uid_t, struct net_data *));
+extern int setpassent_p __P((int, struct net_data *));
+extern void endpwent_p __P((struct net_data *));
+
+#ifdef SETPWENT_VOID
+extern void setpwent_p __P((struct net_data *));
+#else
+extern int setpwent_p __P((struct net_data *));
+#endif
+
+extern struct servent *getservent_p __P((struct net_data *));
+extern struct servent *getservbyname_p __P((const char *, const char *,
+ struct net_data *));
+extern struct servent *getservbyport_p __P((int, const char *,
+ struct net_data *));
+extern void setservent_p __P((int, struct net_data *));
+extern void endservent_p __P((struct net_data *));
+
+#endif /*_IRS_H_INCLUDED*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/assertions.h b/usr/src/lib/libresolv2_joy/include/isc/assertions.h
new file mode 100644
index 0000000000..68925e73b3
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/assertions.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1997-2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: assertions.h,v 1.5 2008/11/14 02:36:51 marka Exp $
+ */
+
+#ifndef ASSERTIONS_H
+#define ASSERTIONS_H 1
+
+typedef enum {
+ assert_require, assert_ensure, assert_insist, assert_invariant
+} assertion_type;
+
+typedef void (*assertion_failure_callback)(const char *, int, assertion_type,
+ const char *, int);
+
+/* coverity[+kill] */
+extern assertion_failure_callback __assertion_failed;
+void set_assertion_failure_callback(assertion_failure_callback f);
+const char *assertion_type_to_text(assertion_type type);
+
+#if defined(CHECK_ALL) || defined(__COVERITY__)
+#define CHECK_REQUIRE 1
+#define CHECK_ENSURE 1
+#define CHECK_INSIST 1
+#define CHECK_INVARIANT 1
+#endif
+
+#if defined(CHECK_NONE) && !defined(__COVERITY__)
+#define CHECK_REQUIRE 0
+#define CHECK_ENSURE 0
+#define CHECK_INSIST 0
+#define CHECK_INVARIANT 0
+#endif
+
+#ifndef CHECK_REQUIRE
+#define CHECK_REQUIRE 1
+#endif
+
+#ifndef CHECK_ENSURE
+#define CHECK_ENSURE 1
+#endif
+
+#ifndef CHECK_INSIST
+#define CHECK_INSIST 1
+#endif
+
+#ifndef CHECK_INVARIANT
+#define CHECK_INVARIANT 1
+#endif
+
+#if CHECK_REQUIRE != 0
+#define REQUIRE(cond) \
+ ((void) ((cond) || \
+ ((__assertion_failed)(__FILE__, __LINE__, assert_require, \
+ #cond, 0), 0)))
+#define REQUIRE_ERR(cond) \
+ ((void) ((cond) || \
+ ((__assertion_failed)(__FILE__, __LINE__, assert_require, \
+ #cond, 1), 0)))
+#else
+#define REQUIRE(cond) ((void) (cond))
+#define REQUIRE_ERR(cond) ((void) (cond))
+#endif /* CHECK_REQUIRE */
+
+#if CHECK_ENSURE != 0
+#define ENSURE(cond) \
+ ((void) ((cond) || \
+ ((__assertion_failed)(__FILE__, __LINE__, assert_ensure, \
+ #cond, 0), 0)))
+#define ENSURE_ERR(cond) \
+ ((void) ((cond) || \
+ ((__assertion_failed)(__FILE__, __LINE__, assert_ensure, \
+ #cond, 1), 0)))
+#else
+#define ENSURE(cond) ((void) (cond))
+#define ENSURE_ERR(cond) ((void) (cond))
+#endif /* CHECK_ENSURE */
+
+#if CHECK_INSIST != 0
+#define INSIST(cond) \
+ ((void) ((cond) || \
+ ((__assertion_failed)(__FILE__, __LINE__, assert_insist, \
+ #cond, 0), 0)))
+#define INSIST_ERR(cond) \
+ ((void) ((cond) || \
+ ((__assertion_failed)(__FILE__, __LINE__, assert_insist, \
+ #cond, 1), 0)))
+#else
+#define INSIST(cond) ((void) (cond))
+#define INSIST_ERR(cond) ((void) (cond))
+#endif /* CHECK_INSIST */
+
+#if CHECK_INVARIANT != 0
+#define INVARIANT(cond) \
+ ((void) ((cond) || \
+ ((__assertion_failed)(__FILE__, __LINE__, assert_invariant, \
+ #cond, 0), 0)))
+#define INVARIANT_ERR(cond) \
+ ((void) ((cond) || \
+ ((__assertion_failed)(__FILE__, __LINE__, assert_invariant, \
+ #cond, 1), 0)))
+#else
+#define INVARIANT(cond) ((void) (cond))
+#define INVARIANT_ERR(cond) ((void) (cond))
+#endif /* CHECK_INVARIANT */
+#endif /* ASSERTIONS_H */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/ctl.h b/usr/src/lib/libresolv2_joy/include/isc/ctl.h
new file mode 100644
index 0000000000..e2ba20201d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/ctl.h
@@ -0,0 +1,112 @@
+#ifndef ISC_CTL_H
+#define ISC_CTL_H
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1998,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: ctl.h,v 1.5 2005/04/27 04:56:17 sra Exp $
+ */
+
+/*! \file */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <isc/eventlib.h>
+
+/* Macros. */
+
+#define CTL_MORE 0x0001 /*%< More will be / should be sent. */
+#define CTL_EXIT 0x0002 /*%< Close connection after this. */
+#define CTL_DATA 0x0004 /*%< Go into / this is DATA mode. */
+/* Types. */
+
+struct ctl_cctx;
+struct ctl_sctx;
+struct ctl_sess;
+struct ctl_verb;
+
+enum ctl_severity { ctl_debug, ctl_warning, ctl_error };
+
+typedef void (*ctl_logfunc)(enum ctl_severity, const char *, ...);
+
+typedef void (*ctl_verbfunc)(struct ctl_sctx *, struct ctl_sess *,
+ const struct ctl_verb *, const char *,
+ u_int, const void *, void *);
+
+typedef void (*ctl_srvrdone)(struct ctl_sctx *, struct ctl_sess *, void *);
+
+typedef void (*ctl_clntdone)(struct ctl_cctx *, void *, const char *, u_int);
+
+struct ctl_verb {
+ const char * name;
+ ctl_verbfunc func;
+ const char * help;
+};
+
+/* General symbols. */
+
+#define ctl_logger __ctl_logger
+
+#ifdef __GNUC__
+void ctl_logger(enum ctl_severity, const char *, ...)
+ __attribute__((__format__(__printf__, 2, 3)));
+#else
+void ctl_logger(enum ctl_severity, const char *, ...);
+#endif
+
+/* Client symbols. */
+
+#define ctl_client __ctl_client
+#define ctl_endclient __ctl_endclient
+#define ctl_command __ctl_command
+
+struct ctl_cctx * ctl_client(evContext, const struct sockaddr *, size_t,
+ const struct sockaddr *, size_t,
+ ctl_clntdone, void *,
+ u_int, ctl_logfunc);
+void ctl_endclient(struct ctl_cctx *);
+int ctl_command(struct ctl_cctx *, const char *, size_t,
+ ctl_clntdone, void *);
+
+/* Server symbols. */
+
+#define ctl_server __ctl_server
+#define ctl_endserver __ctl_endserver
+#define ctl_response __ctl_response
+#define ctl_sendhelp __ctl_sendhelp
+#define ctl_getcsctx __ctl_getcsctx
+#define ctl_setcsctx __ctl_setcsctx
+
+struct ctl_sctx * ctl_server(evContext, const struct sockaddr *, size_t,
+ const struct ctl_verb *,
+ u_int, u_int,
+ u_int, int, int,
+ ctl_logfunc, void *);
+void ctl_endserver(struct ctl_sctx *);
+void ctl_response(struct ctl_sess *, u_int,
+ const char *, u_int, const void *,
+ ctl_srvrdone, void *,
+ const char *, size_t);
+void ctl_sendhelp(struct ctl_sess *, u_int);
+void * ctl_getcsctx(struct ctl_sess *);
+void * ctl_setcsctx(struct ctl_sess *, void *);
+
+#endif /*ISC_CTL_H*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/dst.h b/usr/src/lib/libresolv2_joy/include/isc/dst.h
new file mode 100644
index 0000000000..90a9e67468
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/dst.h
@@ -0,0 +1,168 @@
+#ifndef DST_H
+#define DST_H
+
+#ifndef HAS_DST_KEY
+typedef struct dst_key {
+ char *dk_key_name; /*%< name of the key */
+ int dk_key_size; /*%< this is the size of the key in bits */
+ int dk_proto; /*%< what protocols this key can be used for */
+ int dk_alg; /*%< algorithm number from key record */
+ u_int32_t dk_flags; /*%< and the flags of the public key */
+ u_int16_t dk_id; /*%< identifier of the key */
+} DST_KEY;
+#endif /* HAS_DST_KEY */
+/*
+ * do not taint namespace
+ */
+#define dst_bsafe_init __dst_bsafe_init
+#define dst_buffer_to_key __dst_buffer_to_key
+#define dst_check_algorithm __dst_check_algorithm
+#define dst_compare_keys __dst_compare_keys
+#define dst_cylink_init __dst_cylink_init
+#define dst_dnskey_to_key __dst_dnskey_to_key
+#define dst_eay_dss_init __dst_eay_dss_init
+#define dst_free_key __dst_free_key
+#define dst_generate_key __dst_generate_key
+#define dst_hmac_md5_init __dst_hmac_md5_init
+#define dst_init __dst_init
+#define dst_key_to_buffer __dst_key_to_buffer
+#define dst_key_to_dnskey __dst_key_to_dnskey
+#define dst_read_key __dst_read_key
+#define dst_rsaref_init __dst_rsaref_init
+#define dst_s_build_filename __dst_s_build_filename
+#define dst_s_calculate_bits __dst_s_calculate_bits
+#define dst_s_conv_bignum_b64_to_u8 __dst_s_conv_bignum_b64_to_u8
+#define dst_s_conv_bignum_u8_to_b64 __dst_s_conv_bignum_u8_to_b64
+#define dst_s_dns_key_id __dst_s_dns_key_id
+#define dst_s_dump __dst_s_dump
+#define dst_s_filename_length __dst_s_filename_length
+#define dst_s_fopen __dst_s_fopen
+#define dst_s_get_int16 __dst_s_get_int16
+#define dst_s_get_int32 __dst_s_get_int32
+#define dst_s_id_calc __dst_s_id_calc
+#define dst_s_put_int16 __dst_s_put_int16
+#define dst_s_put_int32 __dst_s_put_int32
+#define dst_s_quick_random __dst_s_quick_random
+#define dst_s_quick_random_set __dst_s_quick_random_set
+#define dst_s_random __dst_s_random
+#define dst_s_semi_random __dst_s_semi_random
+#define dst_s_verify_str __dst_s_verify_str
+#define dst_sig_size __dst_sig_size
+#define dst_sign_data __dst_sign_data
+#define dst_verify_data __dst_verify_data
+#define dst_write_key __dst_write_key
+
+/*
+ * DST Crypto API defintions
+ */
+void dst_init(void);
+int dst_check_algorithm(const int);
+
+
+int dst_sign_data(const int, /*!< specifies INIT/UPDATE/FINAL/ALL */
+ DST_KEY *, /*!< the key to use */
+ void **, /*!< pointer to state structure */
+ const u_char *, /*!< data to be signed */
+ const int, /*!< length of input data */
+ u_char *, /*!< buffer to write signature to */
+ const int); /*!< size of output buffer */
+int dst_verify_data(const int, /*!< specifies INIT/UPDATE/FINAL/ALL */
+ DST_KEY *, /*!< the key to use */
+ void **, /*!< pointer to state structure */
+ const u_char *, /*!< data to be verified */
+ const int, /*!< length of input data */
+ const u_char *, /*!< buffer containing signature */
+ const int); /*!< length of signature */
+DST_KEY *dst_read_key(const char *, /*!< name of key */
+ const u_int16_t, /*!< key tag identifier */
+ const int, /*!< key algorithm */
+ const int); /*!< Private/PublicKey wanted */
+int dst_write_key(const DST_KEY *, /*!< key to write out */
+ const int); /*!< Public/Private */
+DST_KEY *dst_dnskey_to_key(const char *, /*!< KEY record name */
+ const u_char *, /*!< KEY RDATA */
+ const int); /*!< size of input buffer */
+int dst_key_to_dnskey(const DST_KEY *, /*!< key to translate */
+ u_char *, /*!< output buffer */
+ const int); /*!< size of out_storage */
+DST_KEY *dst_buffer_to_key(const char *, /*!< name of the key */
+ const int, /*!< algorithm */
+ const int, /*!< dns flags */
+ const int, /*!< dns protocol */
+ const u_char *, /*!< key in dns wire fmt */
+ const int); /*!< size of key */
+int dst_key_to_buffer(DST_KEY *, u_char *, int);
+
+DST_KEY *dst_generate_key(const char *, /*!< name of new key */
+ const int, /*!< key algorithm to generate */
+ const int, /*!< size of new key */
+ const int, /*!< alg dependent parameter */
+ const int, /*!< key DNS flags */
+ const int); /*!< key DNS protocol */
+DST_KEY *dst_free_key(DST_KEY *);
+int dst_compare_keys(const DST_KEY *, const DST_KEY *);
+
+int dst_sig_size(DST_KEY *);
+
+
+/* support for dns key tags/ids */
+u_int16_t dst_s_dns_key_id(const u_char *, const int);
+u_int16_t dst_s_id_calc(const u_char *, const int);
+
+/* Used by callers as well as by the library. */
+#define RAW_KEY_SIZE 8192 /*%< large enough to store any key */
+/* DST_API control flags */
+/* These are used used in functions dst_sign_data and dst_verify_data */
+#define SIG_MODE_INIT 1 /*%< initialize digest */
+#define SIG_MODE_UPDATE 2 /*%< add data to digest */
+#define SIG_MODE_FINAL 4 /*%< generate/verify signature */
+#define SIG_MODE_ALL (SIG_MODE_INIT|SIG_MODE_UPDATE|SIG_MODE_FINAL)
+
+/* Flags for dst_read_private_key() */
+#define DST_FORCE_READ 0x1000000
+#define DST_CAN_SIGN 0x010F
+#define DST_NO_AUTHEN 0x8000
+#define DST_EXTEND_FLAG 0x1000
+#define DST_STANDARD 0
+#define DST_PRIVATE 0x2000000
+#define DST_PUBLIC 0x4000000
+#define DST_RAND_SEMI 1
+#define DST_RAND_STD 2
+#define DST_RAND_KEY 3
+#define DST_RAND_DSS 4
+
+
+/* DST algorithm codes */
+#define KEY_RSA 1
+#define KEY_DH 2
+#define KEY_DSA 3
+#define KEY_PRIVATE 254
+#define KEY_EXPAND 255
+#define KEY_HMAC_MD5 157
+#define KEY_HMAC_SHA1 158
+#define UNKNOWN_KEYALG 0
+#define DST_MAX_ALGS KEY_HMAC_SHA1
+
+/* DST constants to locations in KEY record changes in new KEY record */
+#define DST_FLAGS_SIZE 2
+#define DST_KEY_PROT 2
+#define DST_KEY_ALG 3
+#define DST_EXT_FLAG 4
+#define DST_KEY_START 4
+
+#ifndef SIGN_F_NOKEY
+#define SIGN_F_NOKEY 0xC000
+#endif
+
+/* error codes from dst routines */
+#define SIGN_INIT_FAILURE (-23)
+#define SIGN_UPDATE_FAILURE (-24)
+#define SIGN_FINAL_FAILURE (-25)
+#define VERIFY_INIT_FAILURE (-26)
+#define VERIFY_UPDATE_FAILURE (-27)
+#define VERIFY_FINAL_FAILURE (-28)
+#define MISSING_KEY_OR_SIGNATURE (-30)
+#define UNSUPPORTED_KEYALG (-31)
+
+#endif /* DST_H */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/eventlib.h b/usr/src/lib/libresolv2_joy/include/isc/eventlib.h
new file mode 100644
index 0000000000..a4cfdf9092
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/eventlib.h
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1995-1999, 2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* eventlib.h - exported interfaces for eventlib
+ * vix 09sep95 [initial]
+ *
+ * $Id: eventlib.h,v 1.7 2008/11/14 02:36:51 marka Exp $
+ */
+
+#ifndef _EVENTLIB_H
+#define _EVENTLIB_H
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <sys/time.h>
+#include <stdio.h>
+
+#include <isc/platform.h>
+
+#ifndef __P
+# define __EVENTLIB_P_DEFINED
+# ifdef __STDC__
+# define __P(x) x
+# else
+# define __P(x) ()
+# endif
+#endif
+
+/* In the absence of branded types... */
+typedef struct { void *opaque; } evConnID;
+typedef struct { void *opaque; } evFileID;
+typedef struct { void *opaque; } evStreamID;
+typedef struct { void *opaque; } evTimerID;
+typedef struct { void *opaque; } evWaitID;
+typedef struct { void *opaque; } evContext;
+typedef struct { void *opaque; } evEvent;
+
+#define evInitID(id) ((id)->opaque = NULL)
+#define evTestID(id) ((id).opaque != NULL)
+
+typedef void (*evConnFunc)__P((evContext, void *, int, const void *, int,
+ const void *, int));
+typedef void (*evFileFunc)__P((evContext, void *, int, int));
+typedef void (*evStreamFunc)__P((evContext, void *, int, int));
+typedef void (*evTimerFunc)__P((evContext, void *,
+ struct timespec, struct timespec));
+typedef void (*evWaitFunc)__P((evContext, void *, const void *));
+
+typedef struct { unsigned char mask[256/8]; } evByteMask;
+#define EV_BYTEMASK_BYTE(b) ((b) / 8)
+#define EV_BYTEMASK_MASK(b) (1 << ((b) % 8))
+#define EV_BYTEMASK_SET(bm, b) \
+ ((bm).mask[EV_BYTEMASK_BYTE(b)] |= EV_BYTEMASK_MASK(b))
+#define EV_BYTEMASK_CLR(bm, b) \
+ ((bm).mask[EV_BYTEMASK_BYTE(b)] &= ~EV_BYTEMASK_MASK(b))
+#define EV_BYTEMASK_TST(bm, b) \
+ ((bm).mask[EV_BYTEMASK_BYTE(b)] & EV_BYTEMASK_MASK(b))
+
+#define EV_POLL 1
+#define EV_WAIT 2
+#define EV_NULL 4
+
+#define EV_READ 1
+#define EV_WRITE 2
+#define EV_EXCEPT 4
+
+#define EV_WASNONBLOCKING 8 /* Internal library use. */
+
+/* eventlib.c */
+#define evCreate __evCreate
+#define evSetDebug __evSetDebug
+#define evDestroy __evDestroy
+#define evGetNext __evGetNext
+#define evDispatch __evDispatch
+#define evDrop __evDrop
+#define evMainLoop __evMainLoop
+#define evHighestFD __evHighestFD
+#define evGetOption __evGetOption
+#define evSetOption __evSetOption
+
+int evCreate __P((evContext *));
+void evSetDebug __P((evContext, int, FILE *));
+int evDestroy __P((evContext));
+int evGetNext __P((evContext, evEvent *, int));
+int evDispatch __P((evContext, evEvent));
+void evDrop __P((evContext, evEvent));
+int evMainLoop __P((evContext));
+int evHighestFD __P((evContext));
+int evGetOption __P((evContext *, const char *, int *));
+int evSetOption __P((evContext *, const char *, int));
+
+/* ev_connects.c */
+#define evListen __evListen
+#define evConnect __evConnect
+#define evCancelConn __evCancelConn
+#define evHold __evHold
+#define evUnhold __evUnhold
+#define evTryAccept __evTryAccept
+
+int evListen __P((evContext, int, int, evConnFunc, void *, evConnID *));
+int evConnect __P((evContext, int, const void *, int,
+ evConnFunc, void *, evConnID *));
+int evCancelConn __P((evContext, evConnID));
+int evHold __P((evContext, evConnID));
+int evUnhold __P((evContext, evConnID));
+int evTryAccept __P((evContext, evConnID, int *));
+
+/* ev_files.c */
+#define evSelectFD __evSelectFD
+#define evDeselectFD __evDeselectFD
+
+int evSelectFD __P((evContext, int, int, evFileFunc, void *, evFileID *));
+int evDeselectFD __P((evContext, evFileID));
+
+/* ev_streams.c */
+#define evConsIovec __evConsIovec
+#define evWrite __evWrite
+#define evRead __evRead
+#define evTimeRW __evTimeRW
+#define evUntimeRW __evUntimeRW
+#define evCancelRW __evCancelRW
+
+struct iovec evConsIovec __P((void *, size_t));
+int evWrite __P((evContext, int, const struct iovec *, int,
+ evStreamFunc func, void *, evStreamID *));
+int evRead __P((evContext, int, const struct iovec *, int,
+ evStreamFunc func, void *, evStreamID *));
+int evTimeRW __P((evContext, evStreamID, evTimerID timer));
+int evUntimeRW __P((evContext, evStreamID));
+int evCancelRW __P((evContext, evStreamID));
+
+/* ev_timers.c */
+#define evConsTime __evConsTime
+#define evAddTime __evAddTime
+#define evSubTime __evSubTime
+#define evCmpTime __evCmpTime
+#define evTimeSpec __evTimeSpec
+#define evTimeVal __evTimeVal
+
+#define evNowTime __evNowTime
+#define evUTCTime __evUTCTime
+#define evLastEventTime __evLastEventTime
+#define evSetTimer __evSetTimer
+#define evClearTimer __evClearTimer
+#define evConfigTimer __evConfigTimer
+#define evResetTimer __evResetTimer
+#define evSetIdleTimer __evSetIdleTimer
+#define evClearIdleTimer __evClearIdleTimer
+#define evResetIdleTimer __evResetIdleTimer
+#define evTouchIdleTimer __evTouchIdleTimer
+
+struct timespec evConsTime __P((time_t sec, long nsec));
+struct timespec evAddTime __P((struct timespec, struct timespec));
+struct timespec evSubTime __P((struct timespec, struct timespec));
+struct timespec evNowTime __P((void));
+struct timespec evUTCTime __P((void));
+struct timespec evLastEventTime __P((evContext));
+struct timespec evTimeSpec __P((struct timeval));
+struct timeval evTimeVal __P((struct timespec));
+int evCmpTime __P((struct timespec, struct timespec));
+int evSetTimer __P((evContext, evTimerFunc, void *, struct timespec,
+ struct timespec, evTimerID *));
+int evClearTimer __P((evContext, evTimerID));
+int evConfigTimer __P((evContext, evTimerID, const char *param,
+ int value));
+int evResetTimer __P((evContext, evTimerID, evTimerFunc, void *,
+ struct timespec, struct timespec));
+int evSetIdleTimer __P((evContext, evTimerFunc, void *, struct timespec,
+ evTimerID *));
+int evClearIdleTimer __P((evContext, evTimerID));
+int evResetIdleTimer __P((evContext, evTimerID, evTimerFunc, void *,
+ struct timespec));
+int evTouchIdleTimer __P((evContext, evTimerID));
+
+/* ev_waits.c */
+#define evWaitFor __evWaitFor
+#define evDo __evDo
+#define evUnwait __evUnwait
+#define evDefer __evDefer
+
+int evWaitFor __P((evContext, const void *, evWaitFunc, void *, evWaitID *));
+int evDo __P((evContext, const void *));
+int evUnwait __P((evContext, evWaitID));
+int evDefer __P((evContext, evWaitFunc, void *));
+
+#ifdef __EVENTLIB_P_DEFINED
+# undef __P
+#endif
+
+#endif /*_EVENTLIB_H*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/heap.h b/usr/src/lib/libresolv2_joy/include/isc/heap.h
new file mode 100644
index 0000000000..384d507cf5
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/heap.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1997,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+typedef int (*heap_higher_priority_func)(void *, void *);
+typedef void (*heap_index_func)(void *, int);
+typedef void (*heap_for_each_func)(void *, void *);
+
+typedef struct heap_context {
+ int array_size;
+ int array_size_increment;
+ int heap_size;
+ void **heap;
+ heap_higher_priority_func higher_priority;
+ heap_index_func index;
+} *heap_context;
+
+#define heap_new __heap_new
+#define heap_free __heap_free
+#define heap_insert __heap_insert
+#define heap_delete __heap_delete
+#define heap_increased __heap_increased
+#define heap_decreased __heap_decreased
+#define heap_element __heap_element
+#define heap_for_each __heap_for_each
+
+heap_context heap_new(heap_higher_priority_func, heap_index_func, int);
+int heap_free(heap_context);
+int heap_insert(heap_context, void *);
+int heap_delete(heap_context, int);
+int heap_increased(heap_context, int);
+int heap_decreased(heap_context, int);
+void * heap_element(heap_context, int);
+int heap_for_each(heap_context, heap_for_each_func, void *);
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/irpmarshall.h b/usr/src/lib/libresolv2_joy/include/isc/irpmarshall.h
new file mode 100644
index 0000000000..244b3e3460
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/irpmarshall.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: irpmarshall.h,v 1.4 2005/04/27 04:56:17 sra Exp $
+ */
+
+#ifndef _IRPMARSHALL_H_INCLUDED
+#define _IRPMARSHALL_H_INCLUDED
+
+/* Hide function names */
+#define irp_marshall_gr __irp_marshall_gr
+#define irp_marshall_ho __irp_marshall_ho
+#define irp_marshall_ne __irp_marshall_ne
+#define irp_marshall_ng __irp_marshall_ng
+#define irp_marshall_nw __irp_marshall_nw
+#define irp_marshall_pr __irp_marshall_pr
+#define irp_marshall_pw __irp_marshall_pw
+#define irp_marshall_sv __irp_marshall_sv
+#define irp_unmarshall_gr __irp_unmarshall_gr
+#define irp_unmarshall_ho __irp_unmarshall_ho
+#define irp_unmarshall_ne __irp_unmarshall_ne
+#define irp_unmarshall_ng __irp_unmarshall_ng
+#define irp_unmarshall_nw __irp_unmarshall_nw
+#define irp_unmarshall_pr __irp_unmarshall_pr
+#define irp_unmarshall_pw __irp_unmarshall_pw
+#define irp_unmarshall_sv __irp_unmarshall_sv
+
+#define MAXPADDRSIZE (sizeof "255.255.255.255" + 1)
+#define ADDR_T_STR(x) (x == AF_INET ? "AF_INET" :\
+ (x == AF_INET6 ? "AF_INET6" : "UNKNOWN"))
+
+/* See comment below on usage */
+int irp_marshall_pw(const struct passwd *, char **, size_t *);
+int irp_unmarshall_pw(struct passwd *, char *);
+int irp_marshall_gr(const struct group *, char **, size_t *);
+int irp_unmarshall_gr(struct group *, char *);
+int irp_marshall_sv(const struct servent *, char **, size_t *);
+int irp_unmarshall_sv(struct servent *, char *);
+int irp_marshall_pr(struct protoent *, char **, size_t *);
+int irp_unmarshall_pr(struct protoent *, char *);
+int irp_marshall_ho(struct hostent *, char **, size_t *);
+int irp_unmarshall_ho(struct hostent *, char *);
+int irp_marshall_ng(const char *, const char *, const char *,
+ char **, size_t *);
+int irp_unmarshall_ng(const char **, const char **, const char **, char *);
+int irp_marshall_nw(struct nwent *, char **, size_t *);
+int irp_unmarshall_nw(struct nwent *, char *);
+int irp_marshall_ne(struct netent *, char **, size_t *);
+int irp_unmarshall_ne(struct netent *, char *);
+
+/*! \file
+ * \brief
+ * Functions to marshall and unmarshall various system data structures. We
+ * use a printable ascii format that is as close to various system config
+ * files as reasonable (e.g. /etc/passwd format).
+ *
+ * We are not forgiving with unmarhsalling misformatted buffers. In
+ * particular whitespace in fields is not ignored. So a formatted password
+ * entry "brister :1364:100:...." will yield a username of "brister "
+ *
+ * We potentially do a lot of mallocs to fill fields that are of type
+ * (char **) like a hostent h_addr field. Building (for example) the
+ * h_addr field and its associated addresses all in one buffer is
+ * certainly possible, but not done here.
+ *
+ * The following description is true for all the marshalling functions:
+ *
+ * int irp_marshall_XX(struct yyyy *XX, char **buffer, size_t *len);
+ *
+ * The argument XX (of type struct passwd for example) is marshalled in the
+ * buffer pointed at by *BUFFER, which is of length *LEN. Returns 0
+ * on success and -1 on failure. Failure will occur if *LEN is
+ * smaller than needed.
+ *
+ * If BUFFER is NULL, then *LEN is set to the size of the buffer
+ * needed to marshall the data and no marshalling is actually done.
+ *
+ * If *BUFFER is NULL, then a buffer large enough will be allocated
+ * with memget() and the size allocated will be stored in *LEN. An extra 2
+ * bytes will be allocated for the client to append CRLF if wanted. The
+ * value of *LEN will include these two bytes.
+ *
+ * All the marshalling functions produce a buffer with the fields
+ * separated by colons (except for the hostent marshalling, which uses '@'
+ * to separate fields). Fields that have multiple subfields (like the
+ * gr_mem field in struct group) have their subparts separated by
+ * commas.
+ *
+ * int irp_unmarshall_XX(struct YYYYY *XX, char *buffer);
+ *
+ * The unmashalling functions break apart the buffer and store the
+ * values in the struct pointed to by XX. All pointer values inside
+ * XX are allocated with malloc. All arrays of pointers have a NULL
+ * as the last element.
+ */
+
+#endif
diff --git a/usr/src/lib/libresolv2_joy/include/isc/list.h b/usr/src/lib/libresolv2_joy/include/isc/list.h
new file mode 100644
index 0000000000..5fe9031141
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/list.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1997,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef LIST_H
+#define LIST_H 1
+#include <isc/assertions.h>
+
+#define LIST(type) struct { type *head, *tail; }
+#define INIT_LIST(list) \
+ do { (list).head = NULL; (list).tail = NULL; } while (0)
+
+#define LINK(type) struct { type *prev, *next; }
+#define INIT_LINK_TYPE(elt, link, type) \
+ do { \
+ (elt)->link.prev = (type *)(-1); \
+ (elt)->link.next = (type *)(-1); \
+ } while (0)
+#define INIT_LINK(elt, link) \
+ INIT_LINK_TYPE(elt, link, void)
+#define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1) && \
+ (void *)((elt)->link.next) != (void *)(-1))
+
+#define HEAD(list) ((list).head)
+#define TAIL(list) ((list).tail)
+#define EMPTY(list) ((list).head == NULL)
+
+#define PREPEND(list, elt, link) \
+ do { \
+ INSIST(!LINKED(elt, link));\
+ if ((list).head != NULL) \
+ (list).head->link.prev = (elt); \
+ else \
+ (list).tail = (elt); \
+ (elt)->link.prev = NULL; \
+ (elt)->link.next = (list).head; \
+ (list).head = (elt); \
+ } while (0)
+
+#define APPEND(list, elt, link) \
+ do { \
+ INSIST(!LINKED(elt, link));\
+ if ((list).tail != NULL) \
+ (list).tail->link.next = (elt); \
+ else \
+ (list).head = (elt); \
+ (elt)->link.prev = (list).tail; \
+ (elt)->link.next = NULL; \
+ (list).tail = (elt); \
+ } while (0)
+
+#define UNLINK_TYPE(list, elt, link, type) \
+ do { \
+ INSIST(LINKED(elt, link));\
+ if ((elt)->link.next != NULL) \
+ (elt)->link.next->link.prev = (elt)->link.prev; \
+ else { \
+ INSIST((list).tail == (elt)); \
+ (list).tail = (elt)->link.prev; \
+ } \
+ if ((elt)->link.prev != NULL) \
+ (elt)->link.prev->link.next = (elt)->link.next; \
+ else { \
+ INSIST((list).head == (elt)); \
+ (list).head = (elt)->link.next; \
+ } \
+ INIT_LINK_TYPE(elt, link, type); \
+ } while (0)
+#define UNLINK(list, elt, link) \
+ UNLINK_TYPE(list, elt, link, void)
+
+#define PREV(elt, link) ((elt)->link.prev)
+#define NEXT(elt, link) ((elt)->link.next)
+
+#define INSERT_BEFORE(list, before, elt, link) \
+ do { \
+ INSIST(!LINKED(elt, link));\
+ if ((before)->link.prev == NULL) \
+ PREPEND(list, elt, link); \
+ else { \
+ (elt)->link.prev = (before)->link.prev; \
+ (before)->link.prev = (elt); \
+ (elt)->link.prev->link.next = (elt); \
+ (elt)->link.next = (before); \
+ } \
+ } while (0)
+
+#define INSERT_AFTER(list, after, elt, link) \
+ do { \
+ INSIST(!LINKED(elt, link));\
+ if ((after)->link.next == NULL) \
+ APPEND(list, elt, link); \
+ else { \
+ (elt)->link.next = (after)->link.next; \
+ (after)->link.next = (elt); \
+ (elt)->link.next->link.prev = (elt); \
+ (elt)->link.prev = (after); \
+ } \
+ } while (0)
+
+#define ENQUEUE(list, elt, link) APPEND(list, elt, link)
+#define DEQUEUE(list, elt, link) UNLINK(list, elt, link)
+
+#endif /* LIST_H */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/logging.h b/usr/src/lib/libresolv2_joy/include/isc/logging.h
new file mode 100644
index 0000000000..c539443ff8
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/logging.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef LOGGING_H
+#define LOGGING_H
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <unistd.h>
+
+#define log_critical (-5)
+#define log_error (-4)
+#define log_warning (-3)
+#define log_notice (-2)
+#define log_info (-1)
+#define log_debug(level) (level)
+
+typedef enum { log_syslog, log_file, log_null } log_channel_type;
+
+#define LOG_MAX_VERSIONS 99
+
+#define LOG_CLOSE_STREAM 0x0001
+#define LOG_TIMESTAMP 0x0002
+#define LOG_TRUNCATE 0x0004
+#define LOG_USE_CONTEXT_LEVEL 0x0008
+#define LOG_PRINT_LEVEL 0x0010
+#define LOG_REQUIRE_DEBUG 0x0020
+#define LOG_CHANNEL_BROKEN 0x0040
+#define LOG_PRINT_CATEGORY 0x0080
+#define LOG_CHANNEL_OFF 0x0100
+
+typedef struct log_context *log_context;
+typedef struct log_channel *log_channel;
+
+#define LOG_OPTION_DEBUG 0x01
+#define LOG_OPTION_LEVEL 0x02
+
+#define log_open_stream __log_open_stream
+#define log_close_stream __log_close_stream
+#define log_get_stream __log_get_stream
+#define log_get_filename __log_get_filename
+#define log_check_channel __log_check_channel
+#define log_check __log_check
+#define log_vwrite __log_vwrite
+#define log_write __log_write
+#define log_new_context __log_new_context
+#define log_free_context __log_free_context
+#define log_add_channel __log_add_channel
+#define log_remove_channel __log_remove_channel
+#define log_option __log_option
+#define log_category_is_active __log_category_is_active
+#define log_new_syslog_channel __log_new_syslog_channel
+#define log_new_file_channel __log_new_file_channel
+#define log_set_file_owner __log_set_file_owner
+#define log_new_null_channel __log_new_null_channel
+#define log_inc_references __log_inc_references
+#define log_dec_references __log_dec_references
+#define log_get_channel_type __log_get_channel_type
+#define log_free_channel __log_free_channel
+#define log_close_debug_channels __log_close_debug_channels
+
+FILE * log_open_stream(log_channel);
+int log_close_stream(log_channel);
+FILE * log_get_stream(log_channel);
+char * log_get_filename(log_channel);
+int log_check_channel(log_context, int, log_channel);
+int log_check(log_context, int, int);
+#ifdef __GNUC__
+void log_vwrite(log_context, int, int, const char *,
+ va_list args)
+ __attribute__((__format__(__printf__, 4, 0)));
+void log_write(log_context, int, int, const char *, ...)
+ __attribute__((__format__(__printf__, 4, 5)));
+#else
+void log_vwrite(log_context, int, int, const char *,
+ va_list args);
+void log_write(log_context, int, int, const char *, ...);
+#endif
+int log_new_context(int, char **, log_context *);
+void log_free_context(log_context);
+int log_add_channel(log_context, int, log_channel);
+int log_remove_channel(log_context, int, log_channel);
+int log_option(log_context, int, int);
+int log_category_is_active(log_context, int);
+log_channel log_new_syslog_channel(unsigned int, int, int);
+log_channel log_new_file_channel(unsigned int, int, const char *,
+ FILE *, unsigned int,
+ unsigned long);
+int log_set_file_owner(log_channel, uid_t, gid_t);
+log_channel log_new_null_channel(void);
+int log_inc_references(log_channel);
+int log_dec_references(log_channel);
+log_channel_type log_get_channel_type(log_channel);
+int log_free_channel(log_channel);
+void log_close_debug_channels(log_context);
+
+#endif /* !LOGGING_H */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/memcluster.h b/usr/src/lib/libresolv2_joy/include/isc/memcluster.h
new file mode 100644
index 0000000000..0923deb5e7
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/memcluster.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1997,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef MEMCLUSTER_H
+#define MEMCLUSTER_H
+
+#include <stdio.h>
+
+#define meminit __meminit
+#ifdef MEMCLUSTER_DEBUG
+#define memget(s) __memget_debug(s, __FILE__, __LINE__)
+#define memput(p, s) __memput_debug(p, s, __FILE__, __LINE__)
+#else /*MEMCLUSTER_DEBUG*/
+#ifdef MEMCLUSTER_RECORD
+#define memget(s) __memget_record(s, __FILE__, __LINE__)
+#define memput(p, s) __memput_record(p, s, __FILE__, __LINE__)
+#else /*MEMCLUSTER_RECORD*/
+#define memget __memget
+#define memput __memput
+#endif /*MEMCLUSTER_RECORD*/
+#endif /*MEMCLUSTER_DEBUG*/
+#define memstats __memstats
+#define memactive __memactive
+
+int meminit(size_t, size_t);
+void * __memget(size_t);
+void __memput(void *, size_t);
+void * __memget_debug(size_t, const char *, int);
+void __memput_debug(void *, size_t, const char *, int);
+void * __memget_record(size_t, const char *, int);
+void __memput_record(void *, size_t, const char *, int);
+void memstats(FILE *);
+int memactive(void);
+
+#endif /* MEMCLUSTER_H */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/misc.h b/usr/src/lib/libresolv2_joy/include/isc/misc.h
new file mode 100644
index 0000000000..b54f4ee6ed
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/misc.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1995-2001, 2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: misc.h,v 1.7 2008/11/14 02:36:51 marka Exp $
+ */
+
+#ifndef _ISC_MISC_H
+#define _ISC_MISC_H
+
+/*! \file */
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#define bitncmp __bitncmp
+/*#define isc_movefile __isc_movefile */
+
+extern int bitncmp(const void *, const void *, int);
+extern int isc_movefile(const char *, const char *);
+
+extern int isc_gethexstring(unsigned char *, size_t, int, FILE *,
+ int *);
+extern void isc_puthexstring(FILE *, const unsigned char *, size_t,
+ size_t, size_t, const char *);
+extern void isc_tohex(const unsigned char *, size_t, char *);
+
+#endif /*_ISC_MISC_H*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/isc/platform.h b/usr/src/lib/libresolv2_joy/include/isc/platform.h
new file mode 100644
index 0000000000..2fc59b61a8
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/platform.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: platform.h.in,v 1.3 2008/01/23 02:15:56 tbox Exp $ */
+
+/*! \file */
+
+#ifndef ISC_PLATFORM_H
+#define ISC_PLATFORM_H
+
+/*
+ * Define if the OS does not define struct timespec.
+ */
+#undef ISC_PLATFORM_NEEDTIMESPEC
+#ifdef ISC_PLATFORM_NEEDTIMESPEC
+#include <time.h> /* For time_t */
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+#endif
+
+#endif
diff --git a/usr/src/lib/libresolv2_joy/include/isc/tree.h b/usr/src/lib/libresolv2_joy/include/isc/tree.h
new file mode 100644
index 0000000000..96feaca68d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/isc/tree.h
@@ -0,0 +1,59 @@
+/* tree.h - declare structures used by tree library
+ *
+ * vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes]
+ * vix 27jun86 [broken out of tree.c]
+ *
+ * $Id: tree.h,v 1.3 2005/04/27 04:56:18 sra Exp $
+ */
+
+
+#ifndef _TREE_H_INCLUDED
+#define _TREE_H_INCLUDED
+
+
+#ifndef __P
+# if defined(__STDC__) || defined(__GNUC__)
+# define __P(x) x
+# else
+# define __P(x) ()
+# endif
+#endif
+
+/*%
+ * tree_t is our package-specific anonymous pointer.
+ */
+#if defined(__STDC__) || defined(__GNUC__)
+typedef void *tree_t;
+#else
+typedef char *tree_t;
+#endif
+
+/*%
+ * Do not taint namespace
+ */
+#define tree_add __tree_add
+#define tree_delete __tree_delete
+#define tree_init __tree_init
+#define tree_mung __tree_mung
+#define tree_srch __tree_srch
+#define tree_trav __tree_trav
+
+
+typedef struct tree_s {
+ tree_t data;
+ struct tree_s *left, *right;
+ short bal;
+ }
+ tree;
+
+
+void tree_init __P((tree **));
+tree_t tree_srch __P((tree **, int (*)(), tree_t));
+tree_t tree_add __P((tree **, int (*)(), tree_t, void (*)()));
+int tree_delete __P((tree **, int (*)(), tree_t, void (*)()));
+int tree_trav __P((tree **, int (*)()));
+void tree_mung __P((tree **, void (*)()));
+
+
+#endif /* _TREE_H_INCLUDED */
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/make_os_version b/usr/src/lib/libresolv2_joy/include/make_os_version
new file mode 100755
index 0000000000..3654490fee
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/make_os_version
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Copyright (c) 1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+UNAME_R=`/usr/bin/uname -r`
+
+OS_MAJOR=`echo $UNAME_R | /usr/bin/sed -e 's/^\([^.]*\).*/\1/'`
+OS_MINOR=`echo $UNAME_R | /usr/bin/sed -e 's/^[^.]*\.\([^.]*\).*/\1/'`
+OS_VERSION=`echo $UNAME_R | tr '.' '_'`
+
+cat <<EOF > new_os_version.h
+#ifndef OS_VERSION_H
+#define OS_VERSION_H
+
+#define SUNOS_$OS_VERSION
+#define OS_MAJOR $OS_MAJOR
+#define OS_MINOR $OS_MINOR
+
+#endif
+EOF
+
+if [ -f os_version.h ]; then
+ if /usr/bin/cmp -s new_os_version.h os_version.h; then
+ /usr/bin/rm -f new_os_version.h
+ else
+ /usr/bin/rm -f os_version.h
+ /usr/bin/mv new_os_version.h os_version.h
+ fi
+else
+ /usr/bin/mv new_os_version.h os_version.h
+fi
diff --git a/usr/src/lib/libresolv2_joy/include/make_os_version.sh b/usr/src/lib/libresolv2_joy/include/make_os_version.sh
new file mode 100644
index 0000000000..3654490fee
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/make_os_version.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Copyright (c) 1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+UNAME_R=`/usr/bin/uname -r`
+
+OS_MAJOR=`echo $UNAME_R | /usr/bin/sed -e 's/^\([^.]*\).*/\1/'`
+OS_MINOR=`echo $UNAME_R | /usr/bin/sed -e 's/^[^.]*\.\([^.]*\).*/\1/'`
+OS_VERSION=`echo $UNAME_R | tr '.' '_'`
+
+cat <<EOF > new_os_version.h
+#ifndef OS_VERSION_H
+#define OS_VERSION_H
+
+#define SUNOS_$OS_VERSION
+#define OS_MAJOR $OS_MAJOR
+#define OS_MINOR $OS_MINOR
+
+#endif
+EOF
+
+if [ -f os_version.h ]; then
+ if /usr/bin/cmp -s new_os_version.h os_version.h; then
+ /usr/bin/rm -f new_os_version.h
+ else
+ /usr/bin/rm -f os_version.h
+ /usr/bin/mv new_os_version.h os_version.h
+ fi
+else
+ /usr/bin/mv new_os_version.h os_version.h
+fi
diff --git a/usr/src/lib/libresolv2_joy/include/port_after.h b/usr/src/lib/libresolv2_joy/include/port_after.h
new file mode 100644
index 0000000000..c3abf4b334
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/port_after.h
@@ -0,0 +1,539 @@
+/*
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/*
+ * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2001-2003 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: port_after.h.in,v 1.60 2008/02/28 05:34:17 marka Exp $ */
+
+#ifndef port_after_h
+#define port_after_h
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#if (!defined(BSD)) || (BSD < 199306)
+#include <sys/bitypes.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif /* HAVE_SYS_SELECT_H */
+
+#ifdef REENABLE_SEND
+#undef send
+#endif
+
+#undef NEED_PSELECT
+#undef HAVE_SA_LEN
+#undef HAVE_MINIMUM_IFREQ
+#define NEED_DAEMON 1
+#undef NEED_STRSEP
+#undef NEED_STRERROR
+#ifdef NEED_STRERROR
+const char *isc_strerror(int);
+#define strerror isc_strerror
+#endif
+/* HAS_INET6_STRUCTS and HAVE_SIN6_SCOPE_ID are defined by port_ipv6.h
+ * #define HAS_INET6_STRUCTS 1
+ * #define HAVE_SIN6_SCOPE_ID 1
+ */
+#include <port_ipv6.h>
+
+#undef NEED_IN6ADDR_ANY
+#undef HAS_IN_ADDR6
+#define HAVE_SOCKADDR_STORAGE 1
+#undef NEED_GETTIMEOFDAY
+#define HAVE_STRNDUP
+#undef USE_FIONBIO_IOCTL
+#undef INNETGR_ARGS
+
+#undef USE_IFNAMELINKID
+#define PORT_NONBLOCK O_NONBLOCK
+
+#ifndef _POSIX_PATH_MAX
+#define _POSIX_PATH_MAX 255
+#endif
+#ifndef PATH_MAX
+#define PATH_MAX _POSIX_PATH_MAX
+#endif
+
+/*
+ * We need to know the IPv6 address family number even on IPv4-only systems.
+ * Note that this is NOT a protocol constant, and that if the system has its
+ * own AF_INET6, different from ours below, all of BIND's libraries and
+ * executables will need to be recompiled after the system <sys/socket.h>
+ * has had this type added. The type number below is correct on most BSD-
+ * derived systems for which AF_INET6 is defined.
+ */
+#ifndef AF_INET6
+#define AF_INET6 24
+#endif
+
+#ifndef PF_INET6
+#define PF_INET6 AF_INET6
+#endif
+
+#ifdef HAS_IN_ADDR6
+/* Map to pre-RFC structure. */
+#define in6_addr in_addr6
+#endif
+
+#ifndef HAS_INET6_STRUCTS
+/* Replace with structure from later rev of O/S if known. */
+struct in6_addr {
+ u_int8_t s6_addr[16];
+};
+
+#define IN6ADDR_ANY_INIT \
+ {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
+
+#define IN6ADDR_LOOPBACK_INIT \
+ {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
+
+/* Replace with structure from later rev of O/S if known. */
+struct sockaddr_in6 {
+#ifdef HAVE_SA_LEN
+ u_int8_t sin6_len; /* length of this struct */
+ u_int8_t sin6_family; /* AF_INET6 */
+#else
+ u_int16_t sin6_family; /* AF_INET6 */
+#endif
+ u_int16_t sin6_port; /* transport layer port # */
+ u_int32_t sin6_flowinfo; /* IPv6 flow information */
+ struct in6_addr sin6_addr; /* IPv6 address */
+ u_int32_t sin6_scope_id; /* set of interfaces for a scope */
+};
+#endif /* HAS_INET6_STRUCTS */
+
+#ifdef BROKEN_IN6ADDR_INIT_MACROS
+#undef IN6ADDR_ANY_INIT
+#undef IN6ADDR_LOOPBACK_INIT
+#endif
+
+#ifdef _AIX
+#ifndef IN6ADDR_ANY_INIT
+#define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0 }}}
+#endif
+#ifndef IN6ADDR_LOOPBACK_INIT
+#if BYTE_ORDER == BIG_ENDIAN
+#define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 1 }}}
+#else
+#define IN6ADDR_LOOPBACK_INIT {{{0, 0, 0, 0x01000000}}}
+#endif
+#endif
+#endif
+
+#ifndef IN6ADDR_ANY_INIT
+#ifdef s6_addr
+#define IN6ADDR_ANY_INIT \
+ {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
+#else
+#define IN6ADDR_ANY_INIT \
+ {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
+#endif
+
+#endif
+#ifndef IN6ADDR_LOOPBACK_INIT
+#ifdef s6_addr
+#define IN6ADDR_LOOPBACK_INIT \
+ {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#else
+#define IN6ADDR_LOOPBACK_INIT \
+ {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
+#endif
+#endif
+
+#ifndef HAVE_SOCKADDR_STORAGE
+#define __SS_MAXSIZE 128
+#define __SS_ALLIGSIZE (sizeof (long))
+
+struct sockaddr_storage {
+#ifdef HAVE_SA_LEN
+ u_int8_t ss_len; /* address length */
+ u_int8_t ss_family; /* address family */
+ char __ss_pad1[__SS_ALLIGSIZE - 2 * sizeof(u_int8_t)];
+ long __ss_align;
+ char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
+#else
+ u_int16_t ss_family; /* address family */
+ char __ss_pad1[__SS_ALLIGSIZE - sizeof(u_int16_t)];
+ long __ss_align;
+ char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
+#endif
+};
+#endif
+
+
+#if !defined(HAS_INET6_STRUCTS) || defined(NEED_IN6ADDR_ANY)
+#define in6addr_any isc_in6addr_any
+extern const struct in6_addr in6addr_any;
+#endif
+
+/*
+ * IN6_ARE_ADDR_EQUAL, IN6_IS_ADDR_UNSPECIFIED, IN6_IS_ADDR_V4COMPAT and
+ * IN6_IS_ADDR_V4MAPPED are broken in glibc 2.1.
+ */
+#ifdef __GLIBC__
+#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
+#undef IN6_ARE_ADDR_EQUAL
+#undef IN6_IS_ADDR_UNSPECIFIED
+#undef IN6_IS_ADDR_V4COMPAT
+#undef IN6_IS_ADDR_V4MAPPED
+#endif
+#endif
+
+#ifndef IN6_ARE_ADDR_EQUAL
+#define IN6_ARE_ADDR_EQUAL(a,b) \
+ (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
+#endif
+
+#ifndef IN6_IS_ADDR_UNSPECIFIED
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+ IN6_ARE_ADDR_EQUAL(a, &in6addr_any)
+#endif
+
+#ifndef IN6_IS_ADDR_LOOPBACK
+extern const struct in6_addr isc_in6addr_loopback;
+#define IN6_IS_ADDR_LOOPBACK(a) \
+ IN6_ARE_ADDR_EQUAL(a, &isc_in6addr_loopback)
+#endif
+
+#ifndef IN6_IS_ADDR_V4MAPPED
+#define IN6_IS_ADDR_V4MAPPED(a) \
+ ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \
+ (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \
+ (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \
+ (a)->s6_addr[6] == 0x00 && (a)->s6_addr[9] == 0x00 && \
+ (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \
+ (a)->s6_addr[10] == 0xff && (a)->s6_addr[11] == 0xff)
+#endif
+
+#ifndef IN6_IS_ADDR_SITELOCAL
+#define IN6_IS_ADDR_SITELOCAL(a) \
+ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
+#endif
+
+#ifndef IN6_IS_ADDR_LINKLOCAL
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
+#endif
+
+#ifndef IN6_IS_ADDR_MULTICAST
+#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
+#endif
+
+#ifndef __IPV6_ADDR_MC_SCOPE
+#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
+#endif
+
+#ifndef __IPV6_ADDR_SCOPE_SITELOCAL
+#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
+#endif
+#ifndef __IPV6_ADDR_SCOPE_ORGLOCAL
+#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08
+#endif
+
+#ifndef IN6_IS_ADDR_MC_SITELOCAL
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
+#endif
+
+#ifndef IN6_IS_ADDR_MC_ORGLOCAL
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
+#endif
+
+#ifndef INADDR_NONE
+#define INADDR_NONE 0xffffffff
+#endif
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 256
+#endif
+
+#ifndef INET6_ADDRSTRLEN
+/* sizeof("aaaa:bbbb:cccc:dddd:eeee:ffff:123.123.123.123") */
+#define INET6_ADDRSTRLEN 46
+#endif
+
+#ifndef MIN
+#define MIN(x,y) (((x) <= (y)) ? (x) : (y))
+#endif
+
+#ifndef MAX
+#define MAX(x,y) (((x) >= (y)) ? (x) : (y))
+#endif
+
+#ifdef NEED_DAEMON
+int daemon(int nochdir, int noclose);
+#endif
+
+#ifdef NEED_STRSEP
+char * strsep(char **stringp, const char *delim);
+#endif
+
+#ifndef ALIGN
+#define ALIGN(p) (((uintptr_t)(p) + (sizeof(long) - 1)) & ~(sizeof(long) - 1))
+#endif
+
+#ifdef NEED_SETGROUPENT
+int setgroupent(int stayopen);
+#endif
+
+#ifdef NEED_GETGROUPLIST
+int getgrouplist(GETGROUPLIST_ARGS);
+#endif
+
+#ifdef POSIX_GETGRNAM_R
+int
+__posix_getgrnam_r(const char *, struct group *, char *, int, struct group **);
+#endif
+
+#ifdef NEED_GETGRNAM_R
+int
+getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
+#endif
+
+#ifdef POSIX_GETGRGID_R
+int
+__posix_getgrgid_r(gid_t, struct group *, char *, int, struct group **) ;
+#endif
+
+#ifdef NEED_GETGRGID_R
+int
+getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
+#endif
+
+#ifdef NEED_GETGRENT_R
+GROUP_R_RETURN getgrent_r(struct group *gptr, GROUP_R_ARGS);
+#endif
+
+#ifdef NEED_SETGRENT_R
+GROUP_R_SET_RETURN setgrent_r(GROUP_R_ENT_ARGS);
+#endif
+
+#ifdef NEED_ENDGRENT_R
+GROUP_R_END_RETURN endgrent_r(GROUP_R_ENT_ARGS);
+#endif
+
+#if defined(NEED_INNETGR_R) && defined(NGR_R_RETURN)
+NGR_R_RETURN
+innetgr_r(const char *, const char *, const char *, const char *);
+#endif
+
+#ifdef NEED_SETNETGRENT_R
+#ifdef NGR_R_SET_ARGS
+NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS);
+#else
+NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup);
+#endif
+#endif
+
+#ifdef NEED_ENDNETGRENT_R
+#ifdef NGR_R_END_ARGS
+NGR_R_END_RETURN endnetgrent_r(NGR_R_END_ARGS);
+#else
+NGR_R_END_RETURN endnetgrent_r(void);
+#endif
+#endif
+
+#ifdef POSIX_GETPWNAM_R
+int
+__posix_getpwnam_r(const char *login, struct passwd *pwptr,
+ char *buf, size_t buflen, struct passwd **result);
+#endif
+
+#ifdef NEED_GETPWNAM_R
+int
+getpwnam_r(const char *login, struct passwd *pwptr,
+ char *buf, size_t buflen, struct passwd **result);
+#endif
+
+#ifdef POSIX_GETPWUID_R
+int
+__posix_getpwuid_r(uid_t uid, struct passwd *pwptr,
+ char *buf, int buflen, struct passwd **result);
+#endif
+
+#ifdef NEED_GETPWUID_R
+int
+getpwuid_r(uid_t uid, struct passwd *pwptr,
+ char *buf, size_t buflen, struct passwd **result);
+#endif
+
+#ifdef NEED_SETPWENT_R
+#ifdef PASS_R_ENT_ARGS
+PASS_R_SET_RETURN setpwent_r(PASS_R_ENT_ARGS);
+#else
+PASS_R_SET_RETURN setpwent_r(void);
+#endif
+
+#endif
+
+#ifdef NEED_SETPASSENT_R
+#ifdef PASS_R_ENT_ARGS
+PASS_R_SET_RETURN setpassent_r(int stayopen, PASS_R_ENT_ARGS);
+#else
+PASS_R_SET_RETURN setpassent_r(int stayopen);
+#endif
+#endif
+
+#ifdef NEED_GETPWENT_R
+PASS_R_RETURN getpwent_r(struct passwd *pwptr, PASS_R_ARGS);
+#endif
+
+#ifdef NEED_ENDPWENT_R
+void endpwent_r(void);
+#endif
+
+#ifdef NEED_SETPASSENT
+int setpassent(int stayopen);
+#endif
+
+#define gettimeofday isc__gettimeofday
+#ifdef NEED_GETTIMEOFDAY
+int isc__gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp);
+#else
+int isc__gettimeofday(struct timeval *tp, struct timezone *tzp);
+#endif
+
+int getnetgrent(NGR_R_CONST char **machinep, NGR_R_CONST char **userp,
+ NGR_R_CONST char **domainp);
+
+#ifdef NGR_R_ARGS
+int getnetgrent_r(NGR_R_CONST char **machinep, NGR_R_CONST char **userp,
+ NGR_R_CONST char **domainp, NGR_R_ARGS);
+#endif
+
+/* setnetgrent and endnetgrent are defined in sunw_port_after.h
+#ifdef SETNETGRENT_ARGS
+void setnetgrent(SETNETGRENT_ARGS);
+#else
+void setnetgrent(const char *netgroup);
+#endif
+
+void endnetgrent(void);
+*/
+
+#ifdef INNETGR_ARGS
+int innetgr(INNETGR_ARGS);
+#else
+int innetgr(const char *netgroup, const char *machine,
+ const char *user, const char *domain);
+#endif
+
+#ifdef NGR_R_SET_ARGS
+NGR_R_SET_RETURN
+setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS);
+#else
+NGR_R_SET_RETURN
+setnetgrent_r(NGR_R_SET_CONST char *netgroup);
+#endif
+
+#ifdef NEED_STRTOUL
+unsigned long strtoul(const char *, char **, int);
+#endif
+
+#ifdef NEED_SUN4PROTOS
+#include <stdarg.h>
+#ifndef __SIZE_TYPE__
+#define __SIZE_TYPE__ int
+#endif
+struct sockaddr;
+struct iovec;
+struct timeval;
+struct timezone;
+int fprintf(FILE *, const char *, ...);
+int getsockname(int, struct sockaddr *, int *);
+int getpeername(int, struct sockaddr *, int *);
+int socket(int, int, int);
+int connect(int, const struct sockaddr *, int);
+int writev(int, struct iovec *, int);
+int readv(int, struct iovec *, int);
+int send(int, const char *, int, int);
+void bzero(char *, int);
+int recvfrom(int, char *, int, int, struct sockaddr *, int *);
+int syslog(int, const char *, ... );
+int printf(const char *, ...);
+__SIZE_TYPE__ fread(void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *);
+__SIZE_TYPE__ fwrite(const void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *);
+int fclose(FILE *);
+int ungetc(int, FILE *);
+int scanf(const char *, ...);
+int sscanf(const char *, const char *, ... );
+int tolower(int);
+int toupper(int);
+int strcasecmp(const char *, const char *);
+int strncasecmp(const char *, const char *, int);
+int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
+#ifdef gettimeofday
+#undef gettimeofday
+int gettimeofday(struct timeval *, struct timezone *);
+#define gettimeofday isc__gettimeofday
+#else
+int gettimeofday(struct timeval *, struct timezone *);
+#endif
+long strtol(const char*, char **, int);
+int fseek(FILE *, long, int);
+int setsockopt(int, int, int, const char *, int);
+int bind(int, const struct sockaddr *, int);
+void bcopy(char *, char *, int);
+int fputc(char, FILE *);
+int listen(int, int);
+int accept(int, struct sockaddr *, int *);
+int getsockopt(int, int, int, char *, int *);
+int vfprintf(FILE *, const char *, va_list);
+int fflush(FILE *);
+int fgetc(FILE *);
+int fputs(const char *, FILE *);
+int fchown(int, int, int);
+void setbuf(FILE *, char *);
+int gethostname(char *, int);
+int rename(const char *, const char *);
+time_t time(time_t *);
+int fscanf(FILE *, const char *, ...);
+int sscanf(const char *, const char *, ...);
+int ioctl(int, int, caddr_t);
+void perror(const char *);
+
+#if !defined(__USE_FIXED_PROTOTYPES__) && !defined(__cplusplus) && !defined(__STRICT_ANSI__)
+/*
+ * 'gcc -ansi' changes the prototype for vsprintf().
+ * Use this prototype when 'gcc -ansi' is not in effect.
+ */
+char *vsprintf(char *, const char *, va_list);
+#endif
+#endif
+
+/* Solaris-specific changes */
+#include "sunw_port_after.h"
+
+#endif /* port_after_h */
diff --git a/usr/src/lib/libresolv2_joy/include/port_before.h b/usr/src/lib/libresolv2_joy/include/port_before.h
new file mode 100644
index 0000000000..2801139223
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/port_before.h
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (C) 2005-2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: port_before.h.in,v 1.31 2008/02/28 05:36:10 marka Exp $ */
+
+#ifndef port_before_h
+#define port_before_h
+/* Solaris-specific changes */
+#include "sunw_port_before.h"
+#include <config.h>
+
+#ifdef NEED_SUN4PROTOS
+#define _PARAMS(x) x
+#endif
+
+struct group; /* silence warning */
+struct passwd; /* silence warning */
+struct timeval; /* silence warning */
+struct timezone; /* silence warning */
+
+#ifdef HAVE_SYS_TIMERS_H
+#include <sys/timers.h>
+#endif
+#include <limits.h>
+
+#ifdef ISC_PLATFORM_NEEDTIMESPEC
+#include <time.h> /* For time_t */
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+#endif
+#ifndef HAVE_MEMMOVE
+#define memmove(a,b,c) bcopy(b,a,c)
+#endif
+
+#undef WANT_IRS_GR
+#undef WANT_IRS_NIS
+#undef WANT_IRS_PW
+
+#define BSD_COMP 1
+#define USE_POLL 1
+#define HAVE_MD5 1
+#define SOLARIS2 1
+
+/* DO_PTHREADS is conditionally defined in sunw_port_before.h
+ * #define DO_PTHREADS 1 */
+#define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups
+#define GETNETBYADDR_ADDR_T long
+#define SETPWENT_VOID 1
+#define SETGRENT_VOID 1
+
+#define NET_R_ARGS char *buf, int buflen
+#define NET_R_BAD NULL
+#define NET_R_COPY buf, buflen
+#define NET_R_COPY_ARGS NET_R_ARGS
+#define NET_R_END_RESULT(x) /*empty*/
+#define NET_R_END_RETURN void
+#undef NET_R_ENT_ARGS /*empty*/
+#define NET_R_OK nptr
+#define NET_R_RETURN struct netent *
+#undef NET_R_SET_RESULT /*empty*/
+#undef NET_R_SETANSWER
+#define NET_R_SET_RETURN void
+#undef NETENT_DATA
+
+#define GROUP_R_RETURN struct group *
+#define GROUP_R_SET_RETURN void
+#undef GROUP_R_SET_RESULT /*empty*/
+#define GROUP_R_END_RETURN void
+#define GROUP_R_END_RESULT(x) /*empty*/
+#define GROUP_R_ARGS char *buf, int buflen
+#define GROUP_R_ENT_ARGS void
+#define GROUP_R_OK gptr
+#define GROUP_R_BAD NULL
+
+#define HOST_R_ARGS char *buf, int buflen, int *h_errnop
+#define HOST_R_BAD NULL
+#define HOST_R_COPY buf, buflen
+#define HOST_R_COPY_ARGS char *buf, int buflen
+#define HOST_R_END_RESULT(x) /*empty*/
+#define HOST_R_END_RETURN void
+#undef HOST_R_ENT_ARGS /*empty*/
+#define HOST_R_ERRNO *h_errnop = h_errno
+#define HOST_R_OK hptr
+#define HOST_R_RETURN struct hostent *
+#undef HOST_R_SETANSWER
+#undef HOST_R_SET_RESULT
+#define HOST_R_SET_RETURN void
+#undef HOSTENT_DATA
+
+#define NGR_R_ARGS char *buf, int buflen
+#define NGR_R_BAD (0)
+#define NGR_R_COPY buf, buflen
+#define NGR_R_COPY_ARGS NGR_R_ARGS
+#define NGR_R_CONST
+#define NGR_R_END_RESULT(x) /*empty*/
+#define NGR_R_END_RETURN void
+#undef NGR_R_END_ARGS /*empty*/
+#define NGR_R_OK 1
+#define NGR_R_RETURN int
+#define NGR_R_SET_CONST const
+#undef NGR_R_SET_RESULT /*empty*/
+#define NGR_R_SET_RETURN void
+#undef NGR_R_SET_ARGS
+
+
+#if !defined(NGR_R_SET_ARGS) && defined(NGR_R_END_ARGS)
+#define NGR_R_SET_ARGS NGR_R_END_ARGS
+#endif
+
+#define PROTO_R_ARGS char *buf, int buflen
+#define PROTO_R_BAD NULL
+#define PROTO_R_COPY buf, buflen
+#define PROTO_R_COPY_ARGS PROTO_R_ARGS
+#define PROTO_R_END_RESULT(x) /*empty*/
+#define PROTO_R_END_RETURN void
+#undef PROTO_R_ENT_ARGS /*empty*/
+#undef PROTO_R_ENT_UNUSED
+#define PROTO_R_OK pptr
+#undef PROTO_R_SETANSWER
+#define PROTO_R_RETURN struct protoent *
+#undef PROTO_R_SET_RESULT
+#define PROTO_R_SET_RETURN void
+#undef PROTOENT_DATA
+
+#define PASS_R_ARGS char *buf, int buflen
+#define PASS_R_BAD NULL
+#define PASS_R_COPY buf, buflen
+#define PASS_R_COPY_ARGS PASS_R_ARGS
+#define PASS_R_END_RESULT(x) /*empty*/
+#define PASS_R_END_RETURN void
+#undef PASS_R_ENT_ARGS
+#define PASS_R_OK pwptr
+#define PASS_R_RETURN struct passwd *
+#undef PASS_R_SET_RESULT /*empty*/
+#define PASS_R_SET_RETURN void
+
+#define SERV_R_ARGS char *buf, int buflen
+#define SERV_R_BAD NULL
+#define SERV_R_COPY buf, buflen
+#define SERV_R_COPY_ARGS SERV_R_ARGS
+#define SERV_R_END_RESULT(x) /*empty*/
+#define SERV_R_END_RETURN void
+#undef SERV_R_ENT_ARGS /*empty*/
+#undef SERV_R_ENT_UNUSED /*empty*/
+#define SERV_R_OK sptr
+#undef SERV_R_SETANSWER
+#define SERV_R_RETURN struct servent *
+#undef SERV_R_SET_RESULT
+#define SERV_R_SET_RETURN void
+
+
+
+#define DE_CONST(konst, var) \
+ do { \
+ union { const void *k; void *v; } _u; \
+ _u.k = konst; \
+ var = _u.v; \
+ } while (0)
+
+#define UNUSED(x) (x) = (x)
+
+#undef NEED_SOLARIS_BITTYPES
+#define ISC_SOCKLEN_T int
+
+#ifdef __GNUC__
+#define ISC_FORMAT_PRINTF(fmt, args) \
+ __attribute__((__format__(__printf__, fmt, args)))
+#else
+#define ISC_FORMAT_PRINTF(fmt, args)
+#endif
+
+/* Pull in host order macros when _XOPEN_SOURCE_EXTENDED is defined. */
+#if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
+#include <sys/byteorder.h>
+#endif
+
+#endif
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/port_netdb.h b/usr/src/lib/libresolv2_joy/include/port_netdb.h
new file mode 100644
index 0000000000..a308cc7efa
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/port_netdb.h
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#ifndef _PORT_NETDB_H
+#define _PORT_NETDB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* AI_NUMERICSERV is not a valid flag for getaddrinfo */
+#define AI_MASK 0x0038 /* mask of valid flags */
+
+/* EAI_OVERFLOW was removed from ISC */
+#define EAI_BADHINTS 12
+
+/*
+ * these are libresolv2 functions that were renamed in previous versions to
+ * res_* because they conflict with libnsl or libsocket
+ */
+
+#define endhostent joy_res_endhostent /* libnsl */
+void endhostent __P((void));
+#define endnetent res_endnetent /* libsocket */
+void endnetent __P((void));
+#define freeaddrinfo res_freeaddrinfo /* libsocket */
+void freeaddrinfo __P((struct addrinfo *));
+#define freehostent res_freehostent /* libsocket and libnsl */
+void freehostent __P((struct hostent *));
+#define getaddrinfo res_getaddrinfo /* libsocket */
+int getaddrinfo __P((const char *, const char *,
+ const struct addrinfo *, struct addrinfo **));
+#define gethostbyaddr joy_res_gethostbyaddr /* libnsl */
+struct hostent *gethostbyaddr __P((const char *, int, int));
+#define gethostbyname joy_res_gethostbyname /* libnsl */
+struct hostent *gethostbyname __P((const char *));
+#define gethostbyname2 joy_res_gethostbyname2 /* lib/nsswitch/dns */
+struct hostent *gethostbyname2 __P((const char *, int));
+#define gethostent res_gethostent /* libnsl */
+struct hostent *gethostent __P((void));
+#define getipnodebyaddr res_getipnodebyaddr /* libnsl and libsocket */
+struct hostent *getipnodebyaddr __P((const void *, size_t, int, int *));
+#define getipnodebyname res_getipnodebyname /* libnsl and libsocket */
+struct hostent *getipnodebyname __P((const char *, int, int, int *));
+
+#define getnetbyaddr res_getnetbyaddr /* libsocket */
+struct netent *getnetbyaddr __P((unsigned long, int));
+#define getnetbyname res_getnetbyname /* libsocket */
+struct netent *getnetbyname __P((const char *));
+#define getnetent res_getnetent /* libsocket */
+struct netent *getnetent __P((void));
+#define sethostent joy_res_sethostent /* libnsl */
+void sethostent __P((int));
+#define setnetent res_setnetent /* libsocket */
+void setnetent __P((int));
+
+/*
+ * these are other irs functions now included in libresolv.so.2. We rename the
+ * ones that overlap with libsocket or libnsl
+ */
+
+/* endprotoent is in libsocket.so.1 */
+#define endprotoent res_endprotoent
+void endprotoent __P((void));
+
+/* endservent is in libsocket.so.1 */
+#define endservent res_endservent
+void endservent __P((void));
+
+/* note: the next two symbols are variables, not functions */
+
+/* gai_errlist is in libsocket.so.1 */
+#define gai_errlist res_gai_errlist
+
+/* gai_nerr is in libsocket.so.1 */
+#define gai_nerr res_gai_nerr
+
+/* gai_strerror is in libsocket.so.1 */
+#define gai_strerror res_gai_strerror
+const char *gai_strerror __P((int ecode));
+
+/* gethostbyaddr_r is in libnsl.so.1 */
+#define gethostbyaddr_r res_gethostbyaddr_r
+struct hostent *gethostbyaddr_r __P((const char *addr, int len, int type,
+ struct hostent *hptr, char *buf,
+ int buflen, int *h_errnop));
+
+/* gethostbyname_r is in libnsl.so.1 */
+#define gethostbyname_r res_gethostbyname_r
+struct hostent *gethostbyname_r __P((const char *name, struct hostent *hptr,
+ char *buf, int buflen, int *h_errnop));
+
+/* gethostent_r is in libnsl.so.1 */
+#define gethostent_r res_gethostent_r
+struct hostent *gethostent_r __P((struct hostent *hptr, char *buf, int buflen,
+ int *h_errnop));
+
+/* getnameinfo is in libsocket.so.1 */
+#define getnameinfo res_getnameinfo
+int getnameinfo __P((const struct sockaddr *, size_t, char *,
+ size_t, char *, size_t, int));
+
+/* getnetbyaddr_r is in libsocket.so.1 */
+#define getnetbyaddr_r res_getnetbyaddr_r
+struct netent *getnetbyaddr_r __P((long, int, struct netent *, char *, int));
+
+/* getnetbyname_r is in libsocket.so.1 */
+#define getnetbyname_r res_getnetbyname_r
+struct netent *getnetbyname_r __P((const char *, struct netent *, char *, int));
+
+/* getnetent_r is in libsocket.so.1 */
+#define getnetent_r res_getnetent_r
+struct netent *getnetent_r __P((struct netent *, char *, int));
+
+/* getprotobyname is in libsocket.so.1 */
+#define getprotobyname res_getprotobyname
+struct protoent *getprotobyname __P((const char *));
+
+/* getprotobyname_r is in libsocket.so.1 */
+#define getprotobyname_r res_getprotobyname_r
+struct protoent *getprotobyname_r __P((const char *, struct protoent *,
+ char *, int));
+
+/* getprotobynumber is in libsocket.so.1 */
+#define getprotobynumber res_getprotobynumber
+struct protoent *getprotobynumber __P((int));
+
+/* getprotobynumber_r is in libsocket.so.1 */
+#define getprotobynumber_r res_getprotobynumber_r
+struct protoent *getprotobynumber_r __P((int,
+ struct protoent *, char *, int));
+
+/* getprotoent is in libsocket.so.1 */
+#define getprotoent res_getprotoent
+struct protoent *getprotoent __P((void));
+
+/* getprotoent_r is in libsocket.so.1 */
+#define getprotoent_r res_getprotoent_r
+struct protoent *getprotoent_r __P((struct protoent *, char *, int));
+
+/* getservbyname is in libsocket.so.1 and libnsl.so.1 */
+#define getservbyname res_getservbyname
+struct servent *getservbyname __P((const char *, const char *));
+
+/* getservbyname_r is in libsocket.so.1 and libnsl.so.1 */
+#define getservbyname_r res_getservbyname_r
+struct servent *getservbyname_r __P((const char *name, const char *,
+ struct servent *, char *, int));
+
+/* getservbyport is in libsocket.so.1 and libnsl.so.1 */
+#define getservbyport res_getservbyport
+struct servent *getservbyport __P((int, const char *));
+
+/* getservbyport_r is in libsocket.so.1 and libnsl.so.1 */
+#define getservbyport_r res_getservbyport_r
+struct servent *getservbyport_r __P((int port, const char *,
+ struct servent *, char *, int));
+
+/* getservent is in libsocket.so.1 */
+#define getservent res_getservent
+struct servent *getservent __P((void));
+
+/* getservent_r is in libsocket.so.1 */
+#define getservent_r res_getservent_r
+struct servent *getservent_r __P((struct servent *, char *, int));
+
+/* innetgr is in libsocket.so.1 */
+#define innetgr res_innetgr
+int innetgr __P((const char *, const char *, const char *, const char *));
+
+/* setprotoent is in libsocket.so.1 */
+#define setprotoent res_setprotoent
+void setprotoent __P((int));
+
+/* setservent is in libsocket.so.1 */
+#define setservent res_setservent
+void setservent __P((int));
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PORT_NETDB_H */
diff --git a/usr/src/lib/libresolv2_joy/include/port_resolv.h b/usr/src/lib/libresolv2_joy/include/port_resolv.h
new file mode 100644
index 0000000000..cd1a97d40c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/port_resolv.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _PORT_RESOLV_H
+#define _PORT_RESOLV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* RES_NSID has the same value as RES_NO_NIBBLE, which has been deleted */
+#define RES_NSID 0x00040000 /* request name server ID */
+
+/* RES_DEFAULT has a new value in libbind-6.0 */
+#undef RES_DEFAULT
+#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | \
+ RES_DNSRCH | RES_NO_NIBBLE2)
+
+#ifndef __ultrix__
+u_int16_t _getshort __P((const uchar_t *));
+u_int32_t _getlong __P((const uchar_t *));
+#endif
+
+/* rename functions so they can be wrapped (see sunw/sunw_wrappers.c */
+#define p_option isc_p_option
+const char *p_option(ulong_t option);
+#define p_secstodate isc_p_secstodate
+char *p_secstodate(ulong_t secs);
+
+/* prevent namespace pollution */
+#define res_protocolnumber __res_protocolnumber
+#define res_servicenumber __res_servicenumber
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PORT_RESOLV_H */
diff --git a/usr/src/lib/libresolv2_joy/include/probe_ipv6 b/usr/src/lib/libresolv2_joy/include/probe_ipv6
new file mode 100755
index 0000000000..371ac96c55
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/probe_ipv6
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# Copyright 2003 by Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+set -e
+PATH=/bin:/usr/bin:$PATH; export PATH
+trap "rm -f tmp$$[abc].[oc]" 0
+target=port_ipv6
+new=new_${target}.h
+old=${target}.h
+
+cat > tmp$$a.c <<EOF
+#include <sys/types.h>
+#include <netinet/in.h>
+struct sockaddr_in6 xx;
+EOF
+
+cat > tmp$$b.c <<EOF
+#include <sys/types.h>
+#include <netinet/in.h>
+struct in6_addr xx;
+EOF
+
+cat > tmp$$c.c <<EOF
+#include <sys/types.h>
+#include <netinet/in.h>
+struct sockaddr_in6 xx;
+main() { xx.sin6_scope_id = 0; }
+EOF
+
+cat > ${new} <<EOF
+
+/* This file is automatically generated. Do Not Edit. */
+
+#ifndef ${target}_h
+#define ${target}_h
+
+EOF
+
+if ${CC} -c tmp$$a.c > /dev/null 2>&1
+then
+ echo "#define HAS_INET6_STRUCTS" >> ${new}
+ if ${CC} -c tmp$$b.c > /dev/null 2>&1
+ then
+ :
+ else
+ echo "#define in6_addr in_addr6" >> ${new}
+ fi
+ if ${CC} -c tmp$$c.c > /dev/null 2>&1
+ then
+ echo "#define HAVE_SIN6_SCOPE_ID" >> ${new}
+ else
+ echo "#undef HAVE_SIN6_SCOPE_ID" >> ${new}
+ fi
+else
+ echo "#undef HAS_INET6_STRUCTS" >> ${new}
+fi
+echo >> ${new}
+echo "#endif" >> ${new}
+if [ -f ${old} ]; then
+ if cmp -s ${new} ${old} ; then
+ rm -f ${new}
+ else
+ rm -f ${old}
+ mv ${new} ${old}
+ fi
+else
+ mv ${new} ${old}
+fi
+exit 0
diff --git a/usr/src/lib/libresolv2_joy/include/probe_ipv6.sh b/usr/src/lib/libresolv2_joy/include/probe_ipv6.sh
new file mode 100644
index 0000000000..371ac96c55
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/probe_ipv6.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# Copyright 2003 by Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+set -e
+PATH=/bin:/usr/bin:$PATH; export PATH
+trap "rm -f tmp$$[abc].[oc]" 0
+target=port_ipv6
+new=new_${target}.h
+old=${target}.h
+
+cat > tmp$$a.c <<EOF
+#include <sys/types.h>
+#include <netinet/in.h>
+struct sockaddr_in6 xx;
+EOF
+
+cat > tmp$$b.c <<EOF
+#include <sys/types.h>
+#include <netinet/in.h>
+struct in6_addr xx;
+EOF
+
+cat > tmp$$c.c <<EOF
+#include <sys/types.h>
+#include <netinet/in.h>
+struct sockaddr_in6 xx;
+main() { xx.sin6_scope_id = 0; }
+EOF
+
+cat > ${new} <<EOF
+
+/* This file is automatically generated. Do Not Edit. */
+
+#ifndef ${target}_h
+#define ${target}_h
+
+EOF
+
+if ${CC} -c tmp$$a.c > /dev/null 2>&1
+then
+ echo "#define HAS_INET6_STRUCTS" >> ${new}
+ if ${CC} -c tmp$$b.c > /dev/null 2>&1
+ then
+ :
+ else
+ echo "#define in6_addr in_addr6" >> ${new}
+ fi
+ if ${CC} -c tmp$$c.c > /dev/null 2>&1
+ then
+ echo "#define HAVE_SIN6_SCOPE_ID" >> ${new}
+ else
+ echo "#undef HAVE_SIN6_SCOPE_ID" >> ${new}
+ fi
+else
+ echo "#undef HAS_INET6_STRUCTS" >> ${new}
+fi
+echo >> ${new}
+echo "#endif" >> ${new}
+if [ -f ${old} ]; then
+ if cmp -s ${new} ${old} ; then
+ rm -f ${new}
+ else
+ rm -f ${old}
+ mv ${new} ${old}
+ fi
+else
+ mv ${new} ${old}
+fi
+exit 0
diff --git a/usr/src/lib/libresolv2_joy/include/res_update.h b/usr/src/lib/libresolv2_joy/include/res_update.h
new file mode 100644
index 0000000000..0c6967db56
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/res_update.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1999 by Internet Software Consortium, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * $Id: res_update.h,v 1.3 2005/04/27 04:56:15 sra Exp $
+ */
+
+#ifndef __RES_UPDATE_H
+#define __RES_UPDATE_H
+
+/*! \file */
+
+#include <sys/types.h>
+#include <arpa/nameser.h>
+#include <isc/list.h>
+#include <resolv_joy.h>
+
+#ifndef ORIGINAL_ISC_CODE
+/* definition of u_int32_t needed on Solaris */
+#include <sys/bitypes.h>
+/* need to rename ns_updrec before we define it here */
+#include "arpa/port_nameser.h"
+#endif /* ORIGINAL_ISC_CODE */
+
+
+/*%
+ * This RR-like structure is particular to UPDATE.
+ */
+struct ns_updrec {
+ LINK(struct ns_updrec) r_link, r_glink;
+ ns_sect r_section; /*%< ZONE/PREREQUISITE/UPDATE */
+ char * r_dname; /*%< owner of the RR */
+ ns_class r_class; /*%< class number */
+ ns_type r_type; /*%< type number */
+ u_int32_t r_ttl; /*%< time to live */
+ u_char * r_data; /*%< rdata fields as text string */
+ u_int r_size; /*%< size of r_data field */
+ int r_opcode; /*%< type of operation */
+ /* following fields for private use by the resolver/server routines */
+ struct databuf *r_dp; /*%< databuf to process */
+ struct databuf *r_deldp; /*%< databuf's deleted/overwritten */
+ u_int r_zone; /*%< zone number on server */
+};
+typedef struct ns_updrec ns_updrec;
+typedef LIST(ns_updrec) ns_updque;
+
+#ifdef ORIGINAL_ISC_CODE
+#define res_mkupdate __res_mkupdate
+#define res_update __res_update
+#define res_mkupdrec __res_mkupdrec
+#define res_freeupdrec __res_freeupdrec
+#define res_nmkupdate __res_nmkupdate
+#define res_nupdate __res_nupdate
+#else
+/* these are renamed in "port_nameser.h" */
+#endif /* ORIGINAL_ISC_CODE */
+
+
+int res_mkupdate __P((ns_updrec *, u_char *, int));
+int res_update __P((ns_updrec *));
+ns_updrec * res_mkupdrec __P((int, const char *, u_int, u_int, u_long));
+void res_freeupdrec __P((ns_updrec *));
+int res_nmkupdate __P((res_state, ns_updrec *, u_char *, int));
+int res_nupdate __P((res_state, ns_updrec *, ns_tsig_key *));
+
+#endif /*__RES_UPDATE_H*/
+
+/*! \file */
diff --git a/usr/src/lib/libresolv2_joy/include/resolv_mt.h b/usr/src/lib/libresolv2_joy/include/resolv_mt.h
new file mode 100644
index 0000000000..500d4d764c
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/resolv_mt.h
@@ -0,0 +1,47 @@
+#ifndef _RESOLV_MT_H
+#define _RESOLV_MT_H
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv_joy.h>
+
+/* Access functions for the libresolv private interface */
+
+int __res_enable_mt(void);
+int __res_disable_mt(void);
+
+/* Per-thread context */
+
+typedef struct {
+int no_hosts_fallback_private;
+int retry_save;
+int retry_private;
+char inet_nsap_ntoa_tmpbuf[255*3];
+char sym_ntos_unname[20];
+char sym_ntop_unname[20];
+char p_option_nbuf[40];
+char p_time_nbuf[40];
+char precsize_ntoa_retbuf[sizeof "90000000.00"];
+char loc_ntoa_tmpbuf[sizeof
+"1000 60 60.000 N 1000 60 60.000 W -12345678.00m 90000000.00m 90000000.00m 90000000.00m"];
+char p_secstodate_output[15];
+} mtctxres_t;
+
+/* Thread-specific data (TSD) */
+
+mtctxres_t *___mtctxres(void);
+#define mtctxres (___mtctxres())
+
+/* Various static data that should be TSD */
+
+#define sym_ntos_unname (mtctxres->sym_ntos_unname)
+#define sym_ntop_unname (mtctxres->sym_ntop_unname)
+#define inet_nsap_ntoa_tmpbuf (mtctxres->inet_nsap_ntoa_tmpbuf)
+#define p_option_nbuf (mtctxres->p_option_nbuf)
+#define p_time_nbuf (mtctxres->p_time_nbuf)
+#define precsize_ntoa_retbuf (mtctxres->precsize_ntoa_retbuf)
+#define loc_ntoa_tmpbuf (mtctxres->loc_ntoa_tmpbuf)
+#define p_secstodate_output (mtctxres->p_secstodate_output)
+
+#endif /* _RESOLV_MT_H */
diff --git a/usr/src/lib/libresolv2_joy/include/sunw_port_after.h b/usr/src/lib/libresolv2_joy/include/sunw_port_after.h
new file mode 100644
index 0000000000..bff64a74c1
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/sunw_port_after.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SUNW_PORT_AFTER_H
+#define _SUNW_PORT_AFTER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * rename setnetgrent and endnetgrent which were formerly in a separate irs
+ * shared library. These functions should come from libc.so
+ */
+#define setnetgrent res_setnetgrent
+#ifdef SETNETGRENT_ARGS
+void setnetgrent(SETNETGRENT_ARGS);
+#else
+void setnetgrent(const char *netgroup);
+#endif
+
+#define endnetgrent res_endnetgrent
+void endnetgrent(void);
+
+
+/*
+ * include ports for the public header files. ISC's versions are quite different
+ * from those currently in OpenSolaris.
+ */
+
+#ifdef _RESOLV_JOY_H
+#include <port_resolv.h>
+#endif /* _RESOLV_JOY_H */
+
+#ifdef _NETDB_H
+#include <port_netdb.h>
+#endif /* _NETDB_H */
+
+#ifdef _ARPA_INET_H
+#include <arpa/port_inet.h>
+#endif /* _ARPA_INET_H */
+
+#ifdef _ARPA_NAMESER_H
+#include <arpa/port_nameser.h>
+#endif /* _ARPA_NAMESER_H */
+
+
+#ifdef _ARPA_NAMESER_COMPAT_H
+/* no changes */
+#endif /* _ARPA_NAMESER_COMPAT_H */
+
+/* version-specific defines */
+#include <os_version.h>
+
+/*
+ * Prior to 2.6, Solaris needs a prototype for gethostname().
+ */
+#if (OS_MAJOR == 5 && OS_MINOR < 6)
+extern int gethostname(char *, size_t);
+#endif
+/*
+ * gethostid() was not available until 2.5
+ * setsockopt(SO_REUSEADDR) fails on unix domain sockets before 2.5
+ * use ioctl(FIONBIO) rather than fcntl() calls to set/clear non-blocking i/o.
+ */
+#if (OS_MAJOR == 5 && OS_MINOR < 5)
+#define GET_HOST_ID_MISSING
+#define NO_UNIX_REUSEADDR
+#define USE_FIONBIO_IOCTL
+#endif
+
+#if (OS_MAJOR == 5 && OS_MINOR < 11)
+#define NEED_STRSEP
+extern char *strsep(char **, const char *);
+#endif
+
+
+/*
+ * Solaris 2.5 and later have getrlimit(), setrlimit() and getrusage().
+ */
+#if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 5))
+#include <sys/resource.h>
+#define HAVE_GETRUSAGE
+#define RLIMIT_TYPE rlim_t
+#define RLIMIT_FILE_INFINITY
+#endif
+
+/* the default syslog facility of named/lwresd. */
+#ifndef ISC_FACILITY
+#define ISC_FACILITY LOG_DAEMON
+#endif
+
+
+/*
+ * Solaris 8 has if_nametoindex().
+ */
+#if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 8))
+#define USE_IFNAMELINKID
+#endif
+
+#undef ALIGN
+#if (OS_MAJOR == 5 && OS_MINOR > 8)
+#define ALIGN(x) (((uintptr_t)(x) + (sizeof (char *) - 1UL)) & \
+ ~(sizeof (char *) - 1UL))
+#else
+#define ALIGN(x) (((unsigned long)(x) + (sizeof (char *) - 1UL)) & \
+ ~(sizeof (char *) - 1UL))
+#endif
+
+#if (OS_MAJOR == 5 && OS_MINOR < 5)
+#ifndef USE_FIONBIO_IOCTL
+#define USE_FIONBIO_IOCTL 1
+#endif
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SUNW_PORT_AFTER_H */
diff --git a/usr/src/lib/libresolv2_joy/include/sunw_port_before.h b/usr/src/lib/libresolv2_joy/include/sunw_port_before.h
new file mode 100644
index 0000000000..776e311fcc
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/sunw_port_before.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SUNW_PORT_BEFORE_H
+#define _SUNW_PORT_BEFORE_H
+
+#ifdef SUNW_OPTIONS
+#include <conf/sunoptions.h>
+#endif
+
+/* version-specific defines */
+#include <os_version.h>
+#if (OS_MAJOR == 5 && OS_MINOR < 6)
+#ifndef SOLARIS_BITTYPES
+#define NEED_SOLARIS_BITTYPES 1
+#endif
+#endif
+
+#if (OS_MAJOR == 5 && OS_MINOR < 5)
+#undef HAS_PTHREADS
+#else
+#define HAS_PTHREADS
+#endif
+
+#if defined(HAS_PTHREADS) && defined(_REENTRANT)
+#define DO_PTHREADS
+#endif
+
+/*
+ * need these if we are using public versions of nameser.h, resolv.h, and
+ * inet.h
+ */
+#include <sys/param.h>
+#if (!defined(BSD)) || (BSD < 199306)
+#include <sys/bitypes.h>
+#else
+#include <sys/types.h>
+#endif
+#include <sys/cdefs.h>
+
+#endif /* _SUNW_PORT_BEFORE_H */
diff --git a/usr/src/lib/libresolv2_joy/include/sys/bitypes.h b/usr/src/lib/libresolv2_joy/include/sys/bitypes.h
new file mode 100644
index 0000000000..54fb42bad7
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/sys/bitypes.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2004, 2007, 2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1998, 1999, 2001 Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: bitypes.h,v 1.7 2008/11/14 02:54:35 tbox Exp $ */
+
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
+
+ /*
+ * Basic integral types. Omit the typedef if
+ * not possible for a machine/compiler combination.
+ */
+
+#ifdef NEED_SOLARIS_BITTYPES
+ typedef /*signed*/ char int8_t;
+ typedef short int16_t;
+ typedef int int32_t;
+#endif
+ typedef unsigned char u_int8_t;
+ typedef unsigned short u_int16_t;
+ typedef unsigned int u_int32_t;
+
+#endif /* __BIT_TYPES_DEFINED__ */
diff --git a/usr/src/lib/libresolv2_joy/include/sys/cdefs.h b/usr/src/lib/libresolv2_joy/include/sys/cdefs.h
new file mode 100644
index 0000000000..67aac00cc7
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/include/sys/cdefs.h
@@ -0,0 +1,144 @@
+/*
+ * ++Copyright++ 1991, 1993
+ * -
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * --Copyright--
+ */
+
+/*
+ * @(#)cdefs.h 8.1 (Berkeley) 6/2/93
+ * $Id: cdefs.h,v 1.2 2004/07/19 05:54:07 marka Exp $
+ */
+
+#ifndef _CDEFS_H_
+#define _CDEFS_H_
+
+#if defined(__cplusplus)
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS };
+#else
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+
+/*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
+ * in between its arguments. __CONCAT can also concatenate double-quoted
+ * strings produced by the __STRING macro, but this only works with ANSI C.
+ */
+#if defined(__STDC__) || defined(__cplusplus)
+#define __P(protos) protos /* full-blown ANSI C */
+#define __CONCAT(x,y) x ## y
+#define __STRING(x) #x
+
+#define __const const /* define reserved names to standard */
+#define __signed signed
+#define __volatile volatile
+#if defined(__cplusplus)
+#define __inline inline /* convert to C++ keyword */
+#else
+#ifndef __GNUC__
+#define __inline /* delete GCC keyword */
+#endif /* !__GNUC__ */
+#endif /* !__cplusplus */
+
+#else /* !(__STDC__ || __cplusplus) */
+#define __P(protos) () /* traditional C preprocessor */
+#define __CONCAT(x,y) x/**/y
+#define __STRING(x) "x"
+
+#ifndef __GNUC__
+#define __const /* delete pseudo-ANSI C keywords */
+#define __inline
+#define __signed
+#define __volatile
+/*
+ * In non-ANSI C environments, new programs will want ANSI-only C keywords
+ * deleted from the program and old programs will want them left alone.
+ * When using a compiler other than gcc, programs using the ANSI C keywords
+ * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
+ * When using "gcc -traditional", we assume that this is the intent; if
+ * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
+ */
+#ifndef NO_ANSI_KEYWORDS
+#define const /* delete ANSI C keywords */
+#define inline
+#define signed
+#define volatile
+#endif
+#endif /* !__GNUC__ */
+#endif /* !(__STDC__ || __cplusplus) */
+
+/*
+ * GCC1 and some versions of GCC2 declare dead (non-returning) and
+ * pure (no side effects) functions using "volatile" and "const";
+ * unfortunately, these then cause warnings under "-ansi -pedantic".
+ * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
+ * these work for GNU C++ (modulo a slight glitch in the C++ grammar
+ * in the distribution version of 2.5.5).
+ */
+#if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#define __dead __volatile
+#define __pure __const
+#endif
+#endif
+
+/* Delete pseudo-keywords wherever they are not available or needed. */
+#ifndef __dead
+#define __dead
+#define __pure
+#endif
+
+#endif /* !_CDEFS_H_ */
diff --git a/usr/src/lib/print/libipp-core/sparc/Makefile b/usr/src/lib/libresolv2_joy/sparc/Makefile
index 3b985583a4..a333224278 100644
--- a/usr/src/lib/print/libipp-core/sparc/Makefile
+++ b/usr/src/lib/libresolv2_joy/sparc/Makefile
@@ -27,4 +27,4 @@
include ../Makefile.com
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libresolv2_joy/sparcv9/Makefile b/usr/src/lib/libresolv2_joy/sparcv9/Makefile
new file mode 100644
index 0000000000..ceed393e0d
--- /dev/null
+++ b/usr/src/lib/libresolv2_joy/sparcv9/Makefile
@@ -0,0 +1,38 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+# With the adition of BIND 8.3.3, the symbol table for 64 bit went over
+# the limit for Kpic, so we've added -KPIC here, for just the 64 bit
+# library. This avoids compiling the 32-bit library with PIC unnecessarily.
+
+sparcv9_C_PICFLAGS = -K PIC
+sparcv9_CC_PICFLAGS = -KPIC
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/libscf/inc/libscf.h b/usr/src/lib/libscf/inc/libscf.h
index 8e68b4dfcc..232fc205e0 100644
--- a/usr/src/lib/libscf/inc/libscf.h
+++ b/usr/src/lib/libscf/inc/libscf.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _LIBSCF_H
@@ -831,8 +832,13 @@ int smf_notify_del_params(const char *, const char *, int32_t);
/*
* SMF exit status definitions
+ *
+ * The SMF_EXIT_NODAEMON exit status should be used when a method does not
+ * need to run any persistent process. This indicates success, abandons the
+ * contract, and allows dependencies to be met.
*/
#define SMF_EXIT_OK 0
+#define SMF_EXIT_NODAEMON 94
#define SMF_EXIT_ERR_FATAL 95
#define SMF_EXIT_ERR_CONFIG 96
#define SMF_EXIT_MON_DEGRADE 97
diff --git a/usr/src/lib/libshare/Makefile.com b/usr/src/lib/libshare/Makefile.com
index 7e3c902a5e..b5f057d694 100644
--- a/usr/src/lib/libshare/Makefile.com
+++ b/usr/src/lib/libshare/Makefile.com
@@ -42,6 +42,8 @@ $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
#add nfs/lib directory as part of the include path
CFLAGS += $(CCVERBOSE)
+CPPFLAGS += -D_REENTRANT -I$(NFSLIB_DIR) \
+ -I$(ADJUNCT_PROTO)/usr/include/libxml2
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-switch
diff --git a/usr/src/lib/libshare/autofs/Makefile.com b/usr/src/lib/libshare/autofs/Makefile.com
index 41c7dfd334..0538ec55fa 100644
--- a/usr/src/lib/libshare/autofs/Makefile.com
+++ b/usr/src/lib/libshare/autofs/Makefile.com
@@ -46,6 +46,8 @@ LDLIBS += -lshare -lscf -lumem -lc -lxml2
#add nfs/lib directory as part of the include path
CFLAGS += $(CCVERBOSE)
+CPPFLAGS += -D_REENTRANT -I$(AUTOFSSMFLIB_DIR) \
+ -I$(ADJUNCT_PROTO)/usr/include/libxml2
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-unused-variable
CERRWARN += -_gcc=-Wno-uninitialized
diff --git a/usr/src/lib/libshare/nfs/Makefile.com b/usr/src/lib/libshare/nfs/Makefile.com
index d393c5f8ba..44e661bbe2 100644
--- a/usr/src/lib/libshare/nfs/Makefile.com
+++ b/usr/src/lib/libshare/nfs/Makefile.com
@@ -46,6 +46,8 @@ LDLIBS += -lshare -lnsl -lscf -lumem -lc -lxml2
#add nfs/lib directory as part of the include path
CFLAGS += $(CCVERBOSE)
+CPPFLAGS += -D_REENTRANT -I$(NFSLIB_DIR) \
+ -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I$(SRCDIR)/../common
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-unused-variable
diff --git a/usr/src/lib/libshare/nfs/libshare_nfs.c b/usr/src/lib/libshare/nfs/libshare_nfs.c
index 37ea8cdf3d..0cf69a241a 100644
--- a/usr/src/lib/libshare/nfs/libshare_nfs.c
+++ b/usr/src/lib/libshare/nfs/libshare_nfs.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
@@ -2663,9 +2664,16 @@ nfs_init()
ret = initprotofromsmf();
if (ret != SA_OK) {
- (void) printf(dgettext(TEXT_DOMAIN,
- "NFS plugin problem with SMF repository: %s\n"),
- sa_errorstr(ret));
+ /*
+ * This is a workaround. See the comment in
+ * cmd/fs.d/nfs/lib/smfcfg.c for an explanation.
+ */
+ if (getzoneid() == GLOBAL_ZONEID ||
+ ret != SCF_ERROR_NOT_FOUND) {
+ (void) printf(dgettext(TEXT_DOMAIN,
+ "NFS plugin problem with SMF repository: %s\n"),
+ sa_errorstr(ret));
+ }
ret = SA_OK;
}
add_defaults();
diff --git a/usr/src/lib/libshare/smb/Makefile.com b/usr/src/lib/libshare/smb/Makefile.com
index 6b3d821684..3fe65dff3c 100644
--- a/usr/src/lib/libshare/smb/Makefile.com
+++ b/usr/src/lib/libshare/smb/Makefile.com
@@ -49,6 +49,7 @@ LDLIBS += -lshare -ldlpi -lnsl -lnvpair -lscf -lumem -lc
all install := LDLIBS += -lxml2
CFLAGS += $(CCVERBOSE)
+CPPFLAGS += -D_REENTRANT -I$(ADJUNCT_PROTO)/usr/include/libxml2
CERRWARN += -_gcc=-Wno-char-subscripts
CERRWARN += -_gcc=-Wno-switch
CPPFLAGS += -D_REENTRANT -I/usr/include/libxml2 \
diff --git a/usr/src/lib/libshare/smbfs/Makefile.com b/usr/src/lib/libshare/smbfs/Makefile.com
index c4b7b48117..fbd4b80000 100644
--- a/usr/src/lib/libshare/smbfs/Makefile.com
+++ b/usr/src/lib/libshare/smbfs/Makefile.com
@@ -41,6 +41,8 @@ LIBS = $(DYNLIB)
LDLIBS += -lshare -lscf -lumem -luuid -lc -lxml2 -lsmbfs
CFLAGS += $(CCVERBOSE)
+CPPFLAGS += -D_REENTRANT -I$(ADJUNCT_PROTO)/usr/include/libxml2 \
+ -I$(SRCDIR)/../common -I$(SRC)/lib/libsmbfs -I$(SRC)/uts/common
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-uninitialized
CPPFLAGS += -D_REENTRANT -I/usr/include/libxml2 -I$(SRCDIR)/../common \
diff --git a/usr/src/lib/libshell/Makefile b/usr/src/lib/libshell/Makefile
index b584728d5f..1cce2316f0 100644
--- a/usr/src/lib/libshell/Makefile
+++ b/usr/src/lib/libshell/Makefile
@@ -64,6 +64,5 @@ $(SUBDIRS): FRC
FRC:
include Makefile.demo
-include Makefile.doc
include ../Makefile.targ
diff --git a/usr/src/lib/libshell/Makefile.doc b/usr/src/lib/libshell/Makefile.doc
deleted file mode 100644
index 07118f7459..0000000000
--- a/usr/src/lib/libshell/Makefile.doc
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-ROOTDOCDIRBASE= $(ROOT)/usr/share/doc/ksh
-
-DOCFILES= \
- RELEASE \
- README \
- TYPES \
- DESIGN \
- COMPATIBILITY \
- OBSOLETE \
- shell_styleguide.docbook \
- shell_styleguide.html \
- images/tag_bourne.png \
- images/tag_i18n.png \
- images/tag_ksh88.png \
- images/tag_ksh93.png \
- images/tag_ksh.png \
- images/tag_l10n.png \
- images/tag_perf.png \
- images/callouts/1.png \
- images/callouts/2.png \
- images/callouts/3.png \
- images/callouts/4.png \
- images/callouts/5.png \
- images/callouts/6.png \
- images/callouts/7.png \
- images/callouts/8.png \
- images/callouts/9.png \
- images/callouts/10.png
-
-# Documentation rules
-$(ROOTDOCDIRBASE)/%: common/%
- $(INS.file)
-
-$(ROOTDOCDIRBASE)/%: misc/%
- $(INS.file)
-
-ROOTDOCDIRS= \
- $(ROOTDOCDIRBASE) .WAIT \
- $(ROOTDOCDIRBASE)/images .WAIT \
- $(ROOTDOCDIRBASE)/images/callouts
-
-$(ROOTDOCDIRBASE)/%.html: misc/%.docbook
- /usr/bin/xsltproc \
- --nonet \
- --stringparam generate.section.toc.level 0 \
- --stringparam toc.max.depth 3 \
- --stringparam toc.section.depth 12 \
- --xinclude \
- -o "$(@F)" \
- $(DOCBOOK_XSL_ROOT)/html/docbook.xsl \
- "$<" >xsltproc.log 2>&1
- $(INS) -s -m $(FILEMODE) -f "$(@D)" "$(@F)"
- $(RM) "$(@F)"
-
-# Generic documentation rules
-DOCFILESRCDIR= common
-ROOTDOCFILES= $(DOCFILES:%=$(ROOTDOCDIRBASE)/%)
-$(ROOTDOCDIRS) := OWNER = root
-$(ROOTDOCDIRS) := GROUP = bin
-$(ROOTDOCDIRS) := DIRMODE = 755
-
-$(ROOTDOCDIRS):
- $(INS.dir)
-
-install: $(ROOTDOCDIRS) .WAIT $(ROOTDOCFILES)
diff --git a/usr/src/lib/libshell/common/COMPATIBILITY b/usr/src/lib/libshell/common/COMPATIBILITY
deleted file mode 100644
index d4d645a99a..0000000000
--- a/usr/src/lib/libshell/common/COMPATIBILITY
+++ /dev/null
@@ -1,134 +0,0 @@
-
- KSH-93 VS. KSH-88
-
-
-The following is a list of known incompatibilities between ksh-93 and ksh-88.
-I have not include cases that are clearly bugs in ksh-88. I also have
-omitted features that are completely upward compatible.
-
-1. Functions, defined with name() with ksh-93 are compatible with
- the POSIX standard, not with ksh-88. No local variables are
- permitted, and there is no separate scope. Functions defined
- with the function name syntax, maintain compatibility.
- This also affects function traces.
-
-2. ! is now a reserved word. As a result, any command by that
- name will no longer work with ksh-93.
-
-3. The -x attribute of alias and typeset -f is no longer
- effective and the ENV file is only read for interactive
- shells. You need to use FPATH to make function definitions
- visible to scripts.
-
-4. A built-in command named command has been added which is
- always found before the PATH search. Any script which uses
- this name as the name of a command (or function) will not
- be compatible.
-
-5. The output format for some built-ins has changed. In particular
- the output format for set, typeset and alias now have single
- quotes around values that have special characters. The output
- for trap without arguments has a format that can be used as input.
-
-6. With ksh-88, a dollar sign ($') followed by a single quote was
- interpreted literally. Now it is an ANSI-C string. You
- must quote the dollar sign to get the previous behavior.
- Also, a $ in front of a " indicates that the string needs
- to be translated for locales other than C or POSIX. The $
- is ignored in the C and POSIX locale.
-
-7. With ksh-88, tilde expansion did not take place inside ${...}.
- with ksh-93, ${foo-~} will cause tilde expansion if foo is
- not set. You need to escape the ~ for the previous behavior.
-
-8. Some changes in the tokenizing rules where made that might
- cause some scripts with previously ambiguous use of quoting
- to produce syntax errors.
-
-9. Programs that rely on specific exit values for the shell,
- (rather than 0 or non-zero) may not be compatible. The
- exit status for many shell failures has been changed.
-
-10. Built-ins in ksh-88 were always executed before looking for
- the command in the PATH variable. This is no longer true.
- Thus, with ksh-93, if you have the current directory first
- in your PATH, and you have a program named test in your
- directory, it will be executed when you type test; the
- built-in version will be run at the point /bin is found
- in your PATH.
-
-11. Some undocumented combinations of argument passing to ksh
- builtins no longer works since ksh-93 is getopts conforming
- with respect to its built-ins. For example, typeset -8i
- previously would work as a synonym for typeset -i8.
-
-12. Command substitution and arithmetic expansion are now performed
- on PS1, PS3, and ENV when they are expanded. Thus, ` and $(
- as part of the value of these variables must be preceded by a \
- to preserve their previous behavior.
-
-13. The ERRNO variable has been dropped.
-
-14. If the file name following a redirection symbol contain pattern
- characters they will only be expanded for interactive shells.
-
-15. The arguments to a dot script will be restored when it completes.
-
-16. The list of tracked aliases is not displayed with alias unless
- the -t option is specified.
-
-17. The POSIX standard requires that test "$arg" have exit status
- of 0, if and only if $arg is null. However, since this breaks
- programs that use test -t, ksh93 treats an explicit test -t
- as if the user had entered test -t 1.
-
-18. The ^T directive of emacs mode has been changed to work the
- way it does in gnu-emacs.
-
-19. ksh-88 allowed unbalanced parenthes within ${name op val} whereas
- ksh-93 does not. Thus, ${foo-(} needs to be written as ${foo-\(}
- which works with both versions.
-
-20. kill -l in ksh-93 lists only the signal names, not their numerical
- values.
-
-21. Local variables defined by typeset are statically scoped in
- ksh93. In ksh88 they were dynamically scoped although this
- behavior was never documented.
-
-22. The value of the variable given to getopts is set to ? when
- the end-of-options is reached to conform to the POSIX standard.
-
-23. Since the POSIX standard requires that octal constants be
- recongnized, doing arithmetic on typeset -Z variables can
- yield different results that with ksh88. Most of these
- differences were eliminated in ksh93o.
-
-24. Starting after ksh93l, If you run ksh name, where name does
- not contain a /, the current directory will be searched
- before doing a path search on name as required by the POSIX
- shell standard.
-
-25. In ksh93, cd - will output the directory that it changes
- to on standard output as required by X/Open. With ksh88,
- this only happened for interactive shells.
-
-26. As an undocumented feature of ksh-88, a leading 0 to an
- assignment of an integer variable caused that variable
- to be treated as unsigned. This behavior was removed
- starting in ksh93p.
-
-27. The getopts builtin in ksh93 requires that optstring contain
- a leading + to allow options to begin with a +.
-
-28. In emacs/gmacs mode, control-v will not display the version when
- the stty lnext character is set to control-v or is unset.
- The sequence escape control-v will display the shell version.
-
-29. In ksh88, DEBUG traps were executed. after each command. In ksh93
- DEBUG traps are exeucted before each command.
-
-30. In ksh88, a redirection to a file name given by an empty string was
- ignored. In ksh93, this is an error.
-I am interested in expanding this list so please let me know if you
-uncover any others.
diff --git a/usr/src/lib/libshell/common/DESIGN b/usr/src/lib/libshell/common/DESIGN
deleted file mode 100644
index c11c0aff1e..0000000000
--- a/usr/src/lib/libshell/common/DESIGN
+++ /dev/null
@@ -1,170 +0,0 @@
-Here is an overview of the source code organization for ksh93.
-
-Directory layout:
-
- The directory include contains header files for ksh93.
- The files nval.h and shell.h are intended to be public
- headers and can be used to add runtime builtin command.
- The remainder are private.
-
- The directory data contains readonly data files for ksh93.
- The man pages for built-ins are in builtins.c rather
- than included as statics with the implementations in the
- bltins directory because some systems don't make static const
- data readonly and we want these to be shared by all running
- shells.
-
- The directory edit contains the code for command line
- editing and history.
-
- The fun directory contains some shell function such as
- pushd, popd, and dirs.
-
- The directory features contains files that are used to generate
- header files in the FEATURE directory. Most of these files
- are in a format that is processed by iffe.
-
- The directory bltins contains code for most of the built-in
- commands. Additional built-in commands are part of libcmd.
-
- The directory sh contains most of the code for ksh93.
-
- The directory tests contains a number of regression tests.
- In most cases, when a bug gets fixed, a test is added to
- one of these files. The regression tests can be run by
- going to this directory and running
- SHELL=shell_path shell_path shtests
- where shell_path is an absolute pathname for the shell to
- be tested.
-
- The top level directory contains the nmake Makefile, a README,
- and several documentation files. The RELEASE file contains
- the list of bug fixes and new features since the original
- ksh93 release. The file COMPATIBILITY is a list of all
- known incompatibilities with ksh88.
-
- The bash_pre_rc.sh is a startup script used when emulating
- bash if the shell is compiled with SHOPT_BASH and the shell
- is invoked as bash. The bash emulation is not complete.
-
-Include directory:
- 1. argnod.h contains the type definitions for command
- nodes, io nodes, argument nodes, and for positional
- parameters.a It defines the prototypes for
- all the positional parameters functions.
- 2. builtins.h contains prototypes for builtins as well
- as symbolic constants that refer to the name-pairs
- that are associated with some of the built-ins.
- It also contains prototypes for many of the strings.
- 3. defs.h is the catch all for all definitions that
- don't fit elsewhere and it includes several other
- headers. It defines a strucuture that contains ksh
- global data, sh, and a structure that contains per
- function data, sh.st.
- 4. edit.h contains definitions that are common to both
- vi and emacs edit modes.
- 5. env.h contains interfaces for creating and modifying
- environment variables.
- 6. fault.h contains prototypes for signal related
- functions and trap and fault handling.
- 7. fcin.h contains macro and function definitions for
- reading from a file or string.
- 8. history.h contains macros and functions definitions
- related to history file processing.
- 9. jobs.h contains the definitions relating to job
- processing and control.
- 10. lexstates.h contains the states associated with
- lexical processing.
- 11. name.h contains the internal definitions related
- to name-value pair processing.
- 12. national.h contains a few I18N definitions, mostly
- obsolete.
- 13. nval.h is the public interface to the name-value
- pair library that is documented with nval.3.
- 14. path.h contains the interface for pathname processing
- and pathname searching.
- 15. shell.h is the public interface for shell functions
- that are documented int shell.3.
- 16. shlex.h contains the lexical token definitions and
- interfaces for lexical analysis.
- 17. shnodes.h contains the definition of the structures
- for each of the parse nodes and flags for the attributes.
- 18. shtable.h contains some interfaces and functions for
- table lookup.
- 19. streval.h contains the interface to the arithmetic
- functions.
- 20. terminal.h is a header file that includes the appropriate
- terminal include.
- 21. test.h contains the definitions for the test and [[...]]
- commands.
- 22. timeout.h contains the define constant for the maximum
- shell timeout.
- 23. ulimit.h includes the appropriate resource header.
- 24. variables.h contains symbolic constants for the built-in
- shell variables.
-
-sh directory:
- 1. args.c contains functions for parsing shell options
- and for processing positional parameters.
- 2. arith.c contains callback functions for the streval.c
- library and the interface to shell arithmetic.
- 3. array.c contains the code for indexed and associative
- arrays.
- 4. bash.h contains code used when compiling with SHOPT_BASH
- to add bash specific features such as shopt.
- 5. defs.c contains the data definitions for global symbols.
- 6. deparse.c contains code to generate shell script from
- a parse tree.
- 7. env.c contains code to add and delete environment variables
- to an environment list.
- 8. expand.c contains code for file name expansion and
- file name generation.
- 9. fault.c contains code for signal processing, trap
- handling and termination.
- 10. fcin.c contains code for reading and writing a character
- at a time from a file or string.
- 11. init.c contains initialization code and callbacks
- for get and set functions for built-in variables.
- 12. io.o contains code for redirections and managing file
- descriptors and file streams.
- 13. jobs.c contains the code for job management.
- 14. lex.c contains the code for the lexical analyzer.
- 15. macro.c contains code for the $ macro expansions, including
- here-documents.
- 16. main.c contains the calls to initialization, profile
- processing and the main evaluation loop as well as
- mail processing.
- 17. name.c contains the name-value pair routines that are
- built on the hash library in libast.
- 18. nvdisc.c contains code related to name-value pair disciplines.
- 19. nvtree.c contains code for compound variables and for
- walking the namespace.
- 20. nvtype.c contains most of the code related to types that
- are created with typeset -T.
- 21. parse.c contains the code for the shell parser.
- 22. path.c contains the code for pathname lookup and
- some path functions. It also contains the code
- that executes commands and scripts.
- 23. pmain.c is just a calls sh_main() so that all of the
- rest of the shell can be in a shared library.
- 24. shcomp.c contains the main program to the shell
- compiler. This program parses a script and creates
- a file that the shell can read containing the parse tree.
- 25. streval.c is an C arithmetic evaluator.
- 26. string.c contains some string related functions.
- 27. subshell.c contains the code to save and restore
- environments so that subshells can run without creating
- a new process.
- 28. suid_exec.c contains the program from running execute
- only and/or setuid/setgid scripts.
- 29. tdump.c contains the code to dump a parse tree into
- a file.
- 30. timers.c contains code for multiple event timeouts.
- 31. trestore contians the code for restoring the parse
- tree from the file created by tdump.
- 32. userinit.c contains a dummy userinit() function.
- This is now obsolete with the new version of sh_main().
- 33. waitevent.c contains the sh_waitnotify function so
- that builtins can handle processing events when the
- shell is waiting for input or for process completion.
- 34. xec.c is the main shell executuion loop.
diff --git a/usr/src/lib/libshell/common/OBSOLETE b/usr/src/lib/libshell/common/OBSOLETE
deleted file mode 100644
index c29cb8bb63..0000000000
--- a/usr/src/lib/libshell/common/OBSOLETE
+++ /dev/null
@@ -1,152 +0,0 @@
-.sp 3
-.tl ''Ksh Features That Are Obsolete in Ksh93''
-.sp 2
-.AL 1
-.LI
-Using a pair of grave accents \^\fB\(ga\fR ... \fB\(ga\fR\^
-for command substition. Use \fB$(\fR ... \fB)\fR instead.
-.LI
-.B FCEDIT
-is an obsolete name for
-the default editor name for the
-.B hist
-command.
-.B FCEDIT
-is not used when
-.B HISTEDIT
-is set. Use
-.B HISTEDIT
-instead.
-.LI
-The newtest (\fB[[\fR ... \fB]]\fR) operator
-\fB\-a\fP \fIfile\fP
-is obsolete. Use
-\fB\-e\fP instead.
-.LI
-The newtest (\fB[[\fR ... \fB]]\fR) operator
-.BR = ,
-as used in
-\fIstring\fP \fB=\fP \fIpattern\fP
-is obsolete. Use
-\fB==\fP instead.
-.LI
-The following obsolete arithmetic comparisons are also permitted:
-.in +5
-.VL 20
-.LI "\fIexp1\fP \fB\-eq\fP \fIexp2\fP"
-True, if
-.I exp1
-is equal to
-.IR exp2 .
-.LI "\fIexp1\fP \fB\-ne\fP \fIexp2\fP"
-True, if
-.I exp1
-is not equal to
-.IR exp2 .
-.LI "\fIexp1\fP \fB\-lt\fP \fIexp2\fP"
-True, if
-.I exp1
-is less than
-.IR exp2 .
-.LI "\fIexp1\fP \fB\-gt\fP \fIexp2\fP"
-True, if
-.I exp1
-is greater than
-.IR exp2 .
-.LI "\fIexp1\fP \fB\-le\fP \fIexp2\fP"
-True, if
-.I exp1
-is less than or equal to
-.IR exp2 .
-.LI "\fIexp1\fP \fB\-ge\fP \fIexp2\fP"
-True, if
-.I exp1
-is greater than or equal to
-.IR exp2 .
-.LE \" End .VL
-.in -5
-.LI
-Using test -t or [ -t ] without specifying the file unit number.
-.LI
-The
-.B \-k
-option to the \fBset\fR builtin is obsolete. It causes
-.I all\^
-variable assignment arguments are placed in the environment,
-even if they occur after the command name.
-The following
-first prints
-.B "a=b c"
-and then
-.BR c :
-There is no alternative.
-.LI
-The obsolete
-.B \-xf
-option of the
-.B typeset
-command allows a function to be exported
-to scripts that are executed without a separate
-invocation of the shell.
-Functions that need to be defined across separate
-invocations of the shell should
-be placed in a directory and the
-.B FPATH
-variable should contains the name of this directory.
-They may also
-be specified in the
-.B ENV
-file with the
-.B \-xf
-option of
-.BR typeset .
-.LI
-The shell environment variable
-.B FCEDIT
-is obsolete. Use
-.B HISTEDIT
-instead.
-.LI
-In the
-.B \-s
-option
-(to \fBfc\fR or \fBhist\fR command???)
-(
-and in obsolete versions, the editor name
-.B \-
-)
-is used to skip the editing phase and
-to re-execute the command.
-.LI
-The
-.B \-t
-option to \fBalias\fR builtin is is obsolete. It
-is used to set and list tracked aliases.
-There is no replacement.
-.LI
-The shell command line option
-.B \-t
-is obsolete. This option cause the shell to exit after reading
-and executing one command. The is no replacement (although ending
-\&"command" with the exit builtin should have the same effect).
-.LI
-As an obsolete feature of the "set" builtin,
-if the first
-.I arg\^
-is
-.B \-
-then the
-.B \-x
-and
-.B \-v
-options are turned off and the next
-.I arg
-is treated as the first argument.
-Using
-.B \+
-rather than
-.B \-
-causes these options to be turned off.
-These options can also be used upon invocation of the shell.
-.LE
-
diff --git a/usr/src/lib/libshell/common/README b/usr/src/lib/libshell/common/README
deleted file mode 100644
index 1feeec8a90..0000000000
--- a/usr/src/lib/libshell/common/README
+++ /dev/null
@@ -1,232 +0,0 @@
-This directory, and its subdirectories contain the source code
-for ksh-93; the language described in the second addition of
-the book, "The KornShell Command and Programming Language," by
-Morris Bolsky and David Korn which is published by Prentice Hall.
-ksh-93 has been compiled and run on several machines with several
-operating systems. The end of this file contains a partial list of
-operating systems and machines that ksh-93 has been known to run on.
-
-The layout of files for ksh-93 has changed somewhat since ksh-88,
-the last major release. Most of the source code for ksh remains in
-the sh directory. However, the shell editing and history routines
-are in the edit sub-directory. The code for shell built-ins is
-in the bltins directory. The data directory contains read-only
-data tables and messages that are used by the shell. The include
-files remain in the include directory and the shlib directory
-is gone. The features directory replaces the older install
-directory. The method for generating systems specific feature
-information has changed substantially.
-
-The Makefile file contains several compilation options that can be set
-before compiling ksh. Options are of the form SHOPT_option and become
-#define inside the code. These options are set to their recommended
-value and some of these may disappear as options in future releases.
-A value of 0, or no value represents off, 1 represents on.
-Note that == is needed, not =, because these are nmake state variables
-and changing their value will cause all modules that could be affected
-by this change to be recompiled.
-The options have the following defaults and meanings:
- ACCT off Shell accounting.
- ACCTFILE off Enable per user accounting info.
- AUDIT off For auditing specific users
- AUDITFILE "/etc/ksh_audit"
- APPEND on Allows var+=val string and array append.
- BASH off Bash compatibility mode. It is not fully implemented
- and is experimental.
- BRACEPAT on C-shell type abc{d,e}f style file generation
- CMDLIB_BLTIN off Makes all commands in libcmd.a builtins. The
- SH_CMDLIB_DIR nmake state variable can be used to
- specify a directory.
- CMDLIB_DIR off Sets CMDLIB_BLTIN=1 and provides a default value
- of "/opt/ast/bin" for SH_CMDLIB_DIR.
- COMPOUND_ARRAY
- on Allows all components of compound variables except the
- first to be any string by enclosing in [...]. It also
- allows components other than the last to be arrays.
- This is experimental and only partially complete.
- CRNL off <cr><nl> treated as <nl> in shell grammar.
- DYNAMIC on Dynamic loading of builtins. (Requires dlopen() interface.)
- ECHOPRINT off Make echo equivalent to print.
- ESH on Compile with emacs command line editing. The original
- emacs line editor code was provided by Mike Veach at IH.
- FILESCAN on Experimental option that allows fast reading of files
- using while < file;do ...; done and allowing fields in
- each line to be accessed as positional parameters.
- FS_3D off For use with 3-D file system. Enabled automatically for
- sytems with dynamic linking.
- KIA off Allow generation of shell cross reference database with -I.
- MULTIBYTE on Multibyte character handling. Requires mblen() and
- mbctowc().
- NAMESPACE on Allows namespaces. This is experimental, incomplete
- and undocumented.
- OLDTERMIO off Use either termios or termio at runtime.
- OO on Experimental object oriented extension. This option
- should disappear soon.
- OPTIMIZE on Optimize loop invariants for with for and while loops.
- P_SUID off If set, all real uids, greater than or equal to this
- value will require the -p flag to run suid/sgid scripts.
- PFSH off Compile with support for profile shell.
- RAWONLY off Turn on if the vi line mode doesn't work right unless
- you do a set -o viraw.
- SEVENBIT off Strip the eigth bit from characters.
- SPAWN off Use spawn as combined fork/exec. May improve speed on
- some systems.
- STATS on Add .sh.stats compound variable.
- SUID_EXEC on Execute /etc/suid_exec for setuid, setgid script.
- TIMEOUT off Set this to the number of seconds for timing out and
- exiting the shell when you don't enter a command. If
- non-zero, TMOUT can not be set larger than this value.
- TYPEDEF on Enable typeset type definitions.
- VSH on Compile with vi command line editing. The original vi
- line editor code was provided by Pat Sullivan at CB.
-
-The following compile options are set automatically by the feature testing:
- DEVFD Set when /dev/fd is a directory that names open files.
- SHELLMAGIC
- Set on systems that recognize script beginning with #! specially.
- VPIX Set on systems the have /usr/bin/vpix program for running MS-DOS.
-
-
-In most instances, you will generate ksh from a higher level directory
-which also generates libcmd and libast libraries on which ksh depends.
-However, it is possible to generate ksh, with by running make -f ksh.mk
-in this directory. The ksh.mk file was generated from the nmake Makefile.
-If you do not have make or nmake, but do have a Version 7 UNIX compatible
-shell, then you can run the script mamexec < Mamfile to build ksh.
-If you have nmake, version 2.3 or later, you can use it without the -f ksh.mk.
-In either case, ksh relies on libraries libast and libcmd which must be
-built first. The binary for ksh becomes the file named ./ksh which can
-be copied to where ever you install it.
-
-If you use old make or the Mamfile, and you system has dynamic shared
-libraries, then you should define the variables mam_cc_static and
-mam_cc_dynanamic as the compiler options that request static linking
-and dynamic linking respectively. This will decrease the number of
-shared libraries that ksh need and cut startup time substantially.
-
-The makefile should also generate shcomp, a program that will precompile
-a script. ksh93 is able to recognize files in this format and process
-them as scripts. You can use shcomp to send out scripts when you
-don't want to give away the original script source.
-
-It is advisable that you put the line PWD=$HOME;export PWD into the
-/etc/profile file to reduce initialization time for ksh.
-
-To be able to run setuid/setgid shell scripts, or scripts without read
-permission, the SUID_EXEC compile option must be on, and ksh must be installed
-in the /bin directory, the /usr/bin directory, the /usr/lbin directory,
-or the /usr/local/bin directory and the name must end in sh. The program
-suid_exec must be installed in the /etc directory, must be owned by root,
-and must be a suid program. If you must install ksh in some other directory
-and want to be able to run setuid/setgid and execute only scripts, then
-you will have to change the source code file sh/suid_exec.c explicitly.
-If you do not have ksh in one of these secure locations, /bin/sh will
-be invoked with the -p options and will fail when you execute a setuid/setgid
-and/or execute only script. Note, that ksh does not read the .profile
-or $ENV file when it the real and effective user/group id's are not
-equal.
-
-The tests sub-directory contains a number of regression tests for ksh.
-To run all these tests with the shell you just built, go to the tests
-directory and run the command
- SHELL=$dir/ksh $dir/ksh shtests
-where dir is the directory of the ksh you want to test.
-
-The file PROMO.mm is an advertisement that extolls the virtues of ksh.
-The file sh.1 contains the troff (man) description of this Shell.
-The file nval.3 contains the troff (man) description of the name-value
-pair library that is needed for writing built-ins that need to
-access shell variables.
-
-The file sh.memo contains a draft troff (mm) memo describing ksh. The
-file RELEASE88 contains the changes made for ksh88. The file RELEASE93
-contains the changes made in this release since ksh-88. The file
-RELEASE contains bug fixes made in this release since ksh-88. The file
-COMPATIBILITY contains a list of incompatibilities with ksh-88. The
-file bltins.mm is a draft troff (mm) memo describing how to write
-built-in commands that can be loaded at run time.
-
-Most of the work for internationalization has been done with ksh93.
-The file ksh.msg is a generated file that contains error messages
-that need to be translated. In addition, the function translate()
-in sh/init.c has to be completed to interface with the dictionary
-lookup. The translate function takes two argument, the string
-that is to be translated and a type which is
- 0 when a library string needs translation.
- 1 when one of the error messages in ksh.msg needs translation.
- 2 when a string in a script needs translation. You use a $ in front
- of a double quoted string in a script to indicate that it
- needs translation. The -D option for ksh builds the dictionary.
-The translate routine needs to return the translated message.
-For dictionaries that need to use a numeric key, it should be
-possible to use the strhash() function to generate numbers to
-go along with each of the messages and to use this number both
-when generating the dictionary and when converting strings.
-If you encounter error messages of type 1 that are not be translated via
-this translate() function send mail to the address below.
-
-Please report any problems or suggestions to:
-
-dgk@research.att.com
-
-
-ksh93 has been compiled and alpha tested on the following. An asterisk
-signifies that ksh has been installed as /bin/sh on this machine.
-
-* Sun OS 4.1.[123] on sparc.
- Sun OS 4.1.1 on sun.
- Solaris 2.[1-9] on sparc.
- Solaris 2.[4-8] on X86.
- HP/UX 8 on HP-9000/730.
- HP/UX 9 on HP-9000/730.
- HP/UX 10 on HP-9000/857.
- HP/UX 11 on pa-risc.
- System V Release 3 on Counterpoint C19
- System V Release 4 on AT&T Intel 486.
- System V Release 4 on NCR 4850 Intel 486.
- IRIX Release 4.0.? System V on SGI-MIPS.
- IRIX Release 5.1 System V on SGI-MIPS.
- IRIX Release 6.[1-5] System V on SGI-MIPS.
- System V Release 3.2 on 3B2.
- UTS 5.2.6 on Amdahl 3090,5990,580.
- System V Release 3.2 on i386.
- SMP_DC.OSx olivetti dcosx MIServer-S 2/128.
- SMP_DC.OSx Pyramid dcosx MIServer-S 2/160 r3000.
- 4.3BSD on Vax 8650.
- AIX release 2 on RS6000.
- AIX 3.2 on RS6000.
- Linux 1.X on Intel
- Linux 2.X on Intel
- Linux 2.X on Alpha
- Linux 2.X on Alpha
- Linux 2.X on OS/390
- Linux 2.X on sparc
- Linux 2.4 on intel itanium 64
- Linux Slackware on sparc64
-* Linux ARM on i-PAQ
- OSF1 on DEC alpha.
- OSF4 on DEC alpha.
- UMIPS 4.52 on mips.
- BSD-i [2-4] on X86.
- OpenBSD on X86
- NetBSD on X86
- FreeBSD on X86
- NeXT on Intel X86.
- NeXT on HP.
-* Windows NT using UWIN on X86
-* Windows NT using UWIN on alpha
- Windows NT using Cygwin on X86
- Windows NT with NutCracker libraries.
- Windows NT with Portage libraries.
- Windows 3.1 using custom C library.
- OpenEdition on MVS
- Darwin OS X on PPC
- MVS on OS 390
- SCO Openserver 3.2 on X86
- Unixware 7 on X86
-
-Good luck!!
-
-David Korn
-dgk@research.att.com
-
diff --git a/usr/src/lib/libshell/common/RELEASE b/usr/src/lib/libshell/common/RELEASE
deleted file mode 100644
index b8fc92511a..0000000000
--- a/usr/src/lib/libshell/common/RELEASE
+++ /dev/null
@@ -1,2204 +0,0 @@
-10-03-05 --- Release ksh93t+ ---
-10-03-05 A varibale unset memory leak has been fixed and tests/leaks.sh
- has been added to verify the fix.
-10-03-04 Documentation, comment, and disgnostic spelling typos corrected.
-10-02-14 Fix sh_getenv() initialization to cooperate with the 3d fs.
-10-02-12 A bug in which the get discipline function was not invoked for
- associative array subscripts for unset array elements has been fixed.
-10-02-12 A bug which could occur if the last line of a script was an eval
- that executed multiple commands has been fixed.
-10-02-02 A buffer overflow in read and another in binary type base64
- encoding were fixed.
-10-01-20 A bug in the evaluation of arithmetic expression in which the
- subscript was evaluated twice for $((foo[x++]++)) has been fixed.
-10-01-19 A workaround for a double-free of a trap in both a subshell and its
- parent has been added.
-10-01-18 A bug in type handling of typeset -H has been fixed.
-10-01-15 The "adding empty subscript" warning now only emitted with -x set.
-10-01-01 A bug in the parser in which '$((case i in i):;esac);:))' was not
- parsed correctly was fixed.
-10-01-01 A bug in the parser in which '$(( 2 , 3.6 ))' dumped core for locales
- with radix char , and thousands separator . has been fixed.
-09-12-28 A bug in the handling of SIGCLD on systems that generated SIGCLD
- while blocked waiting for process to complete has been fixed.
-09-12-24 ast setlocale() reworked to differentiate env var changes from user
- override.
-09-12-18 A bug with the SHOPT_BGX option set which disabled traps for signals
- < SIGCHLD when a trap for a signal > SIGCHLD was set has been fixed.
-09-12-18 A bug where [[ -v var ]] was incorrect for some variables (including
- LC_* vars) has been fixed.
-09-12-15 A bug that produced a syntax error when a multibyte character
- straddled a buffer boundary has been fixed.
-09-12-11 A bug where the subscript of an unset variable was not evaluated has
- been fixed.
-09-12-09 A bug where shcomp dumped core on certain syntax errors has been fixed.
-09-12-07 A bug where a parent shell environment var reset in a subshell removed
- the value in subsequent children of the parent shell has been fixed.
-09-12-04 A bug in which in some cases a trap in a function executed in
- a subshell could trigger twice has been fixed.
-09-12-03 A bug in which SHLVL exported with some attributes could cause
- the shell to abort at startup has been fixed.
-09-12-02 A bug with pipefail in which the shell could hang waiting for the
- writer to complete before the last reader command has been fixed.
-09-11-30 A bug in which a trap could be inherited by the first element of
- a pipeline when the command had more than 63 arguments that did
- not contain any macro expansions has been fixed.
-09-11-19 When read from a terminal was called from with a while or foo loop,
- and an edit mode was on, a backspace or erase no longer will
- overwrite the prompt.
-09-11-17 Change .paths parse to handle BUILTIN_LIB=foo BUILTIN_LIB=foo-1.2.
-09-11-17 Inside a function, typeset foo.bar will bind foo to global variable
- foo if local variable foo does not exist, instead of creating a
- local variable.
-09-11-17 "read -n1" from the terminal has been fixed to read exactly one character.
-09-11-11 Job control now works for subshell commands, (...).
-09-11-11 If set -e is on for an interactive shell errors in special builtins
- now cause the shell to exit.
-09-11-11 A bug in which an interrupt handler processed during the read builtin
- when IFS did not contain a new line has been fixed.
-09-11-09 A bug in which a variable that has been unset in a subshell and then
- exported from that subshell does not show up in the environment
- has been fixed.
-09-11-02 ``,2'' is now a valid numeric constant for locales with
- decimal_point=','.
-09-11-02 A bug where "return" in .profile did not restore the shell state
- has been fixed.
-09-10-31 A bug that corrupted saved exit status when pids wrapped around has
- been fixed.
-09-10-26 A bug in { LANG LC_ALL LC_category } ordering has been fixed in -last.
-09-10-16 A bug where notification to libast that the environment has changed
- has been fixed.
-09-10-12 A bug in which a function loaded in a subshell could leave side
- effects in the parent shell has been fixed.
-09-10-12 A bug in converting a printf %d operand to a number when the operand
- contains multiple subscripts for the same variable has been fixed.
-09-10-09 A bug in the handling of the escape character \ in directory prefixes
- in command completion has been fixed.
-09-10-09 $PATH processing has been changed to delay dir stat() and .paths
- lookup until the directory is needed in the path search.
-09-09-28 Call the ast setlocale() intercept on unset too.
-09-09-24 A bug in which LANG=foo; LC_ALL=foo; unset LC_ALL; did not revert
- LC_CTYPE etc. to the LANG value has been fixed.
-09-09-17 A bug in which unsetting SVLVL could cause a script invoked by
- name without #! to core dump has been fixed.
-09-09-16 A bug in which a pipeline in a here-document could hang when the
- pipefail option was on has been fixed.
-09-09-09 A bug in the processing of line joining in here documents which
- occurred when a buffer began with <escape><new-line> has been fixed.
-09-09-09 A leading ; with commands in a brace group or parenthesis group
- no longer causes an error. It now is used for the "showme" option.
-09-09-09 A bug in which a subshell containing a background process could
- block until the background process completed has been fixed.
-09-09-04 A bug in handing ${var[sub]}, where var is a nameref has been fixed.
-09-09-03 A bug which caused an index array to have the wrong number of elements
- when it was converted from a compound variable by adding an another
- element has been fixed.
-09-09-03 Specifying export for a compound variable now generates an error.
-09-09-02 $"..." localizations strings are no longer recognized inside `...`.
-09-09-01 A bug in the for loop optimizer in the handling of type static
- variables has been fixed.
-09-09-01 An error message is not displayed when * and @ are used as subscripts.
-09-09-01 Several bugs in the processing for types that included an associative
- array of another type has been fixed.
-09-09-01 A bug in the tracing of [[ a < b ]] and [[ a > b ]] has been fixed.
-09-08-26 The .sh.file variable was not being set for a script that was run
- by name and didn't start with #! and this has been fixed.
-09-08-25 A bug in which a function called to deeply from command substitution
- did not display an error message has been fixed.
-09-08-24 When processing profiles, ksh93 now violates the POSIX standard and
- treats &> as a redirection operator similar to bash.
-09-08-23 A bug in the handling of the trap on SIGPIPE that could lead to a
- memory fault has been fixed.
-09-08-21 A bug in the handling of the comma operator in arithmetic expressions
- that could cause a core dump on some systems has been fixed.
-09-08-20 A bug in which a compound variable containing an array of a type
- that doesn't have any elements now expands correctly.
-09-08-19 A bug which disabled function tracing inside a function after
- a call to another function has been fixed.
-09-08-19 A bug in which initializing a compound variable instance to another
- compound variable by name has been fixed.
-09-08-18 A bug in which compound variable instances could be lost after
- an instance that invoked a type method discipline has been fixed.
-09-08-18 A bug in which a discipline function for a type applied to an
- array instance when invoked in a function ignored the subscript
- has been fixed.
-09-08-18 A scoping error with variables in arithmetic expression with
- type variables when reference with a name reference has been fixed.
-09-08-10 Several memory leaks were fixed primarily related to subshells.
-09-08-06 A bug in which setting the trap on CHLD to ignore could cause
- a script to hang has been fixed.
-09-07-08 A bug in the processing of name reference assignments when it
- contained pattern expansions with quoting has been fixed.
-09-06-22 The default width for typeset -X has been changed so that there
- should be no loss of precision when converting to a string.
-09-06-19 A bug in the printing of array elements for binary variables with
- printf %B has been fixed.
-09-06-19 A bug which caused a core dump with trap DEBUG set with an array
- assignment with no elements has been fixed.
-09-06-19 A bug with read with typeset -b -Z<num> has been fixed.
-09-06-19 Two bugs related to read -b for array variables has been fixed.
-09-06-19 A bug with typeset for compound variables containing arrays of
- compound variables has been fixed.
-09-06-18 A bug in appending a compound variable to a an indexed array of
- compound variables has been fixed.
-09-06-18 A bug which occurs when appending a compound variable to an indexed
- array element has been fixed.
-09-06-18 Setting VISUAL to a value other than one ending in vi or emacs will
- no longer unset the edit mode.
-09-06-17 A bug in typeset -m when moving a local compound variable to a
- global compound variable via a name reference has been fixed.
-09-06-17 A bug in appending to nodes of an array of compound variables when
- addressing them via nameref has been fixed.
-09-06-17 A bug in typeset -p var, when var is an array of compound variables
- in which the output only contained on array element has been fixed.
-09-06-17 The prefix expansion ${!y.@} now works when y is a name
- reference to an element of an array.
-09-06-16 Traps on signals that are ignored when the shell is invoked
- no longer display. Previously they were ignored as required but
- would be listed with trap -p.
-09-06-12 A bug in vi edit mode in which hitting the up arrow key at the
- end of a line longer than 40 characters which caused a core dump
- has been fixed.
-09-06-11 A bug in which "eval non-builtin &" would create two processes,
- one for the & and another for non-builtin has been fixed.
-09-06-08 When var is an identifier and is unset, ${var} no longer tries to
- run command substitution on the command var.
-09-06-08 Process substitution arguments of the form <(command) can now be
- used following the < redirection operator to redirect from command.
-09-05-13 A bug in which redirections of the form 2>&1 1>&5 inside command
- substitution could cause the command substitution to hang has been
- fixed.
-09-05-12 To conform with POSIX, the -u option only checks for unset variables
- and subscript elements rather than checking for all parameters.
-09-05-12 A bug which could cause a core dump when a variable whose name
- begins with a . was referenced as part of a name reference inside
- a function has been fixed.
-09-05-01 A bug that caused a core dump when SIGWINCH was received and
- both vi and emacs mode were off has been fixed.
-09-04-22 Default alias compound='typeset -C' added.
-09-04-15 A bug that caused ${...;} to hang for large files has been fixed.
-09-04-08 A change was made in the -n option which printed out an incorrect
- warning with <>.
-09-04-07 The emacs edit command M-_ and M_. and the vi command _ was fixed
- to handle the case there there is no history file.
-09-04-05 A bug in handling new-lines with read -n has been fixed.
-09-04-05 The ENV variable defaults the the file named by $HOME/.kshrc rather
- then to the string $HOME/.kshrc.
-09-03-31 A bug in which a nested command substitution with redirections could
- leave a file descriptor open has been fixed.
-09-03-24 ksh now only uses the value of the _ variable on startup if it can
- verify that it was set by the invoking process rather than being
- inherited by some other ancestor.
-09-03-24 When ksh is invoked without -p and ruid!=euid, and the shell is
- compiled without SHOPT_P_UID or ruid<SHOPT_P_UID, the shell now
- enables the -p option. The previous version instead set the
- euid to the ruid as it does for set +p.
-09-03-24 When SHOPT_P_UID is defined at compile time and the shell is started
- without -p and ruid!=euid and ruid>=SHOPT_P_UID then euid is set
- to ruid. A bug that did the wrong test (ruid<SHOPT_P_UID) was fixed.
-09-03-17 The sleep(1) builtin now accept and ISO 8601 PnYnMnDTnHnMnS
- duration or date(1) compatible date/time operand.
-09-03-10 If a variable that was left or right justified or zero-filled was
- changed with a typeset statement that was left or right justified
- or zero-filled, then the original justification no longer affects
- the result.
-09-03-10 A bug in the handling of traps when the last command in a script
- is a subshell grouping command has been fixed.
-09-03-03 A bug in which an expansion of the form ${!prefix@} could generate
- an exception after the return from a function has been fixed.
-09-02-02 A bug in restricted mode in which the value of ENV could be
- changed from within a function has been fixed.
-09-02-02 A bug in which an erroneous message indicating that a process
- terminated with a coredump has been fixed.
-09-02-02 The exit status when exit was called without an argument from
- a signal handler was incorrect and has been fixed.
-09-02-02 A bug in which a function autoloaded in a subshell could cause
- a core dump when the subshell completed has been fixed.
-09-02-02 A bug in which 2>&1 inside a command substitution wasn't working
- correctly has been fixed.
-09-02-02 A bug in the call stack of arithmetic function with 2 args
- returning int has been fixed.
-09-01-30 A bug in which 'eval print \$0' inside a function was giving the
- wrong value for $0 has been fixed.
-09-01-28 A bug in which a command substitution could return an exit status
- of 127 when the pipefail option is enabled has been fixed.
-09-01-26 ksh93 now generates an error message if you attempt to create
- a global name reference to a local variable.
-09-01-26 The [[ -v var ]] operator was modified to test for array elements.
-09-01-23 The redirection operator <>; was added. It is similar to <>
- except that if the command it is applied to succeeds, the file
- is truncated to the offset at the command completion.
-09-01-23 The default file descriptor for <> was changed to 1.
-09-01-20 A bug in which the exit status specified in an exit trap was
- not used when a process terminated with a signal has been fixed.
-09-01-19 A bug in which a signal whose default action is to terminate
- a process could be ignored when the process is running a sub-shell
- has been fixed.
-09-01-19 A bug in which sending SIGWINCH to a process that reads from a pipe
- could cause a memory fault has been fixed.
-09-01-16 The -R unary operator was added to [[...]] and test to check whether
- a variable is a name reference.
-09-01-16 The -v unary operator was added to [[...]] and test to check whether
- a variable is set.
-09-01-14 The unset built-in was modified to return 0 exit status when
- unsetting a variable that was unset to conform with the POSIX
- standard.
-09-01-14 The unset built-in was modified to continue to unset variables
- after encountering a variable that it could not unset to
- conform to the POSIX standard.
-09-01-14 The parameter expansion ${x+value} no longer expands the value of
- the variable x when determining whether x is set or not.
-09-01-13 A bug in which background jobs and pipelines that were not waited
- for could, in rare instances, cause the shell to go into an infinite
- loop or fail has been fixed.
-09-01-06 A bug in indexed arrays of compound variables in which referencing
- non-existent sub-variable in an arithmetic expression could cause
- the sub-variable to be created has been fixed.
-09-01-05 A bug in which the \ character did not escape extended regular
- expression pattern characters has been fixed.
-08-12-24 A bug in which killing the last element of a pipe did not cause
- a write to the pipe to generate a SIGPIPE has been fixed.
-08-12-19 A bug which could cause command substitution to hang when the
- last element of a pipeline in a command substitution was a built-in
- and the output was more that PIPE_BUFF.
-08-12-18 A bug which occurs when a here documented marker embedded in a
- command substitution occurs on a buffer boundary has been fixed.
-08-12-17 A bug in the output of typeset -p for variables that had attributes
- but did not have a value has been fixed.
-08-12-16 A bug in which a name reference to a name reference variable that
- references an array element has been fixed.
-08-12-16 A bug in which a variable given both the -A and -C attribute along
- with an initial assignment didn't work correctly has been fixed.
-08-12-10 The [[ -t fd ]] test was fixed to handle fd>9.
-08-12-10 A bug where function stack misalignment could cause a bus error
- has been fixed.
-08-12-09 Command completion was changed to use \ to quote special characters
- instead of quoting the argument in single quotes.
-08-12-07 A bug in typeset -m which occurred when the target node was an
- associative array element has been fixed.
-08-12-07 A timing bug on some systems (for example darwin), that could
- cause the last process of a pipeline entered interactively to fail
- with an "Exec format error" has been fixed.
-08-12-04 SHOPT_BGX enables background job extensions. Noted by "J" in
- the version string when enabled. (1) JOBMAX=n limits the number
- of concurrent & jobs to n; the n+1 & job will block until a
- running background job completes. (2) SIGCHLD traps are queued
- so that each completing background job gets its own trap; $! is
- set to the job pid and $? is set to the job exit status at the
- beginning of the trap. (3) sleep -s added to sleep until the time
- expires or until a signal is delivered.
-08-12-04 The sign of floating point zero is preserved across arithmetic
- function calls.
-08-12-04 A bug that caused print(1) to produce garbled stdout/stderr
- output has been fixed.
-08-12-04 A bug in which printf "%d\n" "'<euro>'" did not output the
- numerical value of the EURO symbol, 8354, has been fixed.
-08-11-24 /dev/fd* and /dev/std* redirections are first attempted with
- open() to preserve seek semantics; failing that the corresponding
- file descriptors are dup()'d.
-08-11-20 A bug which could cause a core dump if a function compiled with
- shcomp was found has been fixed.
-08-11-20 A bug in which jobs were not cleared from the jobs table for
- interactive shells when the pipefail option is on has been fixed.
-08-11-11 A bug in which a field that was unset in a type definition and later
- set for an instance could appear twice when displaying the variable
- has been fixed.
-08-11-11 A bug in which running a simple command & inside a function would
- not return the correct process id has been fixed.
-08=11-10 A bug in which the exit status of a command could be lost if the pid
- was that of the most recent command substitution that had completed
- has been fixed.
-08-11-10 The maximum depth for subshells has been increased from 256 to 65536.
-08-11-06 A bug which could cause a core dump when the _ reference variable was
- used as an embedded type with a compound assignment has been fixed.
-
-08-10-31 --- Release ksh93t ---
-08-10-31 Variable scoping/initialization bugs that could dump core were fixed.
-08-10-24 The lexer now accepts all RE characters for patterns prefixed
- with a ksh ~(...) option expression.
-08-10-24 For ${var/pat/sub} \0 in sub expands to the text matched by pat.
-08-10-18 A bug in array scoping that could dump core has been fixed.
-08-10-10 read -n and -N fixed to count characters in multibyte locales.
-08-10-10 A bug that mishandled _.array[] type references has been fixed.
-08-10-09 ${.sh.version} now contains a concatenation of the following (after
- 'Version') denoting compile time features:
- A SHOPT_AUDIT
- B SHOPT_BASH
- L SHOPT_ACCT
- M SHOPT_MULTIBYTE
-08-10-09 A bug that caused subshell command substitution with redirection
- to hang has been fixed.
-08-10-08 Output errors, other than to stderr, now result in a diagnostic.
-08-10-08 ksh93 now supports types that contain arrays of other types as
- members. Earlier versions core dumped in this case.
-08-10-05 A bug which caused the shell to emit a syntax error for an arithmetic
- statement of the form (( var.name[sub] = value)) has been fixed.
-08-10-01 A bug that caused subshell command substitution to hang has
- been fixed.
-08-09-29 When the -p export option of typeset is used with other options,
- only those variables matching the specified options are displayed.
-08-09-29 When the shell reads the environment and finds variables that are
- not valid shell assignments, it now passes these on to subsequent
- commands rather than deleting them.
-08-09-29 A bug in the display of compound variables containing an indexed
- array of compound variables has been fixed.
-08-09-29 A bug in the display of compound variables containing an associative
- array with a subscript containing a . in the name has been fixed.
-08-09-26 A core dump in the subshell environment restore has been fixed.
-08-09-24 $(...) has been fixed to properly set the exit status in $?.
-08-09-23 $(<...) with IFS=$'\n\n' has been fixed to retain all but the last
- of multiple trailing newlines.
-08-09-23 The -p option to typeset when used with other attributes, restricts
- the output to variables with the specified attributes.
-08-09-22 A bug that sometimes lost the exit status of a job has been fixed.
-08-09-21 A bug that retained trailing command substitution newlines in
- cases where the command caused the shell to fork has been fixed.
-08-09-19 type, whence -v, and command -v were fixed to comply with POSIX
- by writing 'not found' diagnostics to the standard error.
-08-09-18 test and [...] were fixed to comply with POSIX in the case
- of test '(' binop ')' where binop is a valid binary test operator.
-08-09-16 If a method discipline named create is specified when defining a
- type, this function will be called when an instance is created.
-08-09-15 The variable _ is now set as a reference to the compound variable
- when defining a compound variable or a type.
-08-09-10 The shell now prints an error message when the type name specified
- for an indexed array subscript is not an enumeration type.
-08-09-10 A bug in which a subshell that spawned a background process could
- loose output that was produced after the foreground completed
- has been fixed.
-08-09-10 A timing bug on some systems that could cause coprocesses started by a
- subshell to not clean up and prevent other coprocesses has been fixed.
-08-09-09 The typeset -m option is now able to rename array elements from
- the same array.
-08-09-09 The exit status of 2 from the DEBUG trap causes the next command
- to be skipped. An exit value of 255 from a DEBUG trap called from
- a function causes the function to return.
-08-09-08 A bug in which a coprocess created in a subshell that did not
- complete when the subshell terminated could prevent a coprocess
- from being created in the parent shell has been fixed.
-08-09-05 An assignment of the form name1=name2 where name1 and name2
- are both compound variables causes name1 to get a copy of name2.
- name1+=name2 causes name2 sub-variables to be appended to name1.
-08-09-05 A bug in which unsetting a compound variable did not unset all
- the sub-variables has been fixed.
-08-09-01 A bug in the subshell cleanup code that could cause SIGSEGV has
- been fixed.
-06-08-26 The SHLVL variable which is an environment variable used by bash
- and zsh that gets incremented when the shell starts.
-08-08-25 For an indexed array, a negative subscript now refers to offsets
- from the end so that -1 refers to the last element.
-08-08-24 An alignment error for shorts on 64 bit architectures has been fixed.
-08-08-22 If oldvar is a compound variable, typeset -C newvar=oldvar creates
- newvar as a copy of oldvar.
-08-08-19 The ALRM signal no longer cause the sleep builtin to terminate.
-08-08-13 When used in an arithmetic expression, the .sh.version variable
- now produces a number that will be increasing for each release.
-08-08-11 A bug in which type instantiation with a compound assignment in
- a dot script in which the type is defined has been fixed.
-08-08-07 The -m option has been added to typeset to move or rename a
- variable. Not documented yet.
-08-08-06 A bug in read when used in a loop when a prompt was specified
- when reading from a terminal has been fixed.
-08-08-01 A bug with the pipefail option in which a nested pipeline could
- cause an asynchronous command to block has been fixed.
-08-08-01 A for loop optimizer bug that treats .sh.lineno as an invariant
- has been fixed.
-08-07-30 A bug in which expanding compound variable that had a get discipline
- from with a here document could cause a syntax error has been fixed.
-08-07-18 A bug in which a nameref caused a local variable to be created
- rather than binding to an existing variable in the global scope
- has been fixed.
-08-07-17 A bug which occurred when a nameref was created from within a
- function that was part of a pipeline has been fixed.
-08-07-14 The compile option SHOPT_STATS was added. With this option the
- compound variable .sh.stats keeps usage statistics that could help
- with performance tuning.
-08-07-10 The output of set now always uses a single line for each variable.
- For array variables, the complete set of values is now displayed.
-08-07-09 The typeset -C option can be used with arrays to indicate that
- each element should default to a compound variable.
-08-07-08 The %B format now outputs compound variables and arrays. The
- alternate flag # can be used to cause output into a single line.
-08-07-03 When the window change signal, WINCH, is received, the current
- edit line is redrawn in place.
-08-07-01 A bug in the handling of shared variables when inside an embedded
- type has been fixed.
-08-06-29 A bug in multiline edit mode which occurred when the prompt length
- was three characters or less has been fixed.
-08-06-23 A bug in which the SIGCLD was not be triggered when background
- jobs completed has been fixed.
-08-06-23 KSH_VERSION added as a name reference to .sh.version.
-08-06-20 type now outputs 'special builtin' for special builtins.
-08-06-19 A couple of bugs in multi-dimensional arrays have been fixed.
-08-06-19 A bug in which a syntax error in a dot script could generated
- a syntax error in the next subsequent command has been fixed.
-08-06-17 Reduced the maximum function call depth to 2048 to avoid exceptions
- on some architectures.
-08-06-16 A bug in which printf "%B" could generate an exception when the
- specified variable was not set has been fixed.
-08-06-16 When typeset -p is followed by variable names, it now displays
- the attributes names and values for the specific names.
-08-06-14 A bug that could effect the drawing of the screen from multiline
- emacs or gmacs mode when walking up the history file has been fixed.
-08-06-13 A bug in which a compound variable defined in a subshell could
- have side effects into the parent shell has been fixed.
-08-06-13 A number of bugs related to using .sh.level to set the stack from
- for DEBUG traps have been fixed.
-08-06-13 The .sh.lineno variable has been added. When .sh.level is changed
- inside a DEBUG trap, the .sh.lineno contains the calling line number
- for the specified stack frame.
-08-06-13 The .sh.level variable has been documented and now works.
-08-06-11 The -C option has been added to read for reading compound command
- definitions from a file.
-08-06-11 The . command is now permitted inside a compound command definition.
- The dot script can contain declaration commands and dot commands.
-08-06-09 Add -C option to typeset so that typeset -C foo, is equivalent
- to foo=().
-08-06-09 Added -n warning message for typeset option orderings that are valid
- with ksh88 but not valid with ksh93, for example Lx5.
-08-06-09 A bug in which the return value for an assignment command containing
- a command substitution with that failed was zero when the assignment
- contained redirections has been fixed.
-08-06-09 A bug in the quoting of $ inside a ERE pattern ~(E)(pattern)
- has been fixed.
-08-06-06 A bug when processing `` command substitution with the character
- sequence \$' has been fixed.
-08-06-02 When defining a type, the typeset -r attribute causes this field
- to be required to be specified for each instance of the type and
- does not allow a default value.
-08-06-02 Several bugs in which compound variables were modified by
- subshells have been fixed.
-08-05-22 The ceil function has been added to the math functions.
-08-05-21 A bug in which a name reference defined in a function and passed
- as an argument to another function could cause an incorrect binding.
-08-05-21 A bug in freeing compound variables that are local to functions
- has been fixed.
-08-05-19 The array expansions ${array[sub1..sub2]} and ${!array[sub1..sub2]}
- to expand to the value (or subscripts) for array between sub1 and
- sub2 inclusive. For associative arrays, the range is based on
- location in the POSIX locale. The .. must be explicit and cannot
- result from an expansion.
-08-05-15 The trap on SIGCLD is no longer triggered by the completion of
- the foreground job as with ksh88.
-08-05-14 A bug in the implementation of the editing feature added on
- 07-09-19 in emacs mode has been fixed.
-08-05-12 A bug in processing the test built-in with parenthesis has been
- fixed.
-08-05-12 The unset built-in now returns non-zero when deleting an array
- subscript that is not set.
-08-05-08 Changing the value of HISTFILE or HISTSIZE will cause the old
- history file to be close and reopened with the new name or size.
-08-05-08 When FPATH is changed functions that were found via a path search
- will be searched for again.
-08-05-08 A parser bug in which reserved words and labels were recognized
- inside compound indexed array assignment after a new-line has
- been fixed.
-08-05-07 A bug in getopts when handling numerical option arguments has
- been fixed.
-08-05-07 The typeset -S option was added for variables outside type
- definitions to provide a storage class similar to C static
- inside a function defined with function name. When outside
- type definitions and outside a function, the -S option cause
- the specified variable so be unset before the assignment and
- before the remaining attributes are supplied.
-08-05-07 A bug that affected the cursor movement in multiline mode when
- a character was deleted from near the beginning of the any
- line other than the first.
-08-05-01 In multiline edit mode, the refresh operation will now clear
- the remaining portion of the last line.
-08-05-01 A bug in computing prompt widths for the edit modes for prompts
- with multibyte characters has been fixed.
-08-05-01 A bug in the multiline edit mode which could cause the current
- line to be displayed incorrectly when moving backwards from third
- or higher line to the previous line has been fixed.
-08-05-01 A bug in which options set in functions declared with the function
- name syntax were carried across into functions invoked by these
- functions has been fixed.
-08-04-30 A bug which could cause a coprocess to hang when the read end
- is a builtin command has been fixed.
-08-04-30 The emacs and vi editors have been modified to handle window
- change commands as soon as they happen rather than waiting for
- the next command.
-08-04-28 A bug in which ${!x} did not expand to x when x was unset has been
- fixed.
-08-04-27 A bug in which the assignment x=(typeset -a foo=([0]=abc)) created
- x.foo as an associative array has been fixed.
-08-04-25 A bug in which $# did not report correctly when there were more
- than 32K positional parameters has been fixed.
-08-04-04 Choose the name _ as the sub-variable that holds type or instance
- specific data used by discipline functions.
-08-03-27 A bug in which the terminal group was not given back to the parent
- shell when the last part of a pipeline was handled by the parent shell
- and the other parts of the pipeline complete has been fixed.
- The symptom was that the pipeline became uninterruptable.
-08-03-25 A bug in restricted mode introduced in ksh93s that caused scripts
- that did not use #! to executed in restricted mode has been fixed.
-08-03-25 A bug in which the pipefail option did not work for a pipeline
- within a pipeline has been fixed.
-08-03-24 A bug in which OPTIND was not set correctly in subshells has
- been fixed.
-08-03-24 A bug which could cause a memory exception when a compound variable
- containing an indexed array with only element 0 defined was expanded.
-08-03-20 A bug in which ${!var[sub].*} was treated as an error has been fixed.
-08-03-20 Associative array assignments of the form ([name]=value ...)
- now allow ; as well as space tab and new line to separate elements.
-08-03-18 A buffering problem in which standard error was sometimes
- not flushed before sleep has been fixed.
-08-03-17 A bug in which a signal sent to $$ while in a subshell would be
- sent to the subshell rather than the parent has been fixed.
-08-03-17 --default option added to set(1) to handle set +o POSIX semantics.
- set --state added as a long name alias for set +o.
-08-03-14 A bug in which using monitor mode from within a script could
- cause the terminal group to change has been fixed.
-08-03-10 The new ${...} command substitution will treat the trailing }
- as a reserved word even if it is not at the beginning of a command,
- for example, ${ date }.
-08-03-10 If the name of the ENV begins with /./ or ././ then the
- /etc/ksh.kshrc file will not be executed on systems that support
- this interactive initialization file.
-08-03-07 A bug in which ksh -i did not run the ENV file has been fixed.
-08-03-07 A bug in which ulimit did not always produce the same output as
- ulimit -fS has been fixed.
-08-03-04 A bug in multiline mode in emacs and vi mode which could cause the
- cursor to be on the wrong line when interrupt was hit has been fixed.
-08-03-03 The change made in ksh93s+ on 07-06-18 in which braces became
- optional for ${a[i]} inside [[...]] was restored in the case
- where the argument can be a pattern.
-08-03-03 A bug in which creating a name reference to an associative array
- instance would fail when the subscript contained characters [ or
- ] has been fixed.
-08-02-29 The redirection operator >; has been added which for non-special
- files, generates the output in a temporary file and writes the
- specified file only of the command has completed successfully.
-08-02-15 A bug in ${var/pattern/string} for patterns of the form ?(*) and +(*)
- has bee fixed.
-08-02-07 A bug in which test \( ! -e \) produced an error has been fixed.
-08-02-14 The typeset -a option can now optionally be followed by the name
- of an enumeration type which allows subscripts to be enumerations.
-08-02-14 The enum builtin which creates enumeration types has been added.
-08-02-12 The backoff logic when there are no more processes has been fixed.
-08-02-07 The -X option has been added to typeset. The -X option creates
- a double precision number that gets displayed using the C99 %a
- format. It can be used along with -l for long double.
-08-01-31 The -T option to typeset has been added for creating typed
- variables. Also the -h and -S options have been added to
- typeset that are only applicable when defining a type.
-08-01-31 The prefix expansion operator @ has been added. ${@name}
- expands to the type of name or yields the attributes.
-07-11-15 A bug in the macro expander for multibyte characters in which
- part of the character contains a file pattern byte has been fixed.
-07-10-03 A bug in which : was not allowed as part of an alias name has been
- fixed.
-07-09-26 A bug in which appending a compound variable to a compound variable
- or to an index array didn't work has been fixed.
-07-09-19 In both emacs and vi edit mode, the escape sequence \E[A (usually
- cursor up, when the cursor is at the end of the line will fetch
- the most recent line starting with the current line.
-07-09-18 The value of ${!var} was correct when var was a reference to an
- array instance.
-07-09-18 The value of ${!var[sub]} was not expanding to var[sub] and this
- was fixed. It also fixed ${name} where name is a name reference
- to var[sub].
-07-09-18 It is now legal to create a name reference without an initialization.
- It will be bound to a variable on the first assignment.
-07-08-30 A discipline function can be invoked as ${x.foo} and is equivalent
- to ${ x.foo;} and can be invoked as x.foo inside ((...)).
-07-07-09 A bug in which typeset -a did not list indexed arrays has been
- fixed.
-07-07-03 The command substitution ${ command;} has been added. It behaves
- like $(command) except that command is executed in the current
- shell environment. The ${ must be followed by a blank or an
- operator.
-
-08-04-17 --- Release ksh93s+ ---
-08-04-17 A bug in which umask was not being restored correctly after a
- subshell has been fixed.
-08-04-15 A bug in which sending a STOP signal to a job control shell started
- from within a shell function caused cause the invoking shell to
- terminate has been fixed.
-08-04-11 A bug which caused $(exec > /dev/null) to go into an infinite loop
- has been fixed.
-08-03-27 A bug in which typeset -LZ was being treated as -RZ has been fixed.
-08-03-06 A bug with ksh -P on systems that support the the profile shell,
- in which it would exit after running a non-builtin has been fixed.
-08-01-31 A bug in which command substitution inside ((...)) could cause
- syntax errors or lead to core dumps has been fixed.
-08-01-17 A bug in which discipline functions could be deleted when invoked
- from a subshell has been fixed.
-08-01-17 A bug in which a command substitution consisting only of
- assignments was treated as a noop has been fixed.
-08-01-17 A bug in which discipline functions invoked from withing a
- compound assignment could fail has been fixed.
-08-01-16 Incomplete arithmetic assignments, for example ((x += )), now
- generate an error message.
-08-01-16 A bug in which a set discipline defined for a variable before
- an array assignment could cause a core dump has been fixed.
-08-01-03 A bug in on some systems in which exit status 0 is incorrectly
- returned by a process that catches the SIGCONT signal is stopped
- and then continued.
-07-12-13 A race condition in which a program that has been stopped and then
- continued could loose the exit status has been fixed.
-07-12-12 Code to check for file system out of space write errors for all
- writes has been added.
-07-12-11 A bug in the macro expander for multibyte characters in which
- part of the character contains a file pattern byte has been fixed.
-07-12-06 A bug in the emacs edit mode when multiline was set that output
- a backspace before the newline to the screen has been fixed.
-07-12-04 A bug in which using <n>TAB after a variable name listing expansion
- in the edit modes would cause the $ to disappear has been fixed.
-07-11-28 A bug in which setting IFS to readonly could cause a subsequent
- command substitution to fail has been fixed.
-07-11-27 A work around for a gcc 4.* C99 "feature" that could cause a job
- control shell to go into an infinite loop by adding the volatile
- attribute to some auto vars in functions that call setjmp().
-07-11-27 A bug in which the shell could read ahead on a pipe causing the
- standard input to be incorrectly positioned has been fixed.
-07-11-27 A bug in which compound variable UTF-8 multibyte values were not
- expanded or traced properly has been fixed.
-07-11-21 A bug where an unbalanced '[' in a command argument was not treated
- properly has been fixed.
-07-11-15 A bug in which compatibility mode (no long option names) getopts(1)
- incorrectly set the value of OPTARG for flag options has been fixed.
-07-11-15 A bug in which "hash -- name" treated "--" as an invalid name operand
- has been fixed.
-07-11-15 typeset now handles "-t -- [-r] [--]" for s5r4 hash(1) compatibility.
-07-11-15 A bug in which the umask builtin mis-handled symbolic mode operands
- has been fixed.
-07-11-15 Bugs in which shell arithmetic and the printf builtin mis-handled the
- signs of { -NaN -Inf -0.0 } have been fixed.
-07-11-15 The full { SIGRTMIN SIGRTMIN+1 ... SIGRTMAX-1 SIGRTMAX } range
- of signals, determined at runtime, are now supported.
-07-11-15 A bug in which creating an index array with only subscript 0 created
- only a simple variable has been fixed.
-07-11-14 A bug in which appending to an indexed array using the form
- name+=([sub]=value) could cause the array to become an associative
- array has been fixed.
-07-11-14 A bug in which typeset without arguments could coredump if a
- variable is declared as in indexed array and has no elements has
- been fixed.
-07-11-14 A bug in which creating a local SECONDS variable with typeset in
- a function could corrupt memory has been fixed.
-07-11-14 A bug which could cause a core dump when a script invoked by name
- from a function used compound variables has been fixed.
-07-11-05 A bug in which printf %d "'AB" did not diagnose unconverted characters
- has been fixed.
-07-11-05 printf %g "'A" support added for all floating point formats.
-07-11-01 A bug in which typeset -f fun did not display the function definition
- when invoked in a subshell has been fixed.
-07-10-29 The sleep builtin was fixed so that all floating point constants
- are valid operands.
-07-10-10 A bug in which the locale was not being restored after
- LANG=value command has been fixed.
-07-09-20 A bug in which a nameref to a compound variable that was local
- to the calling function would not expand correctly when displaying
- is value has been fixed.
-07-09-19 A bug which cause cause a core dump if .sh.edchar returned
- 80 characters or more from a keyboard trap has been fixed.
-07-09-14 A bug in which could cause a core dump when more than 8 file
- descriptors were in use has been fixed.
-07-09-10 A bug in which creating a name reference to an instance of
- an array when the array name is itself a reference has been fixed.
-07-09-10 The file completion code has been modified so that after an = in
- any word, each : will be considered a path delimiter.
-07-09-06 A bug in which subprocess cleanup could corrupt the malloc() heap
- has been fixed.
-07-08-26 A bug in which a name reference to an associative array instance
- could cause the subscript to be evaluated as an arithmetic expression
- has been fixed.
-07-08-22 A bug in which the value of an array instance was of a compound
- variable was not expanded correctly has been fixed.
-07-08-14 A bug which could cause a core dump when a compound assignment was
- made to a compound variable element with a typeset -a attribute
- has been fixed.
-07-08-08 A bug in which a trap ignored in a subshell caused it to be
- ignored by the parent has been fixed.
-07-08-07 A bug in which the set command would generated erroneous output
- for a variable with the -RZ attribute if the variable name had been
- passed to a function has been fixed.
-07-08-02 A bug in which read x[1] could core dump has been fixed.
-07-08-02 A second bug in which after read x[sub] into an associative array
- of an element that hasn't been assigned could lead to a core dump
- has been fixed.
-07-07-31 A bug in which a pipeline that completed correctly could have
- an exit status of 127 when pipefail was enabled has been fixed.
-07-07-09 The SHOPT_AUDIT compile option has been added for keyboard logging.
-07-06-25 In vi insert mode, ksh no longer emits a backspace character
- before the carriage return when the newline is entered.
-07-06-25 A bug in which pipefail would cause a command to return 0
- when the pipeline was the last command and the failure happened
- on a component other than the last has been fixed.
-07-06-25 A bug in the expansion of ${var/pattern/rep} when pattern or rep
- contained a left parenthesis in single quotes has been fixed.
-07-06-18 The braces for a subscripted variable with ${var[sub]} are now
- optional when inside [[...]], ((...)) or as a subscript.
-07-05-28 A bug in brace expansion in which single and double quotes did
- not treat the comma as a literal character has been fixed.
-07-05-24 The -p option of whence now disables -v.
-07-05-23 Several bug fixes in compound variables and arrays of arrays
- have been made.
-07-05-15 A bug in which the %B format of printf was affected by the
- locale has been fixed.
-07-05-14 A bug in which \ was not removed in the replacement pattern with
- ${var/pattern/rep} when it was not followed by \ or a digit has
- been fixed.
-07-05-10 A bug in which ksh -R file core dumped if no script was specified
- has been fixed. it not displays an error message.
-07-05-07 Added additional Solaris signals to signal table.
-07-04-30 A bug in which a pipeline with command substitution inside a
- function could cause a pipeline that invokes this function to
- hang when the pipefail option is on has been fixed.
-07-04-30 Added -q to whence.
-07-04-18 A small memory leak with each redirection of a non-builtin has
- been fixed.
-07-03-08 A bug in which set +o output command line options has been fixed.
-07-03-08 A bug in which an error in read (for example, an invalid variable
- name), could leave the terminal in raw mode has been fixed.
-07-03-06 A bug in which read could core dump when specified with an array
- variable with a subscript that is an arithmetic expression has
- been fixed.
-07-03-06 Several serious bugs with the restricted shell were reported and
- fixed.
-07-03-02 If a job is stopped, and subsequently restarted with a CONT
- signal and exits normally, ksh93 was incorrectly exiting with
- the exit status of the stop signal number.
-07-02-26 M-^L added to emacs mode to clear the screen.
-07-02-26 A bug in which setting a variable readonly in a subshell would
- cause an unset error when the subshell completed has been fixed.
-07-02-19 The format with printf uses the new = flag to center the output.
-07-02-19 A bug in which ksh93 did not allow multibyte characters in
- identifier names has been fixed.
-07-02-19 A bug introduced in ksh93 that causes global compound variable
- definitions inside functions to exit with "no parent" has been fixed.
-07-02-19 A bug in which using compound commands in process redirection
- arguments would give syntax errors <(...) and >(...) has been fixed.
-07-01-29 A bug which caused the shell to core dump which can occur when a
- built-in exits without closing files that it opens has been fixed.
-07-01-26 A bug in which ~(E) in patterns containing \ that are not inside ()
- has been fixed.
-
-06-12-29 --- Release ksh93s ---
-06-12-29 A bug in which the value of IFS could be changed after a command
- substitution has been fixed.
-06-12-22 /dev/(tcp|udp|sctp)/HOST/SEVRICE now handles IPv6 addresses on
- systems that provide getaddrinfo(3).
-06-12-19 A -v option was added to read. With this option the value of
- the first variable name argument will become the default value
- when read from a terminal device.
-06-11-20 A bug in which "${foo[@]:1}}" expands a null argument (instead of
- no argument), when foo[0] is not empty has been fixed.
-06-11-16 The discipline functions have been modified to allow each subscript
- to act independently. Currently the discipline function will not
- be called when called from a discipline function of the same variable.
-06-11-14 A bug which could cause a core dump if a file descriptor for
- an internal file was closed from with a subshell has been fixed.
-06-10-30 The redirections <# pattern, and <## pattern have been added.
- Both seek forward to the beginning of the next line that contains
- the pattern. The <## form copies the skipped portion to standard
- output.
-06-10-26 On systems that support stream control transport, the virtual file
- name /dev/sctp/host/port can now be used to establish connections.
-06-10-26 The printf modifier # when used with d produces units in thousands
- with a single letter suffix added. The modifier # when used with
- the i specification provides units of 1024 with a two letter suffix.
-06-10-24 The value of $! is now set to the process id of a job put
- into the background with the bg command as required by POSIX.
-06-10-23 A bug in which the value of $! was affected by a background
- job started from a subshell has been fixed.
-06-10-23 A bug in ${var:offset:len} in multibyte locales has been fixed.
-06-10-15 The remaining math functions from C99 were added for any system
- that supports them.
-06-10-13 The klockwork.com software detected a few coding errors that
- have been fixed.
-06-10-12 A bug when skipping over `...` with ${x:=`...`} when x is set
- has been fixed.
-06-10-11 A bug in process floating constants produced by the %a format
- of printf has been fixed.
-06-10-06 A bug in which IFS was not being restored correctly in some
- cases after a subshell has been fixed.
-06-10-06 A bug in which pipefail was not detecting some failures in
- pipelines with 3 or more states has been fixed.
-06-10-03 A bug in the processing of >(...) with builtins which could
- cause the builtin to hang has been fixed.
-06-10-03 A bug in the for loop optimizer which causes >(...) process
- substitution to be ignored has been fixed.
-06-09-17 The -a option was added to typeset for indexed arrays. This
- is only needed when using the ([subscript]=value ...) form.
-06-09-06 The showme option was added. Each simple command not beginning
- with a redirection and not occurring with in the while, until, if,
- select condition can be preceded by a semi-colon which will
- be ignored when showme is off. When showme is on, any command
- preceded by a colon will be traced but not executed.
-06-08-16 As a new feature, a leading ~(N) on a pattern has no effect
- except when used for file expansion. In this case if not
- matches are found, the pattern is replaced by nothing rather
- than itself.
-06-08-11 A bug in the expansion of ${.sh.match[i]:${#.shmatch[i]}} has
- been fixed.
-06-08-10 The read builtin options -n and -N have been modified to treat
- the size as characters rather than bytes unless storing into a
- binary (typeset -B) variable.
-06-07-27 When the here document operator << is followed directly by a #
- rather than a -, the first line of the here-document determines
- how much whitespace is removed for each line.
-06-07-26 A bug in the C-shell history (enabled with set -H) in which the
- history event !$ was not processed has been fixed.
-06-07-21 A bug on some systems in which assigning PATH on a command line
- would not take effect has been fixed.
-06-07-20 Add ksh93 and rksh93 as allowable names for ksh binaries.
-06-07-20 Removed the SHOPT_OO compilation option which was only partially
- implemented.
-06-07-20 The ability to use egrep, grep, and fgrep expressions within
- shell patterns has been documented.
-06-07-17 A bug with arithmetic command expressions for locales in which
- the comma is a thousands separator has been fixed.
-06-07-13 The default HISTSIZE was increased from 128 to 512.
-06-07-13 A multibyte problem with locales that use shift codes has been fixed.
-06-06-23 A number of bug fixes for command, file, and variable completion
- have been mode.
-06-06-20 Floating point division by zero now yields the constant Inf or -Inf
- and floating functions with invalid arguments yield NaN.
-06-06-20 The floating point constants Inf and NaN can be used in arithmetic
- expressions.
-06-06-20 The functions isinf(), isnan(), tanhl() have been added for
- arithmetic expressions.
-06-06-13 Internal change to use ordering for variables instead of hashing
- to speed up prefix matching.
-06-06-13 A window between fork/exec in which a signal could get lost
- and cause a program to hang has been eliminated
-06-06-13 A bug in edit completion with quoted strings has been fixed.
-06-06-07 The restricted options can now be enabled by set as well as on
- the command line. Once set, it can not be disabled.
-06-06-04 Modified built-in binding so that for systems for which /bin
- and /usr/bin are the same, a builtin bound to /bin will get
- selected when either /bin or /usr/bin is scanned.
-06-06-04 Added literal-next character processing for emacs/gmacs mode.
- This change is not compatible with earlier versions of ksh93
- and ksh88 when the stty lnext is control-v. The sequence
- escape-control-v will display the shell version.
-06-05-31 Modified emacs and vi mode so that entering a TAB after a partial
- TAB completion, generates a listing of possible completions.
- After the second TAB, a number followed by a TAB will perform
- the completion with the corresponding item.
-06-05-19 Modified arithmetic so that conversions to strings default to
- the maximum number of precision digits.
-06-05-16 Bug fixes for multibyte locales.
-06-05-10 The =~ operator was added to [[...]] and [[ string ~= ERE ]]
- is equivalent to [[ string == ~(E)ERE ]].
-06-04-25 A bug in the vi edit mode which could cause the shell to core dump
- when switching from emacs mode.
-06-04-17 A bug in which using LANG or LC_ in assignment lists with builtins
- did not restore the localed correctly has been fixed.
-06-04-04 A bug in which discipline functions could not be added to variables
- whose names started with .sh has been fixed.
-06-03-28 The -s option to typeset was added to modify -i to indicate short
- integers.
-06-03-28 A bug in which variables assignment lists before functions
- defined with function name were not passed on the functions
- invoked by this function has been fixed.
-06-03-28 A bug in which name references defined within a function defined
- with function name could not be used with compound variables has
- been fixed.
-06-03-27 A bug in which read <&p (print >&p) would cause the coprocess input
- (output) pipe to close before reading from (after writing to)
- it has been fixed.
-06-02-28 A bug in which stopping a job created with the hist builtin command
- would create a job that could not be restarted has been fixed.
-
-06-01-24 --- Release ksh93r ---
-06-01-24 A bug in which running commands with standard output closed would
- not work as expected has been fixed.
-06-01-23 A bug in which print -u<n> could fail when file descriptor <n> was
- open for writing has been fixed.
-06-01-19 The ?: arithmetic operator fixed to work when the operation after
- the colon was an assignment.
-05-12-24 A bug which could lead to a core dump when elements of a compound
- variable were array elements, i.e. foo=(bar=(1 2)), has been fixed.
-05-12-13 An arithmetic bug in which x+=y+=z was not working has been fixed.
-05-12-13 An arithmetic bug in which x||y was returning x when x was non-zero
- rather than 1 has been fixed.
-05-12-07 The aliases for integer and float have been changed to use attributes
- -li and -lE to handle long long and long double types.
-05-12-07 The histexpand (-H) option has been added which allows C-shell
- style history expansions using the history character !.
-05-12-07 The multiline option was added which changes that way the edit
- modes handle lines longer than the window width. Instead of
- horizontal scrolling, multiple lines on the screen are used.
-05-12-05 The whence builtin now returns an absolute pathname when the
- command is found in the current directory.
-05-11-29 A bug which caused ksh -c '[[ ! ((' to core dump rather than
- report a syntax error has been fixed.
-05-11-29 A bug when reading fixed length records into typeset -b variables
- which caused a zero byte to terminate the value has been fixed.
-05-11-22 The ability to seek to an offset within a file has been added
- with the new I/O redirection operators, <# and >#. Currently,
- these redirection operators must be followed by ((expr))
- but in a future release, it should be able to used to seek forward
- to the specified shell pattern. In addition $(n<#) expands to the
- current byte offset for file descriptor n.
-05-11-22 The .sh.match array variable is now set after each [[ ... ]]
- pattern match. Previously it was only set for substring matches.
-05-10-17 A bug in which the library path variable could be prefixed
- with a directory when a .path file was not encountered in
- the directory of the executable has been fixed.
-05-09-15 A for/while loop optimizer bug in which $OPTIND was not
- correctly expanded has been fixed.
-05-09-05 A bug in which a history command that invoked a history
- command could go into an infinite loop has been fixed.
-05-08-31 In the case that IFS contains to adjacent new-lines so that
- new-line is not treated as a space delimiter, only a single
- new-line is deleted at the end of a command substitution.
-05-08-19 When a tilde substitution expands to the / directory and is
- followed by a /, it is replaced by the empty string.
-05-08-16 A bug in which n<&m did not synchronize m has been fixed.
-05-08-16 A bug in which process substitution ( <() and >() ) was not
- working within for and while loops has been fixed.
-05-07-24 A bug in which the pattern ~(E)(foo|bar) was treated as a syntax
- error has been fixed.
-05-07-24 A bug in completion with <n>=, where n was the one of the
- previous selection choices has been fixed.
-05-07-21 A bug with multibyte input when no edit mode was specified which
- caused the input line to shift left/right has been fixed.
-05-06-24 A race condition which could cause the exit status to get lost
- on some fast systems has been fixed.
-05-06-21 A bug in which nested patterns of the form {m,n}(pat) would cause
- syntax errors has been fixed.
-05-06-21 A bug in the macro expander has been fixed which could cause a
- syntax error for an expansion of the form ${x-$(...)} when
- x is set and the command substitution contained certain strings.
-05-06-08 On systems for which echo does not do System V style \ expansions,
- the -e option was added to enable these expansion.
-05-06-08 A bug in which ${var op pattern} to not work when inside an
- arithmetic expression has been fixed.
-05-05-23 An extension to shell patterns that allows matching of nested
- groups while skipping over quoted strings has been added.
-05-05-18 A bug in which the line number for errors was not correct for
- functions loaded from FPATH has been fixed.
-05-04-18 A bug in which the exit status $? is not set when a trap triggered
- by the [[...]] command is executed has been fixed.
-05-04-08 Redirection operators can be directly preceded with {varname}
- with no intervening space, where varname is a variable name which
- allows the shell to select a file descriptor > 10 and store it
- into varname.
-05-04-08 SHOPT_CMDLIB_BLTIN=1 now includes <cmdlist.h> generated table.
-05-04-07 [[ -o ?option ]] is true if "option" is a supported option.
-05-04-05 A bug in handling file completion with spaces in the names
- has been fixed.
-05-03-25 The SIGWINCH signal is caught by default to keeps the LINES and
- COLUMNS variables in sync with the actual window size.
-05-03-25 Building ksh with SHOPT_REMOTE=1 causes ksh to set --rc if stdin is
- a socket (presumably part of a remote shell invocation.)
-05-03-25 Building ksh with SHOPT_SYSRC=1 causes interactive ksh to source
- /etc/ksh.kshrc (if it exists) before sourcing the $ENV file.
-05-03-25 {first..last[..incr][%fmt]} sequences added to brace expansions
- when braceexpand is enabled.
-05-03-03 A bug where a SIGCHLD interrupt could cause a fifo open to fail has
- been fixed.
-05-02-25 A bug in which a builtin command run in the background could
- keep a file descriptor open which could cause a foreground
- process to hang has been fixed.
-05-02-24 A bug where builtin library commands (e.g., date and TZ) failed to
- detect environment variable changes has been fixed.
-05-02-22 The read builtin and word splitting are now consistent with respect
- to IFS -- both treat IFS as field delimiters.
-05-02-22 The read builtin no longer strips off trailing delimiters that
- are not space characters when there are fewer variables than fields.
-05-02-17 A builtin bug on systems where dlsym(libcmd) returns link-time
- bindings has been fixed.
-05-02-12 A bug in which the lib_init() function for .paths BUILTIN_LIB
- libraries was not called has been fixed.
-05-02-06 A bug on some systems in which moving the write end of a co-process
- to a numbered file descriptor could cause it to close has been fixed.
-05-02-06 A bug in the vi-edit mode in which the character under the cursor
- was not deleted in some cases with the d% directive has been fixed.
-05-02-06 A bug where external builtin stdout/stderr redirection corrupted
- stdout has been fixed.
-05-02-04 A bug where times formatting assumed CLK_TCK==60 has been fixed.
-
-05-01-11 --- Release ksh93q ---
-05-01-11 A bug in the integral divide by zero check has been fixed.
-05-01-11 The -l option has been added to read /etc/profile and
- $HOME/.profile, if they exist, before the first command.
-05-01-11 An argument parsing bug that caused `kill -s x -- n' to fail has
- been fixed.
-05-01-11 The .paths file, introduced in ksh93m, which can appear in
- any directory in PATH, now allows a line of the form 'BUILTIN_LIB=.'
- When a command is searched for this directory, and the full path
- matches the path of the built-in version of the command (listed
- by the 'builtin' command) then the built-in version of the command
- is used. When ksh is built with SHOPT_CMDLIB_DIR=1 then all libcmd
- functions become builtins with the '/opt/ast/bin/' directory prefix.
-05-01-10 A bug in which a nameref to a compound name caused a core dump has
- been fixed.
-05-01-09 A bug in which some SIGCHLD interrupts (from child processes exiting)
- caused a fatal print/echo error diagnostic has been fixed.
-04-12-24 A bug in which some SIGCHLD interrupts (from child processes exiting)
- corrupted the internal process/job list, sometimes causing the shell
- to hang, has been fixed.
-04-12-01 A bug in which typeset -Fn truncated less than n digits for large
- numbers has been fixed.
-04-11-25 A bug in which standard error could be closed after a redirection
- to /dev/stderr has been fixed.
-04-11-17 A bug in which an expansion of the form ${array[@]:3} could expand
- to ${array[0]} when ${array[3]} was not set has been fixed.
-04-10-22 The -E or -orc command line option reads ${ENV-$HOME/.kshrc} file.
-04-10-22 `-o foo' equivalent to `+o nofoo', `-o nobar' equivalent to `+o bar'.
- `--foo' equivalent to `-o foo', `--nofoo' equivalent to `+o foo'
-04-10-05 The .paths file, introduced in ksh93m, which can appear in
- any directory in PATH, now allows a line of the form
- 'BUILTIN_LIB=libname'. When a command is searched for this directory,
- the shared library named by libname will first be searched for a
- built-in version of the command.
-04-09-03 <<< here documents now handle quotes in the word token correctly.
-04-08-08 The maximum size for read -n and and read -N was increased from
- 4095 to 32M.
-04-08-04 printf %q was modified so that if an no operand was supplied, no
- no output would be generated rather than a quoted empty string.
-04-08-01 The -n and -N options of the read builtin has been modified
- when reading variables with the binary attribute so that the
- data is stored directly rather than through assignment.
-04-08-01 The shcomp command has been modified to process alias commands
- under some conditions.
-04-07-31 The .sh.match variable added in ksh93l, now works like other
- indexed arrays.
-04-07-08 A loop optimizer bug which occurs when typeset is used in
- a for or while loop inside a function has been fixed.
-04-06-24 The number of subexpressions in a pattern was increased to 64
- from the current number of 20.
-04-06-17 The -t option to read was modified to allow seconds to be
- specified as any arithmetic expression rather than just
- an integral number of seconds, for example even -t 'sin(.5)'
- is now valid.
-04-06-16 Two small memory leak problems were fixed.
-04-06-15 A bug in ${var/pattern/"string"} which occurred when string
- contained pattern matching characters has been fixed.
-04-05-08 printf $'%d\n' produced an erroneous error message and has
- been fixed.
-04-05-24 A bug in which an associative array without any elements could
- cause a core dump when a script with an associative array with
- the same name was declared in a script invoked by name has
- been fixed.
-04-05-11 A bug in which an exec statement could close the script that
- is being processed in a script that is run by name causing
- a failure has been fixed.
-04-04-28 If the first character of assignment to an integer variable was 0,
- the variable had been treated as unsigned. This behavior was
- undocumented and has been removed.
-04-04-05 A bug in which the positioning of standard input could be incorrect
- after reading from standard input from a subshell has been fixed.
-04-03-30 A bug in the for loop optimizer which in rare cases could cause
- memory corruption has been fixed.
-04-03-29 The preset alias source='command .' has been added.
-04-03-29 A bug introduced in ksh93p on some systems in which invoked by
- name with #! on the first line would not get the signals handling
- initialized correctly has been fixed.
-04-03-29 A bug introduced in ksh93p in which a HUP signal received by
- a shell that is a session group leader was not passed down to
- its children has been fixed.
-
-04-02-28 --- Release ksh93p ---
-04-02-28 The ability to apply an append discipline to any variable has
- been added.
-04-02-14 A bug in which the exportall option (set -a) would cause incorrect
- results for arrays has been fixed.
-04-02-02 A bug in which an exported array would pass more than
- the first element to a script invoked by name has been fixed.
-04-02-02 A bug on some systems in which name=value pairs preceding a script
- invoked by name was not getting passed to the script has been fixed.
-04-01-20 A bug in which an unset discipline function could cause a core
- dump on some systems has been fixed.
-04-01-12 A bug in which a continue or break called outside a loop from
- inside a function defined with name() syntax could affect
- the invoking function has been fixed.
-04-01-08 If a command name begins with ~, only filename completion will be
- attempted rather than pathname completion using the builtin editors.
-04-01-08 A bug in the vi edit mode in which the wrong repeat count on
- multiple word replacements with the . directive has been fixed.
-04-01-06 Backspace characters are now handled correctly in prompt strings.
-04-01-06 The getopts builtin has been modified to accept numerical
- arguments of size long long on systems that support this.
-04-01-06 A bug in which unsetting all elements of an associative array
- would cause it to be treated as an indexed array has been fixed.
-03-12-15 A bug in which a quoted string ending with an unescaped $ would
- delete the ending $ in certain cases has been fixed.
-03-12-05 A bug in which the shell could hang when set -x tracing a command
- when an invalid multibyte character is encountered has been fixed.
-03-12-05 On some systems, if the KEYBD trap is set, then commands that use
- the meta key were not processed until return was hit. This
- has been fixed.
-03-12-05 A problem which occurred when the login shell was not a group
- leader that could cause it to fail has been fixed.
-03-12-05 A problem in which a shell could core dump after receiving a signal
- that should cause it to terminate while it was in the process
- of acquiring more space has been fixed.
-03-12-05 If ENV is not specified, the shell will default to $HOME/.kshrc
- for interactive shells.
-03-11-21 A bug introduced in ksh93o in which the DEBUG trap could get
- disabled after it triggered has been fixed.
-03-11-04 A bug in which using arithmetic prefix operators ++ or -- on a
- non-lvalue could cause a core dump has been fixed.
-03-11-04 A bug in which leading zeros were stripped from variable
- expansions within arithmetic computation to avoid being treated
- as octal constants when they should not have, has been fixed.
-03-10-08 A bug introduced in ksh93o in which a large here document inside
- a function definition could get corrupted has been fixed.
-03-09-22 A bug in which the .get discipline function was not being
- called when a string variable was implicitly referenced from
- within a numerical expression has been fixed.
-03-09-22 A bug in which a script without a leading #! could get executed
- by /bin/sh rather than the current shell on some systems has
- been fixed.
-03-09-12 To improve conformance with ksh88, leading zeros will be ignored
- when getting the numerical value of a string variable so that
- they will not be treated as octal constants.
-03-09-03 The builtin kill command now processes obsolete invocations
- such as kill -1 -pid.
-03-09-02 The restriction on modifying FPATH in a restricted shell (sh -r)
- has been documented.
-03-09-02 The restricted shell (sh -r) has been modified to disallow
- executing command -p.
-03-08-07 A bug in which the KEYBD trap was not being invoked when
- characters with the 8th bit set has been fixed.
-03-08-02 A parser bug introduced in ksh93o which caused the character
- after () in a Posix function definition to be skipped
- when reading from standard input has been fixed.
-03-08-01 A bug in which "${foo#pattern}(x)" treated (x) as if it were
- part of the pattern has been fixed.
-03-08-01 The command -x option has been modified so that any trailing
- arguments that do expand to a single word will be included
- on each invocation, so that commands like command -x mv * dir
- work as expected.
-
-03-07-20 --- Release ksh93o+ ---
-03-07-20 A bug in which could cause memory corruption when a posix
- function invoked another one has been fixed.
-03-07-15 A bug in which a file descriptor>2 could be closed before
- executing a script has been fixed.
-03-07-15 A parsing error for <() and >() process substitutions inside
- command substitution has been fixed.
-03-07-15 A parsing error for patterns of the form {...}(...) when
- used inside ${...} has been fixed.
-03-07-15 An error in which expanding an indexed array inside a compound
- variable could cause a core dump has been fixed.
-03-07-15 A bug in which on rare occasions a job completion interrupt
- could cause to core dump has been fixed.
-03-06-26 A bug in which process substitution embedded within command
- substitution would generate a syntax error has been fixed.
-03-96-23 A bug in which ${@:offset:len} could core dump when there
- were no arguments has been fixed.
-03-96-23 A bug in which ${X[@]:offset:len} could core dump when X
- was unset has been fixed.
-03-06-22 The -x option was added to the command builtin. If this
- option is on, and the number of arguments would exceed ARG_MAX,
- the command will be invoked multiple times with a subset of
- the arguments. For example, with alias grep='command -x grep,
- any number of arguments can be specified.
-03-06-14 A bug in which could cause a core dump on some systems with
- vi and emacs editors with the MULTIBYTE option has been fixed.
-03-06-06 A bug in which the shell could core dump when a script was
- run from its directory, and the script name a symlink to a file
- beginning with .., has been fixed.
-03-06-05 A bug in which the shell could core dump when a child process
- that it is unaware of terminates while it is calling malloc()
- has been fixed.
-03-06-02 An option named globstar (set -G) has been added. When enabled,
- during pathname expansion, any component that consists only of ** is
- matches all files and any number of directory levels.
-03-05-30 A bug in which the PATH search could give incorrect results when
- run from directory foo and PATH contained .:foo:xxx has been fixed.
-03-05-29 Some changes were made to the code that displays the prompt in edit
- mode to better handle escape sequences in the prompt.
-03-05-27 I added = to the list of characters that mark the beginning of
- a word for edit completion so that filenames in assignments
- can be completed.
-03-05-20 A bug in which read -N could hang on some systems when reading
- from a terminal or a pipe has been fixed.
-03-05-19 A bug in which the output of uname from a command substitution
- would go to the standard output of the invoking command when
- uname was invoked with a non-standard option has been fixed.
-03-05-19 A job control bug which would cause the shell to exit because
- it hadn't take back the terminal has been fixed. The bug
- could occur when running a function that contained a pipeline
- whose last element was a function.
-03-05-19 A job control timing bug introduced in ksh93o on some systems
- which could cause a pipeline to hang if the first component
- completed quickly has been fixed.
-03-05-13 The read builtin has been modified so that the builtin editors
- will not overwrite output from a previous incomplete line.
-03-05-13 A bug in which the name of an identifier could have the string
- .sh. prefixed to it after expanding a variable whose name begins
- with .sh. has been fixed.
-03-05-13 A bug in the expansion of $var for compound variables in which
- some elements would not be output when the name was a prefix
- of another name in the compound variable has been fixed.
-03-05-08 The last item in the ksh93o release on 03-01-02 has been
- altered slightly to preserve the leading 0's when the
- preceding character is a digit. Thus, with typeset -LZ3 x=10,
- $(( 1$x)) will be 1010 whereas $(( $x) will be 10.
-03-04-25 A bug in which if x is a name reference, then nameref y=x.foo
- did not follow x has been fixed.
-
-03-03-18 --- Release ksh93o ---
-03-03-18 A -N unary operator was added to test and [[...]] which returns
- true if the file exists and the file has been modified since it
- was last read.
-03-03-18 The TIMEFORMAT variable was added to control the format for
- the time compound command. The formatting description is
- described in the man page.
-03-03-06 A -N n option was added to read which causes exactly n bytes
- to be read unlike -n n which causes at most n bytes to be read.
-03-03-03 Three new shell variables were added. The variable .sh.file
- stores the full pathname of the file that the current command
- was found in. The variable .sh.fun names the current function
- that is running. The variable .sh.subshell contains the depth
- of the current subshell or command substitution.
-03-03-03 When the DEBUG trap is executed, the current command line after
- expansions is placed in the variable .sh.command. The trap
- is also now triggered before each iteration of a for, select,
- and case command and before each assignment and redirection.
-03-02-28 Function definitions are no longer stored in the history file so
- that set -o nolog no longer has any meaning.
-03-02-28 All function definitions can be displayed with typeset -f not
- just those stored in the history file. In addition, typeset +f
- displays the function name followed by a comment containing the
- line number and the path name for the file that defined this function.
-03-02-28 A bug in which the value of $LINENO was not correct when executing
- command contained inside mult-line command substitutions has been
- fixed.
-03-02-19 Since some existing ksh88 scripts use the undocumented and
- unintended ability to insert a : in front of the % and # parameter
- expansion operators, ksh93 was modified to accept :% as equivalent
- to % and :# as equivalent to # with ${name op word}.
-03-02-14 A bug which could cause a core dump when reading from standard
- error when standard error was a pty has been fixed.
-03-02-14 The shell arithmetic was modified to use long double on systems
- that provide this data type.
-03-02-09 A bug in which a function located in the first directory in FPATH
- would not be found when the last component of PATH was . and the
- current directory was one of the directories in PATH has been fixed.
-03-02-07 The trap and kill builtin commands now accept a leading SIG prefix
- on the signal names as documented.
-03-02-05 A bug in the expansion of ${var/$pattern}, when pattern contained
- \[ has been fixed.
-03-02-05 A bug in which .sh.match[n], n>0, was not being set for substring
- matches with % and %% has been fixed.
-03-01-15 A bug in which getopts did not work for numerical arguments specified
- as n#var in the getopts string has been fixed.
-03-01-09 A bug in which using ${.sh.match} multiple times could lead to
- a memory exception has been fixed.
-03-01-06 A bug in the expansion of ${var/pattern/$string} in the case that
- $string contains \digit has been fixed.
-03-01-02 A -P option was added for systems such as Solaris 8 that support
- profile shell.
-03-01-02 For backward compatibility with ksh88, arithmetic expansion
- with ((...)) and let has been modified so that if x is a zero-filled
- variable, $x will not be treated as an octal constant.
-
-02-12-05 --- Release ksh93n+ ---
-02-11-30 A bug that can show up in evaluating arithmetic statements that
- are in an autoloaded function when the function is autoload from
- another function has been fixed.
-02-11-30 An optimization bug in which an expansion of the form ${!name.@},
- which occurred inside a for or a while loop, when name is a name
- reference, has been fixed.
-02-11-18 A bug in which modifying array variables in a subshell could leave
- side effects in the parent shell environment has been fixed.
-02-11-18 A memory leak when unsetting an associative array has been fixed.
-02-11-14 The code to display compound objects was rewritten to make
- it easier for runtime extensions to reuse this code.
-02-11-14 A change was made to allow runtime builtins to be notified when
- a signal is received so that cleanup can be performed.
-02-10-31 User applications can now trap the ALRM signal. Previously,
- the ALRM signal was used internally and could not be used
- by applications.
-02-10-31 A bug in which signals received while reading from a coprocess
- for which traps were set was not handled correctly has been fixed.
-02-10-31 A bug in which a file opened with exec inside a subshell could
- be closed before the subshell completed has been fixed.
-02-10-21 A bug in which setting PATH or FPATH inside a function might not
- take effect has been fixed.
-02-10-21 A bug which could cause a core dump when a local SECONDS variable
- is defined in a function has been fixed.
-02-10-15 A bug in which the associate array name operator ${!array[@]}
- could return the same name multiple times has been fixed.
-02-10-15 A bug in which the zero'th element of an associative array was
- not getting set when an assignment was made without a subscript
- specified has been fixed.
-
-02-09-30 --- Release ksh93n ---
-02-09-30 The maximum indexed array size was increased to 16Megs.
-02-09-30 A bug which could cause a core dump when changing attributes
- of associative array has been fixed.
-02-09-30 A bug in which exporting an array variable would not export the
- 0-th element has been fixed.
-02-09-30 A bug in which an array assignment of the form a=($a ...) would unset
- 'a' before the right hand side was evaluated has been fixed.
-02-09-27 A bug in which the error message for ${var?message} when var was
- null or unset did not contain the variable name var has been fixed.
-02-09-27 A bug in which closing file descriptors 0 through 2 could
- cause a subsequent here document to fail has been fixed.
-02-09-14 A bug in whence which occurs when the specified name contained
- a / has been fixed.
-02-09-14 A bug in the parser for strings of the form name$((expr))=value
- has been fixed.
-02-09-14 A for loop optimization bug in which the number of elements in
- an array was treated as an invariant has been fixed.
-02-09-09 A bug in which redirection or closing of a file descriptor between
- 3 and 9 could cause a subsequent here document to fail has been
- fixed.
-02-09-09 A bug in which a background job was not removed from the job list
- when a subshell completed has been fixed, for example (prog&).
-02-09-03 A bug in which an assignment of the form name=(integer x=3)
- could be interpretted as an array assignment rather than a
- compound variable assignment has been fixed.
-02-08-19 A command completion bug which occurred on file systems that
- are case insensitive has been fixed.
-02-08-19 A bug which could lead to an exception on some systems (for
- example FREEBSD) which occurred when setting PATH has been fixed.
-02-08-11 A bug in arithmetic rounding in which a value input as a decimal
- string would output as a rounded version of the string has
- been fixed.
-02-08-11 A bug in which the last character could be deleted from shell
- traces and from whence when called from a multibyte locale
- has been fixed.
-02-08-01 A bug which could cause a core dump to occur when a shell script
- is executed while a coprocess is running that has closed the
- output pipe has been fixed.
-02-08-01 A bug in which command completion in multibyte mode could
- corrupt memory for long command lines has been fixed.
-
-02-06-17 --- Release ksh93n- ---
-02-06-17 A bug in which user defined macros could cause a core dump in
- with MULTIBYTE mode has been fixed.
-02-06-17 A bug in which printf format specifiers of the form %2$s were causing
- a core dump has been fixed.
-02-06-17 A bug in which setting stty to noecho mode did not prevent the
- echoing of characters by ksh when emacs or viraw mode
- was enabled has been fixed.
-02-06-17 A bug in which background job completion could cause the sleep
- builtin to terminate prematurely has been fixed.
-02-06-17 A bug in which the shell could core dump if getopts was called
- when the OPTIND variable contained a negative value has been fixed.
-02-06-10 The edit mode prompt has been modified to handle escape sequences.
-02-06-10 A bug which occurred for interactive shells in which the builtin
- cat command was used in command substitution on a file whose
- size was larger than PIPE_BUF has been fixed.
-02-06-10 A bug in which the trap on ERR was not being processed when
- set inside a function has been fixed.
-02-06-07 A bug in which function definitions could cause the history count
- to be decremented by one (and even become negative) has been fixed.
-02-06-05 A bug in read in which share mode could be enabled has been fixed.
-02-05-28 A bug which could occur when the last command of a script was
- a case statement and the action selected ended in ;& instead of ;;
- has been fixed.
-02-05-23 A bug with unary + introduced in ksh93k has been fixed.
-02-05-07 A bug in substitutions of the form ${var/pattern/string} in which
- a backslash was inserted in the replacement string when it contained
- a special pattern character has been fixed.
-02-05-01 A bug in the emacs edit mode which occurred in versions compiled
- for multibyte character sets which occurred when a repeated search
- was requested after a long line had been returned for the previous
- search has been fixed.
-02-04-02 vi and emacs edit modes were modified so that tab completion is
- disabled when invoked from the read built-in.
-
-02-03-26 --- Release ksh93m+ ---
-02-03-26 A bug in which \ was not handled correctly when used in file
- expansion has been fixed.
-02-02-18 A bug in which lines beginning with a # were deleted from here
- documents when the here-document delimiter was followed by
- a comment has been fixed.
-02-12-06 An optimization bug in which ${!x[@]) was treated as invariant in
- a for loop has been fixed.
-02-02-06 A bug in which the ERR trap is not cleared for a script invoked
- by name from within a function has been fixed.
-02-01-08 A bug in which a shell script executed from within a subshell
- could cause this script to have an invalid pointer leading
- to a memory fault has been fixed.
-02-01-07 Added here documents of the form <<< word (as per zsh) which
- is equivalent to << delim\nword\ndelim.
-02-01-07 A bug in which the first word of a compound assignment,
- x=(word ...), was treated as a reserved word has been fixed.
-02-01-07 A bug in the handling of \ when noglob was enabled and a
- substitution of the form ${word op pattern} occurred in the
- same word has been fixed.
-02-01-07 A compilation option, CMDLIB_BLTIN in the file OPTION, has
- been added. When this options is set, all commands implemented
- in libcmd become shell builtin commands by default.
-02-01-07 A bug in which builtin foo, where foo is already a builtin
- would result in the builtin foo getting removed has been fixed.
-02-01-07 A bug which the shell executed a command found in the current
- directory when PATH have no valid directories has been fixed.
-01-11-28 The value of $? was not being set when called with exit.
-01-11-28 If the last command was of the form (...) and a trap on EXIT or
- ERR was set, and the command inside () modified the trap, then
- the original trap wasn't executed.
-01-11-26 The value for 0 is now preceded by the base number when
- the base was not 10.
-01-11-26 The default has compilation mode has been changes so that
- viraw mode will always be on.
-
-01-10-31 --- Release ksh93m ---
-01-10-31 A for loop optimizer bug for subshells contained withing for
- loops has been fixed.
-01-10-16 typeset without arguments no longer outputs variable names
- that do not have any attributes that are set.
-01-10-16 A bug introduced in ksh93l in which assignments specified with
- the exec built-in were not being expanded properly has been
- fixed.
-01-10-11 An optimization bug in which ${!x) was treated as invariant in
- a for loop has been fixed.
-01-10-11 Unsigned integer variables in bases other than 10 are printed now
- expand in that base with the base prefix.
-01-10-10 A number of typos in the self generating man pages for shell
- built-ins have been fixed.
-01-10-04 The self generated man pages for hist and fc were not working
- correctly and have been fixed.
-01-10-03 Yet another optimizer bug in which shell patterns were
- treated as invariants has been fixed.
-01-09-27 Two bugs relating to multibyte history searches and to find
- have been fixed.
-01-09-27 A bug introduced in ksh93k in which the PATH searching was
- not restored after running a command with an assignment list
- has been fixed.
-01-09-26 A bug in which a zero filled field was treated as octal when
- converted to integer has been fixed.
-01-09-26 Yet another bug in the optimization of for loops related to
- recursive functions with break or continue statements has been fixed.
-01-09-25 The exponentiation operator ** was added to the shell arithmetic
- evaluation. It has higher precedence than * and is left
- associative.
-01-09-25 The code was modified to use the ast multibyte macros
- and functions for handing multibyte locales.
-01-09-25 The expansion ${parameter:offset:length} now handles negative
- offsets which cause offsets to be measured from the end.
-01-09-25 Some spelling errors in the documentation were corrected.
-01-09-24 The /dev/tcp/host/port and /dev/udp/host/port now allow
- the ports to be specified by service name.
-01-09-24 The change staring with ksh93g in which the the appropriate
- library path variable is prepended with a corresponding library
- directory has been modified. With the new method, only the
- library path defined in the file named .paths in the directory
- where the executable is found will be modified. See the
- man page for more details.
-01-09-23 The .fpath file (see ksh93h) is no longer looked for in each
- directory on the path to locate function directories. The
- file named .paths is used instead.
-01-09-23 A bug in which IFS was not being restored after being changed in
- a subshell has been fixed.
-01-09-16 With the vi and emacs edit modes, after a list of command
- or functions is generated with = or M-= respectively,
- any element from the list can be pasted on the command line
- by preceding the = or M-= with a numeric parameter specifying
- the position on the list.
-01-09-16 A bug in ksh93l caused command completion not to find aliases
- and functions. Command listing from the edit mode was presented
- in reverse order. This has been fixed.
-01-09-13 Another bug in the optimization of for loops related to subshells
- when traps were set has been fixed.
-01-09-07 A change in ksh93l caused brace expansion to stop working
- and this has been fixed.
-01-09-04 A bug introduced in ksh93k in which an arithmetic statement
- within a function that used name references did not follow the
- reference has been fixed.
-01-09-04 A bug introduced in ksh93l in which export -p did not prefix
- each export with the word export has been fixed.
-01-08-29 A bug in multibyte input which occurred when a partial multibyte
- character was received has been fixed.
-01-08-29 A bug introduced in ksh93l which could cause a core dump
- when an assignment list containing PATH is specified inside
- command substitution has been fixed.
-01-08-09 Another bug in the optimization of for loops in ksh93l caused
- errors in recursive functions using local variables that
- contained for loops has been fixed.
-01-07-27 A bug in which IFS would be unset after a command substitution
- inside a here document has been fixed.
-01-07-26 To conform to the POSIX standard, if you invoked ksh name,
- and name does not contain a /, it will first try to run
- one in the current directory whether it is executable or not
- before doing a path search for an executable script. Earlier
- versions first checked for an executable script using the
- PATH variable.
-01-07-23 A bug in which unset -f invoked in a subshell could unset a
- function defined in the parent has been fixed.
-01-07-16 A bug in the optimization of for loops in ksh93l caused
- name references to be treated as invariants has been fixed.
-01-07-09 A bug in which a discipline function applied to a local variable
- could cause a shell exception has been fixed. Discipline
- functions can only be specified for global variables.
-
-01-06-18 --- Release ksh93l ---
-01-06-18 A bug in assigning integers larger than can be represented as
- long integers to floating point variables has been fixed.
-01-06-18 A bug in the handling of unsigned integers (typeset -ui) has
- been fixed.
-01-06-04 The evaluation of the PS1 prompt no longer effects the value
- of the $? variable.
-01-06-01 A small memory leak from subshells has been fixed.
-01-05-22 A bug in which attributes for variables that did not have
- values would be lost after a subshell has been fixed.
-01-05-22 The %R format has been added to convert a shell pattern into
- an extended regular expression.
-01-05-22 The escape sequences \e, \cX, \C[.collating-element.], and
- \x{hex} have been added to ASCII-C strings and to printf format
- strings.
-01-05-20 Patterns of the form {n}(pattern) and {m,n}(pattern) are now
- recognized. The first form matches exactly n of pattern whereas,
- the second form matches from m to n instances of pattern.
-01-05-20 The shell allows *-(pattern), +-(pattern), ?-(pattern),
- {m,n}-(pattern}, and @-(pattern) to cause the minimal
- match of pattern to be selected whenever possible rather
- than the maximal (greedy) match.
-01-05-20 The character class [:word:] has been added to patterns.
- The word class is the union of [:alnum:] and the character _.
-01-05-20 Inside (...) pattern groups, the \ character is now treated
- specially even when in an enclosing character class. The
- sequences, \w, \d, \s are equivalent to the character classes
- word, digit, and space respectively. The sequences \W, \D,
- and \S are their complement sets.
-01-05-20 The shell now recognizes pattern groups of the form
- ~(options:pattern) where options or :pattern can be omitted.
- Options use the letters + and - to enable and disable options
- respectively. The option letters g (greedy), i (ignore case)
- are used to cause maximal matching and to cause case
- insensitive matching respectively. If :pattern is also
- specified, these options are only in effect while this
- pattern is being processed. Otherwise, these options remain
- in effect until the end of the pattern group that they are contained
- in or until another ~(...) is encountered. These pattern groups
- are not counted with respect to group numbering.
-01-05-14 When edit completion, expansion, or listing occurs in the
- middle of a quoted string, the leading quote is ignored when
- performing the completion, expansion, or listing.
-01-05-14 A small memory leak from subshells has been fixed.
-01-05-10 A bug in which open files were not restored after a subshell
- that had used exec to replace a file has been fixed.
-01-05-10 Redirection to a null file name now generates an error message.
-01-05-09 The shell now rejects some invalid parameter substitutions that
- were previously processed in undefined ways.
-01-05-09 A bug in which the output of select was not flushed before the
- read when input did not come from the terminal has been fixed.
-01-05-08 A bug in which job ids would not be freed for interactive shells
- when subshells ran built-ins in the background has been fixed.
-01-05-08 The FPATH variable now requires an explicit . to cause the
- current directory to be treated as a function directory.
-01-05-08 A bug in read -n when echo mode was disabled has been fixed.
-01-05-07 A bug in which function definitions could be listed as part
- of the history has been fixed.
-01-04-30 This release uses a new and often much faster pattern matcher than
- earlier releases.
-01-04-30 An optimizer now eliminates invariant parameter expansions from
- for while and until loops.
-01-04-30 The variable .sh.match is set after each pattern match (# % or /)
- in a variable substitution. The variable .sh.match is an
- indexed array with element 0 being the complete match.
- The array is only valid until the next subsequent pattern
- match or until the value of the variable changes which ever
- comes first.
-01-04-30 A self generating man page has been added to shcomp. Also,
- shcomp now stops compiling when it finds an exit or exec
- command and copies the remainder so that it can be used
- for standard input.
-01-04-30 The shcomp command was modified so that it can work in an
- EBCIDIC environment and that binary scripts are portable
- across environments.
-01-04-30 A bug in the handling of a trailing : in PATH has been fixed.
-01-04-30 A bug in which the builtin version of a command would get invoked
- even though the full pathname for the command was specified
- has been fixed.
-01-04-30 A bug in which read would loose the last character when
- reading the last line of a file that did not contain a new-line
- character has been fixed.
-01-04-23 A bug on some systems in which in vi mode the end of file
- character and end of line character could be swapped has
- been fixed.
-01-04-23 A bug on some systems in which invoking a shell script that
- did not have execute permission could set the exit value to
- 127 rather than 126 has been fixed.
-01-04-20 A bug in which read -n from a pipe would block if fewer than
- n characters was received has been fixed.
-01-04-09 A bug in which invalid patterns, for example, ) by itself,
- was not treated as a string has been fixed so that if i=')',
- then [[ $i == $i ]] is true.
-01-04-09 The shell arithmetic now interprets C character constants.
-01-04-09 A bug in which a non-zero return from a function defined
- with the function reserved word did not trigger the ERR
- trap or exit with set -e has been fixed.
-01-04-02 A bug on some systems, in which characters above 127 were
- not displayed correctly in vi or emacs edit mode has been fixed.
-01-04-02 A bug on some systems, introduced in the 'k' point release, in
- which the erase character in viraw mode was moving the cursor
- to the left without erasing the character has been fixed.
-01-04-02 On some systems the wcwith() function was returning a wrong
- value for characters and caused characters to be displayed
- incorrectly from the shell edit modes. A work around for
- this problem has been added.
-01-03-26 A bug in which valid scripts could produce syntax errors
- when run with locales that considered characters such as "'"
- to be space characters has been fixed.
-01-03-20 A bug in which an syntax error in an arithmetic expression
- entered interactively could cause the shell to go into
- an infinite loop outputting the error message has been fixed.
-01-03-10 ksh93 accepts -l as a synonym for -L in test on systems for
- which /bin/test -l tests for symbolic links.
-01-03-10 A bug in parsing scripts in which { and } are used in place of
- in and esac in case statements embedded in compound commands
- has been fixed. Use of { and } for in and esac is obsolete.
-01-03-06 A bug in which an argument of the form foo=bar was not
- being passed correctly to a traced function whose name
- was foo has been fixed.
-01-03-02 Using $(trap -p name) did not print the name of the current
- trap setting for trap name.
-01-02-26 Exported floating point variables gave incorrect results
- when passing them to ksh88. This has been fixed.
-01-02-25 A race condition in which a coprocess which completed too quickly
- would not allow subsequent coprocesses to start has been fixed.
-01-02-25 The 'g' format specifier is now handled by printf. It had
- inadvertently been omitted.
-01-02-20 The + was not being displayed during an execution trace
- with the += assignment operator.
-01-02-19 The error message which occurs when the interpreter name
- defined on the #! line does not exist is more informative.
-01-02-19 A bug in which $0 would not be set correctly when a
- script with #! was invoked by full pathname from the
- directory of the script has been fixed.
-01-02-19 A shell script did not always pick up tty mode changes
- made by external commands such as stty which could
- effect the behavior of read.
-01-02-19 The -u, -g, and -k unary tests did not give the correct
- results when used with negation and this has been fixed.
-
-01-02-05 --- Release ksh93k+ ---
-01-02-05 The sequence \<newline> inside $'...' was not incrementing
- the line count and this has been fixed.
-01-02-05 Modified expansion of "${@-}" so that if no arguments are set
- it results in null string rather than nothing.
-01-02-02 memory leak problem with local variables in functions fixed.
-01-01-25 allow arithmetic expressions with float%int and treat them
- as ((int)float)%int rather than as an error.
-01-01-19 read -n1 was not working and has been fixed.
-01-01-17 ksh now handles the case in which a here document in command
- substitution $() is terminated by the trailing ). Previously,
- a new-line was needed at the end of the delimiter word.
-01-01-02 A bug in which a KEYBD trap would cause a multi-line token
- to be processed incorrectly has been fixed.
-00-12-10 Arithmetic integer constants can now have L and U suffices.
-00-12-10 A bug in the processing of arithmetic expressions with compound
- variables when the -n option is on has been fixed.
-00-12-08 A bug in M-f and M-b from emacs mode has been fixed. This
- bug only occurs when ksh93 is compiled without MULTIBYTE enabled.
-00-11-29 A bug in which jobs -p would yield 0 for background
- jobs run in a script has been fixed.
-00-11-21 A bug in integer arrays in which the number of elements is
- incorrect when the ++ operator is applied to a non-existing
- element has been fixed. For example, integer x; ((x[3]++)).
-00-11-20 A timing bug in which the shell could reset the terminal
- group to the wrong value in the case that the a new process
- changes the terminal group during startup has been fixed.
-
-00-10-27 --- Release ksh93k ---
-00-10-27 Using tab for completion now works only when applied
- after a non-blank character at the end of the current line.
- In other case a tab is inserted.
-00-10-27 A bug in the emacs edit mode for ^X^E has been fixed.
- The ^X^E sequence is supposed to invoke the full editor
- on the current command.
-00-10-18 A bug in which expansions of the form ${var//pattern/string}
- did not work correctly when pattern was '/' or "/" has
- been fixed.
-00-10-18 The output format for indexed arrays in compound variables
- has been modified so that it can be used as input.
-00-10-18 Assignments with name references (typeset -n) will now
- implicitly unreference an existing name reference.
-00-10-17 A bug the += append operator when a single array element
- is appended to a variable that is not an array has been fixed.
-00-10-16 A bug in which the SIGCONT signal was being sent to
- each process will kill -0 or kill -n 0 has been fixed.
-00-10-12 The arithmetic evaluation portion has been rewritten to
- perform a number of optimizations.
-00-10-10 A bug in which name prefix matching ${!name.*} was not
- checking name to see if it was a name reference has been fixed.
-00-09-26 A bug in the multibyte version in which the width of for
- non-printing characters was not correct has been fixed.
-00-09-12 Made changes to get multibyte editing work on UWIN for windows
-00-09-12 A bug in which multibyte characters would be displayed incorrectly
- has been fixed.
-00-08-08 Removed build dependency on iswprint() and iswalph().
-00-07-20 In some cases the read builtin would read more than a single
- line from a pipe on standard input and therefore leave the seek
- position in the wrong location.
-00-07-05 If the directory / is on the path, a / will not be inserted
- between the directory and the file name during path searching
- to avoid searching // for systems that treat this specially.
-00-06-26 A bug in which on rare occasions wait could return before all
- jobs have completed has been fixed.
-00-06-21 A bug in which backspace did not work correctly during the
- R replace directive in vi-mode has been fixed.
-00-06-12 Added variable name completion/expansion/listing to the set of
- completions. Variable name completions begin with $ or "$ followed
- by a letter.
-00-05-09 --- Release ksh93j ---
-00-05-09 Modified command substitution to avoid using /tmp files when
- run on read-only file systems.
-00-04-17 Modified printf to handle '%..Xc' and '%..Xs' options where X
- is not an alpha character. Previous versions core dumped with this.
-00-04-10 Changes to multibyte editing code were made to use standard
- ISO C functions rather than methods devised before the standard.
-00-04-09 Add %H options to printf to output strings with <"'&\t> properly
- converted for use in HTML and XML documents.
-00-04-07 Modified getopts builtin to handle \f...\f in usage string
- by invoking specified function.
-00-04-04 Added self generating man pages for bg, fc, fg, disown, jobs,
- hist, let, ., and ulimit.
-00-03-30 The append operator += has been added and can be used
- for all assignments, strings, arrays, and compound variables.
-00-03-30 Code was modified in several places to support automatic
- generation of C locale dictionaries.
-00-03-28 A bug in which the set and trap commands invoked with --name
- type arguments would terminate the invoking script has
- been fixed.
-00-03-27 A bug in which the library path variable was not updated
- correctly on some systems as described in the 'g' point
- release has been fixed.
-00-03-07 printf now returns a non-zero exit status when one of
- its arguments cannot be converted to the given type.
-00-03-05 The return value and error message for a command that
- was found on the path but was not executable was set
- incorrectly.
-00-03-05 A prototype for ioctl() was removed from the vi edit mode.
-
-00-01-28 --- Release ksh93i ---
-00-01-28 Most of the built-in commands and ksh itself are now
- self documenting. Running command --man will produce
- screen output. Running command --html produces the
- man page in html format.
-00-01-28 The getopts builtin can process command description
- strings to produce man pages.
-00-01-28 A bug in which a script could terminate when getopts
- encountered an error when invoked inside a function
- has been fixed.
-00-01-28 When a symbolic link was specified as the name of
- the script to invoke by name, the value of $0 was
- set to the real file name rather than the link name
- in some cases and this has been fixed.
-00-01-28 A bug in which the precision given as an argument
- to printf was not working has been fixed.
-
-99-03-31 --- Release ksh93h ---
-99-03-31 The PATH search algorithm has been modified to look
- for a file named .fpath in each bin directory and if
- found, to search for functions in this directory if
- it cannot find the command in that directory.
-99-03-31 When performing pathname expansion, the shell checks
- to see whether each directory it reads is case sensitive
- or not, and performs the matching accordingly.
-99-03-31 The %T format for printing formatted date/time.
-99-03-31 The emacs and vi modes now handle arrow keys when
- they use standard ANSI escape sequences.
-99-03-31 The TAB key can be used for completion in emacs and viraw mode.
-99-03-31 A bug in setting .sh.editchar during the KEYBD trap
- for the MULTIBYTE option was fixed in release ksh93h.
-99-03-31 A bug in shcomp for compilation of unary operators with [[...]]
- has been fixed.
-99-03-31 A bug in which the value of $? was changed when executing
- a keyboard trap has been fixed.
-99-03-31 The handling of SIGCHLD has been changed so that the
- trap is not triggered while executing trap commands
- to avoid recursive trap calls.
-99-03-31 A bug in which a local variable in a function declared readonly
- would generated an error when the function went out of
- scope has been fixed.
-99-03-31 A bug in which \<new_line> entered from the keyboard
- with the KEYBD trap enabled has been fixed.
-99-03-31 The error message for a misplaced ((, for example print ((3),
- was often garbled and has been fixed.
-99-03-31 A bug in the KEYBD trap in which escape sequences of the form
- <ESC>[#~ were not being handled as a unit has been fixed.
-99-03-31 A bug in which ksh would consider expressions like [[ (a) ]]
- as syntax errors has been fixed.
-99-03-31 A function defined as foo() without a function body
- was not reported as a syntax error.
-99-03-31 A bug in which ksh could run out of file descriptors when
- a stream was repeatedly opened with exec and read from
- has been fixed.
-
-98-04-30 --- Release ksh93g ---
-98-04-30 The pipefail option has been added. With pipefail
- enabled, a pipeline will not complete until all
- commands are complete, and the return value will
- be that of the last command to fail, or zero if
- all complete successfully.
-98-04-30 The name-value pair library uses the cdt library rather
- than the hash library. This change should be transparent
- to applications.
-98-04-30 On the U/WIN version for Window 95 and Windows NT,
- when a directory beginning with a letter followed by
- a colon is given to cd, it is assumed to be an absolute
- directory
-98-04-30 When an executable is found on a given path,
- the appropriate library path variable is prepended
- with a corresponding library directory.
-98-04-30 A bug in which a name reference could be created to
- itself and later cause the shell to get into an infinite
- loop has been fixed.
-98-04-30 A bug in shcomp relating to compound variables was fixed.
-98-04-30 A bug introduced in ksh93e in which leading 0's in -Z
- fields caused the value to be treated as octal for arithmetic
- evaluation has been fixed.
-98-04-30 A bug when a name reference with a shorter name than
- the variable it references was the subject of a compound
- assignment has been fixed.
-98-04-30 A bug which in which assignment to array variables in
- a subshell could effect the parent shell has been
- fixed.
-98-04-30 read name?prompt was putting a 0 byte at the end of the
- prompt on standard error.
-98-04-30 A bug in [[ string1 > string2 ]] when ksh was run with -x
- has been fixed.
-98-04-30 A bug in which the escape character was not processed
- correctly inside {...} when brace expansion is enabled
- has been fixed, for example {\$foo}.
-98-04-30 A bug in line continuation in here-documents has been
- fixed.
-98-04-30 The default base when not specified with typeset -i is
- 10 in accordance with the documentation. Previously,
- the value was determined by the first assignment.
-98-04-30 A parsing bug in which a # preceded alphanumeric
- characters inside a command substitution caused
- a syntax error to be reported has been fixed.
-98-04-30 A bug in which a decimal constant represented as 10#ddd
- where ddd was more than five digits generated a syntax
- error has been fixed.
-98-04-30 A bug in here document expansion in which ${...} expansions
- were split across buffer boundaries has been fixed.
-98-04-30 The sh_fun() function now takes third argument which
- is an argument list for the invoked discipline function
- or built-in.
-98-04-30 A callback function can be installed which will give
- notification of file duplications and file closes.
-98-04-30 When ksh is compiled on systems that do not use fork()
- current option settings where not propagated to sub-shells.
-
-97-06-30 --- Release ksh93f ---
-97-06-30 Hostnames in addition to host addresses can be given in
- /dev/tcp/host/port virtual file names.
-97-06-30 File name completion and expansion now quotes special
- characters in file names from both emacs and vi edit modes.
-97-06-30 An empty for list behave like a for list with null expansions.
- It produces a warning message with sh -n.
-97-06-30 The code has been modified to work with EBCDIC as well as ASCII.
-97-06-30 A bug which would cause the secondary prompt to be
- displayed when a user entered a literal carriage
- return has been fixed.
-97-06-30 A bug which caused ksh read -s name to core dump was
- fixed.
-97-06-30 A bug with the expansion of \} and \] inside double
- quoted strings that also contained variable expansions
- has been fixed
-97-06-30 Changes in the ksh93e point release caused autoload
- functions invoked from within command substitution
- to fail. This has been fixed.
-97-06-30 A bug in the processing of here-documents that could
- prevent variable substitution to occur after $(...) command
- substitution for long here documents has been fixed.
-97-06-30 A bug caused by a race condition that could cause SIGTERM
- to be ignored by a child process has been fixed.
-97-06-30 A bug which prevented the startup of a coprocess immediately
- after killing a running coprocess has been fixed.
-97-06-30 ulimit foobar, where foobar is not an arithmetic
- expression, now gives an error message as it did with ksh88
- instead of setting the file size limit to 0.
-97-06-30 A bug which could cause an interactive shell to terminate when
- the last process of a pipeline was a POSIX function was fixed.
-97-06-30 A bug which could cause command substitution of a shell script
- to core dump has been fixed.
-97-06-30 A security hole was fixed in suid_exec.
-97-06-30 Arithmetic functions such as pow() that take more than
- one argument, did not work if arguments other than the
- first contained parenthesized sub-expression.
-97-06-30 The error message from a script containing an incomplete
- arithmetic expression has been corrected.
-97-06-30 A bug which caused a core dump on some machines when
- the value of a name reference contained a positional
- parameter and the name reference was not defined inside
- a function has been fixed.
-97-06-30 Arithmetic expressions now correctly handle hexadecimal
- constants.
-97-06-30 A bug in which integer variables could be expanded
- with a leading 10# when declared with typeset -i
- multiple times has been corrected.
-97-06-30 A bug in which IFS wasn't correctly restored when
- set within command substitution has been fixed.
-97-06-30 The _ character is now considered as part of a word
- with the M-f and M-b emacs directives as it was in ksh88.
-97-06-30 A bug in brace pattern expansions that caused expressions
- such as {foo\,bar,bam} to expand incorrectly have been fixed.
-
-
-96-07-31 --- Release ksh93e ---
-96-07-31 The math functions, atan2, hypot, fmod, and pow were added.
-96-07-31 When a shared library is loaded, if the function lib_init()
- is defined in the library, it is invoked the first time that
- the library is loaded with builtin -f library.
-96-07-31 The k-shell information abstraction database option, KIA,
- has been revamped.
-96-07-31 Empty command substitutions of the form $() now work.
- whence -v foo now gives the correct result after calling
- builtin -d foo.
-96-07-31 A bug in right to left arithmetic assignment for which
- the arithmetic expression (( y = x = 1.5 )) did not
- yield 1 for y when x was declared typeset -i was fixed.
-96-07-31 printf has been fixed to handle format containing \0
- and/or \0145 correctly. In addition, characters following
- %b in the format string are no longer displayed when
- the operand contains \c.
-96-07-31 A bug in printf that could cause the %E format to
- produce unnormalized results has been fixed.
-96-07-31 A bug which causes some arithmetic expressions to be
- incorrectly evaluated as integer expressions rather
- that floating point has been fixed.
-96-07-31 Functions defined inside a subshell no longer remain
- defined when the subshell completes.
-96-07-31 The error message from sh -c ';echo foo' has been
- corrected.
-96-07-31 The format for umask -S has been changed to agree
- with the specification in the POSIX standard.
-96-07-31 A bug that caused side effects in subscript evaluation
- when tracing was enabled for subscripts using ++ or --
- has been fixed.
-96-07-31 To conform to the Posix standard getopts has been changed
- so that the option char is set to ? when it returns with
- a non-zero exit status.
-96-07-31 The handling of \} inside ${name...} has been fixed so
- that the \ quotes the }.
-96-07-31 A bug that caused the read builtin to resume execution
- after processing a trap has been fixed.
-96-07-31 [[ -s file ]] has been fixed so that if file is open
- by ksh, it is flushed first.
-96-07-31 In some cases attributes and sizes for non exported
- variables weren't being reset before running a script.
-96-07-31 The value of TMOUT was affected by changes make to
- it in a subshell.
-96-07-31 The jobs command did not reflect changes make by
- sending the CONT signal to a command.
-96-07-31 The error message for ksh -o unknown was incorrect.
-96-07-31 Functions invoked as name=value name, did not use
- values from the calling scope when evaluating value.
-96-07-31 A bug in which the shell would reexecute previously
- executed code when a shell script or coprocess was
- run in the background has been fixed.
-96-07-31 A bug in which an empty here-document would leave
- a file descriptor open has been fixed.
-96-07-31 A bug in which $(set -A array ...) would leave a
- side effect has been fixed.
-96-07-31 A discipline function for a global variable defined
- within a function defined with the function keyword,
- incorrectly created a local variable of the same name
- and applied the discipline to it.
-
-95-08-28 --- Release ksh93d ---
-95-08-28 The \ character was not handled correctly in replacement
- patterns with ${x/pattern/replace}.
-95-08-28 A bug with read in which the line did not end with
- a new-line has been fixed.
-95-08-28 A bug in file name generation which sometimes
- appended a . for filenames that ended in / has
- been fixed.
-95-08-28 If a process is waited for after a status has
- been returned by a previous wait, wait now
- returns 127.
-95-08-28 A bug with hist (fc) -e which prevented a command
- to re-executed after it had been edited has been fixed.
-95-08-28 A bug which prevented quoting from removing the meaning
- of unary test operators has been fixed.
-95-08-28 A bug with typeahead and KEYBOARD traps with the
- MULTIBYTE option set has been fixed.
-95-08-28 Builtin functions can take a third argument which is
- a void*.
-95-08-28 The nv_scan() function can restrict the scope of a walk
- to the top scope.
-
-95-04-31 --- Release ksh93c ---
-95-04-31 The expansion of "$@" was incorrect when $1 was the null
- string.
-95-04-31 A bug which could incorrectly report a syntax error in
- a backquoted expression when a $ was preceded by \\
- has been fixed.
-95-04-31 A bug which prevented the shell from exiting after
- reporting an error when failing to open a script
- has been fixed.
-95-04-31 A bug that could lead to memory corruption when a
- large here document that required parameter or command
- substitution was expanded has been fixed.
-95-04-31 A bug that could cause a core dump on some systems
- after ksh detected an error when reading a function
- has been fixed.
-95-04-31 A bug which could cause a coprocess to hang when
- reading from a process that has terminated has been fixed.
-95-04-31 A bug which caused a script to terminate when set -e
- was on and the first command of and && or || list
- failed has been fixed.
-95-04-31 A bug with here documents inside $(...) when the delimiter
- word is an identifier has been fixed.
-95-04-31 A bug which caused $0 to display the wrong value when
- a script was invoked as an argument to the . command
- and the eval command has been fixed.
-95-04-31 A bug that could cause the built-in sleep to hang
- has been fixed.
-95-04-31 A bug introduces in 12/28/93b which caused the backslash
- to be removed when it was followed by digit inside double
- quotes in some instances has been fixed.
-95-04-31 A bug which could cause a core dump if ksh was invoked with
- standard input closed has been fixed.
-95-04-31 A bug which could cause a core dump if typeset -A was
- specified for an existing variable has been fixed.
-95-04-31 Variables that were unset but had attributes such as readonly
- and export were not listed with readonly, export and typeset.
-95-04-31 Several problems with signals have been fixed.
-95-04-31 A bug which prevented ulimit -t from working has been fixed.
- Also, a bug in which failed ulimits could cause a core dump
- has also been fixed.
-95-04-31 A bug in expansion of the form ${name/#pattern/string} and
- ${name/%pattern/string} has been fixed.
-95-04-31 A bug which caused read -r on a line that contained only
- blanks to get a non-null value has been fixed.
-95-04-31 A bug introduced in the 'a' point release in which
- ${x='\\'} expanded to \ when x was unset has been fixed.
-95-04-31 A bug which prevented a trap on EXIT from being executed
- when the last command in a script was a function invocation
- has been fixed.
-95-04-31 A bug which caused an interactive shell ignore input when
- standard error was redirected to a file with exec,
- and then restored with exec 2>&1 has been fixed.
-95-04-31 An interactive shell turns on monitor mode even when
- standard error has been redirected to a file.
-95-04-31 A bug which could cause standard input to be incorrectly
- positioned for the last command of a script has been fixed.
-95-04-31 A bug in the edit modes which allowed walking back in
- the history file for more than HISTSIZE commands has
- been fixed.
-95-04-31 A bug which could cause a core dump if variable TMPDIR was
- changed between two command substitutions has been fixed.
-95-04-31. A bug which prevented a trap on EXIT from being cleared
- has been fixed.
-95-04-31 A bug fixed for the v directive in vi MULTIBYTE has been
- fixed.
-95-04-31 Code to for IFS handling of multibyte characters has
- been added.
-95-04-31 The displaying of multibyte strings in export, readonly,
- typeset, and execution traces has been fixed.
-95-04-31 Variables inside functions are now statically scoped.
- The previous behavior was never documented.
-95-04-31 Variables inside functions are now statically scoped.
- The previous behavior was never documented.
-95-04-31 A few changes have been made to the name-value library
- that affect built-ins that use disciplines. The
- changes allow disciplines to be shared by variables
- and should make it possible to add new disciplines
- without recompilation.
-95-04-31 The name-value library interface has undergone significant
- change for this revision. See the new nval.3 man page.
-
-94-12-31 --- Release ksh93b ---
-94-12-31 Variables inside functions are now statically scoped.
- The previous behavior was never documented.
-94-12-31 If IFS contains two consecutive identical characters belonging
- to the [:space:] class, then this character is treated as
- a non-space delimiter so that each instance will delimit
- a field. For example, IFS=$'\t\t' will cause two consecutive
- tabs to delimit a null field.
-94-12-31 The getopts command has a -a name option that specifies a
- name that will be used for usage messages.
-94-12-31 A bug which caused unset RANDOM to dump core has been
- fixed.
-94-12-31 A bug which prevented return for terminating a profile
- or ENV file has been fixed.
-94-12-31 A bug which prevented standard input from being
- directed to /dev/null for background jobs when
- monitor mode was turned off has been fixed.
-94-12-31 Statements of the form typeset -options var[expr]=value
- did not perform substitutions on expr as expected.
-94-12-31 A bug which prevented the shell from sending a HUP
- signal to some background jobs that were not disowned
- has been fixed.
-94-12-31 A bug which allowed a script to trap signals that are
- ignored at the time that the shell was invoked by exec
- has been fixed.
-94-12-31 A bug which could cause a core dump when a discipline
- function was unset within a discipline was fixed.
-94-12-31 The typeset builtin now accepts a first argument of
- + or - for compatibility with ksh88.
-94-12-31 For compatibility with ksh88, the results of expansions
- of command arguments will treat the extended character
- match characters ()|& as ordinary characters.
-94-12-31 A bug which caused read to fail on a file that was
- open for read/write with <> when the first operation
- was print or printf has been fixed.
-94-12-31 When a job is suspended, it is put on the top of
- the job list as required by the POSIX standard.
-94-12-31 The value of OPTARG when an option that required
- an argument but didn't have one was incorrect in the
- case the the option string began with a :.
-94-12-31 A bug which caused the terminal to get into a bad
- state with some KEYBD traps in vi-mode has been fixed.
-94-12-31 A bug which caused an invalid trap to cause a script
- to terminate, rather than just return an error, has
- been fixed.
-94-12-31 Backreferencing sub-expressions in patterns and replacement
- strings now works.
-94-12-31 A bug in chmod which caused the -R option to fail has
- been fixed.
-94-12-31 More signal names have been added for Solaris
-
-94-06-30 --- Release ksh93a ---
-94-06-30 An expansion bug which causes portions of a word after
- a $((...)) expansion that contains a nested $var expansion
- to be lost has been fixed.
-94-06-30 A bug that caused a core dump when a script that did not
- have PWD set and did a cd inside command substitution
- has been fixed.
-94-06-30 A bug which caused a core dump on some machines when
- the LANG variable was assigned to has been fixed.
-94-06-30 A bug which incorrectly handled set disciplines that
- performed arithmetic evaluation when the discipline
- was called from the arithmetic evaluator has been fixed.
-94-06-30 A bug caused by an EXIT trap inside a function that
- was executed in a subshell was fixed.
-94-06-30 If foo is a function, and not a program, then command foo
- now reports that foo isn't found rather than invoking foo.
-94-06-30 The previous version incorrectly listed -A as an
- invocation option. The -A option is only for set.
-94-06-30 A bug was fixed which caused ksh to loop when execution trace
- was enabled and the PS4 prompt required command substitution.
-94-06-30 A bug which could cause the job control switch character
- to be disabled when a script that enabled monitor mode
- terminated was fixed.
-94-06-30 A bug in the macro expansion global replacement operator //,
- when the pattern began with a [ or +( has been fixed.
-94-06-30 A bug which prevented ~ expansion from occurring when
- it was terminated with a colon inside an assignment
- has been fixed.
-94-06-30 A bug in the dot command which prevented autoload functions
- from working has been fixed.
-94-06-30 A bug which caused a variable to be unset if the
- its value were expanded inside a set discipline has
- been fixed.
-94-06-30 Whence -a now longer reports that a defined function
- is undefined.
-94-06-30 A bug on some systems in which $0 would be incorrect
- in scripts invoked by name has been fixed.
-94-06-30 Here documents with an empty body now work.
-94-06-30 A bug which disabled argument passing and resetting
- of options for a script invoked by name inside a
- function has been fixed.
-94-06-30 A bug in which an EXIT trap set the caller of a function
- would be executed if a command called inside a function
- was not found has been fixed.
-94-06-30 A bug which allowed a script to trap signals that are
- ignored at the time that the shell was invoked has
- been fixed.
-94-06-30 A bug which caused 2<&1- when applied to a shell built-in
- to leave standard input closed has been fixed.
-94-06-30 A bug which caused the shell to incorrectly parse
- $() command substitutions with nested case statements
- has been fixed.
-
diff --git a/usr/src/lib/libshell/common/TYPES b/usr/src/lib/libshell/common/TYPES
deleted file mode 100644
index 6eb6f41b5e..0000000000
--- a/usr/src/lib/libshell/common/TYPES
+++ /dev/null
@@ -1,182 +0,0 @@
-
-The ability for users to define types has been added to ksh93t.
-Here is a quick summary of how types are defined and used in ksh93t.
-This is still a work in progress so some changes and additions
-are likely.
-
-A type can be defined either by a shared library or by using the new
-typeset -T option to the shell. The method for defining types via
-a shared library is not described here. However, the source file
-bltins/enum.c is an example of a builtin that creates enumeration types.
-
-By convention, typenames begin with a capitol letter and end in _t.
-To define a type, use
- typeset -T Type_t=(
- definition
- )
-where definition contains assignment commands, declaration commands,
-and function definitions. A declaration command (for example typeset,
-readonly, and export), is a built-in that differs from other builtins in
-that tilde substitution is performed on arguments after an =, assignments
-do not have to precede the command name, and field splitting and pathname
-expansion is not performed on the arguments.
-For example,
- typeset -T Pt_t=(
- float -h 'length in inches' x=1
- float -h 'width in inches' y=0
- integer -S count=0
- len()
- {
- print -r $((sqrt(_.x*_.x + _.y*_.y)))
- }
- set()
- {
- (( _.count++))
- }
- )
-
-defines a type Pt_t that has three variables x, y, and count defined as well
-as the discipline functions len and set. The variable x has an initial value
-of 1 and the variable y has an initial value of 0. The new -h option argument,
-is used for documentations purposes as described later and is ignored outside
-of a type definition.
-
-
-The variable count has the new -S attribute which means that it is shared
-between all instances of the type. The -S option to typeset is ignored
-outside of a type definition. Note the variable named _ that is used inside
-the function definition for len and set. It will be a reference to the
-instance of Pt_t that invoked the function. The functions len and set
-could also have been defined with function len and function set, but
-since there are no local variables, the len() and set() form are more
-efficient since they don't need to set up a context for local variables
-and for saving and restoring traps.
-
-If the discipline function named create is defined it will be
-invoked when creating each instance for that type. A function named
-create cannot be defined by any instance.
-
-When a type is defined, a declaration built-in command by this name
-is added to ksh. As with other shell builtins, you can get the man page
-for this newly added command by invoking Pt_t --man. The information from
-the -h options will be embedded in this man page. Any functions that
-use getopts to process arguments will be cross referenced on the generated
-man page.
-
-Since Pt_t is now a declaration command it can be used in the definition
-of other types, for example
- typeset -T Rect_t=( Pt_t ur ll)
-
-Because a type definition is a command, it can be loaded on first reference
-by putting the definition into a file that is found on FPATH.
-Thus, if this definition is in a file named Pt_t on FPATH, then
-a program can create instances of Pt_t without first including
-the definition.
-
-A type definition is readonly and cannot be unset. Unsetting non-shared
-elements of a type restores them to their default value. Unsetting a
-shared element has no effect.
-
-The Pt_t command is used to create an instance of Pt_t.
- Pt_t p1
-creates an instance named p1 with the initial value for p1.x set to 1
-and the initial value of p1.y set to 0.
- Pt_t p2=(x=3 y=4)
-creates an instance with the specified initial values. The len function
-gives the distance of the point to the origin. Thus, p1.len will output
-1 and p2.len will output 5.
-
-ksh93t also introduces a more efficient command substitution mechanism.
-Instead of $(command), the new command substitution ${ command;}
-can be used. Unlike (and ) which are always special, the { and } are
-reserved words and require the space after { and a newline or ; before }.
-Unlike $(), the ${ ;} command substitution executes the command in
-the current shell context saving the need to save and restore
-changes, therefore also allowing side effects.
-
-When trying to expand an element of a type, if the element does not exist,
-ksh will look for a discipline function with that name and treat this as if
-it were the ${ ;} command substitution. Thus, ${p1.len} is equivalent to
-${ p1.len;} and within an arithmetic expression, p1.len will be expanded
-via the new command substitution method.
-
-The type of any variable can be obtained from the new prefix
-operator @. Thus, ${@p1} will output Pt_t.
-
-By default, each instance inherits all the discipline functions defined
-by the type definition other than create. However, each instance can define
-a function by the same name that will override this definition.
-However, only discipline functions with the same name as those defined
-by the type or the standard get, set, append, and unset disciplines
-can be defined by each instance.
-
-Each instance of the type Pt_t behaves like a compound variable except
-that only the variables defined by the type can be referenced or set.
-Thus, p2.x=9 is valid, but p2.z=9 is not. Unless a set discipline function
-does otherwise, the value of $p1 will be expanded to the form of a compound
-variable that can be used for reinput into ksh.
-
-If the variables var1 and var2 are of the same type, then the assignment
- var2=var1
-will create a copy of the variable var1 into var2. This is equivalent to
- eval var2="$var1"
-but is faster since the variable does not need to get expanded or reparsed.
-
-The type Pt_t can be referenced as if it were a variable using the name
-.sh.type.Pt_t. To change the default point location for subsequent
-instances of Pt_t, you can do
- .sh.type.Pt_t=(x=5 y=12)
-so that
- Pt_t p3
- p3.len
-would be 13.
-
-Types can be defined for simple variables as well as for compound
-objects such as Pt_t. In this case, the variable named . inside
-the definition refers to the real value for the variable. For example,
-the type definition
- typeset -T Time_t=(
- integer .=0
- _='%H:%M:%S'
- get()
- {
- .sh.value=$(printf "%(${_._})T" "#$((_))" )
- }
- set()
- {
- .sh.value=$(printf "%(%#)T" "${.sh.value}")
-
- }
- )
-
-The sub-variable name _ is reserved for data used by discipline functions
-and will not be included with data written with the %B option to printf.
-In this case it is used to specify a date format.
-
-In this case
- Time_t t1 t2=now
-will define t1 as the time at the beginning of the epoch and t2
-as the current time. Unlike the previous case, $t2 will output
-the current time in the date format specified by the value t2._.
-However, the value of ${t2.} will expand the instance to a form
-that can be used as input to the shell.
-
-Finally, types can be derived from an existing type. If the first
-element in a type definition is named _, then the new type
-consists of all the elements and discipline functions from the
-type of _ extended by elements and discipline functions defined
-by new type definition. For example,
-
- typeset -T Pq_t=(
- Pt_t _
- float z=0.
- len()
- {
- print -r $((sqrt(_.x*_.x + _.y*_.y + _.z*_.z)))
- }
- )
-
-defines a new type Pq_t which is based on Pq_t and contains an additional
-field z and a different len discipline function. It is also possible
-to create a new type Pt_t based on the original Pt_t. In this case
-the original Pt_t is no longer accessible.
diff --git a/usr/src/lib/libshell/misc/images/callouts/1.png b/usr/src/lib/libshell/misc/images/callouts/1.png
deleted file mode 100644
index 608fad3596..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/1.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/10.png b/usr/src/lib/libshell/misc/images/callouts/10.png
deleted file mode 100644
index 39e55197cf..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/10.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/2.png b/usr/src/lib/libshell/misc/images/callouts/2.png
deleted file mode 100644
index 5444738841..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/2.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/3.png b/usr/src/lib/libshell/misc/images/callouts/3.png
deleted file mode 100644
index 64b87c7151..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/3.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/4.png b/usr/src/lib/libshell/misc/images/callouts/4.png
deleted file mode 100644
index c308193ac4..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/4.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/5.png b/usr/src/lib/libshell/misc/images/callouts/5.png
deleted file mode 100644
index 24799f0a43..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/5.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/6.png b/usr/src/lib/libshell/misc/images/callouts/6.png
deleted file mode 100644
index 8919a670cd..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/6.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/7.png b/usr/src/lib/libshell/misc/images/callouts/7.png
deleted file mode 100644
index e30e8a70cb..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/7.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/8.png b/usr/src/lib/libshell/misc/images/callouts/8.png
deleted file mode 100644
index 3e35c8827c..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/8.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/callouts/9.png b/usr/src/lib/libshell/misc/images/callouts/9.png
deleted file mode 100644
index ed2f14b4eb..0000000000
--- a/usr/src/lib/libshell/misc/images/callouts/9.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/tag_bourne.png b/usr/src/lib/libshell/misc/images/tag_bourne.png
deleted file mode 100644
index f1f78e3a25..0000000000
--- a/usr/src/lib/libshell/misc/images/tag_bourne.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/tag_i18n.png b/usr/src/lib/libshell/misc/images/tag_i18n.png
deleted file mode 100644
index 559929df2a..0000000000
--- a/usr/src/lib/libshell/misc/images/tag_i18n.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/tag_ksh.png b/usr/src/lib/libshell/misc/images/tag_ksh.png
deleted file mode 100644
index b33d5a7aa1..0000000000
--- a/usr/src/lib/libshell/misc/images/tag_ksh.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/tag_ksh88.png b/usr/src/lib/libshell/misc/images/tag_ksh88.png
deleted file mode 100644
index d36dc0f5f5..0000000000
--- a/usr/src/lib/libshell/misc/images/tag_ksh88.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/tag_ksh93.png b/usr/src/lib/libshell/misc/images/tag_ksh93.png
deleted file mode 100644
index 357ee3c50a..0000000000
--- a/usr/src/lib/libshell/misc/images/tag_ksh93.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/tag_l10n.png b/usr/src/lib/libshell/misc/images/tag_l10n.png
deleted file mode 100644
index be89f7a163..0000000000
--- a/usr/src/lib/libshell/misc/images/tag_l10n.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/images/tag_perf.png b/usr/src/lib/libshell/misc/images/tag_perf.png
deleted file mode 100644
index fcb2960852..0000000000
--- a/usr/src/lib/libshell/misc/images/tag_perf.png
+++ /dev/null
Binary files differ
diff --git a/usr/src/lib/libshell/misc/shell_styleguide.docbook b/usr/src/lib/libshell/misc/shell_styleguide.docbook
deleted file mode 100644
index 0376912d1f..0000000000
--- a/usr/src/lib/libshell/misc/shell_styleguide.docbook
+++ /dev/null
@@ -1,1464 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN" "http://www.oasis-open.org/docbook/xml/5.0b5/dtd/docbook.dtd" [
- <!ENTITY tag_bourneonly '<inlinemediaobject><imageobject><imagedata fileref="images/tag_bourne.png"></imagedata></imageobject><textobject><phrase>[Bourne]</phrase></textobject></inlinemediaobject> '>
- <!ENTITY tag_kshonly '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh.png"></imagedata></imageobject><textobject><phrase>[ksh]</phrase></textobject></inlinemediaobject> '>
- <!ENTITY tag_ksh88only '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh88.png"></imagedata></imageobject><textobject><phrase>[ksh88]</phrase></textobject></inlinemediaobject> '>
- <!ENTITY tag_ksh93only '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh93.png"></imagedata></imageobject><textobject><phrase>[ksh93]</phrase></textobject></inlinemediaobject> '>
- <!ENTITY tag_performance '<inlinemediaobject><imageobject><imagedata fileref="images/tag_perf.png"></imagedata></imageobject><textobject><phrase>[perf]</phrase></textobject></inlinemediaobject> '>
- <!ENTITY tag_i18n '<inlinemediaobject><imageobject><imagedata fileref="images/tag_i18n.png"></imagedata></imageobject><textobject><phrase>[i18n]</phrase></textobject></inlinemediaobject> '>
- <!ENTITY tag_l10n '<inlinemediaobject><imageobject><imagedata fileref="images/tag_l10n.png"></imagedata></imageobject><textobject><phrase>[l10n]</phrase></textobject></inlinemediaobject> '>
-]>
-<!--
-
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
--->
-
-<!--
-
- Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- Use is subject to license terms.
-
--->
-
-<!-- tag images were created like this:
-$ (text="perf" ;
- pbmtext -nomargins -lspace 0 -builtin fixed "${text}" |
- pbmtopgm 1 1 |
- pgmtoppm 1.0,1.0,1.0-0,0,0 /dev/stdin |
- ppmtogif |
- giftopnm |
- pnmtopng >"tag_${text}.png")
--->
-
-<!-- compile with:
-xsltproc &minus;&minus;stringparam generate.section.toc.level 0 \
- &minus;&minus;stringparam toc.max.depth 3 \
- &minus;&minus;stringparam toc.section.depth 12 \
- &minus;&minus;xinclude -o opensolaris_shell_styleguide.html /usr/share/sgml/docbook/docbook-xsl-stylesheets-1.69.1/html/docbook.xsl opensolaris_shell_styleguide.docbook
--->
-
-<article
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns="http://docbook.org/ns/docbook"
- xml:lang="en">
- <!-- xmlns:xi="http://www.w3.org/2001/XInclude" -->
-
- <info>
- <title><emphasis>[DRAFT]</emphasis> Bourne/Korn Shell Coding Conventions</title>
-
- <!-- subtitle abuse -->
- <subtitle>
- This page is currently work-in-progress until it is approved by the OS/Net community. Please send any comments to
- <email>shell-discuss@opensolaris.org</email>.
- </subtitle>
-
-
- <authorgroup>
-<!--
- <author><personname>David G. Korn</personname><email>dgk@research.att.com</email></author>
- <author><personname>Roland Mainz</personname><email>roland.mainz@nrubsig.org</email></author>
- <author><personname>Mike Shapiro</personname><email>mike.shapiro@sun.com</email></author>
--->
- <author><orgname>OpenSolaris.org</orgname></author>
- </authorgroup>
- </info>
-
-<section xml:id="intro">
- <title>Intro</title>
- <para>This document describes the shell coding style used for all the SMF script changes integrated into (Open)Solaris.</para>
- <para>All new SMF shell code should conform to this coding standard, which is intended to match our existing C coding standard.</para>
- <para>When in doubt, think "what would be the C-Style equivalent ?" and "What does the POSIX (shell) standard say ?"</para>
-</section><!-- end of intro -->
-
-
-<section xml:id="rules">
- <title>Rules</title>
-
-
-
- <section xml:id="general">
- <title>General</title>
-
- <section xml:id="basic_format">
- <title>Basic Format</title>
- <para>Similar to <literal>cstyle</literal>, the basic format is that all
- lines are indented by TABs or eight spaces, and continuation lines (which
- in the shell end with "\") are indented by an equivalent number of TABs
- and then an additional four spaces, e.g.
-<programlisting>
-cp foo bar
-cp some_realllllllllllllllly_realllllllllllllly_long_path \
- to_another_really_long_path
-</programlisting>
- </para>
- <para>The encoding used for the shell scripts is either <literal>ASCII</literal>
- or <literal>UTF-8</literal>, alternative encodings are only allowed when the
- application requires this.</para>
- </section>
-
-
- <section xml:id="commenting">
- <title>Commenting</title>
- <para>Shell comments are preceded by the '<literal>#</literal>' character. Place
- single-line comments in the right-hand margin. Use an extra '<literal>#</literal>'
- above and below the comment in the case of multi-line comments:
-<programlisting>
-cp foo bar # Copy foo to bar
-
-#
-# Modify the permissions on bar. We need to set them to root/sys
-# in order to match the package prototype.
-#
-chown root bar
-chgrp sys bar
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="interpreter_magic">
- <title>Interpreter magic</title>
- <para>The proper interpreter magic for your shell script should be one of these:
-<programlisting>
-#!/bin/sh Standard Bourne shell script
-#!/bin/ksh -p Standard Korn shell 88 script. You should always write ksh
- scripts with -p so that ${ENV} (if set by the user) is not
- sourced into your script by the shell.
-#!/bin/ksh93 Standard Korn shell 93 script (-p is not needed since ${ENV} is
- only used for interactive shell sessions).
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="harden_your_script_against_unexpected_input">
- <title>Harden the script against unexpected (user) input</title>
- <para>Harden your script against unexpected (user) input, including
- command line options, filenames with blanks (or other special
- characters) in the name, or file input</para>
- </section>
-
-
- <section xml:id="use_builtin_commands">
- <title>&tag_kshonly;&tag_performance;Use builtin commands if the shell provides them</title>
- <para>
- Use builtin commands if the shell provides them. For example ksh93s+
- (ksh93, version 's+') delivered with Solaris (as defined by PSARC 2006/550)
- supports the following builtins:
- <simplelist type="inline">
- <member>basename</member>
- <member>cat</member>
- <member>chgrp</member>
- <member>chmod</member>
- <member>chown</member>
- <member>cmp</member>
- <member>comm</member>
- <member>cp</member>
- <member>cut</member>
- <member>date</member>
- <member>dirname</member>
- <member>expr</member>
- <member>fds</member>
- <member>fmt</member>
- <member>fold</member>
- <member>getconf</member>
- <member>head</member>
- <member>id</member>
- <member>join</member>
- <member>ln</member>
- <member>logname</member>
- <member>mkdir</member>
- <member>mkfifo</member>
- <member>mv</member>
- <member>paste</member>
- <member>pathchk</member>
- <member>rev</member>
- <member>rm</member>
- <member>rmdir</member>
- <member>stty</member>
- <member>tail</member>
- <member>tee</member>
- <member>tty</member>
- <member>uname</member>
- <member>uniq</member>
- <member>wc</member>
- <member>sync</member>
- </simplelist>
- Those builtins can be enabled via <literal>$ builtin name_of_builtin #</literal> in shell
- scripts (note that ksh93 builtins implement exact POSIX behaviour - some
- commands in Solaris <filename>/usr/bin/</filename> directory implement pre-POSIX behaviour.
- Add <literal>/usr/xpg6/bin/:/usr/xpg4/bin</literal> before
- <filename>/usr/bin/</filename> in <envar>${PATH}</envar> to test whether your script works with
- the XPG6/POSIX versions)
- </para>
- </section>
-
-
- <section xml:id="use_blocks_not_subshells">
- <title>&tag_performance;Use blocks and not subshells if possible</title>
- <para>Use blocks and not subshells if possible, e.g. use
- <literal>$ { print "foo" ; print "bar" ; }</literal> instead of
- <literal>$ (print "foo" ; print "bar") #</literal> - blocks are
- faster since they do not require to save the subshell context (ksh93) or
- trigger a shell child process (Bourne shell, bash, ksh88 etc.)
- </para>
- </section>
-
-
- <section xml:id="use_long_options_for_set_builtin">
- <title>&tag_kshonly; use long options for "<literal>set</literal>"</title>
- <para>use long options for "<literal>set</literal>", for example instead of <literal>$ set -x #</literal>
- use <literal>$ set -o xtrace #</literal> to make the code more readable.</para>
- </section>
-
-
- <section xml:id="use_posix_command_substitutions_syntax">
- <title>&tag_kshonly; Use <literal>$(...)</literal> instead of <literal>`...`</literal> command substitutions</title>
- <para>Use <literal>$(...)</literal> instead of <literal>`...`</literal> - <literal>`...`</literal>
- is an obsolete construct in ksh+POSIX sh scripts and <literal>$(...)</literal>.is a cleaner design,
- requires no escaping rules, allows easy nesting etc.</para>
-
- <note><title>&tag_ksh93only; <literal>${ ...;}</literal>-style command substitutions</title>
- <para>ksh93 has support for an alternative version of command substitutions with the
- syntax <literal>${ ...;}</literal> which do not run in a subshell.
- </para></note>
- </section>
-
-
- <section xml:id="put_command_substitution_result_in_quotes">
- <title>&tag_kshonly; Always put the result of a <literal>$(...)</literal> or
- <literal>$( ...;)</literal> command substitution in quotes</title>
- <para>Always put the result of <literal>$( ... )</literal> or <literal>$( ...;)</literal> in
- quotes (e.g. <literal>foo="$( ... )"</literal> or <literal>foo="$( ...;)"</literal>) unless
- there is a very good reason for not doing it</para>
- </section>
-
-
- <section xml:id="always_set_path">
- <title>Scripts should always set their <envar>PATH</envar></title>
- <para>Scripts should always set their <envar>PATH</envar> to make sure they do not use
- alternative commands by accident (unless the value of <envar>PATH</envar> is well-known
- and guaranteed to be set by the caller)</para>
- </section>
-
-
- <section xml:id="make_sure_commands_are_available">
- <title>Make sure that commands from other packages/applications are really installed on the machine</title>
- <para>Scripts should make sure that commands in optional packages are really
- there, e.g. add a "precheck" block in scipts to avoid later failure when
- doing the main job</para>
- </section>
-
-
- <section xml:id="check_usage_of_boolean_variables">
- <title>Check how boolean values are used/implemented in your application</title>
- <para>Check how boolean values are used in your application.</para>
- <para>For example:
-<programlisting>
-mybool=0
-# do something
-if [ $mybool -eq 1 ] ; then do_something_1 ; fi
-</programlisting>
-could be rewritten like this:
-<programlisting>
-mybool=false # (valid values are "true" or "false", pointing
-# to the builtin equivalents of /bin/true or /bin/false)
-# do something
-if ${mybool} ; then do_something_1 ; fi
-</programlisting>
-or
-<programlisting>
-integer mybool=0 # values are 0 or 1
-# do something
-if (( mybool==1 )) ; then do_something_1 ; fi
-</programlisting>
- </para>
- </section>
-
- <section xml:id="shell_uses_characters_not_bytes">
- <title>&tag_i18n;The shell always operates on <emphasis>characters</emphasis> not bytes</title>
- <para>Shell scripts operate on characters and <emphasis>not</emphasis> bytes.
- Some locales use multiple bytes (called "multibyte locales") to represent one character</para>
-
- <note><para>ksh93 has support for binary variables which explicitly
- operate on bytes, not characters. This is the <emphasis>only</emphasis> allowed
- exception.</para></note>
- </section>
-
-
- <section xml:id="multibyte_locale_input">
- <title>&tag_i18n;Multibyte locales and input</title>
- <para>Think about whether your application has to handle file names or
- variables in multibyte locales and make sure all commands used in your
- script can handle such characters (e.g. lots of commands in Solaris's
- <filename>/usr/bin/</filename> are <emphasis>not</emphasis> able to handle such values - either use ksh93
- builtin constructs (which are guaranteed to be multibyte-aware) or
- commands from <filename>/usr/xpg4/bin/</filename> and/or <filename>/usr/xpg6/bin</filename>)
- </para>
- </section>
-
-
- <section xml:id="use_external_filters_only_for_large_datasets">
- <title>&tag_performance;Only use external filters like <literal>grep</literal>/<literal>sed</literal>/<literal>awk</literal>/etc.
- if you want to process lots of data with them</title>
- <para>Only use external filters like <literal>grep</literal>/<literal>sed</literal>/<literal>awk</literal>/etc.
- if a significant amount of data is processed by the filter or if
- benchmarking shows that the use of builtin commands is significantly slower
- (otherwise the time and resources needed to start the filter are
- far greater then the amount of data being processed,
- creating a performance problem).</para>
- <para>For example:
-<programlisting>
-if [ "$(echo "$x" | egrep '.*foo.*')" != "" ] ; then
- do_something ;
-done
-</programlisting>
-can be re-written using ksh93 builtin constructs, saving several
-<literal>|fork()|+|exec()|</literal>'s:
-<programlisting>
-if [[ "${x}" == ~(E).*foo.* ]] ; then
- do_something ;
-done
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="use_dashdash_if_first_arg_is_variable">
- <title>If the first operand of a command is a variable, use <literal>--</literal></title>
- <para>If the first operand of a command is a variable, use <literal>--</literal>
- for any command that accepts this as end of argument to
- avoid problems if the variable expands to a value starting with <literal>-</literal>.
- </para>
- <note><para>
- At least
- <simplelist type="inline">
- <member>print</member>
- <member>/usr/bin/fgrep</member><member>/usr/xpg4/bin/fgrep</member>
- <member>/usr/bin/grep</member> <member>/usr/xpg4/bin/grep</member>
- <member>/usr/bin/egrep</member><member>/usr/xpg4/bin/egrep</member>
- </simplelist>
- support <literal>--</literal> as "end of arguments"-terminator.
- </para></note>
- </section>
-
- <section xml:id="use_export">
- <title>&tag_kshonly;&tag_performance;Use <literal>$ export FOOBAR=val #</literal> instead of
- <literal>$ FOOBAR=val ; export FOOBAR #</literal></title>
- <para>Use <literal>$ export FOOBAR=val # instead of $ FOOBAR=val ; export FOOBAR #</literal> -
- this is much faster.</para>
- </section>
-
-
- <section xml:id="use_subshell_around_set_dashdash_usage">
- <title>Use a subshell (e.g. <literal>$ ( mycmd ) #</literal>) around places which use
- <literal>set -- $(mycmd)</literal> and/or <literal>shift</literal></title>
- <para>Use a subshell (e.g. <literal>$ ( mycmd ) #</literal>) around places which use
- <literal>set -- $(mycmd)</literal> and/or <literal>shift</literal> unless the variable
- affected is either a local one or if it's guaranteed that this variable will no longer be used
- (be careful for loadable functions, e.g. ksh/ksh93's <literal>autoload</literal> !!!!)
- </para>
- </section>
-
-
- <section xml:id="be_careful_with_tabs_in_script_code">
- <title>Be careful with using TABS in script code, they are not portable
- between editors or platforms</title>
- <para>Be careful with using TABS in script code, they are not portable
- between editors or platforms.</para>
- <para>If you use ksh93 use <literal>$'\t'</literal> to include TABs in sources, not the TAB character itself.</para>
- </section>
-
-
- <section xml:id="centralise_error_exit">
- <title>If you have multiple points where your application exits with an error
- message create a central function for this purpose</title>
- <para>If you have multiple points where your application exits with an error
- message create a central function for this, e.g.
-<programlisting>
-if [ -z "$tmpdir" ] ; then
- print -u2 "mktemp failed to produce output; aborting."
- exit 1
-fi
-if [ ! -d $tmpdir ] ; then
- print -u2 "mktemp failed to create a directory; aborting."
- exit 1
-fi
-</programlisting>
-should be replaced with
-<programlisting>
-function fatal_error
-{
- print -u2 "${progname}: $*"
- exit 1
-}
-# do something (and save ARGV[0] to variable "progname")
-if [ -z "$tmpdir" ] ; then
- fatal_error "mktemp failed to produce output; aborting."
-fi
-if [ ! -d "$tmpdir" ] ; then
- fatal_error "mktemp failed to create a directory; aborting."
-fi
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="use_set_o_nounset">
- <title>&tag_kshonly; Think about using <literal>$ set -o nounset #</literal> by default</title>
- <para>Think about using <literal>$ set -o nounset #</literal> by default (or at least during the
- script's development phase) to catch errors where variables are used
- when they are not set (yet), e.g.
-<screen>
-$ <userinput>(set -o nounset ; print ${foonotset})</userinput>
-<computeroutput>/bin/ksh93: foonotset: parameter not set</computeroutput>
-</screen>
- </para>
- </section>
-
-
- <section xml:id="avoid_eval_builtin">
- <title>Avoid using <literal>eval</literal> unless absolutely necessary</title>
- <para>Avoid using <literal>eval</literal> unless absolutely necessary. Subtle things
- can happen when a string is passed back through the shell
- parser. You can use name references to avoid uses such as
- <literal>eval $name="$value"</literal>.
- </para>
- </section>
-
-
- <section xml:id="use_concatenation_operator">
- <title>&tag_ksh93only;Use the string/array concatenation operator <literal>+=</literal></title>
- <para>Use <literal>+=</literal> instead of manually adding strings/array elements, e.g.
-<programlisting>
-foo=""
-foo="${foo}a"
-foo="${foo}b"
-foo="${foo}c"
-</programlisting>
-should be replaced with
-<programlisting>
-foo=""
-foo+="a"
-foo+="b"
-foo+="c"
-</programlisting>
- </para>
- </section>
-
- <section xml:id="use_source_not_dot">
- <title>&tag_ksh93only;Use <literal>source</literal> instead of '<literal>.</literal> '(dot)
- to include other shell script fragments</title>
- <para>Use <literal>source</literal> instead of '<literal>.</literal>'
- (dot) to include other shell script fragments - the new form is much
- more readable than the tiny dot and a failure can be caught within the script.</para>
- </section>
-
-
- <section xml:id="use_builtin_localisation_support">
- <title>&tag_ksh93only;&tag_performance;&tag_l10n;Use <literal>$"..."</literal> instead of
- <literal>gettext ... "..."</literal> for strings that need to be localized for different locales</title>
- <para>Use $"..." instead of <literal>gettext ... "..."</literal> for strings that need to be
- localized for different locales. <literal>gettext</literal> will require a
- <literal>fork()+exec()</literal> and
- reads the whole catalog each time it's called, creating a huge overhead for localisation
- (and the <literal>$"..."</literal> is easier to use, e.g. you only have to put a
- <literal>$</literal> in front of the catalog and the string will be localised).
- </para>
- </section>
-
-
- <section xml:id="use_set_o_noglob">
- <title>&tag_kshonly;&tag_performance;Use <literal>set -o noglob</literal> if you do not need to expand files</title>
- <para>If you don't expect to expand files, you can do set <literal>-f</literal>
- (<literal>set -o noglob</literal>) as well. This way the need to use <literal>""</literal> is
- greatly reduced.</para>
- </section>
-
-
- <section xml:id="use_empty_ifs_to_handle_spaces">
- <title>&tag_ksh93only;Use <literal>IFS=</literal> to avoid problems with spaces in filenames</title>
- <para>Unless you want to do word splitting, put <literal>IFS=</literal>
- at the beginning of a command. This way spaces in
- file names won't be a problem. You can do
- <literal>IFS='delims' read -r</literal> line
- to override <envar>IFS</envar> just for the <literal>read</literal> command. However,
- you can't do this for the <literal>set</literal> builtin.</para>
- </section>
-
-
- <section xml:id="set_locale_when_comparing_against_localised_output">
- <title>Set the message locale if you process output of tools which may be localised</title>
- <para>Set the message locale (<envar>LC_MESSAGES</envar>) if you process output of tools which may be localised</para>
- <example><title>Set <envar>LC_MESSAGES</envar> when testing for specific outout of the <filename>/usr/bin/file</filename> utility:</title>
-<programlisting>
-# set french as default message locale
-export LC_MESSAGES=fr_FR.UTF-8
-
-...
-
-# test whether the file "/tmp" has the filetype "directory" or not
-# we set LC_MESSAGES to "C" to ensure the returned message is in english
-if [[ "$(LC_MESSAGES=C file /tmp)" = *directory ]] ; then
- print "is a directory"
-fi
-</programlisting>
- <note><para>The environment variable <envar>LC_ALL</envar> always
- overrides any other <envar>LC_*</envar> environment variables
- (and <envar>LANG</envar>, too),
- including <envar>LC_MESSAGES</envar>.
- if there is the chance that <envar>LC_ALL</envar> may be set
- replace <envar>LC_MESSAGES</envar> with <envar>LC_ALL</envar>
- in the example above.</para></note>
- </example>
- </section>
-
- <section xml:id="cleanup_after_yourself">
- <title>Cleanup after yourself.</title>
- <para>Cleanup after yourself. For example ksh/ksh93 have an <literal>EXIT</literal> trap which
- is very useful for this.
- </para>
- <note><para>
- Note that the <literal>EXIT</literal> trap is executed for a subshell and each subshell
- level can run it's own <literal>EXIT</literal> trap, for example
-<screen>
-$ <userinput>(trap "print bam" EXIT ; (trap "print snap" EXIT ; print "foo"))</userinput>
-<computeroutput>foo
-snap
-bam</computeroutput>
-</screen>
- </para></note>
- </section>
-
- <section xml:id="use_proper_exit_code">
- <title>Use a proper <literal>exit</literal> code</title>
- <para>Explicitly set the exit code of a script, otherwise the exit code
- from the last command executed will be used which may trigger problems
- if the value is unexpected.</para>
- </section>
-
-
- <section xml:id="shell_lint">
- <title>&tag_ksh93only;Use <literal>shcomp -n scriptname.sh /dev/null</literal> to check for common errors</title>
- <para>Use <literal>shcomp -n scriptname.sh /dev/null</literal> to
- check for common problems (such as insecure, depreciated or ambiguous constructs) in shell scripts.</para>
- </section>
- </section><!-- end of general -->
-
-
-
-
-
- <section xml:id="functions">
- <title>Functions</title>
-
- <section xml:id="use_functions">
- <title>Use functions to break up your code</title>
- <para>Use functions to break up your code into smaller, logical blocks.</para>
- </section>
-
- <section xml:id="do_not_reserved_keywords_for_function_names">
- <title>Do not use function names which are reserved keywords in C/C++/JAVA or the POSIX shell standard</title>
- <para>Do not use function names which are reserved keywords (or function names) in C/C++/JAVA or the POSIX shell standard
- (to avoid confusion and/or future changes/updates to the shell language).
- </para>
- </section>
-
- <section xml:id="use_ksh_style_function_syntax">
- <title>&tag_kshonly;&tag_performance;Use ksh-style <literal>function</literal></title>
- <para>It is <emphasis>highly</emphasis> recommended to use ksh style functions
- (<literal>function foo { ... }</literal>) instead
- of Bourne-style functions (<literal>foo() { ... }</literal>) if possible
- (and local variables instead of spamming the global namespace).</para>
-
- <warning><para>
- The difference between old-style Bourne functions and ksh functions is one of the major differences
- between ksh88 and ksh93 - ksh88 allowed variables to be local for Bourne-style functions while ksh93
- conforms to the POSIX standard and will use a function-local scope for variables declared in
- Bourne-style functions.</para>
- <para>Example (note that "<literal>integer</literal>" is an alias for "<literal>typeset -li</literal>"):
-<programlisting>
-# new style function with local variable
-$ ksh93 -c 'integer x=2 ; function foo { integer x=5 ; } ; print "x=$x"
-; foo ; print "x=$x" ;'
-x=2
-x=2
-# old style function with an attempt to create a local variable
-$ ksh93 -c 'integer x=2 ; foo() { integer x=5 ; } ; print "x=$x" ; foo ;
-print "x=$x" ;'
-x=2
-x=5
-</programlisting>
-
- <uri xlink:href="http://www.opensolaris.org/os/project/ksh93-integration/docs/ksh93r/general/compatibility/">usr/src/lib/libshell/common/COMPATIBILITY</uri>
- says about this issue:
-<blockquote><para>
-Functions, defined with name() with ksh-93 are compatible with
-the POSIX standard, not with ksh-88. No local variables are
-permitted, and there is no separate scope. Functions defined
-with the function name syntax, maintain compatibility.
-This also affects function traces.
-</para></blockquote>
-(this issue also affects <filename>/usr/xpg4/bin/sh</filename> in Solaris 10 because it is based on ksh88. This is a bug.).
- </para></warning>
-
- </section>
-
-
- <section xml:id="use_proper_return_code">
- <title>Use a proper <literal>return</literal> code</title>
- <para>Explicitly set the return code of a function - otherwise the exit code
- from the last command executed will be used which may trigger problems
- if the value is unexpected.</para>
- <para>The only allowed exception is if a function uses the shell's <literal>errexit</literal> mode to leave
- a function, subshell or the script if a command returns a non-zero exit code.
- </para>
- </section>
-
- <section xml:id="use_fpath_to_load_common_code">
- <title>&tag_kshonly;Use <envar>FPATH</envar> to load common functions, not <literal>source</literal></title>
- <para>
- Use the ksh <envar>FPATH</envar> (function path) feature to load functions which are shared between scripts
- and not <literal>source</literal> - this allows to load such a function on demand and not all at once.</para>
- </section>
-
- </section><!-- end of functions -->
-
-
-
-
- <section xml:id="if_for_while">
- <title><literal>if</literal>, <literal>for</literal> and <literal>while</literal></title>
-
- <section xml:id="if_for_while_format">
- <title>Format</title>
- <para>To match <literal>cstyle</literal>, the shell token equivalent to the <literal>C</literal>
- "<literal>{</literal>" should appear on the same line, separated by a
- "<literal>;</literal>", as in:
-<programlisting>
-if [ "$x" = "hello" ] ; then
- echo $x
-fi
-
-if [[ "$x" = "hello" ]] ; then
- print $x
-fi
-
-for i in 1 2 3; do
- echo $i
-done
-
-for ((i=0 ; i &lt; 3 ; i++)); do
- print $i
-done
-
-while [ $# -gt 0 ]; do
- echo $1
- shift
-done
-
-while (( $# &gt; 0 )); do
- print $1
- shift
-done
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="test_builtin">
- <title><literal>test</literal> Builtin</title>
- <para>DO NOT use the test builtin. Sorry, executive decision.</para>
- <para>In our Bourne shell, the <literal>test</literal> built-in is the same as the "["
- builtin (if you don't believe me, try "type test" or refer to <filename>usr/src/cmd/sh/msg.c</filename>).</para>
- <para>
- So please do not write:
-<programlisting>
-if test $# -gt 0 ; then
-</programlisting>
-instead use:
-<programlisting>
-if [ $# -gt 0 ] ; then
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="use_ksh_test_syntax">
- <title>&tag_kshonly;&tag_performance;Use "<literal>[[ expr ]]</literal>" instead of "<literal>[ expr ]</literal>"</title>
- <para>Use "<literal>[[ expr ]]</literal>" instead of "<literal>[ expr ]</literal>" if possible
- since it avoids going through the whole pattern expansion/etc. machinery and
- adds additional operators not available in the Bourne shell, such as short-circuit
- <literal>&amp;&amp;</literal> and <literal>||</literal>.
- </para>
- </section>
-
-
- <section xml:id="use_posix_arithmetic_expressions">
- <title>&tag_kshonly; Use "<literal>(( ... ))</literal>" for arithmetic expressions</title>
- <para>Use "<literal>(( ... ))</literal>" instead of "<literal>[ expr ]</literal>"
- or "<literal>[[ expr ]]</literal>" expressions.
- </para>
- <para>
- Example: Replace
-<programlisting>
-i=5
-# do something
-if [ $i -gt 5 ] ; then
-</programlisting>
-with
-<programlisting>
-i=5
-# do something
-if (( i &gt; 5 )) ; then
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="compare_exit_code_using_math">
- <title>&tag_kshonly;&tag_performance;Compare exit code using arithmetic expressions expressions</title>
- <para>Use POSIX arithmetic expressions to test for exit/return codes of commands and functions.
- For example turn
-<programlisting>
-if [ $? -gt 0 ] ; then
-</programlisting>
-into
-<programlisting>
-if (( $? &gt; 0 )) ; then
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="use_builtin_commands_in_loops">
- <title>&tag_bourneonly; Use builtin commands in conditions for <literal>while</literal> endless loops</title>
- <para>Make sure that your shell has a "<literal>true</literal>" builtin (like ksh93) when
- executing endless loops like <literal>$ while true ; do do_something ; done #</literal> -
- otherwise each loop cycle runs a <literal>|fork()|+|exec()|</literal>-cycle to run
- <filename>/bin/true</filename>
- </para>
- </section>
-
-
- <section xml:id="single_line_if_statements">
- <title>Single-line if-statements</title>
- <para>It is permissible to use <literal>&amp;&amp;</literal> and <literal>||</literal> to construct
- shorthand for an "<literal>if</literal>" statement in the case where the if statement has a
- single consequent line:
-<programlisting>
-[ $# -eq 0 ] &amp;&amp; exit 0
-</programlisting>
-instead of the longer:
-<programlisting>
-if [ $# -eq 0 ]; then
- exit 0
-fi
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="exit_status_and_if_for_while">
- <title>Exit Status and <literal>if</literal>/<literal>while</literal> statements</title>
- <para>Recall that "<literal>if</literal>" and "<literal>while</literal>"
- operate on the exit status of the statement
- to be executed. In the shell, zero (0) means true and non-zero means false.
- The exit status of the last command which was executed is available in the $?
- variable. When using "<literal>if</literal>" and "<literal>while</literal>",
- it is typically not necessary to use
- <literal>$?</literal> explicitly, as in:
-<programlisting>
-grep foo /etc/passwd &gt;/dev/null 2>&amp;1
-if [ $? -eq 0 ]; then
- echo "found"
-fi
-</programlisting>
-Instead, you can more concisely write:
-<programlisting>
-if grep foo /etc/passwd &gt;/dev/null 2>&amp;1; then
- echo "found"
-fi
-</programlisting>
-Or, when appropriate:
-<programlisting>
-grep foo /etc/passwd &gt;/dev/null 2>&amp;1 &amp;&amp; echo "found"
-</programlisting>
- </para>
- </section>
-
- </section><!-- end of if/for/while -->
-
-
-
-
-
-
- <section xml:id="variables">
- <title>Variable types, naming and usage</title>
-
- <section xml:id="names_should_be_lowercase">
- <title>Names of local, non-environment, non-constant variables should be lowercase</title>
- <para>Names of variables local to the current script which are not exported to the environment
- should be lowercase while variable names which are exported to the
- environment should be uppercase.</para>
- <para>The only exception are global constants (=global readonly variables,
- e.g. <literal>$ float -r M_PI=3.14159265358979323846 #</literal> (taken from &lt;math.h&gt;))
- which may be allowed to use uppercase names, too.
- </para>
-
- <warning><para>
- Uppercase variable names should be avoided because there is a good chance
- of naming collisions with either special variable names used by the shell
- (e.g. <literal>PWD</literal>, <literal>SECONDS</literal> etc.).
- </para></warning>
- </section>
-
- <section xml:id="do_not_reserved_keywords_for_variable_names">
- <title>Do not use variable names which are reserved keywords/variable names in C/C++/JAVA or the POSIX shell standard</title>
- <para>Do not use variable names which are reserved keywords in C/C++/JAVA or the POSIX shell standard
- (to avoid confusion and/or future changes/updates to the shell language).
- </para>
- <note>
- <para>The Korn Shell and the POSIX shell standard have many more
- reserved variable names than the original Bourne shell. All
- these reserved variable names are spelled uppercase.
- </para>
- </note>
- </section>
-
- <section xml:id="use_brackets_around_long_names">
- <title>Always use <literal>'{'</literal>+<literal>'}'</literal> when using variable
- names longer than one character</title>
- <para>Always use <literal>'{'</literal>+<literal>'}'</literal> when using
- variable names longer than one character unless a simple variable name is
- followed by a blank, <literal>/</literal>, <literal>;</literal>, or <literal>$</literal>
- character (to avoid problems with array,
- compound variables or accidental misinterpretation by users/shell)
-<programlisting>
-print "$foo=info"
-</programlisting>
-should be rewritten to
-<programlisting>
-print "${foo}=info"
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="quote_variables_containing_filenames_or_userinput">
- <title><emphasis>Always</emphasis> put variables into quotes when handling filenames or user input</title>
- <para><emphasis>Always</emphasis> put variables into quotes when handling filenames or user input, even if
- the values are hardcoded or the values appear to be fixed. Otherwise at
- least two things may go wrong:
- <itemizedlist>
- <listitem><para>a malicious user may be able to exploit a script's inner working to
- infect his/her own code</para></listitem>
- <listitem><para>a script may (fatally) misbehave for unexpected input (e.g. file names
- with blanks and/or special symbols which are interpreted by the shell)</para></listitem>
- </itemizedlist>
- </para>
-
- <note><para>
- As alternative a script may set <literal>IFS='' ; set -o noglob</literal> to turn off the
- interpretation of any field seperators and the pattern globbing.
- </para></note>
- </section>
-
-
-
- <section xml:id="use_typed_variables">
- <title>&tag_kshonly;&tag_performance;Use typed variables if possible.</title>
- <para>For example the following is very
- inefficient since it transforms the integer values to strings and back
- several times:
-<programlisting>
-a=0
-b=1
-c=2
-# more code
-if [ $a -lt 5 -o $b -gt c ] ; then do_something ; fi
-</programlisting>
-This could be rewritten using ksh constructs:
-<programlisting>
-integer a=0
-integer b=1
-integer c=2
-# more code
-if (( a &lt; 5 || b &gt; c )) ; then do_something ; fi
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="store_lists_in_arrays">
- <title>&tag_ksh93only; Store lists in arrays or associative arrays</title>
- <para>Store lists in arrays or associative arrays - this is usually easier
- to manage.</para>
- <para>
- For example:
-<programlisting>
-x="
-/etc/foo
-/etc/bar
-/etc/baz
-"
-echo $x
-</programlisting>
-can be replaced with
-<programlisting>
-typeset -a mylist
-mylist[0]="/etc/foo"
-mylist[1]="/etc/bar"
-mylist[2]="/etc/baz"
-print "${mylist[@]}"
-</programlisting>
-or (ksh93-style append entries to a normal (non-associative) array)
-<programlisting>
-typeset -a mylist
-mylist+=( "/etc/foo" )
-mylist+=( "/etc/bar" )
-mylist+=( "/etc/baz" )
-print "${mylist[@]}"
-</programlisting>
- </para>
- <note>
- <title>Difference between expanding arrays with mylist[@] and mylist[*] subscript operators</title>
- <para>
- Arrays may be expanded using two similar subscript operators, @ and *. These subscripts
- differ only when the variable expansion appears within double quotes. If the variable expansion
- is between double-quotes, "${mylist[*]}" expands to a single string with the value of each array
- member separated by the first character of the <envar>IFS</envar> variable, and "${mylist[@]}"
- expands each element of name to a separate string.
- </para>
- <example><title>Difference between [@] and [*] when expanding arrays</title>
-<programlisting>
-typeset -a mylist
-mylist+=( "/etc/foo" )
-mylist+=( "/etc/bar" )
-mylist+=( "/etc/baz" )
-IFS=","
-printf "mylist[*]={ 0=|%s| 1=|%s| 2=|%s| 3=|%s| }\n" "${mylist[*]}"
-printf "mylist[@]={ 0=|%s| 1=|%s| 2=|%s| 3=|%s| }\n" "${mylist[@]}"
-</programlisting>
-<para>will print:</para>
-<screen>
-<computeroutput>mylist[*]={ 0=|/etc/foo,/etc/bar,/etc/baz| 1=|| 2=|| 3=|| }
-mylist[@]={ 0=|/etc/foo| 1=|/etc/bar| 2=|/etc/baz| 3=|| }
-</computeroutput>
-</screen>
- </example>
- </note>
- </section>
-
-
- <section xml:id="use_compound_variables_or_lists_for_grouping">
- <title>&tag_ksh93only; Use compound variables or associative arrays to group similar variables together</title>
- <para>Use compound variables or associative arrays to group similar variables together.</para>
- <para>
- For example:
-<programlisting>
-box_width=56
-box_height=10
-box_depth=19
-echo "${box_width} ${box_height} ${box_depth}"
-</programlisting>
-could be rewritten to ("associative array"-style)
-<programlisting>
-typeset -A -E box=( [width]=56 [height]=10 [depth]=19 )
-print -- "${box[width]} ${box[height]} ${box[depth]}"
-</programlisting>
-or ("compound variable"-style
-<programlisting>
-box=(
- float width=56
- float height=10
- float depth=19
- )
-print -- "${box.width} ${box.height} ${box.depth}"
-</programlisting>
- </para>
- </section>
- </section><!-- end of variables -->
-
-
-
-
-
-
-
- <section xml:id="io">
- <title>I/O</title>
-
- <section xml:id="avoid_echo">
- <title>Avoid using the "<literal>echo</literal>" command for output</title>
- <para>The behaviour of "<literal>echo</literal>" is not portable
- (e.g. System V, BSD, UCB and ksh93/bash shell builtin versions all
- slightly differ in functionality) and should be avoided if possible.
- POSIX defines the "<literal>printf</literal>" command as replacement
- which provides more flexible and portable behaviour.</para>
-
- <note>
- <title>&tag_kshonly;Use "<literal>print</literal>" and not "<literal>echo</literal>" in Korn Shell scripts</title>
- <para>Korn shell scripts should prefer the "<literal>print</literal>"
- builtin which was introduced as replacement for "<literal>echo</literal>".</para>
- <caution>
- <para>Use <literal>$ print -- ${varname}" #</literal> when there is the slightest chance that the
- variable "<literal>varname</literal>" may contain symbols like "-". Or better use "<literal>printf</literal>"
- instead, for example
-<programlisting>
-integer fx
-# do something
-print $fx
-</programlisting>
-may fail if "f" contains a negative value. A better way may be to use
-<programlisting>
-integer fx
-# do something
-printf "%d\n" fx
-</programlisting>
- </para>
- </caution>
- </note>
- </section>
-
- <section xml:id="use_redirect_not_exec_to_open_files">
- <title>&tag_ksh93only;Use <literal>redirect</literal> and not <literal>exec</literal> to open files</title>
- <para>Use <literal>redirect</literal> and not <literal>exec</literal> to open files - <literal>exec</literal>
- will terminate the current function or script if an error occurs while <literal>redirect</literal>
- just returns a non-zero exit code which can be caught.</para>
-<para>Example:
-<programlisting>
-if redirect 5&lt;/etc/profile ; then
- print "file open ok"
- head &lt;&amp;5
-else
- print "could not open file"
-fi
-</programlisting>
- </para>
- </section>
-
- <section xml:id="group_identical_redirections_together">
- <title>&tag_performance;Avoid redirections per command when the output goes into the same file,
- e.g. <literal>$ echo "foo" &gt;xxx ; echo "bar" &gt;&gt;xxx ; echo "baz" &gt;&gt;xxx #</literal></title>
- <para>Each of the redirections above trigger an
- <literal>|open()|,|write()|,|close()|</literal>-sequence. It is much
- more efficient (and faster) to group the rediction into a block,
- e.g. <literal>{ echo "foo" ; echo "bar" ; echo "baz" } &gt;xxx #</literal></para>
- </section>
-
-
- <section xml:id="avoid_using_temporary_files">
- <title>&tag_performance;Avoid the creation of temporary files and store the values in variables instead</title>
- <para>Avoid the creation of temporary files and store the values in variables instead if possible</para>
- <para>
- Example:
-<programlisting>
-ls -1 &gt;xxx
-for i in $(cat xxx) ; do
- do_something ;
-done
-</programlisting>
-can be replaced with
-<programlisting>
-x="$(ls -1)"
-for i in ${x} ; do
- do_something ;
-done
-</programlisting>
- </para>
- <note><para>ksh93 supports binary variables (e.g. <literal>typeset -b varname</literal>) which can hold any value.</para></note>
- </section>
-
-
- <section xml:id="create_subdirs_for_multiple_temporary_files">
- <title>If you create more than one temporary file create an unique subdir</title>
- <para>If you create more than one temporary file create an unique subdir for
- these files and make sure the dir is writable. Make sure you cleanup
- after yourself (unless you are debugging).
- </para>
- </section>
-
-
- <section xml:id="use_dynamic_file_descriptors">
- <title>&tag_ksh93only;Use {n}&lt;file instead of fixed file descriptor numbers</title>
- <para>When opening a file use {n}&lt;file, where <envar>n</envar> is an
- integer variable rather than specifying a fixed descriptor number.</para>
- <para>This is highly recommended in functions to avoid that fixed file
- descriptor numbers interfere with the calling script.</para>
-<example><title>Open a network connection and store the file descriptor number in a variable</title>
-<programlisting>
-function cat_http
-{
- integer netfd
-
-...
-
- # open TCP channel
- redirect {netfd}&lt;&gt;"/dev/tcp/${host}/${port}"
-
- # send HTTP request
- request="GET /${path} HTTP/1.1\n"
- request+="Host: ${host}\n"
- request+="User-Agent: demo code/ksh93 (2007-08-30; $(uname -s -r -p))\n"
- request+="Connection: close\n"
- print "${request}\n" &gt;&amp;${netfd}
-
- # collect response and send it to stdout
- cat &lt;&amp;${netfd}
-
- # close connection
- exec {netfd}&lt;&amp;-
-
-...
-
-}
-</programlisting>
-</example>
- </section>
-
-
- <section xml:id="use_inline_here_documents">
- <title>&tag_ksh93only;&tag_performance;Use inline here documents
- instead of <literal>echo "$x" | command</literal></title>
- <para>Use inline here documents, for example
-<programlisting>
-command &lt;&lt;&lt; $x
-</programlisting>
- rather than
-<programlisting>
-print -r -- "$x" | command
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="use_read_r">
- <title>&tag_ksh93only;Use the <literal>-r</literal> option of <literal>read</literal> to read a line</title>
- <para>Use the <literal>-r</literal> option of <literal>read</literal> to read a line.
- You never know when a line will end in <literal>\</literal> and without a
- <literal>-r</literal> multiple
- lines can be read.</para>
- </section>
-
-
- <section xml:id="print_compound_variables_using_print_C">
- <title>&tag_ksh93only;Print compound variables using <literal>print -C varname</literal> or <literal>print -v varname</literal></title>
- <para>Print compound variables using <literal>print -C varname</literal> or
- <literal>print -v varname</literal> to make sure that non-printable characters
- are correctly encoded.</para>
-<example><title>Print compound variable with non-printable characters</title>
-<programlisting>
-compound x=(
- a=5
- b="hello"
- c=(
- d=9
- e="$(printf "1\v3")" <co xml:id="co.vertical_tab1" />
- )
-)
-print -v x
-</programlisting>
-<para>will print:</para>
-<screen>
-<computeroutput>(
- a=5
- b=hello
- c=(
- d=9
- e=$'1\0133' <co xml:id="co.vertical_tab2" />
- )
-)</computeroutput>
-</screen>
-<calloutlist>
- <callout arearefs="co.vertical_tab1 co.vertical_tab2">
- <para>vertical tab, <literal>\v</literal>, octal=<literal>\013</literal>.</para>
- </callout>
-</calloutlist>
-</example>
- </section>
-
- <section xml:id="command_name_before_redirections">
- <title>Put the command name and arguments before redirections</title>
- <para>Put the command name and arguments before redirections.
- You can legally do <literal>$ &gt; file date</literal> instead of <literal>date &gt; file</literal>
- but don't do it.</para>
- </section>
-
- <section xml:id="enable_gmacs_editor_mode_for_user_prompts">
- <title>&tag_ksh93only;Enable the <literal>gmacs</literal> editor
- mode when reading user input using the <literal>read</literal> builtin</title>
- <para>Enable the <literal>gmacs</literal>editor mode before reading user
- input using the <literal>read</literal> builtin to enable the use of
- cursor+backspace+delete keys in the edit line</para>
-<example><title>Prompt user for a string with gmacs editor mode enabled</title>
-<programlisting>
-set -o gmacs <co xml:id="co.enable_gmacs" />
-typeset inputstring="default value"
-...
-read -v<co xml:id="co.read_v" /> inputstring<co xml:id="co.readvar" />?"Please enter a string: "<co xml:id="co.prompt" />
-...
-printf "The user entered the following string: '%s'\n" "${inputstring}"
-
-...
-</programlisting>
-<calloutlist>
- <callout arearefs="co.enable_gmacs">
- <para>Enable gmacs editor mode.</para>
- </callout>
- <callout arearefs="co.read_v">
- <para>The value of the variable is displayed and used as a default value.</para>
- </callout>
- <callout arearefs="co.readvar">
- <para>Variable used to store the result.</para>
- </callout>
- <callout arearefs="co.prompt">
- <para>Prompt string which is displayed in stderr.</para>
- </callout>
-</calloutlist>
-</example>
- </section>
- </section><!-- end of I/O -->
-
-
-
-
-
-
- <section xml:id="math">
- <title>Math</title>
-
- <section xml:id="use_builtin_arithmetic_expressions">
- <title>&tag_kshonly;&tag_performance;Use builtin arithmetic expressions instead of external applications</title>
- <para>Use builtin (POSIX shell) arithmetic expressions instead of
- <filename>expr</filename>,
- <filename>bc</filename>,
- <filename>dc</filename>,
- <filename>awk</filename>,
- <filename>nawk</filename> or
- <filename>perl</filename>.
- </para>
- <note>
- <para>ksh93 supports C99-like floating-point arithmetic including special values
- such as
- <simplelist type="inline">
- <member>+Inf</member>
- <member>-Inf</member>
- <member>+NaN</member>
- <member>-NaN</member>
- </simplelist>.
- </para>
- </note>
- </section>
-
-
- <section xml:id="use_floating_point_arithmetic_expressions">
- <title>&tag_ksh93only; Use floating-point arithmetic expressions if
- calculations may trigger a division by zero or other exceptions</title>
- <para>Use floating-point arithmetic expressions if calculations may
- trigger a division by zero or other exceptions - floating point arithmetic expressions in
- ksh93 support special values such as <literal>+Inf</literal>/<literal>-Inf</literal> and
- <literal>+NaN</literal>/<literal>-NaN</literal> which can greatly simplify testing for
- error conditions, e.g. instead of a <literal>trap</literal> or explicit
- <literal>if ... then... else</literal> checks for every sub-expression
- you can check the results for such special values.
- </para>
- <para>Example:
-<screen>
-$ <userinput>ksh93 -c 'integer i=0 j=5 ; print -- "x=$((j/i)) "'</userinput>
-<computeroutput>ksh93: line 1: j/i: divide by zero</computeroutput>
-$ <userinput>ksh93 -c 'float i=0 j=-5 ; print -- "x=$((j/i)) "'</userinput>
-<computeroutput>x=-Inf</computeroutput>
-</screen>
- </para>
- </section>
-
-
- <section xml:id="use_printf_a_for_passing_float_values">
- <title>&tag_ksh93only; Use <literal>printf "%a"</literal> when passing floating-point values</title>
- <para>Use <literal>printf "%a"</literal> when passing floating-point values between scripts or
- as output of a function to avoid rounding errors when converting between
- bases.</para>
- <para>
- Example:
-<programlisting>
-function xxx
-{
- float val
-
- (( val=sin(5.) ))
- printf "%a\n" val
-}
-float out
-(( out=$(xxx) ))
-xxx
-print -- $out
-</programlisting>
-This will print:
-<programlisting>
--0.9589242747
--0x1.eaf81f5e09933226af13e5563bc6p-01
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="put_constants_into_readonly_variables">
- <title>&tag_kshonly;&tag_performance;Put constant values into readonly variables</title>
- <para>Put constant values into readonly variables</para>
- <para>For example:
-<programlisting>
-float -r M_PI=3.14159265358979323846
-</programlisting>
-or
-<programlisting>
-float M_PI=3.14159265358979323846
-readonly M_PI
-</programlisting>
- </para>
- </section>
-
-
- <section xml:id="avoid_unnecessary_string_number_conversions">
- <title>&tag_kshonly;&tag_performance;Avoid string to number
- (and/or number to string) conversions in arithmetic expressions
- expressions</title>
- <para>Avoid string to number and/or number to string conversions in
- arithmetic expressions expressions to avoid performance degradation
- and rounding errors.</para>
- <example><title>(( x=$x*2 )) vs. (( x=x*2 ))</title>
-<programlisting>
-float x
-...
-(( x=$x*2 ))
-</programlisting>
-<para>
-will convert the variable "x" (stored in the machine's native
-<literal>|long double|</literal> datatype) to a string value in base10 format,
-apply pattern expansion (globbing), then insert this string into the
-arithmetic expressions and parse the value which converts it into the internal |long double| datatype format again.
-This is both slow and generates rounding errors when converting the floating-point value between
-the internal base2 and the base10 representation of the string.
-</para>
-<para>
-The correct usage would be:
-</para>
-<programlisting>
-float x
-...
-(( x=x*2 ))
-</programlisting>
-<para>
-e.g. omit the '$' because it's (at least) redundant within arithmetic expressions.
-</para>
- </example>
-
-
- <example><title>x=$(( y+5.5 )) vs. (( x=y+5.5 ))</title>
-<programlisting>
-float x
-float y=7.1
-...
-x=$(( y+5.5 ))
-</programlisting>
-<para>
-will calculate the value of <literal>y+5.5</literal>, convert it to a
-base-10 string value amd assign the value to the floating-point variable
-<literal>x</literal> again which will convert the string value back to the
-internal |long double| datatype format again.
-</para>
-<para>
-The correct usage would be:
-</para>
-<programlisting>
-float x
-float y=7.1
-...
-(( x=y+5.5 ))
-</programlisting>
-<para>
-i.e. this will save the string conversions and avoid any base2--&gt;base10--&gt;base2-conversions.
-</para>
- </example>
- </section>
-
-
- <section xml:id="set_lc_numeric_when_using_floating_point">
- <title>&tag_ksh93only;Set <envar>LC_NUMERIC</envar> when using floating-point constants</title>
- <para>Set <envar>LC_NUMERIC</envar> when using floating-point constants to avoid problems with radix-point
- representations which differ from the representation used in the script, for example the <literal>de_DE.*</literal> locale
- use ',' instead of '.' as default radix point symbol.</para>
- <para>For example:
-<programlisting>
-# Make sure all math stuff runs in the "C" locale to avoid problems with alternative
-# radix point representations (e.g. ',' instead of '.' in de_DE.*-locales). This
-# needs to be set _before_ any floating-point constants are defined in this script)
-if [[ "${LC_ALL}" != "" ]] ; then
- export \
- LC_MONETARY="${LC_ALL}" \
- LC_MESSAGES="${LC_ALL}" \
- LC_COLLATE="${LC_ALL}" \
- LC_CTYPE="${LC_ALL}"
- unset LC_ALL
-fi
-export LC_NUMERIC=C
-...
-float -r M_PI=3.14159265358979323846
-</programlisting>
- </para>
-
- <note><para>The environment variable <envar>LC_ALL</envar> always overrides all other <envar>LC_*</envar> variables,
- including <envar>LC_NUMERIC</envar>. The script should always protect itself against custom <envar>LC_NUMERIC</envar> and
- <envar>LC_ALL</envar> values as shown in the example above.
- </para></note>
- </section>
-
-
-
- </section><!-- end of math -->
-
-
-
-
-
-
- <section xml:id="misc">
- <title>Misc</title>
-
- <section xml:id="debug_use_lineno_in_ps4">
- <title>Put <literal>[${LINENO}]</literal> in your <envar>PS4</envar></title>
- <para>Put <literal>[${LINENO}]</literal> in your <envar>PS4</envar> prompt so that you will get line
- numbers with you run with <literal>-x</literal>. If you are looking at performance
- issues put <literal>$SECONDS</literal> in the <envar>PS4</envar> prompt as well.</para>
- </section>
-
- </section><!-- end of misc -->
-
-
-
-
-</section><!-- end of RULES -->
-
-
-
-
-</article>
diff --git a/usr/src/lib/libsldap/Makefile.com b/usr/src/lib/libsldap/Makefile.com
index d03823deb8..0d35b1f794 100644
--- a/usr/src/lib/libsldap/Makefile.com
+++ b/usr/src/lib/libsldap/Makefile.com
@@ -47,7 +47,7 @@ SRCDIR = ../common
CFLAGS += $(CCVERBOSE)
LOCFLAGS += -D_REENTRANT -DSUNW_OPTIONS
CPPFLAGS += -I../common -I$(SRC)/lib/libldap5/include/ldap \
- -I/usr/include/mps $(LOCFLAGS)
+ -I$(ADJUNCT_PROTO)/usr/include/mps $(LOCFLAGS)
LINTFLAGS += -erroff=E_BAD_PTR_CAST_ALIGN
LINTFLAGS64 += -erroff=E_BAD_PTR_CAST_ALIGN
diff --git a/usr/src/lib/libsmartsshd/Makefile b/usr/src/lib/libsmartsshd/Makefile
new file mode 100644
index 0000000000..50d9545ef1
--- /dev/null
+++ b/usr/src/lib/libsmartsshd/Makefile
@@ -0,0 +1,48 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2011 Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.lib
+
+SUBDIRS= $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET = all
+clean := TARGET = clean
+clobber := TARGET = clobber
+install := TARGET = install
+lint := TARGET = lint
+
+.KEEP_STATE:
+
+all clean clobber install lint: $(SUBDIRS)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+_msg:
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/print/printmgr/bin/Makefile b/usr/src/lib/libsmartsshd/Makefile.com
index 2964b6306f..914aab055b 100644
--- a/usr/src/cmd/print/printmgr/bin/Makefile
+++ b/usr/src/lib/libsmartsshd/Makefile.com
@@ -18,34 +18,30 @@
#
# CDDL HEADER END
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2011 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-# Makefile for print manager wrapper script
-#
-include $(SRC)/cmd/Makefile.cmd
-
-PROG = printmgr
-ROOTBIN = $(ROOT)/usr/sadm/admin/bin
+LIBRARY= libsmartsshd.a
+VERS= .1
+OBJECTS= sshd-plugin.o
-ROOTBINPROG = $(PROG:%=$(ROOTBIN)/%)
+include ../../Makefile.lib
+include ../../Makefile.rootfs
-ROOTDIRS = $(ROOT)/usr/sadm/admin \
- $(ROOT)/usr/sadm/admin/bin
+SRCDIR = ../common
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
-.KEEP_STATE:
+CPPFLAGS += -I$(SRCDIR) -D_REENTRANT -D_FILE_OFFSET_BITS=64
+LIBS = $(DYNLIB) $(LINTLIB)
+LDLIBS += -lc -ldoor
-all: $(PROG)
-install: all $(ROOTDIRS) $(ROOTBINPROG)
+$(LINTLIB) := SRCS= $(SRCDIR)/$(LINTSRC)
-$(ROOTBIN)/%: %
- $(INS.file)
+.KEEP_STATE:
-$(ROOTDIRS):
- $(INS.dir)
+all: $(LIBS)
-lint strip _msg:
+lint: lintcheck
-clean clobber:
- -$(RM) $(PROG)
+include ../../Makefile.targ
diff --git a/usr/src/cmd/lp/Makefile.lp.msg b/usr/src/lib/libsmartsshd/amd64/Makefile
index 07ca9b6dff..31be0ef7e6 100644
--- a/usr/src/cmd/lp/Makefile.lp.msg
+++ b/usr/src/lib/libsmartsshd/amd64/Makefile
@@ -20,14 +20,13 @@
# CDDL HEADER END
#
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2002-2003 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2011 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-# cmd/lp/Makefile.lp.msg
+# ident "%Z%%M% %I% %E% SMI"
+#
-$(POFILE): $(POFILES)
- $(BUILDPO.pofiles)
+include ../Makefile.com
+include ../../Makefile.lib.64
-include $(SRC)/Makefile.msg.targ
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpException.java b/usr/src/lib/libsmartsshd/common/llib-lsmartsshd
index 0079965950..ace7017d41 100644
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmHelpException.java
+++ b/usr/src/lib/libsmartsshd/common/llib-lsmartsshd
@@ -19,20 +19,14 @@
*
* CDDL HEADER END
*/
+/*LINTLIBRARY*/
+/*PROTOLIB1*/
/*
*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmHelpException.java
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
*
*/
-package com.sun.admin.pm.client;
-
-import java.lang.*;
+#pragma ident "%Z%%M% %I% %E% SMI"
-class pmHelpException extends Exception {
-}
diff --git a/usr/src/lib/print/libipp-listener/common/mapfile b/usr/src/lib/libsmartsshd/common/mapfile-vers
index 8aaaebddb2..ce5fc7a9c0 100644
--- a/usr/src/lib/print/libipp-listener/common/mapfile
+++ b/usr/src/lib/libsmartsshd/common/mapfile-vers
@@ -18,13 +18,7 @@
#
# CDDL HEADER END
#
-
-#
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# $Id: mapfile 151 2006-04-25 16:55:34Z njacobs $
+# Copyright (c) 2011, Joyent Inc. All rights reserved.
#
#
@@ -43,10 +37,9 @@
$mapfile_version 2
-SYMBOL_VERSION SUNWprivate_1.0 {
- global:
- ipp_configure_operation;
- ipp_process_request;
- local:
- *;
+SYMBOL_VERSION SUNWprivate_1.1 {
+ global:
+ sshd_user_rsa_key_allowed;
+ local:
+ *;
};
diff --git a/usr/src/lib/libsmartsshd/common/sshd-plugin.c b/usr/src/lib/libsmartsshd/common/sshd-plugin.c
new file mode 100644
index 0000000000..4f0f0bc1ad
--- /dev/null
+++ b/usr/src/lib/libsmartsshd/common/sshd-plugin.c
@@ -0,0 +1,123 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <alloca.h>
+#include <door.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <openssl/rsa.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOG_OOM(SZ) fprintf(stderr, "Unable to alloca %d bytes\n", SZ)
+
+static const char *DOOR = "/var/tmp/._joyent_sshd_key_is_authorized";
+static const char *REQ_FMT_STR = "%s %d %s"; /* name uid fp */
+static const int RETURN_SZ = 2;
+
+static const int MAX_ATTEMPTS = 2;
+static const int SLEEP_PERIOD = 1;
+
+static int
+sshd_allowed_in_capi(struct passwd *pw, const char *fp)
+{
+ int allowed = 0;
+ int fd = -1;
+ int blen = 0;
+ int attempts = 0;
+ char *buf = NULL;
+ door_arg_t door_args = {0};
+
+ if (pw == NULL || fp == NULL)
+ return (0);
+
+ blen = snprintf(NULL, 0, REQ_FMT_STR, pw->pw_name, pw->pw_uid, fp) + 1;
+
+ buf = (char *)alloca(blen);
+ if (buf == NULL) {
+ LOG_OOM(blen);
+ return (0);
+ }
+
+ (void) snprintf(buf, blen, REQ_FMT_STR, pw->pw_name, pw->pw_uid, fp);
+ door_args.data_ptr = buf;
+ door_args.data_size = blen;
+
+ door_args.rsize = RETURN_SZ;
+ door_args.rbuf = alloca(RETURN_SZ);
+ if (door_args.rbuf == NULL) {
+ LOG_OOM(RETURN_SZ);
+ return (0);
+ }
+ memset(door_args.rbuf, 0, RETURN_SZ);
+
+ do {
+ fd = open(DOOR, O_RDWR);
+ if (fd < 0)
+ perror("smartplugin: open (of door FD) failed");
+
+ if (door_call(fd, &door_args) < 0) {
+ perror("smartplugin: door_call failed");
+ } else {
+ allowed = atoi(door_args.rbuf);
+ munmap(door_args.rbuf, door_args.rsize);
+ return (allowed);
+ }
+ if (++attempts < MAX_ATTEMPTS)
+ sleep(SLEEP_PERIOD);
+ } while (attempts < MAX_ATTEMPTS);
+
+ return (0);
+}
+
+int
+sshd_user_rsa_key_allowed(struct passwd *pw, RSA *key, const char *fp)
+{
+ return sshd_allowed_in_capi(pw, fp);
+}
+
+int
+sshd_user_dsa_key_allowed(struct passwd *pw, DSA *key, const char *fp)
+{
+ return sshd_allowed_in_capi(pw, fp);
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmtest b/usr/src/lib/libsmartsshd/i386/Makefile
index 70a7770530..2bfe8001d9 100644
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmtest
+++ b/usr/src/lib/libsmartsshd/i386/Makefile
@@ -1,4 +1,3 @@
-#!/bin/sh
#
# CDDL HEADER START
#
@@ -20,9 +19,13 @@
#
# CDDL HEADER END
#
-# Copyright 1999 Sun Microsystems, Inc. All rights reserved.
+#
+# Copyright 2011 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
-/usr/bin/java com.sun.admin.pm.server.Test $1
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libumem/Makefile.com b/usr/src/lib/libumem/Makefile.com
index 0e726c5646..9c10ded585 100644
--- a/usr/src/lib/libumem/Makefile.com
+++ b/usr/src/lib/libumem/Makefile.com
@@ -22,6 +22,8 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
#
# The build process for libumem is sightly different from that used by other
@@ -65,10 +67,12 @@ SRCS_standalone = $(OBJECTS_standalone:%.o=../common/%.c)
# Architecture-dependent files common to both versions of libumem
OBJECTS_common_isadep = \
- asm_subr.o
+ asm_subr.o \
+ umem_genasm.o
SRCS_common_isadep = \
- $(ISASRCDIR)/asm_subr.s
+ $(ISASRCDIR)/asm_subr.s \
+ $(ISASRCDIR)/umem_genasm.c
# Architecture-independent files common to both versions of libumem
OBJECTS_common_common = \
@@ -115,6 +119,8 @@ MAPFILE_SUPPLEMENTAL = $(MAPFILE_SUPPLEMENTAL_$(CURTYPE))
LDLIBS += -lc
+DYNFLAGS += -Wl,-Plibumem_trampoline.so.1
+
LDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -M../common/mapfile-vers \
-M$(MAPFILE_SUPPLEMENTAL) -dy -r
LDFLAGS = $(LDFLAGS_$(CURTYPE))
diff --git a/usr/src/lib/libumem/amd64/umem_genasm.c b/usr/src/lib/libumem/amd64/umem_genasm.c
new file mode 100644
index 0000000000..7dad57505b
--- /dev/null
+++ b/usr/src/lib/libumem/amd64/umem_genasm.c
@@ -0,0 +1,609 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * Don't Panic! If you find the blocks of assembly that follow confusing and
+ * you're questioning why they exist, please go read section 8 of the umem.c big
+ * theory statement. Next familiarize yourself with the malloc and free
+ * implementations in libumem's malloc.c.
+ *
+ * What follows is the amd64 implementation of the thread caching automatic
+ * assembly generation. The amd64 calling conventions are documented in the
+ * 64-bit System V ABI. For our purposes what matters is that our first argument
+ * will come in rdi. Our functions have to preserve rbp, rbx, and r12->r15. We
+ * are free to do whatever we want with rax, rcx, rdx, rsi, rdi, and r8->r11.
+ *
+ * For both our implementation of malloc and free we only use the registers we
+ * don't have to preserve.
+ *
+ * Malloc register usage:
+ * o. rdi: Original size to malloc. This never changes and is preserved.
+ * o. rsi: Adjusted malloc size for malloc_data_tag(s).
+ * o. rcx: Pointer to the tmem_t in the ulwp_t.
+ * o. rdx: Pointer to the tmem_t array of roots
+ * o. r8: Size of the cache
+ * o. r9: Scratch register
+ *
+ * Free register usage:
+ * o. rdi: Original buffer to free. This never changes and is preserved.
+ * o. rax: The actual buffer, adjusted for the hidden malloc_data_t(s).
+ * o. rcx: Pointer to the tmem_t in the ulwp_t.
+ * o. rdx: Pointer to the tmem_t array of roots
+ * o. r8: Size of the cache
+ * o. r9: Scratch register
+ *
+ * Once we determine what cache we are using, we increment %rdx to the
+ * appropriate offset and set %r8 with the size of the cache. This means that
+ * when we break out to the normal buffer allocation point %rdx contains the
+ * head of the linked list and %r8 is the amount that we have to adjust the
+ * thread's cached amount by.
+ *
+ * Each block of assembly has psuedocode that describes its purpose.
+ */
+
+#include <atomic.h>
+#include <inttypes.h>
+#include <sys/types.h>
+#include <strings.h>
+#include <umem_impl.h>
+#include "umem_base.h"
+
+int umem_genasm_supported = 1;
+uintptr_t umem_genasm_mptr;
+uintptr_t umem_genasm_msize;
+uintptr_t umem_genasm_fptr;
+uintptr_t umem_genasm_fsize;
+static uintptr_t umem_genasm_omptr;
+static uintptr_t umem_genasm_ofptr;
+
+#define UMEM_GENASM_MAX64 (UINT32_MAX / sizeof (uintptr_t))
+#define PTC_JMPADDR(dest, src) (dest - (src + 4))
+#define PTC_ROOT_SIZE sizeof (uintptr_t)
+#define MULTINOP 0x0000441f0f
+
+/*
+ * void *ptcmalloc(size_t orig_size);
+ *
+ * size_t size = orig_size + 8;
+ * if (size > UMEM_SECOND_ALIGN)
+ * size += 8;
+ *
+ * if (size < orig_size)
+ * goto tomalloc; ! This is overflow
+ *
+ * if (size > cache_max)
+ * goto tomalloc
+ *
+ * tmem_t *t = (uintptr_t)curthread() + umem_thr_offset;
+ * void **roots = t->tm_roots;
+ */
+#define PTC_MALINIT_JOUT 0x13
+#define PTC_MALINIT_MCS 0x1a
+#define PTC_MALINIT_JOV 0x20
+#define PTC_MALINIT_SOFF 0x30
+static const uint8_t malinit[] = {
+ 0x48, 0x8d, 0x77, 0x08, /* leaq 0x8(%rdi),%rsi */
+ 0x48, 0x83, 0xfe, 0x10, /* cmpq $0x10, %rsi */
+ 0x76, 0x04, /* jbe +0x4 */
+ 0x48, 0x8d, 0x77, 0x10, /* leaq 0x10(%rdi),%rsi */
+ 0x48, 0x39, 0xfe, /* cmpq %rdi,%rsi */
+ 0x0f, 0x82, 0x00, 0x00, 0x00, 0x00, /* jb +errout */
+ 0x48, 0x81, 0xfe,
+ 0x00, 0x00, 0x00, 0x00, /* cmpq sizeof ($CACHE), %rsi */
+ 0x0f, 0x87, 0x00, 0x00, 0x00, 0x00, /* ja +errout */
+ 0x64, 0x48, 0x8b, 0x0c, 0x25,
+ 0x00, 0x00, 0x00, 0x00, /* movq %fs:0x0,%rcx */
+ 0x48, 0x81, 0xc1,
+ 0x00, 0x00, 0x00, 0x00, /* addq $SOFF, %rcx */
+ 0x48, 0x8d, 0x51, 0x08, /* leaq 0x8(%rcx),%rdx */
+};
+
+/*
+ * void ptcfree(void *buf);
+ *
+ * if (buf == NULL)
+ * return;
+ *
+ * malloc_data_t *tag = buf;
+ * tag--;
+ * int size = tag->malloc_size;
+ * int tagval = UMEM_MALLOC_DECODE(tag->malloc_tag, size);
+ * if (tagval == MALLOC_SECOND_MAGIC) {
+ * tag--;
+ * } else if (tagval != MALLOC_MAGIC) {
+ * goto tofree;
+ * }
+ *
+ * if (size > cache_max)
+ * goto tofree;
+ *
+ * tmem_t *t = (uintptr_t)curthread() + umem_thr_offset;
+ * void **roots = t->tm_roots;
+ */
+#define PTC_FRINI_JDONE 0x05
+#define PTC_FRINI_JFREE 0x25
+#define PTC_FRINI_MCS 0x30
+#define PTC_FRINI_JOV 0x36
+#define PTC_FRINI_SOFF 0x46
+static const uint8_t freeinit[] = {
+ 0x48, 0x85, 0xff, /* testq %rdi,%rdi */
+ 0x0f, 0x84, 0x00, 0x00, 0x00, 0x00, /* jmp $JDONE (done) */
+ 0x8b, 0x77, 0xf8, /* movl -0x8(%rdi),%esi */
+ 0x8b, 0x47, 0xfc, /* movl -0x4(%rdi),%eax */
+ 0x01, 0xf0, /* addl %esi,%eax */
+ 0x3d, 0x00, 0x70, 0xba, 0x16, /* cmpl $MALLOC_2_MAGIC, %eax */
+ 0x75, 0x06, /* jne +0x6 (checkover) */
+ 0x48, 0x8d, 0x47, 0xf0, /* leaq -0x10(%rdi),%eax */
+ 0xeb, 0x0f, /* jmp +0xf (freebuf) */
+ 0x3d, 0x00, 0xc0, 0x10, 0x3a, /* cmpl $MALLOC_MAGIC, %eax */
+ 0x0f, 0x85, 0x00, 0x00, 0x00, 0x00, /* jmp +JFREE (goto torfree) */
+ 0x48, 0x8d, 0x47, 0xf8, /* leaq -0x8(%rdi),%rax */
+ 0x48, 0x81, 0xfe,
+ 0x00, 0x00, 0x00, 0x00, /* cmpq sizeof ($CACHE), %rsi */
+ 0x0f, 0x87, 0x00, 0x00, 0x00, 0x00, /* ja +errout */
+ 0x64, 0x48, 0x8b, 0x0c, 0x25,
+ 0x00, 0x00, 0x00, 0x00, /* movq %fs:0x0,%rcx */
+ 0x48, 0x81, 0xc1,
+ 0x00, 0x00, 0x00, 0x00, /* addq $SOFF, %rcx */
+ 0x48, 0x8d, 0x51, 0x08, /* leaq 0x8(%rcx),%rdx */
+};
+
+/*
+ * if (size <= $CACHE_SIZE) {
+ * csize = $CACHE_SIZE;
+ * } else ... ! goto next cache
+ */
+#define PTC_INICACHE_CMP 0x03
+#define PTC_INICACHE_SIZE 0x0c
+#define PTC_INICACHE_JMP 0x11
+static const uint8_t inicache[] = {
+ 0x48, 0x81, 0xfe,
+ 0x00, 0x00, 0x00, 0x00, /* cmpq sizeof ($CACHE), %rsi */
+ 0x77, 0x0c, /* ja +0xc (next cache) */
+ 0x49, 0xc7, 0xc0,
+ 0x00, 0x00, 0x00, 0x00, /* movq sizeof ($CACHE), %r8 */
+ 0xe9, 0x00, 0x00, 0x00, 0x00, /* jmp $JMP (allocbuf) */
+};
+
+/*
+ * if (size <= $CACHE_SIZE) {
+ * csize = $CACHE_SIZE;
+ * roots += $CACHE_NUM;
+ * } else ... ! goto next cache
+ */
+#define PTC_GENCACHE_CMP 0x03
+#define PTC_GENCACHE_SIZE 0x0c
+#define PTC_GENCACHE_NUM 0x13
+#define PTC_GENCACHE_JMP 0x18
+static const uint8_t gencache[] = {
+ 0x48, 0x81, 0xfe,
+ 0x00, 0x00, 0x00, 0x00, /* cmpq sizeof ($CACHE), %rsi */
+ 0x77, 0x14, /* ja +0xc (next cache) */
+ 0x49, 0xc7, 0xc0,
+ 0x00, 0x00, 0x00, 0x00, /* movq sizeof ($CACHE), %r8 */
+ 0x48, 0x81, 0xc2,
+ 0x00, 0x00, 0x00, 0x00, /* addq $8*ii, %rdx */
+ 0xe9, 0x00, 0x00, 0x00, 0x00 /* jmp +$JMP (allocbuf ) */
+};
+
+/*
+ * else if (size <= $CACHE_SIZE) {
+ * csize = $CACHE_SIZE;
+ * roots += $CACHE_NUM;
+ * } else {
+ * goto tofunc; ! goto tomalloc if ptcmalloc.
+ * } ! goto tofree if ptcfree.
+ */
+#define PTC_FINCACHE_CMP 0x03
+#define PTC_FINCACHE_JMP 0x08
+#define PTC_FINCACHE_SIZE 0x0c
+#define PTC_FINCACHE_NUM 0x13
+static const uint8_t fincache[] = {
+ 0x48, 0x81, 0xfe,
+ 0x00, 0x00, 0x00, 0x00, /* cmpq sizeof ($CACHE), %rsi */
+ 0x77, 0x00, /* ja +JMP (to real malloc) */
+ 0x49, 0xc7, 0xc0,
+ 0x00, 0x00, 0x00, 0x00, /* movq sizeof ($CACHE), %r8 */
+ 0x48, 0x81, 0xc2,
+ 0x00, 0x00, 0x00, 0x00, /* addq $8*ii, %rdx */
+
+};
+
+/*
+ * if (*root == NULL)
+ * goto tomalloc;
+ *
+ * malloc_data_t *ret = *root;
+ * *root = *(void **)ret;
+ * t->tm_size += csize;
+ * ret->malloc_size = size;
+ *
+ * if (size > UMEM_SECOND_ALIGN) {
+ * ret->malloc_data = UMEM_MALLOC_ENCODE(MALLOC_SECOND_MAGIC, size);
+ * ret += 2;
+ * } else {
+ * ret->malloc_data = UMEM_MALLOC_ENCODE(MALLOC_SECOND_MAGIC, size);
+ * ret += 1;
+ * }
+ *
+ * return ((void *)ret);
+ * tomalloc:
+ * return (malloc(orig_size));
+ */
+#define PTC_MALFINI_ALLABEL 0x00
+#define PTC_MALFINI_JMLABEL 0x40
+#define PTC_MALFINI_JMADDR 0x41
+static const uint8_t malfini[] = {
+ 0x48, 0x8b, 0x02, /* movl (%rdx),%rax */
+ 0x48, 0x85, 0xc0, /* testq %rax,%rax */
+ 0x74, 0x38, /* je +0x38 (errout) */
+ 0x4c, 0x8b, 0x08, /* movq (%rax),%r9 */
+ 0x4c, 0x89, 0x0a, /* movq %r9,(%rdx) */
+ 0x4c, 0x29, 0x01, /* subq %rsi,(%rcx) */
+ 0x48, 0x83, 0xfe, 0x10, /* cmpq $0x10,%rsi */
+ 0x76, 0x15, /* jbe +0x15 */
+ 0x41, 0xb9, 0x00, 0x70, 0xba, 0x16, /* movl $MALLOC_MAGIC_2, %r9d */
+ 0x89, 0x70, 0x08, /* movl %r9d,0x8(%rax) */
+ 0x41, 0x29, 0xf1, /* subl %esi, %r9d */
+ 0x44, 0x89, 0x48, 0x0c, /* movl %r9d, 0xc(%rax) */
+ 0x48, 0x83, 0xc0, 0x10, /* addq $0x10, %rax */
+ 0xc3, /* ret */
+ 0x41, 0xb9, 0x00, 0xc0, 0x10, 0x3a, /* movl %MALLOC_MAGIC, %r9d */
+ 0x89, 0x30, /* movl %esi,(%rax) */
+ 0x41, 0x29, 0xf1, /* subl %esi,%r9d */
+ 0x44, 0x89, 0x48, 0x04, /* movl %r9d,0x4(%rax) */
+ 0x48, 0x83, 0xc0, 0x08, /* addq $0x8,%rax */
+ 0xc3, /* ret */
+ 0xe9, 0x00, 0x00, 0x00, 0x00 /* jmp $MALLOC */
+};
+
+/*
+ * if (t->tm_size + csize > umem_ptc_size)
+ * goto tofree;
+ *
+ * t->tm_size += csize
+ * *(void **)tag = *root;
+ * *root = tag;
+ * return;
+ * tofree:
+ * free(buf);
+ * return;
+ */
+#define PTC_FRFINI_RBUFLABEL 0x00
+#define PTC_FRFINI_CACHEMAX 0x09
+#define PTC_FRFINI_DONELABEL 0x1b
+#define PTC_FRFINI_JFLABEL 0x1c
+#define PTC_FRFINI_JFADDR 0x1d
+static const uint8_t freefini[] = {
+ 0x4c, 0x8b, 0x09, /* movq (%rcx),%r9 */
+ 0x4d, 0x01, 0xc1, /* addq %r8, %r9 */
+ 0x49, 0x81, 0xf9,
+ 0x00, 0x00, 0x00, 0x00, /* cmpl $THR_CACHE_MAX, %r9 */
+ 0x77, 0x0d, /* jae +0xd (torfree) */
+ 0x4c, 0x01, 0x01, /* addq %r8,(%rcx) */
+ 0x4c, 0x8b, 0x0a, /* movq (%rdx),%r9 */
+ 0x4c, 0x89, 0x08, /* movq %r9,(%rax) */
+ 0x48, 0x89, 0x02, /* movq %rax,(%rdx) */
+ 0xc3, /* ret */
+ 0xe9, 0x00, 0x00, 0x00, 0x00 /* jmp free */
+};
+
+/*
+ * Construct the initial part of malloc. off contains the offset from curthread
+ * to the root of the tmem structure. ep is the address of the label to error
+ * and jump to free. csize is the size of the largest umem_cache in ptcumem.
+ */
+static int
+genasm_malinit(uint8_t *bp, uint32_t off, uint32_t ep, uint32_t csize)
+{
+ uint32_t addr;
+
+ bcopy(malinit, bp, sizeof (malinit));
+ addr = PTC_JMPADDR(ep, PTC_MALINIT_JOUT);
+ bcopy(&addr, bp + PTC_MALINIT_JOUT, sizeof (addr));
+ bcopy(&csize, bp + PTC_MALINIT_MCS, sizeof (csize));
+ addr = PTC_JMPADDR(ep, PTC_MALINIT_JOV);
+ bcopy(&addr, bp + PTC_MALINIT_JOV, sizeof (addr));
+ bcopy(&off, bp + PTC_MALINIT_SOFF, sizeof (off));
+
+ return (sizeof (malinit));
+}
+
+static int
+genasm_frinit(uint8_t *bp, uint32_t off, uint32_t dp, uint32_t ep, uint32_t mcs)
+{
+ uint32_t addr;
+
+ bcopy(freeinit, bp, sizeof (freeinit));
+ addr = PTC_JMPADDR(dp, PTC_FRINI_JDONE);
+ bcopy(&addr, bp + PTC_FRINI_JDONE, sizeof (addr));
+ addr = PTC_JMPADDR(ep, PTC_FRINI_JFREE);
+ bcopy(&addr, bp + PTC_FRINI_JFREE, sizeof (addr));
+ bcopy(&mcs, bp + PTC_FRINI_MCS, sizeof (mcs));
+ addr = PTC_JMPADDR(ep, PTC_FRINI_JOV);
+ bcopy(&addr, bp + PTC_FRINI_JOV, sizeof (addr));
+ bcopy(&off, bp + PTC_FRINI_SOFF, sizeof (off));
+ return (sizeof (freeinit));
+}
+
+
+/*
+ * Create the initial cache entry of the specified size. The value of ap tells
+ * us what the address of the label to try and allocate a buffer. This value is
+ * an offset from the current base to that value.
+ */
+static int
+genasm_firstcache(uint8_t *bp, uint32_t csize, uint32_t ap)
+{
+ uint32_t addr;
+
+ bcopy(inicache, bp, sizeof (inicache));
+ bcopy(&csize, bp + PTC_INICACHE_CMP, sizeof (csize));
+ bcopy(&csize, bp + PTC_INICACHE_SIZE, sizeof (csize));
+ addr = PTC_JMPADDR(ap, PTC_INICACHE_JMP);
+ ASSERT(addr != 0);
+ bcopy(&addr, bp + PTC_INICACHE_JMP, sizeof (addr));
+
+ return (sizeof (inicache));
+}
+
+static int
+genasm_gencache(uint8_t *bp, int num, uint32_t csize, uint32_t ap)
+{
+ uint32_t addr;
+ uint32_t coff;
+
+ ASSERT(UINT32_MAX / PTC_ROOT_SIZE > num);
+ ASSERT(num != 0);
+ bcopy(gencache, bp, sizeof (gencache));
+ bcopy(&csize, bp + PTC_GENCACHE_CMP, sizeof (csize));
+ bcopy(&csize, bp + PTC_GENCACHE_SIZE, sizeof (csize));
+ coff = num * PTC_ROOT_SIZE;
+ bcopy(&coff, bp + PTC_GENCACHE_NUM, sizeof (coff));
+ addr = PTC_JMPADDR(ap, PTC_GENCACHE_JMP);
+ bcopy(&addr, bp + PTC_GENCACHE_JMP, sizeof (addr));
+
+ return (sizeof (gencache));
+}
+
+static int
+genasm_lastcache(uint8_t *bp, int num, uint32_t csize, uint32_t ep)
+{
+ uint8_t eap;
+ uint32_t coff;
+
+ ASSERT(ep <= 0xff && ep > 7);
+ ASSERT(UINT32_MAX / PTC_ROOT_SIZE > num);
+ bcopy(fincache, bp, sizeof (fincache));
+ bcopy(&csize, bp + PTC_FINCACHE_CMP, sizeof (csize));
+ bcopy(&csize, bp + PTC_FINCACHE_SIZE, sizeof (csize));
+ coff = num * PTC_ROOT_SIZE;
+ bcopy(&coff, bp + PTC_FINCACHE_NUM, sizeof (coff));
+ eap = ep - PTC_FINCACHE_JMP - 1;
+ bcopy(&eap, bp + PTC_FINCACHE_JMP, sizeof (eap));
+
+ return (sizeof (fincache));
+}
+
+static int
+genasm_malfini(uint8_t *bp, uintptr_t mptr)
+{
+ uint32_t addr;
+
+ bcopy(malfini, bp, sizeof (malfini));
+ addr = PTC_JMPADDR(mptr, ((uintptr_t)bp + PTC_MALFINI_JMADDR));
+ bcopy(&addr, bp + PTC_MALFINI_JMADDR, sizeof (addr));
+
+ return (sizeof (malfini));
+}
+
+static int
+genasm_frfini(uint8_t *bp, uint32_t maxthr, uintptr_t fptr)
+{
+ uint32_t addr;
+
+ bcopy(freefini, bp, sizeof (freefini));
+ bcopy(&maxthr, bp + PTC_FRFINI_CACHEMAX, sizeof (maxthr));
+ addr = PTC_JMPADDR(fptr, ((uintptr_t)bp + PTC_FRFINI_JFADDR));
+ bcopy(&addr, bp + PTC_FRFINI_JFADDR, sizeof (addr));
+
+ return (sizeof (freefini));
+}
+
+/*
+ * The malloc inline assembly is constructed as follows:
+ *
+ * o Malloc prologue assembly
+ * o Generic first-cache check
+ * o n Generic cache checks (where n = _tmem_get_entries() - 2)
+ * o Generic last-cache check
+ * o Malloc epilogue assembly
+ *
+ * Generally there are at least three caches. When there is only one cache we
+ * only use the generic last-cache. In the case where there are two caches, we
+ * just leave out the middle ones.
+ */
+static int
+genasm_malloc(void *base, size_t len, int nents, int *umem_alloc_sizes)
+{
+ int ii, off;
+ uint8_t *bp;
+ size_t total;
+ uint32_t allocoff, erroff;
+
+ total = sizeof (malinit) + sizeof (malfini) + sizeof (fincache);
+
+ if (nents >= 2)
+ total += sizeof (inicache) + sizeof (gencache) * (nents - 2);
+
+ if (total > len)
+ return (1);
+
+ erroff = total - sizeof (malfini) + PTC_MALFINI_JMLABEL;
+ allocoff = total - sizeof (malfini) + PTC_MALFINI_ALLABEL;
+
+ bp = base;
+
+ off = genasm_malinit(bp, umem_tmem_off, erroff,
+ umem_alloc_sizes[nents-1]);
+ bp += off;
+ allocoff -= off;
+ erroff -= off;
+
+ if (nents > 1) {
+ off = genasm_firstcache(bp, umem_alloc_sizes[0], allocoff);
+ bp += off;
+ allocoff -= off;
+ erroff -= off;
+ }
+
+ for (ii = 1; ii < nents - 1; ii++) {
+ off = genasm_gencache(bp, ii, umem_alloc_sizes[ii], allocoff);
+ bp += off;
+ allocoff -= off;
+ erroff -= off;
+ }
+
+ bp += genasm_lastcache(bp, nents - 1, umem_alloc_sizes[nents - 1],
+ erroff);
+ bp += genasm_malfini(bp, umem_genasm_omptr);
+ ASSERT(((uintptr_t)bp - total) == (uintptr_t)base);
+
+ return (0);
+}
+
+static int
+genasm_free(void *base, size_t len, int nents, int *umem_alloc_sizes)
+{
+ uint8_t *bp;
+ int ii, off;
+ size_t total;
+ uint32_t rbufoff, retoff, erroff;
+
+ /* Assume that nents has already been audited for us */
+ total = sizeof (freeinit) + sizeof (freefini) + sizeof (fincache);
+ if (nents >= 2)
+ total += sizeof (inicache) + sizeof (gencache) * (nents - 2);
+
+ if (total > len)
+ return (1);
+
+ erroff = total - (sizeof (freefini) - PTC_FRFINI_JFLABEL);
+ rbufoff = total - (sizeof (freefini) - PTC_FRFINI_RBUFLABEL);
+ retoff = total - (sizeof (freefini) - PTC_FRFINI_DONELABEL);
+
+ bp = base;
+
+ off = genasm_frinit(bp, umem_tmem_off, retoff, erroff,
+ umem_alloc_sizes[nents - 1]);
+ bp += off;
+ erroff -= off;
+ rbufoff -= off;
+
+ if (nents > 1) {
+ off = genasm_firstcache(bp, umem_alloc_sizes[0], rbufoff);
+ bp += off;
+ erroff -= off;
+ rbufoff -= off;
+ }
+
+ for (ii = 1; ii < nents - 1; ii++) {
+ off = genasm_gencache(bp, ii, umem_alloc_sizes[ii], rbufoff);
+ bp += off;
+ rbufoff -= off;
+ erroff -= off;
+ }
+
+ bp += genasm_lastcache(bp, nents - 1, umem_alloc_sizes[nents - 1],
+ erroff);
+ bp += genasm_frfini(bp, umem_ptc_size, umem_genasm_ofptr);
+ ASSERT(((uintptr_t)bp - total) == (uintptr_t)base);
+
+ return (0);
+}
+
+/*ARGSUSED*/
+int
+umem_genasm(int *cp, umem_cache_t **caches, int nc)
+{
+ int nents, i;
+ uint8_t *mptr;
+ uint8_t *fptr;
+ uint32_t *ptr;
+ uint64_t v, *vptr;
+
+ mptr = (void *)((uintptr_t)&umem_genasm_mptr + 5);
+ fptr = (void *)((uintptr_t)&umem_genasm_fptr + 5);
+ if (umem_genasm_mptr == 0 || umem_genasm_msize == 0 ||
+ umem_genasm_fptr == 0 || umem_genasm_fsize == 0)
+ return (1);
+
+ /*
+ * The total number of caches that we can service is the minimum of:
+ * o the amount supported by libc
+ * o the total number of umem caches
+ * o we use a single byte addl, so its MAX_UINT32 / sizeof (uintptr_t).
+ * For 64-bit, this is MAX_UINT32 >> 3, a lot.
+ */
+ nents = _tmem_get_nentries();
+
+ if (UMEM_GENASM_MAX64 < nents)
+ nents = UMEM_GENASM_MAX64;
+
+ if (nc < nents)
+ nents = nc;
+
+ /* Based on our constraints, this is not an error */
+ if (nents == 0 || umem_ptc_size == 0)
+ return (0);
+
+ /* Grab the original malloc and free locations */
+ ptr = (void *)(mptr - 4);
+ umem_genasm_omptr = *ptr + (uintptr_t)mptr;
+ ptr = (void *)(fptr - 4);
+ umem_genasm_ofptr = *ptr + (uintptr_t)fptr;
+
+ /* Take into account the jump */
+ if (genasm_malloc(mptr, umem_genasm_fsize - 5, nents, cp) != 0)
+ return (1);
+
+ if (genasm_free(fptr, umem_genasm_fsize - 5, nents, cp) != 0)
+ return (1);
+
+ /* nop out the jump with a multibyte jump */
+ vptr = (void *)&umem_genasm_mptr;
+ v = MULTINOP;
+ v |= *vptr & (0xffffffULL << 40);
+ (void) atomic_swap_64(vptr, v);
+ vptr = (void *)&umem_genasm_fptr;
+ v = MULTINOP;
+ v |= *vptr & (0xffffffULL << 40);
+ (void) atomic_swap_64(vptr, v);
+
+
+ for (i = 0; i < nents; i++)
+ caches[i]->cache_flags |= UMF_PTC;
+
+ return (0);
+}
diff --git a/usr/src/lib/libumem/common/envvar.c b/usr/src/lib/libumem/common/envvar.c
index fc3d490a01..2fdf7824c3 100644
--- a/usr/src/lib/libumem/common/envvar.c
+++ b/usr/src/lib/libumem/common/envvar.c
@@ -25,6 +25,10 @@
* Copyright 2012 Joyent, Inc. All rights reserved.
*/
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ */
+
#include <ctype.h>
#include <errno.h>
#include <limits.h>
@@ -151,7 +155,10 @@ static umem_env_item_t umem_options_items[] = {
NULL, 0, NULL, &vmem_sbrk_pagesize
},
#endif
-
+ { "perthread_cache", "Evolving", ITEM_SIZE,
+ "Size (in bytes) of per-thread allocation cache",
+ NULL, 0, NULL, &umem_ptc_size
+ },
{ NULL, "-- end of UMEM_OPTIONS --", ITEM_INVALID }
};
diff --git a/usr/src/lib/libumem/common/mapfile-vers b/usr/src/lib/libumem/common/mapfile-vers
index 102bd989f7..6a05f0cfaa 100644
--- a/usr/src/lib/libumem/common/mapfile-vers
+++ b/usr/src/lib/libumem/common/mapfile-vers
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
#
@@ -72,6 +73,10 @@ SYMBOL_VERSION SUNWprivate_1.1 {
vmem_walk;
vmem_xalloc;
vmem_xfree;
+ umem_genasm_mptr;
+ umem_genasm_fptr;
+ umem_genasm_fsize;
+ umem_genasm_msize;
local:
*;
};
diff --git a/usr/src/lib/libumem/common/stub_stand.c b/usr/src/lib/libumem/common/stub_stand.c
index 54635558c3..1a90c6be75 100644
--- a/usr/src/lib/libumem/common/stub_stand.c
+++ b/usr/src/lib/libumem/common/stub_stand.c
@@ -23,6 +23,9 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
/*
* Stubs for the standalone to reduce the dependence on external libraries
@@ -125,3 +128,29 @@ issetugid(void)
{
return (1);
}
+
+int
+_tmem_get_nentries(void)
+{
+ return (0);
+}
+
+uintptr_t
+_tmem_get_base(void)
+{
+ return (0);
+}
+
+/*ARGSUSED*/
+void
+_tmem_set_cleanup(void (*f)(int, void *))
+{
+}
+
+uint64_t
+atomic_swap_64(volatile uint64_t *t, uint64_t v)
+{
+ uint64_t old = *t;
+ *t = v;
+ return (old);
+}
diff --git a/usr/src/lib/libumem/common/umem.c b/usr/src/lib/libumem/common/umem.c
index a3eb0b8e6c..e22106e979 100644
--- a/usr/src/lib/libumem/common/umem.c
+++ b/usr/src/lib/libumem/common/umem.c
@@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ */
/*
* based on usr/src/uts/common/os/kmem.c r1.64 from 2001/12/18
@@ -44,7 +46,7 @@
*
* 1. Overview
* -----------
- * umem is very close to kmem in implementation. There are four major
+ * umem is very close to kmem in implementation. There are seven major
* areas of divergence:
*
* * Initialization
@@ -57,6 +59,10 @@
*
* * lock ordering
*
+ * * changing UMEM_MAXBUF
+ *
+ * * Per-thread caching for malloc/free
+ *
* 2. Initialization
* -----------------
* kmem is initialized early on in boot, and knows that no one will call
@@ -355,6 +361,248 @@
* umem_log_header_t's:
* lh_cpu[*].clh_lock
* lh_lock
+ *
+ * 7. Changing UMEM_MAXBUF
+ * -----------------------
+ *
+ * When changing UMEM_MAXBUF extra care has to be taken. It is not sufficient to
+ * simply increase this number. First, one must update the umem_alloc_table to
+ * have the appropriate number of entires based upon the new size. If this is
+ * not done, this will lead to libumem blowing an assertion.
+ *
+ * The second place to update, which is not required, is the umem_alloc_sizes.
+ * These determine the default cache sizes that we're going to support.
+ *
+ * 8. Per-thread caching for malloc/free
+ * -------------------------------------
+ *
+ * "Time is an illusion. Lunchtime doubly so." -- Douglas Adams
+ *
+ * Time may be an illusion, but CPU cycles aren't. While libumem is designed
+ * to be a highly scalable allocator, that scalability comes with a fixed cycle
+ * penalty even in the absence of contention: libumem must acquire (and release
+ * a per-CPU lock for each allocation. When contention is low and malloc(3C)
+ * frequency is high, this overhead can dominate execution time. To alleviate
+ * this, we allow for per-thread caching, a lock-free means of caching recent
+ * deallocations on a per-thread basis for use in satisfying subsequent calls
+ *
+ * In addition to improving performance, we also want to:
+ * * Minimize fragmentation
+ * * Not add additional memory overhead (no larger malloc tags)
+ *
+ * In the ulwp_t of each thread there is a private data structure called a
+ * umem_t that looks like:
+ *
+ * typedef struct {
+ * size_t tm_size;
+ * void *tm_roots[NTMEMBASE]; (Currently 16)
+ * } tmem_t;
+ *
+ * Each of the roots is treated as the head of a linked list. Each entry in the
+ * list can be thought of as a void ** which points to the next entry, until one
+ * of them points to NULL. If the head points to NULL, the list is empty.
+ *
+ * Each head corresponds to a umem_cache. Currently there is a linear mapping
+ * where the first root corresponds to the first cache, second root to the
+ * second cache, etc. This works because every allocation that malloc makes to
+ * umem_alloc that can be satisified by a umem_cache will actually return a
+ * number of bytes equal to the size of that cache. Because of this property and
+ * a one to one mapping between caches and roots we can guarantee that every
+ * entry in a given root's list will be able to satisfy the same requests as the
+ * corresponding cache.
+ *
+ * The maximum amount of memory that can be cached in each thread is determined
+ * by the perthread_cache UMEM_OPTION. It corresponds to the umem_ptc_size
+ * value. The default value for this is currently 1 MB. Once umem_init() has
+ * finished this cannot be directly tuned without directly modifying the
+ * instruction text. If, upon calling free(3C), the amount cached would exceed
+ * this maximum, we instead actually return the buffer to the umem_cache instead
+ * of holding onto it in the thread.
+ *
+ * When a thread calls malloc(3C) it first determines which umem_cache it
+ * would be serviced by. If the allocation is not covered by ptcumem it goes to
+ * the normal malloc instead. Next, it checks if the tmem_root's list is empty
+ * or not. If it is empty, we instead go and allocate the memory from
+ * umem_alloc. If it is not empty, we remove the head of the list, set the
+ * appropriate malloc tags, and return that buffer.
+ *
+ * When a thread calls free(3C) it first looks at the malloc tag and if it is
+ * invalid or the allocation exceeds the largest cache in ptcumem and sends it
+ * off to the original free() to handle and clean up appropriately. Next, it
+ * checks if the allocation size is covered by one of the per-thread roots and
+ * if it isn't, it passes it off to the original free() to be released. Finally,
+ * before it inserts this buffer as the head, it checks if adding this buffer
+ * would put the thread over its maximum cache size. If it would, it frees the
+ * buffer back to the umem_cache. Otherwise it increments the threads total
+ * cached amount and makes the buffer the new head of the appropriate tm_root.
+ *
+ * When a thread exits, all of the buffers that it has in its per-thread cache
+ * will be passed to umem_free() and returned to the appropriate umem_cache.
+ *
+ * 8.1 Handling addition and removal of umem_caches
+ * ------------------------------------------------
+ *
+ * The set of umem_caches that are used to back calls to umem_alloc() and
+ * ultimately malloc() are determined at program execution time. The default set
+ * of caches is defined below in umem_alloc_sizes[]. Various umem_options exist
+ * that modify the set of caches: size_add, size_clear, and size_remove. Because
+ * the set of caches can only be determined once umem_init() has been called and
+ * we have the additional goals of minimizing additional fragmentation and
+ * metadata space overhead in the malloc tags, this forces our hand to go down a
+ * slightly different path: the one tread by fasttrap and trapstat.
+ *
+ * During umem_init we're going to dynamically construct a new version of
+ * malloc(3C) and free(3C) that utilizes the known cache sizes and then ensure
+ * that ptcmalloc and ptcfree replace malloc and free as entries in the plt. If
+ * ptcmalloc and ptcfree cannot handle a request, they simply jump to the
+ * original libumem implementations.
+ *
+ * After creating all of the umem_caches, but before making them visible,
+ * umem_cache_init checks that umem_genasm_supported is non-zero. This value is
+ * set by each architecture in $ARCH/umem_genasm.c to indicate whether or not
+ * they support this. If the value is zero, then this process is skipped.
+ * Similarly, if the cache size has been tuned to zero by UMEM_OPTIONS, then
+ * this is also skipped.
+ *
+ * In umem_genasm.c, each architecture's implementation implements a single
+ * function called umem_genasm() that is responsible for generating the
+ * appropriate versions of ptcmalloc() and ptcfree(), placing them in the
+ * appropriate memory location, and finally doing the switch from malloc() and
+ * free() to ptcmalloc() and ptcfree(). Once the change has been made, there is
+ * no way to switch back, short of restarting the program or modifying program
+ * text with mdb.
+ *
+ * 8.2 Modifying the Procedure Linkage Table (PLT)
+ * -----------------------------------------------
+ *
+ * The last piece of this puzzle is how we actually jam ptcmalloc() into the
+ * PLT. The dyanmic linker has support for global and local audit libraries.
+ * For the full explanation of audit libraries consult the Linkers and Libraries
+ * guide or the linker source. A local auditer can attach to a single library
+ * and interpose on all of the relocations that come in from and leave to that
+ * same library. To facilitate our work, we have created a local audit library
+ * for libumem that is called libumem_trampoline and is located in
+ * lib/libumem_trampoline/.
+ *
+ * When any resolution is done to malloc(), the audit library allows us to
+ * replace the address with an address that it specifies. There are two 4k
+ * sections in the libumem_trampoline's bss which we use as the stomping grounds
+ * for ptcmalloc and ptcfree. When the audit library audits the malloc and free
+ * functions from libumem, it encodes their address and sets its buffers to
+ * contain a simple trampoline which consists of a jmp instruction and a four
+ * byte offset to the original malloc and free. libumem_trampoline's mapfile
+ * explicitly makes its bss rwx instead of rw to support this.
+ *
+ * When umem_genasm() is called, it uses a similar mechanism to get the address
+ * and size of the trampoline libraries malloc (mbuf) and free (fbuf) buffers.
+ * After validating that the size will be able to contain all of the
+ * instructions, it starts laying out ptcmalloc and ptcfree at mbuf[4] and
+ * fbuf[4]. Once both have been successfully generated, umem_genasm() stores a
+ * single five byte nop over the original jump.
+ *
+ * 8.3 umem_genasm()
+ * -----------------
+ *
+ * umem_genasm() is currently implemented for i386 and amd64. This section
+ * describes the theory behind the construction. For specific byte code to
+ * assembly instructions and niceish C and asm versions of ptcmalloc and
+ * ptcfree, see the individual umem_genasm.c files. The layout consists of the
+ * following sections:
+ *
+ * o. function-specfic prologue
+ * o. function-generic cache-selecting elements
+ * o. function-specific epilogue
+ *
+ * There are three different generic cache elements that exist:
+ *
+ * o. the last or only cache
+ * o. the intermediary caches if more than two
+ * o. the first one if more than one cache
+ *
+ * The malloc and free prologues and epilogues mimic the necessary portions of
+ * libumem's malloc and free. This includes things like checking for size
+ * overflow, setting and verifying the malloc tags.
+ *
+ * It is an important constraint that these functions do not make use of the
+ * call instruction. The only jmp outside of the individual functions is to the
+ * original libumem malloc and free respectively. Because doing things like
+ * setting errno or raising an internal umem error on improper malloc tags would
+ * require using calls into the PLT, whenever we encounter one of those cases we
+ * just jump to the original malloc and free functions reusing the same stack
+ * frame.
+ *
+ * Each of the above sections, the three caches, and the malloc and free
+ * prologue and epilogue are implemented as blocks of machine code with the
+ * corresponding assembly in comments. There are known offsets into each block
+ * that corresponds to locations of data and addresses that we only know at run
+ * time. These blocks are copied as necessary and the blanks filled in
+ * appropriately.
+ *
+ * As mentioned in section 8.2, the trampoline library uses specifically named
+ * variables to communicate the buffers and size to use. These variables are:
+ *
+ * o. umem_genasm_mptr: The buffer for ptcmalloc
+ * o. umem_genasm_msize: The size in bytes of the above buffer
+ * o. umem_genasm_fptr: The buffer for ptcfree
+ * o. umem_genasm_fsize: The size in bytes of the above buffer
+ *
+ * Finally, to enable the generated assembly we need to remove the previous jump
+ * to the actual malloc that exists at the start of these buffers. This is a
+ * five byte region. We could zero out the jump offset to be a jmp +0, but
+ * using nops can be faster. We specifically use a single five byte nop which is
+ * faster. The opcode for the five byte nop is 0x 0f 1f 44 00 00. On x86,
+ * remember integers are little endian, so it will be written the other way
+ * around.
+ *
+ * 8.4 Interface with libc.so
+ * --------------------------
+ *
+ * The tmem_t structure as described in the beginning of section 8, is part of a
+ * private interface with libc. There are three functions that exist to cover
+ * this. They are not documented in man pages or header files. They are in the
+ * SUNWprivate part of libc's makefile.
+ *
+ * o. _tmem_get_base(void)
+ *
+ * Returns the offset from the ulwp_t (curthread) to the tmem_t structure.
+ * This is a constant for all threads and is effectively a way to to do
+ * ::offsetof ulwp_t ul_tmem without having to know the specifics of the
+ * structure outside of libc.
+ *
+ * o. _tmem_get_nentries(void)
+ *
+ * Returns the number of roots that exist in the tmem_t. This is one part
+ * of the cap on the number of umem_caches that we can back with tmem.
+ *
+ * o. _tmem_set_cleanup(void (*)(void *, int))
+ *
+ * This sets a clean up handler that gets called back when a thread exits.
+ * There is one call per buffer, the void * is a pointer to the buffer on
+ * the list, the int is the index into the roots array for this buffer.
+ *
+ * 8.5 Tuning and disabling per-thread caching
+ * -------------------------------------------
+ *
+ * There is only one tunable for per-thread caching: the amount of memory each
+ * thread should be able to cache. This is specified via the perthread_cache
+ * UMEM_OPTION option. No attempt is made to to sanity check the specified
+ * value; the limit is simply the maximum value of a size_t.
+ *
+ * If the perthread_cache UMEM_OPTION is set to zero, nomagazines was requested,
+ * or UMEM_DEBUG has been turned on then we will never call into umem_genasm;
+ * however, the trampoline audit library and jump will still be in place.
+ *
+ * 8.6 Observing efficacy of per-thread caching
+ * --------------------------------------------
+ *
+ * To understand the efficacy of per-thread caching, use the ::umastat dcmd
+ * to see the percentage of capacity consumed on a per-thread basis, the
+ * degree to which each umem cache contributes to per-thread cache consumption,
+ * and the number of buffers in per-thread caches on a per-umem cache basis.
+ * If more detail is required, the specific buffers in a per-thread cache can
+ * be iterated over with the umem_ptc_* walkers. (These walkers allow an
+ * optional ulwp_t to be specified to iterate only over a particular thread's
+ * cache.)
*/
#include <umem_impl.h>
@@ -420,7 +668,9 @@ static int umem_alloc_sizes[] = {
P2ALIGN(8192 / 2, 64), 4544,
P2ALIGN(8192 / 1, 64), 9216,
4096 * 3,
- UMEM_MAXBUF, /* = 8192 * 2 */
+ 8192 * 2, /* = 8192 * 2 */
+ 24576, 32768, 40960, 49152, 57344, 65536, 73728, 81920,
+ 90112, 98304, 106496, 114688, 122880, UMEM_MAXBUF, /* 128k */
/* 24 slots for user expansion */
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -461,8 +711,10 @@ size_t umem_lite_minsize = 0; /* minimum buffer size for UMF_LITE */
size_t umem_lite_maxalign = 1024; /* maximum buffer alignment for UMF_LITE */
size_t umem_maxverify; /* maximum bytes to inspect in debug routines */
size_t umem_minfirewall; /* hardware-enforced redzone threshold */
+size_t umem_ptc_size = 1048576; /* size of per-thread cache (in bytes) */
uint_t umem_flags = 0;
+uintptr_t umem_tmem_off;
mutex_t umem_init_lock; /* locks initialization */
cond_t umem_init_cv; /* initialization CV */
@@ -470,6 +722,8 @@ thread_t umem_init_thr; /* thread initializing */
int umem_init_env_ready; /* environ pre-initted */
int umem_ready = UMEM_READY_STARTUP;
+int umem_ptc_enabled; /* per-thread caching enabled */
+
static umem_nofail_callback_t *nofail_callback;
static mutex_t umem_nofail_exit_lock;
static thread_t umem_nofail_exit_thr;
@@ -592,6 +846,20 @@ umem_cache_t umem_null_cache = {
static umem_cache_t *umem_alloc_table[UMEM_MAXBUF >> UMEM_ALIGN_SHIFT] = {
ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
+ ALLOC_TABLE_1024,
ALLOC_TABLE_1024
};
@@ -2812,6 +3080,24 @@ umem_alloc_sizes_remove(size_t size)
umem_alloc_sizes[i] = 0;
}
+/*
+ * We've been called back from libc to indicate that thread is terminating and
+ * that it needs to release the per-thread memory that it has. We get to know
+ * which entry in the thread's tmem array the allocation came from. Currently
+ * this refers to first n umem_caches which makes this a pretty simple indexing
+ * job.
+ */
+static void
+umem_cache_tmem_cleanup(void *buf, int entry)
+{
+ size_t size;
+ umem_cache_t *cp;
+
+ size = umem_alloc_sizes[entry];
+ cp = umem_alloc_table[(size - 1) >> UMEM_ALIGN_SHIFT];
+ _umem_cache_free(cp, buf);
+}
+
static int
umem_cache_init(void)
{
@@ -2927,6 +3213,16 @@ umem_cache_init(void)
umem_alloc_caches[i] = cp;
}
+ umem_tmem_off = _tmem_get_base();
+ _tmem_set_cleanup(umem_cache_tmem_cleanup);
+
+ if (umem_genasm_supported && !(umem_flags & UMF_DEBUG) &&
+ !(umem_flags & UMF_NOMAGAZINE) &&
+ umem_ptc_size > 0) {
+ umem_ptc_enabled = umem_genasm(umem_alloc_sizes,
+ umem_alloc_caches, i) == 0 ? 1 : 0;
+ }
+
/*
* Initialization cannot fail at this point. Make the caches
* visible to umem_alloc() and friends.
diff --git a/usr/src/lib/libumem/common/umem_base.h b/usr/src/lib/libumem/common/umem_base.h
index e78bebfb58..26e00bc282 100644
--- a/usr/src/lib/libumem/common/umem_base.h
+++ b/usr/src/lib/libumem/common/umem_base.h
@@ -22,12 +22,13 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#ifndef _UMEM_BASE_H
#define _UMEM_BASE_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <umem_impl.h>
#ifdef __cplusplus
@@ -75,6 +76,8 @@ extern volatile uint32_t umem_reaping;
#define UMEM_REAP_ADDING 0x00000001 /* umem_reap() is active */
#define UMEM_REAP_ACTIVE 0x00000002 /* update thread is reaping */
+extern uintptr_t umem_tmem_off;
+
/*
* umem.c: tunables
*/
@@ -97,6 +100,7 @@ extern size_t umem_lite_minsize;
extern size_t umem_lite_maxalign;
extern size_t umem_maxverify;
extern size_t umem_minfirewall;
+extern size_t umem_ptc_size;
extern uint32_t umem_flags;
@@ -139,6 +143,12 @@ extern int umem_create_update_thread(void);
void umem_setup_envvars(int);
void umem_process_envvars(void);
+/*
+ * umem_genasm.c: private interfaces
+ */
+extern int umem_genasm_supported;
+extern int umem_genasm(int *, umem_cache_t **, int);
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/lib/libumem/common/umem_impl.h b/usr/src/lib/libumem/common/umem_impl.h
index c6481d9751..f63246e166 100644
--- a/usr/src/lib/libumem/common/umem_impl.h
+++ b/usr/src/lib/libumem/common/umem_impl.h
@@ -24,11 +24,13 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ */
+
#ifndef _UMEM_IMPL_H
#define _UMEM_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <umem.h>
#include <sys/sysmacros.h>
@@ -64,6 +66,7 @@ extern "C" {
#define UMF_HASH 0x00000200 /* cache has hash table */
#define UMF_RANDOMIZE 0x00000400 /* randomize other umem_flags */
+#define UMF_PTC 0x00000800 /* cache has per-thread caching */
#define UMF_BUFTAG (UMF_DEADBEEF | UMF_REDZONE)
#define UMF_TOUCH (UMF_BUFTAG | UMF_LITE | UMF_CONTENTS)
@@ -353,7 +356,7 @@ typedef struct umem_cpu {
uint32_t cpu_number;
} umem_cpu_t;
-#define UMEM_MAXBUF 16384
+#define UMEM_MAXBUF 131072
#define UMEM_ALIGN 8 /* min guaranteed alignment */
#define UMEM_ALIGN_SHIFT 3 /* log2(UMEM_ALIGN) */
@@ -396,6 +399,13 @@ extern void umem_startup(caddr_t, size_t, size_t, caddr_t, caddr_t);
extern int umem_add(caddr_t, size_t);
#endif
+/*
+ * Private interface with libc for tcumem.
+ */
+extern uintptr_t _tmem_get_base(void);
+extern int _tmem_get_nentries(void);
+extern void _tmem_set_cleanup(void(*)(void *, int));
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/lib/libumem/i386/umem_genasm.c b/usr/src/lib/libumem/i386/umem_genasm.c
new file mode 100644
index 0000000000..0bfa338e2b
--- /dev/null
+++ b/usr/src/lib/libumem/i386/umem_genasm.c
@@ -0,0 +1,603 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * Don't Panic! If you find the blocks of assembly that follow confusing and
+ * you're questioning why they exist, please go read section 8 of the umem.c big
+ * theory statement. Next familiarize yourself with the malloc and free
+ * implementations in libumem's malloc.c.
+ *
+ * What follows is the i386 implementation of the thread caching automatic
+ * assembly generation. With i386 a function only has three registers its
+ * allowed to change without restoring them: eax, ecx, and edx. All others have
+ * to be preserved. Since the set of registers we have available is so small, we
+ * have to make use of esi, ebx, and edi and save their original values to the
+ * stack.
+ *
+ * Malloc register usage:
+ * o. esi: Size of the malloc (passed into us and modified)
+ * o. edi: Size of the cache
+ * o. eax: Buffer to return
+ * o. ebx: Scratch space and temporary values
+ * o. ecx: Pointer to the tmem_t in the ulwp_t.
+ * o. edx: Pointer to the tmem_t array of roots
+ *
+ * Free register usage:
+ * o. esi: Size of the malloc (passed into us and modified)
+ * o. edi: Size of the cache
+ * o. eax: Buffer to free
+ * o. ebx: Scratch space and temporary values
+ * o. ecx: Pointer to the tmem_t in the ulwp_t.
+ * o. edx: Pointer to the tmem_t array of roots
+ *
+ * Once we determine what cache we are using, we increment %edx to the
+ * appropriate offset and set %edi with the size of the cache. This means that
+ * when we break out to the normal buffer allocation point %edx contains the
+ * head of the linked list and %edi is the amount that we have to adjust the
+ * total amount cached by the thread.
+ *
+ * Each block of assembly has psuedocode that describes its purpose.
+ */
+
+#include <inttypes.h>
+#include <strings.h>
+#include <umem_impl.h>
+#include "umem_base.h"
+
+#include <atomic.h>
+
+int umem_genasm_supported = 1;
+uintptr_t umem_genasm_mptr;
+size_t umem_genasm_msize;
+uintptr_t umem_genasm_fptr;
+size_t umem_genasm_fsize;
+static uintptr_t umem_genasm_omptr;
+static uintptr_t umem_genasm_ofptr;
+
+/*
+ * The maximum number of caches we can support. We use a single byte addl so
+ * this is 255 (UINT8_MAX) / sizeof (uintptr_t). In this case 63
+ */
+#define UMEM_GENASM_MAX32 63
+
+#define PTC_JMPADDR(dest, src) (dest - (src + 4))
+#define PTC_ROOT_SIZE sizeof (uintptr_t)
+#define MULTINOP 0x0000441f0f
+
+/*
+ * void *ptcmalloc(size_t orig_size);
+ *
+ * size_t size = orig_size + 8;
+ *
+ * if (size < orig_size)
+ * goto tomalloc; ! This is overflow
+ *
+ * if (size > cache_size)
+ * goto tomalloc;
+ *
+ * tmem_t *t = (uintptr_t)curthread() + umem_thr_offset;
+ * void **roots = t->tm_roots;
+ */
+#define PTC_MALINIT_JOUT 0x0e
+#define PTC_MALINIT_MCS 0x14
+#define PTC_MALINIT_JOV 0x1a
+#define PTC_MALINIT_SOFF 0x27
+static const uint8_t malinit[] = {
+ 0x55, /* pushl %ebp */
+ 0x89, 0xe5, /* movl %esp, %ebp */
+ 0x57, /* pushl %edi */
+ 0x56, /* pushl %esi */
+ 0x53, /* pushl %ebx */
+ 0x8b, 0x75, 0x08, /* movl 0x8(%ebp), %esi */
+ 0x83, 0xc6, 0x08, /* addl $0x8,%esi */
+ 0x0f, 0x82, 0x00, 0x00, 0x00, 0x00, /* jc +$JMP (errout) */
+ 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, /* cmpl sizeof ($C0), %esi */
+ 0x0f, 0x87, 0x00, 0x00, 0x00, 0x00, /* ja +$JMP (errout) */
+ 0x65, 0x8b, 0x0d, 0x00, 0x0, 0x00, 0x00, /* movl %gs:0x0,%ecx */
+ 0x81, 0xc1, 0x00, 0x00, 0x00, 0x00, /* addl $OFF, %ecx */
+ 0x8d, 0x51, 0x04 /* leal 0x4(%ecx), %edx */
+};
+
+/*
+ * void ptcfree(void *buf);
+ *
+ * if (buf == NULL)
+ * return;
+ *
+ * malloc_data_t *tag = buf;
+ * tag--;
+ * int size = tag->malloc_size;
+ * int tagtval = UMEM_MALLOC_DECODE(tag->malloc_tag, size);
+ *
+ * if (tagval != MALLOC_MAGIC)
+ * goto tofree;
+ *
+ * if (size > cache_max)
+ * goto tofree;
+ *
+ * tmem_t *t = (uintptr_t)curthread() + umem_thr_offset;
+ * void **roots = t->tm_roots;
+ */
+#define PTC_FRINI_JDONE 0x0d
+#define PTC_FRINI_JFREE 0x23
+#define PTC_FRINI_MCS 0x29
+#define PTC_FRINI_JOV 0x2f
+#define PTC_FRINI_SOFF 0x3c
+static const uint8_t freeinit[] = {
+ 0x55, /* pushl %ebp */
+ 0x89, 0xe5, /* movl %esp, %ebp */
+ 0x57, /* pushl %edi */
+ 0x56, /* pushl %esi */
+ 0x53, /* pushl %ebx */
+ 0x8b, 0x45, 0x08, /* movl 0x8(%ebp), %eax */
+ 0x85, 0xc0, /* testl %eax, %eax */
+ 0x0f, 0x84, 0x00, 0x00, 0x00, 0x00, /* je $JDONE (done) */
+ 0x83, 0xe8, 0x08, /* subl $0x8,%eax */
+ 0x8b, 0x30, /* movl (%eax),%esi */
+ 0x8b, 0x50, 0x04, /* movl 0x4(%eax),%edx */
+ 0x01, 0xf2, /* addl %esi,%edx */
+ 0x81, 0xfa, 0x00, 0xc0, 0x10, 0x3a, /* cmpl MAGIC32, %edx */
+ 0x0f, 0x85, 0x00, 0x00, 0x00, 0x00, /* jne +JFREE (goto freebuf) */
+
+ 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, /* cmpl sizeof ($C0), %esi */
+ 0x0f, 0x87, 0x00, 0x00, 0x00, 0x00, /* ja +$JMP (errout) */
+ 0x65, 0x8b, 0x0d, 0x00, 0x0, 0x00, 0x00, /* movl %gs:0x0,%ecx */
+ 0x81, 0xc1, 0x00, 0x00, 0x00, 0x00, /* addl $0xOFF, %ecx */
+ 0x8d, 0x51, 0x04 /* leal 0x4(%ecx),%edx */
+};
+
+/*
+ * if (size <= $CACHE_SIZE) {
+ * csize = $CACHE_SIZE;
+ * } else ... ! goto next cache
+ */
+#define PTC_INICACHE_CMP 0x02
+#define PTC_INICACHE_SIZE 0x09
+#define PTC_INICACHE_JMP 0x0e
+static const uint8_t inicache[] = {
+ 0x81, 0xfe, 0xff, 0x00, 0x00, 0x00, /* cmpl sizeof ($C0), %esi */
+ 0x77, 0x0a, /* ja +0xa */
+ 0xbf, 0xff, 0x00, 0x00, 0x00, /* movl sizeof ($C0), %edi */
+ 0xe9, 0x00, 0x00, 0x00, 0x00 /* jmp +$JMP (allocbuf) */
+};
+
+/*
+ * if (size <= $CACHE_SIZE) {
+ * csize = $CACHE_SIZE;
+ * roots += $CACHE_NUM;
+ * } else ... ! goto next cache
+ */
+#define PTC_GENCACHE_CMP 0x02
+#define PTC_GENCACHE_NUM 0x0a
+#define PTC_GENCACHE_SIZE 0x0c
+#define PTC_GENCACHE_JMP 0x11
+static const uint8_t gencache[] = {
+ 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, /* cmpl sizeof ($CACHE), %esi */
+ 0x77, 0x0d, /* ja +0xd (next cache) */
+ 0x83, 0xc2, 0x00, /* addl $4*$ii, %edx */
+ 0xbf, 0x00, 0x00, 0x00, 0x00, /* movl sizeof ($CACHE), %edi */
+ 0xe9, 0x00, 0x00, 0x00, 0x00 /* jmp +$JMP (allocbuf) */
+};
+
+/*
+ * else if (size <= $CACHE_SIZE) {
+ * csize = $CACHE_SIZE;
+ * roots += $CACHE_NUM;
+ * } else {
+ * goto tofunc; ! goto tomalloc if ptcmalloc.
+ * } ! goto tofree if ptcfree.
+ */
+#define PTC_FINCACHE_CMP 0x02
+#define PTC_FINCACHE_JMP 0x07
+#define PTC_FINCACHE_NUM 0x0a
+#define PTC_FINCACHE_SIZE 0x0c
+static const uint8_t fincache[] = {
+ 0x81, 0xfe, 0xff, 0x00, 0x00, 0x00, /* cmpl sizeof ($CLAST), %esi */
+ 0x77, 0x00, /* ja +$JMP (to errout) */
+ 0x83, 0xc2, 0x00, /* addl $4*($NCACHES-1), %edx */
+ 0xbf, 0x00, 0x00, 0x00, 0x00, /* movl sizeof ($CLAST), %edi */
+};
+
+/*
+ * if (*root == NULL)
+ * goto tomalloc;
+ *
+ * malloc_data_t *ret = *root;
+ * *root = *(void **)ret;
+ * t->tm_size += csize;
+ * ret->malloc_size = size;
+ *
+ * ret->malloc_data = UMEM_MALLOC_ENCODE(MALLOC_SECOND_MAGIC, size);
+ * ret++;
+ *
+ * return ((void *)ret);
+ * tomalloc:
+ * return (malloc(orig_size));
+ */
+#define PTC_MALFINI_ALLABEL 0x00
+#define PTC_MALFINI_JMLABEL 0x20
+#define PTC_MALFINI_JMADDR 0x25
+static const uint8_t malfini[] = {
+ /* allocbuf: */
+ 0x8b, 0x02, /* movl (%edx), %eax */
+ 0x85, 0xc0, /* testl %eax, %eax */
+ 0x74, 0x1a, /* je +0x1a (errout) */
+ 0x8b, 0x18, /* movl (%eax), %esi */
+ 0x89, 0x1a, /* movl %esi, (%edx) */
+ 0x29, 0x39, /* subl %edi, (%ecx) */
+ 0x89, 0x30, /* movl %esi, ($eax) */
+ 0xba, 0x00, 0xc0, 0x10, 0x3a, /* movl $0x3a10c000,%edx */
+ 0x29, 0xf2, /* subl %esi, %edx */
+ 0x89, 0x50, 0x04, /* movl %edx, 0x4(%eax) */
+ 0x83, 0xc0, 0x08, /* addl %0x8, %eax */
+ 0x5b, /* popl %ebx */
+ 0x5e, /* popl %esi */
+ 0x5f, /* popl %edi */
+ 0xc9, /* leave */
+ 0xc3, /* ret */
+ /* errout: */
+ 0x5b, /* popl %ebx */
+ 0x5e, /* popl %esi */
+ 0x5f, /* popl %edi */
+ 0xc9, /* leave */
+ 0xe9, 0x00, 0x00, 0x00, 0x00 /* jmp $malloc */
+};
+
+/*
+ * if (t->tm_size + csize > umem_ptc_size)
+ * goto tofree;
+ *
+ * t->tm_size += csize
+ * *(void **)tag = *root;
+ * *root = tag;
+ * return;
+ * tofree:
+ * free(buf);
+ * return;
+ */
+#define PTC_FRFINI_RBUFLABEL 0x00
+#define PTC_FRFINI_CACHEMAX 0x06
+#define PTC_FRFINI_DONELABEL 0x14
+#define PTC_FRFINI_JFLABEL 0x19
+#define PTC_FRFINI_JFADDR 0x1e
+static const uint8_t freefini[] = {
+ /* freebuf: */
+ 0x8b, 0x19, /* movl (%ecx),%ebx */
+ 0x01, 0xfb, /* addl %edi,%ebx */
+ 0x81, 0xfb, 0x00, 0x00, 0x00, 0x00, /* cmpl maxsize, %ebx */
+ 0x73, 0x0d, /* jae +0xd <tofree> */
+ 0x01, 0x39, /* addl %edi,(%ecx) */
+ 0x8b, 0x3a, /* movl (%edx),%edi */
+ 0x89, 0x38, /* movl %edi,(%eax) */
+ 0x89, 0x02, /* movl %eax,(%edx) */
+ /* done: */
+ 0x5b, /* popl %ebx */
+ 0x5e, /* popl %esi */
+ 0x5f, /* popl %edi */
+ 0xc9, /* leave */
+ 0xc3, /* ret */
+ /* realfree: */
+ 0x5b, /* popl %ebx */
+ 0x5e, /* popl %esi */
+ 0x5f, /* popl %edi */
+ 0xc9, /* leave */
+ 0xe9, 0x00, 0x00, 0x00, 0x00 /* jmp free */
+};
+
+/*
+ * Construct the initial part of malloc. off contains the offset from curthread
+ * to the root of the tmem structure. ep is the address of the label to error
+ * and jump to free. csize is the size of the largest umem_cache in ptcumem.
+ */
+static int
+genasm_malinit(uint8_t *bp, uint32_t off, uint32_t ep, uint32_t csize)
+{
+ uint32_t addr;
+
+ bcopy(malinit, bp, sizeof (malinit));
+ addr = PTC_JMPADDR(ep, PTC_MALINIT_JOUT);
+ bcopy(&addr, bp + PTC_MALINIT_JOUT, sizeof (addr));
+ bcopy(&csize, bp + PTC_MALINIT_MCS, sizeof (csize));
+ addr = PTC_JMPADDR(ep, PTC_MALINIT_JOV);
+ bcopy(&addr, bp + PTC_MALINIT_JOV, sizeof (addr));
+ bcopy(&off, bp + PTC_MALINIT_SOFF, sizeof (off));
+
+ return (sizeof (malinit));
+}
+
+static int
+genasm_frinit(uint8_t *bp, uint32_t off, uint32_t dp, uint32_t ep, uint32_t mc)
+{
+ uint32_t addr;
+
+ bcopy(freeinit, bp, sizeof (freeinit));
+ addr = PTC_JMPADDR(dp, PTC_FRINI_JDONE);
+ bcopy(&addr, bp + PTC_FRINI_JDONE, sizeof (addr));
+ addr = PTC_JMPADDR(ep, PTC_FRINI_JFREE);
+ bcopy(&addr, bp + PTC_FRINI_JFREE, sizeof (addr));
+ bcopy(&mc, bp + PTC_FRINI_MCS, sizeof (mc));
+ addr = PTC_JMPADDR(ep, PTC_FRINI_JOV);
+ bcopy(&addr, bp + PTC_FRINI_JOV, sizeof (addr));
+ bcopy(&off, bp + PTC_FRINI_SOFF, sizeof (off));
+ return (sizeof (freeinit));
+}
+
+/*
+ * Create the initial cache entry of the specified size. The value of ap tells
+ * us what the address of the label to try and allocate a buffer. This value is
+ * an offset from the current base to that value.
+ */
+static int
+genasm_firstcache(uint8_t *bp, uint32_t csize, uint32_t ap)
+{
+ uint32_t addr;
+
+ bcopy(inicache, bp, sizeof (inicache));
+ bcopy(&csize, bp + PTC_INICACHE_CMP, sizeof (csize));
+ bcopy(&csize, bp + PTC_INICACHE_SIZE, sizeof (csize));
+ addr = PTC_JMPADDR(ap, PTC_INICACHE_JMP);
+ ASSERT(addr != 0);
+ bcopy(&addr, bp + PTC_INICACHE_JMP, sizeof (addr));
+
+ return (sizeof (inicache));
+}
+
+static int
+genasm_gencache(uint8_t *bp, int num, uint32_t csize, uint32_t ap)
+{
+ uint32_t addr;
+ uint8_t coff;
+
+ ASSERT(256 / PTC_ROOT_SIZE > num);
+ ASSERT(num != 0);
+ bcopy(gencache, bp, sizeof (gencache));
+ bcopy(&csize, bp + PTC_GENCACHE_CMP, sizeof (csize));
+ bcopy(&csize, bp + PTC_GENCACHE_SIZE, sizeof (csize));
+ coff = num * PTC_ROOT_SIZE;
+ bcopy(&coff, bp + PTC_GENCACHE_NUM, sizeof (coff));
+ addr = PTC_JMPADDR(ap, PTC_GENCACHE_JMP);
+ bcopy(&addr, bp + PTC_GENCACHE_JMP, sizeof (addr));
+
+ return (sizeof (gencache));
+}
+
+static int
+genasm_lastcache(uint8_t *bp, int num, uint32_t csize, uint32_t ep)
+{
+ uint8_t addr;
+
+ ASSERT(ep <= 0xff && ep > 7);
+ ASSERT(256 / PTC_ROOT_SIZE > num);
+ bcopy(fincache, bp, sizeof (fincache));
+ bcopy(&csize, bp + PTC_FINCACHE_CMP, sizeof (csize));
+ bcopy(&csize, bp + PTC_FINCACHE_SIZE, sizeof (csize));
+ addr = num * PTC_ROOT_SIZE;
+ bcopy(&addr, bp + PTC_FINCACHE_NUM, sizeof (addr));
+ addr = ep - PTC_FINCACHE_JMP - 1;
+ bcopy(&addr, bp + PTC_FINCACHE_JMP, sizeof (addr));
+
+ return (sizeof (fincache));
+}
+
+static int
+genasm_malfini(uint8_t *bp, uintptr_t mptr)
+{
+ uint32_t addr;
+
+ bcopy(malfini, bp, sizeof (malfini));
+ addr = PTC_JMPADDR(mptr, ((uintptr_t)bp + PTC_MALFINI_JMADDR));
+ bcopy(&addr, bp + PTC_MALFINI_JMADDR, sizeof (addr));
+
+ return (sizeof (malfini));
+}
+
+static int
+genasm_frfini(uint8_t *bp, uint32_t maxthr, uintptr_t fptr)
+{
+ uint32_t addr;
+
+ bcopy(freefini, bp, sizeof (freefini));
+ bcopy(&maxthr, bp + PTC_FRFINI_CACHEMAX, sizeof (maxthr));
+ addr = PTC_JMPADDR(fptr, ((uintptr_t)bp + PTC_FRFINI_JFADDR));
+ bcopy(&addr, bp + PTC_FRFINI_JFADDR, sizeof (addr));
+
+ return (sizeof (freefini));
+}
+
+/*
+ * The malloc inline assembly is constructed as follows:
+ *
+ * o Malloc prologue assembly
+ * o Generic first-cache check
+ * o n Generic cache checks (where n = _tmem_get_entries() - 2)
+ * o Generic last-cache check
+ * o Malloc epilogue assembly
+ *
+ * Generally there are at least three caches. When there is only one cache we
+ * only use the generic last-cache. In the case where there are two caches, we
+ * just leave out the middle ones.
+ */
+static int
+genasm_malloc(void *base, size_t len, int nents, int *umem_alloc_sizes)
+{
+ int ii, off;
+ uint8_t *bp;
+ size_t total;
+ uint32_t allocoff, erroff;
+
+ total = sizeof (malinit) + sizeof (malfini) + sizeof (fincache);
+
+ if (nents >= 2)
+ total += sizeof (inicache) + sizeof (gencache) * (nents - 2);
+
+ if (total > len)
+ return (1);
+
+ erroff = total - sizeof (malfini) + PTC_MALFINI_JMLABEL;
+ allocoff = total - sizeof (malfini) + PTC_MALFINI_ALLABEL;
+
+ bp = base;
+
+ off = genasm_malinit(bp, umem_tmem_off, erroff,
+ umem_alloc_sizes[nents-1]);
+ bp += off;
+ allocoff -= off;
+ erroff -= off;
+
+ if (nents > 1) {
+ off = genasm_firstcache(bp, umem_alloc_sizes[0], allocoff);
+ bp += off;
+ allocoff -= off;
+ erroff -= off;
+ }
+
+ for (ii = 1; ii < nents - 1; ii++) {
+ off = genasm_gencache(bp, ii, umem_alloc_sizes[ii], allocoff);
+ bp += off;
+ allocoff -= off;
+ erroff -= off;
+ }
+
+ bp += genasm_lastcache(bp, nents - 1, umem_alloc_sizes[nents - 1],
+ erroff);
+ bp += genasm_malfini(bp, umem_genasm_omptr);
+ ASSERT(((uintptr_t)bp - total) == (uintptr_t)base);
+
+ return (0);
+}
+
+static int
+genasm_free(void *base, size_t len, int nents, int *umem_alloc_sizes)
+{
+ uint8_t *bp;
+ int ii, off;
+ size_t total;
+ uint32_t rbufoff, retoff, erroff;
+
+ /* Assume that nents has already been audited for us */
+ total = sizeof (freeinit) + sizeof (freefini) + sizeof (fincache);
+ if (nents >= 2)
+ total += sizeof (inicache) + sizeof (gencache) * (nents - 2);
+
+ if (total > len)
+ return (1);
+
+ erroff = total - (sizeof (freefini) - PTC_FRFINI_JFLABEL);
+ rbufoff = total - (sizeof (freefini) - PTC_FRFINI_RBUFLABEL);
+ retoff = total - (sizeof (freefini) - PTC_FRFINI_DONELABEL);
+
+ bp = base;
+
+ off = genasm_frinit(bp, umem_tmem_off, retoff, erroff,
+ umem_alloc_sizes[nents - 1]);
+ bp += off;
+ erroff -= off;
+ rbufoff -= off;
+
+ if (nents > 1) {
+ off = genasm_firstcache(bp, umem_alloc_sizes[0], rbufoff);
+ bp += off;
+ erroff -= off;
+ rbufoff -= off;
+ }
+
+ for (ii = 1; ii < nents - 1; ii++) {
+ off = genasm_gencache(bp, ii, umem_alloc_sizes[ii], rbufoff);
+ bp += off;
+ rbufoff -= off;
+ erroff -= off;
+ }
+
+ bp += genasm_lastcache(bp, nents - 1, umem_alloc_sizes[nents - 1],
+ erroff);
+ bp += genasm_frfini(bp, umem_ptc_size, umem_genasm_ofptr);
+ ASSERT(((uintptr_t)bp - total) == (uintptr_t)base);
+
+ return (0);
+}
+
+int
+umem_genasm(int *alloc_sizes, umem_cache_t **caches, int ncaches)
+{
+ int nents, i;
+ uint8_t *mptr;
+ uint8_t *fptr;
+ uint32_t *ptr;
+ uint64_t v, *vptr;
+
+ mptr = (void *)((uintptr_t)&umem_genasm_mptr + 5);
+ fptr = (void *)((uintptr_t)&umem_genasm_fptr + 5);
+ if (umem_genasm_mptr == 0 || umem_genasm_msize == 0 ||
+ umem_genasm_fptr == 0 || umem_genasm_fsize == 0)
+ return (1);
+
+ /*
+ * The total number of caches that we can service is the minimum of:
+ * o the amount supported by libc
+ * o the total number of umem caches
+ * o we use a single byte addl, so its 255 / sizeof (uintptr_t). For
+ * 32-bit, this is 63.
+ */
+ nents = _tmem_get_nentries();
+
+ if (UMEM_GENASM_MAX32 < nents)
+ nents = UMEM_GENASM_MAX32;
+
+ if (ncaches < nents)
+ nents = ncaches;
+
+ /* Based on our constraints, this is not an error */
+ if (nents == 0 || umem_ptc_size == 0)
+ return (0);
+
+ /* Grab the original malloc and free locations */
+ ptr = (void *)(mptr - 4);
+ umem_genasm_omptr = *ptr + (uintptr_t)mptr;
+ ptr = (void *)(fptr - 4);
+ umem_genasm_ofptr = *ptr + (uintptr_t)fptr;
+
+ /* Take into account the jump */
+ if (genasm_malloc(mptr, umem_genasm_fsize - 5, nents,
+ alloc_sizes) != 0)
+ return (1);
+
+ if (genasm_free(fptr, umem_genasm_fsize - 5, nents,
+ alloc_sizes) != 0)
+ return (1);
+
+ /* nop out the jump with a multibyte jump */
+ vptr = (void *)&umem_genasm_mptr;
+ v = MULTINOP;
+ v |= *vptr & (0xffffffULL << 40);
+ (void) atomic_swap_64(vptr, v);
+ vptr = (void *)&umem_genasm_fptr;
+ v = MULTINOP;
+ v |= *vptr & (0xffffffULL << 40);
+ (void) atomic_swap_64(vptr, v);
+
+ for (i = 0; i < nents; i++)
+ caches[i]->cache_flags |= UMF_PTC;
+
+ return (0);
+}
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmException.java b/usr/src/lib/libumem/sparc/umem_genasm.c
index 081c27e79e..77dcc4a6a5 100644
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmException.java
+++ b/usr/src/lib/libumem/sparc/umem_genasm.c
@@ -19,26 +19,20 @@
* CDDL HEADER END
*/
/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmException class
- * General print manager exceptions
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * Don't Panic! If you wonder why this seemingly empty file exists, it's because
+ * there is no sparc implementation for ptcumem. Go read libumem's big theory
+ * statement in lib/libumem/common/umem.c, particularly section eight.
*/
-package com.sun.admin.pm.server;
+int umem_genasm_supported = 0;
-public class pmException extends Exception
+/*ARGSUSED*/
+int
+umem_genasm(int *cp, int nc)
{
- public pmException()
- {
- super();
- }
-
- public pmException(String s)
- {
- super(s);
- }
+ return (1);
}
diff --git a/usr/src/lib/print/libprint/Makefile b/usr/src/lib/libumem_trampoline/Makefile
index 55847e0be0..e1140efa8c 100644
--- a/usr/src/lib/print/libprint/Makefile
+++ b/usr/src/lib/libumem_trampoline/Makefile
@@ -19,36 +19,32 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-include ../../Makefile.lib
+include ../Makefile.lib
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
+SUBDIRS= $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
+all := TARGET= all
+clean := TARGET= clean
+clobber := TARGET= clobber
+install := TARGET= install
+lint := TARGET= lint
.KEEP_STATE:
-all clean clobber install: .WAIT $(SUBDIRS)
-
-lint: # $(SUBDIRS)
+all clean clobber install lint: $(SUBDIRS)
-install_h:
+install_h: $(ROOTHDRS)
-check:
+check: $(CHECKHDRS)
-$(SUBDIRS): FRC
+$(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
FRC:
-include ../../Makefile.targ
+include ../Makefile.targ
diff --git a/usr/src/cmd/print/scripts/desktop-print-management-applet.desktop b/usr/src/lib/libumem_trampoline/Makefile.com
index e227313fb2..a43fad0fd5 100644
--- a/usr/src/cmd/print/scripts/desktop-print-management-applet.desktop
+++ b/usr/src/lib/libumem_trampoline/Makefile.com
@@ -18,20 +18,32 @@
#
# CDDL HEADER END
#
-
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-[Desktop Entry]
-Encoding=UTF-8
-Name=Desktop Printing Monitoring applet
-Comment=Show balloon dialog for printers
-Icon=print-manager
-Exec=env DESKTOP_LAUNCHED=true /usr/bin/desktop-print-management-applet
-Terminal=false
-Type=Application
-Categories=
-OnlyShowIn=GNOME;
-X-GNOME-Autostart-enabled=true
+LIBRARY = libumem_trampoline.a
+VERS = .1
+OBJECTS = trampoline.o
+
+include ../../Makefile.lib
+
+# install this library in the root filesystem
+include ../../Makefile.rootfs
+
+LIBS = $(DYNLIB) $(LINTLIB)
+
+SRCDIR = ../common
+
+$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
+
+CFLAGS += $(CCVERBOSE)
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: lintcheck
+
+include ../../Makefile.targ
diff --git a/usr/src/lib/print/libhttp-core/sparc/Makefile b/usr/src/lib/libumem_trampoline/amd64/Makefile
index 0bc3313291..132720332b 100644
--- a/usr/src/lib/print/libhttp-core/sparc/Makefile
+++ b/usr/src/lib/libumem_trampoline/amd64/Makefile
@@ -19,12 +19,11 @@
# CDDL HEADER END
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2012 (c) Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
include ../Makefile.com
+include ../../Makefile.lib.64
-install: all $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS)
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/cmd/lp/lib/lp/lp_errno.c b/usr/src/lib/libumem_trampoline/common/llib-lumem_trampoline
index 0ae21ff312..8fda64fc80 100644
--- a/usr/src/cmd/lp/lib/lp/lp_errno.c
+++ b/usr/src/lib/libumem_trampoline/common/llib-lumem_trampoline
@@ -19,10 +19,10 @@
*
* CDDL HEADER END
*/
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
/* LINTLIBRARY */
-int lp_errno;
+/* PROTOLIB1 */
diff --git a/usr/src/lib/libumem_trampoline/common/mapfile-vers b/usr/src/lib/libumem_trampoline/common/mapfile-vers
new file mode 100644
index 0000000000..c52eeda977
--- /dev/null
+++ b/usr/src/lib/libumem_trampoline/common/mapfile-vers
@@ -0,0 +1,62 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+# usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+#
+# The BSS must me executable for ptcumem to work properly. If it is not,
+# programs will get a SEGV. For more information read section of 8 libumem's big
+# theory statement in lib/libumem/common/umem.c.
+#
+LOAD_SEGMENT bss {
+ FLAGS = READ WRITE EXECUTE;
+};
+
+SYMBOL_VERSION SUNWprivate_1.1 {
+ global:
+ la_version;
+ la_objopen;
+$if _ELF32
+ la_symbind32;
+$endif
+$if _ELF64
+ la_symbind64;
+$endif
+ local:
+ *;
+};
diff --git a/usr/src/lib/libumem_trampoline/common/trampoline.c b/usr/src/lib/libumem_trampoline/common/trampoline.c
new file mode 100644
index 0000000000..200f32aabc
--- /dev/null
+++ b/usr/src/lib/libumem_trampoline/common/trampoline.c
@@ -0,0 +1,166 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * This is a local link auditing library for libumem(3LIB). It provides a means
+ * for us to implement the per-thread caching component of libumem. When any
+ * binary or library attempts to bind to libumem's malloc and free symbols we
+ * instead point them to a private buffer in our own BSS. Our mapfile ensures
+ * that this BSS is readable, writeable, and executable. By default these
+ * private buffers contain a jmp instruction to the original libumem malloc and
+ * free.
+ *
+ * When libumem tries to generate its assembly, we key off of private symbol
+ * names and replace their values with pointers to our values. For more
+ * information on this process, see section 8 of the big theory statement for
+ * libumem in lib/libumem/common/umem.c.
+ *
+ * Note that this is very x86 specific currently. This includes x86 instructions
+ * and making assumptions about alignment of variables, see the lint warnings.
+ * By the current construction, SPARC is basically a no-op.
+ */
+#include <dlfcn.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <libelf.h>
+#include <link.h>
+
+#if defined(__i386) || defined(__amd64)
+#define LIBUMEM_TRAMPOLINE_JMP32 0xe9
+#endif /* defined(__i386) || defined(__amd64) */
+
+/*
+ * This is our malloc trampoline. We give it the name "malloc" to make it
+ * appear somewhat like malloc.
+ */
+static uint8_t malloc[4096];
+static uint8_t free[4096];
+static size_t msize = sizeof (malloc);
+static size_t fsize = sizeof (free);
+
+/*
+ * We don't want to link against libc, so we define our own versions of the
+ * string functions as necessary.
+ */
+static int
+la_strcmp(const char *s1, const char *s2)
+{
+ if (s1 == s2)
+ return (0);
+ while (*s1 == *s2++)
+ if (*s1++ == '\0')
+ return (0);
+
+ return (*(unsigned char *)s1 - *(unsigned char *)--s2);
+}
+
+static char *
+la_strrchr(char *str, char c)
+{
+ char *r;
+
+ r = NULL;
+ do {
+ if (*str == c)
+ r = str;
+ } while (*str++);
+ return (r);
+}
+
+/*ARGSUSED*/
+uint_t
+la_version(uint_t version)
+{
+ return (LAV_CURRENT);
+}
+
+/*ARGSUSED*/
+uint_t
+la_objopen(Link_map *lmp, Lmid_t lmid, uintptr_t *cookie)
+{
+#if defined(__i386) || defined(__amd64)
+ char *objname;
+
+ if ((objname = la_strrchr(lmp->l_name, '/')) == NULL ||
+ *(++objname) == '\0')
+ objname = lmp->l_name;
+
+ if (la_strcmp(objname, "libumem.so.1") == 0 ||
+ la_strcmp(objname, "libumem.so") == 0)
+ return (LA_FLG_BINDFROM | LA_FLG_BINDTO);
+#endif /* defined(__i386) || defined(__amd64) */
+
+ return (0);
+}
+
+#if defined(_LP64)
+/*ARGSUSED*/
+uintptr_t
+la_symbind64(Elf64_Sym *symp, uint_t symndx, uintptr_t *refcook,
+ uintptr_t *defcook, uint_t *sb_flags, char const *sym_name)
+#else
+/*ARGSUSED*/
+uintptr_t
+la_symbind32(Elf32_Sym *symp, uint_t symndx, uintptr_t *refcook,
+ uintptr_t *defcook, uint_t *sb_flags)
+#endif
+{
+#if defined(__i386) || defined(__amd64)
+ int i = 0;
+
+#if !defined(_LP64)
+ char const *sym_name = (char const *) symp->st_name;
+#endif
+
+ if (la_strcmp(sym_name, "malloc") == 0) {
+ if (malloc[i] == '\0') {
+ malloc[i++] = LIBUMEM_TRAMPOLINE_JMP32;
+ /*LINTED E_BAD_PTR_CAST_ALIGN*/
+ *(uint32_t *)&malloc[i] = (uint32_t)(symp->st_value -
+ (uintptr_t)&malloc[i + sizeof (uint32_t)]);
+ }
+
+ return ((uintptr_t)malloc);
+ } else if (la_strcmp(sym_name, "free") == 0) {
+ if (free[i] == '\0') {
+ free[i++] = LIBUMEM_TRAMPOLINE_JMP32;
+ /*LINTED E_BAD_PTR_CAST_ALIGN*/
+ *(uint32_t *)&free[i] = (uint32_t)(symp->st_value -
+ (uintptr_t)&free[i + sizeof (uint32_t)]);
+ }
+
+ return ((uintptr_t)free);
+ } else if (la_strcmp(sym_name, "umem_genasm_mptr") == 0) {
+ return ((uintptr_t)malloc);
+ } else if (la_strcmp(sym_name, "umem_genasm_msize") == 0) {
+ return ((uintptr_t)&msize);
+ } else if (la_strcmp(sym_name, "umem_genasm_fptr") == 0) {
+ return ((uintptr_t)free);
+ } else if (la_strcmp(sym_name, "umem_genasm_fsize") == 0) {
+ return ((uintptr_t)&fsize);
+ } else {
+ return (symp->st_value);
+ }
+#endif /* defined(__i386) || defined(__amd64) */
+}
diff --git a/usr/src/lib/libumem_trampoline/i386/Makefile b/usr/src/lib/libumem_trampoline/i386/Makefile
new file mode 100644
index 0000000000..76c3ccc672
--- /dev/null
+++ b/usr/src/lib/libumem_trampoline/i386/Makefile
@@ -0,0 +1,29 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2012 (c) Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libumem_trampoline/sparc/Makefile b/usr/src/lib/libumem_trampoline/sparc/Makefile
new file mode 100644
index 0000000000..76c3ccc672
--- /dev/null
+++ b/usr/src/lib/libumem_trampoline/sparc/Makefile
@@ -0,0 +1,29 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2012 (c) Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libumem_trampoline/sparcv9/Makefile b/usr/src/lib/libumem_trampoline/sparcv9/Makefile
new file mode 100644
index 0000000000..132720332b
--- /dev/null
+++ b/usr/src/lib/libumem_trampoline/sparcv9/Makefile
@@ -0,0 +1,29 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2012 (c) Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/libvrrpadm/common/libvrrpadm.c b/usr/src/lib/libvrrpadm/common/libvrrpadm.c
index 2e9cb06aaf..15365864a1 100644
--- a/usr/src/lib/libvrrpadm/common/libvrrpadm.c
+++ b/usr/src/lib/libvrrpadm/common/libvrrpadm.c
@@ -24,6 +24,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
@@ -692,7 +696,8 @@ lookup_vnic(dladm_handle_t dh, datalink_id_t vnicid, void *arg)
if (vrrp_is_vrrp_vnic(lva->lva_vh, vnicid, &linkid, &vid, &vrid,
&af) && lva->lva_vrid == vrid && lva->lva_linkid == linkid &&
- lva->lva_vid == vid && lva->lva_af == af) {
+ (lva->lva_vid == VLAN_ID_NONE || lva->lva_vid == vid) &&
+ lva->lva_af == af) {
if (dladm_datalink_id2info(dh, vnicid, NULL, NULL, NULL,
lva->lva_vnic, sizeof (lva->lva_vnic)) == DLADM_STATUS_OK) {
return (DLADM_WALK_TERMINATE);
@@ -714,6 +719,7 @@ vrrp_get_vnicname(vrrp_handle_t vh, vrid_t vrid, int af, char *link,
uint16_t vid = VLAN_ID_NONE;
datalink_class_t class;
dladm_vlan_attr_t vlan_attr;
+ dladm_vnic_attr_t vnic_attr;
struct lookup_vnic_arg lva;
uint32_t media;
@@ -736,11 +742,20 @@ vrrp_get_vnicname(vrrp_handle_t vh, vrid_t vrid, int af, char *link,
}
}
+ if (class == DATALINK_CLASS_VNIC) {
+ if (dladm_vnic_info(vh->vh_dh, linkid, &vnic_attr,
+ DLADM_OPT_ACTIVE) != DLADM_STATUS_OK) {
+ return (VRRP_EINVAL);
+ }
+ linkid = vnic_attr.va_link_id;
+ vid = vnic_attr.va_vid;
+ }
+
/*
- * For now, Only VRRP over aggr and physical ethernet links is supported
+ * Only VRRP over vnics, aggrs and physical ethernet links is supported
*/
- if ((class != DATALINK_CLASS_PHYS && class != DATALINK_CLASS_AGGR) ||
- media != DL_ETHER) {
+ if ((class != DATALINK_CLASS_PHYS && class != DATALINK_CLASS_AGGR &&
+ class != DATALINK_CLASS_VNIC) || media != DL_ETHER) {
return (VRRP_EINVAL);
}
diff --git a/usr/src/lib/libzdoor/Makefile b/usr/src/lib/libzdoor/Makefile
new file mode 100644
index 0000000000..50d9545ef1
--- /dev/null
+++ b/usr/src/lib/libzdoor/Makefile
@@ -0,0 +1,48 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2011 Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.lib
+
+SUBDIRS= $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET = all
+clean := TARGET = clean
+clobber := TARGET = clobber
+install := TARGET = install
+lint := TARGET = lint
+
+.KEEP_STATE:
+
+all clean clobber install lint: $(SUBDIRS)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+_msg:
+
+FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-common/Makefile.com b/usr/src/lib/libzdoor/Makefile.com
index 7948a2261e..09bde0f1b4 100644
--- a/usr/src/lib/print/libpapi-common/Makefile.com
+++ b/usr/src/lib/libzdoor/Makefile.com
@@ -18,34 +18,28 @@
#
# CDDL HEADER END
#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2011 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-LIBRARY = libpapi-common.a
-VERS = .0
-OBJECTS = attribute.o common.o library.o list.o misc.o status.o uri.o
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
+LIBRARY= libzdoor.a
+VERS= .1
+OBJECTS= zdoor.o \
+ zdoor-int.o \
+ ztree.o \
+ zerror.o
-ROOTLIBDIR= $(ROOT)/usr/lib
+include ../../Makefile.lib
+include ../../Makefile.rootfs
SRCDIR = ../common
+SRCS = $(OBJECTS:%.o=$(SRCDIR)/%.c)
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(SRCDIR)
-
-CERRWARN += -_gcc=-Wno-switch
-
-MAPFILES = $(SRCDIR)/mapfile
+CPPFLAGS += -I$(SRCDIR) -D_REENTRANT -D_FILE_OFFSET_BITS=64
+LIBS = $(DYNLIB) $(LINTLIB)
+LDLIBS += -lc -lzonecfg -lcontract
-LDLIBS += -lc -lsocket -lnsl
+$(LINTLIB) := SRCS= $(SRCDIR)/$(LINTSRC)
.KEEP_STATE:
@@ -53,4 +47,4 @@ all: $(LIBS)
lint: lintcheck
-include ../../../Makefile.targ
+include ../../Makefile.targ
diff --git a/usr/src/cmd/lp/filter/postscript/filtdesc/README b/usr/src/lib/libzdoor/amd64/Makefile
index 9e42cf455d..31be0ef7e6 100644
--- a/usr/src/cmd/lp/filter/postscript/filtdesc/README
+++ b/usr/src/lib/libzdoor/amd64/Makefile
@@ -20,11 +20,13 @@
# CDDL HEADER END
#
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2011 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
-This directory contains a set of input files for the lpfilter command
-that will install the PostScript filters under lp.
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/usr/src/cmd/lp/lib/oam/buffers.c b/usr/src/lib/libzdoor/common/llib-lzdoor
index 1bbf071a26..a21a904b11 100644
--- a/usr/src/cmd/lp/lib/oam/buffers.c
+++ b/usr/src/lib/libzdoor/common/llib-lzdoor
@@ -19,16 +19,16 @@
*
* CDDL HEADER END
*/
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-/* LINTLIBRARY */
+/*LINTLIBRARY*/
+/*PROTOLIB1*/
+/*
+ *
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ */
-#include "oam.h"
+#pragma ident "%Z%%M% %I% %E% SMI"
-char _m_[MSGSIZ],
- _a_[MSGSIZ],
- _f_[MSGSIZ],
- *_t_ = "999999";
+#include <sys/types.h>
+#include <zdoor.h>
diff --git a/usr/src/lib/print/libipp-core/common/mapfile b/usr/src/lib/libzdoor/common/mapfile-vers
index 19a947feb5..38eba57ee2 100644
--- a/usr/src/lib/print/libipp-core/common/mapfile
+++ b/usr/src/lib/libzdoor/common/mapfile-vers
@@ -18,13 +18,7 @@
#
# CDDL HEADER END
#
-
-#
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# $Id: mapfile 151 2006-04-25 16:55:34Z njacobs $
+# Copyright (c) 2011, Joyent Inc. All rights reserved.
#
#
@@ -43,18 +37,12 @@
$mapfile_version 2
-#
-# Common interfaces that are most likely to be shared amongst the various
-# PAPI implementations.
-#
-
-SYMBOL_VERSION SUNWprivate_1.0 {
+SYMBOL_VERSION SUNWprivate_1.1 {
global:
- ipp_read_message ;
- ipp_write_message ;
- ipp_validate_request ;
- ipp_set_status ;
-
+ zdoor_handle_init;
+ zdoor_handle_destroy;
+ zdoor_open;
+ zdoor_close;
local:
- * ;
-} ;
+ *;
+};
diff --git a/usr/src/lib/libzdoor/common/zdoor-int.c b/usr/src/lib/libzdoor/common/zdoor-int.c
new file mode 100644
index 0000000000..f77c1453d4
--- /dev/null
+++ b/usr/src/lib/libzdoor/common/zdoor-int.c
@@ -0,0 +1,324 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2012 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/fork.h>
+#include <libcontract.h>
+#include <libzonecfg.h>
+#include <sys/contract/process.h>
+#include <sys/ctfs.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "zdoor-int.h"
+#include "zerror.h"
+
+#define ZDOOR_FMT_STR "/var/tmp/.%s"
+
+
+static int
+init_template(void)
+{
+ int fd = 0;
+ int err = 0;
+
+ fd = open64(CTFS_ROOT "/process/template", O_RDWR);
+ if (fd == -1)
+ return (-1);
+
+ err |= ct_tmpl_set_critical(fd, 0);
+ err |= ct_tmpl_set_informative(fd, 0);
+ err |= ct_pr_tmpl_set_fatal(fd, CT_PR_EV_HWERR);
+ err |= ct_pr_tmpl_set_param(fd, CT_PR_PGRPONLY | CT_PR_REGENT);
+ if (err || ct_tmpl_activate(fd)) {
+ (void) close(fd);
+ return (-1);
+ }
+
+ return (fd);
+}
+
+static int
+contract_latest(ctid_t *id)
+{
+ int cfd = 0;
+ int r = 0;
+ ct_stathdl_t st = {0};
+ ctid_t result = {0};
+
+ if ((cfd = open64(CTFS_ROOT "/process/latest", O_RDONLY)) == -1)
+ return (errno);
+ if ((r = ct_status_read(cfd, CTD_COMMON, &st)) != 0) {
+ (void) close(cfd);
+ return (r);
+ }
+
+ result = ct_status_get_id(st);
+ ct_status_free(st);
+ (void) close(cfd);
+
+ *id = result;
+ return (0);
+}
+
+static int
+close_on_exec(int fd)
+{
+ int flags = fcntl(fd, F_GETFD, 0);
+ if ((flags != -1) && (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) != -1))
+ return (0);
+ return (-1);
+}
+
+static int
+contract_open(ctid_t ctid, const char *type, const char *file, int oflag)
+{
+ char path[PATH_MAX];
+ int n = 0;
+ int fd = 0;
+
+ if (type == NULL)
+ type = "all";
+
+ n = snprintf(path, PATH_MAX, CTFS_ROOT "/%s/%ld/%s", type, ctid, file);
+ if (n >= sizeof (path)) {
+ errno = ENAMETOOLONG;
+ return (-1);
+ }
+
+ fd = open64(path, oflag);
+ if (fd != -1) {
+ if (close_on_exec(fd) == -1) {
+ int err = errno;
+ (void) close(fd);
+ errno = err;
+ return (-1);
+ }
+ }
+ return (fd);
+}
+
+static int
+contract_abandon_id(ctid_t ctid)
+{
+ int fd = 0;
+ int err = 0;
+
+ fd = contract_open(ctid, "all", "ctl", O_WRONLY);
+ if (fd == -1)
+ return (errno);
+
+ err = ct_ctl_abandon(fd);
+ (void) close(fd);
+
+ return (err);
+}
+
+/*
+ * zdoor_fattach(zone,service,door,detach_only) is heavily borrowed from
+ * zonestatd. Basically this forks, zone_enter's the targeted zone,
+ * fattaches to /var/tmp/.<service> with the door you've opened.
+ * detach_only gets passed in on door_stop to fdetach in the targeted zone.
+ * Note that this code really does require all the contract calls, which are
+ * all the static functions preceding this (have a look at zone_enter; without
+ * that code zone_enter will kick back EINVAL).
+ */
+int
+zdoor_fattach(zoneid_t zoneid, const char *service, int door, int detach_only)
+{
+ int fd = 0;
+ int len = 0;
+ int pid = 0;
+ int stat = 0;
+ int tmpl_fd = 0;
+ char path[MAXPATHLEN] = {0};
+ ctid_t ct = -1;
+
+ if (zoneid < 0) {
+ zdoor_debug("zdoor_fattach: zoneid < 0");
+ return (ZDOOR_ARGS_ERROR);
+ }
+
+ if (service == NULL) {
+ zdoor_debug("zdoor_fattach: NULL service");
+ return (ZDOOR_ARGS_ERROR);
+ }
+
+ if ((tmpl_fd = init_template()) < 0) {
+ zdoor_warn("zdoor_fattach: init contract for %d:%s failed",
+ zoneid, service);
+ return (ZDOOR_ERROR);
+ }
+
+ len = snprintf(NULL, 0, ZDOOR_FMT_STR, service) + 1;
+ if (len > MAXPATHLEN)
+ return (ZDOOR_ARGS_ERROR);
+ (void) snprintf(path, len, ZDOOR_FMT_STR, service);
+
+ zdoor_info("zdoor_fattach: ensuring %s", path);
+
+ pid = fork();
+ if (pid < 0) {
+ (void) ct_tmpl_clear(tmpl_fd);
+ zdoor_error("zdoor_fattach: unable to fork for zone_enter: %s",
+ strerror(errno));
+ return (ZDOOR_OK);
+ }
+
+ if (pid == 0) {
+ zdoor_debug("zdoor_fattach(CHILD): starting");
+ (void) ct_tmpl_clear(tmpl_fd);
+ (void) close(tmpl_fd);
+ if (zone_enter(zoneid) != 0) {
+ zdoor_debug("zdoor_fattach(CHILD): zone_enter fail %s",
+ strerror(errno));
+ if (errno == EINVAL) {
+ _exit(0);
+ }
+ _exit(1);
+ }
+ (void) fdetach(path);
+ (void) unlink(path);
+ if (detach_only) {
+ zdoor_debug("zdoor_fattach(CHILD): detach only, done");
+ _exit(0);
+ }
+ fd = open(path, O_CREAT|O_RDWR, 0644);
+ if (fd < 0) {
+ zdoor_debug("zdoor_fattach(CHILD): open failed: %s",
+ strerror(errno));
+ _exit(2);
+ }
+ if (fattach(door, path) != 0) {
+ zdoor_debug("zdoor_fattach(CHILD): fattach failed: %s",
+ strerror(errno));
+ _exit(3);
+ }
+ _exit(0);
+ }
+ if (contract_latest(&ct) == -1)
+ ct = -1;
+ (void) ct_tmpl_clear(tmpl_fd);
+ (void) close(tmpl_fd);
+ (void) contract_abandon_id(ct);
+
+ zdoor_debug("zdoor_fattach: waiting for child...");
+ while (waitpid(pid, &stat, 0) != pid)
+ ;
+ if (WIFEXITED(stat) && WEXITSTATUS(stat) == 0) {
+ zdoor_debug(" child exited with success");
+ zdoor_debug("zdoor_fattach: returning ZDOOR_OK");
+ return (ZDOOR_OK);
+ }
+
+ zdoor_debug(" child exited with %d", WEXITSTATUS(stat));
+ zdoor_debug("zdoor_fattach: returning ZDOOR_ERROR");
+ return (ZDOOR_ERROR);
+}
+
+/*
+ * zdoor_zone_is_running(zone) returns 1 if the specified zone is running, or 0
+ * if it is any other state. It additionally eats any other errors it
+ * encounters and returns 0 upon encountering them.
+ */
+boolean_t
+zdoor_zone_is_running(zoneid_t zoneid)
+{
+ zone_state_t state;
+ char zone[ZONENAME_MAX];
+ if (zoneid < 0)
+ return (B_FALSE);
+
+ if (getzonenamebyid(zoneid, zone, ZONENAME_MAX) < 0)
+ return (B_FALSE);
+
+ if (!zone_get_state((char *)zone, &state) == Z_OK)
+ return (B_FALSE);
+
+ return (state == ZONE_STATE_RUNNING);
+}
+
+/*
+ * zdoor_cookie_create simply allocates and initializes
+ * memory. Returns NULL on any error.
+ */
+zdoor_cookie_t *
+zdoor_cookie_create(const char *zonename, const char *service,
+const void *biscuit)
+{
+ zdoor_cookie_t *cookie = NULL;
+
+ if (zonename == NULL || service == NULL)
+ return (NULL);
+
+ cookie = (zdoor_cookie_t *)calloc(1, sizeof (zdoor_cookie_t));
+ if (cookie == NULL) {
+ OUT_OF_MEMORY();
+ return (NULL);
+ }
+ cookie->zdc_biscuit = (void *)biscuit;
+ cookie->zdc_zonename = strdup((char *)zonename);
+ if (cookie->zdc_zonename == NULL) {
+ zdoor_cookie_free(cookie);
+ OUT_OF_MEMORY();
+ return (NULL);
+ }
+ cookie->zdc_service = strdup((char *)service);
+ if (cookie->zdc_service == NULL) {
+ zdoor_cookie_free(cookie);
+ OUT_OF_MEMORY();
+ return (NULL);
+ }
+
+ return (cookie);
+}
+
+/*
+ * zdoor_cookie_free(cookie) cleans up any memory associated with the
+ * specified cookie.
+ */
+void
+zdoor_cookie_free(zdoor_cookie_t *cookie)
+{
+ if (cookie == NULL)
+ return;
+
+ if (cookie->zdc_zonename != NULL) {
+ free(cookie->zdc_zonename);
+ cookie->zdc_zonename = NULL;
+ }
+
+ if (cookie->zdc_service != NULL) {
+ free(cookie->zdc_service);
+ cookie->zdc_service = NULL;
+ }
+
+ free(cookie);
+}
diff --git a/usr/src/lib/print/libprint/common/list.h b/usr/src/lib/libzdoor/common/zdoor-int.h
index cb9b62df78..782452c426 100644
--- a/usr/src/lib/print/libprint/common/list.h
+++ b/usr/src/lib/libzdoor/common/zdoor-int.h
@@ -19,32 +19,46 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#ifndef _LIST_H
-#define _LIST_H
+#ifndef _ZDOOR_INT_H
+#define _ZDOOR_INT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
+#pragma ident "%Z%%M% %I% %E% SMI"
-#include <sys/va_list.h>
+#include <pthread.h>
+#include <zdoor.h>
#ifdef __cplusplus
extern "C" {
#endif
-#define VFUNC_T int (*)(void *, __va_list) /* for casting */
-#define COMP_T int (*)(void *, void *) /* for casting */
+typedef enum zdoor_action_t {
+ ZDOOR_ACTION_NOOP,
+ ZDOOR_ACTION_STOP,
+ ZDOOR_ACTION_START
+} zdoor_action_t;
-extern void **list_append(void **, void *);
-extern void **list_append_unique(void **, void *, int (*)(void *, void*));
-extern void **list_concatenate(void **, void **);
-extern void * list_locate(void **, int (*)(void *, void *), void *);
-extern int list_iterate(void **, int (*)(void *, __va_list), ...);
+struct zdoor_handle {
+ pthread_mutex_t zdh_lock;
+ void *zdh_zonecfg_handle;
+ void *zdh_ztree;
+};
+
+zdoor_cookie_t *zdoor_cookie_create(const char *zonename, const char *service,
+ const void *biscuit);
+
+void zdoor_cookie_free(zdoor_cookie_t *cookie);
+
+boolean_t zdoor_zone_is_running(zoneid_t zoneid);
+
+int zdoor_fattach(zoneid_t zoneid, const char *service, int door,
+ int detach_only);
#ifdef __cplusplus
}
#endif
-#endif /* _LIST_H */
+#endif /* _ZDOOR_INT_H */
diff --git a/usr/src/lib/libzdoor/common/zdoor.c b/usr/src/lib/libzdoor/common/zdoor.c
new file mode 100644
index 0000000000..f2996b4e2d
--- /dev/null
+++ b/usr/src/lib/libzdoor/common/zdoor.c
@@ -0,0 +1,437 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <alloca.h>
+#include <door.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libzonecfg.h>
+#include <pthread.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <syslog.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stropts.h>
+#include <unistd.h>
+#include <zdoor.h>
+#include <zone.h>
+
+#include "zdoor-int.h"
+#include "zerror.h"
+#include "ztree.h"
+
+extern void *
+zonecfg_notify_bind(int(*func)(const char *zonename, zoneid_t zid,
+ const char *newstate, const char *oldstate,
+ hrtime_t when, void *p), void *p);
+
+extern void
+zonecfg_notify_unbind(void *handle);
+
+/*
+ * _callback(cookie, door_args...) is our private function that we tell
+ * the Solaris door API about. This function does some sanity checking on
+ * arguments and issues a callback to the owner of this door. That API
+ * will return us memory that needs to be sent back to the client on the
+ * other end of the door, but since the door_return API never gives you
+ * back control of the function, this does a simple alloca/memcpy and
+ * frees up the memory pointed to by the parent. While this really doesn't
+ * let a client do much other than pass a simple struct of primitives (or
+ * more likely more common a char *), that's the way the door API works,
+ * and so this isn't really imposing any restriction that didn't already
+ * need to be dealt with by someone. This is why the zdoor_result structure
+ * takes a char *, rather than a void * for the data pointer.
+ */
+static void
+_callback(void *cookie, char *argp, size_t arg_size, door_desc_t *dp,
+ uint_t n_desc)
+{
+ zdoor_result_t *result = NULL;
+ void *door_response = NULL;
+ int size = 0;
+ dtree_entry_t *entry = (dtree_entry_t *)cookie;
+
+ if (entry == NULL) {
+ zdoor_warn("_callback: NULL cookie? door_returning");
+ (void) door_return(NULL, 0, NULL, 0);
+ }
+
+ (void) pthread_mutex_lock(&entry->dte_parent->zte_parent->zdh_lock);
+ zdoor_debug("_callback: calling back with %p", entry->dte_cookie);
+ result = entry->dte_callback(entry->dte_cookie, argp, arg_size);
+ zdoor_debug("_callback: app callback returned %p", result);
+ (void) pthread_mutex_unlock(&entry->dte_parent->zte_parent->zdh_lock);
+
+ if (result == NULL) {
+ zdoor_debug("_callback: door_returning NULL");
+ (void) door_return(NULL, 0, NULL, 0);
+ }
+
+ if (result->zdr_data != NULL && result->zdr_size > 0) {
+ door_response = alloca(result->zdr_size);
+ if (door_response != NULL) {
+ size = result->zdr_size;
+ (void) memcpy(door_response,
+ (void *) result->zdr_data, size);
+ }
+ }
+
+ if (result->zdr_data != NULL)
+ free(result->zdr_data);
+ free(result);
+
+ zdoor_debug("_callback: door_returning %p, %d", door_response, size);
+ (void) door_return(door_response, size, NULL, 0);
+}
+
+static void
+zdoor_stop(dtree_entry_t *entry)
+{
+ zoneid_t zid = -1;
+
+ if (entry == NULL) {
+ zdoor_debug("zdoor_stop: NULL arguments");
+ return;
+ }
+
+ zdoor_debug("zdoor_stop: entry=%p, zone=%s, service=%s",
+ entry, entry->dte_parent->zte_zonename, entry->dte_service);
+
+ zid = getzoneidbyname(entry->dte_parent->zte_zonename);
+ (void) zdoor_fattach(zid, entry->dte_service, entry->dte_door, 1);
+ (void) door_revoke(entry->dte_door);
+ entry->dte_door = -1;
+
+ zdoor_debug("zdoor_stop returning");
+}
+
+/*
+ * zdoor_create is called both by the main API
+ * call zdoor_open, as well as by the zone_monitor code upon a zone restart
+ * (assuming it already has a door in it). This code assumes that the
+ * permissions were correct (e.g., the target door is not a GZ, that this
+ * program is being run out of the GZ), but does not assume that the target
+ * door file has not changed out from under us, so that is explicitly rechecked.
+ *
+ * This also assumes the parent has already locked handle.
+ */
+static int
+zdoor_create(dtree_entry_t *entry)
+{
+ int status = ZDOOR_OK;
+ zoneid_t zid = -1;
+ zdoor_handle_t handle = NULL;
+
+ if (entry == NULL) {
+ zdoor_debug("zdoor_create: NULL arguments");
+ return (ZDOOR_ARGS_ERROR);
+ }
+
+ zdoor_debug("zdoor_create: entry=%p, zone=%s, service=%s",
+ entry, entry->dte_parent->zte_zonename, entry->dte_service);
+
+ handle = entry->dte_parent->zte_parent;
+
+ zid = getzoneidbyname(entry->dte_parent->zte_zonename);
+ if (zid < 0) {
+ zdoor_info("zdoor_create: %s is a non-existient zone",
+ entry->dte_parent->zte_zonename);
+ return (ZDOOR_ERROR);
+ }
+ if (!zdoor_zone_is_running(zid)) {
+ zdoor_debug("zdoor_create: %s is not running",
+ entry->dte_parent->zte_zonename);
+ return (ZDOOR_ZONE_NOT_RUNNING);
+ }
+
+ entry->dte_door = door_create(_callback, entry, 0);
+ zdoor_info("zdoor_create: door_create returned %d", entry->dte_door);
+ if (entry->dte_door < 0) {
+ zdoor_stop(entry);
+ return (ZDOOR_ERROR);
+ }
+
+ status = zdoor_fattach(zid, entry->dte_service, entry->dte_door, 0);
+
+ zdoor_debug("zdoor_create: returning %d", status);
+ return (status);
+}
+
+
+/*
+ * door_visitor(entry) is a callback from the ztree code that checks whether
+ * or not we should be taking some action on a given door. Note that the
+ * callpath to this API is:
+ * SYSTEM ->
+ * zone_monitor ->
+ * ztree_walk ->
+ * door_visitor
+ *
+ * Which is important to note that this API assumes that all things needing
+ * locking are locked by a parent caller (which is the zone_monitor).
+ */
+static void
+zdoor_visitor(dtree_entry_t *entry)
+{
+ if (entry == NULL) {
+ zdoor_info("zdoor_visitor: entered with NULL entry");
+ return;
+ }
+
+ zdoor_debug("zdoor_visitor: entered for entry=%p, service=%s",
+ entry, entry->dte_service);
+
+ if (entry->dte_parent->zte_action == ZDOOR_ACTION_STOP) {
+ zdoor_debug(" stopping zdoor");
+ zdoor_stop(entry);
+ } else if (entry->dte_parent->zte_action == ZDOOR_ACTION_START) {
+ zdoor_debug(" starting zdoor");
+ if (zdoor_create(entry) != ZDOOR_OK) {
+ zdoor_error("door_visitor: Unable to restart zdoor\n");
+ }
+ }
+}
+
+/*
+ * zone_monitor(zonename, zid, newstate, oldstate, when, cookie) is our
+ * registered callback with libzonecfg to notify us of any changes to a
+ * given zone. This activates a walk on all doors for a zone iff the state
+ * is changing from running or into running.
+ */
+static int
+zone_monitor(const char *zonename, zoneid_t zid, const char *newstate,
+ const char *oldstate, hrtime_t when, void *p)
+{
+ zdoor_handle_t handle = (zdoor_handle_t)p;
+ ztree_entry_t *entry = NULL;
+
+ if (handle == NULL) {
+ zdoor_warn("zone_monitor: entered with NULL handle?");
+ return (-1);
+ }
+
+ zdoor_info("zone_monitor: zone=%s, zid=%d, newst=%s, oldst=%s, p=%p",
+ zonename, zid, newstate, oldstate, p);
+
+ (void) pthread_mutex_lock(&(handle->zdh_lock));
+ entry = ztree_zone_find(handle, zonename);
+ if (entry != NULL) {
+ zdoor_debug(" found entry in ztree");
+ entry->zte_action = ZDOOR_ACTION_NOOP;
+ if (strcmp("running", newstate) == 0) {
+ if (strcmp("ready", oldstate) == 0)
+ entry->zte_action = ZDOOR_ACTION_START;
+ } else if (strcmp("shutting_down", newstate) == 0) {
+ if (strcmp("running", oldstate) == 0)
+ entry->zte_action = ZDOOR_ACTION_STOP;
+ }
+ zdoor_debug(" set state to: %d", entry->zte_action);
+ if (entry->zte_action != ZDOOR_ACTION_NOOP)
+ ztree_walk_doors(handle, zonename);
+ }
+ (void) pthread_mutex_unlock(&(handle->zdh_lock));
+
+ zdoor_info("zone_monitor: returning");
+ return (0);
+}
+
+zdoor_handle_t
+zdoor_handle_init()
+{
+ zdoor_handle_t handle = NULL;
+
+ zdoor_debug("zdoor_handle_init entered");
+
+ handle = (zdoor_handle_t)calloc(1, sizeof (struct zdoor_handle));
+ if (handle == NULL) {
+ OUT_OF_MEMORY();
+ return (NULL);
+ }
+
+ (void) pthread_mutex_init(&(handle->zdh_lock), NULL);
+ handle->zdh_zonecfg_handle = zonecfg_notify_bind(zone_monitor, handle);
+ if (handle->zdh_zonecfg_handle == NULL) {
+ zdoor_error("zonecfg_notify_bind failure: %s", strerror(errno));
+ return (NULL);
+ }
+
+ zdoor_debug("zdoor_handle_init returning %p", handle);
+ return (handle);
+}
+
+void
+zdoor_handle_destroy(zdoor_handle_t handle)
+{
+ if (handle == NULL) {
+ zdoor_debug("zdoor_handle_destroy: NULL arguments");
+ return;
+ }
+
+ zdoor_debug("zdoor_handle_destroy: handle=%p", handle);
+
+ (void) pthread_mutex_lock(&(handle->zdh_lock));
+ zonecfg_notify_unbind(handle->zdh_zonecfg_handle);
+ (void) pthread_mutex_unlock(&(handle->zdh_lock));
+ (void) pthread_mutex_destroy(&(handle->zdh_lock));
+ free(handle);
+}
+
+/*
+ * zdoor_open(zone, service, biscuit, callback) is the main public facing API in
+ * libzdoor. It will open a door with the name .[service] under
+ * [zonepath]/root/var/tmp, where [zonepath] is resolved on the fly. Note this
+ * API can only be invoked from the global zone, and will not allow you to open
+ * a zdoor in the global zone.
+ */
+int
+zdoor_open(zdoor_handle_t handle, const char *zonename, const char *service,
+ void *biscuit, zdoor_callback callback)
+{
+ zdoor_cookie_t *zdoor_cookie = NULL;
+ int rc = -1;
+ int status = ZDOOR_OK;
+ zoneid_t zid = -1;
+ dtree_entry_t *entry = NULL;
+
+ if (handle == NULL || zonename == NULL ||
+ service == NULL || callback == NULL) {
+ zdoor_debug("zdoor_open: NULL arguments");
+ return (ZDOOR_ARGS_ERROR);
+ }
+ zdoor_debug("zdoor_open: entered: handle=%p, zone=%s, service=%s",
+ handle, zonename, service);
+
+ if (getzoneid() != GLOBAL_ZONEID) {
+ zdoor_warn("zdoor_open: not invoked from global zone");
+ return (ZDOOR_NOT_GLOBAL_ZONE);
+ }
+
+
+ zid = getzoneidbyname(zonename);
+ if (zid < 0) {
+ zdoor_info("zdoor_open: %s is a non-existent zone", zonename);
+ return (ZDOOR_ARGS_ERROR);
+ }
+
+ if (zid == GLOBAL_ZONEID) {
+ zdoor_warn("zdoor_open: zdoors not allowed in global zone");
+ return (ZDOOR_ZONE_FORBIDDEN);
+ }
+
+ if (!zdoor_zone_is_running(zid)) {
+ zdoor_info("zdoor_open: %s is not running", zonename);
+ return (ZDOOR_ZONE_NOT_RUNNING);
+ }
+
+ zdoor_cookie = zdoor_cookie_create(zonename, service, biscuit);
+ if (zdoor_cookie == NULL) {
+ OUT_OF_MEMORY();
+ return (ZDOOR_OUT_OF_MEMORY);
+ }
+
+ (void) pthread_mutex_lock(&(handle->zdh_lock));
+ rc = ztree_zone_add(handle, zonename, zdoor_visitor);
+ if (rc != ZTREE_SUCCESS && rc != ZTREE_ALREADY_EXISTS) {
+ zdoor_debug("zdoor_open: unable to add zone to ztree: %d", rc);
+ status = ZDOOR_ERROR;
+ goto out;
+ }
+ rc = ztree_door_add(handle, zonename, service, callback,
+ zdoor_cookie);
+ if (rc != ZTREE_SUCCESS) {
+ zdoor_debug("zdoor_open: unable to add door to ztree: %d", rc);
+ if (rc == ZTREE_ALREADY_EXISTS) {
+ zdoor_warn("service %s already has a zdoor", service);
+ }
+ status = ZDOOR_ERROR;
+ goto out;
+ }
+
+ entry = ztree_door_find(handle, zonename, service);
+ if (entry == NULL) {
+ zdoor_debug("zdoor_open: unable to find door in ztree?");
+ status = ZDOOR_ERROR;
+ goto out;
+ }
+ if (zdoor_create(entry) != ZDOOR_OK) {
+ zdoor_info("zdoor_open: zdoor_create failed.");
+ status = ZDOOR_ERROR;
+ goto out;
+ }
+out:
+ if (status != ZDOOR_OK) {
+ zdoor_debug("zdoor_open: status not ok, stopping and cleaning");
+ zdoor_stop(entry);
+ ztree_door_remove(handle, entry);
+ zdoor_cookie_free(zdoor_cookie);
+ }
+ (void) pthread_mutex_unlock(&(handle->zdh_lock));
+ zdoor_debug("zdoor_open: returning %d", status);
+ return (status);
+}
+
+/*
+ * zdoor_close(zone, service) unregisters a previously created zdoor, and
+ * returns the biscuit provided at creation time, so the caller can free it.
+ * Returns NULL on any error.
+ */
+void *
+zdoor_close(zdoor_handle_t handle, const char *zonename, const char *service)
+{
+ dtree_entry_t *entry = NULL;
+ zdoor_cookie_t *cookie = NULL;
+ void *biscuit = NULL;
+
+ if (handle == NULL || zonename == NULL || service == NULL) {
+ zdoor_debug("zdoor_close: NULL arguments");
+ return (NULL);
+ }
+
+ zdoor_debug("zdoor_close: entered handle=%p, zone=%s, service=%s",
+ handle, zonename, service);
+
+ (void) pthread_mutex_lock(&(handle->zdh_lock));
+
+ entry = ztree_door_find(handle, zonename, service);
+ if (entry != NULL) {
+ zdoor_debug("zdoor_close: found door in ztree, stopping");
+ zdoor_stop(entry);
+ cookie = ztree_door_remove(handle, entry);
+ if (cookie != NULL) {
+ biscuit = cookie->zdc_biscuit;
+ zdoor_cookie_free(cookie);
+ }
+ } else {
+ zdoor_debug("zdoor_close: didn't find door in ztree");
+ }
+
+ (void) pthread_mutex_unlock(&(handle->zdh_lock));
+
+ zdoor_debug("zdoor_close: returning %p", biscuit);
+ return (biscuit);
+}
diff --git a/usr/src/lib/libzdoor/common/zerror.c b/usr/src/lib/libzdoor/common/zerror.c
new file mode 100644
index 0000000000..5ccb449e1b
--- /dev/null
+++ b/usr/src/lib/libzdoor/common/zerror.c
@@ -0,0 +1,117 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <pthread.h>
+#include <sys/types.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "zerror.h"
+
+static const char *PREFIX = "%s ZDOOR:%s:T(%d): ";
+
+static const char *DEBUG_ENV_VAR = "ZDOOR_TRACE";
+
+static boolean_t
+is_debug_enabled()
+{
+ boolean_t enabled = B_FALSE;
+ const char *_envp = getenv(DEBUG_ENV_VAR);
+ if (_envp != NULL && atoi(_envp) >= 2)
+ enabled = B_TRUE;
+
+ return (enabled);
+}
+
+static boolean_t
+is_info_enabled()
+{
+ boolean_t enabled = B_FALSE;
+ const char *_envp = getenv(DEBUG_ENV_VAR);
+ if (_envp != NULL && atoi(_envp) >= 1)
+ enabled = B_TRUE;
+
+ return (enabled);
+}
+
+void
+zdoor_debug(const char *fmt, ...)
+{
+ va_list alist;
+
+ if (!is_debug_enabled())
+ return;
+
+ va_start(alist, fmt);
+
+ (void) fprintf(stderr, PREFIX, __TIME__, "DEBUG", pthread_self());
+ (void) vfprintf(stderr, fmt, alist);
+ (void) fprintf(stderr, "\n");
+ va_end(alist);
+}
+
+void
+zdoor_info(const char *fmt, ...)
+{
+ va_list alist;
+
+ if (!is_info_enabled())
+ return;
+
+ va_start(alist, fmt);
+
+ (void) fprintf(stderr, PREFIX, __TIME__, "INFO", pthread_self());
+ (void) vfprintf(stderr, fmt, alist);
+ (void) fprintf(stderr, "\n");
+ va_end(alist);
+}
+
+void
+zdoor_warn(const char *fmt, ...)
+{
+ va_list alist;
+
+ va_start(alist, fmt);
+
+ (void) fprintf(stderr, PREFIX, __TIME__, "WARN", pthread_self());
+ (void) vfprintf(stderr, fmt, alist);
+ (void) fprintf(stderr, "\n");
+ va_end(alist);
+}
+
+void
+zdoor_error(const char *fmt, ...)
+{
+ va_list alist;
+
+ va_start(alist, fmt);
+
+ (void) fprintf(stderr, PREFIX, __TIME__, "ERROR", pthread_self());
+ (void) vfprintf(stderr, fmt, alist);
+ (void) fprintf(stderr, "\n");
+ va_end(alist);
+}
diff --git a/usr/src/cmd/lp/lib/papi/lpsched-service.c b/usr/src/lib/libzdoor/common/zerror.h
index 33f0082944..afc848fcea 100644
--- a/usr/src/cmd/lp/lib/papi/lpsched-service.c
+++ b/usr/src/lib/libzdoor/common/zerror.h
@@ -19,29 +19,30 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
+#ifndef _ZERROR_H
+#define _ZERROR_H
+#include <stdio.h>
#include <stdlib.h>
-#include <libintl.h>
-#include <papi_impl.h>
-#include "form.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void zdoor_debug(const char *fmt, ...);
+extern void zdoor_info(const char *fmt, ...);
+extern void zdoor_warn(const char *fmt, ...);
+extern void zdoor_error(const char *fmt, ...);
-void
-lpsched_service_information(papi_attribute_t ***attrs)
-{
- FORM form;
+#define OUT_OF_MEMORY() \
+ zdoor_error("Out of Memory at %s:%d", __FILE__, __LINE__)
- while (getform(NAME_ALL, &form, (FALERT *)0, (FILE **)0) != -1) {
- papiAttributeListAddString(attrs, PAPI_ATTR_APPEND,
- "form-supported", form.name);
- freeform(&form);
- }
+#ifdef __cplusplus
}
+#endif
+
+#endif /* _ZERROR_H */
diff --git a/usr/src/lib/libzdoor/common/ztree.c b/usr/src/lib/libzdoor/common/ztree.c
new file mode 100644
index 0000000000..25c67f62fb
--- /dev/null
+++ b/usr/src/lib/libzdoor/common/ztree.c
@@ -0,0 +1,344 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <search.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "zerror.h"
+#include "ztree.h"
+
+
+/*
+ * ztree is just a helpful wrapper over a tsearch binary tree that deals with
+ * all of the libzdoor types.
+ *
+ * So what this ztree actually is is a tree of trees. The outer tree is a tree
+ * of zones, and each node holds a tree of doors.
+ */
+
+/*
+ * _ztree_compare(p1, p2) is the tsearch callback for comparing the "outer"
+ * tree (e.g., the one of zones).
+ */
+static int
+_ztree_compare(const void *p1, const void *p2)
+{
+ ztree_entry_t *z1 = (ztree_entry_t *)p1;
+ ztree_entry_t *z2 = (ztree_entry_t *)p2;
+
+ if (z1 == NULL && z2 == NULL)
+ return (0);
+ if (z1 == NULL && z2 != NULL)
+ return (-1);
+ if (z1 != NULL && z2 == NULL)
+ return (1);
+
+ return (strcmp(z1->zte_zonename, z2->zte_zonename));
+}
+
+/*
+ * _dtree_compare(p1, p2) is the tsearch callback for comparing the "inner"
+ * tree (e.g., the one of doors).
+ */
+static int
+_dtree_compare(const void *p1, const void *p2)
+{
+ dtree_entry_t *d1 = (dtree_entry_t *)p1;
+ dtree_entry_t *d2 = (dtree_entry_t *)p2;
+
+ if (d1 == NULL && d2 == NULL)
+ return (0);
+ if (d1 == NULL && d2 != NULL)
+ return (-1);
+ if (d1 != NULL && d2 == NULL)
+ return (1);
+
+ return (strcmp(d1->dte_service, d2->dte_service));
+}
+
+static void
+ztree_entry_free(ztree_entry_t *entry)
+{
+ if (entry == NULL)
+ return;
+
+ if (entry->zte_zonename != NULL)
+ free(entry->zte_zonename);
+
+ free(entry);
+}
+
+static void
+dtree_entry_free(dtree_entry_t *entry)
+{
+ if (entry == NULL)
+ return;
+
+ if (entry->dte_service)
+ free(entry->dte_service);
+
+ free(entry);
+}
+
+
+/*
+ * ztree_zone_add inserts a new zone into the tree iff
+ * there is not already an entry for that zone. This method returns one of
+ * four possible return codes, ZTREE_SUCCESS on :), ZTREE_ARGUMENT_ERROR if
+ * zone is NULL, ZTREE_ERROR if there is internal failure (e.g., OOM), and
+ * ZTREE_ALREADY_EXISTS if the zone is already in the tree.
+ */
+int
+ztree_zone_add(struct zdoor_handle *handle, const char *zonename,
+ztree_door_visitor visitor)
+{
+ ztree_entry_t *entry = NULL;
+ void *ret = NULL;
+ int status = ZTREE_SUCCESS;
+
+ if (handle == NULL || zonename == NULL)
+ return (ZTREE_ARGUMENT_ERROR);
+
+ entry = (ztree_entry_t *)calloc(1, sizeof (ztree_entry_t));
+ if (entry == NULL) {
+ OUT_OF_MEMORY();
+ return (ZTREE_ERROR);
+ }
+ entry->zte_zonename = strdup(zonename);
+ if (entry->zte_zonename == NULL) {
+ ztree_entry_free(entry);
+ OUT_OF_MEMORY();
+ return (ZTREE_ERROR);
+ }
+ entry->zte_action = ZDOOR_ACTION_NOOP;
+ entry->zte_parent = handle;
+ entry->zte_visitor = visitor;
+
+ ret = tsearch(entry, &(handle->zdh_ztree), _ztree_compare);
+ if (ret == NULL) {
+ ztree_entry_free(entry);
+ status = ZTREE_ERROR;
+ OUT_OF_MEMORY();
+ } else if ((*(ztree_entry_t **)ret) != entry) {
+ ztree_entry_free(entry);
+ status = ZTREE_ALREADY_EXISTS;
+ }
+
+ return (status);
+}
+
+
+/*
+ * ztree_zone_find returns the entry in the "outer" tree representing
+ * this zone, if it exists, NULL otherwise.
+ */
+ztree_entry_t *
+ztree_zone_find(struct zdoor_handle *handle, const char *zonename)
+{
+ ztree_entry_t key = {0};
+ void *ret = NULL;
+
+ if (handle == NULL || zonename == NULL)
+ return (NULL);
+
+ key.zte_zonename = (char *)zonename;
+ ret = tfind(&key, &(handle->zdh_ztree), _ztree_compare);
+
+ return (ret != NULL ? *(ztree_entry_t **)ret : NULL);
+}
+
+
+/*
+ * ztree_zone_remove removes an entry from the "outer" zone iff the
+ * zone exists. The cookie set by the creator is returned.
+ */
+void
+ztree_zone_remove(struct zdoor_handle *handle, ztree_entry_t *entry)
+{
+ if (handle == NULL || entry == NULL)
+ return;
+
+ tdelete(entry, &(handle->zdh_ztree), _ztree_compare);
+ ztree_entry_free(entry);
+}
+
+
+/*
+ * ztree_door_add inserts a new door into the inner tree iff
+ * there is not already an entry for that door. This method returns one of
+ * four possible return codes, ZTREE_SUCCESS on :), ZTREE_ARGUMENT_ERROR if
+ * zone is NULL, ZTREE_ERROR if there is internal failure (e.g., OOM), and
+ * ZTREE_ALREADY_EXISTS if the door is already in the tree.
+ */
+int
+ztree_door_add(struct zdoor_handle *handle, const char *zonename,
+const char *service, zdoor_callback callback, zdoor_cookie_t *cookie)
+{
+ dtree_entry_t *entry = NULL;
+ ztree_entry_t *znode = NULL;
+ void *ret = NULL;
+ int status = ZTREE_SUCCESS;
+
+ if (handle == NULL || zonename == NULL || service == NULL)
+ return (ZTREE_ARGUMENT_ERROR);
+
+ znode = ztree_zone_find(handle, zonename);
+ if (znode == NULL)
+ return (ZTREE_NOT_FOUND);
+
+ entry = (dtree_entry_t *)calloc(1, sizeof (dtree_entry_t));
+ if (entry == NULL) {
+ OUT_OF_MEMORY();
+ return (ZTREE_ERROR);
+ }
+ entry->dte_parent = znode;
+ entry->dte_callback = callback;
+ entry->dte_cookie = cookie;
+ entry->dte_service = strdup(service);
+ if (entry->dte_service == NULL) {
+ free(entry);
+ OUT_OF_MEMORY();
+ return (ZTREE_ERROR);
+ }
+
+ ret = tsearch(entry, &(znode->zte_door_tree), _dtree_compare);
+ if (ret == NULL) {
+ dtree_entry_free(entry);
+ OUT_OF_MEMORY();
+ status = ZTREE_ERROR;
+ } else if ((*(dtree_entry_t **)ret) != entry) {
+ dtree_entry_free(entry);
+ status = ZTREE_ALREADY_EXISTS;
+ } else {
+ znode->zte_num_doors++;
+ }
+
+ return (status);
+}
+
+
+/*
+ * ztree_door_find returns the entry in the "inner" tree
+ * representing this zone, if it exists, NULL otherwise.
+ */
+dtree_entry_t *
+ztree_door_find(struct zdoor_handle *handle, const char *zonename,
+const char *service)
+{
+ dtree_entry_t key = {0};
+ ztree_entry_t *znode = NULL;
+ void *ret = NULL;
+
+ if (handle == NULL || zonename == NULL || service == NULL)
+ return (NULL);
+
+ znode = ztree_zone_find(handle, zonename);
+ if (znode == NULL)
+ return (NULL);
+
+ key.dte_service = (char *)service;
+ ret = tfind(&key, &(znode->zte_door_tree), _dtree_compare);
+
+ return (ret != NULL ? *(dtree_entry_t **)ret : NULL);
+}
+
+
+/*
+ * ztree_door_remove(zone, door) removes a node from the inner tree iff
+ * both the door and zone exist. Note this frees the node as well. The
+ * cookie set by the creator is returned.
+ */
+zdoor_cookie_t *
+ztree_door_remove(struct zdoor_handle *handle, dtree_entry_t *entry)
+{
+ zdoor_cookie_t *cookie = NULL;
+ ztree_entry_t *znode = NULL;
+
+ if (handle == NULL || entry == NULL)
+ return (NULL);
+
+ znode = entry->dte_parent;
+ cookie = entry->dte_cookie;
+
+ tdelete(entry, &(znode->zte_door_tree), _dtree_compare);
+ dtree_entry_free(entry);
+
+ znode->zte_num_doors--;
+ if (znode->zte_num_doors == 0) {
+ zdoor_debug("ztree: zone %s has no doors left, removing",
+ znode->zte_zonename);
+ ztree_zone_remove(handle, znode);
+ }
+
+ return (cookie);
+}
+
+
+/*
+ * _ztree_door_visitor(nodep, which, depth) is the private function we use
+ * to wrap up tsearch's goofy API. We're really just using this to ensure
+ * zdoor doesn't get called > 1 times for a given entity in the ztree.
+ */
+static void
+_ztree_door_visitor(const void *nodep, const VISIT which, const int depth)
+{
+ dtree_entry_t *entry = *(dtree_entry_t **)nodep;
+
+ if (entry == NULL)
+ return;
+
+ switch (which) {
+ case preorder:
+ case endorder:
+ break;
+ case postorder:
+ case leaf:
+ if (entry->dte_parent->zte_visitor != NULL)
+ entry->dte_parent->zte_visitor(entry);
+ break;
+ }
+}
+
+
+/*
+ * ztree_walk_doors(zone) will proceed to visit every node in the "inner" tree
+ * for this zone, and callback the visitor that was registered on tree creation.
+ */
+void
+ztree_walk_doors(struct zdoor_handle *handle, const char *zonename)
+{
+ ztree_entry_t *znode = NULL;
+
+ if (handle == NULL || zonename == NULL)
+ return;
+
+ znode = ztree_zone_find(handle, zonename);
+ if (znode == NULL)
+ return;
+
+ twalk(znode->zte_door_tree, _ztree_door_visitor);
+}
diff --git a/usr/src/lib/libzdoor/common/ztree.h b/usr/src/lib/libzdoor/common/ztree.h
new file mode 100644
index 0000000000..b46dace287
--- /dev/null
+++ b/usr/src/lib/libzdoor/common/ztree.h
@@ -0,0 +1,88 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _ZTREE_H
+#define _ZTREE_H
+
+#include <zdoor.h>
+#include <zone.h>
+#include "zdoor-int.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dtree_entry;
+
+typedef void (*ztree_door_visitor)(struct dtree_entry *entry);
+
+typedef struct ztree_entry {
+ char *zte_zonename;
+ zdoor_action_t zte_action;
+ int zte_num_doors;
+ void *zte_door_tree;
+ ztree_door_visitor zte_visitor;
+ struct zdoor_handle *zte_parent;
+} ztree_entry_t;
+
+typedef struct dtree_entry {
+ char *dte_service;
+ int dte_door;
+ zdoor_callback dte_callback;
+ zdoor_cookie_t *dte_cookie;
+ ztree_entry_t *dte_parent;
+} dtree_entry_t;
+
+#define ZTREE_SUCCESS 0
+#define ZTREE_ERROR -1
+#define ZTREE_ARGUMENT_ERROR -2
+#define ZTREE_ALREADY_EXISTS -3
+#define ZTREE_NOT_FOUND -4
+
+extern int ztree_zone_add(struct zdoor_handle *handle,
+ const char *zonename, ztree_door_visitor visitor);
+
+extern ztree_entry_t *ztree_zone_find(struct zdoor_handle *handle,
+ const char *zonename);
+
+extern void ztree_zone_remove(struct zdoor_handle *handle,
+ ztree_entry_t *entry);
+
+extern int ztree_door_add(struct zdoor_handle *handle, const char *zonename,
+ const char *service, zdoor_callback callback, zdoor_cookie_t *cookie);
+
+extern dtree_entry_t *ztree_door_find(struct zdoor_handle *handle,
+ const char *zonename, const char *service);
+
+extern zdoor_cookie_t *ztree_door_remove(struct zdoor_handle *handle,
+ dtree_entry_t *entry);
+
+extern void ztree_walk_doors(struct zdoor_handle *handle, const char *zonename);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZTREE_H */
diff --git a/usr/src/lib/libzdoor/i386/Makefile b/usr/src/lib/libzdoor/i386/Makefile
new file mode 100644
index 0000000000..2bfe8001d9
--- /dev/null
+++ b/usr/src/lib/libzdoor/i386/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2011 Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libzfs/common/libzfs.h b/usr/src/lib/libzfs/common/libzfs.h
index 4d1e8186d2..4b57c61400 100644
--- a/usr/src/lib/libzfs/common/libzfs.h
+++ b/usr/src/lib/libzfs/common/libzfs.h
@@ -62,6 +62,7 @@ typedef enum zfs_error {
EZFS_PROPTYPE, /* property does not apply to dataset type */
EZFS_PROPNONINHERIT, /* property is not inheritable */
EZFS_PROPSPACE, /* bad quota or reservation */
+ EZFS_PROPCACHED, /* prop unavail since cachedprops flag set */
EZFS_BADTYPE, /* dataset is not of appropriate type */
EZFS_BUSY, /* pool or dataset is busy */
EZFS_EXISTS, /* pool or dataset already exists */
@@ -182,6 +183,7 @@ extern libzfs_handle_t *zpool_get_handle(zpool_handle_t *);
extern libzfs_handle_t *zfs_get_handle(zfs_handle_t *);
extern void libzfs_print_on_error(libzfs_handle_t *, boolean_t);
+extern void libzfs_set_cachedprops(libzfs_handle_t *, boolean_t);
extern void zfs_save_arguments(int argc, char **, char *, int);
extern int zpool_log_history(libzfs_handle_t *, const char *);
@@ -264,7 +266,7 @@ extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *);
*/
extern int zpool_set_prop(zpool_handle_t *, const char *, const char *);
extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *,
- size_t proplen, zprop_source_t *);
+ size_t proplen, zprop_source_t *, boolean_t);
extern uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t,
zprop_source_t *);
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index 6121a0f161..16700bb6a6 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
@@ -326,6 +327,10 @@ get_stats_ioctl(zfs_handle_t *zhp, zfs_cmd_t *zc)
{
libzfs_handle_t *hdl = zhp->zfs_hdl;
+ if (hdl->libzfs_cachedprops &&
+ libzfs_cmd_set_cachedprops(hdl, zc) != 0)
+ return (-1);
+
(void) strlcpy(zc->zc_name, zhp->zfs_name, sizeof (zc->zc_name));
while (ioctl(hdl->libzfs_fd, ZFS_IOC_OBJSET_STATS, zc) != 0) {
@@ -1822,6 +1827,11 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
case ZFS_PROP_NORMALIZE:
case ZFS_PROP_UTF8ONLY:
case ZFS_PROP_CASE:
+ if (zhp->zfs_hdl->libzfs_cachedprops) {
+ return (zfs_error(zhp->zfs_hdl, EZFS_PROPCACHED,
+ "property unavailable since not cached"));
+ }
+
if (!zfs_prop_valid_for_type(prop, zhp->zfs_head_type) ||
zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0)
return (-1);
@@ -2058,6 +2068,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
char *str;
const char *strval;
boolean_t received = zfs_is_recvd_props_mode(zhp);
+ boolean_t printerr;
/*
* Check to see if this property applies to our object
@@ -2068,6 +2079,16 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
if (received && zfs_prop_readonly(prop))
return (-1);
+ if (zhp->zfs_hdl->libzfs_cachedprops &&
+ zfs_prop_cacheable(prop)) {
+ printerr = zhp->zfs_hdl->libzfs_printerr;
+ libzfs_print_on_error(zhp->zfs_hdl, B_FALSE);
+ (void) zfs_error(zhp->zfs_hdl, EZFS_PROPCACHED,
+ "property unavailable since not cached");
+ libzfs_print_on_error(zhp->zfs_hdl, printerr);
+ return (-1);
+ }
+
if (src)
*src = ZPROP_SRC_NONE;
@@ -2125,8 +2146,8 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
}
if ((zpool_get_prop(zhp->zpool_hdl,
- ZPOOL_PROP_ALTROOT, buf, MAXPATHLEN, NULL)) ||
- (strcmp(root, "-") == 0))
+ ZPOOL_PROP_ALTROOT, buf, MAXPATHLEN, NULL,
+ B_FALSE)) || (strcmp(root, "-") == 0))
root[0] = '\0';
/*
* Special case an alternate root of '/'. This will
diff --git a/usr/src/lib/libzfs/common/libzfs_impl.h b/usr/src/lib/libzfs/common/libzfs_impl.h
index 576b2af5d2..62793dcda1 100644
--- a/usr/src/lib/libzfs/common/libzfs_impl.h
+++ b/usr/src/lib/libzfs/common/libzfs_impl.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -79,6 +80,7 @@ struct libzfs_handle {
libzfs_fru_t **libzfs_fru_hash;
libzfs_fru_t *libzfs_fru_list;
char libzfs_chassis_id[256];
+ boolean_t libzfs_cachedprops;
};
#define ZFSSHARE_MISS 0x01 /* Didn't find entry in cache */
@@ -149,6 +151,7 @@ int zpool_standard_error_fmt(libzfs_handle_t *, int, const char *, ...);
int get_dependents(libzfs_handle_t *, boolean_t, const char *, char ***,
size_t *);
zfs_handle_t *make_dataset_handle_zc(libzfs_handle_t *, zfs_cmd_t *);
+int libzfs_cmd_set_cachedprops(libzfs_handle_t *, zfs_cmd_t *);
int zprop_parse_value(libzfs_handle_t *, nvpair_t *, int, zfs_type_t,
diff --git a/usr/src/lib/libzfs/common/libzfs_iter.c b/usr/src/lib/libzfs/common/libzfs_iter.c
index be5767f542..48333df7d9 100644
--- a/usr/src/lib/libzfs/common/libzfs_iter.c
+++ b/usr/src/lib/libzfs/common/libzfs_iter.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -110,6 +111,10 @@ zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f func, void *data)
if (zhp->zfs_type != ZFS_TYPE_FILESYSTEM)
return (0);
+ if (zhp->zfs_hdl->libzfs_cachedprops &&
+ libzfs_cmd_set_cachedprops(zhp->zfs_hdl, &zc) != 0)
+ return (-1);
+
if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0)
return (-1);
@@ -120,9 +125,8 @@ zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f func, void *data)
* that the pool has since been removed.
*/
if ((nzhp = make_dataset_handle_zc(zhp->zfs_hdl,
- &zc)) == NULL) {
+ &zc)) == NULL)
continue;
- }
if ((ret = func(nzhp, data)) != 0) {
zcmd_free_nvlists(&zc);
@@ -146,15 +150,19 @@ zfs_iter_snapshots(zfs_handle_t *zhp, zfs_iter_f func, void *data)
if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT)
return (0);
+ if (zhp->zfs_hdl->libzfs_cachedprops &&
+ libzfs_cmd_set_cachedprops(zhp->zfs_hdl, &zc) != 0)
+ return (-1);
+
if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0)
return (-1);
+
while ((ret = zfs_do_list_ioctl(zhp, ZFS_IOC_SNAPSHOT_LIST_NEXT,
&zc)) == 0) {
if ((nzhp = make_dataset_handle_zc(zhp->zfs_hdl,
- &zc)) == NULL) {
+ &zc)) == NULL)
continue;
- }
if ((ret = func(nzhp, data)) != 0) {
zcmd_free_nvlists(&zc);
diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c
index 1c6fb371e3..8315e1404b 100644
--- a/usr/src/lib/libzfs/common/libzfs_pool.c
+++ b/usr/src/lib/libzfs/common/libzfs_pool.c
@@ -23,6 +23,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <ctype.h>
@@ -211,7 +212,7 @@ zpool_state_to_name(vdev_state_t state, vdev_aux_t aux)
*/
int
zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
- zprop_source_t *srctype)
+ zprop_source_t *srctype, boolean_t literal)
{
uint64_t intval;
const char *strval;
@@ -271,6 +272,12 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
case PROP_TYPE_NUMBER:
intval = zpool_get_prop_int(zhp, prop, &src);
+ if (literal && prop != ZPOOL_PROP_HEALTH) {
+ (void) snprintf(buf, len, "%llu",
+ (u_longlong_t)intval);
+ break;
+ }
+
switch (prop) {
case ZPOOL_PROP_SIZE:
case ZPOOL_PROP_ALLOCATED:
@@ -310,6 +317,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
default:
(void) snprintf(buf, len, "%llu", intval);
}
+
break;
case PROP_TYPE_INDEX:
@@ -376,7 +384,7 @@ zpool_is_bootable(zpool_handle_t *zhp)
char bootfs[ZPOOL_MAXNAMELEN];
return (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
- sizeof (bootfs), NULL) == 0 && strncmp(bootfs, "-",
+ sizeof (bootfs), NULL, B_FALSE) == 0 && strncmp(bootfs, "-",
sizeof (bootfs)) != 0);
}
@@ -774,7 +782,7 @@ zpool_expand_proplist(zpool_handle_t *zhp, zprop_list_t **plp)
if (entry->pl_prop != ZPROP_INVAL &&
zpool_get_prop(zhp, entry->pl_prop, buf, sizeof (buf),
- NULL) == 0) {
+ NULL, B_FALSE) == 0) {
if (strlen(buf) > entry->pl_width)
entry->pl_width = strlen(buf);
}
@@ -3974,9 +3982,7 @@ supported_dump_vdev_type(libzfs_handle_t *hdl, nvlist_t *config, char *errbuf)
uint_t children, c;
verify(nvlist_lookup_string(config, ZPOOL_CONFIG_TYPE, &type) == 0);
- if (strcmp(type, VDEV_TYPE_RAIDZ) == 0 ||
- strcmp(type, VDEV_TYPE_FILE) == 0 ||
- strcmp(type, VDEV_TYPE_LOG) == 0 ||
+ if (strcmp(type, VDEV_TYPE_FILE) == 0 ||
strcmp(type, VDEV_TYPE_HOLE) == 0 ||
strcmp(type, VDEV_TYPE_MISSING) == 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
@@ -3995,8 +4001,12 @@ supported_dump_vdev_type(libzfs_handle_t *hdl, nvlist_t *config, char *errbuf)
}
/*
- * check if this zvol is allowable for use as a dump device; zero if
- * it is, > 0 if it isn't, < 0 if it isn't a zvol
+ * Check if this zvol is allowable for use as a dump device; zero if
+ * it is, > 0 if it isn't, < 0 if it isn't a zvol.
+ *
+ * Allowable storage configurations include mirrors, all raidz variants, and
+ * pools with log, cache, and spare devices. Pools which are backed by files or
+ * have missing/hole vdevs are not suitable.
*/
int
zvol_check_dump_config(char *arg)
@@ -4058,12 +4068,6 @@ zvol_check_dump_config(char *arg)
verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
&top, &toplevels) == 0);
- if (toplevels != 1) {
- zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "'%s' has multiple top level vdevs"), poolname);
- (void) zfs_error(hdl, EZFS_DEVOVERFLOW, errbuf);
- goto out;
- }
if (!supported_dump_vdev_type(hdl, top[0], errbuf)) {
goto out;
diff --git a/usr/src/lib/libzfs/common/libzfs_util.c b/usr/src/lib/libzfs/common/libzfs_util.c
index 41e25e9100..8706a6fdbb 100644
--- a/usr/src/lib/libzfs/common/libzfs_util.c
+++ b/usr/src/lib/libzfs/common/libzfs_util.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -81,6 +82,9 @@ libzfs_error_description(libzfs_handle_t *hdl)
return (dgettext(TEXT_DOMAIN, "property cannot be inherited"));
case EZFS_PROPSPACE:
return (dgettext(TEXT_DOMAIN, "invalid quota or reservation"));
+ case EZFS_PROPCACHED:
+ return (dgettext(TEXT_DOMAIN, "property unavailable since "
+ "cachedprops flag set"));
case EZFS_BADTYPE:
return (dgettext(TEXT_DOMAIN, "operation not applicable to "
"datasets of this type"));
@@ -609,6 +613,42 @@ libzfs_print_on_error(libzfs_handle_t *hdl, boolean_t printerr)
hdl->libzfs_printerr = printerr;
}
+/*
+ * Set the value of the cachedprops flag. If the cachedprops flag is set,
+ * operations which get ZFS properties will only retrieve a property if the
+ * property is cached somewhere in memory.
+ *
+ * Consumers of libzfs should take care when setting this flag, as they will
+ * prevent themselves from listing the full set of ZFS properties.
+ *
+ * ZFS properties which always require disk I/O are ZPL properties (utf8only,
+ * normalization, etc.) and the volsize and volblocksize properties for volumes.
+ */
+void
+libzfs_set_cachedprops(libzfs_handle_t *hdl, boolean_t cachedprops)
+{
+ hdl->libzfs_cachedprops = cachedprops;
+}
+
+/*
+ * Adds a src nvlist to a zfs_cmd_t which specifies that only cached (i.e., will
+ * not require a disk access) properties should be retrieved.
+ */
+int
+libzfs_cmd_set_cachedprops(libzfs_handle_t *hdl, zfs_cmd_t *zc)
+{
+ nvlist_t *nvl;
+ int ret;
+
+ if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, 0) != 0 ||
+ nvlist_add_boolean_value(nvl, "cachedpropsonly", B_TRUE) != 0)
+ return (no_memory(hdl));
+
+ ret = zcmd_write_src_nvlist(hdl, zc, nvl);
+ nvlist_free(nvl);
+ return (ret);
+}
+
libzfs_handle_t *
libzfs_init(void)
{
@@ -644,6 +684,8 @@ libzfs_init(void)
zpool_feature_init();
libzfs_mnttab_init(hdl);
+ hdl->libzfs_cachedprops = B_FALSE;
+
return (hdl);
}
diff --git a/usr/src/lib/libzfs/common/mapfile-vers b/usr/src/lib/libzfs/common/mapfile-vers
index 1cc52f5f79..d2ce523cf8 100644
--- a/usr/src/lib/libzfs/common/mapfile-vers
+++ b/usr/src/lib/libzfs/common/mapfile-vers
@@ -21,6 +21,7 @@
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# MAPFILE HEADER START
#
@@ -59,6 +60,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
libzfs_init;
libzfs_mnttab_cache;
libzfs_print_on_error;
+ libzfs_set_cachedprops;
spa_feature_table;
zfs_allocatable_devs;
zfs_asprintf;
@@ -101,6 +103,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zfs_path_to_zhandle;
zfs_promote;
zfs_prop_align_right;
+ zfs_prop_cacheable;
zfs_prop_column_name;
zfs_prop_default_numeric;
zfs_prop_default_string;
diff --git a/usr/src/lib/libzonecfg/Makefile.com b/usr/src/lib/libzonecfg/Makefile.com
index 4c94fe6dd6..ce29f58a9b 100644
--- a/usr/src/lib/libzonecfg/Makefile.com
+++ b/usr/src/lib/libzonecfg/Makefile.com
@@ -35,6 +35,7 @@ LDLIBS += -lc -lsocket -lnsl -luuid -lnvpair -lsysevent -lsec -lbrand \
$(DYNLIB) := LDLIBS += -lxml2
SRCDIR = ../common
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I$(SRCDIR) -D_REENTRANT
CPPFLAGS += -I/usr/include/libxml2 -I$(SRCDIR) -D_REENTRANT
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-parentheses
diff --git a/usr/src/lib/libzonecfg/common/getzoneent.c b/usr/src/lib/libzonecfg/common/getzoneent.c
index 8155f7272a..76664fcc92 100644
--- a/usr/src/lib/libzonecfg/common/getzoneent.c
+++ b/usr/src/lib/libzonecfg/common/getzoneent.c
@@ -403,14 +403,6 @@ putzoneent(struct zoneent *ze, zoneent_op_t operation)
*/
if (ze->zone_state >= 0) {
zone_state = zone_state_str(ze->zone_state);
-
- /*
- * If the caller is uninstalling this zone,
- * then wipe out the uuid. The zone's contents
- * are no longer known.
- */
- if (ze->zone_state < ZONE_STATE_INSTALLED)
- zone_uuid = "";
}
/* If a new name is supplied, use it. */
@@ -419,6 +411,12 @@ putzoneent(struct zoneent *ze, zoneent_op_t operation)
if (ze->zone_path[0] != '\0')
zone_path = ze->zone_path;
+
+ /* If new UUID provided, replace it */
+ if (!uuid_is_null(ze->zone_uuid)) {
+ uuid_unparse(ze->zone_uuid, uuidstr);
+ zone_uuid = uuidstr;
+ }
break;
case PZE_REMOVE:
diff --git a/usr/src/lib/libzonecfg/common/libzonecfg.c b/usr/src/lib/libzonecfg/common/libzonecfg.c
index 9a664b8824..55e0e58c82 100644
--- a/usr/src/lib/libzonecfg/common/libzonecfg.c
+++ b/usr/src/lib/libzonecfg/common/libzonecfg.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent Inc. All rights reserved.
*/
#include <libsysevent.h>
@@ -77,6 +78,8 @@
#define ZONE_EVENT_PING_SUBCLASS "ping"
#define ZONE_EVENT_PING_PUBLISHER "solaris"
+#define DEBUGID_FILE "/etc/zones/did.txt"
+
/* Hard-code the DTD element/attribute/entity names just once, here. */
#define DTD_ELEM_ATTR (const xmlChar *) "attr"
#define DTD_ELEM_COMMENT (const xmlChar *) "comment"
@@ -84,6 +87,7 @@
#define DTD_ELEM_FS (const xmlChar *) "filesystem"
#define DTD_ELEM_FSOPTION (const xmlChar *) "fsoption"
#define DTD_ELEM_NET (const xmlChar *) "network"
+#define DTD_ELEM_NETATTR (const xmlChar *) "net-attr"
#define DTD_ELEM_RCTL (const xmlChar *) "rctl"
#define DTD_ELEM_RCTLVALUE (const xmlChar *) "rctl-value"
#define DTD_ELEM_ZONE (const xmlChar *) "zone"
@@ -103,10 +107,12 @@
#define DTD_ATTR_IPTYPE (const xmlChar *) "ip-type"
#define DTD_ATTR_DEFROUTER (const xmlChar *) "defrouter"
#define DTD_ATTR_DIR (const xmlChar *) "directory"
+#define DTD_ATTR_GNIC (const xmlChar *) "global-nic"
#define DTD_ATTR_LIMIT (const xmlChar *) "limit"
#define DTD_ATTR_LIMITPRIV (const xmlChar *) "limitpriv"
#define DTD_ATTR_BOOTARGS (const xmlChar *) "bootargs"
#define DTD_ATTR_SCHED (const xmlChar *) "scheduling-class"
+#define DTD_ATTR_MAC (const xmlChar *) "mac-addr"
#define DTD_ATTR_MATCH (const xmlChar *) "match"
#define DTD_ATTR_NAME (const xmlChar *) "name"
#define DTD_ATTR_PHYSICAL (const xmlChar *) "physical"
@@ -116,6 +122,7 @@
#define DTD_ATTR_SPECIAL (const xmlChar *) "special"
#define DTD_ATTR_TYPE (const xmlChar *) "type"
#define DTD_ATTR_VALUE (const xmlChar *) "value"
+#define DTD_ATTR_VLANID (const xmlChar *) "vlan-id"
#define DTD_ATTR_ZONEPATH (const xmlChar *) "zonepath"
#define DTD_ATTR_NCPU_MIN (const xmlChar *) "ncpu_min"
#define DTD_ATTR_NCPU_MAX (const xmlChar *) "ncpu_max"
@@ -128,6 +135,7 @@
#define DTD_ATTR_MODE (const xmlChar *) "mode"
#define DTD_ATTR_ACL (const xmlChar *) "acl"
#define DTD_ATTR_BRAND (const xmlChar *) "brand"
+#define DTD_ATTR_DID (const xmlChar *) "debugid"
#define DTD_ATTR_HOSTID (const xmlChar *) "hostid"
#define DTD_ATTR_USER (const xmlChar *) "user"
#define DTD_ATTR_AUTHS (const xmlChar *) "auths"
@@ -174,9 +182,12 @@ static struct alias {
{ALIAS_MAXSEMIDS, "zone.max-sem-ids", "privileged", "deny", 0},
{ALIAS_MAXLOCKEDMEM, "zone.max-locked-memory", "privileged", "deny", 0},
{ALIAS_MAXSWAP, "zone.max-swap", "privileged", "deny", 0},
+ {ALIAS_MAXPHYSMEM, "zone.max-physical-memory", "privileged", "deny",
+ 1048576},
{ALIAS_SHARES, "zone.cpu-shares", "privileged", "none", 0},
{ALIAS_CPUCAP, "zone.cpu-cap", "privileged", "deny", 0},
{ALIAS_MAXPROCS, "zone.max-processes", "privileged", "deny", 100},
+ {ALIAS_ZFSPRI, "zone.zfs-io-priority", "privileged", "none", 1},
{NULL, NULL, NULL, NULL, 0}
};
@@ -2064,6 +2075,32 @@ zonecfg_ifname_exists(sa_family_t af, char *ifname)
}
/*
+ * Turn an addr that looks like f:2:0:44:5:6C into 0f:02:00:44:05:6c
+ * We're expecting a dst of at least MAXMACADDRLEN size here.
+ */
+static void
+normalize_mac_addr(char *dst, const char *src, int len)
+{
+ char *p, *e, *sep = "";
+ long n;
+ char buf[MAXMACADDRLEN], tmp[4];
+
+ *dst = '\0';
+ (void) strlcpy(buf, src, sizeof (buf));
+ p = strtok(buf, ":");
+ while (p != NULL) {
+ n = strtol(p, &e, 16);
+ if (*e != NULL || n > 0xff)
+ return;
+ (void) snprintf(tmp, sizeof (tmp), "%s%02x", sep, n);
+ (void) strlcat(dst, tmp, len);
+
+ sep = ":";
+ p = strtok(NULL, ":");
+ }
+}
+
+/*
* Determines whether there is a net resource with the physical interface, IP
* address, and default router specified by 'tabptr' in the zone configuration
* to which 'handle' refers. 'tabptr' must have an interface, an address, a
@@ -2082,13 +2119,18 @@ zonecfg_ifname_exists(sa_family_t af, char *ifname)
int
zonecfg_lookup_nwif(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
{
- xmlNodePtr cur;
+ xmlNodePtr cur, val;
xmlNodePtr firstmatch;
int err;
char address[INET6_ADDRSTRLEN];
char physical[LIFNAMSIZ];
+ char mac[MAXMACADDRLEN];
+ char norm_mac[MAXMACADDRLEN];
+ char gnic[LIFNAMSIZ];
size_t addrspec; /* nonzero if tabptr has IP addr */
size_t physspec; /* nonzero if tabptr has interface */
+ size_t macspec; /* nonzero if tabptr has mac addr */
+ size_t gnicspec; /* nonzero if tabptr has gnic */
size_t defrouterspec; /* nonzero if tabptr has def. router */
size_t allowed_addrspec;
zone_iptype_t iptype;
@@ -2100,17 +2142,20 @@ zonecfg_lookup_nwif(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
* Determine the fields that will be searched. There must be at least
* one.
*
- * zone_nwif_address, zone_nwif_physical, and zone_nwif_defrouter are
+ * zone_nwif_address, zone_nwif_physical, zone_nwif_defrouter,
+ * zone_nwif_mac, zone_nwif_vlan_id and zone_nwif_gnic are
* arrays, so no NULL checks are necessary.
*/
addrspec = strlen(tabptr->zone_nwif_address);
physspec = strlen(tabptr->zone_nwif_physical);
+ macspec = strlen(tabptr->zone_nwif_mac);
+ gnicspec = strlen(tabptr->zone_nwif_gnic);
defrouterspec = strlen(tabptr->zone_nwif_defrouter);
allowed_addrspec = strlen(tabptr->zone_nwif_allowed_address);
if (addrspec != 0 && allowed_addrspec != 0)
return (Z_INVAL); /* can't specify both */
if (addrspec == 0 && physspec == 0 && defrouterspec == 0 &&
- allowed_addrspec == 0)
+ allowed_addrspec == 0 && macspec == 0 && gnicspec == 0)
return (Z_INSUFFICIENT_SPEC);
if ((err = operation_prep(handle)) != Z_OK)
@@ -2137,6 +2182,19 @@ zonecfg_lookup_nwif(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
physical, sizeof (physical)) != Z_OK ||
strcmp(tabptr->zone_nwif_physical, physical) != 0))
continue;
+ if (iptype == ZS_EXCLUSIVE && macspec != 0) {
+ if (fetchprop(cur, DTD_ATTR_MAC, mac, sizeof (mac)) !=
+ Z_OK)
+ continue;
+ normalize_mac_addr(norm_mac, mac, sizeof (norm_mac));
+ if (strcmp(tabptr->zone_nwif_mac, norm_mac) != 0)
+ continue;
+ }
+ if (iptype == ZS_EXCLUSIVE && gnicspec != 0 &&
+ (fetchprop(cur, DTD_ATTR_GNIC, gnic,
+ sizeof (gnic)) != Z_OK ||
+ strcmp(tabptr->zone_nwif_gnic, gnic) != 0))
+ continue;
if (iptype == ZS_SHARED && addrspec != 0 &&
(fetchprop(cur, DTD_ATTR_ADDRESS, address,
sizeof (address)) != Z_OK ||
@@ -2179,6 +2237,21 @@ zonecfg_lookup_nwif(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
return (err);
if (iptype == ZS_EXCLUSIVE &&
+ (err = fetchprop(cur, DTD_ATTR_MAC, tabptr->zone_nwif_mac,
+ sizeof (tabptr->zone_nwif_mac))) != Z_OK)
+ return (err);
+
+ if (iptype == ZS_EXCLUSIVE &&
+ (err = fetchprop(cur, DTD_ATTR_VLANID, tabptr->zone_nwif_vlan_id,
+ sizeof (tabptr->zone_nwif_vlan_id))) != Z_OK)
+ return (err);
+
+ if (iptype == ZS_EXCLUSIVE &&
+ (err = fetchprop(cur, DTD_ATTR_GNIC, tabptr->zone_nwif_gnic,
+ sizeof (tabptr->zone_nwif_gnic))) != Z_OK)
+ return (err);
+
+ if (iptype == ZS_EXCLUSIVE &&
(err = fetchprop(cur, DTD_ATTR_ALLOWED_ADDRESS,
tabptr->zone_nwif_allowed_address,
sizeof (tabptr->zone_nwif_allowed_address))) != Z_OK)
@@ -2189,13 +2262,40 @@ zonecfg_lookup_nwif(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
sizeof (tabptr->zone_nwif_defrouter))) != Z_OK)
return (err);
+ tabptr->zone_nwif_attrp = NULL;
+ for (val = cur->xmlChildrenNode; val != NULL; val = val->next) {
+ struct zone_res_attrtab *valptr;
+
+ valptr = (struct zone_res_attrtab *)malloc(
+ sizeof (struct zone_res_attrtab));
+ if (valptr == NULL)
+ return (Z_NOMEM);
+
+ valptr->zone_res_attr_name[0] =
+ valptr->zone_res_attr_value[0] = '\0';
+ if (zonecfg_add_res_attr(&(tabptr->zone_nwif_attrp), valptr)
+ != Z_OK) {
+ free(valptr);
+ break;
+ }
+
+ if ((fetchprop(val, DTD_ATTR_NAME, valptr->zone_res_attr_name,
+ sizeof (valptr->zone_res_attr_name)) != Z_OK))
+ break;
+ if ((fetchprop(val, DTD_ATTR_VALUE,
+ valptr->zone_res_attr_value,
+ sizeof (valptr->zone_res_attr_value)) != Z_OK))
+ break;
+ }
+
return (Z_OK);
}
static int
zonecfg_add_nwif_core(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
{
- xmlNodePtr newnode, cur = handle->zone_dh_cur;
+ xmlNodePtr newnode, cur = handle->zone_dh_cur, valnode;
+ struct zone_res_attrtab *valptr;
int err;
newnode = xmlNewTextChild(cur, NULL, DTD_ELEM_NET, NULL);
@@ -2211,13 +2311,40 @@ zonecfg_add_nwif_core(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
tabptr->zone_nwif_physical)) != Z_OK)
return (err);
/*
- * Do not add this property when it is not set, for backwards
- * compatibility and because it is optional.
+ * Do not add these properties when they are not set, for backwards
+ * compatibility and because they are optional.
*/
if ((strlen(tabptr->zone_nwif_defrouter) > 0) &&
((err = newprop(newnode, DTD_ATTR_DEFROUTER,
tabptr->zone_nwif_defrouter)) != Z_OK))
return (err);
+ if (strlen(tabptr->zone_nwif_mac) > 0 &&
+ (err = newprop(newnode, DTD_ATTR_MAC,
+ tabptr->zone_nwif_mac)) != Z_OK)
+ return (err);
+ if (strlen(tabptr->zone_nwif_vlan_id) > 0 &&
+ (err = newprop(newnode, DTD_ATTR_VLANID,
+ tabptr->zone_nwif_vlan_id)) != Z_OK)
+ return (err);
+ if (strlen(tabptr->zone_nwif_gnic) > 0 &&
+ (err = newprop(newnode, DTD_ATTR_GNIC,
+ tabptr->zone_nwif_gnic)) != Z_OK)
+ return (err);
+
+ for (valptr = tabptr->zone_nwif_attrp; valptr != NULL;
+ valptr = valptr->zone_res_attr_next) {
+ valnode = xmlNewTextChild(newnode, NULL, DTD_ELEM_NETATTR,
+ NULL);
+ err = newprop(valnode, DTD_ATTR_NAME,
+ valptr->zone_res_attr_name);
+ if (err != Z_OK)
+ return (err);
+ err = newprop(valnode, DTD_ATTR_VALUE,
+ valptr->zone_res_attr_value);
+ if (err != Z_OK)
+ return (err);
+ }
+
return (Z_OK);
}
@@ -2242,7 +2369,8 @@ static int
zonecfg_delete_nwif_core(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
{
xmlNodePtr cur = handle->zone_dh_cur;
- boolean_t addr_match, phys_match, allowed_addr_match;
+ boolean_t addr_match, phys_match, allowed_addr_match, mac_match,
+ gnic_match;
for (cur = cur->xmlChildrenNode; cur != NULL; cur = cur->next) {
if (xmlStrcmp(cur->name, DTD_ELEM_NET))
@@ -2254,8 +2382,13 @@ zonecfg_delete_nwif_core(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
tabptr->zone_nwif_allowed_address);
phys_match = match_prop(cur, DTD_ATTR_PHYSICAL,
tabptr->zone_nwif_physical);
+ mac_match = match_prop(cur, DTD_ATTR_MAC,
+ tabptr->zone_nwif_mac);
+ gnic_match = match_prop(cur, DTD_ATTR_GNIC,
+ tabptr->zone_nwif_gnic);
- if ((addr_match || allowed_addr_match) && phys_match) {
+ if ((addr_match || allowed_addr_match || mac_match ||
+ gnic_match) && phys_match) {
xmlUnlinkNode(cur);
xmlFreeNode(cur);
return (Z_OK);
@@ -2304,6 +2437,58 @@ zonecfg_modify_nwif(
return (Z_OK);
}
+void
+zonecfg_free_res_attr_list(struct zone_res_attrtab *valtab)
+{
+ if (valtab == NULL)
+ return;
+ zonecfg_free_res_attr_list(valtab->zone_res_attr_next);
+ free(valtab);
+}
+
+int
+zonecfg_add_res_attr(struct zone_res_attrtab **headptr,
+ struct zone_res_attrtab *valtabptr)
+{
+ struct zone_res_attrtab *last, *old, *new;
+
+ last = *headptr;
+ for (old = last; old != NULL; old = old->zone_res_attr_next)
+ last = old; /* walk to the end of the list */
+ new = valtabptr; /* alloc'd by caller */
+ new->zone_res_attr_next = NULL;
+ if (last == NULL)
+ *headptr = new;
+ else
+ last->zone_res_attr_next = new;
+ return (Z_OK);
+}
+
+int
+zonecfg_remove_res_attr(struct zone_res_attrtab **headptr,
+ struct zone_res_attrtab *valtabptr)
+{
+ struct zone_res_attrtab *last, *this, *next;
+
+ last = *headptr;
+ for (this = last; this != NULL; this = this->zone_res_attr_next) {
+ if (strcmp(this->zone_res_attr_name,
+ valtabptr->zone_res_attr_name) == 0 &&
+ strcmp(this->zone_res_attr_value,
+ valtabptr->zone_res_attr_value) == 0) {
+ next = this->zone_res_attr_next;
+ if (this == *headptr)
+ *headptr = next;
+ else
+ last->zone_res_attr_next = next;
+ free(this);
+ return (Z_OK);
+ } else
+ last = this;
+ }
+ return (Z_NO_PROPERTY_ID);
+}
+
/*
* Must be a comma-separated list of alpha-numeric file system names.
*/
@@ -2453,7 +2638,7 @@ zonecfg_set_hostid(zone_dochandle_t handle, const char *hostidp)
int
zonecfg_lookup_dev(zone_dochandle_t handle, struct zone_devtab *tabptr)
{
- xmlNodePtr cur, firstmatch;
+ xmlNodePtr cur, val, firstmatch;
int err;
char match[MAXPATHLEN];
@@ -2498,13 +2683,40 @@ zonecfg_lookup_dev(zone_dochandle_t handle, struct zone_devtab *tabptr)
sizeof (tabptr->zone_dev_match))) != Z_OK)
return (err);
+ tabptr->zone_dev_attrp = NULL;
+ for (val = cur->xmlChildrenNode; val != NULL; val = val->next) {
+ struct zone_res_attrtab *valptr;
+
+ valptr = (struct zone_res_attrtab *)malloc(
+ sizeof (struct zone_res_attrtab));
+ if (valptr == NULL)
+ return (Z_NOMEM);
+
+ valptr->zone_res_attr_name[0] =
+ valptr->zone_res_attr_value[0] = '\0';
+ if (zonecfg_add_res_attr(&(tabptr->zone_dev_attrp), valptr)
+ != Z_OK) {
+ free(valptr);
+ break;
+ }
+
+ if ((fetchprop(val, DTD_ATTR_NAME, valptr->zone_res_attr_name,
+ sizeof (valptr->zone_res_attr_name)) != Z_OK))
+ break;
+ if ((fetchprop(val, DTD_ATTR_VALUE,
+ valptr->zone_res_attr_value,
+ sizeof (valptr->zone_res_attr_value)) != Z_OK))
+ break;
+ }
+
return (Z_OK);
}
static int
zonecfg_add_dev_core(zone_dochandle_t handle, struct zone_devtab *tabptr)
{
- xmlNodePtr newnode, cur = handle->zone_dh_cur;
+ xmlNodePtr newnode, cur = handle->zone_dh_cur, valnode;
+ struct zone_res_attrtab *valptr;
int err;
newnode = xmlNewTextChild(cur, NULL, DTD_ELEM_DEVICE, NULL);
@@ -2513,6 +2725,21 @@ zonecfg_add_dev_core(zone_dochandle_t handle, struct zone_devtab *tabptr)
tabptr->zone_dev_match)) != Z_OK)
return (err);
+ for (valptr = tabptr->zone_dev_attrp; valptr != NULL;
+ valptr = valptr->zone_res_attr_next) {
+ valnode = xmlNewTextChild(newnode, NULL, DTD_ELEM_NETATTR,
+ NULL);
+ err = newprop(valnode, DTD_ATTR_NAME,
+ valptr->zone_res_attr_name);
+ if (err != Z_OK)
+ return (err);
+ err = newprop(valnode, DTD_ATTR_VALUE,
+ valptr->zone_res_attr_value);
+ if (err != Z_OK)
+ return (err);
+ }
+
+
return (Z_OK);
}
@@ -4572,7 +4799,7 @@ get_pool_sched_class(char *poolname, char *class, int clsize)
pool_conf_t *poolconf;
pool_t *pool;
pool_elem_t *pe;
- pool_value_t *pv = pool_value_alloc();
+ pool_value_t *pv;
const char *sched_str;
if (pool_get_status(&status) != PO_SUCCESS || status != POOL_ENABLED)
@@ -4593,15 +4820,23 @@ get_pool_sched_class(char *poolname, char *class, int clsize)
return (Z_NO_POOL);
}
+ if ((pv = pool_value_alloc()) == NULL) {
+ (void) pool_conf_close(poolconf);
+ pool_conf_free(poolconf);
+ return (Z_NO_POOL);
+ }
+
pe = pool_to_elem(poolconf, pool);
if (pool_get_property(poolconf, pe, "pool.scheduler", pv) !=
POC_STRING) {
(void) pool_conf_close(poolconf);
+ pool_value_free(pv);
pool_conf_free(poolconf);
return (Z_NO_ENTRY);
}
(void) pool_value_get_string(pv, &sched_str);
(void) pool_conf_close(poolconf);
+ pool_value_free(pv);
pool_conf_free(poolconf);
if (strlcpy(class, sched_str, clsize) >= clsize)
return (Z_TOO_BIG);
@@ -4710,7 +4945,8 @@ zonecfg_setnwifent(zone_dochandle_t handle)
int
zonecfg_getnwifent(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
{
- xmlNodePtr cur;
+ xmlNodePtr cur, val;
+ struct zone_res_attrtab *valptr;
int err;
if (handle == NULL)
@@ -4746,6 +4982,24 @@ zonecfg_getnwifent(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
return (err);
}
+ if ((err = fetchprop(cur, DTD_ATTR_MAC, tabptr->zone_nwif_mac,
+ sizeof (tabptr->zone_nwif_mac))) != Z_OK) {
+ handle->zone_dh_cur = handle->zone_dh_top;
+ return (err);
+ }
+
+ if ((err = fetchprop(cur, DTD_ATTR_VLANID, tabptr->zone_nwif_vlan_id,
+ sizeof (tabptr->zone_nwif_vlan_id))) != Z_OK) {
+ handle->zone_dh_cur = handle->zone_dh_top;
+ return (err);
+ }
+
+ if ((err = fetchprop(cur, DTD_ATTR_GNIC, tabptr->zone_nwif_gnic,
+ sizeof (tabptr->zone_nwif_gnic))) != Z_OK) {
+ handle->zone_dh_cur = handle->zone_dh_top;
+ return (err);
+ }
+
if ((err = fetchprop(cur, DTD_ATTR_DEFROUTER,
tabptr->zone_nwif_defrouter,
sizeof (tabptr->zone_nwif_defrouter))) != Z_OK) {
@@ -4753,6 +5007,29 @@ zonecfg_getnwifent(zone_dochandle_t handle, struct zone_nwiftab *tabptr)
return (err);
}
+ tabptr->zone_nwif_attrp = NULL;
+ for (val = cur->xmlChildrenNode; val != NULL; val = val->next) {
+ valptr = (struct zone_res_attrtab *)malloc(
+ sizeof (struct zone_res_attrtab));
+ if (valptr == NULL)
+ return (Z_NOMEM);
+
+ valptr->zone_res_attr_name[0] =
+ valptr->zone_res_attr_value[0] = '\0';
+ if (zonecfg_add_res_attr(&(tabptr->zone_nwif_attrp), valptr)
+ != Z_OK) {
+ free(valptr);
+ break;
+ }
+
+ if (fetchprop(val, DTD_ATTR_NAME, valptr->zone_res_attr_name,
+ sizeof (valptr->zone_res_attr_name)) != Z_OK)
+ break;
+ if (fetchprop(val, DTD_ATTR_VALUE, valptr->zone_res_attr_value,
+ sizeof (valptr->zone_res_attr_value)) != Z_OK)
+ break;
+ }
+
handle->zone_dh_cur = cur->next;
return (Z_OK);
}
@@ -4772,7 +5049,7 @@ zonecfg_setdevent(zone_dochandle_t handle)
int
zonecfg_getdevent(zone_dochandle_t handle, struct zone_devtab *tabptr)
{
- xmlNodePtr cur;
+ xmlNodePtr cur, val;
int err;
if (handle == NULL)
@@ -4795,6 +5072,31 @@ zonecfg_getdevent(zone_dochandle_t handle, struct zone_devtab *tabptr)
return (err);
}
+ tabptr->zone_dev_attrp = NULL;
+ for (val = cur->xmlChildrenNode; val != NULL; val = val->next) {
+ struct zone_res_attrtab *valptr;
+
+ valptr = (struct zone_res_attrtab *)malloc(
+ sizeof (struct zone_res_attrtab));
+ if (valptr == NULL)
+ return (Z_NOMEM);
+
+ valptr->zone_res_attr_name[0] =
+ valptr->zone_res_attr_value[0] = '\0';
+ if (zonecfg_add_res_attr(&(tabptr->zone_dev_attrp), valptr)
+ != Z_OK) {
+ free(valptr);
+ break;
+ }
+
+ if ((fetchprop(val, DTD_ATTR_NAME, valptr->zone_res_attr_name,
+ sizeof (valptr->zone_res_attr_name)) != Z_OK))
+ break;
+ if ((fetchprop(val, DTD_ATTR_VALUE, valptr->zone_res_attr_value,
+ sizeof (valptr->zone_res_attr_value)) != Z_OK))
+ break;
+ }
+
handle->zone_dh_cur = cur->next;
return (Z_OK);
}
@@ -5523,6 +5825,164 @@ zone_get_brand(char *zone_name, char *brandname, size_t rp_sz)
}
/*
+ * Atomically get a new zone_did value. The currently allocated value
+ * is stored in /etc/zones/did.txt. Lock the file, read the current value,
+ * increment, save the new value and unlock the file. Return the new value
+ * or -1 if there was an error. The ID namespace is large enough that we
+ * don't worry about recycling an ID when a zone is deleted.
+ */
+static zoneid_t
+new_zone_did()
+{
+ int fd;
+ int len;
+ int val;
+ struct flock lck;
+ char buf[80];
+
+ if ((fd = open(DEBUGID_FILE, O_RDWR | O_CREAT,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) {
+ perror("new_zone_did open failed");
+ return (-1);
+ }
+
+ /* Initialize the lock. */
+ lck.l_whence = SEEK_SET;
+ lck.l_start = 0;
+ lck.l_len = 0;
+
+ /* Wait until we acquire an exclusive lock on the file. */
+ lck.l_type = F_WRLCK;
+ if (fcntl(fd, F_SETLKW, &lck) == -1) {
+ perror("new_zone_did lock failed");
+ (void) close(fd);
+ return (-1);
+ }
+
+ /* Get currently allocated value */
+ len = read(fd, buf, sizeof (buf));
+ if (len == -1) {
+ perror("new_zone_did read failed");
+ val = -1;
+ } else {
+ if (lseek(fd, 0L, SEEK_SET) == -1) {
+ perror("new_zone_did seek failed");
+ val = -1;
+ } else {
+ if (len == 0) {
+ /* Just created the file, initialize at 1 */
+ val = 1;
+ } else {
+ val = atoi(buf);
+ val++;
+ }
+
+ (void) snprintf(buf, sizeof (buf), "%d\n", val);
+ len = strlen(buf);
+
+ /* Save newly allocated value */
+ if (write(fd, buf, len) == -1) {
+ perror("new_zone_did write failed");
+ val = -1;
+ }
+ }
+ }
+
+ /* Release the file lock. */
+ lck.l_type = F_UNLCK;
+ if (fcntl(fd, F_SETLK, &lck) == -1) {
+ perror("new_zone_did unlock failed");
+ val = -1;
+ }
+
+ if (close(fd) != 0)
+ perror("new_zone_did close failed");
+
+ return (val);
+}
+
+/*
+ * Called by zoneadmd to get the zone's debug ID.
+ * If the zone doesn't already have an ID, a new one is generated and
+ * persistently saved onto the zone. Normally either zoneadm or zonecfg
+ * will assign a new ID for the zone, so zoneadmd should never have to
+ * generate one, but we also handle that here just to be paranoid.
+ */
+zoneid_t
+zone_get_did(char *zone_name)
+{
+ int res;
+ zoneid_t new_did;
+ zone_dochandle_t handle;
+ char did_str[80];
+
+ if ((handle = zonecfg_init_handle()) == NULL)
+ return (getpid());
+
+ if (zonecfg_get_handle((char *)zone_name, handle) != Z_OK)
+ return (getpid());
+
+ res = getrootattr(handle, DTD_ATTR_DID, did_str, sizeof (did_str));
+
+ /* If the zone already has an assigned debug ID, return it. */
+ if (res == Z_OK && did_str[0] != '\0') {
+ zonecfg_fini_handle(handle);
+ return (atoi(did_str));
+ }
+
+ /*
+ * The zone doesn't have an assigned debug ID yet, generate one and
+ * save it as part of the zone definition.
+ */
+ if ((new_did = new_zone_did()) == -1) {
+ /*
+ * We should really never hit this block of code.
+ * Generating a new ID failed for some reason. Use the current
+ * pid as a temporary ID so that the zone can continue to boot
+ * but we don't persistently save this temporary ID on the zone.
+ */
+ zonecfg_fini_handle(handle);
+ return (getpid());
+ }
+
+ /* Now persistently save this new ID onto the zone. */
+ (void) snprintf(did_str, sizeof (did_str), "%d", new_did);
+ (void) setrootattr(handle, DTD_ATTR_DID, did_str);
+ (void) zonecfg_save(handle);
+
+ zonecfg_fini_handle(handle);
+ return (new_did);
+}
+
+zoneid_t
+zonecfg_get_did(zone_dochandle_t handle)
+{
+ char did_str[80];
+ int err;
+ zoneid_t did;
+
+ err = getrootattr(handle, DTD_ATTR_DID, did_str, sizeof (did_str));
+ if (err == Z_OK && did_str[0] != '\0')
+ did = atoi(did_str);
+ else
+ did = -1;
+
+ return (did);
+}
+
+void
+zonecfg_set_did(zone_dochandle_t handle)
+{
+ zoneid_t new_did;
+ char did_str[80];
+
+ if ((new_did = new_zone_did()) == -1)
+ return;
+ (void) snprintf(did_str, sizeof (did_str), "%d", new_did);
+ (void) setrootattr(handle, DTD_ATTR_DID, did_str);
+}
+
+/*
* Return the appropriate root for the active /dev.
* For normal zone, the path is $ZONEPATH/root;
* for scratch zone, the dev path is $ZONEPATH/lu.
@@ -5805,6 +6265,30 @@ zonecfg_get_uuid(const char *zonename, uuid_t uuid)
}
/*
+ * Changes a zone's UUID to the given value. Returns an error if the UUID is
+ * malformed or if the zone cannot be located.
+ */
+int
+zonecfg_set_uuid(const char *zonename, const char *zonepath,
+ const char *uuid)
+{
+ int err;
+ struct zoneent ze;
+
+ bzero(&ze, sizeof (ze));
+ ze.zone_state = -1; /* Preserve existing state in index */
+ (void) strlcpy(ze.zone_name, zonename, sizeof (ze.zone_name));
+ (void) strlcpy(ze.zone_path, zonepath, sizeof (ze.zone_path));
+ if (uuid_parse((char *)uuid, ze.zone_uuid) == -1)
+ return (Z_INVALID_PROPERTY);
+
+ if ((err = putzoneent(&ze, PZE_MODIFY)) != Z_OK)
+ return (err);
+
+ return (Z_OK);
+}
+
+/*
* File-system convenience functions.
*/
boolean_t
@@ -6838,131 +7322,49 @@ zonecfg_getpsetent(zone_dochandle_t handle, struct zone_psettab *tabptr)
return (err);
}
-static int
-add_mcap(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
-{
- xmlNodePtr newnode, cur = handle->zone_dh_cur;
- int err;
-
- newnode = xmlNewTextChild(cur, NULL, DTD_ELEM_MCAP, NULL);
- if ((err = newprop(newnode, DTD_ATTR_PHYSCAP, tabptr->zone_physmem_cap))
- != Z_OK)
- return (err);
-
- return (Z_OK);
-}
-
-int
-zonecfg_delete_mcap(zone_dochandle_t handle)
-{
- int err;
- xmlNodePtr cur = handle->zone_dh_cur;
-
- if ((err = operation_prep(handle)) != Z_OK)
- return (err);
-
- for (cur = cur->xmlChildrenNode; cur != NULL; cur = cur->next) {
- if (xmlStrcmp(cur->name, DTD_ELEM_MCAP) != 0)
- continue;
-
- xmlUnlinkNode(cur);
- xmlFreeNode(cur);
- return (Z_OK);
- }
- return (Z_NO_RESOURCE_ID);
-}
-
-int
-zonecfg_modify_mcap(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
-{
- int err;
-
- if (tabptr == NULL)
- return (Z_INVAL);
-
- err = zonecfg_delete_mcap(handle);
- /* it is ok if there is no mcap entry */
- if (err != Z_OK && err != Z_NO_RESOURCE_ID)
- return (err);
-
- if ((err = add_mcap(handle, tabptr)) != Z_OK)
- return (err);
-
- return (Z_OK);
-}
-
+/*
+ * Cleanup obsolete constructs in the configuration.
+ * Return true of the config has been updated and must be commited.
+ */
int
-zonecfg_lookup_mcap(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
+zonecfg_fix_obsolete(zone_dochandle_t handle)
{
+ int res = 0;
+ int add_physmem_rctl = 0;
xmlNodePtr cur;
- int err;
-
- if (tabptr == NULL)
- return (Z_INVAL);
+ char zone_physmem_cap[MAXNAMELEN];
- if ((err = operation_prep(handle)) != Z_OK)
- return (err);
+ if (operation_prep(handle) != Z_OK)
+ return (res);
+ /*
+ * If an obsolete mcap entry exists, convert it to the rctl.
+ */
cur = handle->zone_dh_cur;
for (cur = cur->xmlChildrenNode; cur != NULL; cur = cur->next) {
if (xmlStrcmp(cur->name, DTD_ELEM_MCAP) != 0)
continue;
- if ((err = fetchprop(cur, DTD_ATTR_PHYSCAP,
- tabptr->zone_physmem_cap,
- sizeof (tabptr->zone_physmem_cap))) != Z_OK) {
- handle->zone_dh_cur = handle->zone_dh_top;
- return (err);
+
+ if (fetchprop(cur, DTD_ATTR_PHYSCAP,
+ zone_physmem_cap, sizeof (zone_physmem_cap)) == Z_OK) {
+ res = 1;
+ add_physmem_rctl = 1;
}
- return (Z_OK);
+ xmlUnlinkNode(cur);
+ xmlFreeNode(cur);
+ break;
}
- return (Z_NO_ENTRY);
-}
-
-static int
-getmcapent_core(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
-{
- xmlNodePtr cur;
- int err;
-
- if (handle == NULL)
- return (Z_INVAL);
-
- if ((cur = handle->zone_dh_cur) == NULL)
- return (Z_NO_ENTRY);
-
- for (; cur != NULL; cur = cur->next)
- if (xmlStrcmp(cur->name, DTD_ELEM_MCAP) == 0)
- break;
- if (cur == NULL) {
- handle->zone_dh_cur = handle->zone_dh_top;
- return (Z_NO_ENTRY);
- }
+ if (add_physmem_rctl) {
+ uint64_t cap;
+ char *endp;
- if ((err = fetchprop(cur, DTD_ATTR_PHYSCAP, tabptr->zone_physmem_cap,
- sizeof (tabptr->zone_physmem_cap))) != Z_OK) {
- handle->zone_dh_cur = handle->zone_dh_top;
- return (err);
+ cap = strtoull(zone_physmem_cap, &endp, 10);
+ (void) zonecfg_set_aliased_rctl(handle, ALIAS_MAXPHYSMEM, cap);
}
- handle->zone_dh_cur = cur->next;
- return (Z_OK);
-}
-
-int
-zonecfg_getmcapent(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
-{
- int err;
-
- if ((err = zonecfg_setent(handle)) != Z_OK)
- return (err);
-
- err = getmcapent_core(handle, tabptr);
-
- (void) zonecfg_endent(handle);
-
- return (err);
+ return (res);
}
/*
diff --git a/usr/src/lib/libzonecfg/common/mapfile-vers b/usr/src/lib/libzonecfg/common/mapfile-vers
index b908a28174..7265b06a1f 100644
--- a/usr/src/lib/libzonecfg/common/mapfile-vers
+++ b/usr/src/lib/libzonecfg/common/mapfile-vers
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, Joyent Inc. All rights reserved.
#
#
@@ -53,6 +54,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_add_fs_option;
zonecfg_add_admin;
zonecfg_add_nwif;
+ zonecfg_add_res_attr;
zonecfg_add_pkg;
zonecfg_add_pset;
zonecfg_add_rctl;
@@ -79,7 +81,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_delete_dev;
zonecfg_delete_ds;
zonecfg_delete_filesystem;
- zonecfg_delete_mcap;
zonecfg_delete_nwif;
zonecfg_delete_pset;
zonecfg_delete_rctl;
@@ -104,7 +105,9 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_find_mounts;
zonecfg_find_scratch;
zonecfg_fini_handle;
+ zonecfg_fix_obsolete;
zonecfg_free_fs_option_list;
+ zonecfg_free_res_attr_list;
zonecfg_free_rctl_value_list;
zonecfg_get_aliased_rctl;
zonecfg_get_attach_handle;
@@ -118,6 +121,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_get_bootargs;
zonecfg_get_brand;
zonecfg_get_dflt_sched_class;
+ zonecfg_get_did;
zonecfg_getdevent;
zonecfg_getdevperment;
zonecfg_getdsent;
@@ -127,7 +131,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_get_hostid;
zonecfg_get_iptype;
zonecfg_get_limitpriv;
- zonecfg_getmcapent;
zonecfg_get_name;
zonecfg_get_name_by_uuid;
zonecfg_getnwifent;
@@ -160,7 +163,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_lookup_dev;
zonecfg_lookup_ds;
zonecfg_lookup_filesystem;
- zonecfg_lookup_mcap;
zonecfg_lookup_nwif;
zonecfg_lookup_pset;
zonecfg_lookup_rctl;
@@ -169,7 +171,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_modify_dev;
zonecfg_modify_ds;
zonecfg_modify_filesystem;
- zonecfg_modify_mcap;
zonecfg_modify_nwif;
zonecfg_modify_pset;
zonecfg_modify_rctl;
@@ -183,6 +184,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_ping_zoneadmd;
zonecfg_release_lock_file;
zonecfg_remove_fs_option;
+ zonecfg_remove_res_attr;
zonecfg_remove_rctl_value;
zonecfg_remove_userauths;
zonecfg_reverse_scratch;
@@ -196,6 +198,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_set_autoboot;
zonecfg_set_bootargs;
zonecfg_set_brand;
+ zonecfg_set_did;
zonecfg_setdevent;
zonecfg_setdevperment;
zonecfg_setdsent;
@@ -211,6 +214,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_set_root;
zonecfg_set_sched;
zonecfg_set_swinv;
+ zonecfg_set_uuid;
zonecfg_set_zonepath;
zonecfg_strerror;
zonecfg_str_to_bytes;
@@ -229,6 +233,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_verify_save;
zonecfg_warn_poold;
zone_get_brand;
+ zone_get_did;
zone_get_devroot;
zone_get_id;
zone_get_rootpath;
diff --git a/usr/src/lib/libzonecfg/dtd/zonecfg.dtd.1 b/usr/src/lib/libzonecfg/dtd/zonecfg.dtd.1
index d94bb09c5f..3c7198efef 100644
--- a/usr/src/lib/libzonecfg/dtd/zonecfg.dtd.1
+++ b/usr/src/lib/libzonecfg/dtd/zonecfg.dtd.1
@@ -21,6 +21,7 @@
CDDL HEADER END
Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2011, Joyent Inc. All rights reserved.
-->
@@ -46,14 +47,21 @@
<!ATTLIST inherited-pkg-dir directory CDATA #REQUIRED>
-<!ELEMENT network EMPTY>
+<!ELEMENT net-attr EMPTY>
+<!ATTLIST net-attr name CDATA #REQUIRED
+ value CDATA #REQUIRED>
+
+<!ELEMENT network (net-attr)*>
<!ATTLIST network address CDATA ""
allowed-address CDATA ""
defrouter CDATA ""
- physical CDATA #REQUIRED>
+ global-nic CDATA ""
+ mac-addr CDATA ""
+ physical CDATA #REQUIRED
+ vlan-id CDATA "">
-<!ELEMENT device EMPTY>
+<!ELEMENT device (net-attr)*>
<!ATTLIST device match CDATA #REQUIRED>
@@ -156,6 +164,7 @@
limitpriv CDATA ""
bootargs CDATA ""
brand CDATA ""
+ debugid CDATA ""
scheduling-class CDATA ""
fs-allowed CDATA ""
version NMTOKEN #FIXED '1'>
diff --git a/usr/src/lib/lvm/libsvm/Makefile.com b/usr/src/lib/lvm/libsvm/Makefile.com
index 7df4a4b39f..2457a10b69 100644
--- a/usr/src/lib/lvm/libsvm/Makefile.com
+++ b/usr/src/lib/lvm/libsvm/Makefile.com
@@ -46,7 +46,7 @@ LDLIBS += -lmeta -ldevid -lc
# XXX There isn't a lint library for libspmicommon. For now, we work
# around this by only using the library when we build (as opposed to lint).
#
-all debug install := LDLIBS += -L/usr/snadm/lib -lspmicommon
+all debug install := LDLIBS += -L$(ADJUNCT_PROTO)/usr/snadm/lib -lspmicommon
DYNFLAGS += -R/usr/snadm/lib
CPPFLAGS += -D_FILE_OFFSET_BITS=64
diff --git a/usr/src/lib/nsswitch/dns/Makefile.com b/usr/src/lib/nsswitch/dns/Makefile.com
index 23c89c32f8..0366633c0c 100644
--- a/usr/src/lib/nsswitch/dns/Makefile.com
+++ b/usr/src/lib/nsswitch/dns/Makefile.com
@@ -22,8 +22,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
# lib/nsswitch/dns/Makefile.com
LIBRARY = libnss_dns.a
@@ -46,5 +44,5 @@ CPPFLAGS += -DNSS_DNS_LIBRESOLV=\"libresolv.so.2\"
LINTFLAGS += -erroff=E_GLOBAL_COULD_BE_STATIC2
-LDLIBS += -lnsl
+LDLIBS += -lnsl -lresolv_joy -lsocket
DYNLIB1 = nss_dns.so$(VERS)
diff --git a/usr/src/lib/nsswitch/dns/common/dns_common.c b/usr/src/lib/nsswitch/dns/common/dns_common.c
index a9195f9f68..0195b1847c 100644
--- a/usr/src/lib/nsswitch/dns/common/dns_common.c
+++ b/usr/src/lib/nsswitch/dns/common/dns_common.c
@@ -22,22 +22,19 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* dns_common.c
*/
#include "dns_common.h"
-
-#pragma weak dn_expand
-#pragma weak res_ninit
-#pragma weak res_ndestroy
-#pragma weak res_nsearch
-#pragma weak res_nclose
-#pragma weak ns_get16
-#pragma weak ns_get32
-#pragma weak __ns_get16
-#pragma weak __ns_get32
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <ifaddrs.h>
+#include <net/if.h>
#define DNS_ALIASES 0
#define DNS_ADDRLIST 1
@@ -321,6 +318,52 @@ name_is_alias(char *aliases_ptr, char *name_ptr) {
return (NSS_NOTFOUND);
}
+
+static int
+_nss_has_interfaces(int *v4, int *v6)
+{
+ struct ifaddrs *ifp, *i;
+ struct in_addr in4;
+ struct in6_addr in6;
+ const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+
+ *v4 = *v6 = 0;
+
+ if (getifaddrs(&ifp) != 0)
+ return (-1);
+
+ for (i = ifp; i != NULL; i = i->ifa_next) {
+ if (i->ifa_flags & IFF_LOOPBACK)
+ continue;
+ if ((i->ifa_flags & IFF_UP) == 0)
+ continue;
+
+ if (i->ifa_addr->sa_family == AF_INET) {
+ if (*v4 != 0)
+ continue;
+
+ if (((struct sockaddr_in *)i->ifa_addr)->
+ sin_addr.s_addr == INADDR_ANY)
+ continue;
+ *v4 = 1;
+ }
+
+ if (i->ifa_addr->sa_family == AF_INET6) {
+ if (*v6 != 0)
+ continue;
+
+ if (memcmp(&in6addr_any,
+ &((struct sockaddr_in6 *)i->ifa_addr)->sin6_addr,
+ sizeof (struct in6_addr)) == 0)
+ continue;
+ *v6 = 1;
+ }
+ }
+
+ freeifaddrs(ifp);
+ return (0);
+}
+
/*
* nss_dns_gethost_withttl(void *buffer, size_t bufsize, int ipnode)
* nss2 get hosts/ipnodes with ttl backend DNS search engine.
@@ -331,13 +374,6 @@ name_is_alias(char *aliases_ptr, char *name_ptr) {
* Additionally in the extended results a nssuint_t ttl is placed.
* This ttl is the lessor of the ttl's extracted from the result.
*
- * ***Currently the first version of this API only performs simple
- * single res_nsearch lookups for with T_A or T_AAAA results.
- * Other searches are deferred to the generic API w/t ttls.
- *
- * This function is not a generic res_* operation. It only performs
- * a single T_A or T_AAAA lookups***
- *
* RETURNS: NSS_SUCCESS or NSS_ERROR
* If an NSS_ERROR result is returned, nscd is expected
* to resubmit the gethosts request using the old style
@@ -384,11 +420,14 @@ _nss_dns_gethost_withttl(void *buffer, size_t bufsize, int ipnode)
int af;
char *ap, *apc;
int hlen = 0, alen, iplen, len, isans;
+ int has_v4 = 0, has_v6 = 0;
+ int flags, family, pass2 = 0;
statp = &stat;
(void) memset(statp, '\0', sizeof (struct __res_state));
- if (res_ninit(statp) == -1)
+ if (res_ninit(statp) == -1) {
return (NSS_ERROR);
+ }
ap = apc = (char *)aliases;
alen = 0;
@@ -404,33 +443,139 @@ _nss_dns_gethost_withttl(void *buffer, size_t bufsize, int ipnode)
return (NSS_ERROR);
}
+ /*
+ * There may be flags set when we are handling ipnode. There are three
+ * different values for flags:
+ *
+ * o AI_V4MAPPED
+ * o AI_ALL
+ * o AI_ADDRCONFIG
+ *
+ * The first two only have a meaning when af_family is ipv6. The latter
+ * means something in both cases. These flags are documented in
+ * getipnodebyname(3SOCKET), though the combinations leave a little
+ * something to be desired. It would be great if we could actually use
+ * getipnodebyname directly here since it already knows how to handle
+ * this kind of logic; however, we're not quite so lucky. Ideally we
+ * would add such an interface to libresolv.so.2 to handle this kind of
+ * thing, but that's rather painful as well. We'll summarize what has to
+ * happen below:
+ *
+ * AI_ALL is only meaningful when AI_V4MAPPED is also specified. Both
+ * are ignored if the family is not AF_INET6
+ *
+ * family == AF_INET, flags | AI_ADDRCONFIG
+ * - lookup A records iff we have v4 plumbed
+ * family == AF_INET, !(flags | AI_ADDRCONFIG)
+ * - lookup A records
+ * family == AF_INET6, flags == 0 || flags == AI_ALL
+ * - lookup AAAA records
+ * family == AF_INET6, flags | AI_V4MAPPED
+ * - lookup AAAA, if none, lookup A
+ * family == AF_INET6, flags | AI_ADDRCONFIG
+ * - lookup AAAA records if ipv6
+ * family == AF_INET6, flags | AI_V4MAPPED && flags | AI_ALL
+ * - lookup AAAA records, lookup A records
+ * family == AF_INET6, flags | AI_V4MAPPED && flags | AI_ADDRCONFIG
+ * - lookup AAAA records if ipv6
+ * - If no AAAA && ipv4 exists, lookup A
+ * family == AF_INET6, flags | AI_V4MAPPED && flags | AI_ADDRCONFIG &&
+ * flags | AI_ALL
+ * - lookup AAAA records if ipv6
+ * - loookup A records if ipv4
+ */
if (ipnode) {
/* initially only handle the simple cases */
- if (arg.key.ipnode.flags != 0) {
- res_ndestroy(statp);
- return (NSS_ERROR);
- }
name = arg.key.ipnode.name;
- if (arg.key.ipnode.af_family == AF_INET6)
- qtype = T_AAAA;
- else
- qtype = T_A;
+ flags = arg.key.ipnode.flags;
+ family = arg.key.ipnode.af_family;
+ if (flags != 0) {
+ /*
+ * Figure out our first pass. We'll determine if we need
+ * to do a second pass afterwards once we successfully
+ * finish our first pass.
+ */
+ if ((flags & AI_ADDRCONFIG) != 0) {
+ if (_nss_has_interfaces(&has_v4, &has_v6) !=
+ 0) {
+ res_ndestroy(statp);
+ return (NSS_ERROR);
+ }
+ /* Impossible situations... */
+ if (family == AF_INET && has_v4 == 0) {
+ res_ndestroy(statp);
+ return (NSS_NOTFOUND);
+ }
+ if (family == AF_INET6 && has_v6 == 0 &&
+ !(flags & AI_V4MAPPED)) {
+ res_ndestroy(statp);
+ return (NSS_NOTFOUND);
+ }
+ if (family == AF_INET6 && has_v6)
+ qtype = T_AAAA;
+ if (family == AF_INET || (family == AF_INET6 &&
+ has_v6 == 0 && flags & AI_V4MAPPED))
+ qtype = T_A;
+ } else {
+ has_v4 = has_v6 = 1;
+ if (family == AF_INET6)
+ qtype = T_AAAA;
+ else
+ qtype = T_A;
+ }
+ } else {
+ if (family == AF_INET6)
+ qtype = T_AAAA;
+ else
+ qtype = T_A;
+ }
} else {
name = arg.key.name;
qtype = T_A;
}
+
+searchagain:
ret = res_nsearch(statp, name, C_IN, qtype, resbuf.buf, NS_MAXMSG);
if (ret == -1) {
- if (statp->res_h_errno == HOST_NOT_FOUND) {
+ /*
+ * We want to continue on unless we got NO_RECOVERY. Otherwise,
+ * HOST_NOT_FOUND, TRY_AGAIN, and NO_DATA all suggest to me that
+ * we should keep going.
+ */
+ if (statp->res_h_errno == NO_RECOVERY) {
+ /* else lookup error - handle in general code */
+ res_ndestroy(statp);
+ return (NSS_ERROR);
+ }
+
+ /*
+ * We found something on our first pass. Make sure that we do
+ * not clobber this information. This ultimately means that we
+ * were successful.
+ */
+ if (pass2 == 2)
+ goto out;
+
+ if (pass2 == 1 || flags == 0 || family == AF_INET ||
+ (family == AF_INET6 && !(flags & AI_V4MAPPED))) {
pbuf->p_herrno = HOST_NOT_FOUND;
pbuf->p_status = NSS_NOTFOUND;
pbuf->data_len = 0;
res_ndestroy(statp);
return (NSS_NOTFOUND);
}
- /* else lookup error - handle in general code */
- res_ndestroy(statp);
- return (NSS_ERROR);
+ if ((flags & AI_ADDRCONFIG) && !(flags & AI_ALL) &&
+ has_v4 == 0) {
+ pbuf->p_herrno = HOST_NOT_FOUND;
+ pbuf->p_status = NSS_NOTFOUND;
+ pbuf->data_len = 0;
+ res_ndestroy(statp);
+ return (NSS_NOTFOUND);
+ }
+ qtype = T_A;
+ flags = 0;
+ pass2 = 1;
+ goto searchagain;
}
cp = resbuf.buf;
@@ -579,6 +724,15 @@ _nss_dns_gethost_withttl(void *buffer, size_t bufsize, int ipnode)
*bptr++ = '\n';
blen++;
}
+
+ /* Depending on our flags we may need to go back another time. */
+ if (qtype == T_AAAA && family == AF_INET6 &&
+ ((flags & AI_V4MAPPED) != 0) && ((flags & AI_ALL) != 0) && has_v4) {
+ qtype = T_A;
+ pass2 = 2; /* Indicate that we found data this pass */
+ goto searchagain;
+ }
+
/* Presumably the buffer is now filled. */
len = ROUND_UP(blen, sizeof (nssuint_t));
/* still room? */
@@ -587,6 +741,7 @@ _nss_dns_gethost_withttl(void *buffer, size_t bufsize, int ipnode)
res_ndestroy(statp);
return (NSS_ERROR);
}
+out:
pbuf->ext_off = pbuf->data_off + len;
pbuf->ext_len = sizeof (nssuint_t);
pbuf->data_len = blen;
diff --git a/usr/src/lib/nsswitch/dns/common/dns_common.h b/usr/src/lib/nsswitch/dns/common/dns_common.h
index 717f56d70f..83d486cf57 100644
--- a/usr/src/lib/nsswitch/dns/common/dns_common.h
+++ b/usr/src/lib/nsswitch/dns/common/dns_common.h
@@ -31,8 +31,6 @@
#ifndef _DNS_COMMON_H
#define _DNS_COMMON_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
@@ -43,7 +41,7 @@
#include <thread.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
-#include <resolv.h>
+#include <resolv_joy.h>
#include <syslog.h>
#include <nsswitch.h>
#include <nss_common.h>
diff --git a/usr/src/lib/nsswitch/dns/common/dns_mt.c b/usr/src/lib/nsswitch/dns/common/dns_mt.c
index 128b1bde75..4af3f671c0 100644
--- a/usr/src/lib/nsswitch/dns/common/dns_mt.c
+++ b/usr/src/lib/nsswitch/dns/common/dns_mt.c
@@ -23,8 +23,9 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* dns_mt.c
@@ -49,52 +50,41 @@
static void _nss_dns_init(void);
extern struct hostent *res_gethostbyname(const char *);
-#pragma weak res_gethostbyname
-#define RES_SET_NO_HOSTS_FALLBACK "__res_set_no_hosts_fallback"
-extern void __res_set_no_hosts_fallback(void);
-#pragma weak __res_set_no_hosts_fallback
+#define RES_SET_NO_HOSTS_FALLBACK "__joy_res_set_no_hosts_fallback"
+extern void __joy_res_set_no_hosts_fallback(void);
-#define RES_UNSET_NO_HOSTS_FALLBACK "__res_unset_no_hosts_fallback"
-extern void __res_unset_no_hosts_fallback(void);
-#pragma weak __res_unset_no_hosts_fallback
+#define RES_UNSET_NO_HOSTS_FALLBACK "__joy_res_unset_no_hosts_fallback"
+extern void __joy_res_unset_no_hosts_fallback(void);
#define RES_GET_RES "__res_get_res"
extern struct __res_state *__res_get_res(void);
-#pragma weak __res_get_res
#define RES_ENABLE_MT "__res_enable_mt"
extern int __res_enable_mt(void);
-#pragma weak __res_enable_mt
#define RES_DISABLE_MT "__res_disable_mt"
extern int __res_disable_mt(void);
-#pragma weak __res_disable_mt
#define RES_GET_H_ERRNO "__res_get_h_errno"
extern int *__res_get_h_errno();
-#pragma weak __res_get_h_errno
-#define __H_ERRNO "__h_errno"
-extern int *__h_errno(void);
-#pragma weak __h_errno
+#define __H_ERRNO "__joy_h_errno"
+extern int *__joy_h_errno(void);
-#define RES_OVERRIDE_RETRY "__res_override_retry"
-extern int __res_override_retry(int);
-#pragma weak __res_override_retry
+#define RES_OVERRIDE_RETRY "__joy_res_override_retry"
+extern int __joy_res_override_retry(int);
static void __fallback_set_no_hosts(void);
-static int *__fallback_h_errno(void);
-static int __fallback_override_retry(int);
static int __is_mt_safe(void);
void (*set_no_hosts_fallback)(void) = __fallback_set_no_hosts;
void (*unset_no_hosts_fallback)(void) = __fallback_set_no_hosts;
struct __res_state *(*set_res_retry)() = 0;
-int (*enable_mt)() = 0;
-int (*disable_mt)() = 0;
-int *(*get_h_errno)(void) = 0;
-int (*override_retry)(int) = 0;
+int (*enable_mt)() = __is_mt_safe;
+int (*disable_mt)() = __is_mt_safe;
+int *(*get_h_errno)(void) = __joy_h_errno;
+int (*override_retry)(int) = __joy_res_override_retry;
/* Usually set from the Makefile */
#ifndef NSS_DNS_LIBRESOLV
@@ -106,91 +96,12 @@ extern int h_errno;
mutex_t one_lane = DEFAULTMUTEX;
+/* Because we link against libresolv_joy.so.2, this is relatively easy. */
void
_nss_dns_init(void)
{
- void *reslib, (*f_void_ptr)();
-
- /* If no libresolv library, then load one */
- if (res_gethostbyname == 0) {
- if ((reslib =
- dlopen(NSS_DNS_LIBRESOLV, RTLD_LAZY|RTLD_GLOBAL)) != 0) {
- /* Turn off /etc/hosts fall back in libresolv */
- if ((f_void_ptr = (void (*)(void))dlsym(reslib,
- RES_SET_NO_HOSTS_FALLBACK)) != 0) {
- set_no_hosts_fallback = f_void_ptr;
- }
- if ((f_void_ptr = (void (*)(void))dlsym(reslib,
- RES_SET_NO_HOSTS_FALLBACK)) != 0) {
- unset_no_hosts_fallback = f_void_ptr;
- }
- /* Set number of resolver retries */
- if ((override_retry = (int (*)(int))dlsym(reslib,
- RES_OVERRIDE_RETRY)) == 0) {
- set_res_retry =
- (struct __res_state *(*)(void))dlsym(reslib,
- RES_GET_RES);
- override_retry = __fallback_override_retry;
- }
- /*
- * Select h_errno retrieval function. A BIND 8.2.2
- * libresolv.so.2 will have __h_errno, a BIND 8.1.2
- * one will have __res_get_h_errno, and other
- * versions may have nothing at all.
- *
- * Also try to bind to the relevant MT enable/disable
- * functions which are also dependent on the version
- * of the BIND libresolv.so.2 being used.
- */
- if ((get_h_errno = (int *(*)(void))dlsym(reslib,
- __H_ERRNO)) != 0) {
- /* BIND 8.2.2 libresolv.so.2 is MT safe. */
- enable_mt = __is_mt_safe;
- disable_mt = __is_mt_safe;
- } else {
- if ((get_h_errno =
- (int *(*)(void))dlsym(reslib,
- RES_GET_H_ERRNO)) == 0) {
- get_h_errno = __fallback_h_errno;
- }
- /*
- * Pre-BIND 8.2.2 was not MT safe. Try to
- * bind the MT enable/disable functions.
- */
- if ((enable_mt = (int (*)(void))dlsym(reslib,
- RES_ENABLE_MT)) != 0 &&
- (disable_mt = (int (*)(void))dlsym(reslib,
- RES_DISABLE_MT)) == 0) {
- enable_mt = 0;
- }
- }
- }
- } else {
- /* Libresolv already loaded */
- if ((f_void_ptr = __res_set_no_hosts_fallback) != 0) {
- set_no_hosts_fallback = f_void_ptr;
- }
- if ((f_void_ptr = __res_unset_no_hosts_fallback) != 0) {
- unset_no_hosts_fallback = f_void_ptr;
- }
- if ((override_retry = __res_override_retry) == 0) {
- set_res_retry = __res_get_res;
- override_retry = __fallback_override_retry;
- }
- if ((get_h_errno = __h_errno) == 0 &&
- (get_h_errno = __res_get_h_errno) == 0) {
- get_h_errno = __fallback_h_errno;
- }
- if (get_h_errno == __h_errno) {
- enable_mt = __is_mt_safe;
- disable_mt = __is_mt_safe;
- } else {
- if ((enable_mt = __res_enable_mt) != 0 &&
- (disable_mt = __res_disable_mt) == 0) {
- enable_mt = 0;
- }
- }
- }
+ enable_mt = __is_mt_safe;
+ disable_mt = __is_mt_safe;
}
@@ -228,36 +139,6 @@ __is_mt_safe(void) {
}
-/*
- * Return pointer to the global h_errno variable
- */
-static int *
-__fallback_h_errno(void) {
- return (&h_errno);
-}
-
-
-/*
- * This function is called when the resolver library doesn't provide its
- * own function to establish an override retry. If we can get a pointer
- * to the per-thread _res (i.e., set_res_retry != 0), we set the retries
- * directly, and return the previous number of retries. Otherwise, there's
- * nothing to do.
- */
-static int
-__fallback_override_retry(int retry) {
- struct __res_state *res;
- int old_retry = 0;
-
- if (set_res_retry != 0) {
- res = set_res_retry();
- old_retry = res->retry;
- res->retry = retry;
- }
- return (old_retry);
-}
-
-
static void
__fallback_set_no_hosts(void) {
}
diff --git a/usr/src/lib/nsswitch/dns/common/gethostent.c b/usr/src/lib/nsswitch/dns/common/gethostent.c
index 648ea8ba01..d321dd24c6 100644
--- a/usr/src/lib/nsswitch/dns/common/gethostent.c
+++ b/usr/src/lib/nsswitch/dns/common/gethostent.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* gethostent.c
*
@@ -53,12 +51,6 @@ static struct hostent *_gethostbyaddr(int *h_errnop, const char *addr,
int len, int type);
struct hostent *_nss_dns_gethostbyname2(int *h_errnop, const char *name);
-#pragma weak res_gethostbyname
-#pragma weak res_gethostbyname2
-#pragma weak res_gethostbyaddr
-#pragma weak res_sethostent
-#pragma weak res_endhostent
-
nss_backend_t *_nss_dns_constr(dns_backend_op_t ops[], int n_ops);
nss_status_t __nss_dns_getbyaddr(dns_backend_ptr_t, void *);
diff --git a/usr/src/lib/nsswitch/dns/common/gethostent6.c b/usr/src/lib/nsswitch/dns/common/gethostent6.c
index ee85832073..f3efc4eae6 100644
--- a/usr/src/lib/nsswitch/dns/common/gethostent6.c
+++ b/usr/src/lib/nsswitch/dns/common/gethostent6.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This is the DNS backend for IPv6 addresses.
* getbyname() is a local routine, but getbyaddr() actually shares the
@@ -50,8 +48,6 @@
*/
-#pragma weak res_endhostent
-
extern struct hostent *_gethostbyname(int *, const char *);
extern struct hostent *_nss_dns_gethostbyname2(int *, const char *);
diff --git a/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com b/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com
index 22082a1fb8..323f311dec 100644
--- a/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com
+++ b/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com
@@ -66,14 +66,14 @@ ROOTLIBDIR64=$(ROOT)/usr/lib/security/$(MACH64)
LIBS=$(DYNLIB) $(DYNLIB64)
-TSSROOT=
+TSSROOT=$(ADJUNCT_PROTO)
TSPILIBDIR=$(TSSROOT)/usr/lib
TSPIINCDIR=$(TSSROOT)/usr/include
TSSLIB=-L$(TSPILIBDIR)
TSSLIB64=-L$(TSPILIBDIR)/$(MACH64)
TSSINC=-I$(TSPIINCDIR)
-LDLIBS += $(TSSLIB) -L/lib -lc -luuid -lmd -ltspi -lcrypto
+LDLIBS += $(TSSLIB) -L$(ADJUNCT_PROTO)/lib -lc -luuid -lmd -ltspi -lcrypto
CPPFLAGS += -xCC -D_POSIX_PTHREAD_SEMANTICS $(TSSINC)
CPPFLAGS64 += $(CPPFLAGS)
C99MODE= $(C99_ENABLE)
diff --git a/usr/src/lib/policykit/Makefile.policykit b/usr/src/lib/policykit/Makefile.policykit
index 8b8cff0fe1..eca0c0d026 100644
--- a/usr/src/lib/policykit/Makefile.policykit
+++ b/usr/src/lib/policykit/Makefile.policykit
@@ -29,8 +29,11 @@
POLICYKIT_VERSION = 0.2
-POLICYKIT_DBUS_CPPFLAGS = -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
-POLICYKIT_GLIB_CPPFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+POLICYKIT_DBUS_CPPFLAGS = -DDBUS_API_SUBJECT_TO_CHANGE \
+ -I$(ADJUNCT_PROTO)/usr/include/dbus-1.0 \
+ -I$(ADJUNCT_PROTO)/usr/lib/dbus-1.0/include
+POLICYKIT_GLIB_CPPFLAGS = -I$(ADJUNCT_PROTO)/usr/include/glib-2.0 \
+ -I$(ADJUNCT_PROTO)/usr/lib/glib-2.0/include
POLICYKIT_DBUS_LDLIBS = -ldbus-1
POLICYKIT_GLIB_LDLIBS = -lglib-2.0
diff --git a/usr/src/lib/print/Makefile b/usr/src/lib/print/Makefile
deleted file mode 100644
index fd931373e8..0000000000
--- a/usr/src/lib/print/Makefile
+++ /dev/null
@@ -1,94 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-SUBDIRS = \
- libprint \
- libpapi-common \
- libpapi-dynamic \
- libpapi-lpd \
- libipp-core \
- libhttp-core \
- libpapi-ipp \
- libipp-listener \
- mod_ipp
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-install_h := TARGET = install_h
-lint := TARGET = lint
-
-include $(SRC)/Makefile.master
-
-TEXT_DOMAIN= SUNW_OST_OSLIB
-POFILE= print-lib.po
-
-.KEEP_STATE:
-
-all: $(TXTS) $(SUBDIRS)
-
-#
-# Each message catalog file is generated in each sub
-# directory and copied to the usr/src/cmd/lp/ directory.
-# Those message catalog files are consolidated into one
-# message catalog file. The consolidated one will be copied
-# into the $(ROOT)/catalog/SUNW_OST_OSCMD/ directory.
-#
-
-_msg: $(MSGDOMAIN)
- @$(RM) $(POFILE)
- $(XGETTEXT) -s `/bin/find . -type d -name SCCS -prune -o -type f -name '*.c' -print`
- @/bin/cat messages.po | sed '/domain/d' > $(POFILE)
- @$(RM) messages.po
- $(RM) $(MSGDOMAIN)/$(POFILE)
- /bin/cp $(POFILE) $(MSGDOMAIN)
-
-install: $(ROOTDIRS) $(ROOTSYMLINKDIRS) $(SUBDIRS)
-
-install_h clean strip lint: $(SUBDIRS)
-
-clobber: $(SUBDIRS) local_clobber
-
-local_clobber:
- $(RM) $(CLOBBERFILES) $(POFILE)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include $(SRC)/Makefile.msg.targ
-
-# Dependencies
-libpapi-dynamic: libpapi-common
-libpapi-lpd: libpapi-dynamic
-libipp-core: libpapi-common
-libpapi-ipp: libpapi-common libipp-core libhttp-core
-libipp-listener: libpapi-dynamic libipp-core
-mod_ipp: libipp-listener
-
diff --git a/usr/src/lib/print/libhttp-core/Makefile b/usr/src/lib/print/libhttp-core/Makefile
deleted file mode 100644
index b92d620b10..0000000000
--- a/usr/src/lib/print/libhttp-core/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.lib
-
-#HDRS = papi.h
-#HDRDIR = common
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all clean clobber install: .WAIT $(SUBDIRS)
-
-lint: # $(SUBDIRS)
-
-install_h: # $(ROOTHDRS)
-
-check: # $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/libhttp-core/Makefile.com b/usr/src/lib/print/libhttp-core/Makefile.com
deleted file mode 100644
index cfb8ae8730..0000000000
--- a/usr/src/lib/print/libhttp-core/Makefile.com
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-LIBRARY = libhttp-core.a
-VERS = .1
-OBJECTS = http-addr.o http-support.o http.o
-
-ROOTLIBDIR = $(ROOT)/usr/lib/print
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
-
-SRCDIR = ../common
-
-ROOTLIBDIR= $(ROOT)/usr/lib/print
-ROOTLIBDIR64= $(ROOT)/usr/lib/print/$(MACH)
-
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(SRCDIR)
-CPPFLAGS += -I../../libpapi-common/common
-
-MAPFILES = $(SRCDIR)/mapfile
-
-LDLIBS += -lsocket -lnsl -lc
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-lint: lintcheck
-
-$(ROOTLIBDIR):
- $(INS.dir)
-
-include ../../../Makefile.targ
diff --git a/usr/src/lib/print/libhttp-core/common/LICENSE.txt b/usr/src/lib/print/libhttp-core/common/LICENSE.txt
deleted file mode 100644
index 797ee5db95..0000000000
--- a/usr/src/lib/print/libhttp-core/common/LICENSE.txt
+++ /dev/null
@@ -1,964 +0,0 @@
- Common UNIX Printing System License Agreement
-
- Copyright 1997-2006 by Easy Software Products
- 44141 AIRPORT VIEW DR STE 204
- HOLLYWOOD, MARYLAND 20636 USA
-
- Voice: +1.301.373.9600
- Email: cups-info@cups.org
- WWW: http://www.cups.org
-
-
-INTRODUCTION
-
-The Common UNIX Printing System(tm), ("CUPS(tm)"), is provided
-under the GNU General Public License ("GPL") and GNU Library
-General Public License ("LGPL"), Version 2, with exceptions for
-Apple operating systems and the OpenSSL toolkit. A copy of the
-exceptions and licenses follow this introduction.
-
-The GNU LGPL applies to the CUPS API library, located in the
-"cups" subdirectory of the CUPS source distribution and in the
-"cups" include directory and library files in the binary
-distributions. The GNU GPL applies to the remainder of the CUPS
-distribution, including the "pdftops" filter which is based upon
-Xpdf and the CUPS imaging library.
-
-For those not familiar with the GNU GPL, the license basically
-allows you to:
-
- - Use the CUPS software at no charge.
- - Distribute verbatim copies of the software in source or
- binary form.
- - Sell verbatim copies of the software for a media fee, or
- sell support for the software.
- - Distribute or sell printer drivers and filters that use
- CUPS so long as source code is made available under the
- GPL.
-
-What this license *does not* allow you to do is make changes or
-add features to CUPS and then sell a binary distribution without
-source code. You must provide source for any new drivers,
-changes, or additions to the software, and all code must be
-provided under the GPL or LGPL as appropriate. The only
-exceptions to this are the portions of the CUPS software covered
-by the Apple operating system license exceptions outlined later
-in this license agreement.
-
-The GNU LGPL relaxes the "link-to" restriction, allowing you to
-develop applications that use the CUPS API library under other
-licenses and/or conditions as appropriate for your application.
-
-
-LICENSE EXCEPTIONS
-
-In addition, as the copyright holder of CUPS, Easy Software
-Products grants the following special exceptions:
-
- 1. Apple Operating System Development License Exception;
-
- a. Software that is developed by any person or entity
- for an Apple Operating System ("Apple OS-Developed
- Software"), including but not limited to Apple and
- third party printer drivers, filters, and backends
- for an Apple Operating System, that is linked to the
- CUPS imaging library or based on any sample filters
- or backends provided with CUPS shall not be
- considered to be a derivative work or collective work
- based on the CUPS program and is exempt from the
- mandatory source code release clauses of the GNU GPL.
- You may therefore distribute linked combinations of
- the CUPS imaging library with Apple OS-Developed
- Software without releasing the source code of the
- Apple OS-Developed Software. You may also use sample
- filters and backends provided with CUPS to develop
- Apple OS-Developed Software without releasing the
- source code of the Apple OS-Developed Software.
-
- b. An Apple Operating System means any operating system
- software developed and/or marketed by Apple Computer,
- Inc., including but not limited to all existing
- releases and versions of Apple's Darwin, Mac OS X,
- and Mac OS X Server products and all follow-on
- releases and future versions thereof.
-
- c. This exception is only available for Apple
- OS-Developed Software and does not apply to software
- that is distributed for use on other operating
- systems.
-
- d. All CUPS software that falls under this license
- exception have the following text at the top of each
- source file:
-
- This file is subject to the Apple OS-Developed
- Software exception.
-
- 2. OpenSSL Toolkit License Exception;
-
- a. Easy Software Products explicitly allows the
- compilation and distribution of the CUPS software
- with the OpenSSL Toolkit.
-
-No developer is required to provide these exceptions in a
-derived work.
-
-
-TRADEMARKS
-
-Easy Software Products has trademarked the Common UNIX Printing
-System, CUPS, and CUPS logo. You may use these names and logos
-in any direct port or binary distribution of CUPS. Please
-contact Easy Software Products for written permission to use
-them in derivative products. Our intention is to protect the
-value of these trademarks and ensure that any derivative product
-meets the same high-quality standards as the original.
-
-
-BINARY DISTRIBUTION RIGHTS
-
-Easy Software Products also sells rights to the CUPS source code
-under a binary distribution license for vendors that are unable
-to release source code for their drivers, additions, and
-modifications to CUPS under the GNU GPL and LGPL. For
-information please contact us at the address shown above.
-
-The Common UNIX Printing System provides a "pdftops" filter that
-is based on the Xpdf software. For binary distribution licensing
-of this software, please contact:
-
- Derek B. Noonburg
- Email: derekn@glyphandcog.com
- WWW: http://www.glyphandcog.com/
-
-
-SUPPORT
-
-Easy Software Products sells software support for CUPS as well
-as a commercial printing product based on CUPS called ESP Print
-Pro. You can find out more at our web site:
-
- http://www.easysw.com/
-
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- [This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
-
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-
- GNU LIBRARY GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also compile or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- c) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- d) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/usr/src/lib/print/libhttp-core/common/LICENSE.txt.descrip b/usr/src/lib/print/libhttp-core/common/LICENSE.txt.descrip
deleted file mode 100644
index 7c846a0987..0000000000
--- a/usr/src/lib/print/libhttp-core/common/LICENSE.txt.descrip
+++ /dev/null
@@ -1 +0,0 @@
-CUPS
diff --git a/usr/src/lib/print/libhttp-core/common/debug.h b/usr/src/lib/print/libhttp-core/common/debug.h
deleted file mode 100644
index aebc790017..0000000000
--- a/usr/src/lib/print/libhttp-core/common/debug.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * "$Id: debug.h 148 2006-04-25 16:54:17Z njacobs $
- *
- * Debugging macros for the Common UNIX Printing System (CUPS).
- *
- * Copyright 1997-2005 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * This file is subject to the Apple OS-Developed Software exception.
- */
-
-#ifndef _CUPS_DEBUG_H_
-#define _CUPS_DEBUG_H_
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Include necessary headers...
- */
-
-# include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- * The debug macros are used if you compile with DEBUG defined.
- *
- * Usage:
- *
- * DEBUG_puts("string")
- * DEBUG_printf(("format string", arg, arg, ...));
- *
- * Note the extra parenthesis around the DEBUG_printf macro...
- */
-
-# ifdef DEBUG
-# define DEBUG_puts(x) puts(x)
-# define DEBUG_printf(x) printf x
-# else
-# define DEBUG_puts(x)
-# define DEBUG_printf(x)
-# endif /* DEBUG */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_CUPS_DEBUG_H_ */
-
-/*
- * End of "$Id: debug.h 148 2006-04-25 16:54:17Z njacobs $"
- */
diff --git a/usr/src/lib/print/libhttp-core/common/http-addr.c b/usr/src/lib/print/libhttp-core/common/http-addr.c
deleted file mode 100644
index a872d4d3fd..0000000000
--- a/usr/src/lib/print/libhttp-core/common/http-addr.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * "$Id: http-addr.c 148 2006-04-25 16:54:17Z njacobs $"
- *
- * HTTP address routines for the Common UNIX Printing System (CUPS).
- *
- * Copyright 1997-2005 by Easy Software Products, all rights reserved.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * Contents:
- *
- * httpAddrAny() - Check for the "any" address.
- * httpAddrEqual() - Compare two addresses.
- * httpAddrLoad() - Load a host entry address into an HTTP address.
- * httpAddrLocalhost() - Check for the local loopback address.
- * httpAddrLookup() - Lookup the hostname associated with the address.
- * httpAddrString() - Convert an IP address to a dotted string.
- * httpGetHostByName() - Lookup a hostname or IP address, and return
- * address records for the specified name.
- */
-
-/*
- * Include necessary headers...
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "http.h"
-#include "debug.h"
-#include "string.h"
-#include <ctype.h>
-
-
-/*
- * 'httpAddrAny()' - Check for the "any" address.
- */
-
-int /* O - 1 if "any", 0 otherwise */
-httpAddrAny(const http_addr_t *addr) /* I - Address to check */
-{
-#ifdef AF_INET6
- if (addr->addr.sa_family == AF_INET6 &&
- IN6_IS_ADDR_UNSPECIFIED(&(addr->ipv6.sin6_addr)))
- return (1);
-#endif /* AF_INET6 */
-
- if (addr->addr.sa_family == AF_INET &&
- ntohl(addr->ipv4.sin_addr.s_addr) == 0x00000000)
- return (1);
-
- return (0);
-}
-
-
-/*
- * 'httpAddrEqual()' - Compare two addresses.
- */
-
-int /* O - 1 if equal, 0 if != */
-httpAddrEqual(const http_addr_t *addr1, /* I - First address */
- const http_addr_t *addr2) /* I - Second address */
-{
- if (addr1->addr.sa_family != addr2->addr.sa_family)
- return (0);
-
-#ifdef AF_INET6
- if (addr1->addr.sa_family == AF_INET6)
- return (memcmp(&(addr1->ipv6.sin6_addr), &(addr2->ipv6.sin6_addr), 16) == 0);
-#endif /* AF_INET6 */
-
- return (addr1->ipv4.sin_addr.s_addr == addr2->ipv4.sin_addr.s_addr);
-}
-
-
-/*
- * 'httpAddrLoad()' - Load a host entry address into an HTTP address.
- */
-
-void
-httpAddrLoad(const struct hostent *host, /* I - Host entry */
- int port, /* I - Port number */
- int n, /* I - Index into host entry */
- http_addr_t *addr) /* O - Address to load */
-{
-#ifdef AF_INET6
- if (host->h_addrtype == AF_INET6)
- {
-# ifdef WIN32
- addr->ipv6.sin6_port = htons((u_short)port);
-# else
- addr->ipv6.sin6_port = htons(port);
-# endif /* WIN32 */
-
- memcpy((char *)&(addr->ipv6.sin6_addr), host->h_addr_list[n],
- host->h_length);
- addr->ipv6.sin6_family = AF_INET6;
- }
- else
-#endif /* AF_INET6 */
-#ifdef AF_LOCAL
- if (host->h_addrtype == AF_LOCAL)
- {
- addr->un.sun_family = AF_LOCAL;
- strlcpy(addr->un.sun_path, host->h_addr_list[n], sizeof(addr->un.sun_path));
- }
- else
-#endif /* AF_LOCAL */
- if (host->h_addrtype == AF_INET)
- {
-# ifdef WIN32
- addr->ipv4.sin_port = htons((u_short)port);
-# else
- addr->ipv4.sin_port = htons(port);
-# endif /* WIN32 */
-
- memcpy((char *)&(addr->ipv4.sin_addr), host->h_addr_list[n],
- host->h_length);
- addr->ipv4.sin_family = AF_INET;
- }
-}
-
-
-/*
- * 'httpAddrLocalhost()' - Check for the local loopback address.
- */
-
-int /* O - 1 if local host, 0 otherwise */
-httpAddrLocalhost(const http_addr_t *addr)
- /* I - Address to check */
-{
-#ifdef AF_INET6
- if (addr->addr.sa_family == AF_INET6 &&
- IN6_IS_ADDR_LOOPBACK(&(addr->ipv6.sin6_addr)))
- return (1);
-#endif /* AF_INET6 */
-
-#ifdef AF_LOCAL
- if (addr->addr.sa_family == AF_LOCAL)
- return (1);
-#endif /* AF_LOCAL */
-
- if (addr->addr.sa_family == AF_INET &&
- ntohl(addr->ipv4.sin_addr.s_addr) == 0x7f000001)
- return (1);
-
- return (0);
-}
-
-
-#ifdef __sgi
-# define ADDR_CAST (struct sockaddr *)
-#else
-# define ADDR_CAST (char *)
-#endif /* __sgi */
-
-
-/*
- * 'httpAddrLookup()' - Lookup the hostname associated with the address.
- */
-
-char * /* O - Host name */
-httpAddrLookup(const http_addr_t *addr, /* I - Address to lookup */
- char *name, /* I - Host name buffer */
- int namelen) /* I - Size of name buffer */
-{
- struct hostent *host; /* Host from name service */
-
-
- DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)\n",
- addr, name, namelen));
-
-#ifdef AF_INET6
- if (addr->addr.sa_family == AF_INET6)
- host = gethostbyaddr(ADDR_CAST &(addr->ipv6.sin6_addr),
- sizeof(struct in6_addr), AF_INET6);
- else
-#endif /* AF_INET6 */
-#ifdef AF_LOCAL
- if (addr->addr.sa_family == AF_LOCAL)
- {
- strlcpy(name, addr->un.sun_path, namelen);
- return (name);
- }
- else
-#endif /* AF_LOCAL */
- if (addr->addr.sa_family == AF_INET)
- host = gethostbyaddr(ADDR_CAST &(addr->ipv4.sin_addr),
- sizeof(struct in_addr), AF_INET);
- else
- host = NULL;
-
- if (host == NULL)
- {
- httpAddrString(addr, name, namelen);
- return (NULL);
- }
-
- strlcpy(name, host->h_name, namelen);
-
- return (name);
-}
-
-
-/*
- * 'httpAddrString()' - Convert an IP address to a dotted string.
- */
-
-char * /* O - IP string */
-httpAddrString(const http_addr_t *addr, /* I - Address to convert */
- char *s, /* I - String buffer */
- int slen) /* I - Length of string */
-{
- DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)\n",
- addr, s, slen));
-
-#ifdef AF_INET6
- if (addr->addr.sa_family == AF_INET6)
- snprintf(s, slen, "%u.%u.%u.%u",
- ntohl(addr->ipv6.sin6_addr.s6_addr32[0]),
- ntohl(addr->ipv6.sin6_addr.s6_addr32[1]),
- ntohl(addr->ipv6.sin6_addr.s6_addr32[2]),
- ntohl(addr->ipv6.sin6_addr.s6_addr32[3]));
- else
-#endif /* AF_INET6 */
-#ifdef AF_LOCAL
- if (addr->addr.sa_family == AF_LOCAL)
- strlcpy(s, addr->un.sun_path, slen);
- else
-#endif /* AF_LOCAL */
- if (addr->addr.sa_family == AF_INET)
- {
- unsigned temp; /* Temporary address */
-
-
- temp = ntohl(addr->ipv4.sin_addr.s_addr);
-
- snprintf(s, slen, "%d.%d.%d.%d", (temp >> 24) & 255,
- (temp >> 16) & 255, (temp >> 8) & 255, temp & 255);
- }
- else
- strlcpy(s, "UNKNOWN", slen);
-
- DEBUG_printf(("httpAddrString: returning \"%s\"...\n", s));
-
- return (s);
-}
-
-
-/*
- * 'httpGetHostByName()' - Lookup a hostname or IP address, and return
- * address records for the specified name.
- */
-
-struct hostent * /* O - Host entry */
-httpGetHostByName(const char *name) /* I - Hostname or IP address */
-{
- const char *nameptr; /* Pointer into name */
- unsigned ip[4]; /* IP address components */
- static unsigned packed_ip; /* Packed IPv4 address */
- static char *packed_ptr[2]; /* Pointer to packed address */
- static struct hostent host_ip; /* Host entry for IP/domain address */
-
-
- DEBUG_printf(("httpGetHostByName(name=\"%s\")\n", name));
-
-#if defined(__APPLE__)
- /* OS X hack to avoid it's ocassional long delay in lookupd */
- static const char sLoopback[] = "127.0.0.1";
- if (strcmp(name, "localhost") == 0)
- name = sLoopback;
-#endif /* __APPLE__ */
-
- /*
- * This function is needed because some operating systems have a
- * buggy implementation of gethostbyname() that does not support
- * IP addresses. If the first character of the name string is a
- * number, then sscanf() is used to extract the IP components.
- * We then pack the components into an IPv4 address manually,
- * since the inet_aton() function is deprecated. We use the
- * htonl() macro to get the right byte order for the address.
- *
- * We also support domain sockets when supported by the underlying
- * OS...
- */
-
-#ifdef AF_LOCAL
- if (name[0] == '/')
- {
- /*
- * A domain socket address, so make an AF_LOCAL entry and return it...
- */
-
- host_ip.h_name = (char *)name;
- host_ip.h_aliases = NULL;
- host_ip.h_addrtype = AF_LOCAL;
- host_ip.h_length = strlen(name) + 1;
- host_ip.h_addr_list = packed_ptr;
- packed_ptr[0] = (char *)name;
- packed_ptr[1] = NULL;
-
- DEBUG_puts("httpGetHostByName: returning domain socket address...");
-
- return (&host_ip);
- }
-#endif /* AF_LOCAL */
-
- for (nameptr = name; isdigit(*nameptr & 255) || *nameptr == '.'; nameptr ++);
-
- if (!*nameptr)
- {
- /*
- * We have an IP address; break it up and provide the host entry
- * to the caller. Currently only supports IPv4 addresses, although
- * it should be trivial to support IPv6 in CUPS 1.2.
- */
-
- if (sscanf(name, "%u.%u.%u.%u", ip, ip + 1, ip + 2, ip + 3) != 4)
- return (NULL); /* Must have 4 numbers */
-
- if (ip[0] > 255 || ip[1] > 255 || ip[2] > 255 || ip[3] > 255)
- return (NULL); /* Invalid byte ranges! */
-
- packed_ip = htonl(((((((ip[0] << 8) | ip[1]) << 8) | ip[2]) << 8) | ip[3]));
-
- /*
- * Fill in the host entry and return it...
- */
-
- host_ip.h_name = (char *)name;
- host_ip.h_aliases = NULL;
- host_ip.h_addrtype = AF_INET;
- host_ip.h_length = 4;
- host_ip.h_addr_list = packed_ptr;
- packed_ptr[0] = (char *)(&packed_ip);
- packed_ptr[1] = NULL;
-
- DEBUG_puts("httpGetHostByName: returning IPv4 address...");
-
- return (&host_ip);
- }
- else
- {
- /*
- * Use the gethostbyname() function to get the IP address for
- * the name...
- */
-
- DEBUG_puts("httpGetHostByName: returning domain lookup address(es)...");
-
- return (gethostbyname(name));
- }
-}
-
-
-/*
- * End of "$Id: http-addr.c 148 2006-04-25 16:54:17Z njacobs $".
- */
diff --git a/usr/src/lib/print/libhttp-core/common/http-private.h b/usr/src/lib/print/libhttp-core/common/http-private.h
deleted file mode 100644
index a11b8bbb5e..0000000000
--- a/usr/src/lib/print/libhttp-core/common/http-private.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * "$Id: http-private.h 148 2006-04-25 16:54:17Z njacobs $"
- *
- * Private HTTP definitions for the Common UNIX Printing System (CUPS).
- *
- * Copyright 1997-2005 by Easy Software Products, all rights reserved.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * This file is subject to the Apple OS-Developed Software exception.
- */
-
-#ifndef _CUPS_HTTP_PRIVATE_H_
-#define _CUPS_HTTP_PRIVATE_H_
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Include necessary headers...
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-# include "config.h"
-
-
-# ifdef __sun
-/*
- * Define FD_SETSIZE to CUPS_MAX_FDS on Solaris to get the correct version of
- * select() for large numbers of file descriptors.
- */
-
-#define CUPS_MAX_FDS 1024
-
-# define FD_SETSIZE CUPS_MAX_FDS
-# include <sys/select.h>
-# endif /* __sun */
-
-# include "http.h"
-
-# if defined HAVE_LIBSSL
-/*
- * The OpenSSL library provides its own SSL/TLS context structure for its
- * IO and protocol management...
- */
-
-# include <openssl/err.h>
-# include <openssl/rand.h>
-# include <openssl/ssl.h>
-
-typedef SSL http_tls_t;
-
-# elif defined HAVE_GNUTLS
-/*
- * The GNU TLS library is more of a "bare metal" SSL/TLS library...
- */
-# include <gnutls/gnutls.h>
-
-typedef struct
-{
- gnutls_session session; /* GNU TLS session object */
- void *credentials; /* GNU TLS credentials object */
-} http_tls_t;
-
-# elif defined(HAVE_CDSASSL)
-/*
- * Darwin's Security framework provides its own SSL/TLS context structure
- * for its IO and protocol management...
- */
-
-# include <Security/SecureTransport.h>
-
-typedef SSLConnectionRef http_tls_t;
-
-# endif /* HAVE_LIBSSL */
-
-/*
- * Some OS's don't have hstrerror(), most notably Solaris...
- */
-
-# ifndef HAVE_HSTRERROR
-extern const char *cups_hstrerror(int error);
-# define hstrerror cups_hstrerror
-# elif defined(_AIX) || defined(__osf__)
-/*
- * AIX and Tru64 UNIX don't provide a prototype but do provide the function...
- */
-extern const char *hstrerror(int error);
-# endif /* !HAVE_HSTRERROR */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_CUPS_HTTP_PRIVATE_H_ */
-
-/*
- * End of "$Id: http-private.h 148 2006-04-25 16:54:17Z njacobs $"
- */
diff --git a/usr/src/lib/print/libhttp-core/common/http-support.c b/usr/src/lib/print/libhttp-core/common/http-support.c
deleted file mode 100644
index 2ef3911058..0000000000
--- a/usr/src/lib/print/libhttp-core/common/http-support.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * "$Id: http-support.c 148 2006-04-25 16:54:17Z njacobs $"
- *
- * HTTP support routines for the Common UNIX Printing System (CUPS) scheduler.
- *
- * Copyright 1997-2005 by Easy Software Products, all rights reserved.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- * httpSeparate() - Separate a Universal Resource Identifier into its
- * components.
- * httpSeparate2() - Separate a Universal Resource Identifier into its
- * components.
- * httpStatus() - Return a short string describing a HTTP status code.
- * cups_hstrerror() - hstrerror() emulation function for Solaris and others...
- * http_copy_decode() - Copy and decode a URI.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Include necessary headers...
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include "string.h"
-
-#include "http.h"
-
-
-/*
- * Local functions...
- */
-
-static const char *http_copy_decode(char *dst, const char *src,
- int dstsize, const char *term);
-
-
-/*
- * 'httpSeparate()' - Separate a Universal Resource Identifier into its
- * components.
- */
-
-void
-httpSeparate(const char *uri, /* I - Universal Resource Identifier */
- char *method, /* O - Method [32] (http, https, etc.) */
- char *username, /* O - Username [1024] */
- char *host, /* O - Hostname [1024] */
- int *port, /* O - Port number to use */
- char *resource) /* O - Resource/filename [1024] */
-{
- httpSeparate2(uri, method, 32, username, HTTP_MAX_URI, host, HTTP_MAX_URI,
- port, resource, HTTP_MAX_URI);
-}
-
-
-/*
- * 'httpSeparate2()' - Separate a Universal Resource Identifier into its
- * components.
- */
-
-void
-httpSeparate2(const char *uri, /* I - Universal Resource Identifier */
- char *method, /* O - Method (http, https, etc.) */
- int methodlen, /* I - Size of method buffer */
- char *username, /* O - Username */
- int usernamelen, /* I - Size of username buffer */
- char *host, /* O - Hostname */
- int hostlen, /* I - Size of hostname buffer */
- int *port, /* O - Port number to use */
- char *resource, /* O - Resource/filename */
- int resourcelen) /* I - Size of resource buffer */
-{
- char *ptr; /* Pointer into string... */
- const char *atsign, /* @ sign */
- *slash; /* Separator */
-
-
- /*
- * Range check input...
- */
-
- if (uri == NULL || method == NULL || username == NULL || host == NULL ||
- port == NULL || resource == NULL)
- return;
-
- /*
- * Grab the method portion of the URI...
- */
-
- if (strncmp(uri, "//", 2) == 0)
- {
- /*
- * Workaround for HP IPP client bug...
- */
-
- strlcpy(method, "ipp", methodlen);
- }
- else
- {
- /*
- * Standard URI with method...
- */
-
- uri = http_copy_decode(host, uri, hostlen, ":");
-
- if (*uri == ':')
- uri ++;
-
- /*
- * If the method contains a period or slash, then it's probably
- * hostname/filename...
- */
-
- if (strchr(host, '.') != NULL || strchr(host, '/') != NULL || *uri == '\0')
- {
- if ((ptr = strchr(host, '/')) != NULL)
- {
- strlcpy(resource, ptr, resourcelen);
- *ptr = '\0';
- }
- else
- resource[0] = '\0';
-
- if (isdigit(*uri & 255))
- {
- /*
- * OK, we have "hostname:port[/resource]"...
- */
-
- *port = strtol(uri, (char **)&uri, 10);
-
- if (*uri == '/')
- strlcpy(resource, uri, resourcelen);
- }
- else
- *port = 631;
-
- strlcpy(method, "http", methodlen);
- username[0] = '\0';
- return;
- }
- else
- strlcpy(method, host, methodlen);
- }
-
- /*
- * If the method starts with less than 2 slashes then it is a local resource...
- */
-
- if (strncmp(uri, "//", 2) != 0)
- {
- strlcpy(resource, uri, resourcelen);
-
- username[0] = '\0';
- host[0] = '\0';
- *port = 0;
- return;
- }
-
- /*
- * Grab the username, if any...
- */
-
- uri += 2;
-
- if ((slash = strchr(uri, '/')) == NULL)
- slash = uri + strlen(uri);
-
- if ((atsign = strchr(uri, '@')) != NULL && atsign < slash)
- {
- /*
- * Got a username:password combo...
- */
-
- uri = http_copy_decode(username, uri, usernamelen, "@") + 1;
- }
- else
- username[0] = '\0';
-
- /*
- * Grab the hostname...
- */
-
- uri = http_copy_decode(host, uri, hostlen, ":/");
-
- if (*uri != ':')
- {
- if (strcasecmp(method, "http") == 0)
- *port = 80;
- else if (strcasecmp(method, "https") == 0)
- *port = 443;
- else if (strcasecmp(method, "ipp") == 0)
- *port = 631;
- else if (strcasecmp(method, "lpd") == 0)
- *port = 515;
- else if (strcasecmp(method, "socket") == 0) /* Not registered yet... */
- *port = 9100;
- else
- *port = 0;
- }
- else
- {
- /*
- * Parse port number...
- */
-
- *port = strtol(uri + 1, (char **)&uri, 10);
- }
-
- if (*uri == '\0')
- {
- /*
- * Hostname but no port or path...
- */
-
- resource[0] = '/';
- resource[1] = '\0';
- return;
- }
-
- /*
- * The remaining portion is the resource string...
- */
-
- http_copy_decode(resource, uri, resourcelen, "");
-}
-
-
-/*
- * 'httpStatus()' - Return a short string describing a HTTP status code.
- */
-
-const char * /* O - String or NULL */
-httpStatus(http_status_t status) /* I - HTTP status code */
-{
- switch (status)
- {
- case HTTP_CONTINUE :
- return ("Continue");
- case HTTP_SWITCHING_PROTOCOLS :
- return ("Switching Protocols");
- case HTTP_OK :
- return ("OK");
- case HTTP_CREATED :
- return ("Created");
- case HTTP_ACCEPTED :
- return ("Accepted");
- case HTTP_NO_CONTENT :
- return ("No Content");
- case HTTP_NOT_MODIFIED :
- return ("Not Modified");
- case HTTP_BAD_REQUEST :
- return ("Bad Request");
- case HTTP_UNAUTHORIZED :
- return ("Unauthorized");
- case HTTP_FORBIDDEN :
- return ("Forbidden");
- case HTTP_NOT_FOUND :
- return ("Not Found");
- case HTTP_REQUEST_TOO_LARGE :
- return ("Request Entity Too Large");
- case HTTP_URI_TOO_LONG :
- return ("URI Too Long");
- case HTTP_UPGRADE_REQUIRED :
- return ("Upgrade Required");
- case HTTP_NOT_IMPLEMENTED :
- return ("Not Implemented");
- case HTTP_NOT_SUPPORTED :
- return ("Not Supported");
- default :
- return ("Unknown");
- }
-}
-
-
-#ifndef HAVE_HSTRERROR
-/*
- * 'cups_hstrerror()' - hstrerror() emulation function for Solaris and others...
- */
-
-const char * /* O - Error string */
-cups_hstrerror(int error) /* I - Error number */
-{
- static const char * const errors[] = /* Error strings */
- {
- "OK",
- "Host not found.",
- "Try again.",
- "Unrecoverable lookup error.",
- "No data associated with name."
- };
-
-
- if (error < 0 || error > 4)
- return ("Unknown hostname lookup error.");
- else
- return (errors[error]);
-}
-#endif /* !HAVE_HSTRERROR */
-
-
-/*
- * 'http_copy_decode()' - Copy and decode a URI.
- */
-
-static const char * /* O - New source pointer */
-http_copy_decode(char *dst, /* O - Destination buffer */
- const char *src, /* I - Source pointer */
- int dstsize, /* I - Destination size */
- const char *term) /* I - Terminating characters */
-{
- char *ptr, /* Pointer into buffer */
- *end; /* End of buffer */
- int quoted; /* Quoted character */
-
-
- /*
- * Copy the src to the destination until we hit a terminating character
- * or the end of the string.
- */
-
- for (ptr = dst, end = dst + dstsize - 1; *src && !strchr(term, *src); src ++)
- if (ptr < end)
- {
- if (*src == '%' && isxdigit(src[1] & 255) && isxdigit(src[2] & 255))
- {
- /*
- * Grab a hex-encoded character...
- */
-
- src ++;
- if (isalpha(*src))
- quoted = (tolower(*src) - 'a' + 10) << 4;
- else
- quoted = (*src - '0') << 4;
-
- src ++;
- if (isalpha(*src))
- quoted |= tolower(*src) - 'a' + 10;
- else
- quoted |= *src - '0';
-
- *ptr++ = quoted;
- }
- else
- *ptr++ = *src;
- }
-
- *ptr = '\0';
-
- return (src);
-}
-
-
-/*
- * End of "$Id: http-support.c 148 2006-04-25 16:54:17Z njacobs $"
- */
diff --git a/usr/src/lib/print/libhttp-core/common/http.c b/usr/src/lib/print/libhttp-core/common/http.c
deleted file mode 100644
index b32b1eb3bc..0000000000
--- a/usr/src/lib/print/libhttp-core/common/http.c
+++ /dev/null
@@ -1,2569 +0,0 @@
-/*
- * "$Id: http.c 148 2006-04-25 16:54:17Z njacobs $"
- *
- * HTTP routines for the Common UNIX Printing System (CUPS).
- *
- * Copyright 1997-2005 by Easy Software Products, all rights reserved.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- * httpInitialize() - Initialize the HTTP interface library and set the
- * default HTTP proxy (if any).
- * httpCheck() - Check to see if there is a pending response from
- * the server.
- * httpClearCookie() - Clear the cookie value(s).
- * httpClose() - Close an HTTP connection...
- * httpConnect() - Connect to a HTTP server.
- * httpConnectEncrypt() - Connect to a HTTP server using encryption.
- * httpEncryption() - Set the required encryption on the link.
- * httpReconnect() - Reconnect to a HTTP server...
- * httpGetSubField() - Get a sub-field value.
- * httpSetField() - Set the value of an HTTP header.
- * httpDelete() - Send a DELETE request to the server.
- * httpGet() - Send a GET request to the server.
- * httpHead() - Send a HEAD request to the server.
- * httpOptions() - Send an OPTIONS request to the server.
- * httpPost() - Send a POST request to the server.
- * httpPut() - Send a PUT request to the server.
- * httpTrace() - Send an TRACE request to the server.
- * httpFlush() - Flush data from a HTTP connection.
- * httpRead() - Read data from a HTTP connection.
- * httpSetCookie() - Set the cookie value(s)...
- * httpWait() - Wait for data available on a connection.
- * httpWrite() - Write data to a HTTP connection.
- * httpGets() - Get a line of text from a HTTP connection.
- * httpPrintf() - Print a formatted string to a HTTP connection.
- * httpGetDateString() - Get a formatted date/time string from a time value.
- * httpGetDateTime() - Get a time value from a formatted date/time string.
- * httpUpdate() - Update the current HTTP state for incoming data.
- * httpDecode64() - Base64-decode a string.
- * httpDecode64_2() - Base64-decode a string.
- * httpEncode64() - Base64-encode a string.
- * httpEncode64_2() - Base64-encode a string.
- * httpGetLength() - Get the amount of data remaining from the
- * content-length or transfer-encoding fields.
- * http_field() - Return the field index for a field name.
- * http_send() - Send a request with all fields and the trailing
- * blank line.
- * http_wait() - Wait for data available on a connection.
- * http_upgrade() - Force upgrade to TLS encryption.
- * http_setup_ssl() - Set up SSL/TLS on a connection.
- * http_shutdown_ssl() - Shut down SSL/TLS on a connection.
- * http_read_ssl() - Read from a SSL/TLS connection.
- * http_write_ssl() - Write to a SSL/TLS connection.
- * CDSAReadFunc() - Read function for CDSA decryption code.
- * CDSAWriteFunc() - Write function for CDSA encryption code.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Include necessary headers...
- */
-
-#include "http-private.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include "string.h"
-#include <fcntl.h>
-#include <errno.h>
-
-#include "http.h"
-#include "debug.h"
-
-#ifndef WIN32
-# include <signal.h>
-# include <sys/time.h>
-# include <sys/resource.h>
-#endif /* !WIN32 */
-
-
-/*
- * Some operating systems have done away with the Fxxxx constants for
- * the fcntl() call; this works around that "feature"...
- */
-
-#ifndef FNONBLK
-# define FNONBLK O_NONBLOCK
-#endif /* !FNONBLK */
-
-
-/*
- * Local functions...
- */
-
-static http_field_t http_field(const char *name);
-static int http_send(http_t *http, http_state_t request,
- const char *uri);
-static int http_wait(http_t *http, int msec);
-#ifdef HAVE_SSL
-static int http_upgrade(http_t *http);
-static int http_setup_ssl(http_t *http);
-static void http_shutdown_ssl(http_t *http);
-static int http_read_ssl(http_t *http, char *buf, int len);
-static int http_write_ssl(http_t *http, const char *buf, int len);
-# ifdef HAVE_CDSASSL
-static OSStatus CDSAReadFunc(SSLConnectionRef connection, void *data, size_t *dataLength);
-static OSStatus CDSAWriteFunc(SSLConnectionRef connection, const void *data, size_t *dataLength);
-# endif /* HAVE_CDSASSL */
-#endif /* HAVE_SSL */
-
-
-/*
- * Local globals...
- */
-
-static const char * const http_fields[] =
- {
- "Accept-Language",
- "Accept-Ranges",
- "Authorization",
- "Connection",
- "Content-Encoding",
- "Content-Language",
- "Content-Length",
- "Content-Location",
- "Content-MD5",
- "Content-Range",
- "Content-Type",
- "Content-Version",
- "Date",
- "Host",
- "If-Modified-Since",
- "If-Unmodified-since",
- "Keep-Alive",
- "Last-Modified",
- "Link",
- "Location",
- "Range",
- "Referer",
- "Retry-After",
- "Transfer-Encoding",
- "Upgrade",
- "User-Agent",
- "WWW-Authenticate"
- };
-static const char * const days[7] =
- {
- "Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat"
- };
-static const char * const months[12] =
- {
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec"
- };
-
-void
-httpDumpData(FILE *fp, const char *tag, const char *buffer, int bytes)
-{
- int i, j, ch;
-
- fprintf(fp, "%s %d(0x%x) bytes...\n", tag, bytes, bytes);
- for (i = 0; i < bytes; i += 16) {
- fprintf(fp, "%s ", (tag ? tag : ""));
-
- for (j = 0; j < 16 && (i + j) < bytes; j ++)
- fprintf(fp, " %02X", buffer[i + j] & 255);
-
- while (j < 16) {
- fprintf(fp, " ");
- j++;
- }
-
- fprintf(fp, " ");
- for (j = 0; j < 16 && (i + j) < bytes; j ++) {
- ch = buffer[i + j] & 255;
- if (ch < ' ' || ch == 127)
- ch = '.';
- putc(ch, fp);
- }
- putc('\n', fp);
- }
-}
-
-
-/*
- * 'httpInitialize()' - Initialize the HTTP interface library and set the
- * default HTTP proxy (if any).
- */
-
-void
-httpInitialize(void)
-{
-#ifdef HAVE_LIBSSL
-# ifndef WIN32
- struct timeval curtime; /* Current time in microseconds */
-# endif /* !WIN32 */
- int i; /* Looping var */
- unsigned char data[1024]; /* Seed data */
-#endif /* HAVE_LIBSSL */
-
-#ifdef WIN32
- WSADATA winsockdata; /* WinSock data */
- static int initialized = 0; /* Has WinSock been initialized? */
-
-
- if (!initialized)
- WSAStartup(MAKEWORD(1,1), &winsockdata);
-#elif defined(HAVE_SIGSET)
- sigset(SIGPIPE, SIG_IGN);
-#elif defined(HAVE_SIGACTION)
- struct sigaction action; /* POSIX sigaction data */
-
-
- /*
- * Ignore SIGPIPE signals...
- */
-
- memset(&action, 0, sizeof(action));
- action.sa_handler = SIG_IGN;
- sigaction(SIGPIPE, &action, NULL);
-#else
- signal(SIGPIPE, SIG_IGN);
-#endif /* WIN32 */
-
-#ifdef HAVE_GNUTLS
- gnutls_global_init();
-#endif /* HAVE_GNUTLS */
-
-#ifdef HAVE_LIBSSL
- SSL_load_error_strings();
- SSL_library_init();
-
- /*
- * Using the current time is a dubious random seed, but on some systems
- * it is the best we can do (on others, this seed isn't even used...)
- */
-
-#ifdef WIN32
-#else
- gettimeofday(&curtime, NULL);
- srand(curtime.tv_sec + curtime.tv_usec);
-#endif /* WIN32 */
-
- for (i = 0; i < sizeof(data); i ++)
- data[i] = rand(); /* Yes, this is a poor source of random data... */
-
- RAND_seed(&data, sizeof(data));
-#endif /* HAVE_LIBSSL */
-}
-
-
-/*
- * 'httpCheck()' - Check to see if there is a pending response from the server.
- */
-
-int /* O - 0 = no data, 1 = data available */
-httpCheck(http_t *http) /* I - HTTP connection */
-{
- return (httpWait(http, 0));
-}
-
-
-/*
- * 'httpClearCookie()' - Clear the cookie value(s).
- */
-
-void
-httpClearCookie(http_t *http) /* I - Connection */
-{
- if (!http)
- return;
-
- if (http->cookie)
- {
- free(http->cookie);
- http->cookie = NULL;
- }
-}
-
-
-/*
- * 'httpClose()' - Close an HTTP connection...
- */
-
-void
-httpClose(http_t *http) /* I - Connection to close */
-{
- DEBUG_printf(("httpClose(http=%p)\n", http));
-
- if (!http)
- return;
-
- if (http->input_set)
- free(http->input_set);
-
- if (http->cookie)
- free(http->cookie);
-
-#ifdef HAVE_SSL
- if (http->tls)
- http_shutdown_ssl(http);
-#endif /* HAVE_SSL */
-
-#ifdef WIN32
- closesocket(http->fd);
-#else
- close(http->fd);
-#endif /* WIN32 */
-
- free(http);
-}
-
-
-/*
- * 'httpConnect()' - Connect to a HTTP server.
- */
-
-http_t * /* O - New HTTP connection */
-httpConnect(const char *host, /* I - Host to connect to */
- int port) /* I - Port number */
-{
- http_encryption_t encrypt; /* Type of encryption to use */
-
-
- /*
- * Set the default encryption status...
- */
-
- if (port == 443)
- encrypt = HTTP_ENCRYPT_ALWAYS;
- else
- encrypt = HTTP_ENCRYPT_IF_REQUESTED;
-
- return (httpConnectEncrypt(host, port, encrypt));
-}
-
-
-/*
- * 'httpConnectEncrypt()' - Connect to a HTTP server using encryption.
- */
-
-http_t * /* O - New HTTP connection */
-httpConnectEncrypt(const char *host, /* I - Host to connect to */
- int port, /* I - Port number */
- http_encryption_t encrypt)
- /* I - Type of encryption to use */
-{
- int i; /* Looping var */
- http_t *http; /* New HTTP connection */
- struct hostent *hostaddr; /* Host address data */
-
-
- DEBUG_printf(("httpConnectEncrypt(host=\"%s\", port=%d, encrypt=%d)\n",
- host ? host : "(null)", port, encrypt));
-
- if (!host)
- return (NULL);
-
- httpInitialize();
-
- /*
- * Lookup the host...
- */
-
- if ((hostaddr = httpGetHostByName(host)) == NULL)
- {
- /*
- * This hack to make users that don't have a localhost entry in
- * their hosts file or DNS happy...
- */
-
- if (strcasecmp(host, "localhost") != 0)
- return (NULL);
- else if ((hostaddr = httpGetHostByName("127.0.0.1")) == NULL)
- return (NULL);
- }
-
- /*
- * Verify that it is an IPv4, IPv6, or domain address...
- */
-
- if ((hostaddr->h_addrtype != AF_INET || hostaddr->h_length != 4)
-#ifdef AF_INET6
- && (hostaddr->h_addrtype != AF_INET6 || hostaddr->h_length != 16)
-#endif /* AF_INET6 */
-#ifdef AF_LOCAL
- && (hostaddr->h_addrtype != AF_LOCAL)
-#endif /* AF_LOCAL */
- )
- return (NULL);
-
- /*
- * Allocate memory for the structure...
- */
-
- http = calloc(sizeof(http_t), 1);
- if (http == NULL)
- return (NULL);
-
- http->version = HTTP_1_1;
- http->blocking = 1;
- http->activity = time(NULL);
- http->fd = -1;
-
- /*
- * Set the encryption status...
- */
-
- if (port == 443) /* Always use encryption for https */
- http->encryption = HTTP_ENCRYPT_ALWAYS;
- else
- http->encryption = encrypt;
-
- /*
- * Loop through the addresses we have until one of them connects...
- */
-
- strlcpy(http->hostname, host, sizeof(http->hostname));
-
- for (i = 0; hostaddr->h_addr_list[i]; i ++)
- {
- /*
- * Load the address...
- */
-
- httpAddrLoad(hostaddr, port, i, &(http->hostaddr));
-
- /*
- * Connect to the remote system...
- */
-
- if (!httpReconnect(http))
- return (http);
- }
-
- /*
- * Could not connect to any known address - bail out!
- */
-
- free(http);
- return (NULL);
-}
-
-
-/*
- * 'httpEncryption()' - Set the required encryption on the link.
- */
-
-int /* O - -1 on error, 0 on success */
-httpEncryption(http_t *http, /* I - HTTP data */
- http_encryption_t e) /* I - New encryption preference */
-{
- DEBUG_printf(("httpEncryption(http=%p, e=%d)\n", http, e));
-
-#ifdef HAVE_SSL
- if (!http)
- return (0);
-
- http->encryption = e;
-
- if ((http->encryption == HTTP_ENCRYPT_ALWAYS && !http->tls) ||
- (http->encryption == HTTP_ENCRYPT_NEVER && http->tls))
- return (httpReconnect(http));
- else if (http->encryption == HTTP_ENCRYPT_REQUIRED && !http->tls)
- return (http_upgrade(http));
- else
- return (0);
-#else
- if (e == HTTP_ENCRYPT_ALWAYS || e == HTTP_ENCRYPT_REQUIRED)
- return (-1);
- else
- return (0);
-#endif /* HAVE_SSL */
-}
-
-
-/*
- * 'httpReconnect()' - Reconnect to a HTTP server...
- */
-
-int /* O - 0 on success, non-zero on failure */
-httpReconnect(http_t *http) /* I - HTTP data */
-{
- int val; /* Socket option value */
- int status; /* Connect status */
-
-
- DEBUG_printf(("httpReconnect(http=%p)\n", http));
-
- if (!http)
- return (-1);
-
-#ifdef HAVE_SSL
- if (http->tls)
- http_shutdown_ssl(http);
-#endif /* HAVE_SSL */
-
- /*
- * Close any previously open socket...
- */
-
- if (http->fd >= 0)
-#ifdef WIN32
- closesocket(http->fd);
-#else
- close(http->fd);
-#endif /* WIN32 */
-
- /*
- * Create the socket and set options to allow reuse.
- */
-
- if ((http->fd = socket(http->hostaddr.addr.sa_family, SOCK_STREAM, 0)) < 0)
- {
-#ifdef WIN32
- http->error = WSAGetLastError();
-#else
- http->error = errno;
-#endif /* WIN32 */
- http->status = HTTP_ERROR;
- return (-1);
- }
-
-#ifdef FD_CLOEXEC
- fcntl(http->fd, F_SETFD, FD_CLOEXEC); /* Close this socket when starting *
- * other processes... */
-#endif /* FD_CLOEXEC */
-
- val = 1;
- setsockopt(http->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val));
-
-#ifdef SO_REUSEPORT
- val = 1;
- setsockopt(http->fd, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
-#endif /* SO_REUSEPORT */
-
- /*
- * Using TCP_NODELAY improves responsiveness, especially on systems
- * with a slow loopback interface... Since we write large buffers
- * when sending print files and requests, there shouldn't be any
- * performance penalty for this...
- */
-
- val = 1;
-#ifdef WIN32
- setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
-#else
- setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
-#endif /* WIN32 */
-
- /*
- * Connect to the server...
- */
-
-#ifdef AF_INET6
- if (http->hostaddr.addr.sa_family == AF_INET6)
- status = connect(http->fd, (struct sockaddr *)&(http->hostaddr),
- sizeof(http->hostaddr.ipv6));
- else
-#endif /* AF_INET6 */
-#ifdef AF_LOCAL
- if (http->hostaddr.addr.sa_family == AF_LOCAL)
- status = connect(http->fd, (struct sockaddr *)&(http->hostaddr),
- SUN_LEN(&(http->hostaddr.un)));
- else
-#endif /* AF_LOCAL */
- status = connect(http->fd, (struct sockaddr *)&(http->hostaddr),
- sizeof(http->hostaddr.ipv4));
-
- if (status < 0)
- {
-#ifdef WIN32
- http->error = WSAGetLastError();
-#else
- http->error = errno;
-#endif /* WIN32 */
- http->status = HTTP_ERROR;
-
-#ifdef WIN32
- closesocket(http->fd);
-#else
- close(http->fd);
-#endif
-
- http->fd = -1;
-
- return (-1);
- }
-
- http->error = 0;
- http->status = HTTP_CONTINUE;
-
-#ifdef HAVE_SSL
- if (http->encryption == HTTP_ENCRYPT_ALWAYS)
- {
- /*
- * Always do encryption via SSL.
- */
-
- if (http_setup_ssl(http) != 0)
- {
-#ifdef WIN32
- closesocket(http->fd);
-#else
- close(http->fd);
-#endif /* WIN32 */
-
- return (-1);
- }
- }
- else if (http->encryption == HTTP_ENCRYPT_REQUIRED)
- return (http_upgrade(http));
-#endif /* HAVE_SSL */
-
- return (0);
-}
-
-
-/*
- * 'httpGetSubField()' - Get a sub-field value.
- */
-
-char * /* O - Value or NULL */
-httpGetSubField(http_t *http, /* I - HTTP data */
- http_field_t field, /* I - Field index */
- const char *name, /* I - Name of sub-field */
- char *value) /* O - Value string */
-{
- const char *fptr; /* Pointer into field */
- char temp[HTTP_MAX_VALUE], /* Temporary buffer for name */
- *ptr; /* Pointer into string buffer */
-
-
- DEBUG_printf(("httpGetSubField(http=%p, field=%d, name=\"%s\", value=%p)\n",
- http, field, name, value));
-
- if (http == NULL ||
- field < HTTP_FIELD_ACCEPT_LANGUAGE ||
- field > HTTP_FIELD_WWW_AUTHENTICATE ||
- name == NULL || value == NULL)
- return (NULL);
-
- for (fptr = http->fields[field]; *fptr;)
- {
- /*
- * Skip leading whitespace...
- */
-
- while (isspace(*fptr & 255))
- fptr ++;
-
- if (*fptr == ',')
- {
- fptr ++;
- continue;
- }
-
- /*
- * Get the sub-field name...
- */
-
- for (ptr = temp;
- *fptr && *fptr != '=' && !isspace(*fptr & 255) && ptr < (temp + sizeof(temp) - 1);
- *ptr++ = *fptr++);
-
- *ptr = '\0';
-
- DEBUG_printf(("httpGetSubField: name=\"%s\"\n", temp));
-
- /*
- * Skip trailing chars up to the '='...
- */
-
- while (isspace(*fptr & 255))
- fptr ++;
-
- if (!*fptr)
- break;
-
- if (*fptr != '=')
- continue;
-
- /*
- * Skip = and leading whitespace...
- */
-
- fptr ++;
-
- while (isspace(*fptr & 255))
- fptr ++;
-
- if (*fptr == '\"')
- {
- /*
- * Read quoted string...
- */
-
- for (ptr = value, fptr ++;
- *fptr && *fptr != '\"' && ptr < (value + HTTP_MAX_VALUE - 1);
- *ptr++ = *fptr++);
-
- *ptr = '\0';
-
- while (*fptr && *fptr != '\"')
- fptr ++;
-
- if (*fptr)
- fptr ++;
- }
- else
- {
- /*
- * Read unquoted string...
- */
-
- for (ptr = value;
- *fptr && !isspace(*fptr & 255) && *fptr != ',' && ptr < (value + HTTP_MAX_VALUE - 1);
- *ptr++ = *fptr++);
-
- *ptr = '\0';
-
- while (*fptr && !isspace(*fptr & 255) && *fptr != ',')
- fptr ++;
- }
-
- DEBUG_printf(("httpGetSubField: value=\"%s\"\n", value));
-
- /*
- * See if this is the one...
- */
-
- if (strcmp(name, temp) == 0)
- return (value);
- }
-
- value[0] = '\0';
-
- return (NULL);
-}
-
-
-/*
- * 'httpSetField()' - Set the value of an HTTP header.
- */
-
-void
-httpSetField(http_t *http, /* I - HTTP data */
- http_field_t field, /* I - Field index */
- const char *value) /* I - Value */
-{
- if (http == NULL ||
- field < HTTP_FIELD_ACCEPT_LANGUAGE ||
- field > HTTP_FIELD_WWW_AUTHENTICATE ||
- value == NULL)
- return;
-
- strlcpy(http->fields[field], value, HTTP_MAX_VALUE);
-}
-
-
-/*
- * 'httpDelete()' - Send a DELETE request to the server.
- */
-
-int /* O - Status of call (0 = success) */
-httpDelete(http_t *http, /* I - HTTP data */
- const char *uri) /* I - URI to delete */
-{
- return (http_send(http, HTTP_DELETE, uri));
-}
-
-
-/*
- * 'httpGet()' - Send a GET request to the server.
- */
-
-int /* O - Status of call (0 = success) */
-httpGet(http_t *http, /* I - HTTP data */
- const char *uri) /* I - URI to get */
-{
- return (http_send(http, HTTP_GET, uri));
-}
-
-
-/*
- * 'httpHead()' - Send a HEAD request to the server.
- */
-
-int /* O - Status of call (0 = success) */
-httpHead(http_t *http, /* I - HTTP data */
- const char *uri) /* I - URI for head */
-{
- return (http_send(http, HTTP_HEAD, uri));
-}
-
-
-/*
- * 'httpOptions()' - Send an OPTIONS request to the server.
- */
-
-int /* O - Status of call (0 = success) */
-httpOptions(http_t *http, /* I - HTTP data */
- const char *uri) /* I - URI for options */
-{
- return (http_send(http, HTTP_OPTIONS, uri));
-}
-
-
-/*
- * 'httpPost()' - Send a POST request to the server.
- */
-
-int /* O - Status of call (0 = success) */
-httpPost(http_t *http, /* I - HTTP data */
- const char *uri) /* I - URI for post */
-{
- httpGetLength(http);
-
- return (http_send(http, HTTP_POST, uri));
-}
-
-
-/*
- * 'httpPut()' - Send a PUT request to the server.
- */
-
-int /* O - Status of call (0 = success) */
-httpPut(http_t *http, /* I - HTTP data */
- const char *uri) /* I - URI to put */
-{
- httpGetLength(http);
-
- return (http_send(http, HTTP_PUT, uri));
-}
-
-
-/*
- * 'httpTrace()' - Send an TRACE request to the server.
- */
-
-int /* O - Status of call (0 = success) */
-httpTrace(http_t *http, /* I - HTTP data */
- const char *uri) /* I - URI for trace */
-{
- return (http_send(http, HTTP_TRACE, uri));
-}
-
-
-/*
- * 'httpFlush()' - Flush data from a HTTP connection.
- */
-
-void
-httpFlush(http_t *http) /* I - HTTP data */
-{
- char buffer[8192]; /* Junk buffer */
-
-
- DEBUG_printf(("httpFlush(http=%p), state=%d\n", http, http->state));
-
- while (httpRead(http, buffer, sizeof(buffer)) > 0);
-}
-
-
-/*
- * 'httpRead()' - Read data from a HTTP connection.
- */
-
-int /* O - Number of bytes read */
-httpRead(http_t *http, /* I - HTTP data */
- char *buffer, /* I - Buffer for data */
- int length) /* I - Maximum number of bytes */
-{
- int bytes; /* Bytes read */
- char len[32]; /* Length string */
-
-
- DEBUG_printf(("httpRead(http=%p, buffer=%p, length=%d)\n",
- http, buffer, length));
-
- if (http == NULL || buffer == NULL)
- return (-1);
-
- http->activity = time(NULL);
-
- if (length <= 0)
- return (0);
-
- if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
- http->data_remaining <= 0)
- {
- DEBUG_puts("httpRead: Getting chunk length...");
-
- if (httpGets(len, sizeof(len), http) == NULL)
- {
- DEBUG_puts("httpRead: Could not get length!");
- return (0);
- }
-
- http->data_remaining = strtol(len, NULL, 16);
- if (http->data_remaining < 0)
- {
- DEBUG_puts("httpRead: Negative chunk length!");
- return (0);
- }
- }
-
- DEBUG_printf(("httpRead: data_remaining=%d\n", http->data_remaining));
-
- if (http->data_remaining <= 0)
- {
- /*
- * A zero-length chunk ends a transfer; unless we are reading POST
- * data, go idle...
- */
-
- if (http->data_encoding == HTTP_ENCODE_CHUNKED)
- httpGets(len, sizeof(len), http);
-
- if (http->state == HTTP_POST_RECV)
- http->state ++;
- else
- http->state = HTTP_WAITING;
-
- /*
- * Prevent future reads for this request...
- */
-
- http->data_encoding = HTTP_ENCODE_LENGTH;
-
- return (0);
- }
- else if (length > http->data_remaining)
- length = http->data_remaining;
-
- if (http->used == 0 && length <= 256)
- {
- /*
- * Buffer small reads for better performance...
- */
-
- if (!http->blocking && !httpWait(http, 1000))
- return (0);
-
- if (http->data_remaining > sizeof(http->buffer))
- bytes = sizeof(http->buffer);
- else
- bytes = http->data_remaining;
-
-#ifdef HAVE_SSL
- if (http->tls)
- bytes = http_read_ssl(http, http->buffer, bytes);
- else
-#endif /* HAVE_SSL */
- {
- DEBUG_printf(("httpRead: reading %d bytes from socket into buffer...\n",
- bytes));
-
- bytes = recv(http->fd, http->buffer, bytes, 0);
-
- DEBUG_printf(("httpRead: read %d bytes from socket into buffer...\n",
- bytes));
-#ifdef DEBUG_HTTP
- httpDumpData(stdout, "httpRead:", http->buffer, bytes);
-#endif
- }
-
- if (bytes > 0)
- http->used = bytes;
- else if (bytes < 0)
- {
-#ifdef WIN32
- http->error = WSAGetLastError();
- return (-1);
-#else
- if (errno != EINTR)
- {
- http->error = errno;
- return (-1);
- }
-#endif /* WIN32 */
- }
- else
- {
- http->error = EPIPE;
- return (0);
- }
- }
-
- if (http->used > 0)
- {
- if (length > http->used)
- length = http->used;
-
- bytes = length;
-
- DEBUG_printf(("httpRead: grabbing %d bytes from input buffer...\n", bytes));
-
- memcpy(buffer, http->buffer, length);
- http->used -= length;
-
- if (http->used > 0)
- memmove(http->buffer, http->buffer + length, http->used);
- }
-#ifdef HAVE_SSL
- else if (http->tls)
- {
- if (!http->blocking && !httpWait(http, 1000))
- return (0);
-
- bytes = http_read_ssl(http, buffer, length);
- }
-#endif /* HAVE_SSL */
- else
- {
- if (!http->blocking && !httpWait(http, 1000))
- return (0);
-
- DEBUG_printf(("httpRead: reading %d bytes from socket...\n", length));
-
- while ((bytes = recv(http->fd, buffer, length, 0)) < 0)
- if (errno != EINTR)
- break;
- DEBUG_printf(("httpRead: read %d bytes from socket...\n", bytes));
- }
-#ifdef DEBUG_HTTP
- httpDumpData(stdout, "httpRead:", buffer, bytes);
-#endif
-
- if (bytes > 0)
- http->data_remaining -= bytes;
- else if (bytes < 0)
- {
-#ifdef WIN32
- http->error = WSAGetLastError();
-#else
- if (errno == EINTR)
- bytes = 0;
- else
- http->error = errno;
-#endif /* WIN32 */
- }
- else
- {
- http->error = EPIPE;
- return (0);
- }
-
- if (http->data_remaining == 0)
- {
- if (http->data_encoding == HTTP_ENCODE_CHUNKED)
- httpGets(len, sizeof(len), http);
-
- if (http->data_encoding != HTTP_ENCODE_CHUNKED)
- {
- if (http->state == HTTP_POST_RECV)
- http->state ++;
- else
- http->state = HTTP_WAITING;
- }
- }
-
- return (bytes);
-}
-
-
-/*
- * 'httpSetCookie()' - Set the cookie value(s)...
- */
-
-void
-httpSetCookie(http_t *http, /* I - Connection */
- const char *cookie) /* I - Cookie string */
-{
- if (!http)
- return;
-
- if (http->cookie)
- free(http->cookie);
-
- if (cookie)
- http->cookie = strdup(cookie);
- else
- http->cookie = NULL;
-}
-
-
-/*
- * 'httpWait()' - Wait for data available on a connection.
- */
-
-int /* O - 1 if data is available, 0 otherwise */
-httpWait(http_t *http, /* I - HTTP data */
- int msec) /* I - Milliseconds to wait */
-{
- /*
- * First see if there is data in the buffer...
- */
-
- if (http == NULL)
- return (0);
-
- if (http->used)
- return (1);
-
- /*
- * If not, check the SSL/TLS buffers and do a select() on the connection...
- */
-
- return (http_wait(http, msec));
-}
-
-
-/*
- * 'httpWrite()' - Write data to a HTTP connection.
- */
-
-int /* O - Number of bytes written */
-httpWrite(http_t *http, /* I - HTTP data */
- const char *buffer, /* I - Buffer for data */
- int length) /* I - Number of bytes to write */
-{
- int tbytes, /* Total bytes sent */
- bytes; /* Bytes sent */
-
-
- if (http == NULL || buffer == NULL)
- return (-1);
-
- http->activity = time(NULL);
-
- if (http->data_encoding == HTTP_ENCODE_CHUNKED)
- {
- if (httpPrintf(http, "%x\r\n", length) < 0)
- return (-1);
-
- if (length == 0)
- {
- /*
- * A zero-length chunk ends a transfer; unless we are sending POST
- * or PUT data, go idle...
- */
-
- DEBUG_printf(("httpWrite: changing states from %d", http->state));
-
- if (http->state == HTTP_POST_RECV)
- http->state ++;
- else if (http->state == HTTP_PUT_RECV)
- http->state = HTTP_STATUS;
- else
- http->state = HTTP_WAITING;
- DEBUG_printf((" to %d\n", http->state));
-
- if (httpPrintf(http, "\r\n") < 0)
- return (-1);
-
- return (0);
- }
- }
-
- tbytes = 0;
-
- while (length > 0)
- {
-#ifdef HAVE_SSL
- if (http->tls)
- bytes = http_write_ssl(http, buffer, length);
- else
-#endif /* HAVE_SSL */
- bytes = send(http->fd, buffer, length, 0);
-
-#ifdef DEBUG_HTTP
- if (bytes >= 0)
- httpDumpData(stdout, "httpWrite:", buffer, bytes);
-#endif /* DEBUG */
-
-
- if (bytes < 0)
- {
-#ifdef WIN32
- if (WSAGetLastError() != http->error)
- {
- http->error = WSAGetLastError();
- continue;
- }
-#else
- if (errno == EINTR)
- continue;
- else if (errno != http->error && errno != ECONNRESET)
- {
- http->error = errno;
- continue;
- }
-#endif /* WIN32 */
-
- DEBUG_puts("httpWrite: error writing data...\n");
-
- return (-1);
- }
-
- buffer += bytes;
- tbytes += bytes;
- length -= bytes;
- if (http->data_encoding == HTTP_ENCODE_LENGTH)
- http->data_remaining -= bytes;
- }
-
- if (http->data_encoding == HTTP_ENCODE_CHUNKED)
- if (httpPrintf(http, "\r\n") < 0)
- return (-1);
-
- if (http->data_remaining == 0 && http->data_encoding == HTTP_ENCODE_LENGTH)
- {
- /*
- * Finished with the transfer; unless we are sending POST or PUT
- * data, go idle...
- */
-
- DEBUG_printf(("httpWrite: changing states from %d", http->state));
-
- if (http->state == HTTP_POST_RECV)
- http->state ++;
- else if (http->state == HTTP_PUT_RECV)
- http->state = HTTP_STATUS;
- else
- http->state = HTTP_WAITING;
-
- DEBUG_printf((" to %d\n", http->state));
- }
-
- return (tbytes);
-}
-
-
-/*
- * 'httpGets()' - Get a line of text from a HTTP connection.
- */
-
-char * /* O - Line or NULL */
-httpGets(char *line, /* I - Line to read into */
- int length, /* I - Max length of buffer */
- http_t *http) /* I - HTTP data */
-{
- char *lineptr, /* Pointer into line */
- *bufptr, /* Pointer into input buffer */
- *bufend; /* Pointer to end of buffer */
- int bytes; /* Number of bytes read */
-
-
- DEBUG_printf(("httpGets(line=%p, length=%d, http=%p)\n", line, length, http));
-
- if (http == NULL || line == NULL)
- return (NULL);
-
- /*
- * Pre-scan the buffer and see if there is a newline in there...
- */
-
-#ifdef WIN32
- WSASetLastError(0);
-#else
- errno = 0;
-#endif /* WIN32 */
-
- do
- {
- bufptr = http->buffer;
- bufend = http->buffer + http->used;
-
- while (bufptr < bufend)
- if (*bufptr == 0x0a)
- break;
- else
- bufptr ++;
-
- if (bufptr >= bufend && http->used < HTTP_MAX_BUFFER)
- {
- /*
- * No newline; see if there is more data to be read...
- */
-
- if (!http->blocking && !http_wait(http, 1000))
- return (NULL);
-
-#ifdef HAVE_SSL
- if (http->tls)
- bytes = http_read_ssl(http, bufend, HTTP_MAX_BUFFER - http->used);
- else
-#endif /* HAVE_SSL */
- bytes = recv(http->fd, bufend, HTTP_MAX_BUFFER - http->used, 0);
-
- DEBUG_printf(("httpGets: read %d bytes...\n", bytes));
-#ifdef DEBUG_HTTP
- httpDumpData(stdout, "httpGets:", bufend, bytes);
-#endif
-
- if (bytes < 0)
- {
- /*
- * Nope, can't get a line this time...
- */
-
-#ifdef WIN32
- if (WSAGetLastError() != http->error)
- {
- http->error = WSAGetLastError();
- continue;
- }
-
- DEBUG_printf(("httpGets: recv() error %d!\n", WSAGetLastError()));
-#else
- DEBUG_printf(("httpGets: recv() error %d!\n", errno));
-
- if (errno == EINTR)
- continue;
- else if (errno != http->error)
- {
- http->error = errno;
- continue;
- }
-#endif /* WIN32 */
-
- return (NULL);
- }
- else if (bytes == 0)
- {
- http->error = EPIPE;
-
- return (NULL);
- }
-
- /*
- * Yup, update the amount used and the end pointer...
- */
-
- http->used += bytes;
- bufend += bytes;
- bufptr = bufend;
- }
- }
- while (bufptr >= bufend && http->used < HTTP_MAX_BUFFER);
-
- http->activity = time(NULL);
-
- /*
- * Read a line from the buffer...
- */
-
- lineptr = line;
- bufptr = http->buffer;
- bytes = 0;
- length --;
-
- while (bufptr < bufend && bytes < length)
- {
- bytes ++;
-
- if (*bufptr == 0x0a)
- {
- bufptr ++;
- break;
- }
- else if (*bufptr == 0x0d)
- bufptr ++;
- else
- *lineptr++ = *bufptr++;
- }
-
- if (bytes > 0)
- {
- *lineptr = '\0';
-
- http->used -= bytes;
- if (http->used > 0)
- memmove(http->buffer, bufptr, http->used);
-
- DEBUG_printf(("httpGets: Returning \"%s\"\n", line));
- return (line);
- }
-
- DEBUG_puts("httpGets: No new line available!");
-
- return (NULL);
-}
-
-
-/*
- * 'httpPrintf()' - Print a formatted string to a HTTP connection.
- */
-
-int /* O - Number of bytes written */
-httpPrintf(http_t *http, /* I - HTTP data */
- const char *format, /* I - printf-style format string */
- ...) /* I - Additional args as needed */
-{
- int bytes, /* Number of bytes to write */
- nbytes, /* Number of bytes written */
- tbytes; /* Number of bytes all together */
- char buf[HTTP_MAX_BUFFER], /* Buffer for formatted string */
- *bufptr; /* Pointer into buffer */
- va_list ap; /* Variable argument pointer */
-
-
- DEBUG_printf(("httpPrintf: httpPrintf(http=%p, format=\"%s\", ...)\n", http, format));
-
- va_start(ap, format);
- bytes = vsnprintf(buf, sizeof(buf), format, ap);
- va_end(ap);
-
- DEBUG_printf(("httpPrintf: %s", buf));
-
- for (tbytes = 0, bufptr = buf; tbytes < bytes; tbytes += nbytes, bufptr += nbytes)
- {
-#ifdef HAVE_SSL
- if (http->tls)
- nbytes = http_write_ssl(http, bufptr, bytes - tbytes);
- else
-#endif /* HAVE_SSL */
- nbytes = send(http->fd, bufptr, bytes - tbytes, 0);
-
-#ifdef DEBUG_HTTP
- if (nbytes >= 0)
- httpDumpData(stdout, "httpPrintf:", bufptr, nbytes);
-#endif
-
- if (nbytes < 0)
- {
- nbytes = 0;
-
-#ifdef WIN32
- if (WSAGetLastError() != http->error)
- {
- http->error = WSAGetLastError();
- continue;
- }
-#else
- if (errno == EINTR)
- continue;
- else if (errno != http->error)
- {
- http->error = errno;
- continue;
- }
-#endif /* WIN32 */
-
- return (-1);
- }
- }
-
- return (bytes);
-}
-
-
-/*
- * 'httpGetDateString()' - Get a formatted date/time string from a time value.
- */
-
-const char * /* O - Date/time string */
-httpGetDateString(time_t t) /* I - UNIX time */
-{
- struct tm *tdate;
- static char datetime[256];
-
-
- tdate = gmtime(&t);
- snprintf(datetime, sizeof(datetime), "%s, %02d %s %d %02d:%02d:%02d GMT",
- days[tdate->tm_wday], tdate->tm_mday, months[tdate->tm_mon],
- tdate->tm_year + 1900, tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
-
- return (datetime);
-}
-
-
-/*
- * 'httpGetDateTime()' - Get a time value from a formatted date/time string.
- */
-
-time_t /* O - UNIX time */
-httpGetDateTime(const char *s) /* I - Date/time string */
-{
- int i; /* Looping var */
- struct tm tdate; /* Time/date structure */
- char mon[16]; /* Abbreviated month name */
- int day, year; /* Day of month and year */
- int hour, min, sec; /* Time */
-
-
- if (sscanf(s, "%*s%d%15s%d%d:%d:%d", &day, mon, &year, &hour, &min, &sec) < 6)
- return (0);
-
- for (i = 0; i < 12; i ++)
- if (strcasecmp(mon, months[i]) == 0)
- break;
-
- if (i >= 12)
- return (0);
-
- tdate.tm_mon = i;
- tdate.tm_mday = day;
- tdate.tm_year = year - 1900;
- tdate.tm_hour = hour;
- tdate.tm_min = min;
- tdate.tm_sec = sec;
- tdate.tm_isdst = 0;
-
- return (mktime(&tdate));
-}
-
-
-/*
- * 'httpUpdate()' - Update the current HTTP state for incoming data.
- */
-
-http_status_t /* O - HTTP status */
-httpUpdate(http_t *http) /* I - HTTP data */
-{
- char line[1024], /* Line from connection... */
- *value; /* Pointer to value on line */
- http_field_t field; /* Field index */
- int major, minor, /* HTTP version numbers */
- status; /* Request status */
-
-
- DEBUG_printf(("httpUpdate(http=%p), state=%d\n", http, http->state));
-
- /*
- * If we haven't issued any commands, then there is nothing to "update"...
- */
-
- if (http->state == HTTP_WAITING)
- return (HTTP_CONTINUE);
-
- /*
- * Grab all of the lines we can from the connection...
- */
-
- line[0] = '\0';
- while (httpGets(line, sizeof(line), http) != NULL)
- {
- DEBUG_printf(("httpUpdate: Got \"%s\"\n", line));
-
- if (line[0] == '\0')
- {
- /*
- * Blank line means the start of the data section (if any). Return
- * the result code, too...
- *
- * If we get status 100 (HTTP_CONTINUE), then we *don't* change states.
- * Instead, we just return HTTP_CONTINUE to the caller and keep on
- * tryin'...
- */
-
- if (http->status == HTTP_CONTINUE)
- return (http->status);
-
- if (http->status < HTTP_BAD_REQUEST)
- http->digest_tries = 0;
-
-#ifdef HAVE_SSL
- if (http->status == HTTP_SWITCHING_PROTOCOLS && !http->tls)
- {
- if (http_setup_ssl(http) != 0)
- {
-# ifdef WIN32
- closesocket(http->fd);
-# else
- close(http->fd);
-# endif /* WIN32 */
-
- return (HTTP_ERROR);
- }
-
- return (HTTP_CONTINUE);
- }
-#endif /* HAVE_SSL */
-
- httpGetLength(http);
-
- switch (http->state)
- {
- case HTTP_GET :
- case HTTP_POST :
- case HTTP_POST_RECV :
- case HTTP_PUT :
- http->state ++;
- case HTTP_POST_SEND :
- break;
-
- default :
- http->state = HTTP_WAITING;
- break;
- }
-
- return (http->status);
- }
- else if (strncmp(line, "HTTP/", 5) == 0)
- {
- /*
- * Got the beginning of a response...
- */
-
- if (sscanf(line, "HTTP/%d.%d%d", &major, &minor, &status) != 3)
- return (HTTP_ERROR);
-
- http->version = (http_version_t)(major * 100 + minor);
- http->status = (http_status_t)status;
- }
- else if ((value = strchr(line, ':')) != NULL)
- {
- /*
- * Got a value...
- */
-
- *value++ = '\0';
- while (isspace(*value & 255))
- value ++;
-
- /*
- * Be tolerants of servers that send unknown attribute fields...
- */
-
- if (!strcasecmp(line, "expect"))
- {
- /*
- * "Expect: 100-continue" or similar...
- */
-
- http->expect = (http_status_t)atoi(value);
- }
- else if (!strcasecmp(line, "cookie"))
- {
- /*
- * "Cookie: name=value[; name=value ...]" - replaces previous cookies...
- */
-
- httpSetCookie(http, value);
- }
- else if ((field = http_field(line)) == HTTP_FIELD_UNKNOWN)
- {
- DEBUG_printf(("httpUpdate: unknown field %s seen!\n", line));
- continue;
- }
- else
- httpSetField(http, field, value);
- }
- else
- {
- http->status = HTTP_ERROR;
- return (HTTP_ERROR);
- }
- }
-
- /*
- * See if there was an error...
- */
-
- if (http->error == EPIPE && http->status > HTTP_CONTINUE)
- return (http->status);
-
- if (http->error)
- {
- DEBUG_printf(("httpUpdate: socket error %d - %s\n", http->error,
- strerror(http->error)));
- http->status = HTTP_ERROR;
- return (HTTP_ERROR);
- }
-
- /*
- * If we haven't already returned, then there is nothing new...
- */
-
- return (HTTP_CONTINUE);
-}
-
-
-/*
- * 'httpDecode64()' - Base64-decode a string.
- */
-
-char * /* O - Decoded string */
-httpDecode64(char *out, /* I - String to write to */
- const char *in) /* I - String to read from */
-{
- int outlen; /* Output buffer length */
-
-
- /*
- * Use the old maximum buffer size for binary compatibility...
- */
-
- outlen = 512;
-
- return (httpDecode64_2(out, &outlen, in));
-}
-
-
-/*
- * 'httpDecode64_2()' - Base64-decode a string.
- */
-
-char * /* O - Decoded string */
-httpDecode64_2(char *out, /* I - String to write to */
- int *outlen, /* IO - Size of output string */
- const char *in) /* I - String to read from */
-{
- int pos, /* Bit position */
- base64; /* Value of this character */
- char *outptr, /* Output pointer */
- *outend; /* End of output buffer */
-
-
- /*
- * Range check input...
- */
-
- if (!out || !outlen || *outlen < 1 || !in || !*in)
- return (NULL);
-
- /*
- * Convert from base-64 to bytes...
- */
-
- for (outptr = out, outend = out + *outlen - 1, pos = 0; *in != '\0'; in ++)
- {
- /*
- * Decode this character into a number from 0 to 63...
- */
-
- if (*in >= 'A' && *in <= 'Z')
- base64 = *in - 'A';
- else if (*in >= 'a' && *in <= 'z')
- base64 = *in - 'a' + 26;
- else if (*in >= '0' && *in <= '9')
- base64 = *in - '0' + 52;
- else if (*in == '+')
- base64 = 62;
- else if (*in == '/')
- base64 = 63;
- else if (*in == '=')
- break;
- else
- continue;
-
- /*
- * Store the result in the appropriate chars...
- */
-
- switch (pos)
- {
- case 0 :
- if (outptr < outend)
- *outptr = base64 << 2;
- pos ++;
- break;
- case 1 :
- if (outptr < outend)
- *outptr++ |= (base64 >> 4) & 3;
- if (outptr < outend)
- *outptr = (base64 << 4) & 255;
- pos ++;
- break;
- case 2 :
- if (outptr < outend)
- *outptr++ |= (base64 >> 2) & 15;
- if (outptr < outend)
- *outptr = (base64 << 6) & 255;
- pos ++;
- break;
- case 3 :
- if (outptr < outend)
- *outptr++ |= base64;
- pos = 0;
- break;
- }
- }
-
- *outptr = '\0';
-
- /*
- * Return the decoded string and size...
- */
-
- *outlen = (int)(outptr - out);
-
- return (out);
-}
-
-
-/*
- * 'httpEncode64()' - Base64-encode a string.
- */
-
-char * /* O - Encoded string */
-httpEncode64(char *out, /* I - String to write to */
- const char *in) /* I - String to read from */
-{
- return (httpEncode64_2(out, 512, in, strlen(in)));
-}
-
-
-/*
- * 'httpEncode64_2()' - Base64-encode a string.
- */
-
-char * /* O - Encoded string */
-httpEncode64_2(char *out, /* I - String to write to */
- int outlen, /* I - Size of output string */
- const char *in, /* I - String to read from */
- int inlen) /* I - Size of input string */
-{
- char *outptr, /* Output pointer */
- *outend; /* End of output buffer */
- static const char base64[] = /* Base64 characters... */
- {
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789"
- "+/"
- };
-
-
- /*
- * Range check input...
- */
-
- if (!out || outlen < 1 || !in || inlen < 1)
- return (NULL);
-
- /*
- * Convert bytes to base-64...
- */
-
- for (outptr = out, outend = out + outlen - 1; inlen > 0; in ++, inlen --)
- {
- /*
- * Encode the up to 3 characters as 4 Base64 numbers...
- */
-
- if (outptr < outend)
- *outptr ++ = base64[(in[0] & 255) >> 2];
- if (outptr < outend)
- *outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63];
-
- in ++;
- inlen --;
- if (inlen <= 0)
- {
- if (outptr < outend)
- *outptr ++ = '=';
- if (outptr < outend)
- *outptr ++ = '=';
- break;
- }
-
- if (outptr < outend)
- *outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63];
-
- in ++;
- inlen --;
- if (inlen <= 0)
- {
- if (outptr < outend)
- *outptr ++ = '=';
- break;
- }
-
- if (outptr < outend)
- *outptr ++ = base64[in[0] & 63];
- }
-
- *outptr = '\0';
-
- /*
- * Return the encoded string...
- */
-
- return (out);
-}
-
-
-/*
- * 'httpGetLength()' - Get the amount of data remaining from the
- * content-length or transfer-encoding fields.
- */
-
-int /* O - Content length */
-httpGetLength(http_t *http) /* I - HTTP data */
-{
- DEBUG_printf(("httpGetLength(http=%p), state=%d\n", http, http->state));
-
- if (strcasecmp(http->fields[HTTP_FIELD_TRANSFER_ENCODING], "chunked") == 0)
- {
- DEBUG_puts("httpGetLength: chunked request!");
-
- http->data_encoding = HTTP_ENCODE_CHUNKED;
- http->data_remaining = 0;
- }
- else
- {
- http->data_encoding = HTTP_ENCODE_LENGTH;
-
- /*
- * The following is a hack for HTTP servers that don't send a
- * content-length or transfer-encoding field...
- *
- * If there is no content-length then the connection must close
- * after the transfer is complete...
- */
-
- if (http->fields[HTTP_FIELD_CONTENT_LENGTH][0] == '\0')
- http->data_remaining = 2147483647;
- else
- http->data_remaining = atoi(http->fields[HTTP_FIELD_CONTENT_LENGTH]);
-
- DEBUG_printf(("httpGetLength: content_length=%d\n", http->data_remaining));
- }
-
- return (http->data_remaining);
-}
-
-
-/*
- * 'http_field()' - Return the field index for a field name.
- */
-
-static http_field_t /* O - Field index */
-http_field(const char *name) /* I - String name */
-{
- int i; /* Looping var */
-
-
- for (i = 0; i < HTTP_FIELD_MAX; i ++)
- if (strcasecmp(name, http_fields[i]) == 0)
- return ((http_field_t)i);
-
- return (HTTP_FIELD_UNKNOWN);
-}
-
-
-/*
- * 'http_send()' - Send a request with all fields and the trailing blank line.
- */
-
-static int /* O - 0 on success, non-zero on error */
-http_send(http_t *http, /* I - HTTP data */
- http_state_t request, /* I - Request code */
- const char *uri) /* I - URI */
-{
- int i; /* Looping var */
- char *ptr, /* Pointer in buffer */
- buf[1024]; /* Encoded URI buffer */
- static const char * const codes[] =
- { /* Request code strings */
- NULL,
- "OPTIONS",
- "GET",
- NULL,
- "HEAD",
- "POST",
- NULL,
- NULL,
- "PUT",
- NULL,
- "DELETE",
- "TRACE",
- "CLOSE"
- };
- static const char hex[] = "0123456789ABCDEF";
- /* Hex digits */
-
-
- DEBUG_printf(("http_send(http=%p, request=HTTP_%s, uri=\"%s\")\n",
- http, codes[request], uri));
-
- if (http == NULL || uri == NULL)
- return (-1);
-
- /*
- * Encode the URI as needed...
- */
-
- for (ptr = buf; *uri != '\0' && ptr < (buf + sizeof(buf) - 1); uri ++)
- if (*uri <= ' ' || *uri >= 127)
- {
- if (ptr < (buf + sizeof(buf) - 1))
- *ptr ++ = '%';
- if (ptr < (buf + sizeof(buf) - 1))
- *ptr ++ = hex[(*uri >> 4) & 15];
- if (ptr < (buf + sizeof(buf) - 1))
- *ptr ++ = hex[*uri & 15];
- }
- else
- *ptr ++ = *uri;
-
- *ptr = '\0';
-
- /*
- * See if we had an error the last time around; if so, reconnect...
- */
-
- if (http->status == HTTP_ERROR || http->status >= HTTP_BAD_REQUEST)
- httpReconnect(http);
-
- /*
- * Send the request header...
- */
-
- http->state = request;
- if (request == HTTP_POST || request == HTTP_PUT)
- http->state ++;
-
- http->status = HTTP_CONTINUE;
-
-#ifdef HAVE_SSL
- if (http->encryption == HTTP_ENCRYPT_REQUIRED && !http->tls)
- {
- httpSetField(http, HTTP_FIELD_CONNECTION, "Upgrade");
- httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.0,SSL/2.0,SSL/3.0");
- }
-#endif /* HAVE_SSL */
-
- if (httpPrintf(http, "%s %s HTTP/1.1\r\n", codes[request], buf) < 1)
- {
- http->status = HTTP_ERROR;
- return (-1);
- }
-
- for (i = 0; i < HTTP_FIELD_MAX; i ++)
- if (http->fields[i][0] != '\0')
- {
- DEBUG_printf(("%s: %s\n", http_fields[i], http->fields[i]));
-
- if (httpPrintf(http, "%s: %s\r\n", http_fields[i], http->fields[i]) < 1)
- {
- http->status = HTTP_ERROR;
- return (-1);
- }
- }
-
- if (httpPrintf(http, "\r\n") < 1)
- {
- http->status = HTTP_ERROR;
- return (-1);
- }
-
- httpClearFields(http);
-
- return (0);
-}
-
-
-/*
- * 'http_wait()' - Wait for data available on a connection.
- */
-
-static int /* O - 1 if data is available, 0 otherwise */
-http_wait(http_t *http, /* I - HTTP data */
- int msec) /* I - Milliseconds to wait */
-{
-#ifndef WIN32
- struct rlimit limit; /* Runtime limit */
-#endif /* !WIN32 */
- struct timeval timeout; /* Timeout */
- int nfds; /* Result from select() */
- int set_size; /* Size of select set */
-
-
- DEBUG_printf(("http_wait(http=%p, msec=%d)\n", http, msec));
-
- /*
- * Check the SSL/TLS buffers for data first...
- */
-
-#ifdef HAVE_SSL
- if (http->tls)
- {
-# ifdef HAVE_LIBSSL
- if (SSL_pending((SSL *)(http->tls)))
- return (1);
-# elif defined(HAVE_GNUTLS)
- if (gnutls_record_check_pending(((http_tls_t *)(http->tls))->session))
- return (1);
-# elif defined(HAVE_CDSASSL)
- size_t bytes; /* Bytes that are available */
-
- if (!SSLGetBufferedReadSize((SSLContextRef)http->tls, &bytes) && bytes > 0)
- return;
-# endif /* HAVE_LIBSSL */
- }
-#endif /* HAVE_SSL */
-
- /*
- * Then try doing a select() to poll the socket...
- */
-
- if (!http->input_set)
- {
-#ifdef WIN32
- /*
- * Windows has a fixed-size select() structure, different (surprise,
- * surprise!) from all UNIX implementations. Just allocate this
- * fixed structure...
- */
-
- http->input_set = calloc(1, sizeof(fd_set));
-#else
- /*
- * Allocate the select() input set based upon the max number of file
- * descriptors available for this process...
- */
-
- getrlimit(RLIMIT_NOFILE, &limit);
-
- set_size = (limit.rlim_cur + 31) / 8 + 4;
- if (set_size < sizeof(fd_set))
- set_size = sizeof(fd_set);
-
- http->input_set = calloc(1, set_size);
-#endif /* WIN32 */
-
- if (!http->input_set)
- return (0);
- }
-
- do
- {
- FD_SET(http->fd, http->input_set);
-
- if (msec >= 0)
- {
- timeout.tv_sec = msec / 1000;
- timeout.tv_usec = (msec % 1000) * 1000;
-
- nfds = select(http->fd + 1, http->input_set, NULL, NULL, &timeout);
- }
- else
- nfds = select(http->fd + 1, http->input_set, NULL, NULL, NULL);
- }
-#ifdef WIN32
- while (nfds < 0 && WSAGetLastError() == WSAEINTR);
-#else
- while (nfds < 0 && errno == EINTR);
-#endif /* WIN32 */
-
- FD_CLR(http->fd, http->input_set);
-
- return (nfds > 0);
-}
-
-
-#ifdef HAVE_SSL
-/*
- * 'http_upgrade()' - Force upgrade to TLS encryption.
- */
-
-static int /* O - Status of connection */
-http_upgrade(http_t *http) /* I - HTTP data */
-{
- int ret; /* Return value */
- http_t myhttp; /* Local copy of HTTP data */
-
-
- DEBUG_printf(("http_upgrade(%p)\n", http));
-
- /*
- * Copy the HTTP data to a local variable so we can do the OPTIONS
- * request without interfering with the existing request data...
- */
-
- memcpy(&myhttp, http, sizeof(myhttp));
-
- /*
- * Send an OPTIONS request to the server, requiring SSL or TLS
- * encryption on the link...
- */
-
- httpClearFields(&myhttp);
- httpSetField(&myhttp, HTTP_FIELD_CONNECTION, "upgrade");
- httpSetField(&myhttp, HTTP_FIELD_UPGRADE, "TLS/1.0, SSL/2.0, SSL/3.0");
-
- if ((ret = httpOptions(&myhttp, "*")) == 0)
- {
- /*
- * Wait for the secure connection...
- */
-
- while (httpUpdate(&myhttp) == HTTP_CONTINUE);
- }
-
- httpFlush(&myhttp);
-
- /*
- * Copy the HTTP data back over, if any...
- */
-
- http->fd = myhttp.fd;
- http->error = myhttp.error;
- http->activity = myhttp.activity;
- http->status = myhttp.status;
- http->version = myhttp.version;
- http->keep_alive = myhttp.keep_alive;
- http->used = myhttp.used;
-
- if (http->used)
- memcpy(http->buffer, myhttp.buffer, http->used);
-
- http->auth_type = myhttp.auth_type;
- http->nonce_count = myhttp.nonce_count;
-
- memcpy(http->nonce, myhttp.nonce, sizeof(http->nonce));
-
- http->tls = myhttp.tls;
- http->encryption = myhttp.encryption;
-
- /*
- * See if we actually went secure...
- */
-
- if (!http->tls)
- {
- /*
- * Server does not support HTTP upgrade...
- */
-
- DEBUG_puts("Server does not support HTTP upgrade!");
-
-# ifdef WIN32
- closesocket(http->fd);
-# else
- close(http->fd);
-# endif
-
- http->fd = -1;
-
- return (-1);
- }
- else
- return (ret);
-}
-
-
-/*
- * 'http_setup_ssl()' - Set up SSL/TLS support on a connection.
- */
-
-static int /* O - Status of connection */
-http_setup_ssl(http_t *http) /* I - HTTP data */
-{
-# ifdef HAVE_LIBSSL
- SSL_CTX *context; /* Context for encryption */
- SSL *conn; /* Connection for encryption */
-# elif defined(HAVE_GNUTLS)
- http_tls_t *conn; /* TLS session object */
- gnutls_certificate_client_credentials *credentials;
- /* TLS credentials */
-# elif defined(HAVE_CDSASSL)
- SSLContextRef conn; /* Context for encryption */
- OSStatus error; /* Error info */
-# endif /* HAVE_LIBSSL */
-
-
- DEBUG_printf(("http_setup_ssl(http=%p)\n", http));
-
-# ifdef HAVE_LIBSSL
- context = SSL_CTX_new(SSLv23_client_method());
-
- SSL_CTX_set_options(context, SSL_OP_NO_SSLv2); /* Only use SSLv3 or TLS */
-
- conn = SSL_new(context);
-
- SSL_set_fd(conn, http->fd);
- if (SSL_connect(conn) != 1)
- {
-# ifdef DEBUG
- unsigned long error; /* Error code */
-
- while ((error = ERR_get_error()) != 0)
- printf("http_setup_ssl: %s\n", ERR_error_string(error, NULL));
-# endif /* DEBUG */
-
- SSL_CTX_free(context);
- SSL_free(conn);
-
-# ifdef WIN32
- http->error = WSAGetLastError();
-# else
- http->error = errno;
-# endif /* WIN32 */
- http->status = HTTP_ERROR;
-
- return (HTTP_ERROR);
- }
-
-# elif defined(HAVE_GNUTLS)
- conn = (http_tls_t *)malloc(sizeof(http_tls_t));
-
- if (conn == NULL)
- {
- http->error = errno;
- http->status = HTTP_ERROR;
-
- return (-1);
- }
-
- credentials = (gnutls_certificate_client_credentials *)
- malloc(sizeof(gnutls_certificate_client_credentials));
- if (credentials == NULL)
- {
- free(conn);
-
- http->error = errno;
- http->status = HTTP_ERROR;
-
- return (-1);
- }
-
- gnutls_certificate_allocate_credentials(credentials);
-
- gnutls_init(&(conn->session), GNUTLS_CLIENT);
- gnutls_set_default_priority(conn->session);
- gnutls_credentials_set(conn->session, GNUTLS_CRD_CERTIFICATE, *credentials);
- gnutls_transport_set_ptr(conn->session, http->fd);
-
- if ((gnutls_handshake(conn->session)) != GNUTLS_E_SUCCESS)
- {
- http->error = errno;
- http->status = HTTP_ERROR;
-
- return (-1);
- }
-
- conn->credentials = credentials;
-
-# elif defined(HAVE_CDSASSL)
- error = SSLNewContext(false, &conn);
-
- if (!error)
- error = SSLSetIOFuncs(conn, CDSAReadFunc, CDSAWriteFunc);
-
- if (!error)
- error = SSLSetConnection(conn, (SSLConnectionRef)http->fd);
-
- if (!error)
- error = SSLSetAllowsExpiredCerts(conn, true);
-
- if (!error)
- error = SSLSetAllowsAnyRoot(conn, true);
-
- if (!error)
- error = SSLHandshake(conn);
-
- if (error != 0)
- {
- http->error = error;
- http->status = HTTP_ERROR;
-
- SSLDisposeContext(conn);
-
- close(http->fd);
-
- return (-1);
- }
-# endif /* HAVE_CDSASSL */
-
- http->tls = conn;
- return (0);
-}
-
-
-/*
- * 'http_shutdown_ssl()' - Shut down SSL/TLS on a connection.
- */
-
-static void
-http_shutdown_ssl(http_t *http) /* I - HTTP data */
-{
-# ifdef HAVE_LIBSSL
- SSL_CTX *context; /* Context for encryption */
- SSL *conn; /* Connection for encryption */
-
-
- conn = (SSL *)(http->tls);
- context = SSL_get_SSL_CTX(conn);
-
- SSL_shutdown(conn);
- SSL_CTX_free(context);
- SSL_free(conn);
-
-# elif defined(HAVE_GNUTLS)
- http_tls_t *conn; /* Encryption session */
- gnutls_certificate_client_credentials *credentials;
- /* TLS credentials */
-
-
- conn = (http_tls_t *)(http->tls);
- credentials = (gnutls_certificate_client_credentials *)(conn->credentials);
-
- gnutls_bye(conn->session, GNUTLS_SHUT_RDWR);
- gnutls_deinit(conn->session);
- gnutls_certificate_free_credentials(*credentials);
- free(credentials);
- free(conn);
-
-# elif defined(HAVE_CDSASSL)
- SSLClose((SSLContextRef)http->tls);
- SSLDisposeContext((SSLContextRef)http->tls);
-# endif /* HAVE_LIBSSL */
-
- http->tls = NULL;
-}
-
-
-/*
- * 'http_read_ssl()' - Read from a SSL/TLS connection.
- */
-
-static int /* O - Bytes read */
-http_read_ssl(http_t *http, /* I - HTTP data */
- char *buf, /* I - Buffer to store data */
- int len) /* I - Length of buffer */
-{
-# if defined(HAVE_LIBSSL)
- return (SSL_read((SSL *)(http->tls), buf, len));
-
-# elif defined(HAVE_GNUTLS)
- return (gnutls_record_recv(((http_tls_t *)(http->tls))->session, buf, len));
-
-# elif defined(HAVE_CDSASSL)
- OSStatus error; /* Error info */
- size_t processed; /* Number of bytes processed */
-
-
- error = SSLRead((SSLContextRef)http->tls, buf, len, &processed);
-
- if (error == 0)
- return (processed);
- else
- {
- http->error = error;
-
- return (-1);
- }
-# endif /* HAVE_LIBSSL */
-}
-
-
-/*
- * 'http_write_ssl()' - Write to a SSL/TLS connection.
- */
-
-static int /* O - Bytes written */
-http_write_ssl(http_t *http, /* I - HTTP data */
- const char *buf, /* I - Buffer holding data */
- int len) /* I - Length of buffer */
-{
-# if defined(HAVE_LIBSSL)
- return (SSL_write((SSL *)(http->tls), buf, len));
-
-# elif defined(HAVE_GNUTLS)
- return (gnutls_record_send(((http_tls_t *)(http->tls))->session, buf, len));
-# elif defined(HAVE_CDSASSL)
- OSStatus error; /* Error info */
- size_t processed; /* Number of bytes processed */
-
-
- error = SSLWrite((SSLContextRef)http->tls, buf, len, &processed);
-
- if (error == 0)
- return (processed);
- else
- {
- http->error = error;
- return (-1);
- }
-# endif /* HAVE_LIBSSL */
-}
-
-
-# if defined(HAVE_CDSASSL)
-/*
- * 'CDSAReadFunc()' - Read function for CDSA decryption code.
- */
-
-static OSStatus /* O - -1 on error, 0 on success */
-CDSAReadFunc(SSLConnectionRef connection, /* I - SSL/TLS connection */
- void *data, /* I - Data buffer */
- size_t *dataLength) /* IO - Number of bytes */
-{
- ssize_t bytes; /* Number of bytes read */
-
-#ifdef DEBUG_HTTP
- httpDumpData(stdout, "CDSAReadFunc:", data, *dataLength);
-#endif
- bytes = recv((int)connection, data, *dataLength, 0);
- if (bytes >= 0)
- {
- *dataLength = bytes;
- return (0);
- }
- else
- return (-1);
-}
-
-
-/*
- * 'CDSAWriteFunc()' - Write function for CDSA encryption code.
- */
-
-static OSStatus /* O - -1 on error, 0 on success */
-CDSAWriteFunc(SSLConnectionRef connection, /* I - SSL/TLS connection */
- const void *data, /* I - Data buffer */
- size_t *dataLength) /* IO - Number of bytes */
-{
- ssize_t bytes;
-
-
- bytes = write((int)connection, data, *dataLength);
- if (bytes >= 0)
- {
- *dataLength = bytes;
- return (0);
- }
- else
- return (-1);
-}
-# endif /* HAVE_CDSASSL */
-#endif /* HAVE_SSL */
-
-
-/*
- * End of "$Id: http.c 148 2006-04-25 16:54:17Z njacobs $"
- */
diff --git a/usr/src/lib/print/libhttp-core/common/http.h b/usr/src/lib/print/libhttp-core/common/http.h
deleted file mode 100644
index 593b7b68f6..0000000000
--- a/usr/src/lib/print/libhttp-core/common/http.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * "$Id: http.h 148 2006-04-25 16:54:17Z njacobs $"
- *
- * Hyper-Text Transport Protocol definitions for the Common UNIX Printing
- * System (CUPS).
- *
- * Copyright 1997-2005 by Easy Software Products, all rights reserved.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
- *
- * This file is subject to the Apple OS-Developed Software exception.
- */
-
-#ifndef _CUPS_HTTP_H_
-#define _CUPS_HTTP_H_
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Include necessary headers...
- */
-
-# include <string.h>
-# include <time.h>
-# ifdef WIN32
-# include <winsock.h>
-# else
-# include <unistd.h>
-# include <sys/time.h>
-# include <sys/types.h>
-# include <sys/socket.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
-# include <netinet/in_systm.h>
-# include <netinet/ip.h>
-# if !defined(__APPLE__) || !defined(TCP_NODELAY)
-# include <netinet/tcp.h>
-# endif /* !__APPLE__ || !TCP_NODELAY */
-# ifdef AF_LOCAL
-# include <sys/un.h>
-# endif /* AF_LOCAL */
-# endif /* WIN32 */
-
-
-/*
- * C++ magic...
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- * Oh, the wonderful world of IPv6 compatibility. Apparently some
- * implementations expose the (more logical) 32-bit address parts
- * to everyone, while others only expose it to kernel code... To
- * make supporting IPv6 even easier, each vendor chose different
- * core structure and union names, so the same defines or code
- * can't be used on all platforms.
- *
- * The following will likely need tweeking on new platforms that
- * support IPv6 - the "s6_addr32" define maps to the 32-bit integer
- * array in the in6_addr union, which is named differently on various
- * platforms.
- */
-
-#if defined(AF_INET6) && !defined(s6_addr32)
-# if defined(__sun)
-# define s6_addr32 _S6_un._S6_u32
-# elif defined(__FreeBSD__) || defined(__APPLE__)
-# define s6_addr32 __u6_addr.__u6_addr32
-# endif /* __sun */
-#endif /* AF_INET6 && !s6_addr32 */
-
-
-/*
- * Limits...
- */
-
-# define HTTP_MAX_URI 1024 /* Max length of URI string */
-# define HTTP_MAX_HOST 256 /* Max length of hostname string */
-# define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */
-# define HTTP_MAX_VALUE 256 /* Max header field value length */
-
-
-/*
- * HTTP state values...
- */
-
-typedef enum /* States are server-oriented */
-{
- HTTP_WAITING, /* Waiting for command */
- HTTP_OPTIONS, /* OPTIONS command, waiting for blank line */
- HTTP_GET, /* GET command, waiting for blank line */
- HTTP_GET_SEND, /* GET command, sending data */
- HTTP_HEAD, /* HEAD command, waiting for blank line */
- HTTP_POST, /* POST command, waiting for blank line */
- HTTP_POST_RECV, /* POST command, receiving data */
- HTTP_POST_SEND, /* POST command, sending data */
- HTTP_PUT, /* PUT command, waiting for blank line */
- HTTP_PUT_RECV, /* PUT command, receiving data */
- HTTP_DELETE, /* DELETE command, waiting for blank line */
- HTTP_TRACE, /* TRACE command, waiting for blank line */
- HTTP_CLOSE, /* CLOSE command, waiting for blank line */
- HTTP_STATUS /* Command complete, sending status */
-} http_state_t;
-
-
-/*
- * HTTP version numbers...
- */
-
-typedef enum
-{
- HTTP_0_9 = 9, /* HTTP/0.9 */
- HTTP_1_0 = 100, /* HTTP/1.0 */
- HTTP_1_1 = 101 /* HTTP/1.1 */
-} http_version_t;
-
-
-/*
- * HTTP keep-alive values...
- */
-
-typedef enum
-{
- HTTP_KEEPALIVE_OFF = 0,
- HTTP_KEEPALIVE_ON
-} http_keepalive_t;
-
-
-/*
- * HTTP transfer encoding values...
- */
-
-typedef enum
-{
- HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */
- HTTP_ENCODE_CHUNKED /* Data is chunked */
-} http_encoding_t;
-
-
-/*
- * HTTP encryption values...
- */
-
-typedef enum
-{
- HTTP_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
- HTTP_ENCRYPT_NEVER, /* Never encrypt */
- HTTP_ENCRYPT_REQUIRED, /* Encryption is required (TLS upgrade) */
- HTTP_ENCRYPT_ALWAYS /* Always encrypt (SSL) */
-} http_encryption_t;
-
-
-/*
- * HTTP authentication types...
- */
-
-typedef enum
-{
- HTTP_AUTH_NONE, /* No authentication in use */
- HTTP_AUTH_BASIC, /* Basic authentication in use */
- HTTP_AUTH_MD5, /* Digest authentication in use */
- HTTP_AUTH_MD5_SESS, /* MD5-session authentication in use */
- HTTP_AUTH_MD5_INT, /* Digest authentication in use for body */
- HTTP_AUTH_MD5_SESS_INT /* MD5-session authentication in use for body */
-} http_auth_t;
-
-
-/*
- * HTTP status codes...
- */
-
-typedef enum
-{
- HTTP_ERROR = -1, /* An error response from httpXxxx() */
-
- HTTP_CONTINUE = 100, /* Everything OK, keep going... */
- HTTP_SWITCHING_PROTOCOLS, /* HTTP upgrade to TLS/SSL */
-
- HTTP_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */
- HTTP_CREATED, /* PUT command was successful */
- HTTP_ACCEPTED, /* DELETE command was successful */
- HTTP_NOT_AUTHORITATIVE, /* Information isn't authoritative */
- HTTP_NO_CONTENT, /* Successful command, no new data */
- HTTP_RESET_CONTENT, /* Content was reset/recreated */
- HTTP_PARTIAL_CONTENT, /* Only a partial file was recieved/sent */
-
- HTTP_MULTIPLE_CHOICES = 300, /* Multiple files match request */
- HTTP_MOVED_PERMANENTLY, /* Document has moved permanently */
- HTTP_MOVED_TEMPORARILY, /* Document has moved temporarily */
- HTTP_SEE_OTHER, /* See this other link... */
- HTTP_NOT_MODIFIED, /* File not modified */
- HTTP_USE_PROXY, /* Must use a proxy to access this URI */
-
- HTTP_BAD_REQUEST = 400, /* Bad request */
- HTTP_UNAUTHORIZED, /* Unauthorized to access host */
- HTTP_PAYMENT_REQUIRED, /* Payment required */
- HTTP_FORBIDDEN, /* Forbidden to access this URI */
- HTTP_NOT_FOUND, /* URI was not found */
- HTTP_METHOD_NOT_ALLOWED, /* Method is not allowed */
- HTTP_NOT_ACCEPTABLE, /* Not Acceptable */
- HTTP_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */
- HTTP_REQUEST_TIMEOUT, /* Request timed out */
- HTTP_CONFLICT, /* Request is self-conflicting */
- HTTP_GONE, /* Server has gone away */
- HTTP_LENGTH_REQUIRED, /* A content length or encoding is required */
- HTTP_PRECONDITION, /* Precondition failed */
- HTTP_REQUEST_TOO_LARGE, /* Request entity too large */
- HTTP_URI_TOO_LONG, /* URI too long */
- HTTP_UNSUPPORTED_MEDIATYPE, /* The requested media type is unsupported */
- HTTP_UPGRADE_REQUIRED = 426, /* Upgrade to SSL/TLS required */
-
- HTTP_SERVER_ERROR = 500, /* Internal server error */
- HTTP_NOT_IMPLEMENTED, /* Feature not implemented */
- HTTP_BAD_GATEWAY, /* Bad gateway */
- HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */
- HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */
- HTTP_NOT_SUPPORTED /* HTTP version not supported */
-} http_status_t;
-
-
-/*
- * HTTP field names...
- */
-
-typedef enum
-{
- HTTP_FIELD_UNKNOWN = -1,
- HTTP_FIELD_ACCEPT_LANGUAGE,
- HTTP_FIELD_ACCEPT_RANGES,
- HTTP_FIELD_AUTHORIZATION,
- HTTP_FIELD_CONNECTION,
- HTTP_FIELD_CONTENT_ENCODING,
- HTTP_FIELD_CONTENT_LANGUAGE,
- HTTP_FIELD_CONTENT_LENGTH,
- HTTP_FIELD_CONTENT_LOCATION,
- HTTP_FIELD_CONTENT_MD5,
- HTTP_FIELD_CONTENT_RANGE,
- HTTP_FIELD_CONTENT_TYPE,
- HTTP_FIELD_CONTENT_VERSION,
- HTTP_FIELD_DATE,
- HTTP_FIELD_HOST,
- HTTP_FIELD_IF_MODIFIED_SINCE,
- HTTP_FIELD_IF_UNMODIFIED_SINCE,
- HTTP_FIELD_KEEP_ALIVE,
- HTTP_FIELD_LAST_MODIFIED,
- HTTP_FIELD_LINK,
- HTTP_FIELD_LOCATION,
- HTTP_FIELD_RANGE,
- HTTP_FIELD_REFERER,
- HTTP_FIELD_RETRY_AFTER,
- HTTP_FIELD_TRANSFER_ENCODING,
- HTTP_FIELD_UPGRADE,
- HTTP_FIELD_USER_AGENT,
- HTTP_FIELD_WWW_AUTHENTICATE,
- HTTP_FIELD_MAX
-} http_field_t;
-
-
-/*
- * HTTP address structure (makes using IPv6 a little easier and more portable.)
- */
-
-typedef union
-{
- struct sockaddr addr; /* Base structure for family value */
- struct sockaddr_in ipv4; /* IPv4 address */
-#ifdef AF_INET6
- struct sockaddr_in6 ipv6; /* IPv6 address */
-#endif /* AF_INET6 */
-#ifdef AF_LOCAL
- struct sockaddr_un un; /* Domain socket file */
-#endif /* AF_LOCAL */
- char pad[128]; /* Pad to ensure binary compatibility */
-} http_addr_t;
-
-/*
- * HTTP connection structure...
- */
-
-typedef struct
-{
- int fd; /* File descriptor for this socket */
- int blocking; /* To block or not to block */
- int error; /* Last error on read */
- time_t activity; /* Time since last read/write */
- http_state_t state; /* State of client */
- http_status_t status; /* Status of last request */
- http_version_t version; /* Protocol version */
- http_keepalive_t keep_alive; /* Keep-alive supported? */
- struct sockaddr_in oldaddr; /* Address of connected host */
- char hostname[HTTP_MAX_HOST],
- /* Name of connected host */
- fields[HTTP_FIELD_MAX][HTTP_MAX_VALUE];
- /* Field values */
- char *data; /* Pointer to data buffer */
- http_encoding_t data_encoding; /* Chunked or not */
- int data_remaining; /* Number of bytes left */
- int used; /* Number of bytes used in buffer */
- char buffer[HTTP_MAX_BUFFER];
- /* Buffer for messages */
- int auth_type; /* Authentication in use */
- char nonce[HTTP_MAX_VALUE];
- /* Nonce value */
- int nonce_count; /* Nonce count */
- void *tls; /* TLS state information */
- http_encryption_t encryption; /* Encryption requirements */
- /**** New in CUPS 1.1.19 ****/
- fd_set *input_set; /* select() set for httpWait() */
- http_status_t expect; /* Expect: header */
- char *cookie; /* Cookie value(s) */
- /**** New in CUPS 1.1.20 ****/
- char authstring[HTTP_MAX_VALUE],
- /* Current Authentication value */
- userpass[HTTP_MAX_VALUE];
- /* Username:password string */
- int digest_tries; /* Number of tries for digest auth */
- /**** New in CUPS 1.2 ****/
- http_addr_t hostaddr; /* Host address and port */
-} http_t;
-
-
-/*
- * Prototypes...
- */
-
-# define httpBlocking(http,b) (http)->blocking = (b)
-extern int httpCheck(http_t *http);
-# define httpClearFields(http) memset((http)->fields, 0, sizeof((http)->fields)),\
- httpSetField((http), HTTP_FIELD_HOST, (http)->hostname)
-extern void httpClose(http_t *http);
-extern http_t *httpConnect(const char *host, int port);
-extern http_t *httpConnectEncrypt(const char *host, int port,
- http_encryption_t encrypt);
-extern int httpDelete(http_t *http, const char *uri);
-extern int httpEncryption(http_t *http, http_encryption_t e);
-# define httpError(http) ((http)->error)
-extern void httpFlush(http_t *http);
-extern int httpGet(http_t *http, const char *uri);
-extern char *httpGets(char *line, int length, http_t *http);
-extern const char *httpGetDateString(time_t t);
-extern time_t httpGetDateTime(const char *s);
-# define httpGetField(http,field) (http)->fields[field]
-extern struct hostent *httpGetHostByName(const char *name);
-extern char *httpGetSubField(http_t *http, http_field_t field,
- const char *name, char *value);
-extern int httpHead(http_t *http, const char *uri);
-extern void httpInitialize(void);
-extern int httpOptions(http_t *http, const char *uri);
-extern int httpPost(http_t *http, const char *uri);
-extern int httpPrintf(http_t *http, const char *format, ...)
-# ifdef __GNUC__
-__attribute__ ((__format__ (__printf__, 2, 3)))
-# endif /* __GNUC__ */
-;
-extern int httpPut(http_t *http, const char *uri);
-extern int httpRead(http_t *http, char *buffer, int length);
-extern int httpReconnect(http_t *http);
-extern void httpSeparate(const char *uri, char *method,
- char *username, char *host, int *port,
- char *resource);
-extern void httpSetField(http_t *http, http_field_t field,
- const char *value);
-extern const char *httpStatus(http_status_t status);
-extern int httpTrace(http_t *http, const char *uri);
-extern http_status_t httpUpdate(http_t *http);
-extern int httpWrite(http_t *http, const char *buffer, int length);
-extern char *httpEncode64(char *out, const char *in);
-extern char *httpDecode64(char *out, const char *in);
-extern int httpGetLength(http_t *http);
-extern char *httpMD5(const char *, const char *, const char *,
- char [33]);
-extern char *httpMD5Final(const char *, const char *, const char *,
- char [33]);
-extern char *httpMD5String(const unsigned char *, char [33]);
-
-/**** New in CUPS 1.1.19 ****/
-extern void httpClearCookie(http_t *http);
-#define httpGetCookie(http) ((http)->cookie)
-extern void httpSetCookie(http_t *http, const char *cookie);
-extern int httpWait(http_t *http, int msec);
-
-/**** New in CUPS 1.1.21 ****/
-extern char *httpDecode64_2(char *out, int *outlen, const char *in);
-extern char *httpEncode64_2(char *out, int outlen, const char *in,
- int inlen);
-extern void httpSeparate2(const char *uri,
- char *method, int methodlen,
- char *username, int usernamelen,
- char *host, int hostlen, int *port,
- char *resource, int resourcelen);
-
-/**** New in CUPS 1.2 ****/
-extern int httpAddrAny(const http_addr_t *addr);
-extern int httpAddrEqual(const http_addr_t *addr1,
- const http_addr_t *addr2);
-extern void httpAddrLoad(const struct hostent *host, int port,
- int n, http_addr_t *addr);
-extern int httpAddrLocalhost(const http_addr_t *addr);
-extern char *httpAddrLookup(const http_addr_t *addr,
- char *name, int namelen);
-extern char *httpAddrString(const http_addr_t *addr,
- char *s, int slen);
-
-#include <stdio.h>
-extern void httpDumpData(FILE *, const char *, const char *, int);
-
-
-/*
- * C++ magic...
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_CUPS_HTTP_H_ */
-
-/*
- * End of "$Id: http.h 148 2006-04-25 16:54:17Z njacobs $"
- */
diff --git a/usr/src/lib/print/libipp-core/Makefile b/usr/src/lib/print/libipp-core/Makefile
deleted file mode 100644
index b92d620b10..0000000000
--- a/usr/src/lib/print/libipp-core/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.lib
-
-#HDRS = papi.h
-#HDRDIR = common
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all clean clobber install: .WAIT $(SUBDIRS)
-
-lint: # $(SUBDIRS)
-
-install_h: # $(ROOTHDRS)
-
-check: # $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/libipp-core/Makefile.com b/usr/src/lib/print/libipp-core/Makefile.com
deleted file mode 100644
index 26f48c2dbb..0000000000
--- a/usr/src/lib/print/libipp-core/Makefile.com
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-LIBRARY = libipp-core.a
-VERS = .0
-OBJECTS = ipp.o ipp_types.o read.o strings.o write.o
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
-
-SRCDIR = ../common
-
-ROOTLIBDIR= $(ROOT)/usr/lib
-
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(SRCDIR)
-CPPFLAGS += -I../../libpapi-common/common
-
-CERRWARN += -_gcc=-Wno-unused-variable
-CERRWARN += -_gcc=-Wno-char-subscripts
-CERRWARN += -_gcc=-Wno-switch
-
-MAPFILES = $(SRCDIR)/mapfile
-
-LDLIBS += -lpapi-common -lc
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-lint: lintcheck
-
-include ../../../Makefile.targ
diff --git a/usr/src/lib/print/libipp-core/common/ipp.c b/usr/src/lib/print/libipp-core/common/ipp.c
deleted file mode 100644
index 133fb0ad13..0000000000
--- a/usr/src/lib/print/libipp-core/common/ipp.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: ipp.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <papi.h>
-#include "ipp.h"
-
-/*
- * IPP requests/responses are represented as attribute lists. An IPP request
- * attribute list will contain header information attributes:
- * version-major (int)
- * version-minor (int)
- * request-id (int)
- * operation-id (int)
- * It will also contain 1 or more attribute groups (collections)
- * operational-attribute-group
- * ...
- * this routine validates that the request falls within the guidelines of
- * the protocol specification (or some other level of conformance if the
- * restrictions have been specified at the top level of the request using
- * a "conformance" attribute.
- */
-papi_status_t
-ipp_validate_request(papi_attribute_t **request, papi_attribute_t ***response)
-{
- papi_attribute_t **attributes = NULL;
- papi_status_t result = PAPI_OK;
- char *s;
-
- if ((request == NULL) || (response == NULL) || (*response == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* validate the operational attributes group */
- result = papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &attributes);
- if (result != PAPI_OK) {
- ipp_set_status(response, result,
- "operational attribute group: %s",
- papiStatusString(result));
- return (result);
- }
-
- result = papiAttributeListGetString(attributes, NULL,
- "attributes-charset", &s);
- if (result != PAPI_OK) {
- ipp_set_status(response, result, "attributes-charset: %s",
- papiStatusString(result));
- return (result);
- }
-
- result = papiAttributeListGetString(attributes, NULL,
- "attributes-natural-language", &s);
- if (result != PAPI_OK) {
- ipp_set_status(response, result,
- "attributes-natural-language: %s",
- papiStatusString(result));
- return (result);
- }
-
- return (result);
-}
-
-/*
- * Add/Modify the statuse-code and status-message in an IPP response's
- * operational attributes group.
- */
-void
-ipp_set_status(papi_attribute_t ***message, papi_status_t status,
- char *format, ...)
-{
- if (message == NULL)
- return;
-
- if (format != NULL) {
- papi_attribute_t **operational = NULL;
- papi_attribute_t **saved;
- char mesg[256]; /* status-message is type text(255) */
- va_list ap;
-
- (void) papiAttributeListGetCollection(*message, NULL,
- "operational-attributes-group",
- &operational);
- saved = operational;
-
- va_start(ap, format);
- (void) vsnprintf(mesg, sizeof (mesg), format, ap);
- va_end(ap);
-
- (void) papiAttributeListAddString(&operational,
- PAPI_ATTR_APPEND, "status-message", mesg);
-
- /*
- * We need to check and see if adding the status-message caused
- * the operational attributes group to be relocated in memory.
- * If it has been, we will need to re-add the collection to
- * the message.
- */
- if (saved != operational)
- (void) papiAttributeListAddCollection(message,
- PAPI_ATTR_REPLACE,
- "operational-attributes-group",
- operational);
- }
-
- (void) papiAttributeListAddInteger(message, PAPI_ATTR_APPEND,
- "status-code", status);
-}
diff --git a/usr/src/lib/print/libipp-core/common/ipp.h b/usr/src/lib/print/libipp-core/common/ipp.h
deleted file mode 100644
index c13728e334..0000000000
--- a/usr/src/lib/print/libipp-core/common/ipp.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _IPP_H
-#define _IPP_H
-
-/* $Id: ipp.h 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdarg.h>
-#include <sys/time.h>
-#include <papi.h>
-#include <inttypes.h>
-
-
-typedef ssize_t (*ipp_reader_t)(void *fd, void *buffer, size_t buffer_size);
-typedef ssize_t (*ipp_writer_t)(void *fd, void *buffer, size_t buffer_size);
-
-enum {
- IPP_TYPE_UNKNOWN = 0,
- IPP_TYPE_REQUEST = 1,
- IPP_TYPE_RESPONSE = 2
-};
-
-/*
- * How closely do we conform to the spec when parsing? Do we
- * a) Stop parsing only when we encounter an error that prevents us from
- * continuing parsing (a server error or ridiculously malformed request)?
- * b) Stop parsing when we know the server wouldn't be able to act on the
- * response correctly, even if we can make sense of some of the data?
- * c) Jawohl, Mein IPP Spec!
- * The answer will usually be b, though a will be useful for debugging.
- */
-enum {
- IPP_PARSE_CONFORMANCE_RASH = 0,
- IPP_PARSE_CONFORMANCE_LOOSE = 1,
- IPP_PARSE_CONFORMANCE_STRICT = 2
-};
-
-
-/* Operation IDs */
-enum {
- OPID_MIN = 0x0000, /* 0x0000 */
- OPID_RESERVED_0000 = 0x0000, /* 0x0000 */
- OPID_RESERVED_0001, /* 0x0001 */
- OPID_PRINT_JOB, /* 0x0002 */
- OPID_PRINT_URI, /* 0x0003 */
- OPID_VALIDATE_JOB, /* 0x0004 */
- OPID_CREATE_JOB, /* 0x0005 */
- OPID_SEND_DOCUMENT, /* 0x0006 */
- OPID_SEND_URI, /* 0x0007 */
- OPID_CANCEL_JOB, /* 0x0008 */
- OPID_GET_JOB_ATTRIBUTES, /* 0x0009 */
- OPID_GET_JOBS, /* 0x000a */
- OPID_GET_PRINTER_ATTRIBUTES, /* 0x000b */
- OPID_HOLD_JOB, /* 0x000c */
- OPID_RELEASE_JOB, /* 0x000d */
- OPID_RESTART_JOB, /* 0x000e */
- OPID_RESERVED_000F, /* 0x000f */
- OPID_PAUSE_PRINTER, /* 0x0010 */
- OPID_RESUME_PRINTER, /* 0x0011 */
- OPID_PURGE_JOBS, /* 0x0012 */
- OPID_SET_PRINTER_ATTRIBUTES, /* 0x0013 */
- OPID_SET_JOB_ATTRIBUTES, /* 0x0014 */
- OPID_GET_PRINTER_SUPPORTED_VALUES, /* 0x0015 */
- OPID_CREATE_PRINTER_SUBSCRIPTION, /* 0x0016 */
- OPID_CREATE_JOB_SUBSCRIPTION, /* 0x0017 */
- OPID_GET_SUBSCRIPTION_ATTRIBUTES, /* 0x0018 */
- OPID_GET_SUBSCRIPTIONS, /* 0x0019 */
- OPID_RENEW_SUBSCRIPTION, /* 0x001a */
- OPID_CANCEL_SUBSCRIPTION, /* 0x001b */
- OPID_GET_NOTIFICATIONS, /* 0x001c */
- OPID_SEND_NOTIFICATIONS, /* 0x001d */
- OPID_GET_RESOURCE_ATTRIBUTES, /* 0x001e */
- OPID_GET_RESOURCE_DATA, /* 0x001f */
- OPID_GET_RESOURCES, /* 0x0020 */
- OPID_GET_PRINT_SUPPORT_FILES, /* 0x0021 */
- OPID_ENABLE_PRINTER, /* 0x0022 */
- OPID_DISABLE_PRINTER, /* 0x0023 */
- OPID_PAUSE_PRINTER_AFTER_CURRENT_JOB, /* 0x0024 */
- OPID_HOLD_NEW_JOBS, /* 0x0025 */
- OPID_RELEASE_HELD_NEW_JOBS, /* 0x0026 */
- OPID_DEACTIVATE_PRINTER, /* 0x0027 */
- OPID_ACTIVATE_PRINTER, /* 0x0028 */
- OPID_RESTART_PRINTER, /* 0x0029 */
- OPID_SHUTDOWN_PRINTER, /* 0x002a */
- OPID_STARTUP_PRINTER, /* 0x002b */
- OPID_REPROCESS_JOB, /* 0x002c */
- OPID_CANCEL_CURRENT_JOB, /* 0x002d */
- OPID_SUSPEND_CURRENT_JOB, /* 0x002e */
- OPID_RESUME_JOB, /* 0x002f */
- OPID_PROMOTE_JOB, /* 0x0030 */
- OPID_SCHEDULE_JOB_AFTER, /* 0x0031 */
- OPID_RESERVED_MIN, /* 0x0032 */
- OPID_RESERVED_0032 = 0x0032, /* 0x0032 */
- /* ... */
- OPID_RESERVED_3FFF = 0x3fff, /* 0x3fff */
- OPID_RESERVED_MAX = 0x3fff, /* 0x3fff */
- OPID_RESERVED_VENDOR_MIN = 0x4000, /* 0x4000 */
- OPID_RESERVED_VENDOR_4000 = 0x4000, /* 0x4000 */
- /* ... */
- OPID_RESERVED_VENDOR_8FFF = 0x8fff, /* 0x8fff */
- OPID_RESERVED_VENDOR_MAX = 0x8fff, /* 0x8fff */
- OPID_MAX = 0x8fff /* 0x8fff */
-};
-
-enum {
- /* Delimiter Tags */
- DTAG_MIN = 0x00, /* 0x00 */
- DTAG_RESERVED_DELIMITER_00 = 0x00, /* 0x00 */
- DTAG_OPERATION_ATTRIBUTES, /* 0x01 */
- DTAG_JOB_ATTRIBUTES, /* 0x02 */
- DTAG_END_OF_ATTRIBUTES, /* 0x03 */
- DTAG_PRINTER_ATTRIBUTES, /* 0x04 */
- DTAG_UNSUPPORTED_ATTRIBUTES, /* 0x05 */
- DTAG_SUBSCRIPTION_ATTRIBUTES, /* 0x06 */
- DTAG_EVENT_NOTIFICATION_ATTRIBUTES, /* 0x07 */
- DTAG_RESERVED_DELIMITER_08, /* 0x08 */
- DTAG_RESERVED_DELIMITER_09, /* 0x09 */
- DTAG_RESERVED_DELIMITER_0A, /* 0x0a */
- DTAG_RESERVED_DELIMITER_0B, /* 0x0b */
- DTAG_RESERVED_DELIMITER_0C, /* 0x0c */
- DTAG_RESERVED_DELIMITER_0D, /* 0x0d */
- DTAG_RESERVED_DELIMITER_0E, /* 0x0e */
- DTAG_RESERVED_DELIMITER_0F, /* 0x0f */
- DTAG_MAX = 0x0f, /* 0x0f */
-
- /* Value Tags */
- VTAG_MIN = 0x10, /* 0x10 */
- VTAG_UNSUPPORTED = 0x10, /* 0x10 */
- VTAG_RESERVED_DEFAULT, /* 0x11 */
- VTAG_UNKNOWN, /* 0x12 */
- VTAG_NOVALUE, /* 0x13 */
- VTAG_RESERVED_OOB_14, /* 0x14 */
- VTAG_NOT_SETTABLE, /* 0x15 */
- VTAG_DELETE_ATTRIBUTE, /* 0x16 */
- VTAG_ADMIN_DEFINE, /* 0x17 */
- VTAG_RESERVED_OOB_18, /* 0x18 */
- VTAG_RESERVED_OOB_19, /* 0x19 */
- VTAG_RESERVED_OOB_1A, /* 0x1a */
- VTAG_RESERVED_OOB_1B, /* 0x1b */
- VTAG_RESERVED_OOB_1C, /* 0x1c */
- VTAG_RESERVED_OOB_1D, /* 0x1d */
- VTAG_RESERVED_OOB_1E, /* 0x1e */
- VTAG_RESERVED_OOB_1F, /* 0x1f */
- VTAG_RESERVED_INT_GEN, /* 0x20 */
- VTAG_INTEGER, /* 0x21 */
- VTAG_BOOLEAN, /* 0x22 */
- VTAG_ENUM, /* 0x23 */
- VTAG_RESERVED_INT_24, /* 0x24 */
- VTAG_RESERVED_INT_25, /* 0x25 */
- VTAG_RESERVED_INT_26, /* 0x26 */
- VTAG_RESERVED_INT_27, /* 0x27 */
- VTAG_RESERVED_INT_28, /* 0x28 */
- VTAG_RESERVED_INT_29, /* 0x29 */
- VTAG_RESERVED_INT_2A, /* 0x2a */
- VTAG_RESERVED_INT_2B, /* 0x2b */
- VTAG_RESERVED_INT_2C, /* 0x2c */
- VTAG_RESERVED_INT_2D, /* 0x2d */
- VTAG_RESERVED_INT_2E, /* 0x2e */
- VTAG_RESERVED_INT_2F, /* 0x2f */
- VTAG_OCTET_STRING, /* 0x30 */
- VTAG_DATE_TIME, /* 0x31 */
- VTAG_RESOLUTION, /* 0x32 */
- VTAG_RANGE_OF_INTEGER, /* 0x33 */
- VTAG_BEGIN_COLLECTION, /* 0x34 */
- VTAG_TEXT_WITH_LANGUAGE, /* 0x35 */
- VTAG_NAME_WITH_LANGUAGE, /* 0x36 */
- VTAG_END_COLLECTION, /* 0x37 */
- VTAG_RESERVED_STRING_38, /* 0x38 */
- VTAG_RESERVED_STRING_39, /* 0x39 */
- VTAG_RESERVED_STRING_3A, /* 0x3a */
- VTAG_RESERVED_STRING_3B, /* 0x3b */
- VTAG_RESERVED_STRING_3C, /* 0x3c */
- VTAG_RESERVED_STRING_3D, /* 0x3d */
- VTAG_RESERVED_STRING_3E, /* 0x3e */
- VTAG_RESERVED_STRING_3F, /* 0x3f */
- VTAG_RESERVED_CHAR_GEN, /* 0x40 */
- VTAG_TEXT_WITHOUT_LANGUAGE, /* 0x41 */
- VTAG_NAME_WITHOUT_LANGUAGE, /* 0x42 */
- VTAG_RESERVED_43, /* 0x43 */
- VTAG_KEYWORD, /* 0x44 */
- VTAG_URI, /* 0x45 */
- VTAG_URI_SCHEME, /* 0x46 */
- VTAG_CHARSET, /* 0x47 */
- VTAG_NATURAL_LANGUAGE, /* 0x48 */
- VTAG_MIME_MEDIA_TYPE, /* 0x49 */
- VTAG_MEMBER_ATTR_NAME, /* 0x4a */
- VTAG_RESERVED_STRING_4B, /* 0x4b */
- VTAG_RESERVED_STRING_4C, /* 0x4c */
- VTAG_RESERVED_STRING_4D, /* 0x4d */
- VTAG_RESERVED_STRING_4E, /* 0x4e */
- VTAG_RESERVED_STRING_4F, /* 0x4f */
- VTAG_RESERVED_STRING_50, /* 0x50 */
- VTAG_RESERVED_STRING_51, /* 0x51 */
- VTAG_RESERVED_STRING_52, /* 0x52 */
- VTAG_RESERVED_STRING_53, /* 0x53 */
- VTAG_RESERVED_STRING_54, /* 0x54 */
- VTAG_RESERVED_STRING_55, /* 0x55 */
- VTAG_RESERVED_STRING_56, /* 0x56 */
- VTAG_RESERVED_STRING_57, /* 0x57 */
- VTAG_RESERVED_STRING_58, /* 0x58 */
- VTAG_RESERVED_STRING_59, /* 0x59 */
- VTAG_RESERVED_STRING_5A, /* 0x5a */
- VTAG_RESERVED_STRING_5B, /* 0x5b */
- VTAG_RESERVED_STRING_5C, /* 0x5c */
- VTAG_RESERVED_STRING_5D, /* 0x5d */
- VTAG_RESERVED_STRING_5E, /* 0x5e */
- VTAG_RESERVED_STRING_5F, /* 0x5f */
- VTAG_RESERVED_MAX = 0x5f, /* 0x5f */
- VTAG_MAX = 0x5f, /* 0x5f */
- VTAG_EXTEND = 0x7f /* 0x7f */
-};
-
-/* Response codes */
-enum {
- IPP_OK_MIN = 0x0000,
- IPP_OK = 0x0000, /* 0x0000 */
- IPP_OK_IGNORED_ATTRIBUTES, /* 0x0001 */
- IPP_OK_CONFLICTING_ATTRIBUTES, /* 0x0002 */
- IPP_OK_IGNORED_SUBSCRIPTIONS, /* 0x0003 */
- IPP_OK_IGNORED_NOTIFICATIONS, /* 0x0004 */
- IPP_OK_TOO_MANY_EVENTS, /* 0x0005 */
- IPP_OK_BUT_CANCEL_SUBSCRIPTION, /* 0x0006 */
- IPP_OK_MAX = IPP_OK_BUT_CANCEL_SUBSCRIPTION,
-
- IPP_REDIR_MIN = 0x0300,
- IPP_REDIR_OTHER_SIZE = 0x0300, /* 0x0300 */
- IPP_REDIR_MAX = 0x0300,
-
- IPP_CERR_MIN = 0x0400,
- IPP_CERR_BAD_REQUEST = 0x0400, /* 0x0400 */
- IPP_CERR_FORBIDDEN, /* 0x0401 */
- IPP_CERR_NOT_AUTHENTICATED, /* 0x0402 */
- IPP_CERR_NOT_AUTHORIZED, /* 0x0403 */
- IPP_CERR_NOT_POSSIBLE, /* 0x0404 */
- IPP_CERR_TIMEOUT, /* 0x0405 */
- IPP_CERR_NOT_FOUND, /* 0x0406 */
- IPP_CERR_GONE, /* 0x0407 */
- IPP_CERR_REQUEST_ENTITY, /* 0x0408 */
- IPP_CERR_REQUEST_VALUE, /* 0x0409 */
- IPP_CERR_DOCUMENT_FORMAT, /* 0x040a */
- IPP_CERR_ATTRIBUTES, /* 0x040b */
- IPP_CERR_URI_SCHEME, /* 0x040c */
- IPP_CERR_CHARSET, /* 0x040d */
- IPP_CERR_CONFLICT, /* 0x040e */
- IPP_CERR_COMPRESSION_NOT_SUPPORTED, /* 0x040f */
- IPP_CERR_COMPRESSION_ERROR, /* 0x0410 */
- IPP_CERR_DOCUMENT_FORMAT_ERROR, /* 0x0411 */
- IPP_CERR_DOCUMENT_ACCESS_ERROR, /* 0x0412 */
- IPP_CERR_ATTRIBUTES_NOT_SETTABLE, /* 0x0413 */
- IPP_CERR_IGNORED_ALL_SUBSCRIPTIONS, /* 0x0414 */
- IPP_CERR_TOO_MANY_SUBSCRIPTIONS, /* 0x0415 */
- IPP_CERR_IGNORED_ALL_NOTIFICATIONS, /* 0x0416 */
- IPP_CERR_PRINT_SUPPORT_FILE_NOT_FOUND, /* 0x0417 */
- IPP_CERR_MAX = IPP_CERR_PRINT_SUPPORT_FILE_NOT_FOUND,
-
- IPP_SERR_MIN = 0x0500,
- IPP_SERR_INTERNAL = 0x0500, /* 0x0500 */
- IPP_SERR_OPERATION_NOT_SUPPORTED, /* 0x0501 */
- IPP_SERR_SERVICE_UNAVAILABLE, /* 0x0502 */
- IPP_SERR_VERSION_NOT_SUPPORTED, /* 0x0503 */
- IPP_SERR_DEVICE_ERROR, /* 0x0504 */
- IPP_SERR_TEMPORARY_ERROR, /* 0x0505 */
- IPP_SERR_NOT_ACCEPTING, /* 0x0506 */
- IPP_SERR_BUSY, /* 0x0507 */
- IPP_SERR_CANCELLED, /* 0x0508 */
- IPP_SERR_MULTIPLE_DOCS_NOT_SUPPORTED, /* 0x0509 */
- IPP_SERR_PRINTER_IS_DEACTIVATED, /* 0x050a */
- IPP_SERR_MAX = IPP_SERR_PRINTER_IS_DEACTIVATED
-};
-
-/* Job state codes */
-enum {
- IPP_JOB_STATE_PENDING = 3,
- IPP_JOB_STATE_PENDING_HELD = 4,
- IPP_JOB_STATE_PROCESSING = 5,
- IPP_JOB_STATE_PROCESSING_STOPPED = 6,
- IPP_JOB_STATE_CANCELED = 7,
- IPP_JOB_STATE_ABORTED = 8,
- IPP_JOB_STATE_COMPLETED = 9
-};
-
-/* exported functions */
-extern papi_status_t ipp_read_message(ipp_reader_t iread, void *fd,
- papi_attribute_t ***message, char type);
-
-extern papi_status_t ipp_write_message(ipp_writer_t iwrite, void *fd,
- papi_attribute_t **message);
-
-/* internal functions shared between modules */
-extern void ipp_set_status(papi_attribute_t ***message, papi_status_t status,
- char *format, ...);
-extern papi_status_t ipp_validate_request(papi_attribute_t **request,
- papi_attribute_t ***response);
-
-extern int ipp_severity(int16_t status);
-
-extern int16_t ipp_charset_supported(char *charset);
-
-extern void *string_to_ipp_attr_value(int8_t type, char *value);
-
-extern char *ipp_uri_to_printer(char *uri);
-extern void *papi_attribute_to_ipp_attr(int8_t type, papi_attribute_t *attr);
-
-extern int8_t name_to_ipp_type(char *name);
-extern char *job_template[];
-extern char *job_description[];
-extern char *printer_description[];
-extern char *ipp_tag_string(int8_t tag, char *buf, size_t bufsiz);
-extern size_t min_val_len(int8_t type, char *name);
-extern size_t max_val_len(int8_t type, char *name);
-extern int is_keyword(char *value);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IPP_H */
diff --git a/usr/src/lib/print/libipp-core/common/ipp_types.c b/usr/src/lib/print/libipp-core/common/ipp_types.c
deleted file mode 100644
index 47fc32c259..0000000000
--- a/usr/src/lib/print/libipp-core/common/ipp_types.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: ipp_types.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ipp.h>
-#include <errno.h>
-#include <values.h>
-
-#ifndef MININT
-#define MININT (-MAXINT - 1)
-#endif
-
-typedef struct {
- char *name;
- int8_t ipp_type;
- int min;
- int max;
-} attr_info_list_t;
-
-static attr_info_list_t attr_list[] = {
- {"operation-attribute-group", DTAG_OPERATION_ATTRIBUTES, 0, 0},
- {"job-attribute-group", DTAG_JOB_ATTRIBUTES, 0, 0},
- {"printer-attribute-group", DTAG_PRINTER_ATTRIBUTES, 0, 0},
- {"unsupported-attribute-group", DTAG_UNSUPPORTED_ATTRIBUTES, 0, 0},
- {"subscription-attribute-group", DTAG_SUBSCRIPTION_ATTRIBUTES, 0, 0},
- {"even-notificaton-attribute-group",
- DTAG_EVENT_NOTIFICATION_ATTRIBUTES, 0, 0},
- {"attributes-charset", VTAG_CHARSET, 0, 255},
- {"attributes-natural-language", VTAG_NATURAL_LANGUAGE, 0, 255},
- {"charset-configured", VTAG_CHARSET, 0, 255},
- {"charset-supported", VTAG_CHARSET, 0, 255},
- {"color-supported", VTAG_BOOLEAN, 0, 1},
- {"compression", VTAG_KEYWORD, 1, 255},
- {"compression-supported", VTAG_KEYWORD, 1, 255},
- {"copies", VTAG_INTEGER, 1, MAXINT},
- {"copies-default", VTAG_INTEGER, 1, MAXINT},
- {"copies-supported", VTAG_RANGE_OF_INTEGER, 1, MAXINT},
- {"date-at-completed", VTAG_DATE_TIME, 0, 0},
- {"date-at-creation", VTAG_DATE_TIME, 0, 0},
- {"date-at-processing", VTAG_DATE_TIME, 0, 0},
- {"detailed-status-message", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 1023},
- {"document-access-error", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 1023},
- {"document-format", VTAG_MIME_MEDIA_TYPE, 0, 255},
- {"document-format-default", VTAG_MIME_MEDIA_TYPE, 0, 255},
- {"document-format-supported", VTAG_MIME_MEDIA_TYPE, 0, 255},
- {"document-name", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"document-name", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"document-natural-language", VTAG_NATURAL_LANGUAGE, 0, 255},
- {"finishing", VTAG_ENUM, 3, 31},
- {"finishing-default", VTAG_ENUM, 3, 31},
- {"finishing-supported", VTAG_ENUM, 3, 31},
- {"generated-natural-language-supported", VTAG_NATURAL_LANGUAGE, 0, 255},
- {"ipp-attribute-fidelity", VTAG_BOOLEAN, 0, 1},
- {"ipp-versions-supported", VTAG_KEYWORD, 1, 255},
- {"job-detailed-status-messages", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 1023},
- {"job-document-access-errors", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 1023},
- {"job-hold-until", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"job-hold-until-default", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"job-hold-until-supported", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"job-id", VTAG_INTEGER, 1, MAXINT},
- {"job-impressions", VTAG_INTEGER, 0, MAXINT},
- {"job-impressions-completed", VTAG_INTEGER, 0, MAXINT},
- {"job-impressions-supported", VTAG_RANGE_OF_INTEGER, 0, MAXINT},
- {"job-k-octets", VTAG_INTEGER, 0, MAXINT},
- {"job-k-octets-processed", VTAG_INTEGER, 0, MAXINT},
- {"job-k-octets-supported", VTAG_RANGE_OF_INTEGER, 0, MAXINT},
- {"job-media-sheets", VTAG_INTEGER, 0, MAXINT},
- {"job-media-sheets-completed", VTAG_INTEGER, 0, MAXINT},
- {"job-media-sheets-supported", VTAG_RANGE_OF_INTEGER, 0, MAXINT},
- {"job-message-from-operator", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 127},
- {"job-more-info", VTAG_URI, 0, 1023},
- {"job-name", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"job-originating-user-name", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"job-printer-up-time", VTAG_INTEGER, 1, MAXINT},
- {"job-printer-uri", VTAG_URI, 0, 1023},
- {"job-priority", VTAG_INTEGER, 1, 100},
- {"job-priority-default", VTAG_INTEGER, 1, 100},
- {"job-priority-supported", VTAG_INTEGER, 1, 100},
- {"job-sheets", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"job-sheets-default", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"job-sheets-supported", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"job-state", VTAG_ENUM, 3, 9},
- {"job-state-message", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 1023},
- {"job-state-reasons", VTAG_KEYWORD, 1, 255},
- {"job-uri", VTAG_URI, 0, 1023},
- {"last-document", VTAG_BOOLEAN, 0, 1},
- {"limit", VTAG_INTEGER, 1, MAXINT},
- {"media", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"media-default", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"media-supported", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"message", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 127},
- {"multiple-document-handling", VTAG_KEYWORD, 1, 255},
- {"multiple-document-handling-default", VTAG_KEYWORD, 1, 255},
- {"multiple-document-handling-supported", VTAG_KEYWORD, 1, 255},
- {"multiple-document-jobs-supported", VTAG_BOOLEAN, 0, 1},
- {"multiple-operation-time-out", VTAG_INTEGER, 1, MAXINT},
- {"my-jobs", VTAG_BOOLEAN, 0, 1},
- {"natural-language-configured", VTAG_NATURAL_LANGUAGE, 0, 255},
- {"number-of-documents", VTAG_INTEGER, 0, MAXINT},
- {"number-of-intervening-jobs", VTAG_INTEGER, 0, MAXINT},
- {"number-up", VTAG_INTEGER, 1, MAXINT},
- {"number-up-default", VTAG_INTEGER, 1, MAXINT},
- {"number-up-supported", VTAG_INTEGER, 1, MAXINT},
- {"operations-supported", VTAG_ENUM, 1, 0x8FFF},
- {"orientation-requested", VTAG_ENUM, 3, 6},
- {"orientation-requested-default", VTAG_ENUM, 3, 6},
- {"orientation-requested-supported", VTAG_ENUM, 3, 6},
- {"output-device-assigned", VTAG_NAME_WITHOUT_LANGUAGE, 0, 127},
- {"page-ranges", VTAG_RANGE_OF_INTEGER, 1, MAXINT},
- {"page-ranges-supported", VTAG_BOOLEAN, 0, 1},
- {"pages-per-minute", VTAG_INTEGER, 0, MAXINT},
- {"pages-per-minute-color", VTAG_INTEGER, 0, MAXINT},
- {"pdl-override-supported", VTAG_KEYWORD, 1, 255},
- {"print-quality", VTAG_ENUM, 3, 5},
- {"print-quality-default", VTAG_ENUM, 3, 5},
- {"print-quality-supported", VTAG_ENUM, 3, 5},
- {"printer-current-time", VTAG_DATE_TIME, 0, 1},
- {"printer-driver-installer", VTAG_URI, 0, 1023},
- {"printer-id", VTAG_INTEGER, 1, MAXINT},
- {"printer-info", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 127},
- {"printer-is-accepting-jobs", VTAG_BOOLEAN, 0, 1},
- {"printer-location", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 127},
- {"printer-make-and-model", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 127},
- {"printer-message-from-operator", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 127},
- {"printer-more-info", VTAG_URI, 0, 1023},
- {"printer-more-info-manufacturer", VTAG_URI, 0, 1023},
- {"printer-name", VTAG_NAME_WITHOUT_LANGUAGE, 0, 127},
- {"printer-resolution", VTAG_RESOLUTION, 0, 0},
- {"printer-resolution-default", VTAG_RESOLUTION, 0, 0},
- {"printer-resolution-supported", VTAG_RESOLUTION, 0, 0},
- {"printer-state", VTAG_ENUM, 3, 5},
- {"printer-state-message", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 1023},
- {"printer-state-reasons", VTAG_KEYWORD, 1, 255},
- {"printer-up-time", VTAG_INTEGER, 1, MAXINT},
- {"printer-uri", VTAG_URI, 0, 1023},
- {"printer-uri-supported", VTAG_URI, 0, 1023},
- {"queued-job-count", VTAG_INTEGER, 0, MAXINT},
- {"reference-uri-schemes-supported", VTAG_URI_SCHEME, 0, 63},
- {"requested-attributes", VTAG_KEYWORD, 1, 255},
- {"requesting-user-name", VTAG_NAME_WITHOUT_LANGUAGE, 0, 255},
- {"sides", VTAG_KEYWORD, 1, 255},
- {"sides-default", VTAG_KEYWORD, 1, 255},
- {"sides-supported", VTAG_KEYWORD, 1, 255},
- {"status-code", VTAG_ENUM, 1, 0x7FFF},
- {"status-message", VTAG_TEXT_WITHOUT_LANGUAGE, 0, 255},
- {"time-at-completed", VTAG_INTEGER, MININT, MAXINT},
- {"time-at-creation", VTAG_INTEGER, MININT, MAXINT},
- {"time-at-processing", VTAG_INTEGER, MININT, MAXINT},
- {"uri-authentication-supported", VTAG_KEYWORD, 1, 255},
- {"uri-security-supported", VTAG_KEYWORD, 1, 255},
- {"which-jobs", VTAG_KEYWORD, 1, 255},
- {NULL, 0, 0, 0}
-};
-
-
-static attr_info_list_t *
-get_attr_info_by_name(char *name)
-{
- if (name != NULL) {
- int i;
-
- for (i = 0; attr_list[i].name != NULL; i++)
- if (strcasecmp(attr_list[i].name, name) == 0)
- return (&attr_list[i]);
- }
-
- return (NULL);
-}
-
-size_t
-max_val_len(int8_t type, char *name)
-{
- attr_info_list_t *t;
- int result;
-
- switch (type) {
- case VTAG_INTEGER:
- case VTAG_RANGE_OF_INTEGER:
- case VTAG_ENUM:
- result = MAXINT;
- break;
- case VTAG_URI:
- case VTAG_OCTET_STRING:
- case VTAG_TEXT_WITHOUT_LANGUAGE:
- result = 1023;
- break;
- case VTAG_NATURAL_LANGUAGE:
- case VTAG_URI_SCHEME:
- case VTAG_CHARSET:
- result = 63;
- break;
- case VTAG_NAME_WITHOUT_LANGUAGE:
- case VTAG_MIME_MEDIA_TYPE:
- case VTAG_KEYWORD:
- result = 255;
- break;
- default:
- result = MAXINT;
- }
-
-#define min(a, b) ((a < b) ? a : b)
- if ((t = get_attr_info_by_name(name)) != NULL)
- result = min(t->max, result);
-#undef min
-
- return (result);
-}
-
-size_t
-min_val_len(int8_t type, char *name)
-{
- attr_info_list_t *t;
- int result;
-
- switch (type) {
- case VTAG_INTEGER:
- case VTAG_RANGE_OF_INTEGER:
- result = MININT;
- break;
- case VTAG_ENUM:
- result = 1;
- break;
- case VTAG_URI:
- case VTAG_OCTET_STRING:
- case VTAG_TEXT_WITHOUT_LANGUAGE:
- case VTAG_MIME_MEDIA_TYPE:
- case VTAG_NAME_WITHOUT_LANGUAGE:
- case VTAG_URI_SCHEME:
- case VTAG_CHARSET:
- case VTAG_NATURAL_LANGUAGE:
- result = 0;
- break;
- case VTAG_KEYWORD:
- result = 1;
- break;
- default:
- result = MININT;
- }
-
-#define max(a, b) ((a > b) ? a : b)
- if ((t = get_attr_info_by_name(name)) != NULL)
- result = max(t->min, result);
-#undef max
-
- return (result);
-}
-
-int
-is_keyword(char *k)
-{
- /* [a-z][a-z0-9._-]* */
- if (*k < 'a' && *k > 'z')
- return (0);
- while (*(++k) != '\0')
- if (*k < 'a' && *k > 'z' && *k < '0' && *k > '9' &&
- *k != '.' && *k != '_' && *k != '-')
- return (0);
- return (1);
-}
-
-int8_t
-name_to_ipp_type(char *name)
-{
- int i;
-
- if (name != NULL)
- for (i = 0; attr_list[i].name != NULL; i++)
- if (strcasecmp(attr_list[i].name, name) == 0)
- return (attr_list[i].ipp_type);
-
- return (0);
-}
diff --git a/usr/src/lib/print/libipp-core/common/read.c b/usr/src/lib/print/libipp-core/common/read.c
deleted file mode 100644
index 6127958f66..0000000000
--- a/usr/src/lib/print/libipp-core/common/read.c
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: read.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <alloca.h>
-#include <string.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <inttypes.h>
-
-#include <papi.h>
-#include <ipp.h>
-
-
-#define _ipp_tag_string(id) ipp_tag_string((id), buf, sizeof (buf))
-
-static papi_status_t
-read_name_with_language(ipp_reader_t iread, void *fd,
- papi_attribute_t ***message)
-{
- char *string;
- uint16_t size;
-
- /* read the language */
- if (iread(fd, &size, 2) != 2) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "read failed: lang len\n");
- return (PAPI_BAD_REQUEST);
- }
- size = (uint16_t)ntohs(size);
-
- if ((string = alloca(size + 1)) == NULL) {
- ipp_set_status(message, PAPI_TEMPORARY_ERROR,
- "Memory allocation failed");
- return (PAPI_TEMPORARY_ERROR);
- }
- if (iread(fd, string, size) != size) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "read failed: lang\n");
- return (PAPI_BAD_REQUEST);
- }
-
- /* read the text */
- if (iread(fd, &size, 2) != 2) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "read failed: text len\n");
- return (PAPI_BAD_REQUEST);
- }
- size = (uint16_t)ntohs(size);
-
- if ((string = alloca(size + 1)) == NULL) {
- ipp_set_status(message, PAPI_TEMPORARY_ERROR,
- "Memory allocation failed");
- return (PAPI_TEMPORARY_ERROR);
- }
- if (iread(fd, string, size) != size) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "read failed: text\n");
- return (PAPI_BAD_REQUEST);
- }
-
- return (PAPI_OK);
-}
-
-
-static struct {
- int8_t ipp_type;
- int8_t size;
-} type_info[] = {
- { VTAG_INTEGER, 4 },
- { VTAG_ENUM, 4 },
- { VTAG_BOOLEAN, 1 },
- { VTAG_RANGE_OF_INTEGER, 8 },
- { VTAG_RESOLUTION, 9 },
- { VTAG_DATE_TIME, 11 },
- { DTAG_MIN, 0 }
-};
-
-/* verify that the IPP type and size are compatible */
-static int
-validate_length(int8_t type, int8_t size)
-{
- int i;
-
- for (i = 0; type_info[i].ipp_type != DTAG_MIN; i++)
- if (type_info[i].ipp_type == type)
- return ((type_info[i].size == size) ? 0 : -1);
- return (0);
-}
-
-/* convert tyep IPP type to a type that is marginally compatible */
-static int8_t
-base_type(int8_t i)
-{
- switch (i) {
- case VTAG_ENUM:
- case VTAG_INTEGER:
- return (VTAG_INTEGER);
- case VTAG_URI:
- case VTAG_OCTET_STRING:
- case VTAG_TEXT_WITHOUT_LANGUAGE:
- case VTAG_URI_SCHEME:
- case VTAG_CHARSET:
- case VTAG_NATURAL_LANGUAGE:
- case VTAG_MIME_MEDIA_TYPE:
- case VTAG_NAME_WITHOUT_LANGUAGE:
- case VTAG_KEYWORD:
- return (VTAG_TEXT_WITHOUT_LANGUAGE);
- case VTAG_BOOLEAN:
- case VTAG_RANGE_OF_INTEGER:
- case VTAG_DATE_TIME:
- case VTAG_RESOLUTION:
- default:
- return (i);
- }
-}
-
-/* verify that the IPP type is correct for the named attribute */
-static papi_status_t
-validate_type(char *name, int8_t type)
-{
- int8_t t = name_to_ipp_type(name);
-
- if (t == 0) /* The attribute is not defined in the RFC */
- return (PAPI_NOT_FOUND);
- else if (t == type) /* The supplied type matched the RFC type */
- return (PAPI_OK);
- else { /* The supplied type doesn't match the RFC */
- if (base_type(t) == base_type(type))
- return (PAPI_OK);
-
- return (PAPI_CONFLICT);
- }
-}
-
-/* verify that the IPP value is within specification for the named attribute */
-static int
-validate_value(papi_attribute_t ***message, char *name, int8_t type, ...)
-{
-#define within(a, b, c) ((b >= a) && (b <= c))
- va_list ap;
- int rc = -1;
- int min = min_val_len(type, name),
- max = max_val_len(type, name);
- char buf[64]; /* For _ipp_<...>_string() */
-
- va_start(ap, type);
- switch (type) {
- case VTAG_ENUM:
- case VTAG_INTEGER: {
- int32_t i = (int32_t)va_arg(ap, int32_t);
-
- if (within(min, i, max))
- rc = 0;
- else
- ipp_set_status(message, PAPI_BAD_ARGUMENT,
- "%s(%s): %d: out of range (%d - %d)", name,
- _ipp_tag_string(type), i, min, max);
- }
- break;
- case VTAG_BOOLEAN: {
- int8_t v = (int8_t)va_arg(ap, int);
-
- if (within(0, v, 1))
- rc = 0;
- else
- ipp_set_status(message, PAPI_BAD_ARGUMENT,
- "%s(%s): %d: out of range (0 - 1)", name,
- _ipp_tag_string(type), v);
- }
- break;
- case VTAG_RANGE_OF_INTEGER: {
- int32_t lower = (int32_t)va_arg(ap, int32_t);
- int32_t upper = (int32_t)va_arg(ap, int32_t);
-
- if (within(min, lower, max) &&
- within(min, upper, max))
- rc = 0;
- else
- ipp_set_status(message, PAPI_BAD_ARGUMENT,
- "%s(%s): %d - %d: out of range (%d - %d)", name,
- _ipp_tag_string(type), lower, upper, min, max);
- }
- break;
- case VTAG_URI:
- case VTAG_OCTET_STRING:
- case VTAG_TEXT_WITHOUT_LANGUAGE:
- case VTAG_URI_SCHEME:
- case VTAG_CHARSET:
- case VTAG_NATURAL_LANGUAGE:
- case VTAG_MIME_MEDIA_TYPE:
- case VTAG_NAME_WITHOUT_LANGUAGE: {
- char *v = (char *)va_arg(ap, char *);
-
- if (strlen(v) < max)
- rc = 0;
- else
- ipp_set_status(message, PAPI_BAD_ARGUMENT,
- "%s(%s): %s: too long (max length: %d)", name,
- _ipp_tag_string(type), v, max);
- }
- break;
- case VTAG_KEYWORD: {
- char *v = (char *)va_arg(ap, char *);
-
- if (strlen(v) >= max)
- ipp_set_status(message, PAPI_BAD_ARGUMENT,
- "%s(%s): %s: too long (max length: %d)", name,
- _ipp_tag_string(type), v, max);
- else if (is_keyword(v) == 0)
- ipp_set_status(message, PAPI_BAD_ARGUMENT,
- "%s(%s): %s: invalid keyword", name,
- _ipp_tag_string(type), v);
- else
- rc = 0;
- }
- break;
- case VTAG_DATE_TIME:
- case VTAG_RESOLUTION:
- default:
- rc = 0;
- }
- va_end(ap);
-
- return (rc);
-#undef within
-}
-
-/*
- * read_attr_group() reads in enough of the message data to parse an entire
- * attribute group. Since to determine that the group is finished you have to
- * read the character that determines the type of the next group, this function
- * must return that character, in order that our caller knows how to call us for
- * the next group. Thus type is used both as an input parameter (the type of
- * attribute group to read in) and an output parameter (the type of the next
- * attribute group).
- */
-
-static papi_status_t
-ipp_read_attribute_group(ipp_reader_t iread, void *fd, int8_t *type,
- papi_attribute_t ***message)
-{
- int8_t value_tag;
- uint16_t name_length, value_length;
- papi_attribute_t **attributes = NULL;
- char *name = NULL;
- int i;
- char buf[64]; /* For _ipp_<...>_string() */
-
- /*
- * RFC2910 3.3 says we need to handle `An expected but missing
- * "begin-attribute-group-tag" field. How?
- */
- if (*type > DTAG_MAX) {
- /* Scream bloody murder, or assign a new type? */
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "Bad attribute group tag 0x%.2hx (%s)",
- *type, _ipp_tag_string(*type));
- return (PAPI_BAD_REQUEST);
- }
-
- /* This loops through *values* not *attributes*! */
- for (i = 0; ; i++) {
- papi_status_t valid = PAPI_OK;
- if (iread(fd, &value_tag, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: value tag\n");
- return (PAPI_BAD_REQUEST);
- }
- /* are we done with this group ? */
- if (value_tag <= DTAG_MAX)
- break;
-
- if (iread(fd, &name_length, 2) != 2) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: name length\n");
- return (PAPI_BAD_REQUEST);
- }
- name_length = (uint16_t)ntohs(name_length);
-
- /* Not just another value for the previous attribute */
- if (name_length != 0) {
- if ((name = alloca(name_length + 1)) == NULL) {
- ipp_set_status(message, PAPI_TEMPORARY_ERROR,
- "alloca(): failed\n");
- return (PAPI_TEMPORARY_ERROR);
- }
- (void) memset(name, 0, name_length + 1);
-
- if (iread(fd, name, name_length) != name_length) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: name\n");
- return (PAPI_BAD_REQUEST);
- }
- }
-
- valid = validate_type(name, value_tag);
- if ((valid != PAPI_OK) && (valid != PAPI_NOT_FOUND))
- ipp_set_status(message, valid, "%s(%s): %s", name,
- _ipp_tag_string(value_tag),
- papiStatusString(valid));
-
- if (iread(fd, &value_length, 2) != 2) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: value length\n");
- return (PAPI_BAD_REQUEST);
- }
- value_length = (uint16_t)ntohs(value_length);
-
- if (validate_length(value_tag, value_length) < 0) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "Bad value length (%d) for type %s",
- value_length, _ipp_tag_string(value_tag));
- return (PAPI_BAD_REQUEST);
- }
-
- switch (value_tag) {
- case VTAG_INTEGER:
- case VTAG_ENUM: {
- int32_t v;
-
- if (iread(fd, &v, value_length) != value_length) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: int/enum\n");
- return (PAPI_BAD_REQUEST);
- }
- v = (int32_t)ntohl(v);
- (void) validate_value(message, name, value_tag, v);
- papiAttributeListAddInteger(&attributes,
- PAPI_ATTR_APPEND, name, v);
-
- }
- break;
- case VTAG_BOOLEAN: {
- int8_t v;
-
- if (iread(fd, &v, value_length) != value_length) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: boolean\n");
- return (PAPI_BAD_REQUEST);
- }
- (void) validate_value(message, name, value_tag, v);
- papiAttributeListAddBoolean(&attributes,
- PAPI_ATTR_APPEND, name, v);
- }
- break;
- case VTAG_RANGE_OF_INTEGER: {
- int32_t min, max;
-
- if (iread(fd, &min, 4) != 4) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: min\n");
- return (PAPI_BAD_REQUEST);
- }
- if (iread(fd, &max, 4) != 4) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: max\n");
- return (PAPI_BAD_REQUEST);
- }
- min = (int32_t)ntohl(min);
- max = (int32_t)ntohl(max);
- (void) validate_value(message, name, value_tag,
- min, max);
- papiAttributeListAddRange(&attributes, PAPI_ATTR_APPEND,
- name, min, max);
- }
- break;
- case VTAG_RESOLUTION: {
- int32_t x, y;
- int8_t units;
-
- if (iread(fd, &x, 4) != 4) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: x\n");
- return (PAPI_BAD_REQUEST);
- }
- if (iread(fd, &y, 4) != 4) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: y\n");
- return (PAPI_BAD_REQUEST);
- }
- if (iread(fd, &units, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: units\n");
- return (PAPI_BAD_REQUEST);
- }
- x = (int32_t)ntohl(x);
- y = (int32_t)ntohl(y);
- papiAttributeListAddResolution(&attributes,
- PAPI_ATTR_APPEND, name, x, y,
- (papi_resolution_unit_t)units);
- }
- break;
- case VTAG_DATE_TIME: {
- struct tm tm;
- time_t v;
- int8_t c;
- uint16_t s;
-
- (void) memset(&tm, 0, sizeof (tm));
- if (iread(fd, &s, 2) != 2) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: year\n");
- return (PAPI_BAD_REQUEST);
- }
- tm.tm_year = (uint16_t)ntohs(s) - 1900;
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: month\n");
- return (PAPI_BAD_REQUEST);
- }
- tm.tm_mon = c - 1;
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: day\n");
- return (PAPI_BAD_REQUEST);
- }
- tm.tm_mday = c;
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: hour\n");
- return (PAPI_BAD_REQUEST);
- }
- tm.tm_hour = c;
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: minutes\n");
- return (PAPI_BAD_REQUEST);
- }
- tm.tm_min = c;
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: seconds\n");
- return (PAPI_BAD_REQUEST);
- }
- tm.tm_sec = c;
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: decisec\n");
- return (PAPI_BAD_REQUEST);
- }
- /* tm.deciseconds = c; */
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: utc_dir\n");
- return (PAPI_BAD_REQUEST);
- }
- /* tm.utc_dir = c; */
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: utc_hour\n");
- return (PAPI_BAD_REQUEST);
- }
- /* tm.utc_hours = c; */
- if (iread(fd, &c, 1) != 1) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: utc_min\n");
- return (PAPI_BAD_REQUEST);
- }
- /* tm.utc_minutes = c; */
-
- v = mktime(&tm);
-
- (void) validate_value(message, name, value_tag, v);
- papiAttributeListAddDatetime(&attributes,
- PAPI_ATTR_APPEND, name, v);
- }
- break;
- case VTAG_NAME_WITH_LANGUAGE:
- case VTAG_TEXT_WITH_LANGUAGE:
- /*
- * we are dropping this because we don't support
- * name with language at this time.
- */
- (void) read_name_with_language(iread, fd, message);
- break;
- case VTAG_NAME_WITHOUT_LANGUAGE:
- case VTAG_TEXT_WITHOUT_LANGUAGE:
- case VTAG_URI:
- case VTAG_KEYWORD:
- case VTAG_CHARSET: {
- char *v;
-
- if ((v = calloc(1, value_length + 1)) == NULL) {
- ipp_set_status(message, PAPI_TEMPORARY_ERROR,
- "calloc(): failed\n");
- return (PAPI_TEMPORARY_ERROR);
- }
-#ifdef NOTDEF
- if (iread(fd, v, value_length) != value_length) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: stringy\n");
- return (PAPI_BAD_REQUEST);
- }
-#else
- {
- int rc, i = value_length;
- char *p = v;
-
- while ((rc = iread(fd, p, i)) != i) {
- if (rc <= 0) {
- ipp_set_status(message,
- PAPI_BAD_REQUEST,
- "bad read: stringy\n");
- return (PAPI_BAD_REQUEST);
- }
- i -= rc;
- p += rc;
- }
- }
-#endif
- (void) validate_value(message, name, value_tag, v);
- papiAttributeListAddString(&attributes,
- PAPI_ATTR_APPEND, name, v);
- }
- break;
- case VTAG_UNKNOWN:
- case VTAG_NOVALUE:
- case VTAG_UNSUPPORTED:
- papiAttributeListAddValue(&attributes, PAPI_ATTR_EXCL,
- name, PAPI_COLLECTION, NULL);
- break;
- default: {
- char *v;
-
- if ((v = calloc(1, value_length + 1)) == NULL) {
- ipp_set_status(message, PAPI_TEMPORARY_ERROR,
- "calloc(): failed\n");
- return (PAPI_TEMPORARY_ERROR);
- }
- if (iread(fd, v, value_length) != value_length) {
- ipp_set_status(message, PAPI_BAD_REQUEST,
- "bad read: other\n");
- return (PAPI_BAD_REQUEST);
- }
- papiAttributeListAddString(&attributes,
- PAPI_ATTR_APPEND, name, v);
- }
- break;
- }
- }
-
- if (attributes != NULL) {
- char name[32];
-
- (void) ipp_tag_string(*type, name, sizeof (name));
- papiAttributeListAddCollection(message, PAPI_ATTR_APPEND, name,
- attributes);
- }
-
- *type = value_tag;
-
- return (PAPI_OK);
-}
-
-
-static papi_status_t
-ipp_read_header(ipp_reader_t iread, void *fd, papi_attribute_t ***message,
- char type)
-{
- char *attr_name = "status-code"; /* default to a response */
- char buf[8];
- int8_t c;
- uint16_t s;
- int32_t i;
-
- if ((iread == NULL) || (fd == NULL) || (message == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /*
- * Apache 1.X uses the buffer supplied to it's read call to read in
- * the chunk size when chunking is used. This causes problems
- * reading the header a piece at a time, because we don't have
- * enough room to read in the chunk size prior to reading the
- * chunk.
- */
-
- if (iread(fd, buf, 8) != 8)
- return (PAPI_BAD_REQUEST);
-
- c = buf[0];
- (void) papiAttributeListAddInteger(message, PAPI_ATTR_REPLACE,
- "version-major", c);
-
- c = buf[1];
- (void) papiAttributeListAddInteger(message, PAPI_ATTR_REPLACE,
- "version-minor", c);
-
- memcpy(&s, &buf[2], 2);
- s = (uint16_t)ntohs(s);
- if (type == IPP_TYPE_REQUEST)
- attr_name = "operation-id";
- (void) papiAttributeListAddInteger(message, PAPI_ATTR_REPLACE,
- attr_name, s);
-
- memcpy(&i, &buf[4], 4);
- i = (uint32_t)ntohl(i);
- (void) papiAttributeListAddInteger(message, PAPI_ATTR_REPLACE,
- "request-id", i);
-
- return (PAPI_OK);
-}
-
-static papi_status_t
-ipp_read_attribute_groups(ipp_reader_t iread, void *fd,
- papi_attribute_t ***message)
-{
- papi_status_t result = PAPI_OK;
- int8_t tag;
-
- /* start reading the attribute groups */
- if (iread(fd, &tag, 1) != 1) /* prime the pump */
- return (PAPI_BAD_REQUEST);
-
- while ((tag != DTAG_END_OF_ATTRIBUTES) && (result == PAPI_OK)) {
- result = ipp_read_attribute_group(iread, fd, &tag, message);
- }
-
- return (result);
-}
-
-papi_status_t
-ipp_read_message(ipp_reader_t iread, void *fd, papi_attribute_t ***message,
- char type)
-{
- papi_status_t result = PAPI_OK;
-
- if ((iread == NULL) || (fd == NULL) || (message == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- result = ipp_read_header(iread, fd, message, type);
- if (result == PAPI_OK)
- result = ipp_read_attribute_groups(iread, fd, message);
-
- return (result);
-}
diff --git a/usr/src/lib/print/libipp-core/common/strings.c b/usr/src/lib/print/libipp-core/common/strings.c
deleted file mode 100644
index b47449b8cc..0000000000
--- a/usr/src/lib/print/libipp-core/common/strings.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: strings.c 151 2006-04-25 16:55:34Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "ipp.h"
-
-static char *tag_strings[] = {
- /* delimiter tags */
- "reserved-delimiter-00",
- "operational-attributes-group",
- "job-attributes-group",
- "end-of-attributes-group",
- "printer-attributes-group",
- "unsupported-attributes-group",
- "subscription-attributes-group",
- "event-notification-attributes-group",
- "reserved-delimiter-08",
- "reserved-delimiter-09",
- "reserved-delimiter-0a",
- "reserved-delimiter-0b",
- "reserved-delimiter-0c",
- "reserved-delimiter-0d",
- "reserved-delimiter-0e",
- "reserved-delimiter-0f",
- /* value tags */
- "unsupported",
- "reserved-default",
- "unknown",
- "no-value",
- "reserved-out-of-band-14",
- "not-settable",
- "delete-attribute",
- "admin-define",
- "reserved-out-of-band-18",
- "reserved-out-of-band-19",
- "reserved-out-of-band-1a",
- "reserved-out-of-band-1b",
- "reserved-out-of-band-1c",
- "reserved-out-of-band-1d",
- "reserved-out-of-band-1e",
- "reserved-out-of-band-1f",
- "reserved",
- "integer",
- "boolean",
- "enum",
- "reserved-integer-type-24",
- "reserved-integer-type-25",
- "reserved-integer-type-26",
- "reserved-integer-type-27",
- "reserved-integer-type-28",
- "reserved-integer-type-29",
- "reserved-integer-type-2a",
- "reserved-integer-type-2b",
- "reserved-integer-type-2c",
- "reserved-integer-type-2d",
- "reserved-integer-type-2e",
- "reserved-integer-type-2f",
- "octetString",
- "dateTime",
- "resolution",
- "rangeOfInteger",
- "begCollection",
- "textWithLanguage",
- "nameWithLanguage",
- "endCollection",
- "reserved-octetString-38",
- "reserved-octetString-39",
- "reserved-octetString-3a",
- "reserved-octetString-3b",
- "reserved-octetString-3c",
- "reserved-octetString-3d",
- "reserved-octetString-3e",
- "reserved-octetString-3f",
- "reserved",
- "textWithoutLanguage",
- "nameWithoutLanguage",
- "reserved",
- "keyword",
- "uri",
- "uriScheme",
- "charset",
- "naturalLanguage",
- "mimeMediaType",
- "memberAttrName",
- "reserved-charString-4b",
- "reserved-charString-4c",
- "reserved-charString-4d",
- "reserved-charString-4e",
- "reserved-charString-4f",
- "reserved-charString-50",
- "reserved-charString-51",
- "reserved-charString-52",
- "reserved-charString-53",
- "reserved-charString-54",
- "reserved-charString-55",
- "reserved-charString-56",
- "reserved-charString-57",
- "reserved-charString-58",
- "reserved-charString-59",
- "reserved-charString-5a",
- "reserved-charString-5b",
- "reserved-charString-5c",
- "reserved-charString-5d",
- "reserved-charString-5e",
- "reserved-charString-5f",
-};
-
-static char *opid_strings[] = {
- "reserved-0x0000",
- "reserved-0x0001",
- "Print-Job",
- "Print-URI",
- "Validate-Job",
- "Create-Job",
- "Send-Document",
- "Send-URI",
- "Cancel-Job",
- "Get-Job-Attributes",
- "Get-Jobs",
- "Get-Printer-Attributes",
- "Hold-Job",
- "Release-Job",
- "Restart-Job",
- "reserved-0x000f",
- "Pause-Printer",
- "Resume-Printer",
- "Purge-Jobs",
- "Set-Printer-Attributes",
- "Set-Job-Attributes",
- "Get-Printer-Supported-Values",
- "Create-Printer-Subscription",
- "Create-Job-Subscription",
- "Get-Subscription-Attributes",
- "Get-Subscriptions",
- "Renew-Subscription",
- "Cancel-Subscription",
- "Get-Notifications",
- "Send-Notifications",
- "Get-Resource-Attributes-deleted",
- "Get-Resource-Data-deleted",
- "Get-Resources-deleted",
- "Get-Print-Support-Files",
- "Disable-Printer",
- "Pause-Printer-After-Current-Job",
- "Hold-New-Jobs",
- "Release-Held-New-Jobs",
- "Deactivate-Printer",
- "Activate-Printer",
- "Restart-Printer",
- "Shutdown-Printer",
- "Startup-Printer",
- "Reprocess-Job",
- "Cancel-Current-Job",
- "Suspend-Current-Job",
- "Resume-Job",
- "Promote-Job",
- "Schedule-Job-After",
- NULL
-};
-
-static char *res_opid_strings[] = {
- "Microsoft-0x4000",
- "CUPS-Get-Default",
- "CUPS-Get-Printers",
- "CUPS-Add-Printer",
- "CUPS-Delete-Printer",
- "CUPS-Get-Classes",
- "CUPS-Add-Class",
- "CUPS-Delete-Class",
- "CUPS-Accept-Jobs",
- "CUPS-Reject-Jobs",
- "CUPS-Set-Default",
- "CUPS-Get-Devices",
- "CUPS-Get-PPDs",
- "CUPS-Move-Job",
- "CUPS-0x400e",
- "CUPS-0x400f",
- "Peerless-0x4010",
- NULL
-};
-#define KNOWN_RESERVED_MIN 0x4000
-#define KNOWN_RESERVED_MAX 0x4010
-
-static char *ok_status_strings[] = {
- "successful-ok",
- "successful-ok-ignored-or-substituted-attributes",
- "successful-ok-conflicting-attributes",
- "successful-ok-ignored-subscriptions",
- "successful-ok-ignored-notifications",
- "successful-ok-too-many-events",
- "successful-ok-but-cancel-subscription"
-};
-
-static char *redir_status_strings[] = {
- "redirection-other-site"
-};
-
-static char *client_error_status_strings[] = {
- "client-error-bad-request",
- "client-error-forbidden",
- "client-error-not-authenticated",
- "client-error-not-authorized",
- "client-error-not-possible",
- "client-error-timeout",
- "client-error-not-found",
- "client-error-gone",
- "client-error-request-entity-too-large",
- "client-error-request-value-too-long",
- "client-error-document-format-not-supported",
- "client-error-attributes-or-values-not-supported",
- "client-error-uri-scheme-not-supported",
- "client-error-charset-not-supported",
- "client-error-conflicting-attributes",
- "client-error-compression-not-supported",
- "client-error-compression-error",
- "client-error-document-format-error",
- "client-error-document-access-error",
- "client-error-attributes-not-settable",
- "client-error-ignored-all-subscriptions",
- "client-error-too-many-subscriptions",
- "client-error-ignored-all-notifications",
- "client-error-print-support-file-not-found"
-};
-
-static char *server_error_status_strings[] = {
- "server-error-internal-error",
- "server-error-operation-not-supported",
- "server-error-service-unavailable",
- "server-error-version-not-supported",
- "server-error-device-error",
- "server-error-temporary-error",
- "server-error-not-accepting-jobs",
- "server-error-busy",
- "server-error-job-canceled",
- "server-error-multiple-document-jobs-not-supported",
- "server-error-printer-is-deactivated"
-};
-
-char *
-ipp_tag_string(int8_t id, char *ret, size_t len)
-{
- if (id < VTAG_MAX)
- (void) strlcpy(ret, tag_strings[id], len);
- else if (id == VTAG_EXTEND)
- (void) strlcpy(ret, "extension", len);
- else
- (void) snprintf(ret, len, "bogus-0x%.2x", id);
-
- return (ret);
-}
-
-char *
-ipp_opid_string(int16_t id, char *ret, size_t len)
-{
- if (id < OPID_RESERVED_MIN)
- (void) strlcpy(ret, opid_strings[id], len);
- else if (id < OPID_RESERVED_VENDOR_MIN)
- (void) snprintf(ret, len, "reserved-0x%.4x", id);
- else if (id <= KNOWN_RESERVED_MAX)
- (void) strlcpy(ret,
- res_opid_strings[id - KNOWN_RESERVED_MIN], len);
- else /* if (id <= OPID_RESERVED_VENDOR_MAX) */
- (void) snprintf(ret, len, "reserved-vendor-0x%.4x", id);
-
- return (ret);
-}
-
-int16_t
-ipp_string_opid(char *string)
-{
- int i;
-
- for (i = 0; opid_strings[i] != NULL; i++)
- if (strcasecmp(opid_strings[i], string) == 0)
- return (i);
-
- for (i = 0; res_opid_strings[i] != NULL; i++)
- if (strcasecmp(res_opid_strings[i], string) == 0)
- return (0x4000 + i);
-
- return (-1);
-}
-
-char *
-ipp_status_string(int16_t id, char *ret, size_t len)
-{
- if (id <= IPP_OK_MAX)
- (void) strlcpy(ret, ok_status_strings[id], len);
- else if (id >= IPP_REDIR_MIN && id <= IPP_REDIR_MAX)
- (void) strlcpy(ret,
- redir_status_strings[id - IPP_REDIR_MIN], len);
- else if (id >= IPP_CERR_MIN && id <= IPP_CERR_MAX)
- (void) strlcpy(ret,
- client_error_status_strings[id - IPP_CERR_MIN], len);
- else if (id >= IPP_SERR_MIN && id <= IPP_SERR_MAX)
- (void) strlcpy(ret,
- server_error_status_strings[id - IPP_SERR_MIN], len);
- else
- (void) snprintf(ret, len, "bogus-0x%.4hx", id);
-
- return (ret);
-}
-
-
-
-/*
- * attribute template handling routines
- */
-char *job_template[] = {
- "copies",
- "finishing",
- "job-hold-until",
- "job-priority",
- "job-sheets",
- "media",
- "multiple-document-handling",
- "number-up",
- "page-ranges-supported",
- "print-quality",
- "printer-resoultion",
- "sides",
- NULL
-};
-
-char *job_description[] = {
- "copies-default", "copies-supported",
- "finishing-default", "finishing-supported",
- "job-hold-until-default", "job-hold-until-supported",
- "job-priority-default", "job-priority-supported",
- "job-sheets-default", "job-sheets-supported",
- "media-default", "media-supported",
- "multiple-document-handling-default",
- "multiple-document-handling-supported",
- "number-up-default", "number-up-supported",
- "page-ranges-supported",
- "print-quality-default", "print-quality-supported",
- "printer-resoultion-default", "printer-resoultion-supported",
- "sides-default", "sides-supported",
- NULL
-};
-
-char *printer_description[] = {
- "printer-uri-supported",
- "uri-security-supported",
- "uri-authentication-supported",
- "printer-name",
- "printer-location",
- "printer-info",
- "printer-more-info",
- "printer-driver-installer",
- "printer-make-and-model",
- "printer-more-info-manufacturer",
- "printer-state",
- "printer-state-reasons",
- "printer-state-message",
- "ipp-versions-supported",
- "multiple-document-jobs-supported",
- "charset-configured",
- "charset-supported",
- "natural-language-configured",
- "generated-natural-language-supported",
- "document-format-default",
- "document-format-supported",
- "printer-is-accepting-jobs",
- "queued-job-count",
- "printer-message-from-operator",
- "color-supported",
- "reference-uri-schemes-supported",
- "pdl-override-supported",
- "printer-up-time",
- "printer-current-time",
- "multiple-operation-time-out",
- "compression-supported",
- "job-k-octets-supported",
- "job-impressions-supported",
- "job-media-sheets-supported",
- "pages-per-minute",
- "pages-per-minute-color",
- NULL
-};
diff --git a/usr/src/lib/print/libipp-core/common/write.c b/usr/src/lib/print/libipp-core/common/write.c
deleted file mode 100644
index aef693a365..0000000000
--- a/usr/src/lib/print/libipp-core/common/write.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: write.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <inttypes.h>
-
-#include <papi.h>
-#include <ipp.h>
-
-static int8_t
-papi_attribute_to_ipp_type(papi_attribute_value_type_t type)
-{
- switch (type) {
- case PAPI_INTEGER:
- return (VTAG_INTEGER);
- case PAPI_BOOLEAN:
- return (VTAG_BOOLEAN);
- case PAPI_RANGE:
- return (VTAG_RANGE_OF_INTEGER);
- case PAPI_RESOLUTION:
- return (VTAG_RESOLUTION);
- case PAPI_DATETIME:
- return (VTAG_DATE_TIME);
- case PAPI_STRING:
- return (VTAG_TEXT_WITHOUT_LANGUAGE);
- }
-
- return (0);
-}
-
-static papi_status_t
-papi_ipp_type_match(papi_attribute_value_type_t papi, int8_t ipp)
-{
- switch (papi) {
- case PAPI_STRING:
- switch (ipp) {
- case VTAG_URI:
- case VTAG_OCTET_STRING:
- case VTAG_TEXT_WITHOUT_LANGUAGE:
- case VTAG_URI_SCHEME:
- case VTAG_CHARSET:
- case VTAG_NATURAL_LANGUAGE:
- case VTAG_MIME_MEDIA_TYPE:
- case VTAG_NAME_WITHOUT_LANGUAGE:
- case VTAG_KEYWORD:
- break;
- default:
- return (PAPI_CONFLICT);
- }
- break;
- case PAPI_INTEGER:
- switch (ipp) {
- case VTAG_ENUM:
- case VTAG_INTEGER:
- break;
- default:
- return (PAPI_CONFLICT);
- }
- break;
- case PAPI_BOOLEAN:
- if (ipp != VTAG_BOOLEAN)
- return (PAPI_CONFLICT);
- break;
- case PAPI_RANGE:
- if (ipp != VTAG_RANGE_OF_INTEGER)
- return (PAPI_CONFLICT);
- break;
- case PAPI_RESOLUTION:
- if (ipp != VTAG_RESOLUTION)
- return (PAPI_CONFLICT);
- break;
- case PAPI_DATETIME:
- if (ipp != VTAG_DATE_TIME)
- return (PAPI_CONFLICT);
- break;
- case PAPI_COLLECTION:
- /* don't need to match */
- break;
- }
-
- return (PAPI_OK);
-}
-
-static papi_status_t
-ipp_write_attribute(ipp_writer_t iwrite, void *fd, papi_attribute_t *attribute)
-{
- papi_status_t status;
- papi_attribute_value_t **values;
- int8_t type;
- int i;
- char *name;
-
- name = attribute->name;
- values = attribute->values;
-
- if ((type = name_to_ipp_type(name)) == 0)
- type = papi_attribute_to_ipp_type(attribute->type);
-
- /* The types don't match, so don't send the attribute */
- if ((status = papi_ipp_type_match(attribute->type, type)) != PAPI_OK)
- return (status);
-
- if (values == NULL) {
- uint16_t length;
-
- type = VTAG_UNSUPPORTED;
- if (iwrite(fd, &type, 1) != 1)
- return (PAPI_DEVICE_ERROR);
-
- if (name != NULL) { /* first value gets named */
- length = (uint16_t)htons(strlen(name));
-
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, name, strlen(name)) != strlen(name))
- return (PAPI_DEVICE_ERROR);
- }
-
- length = (uint16_t)htons(0);
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
-
- return (PAPI_OK);
- }
-
-
-
- for (i = 0; values[i] != NULL; i++) {
- papi_attribute_value_t *value = values[i];
- uint16_t length = 0;
-
- if (iwrite(fd, &type, 1) != 1)
- return (PAPI_DEVICE_ERROR);
-
- if (name != NULL) { /* first value gets named */
- length = (uint16_t)htons(strlen(name));
-
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, name, strlen(name)) != strlen(name))
- return (PAPI_DEVICE_ERROR);
- name = NULL;
- } else {
- length = (uint16_t)htons(0);
-
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- }
-
- switch (attribute->type) {
- case PAPI_STRING: {
- char *v = (char *)value->string;
-
- if (v != NULL) {
- size_t str_length = strlen(v);
-
- /*
- * if the length is more than 16 bits can
- * express, send what can be represented
- * in 16 bits. IPP "strings" can only be
- * that large.
- */
- if (str_length > 0xFFFF)
- str_length = 0xFFFF;
-
- length = (uint16_t)htons(str_length);
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, v, str_length) != str_length)
- return (PAPI_DEVICE_ERROR);
- } else
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- }
- break;
- case PAPI_BOOLEAN: {
- int8_t v = (int8_t)value->boolean;
-
- length = (uint16_t)htons(1);
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, &v, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- }
- break;
- case PAPI_INTEGER: {
- int32_t v = (int32_t)value->integer;
-
- length = (uint16_t)htons(4);
- v = (int32_t)htonl(v);
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, &v, 4) != 4)
- return (PAPI_DEVICE_ERROR);
- }
- break;
- case PAPI_RANGE: {
- int32_t min = (int32_t)htonl((int)(value->range).lower),
- max = (int32_t)htonl((int)(value->range).upper);
-
- length = (uint16_t)htons(8);
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, &min, 4) != 4)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, &max, 4) != 4)
- return (PAPI_DEVICE_ERROR);
- }
- break;
- case PAPI_RESOLUTION: {
- int32_t x = (int)(value->resolution).xres,
- y = (int)(value->resolution).yres;
- int8_t units = (int8_t)(value->resolution).units;
-
- length = (uint16_t)htons(9);
- x = (int32_t)htonl(x);
- y = (int32_t)htonl(y);
-
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, &x, 4) != 4)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, &y, 4) != 4)
- return (PAPI_DEVICE_ERROR);
- if (iwrite(fd, &units, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- }
- break;
- case PAPI_DATETIME: {
- struct tm *v = gmtime(&value->datetime);
- int8_t c;
- uint16_t s;
-
- length = (uint16_t)htons(11);
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- s = (uint16_t)htons(v->tm_year + 1900);
- if (iwrite(fd, &s, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- c = v->tm_mon + 1;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- c = v->tm_mday;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- c = v->tm_hour;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- c = v->tm_min;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- c = v->tm_sec;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- c = /* v->deciseconds */ 0;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- c = /* v->utc_dir */ 0;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- c = /* v->utc_hours */ 0;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- c = /* v->utc_minutes */ 0;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
- }
- break;
- default: {
- /*
- * If there is a value, it is not one of our
- * types, so we couldn't use it anyway. We assume
- * that it was an OOB type with no value
- */
- length = (uint16_t)htons(0);
- if (iwrite(fd, &length, 2) != 2)
- return (PAPI_DEVICE_ERROR);
- }
- break;
- }
- }
-
- return (PAPI_OK);
-}
-
-static papi_status_t
-ipp_write_attribute_group(ipp_writer_t iwrite, void *fd, int8_t type,
- papi_attribute_t **attributes)
-{
- papi_status_t result = PAPI_OK;
- int i;
-
- /* write group tag */
- if (iwrite(fd, &type, 1) != 1)
- return (PAPI_DEVICE_ERROR);
-
- /* write values */
- for (i = 0; ((attributes[i] != NULL) && (result == PAPI_OK)); i++)
- result = ipp_write_attribute(iwrite, fd, attributes[i]);
-
- return (result);
-}
-
-static papi_status_t
-ipp_write_attribute_groups(ipp_writer_t iwrite, void *fd,
- papi_attribute_t **groups)
-{
- papi_status_t result = PAPI_OK;
- int8_t c;
-
- for (c = DTAG_MIN; c <= DTAG_MAX; c++) {
- papi_status_t status;
- papi_attribute_t **group = NULL;
- void *iter = NULL;
- char name[32];
-
- (void) ipp_tag_string(c, name, sizeof (name));
- for (status = papiAttributeListGetCollection(groups, &iter,
- name, &group);
- ((status == PAPI_OK) && (result == PAPI_OK));
- status = papiAttributeListGetCollection(groups, &iter,
- NULL, &group))
- result = ipp_write_attribute_group(iwrite, fd,
- c, group);
- }
-
- c = DTAG_END_OF_ATTRIBUTES;
- if (iwrite(fd, &c, 1) != 1)
- result = PAPI_DEVICE_ERROR;
-
- return (result);
-}
-
-static papi_status_t
-ipp_write_message_header(ipp_writer_t iwrite, void *fd,
- papi_attribute_t **message)
-{
- int tmp;
- int8_t c;
- uint16_t s;
- int32_t i;
-
- /* write the version */
- papiAttributeListGetInteger(message, NULL, "version-major", &tmp);
- c = tmp;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
-
- papiAttributeListGetInteger(message, NULL, "version-minor", &tmp);
- c = tmp;
- if (iwrite(fd, &c, 1) != 1)
- return (PAPI_DEVICE_ERROR);
-
- /* write the request/status code */
- papiAttributeListGetInteger(message, NULL, "status-code", &tmp);
- papiAttributeListGetInteger(message, NULL, "operation-id", &tmp);
- s = (uint16_t)htons(tmp);
- if (iwrite(fd, &s, 2) != 2)
- return (PAPI_DEVICE_ERROR);
-
- /* write the request id */
- papiAttributeListGetInteger(message, NULL, "request-id", &tmp);
- i = (uint32_t)htonl(tmp);
- if (iwrite(fd, &i, 4) != 4)
- return (PAPI_DEVICE_ERROR);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-ipp_write_message(ipp_writer_t iwrite, void *fd, papi_attribute_t **message)
-{
- papi_status_t result;
-
- if ((iwrite == NULL) || (fd == NULL) || (message == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- result = ipp_write_message_header(iwrite, fd, message);
- if (result == PAPI_OK)
- result = ipp_write_attribute_groups(iwrite, fd, message);
-
- return (result);
-}
diff --git a/usr/src/lib/print/libipp-listener/Makefile b/usr/src/lib/print/libipp-listener/Makefile
deleted file mode 100644
index b92d620b10..0000000000
--- a/usr/src/lib/print/libipp-listener/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.lib
-
-#HDRS = papi.h
-#HDRDIR = common
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all clean clobber install: .WAIT $(SUBDIRS)
-
-lint: # $(SUBDIRS)
-
-install_h: # $(ROOTHDRS)
-
-check: # $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/libipp-listener/Makefile.com b/usr/src/lib/print/libipp-listener/Makefile.com
deleted file mode 100644
index 4db2966ceb..0000000000
--- a/usr/src/lib/print/libipp-listener/Makefile.com
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#
-
-LIBRARY = libipp-listener.a
-VERS = .0
-OBJECTS = \
- cancel-job.o common.o create-job.o cups-accept-jobs.o \
- cups-get-classes.o cups-get-default.o cups-get-printers.o \
- cups-move-job.o cups-reject-jobs.o disable-printer.o enable-printer.o \
- get-job-attributes.o get-jobs.o get-printer-attributes.o hold-job.o \
- ipp-listener.o pause-printer.o print-job.o purge-jobs.o release-job.o \
- restart-job.o resume-printer.o send-document.o set-job-attributes.o \
- set-printer-attributes.o validate-job.o
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
-
-SRCDIR = ../common
-
-ROOTLIBDIR= $(ROOT)/usr/lib
-
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -DSOLARIS_PRIVATE_POST_0_9
-CPPFLAGS += -I$(SRCDIR)
-CPPFLAGS += -I../../libpapi-common/common
-CPPFLAGS += -I../../libipp-core/common
-
-CERRWARN += -_gcc=-Wno-unused-variable
-CERRWARN += -_gcc=-Wno-uninitialized
-
-MAPFILES = $(SRCDIR)/mapfile
-
-LDLIBS += -lipp-core -lpapi -lc -lsocket -lnsl
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-lint: lintcheck
-
-include ../../../Makefile.targ
diff --git a/usr/src/lib/print/libipp-listener/common/cancel-job.c b/usr/src/lib/print/libipp-listener/common/cancel-job.c
deleted file mode 100644
index 49ad1980f8..0000000000
--- a/usr/src/lib/print/libipp-listener/common/cancel-job.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: cancel-job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_cancel_job(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *message = NULL;
- char *queue = NULL;
- int id = -1;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * the operational-attributes-group must contain:
- * job-uri (or printer-uri/job-id)
- */
- get_printer_id(operational, &queue, &id);
- if (id < 0) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-uri or job-id");
- return (PAPI_BAD_REQUEST);
- } else if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * the operational-attributes-group may contain:
- * message
- */
- (void) papiAttributeListGetString(operational, NULL,
- "message", &message);
-
- status = papiJobCancel(svc, queue, id);
- if (status != PAPI_OK) {
- ipp_set_status(response, status,
- "cancel failed: %s-%d: %s",
- (queue ? queue : "(null)"), id,
- ipp_svc_status_mesg(svc, status));
- } else if (message != NULL) { /* add unsupported attribute group */
- papi_attribute_t **unsupported = NULL;
-
- papiAttributeListAddValue(&unsupported, PAPI_ATTR_EXCL,
- "message", PAPI_COLLECTION, NULL);
- (void) papiAttributeListAddCollection(response,
- PAPI_ATTR_REPLACE, "unsupported-attributes-group",
- unsupported);
- papiAttributeListFree(unsupported);
-
- status = PAPI_OK_SUBST;
- ipp_set_status(response, status,
- "unsupported attribute in request");
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/common.c b/usr/src/lib/print/libipp-listener/common/common.c
deleted file mode 100644
index a8fbe45098..0000000000
--- a/usr/src/lib/print/libipp-listener/common/common.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: common.c 155 2006-04-26 02:34:54Z ktou $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <papi.h>
-#include <ipp-listener.h>
-
-char *
-ipp_svc_status_mesg(papi_service_t svc, papi_status_t status)
-{
- char *mesg = papiServiceGetStatusMessage(svc);
-
- if (mesg == NULL)
- mesg = papiStatusString(status);
-
- return (mesg);
-}
-
-char *
-destination_from_printer_uri(char *uri)
-{
- static char buf[64];
- char *result = NULL;
-
- if (uri != NULL)
- result = strrchr(uri, '/');
-
- if (result == NULL)
- result = uri;
- else
- result++;
-
-#ifdef FORCE_LPSCHED_URI
- snprintf(buf, sizeof (buf), "lpsched://localhost/printers/%s", result);
- result = buf;
-#endif /* FORCE_LPSCHED_URI */
-
- return (result);
-}
-
-void
-get_printer_id(papi_attribute_t **attributes, char **printer, int *id)
-{
- papi_status_t result;
- char *job = NULL;
- char *fodder;
- int junk;
-
- if (printer == NULL)
- printer = &fodder;
- if (id == NULL)
- id = &junk;
-
- *printer = NULL;
- *id = -1;
-
- result = papiAttributeListGetString(attributes, NULL, "job-uri", &job);
- if (result != PAPI_OK) {
- result = papiAttributeListGetString(attributes, NULL,
- "printer-uri", printer);
- if (result == PAPI_OK)
- papiAttributeListGetInteger(attributes, NULL,
- "job-id", id);
- } else {
- *printer = job;
- if ((job = strrchr(*printer, '/')) != NULL) {
- *job = '\0';
- *id = atoi(++job);
- }
- }
-}
-
-void
-get_string_list(papi_attribute_t **attributes, char *name, char ***values)
-{
- papi_status_t result;
-
- void *iterator = NULL;
- char *value = NULL;
-
- for (result = papiAttributeListGetString(attributes, &iterator,
- name, &value);
- result == PAPI_OK;
- result = papiAttributeListGetString(attributes, &iterator,
- NULL, &value))
- list_append(values, value);
-}
-
-void
-add_default_attributes(papi_attribute_t ***attributes)
-{
-
- (void) papiAttributeListAddString(attributes, PAPI_ATTR_APPEND,
- "ipp-versions-supported", "1.0");
- (void) papiAttributeListAddString(attributes, PAPI_ATTR_APPEND,
- "ipp-versions-supported", "1.1");
- (void) papiAttributeListAddBoolean(attributes, PAPI_ATTR_EXCL,
- "multiple-document-jobs-supported", 0);
- /*
- * Should be able to ask the web server if it supports SSL or TLS, but
- * for now, we pick only "none"
- */
- (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
- "uri-security-supported", "none");
-
- /*
- * For now, we only "none". As we support more authentication methods,
- * we will need to add the associated uri for each. Valid values would
- * be:
- * "none", "requesting-user-name", "basic", "digest", "certificate"
- * See RFC2911 page 127 for more information.
- */
- (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
- "uri-authentication-supported", "requesting-user-name");
- (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
- "uri-security-supported", "none");
- /* printer-uri-supported is added in the service based attributes */
-
- (void) papiAttributeListAddInteger(attributes, PAPI_ATTR_EXCL,
- "multiple-operation-time-out", 60);
-
- /* I18N related */
- (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
- "charset-configured", "utf-8");
- (void) papiAttributeListAddString(attributes, PAPI_ATTR_EXCL,
- "charset-supported", "utf-8");
- (void) papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "natural-language-configured", "en-us");
-}
-
-static void
-massage_printer_attributes_group(papi_attribute_t **group, char *printer_uri)
-{
- if (papiAttributeListFind(group, "printer-uri-supported") != NULL)
- papiAttributeListAddString(&group, PAPI_ATTR_REPLACE,
- "printer-uri-supported", printer_uri);
-}
-
-static void
-massage_job_attributes_group(papi_attribute_t **group, char *printer_uri)
-{
- if (papiAttributeListFind(group, "job-printer-uri") != NULL)
- papiAttributeListAddString(&group, PAPI_ATTR_REPLACE,
- "job-printer-uri", printer_uri);
-
- if (papiAttributeListFind(group, "job-printer-uri") != NULL) {
- char buf[BUFSIZ];
- int32_t id = -1;
-
- papiAttributeListGetInteger(group, NULL, "job-id", &id);
- snprintf(buf, sizeof (buf), "%s/%d", printer_uri, id);
- papiAttributeListAddString(&group, PAPI_ATTR_REPLACE,
- "job-uri", buf);
- }
-}
-
-/*
- * This function will replace the job/printer URIs with the requested
- * uri because the print service may return a URI that isn't IPP based.
- */
-void
-massage_response(papi_attribute_t **request, papi_attribute_t **response)
-{
- papi_status_t status;
- papi_attribute_t **group = NULL;
- void *iter = NULL;
- char *host = "localhost";
- char *path = "/printers/";
- int port = 631;
- char buf[BUFSIZ];
-
- (void) papiAttributeListGetString(request, NULL, "uri-host", &host);
- (void) papiAttributeListGetString(request, NULL, "uri-path", &path);
- (void) papiAttributeListGetInteger(request, NULL, "uri-port", &port);
-
- if (port == 631)
- snprintf(buf, sizeof (buf), "ipp://%s%s", host, path);
- else
- snprintf(buf, sizeof (buf), "http://%s:%d%s", host, port, path);
-
- for (status = papiAttributeListGetCollection(response, &iter,
- "printer-attributes-group", &group);
- status == PAPI_OK;
- status = papiAttributeListGetCollection(NULL, &iter,
- NULL, &group))
- massage_printer_attributes_group(group, buf);
-
- iter = NULL;
- for (status = papiAttributeListGetCollection(response, &iter,
- "job-attributes-group", &group);
- status == PAPI_OK;
- status = papiAttributeListGetCollection(NULL, &iter,
- NULL, &group))
- massage_job_attributes_group(group, buf);
-}
-
-/*
- * This walks through the locale tab and returns the installed
- * locales. There must be a better way.
- */
-void
-add_supported_locales(papi_attribute_t ***attributes)
-{
- FILE *fp;
-
- papiAttributeListAddString(attributes, PAPI_ATTR_REPLACE,
- "generated-natural-language-supported", "en-us");
-
-#ifndef __linux__ /* this is Solaris specific */
- if ((fp = fopen("/usr/lib/locale/lcttab", "r")) != NULL) {
- char buf[1024];
-
- while (fgets(buf, sizeof (buf), fp) != NULL) {
- char *name, *file;
- int i, passed = 1;
-
- name = strtok(buf, " \t\n");
-
- for (i = 0; ((passed == 1) && (name[i] != NULL)); i++)
- if (isalpha(name[i]) != 0)
- name[i] = tolower(name[i]);
- else if ((name[i] == '_') || (name[i] == '-'))
- name[i] = '-';
- else
- passed = 0;
-
- if ((passed == 1) &&
- ((file = strtok(NULL, " \t\n")) != NULL)) {
- char path[1024];
-
- snprintf(path, sizeof (path),
- "/usr/lib/locale/%s", file);
-
- if (access(path, F_OK) == 0)
- papiAttributeListAddString(attributes,
- PAPI_ATTR_APPEND,
- "generated-natural-language-supported",
- name);
- }
- }
- }
-#endif
-}
-
-void
-papi_to_ipp_printer_group(papi_attribute_t ***response,
- papi_attribute_t **request, int flags, papi_printer_t p)
-{
- papi_attribute_t **ipp_group = NULL;
-
- copy_attributes(&ipp_group, papiPrinterGetAttributeList(p));
-
- /* Windows clients appear to have a problem with very large values */
- papiAttributeListDelete(&ipp_group, "lpsched-printer-ppd-contents");
-
- add_default_attributes(&ipp_group);
- ipp_operations_supported(&ipp_group, request);
-
- (void) papiAttributeListAddCollection(response, flags,
- "printer-attributes-group", ipp_group);
- papiAttributeListFree(ipp_group);
-}
-
-void
-papi_to_ipp_job_group(papi_attribute_t ***response,
- papi_attribute_t **request, int flags, papi_job_t j)
-{
- papi_attribute_t **ipp_group = NULL;
-
- copy_attributes(&ipp_group, papiJobGetAttributeList(j));
-
- (void) papiAttributeListAddCollection(response, flags,
- "job-attributes-group", ipp_group);
- papiAttributeListFree(ipp_group);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/create-job.c b/usr/src/lib/print/libipp-listener/common/create-job.c
deleted file mode 100644
index 996b235cea..0000000000
--- a/usr/src/lib/print/libipp-listener/common/create-job.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: create-job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_create_job(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_job_t j = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **job_attributes = NULL;
- char *queue = NULL;
- char *keys[] = { "attributes-natural-language", "attributes-charset",
- "printer-uri", NULL };
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * The operational-attributes-group may contain:
- * job-name
- * ipp-attribute-fidelity
- * document-name
- * compression
- * document-format
- * document-natural-language
- * job-k-octets
- * job-impressions
- * job-media-sheets
- * Simply copy the entire contents of the operational-attributes-group
- * for the PAPI call's possible use.
- */
-
- /* copy the pointers only, not the elements */
- split_and_copy_attributes(keys, operational, NULL, &job_attributes);
-
- /* copy any job-attributes-group attributes for the PAPI call */
- if (papiAttributeListGetCollection(request, NULL,
- "job-attributes-group", &operational) == PAPI_OK)
- copy_attributes(&job_attributes, operational);
-
- /*
- * request job creation, using Sun extention to PAPI. The
- * functionality in this extension is expected to make the
- * next revision of the PAPI.
- */
- status = papiJobCreate(svc, queue, job_attributes, NULL, &j);
- papiAttributeListFree(job_attributes);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "job creation: %s",
- ipp_svc_status_mesg(svc, status));
- return (status);
- }
-
- /* add the job attributes to the response in a job-attributes-group */
- if (j != NULL) {
- papi_to_ipp_job_group(response, request, PAPI_ATTR_REPLACE, j);
- papiJobFree(j);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/cups-accept-jobs.c b/usr/src/lib/print/libipp-listener/common/cups-accept-jobs.c
deleted file mode 100644
index 01a91ba5fd..0000000000
--- a/usr/src/lib/print/libipp-listener/common/cups-accept-jobs.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: cups-accept-jobs.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-cups_accept_jobs(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *queue = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- if ((status = papiPrinterResume(svc, queue)) != PAPI_OK) {
- ipp_set_status(response, status, "accept failed: %s: %s",
- (queue ? queue : "(null)"),
- ipp_svc_status_mesg(svc, status));
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/cups-get-classes.c b/usr/src/lib/print/libipp-listener/common/cups-get-classes.c
deleted file mode 100644
index a6aea61908..0000000000
--- a/usr/src/lib/print/libipp-listener/common/cups-get-classes.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: cups-get-classes.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-cups_get_classes(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_printer_t *p = NULL;
- papi_attribute_t **operational = NULL;
- papi_filter_t filt;
-
- char **req_attrs = NULL;
- int limit = 0;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group may contain:
- * limit
- * printer-info
- * printer-location
- * printer-type
- * printer-type-mask
- * requested-attributes
- */
-
- papiAttributeListGetInteger(operational, NULL, "limit", &limit);
-
- get_string_list(operational, "requested-attributes", &req_attrs);
-
- /* only ask for the classes */
- filt.type = PAPI_FILTER_BITMASK;
- filt.filter.bitmask.mask = ~PAPI_PRINTER_CLASS;
- filt.filter.bitmask.value = PAPI_PRINTER_CLASS;
-
- status = papiPrintersList(svc, req_attrs, &filt, &p);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "query printers: %s",
- ipp_svc_status_mesg(svc, status));
- papiPrinterFree(p); /* we shouldn't have a printer */
- return (status);
- }
-
- if (p != NULL) {
- int i;
-
- for (i = 0; p[i] != NULL; i++)
- papi_to_ipp_printer_group(response, request,
- PAPI_ATTR_APPEND, p[i]);
- papiPrinterListFree(p);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/cups-get-default.c b/usr/src/lib/print/libipp-listener/common/cups-get-default.c
deleted file mode 100644
index 0bb084ac9e..0000000000
--- a/usr/src/lib/print/libipp-listener/common/cups-get-default.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: cups-get-default.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-#include <config-site.h>
-
-papi_status_t
-cups_get_default(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_printer_t p = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **printer_attributes = NULL;
-
- char **req_attrs = NULL;
- int limit = 0;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group may contain:
- * requested-attributes
- */
- get_string_list(operational, "requested-attributes", &req_attrs);
-
- status = papiPrinterQuery(svc, DEFAULT_DEST, req_attrs, NULL, &p);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "query default: %s",
- ipp_svc_status_mesg(svc, status));
- papiPrinterFree(p); /* we shouldn't have a printer */
- return (status);
- }
-
- /*
- * add the printer attributes to the response in a
- * printer-attributes-group
- */
- printer_attributes = papiPrinterGetAttributeList(p);
- add_default_attributes(&printer_attributes);
- (void) papiAttributeListAddCollection(response, PAPI_ATTR_REPLACE,
- "printer-attributes-group", printer_attributes);
-
- papiPrinterFree(p);
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/cups-get-printers.c b/usr/src/lib/print/libipp-listener/common/cups-get-printers.c
deleted file mode 100644
index e883543381..0000000000
--- a/usr/src/lib/print/libipp-listener/common/cups-get-printers.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: cups-get-printers.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-cups_get_printers(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_printer_t *p = NULL;
- papi_attribute_t **operational = NULL;
- papi_filter_t filt;
-
- char **req_attrs = NULL;
- int limit = 0;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group may contain:
- * limit
- * printer-info
- * printer-location
- * printer-type
- * printer-type-mask
- * requested-attributes
- */
-
- papiAttributeListGetInteger(operational, NULL, "limit", &limit);
-
- get_string_list(operational, "requested-attributes", &req_attrs);
-
- /* only ask for the classes */
- filt.type = PAPI_FILTER_BITMASK;
- filt.filter.bitmask.mask = ~PAPI_PRINTER_CLASS;
- filt.filter.bitmask.value = PAPI_PRINTER_LOCAL | PAPI_PRINTER_REMOTE;
-
- /* query the print service for printers information */
- status = papiPrintersList(svc, req_attrs, &filt, &p);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "query printers: %s",
- ipp_svc_status_mesg(svc, status));
- papiPrinterListFree(p); /* we shouldn't have any printers */
- return (status);
- }
-
- if (p != NULL) {
- int i;
-
- for (i = 0; p[i] != NULL; i++)
- papi_to_ipp_printer_group(response, request,
- PAPI_ATTR_APPEND, p[i]);
- papiPrinterListFree(p);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/cups-move-job.c b/usr/src/lib/print/libipp-listener/common/cups-move-job.c
deleted file mode 100644
index 137a507f93..0000000000
--- a/usr/src/lib/print/libipp-listener/common/cups-move-job.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: cups-move-job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-cups_move_job(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL, **job = NULL;
-
- char *message = NULL;
- char *job_printer_uri = NULL;
- char *queue = NULL;
- char *dest = NULL;
- int id = -1;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * Get job attributes from the request
- */
- status = papiAttributeListGetCollection(request, NULL,
- "job-attributes-group", &job);
- if (status != PAPI_OK) {
- ipp_set_status(response, status,
- "job-attributes-group: %s",
- papiStatusString(status));
- return (status);
- }
-
- /*
- * the operational-attributes-group must contain:
- * job-uri (or printer-uri/job-id)
- */
- get_printer_id(operational, &queue, &id);
- if (id < 0) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-uri or job-id");
- return (PAPI_BAD_REQUEST);
- } else if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * the job-attributes-group must contain:
- * job-printer-uri
- */
- job_printer_uri = NULL;
- (void) papiAttributeListGetString(job, NULL,
- "job-printer-uri", &job_printer_uri);
- if (job_printer_uri == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-printer-uri");
- return (PAPI_BAD_REQUEST);
- } else
- dest = destination_from_printer_uri(job_printer_uri);
-
- if ((status = papiJobMove(svc, queue, id, dest)) != PAPI_OK)
- ipp_set_status(response, status,
- "move failed: %s-%d to %s: %s",
- (queue ? queue : "(null)"), id,
- (dest ? dest : "(null)"),
- ipp_svc_status_mesg(svc, status));
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/cups-reject-jobs.c b/usr/src/lib/print/libipp-listener/common/cups-reject-jobs.c
deleted file mode 100644
index 1a35acdf62..0000000000
--- a/usr/src/lib/print/libipp-listener/common/cups-reject-jobs.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: cups-reject-jobs.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-cups_reject_jobs(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *queue = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- if ((status = papiPrinterPause(svc, queue, NULL)) != PAPI_OK) {
- ipp_set_status(response, status, "pause failed: %s: %s",
- (queue ? queue : "(null)"),
- ipp_svc_status_mesg(svc, status));
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/disable-printer.c b/usr/src/lib/print/libipp-listener/common/disable-printer.c
deleted file mode 100644
index e1c2fd3b5c..0000000000
--- a/usr/src/lib/print/libipp-listener/common/disable-printer.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: disable-printer.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_disable_printer(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *queue = NULL;
- char *message = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
-
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * The operational-attributes-group may contain:
- * printer-message-from-operator
- */
- (void) papiAttributeListGetString(operational, NULL,
- "printer-message-from-operator", &message);
-
- if ((status = papiPrinterDisable(svc, queue, message)) != PAPI_OK) {
- ipp_set_status(response, status, "disable failed: %s: %s",
- (queue ? queue : "(null)"),
- ipp_svc_status_mesg(svc, status));
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/enable-printer.c b/usr/src/lib/print/libipp-listener/common/enable-printer.c
deleted file mode 100644
index 0d5419d51d..0000000000
--- a/usr/src/lib/print/libipp-listener/common/enable-printer.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: enable-printer.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_enable_printer(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *queue = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- if ((status = papiPrinterEnable(svc, queue)) != PAPI_OK) {
- ipp_set_status(response, status, "enable failed: %s: %s",
- (queue ? queue : "(null)"),
- ipp_svc_status_mesg(svc, status));
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/get-job-attributes.c b/usr/src/lib/print/libipp-listener/common/get-job-attributes.c
deleted file mode 100644
index 7f74054ebe..0000000000
--- a/usr/src/lib/print/libipp-listener/common/get-job-attributes.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: get-job-attributes.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_get_job_attributes(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_job_t j = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **job_attributes = NULL;
-
- char **req_attrs = NULL;
- char *queue = NULL;
- int id = -1;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * the operational-attributes-group must contain:
- * job-uri (or printer-uri/job-id)
- */
- get_printer_id(operational, &queue, &id);
- if (id < 0) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-uri or job-id");
- return (PAPI_BAD_REQUEST);
- } else if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * the operational-attributes-group should contain:
- * requested-attributes
- */
- get_string_list(operational, "requested-attributes", &req_attrs);
-
- if ((status = papiJobQuery(svc, queue, id, req_attrs, &j)) != PAPI_OK) {
- ipp_set_status(response, status, "query job: %s",
- ipp_svc_status_mesg(svc, status));
- papiJobFree(j); /* we shouldn't have a job, but just in case */
- return (status);
- }
-
- /* add the job attributes to the response in a job-attributes-group */
- if (j != NULL) {
- papi_to_ipp_job_group(response, request, PAPI_ATTR_REPLACE, j);
- papiJobFree(j);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/get-jobs.c b/usr/src/lib/print/libipp-listener/common/get-jobs.c
deleted file mode 100644
index 0e5e56f44c..0000000000
--- a/usr/src/lib/print/libipp-listener/common/get-jobs.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: get-jobs.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_get_jobs(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_job_t *j = NULL;
- papi_attribute_t **operational = NULL;
-
- char **req_attrs = NULL;
- char *queue = NULL;
- int limit = 0;
- char my_jobs = PAPI_FALSE;
- char *which;
- int type = 0;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * The operational-attributes-group may contain:
- * limit
- * requested-attributes
- * which-jobs
- * my-jobs
- */
- (void) papiAttributeListGetString(operational, NULL,
- "which-jobs", &which);
- (void) papiAttributeListGetBoolean(operational, NULL,
- "my-jobs", &my_jobs);
- (void) papiAttributeListGetInteger(operational, NULL, "limit", &limit);
- get_string_list(operational, "requested-attributes", &req_attrs);
-
- status = papiPrinterListJobs(svc, queue, req_attrs, type, limit, &j);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "query jobs: %s",
- ipp_svc_status_mesg(svc, status));
- return (status);
- }
-
- /* add any job's attributes to the response in job-attribute-groups */
- if (j != NULL) {
- int i;
-
- for (i = 0; j[i] != NULL; i++)
- papi_to_ipp_job_group(response, request,
- PAPI_ATTR_APPEND, j[i]);
- papiJobListFree(j);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/get-printer-attributes.c b/usr/src/lib/print/libipp-listener/common/get-printer-attributes.c
deleted file mode 100644
index 2f33d0039c..0000000000
--- a/usr/src/lib/print/libipp-listener/common/get-printer-attributes.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: get-printer-attributes.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_get_printer_attributes(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_printer_t p = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **printer_attributes = NULL;
-
- char **req_attrs = NULL;
- char *doc_fmt = NULL;
- char *queue = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * The operational-attributes-group may contain:
- * requested-attributes
- * document-format
- */
- get_string_list(operational, "requested-attributes", &req_attrs);
- (void) papiAttributeListGetString(operational, NULL,
- "document-format", &doc_fmt);
- status = papiPrinterQuery(svc, queue, req_attrs, NULL, &p);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "query printer: %s",
- ipp_svc_status_mesg(svc, status));
- papiPrinterFree(p); /* we shouldn't have a printer */
- return (status);
- }
-
- /*
- * add the printer attributes to the response in a
- * printer-attributes-group
- */
- if (p != NULL) {
- papi_to_ipp_printer_group(response, request,
- PAPI_ATTR_REPLACE, p);
- papiPrinterFree(p);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/hold-job.c b/usr/src/lib/print/libipp-listener/common/hold-job.c
deleted file mode 100644
index fcb1409df6..0000000000
--- a/usr/src/lib/print/libipp-listener/common/hold-job.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: hold-job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_hold_job(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *message = NULL;
- char *queue = NULL;
- int id = -1;
-
- /* Get operational attributes from the request */
- papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * the operational-attributes-group must contain:
- * job-uri (or printer-uri/job-id)
- */
- get_printer_id(operational, &queue, &id);
- if (id < 0) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-uri or job-id");
- return (PAPI_BAD_REQUEST);
- } else if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * the operational-attributes-group may contain:
- * message
- * job-hold-until (ingored)
- */
- (void) papiAttributeListGetString(operational, NULL,
- "message", &message);
-
- if ((status = papiJobHold(svc, queue, id)) != PAPI_OK) {
- ipp_set_status(response, status,
- "hold failed: %s-%d: %s",
- (queue ? queue : "(null)"), id,
- ipp_svc_status_mesg(svc, status));
- } else if (message != NULL) { /* add unsupported attribute group */
- papi_attribute_t **unsupported = NULL;
-
- papiAttributeListAddValue(&unsupported, PAPI_ATTR_EXCL,
- "message", PAPI_COLLECTION, NULL);
- (void) papiAttributeListAddCollection(response,
- PAPI_ATTR_REPLACE, "unsupported-attributes-group",
- unsupported);
- papiAttributeListFree(unsupported);
-
- status = PAPI_OK_SUBST;
- ipp_set_status(response, status,
- "unsupported attribute in request");
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/ipp-listener.c b/usr/src/lib/print/libipp-listener/common/ipp-listener.c
deleted file mode 100644
index 42f23f85e7..0000000000
--- a/usr/src/lib/print/libipp-listener/common/ipp-listener.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: ipp-listener.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netinet/in.h>
-#include <assert.h>
-#include <errno.h>
-#include <syslog.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/systeminfo.h>
-
-#include <papi.h>
-#include <ipp-listener.h>
-#include <uri.h>
-
-typedef papi_status_t (ipp_handler_t)(papi_service_t svc,
- papi_attribute_t **request,
- papi_attribute_t ***response,
- ipp_reader_t iread, void *fd);
-
-/*
- * protocol request handlers are inserted below. The handler must be
- * declared extern immediately below this comment and then an entry
- * must be inserted in the "handlers" table a little further down.
- */
-extern ipp_handler_t ipp_print_job;
-extern ipp_handler_t ipp_validate_job;
-extern ipp_handler_t ipp_create_job;
-extern ipp_handler_t ipp_get_printer_attributes;
-extern ipp_handler_t ipp_get_jobs;
-extern ipp_handler_t ipp_pause_printer;
-extern ipp_handler_t ipp_resume_printer;
-extern ipp_handler_t ipp_disable_printer;
-extern ipp_handler_t ipp_enable_printer;
-extern ipp_handler_t ipp_purge_jobs;
-extern ipp_handler_t ipp_send_document;
-extern ipp_handler_t ipp_cancel_job;
-extern ipp_handler_t ipp_get_job_attributes;
-extern ipp_handler_t ipp_release_job;
-extern ipp_handler_t ipp_hold_job;
-extern ipp_handler_t ipp_restart_job;
-extern ipp_handler_t ipp_set_job_attributes;
-extern ipp_handler_t ipp_set_printer_attributes;
-extern ipp_handler_t cups_get_default;
-extern ipp_handler_t cups_get_printers;
-extern ipp_handler_t cups_get_classes;
-extern ipp_handler_t cups_accept_jobs;
-extern ipp_handler_t cups_reject_jobs;
-extern ipp_handler_t cups_move_job;
-
-/* ARGSUSED0 */
-static papi_status_t
-default_handler(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response, ipp_reader_t iread, void *fd)
-{
- int result = (int)PAPI_INTERNAL_ERROR;
-
- if (response != NULL)
- (void) papiAttributeListGetInteger(*response, NULL,
- "status-code", &result);
-
- return ((papi_status_t)result);
-}
-
-static struct {
- int16_t id;
- char *name;
- ipp_handler_t *function;
- enum { OP_REQUIRED, OP_OPTIONAL, OP_VENDOR } type;
-} handlers[] = {
- /* Printer Operations */
- { 0x0002, "print-job", ipp_print_job, OP_REQUIRED },
- { 0x0003, "print-uri", NULL, OP_OPTIONAL },
- { 0x0004, "validate-job", ipp_validate_job,
- OP_REQUIRED },
- { 0x0005, "create-job", ipp_create_job, OP_OPTIONAL },
- { 0x000a, "get-jobs", ipp_get_jobs, OP_REQUIRED },
- { 0x000b, "get-printer-attributes", ipp_get_printer_attributes,
- OP_REQUIRED },
- { 0x0010, "pause-printer", ipp_pause_printer,
- OP_OPTIONAL },
- { 0x0011, "resume-printer", ipp_resume_printer,
- OP_OPTIONAL },
- { 0x0012, "purge-jobs", ipp_purge_jobs, OP_OPTIONAL },
- { 0x0013, "set-printer-attributes", ipp_set_printer_attributes,
- OP_OPTIONAL },
- { 0x0014, "set-job-attributes", ipp_set_job_attributes,
- OP_OPTIONAL },
- { 0x0022, "enable-printer", ipp_enable_printer,
- OP_OPTIONAL },
- { 0x0023, "disable-printer", ipp_disable_printer,
- OP_OPTIONAL },
- /* Job Operations */
- { 0x0006, "send-document", ipp_send_document,
- OP_OPTIONAL },
- { 0x0007, "send-uri", NULL, OP_OPTIONAL },
- { 0x0008, "cancel-job", ipp_cancel_job, OP_REQUIRED },
- { 0x0009, "get-job-attributes", ipp_get_job_attributes,
- OP_REQUIRED },
- { 0x000c, "hold-job", ipp_hold_job, OP_OPTIONAL },
- { 0x000d, "release-job", ipp_release_job,
- OP_OPTIONAL },
- { 0x000e, "restart-job", ipp_restart_job,
- OP_OPTIONAL },
- /* Other Operations */
- { 0x4001, "cups-get-default", cups_get_default,
- OP_VENDOR },
- { 0x4002, "cups-get-printers", cups_get_printers,
- OP_VENDOR },
- { 0x4005, "cups-get-classes", cups_get_classes,
- OP_VENDOR },
- { 0x4008, "cups-accept-jobs", cups_accept_jobs,
- OP_VENDOR },
- { 0x4009, "cups-reject-jobs", cups_reject_jobs,
- OP_VENDOR },
- { 0x400D, "cups-move-job", cups_move_job, OP_VENDOR },
- { 0, NULL, NULL, OP_VENDOR }
-};
-
-static int
-ipp_operation_name_to_index(char *name)
-{
- int i;
-
- for (i = 0; handlers[i].name != NULL; i++)
- if (strcasecmp(name, handlers[i].name) == 0)
- return (i);
-
- return (-1);
-}
-
-static int
-ipp_operation_id_to_index(int16_t id)
-{
- int i;
-
- for (i = 0; handlers[i].name != NULL; i++)
- if (id == handlers[i].id)
- return (i);
-
- return (-1);
-}
-
-static ipp_handler_t *
-ipp_operation_handler(papi_attribute_t **request, papi_attribute_t ***response)
-{
- int id = 0;
- int index;
- papi_attribute_t **ops = NULL;
- papi_status_t status;
- char configured = PAPI_FALSE;
-
- /* get the operation from the request */
- status = papiAttributeListGetInteger(request, NULL,
- "operation-id", &id);
- if (status != PAPI_OK) {
- ipp_set_status(response, PAPI_BAD_ARGUMENT,
- "no operation specified in request");
- return (default_handler);
- }
-
- /* find the operation in the handler table */
- index = ipp_operation_id_to_index(id);
-#ifdef DEBUG
- if (index == -1)
- fprintf(stderr, "Operation: 0x%4.4x\n", id);
- else
- fprintf(stderr, "Operation: 0x%4.4x(%s)\n", id,
- handlers[index].name);
- fflush(stderr);
-#endif
-
- if ((index == -1) || (handlers[index].function == NULL)) {
- ipp_set_status(response, PAPI_OPERATION_NOT_SUPPORTED,
- "operation (0x%4.4x) not implemented by server",
- id);
- return (default_handler);
- }
-
- /* find the configured operations */
- status = papiAttributeListGetCollection(request, NULL,
- "operations", &ops);
- if (status != PAPI_OK) { /* this should not be possible */
- ipp_set_status(response, PAPI_INTERNAL_ERROR,
- "sofware error, no operations configured");
- return (default_handler);
- }
-
- /* check if the requested operation is configured */
- status = papiAttributeListGetBoolean(ops, NULL,
- handlers[index].name, &configured);
- if ((status != PAPI_OK) || (configured != PAPI_TRUE)) {
- ipp_set_status(response, PAPI_OPERATION_NOT_SUPPORTED,
- "operation (%s 0x%4.4x) not enabled on server",
- handlers[index].name, id);
- return (default_handler);
- }
-
- return (handlers[index].function);
-}
-
-static char
-type_to_boolean(char *type)
-{
- char result = PAPI_FALSE;
-
- if ((strcasecmp(type, "true") == 0) ||
- (strcasecmp(type, "yes") == 0) ||
- (strcasecmp(type, "on") == 0) ||
- (strcasecmp(type, "enable") == 0))
- result = PAPI_TRUE;
-
- return (result);
-}
-
-static papi_status_t
-ipp_configure_required_operations(papi_attribute_t ***list, char boolean)
-{
- papi_status_t result = PAPI_OK;
- int i;
-
- for (i = 0; ((result == PAPI_OK) && (handlers[i].name != NULL)); i++)
- if (handlers[i].type == OP_REQUIRED)
- result = papiAttributeListAddBoolean(list,
- PAPI_ATTR_REPLACE, handlers[i].name,
- boolean);
-
- return (result);
-
-}
-
-static papi_status_t
-ipp_configure_all_operations(papi_attribute_t ***list, char boolean)
-{
- papi_status_t result = PAPI_OK;
- int i;
-
- for (i = 0; ((result == PAPI_OK) && (handlers[i].name != NULL)); i++)
- result = papiAttributeListAddBoolean(list, PAPI_ATTR_REPLACE,
- handlers[i].name, boolean);
-
- return (result);
-}
-
-papi_status_t
-ipp_configure_operation(papi_attribute_t ***list, char *operation, char *type)
-{
- papi_status_t result = PAPI_OPERATION_NOT_SUPPORTED;
- char boolean = PAPI_FALSE;
-
- if ((list == NULL) || (operation == NULL) || (type == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- boolean = type_to_boolean(type);
-
- if (strcasecmp(operation, "all") == 0) {
- result = ipp_configure_all_operations(list, boolean);
- } else if (strcasecmp(operation, "required") == 0) {
- result = ipp_configure_required_operations(list, boolean);
- } else if (ipp_operation_name_to_index(operation) != -1) {
- result = papiAttributeListAddBoolean(list, PAPI_ATTR_REPLACE,
- operation, boolean);
- }
-
- return (result);
-}
-
-void
-ipp_operations_supported(papi_attribute_t ***list, papi_attribute_t **request)
-{
- papi_attribute_t **group = NULL;
-
- (void) papiAttributeListGetCollection(request, NULL,
- "operations", &group);
- if (group != NULL) {
- int i;
-
- for (i = 0; handlers[i].name != NULL; i++) {
- char boolean = PAPI_FALSE;
- (void) papiAttributeListGetBoolean(group, NULL,
- handlers[i].name, &boolean);
-
- if (boolean == PAPI_TRUE)
- (void) papiAttributeListAddInteger(list,
- PAPI_ATTR_APPEND,
- "operations-supported",
- handlers[i].id);
- }
- }
-}
-
-static papi_status_t
-ipp_initialize_response(papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_attribute_t **operational = NULL;
- int i;
-
- if ((request == NULL) || (response == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* If the response was initialized, start over */
- if (*response != NULL) {
- papiAttributeListFree(*response);
- *response = NULL;
- }
-
- /* Add the basic ipp header information to the response */
- (void) papiAttributeListGetInteger(request, NULL, "version-major", &i);
- (void) papiAttributeListAddInteger(response, PAPI_ATTR_REPLACE,
- "version-major", i);
- (void) papiAttributeListGetInteger(request, NULL, "version-minor", &i);
- (void) papiAttributeListAddInteger(response, PAPI_ATTR_REPLACE,
- "version-minor", i);
-
- (void) papiAttributeListGetInteger(request, NULL, "request-id", &i);
- (void) papiAttributeListAddInteger(response, PAPI_ATTR_REPLACE,
- "request-id", i);
-
- /* Add a default operational attributes group to the response */
- (void) papiAttributeListAddString(&operational, PAPI_ATTR_EXCL,
- "attributes-charset", "utf-8");
- (void) papiAttributeListAddString(&operational, PAPI_ATTR_EXCL,
- "attributes-natural-language", "en-us");
-
- (void) papiAttributeListAddCollection(response, PAPI_ATTR_REPLACE,
- "operational-attributes-group", operational);
- papiAttributeListFree(operational);
-
- return (PAPI_OK);
-}
-
-/* simplistic check for cyclical service references */
-static int
-cyclical_service_check(char *svc_name, int port)
-{
- papi_attribute_t **list;
- char buf[BUFSIZ];
- uri_t *uri = NULL;
- char *s = NULL;
-
- /* was there a service_uri? */
- if (svc_name == NULL)
- return (0);
-
- if ((list = getprinterbyname(svc_name, NULL)) == NULL)
- return (0); /* if it doesnt' resolve, we will fail later */
-
- papiAttributeListGetString(list, NULL, "printer-uri-supported", &s);
- if ((s == NULL) || (strcasecmp(svc_name, s) != 0))
- return (0); /* they don't match */
-
- /* is it in uri form? */
- if (uri_from_string(s, &uri) < 0)
- return (0);
-
- if ((uri == NULL) || (uri->scheme == NULL) || (uri->host == NULL)) {
- uri_free(uri);
- return (0);
- }
-
- /* is it ipp form */
- if (strcasecmp(uri->scheme, "ipp") != 0) {
- uri_free(uri);
- return (0);
- }
-
- /* does the host match up */
- if (is_localhost(uri->host) != 0) {
- uri_free(uri);
- return (0);
- }
-
- /* does the port match our own */
- if (((uri->port == NULL) && (port != 631)) ||
- ((uri->port != NULL) && (atoi(uri->port) != port))) {
- uri_free(uri);
- return (0);
- }
-
- uri_free(uri);
-
- return (1);
-}
-
-static papi_status_t
-print_service_connect(papi_service_t *svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
- char *printer_uri = NULL;
- char *svc_name = NULL;
- char *user = NULL;
- int port = 631;
-
- /* Get the operational attributes group from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /* get the user name */
- (void) papiAttributeListGetString(request, NULL, "default-user", &user);
- (void) papiAttributeListGetString(operational, NULL,
- "requesting-user-name", &user);
-
- /* get the printer or service name */
- (void) papiAttributeListGetString(request, NULL,
- "default-service", &svc_name);
- get_printer_id(operational, &svc_name, NULL);
-
- /* get the port that we are listening on */
- (void) papiAttributeListGetInteger(request, NULL, "uri-port", &port);
-
- if (cyclical_service_check(svc_name, port) != 0) {
- status = PAPI_NOT_POSSIBLE;
- ipp_set_status(response, status, "printer-uri is cyclical");
- return (status);
- }
-
- status = papiServiceCreate(svc, svc_name, user, NULL, NULL,
- PAPI_ENCRYPT_NEVER, NULL);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "print service: %s",
- papiStatusString(status));
- return (status);
- }
-
- /*
- * Trusted Solaris can't be trusting of intermediaries. Pass
- * the socket connection to the print service to retrieve the
- * sensativity label off of a multi-level port.
- */
- {
- int fd = -1;
-
- (void) papiAttributeListGetInteger(request, NULL,
- "peer-socket", &fd);
- if (fd != -1)
- papiServiceSetPeer(*svc, fd);
- }
-
- return (status);
-}
-
-papi_status_t
-ipp_process_request(papi_attribute_t **request, papi_attribute_t ***response,
- ipp_reader_t iread, void *fd)
-{
- papi_status_t result = PAPI_OK;
-
- ipp_initialize_response(request, response);
-
-#ifdef DEBUG
- fprintf(stderr, "REQUEST:");
- papiAttributeListPrint(stderr, request, " %d ", getpid());
- fprintf(stderr, "\n");
-#endif
-
- /* verify that the request is "well-formed" */
- if ((result = ipp_validate_request(request, response)) == PAPI_OK) {
- papi_service_t svc = NULL;
- ipp_handler_t *handler;
-
- result = print_service_connect(&svc, request, response);
- handler = ipp_operation_handler(request, response);
-
- /* process the request */
- if ((result == PAPI_OK) && (handler != NULL))
- result = (handler)(svc, request, response, iread, fd);
-#ifdef DEBUG
- fprintf(stderr, "RESULT: %s\n", papiStatusString(result));
-#endif
- papiServiceDestroy(svc);
- }
-
- (void) papiAttributeListAddInteger(response, PAPI_ATTR_EXCL,
- "status-code", result);
- massage_response(request, *response);
-
-#ifdef DEBUG
- fprintf(stderr, "RESPONSE:");
- papiAttributeListPrint(stderr, *response, " %d ", getpid());
- fprintf(stderr, "\n");
-#endif
-
- return (result);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/ipp-listener.h b/usr/src/lib/print/libipp-listener/common/ipp-listener.h
deleted file mode 100644
index 5a8718477e..0000000000
--- a/usr/src/lib/print/libipp-listener/common/ipp-listener.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _IPP_LISTENER_H
-#define _IPP_LISTENER_H
-
-/* $Id: ipp-listener.h 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <ipp.h>
-
-/* exported functions */
-extern papi_status_t ipp_configure_operation(papi_attribute_t ***list,
- char *operation, char *type);
-extern papi_status_t ipp_process_request(papi_attribute_t **request,
- papi_attribute_t ***response,
- ipp_reader_t iread, void *fd);
-
-/* shared internal functions */
-extern char *ipp_svc_status_mesg(papi_service_t svc, papi_status_t status);
-extern char *destination_from_printer_uri(char *);
-extern void get_printer_id(papi_attribute_t **attributes, char **printer,
- int *id);
-extern void ipp_operations_supported(papi_attribute_t ***list,
- papi_attribute_t **request);
-extern void get_string_list(papi_attribute_t **attributes, char *name,
- char ***values);
-extern void add_default_attributes(papi_attribute_t ***attributes);
-extern void papi_to_ipp_printer_group(papi_attribute_t ***response,
- papi_attribute_t **request, int flags,
- papi_printer_t p);
-extern void papi_to_ipp_job_group(papi_attribute_t ***response,
- papi_attribute_t **request, int flags, papi_job_t j);
-extern void massage_response(papi_attribute_t **request,
- papi_attribute_t **response);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IPP_LISTENER_H */
diff --git a/usr/src/lib/print/libipp-listener/common/pause-printer.c b/usr/src/lib/print/libipp-listener/common/pause-printer.c
deleted file mode 100644
index 0afe4aadf0..0000000000
--- a/usr/src/lib/print/libipp-listener/common/pause-printer.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: pause-printer.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_pause_printer(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *queue = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- if ((status = papiPrinterPause(svc, queue, NULL)) != PAPI_OK) {
- ipp_set_status(response, status, "pause failed: %s: %s",
- (queue ? queue : "(null)"),
- ipp_svc_status_mesg(svc, status));
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/print-job.c b/usr/src/lib/print/libipp-listener/common/print-job.c
deleted file mode 100644
index 29d6b5c5be..0000000000
--- a/usr/src/lib/print/libipp-listener/common/print-job.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: print-job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <netdb.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_print_job(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response, ipp_reader_t iread, void *fd)
-{
- papi_status_t status;
- papi_stream_t s = NULL;
- papi_job_t j = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **job_attributes = NULL;
- char *queue = NULL;
- ssize_t rc;
- char buf[BUFSIZ];
- char *host = NULL;
- int fp = -1;
- char *keys[] = { "attributes-natural-language", "attributes-charset",
- "printer-uri", NULL };
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * The operational-attributes-group may contain:
- * job-name
- * ipp-attribute-fidelity
- * document-name
- * compression
- * document-format
- * document-natural-language
- * job-k-octets
- * job-impressions
- * job-media-sheets
- * Simply copy the entire contents of the operational-attributes-group
- * for the PAPI call's possible use.
- */
- split_and_copy_attributes(keys, operational, NULL, &job_attributes);
-
- /* copy any job-attributes-group attributes for the PAPI call */
- if (papiAttributeListGetCollection(request, NULL,
- "job-attributes-group", &operational) == PAPI_OK) {
- char *user = NULL;
-
- copy_attributes(&job_attributes, operational);
-
- if (papiAttributeListGetString(operational, NULL,
- "requesting-user-name", &user) == PAPI_OK) {
- papiAttributeListAddString(&job_attributes,
- PAPI_ATTR_REPLACE, "requesting-user-name", user);
- }
- }
-
- /* Set "job-originating-host-name" in next block */
- (void) papiAttributeListGetInteger(request, NULL,
- "peer-socket", &fp);
-
- if (fp != -1) {
- struct sockaddr_in peer;
- socklen_t peer_len = sizeof (peer);
-
- /* who is our peer ? */
- if (getpeername(fp, (struct sockaddr *)&peer,
- &peer_len) == 0) {
- struct hostent *he;
- int error_num;
-
- /*
- * get their name or return a string containing
- * their address
- */
- if ((he = getipnodebyaddr((const char *)&peer.sin_addr,
- sizeof (peer.sin_addr), peer.sin_family,
- &error_num)) == NULL) {
- char tmp_buf[INET6_ADDRSTRLEN];
- papiAttributeListAddString(
- &job_attributes,
- PAPI_ATTR_REPLACE,
- "job-originating-host-name",
- (char *)inet_ntop(peer.sin_family,
- &peer.sin_addr, tmp_buf,
- sizeof (tmp_buf)));
-
- } else {
- if (is_localhost(he->h_name) != 0)
- papiAttributeListAddString(
- &job_attributes,
- PAPI_ATTR_REPLACE,
- "job-originating-host-name",
- "localhost");
- else if (he->h_name != NULL)
- papiAttributeListAddString(
- &job_attributes,
- PAPI_ATTR_REPLACE,
- "job-originating-host-name",
- he->h_name);
- }
- }
- }
-
- /* request job creation with a resulting stream that we can write to */
- status = papiJobStreamOpen(svc, queue, job_attributes, NULL, &s);
- papiAttributeListFree(job_attributes);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "job submission: %s",
- ipp_svc_status_mesg(svc, status));
- return (status);
- }
-
- /* copy the document data from the IPP connection to the stream */
- while ((status == PAPI_OK) && ((rc = iread(fd, buf, sizeof (buf))) > 0))
- status = papiJobStreamWrite(svc, s, buf, rc);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "write job data: %s",
- ipp_svc_status_mesg(svc, status));
- return (status);
- }
-
- /* close the stream, committing the job */
- status = papiJobStreamClose(svc, s, &j);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "close job stream: %s",
- ipp_svc_status_mesg(svc, status));
- papiJobFree(j); /* we shouldn't have a job, but just in case */
- return (status);
- }
-
- /* add the job attributes to the response in a job-attributes-group */
- if (j != NULL) {
- papi_to_ipp_job_group(response, request, PAPI_ATTR_REPLACE, j);
- papiJobFree(j);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/purge-jobs.c b/usr/src/lib/print/libipp-listener/common/purge-jobs.c
deleted file mode 100644
index 7128595844..0000000000
--- a/usr/src/lib/print/libipp-listener/common/purge-jobs.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: purge-jobs.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_purge_jobs(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_job_t *jobs = NULL;
- papi_attribute_t **operational = NULL;
-
- char *queue = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- if ((status = papiPrinterPurgeJobs(svc, queue, &jobs)) != PAPI_OK) {
- ipp_set_status(response, status, "purge failed: %s: %s",
- (queue ? queue : "(null)"),
- ipp_svc_status_mesg(svc, status));
- }
-
- papiJobListFree(jobs);
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/release-job.c b/usr/src/lib/print/libipp-listener/common/release-job.c
deleted file mode 100644
index 0ae16906a6..0000000000
--- a/usr/src/lib/print/libipp-listener/common/release-job.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: release-job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_release_job(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *message = NULL;
- char *queue = NULL;
- int id = -1;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * the operational-attributes-group must contain:
- * job-uri (or printer-uri/job-id)
- */
- get_printer_id(operational, &queue, &id);
- if (id < 0) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-uri or job-id");
- return (PAPI_BAD_REQUEST);
- } else if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * the operational-attributes-group may contain:
- * message
- */
- (void) papiAttributeListGetString(operational, NULL,
- "message", &message);
-
- if ((status = papiJobRelease(svc, queue, id)) != PAPI_OK) {
- ipp_set_status(response, status,
- "release failed: %s-%d: %s",
- (queue ? queue : "(null)"), id,
- ipp_svc_status_mesg(svc, status));
- } else if (message != NULL) { /* add unsupported attribute group */
- papi_attribute_t **unsupported = NULL;
-
- papiAttributeListAddValue(&unsupported, PAPI_ATTR_EXCL,
- "message", PAPI_COLLECTION, NULL);
- (void) papiAttributeListAddCollection(response,
- PAPI_ATTR_REPLACE, "unsupported-attributes-group",
- unsupported);
- papiAttributeListFree(unsupported);
-
- status = PAPI_OK_SUBST;
- ipp_set_status(response, status,
- "unsupported attribute in request");
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/restart-job.c b/usr/src/lib/print/libipp-listener/common/restart-job.c
deleted file mode 100644
index d78967b0f2..0000000000
--- a/usr/src/lib/print/libipp-listener/common/restart-job.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: restart-job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_restart_job(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *message = NULL;
- char *hold_until = NULL;
- char *queue = NULL;
- int id = -1;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * the operational-attributes-group must contain:
- * job-uri (or printer-uri/job-id)
- */
- get_printer_id(operational, &queue, &id);
- if (id < 0) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-uri or job-id");
- return (PAPI_BAD_REQUEST);
- } else if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * the operational-attributes-group may contain:
- * message
- * job-hold-until
- */
- (void) papiAttributeListGetString(operational, NULL,
- "job-hold-until", &hold_until);
- (void) papiAttributeListGetString(operational, NULL,
- "message", &message);
-
- if ((status = papiJobRestart(svc, queue, id)) != PAPI_OK) {
- ipp_set_status(response, status,
- "restart failed: %s-%d: %s",
- (queue ? queue : "(null)"), id,
- ipp_svc_status_mesg(svc, status));
- } else if ((message != NULL) || (hold_until != NULL)) {
- /* add unsupported attribute group */
- papi_attribute_t **unsupported = NULL;
-
- if (message != NULL)
- (void) papiAttributeListAddValue(&unsupported,
- PAPI_ATTR_EXCL, "message",
- PAPI_COLLECTION, NULL);
- if (hold_until != NULL)
- (void) papiAttributeListAddValue(&unsupported,
- PAPI_ATTR_EXCL, "hold-until",
- PAPI_COLLECTION, NULL);
- (void) papiAttributeListAddCollection(response,
- PAPI_ATTR_REPLACE, "unsupported-attributes-group",
- unsupported);
- papiAttributeListFree(unsupported);
-
- status = PAPI_OK_SUBST;
- ipp_set_status(response, status,
- "unsupported attribute in request");
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/resume-printer.c b/usr/src/lib/print/libipp-listener/common/resume-printer.c
deleted file mode 100644
index 8d48ee9adb..0000000000
--- a/usr/src/lib/print/libipp-listener/common/resume-printer.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: resume-printer.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_resume_printer(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- papi_status_t status;
- papi_attribute_t **operational = NULL;
-
- char *queue = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- if ((status = papiPrinterResume(svc, queue)) != PAPI_OK) {
- ipp_set_status(response, status, "resume failed: %s: %s",
- (queue ? queue : "(null)"),
- ipp_svc_status_mesg(svc, status));
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/send-document.c b/usr/src/lib/print/libipp-listener/common/send-document.c
deleted file mode 100644
index 4a4d3a4314..0000000000
--- a/usr/src/lib/print/libipp-listener/common/send-document.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: send-document.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-/*
- * When the PAPI supports papiJobCreate(), papiJobStreamAdd() and
- * papiJobClose(), this will be much cleaner and more efficient, but in the
- * meantime, we are using a private, non-standard interface to do this.
- */
-papi_status_t
-ipp_send_document(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response, ipp_reader_t iread, void *fd)
-{
- papi_status_t status;
- papi_stream_t s = NULL;
- papi_job_t j = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **job_attributes = NULL;
- char *queue = NULL;
- ssize_t rc;
- int id = -1;
- char buf[BUFSIZ];
- char last = PAPI_FALSE;
- char *keys[] = { "attributes-natural-language", "attributes-charset",
- "printer-uri", "job-id", "job-uri", "last-document",
- NULL };
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * the operational-attributes-group must contain:
- * job-uri (or printer-uri/job-id)
- * last-document
- */
- get_printer_id(operational, &queue, &id);
- if (id < 0) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-uri or job-id");
- return (PAPI_BAD_REQUEST);
- } else if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- status = papiAttributeListGetBoolean(operational, NULL,
- "last-document", &last);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "last-document: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * the operational-attributes-group may contain:
- * document-name
- * compression
- * document-format
- * document-natural-language
- * Simply copy the entire contents of the operational-attributes-group
- * for the PAPI call's possible use.
- */
- split_and_copy_attributes(keys, operational, NULL, &job_attributes);
-
- /* copy any job-attributes-group attributes for the PAPI call */
- if (papiAttributeListGetCollection(request, NULL,
- "job-attributes-group", &operational) == PAPI_OK)
- copy_attributes(&job_attributes, operational);
-
- /* create a stream to write the document data on */
- status = papiJobStreamAdd(svc, queue, id, &s);
- papiAttributeListFree(job_attributes);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "job submission: %s",
- ipp_svc_status_mesg(svc, status));
- return (status);
- }
-
- /* copy the document data from the IPP connection to the stream */
- while ((status == PAPI_OK) && ((rc = iread(fd, buf, sizeof (buf))) > 0))
- status = papiJobStreamWrite(svc, s, buf, rc);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "write job data: %s",
- ipp_svc_status_mesg(svc, status));
- return (status);
- }
-
- /* close the stream */
- status = papiJobStreamClose(svc, s, &j);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "close job stream: %s",
- ipp_svc_status_mesg(svc, status));
- papiJobFree(j); /* we shouldn't have a job, but just in case */
- return (status);
- }
-
- /* if it's the last document, commit the job */
- if (last == PAPI_TRUE) {
- status = papiJobCommit(svc, queue, id);
- }
-
- /* add the job attributes to the response in a job-attributes-group */
- if (j != NULL) {
- papi_to_ipp_job_group(response, request, PAPI_ATTR_REPLACE, j);
- papiJobFree(j);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/set-job-attributes.c b/usr/src/lib/print/libipp-listener/common/set-job-attributes.c
deleted file mode 100644
index 57c0b899f3..0000000000
--- a/usr/src/lib/print/libipp-listener/common/set-job-attributes.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: set-job-attributes.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_set_job_attributes(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response, ipp_reader_t iread, void *fd)
-{
- papi_status_t status;
- papi_stream_t s = NULL;
- papi_job_t j = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **job_attributes = NULL;
-
- char *queue = NULL;
- int32_t id = -1;
- ssize_t rc;
- char buf[BUFSIZ];
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * job-uri
- */
- get_printer_id(operational, &queue, &id);
- if (id < 0) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing job-uri or job-id");
- return (PAPI_BAD_REQUEST);
- } else if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- /* get the job-attributes-group attributes for the PAPI call */
- papiAttributeListGetCollection(request, NULL,
- "job-attributes-group", &job_attributes);
-
- /* request job modification */
- status = papiJobModify(svc, queue, id, job_attributes, &j);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "job modification: %s",
- ipp_svc_status_mesg(svc, status));
- return (status);
- }
-
- /* add the job attributes to the response in a job-attributes-group */
- if (j != NULL) {
- papi_to_ipp_job_group(response, request, PAPI_ATTR_REPLACE, j);
- papiJobFree(j);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/set-printer-attributes.c b/usr/src/lib/print/libipp-listener/common/set-printer-attributes.c
deleted file mode 100644
index 7d80864961..0000000000
--- a/usr/src/lib/print/libipp-listener/common/set-printer-attributes.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: set-printer-attributes.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_set_printer_attributes(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response, ipp_reader_t iread, void *fd)
-{
- papi_status_t status;
- papi_printer_t p = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **printer_attributes = NULL;
-
- char *queue = NULL;
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, PAPI_BAD_REQUEST,
- "missing printer-uri or job-uri");
- return (PAPI_BAD_REQUEST);
- }
-
- /* get the printer-attributes-group attributes for the PAPI call */
- papiAttributeListGetCollection(request, NULL,
- "printer-attributes-group", &printer_attributes);
-
- /* request job modification */
- status = papiPrinterModify(svc, queue, printer_attributes, &p);
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "printer modification: %s",
- ipp_svc_status_mesg(svc, status));
- return (status);
- }
-
- /* add the job attributes to the response in a job-attributes-group */
- if (p != NULL) {
- papi_to_ipp_printer_group(response, request,
- PAPI_ATTR_REPLACE, p);
- papiPrinterFree(p);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/common/validate-job.c b/usr/src/lib/print/libipp-listener/common/validate-job.c
deleted file mode 100644
index 8ea72ee38b..0000000000
--- a/usr/src/lib/print/libipp-listener/common/validate-job.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: validate-job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <papi.h>
-#include <ipp.h>
-#include <ipp-listener.h>
-
-papi_status_t
-ipp_validate_job(papi_service_t svc, papi_attribute_t **request,
- papi_attribute_t ***response, ipp_reader_t iread, void *fd)
-{
- papi_status_t status;
- papi_job_t j = NULL;
- papi_attribute_t **operational = NULL;
- papi_attribute_t **job_attributes = NULL;
- char *queue = NULL;
- char *files[] = { "/etc/syslog.conf", NULL };
- ssize_t rc;
- char buf[BUFSIZ];
- char *keys[] = { "attributes-natural-language", "attributes-charset",
- "printer-uri", NULL };
-
- /* Get operational attributes from the request */
- (void) papiAttributeListGetCollection(request, NULL,
- "operational-attributes-group", &operational);
-
- /*
- * The operational-attributes-group must contain:
- * printer-uri
- */
- get_printer_id(operational, &queue, NULL);
- if (queue == NULL) {
- ipp_set_status(response, status, "printer-uri: %s",
- papiStatusString(status));
- return (PAPI_BAD_REQUEST);
- }
-
- /*
- * The operational-attributes-group may contain:
- * job-name
- * ipp-attribute-fidelity
- * document-name
- * compression
- * document-format
- * document-natural-language
- * job-k-octets
- * job-impressions
- * job-media-sheets
- * Simply copy the entire contents of the operational-attributes-group
- * for the PAPI call's possible use.
- */
- split_and_copy_attributes(keys, operational, NULL, &job_attributes);
-
- /* copy any job-attributes-group attributes for the PAPI call */
- if (papiAttributeListGetCollection(request, NULL,
- "job-attributes-group", &operational) == PAPI_OK)
- copy_attributes(&job_attributes, operational);
-
- /* request job validation */
- status = papiJobValidate(svc, queue, job_attributes, NULL, files, &j);
- papiAttributeListFree(job_attributes);
-
- if (status != PAPI_OK) {
- ipp_set_status(response, status, "validating job: %s",
- ipp_svc_status_mesg(svc, status));
- papiJobFree(j); /* we shouldn't have a job, but just in case */
- return (status);
- }
-
- /* add the job attributes to the response in a job-attributes-group */
- if (j != NULL) {
- papi_to_ipp_job_group(response, request, PAPI_ATTR_REPLACE, j);
- papiJobFree(j);
- }
-
- return (status);
-}
diff --git a/usr/src/lib/print/libipp-listener/i386/Makefile b/usr/src/lib/print/libipp-listener/i386/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libipp-listener/i386/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/libipp-listener/sparc/Makefile b/usr/src/lib/print/libipp-listener/sparc/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libipp-listener/sparc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/libpapi-common/Makefile b/usr/src/lib/print/libpapi-common/Makefile
deleted file mode 100644
index ef7e964b85..0000000000
--- a/usr/src/lib/print/libpapi-common/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.lib
-
-HDRS = papi.h
-HDRDIR = common
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all clean clobber: .WAIT $(SUBDIRS)
-install: .WAIT $(SUBDIRS) install_h
-
-lint: # $(SUBDIRS)
-
-install_h: $(ROOTHDRS)
-
-check: $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-common/common/attribute.c b/usr/src/lib/print/libpapi-common/common/attribute.c
deleted file mode 100644
index 244e54555d..0000000000
--- a/usr/src/lib/print/libpapi-common/common/attribute.c
+++ /dev/null
@@ -1,1119 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: attribute.c 157 2006-04-26 15:07:55Z ktou $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <alloca.h>
-#include <papi.h>
-#include <regex.h>
-
-#define MAX_PAGES 32767
-/*
- * Assuming the maximum number of pages in
- * a document to be 32767
- */
-
-static void papiAttributeFree(papi_attribute_t *attribute);
-
-static void
-papiAttributeValueFree(papi_attribute_value_type_t type,
- papi_attribute_value_t *value)
-{
- if (value != NULL) {
- switch (type) {
- case PAPI_STRING:
- if (value->string != NULL)
- free(value->string);
- break;
- case PAPI_COLLECTION:
- if (value->collection != NULL) {
- int i;
-
- for (i = 0; value->collection[i] != NULL; i++)
- papiAttributeFree(value->collection[i]);
-
- free(value->collection);
- }
- break;
- default: /* don't need to free anything extra */
- break;
- }
-
- free(value);
- }
-}
-
-static void
-papiAttributeValuesFree(papi_attribute_value_type_t type,
- papi_attribute_value_t **values)
-{
- if (values != NULL) {
- int i;
-
- for (i = 0; values[i] != NULL; i++)
- papiAttributeValueFree(type, values[i]);
-
- free(values);
- }
-}
-
-static void
-papiAttributeFree(papi_attribute_t *attribute)
-{
- if (attribute != NULL) {
- if (attribute->name != NULL)
- free(attribute->name);
- if (attribute->values != NULL)
- papiAttributeValuesFree(attribute->type,
- attribute->values);
- free(attribute);
- }
-}
-
-void
-papiAttributeListFree(papi_attribute_t **list)
-{
- if (list != NULL) {
- int i;
-
- for (i = 0; list[i] != NULL; i++)
- papiAttributeFree(list[i]);
-
- free(list);
- }
-}
-
-static papi_attribute_t **
-collection_dup(papi_attribute_t **collection)
-{
- papi_attribute_t **result = NULL;
-
- /* allows a NULL collection that is "empty" or "no value" */
- if (collection != NULL) {
- papi_status_t status = PAPI_OK;
- int i;
-
- for (i = 0; ((collection[i] != NULL) && (status == PAPI_OK));
- i++) {
- papi_attribute_t *a = collection[i];
-
- status = papiAttributeListAddValue(&result,
- PAPI_ATTR_APPEND, a->name, a->type,
- NULL);
- if ((status == PAPI_OK) && (a->values != NULL)) {
- int j;
-
- for (j = 0; ((a->values[j] != NULL) &&
- (status == PAPI_OK)); j++)
- status = papiAttributeListAddValue(
- &result,
- PAPI_ATTR_APPEND,
- a->name, a->type,
- a->values[j]);
- }
- }
- if (status != PAPI_OK) {
- papiAttributeListFree(result);
- result = NULL;
- }
- }
-
- return (result);
-}
-
-static papi_attribute_value_t *
-papiAttributeValueDup(papi_attribute_value_type_t type,
- papi_attribute_value_t *v)
-{
- papi_attribute_value_t *result = NULL;
-
- if ((v != NULL) && ((result = calloc(1, sizeof (*result))) != NULL)) {
- switch (type) {
- case PAPI_STRING:
- if (v->string == NULL) {
- free(result);
- result = NULL;
- } else
- result->string = strdup(v->string);
- break;
- case PAPI_INTEGER:
- result->integer = v->integer;
- break;
- case PAPI_BOOLEAN:
- result->boolean = v->boolean;
- break;
- case PAPI_RANGE:
- result->range.lower = v->range.lower;
- result->range.upper = v->range.upper;
- break;
- case PAPI_RESOLUTION:
- result->resolution.xres = v->resolution.xres;
- result->resolution.yres = v->resolution.yres;
- result->resolution.units = v->resolution.units;
- break;
- case PAPI_DATETIME:
- result->datetime = v->datetime;
- break;
- case PAPI_COLLECTION:
- result->collection = collection_dup(v->collection);
- break;
- case PAPI_METADATA:
- result->metadata = v->metadata;
- break;
- default: /* unknown type, fail to duplicate */
- free(result);
- result = NULL;
- }
- }
-
- return (result);
-}
-
-static papi_attribute_t *
-papiAttributeAlloc(char *name, papi_attribute_value_type_t type)
-{
- papi_attribute_t *result = NULL;
-
- if ((result = calloc(1, sizeof (*result))) != NULL) {
- result->name = strdup(name);
- result->type = type;
- }
-
- return (result);
-}
-
-static papi_status_t
-papiAttributeListAppendValue(papi_attribute_value_t ***values,
- papi_attribute_value_type_t type,
- papi_attribute_value_t *value)
-{
-
- if (values == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if (value != NULL) { /* this allows "empty" attributes */
- papi_attribute_value_t *tmp = NULL;
-
- if ((tmp = papiAttributeValueDup(type, value)) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- list_append(values, tmp);
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiAttributeListAddValue(papi_attribute_t ***list, int flgs,
- char *name, papi_attribute_value_type_t type,
- papi_attribute_value_t *value)
-{
- papi_status_t result;
- int flags = flgs;
- papi_attribute_t *attribute = NULL;
- papi_attribute_value_t **values = NULL;
-
- if ((list == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((type == PAPI_RANGE) && (value != NULL) &&
- (value->range.lower > value->range.upper))
- return (PAPI_BAD_ARGUMENT); /* RANGE must have min <= max */
-
- if (flags == 0) /* if it wasn't set, set a default behaviour */
- flags = PAPI_ATTR_APPEND;
-
- /* look for an existing one */
- attribute = papiAttributeListFind(*list, name);
-
- if (((flags & PAPI_ATTR_EXCL) != 0) && (attribute != NULL))
- return (PAPI_CONFLICT); /* EXISTS */
-
- if (((flags & PAPI_ATTR_REPLACE) == 0) && (attribute != NULL) &&
- (attribute->type != type))
- return (PAPI_CONFLICT); /* TYPE CONFLICT */
-
- /* if we don't have one, create it and add it to the list */
- if ((attribute == NULL) &&
- ((attribute = papiAttributeAlloc(name, type)) != NULL))
- list_append(list, attribute);
-
- /* if we don't have one by now, it's most likely an alloc fail */
- if (attribute == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /*
- * if we are replacing, clear any existing values, but don't free
- * until after we have replaced the values, in case we are replacing
- * a collection with a relocated version of the original collection.
- */
- if (((flags & PAPI_ATTR_REPLACE) != 0) && (attribute->values != NULL)) {
- values = attribute->values;
- attribute->values = NULL;
- }
-
- attribute->type = type;
-
- result = papiAttributeListAppendValue(&attribute->values, type, value);
-
- /* free old values if we replaced them */
- if (values != NULL)
- papiAttributeValuesFree(type, values);
-
- return (result);
-}
-
-papi_status_t
-papiAttributeListAddString(papi_attribute_t ***list, int flags,
- char *name, char *string)
-{
- papi_attribute_value_t v;
-
- v.string = (char *)string;
- return (papiAttributeListAddValue(list, flags, name, PAPI_STRING, &v));
-}
-
-papi_status_t
-papiAttributeListAddInteger(papi_attribute_t ***list, int flags,
- char *name, int integer)
-{
- papi_attribute_value_t v;
-
- v.integer = integer;
- return (papiAttributeListAddValue(list, flags, name, PAPI_INTEGER, &v));
-}
-
-papi_status_t
-papiAttributeListAddBoolean(papi_attribute_t ***list, int flags,
- char *name, char boolean)
-{
- papi_attribute_value_t v;
-
- v.boolean = boolean;
- return (papiAttributeListAddValue(list, flags, name, PAPI_BOOLEAN, &v));
-}
-
-papi_status_t
-papiAttributeListAddRange(papi_attribute_t ***list, int flags,
- char *name, int lower, int upper)
-{
- papi_attribute_value_t v;
-
- v.range.lower = lower;
- v.range.upper = upper;
- return (papiAttributeListAddValue(list, flags, name, PAPI_RANGE, &v));
-}
-
-papi_status_t
-papiAttributeListAddResolution(papi_attribute_t ***list, int flags,
- char *name, int xres, int yres,
- papi_resolution_unit_t units)
-{
- papi_attribute_value_t v;
-
- v.resolution.xres = xres;
- v.resolution.yres = yres;
- v.resolution.units = units;
- return (papiAttributeListAddValue(list, flags, name,
- PAPI_RESOLUTION, &v));
-}
-
-papi_status_t
-papiAttributeListAddDatetime(papi_attribute_t ***list, int flags,
- char *name, time_t datetime)
-{
- papi_attribute_value_t v;
-
- v.datetime = datetime;
- return (papiAttributeListAddValue(list, flags, name,
- PAPI_DATETIME, &v));
-}
-
-papi_status_t
-papiAttributeListAddCollection(papi_attribute_t ***list, int flags,
- char *name, papi_attribute_t **collection)
-{
- papi_attribute_value_t v;
-
- v.collection = (papi_attribute_t **)collection;
- return (papiAttributeListAddValue(list, flags, name,
- PAPI_COLLECTION, &v));
-}
-
-papi_status_t
-papiAttributeListAddMetadata(papi_attribute_t ***list, int flags,
- char *name, papi_metadata_t metadata)
-{
- papi_attribute_value_t v;
-
- v.metadata = metadata;
- return (papiAttributeListAddValue(list, flags, name,
- PAPI_METADATA, &v));
-}
-
-papi_status_t
-papiAttributeListDelete(papi_attribute_t ***list, char *name)
-{
- papi_attribute_t *attribute;
-
- if ((list == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((attribute = papiAttributeListFind(*list, name)) == NULL)
- return (PAPI_NOT_FOUND);
-
- list_remove(list, attribute);
- papiAttributeFree(attribute);
-
- return (PAPI_OK);
-}
-
-papi_attribute_t *
-papiAttributeListFind(papi_attribute_t **list, char *name)
-{
- int i;
- if ((list == NULL) || (name == NULL))
- return (NULL);
-
- for (i = 0; list[i] != NULL; i++)
- if (strcasecmp(list[i]->name, name) == 0)
- return ((papi_attribute_t *)list[i]);
-
- return (NULL);
-}
-
-papi_attribute_t *
-papiAttributeListGetNext(papi_attribute_t **list, void **iter)
-{
- papi_attribute_t **tmp, *result;
-
- if ((list == NULL) && (iter == NULL))
- return (NULL);
-
- if (*iter == NULL)
- *iter = list;
-
- tmp = *iter;
- result = *tmp;
- *iter = ++tmp;
-
- return (result);
-}
-
-papi_status_t
-papiAttributeListGetValue(papi_attribute_t **list, void **iter,
- char *name, papi_attribute_value_type_t type,
- papi_attribute_value_t **value)
-{
- papi_attribute_value_t **tmp;
- void *fodder = NULL;
-
- if ((list == NULL) || ((name == NULL) && (iter == NULL)) ||
- (value == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (iter == NULL)
- iter = &fodder;
-
- if ((iter == NULL) || (*iter == NULL)) {
- papi_attribute_t *attr = papiAttributeListFind(list, name);
-
- if (attr == NULL)
- return (PAPI_NOT_FOUND);
-
- if (attr->type != type)
- return (PAPI_NOT_POSSIBLE);
-
- tmp = attr->values;
- } else
- tmp = *iter;
-
- if (tmp == NULL)
- return (PAPI_NOT_FOUND);
-
- *value = *tmp;
- *iter = ++tmp;
-
- if (*value == NULL)
- return (PAPI_GONE);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiAttributeListGetString(papi_attribute_t **list, void **iter,
- char *name, char **vptr)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (vptr == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_STRING, &value);
- if (status == PAPI_OK)
- *vptr = value->string;
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetInteger(papi_attribute_t **list, void **iter,
- char *name, int *vptr)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (vptr == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_INTEGER, &value);
- if (status == PAPI_OK)
- *vptr = value->integer;
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetBoolean(papi_attribute_t **list, void **iter,
- char *name, char *vptr)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (vptr == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_BOOLEAN, &value);
- if (status == PAPI_OK)
- *vptr = value->boolean;
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetRange(papi_attribute_t **list, void **iter,
- char *name, int *min, int *max)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if ((min == NULL) || (max == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_RANGE, &value);
- if (status == PAPI_OK) {
- *min = value->range.lower;
- *max = value->range.upper;
- }
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetResolution(papi_attribute_t **list, void **iter,
- char *name, int *x, int *y,
- papi_resolution_unit_t *units)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if ((x == NULL) || (y == NULL) || (units == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_RESOLUTION, &value);
- if (status == PAPI_OK) {
- *x = value->resolution.xres;
- *y = value->resolution.yres;
- *units = value->resolution.units;
- }
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetDatetime(papi_attribute_t **list, void **iter,
- char *name, time_t *dt)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (dt == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_DATETIME, &value);
- if (status == PAPI_OK) {
- *dt = value->datetime;
- }
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetCollection(papi_attribute_t **list, void **iter,
- char *name, papi_attribute_t ***collection)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (collection == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_COLLECTION, &value);
- if (status == PAPI_OK) {
- *collection = value->collection;
- }
-
- return (status);
-}
-
-papi_status_t
-papiAttributeListGetMetadata(papi_attribute_t **list, void **iter,
- char *name, papi_metadata_t *vptr)
-{
- papi_status_t status;
- papi_attribute_value_t *value = NULL;
-
- if (vptr == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- status = papiAttributeListGetValue(list, iter, name,
- PAPI_METADATA, &value);
- if (status == PAPI_OK)
- *vptr = value->metadata;
-
- return (status);
-}
-
-
-/* The string is modified by this call */
-static char *
-regvalue(regmatch_t match, char *string)
-{
- char *result = NULL;
- if (match.rm_so != match.rm_eo) {
- result = string + match.rm_so;
- *(result + (match.rm_eo - match.rm_so)) = '\0';
- }
- return (result);
-}
-
-static papi_attribute_value_type_t
-_process_value(char *string, char ***parts)
-{
- int i;
- static struct {
- papi_attribute_value_type_t type;
- size_t vals;
- char *expression;
- int compiled;
- regex_t re;
- } types[] = {
- { PAPI_BOOLEAN, 1, "^(true|false|yes|no)$", 0 },
- { PAPI_COLLECTION, 1, "^\\{(.+)\\}$", 0 },
- /* PAPI_DATETIME is unsupported, too much like an integer */
- { PAPI_INTEGER, 1, "^([+-]{0,1}[[:digit:]]+)$", 0 },
- { PAPI_RANGE, 3, "^([[:digit:]]*)-([[:digit:]]*)$", 0 },
- { PAPI_RESOLUTION, 4, "^([[:digit:]]+)x([[:digit:]]+)dp(i|c)$",
- 0 },
- NULL
- };
- regmatch_t matches[4];
-
- for (i = 0; i < 5; i++) {
- int j;
-
- if (types[i].compiled == 0) {
- (void) regcomp(&(types[i].re), types[i].expression,
- REG_EXTENDED|REG_ICASE);
- types[i].compiled = 1;
- }
- if (regexec(&(types[i].re), string, (size_t)types[i].vals,
- matches, 0) == REG_NOMATCH)
- continue;
-
- for (j = 0 ; j < types[i].vals; j++)
- list_append(parts, regvalue(matches[j], string));
- return (types[i].type);
- }
-
- list_append(parts, string);
- return (PAPI_STRING);
-}
-
-static void
-_add_attribute_value(papi_attribute_value_t ***list,
- papi_attribute_value_type_t type,
- papi_attribute_value_type_t dtype, char **parts)
-{
- papi_attribute_value_t *value = calloc(1, sizeof (*value));
-
- switch(type) {
- case PAPI_STRING:
- value->string = strdup(parts[0]);
- list_append(list, value);
- break;
- case PAPI_BOOLEAN:
- value->boolean = PAPI_TRUE;
- if ((strcasecmp(parts[0], "false") == 0) ||
- (strcasecmp(parts[0], "no") == 0))
- value->boolean = PAPI_FALSE;
- list_append(list, value);
- break;
- case PAPI_INTEGER:
- value->integer = atoi(parts[0]);
- list_append(list, value);
- break;
- case PAPI_RANGE:
- if (dtype == PAPI_INTEGER) {
- if (atoi(parts[0]) < 0) {
- /*
- * Handles -P -x case
- * which prints from page number 1
- * till page number x
- */
- value->range.lower = 1;
- value->range.upper = 0 - (atoi(parts[0]));
- } else {
- value->range.lower = value->range.upper
- = atoi(parts[0]);
- }
- } else if (dtype == PAPI_RANGE) {
- if (parts[2] == NULL) {
- value->range.lower = atoi(parts[1]);
- /*
- * Imposing an artificial limit on
- * the upper bound for page range.
- */
- value->range.upper = MAX_PAGES;
- } else if ((parts[1] != NULL) && (parts[2] != NULL)) {
- value->range.lower = atoi(parts[1]);
- value->range.upper = atoi(parts[2]);
- }
- }
- list_append(list, value);
- break;
- case PAPI_RESOLUTION:
- value->resolution.xres = atoi(parts[1]);
- value->resolution.yres = atoi(parts[2]);
- if (parts[3][0] == 'i')
- value->resolution.units = PAPI_RES_PER_INCH;
- else
- value->resolution.units = PAPI_RES_PER_CM;
- list_append(list, value);
- break;
- case PAPI_COLLECTION:
- papiAttributeListFromString(&(value->collection), 0, parts[0]);
- list_append(list, value);
- break;
- }
-}
-
-static papi_status_t
-_papiAttributeFromStrings(papi_attribute_t ***list, int flags,
- char *key, char **values)
-{
- int i;
- papi_status_t result = PAPI_OK;
- papi_attribute_t *attr = calloc(1, sizeof (*attr));
-
- /* these are specified in the papi spec as ranges */
- char *ranges[] = { "copies-supported", "job-impressions-supported",
- "job-k-octets-supported",
- "job-media-sheets-supported", "page-ranges",
- NULL };
-
- if ((attr == NULL) || ((attr->name = strdup(key)) == NULL))
- return (PAPI_TEMPORARY_ERROR);
-
- attr->type = PAPI_METADATA;
- /* these are known ranges */
- for (i = 0; ranges[i] != NULL; i++)
- if (strcasecmp(attr->name, ranges[i]) == 0) {
- attr->type = PAPI_RANGE;
- break;
- }
-
- if (values != NULL) {
- papi_attribute_value_t **vals = NULL;
-
- for (i = 0; values[i] != NULL; i++) {
- papi_attribute_value_type_t dtype;
- char **parts = NULL;
-
- dtype = _process_value(values[i], &parts);
- if (attr->type == PAPI_METADATA)
- attr->type = dtype;
- _add_attribute_value(&vals, attr->type, dtype, parts);
- free(parts);
- }
- attr->values = vals;
- }
-
- list_append(list, attr);
-
- return (result);
-}
-
-static papi_status_t
-_parse_attribute_list(papi_attribute_t ***list, int flags, char *string)
-{
- papi_status_t result = PAPI_OK;
- char *ptr;
-
- if ((list == NULL) || (string == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((ptr = strdup(string)) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- while ((*ptr != '\0') && (result == PAPI_OK)) {
- char *key, **values = NULL;
-
- /* strip any leading whitespace */
- while (isspace(*ptr) != 0)
- ptr++;
-
- /* Get the name: name[=value] */
- key = ptr;
- while ((*ptr != '\0') && (*ptr != '=') && (isspace(*ptr) == 0))
- ptr++;
-
- if (*ptr == '=') {
- *ptr++ = '\0';
-
- while ((*ptr != '\0') && (isspace(*ptr) == 0)) {
- char *value = ptr;
-
- if ((*ptr == '\'') || (*ptr == '"')) {
- char q = *ptr++;
-
- /* quoted string value */
- while ((*ptr != '\0') && (*ptr != q))
- ptr++;
- if (*ptr == q)
- ptr++;
- } else if (*ptr == '{') {
- /* collection */
- while ((*ptr != '\0') && (*ptr != '}'))
- ptr++;
- if (*ptr == '}')
- ptr++;
- } else {
- /* value */
- while ((*ptr != '\0') &&
- (*ptr != ',') &&
- (isspace(*ptr) == 0))
- ptr++;
- }
- if (*ptr == ',')
- *ptr++ = '\0';
- list_append(&values, value);
- }
- } else { /* boolean "[no]key" */
- char *value = "true";
-
- if (strncasecmp(key, "no", 2) == 0) {
- key += 2;
- value = "false";
- }
- list_append(&values, value);
- }
- if (*ptr != '\0')
- *ptr++ = '\0';
-
- result = _papiAttributeFromStrings(list, flags, key, values);
- free(values);
- }
-
- return (result);
-}
-
-papi_status_t
-papiAttributeListFromString(papi_attribute_t ***attrs,
- int flags, char *string)
-{
- papi_status_t result = PAPI_OK;
-
- if ((attrs != NULL) && (string != NULL) &&
- ((flags & ~(PAPI_ATTR_APPEND+PAPI_ATTR_REPLACE+PAPI_ATTR_EXCL))
- == 0)) {
- result = _parse_attribute_list(attrs, flags, string);
- } else {
- result = PAPI_BAD_ARGUMENT;
- }
-
- return (result);
-}
-
-static papi_status_t
-papiAttributeToString(papi_attribute_t *attribute, char *delim,
- char *buffer, size_t buflen)
-{
- papi_attribute_value_t **values = attribute->values;
- int rc, i;
-
- if ((attribute->type == PAPI_BOOLEAN) && (values[1] == NULL)) {
- if (values[0]->boolean == PAPI_FALSE) {
- if (isupper(attribute->name[0]) == 0)
- strlcat(buffer, "no", buflen);
- else
- strlcat(buffer, "No", buflen);
- }
- rc = strlcat(buffer, attribute->name, buflen);
- } else {
- strlcat(buffer, attribute->name, buflen);
- rc = strlcat(buffer, "=", buflen);
- }
-
- if (values == NULL)
- return (PAPI_OK);
-
- for (i = 0; values[i] != NULL; i++) {
- switch (attribute->type) {
- case PAPI_STRING:
- rc = strlcat(buffer, values[i]->string, buflen);
- break;
- case PAPI_INTEGER: {
- char string[24];
-
- snprintf(string, sizeof (string), "%d",
- values[i]->integer);
- rc = strlcat(buffer, string, buflen);
- }
- break;
- case PAPI_BOOLEAN:
- if (values[1] != NULL)
- rc = strlcat(buffer, (values[i]->boolean ?
- "true" : "false"), buflen);
- break;
- case PAPI_RANGE: {
- char string[24];
-
- if (values[i]->range.lower == values[i]->range.upper)
- snprintf(string, sizeof (string), "%d",
- values[i]->range.lower);
- else
- snprintf(string, sizeof (string), "%d-%d",
- values[i]->range.lower,
- values[i]->range.upper);
- rc = strlcat(buffer, string, buflen);
- }
- break;
- case PAPI_RESOLUTION: {
- char string[24];
-
- snprintf(string, sizeof (string), "%dx%ddp%c",
- values[i]->resolution.xres,
- values[i]->resolution.yres,
- (values[i]->resolution.units == PAPI_RES_PER_CM
- ? 'c' : 'i'));
- rc = strlcat(buffer, string, buflen);
- }
- break;
- case PAPI_DATETIME: {
- struct tm *tm = localtime(&values[i]->datetime);
-
- if (tm != NULL) {
- char string[64];
-
- strftime(string, sizeof (string), "%C", tm);
- rc = strlcat(buffer, string, buflen);
- }}
- break;
- case PAPI_COLLECTION: {
- char *string = alloca(buflen);
-
- papiAttributeListToString(values[i]->collection,
- delim, string, buflen);
- rc = strlcat(buffer, string, buflen);
- }
- break;
- default: {
- char string[32];
-
- snprintf(string, sizeof (string), "unknown-type-0x%x",
- attribute->type);
- rc = strlcat(buffer, string, buflen);
- }
- }
- if (values[i+1] != NULL)
- rc = strlcat(buffer, ",", buflen);
-
- if (rc >= buflen)
- return (PAPI_NOT_POSSIBLE);
-
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiAttributeListToString(papi_attribute_t **attrs,
- char *delim, char *buffer, size_t buflen)
-{
- papi_status_t status = PAPI_OK;
- int i;
-
- if ((attrs == NULL) || (buffer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- buffer[0] = '\0';
- if (!delim)
- delim = " ";
-
- for (i = 0; ((attrs[i] != NULL) && (status == PAPI_OK)); i++) {
- status = papiAttributeToString(attrs[i], delim, buffer, buflen);
- if (attrs[i+1] != NULL)
- strlcat(buffer, delim, buflen);
- }
-
- return (status);
-}
-
-static int
-is_in_list(char *value, char **list)
-{
- if ((list != NULL) && (value != NULL)) {
- int i;
-
- for (i = 0; list[i] != NULL; i++)
- if (strcasecmp(value, list[i]) == 0)
- return (0);
- }
-
- return (1);
-}
-
-static papi_status_t
-copy_attribute(papi_attribute_t ***list, papi_attribute_t *attribute)
-{
- papi_status_t status;
- int i = 0;
-
- if ((list == NULL) || (attribute == NULL) ||
- (attribute->values == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- for (status = papiAttributeListAddValue(list, PAPI_ATTR_EXCL,
- attribute->name, attribute->type,
- attribute->values[i]);
- ((status == PAPI_OK) && (attribute->values[i] != NULL));
- status = papiAttributeListAddValue(list, PAPI_ATTR_APPEND,
- attribute->name, attribute->type,
- attribute->values[i]))
- i++;
-
- return (status);
-}
-
-void
-copy_attributes(papi_attribute_t ***result, papi_attribute_t **attributes)
-{
- int i;
-
- if ((result == NULL) || (attributes == NULL))
- return;
-
- for (i = 0; attributes[i] != NULL; i++)
- copy_attribute(result, attributes[i]);
-}
-
-void
-split_and_copy_attributes(char **list, papi_attribute_t **attributes,
- papi_attribute_t ***in, papi_attribute_t ***out)
-{
- int i;
-
- if ((list == NULL) || (attributes == NULL))
- return;
-
- for (i = 0; attributes[i] != NULL; i++)
- if (is_in_list(attributes[i]->name, list) == 0)
- copy_attribute(in, attributes[i]);
- else
- copy_attribute(out, attributes[i]);
-}
-
-void
-papiAttributeListPrint(FILE *fp, papi_attribute_t **attributes,
- char *prefix_fmt, ...)
-{
- char *prefix = NULL;
- char *buffer = NULL;
- char *newfmt = NULL;
- void *mem;
- ssize_t size = 0;
- va_list ap;
-
- newfmt = malloc(strlen(prefix_fmt) + 2);
- sprintf(newfmt, "\n%s", prefix_fmt);
-
- va_start(ap, prefix_fmt);
- while (vsnprintf(prefix, size, newfmt, ap) > size) {
- size += 1024;
- mem = realloc(prefix, size);
- if (!mem) goto error;
- prefix = mem;
- }
- va_end(ap);
-
- if (attributes) {
- size = 0;
- while (papiAttributeListToString(attributes, prefix, buffer,
- size) != PAPI_OK) {
- size += 1024;
- mem = realloc(buffer, size);
- if (!mem) goto error;
- buffer = mem;
- }
- }
-
- fprintf(fp, "%s%s\n", prefix, buffer ? buffer : "");
- fflush(fp);
-
- error:
- free(newfmt);
- free(prefix);
- free(buffer);
-}
diff --git a/usr/src/lib/print/libpapi-common/common/common.c b/usr/src/lib/print/libpapi-common/common/common.c
deleted file mode 100644
index c14515417b..0000000000
--- a/usr/src/lib/print/libpapi-common/common/common.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: common.c 151 2006-04-25 16:55:34Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Shared "unsupported" function implementations that can be overridden
- * by libpapi and the various print service modules (psms).
- */
-
-#include <stdlib.h>
-#include <papi.h>
-
-static papi_status_t
-_unsupported()
-{
- return (PAPI_OPERATION_NOT_SUPPORTED);
-}
-
-static void *
-_unsupported_null_return()
-{
- return (NULL);
-}
-
-static void
-_unsupported_no_return()
-{
-}
-
-/*
- * Service interfaces
- */
-#pragma weak papiServiceCreate = _unsupported
-#pragma weak papiServiceDestroy = _unsupported_no_return
-#pragma weak papiServiceSetPeer = _unsupported
-#pragma weak papiServiceSetUserName = _unsupported
-#pragma weak papiServiceSetPassword = _unsupported
-#pragma weak papiServiceSetEncryption = _unsupported
-#pragma weak papiServiceSetAuthCB = _unsupported
-#pragma weak papiServiceSetAppData = _unsupported
-
-#pragma weak papiServiceGetServiceName = _unsupported_null_return
-#pragma weak papiServiceGetUserName = _unsupported_null_return
-#pragma weak papiServiceGetPassword = _unsupported_null_return
-#pragma weak papiServiceGetAppData = _unsupported_null_return
-
-papi_encryption_t
-papiServiceGetEncryption(papi_service_t handle)
-{
- return (PAPI_ENCRYPT_NEVER);
-}
-
-#pragma weak papiServiceGetAttributeList = _unsupported_null_return
-#pragma weak papiServiceGetStatusMessage = _unsupported_null_return
-
-/*
- * Printer operations
- */
-#pragma weak papiPrintersList = _unsupported
-#pragma weak papiPrinterQuery = _unsupported
-#pragma weak papiPrinterEnable = _unsupported
-#pragma weak papiPrinterDisable = _unsupported
-#pragma weak papiPrinterPause = _unsupported
-#pragma weak papiPrinterResume = _unsupported
-#pragma weak papiPrinterAdd = _unsupported
-#pragma weak papiPrinterModify = _unsupported
-#pragma weak papiPrinterRemove = _unsupported
-#pragma weak papiPrinterPurgeJobs = _unsupported
-#pragma weak papiPrinterListJobs = _unsupported
-#pragma weak papiPrinterGetAttributeList = _unsupported_null_return
-#pragma weak papiPrinterFree = _unsupported_no_return
-#pragma weak papiPrinterListFree = _unsupported_no_return
-
-/*
- * Job interfaces
- */
-#pragma weak papiJobHold = _unsupported
-#pragma weak papiJobRelease = _unsupported
-#pragma weak papiJobRestart = _unsupported
-#pragma weak papiJobPromote = _unsupported
-#pragma weak papiJobModify = _unsupported
-#pragma weak papiJobSubmit = _unsupported
-#pragma weak papiJobSubmitByReference = _unsupported
-#pragma weak papiJobValidate = _unsupported
-#pragma weak papiJobStreamOpen = _unsupported
-#pragma weak papiJobStreamWrite = _unsupported
-#pragma weak papiJobStreamClose = _unsupported
-#pragma weak papiJobQuery = _unsupported
-#pragma weak papiJobMove = _unsupported
-#pragma weak papiJobCancel = _unsupported
-#pragma weak papiJobGetAttributeList = _unsupported_null_return
-#pragma weak papiJobGetPrinterName = _unsupported_null_return
-#pragma weak papiJobCreate = _unsupported
-#pragma weak papiJobStreamAdd = _unsupported
-#pragma weak papiJobCommit = _unsupported
-
-int
-papiJobGetId(papi_job_t job)
-{
- return (-1);
-}
-
-#pragma weak papiJobGetJobTicket = _unsupported_null_return
-#pragma weak papiJobFree = _unsupported_no_return
-#pragma weak papiJobListFree = _unsupported_no_return
-
-/* private functions */
-#pragma weak getprinterbyname = _unsupported_null_return
diff --git a/usr/src/lib/print/libpapi-common/common/config-site.h b/usr/src/lib/print/libpapi-common/common/config-site.h
deleted file mode 100644
index 2007f4f669..0000000000
--- a/usr/src/lib/print/libpapi-common/common/config-site.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _CONFIG_SITE_H
-#define _CONFIG_SITE_H
-
-/* $Id: config-site.h.in 171 2006-05-20 06:00:32Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* the "default" destination for various commands and libraries */
-#define DEFAULT_DEST "_default"
-
-/* the "default" server uri to fallback to */
-#define DEFAULT_SERVICE_URI "lpsched://localhost/printers"
-
-/* the "default" IPP service to fallback to in the IPP psm */
-#define DEFAULT_IPP_SERVICE_URI "ipp://localhost/printers"
-
-/* the name of the SUID lpd-port binary that hands psm-lpd a connected socket */
-#define SUID_LPD_PORT "/usr/lib/print/lpd-port"
-
-/* enable/disable printer-uri in enumeration results */
-#define NEED_BROKEN_PRINTER_URI_SEMANTIC
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONFIG_SITE_H */
diff --git a/usr/src/lib/print/libpapi-common/common/config.h b/usr/src/lib/print/libpapi-common/common/config.h
deleted file mode 100644
index 280ac6d6b4..0000000000
--- a/usr/src/lib/print/libpapi-common/common/config.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _CONFIG_H
-#define _CONFIG_H
-
-/* source/libpapi-common/config.h. Generated by configure. */
-/* source/libpapi-common/config.h.in. Generated from configure.in by autoheader. */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the `dlopen' function. */
-#define HAVE_DLOPEN 1
-
-/* Define to 1 if you have the `dlsym' function. */
-#define HAVE_DLSYM 1
-
-/* Define to 1 if you have the `fprintf' function. */
-#define HAVE_FPRINTF 1
-
-/* define if you have getipnodbyname */
-#define HAVE_GETIPNODEBYNAME 1
-
-/* Define to 1 if you have the `getpassphrase' function. */
-#define HAVE_GETPASSPHRASE 1
-
-/* Define to 1 if you have the `gettext' function. */
-#define HAVE_GETTEXT 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the `is_system_labeled' function. */
-#define HAVE_IS_SYSTEM_LABELED 1
-
-/* Define to 1 if you have the `localtime' function. */
-#define HAVE_LOCALTIME 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the <priv.h> header file. */
-#define HAVE_PRIV_H 1
-
-/* define if you have rresvport_af */
-#define HAVE_RRESVPORT_AF 1
-
-/* Define to 1 if you have the <ruby.h> header file. */
-/* #undef HAVE_RUBY_H */
-
-/* Define to 1 if you have the `snprintf' function. */
-#define HAVE_SNPRINTF 1
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `strcmp' function. */
-#define HAVE_STRCMP 1
-
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
-/* Define to 1 if you have the `strftime' function. */
-#define HAVE_STRFTIME 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strlcat' function. */
-#define HAVE_STRLCAT 1
-
-/* Define to 1 if you have the `strlcpy' function. */
-#define HAVE_STRLCPY 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Name of package */
-#define PACKAGE "papi"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME ""
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION ""
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#define VERSION "1.0_rc1"
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CONFIG_H */
diff --git a/usr/src/lib/print/libpapi-common/common/library.c b/usr/src/lib/print/libpapi-common/common/library.c
deleted file mode 100644
index 12b1ffb449..0000000000
--- a/usr/src/lib/print/libpapi-common/common/library.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: library.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <alloca.h>
-#include <libintl.h>
-#include <papi.h>
-
-static char *calls[] = {
- /* Attribute Calls */
- "papiAttributeListAddValue",
- "papiAttributeListAddBoolean", "papiAttributeListAddCollection",
- "papiAttributeListAddDatetime", "papiAttributeListAddInteger",
- "papiAttributeListAddMetadata", "papiAttributeListAddRange",
- "papiAttributeListAddResolution", "papiAttributeListAddString",
- "papiAttributeListDelete",
- "papiAttributeListGetValue", "papiAttributeListGetNext",
- "papiAttributeListFind",
- "papiAttributeListGetBoolean", "papiAttributeListGetCollection",
- "papiAttributeListGetDatetime", "papiAttributeListGetInteger",
- "papiAttributeListGetMetadata", "papiAttributeListGetRange",
- "papiAttributeListGetResolution", "papiAttributeListGetString",
- "papiAttributeListFromString", "papiAttributeListToString",
- "papiAttributeListFree",
- /* Job Calls */
- "papiJobSubmit", "papiJobSubmitByReference", "papiJobValidate",
- "papiJobStreamOpen", "papiJobStreamWrite", "papiJobStreamClose",
- "papiJobQuery", "papiJobModify", "papiJobCancel", "papiJobPromote",
- "papiJobGetAttributeList", "papiJobGetId", "papiJobGetPrinterName",
- "papiJobGetJobTicket",
- "papiJobFree", "papiJobListFree",
- "papiJobHold", "papiJobRelease", "papiJobRestart",
- /* Printer Calls */
- "papiPrintersList", "papiPrinterQuery", "papiPrinterModify",
- "papiPrinterAdd", "papiPrinterRemove",
- "papiPrinterPause", "papiPrinterResume",
- "papiPrinterDisable", "papiPrinterEnable",
- "papiPrinterPurgeJobs", "papiPrinterListJobs",
- "papiPrinterGetAttributeList",
- "papiPrinterFree", "papiPrinterListFree",
- /* Service Calls */
- "papiServiceCreate", "papiServiceDestroy",
- "papiServiceGetAppData",
- "papiServiceGetEncryption", "papiServiceGetPassword",
- "papiServiceGetServiceName", "papiServiceGetUserName",
- "papiServiceSetAppData", "papiServiceSetAuthCB",
- "papiServiceSetEncryption", "papiServiceSetPassword",
- "papiServiceSetUserName",
- "papiServiceGetAttributeList", "papiServiceGetStatusMessage",
- /* Misc Calls */
- "papiStatusString",
- "papiLibrarySupportedCall", "papiLibrarySupportedCalls",
- NULL
-};
-
-char **
-papiLibrarySupportedCalls()
-{
- return (calls);
-}
-
-char
-papiLibrarySupportedCall(const char *name)
-{
- int i;
-
- for (i = 0; calls[i] != NULL; i++)
- if (strcmp(name, calls[i]) == 0)
- return (PAPI_TRUE);
-
- return (PAPI_FALSE);
-}
diff --git a/usr/src/lib/print/libpapi-common/common/list.c b/usr/src/lib/print/libpapi-common/common/list.c
deleted file mode 100644
index b2560c5059..0000000000
--- a/usr/src/lib/print/libpapi-common/common/list.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: list.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-
-static int __list_increment = 16;
-
-#define LIST_SIZE(x) ((((x) / __list_increment) + 1) * __list_increment)
-
-int
-list_append(void ***list, void *item)
-{
- int count;
-
- if ((list == NULL) || (item == NULL)) {
- errno = EINVAL;
- return (-1);
- }
-
- if (item != NULL) {
- if (*list == NULL)
- *list = (void **)calloc(__list_increment,
- sizeof (void *));
-
- for (count = 0; (*list)[count] != NULL; count++)
- ;
-
- if ((count + 1) % __list_increment == 0) { /* expand the list */
- void **new_list = NULL;
- int new_size = LIST_SIZE(count + 1);
-
- new_list = (void **)calloc(new_size, sizeof (void *));
- if (new_list == NULL)
- return (-1);
-
- for (count = 0; (*list)[count] != NULL; count++)
- new_list[count] = (*list)[count];
- free(*list);
- *list = new_list;
- }
-
- (*list)[count] = item;
- }
-
- return (0);
-}
-
-/*
- * list_concatenate() takes in two NULL terminated lists of items (type **)
- * and creates a new list with items from list2 appended on the end of
- * the list of items from list1. The result is a list (type **). If
- * there is a failure, -1 is returned.
- */
-int
-list_concatenate(void ***result, void **list2)
-{
- void **list1;
- int size1 = 0;
- int size2 = 0;
- int new_size = 0;
-
- if ((result == NULL) || ((*result == NULL) && (list2 == NULL))) {
- errno = EINVAL;
- return (-1);
- }
-
- list1 = *result;
-
- if (list1 != NULL)
- for (size1 = 0; list1[size1] != NULL; size1++)
- ;
- if (list2 != NULL)
- for (size2 = 0; list2[size2] != NULL; size2++)
- ;
-
- /* list1 + list2 padded to a multiple of _list_increment */
- new_size = LIST_SIZE(size1 + size2);
-
- if ((*result = (void **)calloc((new_size), sizeof (void *))) != NULL) {
- int count = 0;
-
- if (list1 != NULL)
- for (size1 = 0; list1[size1] != NULL; size1++)
- (*result)[count++] = list1[size1];
- if (list2 != NULL)
- for (size2 = 0; list2[size2] != NULL; size2++)
- (*result)[count++] = list2[size2];
- free(list1);
- }
-
- return (0);
-}
-
-/*
- * list_locate() iterates through the list passed in and uses the comparison
- * routine and element passed in to find an element in the list. It
- * returns the first element matched, or NULL if none exists
- */
-void *
-list_locate(void **list, int (*compare)(void *, void *), void *element)
-{
- int current = 0;
-
- if ((list != NULL) && (element != NULL))
- for (current = 0; list[current] != NULL; current++)
- if ((compare)(list[current], element) == 0)
- return (list[current]);
- return (NULL);
-}
-
-void
-list_remove(void ***list, void *item)
-{
- int i = 0, count;
-
- if ((list == NULL) || (*list == NULL) || (item == NULL))
- return;
-
- /* size the original list */
- for (count = 0; (*list)[count] != NULL; count++)
- if ((*list)[count] == item) { /* mark the location of item */
- i = count;
- item = NULL;
- }
-
- /* if found, remove it */
- if (item == NULL) {
- /* shift the list over the item */
- for (++i; ((*list)[i] != NULL); i++)
- (*list)[i-1] = (*list)[i];
- (*list)[i-1] = NULL;
- }
-
- /* if found, removed, and list should shrink, shrink it */
- if ((item == NULL) && (LIST_SIZE(i) < LIST_SIZE(count))) {
- void **tmp = (void **)calloc(LIST_SIZE(i), sizeof (void *));
-
- if (tmp != NULL) {
- for (i = 0; (*list)[i] != NULL; i++)
- tmp[i] = (*list)[i];
- free(*list);
- *list = tmp;
- }
- }
-}
diff --git a/usr/src/lib/print/libpapi-common/common/mapfile b/usr/src/lib/print/libpapi-common/common/mapfile
deleted file mode 100644
index c1f9e3f1ab..0000000000
--- a/usr/src/lib/print/libpapi-common/common/mapfile
+++ /dev/null
@@ -1,168 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# $Id: mapfile.in,v 1.2 2006/03/02 06:31:36 njacobs Exp $
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-#
-# Common interfaces that are most likely to be shared amongst the various
-# PAPI implementations.
-#
-
-SYMBOL_VERSION SUNW_1.0 {
- global:
- # PAPI Attribute Calls
- papiAttributeListAddValue;
- papiAttributeListAddBoolean;
- papiAttributeListAddCollection;
- papiAttributeListAddDatetime;
- papiAttributeListAddInteger;
- papiAttributeListAddMetadata;
- papiAttributeListAddRange;
- papiAttributeListAddResolution;
- papiAttributeListAddString;
- papiAttributeListDelete;
- papiAttributeListGetValue;
- papiAttributeListGetNext;
- papiAttributeListFind;
- papiAttributeListGetBoolean;
- papiAttributeListGetCollection;
- papiAttributeListGetDatetime;
- papiAttributeListGetInteger;
- papiAttributeListGetMetadata;
- papiAttributeListGetRange;
- papiAttributeListGetResolution;
- papiAttributeListGetString;
- papiAttributeListFromString;
- papiAttributeListToString;
- papiAttributeListFree;
-
- # PAPI Service Calls
- papiServiceCreate { FLAGS = NODYNSORT };
- papiServiceDestroy { FLAGS = NODYNSORT };
- papiServiceSetUserName { FLAGS = NODYNSORT };
- papiServiceSetPassword { FLAGS = NODYNSORT };
- papiServiceSetEncryption { FLAGS = NODYNSORT };
- papiServiceSetAuthCB { FLAGS = NODYNSORT };
- papiServiceSetAppData { FLAGS = NODYNSORT };
- papiServiceGetUserName { FLAGS = NODYNSORT };
- papiServiceGetPassword { FLAGS = NODYNSORT };
- papiServiceGetEncryption;
- papiServiceGetAppData { FLAGS = NODYNSORT };
- papiServiceGetServiceName { FLAGS = NODYNSORT };
- papiServiceGetAttributeList { FLAGS = NODYNSORT };
- papiServiceGetStatusMessage { FLAGS = NODYNSORT };
-
- # PAPI Printer Calls
- papiPrintersList { FLAGS = NODYNSORT };
- papiPrinterQuery { FLAGS = NODYNSORT };
- papiPrinterAdd { FLAGS = NODYNSORT };
- papiPrinterModify { FLAGS = NODYNSORT };
- papiPrinterRemove { FLAGS = NODYNSORT };
- papiPrinterDisable { FLAGS = NODYNSORT };
- papiPrinterEnable { FLAGS = NODYNSORT };
- papiPrinterPause { FLAGS = NODYNSORT };
- papiPrinterResume { FLAGS = NODYNSORT };
- papiPrinterPurgeJobs { FLAGS = NODYNSORT };
- papiPrinterListJobs { FLAGS = NODYNSORT };
- papiPrinterGetAttributeList { FLAGS = NODYNSORT };
- papiPrinterFree { FLAGS = NODYNSORT };
- papiPrinterListFree { FLAGS = NODYNSORT };
-
- # PAPI Job Calls
- papiJobSubmit { FLAGS = NODYNSORT };
- papiJobSubmitByReference { FLAGS = NODYNSORT };
- papiJobValidate { FLAGS = NODYNSORT };
- papiJobStreamOpen { FLAGS = NODYNSORT };
- papiJobStreamWrite { FLAGS = NODYNSORT };
- papiJobStreamClose { FLAGS = NODYNSORT };
- papiJobQuery { FLAGS = NODYNSORT };
- papiJobModify { FLAGS = NODYNSORT };
- papiJobMove { FLAGS = NODYNSORT };
- papiJobCancel { FLAGS = NODYNSORT };
- papiJobHold { FLAGS = NODYNSORT };
- papiJobRelease { FLAGS = NODYNSORT };
- papiJobRestart { FLAGS = NODYNSORT };
- papiJobPromote { FLAGS = NODYNSORT };
- papiJobGetAttributeList { FLAGS = NODYNSORT };
- papiJobGetPrinterName { FLAGS = NODYNSORT };
- papiJobGetId;
- papiJobGetJobTicket { FLAGS = NODYNSORT };
- papiJobFree { FLAGS = NODYNSORT };
- papiJobListFree { FLAGS = NODYNSORT };
-
- # Misc. PAPI Calls
- papiStatusString;
- papiLibrarySupportedCall;
- papiLibrarySupportedCalls;
-};
-
-SYMBOL_VERSION SUNWprivate_1.0 { # Misc. semi-private supporting calls
- global:
- papiServiceSetPeer { FLAGS = NODYNSORT };
- papiJobCreate { FLAGS = NODYNSORT };
- papiJobStreamAdd { FLAGS = NODYNSORT };
- papiJobCommit { FLAGS = NODYNSORT };
-
- # URI
- uri_from_string;
- uri_to_string;
- uri_free;
-
- # list
- list_remove;
- list_append;
- list_concatenate;
-
- # NS
- getprinterbyname { FLAGS = NODYNSORT };
-
- # extra Attribute Calls
- copy_attributes;
- split_and_copy_attributes;
- papiAttributeListPrint;
-
- is_localhost;
-
- local:
- *;
-};
diff --git a/usr/src/lib/print/libpapi-common/common/misc.c b/usr/src/lib/print/libpapi-common/common/misc.c
deleted file mode 100644
index 2688fd0ec0..0000000000
--- a/usr/src/lib/print/libpapi-common/common/misc.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: misc.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <papi.h>
-#include <uri.h>
-#include <config-site.h>
-
-/*
- * The implementations of strlcpy() and strlcat() have been taken directly
- * from OpenSolaris. The contents of this file originated from
- * usr/src/lib/libc/port/gen/strlcpy.c
- * usr/src/lib/libc/port/gen/strcat.c
- */
-
-#ifndef HAVE_STRLCPY
-size_t
-strlcpy(char *dst, const char *src, size_t len)
-{
- size_t slen = strlen(src);
- size_t copied;
-
- if (len == 0)
- return (slen);
-
- if (slen >= len)
- copied = len - 1;
- else
- copied = slen;
- (void) memcpy(dst, src, copied);
- dst[copied] = '\0';
- return (slen);
-}
-#endif
-
-#ifndef HAVE_STRLCAT
-size_t
-strlcat(char *dst, const char *src, size_t dstsize)
-{
- char *df = dst;
- size_t left = dstsize;
- size_t l1;
- size_t l2 = strlen(src);
- size_t copied;
-
- while (left-- != 0 && *df != '\0')
- df++;
- l1 = df - dst;
- if (dstsize == l1)
- return (l1 + l2);
-
- copied = l1 + l2 >= dstsize ? dstsize - l1 - 1 : l2;
- (void) memcpy(dst + l1, src, copied);
- dst[l1+copied] = '\0';
- return (l1 + l2);
-}
-#endif
-
-#if defined(__sun) && defined(__SVR4)
-#include <sys/systeminfo.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/sockio.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-static struct in6_addr **
-local_interfaces()
-{
- struct in6_addr **result = NULL;
- int s;
- struct lifnum n;
- struct lifconf c;
- struct lifreq *r;
- int count;
-
- /* we need a socket to get the interfaces */
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- return (0);
-
- /* get the number of interfaces */
- memset(&n, 0, sizeof (n));
- n.lifn_family = AF_UNSPEC;
- if (ioctl(s, SIOCGLIFNUM, (char *)&n) < 0) {
- close(s);
- return (0); /* no interfaces */
- }
-
- /* get the interface(s) configuration */
- memset(&c, 0, sizeof (c));
- c.lifc_family = AF_UNSPEC;
- c.lifc_buf = calloc(n.lifn_count, sizeof (struct lifreq));
- c.lifc_len = (n.lifn_count * sizeof (struct lifreq));
- if (ioctl(s, SIOCGLIFCONF, (char *)&c) < 0) {
- free(c.lifc_buf);
- close(s);
- return (0); /* can't get interface(s) configuration */
- }
- close(s);
-
- r = c.lifc_req;
- for (count = c.lifc_len / sizeof (struct lifreq);
- count > 0; count--, r++) {
- struct in6_addr v6[1], *addr = NULL;
-
- switch (r->lifr_addr.ss_family) {
- case AF_INET: {
- struct sockaddr_in *s =
- (struct sockaddr_in *)&r->lifr_addr;
- IN6_INADDR_TO_V4MAPPED(&s->sin_addr, v6);
- addr = v6;
- }
- break;
- case AF_INET6: {
- struct sockaddr_in6 *s =
- (struct sockaddr_in6 *)&r->lifr_addr;
- addr = &s->sin6_addr;
- }
- break;
- }
-
- if (addr != NULL) {
- struct in6_addr *a = malloc(sizeof (*a));
-
- memcpy(a, addr, sizeof (*a));
- list_append(&result, a);
- }
- }
- free(c.lifc_buf);
-
- return (result);
-}
-
-static int
-match_interfaces(char *host)
-{
- struct in6_addr **lif = local_interfaces();
- struct hostent *hp;
- int rc = 0;
- int errnum;
-
- /* are there any local interfaces */
- if (lif == NULL)
- return (0);
-
- /* cycle through the host db addresses */
- hp = getipnodebyname(host, AF_INET6, AI_ALL|AI_V4MAPPED, &errnum);
- if (hp != NULL) {
- struct in6_addr **tmp = (struct in6_addr **)hp->h_addr_list;
- int i;
-
- for (i = 0; ((rc == 0) && (tmp[i] != NULL)); i++) {
- int j;
-
- for (j = 0; ((rc == 0) && (lif[j] != NULL)); j++)
- if (memcmp(tmp[i], lif[j],
- sizeof (struct in6_addr)) == 0)
- rc = 1;
- }
- }
- free(lif);
-
- return (rc);
-}
-#endif
-
-int
-is_localhost(char *host)
-{
- char hostname[BUFSIZ];
-
- /* is it "localhost" */
- if (strncasecmp(host, "localhost", 10) == 0)
- return (1);
-
- /* is it the {nodename} */
- sysinfo(SI_HOSTNAME, hostname, sizeof (hostname));
- if (strncasecmp(host, hostname, strlen(hostname)) == 0)
- return (1);
-
-#if defined(__sun) && defined(__SVR4)
- /* does it match one of the host's configured interfaces */
- if (match_interfaces(host) != 0)
- return (1);
-#endif
- return (0);
-}
diff --git a/usr/src/lib/print/libpapi-common/common/papi.h b/usr/src/lib/print/libpapi-common/common/papi.h
deleted file mode 100644
index 5fcaccc584..0000000000
--- a/usr/src/lib/print/libpapi-common/common/papi.h
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _PAPI_H
-#define _PAPI_H
-
-/* $Id: papi.h 161 2006-05-03 04:32:59Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <time.h>
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Types
- */
-
-/* service related types */
-typedef void *papi_service_t;
-typedef void *papi_printer_t;
-typedef void *papi_job_t;
-typedef void *papi_stream_t;
-
-typedef enum {
- PAPI_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
- PAPI_ENCRYPT_NEVER, /* Never encrypt */
- PAPI_ENCRYPT_REQUIRED, /* Encryption required (TLS upgrade) */
- PAPI_ENCRYPT_ALWAYS /* Always encrypt (SSL) */
-} papi_encryption_t;
-
-/* attribute related types */
-typedef enum {
- PAPI_STRING,
- PAPI_INTEGER,
- PAPI_BOOLEAN,
- PAPI_RANGE,
- PAPI_RESOLUTION,
- PAPI_DATETIME,
- PAPI_COLLECTION,
- PAPI_METADATA
-} papi_attribute_value_type_t;
-
-typedef enum {
- PAPI_RES_PER_INCH = 3,
- PAPI_RES_PER_CM
-} papi_resolution_unit_t;
-
-enum { /* for boolean values */
- PAPI_FALSE = 0,
- PAPI_TRUE = 1
-};
-
-typedef enum {
- PAPI_UNSUPPORTED = 0x10,
- PAPI_DEFAULT = 0x11,
- PAPI_UNKNOWN,
- PAPI_NO_VALUE,
- PAPI_NOT_SETTABLE = 0x15,
- PAPI_DELETE = 0x16
-} papi_metadata_t;
-
-#define PAPI_LIST_JOBS_OTHERS 0x0001
-#define PAPI_LIST_JOBS_COMPLETED 0x0002
-#define PAPI_LIST_JOBS_NOT_COMPLETED 0x0004
-#define PAPI_LIST_JOBS_ALL 0xFFFF
-
-typedef struct papi_attribute_s papi_attribute_t;
-
-typedef union {
- char *string; /* PAPI_STRING value */
- int integer; /* PAPI_INTEGER value */
- char boolean; /* PAPI_BOOLEAN value */
- struct { /* PAPI_RANGE value */
- int lower;
- int upper;
- } range;
- struct { /* PAPI_RESOLUTION value */
- int xres;
- int yres;
- papi_resolution_unit_t units;
- } resolution;
- time_t datetime; /* PAPI_DATETIME value */
- papi_attribute_t **collection; /* PAPI_COLLECTION value */
- papi_metadata_t metadata; /* PAPI_METADATA value */
-} papi_attribute_value_t;
-
-struct papi_attribute_s {
- char *name; /* attribute name */
- papi_attribute_value_type_t type; /* type of values */
- papi_attribute_value_t **values; /* list of values */
-};
-
-#define PAPI_ATTR_APPEND 0x0001 /* Add values to attr */
-#define PAPI_ATTR_REPLACE 0x0002 /* Delete existing values, then add */
-#define PAPI_ATTR_EXCL 0x0004 /* Fail if attr exists */
-
-/* job related types */
-typedef enum {
- PAPI_JT_FORMAT_JDF = 0,
- PAPI_JT_FORMAT_PWG = 1
-} papi_jt_format_t;
-
-typedef struct {
- papi_jt_format_t format;
- char *ticket_data;
- char *file_name;
-} papi_job_ticket_t;
-
-/* status related types */
-typedef enum {
- PAPI_OK = 0x0000,
- PAPI_OK_SUBST,
- PAPI_OK_CONFLICT,
- PAPI_OK_IGNORED_SUBSCRIPTIONS,
- PAPI_OK_IGNORED_NOTIFICATIONS,
- PAPI_OK_TOO_MANY_EVENTS,
- PAPI_OK_BUT_CANCEL_SUBSCRIPTION,
- PAPI_REDIRECTION_OTHER_SITE = 0x0300,
- PAPI_BAD_REQUEST = 0x0400,
- PAPI_FORBIDDEN,
- PAPI_NOT_AUTHENTICATED,
- PAPI_NOT_AUTHORIZED,
- PAPI_NOT_POSSIBLE,
- PAPI_TIMEOUT,
- PAPI_NOT_FOUND,
- PAPI_GONE,
- PAPI_REQUEST_ENTITY,
- PAPI_REQUEST_VALUE,
- PAPI_DOCUMENT_FORMAT,
- PAPI_ATTRIBUTES,
- PAPI_URI_SCHEME,
- PAPI_CHARSET,
- PAPI_CONFLICT,
- PAPI_COMPRESSION_NOT_SUPPORTED,
- PAPI_COMPRESSION_ERROR,
- PAPI_DOCUMENT_FORMAT_ERROR,
- PAPI_DOCUMENT_ACCESS_ERROR,
- PAPI_ATTRIBUTES_NOT_SETTABLE,
- PAPI_IGNORED_ALL_SUBSCRIPTIONS,
- PAPI_TOO_MANY_SUBSCRIPTIONS,
- PAPI_IGNORED_ALL_NOTIFICATIONS,
- PAPI_PRINT_SUPPORT_FILE_NOT_FOUND,
- PAPI_INTERNAL_ERROR = 0x0500,
- PAPI_OPERATION_NOT_SUPPORTED,
- PAPI_SERVICE_UNAVAILABLE,
- PAPI_VERSION_NOT_SUPPORTED,
- PAPI_DEVICE_ERROR,
- PAPI_TEMPORARY_ERROR,
- PAPI_NOT_ACCEPTING,
- PAPI_PRINTER_BUSY,
- PAPI_ERROR_JOB_CANCELLED,
- PAPI_MULTIPLE_JOBS_NOT_SUPPORTED,
- PAPI_PRINTER_IS_DEACTIVATED,
- PAPI_BAD_ARGUMENT,
- PAPI_JOB_TICKET_NOT_SUPPORTED
-} papi_status_t;
-
-/* list filter related */
-typedef enum {
- PAPI_FILTER_BITMASK = 0
-} papi_filter_type_t;
-
-typedef struct {
- papi_filter_type_t type;
- union {
- struct { /* PAPI_FILTER_BITMASK */
- unsigned int mask;
- unsigned int value;
- } bitmask;
- } filter;
-} papi_filter_t;
-
-enum {
- PAPI_PRINTER_LOCAL = 0x0000, /* Local destination */
- PAPI_PRINTER_CLASS = 0x0001, /* Printer class */
- PAPI_PRINTER_REMOTE = 0x0002, /* Remote destination */
- PAPI_PRINTER_BW = 0x0004, /* Can do B&W printing */
- PAPI_PRINTER_COLOR = 0x0008, /* Can do color printing */
- PAPI_PRINTER_DUPLEX = 0x0010, /* Can do duplex printing */
- PAPI_PRINTER_STAPLE = 0x0020, /* Can do stapling */
- PAPI_PRINTER_COPIES = 0x0040, /* Can do copies */
- PAPI_PRINTER_COLLATE = 0x0080, /* Can collate copies */
- PAPI_PRINTER_PUNCH = 0x0100, /* Can punch output */
- PAPI_PRINTER_COVER = 0x0200, /* Can cover output */
- PAPI_PRINTER_BIND = 0x0400, /* Can bind output */
- PAPI_PRINTER_SORT = 0x0800, /* Can sort output */
- PAPI_PRINTER_SMALL = 0x1000, /* Can do letter/legal/a4 */
- PAPI_PRINTER_MEDIUM = 0x2000, /* Can do tabloid/B/C/A3/A2 */
- PAPI_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */
- PAPI_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */
- PAPI_PRINTER_IMPLICIT = 0x10000, /* implicit class */
- PAPI_PRINTER_DEFAULT = 0x20000, /* Default printer on network */
- PAPI_PRINTER_OPTIONS = 0xfffc /* ~ (CLASS | REMOTE | IMPLICIT) */
-};
-
-/*
- * Functions
- */
-
-/* Service related */
-extern papi_status_t papiServiceCreate(papi_service_t *handle,
- char *service_name, char *user_name,
- char *password,
- int (*authCB)(papi_service_t svc,
- void *app_data),
- papi_encryption_t encryption,
- void *app_data);
-extern void papiServiceDestroy(papi_service_t handle);
-extern papi_status_t papiServiceSetUserName(papi_service_t handle,
- char *user_name);
-extern papi_status_t papiServiceSetPassword(papi_service_t handle,
- char *password);
-extern papi_status_t papiServiceSetEncryption(papi_service_t handle,
- papi_encryption_t encryption);
-extern papi_status_t papiServiceSetAuthCB(papi_service_t handle,
- int (*authCB)(papi_service_t s,
- void *app_data));
-extern papi_status_t papiServiceSetAppData(papi_service_t handle,
- void *app_data);
-extern char *papiServiceGetServiceName(papi_service_t handle);
-extern char *papiServiceGetUserName(papi_service_t handle);
-extern char *papiServiceGetPassword(papi_service_t handle);
-extern papi_encryption_t papiServiceGetEncryption(papi_service_t handle);
-extern void *papiServiceGetAppData(papi_service_t handle);
-extern papi_attribute_t **papiServiceGetAttributeList(papi_service_t handle);
-extern char *papiServiceGetStatusMessage(papi_service_t handle);
-
-/* Attribute related */
-extern papi_status_t papiAttributeListAddValue(papi_attribute_t ***attrs,
- int flags, char *name,
- papi_attribute_value_type_t type,
- papi_attribute_value_t *value);
-extern papi_status_t papiAttributeListAddString(papi_attribute_t ***attrs,
- int flags, char *name, char *string);
-extern papi_status_t papiAttributeListAddInteger(papi_attribute_t ***attrs,
- int flags, char *name, int integer);
-extern papi_status_t papiAttributeListAddBoolean(papi_attribute_t ***attrs,
- int flags, char *name, char boolean);
-extern papi_status_t papiAttributeListAddRange(papi_attribute_t ***attrs,
- int flags, char *name,
- int lower, int upper);
-extern papi_status_t papiAttributeListAddResolution(papi_attribute_t ***attrs,
- int flags, char *name,
- int xres, int yres,
- papi_resolution_unit_t units);
-extern papi_status_t papiAttributeListAddDatetime(papi_attribute_t ***attrs,
- int flags, char *name, time_t datetime);
-extern papi_status_t papiAttributeListAddCollection(papi_attribute_t ***attrs,
- int flags, char *name,
- papi_attribute_t **collection);
-extern papi_status_t papiAttributeListAddMetadata(papi_attribute_t ***attrs,
- int flags, char *name,
- papi_metadata_t metadata);
-extern papi_status_t papiAttributeListDelete(papi_attribute_t ***attributes,
- char *name);
-extern papi_status_t papiAttributeListGetValue(papi_attribute_t **list,
- void **iterator, char *name,
- papi_attribute_value_type_t type,
- papi_attribute_value_t **value);
-extern papi_status_t papiAttributeListGetString(papi_attribute_t **list,
- void **iterator, char *name,
- char **vptr);
-extern papi_status_t papiAttributeListGetInteger(papi_attribute_t **list,
- void **iterator, char *name, int *vptr);
-extern papi_status_t papiAttributeListGetBoolean(papi_attribute_t **list,
- void **iterator, char *name,
- char *vptr);
-extern papi_status_t papiAttributeListGetRange(papi_attribute_t **list,
- void **iterator, char *name,
- int *min, int *max);
-extern papi_status_t papiAttributeListGetResolution(papi_attribute_t **list,
- void **iterator, char *name,
- int *x, int *y,
- papi_resolution_unit_t *units);
-extern papi_status_t papiAttributeListGetDatetime(papi_attribute_t **list,
- void **iterator, char *name,
- time_t *dt);
-extern papi_status_t papiAttributeListGetCollection(papi_attribute_t **list,
- void **iterator, char *name,
- papi_attribute_t ***collection);
-extern papi_status_t papiAttributeListGetMetadata(papi_attribute_t **list,
- void **iterator, char *name,
- papi_metadata_t *vptr);
-extern papi_attribute_t *papiAttributeListFind(papi_attribute_t **list,
- char *name);
-extern papi_attribute_t *papiAttributeListGetNext(papi_attribute_t **list,
- void **iterator);
-extern void papiAttributeListFree(papi_attribute_t **attributes);
-
-extern papi_status_t papiAttributeListFromString(papi_attribute_t ***attrs,
- int flags, char *string);
-extern papi_status_t papiAttributeListToString(papi_attribute_t **attrs,
- char *delim,
- char *buffer, size_t buflen);
-extern void papiAttributeListPrint(FILE *fp, papi_attribute_t **list,
- char *prefix_fmt, ...);
-
-/* Printer related */
-extern papi_status_t papiPrintersList(papi_service_t handle,
- char **requested_attrs,
- papi_filter_t *filter,
- papi_printer_t **printers);
-extern papi_status_t papiPrinterQuery(papi_service_t handle, char *name,
- char **requested_attrs,
- papi_attribute_t **job_attributes,
- papi_printer_t *printer);
-extern papi_status_t papiPrinterAdd(papi_service_t handle, char *name,
- papi_attribute_t **attributes,
- papi_printer_t *printer);
-extern papi_status_t papiPrinterModify(papi_service_t handle, char *name,
- papi_attribute_t **attributes,
- papi_printer_t *printer);
-extern papi_status_t papiPrinterRemove(papi_service_t handle, char *name);
-extern papi_status_t papiPrinterDisable(papi_service_t handle, char *name,
- char *message);
-extern papi_status_t papiPrinterEnable(papi_service_t handle, char *name);
-extern papi_status_t papiPrinterPause(papi_service_t handle, char *name,
- char *message);
-extern papi_status_t papiPrinterResume(papi_service_t handle, char *name);
-extern papi_status_t papiPrinterPurgeJobs(papi_service_t handle,
- char *name, papi_job_t **jobs);
-extern papi_status_t papiPrinterListJobs(papi_service_t handle,
- char *name, char **requested_attrs,
- int type_mask, int max_num_jobs,
- papi_job_t **jobs);
-extern papi_attribute_t **papiPrinterGetAttributeList(papi_printer_t printer);
-extern void papiPrinterFree(papi_printer_t printer);
-extern void papiPrinterListFree(papi_printer_t *printers);
-
-/* Job related */
-extern papi_status_t papiJobSubmit(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job);
-extern papi_status_t papiJobSubmitByReference(papi_service_t handle,
- char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job);
-extern papi_status_t papiJobValidate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job);
-extern papi_status_t papiJobStreamOpen(papi_service_t handle,
- char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- papi_stream_t *stream);
-extern papi_status_t papiJobStreamWrite(papi_service_t handle,
- papi_stream_t stream,
- void *buffer, size_t buflen);
-extern papi_status_t papiJobStreamClose(papi_service_t handle,
- papi_stream_t stream,
- papi_job_t *job);
-extern papi_status_t papiJobQuery(papi_service_t handle, char *printer,
- int32_t job_id, char **requested_attrs,
- papi_job_t *job);
-extern papi_status_t papiJobModify(papi_service_t handle, char *printer,
- int32_t job_id,
- papi_attribute_t **attributes,
- papi_job_t *job);
-extern papi_status_t papiJobMove(papi_service_t handle, char *printer,
- int32_t job_id, char *destination);
-extern papi_status_t papiJobCancel(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_status_t papiJobHold(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_status_t papiJobRelease(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_status_t papiJobRestart(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_status_t papiJobPromote(papi_service_t handle, char *printer,
- int32_t job_id);
-extern papi_attribute_t **papiJobGetAttributeList(papi_job_t printer);
-extern char *papiJobGetPrinterName(papi_job_t printer);
-extern int32_t papiJobGetId(papi_job_t printer);
-extern papi_job_ticket_t *papiJobGetJobTicket(papi_job_t printer);
-extern void papiJobFree(papi_job_t job);
-extern void papiJobListFree(papi_job_t *jobs);
-
-#ifdef SOLARIS_PRIVATE_POST_0_9
-/*
- * These have been added to support IPP create-job/send-document with PAPI v0.9
- * in an IPP listener using PAPI as it's spooler interface. A future version
- * of the API is expected to support this type of functionality
- */
-extern papi_status_t papiJobCreate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- papi_job_t *job);
-extern papi_status_t papiJobStreamAdd(papi_service_t handle, char *printer,
- int32_t id, papi_stream_t *stream);
-extern papi_status_t papiJobCommit(papi_service_t handle, char *printer,
- int32_t id);
-extern papi_status_t papiServiceSetPeer(papi_service_t handle, int peerfd);
-#endif /* SOLARIS_PRIVATE_POST_0_9 */
-
-extern char *papiStatusString(papi_status_t status);
-
-/*
- * Internal functions that aren't in the API, but are shared across
- * protocol support implementations(psms) and the tightly bound
- * listener library. Do not use these in your applications.
- */
-extern void list_append();
-extern void list_concatenate();
-extern void list_remove();
-extern void copy_attributes(papi_attribute_t ***result,
- papi_attribute_t **list);
-extern void split_and_copy_attributes(char **list,
- papi_attribute_t **attributes,
- papi_attribute_t ***in,
- papi_attribute_t ***out);
-
-extern papi_attribute_t **getprinterbyname(char *name, char *ns);
-
-extern int is_localhost(char *hostname);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PAPI_H */
diff --git a/usr/src/lib/print/libpapi-common/common/status.c b/usr/src/lib/print/libpapi-common/common/status.c
deleted file mode 100644
index 897aa1322d..0000000000
--- a/usr/src/lib/print/libpapi-common/common/status.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: status.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdlib.h>
-#include <papi.h>
-#include <libintl.h>
-
-char *
-papiStatusString(const papi_status_t status)
-{
- switch (status) {
- case PAPI_OK:
- return (gettext("ok"));
- case PAPI_OK_SUBST:
- return (gettext("ok-substitution"));
- case PAPI_OK_CONFLICT:
- return (gettext("ok-conflict"));
- case PAPI_OK_IGNORED_SUBSCRIPTIONS:
- return (gettext("ok-ignored-subscriptions"));
- case PAPI_OK_IGNORED_NOTIFICATIONS:
- return (gettext("ok-ignored-notifications"));
- case PAPI_OK_TOO_MANY_EVENTS:
- return (gettext("ok-too-many-events"));
- case PAPI_OK_BUT_CANCEL_SUBSCRIPTION:
- return (gettext("ok-but-cancel-subscription"));
- case PAPI_REDIRECTION_OTHER_SITE:
- return (gettext("redirection-to-other-site"));
- case PAPI_BAD_REQUEST:
- return (gettext("bad-request"));
- case PAPI_FORBIDDEN:
- return (gettext("forbidden"));
- case PAPI_NOT_AUTHENTICATED:
- return (gettext("not-authenticated"));
- case PAPI_NOT_AUTHORIZED:
- return (gettext("not-authorized"));
- case PAPI_NOT_POSSIBLE:
- return (gettext("not-possible"));
- case PAPI_TIMEOUT:
- return (gettext("timeout"));
- case PAPI_NOT_FOUND:
- return (gettext("not-found"));
- case PAPI_GONE:
- return (gettext("gone"));
- case PAPI_REQUEST_ENTITY:
- return (gettext("request-entity"));
- case PAPI_REQUEST_VALUE:
- return (gettext("request-value"));
- case PAPI_DOCUMENT_FORMAT:
- return (gettext("document-format"));
- case PAPI_ATTRIBUTES:
- return (gettext("attributes"));
- case PAPI_URI_SCHEME:
- return (gettext("uri-scheme"));
- case PAPI_CHARSET:
- return (gettext("charset"));
- case PAPI_CONFLICT:
- return (gettext("conflict"));
- case PAPI_COMPRESSION_NOT_SUPPORTED:
- return (gettext("compression-not-supported"));
- case PAPI_COMPRESSION_ERROR:
- return (gettext("compression-error"));
- case PAPI_DOCUMENT_FORMAT_ERROR:
- return (gettext("document-format-error"));
- case PAPI_DOCUMENT_ACCESS_ERROR:
- return (gettext("document-access-error"));
- case PAPI_ATTRIBUTES_NOT_SETTABLE:
- return (gettext("attributes-not-settable"));
- case PAPI_IGNORED_ALL_SUBSCRIPTIONS:
- return (gettext("ignored-all-subscriptions"));
- case PAPI_TOO_MANY_SUBSCRIPTIONS:
- return (gettext("too-many-subscriptions"));
- case PAPI_IGNORED_ALL_NOTIFICATIONS:
- return (gettext("ignored-all-notifications"));
- case PAPI_PRINT_SUPPORT_FILE_NOT_FOUND:
- return (gettext("print-support-file-not-found"));
- case PAPI_INTERNAL_ERROR:
- return (gettext("internal-error"));
- case PAPI_OPERATION_NOT_SUPPORTED:
- return (gettext("operation-not-supported"));
- case PAPI_SERVICE_UNAVAILABLE:
- return (gettext("service-unavailable"));
- case PAPI_VERSION_NOT_SUPPORTED:
- return (gettext("version-not-supported"));
- case PAPI_DEVICE_ERROR:
- return (gettext("device-error"));
- case PAPI_TEMPORARY_ERROR:
- return (gettext("temporary-error"));
- case PAPI_NOT_ACCEPTING:
- return (gettext("not-accepting"));
- case PAPI_PRINTER_BUSY:
- return (gettext("printer-busy"));
- case PAPI_ERROR_JOB_CANCELLED:
- return (gettext("error-job-cancelled"));
- case PAPI_MULTIPLE_JOBS_NOT_SUPPORTED:
- return (gettext("multiple-jobs-not-supported"));
- case PAPI_PRINTER_IS_DEACTIVATED:
- return (gettext("printer-is-deactivated"));
- case PAPI_BAD_ARGUMENT:
- return (gettext("bad-argument"));
- case PAPI_JOB_TICKET_NOT_SUPPORTED:
- return (gettext("job-ticket-not-supported"));
- default:
- return (gettext("unknown-error"));
- }
-}
diff --git a/usr/src/lib/print/libpapi-common/common/uri.c b/usr/src/lib/print/libpapi-common/common/uri.c
deleted file mode 100644
index 31f6ce4eff..0000000000
--- a/usr/src/lib/print/libpapi-common/common/uri.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/* $Id: uri.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <errno.h>
-#include "uri.h"
-
-/*
- * This will handle the following forms:
- * scheme:scheme_data
- * scheme://[[user[:password]@]host[:port]]/path[[#fragment]|[?query]]
- */
-int
-uri_from_string(char *string, uri_t **uri)
-{
- char *ptr;
- uri_t *u;
-
- if ((string == NULL) || (uri == NULL)) {
- errno = EINVAL;
- return (-1);
- }
-
- /* find the scheme:scheme_part split */
- if ((ptr = strchr(string, ':')) == NULL) {
- errno = EINVAL;
- return (-1);
- }
-
- if ((*uri = u = calloc(1, sizeof (*u))) == NULL)
- return (-1);
-
- u->scheme = strndup(string, ptr - string);
-
- if ((ptr[1] == '/') && (ptr[2] == '/')) {
- /*
- * CSTYLED
- * scheme://[host_part]/[path_part]
- */
- char *end = NULL, *user = NULL, *host = NULL, *path = NULL;
-
- string = ptr + 3; /* skip the :// */
-
- if ((path = end = strchr(string, '/')) == NULL)
- for (end = string; *end != '\0'; end++)
- continue;
-
- u->host_part = strndup(string, end - string);
-
- for (host = string; host < end; host ++)
- if (*host == '@') {
- /* string to host is the user part */
- u->user_part = strndup(string, host-string);
- /* host+1 to end is the host part */
- u->host_part = strndup(host + 1,
- end - (host+1));
- user = string;
- host++;
- break;
- }
-
- if (user != NULL) {
- char *password = NULL;
-
- for (password = user; (password < host - 1); password++)
- if (*password == ':') {
- u->password = strndup(password + 1,
- host - password - 2);
- break;
- }
- u->user = strndup(user, password - user);
- } else
- host = string;
-
- if (host != NULL) {
- char *port = NULL;
-
- for (port = host; (port < path); port++)
- if ((*port == ':') || (*port == '/'))
- break;
-
- if (port < path) {
- u->port = strndup(port + 1, path - port - 1);
- }
-
- u->host = strndup(host, port - host);
- }
-
- if (path != NULL) {
- char *name = strrchr(path, '/');
-
- u->path_part = strdup(path);
-
- if (name != NULL) {
- char *query, *fragment;
-
- query = strrchr(name, '?');
- if ((query != NULL) && (*query != '\0')) {
- u->query = strdup(query + 1);
- end = query;
- } else {
- for (end = path; *end != '\0'; end++)
- continue;
- }
-
- fragment = strrchr(name, '#');
- if ((fragment != NULL) && (*fragment != '\0')) {
- u->fragment = strndup(fragment + 1,
- end - fragment - 1);
- end = fragment;
- }
-
- u->path = strndup(path, end - path);
- }
- }
- } else { /* scheme:scheme_part */
- u->scheme_part = strdup(&ptr[1]);
- }
-
- if ((u->host_part == NULL) && (u->path_part == NULL) &&
- (u->scheme_part == NULL)) {
- errno = EINVAL;
- uri_free(u);
- *uri = NULL;
- return (-1);
- }
-
- return (0);
-}
-
-int
-uri_to_string(uri_t *uri, char *buffer, size_t buflen)
-{
- char *uri_ppfix;
-
- if ((uri == NULL) || (buffer == NULL) || (buflen == 0) ||
- (uri->scheme == NULL) ||
- ((uri->password != NULL) && (uri->user == NULL)) ||
- ((uri->user != NULL) && (uri->host == NULL)) ||
- ((uri->port != NULL) && (uri->host == NULL)) ||
- ((uri->fragment != NULL) && (uri->path == NULL)) ||
- ((uri->query != NULL) && (uri->path == NULL))) {
- errno = EINVAL;
- return (-1);
- }
- if (uri->path == NULL || uri->path[0] == '/')
- uri_ppfix = "";
- else
- uri_ppfix = "/";
-
- (void) memset(buffer, 0, buflen);
-
- if (uri->scheme_part == NULL) {
- (void) snprintf(buffer, buflen,
- "%s://%s%s%s%s%s%s%s%s%s%s%s%s%s",
- uri->scheme,
- (uri->user ? uri->user : ""),
- (uri->password ? ":" : ""),
- (uri->password ? uri->password : ""),
- (uri->user ? "@": ""),
- (uri->host ? uri->host : ""),
- (uri->port ? ":" : ""),
- (uri->port ? uri->port : ""),
- uri_ppfix,
- (uri->path ? uri->path : ""),
- (uri->fragment ? "#" : ""),
- (uri->fragment ? uri->fragment : ""),
- (uri->query ? "?" : ""),
- (uri->query ? uri->query : ""));
- } else {
- (void) snprintf(buffer, buflen, "%s:%s", uri->scheme,
- uri->scheme_part);
- }
-
- return (0);
-}
-
-void
-uri_free(uri_t *uri)
-{
- if (uri != NULL) {
- if (uri->scheme != NULL)
- free(uri->scheme);
- if (uri->scheme_part != NULL)
- free(uri->scheme_part);
- if (uri->user != NULL)
- free(uri->user);
- if (uri->password != NULL)
- free(uri->password);
- if (uri->host != NULL)
- free(uri->host);
- if (uri->port != NULL)
- free(uri->port);
- if (uri->path != NULL)
- free(uri->path);
- if (uri->fragment != NULL)
- free(uri->fragment);
- if (uri->query != NULL)
- free(uri->query);
- /* help me debug */
- if (uri->user_part != NULL)
- free(uri->user_part);
- if (uri->host_part != NULL)
- free(uri->host_part);
- if (uri->path_part != NULL)
- free(uri->path_part);
- free(uri);
- }
-}
-
-#ifdef DEADBEEF
-static void
-uri_dump(FILE *fp, uri_t *uri)
-{
- if (uri != NULL) {
- fprintf(fp, "URI:\n");
- if (uri->scheme != NULL)
- fprintf(fp, "scheme: %s\n", uri->scheme);
- if (uri->scheme_part != NULL)
- fprintf(fp, "scheme_part: %s\n", uri->scheme_part);
- if (uri->user != NULL)
- fprintf(fp, "user: %s\n", uri->user);
- if (uri->password != NULL)
- fprintf(fp, "password: %s\n", uri->password);
- if (uri->host != NULL)
- fprintf(fp, "host: %s\n", uri->host);
- if (uri->port != NULL)
- fprintf(fp, "port: %s\n", uri->port);
- if (uri->path != NULL)
- fprintf(fp, "path: %s\n", uri->path);
- if (uri->fragment != NULL)
- fprintf(fp, "fragment: %s\n", uri->fragment);
- if (uri->query != NULL)
- fprintf(fp, "query: %s\n", uri->query);
- /* help me debug */
- if (uri->user_part != NULL)
- fprintf(fp, "user_part: %s\n", uri->user_part);
- if (uri->host_part != NULL)
- fprintf(fp, "host_part: %s\n", uri->host_part);
- if (uri->path_part != NULL)
- fprintf(fp, "path_part: %s\n", uri->path_part);
- fflush(fp);
- }
-}
-
-int
-main(int argc, char *argv[])
-{
- uri_t *u = NULL;
-
- if (argc != 2) {
- fprintf(stderr, "Usage: %s uri\n", argv[0]);
- exit(1);
- }
-
- if (uri_from_string(argv[1], &u) == 0) {
- char buf[BUFSIZ];
-
- uri_dump(stdout, u);
- uri_to_string(u, buf, sizeof (buf));
- fprintf(stdout, "reconstituted: %s\n", buf);
-
- uri_to_string(u, buf, 12);
- fprintf(stdout, "reconstituted(12): %s\n", buf);
- } else
- printf(" failed for %s (%s)\n", argv[1], strerror(errno));
-
- exit(0);
-}
-#endif /* DEADBEEF */
diff --git a/usr/src/lib/print/libpapi-common/i386/Makefile b/usr/src/lib/print/libpapi-common/i386/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libpapi-common/i386/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/libpapi-common/sparc/Makefile b/usr/src/lib/print/libpapi-common/sparc/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libpapi-common/sparc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/libpapi-dynamic/Makefile b/usr/src/lib/print/libpapi-dynamic/Makefile
deleted file mode 100644
index b92d620b10..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.lib
-
-#HDRS = papi.h
-#HDRDIR = common
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all clean clobber install: .WAIT $(SUBDIRS)
-
-lint: # $(SUBDIRS)
-
-install_h: # $(ROOTHDRS)
-
-check: # $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-dynamic/Makefile.com b/usr/src/lib/print/libpapi-dynamic/Makefile.com
deleted file mode 100644
index 8a51154c48..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/Makefile.com
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-LIBRARY = libpapi.a
-VERS = .0
-OBJECTS = job.o nss.o printer.o psm.o service.o
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
-
-SRCDIR = ../common
-
-ROOTLIBDIR= $(ROOT)/usr/lib
-
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-MAPFILES = $(SRCDIR)/mapfile
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(SRCDIR)
-CPPFLAGS += -I../../libpapi-common/common
-CPPFLAGS += -DNSS_SOLARIS
-LDLIBS += -lc
-
-CERRWARN += -_gcc=-Wno-unused-variable
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-lint: lintcheck
-
-include ../../../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-dynamic/common/job.c b/usr/src/lib/print/libpapi-dynamic/common/job.c
deleted file mode 100644
index e7bca751a0..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/common/job.c
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: job.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <papi_impl.h>
-
-void
-papiJobFree(papi_job_t job)
-{
- job_t *tmp = (job_t *)job;
-
- if (tmp != NULL) {
- void (*f)();
-
- f = (void (*)())psm_sym(tmp->svc, "papiJobFree");
- if (f != NULL)
- f(tmp->job);
- free(tmp);
- }
-}
-
-void
-papiJobListFree(papi_job_t *jobs)
-{
- if (jobs != NULL) {
- int i;
-
- for (i = 0; jobs[i] != NULL; i++)
- papiJobFree(jobs[i]);
- free(jobs);
- }
-}
-
-papi_attribute_t **
-papiJobGetAttributeList(papi_job_t job)
-{
- papi_attribute_t **result = NULL;
- job_t *j = job;
-
- if (job != NULL) {
- papi_attribute_t **(*f)();
-
- f = (papi_attribute_t **(*)())psm_sym(j->svc,
- "papiJobGetAttributeList");
- if (f != NULL)
- result = f(j->job);
- }
-
- return (result);
-}
-
-char *
-papiJobGetPrinterName(papi_job_t job)
-{
- char *result = NULL;
- job_t *j = job;
-
- if (job != NULL) {
- char *(*f)();
-
- f = (char *(*)())psm_sym(j->svc, "papiJobGetPrinterName");
- if (f != NULL)
- result = f(j->job);
- }
-
- return (result);
-}
-
-int32_t
-papiJobGetId(papi_job_t job)
-{
- int32_t result = -1;
- job_t *j = job;
-
- if (job != NULL) {
- int32_t (*f)();
-
- f = (int32_t (*)())psm_sym(j->svc, "papiJobGetId");
- if (f != NULL)
- result = f(j->job);
- }
-
- return (result);
-}
-
-papi_job_ticket_t *
-papiJobGetJobTicket(papi_job_t job)
-{
- papi_job_ticket_t *result = NULL;
- job_t *j = job;
-
- if (job != NULL) {
- papi_job_ticket_t *(*f)();
-
- f = (papi_job_ticket_t *(*)())psm_sym(j->svc,
- "papiJobGetJobTicket");
- if (f != NULL)
- result = f(j->job);
- }
-
- return (result);
-}
-
-/* common support for papiJob{Submit|SubmitByReference|Validate} */
-static papi_status_t
-_papi_job_submit_reference_or_validate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job,
- char *function)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- job_t *j = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printer == NULL) || (files == NULL) ||
- (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- j->svc = svc;
- f = (papi_status_t (*)())psm_sym(j->svc, function);
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, job_attributes,
- job_ticket, files, &j->job);
-
- return (result);
-}
-
-papi_status_t
-papiJobSubmit(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
-{
- return (_papi_job_submit_reference_or_validate(handle, printer,
- job_attributes, job_ticket, files, job,
- "papiJobSubmit"));
-}
-
-papi_status_t
-papiJobSubmitByReference(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
-{
- return (_papi_job_submit_reference_or_validate(handle, printer,
- job_attributes, job_ticket, files, job,
- "papiJobSubmitByReference"));
-}
-
-papi_status_t
-papiJobValidate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
-{
- return (_papi_job_submit_reference_or_validate(handle, printer,
- job_attributes, job_ticket, files, job,
- "papiJobValidate"));
-}
-
-papi_status_t
-papiJobStreamOpen(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, papi_stream_t *stream)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printer == NULL) || (stream == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiJobStreamOpen");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, job_attributes,
- job_ticket, stream);
-
- return (result);
-}
-
-papi_status_t
-papiJobStreamWrite(papi_service_t handle,
- papi_stream_t stream, void *buffer, size_t buflen)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (stream == NULL) || (buffer == NULL) ||
- (buflen == 0))
- return (PAPI_BAD_ARGUMENT);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiJobStreamWrite");
- if (f != NULL)
- result = f(svc->svc_handle, stream, buffer, buflen);
-
- return (result);
-}
-
-papi_status_t
-papiJobStreamClose(papi_service_t handle, papi_stream_t stream, papi_job_t *job)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- job_t *j = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (stream == NULL) || (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- j->svc = svc;
- f = (papi_status_t (*)())psm_sym(j->svc, "papiJobStreamClose");
- if (f != NULL)
- result = f(svc->svc_handle, stream, &j->job);
-
- return (result);
-}
-
-papi_status_t
-papiJobQuery(papi_service_t handle, char *printer, int32_t job_id,
- char **requested_attrs, papi_job_t *job)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- job_t *j = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- j->svc = svc;
- f = (papi_status_t (*)())psm_sym(j->svc, "papiJobQuery");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, job_id,
- requested_attrs, &j->job);
-
- return (result);
-}
-
-papi_status_t
-papiJobMove(papi_service_t handle, char *printer, int32_t job_id,
- char *destination)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiJobMove");
- if (f != NULL) {
- papi_attribute_t **attrs = getprinterbyname(destination, NULL);
-
- papiAttributeListGetString(attrs, NULL,
- "printer-uri-supported", &destination);
- result = f(svc->svc_handle, svc->name, job_id, destination);
- papiAttributeListFree(attrs);
- }
-
- return (result);
-}
-
-/* common support for papiJob{Cancel|Release|Restart|Promote} */
-static papi_status_t
-_papi_job_handle_printer_id(papi_service_t handle,
- char *printer, int32_t job_id, char *function)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, function);
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, job_id);
-
- return (result);
-}
-
-papi_status_t
-papiJobCancel(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_papi_job_handle_printer_id(handle, printer, job_id,
- "papiJobCancel"));
-}
-
-papi_status_t
-papiJobRelease(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_papi_job_handle_printer_id(handle, printer, job_id,
- "papiJobRelease"));
-}
-
-papi_status_t
-papiJobRestart(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_papi_job_handle_printer_id(handle, printer, job_id,
- "papiJobRestart"));
-}
-
-papi_status_t
-papiJobPromote(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_papi_job_handle_printer_id(handle, printer, job_id,
- "papiJobPromote"));
-}
-
-papi_status_t
-papiJobCommit(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_papi_job_handle_printer_id(handle, printer, job_id,
- "papiJobCommit"));
-}
-
-papi_status_t
-papiJobHold(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_papi_job_handle_printer_id(handle, printer, job_id,
- "papiJobHold"));
-}
-
-papi_status_t
-papiJobModify(papi_service_t handle, char *printer, int32_t job_id,
- papi_attribute_t **attributes, papi_job_t *job)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- job_t *j = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0) ||
- (attributes == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- j->svc = svc;
- f = (papi_status_t (*)())psm_sym(j->svc, "papiJobModify");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, job_id, attributes,
- &j->job);
-
- return (result);
-}
-
-/*
- * The functions defined below are private to Solaris. They are here
- * temporarily, until equivalent functionality makes it's way into the PAPI
- * spec. This is expected in the next minor version after v1.0.
- */
-papi_status_t
-papiJobCreate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, papi_job_t *job)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- job_t *j = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printer == NULL) || (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- j->svc = svc;
- f = (papi_status_t (*)())psm_sym(j->svc, "papiJobCreate");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, job_attributes,
- job_ticket, &j->job);
-
- return (result);
-}
-
-papi_status_t
-papiJobStreamAdd(papi_service_t handle, char *printer, int32_t id,
- papi_stream_t *stream)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiJobStreamAdd");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, id, stream);
-
- return (result);
-}
diff --git a/usr/src/lib/print/libpapi-dynamic/common/mapfile b/usr/src/lib/print/libpapi-dynamic/common/mapfile
deleted file mode 100644
index cc8cb45239..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/common/mapfile
+++ /dev/null
@@ -1,279 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# $Id: mapfile.in,v 1.2 2006/03/02 06:31:36 njacobs Exp $
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-#
-# Common interfaces that are most likely to be shared amongst the various
-# PAPI implementations.
-#
-
-SYMBOL_VERSION SUNW_1.0 {
- global:
- # PAPI Attribute Calls
- papiAttributeListAddValue {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddBoolean {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddCollection {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddDatetime {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddInteger {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddMetadata {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddRange {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddResolution {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListDelete {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetValue {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetNext {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFind {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetBoolean {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetCollection {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetDatetime {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetInteger {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetMetadata {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetRange {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetResolution {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFromString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListToString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFree {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- # PAPI Service Calls
- papiServiceCreate ;
- papiServiceDestroy ;
- papiServiceSetUserName ;
- papiServiceSetPassword ;
- papiServiceSetEncryption ;
- papiServiceSetAuthCB ;
- papiServiceSetAppData ;
- papiServiceGetUserName ;
- papiServiceGetPassword ;
- papiServiceGetEncryption ;
- papiServiceGetAppData ;
- papiServiceGetServiceName ;
- papiServiceGetAttributeList ;
- papiServiceGetStatusMessage ;
-
- # PAPI Printer Calls
- papiPrintersList ;
- papiPrinterQuery ;
- papiPrinterAdd ;
- papiPrinterModify ;
- papiPrinterRemove ;
- papiPrinterDisable ;
- papiPrinterEnable ;
- papiPrinterPause ;
- papiPrinterResume ;
- papiPrinterPurgeJobs ;
- papiPrinterListJobs ;
- papiPrinterGetAttributeList ;
- papiPrinterFree ;
- papiPrinterListFree ;
-
- # PAPI Job Calls
- papiJobSubmit ;
- papiJobSubmitByReference ;
- papiJobValidate ;
- papiJobStreamOpen ;
- papiJobStreamWrite ;
- papiJobStreamClose ;
- papiJobQuery ;
- papiJobModify ;
- papiJobMove ;
- papiJobCancel ;
- papiJobHold ;
- papiJobRelease ;
- papiJobRestart ;
- papiJobPromote ;
- papiJobGetAttributeList ;
- papiJobGetPrinterName ;
- papiJobGetId ;
- papiJobGetJobTicket ;
- papiJobFree ;
- papiJobListFree ;
-
- # Misc. PAPI Calls
- papiStatusString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiLibrarySupportedCall {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiLibrarySupportedCalls {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-};
-
-SYMBOL_VERSION SUNWprivate_1.0 {
- global:
- papiServiceSetPeer ; # extension
- papiJobCreate ;
- papiJobStreamAdd ;
- papiJobCommit ;
-
- # Misc. supporting calls
- # URI
- uri_from_string {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- uri_to_string {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- uri_free {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- # list
- list_remove {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- list_append {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- list_concatenate {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- # NS
- getprinterbyname ;
- is_localhost {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- # extra Attribute Calls
- copy_attributes {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- split_and_copy_attributes {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListPrint {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- local:
- * ;
-} ;
-
-SYMBOL_VERSION FSG_1.0 {} SUNW_1.0;
diff --git a/usr/src/lib/print/libpapi-dynamic/common/nss.c b/usr/src/lib/print/libpapi-dynamic/common/nss.c
deleted file mode 100644
index 5ab245e936..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/common/nss.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- *
- */
-
-/* Id: nss.c 180 2006-07-20 17:33:02Z njacobs $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <syslog.h>
-#include <papi.h>
-#include <uri.h>
-#include <papi_impl.h>
-#ifdef NSS_EMULATION
-#include <nss-emulation.h>
-#elif NSS_SOLARIS
-#include <nss_dbdefs.h>
-#endif
-#include <config-site.h>
-#if defined(__sun) && defined(__SVR4)
-#include <sys/systeminfo.h>
-#endif
-
-
-static char *
-bsdaddr_to_uri(papi_attribute_t **list, char *bsdaddr)
-{
- char *result = NULL;
-
- if (bsdaddr != NULL) {
- char *bsd[3], *tmp, *iter = NULL;
- char buf[512];
-
- tmp = strdup(bsdaddr);
-
- bsd[0] = strtok_r(tmp, ":,", &iter);
- if ((bsd[1] = strtok_r(NULL, ":,", &iter)) == NULL)
- papiAttributeListGetString(list, NULL,
- "printer-name", &bsd[1]);
- bsd[2] = strtok_r(NULL, ":,", &iter);
-
- snprintf(buf, sizeof (buf), "lpd://%s/printers/%s%s%s", bsd[0],
- (bsd[1] != NULL) ? bsd[1] : "",
- (bsd[2] != NULL) ? "#" : "",
- (bsd[2] != NULL) ? bsd[2] : "");
-
- free(tmp);
-
- result = strdup(buf);
- }
-
- return (result);
-}
-
-#if defined(__sun) && defined(__SVR4)
-/*
- * This is an awful HACK to force the dynamic PAPI library to use the
- * lpsched support when the destination apears to be a local lpsched
- * queue on Solaris.
- */
-static void
-solaris_lpsched_shortcircuit_hack(papi_attribute_t ***list)
-{
- papi_attribute_t *attribute;
- uri_t *uri = NULL;
- char *printer = NULL;
- char buf[128], buf2[128];
-
- /* setting this in the calling env can be useful for debugging */
- if (getenv("DISABLE_LPSCHED_SHORTCIRCUIT") != NULL)
- return;
-
- papiAttributeListGetString(*list, NULL,
- "printer-uri-supported", &printer);
- /* if there is no printer-uri-supported, there is nothing to do */
- if (printer == NULL) {
- return;
- }
-
- if (uri_from_string(printer, &uri) < 0) {
- papiAttributeListFree(*list);
- *list = NULL;
- uri_free(uri);
- return;
- }
-
- /* already an lpsched URI ? */
- if (strcasecmp(uri->scheme, "lpsched") == 0) {
- uri_free(uri);
- return;
- }
-
- if (uri->path == NULL) {
- printer = "";
- } else {
- if ((printer = strrchr(uri->path, '/')) == NULL)
- printer = uri->path;
- else
- printer++;
- }
-
- /* is there an lpsched queue (printer/class) */
- snprintf(buf, sizeof (buf), "/etc/lp/interfaces/%s", printer);
- snprintf(buf2, sizeof (buf2), "/etc/lp/classes/%s", printer);
- if ((access(buf, F_OK) < 0) && (access(buf2, F_OK) < 0)) {
- uri_free(uri);
- return;
- }
-
- /* is this the "local" host */
- if ((uri->host != NULL) && (is_localhost(uri->host) == 0)) {
- uri_free(uri);
- return;
- }
-
- snprintf(buf, sizeof (buf), "lpsched://%s/printers/%s",
- (uri->host ? uri->host : "localhost"), printer);
- papiAttributeListAddString(list, PAPI_ATTR_REPLACE,
- "printer-uri-supported", buf);
- uri_free(uri);
-}
-#endif
-
-static void
-fill_printer_uri_supported(papi_attribute_t ***list)
-{
- papi_attribute_t *attribute;
- char *string = NULL;
-
- /* do we have a printer-uri-supported */
- attribute = papiAttributeListFind(*list, "printer-uri-supported");
- if (attribute != NULL) /* we have what we need, return */
- return;
-
- /* do we have a printer-uri (in URI form) to rename */
- attribute = papiAttributeListFind(*list, "printer-uri");
- if ((attribute != NULL) &&
- (attribute->type == PAPI_STRING) &&
- (attribute->values != NULL) &&
- (attribute->values[0]->string != NULL) &&
- (strstr(attribute->values[0]->string, "://") != NULL)) {
- /* rename it in place and return */
- free(attribute->name);
- attribute->name = strdup("printer-uri-supported");
- return;
- }
-
- /* do we have a printers.conf(4) "bsdaddr" to convert */
- papiAttributeListGetString(*list, NULL, "bsdaddr", &string);
- if (string != NULL) { /* parse it, convert it, add it */
- char *uri = bsdaddr_to_uri(*list, string);
-
- if (uri != NULL) {
- papiAttributeListAddString(list, PAPI_ATTR_APPEND,
- "printer-uri-supported", uri);
- papiAttributeListDelete(list, "bsdaddr");
- free(uri);
- return;
- }
- }
-
- /* do we have a printers.conf(4) "rm" (and "rp") to convert */
- papiAttributeListGetString(*list, NULL, "rm", &string);
- if (string != NULL) {
- char *rp = NULL;
-
- /* default to "printer-name", but use "rp" if we have it */
- papiAttributeListGetString(*list, NULL, "printer-name", &rp);
- papiAttributeListGetString(*list, NULL, "rp", &rp);
-
- if (rp != NULL) { /* fill in the uri if we have the data */
- char buf[BUFSIZ];
-
- snprintf(buf, sizeof (buf), "lpd://%s/printers/%s",
- string, rp);
- papiAttributeListAddString(list, PAPI_ATTR_APPEND,
- "printer-uri-supported", strdup(buf));
- return;
- }
- }
-
- /* if were are here, we don't have a printer-uri-supported */
-}
-
-#ifdef NEED_BROKEN_PRINTER_URI_SEMANTIC
-static void
-fill_printer_uri(papi_attribute_t ***list)
-{
- papi_attribute_t *attribute;
- char *uri = NULL;
-
- if ((list == NULL) || (*list == NULL))
- return;
-
- /* do we have a printer-uri */
- attribute = papiAttributeListFind(*list, "printer-uri");
- if (attribute != NULL) /* we have what we need, return */
- return;
-
- /*
- * this is sufficient to fool libgnomeprintpapi, but not promote it's
- * use in the future.
- */
- papiAttributeListAddString(list, PAPI_ATTR_EXCL, "printer-uri",
- "broken printer-uri semantic");
-}
-#endif /* NEED_BROKEN_PRINTER_URI_SEMANTIC */
-
-static void
-cvt_all_to_member_names(papi_attribute_t ***list)
-{
- papi_status_t status;
- void *iter = NULL;
- char *string = NULL;
-
- papiAttributeListGetString(*list, NULL, "member-names", &string);
- if (string != NULL) /* already have a member-names */
- return;
-
- for (status = papiAttributeListGetString(*list, &iter, "all", &string);
- status == PAPI_OK;
- status = papiAttributeListGetString(*list, &iter, NULL, &string)) {
- char *s_iter = NULL, *value, *tmp = strdup(string);
-
- for (value = strtok_r(tmp, ", \t", &s_iter);
- value != NULL;
- value = strtok_r(NULL, ", \t", &s_iter))
- papiAttributeListAddString(list, PAPI_ATTR_APPEND,
- "member-names", value);
- free(tmp);
- }
-}
-
-static papi_attribute_t **
-_cvt_nss_entry_to_printer(char *entry)
-{
- char *key = NULL;
- char *cp;
- char buf[BUFSIZ];
- int in_namelist = 1, buf_pos = 0;
- papi_attribute_t **list = NULL;
-
- if (entry == NULL)
- return (NULL);
-
- memset(buf, 0, sizeof (buf));
- for (cp = entry; *cp != '\0'; cp++) {
- switch (*cp) {
- case ':': /* end of kvp */
- if (in_namelist != 0) {
- papiAttributeListAddString(&list,
- PAPI_ATTR_APPEND, "printer-name", buf);
- in_namelist = 0;
- } else if (key != NULL) {
- papiAttributeListAddString(&list,
- PAPI_ATTR_APPEND, key, buf);
- free(key);
- }
- memset(buf, 0, sizeof (buf));
- buf_pos = 0;
- key = NULL;
- break;
- case '=': /* kvp seperator */
- if (key == NULL) {
- key = strdup(buf);
- memset(buf, 0, sizeof (buf));
- buf_pos = 0;
- } else
- buf[buf_pos++] = *cp;
- break;
- case '|': /* namelist seperator */
- if (in_namelist != 0) {
- papiAttributeListAddString(&list,
- PAPI_ATTR_APPEND, "printer-name", buf);
- memset(buf, 0, sizeof (buf));
- buf_pos = 0;
- } else /* add it to the buffer */
- buf[buf_pos++] = *cp;
- break;
- case '\\': /* escape char */
- buf[buf_pos++] = *(++cp);
- break;
- default:
- buf[buf_pos++] = *cp;
- }
-
- }
-
- if (key != NULL) {
- papiAttributeListAddString(&list, PAPI_ATTR_APPEND, key, buf);
- free(key);
- }
-
- /* resolve any "use" references in the configuration DB */
- key = NULL;
- papiAttributeListGetString(list, NULL, "use", &key);
- if (key != NULL) {
- papi_attribute_t **use_attrs = getprinterbyname(key, NULL);
-
- list_concatenate(&list, use_attrs);
- }
-
- fill_printer_uri_supported(&list);
- cvt_all_to_member_names(&list); /* convert "all" to "member-names" */
-
- return (list);
-}
-
-#if defined(NSS_SOLARIS) && !defined(NSS_EMULATION)
-
-#ifndef NSS_DBNAM__PRINTERS /* not in nss_dbdefs.h because it's private */
-#define NSS_DBNAM__PRINTERS "_printers"
-#endif
-
-static DEFINE_NSS_DB_ROOT(db_root);
-static DEFINE_NSS_GETENT(context);
-
-static char *private_ns = NULL;
-
-static void
-_nss_initf_printers(p)
- nss_db_params_t *p;
-{
- if (private_ns != NULL) {
- /*
- * because we need to support a legacy interface that allows
- * us to select a specific name service, we need to dummy up
- * the parameters to use a private nsswitch database and set
- * the * default_config entry to the name service we are
- * looking into.
- */
- p->name = NSS_DBNAM__PRINTERS; /* "_printers" */
- p->default_config = private_ns;
- } else {
- /* regular behaviour */
- p->name = NSS_DBNAM_PRINTERS; /* "printers" */
- p->default_config = NSS_DEFCONF_PRINTERS;
- }
- syslog(LOG_DEBUG, "database: %s, default: %s",
- (p->name ? p->name : "NULL"),
- (p->default_config ? p->default_config : "NULL"));
-}
-
-/*
- * Return values: 0 = success, 1 = parse error, 2 = erange ...
- * The structure pointer passed in is a structure in the caller's space
- * wherein the field pointers would be set to areas in the buffer if
- * need be. instring and buffer should be separate areas.
- */
-/* ARGSUSED */
-static int
-str2printer(const char *instr, int lenstr, void *ent, char *buffer, int buflen)
-{
- if (lenstr + 1 > buflen)
- return (NSS_STR_PARSE_ERANGE);
-
- /* skip entries that begin with '#' */
- if (instr[0] == '#')
- return (NSS_STR_PARSE_PARSE);
-
- /*
- * We copy the input string into the output buffer
- */
- (void) memcpy(buffer, instr, lenstr);
- buffer[lenstr] = '\0';
-
- return (NSS_STR_PARSE_SUCCESS);
-}
-#endif /* NSS_SOLARIS */
-
-int
-setprinterentry(int stayopen, char *ns)
-{
-#ifdef NSS_EMULATION
- emul_setprinterentry(stayopen);
-#elif NSS_SOLARIS
- private_ns = ns;
- nss_setent(&db_root, _nss_initf_printers, &context);
- private_ns = NULL;
-#endif
- return (0);
-}
-
-
-int
-endprinterentry(int i)
-{
-#ifdef NSS_EMULATION
- emul_endprinterentry();
-#elif NSS_SOLARIS
- nss_endent(&db_root, _nss_initf_printers, &context);
- nss_delete(&db_root);
- private_ns = NULL;
-#endif
- return (0);
-}
-
-/* ARGSUSED2 */
-papi_attribute_t **
-getprinterentry(char *ns)
-{
- papi_attribute_t **result = NULL;
-
-#if defined(NSS_EMULATION) || defined(NSS_SOLARIS)
- char buf[10240];
- nss_status_t res = NSS_NOTFOUND;
-
-#ifdef NSS_EMULATION
- res = emul_getprinterentry_r(buf, sizeof (buf));
-#elif NSS_SOLARIS
- nss_XbyY_args_t arg;
-
- private_ns = ns;
- buf[0] = '\0';
- NSS_XbyY_INIT(&arg, buf, buf, sizeof (buf), str2printer);
- res = nss_getent(&db_root, _nss_initf_printers, &context, &arg);
- (void) NSS_XbyY_FINI(&arg);
- private_ns = NULL;
-#endif
-
- if (res != NSS_SUCCESS)
- buf[0] = '\0';
-
- result = _cvt_nss_entry_to_printer(buf);
-#if defined(__sun) && defined(__SVR4)
- solaris_lpsched_shortcircuit_hack(&result);
-#endif
-#ifdef NEED_BROKEN_PRINTER_URI_SEMANTIC
- fill_printer_uri(&result);
-#endif /* NEED_BROKEN_PRINTER_URI_SEMANTIC */
-#endif
-
-#ifdef DEBUG
- printf("getprinterentry(%s): 0x%8.8x\n", (ns ? ns : "NULL"), result);
- if (result != NULL) {
- char buf[4096];
-
- papiAttributeListToString(result, "\n\t", buf, sizeof (buf));
- printf("\t%s\n", buf);
- }
-#endif /* DEBUG */
-
- return (result);
-}
-
-
-papi_attribute_t **
-getprinterbyname(char *name, char *ns)
-{
- papi_attribute_t **result = NULL;
-
- if (strstr(name, "://") != NULL) { /* shortcut for URI form */
- papiAttributeListAddString(&result, PAPI_ATTR_APPEND,
- "printer-name", name);
- papiAttributeListAddString(&result, PAPI_ATTR_APPEND,
- "printer-uri-supported", name);
- } else if (strchr(name, ':') != NULL) { /* shortcut for POSIX form */
- char *uri = bsdaddr_to_uri(result, name);
-
- papiAttributeListAddString(&result, PAPI_ATTR_APPEND,
- "printer-name", name);
- if (uri != NULL) {
- papiAttributeListAddString(&result, PAPI_ATTR_APPEND,
- "printer-uri-supported", uri);
- free(uri);
- }
- } else { /* anything else */
-#if defined(NSS_EMULATION) || defined(NSS_SOLARIS)
- char buf[10240];
- nss_status_t res = NSS_NOTFOUND;
-
-#ifdef NSS_EMULATION
- res = emul_getprinterbyname_r(name, buf, sizeof (buf));
-#elif NSS_SOLARIS
- nss_XbyY_args_t arg;
-
- private_ns = ns;
- NSS_XbyY_INIT(&arg, buf, buf, sizeof (buf), str2printer);
- arg.key.name = name;
- res = nss_search(&db_root, _nss_initf_printers,
- NSS_DBOP_PRINTERS_BYNAME, &arg);
- (void) NSS_XbyY_FINI(&arg);
- private_ns = NULL;
-
- if (res != NSS_SUCCESS)
- buf[0] = '\0';
-#endif
-
- result = _cvt_nss_entry_to_printer(buf);
-#endif
- }
-#if defined(__sun) && defined(__SVR4)
- solaris_lpsched_shortcircuit_hack(&result);
-#endif
-#ifdef DEBUG
- printf("getprinterbyname(%s): %s = 0x%8.8x\n", (ns ? ns : "NULL"),
- name, result);
- if (result != NULL) {
- char buf[4096];
-
- papiAttributeListToString(result, "\n\t", buf, sizeof (buf));
- printf("\t%s\n", buf);
- }
-#endif /* DEBUG */
-
- return (result);
-}
diff --git a/usr/src/lib/print/libpapi-dynamic/common/papi_impl.h b/usr/src/lib/print/libpapi-dynamic/common/papi_impl.h
deleted file mode 100644
index be28a9de0c..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/common/papi_impl.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _PAPI_IMPL_H
-#define _PAPI_IMPL_H
-
-/* $Id: papi_impl.h 161 2006-05-03 04:32:59Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <papi.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <time.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <uri.h>
-
-/*
- * Implementation specific types/prototypes/definitions follow
- *
- *
- * Ex:
- */
-
-typedef struct {
- papi_attribute_t **attributes;
- void *so_handle;
- void *svc_handle;
- char *name;
- char *user;
- char *password;
- int (*authCB)(papi_service_t svc, void *app_data);
- papi_encryption_t encryption;
- void *app_data;
- uri_t *uri;
- int peer_fd;
-} service_t;
-
-typedef struct job {
- service_t *svc;
- papi_job_t *job;
-} job_t;
-
-typedef struct {
- service_t *svc;
- papi_printer_t *printer;
- papi_attribute_t **attributes;
- char svc_is_internal;
-} printer_t;
-
-extern papi_status_t psm_open(service_t *svc, char *name);
-extern void *psm_sym(service_t *svc, char *name);
-extern void psm_close(void *handle);
-extern void detailed_error(service_t *svc, char *fmt, ...);
-extern papi_status_t service_connect(service_t *svc, char *uri);
-extern papi_attribute_t **getprinterentry(char *ns);
-extern papi_attribute_t **getprinterbyname(char *name, char *ns);
-extern int setprinterentry(int stayopen, char *ns);
-extern int endprinterentry(int stayopen);
-
-
-
-extern void list_remove();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PAPI_IMPL_H */
diff --git a/usr/src/lib/print/libpapi-dynamic/common/printer.c b/usr/src/lib/print/libpapi-dynamic/common/printer.c
deleted file mode 100644
index e02a325ebd..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/common/printer.c
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: printer.c 151 2006-04-25 16:55:34Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <papi_impl.h>
-
-void
-papiPrinterFree(papi_printer_t printer)
-{
- printer_t *tmp = printer;
-
- if (tmp != NULL) {
- void (*f)();
-
- f = (void (*)())psm_sym(tmp->svc, "papiPrinterFree");
- if (f != NULL)
- f(tmp->printer);
- if (tmp->attributes != NULL)
- papiAttributeListFree(tmp->attributes);
- if (tmp->svc_is_internal != 0)
- papiServiceDestroy(tmp->svc);
- free(tmp);
- }
-}
-
-void
-papiPrinterListFree(papi_printer_t *printers)
-{
- if (printers != NULL) {
- int i;
-
- for (i = 0; printers[i] != NULL; i++)
- papiPrinterFree(printers[i]);
- free(printers);
- }
-}
-
-/* Enumerate a list of printers from the loaded print service. */
-static papi_status_t
-printers_from_service(service_t *svc, char **requested_attrs,
- papi_filter_t *filter, papi_printer_t **printers)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- papi_printer_t *svc_printers = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printers == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* connect to the service if we are not connected */
- if ((result = service_connect(svc, svc->name)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiPrintersList");
- if (f != NULL)
- result = f(svc->svc_handle, requested_attrs, filter,
- &svc_printers);
-
- /*
- * copy the resulting printer object pointers into our own
- * representation of a printer object because we need the
- * service context to operate against the individual printer
- * objects. We free the list now because we no longer need
- * it and would have no way of freeing it later.
- */
- if ((result == PAPI_OK) && (svc_printers != NULL)) {
- int i;
-
- *printers = NULL;
- for (i = 0; svc_printers[i] != NULL; i++) {
- printer_t *p = NULL;
-
- if ((p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- p->svc = svc;
- p->printer = svc_printers[i];
- list_append(printers, p);
- }
- free(svc_printers);
- }
-
- return (result);
-}
-
-/* Get printer attributes from it's print service */
-static papi_status_t
-printer_from_service(service_t *svc, printer_t *p, char **requested_attrs)
-{
- papi_status_t result;
- papi_service_t p_svc = NULL;
- papi_printer_t printer = NULL;
- char *psm = NULL;
- char *uri = NULL;
-
- /* get the psm and uri from the attributes */
- papiAttributeListGetString(p->attributes, NULL,
- "print-service-module", &psm);
- papiAttributeListGetString(p->attributes, NULL, "printer-name", &uri);
- papiAttributeListGetString(p->attributes, NULL, "printer-uri-supported",
- &uri);
-
- /* contact the service for the printer */
- result = papiServiceCreate((papi_service_t *)&p_svc, psm, svc->user,
- svc->password, svc->authCB, svc->encryption,
- svc->app_data);
- if (result != PAPI_OK)
- return (result);
-
- /* get the printer from the service */
- result = papiPrinterQuery(p_svc, uri, requested_attrs, NULL, &printer);
- if (result == PAPI_OK) {
- papi_attribute_t **attributes;
-
- attributes = papiPrinterGetAttributeList(printer);
- copy_attributes(&p->attributes, attributes);
- }
- papiPrinterFree(printer);
- papiServiceDestroy(p_svc);
-
- return (result);
-}
-
-/* are the requested attributes contained in the list */
-static int
-contained(char **requested, papi_attribute_t **list)
-{
- int i;
-
- if (requested == NULL) /* we want every possible attribute */
- return (0);
-
- for (i = 0; requested[i] != NULL; i++)
- if (papiAttributeListFind(list, requested[i]) == NULL)
- return (0);
-
- return (1);
-}
-
-/* Enumerate a list of printers from the Name Service */
-static papi_status_t
-printers_from_name_service(service_t *svc, char **requested_attrs,
- papi_filter_t *filter, papi_printer_t **printers)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- papi_attribute_t **attrs;
-
- if ((svc == NULL) || (printers == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* retrieve printers from the nameservice */
- setprinterentry(0, NULL);
- while ((attrs = getprinterentry(NULL)) != NULL) {
- printer_t *p = NULL;
-
- if ((p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- p->attributes = attrs;
- list_append(printers, p);
- }
-
- /* if we have printers, check if our request has been satisfied */
- if ((printers != NULL) && (*printers != NULL)) {
- int i;
-
- /* walk through the list */
- for (i = 0; (*printers)[i] != NULL; i++) {
- printer_t *p = (*printers)[i];
-
- /* see if the name service satisfied the request */
- if (contained(requested_attrs, p->attributes) == 0)
- printer_from_service(svc, p, requested_attrs);
- }
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiPrintersList(papi_service_t handle, char **requested_attrs,
- papi_filter_t *filter, papi_printer_t **printers)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_printer_t *svc_printers = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (printers == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (svc->so_handle != NULL) /* connected, use the print svc */
- result = printers_from_service(svc, requested_attrs,
- filter, printers);
- else /* not connected, use the name svc */
- result = printers_from_name_service(svc, requested_attrs,
- filter, printers);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterQuery(papi_service_t handle, char *name, char **requested_attrs,
- papi_attribute_t **job_attributes, papi_printer_t *printer)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- printer_t *p = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (name == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- if ((*printer = p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- if ((svc->name != NULL) && (svc->svc_handle != NULL) &&
- (svc->uri != NULL)) {
- p->svc = svc;
- f = (papi_status_t (*)())psm_sym(p->svc, "papiPrinterQuery");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, requested_attrs,
- job_attributes, &p->printer);
- } else {
- setprinterentry(0, NULL);
- p->attributes = getprinterbyname(name, NULL);
- if (p->attributes == NULL)
- result = PAPI_NOT_FOUND;
- else
- result = PAPI_OK;
- }
-
- return (result);
-}
-
-static papi_status_t
-_papi_printer_disable_or_pause(papi_service_t handle, char *name, char *message,
- char *function)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, function);
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, message);
-
- return (result);
-}
-
-static papi_status_t
-_papi_printer_enable_or_resume(papi_service_t handle, char *name,
- char *function)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, function);
- if (f != NULL)
- result = f(svc->svc_handle, svc->name);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterDisable(papi_service_t handle, char *name, char *message)
-{
- return (_papi_printer_disable_or_pause(handle, name, message,
- "papiPrinterDisable"));
-}
-
-papi_status_t
-papiPrinterPause(papi_service_t handle, char *name, char *message)
-{
- return (_papi_printer_disable_or_pause(handle, name, message,
- "papiPrinterPause"));
-}
-
-papi_status_t
-papiPrinterEnable(papi_service_t handle, char *name)
-{
- return (_papi_printer_enable_or_resume(handle, name,
- "papiPrinterEnable"));
-}
-
-papi_status_t
-papiPrinterResume(papi_service_t handle, char *name)
-{
- return (_papi_printer_enable_or_resume(handle, name,
- "papiPrinterResume"));
-}
-
-static papi_status_t
-_papi_printer_add_or_modify(papi_service_t handle, char *name,
- papi_attribute_t **attributes, papi_printer_t *printer,
- char *function)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- printer_t *p = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (name == NULL) || (attributes == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- if ((*printer = p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- p->svc = svc;
- f = (papi_status_t (*)())psm_sym(p->svc, function);
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, attributes,
- &p->printer);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterAdd(papi_service_t handle, char *name,
- papi_attribute_t **attributes, papi_printer_t *printer)
-{
- return (_papi_printer_add_or_modify(handle, name, attributes, printer,
- "papiPrinterAdd"));
-}
-
-papi_status_t
-papiPrinterModify(papi_service_t handle, char *name,
- papi_attribute_t **attributes, papi_printer_t *printer)
-{
- return (_papi_printer_add_or_modify(handle, name, attributes, printer,
- "papiPrinterModify"));
-}
-
-
-papi_status_t
-papiPrinterRemove(papi_service_t handle, char *name)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiPrinterRemove");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterPurgeJobs(papi_service_t handle, char *name, papi_job_t **jobs)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_job_t *svc_jobs = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiPrinterPurgeJobs");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, &svc_jobs);
-
- /*
- * copy the resulting job object pointers into our own
- * representation of a job object because we need the
- * service context to operate against the individual job
- * objects. We free the list now because we no longer need
- * it and would have no way of freeing it later.
- */
- if ((result == PAPI_OK) && (svc_jobs != NULL) && (jobs != NULL)) {
- int i;
-
- *jobs = NULL;
- for (i = 0; svc_jobs[i] != NULL; i++) {
- job_t *j = NULL;
-
- if ((j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- j->svc = svc;
- j->job = svc_jobs[i];
- list_append(jobs, j);
- }
- free(svc_jobs);
- }
-
- return (result);
-}
-
-papi_status_t
-papiPrinterListJobs(papi_service_t handle, char *name, char **requested_attrs,
- int type_mask, int max_num_jobs, papi_job_t **jobs)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_job_t *svc_jobs = NULL;
- papi_status_t (*f)();
-
- if ((svc == NULL) || (name == NULL) || (jobs == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiPrinterListJobs");
- if (f != NULL)
- result = f(svc->svc_handle, svc->name, requested_attrs,
- type_mask, max_num_jobs, &svc_jobs);
-
- /*
- * copy the resulting job object pointers into our own
- * representation of a job object because we need the
- * service context to operate against the individual job
- * objects. We free the list now because we no longer need
- * it and would have no way of freeing it later.
- */
- if ((result == PAPI_OK) && (svc_jobs != NULL)) {
- int i;
-
- *jobs = NULL;
- for (i = 0; svc_jobs[i] != NULL; i++) {
- job_t *j = NULL;
-
- if ((j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- j->svc = svc;
- j->job = svc_jobs[i];
- list_append(jobs, j);
- }
- free(svc_jobs);
- }
-
- return (result);
-}
-
-papi_attribute_t **
-papiPrinterGetAttributeList(papi_printer_t printer)
-{
- papi_attribute_t **result = NULL;
- printer_t *p = printer;
-
- if ((p != NULL) && (p->printer != NULL)) {
- papi_attribute_t **(*f)();
-
- f = (papi_attribute_t **(*)())psm_sym(p->svc,
- "papiPrinterGetAttributeList");
- if (f != NULL)
- result = f(p->printer);
- } else
- result = p->attributes;
-
- return (result);
-}
diff --git a/usr/src/lib/print/libpapi-dynamic/common/psm.c b/usr/src/lib/print/libpapi-dynamic/common/psm.c
deleted file mode 100644
index af31f24b4e..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/common/psm.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: psm.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <papi_impl.h>
-
-#ifndef RTLD_GROUP
-#define RTLD_GROUP 0
-#endif /* RTLD_GROUP */
-
-#ifndef PSM_DIR
-#define PSM_DIR "/usr/lib/print"
-#endif
-
-papi_status_t
-psm_open(service_t *svc, char *scheme)
-{
- papi_status_t result = PAPI_OK;
- char path[BUFSIZ];
-
- if ((scheme == NULL) || (strchr(scheme, '/') != NULL))
- return (PAPI_BAD_ARGUMENT);
-
- snprintf(path, sizeof (path), PSM_DIR "/psm-%s.so", scheme);
-
- svc->so_handle = dlopen(path, RTLD_LAZY|RTLD_LOCAL|RTLD_GROUP);
- if (svc->so_handle == NULL) { /* failed, set the result/message */
- if ((access(path, F_OK) < 0) && (errno == ENOENT))
- result = PAPI_URI_SCHEME;
- else
- result = PAPI_NOT_POSSIBLE;
-#ifdef DEBUG
- detailed_error(svc, "psm_open(%s): %s: %s", scheme, path,
- dlerror());
-#endif
- }
-
- return (result);
-}
-
-void
-psm_close(void *handle)
-{
- dlclose(handle);
-}
-
-void *
-psm_sym(service_t *svc, char *name)
-{
- char *error = "invalid input";
- void *func = NULL;
-
- if ((svc != NULL) && (svc->so_handle != NULL) && (name != NULL)) {
- if ((func = dlsym(svc->so_handle, name)) == NULL)
- error = dlerror();
- }
-#ifdef DEBUG
- if (func == NULL)
- detailed_error(svc, "psm_sym(%s): %s", name, error);
-#endif
-
- return (func);
-}
diff --git a/usr/src/lib/print/libpapi-dynamic/common/service.c b/usr/src/lib/print/libpapi-dynamic/common/service.c
deleted file mode 100644
index 55f1732a65..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/common/service.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: service.c 172 2006-05-24 20:54:00Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <alloca.h>
-#include <libintl.h>
-#include <papi_impl.h>
-#include <config-site.h>
-
-static int
-interposed_auth_callback(papi_service_t handle, void *app_data)
-{
- int result = -1;
- service_t *svc = app_data;
-
- if (svc != NULL)
- result = svc->authCB(svc, svc->app_data);
-
- return (result);
-}
-
-static char *
-default_service_uri(char *fallback)
-{
- char *result = NULL;
-
- if (getuid() == geteuid())
- result = getenv("PAPI_SERVICE_URI");
-
- if (result == NULL) {
- char *cups;
-
- if ((cups = getenv("CUPS_SERVER")) != NULL) {
- char buf[BUFSIZ];
-
- snprintf(buf, sizeof (buf), "ipp://%s/printers/", cups);
- result = strdup(buf);
- }
- }
-
- if (result == NULL)
- result = fallback;
-
- return (result);
-}
-
-static char *
-default_print_service()
-{
- static char *result = NULL;
-
- if (result == NULL) {
- char *service_uri = default_service_uri(DEFAULT_SERVICE_URI);
- uri_t *uri = NULL;
-
- if (uri_from_string(service_uri, &uri) != -1)
- result = strdup(uri->scheme);
-
- if (uri != NULL)
- uri_free(uri);
- }
-
- return (result);
-}
-
-static papi_status_t
-service_load(service_t *svc, char *name)
-{
- papi_status_t result;
- char *scheme = default_print_service();
-
- if (svc->so_handle != NULL) /* already loaded */
- return (PAPI_OK);
-
- if (name == NULL) /* no info, can't load yet */
- return (PAPI_OK);
-
- /* Lookup the printer in the configuration DB */
- svc->attributes = getprinterbyname((char *)name, NULL);
-
- if (svc->attributes != NULL) {
- char *tmp = NULL;
-
- /* Printer found (or was a URI), use the attribute data */
- papiAttributeListGetString(svc->attributes, NULL,
- "printer-uri-supported", &tmp);
- if (tmp != NULL)
- svc->name = strdup(tmp);
-
- /* parse the URI and set the scheme(print service) */
- if (uri_from_string(svc->name, &svc->uri) != -1)
- scheme = (svc->uri)->scheme;
-
- /* override the scheme if it was in the attributes */
- papiAttributeListGetString(svc->attributes, NULL,
- "print-service-module", &scheme);
-
- } else /* not found, assume it is the actual print service name */
- scheme = name;
-
- result = psm_open(svc, scheme);
- switch (result) {
- case PAPI_OK:
- break; /* no error */
- case PAPI_URI_SCHEME:
- result = PAPI_NOT_FOUND;
-#ifdef DEBUG
- detailed_error(svc, "Unable to load service for: %s", name);
-#endif
- break;
- default: /* set the detailed message */
- detailed_error(svc, "Unable to load service (%s) for: %s",
- scheme, name);
- }
-
- return (result);
-}
-
-static papi_status_t
-service_send_peer(service_t *svc)
-{
- papi_status_t result = PAPI_OK;
-
- if ((svc->peer_fd != -1) && (svc->so_handle != NULL) &&
- (svc->svc_handle != NULL)) {
- papi_status_t (*f)();
-
- f = (papi_status_t (*)())psm_sym(svc, "papiServiceSetPeer");
-
- if (f != NULL)
- result = f(svc->svc_handle, svc->peer_fd);
- }
-
- return (result);
-}
-
-papi_status_t
-service_connect(service_t *svc, char *name)
-{
- papi_status_t result = PAPI_NOT_POSSIBLE;
-
- /* if there is no print service module loaded, try and load one. */
- if (svc->so_handle == NULL)
- result = service_load(svc, name);
- else if ((svc->name == NULL) && (name != NULL))
- svc->name = strdup(name);
-
- /*
- * the print service module is loaded, but we don't have a service
- * handle.
- */
- if (svc->so_handle != NULL) {
- papi_status_t (*f)();
-
- if (svc->svc_handle != NULL) /* already connected? */
- return (PAPI_OK);
-
- f = (papi_status_t (*)())psm_sym(svc, "papiServiceCreate");
-
- if (f != NULL) {
- char *user = svc->user;
- char *password = svc->password;
-
- /* if no API user, try the URI user */
- if ((user == NULL) && (svc->uri != NULL))
- user = (svc->uri)->user;
- /* if no API password, try the URI password */
- if ((password == NULL) && (svc->uri != NULL))
- password = (svc->uri)->password;
-
- result = f(&svc->svc_handle, svc->name, user, password,
- (svc->authCB ? interposed_auth_callback
- : NULL),
- svc->encryption, svc);
- (void) service_send_peer(svc);
- }
- }
-
- return (result);
-}
-
-papi_status_t
-papiServiceCreate(papi_service_t *handle, char *service_name, char *user_name,
- char *password,
- int (*authCB)(papi_service_t svc, void *app_data),
- papi_encryption_t encryption, void *app_data)
-{
- papi_status_t result = PAPI_NOT_POSSIBLE;
- service_t *svc = NULL;
- uri_t *u = NULL;
-
- if (handle == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if ((*handle = svc = calloc(1, sizeof (*svc))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- svc->peer_fd = -1;
-
- if (user_name != NULL)
- svc->user = strdup(user_name);
-
- if (password != NULL)
- svc->password = strdup(password);
-
- svc->encryption = encryption;
-
- if (authCB != NULL)
- svc->authCB = authCB;
-
- if (app_data != NULL)
- svc->app_data = app_data;
-
- /* If not specified, get a "default" service from the environment */
- if (service_name == NULL)
- service_name = default_service_uri(NULL);
-
- if (service_name != NULL) {
- result = service_load(svc, service_name);
- /* if the psm loaded and the svc contains a URI, connect */
- if ((result == PAPI_OK) && (svc->uri != NULL))
- result = service_connect(svc, service_name);
- } else
- result = PAPI_OK;
-
- return (result);
-}
-
-void
-papiServiceDestroy(papi_service_t handle)
-{
- if (handle != NULL) {
- service_t *svc = handle;
-
- if (svc->so_handle != NULL) {
- if (svc->svc_handle != NULL) {
- void (*f)();
-
- f = (void (*)())psm_sym(svc,
- "papiServiceDestroy");
- f(svc->svc_handle);
- }
- psm_close(svc->so_handle);
- }
- if (svc->attributes != NULL)
- papiAttributeListFree(svc->attributes);
- if (svc->name != NULL)
- free(svc->name);
- if (svc->user != NULL)
- free(svc->user);
- if (svc->password != NULL)
- free(svc->password);
- if (svc->uri != NULL)
- uri_free(svc->uri);
-
- free(handle);
- }
-}
-
-papi_status_t
-papiServiceSetPeer(papi_service_t handle, int fd)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- svc->peer_fd = fd;
- result = service_send_peer(svc);
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-papi_status_t
-papiServiceSetUserName(papi_service_t handle, char *user_name)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if (svc->user != NULL)
- free(svc->user);
- if (user_name != NULL)
- svc->user = strdup(user_name);
- f = (papi_status_t (*)())psm_sym(svc, "papiServiceSetUserName");
- if (f != NULL)
- result = f(svc->svc_handle, user_name);
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-papi_status_t
-papiServiceSetPassword(papi_service_t handle, char *password)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
- papi_status_t (*f)();
-
- if (svc->password != NULL)
- free(svc->password);
- if (password != NULL)
- svc->password = strdup(password);
- f = (papi_status_t (*)())psm_sym(svc, "papiServiceSetPassword");
- if (f != NULL)
- result = f(svc->svc_handle, password);
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-papi_status_t
-papiServiceSetEncryption(papi_service_t handle, papi_encryption_t encryption)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
- papi_status_t (*f)();
-
- svc->encryption = encryption;
- f = (papi_status_t (*)())psm_sym(svc,
- "papiServiceSetEncryption");
- if (f != NULL)
- result = f(svc->svc_handle, encryption);
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-papi_status_t
-papiServiceSetAuthCB(papi_service_t handle,
- int (*authCB)(papi_service_t svc, void *app_data))
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
- papi_status_t (*f)();
-
- svc->authCB = authCB;
- f = (papi_status_t (*)())psm_sym(svc, "papiServiceSetAuthCB");
- if (f != NULL)
- result = f(svc->svc_handle, interposed_auth_callback);
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-
-papi_status_t
-papiServiceSetAppData(papi_service_t handle, void *app_data)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
- papi_status_t (*f)();
-
- svc->app_data = (void *)app_data;
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-char *
-papiServiceGetServiceName(papi_service_t handle)
-{
- char *result = NULL;
-
- if (handle != NULL) {
- service_t *svc = handle;
- char *(*f)();
-
- f = (char *(*)())psm_sym(svc, "papiServiceGetServiceName");
- if (f != NULL)
- result = f(svc->svc_handle);
- if (result == NULL)
- result = svc->name;
- }
-
- return (result);
-}
-
-char *
-papiServiceGetUserName(papi_service_t handle)
-{
- char *result = NULL;
-
- if (handle != NULL) {
- service_t *svc = handle;
- char *(*f)();
-
- f = (char *(*)())psm_sym(svc, "papiServiceGetUserName");
- if (f != NULL)
- result = f(svc->svc_handle);
- if (result == NULL)
- result = svc->user;
- }
-
- return (result);
-}
-
-char *
-papiServiceGetPassword(papi_service_t handle)
-{
- char *result = NULL;
-
- if (handle != NULL) {
- service_t *svc = handle;
- char *(*f)();
-
- f = (char *(*)())psm_sym(svc, "papiServiceGetPassword");
- if (f != NULL)
- result = f(svc->svc_handle);
- if (result == NULL)
- result = svc->password;
- }
-
- return (result);
-}
-
-papi_encryption_t
-papiServiceGetEncryption(papi_service_t handle)
-{
- papi_encryption_t result = PAPI_ENCRYPT_NEVER;
-
- if (handle != NULL) {
- service_t *svc = handle;
- papi_encryption_t (*f)();
-
- f = (papi_encryption_t (*)())psm_sym(svc,
- "papiServiceGetEncryption");
- if (f != NULL)
- result = f(svc->svc_handle);
- if (result == PAPI_ENCRYPT_NEVER)
- result = svc->encryption;
- }
-
- return (result);
-}
-
-void *
-papiServiceGetAppData(papi_service_t handle)
-{
- void *result = NULL;
- service_t *svc = handle;
-
- if (handle != NULL)
- result = svc->app_data;
-
- return (result);
-}
-
-papi_attribute_t **
-papiServiceGetAttributeList(papi_service_t handle)
-{
- papi_attribute_t **result = NULL;
- service_t *svc = handle;
-
- if (handle != NULL) {
- papi_attribute_t **(*f)();
-
- if (svc->so_handle == NULL) {
- char *uri = default_service_uri(DEFAULT_SERVICE_URI);
-
- if (service_connect(svc, uri) != PAPI_OK)
- return (NULL);
- }
-
- f = (papi_attribute_t **(*)())psm_sym(svc,
- "papiServiceGetAttributeList");
- if (f != NULL)
- result = f(svc->svc_handle);
- } else
- result = svc->attributes;
-
- return (result);
-}
-
-char *
-papiServiceGetStatusMessage(papi_service_t handle)
-{
- char *result = NULL;
- service_t *svc = handle;
-
- if (handle != NULL) {
- char *(*f)();
-
- f = (char *(*)())psm_sym(svc, "papiServiceGetStatusMessage");
- if (f != NULL)
- result = f(svc->svc_handle);
- }
- if (result == NULL) {
- papiAttributeListGetString(svc->attributes, NULL,
- "detailed-status-message", &result);
- }
-
- return (result);
-}
-
-void
-detailed_error(service_t *svc, char *fmt, ...)
-{
- if ((svc != NULL) && (fmt != NULL)) {
- va_list ap;
- size_t size;
- char *message = alloca(BUFSIZ);
-
- va_start(ap, fmt);
- /*
- * fill in the message. If the buffer is too small, allocate
- * one that is large enough and fill it in.
- */
- if ((size = vsnprintf(message, BUFSIZ, fmt, ap)) >= BUFSIZ)
- if ((message = alloca(size)) != NULL)
- vsnprintf(message, size, fmt, ap);
- va_end(ap);
-
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_APPEND,
- "detailed-status-message", message);
-#ifdef DEBUG
- fprintf(stderr, "detailed_error(%s)\n", message);
-#endif
- }
-}
diff --git a/usr/src/lib/print/libpapi-dynamic/i386/Makefile b/usr/src/lib/print/libpapi-dynamic/i386/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/i386/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/libpapi-dynamic/sparc/Makefile b/usr/src/lib/print/libpapi-dynamic/sparc/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libpapi-dynamic/sparc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/libpapi-ipp/Makefile b/usr/src/lib/print/libpapi-ipp/Makefile
deleted file mode 100644
index b92d620b10..0000000000
--- a/usr/src/lib/print/libpapi-ipp/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.lib
-
-#HDRS = papi.h
-#HDRDIR = common
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all clean clobber install: .WAIT $(SUBDIRS)
-
-lint: # $(SUBDIRS)
-
-install_h: # $(ROOTHDRS)
-
-check: # $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-ipp/Makefile.com b/usr/src/lib/print/libpapi-ipp/Makefile.com
deleted file mode 100644
index f5abebce00..0000000000
--- a/usr/src/lib/print/libpapi-ipp/Makefile.com
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-LIBRARY = psm-ipp.a
-VERS = .1
-OBJECTS = ipp-support.o job.o printer.o service.o
-ROOTLIBDIR = $(ROOT)/usr/lib/print
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
-
-SRCDIR = ../common
-
-ROOTLIBDIR= $(ROOT)/usr/lib/print
-ROOTLIBDIR64= $(ROOT)/usr/lib/print/$(MACH)
-
-EXTRALINKS= $(ROOTLIBDIR)/psm-http.so
-$(EXTRALINKS): $(ROOTLINKS)
- $(RM) $@; $(SYMLINK) $(LIBLINKS) $@
-
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(SRCDIR)
-CPPFLAGS += -I../../libpapi-common/common
-CPPFLAGS += -I../../libipp-core/common
-CPPFLAGS += -I../../libhttp-core/common
-
-CERRWARN += -_gcc=-Wno-type-limits
-CERRWARN += -_gcc=-Wno-unused-variable
-CERRWARN += -_gcc=-Wno-uninitialized
-
-MAPFILES = $(SRCDIR)/mapfile
-
-LDLIBS += -L$(ROOTLIBDIR) -R/usr/lib/print -lhttp-core -lmd5
-LDLIBS += -lipp-core -lc
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-lint: lintcheck
-
-$(ROOTLIBDIR):
- $(INS.dir)
-
-include ../../../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-ipp/common/ipp-support.c b/usr/src/lib/print/libpapi-ipp/common/ipp-support.c
deleted file mode 100644
index b2caff84ac..0000000000
--- a/usr/src/lib/print/libpapi-ipp/common/ipp-support.c
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: ipp-support.c 148 2006-04-25 16:54:17Z njacobs $ */
-
-
-#include <papi_impl.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include <locale.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <md5.h>
-
-#include <config-site.h>
-
-#include <ipp.h>
-
-static void ipp_add_printer_uri(service_t *svc, char *name,
- papi_attribute_t ***op);
-
-papi_status_t
-http_to_papi_status(http_status_t status)
-{
- switch (status) {
- case HTTP_OK:
- return (PAPI_OK);
- case HTTP_BAD_REQUEST:
- return (PAPI_BAD_REQUEST);
- case HTTP_UNAUTHORIZED:
- case HTTP_FORBIDDEN:
- return (PAPI_NOT_AUTHORIZED);
- case HTTP_NOT_FOUND:
- return (PAPI_NOT_FOUND);
- case HTTP_GONE:
- return (PAPI_GONE);
- case HTTP_SERVICE_UNAVAILABLE:
- return (PAPI_SERVICE_UNAVAILABLE);
- default:
- return ((papi_status_t)status);
- }
-}
-
-papi_status_t
-ipp_to_papi_status(uint16_t status)
-{
- switch (status) {
- case IPP_OK:
- return (PAPI_OK);
- case IPP_OK_IGNORED_ATTRIBUTES:
- return (PAPI_OK);
- case IPP_OK_CONFLICTING_ATTRIBUTES:
- return (PAPI_OK);
- case IPP_OK_IGNORED_SUBSCRIPTIONS:
- return (PAPI_OK_IGNORED_SUBSCRIPTIONS);
- case IPP_OK_IGNORED_NOTIFICATIONS:
- return (PAPI_OK_IGNORED_NOTIFICATIONS);
- case IPP_CERR_BAD_REQUEST:
- return (PAPI_BAD_REQUEST);
- case IPP_CERR_FORBIDDEN:
- return (PAPI_FORBIDDEN);
- case IPP_CERR_NOT_AUTHENTICATED:
- return (PAPI_NOT_AUTHENTICATED);
- case IPP_CERR_NOT_AUTHORIZED:
- return (PAPI_NOT_AUTHORIZED);
- case IPP_CERR_NOT_POSSIBLE:
- return (PAPI_NOT_POSSIBLE);
- case IPP_CERR_TIMEOUT:
- return (PAPI_TIMEOUT);
- case IPP_CERR_NOT_FOUND:
- return (PAPI_NOT_FOUND);
- case IPP_CERR_GONE:
- return (PAPI_GONE);
- case IPP_CERR_REQUEST_ENTITY:
- return (PAPI_REQUEST_ENTITY);
- case IPP_CERR_REQUEST_VALUE:
- return (PAPI_REQUEST_VALUE);
- case IPP_CERR_DOCUMENT_FORMAT:
- return (PAPI_DOCUMENT_FORMAT);
- case IPP_CERR_ATTRIBUTES:
- return (PAPI_ATTRIBUTES);
- case IPP_CERR_URI_SCHEME:
- return (PAPI_URI_SCHEME);
- case IPP_CERR_CHARSET:
- return (PAPI_CHARSET);
- case IPP_CERR_CONFLICT:
- return (PAPI_CONFLICT);
- case IPP_CERR_COMPRESSION_NOT_SUPPORTED:
- return (PAPI_COMPRESSION_NOT_SUPPORTED);
- case IPP_CERR_COMPRESSION_ERROR:
- return (PAPI_COMPRESSION_ERROR);
- case IPP_CERR_DOCUMENT_FORMAT_ERROR:
- return (PAPI_DOCUMENT_FORMAT_ERROR);
- case IPP_CERR_DOCUMENT_ACCESS_ERROR:
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- case IPP_CERR_ATTRIBUTES_NOT_SETTABLE:
- return (PAPI_ATTRIBUTES_NOT_SETTABLE);
- case IPP_CERR_IGNORED_ALL_SUBSCRIPTIONS:
- return (PAPI_IGNORED_ALL_SUBSCRIPTIONS);
- case IPP_CERR_TOO_MANY_SUBSCRIPTIONS:
- return (PAPI_TOO_MANY_SUBSCRIPTIONS);
- case IPP_CERR_IGNORED_ALL_NOTIFICATIONS:
- return (PAPI_IGNORED_ALL_NOTIFICATIONS);
- case IPP_CERR_PRINT_SUPPORT_FILE_NOT_FOUND:
- return (PAPI_PRINT_SUPPORT_FILE_NOT_FOUND);
- case IPP_SERR_INTERNAL:
- return (PAPI_INTERNAL_ERROR);
- case IPP_SERR_OPERATION_NOT_SUPPORTED:
- return (PAPI_OPERATION_NOT_SUPPORTED);
- case IPP_SERR_SERVICE_UNAVAILABLE:
- return (PAPI_SERVICE_UNAVAILABLE);
- case IPP_SERR_VERSION_NOT_SUPPORTED:
- return (PAPI_VERSION_NOT_SUPPORTED);
- case IPP_SERR_DEVICE_ERROR:
- return (PAPI_DEVICE_ERROR);
- case IPP_SERR_TEMPORARY_ERROR:
- return (PAPI_TEMPORARY_ERROR);
- case IPP_SERR_NOT_ACCEPTING:
- return (PAPI_NOT_ACCEPTING);
- case IPP_SERR_BUSY:
- case IPP_SERR_CANCELLED:
- default:
- return (PAPI_TEMPORARY_ERROR);
- }
-}
-
-void
-ipp_initialize_request(service_t *svc, papi_attribute_t ***request,
- uint16_t operation)
-{
- papiAttributeListAddInteger(request, PAPI_ATTR_EXCL,
- "version-major", 1);
- papiAttributeListAddInteger(request, PAPI_ATTR_EXCL,
- "version-minor", 1);
- papiAttributeListAddInteger(request, PAPI_ATTR_EXCL,
- "request-id", (short)lrand48());
- papiAttributeListAddInteger(request, PAPI_ATTR_EXCL,
- "operation-id", operation);
-}
-
-void
-ipp_initialize_operational_attributes(service_t *svc, papi_attribute_t ***op,
- char *printer, int job_id)
-{
- char *charset = "utf-8"; /* default to UTF-8 encoding */
- char *language = setlocale(LC_ALL, "");
- char *user = "nobody";
- struct passwd *pw = NULL;
-
- /*
- * All IPP requests must contain the following:
- * attributes-charset (UTF-8)
- * attributes-natural-language (our current locale)
- * (object identifier) printer-uri/job-id or job-uri
- * requesting-user-name (process user or none)
- */
- papiAttributeListAddString(op, PAPI_ATTR_EXCL,
- "attributes-charset", charset);
-
- papiAttributeListAddString(op, PAPI_ATTR_EXCL,
- "attributes-natural-language", language);
-
- if (printer != NULL)
- ipp_add_printer_uri(svc, printer, op);
-
- if ((printer != NULL) && (job_id >= 0))
- papiAttributeListAddInteger(op, PAPI_ATTR_EXCL,
- "job-id", job_id);
-
- if ((pw = getpwuid(getuid())) != NULL)
- user = pw->pw_name;
- /*
- * if our euid is 0 "super user", we will allow the system supplied
- * user name to be overridden, if the requestor wants to.
- */
- if (geteuid() == 0) {
- if (svc->user != NULL)
- user = svc->user;
- }
- papiAttributeListAddString(op, PAPI_ATTR_REPLACE,
- "requesting-user-name", user);
-}
-
-#ifndef OPID_CUPS_GET_DEFAULT /* for servers that will enumerate */
-#define OPID_CUPS_GET_DEFAULT 0x4001
-#endif /* OPID_CUPS_GET_DEFAULT */
-
-static papi_status_t
-_default_destination(service_t *svc, char **uri)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- printer_t *p = NULL;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
- char *tmp = NULL;
-
- if ((svc == NULL) || (uri == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* we must be connected to find the default destination */
- if (svc->connection == NULL)
- return (PAPI_NOT_POSSIBLE);
-
- if ((p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- ipp_initialize_request(svc, &request, OPID_CUPS_GET_DEFAULT);
- ipp_initialize_operational_attributes(svc, &op, NULL, -1);
- papiAttributeListAddString(&op, PAPI_ATTR_APPEND,
- "requested-attributes", "printer-uri-supported");
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
-
- op = NULL;
- papiAttributeListGetCollection(response, NULL,
- "printer-attributes-group", &op);
-
- if (uri != NULL) {
- char *tmp = NULL;
-
- papiAttributeListGetString(op, NULL, "printer-uri", &tmp);
- papiAttributeListGetString(op, NULL,
- "printer-uri-supported", &tmp);
- if (tmp != NULL)
- *uri = strdup(tmp);
- }
-
- papiAttributeListFree(response);
-
- return (result);
-}
-
-static void
-ipp_add_printer_uri(service_t *svc, char *name, papi_attribute_t ***op)
-{
- char *uri = name;
- char buf[BUFSIZ];
- uri_t *tmp = NULL;
-
- if (strstr(name, "://") == NULL) { /* not in URI form */
- if (strcmp(name, DEFAULT_DEST) != 0) {
- /* not the "default" */
- snprintf(buf, sizeof (buf), "%s/%s", svc->name, name);
- uri = buf;
- } else
- _default_destination(svc, &uri);
- }
-
- papiAttributeListAddString(op, PAPI_ATTR_EXCL, "printer-uri", uri);
-
- /* save the printer-uri's path to be used by http POST request */
- if ((uri_from_string(uri, &tmp) == 0) && (tmp != NULL)) {
- if (svc->post != NULL)
- free(svc->post);
- svc->post = strdup(tmp->path);
- uri_free(tmp);
- }
-}
-
-
-/*
- * don't actually write anything, just add to the total size and return the
- * size of what would be written, so we can figure out how big the request
- * is going to be.
- */
-static ssize_t
-size_calculate(void *fd, void *buffer, size_t length)
-{
- ssize_t *size = (ssize_t *)fd;
-
- *size += length;
- return (length);
-}
-
-
-static ssize_t
-build_chunk(void *fd, void *buffer, size_t length)
-{
- char **s1 = fd;
-
- memcpy(*s1, buffer, length);
- *s1 = *s1 + length;
-
- return (length);
-}
-
-ssize_t
-ipp_request_write(void *fd, void *buffer, size_t length)
-{
- service_t *svc = (service_t *)fd;
-
-#ifdef DEBUG
- printf("ipp_request_write(0x%8.8x, 0x%8.8x, %d)\n", fd, buffer, length);
- httpDumpData(stdout, "ipp_request_write:", buffer, length);
-#endif
- return (httpWrite(svc->connection, buffer, length));
-}
-
-ssize_t
-ipp_request_read(void *fd, void *buffer, size_t length)
-{
- service_t *svc = (service_t *)fd;
- ssize_t rc, i = length;
- char *p = buffer;
-
- while ((rc = httpRead(svc->connection, p, i)) != i) {
- if (rc == 0)
- return (rc);
- if (rc < 0)
- return (rc);
- i -= rc;
- p += rc;
- }
-#ifdef DEBUG
- printf("ipp_request_read(0x%8.8x, 0x%8.8x, %d) = %d\n",
- fd, buffer, length, rc);
- httpDumpData(stdout, "ipp_request_read:", buffer, length);
-#endif
-
- return (length);
-}
-
-papi_status_t
-ipp_send_initial_request_block(service_t *svc, papi_attribute_t **request,
- ssize_t file_size)
-{
- papi_status_t result = PAPI_OK;
- ssize_t chunk_size = 0;
- char length[32];
- void *chunk, *ptr;
- http_status_t status;
-
- /* calculate the request size */
- (void) ipp_write_message(&size_calculate, &chunk_size, request);
-
- /* Fill in the HTTP Header information */
- httpClearFields(svc->connection);
- if (svc->transfer_encoding == TRANSFER_ENCODING_CHUNKED)
- httpSetField(svc->connection, HTTP_FIELD_TRANSFER_ENCODING,
- "chunked");
- else {
- sprintf(length, "%lu", (unsigned long)(file_size + chunk_size));
- httpSetField(svc->connection, HTTP_FIELD_CONTENT_LENGTH,
- length);
- }
- httpSetField(svc->connection, HTTP_FIELD_CONTENT_TYPE,
- "application/ipp");
- httpSetField(svc->connection, HTTP_FIELD_AUTHORIZATION,
- svc->connection->authstring);
-
- /* flush any state information about this connection */
- httpFlush(svc->connection);
-
- /* if we have don't have a POST path, use the service uri path */
- if ((svc->post == NULL) && (svc->uri->path))
- svc->post = strdup(svc->uri->path);
- /* send the HTTP POST message for the IPP request */
- /* if the POST fails, return the error */
- status = httpPost(svc->connection, svc->post);
- if (status != 0)
- return (http_to_papi_status(status));
-
- if (httpCheck(svc->connection) != 0) {
- status = httpUpdate(svc->connection);
- if (status != HTTP_OK)
- return (http_to_papi_status(status));
- }
-
- /* build the request chunk */
- chunk = ptr = calloc(1, chunk_size);
- result = ipp_write_message(&build_chunk, &ptr, request);
-#ifdef DEBUG
- printf("request: %d (0x%x) bytes\n", chunk_size, chunk_size);
- httpDumpData(stdout, "request:", chunk, chunk_size);
-#endif
-
- /* send the actual IPP request */
- if (ipp_request_write(svc, chunk, chunk_size) != chunk_size)
- result = PAPI_TEMPORARY_ERROR;
- free(chunk);
-
- if (httpCheck(svc->connection) != 0) {
- status = httpUpdate(svc->connection);
- if (status != HTTP_OK)
- return (http_to_papi_status(status));
- }
-
- return (result);
-}
-
-static int
-setAuthString(service_t *svc)
-{
- http_t *http;
- char *user, *passphrase;
- char encoded[BUFSIZ];
-
- if ((svc == NULL) || (svc->connection == NULL) || (svc->name == NULL))
- return (-1);
-
- http = svc->connection;
-
- if (svc->user == NULL) {
- struct passwd *p;
-
- if ((p = getpwuid(getuid())) != NULL) {
- user = p->pw_name;
- } else if ((user = getenv("LOGNAME")) == NULL)
- user = getenv("USER");
- if (user == NULL)
- user = "nobody";
- } else
- user = svc->user;
-
- /* if the passphrase is not set, use the Authentication Callback */
- if (((svc->password == NULL) || (svc->password[0] == '\0')) &&
- (svc->authCB != NULL))
- (svc->authCB)(svc, svc->app_data);
- passphrase = svc->password;
-
- /* if there is still no passphrase, we have to fail */
- if ((passphrase == NULL) || (passphrase[0] == '\0'))
- return (-1);
-
- if (strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
- "Basic", 5) == 0) {
- char plain[BUFSIZ];
-
- snprintf(plain, sizeof (plain), "%s:%s", user, passphrase);
- httpEncode64(encoded, plain);
- snprintf(http->authstring, sizeof (http->authstring),
- "Basic %s", encoded);
- } else if (strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
- "Digest", 6) == 0) {
- char realm[HTTP_MAX_VALUE];
- char nonce[HTTP_MAX_VALUE];
- char line [BUFSIZ];
- char urp[128];
- char mr[128];
- char *uri = svc->post;
-
- httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE,
- "realm", realm);
- httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE,
- "nonce", nonce);
-
- snprintf(line, sizeof (line), "%s:%s:%s", user, realm,
- passphrase);
- md5_calc(urp, line, strlen(line));
-
- snprintf(line, sizeof (line), "POST:%s", uri);
- md5_calc(mr, line, strlen(line));
-
- snprintf(line, sizeof (line), "%s:%s:%s", urp, mr, nonce);
- md5_calc(encoded, line, strlen(line));
-
- snprintf(http->authstring, sizeof (http->authstring),
- "Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", "
- "uri=\"%s\", response=\"%s\"", user, realm, nonce, uri,
- encoded);
- }
-
- return (0);
-}
-
-papi_status_t
-ipp_status_info(service_t *svc, papi_attribute_t **response)
-{
- papi_attribute_t **operational = NULL;
- int32_t status = 0;
-
- papiAttributeListGetCollection(response, NULL,
- "operational-attributes-group", &operational);
- if (operational != NULL) {
- char *message = NULL;
-
- papiAttributeListGetString(response, NULL,
- "status-message", &message);
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_REPLACE,
- "detailed-status-message", message);
- }
- papiAttributeListGetInteger(response, NULL, "status-code", &status);
-
- return (ipp_to_papi_status(status));
-}
-
-papi_status_t
-ipp_send_request_with_file(service_t *svc, papi_attribute_t **request,
- papi_attribute_t ***response, char *file)
-{
- papi_status_t result = PAPI_OK;
- ssize_t size = 0;
- struct stat statbuf;
- int fd;
-
-#ifdef DEBUG
- fprintf(stderr, "\nIPP-REQUEST: (%s)", (file ? file : ""));
- papiAttributeListPrint(stderr, request, " ");
- putc('\n', stderr);
- fflush(stderr);
-#endif
-
- /*
- * if we are sending a file, open it and include it's size in the
- * message size.
- */
- if (file != NULL) {
- if ((fd = open(file, O_RDONLY)) < 0) {
- detailed_error(svc, "%s: %s", file, strerror(errno));
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- } else if (strcmp("standard input", file) != 0) {
- if (stat(file, &statbuf) < 0) {
- detailed_error(svc,
- gettext("Cannot access file: %s: %s"),
- file, strerror(errno));
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- }
- if (statbuf.st_size == 0) {
- detailed_error(svc,
- "Zero byte (empty) file: %s", file);
- return (PAPI_BAD_ARGUMENT);
- }
- } else if (svc->transfer_encoding !=
- TRANSFER_ENCODING_CHUNKED) {
- struct stat st;
-
- if (fstat(fd, &st) >= 0)
- size = st.st_size;
- }
- }
-
- *response = NULL;
- while (*response == NULL) {
- http_status_t status = HTTP_CONTINUE;
-
- result = ipp_send_initial_request_block(svc, request, size);
-
- if (result == PAPI_OK) {
- if (file != NULL) {
- /* send the file contents if we have it */
- int rc;
- char buf[BUFSIZ];
-
- lseek(fd, 0L, SEEK_SET);
- while ((rc = read(fd, buf, sizeof (buf))) > 0) {
- if (ipp_request_write(svc, buf, rc)
- < rc) {
- break;
- }
- }
- }
-
- (void) ipp_request_write(svc, "", 0);
- }
-
- /* update our connection info */
- while (status == HTTP_CONTINUE)
- status = httpUpdate(svc->connection);
-
- if (status == HTTP_UNAUTHORIZED) {
- httpFlush(svc->connection);
- if ((svc->connection->authstring[0] == '\0') &&
- (setAuthString(svc) == 0)) {
- httpReconnect(svc->connection);
- continue;
- }
- } else if (status == HTTP_UPGRADE_REQUIRED) {
- /*
- * If the transport was built with TLS support, we can
- * try to use it.
- */
- httpFlush(svc->connection);
- httpReconnect(svc->connection);
- httpEncryption(svc->connection, HTTP_ENCRYPT_REQUIRED);
- continue;
- }
-
- if (status != HTTP_OK)
- return (http_to_papi_status(status));
-
- /* read the IPP response */
- result = ipp_read_message(&ipp_request_read, svc, response,
- IPP_TYPE_RESPONSE);
-
- if (result == PAPI_OK)
- result = ipp_status_info(svc, *response);
-#ifdef DEBUG
- fprintf(stderr, "\nIPP-RESPONSE: (%s) (%s)", (file ? file : ""),
- papiStatusString(result));
- papiAttributeListPrint(stderr, *response, " ");
- putc('\n', stderr);
- fflush(stderr);
-#endif
- }
-
- return (result);
-}
-
-papi_status_t
-ipp_send_request(service_t *svc, papi_attribute_t **request,
- papi_attribute_t ***response)
-{
- return (ipp_send_request_with_file(svc, request, response, NULL));
-}
diff --git a/usr/src/lib/print/libpapi-ipp/common/job.c b/usr/src/lib/print/libpapi-ipp/common/job.c
deleted file mode 100644
index 65575d44db..0000000000
--- a/usr/src/lib/print/libpapi-ipp/common/job.c
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: job.c 148 2006-04-25 16:54:17Z njacobs $ */
-
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <papi_impl.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <libintl.h>
-
-#ifndef OPID_CUPS_MOVE_JOB
-#define OPID_CUPS_MOVE_JOB 0x400D
-#endif
-
-void
-papiJobFree(papi_job_t job)
-{
- job_t *tmp = (job_t *)job;
-
- if (tmp != NULL) {
- if (tmp->attributes != NULL)
- papiAttributeListFree(tmp->attributes);
- free(tmp);
- }
-}
-
-void
-papiJobListFree(papi_job_t *jobs)
-{
- if (jobs != NULL) {
- int i;
-
- for (i = 0; jobs[i] != NULL; i++)
- papiJobFree(jobs[i]);
- free(jobs);
- }
-}
-
-papi_attribute_t **
-papiJobGetAttributeList(papi_job_t job)
-{
- papi_attribute_t **result = NULL;
- job_t *j = job;
-
- if (j != NULL)
- result = j->attributes;
-
- return (result);
-}
-
-char *
-papiJobGetPrinterName(papi_job_t job)
-{
- char *result = NULL;
- job_t *j = job;
-
- if (j != NULL)
- (void) papiAttributeListGetString(j->attributes, NULL,
- "printer-name", &result);
-
- return (result);
-}
-
-int32_t
-papiJobGetId(papi_job_t job)
-{
- int32_t result = -1;
- job_t *j = job;
-
- if (j != NULL)
- (void) papiAttributeListGetInteger(j->attributes, NULL,
- "job-id", &result);
-
- return (result);
-}
-
-papi_job_ticket_t *
-papiJobGetJobTicket(papi_job_t job)
-{
- papi_job_ticket_t *result = NULL;
-
- return (result);
-}
-
-static void
-populate_job_request(service_t *svc, papi_attribute_t ***request,
- papi_attribute_t **attributes, char *printer, uint16_t type)
-{
- papi_attribute_t **operational = NULL, **job = NULL;
- static char *operational_names[] = {
- "job-name", "ipp-attribute-fidelity", "document-name",
- "compression", "document-format", "document-natural-language",
- "job-k-octets", "job-impressions", "job-media-sheets", NULL
- };
-
- /* create the base IPP request */
- ipp_initialize_request(svc, request, type);
-
- /* create an operational attributes group */
- ipp_initialize_operational_attributes(svc, &operational, printer, -1);
-
- /* split up the attributes into operational and job attributes */
- split_and_copy_attributes(operational_names, attributes,
- &operational, &job);
-
- /* add the operational attributes group to the request */
- papiAttributeListAddCollection(request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", operational);
- papiAttributeListFree(operational);
-
- /* add the job attributes group to the request */
- if (job != NULL) {
- /*
- * Add job-originating-host-name to attributes
- * if not already set.
- */
- char *hostname = NULL;
-
- papiAttributeListGetString(job, NULL,
- "job-originating-host-name", &hostname);
-
- if (hostname == NULL) {
- char host[BUFSIZ];
-
- if (gethostname(host, sizeof (host)) == 0)
- papiAttributeListAddString(&job, PAPI_ATTR_EXCL,
- "job-originating-host-name", host);
- }
-
- papiAttributeListAddCollection(request, PAPI_ATTR_REPLACE,
- "job-attributes-group", job);
- papiAttributeListFree(job);
- }
-}
-
-static papi_status_t
-send_document_uri(service_t *svc, char *file, papi_attribute_t **attributes,
- char *printer, int32_t id, char last, uint16_t type)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
-
- /* create the base IPP request */
- ipp_initialize_request(svc, &request, type);
-
- /* create an operational attributes group */
- ipp_initialize_operational_attributes(svc, &op, printer, id);
-
- papiAttributeListAddString(&op, PAPI_ATTR_REPLACE, "document-name",
- file);
- papiAttributeListAddBoolean(&op, PAPI_ATTR_REPLACE, "last-document",
- (last ? PAPI_TRUE : PAPI_FALSE));
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
-
- /* send the IPP request to the server */
- result = ipp_send_request_with_file(svc, request, &response, file);
- papiAttributeListFree(request);
- papiAttributeListFree(response);
-
- return (result);
-}
-
-typedef enum {_WITH_DATA, _BY_REFERENCE, _VALIDATE} call_type_t;
-
-papi_status_t
-internal_job_submit(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket,
- char **files, papi_job_t *job,
- call_type_t call_type)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- struct stat statbuf;
- job_t *j = NULL;
- int i;
- uint16_t req_type = OPID_PRINT_JOB;
- uint16_t data_type = OPID_SEND_DOCUMENT;
- papi_attribute_t **request = NULL, **response = NULL;
-
- if ((svc == NULL) || (printer == NULL) || (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- switch (call_type) {
- case _BY_REFERENCE:
-#ifdef SOME_DAY_WE_WILL_BE_ABLE_TO_USE_URIS_FOR_JOB_DATA
- /*
- * For the time being, this is disabled. There are a number
- * of issues to be dealt with before we can send a URI
- * across the network to the server. For example, the file
- * name(s) passed in are most likely relative to the current
- * hosts filesystem. They also most likely will require some
- * form of authentication information to be passed with the
- * URI.
- */
- req_type = OPID_PRINT_URI;
- req_type = OPID_SEND_URI;
-#endif
- /* fall-through */
- case _WITH_DATA:
- if ((files == NULL) || (files[0] == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (files[1] != NULL) /* more than 1 file */
- req_type = OPID_CREATE_JOB;
-
- break;
- case _VALIDATE:
- req_type = OPID_VALIDATE_JOB;
- /* if we have files, validate access to them */
- if (files != NULL) {
- for (i = 0; files[i] != NULL; i++) {
- if (access(files[i], R_OK) < 0) {
- detailed_error(svc, "%s: %s", files[i],
- strerror(errno));
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- }
-
- if (strcmp("standard input", files[i]) != 0) {
- if (stat(files[i], &statbuf) < 0) {
- detailed_error(svc, gettext(
- "Cannot access file: %s:"
- " %s"), files[i],
- strerror(errno));
- return (
- PAPI_DOCUMENT_ACCESS_ERROR);
- }
- if (statbuf.st_size == 0) {
- detailed_error(svc,
- "Zero byte (empty) file: "
- "%s",
- files[i]);
- return (PAPI_BAD_ARGUMENT);
- }
- }
- }
- files = NULL;
- }
- break;
- }
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /*
- * before creating IPP request
- * add the job-name
- */
- if ((files != NULL) && (files[0] != NULL))
- papiAttributeListAddString(&job_attributes, PAPI_ATTR_EXCL,
- "job-name", files[0]);
-
- /* create IPP request */
- populate_job_request(svc, &request, job_attributes, printer, req_type);
-
- switch (req_type) {
- case OPID_PRINT_JOB:
- result = ipp_send_request_with_file(svc, request, &response,
- files[0]);
- break;
- case OPID_CREATE_JOB:
- case OPID_VALIDATE_JOB:
- case OPID_PRINT_URI:
- result = ipp_send_request(svc, request, &response);
- break;
- }
- papiAttributeListFree(request);
-
- if (result == PAPI_OK) {
- papi_attribute_t **op = NULL;
-
- /* retrieve the job attributes */
- papiAttributeListGetCollection(response, NULL,
- "job-attributes-group", &op);
- copy_attributes(&j->attributes, op);
-
- if (req_type == OPID_CREATE_JOB) {
- int32_t id = 0;
-
- papiAttributeListGetInteger(j->attributes, NULL,
- "job-id", &id);
- /* send each document */
- for (i = 0; ((result == PAPI_OK) && (files[i] != NULL));
- i++)
- result = send_document_uri(svc, files[i],
- job_attributes,
- printer, id, (files[i+1]?0:1),
- data_type);
- }
- }
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_status_t
-papiJobSubmit(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
-{
- return (internal_job_submit(handle, printer, job_attributes,
- job_ticket, files, job, _WITH_DATA));
-}
-
-papi_status_t
-papiJobSubmitByReference(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
-{
- return (internal_job_submit(handle, printer, job_attributes,
- job_ticket, files, job, _BY_REFERENCE));
-}
-
-papi_status_t
-papiJobValidate(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
-{
- return (internal_job_submit(handle, printer, job_attributes,
- job_ticket, files, job, _VALIDATE));
-}
-
-papi_status_t
-papiJobStreamOpen(papi_service_t handle, char *printer,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, papi_stream_t *stream)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- papi_attribute_t **request = NULL;
- service_t *svc = handle;
-
- if ((svc == NULL) || (printer == NULL) || (stream == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- papiAttributeListAddString(&job_attributes, PAPI_ATTR_EXCL,
- "job-name", "standard input");
-
- /* create job request */
- populate_job_request(svc, &request, job_attributes, printer,
- OPID_PRINT_JOB);
-
- *stream = svc->connection;
-
- result = ipp_send_initial_request_block(svc, request, 0);
- papiAttributeListFree(request);
-
- return (result);
-}
-
-papi_status_t
-papiJobStreamWrite(papi_service_t handle,
- papi_stream_t stream, void *buffer, size_t buflen)
-{
- papi_status_t result = PAPI_OK;
- service_t *svc = handle;
- size_t rc;
-
-#ifdef DEBUG
- printf("papiJobStreamWrite(0x%8.8x, 0x%8.8x, 0x%8.8x, %d)\n",
- handle, stream, buffer, buflen);
- httpDumpData(stdout, "papiJobStreamWrite:", buffer, buflen);
-#endif
-
- if ((svc == NULL) || (stream == NULL) || (buffer == NULL) ||
- (buflen == 0))
- return (PAPI_BAD_ARGUMENT);
-
- while ((result == PAPI_OK) && (buflen > 0)) {
- rc = ipp_request_write(svc, buffer, buflen);
- if (rc < 0)
- result = PAPI_TEMPORARY_ERROR;
- else {
- buffer = (char *)buffer + rc;
- buflen -= rc;
- }
- }
-
-#ifdef DEBUG
- printf("papiJobStreamWrite(): %s\n", papiStatusString(result));
-#endif
-
- return (result);
-}
-
-papi_status_t
-papiJobStreamClose(papi_service_t handle,
- papi_stream_t stream, papi_job_t *job)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- http_status_t status = HTTP_CONTINUE;
- service_t *svc = handle;
- papi_attribute_t **response = NULL;
- job_t *j = NULL;
-
- if ((svc == NULL) || (stream == NULL) || (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- (void) ipp_request_write(svc, "", 0);
-
- /* update our connection info */
- while (status == HTTP_CONTINUE)
- status = httpUpdate(svc->connection);
-
- if (status != HTTP_OK)
- return (http_to_papi_status(status));
- httpWait(svc->connection, 1000);
-
- /* read the IPP response */
- result = ipp_read_message(&ipp_request_read, svc, &response,
- IPP_TYPE_RESPONSE);
- if (result == PAPI_OK)
- result = ipp_status_info(svc, response);
-
- if (result == PAPI_OK) {
- papi_attribute_t **op = NULL;
-
- papiAttributeListGetCollection(response, NULL,
- "job-attributes-group", &op);
- copy_attributes(&j->attributes, op);
- }
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_status_t
-papiJobQuery(papi_service_t handle, char *printer, int32_t job_id,
- char **requested_attrs,
- papi_job_t *job)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- job_t *j = NULL;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- ipp_initialize_request(svc, &request, OPID_GET_JOB_ATTRIBUTES);
-
- ipp_initialize_operational_attributes(svc, &op, printer, job_id);
-
- if (requested_attrs != NULL) {
- int i;
-
- for (i = 0; requested_attrs[i] != NULL; i++)
- papiAttributeListAddString(&op, PAPI_ATTR_APPEND,
- "requested-attributes", requested_attrs[i]);
- }
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
-
- op = NULL;
- papiAttributeListGetCollection(response, NULL,
- "job-attributes-group", &op);
- copy_attributes(&j->attributes, op);
- papiAttributeListFree(response);
-
- return (result);
-}
-
-/* papiJob{Cancel|Hold|Release|Restart|Promote} are all the same */
-static papi_status_t
-_job_cancel_hold_release_restart_promote(papi_service_t handle,
- char *printer, int32_t job_id, uint16_t type)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- ipp_initialize_request(svc, &request, type);
-
- ipp_initialize_operational_attributes(svc, &op, printer, job_id);
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_status_t
-papiJobCancel(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_job_cancel_hold_release_restart_promote(handle, printer,
- job_id, OPID_CANCEL_JOB));
-}
-
-
-papi_status_t
-papiJobHold(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_job_cancel_hold_release_restart_promote(handle, printer,
- job_id, OPID_HOLD_JOB));
-}
-
-papi_status_t
-papiJobRelease(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_job_cancel_hold_release_restart_promote(handle, printer,
- job_id, OPID_RELEASE_JOB));
-}
-
-papi_status_t
-papiJobRestart(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_job_cancel_hold_release_restart_promote(handle, printer,
- job_id, OPID_RESTART_JOB));
-}
-
-papi_status_t
-papiJobPromote(papi_service_t handle, char *printer, int32_t job_id)
-{
- return (_job_cancel_hold_release_restart_promote(handle, printer,
- job_id, OPID_PROMOTE_JOB));
-}
-
-papi_status_t
-papiJobMove(papi_service_t handle, char *printer, int32_t job_id,
- char *destination)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0) ||
- (destination == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- ipp_initialize_request(svc, &request, OPID_CUPS_MOVE_JOB);
-
- ipp_initialize_operational_attributes(svc, &op, printer, job_id);
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
-
- op = NULL;
- papiAttributeListAddString(&op, PAPI_ATTR_EXCL,
- "job-printer-uri", destination);
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "job-attributes-group", op);
- papiAttributeListFree(op);
-
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_status_t
-papiJobModify(papi_service_t handle, char *printer, int32_t job_id,
- papi_attribute_t **attributes, papi_job_t *job)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
- job_t *j = NULL;
-
- if ((svc == NULL) || (printer == NULL) || (job_id < 0) ||
- (attributes == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((*job = j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, printer)) != PAPI_OK)
- return (result);
-
- ipp_initialize_request(svc, &request, OPID_SET_JOB_ATTRIBUTES);
-
- ipp_initialize_operational_attributes(svc, &op, printer, job_id);
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "job-attributes-group", attributes);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
-
- op = NULL;
- papiAttributeListGetCollection(response, NULL,
- "job-attributes-group", &op);
- copy_attributes(&j->attributes, op);
- papiAttributeListFree(response);
-
- return (result);
-}
diff --git a/usr/src/lib/print/libpapi-ipp/common/mapfile b/usr/src/lib/print/libpapi-ipp/common/mapfile
deleted file mode 100644
index 847a5bb76f..0000000000
--- a/usr/src/lib/print/libpapi-ipp/common/mapfile
+++ /dev/null
@@ -1,292 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# $Id: mapfile.in,v 1.2 2006/03/02 06:31:36 njacobs Exp $
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-#
-# Common interfaces that are most likely to be shared amongst the various
-# PAPI implementations.
-#
-
-SYMBOL_VERSION SUNW_1.0 {
- global:
- # PAPI Attribute Calls
- papiAttributeListAddValue {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddBoolean {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddCollection {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddDatetime {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddInteger {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddMetadata {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddRange {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddResolution {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListDelete {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetValue {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetNext {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFind {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetBoolean {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetCollection {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetDatetime {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetInteger {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetMetadata {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetRange {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetResolution {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFromString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListToString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFree {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- # PAPI Service Calls
- papiServiceCreate ;
- papiServiceDestroy ;
- papiServiceSetUserName ;
- papiServiceSetPassword ;
- papiServiceSetEncryption ;
- papiServiceSetAuthCB ;
- papiServiceSetAppData ;
- papiServiceGetUserName ;
- papiServiceGetPassword ;
- papiServiceGetEncryption ;
- papiServiceGetAppData ;
- papiServiceGetServiceName ;
- papiServiceGetAttributeList ;
- papiServiceGetStatusMessage ;
-
- # PAPI Printer Calls
- papiPrintersList ;
- papiPrinterQuery ;
- papiPrinterAdd ;
- papiPrinterModify ;
- papiPrinterRemove ;
- papiPrinterDisable ;
- papiPrinterEnable ;
- papiPrinterPause ;
- papiPrinterResume ;
- papiPrinterPurgeJobs ;
- papiPrinterListJobs ;
- papiPrinterGetAttributeList ;
- papiPrinterFree ;
- papiPrinterListFree ;
-
- # PAPI Job Calls
- papiJobSubmit ;
- papiJobSubmitByReference ;
- papiJobValidate ;
- papiJobStreamOpen ;
- papiJobStreamWrite ;
- papiJobStreamClose ;
- papiJobQuery ;
- papiJobModify ;
- papiJobMove ;
- papiJobCancel ;
- papiJobHold ;
- papiJobRelease ;
- papiJobRestart ;
- papiJobPromote ;
- papiJobGetAttributeList ;
- papiJobGetPrinterName ;
- papiJobGetId ;
- papiJobGetJobTicket ;
- papiJobFree ;
- papiJobListFree ;
-
- # Misc. PAPI Calls
- papiStatusString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiLibrarySupportedCall {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiLibrarySupportedCalls {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-} ;
-
-SYMBOL_VERSION SUNWprivate_1.0 {
- global:
- papiServiceSetPeer {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobCreate {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobStreamAdd {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobCommit {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- # Misc. supporting calls
- # URI
- uri_from_string {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- uri_to_string {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- uri_free {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- # list
- list_remove {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- list_append {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- list_concatenate {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- # NS
- getprinterbyname {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- is_localhost {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- # extra Attribute Calls
- copy_attributes {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- split_and_copy_attributes {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListPrint {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- local:
- * ;
-} ;
diff --git a/usr/src/lib/print/libpapi-ipp/common/papi_impl.h b/usr/src/lib/print/libpapi-ipp/common/papi_impl.h
deleted file mode 100644
index c7048665a8..0000000000
--- a/usr/src/lib/print/libpapi-ipp/common/papi_impl.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _PAPI_IMPL_H
-#define _PAPI_IMPL_H
-
-/* $Id: papi_impl.h 161 2006-05-03 04:32:59Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <papi.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <time.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <uri.h>
-
-#include <http.h>
-#include <ipp.h>
-
-/*
- * Implementation specific types/prototypes/definitions follow
- *
- *
- * Ex:
- */
-typedef enum {
- TRANSFER_ENCODING_CHUNKED,
- TRANSFER_ENCODING_LENGTH
-} http_transfer_encoding_t;
-
-typedef struct {
- papi_attribute_t **attributes;
- char *name;
- char *user;
- char *password;
- int (*authCB)(papi_service_t svc, void *app_data);
- papi_encryption_t encryption;
- void *app_data;
- uri_t *uri;
- char *post;
- http_t *connection;
- http_transfer_encoding_t transfer_encoding;
-} service_t;
-
-typedef struct job {
- papi_attribute_t **attributes;
-} job_t;
-
-typedef struct {
- papi_attribute_t **attributes;
-} printer_t;
-
-/* IPP glue interfaces */
-extern ssize_t ipp_request_read(void *fd, void *buffer, size_t length);
-extern ssize_t ipp_request_write(void *fd, void *buffer, size_t length);
-extern papi_status_t ipp_send_request(service_t *svc,
- papi_attribute_t **request,
- papi_attribute_t ***response);
-extern papi_status_t ipp_send_request_with_file(service_t *svc,
- papi_attribute_t **request,
- papi_attribute_t ***response, char *file);
-extern papi_status_t ipp_send_initial_request_block(service_t *svc,
- papi_attribute_t **request, ssize_t file_size);
-extern papi_status_t ipp_status_info(service_t *svc,
- papi_attribute_t **response);
-extern void ipp_initialize_request(service_t *svc,
- papi_attribute_t ***request, uint16_t type);
-extern void ipp_initialize_operational_attributes(service_t *svc,
- papi_attribute_t ***op,
- char *printer, int job_id);
-extern papi_status_t ipp_to_papi_status(uint16_t status);
-extern papi_status_t http_to_papi_status(http_status_t status);
-
-/* service related interfaces */
-extern void detailed_error(service_t *svc, char *fmt, ...);
-extern papi_status_t service_connect(service_t *svc, char *service_name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PAPI_IMPL_H */
diff --git a/usr/src/lib/print/libpapi-ipp/common/printer.c b/usr/src/lib/print/libpapi-ipp/common/printer.c
deleted file mode 100644
index c49c4adb03..0000000000
--- a/usr/src/lib/print/libpapi-ipp/common/printer.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: printer.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <papi_impl.h>
-
-#include <config-site.h>
-
-void
-papiPrinterFree(papi_printer_t printer)
-{
- printer_t *tmp = printer;
-
- if (tmp != NULL) {
- if (tmp->attributes != NULL)
- papiAttributeListFree(tmp->attributes);
- free(tmp);
- }
-}
-
-void
-papiPrinterListFree(papi_printer_t *printers)
-{
- if (printers != NULL) {
- int i;
-
- for (i = 0; printers[i] != NULL; i++)
- papiPrinterFree(printers[i]);
- free(printers);
- }
-}
-
-/*
- * Enumeration of printers is not part of the IPP specification, so many
- * servers will probably not respond back with a list of printers, but
- * CUPS has implemented an extension to IPP to enumerate printers and
- * classes. the Apache/mod_ipp IPP listener module available in Solaris
- * implements this IPP extension, so CUPS and Solaris can provide this
- * to IPP clients.
- */
-#ifndef OPID_CUPS_GET_PRINTERS /* for servers that will enumerate */
-#define OPID_CUPS_GET_PRINTERS 0x4002
-#endif /* OPID_CUPS_GET_PRINTERS */
-#ifndef OPID_CUPS_DELETE_PRINTER /* for servers that can delete */
-#define OPID_CUPS_DELETE_PRINTER 0x4004
-#endif /* OPID_CUPS_DELETE_PRINTER */
-#ifndef OPID_CUPS_GET_CLASSES /* for servers that will enumerate */
-#define OPID_CUPS_GET_CLASSES 0x4005
-#endif /* OPID_CUPS_GET_CLASSES */
-
-papi_status_t
-papiPrintersList(papi_service_t handle, char **requested_attrs,
- papi_filter_t *filter, papi_printer_t **printers)
-{
- papi_status_t status, result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
- void *iter = NULL;
-
- if ((svc == NULL) || (printers == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, DEFAULT_DEST)) != PAPI_OK)
- return (result);
- ipp_initialize_request(svc, &request, OPID_CUPS_GET_PRINTERS);
-
- ipp_initialize_operational_attributes(svc, &op, NULL, -1);
-
- if (requested_attrs != NULL) {
- int i;
-
- for (i = 0; requested_attrs[i] != NULL; i++)
- papiAttributeListAddString(&op, PAPI_ATTR_APPEND,
- "requested-attributes", requested_attrs[i]);
- }
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
-
- op = NULL;
- for (status = papiAttributeListGetCollection(response, &iter,
- "printer-attributes-group", &op);
- status == PAPI_OK;
- status = papiAttributeListGetCollection(response, &iter,
- NULL, &op)) {
- printer_t *p = NULL;
-
- if ((p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- copy_attributes(&p->attributes, op);
- op = NULL;
- list_append(printers, p);
- }
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterQuery(papi_service_t handle, char *name,
- char **requested_attrs,
- papi_attribute_t **job_attributes,
- papi_printer_t *printer)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- printer_t *p = NULL;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
-
- if ((svc == NULL) || (name == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- if ((*printer = p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- ipp_initialize_request(svc, &request, OPID_GET_PRINTER_ATTRIBUTES);
-
- ipp_initialize_operational_attributes(svc, &op, name, -1);
-
- if (requested_attrs != NULL) {
- int i;
-
- for (i = 0; requested_attrs[i] != NULL; i++)
- papiAttributeListAddString(&op, PAPI_ATTR_APPEND,
- "requested-attributes", requested_attrs[i]);
- }
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
-
- op = NULL;
- papiAttributeListGetCollection(response, NULL,
- "printer-attributes-group", &op);
- copy_attributes(&p->attributes, op);
- papiAttributeListFree(response);
-
- return (result);
-}
-
-static papi_status_t
-_printer_enable_disable_pause_resume_delete(papi_service_t handle, char *name,
- char *message, uint16_t type)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
-
- if ((svc == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- ipp_initialize_request(svc, &request, type);
-
- ipp_initialize_operational_attributes(svc, &op, name, -1);
-
- switch (type) {
- case OPID_DISABLE_PRINTER:
- papiAttributeListAddString(&op, PAPI_ATTR_REPLACE,
- "printer-message-from-operator", message);
- break;
- case OPID_PAUSE_PRINTER:
- papiAttributeListAddString(&op, PAPI_ATTR_REPLACE,
- "printer-state-message", message);
- break;
- default: /* a message value is of no use */
- break;
- }
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterEnable(papi_service_t handle, char *name)
-{
- return (_printer_enable_disable_pause_resume_delete(handle, name,
- NULL, OPID_ENABLE_PRINTER));
-}
-
-papi_status_t
-papiPrinterResume(papi_service_t handle, char *name)
-{
- return (_printer_enable_disable_pause_resume_delete(handle, name,
- NULL, OPID_RESUME_PRINTER));
-}
-
-papi_status_t
-papiPrinterPause(papi_service_t handle, char *name, char *message)
-{
- return (_printer_enable_disable_pause_resume_delete(handle, name,
- message, OPID_PAUSE_PRINTER));
-}
-
-papi_status_t
-papiPrinterDisable(papi_service_t handle, char *name, char *message)
-{
- return (_printer_enable_disable_pause_resume_delete(handle, name,
- message, OPID_PAUSE_PRINTER));
-}
-
-/*
- * there is no IPP create operation, the set-printer-attibutes operation
- * is the closest we have, so we will assume that the server will create
- * a printer and set attributes if there is none.
- */
-papi_status_t
-papiPrinterAdd(papi_service_t handle, char *name,
- papi_attribute_t **attributes, papi_printer_t *printer)
-{
- return (papiPrinterModify(handle, name, attributes, printer));
-}
-
-papi_status_t
-papiPrinterModify(papi_service_t handle, char *name,
- papi_attribute_t **attributes, papi_printer_t *printer)
-{
- papi_status_t result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- printer_t *p = NULL;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
-
- if ((svc == NULL) || (name == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- if ((*printer = p = calloc(1, sizeof (*p))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- ipp_initialize_request(svc, &request, OPID_SET_PRINTER_ATTRIBUTES);
-
- ipp_initialize_operational_attributes(svc, &op, name, -1);
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "printer-attributes-group", attributes);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
-
- op = NULL;
- papiAttributeListGetCollection(response, NULL,
- "printer-attributes-group", &op);
- copy_attributes(&p->attributes, op);
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterRemove(papi_service_t handle, char *name)
-{
- return (_printer_enable_disable_pause_resume_delete(handle, name,
- NULL, OPID_CUPS_DELETE_PRINTER));
-}
-
-papi_status_t
-papiPrinterPurgeJobs(papi_service_t handle, char *name,
- papi_job_t **jobs)
-{
- papi_status_t status, result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
- void *iter = NULL;
-
-
- if ((svc == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- ipp_initialize_request(svc, &request, OPID_PURGE_JOBS);
-
- ipp_initialize_operational_attributes(svc, &op, name, -1);
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
-
- op = NULL;
- for (status = papiAttributeListGetCollection(response, &iter,
- "job-attributes-group", &op);
- status == PAPI_OK;
- status = papiAttributeListGetCollection(response, &iter,
- NULL, &op)) {
- job_t *j = NULL;
-
- if ((j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- copy_attributes(&j->attributes, op);
- op = NULL;
- list_append(jobs, j);
- }
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_status_t
-papiPrinterListJobs(papi_service_t handle, char *name,
- char **requested_attrs, int type_mask,
- int max_num_jobs, papi_job_t **jobs)
-{
- papi_status_t status, result = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- papi_attribute_t **request = NULL, **op = NULL, **response = NULL;
- void *iter = NULL;
-
- if ((svc == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- /* if we are already connected, use that connection. */
- if (svc->connection == NULL)
- if ((result = service_connect(svc, name)) != PAPI_OK)
- return (result);
-
- ipp_initialize_request(svc, &request, OPID_GET_JOBS);
-
- ipp_initialize_operational_attributes(svc, &op, name, -1);
-
- if (requested_attrs != NULL) {
- int i;
-
- for (i = 0; requested_attrs[i] != NULL; i++)
- papiAttributeListAddString(&op, PAPI_ATTR_APPEND,
- "requested-attributes", requested_attrs[i]);
- }
-
- papiAttributeListAddCollection(&request, PAPI_ATTR_REPLACE,
- "operational-attributes-group", op);
- papiAttributeListFree(op);
- result = ipp_send_request(svc, request, &response);
- papiAttributeListFree(request);
-
- op = NULL;
- for (status = papiAttributeListGetCollection(response, &iter,
- "job-attributes-group", &op);
- status == PAPI_OK;
- status = papiAttributeListGetCollection(response, &iter,
- NULL, &op)) {
- job_t *j = NULL;
-
- if ((j = calloc(1, sizeof (*j))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- copy_attributes(&j->attributes, op);
- op = NULL;
- list_append(jobs, j);
- }
- papiAttributeListFree(response);
-
- return (result);
-}
-
-papi_attribute_t **
-papiPrinterGetAttributeList(papi_printer_t printer)
-{
- papi_attribute_t **result = NULL;
- printer_t *p = printer;
-
- if (p != NULL)
- result = p->attributes;
-
- return (result);
-}
diff --git a/usr/src/lib/print/libpapi-ipp/common/service.c b/usr/src/lib/print/libpapi-ipp/common/service.c
deleted file mode 100644
index e5531f1422..0000000000
--- a/usr/src/lib/print/libpapi-ipp/common/service.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: service.c 171 2006-05-20 06:00:32Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <alloca.h>
-#include <libintl.h>
-#include <papi_impl.h>
-
-#include <config-site.h>
-
-http_encryption_t
-http_encryption_type(papi_encryption_t encryption)
-{
- switch (encryption) {
- case PAPI_ENCRYPT_IF_REQUESTED:
- return (HTTP_ENCRYPT_IF_REQUESTED);
- case PAPI_ENCRYPT_REQUIRED:
- return (HTTP_ENCRYPT_REQUIRED);
- case PAPI_ENCRYPT_ALWAYS:
- return (HTTP_ENCRYPT_ALWAYS);
- case PAPI_ENCRYPT_NEVER:
- return (HTTP_ENCRYPT_NEVER);
- default:
- ; /* this should log an error */
- }
-
- return (HTTP_ENCRYPT_NEVER); /* should never get here */
-}
-
-papi_status_t
-service_connect(service_t *svc, char *service_name)
-{
- papi_status_t result = PAPI_OK;
- int port = 631;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if (svc->connection != NULL) /* alread connected ? */
- return (PAPI_OK);
-
- if (svc->uri == NULL)
- uri_from_string(service_name, &svc->uri);
-
- if ((service_name != NULL) && (svc->uri == NULL)) {
- /*
- * a name was supplied and it's not in URI form, we will
- * try to use a "default" IPP service under the assumption
- * that this is most likely a short-form printer name from
- * from a papiPrinter*() or papiJob*() call and not from a
- * papiServiceCreate() call.
- */
- if ((service_name = getenv("PAPI_SERVICE_URI")) == NULL) {
- char *cups;
-
- if ((cups = getenv("CUPS_SERVER")) != NULL) {
- char buf[BUFSIZ];
-
- snprintf(buf, sizeof (buf),
- "ipp://%s/printers/", cups);
- service_name = strdup(buf);
- }
- }
- if (service_name == NULL)
- service_name = DEFAULT_IPP_SERVICE_URI;
-
- uri_from_string(service_name, &svc->uri);
- }
-
- if (svc->uri == NULL)
- return (PAPI_NOT_POSSIBLE);
-
- if (svc->uri->port != NULL)
- port = strtol(svc->uri->port, NULL, 10);
-
- svc->connection = httpConnectEncrypt(svc->uri->host, port,
- http_encryption_type(svc->encryption));
- if (svc->connection == NULL) {
- if (svc->uri != NULL) {
- uri_free(svc->uri);
- svc->uri = NULL;
- }
- result = PAPI_SERVICE_UNAVAILABLE;
- } else if (service_name != NULL)
- svc->name = strdup(service_name);
-
- return (result);
-}
-
-papi_status_t
-papiServiceCreate(papi_service_t *handle, char *service_name,
- char *user_name, char *password,
- int (*authCB)(papi_service_t svc, void *app_data),
- papi_encryption_t encryption, void *app_data)
-{
- papi_status_t result = PAPI_NOT_POSSIBLE;
- service_t *svc = NULL;
- char *encoding = getenv("HTTP_TRANSFER_ENCODING");
-
- if (handle == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if ((*handle = svc = calloc(1, sizeof (*svc))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- if (user_name != NULL)
- svc->user = strdup(user_name);
-
- if (password != NULL)
- svc->password = strdup(password);
-
- svc->encryption = encryption;
-
- if (authCB != NULL)
- svc->authCB = authCB;
-
- if (app_data != NULL)
- svc->app_data = app_data;
-
- if ((encoding != NULL) && (strcasecmp(encoding, "content-length") == 0))
- svc->transfer_encoding = TRANSFER_ENCODING_LENGTH;
- else
- svc->transfer_encoding = TRANSFER_ENCODING_CHUNKED;
-
- if (service_name != NULL) {
- result = service_connect(svc, service_name);
- } else
- result = PAPI_OK;
-
- return (result);
-}
-
-void
-papiServiceDestroy(papi_service_t handle)
-{
- if (handle != NULL) {
- service_t *svc = handle;
-
- if (svc->attributes != NULL)
- papiAttributeListFree(svc->attributes);
- if (svc->name != NULL)
- free(svc->name);
- if (svc->user != NULL)
- free(svc->user);
- if (svc->password != NULL)
- free(svc->password);
- if (svc->uri != NULL)
- uri_free(svc->uri);
- if (svc->post != NULL)
- free(svc->post);
- if (svc->connection != NULL)
- httpClose(svc->connection);
-
- free(handle);
- }
-}
-
-papi_status_t
-papiServiceSetUserName(papi_service_t handle, char *user_name)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- if (svc->user != NULL)
- free(svc->user);
- svc->user = NULL;
- if (user_name != NULL)
- svc->user = strdup(user_name);
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-papi_status_t
-papiServiceSetPassword(papi_service_t handle, char *password)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- if (svc->password != NULL)
- free(svc->password);
- svc->password = NULL;
- if (password != NULL)
- svc->password = strdup(password);
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-papi_status_t
-papiServiceSetEncryption(papi_service_t handle,
- papi_encryption_t encryption)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- svc->encryption = encryption;
- httpEncryption(svc->connection,
- (http_encryption_t)svc->encryption);
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-papi_status_t
-papiServiceSetAuthCB(papi_service_t handle,
- int (*authCB)(papi_service_t svc, void *app_data))
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- svc->authCB = authCB;
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-
-papi_status_t
-papiServiceSetAppData(papi_service_t handle, void *app_data)
-{
- papi_status_t result = PAPI_OK;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- svc->app_data = (void *)app_data;
- } else
- result = PAPI_BAD_ARGUMENT;
-
- return (result);
-}
-
-char *
-papiServiceGetServiceName(papi_service_t handle)
-{
- char *result = NULL;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- result = svc->name;
- }
-
- return (result);
-}
-
-char *
-papiServiceGetUserName(papi_service_t handle)
-{
- char *result = NULL;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- result = svc->user;
- }
-
- return (result);
-}
-
-char *
-papiServiceGetPassword(papi_service_t handle)
-{
- char *result = NULL;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- result = svc->password;
- }
-
- return (result);
-}
-
-papi_encryption_t
-papiServiceGetEncryption(papi_service_t handle)
-{
- papi_encryption_t result = PAPI_ENCRYPT_NEVER;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- result = svc->encryption;
- }
-
- return (result);
-}
-
-void *
-papiServiceGetAppData(papi_service_t handle)
-{
- void *result = NULL;
-
- if (handle != NULL) {
- service_t *svc = handle;
-
- result = svc->app_data;
- }
-
- return (result);
-}
-
-papi_attribute_t **
-papiServiceGetAttributeList(papi_service_t handle)
-{
- papi_attribute_t **result = NULL;
- service_t *svc = handle;
-
- if (handle != NULL)
- result = svc->attributes;
-
- return (result);
-}
-
-char *
-papiServiceGetStatusMessage(papi_service_t handle)
-{
- char *result = NULL;
- service_t *svc = handle;
-
- papiAttributeListGetString(svc->attributes, NULL,
- "detailed-status-message", &result);
-
- return (result);
-}
-
-void
-detailed_error(service_t *svc, char *fmt, ...)
-{
- if ((svc != NULL) && (fmt != NULL)) {
- va_list ap;
- size_t size;
- char *message = alloca(BUFSIZ);
-
- va_start(ap, fmt);
- /*
- * fill in the message. If the buffer is too small, allocate
- * one that is large enough and fill it in.
- */
- if ((size = vsnprintf(message, BUFSIZ, fmt, ap)) >= BUFSIZ)
- if ((message = alloca(size)) != NULL)
- vsnprintf(message, size, fmt, ap);
- va_end(ap);
-
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_APPEND,
- "detailed-status-message", message);
- }
-}
diff --git a/usr/src/lib/print/libpapi-ipp/i386/Makefile b/usr/src/lib/print/libpapi-ipp/i386/Makefile
deleted file mode 100644
index 39b4a998ec..0000000000
--- a/usr/src/lib/print/libpapi-ipp/i386/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS) $(EXTRALINKS)
diff --git a/usr/src/lib/print/libpapi-ipp/sparc/Makefile b/usr/src/lib/print/libpapi-ipp/sparc/Makefile
deleted file mode 100644
index 39b4a998ec..0000000000
--- a/usr/src/lib/print/libpapi-ipp/sparc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS) $(EXTRALINKS)
diff --git a/usr/src/lib/print/libpapi-lpd/Makefile b/usr/src/lib/print/libpapi-lpd/Makefile
deleted file mode 100644
index b92d620b10..0000000000
--- a/usr/src/lib/print/libpapi-lpd/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.lib
-
-#HDRS = papi.h
-#HDRDIR = common
-SUBDIRS = $(MACH)
-#$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET = all
-clean := TARGET = clean
-clobber := TARGET = clobber
-install := TARGET = install
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all clean clobber install: .WAIT $(SUBDIRS)
-
-lint: # $(SUBDIRS)
-
-install_h: # $(ROOTHDRS)
-
-check: # $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/libpapi-lpd/Makefile.com b/usr/src/lib/print/libpapi-lpd/Makefile.com
deleted file mode 100644
index c50fd8b223..0000000000
--- a/usr/src/lib/print/libpapi-lpd/Makefile.com
+++ /dev/null
@@ -1,92 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-LIBRARY = psm-lpd.a
-VERS = .1
-COMMON_OBJS = lpd-misc.o
-OBJECTS = job.o library.o lpd-cancel.o lpd-job.o lpd-query.o printer.o \
- service.o $(COMMON_OBJS)
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
-
-SRCDIR = ../common
-
-ROOTLIBDIR= $(ROOT)/usr/lib/print
-ROOTLIBDIR64= $(ROOT)/usr/lib/print/$(MACH)
-
-EXTRALINKS= $(ROOTLIBDIR)/psm-rfc-1179.so
-$(EXTRALINKS): $(ROOTLINKS)
- $(RM) $@; $(SYMLINK) $(LIBLINKS) $@
-
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(SRCDIR)
-CPPFLAGS += -I../../libpapi-common/common
-
-CERRWARN += -_gcc=-Wno-unused-variable
-
-MAPFILES = $(SRCDIR)/mapfile
-
-LDLIBS += -lc
-
-.KEEP_STATE:
-
-all: $(LIBS) $(PROG)
-
-lint: lintcheck
-
-include ../../../Makefile.targ
-
-#
-# NEEDED to build lpd-port
-#
-PROG = lpd-port
-LPD_PORT_OBJS = lpd-port.o $(COMMON_OBJS)
-
-$(PROG) := LDLIBS += -lsocket -lnsl -lsendfile
-
-PROG_OBJS = $(LPD_PORT_OBJS:%=pics/%)
-OBJS += $(PROG_OBJS)
-
-LDFLAGS.cmd = \
- $(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) $(BDIRECT) \
- $(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
-
-$(PROG): $(PROG_OBJS)
- $(LINK.c) -o $@ $(PROG_OBJS) $(LDFLAGS.cmd) $(LDLIBS)
- $(POST_PROCESS)
-
-# needed for the 'install' phase
-ROOTLIBPRINTPROG = $(PROG:%=$(ROOTLIBDIR)/%)
-$(ROOTLIBPRINTPROG) := FILEMODE = 04511
-
-$(ROOTLIBDIR)/%: $(ROOTLIBDIR) %
- $(INS.file)
-$(ROOTLIBDIR):
- $(INS.dir)
diff --git a/usr/src/lib/print/libpapi-lpd/common/job.c b/usr/src/lib/print/libpapi-lpd/common/job.c
deleted file mode 100644
index 8663816337..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/job.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* $Id: job.c 179 2006-07-17 18:24:07Z njacobs $ */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <limits.h>
-#include <libintl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <papi_impl.h>
-#include <uri.h>
-
-/*
- * must copy files before leaving routine
- */
-papi_status_t
-papiJobSubmit(papi_service_t handle, char *name, papi_attribute_t **attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
-{
- papi_status_t status = PAPI_OK;
- service_t *svc = handle;
- job_t *j = NULL;
- char *metadata = NULL;
-
- if ((svc == NULL) || (name == NULL) || (files == NULL) ||
- (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (job_ticket != NULL) {
- detailed_error(svc,
- gettext("papiJobSubmit: job ticket not supported"));
- return (PAPI_OPERATION_NOT_SUPPORTED);
- }
-
- if ((status = service_fill_in(svc, name)) != PAPI_OK)
- return (status);
-
- if ((*job = j = (job_t *)calloc(1, sizeof (*j))) == NULL) {
- detailed_error(svc,
- gettext("calloc() failed"));
- return (PAPI_TEMPORARY_ERROR);
- }
-
- /* before creating a control file add the job-name */
- if ((files != NULL) && (files[0] != NULL))
- papiAttributeListAddString(&attributes, PAPI_ATTR_EXCL,
- "job-name", files[0]);
-
- /* create a control file */
- (void) lpd_job_add_attributes(svc, attributes, &metadata,
- &j->attributes);
-
- if ((status = lpd_job_add_files(svc, attributes, files, &metadata,
- &j->attributes)) != PAPI_OK) {
- return (status);
- }
-
- /* send the job to the server */
- status = lpd_submit_job(svc, metadata, &j->attributes, NULL);
- free(metadata);
-
- return (status);
-
-}
-
-
-papi_status_t
-papiJobSubmitByReference(papi_service_t handle, char *name,
- papi_attribute_t **job_attributes,
- papi_job_ticket_t *job_ticket, char **files, papi_job_t *job)
-{
- return (papiJobSubmit(handle, name, job_attributes,
- job_ticket, files, job));
-}
-
-papi_status_t
-papiJobStreamOpen(papi_service_t handle, char *name,
- papi_attribute_t **attributes,
- papi_job_ticket_t *job_ticket, papi_stream_t *stream)
-{
- papi_status_t status = PAPI_OK;
- service_t *svc = handle;
- char *metadata = NULL;
- stream_t *s = NULL;
-
- if ((svc == NULL) || (name == NULL) || (stream == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if (job_ticket != NULL)
- return (PAPI_OPERATION_NOT_SUPPORTED);
-
- if ((status = service_fill_in(svc, name)) != PAPI_OK)
- return (status);
-
- /* create the stream container */
- if ((*stream = s = calloc(1, sizeof (*s))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- /* create the job */
- if ((s->job = calloc(1, sizeof (*(s->job)))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- papiAttributeListAddString(&attributes, PAPI_ATTR_EXCL,
- "job-name", "standard input");
-
- /* process the attribute list */
- lpd_job_add_attributes(svc, attributes, &metadata, &s->job->attributes);
-
- /* if we can stream, do it */
- if ((svc->uri->fragment != NULL) &&
- (strcasecmp(svc->uri->fragment, "streaming") == 0)) {
- char *files[] = { "standard input", NULL };
-
- lpd_job_add_files(svc, attributes, files, &metadata,
- &(s->job->attributes));
- status = lpd_submit_job(svc, metadata, &(s->job->attributes),
- &s->fd);
- } else {
- char dfname[18];
- char buf[256];
-
- strcpy(dfname, "/tmp/stdin-XXXXX");
-
- if ((s->fd = mkstemp(dfname)) >= 0)
- s->dfname = strdup(dfname);
- if (s->job->attributes)
- papiAttributeListFree(s->job->attributes);
- s->job->attributes = NULL;
- papiAttributeListToString(attributes, " ", buf, sizeof (buf));
- papiAttributeListFromString(&(s->job->attributes),
- PAPI_ATTR_APPEND, buf);
- }
- s->metadata = metadata;
-
- return (status);
-}
-
-
-papi_status_t
-papiJobStreamWrite(papi_service_t handle, papi_stream_t stream,
- void *buffer, size_t buflen)
-{
- service_t *svc = handle;
- stream_t *s = stream;
-
- if ((svc == NULL) || (stream == NULL) || (buffer == NULL) ||
- (buflen == 0))
- return (PAPI_BAD_ARGUMENT);
-
- if (write(s->fd, buffer, buflen) != buflen)
- return (PAPI_DEVICE_ERROR);
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiJobStreamClose(papi_service_t handle, papi_stream_t stream, papi_job_t *job)
-{
- papi_status_t status = PAPI_INTERNAL_ERROR;
- service_t *svc = handle;
- job_t *j = NULL;
- stream_t *s = stream;
- int ret;
-
- if ((svc == NULL) || (stream == NULL) || (job == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- close(s->fd); /* close the stream */
-
- if (s->dfname != NULL) { /* if it is a tmpfile, print it */
- char *files[2];
-
- files[0] = s->dfname;
- files[1] = NULL;
-
- lpd_job_add_files(svc, s->job->attributes, files, &s->metadata,
- &(s->job->attributes));
- status = lpd_submit_job(svc, s->metadata,
- &(s->job->attributes), NULL);
- unlink(s->dfname);
- free(s->dfname);
- } else
- status = PAPI_OK;
-
- if (s->metadata != NULL)
- free(s->metadata);
-
- *job = s->job;
-
- return (status);
-}
-
-papi_status_t
-papiJobQuery(papi_service_t handle, char *name, int32_t job_id,
- char **job_attributes, papi_job_t *job)
-{
- papi_status_t status = PAPI_OK;
- service_t *svc = handle;
-
- if ((svc == NULL) || (name == NULL) || job_id < 0)
- return (PAPI_BAD_ARGUMENT);
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK)
- status = lpd_find_job_info(svc, job_id, (job_t **)job);
-
- return (status);
-}
-
-papi_status_t
-papiJobCancel(papi_service_t handle, char *name, int32_t job_id)
-{
- papi_status_t status;
- service_t *svc = handle;
-
- if ((svc == NULL) || (name == NULL) || (job_id < 0))
- return (PAPI_BAD_ARGUMENT);
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK)
- status = lpd_cancel_job(svc, job_id);
-
- return (status);
-}
-
-papi_attribute_t **
-papiJobGetAttributeList(papi_job_t job)
-{
- job_t *j = (job_t *)job;
-
- if (j != NULL)
- return ((papi_attribute_t **)j->attributes);
-
- return (NULL);
-}
-
-char *
-papiJobGetPrinterName(papi_job_t job)
-{
- char *result = NULL;
- job_t *j = (job_t *)job;
-
- if (j != NULL)
- papiAttributeListGetString(j->attributes, NULL,
- "printer-name", &result);
-
- return (result);
-}
-
-int
-papiJobGetId(papi_job_t job)
-{
- int result = -1;
- job_t *j = (job_t *)job;
-
- if (j != NULL)
- papiAttributeListGetInteger(j->attributes, NULL,
- "job-id", &result);
-
- return (result);
-}
-
-void
-papiJobFree(papi_job_t job)
-{
- job_t *j = (job_t *)job;
-
-
- if (j != NULL) {
- papiAttributeListFree(j->attributes);
- free(j);
- }
-}
-
-void
-papiJobListFree(papi_job_t *jobs)
-{
- if (jobs != NULL) {
- int i;
-
- for (i = 0; jobs[i] != NULL; i++)
- papiJobFree(jobs[i]);
- free(jobs);
- }
-}
diff --git a/usr/src/lib/print/libpapi-lpd/common/library.c b/usr/src/lib/print/libpapi-lpd/common/library.c
deleted file mode 100644
index de38c2bbfa..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/library.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: library.c 146 2006-03-24 00:26:54Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <alloca.h>
-#include <libintl.h>
-#include <papi_impl.h>
-
-static char *calls[] = {
- /* Attribute Calls */
- "papiAttributeListAdd",
- "papiAttributeListAddBoolean", "papiAttributeListAddCollection",
- "papiAttributeListAddDatetime", "papiAttributeListAddInteger",
- "papiAttributeListAddMetadata", "papiAttributeListAddRange",
- "papiAttributeListAddResolution", "papiAttributeListAddString",
- "papiAttributeListDelete",
- "papiAttributeListGetValue", "papiAttributeListGetNext",
- "papiAttributeListFind",
- "papiAttributeListGetBoolean", "papiAttributeListGetCollection",
- "papiAttributeListGetDatetime", "papiAttributeListGetInteger",
- "papiAttributeListGetMetadata", "papiAttributeListGetRange",
- "papiAttributeListGetResolution", "papiAttributeListGetString",
- "papiAttributeListFromString", "papiAttributeListToString",
- "papiAttributeListFree",
- /* Job Calls */
- "papiJobSubmit", "papiJobSubmitByReference",
- "papiJobStreamOpen", "papiJobStreamWrite", "papiJobStreamClose",
- "papiJobQuery", "papiJobCancel",
- "papiJobGetAttributeList", "papiJobGetId", "papiJobGetPrinterName",
- "papiJobFree", "papiJobListFree",
- /* Printer Calls */
- "papiPrinterQuery", "papiPrinterPurgeJobs", "papiPrinterListJobs",
- "papiPrinterGetAttributeList", "papiPrinterFree",
- /* Service Calls */
- "papiServiceCreate", "papiServiceDestroy",
- "papiServiceGetStatusMessage",
- /* Misc Calls */
- "papiStatusString",
- "papiLibrarySupportedCall", "papiLibrarySupportedCalls",
- NULL
-};
-
-char **
-papiLibrarySupportedCalls()
-{
- return (calls);
-}
-
-char
-papiLibrarySupportedCall(char *name)
-{
- int i;
-
- for (i = 0; calls[i] != NULL; i++)
- if (strcmp(name, calls[i]) == 0)
- return (PAPI_TRUE);
-
- return (PAPI_FALSE);
-}
diff --git a/usr/src/lib/print/libpapi-lpd/common/lpd-cancel.c b/usr/src/lib/print/libpapi-lpd/common/lpd-cancel.c
deleted file mode 100644
index d5a8fd30fd..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/lpd-cancel.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lpd-cancel.c 155 2006-04-26 02:34:54Z ktou $ */
-
-#define __EXTENSIONS__ /* for strtok_r() */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <papi_impl.h>
-
-papi_status_t
-lpd_cancel_job(service_t *svc, int id)
-{
- papi_status_t status = PAPI_INTERNAL_ERROR;
- int fd;
- char *list[2];
- char buf[128]; /* this should be overkill */
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- snprintf(buf, sizeof (buf), "%d", id);
- list[0] = buf;
- list[1] = NULL;
-
- if ((fd = lpd_open(svc, 'c', list, 15)) < 0)
- return (PAPI_INTERNAL_ERROR);
-
- memset(buf, 0, sizeof (buf));
- if (fdgets(buf, sizeof (buf), fd) != NULL) {
- if (buf[0] == '\0')
- status = PAPI_NOT_FOUND;
- else if ((strstr(buf, "permission denied") != NULL) ||
- (strstr(buf, "not-authorized") != NULL))
- status = PAPI_NOT_AUTHORIZED;
- else if ((strstr(buf, "cancelled") != NULL) ||
- (strstr(buf, "removed") != NULL))
- status = PAPI_OK;
- } else
- status = PAPI_NOT_FOUND;
-
- close(fd);
-
- return (status);
-}
-
-papi_status_t
-lpd_purge_jobs(service_t *svc, job_t ***jobs)
-{
- papi_status_t status = PAPI_INTERNAL_ERROR;
- int fd;
- char *queue;
- char buf[256];
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if ((fd = lpd_open(svc, 'c', NULL, 15)) < 0)
- return (PAPI_INTERNAL_ERROR);
-
- queue = queue_name_from_uri(svc->uri);
-
- status = PAPI_OK;
- memset(buf, 0, sizeof (buf));
- while (fdgets(buf, sizeof (buf), fd) != NULL) {
- /* if we canceled it, add it to the list */
- if ((strstr(buf, "cancelled") != NULL) ||
- (strstr(buf, "removed") != NULL)) {
- job_t *job;
- papi_attribute_t **attributes = NULL;
- char *ptr, *iter = NULL;
- int id;
-
- ptr = strtok_r(buf, ":", &iter);
- papiAttributeListAddString(&attributes, PAPI_ATTR_EXCL,
- "job-name", ptr);
- id = atoi(ptr);
- papiAttributeListAddInteger(&attributes, PAPI_ATTR_EXCL,
- "job-id", id);
- papiAttributeListAddString(&attributes, PAPI_ATTR_EXCL,
- "job-printer", queue);
-
- if ((job = (job_t *)calloc(1, (sizeof (*job))))
- != NULL) {
- job->attributes = attributes;
- list_append(jobs, job);
- } else
- papiAttributeListFree(attributes);
- } else if (strstr(buf, "permission denied") != NULL)
- status = PAPI_NOT_AUTHORIZED;
- }
- close(fd);
-
- return (status);
-}
diff --git a/usr/src/lib/print/libpapi-lpd/common/lpd-job.c b/usr/src/lib/print/libpapi-lpd/common/lpd-job.c
deleted file mode 100644
index c958a51e06..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/lpd-job.c
+++ /dev/null
@@ -1,626 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lpd-job.c 157 2006-04-26 15:07:55Z ktou $ */
-
-
-#define __EXTENSIONS__ /* for strtok_r() */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <pwd.h>
-#include <libintl.h>
-#include <papi_impl.h>
-
-enum { LPD_RFC, LPD_SVR4 };
-
-static char
-mime_type_to_rfc1179_type(char *mime)
-{
- static struct { char *mime; char rfc; } cvt[] = {
- { "text/plain", 'f' },
- { "application/octet-stream", 'l' },
- { "application/postscript", 'f' }, /* rfc incorrectly has 'o' */
- { "application/x-pr", 'p' },
- { "application/x-cif", 'c' },
- { "application/x-dvi", 'd' },
- { "application/x-fortran", 'r' },
- { "application/x-plot", 'g' },
- { "application/x-ditroff", 'n' },
- { "application/x-troff", 't' },
- { "application/x-raster", 'v' },
- { NULL, 0}
- };
- char result = '\0';
-
- if (mime != NULL) {
- int i;
-
- for (i = 0; cvt[i].mime != NULL; i++)
- if (strcasecmp(cvt[i].mime, mime) == 0) {
- result = cvt[i].rfc;
- break;
- }
- }
-
- return (result);
-}
-
-static papi_status_t
-add_lpd_control_line(char **metadata, char code, char *value)
-{
- size_t size = 0;
- char line[BUFSIZ];
-
- if ((metadata == NULL) || (value == NULL))
- return (PAPI_BAD_REQUEST);
-
- if (*metadata != NULL)
- size = strlen(*metadata);
- size += strlen(value) + 3;
-
- if (*metadata == NULL) {
- *metadata = (char *)calloc(1, size);
- } else {
- void *tmp;
- tmp = calloc(1, size);
- if (tmp) {
- strlcpy(tmp, *metadata, size);
- free(*metadata);
- *metadata = (char *)tmp;
- } else
- return (PAPI_TEMPORARY_ERROR);
- }
-
- snprintf(line, sizeof (line), "%c%s\n", code, value);
- strlcat(*metadata, line, size);
-
- return (PAPI_OK);
-}
-
-static papi_status_t
-add_svr4_control_line(char **metadata, char code, char *value)
-{
-
- char line[BUFSIZ];
-
- if ((metadata == NULL) || (value == NULL))
- return (PAPI_BAD_REQUEST);
-
- snprintf(line, sizeof (line), "%c%s", code, value);
-
- return (add_lpd_control_line(metadata, '5', line));
-}
-
-static papi_status_t
-add_hpux_control_line(char **metadata, char *value)
-{
-
- char line[BUFSIZ];
-
- if ((metadata == NULL) || (value == NULL))
- return (PAPI_BAD_REQUEST);
-
- snprintf(line, sizeof (line), " O%s", value);
-
- return (add_lpd_control_line(metadata, 'N', line));
-}
-
-static papi_status_t
-add_int_control_line(char **metadata, char code, int value, int flag)
-{
- char buf[16];
-
- snprintf(buf, sizeof (buf), "%d", value);
-
- if (flag == LPD_SVR4)
- return (add_svr4_control_line(metadata, code, buf));
- else
- return (add_lpd_control_line(metadata, code, buf));
-}
-
-static papi_status_t
-lpd_add_rfc1179_attributes(service_t *svc, papi_attribute_t **attributes,
- char **metadata, papi_attribute_t ***used)
-{
- papi_status_t status = PAPI_OK;
- char *s;
- int integer;
- char bool;
- char host[BUFSIZ];
- char *user = "nobody";
- uid_t uid = getuid();
- struct passwd *pw;
- char *h1;
-
- if (svc == NULL)
- return (PAPI_BAD_REQUEST);
-
- /* There is nothing to do */
- if (attributes == NULL)
- return (PAPI_OK);
-
- gethostname(host, sizeof (host));
- if (papiAttributeListGetString(attributes, NULL,
- "job-originating-host-name", &h1) == PAPI_OK) {
- papiAttributeListAddString(&attributes, PAPI_ATTR_APPEND,
- "job-host", h1);
- }
- add_lpd_control_line(metadata, 'H', host);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "job-originating-host-name", host);
-
- if ((pw = getpwuid(uid)) != NULL)
- user = pw->pw_name;
- if (uid == 0)
- papiAttributeListGetString(svc->attributes, NULL, "username",
- &user);
- add_lpd_control_line(metadata, 'P', user);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "job-originating-user-name", user);
-
- /* Class for Banner Page */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "rfc-1179-class", &s);
- if (s != NULL) {
- add_lpd_control_line(metadata, 'C', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "rfc-1179-class", s);
- }
-
- /* Print Banner Page */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "job-sheets", &s);
- if ((s != NULL) && (strcmp(s, "standard") == 0)) {
- add_lpd_control_line(metadata, 'L', user);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "job-sheets", s);
- }
-
- /* Jobname */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "job-name", &s);
- if (s != NULL) {
- add_lpd_control_line(metadata, 'J', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "job-name", s);
- }
-
- /* User to mail when job is done - lpr -m */
- bool = PAPI_FALSE;
- papiAttributeListGetBoolean(attributes, NULL, "rfc-1179-mail", &bool);
- if (bool == PAPI_TRUE) {
- add_lpd_control_line(metadata, 'M', user);
- papiAttributeListAddBoolean(used, PAPI_ATTR_EXCL,
- "rfc-1179-mail", bool);
- }
-
- /* Title for pr */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "pr-title", &s);
- if (s != NULL) {
- add_lpd_control_line(metadata, 'T', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "pr-title", s);
- }
-
- /* Indent - used with pr filter */
- integer = 0;
- papiAttributeListGetInteger(attributes, NULL, "pr-indent", &integer);
- if (integer >= 1) {
- add_int_control_line(metadata, 'I', integer, LPD_RFC);
- papiAttributeListAddInteger(used, PAPI_ATTR_EXCL,
- "pr-indent", integer);
- }
-
- /* Width - used with pr filter */
- integer = 0;
- papiAttributeListGetInteger(attributes, NULL, "pr-width", &integer);
- if (integer >= 1) {
- add_int_control_line(metadata, 'W', integer, LPD_RFC);
- papiAttributeListAddInteger(used, PAPI_ATTR_EXCL,
- "pr-width", integer);
- }
-
- /* file with Times Roman font lpr -1 */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "rfc-1179-font-r", &s);
- if (s != NULL) {
- add_lpd_control_line(metadata, '1', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "rfc-1179-font-r", s);
- }
-
- /* file with Times Roman font lpr -2 */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "rfc-1179-font-i", &s);
- if (s != NULL) {
- add_lpd_control_line(metadata, '2', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "rfc-1179-font-i", s);
- }
-
- /* file with Times Roman font lpr -3 */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "rfc-1179-font-b", &s);
- if (s != NULL) {
- add_lpd_control_line(metadata, '3', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "rfc-1179-font-b", s);
- }
-
- /* file with Times Roman font lpr -4 */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "rfc-1179-font-s", &s);
- if (s != NULL) {
- add_lpd_control_line(metadata, '4', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "rfc-1179-font-s", s);
- }
-
- /*
- * The document format needs to be added, but the control line
- * should be added when the filenames are figured out.
- */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "document-format", &s);
- if (s != NULL) {
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "document-format", s);
- }
-
- return (status);
-}
-
-static char *
-unused_attributes(papi_attribute_t **list, papi_attribute_t **used)
-{
- char *result = NULL;
- char **names = NULL;
- int i;
-
- if ((list == NULL) || (used == NULL))
- return (NULL);
-
- for (i = 0; used[i] != NULL; i++)
- list_append(&names, used[i]->name);
-
- if (names != NULL) {
- papi_attribute_t **unused = NULL;
-
- /* add these to the list of things to ignore */
- list_append(&names, "document-format");
- list_append(&names, "copies");
-
- split_and_copy_attributes(names, list, NULL, &unused);
- if (unused != NULL) {
- size_t size = 0;
-
- do {
- size += 1024;
- if (result != NULL)
- free(result);
- result = calloc(1, size);
- } while (papiAttributeListToString(unused, " ",
- result, size) != PAPI_OK);
- papiAttributeListFree(unused);
- }
- free(names);
- }
-
- return (result);
-}
-
-/*
- * lpd_add_svr4_attributes
- * Solaris 2.x LP - BSD protocol extensions
- */
-static papi_status_t
-lpd_add_svr4_attributes(service_t *svc, papi_attribute_t **attributes,
- char **metadata, papi_attribute_t ***used)
-{
- papi_attribute_t *tmp[2];
- char *s;
- int integer;
-
- if (svc == NULL)
- return (PAPI_BAD_REQUEST);
-
- /* media */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "media", &s);
- if (s != NULL) {
- add_svr4_control_line(metadata, 'f', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "media", s);
- }
-
- /* Handling */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "job-hold-until", &s);
- if ((s != NULL) && (strcmp(s, "indefinite") == 0)) {
- add_svr4_control_line(metadata, 'H', "hold");
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "job-hold-until", "indefinite");
- } else if ((s != NULL) && (strcmp(s, "no-hold") == 0)) {
- add_svr4_control_line(metadata, 'H', "immediate");
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "job-hold-until", "no-hold");
- } else if (s != NULL) {
- add_svr4_control_line(metadata, 'H', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "job-hold-until", s);
- }
-
- /* Pages */
- s = NULL;
- memset(tmp, NULL, sizeof (tmp));
- tmp[0] = papiAttributeListFind(attributes, "page-ranges");
- if (tmp[0] != NULL) {
- char buf[BUFSIZ];
-
- papiAttributeListToString(tmp, " ", buf, sizeof (buf));
- if ((s = strchr(buf, '=')) != NULL) {
- add_svr4_control_line(metadata, 'P', ++s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "page-ranges", s);
- }
- }
-
- /* Priority : lp -q */
- integer = -1;
- papiAttributeListGetInteger(attributes, NULL, "job-priority", &integer);
- if (integer != -1) {
- integer = 40 - (integer / 2.5);
- add_int_control_line(metadata, 'q', integer, LPD_SVR4);
- papiAttributeListAddInteger(used, PAPI_ATTR_EXCL,
- "job-priority", integer);
- }
-
- /* Charset : lp -S */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "lp-charset", &s);
- if (s != NULL) {
- add_svr4_control_line(metadata, 'S', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "lp-charset", s);
- }
-
- /* Type : done when adding file */
-
- /* Mode : lp -y */
- s = NULL;
- papiAttributeListGetString(attributes, NULL, "lp-modes", &s);
- if (s != NULL) {
- add_svr4_control_line(metadata, 'y', s);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "lp-modes", s);
- }
-
- /* Options lp -o are handled elsewhere */
- if ((s = unused_attributes(attributes, *used)) != NULL) {
- add_lpd_control_line(metadata, 'O', s);
- free(s);
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-lpd_add_hpux_attributes(service_t *svc, papi_attribute_t **attributes,
- char **metadata, papi_attribute_t ***used)
-{
- char *s = NULL;
-
- /* Options lp -o */
- if ((s = unused_attributes(attributes, *used)) != NULL) {
- add_hpux_control_line(metadata, s);
- free(s);
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-lpd_job_add_attributes(service_t *svc, papi_attribute_t **attributes,
- char **metadata, papi_attribute_t ***used)
-{
- if ((svc == NULL) || (metadata == NULL))
- return (PAPI_BAD_REQUEST);
-
- lpd_add_rfc1179_attributes(svc, attributes, metadata, used);
-
- /* add protocol extensions if applicable */
- if (svc->uri->fragment != NULL) {
- if ((strcasecmp(svc->uri->fragment, "solaris") == 0) ||
- (strcasecmp(svc->uri->fragment, "svr4") == 0))
- lpd_add_svr4_attributes(svc, attributes, metadata,
- used);
- else if (strcasecmp(svc->uri->fragment, "hpux") == 0)
- lpd_add_hpux_attributes(svc, attributes, metadata,
- used);
- /*
- * others could be added here:
- * lprng, sco, aix, digital unix, xerox, ...
- */
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-lpd_job_add_files(service_t *svc, papi_attribute_t **attributes,
- char **files, char **metadata, papi_attribute_t ***used)
-{
- char *format = "text/plain";
- char rfc_fmt = 'l';
- int copies = 1;
- char host[BUFSIZ];
- int i;
-
- if ((svc == NULL) || (attributes == NULL) || (files == NULL) ||
- (metadata == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- papiAttributeListGetString(attributes, NULL, "document-format",
- &format);
- papiAttributeListAddString(used, PAPI_ATTR_EXCL,
- "document-format", format);
- if ((rfc_fmt = mime_type_to_rfc1179_type(format)) == '\0') {
- if ((svc->uri->fragment != NULL) &&
- ((strcasecmp(svc->uri->fragment, "solaris") == 0) ||
- (strcasecmp(svc->uri->fragment, "svr4") == 0)))
- add_svr4_control_line(metadata, 'T', format);
- rfc_fmt = 'l';
- }
-
- papiAttributeListGetInteger(attributes, NULL, "copies", &copies);
- if (copies < 1)
- copies = 1;
- papiAttributeListAddInteger(used, PAPI_ATTR_EXCL, "copies", copies);
-
- gethostname(host, sizeof (host));
-
- for (i = 0; files[i] != NULL; i++) {
- char name[BUFSIZ];
- struct stat statbuf;
- char key;
- int j;
-
- if ((strcmp("standard input", files[i]) != 0) &&
- (access(files[i], R_OK) < 0)) {
- detailed_error(svc, gettext("aborting request, %s: %s"),
- files[i], strerror(errno));
- return (PAPI_NOT_AUTHORIZED);
- }
- if (strcmp("standard input", files[i]) != 0) {
- if (stat(files[i], &statbuf) < 0) {
- detailed_error(svc,
- gettext("Cannot access file: %s: %s"),
- files[i], strerror(errno));
- return (PAPI_DOCUMENT_ACCESS_ERROR);
- }
- if (statbuf.st_size == 0) {
- detailed_error(svc,
- gettext("Zero byte (empty) file: %s"),
- files[i]);
- return (PAPI_BAD_ARGUMENT);
- }
- }
-
- if (i < 26)
- key = 'A' + i;
- else if (i < 52)
- key = 'a' + (i - 26);
- else if (i < 62)
- key = '0' + (i - 52);
- else {
- detailed_error(svc,
- gettext("too many files, truncated at 62"));
- return (PAPI_OK_SUBST);
- }
-
- snprintf(name, sizeof (name), "df%cXXX%s", key, host);
-
- for (j = 0; j < copies; j++)
- add_lpd_control_line(metadata, rfc_fmt, name);
- add_lpd_control_line(metadata, 'U', name);
- add_lpd_control_line(metadata, 'N', (char *)files[i]);
- }
-
- return (PAPI_OK);
-}
-
-papi_status_t
-lpd_submit_job(service_t *svc, char *metadata, papi_attribute_t ***attributes,
- int *ofd)
-{
- papi_status_t status = PAPI_INTERNAL_ERROR;
- int fd;
- char path[32];
- char *list[2];
-
- if ((svc == NULL) || (metadata == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- strcpy(path, "/tmp/lpd-job-XXXXXX");
- fd = mkstemp(path);
- write(fd, metadata, strlen(metadata));
- close(fd);
-
- list[0] = path;
- list[1] = NULL;
-
- if (((fd = lpd_open(svc, 's', list, 15)) < 0) && (errno != EBADMSG)) {
- switch (errno) {
- case ENOSPC:
- status = PAPI_TEMPORARY_ERROR;
- break;
- case EIO:
- status = PAPI_TEMPORARY_ERROR;
- break;
- case ECONNREFUSED:
- status = PAPI_SERVICE_UNAVAILABLE;
- break;
- case ENOENT:
- status = PAPI_NOT_ACCEPTING;
- break;
- case EBADMSG:
- case EBADF:
- status = PAPI_OK;
- break;
- default:
- status = PAPI_TIMEOUT;
- break;
- }
- } else
- status = PAPI_OK;
-
- if (ofd != NULL)
- *ofd = fd;
- else
- close(fd);
-
- /* read the ID and add it to to the job */
- if ((fd = open(path, O_RDONLY)) >= 0) {
- int job_id = 0;
- read(fd, &job_id, sizeof (job_id));
- papiAttributeListAddInteger(attributes, PAPI_ATTR_REPLACE,
- "job-id", job_id);
- close(fd);
- }
-
- unlink(path);
-
- return (status);
-}
diff --git a/usr/src/lib/print/libpapi-lpd/common/lpd-misc.c b/usr/src/lib/print/libpapi-lpd/common/lpd-misc.c
deleted file mode 100644
index 1dc9589d25..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/lpd-misc.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lpd-misc.c 155 2006-04-26 02:34:54Z ktou $ */
-
-#define __EXTENSIONS__ /* for strtok_r() */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <wait.h>
-#include <stropts.h>
-#include <papi_impl.h>
-
-#include <config-site.h>
-
-char *
-fdgets(char *buf, size_t len, int fd)
-{
- char tmp;
- int count = 0;
-
- memset(buf, 0, len);
- while ((count < len) && (read(fd, &tmp, 1) > 0))
- if ((buf[count++] = tmp) == '\n') break;
-
- if (count != 0)
- return (buf);
- return (NULL);
-}
-
-char *
-queue_name_from_uri(uri_t *uri)
-{
- char *result = NULL;
-
- if ((uri != NULL) && (uri->path != NULL)) {
- char *ptr = strrchr(uri->path, '/');
-
- if (ptr == NULL)
- result = uri->path;
- else
- result = ++ptr;
- }
-
- return (result);
-}
-
-static int
-recvfd(int sockfd)
-{
- int fd = -1;
-#if defined(sun) && defined(unix) && defined(I_RECVFD)
- struct strrecvfd recv_fd;
-
- memset(&recv_fd, NULL, sizeof (recv_fd));
- if (ioctl(sockfd, I_RECVFD, &recv_fd) == 0)
- fd = recv_fd.fd;
-#else
- struct iovec iov[1];
- struct msghdr msg;
-
-#ifdef CMSG_DATA
- struct cmsghdr cmp[1];
- char buf[24]; /* send/recv 2 byte protocol */
-
- memset(buf, 0, sizeof (buf));
-
- iov[0].iov_base = buf;
- iov[0].iov_len = sizeof (buf);
-
- msg.msg_control = cmp;
- msg.msg_controllen = sizeof (struct cmsghdr) + sizeof (int);
-#else
- iov[0].iov_base = NULL;
- iov[0].iov_len = 0;
- msg.msg_accrights = (caddr_t)&fd;
- msg.msg_accrights = sizeof (fd);
-#endif
- msg.msg_iov = iov;
- msg.msg_iovlen = 1;
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
-
- if (recvmsg(sockfd, &msg, 0) < 0)
- fd = -1;
-#ifdef CMSG_DATA
- else
- fd = * (int *)CMSG_DATA(cmp);
-#endif
-#endif
- return (fd);
-}
-
-int
-lpd_open(service_t *svc, char type, char **args, int timeout)
-{
- int ac, rc = -1, fds[2];
- pid_t pid;
- char *av[64], *tmp, buf[BUFSIZ];
-
- if ((svc == NULL) || (svc->uri == NULL))
- return (-1);
-
-#ifndef SUID_LPD_PORT
-#define SUID_LPD_PORT "/usr/lib/print/lpd-port"
-#endif
-
- av[0] = SUID_LPD_PORT; ac = 1;
-
- /* server */
- av[ac++] = "-H";
- av[ac++] = svc->uri->host;
-
- /* timeout */
- if (timeout > 0) {
- snprintf(buf, sizeof (buf), "%d", timeout);
- av[ac++] = "-t";
- av[ac++] = strdup(buf);
- }
-
- /* operation */
- snprintf(buf, sizeof (buf), "-%c", type);
- av[ac++] = buf;
-
- /* queue */
- if (svc->uri->path == NULL) {
- tmp = "";
- } else {
- if ((tmp = strrchr(svc->uri->path, '/')) == NULL)
- tmp = svc->uri->path;
- else
- tmp++;
- }
- av[ac++] = tmp;
-
- /* args */
- if (args != NULL)
- while ((*args != NULL) && (ac < 62))
- av[ac++] = *args++;
-
- av[ac++] = NULL;
-
-#if defined(sun) && defined(unix) && defined(I_RECVFD)
- pipe(fds);
-#else
- socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
-#endif
-
- switch (pid = fork()) {
- case -1: /* failed */
- break;
- case 0: /* child */
- dup2(fds[1], 1);
- execv(av[0], &av[0]);
- perror("exec");
- exit(1);
- break;
- default: { /* parent */
- int err, status = 0;
-
- while ((waitpid(pid, &status, 0) < 0) && (errno == EINTR));
- errno = WEXITSTATUS(status);
-
- if (errno == 0)
- rc = recvfd(fds[0]);
-
- err = errno;
- close(fds[0]);
- close(fds[1]);
- errno = err;
- }
- }
-
- return (rc);
-}
diff --git a/usr/src/lib/print/libpapi-lpd/common/lpd-port.c b/usr/src/lib/print/libpapi-lpd/common/lpd-port.c
deleted file mode 100644
index 5c6c2e3ff8..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/lpd-port.c
+++ /dev/null
@@ -1,823 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: lpd-port.c 155 2006-04-26 02:34:54Z ktou $ */
-
-#include <config-site.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <errno.h>
-#include <syslog.h>
-#include <values.h>
-#include <stropts.h> /* for sendfd */
-#include <sys/uio.h> /* for sendmsg stuff */
-#include <pwd.h>
-#include <sys/sendfile.h>
-#include <ctype.h>
-#ifdef HAVE_PRIV_H
-#include <priv.h>
-#endif
-
-#ifndef JOB_ID_FILE
-#define JOB_ID_FILE "/var/run/rfc-1179.seq"
-#endif /* JOB_ID_FILE */
-
-static int
-sendfd(int sockfd, int fd)
-{
- syslog(LOG_DEBUG, "sendfd(%d, %d)", sockfd, fd);
-
-#if defined(sun) && defined(unix) && defined(I_SENDFD)
- return (ioctl(sockfd, I_SENDFD, fd));
-#else
- struct iovec iov[1];
- struct msghdr msg;
-#ifdef CMSG_DATA
- struct cmsghdr cmp[1];
- char buf[2]; /* send/recv 2 byte protocol */
-
- iov[0].iov_base = buf;
- iov[0].iov_len = 2;
-
- cmp[0].cmsg_level = SOL_SOCKET;
- cmp[0].cmsg_type = SCM_RIGHTS;
- cmp[0].cmsg_len = sizeof (struct cmsghdr) + sizeof (int);
- * (int *)CMSG_DATA(cmp) = fd;
-
- buf[1] = 0;
- buf[0] = 0;
- msg.msg_control = cmp;
- msg.msg_controllen = sizeof (struct cmsghdr) + sizeof (int);
-#else
- iov[0].iov_base = NULL;
- iov[0].iov_len = 0;
- msg.msg_accrights = (caddr_t)&fd;
- msg.msg_accrights = sizeof (fd);
-#endif
- msg.msg_iov = iov;
- msg.msg_iovlen = 1;
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
-
- return (sendmsg(sockfd, &msg, 0));
-#endif
-}
-
-static void
-null(int i)
-{
-}
-
-static int
-sock_connect(int sock, char *host, int timeout)
-{
- struct hostent *hp;
- struct servent *sp;
-#if defined(HAVE_GETIPNODEBYNAME) && defined(HAVE_RRESVPORT_AF)
- struct sockaddr_in6 sin;
-#else
- struct sockaddr_in sin;
-#endif
- static void (*old_handler)();
- int err, error_num;
- unsigned timo = 1;
-
- /*
- * Get the host address and port number to connect to.
- */
- if (host == NULL) {
- return (-1);
- }
-
- /* linux style NULL usage */
- (void) memset((char *)&sin, (int)NULL, sizeof (sin));
-
-#if defined(HAVE_GETIPNODEBYNAME) && defined(HAVE_RRESVPORT_AF)
- if ((hp = getipnodebyname(host, AF_INET6, AI_DEFAULT,
- &error_num)) == NULL) {
- errno = ENOENT;
- return (-1);
- }
- (void) memcpy((caddr_t)&sin.sin6_addr, hp->h_addr, hp->h_length);
- sin.sin6_family = hp->h_addrtype;
-#else
- if ((hp = gethostbyname(host)) == NULL) {
- errno = ENOENT;
- return (-1);
- }
-
- (void) memcpy((caddr_t)&sin.sin_addr, hp->h_addr, hp->h_length);
- sin.sin_family = hp->h_addrtype;
-#endif
-
- if ((sp = getservbyname("printer", "tcp")) == NULL) {
- errno = ENOENT;
- return (-1);
- }
-
-#if defined(HAVE_GETIPNODEBYNAME) && defined(HAVE_RRESVPORT_AF)
- sin.sin6_port = sp->s_port;
-#else
- sin.sin_port = sp->s_port;
-#endif
-
-retry:
- old_handler = signal(SIGALRM, null);
- (void) alarm(timeout);
-
- if (connect(sock, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
- (void) alarm(0);
- (void) signal(SIGALRM, old_handler);
-
- if (errno == ECONNREFUSED && timo <= 16) {
- (void) sleep(timo);
- timo *= 2;
- goto retry;
- }
-
- return (-1);
- }
-
- (void) alarm(0);
- (void) signal(SIGALRM, old_handler);
- return (sock);
-}
-
-static int
-next_job_id()
-{
- int fd, result = getpid() % 1000;
-
- /* gain back enough privilege to open the id file */
-#ifdef PRIV_ALLSETS
- if ((priv_set(PRIV_ON, PRIV_EFFECTIVE,
- PRIV_FILE_DAC_READ, PRIV_FILE_DAC_WRITE, NULL)) < 0) {
- syslog(LOG_ERR, "lpd_port:next_job_id:priv_set fails: : %m");
- return (-1);
- }
-#else
- seteuid(0);
-#endif
-
- /* open the sequence file */
- if (((fd = open(JOB_ID_FILE, O_RDWR)) < 0) && (errno == ENOENT))
- fd = open(JOB_ID_FILE, O_CREAT|O_EXCL|O_RDWR, 0644);
-
- syslog(LOG_DEBUG, "sequence file fd: %d", fd);
-
- /* drop our privilege again */
-#ifdef PRIV_ALLSETS
- /* drop file access privilege */
- priv_set(PRIV_OFF, PRIV_PERMITTED,
- PRIV_FILE_DAC_READ, PRIV_FILE_DAC_WRITE, NULL);
-#else
- seteuid(getuid());
-#endif
-
- if (fd >= 0) {
- /* wait for a lock on the file */
- if (lockf(fd, F_LOCK, 0) == 0) {
- char buf[8];
- int next;
-
- /* get the current id */
- (void) memset(buf, 0, sizeof (buf));
- if (read(fd, buf, sizeof (buf)) > 0)
- result = atoi(buf);
-
- next = ((result < 999) ? (result + 1) : 0);
-
- /* store the next id in the file */
- snprintf(buf, sizeof (buf), "%.3d", next);
- if ((lseek(fd, 0, SEEK_SET) == 0) &&
- (ftruncate(fd, 0) == 0))
- write(fd, buf, strlen(buf));
- }
- close(fd);
- }
- syslog(LOG_DEBUG, "next_job_id() is %d", result);
-
- return (result);
-}
-
-static int
-reserved_port()
-{
- int result = -1;
- int port;
-
- /* gain back enough privilege to open a reserved port */
-#ifdef PRIV_ALLSETS
- if ((priv_set(
- PRIV_ON, PRIV_EFFECTIVE, PRIV_NET_PRIVADDR, NULL)) != 0) {
- syslog(LOG_ERR, "priv_set fails for net_privaddr %m");
- return (-1);
- }
-#else
- seteuid(0);
-#endif
-
-#if defined(HAVE_GETIPNODEBYNAME) && defined(HAVE_RRESVPORT_AF)
- port = 0; /* set to 0, rresvport_af() will find us one. */
- result = rresvport_af(&port, AF_INET6);
-#else
- port = IPPORT_RESERVED - 1;
- while (((result = rresvport(&port)) < 0) && (port >= 0))
- port--;
-#endif
-
- /* drop our privilege again */
-#ifdef PRIV_ALLSETS
- priv_set(PRIV_OFF, PRIV_PERMITTED, PRIV_NET_PRIVADDR, NULL);
-#else
- seteuid(getuid());
-#endif
-
- return (result);
-}
-
-static char *
-get_user_name()
-{
- static struct passwd *p = NULL;
-
- if ((p = getpwuid(getuid())) != NULL)
- return (p->pw_name);
- else
- return ("unknown");
-}
-
-static void
-add_args(int ac, char **av, char *buf, size_t len)
-{
- while (ac--) {
- strlcat(buf, " ", len);
- strlcat(buf, *(av++), len);
- }
-}
-
-static int
-massage_control_data(char *data, int id)
-{
- char *line, *iter = NULL;
- char *ptr, *mod_ptr, *datacpy;
- char host[BUFSIZ];
- int host_present = 0;
-
- if (gethostname(host, sizeof (host)) != 0)
- return (-1);
-
- if ((datacpy = strdup(data)) == NULL) {
- return (-1);
- }
-
- for (ptr = strtok_r(datacpy, "\n", &iter); ptr != NULL;
- ptr = strtok_r(NULL, "\n", &iter)) {
-
- if (ptr[0] == 'H') {
- if (strncmp(++ptr, host, strlen(host)) != 0) {
- free(datacpy);
- return (-1);
- }
- host_present = 1;
- } else if ((ptr[0] == 'P') || (ptr[0] == 'L')) {
- /* check the user name */
- uid_t uid = getuid();
- struct passwd *pw;
- int len;
-
- if (uid == 0) { /* let root do what they want */
- continue;
- }
- if ((pw = getpwuid(uid)) == NULL) {
- free(datacpy);
- return (-1); /* failed */
- }
- len = strlen(pw->pw_name);
- if ((strncmp(++ptr, pw->pw_name, len) != 0)) {
- free(datacpy);
- return (-1); /* failed */
- }
- } else if ((islower(ptr[0]) != 0) || (ptr[0] == 'U')) {
- /* check/fix df?XXXhostname */
- ptr++;
-
- if (strlen(ptr) < 6) {
- free(datacpy);
- return (-1);
- }
-
- /*
- * As ptr is a copy of the string (df?XXX...) the code
- * needs to work on the original, hence the need for
- * mod_ptr. No need to check for a NULL mod_ptr
- * because the required string must already exist as
- * ptr is a copy of the original data.
- */
-
- mod_ptr = strstr(data, ptr);
-
- if ((mod_ptr[0] == 'd') && (mod_ptr[1] == 'f') &&
- (mod_ptr[3] == 'X') && (mod_ptr[4] == 'X') &&
- (mod_ptr[5] == 'X')) {
- mod_ptr[3] = '0' + (id / 100) % 10;
- mod_ptr[4] = '0' + (id / 10) % 10;
- mod_ptr[5] = '0' + id % 10;
-
- if (strncmp(&mod_ptr[6], host, strlen(host))
- != 0) {
- free(datacpy);
- return (-1);
- }
- } else {
- free(datacpy);
- return (-1);
- }
- }
-
- }
- free(datacpy);
-
- if (!host_present) {
- return (-1);
- }
-
- return (1);
-}
-
-static int
-send_lpd_message(int fd, char *fmt, ...)
-{
- char buf[BUFSIZ];
- size_t size;
- va_list ap;
-
- va_start(ap, fmt);
- size = vsnprintf(buf, sizeof (buf), fmt, ap);
- va_end(ap);
- if (size == 0)
- size = 1;
-
- syslog(LOG_DEBUG, "lpd_messsage(%d, %s)", fd, buf);
-
- if (write(fd, buf, size) != size) {
- errno = EIO;
- return (-1);
- }
-
- if ((read(fd, buf, 1) != 1) || (buf[0] != 0))
- return (-1);
-
- return (0);
-}
-
-static int
-send_data_file(int sock, char *dfname, char *name)
-{
- size_t len;
- off_t off = 0;
- struct stat st;
- char buf[32];
- int fd = -1;
-
- if (strcmp(name, "standard input") != 0) {
- if ((fd = open(name, O_RDONLY)) < 0)
- return (-1);
-
- if (fstat(fd, &st) < 0)
- return (-1);
- } else
- st.st_size = MAXINT; /* should be 0 */
-
- /* request data file transfer, read ack/nack */
- errno = ENOSPC;
- if (send_lpd_message(sock, "\003%d %s\n", st.st_size, dfname) < 0)
- return (-1);
-
- if (fd != -1) {
- /* write the data */
- if (sendfile(sock, fd, &off, st.st_size) != st.st_size)
- return (-1);
- close(fd);
-
- /* request ack/nack after the data transfer */
- errno = EIO;
- if (send_lpd_message(sock, "") < 0)
- return (-1);
- }
-
- return (0);
-}
-
-static int
-send_control_file(int sock, char *data, int id)
-{
- int len;
- char buf[BUFSIZ];
- char *ptr, *iter = NULL;
- char *datacpy = NULL;
- char *host = NULL;
-
- len = strlen(data);
-
- if ((datacpy = strdup(data)) == NULL)
- return (-1);
-
- syslog(LOG_DEBUG, "cfA: %s\n", datacpy);
-
- for (ptr = strtok_r(datacpy, "\n", &iter); ptr != NULL;
- ptr = strtok_r(NULL, "\n", &iter)) {
-
- if (ptr[0] != 'H')
- continue;
-
- ptr++;
- host = ptr;
- syslog(LOG_DEBUG, "hostname: %s\n", host);
- }
-
- free(datacpy);
-
- /* request data file transfer, read ack/nack */
- errno = ENOSPC;
- if (send_lpd_message(sock, "\002%d cfA%.3d%s\n", len, id, host) < 0)
- return (-1);
-
- /* write the data */
- if (write(sock, data, len) != len)
- return (-1);
-
- /* request ack/nack after the data transfer */
- errno = EIO;
- if (send_lpd_message(sock, "") < 0)
- return (-1);
-
- return (0);
-}
-
-
-static int
-submit_job(int sock, char *printer, int job_id, char *path)
-{
- struct stat st;
- int current = 0;
- off_t off = 0;
- char *metadata = NULL;
- char *ptr, *iter = NULL;
- int fd, err;
- int sent_files = 0;
- char buf[BUFSIZ];
- size_t len;
-
- /* open the control file */
- if ((fd = open(path, O_RDONLY)) < 0) {
- syslog(LOG_ERR, "submit_job(%d, %s, %d, %s): open(): %m",
- sock, printer, job_id, path);
- return (-1);
- }
-
- /* get the size of the control file */
- if (fstat(fd, &st) < 0) {
- syslog(LOG_ERR, "submit_job(%d, %s, %d, %s): fstat(): %m",
- sock, printer, job_id, path);
- close(fd);
- return (-1);
- }
-
- /* allocate memory for the control file */
- if ((metadata = calloc(1, st.st_size + 1)) == NULL) {
- syslog(LOG_ERR, "submit_job(%d, %s, %d, %s): calloc(): %m",
- sock, printer, job_id, path);
- close(fd);
- return (-1);
- }
-
- /* read in the control file */
- if (read(fd, metadata, st.st_size) != st.st_size) {
- syslog(LOG_ERR, "submit_job(%d, %s, %d, %s): read(): %m",
- sock, printer, job_id, path);
- free(metadata);
- close(fd);
- return (-1);
- }
-
- /* massage the control file */
- if (massage_control_data(metadata, job_id) < 0) {
- /* bad control data, dump the job */
- syslog(LOG_ALERT,
- "bad control file, possible subversion attempt");
- free(metadata);
- errno = EINVAL;
- close(fd);
- return (-1);
- }
-
- /* request to transfer the job */
- if (send_lpd_message(sock, "\002%s\n", printer) < 0) {
- /* no such (or disabled) queue, got to love rfc-1179 */
- errno = ENOENT;
- return (-1);
- }
-
- /* send the control data */
- if (send_control_file(sock, metadata, job_id) < 0) {
- err = errno;
- write(sock, "\001\n", 2); /* abort */
- errno = err;
- return (-1);
- }
-
- /* walk the control file sending the data files */
- for (ptr = strtok_r(metadata, "\n", &iter); ptr != NULL;
- ptr = strtok_r(NULL, "\n", &iter)) {
- char *name = NULL;
-
- if (ptr[0] != 'U')
- continue;
-
- name = strtok_r(NULL, "\n", &iter);
- if (name[0] != 'N')
- continue;
-
- ptr++;
- name++;
-
- if (send_data_file(sock, ptr, name) < 0) {
- err = errno;
- write(sock, "\001\n", 2); /* abort */
- errno = err;
- return (-1);
- }
- if (strcmp(name, "standard input") != 0)
- sent_files++;
- }
-
- /* write back the job-id */
- err = errno;
- if ((fd = open(path, O_WRONLY)) >= 0) {
- ftruncate(fd, 0);
- write(fd, &job_id, sizeof (job_id));
- close(fd);
- }
- errno = err;
-
- if (sent_files != 0) {
- err = errno;
- close(sock);
- errno = err;
- }
-
- return (0);
-}
-static int
-query(int fd, char *printer, int ac, char **av)
-{
- char buf[BUFSIZ];
- int rc, len;
-
- /* build the request */
- snprintf(buf, sizeof (buf), "\04%s", printer);
- add_args(ac, av, buf, sizeof (buf));
- strlcat(buf, "\n", sizeof (buf));
- len = strlen(buf);
-
- if (((rc = write(fd, buf, len)) >= 0) && (rc != len)) {
- errno = EMSGSIZE;
- rc = -1;
- } else
- rc = 0;
-
- return (rc);
-}
-
-static int
-cancel(int fd, char *printer, int ac, char **av)
-{
- char buf[BUFSIZ];
- int rc, len;
-
- /* build the request */
- snprintf(buf, sizeof (buf), "\05%s %s", printer, get_user_name());
- add_args(ac, av, buf, sizeof (buf));
- strlcat(buf, "\n", sizeof (buf));
- len = strlen(buf);
-
- if (((rc = write(fd, buf, len)) >= 0) && (rc != len)) {
- errno = EMSGSIZE;
- rc = -1;
- } else
- rc = 0;
-
- return (rc);
-}
-
-static void
-usage(char *program)
-{
- char *name;
-
- setreuid(getuid(), getuid());
-
- if ((name = strrchr(program, '/')) == NULL)
- name = program;
- else
- name++;
-
- fprintf(stderr, "usage:\t%s -H host [-t timeout] -s queue control ]\n",
- name);
- fprintf(stderr, "\t%s -H host [-t timeout] -c queue [user|job ...]\n",
- name);
- fprintf(stderr, "\t%s -H host [-t timeout] -q queue [user|job ...]\n",
- name);
- exit(EINVAL);
-}
-
-/*
- * The main program temporarily loses privilege while searching the command
- * line arguments. It then allocates any resources it need privilege for
- * job-id, reserved port. Once it has the resources it needs, it perminently
- * drops all elevated privilege. It ghen connects to the remote print service
- * based on destination hostname. Doing it this way reduces the potenential
- * opportunity for a breakout with elevated privilege, breakout with an
- * unconnected reserved port, and exploitation of the remote print service
- * by a calling program.
- */
-int
-main(int ac, char *av[])
-{
- enum { OP_NONE, OP_SUBMIT, OP_QUERY, OP_CANCEL } operation = OP_NONE;
- int fd, c, timeout = 0, exit_code = 0;
- char *host = NULL, *queue = NULL;
- uid_t uid = getuid();
-#ifdef PRIV_ALLSETS
- priv_set_t *saveset;
-#endif
-
- openlog("lpd-port", LOG_PID, LOG_LPR);
-
-#ifdef PRIV_ALLSETS
-
- /* lose as much as we can perminently and temporarily drop the rest. */
-
- if ((saveset = priv_allocset()) == NULL) {
- syslog(LOG_ERR, "lpd_port: priv_allocset saveset failed: %m\n");
- return (-1);
- }
-
- priv_basicset(saveset);
- (void) priv_addset(saveset, PRIV_NET_PRIVADDR);
- (void) priv_addset(saveset, PRIV_FILE_DAC_READ);
- (void) priv_addset(saveset, PRIV_FILE_DAC_WRITE);
-
- if ((setppriv(PRIV_SET, PRIV_PERMITTED, saveset)) < 0) {
- syslog(LOG_ERR, "lpd_port:setppriv:priv_set failed: %m");
- return (-1);
- }
-
- priv_freeset(saveset);
-
- /*
- * These privileges permanently dropped in next_job_id() and
- * reserved_port()
- */
-
- if (priv_set(PRIV_OFF, PRIV_EFFECTIVE, PRIV_NET_PRIVADDR,
- PRIV_FILE_DAC_READ, PRIV_FILE_DAC_WRITE, (char *)NULL) < 0) {
- syslog(LOG_ERR, "lpd_port:priv_set:priv_off failed: %m");
- return (-1);
- }
-
- syslog(LOG_DEBUG, "using privs");
-#else
-
- syslog(LOG_DEBUG, "no privs");
- seteuid(uid);
-#endif
-
- while ((c = getopt(ac, av, "H:t:c:q:s:")) != EOF) {
- switch (c) {
- case 'H':
- host = optarg;
- break;
- case 't':
- timeout = atoi(optarg);
- break;
- case 'c':
- if (operation != OP_NONE)
- usage(av[0]);
- operation = OP_CANCEL;
- queue = optarg;
- break;
- case 'q':
- if (operation != OP_NONE)
- usage(av[0]);
- operation = OP_QUERY;
- queue = optarg;
- break;
- case 's':
- if (operation != OP_NONE)
- usage(av[0]);
- operation = OP_SUBMIT;
- queue = optarg;
- break;
- default:
- usage(av[0]);
- /* does not return */
- }
- }
-
- if ((host == NULL) || (queue == NULL) || (timeout < 0) ||
- (operation == OP_NONE))
- usage(av[0]);
-
- if (operation == OP_SUBMIT) /* get a job-id if we need it */
- if ((c = next_job_id()) < 0) {
- syslog(LOG_ERR, "lpd_port:main:next_job_id fails");
- return (-1);
- }
-
- if ((fd = reserved_port()) < 0) {
- syslog(LOG_ERR, "reserved_port() failed %m");
- return (errno);
- }
-
- /*
- * we no longer want or need any elevated privilege, lose it all
- * permanently.
- */
-
- setreuid(uid, uid);
-
- /* connect to the print service */
- if ((fd = sock_connect(fd, host, timeout)) < 0)
- return (errno);
-
- /* perform the requested operation */
- switch (operation) {
- case OP_SUBMIT: /* transfer the job, close the fd */
- if (submit_job(fd, queue, c, av[optind]) < 0)
- exit_code = errno;
- break;
- case OP_QUERY: /* send the query string, return the fd */
- if (query(fd, queue, ac - optind, &av[optind]) < 0)
- exit_code = errno;
- break;
- case OP_CANCEL: /* send the cancel string, return the fd */
- if (cancel(fd, queue, ac - optind, &av[optind]) < 0)
- exit_code = errno;
- break;
- default: /* This should never happen */
- exit_code = EINVAL;
- }
-
-
- /* if the operation succeeded, send the fd to our parent */
- if ((exit_code == 0) && (sendfd(1, fd) < 0)) {
- char buf[BUFSIZ];
-
- exit_code = errno;
-
- /* sendfd() failed, dump the socket data for the heck of it */
- while ((c = read(fd, buf, sizeof (buf))) > 0)
- write(1, buf, c);
- }
-
- syslog(LOG_DEBUG, "exit code: %d", exit_code);
- return (exit_code);
-}
diff --git a/usr/src/lib/print/libpapi-lpd/common/lpd-query.c b/usr/src/lib/print/libpapi-lpd/common/lpd-query.c
deleted file mode 100644
index 964023c919..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/lpd-query.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-/* $Id: lpd-query.c 155 2006-04-26 02:34:54Z ktou $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <time.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdarg.h>
-#include <regex.h>
-
-#include <papi_impl.h>
-
-/* The string is modified by this call */
-static char *
-regvalue(regmatch_t match, char *string)
-{
- char *result = NULL;
-
- if (match.rm_so != match.rm_eo) {
- result = string + match.rm_so;
- *(result + (match.rm_eo - match.rm_so)) = '\0';
- }
-
- return (result);
-}
-
-/*
- * Print job entries start with:
- * (user): (rank) [job (number) (...)]
- * (user) is the job-owner's user name
- * (rank) is the rank in queue. (active, 1st, 2nd, ...)
- * (number) is the job number
- * (...) is an optional hostname
- * some servers will use whitespace a little differently than is displayed
- * above. The regular expression below makes whitespace optional in some
- * places.
- */
-static char *job_expr = "^(.*[[:alnum:]]):[[:space:]]+([[:alnum:]]+)"\
- "[[:space:]]+[[][[:space:]]*job[[:space:]]*([[:digit:]]+)"\
- "[[:space:]]*(.*)]";
-static regex_t job_re;
-
-/*
- * Print job entries for remote windows printer start with:
- * Owner Status Jobname Job-Id Size Pages Priority
- * e.g:
- * Owner Status Jobname Job-Id Size Pages Priority
- * ------------------------------------------------------------
- * root (10.3. Waiting /etc/release 2 240 1 4
- *
- * Owner is the job-owner's user name
- * Status is the job-status (printing, waiting, error)
- * Jobname is the name of the job to be printed
- * Job-Id is the id of the job queued to be printed
- * Size is the size of the job in bytes
- * Pages is the number of pages of the job
- * Priority is the job-priority
- */
-static char *wjob_expr = "^([[:alnum:]]+)[[:space:]]*[(](.*)[)]*[[:space:]]"\
- "+([[:alnum:]]+)[[:space:]]+(.*)([[:alnum:]]+)(.*)[[:space:]]+"\
- "([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:digit:]]+)"\
- "[[:space:]]+([[:digit:]]+)";
-static regex_t wjob_re;
-
-/*
- * Windows job header is in the following format
- * Owner Status Jobname Job-Id Size Pages Priority
- * --------------------------------------------------------------
- */
-static char *whjob_expr = "Owner Status Jobname Job-Id"\
- " Size Pages Priority";
-static regex_t whjob_re;
-
-static char *wline_expr = "----------";
-static regex_t wline_re;
-
-/*
- * status line(s) for "processing" printers will contain one of the following:
- * ready and printing
- * Printing
- * processing
- */
-static char *proc_expr = "(ready and printing|printing|processing)";
-static regex_t proc_re;
-
-/*
- * status line(s) for "idle" printers will contain one of the following:
- * no entries
- * (printer) is ready
- * idle
- */
-static char *idle_expr = "(no entries|is ready| idle)";
-static regex_t idle_re;
-
-/*
- * Printer state reason (For Windows remote printers)
- * Paused
- */
-static char *state_reason_expr = "(Paused)";
-static regex_t state_reason_re;
-
-/*
- * document line(s)
- * (copies) copies of (name) (size) bytes
- * (name) (size) bytes
- * document lines can be in either format above.
- * (copies) is the number of copies of the document to print
- * (name) is the name of the document: /etc/motd, ...
- * (size) is the number of bytes in the document data
- */
-static char *doc1_expr = "[[:space:]]+(([[:digit:]]+) copies of )"\
- "([^[:space:]]+)[[:space:]]*([[:digit:]]+) bytes";
-static char *doc2_expr = "[[:space:]]+()([^[:space:]]+)[[:space:]]*"\
- "([[:digit:]]+) bytes";
-static regex_t doc1_re;
-static regex_t doc2_re;
-
-/* Printer-state for Windows */
-static int win_state = 0x03; /* Idle */
-
-static void
-parse_lpd_job(service_t *svc, job_t **job, int fd, char *line, int len)
-{
- papi_attribute_t **attributes = NULL;
- regmatch_t matches[10];
- char *s;
- int octets = 0;
- int flag = 0;
-
- /*
- * job_re and wjob_re were compiled in the calling function
- * first check for solaris jobs
- * if there is no-match check for windows jobs
- */
-
- if (regexec(&job_re, line, (size_t)5, matches, 0) == REG_NOMATCH) {
- if (regexec(&wjob_re, line, (size_t)10, matches, 0)
- == REG_NOMATCH)
- return;
- else
- flag = 1;
- }
-
- if (flag == 1) {
- /* Windows job */
- /* first match is job-id */
-
- if ((s = regvalue(matches[1], line)) == NULL)
- s = "nobody";
- papiAttributeListAddString(&attributes, PAPI_ATTR_REPLACE,
- "job-originating-user-name", s);
-
- if ((s = regvalue(matches[4], line)) == NULL)
- s = "unknown";
- papiAttributeListAddString(&attributes, PAPI_ATTR_APPEND,
- "job-name", s);
- papiAttributeListAddString(&attributes, PAPI_ATTR_APPEND,
- "job-file-names", s);
-
- if ((s = regvalue(matches[7], line)) == NULL)
- s = "0";
- papiAttributeListAddInteger(&attributes, PAPI_ATTR_REPLACE,
- "job-id", atoi(s));
-
- if ((s = regvalue(matches[8], line)) == NULL)
- s = "0";
- octets = atoi(s);
- papiAttributeListAddInteger(&attributes,
- PAPI_ATTR_APPEND, "job-file-sizes", atoi(s));
-
- /*
- * Since a job has been found so the printer state is either
- * 'stopped' or 'processing'
- * By default it is "processing"
- */
- win_state = 0x04;
- } else {
- /* Solaris job */
- if ((s = regvalue(matches[1], line)) == NULL)
- s = "nobody";
- papiAttributeListAddString(&attributes, PAPI_ATTR_REPLACE,
- "job-originating-user-name", s);
-
- if ((s = regvalue(matches[2], line)) == NULL)
- s = "0";
- papiAttributeListAddInteger(&attributes, PAPI_ATTR_REPLACE,
- "number-of-intervening-jobs", atoi(s) - 1);
-
- if ((s = regvalue(matches[3], line)) == NULL)
- s = "0";
- papiAttributeListAddInteger(&attributes, PAPI_ATTR_REPLACE,
- "job-id", atoi(s));
-
- if ((s = regvalue(matches[4], line)) == NULL)
- s = svc->uri->host;
- papiAttributeListAddString(&attributes, PAPI_ATTR_REPLACE,
- "job-originating-host-name", s);
- }
-
- while ((fdgets(line, len, fd) != NULL) &&
- (regexec(&job_re, line, (size_t)0, NULL, 0) == REG_NOMATCH) &&
- (regexec(&wjob_re, line, (size_t)0, NULL, 0) == REG_NOMATCH)) {
- int size = 0, copies = 1;
- /* process copies/documents */
-
- /* doc1_re and doc2_re were compiled in the calling function */
- if ((regexec(&doc1_re, line, (size_t)4, matches, 0) != 0) &&
- (regexec(&doc2_re, line, (size_t)4, matches, 0) != 0))
- continue;
-
- if ((s = regvalue(matches[1], line)) == NULL)
- s = "1";
- if ((copies = atoi(s)) < 1)
- copies = 1;
-
- if ((s = regvalue(matches[2], line)) == NULL)
- s = "unknown";
- papiAttributeListAddString(&attributes,
- PAPI_ATTR_APPEND, "job-name", s);
- papiAttributeListAddString(&attributes,
- PAPI_ATTR_APPEND, "job-file-names", s);
-
- if ((s = regvalue(matches[3], line)) == NULL)
- s = "0";
- size = atoi(s);
-
- papiAttributeListAddInteger(&attributes,
- PAPI_ATTR_APPEND, "job-file-sizes", size);
-
- octets += (size * copies);
- }
-
- papiAttributeListAddInteger(&attributes, PAPI_ATTR_APPEND,
- "job-k-octets", octets/1024);
- papiAttributeListAddInteger(&attributes, PAPI_ATTR_APPEND,
- "job-octets", octets);
- papiAttributeListAddString(&attributes, PAPI_ATTR_APPEND,
- "printer-name", queue_name_from_uri(svc->uri));
-
- if ((*job = (job_t *)calloc(1, sizeof (**job))) != NULL)
- (*job)->attributes = attributes;
-}
-
-void
-parse_lpd_query(service_t *svc, int fd)
-{
- papi_attribute_t **attributes = NULL;
- cache_t *cache = NULL;
- int state = 0x03; /* idle */
- char line[128];
- char status[1024];
- char *s;
- int win_flag = 0;
-
- papiAttributeListAddString(&attributes, PAPI_ATTR_APPEND,
- "printer-name", queue_name_from_uri(svc->uri));
-
- if (uri_to_string(svc->uri, status, sizeof (status)) == 0)
- papiAttributeListAddString(&attributes, PAPI_ATTR_APPEND,
- "printer-uri-supported", status);
-
- /*
- * on most systems, status is a single line, but some appear to
- * return multi-line status messages. To get the "best" possible
- * printer-state-reason, we accumulate the text until we hit the
- * first print job entry.
- *
- * Print job entries start with:
- * user: rank [job number ...]
- */
- (void) regcomp(&job_re, job_expr, REG_EXTENDED|REG_ICASE);
-
- /*
- * For remote windows printers
- * Print job entries start with:
- * Owner Status Jobname Job-Id Size Pages Priority
- */
- (void) regcomp(&wjob_re, wjob_expr, REG_EXTENDED|REG_ICASE);
- (void) regcomp(&whjob_re, whjob_expr, REG_EXTENDED|REG_ICASE);
- (void) regcomp(&wline_re, wline_expr, REG_EXTENDED|REG_ICASE);
-
- status[0] = '\0';
-
- while ((fdgets(line, sizeof (line), fd) != NULL) &&
- (regexec(&job_re, line, (size_t)0, NULL, 0) == REG_NOMATCH) &&
- (regexec(&wjob_re, line, (size_t)0, NULL, 0) == REG_NOMATCH)) {
- /*
- * When windows job queue gets queried following header
- * should not get printed
- * Owner Status Jobname Job-Id Size Pages Priority
- * -----------------------------------------------
- */
- if ((regexec(&whjob_re, line, (size_t)0, NULL, 0)
- == REG_NOMATCH) &&
- (regexec(&wline_re, line, (size_t)0, NULL, 0)
- == REG_NOMATCH))
- strlcat(status, line, sizeof (status));
- }
-
- /* chop off trailing whitespace */
- s = status + strlen(status) - 1;
- while ((s > status) && (isspace(*s) != 0))
- *s-- = '\0';
-
- papiAttributeListAddString(&attributes, PAPI_ATTR_REPLACE,
- "printer-state-reasons", status);
-
- /* Check if this is for Windows remote printers */
- if (strstr(status, "Windows")) {
- /*
- * It is a remote windows printer
- * By default set the status as idle
- * Set the printer-state after call to "parse_lpd_job"
- */
- win_flag = 1;
- (void) regcomp(&state_reason_re, state_reason_expr,
- REG_EXTENDED|REG_ICASE);
-
- if (regexec(&state_reason_re, status, (size_t)0, NULL, 0) == 0)
- state = 0x05; /* stopped */
- } else {
- (void) regcomp(&proc_re, proc_expr, REG_EXTENDED|REG_ICASE);
- (void) regcomp(&idle_re, idle_expr, REG_EXTENDED|REG_ICASE);
-
- if (regexec(&proc_re, status, (size_t)0, NULL, 0) == 0)
- state = 0x04; /* processing */
- else if (regexec(&idle_re, status, (size_t)0, NULL, 0) == 0)
- state = 0x03; /* idle */
- else
- state = 0x05; /* stopped */
- papiAttributeListAddInteger(&attributes, PAPI_ATTR_REPLACE,
- "printer-state", state);
- }
-
- if ((cache = (cache_t *)calloc(1, sizeof (*cache))) == NULL)
- return;
-
- if ((cache->printer = (printer_t *)calloc(1, sizeof (*cache->printer)))
- == NULL)
- return;
-
- cache->printer->attributes = attributes;
- svc->cache = cache;
-
- (void) regcomp(&doc1_re, doc1_expr, REG_EXTENDED|REG_ICASE);
- (void) regcomp(&doc2_re, doc2_expr, REG_EXTENDED|REG_ICASE);
- /* process job related entries */
- while (line[0] != '\0') {
- job_t *job = NULL;
-
- parse_lpd_job(svc, &job, fd, line, sizeof (line));
- if (job == NULL)
- break;
- list_append(&cache->jobs, job);
- }
-
- /*
- * For remote windows printer set the printer-state
- * after parse_lpd_job
- */
- if (win_flag) {
- if (state == 0x05)
- win_state = state;
-
- papiAttributeListAddInteger(&attributes, PAPI_ATTR_REPLACE,
- "printer-state", win_state);
- }
- time(&cache->timestamp);
-}
-
-void
-cache_update(service_t *svc)
-{
- int fd;
-
- if (svc == NULL)
- return;
-
- if (svc->cache != NULL) { /* this should be time based */
- if (svc->cache->jobs == NULL) {
- free(svc->cache);
- svc->cache = NULL;
- } else
- return;
- }
-
- if ((fd = lpd_open(svc, 'q', NULL, 15)) < 0)
- return;
-
- parse_lpd_query(svc, fd);
-
- close(fd);
-}
-
-papi_status_t
-lpd_find_printer_info(service_t *svc, printer_t **printer)
-{
- papi_status_t result = PAPI_BAD_ARGUMENT;
-
- if ((svc == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- cache_update(svc);
-
- if (svc->cache != NULL) {
- *printer = svc->cache->printer;
- result = PAPI_OK;
- } else
- result = PAPI_NOT_FOUND;
-
- return (result);
-}
-
-papi_status_t
-lpd_find_jobs_info(service_t *svc, job_t ***jobs)
-{
- papi_status_t result = PAPI_BAD_ARGUMENT;
-
- if (svc != NULL) {
- cache_update(svc);
-
- if (svc->cache != NULL) {
- *jobs = svc->cache->jobs;
- result = PAPI_OK;
- }
- }
-
- /*
- * cache jobs is free()-ed in
- * libpapi-dynamic/common/printer.c -
- * papiPrinterListJobs() cache printer is
- * free()-ed by the caller of
- * lpd_find_printer_info Invalidate the
- * cache by freeing the cache.
- */
- free(svc->cache);
- svc->cache = NULL;
-
- return (result);
-}
-
-papi_status_t
-lpd_find_job_info(service_t *svc, int job_id, job_t **job)
-{
- papi_status_t result = PAPI_BAD_ARGUMENT;
- job_t **jobs;
-
- if ((lpd_find_jobs_info(svc, &jobs) == PAPI_OK) && (jobs != NULL)) {
- int i;
-
- *job = NULL;
- for (i = 0; ((*job == NULL) && (jobs[i] != NULL)); i++) {
- int id = -1;
-
- papiAttributeListGetInteger(jobs[i]->attributes, NULL,
- "job-id", &id);
- if (id == job_id)
- *job = jobs[i];
- }
-
- if (*job != NULL)
- result = PAPI_OK;
- }
-
- return (result);
-}
-
-void
-cache_free(cache_t *item)
-{
- if (item != NULL) {
- if (item->printer != NULL)
- papiPrinterFree((papi_printer_t *)item->printer);
- if (item->jobs != NULL)
- papiJobListFree((papi_job_t *)item->jobs);
- free(item);
- }
-}
diff --git a/usr/src/lib/print/libpapi-lpd/common/mapfile b/usr/src/lib/print/libpapi-lpd/common/mapfile
deleted file mode 100644
index 2ad5020f15..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/mapfile
+++ /dev/null
@@ -1,322 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# $Id: mapfile.in,v 1.2 2006/03/02 06:31:36 njacobs Exp $
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-#
-# Common interfaces that are most likely to be shared amongst the various
-# PAPI implementations.
-#
-
-SYMBOL_VERSION SUNW_1.0 {
- global:
- # PAPI Attribute Calls
- papiAttributeListAddValue {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddBoolean {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddCollection {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddDatetime {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddInteger {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddMetadata {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddRange {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddResolution {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListAddString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListDelete {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetValue {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetNext {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFind {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetBoolean {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetCollection {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetDatetime {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetInteger {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetMetadata {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetRange {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetResolution {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListGetString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFromString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListToString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListFree {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- # PAPI Service Calls
- papiServiceCreate ;
- papiServiceDestroy ;
- papiServiceSetUserName ;
- papiServiceSetPassword ;
- papiServiceSetEncryption ;
- papiServiceSetAuthCB ;
- papiServiceSetAppData ;
- papiServiceGetUserName ;
- papiServiceGetPassword ;
- papiServiceGetEncryption ;
- papiServiceGetAppData ;
- papiServiceGetServiceName ;
- papiServiceGetAttributeList ;
- papiServiceGetStatusMessage ;
-
- # PAPI Printer Calls
- papiPrintersList {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiPrinterQuery ;
- papiPrinterAdd {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiPrinterModify {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiPrinterRemove {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiPrinterDisable ;
- papiPrinterEnable ;
- papiPrinterPause ;
- papiPrinterResume ;
- papiPrinterPurgeJobs ;
- papiPrinterListJobs ;
- papiPrinterGetAttributeList ;
- papiPrinterFree ;
- papiPrinterListFree ;
-
- # PAPI Job Calls
- papiJobSubmit ;
- papiJobSubmitByReference ;
- papiJobValidate {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobStreamOpen ;
- papiJobStreamWrite ;
- papiJobStreamClose ;
- papiJobQuery ;
- papiJobModify {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobMove {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobCancel ;
- papiJobHold {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobRelease {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobRestart {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobPromote {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobGetAttributeList ;
- papiJobGetPrinterName ;
- papiJobGetId ;
- papiJobGetJobTicket {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobFree ;
- papiJobListFree ;
-
- # Misc. PAPI Calls
- papiStatusString {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiLibrarySupportedCall ;
- papiLibrarySupportedCalls ;
-} ;
-
-SYMBOL_VERSION SUNWprivate_1.0 {
- global:
- papiServiceSetPeer {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobCreate {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobStreamAdd {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiJobCommit {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- # Misc. supporting calls
- # URI
- uri_from_string {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- uri_to_string {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- uri_free {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- # list
- list_remove {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- list_append {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- list_concatenate {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- # NS
- getprinterbyname {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- is_localhost {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- # extra Attribute Calls
- copy_attributes {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- split_and_copy_attributes {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
- papiAttributeListPrint {
- TYPE = FUNCTION;
- FILTER = libpapi-common.so;
- } ;
-
- local:
- * ;
-} ;
diff --git a/usr/src/lib/print/libpapi-lpd/common/papi_impl.h b/usr/src/lib/print/libpapi-lpd/common/papi_impl.h
deleted file mode 100644
index 82d955b3cb..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/papi_impl.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-#ifndef _PAPI_IMPL_H
-#define _PAPI_IMPL_H
-
-/* $Id: papi_impl.h 161 2006-05-03 04:32:59Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <papi.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <time.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <uri.h>
-
-typedef struct {
- papi_attribute_t **attributes;
-} printer_t;
-
-typedef struct job {
- papi_attribute_t **attributes;
-} job_t;
-
-typedef struct stream {
- job_t *job; /* describes current job */
- int fd; /* the fd to write to */
- char *metadata; /* the converted metadata */
- char *dfname; /* the stream data (if we can't stream) */
-
-} stream_t;
-
-typedef struct { /* used for query operations only */
- time_t timestamp;
- printer_t *printer;
- job_t **jobs;
-} cache_t;
-
-typedef struct {
- papi_attribute_t **attributes; /* extra info */
- uri_t *uri; /* printer uri */
- cache_t *cache; /* printer/job cache */
- int (*authCB)(papi_service_t svc, void *app_data); /* unused */
- void *app_data; /* unused */
-} service_t;
-
-
-extern papi_status_t service_fill_in(service_t *svc, char *name);
-extern void detailed_error(service_t *svc, char *fmt, ...);
-extern char *queue_name_from_uri(uri_t *uri);
-extern char *fdgets(char *buf, size_t len, int fd);
-
-
-/* lpd operations */
- /* open a connection to remote print service */
-extern int lpd_open(service_t *svc, char type, char **args,
- int timeout);
- /* job cancelation */
-extern papi_status_t lpd_purge_jobs(service_t *svc, job_t ***jobs);
-extern papi_status_t lpd_cancel_job(service_t *svc, int job_id);
- /* job submission */
-extern papi_status_t lpd_submit_job(service_t *svc, char *metadata,
- papi_attribute_t ***attributes, int *fd);
-extern papi_status_t lpd_job_add_attributes(service_t *svc,
- papi_attribute_t **attributes,
- char **metadata,
- papi_attribute_t ***used_attributes);
-extern papi_status_t lpd_job_add_files(service_t *svc,
- papi_attribute_t **attributes, char **files,
- char **metadata,
- papi_attribute_t ***used_attributes);
- /* query cache lookup routines */
-extern papi_status_t lpd_find_printer_info(service_t *svc, printer_t **result);
-extern papi_status_t lpd_find_job_info(service_t *svc, int job_id, job_t **job);
-extern papi_status_t lpd_find_jobs_info(service_t *svc, job_t ***jobs);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PAPI_IMPL_H */
diff --git a/usr/src/lib/print/libpapi-lpd/common/printer.c b/usr/src/lib/print/libpapi-lpd/common/printer.c
deleted file mode 100644
index 308d9c9443..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/printer.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: printer.c 149 2006-04-25 16:55:01Z njacobs $ */
-
-#include <stdlib.h>
-#include <strings.h>
-#include <papi_impl.h>
-#include <libintl.h>
-
-static int
-contains(char *value, char **list)
-{
- int i;
-
- if ((value == NULL) || (list == NULL))
- return (1);
-
- for (i = 0; list[i] != NULL; i++)
- if (strcasecmp(value, list[i]) == 0)
- return (1);
-
- return (0);
-}
-
-papi_status_t
-papiPrinterQuery(papi_service_t handle, char *name,
- char **requested_attrs,
- papi_attribute_t **job_attributes,
- papi_printer_t *printer)
-{
- papi_status_t status;
- service_t *svc = handle;
- printer_t *p = NULL;
-
- if ((svc == NULL) || (name == NULL) || (printer == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK) {
- *printer = NULL;
-
- if ((contains("printer-state", requested_attrs) == 1) ||
- (contains("printer-state-reasons", requested_attrs) == 1))
- status = lpd_find_printer_info(svc,
- (printer_t **)printer);
-
- if ((status == PAPI_OK) && (*printer == NULL)) {
- char buf[BUFSIZ];
-
- *printer = p = calloc(1, sizeof (*p));
-
- papiAttributeListAddString(&(p->attributes),
- PAPI_ATTR_APPEND, "printer-name",
- queue_name_from_uri(svc->uri));
-
- if (uri_to_string(svc->uri, buf, sizeof (buf)) == 0)
- papiAttributeListAddString(&(p->attributes),
- PAPI_ATTR_APPEND,
- "printer-uri-supported", buf);
- }
- /* Set printer accepting: mimic prepapi behavior */
- if ((p = *printer) != NULL)
- papiAttributeListAddBoolean(&(p->attributes),
- PAPI_ATTR_REPLACE,
- "printer-is-accepting-jobs", PAPI_TRUE);
-
- }
-
- return (status);
-}
-
-papi_status_t
-papiPrinterPurgeJobs(papi_service_t handle, char *name, papi_job_t **jobs)
-{
- papi_status_t status;
- service_t *svc = handle;
-
- if ((svc == NULL) || (name == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK)
- status = lpd_purge_jobs(svc, (job_t ***)jobs);
-
- return (status);
-}
-
-papi_status_t
-papiPrinterListJobs(papi_service_t handle, char *name,
- char **requested_attrs, int type_mask,
- int max_num_jobs, papi_job_t **jobs)
-{
- papi_status_t status;
- service_t *svc = handle;
-
- if ((svc == NULL) || (name == NULL) || (jobs == NULL))
- return (PAPI_BAD_ARGUMENT);
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK)
- status = lpd_find_jobs_info(svc, (job_t ***)jobs);
-
- return (status);
-}
-
-papi_attribute_t **
-papiPrinterGetAttributeList(papi_printer_t printer)
-{
- printer_t *p = printer;
-
- if (p == NULL)
- return (NULL);
-
- return (p->attributes);
-}
-
-void
-papiPrinterFree(papi_printer_t printer)
-{
- printer_t *p = printer;
-
- if (p != NULL) {
- if (p->attributes != NULL)
- papiAttributeListFree(p->attributes);
- free(p);
- }
-}
-
-void
-papiPrinterListFree(papi_printer_t *printers)
-{
- if (printers != NULL) {
- int i;
-
- for (i = 0; printers[i] != NULL; i++)
- papiPrinterFree(printers[i]);
- free(printers);
- }
-}
-
-
-papi_status_t
-papiPrinterDisable(papi_service_t handle, char *name, char *message)
-{
- service_t *svc = handle;
- papi_status_t status;
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK) {
- detailed_error(svc,
- gettext("Warning: %s is remote, disable has no meaning."),
- queue_name_from_uri(svc->uri));
- }
- return (PAPI_OPERATION_NOT_SUPPORTED);
-}
-
-papi_status_t
-papiPrinterEnable(papi_service_t handle, char *name)
-{
- service_t *svc = handle;
- papi_status_t status;
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK) {
- detailed_error(svc,
- gettext("Warning: %s is remote, enable has no meaning."),
- queue_name_from_uri(svc->uri));
- }
- return (PAPI_OPERATION_NOT_SUPPORTED);
-}
-
-
-papi_status_t
-papiPrinterResume(papi_service_t handle, char *name)
-{
- service_t *svc = handle;
- papi_status_t status;
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK) {
- detailed_error(svc,
- gettext("Warning: %s is remote, accept has no meaning."),
- queue_name_from_uri(svc->uri));
- }
- return (PAPI_OPERATION_NOT_SUPPORTED);
-}
-
-
-papi_status_t
-papiPrinterPause(papi_service_t handle, char *name, char *message)
-{
- service_t *svc = handle;
- papi_status_t status;
-
- if ((status = service_fill_in(svc, name)) == PAPI_OK) {
- detailed_error(svc,
- gettext("Warning: %s is remote, reject has no meaning."),
- queue_name_from_uri(svc->uri));
- }
- return (PAPI_OPERATION_NOT_SUPPORTED);
-}
diff --git a/usr/src/lib/print/libpapi-lpd/common/service.c b/usr/src/lib/print/libpapi-lpd/common/service.c
deleted file mode 100644
index c39ea0cbb5..0000000000
--- a/usr/src/lib/print/libpapi-lpd/common/service.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: service.c 163 2006-05-09 15:07:45Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <alloca.h>
-#include <uri.h>
-#include <papi_impl.h>
-
-papi_status_t
-service_fill_in(service_t *svc, char *name)
-{
- papi_status_t status = PAPI_OK;
- uri_t *uri = NULL;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if (name == NULL)
- return (PAPI_OK);
-
- /*
- * valid URIs are in the form:
- * lpd://server[:port]/.../queue[#extensions]
- * rfc-1179://server[:port]/.../queue[#extensions]
- * any authentication information supplied the URI is ignored.
- */
- if (uri_from_string((char *)name, &uri) != -1) {
- if ((strcasecmp(uri->scheme, "lpd") == 0) ||
- (strcasecmp(uri->scheme, "rfc-1179") == 0)) {
- if (svc->uri != NULL)
- uri_free(svc->uri);
- svc->uri = uri;
- } else {
- uri_free(uri);
- status = PAPI_URI_SCHEME;
- }
- }
-
- return (status);
-}
-
-papi_status_t
-papiServiceCreate(papi_service_t *handle, char *service_name,
- char *user_name, char *password,
- int (*authCB)(papi_service_t svc, void *app_data),
- papi_encryption_t encryption, void *app_data)
-{
- papi_status_t status;
- service_t *svc = NULL;
-
- if (handle == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- if ((*handle = svc = (service_t *)calloc(1, sizeof (*svc))) == NULL)
- return (PAPI_TEMPORARY_ERROR);
-
- if (service_name != NULL)
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_EXCL,
- "service-name", service_name);
-
- (void) papiServiceSetUserName(svc, user_name);
- (void) papiServiceSetPassword(svc, password);
- (void) papiServiceSetAuthCB(svc, authCB);
- (void) papiServiceSetAppData(svc, app_data);
- (void) papiServiceSetEncryption(svc, encryption);
-
- status = service_fill_in(svc, service_name);
-
- return (status);
-}
-
-void
-papiServiceDestroy(papi_service_t handle)
-{
- if (handle != NULL) {
- service_t *svc = handle;
-
-#ifdef DEADBEEF
- if (svc->cache != NULL)
- cache_free(svc->cache);
-#endif
- if (svc->uri != NULL)
- uri_free(svc->uri);
- if (svc->attributes != NULL)
- papiAttributeListFree(svc->attributes);
- free(svc);
- }
-}
-
-papi_status_t
-papiServiceSetUserName(papi_service_t handle, char *user_name)
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- return (papiAttributeListAddString(&svc->attributes, PAPI_ATTR_REPLACE,
- "user-name", user_name));
-}
-
-papi_status_t
-papiServiceSetPassword(papi_service_t handle, char *password)
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- return (papiAttributeListAddString(&svc->attributes,
- PAPI_ATTR_REPLACE, "password", password));
-}
-
-papi_status_t
-papiServiceSetEncryption(papi_service_t handle,
- papi_encryption_t encryption)
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- return (papiAttributeListAddInteger(&svc->attributes, PAPI_ATTR_REPLACE,
- "encryption", (int)encryption));
-}
-
-papi_status_t
-papiServiceSetAuthCB(papi_service_t handle,
- int (*authCB)(papi_service_t svc, void *app_data))
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- svc->authCB = (int (*)(papi_service_t svc, void *))authCB;
-
- return (PAPI_OK);
-}
-
-papi_status_t
-papiServiceSetAppData(papi_service_t handle, void *app_data)
-{
- service_t *svc = handle;
-
- if (svc == NULL)
- return (PAPI_BAD_ARGUMENT);
-
- svc->app_data = (void *)app_data;
-
- return (PAPI_OK);
-}
-
-char *
-papiServiceGetServiceName(papi_service_t handle)
-{
- service_t *svc = handle;
- char *result = NULL;
-
- if (svc != NULL)
- papiAttributeListGetString(svc->attributes, NULL,
- "service-name", &result);
-
- return (result);
-}
-
-char *
-papiServiceGetUserName(papi_service_t handle)
-{
- service_t *svc = handle;
- char *result = NULL;
-
- if (svc != NULL)
- papiAttributeListGetString(svc->attributes, NULL,
- "user-name", &result);
-
- return (result);
-
-}
-
-char *
-papiServiceGetPassword(papi_service_t handle)
-{
- service_t *svc = handle;
- char *result = NULL;
-
- if (svc != NULL)
- papiAttributeListGetString(svc->attributes, NULL,
- "password", &result);
-
- return (result);
-}
-
-papi_encryption_t
-papiServiceGetEncryption(papi_service_t handle)
-{
- service_t *svc = handle;
- papi_encryption_t result = PAPI_ENCRYPT_NEVER;
-
- if (svc != NULL)
- papiAttributeListGetInteger(svc->attributes, NULL,
- "encryption", (int *)&result);
-
- return (result);
-}
-
-void *
-papiServiceGetAppData(papi_service_t handle)
-{
- service_t *svc = handle;
- void *result = NULL;
-
- if (svc != NULL) {
- result = svc->app_data;
- }
-
- return (result);
-
-}
-
-papi_attribute_t **
-papiServiceGetAttributeList(papi_service_t handle)
-{
- service_t *svc = handle;
- papi_attribute_t **result = NULL;
-
- if (svc != NULL)
- result = svc->attributes;
-
- return (result);
-}
-
-char *
-papiServiceGetStatusMessage(papi_service_t handle)
-{
- service_t *svc = handle;
- char *result = NULL;
-
- if (svc != NULL) {
- papiAttributeListGetString(svc->attributes, NULL,
- "detailed-status-message", &result);
- }
-
- return (result);
-}
-
-void
-detailed_error(service_t *svc, char *fmt, ...)
-{
- if ((svc != NULL) && (fmt != NULL)) {
- va_list ap;
- size_t size;
- char *message = alloca(BUFSIZ);
-
- va_start(ap, fmt);
- /*
- * fill in the message. If the buffer is too small, allocate
- * one that is large enough and fill it in.
- */
- if ((size = vsnprintf(message, BUFSIZ, fmt, ap)) >= BUFSIZ)
- if ((message = alloca(size)) != NULL)
- vsnprintf(message, size, fmt, ap);
- va_end(ap);
-
- papiAttributeListAddString(&svc->attributes, PAPI_ATTR_APPEND,
- "detailed-status-message", message);
- }
-}
diff --git a/usr/src/lib/print/libpapi-lpd/i386/Makefile b/usr/src/lib/print/libpapi-lpd/i386/Makefile
deleted file mode 100644
index 362f811e03..0000000000
--- a/usr/src/lib/print/libpapi-lpd/i386/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS) $(EXTRALINKS) \
- $(ROOTLIBPRINTPROG)
diff --git a/usr/src/lib/print/libpapi-lpd/sparc/Makefile b/usr/src/lib/print/libpapi-lpd/sparc/Makefile
deleted file mode 100644
index 362f811e03..0000000000
--- a/usr/src/lib/print/libpapi-lpd/sparc/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBDIR) $(ROOTLIBS) $(ROOTLINKS) $(EXTRALINKS) \
- $(ROOTLIBPRINTPROG)
diff --git a/usr/src/lib/print/libprint/Makefile.com b/usr/src/lib/print/libprint/Makefile.com
deleted file mode 100644
index 88fbb532b0..0000000000
--- a/usr/src/lib/print/libprint/Makefile.com
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-LIBRARY = libprint.a
-VERS = .2
-OBJECTS = \
- list.o ns.o ns_bsd_addr.o ns_cmn_kvp.o \
- ns_cmn_printer.o nss_convert.o nss_ldap.o nss_printer.o nss_write.o
-
-include ../../../Makefile.lib
-include ../../../Makefile.rootfs
-
-SRCDIR = ../common
-
-ROOTLIBDIR= $(ROOT)/usr/lib
-
-LIBS = $(DYNLIB)
-
-$(LINTLIB):= SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I$(SRCDIR)
-CPPFLAGS += -I../../head -D_REENTRANT
-
-LDLIBS += -lnsl -lsocket -lc -lldap
-
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-lint: lintcheck
-
-include ../../../Makefile.targ
diff --git a/usr/src/lib/print/libprint/common/list.c b/usr/src/lib/print/libprint/common/list.c
deleted file mode 100644
index fd90e58130..0000000000
--- a/usr/src/lib/print/libprint/common/list.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <syslog.h>
-#include <stdlib.h>
-#include <strings.h>
-
-#include <list.h>
-
-
-static int _list_increment = 64; /* just so It can be tuned with adb(1) */
-/*
- * list_append() takes in a list (type **) and a pointer to an item to add
- * to the list and returns a new list with the new item appended on the
- * end. The list is NULL terminated. If there was an error, NULL is
- * returned. For reasonable efficiency, the list will be allocated
- * in blocks of size _list_increment.
- */
-void **
-list_append(void **list, void *item)
-{
-#ifdef DEBUG
- syslog(LOG_DEBUG, "list_append(0x%x, 0x%x)", list, item);
-#endif
- if (item == NULL)
- return (list);
-
- if (list == NULL) {
- list = (void **)calloc(_list_increment, sizeof (void *));
- (void) memset(list, NULL, (_list_increment * sizeof (void *)));
- list[0] = item;
- } else {
- int count;
-
- for (count = 0; list[count] != NULL; count++);
-
- if ((count + 1) % _list_increment == 0) { /* increase size */
- void **new_list = NULL;
- int new_size = (((count + 1) / _list_increment) + 1) *
- _list_increment;
-
- new_list = (void **)calloc(new_size,
- sizeof (void *));
- (void) memset(new_list, NULL,
- (new_size * sizeof (void *)));
- for (count = 0; list[count] != NULL; count++)
- new_list[count] = list[count];
- free(list);
- list = new_list;
- }
- list[count] = item;
- }
- return (list);
-}
-
-
-void **
-list_append_unique(void **list, void *item, int (*cmp)(void *, void*))
-{
- if (list_locate(list, cmp, item))
- return (list);
-
- list = list_append(list, item);
- return (list);
-}
-
-
-/*
- * list_locate() iterates through the list passed in and uses the comparison
- * routine and element passed in to find an element in the list. It
- * returns the first element matched, or NULL if none exists
- */
-void *
-list_locate(void **list, int (*compair)(void *, void *), void *element)
-{
- int current = 0;
-
-#ifdef DEBUG
- syslog(LOG_DEBUG, "list_locate()");
-#endif
- if (list != NULL)
- for (current = 0; list[current] != NULL; current++)
- if ((compair)(list[current], element) == 0)
- return (list[current]);
- return (NULL);
-}
-
-
-/*
- * list_concatenate() takes in two NULL terminated lists of items (type **)
- * and creates a new list with items from list2 appended on the end of
- * the list of items from list1. The result is a list (type **). If
- * there is a failure, NULL is returned.
- */
-void **
-list_concatenate(void **list1, void **list2)
-{
- void **list = NULL;
- int size1 = 0,
- size2 = 0,
- new_size = 0;
-#ifdef DEBUG
- syslog(LOG_DEBUG, "list_concatenate(0x%x, 0x%x)", list1, list2);
-#endif
- if ((list1 == NULL) || (list2 == NULL))
- return ((list1 != NULL) ? list1 : list2);
-
- for (size1 = 0; list1[size1] != NULL; size1++);
- for (size2 = 0; list2[size2] != NULL; size2++);
-
- /* list1 + list2 padded to a multiple of _list_increment */
- new_size = ((size1 + size2)/_list_increment + 2) * _list_increment;
-
- if ((list = (void **)calloc((new_size), sizeof (void *)))
- != NULL) {
- int count = 0;
-
- (void) memset(list, NULL, (new_size * sizeof (void *)));
-
- for (size1 = 0; list1[size1] != NULL; size1++)
- list[count++] = list1[size1];
- for (size2 = 0; list2[size2] != NULL; size2++)
- list[count++] = list2[size2];
- free(list1);
- }
- return (list);
-}
-
-
-/*
- * list_iterate() take in a list, pointer to a function, and variable number
- * of arguements following. list_iterate() will iterate through the list
- * calling the functions passed in with the first argument being a pointer
- * to the current item in the list and the second argument being a va_list
- * containing the rest of arguments used to call list_iterate(). The
- * calling fuction should be declared: int func(type *, va_list). The
- * return results are all added together and the sum is returned from
- * list_iterate().
- */
-int
-list_iterate(void **list, int (*vfunc)(void *, va_list), ...)
-{
- int current = 0,
- rc = 0;
-
-#ifdef DEBUG
- syslog(LOG_DEBUG, "list_iterate(0x%x, 0x%x)", list, vfunc);
-#endif
- if (list != NULL)
- while (list[current] != NULL) {
- va_list ap;
-
- va_start(ap, (vfunc));
- rc += (vfunc)(list[current++], ap);
- va_end(ap);
- }
- return (rc);
-}
diff --git a/usr/src/lib/print/libprint/common/llib-lprint b/usr/src/lib/print/libprint/common/llib-lprint
deleted file mode 100644
index c52143e527..0000000000
--- a/usr/src/lib/print/libprint/common/llib-lprint
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <arpa/inet.h>
-#include <dirent.h>
-#include <dlfcn.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <libintl.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <pwd.h>
-#include <rpc/rpc.h>
-#include <rpcsvc/yp_prot.h>
-#include <rpcsvc/ypclnt.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/systeminfo.h>
-#include <sys/types.h>
-#include <syslog.h>
-#include <unistd.h>
-
-void **list_append(void **, void *);
-void **list_append_unique(void **, void *, int (*)(void *, void*));
-void **list_concatenate(void **, void **);
-void * list_locate(void **, int (*)(void *, void *), void *);
-int list_iterate(void **, int (*)(void *, __va_list), ...);
-
-void *dynamic_function(const char *, const char *);
-
-struct ns_bsd_addr {
- char *server; /* server name */
- char *printer; /* printer name or NULL */
- char *extension; /* RFC-1179 conformance */
- char *pname; /* Local printer name */
-};
-typedef struct ns_bsd_addr ns_bsd_addr_t;
-
-/* Key/Value pair structure */
-struct ns_kvp {
- char *key; /* key */
- char *value; /* value string */
-};
-typedef struct ns_kvp ns_kvp_t;
-
-/* Printer Object structure */
-struct ns_printer {
- char *name; /* primary name of printer */
- char **aliases; /* aliases for printer */
- char *source; /* name service derived from */
- ns_kvp_t **attributes; /* key/value pairs. */
-};
-typedef struct ns_printer ns_printer_t;
-
-/* functions to get/put printer objects */
-ns_printer_t *ns_printer_create(char *, char **, char *, ns_kvp_t **);
-ns_printer_t *ns_printer_get_name(const char *, const char *);
-ns_printer_t **ns_printer_get_list(const char *);
-int ns_printer_put(const ns_printer_t *);
-void ns_printer_destroy(ns_printer_t *);
-
-/* functions to manipulate key/value pairs */
-void *ns_get_value(const char *, const ns_printer_t *);
-char *ns_get_value_string(const char *, const ns_printer_t *);
-int ns_set_value(const char *, const void *, ns_printer_t *);
-int ns_set_value_from_string(const char *, const char *,
- ns_printer_t *);
-ns_kvp_t *ns_kvp_create(const char *, const char *);
-
-/* for BSD bindings only */
-ns_bsd_addr_t *ns_bsd_addr_get_default(void);
-ns_bsd_addr_t *ns_bsd_addr_get_name(char *name);
-ns_bsd_addr_t **ns_bsd_addr_get_all(int);
-ns_bsd_addr_t **ns_bsd_addr_get_list(int);
-
-/* others */
-ns_printer_t *posix_name(const char *);
-int ns_printer_match_name(ns_printer_t *, const char *);
-char *ns_printer_name_list(const ns_printer_t *);
-char *value_to_string(const char *, void *);
-void *string_to_value(const char *, char *);
-
-
-ns_printer_t *_cvt_pconf_entry_to_printer(char *, char *);
-char *_cvt_printer_to_pconf_entry(ns_printer_t *);
-
-ns_printer_t *_cvt_user_string_to_printer(char *, char *);
-char *_cvt_printer_to_user_string(ns_printer_t *);
-
-
-ns_printer_t *_file_get_name(const char *, const char *,
- ns_printer_t *(*)(char *, char *), char *);
-
-ns_printer_t **_file_get_list(const char *,
- ns_printer_t *(*)(char *, char *), char *);
-
-int _file_put_printer(const char *, const ns_printer_t *,
- ns_printer_t *(*)(char *, char *), char *, char *(*)(ns_printer_t *));
-
-
-ns_printer_t *_nis_get_name(const char *, const char *,
- ns_printer_t *(*)(char *, char *), char *);
-
-ns_printer_t **_nis_get_list(const char *,
- ns_printer_t *(*)(char *, char *), char *);
-
-int _nis_put_printer(const char *, const ns_printer_t *,
- ns_printer_t *(*)(char *, char *), char *, char *(*)(ns_printer_t *));
diff --git a/usr/src/lib/print/libprint/common/mapfile-vers b/usr/src/lib/print/libprint/common/mapfile-vers
deleted file mode 100644
index 776e97beca..0000000000
--- a/usr/src/lib/print/libprint/common/mapfile-vers
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-#
-# Generic interface definition for usr/src/lib/print.
-#
-
-SYMBOL_VERSION SUNWprivate_2.1 {
- global:
- getprinterbyname; # NSS support
- getprinterentry;
- setprinterentry;
- endprinterentry;
-
- ns_printer_create; # Old NS support
- ns_printer_get_name;
- ns_printer_get_list;
- ns_printer_put;
- ns_printer_destroy;
- ns_get_value;
- ns_get_value_string;
- ns_set_value;
- ns_set_value_from_string;
- ns_kvp_create;
- ns_bsd_addr_get_default;
- ns_bsd_addr_get_name;
- ns_bsd_addr_get_all;
- ns_bsd_addr_get_list;
- string_to_bsd_addr;
- bsd_addr_create;
- ns_printer_match_name;
- ns_printer_name_list;
- value_to_string;
- string_to_value;
- normalize_ns_name;
-
- list_append; # list support
- list_append_unique;
- list_concatenate;
- list_locate;
- list_iterate;
-
- files_put_printer; # required for ns_put_printer()
- nis_put_printer;
- ldap_put_printer;
-
- local:
- *;
-};
diff --git a/usr/src/lib/print/libprint/common/ns.c b/usr/src/lib/print/libprint/common/ns.c
deleted file mode 100644
index 943be31e95..0000000000
--- a/usr/src/lib/print/libprint/common/ns.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <string.h>
-#include <stdarg.h>
-#include <dlfcn.h>
-#include <nss_dbdefs.h>
-#include <syslog.h>
-
-#include <ns.h>
-#include <list.h>
-
-
-/*
- * because legacy code can use a variety of values for various name
- * services, this routine is needed to "normalize" them.
- */
-char *
-normalize_ns_name(char *ns)
-{
- if (ns == NULL)
- return (NULL);
- else if ((strcasecmp(ns, "files") == 0) ||
- (strcasecmp(ns, "system") == 0) ||
- (strcasecmp(ns, "etc") == 0))
- return ("files");
- else if (strcasecmp(ns, "nis") == 0)
- return ("nis");
- else if (strcasecmp(ns, "ldap") == 0)
- return ("ldap");
- else
- return (ns);
-}
-
-
-/*
- * FUNCTION:
- * void ns_printer_destroy(ns_printer_t *printer)
- * INPUT:
- * ns_printer_t *printer - a pointer to the printer "object" to destroy
- * DESCRIPTION:
- * This function will free all of the memory associated with a printer
- * object. It does this by walking the structure ad freeing everything
- * underneath it, with the exception of the object source field. This
- * field is not filled in with newly allocated space when it is
- * generated
- */
-void
-ns_printer_destroy(ns_printer_t *printer)
-{
- if (printer != NULL) {
- if (printer->attributes != NULL) { /* attributes */
- extern void ns_kvp_destroy(ns_kvp_t *);
-
- list_iterate((void **)printer->attributes,
- (VFUNC_T)ns_kvp_destroy);
- free(printer->attributes);
- }
- if (printer->aliases != NULL) { /* aliases */
- free(printer->aliases);
- }
- if (printer->name != NULL) /* primary name */
- free(printer->name);
- free(printer);
- }
-}
-
-
-/*
- * FUNCTION:
- * ns_printer_t **ns_printer_get_list()
- * OUTPUT:
- * ns_printer_t ** (return value) - an array of pointers to printer
- * objects.
- * DESCRIPTION:
- * This function will return a list of all printer objects found in every
- * configuration interface.
- */
-ns_printer_t **
-ns_printer_get_list(const char *ns)
-{
- char buf[NSS_LINELEN_PRINTERS];
- ns_printer_t **printer_list = NULL;
-
- (void) setprinterentry(0, (char *)ns);
-
- ns = normalize_ns_name((char *)ns);
- while (getprinterentry(buf, sizeof (buf), (char *)ns) == 0) {
- ns_printer_t *printer =
- (ns_printer_t *)_cvt_nss_entry_to_printer(buf, NULL);
-
- printer_list = (ns_printer_t **)list_append(
- (void **)printer_list,
- (void *)printer);
- }
-
- (void) endprinterentry();
-
- return (printer_list);
-}
-
-
-/*
- * This function looks for the named printer in the supplied
- * name service (ns), or the name services configured under
- * the nsswitch.
- */
-ns_printer_t *
-ns_printer_get_name(const char *name, const char *ns)
-{
- ns_printer_t *result = NULL;
- char buf[NSS_LINELEN_PRINTERS];
-
- /*
- * Reset printer entries to the start so we know we will always
- * pick up the correct entry
- */
- endprinterentry();
-
- if ((result = (ns_printer_t *)posix_name(name)) != NULL)
- return (result);
-
- ns = normalize_ns_name((char *)ns);
- if (getprinterbyname((char *)name, buf, sizeof (buf), (char *)ns) == 0)
- result = (ns_printer_t *)_cvt_nss_entry_to_printer(buf, NULL);
-
- return (result);
-}
-
-
-/*
- * FUNCTION:
- * int ns_printer_put(const ns_printer_t *printer)
- * INPUT:
- * const ns_printer_t *printer - a printer object
- * DESCRIPTION:
- * This function attempts to put the data in the printer object back
- * to the "name service" specified in the source field of the object.
- */
-int
-ns_printer_put(const ns_printer_t *printer)
-{
- char func[32];
- int (*fpt)();
-
- if ((printer == NULL) || (printer->source == NULL))
- return (-1);
-
- if (snprintf(func, sizeof (func), "%s_put_printer",
- normalize_ns_name(printer->source)) >= sizeof (func)) {
- syslog(LOG_ERR, "ns_printer_put: buffer overflow");
- return (-1);
- }
-
- if ((fpt = (int (*)())dlsym(RTLD_DEFAULT, func)) != NULL)
- return ((*fpt)(printer));
-
- return (-1);
-}
diff --git a/usr/src/lib/print/libprint/common/ns.h b/usr/src/lib/print/libprint/common/ns.h
deleted file mode 100644
index 84d16f7ceb..0000000000
--- a/usr/src/lib/print/libprint/common/ns.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _NS_H
-#define _NS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Name Service Common Keys/types for lookup
- */
-#define NS_KEY_BSDADDR "bsdaddr"
-#define NS_KEY_USE "use"
-#define NS_KEY_ALL "all"
-#define NS_KEY_GROUP "group"
-#define NS_KEY_LIST "list"
-
-#define NS_KEY_PRINTER_TYPE "printer-type"
-#define NS_KEY_DESCRIPTION "description"
-
-/*
- * Name Service reserved names for lookup
- */
-#define NS_NAME_DEFAULT "_default"
-#define NS_NAME_ALL "_all"
-
-/*
- * Name Services supported
- */
-#define NS_SVC_USER "user"
-#define NS_SVC_PRINTCAP "printcap"
-#define NS_SVC_ETC "etc"
-#define NS_SVC_NIS "nis"
-#define NS_SVC_LDAP "ldap"
-
-/*
- * Known Protocol Extensions
- */
-#define NS_EXT_SOLARIS "solaris"
-#define NS_EXT_GENERIC "extensions" /* same as SOLARIS */
-#define NS_EXT_HPUX "hpux"
-#define NS_EXT_DEC "dec"
-
-/*
- * get unique or full list of printer bindings
- */
-#define NOTUNIQUE 0
-#define UNIQUE 1
-#define LOCAL_UNIQUE 2 /* include alias names */
-
-/* BSD binding address structure */
-struct ns_bsd_addr {
- char *server; /* server name */
- char *printer; /* printer name or NULL */
- char *extension; /* RFC-1179 conformance */
- char *pname; /* Local printer name */
-};
-typedef struct ns_bsd_addr ns_bsd_addr_t;
-
-/* Key/Value pair structure */
-struct ns_kvp {
- char *key; /* key */
- char *value; /* value string */
-};
-typedef struct ns_kvp ns_kvp_t;
-
-
-/* LDAP specific result codes */
-
-typedef enum NSL_RESULT
-{
- NSL_OK = 0, /* Operation successful */
- NSL_ERR_INTERNAL = 1, /* Internal coding Error */
- NSL_ERR_ADD_FAILED = 2, /* LDAP add failed */
- NSL_ERR_MOD_FAILED = 3, /* LDAP modify failed */
- NSL_ERR_DEL_FAILED = 4, /* LDAP delete failed */
- NSL_ERR_UNKNOWN_PRINTER = 5, /* Unknown Printer object */
- NSL_ERR_CREDENTIALS = 6, /* LDAP credentials invalid */
- NSL_ERR_CONNECT = 7, /* LDAP server connect failed */
- NSL_ERR_BIND = 8, /* LDAP bind failed */
- NSL_ERR_RENAME = 9, /* Object rename is not allowed */
- NSL_ERR_KVP = 10, /* sun-printer-kvp not allowed */
- NSL_ERR_BSDADDR = 11, /* sun-printer-bsdaddr not allowed */
- NSL_ERR_PNAME = 12, /* printer-name not allowed */
- NSL_ERR_MEMORY = 13, /* memory allocation failed */
- NSL_ERR_MULTIOP = 14, /* Replace and delete operation */
- NSL_ERR_NOTALLOWED = 15, /* KVP attribute not allowed */
- NSL_ERROR = -1 /* General error */
-} NSL_RESULT;
-
-
-/* LDAP bind password security type */
-
-typedef enum NS_PASSWD_TYPE {
- NS_PW_INSECURE = 0,
- NS_PW_SECURE = 1
-} NS_PASSWD_TYPE;
-
-
-/*
- * Information needed to update a name service.
- * Currently only used for ldap.
- */
-struct ns_cred {
- char *binddn;
- char *passwd;
- char *host;
- int port; /* LDAP port, 0 = default */
- NS_PASSWD_TYPE passwdType; /* password security type */
- uchar_t *domainDN; /* NS domain DN */
-};
-typedef struct ns_cred ns_cred_t;
-
-/* LDAP specific NS Data */
-
-typedef struct NS_LDAPDATA {
- char **attrList; /* list of user defined Key Value Pairs */
-} NS_LDAPDATA;
-
-/* Printer Object structure */
-struct ns_printer {
- char *name; /* primary name of printer */
- char **aliases; /* aliases for printer */
- char *source; /* name service derived from */
- ns_kvp_t **attributes; /* key/value pairs. */
- ns_cred_t *cred; /* info to update name service */
- void *nsdata; /* name service specific data */
-};
-typedef struct ns_printer ns_printer_t;
-
-/* functions to get/put printer objects */
-extern ns_printer_t *ns_printer_create(char *, char **, char *, ns_kvp_t **);
-extern ns_printer_t *ns_printer_get_name(const char *, const char *);
-extern ns_printer_t **ns_printer_get_list(const char *);
-extern int ns_printer_put(const ns_printer_t *);
-extern void ns_printer_destroy(ns_printer_t *);
-
-extern int setprinterentry(int, char *);
-extern int endprinterentry();
-extern int getprinterentry(char *, int, char *);
-extern int getprinterbyname(char *, char *, int, char *);
-
-extern char *_cvt_printer_to_entry(ns_printer_t *, char *, int);
-
-extern ns_printer_t *_cvt_nss_entry_to_printer(char *, char *);
-extern ns_printer_t *posix_name(const char *);
-
-
-
-/* functions to manipulate key/value pairs */
-extern void *ns_get_value(const char *, const ns_printer_t *);
-extern char *ns_get_value_string(const char *, const ns_printer_t *);
-extern int ns_set_value(const char *, const void *, ns_printer_t *);
-extern int ns_set_value_from_string(const char *, const char *,
- ns_printer_t *);
-extern ns_kvp_t *ns_kvp_create(const char *, const char *);
-
-/* for BSD bindings only */
-extern ns_bsd_addr_t *ns_bsd_addr_get_default();
-extern ns_bsd_addr_t *ns_bsd_addr_get_name(char *name);
-extern ns_bsd_addr_t **ns_bsd_addr_get_all(int);
-extern ns_bsd_addr_t **ns_bsd_addr_get_list(int);
-
-/* others */
-extern int ns_printer_match_name(ns_printer_t *, const char *);
-extern char *ns_printer_name_list(const ns_printer_t *);
-extern char *value_to_string(const char *, void *);
-extern void *string_to_value(const char *, char *);
-extern char *normalize_ns_name(char *);
-extern char *strncat_escaped(char *, char *, int, char *);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _NS_H */
diff --git a/usr/src/lib/print/libprint/common/ns_bsd_addr.c b/usr/src/lib/print/libprint/common/ns_bsd_addr.c
deleted file mode 100644
index ba142bb8a1..0000000000
--- a/usr/src/lib/print/libprint/common/ns_bsd_addr.c
+++ /dev/null
@@ -1,571 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <string.h>
-#include <syslog.h>
-
-#include <ns.h>
-#include <list.h>
-
-static char **
-strsplit(char *string, char *seperators)
-{
- char **list = NULL;
- char *where = NULL;
- char *element;
-
- for (element = strtok_r(string, seperators, &where); element != NULL;
- element = strtok_r(NULL, seperators, &where))
- list = (char **)list_append((void **)list, element);
-
- return (list);
-}
-
-/*
- * Manipulate bsd_addr structures
- */
-ns_bsd_addr_t *
-bsd_addr_create(const char *server, const char *printer, const char *extension)
-{
- ns_bsd_addr_t *addr = NULL;
-
- if ((server != NULL) &&
- ((addr = calloc(1, sizeof (*addr))) != NULL)) {
- addr->printer = (char *)printer;
- addr->server = (char *)server;
- addr->extension = (char *)extension;
- }
-
- return (addr);
-}
-
-static char *
-bsd_addr_to_string(const ns_bsd_addr_t *addr)
-{
- char buf[BUFSIZ];
-
- if ((addr == NULL) || (addr->server == NULL))
- return (NULL);
-
- if (snprintf(buf, sizeof (buf), "%s", addr->server) >= sizeof (buf)) {
- syslog(LOG_ERR, "bsd_addr_to_string: buffer overflow");
- return (NULL);
- }
-
- if ((addr->printer != NULL) || (addr->extension != NULL))
- (void) strlcat(buf, ",", sizeof (buf));
- if (addr->printer != NULL)
- if (strlcat(buf, addr->printer, sizeof (buf)) >= sizeof (buf)) {
- syslog(LOG_ERR, "bsd_addr_to_string: buffer overflow");
- return (NULL);
- }
- if (addr->extension != NULL) {
- (void) strlcat(buf, ",", sizeof (buf));
- if (strlcat(buf, addr->extension, sizeof (buf))
- >= sizeof (buf)) {
- syslog(LOG_ERR, "bsd_addr_to_string: buffer overflow");
- return (NULL);
- }
- }
-
- return (strdup(buf));
-}
-
-ns_bsd_addr_t *
-string_to_bsd_addr(const char *string)
-{
- char **list, *tmp, *printer = NULL, *extension = NULL;
-
- if (string == NULL)
- return (NULL);
-
- tmp = strdup(string);
- list = strsplit(tmp, ",");
-
- if (list[1] != NULL) {
- printer = list[1];
- if (list[2] != NULL)
- extension = list[2];
- }
-
- return (bsd_addr_create(list[0], printer, extension));
-}
-
-static char *
-list_to_string(const char **list)
-{
- char buf[BUFSIZ];
-
- if ((list == NULL) || (*list == NULL))
- return (NULL);
-
- if (snprintf(buf, sizeof (buf), "%s", *list) >= sizeof (buf)) {
- syslog(LOG_ERR, "list_to_string: buffer overflow");
- return (NULL);
- }
-
- while (*++list != NULL) {
- (void) strlcat(buf, ",", sizeof (buf));
- if (strlcat(buf, *list, sizeof (buf)) >= sizeof (buf)) {
- syslog(LOG_ERR, "list_to_string: buffer overflow");
- return (NULL);
- }
- }
-
- return (strdup(buf));
-}
-
-static char *
-internal_list_to_string(const ns_printer_t **list)
-{
- char buf[BUFSIZ];
-
- if ((list == NULL) || (*list == NULL))
- return (NULL);
-
- if (snprintf(buf, sizeof (buf), "%s", (*list)->name) >= sizeof (buf)) {
- syslog(LOG_ERR, "internal_list_to_string:buffer overflow");
- return (NULL);
- }
-
- while (*++list != NULL) {
- (void) strlcat(buf, ",", sizeof (buf));
- if (strlcat(buf, (*list)->name, sizeof (buf)) >= sizeof (buf)) {
- syslog(LOG_ERR,
- "internal_list_to_string:buffer overflow");
- return (NULL);
- }
- }
-
- return (strdup(buf));
-}
-
-
-char *
-value_to_string(const char *key, void *value)
-{
- char *string = NULL;
-
- if ((key != NULL) && (value != NULL)) {
- if (strcmp(key, NS_KEY_BSDADDR) == 0) {
- string = bsd_addr_to_string(value);
- } else if ((strcmp(key, NS_KEY_ALL) == 0) ||
- (strcmp(key, NS_KEY_GROUP) == 0)) {
- string = list_to_string(value);
- } else if (strcmp(key, NS_KEY_LIST) == 0) {
- string = internal_list_to_string(value);
- } else {
- string = strdup((char *)value);
- }
- }
-
- return (string);
-}
-
-
-void *
-string_to_value(const char *key, char *string)
-{
- void *value = NULL;
-
- if ((key != NULL) && (string != NULL) && (string[0] != NULL)) {
- if (strcmp(key, NS_KEY_BSDADDR) == 0) {
- value = (void *)string_to_bsd_addr(string);
- } else if ((strcmp(key, NS_KEY_ALL) == 0) ||
- (strcmp(key, NS_KEY_GROUP) == 0)) {
- value = (void *)strsplit(string, ",");
- } else {
- value = (void *)string;
- }
- }
-
- return (value);
-}
-
-static void
-split_name(char *name, const char *delimiter, char **p1, char **p2, char **p3)
-{
- char *tmp, *junk = NULL;
-
- if (p1 != NULL)
- *p1 = NULL;
- if (p2 != NULL)
- *p2 = NULL;
- if (p3 != NULL)
- *p3 = NULL;
-
- if ((name == NULL) || (delimiter == NULL)) {
- syslog(LOG_DEBUG, "split_name(): name/delimter invalid\n");
- return;
- }
-
- for (tmp = (char *)strtok_r(name, delimiter, &junk); tmp != NULL;
- tmp = (char *)strtok_r(NULL, delimiter, &junk))
- if ((p1 != NULL) && (*p1 == NULL))
- *p1 = tmp;
- else if ((p2 != NULL) && (*p2 == NULL)) {
- *p2 = tmp;
- if (p3 == NULL)
- break;
- } else if ((p3 != NULL) && (*p3 == NULL)) {
- *p3 = tmp;
- break;
- }
-}
-
-/*
- * This implements support for printer names that are fully resolvable
- * on their own. These "complete" names are converted into a ns_printer_t
- * structure containing an appropriate "bsdaddr" attribute. The supported
- * formats are as follows:
- * POSIX style (server:printer[:conformance]).
- * This format is an adaptation of the format originally
- * described in POSIX 1387.4. The POSIX draft has since been
- * squashed, but this particular component lives on. The
- * conformace field has been added to allow further identification
- * of the the server.
- */
-ns_printer_t *
-posix_name(const char *name)
-{
- ns_printer_t *printer = NULL;
- char *tmp = NULL;
-
- if ((name != NULL) && ((tmp = strpbrk(name, ":")) != NULL)) {
- char *server = NULL;
- char *queue = NULL;
- char *extension = NULL;
- char *addr = strdup(name);
- char buf[BUFSIZ];
-
- if (*tmp == ':')
- split_name(addr, ": \t", &server, &queue, &extension);
-
- memset(buf, 0, sizeof (buf));
- if ((server != NULL) && (queue != NULL))
- snprintf(buf, sizeof (buf), "%s,%s%s%s", server,
- queue, (extension != NULL ? "," : ""),
- (extension != NULL ? extension : ""));
-
- /* build the structure here */
- if (buf[0] != NULL) {
- ns_kvp_t **list, *kvp;
-
- kvp = ns_kvp_create(NS_KEY_BSDADDR, buf);
- list = (ns_kvp_t **)list_append(NULL, kvp);
- if (list != NULL)
- printer = ns_printer_create(strdup(name), NULL,
- "posix", list);
- }
- }
-
- return (printer);
-}
-
-/*
- * FUNCTION:
- * int ns_bsd_addr_cmp(ns_bsd_addr_t *at, ns_bsd_addr_t *a2)
- * INPUTS:
- * ns_bsd_addr_t *a1 - a bsd addr
- * ns_bsd_addr_t *21 - another bsd addr
- * DESCRIPTION:
- * This functions compare 2 bsd_addr structures to determine if the
- * information in them is the same.
- */
-static int
-ns_bsd_addr_cmp(ns_bsd_addr_t *a1, ns_bsd_addr_t *a2)
-{
- int rc;
-
- if ((a1 == NULL) || (a2 == NULL))
- return (1);
-
- if ((rc = strcmp(a1->server, a2->server)) != 0)
- return (rc);
-
- if ((a1->printer == NULL) || (a2->printer == NULL))
- return (a1->printer != a2->printer);
-
- return (strcmp(a1->printer, a2->printer));
-}
-
-
-
-
-/*
- * FUNCTION: ns_bsd_addr_cmp_local()
- *
- * DESCRIPTION: This function compares 2 bsd_addr structures to determine if
- * the information in them is the same. It destinquishes between
- * real printer names and alias names while doing the compare.
- *
- * INPUTS: ns_bsd_addr_t *a1 - a bsd addr
- * ns_bsd_addr_t *21 - another bsd addr
- */
-
-static int
-ns_bsd_addr_cmp_local(ns_bsd_addr_t *a1, ns_bsd_addr_t *a2)
-
-{
- int rc;
-
- if ((a1 == NULL) || (a2 == NULL))
- {
- return (1);
- }
-
- if ((rc = strcmp(a1->server, a2->server)) != 0)
- {
- return (rc);
- }
-
- if ((a1->printer == NULL) || (a2->printer == NULL))
- {
- return (a1->printer != a2->printer);
- }
-
- rc = strcmp(a1->printer, a2->printer);
- if (rc == 0)
- {
- /*
- * The printer's real names are the same, but now check if
- * their local names (alias) are the same.
- */
- rc = strcmp(a1->pname, a2->pname);
- }
-
- return (rc);
-} /* ns_bsd_addr_cmp_local */
-
-
-
-/*
- * FUNCTION:
- * ns_bsd_addr_t *ns_bsd_addr_get_name(char *name)
- * INPUTS:
- * char *name - name of printer to get address for
- * OUTPUTS:
- * ns_bsd_addr_t *(return) - the address of the printer
- * DESCRIPTION:
- * This function will get the BSD address of the printer specified.
- * it fills in the printer name if none is specified in the "name service"
- * as a convenience to calling functions.
- */
-ns_bsd_addr_t *
-ns_bsd_addr_get_name(char *name)
-{
- ns_printer_t *printer;
- ns_bsd_addr_t *addr = NULL;
-
- endprinterentry();
- if ((printer = ns_printer_get_name(name, NULL)) != NULL) {
- addr = ns_get_value(NS_KEY_BSDADDR, printer);
-
- if (addr != NULL && addr->printer == NULL)
- addr->printer = strdup(printer->name);
- if (addr != NULL) {
- /*
- * if the name given is not the same as that in the
- * this is an alias/remote name so put that into the
- * pname field otherwise duplicate the real printer
- * name
- */
- if (strcmp(name, printer->name) != 0) {
- addr->pname = strdup(name);
- } else {
- addr->pname = strdup(printer->name);
- }
- }
- }
-
- return (addr);
-}
-
-
-/*
- * FUNCTION:
- * ns_bsd_addr_t **ns_bsd_addr_get_list()
- * OUTPUT:
- * ns_bsd_addr_t **(return) - a list of bsd addresses for all printers
- * in all "name services"
- * DESCRIPTION:
- * This function will gather a list of all printer addresses in all
- * of the "name services". All redundancy is removed.
- */
-ns_bsd_addr_t **
-ns_bsd_addr_get_list(int unique)
-
-{
- ns_printer_t **printers;
- ns_bsd_addr_t **list = NULL;
- char **aliases = NULL;
-
- for (printers = ns_printer_get_list(NULL);
- printers != NULL && *printers != NULL; printers++) {
- ns_bsd_addr_t *addr;
-
- if (strcmp(NS_NAME_ALL, (*printers)->name) == 0)
- continue;
-
- if ((addr = ns_get_value(NS_KEY_BSDADDR, *printers)) != NULL) {
- if (addr->printer == NULL)
- addr->printer = strdup((*printers)->name);
- addr->pname = strdup((*printers)->name);
- }
-
- if (unique == UNIQUE)
- list =
- (ns_bsd_addr_t **)list_append_unique((void **)list,
- (void *)addr, (COMP_T)ns_bsd_addr_cmp);
- else
- if (unique == LOCAL_UNIQUE)
- list =
- (ns_bsd_addr_t **)list_append_unique((void **)list,
- (void *)addr, (COMP_T)ns_bsd_addr_cmp_local);
- else
- list = (ns_bsd_addr_t **)list_append((void **)list,
- (void *)addr);
-
- for (aliases = (*printers)->aliases;
- (aliases != NULL) && (*aliases != NULL); aliases++)
- {
- /*
- * Include any alias names that belong to the printer
- */
-
- if ((addr =
- ns_get_value(NS_KEY_BSDADDR, *printers)) != NULL)
- {
- if (addr->printer == NULL)
- {
- addr->printer = strdup(*aliases);
- }
- addr->pname = strdup(*aliases);
- }
-
- if (unique == UNIQUE)
- {
- list = (ns_bsd_addr_t **)
- list_append_unique((void **)list,
- (void *)addr, (COMP_T)ns_bsd_addr_cmp);
- }
- else
- if (unique == LOCAL_UNIQUE)
- {
- list = (ns_bsd_addr_t **)
- list_append_unique((void **)list,
- (void *)addr,
- (COMP_T)ns_bsd_addr_cmp_local);
- }
- else
- {
- list = (ns_bsd_addr_t **)
- list_append((void **)list, (void *)addr);
- }
- }
- }
-
- return (list);
-}
-
-
-
-
-/*
- * FUNCTION:
- * ns_bsd_addr_t **ns_bsd_addr_get_list()
- * OUTPUT:
- * ns_bsd_addr_t **(return) - a list of bsd addresses for "_all" printers
- * in the "name service"
- * DESCRIPTION:
- * This function will use the "_all" entry to find a list of printers and
- * addresses. The "default" printer is also added to the list.
- * All redundancy is removed.
- */
-ns_bsd_addr_t **
-ns_bsd_addr_get_all(int unique)
-{
- ns_printer_t *printer;
- ns_bsd_addr_t **list = NULL;
- char **printers;
- char *def = NULL;
-
- if (((def = (char *)getenv("PRINTER")) == NULL) &&
- ((def = (char *)getenv("LPDEST")) == NULL))
- def = NS_NAME_DEFAULT;
-
- list = (ns_bsd_addr_t **)list_append((void **)list,
- (void *)ns_bsd_addr_get_name(def));
-
- endprinterentry();
- if ((printer = ns_printer_get_name(NS_NAME_ALL, NULL)) == NULL)
- return (ns_bsd_addr_get_list(unique));
-
- for (printers = (char **)ns_get_value(NS_KEY_ALL, printer);
- printers != NULL && *printers != NULL; printers++) {
- ns_bsd_addr_t *addr;
-
- addr = ns_bsd_addr_get_name(*printers);
- if (addr != NULL)
- addr->pname = *printers;
- if (unique == UNIQUE)
- list =
- (ns_bsd_addr_t **)list_append_unique((void **)list,
- (void *)addr, (COMP_T)ns_bsd_addr_cmp);
- else
- list = (ns_bsd_addr_t **)list_append((void **)list,
- (void *)addr);
- }
-
- return (list);
-}
-
-ns_bsd_addr_t *
-ns_bsd_addr_get_default()
-{
- char *def = NULL;
- ns_bsd_addr_t *addr;
-
- if (((def = (char *)getenv("PRINTER")) == NULL) &&
- ((def = (char *)getenv("LPDEST")) == NULL)) {
- def = NS_NAME_DEFAULT;
- addr = ns_bsd_addr_get_name(def);
- if (addr != NULL) {
- addr->pname = def;
- return (addr);
- }
- }
-
- return (NULL);
-}
diff --git a/usr/src/lib/print/libprint/common/ns_cmn_kvp.c b/usr/src/lib/print/libprint/common/ns_cmn_kvp.c
deleted file mode 100644
index 3fdacd7e5d..0000000000
--- a/usr/src/lib/print/libprint/common/ns_cmn_kvp.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include <ns.h>
-#include <list.h>
-
-/*
- * Commonly Used routines...
- */
-
-/*
- * FUNCTION:
- * kvp_create(const char *key, const void *value)
- * INPUT(S):
- * const char *key
- * - key for key/value pair
- * const void *value
- * - value for key/value pair
- * OUTPUT(S):
- * ns_kvp_t * (return value)
- * - pointer to structure containing the key/value pair
- * DESCRIPTION:
- */
-ns_kvp_t *
-ns_kvp_create(const char *key, const char *value)
-{
- ns_kvp_t *kvp;
-
- if ((kvp = calloc(1, sizeof (*kvp))) != NULL) {
- kvp->key = strdup(key);
- kvp->value = (char *)value;
- }
- return (kvp);
-}
-
-void
-ns_kvp_destroy(ns_kvp_t *kvp)
-{
- if (kvp != NULL) {
- if (kvp->key != NULL)
- free(kvp->key);
- if (kvp->value != NULL)
- free(kvp->value);
- free(kvp);
- }
-}
-
-
-
-
-/*
- * FUNCTION:
- * ns_kvp_match_key(const ns_kvp_t *kvp, const char *key)
- * INPUT(S):
- * const ns_kvp_t *kvp
- * - key/value pair to check
- * const char *key
- * - key for matching
- * OUTPUT(S):
- * int (return value)
- * - 0 if matched
- * DESCRIPTION:
- */
-static int
-ns_kvp_match_key(const ns_kvp_t *kvp, char *key)
-{
- if ((kvp != NULL) && (kvp->key != NULL) && (key != NULL))
- return (strcmp(kvp->key, key));
- return (-1);
-}
-
-
-/*
- * FUNCTION:
- * ns_r_get_value(const char *key, const ns_printer_t *printer)
- * INPUT(S):
- * const char *key
- * - key for matching
- * const ns_printer_t *printer
- * - printer to glean this from
- * OUTPUT(S):
- * char * (return value)
- * - NULL, if not matched
- * DESCRIPTION:
- */
-static void *
-ns_r_get_value(const char *key, const ns_printer_t *printer, int level)
-{
- ns_kvp_t *kvp, **attrs;
-
- if ((key == NULL) || (printer == NULL) ||
- (printer->attributes == NULL))
- return (NULL);
-
- if (level++ == 16)
- return (NULL);
-
- /* find it right here */
- if ((kvp = list_locate((void **)printer->attributes,
- (COMP_T)ns_kvp_match_key, (void *)key)) != NULL) {
- void *value = string_to_value(key, kvp->value);
-
- /* fill in an empty printer for a bsdaddr */
- if (strcmp(key, NS_KEY_BSDADDR) == 0) {
- ns_bsd_addr_t *addr = value;
-
- if (addr->printer == NULL)
- addr->printer = strdup(printer->name);
- }
- return (value);
- }
-
- /* find it in a child */
- for (attrs = printer->attributes; attrs != NULL && *attrs != NULL;
- attrs++) {
- void *value = NULL;
-
- if ((strcmp((*attrs)->key, NS_KEY_ALL) == 0) ||
- (strcmp((*attrs)->key, NS_KEY_GROUP) == 0)) {
- char **printers;
-
- for (printers = string_to_value((*attrs)->key,
- (*attrs)->value);
- printers != NULL && *printers != NULL; printers++) {
- ns_printer_t *printer =
- ns_printer_get_name(*printers, NULL);
-
- if ((value = ns_r_get_value(key, printer,
- level)) != NULL)
- return (value);
- ns_printer_destroy(printer);
- }
- } else if (strcmp((*attrs)->key, NS_KEY_LIST) == 0) {
- ns_printer_t **printers;
-
- for (printers = string_to_value((*attrs)->key,
- (*attrs)->value);
- printers != NULL && *printers != NULL; printers++) {
- if ((value = ns_r_get_value(key, *printers,
- level)) != NULL)
- return (value);
- }
- } else if (strcmp((*attrs)->key, NS_KEY_USE) == 0) {
- char *string = NULL;
- ns_printer_t *printer =
- ns_printer_get_name((*attrs)->value, NULL);
- if ((value = ns_r_get_value(key, printer,
- level)) != NULL)
- string = value_to_string(string, value);
- if (string != NULL)
- value = string_to_value(key, string);
- ns_printer_destroy(printer);
- }
-
- if (value != NULL)
- return (value);
- }
-
- return (NULL);
-}
-
-
-/*
- * ns_get_value() gets the value of the passed in attribute from the passed
- * in printer structure. The value is returned in a converted format.
- */
-void *
-ns_get_value(const char *key, const ns_printer_t *printer)
-{
- return (ns_r_get_value(key, printer, 0));
-}
-
-
-/*
- * ns_get_value_string() gets the value of the key passed in from the
- * printer structure passed in. The results is an ascii string.
- */
-char *
-ns_get_value_string(const char *key, const ns_printer_t *printer)
-{
- return ((char *)value_to_string(key, ns_get_value(key, printer)));
-}
-
-
-/*
- * ns_set_value() sets the passed in kvp in the passed in printer structure,
- * This is done by converting the value to a string first.
- */
-int
-ns_set_value(const char *key, const void *value, ns_printer_t *printer)
-{
- return (ns_set_value_from_string(key,
- value_to_string(key, (void *)value), printer));
-}
-
-
-/*
- * ns_set_value_from_string() sets the passed in kvp in the passed in printer
- * structure.
- */
-int
-ns_set_value_from_string(const char *key, const char *string,
- ns_printer_t *printer)
-{
- if (printer == NULL)
- return (-1);
-
- if (key == NULL)
- list_iterate((void **)printer->attributes,
- (VFUNC_T)ns_kvp_destroy);
- else {
- ns_kvp_t *kvp;
-
- if (((kvp = list_locate((void **)printer->attributes,
- (COMP_T)ns_kvp_match_key,
- (void *)key)) == NULL) &&
- ((kvp = calloc(1, sizeof (*kvp))) != NULL)) {
- kvp->key = strdup(key);
- printer->attributes = (ns_kvp_t **)
- list_append((void **)printer->attributes, kvp);
- }
- if (string != NULL)
- kvp->value = strdup(string);
- else
- kvp->value = NULL;
- }
-
- return (0);
-}
diff --git a/usr/src/lib/print/libprint/common/ns_cmn_printer.c b/usr/src/lib/print/libprint/common/ns_cmn_printer.c
deleted file mode 100644
index 25e344b3c4..0000000000
--- a/usr/src/lib/print/libprint/common/ns_cmn_printer.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*LINTLIBRARY*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <string.h>
-#include <syslog.h>
-
-#include <ns.h>
-#include <list.h>
-
-extern void ns_kvp_destroy(ns_kvp_t *);
-
-/*
- * Commonly Used routines...
- */
-
-/*
- * FUNCTION:
- * printer_create(char *name, char **aliases, char *source,
- * ns_kvp_t **attributes)
- * INPUT(S):
- * char *name
- * - primary name of printer
- * char **aliases
- * - aliases for printer
- * char *source
- * - name service derived from
- * ks_kvp_t **attributes
- * - key/value pairs
- * OUTPUT(S):
- * ns_printer_t * (return value)
- * - pointer to printer object structure
- * DESCRIPTION:
- */
-ns_printer_t *
-ns_printer_create(char *name, char **aliases, char *source,
- ns_kvp_t **attributes)
-{
- ns_printer_t *printer;
-
- if ((printer = (ns_printer_t *)calloc(1, sizeof (*printer))) != NULL) {
- printer->name = (char *)name;
- printer->aliases = (char **)aliases;
- printer->source = (char *)source;
- printer->attributes = (ns_kvp_t **)attributes;
- }
- return (printer);
-}
-
-
-static int
-ns_strcmp(char *s1, char *s2)
-{
- return (strcmp(s1, s2) != 0);
-}
-
-
-/*
- * FUNCTION:
- * ns_printer_match_name(const ns_printer_t *printer, const char *name)
- * INPUT(S):
- * const ns_printer_t *printer
- * - key/value pair to check
- * const char *key
- * - key for matching
- * OUTPUT(S):
- * int (return value)
- * - 0 if matched
- * DESCRIPTION:
- */
-int
-ns_printer_match_name(ns_printer_t *printer, const char *name)
-{
- if ((printer == NULL) || (printer->name == NULL) || (name == NULL))
- return (-1);
-
- if ((strcmp(printer->name, name) == 0) ||
- (list_locate((void **)printer->aliases,
- (COMP_T)ns_strcmp, (void *)name) != NULL))
- return (0);
-
- return (-1);
-}
-
-
-static void
-_ns_append_printer_name(const char *name, va_list ap)
-{
- char *buf = va_arg(ap, char *);
- int bufsize = va_arg(ap, int);
-
- if (name == NULL)
- return;
-
- (void) strlcat(buf, name, bufsize);
- (void) strlcat(buf, "|", bufsize);
-}
-
-/*
- * FUNCTION:
- * char *ns_printer_name_list(const ns_printer_t *printer)
- * INPUT:
- * const ns_printer_t *printer - printer object to generate list from
- * OUTPUT:
- * char * (return) - a newly allocated string containing the names of
- * the printer
- */
-char *
-ns_printer_name_list(const ns_printer_t *printer)
-{
- char buf[BUFSIZ];
-
- if ((printer == NULL) || (printer->name == NULL))
- return (NULL);
-
- if (snprintf(buf, sizeof (buf), "%s|", printer->name) >= sizeof (buf)) {
- syslog(LOG_ERR, "ns_printer_name:buffer overflow");
- return (NULL);
- }
-
- list_iterate((void **)printer->aliases,
- (VFUNC_T)_ns_append_printer_name, buf, sizeof (buf));
-
- buf[strlen(buf) - 1] = (char)NULL;
-
- return (strdup(buf));
-}
diff --git a/usr/src/lib/print/libprint/common/nss_convert.c b/usr/src/lib/print/libprint/common/nss_convert.c
deleted file mode 100644
index eaee6df5b2..0000000000
--- a/usr/src/lib/print/libprint/common/nss_convert.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * This file contains routines necessary to convert a string buffer into
- * a printer object.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <string.h>
-#include <stdarg.h>
-#include <syslog.h>
-
-#include <ns.h>
-#include <list.h>
-
-#define ESCAPE_CHARS "\\\n=:" /* \, \n, =, : */
-
-/*
- * Just like strncat(3C), but escapes the supplied characters.
- * This allows the escape character '\' and seperators to be part of the
- * keys or values.
- */
-char *
-strncat_escaped(char *d, char *s, int len, char *escape)
-{
- char *t = d;
-
- while ((*t != NULL) && (len > 0))
- len--, t++;
-
- if (escape == NULL)
- escape = "\\";
-
- while ((*s != NULL) && (len > 0)) {
- if (strchr(escape, *s) != NULL)
- len--, *t++ = '\\';
- len--, *t++ = *s++;
- }
- *t = NULL;
-
- return (d);
-}
-
-
-
-char *
-_cvt_printer_to_entry(ns_printer_t *printer, char *buf, int buflen)
-{
- int i, len;
- int bufferok = 1;
-
- (void) memset(buf, NULL, buflen);
-
- if ((printer == NULL) || (printer->attributes == NULL))
- return (NULL);
-
- if (snprintf(buf, buflen, "%s", printer->name) >= buflen) {
- (void) memset(buf, NULL, buflen);
- syslog(LOG_ERR, "_cvt_printer_to_entry: buffer overflow");
- return (NULL);
- }
-
- if ((printer->aliases != NULL) && (printer->aliases[0] != NULL)) {
- char **alias = printer->aliases;
-
- while (*alias != NULL) {
- (void) strlcat(buf, "|", buflen);
- (void) strncat_escaped(buf, *alias++, buflen,
- ESCAPE_CHARS);
- }
- }
-
- if (strlcat(buf, ":", buflen) >= buflen) {
- (void) memset(buf, NULL, buflen);
- syslog(LOG_ERR, "_cvt_printer_to_entry: buffer overflow");
- return (NULL);
- }
-
- len = strlen(buf);
-
- for (i = 0; printer->attributes[i] != NULL && bufferok; i++) {
- ns_kvp_t *kvp = printer->attributes[i];
-
- if (kvp->value == NULL)
- continue;
- (void) strlcat(buf, "\\\n\t:", buflen);
- (void) strncat_escaped(buf, kvp->key, buflen, ESCAPE_CHARS);
- (void) strlcat(buf, "=", buflen);
- (void) strncat_escaped(buf, kvp->value, buflen, ESCAPE_CHARS);
- if (strlcat(buf, ":", buflen) >= buflen) {
- bufferok = 0;
- }
- }
-
- if (!bufferok) {
- (void) memset(buf, NULL, buflen);
- syslog(LOG_ERR, "_cvt_printer_to_entry: buffer overflow");
- return (NULL);
- }
-
- if (strlen(buf) == len) { /* there were no attributes */
- (void) memset(buf, NULL, buflen);
- buf = NULL;
- }
-
- return (buf);
-}
-
-
-ns_printer_t *
-_cvt_nss_entry_to_printer(char *entry, char *ns)
-{
- char *name = NULL,
- *key = NULL,
- **aliases = NULL,
- *cp,
- buf[BUFSIZ];
- int in_namelist = 1, buf_pos = 0;
- ns_printer_t *printer = NULL;
-
- if (entry == NULL)
- return (NULL);
-
- (void) memset(buf, NULL, sizeof (buf));
- for (cp = entry; *cp != NULL; cp++) {
- switch (*cp) {
- case ':': /* end of kvp */
- if (in_namelist != 0) {
- if (name == NULL)
- name = strdup(buf);
- else
- aliases = (char **)list_append(
- (void **)aliases,
- (void *)strdup(buf));
- printer = (ns_printer_t *)ns_printer_create(
- name, aliases, ns, NULL);
- in_namelist = 0;
- } else if (key != NULL)
- (void) ns_set_value_from_string(key, buf,
- printer);
- (void) memset(buf, NULL, sizeof (buf));
- buf_pos = 0;
- key = NULL;
- break;
- case '=': /* kvp seperator */
- if (key == NULL) {
- key = strdup(buf);
- (void) memset(buf, NULL, sizeof (buf));
- buf_pos = 0;
- } else
- buf[buf_pos++] = *cp;
- break;
- case '|': /* namelist seperator */
- if (in_namelist != 0) {
- if (name == NULL)
- name = strdup(buf);
- else
- aliases = (char **)list_append(
- (void **)aliases,
- (void *)strdup(buf));
- (void) memset(buf, NULL, sizeof (buf));
- buf_pos = 0;
- } else /* add it to the buffer */
- buf[buf_pos++] = *cp;
- break;
- case '\\': /* escape char */
- buf[buf_pos++] = *(++cp);
- break;
- default:
- buf[buf_pos++] = *cp;
- }
-
- }
-
- if (key != NULL)
- (void) ns_set_value_from_string(key, buf, printer);
-
- return (printer);
-}
diff --git a/usr/src/lib/print/libprint/common/nss_ldap.c b/usr/src/lib/print/libprint/common/nss_ldap.c
deleted file mode 100644
index c2140d5048..0000000000
--- a/usr/src/lib/print/libprint/common/nss_ldap.c
+++ /dev/null
@@ -1,2477 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdarg.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <errno.h>
-#include <pwd.h>
-#include <libintl.h>
-#include <netdb.h> /* for rcmd() */
-
-#include <ns.h>
-#include <list.h>
-
-#define LDAP_REFERRALS
-#include <lber.h>
-#include <ldap.h>
-#include <sys/systeminfo.h>
-
-
-/*
- * This modules contains the code required to manipulate printer objects in
- * a LDAP directory for the Naming Service (NS) switch.
- * It can "add", "modify" and "delete" the objects on the given ldap server
- * and in the given NS domain DN, eg. "dc=mkg,dc=sun,dc=com".
- * Note: printers known to the naming service are contained in the RDN
- * "ou=printers" under the NS domain DN
- */
-
-#define PCONTAINER "ou=printers"
-
-/* attribute keywords */
-#define ATTR_DN "dn"
-#define ATTR_OCLASS "objectClass"
-#define ATTR_URI "printer-uri"
-#define ATTR_PNAME "printer-name"
-#define ATTR_XRISUP "printer-xri-supported"
-#define ATTR_BSDADDR "sun-printer-bsdaddr"
-#define ATTR_KVP "sun-printer-kvp"
-
-/* objectClass values */
-#define OCV_TOP "top"
-#define OCV_PSERVICE "printerService"
-#define OCV_SUNPRT "sunPrinter"
-#define OCV_PABSTRACT "printerAbstract"
-
-/* xri-supported attribute value */
-#define AV_UNKNOWN "unknown"
-
-
-/*
- * LDAP objectclass atributes that the user can explicity change
- */
-
-static const char *nsl_attr_printerService[] = {
- "printer-uri",
- "printer-xri-supported",
- /* Not allowed "printer-name", */
- "printer-natural-language-configured",
- "printer-location",
- "printer-info",
- "printer-more-info",
- "printer-make-and-model",
- "printer-charset-configured",
- "printer-charset-supported",
- "printer-generated-natural-language-supported",
- "printer-document-format-supported",
- "printer-color-supported",
- "printer-compression-supported",
- "printer-pages-per-minute",
- "printer-pages-per-minute-color",
- "printer-finishings-supported",
- "printer-number-up-supported",
- "printer-sides-supported",
- "printer-media-supported",
- "printer-media-local-supported",
- "printer-resolution-supported",
- "printer-print-quality-supported",
- "printer-job-priority-supported",
- "printer-copies-supported",
- "printer-job-k-octets-supported",
- "printer-current-operator",
- "printer-service-person",
- "printer-delivery-orientation-supported",
- "printer-stacking-order-supported",
- "printer-output-features-supported",
- (char *)NULL
-};
-
-
-static const char *nsl_attr_printerIPP[] = {
- "printer-ipp-versions-supported",
- "printer-multiple-document-jobs-supported",
- (char *)NULL
-};
-
-static const char *nsl_attr_sunPrinter[] = {
- /* Not allowed "sun-printer-bsdaddr", */
- /* Not allowed "sun-printer-kvp", */
- (char *)NULL
-};
-
-
-/*
- * List of LDAP attributes that user is not allowed to explicitly change
- */
-static const char *nsl_attr_notAllowed[] = {
- ATTR_DN,
- ATTR_OCLASS, /* objectclass */
- ATTR_PNAME, /* printer-name */
- ATTR_BSDADDR,
- ATTR_KVP,
- (char *)NULL
-};
-
-
-static NSL_RESULT _connectToLDAP(ns_cred_t *cred, LDAP **ld);
-static uchar_t *_constructPrinterDN(uchar_t *printerName,
- uchar_t *domainDN, char **attrList);
-static NSL_RESULT _checkPrinterExists(LDAP *ld, uchar_t *printerName,
- uchar_t *domainDN, uchar_t **printerDN);
-static NSL_RESULT _checkPrinterDNExists(LDAP *ld, uchar_t *objectDN);
-static NSL_RESULT _checkSunPrinter(LDAP *ld, uchar_t *printerDN);
-static NSL_RESULT _addNewPrinterObject(LDAP *ld, uchar_t *printerName,
- uchar_t *domainDN, char **attrList);
-static NSL_RESULT _modifyPrinterObject(LDAP *ld, uchar_t *printerDN,
- uchar_t *printerName, uchar_t *domainDN, char **attrList);
-static NSL_RESULT _checkAttributes(char **list);
-static NSL_RESULT _addLDAPmodValue(LDAPMod ***attrs, char *type, char *value);
-static NSL_RESULT _modLDAPmodValue(LDAPMod ***attrs, char *type, char *value);
-static NSL_RESULT _constructAddLDAPMod(uchar_t *printerName,
- char **attrList, LDAPMod ***attrs);
-static NSL_RESULT _constructModLDAPMod(uchar_t *printerName, int sunPrinter,
- char **attrList, char ***oldKVPList, LDAPMod ***attrs);
-static NSL_RESULT _compareURIinDNs(uchar_t *dn1, uchar_t *dn2);
-static uchar_t *_getThisNSDomainDN(void);
-static int _popen(char *cmd, char *results, int size);
-static int _attrInList(char *attr, const char **list);
-static int _attrInLDAPList(char *attr);
-static NSL_RESULT _getCurrentKVPValues(LDAP *ld,
- uchar_t *objectDN, char ***list);
-static void _freeList(char ***list);
-static NSL_RESULT _modAttrKVP(char *value, char ***kvpList);
-static NSL_RESULT _attrAddKVP(LDAPMod ***attrs, char **kvpList, int kvpExists);
-static int _manageReferralCredentials(LDAP *ld, char **dn, char **credp,
- int *methodp, int freeit);
-
-/*
- * *****************************************************************************
- *
- * Function: ldap_put_printer()
- *
- * Description: Action the request to change a printer object in the LDAP
- * directory DIT. The object is either added, modified or deleted
- * depending on the request's attribute list. A null list indicates
- * the request is a delete.
- * The object's DN is constructed from the supplied domain DN and
- * a check is done to see if the object exists already, if it
- * doesn't exist then this is a request to add a new object
- * If a URI is given in the attribute list and it is different to
- * the existing printing object's DN then the request will be
- * rejected.
- *
- *
- * Parameters:
- * Input: const ns_printer_t *printer
- * - this structure contains the following :
- * char *printerName - name of the printer
- * ns_cred_t *cred - structure containing the ldap host and
- * port, user, password and NS domain DN for the
- * directory server to be updated.
- * char **attrList - pointer to a list of attribute key values
- * for the printer object. If the object does
- * not already exist then this list contains the
- * values for the new object, otherwise this list
- * is a list of attributes to modify. For modify
- * a null attribute value is a attribute delete
- * request. A NULL ptr = delete the object.
- * Output: None
- *
- * Returns: int - 0 = request actioned okay
- * !0 = error - see NSL_RESULT codes
- *
- * *****************************************************************************
- */
-
-int
-ldap_put_printer(const ns_printer_t *printer)
-
-{
- NSL_RESULT result = NSL_OK;
- NSL_RESULT printerExists = NSL_ERR_UNKNOWN_PRINTER;
- LDAP *ld = NULL;
- uchar_t *printerDN = NULL;
- uchar_t *domainDN = NULL;
- char *printerName = NULL;
- ns_cred_t *cred = NULL;
- char **attrList = NULL;
-
- /* -------- */
-
- /*
- * Note: the "attributes" list should be null for ldap as the attribute
- * values are passed in the nsdata field
- */
-
- if ((printer != NULL) &&
- (printer->attributes == NULL) && (printer->name != NULL))
- {
- /* extract required pointer values from structure */
-
- printerName = printer->name;
- cred = printer->cred;
- if (printer->nsdata != NULL)
- {
- attrList = ((NS_LDAPDATA *)(printer->nsdata))->attrList;
- }
-
- /* connect and bind to the ldap directory server */
-
- result = _connectToLDAP(cred, &ld);
- if ((result == NSL_OK) && (ld != NULL))
- {
- /*
- * check if the NS domain DN was given, if not use the
- * current NS domain
- */
-
- if (cred->domainDN != NULL)
- {
- domainDN = (uchar_t *)
- strdup((char *)cred->domainDN);
- }
- else
- {
- /* get DN of current domain */
- domainDN = _getThisNSDomainDN();
- }
-
- printerExists =
- _checkPrinterExists(ld, (uchar_t *)printerName,
- domainDN, &printerDN);
- if (printerExists != LDAP_SUCCESS)
- {
- /*
- * could not find the printer by printer-name,
- * but there could be a non sunPrinter object
- * so if the printer-uri was given check if
- * an object for that exists
- */
- printerDN =
- _constructPrinterDN(NULL,
- domainDN, attrList);
- if (printerDN != NULL)
- {
- printerExists = _checkPrinterDNExists(
- ld, printerDN);
- }
- }
-#ifdef DEBUG
-if (printerExists == NSL_OK)
-{
-printf("DN found = '%s' for '%s'\n", printerDN, printerName);
-}
-#endif
-
- if (attrList == NULL)
- {
- /*
- * a null list indicates that this is a DELETE
- * object request, so if object exists delete
- * it, otherwise report an error.
- */
- if (printerExists == LDAP_SUCCESS)
- {
- result = ldap_delete_s(ld,
- (char *)printerDN);
- if (result != LDAP_SUCCESS)
- {
- result = NSL_ERR_DEL_FAILED;
-#ifdef DEBUG
-ldap_perror(ld, "ldap_delete_s failed");
-#endif
- }
- }
- else
- {
- result = NSL_ERR_UNKNOWN_PRINTER;
- }
- }
- else
- {
- /*
- * if object exists then this is a
- * modify request otherwise is is an add request
- */
-
- if (printerExists == LDAP_SUCCESS)
- {
- /*
- * Modify the printer object to
- * give it the new attribute values
- * specified by the user
- */
- result =
- _modifyPrinterObject(ld, printerDN,
- (uchar_t *)printerName,
- domainDN, attrList);
- }
- else
- {
- /*
- * add new printer object into the
- * ldap directory with the user
- * specified attribute values
- */
- result =
- _addNewPrinterObject(ld,
- (uchar_t *)printerName,
- domainDN, attrList);
- }
- }
-
- if (printerDN != NULL)
- {
- free(printerDN);
- }
- if (domainDN != NULL)
- {
- free(domainDN);
- }
-
- /* disconnect from LDAP server */
-
- (void) ldap_unbind(ld);
- }
- }
-
- else
- {
- /* no printerName given */
- result = NSL_ERR_INTERNAL;
- }
-
- return ((int)result);
-} /* ldap_put_printer */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _connectToLDAP()
- *
- * Description: Setup the connection and bind to the LDAP directory server.
- * The function returns the ldap connection descriptor
- *
- * Note: Currently the native ldap functions do not support secure
- * passwords, when this is supported this function will require
- * updating to allow the type passed in cred->passwdType to
- * be used with the ldap_simple_bind()
- *
- * Parameters:
- * Input: ns_cred_t *cred - structure containing the credentials (host,
- * port, user and password) required to bind
- * to the directory server to be updated.
- * char *printerName - printer name used only for error messages
- * Output: LDAP** - ldap connection descriptor pointer. NULL = failed
- *
- * Returns: NSL_RESULT - NSL_OK = connected okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_connectToLDAP(ns_cred_t *cred, LDAP **ld)
-
-{
- NSL_RESULT result = NSL_OK;
- int lresult = 0;
- int ldapPort = LDAP_PORT; /* default LDAP port number */
- int protoVersion = LDAP_VERSION3;
- int derefOption = LDAP_DEREF_NEVER;
- int referrals = 1;
- char hostname[MAXHOSTNAMELEN];
- int tmpMethod = LDAP_AUTH_SIMPLE; /* temp - until its passed in */
-
- /* -------- */
-
- if ((ld == NULL) || (cred == NULL) ||
- ((cred->passwd == NULL) || (cred->binddn == NULL)))
- {
- result = NSL_ERR_CREDENTIALS;
- }
-
- else
- {
- *ld = NULL;
-
- /* if host was not given then bind to local host */
-
- if (cred->host != NULL)
- {
- (void) strlcpy(hostname, cred->host, sizeof (hostname));
- }
- else
- {
- (void) sysinfo(SI_HOSTNAME,
- hostname, sizeof (hostname));
- }
-
- /* initialise the connection to the ldap server */
-
- if (cred->port != 0)
- {
- ldapPort = cred->port;
- }
- *ld = ldap_init(hostname, ldapPort);
- if (*ld == NULL)
- {
- /* connection setup failed */
- result = NSL_ERR_CONNECT;
-#ifdef DEBUG
-(void) perror("ldap_init");
-#endif
- }
- else
- {
- /* set ldap options */
-
- (void) ldap_set_option(*ld, LDAP_OPT_DEREF,
- &derefOption);
- (void) ldap_set_option(*ld, LDAP_OPT_PROTOCOL_VERSION,
- &protoVersion);
- (void) ldap_set_option(*ld, LDAP_OPT_REFERRALS,
- &referrals);
-
- /* bind to the user DN in the directory */
-
- /* cred->passwdType is currently not supported */
-
- lresult = ldap_simple_bind_s(*ld,
- cred->binddn, cred->passwd);
-
- /*
- * before doing anything else, set up the function to
- * call to get authentication details if the
- * ldap update function calls (eg. ldap_add_s()) get a
- * "referral" (to another ldap server) from the
- * original ldap server, eg. if we are trying to do
- * a update on a LDAP replica server.
- */
- (void) _manageReferralCredentials(*ld,
- &(cred->binddn), &(cred->passwd),
- &tmpMethod, -1);
- ldap_set_rebind_proc(*ld,
- (LDAP_REBINDPROC_CALLBACK *)
- _manageReferralCredentials, NULL);
-
- if (lresult != LDAP_SUCCESS)
- {
- result = NSL_ERR_BIND;
- *ld = NULL;
-#ifdef DEBUG
-(void) ldap_perror(*ld, "ldap_simple_bind_s");
-#endif
- }
- }
- }
-
- return (result);
-} /* _connectToLDAP */
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _constructPrinterDN()
- *
- * Description: Construct the DN for the printer object from its name and NS
- * domain DN. If the printer-uri is given in the attrList then
- * that is used instead of the printerName.
- *
- * Parameters:
- * Input: uchar_t *printerName
- * uchar_t *domainDN
- * char **attrList - this list is searched for printer-uri
- * Output: None
- *
- * Returns: uchar_t* - pointer to the DN, this memory is malloced so
- * must be freed using free() when finished with.
- *
- * *****************************************************************************
- */
-
-static uchar_t *
-_constructPrinterDN(uchar_t *printerName, uchar_t *domainDN, char **attrList)
-
-{
- uchar_t *dn = NULL;
- uchar_t *uri = NULL;
- char **p = NULL;
- int len = 0;
-
- /* ------- */
-
- /* first search for printer-uri in the attribute list */
-
- for (p = attrList; (p != NULL) && (*p != NULL) && (uri == NULL); p++)
- {
- /* get length of this key word */
-
- for (len = 0; ((*p)[len] != '=') && ((*p)[len] != '\0'); len++);
-
- if ((strncasecmp(*p, ATTR_URI, len) == 0) &&
- (strlen(*p) > len+1))
- {
- uri = (uchar_t *)&((*p)[len+1]);
- }
- }
-
-
- if (domainDN != NULL) {
- size_t size;
-
- /* malloc memory for the DN and then construct it */
-
- if ((uri == NULL) && (printerName != NULL))
- {
- /* use the printerName for the RDN */
-
- size = strlen(ATTR_URI) +
- strlen((char *)printerName) +
- strlen((char *)domainDN) +
- strlen(PCONTAINER) +
- 10; /* plus a few extra */
-
- if ((dn = malloc(size)) != NULL)
- (void) snprintf((char *)dn, size, "%s=%s,%s,%s",
- ATTR_URI, printerName, PCONTAINER, domainDN);
- }
- else
- if (uri != NULL)
- {
- /* use the URI for the RDN */
-
- size = strlen(ATTR_URI) +
- strlen((char *)uri) +
- strlen((char *)domainDN) +
- strlen(PCONTAINER) +
- 10; /* plus a few extra */
-
- if ((dn = malloc(size)) != NULL)
- (void) snprintf((char *)dn, size, "%s=%s,%s,%s",
- ATTR_URI, uri, PCONTAINER, domainDN);
- }
-
- /*
- * else
- * {
- * printName not given so return null
- * }
- */
-
- }
-
- return (dn); /* caller must free this memory */
-} /* _constructPrinterDN */
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _checkPrinterExists()
- *
- * Description: Check that the printer object for the printerName exists in the
- * directory DIT and then extract the object's DN
- * The function uses an exiting ldap connection and does a
- * search for the printerName in the supplied domain DN.
- *
- * Parameters:
- * Input: LDAP *ld - existing ldap connection descriptor
- * uchar_t *printerName - printer name
- * uchar_t *domainDN - DN of domain to search in
- * Output: uchar_t **printerDN - DN of the printer - the caller should
- * free this memory using free()
- *
- * Result: NSL_RESULT - NSL_OK = object exists
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_checkPrinterExists(LDAP *ld, uchar_t *printerName, uchar_t *domainDN,
- uchar_t **printerDN)
-
-{
- NSL_RESULT result = NSL_ERR_UNKNOWN_PRINTER;
- int sresult = LDAP_NO_SUCH_OBJECT;
- LDAPMessage *ldapMsg = NULL;
- char *requiredAttrs[2] = { ATTR_PNAME, NULL };
- LDAPMessage *ldapEntry = NULL;
- uchar_t *filter = NULL;
- uchar_t *baseDN = NULL;
-
- /* ---------- */
-
- if ((printerName != NULL) && (domainDN != NULL) && (printerDN != NULL))
- {
- size_t size;
-
- if (printerDN != NULL)
- {
- *printerDN = NULL;
- }
-
- /* search for this Printer in the directory */
-
- size = (3 + strlen((char *)printerName) + strlen(ATTR_PNAME) +
- 2);
-
- if ((filter = malloc(size)) != NULL)
- (void) snprintf((char *)filter, size, "(%s=%s)",
- ATTR_PNAME, (char *)printerName);
-
- size = (strlen((char *)domainDN) + strlen(PCONTAINER) + 5);
-
- if ((baseDN = malloc(size)) != NULL)
- (void) snprintf((char *)baseDN, size, "%s,%s",
- PCONTAINER, (char *)domainDN);
-
- sresult = ldap_search_s(ld, (char *)baseDN, LDAP_SCOPE_SUBTREE,
- (char *)filter, requiredAttrs, 0, &ldapMsg);
- if (sresult == LDAP_SUCCESS)
- {
- /* check that the object exists and extract its DN */
-
- ldapEntry = ldap_first_entry(ld, ldapMsg);
- if (ldapEntry != NULL)
- {
- /* object found - there should only be one */
- result = NSL_OK;
-
- if (printerDN != NULL)
- {
- *printerDN = (uchar_t *)
- ldap_get_dn(ld, ldapEntry);
- }
- }
-
- (void) ldap_msgfree(ldapMsg);
- }
- }
-
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- return (result);
-} /* _checkPrinterExists */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _checkPrinterDNExists()
- *
- * Description: Check that the printer object for the DN exists in the
- * directory DIT.
- * The function uses an exiting ldap connection and does a
- * search for the DN supplied.
- *
- * Parameters: LDAP *ld - existing ldap connection descriptor
- * char *objectDN - DN to search for
- *
- * Result: NSL_RESULT - NSL_OK = object exists
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_checkPrinterDNExists(LDAP *ld, uchar_t *objectDN)
-
-{
- NSL_RESULT result = NSL_ERR_UNKNOWN_PRINTER;
- int sresult = LDAP_NO_SUCH_OBJECT;
- LDAPMessage *ldapMsg;
- char *requiredAttrs[2] = { ATTR_PNAME, NULL };
- LDAPMessage *ldapEntry;
-
- /* ---------- */
-
- if ((ld != NULL) && (objectDN != NULL))
- {
- /* search for this Printer in the directory */
-
- sresult = ldap_search_s(ld, (char *)objectDN, LDAP_SCOPE_BASE,
- "(objectclass=*)", requiredAttrs, 0, &ldapMsg);
- if (sresult == LDAP_SUCCESS)
- {
- /* check that the object exists */
- ldapEntry = ldap_first_entry(ld, ldapMsg);
- if (ldapEntry != NULL)
- {
- /* object found */
- result = NSL_OK;
- }
-
- (void) ldap_msgfree(ldapMsg);
- }
- }
-
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- return (result);
-} /* _checkPrinterDNExists */
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _checkSunPrinter()
- *
- * Description: Check that the printer object for the printerDN is a sunPrinter
- * ie. it has the required objectclass attribute value.
- *
- * Parameters:
- * Input: LDAP *ld - existing ldap connection descriptor
- * Output: uchar_t *printerDN - DN of the printer
- *
- * Result: NSL_RESULT - NSL_OK = object exists and is a sunPrinter
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_checkSunPrinter(LDAP *ld, uchar_t *printerDN)
-
-{
- NSL_RESULT result = NSL_ERR_UNKNOWN_PRINTER;
- int sresult = LDAP_NO_SUCH_OBJECT;
- char *requiredAttrs[2] = { ATTR_PNAME, NULL };
- LDAPMessage *ldapMsg = NULL;
- LDAPMessage *ldapEntry = NULL;
- char *filter = NULL;
-
- /* ---------- */
-
- if ((ld != NULL) && (printerDN != NULL))
- {
- size_t size;
-
- /* search for this Printer in the directory */
-
- size = (3 + strlen(OCV_SUNPRT) + strlen(ATTR_OCLASS) + 2);
- if ((filter = malloc(size)) != NULL)
- (void) snprintf(filter, size, "(%s=%s)",
- ATTR_OCLASS, OCV_SUNPRT);
-
- sresult = ldap_search_s(ld, (char *)printerDN,
- LDAP_SCOPE_SUBTREE, filter,
- requiredAttrs, 0, &ldapMsg);
- if (sresult == LDAP_SUCCESS)
- {
- /* check that the printer object exists */
-
- ldapEntry = ldap_first_entry(ld, ldapMsg);
- if (ldapEntry != NULL)
- {
- /* object is a sunPrinter */
- result = NSL_OK;
- }
-
- (void) ldap_msgfree(ldapMsg);
- }
- }
-
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- return (result);
-} /* _checkSunPrinter */
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _addNewPrinterObject()
- *
- * Description: For the given printerName add a printer object into the
- * LDAP directory NS domain. The object is created with the
- * supplied attribute values. Note: if the printer's uri is
- * given that is used as the RDN otherwise the printer's
- * name is used as the RDN
- *
- * Parameters:
- * Input: LDAP *ld - existing ldap connection descriptor
- * uchar_t *printerName - Name of printer to be added
- * uchar_t *domainDN - DN of the domain to add the printer
- * char **attrList - user specified attribute values list
- * Output: None
- *
- * Returns: NSL_RESULT - NSL_OK = request actioned okay
- * !NSL_OK = error
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_addNewPrinterObject(LDAP *ld, uchar_t *printerName,
- uchar_t *domainDN, char **attrList)
-
-{
- NSL_RESULT result = NSL_ERR_ADD_FAILED;
- int lresult = 0;
- uchar_t *printerDN = NULL;
- LDAPMod **attrs = NULL;
-
- /* ---------- */
-
- if ((ld != NULL) && (printerName != NULL) && (domainDN != NULL) &&
- (attrList != NULL) && (attrList[0] != NULL))
- {
- result = _checkAttributes(attrList);
-
- if (result == NSL_OK)
- {
- /*
- * construct a DN for the printer from the
- * printerName and printer-uri if given.
- */
- printerDN = _constructPrinterDN(printerName,
- domainDN, attrList);
- if (printerDN != NULL)
- {
- /*
- * setup attribute values in an LDAPMod
- * structure and then add the object
- */
- result = _constructAddLDAPMod(printerName,
- attrList, &attrs);
- if (result == NSL_OK)
- {
- lresult = ldap_add_s(ld,
- (char *)printerDN, attrs);
- if (lresult == LDAP_SUCCESS)
- {
- result = NSL_OK;
- }
- else
- {
- result = NSL_ERR_ADD_FAILED;
-#ifdef DEBUG
-(void) ldap_perror(ld, "ldap_add_s");
-#endif
- }
-
- (void) ldap_mods_free(attrs, 1);
- }
- free(printerDN);
- }
-
- else
- {
- result = NSL_ERR_INTERNAL;
- }
- }
- }
-
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- return (result);
-} /* _addNewPrinterObject */
-
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _modifyPrinterObject()
- *
- * Description: Modify the given LDAP printer object to set the new attributes
- * in the attribute list. If the printer's URI (specified in the
- * attrList) changes the URI of the object the request is rejected.
- *
- * Parameters:
- * Input: LDAP *ld - existing ldap connection descriptor
- * uchar_t *printerDN - DN of printer object to modify
- * uchar_t *printerName - Name of printer to be modified
- * uchar_t *domainDN - DN of the domain the printer is in
- * char **attrList - user specified attribute values list
- * Output: None
- *
- * Returns: NSL_RESULT - NSL_OK = object modified okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_modifyPrinterObject(LDAP *ld, uchar_t *printerDN,
- uchar_t *printerName, uchar_t *domainDN, char **attrList)
-
-{
- NSL_RESULT result = NSL_ERR_INTERNAL;
- int lresult = 0;
- int sunPrinter = 0;
- uchar_t *uriDN = NULL;
- LDAPMod **attrs = NULL;
- char **kvpList = NULL;
-
- /* ---------- */
-
- if ((ld != NULL) && (printerDN != NULL) && (printerName != NULL) &&
- (domainDN != NULL) && (attrList != NULL) && (attrList[0] != NULL))
- {
- result = _checkAttributes(attrList);
-
- if (result == NSL_OK)
- {
- /*
- * The user may have requested that the printer object
- * be given a new URI RDN, so construct a DN for the
- * printer from the printerName or the printer-uri (if
- * given).
- */
- uriDN = _constructPrinterDN(NULL, domainDN, attrList);
-
- /*
- * compare the 2 DNs to see if the URI has changed,
- * if uriDN is null then the DN hasn't changed
- */
- if ((uriDN == NULL) || ((uriDN != NULL) &&
- (_compareURIinDNs(printerDN, uriDN) == NSL_OK)))
- {
- /*
- * setup the modify object LDAPMod
- * structure and then do the modify
- */
-
- if (_checkSunPrinter(ld, printerDN) == NSL_OK)
- {
- sunPrinter = 1;
- }
-
- (void) _getCurrentKVPValues(ld,
- printerDN, &kvpList);
-
- result = _constructModLDAPMod(printerName,
- sunPrinter, attrList,
- &kvpList, &attrs);
- _freeList(&kvpList);
-
- if ((result == NSL_OK) && (attrs != NULL))
- {
- lresult = ldap_modify_s(
- ld, (char *)printerDN, attrs);
- if (lresult == LDAP_SUCCESS)
- {
- result = NSL_OK;
- }
- else
- {
- result = NSL_ERR_MOD_FAILED;
-#ifdef DEBUG
-(void) ldap_perror(ld, "ldap_modify_s");
-#endif
- }
-
- (void) ldap_mods_free(attrs, 1);
- }
- }
- else
- {
- /*
- * printer-uri name change has been requested
- * this is NOT allowed as it requires that
- * a new printer object is created
- */
- result = NSL_ERR_RENAME; /* NOT ALLOWED */
- }
-
- if (uriDN != NULL)
- {
- free(uriDN);
- }
- }
- }
-
- return (result);
-} /* _modifyPrinterObject */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _checkAttributes()
- *
- * Description: Check that the given attribute lists does not contain any
- * key words that are not allowed.
- *
- * Parameters:
- * Input: char **list - attribute list to check
- * Output: None
- *
- * Returns: NSL_RESULT - NSL_OK = checked okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_checkAttributes(char **list)
-
-{
- NSL_RESULT result = NSL_OK;
- int len = 0;
- char *attr = NULL;
- char **p = NULL;
-
- /* ------ */
-
- for (p = list; (p != NULL) && (*p != NULL) && (result == NSL_OK); p++)
- {
- /* get length of this key word */
-
- for (len = 0; ((*p)[len] != '=') && ((*p)[len] != '\0'); len++);
-
- /* check if the key word is allowed */
-
- if (strncasecmp(*p, ATTR_KVP, len) == 0)
- {
- /* not supported through this interface */
- result = NSL_ERR_KVP;
- }
- else
- if (strncasecmp(*p, ATTR_BSDADDR, len) == 0)
- {
- /* not supported through this interface */
- result = NSL_ERR_BSDADDR;
- }
- else
- if (strncasecmp(*p, ATTR_PNAME, len) == 0)
- {
- /* not supported through this interface */
- result = NSL_ERR_PNAME;
- }
- else
- {
- /* check for any others */
-
- attr = strdup(*p);
- attr[len] = '\0'; /* terminate the key */
-
- if (_attrInList(attr, nsl_attr_notAllowed))
- {
- result = NSL_ERR_NOTALLOWED;
- }
- }
-
- }
-
- return (result);
-} /* _checkAttributes */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _addLDAPmodValue()
- *
- * Description: Add the given attribute and its value to the LDAPMod array.
- * If this is the first entry in the array then create it.
- *
- * Parameters:
- * Input: LDAPMod ***attrs - array to update
- * char *type - attribute to add into array
- * char *value - attribute value
- * Output: None
- *
- * Returns: NSL_RESULT - NSL_OK = added okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_addLDAPmodValue(LDAPMod ***attrs, char *type, char *value)
-
-{
- int i = 0;
- int j = 0;
- NSL_RESULT result = NSL_OK;
-
- /* ---------- */
-
- if ((attrs != NULL) && (type != NULL) && (value != NULL))
- {
-#ifdef DEBUG
-printf("_addLDAPmodValue() type='%s', value='%s'\n", type, value);
-#endif
- /* search the existing LDAPMod array for the attribute */
-
- for (i = 0; *attrs != NULL && (*attrs)[i] != NULL; i++)
- {
- if (strcasecmp((*attrs)[i]->mod_type, type) == 0)
- {
- break;
- }
- }
-
- if (*attrs == NULL)
- {
- /* array empty so create it */
-
- *attrs = (LDAPMod **)calloc(1, 2 * sizeof (LDAPMod *));
- if (*attrs != NULL)
- {
- i = 0;
- }
- else
- {
- result = NSL_ERR_MEMORY;
- }
-
- }
- else
- if ((*attrs)[i] == NULL)
- {
- *attrs = (LDAPMod **)
- realloc(*attrs, (i+2) * sizeof (LDAPMod *));
- if (*attrs == NULL)
- {
- result = NSL_ERR_MEMORY;
- }
- }
- }
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- if (result == NSL_OK)
- {
- if ((*attrs)[i] == NULL)
- {
- /* We've got a new slot. Create the new mod. */
-
- (*attrs)[i] = (LDAPMod *) malloc(sizeof (LDAPMod));
- if ((*attrs)[i] != NULL)
- {
- (*attrs)[i]->mod_op = LDAP_MOD_ADD;
- (*attrs)[i]->mod_type = strdup(type);
- (*attrs)[i]->mod_values = (char **)
- malloc(2 * sizeof (char *));
- if ((*attrs)[i]->mod_values != NULL)
- {
- (*attrs)[i]->mod_values[0] =
- strdup(value);
- (*attrs)[i]->mod_values[1] = NULL;
- (*attrs)[i+1] = NULL;
- }
- else
- {
- result = NSL_ERR_MEMORY;
- }
- }
- else
- {
- result = NSL_ERR_MEMORY;
- }
- }
-
- else
- {
- /* Found an existing entry so add value to it */
-
- for (j = 0; (*attrs)[i]->mod_values[j] != NULL; j++);
-
- (*attrs)[i]->mod_values =
- (char **)realloc((*attrs)[i]->mod_values,
- (j + 2) * sizeof (char *));
- if ((*attrs)[i]->mod_values != NULL)
- {
- (*attrs)[i]->mod_values[j] = strdup(value);
- (*attrs)[i]->mod_values[j+1] = NULL;
- }
- else
- {
- result = NSL_ERR_MEMORY;
- }
- }
- }
-
- return (result);
-} /* _addLDAPmodValue */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _modLDAPmodValue()
- *
- * Description: Add the given attribute modify operation and its value into
- * the LDAPMod array. This will either be a "replace" or a
- * "delete"; value = null implies a "delete".
- * If this is the first entry in the array then create it.
- *
- * Parameters:
- * Input: LDAPMod ***attrs - array to update
- * char *type - attribute to modify
- * char *value - attribute value, null implies "delete"
- * Output: None
- *
- * Returns: NSL_RESULT - NSL_OK = added okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_modLDAPmodValue(LDAPMod ***attrs, char *type, char *value)
-
-{
- int i = 0;
- int j = 0;
- NSL_RESULT result = NSL_OK;
-
- /* ---------- */
-
- if ((attrs != NULL) && (type != NULL))
- {
-#ifdef DEBUG
-if (value != NULL)
-printf("_modLDAPmodValue() REPLACE type='%s', value='%s'\n", type, value);
-else
-printf("_modLDAPmodValue() DELETE type='%s'\n", type);
-#endif
- /* search the existing LDAPMod array for the attribute */
-
- for (i = 0; *attrs != NULL && (*attrs)[i] != NULL; i++)
- {
- if (strcasecmp((*attrs)[i]->mod_type, type) == 0)
- {
- break;
- }
- }
-
- if (*attrs == NULL)
- {
- /* array empty so create it */
-
- *attrs = (LDAPMod **)calloc(1, 2 * sizeof (LDAPMod *));
- if (*attrs != NULL)
- {
- i = 0;
- }
- else
- {
- result = NSL_ERR_MEMORY;
- }
-
- }
- else
- if ((*attrs)[i] == NULL)
- {
- /* attribute not found in array so add slot for it */
-
- *attrs = (LDAPMod **)
- realloc(*attrs, (i+2) * sizeof (LDAPMod *));
- if (*attrs == NULL)
- {
- result = NSL_ERR_MEMORY;
- }
- }
- }
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- if (result == NSL_OK)
- {
- if ((*attrs)[i] == NULL)
- {
- /* We've got a new slot. Create the new mod entry */
-
- (*attrs)[i] = (LDAPMod *) malloc(sizeof (LDAPMod));
- if (((*attrs)[i] != NULL) && (value != NULL))
- {
- /* Do an attribute replace */
-
- (*attrs)[i]->mod_op = LDAP_MOD_REPLACE;
- (*attrs)[i]->mod_type = strdup(type);
- (*attrs)[i]->mod_values = (char **)
- malloc(2 * sizeof (char *));
- if ((*attrs)[i]->mod_values != NULL)
- {
- (*attrs)[i]->mod_values[0] =
- strdup(value);
- (*attrs)[i]->mod_values[1] = NULL;
- (*attrs)[i+1] = NULL;
- }
- else
- {
- result = NSL_ERR_MEMORY;
- }
- }
- else
- if ((*attrs)[i] != NULL)
- {
- /* value is null so do an attribute delete */
-
- (*attrs)[i]->mod_op = LDAP_MOD_DELETE;
- (*attrs)[i]->mod_type = strdup(type);
- (*attrs)[i]->mod_values = NULL;
- (*attrs)[i+1] = NULL;
- }
- else
- {
- result = NSL_ERR_MEMORY; /* malloc failed */
- }
- }
-
- else
- {
- /* Found an existing entry so add value to it */
-
- if (value != NULL)
- {
- /* add value to attribute's replace list */
-
- if ((*attrs)[i]->mod_op == LDAP_MOD_REPLACE)
- {
- for (j = 0;
- (*attrs)[i]->mod_values[j] != NULL; j++);
-
- (*attrs)[i]->mod_values =
- (char **)realloc((*attrs)[i]->mod_values,
- (j + 2) * sizeof (char *));
- if ((*attrs)[i]->mod_values != NULL)
- {
- (*attrs)[i]->mod_values[j] =
- strdup(value);
- (*attrs)[i]->mod_values[j+1] = NULL;
- }
- else
- {
- result = NSL_ERR_MEMORY;
- }
- }
- else
- {
- /* Delete and replace not allowed */
- result = NSL_ERR_MULTIOP;
- }
- }
-
- else
- {
- /*
- * attribute delete - so free any existing
- * entries in the value array
- */
-
- (*attrs)[i]->mod_op = LDAP_MOD_DELETE;
-
- if ((*attrs)[i]->mod_values != NULL)
- {
- for (j = 0;
- (*attrs)[i]->mod_values[j] != NULL;
- j++)
- {
- free((*attrs)[i]->mod_values[j]);
- }
-
- free((*attrs)[i]->mod_values);
- (*attrs)[i]->mod_values = NULL;
- }
- }
- }
- }
-
- return (result);
-} /* _modLDAPmodValue */
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _constructAddLDAPMod()
- *
- * Description: For the given attribute list construct an
- * LDAPMod array for the printer object to be added. Default
- * attribute values are included.
- *
- * Parameters:
- * Input:
- * uchar_t *printerName - Name of printer to be added
- * char **attrList - user specified attribute values list
- * Output: LDAPMod ***attrs - pointer to the constructed array
- *
- * Returns: NSL_RESULT - NSL_OK = constructed okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_constructAddLDAPMod(uchar_t *printerName, char **attrList, LDAPMod ***attrs)
-
-{
- NSL_RESULT result = NSL_ERROR;
- int len = 0;
- char **p = NULL;
- char *value = NULL;
- char *attr = NULL;
-
- /* ---------- */
-
- if ((printerName != NULL) &&
- ((attrList != NULL) && (attrList[0] != NULL)) && (attrs != NULL))
- {
- *attrs = NULL;
-
- /*
- * setup printer object attribute values in an LDAPMod structure
- */
- result = _addLDAPmodValue(attrs, ATTR_OCLASS, OCV_TOP);
- if (result == NSL_OK)
- {
- /* Structural Objectclass */
- result =
- _addLDAPmodValue(attrs, ATTR_OCLASS, OCV_PSERVICE);
- }
- if (result == NSL_OK)
- {
- result = _addLDAPmodValue(attrs,
- ATTR_OCLASS, OCV_PABSTRACT);
- }
- if (result == NSL_OK)
- {
- result = _addLDAPmodValue(attrs,
- ATTR_OCLASS, OCV_SUNPRT);
- }
- if (result == NSL_OK)
- {
- result = _addLDAPmodValue(attrs,
- ATTR_PNAME, (char *)printerName);
- }
-
- /*
- * Now work through the user supplied attribute
- * values list and add them into the LDAPMod array
- */
-
- for (p = attrList;
- (p != NULL) && (*p != NULL) && (result == NSL_OK); p++)
- {
- /* get length of this key word */
-
- for (len = 0;
- ((*p)[len] != '=') && ((*p)[len] != '\0'); len++);
-
- if ((strlen(*p) > len+1))
- {
- attr = strdup(*p);
- attr[len] = '\0';
- value = strdup(&attr[len+1]);
-
- /* handle specific Key Value Pairs (KVP) */
-
- if (strcasecmp(attr, NS_KEY_BSDADDR) == 0)
- {
- /* use LDAP attribute name */
- free(attr);
- attr = strdup(ATTR_BSDADDR);
- }
- else
- if (_attrInLDAPList(attr) == 0)
- {
- /*
- * Non-LDAP attribute so use LDAP
- * KVP attribute and the given KVP
- * as the value, ie.
- * sun-printer-kvp=description=printer
- */
- free(attr);
- attr = strdup(ATTR_KVP);
- value = strdup(*p);
- }
-
- /* add it into the LDAPMod array */
-
- result = _addLDAPmodValue(attrs, attr, value);
-
- free(attr);
- free(value);
- }
- } /* for */
-
- if ((result != NSL_OK) && (*attrs != NULL))
- {
- (void) ldap_mods_free(*attrs, 1);
- attrs = NULL;
- }
- }
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- return (result);
-} /* _constructAddLDAPMod */
-
-
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _constructModLDAPMod()
- *
- * Description: For the given modify attribute list, construct an
- * LDAPMod array for the printer object to be modified
- *
- * Parameters:
- * Input: uchar_t *printerName - name of printer to be modified
- * int sunPrinter - Boolean; object is a sunPrinter
- * char **attrList - user specified attribute values list
- * char ***oldKVPList - current list of KVP values on object
- * Output: LDAPMod ***attrs - pointer to the constructed array
- *
- * Returns: NSL_RESULT - NSL_OK = constructed okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_constructModLDAPMod(uchar_t *printerName, int sunPrinter, char **attrList,
- char ***oldKVPList, LDAPMod ***attrs)
-
-{
- NSL_RESULT result = NSL_OK;
- int len = 0;
- int kvpUpdated = 0;
- int kvpExists = 0;
- char **p = NULL;
- char *value = NULL;
- char *attr = NULL;
-
- /* ---------- */
-
- if ((printerName != NULL) &&
- ((attrList != NULL) && (attrList[0] != NULL)) && (attrs != NULL))
- {
- *attrs = NULL;
-
- if ((oldKVPList != NULL) && (*oldKVPList != NULL))
- {
- kvpExists = 1;
- }
-
- if (!sunPrinter)
- {
- /*
- * The object was previously not a sunPrinter, so
- * add the required objectclass attribute value, and
- * ensure it has the printername attribute.
- */
- result = _addLDAPmodValue(attrs,
- ATTR_OCLASS, OCV_SUNPRT);
- if (result == NSL_OK)
- {
- result = _modLDAPmodValue(attrs,
- ATTR_PNAME, (char *)printerName);
- }
- }
-
- /*
- * work through the user supplied attribute
- * values list and add them into the LDAPMod array depending
- * on if they are a replace or delete attribute operation,
- * a "null value" means delete.
- */
-
- for (p = attrList;
- (p != NULL) && (*p != NULL) && (result == NSL_OK); p++)
- {
- /* get length of this key word */
-
- for (len = 0;
- ((*p)[len] != '=') && ((*p)[len] != '\0'); len++);
-
- if ((strlen(*p) > len+1))
- {
- attr = strdup(*p);
- attr[len] = '\0';
- value = strdup(&attr[len+1]);
-
- /* handle specific Key Value Pairs (KVP) */
-
- if ((_attrInLDAPList(attr) == 0) &&
- (strcasecmp(attr, NS_KEY_BSDADDR) != 0))
- {
- /*
- * Non-LDAP attribute so use LDAP
- * KVP attribute and the given KVP as
- * the value, ie.
- * sun-printer-kvp=description=printer
- */
- result = _modAttrKVP(*p, oldKVPList);
- kvpUpdated = 1;
- }
-
- else
- {
- if (strcasecmp(attr, NS_KEY_BSDADDR) ==
- 0)
- {
- /*
- * use LDAP bsdaddr attribute
- * name
- */
- free(attr);
- attr = strdup(ATTR_BSDADDR);
- }
-
- /*
- * else
- * use the supplied attribute name
- */
-
- /* add it into the LDAPMod array */
-
- result = _modLDAPmodValue(attrs,
- attr, value);
- }
-
- free(attr);
- free(value);
- }
-
- else
- if (strlen(*p) >= 1)
- {
- /* handle attribute DELETE request */
-
- attr = strdup(*p);
- if (attr[len] == '=')
- {
- /* terminate "attribute=" */
- attr[len] = '\0';
- }
-
- /* handle specific Key Value Pairs (KVP) */
-
- if (strcasecmp(attr, NS_KEY_BSDADDR) == 0)
- {
- /* use LDAP bsdaddr attribute name */
- result = _modLDAPmodValue(attrs,
- ATTR_BSDADDR, NULL);
- }
- else
- if (_attrInLDAPList(attr) == 0)
- {
- /*
- * Non-LDAP kvp, so sort items
- * in the kvp list
- */
- result = _modAttrKVP(*p, oldKVPList);
- kvpUpdated = 1;
- }
- else
- {
- result = _modLDAPmodValue(attrs,
- attr, NULL);
- }
-
- free(attr);
- }
- } /* for */
-
- if ((result == NSL_OK) && (kvpUpdated))
- {
- result = _attrAddKVP(attrs, *oldKVPList, kvpExists);
- }
-
- if ((result != NSL_OK) && (*attrs != NULL))
- {
- (void) ldap_mods_free(*attrs, 1);
- *attrs = NULL;
- }
- }
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- return (result);
-} /* _constructModLDAPMod */
-
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _compareURIinDNs()
- *
- * Description: For the 2 given printer object DNs compare the naming part
- * part of the DN (printer-uri) to see if they are the same.
- *
- * Note: This function only returns "compare failed" if their URI don't
- * compare. Problems with the dn etc., return a good compare
- * because I don't want us to create a new object for these
- *
- * Parameters:
- * Input: uchar_t *dn1
- * uchar_t *dn2
- * Output: None
- *
- * Returns: NSL_RESULT - NSL_OK = URIs are the same
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_compareURIinDNs(uchar_t *dn1, uchar_t *dn2)
-
-{
- NSL_RESULT result = NSL_OK;
- uchar_t *DN1 = NULL;
- uchar_t *DN2 = NULL;
- char *p1 = NULL;
- char *p2 = NULL;
-
- /* --------- */
-
- if ((dn1 != NULL) && (dn2 != NULL))
- {
- DN1 = (uchar_t *)strdup((char *)dn1);
- DN2 = (uchar_t *)strdup((char *)dn2);
-
- /* terminate each string after the printer-uri */
-
- p1 = strstr((char *)DN1, PCONTAINER);
- /* move back to the comma */
- while ((p1 != NULL) && (*p1 != ',') && (p1 >= (char *)DN1))
- {
- p1--;
- }
-
- p2 = strstr((char *)DN2, PCONTAINER);
- /* move back to the comma */
- while ((p2 != NULL) && (*p2 != ',') && (p2 >= (char *)DN2))
- {
- p2--;
- }
-
- if ((*p1 == ',') && (*p2 == ','))
- {
- *p1 = '\0'; /* re-terminate it */
- *p2 = '\0'; /* re-terminate it */
-
- /* do the compare */
-
- /*
- * Note: SHOULD really normalise the 2 DNs before
- * doing the compare
- */
-#ifdef DEBUG
-printf("_compareURIinDNs() @1 (%s) (%s)\n", DN1, DN2);
-#endif
- if (strcasecmp((char *)DN1, (char *)DN2) != 0)
- {
- result = NSL_ERROR;
- }
-
- }
-
- free(DN1);
- free(DN2);
- }
-
- return (result);
-} /* _compareURIinDNs */
-
-
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _getThisNSDomainDN()
- *
- * Description: Get the current Name Service Domain DN
- * This is extracted from the result of executing ldaplist.
- *
- * Note: Do it this way until the NS LDAP library interface is
- * made public.
- *
- * Parameters:
- * Input: None
- * Output: None
- *
- * Returns: uchar_t* - pointer to NS Domain DN (The caller should free this
- * returned memory).
- *
- * *****************************************************************************
- */
-
-#define LDAPLIST_D "/usr/bin/ldaplist -d 2>&1"
-#define DNID "dn: "
-
-static uchar_t *
-_getThisNSDomainDN(void)
-
-{
- uchar_t *domainDN = NULL;
- char *cp = NULL;
- char buf[BUFSIZ] = "";
-
- /* --------- */
-
- if (_popen(LDAPLIST_D, buf, sizeof (buf)) == 0)
- {
- if ((cp = strstr(buf, DNID)) != NULL)
- {
- cp += strlen(DNID); /* increment past "dn: " label */
- domainDN = (uchar_t *)strdup(cp);
-
- if ((cp = strchr((char *)domainDN, '\n')) != NULL)
- {
- *cp = '\0'; /* terminate it */
- }
- }
- }
-
- return (domainDN);
-} /* _getThisNSDomainDN */
-
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _popen()
- *
- * Description: General popen function. The caller should always use a full
- * path cmd.
- *
- * Parameters:
- * Input: char *cmd - command line to execute
- * char *buffer - ptr to buffer to put result in
- * int size - size of result buffer
- * Output: None
- *
- * Returns: int - 0 = opened okay
- *
- * *****************************************************************************
- */
-
-static int
-_popen(char *cmd, char *buffer, int size)
-
-{
- int result = -1;
- int rsize = 0;
- FILE *fptr;
- char safe_cmd[BUFSIZ];
- char linebuf[BUFSIZ];
-
- /* -------- */
-
- if ((cmd != NULL) && (buffer != NULL) && (size != 0))
- {
- (void) strcpy(buffer, "");
- (void) strcpy(linebuf, "");
- (void) snprintf(safe_cmd, BUFSIZ, "IFS=' \t'; %s", cmd);
-
- if ((fptr = popen(safe_cmd, "r")) != NULL)
- {
- while ((fgets(linebuf, BUFSIZ, fptr) != NULL) &&
- (rsize < size))
- {
- rsize = strlcat(buffer, linebuf, size);
- if (rsize >= size)
- {
- /* result is too long */
- (void) memset(buffer, '\0', size);
- }
- }
-
- if (strlen(buffer) > 0)
- {
- result = 0;
- }
-
- (void) pclose(fptr);
- }
- }
-
- return (result);
-} /* popen */
-
-
-/*
- * *****************************************************************************
- *
- * Function: _attrInList()
- *
- * Description: For the given list check if the attribute is it
- *
- * Parameters:
- * Input: char *attr - attribute to check
- * char **list - list of attributes to check against
- * Output: None
- *
- * Returns: int - TRUE = attr found in list
- *
- * *****************************************************************************
- */
-
-static int
-_attrInList(char *attr, const char **list)
-
-{
- int result = 0;
- int j;
-
- /* ------- */
-
- if ((attr != NULL) && (list != NULL))
- {
- for (j = 0; (list[j] != NULL) && (result != 1); j++)
- {
- if (strcasecmp(list[j], attr) == 0)
- {
- result = 1; /* found */
- }
- }
- }
-
- return (result);
-} /* _attrInList */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _attrInLDAPList()
- *
- * Description: Checks to see if the given attribute is an LDAP printing
- * attribute, ie. is either in an IPP objectclass or the
- * sun printer objectclass. Note: some attributes are handled
- * specifically outside this function, so are excluded from
- * the lists that are checked.
- *
- * Parameters:
- * Input: char *attr - attribute to check
- * Output: None
- *
- * Returns: int - TRUE = attr found in list
- *
- * *****************************************************************************
- */
-
-static int
-_attrInLDAPList(char *attr)
-
-{
- int result = 0;
-
- /* ------- */
-
- if (_attrInList(attr, nsl_attr_printerService))
- {
- result = 1; /* in list */
- }
- else
- if (_attrInList(attr, nsl_attr_printerIPP))
- {
- result = 1; /* in list */
- }
- else
- if (_attrInList(attr, nsl_attr_sunPrinter))
- {
- result = 1; /* in list */
- }
-
- return (result);
-} /* _attrInLDAPList */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _getCurrentKVPValues()
- *
- * Description: For the given printer object read the current set of values
- * the object has for the sun-printer-kvp (Key Value pair)
- *
- * Parameters:
- * Input: LDAP *ld - existing ldap connection descriptor
- * char *objectDN - DN to search for
- * Output: char ***list - returned set of kvp values
- *
- * Result: NSL_RESULT - NSL_OK = object exists
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_getCurrentKVPValues(LDAP *ld, uchar_t *objectDN, char ***list)
-
-{
- NSL_RESULT result = NSL_ERR_UNKNOWN_PRINTER;
- int sresult = LDAP_NO_SUCH_OBJECT;
- int i = 0;
- LDAPMessage *ldapMsg;
- char *requiredAttrs[2] = { ATTR_KVP, NULL };
- LDAPMessage *ldapEntry = NULL;
- char *entryAttrib = NULL;
- char **attribValues = NULL;
- BerElement *berElement = NULL;
-
- /* ---------- */
-
- if ((list != NULL) && (ld != NULL) && (objectDN != NULL))
- {
- /* search for this Printer in the directory */
-
- sresult = ldap_search_s(ld, (char *)objectDN, LDAP_SCOPE_BASE,
- "(objectclass=*)", requiredAttrs, 0, &ldapMsg);
- if (sresult == LDAP_SUCCESS)
- {
- /*
- * check that the object exists and extract its
- * KVP attribute values
- */
- ldapEntry = ldap_first_entry(ld, ldapMsg);
- if (ldapEntry != NULL)
- {
- entryAttrib = ldap_first_attribute(ld,
- ldapEntry, &berElement);
- if ((entryAttrib != NULL) &&
- (strcasecmp(entryAttrib, ATTR_KVP) == 0))
-
- {
-#ifdef DEBUG
-printf("Attribute: %s, its values are:\n", entryAttrib);
-#endif
- /*
- * add each KVP value to the list
- * that we will return
- */
- attribValues = ldap_get_values(
- ld, ldapEntry, entryAttrib);
- for (i = 0;
- attribValues[i] != NULL; i++)
- {
- *list = (char **)
- list_append((void **)*list,
- strdup(attribValues[i]));
-#ifdef DEBUG
-printf("\t%s\n", attribValues[i]);
-#endif
- }
- (void) ldap_value_free(attribValues);
- }
-
- if ((entryAttrib != NULL) &&
- (berElement != NULL))
- {
- ber_free(berElement, 0);
- }
-
-
- /* object found */
- result = NSL_OK;
- }
-
- (void) ldap_msgfree(ldapMsg);
- }
- }
-
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- return (result);
-} /* _getCurrentKVPValues */
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _freeList()
- *
- * Description: Free the list created by list_append() where the items in
- * the list have been strdup'ed.
- *
- * Parameters:
- * Input: char ***list - returned set of kvp values
- *
- * Result: void
- *
- * *****************************************************************************
- */
-
-static void
-_freeList(char ***list)
-
-{
- int i = 0;
-
- /* ------ */
-
- if (list != NULL)
- {
- if (*list != NULL)
- {
- for (i = 0; (*list)[i] != NULL; i++)
- {
- free((*list)[i]);
- }
- free(*list);
- }
-
- *list = NULL;
- }
-} /* _freeList */
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _modAttrKVP()
- *
- * Description: Sort out the KVP attribute value list, such that this new
- * value takes precidence over any existing value in the list.
- * The current list is updated to remove this key, and the new
- * key "value" is added to the list, eg. for
- * value: bbb=ddddd
- * and kvpList:
- * aaa=yyyy
- * bbb=zzzz
- * ccc=xxxx
- * the resulting kvpList is:
- * aaa=yyyy
- * ccc=xxxx
- * bbb=ddddd
- *
- * Note: When all new values have been handled the function _attrAddKVP()
- * must be called to add the "new list" values into the
- * LDAPMod array.
- *
- * Parameters:
- * Input: char *value - Key Value Pair to process,
- * eg. aaaaa=hhhhh, where aaaaa is the key
- * char ***kvpList - list of current KVP values
- * Output: char ***kvpList - updated list of KVP values
- *
- * Returns: NSL_RESULT - NSL_OK = done okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_modAttrKVP(char *value, char ***kvpList)
-
-{
- NSL_RESULT result = NSL_ERR_INTERNAL;
- int i = 0;
- int inList = 0;
- int keyDelete = 0;
- char *key = NULL;
- char **p = NULL;
- char **newList = NULL;
-
- /* ------- */
-
- if ((value != NULL) && (kvpList != NULL))
- {
- result = NSL_OK;
-
- /* extract "key" from value */
-
- key = strdup(value);
-
- for (i = 0; ((key)[i] != '=') && ((key)[i] != '\0'); i++);
- key[i] = '\0'; /* terminate the key */
-
- /* Is this a request to delete a "key" value */
-
- if ((value[i] == '\0') || (value[i+1] == '\0'))
- {
- /* this is a request to delete the key */
- keyDelete = 1;
- }
-
- if ((*kvpList != NULL) && (**kvpList != NULL))
- {
- /*
- * for each item in the list remove it if the keys match
- */
- for (p = *kvpList; *p != NULL; p++)
- {
- for (i = 0;
- ((*p)[i] != '=') && ((*p)[i] != '\0'); i++);
-
- if ((strlen(key) == i) &&
- (strncasecmp(*p, key, i) == 0))
- {
- inList = 1;
- }
- else
- {
- /* no match so add value to new list */
- newList = (char **)list_append(
- (void **)newList,
- strdup(*p));
- }
- }
- }
-
- /*
- * if it was not a DELETE request add the new key value into
- * the newList, otherwise we have already removed the key
- */
-
- if (!keyDelete)
- {
- newList = (char **)list_append((void **)newList,
- strdup(value));
- }
-
- if ((newList != NULL) || (inList))
- {
- /* replace old list with the newList */
- _freeList(kvpList);
- *kvpList = newList;
- }
-
- free(key);
- }
-
- return (result);
-} /* modAttrKVP */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _attrAddKVP()
- *
- * Description: Process KVP items in the kvpList adding them to the
- * LDAPMod modify array. If the list is empty but there were
- * previously LDAP KVP values delete them.
- *
- * Note: This function should only be called when all the new KVP
- * items have been processed by _modAttrKVP()
- *
- * Parameters:
- * Input: LDAPMod ***attrs - array to update
- * char **kvpList - list KVP values
- * int kvpExists - object currently has LDAP KVP values
- * Output: None
- *
- * Returns: NSL_RESULT - NSL_OK = done okay
- *
- * *****************************************************************************
- */
-
-static NSL_RESULT
-_attrAddKVP(LDAPMod ***attrs, char **kvpList, int kvpExists)
-
-{
- NSL_RESULT result = NSL_OK;
-
- /* ------- */
-
- if (attrs != NULL)
- {
- if (kvpList != NULL)
- {
- while ((kvpList != NULL) && (*kvpList != NULL))
- {
- /* add item to LDAPMod array */
-
- result =
- _modLDAPmodValue(attrs, ATTR_KVP, *kvpList);
-
- kvpList++;
- }
- }
- else
- if (kvpExists)
- {
- /*
- * We now have no LDAP KVP values but there were
- * some previously, so delete them
- */
- result = _modLDAPmodValue(attrs, ATTR_KVP, NULL);
- }
- }
-
- else
- {
- result = NSL_ERR_INTERNAL;
- }
-
- return (result);
-} /* _attrAddKVP */
-
-
-
-
-/*
- * *****************************************************************************
- *
- * Function: _manageReferralCredentials()
- *
- * Description: This function is called if a referral request is returned by
- * the origonal LDAP server during the ldap update request call,
- * eg. ldap_add_s(), ldap_modify_s() or ldap_delete_s().
- * Parameters:
- * Input: LDAP *ld - LDAP descriptor
- * int freeit - 0 = first call to get details
- * - 1 = second call to free details
- * - -1 = initial store of authentication details
- * Input/Output: char **dn - returns DN to bind to on master
- * char **credp - returns password for DN
- * int *methodp - returns authentication type, eg. simple
- *
- * Returns: int - 0 = okay
- *
- * *****************************************************************************
- */
-static int _manageReferralCredentials(LDAP *ld, char **dn, char **credp,
- int *methodp, int freeit)
-
-{
- int result = 0;
- static char *sDN = NULL;
- static char *sPasswd = NULL;
- static int sMethod = LDAP_AUTH_SIMPLE;
-
- /* -------- */
-
- if (freeit == 1)
- {
- /* second call - free memory */
-
- if ((dn != NULL) && (*dn != NULL))
- {
- free(*dn);
- }
-
- if ((credp != NULL) && (*credp != NULL))
- {
- free(*credp);
- }
- }
-
- else
- if ((ld != NULL) &&
- (dn != NULL) && (credp != NULL) && (methodp != NULL))
- {
- if ((freeit == 0) && (sDN != NULL) && (sPasswd != NULL))
- {
- /* first call - get the saved bind credentials */
-
- *dn = strdup(sDN);
- *credp = strdup(sPasswd);
- *methodp = sMethod;
- }
- else
- if (freeit == -1)
- {
- /* initial call - save the saved bind credentials */
-
- sDN = *dn;
- sPasswd = *credp;
- sMethod = *methodp;
- }
- else
- {
- result = 1; /* error */
- }
- }
- else
- {
- result = 1; /* error */
- }
-
- return (result);
-} /* _manageReferralCredentials */
diff --git a/usr/src/lib/print/libprint/common/nss_printer.c b/usr/src/lib/print/libprint/common/nss_printer.c
deleted file mode 100644
index 149ddadd5c..0000000000
--- a/usr/src/lib/print/libprint/common/nss_printer.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <nss_dbdefs.h>
-#include <syslog.h>
-#include <ns.h>
-
-#ifndef NSS_DBNAM__PRINTERS /* not in nss_dbdefs.h because it's private */
-#define NSS_DBNAM__PRINTERS "_printers"
-#endif
-
-static DEFINE_NSS_DB_ROOT(db_root);
-static DEFINE_NSS_GETENT(context);
-
-static int printers_stayopen;
-static char *private_ns = NULL;
-
-static void
-_nss_initf_printers(p)
- nss_db_params_t *p;
-{
- if (private_ns != NULL) {
- /*
- * because we need to support a legacy interface that allows
- * us to select a specific name service, we need to dummy up
- * the parameters to use a private nsswitch database and set
- * the * default_config entry to the name service we are
- * looking into.
- */
- p->name = NSS_DBNAM__PRINTERS; /* "_printers" */
- p->default_config = normalize_ns_name(private_ns);
- } else {
- /* regular behaviour */
- p->name = NSS_DBNAM_PRINTERS; /* "printers" */
- p->default_config = NSS_DEFCONF_PRINTERS;
- }
- syslog(LOG_DEBUG, "database: %s, default: %s",
- (p->name ? p->name : "NULL"),
- (p->default_config ? p->default_config : "NULL"));
-}
-
-/*
- * Return values: 0 = success, 1 = parse error, 2 = erange ...
- * The structure pointer passed in is a structure in the caller's space
- * wherein the field pointers would be set to areas in the buffer if
- * need be. instring and buffer should be separate areas.
- */
-/* ARGSUSED */
-static int
-str2printer(const char *instr, int lenstr, void *ent, char *buffer, int buflen)
-{
- if (lenstr + 1 > buflen)
- return (NSS_STR_PARSE_ERANGE);
-
- /* skip entries that begin with '#' */
- if (instr[0] == '#')
- return (NSS_STR_PARSE_PARSE);
-
- /*
- * We copy the input string into the output buffer
- */
- (void) memcpy(buffer, instr, lenstr);
- buffer[lenstr] = '\0';
-
- return (NSS_STR_PARSE_SUCCESS);
-}
-
-
-int
-setprinterentry(int stayopen, char *ns)
-{
- printers_stayopen |= stayopen;
- private_ns = ns;
- nss_setent(&db_root, _nss_initf_printers, &context);
- private_ns = NULL;
- return (0);
-}
-
-
-int
-endprinterentry()
-{
- printers_stayopen = 0;
- nss_endent(&db_root, _nss_initf_printers, &context);
- nss_delete(&db_root);
- private_ns = NULL;
- return (0);
-}
-
-
-/* ARGSUSED2 */
-int
-getprinterentry(char *linebuf, int linelen, char *ns)
-{
- nss_XbyY_args_t arg;
- nss_status_t res;
-
- private_ns = ns;
- NSS_XbyY_INIT(&arg, linebuf, linebuf, linelen, str2printer);
- res = nss_getent(&db_root, _nss_initf_printers, &context, &arg);
- (void) NSS_XbyY_FINI(&arg);
- private_ns = NULL;
-
- return (arg.status = res);
-}
-
-
-int
-getprinterbyname(char *name, char *linebuf, int linelen, char *ns)
-{
- nss_XbyY_args_t arg;
- nss_status_t res;
-
- private_ns = ns;
- NSS_XbyY_INIT(&arg, linebuf, linebuf, linelen, str2printer);
- arg.key.name = name;
- res = nss_search(&db_root, _nss_initf_printers,
- NSS_DBOP_PRINTERS_BYNAME, &arg);
- (void) NSS_XbyY_FINI(&arg);
- private_ns = NULL;
-
- return (arg.status = res);
-}
diff --git a/usr/src/lib/print/libprint/common/nss_write.c b/usr/src/lib/print/libprint/common/nss_write.c
deleted file mode 100644
index c617f0d0a5..0000000000
--- a/usr/src/lib/print/libprint/common/nss_write.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdarg.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <errno.h>
-#include <pwd.h>
-#include <libintl.h>
-#include <netdb.h> /* for rcmd() */
-
-#include <ns.h>
-#include <list.h>
-
-/* escaped chars include delimiters and shell meta characters */
-#define ESCAPE_CHARS "\\\n=: `&;|>^$()<*?["
-
-/*
- * This modules contains all of the code nedessary to write back to each
- * printing configuration data repository. The support is intended to
- * introduce the least number of dependencies in the library, so it doesn't
- * always perform it's operations in the cleanest fashion.
- */
-
-
-/*
- * Generic Files support begins here.
- */
-static char *
-freadline(FILE *fp, char *buf, int buflen)
-{
- char *s = buf;
-
- while (fgets(s, buflen, fp)) {
- if ((s == buf) && ((*s == '#') || (*s == '\n'))) {
- continue;
- } else {
- if ((*s == '#') || (*s == '\n')) {
- *s = NULL;
- break;
- }
-
- buflen -= strlen(s);
- s += strlen(s);
-
- if (*(s - 2) != '\\')
- break;
-#ifdef STRIP_CONTINUATION
- buflen -= 2;
- s -= 2;
-#endif
- }
- }
-
- if (s == buf)
- return (NULL);
- else
- return (buf);
-}
-
-
-static int
-_file_put_printer(const char *file, const ns_printer_t *printer)
-{
- FILE *ifp,
- *ofp;
- char *tmpfile;
- int fd;
- int exit_status = 0;
- int size;
-
- size = strlen(file) + 1 + 20;
- if ((tmpfile = malloc(size)) == NULL)
- return (-1);
-
- if (snprintf(tmpfile, size, "%sXXXXXX", file) >= size) {
- syslog(LOG_ERR, "_file_put_printer:buffer overflow:tmpfile");
- return (-1);
- }
-
- /* LINTED */
- while (1) { /* syncronize writes */
- fd = open(file, O_RDWR|O_CREAT|O_EXCL, 0644);
- if ((fd < 0) && (errno == EEXIST))
- fd = open(file, O_RDWR);
- if (fd < 0) {
- if (errno == EAGAIN)
- continue;
- free(tmpfile);
- return (-1);
- }
- if (lockf(fd, F_TLOCK, 0) == 0)
- break;
- (void) close(fd);
- }
-
- if ((ifp = fdopen(fd, "r")) == NULL) {
- (void) close(fd);
- free(tmpfile);
- return (-1);
- }
-
- if ((fd = mkstemp(tmpfile)) < 0) {
- (void) fclose(ifp);
- free(tmpfile);
- return (-1);
- }
-
- (void) fchmod(fd, 0644);
- if ((ofp = fdopen(fd, "wb+")) != NULL) {
- char buf[4096];
-
- (void) fprintf(ofp,
- "#\n#\tIf you hand edit this file, comments and structure may change.\n"
- "#\tThe preferred method of modifying this file is through the use of\n"
- "#\tlpset(1M)\n#\n");
-
- /*
- * Handle the special case of lpset -x all
- * This deletes all entries in the file
- * In this case, just don't write any entries to the tmpfile
- */
-
- if (!((strcmp(printer->name, "all") == 0) &&
- (printer->attributes == NULL))) {
- char *t, *entry, *pentry;
-
- (void) _cvt_printer_to_entry((ns_printer_t *)printer,
- buf, sizeof (buf));
- t = pentry = strdup(buf);
-
- while (freadline(ifp, buf, sizeof (buf)) != NULL) {
- ns_printer_t *tmp = (ns_printer_t *)
- _cvt_nss_entry_to_printer(buf, "");
-
- if (ns_printer_match_name(tmp, printer->name)
- == 0) {
- entry = pentry;
- pentry = NULL;
- } else
- entry = buf;
-
- (void) fprintf(ofp, "%s\n", entry);
- }
-
- if (pentry != NULL)
- (void) fprintf(ofp, "%s\n", pentry);
- free(t);
- }
-
- (void) fclose(ofp);
- (void) rename(tmpfile, file);
- } else {
- (void) close(fd);
- (void) unlink(tmpfile);
- exit_status = -1;
- }
-
- (void) fclose(ifp); /* releases the lock, after rename on purpose */
- (void) free(tmpfile);
- return (exit_status);
-}
-
-
-/*
- * Support for writing a printer into the FILES /etc/printers.conf
- * file.
- */
-int
-files_put_printer(const ns_printer_t *printer)
-{
- static char *file = "/etc/printers.conf";
-
- return (_file_put_printer(file, printer));
-}
-
-/*
- * Support for writing a printer into the NIS printers.conf.byname
- * map.
- */
-
-#include <rpc/rpc.h>
-#include <rpcsvc/ypclnt.h>
-#include <rpcsvc/yp_prot.h>
-
-/*
- * Run the remote command. We aren't interested in any io, Only the
- * return code.
- */
-static int
-remote_command(char *command, char *host)
-{
- struct passwd *pw;
-
- if ((pw = getpwuid(getuid())) != NULL) {
- int fd;
-
- if ((fd = rcmd_af(&host, htons(514), pw->pw_name, "root",
- command, NULL, AF_INET6)) < 0)
- return (-1);
- (void) close(fd);
- return (0);
- } else
- return (-1);
-}
-
-
-/*
- * This isn't all that pretty, but you can update NIS if the machine this
- * runs on is in the /.rhosts or /etc/hosts.equiv on the NIS master.
- * copy it local, update it, copy it remote
- */
-#define TMP_PRINTERS_FILE "/tmp/printers.NIS"
-#define NIS_MAKEFILE "/var/yp/Makefile"
-#define MAKE_EXCERPT "/usr/lib/print/Makefile.yp"
-/*ARGSUSED*/
-int
-nis_put_printer(const ns_printer_t *printer)
-{
- static char *domain = NULL;
- char *map = "printers.conf.byname";
- char *tmp = NULL;
- char *host = NULL;
- char lfile[BUFSIZ];
- char rfile[BUFSIZ];
- char cmd[BUFSIZ];
-
- if (domain == NULL)
- (void) yp_get_default_domain(&domain);
-
- if ((yp_master(domain, (char *)map, &host) != 0) &&
- (yp_master(domain, "passwd.byname", &host) != 0))
- return (-1);
-
- if (snprintf(lfile, sizeof (lfile), "/tmp/%s", map) >=
- sizeof (lfile)) {
- syslog(LOG_ERR, "nis_put_printer:lfile buffer overflow");
- return (-1);
- }
- if (snprintf(rfile, sizeof (rfile), "root@%s:/etc/%s", host, map) >=
- sizeof (rfile)) {
- syslog(LOG_ERR, "nis_put_printer:rfile buffer overflow");
- return (-1);
- }
-
- if (((tmp = strrchr(rfile, '.')) != NULL) &&
- (strcmp(tmp, ".byname") == 0))
- *tmp = NULL; /* strip the .byname */
-
- /* copy it local */
- if (snprintf(cmd, sizeof (cmd), "rcp %s %s >/dev/null 2>&1",
- rfile, lfile) >= sizeof (cmd)) {
- syslog(LOG_ERR,
- "nis_put_printer:buffer overflow building cmd");
- return (-1);
- }
- (void) system(cmd); /* could fail because it doesn't exist */
-
-
- /* update it */
- if (_file_put_printer(lfile, printer) != 0)
- return (-1);
-
- /* copy it back */
- if (snprintf(cmd, sizeof (cmd), "rcp %s %s >/dev/null 2>&1",
- lfile, rfile) >= sizeof (cmd)) {
- syslog(LOG_ERR,
- "nis_put_printer:buffer overflow building cmd");
- return (-1);
- }
- if (system(cmd) != 0)
- return (-1);
-
- /* copy the Makefile excerpt */
- if (snprintf(cmd, sizeof (cmd),
- "rcp %s root@%s:%s.print >/dev/null 2>&1",
- MAKE_EXCERPT, host, NIS_MAKEFILE) >= sizeof (cmd)) {
- syslog(LOG_ERR,
- "nis_put_printer:buffer overflow building cmd");
- return (-1);
- }
-
- if (system(cmd) != 0)
- return (-1);
-
- /* run the make */
- if (snprintf(cmd, sizeof (cmd),
- "/bin/sh -c 'PATH=/usr/ccs/bin:/bin:/usr/bin:$PATH "
- "make -f %s -f %s.print printers.conf >/dev/null 2>&1'",
- NIS_MAKEFILE, NIS_MAKEFILE) >= sizeof (cmd)) {
- syslog(LOG_ERR,
- "nis_put_printer:buffer overflow on make");
- return (-1);
- }
-
- return (remote_command(cmd, host));
-}
diff --git a/usr/src/lib/print/libprint/common/sunPrinter.at.conf.txt b/usr/src/lib/print/libprint/common/sunPrinter.at.conf.txt
deleted file mode 100644
index 0cac14ae95..0000000000
--- a/usr/src/lib/print/libprint/common/sunPrinter.at.conf.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2001 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-
-# IPP Draft 4 schema and Sun Printer Schema
-
-attribute printer-uri 1.3.18.0.2.4.1140 cis single
-attribute printer-xri-supported 1.3.18.0.2.4.1107 cis
-attribute printer-name 1.3.18.0.2.4.1135 cis single
-attribute printer-natural-language-configured 1.3.18.0.2.4.1119 cis single
-attribute printer-location 1.3.18.0.2.4.1136 cis single
-attribute printer-info 1.3.18.0.2.4.1139 cis single
-attribute printer-more-info 1.3.18.0.2.4.1134 cis single
-attribute printer-make-and-model 1.3.18.0.2.4.1138 cis single
-attribute printer-ipp-versions-supported 1.3.18.0.2.4.1133 cis
-attribute printer-multiple-document-jobs-supported 1.3.18.0.2.4.1132 bin single
-attribute printer-charset-configured 1.3.18.0.2.4.1109 cis single
-attribute printer-charset-supported 1.3.18.0.2.4.1131 cis
-attribute printer-generated-natural-language-supported 1.3.18.0.2.4.1137 cis
-attribute printer-document-format-supported 1.3.18.0.2.4.1130 cis
-attribute printer-color-supported 1.3.18.0.2.4.1129 bin single
-attribute printer-compression-supported 1.3.18.0.2.4.1128 cis
-attribute printer-pages-per-minute 1.3.18.0.2.4.1127 bin single
-attribute printer-pages-per-minute-color 1.3.18.0.2.4.1126 bin single
-attribute printer-finishings-supported 1.3.18.0.2.4.1125 cis
-attribute printer-number-up-supported 1.3.18.0.2.4.1124 bin
-attribute printer-sides-supported 1.3.18.0.2.4.1123 cis
-attribute printer-media-supported 1.3.18.0.2.4.1122 cis
-attribute printer-media-local-supported 1.3.18.0.2.4.1117 cis
-attribute printer-resolution-supported 1.3.18.0.2.4.1121 cis
-attribute printer-print-quality-supported 1.3.18.0.2.4.1120 cis
-attribute printer-job-priority-supported 1.3.18.0.2.4.1110 bin single
-attribute printer-copies-supported 1.3.18.0.2.4.1118 bin single
-attribute printer-job-k-octets-supported 1.3.18.0.2.4.1111 bin single
-attribute printer-current-operator 1.3.18.0.2.4.1112 cis single
-attribute printer-service-person 1.3.18.0.2.4.1113 cis single
-attribute printer-delivery-orientation-supported 1.3.18.0.2.4.1114 cis
-attribute printer-stacking-order-supported 1.3.18.0.2.4.1115 cis
-attribute printer-output-features-supported 1.3.18.0.2.4.1116 cis
-attribute printer-aliases 1.3.18.0.2.4.1108 cis
-attribute sun-printer-bsdaddr 1.3.6.1.4.1.42.2.27.5.1.63 cis single
-attribute sun-printer-kvp 1.3.6.1.4.1.42.2.27.5.1.64 cis
diff --git a/usr/src/lib/print/libprint/common/sunPrinter.oc.conf.txt b/usr/src/lib/print/libprint/common/sunPrinter.oc.conf.txt
deleted file mode 100644
index 77f365819d..0000000000
--- a/usr/src/lib/print/libprint/common/sunPrinter.oc.conf.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright 2001 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-
-# IPP Schema Draft 4 and Sun Printer Schema
-
-objectclass slpService
- oid 1.3.18.0.2.6.2549
- superior
- top
-
-objectclass slpServicePrinter
- oid 1.3.18.0.2.6.254
- superior
- slpService
-
-objectclass printerAbstract
- oid 1.3.18.0.2.6.258
- superior
- top
- allows
- printer-charset-configured,
- printer-charset-supported,
- printer-color-supported,
- printer-compression-supported,
- printer-copies-supported,
- printer-current-operator,
- printer-delivery-orientation-supported,
- printer-document-format-supported,
- printer-finishings-supported,
- printer-generated-natural-language-supported,
- printer-info,
- printer-job-k-octets-supported,
- printer-job-priority-supported,
- printer-location,
- printer-make-and-model,
- printer-media-local-supported,
- printer-media-supported,
- printer-more-info,
- printer-multiple-document-jobs-supported,
- printer-name,
- printer-natural-language-configured,
- printer-number-up-supported,
- printer-output-features-supported,
- printer-pages-per-minute,
- printer-pages-per-minute-color,
- printer-print-quality-supported,
- printer-resolution-supported,
- printer-service-person,
- printer-sides-supported,
- printer-stacking-order-supported
-
-objectclass printerService
- oid 1.3.18.0.2.6.255
- superior
- printerAbstract
- allows
- printer-uri,
- printer-xri-supported
-
-objectclass printerServiceAuxClass
- oid 1.3.18.0.2.6.257
- superior
- printerAbstract
- allows
- printer-uri,
- printer-xri-supported
-
-objectclass printerIPP
- oid 1.3.18.0.2.6.256
- superior
- top
- allows
- printer-ipp-versions-supported,
- printer-multiple-document-jobs-supported
-
-objectclass printerLPR
- oid 1.3.18.0.2.6.253
- superior
- top
- requires
- printer-name
- allows
- printer-aliases
-
-objectclass sunPrinter
- oid 1.3.6.1.4.1.42.2.27.5.2.14
- superior
- top
- requires
- printer-name
- allows
- sun-printer-bsdaddr,
- sun-printer-kvp
diff --git a/usr/src/lib/print/libprint/i386/Makefile b/usr/src/lib/print/libprint/i386/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libprint/i386/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/libprint/sparc/Makefile b/usr/src/lib/print/libprint/sparc/Makefile
deleted file mode 100644
index 3b985583a4..0000000000
--- a/usr/src/lib/print/libprint/sparc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) # $(ROOTLINT)
diff --git a/usr/src/lib/print/mod_ipp/Makefile b/usr/src/lib/print/mod_ipp/Makefile
deleted file mode 100644
index 8d6500fb41..0000000000
--- a/usr/src/lib/print/mod_ipp/Makefile
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-LIBRARY = mod_ipp.a
-VERS =
-OBJECTS = mod_ipp.o
-
-include ../../Makefile.lib
-include ../../Makefile.rootfs
-
-APACHEMODDIR = $(ROOT)/usr/apache/libexec
-APACHECONFDIR = $(ROOT)/etc/apache
-LISTENERDIR = $(ROOT)/var/lp/ipp-listener
-
-ROOTDIRS = $(ROOT)/usr/apache $(APACHEMODDIR) $(APACHECONFDIR) \
- $(ROOT)/var/lp $(LISTENERDIR)
-
-$(ROOT)/var/lp:= DIRMODE = 775
-$(ROOT)/var/lp:= FILEMODE = 775
-
-LIBS = $(DYNLIB)
-
-SRCS = $(OBJECTS:%.o = %.c)
-
-
-CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I../libipp-listener/common
-CPPFLAGS += -I../libipp-core/common
-CPPFLAGS += -I/usr/apache/include
-CPPFLAGS += -DEAPI
-ZDEFS = $(ZNODEFS)
-
-MAPFILES = mapfile
-
-LDLIBS += -lipp-listener -lipp-core -lpapi -lc
-
-# SMF manifest
-MANIFEST= ipp-listener.xml
-ROOTMANIFESTDIR= $(ROOT)/lib/svc/manifest/application/print
-ROOTMANIFEST= $(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
-$(ROOTMANIFEST) := FILEMODE= 444
-
-# Apache module
-$(APACHEMODDIR)/$(LIBLINKS): $(ROOTDIRS)
-
-# Apache config
-APACHECONFFILE= $(APACHECONFDIR)/httpd-standalone-ipp.conf
-$(APACHECONFFILE) := FILEMODE= 644
-LISTENERFILE= $(LISTENERDIR)/index.html
-$(LISTENERFILE) := FILEMODE= 444
-
-$(ROOT)/var/lp:= FILEMODE = 0775
-
-$(APACHEMODDIR)/$(LIBLINKS):= FILEMODE = 0555
-
-$(ROOTMANIFESTDIR)/% $(APACHEMODDIR)/% $(APACHECONFDIR)/% $(LISTENERDIR)/%: %
- $(INS.file)
-
-$(ROOTDIRS):
- $(INS.dir)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all $(APACHEMODDIR)/$(LIBLINKS) $(APACHECONFFILE) \
- $(LISTENERFILE) $(ROOTMANIFEST)
-
-install_h:
-
-lint:
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/print/mod_ipp/httpd-standalone-ipp.conf b/usr/src/lib/print/mod_ipp/httpd-standalone-ipp.conf
deleted file mode 100644
index 07a4b8dc11..0000000000
--- a/usr/src/lib/print/mod_ipp/httpd-standalone-ipp.conf
+++ /dev/null
@@ -1,341 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# "$Id: httpd-standalone-ipp.conf,v 1.4 2006/03/24 00:26:54 njacobs Exp $"
-#
-
-# ident "%Z%%M% %I% %E% SMI"
-
-##
-## httpd-standalone-ipp.conf -- Apache HTTP server configuration file for
-## an Internet Print Protocol (IPP) listener
-##
-
-#
-# Based upon the NCSA server configuration files originally by Rob McCool.
-#
-# This is the main Apache server configuration file. It contains the
-# configuration directives that give the server its instructions.
-# See <URL:http://www.apache.org/docs/> for detailed information about
-# the directives. mod_ipp specific directives are described in the
-# mod_ipp(4) man page.
-#
-
-### Section 1: Global Environment
-#
-# The directives in this section affect the overall operation of Apache,
-# such as the number of concurrent requests it can handle or where it
-# can find its configuration files.
-#
-
-#
-# ServerType is either inetd, or standalone. Inetd mode is only supported on
-# Unix platforms.
-#
-ServerType standalone
-
-#
-# ServerRoot: The top of the directory tree under which the server's
-# configuration, error, and log files are kept.
-#
-# NOTE! If you intend to place this on an NFS (or otherwise network)
-# mounted filesystem then please read the LockFile documentation
-# (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>);
-# you will save yourself a lot of trouble.
-#
-ServerRoot "/usr/apache"
-
-#
-# The LockFile directive sets the path to the lockfile used when Apache
-# is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
-# USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be left at
-# its default value. The main reason for changing it is if the logs
-# directory is NFS mounted, since the lockfile MUST BE STORED ON A LOCAL
-# DISK. The PID of the main server process is automatically appended to
-# the filename.
-#
-#LockFile /var/run/httpd.lock
-LockFile /var/run/httpd-standalone-ipp.lock
-
-#
-# PidFile: The file in which the server should record its process
-# identification number when it starts.
-#
-PidFile /var/run/httpd-standalone-ipp.pid
-
-#
-# ScoreBoardFile: File used to store internal server process information.
-# Not all architectures require this. But if yours does (you'll know because
-# this file will be created when you run Apache) then you *must* ensure that
-# no two invocations of Apache share the same scoreboard file.
-#
-ScoreBoardFile /var/run/httpd-standalone-ipp.scoreboard
-
-#
-# In the standard configuration, the server will process httpd.conf (this
-# file, specified by the -f command line option), srm.conf, and access.conf
-# in that order. The latter two files are now distributed empty, as it is
-# recommended that all directives be kept in a single file for simplicity.
-# The commented-out values below are the built-in defaults. You can have the
-# server ignore these files altogether by using "/dev/null" (for Unix) or
-# "nul" (for Win32) for the arguments to the directives.
-#
-#ResourceConfig conf/srm.conf
-#AccessConfig conf/access.conf
-
-#
-# Timeout: The number of seconds before receives and sends time out.
-#
-Timeout 300
-
-#
-# KeepAlive: Whether or not to allow persistent connections (more than
-# one request per connection). Set to "Off" to deactivate.
-#
-KeepAlive On
-
-#
-# MaxKeepAliveRequests: The maximum number of requests to allow
-# during a persistent connection. Set to 0 to allow an unlimited amount.
-# We recommend you leave this number high, for maximum performance.
-#
-MaxKeepAliveRequests 100
-
-#
-# KeepAliveTimeout: Number of seconds to wait for the next request from the
-# same client on the same connection.
-#
-KeepAliveTimeout 15
-
-#
-# Server-pool size regulation. Rather than making you guess how many
-# server processes you need, Apache dynamically adapts to the load it
-# sees --- that is, it tries to maintain enough server processes to
-# handle the current load, plus a few spare servers to handle transient
-# load spikes (e.g., multiple simultaneous requests from a single
-# Netscape browser).
-#
-# It does this by periodically checking how many servers are waiting
-# for a request. If there are fewer than MinSpareServers, it creates
-# a new spare. If there are more than MaxSpareServers, some of the
-# spares die off. The default values are probably OK for most sites.
-#
-MinSpareServers 1
-MaxSpareServers 2
-
-#
-# Number of servers to start initially --- should be a reasonable ballpark
-# figure.
-#
-StartServers 1
-
-#
-# Limit on total number of servers running, i.e., limit on the number
-# of clients who can simultaneously connect --- if this limit is ever
-# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
-# It is intended mainly as a brake to keep a runaway server from taking
-# the system with it as it spirals down...
-#
-MaxClients 150
-
-#
-# MaxRequestsPerChild: the number of requests each child process is
-# allowed to process before the child dies. The child will exit so
-# as to avoid problems after prolonged use when Apache (and maybe the
-# libraries it uses) leak memory or other resources. On most systems, this
-# isn't really needed, but a few (such as Solaris) do have notable leaks
-# in the libraries. For these platforms, set to something like 10000
-# or so; a setting of 0 means unlimited.
-#
-# NOTE: This value does not include keepalive requests after the initial
-# request per connection. For example, if a child process handles
-# an initial request and 10 subsequent "keptalive" requests, it
-# would only count as 1 request towards this limit.
-#
-MaxRequestsPerChild 10
-
-#
-# Dynamic Shared Object (DSO) Support
-#
-# To be able to use the functionality of a module which was built as a DSO you
-# have to place corresponding `LoadModule' lines at this location so the
-# directives contained in it are actually available _before_ they are used.
-# Please read the file http://httpd.apache.org/docs/dso.html for more
-# details about the DSO mechanism and run `httpd -l' for the list of already
-# built-in (statically linked and thus always available) modules in your httpd
-# binary.
-#
-# Note: The order in which modules are loaded is important. Don't change
-# the order below without expert advice.
-#
-LoadModule access_module libexec/mod_access.so
-LoadModule alias_module libexec/mod_alias.so
-LoadModule auth_module libexec/mod_auth.so
-LoadModule mime_module libexec/mod_mime.so
-LoadModule mime_magic_module libexec/mod_mime_magic.so
-LoadModule ipp_module libexec/mod_ipp.so
-
-# Reconstruction of the complete module list from all available modules
-# (static and shared ones) to achieve correct module execution order.
-# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
-ClearModuleList
-AddModule mod_access.c
-AddModule mod_alias.c
-AddModule mod_auth.c
-AddModule mod_mime.c
-AddModule mod_mime_magic.c
-AddModule mod_ipp.c
-AddModule mod_so.c
-
-### Section 2: 'Main' server configuration
-#
-# The directives in this section set up the values used by the 'main'
-# server, which responds to any requests that aren't handled by a
-# <VirtualHost> definition. These values also provide defaults for
-# any <VirtualHost> containers you may define later in the file.
-#
-# All of these directives may appear inside <VirtualHost> containers,
-# in which case these default settings will be overridden for the
-# virtual host being defined.
-#
-
-#
-# If your ServerType directive (set earlier in the 'Global Environment'
-# section) is set to "inetd", the next few directives don't have any
-# effect since their settings are defined by the inetd configuration.
-# Skip ahead to the ServerAdmin directive.
-#
-
-#
-# Port: The port to which the standalone server listens. For
-# ports < 1023, you will need httpd to be run as root initially.
-#
-Port 631
-
-#
-# If you wish httpd to run as a different user or group, you must run
-# httpd as root initially and it will switch.
-#
-# User/Group: The name (or #number) of the user/group to run httpd as.
-# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
-# . On HPUX you may not be able to use shared memory as nobody, and the
-# suggested workaround is to create a user www and use that user.
-# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
-# when the value of (unsigned)Group is above 60000;
-# don't use Group nobody on these systems!
-#
-User lp
-Group lp
-
-#
-# ServerAdmin: Your address, where problems with the server should be
-# e-mailed. This address appears on some server-generated pages, such
-# as error documents.
-#
-ServerAdmin lp@localhost
-
-#
-# ServerName allows you to set a host name which is sent back to clients for
-# your server if it's different than the one the program would get (i.e., use
-# "www" instead of the host's real name).
-#
-# Note: You cannot just invent host names and hope they work. The name you
-# define here must be a valid DNS name for your host. If you don't understand
-# this, ask your network administrator.
-# If your host doesn't have a registered DNS name, enter its IP address here.
-# You will have to access it by its address (e.g., http://123.45.67.89/)
-# anyway, and this will make redirections work in a sensible way.
-#
-# 127.0.0.1 is the TCP/IP local loop-back address, often named localhost. Your
-# machine always knows itself by this address. If you use Apache strictly for
-# local testing and development, you may use 127.0.0.1 as the server name.
-#
-#Servername printserver.some_company.com
-
-DefaultType application/ipp
-
-ErrorLog /var/lp/logs/ipp-errors
-LogLevel warn
-
-DocumentRoot /var/lp/ipp-listener
-
-# Allow passing PPD files from this service as well
-Alias /etc/lp/ppd/ /etc/lp/ppd/
-<Directory /etc/lp/ppd>
- SetHandler send-as-is
- <LimitExcept GET>
- Deny from all
- </LimitExcept>
-</Directory>
-
-# mod_ipp specific configuration
-<IfModule mod_ipp.c>
-
- <Location />
- # ipp-conformance automatic # default
- # ipp-default-user nobody
- ipp-default-service lpsched
- #
- # By default, only turn on operations that are not
- # likely to cause real problems when the user can't
- # be trusted.
- #
- ipp-operation all off
- ipp-operation print-job on
- ipp-operation validate-job on
- ipp-operation create-job on
- ipp-operation get-jobs on
- ipp-operation get-printer-attributes on
- ipp-operation send-document on
- ipp-operation cancel-job on
- ipp-operation get-job-attributes on
- ipp-operation cups-get-default on
- ipp-operation cups-get-printers on
- ipp-operation cups-get-classes on
- ipp-operation cups-move-job on
-
- # redirect non-IPP requests
- ErrorDocument 404 /index.html
- </Location>
-
- <Location /admin>
- # ipp-conformance automatic # default
- # ipp-default-user nobody
- ipp-default-service lpsched
-
- ipp-operation all on
-
- AuthType Basic
- AuthName "IPP Server"
- AuthUserFile /etc/ipp-users
- Require valid-user
-
- # redirect non-IPP requests
- ErrorDocument 404 /index.html
- </Location>
-</IfModule>
-
diff --git a/usr/src/lib/print/mod_ipp/index.html b/usr/src/lib/print/mod_ipp/index.html
deleted file mode 100644
index 15f680c666..0000000000
--- a/usr/src/lib/print/mod_ipp/index.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!--
-
- CDDL HEADER START
-
- The contents of this file are subject to the terms of the
- Common Development and Distribution License (the "License").
- You may not use this file except in compliance with the License.
-
- You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- or http://www.opensolaris.org/os/licensing.
- See the License for the specific language governing permissions
- and limitations under the License.
-
- When distributing Covered Code, include this CDDL HEADER in each
- file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- If applicable, add the following below this CDDL HEADER, with the
- fields enclosed by brackets "[]" replaced with your own identifying
- information: Portions Copyright [yyyy] [name of copyright owner]
-
- CDDL HEADER END
-
-
- Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- Use is subject to license terms.
-
- ident "%Z%%M% %I% %E% SMI"
--->
-<html>
-<body>
-The Internet Print Protocol (IPP) requires that all protocol requests be
-encapsulated in HTTP and that all HTTP protocol requests be POST requests with
-a Content-Type of "application/ipp". Since your request did not meet this
-criteria, it has been ignored by the IPP listener. You will be redirected to
-the
-<a href=http://docs.sun.com/db?q=%22Internet+Print+Protocol%22&p=prod%2Fsolaris>
-<b>Solaris&reg</b> AnswerBook
-</a>
-so that you can learn more about the Internet Print Protocol Listener.
-<p>
-If you would like more information about the Internet Print Protocol itself,
-please visit <a href=http://www.pwg.org/ipp>http://www.pwg.org/ipp/</a>.
-</body>
-</html>
-<meta HTTP-EQUIV=REFRESH CONTENT=10;URL=http://docs.sun.com/db?q=%22Internet+Print+Protocol%22&p=prod%2Fsolaris>
diff --git a/usr/src/lib/print/mod_ipp/ipp-listener.xml b/usr/src/lib/print/mod_ipp/ipp-listener.xml
deleted file mode 100644
index 686646a78c..0000000000
--- a/usr/src/lib/print/mod_ipp/ipp-listener.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0"?>
-<!--
-CDDL HEADER START
-
-The contents of this file are subject to the terms of the
-Common Development and Distribution License (the "License").
-You may not use this file except in compliance with the License.
-
-You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-or http://www.opensolaris.org/os/licensing.
-See the License for the specific language governing permissions
-and limitations under the License.
-
-When distributing Covered Code, include this CDDL HEADER in each
-file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-If applicable, add the following below this CDDL HEADER, with the
-fields enclosed by brackets "[]" replaced with your own identifying
-information: Portions Copyright [yyyy] [name of copyright owner]
-
-CDDL HEADER END
--->
-<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
-<!--
- Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- Use is subject to license terms.
--->
-
-<service_bundle type='manifest' name='SUNWipplr:ipp-listener'>
-
-<service
- name='application/print/ipp-listener'
- type='service'
- version='1'>
-
- <create_default_instance enabled='false' />
-
- <dependency name='print-service'
- grouping='require_any'
- restart_on='refresh'
- type='service'>
- <service_fmri value='svc:/application/print/server' />
- </dependency>
-
- <exec_method
- type='method'
- name='start'
- exec='/usr/apache/bin/httpd -f /etc/apache/httpd-standalone-ipp.conf'
- timeout_seconds='10' />
-
- <exec_method
- type='method'
- name='stop'
- exec='/bin/pkill -f httpd-standalone-ipp.conf'
- timeout_seconds='5' />
-
- <property_group name='general' type='framework'>
- <!-- to start/stop IPP listening service-->
- <propval name='action_authorization' type='astring'
- value='solaris.print.admin' />
- <propval name='value_authorization' type='astring'
- value='solaris.print.admin' />
- </property_group>
-
- <property_group name='firewall_context' type='com.sun,fw_definition'>
- <propval name='ipf_method' type='astring'
- value='/lib/svc/method/print-svc ipfilter svc:/application/print/server:default' />
- </property_group>
-
- <stability value='Unstable' />
-
- <template>
- <common_name>
- <loctext xml:lang='C'>
- Internet Print Protocol Listening Service
- </loctext>
- </common_name>
- <documentation>
- <manpage title='mod_ipp' section='4'
- manpath='/usr/share/man' />
- </documentation>
- </template>
-</service>
-
-</service_bundle>
diff --git a/usr/src/lib/print/mod_ipp/mod_ipp.c b/usr/src/lib/print/mod_ipp/mod_ipp.c
deleted file mode 100644
index 2d9ece2287..0000000000
--- a/usr/src/lib/print/mod_ipp/mod_ipp.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- */
-
-/* $Id: mod_ipp.c 149 2006-04-25 16:55:01Z njacobs $ */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Internet Printing Protocol (IPP) module for Apache.
- */
-
-#include "ap_config.h"
-
-#include <stdio.h>
-#include <time.h>
-#include <sys/time.h>
-#include <values.h>
-#include <libintl.h>
-#include <alloca.h>
-
-#include "httpd.h"
-#include "http_config.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "papi.h"
-#ifndef APACHE_RELEASE /* appears to only exist in Apache 1.X */
-#define APACHE2
-#include "apr_compat.h"
-#endif
-
-#include <papi.h>
-#include <ipp-listener.h>
-
-#ifndef APACHE2
-module MODULE_VAR_EXPORT ipp_module;
-#else
-module AP_MODULE_DECLARE_DATA ipp_module;
-#endif
-
-#ifndef AP_INIT_TAKE1 /* Apache 2.X has this, but 1.3.X does not */
-#define AP_INIT_NO_ARGS(directive, action, arg, where, mesg) \
- { directive, action, arg, where, NO_ARGS, mesg }
-#define AP_INIT_TAKE1(directive, action, arg, where, mesg) \
- { directive, action, arg, where, TAKE1, mesg }
-#define AP_INIT_TAKE2(directive, action, arg, where, mesg) \
- { directive, action, arg, where, TAKE2, mesg }
-#endif
-
-typedef struct {
- int conformance;
- char *default_user;
- char *default_svc;
- papi_attribute_t **operations;
-} IPPListenerConfig;
-
-#ifdef DEBUG
-void
-dump_buffer(FILE *fp, char *tag, char *buffer, int bytes)
-{
- int i, j, ch;
-
- fprintf(fp, "%s %d(0x%x) bytes\n", (tag ? tag : ""), bytes, bytes);
- for (i = 0; i < bytes; i += 16) {
- fprintf(fp, "%s ", (tag ? tag : ""));
-
- for (j = 0; j < 16 && (i + j) < bytes; j ++)
- fprintf(fp, " %02X", buffer[i + j] & 255);
-
- while (j < 16) {
- fprintf(fp, " ");
- j++;
- }
-
- fprintf(fp, " ");
- for (j = 0; j < 16 && (i + j) < bytes; j ++) {
- ch = buffer[i + j] & 255;
- if (ch < ' ' || ch == 127)
- ch = '.';
- putc(ch, fp);
- }
- putc('\n', fp);
- }
- fflush(fp);
-}
-#endif
-
-static ssize_t
-read_data(void *fd, void *buf, size_t siz)
-{
- ssize_t len_read;
- request_rec *ap_r = (request_rec *)fd;
-
- len_read = ap_get_client_block(ap_r, buf, siz);
-#ifndef APACHE2
- ap_reset_timeout(ap_r);
-#endif
-
-#ifdef DEBUG
- fprintf(stderr, "read_data(0x%8.8x, 0x%8.8x, %d): %d",
- fd, buf, siz, len_read);
- if (len_read < 0)
- fprintf(stderr, ": %s", strerror(errno));
- putc('\n', stderr);
- dump_buffer(stderr, "read_data:", buf, len_read);
-#endif
-
- return (len_read);
-}
-
-static ssize_t
-write_data(void *fd, void *buf, size_t siz)
-{
- ssize_t len_written;
- request_rec *ap_r = (request_rec *)fd;
-
-#ifndef APACHE2
- ap_reset_timeout(ap_r);
-#endif
-#ifdef DEBUG
- dump_buffer(stderr, "write_data:", buf, siz);
-#endif
- len_written = ap_rwrite(buf, siz, ap_r);
-
- return (len_written);
-}
-
-static void
-discard_data(request_rec *r)
-{
-#ifdef APACHE2
- (void) ap_discard_request_body(r);
-#else
- /*
- * This is taken from ap_discard_request_body(). The reason we can't
- * just use it in Apache 1.3 is that it does various timeout things we
- * don't want it to do. Apache 2.0 doesn't do that, so we can safely
- * use the normal function.
- */
- if (r->read_chunked || r->remaining > 0) {
- char dumpbuf[HUGE_STRING_LEN];
- int i;
-
- do {
- i = ap_get_client_block(r, dumpbuf, HUGE_STRING_LEN);
-#ifdef DEBUG
- dump_buffer(stderr, "discarded", dumpbuf, i);
-#endif
- } while (i > 0);
- }
-#endif
-}
-
-void _log_rerror(const char *file, int line, int level, request_rec *r,
- const char *fmt, ...)
-{
- va_list args;
- size_t size;
- char *message = alloca(BUFSIZ);
-
- va_start(args, fmt);
- /*
- * fill in the message. If the buffer is too small, allocate
- * one that is large enough and fill it in.
- */
- if ((size = vsnprintf(message, BUFSIZ, fmt, args)) >= BUFSIZ)
- if ((message = alloca(size)) != NULL)
- vsnprintf(message, size, fmt, args);
- va_end(args);
-
-#ifdef APACHE2
- ap_log_rerror(file, line, level, NULL, r, message);
-#else
- ap_log_rerror(file, line, level, r, message);
-#endif
-}
-
-static int
-ipp_handler(request_rec *r)
-{
- papi_attribute_t **request = NULL, **response = NULL;
- IPPListenerConfig *config;
- papi_status_t status;
- int ret;
-
- /* Really, IPP is all POST requests */
- if (r->method_number != M_POST)
- return (DECLINED);
-
-#ifndef APACHE2
- /*
- * An IPP request must have a MIME type of "application/ipp"
- * (RFC-2910, Section 4, page 19). If it doesn't match this
- * MIME type, we should decline the request and let someone else
- * try and handle it.
- */
- if (r->headers_in != NULL) {
- char *mime_type = (char *)ap_table_get(r->headers_in,
- "Content-Type");
-
- if ((mime_type == NULL) ||
- (strcasecmp(mime_type, "application/ipp") != 0))
- return (DECLINED);
- }
-#endif
- /* CHUNKED_DECHUNK might not work right for IPP? */
- if ((ret = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) != OK)
- return (ret);
-
- if (!ap_should_client_block(r))
- return (HTTP_INTERNAL_SERVER_ERROR);
-
-#ifndef APACHE2
- ap_soft_timeout("ipp_module: read/reply request ", r);
-#endif
- /* read the IPP request off the network */
- status = ipp_read_message(read_data, r, &request, IPP_TYPE_REQUEST);
-
- if (status != PAPI_OK)
- _log_rerror(APLOG_MARK, APLOG_ERR, r,
- "read failed: %s\n", papiStatusString(status));
-#ifdef DEBUG
- papiAttributeListPrint(stderr, request, "request (%d) ", getpid());
-#endif
-
- (void) papiAttributeListAddString(&request, PAPI_ATTR_EXCL,
- "originating-host", (char *)
-#ifdef APACHE2
- ap_get_remote_host
- (r->connection, r->per_dir_config, REMOTE_NAME, NULL));
-#else
- ap_get_remote_host
- (r->connection, r->per_dir_config, REMOTE_NAME));
-#endif
-
- (void) papiAttributeListAddInteger(&request, PAPI_ATTR_EXCL,
- "uri-port", ap_get_server_port(r));
- if (r->headers_in != NULL) {
- char *host = (char *)ap_table_get(r->headers_in, "Host");
-
- if ((host == NULL) || (host[0] == '\0'))
- host = (char *)ap_get_server_name(r);
-
- (void) papiAttributeListAddString(&request, PAPI_ATTR_EXCL,
- "uri-host", host);
- }
- (void) papiAttributeListAddString(&request, PAPI_ATTR_EXCL,
- "uri-path", r->uri);
-
- config = ap_get_module_config(r->per_dir_config, &ipp_module);
- if (config != NULL) {
- (void) papiAttributeListAddInteger(&request, PAPI_ATTR_EXCL,
- "conformance", config->conformance);
- (void) papiAttributeListAddCollection(&request, PAPI_ATTR_EXCL,
- "operations", config->operations);
- if (config->default_user != NULL)
- (void) papiAttributeListAddString(&request,
- PAPI_ATTR_EXCL, "default-user",
- config->default_user);
- if (config->default_svc != NULL)
- (void) papiAttributeListAddString(&request,
- PAPI_ATTR_EXCL, "default-service",
- config->default_svc);
- }
-
- /*
- * For Trusted Solaris, pass the fd number of the socket connection
- * to the backend so the it can be forwarded to the backend print
- * service to retrieve the sensativity label off of a multi-level
- * port.
- */
- (void) papiAttributeListAddInteger(&request, PAPI_ATTR_EXCL,
- "peer-socket", ap_bfileno(r->connection->client, B_RD));
-
- /* process the request */
- status = ipp_process_request(request, &response, read_data, r);
- if (status != PAPI_OK) {
- errno = 0;
- _log_rerror(APLOG_MARK, APLOG_ERR, r,
- "request failed: %s\n", papiStatusString(status));
- discard_data(r);
- }
-#ifdef DEBUG
- fprintf(stderr, "processing result: %s\n", papiStatusString(status));
- papiAttributeListPrint(stderr, response, "response (%d) ", getpid());
-#endif
-
- /*
- * If the client is using chunking and we have not yet received the
- * final "0" sized chunk, we need to discard any data that may
- * remain in the post request.
- */
- if ((r->read_chunked != 0) &&
- (ap_table_get(r->headers_in, "Content-Length") == NULL))
- discard_data(r);
-
- /* write an IPP response back to the network */
- r->content_type = "application/ipp";
-
-#ifndef APACHE2
- ap_send_http_header(r);
-#endif
-
- status = ipp_write_message(write_data, r, response);
- if (status != PAPI_OK)
- _log_rerror(APLOG_MARK, APLOG_ERR, r,
- "write failed: %s\n", papiStatusString(status));
-#ifdef DEBUG
- fprintf(stderr, "write result: %s\n", papiStatusString(status));
- fflush(stderr);
-#endif
-
- papiAttributeListFree(request);
- papiAttributeListFree(response);
-
-#ifndef APACHE2
- ap_kill_timeout(r);
- if (ap_rflush(r) < 0)
- _log_rerror(APLOG_MARK, APLOG_ERR, r,
- "flush failed, response may not have been sent");
-#endif
-
- return (OK);
-}
-
-
-/*ARGSUSED1*/
-static void *
-create_ipp_dir_config(
-#ifndef APACHE2
- pool *p,
-#else
- apr_pool_t *p,
-#endif
- char *dirspec)
-{
- IPPListenerConfig *config =
-#ifndef APACHE2
- ap_pcalloc(p, sizeof (*config));
-#else
- apr_pcalloc(p, sizeof (*config));
-#endif
-
- if (config != NULL) {
- (void) memset(config, 0, sizeof (*config));
- config->conformance = IPP_PARSE_CONFORMANCE_RASH;
- config->default_user = NULL;
- config->default_svc = NULL;
- (void) ipp_configure_operation(&config->operations, "required",
- "enable");
- }
-
- return (config);
-}
-
-/*ARGSUSED0*/
-static const char *
-ipp_conformance(cmd_parms *cmd, void *cfg, const char *arg)
-{
- IPPListenerConfig *config = (IPPListenerConfig *)cfg;
-
- if (strncasecmp(arg, "automatic", 4) == 0) {
- config->conformance = IPP_PARSE_CONFORMANCE_RASH;
- } else if (strcasecmp(arg, "1.0") == 0) {
- config->conformance = IPP_PARSE_CONFORMANCE_LOOSE;
- } else if (strcasecmp(arg, "1.1") == 0) {
- config->conformance = IPP_PARSE_CONFORMANCE_STRICT;
- } else {
- return ("unknown conformance, try (automatic/1.0/1.1)");
- }
-
- return (NULL);
-}
-
-/*ARGSUSED0*/
-static const char *
-ipp_operation(cmd_parms *cmd, void *cfg, char *op, char *toggle)
-{
- IPPListenerConfig *config = (IPPListenerConfig *)cfg;
- papi_status_t status;
-
- status = ipp_configure_operation(&config->operations, op, toggle);
- switch (status) {
- case PAPI_OK:
- return (NULL);
- case PAPI_BAD_ARGUMENT:
- return (gettext("internal error (invalid argument)"));
- default:
- return (papiStatusString(status));
- }
-
- /* NOTREACHED */
- /* return (gettext("contact your software vendor")); */
-}
-
-static const char *
-ipp_default_user(cmd_parms *cmd, void *cfg, const char *arg)
-{
- IPPListenerConfig *config = (IPPListenerConfig *)cfg;
-
- config->default_user = (char *)arg;
-
- return (NULL);
-}
-
-static const char *
-ipp_default_svc(cmd_parms *cmd, void *cfg, const char *arg)
-{
- IPPListenerConfig *config = (IPPListenerConfig *)cfg;
-
- config->default_svc = (char *)arg;
-
- return (NULL);
-}
-
-#ifdef DEBUG
-/*ARGSUSED0*/
-static const char *
-ipp_module_hang(cmd_parms *cmd, void *cfg)
-{
- static int i = 1;
-
- /* wait so we can attach a debugger, assign i = 0, and step through */
- while (i);
-
- return (NULL);
-}
-#endif /* DEBUG */
-
-static const command_rec ipp_cmds[] =
-{
- AP_INIT_TAKE1("ipp-conformance", ipp_conformance, NULL, ACCESS_CONF,
- "IPP protocol conformance (loose/strict)"),
- AP_INIT_TAKE2("ipp-operation", ipp_operation, NULL, ACCESS_CONF,
- "IPP protocol operations to enable/disable)"),
- AP_INIT_TAKE1("ipp-default-user", ipp_default_user, NULL, ACCESS_CONF,
- "default user for various operations"),
- AP_INIT_TAKE1("ipp-default-service", ipp_default_svc, NULL, ACCESS_CONF,
- "default service for various operations"),
-#ifdef DEBUG
- AP_INIT_NO_ARGS("ipp-module-hang", ipp_module_hang, NULL, ACCESS_CONF,
- "hang the module until we can attach a debugger (no args)"),
-#endif
- { NULL }
-};
-
-#ifdef APACHE2
-/*ARGSUSED0*/
-static const char *
-ipp_method(const request_rec *r)
-{
- return ("ipp");
-}
-
-/*ARGSUSED0*/
-static unsigned short
-ipp_port(const request_rec *r)
-{
- return (631);
-}
-
-/* Dispatch list for API hooks */
-/*ARGSUSED0*/
-static void
-ipp_register_hooks(apr_pool_t *p)
-{
- static const char * const modules[] = { "mod_dir.c", NULL };
-
- /* Need to make sure we don't get directory listings by accident */
- ap_hook_handler(ipp_handler, NULL, modules, APR_HOOK_MIDDLE);
- ap_hook_default_port(ipp_port, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_http_method(ipp_method, NULL, NULL, APR_HOOK_MIDDLE);
-}
-
-module AP_MODULE_DECLARE_DATA ipp_module = {
- STANDARD20_MODULE_STUFF,
- create_ipp_dir_config, /* create per-dir config */
- NULL, /* merge per-dir config */
- NULL, /* create per-server config */
- NULL, /* merge per-server config */
- ipp_cmds, /* table of config commands */
- ipp_register_hooks /* register hooks */
-};
-
-#else /* Apache 1.X */
-
-/* Dispatch list of content handlers */
-static const handler_rec ipp_handlers[] = {
- /*
- * This handler association causes all IPP request with the
- * correct MIME type to call the protocol handler.
- */
- { "application/ipp", ipp_handler },
- /*
- * This hander association is causes everything to go through the IPP
- * protocol request handler. This is necessary because client POST
- * request may be for something outside of the normal printer-uri
- * space.
- */
- { "*/*", ipp_handler },
-
- { NULL, NULL }
-};
-
-
-module MODULE_VAR_EXPORT ipp_module = {
- STANDARD_MODULE_STUFF,
- NULL, /* module initializer */
- create_ipp_dir_config, /* create per-dir config structures */
- NULL, /* merge per-dir config structures */
- NULL, /* create per-server config structures */
- NULL, /* merge per-server config structures */
- ipp_cmds, /* table of config file commands */
- ipp_handlers, /* [#8] MIME-typed-dispatched handlers */
- NULL, /* [#1] URI to filename translation */
- NULL, /* [#4] validate user id from request */
- NULL, /* [#5] check if the user is ok _here_ */
- NULL, /* [#3] check access by host address */
- NULL, /* [#6] determine MIME type */
- NULL, /* [#7] pre-run fixups */
- NULL, /* [#9] log a transaction */
- NULL, /* [#2] header parser */
- NULL, /* child_init */
- NULL, /* child_exit */
- NULL /* [#0] post read-request */
-};
-#endif
diff --git a/usr/src/lib/pylibbe/Makefile.com b/usr/src/lib/pylibbe/Makefile.com
index aa26dec043..9f964ce417 100644
--- a/usr/src/lib/pylibbe/Makefile.com
+++ b/usr/src/lib/pylibbe/Makefile.com
@@ -44,7 +44,8 @@ C99MODE= $(C99_ENABLE)
LIBS = $(DYNLIB)
LDLIBS += -lbe -lnvpair -lc
CFLAGS += $(CCVERBOSE)
-CPPFLAGS += -I/usr/include/python2.6 -D_FILE_OFFSET_BITS=64 -I../../libbe/common
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/python2.6 \
+ -D_FILE_OFFSET_BITS=64 -I../../libbe/common
.KEEP_STATE:
diff --git a/usr/src/lib/pysolaris/Makefile.com b/usr/src/lib/pysolaris/Makefile.com
index a27492771a..0e5b385bd8 100644
--- a/usr/src/lib/pysolaris/Makefile.com
+++ b/usr/src/lib/pysolaris/Makefile.com
@@ -44,6 +44,7 @@ C99LMODE= -Xc99=%all
LIBS = $(DYNLIB)
LDLIBS += -lc -lsec -lidmap -lpython2.6
CFLAGS += $(CCVERBOSE)
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/python2.6
CERRWARN += -_gcc=-Wno-unused-variable
CPPFLAGS += -I/usr/include/python2.6
diff --git a/usr/src/lib/pyzfs/Makefile.com b/usr/src/lib/pyzfs/Makefile.com
index 29d0407cae..a565ed8059 100644
--- a/usr/src/lib/pyzfs/Makefile.com
+++ b/usr/src/lib/pyzfs/Makefile.com
@@ -47,6 +47,7 @@ C99LMODE= -Xc99=%all
LIBS = $(DYNLIB)
LDLIBS += -lc -lnvpair -lpython2.6 -lzfs
CFLAGS += $(CCVERBOSE)
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/python2.6
CERRWARN += -_gcc=-Wno-unused-variable
CPPFLAGS += -I/usr/include/python2.6
CPPFLAGS += -I../../../uts/common/fs/zfs
diff --git a/usr/src/man/man1/Makefile b/usr/src/man/man1/Makefile
index 917c1ebae0..9233630f08 100644
--- a/usr/src/man/man1/Makefile
+++ b/usr/src/man/man1/Makefile
@@ -70,6 +70,7 @@ MANFILES= acctcom.1 \
clear.1 \
cmp.1 \
col.1 \
+ column.1 \
comm.1 \
command.1 \
compress.1 \
diff --git a/usr/src/man/man1/column.1 b/usr/src/man/man1/column.1
new file mode 100644
index 0000000000..38d9af86c5
--- /dev/null
+++ b/usr/src/man/man1/column.1
@@ -0,0 +1,129 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)column.1 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD$
+.\"
+.\" Portions Copyright (c) 2013 Joyent, Inc. All rights reserved.
+.\"
+.TH COLUMN 1 "Jan 10, 2013"
+.SH NAME
+column \- columnate lists
+.SH SYNOPSIS
+.LP
+.nf
+\fBcolumn\fR [\fB-tx\fR] [\fB-c\fR \fIcolumns\fR] [\fB-s\fR \fIsep\fR] [\fIfile\fR ... ]
+.fi
+
+.Sh DESCRIPTION
+.sp
+.LP
+The \fBcolumn\fR
+utility formats its input into multiple columns.
+Rows are filled before columns.
+Input is taken from
+\fIfile\fR
+operands, or, by default, from the standard input.
+Empty lines are ignored.
+.SH OPTIONS
+.sp
+.LP
+The options are as follows:
+.sp
+.ne 2
+.na
+\fB\fB-c\fR \fIcolumns\fR\fR
+.ad
+.RS 17n
+Output is formatted for a display \fIcolumns\fR
+wide.
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fB-s\fR \fIsep\fR\fR
+.ad
+.RS 17n
+Specify a set of characters to be used to delimit columns for the
+\fB-t\fR option.
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fB-t\fR\fR
+.ad
+.RS 17n
+Determine the number of columns the input contains and create a table.
+Columns are delimited with whitespace, by default, or with the characters
+supplied using the \fBs\fR
+option.
+Useful for pretty-printing displays.
+.RE
+
+.sp
+.ne 2
+.na
+\fB-x\fR
+.ad
+.RS 17n
+Fill columns before filling rows.
+.RE
+
+.SH ENVIRONMENT
+The COLUMNS , LANG , LC_ALL
+and
+LC_CTYPE
+environment variables affect the execution of
+\fBcolumn\fR
+as described in
+\fBenviron\fR(5).
+
+.SH EXIT STATUS
+The \fBcolumn\fR utility exits 0 on success and >0 if an error occurs.
+
+.SH EXAMPLES
+.sp
+.in +2
+.nf
+(printf \&"PERM LINKS OWNER GROUP SIZE MONTH DAY \&"\ \&;\ \&\e
+printf \&"HH:MM/YEAR NAME\en\&"\ \&;\ \&\e
+ls -l \&| sed 1d) \&| column -t
+.fi
+.in -2
+.sp
+
+
+.SH SEE ALSO
+\fBls\fR(1), \fBpaste\fR(1), \fBsort\fR(1)
+
+.SH HISTORY
+The \fBcolumn\fR command appeared in 4.3BSD-Reno.
+
+.SH BUGS
+Input lines are limited to LINE_MAX bytes in length.
diff --git a/usr/src/man/man1/crontab.1 b/usr/src/man/man1/crontab.1
index c93255f406..aae9ad44f1 100644
--- a/usr/src/man/man1/crontab.1
+++ b/usr/src/man/man1/crontab.1
@@ -1,6 +1,7 @@
'\" te
.\" Copyright 1989 AT&T
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright (c) 2011, Joyent, Inc. All Rights Reserved
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text
@@ -86,6 +87,15 @@ users' crontabs.
.LP
If \fBcrontab\fR is invoked with \fIfilename\fR, this overwrites an existing
\fBcrontab\fR entry for the user that invokes it.
+.sp
+.LP
+Cron supports a merged crontab with entries coming from either the user's
+\fB/var/spool/cron/crontabs\fR file or from the user's
+\fB/etc/cron.d/crontabs\fR file. The entries in the user's
+\fB/var/spool/cron/crontabs\fR file are meant to be editable whereas those in
+\fB/etc/cron.d/crontabs\fR are meant as system-defined entries which are not
+intended to be customized by the user. The dual set of crontab entries is only
+of interest to system-defined users such as \fBroot\fR.
.SS "\fBcrontab\fR Access Control"
.sp
.LP
@@ -343,6 +353,9 @@ file using the \fB-r\fR option.
If \fIusername\fR is specified, the specified user's \fBcrontab\fR file is
edited, rather than the current user's \fBcrontab\fR file. This can only be
done by root or by a user with the \fBsolaris.jobs.admin\fR authorization.
+.sp
+Only the entries in the user's \fB/var/spool/cron/crontabs\fR file are
+editable.
.RE
.sp
@@ -354,6 +367,9 @@ done by root or by a user with the \fBsolaris.jobs.admin\fR authorization.
Lists the \fBcrontab\fR file for the invoking user. Only root or a user with
the \fBsolaris.jobs.admin\fR authorization can specify a username following the
\fB-l\fR option to list the \fBcrontab\fR file of the specified user.
+.sp
+Entries from both the user's \fB/var/spool/cron/crontabs\fR file and thhe user's
+\fB/etc/cron.d/crontabs\fR file will be merged in the output.
.RE
.sp
@@ -583,6 +599,17 @@ list of denied users
.sp
.ne 2
.na
+\fB\fB/etc/cron.d/crontabs\fR\fR
+.ad
+.RS 28n
+.rt
+system spool area for \fBcrontab\fR
+.RE
+
+.sp
+.ne 2
+.mk
+.na
\fB\fB/var/cron/log\fR\fR
.ad
.RS 28n
diff --git a/usr/src/man/man1/date.1 b/usr/src/man/man1/date.1
index 08c3b0b878..b996174472 100644
--- a/usr/src/man/man1/date.1
+++ b/usr/src/man/man1/date.1
@@ -155,6 +155,12 @@ Century (a year divided by 100 and truncated to an integer) as a decimal number
[00-99].
.RE
+In addition, the nonstandard conversion specification \fB%N\fR is also
+supported, and is converted to the zero-padded number of nanoseconds since the
+last second. Note that the actual resolution of this number is limited to the
+resolution of the system's \fBCLOCK_REALTIME\fR clock. See
+\fBclock_gettime\fR(3C).
+
The string is always terminated with a NEWLINE. An argument containing blanks
must be quoted; see the EXAMPLES section.
.RE
diff --git a/usr/src/man/man1/ld.1 b/usr/src/man/man1/ld.1
index 634f16e0d1..be9394d829 100644
--- a/usr/src/man/man1/ld.1
+++ b/usr/src/man/man1/ld.1
@@ -24,7 +24,7 @@ ld \- link-editor for object files
[\fB-z\fR combreloc | nocombreloc ] [\fB-z\fR defs | nodefs]
[\fB-z\fR direct | nodirect] [\fB-z\fR endfiltee]
[\fB-z\fR fatal-warnings | nofatal-warnings ] [\fB-z\fR finiarray=\fIfunction\fR]
-[\fB-z\fR globalaudit] [\fB-z\fR groupperm | nogroupperm]
+[\fB-z\fR globalaudit] [\fB-z\fR groupperm | nogroupperm] [\fB-z\fR help ]
[\fB-z\fR guidance[=\fIid1\fR,\fIid2\fR...] [\fB-z\fR help ]
[\fB-z\fR ignore | record] [\fB-z\fR initarray=\fIfunction\fR] [\fB-z\fR initfirst]
[\fB-z\fR interpose] [\fB-z\fR lazyload | nolazyload]
diff --git a/usr/src/man/man1/mdb.1 b/usr/src/man/man1/mdb.1
index a64d145527..f3a084d151 100644
--- a/usr/src/man/man1/mdb.1
+++ b/usr/src/man/man1/mdb.1
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH MDB 1 "Nov 30, 2005"
+.TH MDB 1 "Oct 05, 2012"
.SH NAME
mdb \- modular debugger
.SH SYNOPSIS
@@ -11,7 +12,7 @@ mdb \- modular debugger
.nf
\fBmdb\fR [\fB-fkmuwyAFKMSUW\fR] [\(+-o \fIoption\fR] [\fB-p\fR \fIpid\fR] [\fB-s\fR \fIdistance\fR]
[\fB-I\fR \fIpath\fR] [\fB-L\fR \fIpath\fR] [\fB-P\fR \fIprompt\fR] [\fB-R\fR \fIroot\fR]
- [\fB-V\fR \fIdis-version\fR] [object [core] | core | suffix]
+ [\fB-V\fR \fIdis-version\fR] [\fB-e\fR \fIexpr\fR] [object [core] | core | suffix]
.fi
.SH DESCRIPTION
@@ -3716,6 +3717,18 @@ system or an operating system crash dump.
.sp
.ne 2
.na
+\fB\fB-e\fR \fIexpr\fR\fR
+.ad
+.RS 15n
+Causes \fBmdb\fR to ignore standard input and instead evaluate the \fBmdb\fR
+expression \fIexpr\fR. Upon completing evaluation, \fBmdb\fR terminates and
+returns a status code. A non-zero return code from \fBmdb\fR indicates that
+either \fBmdb\fR or the evaluation of \fIexpr\fR failed.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB-f\fR\fR
.ad
.RS 15n
diff --git a/usr/src/man/man1/nawk.1 b/usr/src/man/man1/nawk.1
index 425db5d299..2c27e1baa0 100644
--- a/usr/src/man/man1/nawk.1
+++ b/usr/src/man/man1/nawk.1
@@ -15,6 +15,12 @@ nawk \- pattern scanning and processing language
.SH SYNOPSIS
.LP
.nf
+\fB/usr/bin/awk\fR [\fB-F\fR \fIERE\fR] [\fB-v\fR \fIassignment\fR] \fI\&'program'\fR | \fB-f\fR \fIprogfile\fR...
+ [\fIargument\fR]...
+.fi
+
+.LP
+.nf
\fB/usr/bin/nawk\fR [\fB-F\fR \fIERE\fR] [\fB-v\fR \fIassignment\fR] \fI\&'program'\fR | \fB-f\fR \fIprogfile\fR...
[\fIargument\fR]...
.fi
@@ -28,7 +34,8 @@ nawk \- pattern scanning and processing language
.SH DESCRIPTION
.sp
.LP
-The \fB/usr/bin/nawk\fR and \fB/usr/xpg4/bin/awk\fR utilities execute
+The \fB/usr/bin/awk\fR, \fB/usr/bin/nawk\fR and \fB/usr/xpg4/bin/awk\fR
+utilities execute
\fIprogram\fRs written in the \fBnawk\fR programming language, which is
specialized for textual data manipulation. A \fBnawk\fR \fIprogram\fR is a
sequence of patterns and corresponding actions. The string specifying
diff --git a/usr/src/man/man1/proc.1 b/usr/src/man/man1/proc.1
index cd20e215e3..bf0e588012 100644
--- a/usr/src/man/man1/proc.1
+++ b/usr/src/man/man1/proc.1
@@ -2,10 +2,11 @@
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
.\" Portions Copyright 2008 Chad Mynhier
.\" Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
+.\" Copyright 2013 (c) Joyent, Inc. All rights reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH PROC 1 "Oct 23, 2012"
+.TH PROC 1 "Apr 01, 2013"
.SH NAME
proc, pflags, pcred, pldd, psig, pstack, pfiles, pwdx, pstop, prun, pwait,
ptime \- proc tools
@@ -72,7 +73,7 @@ ptime \- proc tools
.LP
.nf
-\fB/usr/bin/ptime\fR [\fB-Fm\fR] [\fB-p\fR] \fIpid\fR...
+\fB/usr/bin/ptime\fR [\fB-Fm\fR] \fB-p pidlist\fR
.fi
.LP
@@ -215,8 +216,10 @@ Time the \fIcommand\fR, like \fBtime\fR(1), but using microstate accounting for
reproducible precision. Unlike \fBtime\fR(1), children of the command are not
timed.
.sp
-If the \fB-p\fR \fIpid\fR version is used, display a snapshot of timing
-statistics for the specified \fIpid\fR.
+If the \fB-p\fR \fIpidlist\fR version is used, display a snapshot of timing
+statistics for the specified processes. The \fIpidlist\fR may either be a comma
+delineated list or a space delineated list. Space delineated lists must be
+properly quoted to assure that they are in a single argument.
.RE
.SH OPTIONS
diff --git a/usr/src/man/man1/ps.1 b/usr/src/man/man1/ps.1
index 8e97b196c2..674e326e29 100644
--- a/usr/src/man/man1/ps.1
+++ b/usr/src/man/man1/ps.1
@@ -37,6 +37,9 @@ displayed is controlled by the options.
Some options accept lists as arguments. Items in a list can be either separated
by commas or else enclosed in quotes and separated by commas or spaces. Values
for \fIproclist\fR and \fIgrplist\fR must be numeric.
+.sp
+.LP
+The \fBps\fR command also accepts BSD-style options. See \fBps\fR(1b).
.SH OPTIONS
.sp
.LP
@@ -1295,7 +1298,8 @@ Standard See \fBstandards\fR(5).
.sp
.LP
\fBkill\fR(1), \fBlgrpinfo\fR(1), \fBnice\fR(1), \fBpagesize\fR(1),
-\fBpmap\fR(1), \fBpriocntl\fR(1), \fBwho\fR(1), \fBgetty\fR(1M), \fBproc\fR(4),
+\fBpmap\fR(1), \fBpriocntl\fR(1), \fBps\fR(1b), \fBwho\fR(1), \fBgetty\fR(1M),
+\fBproc\fR(4),
\fBttysrch\fR(4), \fBattributes\fR(5), \fBenviron\fR(5),
\fBresource_controls\fR(5), \fBstandards\fR(5), \fBzones\fR(5)
.SH NOTES
diff --git a/usr/src/man/man1/sed.1 b/usr/src/man/man1/sed.1
index ded1c15fa3..9ec2b67dd9 100644
--- a/usr/src/man/man1/sed.1
+++ b/usr/src/man/man1/sed.1
@@ -1,8 +1,6 @@
.\" Copyright (c) 1992, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
-.\" Copyright 2011 Nexenta Systems, Inc. All rights reserved.
-.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\"
@@ -30,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.TH SED 1 "Nov 2, 2011"
+.TH SED 1 "May 24, 2009"
.SH NAME
\fBsed\fP
\- stream editor
@@ -45,7 +43,8 @@
[\fB\-Ealnr\fP]
[\fB\-e\fP \fIcommand\fP]
[\fB\-f\fP \fIcommand_file\fP]
-[\fB\-I\fP[\fIextension\fP] | \fB\-i\fP[\fIextension\fP]]
+[\fB\-I\fP \fIextension\fP]
+[\fB\-i\fP \fIextension\fP]
[\fIfile ...\fP]
.SH DESCRIPTION
The
@@ -98,11 +97,16 @@ Append the editing commands found in the file
to the list of commands.
The editing commands should each be listed on a separate line.
.TP
-\fB\-I\fP[\fIextension\fP]
-Edit files in-place, saving backups if \fIextension\fP was specified.
-It is not recommended to omit saving backups when in-place editing files,
-as you risk corruption or partial content in situations where disk
-space is exhausted, etc.
+\fB\-I\fP \fIextension\fP
+Edit files in-place, saving backups with the specified
+\fIextension\fP.
+If a zero-length
+\fIextension\fP
+is given, no backup will be saved.
+It is not recommended to give a zero-length
+\fIextension\fP
+when in-place editing files, as you risk corruption or partial content
+in situations where disk space is exhausted, etc.
Note that in-place editing with
\fB\-I\fP
@@ -120,7 +124,7 @@ where using
\fB\-i\fP
is desired.
.TP
-\fB\-i\fP[\fIextension\fP]
+\fB\-i\fP \fIextension\fP
Edit files in-place similarly to
\fB\-I\fP,
but treat each file independently from other files.
diff --git a/usr/src/man/man1/tail.1 b/usr/src/man/man1/tail.1
index aca819269e..b96e6400dd 100644
--- a/usr/src/man/man1/tail.1
+++ b/usr/src/man/man1/tail.1
@@ -23,12 +23,12 @@ tail \- deliver the last part of a file
.LP
.nf
-\fB/usr/bin/tail\fR [\(+- \fInumber\fR [lbcf]] [\fIfile\fR]
+\fB/usr/bin/tail\fR [\(+- \fInumber\fR [lbcfF]] [\fIfile\fR]
.fi
.LP
.nf
-\fB/usr/bin/tail\fR [\fB-lbcf\fR] [\fIfile\fR]
+\fB/usr/bin/tail\fR [\fB-lbcfF\fR] [\fIfile\fR]
.fi
.LP
@@ -92,11 +92,24 @@ Units of bytes.
\fB\fB-f\fR \fR
.ad
.RS 7n
-Follow. If the input-file is not a pipe, the program does not terminate after
-the line of the input-file has been copied, but enters an endless loop, wherein
-it sleeps for a second and then attempts to read and copy further records from
-the input-file. Thus it can be used to monitor the growth of a file that is
-being written by some other process.
+Follow. If the input-file is not a pipe, \fBtail\fR does not terminate after
+the last line of the input-file has been copied, but enters an endless loop,
+wherein it watches the file for modifications and attempts to read and copy
+further records from the input-file. Thus it can be used to monitor the growth
+of a file that is being written by some other process. If the watched file is
+truncated \fBtail\fR will begin reading records from the start of the file.
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fB-F\fR \fR
+.ad
+.RS 7n
+Follow named file. Operates as with \fB-f\fR, except that if the file is moved
+(e.g. if a watched log file is rotated) \fBtail\fR will close the original file
+and begin reading records from the start of the file with the specified name
+if and when that file is recreated.
.RE
.sp
diff --git a/usr/src/man/man1m/Makefile b/usr/src/man/man1m/Makefile
index 4a8dc8849d..afb8908d0e 100644
--- a/usr/src/man/man1m/Makefile
+++ b/usr/src/man/man1m/Makefile
@@ -11,6 +11,7 @@
#
# Copyright 2011, Richard Lowe
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
# Copyright 2012 Nexenta Systems, Inc. All rights reserved.
#
@@ -236,7 +237,8 @@ COMMON_MANFILES = 6to4relay.1m \
intrstat.1m \
iostat.1m \
ipaddrsel.1m \
- ipadm.1m \
+ ipadm.1m \
+ ipdadm.1m \
ipf.1m \
ipfs.1m \
ipfstat.1m \
diff --git a/usr/src/man/man1m/dladm.1m b/usr/src/man/man1m/dladm.1m
index bf20443ad8..a2050328b7 100644
--- a/usr/src/man/man1m/dladm.1m
+++ b/usr/src/man/man1m/dladm.1m
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright (c) 2011, Joyent, Inc. All Rights Reserved
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text
.\" are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical
@@ -15,7 +16,7 @@ dladm \- administer data links
.LP
.nf
\fBdladm show-link\fR [\fB-P\fR] [\fB-s\fR [\fB-i\fR \fIinterval\fR]] [[\fB-p\fR] \fB-o\fR \fIfield\fR[,...]] [\fIlink\fR]
-\fBdladm rename-link\fR [\fB-R\fR \fIroot-dir\fR] \fIlink\fR \fInew-link\fR
+\fBdladm rename-link\fR [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fIlink\fR \fInew-link\fR
.fi
.LP
@@ -98,9 +99,11 @@ dladm \- administer data links
.LP
.nf
-\fBdladm set-linkprop\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] \fB-p\fR \fIprop\fR=\fIvalue\fR[,...] \fIlink\fR
-\fBdladm reset-linkprop\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-p\fR \fIprop\fR[,...]] \fIlink\fR
-\fBdladm show-linkprop\fR [\fB-P\fR] [[\fB-c\fR] \fB-o\fR \fIfield\fR[,...]] [\fB-p\fR \fIprop\fR[,...]] [\fIlink\fR]
+\fBdladm set-linkprop\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fB-p\fR \fIprop\fR=\fIvalue\fR[,...]
+ \fIlink\fR
+\fBdladm reset-linkprop\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] [\fB-p\fR \fIprop\fR[,...]] \fIlink\fR
+\fBdladm show-linkprop\fR [\fB-P\fR] [\fB-z\fR \fIzonename\fR] [[\fB-c\fR] \fB-o\fR \fIfield\fR[,...]]
+ [\fB-p\fR \fIprop\fR[,...]] [\fIlink\fR]
.fi
.LP
@@ -115,9 +118,9 @@ dladm \- administer data links
\fBdladm create-vnic\fR [\fB-t\fR] \fB-l\fR \fIlink\fR [\fB-R\fR \fIroot-dir\fR] [\fB-m\fR \fIvalue\fR | auto |
{factory \fB-n\fR \fIslot-identifier\fR]} | {random [\fB-r\fR \fIprefix\fR]}]
[\fB-v\fR \fIvlan-id\fR] [\fB-p\fR \fIprop\fR=\fIvalue\fR[,...]] \fIvnic-link\fR
-\fBdladm delete-vnic\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] \fIvnic-link\fR
+\fBdladm delete-vnic\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fIvnic-link\fR
\fBdladm show-vnic\fR [\fB-pP\fR] [\fB-s\fR [\fB-i\fR \fIinterval\fR]] [\fB-o\fR \fIfield\fR[,...]]
- [\fB-l\fR \fIlink\fR] [\fIvnic-link\fR]
+ [\fB-l\fR \fIlink\fR] [\fB-z\fR \fIzonename\fR] [\fIvnic-link\fR]
.fi
.LP
@@ -570,8 +573,7 @@ will be displayed only once.
.sp
.ne 2
.na
-\fB\fBdladm rename-link\fR [\fB-R\fR \fIroot-dir\fR] \fIlink\fR
-\fInew-link\fR\fR
+\fB\fBdladm rename-link\fR [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fIlink\fR \fInew-link\fR\fR
.ad
.sp .6
.RS 4n
@@ -589,6 +591,17 @@ examples of how this subcommand is used.
See "Options," above.
.RE
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-z\fR \fIzonename\fR
+.ad
+.sp .6
+.RS 4n
+A link assigned to a zone can only be renamed while the zone is in the ready state.
+.RE
+
.RE
.sp
@@ -3135,8 +3148,7 @@ Extended output is displayed for \fBPTYPE\fR values of \fBcurrent\fR,
.sp
.ne 2
.na
-\fB\fBdladm set-linkprop\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] \fB-p\fR
-\fIprop\fR=\fIvalue\fR[,...] \fIlink\fR\fR
+\fB\fBdladm set-linkprop\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fB-p\fR \fIprop\fR=\fIvalue\fR[,...] \fIlink\fR\fR
.ad
.sp .6
.RS 4n
@@ -3168,6 +3180,17 @@ See "Options," above.
.sp
.ne 2
.na
+\fB\fB-z\fR \fIzonenme\fR
+.ad
+.sp .6
+.RS 4n
+Operate on a link that has been delegated to the specified zone.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
\fB\fB-p\fR \fIprop\fR=\fIvalue\fR[,...], \fB--prop\fR
\fIprop\fR=\fIvalue\fR[,...]\fR
.ad
@@ -3187,8 +3210,7 @@ same value.
.sp
.ne 2
.na
-\fB\fBdladm reset-linkprop\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-p\fR
-\fIprop\fR,...] \fIlink\fR\fR
+\fB\fBdladm reset-linkprop\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] [\fB-p\fR \fIprop\fR,...] \fIlink\fR\fR
.ad
.sp .6
.RS 4n
@@ -3220,6 +3242,17 @@ See "Options," above.
.sp
.ne 2
.na
+\fB\fB-z\fR \fIzonenme\fR
+.ad
+.sp .6
+.RS 4n
+Operate on a link that has been delegated to the specified zone.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
\fB\fB-p\fR \fIprop, ...\fR, \fB--prop\fR=\fIprop, ...\fR\fR
.ad
.sp .6
@@ -3234,8 +3267,7 @@ the same value.
.sp
.ne 2
.na
-\fB\fBdladm show-linkprop\fR [\fB-P\fR] [[\fB-c\fR] \fB-o\fR
-\fIfield\fR[,...]][\fB-p\fR \fIprop\fR[,...]] [\fIlink\fR]\fR
+\fB\fBdladm show-linkprop\fR [\fB-P\fR] [\fB-z\fR \fIzonename\fR] [[\fB-c\fR] \fB-o\fR \fIfield\fR[,...]][\fB-p\fR \fIprop\fR[,...]] [\fIlink\fR]\fR
.ad
.sp .6
.RS 4n
@@ -3353,6 +3385,17 @@ Display persistent link property information
.sp
.ne 2
.na
+\fB\fB-z\fR \fIzonenme\fR
+.ad
+.sp .6
+.RS 4n
+Operate on a link that has been delegated to the specified zone.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
\fB\fB-p\fR \fIprop, ...\fR, \fB--prop\fR=\fIprop, ...\fR\fR
.ad
.sp .6
@@ -3670,8 +3713,7 @@ A comma-separated list of properties to set to the specified values.
.sp
.ne 2
.na
-\fB\fBdladm delete-vnic\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR]
-\fIvnic-link\fR\fR
+\fB\fBdladm delete-vnic\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fIvnic-link\fR\fR
.ad
.sp .6
.RS 4n
@@ -3697,13 +3739,23 @@ next reboot.
See "Options," above.
.RE
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-z\fR \fIzonenme\fR
+.ad
+.sp .6
+.RS 4n
+Operate on a link that has been delegated to the specified zone.
+.RE
+
.RE
.sp
.ne 2
.na
-\fB\fBdladm show-vnic\fR [\fB-pP\fR] [\fB-s\fR [\fB-i\fR \fIinterval\fR]]
-[\fB-o\fR \fIfield\fR[,...]] [\fB-l\fR \fIlink\fR] [\fIvnic-link\fR]\fR
+\fB\fBdladm show-vnic\fR [\fB-pP\fR] [\fB-s\fR [\fB-i\fR \fIinterval\fR]] [\fB-o\fR \fIfield\fR[,...]] [\fB-l\fR \fIlink\fR] [\fB-z\fR \fIzonename\fR] [\fIvnic-link\fR]\fR
.ad
.sp .6
.RS 4n
@@ -3846,6 +3898,17 @@ will be displayed only once.
Display information for all VNICs on the named link.
.RE
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-z\fR \fIzonenme\fR
+.ad
+.sp .6
+.RS 4n
+Operate on a link that has been delegated to the specified zone.
+.RE
+
.RE
.sp
diff --git a/usr/src/man/man1m/flowadm.1m b/usr/src/man/man1m/flowadm.1m
index b12ce6af96..a64a703612 100644
--- a/usr/src/man/man1m/flowadm.1m
+++ b/usr/src/man/man1m/flowadm.1m
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright (c) 2011, Joyent, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
@@ -11,14 +12,14 @@ services, containers, and virtual machines
.LP
.nf
\fBflowadm show-flow\fR [\fB-pP\fR] [\fB-S\fR] [\fB-s\fR [\fB-i\fR \fIinterval\fR]] [\fB-l\fR \fIlink\fR]
- [\fB-o\fR \fIfield\fR[,...]] [\fIflow\fR]
+ [\fB-o\fR \fIfield\fR[,...]] [\fB-z\fR \fIzonename\fR] [\fIflow\fR]
.fi
.LP
.nf
-\fBflowadm add-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] \fB-l\fR \fIlink\fR \fB-a\fR \fIattr\fR=\fIvalue\fR[,...]
- \fB-p\fR \fIprop\fR=\fIvalue\fR[,...] \fIflow\fR
-\fBflowadm remove-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] {\fB-l\fR \fIlink\fR | \fIflow\fR}
+\fBflowadm add-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fB-l\fR \fIlink\fR
+ \fB-a\fR \fIattr\fR=\fIvalue\fR[,...] \fB-p\fR \fIprop\fR=\fIvalue\fR[,...] \fIflow\fR
+\fBflowadm remove-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] {\fB-l\fR \fIlink\fR | \fIflow\fR}
.fi
.LP
@@ -77,8 +78,7 @@ The following subcommands are supported:
.sp
.ne 2
.na
-\fB\fBflowadm show-flow\fR [\fB-pP\fR] [\fB-s\fR [\fB-i\fR \fIinterval\fR]]
-[\fB-o\fR \fIfield\fR[,...]] [\fB-l\fR \fIlink\fR] [\fIflow\fR]\fR
+\fB\fBflowadm show-flow\fR [\fB-pP\fR] [\fB-s\fR [\fB-i\fR \fIinterval\fR]] [\fB-o\fR \fIfield\fR[,...]] [\fB-l\fR \fIlink\fR] [\fB-z\fR \fIzonename\fR] [\fIflow\fR]\fR
.ad
.sp .6
.RS 4n
@@ -223,14 +223,23 @@ Display information for all flows on the named link or information for the
named flow.
.RE
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-z\fR \fIzonename\fR
+.ad
+.sp .6
+.RS 4n
+Operate on a link that has been delegated to the specified zone.
+.RE
+
.RE
.sp
.ne 2
.na
-\fB\fBflowadm add-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] \fB-l\fR
-\fIlink\fR \fB-a\fR \fIattr\fR=\fIvalue\fR[,...] \fB-p\fR
-\fIprop\fR=\fIvalue\fR[,...] \fIflow\fR\fR
+\fB\fBflowadm add-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fB-l\fR \fIlink\fR \fB-a\fR \fIattr\fR=\fIvalue\fR[,...] \fB-p\fR \fIprop\fR=\fIvalue\fR[,...] \fIflow\fR\fR
.ad
.sp .6
.RS 4n
@@ -268,6 +277,17 @@ persistent creation.
.sp
.ne 2
.na
+\fB\fB-z\fR \fIzonename\fR
+.ad
+.sp .6
+.RS 4n
+Operate on a link that has been delegated to the specified zone.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
\fB\fB-l\fR \fIlink\fR, \fB--link\fR=\fIlink\fR\fR
.ad
.sp .6
@@ -300,8 +320,7 @@ A comma-separated list of properties to be set to the specified values.
.sp
.ne 2
.na
-\fB\fBflowadm remove-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] \fB-l\fR
-{\fIlink\fR | \fIflow\fR}\fR
+\fB\fBflowadm remove-flow\fR [\fB-t\fR] [\fB-R\fR \fIroot-dir\fR] [\fB-z\fR \fIzonename\fR] \fB-l\fR {\fIlink\fR | \fIflow\fR}\fR
.ad
.sp .6
.RS 4n
@@ -331,6 +350,17 @@ persistent removal.
.sp
.ne 2
.na
+\fB\fB-z\fR \fIzonename\fR
+.ad
+.sp .6
+.RS 4n
+Operate on a link that has been delegated to the specified zone.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
\fB\fB-l\fR \fIlink\fR | \fIflow\fR, \fB--link\fR=\fIlink\fR | \fIflow\fR\fR
.ad
.sp .6
diff --git a/usr/src/man/man1m/ipdadm.1m b/usr/src/man/man1m/ipdadm.1m
new file mode 100644
index 0000000000..8d5eec4331
--- /dev/null
+++ b/usr/src/man/man1m/ipdadm.1m
@@ -0,0 +1,223 @@
+'\" te
+.\" Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
+.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
+.TH IPDADM 1M "Mar 1, 2012"
+.SH NAME
+ipdadm \- administer the Internet packet disturber
+.SH SYNOPSIS
+.LP
+.nf
+\fBipdadm\fR [\fB-z\fR \fIzonename\fR] \fIsubcommand\fR [\fIsubcommand-options\fR]
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+The ipdadm utility is used to administer the illumos facility for simulating
+pathological networks by induce packet drops, delays, and corruption.
+
+This functionality is only able to the global zone and zones with exclusive
+networking stacks. If this is enabled for the global zone, any zone with a
+shared networking stack will be affected.
+
+.SH OPTIONS
+.sp
+.LP
+The following options are supported:
+.sp
+.ne 2
+.na
+\fB-z\fR
+.ad
+.sp .6
+.RS 4n
+The string of the zonename to control. If this is not specified, the current
+zone is used. For the list subcommand, this option is not supported.
+.RE
+
+.SH SUBCOMMANDS
+.sp
+.LP
+The following subcommands are supported:
+
+.sp
+.ne 2
+.na
+\fBcorrupt\fR \fIpercent\fR
+.ad
+.sp .6
+.RS 4n
+Sets the chance for packets to be corrupted to \fIpercent\fR which must be an
+integer between 0 and 100. Setting \fIpercent\fR to 0 disables packet corruption
+and is equivalent to calling \fBremove\fR \fIcorrupt\fR. When enabled, a random
+byte will have a single bit flipped.
+.sp
+.RE
+
+.sp
+.ne 2
+.na
+\fBdelay\fR \fImicroseconds\fR
+.ad
+.sp .6
+.RS 4n
+Inserts \fImicroseconds\fR of delay between both the transmit and receive of
+each packet. Setting \fImicroseconds\fR to zero is equivalent to calling
+\fBremove\fR \fIdelay\fR.
+.sp
+.RE
+
+.sp
+.ne 2
+.na
+\fBdrop\fR \fIpercent\fR
+.ad
+.sp .6
+.RS 4n
+Sets the chance for packets to be dropped to \fIpercent\fR. \fIpercent\fR must
+be an integer between 0 and 100. Setting \fIpercent\fR to zero is equivalent to
+calling \fBremove\fR \fIdrop\fR.
+.sp
+.RE
+
+.sp
+.ne 2
+.na
+\fBinfo\fR
+.ad
+.sp .6
+.RS 4n
+Prints the current values for packet corruption, packet dropping, and packet
+delay for the zone.
+.sp
+.RE
+
+.sp
+.ne 2
+.na
+\fBlist\fR
+.ad
+.sp .6
+.RS 4n
+Prints out the zonename of each zone that has active (non-zero) packet
+corruption, packet delay, and packet drop.
+.sp
+.RE
+
+.sp
+.ne 2
+.na
+\fBremove\fR \fIcorrupt\fR,\fIdelay\fI,\fIdrop\fR
+.ad
+.sp .6
+.RS 4n
+Disables the requested forms of packet perturbation for the zone. This is
+functionally equivalent to setting the value to zero. One or more of
+\fIcorrupt\fR, \fIdelay\fR, and \fIdrop\fR can be specified as a comma separated
+list.
+.sp
+.RE
+
+.SH EXAMPLES
+.LP
+\fBExample 1 \fRViewing zone information
+.sp
+.LP
+The following command illustrates how to obtain information about a specific
+zone while in the global zone.
+
+.sp
+.in +2
+.nf
+# \fBipdadm -z 949860c5-52e2-4f32-965d-02e60e116b72 info\fR
+ipd information for zone 949860c5-52e2-4f32-965d-02e60e116b72:
+ corrupt: 0% chance of packet corruption
+ drop: 0% chance of packet drop
+ delay: 0 microsecond delay per packet
+.fi
+.in -2
+.sp
+
+.LP
+\fBExample 2 \fRRemoving multiple perturbations
+.sp
+.LP
+The following command illustrates the use of the \fBremove\fR subcommand from
+inside of a zone.
+
+.sp
+.in +2
+.nf
+# \fBipdadm remove corrupt,drop\fR
+.fi
+.in -2
+.sp
+
+.LP
+\fBExample 3 \fREnabling packet drops
+.sp
+.LP
+The following command illustrates the use of the \fBdrop\fR subcommand from the
+global zone.
+
+.sp
+.in +2
+.nf
+# \fBipdadm -z 949860c5-52e2-4f32-965d-02e60e116b72 drop 25\fR
+.fi
+.in -2
+.sp
+
+
+.SH EXIT STATUS
+.sp
+.LP
+The following exit values are returned:
+.sp
+.ne 2
+.na
+\fB0\fR
+.ad
+.RS 5n
+Successful completion.
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fB1\fR\fR
+.ad
+.RS 5n
+An error occurred.
+.sp
+.sp
+.ne 2
+.na
+\fB\fB2\fR\fR
+.ad
+.RS 5n
+Invalid command line options or arguments were specified.
+.RE
+
+.SH ATTRIBUTES
+.sp
+.LP
+See \fBattributes\fR(5) for descriptions of the following attributes:
+.sp
+
+.sp
+.TS
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
+_
+Interface Stability Evolving
+.TE
+
+.SH SEE ALSO
+.sp
+.LP
+\fBzonename\fR(1),\fBzoneadm\fR(1M), \fBattributes\fR(5), \fBzones(5)\fR
diff --git a/usr/src/man/man1m/ipf.1m b/usr/src/man/man1m/ipf.1m
index 69cdacf689..63fb6a460d 100644
--- a/usr/src/man/man1m/ipf.1m
+++ b/usr/src/man/man1m/ipf.1m
@@ -2,7 +2,8 @@
.\" To view license terms, attribution, and copyright for IP Filter, the default path is /usr/lib/ipf/IPFILTER.LICENCE. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed
.\" location.
.\" Portions Copyright (c) 2009, Sun Microsystems Inc. All Rights Reserved.
-.TH IPF 1M "Feb 25, 2009"
+.\" Portions Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
+.TH IPF 1M "Nov 26, 2012"
.SH NAME
ipf \- alter packet filtering lists for IP packet input and output
.SH SYNOPSIS
@@ -10,7 +11,7 @@ ipf \- alter packet filtering lists for IP packet input and output
.nf
\fBipf\fR [\fB-6AdDEInoPRrsvVyzZ\fR] [\fB-l\fR block | pass | nomatch]
[\fB-T\fR \fIoptionlist\fR] [\fB-F\fR i | o | a | s | S] \fB-f\fR \fIfilename\fR
- [\fB-f\fR \fIfilename\fR...]
+ [\fB-f\fR \fIfilename\fR...] [\fIzonename\fR]
.fi
.SH DESCRIPTION
@@ -459,6 +460,14 @@ Zero global statistics held in the kernel for filtering only. This does not
affect fragment or state statistics.
.RE
+.SH ZONES
+.sp
+.LP
+ipf optionally takes a zone name as an argument, which will change the
+ipfilter settings for that zone, rather than the current one. The zonename
+option is only available in the Global Zone. Using it in any other zone will
+return an error.
+
.SH FILES
.sp
.ne 2
@@ -519,7 +528,7 @@ Interface Stability Committed
.LP
\fBipfstat\fR(1M), \fBipmon\fR(1M), \fBipnat\fR(1M), \fBippool\fR(1M),
\fBsvcadm\fR(1M), \fBsvc.ipfd\fR(1M), \fBipf\fR(4), \fBipnat.conf\fR(4),
-\fBippool\fR(4), \fBattributes\fR(5), \fBipfilter\fR(5)
+\fBippool\fR(4), \fBattributes\fR(5), \fBipfilter\fR(5), \fBzones(5)\fR
.sp
.LP
\fI\fR
diff --git a/usr/src/man/man1m/ipfs.1m b/usr/src/man/man1m/ipfs.1m
index ea2f16c065..92006438b3 100644
--- a/usr/src/man/man1m/ipfs.1m
+++ b/usr/src/man/man1m/ipfs.1m
@@ -2,43 +2,44 @@
.\" To view license terms, attribution, and copyright for IP Filter, the default path is /usr/lib/ipf/IPFILTER.LICENCE. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed
.\" location.
.\" Portions Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
-.TH IPFS 1M "Apr 3, 2008"
+.\" Portions Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
+.TH IPFS 1M "Nov 26, 2012"
.SH NAME
ipfs \- saves and restores information for NAT and state tables
.SH SYNOPSIS
.LP
.nf
-\fBipfs\fR [\fB-nv\fR] \fB-l\fR
+\fBipfs\fR [\fB-z\fR \fIzonename\fR] [\fB-nv\fR] \fB-l\fR
.fi
.LP
.nf
-\fBipfs\fR [\fB-nv\fR] \fB-u\fR
+\fBipfs\fR [\fB-z\fR \fIzonename\fR] [\fB-nv\fR] \fB-u\fR
.fi
.LP
.nf
-\fBipfs\fR [\fB-nv\fR] [\fB-d\fR \fIdirname\fR] \fB-R\fR
+\fBipfs\fR [\fB-z\fR \fIzonename\fR] [\fB-nv\fR] [\fB-d\fR \fIdirname\fR] \fB-R\fR
.fi
.LP
.nf
-\fBipfs\fR [\fB-nv\fR] [\fB-d\fR \fIdirname\fR] \fB-W\fR
+\fBipfs\fR [\fB-z\fR \fIzonename\fR] [\fB-nv\fR] [\fB-d\fR \fIdirname\fR] \fB-W\fR
.fi
.LP
.nf
-\fBipfs\fR [\fB-nNSv\fR] [\fB-f\fR \fIfilename\fR] \fB-r\fR
+\fBipfs\fR [\fB-z\fR \fIzonename\fR] [\fB-nNSv\fR] [\fB-f\fR \fIfilename\fR] \fB-r\fR
.fi
.LP
.nf
-\fBipfs\fR [\fB-nNSv\fR] [\fB-f\fR \fIfilename\fR] \fB-w\fR
+\fBipfs\fR [\fB-z\fR \fIzonename\fR] [\fB-nNSv\fR] [\fB-f\fR \fIfilename\fR] \fB-w\fR
.fi
.LP
.nf
-\fBipfs\fR [\fB-nNSv\fR] \fB-f\fR \fIfilename\fR \fB-i\fR \fI<if1>\fR,\fI<if2>\fR
+\fBipfs\fR [\fB-z\fR \fIzonename\fR] [\fB-nNSv\fR] \fB-f\fR \fIfilename\fR \fB-i\fR \fI<if1>\fR,\fI<if2>\fR
.fi
.SH DESCRIPTION
@@ -164,6 +165,17 @@ can be changed with the \fB-d\fR option. The state tables are locked at the
beginning of this operation and unlocked once complete.
.RE
+.sp
+.ne 2
+.na
+\fB\fB-z\fR\fR
+.ad
+.RS 6n
+Operate on the state information for the specified zone. If this option is not
+specified, the current zone is used. This command is only available in the
+Global Zone.
+.RE
+
.SH FILES
.RS +4
.TP
@@ -214,7 +226,8 @@ Interface Stability Committed
.SH SEE ALSO
.sp
.LP
-\fBipf\fR(1M), \fBipmon\fR(1M), \fBipnat\fR(1M), \fBattributes\fR(5)
+\fBipf\fR(1M), \fBipmon\fR(1M), \fBipnat\fR(1M), \fBattributes\fR(5),
+\fBzones(5)\fR
.SH DIAGNOSTICS
.sp
.LP
diff --git a/usr/src/man/man1m/ipfstat.1m b/usr/src/man/man1m/ipfstat.1m
index 212de841a9..210191b852 100644
--- a/usr/src/man/man1m/ipfstat.1m
+++ b/usr/src/man/man1m/ipfstat.1m
@@ -2,7 +2,8 @@
.\" To view license terms, attribution, and copyright for IP Filter, the default path is /usr/lib/ipf/IPFILTER.LICENCE. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed
.\" location.
.\" Portions Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
-.TH IPFSTAT 1M "Apr 3, 2008"
+.\" Portions Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
+.TH IPFSTAT 1M "Nov 26, 2012"
.SH NAME
ipfstat \- reports on packet filter statistics and filter list
.SH SYNOPSIS
@@ -14,7 +15,7 @@ ipfstat \- reports on packet filter statistics and filter list
.LP
.nf
\fBipfstat\fR [\fB-C\fR] [\fB-D\fR \fIaddrport\fR] [\fB-P\fR \fIprotocol\fR] [\fB-S\fR \fIaddrport\fR]
- [\fB-T\fR \fIrefreshtime\fR]
+ [\fB-T\fR \fIrefreshtime\fR] [\fB-z\fR \fIzonename\fR]
.fi
.SH DESCRIPTION
@@ -351,6 +352,16 @@ shows the process table. States can be sorted in a number of different ways.
Turn verbose mode on. Displays additional debugging information.
.RE
+.sp
+.ne 2
+.na
+\fB\fB-z\fR\fR
+.ad
+.RS 18n
+Report statistics for the specified zone. If this option is not specified,
+the current zone is used. This command is only available in the Global Zone.
+.RE
+
.SH FILES
.RS +4
.TP
@@ -396,7 +407,7 @@ Interface Stability Committed
.sp
.LP
\fBipf\fR(1M), \fBkstat\fR(1M), \fBkstat\fR(3KSTAT), \fBattributes\fR(5),
-\fBipfilter\fR(5)
+\fBipfilter\fR(5), \fBzones(5)\fR
.sp
.LP
\fI\fR
diff --git a/usr/src/man/man1m/ipmon.1m b/usr/src/man/man1m/ipmon.1m
index 2094979915..4c8f17b287 100644
--- a/usr/src/man/man1m/ipmon.1m
+++ b/usr/src/man/man1m/ipmon.1m
@@ -2,14 +2,15 @@
.\" To view license terms, attribution, and copyright for IP Filter, the default path is /usr/lib/ipf/IPFILTER.LICENCE. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed
.\" location.
.\" Portions Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
-.TH IPMON 1M "Apr 3, 2008"
+.\" Portions Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
+.TH IPMON 1M "Nov 26, 2012"
.SH NAME
ipmon \- monitors /dev/ipl for logged packets
.SH SYNOPSIS
.LP
.nf
\fBipmon\fR [\fB-abDFhnpstvxX\fR] [\fB-N\fR \fIdevice\fR] [ [o] [NSI]] [\fB-O\fR [NSI]]
- [\fB-P\fR \fIpidfile\fR] [\fB-S\fR \fIdevice\fR] [\fB-f\fR \fIdevice\fR] [\fIfilename\fR]
+ [\fB-P\fR \fIpidfile\fR] [\fB-S\fR \fIdevice\fR] [\fB-f\fR \fIdevice\fR] [\fB-z\fR \fIzonename\fR] [\fIfilename\fR]
.fi
.SH DESCRIPTION
@@ -343,6 +344,17 @@ Show the packet data in hex.
Show the log header record data in hex.
.RE
+.sp
+.ne 2
+.na
+\fB\fB-z\fR\fR
+.ad
+.sp .6
+.RS 4n
+Monitor the specified zone. If this option is not specified, the current zone
+is used. This command is only available in the Global Zone.
+.RE
+
.SH FILES
.RS +4
.TP
@@ -382,7 +394,7 @@ Interface Stability Committed
.sp
.LP
\fBipf\fR(1M), \fBipfstat\fR(1M), \fBipnat\fR(1M), \fBattributes\fR(5),
-\fBipfilter\fR(5)
+\fBipfilter\fR(5), \fBzones(5)\fR
.sp
.LP
\fI\fR
diff --git a/usr/src/man/man1m/ipnat.1m b/usr/src/man/man1m/ipnat.1m
index 6e36a50e26..e9bd8c9fd5 100644
--- a/usr/src/man/man1m/ipnat.1m
+++ b/usr/src/man/man1m/ipnat.1m
@@ -2,13 +2,14 @@
.\" To view license terms, attribution, and copyright for IP Filter, the default path is /usr/lib/ipf/IPFILTER.LICENCE. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed
.\" location.
.\" Portions Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
-.TH IPNAT 1M "Apr 3, 2008"
+.\" Portions Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
+.TH IPNAT 1M "Nov 26, 2012"
.SH NAME
ipnat \- user interface to the NAT subsystem
.SH SYNOPSIS
.LP
.nf
-\fBipnat\fR [\fB-CdFhlnRrsv\fR] \fB-f\fR \fIfilename\fR
+\fBipnat\fR [\fB-CdFhlnRrsv\fR] [\fB-z\fR \fIzonename\fR] \fB-f\fR \fIfilename\fR
.fi
.SH DESCRIPTION
@@ -140,6 +141,17 @@ Turn verbose mode on. Displays information relating to rule processing and
active rules/table entries.
.RE
+.sp
+.ne 2
+.na
+\fB\fB-z\fR\fR
+.ad
+.RS 15n
+Operate on the IP NAT for the specified zone. If this option is not
+specified, the current zone is used. This command is only available in the
+Global Zone.
+.RE
+
.SH FILES
.sp
.ne 2
@@ -200,4 +212,5 @@ Interface Stability Committed
.SH SEE ALSO
.sp
.LP
-\fBipf\fR(1M), \fBipfstat\fR(1M), \fBipnat\fR(4), \fBattributes\fR(5)
+\fBipf\fR(1M), \fBipfstat\fR(1M), \fBipnat\fR(4), \fBattributes\fR(5),
+\fBzones(5)\fR
diff --git a/usr/src/man/man1m/ippool.1m b/usr/src/man/man1m/ippool.1m
index 38e7cc19e6..33d85ace4a 100644
--- a/usr/src/man/man1m/ippool.1m
+++ b/usr/src/man/man1m/ippool.1m
@@ -2,56 +2,57 @@
.\" To view license terms, attribution, and copyright for IP Filter, the default path is /usr/lib/ipf/IPFILTER.LICENCE. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed
.\" location.
.\" Portions Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
-.TH IPPOOL 1M "Apr 3, 2008"
+.\" Portions Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
+.TH IPPOOL 1M "Nov 26, 2012"
.SH NAME
ippool \- user interface to the IP Filter pools
.SH SYNOPSIS
.LP
.nf
-\fBippool\fR \fB-a\fR [\fB-dnv\fR] [\fB-m\fR \fIpoolname\fR] [\fB-o\fR \fIrole\fR] \fB-i\fR \fIipaddr\fR
+\fBippool\fR \fB-a\fR [\fB-dnv\fR] [\fB-z\fR \fIzonename\fR] [\fB-m\fR \fIpoolname\fR] [\fB-o\fR \fIrole\fR] \fB-i\fR \fIipaddr\fR
[/\fInetmask\fR]
.fi
.LP
.nf
-\fBippool\fR \fB-A\fR [\fB-dnv\fR] [\fB-m\fR \fIpoolname\fR] [\fB-o\fR \fIrole\fR] [\fB-S\fR \fIseed\fR]
+\fBippool\fR \fB-A\fR [\fB-dnv\fR] [\fB-z\fR \fIzonename\fR] [\fB-m\fR \fIpoolname\fR] [\fB-o\fR \fIrole\fR] [\fB-S\fR \fIseed\fR]
[\fB-t\fR \fItype\fR]
.fi
.LP
.nf
-\fBippool\fR \fB-f\fR \fIfile\fR [\fB-dnuv\fR]
+\fBippool\fR \fB-f\fR \fIfile\fR [\fB-z\fR \fIzonename\fR] [\fB-dnuv\fR]
.fi
.LP
.nf
-\fBippool\fR \fB-F\fR [\fB-dv\fR] [\fB-o\fR \fIrole\fR] [\fB-t\fR \fItype\fR]
+\fBippool\fR \fB-F\fR [\fB-dv\fR] [\fB-z\fR \fIzonename\fR] [\fB-o\fR \fIrole\fR] [\fB-t\fR \fItype\fR]
.fi
.LP
.nf
-\fBippool\fR \fB-h\fR [\fB-dv\fR] [\fB-m\fR \fIpoolname\fR] [\fB-t\fR \fItype\fR]
+\fBippool\fR \fB-h\fR [\fB-dv\fR] [\fB-z\fR \fIzonename\fR] [\fB-m\fR \fIpoolname\fR] [\fB-t\fR \fItype\fR]
.fi
.LP
.nf
-\fBippool\fR \fB-l\fR [\fB-dv\fR] [\fB-m\fR \fIpoolname\fR] [\fB-t\fR \fItype\fR]
+\fBippool\fR \fB-l\fR [\fB-dv\fR] [\fB-z\fR \fIzonename\fR] [\fB-m\fR \fIpoolname\fR] [\fB-t\fR \fItype\fR]
.fi
.LP
.nf
-\fBippool\fR \fB-r\fR [\fB-dnv\fR] [\fB-m\fR \fIpoolname\fR] [\fB-o\fR \fIrole\fR] \fB-i\fR \fIipaddr\fR
+\fBippool\fR \fB-r\fR [\fB-dnv\fR] [\fB-z\fR \fIzonename\fR] [\fB-m\fR \fIpoolname\fR] [\fB-o\fR \fIrole\fR] \fB-i\fR \fIipaddr\fR
[/\fInetmask\fR]
.fi
.LP
.nf
-\fBippool\fR \fB-R\fR [\fB-dnv\fR] [\fB-m\fR \fIpoolname\fR] [\fB-o\fR \fIrole\fR] [\fB-t\fR \fItype\fR]
+\fBippool\fR \fB-R\fR [\fB-dnv\fR] [\fB-z\fR \fIzonename\fR] [\fB-m\fR \fIpoolname\fR] [\fB-o\fR \fIrole\fR] [\fB-t\fR \fItype\fR]
.fi
.LP
.nf
-\fBippool\fR \fB-s\fR [\fB-dtv\fR] [\fB-M\fR \fIcore\fR] [\fB-N\fR \fInamelist\fR]
+\fBippool\fR \fB-s\fR [\fB-dtv\fR] [\fB-z\fR \fIzonename\fR] [\fB-M\fR \fIcore\fR] [\fB-N\fR \fInamelist\fR]
.fi
.SH DESCRIPTION
@@ -111,6 +112,16 @@ would alter the currently running kernel.
Turn verbose mode on.
.RE
+.sp
+.ne 2
+.na
+\fB\fB-z\fR\fR
+.ad
+.RS 6n
+Manage IP pools for the specified zone. If this option is not specified, the
+current zone is used. This command is only available in the Global Zone.
+.RE
+
.SS "Instance-Specific Options"
.sp
.LP
@@ -328,4 +339,5 @@ Interface Stability Committed
.SH SEE ALSO
.sp
.LP
-\fBipf\fR(1M), \fBipfstat\fR(1M), \fBippool\fR(4), \fBattributes\fR(5)
+\fBipf\fR(1M), \fBipfstat\fR(1M), \fBippool\fR(4), \fBattributes\fR(5),
+\fBzones(5)\fR
diff --git a/usr/src/man/man1m/lofiadm.1m b/usr/src/man/man1m/lofiadm.1m
index 493223c3b2..71c74a2658 100644
--- a/usr/src/man/man1m/lofiadm.1m
+++ b/usr/src/man/man1m/lofiadm.1m
@@ -76,9 +76,11 @@ association, or print information about the current associations.
Encryption and compression options are mutually exclusive on the command line.
Further, an encrypted file cannot be compressed later, nor can a compressed
file be encrypted later.
+
+In the global zone, \fBlofiadm\fR can be used on both the global
+zone devices and all devices owned by other non-global zones on the system.
.sp
.LP
-The \fBlofi\fR driver is not available and will not work inside a zone.
.SH OPTIONS
.sp
.LP
@@ -239,6 +241,10 @@ restrictions apply (such as restricted root access over \fBNFS\fR). The file is
held open until the association is removed. It is not actually accessed until
the block device is used, so it will never be written to if the block device is
only opened read-only.
+
+Note that the filename may appear as "?" if it is not possible to resolve the
+path in the current context (for example, if it's an NFS path in a non-global
+zone).
.RE
.sp
diff --git a/usr/src/man/man1m/mount_tmpfs.1m b/usr/src/man/man1m/mount_tmpfs.1m
index a4f38d3b1f..3520a3f31b 100644
--- a/usr/src/man/man1m/mount_tmpfs.1m
+++ b/usr/src/man/man1m/mount_tmpfs.1m
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright (c) 2011, Joyent, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH MOUNT_TMPFS 1M "Nov 24, 2003"
+.TH MOUNT_TMPFS 1M "Dec 2, 2011"
.SH NAME
mount_tmpfs \- mount tmpfs file systems
.SH SYNOPSIS
@@ -45,6 +46,17 @@ available:
.sp
.ne 2
.na
+\fB\fBremount\fR\fR
+.ad
+.sp .6
+.RS 19n
+Remounts a file system with a new size. A size not explicitly
+set with \fBremount\fR reverts to no limit.
+.RE
+
+.sp
+.ne 2
+.na
\fBsize=\fIsz\fR\fR
.ad
.RS 19n
diff --git a/usr/src/man/man1m/prstat.1m b/usr/src/man/man1m/prstat.1m
index b70124b9b8..5b884da8d5 100644
--- a/usr/src/man/man1m/prstat.1m
+++ b/usr/src/man/man1m/prstat.1m
@@ -1,15 +1,16 @@
'\" te
.\" Copyright (c) 2006, 2009 Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH PRSTAT 1M "Jun 25, 2009"
+.TH PRSTAT 1M "Sep 5, 2012"
.SH NAME
prstat \- report active process statistics
.SH SYNOPSIS
.LP
.nf
-\fBprstat\fR [\fB-acHJLmRrtTv\fR] [\fB-d\fR u | d] [\fB-C\fR \fIpsrsetlist\fR] [\fB-h\fR \fIlgrplist\fR]
+\fBprstat\fR [\fB-acHJLmRrtTvV\fR] [\fB-d\fR u | d] [\fB-C\fR \fIpsrsetlist\fR] [\fB-h\fR \fIlgrplist\fR]
[\fB-j\fR \fIprojlist\fR] [\fB-k\fR \fItasklist\fR] [\fB-n\fR \fIntop\fR[,\fInbottom\fR]]
[\fB-p\fR \fIpidlist\fR] [\fB-P\fR \fIcpulist\fR] [\fB-s\fR \fIkey\fR | \fB-S\fR \fIkey\fR ]
[\fB-u\fR \fIeuidlist\fR] [\fB-U\fR \fIuidlist\fR] [\fB-z\fR \fIzoneidlist\fR] [\fB-Z\fR]
@@ -173,10 +174,10 @@ waiting for user locks and waiting for \fBCPU\fR (latency time).
.RS 4n
Restrict number of output lines. The \fIntop\fR argument determines how many
lines of process or \fBlwp\fR statistics are reported, and the \fInbottom\fR
-argument determines how many lines of user, task, or projects statistics are
-reported if the \fB-a\fR, \fB-t\fR, \fB-T\fR, or \fB-J\fR options are
-specified. By default, \fBprstat\fR displays as many lines of output that fit
-in a window or terminal. When you specify the \fB-c\fR option or direct the
+argument determines how many lines of user, task, project or zone statistics
+are reported if the \fB-a\fR, \fB-t\fR, \fB-T\fR, \fB-J\fR or \fB-Z\fR options
+are specified. By default, \fBprstat\fR displays as many lines of output that
+fit in a window or terminal. When you specify the \fB-c\fR option or direct the
output to a file, the default values for \fBntop\fR and \fBnbottom\fR are
\fB15\fR and \fB5\fR.
.RE
@@ -364,6 +365,18 @@ with the \fB-\fR sign.
.sp
.ne 2
.na
+\fB\fB-V\fR\fR
+.ad
+.sp .6
+.RS 4n
+Report accurate aggregated RSS values when used with the \fB-J\fR, \fB-t\fR,
+\fB-T\fR or \fB-Z\fR options. This uses an accurate, but more expensive,
+calculation to determine the aggregated RSS value for the specified grouping.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB-z\fR \fIzoneidlist\fR\fR
.ad
.sp .6
@@ -429,9 +442,11 @@ devices, in kilobytes (\fBK\fR), megabytes (\fBM\fR), or gigabytes (\fBG\fR).
.RS 4n
The resident set size of the process (\fBRSS\fR), in kilobytes (\fBK\fR),
megabytes (\fBM\fR), or gigabytes (\fBG\fR). The RSS value is an estimate
-provided by \fBproc\fR(4) that might underestimate the actual resident set
-size. Users who want to get more accurate usage information for capacity
-planning should use the \fB-x\fR option to \fBpmap\fR(1) instead.
+provided by \fBproc\fR(4) that might underestimate the actual
+per-process resident set size and usually overestimates the aggregated
+resident set size. Users who want to get more accurate usage information for
+capacity planning should use either the \fB-V\fR option or, for per-process
+results, the \fB-x\fR option to \fBpmap\fR(1) instead.
.RE
.sp
diff --git a/usr/src/man/man1m/prtconf.1m b/usr/src/man/man1m/prtconf.1m
index d8ad9e72ba..ff62a01992 100644
--- a/usr/src/man/man1m/prtconf.1m
+++ b/usr/src/man/man1m/prtconf.1m
@@ -10,7 +10,7 @@ prtconf \- print system configuration
.SH SYNOPSIS
.LP
.nf
-\fB/usr/sbin/prtconf\fR [\fB-V\fR] | [\fB-F\fR] | [\fB-x\fR] | [\fB-bpv\fR] | [\fB-acdDPv\fR]
+\fB/usr/sbin/prtconf\fR [\fB-V\fR] | [\fB-F\fR] | [\fB-m\fr] | [\fB-x\fR] | [\fB-bpv\fR] | [\fB-acdDPv\fR]
[\fIdev_path\fR]
.fi
@@ -100,6 +100,16 @@ console frame buffer on a SUNW,Ultra-30 is \fBffb\fR, the command returns:
.sp
.ne 2
.na
+\fB\fB-m\fR\fR
+.ad
+.RS 6n
+Displays the amount system memory in megabytes.
+This flag must be used by itself.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB-p\fR\fR
.ad
.RS 6n
diff --git a/usr/src/man/man1m/psrset.1m b/usr/src/man/man1m/psrset.1m
index 0212e6fa07..519d2c1e5c 100644
--- a/usr/src/man/man1m/psrset.1m
+++ b/usr/src/man/man1m/psrset.1m
@@ -1,9 +1,10 @@
'\" te
+.\" Copyright (c) 2013, Joyent, Inc. All Rights Reserved
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH PSRSET 1M "Feb 25, 2008"
+.TH PSRSET 1M "Mar 11, 2013"
.SH NAME
psrset \- creation and management of processor sets
.SH SYNOPSIS
@@ -19,6 +20,11 @@ psrset \- creation and management of processor sets
.LP
.nf
+\fBpsrset\fR \fB-b\fR \fB-z\fR \fIzone name\fR \fIprocessor_set_id\fR
+.fi
+
+.LP
+.nf
\fBpsrset\fR \fB-c\fR [\fB-F\fR] [\fIprocessor_id\fR]...
.fi
@@ -110,11 +116,12 @@ privilege.
.sp
.ne 2
.na
-\fB\fB-b\fR\fR
+\fB\fB-b\fR [\fB-z\fr \fIzonename\fR]\fR
.ad
.RS 6n
Bind all or a subset of the \fBLWP\fRs of the specified processes to the
-specified processor set.
+specified processor set. If \fB-z\fR is specified, all processes and threads
+inside the specified zone are bound to the processor set.
.sp
LWPs bound to a processor set are restricted to run only on the processors in
that set. Processes can only be bound to non-empty processor sets, that is,
diff --git a/usr/src/man/man1m/reboot.1m b/usr/src/man/man1m/reboot.1m
index 1ff92b6f33..8eadedf18d 100644
--- a/usr/src/man/man1m/reboot.1m
+++ b/usr/src/man/man1m/reboot.1m
@@ -144,8 +144,7 @@ This option is currently available only on x86 systems. The \fB-p\fR and
.ad
.sp .6
.RS 4n
-Quick. Reboot quickly and ungracefully, without shutting down running processes
-first.
+Quick. Reboot quickly without halting running zones first.
.RE
.SH OPERANDS
diff --git a/usr/src/man/man1m/svc.startd.1m b/usr/src/man/man1m/svc.startd.1m
index 726e556de1..103c6b5fec 100644
--- a/usr/src/man/man1m/svc.startd.1m
+++ b/usr/src/man/man1m/svc.startd.1m
@@ -1,10 +1,10 @@
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright 2011, Joyent Inc
+.\" Copyright 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH SVC.STARTD 1M "Mar 18, 2011"
+.TH SVC.STARTD 1M "Aug 23, 2012"
.SH NAME
svc.startd \- Service Management Facility master restarter
.SH SYNOPSIS
@@ -372,10 +372,13 @@ properties listed below in the \fBstartd\fR property group.
.RS 4n
The \fBcritical_failure_count\fR and \fBcritical_failure_period\fR properties
together specify the maximum number of service failures allowed in a given
-time interval before \fBsvc.startd\fR transitions the service to maintenance.
+number of seconds before \fBsvc.startd\fR transitions the service to
+maintenance.
If the number of failures exceeds \fBcritical_failure_count\fR in any period of
\fBcritical_failure_period\fR seconds, \fBsvc.startd\fR will transition the
-service to maintenance.
+service to maintenance. The \fBcritical_failure_count\fR value is limited
+to the range 1-10 and defaults to 10. The \fBcritical_failure_period\fR
+defaults to 600 seconds.
.RE
.sp
@@ -488,7 +491,9 @@ conditions occurs.
"\fBWait\fR" model services are restarted whenever the child process associated
with the service exits. A child process that exits is not considered an error
for "\fBwait\fR" model services, and repeated failures do not lead to a
-transition to maintenance state.
+transition to maintenance state. However, a wait service which is repeatedly
+exiting with an error that exceeds the default rate (5 failures/second) will be
+throttled back so that the service only restarts once per second.
.SS "LEGACY SERVICES"
.sp
.LP
diff --git a/usr/src/man/man1m/svccfg.1m b/usr/src/man/man1m/svccfg.1m
index 972967267b..c2e2cf28cd 100644
--- a/usr/src/man/man1m/svccfg.1m
+++ b/usr/src/man/man1m/svccfg.1m
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2012, Joyent, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
@@ -261,9 +262,11 @@ Without the \fB-a\fR option, property groups containing protected information
\fB-a\fR option is specified, all values will be archived. An error results if
there are insufficient privileges to read these values.
.sp
-Note that \fBexport\fR requires a service FMRI. If you specify an instance
-(including an abbreviation, such as \fBapache2\fR or \fBsendmail\fR, that
-specifies an instance), the command fails.
+Note that \fBexport\fR requires a service FMRI. To ease the use of arguments
+cut and pasted from other command output, if you specify a complete
+instance FMRI, the entire corresponding service including all instances
+is exported and a warning is issued. If you specify an abbreviation, such as
+\fBapache2\fR or \fBsendmail\fR, that specifies an instance, the command fails.
.RE
.sp
diff --git a/usr/src/man/man1m/zfs.1m b/usr/src/man/man1m/zfs.1m
index c4d579d7cb..e3c40485d9 100644
--- a/usr/src/man/man1m/zfs.1m
+++ b/usr/src/man/man1m/zfs.1m
@@ -95,7 +95,7 @@ zfs \- configures ZFS file systems
.LP
.nf
-\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-H\fR][\fB-o\fR \fIproperty\fR[,\fIproperty\fR]...] [\fB-t\fR \fItype\fR[,\fItype\fR]...]
+\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hp\fR][\fB-o\fR \fIproperty\fR[,\fIproperty\fR]...] [\fB-t\fR \fItype\fR[,\fItype\fR]...]
[\fB-s\fR \fIproperty\fR]... [\fB-S\fR \fIproperty\fR]... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR]...
.fi
@@ -106,7 +106,7 @@ zfs \- configures ZFS file systems
.LP
.nf
-\fBzfs\fR \fBget\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hp\fR][\fB-o\fR \fIfield\fR[,\fIfield\fR]...] [\fB-t\fR \fItype\fR[,\fItype\fR]...]
+\fBzfs\fR \fBget\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hpc\fR][\fB-o\fR \fIfield\fR[,\fIfield\fR]...] [\fB-t\fR \fItype\fR[,\fItype\fR]...]
[\fB-s\fR \fIsource\fR[,\fIsource\fR]...] \fBall\fR | \fIproperty\fR[,\fIproperty\fR]...
\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR...
.fi
@@ -933,16 +933,19 @@ This property is not inherited.
.sp
.ne 2
.na
-\fB\fBchecksum\fR=\fBon\fR | \fBoff\fR | \fBfletcher2\fR | \fBfletcher4\fR |
-\fBsha256\fR\fR
+\fB\fBchecksum\fR=\fBon\fR | \fBoff\fR | \fBfletcher2,\fR| \fBfletcher4\fR |
+\fBsha256\fR | \fBnoparity\fR \fR
.ad
.sp .6
.RS 4n
Controls the checksum used to verify data integrity. The default value is
\fBon\fR, which automatically selects an appropriate algorithm (currently,
-\fBfletcher4\fR, but this may change in future releases). The value \fBoff\fR
-disables integrity checking on user data. Disabling checksums is \fBNOT\fR a
-recommended practice.
+\fBfletcher2\fR, but this may change in future releases). The value \fBoff\fR
+disables integrity checking on user data. The value \fBnoparity\fR not only
+disables integrity but also disables maintaining parity for user data. This
+setting is used internally by a dump device residing on a RAID-Z pool and should
+not be used by any other dataset. Disabling checksums is \fBNOT\fR a recommended
+practice.
.sp
Changing this property affects only newly-written data.
.RE
@@ -2114,7 +2117,7 @@ only dataset that can be renamed recursively.
.sp
.ne 2
.na
-\fB\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR] [\fB-H\fR] [\fB-o\fR
+\fB\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR] [\fB-Hp\fR] [\fB-o\fR
\fIproperty\fR[,\fIproperty\fR]...] [ \fB-t\fR \fItype\fR[,\fItype\fR]...] [ \fB-s\fR
\fIproperty\fR ]... [ \fB-S\fR \fIproperty\fR ]...
[\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR]...\fR
@@ -2262,6 +2265,17 @@ A comma-separated list of types to display, where \fItype\fR is one of
specifying \fB-t snapshot\fR displays only snapshots.
.RE
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-p\fR\fR
+.ad
+.sp .6
+.RS 4n
+Display numbers in parseable (exact) values.
+.RE
+
.RE
.sp
@@ -2285,7 +2299,7 @@ Properties" section.
.sp
.ne 2
.na
-\fB\fBzfs get\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR] [\fB-Hp\fR] [\fB-o\fR
+\fB\fBzfs get\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR] [\fB-Hpc\fR] [\fB-o\fR
\fIfield\fR[,\fIfield\fR]... [\fB-t\fR \fItype\fR[,\fItype\fR]...] [\fB-s\fR \fIsource\fR[,\fIsource\fR]... \fBall\fR |
\fIproperty\fR[,\fIproperty\fR]... \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR...\fR
.ad
@@ -2380,6 +2394,19 @@ is all sources.
Display numbers in parseable (exact) values.
.RE
+.sp
+.ne 2
+.na
+\fB\fB-c\fR\fR
+.ad
+.sp .6
+.RS 4n
+Only display properties which can be retrieved without issuing any I/O requests,
+i.e. properties which are already cached. Most properties are cached except for
+create-time properties (normalization, utf8only, casesensitivity) as well as a
+volume's size and block size.
+.RE
+
.RE
.sp
@@ -2790,7 +2817,7 @@ Unshare the specified filesystem. The command can also be given a path to a
.sp
.ne 2
.na
-\fBzfs send\fR [\fB-DnPpRv\fR] [\fB-\fR[\fBiI\fR] \fIsnapshot\fR] \fIsnapshot\fR
+\fBzfs send\fR [\fB-DnPpRrv\fR] [\fB-\fR[\fBiI\fR] \fIsnapshot\fR] \fIsnapshot\fR
.ad
.sp .6
.RS 4n
@@ -2866,6 +2893,18 @@ will be much better if the filesystem uses a dedup-capable checksum (eg.
.sp
.ne 2
.na
+\fB\fB-r\fR\fR
+.ad
+.sp .6
+.RS 4n
+Recursively send all descendant snapshots. This is similar to the \fB-R\fR
+flag, but information about deleted and renamed datasets is not included, and
+property information is only included if the \fB-p\fR flag is specified.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB-p\fR\fR
.ad
.sp .6
diff --git a/usr/src/man/man1m/zoneadm.1m b/usr/src/man/man1m/zoneadm.1m
index 13612b3ed1..00a4013a90 100644
--- a/usr/src/man/man1m/zoneadm.1m
+++ b/usr/src/man/man1m/zoneadm.1m
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2011 Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
@@ -131,12 +132,14 @@ Use the following command to attach a zone:
.sp
.ne 2
.na
-\fB\fBboot\fR [\fB--\fR \fIboot_options\fR]\fR
+\fB\fBboot\fR [\fB-X\fR] [\fB--\fR \fIboot_options\fR]\fR
.ad
.sp .6
.RS 4n
Boot (or activate) the specified zones.
.sp
+The \fI-X\fR option enables debug for the zone's brand while booting.
+.sp
The following \fIboot_options\fR are supported:
.sp
.ne 2
@@ -251,13 +254,15 @@ The source zone must be halted before this subcommand can be used.
.sp
.ne 2
.na
-\fB\fBhalt\fR\fR
+\fB\fBhalt [\fB-X\fR]\fR\fR
.ad
.sp .6
.RS 4n
Halt the specified zones. \fBhalt\fR bypasses running the shutdown scripts
inside the zone. It also removes run time resources of the zone.
.sp
+The \fI-X\fR option enables debug for the zone's brand while halting.
+.sp
Use:
.sp
.in +2
@@ -417,23 +422,27 @@ and normal restrictions for \fIzonepath\fR apply.
.sp
.ne 2
.na
-\fB\fBready\fR\fR
+\fB\fBready [\fB-X\fR]\fR\fR
.ad
.sp .6
.RS 4n
Prepares a zone for running applications but does not start any user processes
in the zone.
+.sp
+The \fI-X\fR option enables debug for the zone's brand while readying.
.RE
.sp
.ne 2
.na
-\fB\fBreboot\fR\fR
+\fB\fBreboot [\fB-X\fR]\fR\fR
.ad
.sp .6
.RS 4n
Restart the zones. This is equivalent to a \fBhalt\fR \fBboot\fR sequence. This
subcommand fails if the specified zones are not active.
+.sp
+The \fI-X\fR option enables debug for the zone's brand while rebooting.
.RE
.sp
diff --git a/usr/src/man/man1m/zonecfg.1m b/usr/src/man/man1m/zonecfg.1m
index 97cc6bbf57..88b6cdd770 100644
--- a/usr/src/man/man1m/zonecfg.1m
+++ b/usr/src/man/man1m/zonecfg.1m
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2004, 2009 Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2011 Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
@@ -9,17 +10,17 @@ zonecfg \- set up zone configuration
.SH SYNOPSIS
.LP
.nf
-\fBzonecfg\fR \fB-z\fR \fIzonename\fR
+\fBzonecfg\fR {\fB-z\fR \fIzonename\fR | \fB-u\fR \fIuuid\fR}
.fi
.LP
.nf
-\fBzonecfg\fR \fB-z\fR \fIzonename\fR \fIsubcommand\fR
+\fBzonecfg\fR {\fB-z\fR \fIzonename\fR | \fB-u\fR \fIuuid\fR} \fIsubcommand\fR
.fi
.LP
.nf
-\fBzonecfg\fR \fB-z\fR \fIzonename\fR \fB-f\fR \fIcommand_file\fR
+\fBzonecfg\fR {\fB-z\fR \fIzonename\fR | \fB-u\fR \fIuuid\fR} \fB-f\fR \fIcommand_file\fR
.fi
.LP
@@ -42,7 +43,8 @@ The following synopsis of the \fBzonecfg\fR command is for interactive usage:
.sp
.in +2
.nf
-zonecfg \fB-z\fR \fIzonename subcommand\fR
+{\fB-z\fR \fIzonename\fR | \fB-u\fR \fIuuid\fR}
+zonecfg {\fB-z\fR \fIzonename | \fB-u\fR \fIuuid} subcommand\fR
.fi
.in -2
.sp
@@ -164,6 +166,7 @@ Network interface.
Resource control.
.RE
+.RE
.SS "Properties"
.sp
.LP
@@ -326,6 +329,27 @@ The following properties are supported:
.sp
.ne 2
.na
+\fB(global)\fR
+.ad
+.sp .6
+.RS 4n
+\fBfs-allowed\fR
+.RE
+
+.sp
+.ne 2
+.na
+\fB(global)\fR
+.ad
+.sp .6
+.RS 4n
+\fBzfs-io-priority\fR
+.RE
+
+.sp
+.ne 2
+.mk
+.na
\fB\fBfs\fR\fR
.ad
.sp .6
@@ -340,7 +364,7 @@ The following properties are supported:
.ad
.sp .6
.RS 4n
-\fBaddress\fR, \fBphysical\fR, \fBdefrouter\fR
+\fBaddress\fR, \fBallowed-address\fR, \fBdefrouter\fR, \fBglobal-nic\fR, \fBmac-addr\fR, \fBphysical\fR, \fBproperty\fR, \fBvlan-id\fR
.RE
.sp
@@ -603,7 +627,17 @@ Values needed to determine how, where, and so forth to mount file systems. See
.sp
.ne 2
.na
-\fB\fBnet\fR: address, physical, defrouter\fR
+\fB\fBinherit-pkg-dir\fR: dir\fR
+.ad
+.sp .6
+.RS 4n
+The directory path.
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fBnet\fR: address, allowed-address, defrouter, global-nic, mac-addr, physical, property, vlan-id\fR
.ad
.sp .6
.RS 4n
@@ -642,6 +676,10 @@ zone. However, if the interface is not used by the global zone, it should be
configured \fBdown\fR in the global zone, and the default router for the
interface should be specified here.
.sp
+The global-nic is used for exclusive stack zones which will use a VNIC on-demand. When the zone boots, a VNIC named using the physical property will be created on the global NIC. If provided, the mac-addr and vlan-id will be set on this VNIC.
+.sp
+The \fBproperty\fR setting is a resource which can be used to set arbitrary name/value pairs on the network. These name/value pairs are made available to the zone's brand, which can use them as needed to set up the network interface.
+.sp
For an exclusive-IP zone, the physical property must be set and the address and
default router properties cannot be set.
.RE
@@ -850,6 +888,37 @@ control and is related to the \fBzone.cpu-cap\fR resource control. See
.RE
.sp
+.ne 2
+.mk
+.na
+\fBglobal: \fBfs-allowed\fR\fR
+.ad
+.sp .6
+.RS 4n
+A comma-separated list of additional filesystems that may be mounted within
+the zone; for example "ufs,pcfs". By default, only hsfs(7fs) and network
+filesystems can be mounted.
+
+This property does not apply to filesystems mounted into the zone via "add fs"
+or "add dataset".
+
+WARNING: allowing filesystem mounts other than the default may allow the zone
+administrator to compromise the system with a malicious filesystem image, and
+is not supported.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fBglobal: \fBzfs-io-priority\fR\fR
+.ad
+.sp .6
+.RS 4n
+Specifies a priority for this zone's ZFS I/O. The priority is used by the ZFS I/O scheduler as in input to determine how to schedule I/O across zones. By default all zones have a priority of 1. The value can be increased for zones whose I/O is more critical. This property is the preferred way to set the \fBzone.zfs-io-priority\fR rctl.
+.RE
+
+.sp
.LP
The following table summarizes resources, property-names, and types:
.sp
@@ -872,13 +941,22 @@ resource property-name type
(global) max-shm-ids simple
(global) max-shm-memory simple
(global) scheduling-class simple
+(global) zfs-io-priority simple
fs dir simple
special simple
raw simple
type simple
options list of simple
net address simple
+ allowed-address simple
+ defrouter simple
+ global-nic simple
+ mac-addr simple
physical simple
+ property list of complex
+ name simple
+ value simple
+ vlan-id simple
device match simple
rctl name simple
value list of complex
@@ -1091,6 +1169,17 @@ name \fBglobal\fR and all names beginning with \fBSUNW\fR are reserved and
cannot be used.
.RE
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-u\fR \fIuuid\fR\fR
+.ad
+.sp .6
+.RS 4n
+Specify the uuid of a zone instead of the Zone name.
+.RE
+
.SH SUBCOMMANDS
.sp
.LP
@@ -1181,8 +1270,7 @@ correct to be committed, this operation automatically does a verify.
.sp
.ne 2
.na
-\fB\fBcreate [\fR\fB-F\fR\fB] [\fR \fB-a\fR \fIpath\fR |\fB-b\fR \fB|\fR
-\fB-t\fR \fItemplate\fR\fB]\fR\fR
+\fB\fBcreate [\fR\fB-F\fR\fB] [\fR \fB-a\fR \fIpath\fR |\fB-b\fR \fB|\fR \fB-t\fR \fItemplate\fR\fB] [\fR\fB-X\fR\fB]\fR\fR
.ad
.sp .6
.RS 4n
@@ -1204,6 +1292,8 @@ configured, it should be installed using the "\fBzoneadm attach\fR" command
.sp
Use the \fB-b\fR option to create a blank configuration. Without arguments,
\fBcreate\fR applies the Sun default settings.
+.sp
+Use the \fB-X\fR option to facilitate creating a zone whose XML definition already exists on the host. The zone will be atomically added to the zone index file.
.RE
.sp
diff --git a/usr/src/man/man1m/zpool.1m b/usr/src/man/man1m/zpool.1m
index 0da5282c9d..45792c2b92 100644
--- a/usr/src/man/man1m/zpool.1m
+++ b/usr/src/man/man1m/zpool.1m
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2011, Joyent, Inc. All Rights Reserved.
.\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\" The contents of this file are subject to the terms of the Common Development
@@ -61,7 +62,7 @@ zpool \- configures ZFS storage pools
.LP
.nf
-\fBzpool get\fR "\fIall\fR" | \fIproperty\fR[,...] \fIpool\fR ...
+\fBzpool get\fR [\fB-p\fR] "\fIall\fR" | \fIproperty\fR[,...] \fIpool\fR ...
.fi
.LP
@@ -93,7 +94,7 @@ zpool \- configures ZFS storage pools
.LP
.nf
-\fBzpool list\fR [\fB-Hv\fR] [\fB-o\fR \fIproperty\fR[,...]] [\fIpool\fR] ...
+\fBzpool list\fR [\fB-Hvp\fR] [\fB-o\fR \fIproperty\fR[,...]] [\fIpool\fR] ...
.fi
.LP
@@ -1124,7 +1125,7 @@ is currently being used. This may lead to potential data corruption.
.sp
.ne 2
.na
-\fB\fBzpool get\fR "\fIall\fR" | \fIproperty\fR[,...] \fIpool\fR ...\fR
+\fB\fBzpool get\fR [\fB-p\fR] "\fIall\fR" | \fIproperty\fR[,...] \fIpool\fR ...\fR
.ad
.sp .6
.RS 4n
@@ -1149,6 +1150,18 @@ properties.
.sp
.ne 2
.na
+\fB\fB-p\fR\fR
+.ad
+.RS 6n
+.rt
+Display numbers in parseable (exact) values.
+.RE
+
+
+.sp
+.ne 2
+.mk
+.na
\fB\fBzpool history\fR [\fB-il\fR] [\fIpool\fR] ...\fR
.ad
.sp .6
@@ -1463,7 +1476,7 @@ the pool, in addition to the pool-wide statistics.
.sp
.ne 2
.na
-\fB\fBzpool list\fR [\fB-Hv\fR] [\fB-o\fR \fIprops\fR[,...]] [\fIpool\fR] ...\fR
+\fB\fBzpool list\fR [\fB-Hvp\fR] [\fB-o\fR \fIprops\fR[,...]] [\fIpool\fR] ...\fR
.ad
.sp .6
.RS 4n
@@ -1500,6 +1513,17 @@ Verbose statistics. Reports usage statistics for individual \fIvdevs\fR within
the pool, in addition to the pool-wise statistics.
.RE
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-p\fR\fR
+.ad
+.RS 12n
+.rt
+Display numbers in parseable (exact) values.
+.RE
+
.RE
.sp
diff --git a/usr/src/man/man3c/Makefile b/usr/src/man/man3c/Makefile
index 7d7113db7c..ae5b8542bd 100644
--- a/usr/src/man/man3c/Makefile
+++ b/usr/src/man/man3c/Makefile
@@ -150,6 +150,7 @@ MANFILES = __fbufsize.3c \
gethostid.3c \
gethostname.3c \
gethrtime.3c \
+ getline.3c \
getloadavg.3c \
getlogin.3c \
getmntent.3c \
@@ -749,6 +750,7 @@ MANSOFILES = FD_CLR.3c \
getc_unlocked.3c \
getchar.3c \
getchar_unlocked.3c \
+ getdelim.3c \
getextmntent.3c \
getgrent.3c \
getgrent_r.3c \
@@ -1511,6 +1513,8 @@ sethostname.3c := SOSRC = man3c/gethostname.3c
gethrvtime.3c := SOSRC = man3c/gethrtime.3c
+getdelim.3c := SOSRC = man3c/getline.3c
+
getlogin_r.3c := SOSRC = man3c/getlogin.3c
getextmntent.3c := SOSRC = man3c/getmntent.3c
diff --git a/usr/src/man/man3c/getline.3c b/usr/src/man/man3c/getline.3c
new file mode 100644
index 0000000000..a8db7df218
--- /dev/null
+++ b/usr/src/man/man3c/getline.3c
@@ -0,0 +1,136 @@
+'\" t
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
+.\"
+.TH GETLINE 3C "Apr 24, 2013"
+.SH NAME
+getline, getdelim \- read delimited input from streams
+.SH SYNOPSIS
+.LP
+.nf
+#include <stdio.h>
+.fi
+
+.LP
+.nf
+\fBssize_t\fR \fBgetline\fR(\fBchar **restrict\fR \fIptr\fR, \
+\fBsize_t *restrict\fR \fIcap\fR,
+ \fBFILE *restrict\fR \fIstream\fR);
+.fi
+
+.LP
+.nf
+\fBssize_t\fR \fBgetdelim\fR(\fBchar **restrict\fR \fIptr\fR, \
+\fBsize_t *restrict\fR \fIcap\fR,
+ \fBint\fR \fIdelimiter\fR, \fBFILE *restrict\fR \fIstream\fR);
+.fi
+
+.SH DESCRIPTION
+The \fBgetdelim\fR() function reads bytes from the \fIstream\fR into the the
+array pointed to by \fIptr\fR, until the \fIdelimiter\fR byte or an end-of-file
+condition is encountered. The \fBgetline\fR() function is identical in
+behaviour, but uses the newline character as the delimiter. The delimiter
+character is included in the string (unless end-of-file was reached first) and
+the string is terminated with a null byte.
+
+The caller may pass a pre-allocated \fBmalloc\fR(3C) buffer as \fI*ptr\fR,
+along with the capacity of that buffer as \fI*cap\fR. It is also valid to pass
+\fBNULL\fR for \fI*ptr\fR and \fB0\fR for \fI*cap\fR, at which point memory
+will be allocated automatically. If the buffer provided is not large enough to
+hold the string it will be expanded, as if via \fBrealloc(3C)\fR. The caller
+must \fBfree(3C)\fR the buffer when it is no longer required.
+
+.SH RETURN VALUES
+.sp
+.LP
+If successful, \fBgetdelim\fR() and \fBgetline\fR() return the number of bytes
+written into the buffer, excluding the terminating null byte. If an error
+occurs, or if end-of-file is reached prior to reading any bytes, the value
+\fB\(mi1\fR is returned and \fIerrno\fR is set to indicate the error.
+
+.SH ERRORS
+.sp
+.LP
+The \fBgetline\fR() and \fBgetdelim\fR() functions may fail due to the
+following errors:
+
+.sp
+.ne 2
+.na
+\fBEINVAL\fR
+.ad
+.RS 13n
+Either \fIptr\fR or \fIcap\fR are \fBNULL\fR, or the \fIdelimiter\fR is
+not a valid character.
+.RE
+
+.sp
+.ne 2
+.na
+\fBEOVERFLOW\fR
+.ad
+.RS 13n
+More than \fBSSIZE_MAX\fR characters were read from the stream without
+encountering the \fIdelimiter\fR.
+.RE
+
+.sp
+.LP
+The \fBgetline\fR() and \fBgetdelim\fR() functions may also fail and set
+\fIerrno\fR for any of the errors specified for the library routines
+\fBrealloc\fR(3C) or \fBfgetc\fR(3C).
+
+.SH EXAMPLES
+.LP
+\fBExample 1\fR Read a line from \fBstdin\fR.
+.sp
+.LP
+The following example uses \fBgetline\fR to read a line from stdin.
+
+.sp
+.in +2
+.nf
+#include <stdio.h>
+\&...
+char *ptr = NULL;
+size_t cap = 0;
+
+if (getline(&ptr, &cap, stdin) == -1) {
+ perror("getline");
+ exit(1);
+}
+fprintf(stdout, "input line: %s", ptr);
+
+free(ptr);
+.
+.fi
+.in -2
+
+.SH ATTRIBUTES
+.sp
+.TS
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
+_
+Interface Stability Committed
+_
+MT-Level MT-Safe
+.TE
+
+.SH SEE ALSO
+.sp
+.LP
+\fBfgetc\fR(3C), \fBfgets\fR(3C), \fBfree\fR(3C), \fBmalloc\fR(3C),
+\fBrealloc\fR(3C), \fBattributes\fR(5)
diff --git a/usr/src/man/man3c/port_associate.3c b/usr/src/man/man3c/port_associate.3c
index d876b5c9d7..f6e66b0d65 100644
--- a/usr/src/man/man3c/port_associate.3c
+++ b/usr/src/man/man3c/port_associate.3c
@@ -73,21 +73,21 @@ the port.
.LP
Objects of type \fBPORT_SOURCE_FILE\fR are pointer to the structure
\fBfile_obj\fR defined in \fB<sys/port.h>\fR. This event source provides event
-notification when the specified file/directory is accessed or modified or when
-its status changes. The path name of the file/directory to be watched is passed
-in the \fBstruct file_obj\fR along with the \fBaccess\fR, \fBmodification\fR,
-and \fBchange\fR time stamps acquired from a \fBstat\fR(2) call. If the file
-name is a symbolic links, it is followed by default. The \fBFILE_NOFOLLOW\fR
-needs to be passed in along with the specified events if the symbolic link
-itself needs to be watched and \fBlstat()\fR needs to be used to get the file
-status of the symbolic link file.
+notification when the specified file/directory is accessed, modified,
+truncated or when its status changes. The path name of the file/directory to
+be watched is passed in the \fBstruct file_obj\fR along with the \fBaccess\fR,
+\fBmodification\fR, and \fBchange\fR time stamps acquired from a \fBstat\fR(2)
+call. If the file name is a symbolic link, it is followed by default. The
+\fBFILE_NOFOLLOW\fR needs to be passed in along with the specified events if
+the symbolic link itself needs to be watched and \fBlstat()\fR needs to be
+used to get the file status of the symbolic link file.
.sp
.LP
The \fBstruct file_obj\fR contains the following elements:
.sp
.in +2
.nf
-timestruc_t fo_atime; /* Access time got from stat() */
+timestruc_t fo_atime; /* Access time from stat() */
timestruc_t fo_mtime; /* Modification time from stat() */
timestruc_t fo_ctime; /* Change time from stat() */
char *fo_name; /* Pointer to a null terminated path name */
@@ -104,11 +104,13 @@ occurs.
.sp
.LP
The event types that can be specified at \fBport_associate()\fR time for
-\fBPORT_SOURCE_FILE\fR are \fBFILE_ACCESS\fR, \fBFILE_MODIFIED\fR, and
-\fBFILE_ATTRIB\fR, corresponding to the three time stamps. An \fBfo_atime\fR
-change results in the \fBFILE_ACCESS\fR event, an \fBfo_mtime\fR change results
-in the \fBFILE_MODIFIED\fR event, and an \fBfo_time\fR change results in the
-\fBFILE_ATTRIB\fR event.
+\fBPORT_SOURCE_FILE\fR are \fBFILE_ACCESS\fR, \fBFILE_MODIFIED\fR,
+\fBFILE_ATTRIB\fR, and \fbFILE_TRUNC\fR. The first three of these correspond
+to the three time stamps: an \fBfo_atime\fR change results in the
+\fBFILE_ACCESS\fR event, an \fBfo_mtime\fR change results in the
+\fBFILE_MODIFIED\fR event, and an \fBfo_ctime\fR change results in the
+\fBFILE_ATTRIB\fR event. If the operation that induced the time stamp update
+also truncated the file, \fBFILE_TRUNC\fR will be set in the resulting event.
.sp
.LP
The following exception events are delivered when they occur. These event types
diff --git a/usr/src/man/man3malloc/umem_alloc.3malloc b/usr/src/man/man3malloc/umem_alloc.3malloc
index cc8e3df369..d8680ca083 100644
--- a/usr/src/man/man3malloc/umem_alloc.3malloc
+++ b/usr/src/man/man3malloc/umem_alloc.3malloc
@@ -174,6 +174,19 @@ Set the underlying function used to allocate memory. This option can be set to
\fBmmap\fR(2)-based source. If set to a value that is not supported, \fBsbrk\fR
will be used.
.RE
+.sp
+.ne 2
+.na
+\fB\fBperthread_cache\fR=\fBsize\fR\fR
+.ad
+.RS 16n
+libumem allows for each thread to cache recently freed small allocations for
+future allocations. The size argument, which accepts k, m, g, and t, suffixes
+denotes the maximum amount of memory each thread can use for this purpose. The
+default amount used is 1 MB. Any buffers in the per-thread cache are freed when
+the thread exits. The efficacy of the per-thread cache can be determined with
+the \fB::umastat\fR \fBmdb\fR(1) \fIdcmd\fR debugger command.
+.RE
.ne 2
.na
diff --git a/usr/src/man/man3socket/Makefile b/usr/src/man/man3socket/Makefile
index c54af7b3ad..77d818b6cc 100644
--- a/usr/src/man/man3socket/Makefile
+++ b/usr/src/man/man3socket/Makefile
@@ -22,6 +22,7 @@ MANFILES = accept.3socket \
connect.3socket \
ethers.3socket \
getaddrinfo.3socket \
+ getifaddrs.3socket \
getipnodebyname.3socket \
getnetbyname.3socket \
getpeername.3socket \
@@ -64,6 +65,7 @@ MANSOFILES = accept4.3socket \
ether_ntohost.3socket \
freeaddrinfo.3socket \
freehostent.3socket \
+ freeifaddrs.3socket \
gai_strerror.3socket \
getipnodebyaddr.3socket \
getipv4sourcefilter.3socket \
@@ -154,6 +156,8 @@ freeaddrinfo.3socket := SOSRC = man3socket/getaddrinfo.3socket
gai_strerror.3socket := SOSRC = man3socket/getaddrinfo.3socket
getnameinfo.3socket := SOSRC = man3socket/getaddrinfo.3socket
+freeifaddrs.3socket := SOSRC = man3socket/getifaddrs.3socket
+
freehostent.3socket := SOSRC = man3socket/getipnodebyname.3socket
getipnodebyaddr.3socket := SOSRC = man3socket/getipnodebyname.3socket
diff --git a/usr/src/man/man3socket/getifaddrs.3socket b/usr/src/man/man3socket/getifaddrs.3socket
new file mode 100644
index 0000000000..2f303b2835
--- /dev/null
+++ b/usr/src/man/man3socket/getifaddrs.3socket
@@ -0,0 +1,152 @@
+'\" t
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
+.\"
+.TH GETIFADDRS 3SOCKET "Apr 18, 2013"
+.SH NAME
+getifaddrs, freeifaddrs \- get interface addresses
+.SH SYNOPSIS
+.LP
+.nf
+\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB-lnsl\fR \
+[ \fIlibrary\fR ... ]
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <ifaddrs.h>
+.fi
+
+.LP
+.nf
+\fBint\fR \fBgetifaddrs\fR(\fBstruct ifaddrs **\fR\fIifap\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBfreeifaddrs\fR(\fBstruct ifaddrs *\fR\fIifp\fR);
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+The \fBgetifaddrs\fR() function is used to obtain the list of network
+interfaces on the local machine. A reference to a linked list of \fBifaddrs\fR
+structures, as defined in \fB<ifaddrs.h>\fR, is stored in the memory referenced
+by \fIifap\fR. Each structure in the list describes one network interface
+address, and is of the form:
+
+.sp
+.in +2
+.nf
+struct ifaddrs {
+ struct ifaddrs *ifa_next;
+ char *ifa_name;
+ uint64_t ifa_flags;
+ struct sockaddr *ifa_addr;
+ struct sockaddr *ifa_netmask;
+ union {
+ struct sockaddr *ifu_broadaddr;
+ struct sockaddr *ifu_dstaddr;
+ } ifa_ifu;
+ void *ifa_data;
+};
+#define ifa_broadaddr ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr ifa_ifu.ifu_dstaddr
+.fi
+.in -2
+
+.sp
+.LP
+The list is traversed by following the \fIifa_next\fR pointer. This member is
+\fBNULL\fR on the last structure in the list.
+
+.sp
+.LP
+The \fIifa_name\fR member contains the interface name.
+
+.sp
+.LP
+The \fIifa_flags\fR member contains the interface flags.
+
+.sp
+.LP
+The \fIifa_addr\fR member references the address of the interface. Use the
+\fIsa_family\fR member of this structure to determine the format of the
+address, as described in \fBsocket.h\fR(3HEAD).
+
+.sp
+.LP
+The \fIifa_netmask\fR member references the netmask associated with ifa_addr,
+or \fBNULL\fR if one is not set.
+
+.sp
+.LP
+If the \fBIFF_BROADCAST\fR bit is set in \fIifa_flags\fR, then
+\fIifa_broadaddr\fR is valid, or \fBNULL\fR if not present. If the
+\fBIFF_POINTOPOINT\fR bit is set, then \fIifa_dstaddr\fR is valid, or \fBNULL\fR
+if not present. These two flags are mutually exclusive; see \fBif_tcp\fR(7P)
+for more information.
+
+.sp
+.LP
+The \fIifa_data\fR member is presently unused.
+
+.sp
+.LP
+The memory used by \fBgetifaddrs\fR() to back the list is dynamically allocated.
+It should be freed using \fBfreeifaddrs\fR().
+
+.SH RETURN VALUES
+.sp
+.LP
+If successful, \fBgetifaddrs\fR() returns the value \fB0\fR; otherwise it
+returns \fB\(mi1\fR and sets \fIerrno\fR to indicate the error.
+
+.SH ERRORS
+.sp
+.LP
+The \fBgetifaddrs\fR() function may fail and set \fIerrno\fR for any of the
+errors specified for the library routines \fBioctl\fR(2),
+\fBsocket\fR(3SOCKET), and \fBmalloc\fR(3C).
+
+.SH ATTRIBUTES
+.sp
+.TS
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
+_
+Interface Stability Committed
+_
+MT-Level MT-Safe
+.TE
+
+.SH SEE ALSO
+.sp
+.LP
+\fBipadm\fR(1M), \fBifconfig\fR(1M), \fBioctl\fR(2), \fBmalloc\fR(3C),
+\fBsocket\fR(3SOCKET), \fBsocket.h\fR(3HEAD), \fBif_tcp\fR(7P),
+\fBattributes\fR(5)
+
+.SH NOTES
+.sp
+.LP
+On an illumos system, this function lists only interfaces with the \fBIFF_UP\fR
+flag set; see \fBif_tcp\fR(7P) and \fBifconfig\fR(1M) for more information.
+
+.SH BUGS
+.sp
+.LP
+At present, this function only lists addresses from the \fBAF_INET\fR and
+\fBAF_INET6\fR families. Other families, such as \fBAF_LINK\fR, are not
+included.
diff --git a/usr/src/man/man3xnet/Makefile b/usr/src/man/man3xnet/Makefile
index 4996a85a9f..567a6c6055 100644
--- a/usr/src/man/man3xnet/Makefile
+++ b/usr/src/man/man3xnet/Makefile
@@ -59,6 +59,7 @@ MANSOFILES = getaddrinfo.3xnet \
getservbyname.3xnet \
getservbyport.3xnet \
getservent.3xnet \
+ htonll.3xnet \
htons.3xnet \
if_freenameindex.3xnet \
if_indextoname.3xnet \
@@ -70,6 +71,7 @@ MANSOFILES = getaddrinfo.3xnet \
inet_ntoa.3xnet \
inet_pton.3xnet \
ntohl.3xnet \
+ ntohll.3xnet \
ntohs.3xnet \
sethostent.3xnet \
setnetent.3xnet \
@@ -96,6 +98,7 @@ getservbyname.3xnet := SOSRC = man3xnet/endservent.3xnet
getservbyport.3xnet := SOSRC = man3xnet/endservent.3xnet
getservent.3xnet := SOSRC = man3xnet/endservent.3xnet
+htonll.3xnet := SOSRC = man3xnet/htonl.3xnet
htons.3xnet := SOSRC = man3xnet/htonl.3xnet
if_freenameindex.3xnet := SOSRC = man3xnet/if_nametoindex.3xnet
@@ -111,6 +114,7 @@ inet_ntoa.3xnet := SOSRC = man3xnet/inet_addr.3xnet
inet_pton.3xnet := SOSRC = man3xnet/inet_ntop.3xnet
ntohl.3xnet := SOSRC = man3xnet/htonl.3xnet
+ntohll.3xnet := SOSRC = man3xnet/htonl.3xnet
ntohs.3xnet := SOSRC = man3xnet/htonl.3xnet
sethostent.3xnet := SOSRC = man3xnet/endhostent.3xnet
diff --git a/usr/src/man/man3xnet/htonl.3xnet b/usr/src/man/man3xnet/htonl.3xnet
index aa8470a28e..dda4586eb7 100644
--- a/usr/src/man/man3xnet/htonl.3xnet
+++ b/usr/src/man/man3xnet/htonl.3xnet
@@ -7,7 +7,8 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH HTONL 3XNET "Jun 10, 2002"
+.\" Portions Copyright (c) 2012 Joyent, Inc. All rights reserved.
+.TH HTONL 3XNET "Jan 03, 2013"
.SH NAME
htonl, htons, ntohl, ntohs \- convert values between host and network byte
order
@@ -22,6 +23,11 @@ order
.LP
.nf
+\fBuint64_t\fR \fBhtonll\fR(\fBuint64_t\fR \fIhostlonglong\fR);
+.fi
+
+.LP
+.nf
\fBuint16_t\fR \fBhtons\fR(\fBuint16_t\fR \fIhostshort\fR);
.fi
@@ -32,18 +38,23 @@ order
.LP
.nf
+\fBuint64_t\fR \fBntohll\fR(\fBuint64_t\fR \fInetlonglong\fR);
+.fi
+
+.LP
+.nf
\fBuint16_t\fR \fBntohs\fR(\fBuint16_t\fR \fI netshort\fR);
.fi
.SH DESCRIPTION
.sp
.LP
-These functions convert 16-bit and 32-bit quantities between network byte order
-and host byte order.
+These functions convert 16-bit, 32-bit, and 64-bit quantities between network
+byte order and host byte order.
.sp
.LP
-The \fBuint32_t\fR and \fBuint16_t\fR types are made available by inclusion
-of \fB<inttypes.h>\fR\&.
+The \fBuint32_t\fR, \fBuint16_t\fR, and \fBuint64_t\fR types are made available
+by inclusion of \fB<inttypes.h>\fR\&.
.SH USAGE
.sp
.LP
@@ -56,12 +67,12 @@ value of their argument.
.SH RETURN VALUES
.sp
.LP
-The \fBhtonl()\fR and \fBhtons()\fR functions return the argument value
-converted from host to network byte order.
+The \fBhtonl()\fR, \fBhtonll()\fR, and \fBhtons()\fR functions return the
+argument value converted from host to network byte order.
.sp
.LP
-The \fBntohl()\fR and \fBntohs()\fR functions return the argument value
-converted from network to host byte order.
+The \fBntohl()\fR, \fBntohll()\fR, and \fBntohs()\fR functions return the
+argument value converted from network to host byte order.
.SH ERRORS
.sp
.LP
diff --git a/usr/src/man/man5/privileges.5 b/usr/src/man/man5/privileges.5
index be969c17a8..138cd908b2 100644
--- a/usr/src/man/man5/privileges.5
+++ b/usr/src/man/man5/privileges.5
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH PRIVILEGES 5 "May 29, 2009"
+.TH PRIVILEGES 5 "March 7, 2012"
.SH NAME
privileges \- process privilege model
.SH DESCRIPTION
@@ -283,6 +284,16 @@ Allow a process to perform privileged mappings through a graphics device.
.sp
.ne 2
.na
+\fB\fBPRIV_HYPRLOFS_CONTROL\fR\fR
+.ad
+.sp .6
+.RS 4n
+Allow a process to perform hyprlofs name space management.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fBPRIV_IPC_DAC_READ\fR\fR
.ad
.sp .6
diff --git a/usr/src/man/man5/resource_controls.5 b/usr/src/man/man5/resource_controls.5
index a600a79d5a..747f8406fa 100644
--- a/usr/src/man/man5/resource_controls.5
+++ b/usr/src/man/man5/resource_controls.5
@@ -1,16 +1,18 @@
'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH RESOURCE_CONTROLS 5 "Jul 2, 2007"
+.TH RESOURCE_CONTROLS 5 "Sep 16, 2012"
.SH NAME
-resource_controls \- resource controls available through project database
+resource_controls \- resource controls available through projects and zones
.SH DESCRIPTION
.sp
.LP
-The resource controls facility is configured through the project database. See
-\fBproject\fR(4). You can set and modify resource controls through the
+For projects the resource controls facility is configured through the project
+database. See \fBproject\fR(4). For zones, resource controls are configured
+through \fBzonecfg\fR(1M). You can set and modify resource controls through the
following utilities:
.RS +4
.TP
@@ -36,6 +38,12 @@ following utilities:
.el o
\fBrctladm\fR(1M)
.RE
+.RS +4
+.TP
+.ie t \(bu
+.el o
+\fBzonecfg\fR(1M)
+.RE
.sp
.LP
In a program, you use \fBsetrctl\fR(2) to set resource control values.
@@ -273,6 +281,19 @@ Maximum allowable number of event ports, expressed as an integer.
.sp
.ne 2
.na
+\fB\fBproject.max-processes\fR\fR
+.ad
+.sp .6
+.RS 4n
+Maximum number of processes that can be active in a project. This rctl is
+similar to \fBproject.max-lwps\fR, except that zombie processes are included.
+This rctl prevents process-slot exhaustion which can occur due to an excessive
+number of zombies. Expressed as an integer.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fBproject.max-sem-ids\fR\fR
.ad
.sp .6
@@ -361,6 +382,33 @@ The following zone-wide resource controls are available:
.sp
.ne 2
.na
+\fB\fBzone.cpu-baseline\fR\fR
+.ad
+.sp .6
+.RS 4n
+Sets a baseline amount of CPU time that a zone can use before it is considered
+to be bursting. The unit used is the percentage of a single CPU that is being
+used by all user threads in a zone. The value should be less than the
+\fBzone.cpu-cap\fR rctl value and is expressed as an integer.
+This resource control does not support the \fBsyslog\fR action.
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fBzone.cpu-burst-time\fR\fR
+.ad
+.sp .6
+.RS 4n
+Sets the number of seconds that a zone can exceed the \fBzone.cpu-baseline\fR
+rctl value before being cpu-capped down to the \fBzone.cpu-baseline\fR.
+A value of 0 means that \fBzone.cpu-baseline\fR can be exceeded indefinitely.
+This resource control does not support the \fBsyslog\fR action.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fBzone.cpu-cap\fR\fR
.ad
.sp .6
@@ -379,7 +427,7 @@ not support the \fBsyslog\fR action.
.ad
.sp .6
.RS 4n
-Sets a limit on the number of fair share scheduler (FSS) CPU shares for a zone.
+Sets a value on the number of fair share scheduler (FSS) CPU shares for a zone.
CPU shares are first allocated to the zone, and then further subdivided among
projects within the zone as specified in the \fBproject.cpu-shares\fR entries.
Expressed as an integer. This resource control does not support the
@@ -399,14 +447,25 @@ Total amount of physical locked memory available to a zone.
.sp
.ne 2
.na
+\fB\fBzone.max-lofi\fR\fR
+.ad
+.sp .6
+.RS 4n
+Sets a limit on the number of \fBLOFI\fR(7D) devices that can be created in a
+zone. Expressed as an integer. This resource control does not support the
+\fBsyslog\fR action.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fBzone.max-lwps\fR\fR
.ad
.sp .6
.RS 4n
-Enhances resource isolation by preventing too many LWPs in one zone from
-affecting other zones. A zone's total LWPs can be further subdivided among
-projects within the zone within the zone by using \fBproject.max-lwps\fR
-entries. Expressed as an integer.
+Sets a limit on how many LWPs can be active in a zone. A zone's total LWPs
+can be further subdivided among projects within the zone within the zone by
+using \fBproject.max-lwps\fR entries. Expressed as an integer.
.RE
.sp
@@ -423,6 +482,33 @@ integer.
.sp
.ne 2
.na
+\fB\fBzone.max-physical-memory\fR\fR
+.ad
+.sp .6
+.RS 4n
+Sets a limit on the amount of physical memory (RSS) that can be used by a zone
+before resident pages start being forcibly paged out. The unit used is bytes.
+Expressed as an integer. This resource control does not support the
+\fBsyslog\fR action.
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fBzone.max-processes\fR\fR
+.ad
+.sp .6
+.RS 4n
+Maximum number of processes that can be active in a zone. This rctl is
+similar to \fBzone.max-lwps\fR, except that zombie processes are included.
+This rctl prevents process-slot exhaustion which can occur due to an excessive
+number of zombies. This rctl can be further subdivided among projects within
+the zone using \fBproject.max-processes\fR. Expressed as an integer.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fBzone.max-sem-ids\fR\fR
.ad
.sp .6
@@ -464,6 +550,18 @@ mappings and \fBtmpfs\fR mounts for this zone.
.RE
.sp
+.ne 2
+.na
+\fB\fBzone.zfs-io-priority\fR\fR
+.ad
+.sp .6
+.RS 4n
+Sets a value for the \fBzfs\fR(1M) I/O priority for a zone. This is used as
+one of the inputs to determine if a zone's I/O should be throttled. Expressed
+as an integer. This resource control does not support the \fBsyslog\fR action.
+.RE
+
+.sp
.LP
See \fBzones\fR(5).
.SS "Units Used in Resource Controls"
diff --git a/usr/src/man/man5/zpool-features.5 b/usr/src/man/man5/zpool-features.5
index a306e4388f..8d521c7ee2 100644
--- a/usr/src/man/man5/zpool-features.5
+++ b/usr/src/man/man5/zpool-features.5
@@ -228,7 +228,6 @@ read-only compatible, this operation will render the pool unimportable
on systems without support for the \fBlz4_compress\fR feature. At the
moment, this operation cannot be reversed. Booting off of
\fBlz4\fR-compressed root pools is supported.
-
.RE
.SH "SEE ALSO"
diff --git a/usr/src/man/man7d/lofi.7d b/usr/src/man/man7d/lofi.7d
index 72b2d9781b..81fffc6354 100644
--- a/usr/src/man/man7d/lofi.7d
+++ b/usr/src/man/man7d/lofi.7d
@@ -136,7 +136,3 @@ through the \fBlofi\fR file driver.
.LP
For compatibility purposes, a raw device is also exported with the block
device. (For example, \fBnewfs\fR(1M)).
-.sp
-.LP
-The \fBlofi\fR driver isn't available in a zone and will not work inside a
-zone.
diff --git a/usr/src/man/man7fs/Makefile b/usr/src/man/man7fs/Makefile
index dc3755ed0d..e3f5c084b3 100644
--- a/usr/src/man/man7fs/Makefile
+++ b/usr/src/man/man7fs/Makefile
@@ -12,6 +12,7 @@
#
# Copyright 2011, Richard Lowe
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2012 Joyent, Inc. All rights reserved.
#
include ../../Makefile.master
@@ -24,7 +25,9 @@ MANFILES = ctfs.7fs \
devfs.7fs \
fd.7fs \
hsfs.7fs \
+ hyprlofs.7fs \
lofs.7fs \
+ lxproc.7fs \
objfs.7fs \
pcfs.7fs \
sharefs.7fs \
diff --git a/usr/src/man/man7fs/hyprlofs.7fs b/usr/src/man/man7fs/hyprlofs.7fs
new file mode 100644
index 0000000000..8655791193
--- /dev/null
+++ b/usr/src/man/man7fs/hyprlofs.7fs
@@ -0,0 +1,62 @@
+'\" te
+.\" Copyright (c) 2012, Joyent, Inc.
+.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
+.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
+.TH HYPRLOFS 7FS "March 7, 2012"
+.SH NAME
+hyprlofs \- fast name space virtual file system
+.SH SYNOPSIS
+.LP
+.nf
+#include <sys/fs/hyprlofs.h>
+
+\fB\fR\fBmount\fR (\fB\fR\fIspecial\fR, \fB\fR\fIdirectory\fR, \fB\fR\fIMS_DATA\fR, \fB\fR\fI"hyprlofs"\fR, \fB\fR\fINULL\fR, \fB\fR\fI0\fR);
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+\fBhyprlofs\fR is a hybrid file system combining features from
+\fBtmpfs(7FS)\fR and \fBlofs(7FS)\fR.
+As with \fBlofs\fR, the \fBhyprlofs\fR file system allows new, virtual file
+systems to be created which provide access to existing files using alternate
+pathnames. In addition, the files themselves may have alternate names and
+paths within the mount.
+Unlike \fBlofs\fR, files cannot be created and backing files cannot be removed.
+The name space is completely managed through ioctls on the mount.
+Entries in the name space are not mounts and thus, they will not appear in the
+mnttab. The file system is designed to provide a very fast name space to the
+backing files. The name space can be modified very quickly through the ioctl
+interface.
+.sp
+.LP
+\fBhyprlofs\fR file systems can be mounted with the command:
+.sp
+.in +2
+.nf
+\fBmount \fR\fB-F\fR\fB hyprlofs swap \fR\fIdirectory\fR
+.fi
+.in -2
+
+.sp
+.LP
+The name space used by \fBhyprlofs\fR exists only in-memory so it will consume
+a small amount of the system's virtual memory. The files themselves are backed
+by the original file as with \fBlofs\fR.
+
+.SH SEE ALSO
+.sp
+.LP
+\fBdf\fR(1M), \fBmount\fR(1M), \fBswap\fR(1M),
+\fBmount\fR(2), \fBumount\fR(2)
+.sp
+.LP
+\fISystem Administration Guide: Basic Administration\fR
+.SH DIAGNOSTICS
+.sp
+.LP
+\fBdf\fR(1M) output is of limited accuracy since
+the space available to \fBhyprlofs\fR is dependent on the swap
+space demands of the entire system and the files in the name space are not
+included.
diff --git a/usr/src/man/man7fs/lxproc.7fs b/usr/src/man/man7fs/lxproc.7fs
new file mode 100644
index 0000000000..fe8a0d6d35
--- /dev/null
+++ b/usr/src/man/man7fs/lxproc.7fs
@@ -0,0 +1,115 @@
+'\" te
+.\" Copyright (c) 2012, Joyent, Inc.
+.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
+.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
+.TH LXPROC 7FS "April 25, 2012"
+.SH NAME
+lxproc \- a loosely Linux-compatible /proc
+.SH SYNOPSIS
+.LP
+.nf
+\fB\fR\fBmount\fR (\fB\fR\fI"lxproc"\fR, \fB\fR\fIdirectory\fR, \fB\fR\fIMS_DATA\fR, \fB\fR\fI"lxproc"\fR, \fB\fR\fINULL\fR, \fB\fR\fI0\fR);
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+\fBlxproc\fR is an implementation of the \fB/proc\fR filesystem that
+loosely matches the Linux semantics of providing human-readable text files
+that correspond to elements of the system.
+As with both \fBproc\fR(4) and Linux \fB/proc\fR, \fBlxproc\fR makes available
+a directory for every process, with each directory containing a number
+of files; like Linux \fB/proc\fR but unlike \fBproc\fR(4), \fBlxproc\fR also
+makes available a number of files related to system-wide information.
+To ascertain the meaning and structure of the files provided via
+\fBlxproc\fR, users should consult the Linux documentation.
+.sp
+.LP
+The \fBlxproc\fR compatibility layer is
+provided only as a best-effort for simple Linux \fB/proc\fR readers; it
+is not intended to exactly mimic Linux semantics and nor does it attempt to
+somehow fool a consumer into believing that it is operating within a Linux
+environment. As such, \fBlxproc\fR should only be used by Linux-specific
+programs that are willing to trade precision in understanding the
+system in return for Linux compatibility. To programmatically understand
+the system precisely and in terms of its native constructs,
+one should not use \fBlxproc\fR, but rather \fBproc\fR(4) or
+\fBkstat\fR(3KSTAT).
+To understand
+a process or group of processes from either a shell script or the command line,
+one should not use \fBlxproc\fR, but rather \fBproc\fR(4)-based tools like
+\fBprstat\fR(1M),
+\fBpfiles\fR(1),
+\fBpargs\fR(1),
+\fBpmap\fR(1),
+\fBptree\fR(1),
+\fBplimit\fR(1),
+\fBpflags\fR(1),
+\fBpcred\fR(1),
+\fBpstack\fR(1),
+\fBpldd\fR(1),
+\fBpsig\fR(1),
+or
+\fBpwdx\fR(1).
+To understand system-wide constructs from either a shell script or the
+command line, one should not use \fBlxproc\fR, but rather
+\fBkstat\fR(3KSTAT)-based tools like
+\fBkstat\fR(1M),
+\fBmpstat\fR(1M),
+\fBiostat\fR(1M),
+\fBnetstat\fR(1M) or
+\fBpsrinfo\fR(1M).
+.sp
+.LP
+Like \fB/proc\fR, \fBlxproc\fR can be mounted on any mount point, but the
+preferred mount point is \fB/system/lxproc\fR; if a zone brand elects to
+mount it by default, this will (or should) generally be the mount point.
+.sp
+.LP
+\fBlxproc\fR can be mounted with the command:
+.sp
+.in +2
+.nf
+\fBmount \fR\fB-F\fR\fB lxproc lxproc \fR\fIdirectory\fR
+.fi
+.in -2
+
+.SH SEE ALSO
+.sp
+.LP
+\fBdf\fR(1M),
+\fBiostat\fR(1M),
+\fBkstat\fR(1M),
+\fBmpstat\fR(1M),
+\fBmount\fR(1M),
+\fBnetstat\fR(1M),
+\fBpargs\fR(1),
+\fBpcred\fR(1),
+\fBpfiles\fR(1),
+\fBpflags\fR(1),
+\fBpldd\fR(1),
+\fBplimit\fR(1),
+\fBpmap\fR(1),
+\fBprstat\fR(1M),
+\fBpsig\fR(1),
+\fBpsrinfo\fR(1M),
+\fBpstack\fR(1),
+\fBptree\fR(1),
+\fBpwdx\fR(1),
+\fBmount\fR(2), \fBumount\fR(2), \fBkstat\fR(3KSTAT), \fBproc\fR(4),
+\fBkstat\fR(9S)
+
+.SH NOTES
+.sp
+.LP
+When choosing between offering
+Linux compatibility and telling the truth, \fBlxproc\fR emphatically picks
+the truth. A particular glaring example of this is the Linux notion of
+"tasks" (that is, threads), which -- due to historical misadventures on
+Linux -- allocate their identifiers from the process identifier space.
+(That is, each thread has in effect a pid.) Some Linux \fB/proc\fR readers
+have come to depend on this attribute, and become confused when threads
+appear with proper identifiers, so \fBlxproc\fR simply opts for the pre-2.6
+behavior, and does not present the tasks directory at all.
+
diff --git a/usr/src/man/man9e/detach.9e b/usr/src/man/man9e/detach.9e
index b5e1ec78b8..d003dbba1e 100644
--- a/usr/src/man/man9e/detach.9e
+++ b/usr/src/man/man9e/detach.9e
@@ -14,7 +14,7 @@ detach \- detach or suspend a device
-\fBint prefix\fR \fBdetach\fR(\fBdev_info_t\fR \fIdip\fR, \fBddi_detach_cmd_t\fR \fIcmd\fR);
+\fBint prefix\fR \fBdetach\fR(\fBdev_info_t\fR *\fIdip\fR, \fBddi_detach_cmd_t\fR \fIcmd\fR);
.fi
.SH INTERFACE LEVEL
diff --git a/usr/src/man/man9f/kmem_cache_create.9f b/usr/src/man/man9f/kmem_cache_create.9f
index 95b6fd6525..3fa34c3253 100644
--- a/usr/src/man/man9f/kmem_cache_create.9f
+++ b/usr/src/man/man9f/kmem_cache_create.9f
@@ -336,7 +336,7 @@ requirement is that the client must free the object (using
this, so programming errors will lead to hard-to-find bugs.
.sp
.LP
-A driver should call \fBkmem_cache_create()\fR at the time of \fB_fini\fR(9E)
+A driver should call \fBkmem_cache_create()\fR at the time of \fB_init\fR(9E)
or \fBattach\fR(9E), and call the corresponding \fBkmem_cache_destroy()\fR at
the time of \fB_fini\fR(9E) or \fBdetach\fR(9E).
.sp
diff --git a/usr/src/man/man9f/net_hook_register.9f b/usr/src/man/man9f/net_hook_register.9f
index 6cffdc1e64..3d10a10524 100644
--- a/usr/src/man/man9f/net_hook_register.9f
+++ b/usr/src/man/man9f/net_hook_register.9f
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (C) 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH NET_HOOK_REGISTER 9F "May 1, 2008"
+.TH NET_HOOK_REGISTER 9F "Mar 5, 2012"
.SH NAME
net_hook_register \- add a hook to be called in event processing
.SH SYNOPSIS
@@ -11,7 +12,7 @@ net_hook_register \- add a hook to be called in event processing
.nf
#include <sys/neti.h>
-\fBnet_hook_t\fR \fBnet_hook_register\fR(\fBconst\fR \fBnet_data_t\fR \fInet\fR, \fBhook_t\fR *\fIhook\fR);
+\fBint\fR \fBnet_hook_register\fR(\fBnet_handle_t\fR \fIinfo\fR, \fBchar\fR *\fIevent\fR, \fBhook_t\fR *\fIhook\fR);
.fi
.SH INTERFACE LEVEL
@@ -22,7 +23,7 @@ Solaris DDI specific (Solaris DDI).
.sp
.ne 2
.na
-\fB\fInet\fR\fR
+\fB\fIinfo\fR\fR
.ad
.RS 8n
value returned from a successful call to \fBnet_protocol_register()\fR.
@@ -31,6 +32,15 @@ value returned from a successful call to \fBnet_protocol_register()\fR.
.sp
.ne 2
.na
+\fB\fIname\fR\fR
+.ad
+.RS 8n
+unique name for this hook.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fIhook\fR\fR
.ad
.RS 8n
@@ -42,9 +52,10 @@ pointer to a \fBhook_t\fR structure.
.LP
The \fBnet_hook_register()\fR function uses hooks that allow callbacks to be
registered with events that belong to a network protocol. A successful call to
-\fBnet_hook_register()\fR requires that a valid handle for a network protocol
-be provided (the \fInet\fR parameter), along with a hook description that
-includes a reference to an available event.
+\fBnet_hook_register()\fR requires that a valid handle for a network protocol be
+provided (the \fIinfo\fR parameter), along with a unique name and a hook
+description that includes a reference to an available event. No two hooks on the
+same netstack may share a name.
.sp
.LP
While it is possible to use the same \fBhook_t\fR structure with multiple calls
@@ -154,6 +165,14 @@ because it conflicts with another hook. An example of this might be specifying
with this value.
.RE
+.sp
+.ne 2
+.na
+\fBESHUTDOWN\fR
+.ad
+.RS 10n
+The netstack corresponding to \fIinfo\fR is condemned or no longer exists.
+
.SH CONTEXT
.sp
.LP
diff --git a/usr/src/man/man9f/net_instance_alloc.9f b/usr/src/man/man9f/net_instance_alloc.9f
index 0f51ce67d6..146054f5d4 100644
--- a/usr/src/man/man9f/net_instance_alloc.9f
+++ b/usr/src/man/man9f/net_instance_alloc.9f
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (C) 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH NET_INSTANCE_ALLOC 9F "May 1, 2008"
+.TH NET_INSTANCE_ALLOC 9F "Mar 5, 2012"
.SH NAME
net_instance_alloc \- allocate a net_instance_t structure
.SH SYNOPSIS
@@ -25,7 +26,7 @@ Solaris DDI specific (Solaris DDI).
\fB\fIversion\fR\fR
.ad
.RS 11n
-must always be the symbol \fBNETI_VERSION\fR.
+must always be the symbol \fBNETINFO_VERSION\fR.
.RE
.SH DESCRIPTION
diff --git a/usr/src/man/man9f/net_protocol_lookup.9f b/usr/src/man/man9f/net_protocol_lookup.9f
index d6707d7c9e..cafa4c2c4f 100644
--- a/usr/src/man/man9f/net_protocol_lookup.9f
+++ b/usr/src/man/man9f/net_protocol_lookup.9f
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (C) 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH NET_PROTOCOL_LOOKUP 9F "May 1, 2008"
+.TH NET_PROTOCOL_LOOKUP 9F "Mar 5, 2012"
.SH NAME
net_protocol_lookup \- locate an implementation of a network layer protocol
.SH SYNOPSIS
@@ -11,7 +12,7 @@ net_protocol_lookup \- locate an implementation of a network layer protocol
.nf
#include <sys/neti.h>
-\fBnet_data_t\fR \fBnet_protocol_lookup\fR(\fBnetid_t\fR \fIid\fR, \fBconst\fR \fBchar\fR *\fIprotocol\fR);
+\fBnet_handle_t\fR \fBnet_protocol_lookup\fR(\fBnetid_t\fR \fIid\fR, \fBconst\fR \fBchar\fR *\fIprotocol\fR);
.fi
.SH INTERFACE LEVEL
diff --git a/usr/src/man/man9f/net_protocol_release.9f b/usr/src/man/man9f/net_protocol_release.9f
index 5f9d1c5be5..f1759d099d 100644
--- a/usr/src/man/man9f/net_protocol_release.9f
+++ b/usr/src/man/man9f/net_protocol_release.9f
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (C) 2012, Joyent, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH NET_PROTOCOL_RELEASE 9F "May 1, 2008"
+.TH NET_PROTOCOL_RELEASE 9F "Mar 5, 2012"
.SH NAME
net_protocol_release \- indicate that a reference to a network protocol is no
longer required
@@ -12,7 +13,7 @@ longer required
.nf
#include <sys/neti.h>
-\fBint\fR \fBnet_protocol_release\fR(\fBnet_data_t\fR *\fInet\fR);
+\fBint\fR \fBnet_protocol_release\fR(\fBnet_handle_t\fR \fIinfo\fR);
.fi
.SH INTERFACE LEVEL
@@ -23,7 +24,7 @@ Solaris DDI specific (Solaris DDI).
.sp
.ne 2
.na
-\fB\fInet\fR\fR
+\fB\fIinfo\fR\fR
.ad
.RS 7n
value returned from a successful call to \fBnet_protocol_lookup\fR(9F).
diff --git a/usr/src/man/man9s/hook_t.9s b/usr/src/man/man9s/hook_t.9s
index b8abef07a5..818603ba59 100644
--- a/usr/src/man/man9s/hook_t.9s
+++ b/usr/src/man/man9s/hook_t.9s
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright (c) 2012 Joyent, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH HOOK_T 9S "May 1, 2008"
+.TH HOOK_T 9S "Mar 5, 2012"
.SH NAME
hook_t \- callback structure for subscribing to netinfo events
.SH SYNOPSIS
@@ -38,6 +39,16 @@ typedef int (*hook_func_t)(net_event_t token, hook_data_t info,
.fi
.in -2
+.SS "CALLBACK RETURN VALUES"
+.sp
+.LP
+The value returned by the \fBhook_func_t\fR function indicates whether or not
+the packet should still be considered valid. If the callback function has
+modified the packet in such a way that it should no longer be processed or
+considered valid, e.g. called \fBfreemsg\fR(9F), then the callback should return
+\fB1\fR. Otherwise it should return \fB0\fR.
+.sp
+
.SS "HINT TYPES"
.sp
.LP
diff --git a/usr/src/man/man9s/net_instance_t.9s b/usr/src/man/man9s/net_instance_t.9s
index 956bbcdb3a..4f4b143276 100644
--- a/usr/src/man/man9s/net_instance_t.9s
+++ b/usr/src/man/man9s/net_instance_t.9s
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright (c) 2012 Joyent, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH NET_INSTANCE_T 9S "May 1, 2008"
+.TH NET_INSTANCE_T 9S "Mar 5, 2012"
.SH NAME
net_instance_t \- packet event structure passed through to hooks
.SH SYNOPSIS
@@ -51,7 +52,8 @@ Name of the owner of the instance.
\fB\fBnin_create\fR\fR
.ad
.RS 16n
-Function to be called when a new instance of \fBIP\fR is created.
+Function to be called when a new instance of \fBIP\fR is created. It may not
+return \fBNULL\fR.
.RE
.sp
diff --git a/usr/src/pkg/manifests/SUNWcs.mf b/usr/src/pkg/manifests/SUNWcs.mf
index a477cc0e65..54cc11730d 100644
--- a/usr/src/pkg/manifests/SUNWcs.mf
+++ b/usr/src/pkg/manifests/SUNWcs.mf
@@ -237,9 +237,6 @@ $(i386_ONLY)dir path=usr/sbin/$(ARCH32)
dir path=usr/sbin/$(ARCH64)
dir path=usr/share
dir path=usr/share/doc group=other
-dir path=usr/share/doc/ksh
-dir path=usr/share/doc/ksh/images
-dir path=usr/share/doc/ksh/images/callouts
dir path=usr/share/lib
dir path=usr/share/lib/mailx
dir path=usr/share/lib/pub
@@ -1420,31 +1417,6 @@ file path=usr/sbin/volcopy mode=0555
file path=usr/sbin/wall group=tty mode=2555
file path=usr/sbin/zdump mode=0555
file path=usr/sbin/zic mode=0555
-file path=usr/share/doc/ksh/COMPATIBILITY
-file path=usr/share/doc/ksh/DESIGN
-file path=usr/share/doc/ksh/OBSOLETE
-file path=usr/share/doc/ksh/README
-file path=usr/share/doc/ksh/RELEASE
-file path=usr/share/doc/ksh/TYPES
-file path=usr/share/doc/ksh/images/callouts/1.png
-file path=usr/share/doc/ksh/images/callouts/10.png
-file path=usr/share/doc/ksh/images/callouts/2.png
-file path=usr/share/doc/ksh/images/callouts/3.png
-file path=usr/share/doc/ksh/images/callouts/4.png
-file path=usr/share/doc/ksh/images/callouts/5.png
-file path=usr/share/doc/ksh/images/callouts/6.png
-file path=usr/share/doc/ksh/images/callouts/7.png
-file path=usr/share/doc/ksh/images/callouts/8.png
-file path=usr/share/doc/ksh/images/callouts/9.png
-file path=usr/share/doc/ksh/images/tag_bourne.png
-file path=usr/share/doc/ksh/images/tag_i18n.png
-file path=usr/share/doc/ksh/images/tag_ksh.png
-file path=usr/share/doc/ksh/images/tag_ksh88.png
-file path=usr/share/doc/ksh/images/tag_ksh93.png
-file path=usr/share/doc/ksh/images/tag_l10n.png
-file path=usr/share/doc/ksh/images/tag_perf.png
-file path=usr/share/doc/ksh/shell_styleguide.docbook
-file path=usr/share/doc/ksh/shell_styleguide.html
file path=usr/share/lib/mailx/mailx.help
file path=usr/share/lib/mailx/mailx.help.~
file path=usr/share/lib/tabset/3101
diff --git a/usr/src/pkg/manifests/SUNWippcore.mf b/usr/src/pkg/manifests/SUNWippcore.mf
deleted file mode 100644
index c3e9ac8bde..0000000000
--- a/usr/src/pkg/manifests/SUNWippcore.mf
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/SUNWippcore@0.5.11,5.11-0.133
-set name=pkg.renamed value=true
-set name=variant.arch value=$(ARCH)
-depend fmri=pkg:/print/lp/ipp/libipp@0.5.11,5.11-0.133 type=require
diff --git a/usr/src/pkg/manifests/SUNWippl.mf b/usr/src/pkg/manifests/SUNWippl.mf
deleted file mode 100644
index e654f167b9..0000000000
--- a/usr/src/pkg/manifests/SUNWippl.mf
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/SUNWippl@0.5.11,5.11-0.133
-set name=pkg.renamed value=true
-set name=variant.arch value=$(ARCH)
-depend fmri=pkg:/print/lp/ipp/ipp-listener@0.5.11,5.11-0.133 type=require
diff --git a/usr/src/pkg/manifests/SUNWlpr-cmds.mf b/usr/src/pkg/manifests/SUNWlpr-cmds.mf
deleted file mode 100644
index 7c24e7dfbe..0000000000
--- a/usr/src/pkg/manifests/SUNWlpr-cmds.mf
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/SUNWlpr-cmds@0.5.11,5.11-0.130
-set name=pkg.obsolete value=true
-set name=variant.arch value=$(ARCH)
diff --git a/usr/src/pkg/manifests/SUNWps.mf b/usr/src/pkg/manifests/SUNWps.mf
index 1b6a424bf6..e9113f083a 100644
--- a/usr/src/pkg/manifests/SUNWps.mf
+++ b/usr/src/pkg/manifests/SUNWps.mf
@@ -26,4 +26,3 @@
set name=pkg.fmri value=pkg:/SUNWps@0.5.11,5.11-0.133
set name=pkg.renamed value=true
set name=variant.arch value=$(ARCH)
-depend fmri=pkg:/print/lp@0.5.11,5.11-0.133 type=require
diff --git a/usr/src/pkg/manifests/consolidation-osnet-osnet-message-files.mf b/usr/src/pkg/manifests/consolidation-osnet-osnet-message-files.mf
index cd9fd8743e..c7cc82c13d 100644
--- a/usr/src/pkg/manifests/consolidation-osnet-osnet-message-files.mf
+++ b/usr/src/pkg/manifests/consolidation-osnet-osnet-message-files.mf
@@ -334,10 +334,6 @@ file path=usr/lib/locale/C/LC_MESSAGES/priv_names group=sys
file path=usr/lib/locale/C/LC_MESSAGES/uxlibc.src group=sys
file path=usr/lib/locale/C/LC_TIME/SUNW_OST_OSCMD.po group=sys
file path=usr/lib/locale/C/LC_TIME/SUNW_OST_OSLIB.po group=sys
-file path=usr/share/lib/locale/com/sun/admin/pm/client/pmHelpResources.java \
- group=lp
-file path=usr/share/lib/locale/com/sun/admin/pm/client/pmResources.java \
- group=lp
file \
path=usr/share/lib/locale/com/sun/dhcpmgr/bridge/ResourceBundle.properties
file \
diff --git a/usr/src/pkg/manifests/developer-build-onbld.mf b/usr/src/pkg/manifests/developer-build-onbld.mf
index bf01650e0f..5459ca92ad 100644
--- a/usr/src/pkg/manifests/developer-build-onbld.mf
+++ b/usr/src/pkg/manifests/developer-build-onbld.mf
@@ -23,6 +23,7 @@
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2010, Richard Lowe
# Copyright 2012, Piotr Jasiukajtis
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
set name=pkg.fmri value=pkg:/developer/build/onbld@$(PKGVERS)
@@ -171,6 +172,8 @@ file path=opt/onbld/lib/python2.6/onbld/Checks/__init__.py mode=0444
file path=opt/onbld/lib/python2.6/onbld/Checks/__init__.pyc mode=0444
file path=opt/onbld/lib/python2.6/onbld/Scm/Backup.py mode=0444
file path=opt/onbld/lib/python2.6/onbld/Scm/Backup.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/Ignore.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/Ignore.pyc mode=0444
file path=opt/onbld/lib/python2.6/onbld/Scm/Version.py mode=0444
file path=opt/onbld/lib/python2.6/onbld/Scm/Version.pyc mode=0444
file path=opt/onbld/lib/python2.6/onbld/Scm/WorkSpace.py mode=0444
diff --git a/usr/src/pkg/manifests/driver-network-bge.mf b/usr/src/pkg/manifests/driver-network-bge.mf
index 74b2555119..ddf657b4b4 100644
--- a/usr/src/pkg/manifests/driver-network-bge.mf
+++ b/usr/src/pkg/manifests/driver-network-bge.mf
@@ -24,6 +24,9 @@
#
#
+# Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+#
+
# The default for payload-bearing actions in this package is to appear in the
# global zone only. See the include file for greater detail, as well as
# information about overriding the defaults.
@@ -57,9 +60,11 @@ $(i386_ONLY)driver name=bge clone_perms="bge 0666 root sys" \
alias=pci14e4,1649 \
alias=pci14e4,1653 \
alias=pci14e4,1654 \
+ alias=pci14e4,1657 \
alias=pci14e4,1659 \
alias=pci14e4,165d \
alias=pci14e4,165e \
+ alias=pci14e4,165f \
alias=pci14e4,1668 \
alias=pci14e4,1669 \
alias=pci14e4,166a \
@@ -79,9 +84,11 @@ $(i386_ONLY)driver name=bge clone_perms="bge 0666 root sys" \
alias=pci14e4,16c7 \
alias=pciex14e4,1655 \
alias=pciex14e4,1656 \
+ alias=pciex14e4,1657 \
alias=pciex14e4,165a \
alias=pciex14e4,165b \
alias=pciex14e4,165c \
+ alias=pciex14e4,165f \
alias=pciex14e4,1673 \
alias=pciex14e4,1674 \
alias=pciex14e4,1677 \
@@ -90,7 +97,13 @@ $(i386_ONLY)driver name=bge clone_perms="bge 0666 root sys" \
alias=pciex14e4,1680 \
alias=pciex14e4,1681 \
alias=pciex14e4,1684 \
+ alias=pciex14e4,1688 \
+ alias=pciex14e4,1689 \
+ alias=pciex14e4,1690 \
+ alias=pciex14e4,1691 \
alias=pciex14e4,1692 \
+ alias=pciex14e4,1694 \
+ alias=pciex14e4,1698 \
alias=pciex14e4,169d \
alias=pciex14e4,16fd \
alias=pciex14e4,1713
diff --git a/usr/src/pkg/manifests/library-print-open-printing-ipp.mf b/usr/src/pkg/manifests/library-print-open-printing-ipp.mf
deleted file mode 100644
index 51da643223..0000000000
--- a/usr/src/pkg/manifests/library-print-open-printing-ipp.mf
+++ /dev/null
@@ -1,120 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/library/print/open-printing/ipp@$(PKGVERS)
-set name=pkg.description \
- value="Client side support for communicating with IPP based print servers"
-set name=pkg.summary value="FSG Open Printing API IPP Print Service Module"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=usr group=sys
-dir path=usr/lib
-dir path=usr/lib/print group=lp
-dir path=usr/share/man
-dir path=usr/share/man/man4
-file path=usr/lib/print/libhttp-core.so.1
-file path=usr/lib/print/psm-ipp.so.1
-file path=usr/share/man/man3papi/papiAttributeListAddBoolean.3papi
-file path=usr/share/man/man3papi/papiAttributeListAddCollection.3papi
-file path=usr/share/man/man3papi/papiAttributeListAddDatetime.3papi
-file path=usr/share/man/man3papi/papiAttributeListAddInteger.3papi
-file path=usr/share/man/man3papi/papiAttributeListAddMetadata.3papi
-file path=usr/share/man/man3papi/papiAttributeListAddRange.3papi
-file path=usr/share/man/man3papi/papiAttributeListAddResolution.3papi
-file path=usr/share/man/man3papi/papiAttributeListAddString.3papi
-file path=usr/share/man/man3papi/papiAttributeListDelete.3papi
-file path=usr/share/man/man3papi/papiAttributeListFind.3papi
-file path=usr/share/man/man3papi/papiAttributeListFree.3papi
-file path=usr/share/man/man3papi/papiAttributeListFromString.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetBoolean.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetCollection.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetDatetime.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetInteger.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetMetadata.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetNext.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetRange.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetResolution.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetString.3papi
-file path=usr/share/man/man3papi/papiAttributeListGetValue.3papi
-file path=usr/share/man/man3papi/papiAttributeListToString.3papi
-file path=usr/share/man/man3papi/papiJobCancel.3papi
-file path=usr/share/man/man3papi/papiJobFree.3papi
-file path=usr/share/man/man3papi/papiJobGetAttributeList.3papi
-file path=usr/share/man/man3papi/papiJobGetId.3papi
-file path=usr/share/man/man3papi/papiJobGetJobTicket.3papi
-file path=usr/share/man/man3papi/papiJobGetPrinterName.3papi
-file path=usr/share/man/man3papi/papiJobHold.3papi
-file path=usr/share/man/man3papi/papiJobListFree.3papi
-file path=usr/share/man/man3papi/papiJobModify.3papi
-file path=usr/share/man/man3papi/papiJobMove.3papi
-file path=usr/share/man/man3papi/papiJobPromote.3papi
-file path=usr/share/man/man3papi/papiJobQuery.3papi
-file path=usr/share/man/man3papi/papiJobRelease.3papi
-file path=usr/share/man/man3papi/papiJobRestart.3papi
-file path=usr/share/man/man3papi/papiJobStreamClose.3papi
-file path=usr/share/man/man3papi/papiJobStreamOpen.3papi
-file path=usr/share/man/man3papi/papiJobStreamWrite.3papi
-file path=usr/share/man/man3papi/papiJobSubmitByReference.3papi
-file path=usr/share/man/man3papi/papiJobValidate.3papi
-file path=usr/share/man/man3papi/papiLibrarySupportedCalls.3papi
-file path=usr/share/man/man3papi/papiPrinterAdd.3papi
-file path=usr/share/man/man3papi/papiPrinterDisable.3papi
-file path=usr/share/man/man3papi/papiPrinterEnable.3papi
-file path=usr/share/man/man3papi/papiPrinterFree.3papi
-file path=usr/share/man/man3papi/papiPrinterGetAttributeList.3papi
-file path=usr/share/man/man3papi/papiPrinterListFree.3papi
-file path=usr/share/man/man3papi/papiPrinterListJobs.3papi
-file path=usr/share/man/man3papi/papiPrinterModify.3papi
-file path=usr/share/man/man3papi/papiPrinterPause.3papi
-file path=usr/share/man/man3papi/papiPrinterPurgeJobs.3papi
-file path=usr/share/man/man3papi/papiPrinterQuery.3papi
-file path=usr/share/man/man3papi/papiPrinterRemove.3papi
-file path=usr/share/man/man3papi/papiPrinterResume.3papi
-file path=usr/share/man/man3papi/papiServiceDestroy.3papi
-file path=usr/share/man/man3papi/papiServiceGetAppData.3papi
-file path=usr/share/man/man3papi/papiServiceGetAttributeList.3papi
-file path=usr/share/man/man3papi/papiServiceGetEncryption.3papi
-file path=usr/share/man/man3papi/papiServiceGetPassword.3papi
-file path=usr/share/man/man3papi/papiServiceGetServiceName.3papi
-file path=usr/share/man/man3papi/papiServiceGetStatusMessage.3papi
-file path=usr/share/man/man3papi/papiServiceGetUserName.3papi
-file path=usr/share/man/man3papi/papiServiceSetAppData.3papi
-file path=usr/share/man/man3papi/papiServiceSetAuthCB.3papi
-file path=usr/share/man/man3papi/papiServiceSetEncryption.3papi
-file path=usr/share/man/man3papi/papiServiceSetPassword.3papi
-file path=usr/share/man/man3papi/papiServiceSetUserName.3papi
-file path=usr/share/man/man4/mod_ipp.4
-legacy pkg=SUNWpsm-ipp \
- desc="Client side support for communicating with IPP based print servers" \
- name="FSG Open Printing API IPP Print Service Module" \
- version=11.11.0,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
-license usr/src/lib/print/libhttp-core/common/LICENSE.txt \
- license=usr/src/lib/print/libhttp-core/common/LICENSE.txt
-link path=usr/lib/print/libhttp-core.so target=./libhttp-core.so.1
-link path=usr/lib/print/psm-http.so target=./psm-ipp.so
-link path=usr/lib/print/psm-ipp.so target=./psm-ipp.so.1
diff --git a/usr/src/pkg/manifests/library-print-open-printing-lpd.mf b/usr/src/pkg/manifests/library-print-open-printing-lpd.mf
deleted file mode 100644
index ea8ade1ebb..0000000000
--- a/usr/src/pkg/manifests/library-print-open-printing-lpd.mf
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/library/print/open-printing/lpd@$(PKGVERS)
-set name=pkg.description \
- value="Client side support for communicating with RFC-1179 based print servers"
-set name=pkg.summary \
- value="FSG Open Printing API RFC-1179 Print Service Module"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=usr group=sys
-dir path=usr/lib
-dir path=usr/lib/print group=lp
-file path=usr/lib/print/lpd-port mode=4511
-file path=usr/lib/print/psm-lpd.so.1
-legacy pkg=SUNWpsm-lpd \
- desc="Client side support for communicating with RFC-1179 based print servers" \
- name="FSG Open Printing API RFC-1179 Print Service Module" \
- version=11.11.0,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
-link path=usr/lib/print/psm-lpd.so target=./psm-lpd.so.1
-link path=usr/lib/print/psm-rfc-1179.so target=./psm-lpd.so
diff --git a/usr/src/pkg/manifests/library-print-open-printing.mf b/usr/src/pkg/manifests/library-print-open-printing.mf
deleted file mode 100644
index cd5519a2a9..0000000000
--- a/usr/src/pkg/manifests/library-print-open-printing.mf
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/library/print/open-printing@$(PKGVERS)
-set name=pkg.description \
- value="Free Standards Group Open Printing API, Draft v0.9"
-set name=pkg.summary value="Free Standards Group Open Printing API"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=usr group=sys
-dir path=usr/include
-dir path=usr/lib
-dir path=usr/share/man
-dir path=usr/share/man/man3lib
-dir path=usr/share/man/man3papi
-file path=usr/include/papi.h
-file path=usr/lib/libpapi-common.so.0
-file path=usr/lib/libpapi.so.0
-file path=usr/share/man/man3lib/libpapi.3lib
-file path=usr/share/man/man3papi/papiAttributeListAddValue.3papi
-file path=usr/share/man/man3papi/papiJobSubmit.3papi
-file path=usr/share/man/man3papi/papiLibrarySupportedCall.3papi
-file path=usr/share/man/man3papi/papiPrintersList.3papi
-file path=usr/share/man/man3papi/papiServiceCreate.3papi
-file path=usr/share/man/man3papi/papiStatusString.3papi
-legacy pkg=SUNWpapi desc="Free Standards Group Open Printing API, Draft v0.9" \
- name="Free Standards Group Open Printing API" \
- version=11.11.0,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
-link path=usr/lib/libpapi-common.so target=./libpapi-common.so.0
-link path=usr/lib/libpapi.so target=./libpapi.so.0
diff --git a/usr/src/pkg/manifests/print-lp-compatibility-sunos4.mf b/usr/src/pkg/manifests/print-lp-compatibility-sunos4.mf
deleted file mode 100644
index 0608a1589b..0000000000
--- a/usr/src/pkg/manifests/print-lp-compatibility-sunos4.mf
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/print/lp/compatibility/sunos4@$(PKGVERS)
-set name=pkg.description \
- value="print utilities for user interface and source build compatibility with SunOS 4.x"
-set name=pkg.summary value="Solaris Print - Source Compatibility"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=usr group=sys
-dir path=usr/ucb
-legacy pkg=SUNWscplp \
- desc="print utilities for user interface and source build compatibility with SunOS 4.x" \
- name="Solaris Print - Source Compatibility, (Usr)" \
- version=13.1,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
-license usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE \
- license=usr/src/cmd/lp/cmd/lptest/THIRDPARTYLICENSE
-link path=usr/ucb/lpc target=../bin/lpc
-link path=usr/ucb/lpq target=../bin/lpq
-link path=usr/ucb/lpr target=../bin/lpr
-link path=usr/ucb/lprm target=../bin/lprm
-link path=usr/ucb/lptest target=../bin/lptest
diff --git a/usr/src/pkg/manifests/print-lp-filter-postscript-lp-filter.mf b/usr/src/pkg/manifests/print-lp-filter-postscript-lp-filter.mf
deleted file mode 100644
index 4892b5524e..0000000000
--- a/usr/src/pkg/manifests/print-lp-filter-postscript-lp-filter.mf
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/print/lp/filter/postscript-lp-filter@$(PKGVERS)
-set name=pkg.description \
- value="client configuration files and utilities for the print service"
-set name=pkg.summary value="PostScript filters -"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=usr group=sys
-dir path=usr/lib
-dir path=usr/lib/lp group=lp
-dir path=usr/lib/lp/postscript group=lp
-dir path=usr/share/man/man1
-file path=usr/lib/lp/postscript/aps.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/banner.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/baseline.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/color.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/download group=lp mode=0555
-file path=usr/lib/lp/postscript/dpost group=lp mode=0555
-file path=usr/lib/lp/postscript/dpost.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/draw.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/fatcourier.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/forms.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/postcomm group=lp mode=0555
-file path=usr/lib/lp/postscript/postio group=lp mode=0555
-file path=usr/lib/lp/postscript/postprint group=lp mode=0555
-file path=usr/lib/lp/postscript/postprint.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/postreverse group=lp mode=0555
-file path=usr/lib/lp/postscript/ps.requests group=lp mode=0555
-file path=usr/share/man/man1/download.1
-file path=usr/share/man/man1/dpost.1
-file path=usr/share/man/man1/postio.1
-file path=usr/share/man/man1/postprint.1
-file path=usr/share/man/man1/postreverse.1
-legacy pkg=SUNWpsf \
- desc="client configuration files and utilities for the print service" \
- name="PostScript filters - (Usr)" version=13.1,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
diff --git a/usr/src/pkg/manifests/print-lp-ipp-ipp-listener.mf b/usr/src/pkg/manifests/print-lp-ipp-ipp-listener.mf
deleted file mode 100644
index fe8c53ad36..0000000000
--- a/usr/src/pkg/manifests/print-lp-ipp-ipp-listener.mf
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/print/lp/ipp/ipp-listener@$(PKGVERS)
-set name=pkg.description \
- value="Internet Printing Protocol(IPP) Apache module for listening service"
-set name=pkg.summary value="Internet Printing Protocol(IPP) listener module"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=etc group=sys
-dir path=etc/apache
-dir path=lib
-dir path=lib/svc
-dir path=lib/svc/manifest group=sys
-dir path=lib/svc/manifest/application group=sys
-dir path=lib/svc/manifest/application/print group=sys
-dir path=usr group=sys
-dir path=usr/apache
-dir path=usr/apache/libexec
-dir path=var group=sys
-dir path=var/lp group=lp mode=0775 owner=lp
-dir path=var/lp/ipp-listener
-file path=etc/apache/httpd-standalone-ipp.conf \
- original_name=SUNWippl:etc/apache/httpd-standalone-ipp.conf preserve=true
-file path=lib/svc/manifest/application/print/ipp-listener.xml group=sys \
- mode=0444
-file path=usr/apache/libexec/mod_ipp.so mode=0555
-file path=var/lp/ipp-listener/index.html mode=0444
-legacy pkg=SUNWipplr \
- desc="Internet Printing Protocol(IPP) Apache configuration for service module" \
- name="Internet Printing Protocol(IPP) listener, (root)" \
- version=13.1,REV=2009.11.11
-legacy pkg=SUNWipplu \
- desc="Internet Printing Protocol(IPP) Apache module for listening service" \
- name="Internet Printing Protocol(IPP) listener module (/usr)" \
- version=13.1,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
diff --git a/usr/src/pkg/manifests/print-lp-ipp-libipp.mf b/usr/src/pkg/manifests/print-lp-ipp-libipp.mf
deleted file mode 100644
index 1de66b84cd..0000000000
--- a/usr/src/pkg/manifests/print-lp-ipp-libipp.mf
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/print/lp/ipp/libipp@$(PKGVERS)
-set name=pkg.description \
- value="Internet Print Protocol (IPP) encoding/decoding/operation support"
-set name=pkg.summary value="Internet Printing Protocol(IPP) core libraries"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=usr group=sys
-dir path=usr/lib
-file path=usr/lib/libipp-core.so.0
-file path=usr/lib/libipp-listener.so.0
-legacy pkg=SUNWippcore \
- desc="Internet Print Protocol (IPP) encoding/decoding/operation support" \
- name="Internet Printing Protocol(IPP) core libraries, (usr)" \
- version=13.1,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
-link path=usr/lib/libipp-core.so target=./libipp-core.so.0
-link path=usr/lib/libipp-listener.so target=./libipp-listener.so.0
diff --git a/usr/src/pkg/manifests/print-lp-print-client-commands.mf b/usr/src/pkg/manifests/print-lp-print-client-commands.mf
deleted file mode 100644
index 49bdf0520d..0000000000
--- a/usr/src/pkg/manifests/print-lp-print-client-commands.mf
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/print/lp/print-client-commands@$(PKGVERS)
-set name=pkg.description \
- value="client configuration files and utilities for the print service"
-set name=pkg.summary value="Solaris Print - Client"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=usr group=sys
-dir path=usr/bin
-dir path=usr/lib
-dir path=usr/lib/lp group=lp
-dir path=usr/lib/lp/bin group=lp
-dir path=usr/sbin
-dir path=usr/share
-dir path=usr/share/applications group=other
-dir path=usr/share/gnome group=other
-dir path=usr/share/gnome/autostart
-dir path=usr/share/man/man1
-dir path=usr/share/man/man1m
-file path=usr/bin/desktop-print-management-applet mode=0555
-file path=usr/lib/lp/bin/desktop-print-management mode=0555
-file path=usr/lib/lp/bin/desktop-print-management-applet mode=0555
-file path=usr/lib/lp/bin/desktop-print-management-prefs mode=0555
-file path=usr/sbin/print-service mode=0555
-file path=usr/share/applications/desktop-print-management-prefs.desktop
-file path=usr/share/applications/desktop-print-management.desktop
-file path=usr/share/gnome/autostart/desktop-print-management-applet.desktop
-file path=usr/share/man/man1/cancel.1
-file path=usr/share/man/man1/disable.1
-file path=usr/share/man/man1/enable.1
-file path=usr/share/man/man1/lp.1
-file path=usr/share/man/man1/lpstat.1
-file path=usr/share/man/man1m/accept.1m
-file path=usr/share/man/man1m/lpadmin.1m
-file path=usr/share/man/man1m/lpmove.1m
-file path=usr/share/man/man1m/print-service.1m
-file path=usr/share/man/man1m/reject.1m
-legacy pkg=SUNWpcu \
- desc="client configuration files and utilities for the print service" \
- name="Solaris Print - Client, (usr)" version=13.1,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
-link path=usr/bin/cancel target=../sbin/print-service
-link path=usr/bin/desktop-print-management target=../sbin/print-service
-link path=usr/bin/desktop-print-management-prefs target=../sbin/print-service
-link path=usr/bin/disable target=../sbin/print-service
-link path=usr/bin/enable target=../sbin/print-service
-link path=usr/bin/lp target=../sbin/print-service
-link path=usr/bin/lpc target=../sbin/print-service
-link path=usr/bin/lpq target=../sbin/print-service
-link path=usr/bin/lpr target=../sbin/print-service
-link path=usr/bin/lprm target=../sbin/print-service
-link path=usr/bin/lpstat target=../sbin/print-service
-link path=usr/sbin/accept target=./print-service
-link path=usr/sbin/lpadmin target=./print-service
-link path=usr/sbin/lpmove target=./print-service
-link path=usr/sbin/reject target=./print-service
-depend fmri=runtime/perl-510 type=require
diff --git a/usr/src/pkg/manifests/print-lp-print-manager-legacy.mf b/usr/src/pkg/manifests/print-lp-print-manager-legacy.mf
deleted file mode 100644
index 864255aedc..0000000000
--- a/usr/src/pkg/manifests/print-lp-print-manager-legacy.mf
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/print/lp/print-manager/legacy@$(PKGVERS)
-set name=pkg.description \
- value="Graphical tool for managing printers under Solaris."
-set name=pkg.summary value="Solaris Print Manager"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=lib
-dir path=lib/svc
-dir path=lib/svc/manifest group=sys
-dir path=lib/svc/manifest/application group=sys
-dir path=lib/svc/manifest/application/print group=sys
-dir path=lib/svc/method
-dir path=usr group=sys
-dir path=usr/lib
-dir path=usr/lib/lp group=lp
-dir path=usr/lib/lp/bin group=lp
-dir path=usr/sadm
-dir path=usr/sadm/admin
-dir path=usr/sadm/admin/bin
-dir path=usr/sadm/admin/printmgr
-dir path=usr/sadm/admin/printmgr/classes
-dir path=usr/sadm/admin/printmgr/lib
-dir path=usr/sbin
-dir path=usr/share/man/man1m
-dir path=var group=sys
-dir path=var/lp group=lp mode=0775 owner=lp
-dir path=var/lp/ppd group=lp
-dir path=var/lp/ppd/caches group=lp
-file path=lib/svc/manifest/application/print/ppd-cache-update.xml group=sys \
- mode=0444
-file path=lib/svc/method/ppd-cache-update mode=0555
-file path=usr/lib/lp/bin/getmakes group=lp mode=0555
-file path=usr/lib/lp/bin/getmodels group=lp mode=0555
-file path=usr/lib/lp/bin/getppdfile group=lp mode=0555
-file path=usr/lib/lp/bin/getppds group=lp mode=0555
-file path=usr/lib/lp/bin/ppdfilename2mmp group=lp mode=0555
-file path=usr/lib/lp/bin/printer-info group=lp mode=0555
-file path=usr/sadm/admin/bin/printmgr group=lp mode=0555
-file path=usr/sadm/admin/printmgr/classes/pmclient.jar group=lp
-file path=usr/sadm/admin/printmgr/classes/pmserver.jar group=lp
-file path=usr/sadm/admin/printmgr/lib/libpmgr.so.1 group=lp
-file path=usr/sbin/ppdmgr group=lp mode=0555
-file path=usr/share/man/man1m/ppdmgr.1m
-file path=usr/share/man/man1m/printmgr.1m
-file path=var/lp/ppd/manufaliases group=lp mode=0444
-legacy pkg=SUNWppm desc="Graphical tool for managing printers under Solaris." \
- name="Solaris Print Manager"
-legacy pkg=SUNWppmr desc="Graphical tool for managing printers under Solaris." \
- name="Solaris Print Manager (Root)"
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
-link path=usr/sadm/admin/printmgr/lib/libpmgr.so target=./libpmgr.so.1
-link path=usr/sbin/printmgr target=../../usr/sadm/admin/bin/printmgr
diff --git a/usr/src/pkg/manifests/print-lp.mf b/usr/src/pkg/manifests/print-lp.mf
deleted file mode 100644
index a8088194a7..0000000000
--- a/usr/src/pkg/manifests/print-lp.mf
+++ /dev/null
@@ -1,171 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
-#
-
-set name=pkg.fmri value=pkg:/print/lp@$(PKGVERS)
-set name=pkg.description \
- value="client configuration files and utilities for the print service"
-set name=pkg.summary value="Solaris Print - LP Server"
-set name=info.classification \
- value=org.opensolaris.category.2008:System/Printing
-set name=variant.arch value=$(ARCH)
-dir path=etc group=sys
-dir path=etc/lp group=lp mode=0775 owner=lp
-dir path=etc/lp/classes group=lp mode=0775 owner=lp
-dir path=etc/lp/fd group=lp
-dir path=etc/lp/forms group=lp mode=0775 owner=lp
-dir path=etc/lp/interfaces group=lp mode=0775 owner=lp
-dir path=etc/lp/ppd group=lp mode=0775 owner=lp
-dir path=etc/lp/printers group=lp mode=0775 owner=lp
-dir path=etc/lp/pwheels group=lp mode=0775 owner=lp
-dir path=lib
-dir path=lib/svc
-dir path=lib/svc/manifest group=sys
-dir path=lib/svc/manifest/application group=sys
-dir path=lib/svc/manifest/application/print group=sys
-dir path=lib/svc/method
-dir path=usr group=sys
-dir path=usr/bin
-dir path=usr/lib
-dir path=usr/lib/lp group=lp
-dir path=usr/lib/lp/bin group=lp
-dir path=usr/lib/lp/local group=lp
-dir path=usr/lib/lp/model group=lp
-dir path=usr/lib/print group=lp
-dir path=usr/sbin
-dir path=usr/share
-dir path=usr/share/man
-dir path=usr/share/man/man1m
-dir path=usr/share/man/man4
-dir path=var group=sys
-dir path=var/lp group=lp mode=0775 owner=lp
-dir path=var/lp/logs group=lp mode=0775 owner=lp
-dir path=var/spool
-dir path=var/spool/cron group=sys
-dir path=var/spool/cron/crontabs group=sys
-dir path=var/spool/lp group=lp mode=0775 owner=lp
-dir path=var/spool/lp/admins group=lp mode=0775 owner=lp
-dir path=var/spool/lp/requests group=lp mode=0775 owner=lp
-dir path=var/spool/lp/system group=lp mode=0775 owner=lp
-dir path=var/spool/print group=lp
-file path=etc/lp/fd/catv.fd group=lp
-file path=etc/lp/fd/download.fd group=lp
-file path=etc/lp/fd/dpost.fd group=lp
-file path=etc/lp/fd/postio.fd group=lp
-file path=etc/lp/fd/postior.fd group=lp
-file path=etc/lp/fd/postpages.fd group=lp
-file path=etc/lp/fd/postprint.fd group=lp
-file path=etc/lp/fd/postreverse.fd group=lp
-file path=etc/lp/fd/pr.fd group=lp
-file path=etc/printers.conf group=sys original_name=SUNWpc:etc/printers.conf \
- preserve=true
-file path=lib/svc/manifest/application/print/rfc1179.xml group=sys mode=0444
-file path=lib/svc/manifest/application/print/server.xml group=sys mode=0444
-file path=lib/svc/method/print-svc mode=0555
-file path=usr/bin/lpget group=lp mode=0511
-file path=usr/bin/lpset group=lp mode=4511
-file path=usr/bin/lptest group=lp mode=0555
-file path=usr/lib/libprint.so.2
-file path=usr/lib/lp/bin/accept mode=0555
-file path=usr/lib/lp/bin/alert.proto group=lp mode=0444
-file path=usr/lib/lp/bin/cancel mode=0555
-file path=usr/lib/lp/bin/disable mode=0555
-file path=usr/lib/lp/bin/drain.output group=lp mode=0555
-file path=usr/lib/lp/bin/enable mode=0555
-file path=usr/lib/lp/bin/lp mode=0555
-file path=usr/lib/lp/bin/lp.cat group=lp mode=0555
-file path=usr/lib/lp/bin/lp.set group=lp mode=0555
-file path=usr/lib/lp/bin/lp.tell group=lp mode=0555
-file path=usr/lib/lp/bin/lpadmin mode=0555
-file path=usr/lib/lp/bin/lpc mode=0555
-file path=usr/lib/lp/bin/lpmove mode=0555
-file path=usr/lib/lp/bin/lpq mode=0555
-file path=usr/lib/lp/bin/lpr mode=0555
-file path=usr/lib/lp/bin/lprm mode=0555
-file path=usr/lib/lp/bin/lpstat mode=0555
-file path=usr/lib/lp/bin/netpr mode=4511
-file path=usr/lib/lp/bin/reject mode=0555
-file path=usr/lib/lp/bin/slow.filter group=lp mode=0555
-file path=usr/lib/lp/local/lpadmin group=lp mode=0555
-file path=usr/lib/lp/local/lpsched group=lp mode=0555
-file path=usr/lib/lp/local/lpshut group=lp mode=0555
-file path=usr/lib/lp/model/netstandard group=lp mode=0555
-file path=usr/lib/lp/model/standard group=lp mode=0555
-file path=usr/lib/lp/model/uri group=lp mode=0555
-file path=usr/lib/lpsched group=lp mode=0555
-file path=usr/lib/print/Makefile.yp group=lp mode=0444
-file path=usr/lib/print/conv_fix group=lp mode=0555
-file path=usr/lib/print/conv_lp group=lp mode=0555
-file path=usr/lib/print/conv_lpd group=lp mode=0555
-file path=usr/lib/print/in.lpd mode=0555
-file path=usr/lib/print/psm-lpsched.so.1 group=lp
-file path=usr/sbin/lpfilter group=lp mode=0555
-file path=usr/sbin/lpforms group=lp mode=0555
-file path=usr/sbin/lpshut group=lp mode=0555
-file path=usr/sbin/lpsystem group=lp mode=0555
-file path=usr/sbin/lpusers group=lp mode=0555
-file path=usr/share/man/man1m/conv_lp.1m
-file path=usr/share/man/man1m/conv_lpd.1m
-file path=usr/share/man/man1m/in.lpd.1m
-file path=usr/share/man/man1m/lpfilter.1m
-file path=usr/share/man/man1m/lpforms.1m
-file path=usr/share/man/man1m/lpget.1m
-file path=usr/share/man/man1m/lpsched.1m
-file path=usr/share/man/man1m/lpset.1m
-file path=usr/share/man/man1m/lpshut.1m
-file path=usr/share/man/man1m/lpsystem.1m
-file path=usr/share/man/man1m/lpusers.1m
-file path=usr/share/man/man4/printers.4
-file path=usr/share/man/man4/printers.conf.4
-file path=var/spool/cron/crontabs/lp group=root mode=0400 \
- original_name=SUNWps:var/spool/cron/crontabs/lp preserve=true
-legacy pkg=SUNWpsr \
- desc="configuration and start-up files for the print service" \
- name="Solaris Print - LP Server, (root)" version=13.1,REV=2009.11.11
-legacy pkg=SUNWpsu \
- desc="client configuration files and utilities for the print service" \
- name="Solaris Print - LP Server, (usr)" version=13.1,REV=2009.11.11
-license cr_Sun license=cr_Sun
-license lic_CDDL license=lic_CDDL
-link path=etc/lp/logs target=../../var/lp/logs
-link path=usr/lib/accept target=../sbin/accept
-link path=usr/lib/libprint.so target=./libprint.so.2
-link path=usr/lib/lpadmin target=../sbin/lpadmin
-link path=usr/lib/lpfilter target=../sbin/lpfilter
-link path=usr/lib/lpforms target=../sbin/lpforms
-link path=usr/lib/lpmove target=../sbin/lpmove
-link path=usr/lib/lpshut target=../sbin/lpshut
-link path=usr/lib/lpsystem target=../sbin/lpsystem
-link path=usr/lib/lpusers target=../sbin/lpusers
-link path=usr/lib/print/psm-lpsched.so target=./psm-lpsched.so.1
-link path=usr/lib/reject target=../sbin/reject
-link path=var/spool/lp/admins/lp target=../../../../etc/lp
-link path=var/spool/lp/bin target=../../../usr/lib/lp/bin
-link path=var/spool/lp/logs target=../../lp/logs
-link path=var/spool/lp/model target=../../../usr/lib/lp/model
-#
-# Depend on terminfo data.
-#
-depend fmri=system/data/terminfo type=require
diff --git a/usr/src/pkg/manifests/service-file-system-smb.mf b/usr/src/pkg/manifests/service-file-system-smb.mf
index 2ddf448a86..cd3a4ed1a8 100644
--- a/usr/src/pkg/manifests/service-file-system-smb.mf
+++ b/usr/src/pkg/manifests/service-file-system-smb.mf
@@ -22,6 +22,7 @@
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
#
set name=pkg.fmri value=pkg:/service/file-system/smb@$(PKGVERS)
diff --git a/usr/src/pkg/manifests/system-dtrace-tests.mf b/usr/src/pkg/manifests/system-dtrace-tests.mf
index d1e0317ee6..97a35330ef 100644
--- a/usr/src/pkg/manifests/system-dtrace-tests.mf
+++ b/usr/src/pkg/manifests/system-dtrace-tests.mf
@@ -2009,7 +2009,10 @@ file path=opt/SUNWdtrt/tst/common/usdt/tst.linkpriv.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.linkunpriv.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.multiple.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.multiple.ksh.out mode=0444
+file path=opt/SUNWdtrt/tst/common/usdt/tst.multiprov.ksh mode=0444
+file path=opt/SUNWdtrt/tst/common/usdt/tst.multiprov.ksh.out mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.nodtrace.ksh mode=0444
+file path=opt/SUNWdtrt/tst/common/usdt/tst.noprobes.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.noreap.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.noreapring.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.onlyenabled.ksh mode=0444
diff --git a/usr/src/pkg/manifests/system-trusted.mf b/usr/src/pkg/manifests/system-trusted.mf
index a3dbebe5ae..cea17dd482 100644
--- a/usr/src/pkg/manifests/system-trusted.mf
+++ b/usr/src/pkg/manifests/system-trusted.mf
@@ -51,10 +51,6 @@ dir path=usr/lib/help/auths/locale/C
dir path=usr/lib/help/profiles
dir path=usr/lib/help/profiles/locale
dir path=usr/lib/help/profiles/locale/C
-dir path=usr/lib/lp group=lp
-dir path=usr/lib/lp/bin group=lp
-dir path=usr/lib/lp/model group=lp
-dir path=usr/lib/lp/postscript group=lp
dir path=usr/lib/zones
dir path=usr/sbin
dir path=usr/share/man
@@ -102,16 +98,6 @@ file path=usr/lib/help/profiles/locale/C/RtInfoSec.html
file path=usr/lib/help/profiles/locale/C/RtObjectLabelMngmnt.html
file path=usr/lib/help/profiles/locale/C/RtOutsideAccred.html
file path=usr/lib/labeld mode=0555
-file path=usr/lib/lp/bin/lp.tsol_separator group=lp mode=0555
-file path=usr/lib/lp/model/tsol_netstandard group=lp mode=0555
-file path=usr/lib/lp/model/tsol_netstandard_foomatic group=lp mode=0555
-file path=usr/lib/lp/model/tsol_standard group=lp mode=0555
-file path=usr/lib/lp/model/tsol_standard_foomatic group=lp mode=0555
-file path=usr/lib/lp/postscript/tsol_banner.ps group=lp mode=0555
-file path=usr/lib/lp/postscript/tsol_separator.ps group=lp mode=0555 \
- original_name=SUNWts:usr/lib/lp/postscript/tsol_separator.ps \
- preserve=renamenew
-file path=usr/lib/lp/postscript/tsol_trailer.ps group=lp mode=0555
file path=usr/lib/lslabels group=sys mode=0555
file path=usr/lib/zones/zoneshare group=sys mode=0555
file path=usr/lib/zones/zoneunshare group=sys mode=0555
diff --git a/usr/src/pkg/manifests/system-zones-brand-joyent.mf b/usr/src/pkg/manifests/system-zones-brand-joyent.mf
new file mode 100644
index 0000000000..33452cdcd7
--- /dev/null
+++ b/usr/src/pkg/manifests/system-zones-brand-joyent.mf
@@ -0,0 +1,54 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2010 Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+set name=pkg.fmri value=pkg:/system/zones/brand/joyent@$(PKGVERS)
+set name=pkg.description value="Support for the 'joyent' Brand"
+set name=pkg.summary value="Joyent Containers: joyent brand support"
+set name=info.classification \
+ value=org.opensolaris.category.2008:System/Virtualization
+set name=variant.arch value=$(ARCH)
+dir path=etc group=sys
+dir path=etc/zones group=sys
+dir path=lib variant.opensolaris.zone=global
+dir path=lib/svc variant.opensolaris.zone=global
+dir path=lib/svc/manifest group=sys variant.opensolaris.zone=global
+dir path=lib/svc/manifest/system group=sys variant.opensolaris.zone=global
+dir path=lib/svc/method variant.opensolaris.zone=global
+dir path=usr group=sys
+dir path=usr/lib
+dir path=usr/lib/brand
+dir path=usr/lib/brand/joyent group=sys
+file path=etc/zones/Joyent.xml mode=0444
+file path=lib/svc/manifest/system/joyinit.xml group=sys mode=0444 \
+ variant.opensolaris.zone=global
+file path=lib/svc/method/svc-joyinit mode=0555 variant.opensolaris.zone=global
+file path=usr/lib/brand/joyent/config.xml mode=0444
+file path=usr/lib/brand/joyent/jinstall mode=0755
+file path=usr/lib/brand/joyent/juninstall mode=0755
+file path=usr/lib/brand/joyent/pinstall mode=0755
+file path=usr/lib/brand/joyent/platform.xml mode=0444
+file path=usr/lib/brand/joyent/prestate mode=0755
+license lic_CDDL license=lic_CDDL
diff --git a/usr/src/pkg/manifests/text-doctools.mf b/usr/src/pkg/manifests/text-doctools.mf
index 3f5678e235..450b1d17f0 100644
--- a/usr/src/pkg/manifests/text-doctools.mf
+++ b/usr/src/pkg/manifests/text-doctools.mf
@@ -68,168 +68,6 @@ file path=usr/bin/tbl mode=0555
file path=usr/bin/troff mode=0555
file path=usr/bin/ul mode=0555
file path=usr/bin/vgrind mode=0555
-file path=usr/lib/font/devpost/AB group=lp mode=0444
-file path=usr/lib/font/devpost/AB.name group=lp mode=0444
-file path=usr/lib/font/devpost/AB.out group=lp mode=0444
-file path=usr/lib/font/devpost/AI group=lp mode=0444
-file path=usr/lib/font/devpost/AI.name group=lp mode=0444
-file path=usr/lib/font/devpost/AI.out group=lp mode=0444
-file path=usr/lib/font/devpost/AR group=lp mode=0444
-file path=usr/lib/font/devpost/AR.name group=lp mode=0444
-file path=usr/lib/font/devpost/AR.out group=lp mode=0444
-file path=usr/lib/font/devpost/AX group=lp mode=0444
-file path=usr/lib/font/devpost/AX.name group=lp mode=0444
-file path=usr/lib/font/devpost/AX.out group=lp mode=0444
-file path=usr/lib/font/devpost/B group=lp mode=0444
-file path=usr/lib/font/devpost/B.name group=lp mode=0444
-file path=usr/lib/font/devpost/B.out group=lp mode=0444
-file path=usr/lib/font/devpost/BI group=lp mode=0444
-file path=usr/lib/font/devpost/BI.name group=lp mode=0444
-file path=usr/lib/font/devpost/BI.out group=lp mode=0444
-file path=usr/lib/font/devpost/CB group=lp mode=0444
-file path=usr/lib/font/devpost/CB.name group=lp mode=0444
-file path=usr/lib/font/devpost/CB.out group=lp mode=0444
-file path=usr/lib/font/devpost/CI group=lp mode=0444
-file path=usr/lib/font/devpost/CI.name group=lp mode=0444
-file path=usr/lib/font/devpost/CI.out group=lp mode=0444
-file path=usr/lib/font/devpost/CO group=lp mode=0444
-file path=usr/lib/font/devpost/CO.name group=lp mode=0444
-file path=usr/lib/font/devpost/CO.out group=lp mode=0444
-file path=usr/lib/font/devpost/CW group=lp mode=0444
-file path=usr/lib/font/devpost/CW.name group=lp mode=0444
-file path=usr/lib/font/devpost/CW.out group=lp mode=0444
-file path=usr/lib/font/devpost/CX group=lp mode=0444
-file path=usr/lib/font/devpost/CX.name group=lp mode=0444
-file path=usr/lib/font/devpost/CX.out group=lp mode=0444
-file path=usr/lib/font/devpost/DESC group=lp mode=0444
-file path=usr/lib/font/devpost/DESC.out group=lp mode=0444
-file path=usr/lib/font/devpost/G.out group=lp mode=0444
-file path=usr/lib/font/devpost/GI.out group=lp mode=0444
-file path=usr/lib/font/devpost/GR group=lp mode=0444
-file path=usr/lib/font/devpost/GR.name group=lp mode=0444
-file path=usr/lib/font/devpost/GR.out group=lp mode=0444
-file path=usr/lib/font/devpost/H group=lp mode=0444
-file path=usr/lib/font/devpost/H.name group=lp mode=0444
-file path=usr/lib/font/devpost/H.out group=lp mode=0444
-file path=usr/lib/font/devpost/HB group=lp mode=0444
-file path=usr/lib/font/devpost/HB.name group=lp mode=0444
-file path=usr/lib/font/devpost/HB.out group=lp mode=0444
-file path=usr/lib/font/devpost/HI group=lp mode=0444
-file path=usr/lib/font/devpost/HI.name group=lp mode=0444
-file path=usr/lib/font/devpost/HI.out group=lp mode=0444
-file path=usr/lib/font/devpost/HK.out group=lp mode=0444
-file path=usr/lib/font/devpost/HL.out group=lp mode=0444
-file path=usr/lib/font/devpost/HM.out group=lp mode=0444
-file path=usr/lib/font/devpost/HX group=lp mode=0444
-file path=usr/lib/font/devpost/HX.name group=lp mode=0444
-file path=usr/lib/font/devpost/HX.out group=lp mode=0444
-file path=usr/lib/font/devpost/Hb group=lp mode=0444
-file path=usr/lib/font/devpost/Hb.name group=lp mode=0444
-file path=usr/lib/font/devpost/Hb.out group=lp mode=0444
-file path=usr/lib/font/devpost/Hi group=lp mode=0444
-file path=usr/lib/font/devpost/Hi.name group=lp mode=0444
-file path=usr/lib/font/devpost/Hi.out group=lp mode=0444
-file path=usr/lib/font/devpost/Hr group=lp mode=0444
-file path=usr/lib/font/devpost/Hr.name group=lp mode=0444
-file path=usr/lib/font/devpost/Hr.out group=lp mode=0444
-file path=usr/lib/font/devpost/Hx group=lp mode=0444
-file path=usr/lib/font/devpost/Hx.name group=lp mode=0444
-file path=usr/lib/font/devpost/Hx.out group=lp mode=0444
-file path=usr/lib/font/devpost/I group=lp mode=0444
-file path=usr/lib/font/devpost/I.name group=lp mode=0444
-file path=usr/lib/font/devpost/I.out group=lp mode=0444
-file path=usr/lib/font/devpost/KB group=lp mode=0444
-file path=usr/lib/font/devpost/KB.name group=lp mode=0444
-file path=usr/lib/font/devpost/KB.out group=lp mode=0444
-file path=usr/lib/font/devpost/KI group=lp mode=0444
-file path=usr/lib/font/devpost/KI.name group=lp mode=0444
-file path=usr/lib/font/devpost/KI.out group=lp mode=0444
-file path=usr/lib/font/devpost/KR group=lp mode=0444
-file path=usr/lib/font/devpost/KR.name group=lp mode=0444
-file path=usr/lib/font/devpost/KR.out group=lp mode=0444
-file path=usr/lib/font/devpost/KX group=lp mode=0444
-file path=usr/lib/font/devpost/KX.name group=lp mode=0444
-file path=usr/lib/font/devpost/KX.out group=lp mode=0444
-file path=usr/lib/font/devpost/NB group=lp mode=0444
-file path=usr/lib/font/devpost/NB.name group=lp mode=0444
-file path=usr/lib/font/devpost/NB.out group=lp mode=0444
-file path=usr/lib/font/devpost/NI group=lp mode=0444
-file path=usr/lib/font/devpost/NI.name group=lp mode=0444
-file path=usr/lib/font/devpost/NI.out group=lp mode=0444
-file path=usr/lib/font/devpost/NR group=lp mode=0444
-file path=usr/lib/font/devpost/NR.name group=lp mode=0444
-file path=usr/lib/font/devpost/NR.out group=lp mode=0444
-file path=usr/lib/font/devpost/NX group=lp mode=0444
-file path=usr/lib/font/devpost/NX.name group=lp mode=0444
-file path=usr/lib/font/devpost/NX.out group=lp mode=0444
-file path=usr/lib/font/devpost/PA group=lp mode=0444
-file path=usr/lib/font/devpost/PA.name group=lp mode=0444
-file path=usr/lib/font/devpost/PA.out group=lp mode=0444
-file path=usr/lib/font/devpost/PB group=lp mode=0444
-file path=usr/lib/font/devpost/PB.name group=lp mode=0444
-file path=usr/lib/font/devpost/PB.out group=lp mode=0444
-file path=usr/lib/font/devpost/PI group=lp mode=0444
-file path=usr/lib/font/devpost/PI.name group=lp mode=0444
-file path=usr/lib/font/devpost/PI.out group=lp mode=0444
-file path=usr/lib/font/devpost/PX group=lp mode=0444
-file path=usr/lib/font/devpost/PX.name group=lp mode=0444
-file path=usr/lib/font/devpost/PX.out group=lp mode=0444
-file path=usr/lib/font/devpost/R group=lp mode=0444
-file path=usr/lib/font/devpost/R.name group=lp mode=0444
-file path=usr/lib/font/devpost/R.out group=lp mode=0444
-file path=usr/lib/font/devpost/S group=lp mode=0444
-file path=usr/lib/font/devpost/S.name group=lp mode=0444
-file path=usr/lib/font/devpost/S.out group=lp mode=0444
-file path=usr/lib/font/devpost/S1 group=lp mode=0444
-file path=usr/lib/font/devpost/S1.name group=lp mode=0444
-file path=usr/lib/font/devpost/S1.out group=lp mode=0444
-file path=usr/lib/font/devpost/VB group=lp mode=0444
-file path=usr/lib/font/devpost/VB.name group=lp mode=0444
-file path=usr/lib/font/devpost/VB.out group=lp mode=0444
-file path=usr/lib/font/devpost/VI group=lp mode=0444
-file path=usr/lib/font/devpost/VI.name group=lp mode=0444
-file path=usr/lib/font/devpost/VI.out group=lp mode=0444
-file path=usr/lib/font/devpost/VR group=lp mode=0444
-file path=usr/lib/font/devpost/VR.name group=lp mode=0444
-file path=usr/lib/font/devpost/VR.out group=lp mode=0444
-file path=usr/lib/font/devpost/VX group=lp mode=0444
-file path=usr/lib/font/devpost/VX.name group=lp mode=0444
-file path=usr/lib/font/devpost/VX.out group=lp mode=0444
-file path=usr/lib/font/devpost/ZD group=lp mode=0444
-file path=usr/lib/font/devpost/ZD.name group=lp mode=0444
-file path=usr/lib/font/devpost/ZD.out group=lp mode=0444
-file path=usr/lib/font/devpost/ZI group=lp mode=0444
-file path=usr/lib/font/devpost/ZI.name group=lp mode=0444
-file path=usr/lib/font/devpost/ZI.out group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/12 group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/14 group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/34 group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/BRACKETS_NOTE group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/Fi group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/Fl group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/L1 group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/L1.map group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/LH group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/LH.map group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/Lb group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/Lb.map group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/OLD_LH group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/OLD_LH.map group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/README group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/Sl group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/bx group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/ci group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/ff group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/lc group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/lf group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/lh group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/ob group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/rc group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/rf group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/rh group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/sq group=lp mode=0444
-file path=usr/lib/font/devpost/charlib/~ group=lp mode=0444
-file path=usr/lib/font/makedev group=lp mode=0555
file path=usr/lib/getNAME mode=0555
file path=usr/lib/makewhatis mode=0555
file path=usr/lib/refer/hunt mode=0555
diff --git a/usr/src/psm/stand/bootblks/ufs/i386/mboot.S b/usr/src/psm/stand/bootblks/ufs/i386/mboot.S
index 48afbae207..756a643482 100644
--- a/usr/src/psm/stand/bootblks/ufs/i386/mboot.S
+++ b/usr/src/psm/stand/bootblks/ufs/i386/mboot.S
@@ -23,6 +23,7 @@
* Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved.
*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2012 OmniTI Computer Consulting, Inc. All rights reserved.
* Use is subject to license terms.
*/
diff --git a/usr/src/stand/lib/fs/hsfs/hsfsops.c b/usr/src/stand/lib/fs/hsfs/hsfsops.c
index 0119d3fe99..21f8c37081 100644
--- a/usr/src/stand/lib/fs/hsfs/hsfsops.c
+++ b/usr/src/stand/lib/fs/hsfs/hsfsops.c
@@ -1026,6 +1026,7 @@ boot_hsfs_getdents(int fd, struct dirent *dep, unsigned size)
* alignment.
*/
n = strlen(hdp->hs_ufs_dir.d_name);
+
n = roundup((sizeof (struct dirent) + ((n > SLOP) ? n : 0)),
sizeof (off_t));
diff --git a/usr/src/tools/README.tools b/usr/src/tools/README.tools
index 6cb51f028a..323d6c679c 100644
--- a/usr/src/tools/README.tools
+++ b/usr/src/tools/README.tools
@@ -192,6 +192,9 @@ findunref
sort > ~/unref-sparc.out
$ comm -12 ~/unref-i386.out ~/unref-sparc.out > ~/unref.out
+git-active
+ helper used by webrev to generate file lists for Git workspaces.
+
hdrchk
checks headers for compliance with OS/Net standards (form, includes,
C++ guards).
diff --git a/usr/src/tools/aw/aw.c b/usr/src/tools/aw/aw.c
index 88673c88e4..36891b1a9c 100644
--- a/usr/src/tools/aw/aw.c
+++ b/usr/src/tools/aw/aw.c
@@ -550,29 +550,6 @@ main(int argc, char *argv[])
newae(as, "--traditional-format");
/*
- * This is a support hack to rewrite code for the compiler
- * which should probably cause an assembler programmer to recode
- * - so, generate a warning in this case.
- *
- * -K was dropped begining with version 2.18.
- */
- {
- struct aelist *as_ver = newael();
- struct aelist *ggrep = newael();
-
- newae(as_ver, as_pgm);
- newae(as_ver, "--version");
- newae(ggrep, "/usr/bin/ggrep");
- newae(ggrep, "-q");
- newae(ggrep, "-E");
- newae(ggrep, "2.1[567]");
- code = pipeline(aeltoargv(as_ver), aeltoargv(ggrep));
- if (code == 0) {
- newae(as, "-K");
- }
- }
-
- /*
* Walk the argument list, translating as we go ..
*/
while (--argc > 0) {
diff --git a/usr/src/tools/cscope-fast/Makefile b/usr/src/tools/cscope-fast/Makefile
index 6a2270bbed..0237a6e9e9 100644
--- a/usr/src/tools/cscope-fast/Makefile
+++ b/usr/src/tools/cscope-fast/Makefile
@@ -34,6 +34,7 @@ OBJS= main.o dir.o crossref.o scanner.o lookup.o command.o display.o \
vpaccess.o vpfopen.o vpinit.o vpopen.o vpstat.o
SRCS= $(OBJS:%.o=%.c)
CLEANFILES += $(OBJS)
+CLOBBERFILES += scanner.c
TMPDIR= /tmp
include ../Makefile.tools
diff --git a/usr/src/tools/ctf/Makefile.ctf b/usr/src/tools/ctf/Makefile.ctf
index ace863e89b..7c5b041746 100644
--- a/usr/src/tools/ctf/Makefile.ctf
+++ b/usr/src/tools/ctf/Makefile.ctf
@@ -40,7 +40,8 @@ HDRDIRS= \
-I../../common \
-I$(SRC) \
-I/usr/include \
- -I$(SRC)/uts/common
+ -I$(SRC)/uts/common \
+ -I$(NATIVE_ADJUNCT)/include
CPPFLAGS += $(HDRDIRS)
CFLAGS += $(CCVERBOSE)
diff --git a/usr/src/tools/ctf/common/ctf_headers.h b/usr/src/tools/ctf/common/ctf_headers.h
index b00b8fd9a6..268ae79077 100644
--- a/usr/src/tools/ctf/common/ctf_headers.h
+++ b/usr/src/tools/ctf/common/ctf_headers.h
@@ -27,8 +27,6 @@
#ifndef _CTF_HEADERS_H
#define _CTF_HEADERS_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Because the ON tools are executed on the system where they are built,
* the tools need to include the headers installed on the build system,
@@ -69,4 +67,15 @@
#include <uts/common/sys/ctf_api.h>
#include <lib/libctf/common/libctf.h>
+/*
+ * XXX: This is hack to deal with GCC 4.x removing __builtin_stdarg_start
+ *
+ * We need to build on systems that don't have the fixed va_impl.h on the
+ * system, to achieve that, we stub it out here and in all similar places to
+ * give us a leg up.
+ */
+#if __GNUC__ >= 4
+#define __builtin_stdarg_start(list, name) __builtin_va_start(list, name)
+#endif
+
#endif /* _CTF_HEADERS_H */
diff --git a/usr/src/tools/ctf/common/utils.h b/usr/src/tools/ctf/common/utils.h
index 9b07361a53..4ae2dd0917 100644
--- a/usr/src/tools/ctf/common/utils.h
+++ b/usr/src/tools/ctf/common/utils.h
@@ -27,9 +27,8 @@
#ifndef _UTILS_H
#define _UTILS_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdarg.h>
+#include <ctf_headers.h>
#ifdef __cplusplus
extern "C" {
diff --git a/usr/src/tools/ctf/cvt/Makefile.com b/usr/src/tools/ctf/cvt/Makefile.com
index fb35379c3a..5385b3769f 100644
--- a/usr/src/tools/ctf/cvt/Makefile.com
+++ b/usr/src/tools/ctf/cvt/Makefile.com
@@ -73,6 +73,7 @@ DWARFLDFLAGS = \
-ldwarf
DWARFCPPFLAGS = -I../../dwarf/common
+LDFLAGS += -L$(NATIVE_ADJUNCT)/lib
LDLIBS += -lz -lelf
CPPFLAGS += -D_REENTRANT
CFLAGS += $(CTF_FLAGS)
diff --git a/usr/src/tools/ctf/cvt/ctftools.h b/usr/src/tools/ctf/cvt/ctftools.h
index 991f3bc921..f586236ccf 100644
--- a/usr/src/tools/ctf/cvt/ctftools.h
+++ b/usr/src/tools/ctf/cvt/ctftools.h
@@ -26,8 +26,6 @@
#ifndef _CTFTOOLS_H
#define _CTFTOOLS_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Functions and data structures used in the manipulation of stabs and CTF data
*/
@@ -43,6 +41,17 @@
extern "C" {
#endif
+/*
+ * XXX: This is hack to deal with GCC 4.x removing __builtin_stdarg_start
+ *
+ * We need to build on systems that don't have the fixed va_impl.h on the
+ * system, to achieve that, we stub it out here and in all similar places to
+ * give us a leg up.
+ */
+#if __GNUC__ >= 4
+#define __builtin_stdarg_start(list, name) __builtin_va_start(list, name)
+#endif
+
#include "list.h"
#include "hash.h"
diff --git a/usr/src/tools/ctf/dump/Makefile.com b/usr/src/tools/ctf/dump/Makefile.com
index ca3e925d01..9877fa06a3 100644
--- a/usr/src/tools/ctf/dump/Makefile.com
+++ b/usr/src/tools/ctf/dump/Makefile.com
@@ -31,6 +31,7 @@ SRCS = dump.c utils.c symbol.c
include ../../Makefile.ctf
+LDFLAGS += -L$(NATIVE_ADJUNCT)/lib
LDLIBS += -lelf -lz
OBJS = $(SRCS:%.c=%.o)
diff --git a/usr/src/cmd/print/scripts/lpsystem b/usr/src/tools/findunref/exception_list.git
index fdf08de324..d14dbd22f0 100644
--- a/usr/src/cmd/print/scripts/lpsystem
+++ b/usr/src/tools/findunref/exception_list.git
@@ -1,4 +1,3 @@
-#!/bin/sh
#
# CDDL HEADER START
#
@@ -21,13 +20,20 @@
#
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Cyril Plisko. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
+
+#
+# Git-specific exception list
+#
+# See README.exception_lists for details
#
-# This interface is obsolete, do nothing and always succeed for the sake
-# of any shell scripts that may still make a call to it.
#
-exit 0
+# Without nested repositories, this list could be empty, because ON
+# checks for unref relative to usr, and the git files are all in the
+# root of the repository.
+#
+
+*/.git
diff --git a/usr/src/tools/findunref/exception_list.open b/usr/src/tools/findunref/exception_list.open
index afc9b44a2f..5126a6cb88 100644
--- a/usr/src/tools/findunref/exception_list.open
+++ b/usr/src/tools/findunref/exception_list.open
@@ -278,3 +278,4 @@
# ld tests which are not currently delivered
#
./usr/src/cmd/sgs/test
+./usr/src/cmd/mdb/test
diff --git a/usr/src/tools/findunref/exception_list.unknown b/usr/src/tools/findunref/exception_list.unknown
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/usr/src/tools/findunref/exception_list.unknown
diff --git a/usr/src/tools/onbld/Checks/Cddl.py b/usr/src/tools/onbld/Checks/Cddl.py
index 1f5f99f953..0f4d995e89 100644
--- a/usr/src/tools/onbld/Checks/Cddl.py
+++ b/usr/src/tools/onbld/Checks/Cddl.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
CDDL = '''
CDDL HEADER START
diff --git a/usr/src/tools/onbld/Checks/CmtBlk.py b/usr/src/tools/onbld/Checks/CmtBlk.py
index 2f3d29fa79..ddf5caec48 100644
--- a/usr/src/tools/onbld/Checks/CmtBlk.py
+++ b/usr/src/tools/onbld/Checks/CmtBlk.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
diff --git a/usr/src/tools/onbld/Checks/Comments.py b/usr/src/tools/onbld/Checks/Comments.py
index daf6aa47d9..6304e59818 100644
--- a/usr/src/tools/onbld/Checks/Comments.py
+++ b/usr/src/tools/onbld/Checks/Comments.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/onbld/Checks/Copyright.py b/usr/src/tools/onbld/Checks/Copyright.py
index 81a80058aa..8071b7f435 100644
--- a/usr/src/tools/onbld/Checks/Copyright.py
+++ b/usr/src/tools/onbld/Checks/Copyright.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/onbld/Checks/DbLookups.py b/usr/src/tools/onbld/Checks/DbLookups.py
index 11fd4185be..15f889e8d2 100644
--- a/usr/src/tools/onbld/Checks/DbLookups.py
+++ b/usr/src/tools/onbld/Checks/DbLookups.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/onbld/Checks/HdrChk.py b/usr/src/tools/onbld/Checks/HdrChk.py
index c2697dcaf2..8f7b946d12 100644
--- a/usr/src/tools/onbld/Checks/HdrChk.py
+++ b/usr/src/tools/onbld/Checks/HdrChk.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/onbld/Checks/Keywords.py b/usr/src/tools/onbld/Checks/Keywords.py
index 5c374c3abb..ac3555be32 100644
--- a/usr/src/tools/onbld/Checks/Keywords.py
+++ b/usr/src/tools/onbld/Checks/Keywords.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
@@ -24,8 +24,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
#
# Mercurial (lack of) keyword checks
diff --git a/usr/src/tools/onbld/Checks/Mapfile.py b/usr/src/tools/onbld/Checks/Mapfile.py
index 2a8cb74aed..d4fa70d141 100644
--- a/usr/src/tools/onbld/Checks/Mapfile.py
+++ b/usr/src/tools/onbld/Checks/Mapfile.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/onbld/Checks/__init__.py b/usr/src/tools/onbld/Checks/__init__.py
index 4bb5f3e262..b7ecf0e881 100644
--- a/usr/src/tools/onbld/Checks/__init__.py
+++ b/usr/src/tools/onbld/Checks/__init__.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/onbld/Scm/Ignore.py b/usr/src/tools/onbld/Scm/Ignore.py
new file mode 100644
index 0000000000..048b46ba6f
--- /dev/null
+++ b/usr/src/tools/onbld/Scm/Ignore.py
@@ -0,0 +1,91 @@
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE
+#
+# Copyright (c) 2013, Joyent Inc. All rights reserved.
+#
+
+'''
+Process our ignore/exception_list file format.
+
+The format is broadly similar, if not identical, to .gitignore and .hgignore
+files.
+'''
+
+import re
+import fnmatch
+
+RE_SYNTAX = re.compile(r'^syntax:\s*(.*)\s*$')
+
+#
+# It is important that this module not rely on Mercurial
+#
+
+def _read_ignore_file(ignorefile):
+ '''Read an ignore file and return an array of regular expressions
+ to match ignored paths.'''
+
+ syntax = 'regex'
+ ignore_list = []
+ lc = 0
+
+ with open(ignorefile, 'r') as f:
+ for l in f:
+ lc += 1
+ # Remove comments and blank lines
+ l = l.split('#', 2)[0].strip()
+ if l == '':
+ continue
+ # Process "syntax:" lines
+ m = RE_SYNTAX.match(l)
+ if m:
+ syntax = m.group(1)
+ continue
+ # All other lines are considered patterns
+ if (syntax == 'glob'):
+ ignore_list.append(re.compile('.*' + fnmatch.translate(l)))
+ elif (syntax == 'regex'):
+ ignore_list.append(re.compile(l))
+ else:
+ raise Exception('%s:%d: syntax "%s" is not supported' %
+ (ignorefile, lc, syntax))
+
+ return ignore_list
+
+def ignore(root, ignorefiles):
+ # If we aren't provided any ignore files, we'll never ignore
+ # any paths:
+ if (len(ignorefiles) < 1):
+ return lambda x: False
+
+ ignore_list = []
+ for ignorefile in ignorefiles:
+ ignore_list.extend(_read_ignore_file(ignorefile))
+
+ # If the ignore files contained no patterns, we'll never ignore
+ # any paths:
+ if (len(ignore_list) < 1):
+ return lambda x: False
+
+ def _ignore_func(path):
+ for regex in ignore_list:
+ if (regex.match(path)):
+ return True
+ return False
+
+ return _ignore_func
diff --git a/usr/src/tools/onbld/Scm/Makefile b/usr/src/tools/onbld/Scm/Makefile
index a31f7e5c87..26a3a4ccfc 100644
--- a/usr/src/tools/onbld/Scm/Makefile
+++ b/usr/src/tools/onbld/Scm/Makefile
@@ -21,6 +21,7 @@
#
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, Joyent Inc. All rights reserved.
#
include $(SRC)/Makefile.master
@@ -29,6 +30,7 @@ include ../../Makefile.tools
PYSRCS = \
__init__.py \
Backup.py \
+ Ignore.py \
Version.py \
WorkSpace.py
diff --git a/usr/src/tools/onbld/Scm/__init__.py b/usr/src/tools/onbld/Scm/__init__.py
index f45ecbc95f..8934eb3942 100644
--- a/usr/src/tools/onbld/Scm/__init__.py
+++ b/usr/src/tools/onbld/Scm/__init__.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
@@ -24,5 +24,3 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
diff --git a/usr/src/tools/onbld/hgext/__init__.py b/usr/src/tools/onbld/hgext/__init__.py
index f45ecbc95f..8934eb3942 100644
--- a/usr/src/tools/onbld/hgext/__init__.py
+++ b/usr/src/tools/onbld/hgext/__init__.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!ON_PYTHON
#
# CDDL HEADER START
#
@@ -24,5 +24,3 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
diff --git a/usr/src/tools/onbld/hgext/cdm.py b/usr/src/tools/onbld/hgext/cdm.py
index 0ce41d4dad..a04317fff9 100644
--- a/usr/src/tools/onbld/hgext/cdm.py
+++ b/usr/src/tools/onbld/hgext/cdm.py
@@ -16,6 +16,7 @@
#
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2008, 2011 Richard Lowe
+# Copyright (c) 2013, Joyent Inc. All rights reserved.
#
'''OpenSolaris extensions to Mercurial
@@ -92,6 +93,7 @@ sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "..", "..",
sys.path.insert(2, os.path.join(os.path.dirname(__file__), "..", ".."))
from onbld.Scm import Version
+from onbld.Scm import Ignore
from mercurial import util
try:
@@ -99,7 +101,7 @@ try:
except Version.VersionMismatch, badversion:
raise util.Abort("Version Mismatch:\n %s\n" % badversion)
-from mercurial import cmdutil, ignore, node, patch
+from mercurial import cmdutil, node, patch
from onbld.Scm.WorkSpace import WorkSpace, WorkList
from onbld.Scm.Backup import CdmBackup
@@ -167,7 +169,7 @@ def not_check(repo, cmd):
ignorefiles.append(f)
if ignorefiles:
- ign = ignore.ignore(repo.root, ignorefiles, repo.ui.warn)
+ ign = Ignore.ignore(repo.root, ignorefiles)
return canonified_check(ign)
else:
return util.never
diff --git a/usr/src/tools/scripts/bldenv.sh b/usr/src/tools/scripts/bldenv.sh
index 4720b7925e..86ed08d932 100644
--- a/usr/src/tools/scripts/bldenv.sh
+++ b/usr/src/tools/scripts/bldenv.sh
@@ -345,6 +345,10 @@ if [[ "${SUNWSPRO}" != "" ]]; then
export PATH="${SUNWSPRO}/bin:$PATH"
fi
+if [[ -n "${MAKE}" ]]; then
+ export PATH="$(dirname ${MAKE}):$PATH"
+fi
+
if [[ -z "$CLOSED_IS_PRESENT" ]]; then
if [[ -d $SRC/../closed ]]; then
export CLOSED_IS_PRESENT="yes"
diff --git a/usr/src/tools/scripts/cddlchk.py b/usr/src/tools/scripts/cddlchk.py
index 816d2f33a7..ad6a6e6f56 100644
--- a/usr/src/tools/scripts/cddlchk.py
+++ b/usr/src/tools/scripts/cddlchk.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!ON_PYTHON_26
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/scripts/copyrightchk.py b/usr/src/tools/scripts/copyrightchk.py
index 210ef1b46c..f778947bfc 100644
--- a/usr/src/tools/scripts/copyrightchk.py
+++ b/usr/src/tools/scripts/copyrightchk.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!ON_PYTHON_26
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/scripts/git-pbchk.py b/usr/src/tools/scripts/git-pbchk.py
index 656e22f6b4..82a63df70a 100644
--- a/usr/src/tools/scripts/git-pbchk.py
+++ b/usr/src/tools/scripts/git-pbchk.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!ON_PYTHON_26
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
@@ -17,6 +17,7 @@
#
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2008, 2012 Richard Lowe
+# Copyright (c) 2013, Joyent Inc. All rights reserved.
#
import getopt
@@ -28,10 +29,6 @@ import tempfile
from cStringIO import StringIO
-# This is necessary because, in a fit of pique, we used hg-format ignore lists
-# for NOT files.
-from mercurial import ignore
-
#
# Adjust the load path based on our location and the version of python into
# which it is being loaded. This assumes the normal onbld directory
@@ -47,6 +44,7 @@ sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "lib",
#
sys.path.insert(2, os.path.join(os.path.dirname(__file__), ".."))
+from onbld.Scm import Ignore
from onbld.Checks import Comments, Copyright, CStyle, HdrChk
from onbld.Checks import JStyle, Keywords, Mapfile
@@ -177,10 +175,7 @@ def not_check(root, cmd):
ignorefiles = filter(os.path.exists,
[os.path.join(root, ".git", "%s.NOT" % cmd),
os.path.join(root, "exception_lists", cmd)])
- if len(ignorefiles) > 0:
- return ignore.ignore(root, ignorefiles, sys.stderr.write)
- else:
- return lambda x: False
+ return Ignore.ignore(root, ignorefiles)
def gen_files(root, parent, paths, exclude):
diff --git a/usr/src/tools/scripts/hdrchk.py b/usr/src/tools/scripts/hdrchk.py
index 84acbc8616..aa62f7b090 100644
--- a/usr/src/tools/scripts/hdrchk.py
+++ b/usr/src/tools/scripts/hdrchk.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!ON_PYTHON_26
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/scripts/hg-active.py b/usr/src/tools/scripts/hg-active.py
index 88394e98e5..23f6c7cd98 100644
--- a/usr/src/tools/scripts/hg-active.py
+++ b/usr/src/tools/scripts/hg-active.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!ON_PYTHON_26
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
diff --git a/usr/src/tools/scripts/mapfilechk.py b/usr/src/tools/scripts/mapfilechk.py
index 9cf2000c7a..ed90d8b426 100644
--- a/usr/src/tools/scripts/mapfilechk.py
+++ b/usr/src/tools/scripts/mapfilechk.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!ON_PYTHON_26
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/scripts/nightly.sh b/usr/src/tools/scripts/nightly.sh
index 9ad9454f4d..cd6a5bcb6a 100644
--- a/usr/src/tools/scripts/nightly.sh
+++ b/usr/src/tools/scripts/nightly.sh
@@ -654,6 +654,9 @@ function build {
rm -rf $PKGARCHIVE >> "$LOGFILE" 2>&1
mkdir -p $PKGARCHIVE >> "$LOGFILE" 2>&1
+ /bin/time $MAKE -e stage-licenses 2>&1 | \
+ tee -a $SRC/$d/${INSTALLOG}.out >> $LOGFILE
+
for d in pkg pkgdefs; do
if [ ! -f "$SRC/$d/Makefile" ]; then
continue
@@ -1505,7 +1508,9 @@ DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
export o_FLAG X_FLAG POUND_SIGN RELEASE_DATE DEV_CM
maketype="distributed"
-MAKE=dmake
+if [ -z "$MAKE" ]; then
+ MAKE=dmake
+fi
# get the dmake version string alone
DMAKE_VERSION=$( $MAKE -v )
DMAKE_VERSION=${DMAKE_VERSION#*: }
@@ -1700,7 +1705,7 @@ ENVCPPFLAGS4=
PARENT_ROOT=
export ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \
- PARENT_ROOT
+ ENVLDLIBS1 ENVLDLIBS2 PARENT_ROOT
PKGARCHIVE_ORIG=$PKGARCHIVE
IA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS
diff --git a/usr/src/tools/scripts/validate_pkg.py b/usr/src/tools/scripts/validate_pkg.py
index 2ac1e009d0..5bf8bd84f2 100644
--- a/usr/src/tools/scripts/validate_pkg.py
+++ b/usr/src/tools/scripts/validate_pkg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!ON_PYTHON_26
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/scripts/webrev.sh b/usr/src/tools/scripts/webrev.sh
index 7df8aa8b52..e3c1631c1b 100644
--- a/usr/src/tools/scripts/webrev.sh
+++ b/usr/src/tools/scripts/webrev.sh
@@ -3057,7 +3057,12 @@ done
#
# Output directory.
#
-WDIR=${WDIR:-$CWS/webrev}
+if [[ $SCM_MODE == "git" ]]; then
+ ws_top_dir=$(dirname $CWS)
+ WDIR=${WDIR:-$ws_top_dir/webrev}
+else
+ WDIR=${WDIR:-$CWS/webrev}
+fi
#
# Name of the webrev, derived from the workspace name or output directory;
@@ -3685,6 +3690,7 @@ do
if [[ $SCM_MODE == "teamware" ||
$SCM_MODE == "mercurial" ||
+ $SCM_MODE == "git" ||
$SCM_MODE == "unknown" ]]; then
# Include warnings for important file mode situations:
diff --git a/usr/src/tools/scripts/wsdiff.py b/usr/src/tools/scripts/wsdiff.py
index 5156f03c20..b485a143a3 100644
--- a/usr/src/tools/scripts/wsdiff.py
+++ b/usr/src/tools/scripts/wsdiff.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!ON_PYTHON_26
#
# CDDL HEADER START
#
diff --git a/usr/src/tools/scripts/xref.sh b/usr/src/tools/scripts/xref.sh
index 78c85bae81..d69a364fda 100644
--- a/usr/src/tools/scripts/xref.sh
+++ b/usr/src/tools/scripts/xref.sh
@@ -28,11 +28,10 @@
ONBLDDIR=$(dirname $(whence $0))
-PATH=/usr/bin:/usr/ccs/bin:${BUILD_TOOLS:-/opt}/teamware/bin:$ONBLDDIR
-export PATH
PROG=`basename $0`
XREFMK=`dirname $0`/xref.mk
XRMAKEFILE=Makefile export XRMAKEFILE
+MAKE="dmake -m serial"
#
# The CSCOPEOPTIONS variable can cause problems if it's set in the environment
@@ -163,7 +162,7 @@ if [ -z "$xrefs" ]; then
# Disable etags if we can't find it.
#
xrefs="cscope ctags"
- make -e -f $XREFMK xref.etags.check 2>/dev/null 1>&2 && \
+ $MAKE -e -f $XREFMK xref.etags.check 2>/dev/null 1>&2 && \
xrefs="$xrefs etags"
else
oldifs=$IFS
@@ -219,7 +218,7 @@ for dir in $dirs; do
# to purge any crud that may be lying around from previous aborted runs.
#
if [ -z "$clobber" ]; then
- make -e -f $XREFMK xref.clean > /dev/null
+ $MAKE -e -f $XREFMK xref.clean > /dev/null
fi
#
@@ -228,7 +227,7 @@ for dir in $dirs; do
if [ -z "$noflg" -a -z "$clobber" ]; then
SECONDS=0
info "$reldir: finding flg-related source files"
- make -e -f $XREFMK xref.flg > /dev/null
+ $MAKE -e -f $XREFMK xref.flg > /dev/null
if [ $? -ne 0 ]; then
warn "$reldir: unable to find flg-related source files"
else
@@ -248,19 +247,19 @@ for dir in $dirs; do
for xref in $xrefs; do
if [ -n "$clobber" ]; then
info "$reldir: clobbering $xref cross-reference"
- make -e -f $XREFMK xref.${xref}.clobber > /dev/null ||
+ $MAKE -e -f $XREFMK xref.${xref}.clobber > /dev/null ||
warn "$reldir: cannot clobber $xref cross-reference"
continue
fi
SECONDS=0
info "$reldir: building $xref cross-reference"
- make -e -f $XREFMK xref.${xref} > /dev/null ||
+ $MAKE -e -f $XREFMK xref.${xref} > /dev/null ||
fail "$reldir: cannot build $xref cross-reference"
timeinfo "$reldir: built $xref cross-reference"
done
- make -e -f $XREFMK xref.clean > /dev/null ||
+ $MAKE -e -f $XREFMK xref.clean > /dev/null ||
warn "$reldir: cannot clean up temporary files"
cd - > /dev/null
done
diff --git a/usr/src/cmd/lp/filter/postscript/Makefile b/usr/src/ucbhead/Makefile
index a730da0d8f..ef9fc7f2fe 100644
--- a/usr/src/cmd/lp/filter/postscript/Makefile
+++ b/usr/src/ucbhead/Makefile
@@ -20,45 +20,49 @@
# CDDL HEADER END
#
#
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
+# Copyright 1989-2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# cmd/lp/filter/postscript/Makefile
+# ucbhead/Makefile
#
+# include global definitions
+include ../Makefile.master
-include ../../Makefile.lp
+LN= ln
-COMMON_SUBDIRS = \
- common \
- postreverse \
- dpost \
- postio \
- postprint \
- postscript \
- postcomm \
- download \
- font \
- filtdesc
+HDRS= curses.h dbm.h setjmp.h sgtty.h signal.h stdio.h strings.h unistd.h
-SUBDIRS= $(COMMON_SUBDIRS)
+SYSHDRS= \
+dir.h fcntl.h file.h ioctl.h \
+param.h resource.h rusage.h signal.h \
+sysmacros.h ttychars.h types.h vfs.h \
+wait.h
-ROOTDIRS = $(ROOTLIBLPPOST)
+ROOTHDRS= $(HDRS:%=$(ROOT)/usr/ucbinclude/%) \
+ $(SYSHDRS:%=$(ROOT)/usr/ucbinclude/sys/%)
-TXTS= README
+DIRS= sys
+ROOTDIRS= $(ROOT)/usr/ucbinclude $(DIRS:%=$(ROOT)/usr/ucbinclude/%)
-.KEEP_STATE:
+FCNTLH= $(ROOT)/usr/ucbinclude/fcntl.h
+SYSFCNTLH= $(ROOT)/usr/ucbinclude/sys/fcntl.h
+
+INS.FCNTLH= $(RM) $@; $(SYMLINK) sys/fcntl.h $@
-all: $(TXTS) $(SUBDIRS)
+# install rules
+$(ROOT)/usr/ucbinclude/sys/%: sys/%
+ $(INS.file)
-install: $(ROOTDIRS) .WAIT $(SUBDIRS)
+$(ROOT)/usr/ucbinclude/%: %
+ $(INS.file)
+
+.KEEP_STATE:
-clean clobber strip lint catalog: $(SUBDIRS)
+install_h: $(ROOTDIRS) $(ROOTHDRS) $(FCNTLH)
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
+$(FCNTLH): $(SYSFCNTLH)
+ $(INS.FCNTLH)
$(ROOTDIRS):
- $(INS.dir)
+ $(INS.dir)
-FRC:
diff --git a/usr/src/ucbhead/sys/file.h b/usr/src/ucbhead/sys/file.h
index 10863380dd..152141fcd7 100644
--- a/usr/src/ucbhead/sys/file.h
+++ b/usr/src/ucbhead/sys/file.h
@@ -77,6 +77,10 @@ typedef struct file
#include <sys/fcntl.h>
#endif
+#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
+int flock(int, int);
+#endif
+
/* flags - see also fcntl.h */
#ifndef FOPEN
diff --git a/usr/src/uts/Makefile.uts b/usr/src/uts/Makefile.uts
index 64096234f0..6928510468 100644
--- a/usr/src/uts/Makefile.uts
+++ b/usr/src/uts/Makefile.uts
@@ -212,6 +212,7 @@ AS_CPPFLAGS = $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) $(AS_DEFS) \
# Override the default, the kernel is squeaky clean
CERRWARN = -errtags=yes -errwarn=%all
+$(__GNUC4)CERRWARN += -_gcc=-Wno-address
CERRWARN += -_gcc=-Wno-missing-braces
CERRWARN += -_gcc=-Wno-sign-compare
diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files
index e0fa959279..99ea570c69 100644
--- a/usr/src/uts/common/Makefile.files
+++ b/usr/src/uts/common/Makefile.files
@@ -21,6 +21,7 @@
#
# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
# Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
@@ -1146,8 +1147,13 @@ PIPE_OBJS += pipe.o
HSFS_OBJS += hsfs_node.o hsfs_subr.o hsfs_vfsops.o hsfs_vnops.o \
hsfs_susp.o hsfs_rrip.o hsfs_susp_subr.o
+HYPRLOFS_OBJS += hyprlofs_dir.o hyprlofs_subr.o \
+ hyprlofs_vnops.o hyprlofs_vfsops.o
+
LOFS_OBJS += lofs_subr.o lofs_vfsops.o lofs_vnops.o
+LXPROC_OBJS += lxpr_subr.o lxpr_vfsops.o lxpr_vnops.o
+
NAMEFS_OBJS += namevfs.o namevno.o
NFS_OBJS += nfs_client.o nfs_common.o nfs_dump.o \
@@ -1390,6 +1396,7 @@ ZFS_COMMON_OBJS += \
zfs_fuid.o \
zfs_sa.o \
zfs_znode.o \
+ zfs_zone.o \
zil.o \
zio.o \
zio_checksum.o \
@@ -1743,6 +1750,8 @@ IPF_OBJS += ip_fil_solaris.o fil.o solaris.o ip_state.o ip_frag.o ip_nat.o \
ip_proxy.o ip_auth.o ip_pool.o ip_htable.o ip_lookup.o \
ip_log.o misc.o ip_compat.o ip_nat6.o drand48.o
+IPD_OBJS += ipd.o
+
IBD_OBJS += ibd.o ibd_cm.o
EIBNX_OBJS += enx_main.o enx_hdlrs.o enx_ibt.o enx_log.o enx_fip.o \
@@ -2002,6 +2011,11 @@ MEGA_SAS_OBJS = megaraid_sas.o
MR_SAS_OBJS = ld_pd_map.o mr_sas.o mr_sas_tbolt.o mr_sas_list.o
#
+# DR_SAS module
+#
+DR_SAS_OBJS = dr_sas.o
+
+#
# ISCSI_INITIATOR module
#
ISCSI_INITIATOR_OBJS = chap.o iscsi_io.o iscsi_thread.o \
diff --git a/usr/src/uts/common/Makefile.rules b/usr/src/uts/common/Makefile.rules
index 28f7ddefae..08116934ed 100644
--- a/usr/src/uts/common/Makefile.rules
+++ b/usr/src/uts/common/Makefile.rules
@@ -21,6 +21,10 @@
#
# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
# Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
#
@@ -102,6 +106,10 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/common/brand/sn1/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(UTSBASE)/common/brand/sngl/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
$(OBJS_DIR)/%.o: $(UTSBASE)/common/brand/solaris10/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
@@ -242,10 +250,18 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/common/fs/hsfs/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(UTSBASE)/common/fs/hyprlofs/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
$(OBJS_DIR)/%.o: $(UTSBASE)/common/fs/lofs/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(UTSBASE)/common/fs/lxproc/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
$(OBJS_DIR)/%.o: $(UTSBASE)/common/fs/mntfs/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
@@ -505,6 +521,10 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/common/inet/ipf/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(UTSBASE)/common/inet/ipd/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
$(OBJS_DIR)/%.o: $(COMMONBASE)/net/patricia/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
@@ -717,6 +737,10 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/drm/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/dr_sas/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/efe/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
@@ -1615,6 +1639,9 @@ $(LINTS_DIR)/%.ln: $(COMMONBASE)/ucode/%.c
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/brand/sn1/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
+$(LINTS_DIR)/%.ln: $(UTSBASE)/common/brand/sngl/%.c
+ @($(LHEAD) $(LINT.c) $< $(LTAIL))
+
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/brand/solaris10/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
@@ -1744,9 +1771,15 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/common/fs/fifofs/%.c
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/fs/hsfs/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
+$(LINTS_DIR)/%.ln: $(UTSBASE)/common/fs/hyprlofs/%.c
+ @($(LHEAD) $(LINT.c) $< $(LTAIL))
+
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/fs/lofs/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
+$(LINTS_DIR)/%.ln: $(UTSBASE)/common/fs/lxproc/%.c
+ @($(LHEAD) $(LINT.c) $< $(LTAIL))
+
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/fs/mntfs/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
@@ -1891,6 +1924,9 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/common/inet/ipnet/%.c
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/inet/iptun/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
+$(LINTS_DIR)/%.ln: $(UTSBASE)/common/inet/ipd/%.c
+ @($(LHEAD) $(LINT.c) $< $(LTAIL))
+
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/inet/ipf/%.c
@($(LHEAD) $(LINT.c) $(IPFFLAGS) $< $(LTAIL))
@@ -2062,6 +2098,9 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/dmfe/%.c
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/drm/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
+$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/dr_sas/%.c
+ @($(LHEAD) $(LINT.c) $< $(LTAIL))
+
$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/efe/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
diff --git a/usr/src/uts/common/brand/sngl/sngl_brand.c b/usr/src/uts/common/brand/sngl/sngl_brand.c
new file mode 100644
index 0000000000..23e23286ea
--- /dev/null
+++ b/usr/src/uts/common/brand/sngl/sngl_brand.c
@@ -0,0 +1,250 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+#include <sys/errno.h>
+#include <sys/exec.h>
+#include <sys/file.h>
+#include <sys/kmem.h>
+#include <sys/modctl.h>
+#include <sys/model.h>
+#include <sys/proc.h>
+#include <sys/syscall.h>
+#include <sys/systm.h>
+#include <sys/thread.h>
+#include <sys/cmn_err.h>
+#include <sys/archsystm.h>
+#include <sys/pathname.h>
+#include <sys/sunddi.h>
+
+#include <sys/machbrand.h>
+#include <sys/brand.h>
+#include "sngl_brand.h"
+
+char *sngl_emulation_table = NULL;
+
+void sngl_init_brand_data(zone_t *);
+void sngl_free_brand_data(zone_t *);
+void sngl_setbrand(proc_t *);
+int sngl_getattr(zone_t *, int, void *, size_t *);
+int sngl_setattr(zone_t *, int, void *, size_t);
+int sngl_brandsys(int, int64_t *, uintptr_t, uintptr_t, uintptr_t,
+ uintptr_t, uintptr_t, uintptr_t);
+void sngl_copy_procdata(proc_t *, proc_t *);
+void sngl_proc_exit(struct proc *, klwp_t *);
+void sngl_exec();
+int sngl_initlwp(klwp_t *);
+void sngl_forklwp(klwp_t *, klwp_t *);
+void sngl_freelwp(klwp_t *);
+void sngl_lwpexit(klwp_t *);
+int sngl_elfexec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
+ long *, int, caddr_t, cred_t *, int);
+
+/* SNGL brand */
+struct brand_ops sngl_brops = {
+ sngl_init_brand_data,
+ sngl_free_brand_data,
+ sngl_brandsys,
+ sngl_setbrand,
+ sngl_getattr,
+ sngl_setattr,
+ sngl_copy_procdata,
+ sngl_proc_exit,
+ sngl_exec,
+ lwp_setrval,
+ sngl_initlwp,
+ sngl_forklwp,
+ sngl_freelwp,
+ sngl_lwpexit,
+ sngl_elfexec,
+ NULL,
+ NULL,
+ NSIG,
+};
+
+#ifdef __amd64
+
+struct brand_mach_ops sngl_mops = {
+ sngl_brand_sysenter_callback,
+ sngl_brand_int91_callback,
+ sngl_brand_syscall_callback,
+ sngl_brand_syscall32_callback
+};
+
+#else /* ! __amd64 */
+
+struct brand_mach_ops sngl_mops = {
+ sngl_brand_sysenter_callback,
+ NULL,
+ sngl_brand_syscall_callback,
+ NULL
+};
+#endif /* __amd64 */
+
+struct brand sngl_brand = {
+ BRAND_VER_1,
+ "sngl",
+ &sngl_brops,
+ &sngl_mops
+};
+
+static struct modlbrand modlbrand = {
+ &mod_brandops, /* type of module */
+ "SNGL Brand", /* description of module */
+ &sngl_brand /* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+ MODREV_1, (void *)&modlbrand, NULL
+};
+
+void
+sngl_setbrand(proc_t *p)
+{
+ brand_solaris_setbrand(p, &sngl_brand);
+}
+
+/*ARGSUSED*/
+int
+sngl_getattr(zone_t *zone, int attr, void *buf, size_t *bufsize)
+{
+ return (EINVAL);
+}
+
+/*ARGSUSED*/
+int
+sngl_setattr(zone_t *zone, int attr, void *buf, size_t bufsize)
+{
+ return (EINVAL);
+}
+
+/*ARGSUSED*/
+int
+sngl_brandsys(int cmd, int64_t *rval, uintptr_t arg1, uintptr_t arg2,
+ uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t arg6)
+{
+ int res;
+
+ *rval = 0;
+ res = brand_solaris_cmd(cmd, arg1, arg2, arg3, &sngl_brand, SNGL_VERSION);
+ if (res >= 0)
+ return (res);
+
+ return (EINVAL);
+}
+
+void
+sngl_copy_procdata(proc_t *child, proc_t *parent)
+{
+ brand_solaris_copy_procdata(child, parent, &sngl_brand);
+}
+
+void
+sngl_proc_exit(struct proc *p, klwp_t *l)
+{
+ brand_solaris_proc_exit(p, l, &sngl_brand);
+}
+
+void
+sngl_exec()
+{
+ brand_solaris_exec(&sngl_brand);
+}
+
+int
+sngl_initlwp(klwp_t *l)
+{
+ return (brand_solaris_initlwp(l, &sngl_brand));
+}
+
+void
+sngl_forklwp(klwp_t *p, klwp_t *c)
+{
+ brand_solaris_forklwp(p, c, &sngl_brand);
+}
+
+void
+sngl_freelwp(klwp_t *l)
+{
+ brand_solaris_freelwp(l, &sngl_brand);
+}
+
+void
+sngl_lwpexit(klwp_t *l)
+{
+ brand_solaris_lwpexit(l, &sngl_brand);
+}
+
+void
+sngl_free_brand_data(zone_t *zone)
+{
+}
+
+void
+sngl_init_brand_data(zone_t *zone)
+{
+}
+
+int
+sngl_elfexec(vnode_t *vp, execa_t *uap, uarg_t *args, intpdata_t *idatap,
+ int level, long *execsz, int setid, caddr_t exec_file, cred_t *cred,
+ int brand_action)
+{
+ return (brand_solaris_elfexec(vp, uap, args, idatap, level, execsz,
+ setid, exec_file, cred, brand_action, &sngl_brand, SNGL_BRANDNAME,
+ SNGL_LIB, SNGL_LIB32, SNGL_LINKER, SNGL_LINKER32));
+}
+
+int
+_init(void)
+{
+ int err;
+
+ /*
+ * Set up the table to interpose on open.
+ */
+ sngl_emulation_table = kmem_zalloc(NSYSCALL, KM_SLEEP);
+ sngl_emulation_table[SYS_open] = 1; /* 5 */
+
+ err = mod_install(&modlinkage);
+ if (err) {
+ cmn_err(CE_WARN, "Couldn't install brand module");
+ kmem_free(sngl_emulation_table, NSYSCALL);
+ }
+
+ return (err);
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+ return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+ return (brand_solaris_fini(&sngl_emulation_table, &modlinkage,
+ &sngl_brand));
+}
diff --git a/usr/src/uts/common/brand/sngl/sngl_brand.h b/usr/src/uts/common/brand/sngl/sngl_brand.h
new file mode 100644
index 0000000000..22bcb7aa9e
--- /dev/null
+++ b/usr/src/uts/common/brand/sngl/sngl_brand.h
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+#ifndef _SNGL_BRAND_H
+#define _SNGL_BRAND_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/brand.h>
+
+#define SNGL_BRANDNAME "sngl"
+
+#define SNGL_VERSION 1
+
+#define SNGL_LIB_NAME "sngl_brand.so.1"
+#define SNGL_LINKER_NAME "ld.so.1"
+
+#define SNGL_LIB32 "/system/usr/lib/" SNGL_LIB_NAME
+#define SNGL_LINKER32 "/lib/" SNGL_LINKER_NAME
+
+#define SNGL_LIB64 "/system/usr/lib/64/" SNGL_LIB_NAME
+#define SNGL_LINKER64 "/lib/64/" SNGL_LINKER_NAME
+
+#if defined(_LP64)
+#define SNGL_LIB SNGL_LIB64
+#define SNGL_LINKER SNGL_LINKER64
+#else /* !_LP64 */
+#define SNGL_LIB SNGL_LIB32
+#define SNGL_LINKER SNGL_LINKER32
+#endif /* !_LP64 */
+
+#if defined(_KERNEL)
+
+void sngl_brand_syscall_callback(void);
+void sngl_brand_sysenter_callback(void);
+
+#if defined(__amd64)
+void sngl_brand_syscall32_callback(void);
+void sngl_brand_int91_callback(void);
+#endif /* __amd64 */
+
+#endif /* _KERNEL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SNGL_BRAND_H */
diff --git a/usr/src/uts/common/conf/param.c b/usr/src/uts/common/conf/param.c
index a01b879756..34e2d3324d 100644
--- a/usr/src/uts/common/conf/param.c
+++ b/usr/src/uts/common/conf/param.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
*/
@@ -565,8 +566,8 @@ char *isa_list = architecture;
static pgcnt_t original_physmem = 0;
#define MIN_DEFAULT_MAXUSERS 8u
-#define MAX_DEFAULT_MAXUSERS 2048u
-#define MAX_MAXUSERS 4096u
+#define MAX_DEFAULT_MAXUSERS 10000u
+#define MAX_MAXUSERS 20000u
void
param_preset(void)
@@ -578,7 +579,7 @@ void
param_calc(int platform_max_nprocs)
{
/*
- * Default to about one "user" per megabyte, taking into
+ * Default to about one "user" per 8MB, taking into
* account both physical and virtual constraints.
* Note: 2^20 is a meg; shifting right by (20 - PAGESHIFT)
* converts pages to megs without integer overflow.
@@ -592,8 +593,9 @@ param_calc(int platform_max_nprocs)
if (maxusers == 0) {
pgcnt_t physmegs = physmem >> (20 - PAGESHIFT);
pgcnt_t virtmegs = vmem_size(heap_arena, VMEM_FREE) >> 20;
- maxusers = MIN(MAX(MIN(physmegs, virtmegs),
- MIN_DEFAULT_MAXUSERS), MAX_DEFAULT_MAXUSERS);
+ maxusers = MIN(physmegs, virtmegs) >> 3; /* divide by 8 */
+ maxusers = MAX(maxusers, MIN_DEFAULT_MAXUSERS);
+ maxusers = MIN(maxusers, MAX_DEFAULT_MAXUSERS);
}
if (maxusers > MAX_MAXUSERS) {
maxusers = MAX_MAXUSERS;
diff --git a/usr/src/uts/common/crypto/api/kcf_random.c b/usr/src/uts/common/crypto/api/kcf_random.c
index fc77b8d78b..7766d8ba7a 100644
--- a/usr/src/uts/common/crypto/api/kcf_random.c
+++ b/usr/src/uts/common/crypto/api/kcf_random.c
@@ -69,6 +69,7 @@
#include <sys/cpuvar.h>
#include <sys/taskq.h>
#include <rng/fips_random.h>
+#include <sys/strlog.h>
#define RNDPOOLSIZE 1024 /* Pool size in bytes */
#define MINEXTRACTBYTES 20
@@ -932,7 +933,8 @@ rnd_handler(void *arg)
int len = 0;
if (!rng_prov_found && rng_ok_to_log) {
- cmn_err(CE_WARN, "No randomness provider enabled for "
+ (void) strlog(0, 0, 0, SL_NOTE,
+ "No randomness provider enabled for "
"/dev/random. Use cryptoadm(1M) to enable a provider.");
rng_ok_to_log = B_FALSE;
}
diff --git a/usr/src/uts/common/crypto/core/kcf_sched.c b/usr/src/uts/common/crypto/core/kcf_sched.c
index f461fe048c..8b2760b237 100644
--- a/usr/src/uts/common/crypto/core/kcf_sched.c
+++ b/usr/src/uts/common/crypto/core/kcf_sched.c
@@ -1027,9 +1027,9 @@ kcfpool_svc(void *arg)
case 0:
case -1:
/*
- * Woke up with no work to do. Check
- * if this thread should exit. We keep
- * at least kcf_minthreads.
+ * Woke up with no work to do. Check if we
+ * should lwp_exit() (which won't return). We
+ * keep at least kcf_minthreads.
*/
if (kcfpool->kp_threads > kcf_minthreads) {
KCF_ATOMIC_DECR(kcfpool->kp_threads);
diff --git a/usr/src/uts/common/disp/cpucaps.c b/usr/src/uts/common/disp/cpucaps.c
index 46f53faab6..68be78a84f 100644
--- a/usr/src/uts/common/disp/cpucaps.c
+++ b/usr/src/uts/common/disp/cpucaps.c
@@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011, 2012 Joyent, Inc. All rights reserved.
*/
#include <sys/disp.h>
@@ -74,6 +75,32 @@
* Putting threads on wait queues in random places while running in the
* kernel might lead to all kinds of locking problems.
*
+ * Bursting
+ * ========
+ *
+ * CPU bursting occurs when the CPU usage is over the baseline but under the
+ * cap. The baseline CPU (zone.cpu-baseline) is set in a multi-tenant
+ * environment so that we know how much CPU is allocated for a tenant under
+ * normal utilization. We can then track how much time a zone is spending
+ * over the "normal" CPU utilization expected for that zone using the
+ * "above_base_sec" kstat. This kstat is cumulative.
+ *
+ * If the zone has a burst limit (zone.cpu-burst-time) then the zone can
+ * burst for that period of time (in seconds) before the effective cap is
+ * lowered to the baseline. Once the effective cap is lowered, the zone
+ * will run at the baseline for the burst limit before the effective cap is
+ * raised again to the full value. This will allow the zone to burst again.
+ * We can watch this behavior using the kstats. The "effective" kstat shows
+ * which cap is being used, the baseline value or the burst value. The
+ * "burst_limit_sec" shows the value of the zone.cpu-burst-time rctl and the
+ * "bursting_sec" kstat shows how many seconds the zone has currently been
+ * bursting. When the CPU load is continuously greater than the baseline,
+ * bursting_sec will increase, up to the burst_limit_sec value, then the
+ * effective kstat will drop to the baseline and the bursting_sec value will
+ * decrease until it hits 0, at which time the effective kstat will return to
+ * the full burst value and the bursting_sec value will begin to increase
+ * again.
+ *
* Accounting
* ==========
*
@@ -203,18 +230,28 @@ static void caps_update();
*/
struct cap_kstat {
kstat_named_t cap_value;
+ kstat_named_t cap_baseline;
+ kstat_named_t cap_effective;
+ kstat_named_t cap_burst_limit;
+ kstat_named_t cap_bursting;
kstat_named_t cap_usage;
kstat_named_t cap_nwait;
kstat_named_t cap_below;
kstat_named_t cap_above;
+ kstat_named_t cap_above_base;
kstat_named_t cap_maxusage;
kstat_named_t cap_zonename;
} cap_kstat = {
{ "value", KSTAT_DATA_UINT64 },
+ { "baseline", KSTAT_DATA_UINT64 },
+ { "effective", KSTAT_DATA_UINT64 },
+ { "burst_limit_sec", KSTAT_DATA_UINT64 },
+ { "bursting_sec", KSTAT_DATA_UINT64 },
{ "usage", KSTAT_DATA_UINT64 },
{ "nwait", KSTAT_DATA_UINT64 },
{ "below_sec", KSTAT_DATA_UINT64 },
{ "above_sec", KSTAT_DATA_UINT64 },
+ { "above_base_sec", KSTAT_DATA_UINT64 },
{ "maxusage", KSTAT_DATA_UINT64 },
{ "zonename", KSTAT_DATA_STRING },
};
@@ -311,7 +348,7 @@ cap_enable(list_t *l, cpucap_t *cap, hrtime_t value)
cap->cap_below = cap->cap_above = 0;
cap->cap_maxusage = 0;
cap->cap_usage = 0;
- cap->cap_value = value;
+ cap->cap_value = cap->cap_chk_value = value;
waitq_unblock(&cap->cap_waitq);
if (CPUCAPS_OFF()) {
cpucaps_enabled = B_TRUE;
@@ -345,7 +382,7 @@ cap_disable(list_t *l, cpucap_t *cap)
cpucaps_enabled = B_FALSE;
cpucaps_clock_callout = NULL;
}
- cap->cap_value = 0;
+ cap->cap_value = cap->cap_chk_value = 0;
cap->cap_project = NULL;
cap->cap_zone = NULL;
if (cap->cap_kstat != NULL) {
@@ -487,6 +524,8 @@ cap_walk(list_t *l, void (*cb)(cpucap_t *, int64_t))
* The waitq_isempty check is performed without the waitq lock. If a new thread
* is placed on the waitq right after the check, it will be picked up during the
* next invocation of cap_poke_waitq().
+ *
+ * Called once per tick for zones.
*/
/* ARGSUSED */
static void
@@ -494,15 +533,92 @@ cap_poke_waitq(cpucap_t *cap, int64_t gen)
{
ASSERT(MUTEX_HELD(&caps_lock));
- if (cap->cap_usage >= cap->cap_value) {
+ if (cap->cap_base != 0) {
+ /*
+ * Because of the way usage is calculated and decayed, its
+ * possible for the zone to be slightly over its cap, but we
+ * don't want to count that after we have reduced the effective
+ * cap to the baseline. That way the zone will be able to
+ * burst again after the burst_limit has expired.
+ */
+ if (cap->cap_usage > cap->cap_base &&
+ cap->cap_chk_value == cap->cap_value) {
+ cap->cap_above_base++;
+
+ /*
+ * If bursting is limited and we've been bursting
+ * longer than we're supposed to, then set the
+ * effective cap to the baseline.
+ */
+ if (cap->cap_burst_limit != 0) {
+ cap->cap_bursting++;
+ if (cap->cap_bursting >= cap->cap_burst_limit)
+ cap->cap_chk_value = cap->cap_base;
+ }
+ } else if (cap->cap_bursting > 0) {
+ /*
+ * We're not bursting now, but we were, decay the
+ * bursting timer.
+ */
+ cap->cap_bursting--;
+ /*
+ * Reset the effective cap once we decay to 0 so we
+ * can burst again.
+ */
+ if (cap->cap_bursting == 0 &&
+ cap->cap_chk_value != cap->cap_value)
+ cap->cap_chk_value = cap->cap_value;
+ }
+ }
+
+ if (cap->cap_usage >= cap->cap_chk_value) {
cap->cap_above++;
} else {
waitq_t *wq = &cap->cap_waitq;
cap->cap_below++;
- if (!waitq_isempty(wq))
- waitq_runone(wq);
+ if (!waitq_isempty(wq)) {
+ int i, ndequeue, p;
+
+ /*
+ * Since this function is only called once per tick,
+ * we can hit a situation where we have artificially
+ * limited the project/zone below its cap. This would
+ * happen if we have multiple threads queued up but
+ * only dequeued one thread/tick. To avoid this we
+ * dequeue multiple threads, calculated based on the
+ * usage percentage of the cap. It is possible that we
+ * could dequeue too many threads and some of them
+ * might be put back on the wait queue quickly, but
+ * since we know that threads are on the wait queue
+ * because we're capping, we know that there is unused
+ * CPU cycles anyway, so this extra work would not
+ * hurt. Also, the ndequeue number is only an upper
+ * bound and we might dequeue less, depending on how
+ * many threads are actually in the wait queue. The
+ * ndequeue values are empirically derived and could be
+ * adjusted or calculated in another way if necessary.
+ */
+ p = (int)((100 * cap->cap_usage) / cap->cap_chk_value);
+ if (p >= 98)
+ ndequeue = 10;
+ else if (p >= 95)
+ ndequeue = 20;
+ else if (p >= 90)
+ ndequeue = 40;
+ else if (p >= 85)
+ ndequeue = 80;
+ else
+ ndequeue = 160;
+
+ for (i = 0; i < ndequeue; i++) {
+ waitq_runone(wq);
+ if (waitq_isempty(wq))
+ break;
+ }
+ DTRACE_PROBE2(cpucaps__pokeq, int, p, int, i);
+ }
}
}
@@ -629,14 +745,14 @@ cap_project_zone_modify_walker(kproject_t *kpj, void *arg)
* Remove all projects in this zone without caps
* from the capped_projects list.
*/
- if (project_cap->cap_value == MAX_USAGE) {
+ if (project_cap->cap_chk_value == MAX_USAGE) {
cap_project_disable(kpj);
}
} else if (CAP_DISABLED(project_cap)) {
/*
* Add the project to capped_projects list.
*/
- ASSERT(project_cap->cap_value == 0);
+ ASSERT(project_cap->cap_chk_value == 0);
cap_project_enable(kpj, MAX_USAGE);
}
mutex_exit(&caps_lock);
@@ -746,7 +862,7 @@ cpucaps_zone_set(zone_t *zone, rctl_qty_t cap_val)
/*
* No state transitions, just change the value
*/
- cap->cap_value = value;
+ cap->cap_value = cap->cap_chk_value = value;
}
ASSERT(MUTEX_HELD(&caps_lock));
@@ -757,6 +873,108 @@ cpucaps_zone_set(zone_t *zone, rctl_qty_t cap_val)
}
/*
+ * Set zone's base cpu value to base_val
+ */
+int
+cpucaps_zone_set_base(zone_t *zone, rctl_qty_t base_val)
+{
+ cpucap_t *cap = NULL;
+ hrtime_t value;
+
+ ASSERT(base_val <= MAXCAP);
+ if (base_val > MAXCAP)
+ base_val = MAXCAP;
+
+ if (CPUCAPS_OFF() || !ZONE_IS_CAPPED(zone))
+ return (0);
+
+ if (zone->zone_cpucap == NULL)
+ cap = cap_alloc();
+
+ mutex_enter(&caps_lock);
+
+ if (cpucaps_busy) {
+ mutex_exit(&caps_lock);
+ return (EBUSY);
+ }
+
+ /*
+ * Double-check whether zone->zone_cpucap is NULL, now with caps_lock
+ * held. If it is still NULL, assign a newly allocated cpucap to it.
+ */
+ if (zone->zone_cpucap == NULL) {
+ zone->zone_cpucap = cap;
+ } else if (cap != NULL) {
+ cap_free(cap);
+ }
+
+ cap = zone->zone_cpucap;
+
+ value = base_val * cap_tick_cost;
+ if (value < 0 || value > cap->cap_value)
+ value = 0;
+
+ cap->cap_base = value;
+
+ mutex_exit(&caps_lock);
+
+ return (0);
+}
+
+/*
+ * Set zone's maximum burst time in seconds. A burst time of 0 means that
+ * the zone can run over its baseline indefinitely.
+ */
+int
+cpucaps_zone_set_burst_time(zone_t *zone, rctl_qty_t base_val)
+{
+ cpucap_t *cap = NULL;
+ hrtime_t value;
+
+ ASSERT(base_val <= INT_MAX);
+ /* Treat the default as 0 - no limit */
+ if (base_val == INT_MAX)
+ base_val = 0;
+ if (base_val > INT_MAX)
+ base_val = INT_MAX;
+
+ if (CPUCAPS_OFF() || !ZONE_IS_CAPPED(zone))
+ return (0);
+
+ if (zone->zone_cpucap == NULL)
+ cap = cap_alloc();
+
+ mutex_enter(&caps_lock);
+
+ if (cpucaps_busy) {
+ mutex_exit(&caps_lock);
+ return (EBUSY);
+ }
+
+ /*
+ * Double-check whether zone->zone_cpucap is NULL, now with caps_lock
+ * held. If it is still NULL, assign a newly allocated cpucap to it.
+ */
+ if (zone->zone_cpucap == NULL) {
+ zone->zone_cpucap = cap;
+ } else if (cap != NULL) {
+ cap_free(cap);
+ }
+
+ cap = zone->zone_cpucap;
+
+ value = SEC_TO_TICK(base_val);
+ if (value < 0)
+ value = 0;
+
+ cap->cap_burst_limit = value;
+
+ mutex_exit(&caps_lock);
+
+ return (0);
+}
+
+/*
* The project is going away so disable its cap.
*/
void
@@ -902,7 +1120,7 @@ cpucaps_project_set(kproject_t *kpj, rctl_qty_t cap_val)
if (CAP_DISABLED(cap))
cap_project_enable(kpj, value);
else
- cap->cap_value = value;
+ cap->cap_value = cap->cap_chk_value = value;
} else if (CAP_ENABLED(cap)) {
/*
* User requested to drop a cap on the project. If it is part of
@@ -910,7 +1128,7 @@ cpucaps_project_set(kproject_t *kpj, rctl_qty_t cap_val)
* otherwise disable the cap.
*/
if (ZONE_IS_CAPPED(kpj->kpj_zone)) {
- cap->cap_value = MAX_USAGE;
+ cap->cap_value = cap->cap_chk_value = MAX_USAGE;
} else {
cap_project_disable(kpj);
}
@@ -948,6 +1166,26 @@ cpucaps_zone_get(zone_t *zone)
}
/*
+ * Get current zone baseline.
+ */
+rctl_qty_t
+cpucaps_zone_get_base(zone_t *zone)
+{
+ return (zone->zone_cpucap != NULL ?
+ (rctl_qty_t)(zone->zone_cpucap->cap_base / cap_tick_cost) : 0);
+}
+
+/*
+ * Get current zone maximum burst time.
+ */
+rctl_qty_t
+cpucaps_zone_get_burst_time(zone_t *zone)
+{
+ return (zone->zone_cpucap != NULL ?
+ (rctl_qty_t)(TICK_TO_SEC(zone->zone_cpucap->cap_burst_limit)) : 0);
+}
+
+/*
* Charge project of thread t the time thread t spent on CPU since previously
* adjusted.
*
@@ -1045,7 +1283,7 @@ cpucaps_charge(kthread_id_t t, caps_sc_t *csc, cpucaps_charge_t charge_type)
project_cap = kpj->kpj_cpucap;
- if (project_cap->cap_usage >= project_cap->cap_value) {
+ if (project_cap->cap_usage >= project_cap->cap_chk_value) {
t->t_schedflag |= TS_PROJWAITQ;
rc = B_TRUE;
} else if (t->t_schedflag & TS_PROJWAITQ) {
@@ -1059,7 +1297,7 @@ cpucaps_charge(kthread_id_t t, caps_sc_t *csc, cpucaps_charge_t charge_type)
} else {
cpucap_t *zone_cap = zone->zone_cpucap;
- if (zone_cap->cap_usage >= zone_cap->cap_value) {
+ if (zone_cap->cap_usage >= zone_cap->cap_chk_value) {
t->t_schedflag |= TS_ZONEWAITQ;
rc = B_TRUE;
} else if (t->t_schedflag & TS_ZONEWAITQ) {
@@ -1133,6 +1371,12 @@ cap_kstat_update(kstat_t *ksp, int rw)
capsp->cap_value.value.ui64 =
ROUND_SCALE(cap->cap_value, cap_tick_cost);
+ capsp->cap_baseline.value.ui64 =
+ ROUND_SCALE(cap->cap_base, cap_tick_cost);
+ capsp->cap_effective.value.ui64 =
+ ROUND_SCALE(cap->cap_chk_value, cap_tick_cost);
+ capsp->cap_burst_limit.value.ui64 =
+ ROUND_SCALE(cap->cap_burst_limit, tick_sec);
capsp->cap_usage.value.ui64 =
ROUND_SCALE(cap->cap_usage, cap_tick_cost);
capsp->cap_maxusage.value.ui64 =
@@ -1140,6 +1384,10 @@ cap_kstat_update(kstat_t *ksp, int rw)
capsp->cap_nwait.value.ui64 = cap->cap_waitq.wq_count;
capsp->cap_below.value.ui64 = ROUND_SCALE(cap->cap_below, tick_sec);
capsp->cap_above.value.ui64 = ROUND_SCALE(cap->cap_above, tick_sec);
+ capsp->cap_above_base.value.ui64 =
+ ROUND_SCALE(cap->cap_above_base, tick_sec);
+ capsp->cap_bursting.value.ui64 =
+ ROUND_SCALE(cap->cap_bursting, tick_sec);
kstat_named_setstr(&capsp->cap_zonename, zonename);
return (0);
diff --git a/usr/src/uts/common/disp/disp.c b/usr/src/uts/common/disp/disp.c
index be92ba108b..9afcd81239 100644
--- a/usr/src/uts/common/disp/disp.c
+++ b/usr/src/uts/common/disp/disp.c
@@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -105,7 +109,7 @@ static void cpu_resched(cpu_t *cp, pri_t tpri);
/*
* If this is set, only interrupt threads will cause kernel preemptions.
* This is done by changing the value of kpreemptpri. kpreemptpri
- * will either be the max sysclass pri + 1 or the min interrupt pri.
+ * will either be the max sysclass pri or the min interrupt pri.
*/
int only_intr_kpreempt;
@@ -252,7 +256,23 @@ dispinit(void)
maxglobpri = cl_maxglobpri;
}
}
- kpreemptpri = (pri_t)v.v_maxsyspri + 1;
+
+ /*
+ * Historically, kpreemptpri was set to v_maxsyspri + 1 -- which is
+ * to say, maxclsyspri + 1. However, over time, the system has used
+ * more and more asynchronous kernel threads, with an increasing number
+ * of these doing work on direct behalf of higher-level software (e.g.,
+ * network processing). This has led to potential priority inversions:
+ * threads doing low-priority lengthy kernel work can effectively
+ * delay kernel-level processing of higher-priority data. To minimize
+ * such inversions, we set kpreemptpri to be v_maxsyspri; anything in
+ * the kernel that runs at maxclsyspri will therefore induce kernel
+ * preemption, and this priority should be used if/when an asynchronous
+ * thread (or, as is often the case, task queue) is performing a task
+ * on behalf of higher-level software (or any task that is otherwise
+ * latency-sensitve).
+ */
+ kpreemptpri = (pri_t)v.v_maxsyspri;
if (kpqpri == KPQPRI)
kpqpri = kpreemptpri;
diff --git a/usr/src/uts/common/disp/fss.c b/usr/src/uts/common/disp/fss.c
index 62301d65d8..c1c7da06ec 100644
--- a/usr/src/uts/common/disp/fss.c
+++ b/usr/src/uts/common/disp/fss.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -54,6 +55,179 @@
#include <sys/cpucaps.h>
/*
+ * The fair share scheduling class ensures that collections of processes
+ * (zones and projects) each get their configured share of CPU. This is in
+ * contrast to the TS class which considers individual processes.
+ *
+ * The FSS cpu-share is set on zones using the zone.cpu-shares rctl and on
+ * projects using the project.cpu-shares rctl. By default the value is 1
+ * and it can range from 0 - 64k. A value of 0 means that processes in the
+ * collection will only get CPU resources when there are no other processes
+ * that need CPU. The cpu-share is used as one of the inputs to calculate a
+ * thread's "user-mode" priority (umdpri) for the scheduler. The umdpri falls
+ * in the range 0-59. FSS calculates other, internal, priorities which are not
+ * visible outside of the FSS class.
+ *
+ * The FSS class should approximate TS behavior when there are excess CPU
+ * resources. When there is a backlog of runnable processes, then the share
+ * is used as input into the runnable process's priority calculation, where
+ * the final umdpri is used by the scheduler to determine when the process runs.
+ *
+ * Projects in a zone compete with each other for CPU time, receiving CPU
+ * allocation within a zone proportional to the project's share; at a higher
+ * level zones compete with each other, receiving allocation in a pset
+ * proportional to the zone's share.
+ *
+ * The FSS priority calculation consists of several parts.
+ *
+ * 1) Once per second the fss_update function runs. The first thing it does is
+ * call fss_decay_usage. This function does three things.
+ *
+ * a) fss_decay_usage first decays the maxfsspri value for the pset. This
+ * value is used in the per-process priority calculation described in step
+ * (2b). The maxfsspri is decayed using the following formula:
+ *
+ * maxfsspri * fss_nice_decay[NZERO])
+ * maxfsspri = ------------------------------------
+ * FSS_DECAY_BASE
+ *
+ *
+ * - NZERO is the default process priority (i.e. 20)
+ *
+ * The fss_nice_decay array is a fixed set of values used to adjust the
+ * decay rate of processes based on their nice value. Entries in this
+ * array are initialized in fss_init using the following formula:
+ *
+ * (FSS_DECAY_MAX - FSS_DECAY_MIN) * i
+ * FSS_DECAY_MIN + -------------------------------------
+ * FSS_NICE_RANGE - 1
+ *
+ * - FSS_DECAY_MIN is 82 = approximates 65% (82/128)
+ * - FSS_DECAY_MAX is 108 = approximates 85% (108/128)
+ * - FSS_NICE_RANGE is 40 (range is 0 - 39)
+ *
+ * b) The second thing fss_decay_usage does is update each project's "usage"
+ * for the last second and then recalculates the project's "share usage".
+ *
+ * The usage value is the recent CPU usage for all of the threads in the
+ * project. It is decayed and updated this way:
+ *
+ * (usage * FSS_DECAY_USG)
+ * usage = ------------------------- + ticks;
+ * FSS_DECAY_BASE
+ *
+ * - FSS_DECAY_BASE is 128 - used instead of 100 so we can shift vs divide
+ * - FSS_DECAY_USG is 96 - approximates 75% (96/128)
+ * - ticks is updated whenever a process in this project is running
+ * when the scheduler's tick processing fires. This is not a simple
+ * counter, the values are based on the entries in the fss_nice_tick
+ * array (see section 3 below). ticks is then reset to 0 so it can track
+ * the next seconds worth of nice-adjusted time for the project.
+ *
+ * c) The third thing fss_decay_usage does is update each project's "share
+ * usage" (shusage). This is the normalized usage value for the project and
+ * is calculated this way:
+ *
+ * pset_shares^2 zone_int_shares^2
+ * usage * ------------- * ------------------
+ * kpj_shares^2 zone_ext_shares^2
+ *
+ * - usage - see (1b) for more details
+ * - pset_shares is the total of all *active* zone shares in the pset (by
+ * default there is only one pset)
+ * - kpj_shares is the individual project's share (project.cpu-shares rctl)
+ * - zone_int_shares is the sum of shares of all active projects within the
+ * zone (the zone-internal total)
+ * - zone_ext_shares is the share value for the zone (zone.cpu-shares rctl)
+ *
+ * The shusage is used in step (2b) to calculate the thread's new internal
+ * priority. A larger shusage value leads to a lower priority.
+ *
+ * 2) The fss_update function then calls fss_update_list to update the priority
+ * of all threads. This does two things.
+ *
+ * a) First the thread's internal priority is decayed using the following
+ * formula:
+ *
+ * fsspri * fss_nice_decay[nice_value])
+ * fsspri = ------------------------------------
+ * FSS_DECAY_BASE
+ *
+ * - FSS_DECAY_BASE is 128 as described above
+ *
+ * b) Second, if the thread is runnable (TS_RUN or TS_WAIT) calls fss_newpri
+ * to update the user-mode priority (umdpri) of the runnable thread.
+ * Threads that are running (TS_ONPROC) or waiting for an event (TS_SLEEP)
+ * are not updated at this time. The updated user-mode priority can cause
+ * threads to change their position in the run queue.
+ *
+ * The process's new internal fsspri is calculated using the following
+ * formula. All runnable threads in the project will use the same shusage
+ * and nrunnable values in their calculation.
+ *
+ * fsspri += shusage * nrunnable * ticks
+ *
+ * - shusage is the project's share usage, calculated in (1c)
+ * - nrunnable is the number of runnable threads in the project
+ * - ticks is the number of ticks this thread ran since the last fss_newpri
+ * invocation.
+ *
+ * Finally the process's new user-mode priority is calculated using the
+ * following formula:
+ *
+ * (fsspri * umdprirange)
+ * umdpri = maxumdpri - ------------------------
+ * maxfsspri
+ *
+ * - maxumdpri is MINCLSYSPRI - 1 (i.e. 59)
+ * - umdprirange is maxumdpri - 1 (i.e. 58)
+ * - maxfsspri is the largest fsspri seen so far, as we're iterating all
+ * runnable processes
+ *
+ * Thus, a higher internal priority (fsspri) leads to a lower user-mode
+ * priority which means the thread runs less. The fsspri is higher when
+ * the project's normalized share usage is higher, when the project has
+ * more runnable threads, or when the thread has accumulated more run-time.
+ *
+ * This code has various checks to ensure the resulting umdpri is in the
+ * range 1-59. See fss_newpri for more details.
+ *
+ * To reiterate, the above processing is performed once per second to recompute
+ * the runnable thread user-mode priorities.
+ *
+ * 3) The final major component in the priority calculation is the tick
+ * processing which occurs on a thread that is running when the clock
+ * calls fss_tick.
+ *
+ * A thread can run continuously in user-land (compute-bound) for the
+ * fss_quantum (see "dispadmin -c FSS -g" for the configurable properties).
+ * The fss_quantum defaults to 11 (i.e. 11 ticks).
+ *
+ * Once the quantum has been consumed, the thread will call fss_newpri to
+ * recompute its umdpri priority, as described above in (2b). Threads that
+ * were T_ONPROC at the one second interval when runnable thread priorities
+ * were recalculated will have their umdpri priority recalculated when their
+ * quanta expires.
+ *
+ * To ensure that runnable threads within a project see the expected
+ * round-robin behavior, there is a special case in fss_newpri for a thread
+ * that has run for its quanta within the one second update interval. See
+ * the handling for the quanta_up parameter within fss_newpri.
+ *
+ * Also of interest, the fss_tick code increments the project's tick value
+ * using the fss_nice_tick array entry for the thread's nice value. The idea
+ * behind the fss_nice_tick array is that the cost of a tick is lower at
+ * positive nice values (so that it doesn't increase the project's usage
+ * as much as normal) with a 50% drop at the maximum level and a 50%
+ * increase at the minimum level. See (1b). The fss_nice_tick array is
+ * initialized in fss_init using the following formula:
+ *
+ * FSS_TICK_COST * (((3 * FSS_NICE_RANGE) / 2) - i)
+ * --------------------------------------------------
+ * FSS_NICE_RANGE
+ *
+ * - FSS_TICK_COST is 1000, the tick cost for threads with nice level 0
+ *
* FSS Data Structures:
*
* fsszone
@@ -72,7 +246,6 @@
* ----- ----- -----
* fssproj
*
- *
* That is, fsspsets contain a list of fsszone's that are currently active in
* the pset, and a list of fssproj's, corresponding to projects with runnable
* threads on the pset. fssproj's in turn point to the fsszone which they
@@ -81,12 +254,6 @@
* An fssproj_t is removed when there are no threads in it.
*
* An fsszone_t is removed when there are no projects with threads in it.
- *
- * Projects in a zone compete with each other for cpu time, receiving cpu
- * allocation within a zone proportional to fssproj->fssp_shares
- * (project.cpu-shares); at a higher level zones compete with each other,
- * receiving allocation in a pset proportional to fsszone->fssz_shares
- * (zone.cpu-shares). See fss_decay_usage() for the precise formula.
*/
static pri_t fss_init(id_t, int, classfuncs_t **);
@@ -186,7 +353,7 @@ static time_t fss_minrun = 2; /* t_pri becomes 59 within 2 secs */
static time_t fss_minslp = 2; /* min time on sleep queue for hardswap */
static int fss_quantum = 11;
-static void fss_newpri(fssproc_t *);
+static void fss_newpri(fssproc_t *, boolean_t);
static void fss_update(void *);
static int fss_update_list(int);
static void fss_change_priority(kthread_t *, fssproc_t *);
@@ -718,17 +885,55 @@ fss_init(id_t cid, int clparmsz, classfuncs_t **clfuncspp)
}
/*
- * Calculate the new cpupri based on the usage, the number of shares and
- * the number of active threads. Reset the tick counter for this thread.
+ * Calculate the new fss_umdpri based on the usage, the normalized share usage
+ * and the number of active threads. Reset the tick counter for this thread.
+ *
+ * When calculating the new priority using the standard formula we can hit
+ * a scenario where we don't have good round-robin behavior. This would be
+ * most commonly seen when there is a zone with lots of runnable threads.
+ * In the bad scenario we will see the following behavior when using the
+ * standard formula and these conditions:
+ *
+ * - there are multiple runnable threads in the zone (project)
+ * - the fssps_maxfsspri is a very large value
+ * - (we also know all of these threads will use the project's
+ * fssp_shusage)
+ *
+ * Under these conditions, a thread with a low fss_fsspri value is chosen
+ * to run and the thread gets a high fss_umdpri. This thread can run for
+ * its full quanta (fss_timeleft) at which time fss_newpri is called to
+ * calculate the thread's new priority.
+ *
+ * In this case, because the newly calculated fsspri value is much smaller
+ * (orders of magnitude) than the fssps_maxfsspri value, if we used the
+ * standard formula the thread will still get a high fss_umdpri value and
+ * will run again for another quanta, even though there are other runnable
+ * threads in the project.
+ *
+ * For a thread that is runnable for a long time, the thread can continue
+ * to run for many quanta (totaling many seconds) before the thread's fsspri
+ * exceeds the fssps_maxfsspri and the thread's fss_umdpri is reset back
+ * down to 1. This behavior also keeps the fssps_maxfsspr at a high value,
+ * so that the next runnable thread might repeat this cycle.
+ *
+ * This leads to the case where we don't have round-robin behavior at quanta
+ * granularity, but instead, runnable threads within the project only run
+ * at several second intervals.
+ *
+ * To prevent this scenario from occuring, when a thread has consumed its
+ * quanta and there are multiple runnable threads in the project, we
+ * immediately cause the thread to hit fssps_maxfsspri so that it gets
+ * reset back to 1 and another runnable thread in the project can run.
*/
static void
-fss_newpri(fssproc_t *fssproc)
+fss_newpri(fssproc_t *fssproc, boolean_t quanta_up)
{
kthread_t *tp;
fssproj_t *fssproj;
fsspset_t *fsspset;
fsszone_t *fsszone;
fsspri_t fsspri, maxfsspri;
+ uint32_t n_runnable;
pri_t invpri;
uint32_t ticks;
@@ -751,25 +956,43 @@ fss_newpri(fssproc_t *fssproc)
fsspset = FSSPROJ2FSSPSET(fssproj);
disp_lock_enter_high(&fsspset->fssps_displock);
+ ticks = fssproc->fss_ticks;
+ fssproc->fss_ticks = 0;
+
if (fssproj->fssp_shares == 0 || fsszone->fssz_rshares == 0) {
/*
* Special case: threads with no shares.
*/
fssproc->fss_umdpri = fss_minglobpri;
- fssproc->fss_ticks = 0;
disp_lock_exit_high(&fsspset->fssps_displock);
return;
}
- /*
- * fsspri += shusage * nrunnable * ticks
- */
- ticks = fssproc->fss_ticks;
- fssproc->fss_ticks = 0;
- fsspri = fssproc->fss_fsspri;
- fsspri += fssproj->fssp_shusage * fssproj->fssp_runnable * ticks;
+ maxfsspri = fsspset->fssps_maxfsspri;
+ n_runnable = fssproj->fssp_runnable;
+
+ if (quanta_up && n_runnable > 1) {
+ fsspri = maxfsspri;
+ } else {
+ /*
+ * fsspri += fssp_shusage * nrunnable * ticks
+ * If all three values are non-0, this typically calculates to
+ * a large number (sometimes > 1M, sometimes > 100B) due to
+ * fssp_shusage which can be > 1T.
+ */
+ fsspri = fssproc->fss_fsspri;
+ fsspri += fssproj->fssp_shusage * n_runnable * ticks;
+ }
+
fssproc->fss_fsspri = fsspri;
+ /*
+ * fss_maxumdpri is normally 59, since FSS priorities are 0-59.
+ * If the previous calculation resulted in 0 (e.g. was 0 and added 0
+ * because ticks == 0), then instead of 0, we use the largest priority,
+ * which is still small in comparison to the large numbers we typically
+ * see.
+ */
if (fsspri < fss_maxumdpri)
fsspri = fss_maxumdpri; /* so that maxfsspri is != 0 */
@@ -783,12 +1006,16 @@ fss_newpri(fssproc_t *fssproc)
* If this thread's fsspri is greater than the previous largest
* fsspri, then record it as the new high and priority for this
* thread will be one (the lowest priority assigned to a thread
- * that has non-zero shares).
+ * that has non-zero shares). Because of this check, maxfsspri can
+ * change as this function is called via the
+ * fss_update -> fss_update_list -> fss_newpri code path to update
+ * all runnable threads. See the code in fss_update for how we
+ * mitigate this issue.
+ *
* Note that this formula cannot produce out of bounds priority
- * values; if it is changed, additional checks may need to be
+ * values (0-59); if it is changed, additional checks may need to be
* added.
*/
- maxfsspri = fsspset->fssps_maxfsspri;
if (fsspri >= maxfsspri) {
fsspset->fssps_maxfsspri = fsspri;
disp_lock_exit_high(&fsspset->fssps_displock);
@@ -801,8 +1028,9 @@ fss_newpri(fssproc_t *fssproc)
}
/*
- * Decays usages of all running projects and resets their tick counters.
- * Called once per second from fss_update() after updating priorities.
+ * Decays usages of all running projects, resets their tick counters and
+ * calcluates the projects normalized share usage. Called once per second from
+ * fss_update().
*/
static void
fss_decay_usage()
@@ -814,6 +1042,7 @@ fss_decay_usage()
fsszone_t *fsszone;
fsspri_t maxfsspri;
int psetid;
+ struct zone *zp;
mutex_enter(&fsspsets_lock);
/*
@@ -824,6 +1053,8 @@ fss_decay_usage()
fsspset = &fsspsets[psetid];
mutex_enter(&fsspset->fssps_lock);
+ fsspset->fssps_gen++;
+
if (fsspset->fssps_cpupart == NULL ||
(fssproj = fsspset->fssps_list) == NULL) {
mutex_exit(&fsspset->fssps_lock);
@@ -836,6 +1067,8 @@ fss_decay_usage()
*/
disp_lock_enter(&fsspset->fssps_displock);
+ pset_shares = fsspset->fssps_shares;
+
maxfsspri = (fsspset->fssps_maxfsspri *
fss_nice_decay[NZERO]) / FSS_DECAY_BASE;
if (maxfsspri < fss_maxumdpri)
@@ -843,16 +1076,31 @@ fss_decay_usage()
fsspset->fssps_maxfsspri = maxfsspri;
do {
+ fsszone = fssproj->fssp_fsszone;
+ zp = fsszone->fssz_zone;
+
/*
- * Decay usage for each project running on
- * this cpu partition.
+ * Reset zone's FSS stats if they are from a
+ * previous cycle.
+ */
+ if (fsspset->fssps_gen != zp->zone_fss_gen) {
+ zp->zone_fss_gen = fsspset->fssps_gen;
+ zp->zone_run_ticks = 0;
+ }
+
+ /*
+ * Decay project usage, then add in this cycle's
+ * nice tick value.
*/
fssproj->fssp_usage =
(fssproj->fssp_usage * FSS_DECAY_USG) /
- FSS_DECAY_BASE + fssproj->fssp_ticks;
+ FSS_DECAY_BASE +
+ fssproj->fssp_ticks;
+
fssproj->fssp_ticks = 0;
+ zp->zone_run_ticks += fssproj->fssp_tick_cnt;
+ fssproj->fssp_tick_cnt = 0;
- fsszone = fssproj->fssp_fsszone;
/*
* Readjust the project's number of shares if it has
* changed since we checked it last time.
@@ -871,18 +1119,55 @@ fss_decay_usage()
* Readjust the zone's number of shares if it
* has changed since we checked it last time.
*/
- zone_ext_shares = fsszone->fssz_zone->zone_shares;
+ zone_ext_shares = zp->zone_shares;
if (fsszone->fssz_rshares != zone_ext_shares) {
if (fsszone->fssz_runnable != 0) {
fsspset->fssps_shares -=
fsszone->fssz_rshares;
fsspset->fssps_shares +=
zone_ext_shares;
+ pset_shares = fsspset->fssps_shares;
}
fsszone->fssz_rshares = zone_ext_shares;
}
zone_int_shares = fsszone->fssz_shares;
- pset_shares = fsspset->fssps_shares;
+
+ /*
+ * If anything is runnable in the project, track the
+ * overall project share percent for monitoring useage.
+ */
+ if (fssproj->fssp_runnable > 0) {
+ uint32_t zone_shr_pct;
+ uint32_t int_shr_pct;
+
+ /*
+ * Times 1000 to get tenths of a percent
+ *
+ * zone_ext_shares
+ * zone_shr_pct = ---------------
+ * pset_shares
+ *
+ * kpj_shares
+ * int_shr_pct = ---------------
+ * zone_int_shares
+ */
+ if (pset_shares == 0 || zone_int_shares == 0) {
+ fssproj->fssp_shr_pct = 0;
+ } else {
+ zone_shr_pct =
+ (zone_ext_shares * 1000) /
+ pset_shares;
+ int_shr_pct = (kpj_shares * 1000) /
+ zone_int_shares;
+ fssproj->fssp_shr_pct =
+ (zone_shr_pct * int_shr_pct) /
+ 1000;
+ }
+ } else {
+ DTRACE_PROBE1(fss__prj__norun, fssproj_t *,
+ fssproj);
+ }
+
/*
* Calculate fssp_shusage value to be used
* for fsspri increments for the next second.
@@ -890,10 +1175,22 @@ fss_decay_usage()
if (kpj_shares == 0 || zone_ext_shares == 0) {
fssproj->fssp_shusage = 0;
} else if (FSSPROJ2KPROJ(fssproj) == proj0p) {
+ uint32_t zone_shr_pct;
+
/*
* Project 0 in the global zone has 50%
- * of its zone.
+ * of its zone. See calculation above for
+ * the zone's share percent.
*/
+ if (pset_shares == 0)
+ zone_shr_pct = 1000;
+ else
+ zone_shr_pct =
+ (zone_ext_shares * 1000) /
+ pset_shares;
+
+ fssproj->fssp_shr_pct = zone_shr_pct / 2;
+
fssproj->fssp_shusage = (fssproj->fssp_usage *
zone_int_shares * zone_int_shares) /
(zone_ext_shares * zone_ext_shares);
@@ -925,6 +1222,10 @@ fss_decay_usage()
* pset_shares^2
* shusage = usage * ----------------------
* zone_ext_shares^2
+ *
+ * shusage is one input to calculating fss_pri
+ * in fss_newpri(). Larger values tend toward
+ * lower priorities for processes in the proj.
*/
fssproj->fssp_shusage = fssproj->fssp_usage *
pset_shares * zone_int_shares;
@@ -996,6 +1297,10 @@ fss_change_priority(kthread_t *t, fssproc_t *fssproc)
* thread pointer. Each list has its own lock. This avoids blocking all
* fss_enterclass, fss_fork, and fss_exitclass operations while fss_update runs.
* fss_update traverses each list in turn.
+ *
+ * Each time we're run (once/second) we may start at the next list and iterate
+ * through all of the lists. By starting with a different list, we mitigate any
+ * effects we would see updating the fssps_maxfsspri value in fss_newpri.
*/
static void
fss_update(void *arg)
@@ -1021,7 +1326,7 @@ fss_update(void *arg)
do {
/*
* If this is the first list after the current marker to have
- * threads with priorities updates, advance the marker to this
+ * threads with priority updates, advance the marker to this
* list for the next time fss_update runs.
*/
if (fss_update_list(i) &&
@@ -1050,6 +1355,7 @@ fss_update_list(int i)
fssproc_t *fssproc;
fssproj_t *fssproj;
fsspri_t fsspri;
+ pri_t fss_umdpri;
kthread_t *t;
int updated = 0;
@@ -1073,6 +1379,7 @@ fss_update_list(int i)
fssproj = FSSPROC2FSSPROJ(fssproc);
if (fssproj == NULL)
goto next;
+
if (fssproj->fssp_shares != 0) {
/*
* Decay fsspri value.
@@ -1091,16 +1398,21 @@ fss_update_list(int i)
*/
t->t_trapret = 1;
aston(t);
+ if (t->t_state == TS_ONPROC)
+ DTRACE_PROBE1(fss__onproc, fssproc_t *,
+ fssproc);
goto next;
}
- fss_newpri(fssproc);
+ fss_newpri(fssproc, B_FALSE);
updated = 1;
+ fss_umdpri = fssproc->fss_umdpri;
+
/*
* Only dequeue the thread if it needs to be moved; otherwise
* it should just round-robin here.
*/
- if (t->t_pri != fssproc->fss_umdpri)
+ if (t->t_pri != fss_umdpri)
fss_change_priority(t, fssproc);
next:
thread_unlock(t);
@@ -1624,7 +1936,7 @@ fss_forkret(kthread_t *t, kthread_t *ct)
thread_lock(t);
fssproc = FSSPROC(t);
- fss_newpri(fssproc);
+ fss_newpri(fssproc, B_FALSE);
fssproc->fss_timeleft = fss_quantum;
t->t_pri = fssproc->fss_umdpri;
ASSERT(t->t_pri >= 0 && t->t_pri <= fss_maxglobpri);
@@ -1725,7 +2037,7 @@ fss_parmsset(kthread_t *t, void *parmsp, id_t reqpcid, cred_t *reqpcredp)
fssproc->fss_uprilim = reqfssuprilim;
fssproc->fss_upri = reqfssupri;
fssproc->fss_nice = nice;
- fss_newpri(fssproc);
+ fss_newpri(fssproc, B_FALSE);
if ((fssproc->fss_flags & FSSKPRI) != 0) {
thread_unlock(t);
@@ -2180,6 +2492,7 @@ fss_tick(kthread_t *t)
fsspset_t *fsspset = FSSPROJ2FSSPSET(fssproj);
disp_lock_enter_high(&fsspset->fssps_displock);
fssproj->fssp_ticks += fss_nice_tick[fssproc->fss_nice];
+ fssproj->fssp_tick_cnt++;
fssproc->fss_ticks++;
disp_lock_exit_high(&fsspset->fssps_displock);
}
@@ -2223,7 +2536,7 @@ fss_tick(kthread_t *t)
}
fssproc->fss_flags &= ~FSSRESTORE;
- fss_newpri(fssproc);
+ fss_newpri(fssproc, B_TRUE);
new_pri = fssproc->fss_umdpri;
ASSERT(new_pri >= 0 && new_pri <= fss_maxglobpri);
@@ -2262,7 +2575,7 @@ fss_tick(kthread_t *t)
* queue so that it gets charged for the CPU time from its
* quantum even before that quantum expires.
*/
- fss_newpri(fssproc);
+ fss_newpri(fssproc, B_FALSE);
if (t->t_pri != fssproc->fss_umdpri)
fss_change_priority(t, fssproc);
diff --git a/usr/src/uts/common/disp/thread.c b/usr/src/uts/common/disp/thread.c
index 5ed9110251..63a08483f8 100644
--- a/usr/src/uts/common/disp/thread.c
+++ b/usr/src/uts/common/disp/thread.c
@@ -1049,6 +1049,8 @@ installctx(
ctx->free_op = free;
ctx->arg = arg;
ctx->next = t->t_ctx;
+ ctx->save_ts = 0;
+ ctx->restore_ts = 0;
t->t_ctx = ctx;
}
@@ -1120,9 +1122,12 @@ savectx(kthread_t *t)
struct ctxop *ctx;
ASSERT(t == curthread);
- for (ctx = t->t_ctx; ctx != 0; ctx = ctx->next)
- if (ctx->save_op != NULL)
+ for (ctx = t->t_ctx; ctx != 0; ctx = ctx->next) {
+ if (ctx->save_op != NULL) {
+ ctx->save_ts = gethrtime_unscaled();
(ctx->save_op)(ctx->arg);
+ }
+ }
}
void
@@ -1131,9 +1136,12 @@ restorectx(kthread_t *t)
struct ctxop *ctx;
ASSERT(t == curthread);
- for (ctx = t->t_ctx; ctx != 0; ctx = ctx->next)
- if (ctx->restore_op != NULL)
+ for (ctx = t->t_ctx; ctx != 0; ctx = ctx->next) {
+ if (ctx->restore_op != NULL) {
+ ctx->restore_ts = gethrtime_unscaled();
(ctx->restore_op)(ctx->arg);
+ }
+ }
}
void
diff --git a/usr/src/uts/common/dtrace/dtrace.c b/usr/src/uts/common/dtrace/dtrace.c
index 4bee43839f..67b658c907 100644
--- a/usr/src/uts/common/dtrace/dtrace.c
+++ b/usr/src/uts/common/dtrace/dtrace.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -92,6 +92,7 @@
#include <sys/zone.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include "strtolctype.h"
/*
* DTrace Tunable Variables
@@ -116,7 +117,7 @@
int dtrace_destructive_disallow = 0;
dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024);
size_t dtrace_difo_maxsize = (256 * 1024);
-dtrace_optval_t dtrace_dof_maxsize = (256 * 1024);
+dtrace_optval_t dtrace_dof_maxsize = (8 * 1024 * 1024);
size_t dtrace_global_maxsize = (16 * 1024);
size_t dtrace_actions_max = (16 * 1024);
size_t dtrace_retain_max = 1024;
@@ -171,6 +172,7 @@ static dtrace_provider_t *dtrace_provider; /* provider list */
static dtrace_meta_t *dtrace_meta_pid; /* user-land meta provider */
static int dtrace_opens; /* number of opens */
static int dtrace_helpers; /* number of helpers */
+static int dtrace_getf; /* number of unpriv getf()s */
static void *dtrace_softstate; /* softstate pointer */
static dtrace_hash_t *dtrace_bymod; /* probes hashed by module */
static dtrace_hash_t *dtrace_byfunc; /* probes hashed by function */
@@ -267,17 +269,22 @@ dtrace_id_t dtrace_probeid_error; /* special ERROR probe */
/*
* DTrace Helper Tracing Variables
+ *
+ * These variables should be set dynamically to enable helper tracing. The
+ * only variables that should be set are dtrace_helptrace_enable (which should
+ * be set to a non-zero value to allocate helper tracing buffers on the next
+ * open of /dev/dtrace) and dtrace_helptrace_disable (which should be set to a
+ * non-zero value to deallocate helper tracing buffers on the next close of
+ * /dev/dtrace). When (and only when) helper tracing is disabled, the
+ * buffer size may also be set via dtrace_helptrace_bufsize.
*/
-uint32_t dtrace_helptrace_next = 0;
-uint32_t dtrace_helptrace_nlocals;
-char *dtrace_helptrace_buffer;
-int dtrace_helptrace_bufsize = 512 * 1024;
-
-#ifdef DEBUG
-int dtrace_helptrace_enabled = 1;
-#else
-int dtrace_helptrace_enabled = 0;
-#endif
+int dtrace_helptrace_enable = 0;
+int dtrace_helptrace_disable = 0;
+int dtrace_helptrace_bufsize = 16 * 1024 * 1024;
+uint32_t dtrace_helptrace_nlocals;
+static dtrace_helptrace_t *dtrace_helptrace_buffer;
+static uint32_t dtrace_helptrace_next = 0;
+static int dtrace_helptrace_wrapped = 0;
/*
* DTrace Error Hashing
@@ -373,8 +380,8 @@ static kmutex_t dtrace_errlock;
* disallow all negative sizes. Ranges of size 0 are allowed.
*/
#define DTRACE_INRANGE(testaddr, testsz, baseaddr, basesz) \
- ((testaddr) - (baseaddr) < (basesz) && \
- (testaddr) + (testsz) - (baseaddr) <= (basesz) && \
+ ((testaddr) - (uintptr_t)(baseaddr) < (basesz) && \
+ (testaddr) + (testsz) - (uintptr_t)(baseaddr) <= (basesz) && \
(testaddr) + (testsz) >= (testaddr))
/*
@@ -475,6 +482,8 @@ static int dtrace_state_option(dtrace_state_t *, dtrace_optid_t,
dtrace_optval_t);
static int dtrace_ecb_create_enable(dtrace_probe_t *, void *);
static void dtrace_helper_provider_destroy(dtrace_helper_provider_t *);
+static int dtrace_priv_proc(dtrace_state_t *, dtrace_mstate_t *);
+static void dtrace_getf_barrier(void);
/*
* DTrace Probe Context Functions
@@ -619,7 +628,7 @@ dtrace_canstore(uint64_t addr, size_t sz, dtrace_mstate_t *mstate,
* up both thread-local variables and any global dynamically-allocated
* variables.
*/
- if (DTRACE_INRANGE(addr, sz, (uintptr_t)vstate->dtvs_dynvars.dtds_base,
+ if (DTRACE_INRANGE(addr, sz, vstate->dtvs_dynvars.dtds_base,
vstate->dtvs_dynvars.dtds_size)) {
dtrace_dstate_t *dstate = &vstate->dtvs_dynvars;
uintptr_t base = (uintptr_t)dstate->dtds_base +
@@ -686,6 +695,7 @@ dtrace_canload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate,
dtrace_vstate_t *vstate)
{
volatile uintptr_t *illval = &cpu_core[CPU->cpu_id].cpuc_dtrace_illval;
+ file_t *fp;
/*
* If we hold the privilege to read from kernel memory, then
@@ -703,10 +713,99 @@ dtrace_canload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate,
/*
* We're allowed to read from our own string table.
*/
- if (DTRACE_INRANGE(addr, sz, (uintptr_t)mstate->dtms_difo->dtdo_strtab,
+ if (DTRACE_INRANGE(addr, sz, mstate->dtms_difo->dtdo_strtab,
mstate->dtms_difo->dtdo_strlen))
return (1);
+ if (vstate->dtvs_state != NULL &&
+ dtrace_priv_proc(vstate->dtvs_state, mstate)) {
+ proc_t *p;
+
+ /*
+ * When we have privileges to the current process, there are
+ * several context-related kernel structures that are safe to
+ * read, even absent the privilege to read from kernel memory.
+ * These reads are safe because these structures contain only
+ * state that (1) we're permitted to read, (2) is harmless or
+ * (3) contains pointers to additional kernel state that we're
+ * not permitted to read (and as such, do not present an
+ * opportunity for privilege escalation). Finally (and
+ * critically), because of the nature of their relation with
+ * the current thread context, the memory associated with these
+ * structures cannot change over the duration of probe context,
+ * and it is therefore impossible for this memory to be
+ * deallocated and reallocated as something else while it's
+ * being operated upon.
+ */
+ if (DTRACE_INRANGE(addr, sz, curthread, sizeof (kthread_t)))
+ return (1);
+
+ if ((p = curthread->t_procp) != NULL && DTRACE_INRANGE(addr,
+ sz, curthread->t_procp, sizeof (proc_t))) {
+ return (1);
+ }
+
+ if (curthread->t_cred != NULL && DTRACE_INRANGE(addr, sz,
+ curthread->t_cred, sizeof (cred_t))) {
+ return (1);
+ }
+
+ if (p != NULL && p->p_pidp != NULL && DTRACE_INRANGE(addr, sz,
+ &(p->p_pidp->pid_id), sizeof (pid_t))) {
+ return (1);
+ }
+
+ if (curthread->t_cpu != NULL && DTRACE_INRANGE(addr, sz,
+ curthread->t_cpu, offsetof(cpu_t, cpu_pause_thread))) {
+ return (1);
+ }
+ }
+
+ if ((fp = mstate->dtms_getf) != NULL) {
+ uintptr_t psz = sizeof (void *);
+ vnode_t *vp;
+ vnodeops_t *op;
+
+ /*
+ * When getf() returns a file_t, the enabling is implicitly
+ * granted the (transient) right to read the returned file_t
+ * as well as the v_path and v_op->vnop_name of the underlying
+ * vnode. These accesses are allowed after a successful
+ * getf() because the members that they refer to cannot change
+ * once set -- and the barrier logic in the kernel's closef()
+ * path assures that the file_t and its referenced vode_t
+ * cannot themselves be stale (that is, it impossible for
+ * either dtms_getf itself or its f_vnode member to reference
+ * freed memory).
+ */
+ if (DTRACE_INRANGE(addr, sz, fp, sizeof (file_t)))
+ return (1);
+
+ if ((vp = fp->f_vnode) != NULL) {
+ if (DTRACE_INRANGE(addr, sz, &vp->v_path, psz))
+ return (1);
+
+ if (vp->v_path != NULL && DTRACE_INRANGE(addr, sz,
+ vp->v_path, strlen(vp->v_path) + 1)) {
+ return (1);
+ }
+
+ if (DTRACE_INRANGE(addr, sz, &vp->v_op, psz))
+ return (1);
+
+ if ((op = vp->v_op) != NULL &&
+ DTRACE_INRANGE(addr, sz, &op->vnop_name, psz)) {
+ return (1);
+ }
+
+ if (op != NULL && op->vnop_name != NULL &&
+ DTRACE_INRANGE(addr, sz, op->vnop_name,
+ strlen(op->vnop_name) + 1)) {
+ return (1);
+ }
+ }
+ }
+
DTRACE_CPUFLAG_SET(CPU_DTRACE_KPRIV);
*illval = addr;
return (0);
@@ -746,7 +845,7 @@ static int
dtrace_vcanload(void *src, dtrace_diftype_t *type, dtrace_mstate_t *mstate,
dtrace_vstate_t *vstate)
{
- size_t sz;
+ size_t sz, strsize;
ASSERT(type->dtdt_flags & DIF_TF_BYREF);
/*
@@ -756,16 +855,81 @@ dtrace_vcanload(void *src, dtrace_diftype_t *type, dtrace_mstate_t *mstate,
if ((mstate->dtms_access & DTRACE_ACCESS_KERNEL) != 0)
return (1);
- if (type->dtdt_kind == DIF_TYPE_STRING)
- sz = dtrace_strlen(src,
- vstate->dtvs_state->dts_options[DTRACEOPT_STRSIZE]) + 1;
- else
+ if (type->dtdt_kind == DIF_TYPE_STRING) {
+ dtrace_state_t *state = vstate->dtvs_state;
+
+ if (state != NULL) {
+ strsize = state->dts_options[DTRACEOPT_STRSIZE];
+ } else {
+ /*
+ * In helper context, we have a NULL state; fall back
+ * to using the system-wide default for the string size
+ * in this case.
+ */
+ strsize = dtrace_strsize_default;
+ }
+
+ sz = dtrace_strlen(src, strsize) + 1;
+ } else {
sz = type->dtdt_size;
+ }
return (dtrace_canload((uintptr_t)src, sz, mstate, vstate));
}
/*
+ * Convert a string to a signed integer using safe loads.
+ *
+ * NOTE: This function uses various macros from strtolctype.h to manipulate
+ * digit values, etc -- these have all been checked to ensure they make
+ * no additional function calls.
+ */
+static int64_t
+dtrace_strtoll(char *input, int base, size_t limit)
+{
+ uintptr_t pos = (uintptr_t)input;
+ int64_t val = 0;
+ int x;
+ boolean_t neg = B_FALSE;
+ char c, cc, ccc;
+ uintptr_t end = pos + limit;
+
+ /*
+ * Consume any whitespace preceding digits.
+ */
+ while ((c = dtrace_load8(pos)) == ' ' || c == '\t')
+ pos++;
+
+ /*
+ * Handle an explicit sign if one is present.
+ */
+ if (c == '-' || c == '+') {
+ if (c == '-')
+ neg = B_TRUE;
+ c = dtrace_load8(++pos);
+ }
+
+ /*
+ * Check for an explicit hexadecimal prefix ("0x" or "0X") and skip it
+ * if present.
+ */
+ if (base == 16 && c == '0' && ((cc = dtrace_load8(pos + 1)) == 'x' ||
+ cc == 'X') && isxdigit(ccc = dtrace_load8(pos + 2))) {
+ pos += 2;
+ c = ccc;
+ }
+
+ /*
+ * Read in contiguous digits until the first non-digit character.
+ */
+ for (; pos < end && c != '\0' && lisalnum(c) && (x = DIGIT(c)) < base;
+ c = dtrace_load8(++pos))
+ val = val * base + x;
+
+ return (neg ? -val : val);
+}
+
+/*
* Compare two strings using safe loads.
*/
static int
@@ -1085,8 +1249,7 @@ dtrace_priv_proc_common_zone(dtrace_state_t *state)
*/
ASSERT(s_cr != NULL);
- if ((cr = CRED()) != NULL &&
- s_cr->cr_zone == cr->cr_zone)
+ if ((cr = CRED()) != NULL && s_cr->cr_zone == cr->cr_zone)
return (1);
return (0);
@@ -1209,19 +1372,17 @@ dtrace_priv_probe(dtrace_state_t *state, dtrace_mstate_t *mstate,
mode = pops->dtps_mode(prov->dtpv_arg,
probe->dtpr_id, probe->dtpr_arg);
- ASSERT((mode & DTRACE_MODE_USER) ||
- (mode & DTRACE_MODE_KERNEL));
- ASSERT((mode & DTRACE_MODE_NOPRIV_RESTRICT) ||
- (mode & DTRACE_MODE_NOPRIV_DROP));
+ ASSERT(mode & (DTRACE_MODE_USER | DTRACE_MODE_KERNEL));
+ ASSERT(mode & (DTRACE_MODE_NOPRIV_RESTRICT |
+ DTRACE_MODE_NOPRIV_DROP));
}
/*
* If the dte_cond bits indicate that this consumer is only allowed to
- * see user-mode firings of this probe, call the provider's dtps_mode()
- * entry point to check that the probe was fired while in a user
- * context. If that's not the case, use the policy specified by the
- * provider to determine if we drop the probe or merely restrict
- * operation.
+ * see user-mode firings of this probe, check that the probe was fired
+ * while in a user context. If that's not the case, use the policy
+ * specified by the provider to determine if we drop the probe or
+ * merely restrict operation.
*/
if (ecb->dte_cond & DTRACE_COND_USERMODE) {
ASSERT(mode != DTRACE_MODE_NOPRIV_DROP);
@@ -1288,6 +1449,15 @@ dtrace_priv_probe(dtrace_state_t *state, dtrace_mstate_t *mstate,
}
}
+ /*
+ * By merits of being in this code path at all, we have limited
+ * privileges. If the provider has indicated that limited privileges
+ * are to denote restricted operation, strip off the ability to access
+ * arguments.
+ */
+ if (mode & DTRACE_MODE_LIMITEDPRIV_RESTRICT)
+ mstate->dtms_access &= ~DTRACE_ACCESS_ARGS;
+
return (1);
}
@@ -2924,7 +3094,7 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v,
}
case DIF_VAR_CURTHREAD:
- if (!dtrace_priv_kernel(state))
+ if (!dtrace_priv_proc(state, mstate))
return (0);
return ((uint64_t)(uintptr_t)curthread);
@@ -3236,6 +3406,463 @@ dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v,
}
}
+
+typedef enum dtrace_json_state {
+ DTRACE_JSON_REST = 1,
+ DTRACE_JSON_OBJECT,
+ DTRACE_JSON_STRING,
+ DTRACE_JSON_STRING_ESCAPE,
+ DTRACE_JSON_STRING_ESCAPE_UNICODE,
+ DTRACE_JSON_COLON,
+ DTRACE_JSON_COMMA,
+ DTRACE_JSON_VALUE,
+ DTRACE_JSON_IDENTIFIER,
+ DTRACE_JSON_NUMBER,
+ DTRACE_JSON_NUMBER_FRAC,
+ DTRACE_JSON_NUMBER_EXP,
+ DTRACE_JSON_COLLECT_OBJECT
+} dtrace_json_state_t;
+
+/*
+ * This function possesses just enough knowledge about JSON to extract a single
+ * value from a JSON string and store it in the scratch buffer. It is able
+ * to extract nested object values, and members of arrays by index.
+ *
+ * elemlist is a list of JSON keys, stored as packed NUL-terminated strings, to
+ * be looked up as we descend into the object tree. e.g.
+ *
+ * foo[0].bar.baz[32] --> "foo" NUL "0" NUL "bar" NUL "baz" NUL "32" NUL
+ * with nelems = 5.
+ *
+ * The run time of this function must be bounded above by strsize to limit the
+ * amount of work done in probe context. As such, it is implemented as a
+ * simple state machine, reading one character at a time using safe loads
+ * until we find the requested element, hit a parsing error or run off the
+ * end of the object or string.
+ *
+ * As there is no way for a subroutine to return an error without interrupting
+ * clause execution, we simply return NULL in the event of a missing key or any
+ * other error condition. Each NULL return in this function is commented with
+ * the error condition it represents -- parsing or otherwise.
+ *
+ * The set of states for the state machine closely matches the JSON
+ * specification (http://json.org/). Briefly:
+ *
+ * DTRACE_JSON_REST:
+ * Skip whitespace until we find either a top-level Object, moving
+ * to DTRACE_JSON_OBJECT; or an Array, moving to DTRACE_JSON_VALUE.
+ *
+ * DTRACE_JSON_OBJECT:
+ * Locate the next key String in an Object. Sets a flag to denote
+ * the next String as a key string and moves to DTRACE_JSON_STRING.
+ *
+ * DTRACE_JSON_COLON:
+ * Skip whitespace until we find the colon that separates key Strings
+ * from their values. Once found, move to DTRACE_JSON_VALUE.
+ *
+ * DTRACE_JSON_VALUE:
+ * Detects the type of the next value (String, Number, Identifier, Object
+ * or Array) and routes to the states that process that type. Here we also
+ * deal with the element selector list if we are requested to traverse down
+ * into the object tree.
+ *
+ * DTRACE_JSON_COMMA:
+ * Skip whitespace until we find the comma that separates key-value pairs
+ * in Objects (returning to DTRACE_JSON_OBJECT) or values in Arrays
+ * (similarly DTRACE_JSON_VALUE). All following literal value processing
+ * states return to this state at the end of their value, unless otherwise
+ * noted.
+ *
+ * DTRACE_JSON_NUMBER, DTRACE_JSON_NUMBER_FRAC, DTRACE_JSON_NUMBER_EXP:
+ * Processes a Number literal from the JSON, including any exponent
+ * component that may be present. Numbers are returned as strings, which
+ * may be passed to strtoll() if an integer is required.
+ *
+ * DTRACE_JSON_IDENTIFIER:
+ * Processes a "true", "false" or "null" literal in the JSON.
+ *
+ * DTRACE_JSON_STRING, DTRACE_JSON_STRING_ESCAPE,
+ * DTRACE_JSON_STRING_ESCAPE_UNICODE:
+ * Processes a String literal from the JSON, whether the String denotes
+ * a key, a value or part of a larger Object. Handles all escape sequences
+ * present in the specification, including four-digit unicode characters,
+ * but merely includes the escape sequence without converting it to the
+ * actual escaped character. If the String is flagged as a key, we
+ * move to DTRACE_JSON_COLON rather than DTRACE_JSON_COMMA.
+ *
+ * DTRACE_JSON_COLLECT_OBJECT:
+ * This state collects an entire Object (or Array), correctly handling
+ * embedded strings. If the full element selector list matches this nested
+ * object, we return the Object in full as a string. If not, we use this
+ * state to skip to the next value at this level and continue processing.
+ *
+ * NOTE: This function uses various macros from strtolctype.h to manipulate
+ * digit values, etc -- these have all been checked to ensure they make
+ * no additional function calls.
+ */
+static char *
+dtrace_json(uint64_t size, uintptr_t json, char *elemlist, int nelems,
+ char *dest)
+{
+ dtrace_json_state_t state = DTRACE_JSON_REST;
+ int64_t array_elem = INT64_MIN;
+ int64_t array_pos = 0;
+ uint8_t escape_unicount = 0;
+ boolean_t string_is_key = B_FALSE;
+ boolean_t collect_object = B_FALSE;
+ boolean_t found_key = B_FALSE;
+ boolean_t in_array = B_FALSE;
+ uint32_t braces = 0, brackets = 0;
+ char *elem = elemlist;
+ char *dd = dest;
+ uintptr_t cur;
+
+ for (cur = json; cur < json + size; cur++) {
+ char cc = dtrace_load8(cur);
+ if (cc == '\0')
+ return (NULL);
+
+ switch (state) {
+ case DTRACE_JSON_REST:
+ if (isspace(cc))
+ break;
+
+ if (cc == '{') {
+ state = DTRACE_JSON_OBJECT;
+ break;
+ }
+
+ if (cc == '[') {
+ in_array = B_TRUE;
+ array_pos = 0;
+ array_elem = dtrace_strtoll(elem, 10, size);
+ found_key = array_elem == 0 ? B_TRUE : B_FALSE;
+ state = DTRACE_JSON_VALUE;
+ break;
+ }
+
+ /*
+ * ERROR: expected to find a top-level object or array.
+ */
+ return (NULL);
+ case DTRACE_JSON_OBJECT:
+ if (isspace(cc))
+ break;
+
+ if (cc == '"') {
+ state = DTRACE_JSON_STRING;
+ string_is_key = B_TRUE;
+ break;
+ }
+
+ /*
+ * ERROR: either the object did not start with a key
+ * string, or we've run off the end of the object
+ * without finding the requested key.
+ */
+ return (NULL);
+ case DTRACE_JSON_STRING:
+ if (cc == '\\') {
+ *dd++ = '\\';
+ state = DTRACE_JSON_STRING_ESCAPE;
+ break;
+ }
+
+ if (cc == '"') {
+ if (collect_object) {
+ /*
+ * We don't reset the dest here, as
+ * the string is part of a larger
+ * object being collected.
+ */
+ *dd++ = cc;
+ collect_object = B_FALSE;
+ state = DTRACE_JSON_COLLECT_OBJECT;
+ break;
+ }
+ *dd = '\0';
+ dd = dest; /* reset string buffer */
+ if (string_is_key) {
+ if (dtrace_strncmp(dest, elem,
+ size) == 0)
+ found_key = B_TRUE;
+ } else if (found_key) {
+ if (nelems > 1) {
+ /*
+ * We expected an object, not
+ * this string.
+ */
+ return (NULL);
+ }
+ return (dest);
+ }
+ state = string_is_key ? DTRACE_JSON_COLON :
+ DTRACE_JSON_COMMA;
+ string_is_key = B_FALSE;
+ break;
+ }
+
+ *dd++ = cc;
+ break;
+ case DTRACE_JSON_STRING_ESCAPE:
+ *dd++ = cc;
+ if (cc == 'u') {
+ escape_unicount = 0;
+ state = DTRACE_JSON_STRING_ESCAPE_UNICODE;
+ } else {
+ state = DTRACE_JSON_STRING;
+ }
+ break;
+ case DTRACE_JSON_STRING_ESCAPE_UNICODE:
+ if (!isxdigit(cc)) {
+ /*
+ * ERROR: invalid unicode escape, expected
+ * four valid hexidecimal digits.
+ */
+ return (NULL);
+ }
+
+ *dd++ = cc;
+ if (++escape_unicount == 4)
+ state = DTRACE_JSON_STRING;
+ break;
+ case DTRACE_JSON_COLON:
+ if (isspace(cc))
+ break;
+
+ if (cc == ':') {
+ state = DTRACE_JSON_VALUE;
+ break;
+ }
+
+ /*
+ * ERROR: expected a colon.
+ */
+ return (NULL);
+ case DTRACE_JSON_COMMA:
+ if (isspace(cc))
+ break;
+
+ if (cc == ',') {
+ if (in_array) {
+ state = DTRACE_JSON_VALUE;
+ if (++array_pos == array_elem)
+ found_key = B_TRUE;
+ } else {
+ state = DTRACE_JSON_OBJECT;
+ }
+ break;
+ }
+
+ /*
+ * ERROR: either we hit an unexpected character, or
+ * we reached the end of the object or array without
+ * finding the requested key.
+ */
+ return (NULL);
+ case DTRACE_JSON_IDENTIFIER:
+ if (islower(cc)) {
+ *dd++ = cc;
+ break;
+ }
+
+ *dd = '\0';
+ dd = dest; /* reset string buffer */
+
+ if (dtrace_strncmp(dest, "true", 5) == 0 ||
+ dtrace_strncmp(dest, "false", 6) == 0 ||
+ dtrace_strncmp(dest, "null", 5) == 0) {
+ if (found_key) {
+ if (nelems > 1) {
+ /*
+ * ERROR: We expected an object,
+ * not this identifier.
+ */
+ return (NULL);
+ }
+ return (dest);
+ } else {
+ cur--;
+ state = DTRACE_JSON_COMMA;
+ break;
+ }
+ }
+
+ /*
+ * ERROR: we did not recognise the identifier as one
+ * of those in the JSON specification.
+ */
+ return (NULL);
+ case DTRACE_JSON_NUMBER:
+ if (cc == '.') {
+ *dd++ = cc;
+ state = DTRACE_JSON_NUMBER_FRAC;
+ break;
+ }
+
+ if (cc == 'x' || cc == 'X') {
+ /*
+ * ERROR: specification explicitly excludes
+ * hexidecimal or octal numbers.
+ */
+ return (NULL);
+ }
+
+ /* FALLTHRU */
+ case DTRACE_JSON_NUMBER_FRAC:
+ if (cc == 'e' || cc == 'E') {
+ *dd++ = cc;
+ state = DTRACE_JSON_NUMBER_EXP;
+ break;
+ }
+
+ if (cc == '+' || cc == '-') {
+ /*
+ * ERROR: expect sign as part of exponent only.
+ */
+ return (NULL);
+ }
+ /* FALLTHRU */
+ case DTRACE_JSON_NUMBER_EXP:
+ if (isdigit(cc) || cc == '+' || cc == '-') {
+ *dd++ = cc;
+ break;
+ }
+
+ *dd = '\0';
+ dd = dest; /* reset string buffer */
+ if (found_key) {
+ if (nelems > 1) {
+ /*
+ * ERROR: We expected an object, not
+ * this number.
+ */
+ return (NULL);
+ }
+ return (dest);
+ }
+
+ cur--;
+ state = DTRACE_JSON_COMMA;
+ break;
+ case DTRACE_JSON_VALUE:
+ if (isspace(cc))
+ break;
+
+ if (cc == '{' || cc == '[') {
+ if (nelems > 1 && found_key) {
+ in_array = cc == '[' ? B_TRUE : B_FALSE;
+ /*
+ * If our element selector directs us
+ * to descend into this nested object,
+ * then move to the next selector
+ * element in the list and restart the
+ * state machine.
+ */
+ while (*elem != '\0')
+ elem++;
+ elem++; /* skip the inter-element NUL */
+ nelems--;
+ dd = dest;
+ if (in_array) {
+ state = DTRACE_JSON_VALUE;
+ array_pos = 0;
+ array_elem = dtrace_strtoll(
+ elem, 10, size);
+ found_key = array_elem == 0 ?
+ B_TRUE : B_FALSE;
+ } else {
+ found_key = B_FALSE;
+ state = DTRACE_JSON_OBJECT;
+ }
+ break;
+ }
+
+ /*
+ * Otherwise, we wish to either skip this
+ * nested object or return it in full.
+ */
+ if (cc == '[')
+ brackets = 1;
+ else
+ braces = 1;
+ *dd++ = cc;
+ state = DTRACE_JSON_COLLECT_OBJECT;
+ break;
+ }
+
+ if (cc == '"') {
+ state = DTRACE_JSON_STRING;
+ break;
+ }
+
+ if (islower(cc)) {
+ /*
+ * Here we deal with true, false and null.
+ */
+ *dd++ = cc;
+ state = DTRACE_JSON_IDENTIFIER;
+ break;
+ }
+
+ if (cc == '-' || isdigit(cc)) {
+ *dd++ = cc;
+ state = DTRACE_JSON_NUMBER;
+ break;
+ }
+
+ /*
+ * ERROR: unexpected character at start of value.
+ */
+ return (NULL);
+ case DTRACE_JSON_COLLECT_OBJECT:
+ if (cc == '\0')
+ /*
+ * ERROR: unexpected end of input.
+ */
+ return (NULL);
+
+ *dd++ = cc;
+ if (cc == '"') {
+ collect_object = B_TRUE;
+ state = DTRACE_JSON_STRING;
+ break;
+ }
+
+ if (cc == ']') {
+ if (brackets-- == 0) {
+ /*
+ * ERROR: unbalanced brackets.
+ */
+ return (NULL);
+ }
+ } else if (cc == '}') {
+ if (braces-- == 0) {
+ /*
+ * ERROR: unbalanced braces.
+ */
+ return (NULL);
+ }
+ } else if (cc == '{') {
+ braces++;
+ } else if (cc == '[') {
+ brackets++;
+ }
+
+ if (brackets == 0 && braces == 0) {
+ if (found_key) {
+ *dd = '\0';
+ return (dest);
+ }
+ dd = dest; /* reset string buffer */
+ state = DTRACE_JSON_COMMA;
+ }
+ break;
+ }
+ }
+ return (NULL);
+}
+
/*
* Emulate the execution of DTrace ID subroutines invoked by the call opcode.
* Notice that we don't bother validating the proper number of arguments or
@@ -3936,6 +4563,65 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs,
break;
}
+ case DIF_SUBR_JSON: {
+ uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+ uintptr_t json = tupregs[0].dttk_value;
+ size_t jsonlen = dtrace_strlen((char *)json, size);
+ uintptr_t elem = tupregs[1].dttk_value;
+ size_t elemlen = dtrace_strlen((char *)elem, size);
+
+ char *dest = (char *)mstate->dtms_scratch_ptr;
+ char *elemlist = (char *)mstate->dtms_scratch_ptr + jsonlen + 1;
+ char *ee = elemlist;
+ int nelems = 1;
+ uintptr_t cur;
+
+ if (!dtrace_canload(json, jsonlen + 1, mstate, vstate) ||
+ !dtrace_canload(elem, elemlen + 1, mstate, vstate)) {
+ regs[rd] = NULL;
+ break;
+ }
+
+ if (!DTRACE_INSCRATCH(mstate, jsonlen + 1 + elemlen + 1)) {
+ DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+ regs[rd] = NULL;
+ break;
+ }
+
+ /*
+ * Read the element selector and split it up into a packed list
+ * of strings.
+ */
+ for (cur = elem; cur < elem + elemlen; cur++) {
+ char cc = dtrace_load8(cur);
+
+ if (cur == elem && cc == '[') {
+ /*
+ * If the first element selector key is
+ * actually an array index then ignore the
+ * bracket.
+ */
+ continue;
+ }
+
+ if (cc == ']')
+ continue;
+
+ if (cc == '.' || cc == '[') {
+ nelems++;
+ cc = '\0';
+ }
+
+ *ee++ = cc;
+ }
+ *ee++ = '\0';
+
+ if ((regs[rd] = (uintptr_t)dtrace_json(size, json, elemlist,
+ nelems, dest)) != NULL)
+ mstate->dtms_scratch_ptr += jsonlen + 1;
+ break;
+ }
+
case DIF_SUBR_TOUPPER:
case DIF_SUBR_TOLOWER: {
uintptr_t s = tupregs[0].dttk_value;
@@ -4243,6 +4929,28 @@ case DIF_SUBR_GETMAJOR:
break;
}
+ case DIF_SUBR_STRTOLL: {
+ uintptr_t s = tupregs[0].dttk_value;
+ uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+ int base = 10;
+
+ if (nargs > 1) {
+ if ((base = tupregs[1].dttk_value) <= 1 ||
+ base > ('z' - 'a' + 1) + ('9' - '0' + 1)) {
+ *flags |= CPU_DTRACE_ILLOP;
+ break;
+ }
+ }
+
+ if (!dtrace_strcanload(s, size, mstate, vstate)) {
+ regs[rd] = INT64_MIN;
+ break;
+ }
+
+ regs[rd] = dtrace_strtoll((char *)s, base, size);
+ break;
+ }
+
case DIF_SUBR_LLTOSTR: {
int64_t i = (int64_t)tupregs[0].dttk_value;
uint64_t val, digit;
@@ -4452,11 +5160,35 @@ case DIF_SUBR_GETMAJOR:
break;
}
+ case DIF_SUBR_GETF: {
+ uintptr_t fd = tupregs[0].dttk_value;
+ uf_info_t *finfo = &curthread->t_procp->p_user.u_finfo;
+ file_t *fp;
+
+ if (!dtrace_priv_proc(state, mstate)) {
+ regs[rd] = NULL;
+ break;
+ }
+
+ /*
+ * This is safe because fi_nfiles only increases, and the
+ * fi_list array is not freed when the array size doubles.
+ * (See the comment in flist_grow() for details on the
+ * management of the u_finfo structure.)
+ */
+ fp = fd < finfo->fi_nfiles ? finfo->fi_list[fd].uf_file : NULL;
+
+ mstate->dtms_getf = fp;
+ regs[rd] = (uintptr_t)fp;
+ break;
+ }
+
case DIF_SUBR_CLEANPATH: {
char *dest = (char *)mstate->dtms_scratch_ptr, c;
uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
uintptr_t src = tupregs[0].dttk_value;
int i = 0, j = 0;
+ zone_t *z;
if (!dtrace_strcanload(src, size, mstate, vstate)) {
regs[rd] = NULL;
@@ -4555,6 +5287,23 @@ next:
} while (c != '\0');
dest[j] = '\0';
+
+ if (mstate->dtms_getf != NULL &&
+ !(mstate->dtms_access & DTRACE_ACCESS_KERNEL) &&
+ (z = state->dts_cred.dcr_cred->cr_zone) != kcred->cr_zone) {
+ /*
+ * If we've done a getf() as a part of this ECB and we
+ * don't have kernel access (and we're not in the global
+ * zone), check if the path we cleaned up begins with
+ * the zone's root path, and trim it off if so. Note
+ * that this is an output cleanliness issue, not a
+ * security issue: knowing one's zone root path does
+ * not enable privilege escalation.
+ */
+ if (strstr(dest, z->zone_rootpath) == dest)
+ dest += strlen(z->zone_rootpath) - 1;
+ }
+
regs[rd] = (uintptr_t)dest;
mstate->dtms_scratch_ptr += size;
break;
@@ -4939,71 +5688,50 @@ dtrace_dif_emulate(dtrace_difo_t *difo, dtrace_mstate_t *mstate,
pc = DIF_INSTR_LABEL(instr);
break;
case DIF_OP_RLDSB:
- if (!dtrace_canstore(regs[r1], 1, mstate, vstate)) {
- *flags |= CPU_DTRACE_KPRIV;
- *illval = regs[r1];
+ if (!dtrace_canload(regs[r1], 1, mstate, vstate))
break;
- }
/*FALLTHROUGH*/
case DIF_OP_LDSB:
regs[rd] = (int8_t)dtrace_load8(regs[r1]);
break;
case DIF_OP_RLDSH:
- if (!dtrace_canstore(regs[r1], 2, mstate, vstate)) {
- *flags |= CPU_DTRACE_KPRIV;
- *illval = regs[r1];
+ if (!dtrace_canload(regs[r1], 2, mstate, vstate))
break;
- }
/*FALLTHROUGH*/
case DIF_OP_LDSH:
regs[rd] = (int16_t)dtrace_load16(regs[r1]);
break;
case DIF_OP_RLDSW:
- if (!dtrace_canstore(regs[r1], 4, mstate, vstate)) {
- *flags |= CPU_DTRACE_KPRIV;
- *illval = regs[r1];
+ if (!dtrace_canload(regs[r1], 4, mstate, vstate))
break;
- }
/*FALLTHROUGH*/
case DIF_OP_LDSW:
regs[rd] = (int32_t)dtrace_load32(regs[r1]);
break;
case DIF_OP_RLDUB:
- if (!dtrace_canstore(regs[r1], 1, mstate, vstate)) {
- *flags |= CPU_DTRACE_KPRIV;
- *illval = regs[r1];
+ if (!dtrace_canload(regs[r1], 1, mstate, vstate))
break;
- }
/*FALLTHROUGH*/
case DIF_OP_LDUB:
regs[rd] = dtrace_load8(regs[r1]);
break;
case DIF_OP_RLDUH:
- if (!dtrace_canstore(regs[r1], 2, mstate, vstate)) {
- *flags |= CPU_DTRACE_KPRIV;
- *illval = regs[r1];
+ if (!dtrace_canload(regs[r1], 2, mstate, vstate))
break;
- }
/*FALLTHROUGH*/
case DIF_OP_LDUH:
regs[rd] = dtrace_load16(regs[r1]);
break;
case DIF_OP_RLDUW:
- if (!dtrace_canstore(regs[r1], 4, mstate, vstate)) {
- *flags |= CPU_DTRACE_KPRIV;
- *illval = regs[r1];
+ if (!dtrace_canload(regs[r1], 4, mstate, vstate))
break;
- }
/*FALLTHROUGH*/
case DIF_OP_LDUW:
regs[rd] = dtrace_load32(regs[r1]);
break;
case DIF_OP_RLDX:
- if (!dtrace_canstore(regs[r1], 8, mstate, vstate)) {
- *flags |= CPU_DTRACE_KPRIV;
- *illval = regs[r1];
+ if (!dtrace_canload(regs[r1], 8, mstate, vstate))
break;
- }
/*FALLTHROUGH*/
case DIF_OP_LDX:
regs[rd] = dtrace_load64(regs[r1]);
@@ -5942,6 +6670,8 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1,
mstate.dtms_present = DTRACE_MSTATE_ARGS | DTRACE_MSTATE_PROBE;
mstate.dtms_access = DTRACE_ACCESS_ARGS | DTRACE_ACCESS_PROC;
+ mstate.dtms_getf = NULL;
+
*flags &= ~CPU_DTRACE_ERROR;
if (prov == dtrace_provider) {
@@ -6741,7 +7471,7 @@ dtrace_cred2priv(cred_t *cr, uint32_t *privp, uid_t *uidp, zoneid_t *zoneidp)
priv = DTRACE_PRIV_ALL;
} else {
*uidp = crgetuid(cr);
- *zoneidp = crgetzoneid(cr);
+ *zoneidp = crgetzonedid(cr);
priv = 0;
if (PRIV_POLICY_ONLY(cr, PRIV_DTRACE_KERNEL, B_FALSE))
@@ -7237,7 +7967,7 @@ dtrace_register(const char *name, const dtrace_pattr_t *pap, uint32_t priv,
provider->dtpv_priv.dtpp_flags = priv;
if (cr != NULL) {
provider->dtpv_priv.dtpp_uid = crgetuid(cr);
- provider->dtpv_priv.dtpp_zoneid = crgetzoneid(cr);
+ provider->dtpv_priv.dtpp_zoneid = crgetzonedid(cr);
}
provider->dtpv_pops = *pops;
@@ -7848,6 +8578,7 @@ dtrace_probe_enable(const dtrace_probedesc_t *desc, dtrace_enabling_t *enab)
uint32_t priv;
uid_t uid;
zoneid_t zoneid;
+ dtrace_state_t *state = enab->dten_vstate->dtvs_state;
ASSERT(MUTEX_HELD(&dtrace_lock));
dtrace_ecb_create_cache = NULL;
@@ -7862,8 +8593,22 @@ dtrace_probe_enable(const dtrace_probedesc_t *desc, dtrace_enabling_t *enab)
}
dtrace_probekey(desc, &pkey);
- dtrace_cred2priv(enab->dten_vstate->dtvs_state->dts_cred.dcr_cred,
- &priv, &uid, &zoneid);
+ dtrace_cred2priv(state->dts_cred.dcr_cred, &priv, &uid, &zoneid);
+
+ if ((priv & DTRACE_PRIV_ZONEOWNER) &&
+ state->dts_options[DTRACEOPT_ZONE] != DTRACEOPT_UNSET) {
+ /*
+ * If we have the privilege of instrumenting all zones but we
+ * have been told to instrument but one, we will spoof this up
+ * depriving ourselves of DTRACE_PRIV_ZONEOWNER for purposes
+ * of dtrace_match(). (Note that DTRACEOPT_ZONE is not for
+ * security but rather for performance: it allows the global
+ * zone to instrument USDT probes in a local zone without
+ * requiring all zones to be instrumented.)
+ */
+ priv &= ~DTRACE_PRIV_ZONEOWNER;
+ zoneid = state->dts_options[DTRACEOPT_ZONE];
+ }
return (dtrace_match(&pkey, priv, uid, zoneid, dtrace_ecb_create_enable,
enab));
@@ -8448,6 +9193,20 @@ dtrace_difo_validate(dtrace_difo_t *dp, dtrace_vstate_t *vstate, uint_t nregs,
subr == DIF_SUBR_COPYOUTSTR) {
dp->dtdo_destructive = 1;
}
+
+ if (subr == DIF_SUBR_GETF) {
+ /*
+ * If we have a getf() we need to record that
+ * in our state. Note that our state can be
+ * NULL if this is a helper -- but in that
+ * case, the call to getf() is itself illegal,
+ * and will be caught (slightly later) when
+ * the helper is validated.
+ */
+ if (vstate->dtvs_state != NULL)
+ vstate->dtvs_state->dts_getf++;
+ }
+
break;
case DIF_OP_PUSHTR:
if (type != DIF_TYPE_STRING && type != DIF_TYPE_CTF)
@@ -8726,7 +9485,9 @@ dtrace_difo_validate_helper(dtrace_difo_t *dp)
subr == DIF_SUBR_INET_NTOA ||
subr == DIF_SUBR_INET_NTOA6 ||
subr == DIF_SUBR_INET_NTOP ||
+ subr == DIF_SUBR_JSON ||
subr == DIF_SUBR_LLTOSTR ||
+ subr == DIF_SUBR_STRTOLL ||
subr == DIF_SUBR_RINDEX ||
subr == DIF_SUBR_STRCHR ||
subr == DIF_SUBR_STRJOIN ||
@@ -13090,6 +13851,22 @@ dtrace_state_go(dtrace_state_t *state, processorid_t *cpu)
state->dts_activity = DTRACE_ACTIVITY_WARMUP;
+ if (state->dts_getf != 0 &&
+ !(state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL)) {
+ /*
+ * We don't have kernel privs but we have at least one call
+ * to getf(); we need to bump our zone's count, and (if
+ * this is the first enabling to have an unprivileged call
+ * to getf()) we need to hook into closef().
+ */
+ state->dts_cred.dcr_cred->cr_zone->zone_dtrace_getf++;
+
+ if (dtrace_getf++ == 0) {
+ ASSERT(dtrace_closef == NULL);
+ dtrace_closef = dtrace_getf_barrier;
+ }
+ }
+
/*
* Now it's time to actually fire the BEGIN probe. We need to disable
* interrupts here both to record the CPU on which we fired the BEGIN
@@ -13206,6 +13983,24 @@ dtrace_state_stop(dtrace_state_t *state, processorid_t *cpu)
state->dts_activity = DTRACE_ACTIVITY_STOPPED;
dtrace_sync();
+ if (state->dts_getf != 0 &&
+ !(state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL)) {
+ /*
+ * We don't have kernel privs but we have at least one call
+ * to getf(); we need to lower our zone's count, and (if
+ * this is the last enabling to have an unprivileged call
+ * to getf()) we need to clear the closef() hook.
+ */
+ ASSERT(state->dts_cred.dcr_cred->cr_zone->zone_dtrace_getf > 0);
+ ASSERT(dtrace_closef == dtrace_getf_barrier);
+ ASSERT(dtrace_getf > 0);
+
+ state->dts_cred.dcr_cred->cr_zone->zone_dtrace_getf--;
+
+ if (--dtrace_getf == 0)
+ dtrace_closef = NULL;
+ }
+
return (0);
}
@@ -13512,10 +14307,10 @@ dtrace_helper_trace(dtrace_helper_action_t *helper,
dtrace_mstate_t *mstate, dtrace_vstate_t *vstate, int where)
{
uint32_t size, next, nnext, i;
- dtrace_helptrace_t *ent;
+ dtrace_helptrace_t *ent, *buffer;
uint16_t flags = cpu_core[CPU->cpu_id].cpuc_dtrace_flags;
- if (!dtrace_helptrace_enabled)
+ if ((buffer = dtrace_helptrace_buffer) == NULL)
return;
ASSERT(vstate->dtvs_nlocals <= dtrace_helptrace_nlocals);
@@ -13543,10 +14338,12 @@ dtrace_helper_trace(dtrace_helper_action_t *helper,
/*
* We have our slot; fill it in.
*/
- if (nnext == size)
+ if (nnext == size) {
+ dtrace_helptrace_wrapped++;
next = 0;
+ }
- ent = (dtrace_helptrace_t *)&dtrace_helptrace_buffer[next];
+ ent = (dtrace_helptrace_t *)((uintptr_t)buffer + next);
ent->dtht_helper = helper;
ent->dtht_where = where;
ent->dtht_nlocals = vstate->dtvs_nlocals;
@@ -13580,7 +14377,7 @@ dtrace_helper(int which, dtrace_mstate_t *mstate,
dtrace_helper_action_t *helper;
dtrace_vstate_t *vstate;
dtrace_difo_t *pred;
- int i, trace = dtrace_helptrace_enabled;
+ int i, trace = dtrace_helptrace_buffer != NULL;
ASSERT(which >= 0 && which < DTRACE_NHELPER_ACTIONS);
@@ -13941,8 +14738,8 @@ dtrace_helper_provider_add(dof_helper_t *dofhp, int gen)
* Check to make sure this isn't a duplicate.
*/
for (i = 0; i < help->dthps_nprovs; i++) {
- if (dofhp->dofhp_addr ==
- help->dthps_provs[i]->dthp_prov.dofhp_addr)
+ if (dofhp->dofhp_dof ==
+ help->dthps_provs[i]->dthp_prov.dofhp_dof)
return (EALREADY);
}
@@ -14766,6 +15563,23 @@ dtrace_toxrange_add(uintptr_t base, uintptr_t limit)
dtrace_toxranges++;
}
+static void
+dtrace_getf_barrier()
+{
+ /*
+ * When we have unprivileged (that is, non-DTRACE_CRV_KERNEL) enablings
+ * that contain calls to getf(), this routine will be called on every
+ * closef() before either the underlying vnode is released or the
+ * file_t itself is freed. By the time we are here, it is essential
+ * that the file_t can no longer be accessed from a call to getf()
+ * in probe context -- that assures that a dtrace_sync() can be used
+ * to clear out any enablings referring to the old structures.
+ */
+ if (curthread->t_procp->p_zone->zone_dtrace_getf != 0 ||
+ kcred->cr_zone->zone_dtrace_getf != 0)
+ dtrace_sync();
+}
+
/*
* DTrace Driver Cookbook Functions
*/
@@ -14880,17 +15694,6 @@ dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
mutex_exit(&cpu_lock);
/*
- * If DTrace helper tracing is enabled, we need to allocate the
- * trace buffer and initialize the values.
- */
- if (dtrace_helptrace_enabled) {
- ASSERT(dtrace_helptrace_buffer == NULL);
- dtrace_helptrace_buffer =
- kmem_zalloc(dtrace_helptrace_bufsize, KM_SLEEP);
- dtrace_helptrace_next = 0;
- }
-
- /*
* If there are already providers, we must ask them to provide their
* probes, and then match any anonymous enabling against them. Note
* that there should be no other retained enablings at this time:
@@ -14986,6 +15789,18 @@ dtrace_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
return (EBUSY);
}
+ if (dtrace_helptrace_enable && dtrace_helptrace_buffer == NULL) {
+ /*
+ * If DTrace helper tracing is enabled, we need to allocate the
+ * trace buffer and initialize the values.
+ */
+ dtrace_helptrace_buffer =
+ kmem_zalloc(dtrace_helptrace_bufsize, KM_SLEEP);
+ dtrace_helptrace_next = 0;
+ dtrace_helptrace_wrapped = 0;
+ dtrace_helptrace_enable = 0;
+ }
+
state = dtrace_state_create(devp, cred_p);
mutex_exit(&cpu_lock);
@@ -15007,6 +15822,7 @@ dtrace_close(dev_t dev, int flag, int otyp, cred_t *cred_p)
{
minor_t minor = getminor(dev);
dtrace_state_t *state;
+ dtrace_helptrace_t *buf = NULL;
if (minor == DTRACEMNRN_HELPER)
return (0);
@@ -15024,6 +15840,18 @@ dtrace_close(dev_t dev, int flag, int otyp, cred_t *cred_p)
dtrace_state_destroy(state->dts_anon);
}
+ if (dtrace_helptrace_disable) {
+ /*
+ * If we have been told to disable helper tracing, set the
+ * buffer to NULL before calling into dtrace_state_destroy();
+ * we take advantage of its dtrace_sync() to know that no
+ * CPU is in probe context with enabled helper tracing
+ * after it returns.
+ */
+ buf = dtrace_helptrace_buffer;
+ dtrace_helptrace_buffer = NULL;
+ }
+
dtrace_state_destroy(state);
ASSERT(dtrace_opens > 0);
@@ -15034,6 +15862,11 @@ dtrace_close(dev_t dev, int flag, int otyp, cred_t *cred_p)
if (--dtrace_opens == 0 && dtrace_anon.dta_enabling == NULL)
(void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE);
+ if (buf != NULL) {
+ kmem_free(buf, dtrace_helptrace_bufsize);
+ dtrace_helptrace_disable = 0;
+ }
+
mutex_exit(&dtrace_lock);
mutex_exit(&cpu_lock);
@@ -15922,12 +16755,10 @@ dtrace_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
dtrace_modload = NULL;
dtrace_modunload = NULL;
- mutex_exit(&cpu_lock);
+ ASSERT(dtrace_getf == 0);
+ ASSERT(dtrace_closef == NULL);
- if (dtrace_helptrace_enabled) {
- kmem_free(dtrace_helptrace_buffer, dtrace_helptrace_bufsize);
- dtrace_helptrace_buffer = NULL;
- }
+ mutex_exit(&cpu_lock);
kmem_free(dtrace_probes, dtrace_nprobes * sizeof (dtrace_probe_t *));
dtrace_probes = NULL;
diff --git a/usr/src/uts/common/dtrace/sdt_subr.c b/usr/src/uts/common/dtrace/sdt_subr.c
index 242185071b..157acc25fc 100644
--- a/usr/src/uts/common/dtrace/sdt_subr.c
+++ b/usr/src/uts/common/dtrace/sdt_subr.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/sdt_impl.h>
@@ -97,26 +98,26 @@ static dtrace_pattr_t iscsi_attr = {
};
sdt_provider_t sdt_providers[] = {
- { "vtrace", "__vtrace_", &vtrace_attr, 0 },
- { "sysinfo", "__cpu_sysinfo_", &info_attr, 0 },
- { "vminfo", "__cpu_vminfo_", &info_attr, 0 },
- { "fpuinfo", "__fpuinfo_", &fpu_attr, 0 },
- { "sched", "__sched_", &stab_attr, 0 },
- { "proc", "__proc_", &stab_attr, 0 },
- { "io", "__io_", &stab_attr, 0 },
- { "ip", "__ip_", &stab_attr, 0 },
- { "tcp", "__tcp_", &stab_attr, 0 },
- { "udp", "__udp_", &stab_attr, 0 },
- { "mib", "__mib_", &stab_attr, 0 },
- { "fsinfo", "__fsinfo_", &fsinfo_attr, 0 },
- { "iscsi", "__iscsi_", &iscsi_attr, 0 },
- { "nfsv3", "__nfsv3_", &stab_attr, 0 },
- { "nfsv4", "__nfsv4_", &stab_attr, 0 },
- { "xpv", "__xpv_", &xpv_attr, 0 },
- { "fc", "__fc_", &fc_attr, 0 },
- { "srp", "__srp_", &fc_attr, 0 },
- { "sysevent", "__sysevent_", &stab_attr, 0 },
- { "sdt", NULL, &sdt_attr, 0 },
+ { "vtrace", "__vtrace_", &vtrace_attr },
+ { "sysinfo", "__cpu_sysinfo_", &info_attr, DTRACE_PRIV_USER },
+ { "vminfo", "__cpu_vminfo_", &info_attr, DTRACE_PRIV_USER },
+ { "fpuinfo", "__fpuinfo_", &fpu_attr },
+ { "sched", "__sched_", &stab_attr, DTRACE_PRIV_USER },
+ { "proc", "__proc_", &stab_attr, DTRACE_PRIV_USER },
+ { "io", "__io_", &stab_attr },
+ { "ip", "__ip_", &stab_attr },
+ { "tcp", "__tcp_", &stab_attr },
+ { "udp", "__udp_", &stab_attr },
+ { "mib", "__mib_", &stab_attr },
+ { "fsinfo", "__fsinfo_", &fsinfo_attr },
+ { "iscsi", "__iscsi_", &iscsi_attr },
+ { "nfsv3", "__nfsv3_", &stab_attr },
+ { "nfsv4", "__nfsv4_", &stab_attr },
+ { "xpv", "__xpv_", &xpv_attr },
+ { "fc", "__fc_", &fc_attr },
+ { "srp", "__srp_", &fc_attr },
+ { "sysevent", "__sysevent_", &stab_attr },
+ { "sdt", NULL, &sdt_attr },
{ NULL }
};
@@ -1155,6 +1156,20 @@ sdt_argdesc_t sdt_args[] = {
};
/*ARGSUSED*/
+int
+sdt_mode(void *arg, dtrace_id_t id, void *parg)
+{
+ /*
+ * We tell DTrace that we're in kernel mode, that the firing needs to
+ * be dropped for anything that doesn't have necessary privileges, and
+ * that it needs to be restricted for anything that has restricted
+ * (i.e., not all-zone) privileges.
+ */
+ return (DTRACE_MODE_KERNEL | DTRACE_MODE_NOPRIV_DROP |
+ DTRACE_MODE_LIMITEDPRIV_RESTRICT);
+}
+
+/*ARGSUSED*/
void
sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc)
{
diff --git a/usr/src/uts/common/fs/dev/sdev_subr.c b/usr/src/uts/common/fs/dev/sdev_subr.c
index b814175e8a..f29918e351 100644
--- a/usr/src/uts/common/fs/dev/sdev_subr.c
+++ b/usr/src/uts/common/fs/dev/sdev_subr.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -537,7 +538,7 @@ static struct sdev_vop_table vtab[] =
SDEV_DYNAMIC | SDEV_VTOR },
{ "zvol", devzvol_vnodeops_tbl, NULL, &devzvol_vnodeops,
- devzvol_validate, SDEV_DYNAMIC | SDEV_VTOR | SDEV_SUBDIR },
+ devzvol_validate, SDEV_ZONED | SDEV_DYNAMIC | SDEV_VTOR | SDEV_SUBDIR },
{ "zcons", NULL, NULL, NULL, NULL, SDEV_NO_NCACHE },
diff --git a/usr/src/uts/common/fs/dev/sdev_vnops.c b/usr/src/uts/common/fs/dev/sdev_vnops.c
index fb1d93d06b..89c5decbf0 100644
--- a/usr/src/uts/common/fs/dev/sdev_vnops.c
+++ b/usr/src/uts/common/fs/dev/sdev_vnops.c
@@ -1142,9 +1142,21 @@ sdev_readdir(struct vnode *dvp, struct uio *uiop, struct cred *cred, int *eofp,
struct sdev_node *parent = VTOSDEV(dvp);
int error;
- /* execute access is required to search the directory */
- if ((error = VOP_ACCESS(dvp, VEXEC, 0, cred, ct)) != 0)
- return (error);
+ /*
+ * We must check that we have execute access to search the directory --
+ * but because our sdev_contents lock is already held as a reader (the
+ * caller must have done a VOP_RWLOCK()), we call directly into the
+ * underlying access routine if sdev_attr is non-NULL.
+ */
+ if (parent->sdev_attr != NULL) {
+ VERIFY(RW_READ_HELD(&parent->sdev_contents));
+
+ if (sdev_unlocked_access(parent, VEXEC, cred) != 0)
+ return (EACCES);
+ } else {
+ if ((error = VOP_ACCESS(dvp, VEXEC, 0, cred, ct)) != 0)
+ return (error);
+ }
ASSERT(parent);
if (!SDEV_IS_GLOBAL(parent))
diff --git a/usr/src/uts/common/fs/dev/sdev_zvolops.c b/usr/src/uts/common/fs/dev/sdev_zvolops.c
index 89ce67dd68..192b794c67 100644
--- a/usr/src/uts/common/fs/dev/sdev_zvolops.c
+++ b/usr/src/uts/common/fs/dev/sdev_zvolops.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2013 Joyent, Inc. All rights reserved.
*/
/* vnode ops for the /dev/zvol directory */
@@ -47,6 +48,7 @@ static ldi_ident_t devzvol_li;
static ldi_handle_t devzvol_lh;
static kmutex_t devzvol_mtx;
static boolean_t devzvol_isopen;
+static major_t devzvol_major;
/*
* we need to use ddi_mod* since fs/dev gets loaded early on in
@@ -61,12 +63,16 @@ int (*szn2m)(char *, minor_t *);
int
sdev_zvol_create_minor(char *dsname)
{
+ if (szcm == NULL)
+ return (-1);
return ((*szcm)(dsname));
}
int
sdev_zvol_name2minor(char *dsname, minor_t *minor)
{
+ if (szn2m == NULL)
+ return (-1);
return ((*szn2m)(dsname, minor));
}
@@ -74,6 +80,7 @@ int
devzvol_open_zfs()
{
int rc;
+ dev_t dv;
devzvol_li = ldi_ident_from_anon();
if (ldi_open_by_name("/dev/zfs", FREAD | FWRITE, kcred,
@@ -94,6 +101,9 @@ devzvol_open_zfs()
cmn_err(CE_WARN, "couldn't resolve zvol_name2minor");
return (rc);
}
+ if (ldi_get_dev(devzvol_lh, &dv))
+ return (-1);
+ devzvol_major = getmajor(dv);
return (0);
}
@@ -270,6 +280,8 @@ devzvol_validate(struct sdev_node *dv)
sdcmn_err13((" v_type %d do_type %d",
SDEVTOV(dv)->v_type, do_type));
if ((SDEVTOV(dv)->v_type == VLNK && do_type != DMU_OST_ZVOL) ||
+ ((SDEVTOV(dv)->v_type == VBLK || SDEVTOV(dv)->v_type == VCHR) &&
+ do_type != DMU_OST_ZVOL) ||
(SDEVTOV(dv)->v_type == VDIR && do_type == DMU_OST_ZVOL)) {
kmem_free(dsname, strlen(dsname) + 1);
return (SDEV_VTOR_STALE);
@@ -486,6 +498,82 @@ devzvol_prunedir(struct sdev_node *ddv)
rw_downgrade(&ddv->sdev_contents);
}
+/*
+ * This function is used to create a dir or dev inside a zone's /dev when the
+ * zone has a zvol that is dynamically created within the zone (i.e. inside
+ * of a delegated dataset. Since there is no /devices tree within a zone,
+ * we create the chr/blk devices directly inside the zone's /dev instead of
+ * making symlinks.
+ */
+static int
+devzvol_mk_ngz_node(struct sdev_node *parent, char *nm)
+{
+ struct vattr vattr;
+ timestruc_t now;
+ enum vtype expected_type = VDIR;
+ dmu_objset_type_t do_type;
+ struct sdev_node *dv = NULL;
+ int res;
+ char *dsname;
+
+ bzero(&vattr, sizeof (vattr));
+ gethrestime(&now);
+ vattr.va_mask = AT_TYPE|AT_MODE|AT_UID|AT_GID;
+ vattr.va_uid = SDEV_UID_DEFAULT;
+ vattr.va_gid = SDEV_GID_DEFAULT;
+ vattr.va_type = VNON;
+ vattr.va_atime = now;
+ vattr.va_mtime = now;
+ vattr.va_ctime = now;
+
+ if ((dsname = devzvol_make_dsname(parent->sdev_path, nm)) == NULL)
+ return (ENOENT);
+
+ if (devzvol_objset_check(dsname, &do_type) != 0) {
+ kmem_free(dsname, strlen(dsname) + 1);
+ return (ENOENT);
+ }
+ if (do_type == DMU_OST_ZVOL)
+ expected_type = VBLK;
+
+ if (expected_type == VDIR) {
+ vattr.va_type = VDIR;
+ vattr.va_mode = SDEV_DIRMODE_DEFAULT;
+ } else {
+ minor_t minor;
+ dev_t devnum;
+ int rc;
+
+ rc = sdev_zvol_create_minor(dsname);
+ if ((rc != 0 && rc != EEXIST && rc != EBUSY) ||
+ sdev_zvol_name2minor(dsname, &minor)) {
+ kmem_free(dsname, strlen(dsname) + 1);
+ return (ENOENT);
+ }
+
+ devnum = makedevice(devzvol_major, minor);
+ vattr.va_rdev = devnum;
+
+ if (strstr(parent->sdev_path, "/rdsk/") != NULL)
+ vattr.va_type = VCHR;
+ else
+ vattr.va_type = VBLK;
+ vattr.va_mode = SDEV_DEVMODE_DEFAULT;
+ }
+ kmem_free(dsname, strlen(dsname) + 1);
+
+ rw_enter(&parent->sdev_contents, RW_WRITER);
+
+ res = sdev_mknode(parent, nm, &dv, &vattr,
+ NULL, NULL, kcred, SDEV_READY);
+ rw_exit(&parent->sdev_contents);
+ if (res != 0)
+ return (ENOENT);
+
+ SDEV_RELE(dv);
+ return (0);
+}
+
/*ARGSUSED*/
static int
devzvol_lookup(struct vnode *dvp, char *nm, struct vnode **vpp,
@@ -505,9 +593,52 @@ devzvol_lookup(struct vnode *dvp, char *nm, struct vnode **vpp,
return (error);
rw_enter(&parent->sdev_contents, RW_READER);
- if (!SDEV_IS_GLOBAL(parent)) {
+ if (SDEV_IS_GLOBAL(parent)) {
+ /*
+ * During iter_datasets, don't create GZ dev when running in
+ * NGZ. We can't return ENOENT here since that could
+ * incorrectly trigger the creation of the dev from the
+ * recursive call through prof_filldir during iter_datasets.
+ */
+ if (getzoneid() != GLOBAL_ZONEID) {
+ rw_exit(&parent->sdev_contents);
+ return (EPERM);
+ }
+ } else {
+ int res;
+
rw_exit(&parent->sdev_contents);
- return (prof_lookup(dvp, nm, vpp, cred));
+
+ /*
+ * If we're in the global zone and reach down into a non-global
+ * zone's /dev/zvol then this action could trigger the creation
+ * of all of the zvol devices for every zone into the non-global
+ * zone's /dev tree. This could be a big security hole. To
+ * prevent this, disallow the global zone from looking inside
+ * a non-global zones /dev/zvol. This behavior is similar to
+ * delegated datasets, which cannot be used by the global zone.
+ */
+ if (getzoneid() == GLOBAL_ZONEID)
+ return (EPERM);
+
+ res = prof_lookup(dvp, nm, vpp, cred);
+
+ /*
+ * We won't find a zvol that was dynamically created inside
+ * a NGZ, within a delegated dataset, in the zone's dev profile
+ * but prof_lookup will also find it via sdev_cache_lookup.
+ */
+ if (res == ENOENT) {
+ /*
+ * We have to create the sdev node for the dymamically
+ * created zvol.
+ */
+ if (devzvol_mk_ngz_node(parent, nm) != 0)
+ return (ENOENT);
+ res = prof_lookup(dvp, nm, vpp, cred);
+ }
+
+ return (res);
}
dsname = devzvol_make_dsname(parent->sdev_path, nm);
@@ -613,8 +744,10 @@ sdev_iter_datasets(struct vnode *dvp, int arg, char *name)
} else if (rc == ENOENT) {
goto skip;
} else {
- /* EBUSY == problem with zvols's dmu holds? */
- ASSERT(0);
+ /*
+ * EBUSY == problem with zvols's dmu holds?
+ * EPERM when in a NGZ and traversing up and out.
+ */
goto skip;
}
if (arg == ZFS_IOC_DATASET_LIST_NEXT &&
diff --git a/usr/src/uts/common/fs/hyprlofs/hyprlofs_dir.c b/usr/src/uts/common/fs/hyprlofs/hyprlofs_dir.c
new file mode 100644
index 0000000000..05ee2c6e09
--- /dev/null
+++ b/usr/src/uts/common/fs/hyprlofs/hyprlofs_dir.c
@@ -0,0 +1,640 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/sysmacros.h>
+#include <sys/systm.h>
+#include <sys/time.h>
+#include <sys/vfs.h>
+#include <sys/vnode.h>
+#include <sys/errno.h>
+#include <sys/cmn_err.h>
+#include <sys/cred.h>
+#include <sys/stat.h>
+#include <sys/policy.h>
+#include <sys/fs/hyprlofs_info.h>
+
+static int hldir_make_hlnode(hlnode_t *, hlfsmount_t *, vattr_t *, enum de_op,
+ vnode_t *, hlnode_t **, cred_t *);
+static int hldiraddentry(hlnode_t *, hlnode_t *, char *);
+
+
+#define HL_HASH_SIZE 8192 /* must be power of 2 */
+#define HL_MUTEX_SIZE 64
+
+static hldirent_t *hl_hashtable[HL_HASH_SIZE];
+static kmutex_t hl_hashmutex[HL_MUTEX_SIZE];
+
+#define HL_HASH_INDEX(a) ((a) & (HL_HASH_SIZE-1))
+#define HL_MUTEX_INDEX(a) ((a) & (HL_MUTEX_SIZE-1))
+
+#define HYPRLOFS_HASH(tp, name, hash) \
+ { \
+ char Xc, *Xcp; \
+ hash = (uint_t)(uintptr_t)(tp) >> 8; \
+ for (Xcp = (name); (Xc = *Xcp) != 0; Xcp++) \
+ hash = (hash << 4) + hash + (uint_t)Xc; \
+ }
+
+void
+hyprlofs_hash_init(void)
+{
+ int ix;
+
+ for (ix = 0; ix < HL_MUTEX_SIZE; ix++)
+ mutex_init(&hl_hashmutex[ix], NULL, MUTEX_DEFAULT, NULL);
+}
+
+static void
+hyprlofs_hash_in(hldirent_t *h)
+{
+ uint_t hash;
+ hldirent_t **prevpp;
+ kmutex_t *hmtx;
+
+ HYPRLOFS_HASH(h->hld_parent, h->hld_name, hash);
+ h->hld_hash = hash;
+ prevpp = &hl_hashtable[HL_HASH_INDEX(hash)];
+ hmtx = &hl_hashmutex[HL_MUTEX_INDEX(hash)];
+ mutex_enter(hmtx);
+ h->hld_link = *prevpp;
+ *prevpp = h;
+ mutex_exit(hmtx);
+}
+
+/* Remove hldirent *h from the hash list. */
+static void
+hyprlofs_hash_out(hldirent_t *h)
+{
+ uint_t hash;
+ hldirent_t **prevpp;
+ kmutex_t *hmtx;
+
+ hash = h->hld_hash;
+ prevpp = &hl_hashtable[HL_HASH_INDEX(hash)];
+ hmtx = &hl_hashmutex[HL_MUTEX_INDEX(hash)];
+ mutex_enter(hmtx);
+ while (*prevpp != h)
+ prevpp = &(*prevpp)->hld_link;
+ *prevpp = h->hld_link;
+ mutex_exit(hmtx);
+}
+
+static hldirent_t *
+hyprlofs_hash_lookup(char *name, hlnode_t *parent, uint_t hold,
+ hlnode_t **found)
+{
+ hldirent_t *l;
+ uint_t hash;
+ kmutex_t *hmtx;
+ hlnode_t *hnp;
+
+ HYPRLOFS_HASH(parent, name, hash);
+ hmtx = &hl_hashmutex[HL_MUTEX_INDEX(hash)];
+ mutex_enter(hmtx);
+ l = hl_hashtable[HL_HASH_INDEX(hash)];
+ while (l) {
+ if (l->hld_hash == hash && l->hld_parent == parent &&
+ strcmp(l->hld_name, name) == 0) {
+ /*
+ * Ensure that the hlnode that we put a hold on is the
+ * same one that we pass back. Thus the temp. var
+ * hnp is necessary.
+ */
+ hnp = l->hld_hlnode;
+ if (hold) {
+ ASSERT(hnp);
+ hlnode_hold(hnp);
+ }
+ if (found)
+ *found = hnp;
+ mutex_exit(hmtx);
+ return (l);
+ } else {
+ l = l->hld_link;
+ }
+ }
+ mutex_exit(hmtx);
+ return (NULL);
+}
+
+/*
+ * Search directory 'parent' for entry 'name'.
+ *
+ * The calling thread can't hold the write version of the rwlock for the
+ * directory being searched
+ *
+ * On success *foundtp points to the found hlnode with its vnode held.
+ */
+int
+hyprlofs_dirlookup(hlnode_t *parent, char *name, hlnode_t **foundtp, cred_t *cr)
+{
+ int error;
+
+ *foundtp = NULL;
+ if (parent->hln_type != VDIR)
+ return (ENOTDIR);
+
+ if ((error = hyprlofs_taccess(parent, VEXEC, cr)))
+ return (error);
+
+ if (*name == '\0') {
+ hlnode_hold(parent);
+ *foundtp = parent;
+ return (0);
+ }
+
+ /*
+ * Search the directory for the matching name. We need the lock
+ * protecting the hln_dir list so that it doesn't change out from
+ * underneath us. hyprlofs_hash_lookup() will pass back the hlnode
+ * with a hold on it.
+ */
+ if (hyprlofs_hash_lookup(name, parent, 1, foundtp) != NULL) {
+ ASSERT(*foundtp);
+ return (0);
+ }
+
+ return (ENOENT);
+}
+
+/*
+ * Enter a directory entry (either a file or subdir, depending on op) for
+ * 'name' and 'hp' into directory 'dir'
+ */
+int
+hyprlofs_direnter(
+ hlfsmount_t *hm,
+ hlnode_t *dir, /* target directory to make entry in */
+ char *name, /* name of entry */
+ enum de_op op, /* entry operation */
+ vnode_t *realvp, /* real vnode */
+ vattr_t *va,
+ hlnode_t **hpp, /* return hlnode */
+ cred_t *cr)
+{
+ hldirent_t *hdp;
+ hlnode_t *found = NULL;
+ hlnode_t *hp;
+ int error = 0;
+ char *s;
+
+ /* hln_rwlock is held to serialize direnter and dirdeletes */
+ ASSERT(RW_WRITE_HELD(&dir->hln_rwlock));
+ ASSERT(dir->hln_type == VDIR);
+
+ /* Don't allow '/' characters in pathname component */
+ for (s = name; *s; s++)
+ if (*s == '/')
+ return (EACCES);
+
+ if (name[0] == '\0')
+ panic("hyprlofs_direnter: NULL name");
+
+ /*
+ * This might be a "dangling detached directory". It could have been
+ * removed, but a reference to it kept in u_cwd. Don't bother searching
+ * it, and with any luck the user will get tired of dealing with us and
+ * cd to some absolute pathway. This is in ufs, too.
+ */
+ if (dir->hln_nlink == 0) {
+ return (ENOENT);
+ }
+
+ /* Search for the entry. Return "found" if it exists. */
+ hdp = hyprlofs_hash_lookup(name, dir, 1, &found);
+
+ if (hdp) {
+ ASSERT(found);
+ switch (op) {
+ case DE_CREATE:
+ case DE_MKDIR:
+ if (hpp) {
+ *hpp = found;
+ error = EEXIST;
+ } else {
+ hlnode_rele(found);
+ }
+ break;
+ }
+ } else {
+
+ /*
+ * The entry does not exist. Check write perms in dir to see if
+ * entry can be created.
+ */
+ if ((error = hyprlofs_taccess(dir, VWRITE, cr)))
+ return (error);
+
+ /* Make new hlnode and directory entry as required. */
+ if ((error = hldir_make_hlnode(dir, hm, va, op, realvp, &hp,
+ cr)))
+ return (error);
+
+ if ((error = hldiraddentry(dir, hp, name))) {
+ /* Unmake the inode we just made. */
+ rw_enter(&hp->hln_rwlock, RW_WRITER);
+ if ((hp->hln_type) == VDIR) {
+ ASSERT(hdp == NULL);
+ /* cleanup allocs made by hyprlofs_dirinit() */
+ hyprlofs_dirtrunc(hp);
+ }
+ mutex_enter(&hp->hln_tlock);
+ hp->hln_nlink = 0;
+ mutex_exit(&hp->hln_tlock);
+ gethrestime(&hp->hln_ctime);
+ rw_exit(&hp->hln_rwlock);
+ hlnode_rele(hp);
+ hp = NULL;
+ } else if (hpp) {
+ *hpp = hp;
+ } else {
+ hlnode_rele(hp);
+ }
+ }
+
+ return (error);
+}
+
+/*
+ * Delete entry hp of name "nm" from dir. Free dir entry space and decrement
+ * link count on hlnode(s).
+ */
+int
+hyprlofs_dirdelete(hlnode_t *dir, hlnode_t *hp, char *nm, enum dr_op op,
+ cred_t *cr)
+{
+ hldirent_t *hpdp;
+ int error;
+ size_t namelen;
+ hlnode_t *hnp;
+ timestruc_t now;
+
+ ASSERT(RW_WRITE_HELD(&dir->hln_rwlock));
+ ASSERT(RW_WRITE_HELD(&hp->hln_rwlock));
+ ASSERT(dir->hln_type == VDIR);
+
+ if (nm[0] == '\0')
+ panic("hyprlofs_dirdelete: NULL name for %p", (void *)hp);
+
+ /* return error if removing . or .. */
+ if (nm[0] == '.') {
+ if (nm[1] == '\0')
+ return (EINVAL);
+ if (nm[1] == '.' && nm[2] == '\0')
+ return (EEXIST); /* thus in ufs */
+ }
+
+ if ((error = hyprlofs_taccess(dir, VEXEC|VWRITE, cr)) != 0)
+ return (error);
+
+ if (dir->hln_dir == NULL)
+ return (ENOENT);
+
+ hpdp = hyprlofs_hash_lookup(nm, dir, 0, &hnp);
+ if (hpdp == NULL) {
+ /*
+ * If it is gone, some other thread got here first!
+ * Return error ENOENT.
+ */
+ return (ENOENT);
+ }
+
+ /*
+ * If the hlnode in the hldirent changed (shouldn't happen since we
+ * don't support rename) then original is gone, so return that status
+ * (same as UFS).
+ */
+ if (hp != hnp)
+ return (ENOENT);
+
+ hyprlofs_hash_out(hpdp);
+
+ /* Take hpdp out of the directory list. */
+ ASSERT(hpdp->hld_next != hpdp);
+ ASSERT(hpdp->hld_prev != hpdp);
+ if (hpdp->hld_prev) {
+ hpdp->hld_prev->hld_next = hpdp->hld_next;
+ }
+ if (hpdp->hld_next) {
+ hpdp->hld_next->hld_prev = hpdp->hld_prev;
+ }
+
+ /*
+ * If the roving slot pointer happens to match hpdp, point it at the
+ * previous dirent.
+ */
+ if (dir->hln_dir->hld_prev == hpdp) {
+ dir->hln_dir->hld_prev = hpdp->hld_prev;
+ }
+ ASSERT(hpdp->hld_next != hpdp);
+ ASSERT(hpdp->hld_prev != hpdp);
+
+ /* hpdp points to the correct directory entry */
+ namelen = strlen(hpdp->hld_name) + 1;
+
+ kmem_free(hpdp, sizeof (hldirent_t) + namelen);
+ dir->hln_size -= (sizeof (hldirent_t) + namelen);
+ dir->hln_dirents--;
+
+ gethrestime(&now);
+ dir->hln_mtime = now;
+ dir->hln_ctime = now;
+ hp->hln_ctime = now;
+
+ ASSERT(hp->hln_nlink > 0);
+ DECR_COUNT(&hp->hln_nlink, &hp->hln_tlock);
+ if (op == DR_RMDIR && hp->hln_type == VDIR) {
+ hyprlofs_dirtrunc(hp);
+ ASSERT(hp->hln_nlink == 0);
+ }
+ return (0);
+}
+
+/*
+ * hyprlofs_dirinit initializes a dir with '.' and '..' entries without
+ * checking perms and locking
+ */
+void
+hyprlofs_dirinit(
+ hlnode_t *parent, /* parent of directory to initialize */
+ hlnode_t *dir) /* the new directory */
+{
+ hldirent_t *dot, *dotdot;
+ timestruc_t now;
+
+ ASSERT(RW_WRITE_HELD(&parent->hln_rwlock));
+ ASSERT(dir->hln_type == VDIR);
+
+ dot = kmem_zalloc(sizeof (hldirent_t) + 2, KM_SLEEP);
+ dotdot = kmem_zalloc(sizeof (hldirent_t) + 3, KM_SLEEP);
+
+ /* Initialize the entries */
+ dot->hld_hlnode = dir;
+ dot->hld_offset = 0;
+ dot->hld_name = (char *)dot + sizeof (hldirent_t);
+ dot->hld_name[0] = '.';
+ dot->hld_parent = dir;
+ hyprlofs_hash_in(dot);
+
+ dotdot->hld_hlnode = parent;
+ dotdot->hld_offset = 1;
+ dotdot->hld_name = (char *)dotdot + sizeof (hldirent_t);
+ dotdot->hld_name[0] = '.';
+ dotdot->hld_name[1] = '.';
+ dotdot->hld_parent = dir;
+ hyprlofs_hash_in(dotdot);
+
+ /* Initialize directory entry list. */
+ dot->hld_next = dotdot;
+ dot->hld_prev = dotdot;
+ dotdot->hld_next = NULL;
+ dotdot->hld_prev = dot;
+
+ gethrestime(&now);
+ dir->hln_mtime = now;
+ dir->hln_ctime = now;
+
+ /*
+ * Since hyprlofs_dirinit is called with both dir and parent being the
+ * same for the root vnode, we need to increment this before we set
+ * hln_nlink = 2 below.
+ */
+ INCR_COUNT(&parent->hln_nlink, &parent->hln_tlock);
+ parent->hln_ctime = now;
+
+ dir->hln_dir = dot;
+ dir->hln_size = 2 * sizeof (hldirent_t) + 5; /* dot and dotdot */
+ dir->hln_dirents = 2;
+ dir->hln_nlink = 2;
+}
+
+
+/*
+ * hyprlofs_dirtrunc removes all dir entries under this dir.
+ */
+void
+hyprlofs_dirtrunc(hlnode_t *dir)
+{
+ hldirent_t *hdp;
+ hlnode_t *tp;
+ size_t namelen;
+ timestruc_t now;
+
+ ASSERT(RW_WRITE_HELD(&dir->hln_rwlock));
+ ASSERT(dir->hln_type == VDIR);
+
+ if (dir->hln_looped)
+ return;
+
+ for (hdp = dir->hln_dir; hdp; hdp = dir->hln_dir) {
+ ASSERT(hdp->hld_next != hdp);
+ ASSERT(hdp->hld_prev != hdp);
+ ASSERT(hdp->hld_hlnode);
+
+ dir->hln_dir = hdp->hld_next;
+ namelen = strlen(hdp->hld_name) + 1;
+
+ /*
+ * Adjust the link counts to account for this dir entry removal.
+ */
+ tp = hdp->hld_hlnode;
+
+ ASSERT(tp->hln_nlink > 0);
+ DECR_COUNT(&tp->hln_nlink, &tp->hln_tlock);
+
+ hyprlofs_hash_out(hdp);
+
+ kmem_free(hdp, sizeof (hldirent_t) + namelen);
+ dir->hln_size -= (sizeof (hldirent_t) + namelen);
+ dir->hln_dirents--;
+ }
+
+ gethrestime(&now);
+ dir->hln_mtime = now;
+ dir->hln_ctime = now;
+
+ ASSERT(dir->hln_dir == NULL);
+ ASSERT(dir->hln_size == 0);
+ ASSERT(dir->hln_dirents == 0);
+}
+
+static int
+hldiraddentry(
+ hlnode_t *dir, /* target directory to make entry in */
+ hlnode_t *hp, /* new hlnode */
+ char *name)
+{
+ hldirent_t *hdp, *hpdp;
+ size_t namelen, alloc_size;
+ timestruc_t now;
+
+ /*
+ * Make sure the parent dir wasn't removed from underneath the caller.
+ */
+ if (dir->hln_dir == NULL)
+ return (ENOENT);
+
+ /* Check that everything is on the same FS. */
+ if (hp->hln_vnode->v_vfsp != dir->hln_vnode->v_vfsp)
+ return (EXDEV);
+
+ /* Alloc and init dir entry */
+ namelen = strlen(name) + 1;
+ alloc_size = namelen + sizeof (hldirent_t);
+ hdp = kmem_zalloc(alloc_size, KM_NORMALPRI | KM_NOSLEEP);
+ if (hdp == NULL)
+ return (ENOSPC);
+
+ dir->hln_size += alloc_size;
+ dir->hln_dirents++;
+ hdp->hld_hlnode = hp;
+ hdp->hld_parent = dir;
+
+ /* The dir entry and its name were allocated sequentially. */
+ hdp->hld_name = (char *)hdp + sizeof (hldirent_t);
+ (void) strcpy(hdp->hld_name, name);
+
+ hyprlofs_hash_in(hdp);
+
+ /*
+ * Some utilities expect the size of a directory to remain fairly
+ * static. For example, a routine which unlinks files between calls to
+ * readdir(); the size of the dir changes from underneath it and so the
+ * real dir offset in bytes is invalid. To circumvent this problem, we
+ * initialize a dir entry with a phony offset, and use this offset to
+ * determine end of file in hyprlofs_readdir.
+ */
+ hpdp = dir->hln_dir->hld_prev;
+ /*
+ * Install at first empty "slot" in directory list.
+ */
+ while (hpdp->hld_next != NULL && (hpdp->hld_next->hld_offset -
+ hpdp->hld_offset) <= 1) {
+ ASSERT(hpdp->hld_next != hpdp);
+ ASSERT(hpdp->hld_prev != hpdp);
+ ASSERT(hpdp->hld_next->hld_offset > hpdp->hld_offset);
+ hpdp = hpdp->hld_next;
+ }
+ hdp->hld_offset = hpdp->hld_offset + 1;
+
+ /*
+ * If we're at the end of the dirent list and the offset (which is
+ * necessarily the largest offset in this dir) is more than twice the
+ * number of dirents, that means the dir is 50% holes. At this point
+ * we reset the slot pointer back to the beginning of the dir so we
+ * start using the holes. The idea is that if there are N dirents,
+ * there must also be N holes, so we can satisfy the next N creates by
+ * walking at most 2N entries; thus the average cost of a create is
+ * constant. Note that we use the first dirent's hld_prev as the roving
+ * slot pointer. This saves a word in every dirent.
+ */
+ if (hpdp->hld_next == NULL && hpdp->hld_offset > 2 * dir->hln_dirents)
+ dir->hln_dir->hld_prev = dir->hln_dir->hld_next;
+ else
+ dir->hln_dir->hld_prev = hdp;
+
+ ASSERT(hpdp->hld_next != hpdp);
+ ASSERT(hpdp->hld_prev != hpdp);
+
+ hdp->hld_next = hpdp->hld_next;
+ if (hdp->hld_next) {
+ hdp->hld_next->hld_prev = hdp;
+ }
+ hdp->hld_prev = hpdp;
+ hpdp->hld_next = hdp;
+
+ ASSERT(hdp->hld_next != hdp);
+ ASSERT(hdp->hld_prev != hdp);
+ ASSERT(hpdp->hld_next != hpdp);
+ ASSERT(hpdp->hld_prev != hpdp);
+
+ gethrestime(&now);
+ dir->hln_mtime = now;
+ dir->hln_ctime = now;
+
+ return (0);
+}
+
+static int
+hldir_make_hlnode(hlnode_t *dir, hlfsmount_t *hm, vattr_t *va, enum de_op op,
+ vnode_t *realvp, hlnode_t **newnode, cred_t *cr)
+{
+ hlnode_t *hp;
+ enum vtype type;
+
+ ASSERT(va != NULL);
+ ASSERT(op == DE_CREATE || op == DE_MKDIR);
+ if (((va->va_mask & AT_ATIME) && TIMESPEC_OVERFLOW(&va->va_atime)) ||
+ ((va->va_mask & AT_MTIME) && TIMESPEC_OVERFLOW(&va->va_mtime)))
+ return (EOVERFLOW);
+ type = va->va_type;
+ hp = kmem_zalloc(sizeof (hlnode_t), KM_SLEEP);
+ hyprlofs_node_init(hm, hp, va, cr);
+
+ hp->hln_vnode->v_rdev = hp->hln_rdev = NODEV;
+ hp->hln_vnode->v_type = type;
+ hp->hln_uid = crgetuid(cr);
+
+ /*
+ * To determine the gid of the created file:
+ * If the directory's set-gid bit is set, set the gid to the gid
+ * of the parent dir, otherwise, use the process's gid.
+ */
+ if (dir->hln_mode & VSGID)
+ hp->hln_gid = dir->hln_gid;
+ else
+ hp->hln_gid = crgetgid(cr);
+
+ /*
+ * If we're creating a dir and the parent dir has the set-GID bit set,
+ * set it on the new dir. Otherwise, if the user is neither privileged
+ * nor a member of the file's new group, clear the file's set-GID bit.
+ */
+ if (dir->hln_mode & VSGID && type == VDIR)
+ hp->hln_mode |= VSGID;
+ else {
+ if ((hp->hln_mode & VSGID) &&
+ secpolicy_vnode_setids_setgids(cr, hp->hln_gid) != 0)
+ hp->hln_mode &= ~VSGID;
+ }
+
+ if (va->va_mask & AT_ATIME)
+ hp->hln_atime = va->va_atime;
+ if (va->va_mask & AT_MTIME)
+ hp->hln_mtime = va->va_mtime;
+
+ if (op == DE_MKDIR) {
+ hyprlofs_dirinit(dir, hp);
+ hp->hln_looped = 0;
+ } else {
+ hp->hln_realvp = realvp;
+ hp->hln_size = va->va_size;
+ hp->hln_looped = 1;
+ }
+
+ *newnode = hp;
+ return (0);
+}
diff --git a/usr/src/uts/common/fs/hyprlofs/hyprlofs_subr.c b/usr/src/uts/common/fs/hyprlofs/hyprlofs_subr.c
new file mode 100644
index 0000000000..1d857309f3
--- /dev/null
+++ b/usr/src/uts/common/fs/hyprlofs/hyprlofs_subr.c
@@ -0,0 +1,127 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+#include <sys/types.h>
+#include <sys/errno.h>
+#include <sys/param.h>
+#include <sys/t_lock.h>
+#include <sys/systm.h>
+#include <sys/sysmacros.h>
+#include <sys/debug.h>
+#include <sys/time.h>
+#include <sys/cmn_err.h>
+#include <sys/vnode.h>
+#include <sys/stat.h>
+#include <sys/mode.h>
+#include <sys/vfs.h>
+#include <sys/cred.h>
+#include <sys/kmem.h>
+#include <sys/atomic.h>
+#include <sys/policy.h>
+#include <sys/fs/hyprlofs_info.h>
+
+#define MODESHIFT 3
+
+/* Initialize a hlnode and add it to file list under mount point. */
+void
+hyprlofs_node_init(hlfsmount_t *hm, hlnode_t *h, vattr_t *vap, cred_t *cr)
+{
+ vnode_t *vp;
+ timestruc_t now;
+
+ ASSERT(vap != NULL);
+
+ rw_init(&h->hln_rwlock, NULL, RW_DEFAULT, NULL);
+ mutex_init(&h->hln_tlock, NULL, MUTEX_DEFAULT, NULL);
+ h->hln_mode = MAKEIMODE(vap->va_type, vap->va_mode);
+ h->hln_mask = 0;
+ h->hln_type = vap->va_type;
+ h->hln_nodeid = (ino64_t)(uint32_t)((uintptr_t)h >> 3);
+ h->hln_nlink = 1;
+ h->hln_size = 0;
+
+ if (cr == NULL) {
+ h->hln_uid = vap->va_uid;
+ h->hln_gid = vap->va_gid;
+ } else {
+ h->hln_uid = crgetuid(cr);
+ h->hln_gid = crgetgid(cr);
+ }
+
+ h->hln_fsid = hm->hlm_dev;
+ h->hln_rdev = vap->va_rdev;
+ h->hln_blksize = PAGESIZE;
+ h->hln_nblocks = 0;
+ gethrestime(&now);
+ h->hln_atime = now;
+ h->hln_mtime = now;
+ h->hln_ctime = now;
+ h->hln_seq = 0;
+ h->hln_dir = NULL;
+
+ h->hln_vnode = vn_alloc(KM_SLEEP);
+ vp = HLNTOV(h);
+ vn_setops(vp, hyprlofs_vnodeops);
+ vp->v_vfsp = hm->hlm_vfsp;
+ vp->v_type = vap->va_type;
+ vp->v_rdev = vap->va_rdev;
+ vp->v_data = (caddr_t)h;
+ mutex_enter(&hm->hlm_contents);
+ /*
+ * Increment the pseudo generation number for this hlnode. Since
+ * hlnodes are allocated and freed, there really is no particular
+ * generation number for a new hlnode. Just fake it by using a
+ * counter in each file system.
+ */
+ h->hln_gen = hm->hlm_gen++;
+
+ /*
+ * Add new hlnode to end of linked list of hlnodes for this hyprlofs
+ * Root dir is handled specially in hyprlofs_mount.
+ */
+ if (hm->hlm_rootnode != (hlnode_t *)NULL) {
+ h->hln_forw = NULL;
+ h->hln_back = hm->hlm_rootnode->hln_back;
+ h->hln_back->hln_forw = hm->hlm_rootnode->hln_back = h;
+ }
+ mutex_exit(&hm->hlm_contents);
+ vn_exists(vp);
+}
+
+int
+hyprlofs_taccess(void *vtp, int mode, cred_t *cr)
+{
+ hlnode_t *hp = vtp;
+ int shift = 0;
+
+ /* Check access based on owner, group and public perms in hlnode. */
+ if (crgetuid(cr) != hp->hln_uid) {
+ shift += MODESHIFT;
+ if (groupmember(hp->hln_gid, cr) == 0)
+ shift += MODESHIFT;
+ }
+
+ return (secpolicy_vnode_access2(cr, HLNTOV(hp), hp->hln_uid,
+ hp->hln_mode << shift, mode));
+}
diff --git a/usr/src/uts/common/fs/hyprlofs/hyprlofs_vfsops.c b/usr/src/uts/common/fs/hyprlofs/hyprlofs_vfsops.c
new file mode 100644
index 0000000000..c582a8cac2
--- /dev/null
+++ b/usr/src/uts/common/fs/hyprlofs/hyprlofs_vfsops.c
@@ -0,0 +1,614 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * Hyperlofs is a hybrid file system combining features of the tmpfs(7FS) and
+ * lofs(7FS) file systems. It is modeled on code from both of these file
+ * systems.
+ *
+ * The purpose is to create a high performance name space for files on which
+ * applications will compute. Given a large number of data files with various
+ * owners, we want to construct a view onto those files such that only a subset
+ * is visible to the applications and such that the view can be changed very
+ * quickly as compute progresses. Entries in the name space are not mounts and
+ * thus do not appear in the mnttab. Entries in the name space are allowed to
+ * refer to files on different backing file systems. Intermediate directories
+ * in the name space exist only in-memory, ala tmpfs. There are no leaf nodes
+ * in the name space except for entries that refer to backing files ala lofs.
+ *
+ * The name space is managed via ioctls issued on the mounted file system and
+ * is mostly read-only for the compute applications. That is, applications
+ * cannot create new files in the name space. If a file is unlinked by an
+ * application, that only removes the file from the name space, the backing
+ * file remains in place. It is possible for applications to write-through to
+ * the backing files if the file system is mounted read-write.
+ *
+ * The name space is managed via the HYPRLOFS_ADD_ENTRIES, HYPRLOFS_RM_ENTRIES,
+ * and HYPRLOFS_RM_ALL ioctls on the top-level mount.
+ *
+ * The HYPRLOFS_ADD_ENTRIES ioctl specifies path(s) to the backing file(s) and
+ * the name(s) for the file(s) in the name space. The name(s) may be path(s)
+ * which will be relative to the root of the mount and thus cannot begin with
+ * a /. If the name is a path, it does not have to correspond to any backing
+ * path. The intermediate directories will only exist in the name space. The
+ * entry(ies) will be added to the name space.
+ *
+ * The HYPRLOFS_RM_ENTRIES ioctl specifies the name(s) of the file(s) in the
+ * name space which should be removed. The name(s) may be path(s) which will
+ * be relative to the root of the mount and thus cannot begin with a /. The
+ * named entry(ies) will be removed.
+ *
+ * The HYPRLOFS_RM_ALL ioctl will remove all mappings from the name space.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/sysmacros.h>
+#include <sys/kmem.h>
+#include <sys/time.h>
+#include <sys/pathname.h>
+#include <sys/vfs.h>
+#include <sys/vfs_opreg.h>
+#include <sys/vnode.h>
+#include <sys/stat.h>
+#include <sys/uio.h>
+#include <sys/stat.h>
+#include <sys/errno.h>
+#include <sys/cmn_err.h>
+#include <sys/cred.h>
+#include <sys/statvfs.h>
+#include <sys/mount.h>
+#include <sys/debug.h>
+#include <sys/systm.h>
+#include <sys/mntent.h>
+#include <fs/fs_subr.h>
+#include <vm/page.h>
+#include <vm/anon.h>
+#include <sys/model.h>
+#include <sys/policy.h>
+
+#include <sys/fs/swapnode.h>
+#include <sys/fs/hyprlofs_info.h>
+
+static int hyprlofsfstype;
+
+/*
+ * hyprlofs vfs operations.
+ */
+static int hyprlofsinit(int, char *);
+static int hyprlofs_mount(vfs_t *, vnode_t *, struct mounta *, cred_t *);
+static int hyprlofs_unmount(vfs_t *, int, cred_t *);
+static int hyprlofs_root(vfs_t *, vnode_t **);
+static int hyprlofs_statvfs(vfs_t *, struct statvfs64 *);
+static int hyprlofs_vget(vfs_t *, vnode_t **, struct fid *);
+
+/*
+ * Loadable module wrapper
+ */
+#include <sys/modctl.h>
+
+static mntopts_t hyprlofs_mntopts;
+
+static vfsdef_t vfw = {
+ VFSDEF_VERSION,
+ "hyprlofs",
+ hyprlofsinit,
+ VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_ZMOUNT,
+ &hyprlofs_mntopts
+};
+
+static mntopts_t hyprlofs_mntopts = {
+ 0, NULL
+};
+
+/*
+ * Module linkage information
+ */
+static struct modlfs modlfs = {
+ &mod_fsops, "filesystem for hyprlofs", &vfw
+};
+
+static struct modlinkage modlinkage = {
+ MODREV_1, &modlfs, NULL
+};
+
+int
+_init()
+{
+ return (mod_install(&modlinkage));
+}
+
+int
+_fini()
+{
+ int error;
+
+ error = mod_remove(&modlinkage);
+ if (error)
+ return (error);
+ /*
+ * Tear down the operations vectors
+ */
+ (void) vfs_freevfsops_by_type(hyprlofsfstype);
+ vn_freevnodeops(hyprlofs_vnodeops);
+ return (0);
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+ return (mod_info(&modlinkage, modinfop));
+}
+
+/*
+ * The following are patchable variables limiting the amount of system
+ * resources hyprlofs can use.
+ *
+ * hyprlofs_maxkmem limits the amount of kernel kmem_alloc memory hyprlofs can
+ * use for it's data structures (e.g. hlnodes, directory entries). It is set
+ * as a percentage of physical memory which is determined when hyprlofs is
+ * first used in the system.
+ *
+ * hyprlofs_minfree is the minimum amount of swap space that hyprlofs leaves for
+ * the rest of the system. If the amount of free swap space in the system
+ * (i.e. anoninfo.ani_free) drops below hyprlofs_minfree, hyprlofs anon
+ * allocations will fail.
+ */
+size_t hyprlofs_maxkmem = 0;
+size_t hyprlofs_minfree = 0;
+size_t hyprlofs_kmemspace; /* bytes of kernel heap used by all hyprlofs */
+
+static major_t hyprlofs_major;
+static minor_t hyprlofs_minor;
+static kmutex_t hyprlofs_minor_lock;
+
+/*
+ * initialize global hyprlofs locks and hashes when loading hyprlofs module
+ */
+static int
+hyprlofsinit(int fstype, char *name)
+{
+ static const fs_operation_def_t hl_vfsops_template[] = {
+ VFSNAME_MOUNT, { .vfs_mount = hyprlofs_mount },
+ VFSNAME_UNMOUNT, { .vfs_unmount = hyprlofs_unmount },
+ VFSNAME_ROOT, { .vfs_root = hyprlofs_root },
+ VFSNAME_STATVFS, { .vfs_statvfs = hyprlofs_statvfs },
+ VFSNAME_VGET, { .vfs_vget = hyprlofs_vget },
+ NULL, NULL
+ };
+ int error;
+ extern void hyprlofs_hash_init();
+
+ hyprlofs_hash_init();
+ hyprlofsfstype = fstype;
+ ASSERT(hyprlofsfstype != 0);
+
+ error = vfs_setfsops(fstype, hl_vfsops_template, NULL);
+ if (error != 0) {
+ cmn_err(CE_WARN, "hyprlofsinit: bad vfs ops template");
+ return (error);
+ }
+
+ error = vn_make_ops(name, hyprlofs_vnodeops_template,
+ &hyprlofs_vnodeops);
+ if (error != 0) {
+ (void) vfs_freevfsops_by_type(fstype);
+ cmn_err(CE_WARN, "hyprlofsinit: bad vnode ops template");
+ return (error);
+ }
+
+ /*
+ * hyprlofs_minfree is an absolute limit of swap space which still
+ * allows other processes to execute. Set it if its not patched.
+ */
+ if (hyprlofs_minfree == 0)
+ hyprlofs_minfree = btopr(HYPRLOFSMINFREE);
+
+ if ((hyprlofs_major = getudev()) == (major_t)-1) {
+ cmn_err(CE_WARN,
+ "hyprlofsinit: Can't get unique device number.");
+ hyprlofs_major = 0;
+ }
+ mutex_init(&hyprlofs_minor_lock, NULL, MUTEX_DEFAULT, NULL);
+ return (0);
+}
+
+static int
+hyprlofs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
+{
+ hlfsmount_t *hm = NULL;
+ hlnode_t *hp;
+ struct pathname dpn;
+ int error;
+ vattr_t rattr;
+ int got_attrs;
+
+ if ((error = secpolicy_fs_mount(cr, mvp, vfsp)) != 0)
+ return (error);
+ if (secpolicy_hyprlofs_control(cr) != 0)
+ return (EPERM);
+
+ if (mvp->v_type != VDIR)
+ return (ENOTDIR);
+
+ if (uap->flags & MS_REMOUNT)
+ return (EBUSY);
+
+ mutex_enter(&mvp->v_lock);
+ if ((uap->flags & MS_OVERLAY) == 0 &&
+ (mvp->v_count != 1 || (mvp->v_flag & VROOT))) {
+ mutex_exit(&mvp->v_lock);
+ return (EBUSY);
+ }
+ mutex_exit(&mvp->v_lock);
+
+ /* Having the resource be anything but "swap" doesn't make sense. */
+ vfs_setresource(vfsp, "swap", 0);
+
+ if ((error = pn_get(uap->dir,
+ (uap->flags & MS_SYSSPACE) ? UIO_SYSSPACE : UIO_USERSPACE,
+ &dpn)) != 0)
+ goto out;
+
+ if ((hm = kmem_zalloc(sizeof (hlfsmount_t),
+ KM_NORMALPRI | KM_NOSLEEP)) == NULL) {
+ pn_free(&dpn);
+ error = ENOMEM;
+ goto out;
+ }
+
+ /* Get an available minor device number for this mount */
+ mutex_enter(&hyprlofs_minor_lock);
+ do {
+ hyprlofs_minor = (hyprlofs_minor + 1) & L_MAXMIN32;
+ hm->hlm_dev = makedevice(hyprlofs_major, hyprlofs_minor);
+ } while (vfs_devismounted(hm->hlm_dev));
+ mutex_exit(&hyprlofs_minor_lock);
+
+ /*
+ * Set but don't bother entering the mutex since hlfsmount is not on
+ * the mount list yet.
+ */
+ mutex_init(&hm->hlm_contents, NULL, MUTEX_DEFAULT, NULL);
+
+ hm->hlm_vfsp = vfsp;
+
+ vfsp->vfs_data = (caddr_t)hm;
+ vfsp->vfs_fstype = hyprlofsfstype;
+ vfsp->vfs_dev = hm->hlm_dev;
+ vfsp->vfs_bsize = PAGESIZE;
+ vfsp->vfs_flag |= VFS_NOTRUNC;
+ vfs_make_fsid(&vfsp->vfs_fsid, hm->hlm_dev, hyprlofsfstype);
+ hm->hlm_mntpath = kmem_zalloc(dpn.pn_pathlen + 1, KM_SLEEP);
+ (void) strcpy(hm->hlm_mntpath, dpn.pn_path);
+
+ /* allocate and initialize root hlnode structure */
+ bzero(&rattr, sizeof (vattr_t));
+ rattr.va_mode = (mode_t)(S_IFDIR | 0777);
+ rattr.va_type = VDIR;
+ rattr.va_rdev = 0;
+ hp = kmem_zalloc(sizeof (hlnode_t), KM_SLEEP);
+ hyprlofs_node_init(hm, hp, &rattr, cr);
+
+ /* Get the mode, uid, and gid from the underlying mount point. */
+ rattr.va_mask = AT_MODE|AT_UID|AT_GID;
+ got_attrs = VOP_GETATTR(mvp, &rattr, 0, cr, NULL);
+
+ rw_enter(&hp->hln_rwlock, RW_WRITER);
+ HLNTOV(hp)->v_flag |= VROOT;
+
+ /*
+ * If the getattr succeeded, use its results, otherwise allow the
+ * previously set defaults to prevail.
+ */
+ if (got_attrs == 0) {
+ hp->hln_mode = rattr.va_mode;
+ hp->hln_uid = rattr.va_uid;
+ hp->hln_gid = rattr.va_gid;
+ }
+
+ /*
+ * Initialize linked list of hlnodes so that the back pointer of the
+ * root hlnode always points to the last one on the list and the
+ * forward pointer of the last node is null
+ */
+ hp->hln_back = hp;
+ hp->hln_forw = NULL;
+ hp->hln_nlink = 0;
+ hm->hlm_rootnode = hp;
+
+ hyprlofs_dirinit(hp, hp);
+
+ rw_exit(&hp->hln_rwlock);
+
+ pn_free(&dpn);
+ error = 0;
+
+out:
+ return (error);
+}
+
+static int
+hyprlofs_unmount(vfs_t *vfsp, int flag, cred_t *cr)
+{
+ hlfsmount_t *hm = (hlfsmount_t *)VFSTOHLM(vfsp);
+ hlnode_t *hnp, *cancel;
+ vnode_t *vp;
+ int error;
+
+ if ((error = secpolicy_fs_unmount(cr, vfsp)) != 0)
+ return (error);
+ if (secpolicy_hyprlofs_control(cr) != 0)
+ return (EPERM);
+
+ /*
+ * forced unmount is not supported by this file system
+ * and thus, ENOTSUP, is being returned.
+ */
+ if (flag & MS_FORCE)
+ return (ENOTSUP);
+
+ mutex_enter(&hm->hlm_contents);
+
+ /*
+ * If there are no open files, only the root node should have a ref cnt.
+ * With hlm_contents held, nothing can be added or removed. There may
+ * be some dirty pages. To prevent fsflush from disrupting the unmount,
+ * put a hold on each node while scanning. If we find a previously
+ * referenced node, undo the holds we have placed and fail EBUSY.
+ */
+ hnp = hm->hlm_rootnode;
+ if (HLNTOV(hnp)->v_count > 1) {
+ mutex_exit(&hm->hlm_contents);
+ return (EBUSY);
+ }
+
+ for (hnp = hnp->hln_forw; hnp; hnp = hnp->hln_forw) {
+ if ((vp = HLNTOV(hnp))->v_count > 0) {
+ cancel = hm->hlm_rootnode->hln_forw;
+ while (cancel != hnp) {
+ vp = HLNTOV(cancel);
+ ASSERT(vp->v_count > 0);
+ VN_RELE(vp);
+ cancel = cancel->hln_forw;
+ }
+ mutex_exit(&hm->hlm_contents);
+ return (EBUSY);
+ }
+ VN_HOLD(vp);
+ }
+
+ /* We can drop the mutex now because no one can find this mount */
+ mutex_exit(&hm->hlm_contents);
+
+ /*
+ * Free all alloc'd memory associated with this FS. To do this, we go
+ * through the file list twice, once to remove all the dir entries, and
+ * then to remove all the files.
+ */
+
+ /* Remove all directory entries */
+ for (hnp = hm->hlm_rootnode; hnp; hnp = hnp->hln_forw) {
+ rw_enter(&hnp->hln_rwlock, RW_WRITER);
+ if (hnp->hln_type == VDIR)
+ hyprlofs_dirtrunc(hnp);
+ rw_exit(&hnp->hln_rwlock);
+ }
+
+ ASSERT(hm->hlm_rootnode);
+
+ /*
+ * All links are gone, v_count is keeping nodes in place. VN_RELE
+ * should make the node disappear, unless somebody is holding pages
+ * against it. Wait and retry until it disappears.
+ *
+ * We re-acquire the lock to prevent others who have a HOLD on a hlnode
+ * from blowing it away (in hyprlofs_inactive) while we're trying to
+ * get to it here. Once we have a HOLD on it we know it'll stick around.
+ */
+ mutex_enter(&hm->hlm_contents);
+
+ /* Remove all the files (except the rootnode) backwards. */
+ while ((hnp = hm->hlm_rootnode->hln_back) != hm->hlm_rootnode) {
+ mutex_exit(&hm->hlm_contents);
+ /* Note we handled the link count in pass 2 above. */
+ vp = HLNTOV(hnp);
+ VN_RELE(vp);
+ mutex_enter(&hm->hlm_contents);
+ /*
+ * It's still there after the RELE. Someone else like pageout
+ * has a hold on it so wait a bit and then try again.
+ */
+ if (hnp == hm->hlm_rootnode->hln_back) {
+ VN_HOLD(vp);
+ mutex_exit(&hm->hlm_contents);
+ delay(hz / 4);
+ mutex_enter(&hm->hlm_contents);
+ }
+ }
+ mutex_exit(&hm->hlm_contents);
+
+ VN_RELE(HLNTOV(hm->hlm_rootnode));
+
+ ASSERT(hm->hlm_mntpath);
+
+ kmem_free(hm->hlm_mntpath, strlen(hm->hlm_mntpath) + 1);
+
+ mutex_destroy(&hm->hlm_contents);
+ kmem_free(hm, sizeof (hlfsmount_t));
+
+ return (0);
+}
+
+/* Return root hlnode for given vnode */
+static int
+hyprlofs_root(vfs_t *vfsp, vnode_t **vpp)
+{
+ hlfsmount_t *hm = (hlfsmount_t *)VFSTOHLM(vfsp);
+ hlnode_t *hp = hm->hlm_rootnode;
+ vnode_t *vp;
+
+ ASSERT(hp);
+
+ vp = HLNTOV(hp);
+ VN_HOLD(vp);
+ *vpp = vp;
+ return (0);
+}
+
+static int
+hyprlofs_statvfs(vfs_t *vfsp, struct statvfs64 *sbp)
+{
+ hlfsmount_t *hm = (hlfsmount_t *)VFSTOHLM(vfsp);
+ ulong_t blocks;
+ dev32_t d32;
+ zoneid_t eff_zid;
+ struct zone *zp;
+
+ /*
+ * The FS may have been mounted by the GZ on behalf of the NGZ. In
+ * that case, the hlfsmount zone_id will be the global zone. We want
+ * to show the swap cap inside the zone in this case, even though the
+ * FS was mounted by the GZ.
+ */
+ if (curproc->p_zone->zone_id != GLOBAL_ZONEUNIQID)
+ zp = curproc->p_zone;
+ else
+ zp = hm->hlm_vfsp->vfs_zone;
+
+ if (zp == NULL)
+ eff_zid = GLOBAL_ZONEUNIQID;
+ else
+ eff_zid = zp->zone_id;
+
+ sbp->f_bsize = PAGESIZE;
+ sbp->f_frsize = PAGESIZE;
+
+ /*
+ * Find the amount of available physical and memory swap
+ */
+ mutex_enter(&anoninfo_lock);
+ ASSERT(k_anoninfo.ani_max >= k_anoninfo.ani_phys_resv);
+ blocks = (ulong_t)CURRENT_TOTAL_AVAILABLE_SWAP;
+ mutex_exit(&anoninfo_lock);
+
+ if (blocks > hyprlofs_minfree)
+ sbp->f_bfree = blocks - hyprlofs_minfree;
+ else
+ sbp->f_bfree = 0;
+
+ sbp->f_bavail = sbp->f_bfree;
+
+ /*
+ * Total number of blocks is what's available plus what's been used
+ */
+ sbp->f_blocks = (fsblkcnt64_t)(sbp->f_bfree);
+
+ if (eff_zid != GLOBAL_ZONEUNIQID &&
+ zp->zone_max_swap_ctl != UINT64_MAX) {
+ /*
+ * If the fs is used by a NGZ with a swap cap, then report the
+ * capped size.
+ */
+ rctl_qty_t cap, used;
+ pgcnt_t pgcap, pgused;
+
+ mutex_enter(&zp->zone_mem_lock);
+ cap = zp->zone_max_swap_ctl;
+ used = zp->zone_max_swap;
+ mutex_exit(&zp->zone_mem_lock);
+
+ pgcap = btop(cap);
+ pgused = btop(used);
+
+ sbp->f_bfree = MIN(pgcap - pgused, sbp->f_bfree);
+ sbp->f_bavail = sbp->f_bfree;
+ sbp->f_blocks = MIN(pgcap, sbp->f_blocks);
+ }
+
+ /*
+ * This is fairly inaccurate since it doesn't take into account the
+ * names stored in the directory entries.
+ */
+ sbp->f_ffree = sbp->f_files = ptob(availrmem) /
+ (sizeof (hlnode_t) + sizeof (hldirent_t));
+
+ sbp->f_favail = (fsfilcnt64_t)(sbp->f_ffree);
+ (void) cmpldev(&d32, vfsp->vfs_dev);
+ sbp->f_fsid = d32;
+ (void) strcpy(sbp->f_basetype, vfssw[hyprlofsfstype].vsw_name);
+ (void) strncpy(sbp->f_fstr, hm->hlm_mntpath, sizeof (sbp->f_fstr));
+ /*
+ * ensure null termination
+ */
+ sbp->f_fstr[sizeof (sbp->f_fstr) - 1] = '\0';
+ sbp->f_flag = vf_to_stf(vfsp->vfs_flag);
+ sbp->f_namemax = MAXNAMELEN - 1;
+ return (0);
+}
+
+static int
+hyprlofs_vget(vfs_t *vfsp, vnode_t **vpp, struct fid *fidp)
+{
+ hlfid_t *hfid;
+ hlfsmount_t *hm = (hlfsmount_t *)VFSTOHLM(vfsp);
+ hlnode_t *hp = NULL;
+
+ hfid = (hlfid_t *)fidp;
+ *vpp = NULL;
+
+ mutex_enter(&hm->hlm_contents);
+ for (hp = hm->hlm_rootnode; hp; hp = hp->hln_forw) {
+ mutex_enter(&hp->hln_tlock);
+ if (hp->hln_nodeid == hfid->hlfid_ino) {
+ /*
+ * If the gen numbers don't match we know the file
+ * won't be found since only one hlnode can have this
+ * number at a time.
+ */
+ if (hp->hln_gen != hfid->hlfid_gen ||
+ hp->hln_nlink == 0) {
+ mutex_exit(&hp->hln_tlock);
+ mutex_exit(&hm->hlm_contents);
+ return (0);
+ }
+ *vpp = (vnode_t *)HLNTOV(hp);
+
+ VN_HOLD(*vpp);
+
+ if ((hp->hln_mode & S_ISVTX) &&
+ !(hp->hln_mode & (S_IXUSR | S_IFDIR))) {
+ mutex_enter(&(*vpp)->v_lock);
+ (*vpp)->v_flag |= VISSWAP;
+ mutex_exit(&(*vpp)->v_lock);
+ }
+ mutex_exit(&hp->hln_tlock);
+ mutex_exit(&hm->hlm_contents);
+ return (0);
+ }
+ mutex_exit(&hp->hln_tlock);
+ }
+ mutex_exit(&hm->hlm_contents);
+ return (0);
+}
diff --git a/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c b/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c
new file mode 100644
index 0000000000..0a399c6b6e
--- /dev/null
+++ b/usr/src/uts/common/fs/hyprlofs/hyprlofs_vnops.c
@@ -0,0 +1,1412 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2012 Joyent, Inc. All rights reserved.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/t_lock.h>
+#include <sys/systm.h>
+#include <sys/sysmacros.h>
+#include <sys/user.h>
+#include <sys/time.h>
+#include <sys/vfs.h>
+#include <sys/vfs_opreg.h>
+#include <sys/vnode.h>
+#include <sys/file.h>
+#include <sys/fcntl.h>
+#include <sys/flock.h>
+#include <sys/kmem.h>
+#include <sys/errno.h>
+#include <sys/stat.h>
+#include <sys/cred.h>
+#include <sys/dirent.h>
+#include <sys/pathname.h>
+#include <sys/fs/hyprlofs.h>
+#include <sys/fs/hyprlofs_info.h>
+#include <sys/mman.h>
+#include <vm/pvn.h>
+#include <sys/cmn_err.h>
+#include <sys/buf.h>
+#include <sys/policy.h>
+#include <fs/fs_subr.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+
+static int hyprlofs_add_entry(vnode_t *, char *, char *, cred_t *,
+ caller_context_t *);
+static int hyprlofs_rm_entry(vnode_t *, char *, cred_t *, caller_context_t *,
+ int);
+static int hyprlofs_rm_all(vnode_t *, cred_t *, caller_context_t *, int);
+static int hyprlofs_remove(vnode_t *, char *, cred_t *, caller_context_t *,
+ int);
+static int hyprlofs_get_all(vnode_t *, intptr_t, cred_t *, caller_context_t *,
+ int);
+
+/*
+ * This is a somewhat arbitrary upper limit on the number of entries we can
+ * pass in on a single add/rm ioctl call. This is only used to validate that
+ * the input list looks sane.
+ */
+#define MAX_IOCTL_PARAMS 100000
+
+static int
+hyprlofs_open(vnode_t **vpp, int flag, cred_t *cr, caller_context_t *ct)
+{
+ vnode_t *rvp;
+ int error;
+
+ rvp = REALVP(*vpp);
+
+ if (VTOHLN(*vpp)->hln_looped == 0)
+ return (0);
+
+ /*
+ * looped back, pass through to real vnode. Need to hold new reference
+ * to vp since VOP_OPEN() may decide to release it.
+ */
+ VN_HOLD(rvp);
+ error = VOP_OPEN(&rvp, flag, cr, ct);
+ ASSERT(rvp->v_count > 1);
+ VN_RELE(rvp);
+
+ return (error);
+}
+
+static int
+hyprlofs_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr,
+ caller_context_t *ct)
+{
+ if (VTOHLN(vp)->hln_looped == 0) {
+ cleanlocks(vp, ttoproc(curthread)->p_pid, 0);
+ cleanshares(vp, ttoproc(curthread)->p_pid);
+ return (0);
+ }
+
+ return (VOP_CLOSE(REALVP(vp), flag, count, offset, cr, ct));
+}
+
+static int
+hyprlofs_read(vnode_t *vp, struct uio *uiop, int ioflag, cred_t *cr,
+ caller_context_t *ct)
+{
+ return (VOP_READ(REALVP(vp), uiop, ioflag, cr, ct));
+}
+
+static int
+hyprlofs_write(vnode_t *vp, struct uio *uiop, int ioflag, cred_t *cr,
+ caller_context_t *ct)
+{
+ /* We don't support writing to non-regular files */
+ if (vp->v_type != VREG)
+ return (EINVAL);
+
+ if (vn_is_readonly(vp))
+ return (EROFS);
+
+ return (VOP_WRITE(REALVP(vp), uiop, ioflag, cr, ct));
+}
+
+/* ARGSUSED */
+static int
+hyprlofs_ioctl(vnode_t *vp, int cmd, intptr_t data, int flag,
+ cred_t *cr, int *rvalp, caller_context_t *ct)
+{
+ int len, cnt, error;
+ int i;
+ model_t model;
+ char path[MAXPATHLEN];
+ char nm[MAXPATHLEN];
+
+ /* We only support the hyprlofs ioctls on the root vnode */
+ if (!(vp->v_flag & VROOT))
+ return (ENOTTY);
+
+ /*
+ * Check if managing hyprlofs is allowed.
+ */
+ if (secpolicy_hyprlofs_control(cr) != 0)
+ return (EPERM);
+
+ if (cmd == HYPRLOFS_ADD_ENTRIES || cmd == HYPRLOFS_RM_ENTRIES) {
+ model = get_udatamodel();
+
+ if (model == DATAMODEL_NATIVE) {
+ hyprlofs_entries_t ebuf;
+ hyprlofs_entry_t *e;
+
+ if (copyin((void *)data, &ebuf, sizeof (ebuf)))
+ return (EFAULT);
+ cnt = ebuf.hle_len;
+ if (cnt > MAX_IOCTL_PARAMS)
+ return (EINVAL);
+ len = sizeof (hyprlofs_entry_t) * cnt;
+
+ e = kmem_alloc(len, KM_SLEEP);
+ if (copyin((void *)(ebuf.hle_entries), e, len)) {
+ kmem_free(e, len);
+ return (EFAULT);
+ }
+
+ for (i = 0; i < cnt; i++) {
+ if (e[i].hle_nlen == 0 ||
+ e[i].hle_nlen > MAXPATHLEN)
+ return (EINVAL);
+
+ if (copyin(e[i].hle_name, nm, e[i].hle_nlen)
+ != 0) {
+ kmem_free(e, len);
+ return (EFAULT);
+ }
+ nm[e[i].hle_nlen] = '\0';
+
+ if (cmd == HYPRLOFS_ADD_ENTRIES) {
+ if (e[i].hle_plen == 0 ||
+ e[i].hle_plen > MAXPATHLEN)
+ return (EINVAL);
+
+ if (copyin(e[i].hle_path, path,
+ e[i].hle_plen) != 0) {
+ kmem_free(e, len);
+ return (EFAULT);
+ }
+ path[e[i].hle_plen] = '\0';
+
+ if ((error = hyprlofs_add_entry(vp,
+ path, nm, cr, ct)) != 0) {
+ kmem_free(e, len);
+ return (error);
+ }
+ } else {
+ if ((error = hyprlofs_rm_entry(vp, nm,
+ cr, ct, flag)) != 0) {
+ kmem_free(e, len);
+ return (error);
+ }
+ }
+ }
+
+ kmem_free(e, len);
+ return (0);
+
+ } else {
+ hyprlofs_entries32_t ebuf32;
+ hyprlofs_entry32_t *e32;
+
+ if (copyin((void *)data, &ebuf32, sizeof (ebuf32)))
+ return (EFAULT);
+
+ cnt = ebuf32.hle_len;
+ if (cnt > MAX_IOCTL_PARAMS)
+ return (EINVAL);
+ len = sizeof (hyprlofs_entry32_t) * cnt;
+
+ e32 = kmem_alloc(len, KM_SLEEP);
+ if (copyin((void *)(unsigned long)(ebuf32.hle_entries),
+ e32, len)) {
+ kmem_free(e32, len);
+ return (EFAULT);
+ }
+
+ for (i = 0; i < cnt; i++) {
+ if (e32[i].hle_nlen == 0 ||
+ e32[i].hle_nlen > MAXPATHLEN)
+ return (EINVAL);
+
+ if (copyin((void *)(unsigned long)
+ e32[i].hle_name, nm,
+ e32[i].hle_nlen) != 0) {
+ kmem_free(e32, len);
+ return (EFAULT);
+ }
+ nm[e32[i].hle_nlen] = '\0';
+
+ if (cmd == HYPRLOFS_ADD_ENTRIES) {
+ if (e32[i].hle_plen == 0 ||
+ e32[i].hle_plen > MAXPATHLEN)
+ return (EINVAL);
+
+ if (copyin((void *)(unsigned long)
+ e32[i].hle_path, path,
+ e32[i].hle_plen) != 0) {
+ kmem_free(e32, len);
+ return (EFAULT);
+ }
+ path[e32[i].hle_plen] = '\0';
+
+ if ((error = hyprlofs_add_entry(vp,
+ path, nm, cr, ct)) != 0) {
+ kmem_free(e32, len);
+ return (error);
+ }
+ } else {
+ if ((error = hyprlofs_rm_entry(vp, nm,
+ cr, ct, flag)) != 0) {
+ kmem_free(e32, len);
+ return (error);
+ }
+ }
+ }
+
+ kmem_free(e32, len);
+ return (0);
+ }
+ }
+
+ if (cmd == HYPRLOFS_RM_ALL) {
+ return (hyprlofs_rm_all(vp, cr, ct, flag));
+ }
+
+ if (cmd == HYPRLOFS_GET_ENTRIES) {
+ return (hyprlofs_get_all(vp, data, cr, ct, flag));
+ }
+
+ return (ENOTTY);
+}
+
+/*ARGSUSED2*/
+static int
+hyprlofs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr,
+ caller_context_t *ct)
+{
+ hlnode_t *tp = (hlnode_t *)VTOHLN(vp);
+
+ mutex_enter(&tp->hln_tlock);
+ vap->va_type = vp->v_type;
+ vap->va_mode = tp->hln_mode & MODEMASK;
+ vap->va_uid = tp->hln_uid;
+ vap->va_gid = tp->hln_gid;
+ vap->va_fsid = tp->hln_fsid;
+ vap->va_nodeid = (ino64_t)tp->hln_nodeid;
+ vap->va_nlink = tp->hln_nlink;
+ vap->va_size = (u_offset_t)tp->hln_size;
+ vap->va_atime = tp->hln_atime;
+ vap->va_mtime = tp->hln_mtime;
+ vap->va_ctime = tp->hln_ctime;
+ vap->va_blksize = PAGESIZE;
+ vap->va_rdev = tp->hln_rdev;
+ vap->va_seq = tp->hln_seq;
+
+ vap->va_nblocks = (fsblkcnt64_t)btodb(ptob(btopr(vap->va_size)));
+ mutex_exit(&tp->hln_tlock);
+ return (0);
+}
+
+/*ARGSUSED4*/
+static int
+hyprlofs_setattr(vnode_t *vp, vattr_t *vap, int flags,
+ cred_t *cr, caller_context_t *ct)
+{
+ hlnode_t *tp = (hlnode_t *)VTOHLN(vp);
+ int error = 0;
+ vattr_t *get;
+ long mask;
+
+ /*
+ * Cannot set these attributes
+ */
+ if ((vap->va_mask & AT_NOSET) || (vap->va_mask & AT_XVATTR))
+ return (EINVAL);
+
+ mutex_enter(&tp->hln_tlock);
+
+ get = &tp->hln_attr;
+ /*
+ * Change file access modes. Must be owner or have sufficient
+ * privileges.
+ */
+ error = secpolicy_vnode_setattr(cr, vp, vap, get, flags,
+ hyprlofs_taccess, tp);
+
+ if (error)
+ goto out;
+
+ mask = vap->va_mask;
+
+ if (mask & AT_MODE) {
+ get->va_mode &= S_IFMT;
+ get->va_mode |= vap->va_mode & ~S_IFMT;
+ }
+
+ if (mask & AT_UID)
+ get->va_uid = vap->va_uid;
+ if (mask & AT_GID)
+ get->va_gid = vap->va_gid;
+ if (mask & AT_ATIME)
+ get->va_atime = vap->va_atime;
+ if (mask & AT_MTIME)
+ get->va_mtime = vap->va_mtime;
+
+ if (mask & (AT_UID | AT_GID | AT_MODE | AT_MTIME))
+ gethrestime(&tp->hln_ctime);
+
+out:
+ mutex_exit(&tp->hln_tlock);
+ return (error);
+}
+
+static int
+hyprlofs_access(vnode_t *vp, int mode, int flags, cred_t *cr,
+ caller_context_t *ct)
+{
+ hlnode_t *tp = (hlnode_t *)VTOHLN(vp);
+ int error;
+
+ if (mode & VWRITE) {
+ if (vp->v_type == VREG && vn_is_readonly(vp))
+ return (EROFS);
+ }
+ if (VTOHLN(vp)->hln_looped == 1)
+ return (VOP_ACCESS(REALVP(vp), mode, flags, cr, ct));
+
+ mutex_enter(&tp->hln_tlock);
+ error = hyprlofs_taccess(tp, mode, cr);
+ mutex_exit(&tp->hln_tlock);
+ return (error);
+}
+
+/* ARGSUSED3 */
+static int
+hyprlofs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp,
+ int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct,
+ int *direntflags, pathname_t *realpnp)
+{
+ hlnode_t *tp = (hlnode_t *)VTOHLN(dvp);
+ hlnode_t *ntp = NULL;
+ int error;
+
+ if (VTOHLN(dvp)->hln_looped == 1)
+ return (VOP_LOOKUP(REALVP(dvp), nm, vpp, pnp, flags, rdir,
+ cr, ct, direntflags, realpnp));
+
+ if (flags & LOOKUP_XATTR)
+ return (EINVAL);
+
+ /* Null component name is a synonym for directory being searched. */
+ if (*nm == '\0') {
+ VN_HOLD(dvp);
+ *vpp = dvp;
+ return (0);
+ }
+ ASSERT(tp);
+
+ if ((error = hyprlofs_dirlookup(tp, nm, &ntp, cr)) == 0) {
+ ASSERT(ntp);
+ *vpp = HLNTOV(ntp);
+ }
+ return (error);
+}
+
+/*
+ * Create the loopback from the hyprlofs vnode to the real vnode.
+ */
+static int
+hyprlofs_loopback(vnode_t *dvp, vnode_t *rvp, char *nm, vattr_t *vap,
+ int mode, cred_t *cr, caller_context_t *ct)
+{
+ hlnode_t *parent;
+ hlfsmount_t *tm;
+ int error;
+ hlnode_t *oldtp;
+ vnode_t *vp;
+
+ parent = (hlnode_t *)VTOHLN(dvp);
+ tm = (hlfsmount_t *)VTOHLM(dvp);
+ error = 0;
+ oldtp = NULL;
+
+ if (vap->va_type == VREG && (vap->va_mode & VSVTX)) {
+ /* we don't support the sticky bit */
+ vap->va_mode &= ~VSVTX;
+ } else if (vap->va_type == VNON) {
+ return (EINVAL);
+ }
+
+ /* Null component name is a synonym for directory being searched. */
+ if (*nm == '\0') {
+ VN_HOLD(dvp);
+ oldtp = parent;
+ } else {
+ error = hyprlofs_dirlookup(parent, nm, &oldtp, cr);
+ }
+
+ if (error == 0) { /* name found */
+ ASSERT(oldtp);
+
+ rw_enter(&oldtp->hln_rwlock, RW_WRITER);
+
+ /*
+ * if create/read-only an existing directory, allow it
+ */
+ if ((oldtp->hln_type == VDIR) && (mode & VWRITE))
+ error = EISDIR;
+ else {
+ error = hyprlofs_taccess(oldtp, mode, cr);
+ }
+
+ if (error) {
+ rw_exit(&oldtp->hln_rwlock);
+ hlnode_rele(oldtp);
+ return (error);
+ }
+
+ vp = HLNTOV(oldtp);
+ rw_exit(&oldtp->hln_rwlock);
+
+ if (vp->v_type == VREG) {
+ hlnode_rele(oldtp);
+ return (EEXIST);
+ }
+
+ vnevent_create(vp, ct);
+ return (0);
+ }
+
+ if (error != ENOENT)
+ return (error);
+
+ rw_enter(&parent->hln_rwlock, RW_WRITER);
+ error = hyprlofs_direnter(tm, parent, nm, DE_CREATE, rvp, vap, NULL,
+ cr);
+ rw_exit(&parent->hln_rwlock);
+
+ return (error);
+}
+
+/*
+ * Create an in-memory directory based on the add-entry ioctl name.
+ * If the dir exists, return EEXIST but still also return node in vpp.
+ */
+static int
+hyprlofs_mkdir(vnode_t *dvp, char *nm, vattr_t *va, vnode_t **vpp, cred_t *cr)
+{
+ hlnode_t *parent = (hlnode_t *)VTOHLN(dvp);
+ hlnode_t *self = NULL;
+ hlfsmount_t *tm = (hlfsmount_t *)VTOHLM(dvp);
+ int error;
+
+ /*
+ * Might be dangling directory. Catch it here, because a ENOENT return
+ * from hyprlofs_dirlookup() is a valid return.
+ */
+ if (parent->hln_nlink == 0)
+ return (ENOENT);
+
+ error = hyprlofs_dirlookup(parent, nm, &self, cr);
+ if (error == 0) {
+ ASSERT(self);
+ hlnode_rele(self);
+ /* We can't loop in under a looped in directory */
+ if (self->hln_looped)
+ return (EACCES);
+ *vpp = HLNTOV(self);
+ return (EEXIST);
+ }
+ if (error != ENOENT)
+ return (error);
+
+ rw_enter(&parent->hln_rwlock, RW_WRITER);
+ error = hyprlofs_direnter(tm, parent, nm, DE_MKDIR, (vnode_t *)NULL,
+ va, &self, cr);
+ rw_exit(&parent->hln_rwlock);
+
+ if (error == 0 || error == EEXIST) {
+ hlnode_rele(self);
+ *vpp = HLNTOV(self);
+ }
+
+ return (error);
+}
+
+/*
+ * Loop in a file or directory into the namespace.
+ */
+static int
+hyprlofs_add_entry(vnode_t *vp, char *fspath, char *fsname,
+ cred_t *cr, caller_context_t *ct)
+{
+ int error;
+ char *p, *pnm;
+ vnode_t *realvp, *dvp;
+ vattr_t va;
+
+ /*
+ * Get vnode for the real file/dir. We'll have a hold on realvp which
+ * we won't vn_rele until hyprlofs_inactive.
+ */
+ if ((error = lookupname(fspath, UIO_SYSSPACE, FOLLOW, NULLVPP,
+ &realvp)) != 0)
+ return (error);
+
+ /* no devices allowed */
+ if (IS_DEVVP(realvp)) {
+ VN_RELE(realvp);
+ return (ENODEV);
+ }
+
+ /*
+ * realvp may be an AUTOFS node, in which case we perform a VOP_ACCESS
+ * to trigger the mount of the intended filesystem. This causes a
+ * loopback mount of the intended filesystem instead of the AUTOFS
+ * filesystem.
+ */
+ if ((error = VOP_ACCESS(realvp, 0, 0, cr, NULL)) != 0) {
+ VN_RELE(realvp);
+ return (error);
+ }
+
+ /*
+ * We're interested in the top most filesystem. This is specially
+ * important when fspath is a trigger AUTOFS node, since we're really
+ * interested in mounting the filesystem AUTOFS mounted as result of
+ * the VOP_ACCESS() call not the AUTOFS node itself.
+ */
+ if (vn_mountedvfs(realvp) != NULL) {
+ if ((error = traverse(&realvp)) != 0) {
+ VN_RELE(realvp);
+ return (error);
+ }
+ }
+
+ va.va_type = VNON;
+ /*
+ * If the target name is a path, make sure we have all of the
+ * intermediate directories, creating them if necessary.
+ */
+ dvp = vp;
+ pnm = p = fsname;
+
+ /* path cannot be absolute */
+ if (*p == '/') {
+ VN_RELE(realvp);
+ return (EINVAL);
+ }
+
+ for (p = strchr(pnm, '/'); p != NULL; p = strchr(pnm, '/')) {
+ if (va.va_type == VNON)
+ /* use the top-level dir as the template va for mkdir */
+ if ((error = VOP_GETATTR(vp, &va, 0, cr, NULL)) != 0) {
+ VN_RELE(realvp);
+ return (error);
+ }
+
+ *p = '\0';
+
+ /* Path component cannot be empty or relative */
+ if (pnm[0] == '\0' || (pnm[0] == '.' && pnm[1] == '.')) {
+ VN_RELE(realvp);
+ return (EINVAL);
+ }
+
+ if ((error = hyprlofs_mkdir(dvp, pnm, &va, &dvp, cr)) != 0 &&
+ error != EEXIST) {
+ VN_RELE(realvp);
+ return (error);
+ }
+
+ *p = '/';
+ pnm = p + 1;
+ }
+
+ /* The file name is required */
+ if (pnm[0] == '\0') {
+ VN_RELE(realvp);
+ return (EINVAL);
+ }
+
+ /* Now use the real file's va as the template va */
+ if ((error = VOP_GETATTR(realvp, &va, 0, cr, NULL)) != 0) {
+ VN_RELE(realvp);
+ return (error);
+ }
+
+ /* Make the vnode */
+ error = hyprlofs_loopback(dvp, realvp, pnm, &va, va.va_mode, cr, ct);
+ if (error != 0)
+ VN_RELE(realvp);
+ return (error);
+}
+
+/*
+ * Remove a looped in file from the namespace.
+ */
+static int
+hyprlofs_rm_entry(vnode_t *dvp, char *fsname, cred_t *cr, caller_context_t *ct,
+ int flags)
+{
+ int error;
+ char *p, *pnm;
+ hlnode_t *parent;
+ hlnode_t *fndtp;
+
+ pnm = p = fsname;
+
+ /* path cannot be absolute */
+ if (*p == '/')
+ return (EINVAL);
+
+ /*
+ * If the target name is a path, get the containing dir and simple
+ * file name.
+ */
+ parent = (hlnode_t *)VTOHLN(dvp);
+ for (p = strchr(pnm, '/'); p != NULL; p = strchr(pnm, '/')) {
+ *p = '\0';
+
+ /* Path component cannot be empty or relative */
+ if (pnm[0] == '\0' || (pnm[0] == '.' && pnm[1] == '.'))
+ return (EINVAL);
+
+ if ((error = hyprlofs_dirlookup(parent, pnm, &fndtp, cr)) != 0)
+ return (error);
+
+ dvp = HLNTOV(fndtp);
+ parent = fndtp;
+ pnm = p + 1;
+ }
+
+ /* The file name is required */
+ if (pnm[0] == '\0')
+ return (EINVAL);
+
+ /* Remove the entry from the parent dir */
+ return (hyprlofs_remove(dvp, pnm, cr, ct, flags));
+}
+
+/*
+ * Remove all looped in files from the namespace.
+ */
+static int
+hyprlofs_rm_all(vnode_t *dvp, cred_t *cr, caller_context_t *ct,
+ int flags)
+{
+ int error = 0;
+ hlnode_t *hp = (hlnode_t *)VTOHLN(dvp);
+ hldirent_t *hdp;
+
+ hlnode_hold(hp);
+
+ /*
+ * There's a window here where someone could have removed
+ * all the entries in the directory after we put a hold on the
+ * vnode but before we grabbed the rwlock. Just return.
+ */
+ if (hp->hln_dir == NULL) {
+ if (hp->hln_nlink) {
+ panic("empty directory 0x%p", (void *)hp);
+ /*NOTREACHED*/
+ }
+ goto done;
+ }
+
+ hdp = hp->hln_dir;
+ while (hdp) {
+ hlnode_t *fndhp;
+
+ if (strcmp(hdp->hld_name, ".") == 0 ||
+ strcmp(hdp->hld_name, "..") == 0) {
+ hdp = hdp->hld_next;
+ continue;
+ }
+
+ /* This holds the fndhp vnode */
+ error = hyprlofs_dirlookup(hp, hdp->hld_name, &fndhp, cr);
+ if (error != 0)
+ goto done;
+ hlnode_rele(fndhp);
+
+ if (fndhp->hln_looped == 0) {
+ /* recursively remove contents of this subdir */
+ if (fndhp->hln_type == VDIR) {
+ vnode_t *tvp = HLNTOV(fndhp);
+
+ error = hyprlofs_rm_all(tvp, cr, ct, flags);
+ if (error != 0)
+ goto done;
+ }
+ }
+
+ /* remove the entry */
+ error = hyprlofs_remove(dvp, hdp->hld_name, cr, ct, flags);
+ if (error != 0)
+ goto done;
+
+ hdp = hp->hln_dir;
+ }
+
+done:
+ hlnode_rele(hp);
+ return (error);
+}
+
+/*
+ * Get a list of all looped in files in the namespace.
+ */
+static int
+hyprlofs_get_all_entries(vnode_t *dvp, hyprlofs_curr_entry_t *hcp,
+ char *prefix, int *pcnt, int n_max,
+ cred_t *cr, caller_context_t *ct, int flags)
+{
+ int error = 0;
+ int too_big = 0;
+ int cnt;
+ int len;
+ hlnode_t *hp = (hlnode_t *)VTOHLN(dvp);
+ hldirent_t *hdp;
+ char *path;
+
+ cnt = *pcnt;
+ path = kmem_alloc(MAXPATHLEN, KM_SLEEP);
+
+ hlnode_hold(hp);
+
+ /*
+ * There's a window here where someone could have removed
+ * all the entries in the directory after we put a hold on the
+ * vnode but before we grabbed the rwlock. Just return.
+ */
+ if (hp->hln_dir == NULL) {
+ if (hp->hln_nlink) {
+ panic("empty directory 0x%p", (void *)hp);
+ /*NOTREACHED*/
+ }
+ goto done;
+ }
+
+ hdp = hp->hln_dir;
+ while (hdp) {
+ hlnode_t *fndhp;
+ vnode_t *tvp;
+
+ if (strcmp(hdp->hld_name, ".") == 0 ||
+ strcmp(hdp->hld_name, "..") == 0) {
+ hdp = hdp->hld_next;
+ continue;
+ }
+
+ /* This holds the fndhp vnode */
+ error = hyprlofs_dirlookup(hp, hdp->hld_name, &fndhp, cr);
+ if (error != 0)
+ goto done;
+ hlnode_rele(fndhp);
+
+ if (fndhp->hln_looped == 0) {
+ /* recursively get contents of this subdir */
+ VERIFY(fndhp->hln_type == VDIR);
+ tvp = HLNTOV(fndhp);
+
+ if (*prefix == '\0')
+ (void) strlcpy(path, hdp->hld_name, MAXPATHLEN);
+ else
+ (void) snprintf(path, MAXPATHLEN, "%s/%s",
+ prefix, hdp->hld_name);
+
+ error = hyprlofs_get_all_entries(tvp, hcp, path,
+ &cnt, n_max, cr, ct, flags);
+
+ if (error == E2BIG) {
+ too_big = 1;
+ error = 0;
+ }
+ if (error != 0)
+ goto done;
+ } else {
+ if (cnt < n_max) {
+ char *p;
+
+ if (*prefix == '\0')
+ (void) strlcpy(path, hdp->hld_name,
+ MAXPATHLEN);
+ else
+ (void) snprintf(path, MAXPATHLEN,
+ "%s/%s", prefix, hdp->hld_name);
+
+ len = strlen(path);
+ ASSERT(len <= MAXPATHLEN);
+ if (copyout(path, (void *)(hcp[cnt].hce_name),
+ len)) {
+ error = EFAULT;
+ goto done;
+ }
+
+ tvp = REALVP(HLNTOV(fndhp));
+ if (tvp->v_path == NULL) {
+ p = "<unknown>";
+ } else {
+ p = tvp->v_path;
+ }
+ len = strlen(p);
+ ASSERT(len <= MAXPATHLEN);
+ if (copyout(p, (void *)(hcp[cnt].hce_path),
+ len)) {
+ error = EFAULT;
+ goto done;
+ }
+ }
+
+ cnt++;
+ if (cnt > n_max)
+ too_big = 1;
+ }
+
+ hdp = hdp->hld_next;
+ }
+
+done:
+ hlnode_rele(hp);
+ kmem_free(path, MAXPATHLEN);
+
+ *pcnt = cnt;
+ if (error == 0 && too_big == 1)
+ error = E2BIG;
+
+ return (error);
+}
+
+/*
+ * Return a list of all looped in files in the namespace.
+ */
+static int
+hyprlofs_get_all(vnode_t *dvp, intptr_t data, cred_t *cr, caller_context_t *ct,
+ int flags)
+{
+ int limit, cnt, error;
+ model_t model;
+ hyprlofs_curr_entry_t *e;
+
+ model = get_udatamodel();
+
+ if (model == DATAMODEL_NATIVE) {
+ hyprlofs_curr_entries_t ebuf;
+
+ if (copyin((void *)data, &ebuf, sizeof (ebuf)))
+ return (EFAULT);
+ limit = ebuf.hce_cnt;
+ e = ebuf.hce_entries;
+ if (limit > MAX_IOCTL_PARAMS)
+ return (EINVAL);
+
+ } else {
+ hyprlofs_curr_entries32_t ebuf32;
+
+ if (copyin((void *)data, &ebuf32, sizeof (ebuf32)))
+ return (EFAULT);
+
+ limit = ebuf32.hce_cnt;
+ e = (hyprlofs_curr_entry_t *)(unsigned long)
+ (ebuf32.hce_entries);
+ if (limit > MAX_IOCTL_PARAMS)
+ return (EINVAL);
+ }
+
+ cnt = 0;
+ error = hyprlofs_get_all_entries(dvp, e, "", &cnt, limit, cr, ct,
+ flags);
+
+ if (error == 0 || error == E2BIG) {
+ if (model == DATAMODEL_NATIVE) {
+ hyprlofs_curr_entries_t ebuf;
+
+ ebuf.hce_cnt = cnt;
+ if (copyout(&ebuf, (void *)data, sizeof (ebuf)))
+ return (EFAULT);
+
+ } else {
+ hyprlofs_curr_entries32_t ebuf32;
+
+ ebuf32.hce_cnt = cnt;
+ if (copyout(&ebuf32, (void *)data, sizeof (ebuf32)))
+ return (EFAULT);
+ }
+ }
+
+ return (error);
+}
+
+/* ARGSUSED3 */
+static int
+hyprlofs_remove(vnode_t *dvp, char *nm, cred_t *cr, caller_context_t *ct,
+ int flags)
+{
+ hlnode_t *parent = (hlnode_t *)VTOHLN(dvp);
+ int error;
+ hlnode_t *hp = NULL;
+
+ /* This holds the hp vnode */
+ error = hyprlofs_dirlookup(parent, nm, &hp, cr);
+ if (error)
+ return (error);
+
+ ASSERT(hp);
+ rw_enter(&parent->hln_rwlock, RW_WRITER);
+ rw_enter(&hp->hln_rwlock, RW_WRITER);
+
+ error = hyprlofs_dirdelete(parent, hp, nm, DR_REMOVE, cr);
+
+ rw_exit(&hp->hln_rwlock);
+ rw_exit(&parent->hln_rwlock);
+ vnevent_remove(HLNTOV(hp), dvp, nm, ct);
+
+ /*
+ * We've now dropped the dir link so by rele-ing our vnode we should
+ * clean up in hyprlofs_inactive.
+ */
+ hlnode_rele(hp);
+
+ return (error);
+}
+
+/* ARGSUSED4 */
+static int
+hyprlofs_rmdir(vnode_t *dvp, char *nm, vnode_t *cdir, cred_t *cr,
+ caller_context_t *ct, int flags)
+{
+ hlnode_t *parent = (hlnode_t *)VTOHLN(dvp);
+ hlnode_t *self = NULL;
+ vnode_t *vp;
+ int error = 0;
+
+ /* Return error if removing . or .. */
+ if (strcmp(nm, ".") == 0)
+ return (EINVAL);
+ if (strcmp(nm, "..") == 0)
+ return (EEXIST); /* Should be ENOTEMPTY */
+ error = hyprlofs_dirlookup(parent, nm, &self, cr);
+ if (error)
+ return (error);
+
+ rw_enter(&parent->hln_rwlock, RW_WRITER);
+ rw_enter(&self->hln_rwlock, RW_WRITER);
+
+ vp = HLNTOV(self);
+ if (vp == dvp || vp == cdir) {
+ error = EINVAL;
+ goto done1;
+ }
+ if (self->hln_type != VDIR) {
+ error = ENOTDIR;
+ goto done1;
+ }
+
+ /*
+ * When a dir is looped in, we only remove the in-memory dir, not the
+ * backing dir.
+ */
+ if (self->hln_looped == 0) {
+ mutex_enter(&self->hln_tlock);
+ if (self->hln_nlink > 2) {
+ mutex_exit(&self->hln_tlock);
+ error = EEXIST;
+ goto done1;
+ }
+ mutex_exit(&self->hln_tlock);
+
+ if (vn_vfswlock(vp)) {
+ error = EBUSY;
+ goto done1;
+ }
+ if (vn_mountedvfs(vp) != NULL) {
+ error = EBUSY;
+ goto done;
+ }
+
+ /*
+ * Check for an empty directory, i.e. only includes entries for
+ * "." and ".."
+ */
+ if (self->hln_dirents > 2) {
+ error = EEXIST; /* SIGH should be ENOTEMPTY */
+ /*
+ * Update atime because checking hln_dirents is
+ * equivalent to reading the directory
+ */
+ gethrestime(&self->hln_atime);
+ goto done;
+ }
+
+ error = hyprlofs_dirdelete(parent, self, nm, DR_RMDIR, cr);
+ } else {
+ error = hyprlofs_dirdelete(parent, self, nm, DR_REMOVE, cr);
+ }
+
+done:
+ if (self->hln_looped == 0)
+ vn_vfsunlock(vp);
+done1:
+ rw_exit(&self->hln_rwlock);
+ rw_exit(&parent->hln_rwlock);
+ vnevent_rmdir(HLNTOV(self), dvp, nm, ct);
+
+ /*
+ * We've now dropped the dir link so by rele-ing our vnode we should
+ * clean up in hyprlofs_inactive.
+ */
+ hlnode_rele(self);
+
+ return (error);
+}
+
+static int
+hyprlofs_readdir(vnode_t *vp, struct uio *uiop, cred_t *cr, int *eofp,
+ caller_context_t *ct, int flags)
+{
+ hlnode_t *hp = (hlnode_t *)VTOHLN(vp);
+ hldirent_t *hdp;
+ int error = 0;
+ size_t namelen;
+ struct dirent64 *dp;
+ ulong_t offset;
+ ulong_t total_bytes_wanted;
+ long outcount = 0;
+ long bufsize;
+ int reclen;
+ caddr_t outbuf;
+
+ if (VTOHLN(vp)->hln_looped == 1)
+ return (VOP_READDIR(REALVP(vp), uiop, cr, eofp, ct, flags));
+
+ if (uiop->uio_loffset >= MAXOFF_T) {
+ if (eofp)
+ *eofp = 1;
+ return (0);
+ }
+ /* assuming syscall has already called hln_rwlock */
+ ASSERT(RW_READ_HELD(&hp->hln_rwlock));
+
+ if (uiop->uio_iovcnt != 1)
+ return (EINVAL);
+
+ if (vp->v_type != VDIR)
+ return (ENOTDIR);
+
+ /*
+ * There's a window here where someone could have removed
+ * all the entries in the directory after we put a hold on the
+ * vnode but before we grabbed the rwlock. Just return.
+ */
+ if (hp->hln_dir == NULL) {
+ if (hp->hln_nlink) {
+ panic("empty directory 0x%p", (void *)hp);
+ /*NOTREACHED*/
+ }
+ return (0);
+ }
+
+ /* Get space for multiple dir entries */
+ total_bytes_wanted = uiop->uio_iov->iov_len;
+ bufsize = total_bytes_wanted + sizeof (struct dirent64);
+ outbuf = kmem_alloc(bufsize, KM_SLEEP);
+
+ dp = (struct dirent64 *)((uintptr_t)outbuf);
+
+ offset = 0;
+ hdp = hp->hln_dir;
+ while (hdp) {
+ namelen = strlen(hdp->hld_name); /* no +1 needed */
+ offset = hdp->hld_offset;
+ if (offset >= uiop->uio_offset) {
+ reclen = (int)DIRENT64_RECLEN(namelen);
+ if (outcount + reclen > total_bytes_wanted) {
+ if (!outcount)
+ /* Buffer too small for any entries. */
+ error = EINVAL;
+ break;
+ }
+ ASSERT(hdp->hld_hlnode != NULL);
+
+ /* zero out uninitialized bytes */
+ (void) strncpy(dp->d_name, hdp->hld_name,
+ DIRENT64_NAMELEN(reclen));
+ dp->d_reclen = (ushort_t)reclen;
+ dp->d_ino = (ino64_t)hdp->hld_hlnode->hln_nodeid;
+ dp->d_off = (offset_t)hdp->hld_offset + 1;
+ dp = (struct dirent64 *)
+ ((uintptr_t)dp + dp->d_reclen);
+ outcount += reclen;
+ ASSERT(outcount <= bufsize);
+ }
+ hdp = hdp->hld_next;
+ }
+
+ if (!error)
+ error = uiomove(outbuf, outcount, UIO_READ, uiop);
+
+ if (!error) {
+ /*
+ * If we reached the end of the list our offset should now be
+ * just past the end.
+ */
+ if (!hdp) {
+ offset += 1;
+ if (eofp)
+ *eofp = 1;
+ } else if (eofp)
+ *eofp = 0;
+ uiop->uio_offset = offset;
+ }
+ gethrestime(&hp->hln_atime);
+ kmem_free(outbuf, bufsize);
+ return (error);
+}
+
+static int
+hyprlofs_fsync(vnode_t *vp, int syncflag, cred_t *cr, caller_context_t *ct)
+{
+ if (VTOHLN(vp)->hln_looped == 1)
+ return (VOP_FSYNC(REALVP(vp), syncflag, cr, ct));
+ return (0);
+}
+
+/* ARGSUSED */
+static void
+hyprlofs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct)
+{
+ hlnode_t *hp = (hlnode_t *)VTOHLN(vp);
+ hlfsmount_t *hm = (hlfsmount_t *)VFSTOHLM(vp->v_vfsp);
+
+ rw_enter(&hp->hln_rwlock, RW_WRITER);
+
+ mutex_enter(&hp->hln_tlock);
+ mutex_enter(&vp->v_lock);
+ ASSERT(vp->v_count >= 1);
+
+ /*
+ * If we don't have the last hold or the link count is non-zero,
+ * there's nothing to do except drop our hold.
+ */
+ if (vp->v_count > 1 || hp->hln_nlink != 0) {
+ vp->v_count--;
+ mutex_exit(&vp->v_lock);
+ mutex_exit(&hp->hln_tlock);
+ rw_exit(&hp->hln_rwlock);
+ return;
+ }
+
+ mutex_exit(&vp->v_lock);
+ mutex_exit(&hp->hln_tlock);
+
+ /* release hold on the real vnode now */
+ if (hp->hln_looped == 1 && hp->hln_realvp != NULL)
+ VN_RELE(hp->hln_realvp);
+
+ /* Here's our chance to send invalid event while we're between locks */
+ vn_invalid(HLNTOV(hp));
+
+ mutex_enter(&hm->hlm_contents);
+ if (hp->hln_forw == NULL)
+ hm->hlm_rootnode->hln_back = hp->hln_back;
+ else
+ hp->hln_forw->hln_back = hp->hln_back;
+ hp->hln_back->hln_forw = hp->hln_forw;
+ mutex_exit(&hm->hlm_contents);
+ rw_exit(&hp->hln_rwlock);
+ rw_destroy(&hp->hln_rwlock);
+ mutex_destroy(&hp->hln_tlock);
+ vn_free(HLNTOV(hp));
+ kmem_free(hp, sizeof (hlnode_t));
+}
+
+static int
+hyprlofs_fid(vnode_t *vp, struct fid *fidp, caller_context_t *ct)
+{
+ hlnode_t *hp = (hlnode_t *)VTOHLN(vp);
+ hlfid_t *hfid;
+
+ if (VTOHLN(vp)->hln_looped == 1)
+ return (VOP_FID(REALVP(vp), fidp, ct));
+
+ if (fidp->fid_len < (sizeof (hlfid_t) - sizeof (ushort_t))) {
+ fidp->fid_len = sizeof (hlfid_t) - sizeof (ushort_t);
+ return (ENOSPC);
+ }
+
+ hfid = (hlfid_t *)fidp;
+ bzero(hfid, sizeof (hlfid_t));
+ hfid->hlfid_len = (int)sizeof (hlfid_t) - sizeof (ushort_t);
+
+ hfid->hlfid_ino = hp->hln_nodeid;
+ hfid->hlfid_gen = hp->hln_gen;
+
+ return (0);
+}
+
+static int
+hyprlofs_getpage(vnode_t *vp, offset_t off, size_t len, uint_t *protp,
+ page_t *pl[], size_t plsz, struct seg *seg, caddr_t addr, enum seg_rw rw,
+ cred_t *cr, caller_context_t *ct)
+{
+ ASSERT(VTOHLN(vp)->hln_looped == 1);
+ return (VOP_GETPAGE(REALVP(vp), off, len, protp, pl, plsz, seg, addr,
+ rw, cr, ct));
+}
+
+int
+hyprlofs_putpage(vnode_t *vp, offset_t off, size_t len, int flags,
+ cred_t *cr, caller_context_t *ct)
+{
+ ASSERT(VTOHLN(vp)->hln_looped == 1);
+ return (VOP_PUTPAGE(REALVP(vp), off, len, flags, cr, ct));
+}
+
+static int
+hyprlofs_map(vnode_t *vp, offset_t off, struct as *as, caddr_t *addrp,
+ size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, cred_t *cr,
+ caller_context_t *ct)
+{
+ ASSERT(VTOHLN(vp)->hln_looped == 1);
+ return (VOP_MAP(REALVP(vp), off, as, addrp, len, prot, maxprot, flags,
+ cr, ct));
+}
+
+static int
+hyprlofs_addmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr,
+ size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, cred_t *cr,
+ caller_context_t *ct)
+{
+ ASSERT(VTOHLN(vp)->hln_looped == 1);
+ return (VOP_ADDMAP(REALVP(vp), off, as, addr, len, prot, maxprot,
+ flags, cr, ct));
+}
+
+static int
+hyprlofs_delmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr,
+ size_t len, uint_t prot, uint_t maxprot, uint_t flags, cred_t *cr,
+ caller_context_t *ct)
+{
+ ASSERT(VTOHLN(vp)->hln_looped == 1);
+ return (VOP_DELMAP(REALVP(vp), off, as, addr, len, prot, maxprot,
+ flags, cr, ct));
+}
+
+static int
+hyprlofs_space(vnode_t *vp, int cmd, struct flock64 *bfp, int flag,
+ offset_t offset, cred_t *cr, caller_context_t *ct)
+{
+ ASSERT(VTOHLN(vp)->hln_looped == 1);
+ return (VOP_SPACE(REALVP(vp), cmd, bfp, flag, offset, cr, ct));
+}
+
+static int
+hyprlofs_seek(vnode_t *vp, offset_t ooff, offset_t *noffp,
+ caller_context_t *ct)
+{
+ if (VTOHLN(vp)->hln_looped == 0)
+ return ((*noffp < 0 || *noffp > MAXOFFSET_T) ? EINVAL : 0);
+
+ return (VOP_SEEK(REALVP(vp), ooff, noffp, ct));
+}
+
+static int
+hyprlofs_rwlock(vnode_t *vp, int write_lock, caller_context_t *ct)
+{
+ hlnode_t *hp = VTOHLN(vp);
+
+ if (hp->hln_looped == 1)
+ return (VOP_RWLOCK(REALVP(vp), write_lock, ct));
+
+ if (write_lock) {
+ rw_enter(&hp->hln_rwlock, RW_WRITER);
+ } else {
+ rw_enter(&hp->hln_rwlock, RW_READER);
+ }
+ return (write_lock);
+}
+
+static void
+hyprlofs_rwunlock(vnode_t *vp, int write_lock, caller_context_t *ct)
+{
+ hlnode_t *hp = VTOHLN(vp);
+
+ if (hp->hln_looped == 1) {
+ VOP_RWUNLOCK(REALVP(vp), write_lock, ct);
+ return;
+ }
+
+ rw_exit(&hp->hln_rwlock);
+}
+
+static int
+hyprlofs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
+ caller_context_t *ct)
+{
+ int error;
+
+ if (VTOHLN(vp)->hln_looped == 1)
+ return (VOP_PATHCONF(REALVP(vp), cmd, valp, cr, ct));
+
+ switch (cmd) {
+ case _PC_XATTR_ENABLED:
+ case _PC_XATTR_EXISTS:
+ case _PC_SATTR_ENABLED:
+ case _PC_SATTR_EXISTS:
+ error = EINVAL;
+ break;
+ case _PC_TIMESTAMP_RESOLUTION:
+ /* nanosecond timestamp resolution */
+ *valp = 1L;
+ error = 0;
+ break;
+ default:
+ error = fs_pathconf(vp, cmd, valp, cr, ct);
+ }
+ return (error);
+}
+
+
+struct vnodeops *hyprlofs_vnodeops;
+
+const fs_operation_def_t hyprlofs_vnodeops_template[] = {
+ VOPNAME_OPEN, { .vop_open = hyprlofs_open },
+ VOPNAME_CLOSE, { .vop_close = hyprlofs_close },
+ VOPNAME_READ, { .vop_read = hyprlofs_read },
+ VOPNAME_WRITE, { .vop_write = hyprlofs_write },
+ VOPNAME_IOCTL, { .vop_ioctl = hyprlofs_ioctl },
+ VOPNAME_GETATTR, { .vop_getattr = hyprlofs_getattr },
+ VOPNAME_SETATTR, { .vop_setattr = hyprlofs_setattr },
+ VOPNAME_ACCESS, { .vop_access = hyprlofs_access },
+ VOPNAME_LOOKUP, { .vop_lookup = hyprlofs_lookup },
+ VOPNAME_CREATE, { .error = fs_error },
+ VOPNAME_REMOVE, { .vop_remove = hyprlofs_remove },
+ VOPNAME_LINK, { .error = fs_error },
+ VOPNAME_RENAME, { .error = fs_error },
+ VOPNAME_MKDIR, { .error = fs_error },
+ VOPNAME_RMDIR, { .vop_rmdir = hyprlofs_rmdir },
+ VOPNAME_READDIR, { .vop_readdir = hyprlofs_readdir },
+ VOPNAME_SYMLINK, { .error = fs_error },
+ VOPNAME_READLINK, { .error = fs_error },
+ VOPNAME_FSYNC, { .vop_fsync = hyprlofs_fsync },
+ VOPNAME_INACTIVE, { .vop_inactive = hyprlofs_inactive },
+ VOPNAME_FID, { .vop_fid = hyprlofs_fid },
+ VOPNAME_RWLOCK, { .vop_rwlock = hyprlofs_rwlock },
+ VOPNAME_RWUNLOCK, { .vop_rwunlock = hyprlofs_rwunlock },
+ VOPNAME_SEEK, { .vop_seek = hyprlofs_seek },
+ VOPNAME_SPACE, { .vop_space = hyprlofs_space },
+ VOPNAME_GETPAGE, { .vop_getpage = hyprlofs_getpage },
+ VOPNAME_PUTPAGE, { .vop_putpage = hyprlofs_putpage },
+ VOPNAME_MAP, { .vop_map = hyprlofs_map },
+ VOPNAME_ADDMAP, { .vop_addmap = hyprlofs_addmap },
+ VOPNAME_DELMAP, { .vop_delmap = hyprlofs_delmap },
+ VOPNAME_PATHCONF, { .vop_pathconf = hyprlofs_pathconf },
+ VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
+ NULL, NULL
+};
diff --git a/usr/src/uts/common/fs/lxproc/lxpr_subr.c b/usr/src/uts/common/fs/lxproc/lxpr_subr.c
new file mode 100644
index 0000000000..3c1405d4af
--- /dev/null
+++ b/usr/src/uts/common/fs/lxproc/lxpr_subr.c
@@ -0,0 +1,524 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+#include <sys/varargs.h>
+#include <sys/cpuvar.h>
+#include <sys/mman.h>
+#include <sys/vmsystm.h>
+#include <sys/prsystm.h>
+
+#include "lxproc.h"
+
+#define LXPRCACHE_NAME "lxpr_cache"
+
+static int lxpr_node_constructor(void *, void *, int);
+static void lxpr_node_destructor(void *, void *);
+
+static kmem_cache_t *lxpr_node_cache;
+
+struct lxpr_uiobuf {
+ uio_t *uiop;
+ char *buffer;
+ uint32_t buffsize;
+ char *pos;
+ size_t beg;
+ int error;
+};
+
+int lxpr_bufsize = 4000;
+
+struct lxpr_uiobuf *
+lxpr_uiobuf_new(uio_t *uiop)
+{
+ /* Allocate memory for both lxpr_uiobuf and output buffer */
+ int bufsize = lxpr_bufsize;
+ struct lxpr_uiobuf *uiobuf =
+ kmem_alloc(sizeof (struct lxpr_uiobuf) + bufsize, KM_SLEEP);
+
+ uiobuf->uiop = uiop;
+ uiobuf->buffer = (char *)&uiobuf[1];
+ uiobuf->buffsize = bufsize;
+ uiobuf->pos = uiobuf->buffer;
+ uiobuf->beg = 0;
+ uiobuf->error = 0;
+
+ return (uiobuf);
+}
+
+void
+lxpr_uiobuf_free(struct lxpr_uiobuf *uiobuf)
+{
+ ASSERT(uiobuf != NULL);
+ ASSERT(uiobuf->pos == uiobuf->buffer);
+
+ kmem_free(uiobuf, sizeof (struct lxpr_uiobuf) + uiobuf->buffsize);
+}
+
+void
+lxpr_uiobuf_seek(struct lxpr_uiobuf *uiobuf, offset_t offset)
+{
+ uiobuf->uiop->uio_offset = (off_t)offset;
+}
+
+void
+lxpr_uiobuf_seterr(struct lxpr_uiobuf *uiobuf, int err)
+{
+ ASSERT(uiobuf->error == 0);
+
+ uiobuf->error = err;
+}
+
+int
+lxpr_uiobuf_flush(struct lxpr_uiobuf *uiobuf)
+{
+ off_t off = uiobuf->uiop->uio_offset;
+ caddr_t uaddr = uiobuf->buffer;
+ size_t beg = uiobuf->beg;
+ size_t size = (uintptr_t)uiobuf->pos - (uintptr_t)uaddr;
+
+ if (uiobuf->error == 0 && uiobuf->uiop->uio_resid != 0) {
+ ASSERT(off >= beg);
+
+ if (beg + size > off && off >= 0)
+ uiobuf->error =
+ uiomove(uaddr + (off - beg), size - (off - beg),
+ UIO_READ, uiobuf->uiop);
+
+ uiobuf->beg += size;
+ }
+
+ uiobuf->pos = uaddr;
+
+ return (uiobuf->error);
+}
+
+void
+lxpr_uiobuf_write(struct lxpr_uiobuf *uiobuf, const char *buf, size_t size)
+{
+ /* While we can still carry on */
+ while (uiobuf->error == 0 && uiobuf->uiop->uio_resid != 0) {
+ uintptr_t remain = (uintptr_t)uiobuf->buffsize -
+ ((uintptr_t)uiobuf->pos - (uintptr_t)uiobuf->buffer);
+
+ /* Enough space in buffer? */
+ if (remain >= size) {
+ bcopy(buf, uiobuf->pos, size);
+ uiobuf->pos += size;
+ return;
+ }
+
+ /* Not enough space, so copy all we can and try again */
+ bcopy(buf, uiobuf->pos, remain);
+ uiobuf->pos += remain;
+ (void) lxpr_uiobuf_flush(uiobuf);
+ buf += remain;
+ size -= remain;
+ }
+}
+
+#define TYPBUFFSIZE 256
+
+void
+lxpr_uiobuf_printf(struct lxpr_uiobuf *uiobuf, const char *fmt, ...)
+{
+ va_list args;
+ char buff[TYPBUFFSIZE];
+ int len;
+ char *buffer;
+
+ /* Can we still do any output */
+ if (uiobuf->error != 0 || uiobuf->uiop->uio_resid == 0)
+ return;
+
+ va_start(args, fmt);
+
+ /* Try using stack allocated buffer */
+ len = vsnprintf(buff, TYPBUFFSIZE, fmt, args);
+ if (len < TYPBUFFSIZE) {
+ va_end(args);
+ lxpr_uiobuf_write(uiobuf, buff, len);
+ return;
+ }
+
+ /* Not enough space in pre-allocated buffer */
+ buffer = kmem_alloc(len + 1, KM_SLEEP);
+
+ /*
+ * We know we allocated the correct amount of space
+ * so no check on the return value
+ */
+ (void) vsnprintf(buffer, len+1, fmt, args);
+ lxpr_uiobuf_write(uiobuf, buffer, len);
+ va_end(args);
+ kmem_free(buffer, len+1);
+}
+
+/*
+ * lxpr_lock():
+ *
+ * Lookup process from pid and return with p_plock and P_PR_LOCK held.
+ */
+proc_t *
+lxpr_lock(pid_t pid)
+{
+ proc_t *p;
+ kmutex_t *mp;
+
+ ASSERT(!MUTEX_HELD(&pidlock));
+
+ for (;;) {
+ mutex_enter(&pidlock);
+
+ /*
+ * If the pid is 1, we really want the zone's init process
+ */
+ p = prfind((pid == 1) ?
+ curproc->p_zone->zone_proc_initpid : pid);
+
+ if (p == NULL || p->p_stat == SIDL) {
+ mutex_exit(&pidlock);
+ return (NULL);
+ }
+
+ /*
+ * p_lock is persistent, but p itself is not -- it could
+ * vanish during cv_wait(). Load p->p_lock now so we can
+ * drop it after cv_wait() without referencing p.
+ */
+ mp = &p->p_lock;
+ mutex_enter(mp);
+
+ mutex_exit(&pidlock);
+
+ if (p->p_flag & SEXITING) {
+ /*
+ * This process is exiting -- let it go.
+ */
+ mutex_exit(mp);
+ return (NULL);
+ }
+
+ if (!(p->p_proc_flag & P_PR_LOCK))
+ break;
+
+ cv_wait(&pr_pid_cv[p->p_slot], mp);
+ mutex_exit(mp);
+ }
+
+ p->p_proc_flag |= P_PR_LOCK;
+ THREAD_KPRI_REQUEST();
+ return (p);
+}
+
+/*
+ * lxpr_unlock()
+ *
+ * Unlock locked process
+ */
+void
+lxpr_unlock(proc_t *p)
+{
+ ASSERT(p->p_proc_flag & P_PR_LOCK);
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ ASSERT(!MUTEX_HELD(&pidlock));
+
+ cv_signal(&pr_pid_cv[p->p_slot]);
+ p->p_proc_flag &= ~P_PR_LOCK;
+ mutex_exit(&p->p_lock);
+ THREAD_KPRI_RELEASE();
+}
+
+void
+lxpr_initnodecache()
+{
+ lxpr_node_cache = kmem_cache_create(LXPRCACHE_NAME,
+ sizeof (lxpr_node_t), 0,
+ lxpr_node_constructor, lxpr_node_destructor, NULL, NULL, NULL, 0);
+}
+
+void
+lxpr_fininodecache()
+{
+ kmem_cache_destroy(lxpr_node_cache);
+}
+
+/* ARGSUSED */
+static int
+lxpr_node_constructor(void *buf, void *un, int kmflags)
+{
+ lxpr_node_t *lxpnp = buf;
+ vnode_t *vp;
+
+ vp = lxpnp->lxpr_vnode = vn_alloc(kmflags);
+ if (vp == NULL)
+ return (-1);
+
+ (void) vn_setops(vp, lxpr_vnodeops);
+ vp->v_data = lxpnp;
+
+ return (0);
+}
+
+/* ARGSUSED */
+static void
+lxpr_node_destructor(void *buf, void *un)
+{
+ lxpr_node_t *lxpnp = buf;
+
+ vn_free(LXPTOV(lxpnp));
+}
+
+/*
+ * Calculate an inode number
+ *
+ * This takes various bits of info and munges them
+ * to give the inode number for an lxproc node
+ */
+ino_t
+lxpr_inode(lxpr_nodetype_t type, pid_t pid, int fd)
+{
+ if (pid == 1)
+ pid = curproc->p_zone->zone_proc_initpid;
+
+ switch (type) {
+ case LXPR_PIDDIR:
+ return (pid + 1);
+ case LXPR_PROCDIR:
+ return (maxpid + 2);
+ case LXPR_PID_FD_FD:
+ return (maxpid + 2 +
+ (pid * (LXPR_FD_PERPROC + LXPR_NFILES)) +
+ LXPR_NFILES + fd);
+ default:
+ return (maxpid + 2 +
+ (pid * (LXPR_FD_PERPROC + LXPR_NFILES)) +
+ type);
+ }
+}
+
+/*
+ * Return inode number of parent (directory)
+ */
+ino_t
+lxpr_parentinode(lxpr_node_t *lxpnp)
+{
+ /*
+ * If the input node is the root then the parent inode
+ * is the mounted on inode so just return our inode number
+ */
+ if (lxpnp->lxpr_type != LXPR_PROCDIR)
+ return (VTOLXP(lxpnp->lxpr_parent)->lxpr_ino);
+ else
+ return (lxpnp->lxpr_ino);
+}
+
+/*
+ * Allocate a new lxproc node
+ *
+ * This also allocates the vnode associated with it
+ */
+lxpr_node_t *
+lxpr_getnode(vnode_t *dp, lxpr_nodetype_t type, proc_t *p, int fd)
+{
+ lxpr_node_t *lxpnp;
+ vnode_t *vp;
+ user_t *up;
+ timestruc_t now;
+
+ /*
+ * Allocate a new node. It is deallocated in vop_innactive
+ */
+ lxpnp = kmem_cache_alloc(lxpr_node_cache, KM_SLEEP);
+
+ /*
+ * Set defaults (may be overridden below)
+ */
+ gethrestime(&now);
+ lxpnp->lxpr_type = type;
+ lxpnp->lxpr_realvp = NULL;
+ lxpnp->lxpr_parent = dp;
+ VN_HOLD(dp);
+ if (p != NULL) {
+ lxpnp->lxpr_pid = ((p->p_pid ==
+ curproc->p_zone->zone_proc_initpid) ? 1 : p->p_pid);
+
+ lxpnp->lxpr_time = PTOU(p)->u_start;
+ lxpnp->lxpr_uid = crgetruid(p->p_cred);
+ lxpnp->lxpr_gid = crgetrgid(p->p_cred);
+ lxpnp->lxpr_ino = lxpr_inode(type, p->p_pid, fd);
+ } else {
+ /* Pretend files without a proc belong to sched */
+ lxpnp->lxpr_pid = 0;
+ lxpnp->lxpr_time = now;
+ lxpnp->lxpr_uid = lxpnp->lxpr_gid = 0;
+ lxpnp->lxpr_ino = lxpr_inode(type, 0, 0);
+ }
+
+ /* initialize the vnode data */
+ vp = lxpnp->lxpr_vnode;
+ vn_reinit(vp);
+ vp->v_flag = VNOCACHE|VNOMAP|VNOSWAP|VNOMOUNT;
+ vp->v_vfsp = dp->v_vfsp;
+
+ /*
+ * Do node specific stuff
+ */
+ switch (type) {
+ case LXPR_PROCDIR:
+ vp->v_flag |= VROOT;
+ vp->v_type = VDIR;
+ lxpnp->lxpr_mode = 0555; /* read-search by everyone */
+ break;
+
+ case LXPR_PID_CURDIR:
+ ASSERT(p != NULL);
+
+ /*
+ * Zombie check. p_stat is officially protected by pidlock,
+ * but we can't grab pidlock here because we already hold
+ * p_lock. Luckily if we look at the process exit code
+ * we see that p_stat only transisions from SRUN to SZOMB
+ * while p_lock is held. Aside from this, the only other
+ * p_stat transition that we need to be aware about is
+ * SIDL to SRUN, but that's not a problem since lxpr_lock()
+ * ignores nodes in the SIDL state so we'll never get a node
+ * that isn't already in the SRUN state.
+ */
+ if (p->p_stat == SZOMB) {
+ lxpnp->lxpr_realvp = NULL;
+ } else {
+ up = PTOU(p);
+ lxpnp->lxpr_realvp = up->u_cdir;
+ ASSERT(lxpnp->lxpr_realvp != NULL);
+ VN_HOLD(lxpnp->lxpr_realvp);
+ }
+ vp->v_type = VLNK;
+ lxpnp->lxpr_mode = 0777; /* anyone does anything ! */
+ break;
+
+ case LXPR_PID_ROOTDIR:
+ ASSERT(p != NULL);
+ /* Zombie check. see locking comment above */
+ if (p->p_stat == SZOMB) {
+ lxpnp->lxpr_realvp = NULL;
+ } else {
+ up = PTOU(p);
+ lxpnp->lxpr_realvp =
+ up->u_rdir != NULL ? up->u_rdir : rootdir;
+ ASSERT(lxpnp->lxpr_realvp != NULL);
+ VN_HOLD(lxpnp->lxpr_realvp);
+ }
+ vp->v_type = VLNK;
+ lxpnp->lxpr_mode = 0777; /* anyone does anything ! */
+ break;
+
+ case LXPR_PID_EXE:
+ ASSERT(p != NULL);
+ lxpnp->lxpr_realvp = p->p_exec;
+ if (lxpnp->lxpr_realvp != NULL) {
+ VN_HOLD(lxpnp->lxpr_realvp);
+ }
+ vp->v_type = VLNK;
+ lxpnp->lxpr_mode = 0777;
+ break;
+
+ case LXPR_SELF:
+ vp->v_type = VLNK;
+ lxpnp->lxpr_mode = 0777; /* anyone does anything ! */
+ break;
+
+ case LXPR_PID_FD_FD:
+ ASSERT(p != NULL);
+ /* lxpr_realvp is set after we return */
+ vp->v_type = VLNK;
+ lxpnp->lxpr_mode = 0700; /* read-write-exe owner only */
+ break;
+
+ case LXPR_PID_FDDIR:
+ ASSERT(p != NULL);
+ vp->v_type = VDIR;
+ lxpnp->lxpr_mode = 0500; /* read-search by owner only */
+ break;
+
+ case LXPR_PIDDIR:
+ ASSERT(p != NULL);
+ vp->v_type = VDIR;
+ lxpnp->lxpr_mode = 0511;
+ break;
+
+ case LXPR_NETDIR:
+ vp->v_type = VDIR;
+ lxpnp->lxpr_mode = 0555; /* read-search by all */
+ break;
+
+ case LXPR_PID_ENV:
+ case LXPR_PID_MEM:
+ ASSERT(p != NULL);
+ /*FALLTHRU*/
+ case LXPR_KCORE:
+ vp->v_type = VREG;
+ lxpnp->lxpr_mode = 0400; /* read-only by owner only */
+ break;
+
+ default:
+ vp->v_type = VREG;
+ lxpnp->lxpr_mode = 0444; /* read-only by all */
+ break;
+ }
+
+ return (lxpnp);
+}
+
+
+/*
+ * Free the storage obtained from lxpr_getnode().
+ */
+void
+lxpr_freenode(lxpr_node_t *lxpnp)
+{
+ ASSERT(lxpnp != NULL);
+ ASSERT(LXPTOV(lxpnp) != NULL);
+
+ /*
+ * delete any association with realvp
+ */
+ if (lxpnp->lxpr_realvp != NULL)
+ VN_RELE(lxpnp->lxpr_realvp);
+
+ /*
+ * delete any association with parent vp
+ */
+ if (lxpnp->lxpr_parent != NULL)
+ VN_RELE(lxpnp->lxpr_parent);
+
+ /*
+ * Release the lxprnode.
+ */
+ kmem_cache_free(lxpr_node_cache, lxpnp);
+}
diff --git a/usr/src/uts/common/fs/lxproc/lxpr_vfsops.c b/usr/src/uts/common/fs/lxproc/lxpr_vfsops.c
new file mode 100644
index 0000000000..1bb7bd3823
--- /dev/null
+++ b/usr/src/uts/common/fs/lxproc/lxpr_vfsops.c
@@ -0,0 +1,367 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/cmn_err.h>
+#include <sys/cred.h>
+#include <sys/debug.h>
+#include <sys/errno.h>
+#include <sys/proc.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+#include <sys/sysmacros.h>
+#include <sys/systm.h>
+#include <sys/var.h>
+#include <sys/vfs.h>
+#include <sys/vfs_opreg.h>
+#include <sys/vnode.h>
+#include <sys/mode.h>
+#include <sys/signal.h>
+#include <sys/user.h>
+#include <sys/mount.h>
+#include <sys/bitmap.h>
+#include <sys/kmem.h>
+#include <sys/policy.h>
+#include <sys/modctl.h>
+#include <sys/sunddi.h>
+#include <sys/sunldi.h>
+
+#include "lxproc.h"
+
+/* Module level parameters */
+static int lxprocfstype;
+static dev_t lxprocdev;
+static kmutex_t lxpr_mount_lock;
+
+int nproc_highbit; /* highbit(v.v_nproc) */
+
+static int lxpr_mount(vfs_t *, vnode_t *, mounta_t *, cred_t *);
+static int lxpr_unmount(vfs_t *, int, cred_t *);
+static int lxpr_root(vfs_t *, vnode_t **);
+static int lxpr_statvfs(vfs_t *, statvfs64_t *);
+static int lxpr_init(int, char *);
+
+static vfsdef_t vfw = {
+ VFSDEF_VERSION,
+ "lxproc",
+ lxpr_init,
+ VSW_ZMOUNT,
+ NULL
+};
+
+/*
+ * Module linkage information for the kernel.
+ */
+extern struct mod_ops mod_fsops;
+
+static struct modlfs modlfs = {
+ &mod_fsops, "generic linux procfs", &vfw
+};
+
+static struct modlinkage modlinkage = {
+ MODREV_1, (void *)&modlfs, NULL
+};
+
+int
+_init(void)
+{
+ return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+ return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+ int retval;
+
+ /*
+ * attempt to unload the module
+ */
+ if ((retval = mod_remove(&modlinkage)) != 0)
+ goto done;
+
+ /*
+ * destroy lxpr_node cache
+ */
+ lxpr_fininodecache();
+
+ /*
+ * clean out the vfsops and vnodeops
+ */
+ (void) vfs_freevfsops_by_type(lxprocfstype);
+ vn_freevnodeops(lxpr_vnodeops);
+
+ mutex_destroy(&lxpr_mount_lock);
+done:
+ return (retval);
+}
+
+static int
+lxpr_init(int fstype, char *name)
+{
+ static const fs_operation_def_t lxpr_vfsops_template[] = {
+ VFSNAME_MOUNT, { .vfs_mount = lxpr_mount },
+ VFSNAME_UNMOUNT, { .vfs_unmount = lxpr_unmount },
+ VFSNAME_ROOT, { .vfs_root = lxpr_root },
+ VFSNAME_STATVFS, { .vfs_statvfs = lxpr_statvfs },
+ NULL, NULL
+ };
+ extern const fs_operation_def_t lxpr_vnodeops_template[];
+ int error;
+ major_t dev;
+
+ nproc_highbit = highbit(v.v_proc);
+ lxprocfstype = fstype;
+ ASSERT(lxprocfstype != 0);
+
+ mutex_init(&lxpr_mount_lock, NULL, MUTEX_DEFAULT, NULL);
+
+ /*
+ * Associate VFS ops vector with this fstype.
+ */
+ error = vfs_setfsops(fstype, lxpr_vfsops_template, NULL);
+ if (error != 0) {
+ cmn_err(CE_WARN, "lxpr_init: bad vfs ops template");
+ return (error);
+ }
+
+ /*
+ * Set up vnode ops vector too.
+ */
+ error = vn_make_ops(name, lxpr_vnodeops_template, &lxpr_vnodeops);
+ if (error != 0) {
+ (void) vfs_freevfsops_by_type(fstype);
+ cmn_err(CE_WARN, "lxpr_init: bad vnode ops template");
+ return (error);
+ }
+
+ /*
+ * Assign a unique "device" number (used by stat(2)).
+ */
+ if ((dev = getudev()) == (major_t)-1) {
+ cmn_err(CE_WARN, "lxpr_init: can't get unique device number");
+ dev = 0;
+ }
+
+ /*
+ * Make the pseudo device
+ */
+ lxprocdev = makedevice(dev, 0);
+
+ /*
+ * Initialize cache for lxpr_nodes
+ */
+ lxpr_initnodecache();
+
+ return (0);
+}
+
+static int
+lxpr_mount(vfs_t *vfsp, vnode_t *mvp, mounta_t *uap, cred_t *cr)
+{
+ lxpr_mnt_t *lxpr_mnt;
+ zone_t *zone = curproc->p_zone;
+ ldi_ident_t li;
+ int err;
+
+ /*
+ * must be root to mount
+ */
+ if (secpolicy_fs_mount(cr, mvp, vfsp) != 0)
+ return (EPERM);
+
+ /*
+ * mount point must be a directory
+ */
+ if (mvp->v_type != VDIR)
+ return (ENOTDIR);
+
+ if (zone == global_zone) {
+ zone_t *mntzone;
+
+ mntzone = zone_find_by_path(refstr_value(vfsp->vfs_mntpt));
+ zone_rele(mntzone);
+ if (zone != mntzone)
+ return (EBUSY);
+ }
+
+ /*
+ * Having the resource be anything but "lxproc" doesn't make sense
+ */
+ vfs_setresource(vfsp, "lxproc", 0);
+
+ lxpr_mnt = kmem_alloc(sizeof (*lxpr_mnt), KM_SLEEP);
+
+ if ((err = ldi_ident_from_mod(&modlinkage, &li)) != 0) {
+ kmem_free(lxpr_mnt, sizeof (*lxpr_mnt));
+ return (err);
+ }
+
+ lxpr_mnt->lxprm_li = li;
+
+ mutex_enter(&lxpr_mount_lock);
+
+ /*
+ * Ensure we don't allow overlaying mounts
+ */
+ mutex_enter(&mvp->v_lock);
+ if ((uap->flags & MS_OVERLAY) == 0 &&
+ (mvp->v_count > 1 || (mvp->v_flag & VROOT))) {
+ mutex_exit(&mvp->v_lock);
+ mutex_exit(&lxpr_mount_lock);
+ kmem_free(lxpr_mnt, sizeof ((*lxpr_mnt)));
+ return (EBUSY);
+ }
+ mutex_exit(&mvp->v_lock);
+
+ /*
+ * allocate the first vnode
+ */
+ zone_hold(lxpr_mnt->lxprm_zone = zone);
+
+ /* Arbitrarily set the parent vnode to the mounted over directory */
+ lxpr_mnt->lxprm_node = lxpr_getnode(mvp, LXPR_PROCDIR, NULL, 0);
+
+ /* Correctly set the fs for the root node */
+ lxpr_mnt->lxprm_node->lxpr_vnode->v_vfsp = vfsp;
+
+ vfs_make_fsid(&vfsp->vfs_fsid, lxprocdev, lxprocfstype);
+ vfsp->vfs_bsize = DEV_BSIZE;
+ vfsp->vfs_fstype = lxprocfstype;
+ vfsp->vfs_data = (caddr_t)lxpr_mnt;
+ vfsp->vfs_dev = lxprocdev;
+
+ mutex_exit(&lxpr_mount_lock);
+
+ return (0);
+}
+
+static int
+lxpr_unmount(vfs_t *vfsp, int flag, cred_t *cr)
+{
+ lxpr_mnt_t *lxpr_mnt = (lxpr_mnt_t *)vfsp->vfs_data;
+ vnode_t *vp;
+ int count;
+
+ ASSERT(lxpr_mnt != NULL);
+ vp = LXPTOV(lxpr_mnt->lxprm_node);
+
+ mutex_enter(&lxpr_mount_lock);
+
+ /*
+ * must be root to unmount
+ */
+ if (secpolicy_fs_unmount(cr, vfsp) != 0) {
+ mutex_exit(&lxpr_mount_lock);
+ return (EPERM);
+ }
+
+ /*
+ * forced unmount is not supported by this file system
+ */
+ if (flag & MS_FORCE) {
+ mutex_exit(&lxpr_mount_lock);
+ return (ENOTSUP);
+ }
+
+ /*
+ * Ensure that no vnodes are in use on this mount point.
+ */
+ mutex_enter(&vp->v_lock);
+ count = vp->v_count;
+ mutex_exit(&vp->v_lock);
+ if (count > 1) {
+ mutex_exit(&lxpr_mount_lock);
+ return (EBUSY);
+ }
+
+ /*
+ * purge the dnlc cache for vnode entries
+ * associated with this file system
+ */
+ count = dnlc_purge_vfsp(vfsp, 0);
+
+ /*
+ * free up the lxprnode
+ */
+ lxpr_freenode(lxpr_mnt->lxprm_node);
+ zone_rele(lxpr_mnt->lxprm_zone);
+ kmem_free(lxpr_mnt, sizeof (*lxpr_mnt));
+
+ mutex_exit(&lxpr_mount_lock);
+
+ return (0);
+}
+
+static int
+lxpr_root(vfs_t *vfsp, vnode_t **vpp)
+{
+ lxpr_node_t *lxpnp = ((lxpr_mnt_t *)vfsp->vfs_data)->lxprm_node;
+ vnode_t *vp = LXPTOV(lxpnp);
+
+ VN_HOLD(vp);
+ *vpp = vp;
+ return (0);
+}
+
+static int
+lxpr_statvfs(vfs_t *vfsp, statvfs64_t *sp)
+{
+ int n;
+ dev32_t d32;
+ extern uint_t nproc;
+
+ n = v.v_proc - nproc;
+
+ bzero((caddr_t)sp, sizeof (*sp));
+ sp->f_bsize = DEV_BSIZE;
+ sp->f_frsize = DEV_BSIZE;
+ sp->f_blocks = (fsblkcnt64_t)0;
+ sp->f_bfree = (fsblkcnt64_t)0;
+ sp->f_bavail = (fsblkcnt64_t)0;
+ sp->f_files = (fsfilcnt64_t)v.v_proc + 2;
+ sp->f_ffree = (fsfilcnt64_t)n;
+ sp->f_favail = (fsfilcnt64_t)n;
+ (void) cmpldev(&d32, vfsp->vfs_dev);
+ sp->f_fsid = d32;
+ /* It is guaranteed that vsw_name will fit in f_basetype */
+ (void) strcpy(sp->f_basetype, vfssw[lxprocfstype].vsw_name);
+ sp->f_flag = vf_to_stf(vfsp->vfs_flag);
+ sp->f_namemax = 64; /* quite arbitrary */
+
+ (void) strcpy(sp->f_fstr, "lxproc");
+
+ return (0);
+}
diff --git a/usr/src/uts/common/fs/lxproc/lxpr_vnops.c b/usr/src/uts/common/fs/lxproc/lxpr_vnops.c
new file mode 100644
index 0000000000..fc4de9f370
--- /dev/null
+++ b/usr/src/uts/common/fs/lxproc/lxpr_vnops.c
@@ -0,0 +1,3092 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * lxproc -- a loosely Linux-compatible /proc
+ *
+ * The aspiration here is to provide something that sufficiently approximates
+ * the Linux /proc implementation for purposes of offering some compatibility
+ * for simple Linux /proc readers (e.g., ps/top/htop). However, it is not
+ * intended to exactly mimic Linux semantics; when choosing between offering
+ * compatibility and telling the truth, we emphatically pick the truth. A
+ * particular glaring example of this is the Linux notion of "tasks" (that is,
+ * threads), which -- due to historical misadventures on Linux -- allocate their
+ * identifiers from the process identifier space. (That is, each thread has in
+ * effect a pid.) Some Linux /proc readers have come to depend on this
+ * attribute, and become confused when threads appear with proper identifiers,
+ * so we simply opt for the pre-2.6 behavior, and do not present the tasks
+ * directory at all. Similarly, when choosing between offering compatibility
+ * and remaining consistent with our broader security model, we (obviously)
+ * choose security over compatibility. In short, this is meant to be a best
+ * effort -- no more.
+ */
+
+#include <sys/cpupart.h>
+#include <sys/cpuvar.h>
+#include <sys/session.h>
+#include <sys/vmparam.h>
+#include <sys/mman.h>
+#include <vm/rm.h>
+#include <vm/seg_vn.h>
+#include <sys/sdt.h>
+#include <sys/strlog.h>
+#include <sys/stropts.h>
+#include <sys/cmn_err.h>
+#include <sys/x86_archext.h>
+#include <sys/archsystm.h>
+#include <sys/fp.h>
+#include <sys/pool_pset.h>
+#include <sys/pset.h>
+#include <sys/zone.h>
+#include <sys/pghw.h>
+#include <sys/vfs_opreg.h>
+
+/* Dependent on procfs */
+extern kthread_t *prchoose(proc_t *);
+
+#include "lxproc.h"
+
+extern pgcnt_t swapfs_minfree;
+extern time_t boot_time;
+
+/*
+ * Pointer to the vnode ops vector for this fs.
+ * This is instantiated in lxprinit() in lxpr_vfsops.c
+ */
+vnodeops_t *lxpr_vnodeops;
+
+static int lxpr_open(vnode_t **, int, cred_t *, caller_context_t *);
+static int lxpr_close(vnode_t *, int, int, offset_t, cred_t *,
+ caller_context_t *);
+static int lxpr_read(vnode_t *, uio_t *, int, cred_t *, caller_context_t *);
+static int lxpr_getattr(vnode_t *, vattr_t *, int, cred_t *,
+ caller_context_t *);
+static int lxpr_access(vnode_t *, int, int, cred_t *, caller_context_t *);
+static int lxpr_lookup(vnode_t *, char *, vnode_t **,
+ pathname_t *, int, vnode_t *, cred_t *, caller_context_t *, int *,
+ pathname_t *);
+static int lxpr_readdir(vnode_t *, uio_t *, cred_t *, int *,
+ caller_context_t *, int);
+static int lxpr_readlink(vnode_t *, uio_t *, cred_t *, caller_context_t *);
+static int lxpr_cmp(vnode_t *, vnode_t *, caller_context_t *);
+static int lxpr_realvp(vnode_t *, vnode_t **, caller_context_t *);
+static int lxpr_sync(void);
+static void lxpr_inactive(vnode_t *, cred_t *, caller_context_t *);
+
+static vnode_t *lxpr_lookup_procdir(vnode_t *, char *);
+static vnode_t *lxpr_lookup_piddir(vnode_t *, char *);
+static vnode_t *lxpr_lookup_not_a_dir(vnode_t *, char *);
+static vnode_t *lxpr_lookup_fddir(vnode_t *, char *);
+static vnode_t *lxpr_lookup_netdir(vnode_t *, char *);
+
+static int lxpr_readdir_procdir(lxpr_node_t *, uio_t *, int *);
+static int lxpr_readdir_piddir(lxpr_node_t *, uio_t *, int *);
+static int lxpr_readdir_not_a_dir(lxpr_node_t *, uio_t *, int *);
+static int lxpr_readdir_fddir(lxpr_node_t *, uio_t *, int *);
+static int lxpr_readdir_netdir(lxpr_node_t *, uio_t *, int *);
+
+static void lxpr_read_invalid(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_empty(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_cpuinfo(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_isdir(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_fd(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_kmsg(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_loadavg(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_meminfo(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_mounts(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_partitions(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_stat(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_uptime(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_version(lxpr_node_t *, lxpr_uiobuf_t *);
+
+static void lxpr_read_pid_cmdline(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_pid_maps(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_pid_stat(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_pid_statm(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_pid_status(lxpr_node_t *, lxpr_uiobuf_t *);
+
+static void lxpr_read_net_arp(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_dev(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_dev_mcast(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_igmp(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_ip_mr_cache(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_ip_mr_vif(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_mcfilter(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_netstat(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_raw(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_route(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_rpc(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_rt_cache(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_sockstat(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_snmp(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_stat(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_tcp(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_udp(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_net_unix(lxpr_node_t *, lxpr_uiobuf_t *);
+
+/*
+ * Simple conversion
+ */
+#define btok(x) ((x) >> 10) /* bytes to kbytes */
+#define ptok(x) ((x) << (PAGESHIFT - 10)) /* pages to kbytes */
+
+/*
+ * The lxproc vnode operations vector
+ */
+const fs_operation_def_t lxpr_vnodeops_template[] = {
+ VOPNAME_OPEN, { .vop_open = lxpr_open },
+ VOPNAME_CLOSE, { .vop_close = lxpr_close },
+ VOPNAME_READ, { .vop_read = lxpr_read },
+ VOPNAME_GETATTR, { .vop_getattr = lxpr_getattr },
+ VOPNAME_ACCESS, { .vop_access = lxpr_access },
+ VOPNAME_LOOKUP, { .vop_lookup = lxpr_lookup },
+ VOPNAME_READDIR, { .vop_readdir = lxpr_readdir },
+ VOPNAME_READLINK, { .vop_readlink = lxpr_readlink },
+ VOPNAME_FSYNC, { .error = lxpr_sync },
+ VOPNAME_SEEK, { .error = lxpr_sync },
+ VOPNAME_INACTIVE, { .vop_inactive = lxpr_inactive },
+ VOPNAME_CMP, { .vop_cmp = lxpr_cmp },
+ VOPNAME_REALVP, { .vop_realvp = lxpr_realvp },
+ NULL, NULL
+};
+
+/*
+ * file contents of an lxproc directory.
+ */
+static lxpr_dirent_t lxpr_dir[] = {
+ { LXPR_CMDLINE, "cmdline" },
+ { LXPR_CPUINFO, "cpuinfo" },
+ { LXPR_DEVICES, "devices" },
+ { LXPR_DMA, "dma" },
+ { LXPR_FILESYSTEMS, "filesystems" },
+ { LXPR_INTERRUPTS, "interrupts" },
+ { LXPR_IOPORTS, "ioports" },
+ { LXPR_KCORE, "kcore" },
+ { LXPR_KMSG, "kmsg" },
+ { LXPR_LOADAVG, "loadavg" },
+ { LXPR_MEMINFO, "meminfo" },
+ { LXPR_MOUNTS, "mounts" },
+ { LXPR_NETDIR, "net" },
+ { LXPR_PARTITIONS, "partitions" },
+ { LXPR_SELF, "self" },
+ { LXPR_STAT, "stat" },
+ { LXPR_UPTIME, "uptime" },
+ { LXPR_VERSION, "version" }
+};
+
+#define PROCDIRFILES (sizeof (lxpr_dir) / sizeof (lxpr_dir[0]))
+
+/*
+ * Contents of an /lxproc/<pid> directory.
+ */
+static lxpr_dirent_t piddir[] = {
+ { LXPR_PID_CMDLINE, "cmdline" },
+ { LXPR_PID_CPU, "cpu" },
+ { LXPR_PID_CURDIR, "cwd" },
+ { LXPR_PID_ENV, "environ" },
+ { LXPR_PID_EXE, "exe" },
+ { LXPR_PID_MAPS, "maps" },
+ { LXPR_PID_MEM, "mem" },
+ { LXPR_PID_ROOTDIR, "root" },
+ { LXPR_PID_STAT, "stat" },
+ { LXPR_PID_STATM, "statm" },
+ { LXPR_PID_STATUS, "status" },
+ { LXPR_PID_FDDIR, "fd" }
+};
+
+#define PIDDIRFILES (sizeof (piddir) / sizeof (piddir[0]))
+
+/*
+ * contents of /lxproc/net directory
+ */
+static lxpr_dirent_t netdir[] = {
+ { LXPR_NET_ARP, "arp" },
+ { LXPR_NET_DEV, "dev" },
+ { LXPR_NET_DEV_MCAST, "dev_mcast" },
+ { LXPR_NET_IGMP, "igmp" },
+ { LXPR_NET_IP_MR_CACHE, "ip_mr_cache" },
+ { LXPR_NET_IP_MR_VIF, "ip_mr_vif" },
+ { LXPR_NET_MCFILTER, "mcfilter" },
+ { LXPR_NET_NETSTAT, "netstat" },
+ { LXPR_NET_RAW, "raw" },
+ { LXPR_NET_ROUTE, "route" },
+ { LXPR_NET_RPC, "rpc" },
+ { LXPR_NET_RT_CACHE, "rt_cache" },
+ { LXPR_NET_SOCKSTAT, "sockstat" },
+ { LXPR_NET_SNMP, "snmp" },
+ { LXPR_NET_STAT, "stat" },
+ { LXPR_NET_TCP, "tcp" },
+ { LXPR_NET_UDP, "udp" },
+ { LXPR_NET_UNIX, "unix" }
+};
+
+#define NETDIRFILES (sizeof (netdir) / sizeof (netdir[0]))
+
+/*
+ * These are the major signal number differences between Linux and native:
+ *
+ * ====================================
+ * | Number | Linux | Native |
+ * | ====== | ========= | ========== |
+ * | 7 | SIGBUS | SIGEMT |
+ * | 10 | SIGUSR1 | SIGBUS |
+ * | 12 | SIGUSR2 | SIGSYS |
+ * | 16 | SIGSTKFLT | SIGUSR1 |
+ * | 17 | SIGCHLD | SIGUSR2 |
+ * | 18 | SIGCONT | SIGCHLD |
+ * | 19 | SIGSTOP | SIGPWR |
+ * | 20 | SIGTSTP | SIGWINCH |
+ * | 21 | SIGTTIN | SIGURG |
+ * | 22 | SIGTTOU | SIGPOLL |
+ * | 23 | SIGURG | SIGSTOP |
+ * | 24 | SIGXCPU | SIGTSTP |
+ * | 25 | SIGXFSZ | SIGCONT |
+ * | 26 | SIGVTALARM | SIGTTIN |
+ * | 27 | SIGPROF | SIGTTOU |
+ * | 28 | SIGWINCH | SIGVTALARM |
+ * | 29 | SIGPOLL | SIGPROF |
+ * | 30 | SIGPWR | SIGXCPU |
+ * | 31 | SIGSYS | SIGXFSZ |
+ * ====================================
+ *
+ * Not every Linux signal maps to a native signal, nor does every native
+ * signal map to a Linux counterpart. However, when signals do map, the
+ * mapping is unique.
+ */
+static int
+lxpr_sigmap[NSIG] = {
+ 0,
+ LX_SIGHUP,
+ LX_SIGINT,
+ LX_SIGQUIT,
+ LX_SIGILL,
+ LX_SIGTRAP,
+ LX_SIGABRT,
+ LX_SIGSTKFLT,
+ LX_SIGFPE,
+ LX_SIGKILL,
+ LX_SIGBUS,
+ LX_SIGSEGV,
+ LX_SIGSYS,
+ LX_SIGPIPE,
+ LX_SIGALRM,
+ LX_SIGTERM,
+ LX_SIGUSR1,
+ LX_SIGUSR2,
+ LX_SIGCHLD,
+ LX_SIGPWR,
+ LX_SIGWINCH,
+ LX_SIGURG,
+ LX_SIGPOLL,
+ LX_SIGSTOP,
+ LX_SIGTSTP,
+ LX_SIGCONT,
+ LX_SIGTTIN,
+ LX_SIGTTOU,
+ LX_SIGVTALRM,
+ LX_SIGPROF,
+ LX_SIGXCPU,
+ LX_SIGXFSZ,
+ -1, /* 32: illumos SIGWAITING */
+ -1, /* 33: illumos SIGLWP */
+ -1, /* 34: illumos SIGFREEZE */
+ -1, /* 35: illumos SIGTHAW */
+ -1, /* 36: illumos SIGCANCEL */
+ -1, /* 37: illumos SIGLOST */
+ -1, /* 38: illumos SIGXRES */
+ -1, /* 39: illumos SIGJVM1 */
+ -1, /* 40: illumos SIGJVM2 */
+ LX_SIGRTMIN, /* 41: illumos _SIGRTMIN */
+ LX_SIGRTMIN + 1,
+ LX_SIGRTMIN + 2,
+ LX_SIGRTMIN + 3,
+ LX_SIGRTMIN + 4,
+ LX_SIGRTMIN + 5,
+ LX_SIGRTMIN + 6,
+ LX_SIGRTMIN + 7,
+ LX_SIGRTMIN + 8,
+ LX_SIGRTMIN + 9,
+ LX_SIGRTMIN + 10,
+ LX_SIGRTMIN + 11,
+ LX_SIGRTMIN + 12,
+ LX_SIGRTMIN + 13,
+ LX_SIGRTMIN + 14,
+ LX_SIGRTMIN + 15,
+ LX_SIGRTMIN + 16,
+ LX_SIGRTMIN + 17,
+ LX_SIGRTMIN + 18,
+ LX_SIGRTMIN + 19,
+ LX_SIGRTMIN + 20,
+ LX_SIGRTMIN + 21,
+ LX_SIGRTMIN + 22,
+ LX_SIGRTMIN + 23,
+ LX_SIGRTMIN + 24,
+ LX_SIGRTMIN + 25,
+ LX_SIGRTMIN + 26,
+ LX_SIGRTMIN + 27,
+ LX_SIGRTMIN + 28,
+ LX_SIGRTMIN + 29,
+ LX_SIGRTMIN + 30,
+ LX_SIGRTMAX,
+};
+
+/*
+ * lxpr_open(): Vnode operation for VOP_OPEN()
+ */
+static int
+lxpr_open(vnode_t **vpp, int flag, cred_t *cr, caller_context_t *ct)
+{
+ vnode_t *vp = *vpp;
+ lxpr_node_t *lxpnp = VTOLXP(vp);
+ lxpr_nodetype_t type = lxpnp->lxpr_type;
+ vnode_t *rvp;
+ int error = 0;
+
+ /*
+ * We only allow reading in this file systrem
+ */
+ if (flag & FWRITE)
+ return (EROFS);
+
+ /*
+ * If we are opening an underlying file only allow regular files
+ * reject the open for anything but a regular file.
+ * Just do it if we are opening the current or root directory.
+ */
+ if (lxpnp->lxpr_realvp != NULL) {
+ rvp = lxpnp->lxpr_realvp;
+
+ if (type == LXPR_PID_FD_FD && rvp->v_type != VREG)
+ error = EACCES;
+ else {
+ /*
+ * Need to hold rvp since VOP_OPEN() may release it.
+ */
+ VN_HOLD(rvp);
+ error = VOP_OPEN(&rvp, flag, cr, ct);
+ if (error) {
+ VN_RELE(rvp);
+ } else {
+ *vpp = rvp;
+ VN_RELE(vp);
+ }
+ }
+ }
+
+ if (type == LXPR_KMSG) {
+ ldi_ident_t li = VTOLXPM(vp)->lxprm_li;
+ struct strioctl str;
+ int rv;
+
+ /*
+ * Open the zone's console device using the layered driver
+ * interface.
+ */
+ if ((error = ldi_open_by_name("/dev/log", FREAD, cr,
+ &lxpnp->lxpr_cons_ldih, li)) != 0)
+ return (error);
+
+ /*
+ * Send an ioctl to the underlying console device, letting it
+ * know we're interested in getting console messages.
+ */
+ str.ic_cmd = I_CONSLOG;
+ str.ic_timout = 0;
+ str.ic_len = 0;
+ str.ic_dp = NULL;
+ if ((error = ldi_ioctl(lxpnp->lxpr_cons_ldih, I_STR,
+ (intptr_t)&str, FKIOCTL, cr, &rv)) != 0)
+ return (error);
+ }
+
+ return (error);
+}
+
+
+/*
+ * lxpr_close(): Vnode operation for VOP_CLOSE()
+ */
+/* ARGSUSED */
+static int
+lxpr_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr,
+ caller_context_t *ct)
+{
+ lxpr_node_t *lxpr = VTOLXP(vp);
+ lxpr_nodetype_t type = lxpr->lxpr_type;
+ int err;
+
+ /*
+ * we should never get here because the close is done on the realvp
+ * for these nodes
+ */
+ ASSERT(type != LXPR_PID_FD_FD &&
+ type != LXPR_PID_CURDIR &&
+ type != LXPR_PID_ROOTDIR &&
+ type != LXPR_PID_EXE);
+
+ if (type == LXPR_KMSG) {
+ if ((err = ldi_close(lxpr->lxpr_cons_ldih, 0, cr)) != 0)
+ return (err);
+ }
+
+ return (0);
+}
+
+static void (*lxpr_read_function[LXPR_NFILES])() = {
+ lxpr_read_isdir, /* /proc */
+ lxpr_read_isdir, /* /proc/<pid> */
+ lxpr_read_pid_cmdline, /* /proc/<pid>/cmdline */
+ lxpr_read_empty, /* /proc/<pid>/cpu */
+ lxpr_read_invalid, /* /proc/<pid>/cwd */
+ lxpr_read_empty, /* /proc/<pid>/environ */
+ lxpr_read_invalid, /* /proc/<pid>/exe */
+ lxpr_read_pid_maps, /* /proc/<pid>/maps */
+ lxpr_read_empty, /* /proc/<pid>/mem */
+ lxpr_read_invalid, /* /proc/<pid>/root */
+ lxpr_read_pid_stat, /* /proc/<pid>/stat */
+ lxpr_read_pid_statm, /* /proc/<pid>/statm */
+ lxpr_read_pid_status, /* /proc/<pid>/status */
+ lxpr_read_isdir, /* /proc/<pid>/fd */
+ lxpr_read_fd, /* /proc/<pid>/fd/nn */
+ lxpr_read_empty, /* /proc/cmdline */
+ lxpr_read_cpuinfo, /* /proc/cpuinfo */
+ lxpr_read_empty, /* /proc/devices */
+ lxpr_read_empty, /* /proc/dma */
+ lxpr_read_empty, /* /proc/filesystems */
+ lxpr_read_empty, /* /proc/interrupts */
+ lxpr_read_empty, /* /proc/ioports */
+ lxpr_read_empty, /* /proc/kcore */
+ lxpr_read_kmsg, /* /proc/kmsg */
+ lxpr_read_loadavg, /* /proc/loadavg */
+ lxpr_read_meminfo, /* /proc/meminfo */
+ lxpr_read_mounts, /* /proc/mounts */
+ lxpr_read_isdir, /* /proc/net */
+ lxpr_read_net_arp, /* /proc/net/arp */
+ lxpr_read_net_dev, /* /proc/net/dev */
+ lxpr_read_net_dev_mcast, /* /proc/net/dev_mcast */
+ lxpr_read_net_igmp, /* /proc/net/igmp */
+ lxpr_read_net_ip_mr_cache, /* /proc/net/ip_mr_cache */
+ lxpr_read_net_ip_mr_vif, /* /proc/net/ip_mr_vif */
+ lxpr_read_net_mcfilter, /* /proc/net/mcfilter */
+ lxpr_read_net_netstat, /* /proc/net/netstat */
+ lxpr_read_net_raw, /* /proc/net/raw */
+ lxpr_read_net_route, /* /proc/net/route */
+ lxpr_read_net_rpc, /* /proc/net/rpc */
+ lxpr_read_net_rt_cache, /* /proc/net/rt_cache */
+ lxpr_read_net_sockstat, /* /proc/net/sockstat */
+ lxpr_read_net_snmp, /* /proc/net/snmp */
+ lxpr_read_net_stat, /* /proc/net/stat */
+ lxpr_read_net_tcp, /* /proc/net/tcp */
+ lxpr_read_net_udp, /* /proc/net/udp */
+ lxpr_read_net_unix, /* /proc/net/unix */
+ lxpr_read_partitions, /* /proc/partitions */
+ lxpr_read_invalid, /* /proc/self */
+ lxpr_read_stat, /* /proc/stat */
+ lxpr_read_uptime, /* /proc/uptime */
+ lxpr_read_version, /* /proc/version */
+};
+
+/*
+ * Array of lookup functions, indexed by /lxproc file type.
+ */
+static vnode_t *(*lxpr_lookup_function[LXPR_NFILES])() = {
+ lxpr_lookup_procdir, /* /proc */
+ lxpr_lookup_piddir, /* /proc/<pid> */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/cmdline */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/cpu */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/cwd */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/environ */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/exe */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/maps */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/mem */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/root */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/stat */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/statm */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/status */
+ lxpr_lookup_fddir, /* /proc/<pid>/fd */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/fd/nn */
+ lxpr_lookup_not_a_dir, /* /proc/cmdline */
+ lxpr_lookup_not_a_dir, /* /proc/cpuinfo */
+ lxpr_lookup_not_a_dir, /* /proc/devices */
+ lxpr_lookup_not_a_dir, /* /proc/dma */
+ lxpr_lookup_not_a_dir, /* /proc/filesystems */
+ lxpr_lookup_not_a_dir, /* /proc/interrupts */
+ lxpr_lookup_not_a_dir, /* /proc/ioports */
+ lxpr_lookup_not_a_dir, /* /proc/kcore */
+ lxpr_lookup_not_a_dir, /* /proc/kmsg */
+ lxpr_lookup_not_a_dir, /* /proc/loadavg */
+ lxpr_lookup_not_a_dir, /* /proc/meminfo */
+ lxpr_lookup_not_a_dir, /* /proc/mounts */
+ lxpr_lookup_netdir, /* /proc/net */
+ lxpr_lookup_not_a_dir, /* /proc/net/arp */
+ lxpr_lookup_not_a_dir, /* /proc/net/dev */
+ lxpr_lookup_not_a_dir, /* /proc/net/dev_mcast */
+ lxpr_lookup_not_a_dir, /* /proc/net/igmp */
+ lxpr_lookup_not_a_dir, /* /proc/net/ip_mr_cache */
+ lxpr_lookup_not_a_dir, /* /proc/net/ip_mr_vif */
+ lxpr_lookup_not_a_dir, /* /proc/net/mcfilter */
+ lxpr_lookup_not_a_dir, /* /proc/net/netstat */
+ lxpr_lookup_not_a_dir, /* /proc/net/raw */
+ lxpr_lookup_not_a_dir, /* /proc/net/route */
+ lxpr_lookup_not_a_dir, /* /proc/net/rpc */
+ lxpr_lookup_not_a_dir, /* /proc/net/rt_cache */
+ lxpr_lookup_not_a_dir, /* /proc/net/sockstat */
+ lxpr_lookup_not_a_dir, /* /proc/net/snmp */
+ lxpr_lookup_not_a_dir, /* /proc/net/stat */
+ lxpr_lookup_not_a_dir, /* /proc/net/tcp */
+ lxpr_lookup_not_a_dir, /* /proc/net/udp */
+ lxpr_lookup_not_a_dir, /* /proc/net/unix */
+ lxpr_lookup_not_a_dir, /* /proc/partitions */
+ lxpr_lookup_not_a_dir, /* /proc/self */
+ lxpr_lookup_not_a_dir, /* /proc/stat */
+ lxpr_lookup_not_a_dir, /* /proc/uptime */
+ lxpr_lookup_not_a_dir, /* /proc/version */
+};
+
+/*
+ * Array of readdir functions, indexed by /proc file type.
+ */
+static int (*lxpr_readdir_function[LXPR_NFILES])() = {
+ lxpr_readdir_procdir, /* /proc */
+ lxpr_readdir_piddir, /* /proc/<pid> */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/cmdline */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/cpu */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/cwd */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/environ */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/exe */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/maps */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/mem */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/root */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/stat */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/statm */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/status */
+ lxpr_readdir_fddir, /* /proc/<pid>/fd */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/fd/nn */
+ lxpr_readdir_not_a_dir, /* /proc/cmdline */
+ lxpr_readdir_not_a_dir, /* /proc/cpuinfo */
+ lxpr_readdir_not_a_dir, /* /proc/devices */
+ lxpr_readdir_not_a_dir, /* /proc/dma */
+ lxpr_readdir_not_a_dir, /* /proc/filesystems */
+ lxpr_readdir_not_a_dir, /* /proc/interrupts */
+ lxpr_readdir_not_a_dir, /* /proc/ioports */
+ lxpr_readdir_not_a_dir, /* /proc/kcore */
+ lxpr_readdir_not_a_dir, /* /proc/kmsg */
+ lxpr_readdir_not_a_dir, /* /proc/loadavg */
+ lxpr_readdir_not_a_dir, /* /proc/meminfo */
+ lxpr_readdir_not_a_dir, /* /proc/mounts */
+ lxpr_readdir_netdir, /* /proc/net */
+ lxpr_readdir_not_a_dir, /* /proc/net/arp */
+ lxpr_readdir_not_a_dir, /* /proc/net/dev */
+ lxpr_readdir_not_a_dir, /* /proc/net/dev_mcast */
+ lxpr_readdir_not_a_dir, /* /proc/net/igmp */
+ lxpr_readdir_not_a_dir, /* /proc/net/ip_mr_cache */
+ lxpr_readdir_not_a_dir, /* /proc/net/ip_mr_vif */
+ lxpr_readdir_not_a_dir, /* /proc/net/mcfilter */
+ lxpr_readdir_not_a_dir, /* /proc/net/netstat */
+ lxpr_readdir_not_a_dir, /* /proc/net/raw */
+ lxpr_readdir_not_a_dir, /* /proc/net/route */
+ lxpr_readdir_not_a_dir, /* /proc/net/rpc */
+ lxpr_readdir_not_a_dir, /* /proc/net/rt_cache */
+ lxpr_readdir_not_a_dir, /* /proc/net/sockstat */
+ lxpr_readdir_not_a_dir, /* /proc/net/snmp */
+ lxpr_readdir_not_a_dir, /* /proc/net/stat */
+ lxpr_readdir_not_a_dir, /* /proc/net/tcp */
+ lxpr_readdir_not_a_dir, /* /proc/net/udp */
+ lxpr_readdir_not_a_dir, /* /proc/net/unix */
+ lxpr_readdir_not_a_dir, /* /proc/partitions */
+ lxpr_readdir_not_a_dir, /* /proc/self */
+ lxpr_readdir_not_a_dir, /* /proc/stat */
+ lxpr_readdir_not_a_dir, /* /proc/uptime */
+ lxpr_readdir_not_a_dir, /* /proc/version */
+};
+
+
+/*
+ * lxpr_read(): Vnode operation for VOP_READ()
+ *
+ * As the format of all the files that can be read in lxproc is human readable
+ * and not binary structures there do not have to be different read variants
+ * depending on whether the reading process model is 32- or 64-bit.
+ */
+/* ARGSUSED */
+static int
+lxpr_read(vnode_t *vp, uio_t *uiop, int ioflag, cred_t *cr,
+ caller_context_t *ct)
+{
+ lxpr_node_t *lxpnp = VTOLXP(vp);
+ lxpr_nodetype_t type = lxpnp->lxpr_type;
+ lxpr_uiobuf_t *uiobuf = lxpr_uiobuf_new(uiop);
+ int error;
+
+ ASSERT(type < LXPR_NFILES);
+
+ lxpr_read_function[type](lxpnp, uiobuf);
+
+ error = lxpr_uiobuf_flush(uiobuf);
+ lxpr_uiobuf_free(uiobuf);
+
+ return (error);
+}
+
+/*
+ * lxpr_read_invalid(), lxpr_read_isdir(), lxpr_read_empty()
+ *
+ * Various special case reads:
+ * - trying to read a directory
+ * - invalid file (used to mean a file that should be implemented,
+ * but isn't yet)
+ * - empty file
+ * - wait to be able to read a file that will never have anything to read
+ */
+/* ARGSUSED */
+static void
+lxpr_read_isdir(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ lxpr_uiobuf_seterr(uiobuf, EISDIR);
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_invalid(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ lxpr_uiobuf_seterr(uiobuf, EINVAL);
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_empty(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/*
+ * lxpr_read_pid_cmdline():
+ *
+ * This is not precisely compatible with Linux: the Linux cmdline returns argv
+ * with the correct separation using \0 between the arguments, but we cannot do
+ * that without copying the real argv from the correct process context. This
+ * is too difficult to attempt so we pretend that the entire cmdline is just
+ * argv[0]. This is good enough for ps and htop to display correctly, but might
+ * cause some other things not to work correctly.
+ */
+static void
+lxpr_read_pid_cmdline(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ proc_t *p;
+ char *buf;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PID_CMDLINE);
+
+ p = lxpr_lock(lxpnp->lxpr_pid);
+ if (p == NULL) {
+ lxpr_uiobuf_seterr(uiobuf, EINVAL);
+ return;
+ }
+
+ buf = PTOU(p)->u_argv != 0 ? PTOU(p)->u_psargs : PTOU(p)->u_comm;
+
+ lxpr_uiobuf_write(uiobuf, buf, strlen(buf) + 1);
+ lxpr_unlock(p);
+}
+
+/*
+ * lxpr_read_pid_maps(): memory map file
+ */
+static void
+lxpr_read_pid_maps(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ proc_t *p;
+ struct as *as;
+ struct seg *seg;
+ char *buf;
+ int buflen = MAXPATHLEN;
+ struct print_data {
+ caddr_t saddr;
+ caddr_t eaddr;
+ int type;
+ char prot[5];
+ uint32_t offset;
+ vnode_t *vp;
+ struct print_data *next;
+ } *print_head = NULL;
+ struct print_data **print_tail = &print_head;
+ struct print_data *pbuf;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PID_MAPS);
+
+ p = lxpr_lock(lxpnp->lxpr_pid);
+ if (p == NULL) {
+ lxpr_uiobuf_seterr(uiobuf, EINVAL);
+ return;
+ }
+
+ as = p->p_as;
+
+ if (as == &kas) {
+ lxpr_unlock(p);
+ return;
+ }
+
+ mutex_exit(&p->p_lock);
+
+ /* Iterate over all segments in the address space */
+ AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
+ for (seg = AS_SEGFIRST(as); seg != NULL; seg = AS_SEGNEXT(as, seg)) {
+ vnode_t *vp;
+ uint_t protbits;
+
+ pbuf = kmem_alloc(sizeof (*pbuf), KM_SLEEP);
+
+ pbuf->saddr = seg->s_base;
+ pbuf->eaddr = seg->s_base+seg->s_size;
+ pbuf->type = SEGOP_GETTYPE(seg, seg->s_base);
+
+ /*
+ * Cheat and only use the protection bits of the first page
+ * in the segment
+ */
+ (void) strncpy(pbuf->prot, "----", sizeof (pbuf->prot));
+ (void) SEGOP_GETPROT(seg, seg->s_base, 0, &protbits);
+
+ if (protbits & PROT_READ) pbuf->prot[0] = 'r';
+ if (protbits & PROT_WRITE) pbuf->prot[1] = 'w';
+ if (protbits & PROT_EXEC) pbuf->prot[2] = 'x';
+ if (pbuf->type & MAP_SHARED) pbuf->prot[3] = 's';
+ else if (pbuf->type & MAP_PRIVATE) pbuf->prot[3] = 'p';
+
+ if (seg->s_ops == &segvn_ops &&
+ SEGOP_GETVP(seg, seg->s_base, &vp) == 0 &&
+ vp != NULL && vp->v_type == VREG) {
+ VN_HOLD(vp);
+ pbuf->vp = vp;
+ } else {
+ pbuf->vp = NULL;
+ }
+
+ pbuf->offset = (uint32_t)SEGOP_GETOFFSET(seg, pbuf->saddr);
+
+ pbuf->next = NULL;
+ *print_tail = pbuf;
+ print_tail = &pbuf->next;
+ }
+ AS_LOCK_EXIT(as, &as->a_lock);
+ mutex_enter(&p->p_lock);
+ lxpr_unlock(p);
+
+ buf = kmem_alloc(buflen, KM_SLEEP);
+
+ /* print the data we've extracted */
+ pbuf = print_head;
+ while (pbuf != NULL) {
+ struct print_data *pbuf_next;
+ vattr_t vattr;
+
+ int maj = 0;
+ int min = 0;
+ u_longlong_t inode = 0;
+
+ *buf = '\0';
+ if (pbuf->vp != NULL) {
+ vattr.va_mask = AT_FSID | AT_NODEID;
+ if (VOP_GETATTR(pbuf->vp, &vattr, 0, CRED(),
+ NULL) == 0) {
+ maj = getmajor(vattr.va_fsid);
+ min = getminor(vattr.va_fsid);
+ inode = vattr.va_nodeid;
+ }
+ (void) vnodetopath(NULL, pbuf->vp, buf, buflen, CRED());
+ VN_RELE(pbuf->vp);
+ }
+
+ if (*buf != '\0') {
+ lxpr_uiobuf_printf(uiobuf,
+ "%08x-%08x %s %08x %02d:%03d %lld %s\n",
+ pbuf->saddr, pbuf->eaddr, pbuf->prot, pbuf->offset,
+ maj, min, inode, buf);
+ } else {
+ lxpr_uiobuf_printf(uiobuf,
+ "%08x-%08x %s %08x %02d:%03d %lld\n",
+ pbuf->saddr, pbuf->eaddr, pbuf->prot, pbuf->offset,
+ maj, min, inode);
+ }
+
+ pbuf_next = pbuf->next;
+ kmem_free(pbuf, sizeof (*pbuf));
+ pbuf = pbuf_next;
+ }
+
+ kmem_free(buf, buflen);
+}
+
+/*
+ * lxpr_read_pid_statm(): memory status file
+ */
+static void
+lxpr_read_pid_statm(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ proc_t *p;
+ struct as *as;
+ size_t vsize;
+ size_t rss;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PID_STATM);
+
+ p = lxpr_lock(lxpnp->lxpr_pid);
+ if (p == NULL) {
+ lxpr_uiobuf_seterr(uiobuf, EINVAL);
+ return;
+ }
+
+ as = p->p_as;
+
+ mutex_exit(&p->p_lock);
+
+ AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
+ vsize = btopr(as->a_resvsize);
+ rss = rm_asrss(as);
+ AS_LOCK_EXIT(as, &as->a_lock);
+
+ mutex_enter(&p->p_lock);
+ lxpr_unlock(p);
+
+ lxpr_uiobuf_printf(uiobuf,
+ "%lu %lu %lu %lu %lu %lu %lu\n",
+ vsize, rss, 0l, rss, 0l, 0l, 0l);
+}
+
+/*
+ * lxpr_read_pid_status(): status file
+ */
+static void
+lxpr_read_pid_status(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ proc_t *p;
+ kthread_t *t;
+ user_t *up;
+ cred_t *cr;
+ const gid_t *groups;
+ int ngroups;
+ struct as *as;
+ char *status;
+ pid_t pid, ppid;
+ size_t vsize;
+ size_t rss;
+ k_sigset_t current, ignore, handle;
+ int i, lx_sig;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PID_STATUS);
+
+ p = lxpr_lock(lxpnp->lxpr_pid);
+ if (p == NULL) {
+ lxpr_uiobuf_seterr(uiobuf, EINVAL);
+ return;
+ }
+
+ pid = p->p_pid;
+
+ /*
+ * Convert pid to the Linux default of 1 if we're the zone's init
+ * process
+ */
+ if (pid == curproc->p_zone->zone_proc_initpid) {
+ pid = 1;
+ ppid = 0; /* parent pid for init is 0 */
+ } else {
+ /*
+ * Make sure not to reference parent PIDs that reside outside
+ * the zone
+ */
+ ppid = ((p->p_flag & SZONETOP)
+ ? curproc->p_zone->zone_zsched->p_pid : p->p_ppid);
+
+ /*
+ * Convert ppid to the Linux default of 1 if our parent is the
+ * zone's init process
+ */
+ if (ppid == curproc->p_zone->zone_proc_initpid)
+ ppid = 1;
+ }
+
+ t = prchoose(p);
+ if (t != NULL) {
+ switch (t->t_state) {
+ case TS_SLEEP:
+ status = "S (sleeping)";
+ break;
+ case TS_RUN:
+ case TS_ONPROC:
+ status = "R (running)";
+ break;
+ case TS_ZOMB:
+ status = "Z (zombie)";
+ break;
+ case TS_STOPPED:
+ status = "T (stopped)";
+ break;
+ default:
+ status = "! (unknown)";
+ break;
+ }
+ thread_unlock(t);
+ } else {
+ /*
+ * there is a hole in the exit code, where a proc can have
+ * no threads but it is yet to be flagged SZOMB. We will
+ * assume we are about to become a zombie
+ */
+ status = "Z (zombie)";
+ }
+
+ up = PTOU(p);
+ mutex_enter(&p->p_crlock);
+ crhold(cr = p->p_cred);
+ mutex_exit(&p->p_crlock);
+
+ lxpr_uiobuf_printf(uiobuf,
+ "Name:\t%s\n"
+ "State:\t%s\n"
+ "Tgid:\t%d\n"
+ "Pid:\t%d\n"
+ "PPid:\t%d\n"
+ "TracerPid:\t%d\n"
+ "Uid:\t%u\t%u\t%u\t%u\n"
+ "Gid:\t%u\t%u\t%u\t%u\n"
+ "FDSize:\t%d\n"
+ "Groups:\t",
+ up->u_comm,
+ status,
+ pid, /* thread group id - same as pid */
+ pid,
+ ppid,
+ 0,
+ crgetruid(cr), crgetuid(cr), crgetsuid(cr), crgetuid(cr),
+ crgetrgid(cr), crgetgid(cr), crgetsgid(cr), crgetgid(cr),
+ p->p_fno_ctl);
+
+ ngroups = crgetngroups(cr);
+ groups = crgetgroups(cr);
+ for (i = 0; i < ngroups; i++) {
+ lxpr_uiobuf_printf(uiobuf,
+ "%u ",
+ groups[i]);
+ }
+ crfree(cr);
+
+ as = p->p_as;
+ if ((p->p_stat != SZOMB) && !(p->p_flag & SSYS) && (as != &kas)) {
+ mutex_exit(&p->p_lock);
+ AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
+ vsize = as->a_resvsize;
+ rss = rm_asrss(as);
+ AS_LOCK_EXIT(as, &as->a_lock);
+ mutex_enter(&p->p_lock);
+
+ lxpr_uiobuf_printf(uiobuf,
+ "\n"
+ "VmSize:\t%8lu kB\n"
+ "VmLck:\t%8lu kB\n"
+ "VmRSS:\t%8lu kB\n"
+ "VmData:\t%8lu kB\n"
+ "VmStk:\t%8lu kB\n"
+ "VmExe:\t%8lu kB\n"
+ "VmLib:\t%8lu kB",
+ btok(vsize),
+ 0l,
+ ptok(rss),
+ 0l,
+ btok(p->p_stksize),
+ ptok(rss),
+ 0l);
+ }
+
+ sigemptyset(&current);
+ sigemptyset(&ignore);
+ sigemptyset(&handle);
+
+ for (i = 1; i < NSIG; i++) {
+ lx_sig = lxpr_sigmap[i];
+
+ if ((lx_sig > 0) && (lx_sig < LX_NSIG)) {
+ if (sigismember(&p->p_sig, i))
+ sigaddset(&current, lx_sig);
+
+ if (up->u_signal[i - 1] == SIG_IGN)
+ sigaddset(&ignore, lx_sig);
+ else if (up->u_signal[i - 1] != SIG_DFL)
+ sigaddset(&handle, lx_sig);
+ }
+ }
+
+ lxpr_uiobuf_printf(uiobuf,
+ "\n"
+ "SigPnd:\t%08x%08x\n"
+ "SigBlk:\t%08x%08x\n"
+ "SigIgn:\t%08x%08x\n"
+ "SigCgt:\t%08x%08x\n"
+ "CapInh:\t%016x\n"
+ "CapPrm:\t%016x\n"
+ "CapEff:\t%016x\n",
+ current.__sigbits[1], current.__sigbits[0],
+ 0, 0, /* signals blocked on per thread basis */
+ ignore.__sigbits[1], ignore.__sigbits[0],
+ handle.__sigbits[1], handle.__sigbits[0],
+ /* Can't do anything with linux capabilities */
+ 0,
+ 0,
+ 0);
+
+ lxpr_unlock(p);
+}
+
+
+/*
+ * lxpr_read_pid_stat(): pid stat file
+ */
+static void
+lxpr_read_pid_stat(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ proc_t *p;
+ kthread_t *t;
+ struct as *as;
+ char stat;
+ pid_t pid, ppid, pgpid, spid;
+ gid_t psgid;
+ dev_t psdev;
+ size_t rss, vsize;
+ int nice, pri;
+ caddr_t wchan;
+ processorid_t cpu;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PID_STAT);
+
+ p = lxpr_lock(lxpnp->lxpr_pid);
+ if (p == NULL) {
+ lxpr_uiobuf_seterr(uiobuf, EINVAL);
+ return;
+ }
+
+ pid = p->p_pid;
+
+ /*
+ * Set Linux defaults if we're the zone's init process
+ */
+ if (pid == curproc->p_zone->zone_proc_initpid) {
+ pid = 1; /* PID for init */
+ ppid = 0; /* parent PID for init is 0 */
+ pgpid = 0; /* process group for init is 0 */
+ psgid = (gid_t)-1; /* credential GID for init is -1 */
+ spid = 0; /* session id for init is 0 */
+ psdev = 0; /* session device for init is 0 */
+ } else {
+ /*
+ * Make sure not to reference parent PIDs that reside outside
+ * the zone
+ */
+ ppid = ((p->p_flag & SZONETOP) ?
+ curproc->p_zone->zone_zsched->p_pid : p->p_ppid);
+
+ /*
+ * Convert ppid to the Linux default of 1 if our parent is the
+ * zone's init process
+ */
+ if (ppid == curproc->p_zone->zone_proc_initpid)
+ ppid = 1;
+
+ pgpid = p->p_pgrp;
+
+ mutex_enter(&p->p_splock);
+ mutex_enter(&p->p_sessp->s_lock);
+ spid = p->p_sessp->s_sid;
+ psdev = p->p_sessp->s_dev;
+ if (p->p_sessp->s_cred)
+ psgid = crgetgid(p->p_sessp->s_cred);
+ else
+ psgid = crgetgid(p->p_cred);
+
+ mutex_exit(&p->p_sessp->s_lock);
+ mutex_exit(&p->p_splock);
+ }
+
+ t = prchoose(p);
+ if (t != NULL) {
+ switch (t->t_state) {
+ case TS_SLEEP:
+ stat = 'S'; break;
+ case TS_RUN:
+ case TS_ONPROC:
+ stat = 'R'; break;
+ case TS_ZOMB:
+ stat = 'Z'; break;
+ case TS_STOPPED:
+ stat = 'T'; break;
+ default:
+ stat = '!'; break;
+ }
+
+ if (CL_DONICE(t, NULL, 0, &nice) != 0)
+ nice = 0;
+
+ pri = t->t_pri;
+ wchan = t->t_wchan;
+ cpu = t->t_cpu->cpu_id;
+ thread_unlock(t);
+ } else {
+ /* Only zombies have no threads */
+ stat = 'Z';
+ nice = 0;
+ pri = 0;
+ wchan = 0;
+ cpu = 0;
+ }
+ as = p->p_as;
+ mutex_exit(&p->p_lock);
+ AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
+ vsize = as->a_resvsize;
+ rss = rm_asrss(as);
+ AS_LOCK_EXIT(as, &as->a_lock);
+ mutex_enter(&p->p_lock);
+
+ lxpr_uiobuf_printf(uiobuf,
+ "%d (%s) %c %d %d %d %d %d "
+ "%lu %lu %lu %lu %lu "
+ "%lu %lu %ld %ld "
+ "%d %d %d "
+ "%lu "
+ "%lu "
+ "%lu %ld %llu "
+ "%lu %lu %u "
+ "%lu %lu "
+ "%lu %lu %lu %lu "
+ "%lu "
+ "%lu %lu "
+ "%d "
+ "%d"
+ "\n",
+ pid, PTOU(p)->u_comm, stat, ppid, pgpid, spid, psdev, psgid,
+ 0l, 0l, 0l, 0l, 0l, /* flags, minflt, cminflt, majflt, cmajflt */
+ p->p_utime, p->p_stime, p->p_cutime, p->p_cstime,
+ pri, nice, p->p_lwpcnt,
+ 0l, /* itrealvalue (time before next SIGALRM) */
+ PTOU(p)->u_ticks,
+ vsize, rss, p->p_vmem_ctl,
+ 0l, 0l, USRSTACK, /* startcode, endcode, startstack */
+ 0l, 0l, /* kstkesp, kstkeip */
+ 0l, 0l, 0l, 0l, /* signal, blocked, sigignore, sigcatch */
+ wchan,
+ 0l, 0l, /* nswap, cnswap */
+ 0, /* exit_signal */
+ cpu);
+
+ lxpr_unlock(p);
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_arp(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_dev(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ lxpr_uiobuf_printf(uiobuf, "Inter-| Receive "
+ " | Transmit\n");
+ lxpr_uiobuf_printf(uiobuf, " face |bytes packets errs drop fifo"
+ " frame compressed multicast|bytes packets errs drop fifo"
+ " colls carrier compressed\n");
+
+ /*
+ * Data about each interface should go here, but that shouldn't be added
+ * unless there is an lxproc reader that actually makes use of it (and
+ * doesn't need anything else that we refuse to provide)...
+ */
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_dev_mcast(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_igmp(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_ip_mr_cache(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_ip_mr_vif(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_mcfilter(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_netstat(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_raw(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_route(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_rpc(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_rt_cache(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_sockstat(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_snmp(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_stat(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_tcp(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_udp(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_net_unix(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+}
+
+/*
+ * lxpr_read_kmsg(): read the contents of the kernel message queue. We
+ * translate this into the reception of console messages for this zone; each
+ * read copies out a single zone console message, or blocks until the next one
+ * is produced.
+ */
+
+#define LX_KMSG_PRI "<0>"
+
+static void
+lxpr_read_kmsg(lxpr_node_t *lxpnp, struct lxpr_uiobuf *uiobuf)
+{
+ ldi_handle_t lh = lxpnp->lxpr_cons_ldih;
+ mblk_t *mp;
+
+ if (ldi_getmsg(lh, &mp, NULL) == 0) {
+ /*
+ * lxproc doesn't like successive reads to the same file
+ * descriptor unless we do an explicit rewind each time.
+ */
+ lxpr_uiobuf_seek(uiobuf, 0);
+
+ lxpr_uiobuf_printf(uiobuf, "%s%s", LX_KMSG_PRI,
+ mp->b_cont->b_rptr);
+
+ freemsg(mp);
+ }
+}
+
+/*
+ * lxpr_read_loadavg(): read the contents of the "loadavg" file. We do just
+ * enough for uptime and other simple lxproc readers to work
+ */
+extern int nthread;
+
+static void
+lxpr_read_loadavg(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ ulong_t avenrun1;
+ ulong_t avenrun5;
+ ulong_t avenrun15;
+ ulong_t avenrun1_cs;
+ ulong_t avenrun5_cs;
+ ulong_t avenrun15_cs;
+ int loadavg[3];
+ int *loadbuf;
+ cpupart_t *cp;
+ zone_t *zone = LXPTOZ(lxpnp);
+
+ uint_t nrunnable = 0;
+ rctl_qty_t nlwps;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_LOADAVG);
+
+ mutex_enter(&cpu_lock);
+
+ /*
+ * Need to add up values over all CPU partitions. If pools are active,
+ * only report the values of the zone's partition, which by definition
+ * includes the current CPU.
+ */
+ if (pool_pset_enabled()) {
+ psetid_t psetid = zone_pset_get(curproc->p_zone);
+
+ ASSERT(curproc->p_zone != &zone0);
+ cp = CPU->cpu_part;
+
+ nrunnable = cp->cp_nrunning + cp->cp_nrunnable;
+ (void) cpupart_get_loadavg(psetid, &loadavg[0], 3);
+ loadbuf = &loadavg[0];
+ } else {
+ cp = cp_list_head;
+ do {
+ nrunnable += cp->cp_nrunning + cp->cp_nrunnable;
+ } while ((cp = cp->cp_next) != cp_list_head);
+
+ loadbuf = zone == global_zone ?
+ &avenrun[0] : zone->zone_avenrun;
+ }
+
+ /*
+ * If we're in the non-global zone, we'll report the total number of
+ * LWPs in the zone for the "nproc" parameter of /proc/loadavg,
+ * otherwise will just use nthread (which will include kernel threads,
+ * but should be good enough for lxproc).
+ */
+ nlwps = zone == global_zone ? nthread : zone->zone_nlwps;
+
+ mutex_exit(&cpu_lock);
+
+ avenrun1 = loadbuf[0] >> FSHIFT;
+ avenrun1_cs = ((loadbuf[0] & (FSCALE-1)) * 100) >> FSHIFT;
+ avenrun5 = loadbuf[1] >> FSHIFT;
+ avenrun5_cs = ((loadbuf[1] & (FSCALE-1)) * 100) >> FSHIFT;
+ avenrun15 = loadbuf[2] >> FSHIFT;
+ avenrun15_cs = ((loadbuf[2] & (FSCALE-1)) * 100) >> FSHIFT;
+
+ lxpr_uiobuf_printf(uiobuf,
+ "%ld.%02d %ld.%02d %ld.%02d %d/%d %d\n",
+ avenrun1, avenrun1_cs,
+ avenrun5, avenrun5_cs,
+ avenrun15, avenrun15_cs,
+ nrunnable, nlwps, 0);
+}
+
+/*
+ * lxpr_read_meminfo(): read the contents of the "meminfo" file.
+ */
+static void
+lxpr_read_meminfo(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ zone_t *zone = LXPTOZ(lxpnp);
+ int global = zone == global_zone;
+ long total_mem, free_mem, total_swap, used_swap;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_MEMINFO);
+
+ if (global || zone->zone_phys_mem_ctl == UINT64_MAX) {
+ total_mem = physmem * PAGESIZE;
+ free_mem = freemem * PAGESIZE;
+ } else {
+ total_mem = zone->zone_phys_mem_ctl;
+ free_mem = zone->zone_phys_mem_ctl - zone->zone_phys_mem;
+ }
+
+ if (global || zone->zone_max_swap_ctl == UINT64_MAX) {
+ total_swap = k_anoninfo.ani_max * PAGESIZE;
+ used_swap = k_anoninfo.ani_phys_resv * PAGESIZE;
+ } else {
+ mutex_enter(&zone->zone_mem_lock);
+ total_swap = zone->zone_max_swap_ctl;
+ used_swap = zone->zone_max_swap;
+ mutex_exit(&zone->zone_mem_lock);
+ }
+
+ lxpr_uiobuf_printf(uiobuf,
+ " total: used: free: shared: buffers: cached:\n"
+ "Mem: %8lu %8lu %8lu %8u %8u %8u\n"
+ "Swap: %8lu %8lu %8lu\n"
+ "MemTotal: %8lu kB\n"
+ "MemFree: %8lu kB\n"
+ "MemShared: %8u kB\n"
+ "Buffers: %8u kB\n"
+ "Cached: %8u kB\n"
+ "SwapCached:%8u kB\n"
+ "Active: %8u kB\n"
+ "Inactive: %8u kB\n"
+ "HighTotal: %8u kB\n"
+ "HighFree: %8u kB\n"
+ "LowTotal: %8u kB\n"
+ "LowFree: %8u kB\n"
+ "SwapTotal: %8lu kB\n"
+ "SwapFree: %8lu kB\n",
+ total_mem, total_mem - free_mem, free_mem, 0, 0, 0,
+ total_swap, used_swap, total_swap - used_swap,
+ btok(total_mem), /* MemTotal */
+ btok(free_mem), /* MemFree */
+ 0, /* MemShared */
+ 0, /* Buffers */
+ 0, /* Cached */
+ 0, /* SwapCached */
+ 0, /* Active */
+ 0, /* Inactive */
+ 0, /* HighTotal */
+ 0, /* HighFree */
+ btok(total_mem), /* LowTotal */
+ btok(free_mem), /* LowFree */
+ btok(total_swap), /* SwapTotal */
+ btok(total_swap - used_swap)); /* SwapFree */
+}
+
+/*
+ * lxpr_read_mounts():
+ */
+/* ARGSUSED */
+static void
+lxpr_read_mounts(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ struct vfs *vfsp;
+ struct vfs *vfslist;
+ zone_t *zone = LXPTOZ(lxpnp);
+ struct print_data {
+ refstr_t *vfs_mntpt;
+ refstr_t *vfs_resource;
+ uint_t vfs_flag;
+ int vfs_fstype;
+ struct print_data *next;
+ } *print_head = NULL;
+ struct print_data **print_tail = &print_head;
+ struct print_data *printp;
+
+ vfs_list_read_lock();
+
+ if (zone == global_zone) {
+ vfsp = vfslist = rootvfs;
+ } else {
+ vfsp = vfslist = zone->zone_vfslist;
+ /*
+ * If the zone has a root entry, it will be the first in
+ * the list. If it doesn't, we conjure one up.
+ */
+ if (vfslist == NULL || strcmp(refstr_value(vfsp->vfs_mntpt),
+ zone->zone_rootpath) != 0) {
+ struct vfs *tvfsp;
+ /*
+ * The root of the zone is not a mount point. The vfs
+ * we want to report is that of the zone's root vnode.
+ */
+ tvfsp = zone->zone_rootvp->v_vfsp;
+
+ lxpr_uiobuf_printf(uiobuf,
+ "/ / %s %s 0 0\n",
+ vfssw[tvfsp->vfs_fstype].vsw_name,
+ tvfsp->vfs_flag & VFS_RDONLY ? "ro" : "rw");
+
+ }
+ if (vfslist == NULL) {
+ vfs_list_unlock();
+ return;
+ }
+ }
+
+ /*
+ * Later on we have to do a lookupname, which can end up causing
+ * another vfs_list_read_lock() to be called. Which can lead to a
+ * deadlock. To avoid this, we extract the data we need into a local
+ * list, then we can run this list without holding vfs_list_read_lock()
+ * We keep the list in the same order as the vfs_list
+ */
+ do {
+ /* Skip mounts we shouldn't show */
+ if (vfsp->vfs_flag & VFS_NOMNTTAB) {
+ goto nextfs;
+ }
+
+ printp = kmem_alloc(sizeof (*printp), KM_SLEEP);
+ refstr_hold(vfsp->vfs_mntpt);
+ printp->vfs_mntpt = vfsp->vfs_mntpt;
+ refstr_hold(vfsp->vfs_resource);
+ printp->vfs_resource = vfsp->vfs_resource;
+ printp->vfs_flag = vfsp->vfs_flag;
+ printp->vfs_fstype = vfsp->vfs_fstype;
+ printp->next = NULL;
+
+ *print_tail = printp;
+ print_tail = &printp->next;
+
+nextfs:
+ vfsp = (zone == global_zone) ?
+ vfsp->vfs_next : vfsp->vfs_zone_next;
+
+ } while (vfsp != vfslist);
+
+ vfs_list_unlock();
+
+ /*
+ * now we can run through what we've extracted without holding
+ * vfs_list_read_lock()
+ */
+ printp = print_head;
+ while (printp != NULL) {
+ struct print_data *printp_next;
+ const char *resource;
+ char *mntpt;
+ struct vnode *vp;
+ int error;
+
+ mntpt = (char *)refstr_value(printp->vfs_mntpt);
+ resource = refstr_value(printp->vfs_resource);
+
+ if (mntpt != NULL && mntpt[0] != '\0')
+ mntpt = ZONE_PATH_TRANSLATE(mntpt, zone);
+ else
+ mntpt = "-";
+
+ error = lookupname(mntpt, UIO_SYSSPACE, FOLLOW, NULLVPP, &vp);
+
+ if (error != 0)
+ goto nextp;
+
+ if (!(vp->v_flag & VROOT)) {
+ VN_RELE(vp);
+ goto nextp;
+ }
+ VN_RELE(vp);
+
+ if (resource != NULL && resource[0] != '\0') {
+ if (resource[0] == '/') {
+ resource = ZONE_PATH_VISIBLE(resource, zone) ?
+ ZONE_PATH_TRANSLATE(resource, zone) :
+ mntpt;
+ }
+ } else {
+ resource = "-";
+ }
+
+ lxpr_uiobuf_printf(uiobuf,
+ "%s %s %s %s 0 0\n",
+ resource, mntpt, vfssw[printp->vfs_fstype].vsw_name,
+ printp->vfs_flag & VFS_RDONLY ? "ro" : "rw");
+
+nextp:
+ printp_next = printp->next;
+ refstr_rele(printp->vfs_mntpt);
+ refstr_rele(printp->vfs_resource);
+ kmem_free(printp, sizeof (*printp));
+ printp = printp_next;
+
+ }
+}
+
+/*
+ * lxpr_read_partitions():
+ *
+ * We don't support partitions in a local zone because it requires access to
+ * physical devices. But we need to fake up enough of the file to show that we
+ * have no partitions.
+ */
+/* ARGSUSED */
+static void
+lxpr_read_partitions(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ lxpr_uiobuf_printf(uiobuf,
+ "major minor #blocks name rio rmerge rsect ruse "
+ "wio wmerge wsect wuse running use aveq\n\n");
+}
+
+/*
+ * lxpr_read_version(): read the contents of the "version" file. Note that
+ * we don't lie here -- we don't pretend that we're Linux. If lxproc is to
+ * be used in a Linux-branded zone, there will need to be a mount option to
+ * indicate that Linux should be more fully mimicked.
+ */
+/* ARGSUSED */
+static void
+lxpr_read_version(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ lxpr_uiobuf_printf(uiobuf,
+ "%s version %s (%s version %d.%d.%d) "
+ "#%s SMP %s\n",
+ utsname.sysname, utsname.release,
+#if defined(__GNUC__)
+ "gcc",
+ __GNUC__,
+ __GNUC_MINOR__,
+ __GNUC_PATCHLEVEL__,
+#else
+ "Sun C",
+ __SUNPRO_C / 0x100,
+ (__SUNPRO_C & 0xff) / 0x10,
+ __SUNPRO_C & 0xf,
+#endif
+ utsname.version,
+ "00:00:00 00/00/00");
+}
+
+/*
+ * lxpr_read_stat(): read the contents of the "stat" file.
+ *
+ */
+/* ARGSUSED */
+static void
+lxpr_read_stat(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ cpu_t *cp, *cpstart;
+ int pools_enabled;
+ ulong_t idle_cum = 0;
+ ulong_t sys_cum = 0;
+ ulong_t user_cum = 0;
+ ulong_t irq_cum = 0;
+ uint_t cpu_nrunnable_cum = 0;
+ uint_t w_io_cum = 0;
+
+ ulong_t pgpgin_cum = 0;
+ ulong_t pgpgout_cum = 0;
+ ulong_t pgswapout_cum = 0;
+ ulong_t pgswapin_cum = 0;
+ ulong_t intr_cum = 0;
+ ulong_t pswitch_cum = 0;
+ ulong_t forks_cum = 0;
+ hrtime_t msnsecs[NCMSTATES];
+
+ /* temporary variable since scalehrtime modifies data in place */
+ hrtime_t tmptime;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_STAT);
+
+ mutex_enter(&cpu_lock);
+ pools_enabled = pool_pset_enabled();
+
+ /* Calculate cumulative stats */
+ cp = cpstart = CPU->cpu_part->cp_cpulist;
+ do {
+ int i;
+
+ /*
+ * Don't count CPUs that aren't even in the system
+ * or aren't up yet.
+ */
+ if ((cp->cpu_flags & CPU_EXISTS) == 0) {
+ continue;
+ }
+
+ get_cpu_mstate(cp, msnsecs);
+
+ idle_cum += NSEC_TO_TICK(msnsecs[CMS_IDLE]);
+ sys_cum += NSEC_TO_TICK(msnsecs[CMS_SYSTEM]);
+ user_cum += NSEC_TO_TICK(msnsecs[CMS_USER]);
+
+ pgpgin_cum += CPU_STATS(cp, vm.pgpgin);
+ pgpgout_cum += CPU_STATS(cp, vm.pgpgout);
+ pgswapin_cum += CPU_STATS(cp, vm.pgswapin);
+ pgswapout_cum += CPU_STATS(cp, vm.pgswapout);
+
+ cpu_nrunnable_cum += cp->cpu_disp->disp_nrunnable;
+ w_io_cum += CPU_STATS(cp, sys.iowait);
+ for (i = 0; i < NCMSTATES; i++) {
+ tmptime = cp->cpu_intracct[i];
+ scalehrtime(&tmptime);
+ irq_cum += NSEC_TO_TICK(tmptime);
+ }
+
+ for (i = 0; i < PIL_MAX; i++)
+ intr_cum += CPU_STATS(cp, sys.intr[i]);
+
+ pswitch_cum += CPU_STATS(cp, sys.pswitch);
+ forks_cum += CPU_STATS(cp, sys.sysfork);
+ forks_cum += CPU_STATS(cp, sys.sysvfork);
+
+ if (pools_enabled)
+ cp = cp->cpu_next_part;
+ else
+ cp = cp->cpu_next;
+ } while (cp != cpstart);
+
+ lxpr_uiobuf_printf(uiobuf, "cpu %ld %ld %ld %ld %ld %ld %ld\n",
+ user_cum, 0, sys_cum, idle_cum, 0, irq_cum, 0);
+
+ /* Do per processor stats */
+ do {
+ int i;
+
+ ulong_t idle_ticks;
+ ulong_t sys_ticks;
+ ulong_t user_ticks;
+ ulong_t irq_ticks = 0;
+
+ /*
+ * Don't count CPUs that aren't even in the system
+ * or aren't up yet.
+ */
+ if ((cp->cpu_flags & CPU_EXISTS) == 0) {
+ continue;
+ }
+
+ get_cpu_mstate(cp, msnsecs);
+
+ idle_ticks = NSEC_TO_TICK(msnsecs[CMS_IDLE]);
+ sys_ticks = NSEC_TO_TICK(msnsecs[CMS_SYSTEM]);
+ user_ticks = NSEC_TO_TICK(msnsecs[CMS_USER]);
+
+ for (i = 0; i < NCMSTATES; i++) {
+ tmptime = cp->cpu_intracct[i];
+ scalehrtime(&tmptime);
+ irq_ticks += NSEC_TO_TICK(tmptime);
+ }
+
+ lxpr_uiobuf_printf(uiobuf,
+ "cpu%d %ld %ld %ld %ld %ld %ld %ld\n",
+ cp->cpu_id, user_ticks, 0, sys_ticks, idle_ticks,
+ 0, irq_ticks, 0);
+
+ if (pools_enabled)
+ cp = cp->cpu_next_part;
+ else
+ cp = cp->cpu_next;
+ } while (cp != cpstart);
+
+ mutex_exit(&cpu_lock);
+
+ lxpr_uiobuf_printf(uiobuf,
+ "page %lu %lu\n"
+ "swap %lu %lu\n"
+ "intr %lu\n"
+ "ctxt %lu\n"
+ "btime %lu\n"
+ "processes %lu\n"
+ "procs_running %lu\n"
+ "procs_blocked %lu\n",
+ pgpgin_cum, pgpgout_cum,
+ pgswapin_cum, pgswapout_cum,
+ intr_cum,
+ pswitch_cum,
+ boot_time,
+ forks_cum,
+ cpu_nrunnable_cum,
+ w_io_cum);
+}
+
+/*
+ * lxpr_read_uptime(): read the contents of the "uptime" file.
+ *
+ * format is: "%.2lf, %.2lf",uptime_secs, idle_secs
+ * Use fixed point arithmetic to get 2 decimal places
+ */
+/* ARGSUSED */
+static void
+lxpr_read_uptime(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ cpu_t *cp, *cpstart;
+ int pools_enabled;
+ ulong_t idle_cum = 0;
+ ulong_t cpu_count = 0;
+ ulong_t idle_s;
+ ulong_t idle_cs;
+ ulong_t up_s;
+ ulong_t up_cs;
+ hrtime_t birthtime;
+ hrtime_t centi_sec = 10000000; /* 10^7 */
+
+ ASSERT(lxpnp->lxpr_type == LXPR_UPTIME);
+
+ /* Calculate cumulative stats */
+ mutex_enter(&cpu_lock);
+ pools_enabled = pool_pset_enabled();
+
+ cp = cpstart = CPU;
+ do {
+ /*
+ * Don't count CPUs that aren't even in the system
+ * or aren't up yet.
+ */
+ if ((cp->cpu_flags & CPU_EXISTS) == 0) {
+ continue;
+ }
+
+ idle_cum += CPU_STATS(cp, sys.cpu_ticks_idle);
+ idle_cum += CPU_STATS(cp, sys.cpu_ticks_wait);
+ cpu_count += 1;
+
+ if (pools_enabled)
+ cp = cp->cpu_next_part;
+ else
+ cp = cp->cpu_next;
+ } while (cp != cpstart);
+ mutex_exit(&cpu_lock);
+
+ /* Getting the Zone zsched process startup time */
+ birthtime = LXPTOZ(lxpnp)->zone_zsched->p_mstart;
+ up_cs = (gethrtime() - birthtime) / centi_sec;
+ up_s = up_cs / 100;
+ up_cs %= 100;
+
+ ASSERT(cpu_count > 0);
+ idle_cum /= cpu_count;
+ idle_s = idle_cum / hz;
+ idle_cs = idle_cum % hz;
+ idle_cs *= 100;
+ idle_cs /= hz;
+
+ lxpr_uiobuf_printf(uiobuf,
+ "%ld.%02d %ld.%02d\n", up_s, up_cs, idle_s, idle_cs);
+}
+
+static const char *amd_x_edx[] = {
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, "syscall",
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, "mp",
+ "nx", NULL, "mmxext", NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, "lm", "3dnowext", "3dnow"
+};
+
+static const char *amd_x_ecx[] = {
+ "lahf_lm", NULL, "svm", NULL,
+ "altmovcr8"
+};
+
+static const char *tm_x_edx[] = {
+ "recovery", "longrun", NULL, "lrti"
+};
+
+/*
+ * Intel calls no-execute "xd" in its docs, but Linux still reports it as "nx."
+ */
+static const char *intc_x_edx[] = {
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, "syscall",
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ "nx", NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, "lm", NULL, NULL
+};
+
+static const char *intc_edx[] = {
+ "fpu", "vme", "de", "pse",
+ "tsc", "msr", "pae", "mce",
+ "cx8", "apic", NULL, "sep",
+ "mtrr", "pge", "mca", "cmov",
+ "pat", "pse36", "pn", "clflush",
+ NULL, "dts", "acpi", "mmx",
+ "fxsr", "sse", "sse2", "ss",
+ "ht", "tm", "ia64", "pbe"
+};
+
+/*
+ * "sse3" on linux is called "pni" (Prescott New Instructions).
+ */
+static const char *intc_ecx[] = {
+ "pni", NULL, NULL, "monitor",
+ "ds_cpl", NULL, NULL, "est",
+ "tm2", NULL, "cid", NULL,
+ NULL, "cx16", "xtpr"
+};
+
+static void
+lxpr_read_cpuinfo(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ int i;
+ uint32_t bits;
+ cpu_t *cp, *cpstart;
+ int pools_enabled;
+ const char **fp;
+ char brandstr[CPU_IDSTRLEN];
+ struct cpuid_regs cpr;
+ int maxeax;
+ int std_ecx, std_edx, ext_ecx, ext_edx;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_CPUINFO);
+
+ mutex_enter(&cpu_lock);
+ pools_enabled = pool_pset_enabled();
+
+ cp = cpstart = CPU;
+ do {
+ /*
+ * This returns the maximum eax value for standard cpuid
+ * functions in eax.
+ */
+ cpr.cp_eax = 0;
+ (void) cpuid_insn(cp, &cpr);
+ maxeax = cpr.cp_eax;
+
+ /*
+ * Get standard x86 feature flags.
+ */
+ cpr.cp_eax = 1;
+ (void) cpuid_insn(cp, &cpr);
+ std_ecx = cpr.cp_ecx;
+ std_edx = cpr.cp_edx;
+
+ /*
+ * Now get extended feature flags.
+ */
+ cpr.cp_eax = 0x80000001;
+ (void) cpuid_insn(cp, &cpr);
+ ext_ecx = cpr.cp_ecx;
+ ext_edx = cpr.cp_edx;
+
+ (void) cpuid_getbrandstr(cp, brandstr, CPU_IDSTRLEN);
+
+ lxpr_uiobuf_printf(uiobuf,
+ "processor\t: %d\n"
+ "vendor_id\t: %s\n"
+ "cpu family\t: %d\n"
+ "model\t\t: %d\n"
+ "model name\t: %s\n"
+ "stepping\t: %d\n"
+ "cpu MHz\t\t: %u.%03u\n",
+ cp->cpu_id, cpuid_getvendorstr(cp), cpuid_getfamily(cp),
+ cpuid_getmodel(cp), brandstr, cpuid_getstep(cp),
+ (uint32_t)(cpu_freq_hz / 1000000),
+ ((uint32_t)(cpu_freq_hz / 1000)) % 1000);
+
+ lxpr_uiobuf_printf(uiobuf, "cache size\t: %u KB\n",
+ getl2cacheinfo(cp, NULL, NULL, NULL) / 1024);
+
+ if (is_x86_feature(x86_featureset, X86FSET_HTT)) {
+ /*
+ * 'siblings' is used for HT-style threads
+ */
+ lxpr_uiobuf_printf(uiobuf,
+ "physical id\t: %lu\n"
+ "siblings\t: %u\n",
+ pg_plat_hw_instance_id(cp, PGHW_CHIP),
+ cpuid_get_ncpu_per_chip(cp));
+ }
+
+ /*
+ * Since we're relatively picky about running on older hardware,
+ * we can be somewhat cavalier about the answers to these ones.
+ *
+ * In fact, given the hardware we support, we just say:
+ *
+ * fdiv_bug : no (if we're on a 64-bit kernel)
+ * hlt_bug : no
+ * f00f_bug : no
+ * coma_bug : no
+ * wp : yes (write protect in supervsr mode)
+ */
+ lxpr_uiobuf_printf(uiobuf,
+ "fdiv_bug\t: %s\n"
+ "hlt_bug \t: no\n"
+ "f00f_bug\t: no\n"
+ "coma_bug\t: no\n"
+ "fpu\t\t: %s\n"
+ "fpu_exception\t: %s\n"
+ "cpuid level\t: %d\n"
+ "flags\t\t:",
+#if defined(__i386)
+ fpu_pentium_fdivbug ? "yes" : "no",
+#else
+ "no",
+#endif /* __i386 */
+ fpu_exists ? "yes" : "no", fpu_exists ? "yes" : "no",
+ maxeax);
+
+ for (bits = std_edx, fp = intc_edx, i = 0;
+ i < sizeof (intc_edx) / sizeof (intc_edx[0]); fp++, i++)
+ if ((bits & (1 << i)) != 0 && *fp)
+ lxpr_uiobuf_printf(uiobuf, " %s", *fp);
+
+ /*
+ * name additional features where appropriate
+ */
+ switch (x86_vendor) {
+ case X86_VENDOR_Intel:
+ for (bits = ext_edx, fp = intc_x_edx, i = 0;
+ i < sizeof (intc_x_edx) / sizeof (intc_x_edx[0]);
+ fp++, i++)
+ if ((bits & (1 << i)) != 0 && *fp)
+ lxpr_uiobuf_printf(uiobuf, " %s", *fp);
+ break;
+
+ case X86_VENDOR_AMD:
+ for (bits = ext_edx, fp = amd_x_edx, i = 0;
+ i < sizeof (amd_x_edx) / sizeof (amd_x_edx[0]);
+ fp++, i++)
+ if ((bits & (1 << i)) != 0 && *fp)
+ lxpr_uiobuf_printf(uiobuf, " %s", *fp);
+
+ for (bits = ext_ecx, fp = amd_x_ecx, i = 0;
+ i < sizeof (amd_x_ecx) / sizeof (amd_x_ecx[0]);
+ fp++, i++)
+ if ((bits & (1 << i)) != 0 && *fp)
+ lxpr_uiobuf_printf(uiobuf, " %s", *fp);
+ break;
+
+ case X86_VENDOR_TM:
+ for (bits = ext_edx, fp = tm_x_edx, i = 0;
+ i < sizeof (tm_x_edx) / sizeof (tm_x_edx[0]);
+ fp++, i++)
+ if ((bits & (1 << i)) != 0 && *fp)
+ lxpr_uiobuf_printf(uiobuf, " %s", *fp);
+ break;
+ default:
+ break;
+ }
+
+ for (bits = std_ecx, fp = intc_ecx, i = 0;
+ i < sizeof (intc_ecx) / sizeof (intc_ecx[0]); fp++, i++)
+ if ((bits & (1 << i)) != 0 && *fp)
+ lxpr_uiobuf_printf(uiobuf, " %s", *fp);
+
+ lxpr_uiobuf_printf(uiobuf, "\n\n");
+
+ if (pools_enabled)
+ cp = cp->cpu_next_part;
+ else
+ cp = cp->cpu_next;
+ } while (cp != cpstart);
+
+ mutex_exit(&cpu_lock);
+}
+
+/* ARGSUSED */
+static void
+lxpr_read_fd(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ ASSERT(lxpnp->lxpr_type == LXPR_PID_FD_FD);
+ lxpr_uiobuf_seterr(uiobuf, EFAULT);
+}
+
+/*
+ * lxpr_getattr(): Vnode operation for VOP_GETATTR()
+ */
+static int
+lxpr_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr,
+ caller_context_t *ct)
+{
+ register lxpr_node_t *lxpnp = VTOLXP(vp);
+ lxpr_nodetype_t type = lxpnp->lxpr_type;
+ extern uint_t nproc;
+ int error;
+
+ /*
+ * Return attributes of underlying vnode if ATTR_REAL
+ *
+ * but keep fd files with the symlink permissions
+ */
+ if (lxpnp->lxpr_realvp != NULL && (flags & ATTR_REAL)) {
+ vnode_t *rvp = lxpnp->lxpr_realvp;
+
+ /*
+ * withold attribute information to owner or root
+ */
+ if ((error = VOP_ACCESS(rvp, 0, 0, cr, ct)) != 0) {
+ return (error);
+ }
+
+ /*
+ * now its attributes
+ */
+ if ((error = VOP_GETATTR(rvp, vap, flags, cr, ct)) != 0) {
+ return (error);
+ }
+
+ /*
+ * if it's a file in lx /proc/pid/fd/xx then set its
+ * mode and keep it looking like a symlink
+ */
+ if (type == LXPR_PID_FD_FD) {
+ vap->va_mode = lxpnp->lxpr_mode;
+ vap->va_type = vp->v_type;
+ vap->va_size = 0;
+ vap->va_nlink = 1;
+ }
+ return (0);
+ }
+
+ /* Default attributes, that may be overridden below */
+ bzero(vap, sizeof (*vap));
+ vap->va_atime = vap->va_mtime = vap->va_ctime = lxpnp->lxpr_time;
+ vap->va_nlink = 1;
+ vap->va_type = vp->v_type;
+ vap->va_mode = lxpnp->lxpr_mode;
+ vap->va_fsid = vp->v_vfsp->vfs_dev;
+ vap->va_blksize = DEV_BSIZE;
+ vap->va_uid = lxpnp->lxpr_uid;
+ vap->va_gid = lxpnp->lxpr_gid;
+ vap->va_nodeid = lxpnp->lxpr_ino;
+
+ switch (type) {
+ case LXPR_PROCDIR:
+ vap->va_nlink = nproc + 2 + PROCDIRFILES;
+ vap->va_size = (nproc + 2 + PROCDIRFILES) * LXPR_SDSIZE;
+ break;
+ case LXPR_PIDDIR:
+ vap->va_nlink = PIDDIRFILES;
+ vap->va_size = PIDDIRFILES * LXPR_SDSIZE;
+ break;
+ case LXPR_SELF:
+ vap->va_uid = crgetruid(curproc->p_cred);
+ vap->va_gid = crgetrgid(curproc->p_cred);
+ break;
+ default:
+ break;
+ }
+
+ vap->va_nblocks = (fsblkcnt64_t)btod(vap->va_size);
+ return (0);
+}
+
+/*
+ * lxpr_access(): Vnode operation for VOP_ACCESS()
+ */
+static int
+lxpr_access(vnode_t *vp, int mode, int flags, cred_t *cr, caller_context_t *ct)
+{
+ lxpr_node_t *lxpnp = VTOLXP(vp);
+ int shift = 0;
+ proc_t *tp;
+
+ /* lx /proc is a read only file system */
+ if (mode & VWRITE)
+ return (EROFS);
+
+ /*
+ * If this is a restricted file, check access permissions.
+ */
+ switch (lxpnp->lxpr_type) {
+ case LXPR_PIDDIR:
+ return (0);
+ case LXPR_PID_CURDIR:
+ case LXPR_PID_ENV:
+ case LXPR_PID_EXE:
+ case LXPR_PID_MAPS:
+ case LXPR_PID_MEM:
+ case LXPR_PID_ROOTDIR:
+ case LXPR_PID_FDDIR:
+ case LXPR_PID_FD_FD:
+ if ((tp = lxpr_lock(lxpnp->lxpr_pid)) == NULL)
+ return (ENOENT);
+ if (tp != curproc && secpolicy_proc_access(cr) != 0 &&
+ priv_proc_cred_perm(cr, tp, NULL, mode) != 0) {
+ lxpr_unlock(tp);
+ return (EACCES);
+ }
+ lxpr_unlock(tp);
+ default:
+ break;
+ }
+
+ if (lxpnp->lxpr_realvp != NULL) {
+ /*
+ * For these we use the underlying vnode's accessibility.
+ */
+ return (VOP_ACCESS(lxpnp->lxpr_realvp, mode, flags, cr, ct));
+ }
+
+ /* If user is root allow access regardless of permission bits */
+ if (secpolicy_proc_access(cr) == 0)
+ return (0);
+
+ /*
+ * Access check is based on only one of owner, group, public. If not
+ * owner, then check group. If not a member of the group, then check
+ * public access.
+ */
+ if (crgetuid(cr) != lxpnp->lxpr_uid) {
+ shift += 3;
+ if (!groupmember((uid_t)lxpnp->lxpr_gid, cr))
+ shift += 3;
+ }
+
+ mode &= ~(lxpnp->lxpr_mode << shift);
+
+ if (mode == 0)
+ return (0);
+
+ return (EACCES);
+}
+
+/* ARGSUSED */
+static vnode_t *
+lxpr_lookup_not_a_dir(vnode_t *dp, char *comp)
+{
+ return (NULL);
+}
+
+/*
+ * lxpr_lookup(): Vnode operation for VOP_LOOKUP()
+ */
+/* ARGSUSED */
+static int
+lxpr_lookup(vnode_t *dp, char *comp, vnode_t **vpp, pathname_t *pathp,
+ int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct,
+ int *direntflags, pathname_t *realpnp)
+{
+ lxpr_node_t *lxpnp = VTOLXP(dp);
+ lxpr_nodetype_t type = lxpnp->lxpr_type;
+ int error;
+
+ ASSERT(dp->v_type == VDIR);
+ ASSERT(type < LXPR_NFILES);
+
+ /*
+ * we should never get here because the lookup
+ * is done on the realvp for these nodes
+ */
+ ASSERT(type != LXPR_PID_FD_FD &&
+ type != LXPR_PID_CURDIR &&
+ type != LXPR_PID_ROOTDIR);
+
+ /*
+ * restrict lookup permission to owner or root
+ */
+ if ((error = lxpr_access(dp, VEXEC, 0, cr, ct)) != 0) {
+ return (error);
+ }
+
+ /*
+ * Just return the parent vnode if that's where we are trying to go.
+ */
+ if (strcmp(comp, "..") == 0) {
+ VN_HOLD(lxpnp->lxpr_parent);
+ *vpp = lxpnp->lxpr_parent;
+ return (0);
+ }
+
+ /*
+ * Special handling for directory searches. Note: null component name
+ * denotes that the current directory is being searched.
+ */
+ if ((dp->v_type == VDIR) && (*comp == '\0' || strcmp(comp, ".") == 0)) {
+ VN_HOLD(dp);
+ *vpp = dp;
+ return (0);
+ }
+
+ *vpp = (lxpr_lookup_function[type](dp, comp));
+ return ((*vpp == NULL) ? ENOENT : 0);
+}
+
+/*
+ * Do a sequential search on the given directory table
+ */
+static vnode_t *
+lxpr_lookup_common(vnode_t *dp, char *comp, proc_t *p,
+ lxpr_dirent_t *dirtab, int dirtablen)
+{
+ lxpr_node_t *lxpnp;
+ int count;
+
+ for (count = 0; count < dirtablen; count++) {
+ if (strcmp(dirtab[count].d_name, comp) == 0) {
+ lxpnp = lxpr_getnode(dp, dirtab[count].d_type, p, 0);
+ dp = LXPTOV(lxpnp);
+ ASSERT(dp != NULL);
+ return (dp);
+ }
+ }
+ return (NULL);
+}
+
+static vnode_t *
+lxpr_lookup_piddir(vnode_t *dp, char *comp)
+{
+ proc_t *p;
+
+ ASSERT(VTOLXP(dp)->lxpr_type == LXPR_PIDDIR);
+
+ p = lxpr_lock(VTOLXP(dp)->lxpr_pid);
+ if (p == NULL)
+ return (NULL);
+
+ dp = lxpr_lookup_common(dp, comp, p, piddir, PIDDIRFILES);
+
+ lxpr_unlock(p);
+
+ return (dp);
+}
+
+/*
+ * Lookup one of the process's open files.
+ */
+static vnode_t *
+lxpr_lookup_fddir(vnode_t *dp, char *comp)
+{
+ lxpr_node_t *dlxpnp = VTOLXP(dp);
+ lxpr_node_t *lxpnp;
+ vnode_t *vp = NULL;
+ proc_t *p;
+ file_t *fp;
+ uint_t fd;
+ int c;
+ uf_entry_t *ufp;
+ uf_info_t *fip;
+
+ ASSERT(dlxpnp->lxpr_type == LXPR_PID_FDDIR);
+
+ /*
+ * convert the string rendition of the filename
+ * to a file descriptor
+ */
+ fd = 0;
+ while ((c = *comp++) != '\0') {
+ int ofd;
+ if (c < '0' || c > '9')
+ return (NULL);
+
+ ofd = fd;
+ fd = 10*fd + c - '0';
+ /* integer overflow */
+ if (fd / 10 != ofd)
+ return (NULL);
+ }
+
+ /*
+ * get the proc to work with and lock it
+ */
+ p = lxpr_lock(dlxpnp->lxpr_pid);
+ if ((p == NULL))
+ return (NULL);
+
+ /*
+ * If the process is a zombie or system process
+ * it can't have any open files.
+ */
+ if ((p->p_stat == SZOMB) || (p->p_flag & SSYS) || (p->p_as == &kas)) {
+ lxpr_unlock(p);
+ return (NULL);
+ }
+
+ /*
+ * get us a fresh node/vnode
+ */
+ lxpnp = lxpr_getnode(dp, LXPR_PID_FD_FD, p, fd);
+
+ /*
+ * Drop p_lock, but keep the process P_PR_LOCK'd to prevent it from
+ * going away while we dereference into fi_list.
+ */
+ mutex_exit(&p->p_lock);
+
+ /*
+ * get open file info
+ */
+ fip = (&(p)->p_user.u_finfo);
+ mutex_enter(&fip->fi_lock);
+
+ if (fd < fip->fi_nfiles) {
+ UF_ENTER(ufp, fip, fd);
+ /*
+ * ensure the fd is still kosher.
+ * it may have gone between the readdir and
+ * the lookup
+ */
+ if (fip->fi_list[fd].uf_file == NULL) {
+ mutex_exit(&fip->fi_lock);
+ UF_EXIT(ufp);
+ mutex_enter(&p->p_lock);
+ lxpr_unlock(p);
+ lxpr_freenode(lxpnp);
+ return (NULL);
+ }
+
+ if ((fp = ufp->uf_file) != NULL)
+ vp = fp->f_vnode;
+ UF_EXIT(ufp);
+ }
+ mutex_exit(&fip->fi_lock);
+
+ if (vp == NULL) {
+ mutex_enter(&p->p_lock);
+ lxpr_unlock(p);
+ lxpr_freenode(lxpnp);
+ return (NULL);
+ } else {
+ /*
+ * Fill in the lxpr_node so future references will be able to
+ * find the underlying vnode. The vnode is held on the realvp.
+ */
+ lxpnp->lxpr_realvp = vp;
+ VN_HOLD(lxpnp->lxpr_realvp);
+ }
+
+ mutex_enter(&p->p_lock);
+ lxpr_unlock(p);
+ dp = LXPTOV(lxpnp);
+ ASSERT(dp != NULL);
+
+ return (dp);
+}
+
+static vnode_t *
+lxpr_lookup_netdir(vnode_t *dp, char *comp)
+{
+ ASSERT(VTOLXP(dp)->lxpr_type == LXPR_NETDIR);
+
+ dp = lxpr_lookup_common(dp, comp, NULL, netdir, NETDIRFILES);
+
+ return (dp);
+}
+
+static vnode_t *
+lxpr_lookup_procdir(vnode_t *dp, char *comp)
+{
+ ASSERT(VTOLXP(dp)->lxpr_type == LXPR_PROCDIR);
+
+ /*
+ * We know all the names of files & dirs in our file system structure
+ * except those that are pid names. These change as pids are created/
+ * deleted etc., so we just look for a number as the first char to see
+ * if we are we doing pid lookups.
+ *
+ * Don't need to check for "self" as it is implemented as a symlink
+ */
+ if (*comp >= '0' && *comp <= '9') {
+ pid_t pid = 0;
+ lxpr_node_t *lxpnp = NULL;
+ proc_t *p;
+ int c;
+
+ while ((c = *comp++) != '\0')
+ pid = 10 * pid + c - '0';
+
+ /*
+ * Can't continue if the process is still loading or it doesn't
+ * really exist yet (or maybe it just died!)
+ */
+ p = lxpr_lock(pid);
+ if (p == NULL)
+ return (NULL);
+
+ if (secpolicy_basic_procinfo(CRED(), p, curproc) != 0) {
+ lxpr_unlock(p);
+ return (NULL);
+ }
+
+ /*
+ * allocate and fill in a new lxpr node
+ */
+ lxpnp = lxpr_getnode(dp, LXPR_PIDDIR, p, 0);
+
+ lxpr_unlock(p);
+
+ dp = LXPTOV(lxpnp);
+ ASSERT(dp != NULL);
+
+ return (dp);
+ }
+
+ /* Lookup fixed names */
+ return (lxpr_lookup_common(dp, comp, NULL, lxpr_dir, PROCDIRFILES));
+}
+
+/*
+ * lxpr_readdir(): Vnode operation for VOP_READDIR()
+ */
+/* ARGSUSED */
+static int
+lxpr_readdir(vnode_t *dp, uio_t *uiop, cred_t *cr, int *eofp,
+ caller_context_t *ct, int flags)
+{
+ lxpr_node_t *lxpnp = VTOLXP(dp);
+ lxpr_nodetype_t type = lxpnp->lxpr_type;
+ ssize_t uresid;
+ off_t uoffset;
+ int error;
+
+ ASSERT(dp->v_type == VDIR);
+ ASSERT(type < LXPR_NFILES);
+
+ /*
+ * we should never get here because the readdir
+ * is done on the realvp for these nodes
+ */
+ ASSERT(type != LXPR_PID_FD_FD &&
+ type != LXPR_PID_CURDIR &&
+ type != LXPR_PID_ROOTDIR);
+
+ /*
+ * restrict readdir permission to owner or root
+ */
+ if ((error = lxpr_access(dp, VREAD, 0, cr, ct)) != 0)
+ return (error);
+
+ uoffset = uiop->uio_offset;
+ uresid = uiop->uio_resid;
+
+ /* can't do negative reads */
+ if (uoffset < 0 || uresid <= 0)
+ return (EINVAL);
+
+ /* can't read directory entries that don't exist! */
+ if (uoffset % LXPR_SDSIZE)
+ return (ENOENT);
+
+ return (lxpr_readdir_function[lxpnp->lxpr_type](lxpnp, uiop, eofp));
+}
+
+/* ARGSUSED */
+static int
+lxpr_readdir_not_a_dir(lxpr_node_t *lxpnp, uio_t *uiop, int *eofp)
+{
+ return (ENOTDIR);
+}
+
+/*
+ * This has the common logic for returning directory entries
+ */
+static int
+lxpr_readdir_common(lxpr_node_t *lxpnp, uio_t *uiop, int *eofp,
+ lxpr_dirent_t *dirtab, int dirtablen)
+{
+ /* bp holds one dirent64 structure */
+ longlong_t bp[DIRENT64_RECLEN(LXPNSIZ) / sizeof (longlong_t)];
+ dirent64_t *dirent = (dirent64_t *)bp;
+ ssize_t oresid; /* save a copy for testing later */
+ ssize_t uresid;
+
+ oresid = uiop->uio_resid;
+
+ /* clear out the dirent buffer */
+ bzero(bp, sizeof (bp));
+
+ /*
+ * Satisfy user request
+ */
+ while ((uresid = uiop->uio_resid) > 0) {
+ int dirindex;
+ off_t uoffset;
+ int reclen;
+ int error;
+
+ uoffset = uiop->uio_offset;
+ dirindex = (uoffset / LXPR_SDSIZE) - 2;
+
+ if (uoffset == 0) {
+
+ dirent->d_ino = lxpnp->lxpr_ino;
+ dirent->d_name[0] = '.';
+ dirent->d_name[1] = '\0';
+ reclen = DIRENT64_RECLEN(1);
+
+ } else if (uoffset == LXPR_SDSIZE) {
+
+ dirent->d_ino = lxpr_parentinode(lxpnp);
+ dirent->d_name[0] = '.';
+ dirent->d_name[1] = '.';
+ dirent->d_name[2] = '\0';
+ reclen = DIRENT64_RECLEN(2);
+
+ } else if (dirindex < dirtablen) {
+ int slen = strlen(dirtab[dirindex].d_name);
+
+ dirent->d_ino = lxpr_inode(dirtab[dirindex].d_type,
+ lxpnp->lxpr_pid, 0);
+
+ ASSERT(slen < LXPNSIZ);
+ (void) strcpy(dirent->d_name, dirtab[dirindex].d_name);
+ reclen = DIRENT64_RECLEN(slen);
+
+ } else {
+ /* Run out of table entries */
+ if (eofp) {
+ *eofp = 1;
+ }
+ return (0);
+ }
+
+ dirent->d_off = (off64_t)(uoffset + LXPR_SDSIZE);
+ dirent->d_reclen = (ushort_t)reclen;
+
+ /*
+ * if the size of the data to transfer is greater
+ * that that requested then we can't do it this transfer.
+ */
+ if (reclen > uresid) {
+ /*
+ * Error if no entries have been returned yet.
+ */
+ if (uresid == oresid) {
+ return (EINVAL);
+ }
+ break;
+ }
+
+ /*
+ * uiomove() updates both uiop->uio_resid and uiop->uio_offset
+ * by the same amount. But we want uiop->uio_offset to change
+ * in increments of LXPR_SDSIZE, which is different from the
+ * number of bytes being returned to the user. So we set
+ * uiop->uio_offset separately, ignoring what uiomove() does.
+ */
+ if ((error = uiomove((caddr_t)dirent, reclen, UIO_READ,
+ uiop)) != 0)
+ return (error);
+
+ uiop->uio_offset = uoffset + LXPR_SDSIZE;
+ }
+
+ /* Have run out of space, but could have just done last table entry */
+ if (eofp) {
+ *eofp =
+ (uiop->uio_offset >= ((dirtablen+2) * LXPR_SDSIZE)) ? 1 : 0;
+ }
+ return (0);
+}
+
+
+static int
+lxpr_readdir_procdir(lxpr_node_t *lxpnp, uio_t *uiop, int *eofp)
+{
+ /* bp holds one dirent64 structure */
+ longlong_t bp[DIRENT64_RECLEN(LXPNSIZ) / sizeof (longlong_t)];
+ dirent64_t *dirent = (dirent64_t *)bp;
+ ssize_t oresid; /* save a copy for testing later */
+ ssize_t uresid;
+ off_t uoffset;
+ zoneid_t zoneid;
+ pid_t pid;
+ int error;
+ int ceof;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PROCDIR);
+
+ oresid = uiop->uio_resid;
+ zoneid = LXPTOZ(lxpnp)->zone_id;
+
+ /*
+ * We return directory entries in the order: "." and ".." then the
+ * unique lxproc files, then the directories corresponding to the
+ * running processes. We have defined this as the ordering because
+ * it allows us to more easily keep track of where we are betwen calls
+ * to getdents(). If the number of processes changes between calls
+ * then we can't lose track of where we are in the lxproc files.
+ */
+
+ /* Do the fixed entries */
+ error = lxpr_readdir_common(lxpnp, uiop, &ceof, lxpr_dir,
+ PROCDIRFILES);
+
+ /* Finished if we got an error or if we couldn't do all the table */
+ if (error != 0 || ceof == 0)
+ return (error);
+
+ /* clear out the dirent buffer */
+ bzero(bp, sizeof (bp));
+
+ /* Do the process entries */
+ while ((uresid = uiop->uio_resid) > 0) {
+ proc_t *p;
+ int len;
+ int reclen;
+ int i;
+
+ uoffset = uiop->uio_offset;
+
+ /*
+ * Stop when entire proc table has been examined.
+ */
+ i = (uoffset / LXPR_SDSIZE) - 2 - PROCDIRFILES;
+ if (i >= v.v_proc) {
+ /* Run out of table entries */
+ if (eofp) {
+ *eofp = 1;
+ }
+ return (0);
+ }
+ mutex_enter(&pidlock);
+
+ /*
+ * Skip indices for which there is no pid_entry, PIDs for
+ * which there is no corresponding process, a PID of 0,
+ * and anything the security policy doesn't allow
+ * us to look at.
+ */
+ if ((p = pid_entry(i)) == NULL || p->p_stat == SIDL ||
+ p->p_pid == 0 ||
+ secpolicy_basic_procinfo(CRED(), p, curproc) != 0) {
+ mutex_exit(&pidlock);
+ goto next;
+ }
+ mutex_exit(&pidlock);
+
+ /*
+ * Convert pid to the Linux default of 1 if we're the zone's
+ * init process, otherwise use the value from the proc
+ * structure
+ */
+ pid = ((p->p_pid != curproc->p_zone->zone_proc_initpid) ?
+ p->p_pid : 1);
+
+ /*
+ * If this /proc was mounted in the global zone, view
+ * all procs; otherwise, only view zone member procs.
+ */
+ if (zoneid != GLOBAL_ZONEID && p->p_zone->zone_id != zoneid) {
+ goto next;
+ }
+
+ ASSERT(p->p_stat != 0);
+
+ dirent->d_ino = lxpr_inode(LXPR_PIDDIR, pid, 0);
+ len = snprintf(dirent->d_name, LXPNSIZ, "%d", pid);
+ ASSERT(len < LXPNSIZ);
+ reclen = DIRENT64_RECLEN(len);
+
+ dirent->d_off = (off64_t)(uoffset + LXPR_SDSIZE);
+ dirent->d_reclen = (ushort_t)reclen;
+
+ /*
+ * if the size of the data to transfer is greater
+ * that that requested then we can't do it this transfer.
+ */
+ if (reclen > uresid) {
+ /*
+ * Error if no entries have been returned yet.
+ */
+ if (uresid == oresid)
+ return (EINVAL);
+ break;
+ }
+
+ /*
+ * uiomove() updates both uiop->uio_resid and uiop->uio_offset
+ * by the same amount. But we want uiop->uio_offset to change
+ * in increments of LXPR_SDSIZE, which is different from the
+ * number of bytes being returned to the user. So we set
+ * uiop->uio_offset separately, in the increment of this for
+ * the loop, ignoring what uiomove() does.
+ */
+ if ((error = uiomove((caddr_t)dirent, reclen, UIO_READ,
+ uiop)) != 0)
+ return (error);
+next:
+ uiop->uio_offset = uoffset + LXPR_SDSIZE;
+ }
+
+ if (eofp != NULL) {
+ *eofp = (uiop->uio_offset >=
+ ((v.v_proc + PROCDIRFILES + 2) * LXPR_SDSIZE)) ? 1 : 0;
+ }
+
+ return (0);
+}
+
+static int
+lxpr_readdir_piddir(lxpr_node_t *lxpnp, uio_t *uiop, int *eofp)
+{
+ proc_t *p;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PIDDIR);
+
+ /* can't read its contents if it died */
+ mutex_enter(&pidlock);
+
+ p = prfind((lxpnp->lxpr_pid == 1) ?
+ curproc->p_zone->zone_proc_initpid : lxpnp->lxpr_pid);
+
+ if (p == NULL || p->p_stat == SIDL) {
+ mutex_exit(&pidlock);
+ return (ENOENT);
+ }
+ mutex_exit(&pidlock);
+
+ return (lxpr_readdir_common(lxpnp, uiop, eofp, piddir, PIDDIRFILES));
+}
+
+static int
+lxpr_readdir_netdir(lxpr_node_t *lxpnp, uio_t *uiop, int *eofp)
+{
+ ASSERT(lxpnp->lxpr_type == LXPR_NETDIR);
+ return (lxpr_readdir_common(lxpnp, uiop, eofp, netdir, NETDIRFILES));
+}
+
+static int
+lxpr_readdir_fddir(lxpr_node_t *lxpnp, uio_t *uiop, int *eofp)
+{
+ /* bp holds one dirent64 structure */
+ longlong_t bp[DIRENT64_RECLEN(LXPNSIZ) / sizeof (longlong_t)];
+ dirent64_t *dirent = (dirent64_t *)bp;
+ ssize_t oresid; /* save a copy for testing later */
+ ssize_t uresid;
+ off_t uoffset;
+ int error;
+ int ceof;
+ proc_t *p;
+ int fddirsize = -1;
+ uf_info_t *fip;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PID_FDDIR);
+
+ oresid = uiop->uio_resid;
+
+ /* can't read its contents if it died */
+ p = lxpr_lock(lxpnp->lxpr_pid);
+ if (p == NULL)
+ return (ENOENT);
+
+ if ((p->p_stat == SZOMB) || (p->p_flag & SSYS) || (p->p_as == &kas))
+ fddirsize = 0;
+
+ /*
+ * Drop p_lock, but keep the process P_PR_LOCK'd to prevent it from
+ * going away while we iterate over its fi_list.
+ */
+ mutex_exit(&p->p_lock);
+
+ /* Get open file info */
+ fip = (&(p)->p_user.u_finfo);
+ mutex_enter(&fip->fi_lock);
+
+ if (fddirsize == -1)
+ fddirsize = fip->fi_nfiles;
+
+ /* Do the fixed entries (in this case just "." & "..") */
+ error = lxpr_readdir_common(lxpnp, uiop, &ceof, 0, 0);
+
+ /* Finished if we got an error or if we couldn't do all the table */
+ if (error != 0 || ceof == 0)
+ goto out;
+
+ /* clear out the dirent buffer */
+ bzero(bp, sizeof (bp));
+
+ /*
+ * Loop until user's request is satisfied or until
+ * all file descriptors have been examined.
+ */
+ for (; (uresid = uiop->uio_resid) > 0;
+ uiop->uio_offset = uoffset + LXPR_SDSIZE) {
+ int reclen;
+ int fd;
+ int len;
+
+ uoffset = uiop->uio_offset;
+
+ /*
+ * Stop at the end of the fd list
+ */
+ fd = (uoffset / LXPR_SDSIZE) - 2;
+ if (fd >= fddirsize) {
+ if (eofp) {
+ *eofp = 1;
+ }
+ goto out;
+ }
+
+ if (fip->fi_list[fd].uf_file == NULL)
+ continue;
+
+ dirent->d_ino = lxpr_inode(LXPR_PID_FD_FD, lxpnp->lxpr_pid, fd);
+ len = snprintf(dirent->d_name, LXPNSIZ, "%d", fd);
+ ASSERT(len < LXPNSIZ);
+ reclen = DIRENT64_RECLEN(len);
+
+ dirent->d_off = (off64_t)(uoffset + LXPR_SDSIZE);
+ dirent->d_reclen = (ushort_t)reclen;
+
+ if (reclen > uresid) {
+ /*
+ * Error if no entries have been returned yet.
+ */
+ if (uresid == oresid)
+ error = EINVAL;
+ goto out;
+ }
+
+ if ((error = uiomove((caddr_t)dirent, reclen, UIO_READ,
+ uiop)) != 0)
+ goto out;
+ }
+
+ if (eofp != NULL) {
+ *eofp =
+ (uiop->uio_offset >= ((fddirsize+2) * LXPR_SDSIZE)) ? 1 : 0;
+ }
+
+out:
+ mutex_exit(&fip->fi_lock);
+ mutex_enter(&p->p_lock);
+ lxpr_unlock(p);
+ return (error);
+}
+
+
+/*
+ * lxpr_readlink(): Vnode operation for VOP_READLINK()
+ */
+/* ARGSUSED */
+static int
+lxpr_readlink(vnode_t *vp, uio_t *uiop, cred_t *cr, caller_context_t *ct)
+{
+ char bp[MAXPATHLEN + 1];
+ size_t buflen = sizeof (bp);
+ lxpr_node_t *lxpnp = VTOLXP(vp);
+ vnode_t *rvp = lxpnp->lxpr_realvp;
+ pid_t pid;
+ int error = 0;
+
+ /* must be a symbolic link file */
+ if (vp->v_type != VLNK)
+ return (EINVAL);
+
+ /* Try to produce a symlink name for anything that has a realvp */
+ if (rvp != NULL) {
+ if ((error = lxpr_access(vp, VREAD, 0, CRED(), ct)) != 0)
+ return (error);
+ if ((error = vnodetopath(NULL, rvp, bp, buflen, CRED())) != 0)
+ return (error);
+ } else {
+ switch (lxpnp->lxpr_type) {
+ case LXPR_SELF:
+ /*
+ * Convert pid to the Linux default of 1 if we're the
+ * zone's init process
+ */
+ pid = ((curproc->p_pid !=
+ curproc->p_zone->zone_proc_initpid)
+ ? curproc->p_pid : 1);
+
+ /*
+ * Don't need to check result as every possible int
+ * will fit within MAXPATHLEN bytes.
+ */
+ (void) snprintf(bp, buflen, "%d", pid);
+ break;
+ case LXPR_PID_CURDIR:
+ case LXPR_PID_ROOTDIR:
+ case LXPR_PID_EXE:
+ return (EACCES);
+ default:
+ /*
+ * Need to return error so that nothing thinks
+ * that the symlink is empty and hence "."
+ */
+ return (EINVAL);
+ }
+ }
+
+ /* copy the link data to user space */
+ return (uiomove(bp, strlen(bp), UIO_READ, uiop));
+}
+
+/*
+ * lxpr_inactive(): Vnode operation for VOP_INACTIVE()
+ * Vnode is no longer referenced, deallocate the file
+ * and all its resources.
+ */
+/* ARGSUSED */
+static void
+lxpr_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct)
+{
+ lxpr_freenode(VTOLXP(vp));
+}
+
+/*
+ * lxpr_sync(): Vnode operation for VOP_SYNC()
+ */
+static int
+lxpr_sync()
+{
+ /*
+ * Nothing to sync but this function must never fail
+ */
+ return (0);
+}
+
+/*
+ * lxpr_cmp(): Vnode operation for VOP_CMP()
+ */
+static int
+lxpr_cmp(vnode_t *vp1, vnode_t *vp2, caller_context_t *ct)
+{
+ vnode_t *rvp;
+
+ while (vn_matchops(vp1, lxpr_vnodeops) &&
+ (rvp = VTOLXP(vp1)->lxpr_realvp) != NULL) {
+ vp1 = rvp;
+ }
+
+ while (vn_matchops(vp2, lxpr_vnodeops) &&
+ (rvp = VTOLXP(vp2)->lxpr_realvp) != NULL) {
+ vp2 = rvp;
+ }
+
+ if (vn_matchops(vp1, lxpr_vnodeops) || vn_matchops(vp2, lxpr_vnodeops))
+ return (vp1 == vp2);
+
+ return (VOP_CMP(vp1, vp2, ct));
+}
+
+/*
+ * lxpr_realvp(): Vnode operation for VOP_REALVP()
+ */
+static int
+lxpr_realvp(vnode_t *vp, vnode_t **vpp, caller_context_t *ct)
+{
+ vnode_t *rvp;
+
+ if ((rvp = VTOLXP(vp)->lxpr_realvp) != NULL) {
+ vp = rvp;
+ if (VOP_REALVP(vp, &rvp, ct) == 0)
+ vp = rvp;
+ }
+
+ *vpp = vp;
+ return (0);
+}
diff --git a/usr/src/uts/common/fs/lxproc/lxproc.h b/usr/src/uts/common/fs/lxproc/lxproc.h
new file mode 100644
index 0000000000..a06bef1570
--- /dev/null
+++ b/usr/src/uts/common/fs/lxproc/lxproc.h
@@ -0,0 +1,275 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+#ifndef _LXPROC_H
+#define _LXPROC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * lxproc.h: declarations, data structures and macros for lxprocfs
+ */
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/policy.h>
+#include <sys/debug.h>
+#include <sys/dirent.h>
+#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/kmem.h>
+#include <sys/pathname.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/var.h>
+#include <sys/user.h>
+#include <sys/t_lock.h>
+#include <sys/sysmacros.h>
+#include <sys/cred.h>
+#include <sys/priv.h>
+#include <sys/vnode.h>
+#include <sys/vfs.h>
+#include <sys/statvfs.h>
+#include <sys/cmn_err.h>
+#include <sys/zone.h>
+#include <sys/uio.h>
+#include <sys/utsname.h>
+#include <sys/dnlc.h>
+#include <sys/atomic.h>
+#include <sys/sunddi.h>
+#include <sys/sunldi.h>
+#include <vm/as.h>
+#include <vm/anon.h>
+
+#define LX_SIGHUP 1
+#define LX_SIGINT 2
+#define LX_SIGQUIT 3
+#define LX_SIGILL 4
+#define LX_SIGTRAP 5
+#define LX_SIGABRT 6
+#define LX_SIGIOT 6
+#define LX_SIGBUS 7
+#define LX_SIGFPE 8
+#define LX_SIGKILL 9
+#define LX_SIGUSR1 10
+#define LX_SIGSEGV 11
+#define LX_SIGUSR2 12
+#define LX_SIGPIPE 13
+#define LX_SIGALRM 14
+#define LX_SIGTERM 15
+#define LX_SIGSTKFLT 16
+#define LX_SIGCHLD 17
+#define LX_SIGCONT 18
+#define LX_SIGSTOP 19
+#define LX_SIGTSTP 20
+#define LX_SIGTTIN 21
+#define LX_SIGTTOU 22
+#define LX_SIGURG 23
+#define LX_SIGXCPU 24
+#define LX_SIGXFSZ 25
+#define LX_SIGVTALRM 26
+#define LX_SIGPROF 27
+#define LX_SIGWINCH 28
+#define LX_SIGIO 29
+#define LX_SIGPOLL LX_SIGIO
+#define LX_SIGPWR 30
+#define LX_SIGSYS 31
+#define LX_SIGUNUSED 31
+
+#define LX_NSIG_WORDS 2
+#define LX_NBPW 32
+#define LX_NSIG ((LX_NBPW * LX_NSIG_WORDS) + 1)
+
+#define LX_SIGRTMIN 32
+#define LX_SIGRTMAX LX_NSIG - 1
+
+/*
+ * Convert a vnode into an lxpr_mnt_t
+ */
+#define VTOLXPM(vp) ((lxpr_mnt_t *)(vp)->v_vfsp->vfs_data)
+
+/*
+ * convert a vnode into an lxpr_node
+ */
+#define VTOLXP(vp) ((lxpr_node_t *)(vp)->v_data)
+
+/*
+ * convert a lxprnode into a vnode
+ */
+#define LXPTOV(lxpnp) ((lxpnp)->lxpr_vnode)
+
+/*
+ * convert a lxpr_node into zone for fs
+ */
+#define LXPTOZ(lxpnp) \
+ (((lxpr_mnt_t *)(lxpnp)->lxpr_vnode->v_vfsp->vfs_data)->lxprm_zone)
+
+#define LXPNSIZ 256 /* max size of lx /proc file name entries */
+
+/*
+ * Pretend that a directory entry takes 16 bytes
+ */
+#define LXPR_SDSIZE 16
+
+/*
+ * Node/file types for lx /proc files
+ * (directories and files contained therein).
+ */
+typedef enum lxpr_nodetype {
+ LXPR_PROCDIR, /* /proc */
+ LXPR_PIDDIR, /* /proc/<pid> */
+ LXPR_PID_CMDLINE, /* /proc/<pid>/cmdline */
+ LXPR_PID_CPU, /* /proc/<pid>/cpu */
+ LXPR_PID_CURDIR, /* /proc/<pid>/cwd */
+ LXPR_PID_ENV, /* /proc/<pid>/environ */
+ LXPR_PID_EXE, /* /proc/<pid>/exe */
+ LXPR_PID_MAPS, /* /proc/<pid>/maps */
+ LXPR_PID_MEM, /* /proc/<pid>/mem */
+ LXPR_PID_ROOTDIR, /* /proc/<pid>/root */
+ LXPR_PID_STAT, /* /proc/<pid>/stat */
+ LXPR_PID_STATM, /* /proc/<pid>/statm */
+ LXPR_PID_STATUS, /* /proc/<pid>/status */
+ LXPR_PID_FDDIR, /* /proc/<pid>/fd */
+ LXPR_PID_FD_FD, /* /proc/<pid>/fd/nn */
+ LXPR_CMDLINE, /* /proc/cmdline */
+ LXPR_CPUINFO, /* /proc/cpuinfo */
+ LXPR_DEVICES, /* /proc/devices */
+ LXPR_DMA, /* /proc/dma */
+ LXPR_FILESYSTEMS, /* /proc/filesystems */
+ LXPR_INTERRUPTS, /* /proc/interrupts */
+ LXPR_IOPORTS, /* /proc/ioports */
+ LXPR_KCORE, /* /proc/kcore */
+ LXPR_KMSG, /* /proc/kmsg */
+ LXPR_LOADAVG, /* /proc/loadavg */
+ LXPR_MEMINFO, /* /proc/meminfo */
+ LXPR_MOUNTS, /* /proc/mounts */
+ LXPR_NETDIR, /* /proc/net */
+ LXPR_NET_ARP, /* /proc/net/arp */
+ LXPR_NET_DEV, /* /proc/net/dev */
+ LXPR_NET_DEV_MCAST, /* /proc/net/dev_mcast */
+ LXPR_NET_IGMP, /* /proc/net/igmp */
+ LXPR_NET_IP_MR_CACHE, /* /proc/net/ip_mr_cache */
+ LXPR_NET_IP_MR_VIF, /* /proc/net/ip_mr_vif */
+ LXPR_NET_MCFILTER, /* /proc/net/mcfilter */
+ LXPR_NET_NETSTAT, /* /proc/net/netstat */
+ LXPR_NET_RAW, /* /proc/net/raw */
+ LXPR_NET_ROUTE, /* /proc/net/route */
+ LXPR_NET_RPC, /* /proc/net/rpc */
+ LXPR_NET_RT_CACHE, /* /proc/net/rt_cache */
+ LXPR_NET_SOCKSTAT, /* /proc/net/sockstat */
+ LXPR_NET_SNMP, /* /proc/net/snmp */
+ LXPR_NET_STAT, /* /proc/net/stat */
+ LXPR_NET_TCP, /* /proc/net/tcp */
+ LXPR_NET_UDP, /* /proc/net/udp */
+ LXPR_NET_UNIX, /* /proc/net/unix */
+ LXPR_PARTITIONS, /* /proc/partitions */
+ LXPR_SELF, /* /proc/self */
+ LXPR_STAT, /* /proc/stat */
+ LXPR_UPTIME, /* /proc/uptime */
+ LXPR_VERSION, /* /proc/version */
+ LXPR_NFILES /* number of lx /proc file types */
+} lxpr_nodetype_t;
+
+/*
+ * Number of fds allowed for in the inode number calculation
+ * per process (if a process has more fds then inode numbers
+ * may be duplicated)
+ */
+#define LXPR_FD_PERPROC 2000
+
+/*
+ * external dirent characteristics
+ */
+#define LXPRMAXNAMELEN 14
+typedef struct {
+ lxpr_nodetype_t d_type;
+ char d_name[LXPRMAXNAMELEN];
+} lxpr_dirent_t;
+
+/*
+ * This is the lxprocfs private data object
+ * which is attached to v_data in the vnode structure
+ */
+typedef struct lxpr_node {
+ lxpr_nodetype_t lxpr_type; /* type of this node */
+ vnode_t *lxpr_vnode; /* vnode for the node */
+ vnode_t *lxpr_parent; /* parent directory */
+ vnode_t *lxpr_realvp; /* real vnode, file in dirs */
+ timestruc_t lxpr_time; /* creation etc time for file */
+ mode_t lxpr_mode; /* file mode bits */
+ uid_t lxpr_uid; /* file owner */
+ gid_t lxpr_gid; /* file group owner */
+ pid_t lxpr_pid; /* pid of proc referred to */
+ ino_t lxpr_ino; /* node id */
+ ldi_handle_t lxpr_cons_ldih; /* ldi handle for console device */
+} lxpr_node_t;
+
+struct zone; /* forward declaration */
+
+/*
+ * This is the lxprocfs private data object
+ * which is attached to vfs_data in the vfs structure
+ */
+typedef struct lxpr_mnt {
+ lxpr_node_t *lxprm_node; /* node at root of proc mount */
+ struct zone *lxprm_zone; /* zone for this mount */
+ ldi_ident_t lxprm_li; /* ident for ldi */
+} lxpr_mnt_t;
+
+extern vnodeops_t *lxpr_vnodeops;
+extern int nproc_highbit; /* highbit(v.v_nproc) */
+
+typedef struct mounta mounta_t;
+
+extern void lxpr_initnodecache();
+extern void lxpr_fininodecache();
+extern void lxpr_initrootnode(lxpr_node_t **, vfs_t *);
+extern ino_t lxpr_inode(lxpr_nodetype_t, pid_t, int);
+extern ino_t lxpr_parentinode(lxpr_node_t *);
+extern lxpr_node_t *lxpr_getnode(vnode_t *, lxpr_nodetype_t, proc_t *, int);
+extern void lxpr_freenode(lxpr_node_t *);
+
+typedef struct lxpr_uiobuf lxpr_uiobuf_t;
+extern lxpr_uiobuf_t *lxpr_uiobuf_new(uio_t *);
+extern void lxpr_uiobuf_free(lxpr_uiobuf_t *);
+extern int lxpr_uiobuf_flush(lxpr_uiobuf_t *);
+extern void lxpr_uiobuf_seek(lxpr_uiobuf_t *, offset_t);
+extern void lxpr_uiobuf_write(lxpr_uiobuf_t *, const char *, size_t);
+extern void lxpr_uiobuf_printf(lxpr_uiobuf_t *, const char *, ...);
+extern void lxpr_uiobuf_seterr(lxpr_uiobuf_t *, int);
+
+proc_t *lxpr_lock(pid_t);
+void lxpr_unlock(proc_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LXPROC_H */
diff --git a/usr/src/uts/common/fs/nfs/nfs3_vnops.c b/usr/src/uts/common/fs/nfs/nfs3_vnops.c
index d31b53d2e9..4e5882ad7c 100644
--- a/usr/src/uts/common/fs/nfs/nfs3_vnops.c
+++ b/usr/src/uts/common/fs/nfs/nfs3_vnops.c
@@ -28,6 +28,10 @@
* All rights reserved.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
@@ -2298,6 +2302,12 @@ top:
vattr.va_mask = AT_SIZE;
error = nfs3setattr(vp,
&vattr, 0, cr);
+
+ /*
+ * Existing file was truncated;
+ * emit a create event.
+ */
+ vnevent_create(vp, ct);
}
}
}
@@ -2306,12 +2316,9 @@ top:
if (error) {
VN_RELE(vp);
} else {
- /*
- * existing file got truncated, notify.
- */
- vnevent_create(vp, ct);
*vpp = vp;
}
+
return (error);
}
diff --git a/usr/src/uts/common/fs/nfs/nfs4_vnops.c b/usr/src/uts/common/fs/nfs/nfs4_vnops.c
index 5ae2c28d53..f05a0717d9 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_vnops.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_vnops.c
@@ -31,6 +31,10 @@
* All Rights Reserved
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
@@ -6653,16 +6657,20 @@ top:
} else {
vnode_t *tvp;
rnode4_t *trp;
- /*
- * existing file got truncated, notify.
- */
tvp = vp;
if (vp->v_type == VREG) {
trp = VTOR4(vp);
if (IS_SHADOW(vp, trp))
tvp = RTOV4(trp);
}
- vnevent_create(tvp, ct);
+
+ if (must_trunc) {
+ /*
+ * existing file got truncated, notify.
+ */
+ vnevent_create(tvp, ct);
+ }
+
*vpp = vp;
}
return (error);
diff --git a/usr/src/uts/common/fs/nfs/nfs_server.c b/usr/src/uts/common/fs/nfs/nfs_server.c
index ff0ebfe6d8..d5c5f18577 100644
--- a/usr/src/uts/common/fs/nfs/nfs_server.c
+++ b/usr/src/uts/common/fs/nfs/nfs_server.c
@@ -21,6 +21,8 @@
/*
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 Bayard G. Bell. All rights reserved.
+ * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -2520,6 +2522,9 @@ nfs_srvinit(void)
{
int error;
+ if (getzoneid() != GLOBAL_ZONEID)
+ return (EACCES);
+
error = nfs_exportinit();
if (error != 0)
return (error);
diff --git a/usr/src/uts/common/fs/nfs/nfs_vnops.c b/usr/src/uts/common/fs/nfs/nfs_vnops.c
index a3f43a4e95..fa31e3693f 100644
--- a/usr/src/uts/common/fs/nfs/nfs_vnops.c
+++ b/usr/src/uts/common/fs/nfs/nfs_vnops.c
@@ -25,6 +25,10 @@
* All rights reserved.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
@@ -2030,6 +2034,14 @@ nfs_create(vnode_t *dvp, char *nm, struct vattr *va, enum vcexcl exclusive,
vp->v_type == VREG) {
vattr.va_mask = AT_SIZE;
error = nfssetattr(vp, &vattr, 0, cr);
+
+ if (!error) {
+ /*
+ * Existing file was truncated;
+ * emit a create event.
+ */
+ vnevent_create(vp, ct);
+ }
}
}
}
@@ -2037,10 +2049,6 @@ nfs_create(vnode_t *dvp, char *nm, struct vattr *va, enum vcexcl exclusive,
if (error) {
VN_RELE(vp);
} else {
- /*
- * existing file got truncated, notify.
- */
- vnevent_create(vp, ct);
*vpp = vp;
}
return (error);
diff --git a/usr/src/uts/common/fs/portfs/port_fop.c b/usr/src/uts/common/fs/portfs/port_fop.c
index 2852a98f52..48792394a5 100644
--- a/usr/src/uts/common/fs/portfs/port_fop.c
+++ b/usr/src/uts/common/fs/portfs/port_fop.c
@@ -23,6 +23,9 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
/*
* File Events Notification
@@ -1965,7 +1968,9 @@ port_fop(vnode_t *vp, int op, int retval)
if (op & FOP_ATTRIB_MASK) {
event |= FILE_ATTRIB;
}
-
+ if (op & FOP_TRUNC_MASK) {
+ event |= FILE_TRUNC;
+ }
if (event) {
port_fop_sendevent(vp, event, NULL, NULL);
}
@@ -2147,6 +2152,9 @@ port_fop_setattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr,
int events = 0;
retval = vnext_setattr(vf, vap, flags, cr, ct);
+ if (vap->va_mask & AT_SIZE) {
+ events |= FOP_FILE_TRUNC;
+ }
if (vap->va_mask & (AT_SIZE|AT_MTIME)) {
events |= FOP_FILE_SETATTR_MTIME;
}
@@ -2322,8 +2330,8 @@ port_fop_vnevent(femarg_t *vf, vnevent_t vnevent, vnode_t *dvp, char *name,
port_fop_sendevent(vp, FILE_DELETE, dvp, name);
break;
case VE_CREATE:
- port_fop_sendevent(vp, FILE_MODIFIED|FILE_ATTRIB,
- NULL, NULL);
+ port_fop_sendevent(vp,
+ FILE_MODIFIED|FILE_ATTRIB|FILE_TRUNC, NULL, NULL);
break;
case VE_LINK:
port_fop_sendevent(vp, FILE_ATTRIB, NULL, NULL);
diff --git a/usr/src/uts/common/fs/proc/prcontrol.c b/usr/src/uts/common/fs/proc/prcontrol.c
index d907e7769d..a5679a8afb 100644
--- a/usr/src/uts/common/fs/proc/prcontrol.c
+++ b/usr/src/uts/common/fs/proc/prcontrol.c
@@ -939,7 +939,7 @@ pr_control32(int32_t cmd, arg32_t *argp, prnode_t *pnp, cred_t *cr)
case PCREAD: /* read from the address space */
case PCWRITE: /* write to the address space */
- if (PROCESS_NOT_32BIT(p))
+ if (PROCESS_NOT_32BIT(p) || (pnp->pr_flags & PR_OFFMAX))
error = EOVERFLOW;
else {
enum uio_rw rw = (cmd == PCREAD)? UIO_READ : UIO_WRITE;
@@ -2276,9 +2276,17 @@ pr_szoneid(proc_t *p, zoneid_t zoneid, cred_t *cr)
return (EPERM);
if (zoneid != GLOBAL_ZONEID && zoneid != p->p_zone->zone_id)
return (EINVAL);
- if ((zptr = zone_find_by_id(zoneid)) == NULL)
- return (EINVAL);
+ /*
+ * We cannot hold p_lock when we call zone_find_by_id since that can
+ * lead to a deadlock. zone_find_by_id() takes zonehash_lock.
+ * zone_enter() can hold the zonehash_lock and needs p_lock when it
+ * calls task_join.
+ */
mutex_exit(&p->p_lock);
+ if ((zptr = zone_find_by_id(zoneid)) == NULL) {
+ mutex_enter(&p->p_lock);
+ return (EINVAL);
+ }
mutex_enter(&p->p_crlock);
oldcred = p->p_cred;
crhold(oldcred);
diff --git a/usr/src/uts/common/fs/proc/prdata.h b/usr/src/uts/common/fs/proc/prdata.h
index 1f1b80d0ac..d3898ca9ea 100644
--- a/usr/src/uts/common/fs/proc/prdata.h
+++ b/usr/src/uts/common/fs/proc/prdata.h
@@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -185,6 +189,7 @@ typedef struct prnode {
#define PR_INVAL 0x01 /* vnode is invalidated */
#define PR_ISSELF 0x02 /* vnode is a self-open */
#define PR_AOUT 0x04 /* vnode is for an a.out path */
+#define PR_OFFMAX 0x08 /* vnode is a large file open */
/*
* Conversion macros.
diff --git a/usr/src/uts/common/fs/proc/prvnops.c b/usr/src/uts/common/fs/proc/prvnops.c
index 25382e43fc..c84b9d3726 100644
--- a/usr/src/uts/common/fs/proc/prvnops.c
+++ b/usr/src/uts/common/fs/proc/prvnops.c
@@ -340,6 +340,15 @@ propen(vnode_t **vpp, int flag, cred_t *cr, caller_context_t *ct)
}
/*
+ * If this is a large file open, indicate that in our flags -- some
+ * procfs structures are not off_t-neutral (e.g., priovec_t), and
+ * the open will need to be differentiated where 32-bit processes
+ * pass these structures across the user/kernel boundary.
+ */
+ if (flag & FOFFMAX)
+ pnp->pr_flags |= PR_OFFMAX;
+
+ /*
* Do file-specific things.
*/
switch (type) {
diff --git a/usr/src/uts/common/fs/swapfs/swap_subr.c b/usr/src/uts/common/fs/swapfs/swap_subr.c
index 74c4302da9..a4d983665b 100644
--- a/usr/src/uts/common/fs/swapfs/swap_subr.c
+++ b/usr/src/uts/common/fs/swapfs/swap_subr.c
@@ -110,9 +110,11 @@ swapfs_recalc(pgcnt_t pgs)
* memory that can be used as swap space should do so by
* setting swapfs_desfree at boot time, not swapfs_minfree.
* However, swapfs_minfree is tunable by install as a
- * workaround for bugid 1147463.
+ * workaround for bugid 1147463. Note swapfs_minfree is set
+ * to 1/8th of memory, but clamped at the limit of 256 MB.
*/
- new_swapfs_minfree = MAX(btopr(2 * 1024 * 1024), pgs >> 3);
+ new_swapfs_minfree = MIN(MAX(btopr(2 * 1024 * 1024), pgs >> 3),
+ btopr(256 * 1024 * 1024));
}
/*
diff --git a/usr/src/uts/common/fs/tmpfs/tmp_dir.c b/usr/src/uts/common/fs/tmpfs/tmp_dir.c
index f6621c8097..387cc6ae54 100644
--- a/usr/src/uts/common/fs/tmpfs/tmp_dir.c
+++ b/usr/src/uts/common/fs/tmpfs/tmp_dir.c
@@ -516,7 +516,7 @@ tdirdelete(
*/
namelen = strlen(tpdp->td_name) + 1;
- tmp_memfree(tpdp, sizeof (struct tdirent) + namelen);
+ kmem_free(tpdp, sizeof (struct tdirent) + namelen);
dir->tn_size -= (sizeof (struct tdirent) + namelen);
dir->tn_dirents--;
@@ -549,8 +549,8 @@ tdirinit(
ASSERT(RW_WRITE_HELD(&parent->tn_rwlock));
ASSERT(dir->tn_type == VDIR);
- dot = tmp_memalloc(sizeof (struct tdirent) + 2, TMP_MUSTHAVE);
- dotdot = tmp_memalloc(sizeof (struct tdirent) + 3, TMP_MUSTHAVE);
+ dot = kmem_zalloc(sizeof (struct tdirent) + 2, KM_SLEEP);
+ dotdot = kmem_zalloc(sizeof (struct tdirent) + 3, KM_SLEEP);
/*
* Initialize the entries
@@ -650,7 +650,7 @@ tdirtrunc(struct tmpnode *dir)
tmpfs_hash_out(tdp);
- tmp_memfree(tdp, sizeof (struct tdirent) + namelen);
+ kmem_free(tdp, sizeof (struct tdirent) + namelen);
dir->tn_size -= (sizeof (struct tdirent) + namelen);
dir->tn_dirents--;
}
@@ -925,7 +925,7 @@ tdiraddentry(
*/
namelen = strlen(name) + 1;
alloc_size = namelen + sizeof (struct tdirent);
- tdp = tmp_memalloc(alloc_size, 0);
+ tdp = kmem_zalloc(alloc_size, KM_NOSLEEP | KM_NORMALPRI);
if (tdp == NULL)
return (ENOSPC);
@@ -1025,7 +1025,7 @@ tdirmaketnode(
((va->va_mask & AT_MTIME) && TIMESPEC_OVERFLOW(&va->va_mtime)))
return (EOVERFLOW);
type = va->va_type;
- tp = tmp_memalloc(sizeof (struct tmpnode), TMP_MUSTHAVE);
+ tp = kmem_zalloc(sizeof (struct tmpnode), KM_SLEEP);
tmpnode_init(tm, tp, va, cred);
/* setup normal file/dir's extended attribute directory */
diff --git a/usr/src/uts/common/fs/tmpfs/tmp_subr.c b/usr/src/uts/common/fs/tmpfs/tmp_subr.c
index 2e59d28d80..bc768466cb 100644
--- a/usr/src/uts/common/fs/tmpfs/tmp_subr.c
+++ b/usr/src/uts/common/fs/tmpfs/tmp_subr.c
@@ -89,40 +89,6 @@ tmp_sticky_remove_access(struct tmpnode *dir, struct tmpnode *entry,
}
/*
- * Allocate zeroed memory if tmpfs_maxkmem has not been exceeded
- * or the 'musthave' flag is set. 'musthave' allocations should
- * always be subordinate to normal allocations so that tmpfs_maxkmem
- * can't be exceeded by more than a few KB. Example: when creating
- * a new directory, the tmpnode is a normal allocation; if that
- * succeeds, the dirents for "." and ".." are 'musthave' allocations.
- */
-void *
-tmp_memalloc(size_t size, int musthave)
-{
- static time_t last_warning;
- time_t now;
-
- if (atomic_add_long_nv(&tmp_kmemspace, size) < tmpfs_maxkmem ||
- musthave)
- return (kmem_zalloc(size, KM_SLEEP));
-
- atomic_add_long(&tmp_kmemspace, -size);
- now = gethrestime_sec();
- if (last_warning != now) {
- last_warning = now;
- cmn_err(CE_WARN, "tmp_memalloc: tmpfs over memory limit");
- }
- return (NULL);
-}
-
-void
-tmp_memfree(void *cp, size_t size)
-{
- kmem_free(cp, size);
- atomic_add_long(&tmp_kmemspace, -size);
-}
-
-/*
* Convert a string containing a number (number of bytes) to a pgcnt_t,
* containing the corresponding number of pages. On 32-bit kernels, the
* maximum value encoded in 'str' is PAGESIZE * ULONG_MAX, while the value
diff --git a/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c b/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c
index f8a36a528f..91d953f88a 100644
--- a/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c
+++ b/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -55,6 +56,15 @@
static int tmpfsfstype;
/*
+ * tmpfs_mountcount is used to prevent module unloads while there is still
+ * state from a former mount hanging around. With forced umount support, the
+ * filesystem module must not be allowed to go away before the last
+ * VFS_FREEVFS() call has been made. Since this is just an atomic counter,
+ * there's no need for locking.
+ */
+static uint32_t tmpfs_mountcount;
+
+/*
* tmpfs vfs operations.
*/
static int tmpfsinit(int, char *);
@@ -64,6 +74,7 @@ static int tmp_unmount(struct vfs *, int, struct cred *);
static int tmp_root(struct vfs *, struct vnode **);
static int tmp_statvfs(struct vfs *, struct statvfs64 *);
static int tmp_vget(struct vfs *, struct vnode **, struct fid *);
+static void tmp_freevfs(vfs_t *vfsp);
/*
* Loadable module wrapper
@@ -76,7 +87,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"tmpfs",
tmpfsinit,
- VSW_HASPROTO|VSW_STATS|VSW_ZMOUNT,
+ VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_ZMOUNT,
&tmpfs_proto_opttbl
};
@@ -121,6 +132,14 @@ _fini()
{
int error;
+ /*
+ * If a forceably unmounted instance is still hanging around, we cannot
+ * allow the module to be unloaded because that would cause panics once
+ * the VFS framework decides it's time to call into VFS_FREEVFS().
+ */
+ if (tmpfs_mountcount)
+ return (EBUSY);
+
error = mod_remove(&modlinkage);
if (error)
return (error);
@@ -139,14 +158,6 @@ _info(struct modinfo *modinfop)
}
/*
- * The following are patchable variables limiting the amount of system
- * resources tmpfs can use.
- *
- * tmpfs_maxkmem limits the amount of kernel kmem_alloc memory
- * tmpfs can use for it's data structures (e.g. tmpnodes, directory entries)
- * It is not determined by setting a hard limit but rather as a percentage of
- * physical memory which is determined when tmpfs is first used in the system.
- *
* tmpfs_minfree is the minimum amount of swap space that tmpfs leaves for
* the rest of the system. In other words, if the amount of free swap space
* in the system (i.e. anoninfo.ani_free) drops below tmpfs_minfree, tmpfs
@@ -155,9 +166,7 @@ _info(struct modinfo *modinfop)
* There is also a per mount limit on the amount of swap space
* (tmount.tm_anonmax) settable via a mount option.
*/
-size_t tmpfs_maxkmem = 0;
size_t tmpfs_minfree = 0;
-size_t tmp_kmemspace; /* bytes of kernel heap used by all tmpfs */
static major_t tmpfs_major;
static minor_t tmpfs_minor;
@@ -176,6 +185,7 @@ tmpfsinit(int fstype, char *name)
VFSNAME_ROOT, { .vfs_root = tmp_root },
VFSNAME_STATVFS, { .vfs_statvfs = tmp_statvfs },
VFSNAME_VGET, { .vfs_vget = tmp_vget },
+ VFSNAME_FREEVFS, { .vfs_freevfs = tmp_freevfs },
NULL, NULL
};
int error;
@@ -210,18 +220,12 @@ tmpfsinit(int fstype, char *name)
tmpfs_minfree = btopr(TMPMINFREE);
}
- /*
- * The maximum amount of space tmpfs can allocate is
- * TMPMAXPROCKMEM percent of kernel memory
- */
- if (tmpfs_maxkmem == 0)
- tmpfs_maxkmem = MAX(PAGESIZE, kmem_maxavail() / TMPMAXFRACKMEM);
-
if ((tmpfs_major = getudev()) == (major_t)-1) {
cmn_err(CE_WARN, "tmpfsinit: Can't get unique device number.");
tmpfs_major = 0;
}
mutex_init(&tmpfs_minor_lock, NULL, MUTEX_DEFAULT, NULL);
+ tmpfs_mountcount = 0;
return (0);
}
@@ -249,7 +253,7 @@ tmp_mount(
return (ENOTDIR);
mutex_enter(&mvp->v_lock);
- if ((uap->flags & MS_OVERLAY) == 0 &&
+ if ((uap->flags & MS_REMOUNT) == 0 && (uap->flags & MS_OVERLAY) == 0 &&
(mvp->v_count != 1 || (mvp->v_flag & VROOT))) {
mutex_exit(&mvp->v_lock);
return (EBUSY);
@@ -286,7 +290,23 @@ tmp_mount(
(uap->flags & MS_SYSSPACE) ? UIO_SYSSPACE : UIO_USERSPACE, &dpn))
goto out;
- if ((tm = tmp_memalloc(sizeof (struct tmount), 0)) == NULL) {
+ if (uap->flags & MS_REMOUNT) {
+ tm = (struct tmount *)VFSTOTM(vfsp);
+
+ /*
+ * If we change the size so its less than what is currently
+ * being used, we allow that. The file system will simply be
+ * full until enough files have been removed to get below the
+ * new max.
+ */
+ mutex_enter(&tm->tm_contents);
+ tm->tm_anonmax = anonmax;
+ mutex_exit(&tm->tm_contents);
+ goto out;
+ }
+
+ if ((tm = kmem_zalloc(sizeof (struct tmount),
+ KM_NOSLEEP | KM_NORMALPRI)) == NULL) {
pn_free(&dpn);
error = ENOMEM;
goto out;
@@ -318,7 +338,7 @@ tmp_mount(
vfsp->vfs_bsize = PAGESIZE;
vfsp->vfs_flag |= VFS_NOTRUNC;
vfs_make_fsid(&vfsp->vfs_fsid, tm->tm_dev, tmpfsfstype);
- tm->tm_mntpath = tmp_memalloc(dpn.pn_pathlen + 1, TMP_MUSTHAVE);
+ tm->tm_mntpath = kmem_zalloc(dpn.pn_pathlen + 1, KM_SLEEP);
(void) strcpy(tm->tm_mntpath, dpn.pn_path);
/*
@@ -328,7 +348,7 @@ tmp_mount(
rattr.va_mode = (mode_t)(S_IFDIR | 0777); /* XXX modes */
rattr.va_type = VDIR;
rattr.va_rdev = 0;
- tp = tmp_memalloc(sizeof (struct tmpnode), TMP_MUSTHAVE);
+ tp = kmem_zalloc(sizeof (struct tmpnode), KM_SLEEP);
tmpnode_init(tm, tp, &rattr, cr);
/*
@@ -366,6 +386,7 @@ tmp_mount(
pn_free(&dpn);
error = 0;
+ atomic_inc_32(&tmpfs_mountcount);
out:
if (error == 0)
@@ -381,36 +402,107 @@ tmp_unmount(struct vfs *vfsp, int flag, struct cred *cr)
struct tmpnode *tnp, *cancel;
struct vnode *vp;
int error;
+ uint_t cnt;
+ int i;
if ((error = secpolicy_fs_unmount(cr, vfsp)) != 0)
return (error);
- /*
- * forced unmount is not supported by this file system
- * and thus, ENOTSUP, is being returned.
- */
- if (flag & MS_FORCE)
- return (ENOTSUP);
-
mutex_enter(&tm->tm_contents);
/*
- * If there are no open files, only the root node should have
- * a reference count.
+ * In the normal unmount case (non-forced unmount), if there are no
+ * open files, only the root node should have a reference count.
+ *
* With tm_contents held, nothing can be added or removed.
* There may be some dirty pages. To prevent fsflush from
* disrupting the unmount, put a hold on each node while scanning.
* If we find a previously referenced node, undo the holds we have
* placed and fail EBUSY.
+ *
+ * However, in the case of a forced umount, things are a bit different.
+ * An additional VFS_HOLD is added for each outstanding VN_HOLD to
+ * ensure that the file system is not cleaned up (tmp_freevfs) until
+ * the last vfs hold is dropped. This happens in tmp_inactive as the
+ * vnodes are released. Also, we can't add an additional VN_HOLD in
+ * this case since that would prevent tmp_inactive from ever being
+ * called. Finally, we do need to drop the zone ref now (zone_rele_ref)
+ * so that the zone is not blocked waiting for the final file system
+ * cleanup.
*/
tnp = tm->tm_rootnode;
- if (TNTOV(tnp)->v_count > 1) {
+
+ vp = TNTOV(tnp);
+ mutex_enter(&vp->v_lock);
+ cnt = vp->v_count;
+ if (flag & MS_FORCE) {
+ vfsp->vfs_flag |= VFS_UNMOUNTED;
+ /* Extra hold which we rele below when we drop the zone ref */
+ VFS_HOLD(vfsp);
+
+ for (i = 1; i < cnt; i++)
+ VFS_HOLD(vfsp);
+
+ /* drop the mutex now because no one can find this mount */
+ mutex_exit(&tm->tm_contents);
+ } else if (cnt > 1) {
+ mutex_exit(&vp->v_lock);
mutex_exit(&tm->tm_contents);
return (EBUSY);
}
+ mutex_exit(&vp->v_lock);
+ /*
+ * Check for open files. An open file causes everything to unwind
+ * unless this is a forced umount.
+ */
for (tnp = tnp->tn_forw; tnp; tnp = tnp->tn_forw) {
- if ((vp = TNTOV(tnp))->v_count > 0) {
+ vp = TNTOV(tnp);
+ mutex_enter(&vp->v_lock);
+ cnt = vp->v_count;
+ if (flag & MS_FORCE) {
+ for (i = 0; i < cnt; i++)
+ VFS_HOLD(vfsp);
+
+ /*
+ * In the case of a forced umount don't add an
+ * additional VN_HOLD on the already held vnodes, like
+ * we do in the non-forced unmount case. If the
+ * cnt > 0, then the vnode already has at least one
+ * hold and we need tmp_inactive to get called when the
+ * last pre-existing hold on the node is released so
+ * that we can VFS_RELE the VFS holds we just added.
+ */
+ if (cnt == 0) {
+ /* directly add VN_HOLD since have the lock */
+ vp->v_count++;
+ }
+
+ mutex_exit(&vp->v_lock);
+
+ /*
+ * If the tmpnode has any pages associated with it
+ * (i.e. if it's a normal file with non-zero size), the
+ * tmpnode could still be discovered by pageout or
+ * fsflush via the page vnode pointers. To prevent this
+ * from interfering with the tmp_freevfs, truncate the
+ * tmpnode now.
+ */
+ if (tnp->tn_size != 0 && tnp->tn_type == VREG) {
+ rw_enter(&tnp->tn_rwlock, RW_WRITER);
+ rw_enter(&tnp->tn_contents, RW_WRITER);
+
+ (void) tmpnode_trunc(tm, tnp, 0);
+
+ rw_exit(&tnp->tn_contents);
+ rw_exit(&tnp->tn_rwlock);
+
+ ASSERT(tnp->tn_size == 0);
+ ASSERT(tnp->tn_nblocks == 0);
+ }
+ } else if (cnt > 0) {
+ /* An open file; unwind the holds we've been adding. */
+ mutex_exit(&vp->v_lock);
cancel = tm->tm_rootnode->tn_forw;
while (cancel != tnp) {
vp = TNTOV(cancel);
@@ -420,14 +512,50 @@ tmp_unmount(struct vfs *vfsp, int flag, struct cred *cr)
}
mutex_exit(&tm->tm_contents);
return (EBUSY);
+ } else {
+ /* directly add a VN_HOLD since we have the lock */
+ vp->v_count++;
+ mutex_exit(&vp->v_lock);
}
- VN_HOLD(vp);
}
- /*
- * We can drop the mutex now because no one can find this mount
- */
- mutex_exit(&tm->tm_contents);
+ if (flag & MS_FORCE) {
+ /*
+ * Drop the zone ref now since we don't know how long it will
+ * be until the final vfs_rele is called by tmp_inactive.
+ */
+ if (vfsp->vfs_zone) {
+ zone_rele_ref(&vfsp->vfs_implp->vi_zone_ref,
+ ZONE_REF_VFS);
+ vfsp->vfs_zone = 0;
+ }
+ /* We can now drop the extra hold we added above. */
+ VFS_RELE(vfsp);
+ } else {
+ /*
+ * For the non-forced case, we can drop the mutex now because
+ * no one can find this mount anymore
+ */
+ vfsp->vfs_flag |= VFS_UNMOUNTED;
+ mutex_exit(&tm->tm_contents);
+ }
+
+ return (0);
+}
+
+/*
+ * Implementation of VFS_FREEVFS() to support forced umounts. This is called by
+ * the vfs framework after umount and the last VFS_RELE, to trigger the release
+ * of any resources still associated with the given vfs_t. We only add
+ * additional VFS_HOLDs during the forced umount case, so this is normally
+ * called immediately after tmp_umount.
+ */
+void
+tmp_freevfs(vfs_t *vfsp)
+{
+ struct tmount *tm = (struct tmount *)VFSTOTM(vfsp);
+ struct tmpnode *tnp;
+ struct vnode *vp;
/*
* Free all kmemalloc'd and anonalloc'd memory associated with
@@ -437,6 +565,16 @@ tmp_unmount(struct vfs *vfsp, int flag, struct cred *cr)
* tmpnode_free which assumes that the directory entry has been
* removed before the file.
*/
+
+ /*
+ * Now that we are tearing ourselves down we need to remove the
+ * UNMOUNTED flag. If we don't, we'll later hit a VN_RELE when we remove
+ * files from the system causing us to have a negative value. Doing this
+ * seems a bit better than trying to set a flag on the tmount that says
+ * we're tearing down.
+ */
+ vfsp->vfs_flag &= ~VFS_UNMOUNTED;
+
/*
* Remove all directory entries
*/
@@ -503,15 +641,16 @@ tmp_unmount(struct vfs *vfsp, int flag, struct cred *cr)
ASSERT(tm->tm_mntpath);
- tmp_memfree(tm->tm_mntpath, strlen(tm->tm_mntpath) + 1);
+ kmem_free(tm->tm_mntpath, strlen(tm->tm_mntpath) + 1);
ASSERT(tm->tm_anonmem == 0);
mutex_destroy(&tm->tm_contents);
mutex_destroy(&tm->tm_renamelck);
- tmp_memfree(tm, sizeof (struct tmount));
+ kmem_free(tm, sizeof (struct tmount));
- return (0);
+ /* Allow _fini() to succeed now */
+ atomic_dec_32(&tmpfs_mountcount);
}
/*
@@ -614,13 +753,7 @@ tmp_statvfs(struct vfs *vfsp, struct statvfs64 *sbp)
* available to tmpfs. This is fairly inaccurate since it doesn't
* take into account the names stored in the directory entries.
*/
- if (tmpfs_maxkmem > tmp_kmemspace)
- sbp->f_ffree = (tmpfs_maxkmem - tmp_kmemspace) /
- (sizeof (struct tmpnode) + sizeof (struct tdirent));
- else
- sbp->f_ffree = 0;
-
- sbp->f_files = tmpfs_maxkmem /
+ sbp->f_ffree = sbp->f_files = ptob(availrmem) /
(sizeof (struct tmpnode) + sizeof (struct tdirent));
sbp->f_favail = (fsfilcnt64_t)(sbp->f_ffree);
(void) cmpldev(&d32, vfsp->vfs_dev);
diff --git a/usr/src/uts/common/fs/tmpfs/tmp_vnops.c b/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
index 61d72a4015..a2074f284f 100644
--- a/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
+++ b/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
@@ -24,6 +24,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
#include <sys/types.h>
#include <sys/param.h>
#include <sys/t_lock.h>
@@ -579,6 +583,10 @@ tmp_read(struct vnode *vp, struct uio *uiop, int ioflag, cred_t *cred,
struct tmount *tm = (struct tmount *)VTOTM(vp);
int error;
+ /* If the filesystem was umounted by force, return immediately. */
+ if (vp->v_vfsp->vfs_flag & VFS_UNMOUNTED)
+ return (EIO);
+
/*
* We don't currently support reading non-regular files
*/
@@ -608,6 +616,10 @@ tmp_write(struct vnode *vp, struct uio *uiop, int ioflag, struct cred *cred,
struct tmount *tm = (struct tmount *)VTOTM(vp);
int error;
+ /* If the filesystem was umounted by force, return immediately. */
+ if (vp->v_vfsp->vfs_flag & VFS_UNMOUNTED)
+ return (EIO);
+
/*
* We don't currently support writing to non-regular files
*/
@@ -824,6 +836,9 @@ tmp_lookup(
struct tmpnode *ntp = NULL;
int error;
+ /* If the filesystem was umounted by force, return immediately. */
+ if (dvp->v_vfsp->vfs_flag & VFS_UNMOUNTED)
+ return (EIO);
/* allow cd into @ dir */
if (flags & LOOKUP_XATTR) {
@@ -862,8 +877,7 @@ tmp_lookup(
return (error);
}
- xdp = tmp_memalloc(sizeof (struct tmpnode),
- TMP_MUSTHAVE);
+ xdp = kmem_zalloc(sizeof (struct tmpnode), KM_SLEEP);
tm = VTOTM(dvp);
tmpnode_init(tm, xdp, &tp->tn_attr, NULL);
/*
@@ -978,6 +992,8 @@ again:
}
if (error == 0) { /* name found */
+ boolean_t trunc = B_FALSE;
+
ASSERT(oldtp);
rw_enter(&oldtp->tn_rwlock, RW_WRITER);
@@ -1005,6 +1021,7 @@ again:
rw_enter(&oldtp->tn_contents, RW_WRITER);
(void) tmpnode_trunc(tm, oldtp, 0);
rw_exit(&oldtp->tn_contents);
+ trunc = B_TRUE;
}
rw_exit(&oldtp->tn_rwlock);
if (IS_DEVVP(*vpp)) {
@@ -1019,9 +1036,9 @@ again:
*vpp = newvp;
}
- if (error == 0) {
+ if (trunc)
vnevent_create(*vpp, ct);
- }
+
return (0);
}
@@ -1447,6 +1464,10 @@ tmp_readdir(
int reclen;
caddr_t outbuf;
+ /* If the filesystem was umounted by force, return immediately. */
+ if (vp->v_vfsp->vfs_flag & VFS_UNMOUNTED)
+ return (EIO);
+
if (uiop->uio_loffset >= MAXOFF_T) {
if (eofp)
*eofp = 1;
@@ -1585,7 +1606,7 @@ tmp_symlink(
return (error);
}
len = strlen(tnm) + 1;
- cp = tmp_memalloc(len, 0);
+ cp = kmem_alloc(len, KM_NOSLEEP | KM_NORMALPRI);
if (cp == NULL) {
tmpnode_rele(self);
return (ENOSPC);
@@ -1650,10 +1671,27 @@ top:
* there's little to do -- just drop our hold.
*/
if (vp->v_count > 1 || tp->tn_nlink != 0) {
- vp->v_count--;
+ if (vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) {
+ /*
+ * Since the file system was forcibly unmounted, we can
+ * have a case (v_count == 1, tn_nlink != 0) where this
+ * file was open so we didn't add an extra hold on the
+ * file in tmp_unmount. We are counting on the
+ * interaction of the hold made in tmp_unmount and
+ * rele-ed in tmp_vfsfree so we need to be sure we
+ * don't decrement in this case.
+ */
+ if (vp->v_count > 1)
+ vp->v_count--;
+ } else {
+ vp->v_count--;
+ }
mutex_exit(&vp->v_lock);
mutex_exit(&tp->tn_tlock);
rw_exit(&tp->tn_rwlock);
+ /* If the filesystem was umounted by force, rele the vfs ref */
+ if (tm->tm_vfsp->vfs_flag & VFS_UNMOUNTED)
+ VFS_RELE(tm->tm_vfsp);
return;
}
@@ -1678,7 +1716,7 @@ top:
goto top;
}
if (tp->tn_type == VLNK)
- tmp_memfree(tp->tn_symlink, tp->tn_size + 1);
+ kmem_free(tp->tn_symlink, tp->tn_size + 1);
}
/*
@@ -1712,7 +1750,11 @@ top:
rw_destroy(&tp->tn_rwlock);
mutex_destroy(&tp->tn_tlock);
vn_free(TNTOV(tp));
- tmp_memfree(tp, sizeof (struct tmpnode));
+ kmem_free(tp, sizeof (struct tmpnode));
+
+ /* If the filesystem was umounted by force, rele the vfs ref */
+ if (tm->tm_vfsp->vfs_flag & VFS_UNMOUNTED)
+ VFS_RELE(tm->tm_vfsp);
}
/* ARGSUSED2 */
@@ -1838,6 +1880,10 @@ tmp_getapage(
struct vnode *pvp;
u_offset_t poff;
+ /* If the filesystem was umounted by force, return immediately. */
+ if (vp->v_vfsp->vfs_flag & VFS_UNMOUNTED)
+ return (EIO);
+
if (protp != NULL)
*protp = PROT_ALL;
again:
@@ -2059,6 +2105,10 @@ tmp_putapage(
u_offset_t offset;
u_offset_t tmpoff;
+ /* If the filesystem was umounted by force, return immediately. */
+ if (vp->v_vfsp->vfs_flag & VFS_UNMOUNTED)
+ return (EIO);
+
ASSERT(PAGE_LOCKED(pp));
/* Kluster in tmp_klustsize chunks */
diff --git a/usr/src/uts/common/fs/vfs.c b/usr/src/uts/common/fs/vfs.c
index 83c53d859d..8d5c741428 100644
--- a/usr/src/uts/common/fs/vfs.c
+++ b/usr/src/uts/common/fs/vfs.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -1129,6 +1130,7 @@ domount(char *fsname, struct mounta *uap, vnode_t *vp, struct cred *credp,
struct pathname pn, rpn;
vsk_anchor_t *vskap;
char fstname[FSTYPSZ];
+ zone_t *zone;
/*
* The v_flag value for the mount point vp is permanently set
@@ -1590,9 +1592,24 @@ domount(char *fsname, struct mounta *uap, vnode_t *vp, struct cred *credp,
}
/*
- * Serialize with zone creations.
+ * Serialize with zone state transitions.
+ * See vfs_list_add; zone mounted into is:
+ * zone_find_by_path(refstr_value(vfsp->vfs_mntpt))
+ * not the zone doing the mount (curproc->p_zone), but if we're already
+ * inside a NGZ, then we know what zone we are.
*/
- mount_in_progress();
+ if (INGLOBALZONE(curproc)) {
+ zone = zone_find_by_path(mountpt);
+ ASSERT(zone != NULL);
+ } else {
+ zone = curproc->p_zone;
+ /*
+ * zone_find_by_path does a hold, so do one here too so that
+ * we can do a zone_rele after mount_completed.
+ */
+ zone_hold(zone);
+ }
+ mount_in_progress(zone);
/*
* Instantiate (or reinstantiate) the file system. If appropriate,
* splice it into the file system name space.
@@ -1761,7 +1778,8 @@ domount(char *fsname, struct mounta *uap, vnode_t *vp, struct cred *credp,
vfs_unlock(vfsp);
}
- mount_completed();
+ mount_completed(zone);
+ zone_rele(zone);
if (splice)
vn_vfsunlock(vp);
@@ -3881,6 +3899,8 @@ vfs_to_modname(const char *vfstype)
vfstype = "fdfs";
} else if (strncmp(vfstype, "nfs", 3) == 0) {
vfstype = "nfs";
+ } else if (strcmp(vfstype, "lxproc") == 0) {
+ vfstype = "lxprocfs";
}
return (vfstype);
diff --git a/usr/src/uts/common/fs/vnode.c b/usr/src/uts/common/fs/vnode.c
index 382369c7fc..67f21866ec 100644
--- a/usr/src/uts/common/fs/vnode.c
+++ b/usr/src/uts/common/fs/vnode.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent Inc. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -65,6 +66,7 @@
#include <fs/fs_subr.h>
#include <sys/taskq.h>
#include <fs/fs_reparse.h>
+#include <sys/time.h>
/* Determine if this vnode is a file that is read-only */
#define ISROFILE(vp) \
@@ -199,6 +201,11 @@ static void (**vsd_destructor)(void *);
cr = crgetmapped(cr); \
}
+#define VOP_LATENCY_10MS 10000000
+#define VOP_LATENCY_100MS 100000000
+#define VOP_LATENCY_1S 1000000000
+#define VOP_LATENCY_10S 10000000000
+
/*
* Convert stat(2) formats to vnode types and vice versa. (Knows about
* numerical order of S_IFMT and vnode types.)
@@ -3220,14 +3227,57 @@ fop_read(
cred_t *cr,
caller_context_t *ct)
{
- int err;
ssize_t resid_start = uiop->uio_resid;
+ zone_t *zonep = curzone;
+ zone_vfs_kstat_t *zvp = zonep->zone_vfs_stats;
+
+ hrtime_t start, lat;
+ ssize_t len;
+ int err;
+
+ if (vp->v_type == VREG || vp->v_type == VDIR || vp->v_type == VBLK) {
+ start = gethrtime();
+
+ mutex_enter(&zonep->zone_vfs_lock);
+ kstat_runq_enter(&zonep->zone_vfs_rwstats);
+ mutex_exit(&zonep->zone_vfs_lock);
+ }
VOPXID_MAP_CR(vp, cr);
err = (*(vp)->v_op->vop_read)(vp, uiop, ioflag, cr, ct);
- VOPSTATS_UPDATE_IO(vp, read,
- read_bytes, (resid_start - uiop->uio_resid));
+ len = resid_start - uiop->uio_resid;
+
+ VOPSTATS_UPDATE_IO(vp, read, read_bytes, len);
+
+ if (vp->v_type == VREG || vp->v_type == VDIR || vp->v_type == VBLK) {
+ mutex_enter(&zonep->zone_vfs_lock);
+ zonep->zone_vfs_rwstats.reads++;
+ zonep->zone_vfs_rwstats.nread += len;
+ kstat_runq_exit(&zonep->zone_vfs_rwstats);
+ mutex_exit(&zonep->zone_vfs_lock);
+
+ lat = gethrtime() - start;
+
+ if (lat >= VOP_LATENCY_10MS) {
+ if (lat < VOP_LATENCY_100MS)
+ atomic_inc_64(&zvp->zv_10ms_ops.value.ui64);
+ else if (lat < VOP_LATENCY_1S) {
+ atomic_inc_64(&zvp->zv_10ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_100ms_ops.value.ui64);
+ } else if (lat < VOP_LATENCY_10S) {
+ atomic_inc_64(&zvp->zv_10ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_100ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_1s_ops.value.ui64);
+ } else {
+ atomic_inc_64(&zvp->zv_10ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_100ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_1s_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_10s_ops.value.ui64);
+ }
+ }
+ }
+
return (err);
}
@@ -3239,14 +3289,62 @@ fop_write(
cred_t *cr,
caller_context_t *ct)
{
- int err;
ssize_t resid_start = uiop->uio_resid;
+ zone_t *zonep = curzone;
+ zone_vfs_kstat_t *zvp = zonep->zone_vfs_stats;
+
+ hrtime_t start, lat;
+ ssize_t len;
+ int err;
+
+ /*
+ * For the purposes of VFS kstat consumers, the "waitq" calculation is
+ * repurposed as the active queue for VFS write operations. There's no
+ * actual wait queue for VFS operations.
+ */
+ if (vp->v_type == VREG || vp->v_type == VDIR || vp->v_type == VBLK) {
+ start = gethrtime();
+
+ mutex_enter(&zonep->zone_vfs_lock);
+ kstat_waitq_enter(&zonep->zone_vfs_rwstats);
+ mutex_exit(&zonep->zone_vfs_lock);
+ }
VOPXID_MAP_CR(vp, cr);
err = (*(vp)->v_op->vop_write)(vp, uiop, ioflag, cr, ct);
- VOPSTATS_UPDATE_IO(vp, write,
- write_bytes, (resid_start - uiop->uio_resid));
+ len = resid_start - uiop->uio_resid;
+
+ VOPSTATS_UPDATE_IO(vp, write, write_bytes, len);
+
+ if (vp->v_type == VREG || vp->v_type == VDIR || vp->v_type == VBLK) {
+ mutex_enter(&zonep->zone_vfs_lock);
+ zonep->zone_vfs_rwstats.writes++;
+ zonep->zone_vfs_rwstats.nwritten += len;
+ kstat_waitq_exit(&zonep->zone_vfs_rwstats);
+ mutex_exit(&zonep->zone_vfs_lock);
+
+ lat = gethrtime() - start;
+
+ if (lat >= VOP_LATENCY_10MS) {
+ if (lat < VOP_LATENCY_100MS)
+ atomic_inc_64(&zvp->zv_10ms_ops.value.ui64);
+ else if (lat < VOP_LATENCY_1S) {
+ atomic_inc_64(&zvp->zv_10ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_100ms_ops.value.ui64);
+ } else if (lat < VOP_LATENCY_10S) {
+ atomic_inc_64(&zvp->zv_10ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_100ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_1s_ops.value.ui64);
+ } else {
+ atomic_inc_64(&zvp->zv_10ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_100ms_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_1s_ops.value.ui64);
+ atomic_inc_64(&zvp->zv_10s_ops.value.ui64);
+ }
+ }
+ }
+
return (err);
}
diff --git a/usr/src/uts/common/fs/zfs/arc.c b/usr/src/uts/common/fs/zfs/arc.c
index 0d33c5e418..cb47af47e5 100644
--- a/usr/src/uts/common/fs/zfs/arc.c
+++ b/usr/src/uts/common/fs/zfs/arc.c
@@ -22,6 +22,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -125,6 +126,7 @@
#include <sys/refcount.h>
#include <sys/vdev.h>
#include <sys/vdev_impl.h>
+#include <sys/zfs_zone.h>
#ifdef _KERNEL
#include <sys/vmsystm.h>
#include <vm/anon.h>
@@ -2150,6 +2152,16 @@ arc_reclaim_needed(void)
if (availrmem < swapfs_minfree + swapfs_reserve + extra)
return (1);
+ /*
+ * Check that we have enough availrmem that memory locking (e.g., via
+ * mlock(3C) or memcntl(2)) can still succeed. (pages_pp_maximum
+ * stores the number of pages that cannot be locked; when availrmem
+ * drops below pages_pp_maximum, page locking mechanisms such as
+ * page_pp_lock() will fail.)
+ */
+ if (availrmem <= pages_pp_maximum)
+ return (1);
+
#if defined(__i386)
/*
* If we're on an i386 platform, it's possible that we'll exhaust the
@@ -3036,6 +3048,14 @@ top:
rzio = zio_read(pio, spa, bp, buf->b_data, size,
arc_read_done, buf, priority, zio_flags, zb);
+ /*
+ * At this point, this read I/O has already missed in the ARC
+ * and will be going through to the disk. The I/O throttle
+ * should delay this I/O if this zone is using more than its I/O
+ * priority allows.
+ */
+ zfs_zone_io_throttle(ZFS_ZONE_IOP_READ);
+
if (*arc_flags & ARC_WAIT)
return (zio_wait(rzio));
@@ -3607,9 +3627,6 @@ arc_init(void)
if (zfs_arc_meta_limit > 0 && zfs_arc_meta_limit <= arc_c_max)
arc_meta_limit = zfs_arc_meta_limit;
- if (arc_c_min < arc_meta_limit / 2 && zfs_arc_min == 0)
- arc_c_min = arc_meta_limit / 2;
-
if (zfs_arc_grow_retry > 0)
arc_grow_retry = zfs_arc_grow_retry;
diff --git a/usr/src/uts/common/fs/zfs/dbuf.c b/usr/src/uts/common/fs/zfs/dbuf.c
index 1572acb94e..4253ef586e 100644
--- a/usr/src/uts/common/fs/zfs/dbuf.c
+++ b/usr/src/uts/common/fs/zfs/dbuf.c
@@ -22,6 +22,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <sys/zfs_context.h>
@@ -531,8 +532,19 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags)
arc_space_consume(DN_MAX_BONUSLEN, ARC_SPACE_OTHER);
if (bonuslen < DN_MAX_BONUSLEN)
bzero(db->db.db_data, DN_MAX_BONUSLEN);
- if (bonuslen)
- bcopy(DN_BONUS(dn->dn_phys), db->db.db_data, bonuslen);
+
+ if (bonuslen) {
+ /*
+ * Absent byzantine on-disk corruption, we fully expect
+ * our bonuslen to be no more than DN_MAX_BONUSLEN --
+ * but we nonetheless explicitly clamp it on the bcopy()
+ * to prevent any on-disk corruption from becoming
+ * rampant in-kernel corruption.
+ */
+ bcopy(DN_BONUS(dn->dn_phys), db->db.db_data,
+ MIN(bonuslen, DN_MAX_BONUSLEN));
+ }
+
DB_DNODE_EXIT(db);
dbuf_update_data(db);
db->db_state = DB_CACHED;
@@ -2697,7 +2709,8 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx)
dr->dt.dl.dr_copies, dr->dt.dl.dr_nopwrite);
mutex_exit(&db->db_mtx);
} else if (db->db_state == DB_NOFILL) {
- ASSERT(zp.zp_checksum == ZIO_CHECKSUM_OFF);
+ ASSERT(zp.zp_checksum == ZIO_CHECKSUM_OFF ||
+ zp.zp_checksum == ZIO_CHECKSUM_NOPARITY);
dr->dr_zio = zio_write(zio, os->os_spa, txg,
db->db_blkptr, NULL, db->db.db_size, &zp,
dbuf_write_nofill_ready, dbuf_write_nofill_done, db,
diff --git a/usr/src/uts/common/fs/zfs/dmu.c b/usr/src/uts/common/fs/zfs/dmu.c
index 00eddacfb8..e4d9c7a3a6 100644
--- a/usr/src/uts/common/fs/zfs/dmu.c
+++ b/usr/src/uts/common/fs/zfs/dmu.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2011, Joyent, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
@@ -969,6 +970,7 @@ xuio_stat_wbuf_nocopy()
}
#ifdef _KERNEL
+
int
dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size)
{
@@ -1627,7 +1629,6 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
if (!zio_checksum_table[checksum].ci_dedup)
dedup_verify = B_TRUE;
}
-
/*
* Enable nopwrite if we have a cryptographically secure
* checksum that has no known collisions (i.e. SHA-256)
diff --git a/usr/src/uts/common/fs/zfs/dmu_tx.c b/usr/src/uts/common/fs/zfs/dmu_tx.c
index 3eeaca64ec..ad4084021d 100644
--- a/usr/src/uts/common/fs/zfs/dmu_tx.c
+++ b/usr/src/uts/common/fs/zfs/dmu_tx.c
@@ -38,11 +38,11 @@
#include <sys/sa_impl.h>
#include <sys/zfs_context.h>
#include <sys/varargs.h>
+#include <sys/zfs_zone.h>
typedef void (*dmu_tx_hold_func_t)(dmu_tx_t *tx, struct dnode *dn,
uint64_t arg1, uint64_t arg2);
-
dmu_tx_t *
dmu_tx_create_dd(dsl_dir_t *dd)
{
@@ -222,6 +222,8 @@ dmu_tx_count_write(dmu_tx_hold_t *txh, uint64_t off, uint64_t len)
if (len == 0)
return;
+ zfs_zone_io_throttle(ZFS_ZONE_IOP_LOGICAL_WRITE);
+
min_bs = SPA_MINBLOCKSHIFT;
max_bs = SPA_MAXBLOCKSHIFT;
min_ibs = DN_MIN_INDBLKSHIFT;
diff --git a/usr/src/uts/common/fs/zfs/dsl_dir.c b/usr/src/uts/common/fs/zfs/dsl_dir.c
index ca56829740..cfb763a8eb 100644
--- a/usr/src/uts/common/fs/zfs/dsl_dir.c
+++ b/usr/src/uts/common/fs/zfs/dsl_dir.c
@@ -37,6 +37,7 @@
#include <sys/zio.h>
#include <sys/arc.h>
#include <sys/sunddi.h>
+#include <sys/zfs_zone.h>
#include "zfs_namecheck.h"
static uint64_t dsl_dir_space_towrite(dsl_dir_t *dd);
@@ -739,7 +740,7 @@ dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t lsize, uint64_t asize,
} else {
if (err == EAGAIN) {
txg_delay(dd->dd_pool, tx->tx_txg,
- MSEC2NSEC(10), MSEC2NSEC(10));
+ zfs_zone_txg_delay(), MSEC2NSEC(10));
err = SET_ERROR(ERESTART);
}
dsl_pool_memory_pressure(dd->dd_pool);
diff --git a/usr/src/uts/common/fs/zfs/dsl_pool.c b/usr/src/uts/common/fs/zfs/dsl_pool.c
index c72f13c271..288c90e227 100644
--- a/usr/src/uts/common/fs/zfs/dsl_pool.c
+++ b/usr/src/uts/common/fs/zfs/dsl_pool.c
@@ -40,6 +40,7 @@
#include <sys/zfs_znode.h>
#include <sys/spa_impl.h>
#include <sys/dsl_deadlist.h>
+#include <sys/zfs_zone.h>
#include <sys/bptree.h>
#include <sys/zfeature.h>
#include <sys/zil_impl.h>
@@ -58,7 +59,6 @@ kmutex_t zfs_write_limit_lock;
static pgcnt_t old_physmem = 0;
-hrtime_t zfs_throttle_delay = MSEC2NSEC(10);
hrtime_t zfs_throttle_resolution = MSEC2NSEC(10);
int
@@ -615,11 +615,11 @@ dsl_pool_tempreserve_space(dsl_pool_t *dp, uint64_t space, dmu_tx_t *tx)
/*
* If this transaction group is over 7/8ths capacity, delay
- * the caller 1 clock tick. This will slow down the "fill"
- * rate until the sync process can catch up with us.
+ * the caller some number of clock ticks. This will slow down the
+ * "fill" rate until the sync process can catch up with us.
*/
if (reserved && reserved > (write_limit - (write_limit >> 3))) {
- txg_delay(dp, tx->tx_txg, zfs_throttle_delay,
+ txg_delay(dp, tx->tx_txg, zfs_zone_txg_delay(),
zfs_throttle_resolution);
}
diff --git a/usr/src/uts/common/fs/zfs/sys/dsl_dir.h b/usr/src/uts/common/fs/zfs/sys/dsl_dir.h
index 641bcfcdd3..761d278f43 100644
--- a/usr/src/uts/common/fs/zfs/sys/dsl_dir.h
+++ b/usr/src/uts/common/fs/zfs/sys/dsl_dir.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_DSL_DIR_H
@@ -71,7 +72,11 @@ typedef struct dsl_dir_phys {
uint64_t dd_flags;
uint64_t dd_used_breakdown[DD_USED_NUM];
uint64_t dd_clones; /* dsl_dir objects */
- uint64_t dd_pad[13]; /* pad out to 256 bytes for good measure */
+
+ uint64_t dd_filesystem_count;
+ uint64_t dd_snapshot_count;
+
+ uint64_t dd_pad[11]; /* pad out to 256 bytes for good measure */
} dsl_dir_phys_t;
struct dsl_dir {
diff --git a/usr/src/uts/common/fs/zfs/sys/vdev_disk.h b/usr/src/uts/common/fs/zfs/sys/vdev_disk.h
index b748571ea0..1f68b47e84 100644
--- a/usr/src/uts/common/fs/zfs/sys/vdev_disk.h
+++ b/usr/src/uts/common/fs/zfs/sys/vdev_disk.h
@@ -21,13 +21,13 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SYS_VDEV_DISK_H
#define _SYS_VDEV_DISK_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/vdev.h>
#ifdef _KERNEL
#include <sys/buf.h>
@@ -40,14 +40,24 @@
extern "C" {
#endif
+#ifdef _KERNEL
typedef struct vdev_disk {
ddi_devid_t vd_devid;
char *vd_minor;
ldi_handle_t vd_lh;
+ list_t vd_ldi_cbs;
+ boolean_t vd_ldi_offline;
} vdev_disk_t;
+#endif
+extern int vdev_disk_physio(vdev_t *, caddr_t, size_t, uint64_t, int);
+
+/*
+ * Since vdev_disk.c is not compiled into libzpool, this function should only be
+ * defined in the zfs kernel module.
+ */
#ifdef _KERNEL
-extern int vdev_disk_physio(ldi_handle_t, caddr_t, size_t, uint64_t, int);
+extern int vdev_disk_ldi_physio(ldi_handle_t, caddr_t, size_t, uint64_t, int);
#endif
#ifdef __cplusplus
}
diff --git a/usr/src/uts/common/fs/zfs/sys/vdev_impl.h b/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
index b7215e7979..c599c549ac 100644
--- a/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
+++ b/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
@@ -104,6 +104,7 @@ struct vdev_queue {
avl_tree_t vq_read_tree;
avl_tree_t vq_write_tree;
avl_tree_t vq_pending_tree;
+ zoneid_t vq_last_zone_id;
hrtime_t vq_io_complete_ts;
kmutex_t vq_lock;
};
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmMisc.java b/usr/src/uts/common/fs/zfs/sys/vdev_raidz.h
index 21202c0eba..40616280b8 100644
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/pmMisc.java
+++ b/usr/src/uts/common/fs/zfs/sys/vdev_raidz.h
@@ -19,28 +19,30 @@
* CDDL HEADER END
*/
/*
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Miscellaneous functions which don't apply to printer object
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
-package com.sun.admin.pm.server;
+#ifndef _SYS_VDEV_RAIDZ_H
+#define _SYS_VDEV_RAIDZ_H
-import java.io.*;
+#include <sys/vdev.h>
+#include <sys/semaphore.h>
+#ifdef _KERNEL
+#include <sys/ddi.h>
+#include <sys/sunldi.h>
+#include <sys/sunddi.h>
+#endif
-/*
- * Class is miscellaneous routines
- */
-
-public class pmMisc {
-
- public static boolean isppdCachefile()
- {
- File ppdcache = new File("/var/lp/ppd/ppdcache");
- return (ppdcache.isFile());
- }
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef _KERNEL
+extern int vdev_raidz_physio(vdev_t *,
+ caddr_t, size_t, uint64_t, uint64_t, boolean_t);
+#endif
+#ifdef __cplusplus
}
+#endif
+
+#endif /* _SYS_VDEV_RAIDZ_H */
diff --git a/usr/src/uts/common/fs/zfs/sys/zfs_zone.h b/usr/src/uts/common/fs/zfs/sys/zfs_zone.h
new file mode 100644
index 0000000000..b3e90c187e
--- /dev/null
+++ b/usr/src/uts/common/fs/zfs/sys/zfs_zone.h
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Joyent, Inc. All rights reserved.
+ */
+
+#ifndef _SYS_FS_ZFS_ZONE_H
+#define _SYS_FS_ZFS_ZONE_H
+
+#ifdef _KERNEL
+#include <sys/isa_defs.h>
+#include <sys/types32.h>
+#include <sys/vdev_impl.h>
+#include <sys/zio.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ ZFS_ZONE_IOP_READ = 0,
+ ZFS_ZONE_IOP_WRITE,
+ ZFS_ZONE_IOP_LOGICAL_WRITE,
+} zfs_zone_iop_type_t;
+
+extern void zfs_zone_io_throttle(zfs_zone_iop_type_t);
+
+extern void zfs_zone_zio_init(zio_t *);
+extern void zfs_zone_zio_start(zio_t *);
+extern void zfs_zone_zio_done(zio_t *);
+extern void zfs_zone_zio_dequeue(zio_t *);
+extern void zfs_zone_zio_enqueue(zio_t *);
+extern void zfs_zone_report_txg_sync(void *);
+extern hrtime_t zfs_zone_txg_delay();
+#ifdef _KERNEL
+extern zio_t *zfs_zone_schedule(vdev_queue_t *);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FS_ZFS_ZONE_H */
diff --git a/usr/src/uts/common/fs/zfs/sys/zio.h b/usr/src/uts/common/fs/zfs/sys/zio.h
index 1ce087e686..a8fb9f9c4d 100644
--- a/usr/src/uts/common/fs/zfs/sys/zio.h
+++ b/usr/src/uts/common/fs/zfs/sys/zio.h
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
*/
@@ -79,6 +80,8 @@ enum zio_checksum {
ZIO_CHECKSUM_FLETCHER_4,
ZIO_CHECKSUM_SHA256,
ZIO_CHECKSUM_ZILOG2,
+ ZIO_CHECKSUM_SHA256_MAC,
+ ZIO_CHECKSUM_NOPARITY,
ZIO_CHECKSUM_FUNCTIONS
};
@@ -437,6 +440,9 @@ struct zio {
zio_cksum_report_t *io_cksum_report;
uint64_t io_ena;
+ zoneid_t io_zoneid; /* zone which originated this I/O */
+ hrtime_t io_start; /* time I/O entered zio pipeline */
+ hrtime_t io_dispatched; /* time I/O was dispatched to disk */
/* Taskq dispatching state */
taskq_ent_t io_tqent;
};
diff --git a/usr/src/uts/common/fs/zfs/txg.c b/usr/src/uts/common/fs/zfs/txg.c
index af48c4f186..62a0c605d7 100644
--- a/usr/src/uts/common/fs/zfs/txg.c
+++ b/usr/src/uts/common/fs/zfs/txg.c
@@ -31,6 +31,7 @@
#include <sys/dsl_pool.h>
#include <sys/dsl_scan.h>
#include <sys/callb.h>
+#include <sys/zfs_zone.h>
/*
* ZFS Transaction Groups
@@ -491,6 +492,8 @@ txg_sync_thread(dsl_pool_t *dp)
txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
mutex_exit(&tx->tx_sync_lock);
+ zfs_zone_report_txg_sync(dp);
+
start = ddi_get_lbolt();
spa_sync(spa, txg);
delta = ddi_get_lbolt() - start;
diff --git a/usr/src/uts/common/fs/zfs/vdev_disk.c b/usr/src/uts/common/fs/zfs/vdev_disk.c
index c526363dae..a0a151db71 100644
--- a/usr/src/uts/common/fs/zfs/vdev_disk.c
+++ b/usr/src/uts/common/fs/zfs/vdev_disk.c
@@ -21,9 +21,12 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
#include <sys/zfs_context.h>
+#include <sys/zfs_zone.h>
#include <sys/spa_impl.h>
#include <sys/refcount.h>
#include <sys/vdev_disk.h>
@@ -40,6 +43,153 @@
extern ldi_ident_t zfs_li;
+static void vdev_disk_close(vdev_t *);
+
+typedef struct vdev_disk_buf {
+ buf_t vdb_buf;
+ zio_t *vdb_io;
+} vdev_disk_buf_t;
+
+typedef struct vdev_disk_ldi_cb {
+ list_node_t lcb_next;
+ ldi_callback_id_t lcb_id;
+} vdev_disk_ldi_cb_t;
+
+static void
+vdev_disk_alloc(vdev_t *vd)
+{
+ vdev_disk_t *dvd;
+
+ dvd = vd->vdev_tsd = kmem_zalloc(sizeof (vdev_disk_t), KM_SLEEP);
+ /*
+ * Create the LDI event callback list.
+ */
+ list_create(&dvd->vd_ldi_cbs, sizeof (vdev_disk_ldi_cb_t),
+ offsetof(vdev_disk_ldi_cb_t, lcb_next));
+}
+
+static void
+vdev_disk_free(vdev_t *vd)
+{
+ vdev_disk_t *dvd = vd->vdev_tsd;
+ vdev_disk_ldi_cb_t *lcb;
+
+ if (dvd == NULL)
+ return;
+
+ /*
+ * We have already closed the LDI handle. Clean up the LDI event
+ * callbacks and free vd->vdev_tsd.
+ */
+ while ((lcb = list_head(&dvd->vd_ldi_cbs)) != NULL) {
+ list_remove(&dvd->vd_ldi_cbs, lcb);
+ (void) ldi_ev_remove_callbacks(lcb->lcb_id);
+ kmem_free(lcb, sizeof (vdev_disk_ldi_cb_t));
+ }
+ list_destroy(&dvd->vd_ldi_cbs);
+ kmem_free(dvd, sizeof (vdev_disk_t));
+ vd->vdev_tsd = NULL;
+}
+
+/* ARGSUSED */
+static int
+vdev_disk_off_notify(ldi_handle_t lh, ldi_ev_cookie_t ecookie, void *arg,
+ void *ev_data)
+{
+ vdev_t *vd = (vdev_t *)arg;
+ vdev_disk_t *dvd = vd->vdev_tsd;
+
+ /*
+ * Ignore events other than offline.
+ */
+ if (strcmp(ldi_ev_get_type(ecookie), LDI_EV_OFFLINE) != 0)
+ return (LDI_EV_SUCCESS);
+
+ /*
+ * All LDI handles must be closed for the state change to succeed, so
+ * call on vdev_disk_close() to do this.
+ *
+ * We inform vdev_disk_close that it is being called from offline
+ * notify context so it will defer cleanup of LDI event callbacks and
+ * freeing of vd->vdev_tsd to the offline finalize or a reopen.
+ */
+ dvd->vd_ldi_offline = B_TRUE;
+ vdev_disk_close(vd);
+
+ /*
+ * Now that the device is closed, request that the spa_async_thread
+ * mark the device as REMOVED and notify FMA of the removal.
+ */
+ zfs_post_remove(vd->vdev_spa, vd);
+ vd->vdev_remove_wanted = B_TRUE;
+ spa_async_request(vd->vdev_spa, SPA_ASYNC_REMOVE);
+
+ return (LDI_EV_SUCCESS);
+}
+
+/* ARGSUSED */
+static void
+vdev_disk_off_finalize(ldi_handle_t lh, ldi_ev_cookie_t ecookie,
+ int ldi_result, void *arg, void *ev_data)
+{
+ vdev_t *vd = (vdev_t *)arg;
+ vdev_disk_t *dvd = vd->vdev_tsd;
+ vdev_disk_ldi_cb_t *lcb;
+
+ /*
+ * Ignore events other than offline.
+ */
+ if (strcmp(ldi_ev_get_type(ecookie), LDI_EV_OFFLINE) != 0)
+ return;
+
+ /*
+ * We have already closed the LDI handle in notify.
+ * Clean up the LDI event callbacks and free vd->vdev_tsd.
+ */
+ vdev_disk_free(vd);
+
+ /*
+ * Request that the vdev be reopened if the offline state change was
+ * unsuccessful.
+ */
+ if (ldi_result != LDI_EV_SUCCESS) {
+ vd->vdev_probe_wanted = B_TRUE;
+ spa_async_request(vd->vdev_spa, SPA_ASYNC_PROBE);
+ }
+}
+
+static ldi_ev_callback_t vdev_disk_off_callb = {
+ .cb_vers = LDI_EV_CB_VERS,
+ .cb_notify = vdev_disk_off_notify,
+ .cb_finalize = vdev_disk_off_finalize
+};
+
+/* ARGSUSED */
+static void
+vdev_disk_dgrd_finalize(ldi_handle_t lh, ldi_ev_cookie_t ecookie,
+ int ldi_result, void *arg, void *ev_data)
+{
+ vdev_t *vd = (vdev_t *)arg;
+
+ /*
+ * Ignore events other than degrade.
+ */
+ if (strcmp(ldi_ev_get_type(ecookie), LDI_EV_DEGRADE) != 0)
+ return;
+
+ /*
+ * Degrade events always succeed. Mark the vdev as degraded.
+ * This status is purely informative for the user.
+ */
+ (void) vdev_degrade(vd->vdev_spa, vd->vdev_guid, 0);
+}
+
+static ldi_ev_callback_t vdev_disk_dgrd_callb = {
+ .cb_vers = LDI_EV_CB_VERS,
+ .cb_notify = NULL,
+ .cb_finalize = vdev_disk_dgrd_finalize
+};
+
static void
vdev_disk_hold(vdev_t *vd)
{
@@ -134,8 +284,10 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
uint64_t *ashift)
{
spa_t *spa = vd->vdev_spa;
- vdev_disk_t *dvd;
+ vdev_disk_t *dvd = vd->vdev_tsd;
struct dk_minfo_ext dkmext;
+ ldi_ev_cookie_t ecookie;
+ vdev_disk_ldi_cb_t *lcb;
int error;
dev_t dev;
int otyp;
@@ -154,13 +306,25 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
* Reopen the device if it's not currently open. Otherwise,
* just update the physical size of the device.
*/
- if (vd->vdev_tsd != NULL) {
- ASSERT(vd->vdev_reopening);
- dvd = vd->vdev_tsd;
- goto skip_open;
+ if (dvd != NULL) {
+ if (dvd->vd_ldi_offline && dvd->vd_lh == NULL) {
+ /*
+ * If we are opening a device in its offline notify
+ * context, the LDI handle was just closed. Clean
+ * up the LDI event callbacks and free vd->vdev_tsd.
+ */
+ vdev_disk_free(vd);
+ } else {
+ ASSERT(vd->vdev_reopening);
+ goto skip_open;
+ }
}
- dvd = vd->vdev_tsd = kmem_zalloc(sizeof (vdev_disk_t), KM_SLEEP);
+ /*
+ * Create vd->vdev_tsd.
+ */
+ vdev_disk_alloc(vd);
+ dvd = vd->vdev_tsd;
/*
* When opening a disk device, we want to preserve the user's original
@@ -193,23 +357,28 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
if (vd->vdev_wholedisk == -1ULL) {
size_t len = strlen(vd->vdev_path) + 3;
char *buf = kmem_alloc(len, KM_SLEEP);
- ldi_handle_t lh;
(void) snprintf(buf, len, "%ss0", vd->vdev_path);
- if (ldi_open_by_name(buf, spa_mode(spa), kcred,
- &lh, zfs_li) == 0) {
+ error = ldi_open_by_name(buf, spa_mode(spa), kcred,
+ &dvd->vd_lh, zfs_li);
+ if (error == 0) {
spa_strfree(vd->vdev_path);
vd->vdev_path = buf;
vd->vdev_wholedisk = 1ULL;
- (void) ldi_close(lh, spa_mode(spa), kcred);
} else {
kmem_free(buf, len);
}
}
- error = ldi_open_by_name(vd->vdev_path, spa_mode(spa), kcred,
- &dvd->vd_lh, zfs_li);
+ /*
+ * If we have not yet opened the device, try to open it by the
+ * specified path.
+ */
+ if (error != 0) {
+ error = ldi_open_by_name(vd->vdev_path, spa_mode(spa),
+ kcred, &dvd->vd_lh, zfs_li);
+ }
/*
* Compare the devid to the stored value.
@@ -316,6 +485,27 @@ vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
kmem_free(physpath, MAXPATHLEN);
}
+ /*
+ * Register callbacks for the LDI offline event.
+ */
+ if (ldi_ev_get_cookie(dvd->vd_lh, LDI_EV_OFFLINE, &ecookie) ==
+ LDI_EV_SUCCESS) {
+ lcb = kmem_zalloc(sizeof (vdev_disk_ldi_cb_t), KM_SLEEP);
+ list_insert_tail(&dvd->vd_ldi_cbs, lcb);
+ (void) ldi_ev_register_callbacks(dvd->vd_lh, ecookie,
+ &vdev_disk_off_callb, (void *) vd, &lcb->lcb_id);
+ }
+
+ /*
+ * Register callbacks for the LDI degrade event.
+ */
+ if (ldi_ev_get_cookie(dvd->vd_lh, LDI_EV_DEGRADE, &ecookie) ==
+ LDI_EV_SUCCESS) {
+ lcb = kmem_zalloc(sizeof (vdev_disk_ldi_cb_t), KM_SLEEP);
+ list_insert_tail(&dvd->vd_ldi_cbs, lcb);
+ (void) ldi_ev_register_callbacks(dvd->vd_lh, ecookie,
+ &vdev_disk_dgrd_callb, (void *) vd, &lcb->lcb_id);
+ }
skip_open:
/*
* Determine the actual size of the device.
@@ -367,27 +557,58 @@ static void
vdev_disk_close(vdev_t *vd)
{
vdev_disk_t *dvd = vd->vdev_tsd;
+ vdev_disk_ldi_cb_t *lcb;
if (vd->vdev_reopening || dvd == NULL)
return;
- if (dvd->vd_minor != NULL)
+ if (dvd->vd_minor != NULL) {
ddi_devid_str_free(dvd->vd_minor);
+ dvd->vd_minor = NULL;
+ }
- if (dvd->vd_devid != NULL)
+ if (dvd->vd_devid != NULL) {
ddi_devid_free(dvd->vd_devid);
+ dvd->vd_devid = NULL;
+ }
- if (dvd->vd_lh != NULL)
+ if (dvd->vd_lh != NULL) {
(void) ldi_close(dvd->vd_lh, spa_mode(vd->vdev_spa), kcred);
+ dvd->vd_lh = NULL;
+ }
vd->vdev_delayed_close = B_FALSE;
- kmem_free(dvd, sizeof (vdev_disk_t));
- vd->vdev_tsd = NULL;
+ /*
+ * If we closed the LDI handle due to an offline notify from LDI,
+ * don't free vd->vdev_tsd or unregister the callbacks here;
+ * the offline finalize callback or a reopen will take care of it.
+ */
+ if (dvd->vd_ldi_offline)
+ return;
+
+ vdev_disk_free(vd);
}
int
-vdev_disk_physio(ldi_handle_t vd_lh, caddr_t data, size_t size,
- uint64_t offset, int flags)
+vdev_disk_physio(vdev_t *vd, caddr_t data,
+ size_t size, uint64_t offset, int flags)
+{
+ vdev_disk_t *dvd = vd->vdev_tsd;
+
+ /*
+ * If the vdev is closed, it's likely in the REMOVED or FAULTED state.
+ * Nothing to be done here but return failure.
+ */
+ if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL))
+ return (EIO);
+
+ ASSERT(vd->vdev_ops == &vdev_disk_ops);
+ return (vdev_disk_ldi_physio(dvd->vd_lh, data, size, offset, flags));
+}
+
+int
+vdev_disk_ldi_physio(ldi_handle_t vd_lh, caddr_t data,
+ size_t size, uint64_t offset, int flags)
{
buf_t *bp;
int error = 0;
@@ -465,6 +686,15 @@ vdev_disk_io_start(zio_t *zio)
buf_t *bp;
int error;
+ /*
+ * If the vdev is closed, it's likely in the REMOVED or FAULTED state.
+ * Nothing to be done here but return failure.
+ */
+ if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL)) {
+ zio->io_error = ENXIO;
+ return (ZIO_PIPELINE_CONTINUE);
+ }
+
if (zio->io_type == ZIO_TYPE_IOCTL) {
/* XXPOLICY */
if (!vdev_readable(vd)) {
@@ -540,6 +770,8 @@ vdev_disk_io_start(zio_t *zio)
bp->b_bufsize = zio->io_size;
bp->b_iodone = (int (*)())vdev_disk_io_intr;
+ zfs_zone_zio_start(zio);
+
/* ldi_strategy() will return non-zero only on programming errors */
VERIFY(ldi_strategy(dvd->vd_lh, bp) == 0);
@@ -551,6 +783,8 @@ vdev_disk_io_done(zio_t *zio)
{
vdev_t *vd = zio->io_vd;
+ zfs_zone_zio_done(zio);
+
/*
* If the device returned EIO, then attempt a DKIOCSTATE ioctl to see if
* the device has been removed. If this is the case, then we trigger an
@@ -635,7 +869,7 @@ vdev_disk_read_rootlabel(char *devpath, char *devid, nvlist_t **config)
/* read vdev label */
offset = vdev_label_offset(size, l, 0);
- if (vdev_disk_physio(vd_lh, (caddr_t)label,
+ if (vdev_disk_ldi_physio(vd_lh, (caddr_t)label,
VDEV_SKIP_SIZE + VDEV_PHYS_SIZE, offset, B_READ) != 0)
continue;
diff --git a/usr/src/uts/common/fs/zfs/vdev_queue.c b/usr/src/uts/common/fs/zfs/vdev_queue.c
index 61fc177ff0..fccbbb1d75 100644
--- a/usr/src/uts/common/fs/zfs/vdev_queue.c
+++ b/usr/src/uts/common/fs/zfs/vdev_queue.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
/*
@@ -32,6 +33,7 @@
#include <sys/spa_impl.h>
#include <sys/zio.h>
#include <sys/avl.h>
+#include <sys/zfs_zone.h>
/*
* These tunables are for performance analysis.
@@ -128,6 +130,8 @@ vdev_queue_init(vdev_t *vd)
avl_create(&vq->vq_pending_tree, vdev_queue_offset_compare,
sizeof (zio_t), offsetof(struct zio, io_offset_node));
+
+ vq->vq_last_zone_id = 0;
}
void
@@ -148,6 +152,7 @@ vdev_queue_io_add(vdev_queue_t *vq, zio_t *zio)
{
spa_t *spa = zio->io_spa;
avl_add(&vq->vq_deadline_tree, zio);
+ zfs_zone_zio_enqueue(zio);
avl_add(zio->io_vdev_tree, zio);
if (spa->spa_iokstat != NULL) {
@@ -162,6 +167,7 @@ vdev_queue_io_remove(vdev_queue_t *vq, zio_t *zio)
{
spa_t *spa = zio->io_spa;
avl_remove(&vq->vq_deadline_tree, zio);
+ zfs_zone_zio_dequeue(zio);
avl_remove(zio->io_vdev_tree, zio);
if (spa->spa_iokstat != NULL) {
@@ -243,7 +249,11 @@ again:
avl_numnodes(&vq->vq_deadline_tree) == 0)
return (NULL);
+#ifdef _KERNEL
+ fio = lio = zfs_zone_schedule(vq);
+#else
fio = lio = avl_first(&vq->vq_deadline_tree);
+#endif
t = fio->io_vdev_tree;
flags = fio->io_flags & ZIO_FLAG_AGG_INHERIT;
diff --git a/usr/src/uts/common/fs/zfs/vdev_raidz.c b/usr/src/uts/common/fs/zfs/vdev_raidz.c
index 1d6cac0b69..d4b3d5b5a8 100644
--- a/usr/src/uts/common/fs/zfs/vdev_raidz.c
+++ b/usr/src/uts/common/fs/zfs/vdev_raidz.c
@@ -22,11 +22,15 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/zfs_context.h>
#include <sys/spa.h>
#include <sys/vdev_impl.h>
+#include <sys/vdev_disk.h>
+#include <sys/vdev_file.h>
+#include <sys/vdev_raidz.h>
#include <sys/zio.h>
#include <sys/zio_checksum.h>
#include <sys/fs/zfs.h>
@@ -153,6 +157,8 @@ typedef struct raidz_map {
VDEV_RAIDZ_64MUL_2((x), mask); \
}
+#define VDEV_LABEL_OFFSET(x) (x + VDEV_LABEL_START_SIZE)
+
/*
* Force reconstruction to use the general purpose method.
*/
@@ -432,12 +438,12 @@ static const zio_vsd_ops_t vdev_raidz_vsd_ops = {
};
static raidz_map_t *
-vdev_raidz_map_alloc(zio_t *zio, uint64_t unit_shift, uint64_t dcols,
- uint64_t nparity)
+vdev_raidz_map_alloc(caddr_t data, uint64_t size, uint64_t offset,
+ uint64_t unit_shift, uint64_t dcols, uint64_t nparity)
{
raidz_map_t *rm;
- uint64_t b = zio->io_offset >> unit_shift;
- uint64_t s = zio->io_size >> unit_shift;
+ uint64_t b = offset >> unit_shift;
+ uint64_t s = size >> unit_shift;
uint64_t f = b % dcols;
uint64_t o = (b / dcols) << unit_shift;
uint64_t q, r, c, bc, col, acols, scols, coff, devidx, asize, tot;
@@ -507,7 +513,7 @@ vdev_raidz_map_alloc(zio_t *zio, uint64_t unit_shift, uint64_t dcols,
for (c = 0; c < rm->rm_firstdatacol; c++)
rm->rm_col[c].rc_data = zio_buf_alloc(rm->rm_col[c].rc_size);
- rm->rm_col[c].rc_data = zio->io_data;
+ rm->rm_col[c].rc_data = data;
for (c = c + 1; c < acols; c++)
rm->rm_col[c].rc_data = (char *)rm->rm_col[c - 1].rc_data +
@@ -536,7 +542,7 @@ vdev_raidz_map_alloc(zio_t *zio, uint64_t unit_shift, uint64_t dcols,
ASSERT(rm->rm_cols >= 2);
ASSERT(rm->rm_col[0].rc_size == rm->rm_col[1].rc_size);
- if (rm->rm_firstdatacol == 1 && (zio->io_offset & (1ULL << 20))) {
+ if (rm->rm_firstdatacol == 1 && (offset & (1ULL << 20))) {
devidx = rm->rm_col[0].rc_devidx;
o = rm->rm_col[0].rc_offset;
rm->rm_col[0].rc_devidx = rm->rm_col[1].rc_devidx;
@@ -548,8 +554,6 @@ vdev_raidz_map_alloc(zio_t *zio, uint64_t unit_shift, uint64_t dcols,
rm->rm_skipstart = 1;
}
- zio->io_vsd = rm;
- zio->io_vsd_ops = &vdev_raidz_vsd_ops;
return (rm);
}
@@ -959,12 +963,9 @@ vdev_raidz_reconstruct_pq(raidz_map_t *rm, int *tgts, int ntgts)
* ~~ ~~
* __ __
* | 1 1 1 1 1 1 1 1 |
- * | 128 64 32 16 8 4 2 1 |
* | 19 205 116 29 64 16 4 1 |
* | 1 0 0 0 0 0 0 0 |
- * | 0 1 0 0 0 0 0 0 |
- * (V|I)' = | 0 0 1 0 0 0 0 0 |
- * | 0 0 0 1 0 0 0 0 |
+ * (V|I)' = | 0 0 0 1 0 0 0 0 |
* | 0 0 0 0 1 0 0 0 |
* | 0 0 0 0 0 1 0 0 |
* | 0 0 0 0 0 0 1 0 |
@@ -1496,6 +1497,152 @@ vdev_raidz_close(vdev_t *vd)
vdev_close(vd->vdev_child[c]);
}
+/*
+ * Handle a read or write I/O to a RAID-Z dump device.
+ *
+ * The dump device is in a unique situation compared to other ZFS datasets:
+ * writing to this device should be as simple and fast as possible. In
+ * addition, durability matters much less since the dump will be extracted
+ * once the machine reboots. For that reason, this function eschews parity for
+ * performance and simplicity. The dump device uses the checksum setting
+ * ZIO_CHECKSUM_NOPARITY to indicate that parity is not maintained for this
+ * dataset.
+ *
+ * Blocks of size 128 KB have been preallocated for this volume. I/Os less than
+ * 128 KB will not fill an entire block; in addition, they may not be properly
+ * aligned. In that case, this function uses the preallocated 128 KB block and
+ * omits reading or writing any "empty" portions of that block, as opposed to
+ * allocating a fresh appropriately-sized block.
+ *
+ * Looking at an example of a 32 KB I/O to a RAID-Z vdev with 5 child vdevs:
+ *
+ * vdev_raidz_io_start(data, size: 32 KB, offset: 64 KB)
+ *
+ * If this were a standard RAID-Z dataset, a block of at least 40 KB would be
+ * allocated which spans all five child vdevs. 8 KB of data would be written to
+ * each of four vdevs, with the fifth containing the parity bits.
+ *
+ * parity data data data data
+ * | PP | XX | XX | XX | XX |
+ * ^ ^ ^ ^ ^
+ * | | | | |
+ * 8 KB parity ------8 KB data blocks------
+ *
+ * However, when writing to the dump device, the layout is different:
+ *
+ * vdev_raidz_physio(data, size: 32 KB, offset: 64 KB)
+ *
+ * Unlike the normal RAID-Z case in which the block is allocated based on the
+ * I/O size, reads and writes here always use a 128 KB logical I/O size. is
+ * less than 128 KB, only the actual portions of data are written. In this
+ * example the data is written to the third data vdev since that vdev contains
+ * the offset [64 KB, 96 KB).
+ *
+ * parity data data data data
+ * | | | | XX | |
+ * ^
+ * |
+ * 32 KB data block
+ *
+ * As a result, an individual I/O may not span all child vdevs; moreover, a
+ * small I/O may only operate on a single child vdev.
+ *
+ * Note that since there are no parity bits calculated or written, this format
+ * remains the same no matter how many parity bits are used in a normal RAID-Z
+ * stripe. On a RAID-Z3 configuration with seven child vdevs, the example above
+ * would look like:
+ *
+ * parity parity parity data data data data
+ * | | | | | | XX | |
+ * ^
+ * |
+ * 32 KB data block
+ */
+int
+vdev_raidz_physio(vdev_t *vd, caddr_t data, size_t size,
+ uint64_t offset, uint64_t origoffset, boolean_t doread)
+{
+ vdev_t *tvd = vd->vdev_top;
+ vdev_t *cvd;
+ raidz_map_t *rm;
+ raidz_col_t *rc;
+ int c, err = 0;
+
+ uint64_t start, end, colstart, colend;
+ uint64_t coloffset, colsize, colskip;
+
+ int flags = doread ? B_READ : B_WRITE;
+
+#ifdef _KERNEL
+
+ /*
+ * Don't write past the end of the block
+ */
+ VERIFY3U(offset + size, <=, origoffset + SPA_MAXBLOCKSIZE);
+
+ start = offset;
+ end = start + size;
+
+ /*
+ * Allocate a RAID-Z map for this block. Note that this block starts
+ * from the "original" offset, this is, the offset of the extent which
+ * contains the requisite offset of the data being read or written.
+ *
+ * Even if this I/O operation doesn't span the full block size, let's
+ * treat the on-disk format as if the only blocks are the complete 128
+ * KB size.
+ */
+ rm = vdev_raidz_map_alloc(data - (offset - origoffset),
+ SPA_MAXBLOCKSIZE, origoffset, tvd->vdev_ashift, vd->vdev_children,
+ vd->vdev_nparity);
+
+ coloffset = origoffset;
+
+ for (c = rm->rm_firstdatacol; c < rm->rm_cols;
+ c++, coloffset += rc->rc_size) {
+ rc = &rm->rm_col[c];
+ cvd = vd->vdev_child[rc->rc_devidx];
+
+ /*
+ * Find the start and end of this column in the RAID-Z map,
+ * keeping in mind that the stated size and offset of the
+ * operation may not fill the entire column for this vdev.
+ *
+ * If any portion of the data spans this column, issue the
+ * appropriate operation to the vdev.
+ */
+ if (coloffset + rc->rc_size <= start)
+ continue;
+ if (coloffset >= end)
+ continue;
+
+ colstart = MAX(coloffset, start);
+ colend = MIN(end, coloffset + rc->rc_size);
+ colsize = colend - colstart;
+ colskip = colstart - coloffset;
+
+ VERIFY3U(colsize, <=, rc->rc_size);
+ VERIFY3U(colskip, <=, rc->rc_size);
+
+ /*
+ * Note that the child vdev will have a vdev label at the start
+ * of its range of offsets, hence the need for
+ * VDEV_LABEL_OFFSET(). See zio_vdev_child_io() for another
+ * example of why this calculation is needed.
+ */
+ if ((err = vdev_disk_physio(cvd,
+ ((char *)rc->rc_data) + colskip, colsize,
+ VDEV_LABEL_OFFSET(rc->rc_offset) + colskip,
+ flags)) != 0)
+ break;
+ }
+
+ vdev_raidz_map_free(rm);
+#endif /* KERNEL */
+
+ return (err);
+}
+
static uint64_t
vdev_raidz_asize(vdev_t *vd, uint64_t psize)
{
@@ -1531,9 +1678,13 @@ vdev_raidz_io_start(zio_t *zio)
raidz_col_t *rc;
int c, i;
- rm = vdev_raidz_map_alloc(zio, tvd->vdev_ashift, vd->vdev_children,
+ rm = vdev_raidz_map_alloc(zio->io_data, zio->io_size, zio->io_offset,
+ tvd->vdev_ashift, vd->vdev_children,
vd->vdev_nparity);
+ zio->io_vsd = rm;
+ zio->io_vsd_ops = &vdev_raidz_vsd_ops;
+
ASSERT3U(rm->rm_asize, ==, vdev_psize_to_asize(vd, zio->io_size));
if (zio->io_type == ZIO_TYPE_WRITE) {
@@ -1664,6 +1815,13 @@ raidz_parity_verify(zio_t *zio, raidz_map_t *rm)
int c, ret = 0;
raidz_col_t *rc;
+ blkptr_t *bp = zio->io_bp;
+ enum zio_checksum checksum = (bp == NULL ? zio->io_prop.zp_checksum :
+ (BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : BP_GET_CHECKSUM(bp)));
+
+ if (checksum == ZIO_CHECKSUM_NOPARITY)
+ return (ret);
+
for (c = 0; c < rm->rm_firstdatacol; c++) {
rc = &rm->rm_col[c];
if (!rc->rc_tried || rc->rc_error != 0)
diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c
index 7d02bb67d6..15b19b0d06 100644
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c
@@ -613,9 +613,10 @@ zfs_secpolicy_setprop(const char *dsname, zfs_prop_t prop, nvpair_t *propval,
* Check permissions for special properties.
*/
switch (prop) {
+ case ZFS_PROP_DEDUP:
case ZFS_PROP_ZONED:
/*
- * Disallow setting of 'zoned' from within a local zone.
+ * Disallow setting these properties from within a local zone.
*/
if (!INGLOBALZONE(curproc))
return (SET_ERROR(EPERM));
@@ -1978,7 +1979,8 @@ zfs_ioc_vdev_setfru(zfs_cmd_t *zc)
}
static int
-zfs_ioc_objset_stats_impl(zfs_cmd_t *zc, objset_t *os)
+zfs_ioc_objset_stats_impl(zfs_cmd_t *zc, objset_t *os,
+ boolean_t cachedpropsonly)
{
int error = 0;
nvlist_t *nv;
@@ -1996,7 +1998,8 @@ zfs_ioc_objset_stats_impl(zfs_cmd_t *zc, objset_t *os)
* XXX reading with out owning
*/
if (!zc->zc_objset_stats.dds_inconsistent &&
- dmu_objset_type(os) == DMU_OST_ZVOL) {
+ dmu_objset_type(os) == DMU_OST_ZVOL &&
+ !cachedpropsonly) {
error = zvol_get_stats(os, nv);
if (error == EIO)
return (error);
@@ -2023,11 +2026,24 @@ static int
zfs_ioc_objset_stats(zfs_cmd_t *zc)
{
objset_t *os;
+ nvlist_t *nvl = NULL;
+ boolean_t cachedpropsonly = B_FALSE;
int error;
+ if (zc->zc_nvlist_src != NULL &&
+ (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size,
+ zc->zc_iflags, &nvl) != 0))
+ return (error);
+
+ if (nvl != NULL) {
+ (void) nvlist_lookup_boolean_value(nvl, "cachedpropsonly",
+ &cachedpropsonly);
+ nvlist_free(nvl);
+ }
+
error = dmu_objset_hold(zc->zc_name, FTAG, &os);
if (error == 0) {
- error = zfs_ioc_objset_stats_impl(zc, os);
+ error = zfs_ioc_objset_stats_impl(zc, os, cachedpropsonly);
dmu_objset_rele(os, FTAG);
}
@@ -2221,8 +2237,21 @@ static int
zfs_ioc_snapshot_list_next(zfs_cmd_t *zc)
{
objset_t *os;
+ nvlist_t *nvl = NULL;
+ boolean_t cachedpropsonly = B_FALSE;
int error;
+ if (zc->zc_nvlist_src != NULL &&
+ (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size,
+ zc->zc_iflags, &nvl) != 0))
+ return (error);
+
+ if (nvl != NULL) {
+ (void) nvlist_lookup_boolean_value(nvl, "cachedpropsonly",
+ &cachedpropsonly);
+ nvlist_free(nvl);
+ }
+
error = dmu_objset_hold(zc->zc_name, FTAG, &os);
if (error != 0) {
return (error == ENOENT ? ESRCH : error);
@@ -2251,8 +2280,10 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc)
objset_t *ossnap;
error = dmu_objset_from_ds(ds, &ossnap);
- if (error == 0)
- error = zfs_ioc_objset_stats_impl(zc, ossnap);
+ if (error == 0) {
+ error = zfs_ioc_objset_stats_impl(zc,
+ ossnap, cachedpropsonly);
+ }
dsl_dataset_rele(ds, FTAG);
}
} else if (error == ENOENT) {
@@ -2981,6 +3012,7 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver,
uint64_t sense = ZFS_PROP_UNDEFINED;
uint64_t norm = ZFS_PROP_UNDEFINED;
uint64_t u8 = ZFS_PROP_UNDEFINED;
+ int error;
ASSERT(zplprops != NULL);
@@ -3024,8 +3056,9 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver,
VERIFY(nvlist_add_uint64(zplprops,
zfs_prop_to_name(ZFS_PROP_VERSION), zplver) == 0);
- if (norm == ZFS_PROP_UNDEFINED)
- VERIFY(zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &norm) == 0);
+ if (norm == ZFS_PROP_UNDEFINED &&
+ (error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &norm)) != 0)
+ return (error);
VERIFY(nvlist_add_uint64(zplprops,
zfs_prop_to_name(ZFS_PROP_NORMALIZE), norm) == 0);
@@ -3034,13 +3067,15 @@ zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver,
*/
if (norm)
u8 = 1;
- if (u8 == ZFS_PROP_UNDEFINED)
- VERIFY(zfs_get_zplprop(os, ZFS_PROP_UTF8ONLY, &u8) == 0);
+ if (u8 == ZFS_PROP_UNDEFINED &&
+ (error = zfs_get_zplprop(os, ZFS_PROP_UTF8ONLY, &u8)) != 0)
+ return (error);
VERIFY(nvlist_add_uint64(zplprops,
zfs_prop_to_name(ZFS_PROP_UTF8ONLY), u8) == 0);
- if (sense == ZFS_PROP_UNDEFINED)
- VERIFY(zfs_get_zplprop(os, ZFS_PROP_CASE, &sense) == 0);
+ if (sense == ZFS_PROP_UNDEFINED &&
+ (error = zfs_get_zplprop(os, ZFS_PROP_CASE, &sense)) != 0)
+ return (error);
VERIFY(nvlist_add_uint64(zplprops,
zfs_prop_to_name(ZFS_PROP_CASE), sense) == 0);
diff --git a/usr/src/uts/common/fs/zfs/zfs_vfsops.c b/usr/src/uts/common/fs/zfs/zfs_vfsops.c
index 108a0b45a1..e337861cd4 100644
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c
+++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/* Portions Copyright 2010 Robert Milkowski */
@@ -1955,6 +1956,17 @@ zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr)
if (zfsvfs->z_ctldir != NULL)
zfsctl_destroy(zfsvfs);
+ /*
+ * If we're doing a forced unmount on a dataset which still has
+ * references and is in a zone, then we need to cleanup the zone
+ * reference at this point or else the zone will never be able to
+ * shutdown.
+ */
+ if ((fflag & MS_FORCE) && vfsp->vfs_count > 1 && vfsp->vfs_zone) {
+ zone_rele_ref(&vfsp->vfs_implp->vi_zone_ref, ZONE_REF_VFS);
+ vfsp->vfs_zone = NULL;
+ }
+
return (0);
}
diff --git a/usr/src/uts/common/fs/zfs/zfs_vnops.c b/usr/src/uts/common/fs/zfs/zfs_vnops.c
index 76408bbb6c..161e573175 100644
--- a/usr/src/uts/common/fs/zfs/zfs_vnops.c
+++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c
@@ -26,6 +26,10 @@
/* Portions Copyright 2007 Jeremy Teo */
/* Portions Copyright 2010 Robert Milkowski */
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
+
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
@@ -621,6 +625,17 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
if (limit == RLIM64_INFINITY || limit > MAXOFFSET_T)
limit = MAXOFFSET_T;
+ /*
+ * Pre-fault the pages to ensure slow (eg NFS) pages
+ * don't hold up txg.
+ * Skip this if uio contains loaned arc_buf.
+ */
+ if ((uio->uio_extflg == UIO_XUIO) &&
+ (((xuio_t *)uio)->xu_type == UIOTYPE_ZEROCOPY))
+ xuio = (xuio_t *)uio;
+ else
+ uio_prefaultpages(n, uio);
+
ZFS_ENTER(zfsvfs);
ZFS_VERIFY_ZP(zp);
@@ -663,17 +678,6 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct)
}
/*
- * Pre-fault the pages to ensure slow (eg NFS) pages
- * don't hold up txg.
- * Skip this if uio contains loaned arc_buf.
- */
- if ((uio->uio_extflg == UIO_XUIO) &&
- (((xuio_t *)uio)->xu_type == UIOTYPE_ZEROCOPY))
- xuio = (xuio_t *)uio;
- else
- uio_prefaultpages(MIN(n, max_blksz), uio);
-
- /*
* If in append mode, set the io offset pointer to eof.
*/
if (ioflag & FAPPEND) {
@@ -913,9 +917,6 @@ again:
break;
ASSERT(tx_bytes == nbytes);
n -= nbytes;
-
- if (!xuio && n > 0)
- uio_prefaultpages(MIN(n, max_blksz), uio);
}
zfs_range_unlock(rl);
@@ -4159,6 +4160,8 @@ top:
&zp->z_pflags, 8);
zfs_tstamp_update_setup(zp, CONTENT_MODIFIED, mtime, ctime,
B_TRUE);
+ err = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx);
+
zfs_log_write(zfsvfs->z_log, tx, TX_WRITE, zp, off, len, 0);
}
dmu_tx_commit(tx);
@@ -4669,27 +4672,6 @@ zfs_addmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr,
return (0);
}
-/*
- * The reason we push dirty pages as part of zfs_delmap() is so that we get a
- * more accurate mtime for the associated file. Since we don't have a way of
- * detecting when the data was actually modified, we have to resort to
- * heuristics. If an explicit msync() is done, then we mark the mtime when the
- * last page is pushed. The problem occurs when the msync() call is omitted,
- * which by far the most common case:
- *
- * open()
- * mmap()
- * <modify memory>
- * munmap()
- * close()
- * <time lapse>
- * putpage() via fsflush
- *
- * If we wait until fsflush to come along, we can have a modification time that
- * is some arbitrary point in the future. In order to prevent this in the
- * common case, we flush pages whenever a (MAP_SHARED, PROT_WRITE) mapping is
- * torn down.
- */
/* ARGSUSED */
static int
zfs_delmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr,
@@ -4701,10 +4683,6 @@ zfs_delmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr,
ASSERT3U(VTOZ(vp)->z_mapcnt, >=, pages);
atomic_add_64(&VTOZ(vp)->z_mapcnt, -pages);
- if ((flags & MAP_SHARED) && (prot & PROT_WRITE) &&
- vn_has_cached_data(vp))
- (void) VOP_PUTPAGE(vp, off, len, B_ASYNC, cr, ct);
-
return (0);
}
diff --git a/usr/src/uts/common/fs/zfs/zfs_zone.c b/usr/src/uts/common/fs/zfs/zfs_zone.c
new file mode 100644
index 0000000000..6e0864c799
--- /dev/null
+++ b/usr/src/uts/common/fs/zfs/zfs_zone.c
@@ -0,0 +1,1179 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
+#include <sys/spa.h>
+#include <sys/vdev_impl.h>
+#include <sys/zfs_zone.h>
+
+#ifndef _KERNEL
+
+/*
+ * Stubs for when compiling for user-land.
+ */
+
+void
+zfs_zone_io_throttle(zfs_zone_iop_type_t type)
+{
+}
+
+void
+zfs_zone_zio_init(zio_t *zp)
+{
+}
+
+void
+zfs_zone_zio_start(zio_t *zp)
+{
+}
+
+void
+zfs_zone_zio_done(zio_t *zp)
+{
+}
+
+void
+zfs_zone_zio_dequeue(zio_t *zp)
+{
+}
+
+void
+zfs_zone_zio_enqueue(zio_t *zp)
+{
+}
+
+/*ARGSUSED*/
+void
+zfs_zone_report_txg_sync(void *dp)
+{
+}
+
+hrtime_t
+zfs_zone_txg_delay()
+{
+ return (MSEC2NSEC(10));
+}
+
+#else
+
+/*
+ * The real code.
+ */
+
+#include <sys/systm.h>
+#include <sys/thread.h>
+#include <sys/proc.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/atomic.h>
+#include <sys/zio.h>
+#include <sys/zone.h>
+#include <sys/avl.h>
+#include <sys/sdt.h>
+#include <sys/ddi.h>
+
+/*
+ * The zone throttle delays read and write operations from certain zones based
+ * on each zone's IO utilitzation. Once a cycle (defined by zfs_zone_cycle_time
+ * below), the delays for each zone are recalculated based on the utilization
+ * over the previous window.
+ */
+boolean_t zfs_zone_delay_enable = B_TRUE; /* enable IO throttle */
+uint16_t zfs_zone_delay_step = 5; /* amount to change delay */
+uint16_t zfs_zone_delay_ceiling = 100; /* longest possible delay */
+
+hrtime_t zfs_zone_last_checked = 0;
+
+boolean_t zfs_zone_priority_enable = B_TRUE; /* enable IO priority */
+
+/*
+ * For certain workloads, one zone may be issuing primarily sequential I/O and
+ * another primarily random I/O. The sequential I/O will complete much more
+ * quickly than the random I/O, driving the average system latency for those
+ * operations way down. As a result, the random I/O may be throttled back, even
+ * though the sequential I/O should be throttled to allow the random I/O more
+ * access to the disk.
+ *
+ * This tunable limits the discrepancy between the read and write system
+ * latency. If one becomes excessively high, this tunable prevents the I/O
+ * throttler from exacerbating the imbalance.
+ */
+uint_t zfs_zone_rw_lat_limit = 10;
+
+
+/*
+ * The I/O throttle will only start delaying zones when it detects disk
+ * utilization has reached a certain level. This tunable controls the threshold
+ * at which the throttle will start delaying zones. The calculation should
+ * correspond closely with the %b column from iostat.
+ */
+uint_t zfs_zone_util_threshold = 80;
+
+/*
+ * Throughout this subsystem, our timestamps are in microseconds. Our system
+ * average cycle is one second or 1 million microseconds. Our zone counter
+ * update cycle is two seconds or 2 million microseconds. We use a longer
+ * duration for that cycle because some ops can see a little over two seconds of
+ * latency when they are being starved by another zone.
+ */
+uint_t zfs_zone_sys_avg_cycle = 1000000; /* 1 s */
+uint_t zfs_zone_cycle_time = 2000000; /* 2 s */
+
+uint_t zfs_zone_adjust_time = 250000; /* 250 ms */
+
+typedef struct {
+ hrtime_t cycle_start;
+ int cycle_cnt;
+ hrtime_t cycle_lat;
+ hrtime_t sys_avg_lat;
+} sys_lat_cycle_t;
+
+typedef struct {
+ hrtime_t zi_now;
+ uint_t zi_avgrlat;
+ uint_t zi_avgwlat;
+ uint64_t zi_totpri;
+ uint64_t zi_totutil;
+ int zi_active;
+ uint_t zi_diskutil;
+} zoneio_stats_t;
+
+static sys_lat_cycle_t rd_lat;
+static sys_lat_cycle_t wr_lat;
+
+/*
+ * Some basic disk stats to determine disk utilization.
+ */
+kmutex_t zfs_disk_lock;
+uint_t zfs_disk_rcnt;
+hrtime_t zfs_disk_rtime = 0;
+hrtime_t zfs_disk_rlastupdate = 0;
+
+hrtime_t zfs_disk_last_rtime = 0;
+
+/*
+ * Data used to keep track of how often txg flush is running.
+ */
+extern int zfs_txg_timeout;
+static uint_t txg_last_check;
+static uint_t txg_cnt;
+static uint_t txg_flush_rate;
+
+boolean_t zfs_zone_schedule_enable = B_TRUE; /* enable IO sched. */
+/*
+ * Threshold for when zio scheduling should kick in.
+ *
+ * This threshold is based on 1/2 of the zfs_vdev_max_pending value for the
+ * number of I/Os that can be pending on a device. If there are more than a
+ * few ops already queued up, beyond those already issued to the vdev, then
+ * use scheduling to get the next zio.
+ */
+int zfs_zone_schedule_thresh = 5;
+
+/*
+ * Tunables for delay throttling when TxG flush is occurring.
+ */
+int zfs_zone_txg_throttle_scale = 2;
+hrtime_t zfs_zone_txg_delay_nsec = MSEC2NSEC(20);
+
+typedef struct {
+ int zq_qdepth;
+ int zq_priority;
+ int zq_wt;
+ zoneid_t zq_zoneid;
+} zone_q_bump_t;
+
+/*
+ * This uses gethrtime() but returns a value in usecs.
+ */
+#define GET_USEC_TIME (gethrtime() / 1000)
+#define NANO_TO_MICRO(x) (x / (NANOSEC / MICROSEC))
+
+/*
+ * Keep track of the zone's ZFS IOPs.
+ *
+ * If the number of ops is >1 then we can just use that value. However,
+ * if the number of ops is <2 then we might have a zone which is trying to do
+ * IO but is not able to get any ops through the system. We don't want to lose
+ * track of this zone so we factor in its decayed count into the current count.
+ *
+ * Each cycle (zfs_zone_sys_avg_cycle) we want to update the decayed count.
+ * However, since this calculation is driven by IO activity and since IO does
+ * not happen at fixed intervals, we use a timestamp to see when the last update
+ * was made. If it was more than one cycle ago, then we need to decay the
+ * historical count by the proper number of additional cycles in which no IO was
+ * performed.
+ *
+ * Return true if we actually computed a new historical count.
+ * If we're still within an active cycle there is nothing to do, return false.
+ */
+static hrtime_t
+compute_historical_zone_cnt(hrtime_t unow, sys_zio_cntr_t *cp)
+{
+ hrtime_t delta;
+ int gen_cnt;
+
+ /*
+ * Check if its time to recompute a new zone count.
+ * If we're still collecting data for the current cycle, return false.
+ */
+ delta = unow - cp->cycle_start;
+ if (delta < zfs_zone_cycle_time)
+ return (delta);
+
+ /* A previous cycle is past, compute the new zone count. */
+
+ /*
+ * Figure out how many generations we have to decay the historical
+ * count, since multiple cycles may have elapsed since our last IO.
+ * We depend on int rounding here.
+ */
+ gen_cnt = (int)(delta / zfs_zone_cycle_time);
+
+ /* If more than 5 cycles since last the IO, reset count. */
+ if (gen_cnt > 5) {
+ cp->zone_avg_cnt = 0;
+ } else {
+ /* Update the count. */
+ int i;
+
+ /*
+ * If the zone did more than 1 IO, just use its current count
+ * as the historical value, otherwise decay the historical
+ * count and factor that into the new historical count. We
+ * pick a threshold > 1 so that we don't lose track of IO due
+ * to int rounding.
+ */
+ if (cp->cycle_cnt > 1)
+ cp->zone_avg_cnt = cp->cycle_cnt;
+ else
+ cp->zone_avg_cnt = cp->cycle_cnt +
+ (cp->zone_avg_cnt / 2);
+
+ /*
+ * If more than one generation has elapsed since the last
+ * update, decay the values further.
+ */
+ for (i = 1; i < gen_cnt; i++)
+ cp->zone_avg_cnt = cp->zone_avg_cnt / 2;
+ }
+
+ /* A new cycle begins. */
+ cp->cycle_start = unow;
+ cp->cycle_cnt = 0;
+
+ return (0);
+}
+
+/*
+ * Add IO op data to the zone.
+ */
+static void
+add_zone_iop(zone_t *zonep, hrtime_t unow, zfs_zone_iop_type_t op)
+{
+ switch (op) {
+ case ZFS_ZONE_IOP_READ:
+ (void) compute_historical_zone_cnt(unow, &zonep->zone_rd_ops);
+ zonep->zone_rd_ops.cycle_cnt++;
+ break;
+ case ZFS_ZONE_IOP_WRITE:
+ (void) compute_historical_zone_cnt(unow, &zonep->zone_wr_ops);
+ zonep->zone_wr_ops.cycle_cnt++;
+ break;
+ case ZFS_ZONE_IOP_LOGICAL_WRITE:
+ (void) compute_historical_zone_cnt(unow, &zonep->zone_lwr_ops);
+ zonep->zone_lwr_ops.cycle_cnt++;
+ break;
+ }
+}
+
+/*
+ * Use a decaying average to keep track of the overall system latency.
+ *
+ * We want to have the recent activity heavily weighted, but if the
+ * activity decreases or stops, then the average should quickly decay
+ * down to the new value.
+ *
+ * Each cycle (zfs_zone_sys_avg_cycle) we want to update the decayed average.
+ * However, since this calculation is driven by IO activity and since IO does
+ * not happen
+ *
+ * at fixed intervals, we use a timestamp to see when the last update was made.
+ * If it was more than one cycle ago, then we need to decay the average by the
+ * proper number of additional cycles in which no IO was performed.
+ *
+ * Return true if we actually computed a new system average.
+ * If we're still within an active cycle there is nothing to do, return false.
+ */
+static int
+compute_new_sys_avg(hrtime_t unow, sys_lat_cycle_t *cp)
+{
+ hrtime_t delta;
+ int gen_cnt;
+
+ /*
+ * Check if its time to recompute a new average.
+ * If we're still collecting data for the current cycle, return false.
+ */
+ delta = unow - cp->cycle_start;
+ if (delta < zfs_zone_sys_avg_cycle)
+ return (0);
+
+ /* A previous cycle is past, compute a new system average. */
+
+ /*
+ * Figure out how many generations we have to decay, since multiple
+ * cycles may have elapsed since our last IO.
+ * We count on int rounding here.
+ */
+ gen_cnt = (int)(delta / zfs_zone_sys_avg_cycle);
+
+ /* If more than 5 cycles since last the IO, reset average. */
+ if (gen_cnt > 5) {
+ cp->sys_avg_lat = 0;
+ } else {
+ /* Update the average. */
+ int i;
+
+ cp->sys_avg_lat =
+ (cp->sys_avg_lat + cp->cycle_lat) / (1 + cp->cycle_cnt);
+
+ /*
+ * If more than one generation has elapsed since the last
+ * update, decay the values further.
+ */
+ for (i = 1; i < gen_cnt; i++)
+ cp->sys_avg_lat = cp->sys_avg_lat / 2;
+ }
+
+ /* A new cycle begins. */
+ cp->cycle_start = unow;
+ cp->cycle_cnt = 0;
+ cp->cycle_lat = 0;
+
+ return (1);
+}
+
+static void
+add_sys_iop(hrtime_t unow, int op, int lat)
+{
+ switch (op) {
+ case ZFS_ZONE_IOP_READ:
+ (void) compute_new_sys_avg(unow, &rd_lat);
+ rd_lat.cycle_cnt++;
+ rd_lat.cycle_lat += lat;
+ break;
+ case ZFS_ZONE_IOP_WRITE:
+ (void) compute_new_sys_avg(unow, &wr_lat);
+ wr_lat.cycle_cnt++;
+ wr_lat.cycle_lat += lat;
+ break;
+ }
+}
+
+/*
+ * Get the zone IO counts.
+ */
+static uint_t
+calc_zone_cnt(hrtime_t unow, sys_zio_cntr_t *cp)
+{
+ hrtime_t delta;
+ uint_t cnt;
+
+ if ((delta = compute_historical_zone_cnt(unow, cp)) == 0) {
+ /*
+ * No activity in the current cycle, we already have the
+ * historical data so we'll use that.
+ */
+ cnt = cp->zone_avg_cnt;
+ } else {
+ /*
+ * If we're less than half way through the cycle then use
+ * the current count plus half the historical count, otherwise
+ * just use the current count.
+ */
+ if (delta < (zfs_zone_cycle_time / 2))
+ cnt = cp->cycle_cnt + (cp->zone_avg_cnt / 2);
+ else
+ cnt = cp->cycle_cnt;
+ }
+
+ return (cnt);
+}
+
+/*
+ * Get the average read/write latency in usecs for the system.
+ */
+static uint_t
+calc_avg_lat(hrtime_t unow, sys_lat_cycle_t *cp)
+{
+ if (compute_new_sys_avg(unow, cp)) {
+ /*
+ * No activity in the current cycle, we already have the
+ * historical data so we'll use that.
+ */
+ return (cp->sys_avg_lat);
+ } else {
+ /*
+ * We're within a cycle; weight the current activity higher
+ * compared to the historical data and use that.
+ */
+ extern void __dtrace_probe_zfs__zone__calc__wt__avg(uintptr_t,
+ uintptr_t, uintptr_t);
+
+ __dtrace_probe_zfs__zone__calc__wt__avg(
+ (uintptr_t)cp->sys_avg_lat,
+ (uintptr_t)cp->cycle_lat,
+ (uintptr_t)cp->cycle_cnt);
+
+ return ((cp->sys_avg_lat + (cp->cycle_lat * 8)) /
+ (1 + (cp->cycle_cnt * 8)));
+ }
+}
+
+/*
+ * Account for the current IOP on the zone and for the system as a whole.
+ * The latency parameter is in usecs.
+ */
+static void
+add_iop(zone_t *zonep, hrtime_t unow, zfs_zone_iop_type_t op, hrtime_t lat)
+{
+ /* Add op to zone */
+ add_zone_iop(zonep, unow, op);
+
+ /* Track system latency */
+ if (op != ZFS_ZONE_IOP_LOGICAL_WRITE)
+ add_sys_iop(unow, op, lat);
+}
+
+/*
+ * Calculate and return the total number of read ops, write ops and logical
+ * write ops for the given zone. If the zone has issued operations of any type
+ * return a non-zero value, otherwise return 0.
+ */
+static int
+get_zone_io_cnt(hrtime_t unow, zone_t *zonep, uint_t *rops, uint_t *wops,
+ uint_t *lwops)
+{
+ *rops = calc_zone_cnt(unow, &zonep->zone_rd_ops);
+ *wops = calc_zone_cnt(unow, &zonep->zone_wr_ops);
+ *lwops = calc_zone_cnt(unow, &zonep->zone_lwr_ops);
+
+ extern void __dtrace_probe_zfs__zone__io__cnt(uintptr_t,
+ uintptr_t, uintptr_t, uintptr_t);
+
+ __dtrace_probe_zfs__zone__io__cnt((uintptr_t)zonep->zone_id,
+ (uintptr_t)(*rops), (uintptr_t)*wops, (uintptr_t)*lwops);
+
+ return (*rops | *wops | *lwops);
+}
+
+/*
+ * Get the average read/write latency in usecs for the system.
+ */
+static void
+get_sys_avg_lat(hrtime_t unow, uint_t *rlat, uint_t *wlat)
+{
+ *rlat = calc_avg_lat(unow, &rd_lat);
+ *wlat = calc_avg_lat(unow, &wr_lat);
+
+ /*
+ * In an attempt to improve the accuracy of the throttling algorithm,
+ * assume that IO operations can't have zero latency. Instead, assume
+ * a reasonable lower bound for each operation type. If the actual
+ * observed latencies are non-zero, use those latency values instead.
+ */
+ if (*rlat == 0)
+ *rlat = 1000;
+ if (*wlat == 0)
+ *wlat = 1000;
+
+ extern void __dtrace_probe_zfs__zone__sys__avg__lat(uintptr_t,
+ uintptr_t);
+
+ __dtrace_probe_zfs__zone__sys__avg__lat((uintptr_t)(*rlat),
+ (uintptr_t)*wlat);
+}
+
+/*
+ * Find disk utilization for each zone and average utilization for all active
+ * zones.
+ */
+static int
+zfs_zone_wait_adjust_calculate_cb(zone_t *zonep, void *arg)
+{
+ zoneio_stats_t *sp = arg;
+ uint_t rops, wops, lwops;
+
+ if (zonep->zone_id == GLOBAL_ZONEID ||
+ get_zone_io_cnt(sp->zi_now, zonep, &rops, &wops, &lwops) == 0) {
+ zonep->zone_io_util = 0;
+ return (0);
+ }
+
+ zonep->zone_io_util = (rops * sp->zi_avgrlat) +
+ (wops * sp->zi_avgwlat) + (lwops * sp->zi_avgwlat);
+ sp->zi_totutil += zonep->zone_io_util;
+
+ if (zonep->zone_io_util > 0) {
+ sp->zi_active++;
+ sp->zi_totpri += zonep->zone_zfs_io_pri;
+ }
+
+ /*
+ * sdt:::zfs-zone-utilization
+ *
+ * arg0: zone ID
+ * arg1: read operations observed during time window
+ * arg2: physical write operations observed during time window
+ * arg3: logical write ops observed during time window
+ * arg4: calculated utilization given read and write ops
+ * arg5: I/O priority assigned to this zone
+ */
+ extern void __dtrace_probe_zfs__zone__utilization(
+ uint_t, uint_t, uint_t, uint_t, uint_t, uint_t);
+
+ __dtrace_probe_zfs__zone__utilization((uint_t)(zonep->zone_id),
+ (uint_t)rops, (uint_t)wops, (uint_t)lwops,
+ (uint_t)zonep->zone_io_util, (uint_t)zonep->zone_zfs_io_pri);
+
+ return (0);
+}
+
+static void
+zfs_zone_delay_inc(zone_t *zonep)
+{
+ if (zonep->zone_io_delay < zfs_zone_delay_ceiling)
+ zonep->zone_io_delay += zfs_zone_delay_step;
+}
+
+static void
+zfs_zone_delay_dec(zone_t *zonep)
+{
+ if (zonep->zone_io_delay > 0)
+ zonep->zone_io_delay -= zfs_zone_delay_step;
+}
+
+/*
+ * For all zones "far enough" away from the average utilization, increase that
+ * zones delay. Otherwise, reduce its delay.
+ */
+static int
+zfs_zone_wait_adjust_delay_cb(zone_t *zonep, void *arg)
+{
+ zoneio_stats_t *sp = arg;
+ uint16_t delay = zonep->zone_io_delay;
+ uint_t fairutil = 0;
+
+ zonep->zone_io_util_above_avg = B_FALSE;
+
+ /*
+ * Given the calculated total utilitzation for all zones, calculate the
+ * fair share of I/O for this zone.
+ */
+ if (zfs_zone_priority_enable && sp->zi_totpri > 0) {
+ fairutil = (sp->zi_totutil * zonep->zone_zfs_io_pri) /
+ sp->zi_totpri;
+ } else if (sp->zi_active > 0) {
+ fairutil = sp->zi_totutil / sp->zi_active;
+ }
+
+ /*
+ * Adjust each IO's delay. If the overall delay becomes too high, avoid
+ * increasing beyond the ceiling value.
+ */
+ if (zonep->zone_io_util > fairutil &&
+ sp->zi_diskutil > zfs_zone_util_threshold) {
+ zonep->zone_io_util_above_avg = B_TRUE;
+
+ if (sp->zi_active > 1)
+ zfs_zone_delay_inc(zonep);
+ } else if (zonep->zone_io_util < fairutil || sp->zi_active <= 1) {
+ zfs_zone_delay_dec(zonep);
+ }
+
+ /*
+ * sdt:::zfs-zone-throttle
+ *
+ * arg0: zone ID
+ * arg1: old delay for this zone
+ * arg2: new delay for this zone
+ * arg3: calculated fair I/O utilization
+ * arg4: actual I/O utilization
+ */
+ extern void __dtrace_probe_zfs__zone__throttle(
+ uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+
+ __dtrace_probe_zfs__zone__throttle(
+ (uintptr_t)zonep->zone_id, (uintptr_t)delay,
+ (uintptr_t)zonep->zone_io_delay, (uintptr_t)fairutil,
+ (uintptr_t)zonep->zone_io_util);
+
+ return (0);
+}
+
+/*
+ * Examine the utilization between different zones, and adjust the delay for
+ * each zone appropriately.
+ */
+static void
+zfs_zone_wait_adjust(hrtime_t unow)
+{
+ zoneio_stats_t stats;
+
+ (void) bzero(&stats, sizeof (stats));
+
+ stats.zi_now = unow;
+ get_sys_avg_lat(unow, &stats.zi_avgrlat, &stats.zi_avgwlat);
+
+ if (stats.zi_avgrlat > stats.zi_avgwlat * zfs_zone_rw_lat_limit)
+ stats.zi_avgrlat = stats.zi_avgwlat * zfs_zone_rw_lat_limit;
+ else if (stats.zi_avgrlat * zfs_zone_rw_lat_limit < stats.zi_avgwlat)
+ stats.zi_avgwlat = stats.zi_avgrlat * zfs_zone_rw_lat_limit;
+
+ if (zone_walk(zfs_zone_wait_adjust_calculate_cb, &stats) != 0)
+ return;
+
+ /*
+ * Calculate disk utilization for the most recent period.
+ */
+ if (zfs_disk_last_rtime == 0 || unow - zfs_zone_last_checked <= 0) {
+ stats.zi_diskutil = 0;
+ } else {
+ stats.zi_diskutil =
+ ((zfs_disk_rtime - zfs_disk_last_rtime) * 100) /
+ ((unow - zfs_zone_last_checked) * 1000);
+ }
+ zfs_disk_last_rtime = zfs_disk_rtime;
+
+ /*
+ * sdt:::zfs-zone-stats
+ *
+ * Statistics observed over the last period:
+ *
+ * arg0: average system read latency
+ * arg1: average system write latency
+ * arg2: number of active zones
+ * arg3: total I/O 'utilization' for all zones
+ * arg4: total I/O priority of all active zones
+ * arg5: calculated disk utilization
+ */
+ extern void __dtrace_probe_zfs__zone__stats(
+ uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+
+ __dtrace_probe_zfs__zone__stats((uintptr_t)(stats.zi_avgrlat),
+ (uintptr_t)(stats.zi_avgwlat),
+ (uintptr_t)(stats.zi_active),
+ (uintptr_t)(stats.zi_totutil),
+ (uintptr_t)(stats.zi_totpri),
+ (uintptr_t)(stats.zi_diskutil));
+
+ (void) zone_walk(zfs_zone_wait_adjust_delay_cb, &stats);
+}
+
+/*
+ * Callback used to calculate a zone's IO schedule priority.
+ *
+ * We scan the zones looking for ones with ops in the queue. Out of those,
+ * we pick the one that calculates to the highest schedule priority.
+ */
+static int
+get_sched_pri_cb(zone_t *zonep, void *arg)
+{
+ int pri;
+ zone_q_bump_t *qbp = arg;
+
+ extern void __dtrace_probe_zfs__zone__enqueued(uintptr_t, uintptr_t);
+ __dtrace_probe_zfs__zone__enqueued((uintptr_t)(zonep->zone_id),
+ (uintptr_t)(zonep->zone_zfs_queued));
+
+ if (zonep->zone_zfs_queued == 0) {
+ zonep->zone_zfs_weight = 0;
+ return (0);
+ }
+
+ /*
+ * On each pass, increment the zone's weight. We use this as input
+ * to the calculation to prevent starvation. The value is reset
+ * each time we issue an IO for this zone so zones which haven't
+ * done any IO over several iterations will see their weight max
+ * out.
+ */
+ if (zonep->zone_zfs_weight < 20)
+ zonep->zone_zfs_weight++;
+
+ /*
+ * This zone's IO priority is the inverse of the number of IOs
+ * the zone has enqueued * zone's configured priority * weight.
+ * The queue depth has already been scaled by 10 to avoid problems
+ * with int rounding.
+ *
+ * This means that zones with fewer IOs in the queue will get
+ * preference unless other zone's assigned priority pulls them
+ * ahead. The weight is factored in to help ensure that zones
+ * which haven't done IO in a while aren't getting starved.
+ */
+ pri = (qbp->zq_qdepth / zonep->zone_zfs_queued) *
+ zonep->zone_zfs_io_pri * zonep->zone_zfs_weight;
+
+ /*
+ * If this zone has a higher priority than what we found so far,
+ * schedule it next.
+ */
+ if (pri > qbp->zq_priority) {
+ qbp->zq_zoneid = zonep->zone_id;
+ qbp->zq_priority = pri;
+ qbp->zq_wt = zonep->zone_zfs_weight;
+ }
+ return (0);
+}
+
+/*
+ * See if we need to bump a zone's zio to the head of the queue.
+ *
+ * For single-threaded synchronous workloads a zone cannot get more than
+ * 1 op into the queue at a time unless the zone is running multiple workloads
+ * in parallel. This can cause an imbalance in performance if there are zones
+ * with many parallel workloads (and ops in the queue) vs. other zones which
+ * are doing simple single-threaded workloads, such as interactive tasks in the
+ * shell. These zones can get backed up behind a deep queue and their IO
+ * performance will appear to be very poor as a result. This can make the
+ * zone work badly for interactive behavior.
+ *
+ * The scheduling algorithm kicks in once we start to get a deeper queue.
+ * Once that occurs, we look at all of the zones to see which one calculates
+ * to the highest priority. We bump that zone's first zio to the head of the
+ * queue.
+ *
+ * We use a counter on the zone so that we can quickly find how many ops each
+ * zone has in the queue without having to search the entire queue itself.
+ * This scales better since the number of zones is expected to be on the
+ * order of 10-100 whereas the queue depth can be in the range of 50-2000.
+ * In addition, since the zio's in the queue only have the zoneid, we would
+ * have to look up the zone for each zio enqueued and that means the overhead
+ * for scanning the queue each time would be much higher.
+ *
+ * In all cases, we fall back to simply pulling the next op off the queue
+ * if something should go wrong.
+ */
+static zio_t *
+get_next_zio(vdev_queue_t *vq, int qdepth)
+{
+ zone_q_bump_t qbump;
+ zio_t *zp = NULL, *zphead;
+ int cnt = 0;
+
+ ASSERT(MUTEX_HELD(&vq->vq_lock));
+
+ /* To avoid problems with int rounding, scale the queue depth by 10 */
+ qbump.zq_qdepth = qdepth * 10;
+ qbump.zq_priority = 0;
+ qbump.zq_zoneid = 0;
+ (void) zone_walk(get_sched_pri_cb, &qbump);
+
+ zphead = avl_first(&vq->vq_deadline_tree);
+
+ /* Check if the scheduler didn't pick a zone for some reason!? */
+ if (qbump.zq_zoneid != 0) {
+ for (zp = avl_first(&vq->vq_deadline_tree); zp != NULL;
+ zp = avl_walk(&vq->vq_deadline_tree, zp, AVL_AFTER)) {
+ if (zp->io_zoneid == qbump.zq_zoneid)
+ break;
+ cnt++;
+ }
+ }
+
+ if (zp == NULL) {
+ zp = zphead;
+ } else if (zp != zphead) {
+ /*
+ * Only fire the probe if we actually picked a different zio
+ * than the one already at the head of the queue.
+ */
+ extern void __dtrace_probe_zfs__zone__sched__bump(uintptr_t,
+ uintptr_t, uintptr_t, uintptr_t);
+ __dtrace_probe_zfs__zone__sched__bump(
+ (uintptr_t)(zp->io_zoneid), (uintptr_t)(cnt),
+ (uintptr_t)(qbump.zq_priority), (uintptr_t)(qbump.zq_wt));
+ }
+
+ return (zp);
+}
+
+/*
+ * Add our zone ID to the zio so we can keep track of which zones are doing
+ * what, even when the current thread processing the zio is not associated
+ * with the zone (e.g. the kernel taskq which pushes out RX groups).
+ */
+void
+zfs_zone_zio_init(zio_t *zp)
+{
+ zone_t *zonep = curzone;
+
+ zp->io_zoneid = zonep->zone_id;
+}
+
+/*
+ * Track IO operations per zone. Called from dmu_tx_count_write for write ops
+ * and dmu_read_uio for read ops. For each operation, increment that zone's
+ * counter based on the type of operation.
+ *
+ * There are three basic ways that we can see write ops:
+ * 1) An application does write syscalls. Those ops go into a TXG which
+ * we'll count here. Sometime later a kernel taskq thread (we'll see the
+ * vdev IO as zone 0) will perform some number of physical writes to commit
+ * the TXG to disk. Those writes are not associated with the zone which
+ * made the write syscalls and the number of operations is not correlated
+ * between the taskq and the zone.
+ * 2) An application opens a file with O_SYNC. Each write will result in
+ * an operation which we'll see here plus a low-level vdev write from
+ * that zone.
+ * 3) An application does write syscalls followed by an fsync(). We'll
+ * count the writes going into a TXG here. We'll also see some number
+ * (usually much smaller, maybe only 1) of low-level vdev writes from this
+ * zone when the fsync is performed, plus some other low-level vdev writes
+ * from the taskq in zone 0 (are these metadata writes?).
+ *
+ * 4) In addition to the above, there are misc. system-level writes, such as
+ * writing out dirty pages to swap, or sync(2) calls, which will be handled
+ * by the global zone and which we count but don't generally worry about.
+ *
+ * Because of the above, we can see writes twice because this is called
+ * at a high level by a zone thread, but we also will count the phys. writes
+ * that are performed at a low level via zfs_zone_zio_start.
+ *
+ * Without this, it can look like a non-global zone never writes (case 1).
+ * Depending on when the TXG is flushed, the counts may be in the same sample
+ * bucket or in a different one.
+ *
+ * Tracking read operations is simpler due to their synchronous semantics. The
+ * zfs_read function -- called as a result of a read(2) syscall -- will always
+ * retrieve the data to be read through dmu_read_uio.
+ */
+void
+zfs_zone_io_throttle(zfs_zone_iop_type_t type)
+{
+ zone_t *zonep = curzone;
+ hrtime_t unow;
+ uint16_t wait;
+
+ unow = GET_USEC_TIME;
+
+ /*
+ * Only bump the counters for logical operations here. The counters for
+ * tracking physical IO operations are handled in zfs_zone_zio_done.
+ */
+ if (type == ZFS_ZONE_IOP_LOGICAL_WRITE) {
+ mutex_enter(&zonep->zone_stg_io_lock);
+ add_iop(zonep, unow, type, 0);
+ mutex_exit(&zonep->zone_stg_io_lock);
+ }
+
+ if (!zfs_zone_delay_enable)
+ return;
+
+ /*
+ * XXX There's a potential race here in that more than one thread may
+ * update the zone delays concurrently. The worst outcome is corruption
+ * of our data to track each zone's IO, so the algorithm may make
+ * incorrect throttling decisions until the data is refreshed.
+ */
+ if ((unow - zfs_zone_last_checked) > zfs_zone_adjust_time) {
+ zfs_zone_wait_adjust(unow);
+ zfs_zone_last_checked = unow;
+ }
+
+ if ((wait = zonep->zone_io_delay) > 0) {
+ /*
+ * If this is a write and we're doing above normal TxG
+ * flushing, then throttle for longer than normal.
+ */
+ if (type == ZFS_ZONE_IOP_LOGICAL_WRITE &&
+ (txg_cnt > 1 || txg_flush_rate > 1))
+ wait *= zfs_zone_txg_throttle_scale;
+
+ /*
+ * sdt:::zfs-zone-wait
+ *
+ * arg0: zone ID
+ * arg1: type of IO operation
+ * arg2: time to delay (in us)
+ */
+ extern void __dtrace_probe_zfs__zone__wait(
+ uintptr_t, uintptr_t, uintptr_t);
+
+ __dtrace_probe_zfs__zone__wait((uintptr_t)(zonep->zone_id),
+ (uintptr_t)type, (uintptr_t)wait);
+
+ drv_usecwait(wait);
+
+ if (zonep->zone_vfs_stats != NULL) {
+ atomic_inc_64(&zonep->zone_vfs_stats->
+ zv_delay_cnt.value.ui64);
+ atomic_add_64(&zonep->zone_vfs_stats->
+ zv_delay_time.value.ui64, wait);
+ }
+ }
+}
+
+/*
+ * XXX Ignore the pool pointer parameter for now.
+ *
+ * Keep track to see if the TxG flush rate is running above the expected rate.
+ * If so, this implies that we are filling TxG's at a high rate due to a heavy
+ * write workload. We use this as input into the zone throttle.
+ *
+ * This function is called every 5 seconds (zfs_txg_timeout) under a normal
+ * write load. In this case, the flush rate is going to be 1. When there
+ * is a heavy write load, TxG's fill up fast and the sync thread will write
+ * the TxG more frequently (perhaps once a second). In this case the rate
+ * will be > 1. The flush rate is a lagging indicator since it can be up
+ * to 5 seconds old. We use the txg_cnt to keep track of the rate in the
+ * current 5 second interval and txg_flush_rate to keep track of the previous
+ * 5 second interval. In that way we don't have a period (1 or more seconds)
+ * where the txg_cnt == 0 and we cut back on throttling even though the rate
+ * is still high.
+ */
+/*ARGSUSED*/
+void
+zfs_zone_report_txg_sync(void *dp)
+{
+ uint_t now;
+
+ txg_cnt++;
+ now = (uint_t)(gethrtime() / NANOSEC);
+ if ((now - txg_last_check) >= zfs_txg_timeout) {
+ txg_flush_rate = txg_cnt / 2;
+ txg_cnt = 0;
+ txg_last_check = now;
+ }
+}
+
+hrtime_t
+zfs_zone_txg_delay()
+{
+ zone_t *zonep = curzone;
+ hrtime_t delay = MSEC2NSEC(10);
+
+ if (zonep->zone_io_util_above_avg)
+ delay = zfs_zone_txg_delay_nsec;
+
+ extern void __dtrace_probe_zfs__zone__txg__delay(uintptr_t, hrtime_t);
+
+ __dtrace_probe_zfs__zone__txg__delay((uintptr_t)(zonep->zone_id),
+ (hrtime_t)delay);
+
+ return (delay);
+}
+
+/*
+ * Called from zio_vdev_io_start when an IO hits the end of the zio pipeline
+ * and is issued.
+ * Keep track of start time for latency calculation in zfs_zone_zio_done.
+ */
+void
+zfs_zone_zio_start(zio_t *zp)
+{
+ zone_t *zonep;
+
+ /*
+ * I/Os of type ZIO_TYPE_IOCTL are used to flush the disk cache, not for
+ * an actual I/O operation. Ignore those operations as they relate to
+ * throttling and scheduling.
+ */
+ if (zp->io_type == ZIO_TYPE_IOCTL)
+ return;
+
+ if ((zonep = zone_find_by_id(zp->io_zoneid)) == NULL)
+ return;
+
+ mutex_enter(&zonep->zone_zfs_lock);
+ if (zp->io_type == ZIO_TYPE_READ)
+ kstat_runq_enter(&zonep->zone_zfs_rwstats);
+ zonep->zone_zfs_weight = 0;
+ mutex_exit(&zonep->zone_zfs_lock);
+
+ mutex_enter(&zfs_disk_lock);
+ zp->io_dispatched = gethrtime();
+
+ if (zfs_disk_rcnt++ != 0)
+ zfs_disk_rtime += (zp->io_dispatched - zfs_disk_rlastupdate);
+ zfs_disk_rlastupdate = zp->io_dispatched;
+ mutex_exit(&zfs_disk_lock);
+
+ zone_rele(zonep);
+}
+
+/*
+ * Called from vdev_queue_io_done when an IO completes.
+ * Increment our counter for zone ops.
+ * Calculate the IO latency avg. for this zone.
+ */
+void
+zfs_zone_zio_done(zio_t *zp)
+{
+ zone_t *zonep;
+ hrtime_t now, unow, udelta;
+
+ if (zp->io_type == ZIO_TYPE_IOCTL)
+ return;
+
+ if ((zonep = zone_find_by_id(zp->io_zoneid)) == NULL)
+ return;
+
+ now = gethrtime();
+ unow = NANO_TO_MICRO(now);
+ udelta = unow - NANO_TO_MICRO(zp->io_dispatched);
+
+ mutex_enter(&zonep->zone_zfs_lock);
+
+ /*
+ * To calculate the wsvc_t average, keep a cumulative sum of all the
+ * wait time before each I/O was dispatched. Since most writes are
+ * asynchronous, only track the wait time for read I/Os.
+ */
+ if (zp->io_type == ZIO_TYPE_READ) {
+ zonep->zone_zfs_rwstats.reads++;
+ zonep->zone_zfs_rwstats.nread += zp->io_size;
+
+ zonep->zone_zfs_stats->zz_waittime.value.ui64 +=
+ zp->io_dispatched - zp->io_start;
+
+ kstat_runq_exit(&zonep->zone_zfs_rwstats);
+ } else {
+ zonep->zone_zfs_rwstats.writes++;
+ zonep->zone_zfs_rwstats.nwritten += zp->io_size;
+ }
+
+ mutex_exit(&zonep->zone_zfs_lock);
+
+ mutex_enter(&zfs_disk_lock);
+ zfs_disk_rcnt--;
+ zfs_disk_rtime += (now - zfs_disk_rlastupdate);
+ zfs_disk_rlastupdate = now;
+ mutex_exit(&zfs_disk_lock);
+
+ if (zfs_zone_delay_enable) {
+ mutex_enter(&zonep->zone_stg_io_lock);
+ add_iop(zonep, unow, zp->io_type == ZIO_TYPE_READ ?
+ ZFS_ZONE_IOP_READ : ZFS_ZONE_IOP_WRITE, udelta);
+ mutex_exit(&zonep->zone_stg_io_lock);
+ }
+
+ zone_rele(zonep);
+
+ /*
+ * sdt:::zfs-zone-latency
+ *
+ * arg0: zone ID
+ * arg1: type of I/O operation
+ * arg2: I/O latency (in us)
+ */
+ extern void __dtrace_probe_zfs__zone__latency(
+ uintptr_t, uintptr_t, uintptr_t);
+
+ __dtrace_probe_zfs__zone__latency((uintptr_t)(zp->io_zoneid),
+ (uintptr_t)(zp->io_type), (uintptr_t)(udelta));
+}
+
+void
+zfs_zone_zio_dequeue(zio_t *zp)
+{
+ zone_t *zonep;
+
+ if ((zonep = zone_find_by_id(zp->io_zoneid)) == NULL)
+ return;
+
+ mutex_enter(&zonep->zone_stg_io_lock);
+ ASSERT(zonep->zone_zfs_queued > 0);
+ if (zonep->zone_zfs_queued == 0)
+ cmn_err(CE_WARN, "zfs_zone_zio_dequeue: count==0");
+ else
+ zonep->zone_zfs_queued--;
+ mutex_exit(&zonep->zone_stg_io_lock);
+ zone_rele(zonep);
+}
+
+void
+zfs_zone_zio_enqueue(zio_t *zp)
+{
+ zone_t *zonep;
+
+ if ((zonep = zone_find_by_id(zp->io_zoneid)) == NULL)
+ return;
+
+ mutex_enter(&zonep->zone_stg_io_lock);
+ zonep->zone_zfs_queued++;
+ mutex_exit(&zonep->zone_stg_io_lock);
+ zone_rele(zonep);
+}
+
+/*
+ * Called from vdev_queue_io_to_issue. This function is where zio's are found
+ * at the head of the queue (by avl_first), then pulled off (by
+ * vdev_queue_io_remove) and issued. We do our scheduling here to find the
+ * next zio to issue.
+ *
+ * The vq->vq_lock mutex is held when we're executing this function so we
+ * can safely access the "last zone" variable on the queue.
+ */
+zio_t *
+zfs_zone_schedule(vdev_queue_t *vq)
+{
+ int cnt;
+ zoneid_t last_zone;
+ zio_t *zp;
+
+ ASSERT(MUTEX_HELD(&vq->vq_lock));
+
+ cnt = avl_numnodes(&vq->vq_deadline_tree);
+ last_zone = vq->vq_last_zone_id;
+
+ /*
+ * If there are only a few ops in the queue then just issue the head.
+ * If there are more than a few ops already queued up, then use
+ * scheduling to get the next zio.
+ */
+ if (!zfs_zone_schedule_enable || cnt < zfs_zone_schedule_thresh)
+ zp = avl_first(&vq->vq_deadline_tree);
+ else
+ zp = get_next_zio(vq, cnt);
+
+ vq->vq_last_zone_id = zp->io_zoneid;
+
+ /*
+ * Probe with 3 args; the number of IOs in the queue, the zone that
+ * was last scheduled off this queue, and the zone that was associated
+ * with the next IO that is scheduled.
+ */
+ extern void __dtrace_probe_zfs__zone__sched(uintptr_t, uintptr_t,
+ uintptr_t);
+
+ __dtrace_probe_zfs__zone__sched((uintptr_t)(cnt),
+ (uintptr_t)(last_zone), (uintptr_t)(zp->io_zoneid));
+
+ return (zp);
+}
+
+#endif
diff --git a/usr/src/uts/common/fs/zfs/zio.c b/usr/src/uts/common/fs/zfs/zio.c
index 84f3028bd5..9adaf3b974 100644
--- a/usr/src/uts/common/fs/zfs/zio.c
+++ b/usr/src/uts/common/fs/zfs/zio.c
@@ -36,6 +36,7 @@
#include <sys/dmu_objset.h>
#include <sys/arc.h>
#include <sys/ddt.h>
+#include <sys/zfs_zone.h>
/*
* ==========================================================================
@@ -527,6 +528,8 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp,
zio = kmem_cache_alloc(zio_cache, KM_SLEEP);
bzero(zio, sizeof (zio_t));
+ zio->io_start = gethrtime();
+
mutex_init(&zio->io_lock, NULL, MUTEX_DEFAULT, NULL);
cv_init(&zio->io_cv, NULL, CV_DEFAULT, NULL);
@@ -578,11 +581,14 @@ zio_create(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp,
zio->io_bookmark = *zb;
if (pio != NULL) {
+ zio->io_zoneid = pio->io_zoneid;
if (zio->io_logical == NULL)
zio->io_logical = pio->io_logical;
if (zio->io_child_type == ZIO_CHILD_GANG)
zio->io_gang_leader = pio->io_gang_leader;
zio_add_child(pio, zio);
+ } else {
+ zfs_zone_zio_init(zio);
}
return (zio);
@@ -928,6 +934,8 @@ zio_read_bp_init(zio_t *zio)
{
blkptr_t *bp = zio->io_bp;
+ zio->io_start = gethrtime();
+
if (BP_GET_COMPRESS(bp) != ZIO_COMPRESS_OFF &&
zio->io_child_type == ZIO_CHILD_LOGICAL &&
!(zio->io_flags & ZIO_FLAG_RAW)) {
@@ -2395,6 +2403,9 @@ zio_vdev_io_start(zio_t *zio)
ASSERT(zio->io_error == 0);
ASSERT(zio->io_child_error[ZIO_CHILD_VDEV] == 0);
+ if (zio->io_type == ZIO_TYPE_WRITE)
+ zio->io_start = gethrtime();
+
if (vd == NULL) {
if (!(zio->io_flags & ZIO_FLAG_CONFIG_WRITER))
spa_config_enter(spa, SCL_ZIO, zio, RW_READER);
diff --git a/usr/src/uts/common/fs/zfs/zio_checksum.c b/usr/src/uts/common/fs/zfs/zio_checksum.c
index bc7331764c..1a3b51030a 100644
--- a/usr/src/uts/common/fs/zfs/zio_checksum.c
+++ b/usr/src/uts/common/fs/zfs/zio_checksum.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/zfs_context.h>
@@ -67,6 +68,13 @@ zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp)
ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0);
}
+/*
+ * The sha256_mac checksum algorithm was added to try to maintain on-disk
+ * compatibility with ZFS on other platforms. That effort didn't work for other
+ * reasons. As a result, the sha256_mac algorithm is unused except in the rare
+ * case of an older platform interpreting noparity as sha256_mac -- which is why
+ * they both are no-ops.
+ */
zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
{{NULL, NULL}, 0, 0, 0, "inherit"},
{{NULL, NULL}, 0, 0, 0, "on"},
@@ -78,6 +86,8 @@ zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
{{fletcher_4_native, fletcher_4_byteswap}, 1, 0, 0, "fletcher4"},
{{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 0, 1, "sha256"},
{{fletcher_4_native, fletcher_4_byteswap}, 0, 1, 0, "zilog2"},
+ {{zio_checksum_off, zio_checksum_off}, 0, 0, 0, "sha256_mac"},
+ {{zio_checksum_off, zio_checksum_off}, 0, 0, 0, "noparity"},
};
enum zio_checksum
diff --git a/usr/src/uts/common/fs/zfs/zvol.c b/usr/src/uts/common/fs/zfs/zvol.c
index 5fad8cfdaf..3659a87746 100644
--- a/usr/src/uts/common/fs/zfs/zvol.c
+++ b/usr/src/uts/common/fs/zfs/zvol.c
@@ -77,9 +77,11 @@
#include <sys/zfs_rlock.h>
#include <sys/vdev_disk.h>
#include <sys/vdev_impl.h>
+#include <sys/vdev_raidz.h>
#include <sys/zvol.h>
#include <sys/dumphdr.h>
#include <sys/zil_impl.h>
+#include <sys/sdt.h>
#include <sys/dbuf.h>
#include "zfs_namecheck.h"
@@ -1101,47 +1103,56 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, offset_t off, ssize_t resid,
}
static int
-zvol_dumpio_vdev(vdev_t *vd, void *addr, uint64_t offset, uint64_t size,
- boolean_t doread, boolean_t isdump)
+zvol_dumpio_vdev(vdev_t *vd, void *addr, uint64_t offset, uint64_t origoffset,
+ uint64_t size, boolean_t doread, boolean_t isdump)
{
vdev_disk_t *dvd;
int c;
int numerrors = 0;
- for (c = 0; c < vd->vdev_children; c++) {
- ASSERT(vd->vdev_ops == &vdev_mirror_ops ||
- vd->vdev_ops == &vdev_replacing_ops ||
- vd->vdev_ops == &vdev_spare_ops);
- int err = zvol_dumpio_vdev(vd->vdev_child[c],
- addr, offset, size, doread, isdump);
- if (err != 0) {
- numerrors++;
- } else if (doread) {
- break;
+ if (vd->vdev_ops == &vdev_mirror_ops ||
+ vd->vdev_ops == &vdev_replacing_ops ||
+ vd->vdev_ops == &vdev_spare_ops) {
+ for (c = 0; c < vd->vdev_children; c++) {
+ int err = zvol_dumpio_vdev(vd->vdev_child[c],
+ addr, offset, origoffset, size, doread, isdump);
+ if (err != 0) {
+ numerrors++;
+ } else if (doread) {
+ break;
+ }
}
}
- if (!vd->vdev_ops->vdev_op_leaf)
- return (numerrors < vd->vdev_children ? 0 : EIO);
+ if (!vd->vdev_ops->vdev_op_leaf && vd->vdev_ops != &vdev_raidz_ops)
+ return (numerrors < vd->vdev_children ? 0 : SET_ERROR(EIO));
if (doread && !vdev_readable(vd))
return (SET_ERROR(EIO));
else if (!doread && !vdev_writeable(vd))
return (SET_ERROR(EIO));
- dvd = vd->vdev_tsd;
- ASSERT3P(dvd, !=, NULL);
+ if (vd->vdev_ops == &vdev_raidz_ops) {
+ return (vdev_raidz_physio(vd,
+ addr, size, offset, origoffset, doread));
+ }
+
offset += VDEV_LABEL_START_SIZE;
if (ddi_in_panic() || isdump) {
ASSERT(!doread);
if (doread)
return (SET_ERROR(EIO));
+ dvd = vd->vdev_tsd;
+ ASSERT3P(dvd, !=, NULL);
return (ldi_dump(dvd->vd_lh, addr, lbtodb(offset),
lbtodb(size)));
} else {
- return (vdev_disk_physio(dvd->vd_lh, addr, size, offset,
- doread ? B_READ : B_WRITE));
+ dvd = vd->vdev_tsd;
+ ASSERT3P(dvd, !=, NULL);
+
+ return (vdev_disk_ldi_physio(dvd->vd_lh, addr, size,
+ offset, doread ? B_READ : B_WRITE));
}
}
@@ -1176,7 +1187,8 @@ zvol_dumpio(zvol_state_t *zv, void *addr, uint64_t offset, uint64_t size,
vd = vdev_lookup_top(spa, DVA_GET_VDEV(&ze->ze_dva));
offset += DVA_GET_OFFSET(&ze->ze_dva);
- error = zvol_dumpio_vdev(vd, addr, offset, size, doread, isdump);
+ error = zvol_dumpio_vdev(vd, addr, offset, DVA_GET_OFFSET(&ze->ze_dva),
+ size, doread, isdump);
if (!ddi_in_panic())
spa_config_exit(spa, SCL_STATE, FTAG);
@@ -1370,6 +1382,8 @@ zvol_read(dev_t dev, uio_t *uio, cred_t *cr)
return (error);
}
+ DTRACE_PROBE3(zvol__uio__start, dev_t, dev, uio_t *, uio, int, 0);
+
rl = zfs_range_lock(&zv->zv_znode, uio->uio_loffset, uio->uio_resid,
RL_READER);
while (uio->uio_resid > 0 && uio->uio_loffset < volsize) {
@@ -1388,6 +1402,10 @@ zvol_read(dev_t dev, uio_t *uio, cred_t *cr)
}
}
zfs_range_unlock(rl);
+
+ DTRACE_PROBE4(zvol__uio__done, dev_t, dev, uio_t *, uio, int, 0, int,
+ error);
+
return (error);
}
@@ -1417,6 +1435,8 @@ zvol_write(dev_t dev, uio_t *uio, cred_t *cr)
return (error);
}
+ DTRACE_PROBE3(zvol__uio__start, dev_t, dev, uio_t *, uio, int, 1);
+
sync = !(zv->zv_flags & ZVOL_WCE) ||
(zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS);
@@ -1447,6 +1467,10 @@ zvol_write(dev_t dev, uio_t *uio, cred_t *cr)
zfs_range_unlock(rl);
if (sync)
zil_commit(zv->zv_zilog, ZVOL_OBJ);
+
+ DTRACE_PROBE4(zvol__uio__done, dev_t, dev, uio_t *, uio, int, 1, int,
+ error);
+
return (error);
}
@@ -1900,7 +1924,7 @@ zvol_dump_init(zvol_state_t *zv, boolean_t resize)
ZIO_COMPRESS_OFF) == 0);
VERIFY(nvlist_add_uint64(nv,
zfs_prop_to_name(ZFS_PROP_CHECKSUM),
- ZIO_CHECKSUM_OFF) == 0);
+ ZIO_CHECKSUM_NOPARITY) == 0);
if (version >= SPA_VERSION_DEDUP) {
VERIFY(nvlist_add_uint64(nv,
zfs_prop_to_name(ZFS_PROP_DEDUP),
diff --git a/usr/src/uts/common/inet/ip.h b/usr/src/uts/common/inet/ip.h
index 42adb4c451..bd50364310 100644
--- a/usr/src/uts/common/inet/ip.h
+++ b/usr/src/uts/common/inet/ip.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 1990 Mentat Inc.
*/
@@ -2195,6 +2196,8 @@ struct ip_xmit_attr_s {
*/
ixa_notify_t ixa_notify; /* Registered upcall notify function */
void *ixa_notify_cookie; /* ULP cookie for ixa_notify */
+
+ uint_t ixa_tcpcleanup; /* Used by conn_ixa_cleanup */
};
/*
@@ -2266,6 +2269,14 @@ struct ip_xmit_attr_s {
#define IXA_FREE_TSL 0x00000002 /* ixa_tsl needs to be rele */
/*
+ * Trivial state machine used to synchronize IXA cleanup for TCP connections.
+ * See conn_ixa_cleanup().
+ */
+#define IXATC_IDLE 0x00000000
+#define IXATC_INPROGRESS 0x00000001
+#define IXATC_COMPLETE 0x00000002
+
+/*
* Simplistic way to set the ixa_xmit_hint for locally generated traffic
* and forwarded traffic. The shift amount are based on the size of the
* structs to discard the low order bits which don't have much if any variation
@@ -3030,6 +3041,7 @@ extern vmem_t *ip_minor_arena_la;
#define ips_ip_strict_src_multihoming ips_propinfo_tbl[80].prop_cur_uval
#define ips_ipv6_strict_src_multihoming ips_propinfo_tbl[81].prop_cur_uval
#define ips_ipv6_drop_inbound_icmpv6 ips_propinfo_tbl[82].prop_cur_bval
+#define ips_ip_dce_reclaim_threshold ips_propinfo_tbl[83].prop_cur_uval
extern int dohwcksum; /* use h/w cksum if supported by the h/w */
#ifdef ZC_TEST
diff --git a/usr/src/uts/common/inet/ip/ip_attr.c b/usr/src/uts/common/inet/ip/ip_attr.c
index 3197858f8e..e040af14ba 100644
--- a/usr/src/uts/common/inet/ip/ip_attr.c
+++ b/usr/src/uts/common/inet/ip/ip_attr.c
@@ -909,6 +909,11 @@ ixa_safe_copy(ip_xmit_attr_t *src, ip_xmit_attr_t *ixa)
*/
if (ixa->ixa_free_flags & IXA_FREE_CRED)
crhold(ixa->ixa_cred);
+
+ /*
+ * There is no cleanup in progress on this new copy.
+ */
+ ixa->ixa_tcpcleanup = IXATC_IDLE;
}
/*
@@ -1176,6 +1181,59 @@ ixa_cleanup_stale(ip_xmit_attr_t *ixa)
}
}
+static mblk_t *
+tcp_ixa_cleanup_getmblk(conn_t *connp)
+{
+ tcp_stack_t *tcps = connp->conn_netstack->netstack_tcp;
+ int need_retry;
+ mblk_t *mp;
+
+ mutex_enter(&tcps->tcps_ixa_cleanup_lock);
+
+ /*
+ * It's possible that someone else came in and started cleaning up
+ * another connection between the time we verified this one is not being
+ * cleaned up and the time we actually get the shared mblk. If that's
+ * the case, we've dropped the lock, and some other thread may have
+ * cleaned up this connection again, and is still waiting for
+ * notification of that cleanup's completion. Therefore we need to
+ * recheck.
+ */
+ do {
+ need_retry = 0;
+ while (connp->conn_ixa->ixa_tcpcleanup != IXATC_IDLE) {
+ cv_wait(&tcps->tcps_ixa_cleanup_done_cv,
+ &tcps->tcps_ixa_cleanup_lock);
+ }
+
+ while ((mp = tcps->tcps_ixa_cleanup_mp) == NULL) {
+ /*
+ * Multiple concurrent cleanups; need to have the last
+ * one run since it could be an unplumb.
+ */
+ need_retry = 1;
+ cv_wait(&tcps->tcps_ixa_cleanup_ready_cv,
+ &tcps->tcps_ixa_cleanup_lock);
+ }
+ } while (need_retry);
+
+ /*
+ * We now have the lock and the mblk; now make sure that no one else can
+ * try to clean up this connection or enqueue it for cleanup, clear the
+ * mblk pointer for this stack, drop the lock, and return the mblk.
+ */
+ ASSERT(MUTEX_HELD(&tcps->tcps_ixa_cleanup_lock));
+ ASSERT(connp->conn_ixa->ixa_tcpcleanup == IXATC_IDLE);
+ ASSERT(tcps->tcps_ixa_cleanup_mp == mp);
+ ASSERT(mp != NULL);
+
+ connp->conn_ixa->ixa_tcpcleanup = IXATC_INPROGRESS;
+ tcps->tcps_ixa_cleanup_mp = NULL;
+ mutex_exit(&tcps->tcps_ixa_cleanup_lock);
+
+ return (mp);
+}
+
/*
* Used to run ixa_cleanup_stale inside the tcp squeue.
* When done we hand the mp back by assigning it to tcps_ixa_cleanup_mp
@@ -1195,11 +1253,39 @@ tcp_ixa_cleanup(void *arg, mblk_t *mp, void *arg2,
mutex_enter(&tcps->tcps_ixa_cleanup_lock);
ASSERT(tcps->tcps_ixa_cleanup_mp == NULL);
+ connp->conn_ixa->ixa_tcpcleanup = IXATC_COMPLETE;
tcps->tcps_ixa_cleanup_mp = mp;
- cv_signal(&tcps->tcps_ixa_cleanup_cv);
+ cv_signal(&tcps->tcps_ixa_cleanup_ready_cv);
+ /*
+ * It is possible for any number of threads to be waiting for cleanup of
+ * different connections. Absent a per-connection (or per-IXA) CV, we
+ * need to wake them all up even though only one can be waiting on this
+ * particular cleanup.
+ */
+ cv_broadcast(&tcps->tcps_ixa_cleanup_done_cv);
mutex_exit(&tcps->tcps_ixa_cleanup_lock);
}
+static void
+tcp_ixa_cleanup_wait_and_finish(conn_t *connp)
+{
+ tcp_stack_t *tcps = connp->conn_netstack->netstack_tcp;
+
+ mutex_enter(&tcps->tcps_ixa_cleanup_lock);
+
+ ASSERT(connp->conn_ixa->ixa_tcpcleanup != IXATC_IDLE);
+
+ while (connp->conn_ixa->ixa_tcpcleanup == IXATC_INPROGRESS) {
+ cv_wait(&tcps->tcps_ixa_cleanup_done_cv,
+ &tcps->tcps_ixa_cleanup_lock);
+ }
+
+ ASSERT(connp->conn_ixa->ixa_tcpcleanup == IXATC_COMPLETE);
+ connp->conn_ixa->ixa_tcpcleanup = IXATC_IDLE;
+ cv_broadcast(&tcps->tcps_ixa_cleanup_done_cv);
+
+ mutex_exit(&tcps->tcps_ixa_cleanup_lock);
+}
/*
* ipcl_walk() function to help release any IRE, NCE, or DCEs that
@@ -1214,21 +1300,8 @@ conn_ixa_cleanup(conn_t *connp, void *arg)
if (IPCL_IS_TCP(connp)) {
mblk_t *mp;
- tcp_stack_t *tcps;
-
- tcps = connp->conn_netstack->netstack_tcp;
- mutex_enter(&tcps->tcps_ixa_cleanup_lock);
- while ((mp = tcps->tcps_ixa_cleanup_mp) == NULL) {
- /*
- * Multiple concurrent cleanups; need to have the last
- * one run since it could be an unplumb.
- */
- cv_wait(&tcps->tcps_ixa_cleanup_cv,
- &tcps->tcps_ixa_cleanup_lock);
- }
- tcps->tcps_ixa_cleanup_mp = NULL;
- mutex_exit(&tcps->tcps_ixa_cleanup_lock);
+ mp = tcp_ixa_cleanup_getmblk(connp);
if (connp->conn_sqp->sq_run == curthread) {
/* Already on squeue */
@@ -1237,15 +1310,8 @@ conn_ixa_cleanup(conn_t *connp, void *arg)
CONN_INC_REF(connp);
SQUEUE_ENTER_ONE(connp->conn_sqp, mp, tcp_ixa_cleanup,
connp, NULL, SQ_PROCESS, SQTAG_TCP_IXA_CLEANUP);
-
- /* Wait until tcp_ixa_cleanup has run */
- mutex_enter(&tcps->tcps_ixa_cleanup_lock);
- while (tcps->tcps_ixa_cleanup_mp == NULL) {
- cv_wait(&tcps->tcps_ixa_cleanup_cv,
- &tcps->tcps_ixa_cleanup_lock);
- }
- mutex_exit(&tcps->tcps_ixa_cleanup_lock);
}
+ tcp_ixa_cleanup_wait_and_finish(connp);
} else if (IPCL_IS_SCTP(connp)) {
sctp_t *sctp;
sctp_faddr_t *fp;
diff --git a/usr/src/uts/common/inet/ip/ip_dce.c b/usr/src/uts/common/inet/ip/ip_dce.c
index 215bc4675f..502ee8a735 100644
--- a/usr/src/uts/common/inet/ip/ip_dce.c
+++ b/usr/src/uts/common/inet/ip/ip_dce.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -32,6 +33,7 @@
#include <sys/cmn_err.h>
#include <sys/debug.h>
#include <sys/atomic.h>
+#include <sys/callb.h>
#define _SUN_TPI_VERSION 2
#include <sys/tihdr.h>
@@ -102,7 +104,19 @@ static void dce_delete_locked(dcb_t *, dce_t *);
static void dce_make_condemned(dce_t *);
static kmem_cache_t *dce_cache;
+static kthread_t *dce_reclaim_thread;
+static kmutex_t dce_reclaim_lock;
+static kcondvar_t dce_reclaim_cv;
+static int dce_reclaim_shutdown;
+/* Global so it can be tuned in /etc/system. This must be a power of two. */
+uint_t ip_dce_hash_size = 1024;
+
+/* The time in seconds between executions of the IP DCE reclaim worker. */
+uint_t ip_dce_reclaim_interval = 60;
+
+/* The factor of the DCE threshold at which to start hard reclaims */
+uint_t ip_dce_reclaim_threshold_hard = 2;
/* Operates on a uint64_t */
#define RANDOM_HASH(p) ((p) ^ ((p)>>16) ^ ((p)>>32) ^ ((p)>>48))
@@ -117,6 +131,11 @@ dcb_reclaim(dcb_t *dcb, ip_stack_t *ipst, uint_t fraction)
uint_t fraction_pmtu = fraction*4;
uint_t hash;
dce_t *dce, *nextdce;
+ hrtime_t seed = gethrtime();
+ uint_t retained = 0;
+ uint_t max = ipst->ips_ip_dce_reclaim_threshold;
+
+ max *= ip_dce_reclaim_threshold_hard;
rw_enter(&dcb->dcb_lock, RW_WRITER);
for (dce = dcb->dcb_dce; dce != NULL; dce = nextdce) {
@@ -132,13 +151,21 @@ dcb_reclaim(dcb_t *dcb, ip_stack_t *ipst, uint_t fraction)
} else {
mutex_exit(&dce->dce_lock);
}
- hash = RANDOM_HASH((uint64_t)(uintptr_t)dce);
- if (dce->dce_flags & DCEF_PMTU) {
- if (hash % fraction_pmtu != 0)
- continue;
- } else {
- if (hash % fraction != 0)
- continue;
+
+ if (max == 0 || retained < max) {
+ hash = RANDOM_HASH((uint64_t)((uintptr_t)dce | seed));
+
+ if (dce->dce_flags & DCEF_PMTU) {
+ if (hash % fraction_pmtu != 0) {
+ retained++;
+ continue;
+ }
+ } else {
+ if (hash % fraction != 0) {
+ retained++;
+ continue;
+ }
+ }
}
IP_STAT(ipst, ip_dce_reclaim_deleted);
@@ -175,17 +202,19 @@ ip_dce_reclaim_stack(ip_stack_t *ipst)
}
/*
- * Called by the memory allocator subsystem directly, when the system
- * is running low on memory.
+ * Called by dce_reclaim_worker() below, and no one else. Typically this will
+ * mean that the number of entries in the hash buckets has exceeded a tunable
+ * threshold.
*/
-/* ARGSUSED */
-void
-ip_dce_reclaim(void *args)
+static void
+ip_dce_reclaim(void)
{
netstack_handle_t nh;
netstack_t *ns;
ip_stack_t *ipst;
+ ASSERT(curthread == dce_reclaim_thread);
+
netstack_next_init(&nh);
while ((ns = netstack_next(&nh)) != NULL) {
/*
@@ -196,26 +225,75 @@ ip_dce_reclaim(void *args)
netstack_rele(ns);
continue;
}
- ip_dce_reclaim_stack(ipst);
+ if (atomic_swap_uint(&ipst->ips_dce_reclaim_needed, 0) != 0)
+ ip_dce_reclaim_stack(ipst);
netstack_rele(ns);
}
netstack_next_fini(&nh);
}
+/* ARGSUSED */
+static void
+dce_reclaim_worker(void *arg)
+{
+ callb_cpr_t cprinfo;
+
+ CALLB_CPR_INIT(&cprinfo, &dce_reclaim_lock, callb_generic_cpr,
+ "dce_reclaim_worker");
+
+ mutex_enter(&dce_reclaim_lock);
+ while (!dce_reclaim_shutdown) {
+ CALLB_CPR_SAFE_BEGIN(&cprinfo);
+ (void) cv_timedwait(&dce_reclaim_cv, &dce_reclaim_lock,
+ ddi_get_lbolt() + ip_dce_reclaim_interval * hz);
+ CALLB_CPR_SAFE_END(&cprinfo, &dce_reclaim_lock);
+
+ if (dce_reclaim_shutdown)
+ break;
+
+ mutex_exit(&dce_reclaim_lock);
+ ip_dce_reclaim();
+ mutex_enter(&dce_reclaim_lock);
+ }
+
+ ASSERT(MUTEX_HELD(&dce_reclaim_lock));
+ dce_reclaim_thread = NULL;
+ dce_reclaim_shutdown = 0;
+ cv_broadcast(&dce_reclaim_cv);
+ CALLB_CPR_EXIT(&cprinfo); /* drops the lock */
+
+ thread_exit();
+}
+
void
dce_g_init(void)
{
dce_cache = kmem_cache_create("dce_cache",
- sizeof (dce_t), 0, NULL, NULL, ip_dce_reclaim, NULL, NULL, 0);
+ sizeof (dce_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
+
+ mutex_init(&dce_reclaim_lock, NULL, MUTEX_DEFAULT, NULL);
+ cv_init(&dce_reclaim_cv, NULL, CV_DEFAULT, NULL);
+
+ dce_reclaim_thread = thread_create(NULL, 0, dce_reclaim_worker,
+ NULL, 0, &p0, TS_RUN, minclsyspri);
}
void
dce_g_destroy(void)
{
+ mutex_enter(&dce_reclaim_lock);
+ dce_reclaim_shutdown = 1;
+ cv_signal(&dce_reclaim_cv);
+ while (dce_reclaim_thread != NULL)
+ cv_wait(&dce_reclaim_cv, &dce_reclaim_lock);
+ mutex_exit(&dce_reclaim_lock);
+
+ cv_destroy(&dce_reclaim_cv);
+ mutex_destroy(&dce_reclaim_lock);
+
kmem_cache_destroy(dce_cache);
}
-
/*
* Allocate a default DCE and a hash table for per-IP address DCEs
*/
@@ -234,7 +312,7 @@ dce_stack_init(ip_stack_t *ipst)
ipst->ips_dce_default->dce_ipst = ipst;
/* This must be a power of two since we are using IRE_ADDR_HASH macro */
- ipst->ips_dce_hashsize = 256;
+ ipst->ips_dce_hashsize = ip_dce_hash_size;
ipst->ips_dce_hash_v4 = kmem_zalloc(ipst->ips_dce_hashsize *
sizeof (dcb_t), KM_SLEEP);
ipst->ips_dce_hash_v6 = kmem_zalloc(ipst->ips_dce_hashsize *
@@ -414,6 +492,12 @@ dce_lookup_and_add_v4(ipaddr_t dst, ip_stack_t *ipst)
hash = IRE_ADDR_HASH(dst, ipst->ips_dce_hashsize);
dcb = &ipst->ips_dce_hash_v4[hash];
+ /*
+ * Assuming that we get fairly even distribution across all of the
+ * buckets, once one bucket is overly full, prune the whole cache.
+ */
+ if (dcb->dcb_cnt > ipst->ips_ip_dce_reclaim_threshold)
+ atomic_or_uint(&ipst->ips_dce_reclaim_needed, 1);
rw_enter(&dcb->dcb_lock, RW_WRITER);
for (dce = dcb->dcb_dce; dce != NULL; dce = dce->dce_next) {
if (dce->dce_v4addr == dst) {
@@ -447,6 +531,7 @@ dce_lookup_and_add_v4(ipaddr_t dst, ip_stack_t *ipst)
dce->dce_ptpn = &dcb->dcb_dce;
dcb->dcb_dce = dce;
dce->dce_bucket = dcb;
+ atomic_add_32(&dcb->dcb_cnt, 1);
dce_refhold(dce); /* For the caller */
rw_exit(&dcb->dcb_lock);
@@ -476,6 +561,12 @@ dce_lookup_and_add_v6(const in6_addr_t *dst, uint_t ifindex, ip_stack_t *ipst)
hash = IRE_ADDR_HASH_V6(*dst, ipst->ips_dce_hashsize);
dcb = &ipst->ips_dce_hash_v6[hash];
+ /*
+ * Assuming that we get fairly even distribution across all of the
+ * buckets, once one bucket is overly full, prune the whole cache.
+ */
+ if (dcb->dcb_cnt > ipst->ips_ip_dce_reclaim_threshold)
+ atomic_or_uint(&ipst->ips_dce_reclaim_needed, 1);
rw_enter(&dcb->dcb_lock, RW_WRITER);
for (dce = dcb->dcb_dce; dce != NULL; dce = dce->dce_next) {
if (IN6_ARE_ADDR_EQUAL(&dce->dce_v6addr, dst) &&
diff --git a/usr/src/uts/common/inet/ip/ip_tunables.c b/usr/src/uts/common/inet/ip/ip_tunables.c
index 516d6c1a21..1e249b493e 100644
--- a/usr/src/uts/common/inet/ip/ip_tunables.c
+++ b/usr/src/uts/common/inet/ip/ip_tunables.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1990 Mentat Inc. */
@@ -908,6 +909,11 @@ mod_prop_info_t ip_propinfo_tbl[] = {
#else
{ "", 0, NULL, NULL, {0}, {0} },
#endif
+
+ { "_dce_reclaim_threshold", MOD_PROTO_IP,
+ mod_set_uint32, mod_get_uint32,
+ {1, 100000, 32}, {32} },
+
{ "mtu", MOD_PROTO_IPV4, NULL, ip_get_mtu, {0}, {0} },
{ "mtu", MOD_PROTO_IPV6, NULL, ip_get_mtu, {0}, {0} },
diff --git a/usr/src/uts/common/inet/ip/ipsecesp.c b/usr/src/uts/common/inet/ip/ipsecesp.c
index 47972a8c1a..96a0457678 100644
--- a/usr/src/uts/common/inet/ip/ipsecesp.c
+++ b/usr/src/uts/common/inet/ip/ipsecesp.c
@@ -234,8 +234,7 @@ esp_kstat_init(ipsecesp_stack_t *espstack, netstackid_t stackid)
{
espstack->esp_ksp = kstat_create_netstack("ipsecesp", 0, "esp_stat",
"net", KSTAT_TYPE_NAMED,
- sizeof (esp_kstats_t) / sizeof (kstat_named_t),
- KSTAT_FLAG_PERSISTENT, stackid);
+ sizeof (esp_kstats_t) / sizeof (kstat_named_t), 0, stackid);
if (espstack->esp_ksp == NULL || espstack->esp_ksp->ks_data == NULL)
return (B_FALSE);
diff --git a/usr/src/uts/common/inet/ip_stack.h b/usr/src/uts/common/inet/ip_stack.h
index 9ca6eaa593..e46a3b6a3c 100644
--- a/usr/src/uts/common/inet/ip_stack.h
+++ b/usr/src/uts/common/inet/ip_stack.h
@@ -264,6 +264,7 @@ struct ip_stack {
uint_t ips_dce_hashsize;
struct dcb_s *ips_dce_hash_v4;
struct dcb_s *ips_dce_hash_v6;
+ uint_t ips_dce_reclaim_needed;
/* pending binds */
mblk_t *ips_ip6_asp_pending_ops;
diff --git a/usr/src/uts/common/inet/ipd/ipd.c b/usr/src/uts/common/inet/ipd/ipd.c
new file mode 100644
index 0000000000..9d9d19562a
--- /dev/null
+++ b/usr/src/uts/common/inet/ipd/ipd.c
@@ -0,0 +1,1191 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * ipd: Internet packet disturber
+ *
+ * The purpose of ipd is to simulate congested and lossy networks when they
+ * don't actually exist. The features of these congested and lossy networks are
+ * events that end up leading to retransmits and thus kicking us out of the
+ * TCP/IP fastpath. Since normally this would require us to have an actually
+ * congested network, which can be problematic, we instead simulate this
+ * behavior.
+ *
+ * 1. ipd's operations and restrictions
+ *
+ * ipd currently has facilities to cause IP traffic to be:
+ *
+ * - Corrupted with some probability.
+ * - Delayed for a set number of microseconds.
+ * - Dropped with some probability.
+ *
+ * Each of these features are enabled on a per-zone basic. The current
+ * implementation restricts this specifically to exclusive stack zones.
+ * Enabling ipd on a given zone causes pfhooks to be installed for that zone's
+ * netstack. Because of the nature of ipd, it currently only supports exclusive
+ * stack zones and as a further restriction, it only allows the global zone
+ * administrative access. ipd can be enabled for the global zone, but doing so
+ * will cause all shared-stack zones to also be affected.
+ *
+ * 2. General architecture and Locking
+ *
+ * ipd consists of a few components. There is a per netstack data structure that
+ * is created and destroyed with the creation and destruction of each exclusive
+ * stack zone. Each of these netstacks is stored in a global list which is
+ * accessed for control of ipd via ioctls. The following diagram touches on the
+ * data structures that are used throughout ipd.
+ *
+ * ADMINISTRATIVE DATA PATH
+ *
+ * +--------+ +------+ +------+
+ * | ipdadm | | ip | | nics |
+ * +--------+ +------+ +------+
+ * | ^ | |
+ * | | ioctl(2) | |
+ * V | V V
+ * +----------+ +-------------------------+
+ * | /dev/ipd | | pfhooks packet callback | == ipd_hook()
+ * +----------+ +-------------------------+
+ * | |
+ * | |
+ * V |
+ * +----------------+ |
+ * | list_t ipd_nsl |------+ |
+ * +----------------+ | |
+ * | |
+ * V per netstack V
+ * +----------------------------+
+ * | ipd_nestack_t |
+ * +----------------------------+
+ *
+ * ipd has two different entry points, one is administrative, the other is the
+ * data path. The administrative path is accessed by a userland component called
+ * ipdadm(1M). It communicates to the kernel component via ioctls to /dev/ipd.
+ * If the administrative path enables a specific zone, then the data path will
+ * become active for that zone. Any packet that leaves that zone's IP stack or
+ * is going to enter it, comes through the callback specified in the hook_t(9S)
+ * structure. This will cause each packet to go through ipd_hook().
+ *
+ * While the locking inside of ipd should be straightforward, unfortunately, the
+ * pfhooks subsystem necessarily complicates this a little bit. There are
+ * currently three different sets of locks in ipd.
+ *
+ * - Global lock N on the netstack list.
+ * - Global lock A on the active count.
+ * - Per-netstack data structure lock Z.
+ *
+ * # Locking rules
+ *
+ * L.1a N must always be acquired first and released last
+ *
+ * If you need to acquire the netstack list lock, either for reading or writing,
+ * then N must be acquired first and before any other locks. It may not be
+ * dropped before any other lock.
+ *
+ * L.1b N must only be acquired from the administrative path and zone creation,
+ * shutdown, and destruct callbacks.
+ *
+ * The data path, e.g. receiving the per-packet callbacks, should never be
+ * grabbing the list lock. If it is, then the architecture here needs to be
+ * reconsidered.
+ *
+ * L.2 Z cannot be held across calls to the pfhooks subsystem if packet hooks
+ * are active.
+ *
+ * The way the pfhooks subsystem is designed is that a reference count is
+ * present on the hook_t while it is active. As long as that reference count is
+ * non-zero, a call to net_hook_unregister will block until it is lowered.
+ * Because the callbacks want the same lock for the netstack that is held by the
+ * administrative path calling into net_hook_unregister, we deadlock.
+ *
+ * ioctl from ipdadm remove hook_t cb (from nic) hook_t cb (from IP)
+ * ----------------------- -------------------- -------------------
+ * | | |
+ * | bump hook_t refcount |
+ * mutex_enter(ipd_nsl_lock); enter ipd_hook() bump hook_t refcount
+ * mutex acquired mutex_enter(ins->ipdn_lock); |
+ * | mutex acquired enter ipd_hook()
+ * mutex_enter(ins->ipdn_lock); | mutex_enter(ins->ipdn_lock);
+ * | | |
+ * | | |
+ * | mutex_exit(ins->ipdn_lock); |
+ * | | |
+ * mutex acquired leave ipd_hook() |
+ * | decrement hook_t refcount |
+ * | | |
+ * ipd_teardown_hooks() | |
+ * net_hook_unregister() | |
+ * cv_wait() if recount | |
+ * | | |
+ * ---------------------------------------------------------------------------
+ *
+ * At this point, we can see that the second hook callback still doesn't have
+ * the mutex, but it has bumped the hook_t refcount. However, it will never
+ * acquire the mutex that it needs to finish its operation and decrement the
+ * refcount.
+ *
+ * Obviously, deadlocking is not acceptable, thus the following corollary to the
+ * second locking rule:
+ *
+ * L.2 Corollary: If Z is being released across a call to the pfhooks subsystem,
+ * N must be held.
+ *
+ * There is currently only one path where we have to worry about this. That is
+ * when we are removing a hook, but the zone is not being shutdown, then hooks
+ * are currently active. The only place that this currently happens is in
+ * ipd_check_hooks().
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/kmem.h>
+#include <sys/conf.h>
+#include <sys/stat.h>
+#include <sys/cmn_err.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/modctl.h>
+#include <sys/kstat.h>
+#include <sys/neti.h>
+#include <sys/list.h>
+#include <sys/ksynch.h>
+#include <sys/sysmacros.h>
+#include <sys/policy.h>
+#include <sys/atomic.h>
+#include <sys/model.h>
+#include <sys/strsun.h>
+
+#include <sys/netstack.h>
+#include <sys/hook.h>
+#include <sys/hook_event.h>
+
+#include <sys/ipd.h>
+
+#define IPDN_STATUS_DISABLED 0x1
+#define IPDN_STATUS_ENABLED 0x2
+#define IPDN_STATUS_CONDEMNED 0x4
+
+/*
+ * These flags are used to determine whether or not the hooks are registered.
+ */
+#define IPDN_HOOK_NONE 0x0
+#define IPDN_HOOK_V4IN 0x1
+#define IPDN_HOOK_V4OUT 0x2
+#define IPDN_HOOK_V6IN 0x4
+#define IPDN_HOOK_V6OUT 0x8
+#define IPDN_HOOK_ALL 0xf
+
+/*
+ * Per-netstack kstats.
+ */
+typedef struct ipd_nskstat {
+ kstat_named_t ink_ndrops;
+ kstat_named_t ink_ncorrupts;
+ kstat_named_t ink_ndelays;
+} ipd_nskstat_t;
+
+/*
+ * Different parts of this structure have different locking semantics. The list
+ * node is not normally referenced, if it is, one has to hold the ipd_nsl_lock.
+ * The following members are read only: ipdn_netid and ipdn_zoneid. The members
+ * of the kstat structure are always accessible in the data path, but the
+ * counters must be bumped with atomic operations. The ipdn_lock protects every
+ * other aspect of this structure. Please see the big theory statement on the
+ * requirements for lock ordering.
+ */
+typedef struct ipd_netstack {
+ list_node_t ipdn_link; /* link on ipd_nsl */
+ netid_t ipdn_netid; /* netstack id */
+ zoneid_t ipdn_zoneid; /* zone id */
+ kstat_t *ipdn_kstat; /* kstat_t ptr */
+ ipd_nskstat_t ipdn_ksdata; /* kstat data */
+ kmutex_t ipdn_lock; /* protects following members */
+ int ipdn_status; /* status flags */
+ net_handle_t ipdn_v4hdl; /* IPv4 net handle */
+ net_handle_t ipdn_v6hdl; /* IPv4 net handle */
+ int ipdn_hooked; /* are hooks registered */
+ hook_t *ipdn_v4in; /* IPv4 traffic in hook */
+ hook_t *ipdn_v4out; /* IPv4 traffice out hook */
+ hook_t *ipdn_v6in; /* IPv6 traffic in hook */
+ hook_t *ipdn_v6out; /* IPv6 traffic out hook */
+ int ipdn_enabled; /* which perturbs are on */
+ int ipdn_corrupt; /* corrupt percentage */
+ int ipdn_drop; /* drop percentage */
+ uint_t ipdn_delay; /* delay us */
+ long ipdn_rand; /* random seed */
+} ipd_netstack_t;
+
+/*
+ * ipd internal variables
+ */
+static dev_info_t *ipd_devi; /* device info */
+static net_instance_t *ipd_neti; /* net_instance for hooks */
+static unsigned int ipd_max_delay = IPD_MAX_DELAY; /* max delay in us */
+static kmutex_t ipd_nsl_lock; /* lock for the nestack list */
+static list_t ipd_nsl; /* list of netstacks */
+static kmutex_t ipd_nactive_lock; /* lock for nactive */
+static unsigned int ipd_nactive; /* number of active netstacks */
+static int ipd_nactive_fudge = 4; /* amount to fudge by in list */
+
+/*
+ * Note that this random number implementation is based upon the old BSD 4.1
+ * rand. It's good enough for us!
+ */
+static int
+ipd_nextrand(ipd_netstack_t *ins)
+{
+ ins->ipdn_rand = ins->ipdn_rand * 1103515245L + 12345;
+ return (ins->ipdn_rand & 0x7fffffff);
+}
+
+static void
+ipd_ksbump(kstat_named_t *nkp)
+{
+ atomic_inc_64(&nkp->value.ui64);
+}
+
+/*
+ * This is where all the magic actually happens. The way that this works is we
+ * grab the ins lock to basically get a copy of all the data that we need to do
+ * our job and then let it go to minimize contention. In terms of actual work on
+ * the packet we do them in the following order:
+ *
+ * - drop
+ * - delay
+ * - corrupt
+ */
+/*ARGSUSED*/
+static int
+ipd_hook(hook_event_token_t event, hook_data_t data, void *arg)
+{
+ unsigned char *crp;
+ int dwait, corrupt, drop, rand, off, status;
+ mblk_t *mbp;
+ ipd_netstack_t *ins = arg;
+ hook_pkt_event_t *pkt = (hook_pkt_event_t *)data;
+
+ mutex_enter(&ins->ipdn_lock);
+ status = ins->ipdn_status;
+ dwait = ins->ipdn_delay;
+ corrupt = ins->ipdn_corrupt;
+ drop = ins->ipdn_drop;
+ rand = ipd_nextrand(ins);
+ mutex_exit(&ins->ipdn_lock);
+
+ /*
+ * This probably cannot happen, but we'll do an extra guard just in
+ * case.
+ */
+ if (status & IPDN_STATUS_CONDEMNED)
+ return (0);
+
+ if (drop != 0 && rand % 100 < drop) {
+ freemsg(*pkt->hpe_mp);
+ *pkt->hpe_mp = NULL;
+ pkt->hpe_mb = NULL;
+ pkt->hpe_hdr = NULL;
+ ipd_ksbump(&ins->ipdn_ksdata.ink_ndrops);
+
+ return (1);
+ }
+
+ if (dwait != 0) {
+ if (dwait < TICK_TO_USEC(1))
+ drv_usecwait(dwait);
+ else
+ delay(drv_usectohz(dwait));
+ ipd_ksbump(&ins->ipdn_ksdata.ink_ndelays);
+ }
+
+ if (corrupt != 0 && rand % 100 < corrupt) {
+ /*
+ * Since we're corrupting the mblk, just corrupt everything in
+ * the chain. While we could corrupt the entire packet, that's a
+ * little strong. Instead we're going to just change one of the
+ * bytes in each mblock.
+ */
+ mbp = *pkt->hpe_mp;
+ while (mbp != NULL) {
+ if (mbp->b_wptr == mbp->b_rptr)
+ continue;
+
+ /*
+ * While pfhooks probably won't send us anything else,
+ * let's just be extra careful. The stack probably isn't
+ * as resiliant to corruption of control messages.
+ */
+ if (DB_TYPE(mbp) != M_DATA)
+ continue;
+
+ off = rand % ((uintptr_t)mbp->b_wptr -
+ (uintptr_t)mbp->b_rptr);
+ crp = mbp->b_rptr + off;
+ off = rand % 8;
+ *crp = *crp ^ (1 << off);
+
+ mbp = mbp->b_cont;
+ }
+ ipd_ksbump(&ins->ipdn_ksdata.ink_ncorrupts);
+ }
+
+ return (0);
+}
+
+/*
+ * Sets up and registers all the proper hooks needed for the netstack to capture
+ * packets. Callers are assumed to already be holding the ipd_netstack_t's lock.
+ * If there is a failure in setting something up, it is the responsibility of
+ * this function to clean it up. Once this function has been called, it should
+ * not be called until a corresponding call to tear down the hooks has been
+ * done.
+ */
+static int
+ipd_setup_hooks(ipd_netstack_t *ins)
+{
+ ASSERT(MUTEX_HELD(&ins->ipdn_lock));
+ ins->ipdn_v4hdl = net_protocol_lookup(ins->ipdn_netid, NHF_INET);
+ if (ins->ipdn_v4hdl == NULL)
+ goto cleanup;
+
+ ins->ipdn_v6hdl = net_protocol_lookup(ins->ipdn_netid, NHF_INET6);
+ if (ins->ipdn_v6hdl == NULL)
+ goto cleanup;
+
+ ins->ipdn_v4in = hook_alloc(HOOK_VERSION);
+ if (ins->ipdn_v4in == NULL)
+ goto cleanup;
+
+ ins->ipdn_v4in->h_flags = 0;
+ ins->ipdn_v4in->h_hint = HH_NONE;
+ ins->ipdn_v4in->h_hintvalue = 0;
+ ins->ipdn_v4in->h_func = ipd_hook;
+ ins->ipdn_v4in->h_arg = ins;
+ ins->ipdn_v4in->h_name = "ipd IPv4 in";
+
+ if (net_hook_register(ins->ipdn_v4hdl, NH_PHYSICAL_IN,
+ ins->ipdn_v4in) != 0)
+ goto cleanup;
+ ins->ipdn_hooked |= IPDN_HOOK_V4IN;
+
+ ins->ipdn_v4out = hook_alloc(HOOK_VERSION);
+ if (ins->ipdn_v4out == NULL)
+ goto cleanup;
+ ins->ipdn_v4out->h_flags = 0;
+ ins->ipdn_v4out->h_hint = HH_NONE;
+ ins->ipdn_v4out->h_hintvalue = 0;
+ ins->ipdn_v4out->h_func = ipd_hook;
+ ins->ipdn_v4out->h_arg = ins;
+ ins->ipdn_v4out->h_name = "ipd IPv4 out";
+
+ if (net_hook_register(ins->ipdn_v4hdl, NH_PHYSICAL_OUT,
+ ins->ipdn_v4out) != 0)
+ goto cleanup;
+ ins->ipdn_hooked |= IPDN_HOOK_V4OUT;
+
+ ins->ipdn_v6in = hook_alloc(HOOK_VERSION);
+ if (ins->ipdn_v6in == NULL)
+ goto cleanup;
+ ins->ipdn_v6in->h_flags = 0;
+ ins->ipdn_v6in->h_hint = HH_NONE;
+ ins->ipdn_v6in->h_hintvalue = 0;
+ ins->ipdn_v6in->h_func = ipd_hook;
+ ins->ipdn_v6in->h_arg = ins;
+ ins->ipdn_v6in->h_name = "ipd IPv6 in";
+
+ if (net_hook_register(ins->ipdn_v6hdl, NH_PHYSICAL_IN,
+ ins->ipdn_v6in) != 0)
+ goto cleanup;
+ ins->ipdn_hooked |= IPDN_HOOK_V6IN;
+
+ ins->ipdn_v6out = hook_alloc(HOOK_VERSION);
+ if (ins->ipdn_v6out == NULL)
+ goto cleanup;
+ ins->ipdn_v6out->h_flags = 0;
+ ins->ipdn_v6out->h_hint = HH_NONE;
+ ins->ipdn_v6out->h_hintvalue = 0;
+ ins->ipdn_v6out->h_func = ipd_hook;
+ ins->ipdn_v6out->h_arg = ins;
+ ins->ipdn_v6out->h_name = "ipd IPv6 out";
+
+ if (net_hook_register(ins->ipdn_v6hdl, NH_PHYSICAL_OUT,
+ ins->ipdn_v6out) != 0)
+ goto cleanup;
+ ins->ipdn_hooked |= IPDN_HOOK_V6OUT;
+ mutex_enter(&ipd_nactive_lock);
+ ipd_nactive++;
+ mutex_exit(&ipd_nactive_lock);
+
+ return (0);
+
+cleanup:
+ if (ins->ipdn_hooked & IPDN_HOOK_V6OUT)
+ (void) net_hook_unregister(ins->ipdn_v6hdl, NH_PHYSICAL_OUT,
+ ins->ipdn_v6out);
+
+ if (ins->ipdn_hooked & IPDN_HOOK_V6IN)
+ (void) net_hook_unregister(ins->ipdn_v6hdl, NH_PHYSICAL_IN,
+ ins->ipdn_v6in);
+
+ if (ins->ipdn_hooked & IPDN_HOOK_V4OUT)
+ (void) net_hook_unregister(ins->ipdn_v4hdl, NH_PHYSICAL_OUT,
+ ins->ipdn_v4out);
+
+ if (ins->ipdn_hooked & IPDN_HOOK_V4IN)
+ (void) net_hook_unregister(ins->ipdn_v4hdl, NH_PHYSICAL_IN,
+ ins->ipdn_v4in);
+
+ ins->ipdn_hooked = IPDN_HOOK_NONE;
+
+ if (ins->ipdn_v6out != NULL)
+ hook_free(ins->ipdn_v6out);
+
+ if (ins->ipdn_v6in != NULL)
+ hook_free(ins->ipdn_v6in);
+
+ if (ins->ipdn_v4out != NULL)
+ hook_free(ins->ipdn_v4out);
+
+ if (ins->ipdn_v4in != NULL)
+ hook_free(ins->ipdn_v4in);
+
+ if (ins->ipdn_v6hdl != NULL)
+ (void) net_protocol_release(ins->ipdn_v6hdl);
+
+ if (ins->ipdn_v4hdl != NULL)
+ (void) net_protocol_release(ins->ipdn_v4hdl);
+
+ return (1);
+}
+
+static void
+ipd_teardown_hooks(ipd_netstack_t *ins)
+{
+ ASSERT(ins->ipdn_hooked == IPDN_HOOK_ALL);
+ VERIFY(net_hook_unregister(ins->ipdn_v6hdl, NH_PHYSICAL_OUT,
+ ins->ipdn_v6out) == 0);
+ VERIFY(net_hook_unregister(ins->ipdn_v6hdl, NH_PHYSICAL_IN,
+ ins->ipdn_v6in) == 0);
+ VERIFY(net_hook_unregister(ins->ipdn_v4hdl, NH_PHYSICAL_OUT,
+ ins->ipdn_v4out) == 0);
+ VERIFY(net_hook_unregister(ins->ipdn_v4hdl, NH_PHYSICAL_IN,
+ ins->ipdn_v4in) == 0);
+
+ ins->ipdn_hooked = IPDN_HOOK_NONE;
+
+ hook_free(ins->ipdn_v6out);
+ hook_free(ins->ipdn_v6in);
+ hook_free(ins->ipdn_v4out);
+ hook_free(ins->ipdn_v4in);
+
+ VERIFY(net_protocol_release(ins->ipdn_v6hdl) == 0);
+ VERIFY(net_protocol_release(ins->ipdn_v4hdl) == 0);
+
+ mutex_enter(&ipd_nactive_lock);
+ ipd_nactive--;
+ mutex_exit(&ipd_nactive_lock);
+}
+
+static int
+ipd_check_hooks(ipd_netstack_t *ins, int type, boolean_t enable)
+{
+ int olden, rval;
+ olden = ins->ipdn_enabled;
+
+ if (enable)
+ ins->ipdn_enabled |= type;
+ else
+ ins->ipdn_enabled &= ~type;
+
+ /*
+ * If hooks were previously enabled.
+ */
+ if (olden == 0 && ins->ipdn_enabled != 0) {
+ rval = ipd_setup_hooks(ins);
+ if (rval != 0) {
+ ins->ipdn_enabled &= ~type;
+ ASSERT(ins->ipdn_enabled == 0);
+ return (rval);
+ }
+
+ return (0);
+ }
+
+ if (olden != 0 && ins->ipdn_enabled == 0) {
+ ASSERT(olden != 0);
+
+ /*
+ * We have to drop the lock here, lest we cause a deadlock.
+ * Unfortunately, there may be hooks that are running and are
+ * actively in flight and we have to call the unregister
+ * function. Due to the hooks framework, if there is an inflight
+ * hook (most likely right now), and we are holding the
+ * netstack's lock, those hooks will never return. This is
+ * unfortunate.
+ *
+ * Because we only come into this path holding the list lock, we
+ * know that only way that someone else can come in and get to
+ * this structure is via the hook callbacks which are going to
+ * only be doing reads. They'll also see that everything has
+ * been disabled and return. So while this is unfortunate, it
+ * should be relatively safe.
+ */
+ mutex_exit(&ins->ipdn_lock);
+ ipd_teardown_hooks(ins);
+ mutex_enter(&ins->ipdn_lock);
+ return (0);
+ }
+
+ /*
+ * Othwerise, nothing should have changed here.
+ */
+ ASSERT((olden == 0) == (ins->ipdn_enabled == 0));
+ return (0);
+}
+
+static int
+ipd_toggle_corrupt(ipd_netstack_t *ins, int percent)
+{
+ int rval;
+
+ ASSERT(MUTEX_HELD(&ins->ipdn_lock));
+
+ if (percent < 0 || percent > 100)
+ return (ERANGE);
+
+ /*
+ * If we've been asked to set the value to a value that we already have,
+ * great, then we're done.
+ */
+ if (percent == ins->ipdn_corrupt)
+ return (0);
+
+ ins->ipdn_corrupt = percent;
+ rval = ipd_check_hooks(ins, IPD_CORRUPT, percent != 0);
+
+ /*
+ * If ipd_check_hooks_failed, that must mean that we failed to set up
+ * the hooks, so we are going to effectively zero out and fail the
+ * request to enable corruption.
+ */
+ if (rval != 0)
+ ins->ipdn_corrupt = 0;
+
+ return (rval);
+}
+
+static int
+ipd_toggle_delay(ipd_netstack_t *ins, uint32_t delay)
+{
+ int rval;
+
+ ASSERT(MUTEX_HELD(&ins->ipdn_lock));
+
+ if (delay > ipd_max_delay)
+ return (ERANGE);
+
+ /*
+ * If we've been asked to set the value to a value that we already have,
+ * great, then we're done.
+ */
+ if (delay == ins->ipdn_delay)
+ return (0);
+
+ ins->ipdn_delay = delay;
+ rval = ipd_check_hooks(ins, IPD_DELAY, delay != 0);
+
+ /*
+ * If ipd_check_hooks_failed, that must mean that we failed to set up
+ * the hooks, so we are going to effectively zero out and fail the
+ * request to enable corruption.
+ */
+ if (rval != 0)
+ ins->ipdn_delay = 0;
+
+ return (rval);
+}
+static int
+ipd_toggle_drop(ipd_netstack_t *ins, int percent)
+{
+ int rval;
+
+ ASSERT(MUTEX_HELD(&ins->ipdn_lock));
+
+ if (percent < 0 || percent > 100)
+ return (ERANGE);
+
+ /*
+ * If we've been asked to set the value to a value that we already have,
+ * great, then we're done.
+ */
+ if (percent == ins->ipdn_drop)
+ return (0);
+
+ ins->ipdn_drop = percent;
+ rval = ipd_check_hooks(ins, IPD_DROP, percent != 0);
+
+ /*
+ * If ipd_check_hooks_failed, that must mean that we failed to set up
+ * the hooks, so we are going to effectively zero out and fail the
+ * request to enable corruption.
+ */
+ if (rval != 0)
+ ins->ipdn_drop = 0;
+
+ return (rval);
+}
+
+static int
+ipd_ioctl_perturb(ipd_ioc_perturb_t *ipi, cred_t *cr, intptr_t cmd)
+{
+ zoneid_t zid;
+ ipd_netstack_t *ins;
+ int rval = 0;
+
+ /*
+ * If the zone that we're coming from is not the GZ, then we ignore it
+ * completely and then instead just set the zoneid to be that of the
+ * caller. If the zoneid is that of the GZ, then we don't touch this
+ * value.
+ */
+ zid = crgetzoneid(cr);
+ if (zid != GLOBAL_ZONEID)
+ ipi->ipip_zoneid = zid;
+
+ if (zoneid_to_netstackid(ipi->ipip_zoneid) == GLOBAL_NETSTACKID &&
+ zid != GLOBAL_ZONEID)
+ return (EPERM);
+
+ /*
+ * We need to hold the ipd_nsl_lock throughout the entire operation,
+ * otherwise someone else could come in and remove us from the list and
+ * free us, e.g. the netstack destroy handler. By holding the lock, we
+ * stop it from being able to do anything wrong.
+ */
+ mutex_enter(&ipd_nsl_lock);
+ for (ins = list_head(&ipd_nsl); ins != NULL;
+ ins = list_next(&ipd_nsl, ins)) {
+ if (ins->ipdn_zoneid == ipi->ipip_zoneid)
+ break;
+ }
+
+ if (ins == NULL) {
+ mutex_exit(&ipd_nsl_lock);
+ return (EINVAL);
+ }
+
+ mutex_enter(&ins->ipdn_lock);
+
+ if (ins->ipdn_status & IPDN_STATUS_CONDEMNED) {
+ rval = ESHUTDOWN;
+ goto cleanup;
+ }
+
+ switch (cmd) {
+ case IPDIOC_CORRUPT:
+ rval = ipd_toggle_corrupt(ins, ipi->ipip_arg);
+ break;
+ case IPDIOC_DELAY:
+ rval = ipd_toggle_delay(ins, ipi->ipip_arg);
+ break;
+ case IPDIOC_DROP:
+ rval = ipd_toggle_drop(ins, ipi->ipip_arg);
+ break;
+ }
+
+cleanup:
+ mutex_exit(&ins->ipdn_lock);
+ mutex_exit(&ipd_nsl_lock);
+ return (rval);
+}
+
+static int
+ipd_ioctl_remove(ipd_ioc_perturb_t *ipi, cred_t *cr)
+{
+ zoneid_t zid;
+ ipd_netstack_t *ins;
+ int rval = 0;
+
+ /*
+ * See ipd_ioctl_perturb for the rational here.
+ */
+ zid = crgetzoneid(cr);
+ if (zid != GLOBAL_ZONEID)
+ ipi->ipip_zoneid = zid;
+
+ if (zoneid_to_netstackid(ipi->ipip_zoneid) == GLOBAL_NETSTACKID &&
+ zid != GLOBAL_ZONEID)
+ return (EPERM);
+
+ mutex_enter(&ipd_nsl_lock);
+ for (ins = list_head(&ipd_nsl); ins != NULL;
+ ins = list_next(&ipd_nsl, ins)) {
+ if (ins->ipdn_zoneid == ipi->ipip_zoneid)
+ break;
+ }
+
+ if (ins == NULL) {
+ mutex_exit(&ipd_nsl_lock);
+ return (EINVAL);
+ }
+
+ mutex_enter(&ins->ipdn_lock);
+
+ /*
+ * If this is condemned, that means it's very shortly going to be torn
+ * down. In that case, there's no reason to actually do anything here,
+ * as it will all be done rather shortly in the destroy function.
+ * Furthermore, because condemned corresponds with it having hit
+ * shutdown, we know that no more packets can be received by this
+ * netstack. All this translates to a no-op.
+ */
+ if (ins->ipdn_status & IPDN_STATUS_CONDEMNED) {
+ rval = 0;
+ goto cleanup;
+ }
+
+ rval = EINVAL;
+ /*
+ * Go through and disable the requested pieces. We can safely ignore the
+ * return value of ipd_check_hooks because the removal case should never
+ * fail, we verify that in the hook teardown case.
+ */
+ if (ipi->ipip_arg & IPD_CORRUPT) {
+ ins->ipdn_corrupt = 0;
+ (void) ipd_check_hooks(ins, IPD_CORRUPT, B_FALSE);
+ rval = 0;
+ }
+
+ if (ipi->ipip_arg & IPD_DELAY) {
+ ins->ipdn_delay = 0;
+ (void) ipd_check_hooks(ins, IPD_DELAY, B_FALSE);
+ rval = 0;
+ }
+
+ if (ipi->ipip_arg & IPD_DROP) {
+ ins->ipdn_drop = 0;
+ (void) ipd_check_hooks(ins, IPD_DROP, B_FALSE);
+ rval = 0;
+ }
+
+cleanup:
+ mutex_exit(&ins->ipdn_lock);
+ mutex_exit(&ipd_nsl_lock);
+ return (rval);
+}
+
+/*
+ * When this function is called, the value of the ipil_nzones argument controls
+ * how this function works. When called with a value of zero, then we treat that
+ * as the caller asking us what's a reasonable number of entries for me to
+ * allocate memory for. If the zone is the global zone, then we tell them how
+ * many folks are currently active and add a fudge factor. Otherwise the answer
+ * is always one.
+ *
+ * In the non-zero case, we give them that number of zone ids. While this isn't
+ * quite ideal as it might mean that someone misses something, this generally
+ * won't be an issue, as it involves a rather tight race condition in the
+ * current ipdadm implementation.
+ */
+static int
+ipd_ioctl_list(intptr_t arg, cred_t *cr)
+{
+ zoneid_t zid;
+ ipd_ioc_info_t *configs;
+ ipd_netstack_t *ins;
+ uint_t azones, rzones, nzones, cur;
+ int rval = 0;
+ STRUCT_DECL(ipd_ioc_list, h);
+
+ STRUCT_INIT(h, get_udatamodel());
+ if (ddi_copyin((void *)arg, STRUCT_BUF(h),
+ STRUCT_SIZE(h), 0) != 0)
+ return (EFAULT);
+
+ zid = crgetzoneid(cr);
+
+ rzones = STRUCT_FGET(h, ipil_nzones);
+ if (rzones == 0) {
+ if (zid == GLOBAL_ZONEID) {
+ mutex_enter(&ipd_nactive_lock);
+ rzones = ipd_nactive + ipd_nactive_fudge;
+ mutex_exit(&ipd_nactive_lock);
+ } else {
+ rzones = 1;
+ }
+ STRUCT_FSET(h, ipil_nzones, rzones);
+ if (ddi_copyout(STRUCT_BUF(h), (void *)arg,
+ STRUCT_SIZE(h), 0) != 0)
+ return (EFAULT);
+
+ return (0);
+ }
+
+ mutex_enter(&ipd_nsl_lock);
+ if (zid == GLOBAL_ZONEID) {
+ azones = ipd_nactive;
+ } else {
+ azones = 1;
+ }
+
+ configs = kmem_alloc(sizeof (ipd_ioc_info_t) * azones, KM_SLEEP);
+ cur = 0;
+ for (ins = list_head(&ipd_nsl); ins != NULL;
+ ins = list_next(&ipd_nsl, ins)) {
+ if (ins->ipdn_enabled == 0)
+ continue;
+
+ ASSERT(cur < azones);
+
+ if (zid == GLOBAL_ZONEID || zid == ins->ipdn_zoneid) {
+ configs[cur].ipii_zoneid = ins->ipdn_zoneid;
+
+ mutex_enter(&ins->ipdn_lock);
+ configs[cur].ipii_corrupt = ins->ipdn_corrupt;
+ configs[cur].ipii_delay = ins->ipdn_delay;
+ configs[cur].ipii_drop = ins->ipdn_drop;
+ mutex_exit(&ins->ipdn_lock);
+
+ ++cur;
+ }
+
+ if (zid != GLOBAL_ZONEID && zid == ins->ipdn_zoneid)
+ break;
+ }
+ mutex_exit(&ipd_nsl_lock);
+
+ ASSERT(zid != GLOBAL_ZONEID || cur == azones);
+
+ if (cur == 0)
+ STRUCT_FSET(h, ipil_nzones, 0);
+ else
+ STRUCT_FSET(h, ipil_nzones, cur);
+
+ nzones = MIN(cur, rzones);
+ if (nzones > 0) {
+ if (ddi_copyout(configs, STRUCT_FGETP(h, ipil_info),
+ nzones * sizeof (ipd_ioc_info_t), NULL) != 0)
+ rval = EFAULT;
+ }
+
+ kmem_free(configs, sizeof (ipd_ioc_info_t) * azones);
+ if (ddi_copyout(STRUCT_BUF(h), (void *)arg, STRUCT_SIZE(h), 0) != 0)
+ return (EFAULT);
+
+ return (rval);
+}
+
+static void *
+ipd_nin_create(const netid_t id)
+{
+ ipd_netstack_t *ins;
+ ipd_nskstat_t *ink;
+
+ ins = kmem_zalloc(sizeof (ipd_netstack_t), KM_SLEEP);
+ ins->ipdn_status = IPDN_STATUS_DISABLED;
+ ins->ipdn_netid = id;
+ ins->ipdn_zoneid = netstackid_to_zoneid(id);
+ ins->ipdn_rand = gethrtime();
+ mutex_init(&ins->ipdn_lock, NULL, MUTEX_DRIVER, NULL);
+
+ ins->ipdn_kstat = net_kstat_create(id, "ipd", ins->ipdn_zoneid,
+ "ipd", "net", KSTAT_TYPE_NAMED,
+ sizeof (ipd_nskstat_t) / sizeof (kstat_named_t),
+ KSTAT_FLAG_VIRTUAL);
+
+ if (ins->ipdn_kstat != NULL) {
+ if (ins->ipdn_zoneid != GLOBAL_ZONEID)
+ kstat_zone_add(ins->ipdn_kstat, GLOBAL_ZONEID);
+
+ ink = &ins->ipdn_ksdata;
+ ins->ipdn_kstat->ks_data = ink;
+ kstat_named_init(&ink->ink_ncorrupts, "corrupts",
+ KSTAT_DATA_UINT64);
+ kstat_named_init(&ink->ink_ndrops, "drops", KSTAT_DATA_UINT64);
+ kstat_named_init(&ink->ink_ndelays, "delays",
+ KSTAT_DATA_UINT64);
+ kstat_install(ins->ipdn_kstat);
+ }
+
+ mutex_enter(&ipd_nsl_lock);
+ list_insert_tail(&ipd_nsl, ins);
+ mutex_exit(&ipd_nsl_lock);
+
+ return (ins);
+}
+
+static void
+ipd_nin_shutdown(const netid_t id, void *arg)
+{
+ ipd_netstack_t *ins = arg;
+
+ VERIFY(id == ins->ipdn_netid);
+ mutex_enter(&ins->ipdn_lock);
+ ASSERT(ins->ipdn_status == IPDN_STATUS_DISABLED ||
+ ins->ipdn_status == IPDN_STATUS_ENABLED);
+ ins->ipdn_status |= IPDN_STATUS_CONDEMNED;
+ if (ins->ipdn_kstat != NULL)
+ net_kstat_delete(id, ins->ipdn_kstat);
+ mutex_exit(&ins->ipdn_lock);
+}
+
+/*ARGSUSED*/
+static void
+ipd_nin_destroy(const netid_t id, void *arg)
+{
+ ipd_netstack_t *ins = arg;
+
+ /*
+ * At this point none of the hooks should be able to fire because the
+ * zone has been shutdown and we are in the process of destroying it.
+ * Thus it should not be possible for someone else to come in and grab
+ * our ipd_netstack_t for this zone. Because of that, we know that we
+ * are the only ones who could be running here.
+ */
+ mutex_enter(&ipd_nsl_lock);
+ list_remove(&ipd_nsl, ins);
+ mutex_exit(&ipd_nsl_lock);
+
+ if (ins->ipdn_hooked)
+ ipd_teardown_hooks(ins);
+ mutex_destroy(&ins->ipdn_lock);
+ kmem_free(ins, sizeof (ipd_netstack_t));
+}
+
+/*ARGSUSED*/
+static int
+ipd_open(dev_t *devp, int flag, int otype, cred_t *credp)
+{
+ if (flag & FEXCL || flag & FNDELAY)
+ return (EINVAL);
+
+ if (otype != OTYP_CHR)
+ return (EINVAL);
+
+ if (!(flag & FREAD && flag & FWRITE))
+ return (EINVAL);
+
+ if (secpolicy_ip_config(credp, B_FALSE) != 0)
+ return (EPERM);
+
+ return (0);
+}
+
+/*ARGSUSED*/
+static int
+ipd_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv)
+{
+ int rval;
+ ipd_ioc_perturb_t ipip;
+
+ switch (cmd) {
+ case IPDIOC_CORRUPT:
+ case IPDIOC_DELAY:
+ case IPDIOC_DROP:
+ if (ddi_copyin((void *)arg, &ipip, sizeof (ipd_ioc_perturb_t),
+ 0) != 0)
+ return (EFAULT);
+ rval = ipd_ioctl_perturb(&ipip, cr, cmd);
+ return (rval);
+ case IPDIOC_REMOVE:
+ if (ddi_copyin((void *)arg, &ipip, sizeof (ipd_ioc_perturb_t),
+ 0) != 0)
+ return (EFAULT);
+ rval = ipd_ioctl_remove(&ipip, cr);
+ return (rval);
+ case IPDIOC_LIST:
+ /*
+ * Because the list ioctl doesn't have a fixed-size struct due
+ * to needing to pass around a pointer, we instead delegate the
+ * copyin logic to the list code.
+ */
+ return (ipd_ioctl_list(arg, cr));
+ default:
+ break;
+ }
+ return (ENOTTY);
+}
+
+/*ARGSUSED*/
+static int
+ipd_close(dev_t dev, int flag, int otype, cred_t *credp)
+{
+ return (0);
+}
+
+static int
+ipd_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
+{
+ minor_t instance;
+
+ if (cmd != DDI_ATTACH)
+ return (DDI_FAILURE);
+
+ if (ipd_devi != NULL)
+ return (DDI_FAILURE);
+
+ instance = ddi_get_instance(dip);
+ if (ddi_create_minor_node(dip, "ipd", S_IFCHR, instance,
+ DDI_PSEUDO, 0) == DDI_FAILURE)
+ return (DDI_FAILURE);
+
+ ipd_neti = net_instance_alloc(NETINFO_VERSION);
+ if (ipd_neti == NULL) {
+ ddi_remove_minor_node(dip, NULL);
+ return (DDI_FAILURE);
+ }
+
+ /*
+ * Note that these global structures MUST be initialized before we call
+ * net_instance_register, as that will instantly cause us to drive into
+ * the ipd_nin_create callbacks.
+ */
+ list_create(&ipd_nsl, sizeof (ipd_netstack_t),
+ offsetof(ipd_netstack_t, ipdn_link));
+ mutex_init(&ipd_nsl_lock, NULL, MUTEX_DRIVER, NULL);
+ mutex_init(&ipd_nactive_lock, NULL, MUTEX_DRIVER, NULL);
+
+ /* Note, net_instance_alloc sets the version. */
+ ipd_neti->nin_name = "ipd";
+ ipd_neti->nin_create = ipd_nin_create;
+ ipd_neti->nin_destroy = ipd_nin_destroy;
+ ipd_neti->nin_shutdown = ipd_nin_shutdown;
+ if (net_instance_register(ipd_neti) == DDI_FAILURE) {
+ net_instance_free(ipd_neti);
+ ddi_remove_minor_node(dip, NULL);
+ }
+
+ ddi_report_dev(dip);
+ ipd_devi = dip;
+
+ return (DDI_SUCCESS);
+}
+
+/*ARGSUSED*/
+static int
+ipd_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+ int error;
+
+ switch (infocmd) {
+ case DDI_INFO_DEVT2DEVINFO:
+ *result = ipd_devi;
+ error = DDI_SUCCESS;
+ break;
+ case DDI_INFO_DEVT2INSTANCE:
+ *result = (void *)(uintptr_t)getminor((dev_t)arg);
+ error = DDI_SUCCESS;
+ default:
+ error = DDI_FAILURE;
+ break;
+ }
+
+ return (error);
+}
+
+static int
+ipd_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
+{
+ if (cmd != DDI_DETACH)
+ return (DDI_FAILURE);
+
+ ASSERT(dip == ipd_devi);
+ ddi_remove_minor_node(dip, NULL);
+ ipd_devi = NULL;
+
+ if (ipd_neti != NULL) {
+ VERIFY(net_instance_unregister(ipd_neti) == 0);
+ net_instance_free(ipd_neti);
+ }
+
+ mutex_destroy(&ipd_nsl_lock);
+ mutex_destroy(&ipd_nactive_lock);
+ list_destroy(&ipd_nsl);
+
+ return (DDI_SUCCESS);
+}
+
+static struct cb_ops ipd_cb_ops = {
+ ipd_open, /* open */
+ ipd_close, /* close */
+ nodev, /* strategy */
+ nodev, /* print */
+ nodev, /* dump */
+ nodev, /* read */
+ nodev, /* write */
+ ipd_ioctl, /* ioctl */
+ nodev, /* devmap */
+ nodev, /* mmap */
+ nodev, /* segmap */
+ nochpoll, /* poll */
+ ddi_prop_op, /* cb_prop_op */
+ NULL, /* streamtab */
+ D_NEW | D_MP, /* Driver compatibility flag */
+ CB_REV, /* rev */
+ nodev, /* aread */
+ nodev /* awrite */
+};
+
+static struct dev_ops ipd_ops = {
+ DEVO_REV, /* devo_rev */
+ 0, /* refcnt */
+ ipd_getinfo, /* get_dev_info */
+ nulldev, /* identify */
+ nulldev, /* probe */
+ ipd_attach, /* attach */
+ ipd_detach, /* detach */
+ nodev, /* reset */
+ &ipd_cb_ops, /* driver operations */
+ NULL, /* bus operations */
+ nodev, /* dev power */
+ ddi_quiesce_not_needed /* quiesce */
+};
+
+static struct modldrv modldrv = {
+ &mod_driverops,
+ "Internet packet disturber",
+ &ipd_ops
+};
+
+static struct modlinkage modlinkage = {
+ MODREV_1,
+ { (void *)&modldrv, NULL }
+};
+
+int
+_init(void)
+{
+ return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+ return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+ return (mod_remove(&modlinkage));
+}
diff --git a/usr/src/cmd/lp/lib/oam/lp_lib_oam.xcl b/usr/src/uts/common/inet/ipd/ipd.conf
index ccc0fa8c6d..83b9b685f4 100644
--- a/usr/src/cmd/lp/lib/oam/lp_lib_oam.xcl
+++ b/usr/src/uts/common/inet/ipd/ipd.conf
@@ -20,10 +20,8 @@
# CDDL HEADER END
#
#
-# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-msgid ""
-msgid "999999"
+
+name="ipd" parent="pseudo" instance=0;
diff --git a/usr/src/uts/common/inet/ipf/fil.c b/usr/src/uts/common/inet/ipf/fil.c
index 3955d881e8..e04d9242ea 100644
--- a/usr/src/uts/common/inet/ipf/fil.c
+++ b/usr/src/uts/common/inet/ipf/fil.c
@@ -4,6 +4,8 @@
* See the IPFILTER.LICENCE file for details on licencing.
*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#if defined(KERNEL) || defined(_KERNEL)
@@ -5696,6 +5698,39 @@ static int fr_objbytes[NUM_OBJ_TYPES][2] = {
/* ------------------------------------------------------------------------ */
+/* Function: fr_getzoneid */
+/* Returns: int - 0 = success, else failure */
+/* Parameters: idsp(I) - pointer to ipf_devstate_t */
+/* data(I) - pointer to ioctl data */
+/* */
+/* Set the zone ID in idsp based on the zone name in ipfzoneobj. Further */
+/* ioctls will act on the IPF stack for that zone ID. */
+/* ------------------------------------------------------------------------ */
+#if defined(SOLARIS) && defined(_KERNEL)
+int fr_setzoneid(idsp, data)
+ipf_devstate_t *idsp;
+void *data;
+{
+ int error = 0;
+ ipfzoneobj_t ipfzo;
+ zone_t *zone;
+
+ error = BCOPYIN(data, &ipfzo, sizeof(ipfzo));
+ if (error != 0)
+ return EFAULT;
+
+ if ((zone = zone_find_by_name(ipfzo.ipfz_zonename)) == NULL)
+ return ENODEV;
+
+ idsp->ipfs_zoneid = zone->zone_id;
+ zone_rele(zone);
+
+ return error;
+}
+#endif
+
+
+/* ------------------------------------------------------------------------ */
/* Function: fr_inobj */
/* Returns: int - 0 = success, else failure */
/* Parameters: data(I) - pointer to ioctl data */
diff --git a/usr/src/uts/common/inet/ipf/ip_fil_solaris.c b/usr/src/uts/common/inet/ipf/ip_fil_solaris.c
index 98cda0b7cc..1b23cfe497 100644
--- a/usr/src/uts/common/inet/ipf/ip_fil_solaris.c
+++ b/usr/src/uts/common/inet/ipf/ip_fil_solaris.c
@@ -4,6 +4,8 @@
* See the IPFILTER.LICENCE file for details on licencing.
*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#if !defined(lint)
@@ -101,6 +103,8 @@ u_long *ip_forwarding = NULL;
#endif
#endif
+vmem_t *ipf_minor; /* minor number arena */
+void *ipf_state; /* DDI state */
/* ------------------------------------------------------------------------ */
/* Function: ipldetach */
@@ -141,11 +145,13 @@ ipf_stack_t *ifs;
#define UNDO_HOOK(_f, _b, _e, _h) \
do { \
+ int tmp; \
if (ifs->_f != NULL) { \
if (ifs->_b) { \
- ifs->_b = (net_hook_unregister(ifs->_f, \
- _e, ifs->_h) != 0); \
- if (!ifs->_b) { \
+ tmp = net_hook_unregister(ifs->_f, \
+ _e, ifs->_h); \
+ ifs->_b = (tmp != 0 && tmp != ENXIO); \
+ if (!ifs->_b && ifs->_h != NULL) { \
hook_free(ifs->_h); \
ifs->_h = NULL; \
} \
@@ -518,35 +524,52 @@ int *rp;
minor_t unit;
u_int enable;
ipf_stack_t *ifs;
+ zoneid_t zid;
+ ipf_devstate_t *isp;
#ifdef IPFDEBUG
cmn_err(CE_CONT, "iplioctl(%x,%x,%x,%d,%x,%d)\n",
dev, cmd, data, mode, cp, rp);
#endif
unit = getminor(dev);
- if (IPL_LOGMAX < unit)
+
+ isp = ddi_get_soft_state(ipf_state, unit);
+ if (isp == NULL) {
return ENXIO;
+ }
+ unit = isp->ipfs_minor;
+
+ zid = crgetzoneid(cp);
+ if (cmd == SIOCIPFZONESET) {
+ if (zid == GLOBAL_ZONEID)
+ return fr_setzoneid(isp, (caddr_t) data);
+ return EACCES;
+ }
+
+ if (zid == GLOBAL_ZONEID)
+ zid = isp->ipfs_zoneid;
/*
- * As we're calling ipf_find_stack in user space, from a given zone
- * to find the stack pointer for this zone, there is no need to have
- * a hold/refence count here.
+ * ipf_find_stack returns with a read lock on ifs_ipf_global
*/
- ifs = ipf_find_stack(crgetzoneid(cp));
- ASSERT(ifs != NULL);
+ ifs = ipf_find_stack(zid);
+ if (ifs == NULL) {
+ return ENXIO;
+ }
if (ifs->ifs_fr_running <= 0) {
if (unit != IPL_LOGIPF) {
+ RWLOCK_EXIT(&ifs->ifs_ipf_global);
return EIO;
}
if (cmd != SIOCIPFGETNEXT && cmd != SIOCIPFGET &&
cmd != SIOCIPFSET && cmd != SIOCFRENB &&
cmd != SIOCGETFS && cmd != SIOCGETFF) {
+ RWLOCK_EXIT(&ifs->ifs_ipf_global);
return EIO;
}
}
- READ_ENTER(&ifs->ifs_ipf_global);
if (ifs->ifs_fr_enable_active != 0) {
RWLOCK_EXIT(&ifs->ifs_ipf_global);
return EBUSY;
@@ -847,7 +870,9 @@ dev_t *devp;
int flags, otype;
cred_t *cred;
{
+ ipf_devstate_t *isp;
minor_t min = getminor(*devp);
+ minor_t minor;
#ifdef IPFDEBUG
cmn_err(CE_CONT, "iplopen(%x,%x,%x,%x)\n", devp, flags, otype, cred);
@@ -855,8 +880,25 @@ cred_t *cred;
if (!(otype & OTYP_CHR))
return ENXIO;
- min = (IPL_LOGMAX < min) ? ENXIO : 0;
- return min;
+ if (IPL_LOGMAX < min)
+ return ENXIO;
+
+ minor = (minor_t)(uintptr_t)vmem_alloc(ipf_minor, 1,
+ VM_BESTFIT | VM_SLEEP);
+
+ if (ddi_soft_state_zalloc(ipf_state, minor) != 0) {
+ vmem_free(ipf_minor, (void *)(uintptr_t)minor, 1);
+ return ENXIO;
+ }
+
+ *devp = makedevice(getmajor(*devp), minor);
+ isp = ddi_get_soft_state(ipf_state, minor);
+ VERIFY(isp != NULL);
+
+ isp->ipfs_minor = min;
+ isp->ipfs_zoneid = GLOBAL_ZONEID;
+
+ return 0;
}
@@ -872,8 +914,13 @@ cred_t *cred;
cmn_err(CE_CONT, "iplclose(%x,%x,%x,%x)\n", dev, flags, otype, cred);
#endif
- min = (IPL_LOGMAX < min) ? ENXIO : 0;
- return min;
+ if (IPL_LOGMAX < min)
+ return ENXIO;
+
+ ddi_soft_state_free(ipf_state, min);
+ vmem_free(ipf_minor, (void *)(uintptr_t)min, 1);
+
+ return 0;
}
#ifdef IPFILTER_LOG
@@ -891,30 +938,48 @@ cred_t *cp;
{
ipf_stack_t *ifs;
int ret;
+ minor_t unit;
+ zoneid_t zid;
+ ipf_devstate_t *isp;
+
+ unit = getminor(dev);
+ isp = ddi_get_soft_state(ipf_state, unit);
+ if (isp == NULL) {
+ return ENXIO;
+ }
+ unit = isp->ipfs_minor;
+
+ zid = crgetzoneid(cp);
+ if (zid == GLOBAL_ZONEID) {
+ zid = isp->ipfs_zoneid;
+ }
/*
- * As we're calling ipf_find_stack in user space, from a given zone
- * to find the stack pointer for this zone, there is no need to have
- * a hold/refence count here.
+ * ipf_find_stack returns with a read lock on ifs_ipf_global
*/
- ifs = ipf_find_stack(crgetzoneid(cp));
- ASSERT(ifs != NULL);
+ ifs = ipf_find_stack(zid);
+ if (ifs == NULL) {
+ return ENXIO;
+ }
# ifdef IPFDEBUG
cmn_err(CE_CONT, "iplread(%x,%x,%x)\n", dev, uio, cp);
# endif
if (ifs->ifs_fr_running < 1) {
+ RWLOCK_EXIT(&ifs->ifs_ipf_global);
return EIO;
}
# ifdef IPFILTER_SYNC
- if (getminor(dev) == IPL_LOGSYNC) {
+ if (unit == IPL_LOGSYNC) {
+ RWLOCK_EXIT(&ifs->ifs_ipf_global);
return ipfsync_read(uio);
}
# endif
- ret = ipflog_read(getminor(dev), uio, ifs);
+ ret = ipflog_read(unit, uio, ifs);
+ RWLOCK_EXIT(&ifs->ifs_ipf_global);
return ret;
}
#endif /* IPFILTER_LOG */
@@ -932,20 +997,36 @@ register struct uio *uio;
cred_t *cp;
{
ipf_stack_t *ifs;
+ minor_t unit;
+ zoneid_t zid;
+ ipf_devstate_t *isp;
+
+ unit = getminor(dev);
+ isp = ddi_get_soft_state(ipf_state, unit);
+ if (isp == NULL) {
+ return ENXIO;
+ }
+ unit = isp->ipfs_minor;
/*
- * As we're calling ipf_find_stack in user space, from a given zone
- * to find the stack pointer for this zone, there is no need to have
- * a hold/refence count here.
+ * ipf_find_stack returns with a read lock on ifs_ipf_global
*/
- ifs = ipf_find_stack(crgetzoneid(cp));
- ASSERT(ifs != NULL);
+ zid = crgetzoneid(cp);
+ if (zid == GLOBAL_ZONEID) {
+ zid = isp->ipfs_zoneid;
+ }
+
+ ifs = ipf_find_stack(zid);
+ if (ifs == NULL) {
+ return ENXIO;
+ }
#ifdef IPFDEBUG
cmn_err(CE_CONT, "iplwrite(%x,%x,%x)\n", dev, uio, cp);
#endif
if (ifs->ifs_fr_running < 1) {
+ RWLOCK_EXIT(&ifs->ifs_ipf_global);
return EIO;
}
@@ -956,6 +1037,7 @@ cred_t *cp;
dev = dev; /* LINT */
uio = uio; /* LINT */
cp = cp; /* LINT */
+ RWLOCK_EXIT(&ifs->ifs_ipf_global);
return ENXIO;
}
diff --git a/usr/src/uts/common/inet/ipf/ip_log.c b/usr/src/uts/common/inet/ipf/ip_log.c
index 1fe54f3a07..66e590eb4e 100644
--- a/usr/src/uts/common/inet/ipf/ip_log.c
+++ b/usr/src/uts/common/inet/ipf/ip_log.c
@@ -7,6 +7,8 @@
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/param.h>
@@ -572,10 +574,15 @@ ipf_stack_t *ifs;
while (ifs->ifs_iplt[unit] == NULL) {
# if SOLARIS && defined(_KERNEL)
+ /*
+ * Prevent a deadlock with ipldetach()
+ */
+ RWLOCK_EXIT(&ifs->ifs_ipf_global);
if (!cv_wait_sig(&ifs->ifs_iplwait, &ifs->ifs_ipl_mutex.ipf_lk)) {
MUTEX_EXIT(&ifs->ifs_ipl_mutex);
return EINTR;
}
+ READ_ENTER(&ifs->ifs_ipf_global);
# else
# if defined(__hpux) && defined(_KERNEL)
lock_t *l;
diff --git a/usr/src/uts/common/inet/ipf/ipf.conf b/usr/src/uts/common/inet/ipf/ipf.conf
index 6b36f9fdbf..f49e024a72 100644
--- a/usr/src/uts/common/inet/ipf/ipf.conf
+++ b/usr/src/uts/common/inet/ipf/ipf.conf
@@ -1,3 +1,8 @@
#
#
name="ipf" parent="pseudo" instance=0;
+
+# Increase the state table limits. fr_statemax should be ~70% of fr_statesize,
+# and both should be prime numbers
+fr_statesize=151007;
+fr_statemax=113279;
diff --git a/usr/src/uts/common/inet/ipf/netinet/ip_fil.h b/usr/src/uts/common/inet/ipf/netinet/ip_fil.h
index 0a2d6431d8..5b4d125764 100644
--- a/usr/src/uts/common/inet/ipf/netinet/ip_fil.h
+++ b/usr/src/uts/common/inet/ipf/netinet/ip_fil.h
@@ -7,6 +7,8 @@
* $Id: ip_fil.h,v 2.170.2.22 2005/07/16 05:55:35 darrenr Exp $
*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef __IP_FIL_H__
@@ -107,6 +109,10 @@
#define SIOCDELFR SIOCRMAFR
#define SIOCINSFR SIOCINAFR
+#ifdef SOLARIS
+# define SIOCIPFZONESET _IOWR('r', 97, struct ipfzoneobj)
+#endif
+
/*
* What type of table is getting flushed?
*/
@@ -1165,6 +1171,23 @@ typedef struct ipfobj {
u_char ipfo_xxxpad[32]; /* reserved for future use */
} ipfobj_t;
+#if defined(SOLARIS)
+
+#include <sys/zone.h>
+
+typedef struct ipfzoneobj {
+ char ipfz_zonename[ZONENAME_MAX];
+} ipfzoneobj_t;
+
+#if defined(_KERNEL)
+typedef struct ipf_devstate {
+ zoneid_t ipfs_zoneid;
+ minor_t ipfs_minor;
+} ipf_devstate_t;
+#endif
+
+#endif
+
#define IPFOBJ_FRENTRY 0 /* struct frentry */
#define IPFOBJ_IPFSTAT 1 /* struct friostat */
#define IPFOBJ_IPFINFO 2 /* struct fr_info */
@@ -1576,6 +1599,10 @@ extern int ipf_earlydrop __P((int, ipftq_t *, int, ipf_stack_t *));
extern u_32_t ipf_random __P((void));
#endif
+#if defined(SOLARIS) && defined(_KERNEL)
+extern int fr_setzoneid __P((ipf_devstate_t *, void *));
+#endif
+
extern char ipfilter_version[];
#ifdef USE_INET6
extern int icmptoicmp6types[ICMP_MAXTYPE+1];
diff --git a/usr/src/uts/common/inet/ipf/solaris.c b/usr/src/uts/common/inet/ipf/solaris.c
index 1a1d94def5..c127185fea 100644
--- a/usr/src/uts/common/inet/ipf/solaris.c
+++ b/usr/src/uts/common/inet/ipf/solaris.c
@@ -5,6 +5,50 @@
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * ipfilter kernel module mutexes and locking:
+ *
+ * Enabling ipfilter creates a per-netstack ipf_stack_t object that is
+ * stored in the ipf_stacks list, which is protected by ipf_stack_lock.
+ * ipf_stack_t objects are accessed in three contexts:
+ *
+ * 1) administering that filter (eg: ioctls handled with iplioctl())
+ * 2) reading log data (eg: iplread() / iplwrite())
+ * 3) filtering packets (eg: ipf_hook4_* and ipf_hook6_* pfhooks
+ * functions)
+ *
+ * Each ipf_stack_t has a RW lock, ifs_ipf_global, protecting access to the
+ * whole structure. The structure also has locks protecting the various
+ * data structures used for filtering. The following guidelines should be
+ * followed for ipf_stack_t locks:
+ *
+ * - ipf_stack_lock must be held when accessing the ipf_stacks list
+ * - ipf_stack_lock should be held before acquiring ifs_ipf_global for
+ * a stack (the exception to this is ipf_stack_destroy(), which removes
+ * the ipf_stack_t from the list, then drops ipf_stack_lock before
+ * acquiring ifs_ipf_global)
+ * - ifs_ipf_global must be held when accessing an ipf_stack_t in that list:
+ * - The write lock is held only during stack creation / destruction
+ * - The read lock should be held for all other accesses
+ * - To alter the filtering data in the administrative context, one must:
+ * - acquire the read lock for ifs_ipf_global
+ * - then acquire the write lock for the data in question
+ * - In the filtering path, the read lock needs to be held for each type of
+ * filtering data used
+ * - ifs_ipf_global does not need to be held in the filtering path:
+ * - The filtering hooks don't need to modify the stack itself
+ * - The ipf_stack_t will not be destroyed until the hooks are unregistered.
+ * This requires a write lock on the hook, ensuring that no active hooks
+ * (eg: the filtering path) are running, and that the hooks won't be run
+ * afterward.
+ *
+ * Note that there is a deadlock possible when calling net_hook_register()
+ * or net_hook_unregister() with ifs_ipf_global held: see the comments in
+ * iplattach() and ipldetach() for details.
*/
#include <sys/systm.h>
@@ -73,7 +117,8 @@ static int ipf_property_g_update __P((dev_info_t *));
static char *ipf_devfiles[] = { IPL_NAME, IPNAT_NAME, IPSTATE_NAME,
IPAUTH_NAME, IPSYNC_NAME, IPSCAN_NAME,
IPLOOKUP_NAME, NULL };
-
+extern void *ipf_state; /* DDI state */
+extern vmem_t *ipf_minor; /* minor number arena */
static struct cb_ops ipf_cb_ops = {
iplopen,
@@ -429,13 +474,8 @@ ipf_stack_create(const netid_t id)
/*
- * This function should only ever be used to find the pointer to the
- * ipfilter stack structure for the zone that is currently being
- * executed... so if you're running in the context of zone 1, you
- * should not attempt to find the ipf_stack_t for zone 0 or 2 or
- * anything else but 1. In that way, the returned pointer is safe
- * as it will only be nuked when the instance is destroyed as part
- * of the final shutdown of a zone.
+ * This function returns with the ipf_stack_t's ifs_ipf_global
+ * read lock held (if the stack is found).
*/
ipf_stack_t *
ipf_find_stack(const zoneid_t zone)
@@ -447,6 +487,10 @@ ipf_find_stack(const zoneid_t zone)
if (ifs->ifs_zone == zone)
break;
}
+
+ if (ifs != NULL) {
+ READ_ENTER(&ifs->ifs_ipf_global);
+ }
mutex_exit(&ipf_stack_lock);
return (ifs);
}
@@ -586,27 +630,39 @@ ddi_attach_cmd_t cmd;
(void) ipf_property_g_update(dip);
+ if (ddi_soft_state_init(&ipf_state, sizeof (ipf_devstate_t), 1)
+ != 0) {
+ ddi_prop_remove_all(dip);
+ return (DDI_FAILURE);
+ }
+
for (i = 0; ((s = ipf_devfiles[i]) != NULL); i++) {
s = strrchr(s, '/');
if (s == NULL)
continue;
s++;
if (ddi_create_minor_node(dip, s, S_IFCHR, i,
- DDI_PSEUDO, 0) ==
- DDI_FAILURE) {
- ddi_remove_minor_node(dip, NULL);
+ DDI_PSEUDO, 0) == DDI_FAILURE)
goto attach_failed;
- }
}
ipf_dev_info = dip;
ipfncb = net_instance_alloc(NETINFO_VERSION);
+ if (ipfncb == NULL)
+ goto attach_failed;
+
ipfncb->nin_name = "ipf";
ipfncb->nin_create = ipf_stack_create;
ipfncb->nin_destroy = ipf_stack_destroy;
ipfncb->nin_shutdown = ipf_stack_shutdown;
- i = net_instance_register(ipfncb);
+ if (net_instance_register(ipfncb) == DDI_FAILURE) {
+ net_instance_free(ipfncb);
+ goto attach_failed;
+ }
+
+ ipf_minor = vmem_create("ipf_minor", (void *)1, UINT32_MAX - 1,
+ 1, NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
#ifdef IPFDEBUG
cmn_err(CE_CONT, "IP Filter:stack_create callback_reg=%d", i);
@@ -619,7 +675,9 @@ ddi_attach_cmd_t cmd;
}
attach_failed:
+ ddi_remove_minor_node(dip, NULL);
ddi_prop_remove_all(dip);
+ ddi_soft_state_fini(&ipf_state);
return (DDI_FAILURE);
}
@@ -652,6 +710,9 @@ ddi_detach_cmd_t cmd;
return (DDI_FAILURE);
}
+ vmem_destroy(ipf_minor);
+ ddi_soft_state_fini(&ipf_state);
+
(void) net_instance_unregister(ipfncb);
net_instance_free(ipfncb);
diff --git a/usr/src/uts/common/inet/squeue.c b/usr/src/uts/common/inet/squeue.c
index 6d0bf70b2a..2e08dc359b 100644
--- a/usr/src/uts/common/inet/squeue.c
+++ b/usr/src/uts/common/inet/squeue.c
@@ -23,6 +23,10 @@
*/
/*
+ * Copyright 2012 Joyent, Inc. All rights reserved.
+ */
+
+/*
* Squeues: General purpose serialization mechanism
* ------------------------------------------------
*
@@ -120,6 +124,8 @@
#include <sys/sdt.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
+#include <sys/stack.h>
+#include <sys/archsystm.h>
#include <inet/ipclassifier.h>
#include <inet/udp_impl.h>
@@ -142,6 +148,9 @@ int squeue_workerwait_ms = 0;
static int squeue_drain_ns = 0;
static int squeue_workerwait_tick = 0;
+uintptr_t squeue_drain_stack_needed = 10240;
+uint_t squeue_drain_stack_toodeep;
+
#define MAX_BYTES_TO_PICKUP 150000
#define ENQUEUE_CHAIN(sqp, mp, tail, cnt) { \
@@ -546,6 +555,7 @@ squeue_enter(squeue_t *sqp, mblk_t *mp, mblk_t *tail, uint32_t cnt,
ASSERT(MUTEX_HELD(&sqp->sq_lock));
ASSERT(sqp->sq_first != NULL);
now = gethrtime();
+ sqp->sq_run = curthread;
sqp->sq_drain(sqp, SQS_ENTER, now + squeue_drain_ns);
/*
@@ -711,6 +721,20 @@ squeue_drain(squeue_t *sqp, uint_t proc_type, hrtime_t expire)
boolean_t sq_poll_capable;
ip_recv_attr_t *ira, iras;
+ /*
+ * Before doing any work, check our stack depth; if we're not a
+ * worker thread for this squeue and we're beginning to get tight on
+ * on stack, kick the worker, bump a counter and return.
+ */
+ if (proc_type != SQS_WORKER && STACK_BIAS + (uintptr_t)getfp() -
+ (uintptr_t)curthread->t_stkbase < squeue_drain_stack_needed) {
+ ASSERT(mutex_owned(&sqp->sq_lock));
+ sqp->sq_awaken = ddi_get_lbolt();
+ cv_signal(&sqp->sq_worker_cv);
+ squeue_drain_stack_toodeep++;
+ return;
+ }
+
sq_poll_capable = (sqp->sq_state & SQS_POLL_CAPAB) != 0;
again:
ASSERT(mutex_owned(&sqp->sq_lock));
diff --git a/usr/src/uts/common/inet/tcp/tcp.c b/usr/src/uts/common/inet/tcp/tcp.c
index 1bb87e5c56..f79427e766 100644
--- a/usr/src/uts/common/inet/tcp/tcp.c
+++ b/usr/src/uts/common/inet/tcp/tcp.c
@@ -3792,7 +3792,8 @@ tcp_stack_init(netstackid_t stackid, netstack_t *ns)
ASSERT(error == 0);
tcps->tcps_ixa_cleanup_mp = allocb_wait(0, BPRI_MED, STR_NOSIG, NULL);
ASSERT(tcps->tcps_ixa_cleanup_mp != NULL);
- cv_init(&tcps->tcps_ixa_cleanup_cv, NULL, CV_DEFAULT, NULL);
+ cv_init(&tcps->tcps_ixa_cleanup_ready_cv, NULL, CV_DEFAULT, NULL);
+ cv_init(&tcps->tcps_ixa_cleanup_done_cv, NULL, CV_DEFAULT, NULL);
mutex_init(&tcps->tcps_ixa_cleanup_lock, NULL, MUTEX_DEFAULT, NULL);
mutex_init(&tcps->tcps_reclaim_lock, NULL, MUTEX_DEFAULT, NULL);
@@ -3857,7 +3858,8 @@ tcp_stack_fini(netstackid_t stackid, void *arg)
freeb(tcps->tcps_ixa_cleanup_mp);
tcps->tcps_ixa_cleanup_mp = NULL;
- cv_destroy(&tcps->tcps_ixa_cleanup_cv);
+ cv_destroy(&tcps->tcps_ixa_cleanup_ready_cv);
+ cv_destroy(&tcps->tcps_ixa_cleanup_done_cv);
mutex_destroy(&tcps->tcps_ixa_cleanup_lock);
/*
diff --git a/usr/src/uts/common/inet/tcp/tcp_stats.c b/usr/src/uts/common/inet/tcp/tcp_stats.c
index 6e729ff461..e6b13fe6c9 100644
--- a/usr/src/uts/common/inet/tcp/tcp_stats.c
+++ b/usr/src/uts/common/inet/tcp/tcp_stats.c
@@ -21,12 +21,14 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#include <sys/types.h>
#include <sys/tihdr.h>
#include <sys/policy.h>
#include <sys/tsol/tnet.h>
+#include <sys/kstat.h>
#include <inet/common.h>
#include <inet/ip.h>
@@ -505,7 +507,7 @@ tcp_kstat_init(netstackid_t stackid)
{ "connTableSize6", KSTAT_DATA_INT32, 0 }
};
- ksp = kstat_create_netstack(TCP_MOD_NAME, 0, TCP_MOD_NAME, "mib2",
+ ksp = kstat_create_netstack(TCP_MOD_NAME, stackid, TCP_MOD_NAME, "mib2",
KSTAT_TYPE_NAMED, NUM_OF_FIELDS(tcp_named_kstat_t), 0, stackid);
if (ksp == NULL)
@@ -518,6 +520,13 @@ tcp_kstat_init(netstackid_t stackid)
ksp->ks_update = tcp_kstat_update;
ksp->ks_private = (void *)(uintptr_t)stackid;
+ /*
+ * If this is an exclusive netstack for a local zone, the global zone
+ * should still be able to read the kstat.
+ */
+ if (stackid != GLOBAL_NETSTACKID)
+ kstat_zone_add(ksp, GLOBAL_ZONEID);
+
kstat_install(ksp);
return (ksp);
}
@@ -733,7 +742,7 @@ tcp_kstat2_init(netstackid_t stackid)
#endif
};
- ksp = kstat_create_netstack(TCP_MOD_NAME, 0, "tcpstat", "net",
+ ksp = kstat_create_netstack(TCP_MOD_NAME, stackid, "tcpstat", "net",
KSTAT_TYPE_NAMED, sizeof (template) / sizeof (kstat_named_t), 0,
stackid);
@@ -744,6 +753,13 @@ tcp_kstat2_init(netstackid_t stackid)
ksp->ks_private = (void *)(uintptr_t)stackid;
ksp->ks_update = tcp_kstat2_update;
+ /*
+ * If this is an exclusive netstack for a local zone, the global zone
+ * should still be able to read the kstat.
+ */
+ if (stackid != GLOBAL_NETSTACKID)
+ kstat_zone_add(ksp, GLOBAL_ZONEID);
+
kstat_install(ksp);
return (ksp);
}
diff --git a/usr/src/uts/common/inet/tcp/tcp_time_wait.c b/usr/src/uts/common/inet/tcp/tcp_time_wait.c
index 6f896fa740..adde51e745 100644
--- a/usr/src/uts/common/inet/tcp/tcp_time_wait.c
+++ b/usr/src/uts/common/inet/tcp/tcp_time_wait.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, Joyent Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent Inc. All rights reserved.
*/
/*
@@ -111,6 +111,21 @@ tcp_time_wait_remove(tcp_t *tcp, tcp_squeue_priv_t *tcp_time_wait)
return (B_TRUE);
}
+/* Constants used for fast checking of a localhost address */
+#if defined(_BIG_ENDIAN)
+#define IPv4_LOCALHOST 0x7f000000U
+#define IPv4_LH_MASK 0xffffff00U
+#else
+#define IPv4_LOCALHOST 0x0000007fU
+#define IPv4_LH_MASK 0x00ffffffU
+#endif
+
+#define IS_LOCAL_HOST(x) ( \
+ ((x)->tcp_connp->conn_ipversion == IPV4_VERSION && \
+ ((x)->tcp_connp->conn_laddr_v4 & IPv4_LH_MASK) == IPv4_LOCALHOST) || \
+ ((x)->tcp_connp->conn_ipversion == IPV6_VERSION && \
+ IN6_IS_ADDR_LOOPBACK(&(x)->tcp_connp->conn_laddr_v6)))
+
/*
* Add a connection to the list of detached TIME_WAIT connections
* and set its time to expire.
@@ -122,6 +137,7 @@ tcp_time_wait_append(tcp_t *tcp)
squeue_t *sqp = tcp->tcp_connp->conn_sqp;
tcp_squeue_priv_t *tcp_time_wait =
*((tcp_squeue_priv_t **)squeue_getprivate(sqp, SQPRIVATE_TCP));
+ hrtime_t firetime = 0;
tcp_timers_stop(tcp);
@@ -138,13 +154,37 @@ tcp_time_wait_append(tcp_t *tcp)
ASSERT(tcp->tcp_listener == NULL);
tcp->tcp_time_wait_expire = ddi_get_lbolt64();
- /*
- * Since tcp_time_wait_expire is lbolt64, it should not wrap around
- * in practice. Hence it cannot be 0. Note that zero means that the
- * tcp_t is not in the TIME_WAIT list.
- */
- tcp->tcp_time_wait_expire += MSEC_TO_TICK(
- tcps->tcps_time_wait_interval);
+ if (IS_LOCAL_HOST(tcp)) {
+ /*
+ * This is the fastpath for handling localhost connections.
+ * Since we don't have to worry about packets on the localhost
+ * showing up after a long network delay, we want to expire
+ * these quickly so the port range on the localhost doesn't
+ * get starved by short-running, local apps.
+ *
+ * Leave tcp_time_wait_expire at the current time. This
+ * essentially means the connection is expired now and it will
+ * clean up the next time tcp_time_wait_collector runs. We set
+ * firetime to use a short delay so that if we have to start a
+ * tcp_time_wait_collector thread below, it runs soon instead
+ * of after a delay of time_wait_interval. firetime being set
+ * to a non-0 value is also our indicator that we should add
+ * this connection to the head of the time wait list (since we
+ * are already expired) so that its sure to get cleaned up on
+ * the next run of tcp_time_wait_collector (which expects the
+ * entries to appear in time-order and stops when it hits the
+ * first non-expired entry).
+ */
+ firetime = TCP_TIME_WAIT_DELAY;
+ } else {
+ /*
+ * Since tcp_time_wait_expire is lbolt64, it should not wrap
+ * around in practice. Hence it cannot be 0. Note that zero
+ * means that the tcp_t is not in the TIME_WAIT list.
+ */
+ tcp->tcp_time_wait_expire += MSEC_TO_TICK(
+ tcps->tcps_time_wait_interval);
+ }
ASSERT(TCP_IS_DETACHED(tcp));
ASSERT(tcp->tcp_state == TCPS_TIME_WAIT);
@@ -164,13 +204,17 @@ tcp_time_wait_append(tcp_t *tcp)
* a timer is needed.
*/
if (tcp_time_wait->tcp_time_wait_tid == 0) {
+ if (firetime == 0)
+ firetime = (hrtime_t)
+ (tcps->tcps_time_wait_interval + 1) *
+ MICROSEC;
+
tcp_time_wait->tcp_time_wait_tid =
timeout_generic(CALLOUT_NORMAL,
- tcp_time_wait_collector, sqp,
- (hrtime_t)(tcps->tcps_time_wait_interval + 1) *
- MICROSEC, CALLOUT_TCP_RESOLUTION,
- CALLOUT_FLAG_ROUNDUP);
+ tcp_time_wait_collector, sqp, firetime,
+ CALLOUT_TCP_RESOLUTION, CALLOUT_FLAG_ROUNDUP);
}
+ tcp_time_wait->tcp_time_wait_tail = tcp;
} else {
/*
* The list is not empty, so a timer must be running. If not,
@@ -182,11 +226,23 @@ tcp_time_wait_append(tcp_t *tcp)
ASSERT(tcp_time_wait->tcp_time_wait_tail != NULL);
ASSERT(tcp_time_wait->tcp_time_wait_tail->tcp_state ==
TCPS_TIME_WAIT);
- tcp_time_wait->tcp_time_wait_tail->tcp_time_wait_next = tcp;
- tcp->tcp_time_wait_prev = tcp_time_wait->tcp_time_wait_tail;
+ if (firetime == 0) {
+ /* add at end */
+ tcp_time_wait->tcp_time_wait_tail->tcp_time_wait_next =
+ tcp;
+ tcp->tcp_time_wait_prev =
+ tcp_time_wait->tcp_time_wait_tail;
+ tcp_time_wait->tcp_time_wait_tail = tcp;
+ } else {
+ /* add at head */
+ tcp->tcp_time_wait_next =
+ tcp_time_wait->tcp_time_wait_head;
+ tcp_time_wait->tcp_time_wait_head->tcp_time_wait_prev =
+ tcp;
+ tcp_time_wait->tcp_time_wait_head = tcp;
+ }
}
- tcp_time_wait->tcp_time_wait_tail = tcp;
mutex_exit(&tcp_time_wait->tcp_time_wait_lock);
}
@@ -416,6 +472,10 @@ tcp_time_wait_collector(void *arg)
tcp_time_wait->tcp_time_wait_tid == 0) {
hrtime_t firetime;
+ /* shouldn't be necessary, but just in case */
+ if (tcp->tcp_time_wait_expire < now)
+ tcp->tcp_time_wait_expire = now;
+
firetime = TICK_TO_NSEC(tcp->tcp_time_wait_expire - now);
/* This ensures that we won't wake up too often. */
firetime = MAX(TCP_TIME_WAIT_DELAY, firetime);
diff --git a/usr/src/uts/common/inet/tcp_stack.h b/usr/src/uts/common/inet/tcp_stack.h
index 2dccf6b78c..e46ebe08da 100644
--- a/usr/src/uts/common/inet/tcp_stack.h
+++ b/usr/src/uts/common/inet/tcp_stack.h
@@ -101,7 +101,8 @@ struct tcp_stack {
/* Used to synchronize access when reclaiming memory */
mblk_t *tcps_ixa_cleanup_mp;
kmutex_t tcps_ixa_cleanup_lock;
- kcondvar_t tcps_ixa_cleanup_cv;
+ kcondvar_t tcps_ixa_cleanup_ready_cv;
+ kcondvar_t tcps_ixa_cleanup_done_cv;
/* Variables for handling kmem reclaim call back. */
kmutex_t tcps_reclaim_lock;
diff --git a/usr/src/uts/common/io/aggr/aggr_port.c b/usr/src/uts/common/io/aggr/aggr_port.c
index 00545d2c03..a39110255a 100644
--- a/usr/src/uts/common/io/aggr/aggr_port.c
+++ b/usr/src/uts/common/io/aggr/aggr_port.c
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved.
*/
/*
@@ -528,8 +529,13 @@ aggr_port_promisc(aggr_port_t *port, boolean_t on)
if (on) {
mac_rx_clear(port->lp_mch);
+ /* We use the promisc callback because without hardware
+ * rings, we deliver through flows that will cause duplicate
+ * delivery of packets when we've flipped into this mode
+ * to compensate for the lack of hardware MAC matching
+ */
rc = mac_promisc_add(port->lp_mch, MAC_CLIENT_PROMISC_ALL,
- aggr_recv_cb, port, &port->lp_mphp,
+ aggr_recv_promisc_cb, port, &port->lp_mphp,
MAC_PROMISC_FLAGS_NO_TX_LOOP);
if (rc != 0) {
mac_rx_set(port->lp_mch, aggr_recv_cb, port);
diff --git a/usr/src/uts/common/io/aggr/aggr_recv.c b/usr/src/uts/common/io/aggr/aggr_recv.c
index 2bdb7872e3..0dfe234b70 100644
--- a/usr/src/uts/common/io/aggr/aggr_recv.c
+++ b/usr/src/uts/common/io/aggr/aggr_recv.c
@@ -21,6 +21,7 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved.
*/
/*
@@ -68,16 +69,27 @@ aggr_recv_lacp(aggr_port_t *port, mac_resource_handle_t mrh, mblk_t *mp)
/*
* Callback function invoked by MAC service module when packets are
- * made available by a MAC port.
+ * made available by a MAC port, both in promisc_on mode and not.
*/
/* ARGSUSED */
-void
-aggr_recv_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
- boolean_t loopback)
+static void
+aggr_recv_path_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
+ boolean_t loopback, boolean_t promisc_path)
{
aggr_port_t *port = (aggr_port_t *)arg;
aggr_grp_t *grp = port->lp_grp;
+ /* In the case where lp_promisc_on has been turned on to
+ * compensate for insufficient hardware MAC matching and
+ * hardware rings are not in use we will fall back to
+ * using flows for delivery which can result in duplicates
+ * pushed up the stack. Only respect the chosen path.
+ */
+ if (port->lp_promisc_on != promisc_path) {
+ freemsgchain(mp);
+ return;
+ }
+
if (grp->lg_lacp_mode == AGGR_LACP_OFF) {
aggr_mac_rx(grp->lg_mh, mrh, mp);
} else {
@@ -161,3 +173,19 @@ aggr_recv_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
}
}
}
+
+/* ARGSUSED */
+void
+aggr_recv_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
+ boolean_t loopback)
+{
+ aggr_recv_path_cb(arg, mrh, mp, loopback, B_FALSE);
+}
+
+/* ARGSUSED */
+void
+aggr_recv_promisc_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp,
+ boolean_t loopback)
+{
+ aggr_recv_path_cb(arg, mrh, mp, loopback, B_TRUE);
+}
diff --git a/usr/src/uts/common/io/bge/bge_chip2.c b/usr/src/uts/common/io/bge/bge_chip2.c
index f687ce4892..a459f867f3 100644
--- a/usr/src/uts/common/io/bge/bge_chip2.c
+++ b/usr/src/uts/common/io/bge/bge_chip2.c
@@ -24,7 +24,7 @@
*/
/*
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2011, 2012 Nexenta Systems, Inc. All rights reserved.
*/
#include "bge_impl.h"
@@ -363,7 +363,34 @@ bge_chip_cfg_init(bge_t *bgep, chip_id_t *cidp, boolean_t enable_dma)
if (DEVICE_5717_SERIES_CHIPSETS(bgep))
pci_config_put32(handle, PCI_CONF_BGE_MHCR, 0);
mhcr = pci_config_get32(handle, PCI_CONF_BGE_MHCR);
- cidp->asic_rev = mhcr & MHCR_CHIP_REV_MASK;
+ cidp->asic_rev = (mhcr & MHCR_CHIP_REV_MASK) >> MHCR_CHIP_REV_SHIFT;
+ if (MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_PRODID) {
+ uint32_t reg;
+ switch (cidp->device) {
+ case DEVICE_ID_5717:
+ case DEVICE_ID_5718:
+ case DEVICE_ID_5719:
+ case DEVICE_ID_5720:
+ reg = PCI_CONF_GEN2_PRODID_ASICREV;
+ break;
+ case DEVICE_ID_57781:
+ case DEVICE_ID_57785:
+ case DEVICE_ID_57761:
+ case DEVICE_ID_57765:
+ case DEVICE_ID_57791:
+ case DEVICE_ID_57795:
+ case DEVICE_ID_57762:
+ case DEVICE_ID_57766:
+ case DEVICE_ID_57782:
+ case DEVICE_ID_57786:
+ reg = PCI_CONF_GEN15_PRODID_ASICREV;
+ break;
+ default:
+ reg = PCI_CONF_PRODID_ASICREV;
+ break;
+ }
+ cidp->asic_rev = pci_config_get32(handle, reg);
+ }
cidp->businfo = pci_config_get32(handle, PCI_CONF_BGE_PCISTATE);
cidp->command = pci_config_get16(handle, PCI_CONF_COMM);
@@ -386,6 +413,45 @@ bge_chip_cfg_init(bge_t *bgep, chip_id_t *cidp, boolean_t enable_dma)
BGE_DEBUG(("bge_chip_cfg_init: clsize %d latency %d command 0x%x",
cidp->clsize, cidp->latency, cidp->command));
+ cidp->chip_type = 0;
+ if (MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5717 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5719 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5720)
+ cidp->chip_type |= CHIP_TYPE_5717_PLUS;
+
+ if (MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_57765 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_57766)
+ cidp->chip_type |= CHIP_TYPE_57765_CLASS;
+
+ if (cidp->chip_type & CHIP_TYPE_57765_CLASS ||
+ cidp->chip_type & CHIP_TYPE_5717_PLUS)
+ cidp->chip_type |= CHIP_TYPE_57765_PLUS;
+
+ /* Intentionally exclude ASIC_REV_5906 */
+ if (MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5755 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5787 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5784 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5761 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5785 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_57780 ||
+ cidp->chip_type & CHIP_TYPE_57765_PLUS)
+ cidp->chip_type |= CHIP_TYPE_5755_PLUS;
+
+ if (MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5780 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5714)
+ cidp->chip_type |= CHIP_TYPE_5780_CLASS;
+
+ if (MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5750 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5752 ||
+ MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5906 ||
+ cidp->chip_type & CHIP_TYPE_5755_PLUS ||
+ cidp->chip_type & CHIP_TYPE_5780_CLASS)
+ cidp->chip_type |= CHIP_TYPE_5750_PLUS;
+
+ if (MHCR_CHIP_ASIC_REV(cidp->asic_rev) == MHCR_CHIP_ASIC_REV_5705 ||
+ cidp->chip_type & CHIP_TYPE_5750_PLUS)
+ cidp->chip_type |= CHIP_TYPE_5705_PLUS;
+
/*
* Step 2 (also step 6): disable and clear interrupts.
* Steps 11-13: configure PIO endianness options, and enable
@@ -445,8 +511,9 @@ bge_chip_cfg_init(bge_t *bgep, chip_id_t *cidp, boolean_t enable_dma)
* see whether the host is truly up to date, and regenerate
* its interrupt if not.
*/
- mhcr = MHCR_ENABLE_INDIRECT_ACCESS |
+ mhcr = MHCR_ENABLE_INDIRECT_ACCESS |
MHCR_ENABLE_TAGGED_STATUS_MODE |
+ MHCR_ENABLE_PCI_STATE_WRITE |
MHCR_MASK_INTERRUPT_MODE |
MHCR_CLEAR_INTERRUPT_INTA;
@@ -1896,10 +1963,16 @@ bge_nvmem_id(bge_t *bgep)
case DEVICE_ID_5705_2:
case DEVICE_ID_5717:
case DEVICE_ID_5718:
+ case DEVICE_ID_5719:
+ case DEVICE_ID_5720:
case DEVICE_ID_5724:
+ case DEVICE_ID_57760:
case DEVICE_ID_57780:
+ case DEVICE_ID_57788:
+ case DEVICE_ID_57790:
case DEVICE_ID_5780:
case DEVICE_ID_5782:
+ case DEVICE_ID_5784M:
case DEVICE_ID_5785:
case DEVICE_ID_5787:
case DEVICE_ID_5787M:
@@ -1918,6 +1991,8 @@ bge_nvmem_id(bge_t *bgep)
case DEVICE_ID_5723:
case DEVICE_ID_5761:
case DEVICE_ID_5761E:
+ case DEVICE_ID_5761S:
+ case DEVICE_ID_5761SE:
case DEVICE_ID_5764:
case DEVICE_ID_5714C:
case DEVICE_ID_5714S:
@@ -2023,14 +2098,35 @@ bge_chip_id_init(bge_t *bgep)
cidp->msi_enabled = B_FALSE;
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) >
+ MHCR_CHIP_ASIC_REV_PRODID ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5906 ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5700 ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5701 ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5750)
+ /*
+ * Just a plain reset; the "check" code breaks these chips
+ */
+ cidp->flags |= CHIP_FLAG_NO_CHECK_RESET;
+
switch (cidp->device) {
case DEVICE_ID_5717:
case DEVICE_ID_5718:
+ case DEVICE_ID_5719:
+ case DEVICE_ID_5720:
case DEVICE_ID_5724:
if (cidp->device == DEVICE_ID_5717)
cidp->chip_label = 5717;
else if (cidp->device == DEVICE_ID_5718)
cidp->chip_label = 5718;
+ else if (cidp->device == DEVICE_ID_5719)
+ cidp->chip_label = 5719;
+ else if (cidp->device == DEVICE_ID_5720)
+ cidp->chip_label = 5720;
else
cidp->chip_label = 5724;
cidp->msi_enabled = bge_enable_msi;
@@ -2044,7 +2140,7 @@ bge_chip_id_init(bge_t *bgep)
cidp->mbuf_hi_water = MBUF_HIWAT_5717;
cidp->mbuf_base = bge_mbuf_pool_base_5705;
cidp->mbuf_length = bge_mbuf_pool_len_5705;
- cidp->recv_slots = BGE_RECV_SLOTS_5705;
+ cidp->recv_slots = BGE_RECV_SLOTS_5717;
cidp->bge_mlcr_default = MLCR_DEFAULT_5717;
cidp->rx_rings = BGE_RECV_RINGS_MAX_5705;
cidp->tx_rings = BGE_SEND_RINGS_MAX_5705;
@@ -2220,7 +2316,13 @@ bge_chip_id_init(bge_t *bgep)
case DEVICE_ID_5723:
case DEVICE_ID_5761:
case DEVICE_ID_5761E:
+ case DEVICE_ID_5761S:
+ case DEVICE_ID_5761SE:
+ case DEVICE_ID_5784M:
+ case DEVICE_ID_57760:
case DEVICE_ID_57780:
+ case DEVICE_ID_57788:
+ case DEVICE_ID_57790:
cidp->msi_enabled = bge_enable_msi;
/*
* We don't use MSI for BCM5764 and BCM5785, as the
@@ -2234,10 +2336,18 @@ bge_chip_id_init(bge_t *bgep)
cidp->chip_label = 5723;
else if (cidp->device == DEVICE_ID_5764)
cidp->chip_label = 5764;
+ else if (cidp->device == DEVICE_ID_5784M)
+ cidp->chip_label = 5784;
else if (cidp->device == DEVICE_ID_5785)
cidp->chip_label = 5785;
+ else if (cidp->device == DEVICE_ID_57760)
+ cidp->chip_label = 57760;
else if (cidp->device == DEVICE_ID_57780)
cidp->chip_label = 57780;
+ else if (cidp->device == DEVICE_ID_57788)
+ cidp->chip_label = 57788;
+ else if (cidp->device == DEVICE_ID_57790)
+ cidp->chip_label = 57790;
else
cidp->chip_label = 5761;
cidp->bge_dma_rwctrl = bge_dma_rwctrl_5721;
@@ -3401,18 +3511,27 @@ bge_chip_reset(bge_t *bgep, boolean_t enable_dma)
mhcr = MHCR_ENABLE_INDIRECT_ACCESS |
MHCR_ENABLE_TAGGED_STATUS_MODE |
MHCR_MASK_INTERRUPT_MODE |
- MHCR_MASK_PCI_INT_OUTPUT |
MHCR_CLEAR_INTERRUPT_INTA |
MHCR_ENABLE_ENDIAN_WORD_SWAP |
MHCR_ENABLE_ENDIAN_BYTE_SWAP;
+
+ if (bgep->intr_type == DDI_INTR_TYPE_FIXED)
+ mhcr |= MHCR_MASK_PCI_INT_OUTPUT;
+
if (DEVICE_5717_SERIES_CHIPSETS(bgep))
pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MHCR,
0);
+#else
+ mhcr = MHCR_ENABLE_INDIRECT_ACCESS |
+ MHCR_ENABLE_TAGGED_STATUS_MODE |
+ MHCR_MASK_INTERRUPT_MODE |
+ MHCR_MASK_PCI_INT_OUTPUT |
+ MHCR_CLEAR_INTERRUPT_INTA;
+#endif
pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MHCR, mhcr);
bge_reg_put32(bgep, MEMORY_ARBITER_MODE_REG,
bge_reg_get32(bgep, MEMORY_ARBITER_MODE_REG) |
MEMORY_ARBITER_ENABLE);
-#endif
if (asf_mode == ASF_MODE_INIT) {
bge_asf_pre_reset_operations(bgep, BGE_INIT_RESET);
} else if (asf_mode == ASF_MODE_SHUTDOWN) {
@@ -3436,9 +3555,13 @@ bge_chip_reset(bge_t *bgep, boolean_t enable_dma)
mhcr = MHCR_ENABLE_INDIRECT_ACCESS |
MHCR_ENABLE_TAGGED_STATUS_MODE |
+ MHCR_ENABLE_PCI_STATE_WRITE |
MHCR_MASK_INTERRUPT_MODE |
- MHCR_MASK_PCI_INT_OUTPUT |
MHCR_CLEAR_INTERRUPT_INTA;
+
+ if (bgep->intr_type == DDI_INTR_TYPE_FIXED)
+ mhcr |= MHCR_MASK_PCI_INT_OUTPUT;
+
#ifdef _BIG_ENDIAN
mhcr |= MHCR_ENABLE_ENDIAN_WORD_SWAP | MHCR_ENABLE_ENDIAN_BYTE_SWAP;
#endif /* _BIG_ENDIAN */
@@ -3449,6 +3572,12 @@ bge_chip_reset(bge_t *bgep, boolean_t enable_dma)
if (bgep->asf_enabled)
bgep->asf_wordswapped = B_FALSE;
#endif
+
+ if (DEVICE_IS_5755_PLUS(bgep) ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5752)
+ bge_reg_put32(bgep, GRC_FASTBOOT_PC, 0);
+
/*
* NVRAM Corruption Workaround
*/
@@ -3508,6 +3637,11 @@ bge_chip_reset(bge_t *bgep, boolean_t enable_dma)
#else
modeflags = MODE_WORD_SWAP_FRAME | MODE_BYTE_SWAP_FRAME;
#endif /* _BIG_ENDIAN */
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5720)
+ modeflags |=
+ MODE_BYTE_SWAP_B2HRX_DATA | MODE_WORD_SWAP_B2HRX_DATA |
+ MODE_B2HRX_ENABLE | MODE_HTX2B_ENABLE;
#ifdef BGE_IPMI_ASF
if (bgep->asf_enabled)
modeflags |= MODE_HOST_STACK_UP;
@@ -3592,6 +3726,13 @@ bge_chip_reset(bge_t *bgep, boolean_t enable_dma)
*/
bge_reg_put32(bgep, ETHERNET_MAC_MODE_REG, 0);
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5720) {
+ uint32_t regval = bge_reg_get32(bgep, CPMU_CLCK_ORIDE_REG);
+ bge_reg_put32(bgep, CPMU_CLCK_ORIDE_REG,
+ regval & ~CPMU_CLCK_ORIDE_MAC_ORIDE_EN);
+ }
+
/*
* Step 21: restore cache-line-size, latency timer, and
* subsystem ID registers to their original values (not
@@ -3818,8 +3959,17 @@ bge_chip_start(bge_t *bgep, boolean_t reset_phys)
/*
* Steps 34-36: enable buffer manager & internal h/w queues
*/
- if (!bge_chip_enable_engine(bgep, BUFFER_MANAGER_MODE_REG,
- STATE_MACHINE_ATTN_ENABLE_BIT))
+
+ regval = STATE_MACHINE_ATTN_ENABLE_BIT;
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5719)
+ regval |= BUFF_MGR_NO_TX_UNDERRUN;
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5717 ||
+ bgep->chipid.asic_rev == MHCR_CHIP_REV_5719_A0 ||
+ bgep->chipid.asic_rev == MHCR_CHIP_REV_5720_A0)
+ regval |= BUFF_MGR_MBUF_LOW_ATTN_ENABLE;
+ if (!bge_chip_enable_engine(bgep, BUFFER_MANAGER_MODE_REG, regval))
retval = DDI_FAILURE;
if (!bge_chip_enable_engine(bgep, FTQ_RESET_REG, 0))
retval = DDI_FAILURE;
@@ -3913,7 +4063,13 @@ bge_chip_start(bge_t *bgep, boolean_t reset_phys)
/*
* Step 50: configure the IPG et al
*/
- bge_reg_put32(bgep, MAC_TX_LENGTHS_REG, MAC_TX_LENGTHS_DEFAULT);
+ regval = MAC_TX_LENGTHS_DEFAULT;
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev)
+ == MHCR_CHIP_ASIC_REV_5720)
+ regval |= bge_reg_get32(bgep, MAC_TX_LENGTHS_REG) &
+ (MAC_TX_LENGTHS_JMB_FRM_LEN_MSK |
+ MAC_TX_LENGTHS_CNT_DWN_VAL_MSK);
+ bge_reg_put32(bgep, MAC_TX_LENGTHS_REG, regval);
/*
* Step 51: configure the default Rx Return Ring
@@ -4068,22 +4224,45 @@ bge_chip_start(bge_t *bgep, boolean_t reset_phys)
retval = DDI_FAILURE;
dma_wrprio = (bge_dma_wrprio << DMA_PRIORITY_SHIFT) |
ALL_DMA_ATTN_BITS;
- if ((MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
- MHCR_CHIP_ASIC_REV_5755) ||
- (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
- MHCR_CHIP_ASIC_REV_5723) ||
- (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
- MHCR_CHIP_ASIC_REV_5906)) {
+ if (DEVICE_IS_5755_PLUS(bgep))
dma_wrprio |= DMA_STATUS_TAG_FIX_CQ12384;
- }
if (!bge_chip_enable_engine(bgep, WRITE_DMA_MODE_REG,
dma_wrprio))
retval = DDI_FAILURE;
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5761 ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5784 ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5785 ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_57780 ||
+ DEVICE_IS_57765_PLUS(bgep)) {
+ regval = bge_reg_get32(bgep, READ_DMA_RESERVED_CONTROL_REG);
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5719 ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5720) {
+ regval &= ~(RDMA_RSRVCTRL_TXMRGN_MASK |
+ RDMA_RSRVCTRL_FIFO_LWM_MASK |
+ RDMA_RSRVCTRL_FIFO_HWM_MASK);
+ regval |= RDMA_RSRVCTRL_TXMRGN_320B |
+ RDMA_RSRVCTRL_FIFO_LWM_1_5K |
+ RDMA_RSRVCTRL_FIFO_HWM_1_5K;
+ }
+ bge_reg_put32(bgep, READ_DMA_RESERVED_CONTROL_REG,
+ regval | RDMA_RSRVCTRL_FIFO_OFLW_FIX);
+ }
if (DEVICE_5723_SERIES_CHIPSETS(bgep) ||
DEVICE_5717_SERIES_CHIPSETS(bgep))
bge_dma_rdprio = 0;
+ regval = bge_dma_rdprio << DMA_PRIORITY_SHIFT;
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5720)
+ regval |= bge_reg_get32(bgep, READ_DMA_MODE_REG) &
+ DMA_H2BNC_VLAN_DET;
if (!bge_chip_enable_engine(bgep, READ_DMA_MODE_REG,
- (bge_dma_rdprio << DMA_PRIORITY_SHIFT) | ALL_DMA_ATTN_BITS))
+ regval | ALL_DMA_ATTN_BITS))
retval = DDI_FAILURE;
if (!bge_chip_enable_engine(bgep, RCV_DATA_COMPLETION_MODE_REG,
STATE_MACHINE_ATTN_ENABLE_BIT))
@@ -4116,7 +4295,23 @@ bge_chip_start(bge_t *bgep, boolean_t reset_phys)
* Step 88: download firmware -- doesn't apply
* Steps 89-90: enable Transmit & Receive MAC Engines
*/
- if (!bge_chip_enable_engine(bgep, TRANSMIT_MAC_MODE_REG, 0))
+ if (DEVICE_IS_5755_PLUS(bgep) ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5906) {
+ regval = bge_reg_get32(bgep, TRANSMIT_MAC_MODE_REG);
+ regval |= TRANSMIT_MODE_MBUF_LOCKUP_FIX;
+ } else {
+ regval = 0;
+ }
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5720) {
+ regval &= ~(TRANSMIT_MODE_HTX2B_JMB_FRM_LEN |
+ TRANSMIT_MODE_HTX2B_CNT_DN_MODE);
+ regval |= bge_reg_get32(bgep, TRANSMIT_MAC_MODE_REG) &
+ (TRANSMIT_MODE_HTX2B_JMB_FRM_LEN |
+ TRANSMIT_MODE_HTX2B_CNT_DN_MODE);
+ }
+ if (!bge_chip_enable_engine(bgep, TRANSMIT_MAC_MODE_REG, regval))
retval = DDI_FAILURE;
#ifdef BGE_IPMI_ASF
if (!bgep->asf_enabled) {
@@ -4219,7 +4414,6 @@ bge_chip_start(bge_t *bgep, boolean_t reset_phys)
if (bgep->intr_type == DDI_INTR_TYPE_FIXED)
bge_cfg_clr32(bgep, PCI_CONF_BGE_MHCR,
bgep->chipid.mask_pci_int);
-
/*
* All done!
*/
diff --git a/usr/src/uts/common/io/bge/bge_hw.h b/usr/src/uts/common/io/bge/bge_hw.h
index f8e6c4d09a..cfcae929dd 100644
--- a/usr/src/uts/common/io/bge/bge_hw.h
+++ b/usr/src/uts/common/io/bge/bge_hw.h
@@ -23,6 +23,10 @@
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ */
+
#ifndef _BGE_HW_H
#define _BGE_HW_H
@@ -68,9 +72,12 @@ extern "C" {
#define DEVICE_ID_5724 0x165c
#define DEVICE_ID_5705M 0x165d
#define DEVICE_ID_5705MA3 0x165e
+#define DEVICE_ID_5719 0x1657
+#define DEVICE_ID_5720 0x165f
#define DEVICE_ID_5705F 0x166e
#define DEVICE_ID_5780 0x166a
#define DEVICE_ID_5782 0x1696
+#define DEVICE_ID_5784M 0x1698
#define DEVICE_ID_5785 0x1699
#define DEVICE_ID_5787 0x169b
#define DEVICE_ID_5787M 0x1693
@@ -92,12 +99,27 @@ extern "C" {
#define DEVICE_ID_5714S 0x1669
#define DEVICE_ID_5715C 0x1678
#define DEVICE_ID_5715S 0x1679
-#define DEVICE_ID_5761E 0x1680
#define DEVICE_ID_5761 0x1681
+#define DEVICE_ID_5761E 0x1680
+#define DEVICE_ID_5761S 0x1688
+#define DEVICE_ID_5761SE 0x1689
#define DEVICE_ID_5764 0x1684
#define DEVICE_ID_5906 0x1712
#define DEVICE_ID_5906M 0x1713
+#define DEVICE_ID_57760 0x1690
#define DEVICE_ID_57780 0x1692
+#define DEVICE_ID_57788 0x1691
+#define DEVICE_ID_57790 0x1694
+#define DEVICE_ID_57781 0x16b1
+#define DEVICE_ID_57785 0x16b5
+#define DEVICE_ID_57761 0x16b0
+#define DEVICE_ID_57765 0x16b4
+#define DEVICE_ID_57791 0x16b2
+#define DEVICE_ID_57795 0x16b6
+#define DEVICE_ID_57762 0x1682
+#define DEVICE_ID_57766 0x1686
+#define DEVICE_ID_57786 0x16b3
+#define DEVICE_ID_57782 0x16b7
#define REVISION_ID_5700_B0 0x10
#define REVISION_ID_5700_B2 0x12
@@ -189,15 +211,23 @@ extern "C" {
#define DEVICE_5717_SERIES_CHIPSETS(bgep) \
(bgep->chipid.device == DEVICE_ID_5717) ||\
(bgep->chipid.device == DEVICE_ID_5718) ||\
+ (bgep->chipid.device == DEVICE_ID_5719) ||\
+ (bgep->chipid.device == DEVICE_ID_5720) ||\
(bgep->chipid.device == DEVICE_ID_5724)
#define DEVICE_5723_SERIES_CHIPSETS(bgep) \
((bgep->chipid.device == DEVICE_ID_5723) ||\
(bgep->chipid.device == DEVICE_ID_5761) ||\
(bgep->chipid.device == DEVICE_ID_5761E) ||\
+ (bgep->chipid.device == DEVICE_ID_5761S) ||\
+ (bgep->chipid.device == DEVICE_ID_5761SE) ||\
(bgep->chipid.device == DEVICE_ID_5764) ||\
+ (bgep->chipid.device == DEVICE_ID_5784M) ||\
(bgep->chipid.device == DEVICE_ID_5785) ||\
- (bgep->chipid.device == DEVICE_ID_57780))
+ (bgep->chipid.device == DEVICE_ID_57760) ||\
+ (bgep->chipid.device == DEVICE_ID_57780) ||\
+ (bgep->chipid.device == DEVICE_ID_57788) ||\
+ (bgep->chipid.device == DEVICE_ID_57790))
#define DEVICE_5714_SERIES_CHIPSETS(bgep) \
((bgep->chipid.device == DEVICE_ID_5714C) ||\
@@ -209,6 +239,20 @@ extern "C" {
((bgep->chipid.device == DEVICE_ID_5906) ||\
(bgep->chipid.device == DEVICE_ID_5906M))
+
+#define CHIP_TYPE_5705_PLUS (1 << 0)
+#define CHIP_TYPE_5750_PLUS (1 << 1)
+#define CHIP_TYPE_5780_CLASS (1 << 2)
+#define CHIP_TYPE_5755_PLUS (1 << 3)
+#define CHIP_TYPE_57765_CLASS (1 << 4)
+#define CHIP_TYPE_57765_PLUS (1 << 5)
+#define CHIP_TYPE_5717_PLUS (1 << 6)
+
+#define DEVICE_IS_57765_PLUS(bgep) \
+ (bgep->chipid.chip_type & CHIP_TYPE_57765_PLUS)
+#define DEVICE_IS_5755_PLUS(bgep) \
+ (bgep->chipid.chip_type & CHIP_TYPE_5755_PLUS)
+
/*
* Second section:
* Offsets of important registers & definitions for bits therein
@@ -225,6 +269,7 @@ extern "C" {
*/
#define PCI_CONF_BGE_MHCR 0x68
#define MHCR_CHIP_REV_MASK 0xffff0000
+#define MHCR_CHIP_REV_SHIFT 16
#define MHCR_ENABLE_TAGGED_STATUS_MODE 0x00000200
#define MHCR_MASK_INTERRUPT_MODE 0x00000100
#define MHCR_ENABLE_INDIRECT_ACCESS 0x00000080
@@ -236,95 +281,38 @@ extern "C" {
#define MHCR_MASK_PCI_INT_OUTPUT 0x00000002
#define MHCR_CLEAR_INTERRUPT_INTA 0x00000001
-#define MHCR_CHIP_REV_5700_B0 0x71000000
-#define MHCR_CHIP_REV_5700_B2 0x71020000
-#define MHCR_CHIP_REV_5700_B3 0x71030000
-#define MHCR_CHIP_REV_5700_C0 0x72000000
-#define MHCR_CHIP_REV_5700_C1 0x72010000
-#define MHCR_CHIP_REV_5700_C2 0x72020000
-
-#define MHCR_CHIP_REV_5701_A0 0x00000000
-#define MHCR_CHIP_REV_5701_A2 0x00020000
-#define MHCR_CHIP_REV_5701_A3 0x00030000
-#define MHCR_CHIP_REV_5701_A5 0x01050000
-
-#define MHCR_CHIP_REV_5702_A0 0x10000000
-#define MHCR_CHIP_REV_5702_A1 0x10010000
-#define MHCR_CHIP_REV_5702_A2 0x10020000
-
-#define MHCR_CHIP_REV_5703_A0 0x10000000
-#define MHCR_CHIP_REV_5703_A1 0x10010000
-#define MHCR_CHIP_REV_5703_A2 0x10020000
-#define MHCR_CHIP_REV_5703_B0 0x11000000
-#define MHCR_CHIP_REV_5703_B1 0x11010000
-
-#define MHCR_CHIP_REV_5704_A0 0x20000000
-#define MHCR_CHIP_REV_5704_A1 0x20010000
-#define MHCR_CHIP_REV_5704_A2 0x20020000
-#define MHCR_CHIP_REV_5704_A3 0x20030000
-#define MHCR_CHIP_REV_5704_B0 0x21000000
-
-#define MHCR_CHIP_REV_5705_A0 0x30000000
-#define MHCR_CHIP_REV_5705_A1 0x30010000
-#define MHCR_CHIP_REV_5705_A2 0x30020000
-#define MHCR_CHIP_REV_5705_A3 0x30030000
-#define MHCR_CHIP_REV_5705_A5 0x30050000
-
-#define MHCR_CHIP_REV_5782_A0 0x30030000
-#define MHCR_CHIP_REV_5782_A1 0x30030088
-
-#define MHCR_CHIP_REV_5788_A1 0x30050000
-
-#define MHCR_CHIP_REV_5751_A0 0x40000000
-#define MHCR_CHIP_REV_5751_A1 0x40010000
-
-#define MHCR_CHIP_REV_5721_A0 0x41000000
-#define MHCR_CHIP_REV_5721_A1 0x41010000
-
-#define MHCR_CHIP_REV_5714_A0 0x50000000
-#define MHCR_CHIP_REV_5714_A1 0x90010000
-
-#define MHCR_CHIP_REV_5715_A0 0x50000000
-#define MHCR_CHIP_REV_5715_A1 0x90010000
-
-#define MHCR_CHIP_REV_5715S_A0 0x50000000
-#define MHCR_CHIP_REV_5715S_A1 0x90010000
-
-#define MHCR_CHIP_REV_5754_A0 0xb0000000
-#define MHCR_CHIP_REV_5754_A1 0xb0010000
-
-#define MHCR_CHIP_REV_5787_A0 0xb0000000
-#define MHCR_CHIP_REV_5787_A1 0xb0010000
-#define MHCR_CHIP_REV_5787_A2 0xb0020000
-
-#define MHCR_CHIP_REV_5755_A0 0xa0000000
-#define MHCR_CHIP_REV_5755_A1 0xa0010000
-
-#define MHCR_CHIP_REV_5906_A0 0xc0000000
-#define MHCR_CHIP_REV_5906_A1 0xc0010000
-#define MHCR_CHIP_REV_5906_A2 0xc0020000
-
-#define MHCR_CHIP_REV_5723_A0 0xf0000000
-#define MHCR_CHIP_REV_5723_A1 0xf0010000
-#define MHCR_CHIP_REV_5723_A2 0xf0020000
-#define MHCR_CHIP_REV_5723_B0 0xf1000000
-
-#define MHCR_CHIP_ASIC_REV(ChipRevId) ((ChipRevId) & 0xf0000000)
-#define MHCR_CHIP_ASIC_REV_5700 (0x7 << 28)
-#define MHCR_CHIP_ASIC_REV_5701 (0x0 << 28)
-#define MHCR_CHIP_ASIC_REV_5703 (0x1 << 28)
-#define MHCR_CHIP_ASIC_REV_5704 (0x2 << 28)
-#define MHCR_CHIP_ASIC_REV_5705 (0x3 << 28)
-#define MHCR_CHIP_ASIC_REV_5721_5751 (0x4 << 28)
-#define MHCR_CHIP_ASIC_REV_5714 (0x5 << 28)
-#define MHCR_CHIP_ASIC_REV_5752 (0x6 << 28)
-#define MHCR_CHIP_ASIC_REV_5754 (0xb << 28)
-#define MHCR_CHIP_ASIC_REV_5787 ((uint32_t)0xb << 28)
-#define MHCR_CHIP_ASIC_REV_5755 ((uint32_t)0xa << 28)
-#define MHCR_CHIP_ASIC_REV_5715 ((uint32_t)0x9 << 28)
-#define MHCR_CHIP_ASIC_REV_5906 ((uint32_t)0xc << 28)
-#define MHCR_CHIP_ASIC_REV_5723 ((uint32_t)0xf << 28)
-
+#define MHCR_CHIP_REV_5703_A0 0x1000
+#define MHCR_CHIP_REV_5704_A0 0x2000
+#define MHCR_CHIP_REV_5751_A0 0x4000
+#define MHCR_CHIP_REV_5721_A0 0x4100
+#define MHCR_CHIP_REV_5755_A0 0xa000
+#define MHCR_CHIP_REV_5755_A1 0xa001
+#define MHCR_CHIP_REV_5719_A0 0x05719000
+#define MHCR_CHIP_REV_5720_A0 0x05720000
+
+#define MHCR_CHIP_ASIC_REV(ChipRevId) ((ChipRevId) >> 12)
+#define MHCR_CHIP_ASIC_REV_5700 0x07
+#define MHCR_CHIP_ASIC_REV_5701 0x00
+#define MHCR_CHIP_ASIC_REV_5703 0x01
+#define MHCR_CHIP_ASIC_REV_5704 0x02
+#define MHCR_CHIP_ASIC_REV_5705 0x03
+#define MHCR_CHIP_ASIC_REV_5750 0x04
+#define MHCR_CHIP_ASIC_REV_5752 0x06
+#define MHCR_CHIP_ASIC_REV_5780 0x08
+#define MHCR_CHIP_ASIC_REV_5714 0x09
+#define MHCR_CHIP_ASIC_REV_5755 0x0a
+#define MHCR_CHIP_ASIC_REV_5787 0x0b
+#define MHCR_CHIP_ASIC_REV_5906 0x0c
+#define MHCR_CHIP_ASIC_REV_PRODID 0x0f
+#define MHCR_CHIP_ASIC_REV_5784 0x5784
+#define MHCR_CHIP_ASIC_REV_5761 0x5761
+#define MHCR_CHIP_ASIC_REV_5785 0x5785
+#define MHCR_CHIP_ASIC_REV_5717 0x5717
+#define MHCR_CHIP_ASIC_REV_5719 0x5719
+#define MHCR_CHIP_ASIC_REV_5720 0x5720
+#define MHCR_CHIP_ASIC_REV_57780 0x57780
+#define MHCR_CHIP_ASIC_REV_57765 0x57785
+#define MHCR_CHIP_ASIC_REV_57766 0x57766
/*
* PCI DMA read/write Control Register, in PCI config space
@@ -466,6 +454,10 @@ extern "C" {
#define PCI_CONF_DEV_STUS_5723 0xd6
#define DEVICE_ERROR_STUS 0xf
+#define PCI_CONF_PRODID_ASICREV 0x000000bc
+#define PCI_CONF_GEN2_PRODID_ASICREV 0x000000f4
+#define PCI_CONF_GEN15_PRODID_ASICREV 0x000000fc
+
#define NIC_MEM_WINDOW_OFFSET 0x00008000 /* 32k */
/*
@@ -541,6 +533,7 @@ extern "C" {
#define MEMORY_ARBITER_MODE_REG 0x4000
#define BUFFER_MANAGER_MODE_REG 0x4400
#define READ_DMA_MODE_REG 0x4800
+#define READ_DMA_RESERVED_CONTROL_REG 0x4900
#define WRITE_DMA_MODE_REG 0x4c00
#define DMA_COMPLETION_MODE_REG 0x6400
@@ -552,6 +545,9 @@ extern "C" {
* Transmit MAC Mode Register
* (TRANSMIT_MAC_MODE_REG, 0x045c)
*/
+#define TRANSMIT_MODE_HTX2B_CNT_DN_MODE 0x00800000
+#define TRANSMIT_MODE_HTX2B_JMB_FRM_LEN 0x00400000
+#define TRANSMIT_MODE_MBUF_LOCKUP_FIX 0x00000100
#define TRANSMIT_MODE_LONG_PAUSE 0x00000040
#define TRANSMIT_MODE_BIG_BACKOFF 0x00000020
#define TRANSMIT_MODE_FLOW_CONTROL 0x00000010
@@ -619,12 +615,14 @@ extern "C" {
*/
#define BUFF_MGR_TEST_MODE 0x00000008
#define BUFF_MGR_MBUF_LOW_ATTN_ENABLE 0x00000010
+#define BUFF_MGR_NO_TX_UNDERRUN 0x80000000
#define BUFF_MGR_ALL_ATTN_BITS 0x00000014
/*
* Read and Write DMA Mode Registers (READ_DMA_MODE_REG,
- * 0x4800 and WRITE_DMA_MODE_REG, 0x4c00)
+ * 0x4800, READ_DMA_RESERVED_CONTROL_REG, 0x4900,
+ * WRITE_DMA_MODE_REG, 0x4c00)
*
* These registers each contain a 2-bit priority field, which controls
* the relative priority of that type of DMA (read vs. write vs. MSI),
@@ -635,6 +633,15 @@ extern "C" {
#define DMA_PRIORITY_SHIFT 30
#define ALL_DMA_ATTN_BITS 0x000003fc
+#define RDMA_RSRVCTRL_FIFO_OFLW_FIX 0x00000004
+#define RDMA_RSRVCTRL_FIFO_LWM_1_5K 0x00000c00
+#define RDMA_RSRVCTRL_FIFO_LWM_MASK 0x00000ff0
+#define RDMA_RSRVCTRL_FIFO_HWM_1_5K 0x000c0000
+#define RDMA_RSRVCTRL_FIFO_HWM_MASK 0x000ff000
+#define RDMA_RSRVCTRL_TXMRGN_320B 0x28000000
+#define RDMA_RSRVCTRL_TXMRGN_MASK 0xffe00000
+
+
/*
* BCM5755, 5755M, 5906, 5906M only
* 1 - Enable Fix. Device will send out the status block before
@@ -644,6 +651,10 @@ extern "C" {
*/
#define DMA_STATUS_TAG_FIX_CQ12384 0x20000000
+/* 5720 only */
+#define DMA_H2BNC_VLAN_DET 0x20000000
+
+
/*
* End of state machine control register definitions
*/
@@ -781,6 +792,8 @@ extern "C" {
#define MAC_RX_MTU_DEFAULT 0x000005f2 /* 1522 */
#define MAC_TX_LENGTHS_REG 0x0464
#define MAC_TX_LENGTHS_DEFAULT 0x00002620
+#define MAC_TX_LENGTHS_JMB_FRM_LEN_MSK 0x00ff0000
+#define MAC_TX_LENGTHS_CNT_DWN_VAL_MSK 0xff000000
/*
* MII access registers
@@ -1069,10 +1082,16 @@ extern "C" {
#define JUMBO_RCV_BD_REPLENISH_DEFAULT 0x00000020 /* 32 */
/*
- * CPMU registers (5717/5718 only)
+ * CPMU registers (5717/5718/5719/5720 only)
*/
-#define CPMU_STATUS_REG 0x362c
-#define CPMU_STATUS_FUN_NUM 0x20000000
+#define CPMU_CLCK_ORIDE_REG 0x3624
+#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000
+
+#define CPMU_STATUS_REG 0x362c
+#define CPMU_STATUS_FUN_NUM_5717 0x20000000
+#define CPMU_STATUS_FUN_NUM_5719 0xc0000000
+#define CPMU_STATUS_FUN_NUM_5719_SHIFT 30
+
/*
* Host Coalescing Engine Control Registers
@@ -1191,6 +1210,8 @@ extern "C" {
#define VCPU_EXT_CTL 0x6890
#define VCPU_EXT_CTL_HALF 0x00400000
+#define GRC_FASTBOOT_PC 0x6894
+
#define FTQ_RESET_REG 0x5c00
#define MSI_MODE_REG 0x6000
@@ -1210,14 +1231,18 @@ extern "C" {
#define MODE_INT_ON_TXRISC_ATTN 0x01000000
#define MODE_RECV_NO_PSEUDO_HDR_CSUM 0x00800000
#define MODE_SEND_NO_PSEUDO_HDR_CSUM 0x00100000
+#define MODE_HTX2B_ENABLE 0x00040000
#define MODE_HOST_SEND_BDS 0x00020000
#define MODE_HOST_STACK_UP 0x00010000
#define MODE_FORCE_32_BIT_PCI 0x00008000
+#define MODE_B2HRX_ENABLE 0x00008000
#define MODE_NO_INT_ON_RECV 0x00004000
#define MODE_NO_INT_ON_SEND 0x00002000
#define MODE_ALLOW_BAD_FRAMES 0x00000800
#define MODE_NO_CRC 0x00000400
#define MODE_NO_FRAME_CRACKING 0x00000200
+#define MODE_WORD_SWAP_B2HRX_DATA 0x00000080
+#define MODE_BYTE_SWAP_B2HRX_DATA 0x00000040
#define MODE_WORD_SWAP_FRAME 0x00000020
#define MODE_BYTE_SWAP_FRAME 0x00000010
#define MODE_WORD_SWAP_NONFRAME 0x00000004
@@ -1246,7 +1271,7 @@ extern "C" {
*/
#define CORE_CLOCK_MHZ 66
#define MISC_CONFIG_REG 0x6804
-#define MISC_CONFIG_GRC_RESET_DISABLE 0x20000000
+#define MISC_CONFIG_GRC_RESET_DISABLE 0x20000000
#define MISC_CONFIG_GPHY_POWERDOWN_OVERRIDE 0x04000000
#define MISC_CONFIG_POWERDOWN 0x00100000
#define MISC_CONFIG_POWER_STATE 0x00060000
@@ -1567,6 +1592,7 @@ extern "C" {
#define BGE_MINI_SLOTS_MAX 1024
#define BGE_RECV_SLOTS_MAX 2048
#define BGE_RECV_SLOTS_5705 512
+#define BGE_RECV_SLOTS_5717 1024
#define BGE_RECV_SLOTS_5782 512
#define BGE_RECV_SLOTS_5721 512
diff --git a/usr/src/uts/common/io/bge/bge_impl.h b/usr/src/uts/common/io/bge/bge_impl.h
index 772c989092..0c51c2bc8e 100644
--- a/usr/src/uts/common/io/bge/bge_impl.h
+++ b/usr/src/uts/common/io/bge/bge_impl.h
@@ -23,6 +23,10 @@
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ */
+
#ifndef _BGE_IMPL_H
#define _BGE_IMPL_H
@@ -605,6 +609,7 @@ typedef struct {
uint8_t latency; /* latency-timer */
uint8_t flags;
+ uint32_t chip_type; /* see CHIP_TYPE_ in bge_hw.h */
uint16_t chip_label; /* numeric part only */
/* (e.g. 5703/5794/etc) */
uint32_t mbuf_base; /* Mbuf pool parameters */
@@ -640,10 +645,11 @@ typedef struct {
uint32_t mask_pci_int;
} chip_id_t;
-#define CHIP_FLAG_SUPPORTED 0x80
-#define CHIP_FLAG_SERDES 0x40
-#define CHIP_FLAG_PARTIAL_CSUM 0x20
-#define CHIP_FLAG_NO_JUMBO 0x1
+#define CHIP_FLAG_SUPPORTED 0x80
+#define CHIP_FLAG_SERDES 0x40
+#define CHIP_FLAG_PARTIAL_CSUM 0x20
+#define CHIP_FLAG_NO_CHECK_RESET 0x2
+#define CHIP_FLAG_NO_JUMBO 0x1
/*
* Collection of physical-layer functions to:
diff --git a/usr/src/uts/common/io/bge/bge_main2.c b/usr/src/uts/common/io/bge/bge_main2.c
index f191f313c0..d0f309730d 100644
--- a/usr/src/uts/common/io/bge/bge_main2.c
+++ b/usr/src/uts/common/io/bge/bge_main2.c
@@ -23,6 +23,10 @@
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ */
+
#include "bge_impl.h"
#include <sys/sdt.h>
#include <sys/mac_provider.h>
@@ -3211,13 +3215,17 @@ bge_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
*/
if (DEVICE_5717_SERIES_CHIPSETS(bgep))
pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MHCR, 0);
+#else
+ mhcrValue = MHCR_ENABLE_INDIRECT_ACCESS |
+ MHCR_ENABLE_TAGGED_STATUS_MODE |
+ MHCR_MASK_INTERRUPT_MODE |
+ MHCR_MASK_PCI_INT_OUTPUT |
+ MHCR_CLEAR_INTERRUPT_INTA;
+#endif
pci_config_put32(bgep->cfg_handle, PCI_CONF_BGE_MHCR, mhcrValue);
bge_ind_put32(bgep, MEMORY_ARBITER_MODE_REG,
bge_ind_get32(bgep, MEMORY_ARBITER_MODE_REG) |
MEMORY_ARBITER_ENABLE);
-#else
- mhcrValue = pci_config_get32(bgep->cfg_handle, PCI_CONF_BGE_MHCR);
-#endif
if (mhcrValue & MHCR_ENABLE_ENDIAN_WORD_SWAP) {
bgep->asf_wordswapped = B_TRUE;
} else {
diff --git a/usr/src/uts/common/io/bge/bge_mii.c b/usr/src/uts/common/io/bge/bge_mii.c
index f24b6a3f16..b47c043d8c 100644
--- a/usr/src/uts/common/io/bge/bge_mii.c
+++ b/usr/src/uts/common/io/bge/bge_mii.c
@@ -23,6 +23,10 @@
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ */
+
#include "bge_impl.h"
/*
@@ -207,6 +211,7 @@ bge_phy_reset(bge_t *bgep)
{
uint16_t control;
uint_t count;
+ boolean_t ret = B_FALSE;
BGE_TRACE(("bge_phy_reset($%p)", (void *)bgep));
@@ -221,22 +226,26 @@ bge_phy_reset(bge_t *bgep)
}
/*
- * Set the PHY RESET bit, then wait up to 5 ms for it to self-clear
+ * Set the PHY RESET bit, then wait up to 50 ms for it to self-clear
*/
bge_mii_put16(bgep, MII_CONTROL, MII_CONTROL_RESET);
- for (count = 0; ++count < 1000; ) {
- drv_usecwait(5);
+ for (count = 0; ++count < 5000; ) {
control = bge_mii_get16(bgep, MII_CONTROL);
- if (BIC(control, MII_CONTROL_RESET))
- return (B_TRUE);
+ if (BIC(control, MII_CONTROL_RESET)) {
+ drv_usecwait(40);
+ ret = B_TRUE;
+ break;
+ }
+ drv_usecwait(10);
}
- if (DEVICE_5906_SERIES_CHIPSETS(bgep))
+ if (ret == B_TRUE && DEVICE_5906_SERIES_CHIPSETS(bgep))
(void) bge_adj_volt_5906(bgep);
- BGE_DEBUG(("bge_phy_reset: FAILED, control now 0x%x", control));
+ if (ret == B_FALSE)
+ BGE_DEBUG(("bge_phy_reset: FAILED, control now 0x%x", control));
- return (B_FALSE);
+ return (ret);
}
/*
@@ -541,34 +550,14 @@ bge_restart_copper(bge_t *bgep, boolean_t powerdown)
ASSERT(mutex_owned(bgep->genlock));
- switch (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev)) {
- default:
- /*
- * Shouldn't happen; it means we don't recognise this chip.
- * It's probably a new one, so we'll try our best anyway ...
- */
- case MHCR_CHIP_ASIC_REV_5703:
- case MHCR_CHIP_ASIC_REV_5704:
- case MHCR_CHIP_ASIC_REV_5705:
- case MHCR_CHIP_ASIC_REV_5752:
- case MHCR_CHIP_ASIC_REV_5714:
- case MHCR_CHIP_ASIC_REV_5715:
- reset_ok = bge_phy_reset_and_check(bgep);
- break;
-
- case MHCR_CHIP_ASIC_REV_5906:
- case MHCR_CHIP_ASIC_REV_5700:
- case MHCR_CHIP_ASIC_REV_5701:
- case MHCR_CHIP_ASIC_REV_5723:
- case MHCR_CHIP_ASIC_REV_5721_5751:
- /*
- * Just a plain reset; the "check" code breaks these chips
- */
+ if (bgep->chipid.flags & CHIP_FLAG_NO_CHECK_RESET) {
reset_ok = bge_phy_reset(bgep);
if (!reset_ok)
bge_fm_ereport(bgep, DDI_FM_DEVICE_NO_RESPONSE);
- break;
+ } else {
+ reset_ok = bge_phy_reset_and_check(bgep);
}
+
if (!reset_ok) {
BGE_REPORT((bgep, "PHY failed to reset correctly"));
return (DDI_FAILURE);
@@ -590,7 +579,7 @@ bge_restart_copper(bge_t *bgep, boolean_t powerdown)
switch (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev)) {
case MHCR_CHIP_ASIC_REV_5705:
- case MHCR_CHIP_ASIC_REV_5721_5751:
+ case MHCR_CHIP_ASIC_REV_5750:
bge_phy_bit_err_fix(bgep);
break;
}
@@ -1507,14 +1496,22 @@ bge_phys_init(bge_t *bgep)
*/
bgep->phy_mii_addr = 1;
if (DEVICE_5717_SERIES_CHIPSETS(bgep)) {
- int regval = bge_reg_get32(bgep, CPMU_STATUS_REG);
- if (regval & CPMU_STATUS_FUN_NUM)
- bgep->phy_mii_addr += 1;
+ uint32_t regval = bge_reg_get32(bgep, CPMU_STATUS_REG);
+ if (MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5719 ||
+ MHCR_CHIP_ASIC_REV(bgep->chipid.asic_rev) ==
+ MHCR_CHIP_ASIC_REV_5720) {
+ bgep->phy_mii_addr +=
+ (regval & CPMU_STATUS_FUN_NUM_5719) >>
+ CPMU_STATUS_FUN_NUM_5719_SHIFT;
+ } else {
+ bgep->phy_mii_addr +=
+ (regval & CPMU_STATUS_FUN_NUM_5717) ? 1 : 0;
+ }
regval = bge_reg_get32(bgep, SGMII_STATUS_REG);
if (regval & MEDIA_SELECTION_MODE)
bgep->phy_mii_addr += 7;
}
-
if (bge_phy_probe(bgep)) {
bgep->chipid.flags &= ~CHIP_FLAG_SERDES;
bgep->physops = &copper_ops;
diff --git a/usr/src/uts/common/io/blkdev/blkdev.c b/usr/src/uts/common/io/blkdev/blkdev.c
index 8af4d1d6a5..20e3a5737e 100644
--- a/usr/src/uts/common/io/blkdev/blkdev.c
+++ b/usr/src/uts/common/io/blkdev/blkdev.c
@@ -85,6 +85,7 @@ struct bd {
kstat_io_t *d_kiop;
boolean_t d_rdonly;
+ boolean_t d_ssd;
boolean_t d_removable;
boolean_t d_hotpluggable;
boolean_t d_use_dma;
@@ -1103,6 +1104,14 @@ bd_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *credp, int *rvalp)
}
return (0);
}
+ case DKIOCSOLIDSTATE: {
+ int i;
+ i = bd->d_ssd ? 1 : 0;
+ if (ddi_copyout(&i, ptr, sizeof (i), flag)) {
+ return (EFAULT);
+ }
+ return (0);
+ }
case DKIOCSTATE: {
enum dkio_state state;
if (ddi_copyin(ptr, &state, sizeof (state), flag)) {
@@ -1246,6 +1255,7 @@ bd_tg_getinfo(dev_info_t *dip, int cmd, void *arg, void *tg_cookie)
bd_update_state(bd);
((tg_attribute_t *)arg)->media_is_writable =
bd->d_rdonly ? B_FALSE : B_TRUE;
+ ((tg_attribute_t *)arg)->media_is_solid_state = bd->d_ssd;
return (0);
default:
@@ -1361,6 +1371,7 @@ bd_update_state(bd_t *bd)
bd->d_blkshift = ddi_ffs(media.m_blksize) - 1;
bd->d_numblks = media.m_nblks;
bd->d_rdonly = media.m_readonly;
+ bd->d_ssd = media.m_solidstate;
state = DKIO_INSERTED;
}
diff --git a/usr/src/uts/common/io/cmlb.c b/usr/src/uts/common/io/cmlb.c
index 0d174501f5..d7d6cb5ab5 100644
--- a/usr/src/uts/common/io/cmlb.c
+++ b/usr/src/uts/common/io/cmlb.c
@@ -20,6 +20,7 @@
*/
/*
+ * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -243,6 +244,7 @@ static i_ddi_prop_dyn_t cmlb_prop_dyn[] = {
{"Size", DDI_PROP_TYPE_INT64, S_IFCHR},
{"device-nblocks", DDI_PROP_TYPE_INT64},
{"device-blksize", DDI_PROP_TYPE_INT},
+ {"device-solid-state", DDI_PROP_TYPE_INT},
{NULL}
};
@@ -5657,11 +5659,12 @@ cmlb_prop_op(cmlb_handle_t cmlbhandle,
struct cmlb_lun *cl;
diskaddr_t capacity;
uint32_t lbasize;
- enum dp { DP_NBLOCKS, DP_BLKSIZE } dp;
+ enum dp { DP_NBLOCKS, DP_BLKSIZE, DP_SSD } dp;
int callers_length;
caddr_t buffer;
uint64_t nblocks64;
uint_t dblk;
+ tg_attribute_t tgattr;
/* Always fallback to ddi_prop_op... */
cl = (struct cmlb_lun *)cmlbhandle;
@@ -5685,6 +5688,8 @@ fallback: return (ddi_prop_op(dev, dip, prop_op, mod_flags,
dp = DP_NBLOCKS;
else if (strcmp(name, "device-blksize") == 0)
dp = DP_BLKSIZE;
+ else if (strcmp(name, "device-solid-state") == 0)
+ dp = DP_SSD;
else
goto fallback;
@@ -5692,7 +5697,7 @@ fallback: return (ddi_prop_op(dev, dip, prop_op, mod_flags,
callers_length = *lengthp;
if (dp == DP_NBLOCKS)
*lengthp = sizeof (uint64_t);
- else if (dp == DP_BLKSIZE)
+ else if ((dp == DP_BLKSIZE) || (dp == DP_SSD))
*lengthp = sizeof (uint32_t);
/* service request for the length of the property */
@@ -5720,11 +5725,19 @@ fallback: return (ddi_prop_op(dev, dip, prop_op, mod_flags,
}
/* transfer the value into the buffer */
- if (dp == DP_NBLOCKS)
+ switch (dp) {
+ case DP_NBLOCKS:
*((uint64_t *)buffer) = capacity;
- else if (dp == DP_BLKSIZE)
+ break;
+ case DP_BLKSIZE:
*((uint32_t *)buffer) = lbasize;
-
+ break;
+ case DP_SSD:
+ if (DK_TG_GETATTRIBUTE(cl, &tgattr, tg_cookie) != 0)
+ tgattr.media_is_solid_state = B_FALSE;
+ *((uint32_t *)buffer) =
+ tgattr.media_is_solid_state ? 1 : 0;
+ }
return (DDI_PROP_SUCCESS);
}
diff --git a/usr/src/uts/common/io/dld/dld_drv.c b/usr/src/uts/common/io/dld/dld_drv.c
index 40cbe86170..2152ce0baa 100644
--- a/usr/src/uts/common/io/dld/dld_drv.c
+++ b/usr/src/uts/common/io/dld/dld_drv.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
/*
@@ -701,7 +702,8 @@ drv_ioc_prop_common(dld_ioc_macprop_t *prop, intptr_t arg, boolean_t set,
err = EACCES;
goto done;
}
- err = dls_devnet_setzid(dlh, dzp->diz_zid);
+ err = dls_devnet_setzid(dlh, dzp->diz_zid,
+ dzp->diz_transient);
} else {
kprop->pr_perm_flags = MAC_PROP_PERM_RW;
(*(zoneid_t *)kprop->pr_val) = dls_devnet_getzid(dlh);
@@ -865,7 +867,7 @@ drv_ioc_rename(void *karg, intptr_t arg, int mode, cred_t *cred, int *rvalp)
return (err);
if ((err = dls_devnet_rename(dir->dir_linkid1, dir->dir_linkid2,
- dir->dir_link)) != 0)
+ dir->dir_link, dir->dir_zoneinit)) != 0)
return (err);
if (dir->dir_linkid2 == DATALINK_INVALID_LINKID)
diff --git a/usr/src/uts/common/io/dls/dls.c b/usr/src/uts/common/io/dls/dls.c
index 92993ada58..61e4afb5b6 100644
--- a/usr/src/uts/common/io/dls/dls.c
+++ b/usr/src/uts/common/io/dls/dls.c
@@ -629,6 +629,22 @@ boolean_t
dls_accept_promisc(dld_str_t *dsp, mac_header_info_t *mhip, dls_rx_t *ds_rx,
void **ds_rx_arg, boolean_t loopback)
{
+ if (dsp->ds_promisc == 0) {
+ /*
+ * If there are active walkers of the mi_promisc_list when
+ * promiscuousness is disabled, ds_promisc will be cleared,
+ * but the DLS will remain on the mi_promisc_list until the
+ * walk is completed. If we do not recognize this case here,
+ * we won't properly execute the ds_promisc case in the common
+ * accept routine -- and we will potentially accept a packet
+ * that has originated with this DLS (which in turn can
+ * induce recursion and death by stack overflow). If
+ * ds_promisc is zero, we know that we are in this window --
+ * and we refuse to accept the packet.
+ */
+ return (B_FALSE);
+ }
+
return (dls_accept_common(dsp, mhip, ds_rx, ds_rx_arg, B_TRUE,
loopback));
}
diff --git a/usr/src/uts/common/io/dls/dls_mgmt.c b/usr/src/uts/common/io/dls/dls_mgmt.c
index 049c4bd757..27a808f211 100644
--- a/usr/src/uts/common/io/dls/dls_mgmt.c
+++ b/usr/src/uts/common/io/dls/dls_mgmt.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
/*
@@ -105,12 +106,13 @@ typedef struct dls_devnet_s {
zoneid_t dd_zid; /* current zone */
boolean_t dd_prop_loaded;
taskqid_t dd_prop_taskid;
+ boolean_t dd_transient; /* link goes away when zone does */
} dls_devnet_t;
static int i_dls_devnet_create_iptun(const char *, const char *,
datalink_id_t *);
static int i_dls_devnet_destroy_iptun(datalink_id_t);
-static int i_dls_devnet_setzid(dls_devnet_t *, zoneid_t, boolean_t);
+static int i_dls_devnet_setzid(dls_devnet_t *, zoneid_t, boolean_t, boolean_t);
static int dls_devnet_unset(const char *, datalink_id_t *, boolean_t);
/*ARGSUSED*/
@@ -145,7 +147,12 @@ dls_zone_remove(datalink_id_t linkid, void *arg)
dls_devnet_t *ddp;
if (dls_devnet_hold_tmp(linkid, &ddp) == 0) {
- (void) dls_devnet_setzid(ddp, GLOBAL_ZONEID);
+ /*
+ * Don't bother moving transient links back to the global zone
+ * since we will simply delete them in dls_devnet_unset.
+ */
+ if (!ddp->dd_transient)
+ (void) dls_devnet_setzid(ddp, GLOBAL_ZONEID, B_FALSE);
dls_devnet_rele_tmp(ddp);
}
return (0);
@@ -526,6 +533,7 @@ dls_mgmt_get_linkid(const char *link, datalink_id_t *linkid)
getlinkid.ld_cmd = DLMGMT_CMD_GETLINKID;
(void) strlcpy(getlinkid.ld_link, link, MAXLINKNAMELEN);
+ getlinkid.ld_zoneid = getzoneid();
if ((err = i_dls_mgmt_upcall(&getlinkid, sizeof (getlinkid), &retval,
sizeof (retval))) == 0) {
@@ -740,12 +748,23 @@ dls_devnet_stat_update(kstat_t *ksp, int rw)
* Create the "link" kstats.
*/
static void
-dls_devnet_stat_create(dls_devnet_t *ddp, zoneid_t zoneid)
+dls_devnet_stat_create(dls_devnet_t *ddp, zoneid_t zoneid, zoneid_t newzoneid)
{
kstat_t *ksp;
+ char *nm;
+ char kname[MAXLINKNAMELEN];
+
+ if (zoneid != newzoneid) {
+ ASSERT(zoneid == GLOBAL_ZONEID);
+ (void) snprintf(kname, sizeof (kname), "z%d_%s", newzoneid,
+ ddp->dd_linkname);
+ nm = kname;
+ } else {
+ nm = ddp->dd_linkname;
+ }
- if (dls_stat_create("link", 0, ddp->dd_linkname, zoneid,
- dls_devnet_stat_update, ddp, &ksp) == 0) {
+ if (dls_stat_create("link", 0, nm, zoneid,
+ dls_devnet_stat_update, ddp, &ksp, newzoneid) == 0) {
ASSERT(ksp != NULL);
if (zoneid == ddp->dd_owner_zid) {
ASSERT(ddp->dd_ksp == NULL);
@@ -765,12 +784,12 @@ dls_devnet_stat_destroy(dls_devnet_t *ddp, zoneid_t zoneid)
{
if (zoneid == ddp->dd_owner_zid) {
if (ddp->dd_ksp != NULL) {
- kstat_delete(ddp->dd_ksp);
+ dls_stat_delete(ddp->dd_ksp);
ddp->dd_ksp = NULL;
}
} else {
if (ddp->dd_zone_ksp != NULL) {
- kstat_delete(ddp->dd_zone_ksp);
+ dls_stat_delete(ddp->dd_zone_ksp);
ddp->dd_zone_ksp = NULL;
}
}
@@ -781,15 +800,25 @@ dls_devnet_stat_destroy(dls_devnet_t *ddp, zoneid_t zoneid)
* and create the new set using the new name.
*/
static void
-dls_devnet_stat_rename(dls_devnet_t *ddp)
+dls_devnet_stat_rename(dls_devnet_t *ddp, boolean_t zoneinit)
{
if (ddp->dd_ksp != NULL) {
- kstat_delete(ddp->dd_ksp);
+ dls_stat_delete(ddp->dd_ksp);
ddp->dd_ksp = NULL;
}
- /* We can't rename a link while it's assigned to a non-global zone. */
+ if (zoneinit && ddp->dd_zone_ksp != NULL) {
+ dls_stat_delete(ddp->dd_zone_ksp);
+ ddp->dd_zone_ksp = NULL;
+ }
+ /*
+ * We can't rename a link while it's assigned to a non-global zone
+ * unless we're first initializing the zone while readying it.
+ */
ASSERT(ddp->dd_zone_ksp == NULL);
- dls_devnet_stat_create(ddp, ddp->dd_owner_zid);
+ dls_devnet_stat_create(ddp, ddp->dd_owner_zid,
+ (zoneinit ? ddp->dd_zid : ddp->dd_owner_zid));
+ if (zoneinit)
+ dls_devnet_stat_create(ddp, ddp->dd_zid, ddp->dd_zid);
}
/*
@@ -878,7 +907,8 @@ done:
rw_exit(&i_dls_devnet_lock);
if (err == 0) {
if (zoneid != GLOBAL_ZONEID &&
- (err = i_dls_devnet_setzid(ddp, zoneid, B_FALSE)) != 0)
+ (err = i_dls_devnet_setzid(ddp, zoneid, B_FALSE,
+ B_FALSE)) != 0)
(void) dls_devnet_unset(macname, &linkid, B_TRUE);
/*
* The kstat subsystem holds its own locks (rather perimeter)
@@ -887,7 +917,7 @@ done:
* lock hierarchy is kstat locks -> i_dls_devnet_lock.
*/
if (stat_create)
- dls_devnet_stat_create(ddp, zoneid);
+ dls_devnet_stat_create(ddp, zoneid, zoneid);
if (ddpp != NULL)
*ddpp = ddp;
}
@@ -924,17 +954,78 @@ dls_devnet_unset(const char *macname, datalink_id_t *id, boolean_t wait)
ASSERT(ddp->dd_ref != 0);
if ((ddp->dd_ref != 1) || (!wait &&
(ddp->dd_tref != 0 || ddp->dd_prop_taskid != NULL))) {
- mutex_exit(&ddp->dd_mutex);
- rw_exit(&i_dls_devnet_lock);
- return (EBUSY);
+ int zstatus = 0;
+
+ /*
+ * There are a couple of alternatives that might be going on
+ * here; a) the zone is shutting down and it has a transient
+ * link assigned, in which case we want to clean it up instead
+ * of moving it back to the global zone, or b) its possible
+ * that we're trying to clean up an orphaned vnic that was
+ * delegated to a zone and which wasn't cleaned up properly
+ * when the zone went away. Check for either of these cases
+ * before we simply return EBUSY.
+ *
+ * zstatus indicates which situation we are dealing with:
+ * 0 - means return EBUSY
+ * 1 - means case (a), cleanup transient link
+ * -1 - means case (b), orphained VNIC
+ */
+ if (ddp->dd_ref > 1 && ddp->dd_zid != GLOBAL_ZONEID) {
+ zone_t *zp;
+
+ if ((zp = zone_find_by_id(ddp->dd_zid)) == NULL) {
+ zstatus = -1;
+ } else {
+ if (ddp->dd_transient) {
+ zone_status_t s = zone_status_get(zp);
+
+ if (s >= ZONE_IS_SHUTTING_DOWN)
+ zstatus = 1;
+ }
+ zone_rele(zp);
+ }
+ }
+
+ if (zstatus == 0) {
+ mutex_exit(&ddp->dd_mutex);
+ rw_exit(&i_dls_devnet_lock);
+ return (EBUSY);
+ }
+
+ /*
+ * We want to delete the link, reset ref to 1;
+ */
+ if (zstatus == -1)
+ /* Log a warning, but continue in this case */
+ cmn_err(CE_WARN, "clear orphaned datalink: %s\n",
+ ddp->dd_linkname);
+ ddp->dd_ref = 1;
}
ddp->dd_flags |= DD_CONDEMNED;
ddp->dd_ref--;
*id = ddp->dd_linkid;
- if (ddp->dd_zid != GLOBAL_ZONEID)
- (void) i_dls_devnet_setzid(ddp, GLOBAL_ZONEID, B_FALSE);
+ if (ddp->dd_zid != GLOBAL_ZONEID) {
+ /*
+ * We need to release the dd_mutex before we try and destroy the
+ * stat. When we destroy it, we'll need to grab the lock for the
+ * kstat but if there's a concurrent reader of the kstat, we'll
+ * be blocked on it. This will lead to deadlock because these
+ * kstats employ a ks_update function (dls_devnet_stat_update)
+ * which needs the dd_mutex that we currently hold.
+ *
+ * Because we've already flagged the dls_devnet_t as
+ * DD_CONDEMNED and we still have a write lock on
+ * i_dls_devnet_lock, we should be able to release the dd_mutex.
+ */
+ mutex_exit(&ddp->dd_mutex);
+ dls_devnet_stat_destroy(ddp, ddp->dd_zid);
+ mutex_enter(&ddp->dd_mutex);
+ (void) i_dls_devnet_setzid(ddp, GLOBAL_ZONEID, B_FALSE,
+ B_FALSE);
+ }
/*
* Remove this dls_devnet_t from the hash table.
@@ -960,8 +1051,15 @@ dls_devnet_unset(const char *macname, datalink_id_t *id, boolean_t wait)
ASSERT(ddp->dd_tref == 0 && ddp->dd_prop_taskid == NULL);
}
- if (ddp->dd_linkid != DATALINK_INVALID_LINKID)
+ if (ddp->dd_linkid != DATALINK_INVALID_LINKID) {
+ /*
+ * See the earlier call in this function for an explanation.
+ */
+ mutex_exit(&ddp->dd_mutex);
dls_devnet_stat_destroy(ddp, ddp->dd_owner_zid);
+ mutex_enter(&ddp->dd_mutex);
+ }
+
ddp->dd_prop_loaded = B_FALSE;
ddp->dd_linkid = DATALINK_INVALID_LINKID;
@@ -1261,9 +1359,15 @@ dls_devnet_phydev(datalink_id_t vlanid, dev_t *devp)
*
* This case does not change the <link name, linkid> mapping, so the link's
* kstats need to be updated with using name associated the given id2.
+ *
+ * The zonename parameter is used to allow us to create a VNIC in the global
+ * zone which is assigned to a non-global zone. Since there is a race condition
+ * in the create process if two VNICs have the same name, we need to rename it
+ * after it has been assigned to the zone.
*/
int
-dls_devnet_rename(datalink_id_t id1, datalink_id_t id2, const char *link)
+dls_devnet_rename(datalink_id_t id1, datalink_id_t id2, const char *link,
+ boolean_t zoneinit)
{
dls_dev_handle_t ddh = NULL;
int err = 0;
@@ -1313,13 +1417,16 @@ dls_devnet_rename(datalink_id_t id1, datalink_id_t id2, const char *link)
* is currently accessing the link kstats, or if the link is on-loan
* to a non-global zone. Then set the DD_KSTAT_CHANGING flag to
* prevent any access to the kstats while we delete and recreate
- * kstats below.
+ * kstats below. However, we skip this check if we're renaming the
+ * vnic as part of bringing it up for a zone.
*/
mutex_enter(&ddp->dd_mutex);
- if (ddp->dd_ref > 1) {
- mutex_exit(&ddp->dd_mutex);
- err = EBUSY;
- goto done;
+ if (!zoneinit) {
+ if (ddp->dd_ref > 1) {
+ mutex_exit(&ddp->dd_mutex);
+ err = EBUSY;
+ goto done;
+ }
}
ddp->dd_flags |= DD_KSTAT_CHANGING;
@@ -1333,7 +1440,15 @@ dls_devnet_rename(datalink_id_t id1, datalink_id_t id2, const char *link)
/* rename mac client name and its flow if exists */
if ((err = mac_open(ddp->dd_mac, &mh)) != 0)
goto done;
- (void) mac_rename_primary(mh, link);
+ if (zoneinit) {
+ char tname[MAXLINKNAMELEN];
+
+ (void) snprintf(tname, sizeof (tname), "z%d_%s",
+ ddp->dd_zid, link);
+ (void) mac_rename_primary(mh, tname);
+ } else {
+ (void) mac_rename_primary(mh, link);
+ }
mac_close(mh);
goto done;
}
@@ -1406,7 +1521,7 @@ done:
*/
rw_exit(&i_dls_devnet_lock);
if (err == 0)
- dls_devnet_stat_rename(ddp);
+ dls_devnet_stat_rename(ddp, zoneinit);
if (clear_dd_flag) {
mutex_enter(&ddp->dd_mutex);
@@ -1421,7 +1536,8 @@ done:
}
static int
-i_dls_devnet_setzid(dls_devnet_t *ddp, zoneid_t new_zoneid, boolean_t setprop)
+i_dls_devnet_setzid(dls_devnet_t *ddp, zoneid_t new_zoneid, boolean_t setprop,
+ boolean_t transient)
{
int err;
mac_perim_handle_t mph;
@@ -1454,6 +1570,7 @@ i_dls_devnet_setzid(dls_devnet_t *ddp, zoneid_t new_zoneid, boolean_t setprop)
}
if ((err = dls_link_setzid(ddp->dd_mac, new_zoneid)) == 0) {
ddp->dd_zid = new_zoneid;
+ ddp->dd_transient = transient;
devnet_need_rebuild = B_TRUE;
}
@@ -1468,7 +1585,7 @@ done:
}
int
-dls_devnet_setzid(dls_dl_handle_t ddh, zoneid_t new_zid)
+dls_devnet_setzid(dls_dl_handle_t ddh, zoneid_t new_zid, boolean_t transient)
{
dls_devnet_t *ddp;
int err;
@@ -1490,7 +1607,7 @@ dls_devnet_setzid(dls_dl_handle_t ddh, zoneid_t new_zid)
refheld = B_TRUE;
}
- if ((err = i_dls_devnet_setzid(ddh, new_zid, B_TRUE)) != 0) {
+ if ((err = i_dls_devnet_setzid(ddh, new_zid, B_TRUE, transient)) != 0) {
if (refheld)
dls_devnet_rele(ddp);
return (err);
@@ -1507,7 +1624,7 @@ dls_devnet_setzid(dls_dl_handle_t ddh, zoneid_t new_zid)
if (old_zid != GLOBAL_ZONEID)
dls_devnet_stat_destroy(ddh, old_zid);
if (new_zid != GLOBAL_ZONEID)
- dls_devnet_stat_create(ddh, new_zid);
+ dls_devnet_stat_create(ddh, new_zid, new_zid);
return (0);
}
diff --git a/usr/src/uts/common/io/dls/dls_stat.c b/usr/src/uts/common/io/dls/dls_stat.c
index 51e4be7260..82dceff278 100644
--- a/usr/src/uts/common/io/dls/dls_stat.c
+++ b/usr/src/uts/common/io/dls/dls_stat.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
/*
@@ -30,30 +31,33 @@
#include <sys/dld_impl.h>
#include <sys/mac_ether.h>
-static mac_stat_info_t i_dls_si[] = {
- { MAC_STAT_IFSPEED, "ifspeed", KSTAT_DATA_UINT64, 0 },
- { MAC_STAT_MULTIRCV, "multircv", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_BRDCSTRCV, "brdcstrcv", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_MULTIXMT, "multixmt", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_BRDCSTXMT, "brdcstxmt", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_NORCVBUF, "norcvbuf", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_IERRORS, "ierrors", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_NOXMTBUF, "noxmtbuf", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_OERRORS, "oerrors", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_COLLISIONS, "collisions", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_RBYTES, "rbytes", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_IPACKETS, "ipackets", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_OBYTES, "obytes", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_OPACKETS, "opackets", KSTAT_DATA_UINT32, 0 },
- { MAC_STAT_RBYTES, "rbytes64", KSTAT_DATA_UINT64, 0 },
- { MAC_STAT_IPACKETS, "ipackets64", KSTAT_DATA_UINT64, 0 },
- { MAC_STAT_OBYTES, "obytes64", KSTAT_DATA_UINT64, 0 },
- { MAC_STAT_OPACKETS, "opackets64", KSTAT_DATA_UINT64, 0 },
- { MAC_STAT_LINK_STATE, "link_state", KSTAT_DATA_UINT32,
- (uint64_t)LINK_STATE_UNKNOWN}
-};
-
-#define STAT_INFO_COUNT (sizeof (i_dls_si) / sizeof (i_dls_si[0]))
+/*
+ * structure for link kstats
+ */
+typedef struct {
+ kstat_named_t dk_ifspeed;
+ kstat_named_t dk_multircv;
+ kstat_named_t dk_brdcstrcv;
+ kstat_named_t dk_multixmt;
+ kstat_named_t dk_brdcstxmt;
+ kstat_named_t dk_norcvbuf;
+ kstat_named_t dk_ierrors;
+ kstat_named_t dk_noxmtbuf;
+ kstat_named_t dk_oerrors;
+ kstat_named_t dk_collisions;
+ kstat_named_t dk_rbytes;
+ kstat_named_t dk_ipackets;
+ kstat_named_t dk_obytes;
+ kstat_named_t dk_opackets;
+ kstat_named_t dk_rbytes64;
+ kstat_named_t dk_ipackets64;
+ kstat_named_t dk_obytes64;
+ kstat_named_t dk_opackets64;
+ kstat_named_t dk_link_state;
+ kstat_named_t dk_link_duplex;
+ kstat_named_t dk_unknowns;
+ kstat_named_t dk_zonename;
+} dls_kstat_t;
/*
* Exported functions.
@@ -61,42 +65,54 @@ static mac_stat_info_t i_dls_si[] = {
int
dls_stat_update(kstat_t *ksp, dls_link_t *dlp, int rw)
{
- kstat_named_t *knp;
- uint_t i;
- uint64_t val;
+ dls_kstat_t *dkp = ksp->ks_data;
if (rw != KSTAT_READ)
return (EACCES);
- knp = (kstat_named_t *)ksp->ks_data;
- for (i = 0; i < STAT_INFO_COUNT; i++) {
- val = mac_stat_get(dlp->dl_mh, i_dls_si[i].msi_stat);
-
- switch (i_dls_si[i].msi_type) {
- case KSTAT_DATA_UINT64:
- knp->value.ui64 = val;
- break;
- case KSTAT_DATA_UINT32:
- knp->value.ui32 = (uint32_t)val;
- break;
- default:
- ASSERT(B_FALSE);
- }
-
- knp++;
- }
+ dkp->dk_ifspeed.value.ui64 = mac_stat_get(dlp->dl_mh, MAC_STAT_IFSPEED);
+ dkp->dk_multircv.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_MULTIRCV);
+ dkp->dk_brdcstrcv.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_BRDCSTRCV);
+ dkp->dk_multixmt.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_MULTIXMT);
+ dkp->dk_brdcstxmt.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_BRDCSTXMT);
+ dkp->dk_norcvbuf.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_NORCVBUF);
+ dkp->dk_ierrors.value.ui32 = mac_stat_get(dlp->dl_mh, MAC_STAT_IERRORS);
+ dkp->dk_noxmtbuf.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_NOXMTBUF);
+ dkp->dk_oerrors.value.ui32 = mac_stat_get(dlp->dl_mh, MAC_STAT_OERRORS);
+ dkp->dk_collisions.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_COLLISIONS);
+ dkp->dk_rbytes.value.ui32 = mac_stat_get(dlp->dl_mh, MAC_STAT_RBYTES);
+ dkp->dk_ipackets.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_IPACKETS);
+ dkp->dk_obytes.value.ui32 = mac_stat_get(dlp->dl_mh, MAC_STAT_OBYTES);
+ dkp->dk_opackets.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_OPACKETS);
+ dkp->dk_rbytes64.value.ui64 = mac_stat_get(dlp->dl_mh, MAC_STAT_RBYTES);
+ dkp->dk_ipackets64.value.ui64 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_IPACKETS);
+ dkp->dk_obytes64.value.ui64 = mac_stat_get(dlp->dl_mh, MAC_STAT_OBYTES);
+ dkp->dk_opackets64.value.ui64 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_OPACKETS);
+ dkp->dk_link_state.value.ui32 = mac_stat_get(dlp->dl_mh,
+ MAC_STAT_LINK_STATE);
/*
* Ethernet specific kstat "link_duplex"
*/
if (dlp->dl_mip->mi_nativemedia != DL_ETHER) {
- knp->value.ui32 = LINK_DUPLEX_UNKNOWN;
+ dkp->dk_link_duplex.value.ui32 = LINK_DUPLEX_UNKNOWN;
} else {
- val = mac_stat_get(dlp->dl_mh, ETHER_STAT_LINK_DUPLEX);
- knp->value.ui32 = (uint32_t)val;
+ dkp->dk_link_duplex.value.ui32 =
+ (uint32_t)mac_stat_get(dlp->dl_mh, ETHER_STAT_LINK_DUPLEX);
}
- knp++;
- knp->value.ui32 = dlp->dl_unknowns;
+
+ dkp->dk_unknowns.value.ui32 = dlp->dl_unknowns;
return (0);
}
@@ -104,30 +120,66 @@ dls_stat_update(kstat_t *ksp, dls_link_t *dlp, int rw)
int
dls_stat_create(const char *module, int instance, const char *name,
zoneid_t zoneid, int (*update)(struct kstat *, int), void *private,
- kstat_t **kspp)
+ kstat_t **kspp, zoneid_t newzoneid)
{
kstat_t *ksp;
- kstat_named_t *knp;
- uint_t i;
+ zone_t *zone;
+ dls_kstat_t *dkp;
if ((ksp = kstat_create_zone(module, instance, name, "net",
- KSTAT_TYPE_NAMED, STAT_INFO_COUNT + 2, 0, zoneid)) == NULL) {
+ KSTAT_TYPE_NAMED, sizeof (dls_kstat_t) / sizeof (kstat_named_t),
+ KSTAT_FLAG_VIRTUAL, zoneid)) == NULL) {
return (EINVAL);
}
ksp->ks_update = update;
ksp->ks_private = private;
+ dkp = ksp->ks_data = kmem_zalloc(sizeof (dls_kstat_t), KM_SLEEP);
+ if ((zone = zone_find_by_id(newzoneid)) != NULL) {
+ ksp->ks_data_size += strlen(zone->zone_name) + 1;
+ }
- knp = (kstat_named_t *)ksp->ks_data;
- for (i = 0; i < STAT_INFO_COUNT; i++) {
- kstat_named_init(knp, i_dls_si[i].msi_name,
- i_dls_si[i].msi_type);
- knp++;
+ kstat_named_init(&dkp->dk_ifspeed, "ifspeed", KSTAT_DATA_UINT64);
+ kstat_named_init(&dkp->dk_multircv, "multircv", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_brdcstrcv, "brdcstrcv", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_multixmt, "multixmt", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_brdcstxmt, "brdcstxmt", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_norcvbuf, "norcvbuf", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_ierrors, "ierrors", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_noxmtbuf, "noxmtbuf", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_oerrors, "oerrors", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_collisions, "collisions", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_rbytes, "rbytes", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_ipackets, "ipackets", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_obytes, "obytes", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_opackets, "opackets", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_rbytes64, "rbytes64", KSTAT_DATA_UINT64);
+ kstat_named_init(&dkp->dk_ipackets64, "ipackets64", KSTAT_DATA_UINT64);
+ kstat_named_init(&dkp->dk_obytes64, "obytes64", KSTAT_DATA_UINT64);
+ kstat_named_init(&dkp->dk_opackets64, "opackets64", KSTAT_DATA_UINT64);
+ kstat_named_init(&dkp->dk_link_state, "link_state", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_link_duplex, "link_duplex",
+ KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_unknowns, "unknowns", KSTAT_DATA_UINT32);
+ kstat_named_init(&dkp->dk_zonename, "zonename", KSTAT_DATA_STRING);
+
+ if (zone != NULL) {
+ kstat_named_setstr(&dkp->dk_zonename, zone->zone_name);
+ zone_rele(zone);
}
- kstat_named_init(knp++, "link_duplex", KSTAT_DATA_UINT32);
- kstat_named_init(knp, "unknowns", KSTAT_DATA_UINT32);
kstat_install(ksp);
*kspp = ksp;
return (0);
}
+
+void
+dls_stat_delete(kstat_t *ksp)
+{
+ void *data;
+ if (ksp != NULL) {
+ data = ksp->ks_data;
+ kstat_delete(ksp);
+ kmem_free(data, sizeof (dls_kstat_t));
+ }
+}
diff --git a/usr/src/uts/common/io/dr_sas/THIRDPARTYLICENSE b/usr/src/uts/common/io/dr_sas/THIRDPARTYLICENSE
new file mode 100644
index 0000000000..00aefb6f51
--- /dev/null
+++ b/usr/src/uts/common/io/dr_sas/THIRDPARTYLICENSE
@@ -0,0 +1,32 @@
+/*
+ * MegaRAID device driver for SAS2.0 controllers
+ * Copyright (c) 2009, LSI Logic Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
diff --git a/usr/src/uts/common/io/dr_sas/THIRDPARTYLICENSE.descrip b/usr/src/uts/common/io/dr_sas/THIRDPARTYLICENSE.descrip
new file mode 100644
index 0000000000..ac6d2d1b15
--- /dev/null
+++ b/usr/src/uts/common/io/dr_sas/THIRDPARTYLICENSE.descrip
@@ -0,0 +1 @@
+DR_SAS DRIVER
diff --git a/usr/src/uts/common/io/dr_sas/dr_sas.c b/usr/src/uts/common/io/dr_sas/dr_sas.c
new file mode 100644
index 0000000000..5b1dc82938
--- /dev/null
+++ b/usr/src/uts/common/io/dr_sas/dr_sas.c
@@ -0,0 +1,5506 @@
+/*
+ * dr_sas.c: source for dr_sas driver
+ *
+ * MegaRAID device driver for SAS2.0 controllers
+ * Copyright (c) 2008-2009, LSI Logic Corporation.
+ * All rights reserved.
+ *
+ * Version:
+ * Author:
+ * Arun Chandrashekhar
+ * Manju R
+ * Rajesh Prabhakaran
+ * Seokmann Ju
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/errno.h>
+#include <sys/open.h>
+#include <sys/cred.h>
+#include <sys/modctl.h>
+#include <sys/conf.h>
+#include <sys/devops.h>
+#include <sys/cmn_err.h>
+#include <sys/kmem.h>
+#include <sys/stat.h>
+#include <sys/mkdev.h>
+#include <sys/pci.h>
+#include <sys/scsi/scsi.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/atomic.h>
+#include <sys/signal.h>
+#include <sys/fs/dv_node.h> /* devfs_clean */
+
+#include "dr_sas.h"
+
+/*
+ * FMA header files
+ */
+#include <sys/ddifm.h>
+#include <sys/fm/protocol.h>
+#include <sys/fm/util.h>
+#include <sys/fm/io/ddi.h>
+
+/*
+ * Local static data
+ */
+static void *drsas_state = NULL;
+static int debug_level_g = CL_NONE;
+
+#pragma weak scsi_hba_open
+#pragma weak scsi_hba_close
+#pragma weak scsi_hba_ioctl
+
+static ddi_dma_attr_t drsas_generic_dma_attr = {
+ DMA_ATTR_V0, /* dma_attr_version */
+ 0, /* low DMA address range */
+ 0xFFFFFFFFU, /* high DMA address range */
+ 0xFFFFFFFFU, /* DMA counter register */
+ 8, /* DMA address alignment */
+ 0x07, /* DMA burstsizes */
+ 1, /* min DMA size */
+ 0xFFFFFFFFU, /* max DMA size */
+ 0xFFFFFFFFU, /* segment boundary */
+ DRSAS_MAX_SGE_CNT, /* dma_attr_sglen */
+ 512, /* granularity of device */
+ 0 /* bus specific DMA flags */
+};
+
+int32_t drsas_max_cap_maxxfer = 0x1000000;
+
+/*
+ * cb_ops contains base level routines
+ */
+static struct cb_ops drsas_cb_ops = {
+ drsas_open, /* open */
+ drsas_close, /* close */
+ nodev, /* strategy */
+ nodev, /* print */
+ nodev, /* dump */
+ nodev, /* read */
+ nodev, /* write */
+ drsas_ioctl, /* ioctl */
+ nodev, /* devmap */
+ nodev, /* mmap */
+ nodev, /* segmap */
+ nochpoll, /* poll */
+ nodev, /* cb_prop_op */
+ 0, /* streamtab */
+ D_NEW | D_HOTPLUG, /* cb_flag */
+ CB_REV, /* cb_rev */
+ nodev, /* cb_aread */
+ nodev /* cb_awrite */
+};
+
+/*
+ * dev_ops contains configuration routines
+ */
+static struct dev_ops drsas_ops = {
+ DEVO_REV, /* rev, */
+ 0, /* refcnt */
+ drsas_getinfo, /* getinfo */
+ nulldev, /* identify */
+ nulldev, /* probe */
+ drsas_attach, /* attach */
+ drsas_detach, /* detach */
+ drsas_reset, /* reset */
+ &drsas_cb_ops, /* char/block ops */
+ NULL, /* bus ops */
+ NULL, /* power */
+ ddi_quiesce_not_supported, /* quiesce */
+};
+
+char _depends_on[] = "misc/scsi";
+
+static struct modldrv modldrv = {
+ &mod_driverops, /* module type - driver */
+ DRSAS_VERSION,
+ &drsas_ops, /* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+ MODREV_1, /* ml_rev - must be MODREV_1 */
+ &modldrv, /* ml_linkage */
+ NULL /* end of driver linkage */
+};
+
+static struct ddi_device_acc_attr endian_attr = {
+ DDI_DEVICE_ATTR_V0,
+ DDI_STRUCTURE_LE_ACC,
+ DDI_STRICTORDER_ACC
+};
+
+
+/*
+ * ************************************************************************** *
+ * *
+ * common entry points - for loadable kernel modules *
+ * *
+ * ************************************************************************** *
+ */
+
+int
+_init(void)
+{
+ int ret;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ ret = ddi_soft_state_init(&drsas_state,
+ sizeof (struct drsas_instance), 0);
+
+ if (ret != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN, "dr_sas: could not init state"));
+ return (ret);
+ }
+
+ if ((ret = scsi_hba_init(&modlinkage)) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN, "dr_sas: could not init scsi hba"));
+ ddi_soft_state_fini(&drsas_state);
+ return (ret);
+ }
+
+ ret = mod_install(&modlinkage);
+
+ if (ret != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN, "dr_sas: mod_install failed"));
+ scsi_hba_fini(&modlinkage);
+ ddi_soft_state_fini(&drsas_state);
+ }
+
+ return (ret);
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+ int ret;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ if ((ret = mod_remove(&modlinkage)) != DDI_SUCCESS)
+ return (ret);
+
+ scsi_hba_fini(&modlinkage);
+
+ ddi_soft_state_fini(&drsas_state);
+
+ return (ret);
+}
+
+
+/*
+ * ************************************************************************** *
+ * *
+ * common entry points - for autoconfiguration *
+ * *
+ * ************************************************************************** *
+ */
+
+static int
+drsas_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
+{
+ int instance_no;
+ int nregs;
+ uint8_t added_isr_f = 0;
+ uint8_t added_soft_isr_f = 0;
+ uint8_t create_devctl_node_f = 0;
+ uint8_t create_scsi_node_f = 0;
+ uint8_t create_ioc_node_f = 0;
+ uint8_t tran_alloc_f = 0;
+ uint8_t irq;
+ uint16_t vendor_id;
+ uint16_t device_id;
+ uint16_t subsysvid;
+ uint16_t subsysid;
+ uint16_t command;
+ off_t reglength = 0;
+ int intr_types = 0;
+ char *data;
+ int msi_enable = 0;
+
+ scsi_hba_tran_t *tran;
+ ddi_dma_attr_t tran_dma_attr;
+ struct drsas_instance *instance;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ /* CONSTCOND */
+ ASSERT(NO_COMPETING_THREADS);
+
+ instance_no = ddi_get_instance(dip);
+
+ /*
+ * check to see whether this device is in a DMA-capable slot.
+ */
+ if (ddi_slaveonly(dip) == DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas%d: Device in slave-only slot, unused",
+ instance_no));
+ return (DDI_FAILURE);
+ }
+
+ switch (cmd) {
+ case DDI_ATTACH:
+ con_log(CL_DLEVEL1, (CE_NOTE, "dr_sas: DDI_ATTACH"));
+ /* allocate the soft state for the instance */
+ if (ddi_soft_state_zalloc(drsas_state, instance_no)
+ != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas%d: Failed to allocate soft state",
+ instance_no));
+
+ return (DDI_FAILURE);
+ }
+
+ instance = (struct drsas_instance *)ddi_get_soft_state
+ (drsas_state, instance_no);
+
+ if (instance == NULL) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas%d: Bad soft state", instance_no));
+
+ ddi_soft_state_free(drsas_state, instance_no);
+
+ return (DDI_FAILURE);
+ }
+
+ bzero((caddr_t)instance,
+ sizeof (struct drsas_instance));
+
+ instance->func_ptr = kmem_zalloc(
+ sizeof (struct drsas_func_ptr), KM_SLEEP);
+ ASSERT(instance->func_ptr);
+
+ /* Setup the PCI configuration space handles */
+ if (pci_config_setup(dip, &instance->pci_handle) !=
+ DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas%d: pci config setup failed ",
+ instance_no));
+
+ kmem_free(instance->func_ptr,
+ sizeof (struct drsas_func_ptr));
+ ddi_soft_state_free(drsas_state, instance_no);
+
+ return (DDI_FAILURE);
+ }
+
+ if (ddi_dev_nregs(dip, &nregs) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: failed to get registers."));
+
+ pci_config_teardown(&instance->pci_handle);
+ kmem_free(instance->func_ptr,
+ sizeof (struct drsas_func_ptr));
+ ddi_soft_state_free(drsas_state, instance_no);
+
+ return (DDI_FAILURE);
+ }
+
+ vendor_id = pci_config_get16(instance->pci_handle,
+ PCI_CONF_VENID);
+ device_id = pci_config_get16(instance->pci_handle,
+ PCI_CONF_DEVID);
+
+ subsysvid = pci_config_get16(instance->pci_handle,
+ PCI_CONF_SUBVENID);
+ subsysid = pci_config_get16(instance->pci_handle,
+ PCI_CONF_SUBSYSID);
+
+ pci_config_put16(instance->pci_handle, PCI_CONF_COMM,
+ (pci_config_get16(instance->pci_handle,
+ PCI_CONF_COMM) | PCI_COMM_ME));
+ irq = pci_config_get8(instance->pci_handle,
+ PCI_CONF_ILINE);
+
+ con_log(CL_DLEVEL1, (CE_CONT, "dr_sas%d: "
+ "0x%x:0x%x 0x%x:0x%x, irq:%d drv-ver:%s",
+ instance_no, vendor_id, device_id, subsysvid,
+ subsysid, irq, DRSAS_VERSION));
+
+ /* enable bus-mastering */
+ command = pci_config_get16(instance->pci_handle,
+ PCI_CONF_COMM);
+
+ if (!(command & PCI_COMM_ME)) {
+ command |= PCI_COMM_ME;
+
+ pci_config_put16(instance->pci_handle,
+ PCI_CONF_COMM, command);
+
+ con_log(CL_ANN, (CE_CONT, "dr_sas%d: "
+ "enable bus-mastering", instance_no));
+ } else {
+ con_log(CL_DLEVEL1, (CE_CONT, "dr_sas%d: "
+ "bus-mastering already set", instance_no));
+ }
+
+ /* initialize function pointers */
+ if ((device_id == PCI_DEVICE_ID_LSI_2108VDE) ||
+ (device_id == PCI_DEVICE_ID_LSI_2108V)) {
+ con_log(CL_DLEVEL1, (CE_CONT, "dr_sas%d: "
+ "2108V/DE detected", instance_no));
+ instance->func_ptr->read_fw_status_reg =
+ read_fw_status_reg_ppc;
+ instance->func_ptr->issue_cmd = issue_cmd_ppc;
+ instance->func_ptr->issue_cmd_in_sync_mode =
+ issue_cmd_in_sync_mode_ppc;
+ instance->func_ptr->issue_cmd_in_poll_mode =
+ issue_cmd_in_poll_mode_ppc;
+ instance->func_ptr->enable_intr =
+ enable_intr_ppc;
+ instance->func_ptr->disable_intr =
+ disable_intr_ppc;
+ instance->func_ptr->intr_ack = intr_ack_ppc;
+ } else {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: Invalid device detected"));
+
+ pci_config_teardown(&instance->pci_handle);
+ kmem_free(instance->func_ptr,
+ sizeof (struct drsas_func_ptr));
+ ddi_soft_state_free(drsas_state, instance_no);
+
+ return (DDI_FAILURE);
+ }
+
+ instance->baseaddress = pci_config_get32(
+ instance->pci_handle, PCI_CONF_BASE0);
+ instance->baseaddress &= 0x0fffc;
+
+ instance->dip = dip;
+ instance->vendor_id = vendor_id;
+ instance->device_id = device_id;
+ instance->subsysvid = subsysvid;
+ instance->subsysid = subsysid;
+ instance->instance = instance_no;
+
+ /* Initialize FMA */
+ instance->fm_capabilities = ddi_prop_get_int(
+ DDI_DEV_T_ANY, instance->dip, DDI_PROP_DONTPASS,
+ "fm-capable", DDI_FM_EREPORT_CAPABLE |
+ DDI_FM_ACCCHK_CAPABLE | DDI_FM_DMACHK_CAPABLE
+ | DDI_FM_ERRCB_CAPABLE);
+
+ drsas_fm_init(instance);
+
+ /* Initialize Interrupts */
+ if ((ddi_dev_regsize(instance->dip,
+ REGISTER_SET_IO_2108, &reglength) != DDI_SUCCESS) ||
+ reglength < MINIMUM_MFI_MEM_SZ) {
+ return (DDI_FAILURE);
+ }
+ if (reglength > DEFAULT_MFI_MEM_SZ) {
+ reglength = DEFAULT_MFI_MEM_SZ;
+ con_log(CL_DLEVEL1, (CE_NOTE,
+ "dr_sas: register length to map is "
+ "0x%lx bytes", reglength));
+ }
+ if (ddi_regs_map_setup(instance->dip,
+ REGISTER_SET_IO_2108, &instance->regmap, 0,
+ reglength, &endian_attr, &instance->regmap_handle)
+ != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: couldn't map control registers"));
+ goto fail_attach;
+ }
+
+ /*
+ * Disable Interrupt Now.
+ * Setup Software interrupt
+ */
+ instance->func_ptr->disable_intr(instance);
+
+ msi_enable = 0;
+ if (ddi_prop_lookup_string(DDI_DEV_T_ANY, dip, 0,
+ "drsas-enable-msi", &data) == DDI_SUCCESS) {
+ if (strncmp(data, "yes", 3) == 0) {
+ msi_enable = 1;
+ con_log(CL_ANN, (CE_WARN,
+ "msi_enable = %d ENABLED",
+ msi_enable));
+ }
+ ddi_prop_free(data);
+ }
+
+ con_log(CL_DLEVEL1, (CE_WARN, "msi_enable = %d",
+ msi_enable));
+
+ /* Check for all supported interrupt types */
+ if (ddi_intr_get_supported_types(
+ dip, &intr_types) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "ddi_intr_get_supported_types() failed"));
+ goto fail_attach;
+ }
+
+ con_log(CL_DLEVEL1, (CE_NOTE,
+ "ddi_intr_get_supported_types() ret: 0x%x",
+ intr_types));
+
+ /* Initialize and Setup Interrupt handler */
+ if (msi_enable && (intr_types & DDI_INTR_TYPE_MSIX)) {
+ if (drsas_add_intrs(instance,
+ DDI_INTR_TYPE_MSIX) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "MSIX interrupt query failed"));
+ goto fail_attach;
+ }
+ instance->intr_type = DDI_INTR_TYPE_MSIX;
+ } else if (msi_enable && (intr_types &
+ DDI_INTR_TYPE_MSI)) {
+ if (drsas_add_intrs(instance,
+ DDI_INTR_TYPE_MSI) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "MSI interrupt query failed"));
+ goto fail_attach;
+ }
+ instance->intr_type = DDI_INTR_TYPE_MSI;
+ } else if (intr_types & DDI_INTR_TYPE_FIXED) {
+ msi_enable = 0;
+ if (drsas_add_intrs(instance,
+ DDI_INTR_TYPE_FIXED) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "FIXED interrupt query failed"));
+ goto fail_attach;
+ }
+ instance->intr_type = DDI_INTR_TYPE_FIXED;
+ } else {
+ con_log(CL_ANN, (CE_WARN, "Device cannot "
+ "suppport either FIXED or MSI/X "
+ "interrupts"));
+ goto fail_attach;
+ }
+
+ added_isr_f = 1;
+
+ /* setup the mfi based low level driver */
+ if (init_mfi(instance) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN, "dr_sas: "
+ "could not initialize the low level driver"));
+
+ goto fail_attach;
+ }
+
+ /* Initialize all Mutex */
+ INIT_LIST_HEAD(&instance->completed_pool_list);
+ mutex_init(&instance->completed_pool_mtx,
+ "completed_pool_mtx", MUTEX_DRIVER,
+ DDI_INTR_PRI(instance->intr_pri));
+
+ mutex_init(&instance->int_cmd_mtx, "int_cmd_mtx",
+ MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
+ cv_init(&instance->int_cmd_cv, NULL, CV_DRIVER, NULL);
+
+ mutex_init(&instance->cmd_pool_mtx, "cmd_pool_mtx",
+ MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
+
+ /* Register our soft-isr for highlevel interrupts. */
+ instance->isr_level = instance->intr_pri;
+ if (instance->isr_level == HIGH_LEVEL_INTR) {
+ if (ddi_add_softintr(dip, DDI_SOFTINT_HIGH,
+ &instance->soft_intr_id, NULL, NULL,
+ drsas_softintr, (caddr_t)instance) !=
+ DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ " Software ISR did not register"));
+
+ goto fail_attach;
+ }
+
+ added_soft_isr_f = 1;
+ }
+
+ /* Allocate a transport structure */
+ tran = scsi_hba_tran_alloc(dip, SCSI_HBA_CANSLEEP);
+
+ if (tran == NULL) {
+ con_log(CL_ANN, (CE_WARN,
+ "scsi_hba_tran_alloc failed"));
+ goto fail_attach;
+ }
+
+ tran_alloc_f = 1;
+
+ instance->tran = tran;
+
+ tran->tran_hba_private = instance;
+ tran->tran_tgt_init = drsas_tran_tgt_init;
+ tran->tran_tgt_probe = scsi_hba_probe;
+ tran->tran_tgt_free = drsas_tran_tgt_free;
+ tran->tran_init_pkt = drsas_tran_init_pkt;
+ tran->tran_start = drsas_tran_start;
+ tran->tran_abort = drsas_tran_abort;
+ tran->tran_reset = drsas_tran_reset;
+ tran->tran_getcap = drsas_tran_getcap;
+ tran->tran_setcap = drsas_tran_setcap;
+ tran->tran_destroy_pkt = drsas_tran_destroy_pkt;
+ tran->tran_dmafree = drsas_tran_dmafree;
+ tran->tran_sync_pkt = drsas_tran_sync_pkt;
+ tran->tran_bus_config = drsas_tran_bus_config;
+
+ tran_dma_attr = drsas_generic_dma_attr;
+ tran_dma_attr.dma_attr_sgllen = instance->max_num_sge;
+
+ /* Attach this instance of the hba */
+ if (scsi_hba_attach_setup(dip, &tran_dma_attr, tran, 0)
+ != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "scsi_hba_attach failed"));
+
+ goto fail_attach;
+ }
+
+ /* create devctl node for cfgadm command */
+ if (ddi_create_minor_node(dip, "devctl",
+ S_IFCHR, INST2DEVCTL(instance_no),
+ DDI_NT_SCSI_NEXUS, 0) == DDI_FAILURE) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: failed to create devctl node."));
+
+ goto fail_attach;
+ }
+
+ create_devctl_node_f = 1;
+
+ /* create scsi node for cfgadm command */
+ if (ddi_create_minor_node(dip, "scsi", S_IFCHR,
+ INST2SCSI(instance_no),
+ DDI_NT_SCSI_ATTACHMENT_POINT, 0) ==
+ DDI_FAILURE) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: failed to create scsi node."));
+
+ goto fail_attach;
+ }
+
+ create_scsi_node_f = 1;
+
+ (void) sprintf(instance->iocnode, "%d:lsirdctl",
+ instance_no);
+
+ /*
+ * Create a node for applications
+ * for issuing ioctl to the driver.
+ */
+ if (ddi_create_minor_node(dip, instance->iocnode,
+ S_IFCHR, INST2LSIRDCTL(instance_no),
+ DDI_PSEUDO, 0) == DDI_FAILURE) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: failed to create ioctl node."));
+
+ goto fail_attach;
+ }
+
+ create_ioc_node_f = 1;
+
+ /* Create a taskq to handle dr events */
+ if ((instance->taskq = ddi_taskq_create(dip,
+ "drsas_dr_taskq", 1,
+ TASKQ_DEFAULTPRI, 0)) == NULL) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: failed to create taskq "));
+ instance->taskq = NULL;
+ goto fail_attach;
+ }
+
+ /* enable interrupt */
+ instance->func_ptr->enable_intr(instance);
+
+ /* initiate AEN */
+ if (start_mfi_aen(instance)) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: failed to initiate AEN."));
+ goto fail_initiate_aen;
+ }
+
+ con_log(CL_DLEVEL1, (CE_NOTE,
+ "AEN started for instance %d.", instance_no));
+
+ /* Finally! We are on the air. */
+ ddi_report_dev(dip);
+
+ if (drsas_check_acc_handle(instance->regmap_handle) !=
+ DDI_SUCCESS) {
+ goto fail_attach;
+ }
+ if (drsas_check_acc_handle(instance->pci_handle) !=
+ DDI_SUCCESS) {
+ goto fail_attach;
+ }
+ instance->dr_ld_list =
+ kmem_zalloc(MRDRV_MAX_LD * sizeof (struct drsas_ld),
+ KM_SLEEP);
+ break;
+ case DDI_PM_RESUME:
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: DDI_PM_RESUME"));
+ break;
+ case DDI_RESUME:
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: DDI_RESUME"));
+ break;
+ default:
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: invalid attach cmd=%x", cmd));
+ return (DDI_FAILURE);
+ }
+
+ return (DDI_SUCCESS);
+
+fail_initiate_aen:
+fail_attach:
+ if (create_devctl_node_f) {
+ ddi_remove_minor_node(dip, "devctl");
+ }
+
+ if (create_scsi_node_f) {
+ ddi_remove_minor_node(dip, "scsi");
+ }
+
+ if (create_ioc_node_f) {
+ ddi_remove_minor_node(dip, instance->iocnode);
+ }
+
+ if (tran_alloc_f) {
+ scsi_hba_tran_free(tran);
+ }
+
+
+ if (added_soft_isr_f) {
+ ddi_remove_softintr(instance->soft_intr_id);
+ }
+
+ if (added_isr_f) {
+ drsas_rem_intrs(instance);
+ }
+
+ if (instance && instance->taskq) {
+ ddi_taskq_destroy(instance->taskq);
+ }
+
+ drsas_fm_ereport(instance, DDI_FM_DEVICE_NO_RESPONSE);
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_LOST);
+
+ drsas_fm_fini(instance);
+
+ pci_config_teardown(&instance->pci_handle);
+
+ ddi_soft_state_free(drsas_state, instance_no);
+
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: return failure from drsas_attach"));
+
+ return (DDI_FAILURE);
+}
+
+/*ARGSUSED*/
+static int
+drsas_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **resultp)
+{
+ int rval;
+ int drsas_minor = getminor((dev_t)arg);
+
+ struct drsas_instance *instance;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ switch (cmd) {
+ case DDI_INFO_DEVT2DEVINFO:
+ instance = (struct drsas_instance *)
+ ddi_get_soft_state(drsas_state,
+ MINOR2INST(drsas_minor));
+
+ if (instance == NULL) {
+ *resultp = NULL;
+ rval = DDI_FAILURE;
+ } else {
+ *resultp = instance->dip;
+ rval = DDI_SUCCESS;
+ }
+ break;
+ case DDI_INFO_DEVT2INSTANCE:
+ *resultp = (void *)instance;
+ rval = DDI_SUCCESS;
+ break;
+ default:
+ *resultp = NULL;
+ rval = DDI_FAILURE;
+ }
+
+ return (rval);
+}
+
+static int
+drsas_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
+{
+ int instance_no;
+
+ struct drsas_instance *instance;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ /* CONSTCOND */
+ ASSERT(NO_COMPETING_THREADS);
+
+ instance_no = ddi_get_instance(dip);
+
+ instance = (struct drsas_instance *)ddi_get_soft_state(drsas_state,
+ instance_no);
+
+ if (!instance) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas:%d could not get instance in detach",
+ instance_no));
+
+ return (DDI_FAILURE);
+ }
+
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas%d: detaching device 0x%4x:0x%4x:0x%4x:0x%4x",
+ instance_no, instance->vendor_id, instance->device_id,
+ instance->subsysvid, instance->subsysid));
+
+ switch (cmd) {
+ case DDI_DETACH:
+ con_log(CL_ANN, (CE_NOTE,
+ "drsas_detach: DDI_DETACH"));
+
+ if (scsi_hba_detach(dip) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas:%d failed to detach",
+ instance_no));
+
+ return (DDI_FAILURE);
+ }
+
+ scsi_hba_tran_free(instance->tran);
+
+ flush_cache(instance);
+
+ if (abort_aen_cmd(instance, instance->aen_cmd)) {
+ con_log(CL_ANN, (CE_WARN, "drsas_detach: "
+ "failed to abort prevous AEN command"));
+
+ return (DDI_FAILURE);
+ }
+
+ instance->func_ptr->disable_intr(instance);
+
+ if (instance->isr_level == HIGH_LEVEL_INTR) {
+ ddi_remove_softintr(instance->soft_intr_id);
+ }
+
+ drsas_rem_intrs(instance);
+
+ if (instance->taskq) {
+ ddi_taskq_destroy(instance->taskq);
+ }
+ kmem_free(instance->dr_ld_list, MRDRV_MAX_LD
+ * sizeof (struct drsas_ld));
+ free_space_for_mfi(instance);
+
+ drsas_fm_fini(instance);
+
+ pci_config_teardown(&instance->pci_handle);
+
+ kmem_free(instance->func_ptr,
+ sizeof (struct drsas_func_ptr));
+
+ ddi_soft_state_free(drsas_state, instance_no);
+ break;
+ case DDI_PM_SUSPEND:
+ con_log(CL_ANN, (CE_NOTE,
+ "drsas_detach: DDI_PM_SUSPEND"));
+
+ break;
+ case DDI_SUSPEND:
+ con_log(CL_ANN, (CE_NOTE,
+ "drsas_detach: DDI_SUSPEND"));
+
+ break;
+ default:
+ con_log(CL_ANN, (CE_WARN,
+ "invalid detach command:0x%x", cmd));
+ return (DDI_FAILURE);
+ }
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * ************************************************************************** *
+ * *
+ * common entry points - for character driver types *
+ * *
+ * ************************************************************************** *
+ */
+static int
+drsas_open(dev_t *dev, int openflags, int otyp, cred_t *credp)
+{
+ int rval = 0;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ /* Check root permissions */
+ if (drv_priv(credp) != 0) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: Non-root ioctl access denied!"));
+ return (EPERM);
+ }
+
+ /* Verify we are being opened as a character device */
+ if (otyp != OTYP_CHR) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: ioctl node must be a char node"));
+ return (EINVAL);
+ }
+
+ if (ddi_get_soft_state(drsas_state, MINOR2INST(getminor(*dev)))
+ == NULL) {
+ return (ENXIO);
+ }
+
+ if (scsi_hba_open) {
+ rval = scsi_hba_open(dev, openflags, otyp, credp);
+ }
+
+ return (rval);
+}
+
+static int
+drsas_close(dev_t dev, int openflags, int otyp, cred_t *credp)
+{
+ int rval = 0;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ /* no need for locks! */
+
+ if (scsi_hba_close) {
+ rval = scsi_hba_close(dev, openflags, otyp, credp);
+ }
+
+ return (rval);
+}
+
+static int
+drsas_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp,
+ int *rvalp)
+{
+ int rval = 0;
+
+ struct drsas_instance *instance;
+ struct drsas_ioctl *ioctl;
+ struct drsas_aen aen;
+ int i;
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ instance = ddi_get_soft_state(drsas_state, MINOR2INST(getminor(dev)));
+
+ if (instance == NULL) {
+ /* invalid minor number */
+ con_log(CL_ANN, (CE_WARN, "dr_sas: adapter not found."));
+ return (ENXIO);
+ }
+
+ ioctl = (struct drsas_ioctl *)kmem_zalloc(sizeof (struct drsas_ioctl),
+ KM_SLEEP);
+ ASSERT(ioctl);
+
+ switch ((uint_t)cmd) {
+ case DRSAS_IOCTL_FIRMWARE:
+ for (i = 0; i < sizeof (struct drsas_ioctl); i++) {
+ if (ddi_copyin((uint8_t *)arg+i,
+ (uint8_t *)ioctl+i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN, "drsas_ioctl "
+ "ERROR IOCTL copyin"));
+ kmem_free(ioctl,
+ sizeof (struct drsas_ioctl));
+ return (EFAULT);
+ }
+ }
+ if (ioctl->control_code == DRSAS_DRIVER_IOCTL_COMMON) {
+ rval = handle_drv_ioctl(instance, ioctl, mode);
+ } else {
+ rval = handle_mfi_ioctl(instance, ioctl, mode);
+ }
+ for (i = 0; i < sizeof (struct drsas_ioctl) - 1; i++) {
+ if (ddi_copyout((uint8_t *)ioctl+i,
+ (uint8_t *)arg+i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "drsas_ioctl: ddi_copyout "
+ "failed"));
+ rval = 1;
+ break;
+ }
+ }
+
+ break;
+ case DRSAS_IOCTL_AEN:
+ for (i = 0; i < sizeof (struct drsas_aen); i++) {
+ if (ddi_copyin((uint8_t *)arg+i,
+ (uint8_t *)&aen+i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "drsas_ioctl: "
+ "ERROR AEN copyin"));
+ kmem_free(ioctl,
+ sizeof (struct drsas_ioctl));
+ return (EFAULT);
+ }
+ }
+
+ rval = handle_mfi_aen(instance, &aen);
+ for (i = 0; i < sizeof (struct drsas_aen); i++) {
+ if (ddi_copyout((uint8_t *)&aen + i,
+ (uint8_t *)arg + i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "drsas_ioctl: "
+ "ddi_copyout failed"));
+ rval = 1;
+ break;
+ }
+ }
+
+ break;
+ default:
+ rval = scsi_hba_ioctl(dev, cmd, arg,
+ mode, credp, rvalp);
+
+ con_log(CL_DLEVEL1, (CE_NOTE, "drsas_ioctl: "
+ "scsi_hba_ioctl called, ret = %x.", rval));
+ }
+
+ kmem_free(ioctl, sizeof (struct drsas_ioctl));
+ return (rval);
+}
+
+/*
+ * ************************************************************************** *
+ * *
+ * common entry points - for block driver types *
+ * *
+ * ************************************************************************** *
+ */
+/*ARGSUSED*/
+static int
+drsas_reset(dev_info_t *dip, ddi_reset_cmd_t cmd)
+{
+ int instance_no;
+
+ struct drsas_instance *instance;
+
+ instance_no = ddi_get_instance(dip);
+ instance = (struct drsas_instance *)ddi_get_soft_state
+ (drsas_state, instance_no);
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ if (!instance) {
+ con_log(CL_ANN, (CE_WARN, "dr_sas:%d could not get adapter "
+ "in reset", instance_no));
+ return (DDI_FAILURE);
+ }
+
+ instance->func_ptr->disable_intr(instance);
+
+ con_log(CL_ANN1, (CE_NOTE, "flushing cache for instance %d",
+ instance_no));
+
+ flush_cache(instance);
+
+ return (DDI_SUCCESS);
+}
+
+
+/*
+ * ************************************************************************** *
+ * *
+ * entry points (SCSI HBA) *
+ * *
+ * ************************************************************************** *
+ */
+/*ARGSUSED*/
+static int
+drsas_tran_tgt_init(dev_info_t *hba_dip, dev_info_t *tgt_dip,
+ scsi_hba_tran_t *tran, struct scsi_device *sd)
+{
+ struct drsas_instance *instance;
+ uint16_t tgt = sd->sd_address.a_target;
+ uint8_t lun = sd->sd_address.a_lun;
+
+ con_log(CL_ANN1, (CE_NOTE, "drsas_tgt_init target %d lun %d",
+ tgt, lun));
+
+ instance = ADDR2MR(&sd->sd_address);
+
+ if (ndi_dev_is_persistent_node(tgt_dip) == 0) {
+ (void) ndi_merge_node(tgt_dip, drsas_name_node);
+ ddi_set_name_addr(tgt_dip, NULL);
+
+ con_log(CL_ANN1, (CE_NOTE, "drsas_tgt_init in "
+ "ndi_dev_is_persistent_node DDI_FAILURE t = %d l = %d",
+ tgt, lun));
+ return (DDI_FAILURE);
+ }
+
+ con_log(CL_ANN1, (CE_NOTE, "drsas_tgt_init dev_dip %p tgt_dip %p",
+ (void *)instance->dr_ld_list[tgt].dip, (void *)tgt_dip));
+
+ if (tgt < MRDRV_MAX_LD && lun == 0) {
+ if (instance->dr_ld_list[tgt].dip == NULL &&
+ strcmp(ddi_driver_name(sd->sd_dev), "sd") == 0) {
+ instance->dr_ld_list[tgt].dip = tgt_dip;
+ instance->dr_ld_list[tgt].lun_type = DRSAS_LD_LUN;
+ }
+ }
+ return (DDI_SUCCESS);
+}
+
+/*ARGSUSED*/
+static void
+drsas_tran_tgt_free(dev_info_t *hba_dip, dev_info_t *tgt_dip,
+ scsi_hba_tran_t *hba_tran, struct scsi_device *sd)
+{
+ struct drsas_instance *instance;
+ int tgt = sd->sd_address.a_target;
+ int lun = sd->sd_address.a_lun;
+
+ instance = ADDR2MR(&sd->sd_address);
+
+ con_log(CL_ANN1, (CE_NOTE, "tgt_free t = %d l = %d", tgt, lun));
+
+ if (tgt < MRDRV_MAX_LD && lun == 0) {
+ if (instance->dr_ld_list[tgt].dip == tgt_dip) {
+ instance->dr_ld_list[tgt].dip = NULL;
+ }
+ }
+}
+
+static dev_info_t *
+drsas_find_child(struct drsas_instance *instance, uint16_t tgt, uint8_t lun)
+{
+ dev_info_t *child = NULL;
+ char addr[SCSI_MAXNAMELEN];
+ char tmp[MAXNAMELEN];
+
+ (void) sprintf(addr, "%x,%x", tgt, lun);
+ for (child = ddi_get_child(instance->dip); child;
+ child = ddi_get_next_sibling(child)) {
+
+ if (drsas_name_node(child, tmp, MAXNAMELEN) !=
+ DDI_SUCCESS) {
+ continue;
+ }
+
+ if (strcmp(addr, tmp) == 0) {
+ break;
+ }
+ }
+ con_log(CL_ANN1, (CE_NOTE, "drsas_find_child: return child = %p",
+ (void *)child));
+ return (child);
+}
+
+static int
+drsas_name_node(dev_info_t *dip, char *name, int len)
+{
+ int tgt, lun;
+
+ tgt = ddi_prop_get_int(DDI_DEV_T_ANY, dip,
+ DDI_PROP_DONTPASS, "target", -1);
+ con_log(CL_ANN1, (CE_NOTE,
+ "drsas_name_node: dip %p tgt %d", (void *)dip, tgt));
+ if (tgt == -1) {
+ return (DDI_FAILURE);
+ }
+ lun = ddi_prop_get_int(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
+ "lun", -1);
+ con_log(CL_ANN1,
+ (CE_NOTE, "drsas_name_node: tgt %d lun %d", tgt, lun));
+ if (lun == -1) {
+ return (DDI_FAILURE);
+ }
+ (void) snprintf(name, len, "%x,%x", tgt, lun);
+ return (DDI_SUCCESS);
+}
+
+static struct scsi_pkt *
+drsas_tran_init_pkt(struct scsi_address *ap, register struct scsi_pkt *pkt,
+ struct buf *bp, int cmdlen, int statuslen, int tgtlen,
+ int flags, int (*callback)(), caddr_t arg)
+{
+ struct scsa_cmd *acmd;
+ struct drsas_instance *instance;
+ struct scsi_pkt *new_pkt;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ instance = ADDR2MR(ap);
+
+ /* step #1 : pkt allocation */
+ if (pkt == NULL) {
+ pkt = scsi_hba_pkt_alloc(instance->dip, ap, cmdlen, statuslen,
+ tgtlen, sizeof (struct scsa_cmd), callback, arg);
+ if (pkt == NULL) {
+ return (NULL);
+ }
+
+ acmd = PKT2CMD(pkt);
+
+ /*
+ * Initialize the new pkt - we redundantly initialize
+ * all the fields for illustrative purposes.
+ */
+ acmd->cmd_pkt = pkt;
+ acmd->cmd_flags = 0;
+ acmd->cmd_scblen = statuslen;
+ acmd->cmd_cdblen = cmdlen;
+ acmd->cmd_dmahandle = NULL;
+ acmd->cmd_ncookies = 0;
+ acmd->cmd_cookie = 0;
+ acmd->cmd_cookiecnt = 0;
+ acmd->cmd_nwin = 0;
+
+ pkt->pkt_address = *ap;
+ pkt->pkt_comp = (void (*)())NULL;
+ pkt->pkt_flags = 0;
+ pkt->pkt_time = 0;
+ pkt->pkt_resid = 0;
+ pkt->pkt_state = 0;
+ pkt->pkt_statistics = 0;
+ pkt->pkt_reason = 0;
+ new_pkt = pkt;
+ } else {
+ acmd = PKT2CMD(pkt);
+ new_pkt = NULL;
+ }
+
+ /* step #2 : dma allocation/move */
+ if (bp && bp->b_bcount != 0) {
+ if (acmd->cmd_dmahandle == NULL) {
+ if (drsas_dma_alloc(instance, pkt, bp, flags,
+ callback) == DDI_FAILURE) {
+ if (new_pkt) {
+ scsi_hba_pkt_free(ap, new_pkt);
+ }
+ return ((struct scsi_pkt *)NULL);
+ }
+ } else {
+ if (drsas_dma_move(instance, pkt, bp) == DDI_FAILURE) {
+ return ((struct scsi_pkt *)NULL);
+ }
+ }
+ }
+
+ return (pkt);
+}
+
+static int
+drsas_tran_start(struct scsi_address *ap, register struct scsi_pkt *pkt)
+{
+ uchar_t cmd_done = 0;
+
+ struct drsas_instance *instance = ADDR2MR(ap);
+ struct drsas_cmd *cmd;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d:SCSI CDB[0]=0x%x",
+ __func__, __LINE__, pkt->pkt_cdbp[0]));
+
+ pkt->pkt_reason = CMD_CMPLT;
+ *pkt->pkt_scbp = STATUS_GOOD; /* clear arq scsi_status */
+
+ cmd = build_cmd(instance, ap, pkt, &cmd_done);
+
+ /*
+ * Check if the command is already completed by the drsas_build_cmd()
+ * routine. In which case the busy_flag would be clear and scb will be
+ * NULL and appropriate reason provided in pkt_reason field
+ */
+ if (cmd_done) {
+ pkt->pkt_reason = CMD_CMPLT;
+ pkt->pkt_scbp[0] = STATUS_GOOD;
+ pkt->pkt_state |= STATE_GOT_BUS | STATE_GOT_TARGET
+ | STATE_SENT_CMD;
+ if (((pkt->pkt_flags & FLAG_NOINTR) == 0) && pkt->pkt_comp) {
+ (*pkt->pkt_comp)(pkt);
+ }
+
+ return (TRAN_ACCEPT);
+ }
+
+ if (cmd == NULL) {
+ return (TRAN_BUSY);
+ }
+
+ if ((pkt->pkt_flags & FLAG_NOINTR) == 0) {
+ if (instance->fw_outstanding > instance->max_fw_cmds) {
+ con_log(CL_ANN, (CE_CONT, "dr_sas:Firmware busy"));
+ return_mfi_pkt(instance, cmd);
+ return (TRAN_BUSY);
+ }
+
+ /* Synchronize the Cmd frame for the controller */
+ (void) ddi_dma_sync(cmd->frame_dma_obj.dma_handle, 0, 0,
+ DDI_DMA_SYNC_FORDEV);
+
+ instance->func_ptr->issue_cmd(cmd, instance);
+
+ } else {
+ struct drsas_header *hdr = &cmd->frame->hdr;
+
+ cmd->sync_cmd = DRSAS_TRUE;
+
+ instance->func_ptr-> issue_cmd_in_poll_mode(instance, cmd);
+
+ pkt->pkt_reason = CMD_CMPLT;
+ pkt->pkt_statistics = 0;
+ pkt->pkt_state |= STATE_XFERRED_DATA | STATE_GOT_STATUS;
+
+ switch (ddi_get8(cmd->frame_dma_obj.acc_handle,
+ &hdr->cmd_status)) {
+ case MFI_STAT_OK:
+ pkt->pkt_scbp[0] = STATUS_GOOD;
+ break;
+
+ case MFI_STAT_SCSI_DONE_WITH_ERROR:
+
+ pkt->pkt_reason = CMD_CMPLT;
+ pkt->pkt_statistics = 0;
+
+ ((struct scsi_status *)pkt->pkt_scbp)->sts_chk = 1;
+ break;
+
+ case MFI_STAT_DEVICE_NOT_FOUND:
+ pkt->pkt_reason = CMD_DEV_GONE;
+ pkt->pkt_statistics = STAT_DISCON;
+ break;
+
+ default:
+ ((struct scsi_status *)pkt->pkt_scbp)->sts_busy = 1;
+ }
+
+ return_mfi_pkt(instance, cmd);
+ (void) drsas_common_check(instance, cmd);
+
+ if (pkt->pkt_comp) {
+ (*pkt->pkt_comp)(pkt);
+ }
+
+ }
+
+ return (TRAN_ACCEPT);
+}
+
+/*ARGSUSED*/
+static int
+drsas_tran_abort(struct scsi_address *ap, struct scsi_pkt *pkt)
+{
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ /* abort command not supported by H/W */
+
+ return (DDI_FAILURE);
+}
+
+/*ARGSUSED*/
+static int
+drsas_tran_reset(struct scsi_address *ap, int level)
+{
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ /* reset command not supported by H/W */
+
+ return (DDI_FAILURE);
+
+}
+
+/*ARGSUSED*/
+static int
+drsas_tran_getcap(struct scsi_address *ap, char *cap, int whom)
+{
+ int rval = 0;
+
+ struct drsas_instance *instance = ADDR2MR(ap);
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ /* we do allow inquiring about capabilities for other targets */
+ if (cap == NULL) {
+ return (-1);
+ }
+
+ switch (scsi_hba_lookup_capstr(cap)) {
+ case SCSI_CAP_DMA_MAX:
+ /* Limit to 16MB max transfer */
+ rval = drsas_max_cap_maxxfer;
+ break;
+ case SCSI_CAP_MSG_OUT:
+ rval = 1;
+ break;
+ case SCSI_CAP_DISCONNECT:
+ rval = 0;
+ break;
+ case SCSI_CAP_SYNCHRONOUS:
+ rval = 0;
+ break;
+ case SCSI_CAP_WIDE_XFER:
+ rval = 1;
+ break;
+ case SCSI_CAP_TAGGED_QING:
+ rval = 1;
+ break;
+ case SCSI_CAP_UNTAGGED_QING:
+ rval = 1;
+ break;
+ case SCSI_CAP_PARITY:
+ rval = 1;
+ break;
+ case SCSI_CAP_INITIATOR_ID:
+ rval = instance->init_id;
+ break;
+ case SCSI_CAP_ARQ:
+ rval = 1;
+ break;
+ case SCSI_CAP_LINKED_CMDS:
+ rval = 0;
+ break;
+ case SCSI_CAP_RESET_NOTIFICATION:
+ rval = 1;
+ break;
+ case SCSI_CAP_GEOMETRY:
+ rval = -1;
+
+ break;
+ default:
+ con_log(CL_DLEVEL2, (CE_NOTE, "Default cap coming 0x%x",
+ scsi_hba_lookup_capstr(cap)));
+ rval = -1;
+ break;
+ }
+
+ return (rval);
+}
+
+/*ARGSUSED*/
+static int
+drsas_tran_setcap(struct scsi_address *ap, char *cap, int value, int whom)
+{
+ int rval = 1;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ /* We don't allow setting capabilities for other targets */
+ if (cap == NULL || whom == 0) {
+ return (-1);
+ }
+
+ switch (scsi_hba_lookup_capstr(cap)) {
+ case SCSI_CAP_DMA_MAX:
+ case SCSI_CAP_MSG_OUT:
+ case SCSI_CAP_PARITY:
+ case SCSI_CAP_LINKED_CMDS:
+ case SCSI_CAP_RESET_NOTIFICATION:
+ case SCSI_CAP_DISCONNECT:
+ case SCSI_CAP_SYNCHRONOUS:
+ case SCSI_CAP_UNTAGGED_QING:
+ case SCSI_CAP_WIDE_XFER:
+ case SCSI_CAP_INITIATOR_ID:
+ case SCSI_CAP_ARQ:
+ /*
+ * None of these are settable via
+ * the capability interface.
+ */
+ break;
+ case SCSI_CAP_TAGGED_QING:
+ rval = 1;
+ break;
+ case SCSI_CAP_SECTOR_SIZE:
+ rval = 1;
+ break;
+
+ case SCSI_CAP_TOTAL_SECTORS:
+ rval = 1;
+ break;
+ default:
+ rval = -1;
+ break;
+ }
+
+ return (rval);
+}
+
+static void
+drsas_tran_destroy_pkt(struct scsi_address *ap, struct scsi_pkt *pkt)
+{
+ struct scsa_cmd *acmd = PKT2CMD(pkt);
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ if (acmd->cmd_flags & CFLAG_DMAVALID) {
+ acmd->cmd_flags &= ~CFLAG_DMAVALID;
+
+ (void) ddi_dma_unbind_handle(acmd->cmd_dmahandle);
+
+ ddi_dma_free_handle(&acmd->cmd_dmahandle);
+
+ acmd->cmd_dmahandle = NULL;
+ }
+
+ /* free the pkt */
+ scsi_hba_pkt_free(ap, pkt);
+}
+
+/*ARGSUSED*/
+static void
+drsas_tran_dmafree(struct scsi_address *ap, struct scsi_pkt *pkt)
+{
+ register struct scsa_cmd *acmd = PKT2CMD(pkt);
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ if (acmd->cmd_flags & CFLAG_DMAVALID) {
+ acmd->cmd_flags &= ~CFLAG_DMAVALID;
+
+ (void) ddi_dma_unbind_handle(acmd->cmd_dmahandle);
+
+ ddi_dma_free_handle(&acmd->cmd_dmahandle);
+
+ acmd->cmd_dmahandle = NULL;
+ }
+}
+
+/*ARGSUSED*/
+static void
+drsas_tran_sync_pkt(struct scsi_address *ap, struct scsi_pkt *pkt)
+{
+ register struct scsa_cmd *acmd = PKT2CMD(pkt);
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ if (acmd->cmd_flags & CFLAG_DMAVALID) {
+ (void) ddi_dma_sync(acmd->cmd_dmahandle, acmd->cmd_dma_offset,
+ acmd->cmd_dma_len, (acmd->cmd_flags & CFLAG_DMASEND) ?
+ DDI_DMA_SYNC_FORDEV : DDI_DMA_SYNC_FORCPU);
+ }
+}
+
+/*
+ * drsas_isr(caddr_t)
+ *
+ * The Interrupt Service Routine
+ *
+ * Collect status for all completed commands and do callback
+ *
+ */
+static uint_t
+drsas_isr(struct drsas_instance *instance)
+{
+ int need_softintr;
+ uint32_t producer;
+ uint32_t consumer;
+ uint32_t context;
+
+ struct drsas_cmd *cmd;
+
+ con_log(CL_ANN1, (CE_NOTE, "chkpnt:%s:%d", __func__, __LINE__));
+
+ ASSERT(instance);
+ if ((instance->intr_type == DDI_INTR_TYPE_FIXED) &&
+ !instance->func_ptr->intr_ack(instance)) {
+ return (DDI_INTR_UNCLAIMED);
+ }
+
+ (void) ddi_dma_sync(instance->mfi_internal_dma_obj.dma_handle,
+ 0, 0, DDI_DMA_SYNC_FORCPU);
+
+ if (drsas_check_dma_handle(instance->mfi_internal_dma_obj.dma_handle)
+ != DDI_SUCCESS) {
+ drsas_fm_ereport(instance, DDI_FM_DEVICE_NO_RESPONSE);
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_LOST);
+ return (DDI_INTR_UNCLAIMED);
+ }
+
+ producer = ddi_get32(instance->mfi_internal_dma_obj.acc_handle,
+ instance->producer);
+ consumer = ddi_get32(instance->mfi_internal_dma_obj.acc_handle,
+ instance->consumer);
+
+ con_log(CL_ANN1, (CE_CONT, " producer %x consumer %x ",
+ producer, consumer));
+ if (producer == consumer) {
+ con_log(CL_ANN1, (CE_WARN, "producer = consumer case"));
+ return (DDI_INTR_UNCLAIMED);
+ }
+ mutex_enter(&instance->completed_pool_mtx);
+
+ while (consumer != producer) {
+ context = ddi_get32(instance->mfi_internal_dma_obj.acc_handle,
+ &instance->reply_queue[consumer]);
+ cmd = instance->cmd_list[context];
+ mlist_add_tail(&cmd->list, &instance->completed_pool_list);
+
+ consumer++;
+ if (consumer == (instance->max_fw_cmds + 1)) {
+ consumer = 0;
+ }
+ }
+
+ mutex_exit(&instance->completed_pool_mtx);
+
+ ddi_put32(instance->mfi_internal_dma_obj.acc_handle,
+ instance->consumer, consumer);
+ (void) ddi_dma_sync(instance->mfi_internal_dma_obj.dma_handle,
+ 0, 0, DDI_DMA_SYNC_FORDEV);
+
+ if (instance->softint_running) {
+ need_softintr = 0;
+ } else {
+ need_softintr = 1;
+ }
+
+ if (instance->isr_level == HIGH_LEVEL_INTR) {
+ if (need_softintr) {
+ ddi_trigger_softintr(instance->soft_intr_id);
+ }
+ } else {
+ /*
+ * Not a high-level interrupt, therefore call the soft level
+ * interrupt explicitly
+ */
+ (void) drsas_softintr(instance);
+ }
+
+ return (DDI_INTR_CLAIMED);
+}
+
+
+/*
+ * ************************************************************************** *
+ * *
+ * libraries *
+ * *
+ * ************************************************************************** *
+ */
+/*
+ * get_mfi_pkt : Get a command from the free pool
+ * After successful allocation, the caller of this routine
+ * must clear the frame buffer (memset to zero) before
+ * using the packet further.
+ *
+ * ***** Note *****
+ * After clearing the frame buffer the context id of the
+ * frame buffer SHOULD be restored back.
+ */
+static struct drsas_cmd *
+get_mfi_pkt(struct drsas_instance *instance)
+{
+ mlist_t *head = &instance->cmd_pool_list;
+ struct drsas_cmd *cmd = NULL;
+
+ mutex_enter(&instance->cmd_pool_mtx);
+ ASSERT(mutex_owned(&instance->cmd_pool_mtx));
+
+ if (!mlist_empty(head)) {
+ cmd = mlist_entry(head->next, struct drsas_cmd, list);
+ mlist_del_init(head->next);
+ }
+ if (cmd != NULL)
+ cmd->pkt = NULL;
+ mutex_exit(&instance->cmd_pool_mtx);
+
+ return (cmd);
+}
+
+/*
+ * return_mfi_pkt : Return a cmd to free command pool
+ */
+static void
+return_mfi_pkt(struct drsas_instance *instance, struct drsas_cmd *cmd)
+{
+ mutex_enter(&instance->cmd_pool_mtx);
+ ASSERT(mutex_owned(&instance->cmd_pool_mtx));
+
+ mlist_add(&cmd->list, &instance->cmd_pool_list);
+
+ mutex_exit(&instance->cmd_pool_mtx);
+}
+
+/*
+ * destroy_mfi_frame_pool
+ */
+static void
+destroy_mfi_frame_pool(struct drsas_instance *instance)
+{
+ int i;
+ uint32_t max_cmd = instance->max_fw_cmds;
+
+ struct drsas_cmd *cmd;
+
+ /* return all frames to pool */
+ for (i = 0; i < max_cmd+1; i++) {
+
+ cmd = instance->cmd_list[i];
+
+ if (cmd->frame_dma_obj_status == DMA_OBJ_ALLOCATED)
+ (void) drsas_free_dma_obj(instance, cmd->frame_dma_obj);
+
+ cmd->frame_dma_obj_status = DMA_OBJ_FREED;
+ }
+
+}
+
+/*
+ * create_mfi_frame_pool
+ */
+static int
+create_mfi_frame_pool(struct drsas_instance *instance)
+{
+ int i = 0;
+ int cookie_cnt;
+ uint16_t max_cmd;
+ uint16_t sge_sz;
+ uint32_t sgl_sz;
+ uint32_t tot_frame_size;
+
+ struct drsas_cmd *cmd;
+
+ max_cmd = instance->max_fw_cmds;
+
+ sge_sz = sizeof (struct drsas_sge64);
+
+ /* calculated the number of 64byte frames required for SGL */
+ sgl_sz = sge_sz * instance->max_num_sge;
+ tot_frame_size = sgl_sz + MRMFI_FRAME_SIZE + SENSE_LENGTH;
+
+ con_log(CL_DLEVEL3, (CE_NOTE, "create_mfi_frame_pool: "
+ "sgl_sz %x tot_frame_size %x", sgl_sz, tot_frame_size));
+
+ while (i < max_cmd+1) {
+ cmd = instance->cmd_list[i];
+
+ cmd->frame_dma_obj.size = tot_frame_size;
+ cmd->frame_dma_obj.dma_attr = drsas_generic_dma_attr;
+ cmd->frame_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ cmd->frame_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ cmd->frame_dma_obj.dma_attr.dma_attr_sgllen = 1;
+ cmd->frame_dma_obj.dma_attr.dma_attr_align = 64;
+
+
+ cookie_cnt = drsas_alloc_dma_obj(instance, &cmd->frame_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC);
+
+ if (cookie_cnt == -1 || cookie_cnt > 1) {
+ con_log(CL_ANN, (CE_WARN,
+ "create_mfi_frame_pool: could not alloc."));
+ return (DDI_FAILURE);
+ }
+
+ bzero(cmd->frame_dma_obj.buffer, tot_frame_size);
+
+ cmd->frame_dma_obj_status = DMA_OBJ_ALLOCATED;
+ cmd->frame = (union drsas_frame *)cmd->frame_dma_obj.buffer;
+ cmd->frame_phys_addr =
+ cmd->frame_dma_obj.dma_cookie[0].dmac_address;
+
+ cmd->sense = (uint8_t *)(((unsigned long)
+ cmd->frame_dma_obj.buffer) +
+ tot_frame_size - SENSE_LENGTH);
+ cmd->sense_phys_addr =
+ cmd->frame_dma_obj.dma_cookie[0].dmac_address +
+ tot_frame_size - SENSE_LENGTH;
+
+ if (!cmd->frame || !cmd->sense) {
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: pci_pool_alloc failed"));
+
+ return (ENOMEM);
+ }
+
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &cmd->frame->io.context, cmd->index);
+ i++;
+
+ con_log(CL_DLEVEL3, (CE_NOTE, "[%x]-%x",
+ cmd->index, cmd->frame_phys_addr));
+ }
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * free_additional_dma_buffer
+ */
+static void
+free_additional_dma_buffer(struct drsas_instance *instance)
+{
+ if (instance->mfi_internal_dma_obj.status == DMA_OBJ_ALLOCATED) {
+ (void) drsas_free_dma_obj(instance,
+ instance->mfi_internal_dma_obj);
+ instance->mfi_internal_dma_obj.status = DMA_OBJ_FREED;
+ }
+
+ if (instance->mfi_evt_detail_obj.status == DMA_OBJ_ALLOCATED) {
+ (void) drsas_free_dma_obj(instance,
+ instance->mfi_evt_detail_obj);
+ instance->mfi_evt_detail_obj.status = DMA_OBJ_FREED;
+ }
+}
+
+/*
+ * alloc_additional_dma_buffer
+ */
+static int
+alloc_additional_dma_buffer(struct drsas_instance *instance)
+{
+ uint32_t reply_q_sz;
+ uint32_t internal_buf_size = PAGESIZE*2;
+
+ /* max cmds plus 1 + producer & consumer */
+ reply_q_sz = sizeof (uint32_t) * (instance->max_fw_cmds + 1 + 2);
+
+ instance->mfi_internal_dma_obj.size = internal_buf_size;
+ instance->mfi_internal_dma_obj.dma_attr = drsas_generic_dma_attr;
+ instance->mfi_internal_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ instance->mfi_internal_dma_obj.dma_attr.dma_attr_count_max =
+ 0xFFFFFFFFU;
+ instance->mfi_internal_dma_obj.dma_attr.dma_attr_sgllen = 1;
+
+ if (drsas_alloc_dma_obj(instance, &instance->mfi_internal_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas: could not alloc reply queue"));
+ return (DDI_FAILURE);
+ }
+
+ bzero(instance->mfi_internal_dma_obj.buffer, internal_buf_size);
+
+ instance->mfi_internal_dma_obj.status |= DMA_OBJ_ALLOCATED;
+
+ instance->producer = (uint32_t *)((unsigned long)
+ instance->mfi_internal_dma_obj.buffer);
+ instance->consumer = (uint32_t *)((unsigned long)
+ instance->mfi_internal_dma_obj.buffer + 4);
+ instance->reply_queue = (uint32_t *)((unsigned long)
+ instance->mfi_internal_dma_obj.buffer + 8);
+ instance->internal_buf = (caddr_t)(((unsigned long)
+ instance->mfi_internal_dma_obj.buffer) + reply_q_sz + 8);
+ instance->internal_buf_dmac_add =
+ instance->mfi_internal_dma_obj.dma_cookie[0].dmac_address +
+ (reply_q_sz + 8);
+ instance->internal_buf_size = internal_buf_size -
+ (reply_q_sz + 8);
+
+ /* allocate evt_detail */
+ instance->mfi_evt_detail_obj.size = sizeof (struct drsas_evt_detail);
+ instance->mfi_evt_detail_obj.dma_attr = drsas_generic_dma_attr;
+ instance->mfi_evt_detail_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ instance->mfi_evt_detail_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ instance->mfi_evt_detail_obj.dma_attr.dma_attr_sgllen = 1;
+ instance->mfi_evt_detail_obj.dma_attr.dma_attr_align = 1;
+
+ if (drsas_alloc_dma_obj(instance, &instance->mfi_evt_detail_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN, "alloc_additional_dma_buffer: "
+ "could not allocate data transfer buffer."));
+ return (DDI_FAILURE);
+ }
+
+ bzero(instance->mfi_evt_detail_obj.buffer,
+ sizeof (struct drsas_evt_detail));
+
+ instance->mfi_evt_detail_obj.status |= DMA_OBJ_ALLOCATED;
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * free_space_for_mfi
+ */
+static void
+free_space_for_mfi(struct drsas_instance *instance)
+{
+ int i;
+ uint32_t max_cmd = instance->max_fw_cmds;
+
+ /* already freed */
+ if (instance->cmd_list == NULL) {
+ return;
+ }
+
+ free_additional_dma_buffer(instance);
+
+ /* first free the MFI frame pool */
+ destroy_mfi_frame_pool(instance);
+
+ /* free all the commands in the cmd_list */
+ for (i = 0; i < instance->max_fw_cmds+1; i++) {
+ kmem_free(instance->cmd_list[i],
+ sizeof (struct drsas_cmd));
+
+ instance->cmd_list[i] = NULL;
+ }
+
+ /* free the cmd_list buffer itself */
+ kmem_free(instance->cmd_list,
+ sizeof (struct drsas_cmd *) * (max_cmd+1));
+
+ instance->cmd_list = NULL;
+
+ INIT_LIST_HEAD(&instance->cmd_pool_list);
+}
+
+/*
+ * alloc_space_for_mfi
+ */
+static int
+alloc_space_for_mfi(struct drsas_instance *instance)
+{
+ int i;
+ uint32_t max_cmd;
+ size_t sz;
+
+ struct drsas_cmd *cmd;
+
+ max_cmd = instance->max_fw_cmds;
+
+ /* reserve 1 more slot for flush_cache */
+ sz = sizeof (struct drsas_cmd *) * (max_cmd+1);
+
+ /*
+ * instance->cmd_list is an array of struct drsas_cmd pointers.
+ * Allocate the dynamic array first and then allocate individual
+ * commands.
+ */
+ instance->cmd_list = kmem_zalloc(sz, KM_SLEEP);
+ ASSERT(instance->cmd_list);
+
+ for (i = 0; i < max_cmd+1; i++) {
+ instance->cmd_list[i] = kmem_zalloc(sizeof (struct drsas_cmd),
+ KM_SLEEP);
+ ASSERT(instance->cmd_list[i]);
+ }
+
+ INIT_LIST_HEAD(&instance->cmd_pool_list);
+
+ /* add all the commands to command pool (instance->cmd_pool) */
+ for (i = 0; i < max_cmd; i++) {
+ cmd = instance->cmd_list[i];
+ cmd->index = i;
+
+ mlist_add_tail(&cmd->list, &instance->cmd_pool_list);
+ }
+
+ /* single slot for flush_cache won't be added in command pool */
+ cmd = instance->cmd_list[max_cmd];
+ cmd->index = i;
+
+ /* create a frame pool and assign one frame to each cmd */
+ if (create_mfi_frame_pool(instance)) {
+ con_log(CL_ANN, (CE_NOTE, "error creating frame DMA pool"));
+ return (DDI_FAILURE);
+ }
+
+ /* create a frame pool and assign one frame to each cmd */
+ if (alloc_additional_dma_buffer(instance)) {
+ con_log(CL_ANN, (CE_NOTE, "error creating frame DMA pool"));
+ return (DDI_FAILURE);
+ }
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * get_ctrl_info
+ */
+static int
+get_ctrl_info(struct drsas_instance *instance,
+ struct drsas_ctrl_info *ctrl_info)
+{
+ int ret = 0;
+
+ struct drsas_cmd *cmd;
+ struct drsas_dcmd_frame *dcmd;
+ struct drsas_ctrl_info *ci;
+
+ cmd = get_mfi_pkt(instance);
+
+ if (!cmd) {
+ con_log(CL_ANN, (CE_WARN,
+ "Failed to get a cmd for ctrl info"));
+ return (DDI_FAILURE);
+ }
+ /* Clear the frame buffer and assign back the context id */
+ (void) memset((char *)&cmd->frame[0], 0, sizeof (union drsas_frame));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &cmd->frame->hdr.context,
+ cmd->index);
+
+ dcmd = &cmd->frame->dcmd;
+
+ ci = (struct drsas_ctrl_info *)instance->internal_buf;
+
+ if (!ci) {
+ con_log(CL_ANN, (CE_WARN,
+ "Failed to alloc mem for ctrl info"));
+ return_mfi_pkt(instance, cmd);
+ return (DDI_FAILURE);
+ }
+
+ (void) memset(ci, 0, sizeof (struct drsas_ctrl_info));
+
+ /* for( i = 0; i < DCMD_MBOX_SZ; i++ ) dcmd->mbox.b[i] = 0; */
+ (void) memset(dcmd->mbox.b, 0, DCMD_MBOX_SZ);
+
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd, MFI_CMD_OP_DCMD);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd_status,
+ MFI_CMD_STATUS_POLL_MODE);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->sge_count, 1);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->flags,
+ MFI_FRAME_DIR_READ);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->timeout, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->data_xfer_len,
+ sizeof (struct drsas_ctrl_info));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->opcode,
+ DR_DCMD_CTRL_GET_INFO);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].phys_addr,
+ instance->internal_buf_dmac_add);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].length,
+ sizeof (struct drsas_ctrl_info));
+
+ cmd->frame_count = 1;
+
+ if (!instance->func_ptr->issue_cmd_in_poll_mode(instance, cmd)) {
+ ret = 0;
+ ddi_rep_get8(cmd->frame_dma_obj.acc_handle,
+ (uint8_t *)ctrl_info, (uint8_t *)ci,
+ sizeof (struct drsas_ctrl_info), DDI_DEV_AUTOINCR);
+ } else {
+ con_log(CL_ANN, (CE_WARN, "get_ctrl_info: Ctrl info failed"));
+ ret = -1;
+ }
+
+ return_mfi_pkt(instance, cmd);
+ if (drsas_common_check(instance, cmd) != DDI_SUCCESS) {
+ ret = -1;
+ }
+
+ return (ret);
+}
+
+/*
+ * abort_aen_cmd
+ */
+static int
+abort_aen_cmd(struct drsas_instance *instance,
+ struct drsas_cmd *cmd_to_abort)
+{
+ int ret = 0;
+
+ struct drsas_cmd *cmd;
+ struct drsas_abort_frame *abort_fr;
+
+ cmd = get_mfi_pkt(instance);
+
+ if (!cmd) {
+ con_log(CL_ANN, (CE_WARN,
+ "Failed to get a cmd for ctrl info"));
+ return (DDI_FAILURE);
+ }
+ /* Clear the frame buffer and assign back the context id */
+ (void) memset((char *)&cmd->frame[0], 0, sizeof (union drsas_frame));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &cmd->frame->hdr.context,
+ cmd->index);
+
+ abort_fr = &cmd->frame->abort;
+
+ /* prepare and issue the abort frame */
+ ddi_put8(cmd->frame_dma_obj.acc_handle,
+ &abort_fr->cmd, MFI_CMD_OP_ABORT);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &abort_fr->cmd_status,
+ MFI_CMD_STATUS_SYNC_MODE);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &abort_fr->flags, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &abort_fr->abort_context,
+ cmd_to_abort->index);
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &abort_fr->abort_mfi_phys_addr_lo, cmd_to_abort->frame_phys_addr);
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &abort_fr->abort_mfi_phys_addr_hi, 0);
+
+ instance->aen_cmd->abort_aen = 1;
+
+ cmd->sync_cmd = DRSAS_TRUE;
+ cmd->frame_count = 1;
+
+ if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) {
+ con_log(CL_ANN, (CE_WARN,
+ "abort_aen_cmd: issue_cmd_in_sync_mode failed"));
+ ret = -1;
+ } else {
+ ret = 0;
+ }
+
+ instance->aen_cmd->abort_aen = 1;
+ instance->aen_cmd = 0;
+
+ return_mfi_pkt(instance, cmd);
+ (void) drsas_common_check(instance, cmd);
+
+ return (ret);
+}
+
+/*
+ * init_mfi
+ */
+static int
+init_mfi(struct drsas_instance *instance)
+{
+ struct drsas_cmd *cmd;
+ struct drsas_ctrl_info ctrl_info;
+ struct drsas_init_frame *init_frame;
+ struct drsas_init_queue_info *initq_info;
+
+ /* we expect the FW state to be READY */
+ if (mfi_state_transition_to_ready(instance)) {
+ con_log(CL_ANN, (CE_WARN, "dr_sas: F/W is not ready"));
+ goto fail_ready_state;
+ }
+
+ /* get various operational parameters from status register */
+ instance->max_num_sge =
+ (instance->func_ptr->read_fw_status_reg(instance) &
+ 0xFF0000) >> 0x10;
+ /*
+ * Reduce the max supported cmds by 1. This is to ensure that the
+ * reply_q_sz (1 more than the max cmd that driver may send)
+ * does not exceed max cmds that the FW can support
+ */
+ instance->max_fw_cmds =
+ instance->func_ptr->read_fw_status_reg(instance) & 0xFFFF;
+ instance->max_fw_cmds = instance->max_fw_cmds - 1;
+
+ instance->max_num_sge =
+ (instance->max_num_sge > DRSAS_MAX_SGE_CNT) ?
+ DRSAS_MAX_SGE_CNT : instance->max_num_sge;
+
+ /* create a pool of commands */
+ if (alloc_space_for_mfi(instance) != DDI_SUCCESS)
+ goto fail_alloc_fw_space;
+
+ /*
+ * Prepare a init frame. Note the init frame points to queue info
+ * structure. Each frame has SGL allocated after first 64 bytes. For
+ * this frame - since we don't need any SGL - we use SGL's space as
+ * queue info structure
+ */
+ cmd = get_mfi_pkt(instance);
+ /* Clear the frame buffer and assign back the context id */
+ (void) memset((char *)&cmd->frame[0], 0, sizeof (union drsas_frame));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &cmd->frame->hdr.context,
+ cmd->index);
+
+ init_frame = (struct drsas_init_frame *)cmd->frame;
+ initq_info = (struct drsas_init_queue_info *)
+ ((unsigned long)init_frame + 64);
+
+ (void) memset(init_frame, 0, MRMFI_FRAME_SIZE);
+ (void) memset(initq_info, 0, sizeof (struct drsas_init_queue_info));
+
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &initq_info->init_flags, 0);
+
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &initq_info->reply_queue_entries, instance->max_fw_cmds + 1);
+
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &initq_info->producer_index_phys_addr_hi, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &initq_info->producer_index_phys_addr_lo,
+ instance->mfi_internal_dma_obj.dma_cookie[0].dmac_address);
+
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &initq_info->consumer_index_phys_addr_hi, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &initq_info->consumer_index_phys_addr_lo,
+ instance->mfi_internal_dma_obj.dma_cookie[0].dmac_address + 4);
+
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &initq_info->reply_queue_start_phys_addr_hi, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &initq_info->reply_queue_start_phys_addr_lo,
+ instance->mfi_internal_dma_obj.dma_cookie[0].dmac_address + 8);
+
+ ddi_put8(cmd->frame_dma_obj.acc_handle,
+ &init_frame->cmd, MFI_CMD_OP_INIT);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &init_frame->cmd_status,
+ MFI_CMD_STATUS_POLL_MODE);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &init_frame->flags, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &init_frame->queue_info_new_phys_addr_lo,
+ cmd->frame_phys_addr + 64);
+ ddi_put32(cmd->frame_dma_obj.acc_handle,
+ &init_frame->queue_info_new_phys_addr_hi, 0);
+
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &init_frame->data_xfer_len,
+ sizeof (struct drsas_init_queue_info));
+
+ cmd->frame_count = 1;
+
+ /* issue the init frame in polled mode */
+ if (instance->func_ptr->issue_cmd_in_poll_mode(instance, cmd)) {
+ con_log(CL_ANN, (CE_WARN, "failed to init firmware"));
+ goto fail_fw_init;
+ }
+
+ return_mfi_pkt(instance, cmd);
+ if (drsas_common_check(instance, cmd) != DDI_SUCCESS) {
+ goto fail_fw_init;
+ }
+
+ /* gather misc FW related information */
+ if (!get_ctrl_info(instance, &ctrl_info)) {
+ instance->max_sectors_per_req = ctrl_info.max_request_size;
+ con_log(CL_ANN1, (CE_NOTE, "product name %s ld present %d",
+ ctrl_info.product_name, ctrl_info.ld_present_count));
+ } else {
+ instance->max_sectors_per_req = instance->max_num_sge *
+ PAGESIZE / 512;
+ }
+
+ if (drsas_check_acc_handle(instance->regmap_handle) != DDI_SUCCESS) {
+ goto fail_fw_init;
+ }
+
+ return (DDI_SUCCESS);
+
+fail_fw_init:
+fail_alloc_fw_space:
+
+ free_space_for_mfi(instance);
+
+fail_ready_state:
+ ddi_regs_map_free(&instance->regmap_handle);
+
+fail_mfi_reg_setup:
+ return (DDI_FAILURE);
+}
+
+/*
+ * mfi_state_transition_to_ready : Move the FW to READY state
+ *
+ * @reg_set : MFI register set
+ */
+static int
+mfi_state_transition_to_ready(struct drsas_instance *instance)
+{
+ int i;
+ uint8_t max_wait;
+ uint32_t fw_ctrl;
+ uint32_t fw_state;
+ uint32_t cur_state;
+
+ fw_state =
+ instance->func_ptr->read_fw_status_reg(instance) & MFI_STATE_MASK;
+ con_log(CL_ANN1, (CE_NOTE,
+ "mfi_state_transition_to_ready:FW state = 0x%x", fw_state));
+
+ while (fw_state != MFI_STATE_READY) {
+ con_log(CL_ANN, (CE_NOTE,
+ "mfi_state_transition_to_ready:FW state%x", fw_state));
+
+ switch (fw_state) {
+ case MFI_STATE_FAULT:
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: FW in FAULT state!!"));
+
+ return (ENODEV);
+ case MFI_STATE_WAIT_HANDSHAKE:
+ /* set the CLR bit in IMR0 */
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: FW waiting for HANDSHAKE"));
+ /*
+ * PCI_Hot Plug: MFI F/W requires
+ * (MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG)
+ * to be set
+ */
+ /* WR_IB_MSG_0(MFI_INIT_CLEAR_HANDSHAKE, instance); */
+ WR_IB_DOORBELL(MFI_INIT_CLEAR_HANDSHAKE |
+ MFI_INIT_HOTPLUG, instance);
+
+ max_wait = 2;
+ cur_state = MFI_STATE_WAIT_HANDSHAKE;
+ break;
+ case MFI_STATE_BOOT_MESSAGE_PENDING:
+ /* set the CLR bit in IMR0 */
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: FW state boot message pending"));
+ /*
+ * PCI_Hot Plug: MFI F/W requires
+ * (MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG)
+ * to be set
+ */
+ WR_IB_DOORBELL(MFI_INIT_HOTPLUG, instance);
+
+ max_wait = 10;
+ cur_state = MFI_STATE_BOOT_MESSAGE_PENDING;
+ break;
+ case MFI_STATE_OPERATIONAL:
+ /* bring it to READY state; assuming max wait 2 secs */
+ instance->func_ptr->disable_intr(instance);
+ con_log(CL_ANN1, (CE_NOTE,
+ "dr_sas: FW in OPERATIONAL state"));
+ /*
+ * PCI_Hot Plug: MFI F/W requires
+ * (MFI_INIT_READY | MFI_INIT_MFIMODE | MFI_INIT_ABORT)
+ * to be set
+ */
+ /* WR_IB_DOORBELL(MFI_INIT_READY, instance); */
+ WR_IB_DOORBELL(MFI_RESET_FLAGS, instance);
+
+ max_wait = 10;
+ cur_state = MFI_STATE_OPERATIONAL;
+ break;
+ case MFI_STATE_UNDEFINED:
+ /* this state should not last for more than 2 seconds */
+ con_log(CL_ANN, (CE_NOTE, "FW state undefined"));
+
+ max_wait = 2;
+ cur_state = MFI_STATE_UNDEFINED;
+ break;
+ case MFI_STATE_BB_INIT:
+ max_wait = 2;
+ cur_state = MFI_STATE_BB_INIT;
+ break;
+ case MFI_STATE_FW_INIT:
+ max_wait = 2;
+ cur_state = MFI_STATE_FW_INIT;
+ break;
+ case MFI_STATE_DEVICE_SCAN:
+ max_wait = 10;
+ cur_state = MFI_STATE_DEVICE_SCAN;
+ break;
+ default:
+ con_log(CL_ANN, (CE_NOTE,
+ "dr_sas: Unknown state 0x%x", fw_state));
+ return (ENODEV);
+ }
+
+ /* the cur_state should not last for more than max_wait secs */
+ for (i = 0; i < (max_wait * MILLISEC); i++) {
+ /* fw_state = RD_OB_MSG_0(instance) & MFI_STATE_MASK; */
+ fw_state =
+ instance->func_ptr->read_fw_status_reg(instance) &
+ MFI_STATE_MASK;
+
+ if (fw_state == cur_state) {
+ delay(1 * drv_usectohz(MILLISEC));
+ } else {
+ break;
+ }
+ }
+
+ /* return error if fw_state hasn't changed after max_wait */
+ if (fw_state == cur_state) {
+ con_log(CL_ANN, (CE_NOTE,
+ "FW state hasn't changed in %d secs", max_wait));
+ return (ENODEV);
+ }
+ };
+
+ fw_ctrl = RD_IB_DOORBELL(instance);
+
+ con_log(CL_ANN1, (CE_NOTE,
+ "mfi_state_transition_to_ready:FW ctrl = 0x%x", fw_ctrl));
+
+ /*
+ * Write 0xF to the doorbell register to do the following.
+ * - Abort all outstanding commands (bit 0).
+ * - Transition from OPERATIONAL to READY state (bit 1).
+ * - Discard (possible) low MFA posted in 64-bit mode (bit-2).
+ * - Set to release FW to continue running (i.e. BIOS handshake
+ * (bit 3).
+ */
+ WR_IB_DOORBELL(0xF, instance);
+
+ if (drsas_check_acc_handle(instance->regmap_handle) != DDI_SUCCESS) {
+ return (ENODEV);
+ }
+ return (DDI_SUCCESS);
+}
+
+/*
+ * get_seq_num
+ */
+static int
+get_seq_num(struct drsas_instance *instance,
+ struct drsas_evt_log_info *eli)
+{
+ int ret = DDI_SUCCESS;
+
+ dma_obj_t dcmd_dma_obj;
+ struct drsas_cmd *cmd;
+ struct drsas_dcmd_frame *dcmd;
+
+ cmd = get_mfi_pkt(instance);
+
+ if (!cmd) {
+ cmn_err(CE_WARN, "dr_sas: failed to get a cmd");
+ return (ENOMEM);
+ }
+ /* Clear the frame buffer and assign back the context id */
+ (void) memset((char *)&cmd->frame[0], 0, sizeof (union drsas_frame));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &cmd->frame->hdr.context,
+ cmd->index);
+
+ dcmd = &cmd->frame->dcmd;
+
+ /* allocate the data transfer buffer */
+ dcmd_dma_obj.size = sizeof (struct drsas_evt_log_info);
+ dcmd_dma_obj.dma_attr = drsas_generic_dma_attr;
+ dcmd_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ dcmd_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ dcmd_dma_obj.dma_attr.dma_attr_sgllen = 1;
+ dcmd_dma_obj.dma_attr.dma_attr_align = 1;
+
+ if (drsas_alloc_dma_obj(instance, &dcmd_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN,
+ "get_seq_num: could not allocate data transfer buffer."));
+ return (DDI_FAILURE);
+ }
+
+ (void) memset(dcmd_dma_obj.buffer, 0,
+ sizeof (struct drsas_evt_log_info));
+
+ (void) memset(dcmd->mbox.b, 0, DCMD_MBOX_SZ);
+
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd, MFI_CMD_OP_DCMD);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd_status, 0);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->sge_count, 1);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->flags,
+ MFI_FRAME_DIR_READ);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->timeout, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->data_xfer_len,
+ sizeof (struct drsas_evt_log_info));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->opcode,
+ DR_DCMD_CTRL_EVENT_GET_INFO);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].length,
+ sizeof (struct drsas_evt_log_info));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].phys_addr,
+ dcmd_dma_obj.dma_cookie[0].dmac_address);
+
+ cmd->sync_cmd = DRSAS_TRUE;
+ cmd->frame_count = 1;
+
+ if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) {
+ cmn_err(CE_WARN, "get_seq_num: "
+ "failed to issue DRSAS_DCMD_CTRL_EVENT_GET_INFO");
+ ret = DDI_FAILURE;
+ } else {
+ /* copy the data back into callers buffer */
+ ddi_rep_get8(cmd->frame_dma_obj.acc_handle, (uint8_t *)eli,
+ (uint8_t *)dcmd_dma_obj.buffer,
+ sizeof (struct drsas_evt_log_info), DDI_DEV_AUTOINCR);
+ ret = DDI_SUCCESS;
+ }
+
+ if (drsas_free_dma_obj(instance, dcmd_dma_obj) != DDI_SUCCESS)
+ ret = DDI_FAILURE;
+
+ return_mfi_pkt(instance, cmd);
+ if (drsas_common_check(instance, cmd) != DDI_SUCCESS) {
+ ret = DDI_FAILURE;
+ }
+ return (ret);
+}
+
+/*
+ * start_mfi_aen
+ */
+static int
+start_mfi_aen(struct drsas_instance *instance)
+{
+ int ret = 0;
+
+ struct drsas_evt_log_info eli;
+ union drsas_evt_class_locale class_locale;
+
+ /* get the latest sequence number from FW */
+ (void) memset(&eli, 0, sizeof (struct drsas_evt_log_info));
+
+ if (get_seq_num(instance, &eli)) {
+ cmn_err(CE_WARN, "start_mfi_aen: failed to get seq num");
+ return (-1);
+ }
+
+ /* register AEN with FW for latest sequence number plus 1 */
+ class_locale.members.reserved = 0;
+ class_locale.members.locale = DR_EVT_LOCALE_ALL;
+ class_locale.members.class = DR_EVT_CLASS_INFO;
+ ret = register_mfi_aen(instance, eli.newest_seq_num + 1,
+ class_locale.word);
+
+ if (ret) {
+ cmn_err(CE_WARN, "start_mfi_aen: aen registration failed");
+ return (-1);
+ }
+
+ return (ret);
+}
+
+/*
+ * flush_cache
+ */
+static void
+flush_cache(struct drsas_instance *instance)
+{
+ struct drsas_cmd *cmd = NULL;
+ struct drsas_dcmd_frame *dcmd;
+ uint32_t max_cmd = instance->max_fw_cmds;
+
+ cmd = instance->cmd_list[max_cmd];
+
+ if (cmd == NULL)
+ return;
+
+ dcmd = &cmd->frame->dcmd;
+
+ (void) memset(dcmd->mbox.b, 0, DCMD_MBOX_SZ);
+
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd, MFI_CMD_OP_DCMD);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd_status, 0x0);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->sge_count, 0);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->flags,
+ MFI_FRAME_DIR_NONE);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->timeout, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->data_xfer_len, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->opcode,
+ DR_DCMD_CTRL_CACHE_FLUSH);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->mbox.b[0],
+ DR_FLUSH_CTRL_CACHE | DR_FLUSH_DISK_CACHE);
+
+ cmd->frame_count = 1;
+
+ if (instance->func_ptr->issue_cmd_in_poll_mode(instance, cmd)) {
+ con_log(CL_ANN1, (CE_WARN,
+ "flush_cache: failed to issue MFI_DCMD_CTRL_CACHE_FLUSH"));
+ }
+ con_log(CL_DLEVEL1, (CE_NOTE, "done"));
+}
+
+/*
+ * service_mfi_aen- Completes an AEN command
+ * @instance: Adapter soft state
+ * @cmd: Command to be completed
+ *
+ */
+static void
+service_mfi_aen(struct drsas_instance *instance, struct drsas_cmd *cmd)
+{
+ uint32_t seq_num;
+ struct drsas_evt_detail *evt_detail =
+ (struct drsas_evt_detail *)instance->mfi_evt_detail_obj.buffer;
+ int rval = 0;
+ int tgt = 0;
+ ddi_acc_handle_t acc_handle;
+
+ acc_handle = cmd->frame_dma_obj.acc_handle;
+
+ cmd->cmd_status = ddi_get8(acc_handle, &cmd->frame->io.cmd_status);
+
+ if (cmd->cmd_status == ENODATA) {
+ cmd->cmd_status = 0;
+ }
+
+ /*
+ * log the MFI AEN event to the sysevent queue so that
+ * application will get noticed
+ */
+ if (ddi_log_sysevent(instance->dip, DDI_VENDOR_LSI, "LSIMEGA", "SAS",
+ NULL, NULL, DDI_NOSLEEP) != DDI_SUCCESS) {
+ int instance_no = ddi_get_instance(instance->dip);
+ con_log(CL_ANN, (CE_WARN,
+ "dr_sas%d: Failed to log AEN event", instance_no));
+ }
+ /*
+ * Check for any ld devices that has changed state. i.e. online
+ * or offline.
+ */
+ con_log(CL_ANN1, (CE_NOTE,
+ "AEN: code = %x class = %x locale = %x args = %x",
+ ddi_get32(acc_handle, &evt_detail->code),
+ evt_detail->cl.members.class,
+ ddi_get16(acc_handle, &evt_detail->cl.members.locale),
+ ddi_get8(acc_handle, &evt_detail->arg_type)));
+
+ switch (ddi_get32(acc_handle, &evt_detail->code)) {
+ case DR_EVT_CFG_CLEARED: {
+ for (tgt = 0; tgt < MRDRV_MAX_LD; tgt++) {
+ if (instance->dr_ld_list[tgt].dip != NULL) {
+ rval = drsas_service_evt(instance, tgt, 0,
+ DRSAS_EVT_UNCONFIG_TGT, NULL);
+ con_log(CL_ANN1, (CE_WARN,
+ "dr_sas: CFG CLEARED AEN rval = %d "
+ "tgt id = %d", rval, tgt));
+ }
+ }
+ break;
+ }
+
+ case DR_EVT_LD_DELETED: {
+ rval = drsas_service_evt(instance,
+ ddi_get16(acc_handle, &evt_detail->args.ld.target_id), 0,
+ DRSAS_EVT_UNCONFIG_TGT, NULL);
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: LD DELETED AEN rval = %d "
+ "tgt id = %d index = %d", rval,
+ ddi_get16(acc_handle, &evt_detail->args.ld.target_id),
+ ddi_get8(acc_handle, &evt_detail->args.ld.ld_index)));
+ break;
+ } /* End of DR_EVT_LD_DELETED */
+
+ case DR_EVT_LD_CREATED: {
+ rval = drsas_service_evt(instance,
+ ddi_get16(acc_handle, &evt_detail->args.ld.target_id), 0,
+ DRSAS_EVT_CONFIG_TGT, NULL);
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: LD CREATED AEN rval = %d "
+ "tgt id = %d index = %d", rval,
+ ddi_get16(acc_handle, &evt_detail->args.ld.target_id),
+ ddi_get8(acc_handle, &evt_detail->args.ld.ld_index)));
+ break;
+ } /* End of DR_EVT_LD_CREATED */
+ } /* End of Main Switch */
+
+ /* get copy of seq_num and class/locale for re-registration */
+ seq_num = ddi_get32(acc_handle, &evt_detail->seq_num);
+ seq_num++;
+ (void) memset(instance->mfi_evt_detail_obj.buffer, 0,
+ sizeof (struct drsas_evt_detail));
+
+ ddi_put8(acc_handle, &cmd->frame->dcmd.cmd_status, 0x0);
+ ddi_put32(acc_handle, &cmd->frame->dcmd.mbox.w[0], seq_num);
+
+ instance->aen_seq_num = seq_num;
+
+ cmd->frame_count = 1;
+
+ /* Issue the aen registration frame */
+ instance->func_ptr->issue_cmd(cmd, instance);
+}
+
+/*
+ * complete_cmd_in_sync_mode - Completes an internal command
+ * @instance: Adapter soft state
+ * @cmd: Command to be completed
+ *
+ * The issue_cmd_in_sync_mode() function waits for a command to complete
+ * after it issues a command. This function wakes up that waiting routine by
+ * calling wake_up() on the wait queue.
+ */
+static void
+complete_cmd_in_sync_mode(struct drsas_instance *instance,
+ struct drsas_cmd *cmd)
+{
+ cmd->cmd_status = ddi_get8(cmd->frame_dma_obj.acc_handle,
+ &cmd->frame->io.cmd_status);
+
+ cmd->sync_cmd = DRSAS_FALSE;
+
+ if (cmd->cmd_status == ENODATA) {
+ cmd->cmd_status = 0;
+ }
+
+ cv_broadcast(&instance->int_cmd_cv);
+}
+
+/*
+ * drsas_softintr - The Software ISR
+ * @param arg : HBA soft state
+ *
+ * called from high-level interrupt if hi-level interrupt are not there,
+ * otherwise triggered as a soft interrupt
+ */
+static uint_t
+drsas_softintr(struct drsas_instance *instance)
+{
+ struct scsi_pkt *pkt;
+ struct scsa_cmd *acmd;
+ struct drsas_cmd *cmd;
+ struct mlist_head *pos, *next;
+ mlist_t process_list;
+ struct drsas_header *hdr;
+ struct scsi_arq_status *arqstat;
+
+ con_log(CL_ANN1, (CE_CONT, "drsas_softintr called"));
+
+ ASSERT(instance);
+ mutex_enter(&instance->completed_pool_mtx);
+
+ if (mlist_empty(&instance->completed_pool_list)) {
+ mutex_exit(&instance->completed_pool_mtx);
+ return (DDI_INTR_UNCLAIMED);
+ }
+
+ instance->softint_running = 1;
+
+ INIT_LIST_HEAD(&process_list);
+ mlist_splice(&instance->completed_pool_list, &process_list);
+ INIT_LIST_HEAD(&instance->completed_pool_list);
+
+ mutex_exit(&instance->completed_pool_mtx);
+
+ /* perform all callbacks first, before releasing the SCBs */
+ mlist_for_each_safe(pos, next, &process_list) {
+ cmd = mlist_entry(pos, struct drsas_cmd, list);
+
+ /* syncronize the Cmd frame for the controller */
+ (void) ddi_dma_sync(cmd->frame_dma_obj.dma_handle,
+ 0, 0, DDI_DMA_SYNC_FORCPU);
+
+ if (drsas_check_dma_handle(cmd->frame_dma_obj.dma_handle) !=
+ DDI_SUCCESS) {
+ drsas_fm_ereport(instance, DDI_FM_DEVICE_NO_RESPONSE);
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_LOST);
+ return (DDI_INTR_UNCLAIMED);
+ }
+
+ hdr = &cmd->frame->hdr;
+
+ /* remove the internal command from the process list */
+ mlist_del_init(&cmd->list);
+
+ switch (ddi_get8(cmd->frame_dma_obj.acc_handle, &hdr->cmd)) {
+ case MFI_CMD_OP_PD_SCSI:
+ case MFI_CMD_OP_LD_SCSI:
+ case MFI_CMD_OP_LD_READ:
+ case MFI_CMD_OP_LD_WRITE:
+ /*
+ * MFI_CMD_OP_PD_SCSI and MFI_CMD_OP_LD_SCSI
+ * could have been issued either through an
+ * IO path or an IOCTL path. If it was via IOCTL,
+ * we will send it to internal completion.
+ */
+ if (cmd->sync_cmd == DRSAS_TRUE) {
+ complete_cmd_in_sync_mode(instance, cmd);
+ break;
+ }
+
+ /* regular commands */
+ acmd = cmd->cmd;
+ pkt = CMD2PKT(acmd);
+
+ if (acmd->cmd_flags & CFLAG_DMAVALID) {
+ if (acmd->cmd_flags & CFLAG_CONSISTENT) {
+ (void) ddi_dma_sync(acmd->cmd_dmahandle,
+ acmd->cmd_dma_offset,
+ acmd->cmd_dma_len,
+ DDI_DMA_SYNC_FORCPU);
+ }
+ }
+
+ pkt->pkt_reason = CMD_CMPLT;
+ pkt->pkt_statistics = 0;
+ pkt->pkt_state = STATE_GOT_BUS
+ | STATE_GOT_TARGET | STATE_SENT_CMD
+ | STATE_XFERRED_DATA | STATE_GOT_STATUS;
+
+ con_log(CL_ANN1, (CE_CONT,
+ "CDB[0] = %x completed for %s: size %lx context %x",
+ pkt->pkt_cdbp[0], ((acmd->islogical) ? "LD" : "PD"),
+ acmd->cmd_dmacount, hdr->context));
+
+ if (pkt->pkt_cdbp[0] == SCMD_INQUIRY) {
+ struct scsi_inquiry *inq;
+
+ if (acmd->cmd_dmacount != 0) {
+ bp_mapin(acmd->cmd_buf);
+ inq = (struct scsi_inquiry *)
+ acmd->cmd_buf->b_un.b_addr;
+
+ /* don't expose physical drives to OS */
+ if (acmd->islogical &&
+ (hdr->cmd_status == MFI_STAT_OK)) {
+ display_scsi_inquiry(
+ (caddr_t)inq);
+ } else if ((hdr->cmd_status ==
+ MFI_STAT_OK) && inq->inq_dtype ==
+ DTYPE_DIRECT) {
+
+ display_scsi_inquiry(
+ (caddr_t)inq);
+
+ /* for physical disk */
+ hdr->cmd_status =
+ MFI_STAT_DEVICE_NOT_FOUND;
+ }
+ }
+ }
+
+ switch (hdr->cmd_status) {
+ case MFI_STAT_OK:
+ pkt->pkt_scbp[0] = STATUS_GOOD;
+ break;
+ case MFI_STAT_LD_CC_IN_PROGRESS:
+ case MFI_STAT_LD_RECON_IN_PROGRESS:
+ pkt->pkt_scbp[0] = STATUS_GOOD;
+ break;
+ case MFI_STAT_LD_INIT_IN_PROGRESS:
+ con_log(CL_ANN,
+ (CE_WARN, "Initialization in Progress"));
+ pkt->pkt_reason = CMD_TRAN_ERR;
+
+ break;
+ case MFI_STAT_SCSI_DONE_WITH_ERROR:
+ con_log(CL_ANN1, (CE_CONT, "scsi_done error"));
+
+ pkt->pkt_reason = CMD_CMPLT;
+ ((struct scsi_status *)
+ pkt->pkt_scbp)->sts_chk = 1;
+
+ if (pkt->pkt_cdbp[0] == SCMD_TEST_UNIT_READY) {
+
+ con_log(CL_ANN,
+ (CE_WARN, "TEST_UNIT_READY fail"));
+
+ } else {
+ pkt->pkt_state |= STATE_ARQ_DONE;
+ arqstat = (void *)(pkt->pkt_scbp);
+ arqstat->sts_rqpkt_reason = CMD_CMPLT;
+ arqstat->sts_rqpkt_resid = 0;
+ arqstat->sts_rqpkt_state |=
+ STATE_GOT_BUS | STATE_GOT_TARGET
+ | STATE_SENT_CMD
+ | STATE_XFERRED_DATA;
+ *(uint8_t *)&arqstat->sts_rqpkt_status =
+ STATUS_GOOD;
+ ddi_rep_get8(
+ cmd->frame_dma_obj.acc_handle,
+ (uint8_t *)
+ &(arqstat->sts_sensedata),
+ cmd->sense,
+ acmd->cmd_scblen -
+ offsetof(struct scsi_arq_status,
+ sts_sensedata), DDI_DEV_AUTOINCR);
+ }
+ break;
+ case MFI_STAT_LD_OFFLINE:
+ case MFI_STAT_DEVICE_NOT_FOUND:
+ con_log(CL_ANN1, (CE_CONT,
+ "device not found error"));
+ pkt->pkt_reason = CMD_DEV_GONE;
+ pkt->pkt_statistics = STAT_DISCON;
+ break;
+ case MFI_STAT_LD_LBA_OUT_OF_RANGE:
+ pkt->pkt_state |= STATE_ARQ_DONE;
+ pkt->pkt_reason = CMD_CMPLT;
+ ((struct scsi_status *)
+ pkt->pkt_scbp)->sts_chk = 1;
+
+ arqstat = (void *)(pkt->pkt_scbp);
+ arqstat->sts_rqpkt_reason = CMD_CMPLT;
+ arqstat->sts_rqpkt_resid = 0;
+ arqstat->sts_rqpkt_state |= STATE_GOT_BUS
+ | STATE_GOT_TARGET | STATE_SENT_CMD
+ | STATE_XFERRED_DATA;
+ *(uint8_t *)&arqstat->sts_rqpkt_status =
+ STATUS_GOOD;
+
+ arqstat->sts_sensedata.es_valid = 1;
+ arqstat->sts_sensedata.es_key =
+ KEY_ILLEGAL_REQUEST;
+ arqstat->sts_sensedata.es_class =
+ CLASS_EXTENDED_SENSE;
+
+ /*
+ * LOGICAL BLOCK ADDRESS OUT OF RANGE:
+ * ASC: 0x21h; ASCQ: 0x00h;
+ */
+ arqstat->sts_sensedata.es_add_code = 0x21;
+ arqstat->sts_sensedata.es_qual_code = 0x00;
+
+ break;
+
+ default:
+ con_log(CL_ANN, (CE_CONT, "Unknown status!"));
+ pkt->pkt_reason = CMD_TRAN_ERR;
+
+ break;
+ }
+
+ atomic_add_16(&instance->fw_outstanding, (-1));
+
+ return_mfi_pkt(instance, cmd);
+
+ (void) drsas_common_check(instance, cmd);
+
+ if (acmd->cmd_dmahandle) {
+ if (drsas_check_dma_handle(
+ acmd->cmd_dmahandle) != DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip,
+ DDI_SERVICE_UNAFFECTED);
+ pkt->pkt_reason = CMD_TRAN_ERR;
+ pkt->pkt_statistics = 0;
+ }
+ }
+
+ /* Call the callback routine */
+ if (((pkt->pkt_flags & FLAG_NOINTR) == 0) &&
+ pkt->pkt_comp) {
+ (*pkt->pkt_comp)(pkt);
+ }
+
+ break;
+ case MFI_CMD_OP_SMP:
+ case MFI_CMD_OP_STP:
+ complete_cmd_in_sync_mode(instance, cmd);
+ break;
+ case MFI_CMD_OP_DCMD:
+ /* see if got an event notification */
+ if (ddi_get32(cmd->frame_dma_obj.acc_handle,
+ &cmd->frame->dcmd.opcode) ==
+ DR_DCMD_CTRL_EVENT_WAIT) {
+ if ((instance->aen_cmd == cmd) &&
+ (instance->aen_cmd->abort_aen)) {
+ con_log(CL_ANN, (CE_WARN,
+ "drsas_softintr: "
+ "aborted_aen returned"));
+ } else {
+ atomic_add_16(&instance->fw_outstanding,
+ (-1));
+ service_mfi_aen(instance, cmd);
+ }
+ } else {
+ complete_cmd_in_sync_mode(instance, cmd);
+ }
+
+ break;
+ case MFI_CMD_OP_ABORT:
+ con_log(CL_ANN, (CE_WARN, "MFI_CMD_OP_ABORT complete"));
+ /*
+ * MFI_CMD_OP_ABORT successfully completed
+ * in the synchronous mode
+ */
+ complete_cmd_in_sync_mode(instance, cmd);
+ break;
+ default:
+ drsas_fm_ereport(instance, DDI_FM_DEVICE_NO_RESPONSE);
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_LOST);
+
+ if (cmd->pkt != NULL) {
+ pkt = cmd->pkt;
+ if (((pkt->pkt_flags & FLAG_NOINTR) == 0) &&
+ pkt->pkt_comp) {
+ (*pkt->pkt_comp)(pkt);
+ }
+ }
+ con_log(CL_ANN, (CE_WARN, "Cmd type unknown !"));
+ break;
+ }
+ }
+
+ instance->softint_running = 0;
+
+ return (DDI_INTR_CLAIMED);
+}
+
+/*
+ * drsas_alloc_dma_obj
+ *
+ * Allocate the memory and other resources for an dma object.
+ */
+static int
+drsas_alloc_dma_obj(struct drsas_instance *instance, dma_obj_t *obj,
+ uchar_t endian_flags)
+{
+ int i;
+ size_t alen = 0;
+ uint_t cookie_cnt;
+ struct ddi_device_acc_attr tmp_endian_attr;
+
+ tmp_endian_attr = endian_attr;
+ tmp_endian_attr.devacc_attr_endian_flags = endian_flags;
+
+ i = ddi_dma_alloc_handle(instance->dip, &obj->dma_attr,
+ DDI_DMA_SLEEP, NULL, &obj->dma_handle);
+ if (i != DDI_SUCCESS) {
+
+ switch (i) {
+ case DDI_DMA_BADATTR :
+ con_log(CL_ANN, (CE_WARN,
+ "Failed ddi_dma_alloc_handle- Bad attribute"));
+ break;
+ case DDI_DMA_NORESOURCES :
+ con_log(CL_ANN, (CE_WARN,
+ "Failed ddi_dma_alloc_handle- No Resources"));
+ break;
+ default :
+ con_log(CL_ANN, (CE_WARN,
+ "Failed ddi_dma_alloc_handle: "
+ "unknown status %d", i));
+ break;
+ }
+
+ return (-1);
+ }
+
+ if ((ddi_dma_mem_alloc(obj->dma_handle, obj->size, &tmp_endian_attr,
+ DDI_DMA_RDWR | DDI_DMA_STREAMING, DDI_DMA_SLEEP, NULL,
+ &obj->buffer, &alen, &obj->acc_handle) != DDI_SUCCESS) ||
+ alen < obj->size) {
+
+ ddi_dma_free_handle(&obj->dma_handle);
+
+ con_log(CL_ANN, (CE_WARN, "Failed : ddi_dma_mem_alloc"));
+
+ return (-1);
+ }
+
+ if (ddi_dma_addr_bind_handle(obj->dma_handle, NULL, obj->buffer,
+ obj->size, DDI_DMA_RDWR | DDI_DMA_STREAMING, DDI_DMA_SLEEP,
+ NULL, &obj->dma_cookie[0], &cookie_cnt) != DDI_SUCCESS) {
+
+ ddi_dma_mem_free(&obj->acc_handle);
+ ddi_dma_free_handle(&obj->dma_handle);
+
+ con_log(CL_ANN, (CE_WARN, "Failed : ddi_dma_addr_bind_handle"));
+
+ return (-1);
+ }
+
+ if (drsas_check_dma_handle(obj->dma_handle) != DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_LOST);
+ return (-1);
+ }
+
+ if (drsas_check_acc_handle(obj->acc_handle) != DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_LOST);
+ return (-1);
+ }
+
+ return (cookie_cnt);
+}
+
+/*
+ * drsas_free_dma_obj(struct drsas_instance *, dma_obj_t)
+ *
+ * De-allocate the memory and other resources for an dma object, which must
+ * have been alloated by a previous call to drsas_alloc_dma_obj()
+ */
+static int
+drsas_free_dma_obj(struct drsas_instance *instance, dma_obj_t obj)
+{
+
+ if (drsas_check_dma_handle(obj.dma_handle) != DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_UNAFFECTED);
+ return (DDI_FAILURE);
+ }
+
+ if (drsas_check_acc_handle(obj.acc_handle) != DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_UNAFFECTED);
+ return (DDI_FAILURE);
+ }
+
+ (void) ddi_dma_unbind_handle(obj.dma_handle);
+ ddi_dma_mem_free(&obj.acc_handle);
+ ddi_dma_free_handle(&obj.dma_handle);
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * drsas_dma_alloc(instance_t *, struct scsi_pkt *, struct buf *,
+ * int, int (*)())
+ *
+ * Allocate dma resources for a new scsi command
+ */
+static int
+drsas_dma_alloc(struct drsas_instance *instance, struct scsi_pkt *pkt,
+ struct buf *bp, int flags, int (*callback)())
+{
+ int dma_flags;
+ int (*cb)(caddr_t);
+ int i;
+
+ ddi_dma_attr_t tmp_dma_attr = drsas_generic_dma_attr;
+ struct scsa_cmd *acmd = PKT2CMD(pkt);
+
+ acmd->cmd_buf = bp;
+
+ if (bp->b_flags & B_READ) {
+ acmd->cmd_flags &= ~CFLAG_DMASEND;
+ dma_flags = DDI_DMA_READ;
+ } else {
+ acmd->cmd_flags |= CFLAG_DMASEND;
+ dma_flags = DDI_DMA_WRITE;
+ }
+
+ if (flags & PKT_CONSISTENT) {
+ acmd->cmd_flags |= CFLAG_CONSISTENT;
+ dma_flags |= DDI_DMA_CONSISTENT;
+ }
+
+ if (flags & PKT_DMA_PARTIAL) {
+ dma_flags |= DDI_DMA_PARTIAL;
+ }
+
+ dma_flags |= DDI_DMA_REDZONE;
+
+ cb = (callback == NULL_FUNC) ? DDI_DMA_DONTWAIT : DDI_DMA_SLEEP;
+
+ tmp_dma_attr.dma_attr_sgllen = instance->max_num_sge;
+ tmp_dma_attr.dma_attr_addr_hi = 0xffffffffffffffffull;
+
+ if ((i = ddi_dma_alloc_handle(instance->dip, &tmp_dma_attr,
+ cb, 0, &acmd->cmd_dmahandle)) != DDI_SUCCESS) {
+ switch (i) {
+ case DDI_DMA_BADATTR:
+ bioerror(bp, EFAULT);
+ return (DDI_FAILURE);
+
+ case DDI_DMA_NORESOURCES:
+ bioerror(bp, 0);
+ return (DDI_FAILURE);
+
+ default:
+ con_log(CL_ANN, (CE_PANIC, "ddi_dma_alloc_handle: "
+ "impossible result (0x%x)", i));
+ bioerror(bp, EFAULT);
+ return (DDI_FAILURE);
+ }
+ }
+
+ i = ddi_dma_buf_bind_handle(acmd->cmd_dmahandle, bp, dma_flags,
+ cb, 0, &acmd->cmd_dmacookies[0], &acmd->cmd_ncookies);
+
+ switch (i) {
+ case DDI_DMA_PARTIAL_MAP:
+ if ((dma_flags & DDI_DMA_PARTIAL) == 0) {
+ con_log(CL_ANN, (CE_PANIC, "ddi_dma_buf_bind_handle: "
+ "DDI_DMA_PARTIAL_MAP impossible"));
+ goto no_dma_cookies;
+ }
+
+ if (ddi_dma_numwin(acmd->cmd_dmahandle, &acmd->cmd_nwin) ==
+ DDI_FAILURE) {
+ con_log(CL_ANN, (CE_PANIC, "ddi_dma_numwin failed"));
+ goto no_dma_cookies;
+ }
+
+ if (ddi_dma_getwin(acmd->cmd_dmahandle, acmd->cmd_curwin,
+ &acmd->cmd_dma_offset, &acmd->cmd_dma_len,
+ &acmd->cmd_dmacookies[0], &acmd->cmd_ncookies) ==
+ DDI_FAILURE) {
+
+ con_log(CL_ANN, (CE_PANIC, "ddi_dma_getwin failed"));
+ goto no_dma_cookies;
+ }
+
+ goto get_dma_cookies;
+ case DDI_DMA_MAPPED:
+ acmd->cmd_nwin = 1;
+ acmd->cmd_dma_len = 0;
+ acmd->cmd_dma_offset = 0;
+
+get_dma_cookies:
+ i = 0;
+ acmd->cmd_dmacount = 0;
+ for (;;) {
+ acmd->cmd_dmacount +=
+ acmd->cmd_dmacookies[i++].dmac_size;
+
+ if (i == instance->max_num_sge ||
+ i == acmd->cmd_ncookies)
+ break;
+
+ ddi_dma_nextcookie(acmd->cmd_dmahandle,
+ &acmd->cmd_dmacookies[i]);
+ }
+
+ acmd->cmd_cookie = i;
+ acmd->cmd_cookiecnt = i;
+
+ acmd->cmd_flags |= CFLAG_DMAVALID;
+
+ if (bp->b_bcount >= acmd->cmd_dmacount) {
+ pkt->pkt_resid = bp->b_bcount - acmd->cmd_dmacount;
+ } else {
+ pkt->pkt_resid = 0;
+ }
+
+ return (DDI_SUCCESS);
+ case DDI_DMA_NORESOURCES:
+ bioerror(bp, 0);
+ break;
+ case DDI_DMA_NOMAPPING:
+ bioerror(bp, EFAULT);
+ break;
+ case DDI_DMA_TOOBIG:
+ bioerror(bp, EINVAL);
+ break;
+ case DDI_DMA_INUSE:
+ con_log(CL_ANN, (CE_PANIC, "ddi_dma_buf_bind_handle:"
+ " DDI_DMA_INUSE impossible"));
+ break;
+ default:
+ con_log(CL_ANN, (CE_PANIC, "ddi_dma_buf_bind_handle: "
+ "impossible result (0x%x)", i));
+ break;
+ }
+
+no_dma_cookies:
+ ddi_dma_free_handle(&acmd->cmd_dmahandle);
+ acmd->cmd_dmahandle = NULL;
+ acmd->cmd_flags &= ~CFLAG_DMAVALID;
+ return (DDI_FAILURE);
+}
+
+/*
+ * drsas_dma_move(struct drsas_instance *, struct scsi_pkt *, struct buf *)
+ *
+ * move dma resources to next dma window
+ *
+ */
+static int
+drsas_dma_move(struct drsas_instance *instance, struct scsi_pkt *pkt,
+ struct buf *bp)
+{
+ int i = 0;
+
+ struct scsa_cmd *acmd = PKT2CMD(pkt);
+
+ /*
+ * If there are no more cookies remaining in this window,
+ * must move to the next window first.
+ */
+ if (acmd->cmd_cookie == acmd->cmd_ncookies) {
+ if (acmd->cmd_curwin == acmd->cmd_nwin && acmd->cmd_nwin == 1) {
+ return (DDI_SUCCESS);
+ }
+
+ /* at last window, cannot move */
+ if (++acmd->cmd_curwin >= acmd->cmd_nwin) {
+ return (DDI_FAILURE);
+ }
+
+ if (ddi_dma_getwin(acmd->cmd_dmahandle, acmd->cmd_curwin,
+ &acmd->cmd_dma_offset, &acmd->cmd_dma_len,
+ &acmd->cmd_dmacookies[0], &acmd->cmd_ncookies) ==
+ DDI_FAILURE) {
+ return (DDI_FAILURE);
+ }
+
+ acmd->cmd_cookie = 0;
+ } else {
+ /* still more cookies in this window - get the next one */
+ ddi_dma_nextcookie(acmd->cmd_dmahandle,
+ &acmd->cmd_dmacookies[0]);
+ }
+
+ /* get remaining cookies in this window, up to our maximum */
+ for (;;) {
+ acmd->cmd_dmacount += acmd->cmd_dmacookies[i++].dmac_size;
+ acmd->cmd_cookie++;
+
+ if (i == instance->max_num_sge ||
+ acmd->cmd_cookie == acmd->cmd_ncookies) {
+ break;
+ }
+
+ ddi_dma_nextcookie(acmd->cmd_dmahandle,
+ &acmd->cmd_dmacookies[i]);
+ }
+
+ acmd->cmd_cookiecnt = i;
+
+ if (bp->b_bcount >= acmd->cmd_dmacount) {
+ pkt->pkt_resid = bp->b_bcount - acmd->cmd_dmacount;
+ } else {
+ pkt->pkt_resid = 0;
+ }
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * build_cmd
+ */
+static struct drsas_cmd *
+build_cmd(struct drsas_instance *instance, struct scsi_address *ap,
+ struct scsi_pkt *pkt, uchar_t *cmd_done)
+{
+ uint16_t flags = 0;
+ uint32_t i;
+ uint32_t context;
+ uint32_t sge_bytes;
+ ddi_acc_handle_t acc_handle;
+ struct drsas_cmd *cmd;
+ struct drsas_sge64 *mfi_sgl;
+ struct scsa_cmd *acmd = PKT2CMD(pkt);
+ struct drsas_pthru_frame *pthru;
+ struct drsas_io_frame *ldio;
+
+ /* find out if this is logical or physical drive command. */
+ acmd->islogical = MRDRV_IS_LOGICAL(ap);
+ acmd->device_id = MAP_DEVICE_ID(instance, ap);
+ *cmd_done = 0;
+
+ /* get the command packet */
+ if (!(cmd = get_mfi_pkt(instance))) {
+ return (NULL);
+ }
+
+ acc_handle = cmd->frame_dma_obj.acc_handle;
+
+ /* Clear the frame buffer and assign back the context id */
+ (void) memset((char *)&cmd->frame[0], 0, sizeof (union drsas_frame));
+ ddi_put32(acc_handle, &cmd->frame->hdr.context, cmd->index);
+
+ cmd->pkt = pkt;
+ cmd->cmd = acmd;
+
+ /* lets get the command directions */
+ if (acmd->cmd_flags & CFLAG_DMASEND) {
+ flags = MFI_FRAME_DIR_WRITE;
+
+ if (acmd->cmd_flags & CFLAG_CONSISTENT) {
+ (void) ddi_dma_sync(acmd->cmd_dmahandle,
+ acmd->cmd_dma_offset, acmd->cmd_dma_len,
+ DDI_DMA_SYNC_FORDEV);
+ }
+ } else if (acmd->cmd_flags & ~CFLAG_DMASEND) {
+ flags = MFI_FRAME_DIR_READ;
+
+ if (acmd->cmd_flags & CFLAG_CONSISTENT) {
+ (void) ddi_dma_sync(acmd->cmd_dmahandle,
+ acmd->cmd_dma_offset, acmd->cmd_dma_len,
+ DDI_DMA_SYNC_FORCPU);
+ }
+ } else {
+ flags = MFI_FRAME_DIR_NONE;
+ }
+
+ flags |= MFI_FRAME_SGL64;
+
+ switch (pkt->pkt_cdbp[0]) {
+
+ /*
+ * case SCMD_SYNCHRONIZE_CACHE:
+ * flush_cache(instance);
+ * return_mfi_pkt(instance, cmd);
+ * *cmd_done = 1;
+ *
+ * return (NULL);
+ */
+
+ case SCMD_READ:
+ case SCMD_WRITE:
+ case SCMD_READ_G1:
+ case SCMD_WRITE_G1:
+ if (acmd->islogical) {
+ ldio = (struct drsas_io_frame *)cmd->frame;
+
+ /*
+ * preare the Logical IO frame:
+ * 2nd bit is zero for all read cmds
+ */
+ ddi_put8(acc_handle, &ldio->cmd,
+ (pkt->pkt_cdbp[0] & 0x02) ? MFI_CMD_OP_LD_WRITE
+ : MFI_CMD_OP_LD_READ);
+ ddi_put8(acc_handle, &ldio->cmd_status, 0x0);
+ ddi_put8(acc_handle, &ldio->scsi_status, 0x0);
+ ddi_put8(acc_handle, &ldio->target_id, acmd->device_id);
+ ddi_put16(acc_handle, &ldio->timeout, 0);
+ ddi_put8(acc_handle, &ldio->reserved_0, 0);
+ ddi_put16(acc_handle, &ldio->pad_0, 0);
+ ddi_put16(acc_handle, &ldio->flags, flags);
+
+ /* Initialize sense Information */
+ bzero(cmd->sense, SENSE_LENGTH);
+ ddi_put8(acc_handle, &ldio->sense_len, SENSE_LENGTH);
+ ddi_put32(acc_handle, &ldio->sense_buf_phys_addr_hi, 0);
+ ddi_put32(acc_handle, &ldio->sense_buf_phys_addr_lo,
+ cmd->sense_phys_addr);
+ ddi_put32(acc_handle, &ldio->start_lba_hi, 0);
+ ddi_put8(acc_handle, &ldio->access_byte,
+ (acmd->cmd_cdblen != 6) ? pkt->pkt_cdbp[1] : 0);
+ ddi_put8(acc_handle, &ldio->sge_count,
+ acmd->cmd_cookiecnt);
+ mfi_sgl = (struct drsas_sge64 *)&ldio->sgl;
+
+ context = ddi_get32(acc_handle, &ldio->context);
+
+ if (acmd->cmd_cdblen == CDB_GROUP0) {
+ ddi_put32(acc_handle, &ldio->lba_count, (
+ (uint16_t)(pkt->pkt_cdbp[4])));
+
+ ddi_put32(acc_handle, &ldio->start_lba_lo, (
+ ((uint32_t)(pkt->pkt_cdbp[3])) |
+ ((uint32_t)(pkt->pkt_cdbp[2]) << 8) |
+ ((uint32_t)((pkt->pkt_cdbp[1]) & 0x1F)
+ << 16)));
+ } else if (acmd->cmd_cdblen == CDB_GROUP1) {
+ ddi_put32(acc_handle, &ldio->lba_count, (
+ ((uint16_t)(pkt->pkt_cdbp[8])) |
+ ((uint16_t)(pkt->pkt_cdbp[7]) << 8)));
+
+ ddi_put32(acc_handle, &ldio->start_lba_lo, (
+ ((uint32_t)(pkt->pkt_cdbp[5])) |
+ ((uint32_t)(pkt->pkt_cdbp[4]) << 8) |
+ ((uint32_t)(pkt->pkt_cdbp[3]) << 16) |
+ ((uint32_t)(pkt->pkt_cdbp[2]) << 24)));
+ } else if (acmd->cmd_cdblen == CDB_GROUP2) {
+ ddi_put32(acc_handle, &ldio->lba_count, (
+ ((uint16_t)(pkt->pkt_cdbp[9])) |
+ ((uint16_t)(pkt->pkt_cdbp[8]) << 8) |
+ ((uint16_t)(pkt->pkt_cdbp[7]) << 16) |
+ ((uint16_t)(pkt->pkt_cdbp[6]) << 24)));
+
+ ddi_put32(acc_handle, &ldio->start_lba_lo, (
+ ((uint32_t)(pkt->pkt_cdbp[5])) |
+ ((uint32_t)(pkt->pkt_cdbp[4]) << 8) |
+ ((uint32_t)(pkt->pkt_cdbp[3]) << 16) |
+ ((uint32_t)(pkt->pkt_cdbp[2]) << 24)));
+ } else if (acmd->cmd_cdblen == CDB_GROUP3) {
+ ddi_put32(acc_handle, &ldio->lba_count, (
+ ((uint16_t)(pkt->pkt_cdbp[13])) |
+ ((uint16_t)(pkt->pkt_cdbp[12]) << 8) |
+ ((uint16_t)(pkt->pkt_cdbp[11]) << 16) |
+ ((uint16_t)(pkt->pkt_cdbp[10]) << 24)));
+
+ ddi_put32(acc_handle, &ldio->start_lba_lo, (
+ ((uint32_t)(pkt->pkt_cdbp[9])) |
+ ((uint32_t)(pkt->pkt_cdbp[8]) << 8) |
+ ((uint32_t)(pkt->pkt_cdbp[7]) << 16) |
+ ((uint32_t)(pkt->pkt_cdbp[6]) << 24)));
+
+ ddi_put32(acc_handle, &ldio->start_lba_lo, (
+ ((uint32_t)(pkt->pkt_cdbp[5])) |
+ ((uint32_t)(pkt->pkt_cdbp[4]) << 8) |
+ ((uint32_t)(pkt->pkt_cdbp[3]) << 16) |
+ ((uint32_t)(pkt->pkt_cdbp[2]) << 24)));
+ }
+
+ break;
+ }
+ /* fall through For all non-rd/wr cmds */
+ default:
+
+ switch (pkt->pkt_cdbp[0]) {
+ case SCMD_MODE_SENSE:
+ case SCMD_MODE_SENSE_G1: {
+ union scsi_cdb *cdbp;
+ uint16_t page_code;
+
+ cdbp = (void *)pkt->pkt_cdbp;
+ page_code = (uint16_t)cdbp->cdb_un.sg.scsi[0];
+ switch (page_code) {
+ case 0x3:
+ case 0x4:
+ (void) drsas_mode_sense_build(pkt);
+ return_mfi_pkt(instance, cmd);
+ *cmd_done = 1;
+ return (NULL);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ pthru = (struct drsas_pthru_frame *)cmd->frame;
+
+ /* prepare the DCDB frame */
+ ddi_put8(acc_handle, &pthru->cmd, (acmd->islogical) ?
+ MFI_CMD_OP_LD_SCSI : MFI_CMD_OP_PD_SCSI);
+ ddi_put8(acc_handle, &pthru->cmd_status, 0x0);
+ ddi_put8(acc_handle, &pthru->scsi_status, 0x0);
+ ddi_put8(acc_handle, &pthru->target_id, acmd->device_id);
+ ddi_put8(acc_handle, &pthru->lun, 0);
+ ddi_put8(acc_handle, &pthru->cdb_len, acmd->cmd_cdblen);
+ ddi_put16(acc_handle, &pthru->timeout, 0);
+ ddi_put16(acc_handle, &pthru->flags, flags);
+ ddi_put32(acc_handle, &pthru->data_xfer_len,
+ acmd->cmd_dmacount);
+ ddi_put8(acc_handle, &pthru->sge_count, acmd->cmd_cookiecnt);
+ mfi_sgl = (struct drsas_sge64 *)&pthru->sgl;
+
+ bzero(cmd->sense, SENSE_LENGTH);
+ ddi_put8(acc_handle, &pthru->sense_len, SENSE_LENGTH);
+ ddi_put32(acc_handle, &pthru->sense_buf_phys_addr_hi, 0);
+ ddi_put32(acc_handle, &pthru->sense_buf_phys_addr_lo,
+ cmd->sense_phys_addr);
+
+ context = ddi_get32(acc_handle, &pthru->context);
+ ddi_rep_put8(acc_handle, (uint8_t *)pkt->pkt_cdbp,
+ (uint8_t *)pthru->cdb, acmd->cmd_cdblen, DDI_DEV_AUTOINCR);
+
+ break;
+ }
+#ifdef lint
+ context = context;
+#endif
+ /* prepare the scatter-gather list for the firmware */
+ for (i = 0; i < acmd->cmd_cookiecnt; i++, mfi_sgl++) {
+ ddi_put64(acc_handle, &mfi_sgl->phys_addr,
+ acmd->cmd_dmacookies[i].dmac_laddress);
+ ddi_put32(acc_handle, &mfi_sgl->length,
+ acmd->cmd_dmacookies[i].dmac_size);
+ }
+
+ sge_bytes = sizeof (struct drsas_sge64)*acmd->cmd_cookiecnt;
+
+ cmd->frame_count = (sge_bytes / MRMFI_FRAME_SIZE) +
+ ((sge_bytes % MRMFI_FRAME_SIZE) ? 1 : 0) + 1;
+
+ if (cmd->frame_count >= 8) {
+ cmd->frame_count = 8;
+ }
+
+ return (cmd);
+}
+
+/*
+ * issue_mfi_pthru
+ */
+static int
+issue_mfi_pthru(struct drsas_instance *instance, struct drsas_ioctl *ioctl,
+ struct drsas_cmd *cmd, int mode)
+{
+ void *ubuf;
+ uint32_t kphys_addr = 0;
+ uint32_t xferlen = 0;
+ uint_t model;
+ ddi_acc_handle_t acc_handle = cmd->frame_dma_obj.acc_handle;
+ dma_obj_t pthru_dma_obj;
+ struct drsas_pthru_frame *kpthru;
+ struct drsas_pthru_frame *pthru;
+ int i;
+ pthru = &cmd->frame->pthru;
+ kpthru = (struct drsas_pthru_frame *)&ioctl->frame[0];
+
+ model = ddi_model_convert_from(mode & FMODELS);
+ if (model == DDI_MODEL_ILP32) {
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_pthru: DDI_MODEL_LP32"));
+
+ xferlen = kpthru->sgl.sge32[0].length;
+
+ ubuf = (void *)(ulong_t)kpthru->sgl.sge32[0].phys_addr;
+ } else {
+#ifdef _ILP32
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_pthru: DDI_MODEL_LP32"));
+ xferlen = kpthru->sgl.sge32[0].length;
+ ubuf = (void *)(ulong_t)kpthru->sgl.sge32[0].phys_addr;
+#else
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_pthru: DDI_MODEL_LP64"));
+ xferlen = kpthru->sgl.sge64[0].length;
+ ubuf = (void *)(ulong_t)kpthru->sgl.sge64[0].phys_addr;
+#endif
+ }
+
+ if (xferlen) {
+ /* means IOCTL requires DMA */
+ /* allocate the data transfer buffer */
+ pthru_dma_obj.size = xferlen;
+ pthru_dma_obj.dma_attr = drsas_generic_dma_attr;
+ pthru_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ pthru_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ pthru_dma_obj.dma_attr.dma_attr_sgllen = 1;
+ pthru_dma_obj.dma_attr.dma_attr_align = 1;
+
+ /* allocate kernel buffer for DMA */
+ if (drsas_alloc_dma_obj(instance, &pthru_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_pthru: "
+ "could not allocate data transfer buffer."));
+ return (DDI_FAILURE);
+ }
+
+ /* If IOCTL requires DMA WRITE, do ddi_copyin IOCTL data copy */
+ if (kpthru->flags & MFI_FRAME_DIR_WRITE) {
+ for (i = 0; i < xferlen; i++) {
+ if (ddi_copyin((uint8_t *)ubuf+i,
+ (uint8_t *)pthru_dma_obj.buffer+i,
+ 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_pthru : "
+ "copy from user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+
+ kphys_addr = pthru_dma_obj.dma_cookie[0].dmac_address;
+ }
+
+ ddi_put8(acc_handle, &pthru->cmd, kpthru->cmd);
+ ddi_put8(acc_handle, &pthru->sense_len, kpthru->sense_len);
+ ddi_put8(acc_handle, &pthru->cmd_status, 0);
+ ddi_put8(acc_handle, &pthru->scsi_status, 0);
+ ddi_put8(acc_handle, &pthru->target_id, kpthru->target_id);
+ ddi_put8(acc_handle, &pthru->lun, kpthru->lun);
+ ddi_put8(acc_handle, &pthru->cdb_len, kpthru->cdb_len);
+ ddi_put8(acc_handle, &pthru->sge_count, kpthru->sge_count);
+ ddi_put16(acc_handle, &pthru->timeout, kpthru->timeout);
+ ddi_put32(acc_handle, &pthru->data_xfer_len, kpthru->data_xfer_len);
+
+ ddi_put32(acc_handle, &pthru->sense_buf_phys_addr_hi, 0);
+ /* pthru->sense_buf_phys_addr_lo = cmd->sense_phys_addr; */
+ ddi_put32(acc_handle, &pthru->sense_buf_phys_addr_lo, 0);
+
+ ddi_rep_put8(acc_handle, (uint8_t *)kpthru->cdb, (uint8_t *)pthru->cdb,
+ pthru->cdb_len, DDI_DEV_AUTOINCR);
+
+ ddi_put16(acc_handle, &pthru->flags, kpthru->flags & ~MFI_FRAME_SGL64);
+ ddi_put32(acc_handle, &pthru->sgl.sge32[0].length, xferlen);
+ ddi_put32(acc_handle, &pthru->sgl.sge32[0].phys_addr, kphys_addr);
+
+ cmd->sync_cmd = DRSAS_TRUE;
+ cmd->frame_count = 1;
+
+ if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_pthru: fw_ioctl failed"));
+ } else {
+ if (xferlen && kpthru->flags & MFI_FRAME_DIR_READ) {
+ for (i = 0; i < xferlen; i++) {
+ if (ddi_copyout(
+ (uint8_t *)pthru_dma_obj.buffer+i,
+ (uint8_t *)ubuf+i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_pthru : "
+ "copy to user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+ }
+
+ kpthru->cmd_status = ddi_get8(acc_handle, &pthru->cmd_status);
+ kpthru->scsi_status = ddi_get8(acc_handle, &pthru->scsi_status);
+
+ con_log(CL_ANN, (CE_NOTE, "issue_mfi_pthru: cmd_status %x, "
+ "scsi_status %x", kpthru->cmd_status, kpthru->scsi_status));
+
+ if (xferlen) {
+ /* free kernel buffer */
+ if (drsas_free_dma_obj(instance, pthru_dma_obj) != DDI_SUCCESS)
+ return (DDI_FAILURE);
+ }
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * issue_mfi_dcmd
+ */
+static int
+issue_mfi_dcmd(struct drsas_instance *instance, struct drsas_ioctl *ioctl,
+ struct drsas_cmd *cmd, int mode)
+{
+ void *ubuf;
+ uint32_t kphys_addr = 0;
+ uint32_t xferlen = 0;
+ uint32_t model;
+ dma_obj_t dcmd_dma_obj;
+ struct drsas_dcmd_frame *kdcmd;
+ struct drsas_dcmd_frame *dcmd;
+ ddi_acc_handle_t acc_handle = cmd->frame_dma_obj.acc_handle;
+ int i;
+ dcmd = &cmd->frame->dcmd;
+ kdcmd = (struct drsas_dcmd_frame *)&ioctl->frame[0];
+
+ model = ddi_model_convert_from(mode & FMODELS);
+ if (model == DDI_MODEL_ILP32) {
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_dcmd: DDI_MODEL_ILP32"));
+
+ xferlen = kdcmd->sgl.sge32[0].length;
+
+ ubuf = (void *)(ulong_t)kdcmd->sgl.sge32[0].phys_addr;
+ } else {
+#ifdef _ILP32
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_dcmd: DDI_MODEL_ILP32"));
+ xferlen = kdcmd->sgl.sge32[0].length;
+ ubuf = (void *)(ulong_t)kdcmd->sgl.sge32[0].phys_addr;
+#else
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_dcmd: DDI_MODEL_LP64"));
+ xferlen = kdcmd->sgl.sge64[0].length;
+ ubuf = (void *)(ulong_t)kdcmd->sgl.sge64[0].phys_addr;
+#endif
+ }
+ if (xferlen) {
+ /* means IOCTL requires DMA */
+ /* allocate the data transfer buffer */
+ dcmd_dma_obj.size = xferlen;
+ dcmd_dma_obj.dma_attr = drsas_generic_dma_attr;
+ dcmd_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ dcmd_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ dcmd_dma_obj.dma_attr.dma_attr_sgllen = 1;
+ dcmd_dma_obj.dma_attr.dma_attr_align = 1;
+
+ /* allocate kernel buffer for DMA */
+ if (drsas_alloc_dma_obj(instance, &dcmd_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_dcmd: "
+ "could not allocate data transfer buffer."));
+ return (DDI_FAILURE);
+ }
+
+ /* If IOCTL requires DMA WRITE, do ddi_copyin IOCTL data copy */
+ if (kdcmd->flags & MFI_FRAME_DIR_WRITE) {
+ for (i = 0; i < xferlen; i++) {
+ if (ddi_copyin((uint8_t *)ubuf + i,
+ (uint8_t *)dcmd_dma_obj.buffer + i,
+ 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_dcmd : "
+ "copy from user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+
+ kphys_addr = dcmd_dma_obj.dma_cookie[0].dmac_address;
+ }
+
+ ddi_put8(acc_handle, &dcmd->cmd, kdcmd->cmd);
+ ddi_put8(acc_handle, &dcmd->cmd_status, 0);
+ ddi_put8(acc_handle, &dcmd->sge_count, kdcmd->sge_count);
+ ddi_put16(acc_handle, &dcmd->timeout, kdcmd->timeout);
+ ddi_put32(acc_handle, &dcmd->data_xfer_len, kdcmd->data_xfer_len);
+ ddi_put32(acc_handle, &dcmd->opcode, kdcmd->opcode);
+
+ ddi_rep_put8(acc_handle, (uint8_t *)kdcmd->mbox.b,
+ (uint8_t *)dcmd->mbox.b, DCMD_MBOX_SZ, DDI_DEV_AUTOINCR);
+
+ ddi_put16(acc_handle, &dcmd->flags, kdcmd->flags & ~MFI_FRAME_SGL64);
+ ddi_put32(acc_handle, &dcmd->sgl.sge32[0].length, xferlen);
+ ddi_put32(acc_handle, &dcmd->sgl.sge32[0].phys_addr, kphys_addr);
+
+ cmd->sync_cmd = DRSAS_TRUE;
+ cmd->frame_count = 1;
+
+ if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_dcmd: fw_ioctl failed"));
+ } else {
+ if (xferlen && (kdcmd->flags & MFI_FRAME_DIR_READ)) {
+ for (i = 0; i < xferlen; i++) {
+ if (ddi_copyout(
+ (uint8_t *)dcmd_dma_obj.buffer + i,
+ (uint8_t *)ubuf + i,
+ 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_dcmd : "
+ "copy to user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+ }
+
+ kdcmd->cmd_status = ddi_get8(acc_handle, &dcmd->cmd_status);
+
+ if (xferlen) {
+ /* free kernel buffer */
+ if (drsas_free_dma_obj(instance, dcmd_dma_obj) != DDI_SUCCESS)
+ return (DDI_FAILURE);
+ }
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * issue_mfi_smp
+ */
+static int
+issue_mfi_smp(struct drsas_instance *instance, struct drsas_ioctl *ioctl,
+ struct drsas_cmd *cmd, int mode)
+{
+ void *request_ubuf;
+ void *response_ubuf;
+ uint32_t request_xferlen = 0;
+ uint32_t response_xferlen = 0;
+ uint_t model;
+ dma_obj_t request_dma_obj;
+ dma_obj_t response_dma_obj;
+ ddi_acc_handle_t acc_handle = cmd->frame_dma_obj.acc_handle;
+ struct drsas_smp_frame *ksmp;
+ struct drsas_smp_frame *smp;
+ struct drsas_sge32 *sge32;
+#ifndef _ILP32
+ struct drsas_sge64 *sge64;
+#endif
+ int i;
+ uint64_t tmp_sas_addr;
+
+ smp = &cmd->frame->smp;
+ ksmp = (struct drsas_smp_frame *)&ioctl->frame[0];
+
+ model = ddi_model_convert_from(mode & FMODELS);
+ if (model == DDI_MODEL_ILP32) {
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_smp: DDI_MODEL_ILP32"));
+
+ sge32 = &ksmp->sgl[0].sge32[0];
+ response_xferlen = sge32[0].length;
+ request_xferlen = sge32[1].length;
+ con_log(CL_ANN, (CE_NOTE, "issue_mfi_smp: "
+ "response_xferlen = %x, request_xferlen = %x",
+ response_xferlen, request_xferlen));
+
+ response_ubuf = (void *)(ulong_t)sge32[0].phys_addr;
+ request_ubuf = (void *)(ulong_t)sge32[1].phys_addr;
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_smp: "
+ "response_ubuf = %p, request_ubuf = %p",
+ response_ubuf, request_ubuf));
+ } else {
+#ifdef _ILP32
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_smp: DDI_MODEL_ILP32"));
+
+ sge32 = &ksmp->sgl[0].sge32[0];
+ response_xferlen = sge32[0].length;
+ request_xferlen = sge32[1].length;
+ con_log(CL_ANN, (CE_NOTE, "issue_mfi_smp: "
+ "response_xferlen = %x, request_xferlen = %x",
+ response_xferlen, request_xferlen));
+
+ response_ubuf = (void *)(ulong_t)sge32[0].phys_addr;
+ request_ubuf = (void *)(ulong_t)sge32[1].phys_addr;
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_smp: "
+ "response_ubuf = %p, request_ubuf = %p",
+ response_ubuf, request_ubuf));
+#else
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_smp: DDI_MODEL_LP64"));
+
+ sge64 = &ksmp->sgl[0].sge64[0];
+ response_xferlen = sge64[0].length;
+ request_xferlen = sge64[1].length;
+
+ response_ubuf = (void *)(ulong_t)sge64[0].phys_addr;
+ request_ubuf = (void *)(ulong_t)sge64[1].phys_addr;
+#endif
+ }
+ if (request_xferlen) {
+ /* means IOCTL requires DMA */
+ /* allocate the data transfer buffer */
+ request_dma_obj.size = request_xferlen;
+ request_dma_obj.dma_attr = drsas_generic_dma_attr;
+ request_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ request_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ request_dma_obj.dma_attr.dma_attr_sgllen = 1;
+ request_dma_obj.dma_attr.dma_attr_align = 1;
+
+ /* allocate kernel buffer for DMA */
+ if (drsas_alloc_dma_obj(instance, &request_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_smp: "
+ "could not allocate data transfer buffer."));
+ return (DDI_FAILURE);
+ }
+
+ /* If IOCTL requires DMA WRITE, do ddi_copyin IOCTL data copy */
+ for (i = 0; i < request_xferlen; i++) {
+ if (ddi_copyin((uint8_t *)request_ubuf + i,
+ (uint8_t *)request_dma_obj.buffer + i,
+ 1, mode)) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_smp: "
+ "copy from user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+
+ if (response_xferlen) {
+ /* means IOCTL requires DMA */
+ /* allocate the data transfer buffer */
+ response_dma_obj.size = response_xferlen;
+ response_dma_obj.dma_attr = drsas_generic_dma_attr;
+ response_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ response_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ response_dma_obj.dma_attr.dma_attr_sgllen = 1;
+ response_dma_obj.dma_attr.dma_attr_align = 1;
+
+ /* allocate kernel buffer for DMA */
+ if (drsas_alloc_dma_obj(instance, &response_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_smp: "
+ "could not allocate data transfer buffer."));
+ return (DDI_FAILURE);
+ }
+
+ /* If IOCTL requires DMA WRITE, do ddi_copyin IOCTL data copy */
+ for (i = 0; i < response_xferlen; i++) {
+ if (ddi_copyin((uint8_t *)response_ubuf + i,
+ (uint8_t *)response_dma_obj.buffer + i,
+ 1, mode)) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_smp: "
+ "copy from user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+
+ ddi_put8(acc_handle, &smp->cmd, ksmp->cmd);
+ ddi_put8(acc_handle, &smp->cmd_status, 0);
+ ddi_put8(acc_handle, &smp->connection_status, 0);
+ ddi_put8(acc_handle, &smp->sge_count, ksmp->sge_count);
+ /* smp->context = ksmp->context; */
+ ddi_put16(acc_handle, &smp->timeout, ksmp->timeout);
+ ddi_put32(acc_handle, &smp->data_xfer_len, ksmp->data_xfer_len);
+
+ bcopy((void *)&ksmp->sas_addr, (void *)&tmp_sas_addr,
+ sizeof (uint64_t));
+ ddi_put64(acc_handle, &smp->sas_addr, tmp_sas_addr);
+
+ ddi_put16(acc_handle, &smp->flags, ksmp->flags & ~MFI_FRAME_SGL64);
+
+ model = ddi_model_convert_from(mode & FMODELS);
+ if (model == DDI_MODEL_ILP32) {
+ con_log(CL_ANN1, (CE_NOTE,
+ "handle_drv_ioctl: DDI_MODEL_ILP32"));
+
+ sge32 = &smp->sgl[0].sge32[0];
+ ddi_put32(acc_handle, &sge32[0].length, response_xferlen);
+ ddi_put32(acc_handle, &sge32[0].phys_addr,
+ response_dma_obj.dma_cookie[0].dmac_address);
+ ddi_put32(acc_handle, &sge32[1].length, request_xferlen);
+ ddi_put32(acc_handle, &sge32[1].phys_addr,
+ request_dma_obj.dma_cookie[0].dmac_address);
+ } else {
+#ifdef _ILP32
+ con_log(CL_ANN1, (CE_NOTE,
+ "handle_drv_ioctl: DDI_MODEL_ILP32"));
+ sge32 = &smp->sgl[0].sge32[0];
+ ddi_put32(acc_handle, &sge32[0].length, response_xferlen);
+ ddi_put32(acc_handle, &sge32[0].phys_addr,
+ response_dma_obj.dma_cookie[0].dmac_address);
+ ddi_put32(acc_handle, &sge32[1].length, request_xferlen);
+ ddi_put32(acc_handle, &sge32[1].phys_addr,
+ request_dma_obj.dma_cookie[0].dmac_address);
+#else
+ con_log(CL_ANN1, (CE_NOTE,
+ "issue_mfi_smp: DDI_MODEL_LP64"));
+ sge64 = &smp->sgl[0].sge64[0];
+ ddi_put32(acc_handle, &sge64[0].length, response_xferlen);
+ ddi_put64(acc_handle, &sge64[0].phys_addr,
+ response_dma_obj.dma_cookie[0].dmac_address);
+ ddi_put32(acc_handle, &sge64[1].length, request_xferlen);
+ ddi_put64(acc_handle, &sge64[1].phys_addr,
+ request_dma_obj.dma_cookie[0].dmac_address);
+#endif
+ }
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_smp : "
+ "smp->response_xferlen = %d, smp->request_xferlen = %d "
+ "smp->data_xfer_len = %d", ddi_get32(acc_handle, &sge32[0].length),
+ ddi_get32(acc_handle, &sge32[1].length),
+ ddi_get32(acc_handle, &smp->data_xfer_len)));
+
+ cmd->sync_cmd = DRSAS_TRUE;
+ cmd->frame_count = 1;
+
+ if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_smp: fw_ioctl failed"));
+ } else {
+ con_log(CL_ANN1, (CE_NOTE,
+ "issue_mfi_smp: copy to user space"));
+
+ if (request_xferlen) {
+ for (i = 0; i < request_xferlen; i++) {
+ if (ddi_copyout(
+ (uint8_t *)request_dma_obj.buffer +
+ i, (uint8_t *)request_ubuf + i,
+ 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_smp : copy to user space"
+ " failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+
+ if (response_xferlen) {
+ for (i = 0; i < response_xferlen; i++) {
+ if (ddi_copyout(
+ (uint8_t *)response_dma_obj.buffer
+ + i, (uint8_t *)response_ubuf
+ + i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_smp : copy to "
+ "user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+ }
+
+ ksmp->cmd_status = ddi_get8(acc_handle, &smp->cmd_status);
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_smp: smp->cmd_status = %d",
+ ddi_get8(acc_handle, &smp->cmd_status)));
+
+
+ if (request_xferlen) {
+ /* free kernel buffer */
+ if (drsas_free_dma_obj(instance, request_dma_obj) !=
+ DDI_SUCCESS)
+ return (DDI_FAILURE);
+ }
+
+ if (response_xferlen) {
+ /* free kernel buffer */
+ if (drsas_free_dma_obj(instance, response_dma_obj) !=
+ DDI_SUCCESS)
+ return (DDI_FAILURE);
+ }
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * issue_mfi_stp
+ */
+static int
+issue_mfi_stp(struct drsas_instance *instance, struct drsas_ioctl *ioctl,
+ struct drsas_cmd *cmd, int mode)
+{
+ void *fis_ubuf;
+ void *data_ubuf;
+ uint32_t fis_xferlen = 0;
+ uint32_t data_xferlen = 0;
+ uint_t model;
+ dma_obj_t fis_dma_obj;
+ dma_obj_t data_dma_obj;
+ struct drsas_stp_frame *kstp;
+ struct drsas_stp_frame *stp;
+ ddi_acc_handle_t acc_handle = cmd->frame_dma_obj.acc_handle;
+ int i;
+
+ stp = &cmd->frame->stp;
+ kstp = (struct drsas_stp_frame *)&ioctl->frame[0];
+
+ model = ddi_model_convert_from(mode & FMODELS);
+ if (model == DDI_MODEL_ILP32) {
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_stp: DDI_MODEL_ILP32"));
+
+ fis_xferlen = kstp->sgl.sge32[0].length;
+ data_xferlen = kstp->sgl.sge32[1].length;
+
+ fis_ubuf = (void *)(ulong_t)kstp->sgl.sge32[0].phys_addr;
+ data_ubuf = (void *)(ulong_t)kstp->sgl.sge32[1].phys_addr;
+ }
+ else
+ {
+#ifdef _ILP32
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_stp: DDI_MODEL_ILP32"));
+
+ fis_xferlen = kstp->sgl.sge32[0].length;
+ data_xferlen = kstp->sgl.sge32[1].length;
+
+ fis_ubuf = (void *)(ulong_t)kstp->sgl.sge32[0].phys_addr;
+ data_ubuf = (void *)(ulong_t)kstp->sgl.sge32[1].phys_addr;
+#else
+ con_log(CL_ANN1, (CE_NOTE, "issue_mfi_stp: DDI_MODEL_LP64"));
+
+ fis_xferlen = kstp->sgl.sge64[0].length;
+ data_xferlen = kstp->sgl.sge64[1].length;
+
+ fis_ubuf = (void *)(ulong_t)kstp->sgl.sge64[0].phys_addr;
+ data_ubuf = (void *)(ulong_t)kstp->sgl.sge64[1].phys_addr;
+#endif
+ }
+
+
+ if (fis_xferlen) {
+ con_log(CL_ANN, (CE_NOTE, "issue_mfi_stp: "
+ "fis_ubuf = %p fis_xferlen = %x", fis_ubuf, fis_xferlen));
+
+ /* means IOCTL requires DMA */
+ /* allocate the data transfer buffer */
+ fis_dma_obj.size = fis_xferlen;
+ fis_dma_obj.dma_attr = drsas_generic_dma_attr;
+ fis_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ fis_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ fis_dma_obj.dma_attr.dma_attr_sgllen = 1;
+ fis_dma_obj.dma_attr.dma_attr_align = 1;
+
+ /* allocate kernel buffer for DMA */
+ if (drsas_alloc_dma_obj(instance, &fis_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_stp : "
+ "could not allocate data transfer buffer."));
+ return (DDI_FAILURE);
+ }
+
+ /* If IOCTL requires DMA WRITE, do ddi_copyin IOCTL data copy */
+ for (i = 0; i < fis_xferlen; i++) {
+ if (ddi_copyin((uint8_t *)fis_ubuf + i,
+ (uint8_t *)fis_dma_obj.buffer + i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_stp: "
+ "copy from user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+
+ if (data_xferlen) {
+ con_log(CL_ANN, (CE_NOTE, "issue_mfi_stp: data_ubuf = %p "
+ "data_xferlen = %x", data_ubuf, data_xferlen));
+
+ /* means IOCTL requires DMA */
+ /* allocate the data transfer buffer */
+ data_dma_obj.size = data_xferlen;
+ data_dma_obj.dma_attr = drsas_generic_dma_attr;
+ data_dma_obj.dma_attr.dma_attr_addr_hi = 0xFFFFFFFFU;
+ data_dma_obj.dma_attr.dma_attr_count_max = 0xFFFFFFFFU;
+ data_dma_obj.dma_attr.dma_attr_sgllen = 1;
+ data_dma_obj.dma_attr.dma_attr_align = 1;
+
+/* allocate kernel buffer for DMA */
+ if (drsas_alloc_dma_obj(instance, &data_dma_obj,
+ (uchar_t)DDI_STRUCTURE_LE_ACC) != 1) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_stp: "
+ "could not allocate data transfer buffer."));
+ return (DDI_FAILURE);
+ }
+
+ /* If IOCTL requires DMA WRITE, do ddi_copyin IOCTL data copy */
+ for (i = 0; i < data_xferlen; i++) {
+ if (ddi_copyin((uint8_t *)data_ubuf + i,
+ (uint8_t *)data_dma_obj.buffer + i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_stp: "
+ "copy from user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+
+ ddi_put8(acc_handle, &stp->cmd, kstp->cmd);
+ ddi_put8(acc_handle, &stp->cmd_status, 0);
+ ddi_put8(acc_handle, &stp->connection_status, 0);
+ ddi_put8(acc_handle, &stp->target_id, kstp->target_id);
+ ddi_put8(acc_handle, &stp->sge_count, kstp->sge_count);
+
+ ddi_put16(acc_handle, &stp->timeout, kstp->timeout);
+ ddi_put32(acc_handle, &stp->data_xfer_len, kstp->data_xfer_len);
+
+ ddi_rep_put8(acc_handle, (uint8_t *)kstp->fis, (uint8_t *)stp->fis, 10,
+ DDI_DEV_AUTOINCR);
+
+ ddi_put16(acc_handle, &stp->flags, kstp->flags & ~MFI_FRAME_SGL64);
+ ddi_put32(acc_handle, &stp->stp_flags, kstp->stp_flags);
+ ddi_put32(acc_handle, &stp->sgl.sge32[0].length, fis_xferlen);
+ ddi_put32(acc_handle, &stp->sgl.sge32[0].phys_addr,
+ fis_dma_obj.dma_cookie[0].dmac_address);
+ ddi_put32(acc_handle, &stp->sgl.sge32[1].length, data_xferlen);
+ ddi_put32(acc_handle, &stp->sgl.sge32[1].phys_addr,
+ data_dma_obj.dma_cookie[0].dmac_address);
+
+ cmd->sync_cmd = DRSAS_TRUE;
+ cmd->frame_count = 1;
+
+ if (instance->func_ptr->issue_cmd_in_sync_mode(instance, cmd)) {
+ con_log(CL_ANN, (CE_WARN, "issue_mfi_stp: fw_ioctl failed"));
+ } else {
+
+ if (fis_xferlen) {
+ for (i = 0; i < fis_xferlen; i++) {
+ if (ddi_copyout(
+ (uint8_t *)fis_dma_obj.buffer + i,
+ (uint8_t *)fis_ubuf + i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_stp : copy to "
+ "user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+ }
+ if (data_xferlen) {
+ for (i = 0; i < data_xferlen; i++) {
+ if (ddi_copyout(
+ (uint8_t *)data_dma_obj.buffer + i,
+ (uint8_t *)data_ubuf + i, 1, mode)) {
+ con_log(CL_ANN, (CE_WARN,
+ "issue_mfi_stp : copy to"
+ " user space failed"));
+ return (DDI_FAILURE);
+ }
+ }
+ }
+
+ kstp->cmd_status = ddi_get8(acc_handle, &stp->cmd_status);
+
+ if (fis_xferlen) {
+ /* free kernel buffer */
+ if (drsas_free_dma_obj(instance, fis_dma_obj) != DDI_SUCCESS)
+ return (DDI_FAILURE);
+ }
+
+ if (data_xferlen) {
+ /* free kernel buffer */
+ if (drsas_free_dma_obj(instance, data_dma_obj) != DDI_SUCCESS)
+ return (DDI_FAILURE);
+ }
+
+ return (DDI_SUCCESS);
+}
+
+/*
+ * fill_up_drv_ver
+ */
+static void
+fill_up_drv_ver(struct drsas_drv_ver *dv)
+{
+ (void) memset(dv, 0, sizeof (struct drsas_drv_ver));
+
+ (void) memcpy(dv->signature, "$LSI LOGIC$", strlen("$LSI LOGIC$"));
+ (void) memcpy(dv->os_name, "Solaris", strlen("Solaris"));
+ (void) memcpy(dv->drv_name, "dr_sas", strlen("dr_sas"));
+ (void) memcpy(dv->drv_ver, DRSAS_VERSION, strlen(DRSAS_VERSION));
+ (void) memcpy(dv->drv_rel_date, DRSAS_RELDATE,
+ strlen(DRSAS_RELDATE));
+}
+
+/*
+ * handle_drv_ioctl
+ */
+static int
+handle_drv_ioctl(struct drsas_instance *instance, struct drsas_ioctl *ioctl,
+ int mode)
+{
+ int i;
+ int rval = DDI_SUCCESS;
+ int *props = NULL;
+ void *ubuf;
+
+ uint8_t *pci_conf_buf;
+ uint32_t xferlen;
+ uint32_t num_props;
+ uint_t model;
+ struct drsas_dcmd_frame *kdcmd;
+ struct drsas_drv_ver dv;
+ struct drsas_pci_information pi;
+
+ kdcmd = (struct drsas_dcmd_frame *)&ioctl->frame[0];
+
+ model = ddi_model_convert_from(mode & FMODELS);
+ if (model == DDI_MODEL_ILP32) {
+ con_log(CL_ANN1, (CE_NOTE,
+ "handle_drv_ioctl: DDI_MODEL_ILP32"));
+
+ xferlen = kdcmd->sgl.sge32[0].length;
+
+ ubuf = (void *)(ulong_t)kdcmd->sgl.sge32[0].phys_addr;
+ } else {
+#ifdef _ILP32
+ con_log(CL_ANN1, (CE_NOTE,
+ "handle_drv_ioctl: DDI_MODEL_ILP32"));
+ xferlen = kdcmd->sgl.sge32[0].length;
+ ubuf = (void *)(ulong_t)kdcmd->sgl.sge32[0].phys_addr;
+#else
+ con_log(CL_ANN1, (CE_NOTE,
+ "handle_drv_ioctl: DDI_MODEL_LP64"));
+ xferlen = kdcmd->sgl.sge64[0].length;
+ ubuf = (void *)(ulong_t)kdcmd->sgl.sge64[0].phys_addr;
+#endif
+ }
+ con_log(CL_ANN1, (CE_NOTE, "handle_drv_ioctl: "
+ "dataBuf=%p size=%d bytes", ubuf, xferlen));
+
+ switch (kdcmd->opcode) {
+ case DRSAS_DRIVER_IOCTL_DRIVER_VERSION:
+ con_log(CL_ANN1, (CE_NOTE, "handle_drv_ioctl: "
+ "DRSAS_DRIVER_IOCTL_DRIVER_VERSION"));
+
+ fill_up_drv_ver(&dv);
+ for (i = 0; i < xferlen; i++) {
+ if (ddi_copyout((uint8_t *)&dv + i, (uint8_t *)ubuf + i,
+ 1, mode)) {
+ con_log(CL_ANN, (CE_WARN, "handle_drv_ioctl: "
+ "DRSAS_DRIVER_IOCTL_DRIVER_VERSION"
+ " : copy to user space failed"));
+ kdcmd->cmd_status = 1;
+ rval = DDI_FAILURE;
+ break;
+ }
+ }
+ if (i == xferlen)
+ kdcmd->cmd_status = 0;
+ break;
+ case DRSAS_DRIVER_IOCTL_PCI_INFORMATION:
+ con_log(CL_ANN1, (CE_NOTE, "handle_drv_ioctl: "
+ "DRSAS_DRIVER_IOCTL_PCI_INFORMAITON"));
+
+ if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, instance->dip,
+ 0, "reg", &props, &num_props)) {
+ con_log(CL_ANN, (CE_WARN, "handle_drv_ioctl: "
+ "DRSAS_DRIVER_IOCTL_PCI_INFORMATION : "
+ "ddi_prop_look_int_array failed"));
+ rval = DDI_FAILURE;
+ } else {
+
+ pi.busNumber = (props[0] >> 16) & 0xFF;
+ pi.deviceNumber = (props[0] >> 11) & 0x1f;
+ pi.functionNumber = (props[0] >> 8) & 0x7;
+ ddi_prop_free((void *)props);
+ }
+
+ pci_conf_buf = (uint8_t *)&pi.pciHeaderInfo;
+
+ for (i = 0; i < (sizeof (struct drsas_pci_information) -
+ offsetof(struct drsas_pci_information, pciHeaderInfo));
+ i++) {
+ pci_conf_buf[i] =
+ pci_config_get8(instance->pci_handle, i);
+ }
+ for (i = 0; i < xferlen; i++) {
+ if (ddi_copyout((uint8_t *)&pi + i, (uint8_t *)ubuf + i,
+ 1, mode)) {
+ con_log(CL_ANN, (CE_WARN, "handle_drv_ioctl: "
+ "DRSAS_DRIVER_IOCTL_PCI_INFORMATION"
+ " : copy to user space failed"));
+ kdcmd->cmd_status = 1;
+ rval = DDI_FAILURE;
+ break;
+ }
+ }
+
+ if (i == xferlen)
+ kdcmd->cmd_status = 0;
+
+ break;
+ default:
+ con_log(CL_ANN, (CE_WARN, "handle_drv_ioctl: "
+ "invalid driver specific IOCTL opcode = 0x%x",
+ kdcmd->opcode));
+ kdcmd->cmd_status = 1;
+ rval = DDI_FAILURE;
+ break;
+ }
+
+ return (rval);
+}
+
+/*
+ * handle_mfi_ioctl
+ */
+static int
+handle_mfi_ioctl(struct drsas_instance *instance, struct drsas_ioctl *ioctl,
+ int mode)
+{
+ int rval = DDI_SUCCESS;
+
+ struct drsas_header *hdr;
+ struct drsas_cmd *cmd;
+
+ cmd = get_mfi_pkt(instance);
+
+ if (!cmd) {
+ con_log(CL_ANN, (CE_WARN, "dr_sas: "
+ "failed to get a cmd packet"));
+ return (DDI_FAILURE);
+ }
+
+ /* Clear the frame buffer and assign back the context id */
+ (void) memset((char *)&cmd->frame[0], 0, sizeof (union drsas_frame));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &cmd->frame->hdr.context,
+ cmd->index);
+
+ hdr = (struct drsas_header *)&ioctl->frame[0];
+
+ switch (hdr->cmd) {
+ case MFI_CMD_OP_DCMD:
+ rval = issue_mfi_dcmd(instance, ioctl, cmd, mode);
+ break;
+ case MFI_CMD_OP_SMP:
+ rval = issue_mfi_smp(instance, ioctl, cmd, mode);
+ break;
+ case MFI_CMD_OP_STP:
+ rval = issue_mfi_stp(instance, ioctl, cmd, mode);
+ break;
+ case MFI_CMD_OP_LD_SCSI:
+ case MFI_CMD_OP_PD_SCSI:
+ rval = issue_mfi_pthru(instance, ioctl, cmd, mode);
+ break;
+ default:
+ con_log(CL_ANN, (CE_WARN, "handle_mfi_ioctl: "
+ "invalid mfi ioctl hdr->cmd = %d", hdr->cmd));
+ rval = DDI_FAILURE;
+ break;
+ }
+
+
+ return_mfi_pkt(instance, cmd);
+ if (drsas_common_check(instance, cmd) != DDI_SUCCESS)
+ rval = DDI_FAILURE;
+ return (rval);
+}
+
+/*
+ * AEN
+ */
+static int
+handle_mfi_aen(struct drsas_instance *instance, struct drsas_aen *aen)
+{
+ int rval = 0;
+
+ rval = register_mfi_aen(instance, instance->aen_seq_num,
+ aen->class_locale_word);
+
+ aen->cmd_status = (uint8_t)rval;
+
+ return (rval);
+}
+
+static int
+register_mfi_aen(struct drsas_instance *instance, uint32_t seq_num,
+ uint32_t class_locale_word)
+{
+ int ret_val;
+
+ struct drsas_cmd *cmd, *aen_cmd;
+ struct drsas_dcmd_frame *dcmd;
+ union drsas_evt_class_locale curr_aen;
+ union drsas_evt_class_locale prev_aen;
+
+ /*
+ * If there an AEN pending already (aen_cmd), check if the
+ * class_locale of that pending AEN is inclusive of the new
+ * AEN request we currently have. If it is, then we don't have
+ * to do anything. In other words, whichever events the current
+ * AEN request is subscribing to, have already been subscribed
+ * to.
+ *
+ * If the old_cmd is _not_ inclusive, then we have to abort
+ * that command, form a class_locale that is superset of both
+ * old and current and re-issue to the FW
+ */
+
+ curr_aen.word = class_locale_word;
+ aen_cmd = instance->aen_cmd;
+ if (aen_cmd) {
+ prev_aen.word = ddi_get32(aen_cmd->frame_dma_obj.acc_handle,
+ &aen_cmd->frame->dcmd.mbox.w[1]);
+
+ /*
+ * A class whose enum value is smaller is inclusive of all
+ * higher values. If a PROGRESS (= -1) was previously
+ * registered, then a new registration requests for higher
+ * classes need not be sent to FW. They are automatically
+ * included.
+ *
+ * Locale numbers don't have such hierarchy. They are bitmap
+ * values
+ */
+ if ((prev_aen.members.class <= curr_aen.members.class) &&
+ !((prev_aen.members.locale & curr_aen.members.locale) ^
+ curr_aen.members.locale)) {
+ /*
+ * Previously issued event registration includes
+ * current request. Nothing to do.
+ */
+
+ return (0);
+ } else {
+ curr_aen.members.locale |= prev_aen.members.locale;
+
+ if (prev_aen.members.class < curr_aen.members.class)
+ curr_aen.members.class = prev_aen.members.class;
+
+ ret_val = abort_aen_cmd(instance, aen_cmd);
+
+ if (ret_val) {
+ con_log(CL_ANN, (CE_WARN, "register_mfi_aen: "
+ "failed to abort prevous AEN command"));
+
+ return (ret_val);
+ }
+ }
+ } else {
+ curr_aen.word = class_locale_word;
+ }
+
+ cmd = get_mfi_pkt(instance);
+
+ if (!cmd)
+ return (ENOMEM);
+ /* Clear the frame buffer and assign back the context id */
+ (void) memset((char *)&cmd->frame[0], 0, sizeof (union drsas_frame));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &cmd->frame->hdr.context,
+ cmd->index);
+
+ dcmd = &cmd->frame->dcmd;
+
+ /* for(i = 0; i < DCMD_MBOX_SZ; i++) dcmd->mbox.b[i] = 0; */
+ (void) memset(dcmd->mbox.b, 0, DCMD_MBOX_SZ);
+
+ (void) memset(instance->mfi_evt_detail_obj.buffer, 0,
+ sizeof (struct drsas_evt_detail));
+
+ /* Prepare DCMD for aen registration */
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd, MFI_CMD_OP_DCMD);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->cmd_status, 0x0);
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &dcmd->sge_count, 1);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->flags,
+ MFI_FRAME_DIR_READ);
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &dcmd->timeout, 0);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->data_xfer_len,
+ sizeof (struct drsas_evt_detail));
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->opcode,
+ DR_DCMD_CTRL_EVENT_WAIT);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->mbox.w[0], seq_num);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->mbox.w[1],
+ curr_aen.word);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].phys_addr,
+ instance->mfi_evt_detail_obj.dma_cookie[0].dmac_address);
+ ddi_put32(cmd->frame_dma_obj.acc_handle, &dcmd->sgl.sge32[0].length,
+ sizeof (struct drsas_evt_detail));
+
+ instance->aen_seq_num = seq_num;
+
+
+ /*
+ * Store reference to the cmd used to register for AEN. When an
+ * application wants us to register for AEN, we have to abort this
+ * cmd and re-register with a new EVENT LOCALE supplied by that app
+ */
+ instance->aen_cmd = cmd;
+
+ cmd->frame_count = 1;
+
+ /* Issue the aen registration frame */
+ /* atomic_add_16 (&instance->fw_outstanding, 1); */
+ instance->func_ptr->issue_cmd(cmd, instance);
+
+ return (0);
+}
+
+static void
+display_scsi_inquiry(caddr_t scsi_inq)
+{
+#define MAX_SCSI_DEVICE_CODE 14
+ int i;
+ char inquiry_buf[256] = {0};
+ int len;
+ const char *const scsi_device_types[] = {
+ "Direct-Access ",
+ "Sequential-Access",
+ "Printer ",
+ "Processor ",
+ "WORM ",
+ "CD-ROM ",
+ "Scanner ",
+ "Optical Device ",
+ "Medium Changer ",
+ "Communications ",
+ "Unknown ",
+ "Unknown ",
+ "Unknown ",
+ "Enclosure ",
+ };
+
+ len = 0;
+
+ len += snprintf(inquiry_buf + len, 265 - len, " Vendor: ");
+ for (i = 8; i < 16; i++) {
+ len += snprintf(inquiry_buf + len, 265 - len, "%c",
+ scsi_inq[i]);
+ }
+
+ len += snprintf(inquiry_buf + len, 265 - len, " Model: ");
+
+ for (i = 16; i < 32; i++) {
+ len += snprintf(inquiry_buf + len, 265 - len, "%c",
+ scsi_inq[i]);
+ }
+
+ len += snprintf(inquiry_buf + len, 265 - len, " Rev: ");
+
+ for (i = 32; i < 36; i++) {
+ len += snprintf(inquiry_buf + len, 265 - len, "%c",
+ scsi_inq[i]);
+ }
+
+ len += snprintf(inquiry_buf + len, 265 - len, "\n");
+
+
+ i = scsi_inq[0] & 0x1f;
+
+
+ len += snprintf(inquiry_buf + len, 265 - len, " Type: %s ",
+ i < MAX_SCSI_DEVICE_CODE ? scsi_device_types[i] :
+ "Unknown ");
+
+
+ len += snprintf(inquiry_buf + len, 265 - len,
+ " ANSI SCSI revision: %02x", scsi_inq[2] & 0x07);
+
+ if ((scsi_inq[2] & 0x07) == 1 && (scsi_inq[3] & 0x0f) == 1) {
+ len += snprintf(inquiry_buf + len, 265 - len, " CCS\n");
+ } else {
+ len += snprintf(inquiry_buf + len, 265 - len, "\n");
+ }
+
+ con_log(CL_ANN1, (CE_CONT, inquiry_buf));
+}
+
+static int
+read_fw_status_reg_ppc(struct drsas_instance *instance)
+{
+ return ((int)RD_OB_SCRATCH_PAD_0(instance));
+}
+
+static void
+issue_cmd_ppc(struct drsas_cmd *cmd, struct drsas_instance *instance)
+{
+ atomic_add_16(&instance->fw_outstanding, 1);
+
+ /* Issue the command to the FW */
+ WR_IB_QPORT((cmd->frame_phys_addr) |
+ (((cmd->frame_count - 1) << 1) | 1), instance);
+}
+
+/*
+ * issue_cmd_in_sync_mode
+ */
+static int
+issue_cmd_in_sync_mode_ppc(struct drsas_instance *instance,
+ struct drsas_cmd *cmd)
+{
+ int i;
+ uint32_t msecs = MFI_POLL_TIMEOUT_SECS * (10 * MILLISEC);
+
+ con_log(CL_ANN1, (CE_NOTE, "issue_cmd_in_sync_mode_ppc: called"));
+
+ cmd->cmd_status = ENODATA;
+
+ WR_IB_QPORT((cmd->frame_phys_addr) |
+ (((cmd->frame_count - 1) << 1) | 1), instance);
+
+ mutex_enter(&instance->int_cmd_mtx);
+
+ for (i = 0; i < msecs && (cmd->cmd_status == ENODATA); i++) {
+ cv_wait(&instance->int_cmd_cv, &instance->int_cmd_mtx);
+ }
+
+ mutex_exit(&instance->int_cmd_mtx);
+
+ con_log(CL_ANN1, (CE_NOTE, "issue_cmd_in_sync_mode_ppc: done"));
+
+ if (i < (msecs -1)) {
+ return (DDI_SUCCESS);
+ } else {
+ return (DDI_FAILURE);
+ }
+}
+
+/*
+ * issue_cmd_in_poll_mode
+ */
+static int
+issue_cmd_in_poll_mode_ppc(struct drsas_instance *instance,
+ struct drsas_cmd *cmd)
+{
+ int i;
+ uint16_t flags;
+ uint32_t msecs = MFI_POLL_TIMEOUT_SECS * MILLISEC;
+ struct drsas_header *frame_hdr;
+
+ con_log(CL_ANN1, (CE_NOTE, "issue_cmd_in_poll_mode_ppc: called"));
+
+ frame_hdr = (struct drsas_header *)cmd->frame;
+ ddi_put8(cmd->frame_dma_obj.acc_handle, &frame_hdr->cmd_status,
+ MFI_CMD_STATUS_POLL_MODE);
+ flags = ddi_get16(cmd->frame_dma_obj.acc_handle, &frame_hdr->flags);
+ flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE;
+
+ ddi_put16(cmd->frame_dma_obj.acc_handle, &frame_hdr->flags, flags);
+
+ /* issue the frame using inbound queue port */
+ WR_IB_QPORT((cmd->frame_phys_addr) |
+ (((cmd->frame_count - 1) << 1) | 1), instance);
+
+ /* wait for cmd_status to change from 0xFF */
+ for (i = 0; i < msecs && (
+ ddi_get8(cmd->frame_dma_obj.acc_handle, &frame_hdr->cmd_status)
+ == MFI_CMD_STATUS_POLL_MODE); i++) {
+ drv_usecwait(MILLISEC); /* wait for 1000 usecs */
+ }
+
+ if (ddi_get8(cmd->frame_dma_obj.acc_handle, &frame_hdr->cmd_status)
+ == MFI_CMD_STATUS_POLL_MODE) {
+ con_log(CL_ANN, (CE_NOTE, "issue_cmd_in_poll_mode: "
+ "cmd polling timed out"));
+ return (DDI_FAILURE);
+ }
+
+ return (DDI_SUCCESS);
+}
+
+static void
+enable_intr_ppc(struct drsas_instance *instance)
+{
+ uint32_t mask;
+
+ con_log(CL_ANN1, (CE_NOTE, "enable_intr_ppc: called"));
+
+ /* WR_OB_DOORBELL_CLEAR(0xFFFFFFFF, instance); */
+ WR_OB_DOORBELL_CLEAR(OB_DOORBELL_CLEAR_MASK, instance);
+
+ /* WR_OB_INTR_MASK(~0x80000000, instance); */
+ WR_OB_INTR_MASK(~(MFI_REPLY_2108_MESSAGE_INTR_MASK), instance);
+
+ /* dummy read to force PCI flush */
+ mask = RD_OB_INTR_MASK(instance);
+
+ con_log(CL_ANN1, (CE_NOTE, "enable_intr_ppc: "
+ "outbound_intr_mask = 0x%x", mask));
+}
+
+static void
+disable_intr_ppc(struct drsas_instance *instance)
+{
+ uint32_t mask;
+
+ con_log(CL_ANN1, (CE_NOTE, "disable_intr_ppc: called"));
+
+ con_log(CL_ANN1, (CE_NOTE, "disable_intr_ppc: before : "
+ "outbound_intr_mask = 0x%x", RD_OB_INTR_MASK(instance)));
+
+ /* WR_OB_INTR_MASK(0xFFFFFFFF, instance); */
+ WR_OB_INTR_MASK(OB_INTR_MASK, instance);
+
+ con_log(CL_ANN1, (CE_NOTE, "disable_intr_ppc: after : "
+ "outbound_intr_mask = 0x%x", RD_OB_INTR_MASK(instance)));
+
+ /* dummy read to force PCI flush */
+ mask = RD_OB_INTR_MASK(instance);
+#ifdef lint
+ mask = mask;
+#endif
+}
+
+static int
+intr_ack_ppc(struct drsas_instance *instance)
+{
+ uint32_t status;
+
+ con_log(CL_ANN1, (CE_NOTE, "intr_ack_ppc: called"));
+
+ /* check if it is our interrupt */
+ status = RD_OB_INTR_STATUS(instance);
+
+ con_log(CL_ANN1, (CE_NOTE, "intr_ack_ppc: status = 0x%x", status));
+
+ if (!(status & MFI_REPLY_2108_MESSAGE_INTR)) {
+ return (DDI_INTR_UNCLAIMED);
+ }
+
+ /* clear the interrupt by writing back the same value */
+ WR_OB_DOORBELL_CLEAR(status, instance);
+
+ /* dummy READ */
+ status = RD_OB_INTR_STATUS(instance);
+
+ con_log(CL_ANN1, (CE_NOTE, "intr_ack_ppc: interrupt cleared"));
+
+ return (DDI_INTR_CLAIMED);
+}
+
+static int
+drsas_common_check(struct drsas_instance *instance,
+ struct drsas_cmd *cmd)
+{
+ int ret = DDI_SUCCESS;
+
+ if (drsas_check_dma_handle(cmd->frame_dma_obj.dma_handle) !=
+ DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_UNAFFECTED);
+ if (cmd->pkt != NULL) {
+ cmd->pkt->pkt_reason = CMD_TRAN_ERR;
+ cmd->pkt->pkt_statistics = 0;
+ }
+ ret = DDI_FAILURE;
+ }
+ if (drsas_check_dma_handle(instance->mfi_internal_dma_obj.dma_handle)
+ != DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_UNAFFECTED);
+ if (cmd->pkt != NULL) {
+ cmd->pkt->pkt_reason = CMD_TRAN_ERR;
+ cmd->pkt->pkt_statistics = 0;
+ }
+ ret = DDI_FAILURE;
+ }
+ if (drsas_check_dma_handle(instance->mfi_evt_detail_obj.dma_handle) !=
+ DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_UNAFFECTED);
+ if (cmd->pkt != NULL) {
+ cmd->pkt->pkt_reason = CMD_TRAN_ERR;
+ cmd->pkt->pkt_statistics = 0;
+ }
+ ret = DDI_FAILURE;
+ }
+ if (drsas_check_acc_handle(instance->regmap_handle) != DDI_SUCCESS) {
+ ddi_fm_service_impact(instance->dip, DDI_SERVICE_UNAFFECTED);
+
+ ddi_fm_acc_err_clear(instance->regmap_handle, DDI_FME_VER0);
+
+ if (cmd->pkt != NULL) {
+ cmd->pkt->pkt_reason = CMD_TRAN_ERR;
+ cmd->pkt->pkt_statistics = 0;
+ }
+ ret = DDI_FAILURE;
+ }
+
+ return (ret);
+}
+
+/*ARGSUSED*/
+static int
+drsas_fm_error_cb(dev_info_t *dip, ddi_fm_error_t *err, const void *impl_data)
+{
+ /*
+ * as the driver can always deal with an error in any dma or
+ * access handle, we can just return the fme_status value.
+ */
+ pci_ereport_post(dip, err, NULL);
+ return (err->fme_status);
+}
+
+static void
+drsas_fm_init(struct drsas_instance *instance)
+{
+ /* Need to change iblock to priority for new MSI intr */
+ ddi_iblock_cookie_t fm_ibc;
+
+ /* Only register with IO Fault Services if we have some capability */
+ if (instance->fm_capabilities) {
+ /* Adjust access and dma attributes for FMA */
+ endian_attr.devacc_attr_access = DDI_FLAGERR_ACC;
+ drsas_generic_dma_attr.dma_attr_flags = DDI_DMA_FLAGERR;
+
+ /*
+ * Register capabilities with IO Fault Services.
+ * fm_capabilities will be updated to indicate
+ * capabilities actually supported (not requested.)
+ */
+
+ ddi_fm_init(instance->dip, &instance->fm_capabilities, &fm_ibc);
+
+ /*
+ * Initialize pci ereport capabilities if ereport
+ * capable (should always be.)
+ */
+
+ if (DDI_FM_EREPORT_CAP(instance->fm_capabilities) ||
+ DDI_FM_ERRCB_CAP(instance->fm_capabilities)) {
+ pci_ereport_setup(instance->dip);
+ }
+
+ /*
+ * Register error callback if error callback capable.
+ */
+ if (DDI_FM_ERRCB_CAP(instance->fm_capabilities)) {
+ ddi_fm_handler_register(instance->dip,
+ drsas_fm_error_cb, (void*) instance);
+ }
+ } else {
+ endian_attr.devacc_attr_access = DDI_DEFAULT_ACC;
+ drsas_generic_dma_attr.dma_attr_flags = 0;
+ }
+}
+
+static void
+drsas_fm_fini(struct drsas_instance *instance)
+{
+ /* Only unregister FMA capabilities if registered */
+ if (instance->fm_capabilities) {
+ /*
+ * Un-register error callback if error callback capable.
+ */
+ if (DDI_FM_ERRCB_CAP(instance->fm_capabilities)) {
+ ddi_fm_handler_unregister(instance->dip);
+ }
+
+ /*
+ * Release any resources allocated by pci_ereport_setup()
+ */
+ if (DDI_FM_EREPORT_CAP(instance->fm_capabilities) ||
+ DDI_FM_ERRCB_CAP(instance->fm_capabilities)) {
+ pci_ereport_teardown(instance->dip);
+ }
+
+ /* Unregister from IO Fault Services */
+ ddi_fm_fini(instance->dip);
+
+ /* Adjust access and dma attributes for FMA */
+ endian_attr.devacc_attr_access = DDI_DEFAULT_ACC;
+ drsas_generic_dma_attr.dma_attr_flags = 0;
+ }
+}
+
+int
+drsas_check_acc_handle(ddi_acc_handle_t handle)
+{
+ ddi_fm_error_t de;
+
+ if (handle == NULL) {
+ return (DDI_FAILURE);
+ }
+
+ ddi_fm_acc_err_get(handle, &de, DDI_FME_VERSION);
+
+ return (de.fme_status);
+}
+
+int
+drsas_check_dma_handle(ddi_dma_handle_t handle)
+{
+ ddi_fm_error_t de;
+
+ if (handle == NULL) {
+ return (DDI_FAILURE);
+ }
+
+ ddi_fm_dma_err_get(handle, &de, DDI_FME_VERSION);
+
+ return (de.fme_status);
+}
+
+void
+drsas_fm_ereport(struct drsas_instance *instance, char *detail)
+{
+ uint64_t ena;
+ char buf[FM_MAX_CLASS];
+
+ (void) snprintf(buf, FM_MAX_CLASS, "%s.%s", DDI_FM_DEVICE, detail);
+ ena = fm_ena_generate(0, FM_ENA_FMT1);
+ if (DDI_FM_EREPORT_CAP(instance->fm_capabilities)) {
+ ddi_fm_ereport_post(instance->dip, buf, ena, DDI_NOSLEEP,
+ FM_VERSION, DATA_TYPE_UINT8, FM_EREPORT_VERSION, NULL);
+ }
+}
+
+static int
+drsas_add_intrs(struct drsas_instance *instance, int intr_type)
+{
+
+ dev_info_t *dip = instance->dip;
+ int avail, actual, count;
+ int i, flag, ret;
+
+ con_log(CL_DLEVEL1, (CE_WARN, "drsas_add_intrs: intr_type = %x",
+ intr_type));
+
+ /* Get number of interrupts */
+ ret = ddi_intr_get_nintrs(dip, intr_type, &count);
+ if ((ret != DDI_SUCCESS) || (count == 0)) {
+ con_log(CL_ANN, (CE_WARN, "ddi_intr_get_nintrs() failed:"
+ "ret %d count %d", ret, count));
+
+ return (DDI_FAILURE);
+ }
+
+ con_log(CL_DLEVEL1, (CE_WARN, "drsas_add_intrs: count = %d ", count));
+
+ /* Get number of available interrupts */
+ ret = ddi_intr_get_navail(dip, intr_type, &avail);
+ if ((ret != DDI_SUCCESS) || (avail == 0)) {
+ con_log(CL_ANN, (CE_WARN, "ddi_intr_get_navail() failed:"
+ "ret %d avail %d", ret, avail));
+
+ return (DDI_FAILURE);
+ }
+ con_log(CL_DLEVEL1, (CE_WARN, "drsas_add_intrs: avail = %d ", avail));
+
+ /* Only one interrupt routine. So limit the count to 1 */
+ if (count > 1) {
+ count = 1;
+ }
+
+ /*
+ * Allocate an array of interrupt handlers. Currently we support
+ * only one interrupt. The framework can be extended later.
+ */
+ instance->intr_size = count * sizeof (ddi_intr_handle_t);
+ instance->intr_htable = kmem_zalloc(instance->intr_size, KM_SLEEP);
+ ASSERT(instance->intr_htable);
+
+ flag = ((intr_type == DDI_INTR_TYPE_MSI) || (intr_type ==
+ DDI_INTR_TYPE_MSIX)) ? DDI_INTR_ALLOC_STRICT:DDI_INTR_ALLOC_NORMAL;
+
+ /* Allocate interrupt */
+ ret = ddi_intr_alloc(dip, instance->intr_htable, intr_type, 0,
+ count, &actual, flag);
+
+ if ((ret != DDI_SUCCESS) || (actual == 0)) {
+ con_log(CL_ANN, (CE_WARN, "drsas_add_intrs: "
+ "avail = %d", avail));
+ kmem_free(instance->intr_htable, instance->intr_size);
+ return (DDI_FAILURE);
+ }
+ if (actual < count) {
+ con_log(CL_ANN, (CE_WARN, "drsas_add_intrs: "
+ "Requested = %d Received = %d", count, actual));
+ }
+ instance->intr_cnt = actual;
+
+ /*
+ * Get the priority of the interrupt allocated.
+ */
+ if ((ret = ddi_intr_get_pri(instance->intr_htable[0],
+ &instance->intr_pri)) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN, "drsas_add_intrs: "
+ "get priority call failed"));
+
+ for (i = 0; i < actual; i++) {
+ (void) ddi_intr_free(instance->intr_htable[i]);
+ }
+ kmem_free(instance->intr_htable, instance->intr_size);
+ return (DDI_FAILURE);
+ }
+
+ /*
+ * Test for high level mutex. we don't support them.
+ */
+ if (instance->intr_pri >= ddi_intr_get_hilevel_pri()) {
+ con_log(CL_ANN, (CE_WARN, "drsas_add_intrs: "
+ "High level interrupts not supported."));
+
+ for (i = 0; i < actual; i++) {
+ (void) ddi_intr_free(instance->intr_htable[i]);
+ }
+ kmem_free(instance->intr_htable, instance->intr_size);
+ return (DDI_FAILURE);
+ }
+
+ con_log(CL_DLEVEL1, (CE_NOTE, "drsas_add_intrs: intr_pri = 0x%x ",
+ instance->intr_pri));
+
+ /* Call ddi_intr_add_handler() */
+ for (i = 0; i < actual; i++) {
+ ret = ddi_intr_add_handler(instance->intr_htable[i],
+ (ddi_intr_handler_t *)drsas_isr, (caddr_t)instance,
+ (caddr_t)(uintptr_t)i);
+
+ if (ret != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN, "drsas_add_intrs:"
+ "failed %d", ret));
+
+ for (i = 0; i < actual; i++) {
+ (void) ddi_intr_free(instance->intr_htable[i]);
+ }
+ kmem_free(instance->intr_htable, instance->intr_size);
+ return (DDI_FAILURE);
+ }
+
+ }
+
+ con_log(CL_DLEVEL1, (CE_WARN, " ddi_intr_add_handler done"));
+
+ if ((ret = ddi_intr_get_cap(instance->intr_htable[0],
+ &instance->intr_cap)) != DDI_SUCCESS) {
+ con_log(CL_ANN, (CE_WARN, "ddi_intr_get_cap() failed %d",
+ ret));
+
+ /* Free already allocated intr */
+ for (i = 0; i < actual; i++) {
+ (void) ddi_intr_remove_handler(
+ instance->intr_htable[i]);
+ (void) ddi_intr_free(instance->intr_htable[i]);
+ }
+ kmem_free(instance->intr_htable, instance->intr_size);
+ return (DDI_FAILURE);
+ }
+
+ if (instance->intr_cap & DDI_INTR_FLAG_BLOCK) {
+ con_log(CL_ANN, (CE_WARN, "Calling ddi_intr_block _enable"));
+
+ (void) ddi_intr_block_enable(instance->intr_htable,
+ instance->intr_cnt);
+ } else {
+ con_log(CL_ANN, (CE_NOTE, " calling ddi_intr_enable"));
+
+ for (i = 0; i < instance->intr_cnt; i++) {
+ (void) ddi_intr_enable(instance->intr_htable[i]);
+ con_log(CL_ANN, (CE_NOTE, "ddi intr enable returns "
+ "%d", i));
+ }
+ }
+
+ return (DDI_SUCCESS);
+
+}
+
+
+static void
+drsas_rem_intrs(struct drsas_instance *instance)
+{
+ int i;
+
+ con_log(CL_ANN, (CE_NOTE, "drsas_rem_intrs called"));
+
+ /* Disable all interrupts first */
+ if (instance->intr_cap & DDI_INTR_FLAG_BLOCK) {
+ (void) ddi_intr_block_disable(instance->intr_htable,
+ instance->intr_cnt);
+ } else {
+ for (i = 0; i < instance->intr_cnt; i++) {
+ (void) ddi_intr_disable(instance->intr_htable[i]);
+ }
+ }
+
+ /* Remove all the handlers */
+
+ for (i = 0; i < instance->intr_cnt; i++) {
+ (void) ddi_intr_remove_handler(instance->intr_htable[i]);
+ (void) ddi_intr_free(instance->intr_htable[i]);
+ }
+
+ kmem_free(instance->intr_htable, instance->intr_size);
+}
+
+static int
+drsas_tran_bus_config(dev_info_t *parent, uint_t flags,
+ ddi_bus_config_op_t op, void *arg, dev_info_t **childp)
+{
+ struct drsas_instance *instance;
+ int config;
+ int rval;
+
+ char *ptr = NULL;
+ int tgt, lun;
+
+ con_log(CL_ANN1, (CE_NOTE, "Bus config called for op = %x", op));
+
+ if ((instance = ddi_get_soft_state(drsas_state,
+ ddi_get_instance(parent))) == NULL) {
+ return (NDI_FAILURE);
+ }
+
+ /* Hold nexus during bus_config */
+ ndi_devi_enter(parent, &config);
+ switch (op) {
+ case BUS_CONFIG_ONE: {
+
+ /* parse wwid/target name out of name given */
+ if ((ptr = strchr((char *)arg, '@')) == NULL) {
+ rval = NDI_FAILURE;
+ break;
+ }
+ ptr++;
+
+ if (drsas_parse_devname(arg, &tgt, &lun) != 0) {
+ rval = NDI_FAILURE;
+ break;
+ }
+
+ if (lun == 0) {
+ rval = drsas_config_ld(instance, tgt, lun, childp);
+ } else {
+ rval = NDI_FAILURE;
+ }
+
+ break;
+ }
+ case BUS_CONFIG_DRIVER:
+ case BUS_CONFIG_ALL: {
+
+ rval = drsas_config_all_devices(instance);
+
+ rval = NDI_SUCCESS;
+ break;
+ }
+ }
+
+ if (rval == NDI_SUCCESS) {
+ rval = ndi_busop_bus_config(parent, flags, op, arg, childp, 0);
+
+ }
+ ndi_devi_exit(parent, config);
+
+ con_log(CL_ANN1, (CE_NOTE, "drsas_tran_bus_config: rval = %x",
+ rval));
+ return (rval);
+}
+
+static int
+drsas_config_all_devices(struct drsas_instance *instance)
+{
+ int rval, tgt;
+
+ for (tgt = 0; tgt < MRDRV_MAX_LD; tgt++) {
+ (void) drsas_config_ld(instance, tgt, 0, NULL);
+
+ }
+
+ rval = NDI_SUCCESS;
+ return (rval);
+}
+
+static int
+drsas_parse_devname(char *devnm, int *tgt, int *lun)
+{
+ char devbuf[SCSI_MAXNAMELEN];
+ char *addr;
+ char *p, *tp, *lp;
+ long num;
+
+ /* Parse dev name and address */
+ (void) strcpy(devbuf, devnm);
+ addr = "";
+ for (p = devbuf; *p != '\0'; p++) {
+ if (*p == '@') {
+ addr = p + 1;
+ *p = '\0';
+ } else if (*p == ':') {
+ *p = '\0';
+ break;
+ }
+ }
+
+ /* Parse target and lun */
+ for (p = tp = addr, lp = NULL; *p != '\0'; p++) {
+ if (*p == ',') {
+ lp = p + 1;
+ *p = '\0';
+ break;
+ }
+ }
+ if (tgt && tp) {
+ if (ddi_strtol(tp, NULL, 0x10, &num)) {
+ return (DDI_FAILURE); /* Can declare this as constant */
+ }
+ *tgt = (int)num;
+ }
+ if (lun && lp) {
+ if (ddi_strtol(lp, NULL, 0x10, &num)) {
+ return (DDI_FAILURE);
+ }
+ *lun = (int)num;
+ }
+ return (DDI_SUCCESS); /* Success case */
+}
+
+static int
+drsas_config_ld(struct drsas_instance *instance, uint16_t tgt,
+ uint8_t lun, dev_info_t **ldip)
+{
+ struct scsi_device *sd;
+ dev_info_t *child;
+ int rval;
+
+ con_log(CL_ANN1, (CE_NOTE, "drsas_config_ld: t = %d l = %d",
+ tgt, lun));
+
+ if ((child = drsas_find_child(instance, tgt, lun)) != NULL) {
+ if (ldip) {
+ *ldip = child;
+ }
+ con_log(CL_ANN1, (CE_NOTE,
+ "drsas_config_ld: Child = %p found t = %d l = %d",
+ (void *)child, tgt, lun));
+ return (NDI_SUCCESS);
+ }
+
+ sd = kmem_zalloc(sizeof (struct scsi_device), KM_SLEEP);
+ sd->sd_address.a_hba_tran = instance->tran;
+ sd->sd_address.a_target = (uint16_t)tgt;
+ sd->sd_address.a_lun = (uint8_t)lun;
+
+ if (scsi_hba_probe(sd, NULL) == SCSIPROBE_EXISTS)
+ rval = drsas_config_scsi_device(instance, sd, ldip);
+ else
+ rval = NDI_FAILURE;
+
+ /* sd_unprobe is blank now. Free buffer manually */
+ if (sd->sd_inq) {
+ kmem_free(sd->sd_inq, SUN_INQSIZE);
+ sd->sd_inq = (struct scsi_inquiry *)NULL;
+ }
+
+ kmem_free(sd, sizeof (struct scsi_device));
+ con_log(CL_ANN1, (CE_NOTE, "drsas_config_ld: return rval = %d",
+ rval));
+ return (rval);
+}
+
+static int
+drsas_config_scsi_device(struct drsas_instance *instance,
+ struct scsi_device *sd, dev_info_t **dipp)
+{
+ char *nodename = NULL;
+ char **compatible = NULL;
+ int ncompatible = 0;
+ char *childname;
+ dev_info_t *ldip = NULL;
+ int tgt = sd->sd_address.a_target;
+ int lun = sd->sd_address.a_lun;
+ int dtype = sd->sd_inq->inq_dtype & DTYPE_MASK;
+ int rval;
+
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: scsi_device t%dL%d", tgt, lun));
+ scsi_hba_nodename_compatible_get(sd->sd_inq, NULL, dtype,
+ NULL, &nodename, &compatible, &ncompatible);
+
+ if (nodename == NULL) {
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: Found no compatible driver "
+ "for t%dL%d", tgt, lun));
+ rval = NDI_FAILURE;
+ goto finish;
+ }
+
+ childname = (dtype == DTYPE_DIRECT) ? "sd" : nodename;
+ con_log(CL_ANN1, (CE_WARN,
+ "dr_sas: Childname = %2s nodename = %s", childname, nodename));
+
+ /* Create a dev node */
+ rval = ndi_devi_alloc(instance->dip, childname, DEVI_SID_NODEID, &ldip);
+ con_log(CL_ANN1, (CE_WARN,
+ "dr_sas_config_scsi_device: ndi_devi_alloc rval = %x", rval));
+ if (rval == NDI_SUCCESS) {
+ if (ndi_prop_update_int(DDI_DEV_T_NONE, ldip, "target", tgt) !=
+ DDI_PROP_SUCCESS) {
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: unable to create "
+ "property for t%dl%d target", tgt, lun));
+ rval = NDI_FAILURE;
+ goto finish;
+ }
+ if (ndi_prop_update_int(DDI_DEV_T_NONE, ldip, "lun", lun) !=
+ DDI_PROP_SUCCESS) {
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: unable to create "
+ "property for t%dl%d lun", tgt, lun));
+ rval = NDI_FAILURE;
+ goto finish;
+ }
+
+ if (ndi_prop_update_string_array(DDI_DEV_T_NONE, ldip,
+ "compatible", compatible, ncompatible) !=
+ DDI_PROP_SUCCESS) {
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: unable to create "
+ "property for t%dl%d compatible", tgt, lun));
+ rval = NDI_FAILURE;
+ goto finish;
+ }
+
+ rval = ndi_devi_online(ldip, NDI_ONLINE_ATTACH);
+ if (rval != NDI_SUCCESS) {
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: unable to online "
+ "t%dl%d", tgt, lun));
+ ndi_prop_remove_all(ldip);
+ (void) ndi_devi_free(ldip);
+ } else {
+ con_log(CL_ANN1, (CE_WARN, "dr_sas: online Done :"
+ "0 t%dl%d", tgt, lun));
+ }
+
+ }
+finish:
+ if (dipp) {
+ *dipp = ldip;
+ }
+
+ con_log(CL_DLEVEL1, (CE_WARN,
+ "dr_sas: config_scsi_device rval = %d t%dL%d",
+ rval, tgt, lun));
+ scsi_hba_nodename_compatible_free(nodename, compatible);
+ return (rval);
+}
+
+/*ARGSUSED*/
+static int
+drsas_service_evt(struct drsas_instance *instance, int tgt, int lun, int event,
+ uint64_t wwn)
+{
+ struct drsas_eventinfo *mrevt = NULL;
+
+ con_log(CL_ANN1, (CE_NOTE,
+ "drsas_service_evt called for t%dl%d event = %d",
+ tgt, lun, event));
+
+ if ((instance->taskq == NULL) || (mrevt =
+ kmem_zalloc(sizeof (struct drsas_eventinfo), KM_NOSLEEP)) == NULL) {
+ return (ENOMEM);
+ }
+
+ mrevt->instance = instance;
+ mrevt->tgt = tgt;
+ mrevt->lun = lun;
+ mrevt->event = event;
+
+ if ((ddi_taskq_dispatch(instance->taskq,
+ (void (*)(void *))drsas_issue_evt_taskq, mrevt, DDI_NOSLEEP)) !=
+ DDI_SUCCESS) {
+ con_log(CL_ANN1, (CE_NOTE,
+ "dr_sas: Event task failed for t%dl%d event = %d",
+ tgt, lun, event));
+ kmem_free(mrevt, sizeof (struct drsas_eventinfo));
+ return (DDI_FAILURE);
+ }
+ return (DDI_SUCCESS);
+}
+
+static void
+drsas_issue_evt_taskq(struct drsas_eventinfo *mrevt)
+{
+ struct drsas_instance *instance = mrevt->instance;
+ dev_info_t *dip, *pdip;
+ int circ1 = 0;
+ char *devname;
+
+ con_log(CL_ANN1, (CE_NOTE, "drsas_issue_evt_taskq: called for"
+ " tgt %d lun %d event %d",
+ mrevt->tgt, mrevt->lun, mrevt->event));
+
+ if (mrevt->tgt < MRDRV_MAX_LD && mrevt->lun == 0) {
+ dip = instance->dr_ld_list[mrevt->tgt].dip;
+ } else {
+ return;
+ }
+
+ ndi_devi_enter(instance->dip, &circ1);
+ switch (mrevt->event) {
+ case DRSAS_EVT_CONFIG_TGT:
+ if (dip == NULL) {
+
+ if (mrevt->lun == 0) {
+ (void) drsas_config_ld(instance, mrevt->tgt,
+ 0, NULL);
+ }
+ con_log(CL_ANN1, (CE_NOTE,
+ "dr_sas: EVT_CONFIG_TGT called:"
+ " for tgt %d lun %d event %d",
+ mrevt->tgt, mrevt->lun, mrevt->event));
+
+ } else {
+ con_log(CL_ANN1, (CE_NOTE,
+ "dr_sas: EVT_CONFIG_TGT dip != NULL:"
+ " for tgt %d lun %d event %d",
+ mrevt->tgt, mrevt->lun, mrevt->event));
+ }
+ break;
+ case DRSAS_EVT_UNCONFIG_TGT:
+ if (dip) {
+ if (i_ddi_devi_attached(dip)) {
+
+ pdip = ddi_get_parent(dip);
+
+ devname = kmem_zalloc(MAXNAMELEN + 1, KM_SLEEP);
+ (void) ddi_deviname(dip, devname);
+
+ (void) devfs_clean(pdip, devname + 1,
+ DV_CLEAN_FORCE);
+ kmem_free(devname, MAXNAMELEN + 1);
+ }
+ (void) ndi_devi_offline(dip, NDI_DEVI_REMOVE);
+ con_log(CL_ANN1, (CE_NOTE,
+ "dr_sas: EVT_UNCONFIG_TGT called:"
+ " for tgt %d lun %d event %d",
+ mrevt->tgt, mrevt->lun, mrevt->event));
+ } else {
+ con_log(CL_ANN1, (CE_NOTE,
+ "dr_sas: EVT_UNCONFIG_TGT dip == NULL:"
+ " for tgt %d lun %d event %d",
+ mrevt->tgt, mrevt->lun, mrevt->event));
+ }
+ break;
+ }
+ kmem_free(mrevt, sizeof (struct drsas_eventinfo));
+ ndi_devi_exit(instance->dip, circ1);
+}
+
+static int
+drsas_mode_sense_build(struct scsi_pkt *pkt)
+{
+ union scsi_cdb *cdbp;
+ uint16_t page_code;
+ struct scsa_cmd *acmd;
+ struct buf *bp;
+ struct mode_header *modehdrp;
+
+ cdbp = (void *)pkt->pkt_cdbp;
+ page_code = cdbp->cdb_un.sg.scsi[0];
+ acmd = PKT2CMD(pkt);
+ bp = acmd->cmd_buf;
+ if ((!bp) && bp->b_un.b_addr && bp->b_bcount && acmd->cmd_dmacount) {
+ con_log(CL_ANN1, (CE_WARN, "Failing MODESENSE Command"));
+ /* ADD pkt statistics as Command failed. */
+ return (NULL);
+ }
+
+ bp_mapin(bp);
+ bzero(bp->b_un.b_addr, bp->b_bcount);
+
+ switch (page_code) {
+ case 0x3: {
+ struct mode_format *page3p = NULL;
+ modehdrp = (struct mode_header *)(bp->b_un.b_addr);
+ modehdrp->bdesc_length = MODE_BLK_DESC_LENGTH;
+
+ page3p = (void *)((caddr_t)modehdrp +
+ MODE_HEADER_LENGTH + MODE_BLK_DESC_LENGTH);
+ page3p->mode_page.code = 0x3;
+ page3p->mode_page.length =
+ (uchar_t)(sizeof (struct mode_format));
+ page3p->data_bytes_sect = 512;
+ page3p->sect_track = 63;
+ break;
+ }
+ case 0x4: {
+ struct mode_geometry *page4p = NULL;
+ modehdrp = (struct mode_header *)(bp->b_un.b_addr);
+ modehdrp->bdesc_length = MODE_BLK_DESC_LENGTH;
+
+ page4p = (void *)((caddr_t)modehdrp +
+ MODE_HEADER_LENGTH + MODE_BLK_DESC_LENGTH);
+ page4p->mode_page.code = 0x4;
+ page4p->mode_page.length =
+ (uchar_t)(sizeof (struct mode_geometry));
+ page4p->heads = 255;
+ page4p->rpm = 10000;
+ break;
+ }
+ default:
+ break;
+ }
+ return (NULL);
+}
diff --git a/usr/src/uts/common/io/dr_sas/dr_sas.conf b/usr/src/uts/common/io/dr_sas/dr_sas.conf
new file mode 100644
index 0000000000..3792f43ca4
--- /dev/null
+++ b/usr/src/uts/common/io/dr_sas/dr_sas.conf
@@ -0,0 +1,15 @@
+#
+# Copyright (c) 2008-2009, LSI Logic Corporation.
+# All rights reserved.
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# dr_sas.conf for sol 10 (and later) for all supported architectures
+#
+# global definitions
+
+# MSI specific flag. user can uncomment this line and set flag "yes" to enable MSI
+#drsas-enable-msi="yes";
diff --git a/usr/src/uts/common/io/dr_sas/dr_sas.h b/usr/src/uts/common/io/dr_sas/dr_sas.h
new file mode 100644
index 0000000000..8f78658edf
--- /dev/null
+++ b/usr/src/uts/common/io/dr_sas/dr_sas.h
@@ -0,0 +1,1766 @@
+/*
+ * dr_sas.h: header for dr_sas
+ *
+ * Solaris MegaRAID driver for SAS2.0 controllers
+ * Copyright (c) 2008-2009, LSI Logic Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _DR_SAS_H_
+#define _DR_SAS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/scsi/scsi.h>
+#include "dr_sas_list.h"
+
+/*
+ * MegaRAID SAS2.0 Driver meta data
+ */
+#define DRSAS_VERSION "LSIv2.0"
+#define DRSAS_RELDATE "Jan 9, 2009"
+
+#define DRSAS_TRUE 1
+#define DRSAS_FALSE 0
+
+/*
+ * MegaRAID SAS2.0 device id conversion definitions.
+ */
+#define INST2LSIRDCTL(x) ((x) << INST_MINOR_SHIFT)
+
+/*
+ * MegaRAID SAS2.0 supported controllers
+ */
+#define PCI_DEVICE_ID_LSI_2108VDE 0x0078
+#define PCI_DEVICE_ID_LSI_2108V 0x0079
+
+/*
+ * Register Index for 2108 Controllers.
+ */
+#define REGISTER_SET_IO_2108 (2)
+
+#define DRSAS_MAX_SGE_CNT 0x50
+
+#define DRSAS_IOCTL_DRIVER 0x12341234
+#define DRSAS_IOCTL_FIRMWARE 0x12345678
+#define DRSAS_IOCTL_AEN 0x87654321
+
+#define DRSAS_1_SECOND 1000000
+
+/* Dynamic Enumeration Flags */
+#define DRSAS_PD_LUN 1
+#define DRSAS_LD_LUN 0
+#define DRSAS_PD_TGT_MAX 255
+#define DRSAS_GET_PD_MAX(s) ((s)->dr_pd_max)
+#define WWN_STRLEN 17
+
+/*
+ * =====================================
+ * MegaRAID SAS2.0 MFI firmware definitions
+ * =====================================
+ */
+/*
+ * MFI stands for MegaRAID SAS2.0 FW Interface. This is just a moniker for
+ * protocol between the software and firmware. Commands are issued using
+ * "message frames"
+ */
+
+/*
+ * FW posts its state in upper 4 bits of outbound_msg_0 register
+ */
+#define MFI_STATE_SHIFT 28
+#define MFI_STATE_MASK ((uint32_t)0xF<<MFI_STATE_SHIFT)
+#define MFI_STATE_UNDEFINED ((uint32_t)0x0<<MFI_STATE_SHIFT)
+#define MFI_STATE_BB_INIT ((uint32_t)0x1<<MFI_STATE_SHIFT)
+#define MFI_STATE_FW_INIT ((uint32_t)0x4<<MFI_STATE_SHIFT)
+#define MFI_STATE_WAIT_HANDSHAKE ((uint32_t)0x6<<MFI_STATE_SHIFT)
+#define MFI_STATE_FW_INIT_2 ((uint32_t)0x7<<MFI_STATE_SHIFT)
+#define MFI_STATE_DEVICE_SCAN ((uint32_t)0x8<<MFI_STATE_SHIFT)
+#define MFI_STATE_BOOT_MESSAGE_PENDING ((uint32_t)0x9<<MFI_STATE_SHIFT)
+#define MFI_STATE_FLUSH_CACHE ((uint32_t)0xA<<MFI_STATE_SHIFT)
+#define MFI_STATE_READY ((uint32_t)0xB<<MFI_STATE_SHIFT)
+#define MFI_STATE_OPERATIONAL ((uint32_t)0xC<<MFI_STATE_SHIFT)
+#define MFI_STATE_FAULT ((uint32_t)0xF<<MFI_STATE_SHIFT)
+
+#define MRMFI_FRAME_SIZE 64
+
+/*
+ * During FW init, clear pending cmds & reset state using inbound_msg_0
+ *
+ * ABORT : Abort all pending cmds
+ * READY : Move from OPERATIONAL to READY state; discard queue info
+ * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??)
+ * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver
+ */
+#define MFI_INIT_ABORT 0x00000001
+#define MFI_INIT_READY 0x00000002
+#define MFI_INIT_MFIMODE 0x00000004
+#define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
+#define MFI_INIT_HOTPLUG 0x00000010
+#define MFI_STOP_ADP 0x00000020
+#define MFI_RESET_FLAGS MFI_INIT_READY|MFI_INIT_MFIMODE|MFI_INIT_ABORT
+
+/*
+ * MFI frame flags
+ */
+#define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000
+#define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001
+#define MFI_FRAME_SGL32 0x0000
+#define MFI_FRAME_SGL64 0x0002
+#define MFI_FRAME_SENSE32 0x0000
+#define MFI_FRAME_SENSE64 0x0004
+#define MFI_FRAME_DIR_NONE 0x0000
+#define MFI_FRAME_DIR_WRITE 0x0008
+#define MFI_FRAME_DIR_READ 0x0010
+#define MFI_FRAME_DIR_BOTH 0x0018
+
+/*
+ * Definition for cmd_status
+ */
+#define MFI_CMD_STATUS_POLL_MODE 0xFF
+#define MFI_CMD_STATUS_SYNC_MODE 0xFF
+
+/*
+ * MFI command opcodes
+ */
+#define MFI_CMD_OP_INIT 0x00
+#define MFI_CMD_OP_LD_READ 0x01
+#define MFI_CMD_OP_LD_WRITE 0x02
+#define MFI_CMD_OP_LD_SCSI 0x03
+#define MFI_CMD_OP_PD_SCSI 0x04
+#define MFI_CMD_OP_DCMD 0x05
+#define MFI_CMD_OP_ABORT 0x06
+#define MFI_CMD_OP_SMP 0x07
+#define MFI_CMD_OP_STP 0x08
+
+#define DR_DCMD_CTRL_GET_INFO 0x01010000
+
+#define DR_DCMD_CTRL_CACHE_FLUSH 0x01101000
+#define DR_FLUSH_CTRL_CACHE 0x01
+#define DR_FLUSH_DISK_CACHE 0x02
+
+#define DR_DCMD_CTRL_SHUTDOWN 0x01050000
+#define DRSAS_ENABLE_DRIVE_SPINDOWN 0x01
+
+#define DR_DCMD_CTRL_EVENT_GET_INFO 0x01040100
+#define DR_DCMD_CTRL_EVENT_GET 0x01040300
+#define DR_DCMD_CTRL_EVENT_WAIT 0x01040500
+#define DR_DCMD_LD_GET_PROPERTIES 0x03030000
+#define DR_DCMD_PD_GET_INFO 0x02020000
+
+/*
+ * Solaris Specific MAX values
+ */
+#define MAX_SGL 24
+/*
+ * MFI command completion codes
+ */
+enum MFI_STAT {
+ MFI_STAT_OK = 0x00,
+ MFI_STAT_INVALID_CMD = 0x01,
+ MFI_STAT_INVALID_DCMD = 0x02,
+ MFI_STAT_INVALID_PARAMETER = 0x03,
+ MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04,
+ MFI_STAT_ABORT_NOT_POSSIBLE = 0x05,
+ MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06,
+ MFI_STAT_APP_IN_USE = 0x07,
+ MFI_STAT_APP_NOT_INITIALIZED = 0x08,
+ MFI_STAT_ARRAY_INDEX_INVALID = 0x09,
+ MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a,
+ MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b,
+ MFI_STAT_DEVICE_NOT_FOUND = 0x0c,
+ MFI_STAT_DRIVE_TOO_SMALL = 0x0d,
+ MFI_STAT_FLASH_ALLOC_FAIL = 0x0e,
+ MFI_STAT_FLASH_BUSY = 0x0f,
+ MFI_STAT_FLASH_ERROR = 0x10,
+ MFI_STAT_FLASH_IMAGE_BAD = 0x11,
+ MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12,
+ MFI_STAT_FLASH_NOT_OPEN = 0x13,
+ MFI_STAT_FLASH_NOT_STARTED = 0x14,
+ MFI_STAT_FLUSH_FAILED = 0x15,
+ MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16,
+ MFI_STAT_LD_CC_IN_PROGRESS = 0x17,
+ MFI_STAT_LD_INIT_IN_PROGRESS = 0x18,
+ MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19,
+ MFI_STAT_LD_MAX_CONFIGURED = 0x1a,
+ MFI_STAT_LD_NOT_OPTIMAL = 0x1b,
+ MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c,
+ MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d,
+ MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e,
+ MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f,
+ MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20,
+ MFI_STAT_MFC_HW_ERROR = 0x21,
+ MFI_STAT_NO_HW_PRESENT = 0x22,
+ MFI_STAT_NOT_FOUND = 0x23,
+ MFI_STAT_NOT_IN_ENCL = 0x24,
+ MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25,
+ MFI_STAT_PD_TYPE_WRONG = 0x26,
+ MFI_STAT_PR_DISABLED = 0x27,
+ MFI_STAT_ROW_INDEX_INVALID = 0x28,
+ MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29,
+ MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a,
+ MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b,
+ MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c,
+ MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d,
+ MFI_STAT_SCSI_IO_FAILED = 0x2e,
+ MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f,
+ MFI_STAT_SHUTDOWN_FAILED = 0x30,
+ MFI_STAT_TIME_NOT_SET = 0x31,
+ MFI_STAT_WRONG_STATE = 0x32,
+ MFI_STAT_LD_OFFLINE = 0x33,
+ /* UNUSED: 0x34 to 0xfe */
+ MFI_STAT_INVALID_STATUS = 0xFF
+};
+
+enum DR_EVT_CLASS {
+ DR_EVT_CLASS_DEBUG = -2,
+ DR_EVT_CLASS_PROGRESS = -1,
+ DR_EVT_CLASS_INFO = 0,
+ DR_EVT_CLASS_WARNING = 1,
+ DR_EVT_CLASS_CRITICAL = 2,
+ DR_EVT_CLASS_FATAL = 3,
+ DR_EVT_CLASS_DEAD = 4
+};
+
+enum DR_EVT_LOCALE {
+ DR_EVT_LOCALE_LD = 0x0001,
+ DR_EVT_LOCALE_PD = 0x0002,
+ DR_EVT_LOCALE_ENCL = 0x0004,
+ DR_EVT_LOCALE_BBU = 0x0008,
+ DR_EVT_LOCALE_SAS = 0x0010,
+ DR_EVT_LOCALE_CTRL = 0x0020,
+ DR_EVT_LOCALE_CONFIG = 0x0040,
+ DR_EVT_LOCALE_CLUSTER = 0x0080,
+ DR_EVT_LOCALE_ALL = 0xffff
+};
+
+#define DR_EVT_CFG_CLEARED 0x0004
+#define DR_EVT_LD_CREATED 0x008a
+#define DR_EVT_LD_DELETED 0x008b
+#define DR_EVT_PD_REMOVED_EXT 0x00f8
+#define DR_EVT_PD_INSERTED_EXT 0x00f7
+
+enum LD_STATE {
+ LD_OFFLINE = 0,
+ LD_PARTIALLY_DEGRADED = 1,
+ LD_DEGRADED = 2,
+ LD_OPTIMAL = 3,
+ LD_INVALID = 0xFF
+};
+
+enum DRSAS_EVT {
+ DRSAS_EVT_CONFIG_TGT = 0,
+ DRSAS_EVT_UNCONFIG_TGT = 1,
+ DRSAS_EVT_UNCONFIG_SMP = 2
+};
+
+#define DMA_OBJ_ALLOCATED 1
+#define DMA_OBJ_REALLOCATED 2
+#define DMA_OBJ_FREED 3
+
+/*
+ * dma_obj_t - Our DMA object
+ * @param buffer : kernel virtual address
+ * @param size : size of the data to be allocated
+ * @param acc_handle : access handle
+ * @param dma_handle : dma handle
+ * @param dma_cookie : scatter-gather list
+ * @param dma_attr : dma attributes for this buffer
+ * Our DMA object. The caller must initialize the size and dma attributes
+ * (dma_attr) fields before allocating the resources.
+ */
+typedef struct {
+ caddr_t buffer;
+ uint32_t size;
+ ddi_acc_handle_t acc_handle;
+ ddi_dma_handle_t dma_handle;
+ ddi_dma_cookie_t dma_cookie[DRSAS_MAX_SGE_CNT];
+ ddi_dma_attr_t dma_attr;
+ uint8_t status;
+ uint8_t reserved[3];
+} dma_obj_t;
+
+struct drsas_eventinfo {
+ struct drsas_instance *instance;
+ int tgt;
+ int lun;
+ int event;
+};
+
+struct drsas_ld {
+ dev_info_t *dip;
+ uint8_t lun_type;
+ uint8_t reserved[3];
+};
+
+struct drsas_pd {
+ dev_info_t *dip;
+ uint8_t lun_type;
+ uint8_t dev_id;
+ uint8_t flags;
+ uint8_t reserved;
+};
+
+struct drsas_pd_info {
+ uint16_t deviceId;
+ uint16_t seqNum;
+ uint8_t inquiryData[96];
+ uint8_t vpdPage83[64];
+ uint8_t notSupported;
+ uint8_t scsiDevType;
+ uint8_t a;
+ uint8_t device_speed;
+ uint32_t mediaerrcnt;
+ uint32_t other;
+ uint32_t pred;
+ uint32_t lastpred;
+ uint16_t fwState;
+ uint8_t disabled;
+ uint8_t linkspwwd;
+ uint32_t ddfType;
+ struct {
+ uint8_t count;
+ uint8_t isPathBroken;
+ uint8_t connectorIndex[2];
+ uint8_t reserved[4];
+ uint64_t sasAddr[2];
+ uint8_t reserved2[16];
+ } pathInfo;
+};
+
+typedef struct drsas_instance {
+ uint32_t *producer;
+ uint32_t *consumer;
+
+ uint32_t *reply_queue;
+ dma_obj_t mfi_internal_dma_obj;
+
+ uint8_t init_id;
+ uint8_t reserved[3];
+
+ uint16_t max_num_sge;
+ uint16_t max_fw_cmds;
+ uint32_t max_sectors_per_req;
+
+ struct drsas_cmd **cmd_list;
+
+ mlist_t cmd_pool_list;
+ kmutex_t cmd_pool_mtx;
+
+ mlist_t cmd_pend_list;
+ kmutex_t cmd_pend_mtx;
+
+ dma_obj_t mfi_evt_detail_obj;
+ struct drsas_cmd *aen_cmd;
+
+ uint32_t aen_seq_num;
+ uint32_t aen_class_locale_word;
+
+ scsi_hba_tran_t *tran;
+
+ kcondvar_t int_cmd_cv;
+ kmutex_t int_cmd_mtx;
+
+ kcondvar_t aen_cmd_cv;
+ kmutex_t aen_cmd_mtx;
+
+ kcondvar_t abort_cmd_cv;
+ kmutex_t abort_cmd_mtx;
+
+ dev_info_t *dip;
+ ddi_acc_handle_t pci_handle;
+
+ timeout_id_t timeout_id;
+ uint32_t unique_id;
+ uint16_t fw_outstanding;
+ caddr_t regmap;
+ ddi_acc_handle_t regmap_handle;
+ uint8_t isr_level;
+ ddi_iblock_cookie_t iblock_cookie;
+ ddi_iblock_cookie_t soft_iblock_cookie;
+ ddi_softintr_t soft_intr_id;
+ uint8_t softint_running;
+ kmutex_t completed_pool_mtx;
+ mlist_t completed_pool_list;
+
+ caddr_t internal_buf;
+ uint32_t internal_buf_dmac_add;
+ uint32_t internal_buf_size;
+
+ uint16_t vendor_id;
+ uint16_t device_id;
+ uint16_t subsysvid;
+ uint16_t subsysid;
+ int instance;
+ int baseaddress;
+ char iocnode[16];
+
+ int fm_capabilities;
+
+ struct drsas_func_ptr *func_ptr;
+ /* MSI interrupts specific */
+ ddi_intr_handle_t *intr_htable;
+ int intr_type;
+ int intr_cnt;
+ size_t intr_size;
+ uint_t intr_pri;
+ int intr_cap;
+
+ ddi_taskq_t *taskq;
+ struct drsas_ld *dr_ld_list;
+} drsas_t;
+
+struct drsas_func_ptr {
+ int (*read_fw_status_reg)(struct drsas_instance *);
+ void (*issue_cmd)(struct drsas_cmd *, struct drsas_instance *);
+ int (*issue_cmd_in_sync_mode)(struct drsas_instance *,
+ struct drsas_cmd *);
+ int (*issue_cmd_in_poll_mode)(struct drsas_instance *,
+ struct drsas_cmd *);
+ void (*enable_intr)(struct drsas_instance *);
+ void (*disable_intr)(struct drsas_instance *);
+ int (*intr_ack)(struct drsas_instance *);
+};
+
+/*
+ * ### Helper routines ###
+ */
+
+/*
+ * con_log() - console log routine
+ * @param level : indicates the severity of the message.
+ * @fparam mt : format string
+ *
+ * con_log displays the error messages on the console based on the current
+ * debug level. Also it attaches the appropriate kernel severity level with
+ * the message.
+ *
+ *
+ * console messages debug levels
+ */
+#define CL_NONE 0 /* No debug information */
+#define CL_ANN 1 /* print unconditionally, announcements */
+#define CL_ANN1 2 /* No o/p */
+#define CL_DLEVEL1 3 /* debug level 1, informative */
+#define CL_DLEVEL2 4 /* debug level 2, verbose */
+#define CL_DLEVEL3 5 /* debug level 3, very verbose */
+
+#ifdef __SUNPRO_C
+#define __func__ ""
+#endif
+
+#define con_log(level, fmt) { if (debug_level_g >= level) cmn_err fmt; }
+
+/*
+ * ### SCSA definitions ###
+ */
+#define PKT2TGT(pkt) ((pkt)->pkt_address.a_target)
+#define PKT2LUN(pkt) ((pkt)->pkt_address.a_lun)
+#define PKT2TRAN(pkt) ((pkt)->pkt_adress.a_hba_tran)
+#define ADDR2TRAN(ap) ((ap)->a_hba_tran)
+
+#define TRAN2MR(tran) (struct drsas_instance *)(tran)->tran_hba_private)
+#define ADDR2MR(ap) (TRAN2MR(ADDR2TRAN(ap))
+
+#define PKT2CMD(pkt) ((struct scsa_cmd *)(pkt)->pkt_ha_private)
+#define CMD2PKT(sp) ((sp)->cmd_pkt)
+#define PKT2REQ(pkt) (&(PKT2CMD(pkt)->request))
+
+#define CMD2ADDR(cmd) (&CMD2PKT(cmd)->pkt_address)
+#define CMD2TRAN(cmd) (CMD2PKT(cmd)->pkt_address.a_hba_tran)
+#define CMD2MR(cmd) (TRAN2MR(CMD2TRAN(cmd)))
+
+#define CFLAG_DMAVALID 0x0001 /* requires a dma operation */
+#define CFLAG_DMASEND 0x0002 /* Transfer from the device */
+#define CFLAG_CONSISTENT 0x0040 /* consistent data transfer */
+
+/*
+ * ### Data structures for ioctl inteface and internal commands ###
+ */
+
+/*
+ * Data direction flags
+ */
+#define UIOC_RD 0x00001
+#define UIOC_WR 0x00002
+
+#define SCP2HOST(scp) (scp)->device->host /* to host */
+#define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata /* to soft state */
+#define SCP2CHANNEL(scp) (scp)->device->channel /* to channel */
+#define SCP2TARGET(scp) (scp)->device->id /* to target */
+#define SCP2LUN(scp) (scp)->device->lun /* to LUN */
+
+#define SCSIHOST2ADAP(host) (((caddr_t *)(host->hostdata))[0])
+#define SCP2ADAPTER(scp) \
+ (struct drsas_instance *)SCSIHOST2ADAP(SCP2HOST(scp))
+
+#define MRDRV_IS_LOGICAL_SCSA(instance, acmd) \
+ (acmd->device_id < MRDRV_MAX_LD) ? 1 : 0
+#define MRDRV_IS_LOGICAL(ap) \
+ ((ap->a_target < MRDRV_MAX_LD) && (ap->a_lun == 0)) ? 1 : 0
+#define MAP_DEVICE_ID(instance, ap) \
+ (ap->a_target)
+
+#define HIGH_LEVEL_INTR 1
+#define NORMAL_LEVEL_INTR 0
+
+/*
+ * scsa_cmd - Per-command mr private data
+ * @param cmd_dmahandle : dma handle
+ * @param cmd_dmacookies : current dma cookies
+ * @param cmd_pkt : scsi_pkt reference
+ * @param cmd_dmacount : dma count
+ * @param cmd_cookie : next cookie
+ * @param cmd_ncookies : cookies per window
+ * @param cmd_cookiecnt : cookies per sub-win
+ * @param cmd_nwin : number of dma windows
+ * @param cmd_curwin : current dma window
+ * @param cmd_dma_offset : current window offset
+ * @param cmd_dma_len : current window length
+ * @param cmd_flags : private flags
+ * @param cmd_cdblen : length of cdb
+ * @param cmd_scblen : length of scb
+ * @param cmd_buf : command buffer
+ * @param channel : channel for scsi sub-system
+ * @param target : target for scsi sub-system
+ * @param lun : LUN for scsi sub-system
+ *
+ * - Allocated at same time as scsi_pkt by scsi_hba_pkt_alloc(9E)
+ * - Pointed to by pkt_ha_private field in scsi_pkt
+ */
+struct scsa_cmd {
+ ddi_dma_handle_t cmd_dmahandle;
+ ddi_dma_cookie_t cmd_dmacookies[DRSAS_MAX_SGE_CNT];
+ struct scsi_pkt *cmd_pkt;
+ ulong_t cmd_dmacount;
+ uint_t cmd_cookie;
+ uint_t cmd_ncookies;
+ uint_t cmd_cookiecnt;
+ uint_t cmd_nwin;
+ uint_t cmd_curwin;
+ off_t cmd_dma_offset;
+ ulong_t cmd_dma_len;
+ ulong_t cmd_flags;
+ uint_t cmd_cdblen;
+ uint_t cmd_scblen;
+ struct buf *cmd_buf;
+ ushort_t device_id;
+ uchar_t islogical;
+ uchar_t lun;
+ struct drsas_device *drsas_dev;
+};
+
+
+struct drsas_cmd {
+ union drsas_frame *frame;
+ uint32_t frame_phys_addr;
+ uint8_t *sense;
+ uint32_t sense_phys_addr;
+ dma_obj_t frame_dma_obj;
+ uint8_t frame_dma_obj_status;
+
+ uint32_t index;
+ uint8_t sync_cmd;
+ uint8_t cmd_status;
+ uint16_t abort_aen;
+ mlist_t list;
+ uint32_t frame_count;
+ struct scsa_cmd *cmd;
+ struct scsi_pkt *pkt;
+};
+
+#define MAX_MGMT_ADAPTERS 1024
+#define IOC_SIGNATURE "MR-SAS"
+
+#define IOC_CMD_FIRMWARE 0x0
+#define DRSAS_DRIVER_IOCTL_COMMON 0xF0010000
+#define DRSAS_DRIVER_IOCTL_DRIVER_VERSION 0xF0010100
+#define DRSAS_DRIVER_IOCTL_PCI_INFORMATION 0xF0010200
+#define DRSAS_DRIVER_IOCTL_MRRAID_STATISTICS 0xF0010300
+
+
+#define DRSAS_MAX_SENSE_LENGTH 32
+
+struct drsas_mgmt_info {
+
+ uint16_t count;
+ struct drsas_instance *instance[MAX_MGMT_ADAPTERS];
+ uint16_t map[MAX_MGMT_ADAPTERS];
+ int max_index;
+};
+
+#pragma pack(1)
+
+/*
+ * SAS controller properties
+ */
+struct drsas_ctrl_prop {
+ uint16_t seq_num;
+ uint16_t pred_fail_poll_interval;
+ uint16_t intr_throttle_count;
+ uint16_t intr_throttle_timeouts;
+
+ uint8_t rebuild_rate;
+ uint8_t patrol_read_rate;
+ uint8_t bgi_rate;
+ uint8_t cc_rate;
+ uint8_t recon_rate;
+
+ uint8_t cache_flush_interval;
+
+ uint8_t spinup_drv_count;
+ uint8_t spinup_delay;
+
+ uint8_t cluster_enable;
+ uint8_t coercion_mode;
+ uint8_t disk_write_cache_disable;
+ uint8_t alarm_enable;
+
+ uint8_t reserved[44];
+};
+
+/*
+ * SAS controller information
+ */
+struct drsas_ctrl_info {
+ /* PCI device information */
+ struct {
+ uint16_t vendor_id;
+ uint16_t device_id;
+ uint16_t sub_vendor_id;
+ uint16_t sub_device_id;
+ uint8_t reserved[24];
+ } pci;
+
+ /* Host interface information */
+ struct {
+ uint8_t PCIX : 1;
+ uint8_t PCIE : 1;
+ uint8_t iSCSI : 1;
+ uint8_t SAS_3G : 1;
+ uint8_t reserved_0 : 4;
+ uint8_t reserved_1[6];
+ uint8_t port_count;
+ uint64_t port_addr[8];
+ } host_interface;
+
+ /* Device (backend) interface information */
+ struct {
+ uint8_t SPI : 1;
+ uint8_t SAS_3G : 1;
+ uint8_t SATA_1_5G : 1;
+ uint8_t SATA_3G : 1;
+ uint8_t reserved_0 : 4;
+ uint8_t reserved_1[6];
+ uint8_t port_count;
+ uint64_t port_addr[8];
+ } device_interface;
+
+ /* List of components residing in flash. All str are null terminated */
+ uint32_t image_check_word;
+ uint32_t image_component_count;
+
+ struct {
+ char name[8];
+ char version[32];
+ char build_date[16];
+ char built_time[16];
+ } image_component[8];
+
+ /*
+ * List of flash components that have been flashed on the card, but
+ * are not in use, pending reset of the adapter. This list will be
+ * empty if a flash operation has not occurred. All stings are null
+ * terminated
+ */
+ uint32_t pending_image_component_count;
+
+ struct {
+ char name[8];
+ char version[32];
+ char build_date[16];
+ char build_time[16];
+ } pending_image_component[8];
+
+ uint8_t max_arms;
+ uint8_t max_spans;
+ uint8_t max_arrays;
+ uint8_t max_lds;
+
+ char product_name[80];
+ char serial_no[32];
+
+ /*
+ * Other physical/controller/operation information. Indicates the
+ * presence of the hardware
+ */
+ struct {
+ uint32_t bbu : 1;
+ uint32_t alarm : 1;
+ uint32_t nvram : 1;
+ uint32_t uart : 1;
+ uint32_t reserved : 28;
+ } hw_present;
+
+ uint32_t current_fw_time;
+
+ /* Maximum data transfer sizes */
+ uint16_t max_concurrent_cmds;
+ uint16_t max_sge_count;
+ uint32_t max_request_size;
+
+ /* Logical and physical device counts */
+ uint16_t ld_present_count;
+ uint16_t ld_degraded_count;
+ uint16_t ld_offline_count;
+
+ uint16_t pd_present_count;
+ uint16_t pd_disk_present_count;
+ uint16_t pd_disk_pred_failure_count;
+ uint16_t pd_disk_failed_count;
+
+ /* Memory size information */
+ uint16_t nvram_size;
+ uint16_t memory_size;
+ uint16_t flash_size;
+
+ /* Error counters */
+ uint16_t mem_correctable_error_count;
+ uint16_t mem_uncorrectable_error_count;
+
+ /* Cluster information */
+ uint8_t cluster_permitted;
+ uint8_t cluster_active;
+ uint8_t reserved_1[2];
+
+ /* Controller capabilities structures */
+ struct {
+ uint32_t raid_level_0 : 1;
+ uint32_t raid_level_1 : 1;
+ uint32_t raid_level_5 : 1;
+ uint32_t raid_level_1E : 1;
+ uint32_t reserved : 28;
+ } raid_levels;
+
+ struct {
+ uint32_t rbld_rate : 1;
+ uint32_t cc_rate : 1;
+ uint32_t bgi_rate : 1;
+ uint32_t recon_rate : 1;
+ uint32_t patrol_rate : 1;
+ uint32_t alarm_control : 1;
+ uint32_t cluster_supported : 1;
+ uint32_t bbu : 1;
+ uint32_t spanning_allowed : 1;
+ uint32_t dedicated_hotspares : 1;
+ uint32_t revertible_hotspares : 1;
+ uint32_t foreign_config_import : 1;
+ uint32_t self_diagnostic : 1;
+ uint32_t reserved : 19;
+ } adapter_operations;
+
+ struct {
+ uint32_t read_policy : 1;
+ uint32_t write_policy : 1;
+ uint32_t io_policy : 1;
+ uint32_t access_policy : 1;
+ uint32_t reserved : 28;
+ } ld_operations;
+
+ struct {
+ uint8_t min;
+ uint8_t max;
+ uint8_t reserved[2];
+ } stripe_size_operations;
+
+ struct {
+ uint32_t force_online : 1;
+ uint32_t force_offline : 1;
+ uint32_t force_rebuild : 1;
+ uint32_t reserved : 29;
+ } pd_operations;
+
+ struct {
+ uint32_t ctrl_supports_sas : 1;
+ uint32_t ctrl_supports_sata : 1;
+ uint32_t allow_mix_in_encl : 1;
+ uint32_t allow_mix_in_ld : 1;
+ uint32_t allow_sata_in_cluster : 1;
+ uint32_t reserved : 27;
+ } pd_mix_support;
+
+ /* Include the controller properties (changeable items) */
+ uint8_t reserved_2[12];
+ struct drsas_ctrl_prop properties;
+
+ uint8_t pad[0x800 - 0x640];
+};
+
+/*
+ * ==================================
+ * MegaRAID SAS2.0 driver definitions
+ * ==================================
+ */
+#define MRDRV_MAX_NUM_CMD 1024
+
+#define MRDRV_MAX_PD_CHANNELS 2
+#define MRDRV_MAX_LD_CHANNELS 2
+#define MRDRV_MAX_CHANNELS (MRDRV_MAX_PD_CHANNELS + \
+ MRDRV_MAX_LD_CHANNELS)
+#define MRDRV_MAX_DEV_PER_CHANNEL 128
+#define MRDRV_DEFAULT_INIT_ID -1
+#define MRDRV_MAX_CMD_PER_LUN 1000
+#define MRDRV_MAX_LUN 1
+#define MRDRV_MAX_LD 64
+
+#define MRDRV_RESET_WAIT_TIME 300
+#define MRDRV_RESET_NOTICE_INTERVAL 5
+
+#define DRSAS_IOCTL_CMD 0
+
+/*
+ * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit
+ * SGLs based on the size of dma_addr_t
+ */
+#define IS_DMA64 (sizeof (dma_addr_t) == 8)
+
+#define IB_MSG_0_OFF 0x10 /* XScale */
+#define OB_MSG_0_OFF 0x18 /* XScale */
+#define IB_DOORBELL_OFF 0x20 /* XScale & ROC */
+#define OB_INTR_STATUS_OFF 0x30 /* XScale & ROC */
+#define OB_INTR_MASK_OFF 0x34 /* XScale & ROC */
+#define IB_QPORT_OFF 0x40 /* XScale & ROC */
+#define OB_DOORBELL_CLEAR_OFF 0xA0 /* ROC */
+#define OB_SCRATCH_PAD_0_OFF 0xB0 /* ROC */
+#define OB_INTR_MASK 0xFFFFFFFF
+#define OB_DOORBELL_CLEAR_MASK 0xFFFFFFFF
+
+/*
+ * All MFI register set macros accept drsas_register_set*
+ */
+#define WR_IB_MSG_0(v, instance) ddi_put32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + IB_MSG_0_OFF), (v))
+
+#define RD_OB_MSG_0(instance) ddi_get32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_MSG_0_OFF))
+
+#define WR_IB_DOORBELL(v, instance) ddi_put32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + IB_DOORBELL_OFF), (v))
+
+#define RD_IB_DOORBELL(instance) ddi_get32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + IB_DOORBELL_OFF))
+
+#define WR_OB_INTR_STATUS(v, instance) ddi_put32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_STATUS_OFF), (v))
+
+#define RD_OB_INTR_STATUS(instance) ddi_get32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_STATUS_OFF))
+
+#define WR_OB_INTR_MASK(v, instance) ddi_put32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_MASK_OFF), (v))
+
+#define RD_OB_INTR_MASK(instance) ddi_get32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_MASK_OFF))
+
+#define WR_IB_QPORT(v, instance) ddi_put32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + IB_QPORT_OFF), (v))
+
+#define WR_OB_DOORBELL_CLEAR(v, instance) ddi_put32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_DOORBELL_CLEAR_OFF), \
+ (v))
+
+#define RD_OB_SCRATCH_PAD_0(instance) ddi_get32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_SCRATCH_PAD_0_OFF))
+
+/*
+ * When FW is in MFI_STATE_READY or MFI_STATE_OPERATIONAL, the state data
+ * of Outbound Msg Reg 0 indicates max concurrent cmds supported, max SGEs
+ * supported per cmd and if 64-bit MFAs (M64) is enabled or disabled.
+ */
+#define MFI_OB_INTR_STATUS_MASK 0x00000002
+
+/*
+ * This MFI_REPLY_2108_MESSAGE_INTR flag is used also
+ * in enable_intr_ppc also. Hence bit 2, i.e. 0x4 has
+ * been set in this flag along with bit 1.
+ */
+#define MFI_REPLY_2108_MESSAGE_INTR 0x00000001
+#define MFI_REPLY_2108_MESSAGE_INTR_MASK 0x00000005
+
+#define MFI_POLL_TIMEOUT_SECS 60
+
+#define MFI_ENABLE_INTR(instance) ddi_put32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_MASK_OFF), 1)
+#define MFI_DISABLE_INTR(instance) \
+{ \
+ uint32_t disable = 1; \
+ uint32_t mask = ddi_get32((instance)->regmap_handle, \
+ (uint32_t *)((uintptr_t)(instance)->regmap + OB_INTR_MASK_OFF));\
+ mask &= ~disable; \
+ ddi_put32((instance)->regmap_handle, (uint32_t *) \
+ (uintptr_t)((instance)->regmap + OB_INTR_MASK_OFF), mask); \
+}
+
+/* By default, the firmware programs for 8 Kbytes of memory */
+#define DEFAULT_MFI_MEM_SZ 8192
+#define MINIMUM_MFI_MEM_SZ 4096
+
+/* DCMD Message Frame MAILBOX0-11 */
+#define DCMD_MBOX_SZ 12
+
+
+struct drsas_register_set {
+ uint32_t reserved_0[4];
+
+ uint32_t inbound_msg_0;
+ uint32_t inbound_msg_1;
+ uint32_t outbound_msg_0;
+ uint32_t outbound_msg_1;
+
+ uint32_t inbound_doorbell;
+ uint32_t inbound_intr_status;
+ uint32_t inbound_intr_mask;
+
+ uint32_t outbound_doorbell;
+ uint32_t outbound_intr_status;
+ uint32_t outbound_intr_mask;
+
+ uint32_t reserved_1[2];
+
+ uint32_t inbound_queue_port;
+ uint32_t outbound_queue_port;
+
+ uint32_t reserved_2[22];
+
+ uint32_t outbound_doorbell_clear;
+
+ uint32_t reserved_3[3];
+
+ uint32_t outbound_scratch_pad;
+
+ uint32_t reserved_4[3];
+
+ uint32_t inbound_low_queue_port;
+
+ uint32_t inbound_high_queue_port;
+
+ uint32_t reserved_5;
+ uint32_t index_registers[820];
+};
+
+struct drsas_sge32 {
+ uint32_t phys_addr;
+ uint32_t length;
+};
+
+struct drsas_sge64 {
+ uint64_t phys_addr;
+ uint32_t length;
+};
+
+union drsas_sgl {
+ struct drsas_sge32 sge32[1];
+ struct drsas_sge64 sge64[1];
+};
+
+struct drsas_header {
+ uint8_t cmd;
+ uint8_t sense_len;
+ uint8_t cmd_status;
+ uint8_t scsi_status;
+
+ uint8_t target_id;
+ uint8_t lun;
+ uint8_t cdb_len;
+ uint8_t sge_count;
+
+ uint32_t context;
+ uint8_t req_id;
+ uint8_t msgvector;
+ uint16_t pad_0;
+
+ uint16_t flags;
+ uint16_t timeout;
+ uint32_t data_xferlen;
+};
+
+union drsas_sgl_frame {
+ struct drsas_sge32 sge32[8];
+ struct drsas_sge64 sge64[5];
+};
+
+struct drsas_init_frame {
+ uint8_t cmd;
+ uint8_t reserved_0;
+ uint8_t cmd_status;
+
+ uint8_t reserved_1;
+ uint32_t reserved_2;
+
+ uint32_t context;
+ uint8_t req_id;
+ uint8_t msgvector;
+ uint16_t pad_0;
+
+ uint16_t flags;
+ uint16_t reserved_3;
+ uint32_t data_xfer_len;
+
+ uint32_t queue_info_new_phys_addr_lo;
+ uint32_t queue_info_new_phys_addr_hi;
+ uint32_t queue_info_old_phys_addr_lo;
+ uint32_t queue_info_old_phys_addr_hi;
+
+ uint32_t reserved_4[6];
+};
+
+struct drsas_init_queue_info {
+ uint32_t init_flags;
+ uint32_t reply_queue_entries;
+
+ uint32_t reply_queue_start_phys_addr_lo;
+ uint32_t reply_queue_start_phys_addr_hi;
+ uint32_t producer_index_phys_addr_lo;
+ uint32_t producer_index_phys_addr_hi;
+ uint32_t consumer_index_phys_addr_lo;
+ uint32_t consumer_index_phys_addr_hi;
+};
+
+struct drsas_io_frame {
+ uint8_t cmd;
+ uint8_t sense_len;
+ uint8_t cmd_status;
+ uint8_t scsi_status;
+
+ uint8_t target_id;
+ uint8_t access_byte;
+ uint8_t reserved_0;
+ uint8_t sge_count;
+
+ uint32_t context;
+ uint8_t req_id;
+ uint8_t msgvector;
+ uint16_t pad_0;
+
+ uint16_t flags;
+ uint16_t timeout;
+ uint32_t lba_count;
+
+ uint32_t sense_buf_phys_addr_lo;
+ uint32_t sense_buf_phys_addr_hi;
+
+ uint32_t start_lba_lo;
+ uint32_t start_lba_hi;
+
+ union drsas_sgl sgl;
+};
+
+struct drsas_pthru_frame {
+ uint8_t cmd;
+ uint8_t sense_len;
+ uint8_t cmd_status;
+ uint8_t scsi_status;
+
+ uint8_t target_id;
+ uint8_t lun;
+ uint8_t cdb_len;
+ uint8_t sge_count;
+
+ uint32_t context;
+ uint8_t req_id;
+ uint8_t msgvector;
+ uint16_t pad_0;
+
+ uint16_t flags;
+ uint16_t timeout;
+ uint32_t data_xfer_len;
+
+ uint32_t sense_buf_phys_addr_lo;
+ uint32_t sense_buf_phys_addr_hi;
+
+ uint8_t cdb[16];
+ union drsas_sgl sgl;
+};
+
+struct drsas_dcmd_frame {
+ uint8_t cmd;
+ uint8_t reserved_0;
+ uint8_t cmd_status;
+ uint8_t reserved_1[4];
+ uint8_t sge_count;
+
+ uint32_t context;
+ uint8_t req_id;
+ uint8_t msgvector;
+ uint16_t pad_0;
+
+ uint16_t flags;
+ uint16_t timeout;
+
+ uint32_t data_xfer_len;
+ uint32_t opcode;
+
+ union {
+ uint8_t b[DCMD_MBOX_SZ];
+ uint16_t s[6];
+ uint32_t w[3];
+ } mbox;
+
+ union drsas_sgl sgl;
+};
+
+struct drsas_abort_frame {
+ uint8_t cmd;
+ uint8_t reserved_0;
+ uint8_t cmd_status;
+
+ uint8_t reserved_1;
+ uint32_t reserved_2;
+
+ uint32_t context;
+ uint8_t req_id;
+ uint8_t msgvector;
+ uint16_t pad_0;
+
+ uint16_t flags;
+ uint16_t reserved_3;
+ uint32_t reserved_4;
+
+ uint32_t abort_context;
+ uint32_t pad_1;
+
+ uint32_t abort_mfi_phys_addr_lo;
+ uint32_t abort_mfi_phys_addr_hi;
+
+ uint32_t reserved_5[6];
+};
+
+struct drsas_smp_frame {
+ uint8_t cmd;
+ uint8_t reserved_1;
+ uint8_t cmd_status;
+ uint8_t connection_status;
+
+ uint8_t reserved_2[3];
+ uint8_t sge_count;
+
+ uint32_t context;
+ uint8_t req_id;
+ uint8_t msgvector;
+ uint16_t pad_0;
+
+ uint16_t flags;
+ uint16_t timeout;
+
+ uint32_t data_xfer_len;
+
+ uint64_t sas_addr;
+
+ union drsas_sgl sgl[2];
+};
+
+struct drsas_stp_frame {
+ uint8_t cmd;
+ uint8_t reserved_1;
+ uint8_t cmd_status;
+ uint8_t connection_status;
+
+ uint8_t target_id;
+ uint8_t reserved_2[2];
+ uint8_t sge_count;
+
+ uint32_t context;
+ uint8_t req_id;
+ uint8_t msgvector;
+ uint16_t pad_0;
+
+ uint16_t flags;
+ uint16_t timeout;
+
+ uint32_t data_xfer_len;
+
+ uint16_t fis[10];
+ uint32_t stp_flags;
+ union drsas_sgl sgl;
+};
+
+union drsas_frame {
+ struct drsas_header hdr;
+ struct drsas_init_frame init;
+ struct drsas_io_frame io;
+ struct drsas_pthru_frame pthru;
+ struct drsas_dcmd_frame dcmd;
+ struct drsas_abort_frame abort;
+ struct drsas_smp_frame smp;
+ struct drsas_stp_frame stp;
+
+ uint8_t raw_bytes[64];
+};
+
+typedef struct drsas_pd_address {
+ uint16_t device_id;
+ uint16_t encl_id;
+
+ union {
+ struct {
+ uint8_t encl_index;
+ uint8_t slot_number;
+ } pd_address;
+ struct {
+ uint8_t encl_position;
+ uint8_t encl_connector_index;
+ } encl_address;
+ }address;
+
+ uint8_t scsi_dev_type;
+
+ union {
+ uint8_t port_bitmap;
+ uint8_t port_numbers;
+ } connected;
+
+ uint64_t sas_addr[2];
+} drsas_pd_address_t;
+
+union drsas_evt_class_locale {
+ struct {
+ uint16_t locale;
+ uint8_t reserved;
+ int8_t class;
+ } members;
+
+ uint32_t word;
+};
+
+struct drsas_evt_log_info {
+ uint32_t newest_seq_num;
+ uint32_t oldest_seq_num;
+ uint32_t clear_seq_num;
+ uint32_t shutdown_seq_num;
+ uint32_t boot_seq_num;
+};
+
+struct drsas_progress {
+ uint16_t progress;
+ uint16_t elapsed_seconds;
+};
+
+struct drsas_evtarg_ld {
+ uint16_t target_id;
+ uint8_t ld_index;
+ uint8_t reserved;
+};
+
+struct drsas_evtarg_pd {
+ uint16_t device_id;
+ uint8_t encl_index;
+ uint8_t slot_number;
+};
+
+struct drsas_evt_detail {
+ uint32_t seq_num;
+ uint32_t time_stamp;
+ uint32_t code;
+ union drsas_evt_class_locale cl;
+ uint8_t arg_type;
+ uint8_t reserved1[15];
+
+ union {
+ struct {
+ struct drsas_evtarg_pd pd;
+ uint8_t cdb_length;
+ uint8_t sense_length;
+ uint8_t reserved[2];
+ uint8_t cdb[16];
+ uint8_t sense[64];
+ } cdbSense;
+
+ struct drsas_evtarg_ld ld;
+
+ struct {
+ struct drsas_evtarg_ld ld;
+ uint64_t count;
+ } ld_count;
+
+ struct {
+ uint64_t lba;
+ struct drsas_evtarg_ld ld;
+ } ld_lba;
+
+ struct {
+ struct drsas_evtarg_ld ld;
+ uint32_t prevOwner;
+ uint32_t newOwner;
+ } ld_owner;
+
+ struct {
+ uint64_t ld_lba;
+ uint64_t pd_lba;
+ struct drsas_evtarg_ld ld;
+ struct drsas_evtarg_pd pd;
+ } ld_lba_pd_lba;
+
+ struct {
+ struct drsas_evtarg_ld ld;
+ struct drsas_progress prog;
+ } ld_prog;
+
+ struct {
+ struct drsas_evtarg_ld ld;
+ uint32_t prev_state;
+ uint32_t new_state;
+ } ld_state;
+
+ struct {
+ uint64_t strip;
+ struct drsas_evtarg_ld ld;
+ } ld_strip;
+
+ struct drsas_evtarg_pd pd;
+
+ struct {
+ struct drsas_evtarg_pd pd;
+ uint32_t err;
+ } pd_err;
+
+ struct {
+ uint64_t lba;
+ struct drsas_evtarg_pd pd;
+ } pd_lba;
+
+ struct {
+ uint64_t lba;
+ struct drsas_evtarg_pd pd;
+ struct drsas_evtarg_ld ld;
+ } pd_lba_ld;
+
+ struct {
+ struct drsas_evtarg_pd pd;
+ struct drsas_progress prog;
+ } pd_prog;
+
+ struct {
+ struct drsas_evtarg_pd pd;
+ uint32_t prevState;
+ uint32_t newState;
+ } pd_state;
+
+ struct {
+ uint16_t vendorId;
+ uint16_t deviceId;
+ uint16_t subVendorId;
+ uint16_t subDeviceId;
+ } pci;
+
+ uint32_t rate;
+ char str[96];
+
+ struct {
+ uint32_t rtc;
+ uint32_t elapsedSeconds;
+ } time;
+
+ struct {
+ uint32_t ecar;
+ uint32_t elog;
+ char str[64];
+ } ecc;
+
+ drsas_pd_address_t pd_addr;
+
+ uint8_t b[96];
+ uint16_t s[48];
+ uint32_t w[24];
+ uint64_t d[12];
+ } args;
+
+ char description[128];
+
+};
+
+/* only 63 are usable by the application */
+#define MAX_LOGICAL_DRIVES 64
+/* only 255 physical devices may be used */
+#define MAX_PHYSICAL_DEVICES 256
+#define MAX_PD_PER_ENCLOSURE 64
+/* maximum disks per array */
+#define MAX_ROW_SIZE 32
+/* maximum spans per logical drive */
+#define MAX_SPAN_DEPTH 8
+/* maximum number of arrays a hot spare may be dedicated to */
+#define MAX_ARRAYS_DEDICATED 16
+/* maximum number of arrays which may exist */
+#define MAX_ARRAYS 128
+/* maximum number of foreign configs that may ha managed at once */
+#define MAX_FOREIGN_CONFIGS 8
+/* maximum spares (global and dedicated combined) */
+#define MAX_SPARES_FOR_THE_CONTROLLER MAX_PHYSICAL_DEVICES
+/* maximum possible Target IDs (i.e. 0 to 63) */
+#define MAX_TARGET_ID 63
+/* maximum number of supported enclosures */
+#define MAX_ENCLOSURES 32
+/* maximum number of PHYs per controller */
+#define MAX_PHYS_PER_CONTROLLER 16
+/* maximum number of LDs per array (due to DDF limitations) */
+#define MAX_LDS_PER_ARRAY 16
+
+/*
+ * -----------------------------------------------------------------------------
+ * -----------------------------------------------------------------------------
+ *
+ * Logical Drive commands
+ *
+ * -----------------------------------------------------------------------------
+ * -----------------------------------------------------------------------------
+ */
+#define DR_DCMD_LD 0x03000000, /* Logical Device (LD) opcodes */
+
+/*
+ * Input: dcmd.opcode - DR_DCMD_LD_GET_LIST
+ * dcmd.mbox - reserved
+ * dcmd.sge IN - ptr to returned DR_LD_LIST structure
+ * Desc: Return the logical drive list structure
+ * Status: No error
+ */
+
+/*
+ * defines the logical drive reference structure
+ */
+typedef union _DR_LD_REF { /* LD reference structure */
+ struct {
+ uint8_t targetId; /* LD target id (0 to MAX_TARGET_ID) */
+ uint8_t reserved; /* reserved for in line with DR_PD_REF */
+ uint16_t seqNum; /* Sequence Number */
+ } ld_ref;
+ uint32_t ref; /* shorthand reference to full 32-bits */
+} DR_LD_REF; /* 4 bytes */
+
+/*
+ * defines the logical drive list structure
+ */
+typedef struct _DR_LD_LIST {
+ uint32_t ldCount; /* number of LDs */
+ uint32_t reserved; /* pad to 8-byte boundary */
+ struct {
+ DR_LD_REF ref; /* LD reference */
+ uint8_t state; /* current LD state (DR_LD_STATE) */
+ uint8_t reserved[3]; /* pad to 8-byte boundary */
+ uint64_t size; /* LD size */
+ } ldList[MAX_LOGICAL_DRIVES];
+} DR_LD_LIST;
+
+struct drsas_drv_ver {
+ uint8_t signature[12];
+ uint8_t os_name[16];
+ uint8_t os_ver[12];
+ uint8_t drv_name[20];
+ uint8_t drv_ver[32];
+ uint8_t drv_rel_date[20];
+};
+
+#define PCI_TYPE0_ADDRESSES 6
+#define PCI_TYPE1_ADDRESSES 2
+#define PCI_TYPE2_ADDRESSES 5
+
+struct drsas_pci_common_header {
+ uint16_t vendorID; /* (ro) */
+ uint16_t deviceID; /* (ro) */
+ uint16_t command; /* Device control */
+ uint16_t status;
+ uint8_t revisionID; /* (ro) */
+ uint8_t progIf; /* (ro) */
+ uint8_t subClass; /* (ro) */
+ uint8_t baseClass; /* (ro) */
+ uint8_t cacheLineSize; /* (ro+) */
+ uint8_t latencyTimer; /* (ro+) */
+ uint8_t headerType; /* (ro) */
+ uint8_t bist; /* Built in self test */
+
+ union {
+ struct {
+ uint32_t baseAddresses[PCI_TYPE0_ADDRESSES];
+ uint32_t cis;
+ uint16_t subVendorID;
+ uint16_t subSystemID;
+ uint32_t romBaseAddress;
+ uint8_t capabilitiesPtr;
+ uint8_t reserved1[3];
+ uint32_t reserved2;
+ uint8_t interruptLine;
+ uint8_t interruptPin; /* (ro) */
+ uint8_t minimumGrant; /* (ro) */
+ uint8_t maximumLatency; /* (ro) */
+ } type_0;
+
+ struct {
+ uint32_t baseAddresses[PCI_TYPE1_ADDRESSES];
+ uint8_t primaryBus;
+ uint8_t secondaryBus;
+ uint8_t subordinateBus;
+ uint8_t secondaryLatency;
+ uint8_t ioBase;
+ uint8_t ioLimit;
+ uint16_t secondaryStatus;
+ uint16_t memoryBase;
+ uint16_t memoryLimit;
+ uint16_t prefetchBase;
+ uint16_t prefetchLimit;
+ uint32_t prefetchBaseUpper32;
+ uint32_t prefetchLimitUpper32;
+ uint16_t ioBaseUpper16;
+ uint16_t ioLimitUpper16;
+ uint8_t capabilitiesPtr;
+ uint8_t reserved1[3];
+ uint32_t romBaseAddress;
+ uint8_t interruptLine;
+ uint8_t interruptPin;
+ uint16_t bridgeControl;
+ } type_1;
+
+ struct {
+ uint32_t socketRegistersBaseAddress;
+ uint8_t capabilitiesPtr;
+ uint8_t reserved;
+ uint16_t secondaryStatus;
+ uint8_t primaryBus;
+ uint8_t secondaryBus;
+ uint8_t subordinateBus;
+ uint8_t secondaryLatency;
+ struct {
+ uint32_t base;
+ uint32_t limit;
+ } range[PCI_TYPE2_ADDRESSES-1];
+ uint8_t interruptLine;
+ uint8_t interruptPin;
+ uint16_t bridgeControl;
+ } type_2;
+ } header;
+};
+
+struct drsas_pci_link_capability {
+ union {
+ struct {
+ uint32_t linkSpeed :4;
+ uint32_t linkWidth :6;
+ uint32_t aspmSupport :2;
+ uint32_t losExitLatency :3;
+ uint32_t l1ExitLatency :3;
+ uint32_t rsvdp :6;
+ uint32_t portNumber :8;
+ } bits;
+
+ uint32_t asUlong;
+ } cap;
+
+};
+
+struct drsas_pci_link_status_capability {
+ union {
+ struct {
+ uint16_t linkSpeed :4;
+ uint16_t negotiatedLinkWidth :6;
+ uint16_t linkTrainingError :1;
+ uint16_t linkTraning :1;
+ uint16_t slotClockConfig :1;
+ uint16_t rsvdZ :3;
+ } bits;
+
+ uint16_t asUshort;
+ } stat_cap;
+
+ uint16_t reserved;
+
+};
+
+struct drsas_pci_capabilities {
+ struct drsas_pci_link_capability linkCapability;
+ struct drsas_pci_link_status_capability linkStatusCapability;
+};
+
+struct drsas_pci_information
+{
+ uint32_t busNumber;
+ uint8_t deviceNumber;
+ uint8_t functionNumber;
+ uint8_t interruptVector;
+ uint8_t reserved;
+ struct drsas_pci_common_header pciHeaderInfo;
+ struct drsas_pci_capabilities capability;
+ uint8_t reserved2[32];
+};
+
+struct drsas_ioctl {
+ uint16_t version;
+ uint16_t controller_id;
+ uint8_t signature[8];
+ uint32_t reserved_1;
+ uint32_t control_code;
+ uint32_t reserved_2[2];
+ uint8_t frame[64];
+ union drsas_sgl_frame sgl_frame;
+ uint8_t sense_buff[DRSAS_MAX_SENSE_LENGTH];
+ uint8_t data[1];
+};
+
+struct drsas_aen {
+ uint16_t host_no;
+ uint16_t cmd_status;
+ uint32_t seq_num;
+ uint32_t class_locale_word;
+};
+#pragma pack()
+
+#ifndef DDI_VENDOR_LSI
+#define DDI_VENDOR_LSI "LSI"
+#endif /* DDI_VENDOR_LSI */
+
+static int drsas_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
+static int drsas_attach(dev_info_t *, ddi_attach_cmd_t);
+static int drsas_reset(dev_info_t *, ddi_reset_cmd_t);
+static int drsas_detach(dev_info_t *, ddi_detach_cmd_t);
+static int drsas_open(dev_t *, int, int, cred_t *);
+static int drsas_close(dev_t, int, int, cred_t *);
+static int drsas_ioctl(dev_t, int, intptr_t, int, cred_t *, int *);
+
+static int drsas_tran_tgt_init(dev_info_t *, dev_info_t *,
+ scsi_hba_tran_t *, struct scsi_device *);
+static struct scsi_pkt *drsas_tran_init_pkt(struct scsi_address *, register
+ struct scsi_pkt *, struct buf *, int, int, int, int,
+ int (*)(), caddr_t);
+static int drsas_tran_start(struct scsi_address *,
+ register struct scsi_pkt *);
+static int drsas_tran_abort(struct scsi_address *, struct scsi_pkt *);
+static int drsas_tran_reset(struct scsi_address *, int);
+static int drsas_tran_getcap(struct scsi_address *, char *, int);
+static int drsas_tran_setcap(struct scsi_address *, char *, int, int);
+static void drsas_tran_destroy_pkt(struct scsi_address *,
+ struct scsi_pkt *);
+static void drsas_tran_dmafree(struct scsi_address *, struct scsi_pkt *);
+static void drsas_tran_sync_pkt(struct scsi_address *, struct scsi_pkt *);
+static uint_t drsas_isr();
+static uint_t drsas_softintr();
+
+static int init_mfi(struct drsas_instance *);
+static int drsas_free_dma_obj(struct drsas_instance *, dma_obj_t);
+static int drsas_alloc_dma_obj(struct drsas_instance *, dma_obj_t *,
+ uchar_t);
+static struct drsas_cmd *get_mfi_pkt(struct drsas_instance *);
+static void return_mfi_pkt(struct drsas_instance *,
+ struct drsas_cmd *);
+
+static void free_space_for_mfi(struct drsas_instance *);
+static void free_additional_dma_buffer(struct drsas_instance *);
+static int alloc_additional_dma_buffer(struct drsas_instance *);
+static int read_fw_status_reg_ppc(struct drsas_instance *);
+static void issue_cmd_ppc(struct drsas_cmd *, struct drsas_instance *);
+static int issue_cmd_in_poll_mode_ppc(struct drsas_instance *,
+ struct drsas_cmd *);
+static int issue_cmd_in_sync_mode_ppc(struct drsas_instance *,
+ struct drsas_cmd *);
+static void enable_intr_ppc(struct drsas_instance *);
+static void disable_intr_ppc(struct drsas_instance *);
+static int intr_ack_ppc(struct drsas_instance *);
+static int mfi_state_transition_to_ready(struct drsas_instance *);
+static void destroy_mfi_frame_pool(struct drsas_instance *);
+static int create_mfi_frame_pool(struct drsas_instance *);
+static int drsas_dma_alloc(struct drsas_instance *, struct scsi_pkt *,
+ struct buf *, int, int (*)());
+static int drsas_dma_move(struct drsas_instance *,
+ struct scsi_pkt *, struct buf *);
+static void flush_cache(struct drsas_instance *instance);
+static void display_scsi_inquiry(caddr_t);
+static int start_mfi_aen(struct drsas_instance *instance);
+static int handle_drv_ioctl(struct drsas_instance *instance,
+ struct drsas_ioctl *ioctl, int mode);
+static int handle_mfi_ioctl(struct drsas_instance *instance,
+ struct drsas_ioctl *ioctl, int mode);
+static int handle_mfi_aen(struct drsas_instance *instance,
+ struct drsas_aen *aen);
+static void fill_up_drv_ver(struct drsas_drv_ver *dv);
+static struct drsas_cmd *build_cmd(struct drsas_instance *instance,
+ struct scsi_address *ap, struct scsi_pkt *pkt,
+ uchar_t *cmd_done);
+static int register_mfi_aen(struct drsas_instance *instance,
+ uint32_t seq_num, uint32_t class_locale_word);
+static int issue_mfi_pthru(struct drsas_instance *instance, struct
+ drsas_ioctl *ioctl, struct drsas_cmd *cmd, int mode);
+static int issue_mfi_dcmd(struct drsas_instance *instance, struct
+ drsas_ioctl *ioctl, struct drsas_cmd *cmd, int mode);
+static int issue_mfi_smp(struct drsas_instance *instance, struct
+ drsas_ioctl *ioctl, struct drsas_cmd *cmd, int mode);
+static int issue_mfi_stp(struct drsas_instance *instance, struct
+ drsas_ioctl *ioctl, struct drsas_cmd *cmd, int mode);
+static int abort_aen_cmd(struct drsas_instance *instance,
+ struct drsas_cmd *cmd_to_abort);
+
+static int drsas_common_check(struct drsas_instance *instance,
+ struct drsas_cmd *cmd);
+static void drsas_fm_init(struct drsas_instance *instance);
+static void drsas_fm_fini(struct drsas_instance *instance);
+static int drsas_fm_error_cb(dev_info_t *, ddi_fm_error_t *,
+ const void *);
+static void drsas_fm_ereport(struct drsas_instance *instance,
+ char *detail);
+static int drsas_check_dma_handle(ddi_dma_handle_t handle);
+static int drsas_check_acc_handle(ddi_acc_handle_t handle);
+
+static void drsas_rem_intrs(struct drsas_instance *instance);
+static int drsas_add_intrs(struct drsas_instance *instance, int intr_type);
+
+static void drsas_tran_tgt_free(dev_info_t *, dev_info_t *,
+ scsi_hba_tran_t *, struct scsi_device *);
+static int drsas_tran_bus_config(dev_info_t *, uint_t,
+ ddi_bus_config_op_t, void *, dev_info_t **);
+static int drsas_parse_devname(char *, int *, int *);
+static int drsas_config_all_devices(struct drsas_instance *);
+static int drsas_config_scsi_device(struct drsas_instance *,
+ struct scsi_device *, dev_info_t **);
+static int drsas_config_ld(struct drsas_instance *, uint16_t,
+ uint8_t, dev_info_t **);
+static dev_info_t *drsas_find_child(struct drsas_instance *, uint16_t,
+ uint8_t);
+static int drsas_name_node(dev_info_t *, char *, int);
+static void drsas_issue_evt_taskq(struct drsas_eventinfo *);
+static int drsas_service_evt(struct drsas_instance *, int, int, int,
+ uint64_t);
+static int drsas_mode_sense_build(struct scsi_pkt *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DR_SAS_H_ */
diff --git a/usr/src/uts/common/io/dr_sas/dr_sas_list.h b/usr/src/uts/common/io/dr_sas/dr_sas_list.h
new file mode 100644
index 0000000000..4154a77796
--- /dev/null
+++ b/usr/src/uts/common/io/dr_sas/dr_sas_list.h
@@ -0,0 +1,212 @@
+/*
+ * dr_sas_list.h: header for dr_sas
+ *
+ * Solaris MegaRAID driver for SAS2.0 controllers
+ * Copyright (c) 2008-2009, LSI Logic Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the author nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _DR_SAS_LIST_H_
+#define _DR_SAS_LIST_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+struct mlist_head {
+ struct mlist_head *next, *prev;
+};
+
+typedef struct mlist_head mlist_t;
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+ struct mlist_head name = LIST_HEAD_INIT(name)
+
+#define INIT_LIST_HEAD(ptr) { \
+ (ptr)->next = (ptr); (ptr)->prev = (ptr); \
+}
+
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static void __list_add(struct mlist_head *new,
+ struct mlist_head *prev,
+ struct mlist_head *next)
+{
+ next->prev = new;
+ new->next = next;
+ new->prev = prev;
+ prev->next = new;
+}
+
+
+/*
+ * mlist_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+static void mlist_add(struct mlist_head *new, struct mlist_head *head)
+{
+ __list_add(new, head, head->next);
+}
+
+
+/*
+ * mlist_add_tail - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+static void mlist_add_tail(struct mlist_head *new, struct mlist_head *head)
+{
+ __list_add(new, head->prev, head);
+}
+
+
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static void __list_del(struct mlist_head *prev,
+ struct mlist_head *next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+
+
+/*
+ * mlist_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+static void mlist_del_init(struct mlist_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ INIT_LIST_HEAD(entry);
+}
+
+
+/*
+ * mlist_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static int mlist_empty(struct mlist_head *head)
+{
+ return (head->next == head);
+}
+
+
+/*
+ * mlist_splice - join two lists
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static void mlist_splice(struct mlist_head *list, struct mlist_head *head)
+{
+ struct mlist_head *first = list->next;
+
+ if (first != list) {
+ struct mlist_head *last = list->prev;
+ struct mlist_head *at = head->next;
+
+ first->prev = head;
+ head->next = first;
+
+ last->next = at;
+ at->prev = last;
+ }
+}
+
+
+/*
+ * mlist_entry - get the struct for this entry
+ * @ptr: the &struct mlist_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define mlist_entry(ptr, type, member) \
+ ((type *)((size_t)(ptr) - offsetof(type, member)))
+
+
+/*
+ * mlist_for_each - iterate over a list
+ * @pos: the &struct mlist_head to use as a loop counter.
+ * @head: the head for your list.
+ */
+#define mlist_for_each(pos, head) \
+ for (pos = (head)->next, prefetch(pos->next); pos != (head); \
+ pos = pos->next, prefetch(pos->next))
+
+
+/*
+ * mlist_for_each_safe - iterate over a list safe against removal of list entry
+ * @pos: the &struct mlist_head to use as a loop counter.
+ * @n: another &struct mlist_head to use as temporary storage
+ * @head: the head for your list.
+ */
+#define mlist_for_each_safe(pos, n, head) \
+ for (pos = (head)->next, n = pos->next; pos != (head); \
+ pos = n, n = pos->next)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DR_SAS_LIST_H_ */
diff --git a/usr/src/uts/common/io/fibre-channel/fca/oce/oce_rx.c b/usr/src/uts/common/io/fibre-channel/fca/oce/oce_rx.c
index da00160b68..2efb178ff1 100644
--- a/usr/src/uts/common/io/fibre-channel/fca/oce/oce_rx.c
+++ b/usr/src/uts/common/io/fibre-channel/fca/oce/oce_rx.c
@@ -532,8 +532,7 @@ oce_drain_rq_cq(void *arg)
if (dev->function_mode & FLEX10_MODE) {
if (cqe->u0.s.vlan_tag_present &&
cqe->u0.s.qnq) {
- oce_rx_insert_tag(mp,
- cqe->u0.s.vlan_tag);
+ oce_rx_insert_tag(mp, cqe->u0.s.vlan_tag);
}
} else if (cqe->u0.s.vlan_tag_present) {
oce_rx_insert_tag(mp, cqe->u0.s.vlan_tag);
diff --git a/usr/src/uts/common/io/igb/igb_api.c b/usr/src/uts/common/io/igb/igb_api.c
index d151d0abec..da3a428214 100644
--- a/usr/src/uts/common/io/igb/igb_api.c
+++ b/usr/src/uts/common/io/igb/igb_api.c
@@ -984,9 +984,10 @@ e1000_read_mac_addr(struct e1000_hw *hw)
}
/*
- * e1000_read_pba_num - Read device part number
+ * e1000_read_pba_string - Read device part number string
* @hw: pointer to the HW structure
* @pba_num: pointer to device part number
+ * @pba_num_size: size of part number buffer
*
* Reads the product board assembly (PBA) number from the EEPROM and stores
* the value in pba_num.
@@ -994,9 +995,24 @@ e1000_read_mac_addr(struct e1000_hw *hw)
* generic version of this function.
*/
s32
-e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
+e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size)
{
- return (e1000_read_pba_num_generic(hw, pba_num));
+ return (e1000_read_pba_string_generic(hw, pba_num, pba_num_size));
+}
+
+/*
+ * e1000_read_pba_length - Read device part number string length
+ * @hw: pointer to the HW structure
+ * @pba_num_size: size of part number buffer
+ *
+ * Reads the product board assembly (PBA) number length from the EEPROM and
+ * stores the value in pba_num.
+ * Currently no func pointer exists and all implementations are handled in the
+ * generic version of this function.
+ */
+s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size)
+{
+ return e1000_read_pba_length_generic(hw, pba_num_size);
}
/*
diff --git a/usr/src/uts/common/io/igb/igb_api.h b/usr/src/uts/common/io/igb/igb_api.h
index 9574fc4593..fe5af41526 100644
--- a/usr/src/uts/common/io/igb/igb_api.h
+++ b/usr/src/uts/common/io/igb/igb_api.h
@@ -87,7 +87,8 @@ s32 e1000_phy_commit(struct e1000_hw *hw);
void e1000_power_up_phy(struct e1000_hw *hw);
void e1000_power_down_phy(struct e1000_hw *hw);
s32 e1000_read_mac_addr(struct e1000_hw *hw);
-s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num);
+s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size);
+s32 e1000_read_pbe_length(struct e1000_hw *hw, u32 *pba_num_size);
void e1000_reload_nvm(struct e1000_hw *hw);
s32 e1000_update_nvm_checksum(struct e1000_hw *hw);
s32 e1000_validate_nvm_checksum(struct e1000_hw *hw);
diff --git a/usr/src/uts/common/io/igb/igb_defines.h b/usr/src/uts/common/io/igb/igb_defines.h
index 9b238132dc..91230531f8 100644
--- a/usr/src/uts/common/io/igb/igb_defines.h
+++ b/usr/src/uts/common/io/igb/igb_defines.h
@@ -946,6 +946,9 @@ extern "C" {
#define E1000_ERR_SWFW_SYNC 13
#define E1000_NOT_IMPLEMENTED 14
#define E1000_ERR_MBX 15
+#define E1000_ERR_INVALID_ARGUMENT 16
+#define E1000_ERR_NO_SPACE 17
+#define E1000_ERR_NVM_PBA_SECTION 18
/* Loop limit on how long we wait for auto-negotiation to complete */
#define FIBER_LINK_UP_LIMIT 50
@@ -1230,8 +1233,11 @@ extern "C" {
#define NVM_SUM 0xBABA
#define NVM_MAC_ADDR_OFFSET 0
+#define NVM_OEM_OFFSET_0 6
+#define NVM_OEM_OFFSET_1 7
#define NVM_PBA_OFFSET_0 8
#define NVM_PBA_OFFSET_1 9
+#define NVM_PBA_PTR_GUARD 0xFAFA
#define NVM_RESERVED_WORD 0xFFFF
#define NVM_PHY_CLASS_A 0x8000
#define NVM_SERDES_AMPLITUDE_MASK 0x000F
@@ -1240,6 +1246,8 @@ extern "C" {
#define NVM_WORD_SIZE_BASE_SHIFT 6
#define NVM_SWDPIO_EXT_SHIFT 4
+#define E1000_PBANUM_LENGTH 11
+
/* NVM Commands - Microwire */
#define NVM_READ_OPCODE_MICROWIRE 0x6 /* NVM read opcode */
#define NVM_WRITE_OPCODE_MICROWIRE 0x5 /* NVM write opcode */
diff --git a/usr/src/uts/common/io/igb/igb_main.c b/usr/src/uts/common/io/igb/igb_main.c
index 7864a3193f..19abbdf76a 100644
--- a/usr/src/uts/common/io/igb/igb_main.c
+++ b/usr/src/uts/common/io/igb/igb_main.c
@@ -1254,6 +1254,10 @@ igb_init_adapter(igb_t *igb)
struct e1000_hw *hw = &igb->hw;
uint32_t pba;
uint32_t high_water;
+ int oemid[2];
+ uint16_t nvmword;
+ u8 pbanum[E1000_PBANUM_LENGTH];
+ char eepromver[5]; /* f.ff */
int i;
ASSERT(mutex_owned(&igb->gen_lock));
@@ -1397,6 +1401,33 @@ igb_init_adapter(igb_t *igb)
E1000_WRITE_REG(hw, E1000_EITR(i), igb->intr_throttling[i]);
/*
+ * Read identifying information and place in devinfo.
+ */
+ nvmword = 0xffff;
+ (void) e1000_read_nvm(&igb->hw, NVM_OEM_OFFSET_0, 1, &nvmword);
+ oemid[0] = (int)nvmword;
+ (void) e1000_read_nvm(&igb->hw, NVM_OEM_OFFSET_1, 1, &nvmword);
+ oemid[1] = (int)nvmword;
+ (void) ddi_prop_update_int_array(DDI_DEV_T_NONE, igb->dip,
+ "oem-identifier", oemid, 2);
+
+ pbanum[0] = '\0';
+ (void) e1000_read_pba_string(&igb->hw, pbanum, sizeof (pbanum));
+ if (*pbanum != '\0') {
+ (void) ddi_prop_update_string(DDI_DEV_T_NONE, igb->dip,
+ "printed-board-assembly", (char *)pbanum);
+ }
+
+ nvmword = 0xffff;
+ (void) e1000_read_nvm(&igb->hw, NVM_VERSION, 1, &nvmword);
+ if ((nvmword & 0xf00) == 0) {
+ (void) snprintf(eepromver, sizeof (eepromver), "%x.%x",
+ (nvmword & 0xf000) >> 12, (nvmword & 0xff));
+ (void) ddi_prop_update_string(DDI_DEV_T_NONE, igb->dip,
+ "nvm-version", eepromver);
+ }
+
+ /*
* Save the state of the phy
*/
igb_get_phy_state(igb);
diff --git a/usr/src/uts/common/io/igb/igb_nvm.c b/usr/src/uts/common/io/igb/igb_nvm.c
index 71901e0263..6f809a9338 100644
--- a/usr/src/uts/common/io/igb/igb_nvm.c
+++ b/usr/src/uts/common/io/igb/igb_nvm.c
@@ -728,37 +728,172 @@ out:
}
/*
- * e1000_read_pba_num_generic - Read device part number
+ * e1000_read_pba_string_generic - Read device part number
* @hw: pointer to the HW structure
* @pba_num: pointer to device part number
+ * @pba_num_size: size of part number buffer
*
* Reads the product board assembly (PBA) number from the EEPROM and stores
* the value in pba_num.
*/
-s32
-e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num)
+s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
+ u32 pba_num_size)
{
- s32 ret_val;
+ s32 ret_val;
u16 nvm_data;
+ u16 pba_ptr;
+ u16 offset;
+ u16 length;
+
+ DEBUGFUNC("e1000_read_pba_string_generic");
- DEBUGFUNC("e1000_read_pba_num_generic");
+ if (pba_num == NULL) {
+ DEBUGOUT("PBA string buffer was null\n");
+ return (-E1000_ERR_INVALID_ARGUMENT);
+ }
ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
if (ret_val) {
DEBUGOUT("NVM Read Error\n");
- goto out;
+ return (ret_val);
}
- *pba_num = (u32)(nvm_data << 16);
- ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
+ ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &pba_ptr);
if (ret_val) {
DEBUGOUT("NVM Read Error\n");
- goto out;
+ return (ret_val);
}
- *pba_num |= nvm_data;
-out:
- return (ret_val);
+ /* if nvm_data is not ptr guard the PBA must be in legacy format which
+ * means pba_ptr is actually our second data word for the PBA number
+ * and we can decode it into an ascii string
+ */
+ if (nvm_data != NVM_PBA_PTR_GUARD) {
+ DEBUGOUT("NVM PBA number is not stored as string\n");
+
+ /* make sure callers buffer is big enough to store the PBA */
+ if (pba_num_size < E1000_PBANUM_LENGTH) {
+ DEBUGOUT("PBA string buffer too small\n");
+ return (-E1000_ERR_NO_SPACE);
+ }
+
+ /* extract hex string from data and pba_ptr */
+ pba_num[0] = (nvm_data >> 12) & 0xF;
+ pba_num[1] = (nvm_data >> 8) & 0xF;
+ pba_num[2] = (nvm_data >> 4) & 0xF;
+ pba_num[3] = nvm_data & 0xF;
+ pba_num[4] = (pba_ptr >> 12) & 0xF;
+ pba_num[5] = (pba_ptr >> 8) & 0xF;
+ pba_num[6] = '-';
+ pba_num[7] = 0;
+ pba_num[8] = (pba_ptr >> 4) & 0xF;
+ pba_num[9] = pba_ptr & 0xF;
+
+ /* put a null character on the end of our string */
+ pba_num[10] = '\0';
+
+ /* switch all the data but the '-' to hex char */
+ for (offset = 0; offset < 10; offset++) {
+ if (pba_num[offset] < 0xA)
+ pba_num[offset] += '0';
+ else if (pba_num[offset] < 0x10)
+ pba_num[offset] += 'A' - 0xA;
+ }
+
+ return (E1000_SUCCESS);
+ }
+
+ ret_val = hw->nvm.ops.read(hw, pba_ptr, 1, &length);
+ if (ret_val) {
+ DEBUGOUT("NVM Read Error\n");
+ return (ret_val);
+ }
+
+ if (length == 0xFFFF || length == 0) {
+ DEBUGOUT("NVM PBA number section invalid length\n");
+ return (-E1000_ERR_NVM_PBA_SECTION);
+ }
+ /* check if pba_num buffer is big enough */
+ if (pba_num_size < (((u32)length * 2) - 1)) {
+ DEBUGOUT("PBA string buffer too small\n");
+ return (-E1000_ERR_NO_SPACE);
+ }
+
+ /* trim pba length from start of string */
+ pba_ptr++;
+ length--;
+
+ for (offset = 0; offset < length; offset++) {
+ ret_val = hw->nvm.ops.read(hw, pba_ptr + offset, 1, &nvm_data);
+ if (ret_val) {
+ DEBUGOUT("NVM Read Error\n");
+ return (ret_val);
+ }
+ pba_num[offset * 2] = (u8)(nvm_data >> 8);
+ pba_num[(offset * 2) + 1] = (u8)(nvm_data & 0xFF);
+ }
+ pba_num[offset * 2] = '\0';
+
+ return (E1000_SUCCESS);
+}
+
+/*
+ * e1000_read_pba_length_generic - Read device part number length
+ * @hw: pointer to the HW structure
+ * @pba_num_size: size of part number buffer
+ *
+ * Reads the product board assembly (PBA) number length from the EEPROM and
+ * stores the value in pba_num_size.
+ */
+s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size)
+{
+ s32 ret_val;
+ u16 nvm_data;
+ u16 pba_ptr;
+ u16 length;
+
+ DEBUGFUNC("e1000_read_pba_length_generic");
+
+ if (pba_num_size == NULL) {
+ DEBUGOUT("PBA buffer size was null\n");
+ return (-E1000_ERR_INVALID_ARGUMENT);
+ }
+
+ ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
+ if (ret_val) {
+ DEBUGOUT("NVM Read Error\n");
+ return (ret_val);
+ }
+
+ ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &pba_ptr);
+ if (ret_val) {
+ DEBUGOUT("NVM Read Error\n");
+ return (ret_val);
+ }
+
+ /* if data is not ptr guard the PBA must be in legacy format */
+ if (nvm_data != NVM_PBA_PTR_GUARD) {
+ *pba_num_size = E1000_PBANUM_LENGTH;
+ return (E1000_SUCCESS);
+ }
+
+ ret_val = hw->nvm.ops.read(hw, pba_ptr, 1, &length);
+ if (ret_val) {
+ DEBUGOUT("NVM Read Error\n");
+ return (ret_val);
+ }
+
+ if (length == 0xFFFF || length == 0) {
+ DEBUGOUT("NVM PBA number section invalid length\n");
+ return (-E1000_ERR_NVM_PBA_SECTION);
+ }
+
+ /* Convert from length in u16 values to u8 chars, add 1 for NULL,
+ * and subtract 2 because length field is included in length.
+ */
+ *pba_num_size = ((u32)length * 2) - 1;
+
+ return (E1000_SUCCESS);
}
/*
diff --git a/usr/src/uts/common/io/igb/igb_nvm.h b/usr/src/uts/common/io/igb/igb_nvm.h
index e0de52b748..ceb42a4f10 100644
--- a/usr/src/uts/common/io/igb/igb_nvm.h
+++ b/usr/src/uts/common/io/igb/igb_nvm.h
@@ -45,7 +45,9 @@ s32 e1000_acquire_nvm_generic(struct e1000_hw *hw);
s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
s32 e1000_read_mac_addr_generic(struct e1000_hw *hw);
-s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num);
+s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
+ u32 pba_num_size);
+s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size);
s32 e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset,
u16 words, u16 *data);
s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words,
diff --git a/usr/src/uts/common/io/ixgbe/ixgbe_main.c b/usr/src/uts/common/io/ixgbe/ixgbe_main.c
index 791df9eff8..848e3470c7 100644
--- a/usr/src/uts/common/io/ixgbe/ixgbe_main.c
+++ b/usr/src/uts/common/io/ixgbe/ixgbe_main.c
@@ -1246,6 +1246,7 @@ static int
ixgbe_init(ixgbe_t *ixgbe)
{
struct ixgbe_hw *hw = &ixgbe->hw;
+ u8 pbanum[IXGBE_PBANUM_LENGTH];
mutex_enter(&ixgbe->gen_lock);
@@ -1308,6 +1309,16 @@ ixgbe_init(ixgbe_t *ixgbe)
goto init_fail;
}
+ /*
+ * Read identifying information and place in devinfo.
+ */
+ pbanum[0] = '\0';
+ (void) ixgbe_read_pba_string(hw, pbanum, sizeof (pbanum));
+ if (*pbanum != '\0') {
+ (void) ddi_prop_update_string(DDI_DEV_T_NONE, ixgbe->dip,
+ "printed-board-assembly", (char *)pbanum);
+ }
+
if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) {
goto init_fail;
}
diff --git a/usr/src/uts/common/io/mac/mac.c b/usr/src/uts/common/io/mac/mac.c
index 4e1979cf54..61a5353365 100644
--- a/usr/src/uts/common/io/mac/mac.c
+++ b/usr/src/uts/common/io/mac/mac.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -2989,6 +2990,9 @@ mac_prop_check_size(mac_prop_id_t id, uint_t valsize, boolean_t is_range)
case MAC_PROP_WL_MLME:
minsize = sizeof (wl_mlme_t);
break;
+ case MAC_PROP_VN_PROMISC_FILTERED:
+ minsize = sizeof (boolean_t);
+ break;
}
return (valsize >= minsize);
diff --git a/usr/src/uts/common/io/mac/mac_client.c b/usr/src/uts/common/io/mac/mac_client.c
index dc1132941b..dc1e40b424 100644
--- a/usr/src/uts/common/io/mac/mac_client.c
+++ b/usr/src/uts/common/io/mac/mac_client.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -3170,7 +3171,8 @@ mac_promisc_add(mac_client_handle_t mch, mac_client_promisc_type_t type,
}
if ((mcip->mci_state_flags & MCIS_IS_VNIC) &&
- type == MAC_CLIENT_PROMISC_ALL) {
+ type == MAC_CLIENT_PROMISC_ALL &&
+ (mcip->mci_protect_flags & MPT_FLAG_PROMISC_FILTERED)) {
/*
* The function is being invoked by the upper MAC client
* of a VNIC. The VNIC should only see the traffic
@@ -4032,16 +4034,15 @@ mac_info_get(const char *name, mac_info_t *minfop)
/*
* To get the capabilities that MAC layer cares about, such as rings, factory
* mac address, vnic or not, it should directly invoke this function. If the
- * link is part of a bridge, then the only "capability" it has is the inability
- * to do zero copy.
+ * link is part of a bridge, then the link is unable to do zero copy.
*/
boolean_t
i_mac_capab_get(mac_handle_t mh, mac_capab_t cap, void *cap_data)
{
mac_impl_t *mip = (mac_impl_t *)mh;
- if (mip->mi_bridge_link != NULL)
- return (cap == MAC_CAPAB_NO_ZCOPY);
+ if (mip->mi_bridge_link != NULL && cap == MAC_CAPAB_NO_ZCOPY)
+ return (B_TRUE);
else if (mip->mi_callbacks->mc_callbacks & MC_GETCAPAB)
return (mip->mi_getcapab(mip->mi_driver, cap, cap_data));
else
@@ -5411,3 +5412,23 @@ mac_client_set_rings(mac_client_handle_t mch, int rxrings, int txrings)
mrp->mrp_ntxrings = txrings;
}
}
+
+boolean_t
+mac_get_promisc_filtered(mac_client_handle_t mch)
+{
+ mac_client_impl_t *mcip = (mac_client_impl_t *)mch;
+
+ return (mcip->mci_protect_flags & MPT_FLAG_PROMISC_FILTERED);
+}
+
+void
+mac_set_promisc_filtered(mac_client_handle_t mch, boolean_t enable)
+{
+ mac_client_impl_t *mcip = (mac_client_impl_t *)mch;
+
+ ASSERT(MAC_PERIM_HELD((mac_handle_t)mcip->mci_mip));
+ if (enable)
+ mcip->mci_protect_flags |= MPT_FLAG_PROMISC_FILTERED;
+ else
+ mcip->mci_protect_flags &= ~MPT_FLAG_PROMISC_FILTERED;
+}
diff --git a/usr/src/uts/common/io/mac/mac_protect.c b/usr/src/uts/common/io/mac/mac_protect.c
index 0dc825492e..4d5201a994 100644
--- a/usr/src/uts/common/io/mac/mac_protect.c
+++ b/usr/src/uts/common/io/mac/mac_protect.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/strsun.h>
@@ -2267,6 +2268,9 @@ mac_protect_init(mac_client_impl_t *mcip)
sizeof (dhcpv6_cid_t), offsetof(dhcpv6_cid_t, dc_node));
avl_create(&mcip->mci_v6_dyn_ip, compare_dhcpv6_ip,
sizeof (dhcpv6_addr_t), offsetof(dhcpv6_addr_t, da_node));
+
+ if (mcip->mci_state_flags & MCIS_IS_VNIC)
+ mcip->mci_protect_flags |= MPT_FLAG_PROMISC_FILTERED;
}
void
diff --git a/usr/src/uts/common/io/mr_sas/mr_sas.conf b/usr/src/uts/common/io/mr_sas/mr_sas.conf
index cfda434e23..6c585c6a42 100644
--- a/usr/src/uts/common/io/mr_sas/mr_sas.conf
+++ b/usr/src/uts/common/io/mr_sas/mr_sas.conf
@@ -13,3 +13,11 @@
# Fast-Path specific flag. Default is "yes".
# mrsas-enable-fp="yes";
+flow_control="dmult" queue="qsort" tape="sctp";
+
+# MSI specific flag. To enable MSI modify the flag value to "yes"
+mrsas-enable-msi="yes";
+
+# Fast-Path specific flag. To enable Fast-Path modify the flag value to "yes"
+mrsas-enable-fp="yes";
+
diff --git a/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c b/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c
index e7974fb538..5d7cb87590 100644
--- a/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c
+++ b/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/*
@@ -69,6 +70,7 @@
#include <sys/file.h>
#include <sys/cpuvar.h>
#include <sys/policy.h>
+#include <sys/model.h>
#include <sys/sysevent.h>
#include <sys/sysevent/eventdefs.h>
#include <sys/sysevent/dr.h>
@@ -369,8 +371,7 @@ static dev_info_t *mptsas_get_dip_from_dev(dev_t dev,
mptsas_phymask_t *phymask);
static mptsas_target_t *mptsas_addr_to_ptgt(mptsas_t *mpt, char *addr,
mptsas_phymask_t phymask);
-static int mptsas_set_led_status(mptsas_t *mpt, mptsas_target_t *ptgt,
- uint32_t slotstatus);
+static int mptsas_flush_led_status(mptsas_t *mpt, mptsas_target_t *ptgt);
/*
@@ -6451,7 +6452,8 @@ mptsas_handle_topo_change(mptsas_topo_change_list_t *topo_node,
}
mutex_enter(&mpt->m_mutex);
- if (mptsas_set_led_status(mpt, ptgt, 0) != DDI_SUCCESS) {
+ ptgt->m_led_status = 0;
+ if (mptsas_flush_led_status(mpt, ptgt) != DDI_SUCCESS) {
NDBG14(("mptsas: clear LED for tgt %x failed",
ptgt->m_slot_num));
}
@@ -9964,6 +9966,7 @@ mptsas_watchsubr(mptsas_t *mpt)
int i;
mptsas_cmd_t *cmd;
mptsas_target_t *ptgt = NULL;
+ int restart_needed = 0;
NDBG30(("mptsas_watchsubr: mpt=0x%p", (void *)mpt));
@@ -10033,9 +10036,20 @@ mptsas_watchsubr(mptsas_t *mpt)
(ptgt->m_t_throttle > HOLD_THROTTLE) &&
(ptgt->m_t_ncmds < ptgt->m_t_throttle)) {
mptsas_set_throttle(mpt, ptgt, MAX_THROTTLE);
- mptsas_restart_hba(mpt);
+ ++restart_needed;
}
+ mutex_exit(&ptgt->m_tgt_intr_mutex);
+ ptgt = (mptsas_target_t *)mptsas_hash_traverse(
+ &mpt->m_active->m_tgttbl, MPTSAS_HASH_NEXT);
+ }
+
+ if (restart_needed != 0)
+ mptsas_restart_hba(mpt);
+ ptgt = (mptsas_target_t *)mptsas_hash_traverse(&mpt->m_active->m_tgttbl,
+ MPTSAS_HASH_FIRST);
+ while (ptgt != NULL) {
+ mutex_enter(&ptgt->m_tgt_intr_mutex);
if ((ptgt->m_t_ncmds > 0) &&
(ptgt->m_timebase)) {
@@ -11951,6 +11965,163 @@ mptsas_reg_access(mptsas_t *mpt, mptsas_reg_access_t *data, int mode)
}
static int
+led_control(mptsas_t *mpt, intptr_t data, int mode)
+{
+ int ret = 0;
+ mptsas_led_control_t lc;
+ mptsas_target_t *ptgt;
+
+ if (ddi_copyin((void *)data, &lc, sizeof (lc), mode) != 0) {
+ return (EFAULT);
+ }
+
+ if ((lc.Command != MPTSAS_LEDCTL_FLAG_SET &&
+ lc.Command != MPTSAS_LEDCTL_FLAG_GET) ||
+ lc.Led < MPTSAS_LEDCTL_LED_MIN ||
+ lc.Led > MPTSAS_LEDCTL_LED_MAX ||
+ (lc.Command == MPTSAS_LEDCTL_FLAG_SET && lc.LedStatus != 0 &&
+ lc.LedStatus != 1)) {
+ return (EINVAL);
+ }
+
+ if ((lc.Command == MPTSAS_LEDCTL_FLAG_SET && (mode & FWRITE) == 0) ||
+ (lc.Command == MPTSAS_LEDCTL_FLAG_GET && (mode & FREAD) == 0))
+ return (EACCES);
+
+ /* Locate the target we're interrogating... */
+ mutex_enter(&mpt->m_mutex);
+ ptgt = (mptsas_target_t *)mptsas_hash_traverse(&mpt->m_active->m_tgttbl,
+ MPTSAS_HASH_FIRST);
+ while (ptgt != NULL) {
+ if (ptgt->m_enclosure == lc.Enclosure &&
+ ptgt->m_slot_num == lc.Slot) {
+ break;
+ }
+ ptgt = (mptsas_target_t *)mptsas_hash_traverse(
+ &mpt->m_active->m_tgttbl, MPTSAS_HASH_NEXT);
+ }
+ if (ptgt == NULL) {
+ /* We could not find a target for that enclosure/slot. */
+ mutex_exit(&mpt->m_mutex);
+ return (ENOENT);
+ }
+
+ if (lc.Command == MPTSAS_LEDCTL_FLAG_SET) {
+ /* Update our internal LED state. */
+ ptgt->m_led_status &= ~(1 << (lc.Led - 1));
+ ptgt->m_led_status |= lc.LedStatus << (lc.Led - 1);
+
+ /* Flush it to the controller. */
+ ret = mptsas_flush_led_status(mpt, ptgt);
+ mutex_exit(&mpt->m_mutex);
+ return (ret);
+ }
+
+ /* Return our internal LED state. */
+ lc.LedStatus = (ptgt->m_led_status >> (lc.Led - 1)) & 1;
+ mutex_exit(&mpt->m_mutex);
+
+ if (ddi_copyout(&lc, (void *)data, sizeof (lc), mode) != 0) {
+ return (EFAULT);
+ }
+
+ return (0);
+}
+
+static int
+get_disk_info(mptsas_t *mpt, intptr_t data, int mode)
+{
+ int i = 0;
+ int count = 0;
+ int ret = 0;
+ mptsas_target_t *ptgt;
+ mptsas_disk_info_t *di;
+ STRUCT_DECL(mptsas_get_disk_info, gdi);
+
+ if ((mode & FREAD) == 0)
+ return (EACCES);
+
+ STRUCT_INIT(gdi, get_udatamodel());
+
+ if (ddi_copyin((void *)data, STRUCT_BUF(gdi), STRUCT_SIZE(gdi),
+ mode) != 0) {
+ return (EFAULT);
+ }
+
+ /* Find out how many targets there are. */
+ mutex_enter(&mpt->m_mutex);
+ ptgt = (mptsas_target_t *)mptsas_hash_traverse(&mpt->m_active->m_tgttbl,
+ MPTSAS_HASH_FIRST);
+ while (ptgt != NULL) {
+ count++;
+ ptgt = (mptsas_target_t *)mptsas_hash_traverse(
+ &mpt->m_active->m_tgttbl, MPTSAS_HASH_NEXT);
+ }
+ mutex_exit(&mpt->m_mutex);
+
+ /*
+ * If we haven't been asked to copy out information on each target,
+ * then just return the count.
+ */
+ STRUCT_FSET(gdi, DiskCount, count);
+ if (STRUCT_FGETP(gdi, PtrDiskInfoArray) == NULL)
+ goto copy_out;
+
+ /*
+ * If we haven't been given a large enough buffer to copy out into,
+ * let the caller know.
+ */
+ if (STRUCT_FGET(gdi, DiskInfoArraySize) <
+ count * sizeof (mptsas_disk_info_t)) {
+ ret = ENOSPC;
+ goto copy_out;
+ }
+
+ di = kmem_zalloc(count * sizeof (mptsas_disk_info_t), KM_SLEEP);
+
+ mutex_enter(&mpt->m_mutex);
+ ptgt = (mptsas_target_t *)mptsas_hash_traverse(&mpt->m_active->m_tgttbl,
+ MPTSAS_HASH_FIRST);
+ while (ptgt != NULL) {
+ if (i >= count) {
+ /*
+ * The number of targets changed while we weren't
+ * looking, so give up.
+ */
+ mutex_exit(&mpt->m_mutex);
+ kmem_free(di, count * sizeof (mptsas_disk_info_t));
+ return (EAGAIN);
+ }
+ di[i].Instance = mpt->m_instance;
+ di[i].Enclosure = ptgt->m_enclosure;
+ di[i].Slot = ptgt->m_slot_num;
+ di[i].SasAddress = ptgt->m_sas_wwn;
+
+ ptgt = (mptsas_target_t *)mptsas_hash_traverse(
+ &mpt->m_active->m_tgttbl, MPTSAS_HASH_NEXT);
+ i++;
+ }
+ mutex_exit(&mpt->m_mutex);
+ STRUCT_FSET(gdi, DiskCount, i);
+
+ /* Copy out the disk information to the caller. */
+ if (ddi_copyout((void *)di, STRUCT_FGETP(gdi, PtrDiskInfoArray),
+ i * sizeof (mptsas_disk_info_t), mode) != 0) {
+ ret = EFAULT;
+ }
+
+ kmem_free(di, count * sizeof (mptsas_disk_info_t));
+
+copy_out:
+ if (ddi_copyout(STRUCT_BUF(gdi), (void *)data, STRUCT_SIZE(gdi),
+ mode) != 0) {
+ ret = EFAULT;
+ }
+
+ return (ret);
+}
+
+static int
mptsas_ioctl(dev_t dev, int cmd, intptr_t data, int mode, cred_t *credp,
int *rval)
{
@@ -12037,31 +12208,14 @@ mptsas_ioctl(dev_t dev, int cmd, intptr_t data, int mode, cred_t *credp,
} else if (cmd == DEVCTL_DEVICE_OFFLINE) {
ptgt->m_tgt_unconfigured = 1;
}
- slotstatus = 0;
-#ifdef MPTSAS_GET_LED
- /*
- * The get led status can't get a valid/reasonable
- * state, so ignore the get led status, and write the
- * required value directly
- */
- if (mptsas_get_led_status(mpt, ptgt, &slotstatus) !=
- DDI_SUCCESS) {
- NDBG14(("mptsas_ioctl: get LED for tgt %s "
- "failed %x", addr, slotstatus));
- slotstatus = 0;
- }
- NDBG14(("mptsas_ioctl: LED status %x for %s",
- slotstatus, addr));
-#endif
if (cmd == DEVCTL_DEVICE_OFFLINE) {
- slotstatus |=
- MPI2_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE;
+ ptgt->m_led_status |=
+ (1 << (MPTSAS_LEDCTL_LED_OK2RM - 1));
} else {
- slotstatus &=
- ~MPI2_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE;
+ ptgt->m_led_status &=
+ ~(1 << (MPTSAS_LEDCTL_LED_OK2RM - 1));
}
- if (mptsas_set_led_status(mpt, ptgt, slotstatus) !=
- DDI_SUCCESS) {
+ if (mptsas_flush_led_status(mpt, ptgt) != DDI_SUCCESS) {
NDBG14(("mptsas_ioctl: set LED for tgt %s "
"failed %x", addr, slotstatus));
}
@@ -12071,6 +12225,12 @@ mptsas_ioctl(dev_t dev, int cmd, intptr_t data, int mode, cred_t *credp,
goto out;
}
switch (cmd) {
+ case MPTIOCTL_GET_DISK_INFO:
+ status = get_disk_info(mpt, data, mode);
+ break;
+ case MPTIOCTL_LED_CONTROL:
+ status = led_control(mpt, data, mode);
+ break;
case MPTIOCTL_UPDATE_FLASH:
if (ddi_copyin((void *)data, &flashdata,
sizeof (struct mptsas_update_flash), mode)) {
@@ -14531,8 +14691,9 @@ mptsas_create_virt_lun(dev_info_t *pdip, struct scsi_inquiry *inq, char *guid,
(ptgt->m_tgt_unconfigured == 0)) {
rval = mdi_pi_online(*pip, 0);
mutex_enter(&mpt->m_mutex);
- (void) mptsas_set_led_status(mpt, ptgt,
- 0);
+ ptgt->m_led_status = 0;
+ (void) mptsas_flush_led_status(mpt,
+ ptgt);
mutex_exit(&mpt->m_mutex);
} else {
rval = DDI_SUCCESS;
@@ -14789,8 +14950,8 @@ mptsas_create_virt_lun(dev_info_t *pdip, struct scsi_inquiry *inq, char *guid,
mdi_rtn = mdi_pi_online(*pip, 0);
if (mdi_rtn == MDI_SUCCESS) {
mutex_enter(&mpt->m_mutex);
- if (mptsas_set_led_status(mpt, ptgt, 0) !=
- DDI_SUCCESS) {
+ ptgt->m_led_status = 0;
+ if (mptsas_flush_led_status(mpt, ptgt) != DDI_SUCCESS) {
NDBG14(("mptsas: clear LED for slot %x "
"failed", ptgt->m_slot_num));
}
@@ -15151,8 +15312,8 @@ phys_create_done:
}
if (ndi_rtn == NDI_SUCCESS) {
mutex_enter(&mpt->m_mutex);
- if (mptsas_set_led_status(mpt, ptgt, 0) !=
- DDI_SUCCESS) {
+ ptgt->m_led_status = 0;
+ if (mptsas_flush_led_status(mpt, ptgt) != DDI_SUCCESS) {
NDBG14(("mptsas: clear LED for tgt %x "
"failed", ptgt->m_slot_num));
}
@@ -16053,23 +16214,26 @@ mptsas_addr_to_ptgt(mptsas_t *mpt, char *addr, mptsas_phymask_t phymask)
return (ptgt);
}
-#ifdef MPTSAS_GET_LED
static int
-mptsas_get_led_status(mptsas_t *mpt, mptsas_target_t *ptgt,
- uint32_t *slotstatus)
-{
- return (mptsas_send_sep(mpt, ptgt, slotstatus,
- MPI2_SEP_REQ_ACTION_READ_STATUS));
-}
-#endif
-static int
-mptsas_set_led_status(mptsas_t *mpt, mptsas_target_t *ptgt, uint32_t slotstatus)
+mptsas_flush_led_status(mptsas_t *mpt, mptsas_target_t *ptgt)
{
+ uint32_t slotstatus = 0;
+
+ /* Build an MPI2 Slot Status based on our view of the world */
+ if (ptgt->m_led_status & (1 << (MPTSAS_LEDCTL_LED_IDENT - 1)))
+ slotstatus |= MPI2_SEP_REQ_SLOTSTATUS_IDENTIFY_REQUEST;
+ if (ptgt->m_led_status & (1 << (MPTSAS_LEDCTL_LED_FAIL - 1)))
+ slotstatus |= MPI2_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT;
+ if (ptgt->m_led_status & (1 << (MPTSAS_LEDCTL_LED_OK2RM - 1)))
+ slotstatus |= MPI2_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE;
+
+ /* Write it to the controller */
NDBG14(("mptsas_ioctl: set LED status %x for slot %x",
slotstatus, ptgt->m_slot_num));
return (mptsas_send_sep(mpt, ptgt, &slotstatus,
MPI2_SEP_REQ_ACTION_WRITE_STATUS));
}
+
/*
* send sep request, use enclosure/slot addressing
*/
diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c
index 9eea65b186..7e9940e33b 100644
--- a/usr/src/uts/common/io/scsi/targets/sd.c
+++ b/usr/src/uts/common/io/scsi/targets/sd.c
@@ -26,6 +26,7 @@
* Copyright (c) 2011 Bayard G. Bell. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
*/
/*
* Copyright 2011 cyril.galibern@opensvc.com
@@ -3502,9 +3503,13 @@ sd_set_mmc_caps(sd_ssc_t *ssc)
* according to the successful response to the page
* 0x2A mode sense request.
*/
- scsi_log(SD_DEVINFO(un), sd_label, CE_WARN,
- "sd_set_mmc_caps: Mode Sense returned "
- "invalid block descriptor length\n");
+ /*
+ * The following warning occurs due to the KVM CD-ROM
+ * mishandling the multi-media commands. Ignore it.
+ * scsi_log(SD_DEVINFO(un), sd_label, CE_WARN,
+ * "sd_set_mmc_caps: Mode Sense returned "
+ * "invalid block descriptor length\n");
+ */
kmem_free(buf, BUFLEN_MODE_CDROM_CAP);
return;
}
@@ -4441,18 +4446,77 @@ sd_sdconf_id_match(struct sd_lun *un, char *id, int idlen)
{
struct scsi_inquiry *sd_inq;
int rval = SD_SUCCESS;
+ char *p;
+ int chk_vidlen = 0, chk_pidlen = 0;
+ int has_tail = 0;
+ static const int VSZ = sizeof (sd_inq->inq_vid);
+ static const int PSZ = sizeof (sd_inq->inq_pid);
ASSERT(un != NULL);
sd_inq = un->un_sd->sd_inq;
ASSERT(id != NULL);
/*
- * We use the inq_vid as a pointer to a buffer containing the
- * vid and pid and use the entire vid/pid length of the table
- * entry for the comparison. This works because the inq_pid
- * data member follows inq_vid in the scsi_inquiry structure.
+ * We would like to use the inq_vid as a pointer to a buffer
+ * containing the vid and pid and use the entire vid/pid length of
+ * the table entry for the comparison. However, this does not work
+ * because, while the inq_pid data member follows inq_vid in the
+ * scsi_inquiry structure, we do not control the contents of this
+ * buffer, and some broken devices violate SPC 4.3.1 and return
+ * fields with null bytes in them.
+ */
+ chk_vidlen = MIN(VSZ, idlen);
+ p = id + chk_vidlen - 1;
+ while (*p == ' ' && chk_vidlen > 0) {
+ --p;
+ --chk_vidlen;
+ }
+
+ /*
+ * If it's all spaces, check the whole thing.
*/
- if (strncasecmp(sd_inq->inq_vid, id, idlen) != 0) {
+ if (chk_vidlen == 0)
+ chk_vidlen = MIN(VSZ, idlen);
+
+ if (idlen > VSZ) {
+ chk_pidlen = idlen - VSZ;
+ p = id + idlen - 1;
+ while (*p == ' ' && chk_pidlen > 0) {
+ --p;
+ --chk_pidlen;
+ }
+ if (chk_pidlen == 0)
+ chk_pidlen = MIN(PSZ, idlen - VSZ);
+ }
+
+ /*
+ * There's one more thing we need to do here. If the user specified
+ * an ID with trailing spaces, we need to make sure the inquiry
+ * vid/pid has only spaces or NULs after the check length; otherwise, it
+ * can't match.
+ */
+ if (idlen > chk_vidlen && chk_vidlen < VSZ) {
+ for (p = sd_inq->inq_vid + chk_vidlen;
+ p < sd_inq->inq_vid + VSZ; ++p) {
+ if (*p != ' ' && *p != '\0') {
+ ++has_tail;
+ break;
+ }
+ }
+ }
+ if (idlen > chk_pidlen + VSZ && chk_pidlen < PSZ) {
+ for (p = sd_inq->inq_pid + chk_pidlen;
+ p < sd_inq->inq_pid + PSZ; ++p) {
+ if (*p != ' ' && *p != '\0') {
+ ++has_tail;
+ break;
+ }
+ }
+ }
+
+ if (has_tail || strncasecmp(sd_inq->inq_vid, id, chk_vidlen) != 0 ||
+ (idlen > VSZ &&
+ strncasecmp(sd_inq->inq_pid, id + VSZ, chk_pidlen) != 0)) {
/*
* The user id string is compared to the inquiry vid/pid
* using a case insensitive comparison and ignoring
@@ -22314,6 +22378,7 @@ sdioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cred_p, int *rval_p)
case DKIOCINFO:
case DKIOCGMEDIAINFO:
case DKIOCGMEDIAINFOEXT:
+ case DKIOCSOLIDSTATE:
case MHIOCENFAILFAST:
case MHIOCSTATUS:
case MHIOCTKOWN:
@@ -22506,6 +22571,16 @@ skip_ready_valid:
}
break;
+ case DKIOCSOLIDSTATE:
+ SD_TRACE(SD_LOG_IOCTL, un, "DKIOCSOLIDSTATE\n");
+ i = un->un_f_is_solid_state ? 1 : 0;
+ if (ddi_copyout(&i, (void *)arg, sizeof (int), flag) != 0) {
+ err = EFAULT;
+ } else {
+ err = 0;
+ }
+ break;
+
case DKIOCHOTPLUGGABLE:
SD_TRACE(SD_LOG_IOCTL, un, "DKIOCHOTPLUGGABLE\n");
i = un->un_f_is_hotpluggable ? 1 : 0;
diff --git a/usr/src/uts/common/io/sdcard/impl/sda_mem.c b/usr/src/uts/common/io/sdcard/impl/sda_mem.c
index 752a3b8a32..1b485cac24 100644
--- a/usr/src/uts/common/io/sdcard/impl/sda_mem.c
+++ b/usr/src/uts/common/io/sdcard/impl/sda_mem.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
*/
/*
@@ -207,6 +208,7 @@ sda_mem_bd_mediainfo(void *arg, bd_media_t *media)
media->m_nblks = slot->s_nblks;
media->m_blksize = slot->s_blksz;
media->m_readonly = slot->s_flags & SLOTF_WRITABLE ? B_FALSE : B_TRUE;
+ media->m_solidstate = B_TRUE;
sda_slot_exit(slot);
return (0);
}
diff --git a/usr/src/uts/common/io/vnic/vnic_dev.c b/usr/src/uts/common/io/vnic/vnic_dev.c
index c70ff2b22b..065d7f2cbc 100644
--- a/usr/src/uts/common/io/vnic/vnic_dev.c
+++ b/usr/src/uts/common/io/vnic/vnic_dev.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -51,6 +52,7 @@
#include <sys/vlan.h>
#include <sys/vnic.h>
#include <sys/vnic_impl.h>
+#include <sys/mac_impl.h>
#include <sys/mac_flow_impl.h>
#include <inet/ip_impl.h>
@@ -81,6 +83,7 @@ static int vnic_m_stat(void *, uint_t, uint64_t *);
static void vnic_m_ioctl(void *, queue_t *, mblk_t *);
static int vnic_m_setprop(void *, const char *, mac_prop_id_t, uint_t,
const void *);
+static int vnic_m_getprop(void *, const char *, mac_prop_id_t, uint_t, void *);
static void vnic_m_propinfo(void *, const char *, mac_prop_id_t,
mac_prop_info_handle_t);
static mblk_t *vnic_m_tx(void *, mblk_t *);
@@ -100,7 +103,7 @@ static mod_hash_t *vnic_hash;
#define VNIC_HASH_KEY(vnic_id) ((mod_hash_key_t)(uintptr_t)vnic_id)
#define VNIC_M_CALLBACK_FLAGS \
- (MC_IOCTL | MC_GETCAPAB | MC_SETPROP | MC_PROPINFO)
+ (MC_IOCTL | MC_GETCAPAB | MC_SETPROP | MC_GETPROP | MC_PROPINFO)
static mac_callbacks_t vnic_m_callbacks = {
VNIC_M_CALLBACK_FLAGS,
@@ -117,7 +120,7 @@ static mac_callbacks_t vnic_m_callbacks = {
NULL,
NULL,
vnic_m_setprop,
- NULL,
+ vnic_m_getprop,
vnic_m_propinfo
};
@@ -849,17 +852,19 @@ static int
vnic_m_setprop(void *m_driver, const char *pr_name, mac_prop_id_t pr_num,
uint_t pr_valsize, const void *pr_val)
{
- int err = ENOTSUP;
+ int err = 0;
vnic_t *vn = m_driver;
- /* allow setting MTU only on an etherstub */
- if (vn->vn_link_id != DATALINK_INVALID_LINKID)
- return (err);
-
switch (pr_num) {
case MAC_PROP_MTU: {
uint32_t mtu;
+ /* allow setting MTU only on an etherstub */
+ if (vn->vn_link_id != DATALINK_INVALID_LINKID) {
+ err = ENOTSUP;
+ break;
+ }
+
if (pr_valsize < sizeof (mtu)) {
err = EINVAL;
break;
@@ -872,12 +877,46 @@ vnic_m_setprop(void *m_driver, const char *pr_name, mac_prop_id_t pr_num,
err = mac_maxsdu_update(vn->vn_mh, mtu);
break;
}
+ case MAC_PROP_VN_PROMISC_FILTERED: {
+ boolean_t filtered;
+
+ if (pr_valsize < sizeof (filtered)) {
+ err = EINVAL;
+ break;
+ }
+
+ bcopy(pr_val, &filtered, sizeof (filtered));
+ mac_set_promisc_filtered(vn->vn_mch, filtered);
+ }
default:
+ err = ENOTSUP;
break;
}
return (err);
}
+static int
+vnic_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
+ uint_t pr_valsize, void *pr_val)
+{
+ vnic_t *vn = arg;
+ int ret = 0;
+ boolean_t out;
+
+ switch (pr_num) {
+ case MAC_PROP_VN_PROMISC_FILTERED:
+ out = mac_get_promisc_filtered(vn->vn_mch);
+ ASSERT(pr_valsize >= sizeof (boolean_t));
+ bcopy(&out, pr_val, sizeof (boolean_t));
+ break;
+ default:
+ ret = EINVAL;
+ break;
+ }
+
+ return (ret);
+}
+
/* ARGSUSED */
static void vnic_m_propinfo(void *m_driver, const char *pr_name,
mac_prop_id_t pr_num, mac_prop_info_handle_t prh)
diff --git a/usr/src/uts/common/os/bio.c b/usr/src/uts/common/os/bio.c
index 0db01f80d7..c3d04e5508 100644
--- a/usr/src/uts/common/os/bio.c
+++ b/usr/src/uts/common/os/bio.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -1320,6 +1321,9 @@ pageio_setup(struct page *pp, size_t len, struct vnode *vp, int flags)
cpup = CPU; /* get pointer AFTER preemption is disabled */
CPU_STATS_ADDQ(cpup, vm, pgin, 1);
CPU_STATS_ADDQ(cpup, vm, pgpgin, btopr(len));
+
+ atomic_add_64(&curzone->zone_pgpgin, btopr(len));
+
if ((flags & B_ASYNC) == 0) {
klwp_t *lwp = ttolwp(curthread);
if (lwp != NULL)
@@ -1336,13 +1340,19 @@ pageio_setup(struct page *pp, size_t len, struct vnode *vp, int flags)
if (pp != NULL && pp->p_vnode != NULL) {
if (IS_SWAPFSVP(pp->p_vnode)) {
CPU_STATS_ADDQ(cpup, vm, anonpgin, btopr(len));
+ atomic_add_64(&curzone->zone_anonpgin,
+ btopr(len));
} else {
if (pp->p_vnode->v_flag & VVMEXEC) {
CPU_STATS_ADDQ(cpup, vm, execpgin,
btopr(len));
+ atomic_add_64(&curzone->zone_execpgin,
+ btopr(len));
} else {
CPU_STATS_ADDQ(cpup, vm, fspgin,
btopr(len));
+ atomic_add_64(&curzone->zone_fspgin,
+ btopr(len));
}
}
}
diff --git a/usr/src/uts/common/os/clock.c b/usr/src/uts/common/os/clock.c
index 451c9db48c..3f4dd63c82 100644
--- a/usr/src/uts/common/os/clock.c
+++ b/usr/src/uts/common/os/clock.c
@@ -23,6 +23,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#include <sys/param.h>
@@ -66,6 +67,7 @@
#include <sys/ddi_timer.h>
#include <sys/random.h>
#include <sys/modctl.h>
+#include <sys/zone.h>
/*
* for NTP support
@@ -1158,6 +1160,10 @@ loadavg_update()
} while ((cpupart = cpupart->cp_next) != cp_list_head);
+ /*
+ * Third pass totals up per-zone statistics.
+ */
+ zone_loadavg_update();
}
/*
diff --git a/usr/src/uts/common/os/clock_highres.c b/usr/src/uts/common/os/clock_highres.c
index e097f355ec..7870617a26 100644
--- a/usr/src/uts/common/os/clock_highres.c
+++ b/usr/src/uts/common/os/clock_highres.c
@@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012, Joyent Inc. All rights reserved.
+ */
#include <sys/timer.h>
#include <sys/systm.h>
@@ -112,6 +114,25 @@ clock_highres_timer_settime(itimer_t *it, int flags,
cyctime.cyt_when = ts2hrt(&when->it_value);
cyctime.cyt_interval = ts2hrt(&when->it_interval);
+ if (cyctime.cyt_when != 0 && cyctime.cyt_interval == 0 &&
+ it->it_itime.it_interval.tv_sec == 0 &&
+ it->it_itime.it_interval.tv_nsec == 0 &&
+ (cyc = *cycp) != CYCLIC_NONE) {
+ /*
+ * If our existing timer is a one-shot and our new timer is a
+ * one-shot, we'll save ourselves a world of grief and just
+ * reprogram the cyclic.
+ */
+ it->it_itime = *when;
+
+ if (!(flags & TIMER_ABSTIME))
+ cyctime.cyt_when += gethrtime();
+
+ hrt2ts(cyctime.cyt_when, &it->it_itime.it_value);
+ (void) cyclic_reprogram(cyc, cyctime.cyt_when);
+ return (0);
+ }
+
mutex_enter(&cpu_lock);
if ((cyc = *cycp) != CYCLIC_NONE) {
cyclic_remove(cyc);
@@ -162,17 +183,14 @@ clock_highres_timer_settime(itimer_t *it, int flags,
if (cyctime.cyt_interval == 0) {
/*
- * If this is a one-shot, then we set the interval to assure
- * that the cyclic will next fire INT64_MAX nanoseconds after
- * boot (which corresponds to over 292 years -- yes, Buck Rogers
- * may have his 292-year-uptime-Solaris box malfunction). If
- * this timer is never touched, this cyclic will simply
- * consume space in the cyclic subsystem. As soon as
+ * If this is a one-shot, then we set the interval to be
+ * inifinite. If this timer is never touched, this cyclic will
+ * simply consume space in the cyclic subsystem. As soon as
* timer_settime() or timer_delete() is called, the cyclic is
* removed (so it's not possible to run the machine out
* of resources by creating one-shots).
*/
- cyctime.cyt_interval = INT64_MAX - cyctime.cyt_when;
+ cyctime.cyt_interval = CY_INFINITY;
}
it->it_itime = *when;
@@ -185,8 +203,6 @@ clock_highres_timer_settime(itimer_t *it, int flags,
if (cyctime.cyt_when != 0)
*cycp = cyc = cyclic_add(&hdlr, &cyctime);
- else
- *cycp = cyc = CYCLIC_NONE;
/*
* Now that we have the cyclic created, we need to bind it to our
diff --git a/usr/src/uts/common/os/contract.c b/usr/src/uts/common/os/contract.c
index a292f4e14f..ebaa6bfe41 100644
--- a/usr/src/uts/common/os/contract.c
+++ b/usr/src/uts/common/os/contract.c
@@ -497,7 +497,7 @@ contract_abandon(contract_t *ct, proc_t *p, int explicit)
contract_t *parent = &p->p_ct_process->conp_contract;
int inherit = 0;
- ASSERT(p == curproc);
+ VERIFY(p == curproc);
mutex_enter(&ct->ct_lock);
@@ -547,7 +547,7 @@ contract_abandon(contract_t *ct, proc_t *p, int explicit)
if (inherit) {
ct->ct_state = CTS_INHERITED;
- ASSERT(ct->ct_regent == parent);
+ VERIFY(ct->ct_regent == parent);
contract_process_take(parent, ct);
/*
@@ -2063,8 +2063,8 @@ cte_copy(ct_equeue_t *q, ct_equeue_t *newq)
{
ct_kevent_t *e, *first = NULL;
- ASSERT(q->ctq_listno == CTEL_CONTRACT);
- ASSERT(newq->ctq_listno == CTEL_PBUNDLE);
+ VERIFY(q->ctq_listno == CTEL_CONTRACT);
+ VERIFY(newq->ctq_listno == CTEL_PBUNDLE);
mutex_enter(&q->ctq_lock);
mutex_enter(&newq->ctq_lock);
@@ -2077,8 +2077,16 @@ cte_copy(ct_equeue_t *q, ct_equeue_t *newq)
if ((e->cte_flags & (CTE_INFO | CTE_ACK)) == 0) {
if (first == NULL)
first = e;
- list_insert_tail(&newq->ctq_events, e);
- cte_hold(e);
+ /*
+ * It is possible for adoption to race with an owner's
+ * cte_publish_all(); we must only enqueue events that
+ * have not already been enqueued.
+ */
+ if (!list_link_active((list_node_t *)
+ ((uintptr_t)e + newq->ctq_events.list_offset))) {
+ list_insert_tail(&newq->ctq_events, e);
+ cte_hold(e);
+ }
}
}
@@ -2117,7 +2125,7 @@ cte_trim(ct_equeue_t *q, contract_t *ct)
int flags, stopper;
int start = 1;
- ASSERT(MUTEX_HELD(&q->ctq_lock));
+ VERIFY(MUTEX_HELD(&q->ctq_lock));
for (e = list_head(&q->ctq_events); e != NULL; e = next) {
next = list_next(&q->ctq_events, e);
@@ -2227,13 +2235,24 @@ cte_queue_drain(ct_equeue_t *q, int ack)
* cte_publish_all.
*/
static void
-cte_publish(ct_equeue_t *q, ct_kevent_t *e, timespec_t *tsp)
+cte_publish(ct_equeue_t *q, ct_kevent_t *e, timespec_t *tsp, boolean_t mayexist)
{
ASSERT(MUTEX_HELD(&q->ctq_lock));
q->ctq_atime = *tsp;
/*
+ * If this event may already exist on this queue, check to see if it
+ * is already there and return if so.
+ */
+ if (mayexist && list_link_active((list_node_t *)((uintptr_t)e +
+ q->ctq_events.list_offset))) {
+ mutex_exit(&q->ctq_lock);
+ cte_rele(e);
+ return;
+ }
+
+ /*
* Don't publish if the event is informative and there aren't
* any listeners, or if the queue has been shut down.
*/
@@ -2247,6 +2266,8 @@ cte_publish(ct_equeue_t *q, ct_kevent_t *e, timespec_t *tsp)
/*
* Enqueue event
*/
+ VERIFY(!list_link_active((list_node_t *)
+ ((uintptr_t)e + q->ctq_events.list_offset)));
list_insert_tail(&q->ctq_events, e);
/*
@@ -2318,14 +2339,14 @@ cte_publish_all(contract_t *ct, ct_kevent_t *e, nvlist_t *data, nvlist_t *gdata)
ct->ct_evcnt++;
}
mutex_exit(&ct->ct_lock);
- cte_publish(&ct->ct_events, e, &ts);
+ cte_publish(&ct->ct_events, e, &ts, B_FALSE);
/*
* CTEL_BUNDLE - Next deliver to the contract type's bundle
* queue.
*/
mutex_enter(&ct->ct_type->ct_type_events.ctq_lock);
- cte_publish(&ct->ct_type->ct_type_events, e, &ts);
+ cte_publish(&ct->ct_type->ct_type_events, e, &ts, B_FALSE);
/*
* CTEL_PBUNDLE - Finally, if the contract has an owner,
@@ -2342,7 +2363,14 @@ cte_publish_all(contract_t *ct, ct_kevent_t *e, nvlist_t *data, nvlist_t *gdata)
q = ct->ct_owner->p_ct_equeue[ct->ct_type->ct_type_index];
mutex_enter(&q->ctq_lock);
mutex_exit(&ct->ct_lock);
- cte_publish(q, e, &ts);
+
+ /*
+ * It is possible for this code to race with adoption; we
+ * publish the event indicating that the event may already
+ * be enqueued because adoption beat us to it (in which case
+ * cte_pubish() does nothing).
+ */
+ cte_publish(q, e, &ts, B_TRUE);
} else {
mutex_exit(&ct->ct_lock);
cte_rele(e);
diff --git a/usr/src/uts/common/os/core.c b/usr/src/uts/common/os/core.c
index 71242af678..05deaf4151 100644
--- a/usr/src/uts/common/os/core.c
+++ b/usr/src/uts/common/os/core.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -63,6 +64,7 @@
#include <sys/contract/process_impl.h>
#include <sys/ddi.h>
+extern int yield(void);
/*
* Processes running within a zone potentially dump core in 3 locations,
* based on the per-process, per-zone, and the global zone's core settings.
@@ -534,6 +536,10 @@ expand_string(const char *pat, char *fp, int size, cred_t *cr)
case 'z':
s = p->p_zone->zone_name;
break;
+ case 'Z':
+ /* This is zonepath + "/root/", except for GZ */
+ s = p->p_zone->zone_rootpath;
+ break;
case '%':
(void) strcpy((s = buf), "%");
break;
@@ -548,6 +554,9 @@ expand_string(const char *pat, char *fp, int size, cred_t *cr)
if ((size -= len) <= 0)
return (ENAMETOOLONG);
(void) strcpy(fp, s);
+ /* strip trailing "/root/" from non-GZ zonepath string */
+ if (c == 'Z' && len > 6)
+ len -= 6;
fp += len;
}
diff --git a/usr/src/uts/common/os/cred.c b/usr/src/uts/common/os/cred.c
index 1ec63249ab..20e57efaad 100644
--- a/usr/src/uts/common/os/cred.c
+++ b/usr/src/uts/common/os/cred.c
@@ -724,6 +724,14 @@ crgetzoneid(const cred_t *cr)
cr->cr_zone->zone_id);
}
+zoneid_t
+crgetzonedid(const cred_t *cr)
+{
+ return (cr->cr_zone == NULL ?
+ (cr->cr_uid == -1 ? (zoneid_t)-1 : GLOBAL_ZONEID) :
+ cr->cr_zone->zone_did);
+}
+
projid_t
crgetprojid(const cred_t *cr)
{
diff --git a/usr/src/uts/common/os/cyclic.c b/usr/src/uts/common/os/cyclic.c
index 1bb6baf445..93a318d260 100644
--- a/usr/src/uts/common/os/cyclic.c
+++ b/usr/src/uts/common/os/cyclic.c
@@ -24,6 +24,10 @@
*/
/*
+ * Copyright (c) 2012, Joyent Inc. All rights reserved.
+ */
+
+/*
* The Cyclic Subsystem
* --------------------
*
@@ -1139,7 +1143,7 @@ top:
CYC_TRACE(cpu, level, "softint-top", cyclics, pc);
while (consndx != pc->cypc_prodndx) {
- int pend, npend, opend;
+ uint32_t pend, npend, opend;
int consmasked = consndx & sizemask;
cyclic_t *cyclic = &cyclics[buf[consmasked]];
cyc_func_t handler = cyclic->cy_handler;
diff --git a/usr/src/uts/common/os/devcfg.c b/usr/src/uts/common/os/devcfg.c
index d11c6fb7b7..f8331cb132 100644
--- a/usr/src/uts/common/os/devcfg.c
+++ b/usr/src/uts/common/os/devcfg.c
@@ -22,6 +22,7 @@
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <sys/note.h>
@@ -5890,6 +5891,13 @@ devi_detach_node(dev_info_t *dip, uint_t flags)
}
}
+ /*
+ * dv_mknod places a hold on the dev_info_t for each devfs node
+ * created. If we're to succeed in detaching this device, we must
+ * first release all outstanding references held by devfs.
+ */
+ (void) devfs_clean(pdip, NULL, DV_CLEAN_FORCE);
+
if (i_ddi_detachchild(dip, flags) != DDI_SUCCESS) {
if (flags & NDI_DEVI_OFFLINE) {
RIO_DEBUG((CE_NOTE, "devi_detach_node: offline failed."
diff --git a/usr/src/uts/common/os/driver_lyr.c b/usr/src/uts/common/os/driver_lyr.c
index 8386a1efd8..e59acc4370 100644
--- a/usr/src/uts/common/os/driver_lyr.c
+++ b/usr/src/uts/common/os/driver_lyr.c
@@ -21,6 +21,9 @@
/*
* Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* Layered driver support.
@@ -127,6 +130,10 @@ static kmutex_t ldi_handle_hash_lock[LH_HASH_SZ];
static struct ldi_handle *ldi_handle_hash[LH_HASH_SZ];
static size_t ldi_handle_hash_count;
+/*
+ * Use of "ldi_ev_callback_list" must be protected by ldi_ev_lock()
+ * and ldi_ev_unlock().
+ */
static struct ldi_ev_callback_list ldi_ev_callback_list;
static uint32_t ldi_ev_id_pool = 0;
@@ -166,6 +173,8 @@ ldi_init(void)
cv_init(&ldi_ev_callback_list.le_cv, NULL, CV_DEFAULT, NULL);
ldi_ev_callback_list.le_busy = 0;
ldi_ev_callback_list.le_thread = NULL;
+ ldi_ev_callback_list.le_walker_next = NULL;
+ ldi_ev_callback_list.le_walker_prev = NULL;
list_create(&ldi_ev_callback_list.le_head,
sizeof (ldi_ev_callback_impl_t),
offsetof(ldi_ev_callback_impl_t, lec_list));
@@ -3329,8 +3338,12 @@ ldi_invoke_notify(dev_info_t *dip, dev_t dev, int spec_type, char *event,
ret = LDI_EV_NONE;
ldi_ev_lock();
+
+ VERIFY(ldi_ev_callback_list.le_walker_next == NULL);
listp = &ldi_ev_callback_list.le_head;
- for (lecp = list_head(listp); lecp; lecp = list_next(listp, lecp)) {
+ for (lecp = list_head(listp); lecp; lecp =
+ ldi_ev_callback_list.le_walker_next) {
+ ldi_ev_callback_list.le_walker_next = list_next(listp, lecp);
/* Check if matching device */
if (!ldi_ev_device_match(lecp, dip, dev, spec_type))
@@ -3386,7 +3399,9 @@ ldi_invoke_notify(dev_info_t *dip, dev_t dev, int spec_type, char *event,
* Undo notifies already sent
*/
lecp = list_prev(listp, lecp);
- for (; lecp; lecp = list_prev(listp, lecp)) {
+ VERIFY(ldi_ev_callback_list.le_walker_prev == NULL);
+ for (; lecp; lecp = ldi_ev_callback_list.le_walker_prev) {
+ ldi_ev_callback_list.le_walker_prev = list_prev(listp, lecp);
/*
* Check if matching device
@@ -3437,6 +3452,8 @@ ldi_invoke_notify(dev_info_t *dip, dev_t dev, int spec_type, char *event,
}
out:
+ ldi_ev_callback_list.le_walker_next = NULL;
+ ldi_ev_callback_list.le_walker_prev = NULL;
ldi_ev_unlock();
if (ret == LDI_EV_NONE) {
@@ -3552,8 +3569,11 @@ ldi_invoke_finalize(dev_info_t *dip, dev_t dev, int spec_type, char *event,
" event=%s", (void *)dip, ldi_result, event));
ldi_ev_lock();
+ VERIFY(ldi_ev_callback_list.le_walker_next == NULL);
listp = &ldi_ev_callback_list.le_head;
- for (lecp = list_head(listp); lecp; lecp = list_next(listp, lecp)) {
+ for (lecp = list_head(listp); lecp; lecp =
+ ldi_ev_callback_list.le_walker_next) {
+ ldi_ev_callback_list.le_walker_next = list_next(listp, lecp);
if (lecp->lec_finalize == NULL) {
LDI_EVDBG((CE_NOTE, "ldi_invoke_finalize(): No "
@@ -3604,6 +3624,7 @@ ldi_invoke_finalize(dev_info_t *dip, dev_t dev, int spec_type, char *event,
lecp->lec_finalize = NULL;
}
}
+ ldi_ev_callback_list.le_walker_next = NULL;
ldi_ev_unlock();
if (found)
@@ -3684,7 +3705,23 @@ ldi_ev_remove_callbacks(ldi_callback_id_t id)
for (lecp = list_head(listp); lecp; lecp = next) {
next = list_next(listp, lecp);
if (lecp->lec_id == id) {
- ASSERT(found == NULL);
+ VERIFY(found == NULL);
+
+ /*
+ * If there is a walk in progress, shift that walk
+ * along to the next element so that we can remove
+ * this one. This allows us to unregister an arbitrary
+ * number of callbacks from within a callback.
+ *
+ * See the struct definition (in sunldi_impl.h) for
+ * more information.
+ */
+ if (ldi_ev_callback_list.le_walker_next == lecp)
+ ldi_ev_callback_list.le_walker_next = next;
+ if (ldi_ev_callback_list.le_walker_prev == lecp)
+ ldi_ev_callback_list.le_walker_prev = list_prev(
+ listp, ldi_ev_callback_list.le_walker_prev);
+
list_remove(listp, lecp);
found = lecp;
}
diff --git a/usr/src/uts/common/os/dtrace_subr.c b/usr/src/uts/common/os/dtrace_subr.c
index f2a9ac1b7d..d2ce3361c1 100644
--- a/usr/src/uts/common/os/dtrace_subr.c
+++ b/usr/src/uts/common/os/dtrace_subr.c
@@ -44,6 +44,7 @@ void (*dtrace_helpers_fork)(proc_t *, proc_t *);
void (*dtrace_cpustart_init)(void);
void (*dtrace_cpustart_fini)(void);
void (*dtrace_cpc_fire)(uint64_t);
+void (*dtrace_closef)(void);
void (*dtrace_debugger_init)(void);
void (*dtrace_debugger_fini)(void);
diff --git a/usr/src/uts/common/os/exit.c b/usr/src/uts/common/os/exit.c
index b97a09454b..7c5b8323e3 100644
--- a/usr/src/uts/common/os/exit.c
+++ b/usr/src/uts/common/os/exit.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -388,10 +389,16 @@ proc_exit(int why, int what)
if (p->p_pid == z->zone_proc_initpid) {
if (z->zone_boot_err == 0 &&
zone_status_get(z) < ZONE_IS_SHUTTING_DOWN &&
- zone_status_get(global_zone) < ZONE_IS_SHUTTING_DOWN &&
- z->zone_restart_init == B_TRUE &&
- restart_init(what, why) == 0)
- return (0);
+ zone_status_get(global_zone) < ZONE_IS_SHUTTING_DOWN) {
+ if (z->zone_restart_init == B_TRUE) {
+ if (restart_init(what, why) == 0)
+ return (0);
+ } else {
+ (void) zone_kadmin(A_SHUTDOWN, AD_HALT, NULL,
+ CRED());
+ }
+ }
+
/*
* Since we didn't or couldn't restart init, we clear
* the zone's init state and proceed with exit
diff --git a/usr/src/uts/common/os/fio.c b/usr/src/uts/common/os/fio.c
index a014d25c0f..3b47e05ef2 100644
--- a/usr/src/uts/common/os/fio.c
+++ b/usr/src/uts/common/os/fio.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -54,6 +55,7 @@
#include <sys/poll.h>
#include <sys/rctl.h>
#include <sys/port_impl.h>
+#include <sys/dtrace.h>
#include <c2/audit.h>
#include <sys/nbmlock.h>
@@ -952,6 +954,18 @@ closef(file_t *fp)
ASSERT(fp->f_count == 0);
mutex_exit(&fp->f_tlock);
+ /*
+ * If DTrace has getf() subroutines active, it will set dtrace_closef
+ * to point to code that implements a barrier with respect to probe
+ * context. This must be called before the file_t is freed (and the
+ * vnode that it refers to is released) -- but it must be after the
+ * file_t has been removed from the uf_entry_t. That is, there must
+ * be no way for a racing getf() in probe context to yield the fp that
+ * we're operating upon.
+ */
+ if (dtrace_closef != NULL)
+ (*dtrace_closef)();
+
VN_RELE(vp);
/*
* deallocate resources to audit_data
diff --git a/usr/src/uts/common/os/kstat_fr.c b/usr/src/uts/common/os/kstat_fr.c
index 83b817e866..a5f5a6f3c2 100644
--- a/usr/src/uts/common/os/kstat_fr.c
+++ b/usr/src/uts/common/os/kstat_fr.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
@@ -160,6 +161,7 @@ struct {
kstat_named_t avenrun_5min;
kstat_named_t avenrun_15min;
kstat_named_t boot_time;
+ kstat_named_t nsec_per_tick;
} system_misc_kstat = {
{ "ncpus", KSTAT_DATA_UINT32 },
{ "lbolt", KSTAT_DATA_UINT32 },
@@ -171,6 +173,7 @@ struct {
{ "avenrun_5min", KSTAT_DATA_UINT32 },
{ "avenrun_15min", KSTAT_DATA_UINT32 },
{ "boot_time", KSTAT_DATA_UINT32 },
+ { "nsec_per_tick", KSTAT_DATA_UINT32 },
};
struct {
@@ -803,7 +806,6 @@ system_misc_kstat_update(kstat_t *ksp, int rw)
{
int myncpus = ncpus;
int *loadavgp = &avenrun[0];
- int loadavg[LOADAVG_NSTATS];
time_t zone_boot_time;
clock_t zone_lbolt;
hrtime_t zone_hrtime;
@@ -820,17 +822,11 @@ system_misc_kstat_update(kstat_t *ksp, int rw)
*/
mutex_enter(&cpu_lock);
if (pool_pset_enabled()) {
- psetid_t mypsid = zone_pset_get(curproc->p_zone);
- int error;
-
myncpus = zone_ncpus_get(curproc->p_zone);
ASSERT(myncpus > 0);
- error = cpupart_get_loadavg(mypsid, &loadavg[0],
- LOADAVG_NSTATS);
- ASSERT(error == 0);
- loadavgp = &loadavg[0];
}
mutex_exit(&cpu_lock);
+ loadavgp = &curproc->p_zone->zone_avenrun[0];
}
if (INGLOBALZONE(curproc)) {
@@ -838,9 +834,7 @@ system_misc_kstat_update(kstat_t *ksp, int rw)
zone_lbolt = ddi_get_lbolt();
zone_nproc = nproc;
} else {
- struct timeval tvp;
- hrt2tv(curproc->p_zone->zone_zsched->p_mstart, &tvp);
- zone_boot_time = tvp.tv_sec;
+ zone_boot_time = curproc->p_zone->zone_boot_time;
zone_hrtime = gethrtime();
zone_lbolt = (clock_t)(NSEC_TO_TICK(zone_hrtime) -
@@ -861,6 +855,8 @@ system_misc_kstat_update(kstat_t *ksp, int rw)
system_misc_kstat.avenrun_15min.value.ui32 = (uint32_t)loadavgp[2];
system_misc_kstat.boot_time.value.ui32 = (uint32_t)
zone_boot_time;
+ system_misc_kstat.nsec_per_tick.value.ui32 = (uint32_t)
+ nsec_per_tick;
return (0);
}
diff --git a/usr/src/uts/common/os/logsubr.c b/usr/src/uts/common/os/logsubr.c
index f5cebbf82e..2142f5b047 100644
--- a/usr/src/uts/common/os/logsubr.c
+++ b/usr/src/uts/common/os/logsubr.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -248,8 +249,7 @@ log_init(void)
*/
printf("\rSunOS Release %s Version %s %u-bit\n",
utsname.release, utsname.version, NBBY * (uint_t)sizeof (void *));
- printf("Copyright (c) 1983, 2010, Oracle and/or its affiliates. "
- "All rights reserved.\n");
+ printf("Copyright (c) 2010-2013, Joyent Inc. All rights reserved.\n");
#ifdef DEBUG
printf("DEBUG enabled\n");
#endif
diff --git a/usr/src/uts/common/os/msacct.c b/usr/src/uts/common/os/msacct.c
index df975eb7ee..30e50cce72 100644
--- a/usr/src/uts/common/os/msacct.c
+++ b/usr/src/uts/common/os/msacct.c
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -33,6 +34,7 @@
#include <sys/debug.h>
#include <sys/msacct.h>
#include <sys/time.h>
+#include <sys/zone.h>
/*
* Mega-theory block comment:
@@ -390,6 +392,7 @@ void
syscall_mstate(int fromms, int toms)
{
kthread_t *t = curthread;
+ zone_t *z = ttozone(t);
struct mstate *ms;
hrtime_t *mstimep;
hrtime_t curtime;
@@ -413,6 +416,10 @@ syscall_mstate(int fromms, int toms)
newtime = curtime - ms->ms_state_start;
}
*mstimep += newtime;
+ if (fromms == LMS_USER)
+ atomic_add_64(&z->zone_utime, newtime);
+ else if (fromms == LMS_SYSTEM)
+ atomic_add_64(&z->zone_stime, newtime);
t->t_mstate = toms;
ms->ms_state_start = curtime;
ms->ms_prev = fromms;
@@ -560,27 +567,18 @@ cpu_update_pct(kthread_t *t, hrtime_t newtime)
*/
do {
- if (T_ONPROC(t) && t->t_waitrq == 0) {
- hrlb = t->t_hrtime;
+ pctcpu = t->t_pctcpu;
+ hrlb = t->t_hrtime;
+ delta = newtime - hrlb;
+ if (delta < 0) {
+ newtime = gethrtime_unscaled();
delta = newtime - hrlb;
- if (delta < 0) {
- newtime = gethrtime_unscaled();
- delta = newtime - hrlb;
- }
- t->t_hrtime = newtime;
- scalehrtime(&delta);
- pctcpu = t->t_pctcpu;
+ }
+ t->t_hrtime = newtime;
+ scalehrtime(&delta);
+ if (T_ONPROC(t) && t->t_waitrq == 0) {
npctcpu = cpu_grow(pctcpu, delta);
} else {
- hrlb = t->t_hrtime;
- delta = newtime - hrlb;
- if (delta < 0) {
- newtime = gethrtime_unscaled();
- delta = newtime - hrlb;
- }
- t->t_hrtime = newtime;
- scalehrtime(&delta);
- pctcpu = t->t_pctcpu;
npctcpu = cpu_decay(pctcpu, delta);
}
} while (cas32(&t->t_pctcpu, pctcpu, npctcpu) != pctcpu);
@@ -602,7 +600,10 @@ new_mstate(kthread_t *t, int new_state)
hrtime_t curtime;
hrtime_t newtime;
hrtime_t oldtime;
+ hrtime_t ztime;
+ hrtime_t origstart;
klwp_t *lwp;
+ zone_t *z;
ASSERT(new_state != LMS_WAIT_CPU);
ASSERT((unsigned)new_state < NMSTATES);
@@ -625,6 +626,7 @@ new_mstate(kthread_t *t, int new_state)
ms = &lwp->lwp_mstate;
state = t->t_mstate;
+ origstart = ms->ms_state_start;
do {
switch (state) {
case LMS_TFAULT:
@@ -637,7 +639,7 @@ new_mstate(kthread_t *t, int new_state)
mstimep = &ms->ms_acct[state];
break;
}
- newtime = curtime - ms->ms_state_start;
+ ztime = newtime = curtime - ms->ms_state_start;
if (newtime < 0) {
curtime = gethrtime_unscaled();
oldtime = *mstimep - 1; /* force CAS to fail */
@@ -648,6 +650,20 @@ new_mstate(kthread_t *t, int new_state)
t->t_mstate = new_state;
ms->ms_state_start = curtime;
} while (cas64((uint64_t *)mstimep, oldtime, newtime) != oldtime);
+
+ /*
+ * When the system boots the initial startup thread will have a
+ * ms_state_start of 0 which would add a huge system time to the global
+ * zone. We want to skip aggregating that initial bit of work.
+ */
+ if (origstart != 0) {
+ z = ttozone(t);
+ if (state == LMS_USER)
+ atomic_add_64(&z->zone_utime, ztime);
+ else if (state == LMS_SYSTEM)
+ atomic_add_64(&z->zone_stime, ztime);
+ }
+
/*
* Remember the previous running microstate.
*/
@@ -686,6 +702,8 @@ restore_mstate(kthread_t *t)
hrtime_t waitrq;
hrtime_t newtime;
hrtime_t oldtime;
+ hrtime_t waittime;
+ zone_t *z;
/*
* Don't call restore mstate of threads without lwps. (Kernel threads)
@@ -756,11 +774,15 @@ restore_mstate(kthread_t *t)
oldtime = *mstimep;
newtime += oldtime;
} while (cas64((uint64_t *)mstimep, oldtime, newtime) != oldtime);
+
/*
* Update the WAIT_CPU timer and per-cpu waitrq total.
*/
- ms->ms_acct[LMS_WAIT_CPU] += (curtime - waitrq);
- CPU->cpu_waitrq += (curtime - waitrq);
+ z = ttozone(t);
+ waittime = curtime - waitrq;
+ ms->ms_acct[LMS_WAIT_CPU] += waittime;
+ atomic_add_64(&z->zone_wtime, waittime);
+ CPU->cpu_waitrq += waittime;
ms->ms_state_start = curtime;
}
diff --git a/usr/src/uts/common/os/netstack.c b/usr/src/uts/common/os/netstack.c
index b8467fbe13..93fd1a387d 100644
--- a/usr/src/uts/common/os/netstack.c
+++ b/usr/src/uts/common/os/netstack.c
@@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/param.h>
@@ -205,6 +206,7 @@ void
netstack_unregister(int moduleid)
{
netstack_t *ns;
+ boolean_t created = B_FALSE;
ASSERT(moduleid >= 0 && moduleid < NS_MAX);
@@ -223,7 +225,33 @@ netstack_unregister(int moduleid)
nm_state_t *nms = &ns->netstack_m_state[moduleid];
mutex_enter(&ns->netstack_lock);
- if (ns_reg[moduleid].nr_shutdown != NULL &&
+
+ /*
+ * We need to be careful here. We could actually have a netstack
+ * being created as we speak waiting for us to let go of this
+ * lock to proceed. It may have set NSS_CREATE_NEEDED, but not
+ * have gotten to the point of completing it yet. If
+ * NSS_CREATE_NEEDED, we can safely just remove it here and
+ * never create the module. However, if NSS_CREATE_INPROGRESS is
+ * set, we need to still flag this module for shutdown and
+ * deletion, just as though it had reached NSS_CREATE_COMPLETED.
+ *
+ * It is safe to do that because of two different guarantees
+ * that exist in the system. The first is that before we do a
+ * create, shutdown, or destroy, we ensure that nothing else is
+ * in progress in the system for this netstack and wait for it
+ * to complete. Secondly, because the zone is being created, we
+ * know that the following call to apply_all_netstack will block
+ * on the zone finishing its initialization.
+ */
+ if (nms->nms_flags & NSS_CREATE_NEEDED)
+ nms->nms_flags &= ~NSS_CREATE_NEEDED;
+
+ if (nms->nms_flags & NSS_CREATE_INPROGRESS ||
+ nms->nms_flags & NSS_CREATE_COMPLETED)
+ created = B_TRUE;
+
+ if (ns_reg[moduleid].nr_shutdown != NULL && created &&
(nms->nms_flags & NSS_CREATE_COMPLETED) &&
(nms->nms_flags & NSS_SHUTDOWN_ALL) == 0) {
nms->nms_flags |= NSS_SHUTDOWN_NEEDED;
@@ -231,8 +259,7 @@ netstack_unregister(int moduleid)
netstack_t *, ns, int, moduleid);
}
if ((ns_reg[moduleid].nr_flags & NRF_REGISTERED) &&
- ns_reg[moduleid].nr_destroy != NULL &&
- (nms->nms_flags & NSS_CREATE_COMPLETED) &&
+ ns_reg[moduleid].nr_destroy != NULL && created &&
(nms->nms_flags & NSS_DESTROY_ALL) == 0) {
nms->nms_flags |= NSS_DESTROY_NEEDED;
DTRACE_PROBE2(netstack__destroy__needed,
diff --git a/usr/src/uts/common/os/policy.c b/usr/src/uts/common/os/policy.c
index 573ebbc367..d8f7882723 100644
--- a/usr/src/uts/common/os/policy.c
+++ b/usr/src/uts/common/os/policy.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -2563,3 +2564,12 @@ secpolicy_ppp_config(const cred_t *cr)
return (secpolicy_net_config(cr, B_FALSE));
return (PRIV_POLICY(cr, PRIV_SYS_PPP_CONFIG, B_FALSE, EPERM, NULL));
}
+
+int
+secpolicy_hyprlofs_control(const cred_t *cr)
+{
+ if (PRIV_POLICY(cr, PRIV_HYPRLOFS_CONTROL, B_FALSE, EPERM, NULL))
+ return (EPERM);
+ return (0);
+}
+
diff --git a/usr/src/uts/common/os/priv_defs b/usr/src/uts/common/os/priv_defs
index a5a918b326..53617bd0fe 100644
--- a/usr/src/uts/common/os/priv_defs
+++ b/usr/src/uts/common/os/priv_defs
@@ -176,6 +176,10 @@ privilege PRIV_GRAPHICS_MAP
Allows a process to perform privileged mappings through a
graphics device.
+privilege PRIV_HYPRLOFS_CONTROL
+
+ Allows a process to manage hyprlofs entries.
+
privilege PRIV_IPC_DAC_READ
Allows a process to read a System V IPC
diff --git a/usr/src/uts/common/os/vmem.c b/usr/src/uts/common/os/vmem.c
index 6946a35a38..1b222538b3 100644
--- a/usr/src/uts/common/os/vmem.c
+++ b/usr/src/uts/common/os/vmem.c
@@ -1619,7 +1619,7 @@ vmem_destroy(vmem_t *vmp)
leaked = vmem_size(vmp, VMEM_ALLOC);
if (leaked != 0)
- cmn_err(CE_WARN, "vmem_destroy('%s'): leaked %lu %s",
+ cmn_err(CE_WARN, "!vmem_destroy('%s'): leaked %lu %s",
vmp->vm_name, leaked, (vmp->vm_cflags & VMC_IDENTIFIER) ?
"identifiers" : "bytes");
diff --git a/usr/src/uts/common/os/zone.c b/usr/src/uts/common/os/zone.c
index 79ccd94ae4..2ac59c6b95 100644
--- a/usr/src/uts/common/os/zone.c
+++ b/usr/src/uts/common/os/zone.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Joyent Inc. All rights reserved.
*/
/*
@@ -369,21 +370,18 @@ static char *zone_ref_subsys_names[] = {
rctl_hndl_t rc_zone_cpu_shares;
rctl_hndl_t rc_zone_locked_mem;
rctl_hndl_t rc_zone_max_swap;
+rctl_hndl_t rc_zone_phys_mem;
rctl_hndl_t rc_zone_max_lofi;
rctl_hndl_t rc_zone_cpu_cap;
+rctl_hndl_t rc_zone_cpu_baseline;
+rctl_hndl_t rc_zone_cpu_burst_time;
+rctl_hndl_t rc_zone_zfs_io_pri;
rctl_hndl_t rc_zone_nlwps;
rctl_hndl_t rc_zone_nprocs;
rctl_hndl_t rc_zone_shmmax;
rctl_hndl_t rc_zone_shmmni;
rctl_hndl_t rc_zone_semmni;
rctl_hndl_t rc_zone_msgmni;
-/*
- * Synchronization primitives used to synchronize between mounts and zone
- * creation/destruction.
- */
-static int mounts_in_progress;
-static kcondvar_t mount_cv;
-static kmutex_t mount_lock;
const char * const zone_default_initname = "/sbin/init";
static char * const zone_prefix = "/zone/";
@@ -423,23 +421,27 @@ static boolean_t zsd_wait_for_inprogress(zone_t *, struct zsd_entry *,
* Version 5 alters the zone_boot system call, and converts its old
* bootargs parameter to be set by the zone_setattr API instead.
* Version 6 adds the flag argument to zone_create.
+ * Version 7 adds the requested zoneid to zone_create.
*/
-static const int ZONE_SYSCALL_API_VERSION = 6;
+static const int ZONE_SYSCALL_API_VERSION = 7;
/*
* Certain filesystems (such as NFS and autofs) need to know which zone
* the mount is being placed in. Because of this, we need to be able to
- * ensure that a zone isn't in the process of being created such that
- * nfs_mount() thinks it is in the global zone, while by the time it
- * gets added the list of mounted zones, it ends up on zoneA's mount
- * list.
+ * ensure that a zone isn't in the process of being created/destroyed such
+ * that nfs_mount() thinks it is in the global/NGZ zone, while by the time
+ * it gets added the list of mounted zones, it ends up on the wrong zone's
+ * mount list. Since a zone can't reside on an NFS file system, we don't
+ * have to worry about the zonepath itself.
*
* The following functions: block_mounts()/resume_mounts() and
* mount_in_progress()/mount_completed() are used by zones and the VFS
- * layer (respectively) to synchronize zone creation and new mounts.
+ * layer (respectively) to synchronize zone state transitions and new
+ * mounts within a zone. This syncronization is on a per-zone basis, so
+ * activity for one zone will not interfere with activity for another zone.
*
* The semantics are like a reader-reader lock such that there may
- * either be multiple mounts (or zone creations, if that weren't
+ * either be multiple mounts (or zone state transitions, if that weren't
* serialized by zonehash_lock) in progress at the same time, but not
* both.
*
@@ -447,10 +449,8 @@ static const int ZONE_SYSCALL_API_VERSION = 6;
* taking too long.
*
* The semantics are such that there is unfair bias towards the
- * "current" operation. This means that zone creations may starve if
- * there is a rapid succession of new mounts coming in to the system, or
- * there is a remote possibility that zones will be created at such a
- * rate that new mounts will not be able to proceed.
+ * "current" operation. This means that zone halt may starve if
+ * there is a rapid succession of new mounts coming in to the zone.
*/
/*
* Prevent new mounts from progressing to the point of calling
@@ -458,7 +458,7 @@ static const int ZONE_SYSCALL_API_VERSION = 6;
* them to complete.
*/
static int
-block_mounts(void)
+block_mounts(zone_t *zp)
{
int retval = 0;
@@ -467,19 +467,21 @@ block_mounts(void)
* called with zonehash_lock held.
*/
ASSERT(MUTEX_NOT_HELD(&zonehash_lock));
- mutex_enter(&mount_lock);
- while (mounts_in_progress > 0) {
- if (cv_wait_sig(&mount_cv, &mount_lock) == 0)
+ mutex_enter(&zp->zone_mount_lock);
+ while (zp->zone_mounts_in_progress > 0) {
+ if (cv_wait_sig(&zp->zone_mount_cv, &zp->zone_mount_lock) == 0)
goto signaled;
}
/*
* A negative value of mounts_in_progress indicates that mounts
- * have been blocked by (-mounts_in_progress) different callers.
+ * have been blocked by (-mounts_in_progress) different callers
+ * (remotely possible if two threads enter zone_shutdown at the same
+ * time).
*/
- mounts_in_progress--;
+ zp->zone_mounts_in_progress--;
retval = 1;
signaled:
- mutex_exit(&mount_lock);
+ mutex_exit(&zp->zone_mount_lock);
return (retval);
}
@@ -488,26 +490,26 @@ signaled:
* Allow them to progress if we were the last obstacle.
*/
static void
-resume_mounts(void)
+resume_mounts(zone_t *zp)
{
- mutex_enter(&mount_lock);
- if (++mounts_in_progress == 0)
- cv_broadcast(&mount_cv);
- mutex_exit(&mount_lock);
+ mutex_enter(&zp->zone_mount_lock);
+ if (++zp->zone_mounts_in_progress == 0)
+ cv_broadcast(&zp->zone_mount_cv);
+ mutex_exit(&zp->zone_mount_lock);
}
/*
- * The VFS layer is busy with a mount; zones should wait until all
- * mounts are completed to progress.
+ * The VFS layer is busy with a mount; this zone should wait until all
+ * of its mounts are completed to progress.
*/
void
-mount_in_progress(void)
+mount_in_progress(zone_t *zp)
{
- mutex_enter(&mount_lock);
- while (mounts_in_progress < 0)
- cv_wait(&mount_cv, &mount_lock);
- mounts_in_progress++;
- mutex_exit(&mount_lock);
+ mutex_enter(&zp->zone_mount_lock);
+ while (zp->zone_mounts_in_progress < 0)
+ cv_wait(&zp->zone_mount_cv, &zp->zone_mount_lock);
+ zp->zone_mounts_in_progress++;
+ mutex_exit(&zp->zone_mount_lock);
}
/*
@@ -515,12 +517,12 @@ mount_in_progress(void)
* callers if this is the last mount.
*/
void
-mount_completed(void)
+mount_completed(zone_t *zp)
{
- mutex_enter(&mount_lock);
- if (--mounts_in_progress == 0)
- cv_broadcast(&mount_cv);
- mutex_exit(&mount_lock);
+ mutex_enter(&zp->zone_mount_lock);
+ if (--zp->zone_mounts_in_progress == 0)
+ cv_broadcast(&zp->zone_mount_cv);
+ mutex_exit(&zp->zone_mount_lock);
}
/*
@@ -1380,6 +1382,114 @@ static rctl_ops_t zone_cpu_cap_ops = {
/*ARGSUSED*/
static rctl_qty_t
+zone_cpu_base_get(rctl_t *rctl, struct proc *p)
+{
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ return (cpucaps_zone_get_base(p->p_zone));
+}
+
+/*
+ * The zone cpu base is used to set the baseline CPU for the zone
+ * so we can track when the zone is bursting.
+ */
+/*ARGSUSED*/
+static int
+zone_cpu_base_set(rctl_t *rctl, struct proc *p, rctl_entity_p_t *e,
+ rctl_qty_t nv)
+{
+ zone_t *zone = e->rcep_p.zone;
+
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ ASSERT(e->rcep_t == RCENTITY_ZONE);
+
+ if (zone == NULL)
+ return (0);
+
+ return (cpucaps_zone_set_base(zone, nv));
+}
+
+static rctl_ops_t zone_cpu_base_ops = {
+ rcop_no_action,
+ zone_cpu_base_get,
+ zone_cpu_base_set,
+ rcop_no_test
+};
+
+/*ARGSUSED*/
+static rctl_qty_t
+zone_cpu_burst_time_get(rctl_t *rctl, struct proc *p)
+{
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ return (cpucaps_zone_get_burst_time(p->p_zone));
+}
+
+/*
+ * The zone cpu burst time is used to set the amount of time CPU(s) can be
+ * bursting for the zone.
+ */
+/*ARGSUSED*/
+static int
+zone_cpu_burst_time_set(rctl_t *rctl, struct proc *p, rctl_entity_p_t *e,
+ rctl_qty_t nv)
+{
+ zone_t *zone = e->rcep_p.zone;
+
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ ASSERT(e->rcep_t == RCENTITY_ZONE);
+
+ if (zone == NULL)
+ return (0);
+
+ return (cpucaps_zone_set_burst_time(zone, nv));
+}
+
+static rctl_ops_t zone_cpu_burst_time_ops = {
+ rcop_no_action,
+ zone_cpu_burst_time_get,
+ zone_cpu_burst_time_set,
+ rcop_no_test
+};
+
+/*
+ * zone.zfs-io-pri resource control support (IO priority).
+ */
+/*ARGSUSED*/
+static rctl_qty_t
+zone_zfs_io_pri_get(rctl_t *rctl, struct proc *p)
+{
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ return (p->p_zone->zone_zfs_io_pri);
+}
+
+/*ARGSUSED*/
+static int
+zone_zfs_io_pri_set(rctl_t *rctl, struct proc *p, rctl_entity_p_t *e,
+ rctl_qty_t nv)
+{
+ zone_t *zone = e->rcep_p.zone;
+
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ ASSERT(e->rcep_t == RCENTITY_ZONE);
+
+ if (zone == NULL)
+ return (0);
+
+ /*
+ * set priority to the new value.
+ */
+ zone->zone_zfs_io_pri = nv;
+ return (0);
+}
+
+static rctl_ops_t zone_zfs_io_pri_ops = {
+ rcop_no_action,
+ zone_zfs_io_pri_get,
+ zone_zfs_io_pri_set,
+ rcop_no_test
+};
+
+/*ARGSUSED*/
+static rctl_qty_t
zone_lwps_usage(rctl_t *r, proc_t *p)
{
rctl_qty_t nlwps;
@@ -1674,6 +1784,39 @@ static rctl_ops_t zone_max_swap_ops = {
/*ARGSUSED*/
static rctl_qty_t
+zone_phys_mem_usage(rctl_t *rctl, struct proc *p)
+{
+ rctl_qty_t q;
+ zone_t *z = p->p_zone;
+
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ /* No additional lock because not enforced in the kernel */
+ q = z->zone_phys_mem;
+ return (q);
+}
+
+/*ARGSUSED*/
+static int
+zone_phys_mem_set(rctl_t *rctl, struct proc *p, rctl_entity_p_t *e,
+ rctl_qty_t nv)
+{
+ ASSERT(MUTEX_HELD(&p->p_lock));
+ ASSERT(e->rcep_t == RCENTITY_ZONE);
+ if (e->rcep_p.zone == NULL)
+ return (0);
+ e->rcep_p.zone->zone_phys_mem_ctl = nv;
+ return (0);
+}
+
+static rctl_ops_t zone_phys_mem_ops = {
+ rcop_no_action,
+ zone_phys_mem_usage,
+ zone_phys_mem_set,
+ rcop_no_test
+};
+
+/*ARGSUSED*/
+static rctl_qty_t
zone_max_lofi_usage(rctl_t *rctl, struct proc *p)
{
rctl_qty_t q;
@@ -1767,6 +1910,20 @@ zone_lockedmem_kstat_update(kstat_t *ksp, int rw)
}
static int
+zone_physmem_kstat_update(kstat_t *ksp, int rw)
+{
+ zone_t *zone = ksp->ks_private;
+ zone_kstat_t *zk = ksp->ks_data;
+
+ if (rw == KSTAT_WRITE)
+ return (EACCES);
+
+ zk->zk_usage.value.ui64 = zone->zone_phys_mem;
+ zk->zk_value.value.ui64 = zone->zone_phys_mem_ctl;
+ return (0);
+}
+
+static int
zone_nprocs_kstat_update(kstat_t *ksp, int rw)
{
zone_t *zone = ksp->ks_private;
@@ -1795,7 +1952,7 @@ zone_swapresv_kstat_update(kstat_t *ksp, int rw)
}
static kstat_t *
-zone_kstat_create_common(zone_t *zone, char *name,
+zone_rctl_kstat_create_common(zone_t *zone, char *name,
int (*updatefunc) (kstat_t *, int))
{
kstat_t *ksp;
@@ -1820,26 +1977,337 @@ zone_kstat_create_common(zone_t *zone, char *name,
return (ksp);
}
+static int
+zone_vfs_kstat_update(kstat_t *ksp, int rw)
+{
+ zone_t *zone = ksp->ks_private;
+ zone_vfs_kstat_t *zvp = ksp->ks_data;
+ kstat_io_t *kiop = &zone->zone_vfs_rwstats;
+
+ if (rw == KSTAT_WRITE)
+ return (EACCES);
+
+ /*
+ * Extract the VFS statistics from the kstat_io_t structure used by
+ * kstat_runq_enter() and related functions. Since the slow ops
+ * counters are updated directly by the VFS layer, there's no need to
+ * copy those statistics here.
+ *
+ * Note that kstat_runq_enter() and the related functions use
+ * gethrtime_unscaled(), so scale the time here.
+ */
+ zvp->zv_nread.value.ui64 = kiop->nread;
+ zvp->zv_reads.value.ui64 = kiop->reads;
+ zvp->zv_rtime.value.ui64 = kiop->rtime;
+ zvp->zv_rlentime.value.ui64 = kiop->rlentime;
+ zvp->zv_nwritten.value.ui64 = kiop->nwritten;
+ zvp->zv_writes.value.ui64 = kiop->writes;
+ zvp->zv_wtime.value.ui64 = kiop->wtime;
+ zvp->zv_wlentime.value.ui64 = kiop->wlentime;
+
+ scalehrtime((hrtime_t *)&zvp->zv_rtime.value.ui64);
+ scalehrtime((hrtime_t *)&zvp->zv_rlentime.value.ui64);
+ scalehrtime((hrtime_t *)&zvp->zv_wtime.value.ui64);
+ scalehrtime((hrtime_t *)&zvp->zv_wlentime.value.ui64);
+
+ return (0);
+}
+
+static kstat_t *
+zone_vfs_kstat_create(zone_t *zone)
+{
+ kstat_t *ksp;
+ zone_vfs_kstat_t *zvp;
+
+ if ((ksp = kstat_create_zone("zone_vfs", zone->zone_id,
+ zone->zone_name, "zone_vfs", KSTAT_TYPE_NAMED,
+ sizeof (zone_vfs_kstat_t) / sizeof (kstat_named_t),
+ KSTAT_FLAG_VIRTUAL, zone->zone_id)) == NULL)
+ return (NULL);
+
+ if (zone->zone_id != GLOBAL_ZONEID)
+ kstat_zone_add(ksp, GLOBAL_ZONEID);
+
+ zvp = ksp->ks_data = kmem_zalloc(sizeof (zone_vfs_kstat_t), KM_SLEEP);
+ ksp->ks_data_size += strlen(zone->zone_name) + 1;
+ ksp->ks_lock = &zone->zone_vfs_lock;
+ zone->zone_vfs_stats = zvp;
+
+ /* The kstat "name" field is not large enough for a full zonename */
+ kstat_named_init(&zvp->zv_zonename, "zonename", KSTAT_DATA_STRING);
+ kstat_named_setstr(&zvp->zv_zonename, zone->zone_name);
+ kstat_named_init(&zvp->zv_nread, "nread", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_reads, "reads", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_rtime, "rtime", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_rlentime, "rlentime", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_nwritten, "nwritten", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_writes, "writes", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_wtime, "wtime", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_wlentime, "wlentime", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_10ms_ops, "10ms_ops", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_100ms_ops, "100ms_ops", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_1s_ops, "1s_ops", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_10s_ops, "10s_ops", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_delay_cnt, "delay_cnt", KSTAT_DATA_UINT64);
+ kstat_named_init(&zvp->zv_delay_time, "delay_time", KSTAT_DATA_UINT64);
+
+ ksp->ks_update = zone_vfs_kstat_update;
+ ksp->ks_private = zone;
+
+ kstat_install(ksp);
+ return (ksp);
+}
+
+static int
+zone_zfs_kstat_update(kstat_t *ksp, int rw)
+{
+ zone_t *zone = ksp->ks_private;
+ zone_zfs_kstat_t *zzp = ksp->ks_data;
+ kstat_io_t *kiop = &zone->zone_zfs_rwstats;
+
+ if (rw == KSTAT_WRITE)
+ return (EACCES);
+
+ /*
+ * Extract the ZFS statistics from the kstat_io_t structure used by
+ * kstat_runq_enter() and related functions. Since the I/O throttle
+ * counters are updated directly by the ZFS layer, there's no need to
+ * copy those statistics here.
+ *
+ * Note that kstat_runq_enter() and the related functions use
+ * gethrtime_unscaled(), so scale the time here.
+ */
+ zzp->zz_nread.value.ui64 = kiop->nread;
+ zzp->zz_reads.value.ui64 = kiop->reads;
+ zzp->zz_rtime.value.ui64 = kiop->rtime;
+ zzp->zz_rlentime.value.ui64 = kiop->rlentime;
+ zzp->zz_nwritten.value.ui64 = kiop->nwritten;
+ zzp->zz_writes.value.ui64 = kiop->writes;
+
+ scalehrtime((hrtime_t *)&zzp->zz_rtime.value.ui64);
+ scalehrtime((hrtime_t *)&zzp->zz_rlentime.value.ui64);
+
+ return (0);
+}
+
+static kstat_t *
+zone_zfs_kstat_create(zone_t *zone)
+{
+ kstat_t *ksp;
+ zone_zfs_kstat_t *zzp;
+
+ if ((ksp = kstat_create_zone("zone_zfs", zone->zone_id,
+ zone->zone_name, "zone_zfs", KSTAT_TYPE_NAMED,
+ sizeof (zone_zfs_kstat_t) / sizeof (kstat_named_t),
+ KSTAT_FLAG_VIRTUAL, zone->zone_id)) == NULL)
+ return (NULL);
+
+ if (zone->zone_id != GLOBAL_ZONEID)
+ kstat_zone_add(ksp, GLOBAL_ZONEID);
+
+ zzp = ksp->ks_data = kmem_zalloc(sizeof (zone_zfs_kstat_t), KM_SLEEP);
+ ksp->ks_data_size += strlen(zone->zone_name) + 1;
+ ksp->ks_lock = &zone->zone_zfs_lock;
+ zone->zone_zfs_stats = zzp;
+
+ /* The kstat "name" field is not large enough for a full zonename */
+ kstat_named_init(&zzp->zz_zonename, "zonename", KSTAT_DATA_STRING);
+ kstat_named_setstr(&zzp->zz_zonename, zone->zone_name);
+ kstat_named_init(&zzp->zz_nread, "nread", KSTAT_DATA_UINT64);
+ kstat_named_init(&zzp->zz_reads, "reads", KSTAT_DATA_UINT64);
+ kstat_named_init(&zzp->zz_rtime, "rtime", KSTAT_DATA_UINT64);
+ kstat_named_init(&zzp->zz_rlentime, "rlentime", KSTAT_DATA_UINT64);
+ kstat_named_init(&zzp->zz_nwritten, "nwritten", KSTAT_DATA_UINT64);
+ kstat_named_init(&zzp->zz_writes, "writes", KSTAT_DATA_UINT64);
+ kstat_named_init(&zzp->zz_waittime, "waittime", KSTAT_DATA_UINT64);
+
+ ksp->ks_update = zone_zfs_kstat_update;
+ ksp->ks_private = zone;
+
+ kstat_install(ksp);
+ return (ksp);
+}
+
+static int
+zone_mcap_kstat_update(kstat_t *ksp, int rw)
+{
+ zone_t *zone = ksp->ks_private;
+ zone_mcap_kstat_t *zmp = ksp->ks_data;
+
+ if (rw == KSTAT_WRITE)
+ return (EACCES);
+
+ zmp->zm_rss.value.ui64 = zone->zone_phys_mem;
+ zmp->zm_phys_cap.value.ui64 = zone->zone_phys_mem_ctl;
+ zmp->zm_swap.value.ui64 = zone->zone_max_swap;
+ zmp->zm_swap_cap.value.ui64 = zone->zone_max_swap_ctl;
+ zmp->zm_nover.value.ui64 = zone->zone_mcap_nover;
+ zmp->zm_pagedout.value.ui64 = zone->zone_mcap_pagedout;
+ zmp->zm_pgpgin.value.ui64 = zone->zone_pgpgin;
+ zmp->zm_anonpgin.value.ui64 = zone->zone_anonpgin;
+ zmp->zm_execpgin.value.ui64 = zone->zone_execpgin;
+ zmp->zm_fspgin.value.ui64 = zone->zone_fspgin;
+ zmp->zm_anon_alloc_fail.value.ui64 = zone->zone_anon_alloc_fail;
+ zmp->zm_pf_throttle.value.ui64 = zone->zone_pf_throttle;
+ zmp->zm_pf_throttle_usec.value.ui64 = zone->zone_pf_throttle_usec;
+
+ return (0);
+}
+
+static kstat_t *
+zone_mcap_kstat_create(zone_t *zone)
+{
+ kstat_t *ksp;
+ zone_mcap_kstat_t *zmp;
+
+ if ((ksp = kstat_create_zone("memory_cap", zone->zone_id,
+ zone->zone_name, "zone_memory_cap", KSTAT_TYPE_NAMED,
+ sizeof (zone_mcap_kstat_t) / sizeof (kstat_named_t),
+ KSTAT_FLAG_VIRTUAL, zone->zone_id)) == NULL)
+ return (NULL);
+
+ if (zone->zone_id != GLOBAL_ZONEID)
+ kstat_zone_add(ksp, GLOBAL_ZONEID);
+
+ zmp = ksp->ks_data = kmem_zalloc(sizeof (zone_mcap_kstat_t), KM_SLEEP);
+ ksp->ks_data_size += strlen(zone->zone_name) + 1;
+ ksp->ks_lock = &zone->zone_mcap_lock;
+ zone->zone_mcap_stats = zmp;
+
+ /* The kstat "name" field is not large enough for a full zonename */
+ kstat_named_init(&zmp->zm_zonename, "zonename", KSTAT_DATA_STRING);
+ kstat_named_setstr(&zmp->zm_zonename, zone->zone_name);
+ kstat_named_init(&zmp->zm_rss, "rss", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_phys_cap, "physcap", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_swap, "swap", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_swap_cap, "swapcap", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_nover, "nover", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_pagedout, "pagedout", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_pgpgin, "pgpgin", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_anonpgin, "anonpgin", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_execpgin, "execpgin", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_fspgin, "fspgin", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_anon_alloc_fail, "anon_alloc_fail",
+ KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_pf_throttle, "n_pf_throttle",
+ KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_pf_throttle_usec, "n_pf_throttle_usec",
+ KSTAT_DATA_UINT64);
+
+ ksp->ks_update = zone_mcap_kstat_update;
+ ksp->ks_private = zone;
+
+ kstat_install(ksp);
+ return (ksp);
+}
+
+static int
+zone_misc_kstat_update(kstat_t *ksp, int rw)
+{
+ zone_t *zone = ksp->ks_private;
+ zone_misc_kstat_t *zmp = ksp->ks_data;
+ hrtime_t tmp;
+
+ if (rw == KSTAT_WRITE)
+ return (EACCES);
+
+ tmp = zone->zone_utime;
+ scalehrtime(&tmp);
+ zmp->zm_utime.value.ui64 = tmp;
+ tmp = zone->zone_stime;
+ scalehrtime(&tmp);
+ zmp->zm_stime.value.ui64 = tmp;
+ tmp = zone->zone_wtime;
+ scalehrtime(&tmp);
+ zmp->zm_wtime.value.ui64 = tmp;
+
+ zmp->zm_avenrun1.value.ui32 = zone->zone_avenrun[0];
+ zmp->zm_avenrun5.value.ui32 = zone->zone_avenrun[1];
+ zmp->zm_avenrun15.value.ui32 = zone->zone_avenrun[2];
+
+ return (0);
+}
+
+static kstat_t *
+zone_misc_kstat_create(zone_t *zone)
+{
+ kstat_t *ksp;
+ zone_misc_kstat_t *zmp;
+
+ if ((ksp = kstat_create_zone("zones", zone->zone_id,
+ zone->zone_name, "zone_misc", KSTAT_TYPE_NAMED,
+ sizeof (zone_misc_kstat_t) / sizeof (kstat_named_t),
+ KSTAT_FLAG_VIRTUAL, zone->zone_id)) == NULL)
+ return (NULL);
+
+ if (zone->zone_id != GLOBAL_ZONEID)
+ kstat_zone_add(ksp, GLOBAL_ZONEID);
+
+ zmp = ksp->ks_data = kmem_zalloc(sizeof (zone_misc_kstat_t), KM_SLEEP);
+ ksp->ks_data_size += strlen(zone->zone_name) + 1;
+ ksp->ks_lock = &zone->zone_misc_lock;
+ zone->zone_misc_stats = zmp;
+
+ /* The kstat "name" field is not large enough for a full zonename */
+ kstat_named_init(&zmp->zm_zonename, "zonename", KSTAT_DATA_STRING);
+ kstat_named_setstr(&zmp->zm_zonename, zone->zone_name);
+ kstat_named_init(&zmp->zm_utime, "nsec_user", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_stime, "nsec_sys", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_wtime, "nsec_waitrq", KSTAT_DATA_UINT64);
+ kstat_named_init(&zmp->zm_avenrun1, "avenrun_1min", KSTAT_DATA_UINT32);
+ kstat_named_init(&zmp->zm_avenrun5, "avenrun_5min", KSTAT_DATA_UINT32);
+ kstat_named_init(&zmp->zm_avenrun15, "avenrun_15min",
+ KSTAT_DATA_UINT32);
+
+ ksp->ks_update = zone_misc_kstat_update;
+ ksp->ks_private = zone;
+
+ kstat_install(ksp);
+ return (ksp);
+}
+
static void
zone_kstat_create(zone_t *zone)
{
- zone->zone_lockedmem_kstat = zone_kstat_create_common(zone,
+ zone->zone_lockedmem_kstat = zone_rctl_kstat_create_common(zone,
"lockedmem", zone_lockedmem_kstat_update);
- zone->zone_swapresv_kstat = zone_kstat_create_common(zone,
+ zone->zone_swapresv_kstat = zone_rctl_kstat_create_common(zone,
"swapresv", zone_swapresv_kstat_update);
- zone->zone_nprocs_kstat = zone_kstat_create_common(zone,
+ zone->zone_physmem_kstat = zone_rctl_kstat_create_common(zone,
+ "physicalmem", zone_physmem_kstat_update);
+ zone->zone_nprocs_kstat = zone_rctl_kstat_create_common(zone,
"nprocs", zone_nprocs_kstat_update);
+
+ if ((zone->zone_vfs_ksp = zone_vfs_kstat_create(zone)) == NULL) {
+ zone->zone_vfs_stats = kmem_zalloc(
+ sizeof (zone_vfs_kstat_t), KM_SLEEP);
+ }
+
+ if ((zone->zone_zfs_ksp = zone_zfs_kstat_create(zone)) == NULL) {
+ zone->zone_zfs_stats = kmem_zalloc(
+ sizeof (zone_zfs_kstat_t), KM_SLEEP);
+ }
+
+ if ((zone->zone_mcap_ksp = zone_mcap_kstat_create(zone)) == NULL) {
+ zone->zone_mcap_stats = kmem_zalloc(
+ sizeof (zone_mcap_kstat_t), KM_SLEEP);
+ }
+
+ if ((zone->zone_misc_ksp = zone_misc_kstat_create(zone)) == NULL) {
+ zone->zone_misc_stats = kmem_zalloc(
+ sizeof (zone_misc_kstat_t), KM_SLEEP);
+ }
}
static void
-zone_kstat_delete_common(kstat_t **pkstat)
+zone_kstat_delete_common(kstat_t **pkstat, size_t datasz)
{
void *data;
if (*pkstat != NULL) {
data = (*pkstat)->ks_data;
kstat_delete(*pkstat);
- kmem_free(data, sizeof (zone_kstat_t));
+ kmem_free(data, datasz);
*pkstat = NULL;
}
}
@@ -1847,9 +2315,23 @@ zone_kstat_delete_common(kstat_t **pkstat)
static void
zone_kstat_delete(zone_t *zone)
{
- zone_kstat_delete_common(&zone->zone_lockedmem_kstat);
- zone_kstat_delete_common(&zone->zone_swapresv_kstat);
- zone_kstat_delete_common(&zone->zone_nprocs_kstat);
+ zone_kstat_delete_common(&zone->zone_lockedmem_kstat,
+ sizeof (zone_kstat_t));
+ zone_kstat_delete_common(&zone->zone_swapresv_kstat,
+ sizeof (zone_kstat_t));
+ zone_kstat_delete_common(&zone->zone_physmem_kstat,
+ sizeof (zone_kstat_t));
+ zone_kstat_delete_common(&zone->zone_nprocs_kstat,
+ sizeof (zone_kstat_t));
+
+ zone_kstat_delete_common(&zone->zone_vfs_ksp,
+ sizeof (zone_vfs_kstat_t));
+ zone_kstat_delete_common(&zone->zone_zfs_ksp,
+ sizeof (zone_zfs_kstat_t));
+ zone_kstat_delete_common(&zone->zone_mcap_ksp,
+ sizeof (zone_mcap_kstat_t));
+ zone_kstat_delete_common(&zone->zone_misc_ksp,
+ sizeof (zone_misc_kstat_t));
}
/*
@@ -1883,6 +2365,8 @@ zone_zsd_init(void)
zone0.zone_locked_mem_ctl = UINT64_MAX;
ASSERT(zone0.zone_max_swap == 0);
zone0.zone_max_swap_ctl = UINT64_MAX;
+ zone0.zone_phys_mem = 0;
+ zone0.zone_phys_mem_ctl = UINT64_MAX;
zone0.zone_max_lofi = 0;
zone0.zone_max_lofi_ctl = UINT64_MAX;
zone0.zone_shmmax = 0;
@@ -1906,7 +2390,13 @@ zone_zsd_init(void)
zone0.zone_initname = initname;
zone0.zone_lockedmem_kstat = NULL;
zone0.zone_swapresv_kstat = NULL;
+ zone0.zone_physmem_kstat = NULL;
zone0.zone_nprocs_kstat = NULL;
+ zone0.zone_zfs_io_pri = 1;
+ zone0.zone_stime = 0;
+ zone0.zone_utime = 0;
+ zone0.zone_wtime = 0;
+
list_create(&zone0.zone_ref_list, sizeof (zone_ref_t),
offsetof(zone_ref_t, zref_linkage));
list_create(&zone0.zone_zsd, sizeof (struct zsd_entry),
@@ -2013,6 +2503,21 @@ zone_init(void)
RCTL_GLOBAL_INFINITE,
MAXCAP, MAXCAP, &zone_cpu_cap_ops);
+ rc_zone_cpu_baseline = rctl_register("zone.cpu-baseline",
+ RCENTITY_ZONE, RCTL_GLOBAL_SIGNAL_NEVER | RCTL_GLOBAL_DENY_NEVER |
+ RCTL_GLOBAL_NOBASIC | RCTL_GLOBAL_COUNT | RCTL_GLOBAL_SYSLOG_NEVER,
+ MAXCAP, MAXCAP, &zone_cpu_base_ops);
+
+ rc_zone_cpu_burst_time = rctl_register("zone.cpu-burst-time",
+ RCENTITY_ZONE, RCTL_GLOBAL_SIGNAL_NEVER | RCTL_GLOBAL_DENY_NEVER |
+ RCTL_GLOBAL_NOBASIC | RCTL_GLOBAL_COUNT | RCTL_GLOBAL_SYSLOG_NEVER,
+ INT_MAX, INT_MAX, &zone_cpu_burst_time_ops);
+
+ rc_zone_zfs_io_pri = rctl_register("zone.zfs-io-priority",
+ RCENTITY_ZONE, RCTL_GLOBAL_SIGNAL_NEVER | RCTL_GLOBAL_DENY_NEVER |
+ RCTL_GLOBAL_NOBASIC | RCTL_GLOBAL_COUNT | RCTL_GLOBAL_SYSLOG_NEVER,
+ 1024, 1024, &zone_zfs_io_pri_ops);
+
rc_zone_nlwps = rctl_register("zone.max-lwps", RCENTITY_ZONE,
RCTL_GLOBAL_NOACTION | RCTL_GLOBAL_NOBASIC | RCTL_GLOBAL_COUNT,
INT_MAX, INT_MAX, &zone_lwps_ops);
@@ -2054,6 +2559,20 @@ zone_init(void)
rde = rctl_dict_lookup("zone.cpu-shares");
(void) rctl_val_list_insert(&rde->rcd_default_value, dval);
+ /*
+ * Create a rctl_val with PRIVILEGED, NOACTION, value = 1. Then attach
+ * this at the head of the rctl_dict_entry for ``zone.zfs-io-priority'.
+ */
+ dval = kmem_cache_alloc(rctl_val_cache, KM_SLEEP);
+ bzero(dval, sizeof (rctl_val_t));
+ dval->rcv_value = 1;
+ dval->rcv_privilege = RCPRIV_PRIVILEGED;
+ dval->rcv_flagaction = RCTL_LOCAL_NOACTION;
+ dval->rcv_action_recip_pid = -1;
+
+ rde = rctl_dict_lookup("zone.zfs-io-priority");
+ (void) rctl_val_list_insert(&rde->rcd_default_value, dval);
+
rc_zone_locked_mem = rctl_register("zone.max-locked-memory",
RCENTITY_ZONE, RCTL_GLOBAL_NOBASIC | RCTL_GLOBAL_BYTES |
RCTL_GLOBAL_DENY_ALWAYS, UINT64_MAX, UINT64_MAX,
@@ -2064,6 +2583,11 @@ zone_init(void)
RCTL_GLOBAL_DENY_ALWAYS, UINT64_MAX, UINT64_MAX,
&zone_max_swap_ops);
+ rc_zone_phys_mem = rctl_register("zone.max-physical-memory",
+ RCENTITY_ZONE, RCTL_GLOBAL_NOBASIC | RCTL_GLOBAL_BYTES |
+ RCTL_GLOBAL_DENY_ALWAYS, UINT64_MAX, UINT64_MAX,
+ &zone_phys_mem_ops);
+
rc_zone_max_lofi = rctl_register("zone.max-lofi",
RCENTITY_ZONE, RCTL_GLOBAL_NOBASIC | RCTL_GLOBAL_COUNT |
RCTL_GLOBAL_DENY_ALWAYS, UINT64_MAX, UINT64_MAX,
@@ -2236,12 +2760,18 @@ zone_free(zone_t *zone)
static void
zone_status_set(zone_t *zone, zone_status_t status)
{
+ timestruc_t now;
+ uint64_t t;
nvlist_t *nvl = NULL;
ASSERT(MUTEX_HELD(&zone_status_lock));
ASSERT(status > ZONE_MIN_STATE && status <= ZONE_MAX_STATE &&
status >= zone_status_get(zone));
+ /* Current time since Jan 1 1970 but consumers expect NS */
+ gethrestime(&now);
+ t = (now.tv_sec * NANOSEC) + now.tv_nsec;
+
if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP) ||
nvlist_add_string(nvl, ZONE_CB_NAME, zone->zone_name) ||
nvlist_add_string(nvl, ZONE_CB_NEWSTATE,
@@ -2249,7 +2779,7 @@ zone_status_set(zone_t *zone, zone_status_t status)
nvlist_add_string(nvl, ZONE_CB_OLDSTATE,
zone_status_table[zone->zone_status]) ||
nvlist_add_int32(nvl, ZONE_CB_ZONEID, zone->zone_id) ||
- nvlist_add_uint64(nvl, ZONE_CB_TIMESTAMP, (uint64_t)gethrtime()) ||
+ nvlist_add_uint64(nvl, ZONE_CB_TIMESTAMP, t) ||
sysevent_evc_publish(zone_event_chan, ZONE_EVENT_STATUS_CLASS,
ZONE_EVENT_STATUS_SUBCLASS, "sun.com", "kernel", nvl, EVCH_SLEEP)) {
#ifdef DEBUG
@@ -2375,14 +2905,65 @@ zone_set_initname(zone_t *zone, const char *zone_initname)
return (0);
}
+/*
+ * The zone_set_mcap_nover and zone_set_mcap_pageout functions are used
+ * to provide the physical memory capping kstats. Since physical memory
+ * capping is currently implemented in userland, that code uses the setattr
+ * entry point to increment the kstats. We always simply increment nover
+ * every time that setattr is called and we always add in the input value
+ * to zone_mcap_pagedout every time that is called.
+ */
+/*ARGSUSED*/
static int
-zone_set_phys_mcap(zone_t *zone, const uint64_t *zone_mcap)
+zone_set_mcap_nover(zone_t *zone, const uint64_t *zone_nover)
{
- uint64_t mcap;
- int err = 0;
+ zone->zone_mcap_nover++;
+
+ return (0);
+}
+
+static int
+zone_set_mcap_pageout(zone_t *zone, const uint64_t *zone_pageout)
+{
+ uint64_t pageout;
+ int err;
+
+ if ((err = copyin(zone_pageout, &pageout, sizeof (uint64_t))) == 0)
+ zone->zone_mcap_pagedout += pageout;
+
+ return (err);
+}
+
+/*
+ * The zone_set_page_fault_delay function is used to set the number of usecs
+ * to throttle page faults. This is normally 0 but can be set to a non-0 value
+ * by the user-land memory capping code when the zone is over its physcial
+ * memory cap.
+ */
+static int
+zone_set_page_fault_delay(zone_t *zone, const uint32_t *pfdelay)
+{
+ uint32_t dusec;
+ int err;
+
+ if ((err = copyin(pfdelay, &dusec, sizeof (uint32_t))) == 0)
+ zone->zone_pg_flt_delay = dusec;
- if ((err = copyin(zone_mcap, &mcap, sizeof (uint64_t))) == 0)
- zone->zone_phys_mcap = mcap;
+ return (err);
+}
+
+/*
+ * The zone_set_rss function is used to set the zone's RSS when we do the
+ * fast, approximate calculation in user-land.
+ */
+static int
+zone_set_rss(zone_t *zone, const uint64_t *prss)
+{
+ uint64_t rss;
+ int err;
+
+ if ((err = copyin(prss, &rss, sizeof (uint64_t))) == 0)
+ zone->zone_phys_mem = rss;
return (err);
}
@@ -2794,6 +3375,12 @@ getzoneid(void)
return (curproc->p_zone->zone_id);
}
+zoneid_t
+getzonedid(void)
+{
+ return (curproc->p_zone->zone_did);
+}
+
/*
* Internal versions of zone_find_by_*(). These don't zone_hold() or
* check the validity of a zone's state.
@@ -2977,6 +3564,92 @@ zone_find_by_path(const char *path)
}
/*
+ * Public interface for updating per-zone load averages. Called once per
+ * second.
+ *
+ * Based on loadavg_update(), genloadavg() and calcloadavg() from clock.c.
+ */
+void
+zone_loadavg_update()
+{
+ zone_t *zp;
+ zone_status_t status;
+ struct loadavg_s *lavg;
+ hrtime_t zone_total;
+ int i;
+ hrtime_t hr_avg;
+ int nrun;
+ static int64_t f[3] = { 135, 27, 9 };
+ int64_t q, r;
+
+ mutex_enter(&zonehash_lock);
+ for (zp = list_head(&zone_active); zp != NULL;
+ zp = list_next(&zone_active, zp)) {
+ mutex_enter(&zp->zone_lock);
+
+ /* Skip zones that are on the way down or not yet up */
+ status = zone_status_get(zp);
+ if (status < ZONE_IS_READY || status >= ZONE_IS_DOWN) {
+ /* For all practical purposes the zone doesn't exist. */
+ mutex_exit(&zp->zone_lock);
+ continue;
+ }
+
+ /*
+ * Update the 10 second moving average data in zone_loadavg.
+ */
+ lavg = &zp->zone_loadavg;
+
+ zone_total = zp->zone_utime + zp->zone_stime + zp->zone_wtime;
+ scalehrtime(&zone_total);
+
+ /* The zone_total should always be increasing. */
+ lavg->lg_loads[lavg->lg_cur] = (zone_total > lavg->lg_total) ?
+ zone_total - lavg->lg_total : 0;
+ lavg->lg_cur = (lavg->lg_cur + 1) % S_LOADAVG_SZ;
+ /* lg_total holds the prev. 1 sec. total */
+ lavg->lg_total = zone_total;
+
+ /*
+ * To simplify the calculation, we don't calculate the load avg.
+ * until the zone has been up for at least 10 seconds and our
+ * moving average is thus full.
+ */
+ if ((lavg->lg_len + 1) < S_LOADAVG_SZ) {
+ lavg->lg_len++;
+ mutex_exit(&zp->zone_lock);
+ continue;
+ }
+
+ /* Now calculate the 1min, 5min, 15 min load avg. */
+ hr_avg = 0;
+ for (i = 0; i < S_LOADAVG_SZ; i++)
+ hr_avg += lavg->lg_loads[i];
+ hr_avg = hr_avg / S_LOADAVG_SZ;
+ nrun = hr_avg / (NANOSEC / LGRP_LOADAVG_IN_THREAD_MAX);
+
+ /* Compute load avg. See comment in calcloadavg() */
+ for (i = 0; i < 3; i++) {
+ q = (zp->zone_hp_avenrun[i] >> 16) << 7;
+ r = (zp->zone_hp_avenrun[i] & 0xffff) << 7;
+ zp->zone_hp_avenrun[i] +=
+ ((nrun - q) * f[i] - ((r * f[i]) >> 16)) >> 4;
+
+ /* avenrun[] can only hold 31 bits of load avg. */
+ if (zp->zone_hp_avenrun[i] <
+ ((uint64_t)1<<(31+16-FSHIFT)))
+ zp->zone_avenrun[i] = (int32_t)
+ (zp->zone_hp_avenrun[i] >> (16 - FSHIFT));
+ else
+ zp->zone_avenrun[i] = 0x7fffffff;
+ }
+
+ mutex_exit(&zp->zone_lock);
+ }
+ mutex_exit(&zonehash_lock);
+}
+
+/*
* Get the number of cpus visible to this zone. The system-wide global
* 'ncpus' is returned if pools are disabled, the caller is in the
* global zone, or a NULL zone argument is passed in.
@@ -3789,7 +4462,10 @@ zsched(void *arg)
mutex_enter(&zone_status_lock);
zone_status_set(zone, ZONE_IS_SHUTTING_DOWN);
mutex_exit(&zone_status_lock);
+ } else {
+ zone->zone_boot_time = gethrestime_sec();
}
+
pool_unlock();
}
@@ -4081,7 +4757,7 @@ zone_create(const char *zone_name, const char *zone_root,
caddr_t rctlbuf, size_t rctlbufsz,
caddr_t zfsbuf, size_t zfsbufsz, int *extended_error,
int match, uint32_t doi, const bslabel_t *label,
- int flags)
+ int flags, zoneid_t zone_did)
{
struct zsched_arg zarg;
nvlist_t *rctls = NULL;
@@ -4104,6 +4780,7 @@ zone_create(const char *zone_name, const char *zone_root,
zone = kmem_zalloc(sizeof (zone_t), KM_SLEEP);
zoneid = zone->zone_id = id_alloc(zoneid_space);
+ zone->zone_did = zone_did;
zone->zone_status = ZONE_IS_UNINITIALIZED;
zone->zone_pool = pool_default;
zone->zone_pool_mod = gethrtime();
@@ -4172,10 +4849,14 @@ zone_create(const char *zone_name, const char *zone_root,
zone->zone_locked_mem_ctl = UINT64_MAX;
zone->zone_max_swap = 0;
zone->zone_max_swap_ctl = UINT64_MAX;
+ zone->zone_phys_mem = 0;
+ zone->zone_phys_mem_ctl = UINT64_MAX;
zone->zone_max_lofi = 0;
zone->zone_max_lofi_ctl = UINT64_MAX;
- zone0.zone_lockedmem_kstat = NULL;
- zone0.zone_swapresv_kstat = NULL;
+ zone->zone_lockedmem_kstat = NULL;
+ zone->zone_swapresv_kstat = NULL;
+ zone->zone_physmem_kstat = NULL;
+ zone->zone_zfs_io_pri = 1;
/*
* Zsched initializes the rctls.
@@ -4229,7 +4910,7 @@ zone_create(const char *zone_name, const char *zone_root,
return (zone_create_error(error, 0, extended_error));
}
- if (block_mounts() == 0) {
+ if (block_mounts(zone) == 0) {
mutex_enter(&pp->p_lock);
if (curthread != pp->p_agenttp)
continuelwps(pp);
@@ -4380,7 +5061,7 @@ zone_create(const char *zone_name, const char *zone_root,
/*
* The zone is fully visible, so we can let mounts progress.
*/
- resume_mounts();
+ resume_mounts(zone);
if (rctls)
nvlist_free(rctls);
@@ -4396,7 +5077,7 @@ errout:
continuelwps(pp);
mutex_exit(&pp->p_lock);
- resume_mounts();
+ resume_mounts(zone);
if (rctls)
nvlist_free(rctls);
/*
@@ -4474,6 +5155,7 @@ zone_boot(zoneid_t zoneid)
static int
zone_empty(zone_t *zone)
{
+ int cnt = 0;
int waitstatus;
/*
@@ -4484,7 +5166,16 @@ zone_empty(zone_t *zone)
ASSERT(MUTEX_NOT_HELD(&zonehash_lock));
while ((waitstatus = zone_status_timedwait_sig(zone,
ddi_get_lbolt() + hz, ZONE_IS_EMPTY)) == -1) {
- killall(zone->zone_id);
+ boolean_t force = B_FALSE;
+
+ /* Every 30 seconds, try harder */
+ if (cnt++ >= 30) {
+ cmn_err(CE_WARN, "attempt to force kill zone %d\n",
+ zone->zone_id);
+ force = B_TRUE;
+ cnt = 0;
+ }
+ killall(zone->zone_id, force);
}
/*
* return EINTR if we were signaled
@@ -4551,15 +5242,6 @@ zone_shutdown(zoneid_t zoneid)
if (zoneid < MIN_USERZONEID || zoneid > MAX_ZONEID)
return (set_errno(EINVAL));
- /*
- * Block mounts so that VFS_MOUNT() can get an accurate view of
- * the zone's status with regards to ZONE_IS_SHUTTING down.
- *
- * e.g. NFS can fail the mount if it determines that the zone
- * has already begun the shutdown sequence.
- */
- if (block_mounts() == 0)
- return (set_errno(EINTR));
mutex_enter(&zonehash_lock);
/*
* Look for zone under hash lock to prevent races with other
@@ -4567,9 +5249,30 @@ zone_shutdown(zoneid_t zoneid)
*/
if ((zone = zone_find_all_by_id(zoneid)) == NULL) {
mutex_exit(&zonehash_lock);
- resume_mounts();
return (set_errno(EINVAL));
}
+
+ /*
+ * We have to drop zonehash_lock before calling block_mounts.
+ * Hold the zone so we can continue to use the zone_t.
+ */
+ zone_hold(zone);
+ mutex_exit(&zonehash_lock);
+
+ /*
+ * Block mounts so that VFS_MOUNT() can get an accurate view of
+ * the zone's status with regards to ZONE_IS_SHUTTING down.
+ *
+ * e.g. NFS can fail the mount if it determines that the zone
+ * has already begun the shutdown sequence.
+ *
+ */
+ if (block_mounts(zone) == 0) {
+ zone_rele(zone);
+ return (set_errno(EINTR));
+ }
+
+ mutex_enter(&zonehash_lock);
mutex_enter(&zone_status_lock);
status = zone_status_get(zone);
/*
@@ -4578,7 +5281,8 @@ zone_shutdown(zoneid_t zoneid)
if (status < ZONE_IS_READY) {
mutex_exit(&zone_status_lock);
mutex_exit(&zonehash_lock);
- resume_mounts();
+ resume_mounts(zone);
+ zone_rele(zone);
return (set_errno(EINVAL));
}
/*
@@ -4588,7 +5292,8 @@ zone_shutdown(zoneid_t zoneid)
if (status >= ZONE_IS_DOWN) {
mutex_exit(&zone_status_lock);
mutex_exit(&zonehash_lock);
- resume_mounts();
+ resume_mounts(zone);
+ zone_rele(zone);
return (0);
}
/*
@@ -4623,10 +5328,9 @@ zone_shutdown(zoneid_t zoneid)
}
}
}
- zone_hold(zone); /* so we can use the zone_t later */
mutex_exit(&zone_status_lock);
mutex_exit(&zonehash_lock);
- resume_mounts();
+ resume_mounts(zone);
if (error = zone_empty(zone)) {
zone_rele(zone);
@@ -5222,14 +5926,6 @@ zone_getattr(zoneid_t zoneid, int attr, void *buf, size_t bufsize)
error = EFAULT;
}
break;
- case ZONE_ATTR_PHYS_MCAP:
- size = sizeof (zone->zone_phys_mcap);
- if (bufsize > size)
- bufsize = size;
- if (buf != NULL &&
- copyout(&zone->zone_phys_mcap, buf, bufsize) != 0)
- error = EFAULT;
- break;
case ZONE_ATTR_SCHED_CLASS:
mutex_enter(&class_lock);
@@ -5284,6 +5980,14 @@ zone_getattr(zoneid_t zoneid, int attr, void *buf, size_t bufsize)
}
kmem_free(zbuf, bufsize);
break;
+ case ZONE_ATTR_DID:
+ size = sizeof (zoneid_t);
+ if (bufsize > size)
+ bufsize = size;
+
+ if (buf != NULL && copyout(&zone->zone_did, buf, bufsize) != 0)
+ error = EFAULT;
+ break;
default:
if ((attr >= ZONE_ATTR_BRAND_ATTRS) && ZONE_IS_BRANDED(zone)) {
size = bufsize;
@@ -5315,10 +6019,11 @@ zone_setattr(zoneid_t zoneid, int attr, void *buf, size_t bufsize)
return (set_errno(EPERM));
/*
- * Only the ZONE_ATTR_PHYS_MCAP attribute can be set on the
- * global zone.
+ * Only the ZONE_ATTR_PMCAP_NOVER and ZONE_ATTR_PMCAP_PAGEOUT
+ * attributes can be set on the global zone.
*/
- if (zoneid == GLOBAL_ZONEID && attr != ZONE_ATTR_PHYS_MCAP) {
+ if (zoneid == GLOBAL_ZONEID &&
+ attr != ZONE_ATTR_PMCAP_NOVER && attr != ZONE_ATTR_PMCAP_PAGEOUT) {
return (set_errno(EINVAL));
}
@@ -5335,7 +6040,9 @@ zone_setattr(zoneid_t zoneid, int attr, void *buf, size_t bufsize)
* non-global zones.
*/
zone_status = zone_status_get(zone);
- if (attr != ZONE_ATTR_PHYS_MCAP && zone_status > ZONE_IS_READY) {
+ if (attr != ZONE_ATTR_PMCAP_NOVER && attr != ZONE_ATTR_PMCAP_PAGEOUT &&
+ attr != ZONE_ATTR_PG_FLT_DELAY && attr != ZONE_ATTR_RSS &&
+ zone_status > ZONE_IS_READY) {
err = EINVAL;
goto done;
}
@@ -5344,6 +6051,10 @@ zone_setattr(zoneid_t zoneid, int attr, void *buf, size_t bufsize)
case ZONE_ATTR_INITNAME:
err = zone_set_initname(zone, (const char *)buf);
break;
+ case ZONE_ATTR_INITNORESTART:
+ zone->zone_restart_init = B_FALSE;
+ err = 0;
+ break;
case ZONE_ATTR_BOOTARGS:
err = zone_set_bootargs(zone, (const char *)buf);
break;
@@ -5353,8 +6064,17 @@ zone_setattr(zoneid_t zoneid, int attr, void *buf, size_t bufsize)
case ZONE_ATTR_FS_ALLOWED:
err = zone_set_fs_allowed(zone, (const char *)buf);
break;
- case ZONE_ATTR_PHYS_MCAP:
- err = zone_set_phys_mcap(zone, (const uint64_t *)buf);
+ case ZONE_ATTR_PMCAP_NOVER:
+ err = zone_set_mcap_nover(zone, (const uint64_t *)buf);
+ break;
+ case ZONE_ATTR_PMCAP_PAGEOUT:
+ err = zone_set_mcap_pageout(zone, (const uint64_t *)buf);
+ break;
+ case ZONE_ATTR_PG_FLT_DELAY:
+ err = zone_set_page_fault_delay(zone, (const uint32_t *)buf);
+ break;
+ case ZONE_ATTR_RSS:
+ err = zone_set_rss(zone, (const uint64_t *)buf);
break;
case ZONE_ATTR_SCHED_CLASS:
err = zone_set_sched_class(zone, (const char *)buf);
@@ -6075,6 +6795,7 @@ zone(int cmd, void *arg1, void *arg2, void *arg3, void *arg4)
zs.doi = zs32.doi;
zs.label = (const bslabel_t *)(uintptr_t)zs32.label;
zs.flags = zs32.flags;
+ zs.zoneid = zs32.zoneid;
#else
panic("get_udatamodel() returned bogus result\n");
#endif
@@ -6085,7 +6806,7 @@ zone(int cmd, void *arg1, void *arg2, void *arg3, void *arg4)
(caddr_t)zs.rctlbuf, zs.rctlbufsz,
(caddr_t)zs.zfsbuf, zs.zfsbufsz,
zs.extended_error, zs.match, zs.doi,
- zs.label, zs.flags));
+ zs.label, zs.flags, zs.zoneid));
case ZONE_BOOT:
return (zone_boot((zoneid_t)(uintptr_t)arg1));
case ZONE_DESTROY:
@@ -6363,7 +7084,7 @@ zone_kadmin(int cmd, int fcn, const char *mdep, cred_t *credp)
* zone_ki_call_zoneadmd() will do a more thorough job of this
* later.
*/
- killall(zone->zone_id);
+ killall(zone->zone_id, B_FALSE);
/*
* Now, create the thread to contact zoneadmd and do the rest of the
* work. This thread can't be created in our zone otherwise
diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile
index 271682bc67..50846d0cb3 100644
--- a/usr/src/uts/common/sys/Makefile
+++ b/usr/src/uts/common/sys/Makefile
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2012, Joyent, Inc. All rights reserved.
#
include $(SRC)/uts/Makefile.uts
@@ -277,6 +278,7 @@ CHKHDRS= \
ipc.h \
ipc_impl.h \
ipc_rctl.h \
+ ipd.h \
ipmi.h \
isa_defs.h \
iscsi_authclient.h \
@@ -856,6 +858,8 @@ FSHDRS= \
hsfs_rrip.h \
hsfs_spec.h \
hsfs_susp.h \
+ hyprlofs.h \
+ hyprlofs_info.h \
lofs_info.h \
lofs_node.h \
mntdata.h \
diff --git a/usr/src/uts/common/sys/aggr_impl.h b/usr/src/uts/common/sys/aggr_impl.h
index 8363d231cf..e0cfd6f778 100644
--- a/usr/src/uts/common/sys/aggr_impl.h
+++ b/usr/src/uts/common/sys/aggr_impl.h
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved.
*/
#ifndef _SYS_AGGR_IMPL_H
@@ -307,6 +308,8 @@ extern boolean_t aggr_port_notify_link(aggr_grp_t *, aggr_port_t *);
extern void aggr_port_init_callbacks(aggr_port_t *);
extern void aggr_recv_cb(void *, mac_resource_handle_t, mblk_t *, boolean_t);
+extern void aggr_recv_promisc_cb(void *, mac_resource_handle_t, mblk_t *,
+ boolean_t);
extern void aggr_tx_ring_update(void *, uintptr_t);
extern void aggr_tx_notify_thread(void *);
diff --git a/usr/src/uts/common/sys/blkdev.h b/usr/src/uts/common/sys/blkdev.h
index 2307610bae..4ec50fbf3b 100644
--- a/usr/src/uts/common/sys/blkdev.h
+++ b/usr/src/uts/common/sys/blkdev.h
@@ -19,6 +19,7 @@
* CDDL HEADER END
*/
/*
+ * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*/
@@ -116,6 +117,7 @@ struct bd_media {
uint64_t m_nblks;
uint32_t m_blksize;
boolean_t m_readonly;
+ boolean_t m_solidstate;
};
#define BD_INFO_FLAG_REMOVABLE (1U << 0)
diff --git a/usr/src/uts/common/sys/buf.h b/usr/src/uts/common/sys/buf.h
index a9191aed7c..cb8a6012fc 100644
--- a/usr/src/uts/common/sys/buf.h
+++ b/usr/src/uts/common/sys/buf.h
@@ -21,6 +21,7 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -186,6 +187,7 @@ struct biostats {
#define B_STARTED 0x2000000 /* io:::start probe called for buf */
#define B_ABRWRITE 0x4000000 /* Application based recovery active */
#define B_PAGE_NOWAIT 0x8000000 /* Skip the page if it is locked */
+#define B_INVALCURONLY 0x10000000 /* invalidate only for curproc */
/*
* There is some confusion over the meaning of B_FREE and B_INVAL and what
@@ -198,6 +200,12 @@ struct biostats {
* between the sole use of these two flags. In both cases, IO will be done
* if the page is not yet committed to storage.
*
+ * The B_INVALCURONLY flag modifies the behavior of the B_INVAL flag and is
+ * intended to be used in conjunction with B_INVAL. B_INVALCURONLY has no
+ * meaning on its own. When both B_INVALCURONLY and B_INVAL are set, then
+ * the mapping for the page is only invalidated for the current process.
+ * In this case, the page is not destroyed unless this was the final mapping.
+ *
* In order to discard pages without writing them back, (B_INVAL | B_TRUNC)
* should be used.
*
diff --git a/usr/src/uts/common/sys/cpucaps.h b/usr/src/uts/common/sys/cpucaps.h
index 6063ff4380..6bc042108c 100644
--- a/usr/src/uts/common/sys/cpucaps.h
+++ b/usr/src/uts/common/sys/cpucaps.h
@@ -22,6 +22,7 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011, 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_CPUCAPS_H
@@ -84,12 +85,16 @@ extern void cpucaps_zone_remove(zone_t *);
*/
extern int cpucaps_project_set(kproject_t *, rctl_qty_t);
extern int cpucaps_zone_set(zone_t *, rctl_qty_t);
+extern int cpucaps_zone_set_base(zone_t *, rctl_qty_t);
+extern int cpucaps_zone_set_burst_time(zone_t *, rctl_qty_t);
/*
* Get current CPU usage for a project/zone.
*/
extern rctl_qty_t cpucaps_project_get(kproject_t *);
extern rctl_qty_t cpucaps_zone_get(zone_t *);
+extern rctl_qty_t cpucaps_zone_get_base(zone_t *);
+extern rctl_qty_t cpucaps_zone_get_burst_time(zone_t *);
/*
* Scheduling class hooks into CPU caps framework.
diff --git a/usr/src/uts/common/sys/cpucaps_impl.h b/usr/src/uts/common/sys/cpucaps_impl.h
index 95afd21827..2cd4ed644d 100644
--- a/usr/src/uts/common/sys/cpucaps_impl.h
+++ b/usr/src/uts/common/sys/cpucaps_impl.h
@@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011, 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_CPUCAPS_IMPL_H
@@ -66,8 +67,12 @@ typedef struct cpucap {
waitq_t cap_waitq; /* waitq for capped threads */
kstat_t *cap_kstat; /* cpucaps specific kstat */
int64_t cap_gen; /* zone cap specific */
+ hrtime_t cap_chk_value; /* effective CPU usage cap */
hrtime_t cap_value; /* scaled CPU usage cap */
hrtime_t cap_usage; /* current CPU usage */
+ hrtime_t cap_base; /* base CPU for burst */
+ u_longlong_t cap_burst_limit; /* max secs (in tics) for a burst */
+ u_longlong_t cap_bursting; /* # of ticks currently bursting */
disp_lock_t cap_usagelock; /* protects cap_usage above */
/*
* Per cap statistics.
@@ -75,6 +80,7 @@ typedef struct cpucap {
hrtime_t cap_maxusage; /* maximum cap usage */
u_longlong_t cap_below; /* # of ticks spend below the cap */
u_longlong_t cap_above; /* # of ticks spend above the cap */
+ u_longlong_t cap_above_base; /* # of ticks spent above the base */
} cpucap_t;
/*
diff --git a/usr/src/uts/common/sys/cred.h b/usr/src/uts/common/sys/cred.h
index 5056f9a511..914f132dc0 100644
--- a/usr/src/uts/common/sys/cred.h
+++ b/usr/src/uts/common/sys/cred.h
@@ -93,6 +93,7 @@ extern gid_t crgetgid(const cred_t *);
extern gid_t crgetrgid(const cred_t *);
extern gid_t crgetsgid(const cred_t *);
extern zoneid_t crgetzoneid(const cred_t *);
+extern zoneid_t crgetzonedid(const cred_t *);
extern projid_t crgetprojid(const cred_t *);
extern cred_t *crgetmapped(const cred_t *);
diff --git a/usr/src/uts/common/sys/ctf_api.h b/usr/src/uts/common/sys/ctf_api.h
index 17b0b7262e..c08acf1950 100644
--- a/usr/src/uts/common/sys/ctf_api.h
+++ b/usr/src/uts/common/sys/ctf_api.h
@@ -23,6 +23,9 @@
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
/*
* This header file defines the interfaces available from the CTF debugger
@@ -40,8 +43,6 @@
#ifndef _CTF_API_H
#define _CTF_API_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/elf.h>
@@ -223,6 +224,8 @@ extern int ctf_add_member(ctf_file_t *, ctf_id_t, const char *, ctf_id_t);
extern int ctf_set_array(ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
+extern int ctf_delete_type(ctf_file_t *, ctf_id_t);
+
extern int ctf_update(ctf_file_t *);
extern int ctf_discard(ctf_file_t *);
extern int ctf_write(ctf_file_t *, int);
diff --git a/usr/src/uts/common/sys/dkio.h b/usr/src/uts/common/sys/dkio.h
index eb4ddf34fe..a5b0c312f9 100644
--- a/usr/src/uts/common/sys/dkio.h
+++ b/usr/src/uts/common/sys/dkio.h
@@ -23,6 +23,7 @@
* Copyright (c) 1982, 2010, Oracle and/or its affiliates. All rights reserved.
*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
*/
#ifndef _SYS_DKIO_H
@@ -237,6 +238,9 @@ struct dk_callback {
#define DKIOCSETEXTPART (DKIOC|46)
#endif
+/* ioctl to report whether the disk is solid state or not - used for ZFS */
+#define DKIOCSOLIDSTATE (DKIOC|38)
+
/*
* Ioctl to force driver to re-read the alternate partition and rebuild
* the internal defect map.
diff --git a/usr/src/uts/common/sys/dktp/dadk.h b/usr/src/uts/common/sys/dktp/dadk.h
index f5c990e7c0..2178ad1f0d 100644
--- a/usr/src/uts/common/sys/dktp/dadk.h
+++ b/usr/src/uts/common/sys/dktp/dadk.h
@@ -65,6 +65,8 @@ struct dadk {
kstat_t *dad_errstats; /* error stats */
kmutex_t dad_cmd_mutex;
int dad_cmd_count;
+ uint32_t dad_err_cnt; /* number of recent errors */
+ hrtime_t dad_last_log; /* time of last error log */
};
#define DAD_SECSIZ dad_phyg.g_secsiz
diff --git a/usr/src/uts/common/sys/dld.h b/usr/src/uts/common/sys/dld.h
index fb2a0749d3..303a9c7e45 100644
--- a/usr/src/uts/common/sys/dld.h
+++ b/usr/src/uts/common/sys/dld.h
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_DLD_H
@@ -191,6 +192,7 @@ typedef struct dld_ioc_rename {
datalink_id_t dir_linkid1;
datalink_id_t dir_linkid2;
char dir_link[MAXLINKNAMELEN];
+ boolean_t dir_zoneinit;
} dld_ioc_rename_t;
/*
@@ -203,6 +205,7 @@ typedef struct dld_ioc_rename {
typedef struct dld_ioc_zid {
zoneid_t diz_zid;
datalink_id_t diz_linkid;
+ boolean_t diz_transient;
} dld_ioc_zid_t;
/*
diff --git a/usr/src/uts/common/sys/dls.h b/usr/src/uts/common/sys/dls.h
index 6bd2bbe35a..adcfe76c08 100644
--- a/usr/src/uts/common/sys/dls.h
+++ b/usr/src/uts/common/sys/dls.h
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_DLS_H
@@ -110,7 +111,7 @@ extern void dls_devnet_close(dls_dl_handle_t);
extern boolean_t dls_devnet_rebuild();
extern int dls_devnet_rename(datalink_id_t, datalink_id_t,
- const char *);
+ const char *, boolean_t);
extern int dls_devnet_create(mac_handle_t, datalink_id_t,
zoneid_t);
extern int dls_devnet_destroy(mac_handle_t, datalink_id_t *,
@@ -127,7 +128,7 @@ extern uint16_t dls_devnet_vid(dls_dl_handle_t);
extern datalink_id_t dls_devnet_linkid(dls_dl_handle_t);
extern int dls_devnet_dev2linkid(dev_t, datalink_id_t *);
extern int dls_devnet_phydev(datalink_id_t, dev_t *);
-extern int dls_devnet_setzid(dls_dl_handle_t, zoneid_t);
+extern int dls_devnet_setzid(dls_dl_handle_t, zoneid_t, boolean_t);
extern zoneid_t dls_devnet_getzid(dls_dl_handle_t);
extern zoneid_t dls_devnet_getownerzid(dls_dl_handle_t);
extern boolean_t dls_devnet_islinkvisible(datalink_id_t, zoneid_t);
diff --git a/usr/src/uts/common/sys/dls_impl.h b/usr/src/uts/common/sys/dls_impl.h
index 60f51c47b5..8f7af6856c 100644
--- a/usr/src/uts/common/sys/dls_impl.h
+++ b/usr/src/uts/common/sys/dls_impl.h
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_DLS_IMPL_H
@@ -96,7 +97,8 @@ extern void dls_create_str_kstats(dld_str_t *);
extern int dls_stat_update(kstat_t *, dls_link_t *, int);
extern int dls_stat_create(const char *, int, const char *,
zoneid_t, int (*)(struct kstat *, int), void *,
- kstat_t **);
+ kstat_t **, zoneid_t);
+extern void dls_stat_delete(kstat_t *);
extern int dls_devnet_open_by_dev(dev_t, dls_link_t **,
dls_dl_handle_t *);
diff --git a/usr/src/uts/common/sys/dls_mgmt.h b/usr/src/uts/common/sys/dls_mgmt.h
index b4032c24d6..4f73d92118 100644
--- a/usr/src/uts/common/sys/dls_mgmt.h
+++ b/usr/src/uts/common/sys/dls_mgmt.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#ifndef _DLS_MGMT_H
@@ -165,6 +166,7 @@ typedef struct dlmgmt_door_getname {
typedef struct dlmgmt_door_getlinkid {
int ld_cmd;
char ld_link[MAXLINKNAMELEN];
+ zoneid_t ld_zoneid;
} dlmgmt_door_getlinkid_t;
typedef struct dlmgmt_door_getnext_s {
diff --git a/usr/src/uts/common/sys/dtrace.h b/usr/src/uts/common/sys/dtrace.h
index fd7612f88a..8979791aab 100644
--- a/usr/src/uts/common/sys/dtrace.h
+++ b/usr/src/uts/common/sys/dtrace.h
@@ -25,7 +25,7 @@
*/
/*
- * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -288,8 +288,11 @@ typedef enum dtrace_probespec {
#define DIF_SUBR_INET_NTOA6 43
#define DIF_SUBR_TOUPPER 44
#define DIF_SUBR_TOLOWER 45
+#define DIF_SUBR_GETF 46
+#define DIF_SUBR_JSON 47
+#define DIF_SUBR_STRTOLL 48
-#define DIF_SUBR_MAX 45 /* max subroutine value */
+#define DIF_SUBR_MAX 48 /* max subroutine value */
typedef uint32_t dif_instr_t;
@@ -1019,7 +1022,8 @@ typedef struct dtrace_fmtdesc {
#define DTRACEOPT_AGGSORTPOS 25 /* agg. position to sort on */
#define DTRACEOPT_AGGSORTKEYPOS 26 /* agg. key position to sort on */
#define DTRACEOPT_TEMPORAL 27 /* temporally ordered output */
-#define DTRACEOPT_MAX 28 /* number of options */
+#define DTRACEOPT_ZONE 28 /* zone in which to enable probes */
+#define DTRACEOPT_MAX 29 /* number of options */
#define DTRACEOPT_UNSET (dtrace_optval_t)-2 /* unset option */
@@ -1649,13 +1653,20 @@ typedef struct dof_helper {
*
* A bitwise OR that encapsulates both the mode (either DTRACE_MODE_KERNEL
* or DTRACE_MODE_USER) and the policy when the privilege of the enabling
- * is insufficient for that mode (either DTRACE_MODE_NOPRIV_DROP or
- * DTRACE_MODE_NOPRIV_RESTRICT). If the policy is DTRACE_MODE_NOPRIV_DROP,
- * insufficient privilege will result in the probe firing being silently
- * ignored for the enabling; if the policy is DTRACE_NODE_NOPRIV_RESTRICT,
- * insufficient privilege will not prevent probe processing for the
- * enabling, but restrictions will be in place that induce a UPRIV fault
- * upon attempt to examine probe arguments or current process state.
+ * is insufficient for that mode (a combination of DTRACE_MODE_NOPRIV_DROP,
+ * DTRACE_MODE_NOPRIV_RESTRICT, and DTRACE_MODE_LIMITEDPRIV_RESTRICT). If
+ * DTRACE_MODE_NOPRIV_DROP bit is set, insufficient privilege will result
+ * in the probe firing being silently ignored for the enabling; if the
+ * DTRACE_NODE_NOPRIV_RESTRICT bit is set, insufficient privilege will not
+ * prevent probe processing for the enabling, but restrictions will be in
+ * place that induce a UPRIV fault upon attempt to examine probe arguments
+ * or current process state. If the DTRACE_MODE_LIMITEDPRIV_RESTRICT bit
+ * is set, similar restrictions will be placed upon operation if the
+ * privilege is sufficient to process the enabling, but does not otherwise
+ * entitle the enabling to all zones. The DTRACE_MODE_NOPRIV_DROP and
+ * DTRACE_MODE_NOPRIV_RESTRICT are mutually exclusive (and one of these
+ * two policies must be specified), but either may be combined (or not)
+ * with DTRACE_MODE_LIMITEDPRIV_RESTRICT.
*
* 1.10.4 Caller's context
*
@@ -2054,6 +2065,7 @@ typedef struct dtrace_pops {
#define DTRACE_MODE_USER 0x02
#define DTRACE_MODE_NOPRIV_DROP 0x10
#define DTRACE_MODE_NOPRIV_RESTRICT 0x20
+#define DTRACE_MODE_LIMITEDPRIV_RESTRICT 0x40
typedef uintptr_t dtrace_provider_id_t;
@@ -2268,6 +2280,7 @@ extern void (*dtrace_helpers_cleanup)();
extern void (*dtrace_helpers_fork)(proc_t *parent, proc_t *child);
extern void (*dtrace_cpustart_init)();
extern void (*dtrace_cpustart_fini)();
+extern void (*dtrace_closef)();
extern void (*dtrace_debugger_init)();
extern void (*dtrace_debugger_fini)();
diff --git a/usr/src/uts/common/sys/dtrace_impl.h b/usr/src/uts/common/sys/dtrace_impl.h
index d780082137..f79bf1e42e 100644
--- a/usr/src/uts/common/sys/dtrace_impl.h
+++ b/usr/src/uts/common/sys/dtrace_impl.h
@@ -924,6 +924,7 @@ typedef struct dtrace_mstate {
uintptr_t dtms_strtok; /* saved strtok() pointer */
uint32_t dtms_access; /* memory access rights */
dtrace_difo_t *dtms_difo; /* current dif object */
+ file_t *dtms_getf; /* cached rval of getf() */
} dtrace_mstate_t;
#define DTRACE_COND_OWNER 0x1
@@ -1144,6 +1145,7 @@ struct dtrace_state {
dtrace_optval_t dts_options[DTRACEOPT_MAX]; /* options */
dtrace_cred_t dts_cred; /* credentials */
size_t dts_nretained; /* number of retained enabs */
+ int dts_getf; /* number of getf() calls */
};
struct dtrace_provider {
diff --git a/usr/src/uts/common/sys/fs/hyprlofs.h b/usr/src/uts/common/sys/fs/hyprlofs.h
new file mode 100644
index 0000000000..b8c4149df2
--- /dev/null
+++ b/usr/src/uts/common/sys/fs/hyprlofs.h
@@ -0,0 +1,91 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+#ifndef _SYS_FS_HYPRLOFS_H
+#define _SYS_FS_HYPRLOFS_H
+
+#include <sys/param.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * hyprlofs ioctl numbers.
+ */
+#define HYPRLOFS_IOC ('H' << 8)
+
+#define HYPRLOFS_ADD_ENTRIES (HYPRLOFS_IOC | 1)
+#define HYPRLOFS_RM_ENTRIES (HYPRLOFS_IOC | 2)
+#define HYPRLOFS_RM_ALL (HYPRLOFS_IOC | 3)
+#define HYPRLOFS_GET_ENTRIES (HYPRLOFS_IOC | 4)
+
+typedef struct {
+ char *hle_path;
+ uint_t hle_plen;
+ char *hle_name;
+ uint_t hle_nlen;
+} hyprlofs_entry_t;
+
+typedef struct {
+ hyprlofs_entry_t *hle_entries;
+ uint_t hle_len;
+} hyprlofs_entries_t;
+
+typedef struct {
+ char hce_path[MAXPATHLEN];
+ char hce_name[MAXPATHLEN];
+} hyprlofs_curr_entry_t;
+
+typedef struct {
+ hyprlofs_curr_entry_t *hce_entries;
+ uint_t hce_cnt;
+} hyprlofs_curr_entries_t;
+
+#ifdef _KERNEL
+typedef struct {
+ caddr32_t hle_path;
+ uint_t hle_plen;
+ caddr32_t hle_name;
+ uint_t hle_nlen;
+} hyprlofs_entry32_t;
+
+typedef struct {
+ caddr32_t hle_entries;
+ uint_t hle_len;
+} hyprlofs_entries32_t;
+
+typedef struct {
+ caddr32_t hce_entries;
+ uint_t hce_cnt;
+} hyprlofs_curr_entries32_t;
+
+#endif /* _KERNEL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FS_HYPRLOFS_H */
diff --git a/usr/src/uts/common/sys/fs/hyprlofs_info.h b/usr/src/uts/common/sys/fs/hyprlofs_info.h
new file mode 100644
index 0000000000..38389f77d9
--- /dev/null
+++ b/usr/src/uts/common/sys/fs/hyprlofs_info.h
@@ -0,0 +1,174 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2012, Joyent, Inc. All rights reserved.
+ */
+
+#ifndef _SYS_FS_HYPRLOFS_INFO_H
+#define _SYS_FS_HYPRLOFS_INFO_H
+
+#include <sys/t_lock.h>
+#include <vm/seg.h>
+#include <vm/seg_vn.h>
+#include <sys/vfs_opreg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * hlnode is the file system dependent node for hyprlofs.
+ * It is modeled on the tmpfs tmpnode.
+ *
+ * hln_rwlock protects access of the directory list at hln_dir
+ * as well as syncronizing read/writes to directory hlnodes.
+ * hln_tlock protects updates to hln_mode and hln_nlink.
+ * hln_tlock doesn't require any hlnode locks.
+ */
+typedef struct hlnode {
+ struct hlnode *hln_back; /* linked list of hlnodes */
+ struct hlnode *hln_forw; /* linked list of hlnodes */
+ union {
+ struct {
+ struct hldirent *un_dirlist; /* dirent list */
+ uint_t un_dirents; /* number of dirents */
+ } un_dirstruct;
+ vnode_t *un_realvp; /* real vnode */
+ } un_hlnode;
+ vnode_t *hln_vnode; /* vnode for this hlnode */
+ int hln_gen; /* pseudo gen num for hlfid */
+ int hln_looped; /* flag indicating loopback */
+ vattr_t hln_attr; /* attributes */
+ krwlock_t hln_rwlock; /* rw - serialize mods and */
+ /* directory updates */
+ kmutex_t hln_tlock; /* time, flag, and nlink lock */
+} hlnode_t;
+
+/*
+ * hyprlofs per-mount data structure.
+ * All fields are protected by hlm_contents.
+ */
+typedef struct {
+ vfs_t *hlm_vfsp; /* filesystem's vfs struct */
+ hlnode_t *hlm_rootnode; /* root hlnode */
+ char *hlm_mntpath; /* name of hyprlofs mount point */
+ dev_t hlm_dev; /* unique dev # of mounted `device' */
+ uint_t hlm_gen; /* pseudo generation number for files */
+ kmutex_t hlm_contents; /* lock for hlfsmount structure */
+} hlfsmount_t;
+
+/*
+ * hyprlofs directories are made up of a linked list of hldirent structures
+ * hanging off directory hlnodes. File names are not fixed length,
+ * but are null terminated.
+ */
+typedef struct hldirent {
+ hlnode_t *hld_hlnode; /* hlnode for this file */
+ struct hldirent *hld_next; /* next directory entry */
+ struct hldirent *hld_prev; /* prev directory entry */
+ uint_t hld_offset; /* "offset" of dir entry */
+ uint_t hld_hash; /* a hash of td_name */
+ struct hldirent *hld_link; /* linked via the hash table */
+ hlnode_t *hld_parent; /* parent, dir we are in */
+ char *hld_name; /* must be null terminated */
+ /* max length is MAXNAMELEN */
+} hldirent_t;
+
+/*
+ * hlfid overlays the fid structure (for VFS_VGET)
+ */
+typedef struct {
+ uint16_t hlfid_len;
+ ino32_t hlfid_ino;
+ int32_t hlfid_gen;
+} hlfid_t;
+
+/*
+ * File system independent to hyprlofs conversion macros
+ */
+#define VFSTOHLM(vfsp) ((hlfsmount_t *)(vfsp)->vfs_data)
+#define VTOHLM(vp) ((hlfsmount_t *)(vp)->v_vfsp->vfs_data)
+#define VTOHLN(vp) ((hlnode_t *)(vp)->v_data)
+#define HLNTOV(tp) ((tp)->hln_vnode)
+#define REALVP(vp) ((vnode_t *)VTOHLN(vp)->hln_realvp)
+#define hlnode_hold(tp) VN_HOLD(HLNTOV(tp))
+#define hlnode_rele(tp) VN_RELE(HLNTOV(tp))
+
+#define hln_dir un_hlnode.un_dirstruct.un_dirlist
+#define hln_dirents un_hlnode.un_dirstruct.un_dirents
+#define hln_realvp un_hlnode.un_realvp
+
+/*
+ * Attributes
+ */
+#define hln_mask hln_attr.va_mask
+#define hln_type hln_attr.va_type
+#define hln_mode hln_attr.va_mode
+#define hln_uid hln_attr.va_uid
+#define hln_gid hln_attr.va_gid
+#define hln_fsid hln_attr.va_fsid
+#define hln_nodeid hln_attr.va_nodeid
+#define hln_nlink hln_attr.va_nlink
+#define hln_size hln_attr.va_size
+#define hln_atime hln_attr.va_atime
+#define hln_mtime hln_attr.va_mtime
+#define hln_ctime hln_attr.va_ctime
+#define hln_rdev hln_attr.va_rdev
+#define hln_blksize hln_attr.va_blksize
+#define hln_nblocks hln_attr.va_nblocks
+#define hln_seq hln_attr.va_seq
+
+/*
+ * enums
+ */
+enum de_op { DE_CREATE, DE_MKDIR }; /* direnter ops */
+enum dr_op { DR_REMOVE, DR_RMDIR }; /* dirremove ops */
+
+/*
+ * hyprlofs_minfree is the amount (in pages) of anonymous memory that hyprlofs
+ * leaves free for the rest of the system. The default value for
+ * hyprlofs_minfree is btopr(HYPRLOFSMINFREE) but it can be patched to a
+ * different number of pages. Since hyprlofs doesn't actually use much
+ * memory, its unlikely this ever needs to be patched.
+ */
+#define HYPRLOFSMINFREE 8 * 1024 * 1024 /* 8 Megabytes */
+
+extern size_t hyprlofs_minfree; /* Anonymous memory in pages */
+
+extern void hyprlofs_node_init(hlfsmount_t *, hlnode_t *, vattr_t *,
+ cred_t *);
+extern int hyprlofs_dirlookup(hlnode_t *, char *, hlnode_t **, cred_t *);
+extern int hyprlofs_dirdelete(hlnode_t *, hlnode_t *, char *, enum dr_op,
+ cred_t *);
+extern void hyprlofs_dirinit(hlnode_t *, hlnode_t *);
+extern void hyprlofs_dirtrunc(hlnode_t *);
+extern int hyprlofs_taccess(void *, int, cred_t *);
+extern int hyprlofs_direnter(hlfsmount_t *, hlnode_t *, char *, enum de_op,
+ vnode_t *, vattr_t *, hlnode_t **, cred_t *);
+
+extern struct vnodeops *hyprlofs_vnodeops;
+extern const struct fs_operation_def hyprlofs_vnodeops_template[];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FS_HYPRLOFS_INFO_H */
diff --git a/usr/src/uts/common/sys/fs/tmp.h b/usr/src/uts/common/sys/fs/tmp.h
index 68dd67c61e..4a6e86bdd9 100644
--- a/usr/src/uts/common/sys/fs/tmp.h
+++ b/usr/src/uts/common/sys/fs/tmp.h
@@ -68,29 +68,28 @@ enum dr_op { DR_REMOVE, DR_RMDIR, DR_RENAME }; /* dirremove ops */
/*
* tmpfs_minfree is the amount (in pages) of anonymous memory that tmpfs
- * leaves free for the rest of the system. E.g. in a system with 32MB of
- * configured swap space, if 16MB were reserved (leaving 16MB free),
- * tmpfs could allocate up to 16MB - tmpfs_minfree. The default value
- * for tmpfs_minfree is btopr(TMPMINFREE) but it can cautiously patched
- * to a different number of pages.
- * NB: If tmpfs allocates too much swap space, other processes will be
- * unable to execute.
+ * leaves free for the rest of the system. In antiquity, this number could be
+ * relevant on a system-wide basis, as physical DRAM was routinely exhausted;
+ * however, in more modern times, the relative growth of DRAM with respect to
+ * application footprint means that this number is only likely to become
+ * factor in a virtualized OS environment (e.g., a zone) -- and even then only
+ * when DRAM and swap have both been capped low to allow for maximum tenancy.
+ * TMPMINFREE -- the value from which tmpfs_minfree is derived -- should
+ * therefore be configured to a value that is roughly the smallest practical
+ * value for memory + swap minus the largest reasonable size for tmpfs in such
+ * a configuration. As of this writing, the smallest practical memory + swap
+ * configuration is 128MB, and it seems reasonable to allow tmpfs to consume
+ * no more than seven-eighths of this, yielding a TMPMINFREE of 16MB. Care
+ * should be exercised in changing this: tuning this value too high will
+ * result in spurious ENOSPC errors in tmpfs in small zones (a problem that
+ * can induce cascading failure surprisingly often); tuning this value too low
+ * will result in tmpfs consumption alone to alone induce application-level
+ * memory allocation failure.
*/
-#define TMPMINFREE 2 * 1024 * 1024 /* 2 Megabytes */
+#define TMPMINFREE 16 * 1024 * 1024 /* 16 Megabytes */
extern size_t tmpfs_minfree; /* Anonymous memory in pages */
-/*
- * tmpfs can allocate only a certain percentage of kernel memory,
- * which is used for tmpnodes, directories, file names, etc.
- * This is statically set as TMPMAXFRACKMEM of physical memory.
- * The actual number of allocatable bytes can be patched in tmpfs_maxkmem.
- */
-#define TMPMAXFRACKMEM 25 /* 1/25 of physical memory */
-
-extern size_t tmp_kmemspace;
-extern size_t tmpfs_maxkmem; /* Allocatable kernel memory in bytes */
-
extern void tmpnode_init(struct tmount *, struct tmpnode *,
struct vattr *, struct cred *);
extern int tmpnode_trunc(struct tmount *, struct tmpnode *, ulong_t);
@@ -101,8 +100,6 @@ extern int tdirdelete(struct tmpnode *, struct tmpnode *, char *,
enum dr_op, struct cred *);
extern void tdirinit(struct tmpnode *, struct tmpnode *);
extern void tdirtrunc(struct tmpnode *);
-extern void *tmp_memalloc(size_t, int);
-extern void tmp_memfree(void *, size_t);
extern int tmp_resv(struct tmount *, struct tmpnode *, size_t, int);
extern int tmp_taccess(void *, int, struct cred *);
extern int tmp_sticky_remove_access(struct tmpnode *, struct tmpnode *,
diff --git a/usr/src/uts/common/sys/fss.h b/usr/src/uts/common/sys/fss.h
index 583586fd75..03c35277d4 100644
--- a/usr/src/uts/common/sys/fss.h
+++ b/usr/src/uts/common/sys/fss.h
@@ -22,6 +22,7 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_FSS_H
@@ -86,6 +87,7 @@ typedef struct fsspset {
/* on the list */
struct fssproj *fssps_list; /* list of project parts */
struct fsszone *fssps_zones; /* list of fsszone_t's in pset */
+ uint32_t fssps_gen; /* generation for zone's kstats */
} fsspset_t;
/*
@@ -101,7 +103,10 @@ typedef struct fssproj {
/* protected by fssps_lock */
uint32_t fssp_shares; /* copy of our kpj_shares */
/* protected by fssps_displock */
- uint32_t fssp_ticks; /* total of all ticks */
+ uint32_t fssp_ticks; /* total of nice tick values */
+ /* protected by fssps_displock */
+ uint32_t fssp_tick_cnt; /* cnt of all ticks in this sec */
+ uint32_t fssp_shr_pct; /* active shr % in this sec */
/* protected by fssps_displock */
fssusage_t fssp_usage; /* this project's decayed usage */
fssusage_t fssp_shusage; /* normalized usage */
diff --git a/usr/src/uts/common/sys/ipd.h b/usr/src/uts/common/sys/ipd.h
new file mode 100644
index 0000000000..901e74f44c
--- /dev/null
+++ b/usr/src/uts/common/sys/ipd.h
@@ -0,0 +1,81 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * These definitions are private to ipd and ipdadm.
+ */
+
+#ifndef _SYS_IPD_H
+#define _SYS_IPD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IPD_DEV_PATH "/dev/ipd"
+#define IPD_MAX_DELAY 1000000 /* 1s in us */
+
+typedef struct ipd_ioc_perturb {
+ zoneid_t ipip_zoneid;
+ uint32_t ipip_arg;
+} ipd_ioc_perturb_t;
+
+typedef struct ipd_ioc_info {
+ zoneid_t ipii_zoneid;
+ uint32_t ipii_corrupt;
+ uint32_t ipii_drop;
+ uint32_t ipii_delay;
+} ipd_ioc_info_t;
+
+#ifdef _KERNEL
+
+typedef struct ipd_ioc_list32 {
+ uint_t ipil_nzones;
+ caddr32_t ipil_info;
+} ipd_ioc_list32_t;
+
+#endif /* _KERNEL */
+
+typedef struct ipd_ioc_list {
+ uint_t ipil_nzones;
+ ipd_ioc_info_t *ipil_info;
+} ipd_ioc_list_t;
+
+#define IPD_CORRUPT 0x1
+#define IPD_DELAY 0x2
+#define IPD_DROP 0x4
+
+#define IPDIOC (('i' << 24) | ('p' << 16) | ('d' << 8))
+#define IPDIOC_CORRUPT (IPDIOC | 1) /* disable ipd */
+#define IPDIOC_DELAY (IPDIOC | 2) /* disable ipd */
+#define IPDIOC_DROP (IPDIOC | 3) /* disable ipd */
+#define IPDIOC_LIST (IPDIOC | 4) /* enable ipd */
+#define IPDIOC_REMOVE (IPDIOC | 5) /* disable ipd */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_IPD_H */
diff --git a/usr/src/uts/common/sys/mac.h b/usr/src/uts/common/sys/mac.h
index 6876fccb1a..220446af65 100644
--- a/usr/src/uts/common/sys/mac.h
+++ b/usr/src/uts/common/sys/mac.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_MAC_H
@@ -205,6 +206,7 @@ typedef enum {
MAC_PROP_MAX_RXHWCLNT_AVAIL,
MAC_PROP_MAX_TXHWCLNT_AVAIL,
MAC_PROP_IB_LINKMODE,
+ MAC_PROP_VN_PROMISC_FILTERED,
MAC_PROP_PRIVATE = -1
} mac_prop_id_t;
diff --git a/usr/src/uts/common/sys/mac_client_impl.h b/usr/src/uts/common/sys/mac_client_impl.h
index ae25df6a0d..ec49527300 100644
--- a/usr/src/uts/common/sys/mac_client_impl.h
+++ b/usr/src/uts/common/sys/mac_client_impl.h
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_MAC_CLIENT_IMPL_H
@@ -302,6 +303,7 @@ extern int mac_tx_percpu_cnt;
/* Mac protection flags */
#define MPT_FLAG_V6_LOCAL_ADDR_SET 0x0001
+#define MPT_FLAG_PROMISC_FILTERED 0x0002
/* in mac_client.c */
extern void mac_promisc_client_dispatch(mac_client_impl_t *, mblk_t *);
diff --git a/usr/src/uts/common/sys/mac_impl.h b/usr/src/uts/common/sys/mac_impl.h
index 8f9f23ff71..2eef66113d 100644
--- a/usr/src/uts/common/sys/mac_impl.h
+++ b/usr/src/uts/common/sys/mac_impl.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_MAC_IMPL_H
@@ -885,6 +886,8 @@ extern void mac_protect_fini(mac_client_impl_t *);
extern int mac_set_resources(mac_handle_t, mac_resource_props_t *);
extern void mac_get_resources(mac_handle_t, mac_resource_props_t *);
extern void mac_get_effective_resources(mac_handle_t, mac_resource_props_t *);
+extern void mac_set_promisc_filtered(mac_client_handle_t, boolean_t);
+extern boolean_t mac_get_promisc_filtered(mac_client_handle_t);
extern cpupart_t *mac_pset_find(mac_resource_props_t *, boolean_t *);
extern void mac_set_pool_effective(boolean_t, cpupart_t *,
diff --git a/usr/src/uts/common/sys/mman.h b/usr/src/uts/common/sys/mman.h
index 6c9119e56d..82344607b0 100644
--- a/usr/src/uts/common/sys/mman.h
+++ b/usr/src/uts/common/sys/mman.h
@@ -22,6 +22,7 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -353,6 +354,7 @@ struct memcntl_mha32 {
#define MS_SYNC 0x4 /* wait for msync */
#define MS_ASYNC 0x1 /* return immediately */
#define MS_INVALIDATE 0x2 /* invalidate caches */
+#define MS_INVALCURPROC 0x8 /* invalidate cache for curproc only */
#if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) || defined(__EXTENSIONS__)
/* functions to mctl */
diff --git a/usr/src/uts/common/sys/mntent.h b/usr/src/uts/common/sys/mntent.h
index e95ef3fccc..d215d88790 100644
--- a/usr/src/uts/common/sys/mntent.h
+++ b/usr/src/uts/common/sys/mntent.h
@@ -21,6 +21,7 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012, Joyent, Inc. All rights reserved.
*
* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
* All Rights Reserved
@@ -47,6 +48,7 @@ extern "C" {
#define MNTTYPE_PCFS "pcfs" /* PC (MSDOS) file system */
#define MNTTYPE_PC MNTTYPE_PCFS /* Deprecated name; use MNTTYPE_PCFS */
#define MNTTYPE_LOFS "lofs" /* Loop back file system */
+#define MNTTYPE_HYPRLOFS "hyprlofs" /* Hyperlofs file system */
#define MNTTYPE_LO MNTTYPE_LOFS /* Deprecated name; use MNTTYPE_LOFS */
#define MNTTYPE_HSFS "hsfs" /* High Sierra (9660) file system */
#define MNTTYPE_SWAP "swap" /* Swap file system */
diff --git a/usr/src/uts/common/sys/policy.h b/usr/src/uts/common/sys/policy.h
index bcd5ba2b4c..819c788b9e 100644
--- a/usr/src/uts/common/sys/policy.h
+++ b/usr/src/uts/common/sys/policy.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_POLICY_H
@@ -171,6 +172,7 @@ int secpolicy_setid_setsticky_clear(vnode_t *, vattr_t *,
const vattr_t *, cred_t *);
int secpolicy_xvattr(xvattr_t *, uid_t, cred_t *, vtype_t);
int secpolicy_xvm_control(const cred_t *);
+int secpolicy_hyprlofs_control(const cred_t *);
int secpolicy_basic_exec(const cred_t *, vnode_t *);
int secpolicy_basic_fork(const cred_t *);
diff --git a/usr/src/uts/common/sys/port.h b/usr/src/uts/common/sys/port.h
index ccb0308255..d4d74d55ea 100644
--- a/usr/src/uts/common/sys/port.h
+++ b/usr/src/uts/common/sys/port.h
@@ -24,11 +24,13 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#ifndef _SYS_PORT_H
#define _SYS_PORT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -106,6 +108,7 @@ typedef struct port_notify32 {
#define FILE_ACCESS 0x00000001
#define FILE_MODIFIED 0x00000002
#define FILE_ATTRIB 0x00000004
+#define FILE_TRUNC 0x00100000
#define FILE_NOFOLLOW 0x10000000
/*
diff --git a/usr/src/uts/common/sys/port_impl.h b/usr/src/uts/common/sys/port_impl.h
index 9f3f291874..504fb9ece1 100644
--- a/usr/src/uts/common/sys/port_impl.h
+++ b/usr/src/uts/common/sys/port_impl.h
@@ -24,6 +24,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#ifndef _SYS_PORT_IMPL_H
#define _SYS_PORT_IMPL_H
@@ -311,6 +315,7 @@ typedef struct portfop_vp {
#define FOP_FILE_SETATTR_MTIME 0x00080000
#define FOP_FILE_SETATTR_CTIME 0x00100000
#define FOP_FILE_LINK_SRC 0x00200000
+#define FOP_FILE_TRUNC 0x00400000
/*
* File modification event.
@@ -339,10 +344,15 @@ typedef struct portfop_vp {
/*
+ * File trunc event
+ */
+#define FOP_TRUNC_MASK (FOP_FILE_TRUNC|FOP_FILE_CREATE)
+
+/*
* valid watchable events
*/
#define FILE_EVENTS_MASK (FILE_ACCESS|FILE_MODIFIED|FILE_ATTRIB \
- |FILE_NOFOLLOW)
+ |FILE_NOFOLLOW|FILE_TRUNC)
/* --- End file events --- */
/*
diff --git a/usr/src/uts/common/sys/procfs.h b/usr/src/uts/common/sys/procfs.h
index 0c4a48fcdd..f592fd9dcf 100644
--- a/usr/src/uts/common/sys/procfs.h
+++ b/usr/src/uts/common/sys/procfs.h
@@ -65,10 +65,6 @@ extern "C" {
#include <sys/stat.h>
#include <sys/param.h>
-#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
-#error "Cannot use procfs in the large file compilation environment"
-#endif
-
/*
* System call interfaces for /proc.
*/
diff --git a/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_ioctl.h b/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_ioctl.h
index 157c9fb064..5586b490f6 100644
--- a/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_ioctl.h
+++ b/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_ioctl.h
@@ -23,6 +23,9 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* Copyright (c) 2000 to 2010, LSI Corporation.
@@ -71,6 +74,8 @@ extern "C" {
#define MPTIOCTL_GET_PCI_INFO (MPTIOCTL | 8)
#define MPTIOCTL_DIAG_ACTION (MPTIOCTL | 9)
#define MPTIOCTL_REG_ACCESS (MPTIOCTL | 10)
+#define MPTIOCTL_GET_DISK_INFO (MPTIOCTL | 11)
+#define MPTIOCTL_LED_CONTROL (MPTIOCTL | 12)
/*
* The following are our ioctl() return status values. If everything went
@@ -296,6 +301,58 @@ typedef struct mptsas_reg_access
uint32_t RegData;
} mptsas_reg_access_t;
+/*
+ * Disk Toplogy Information
+ */
+typedef struct mptsas_disk_info
+{
+ uint64_t SasAddress;
+ uint16_t Instance;
+ uint16_t Enclosure;
+ uint16_t Slot;
+} mptsas_disk_info_t;
+
+typedef struct mptsas_get_disk_info
+{
+ uint16_t DiskCount;
+ mptsas_disk_info_t *PtrDiskInfoArray;
+ uint64_t DiskInfoArraySize;
+} mptsas_get_disk_info_t;
+
+#ifdef _KERNEL
+
+typedef struct mptsas_get_disk_info32
+{
+ uint16_t DiskCount;
+ caddr32_t PtrDiskInfoArray;
+ uint64_t DiskInfoArraySize;
+} mptsas_get_disk_info32_t;
+
+#endif /* _KERNEL */
+
+/*
+ * LED Control
+ */
+
+typedef struct mptsas_led_control
+{
+ uint8_t Command;
+ uint16_t Enclosure;
+ uint16_t Slot;
+ uint8_t Led;
+ uint8_t LedStatus;
+} mptsas_led_control_t;
+
+#define MPTSAS_LEDCTL_FLAG_SET 1
+#define MPTSAS_LEDCTL_FLAG_GET 2
+
+#define MPTSAS_LEDCTL_LED_IDENT 1
+#define MPTSAS_LEDCTL_LED_FAIL 2
+#define MPTSAS_LEDCTL_LED_OK2RM 3
+
+#define MPTSAS_LEDCTL_LED_MIN MPTSAS_LEDCTL_LED_IDENT
+#define MPTSAS_LEDCTL_LED_MAX MPTSAS_LEDCTL_LED_OK2RM
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_var.h b/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_var.h
index c757299b32..ec7095e590 100644
--- a/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_var.h
+++ b/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_var.h
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/*
@@ -208,6 +209,7 @@ typedef struct mptsas_target {
uint16_t m_enclosure;
uint16_t m_slot_num;
uint32_t m_tgt_unconfigured;
+ uint8_t m_led_status;
/*
* For the common case, the elements in this structure are
diff --git a/usr/src/uts/common/sys/sdt_impl.h b/usr/src/uts/common/sys/sdt_impl.h
index cbe95f7c66..f7cc683f2f 100644
--- a/usr/src/uts/common/sys/sdt_impl.h
+++ b/usr/src/uts/common/sys/sdt_impl.h
@@ -24,11 +24,13 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
#ifndef _SYS_SDT_IMPL_H
#define _SYS_SDT_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -45,6 +47,7 @@ typedef struct sdt_provider {
char *sdtp_name; /* name of provider */
char *sdtp_prefix; /* prefix for probe names */
dtrace_pattr_t *sdtp_attr; /* stability attributes */
+ uint32_t sdtp_priv; /* privilege, if any */
dtrace_provider_id_t sdtp_id; /* provider ID */
} sdt_provider_t;
@@ -75,6 +78,7 @@ typedef struct sdt_argdesc {
} sdt_argdesc_t;
extern void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *);
+extern int sdt_mode(void *, dtrace_id_t, void *);
#ifdef __cplusplus
}
diff --git a/usr/src/uts/common/sys/sunldi_impl.h b/usr/src/uts/common/sys/sunldi_impl.h
index 1156fe2c41..e9fdb431bf 100644
--- a/usr/src/uts/common/sys/sunldi_impl.h
+++ b/usr/src/uts/common/sys/sunldi_impl.h
@@ -22,12 +22,13 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
#ifndef _SYS_SUNLDI_IMPL_H
#define _SYS_SUNLDI_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -141,12 +142,29 @@ typedef struct ldi_ev_callback_impl {
list_node_t lec_list;
} ldi_ev_callback_impl_t;
+/*
+ * Members of "struct ldi_ev_callback_list" are protected by their le_lock
+ * member. The struct is currently only used once, as a file-level global,
+ * and the locking protocol is currently implemented in ldi_ev_lock() and
+ * ldi_ev_unlock().
+ *
+ * When delivering events to subscribers, ldi_invoke_notify() and
+ * ldi_invoke_finalize() will walk the list of callbacks: le_head. It is
+ * possible that an invoked callback function will need to unregister an
+ * arbitrary number of callbacks from this list.
+ *
+ * To enable ldi_ev_remove_callbacks() to remove elements from the list
+ * without breaking the walk-in-progress, we store the next element in the
+ * walk direction on the struct as le_walker_next and le_walker_prev.
+ */
struct ldi_ev_callback_list {
- kmutex_t le_lock;
- kcondvar_t le_cv;
- int le_busy;
- void *le_thread;
- list_t le_head;
+ kmutex_t le_lock;
+ kcondvar_t le_cv;
+ int le_busy;
+ void *le_thread;
+ list_t le_head;
+ ldi_ev_callback_impl_t *le_walker_next;
+ ldi_ev_callback_impl_t *le_walker_prev;
};
int ldi_invoke_notify(dev_info_t *dip, dev_t dev, int spec_type, char *event,
diff --git a/usr/src/uts/common/sys/thread.h b/usr/src/uts/common/sys/thread.h
index 188230d61e..c7f460e7c7 100644
--- a/usr/src/uts/common/sys/thread.h
+++ b/usr/src/uts/common/sys/thread.h
@@ -68,6 +68,8 @@ typedef struct ctxop {
void (*free_op)(void *, int); /* function which frees the context */
void *arg; /* argument to above functions, ctx pointer */
struct ctxop *next; /* next context ops */
+ hrtime_t save_ts; /* timestamp of last save */
+ hrtime_t restore_ts; /* timestamp of last restore */
} ctxop_t;
/*
diff --git a/usr/src/uts/common/sys/uadmin.h b/usr/src/uts/common/sys/uadmin.h
index c35d0a5cfb..6adeb477bb 100644
--- a/usr/src/uts/common/sys/uadmin.h
+++ b/usr/src/uts/common/sys/uadmin.h
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -157,7 +158,7 @@ extern kmutex_t ualock;
extern void mdboot(int, int, char *, boolean_t);
extern void mdpreboot(int, int, char *);
extern int kadmin(int, int, void *, cred_t *);
-extern void killall(zoneid_t);
+extern void killall(zoneid_t, boolean_t);
#endif
#if defined(__STDC__)
diff --git a/usr/src/uts/common/sys/vm_usage.h b/usr/src/uts/common/sys/vm_usage.h
index 1aa4a8ee6d..97e3430ae2 100644
--- a/usr/src/uts/common/sys/vm_usage.h
+++ b/usr/src/uts/common/sys/vm_usage.h
@@ -21,6 +21,7 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_VM_USAGE_H
@@ -79,8 +80,9 @@ extern "C" {
/* zoneid */
#define VMUSAGE_COL_EUSERS 0x2000 /* same as VMUSAGE_COL_RUSERS, but by */
/* euser */
+#define VMUSAGE_A_ZONE 0x4000 /* rss/swap for a specified zone */
-#define VMUSAGE_MASK 0x3fff /* all valid flags for getvmusage() */
+#define VMUSAGE_MASK 0x7fff /* all valid flags for getvmusage() */
typedef struct vmusage {
id_t vmu_zoneid; /* zoneid, or ALL_ZONES for */
diff --git a/usr/src/uts/common/sys/zone.h b/usr/src/uts/common/sys/zone.h
index 3ba7bf47f4..a44930c853 100644
--- a/usr/src/uts/common/sys/zone.h
+++ b/usr/src/uts/common/sys/zone.h
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_ZONE_H
@@ -94,12 +95,17 @@ extern "C" {
#define ZONE_ATTR_INITNAME 9
#define ZONE_ATTR_BOOTARGS 10
#define ZONE_ATTR_BRAND 11
-#define ZONE_ATTR_PHYS_MCAP 12
+#define ZONE_ATTR_PMCAP_NOVER 12
#define ZONE_ATTR_SCHED_CLASS 13
#define ZONE_ATTR_FLAGS 14
#define ZONE_ATTR_HOSTID 15
#define ZONE_ATTR_FS_ALLOWED 16
#define ZONE_ATTR_NETWORK 17
+#define ZONE_ATTR_DID 18
+#define ZONE_ATTR_PMCAP_PAGEOUT 19
+#define ZONE_ATTR_INITNORESTART 20
+#define ZONE_ATTR_PG_FLT_DELAY 21
+#define ZONE_ATTR_RSS 22
/* Start of the brand-specific attribute namespace */
#define ZONE_ATTR_BRAND_ATTRS 32768
@@ -180,6 +186,7 @@ typedef struct {
uint32_t doi; /* DOI for label */
caddr32_t label; /* label associated with zone */
int flags;
+ zoneid_t zoneid; /* requested zoneid */
} zone_def32;
#endif
typedef struct {
@@ -196,6 +203,7 @@ typedef struct {
uint32_t doi; /* DOI for label */
const bslabel_t *label; /* label associated with zone */
int flags;
+ zoneid_t zoneid; /* requested zoneid */
} zone_def;
/* extended error information */
@@ -240,7 +248,7 @@ typedef enum zone_cmd {
typedef struct zone_cmd_arg {
uint64_t uniqid; /* unique "generation number" */
zone_cmd_t cmd; /* requested action */
- uint32_t _pad; /* need consistent 32/64 bit alignmt */
+ uint32_t debug; /* enable brand hook debug */
char locale[MAXPATHLEN]; /* locale in which to render messages */
char bootbuf[BOOTARGS_MAX]; /* arguments passed to zone_boot() */
} zone_cmd_arg_t;
@@ -320,6 +328,7 @@ typedef struct zone_net_data {
* libraries which may be defining ther own versions.
*/
#include <sys/list.h>
+#include <sys/cpuvar.h>
#define GLOBAL_ZONEUNIQID 0 /* uniqid of the global zone */
@@ -367,7 +376,7 @@ typedef struct zone_dataset {
} zone_dataset_t;
/*
- * structure for zone kstats
+ * structure for rctl zone kstats
*/
typedef struct zone_kstat {
kstat_named_t zk_zonename;
@@ -377,6 +386,73 @@ typedef struct zone_kstat {
struct cpucap;
+typedef struct {
+ hrtime_t cycle_start;
+ uint_t cycle_cnt;
+ hrtime_t zone_avg_cnt;
+} sys_zio_cntr_t;
+
+typedef struct {
+ kstat_named_t zv_zonename;
+ kstat_named_t zv_nread;
+ kstat_named_t zv_reads;
+ kstat_named_t zv_rtime;
+ kstat_named_t zv_rlentime;
+ kstat_named_t zv_nwritten;
+ kstat_named_t zv_writes;
+ kstat_named_t zv_wtime;
+ kstat_named_t zv_wlentime;
+ kstat_named_t zv_10ms_ops;
+ kstat_named_t zv_100ms_ops;
+ kstat_named_t zv_1s_ops;
+ kstat_named_t zv_10s_ops;
+ kstat_named_t zv_delay_cnt;
+ kstat_named_t zv_delay_time;
+} zone_vfs_kstat_t;
+
+typedef struct {
+ kstat_named_t zz_zonename;
+ kstat_named_t zz_nread;
+ kstat_named_t zz_reads;
+ kstat_named_t zz_rtime;
+ kstat_named_t zz_rlentime;
+ kstat_named_t zz_nwritten;
+ kstat_named_t zz_writes;
+ kstat_named_t zz_waittime;
+} zone_zfs_kstat_t;
+
+typedef struct {
+ kstat_named_t zm_zonename;
+ kstat_named_t zm_rss;
+ kstat_named_t zm_phys_cap;
+ kstat_named_t zm_swap;
+ kstat_named_t zm_swap_cap;
+ kstat_named_t zm_nover;
+ kstat_named_t zm_pagedout;
+ kstat_named_t zm_pgpgin;
+ kstat_named_t zm_anonpgin;
+ kstat_named_t zm_execpgin;
+ kstat_named_t zm_fspgin;
+ kstat_named_t zm_anon_alloc_fail;
+ kstat_named_t zm_pf_throttle;
+ kstat_named_t zm_pf_throttle_usec;
+} zone_mcap_kstat_t;
+
+typedef struct {
+ kstat_named_t zm_zonename; /* full name, kstat truncates name */
+ kstat_named_t zm_utime;
+ kstat_named_t zm_stime;
+ kstat_named_t zm_wtime;
+ kstat_named_t zm_avenrun1;
+ kstat_named_t zm_avenrun5;
+ kstat_named_t zm_avenrun15;
+ kstat_named_t zm_run_ticks;
+ kstat_named_t zm_run_wait;
+ kstat_named_t zm_fss_shr_pct;
+ kstat_named_t zm_fss_pri_hi;
+ kstat_named_t zm_fss_pri_avg;
+} zone_misc_kstat_t;
+
typedef struct zone {
/*
* zone_name is never modified once set.
@@ -416,6 +492,7 @@ typedef struct zone {
*/
list_node_t zone_linkage;
zoneid_t zone_id; /* ID of zone */
+ zoneid_t zone_did; /* persistent debug ID of zone */
uint_t zone_ref; /* count of zone_hold()s on zone */
uint_t zone_cred_ref; /* count of zone_hold_cred()s on zone */
/*
@@ -471,7 +548,7 @@ typedef struct zone {
char *zone_initname; /* fs path to 'init' */
int zone_boot_err; /* for zone_boot() if boot fails */
char *zone_bootargs; /* arguments passed via zone_boot() */
- uint64_t zone_phys_mcap; /* physical memory cap */
+ rctl_qty_t zone_phys_mem_ctl; /* current phys. memory limit */
/*
* zone_kthreads is protected by zone_status_lock.
*/
@@ -490,6 +567,9 @@ typedef struct zone {
hrtime_t zone_pool_mod; /* last pool bind modification time */
/* zone_psetid is protected by cpu_lock */
psetid_t zone_psetid; /* pset the zone is bound to */
+
+ time_t zone_boot_time; /* Similar to boot_time */
+
/*
* The following two can be read without holding any locks. They are
* updated under cpu_lock.
@@ -517,6 +597,37 @@ typedef struct zone {
list_t zone_dl_list;
netstack_t *zone_netstack;
struct cpucap *zone_cpucap; /* CPU caps data */
+
+ /*
+ * Data and counters used for ZFS fair-share disk IO.
+ */
+ rctl_qty_t zone_zfs_io_pri; /* ZFS IO priority */
+ uint_t zone_zfs_queued; /* enqueued count */
+ uint64_t zone_zfs_weight; /* used to prevent starvation */
+ uint64_t zone_io_util; /* IO utilization metric */
+ boolean_t zone_io_util_above_avg; /* IO util percent > avg. */
+ uint16_t zone_io_delay; /* IO delay on logical r/w */
+ kmutex_t zone_stg_io_lock; /* protects IO window data */
+ sys_zio_cntr_t zone_rd_ops; /* Counters for ZFS reads, */
+ sys_zio_cntr_t zone_wr_ops; /* writes and logical writes. */
+ sys_zio_cntr_t zone_lwr_ops;
+
+ /*
+ * kstats and counters for VFS ops and bytes.
+ */
+ kmutex_t zone_vfs_lock; /* protects VFS statistics */
+ kstat_t *zone_vfs_ksp;
+ kstat_io_t zone_vfs_rwstats;
+ zone_vfs_kstat_t *zone_vfs_stats;
+
+ /*
+ * kstats for ZFS I/O ops and bytes.
+ */
+ kmutex_t zone_zfs_lock; /* protects ZFS statistics */
+ kstat_t *zone_zfs_ksp;
+ kstat_io_t zone_zfs_rwstats;
+ zone_zfs_kstat_t *zone_zfs_stats;
+
/*
* Solaris Auditing per-zone audit context
*/
@@ -534,6 +645,69 @@ typedef struct zone {
rctl_qty_t zone_nprocs_ctl; /* current limit protected by */
/* zone_rctls->rcs_lock */
kstat_t *zone_nprocs_kstat;
+
+ /*
+ * kstats and counters for physical memory capping.
+ */
+ rctl_qty_t zone_phys_mem; /* current bytes of phys. mem. (RSS) */
+ kstat_t *zone_physmem_kstat;
+ uint64_t zone_mcap_nover; /* # of times over phys. cap */
+ uint64_t zone_mcap_pagedout; /* bytes of mem. paged out */
+ kmutex_t zone_mcap_lock; /* protects mcap statistics */
+ kstat_t *zone_mcap_ksp;
+ zone_mcap_kstat_t *zone_mcap_stats;
+ uint64_t zone_pgpgin; /* pages paged in */
+ uint64_t zone_anonpgin; /* anon pages paged in */
+ uint64_t zone_execpgin; /* exec pages paged in */
+ uint64_t zone_fspgin; /* fs pages paged in */
+ uint64_t zone_anon_alloc_fail; /* cnt of anon alloc fails */
+ uint64_t zone_pf_throttle; /* cnt of page flt throttles */
+ uint64_t zone_pf_throttle_usec; /* time of page flt throttles */
+
+ /* Num usecs to throttle page fault when zone is over phys. mem cap */
+ uint32_t zone_pg_flt_delay;
+
+ /*
+ * Misc. kstats and counters for zone cpu-usage aggregation.
+ * The zone_Xtime values are the sum of the micro-state accounting
+ * values for all threads that are running or have run in the zone.
+ * This is tracked in msacct.c as threads change state.
+ * The zone_stime is the sum of the LMS_SYSTEM times.
+ * The zone_utime is the sum of the LMS_USER times.
+ * The zone_wtime is the sum of the LMS_WAIT_CPU times.
+ * As with per-thread micro-state accounting values, these values are
+ * not scaled to nanosecs. The scaling is done by the
+ * zone_misc_kstat_update function when kstats are requested.
+ */
+ kmutex_t zone_misc_lock; /* protects misc statistics */
+ kstat_t *zone_misc_ksp;
+ zone_misc_kstat_t *zone_misc_stats;
+ uint64_t zone_stime; /* total system time */
+ uint64_t zone_utime; /* total user time */
+ uint64_t zone_wtime; /* total time waiting in runq */
+
+ struct loadavg_s zone_loadavg; /* loadavg for this zone */
+ uint64_t zone_hp_avenrun[3]; /* high-precision avenrun */
+ int zone_avenrun[3]; /* FSCALED avg. run queue len */
+
+ /*
+ * FSS stats updated once per second by fss_decay_usage.
+ */
+ uint32_t zone_fss_gen; /* FSS generation cntr */
+ uint64_t zone_run_ticks; /* tot # of ticks running */
+
+ /*
+ * DTrace-private per-zone state
+ */
+ int zone_dtrace_getf; /* # of unprivileged getf()s */
+
+ /*
+ * Synchronization primitives used to synchronize between mounts and
+ * zone creation/destruction.
+ */
+ int zone_mounts_in_progress;
+ kcondvar_t zone_mount_cv;
+ kmutex_t zone_mount_lock;
} zone_t;
/*
@@ -566,9 +740,11 @@ extern zone_t *zone_find_by_name(char *);
extern zone_t *zone_find_by_any_path(const char *, boolean_t);
extern zone_t *zone_find_by_path(const char *);
extern zoneid_t getzoneid(void);
+extern zoneid_t getzonedid(void);
extern zone_t *zone_find_by_id_nolock(zoneid_t);
extern int zone_datalink_walk(zoneid_t, int (*)(datalink_id_t, void *), void *);
extern int zone_check_datalink(zoneid_t *, datalink_id_t);
+extern void zone_loadavg_update();
/*
* Zone-specific data (ZSD) APIs
@@ -752,13 +928,14 @@ extern int zone_dataset_visible(const char *, int *);
extern int zone_kadmin(int, int, const char *, cred_t *);
extern void zone_shutdown_global(void);
-extern void mount_in_progress(void);
-extern void mount_completed(void);
+extern void mount_in_progress(zone_t *);
+extern void mount_completed(zone_t *);
extern int zone_walk(int (*)(zone_t *, void *), void *);
extern rctl_hndl_t rc_zone_locked_mem;
extern rctl_hndl_t rc_zone_max_swap;
+extern rctl_hndl_t rc_zone_phys_mem;
extern rctl_hndl_t rc_zone_max_lofi;
#endif /* _KERNEL */
diff --git a/usr/src/uts/common/syscall/getloadavg.c b/usr/src/uts/common/syscall/getloadavg.c
index c669f9b8ba..0f44064e90 100644
--- a/usr/src/uts/common/syscall/getloadavg.c
+++ b/usr/src/uts/common/syscall/getloadavg.c
@@ -22,10 +22,9 @@
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/errno.h>
@@ -41,7 +40,6 @@ int
getloadavg(int *buf, int nelem)
{
int *loadbuf = &avenrun[0];
- int loadavg[LOADAVG_NSTATS];
int error;
if (nelem < 0)
@@ -50,15 +48,7 @@ getloadavg(int *buf, int nelem)
nelem = LOADAVG_NSTATS;
if (!INGLOBALZONE(curproc)) {
- mutex_enter(&cpu_lock);
- if (pool_pset_enabled()) {
- psetid_t psetid = zone_pset_get(curproc->p_zone);
-
- error = cpupart_get_loadavg(psetid, &loadavg[0], nelem);
- ASSERT(error == 0); /* pset isn't going anywhere */
- loadbuf = &loadavg[0];
- }
- mutex_exit(&cpu_lock);
+ loadbuf = &curproc->p_zone->zone_avenrun[0];
}
error = copyout(loadbuf, buf, nelem * sizeof (avenrun[0]));
diff --git a/usr/src/uts/common/syscall/memcntl.c b/usr/src/uts/common/syscall/memcntl.c
index 1ab3a8b65e..63c8b64ad0 100644
--- a/usr/src/uts/common/syscall/memcntl.c
+++ b/usr/src/uts/common/syscall/memcntl.c
@@ -21,6 +21,7 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -116,13 +117,17 @@ memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask)
* MS_SYNC used to be defined to be zero but is now non-zero.
* For binary compatibility we still accept zero
* (the absence of MS_ASYNC) to mean the same thing.
+ * Binary compatibility is not an issue for MS_INVALCURPROC.
*/
iarg = (uintptr_t)arg;
if ((iarg & ~MS_INVALIDATE) == 0)
iarg |= MS_SYNC;
- if (((iarg & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) != 0) ||
- ((iarg & (MS_SYNC|MS_ASYNC)) == (MS_SYNC|MS_ASYNC))) {
+ if (((iarg &
+ ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE|MS_INVALCURPROC)) != 0) ||
+ ((iarg & (MS_SYNC|MS_ASYNC)) == (MS_SYNC|MS_ASYNC)) ||
+ ((iarg & (MS_INVALIDATE|MS_INVALCURPROC)) ==
+ (MS_INVALIDATE|MS_INVALCURPROC))) {
error = set_errno(EINVAL);
} else {
error = as_ctl(as, addr, len, cmd, attr, iarg, NULL, 0);
diff --git a/usr/src/uts/common/syscall/sysconfig.c b/usr/src/uts/common/syscall/sysconfig.c
index 471c66ff32..e68f640045 100644
--- a/usr/src/uts/common/syscall/sysconfig.c
+++ b/usr/src/uts/common/syscall/sysconfig.c
@@ -22,6 +22,7 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -158,8 +159,8 @@ sysconfig(int which)
* even though rcapd can be used on the global zone too.
*/
if (!INGLOBALZONE(curproc) &&
- curproc->p_zone->zone_phys_mcap != 0)
- return (MIN(btop(curproc->p_zone->zone_phys_mcap),
+ curproc->p_zone->zone_phys_mem_ctl != UINT64_MAX)
+ return (MIN(btop(curproc->p_zone->zone_phys_mem_ctl),
physinstalled));
return (physinstalled);
@@ -167,26 +168,23 @@ sysconfig(int which)
case _CONFIG_AVPHYS_PAGES:
/*
* If the non-global zone has a phys. memory cap, use
- * the phys. memory cap - zone's current rss. We always
+ * the phys. memory cap - zone's rss. We always
* report the system-wide value for the global zone, even
- * though rcapd can be used on the global zone too.
+ * though memory capping can be used on the global zone too.
+ * We use the cached value for the RSS since vm_getusage()
+ * is so expensive and we don't need this value to be exact.
*/
if (!INGLOBALZONE(curproc) &&
- curproc->p_zone->zone_phys_mcap != 0) {
+ curproc->p_zone->zone_phys_mem_ctl != UINT64_MAX) {
pgcnt_t cap, rss, free;
- vmusage_t in_use;
- size_t cnt = 1;
- cap = btop(curproc->p_zone->zone_phys_mcap);
+ cap = btop(curproc->p_zone->zone_phys_mem_ctl);
if (cap > physinstalled)
return (freemem);
- if (vm_getusage(VMUSAGE_ZONE, 1, &in_use, &cnt,
- FKIOCTL) != 0)
- in_use.vmu_rss_all = 0;
- rss = btop(in_use.vmu_rss_all);
+ rss = btop(curproc->p_zone->zone_phys_mem);
/*
- * Because rcapd implements a soft cap, it is possible
+ * Because this is a soft cap, it is possible
* for rss to be temporarily over the cap.
*/
if (cap > rss)
diff --git a/usr/src/uts/common/syscall/tasksys.c b/usr/src/uts/common/syscall/tasksys.c
index bbaaba9f5d..c3aa187d08 100644
--- a/usr/src/uts/common/syscall/tasksys.c
+++ b/usr/src/uts/common/syscall/tasksys.c
@@ -22,6 +22,9 @@
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
/*
* System calls for creating and inquiring about tasks and projects
@@ -146,6 +149,7 @@ tasksys_settaskid(projid_t projid, uint_t flags)
if (curthread != p->p_agenttp)
continuelwps(p);
mutex_exit(&p->p_lock);
+ project_rele(kpj);
return (set_errno(EAGAIN));
}
kpj->kpj_data.kpd_crypto_mem += p->p_crypto_mem;
diff --git a/usr/src/uts/common/syscall/uadmin.c b/usr/src/uts/common/syscall/uadmin.c
index 1bdfbbfd0b..dbff1b637c 100644
--- a/usr/src/uts/common/syscall/uadmin.c
+++ b/usr/src/uts/common/syscall/uadmin.c
@@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2011 Joyent, Inc. All rights reserved.
*/
#include <sys/param.h>
@@ -76,7 +77,7 @@ volatile int fastreboot_dryrun = 0;
* system with many zones.
*/
void
-killall(zoneid_t zoneid)
+killall(zoneid_t zoneid, boolean_t force)
{
proc_t *p;
@@ -106,7 +107,7 @@ killall(zoneid_t zoneid)
p->p_stat != SIDL &&
p->p_stat != SZOMB) {
mutex_enter(&p->p_lock);
- if (sigismember(&p->p_sig, SIGKILL)) {
+ if (!force && sigismember(&p->p_sig, SIGKILL)) {
mutex_exit(&p->p_lock);
p = p->p_next;
} else {
@@ -243,7 +244,7 @@ kadmin(int cmd, int fcn, void *mdep, cred_t *credp)
*/
zone_shutdown_global();
- killall(ALL_ZONES);
+ killall(ALL_ZONES, B_FALSE);
/*
* If we are calling kadmin() from a kernel context then we
* do not release these resources.
diff --git a/usr/src/uts/common/vm/hat.h b/usr/src/uts/common/vm/hat.h
index 1d91475e38..156b810046 100644
--- a/usr/src/uts/common/vm/hat.h
+++ b/usr/src/uts/common/vm/hat.h
@@ -21,6 +21,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -460,6 +461,7 @@ void hat_setstat(struct as *, caddr_t, size_t, uint_t);
*/
#define HAT_ADV_PGUNLOAD 0x00
#define HAT_FORCE_PGUNLOAD 0x01
+#define HAT_CURPROC_PGUNLOAD 0x02
/*
* Attributes for hat_page_*attr, hat_setstats and
diff --git a/usr/src/uts/common/vm/seg_vn.c b/usr/src/uts/common/vm/seg_vn.c
index 31c293d416..5f106f6c06 100644
--- a/usr/src/uts/common/vm/seg_vn.c
+++ b/usr/src/uts/common/vm/seg_vn.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -7254,7 +7255,8 @@ segvn_sync(struct seg *seg, caddr_t addr, size_t len, int attr, uint_t flags)
vpp = svd->vpage;
offset = svd->offset + (uintptr_t)(addr - seg->s_base);
bflags = ((flags & MS_ASYNC) ? B_ASYNC : 0) |
- ((flags & MS_INVALIDATE) ? B_INVAL : 0);
+ ((flags & MS_INVALIDATE) ? B_INVAL : 0) |
+ ((flags & MS_INVALCURPROC) ? (B_INVALCURONLY | B_INVAL) : 0);
if (attr) {
pageprot = attr & ~(SHARED|PRIVATE);
@@ -7279,11 +7281,11 @@ segvn_sync(struct seg *seg, caddr_t addr, size_t len, int attr, uint_t flags)
vpp = &svd->vpage[seg_page(seg, addr)];
} else if (svd->vp && svd->amp == NULL &&
- (flags & MS_INVALIDATE) == 0) {
+ (flags & (MS_INVALIDATE | MS_INVALCURPROC)) == 0) {
/*
- * No attributes, no anonymous pages and MS_INVALIDATE flag
- * is not on, just use one big request.
+ * No attributes, no anonymous pages and MS_INVAL* flags
+ * are not on, just use one big request.
*/
err = VOP_PUTPAGE(svd->vp, (offset_t)offset, len,
bflags, svd->cred, NULL);
@@ -7335,7 +7337,7 @@ segvn_sync(struct seg *seg, caddr_t addr, size_t len, int attr, uint_t flags)
* might race in and lock the page after we unlock and before
* we do the PUTPAGE, then PUTPAGE simply does nothing.
*/
- if (flags & MS_INVALIDATE) {
+ if (flags & (MS_INVALIDATE | MS_INVALCURPROC)) {
if ((pp = page_lookup(vp, off, SE_SHARED)) != NULL) {
if (pp->p_lckcnt != 0 || pp->p_cowcnt != 0) {
page_unlock(pp);
diff --git a/usr/src/uts/common/vm/vm_anon.c b/usr/src/uts/common/vm/vm_anon.c
index fdf9f7790c..21ab9b237c 100644
--- a/usr/src/uts/common/vm/vm_anon.c
+++ b/usr/src/uts/common/vm/vm_anon.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -787,13 +788,21 @@ anon_resvmem(size_t size, boolean_t takemem, zone_t *zone, int tryhard)
pgcnt_t pswap_pages = 0;
proc_t *p = curproc;
- if (zone != NULL && takemem) {
+ if (zone != NULL) {
/* test zone.max-swap resource control */
mutex_enter(&p->p_lock);
if (rctl_incr_swap(p, zone, ptob(npages)) != 0) {
mutex_exit(&p->p_lock);
+
+ if (takemem)
+ atomic_add_64(&zone->zone_anon_alloc_fail, 1);
+
return (0);
}
+
+ if (!takemem)
+ rctl_decr_swap(zone, ptob(npages));
+
mutex_exit(&p->p_lock);
}
mutex_enter(&anoninfo_lock);
diff --git a/usr/src/uts/common/vm/vm_as.c b/usr/src/uts/common/vm/vm_as.c
index 01ad32e0b1..8caa257486 100644
--- a/usr/src/uts/common/vm/vm_as.c
+++ b/usr/src/uts/common/vm/vm_as.c
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -56,6 +57,7 @@
#include <sys/debug.h>
#include <sys/tnf_probe.h>
#include <sys/vtrace.h>
+#include <sys/ddi.h>
#include <vm/hat.h>
#include <vm/xhat.h>
@@ -879,6 +881,7 @@ as_fault(struct hat *hat, struct as *as, caddr_t addr, size_t size,
struct seg *segsav;
int as_lock_held;
klwp_t *lwp = ttolwp(curthread);
+ zone_t *zonep = curzone;
int is_xhat = 0;
int holding_wpage = 0;
extern struct seg_ops segdev_ops;
@@ -928,6 +931,23 @@ retry:
if (as == &kas)
CPU_STATS_ADDQ(CPU, vm, kernel_asflt, 1);
CPU_STATS_EXIT_K();
+ if (zonep->zone_pg_flt_delay != 0) {
+ /*
+ * The zone in which this process is running
+ * is currently over it's physical memory cap.
+ * Throttle page faults to help the user-land
+ * memory capper catch up. Note that
+ * drv_usectohz() rounds up.
+ */
+ atomic_add_64(&zonep->zone_pf_throttle, 1);
+ atomic_add_64(&zonep->zone_pf_throttle_usec,
+ zonep->zone_pg_flt_delay);
+ if (zonep->zone_pg_flt_delay < TICK_TO_USEC(1))
+ drv_usecwait(zonep->zone_pg_flt_delay);
+ else
+ delay(drv_usectohz(
+ zonep->zone_pg_flt_delay));
+ }
break;
}
}
diff --git a/usr/src/uts/common/vm/vm_pvn.c b/usr/src/uts/common/vm/vm_pvn.c
index 7233581227..39ace0b3c2 100644
--- a/usr/src/uts/common/vm/vm_pvn.c
+++ b/usr/src/uts/common/vm/vm_pvn.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -431,7 +432,14 @@ pvn_write_done(page_t *plist, int flags)
page_io_unlock(pp);
page_unlock(pp);
}
- } else if (flags & B_INVAL) {
+ } else if ((flags & (B_INVAL | B_INVALCURONLY)) == B_INVAL) {
+ /*
+ * If B_INVALCURONLY is set, then we handle that case
+ * in the next conditional if hat_page_is_mapped()
+ * indicates that there are no additional mappings
+ * to the page.
+ */
+
/*
* XXX - Failed writes with B_INVAL set are
* not handled appropriately.
@@ -572,8 +580,9 @@ pvn_write_done(page_t *plist, int flags)
}
/*
- * Flags are composed of {B_ASYNC, B_INVAL, B_FREE, B_DONTNEED, B_DELWRI,
- * B_TRUNC, B_FORCE}. B_DELWRI indicates that this page is part of a kluster
+ * Flags are composed of {B_ASYNC, B_INVAL, B_INVALCURONLY, B_FREE,
+ * B_DONTNEED, B_DELWRI, B_TRUNC, B_FORCE}.
+ * B_DELWRI indicates that this page is part of a kluster
* operation and is only to be considered if it doesn't involve any
* waiting here. B_TRUNC indicates that the file is being truncated
* and so no i/o needs to be done. B_FORCE indicates that the page
@@ -627,13 +636,17 @@ pvn_getdirty(page_t *pp, int flags)
* If we want to free or invalidate the page then
* we need to unload it so that anyone who wants
* it will have to take a minor fault to get it.
+ * If we are only invalidating the page for the
+ * current process, then pass in a different flag.
* Otherwise, we're just writing the page back so we
* need to sync up the hardwre and software mod bit to
* detect any future modifications. We clear the
* software mod bit when we put the page on the dirty
* list.
*/
- if (flags & (B_INVAL | B_FREE)) {
+ if (flags & B_INVALCURONLY) {
+ (void) hat_pageunload(pp, HAT_CURPROC_PGUNLOAD);
+ } else if (flags & (B_INVAL | B_FREE)) {
(void) hat_pageunload(pp, HAT_FORCE_PGUNLOAD);
} else {
(void) hat_pagesync(pp, HAT_SYNC_ZERORM);
@@ -645,7 +658,7 @@ pvn_getdirty(page_t *pp, int flags)
* list after all.
*/
page_io_unlock(pp);
- if (flags & B_INVAL) {
+ if ((flags & (B_INVAL | B_INVALCURONLY)) == B_INVAL) {
/*LINTED: constant in conditional context*/
VN_DISPOSE(pp, B_INVAL, 0, kcred);
} else if (flags & B_FREE) {
@@ -657,6 +670,9 @@ pvn_getdirty(page_t *pp, int flags)
* of VOP_PUTPAGE() who prefer freeing the
* page _only_ if no one else is accessing it.
* E.g. segmap_release()
+ * We also take this path for B_INVALCURONLY and
+ * let page_release call VN_DISPOSE if no one else is
+ * using the page.
*
* The above hat_ismod() check is useless because:
* (1) we may not be holding SE_EXCL lock;
@@ -681,7 +697,7 @@ pvn_getdirty(page_t *pp, int flags)
* We'll detect the fact that they used it when the
* i/o is done and avoid freeing the page.
*/
- if (flags & B_FREE)
+ if (flags & (B_FREE | B_INVALCURONLY))
page_downgrade(pp);
diff --git a/usr/src/uts/common/vm/vm_usage.c b/usr/src/uts/common/vm/vm_usage.c
index d422f8d0e8..8f425e9e4f 100644
--- a/usr/src/uts/common/vm/vm_usage.c
+++ b/usr/src/uts/common/vm/vm_usage.c
@@ -25,6 +25,10 @@
*/
/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+
+/*
* vm_usage
*
* This file implements the getvmusage() private system call.
@@ -114,7 +118,7 @@
* For accurate counting of map-shared and COW-shared pages.
*
* - visited private anons (refcnt > 1) for each collective.
- * (entity->vme_anon_hash)
+ * (entity->vme_anon)
* For accurate counting of COW-shared pages.
*
* The common accounting structure is the vmu_entity_t, which represents
@@ -152,6 +156,7 @@
#include <sys/vm_usage.h>
#include <sys/zone.h>
#include <sys/sunddi.h>
+#include <sys/sysmacros.h>
#include <sys/avl.h>
#include <vm/anon.h>
#include <vm/as.h>
@@ -199,6 +204,14 @@ typedef struct vmu_object {
} vmu_object_t;
/*
+ * Node for tree of visited COW anons.
+ */
+typedef struct vmu_anon {
+ avl_node_t vma_node;
+ uintptr_t vma_addr;
+} vmu_anon_t;
+
+/*
* Entity by which to count results.
*
* The entity structure keeps the current rss/swap counts for each entity
@@ -221,7 +234,7 @@ typedef struct vmu_entity {
struct vmu_entity *vme_next_calc;
mod_hash_t *vme_vnode_hash; /* vnodes visited for entity */
mod_hash_t *vme_amp_hash; /* shared amps visited for entity */
- mod_hash_t *vme_anon_hash; /* COW anons visited for entity */
+ avl_tree_t vme_anon; /* COW anons visited for entity */
vmusage_t vme_result; /* identifies entity and results */
} vmu_entity_t;
@@ -324,6 +337,23 @@ bounds_cmp(const void *bnd1, const void *bnd2)
}
/*
+ * Comparison routine for our AVL tree of anon structures.
+ */
+static int
+vmu_anon_cmp(const void *lhs, const void *rhs)
+{
+ const vmu_anon_t *l = lhs, *r = rhs;
+
+ if (l->vma_addr == r->vma_addr)
+ return (0);
+
+ if (l->vma_addr < r->vma_addr)
+ return (-1);
+
+ return (1);
+}
+
+/*
* Save a bound on the free list.
*/
static void
@@ -363,13 +393,18 @@ static void
vmu_free_entity(mod_hash_val_t val)
{
vmu_entity_t *entity = (vmu_entity_t *)val;
+ vmu_anon_t *anon;
+ void *cookie = NULL;
if (entity->vme_vnode_hash != NULL)
i_mod_hash_clear_nosync(entity->vme_vnode_hash);
if (entity->vme_amp_hash != NULL)
i_mod_hash_clear_nosync(entity->vme_amp_hash);
- if (entity->vme_anon_hash != NULL)
- i_mod_hash_clear_nosync(entity->vme_anon_hash);
+
+ while ((anon = avl_destroy_nodes(&entity->vme_anon, &cookie)) != NULL)
+ kmem_free(anon, sizeof (vmu_anon_t));
+
+ avl_destroy(&entity->vme_anon);
entity->vme_next = vmu_data.vmu_free_entities;
vmu_data.vmu_free_entities = entity;
@@ -485,10 +520,10 @@ vmu_alloc_entity(id_t id, int type, id_t zoneid)
"vmusage amp hash", VMUSAGE_HASH_SIZE, vmu_free_object,
sizeof (struct anon_map));
- if (entity->vme_anon_hash == NULL)
- entity->vme_anon_hash = mod_hash_create_ptrhash(
- "vmusage anon hash", VMUSAGE_HASH_SIZE,
- mod_hash_null_valdtor, sizeof (struct anon));
+ VERIFY(avl_first(&entity->vme_anon) == NULL);
+
+ avl_create(&entity->vme_anon, vmu_anon_cmp, sizeof (struct vmu_anon),
+ offsetof(struct vmu_anon, vma_node));
entity->vme_next = vmu_data.vmu_entities;
vmu_data.vmu_entities = entity;
@@ -518,7 +553,8 @@ vmu_alloc_zone(id_t id)
zone->vmz_id = id;
- if ((vmu_data.vmu_calc_flags & (VMUSAGE_ZONE | VMUSAGE_ALL_ZONES)) != 0)
+ if ((vmu_data.vmu_calc_flags &
+ (VMUSAGE_ZONE | VMUSAGE_ALL_ZONES | VMUSAGE_A_ZONE)) != 0)
zone->vmz_zone = vmu_alloc_entity(id, VMUSAGE_ZONE, id);
if ((vmu_data.vmu_calc_flags & (VMUSAGE_PROJECTS |
@@ -613,21 +649,19 @@ vmu_find_insert_object(mod_hash_t *hash, caddr_t key, uint_t type)
}
static int
-vmu_find_insert_anon(mod_hash_t *hash, caddr_t key)
+vmu_find_insert_anon(vmu_entity_t *entity, void *key)
{
- int ret;
- caddr_t val;
+ vmu_anon_t anon, *ap;
- ret = i_mod_hash_find_nosync(hash, (mod_hash_key_t)key,
- (mod_hash_val_t *)&val);
+ anon.vma_addr = (uintptr_t)key;
- if (ret == 0)
+ if (avl_find(&entity->vme_anon, &anon, NULL) != NULL)
return (0);
- ret = i_mod_hash_insert_nosync(hash, (mod_hash_key_t)key,
- (mod_hash_val_t)key, (mod_hash_hndl_t)0);
+ ap = kmem_alloc(sizeof (vmu_anon_t), KM_SLEEP);
+ ap->vma_addr = (uintptr_t)key;
- ASSERT(ret == 0);
+ avl_add(&entity->vme_anon, ap);
return (1);
}
@@ -937,7 +971,10 @@ vmu_amp_update_incore_bounds(avl_tree_t *tree, struct anon_map *amp,
if (ap != NULL && vn != NULL && vn->v_pages != NULL &&
(page = page_exists(vn, off)) != NULL) {
- page_type = VMUSAGE_BOUND_INCORE;
+ if (PP_ISFREE(page))
+ page_type = VMUSAGE_BOUND_NOT_INCORE;
+ else
+ page_type = VMUSAGE_BOUND_INCORE;
if (page->p_szc > 0) {
pgcnt = page_get_pagecnt(page->p_szc);
pgshft = page_get_shift(page->p_szc);
@@ -1024,7 +1061,10 @@ vmu_vnode_update_incore_bounds(avl_tree_t *tree, vnode_t *vnode,
if (vnode->v_pages != NULL &&
(page = page_exists(vnode, ptob(index))) != NULL) {
- page_type = VMUSAGE_BOUND_INCORE;
+ if (PP_ISFREE(page))
+ page_type = VMUSAGE_BOUND_NOT_INCORE;
+ else
+ page_type = VMUSAGE_BOUND_INCORE;
if (page->p_szc > 0) {
pgcnt = page_get_pagecnt(page->p_szc);
pgshft = page_get_shift(page->p_szc);
@@ -1304,6 +1344,12 @@ vmu_calculate_seg(vmu_entity_t *vmu_entities, struct seg *seg)
}
/*
+ * Pages on the free list aren't counted for the rss.
+ */
+ if (PP_ISFREE(page))
+ continue;
+
+ /*
* Assume anon structs with a refcnt
* of 1 are not COW shared, so there
* is no reason to track them per entity.
@@ -1320,8 +1366,7 @@ vmu_calculate_seg(vmu_entity_t *vmu_entities, struct seg *seg)
* Track COW anons per entity so
* they are not double counted.
*/
- if (vmu_find_insert_anon(entity->vme_anon_hash,
- (caddr_t)ap) == 0)
+ if (vmu_find_insert_anon(entity, ap) == 0)
continue;
result->vmu_rss_all += (pgcnt << PAGESHIFT);
@@ -1461,8 +1506,9 @@ vmu_calculate_proc(proc_t *p)
entities = tmp;
}
if (vmu_data.vmu_calc_flags &
- (VMUSAGE_ZONE | VMUSAGE_ALL_ZONES | VMUSAGE_PROJECTS |
- VMUSAGE_ALL_PROJECTS | VMUSAGE_TASKS | VMUSAGE_ALL_TASKS |
+ (VMUSAGE_ZONE | VMUSAGE_ALL_ZONES | VMUSAGE_A_ZONE |
+ VMUSAGE_PROJECTS | VMUSAGE_ALL_PROJECTS |
+ VMUSAGE_TASKS | VMUSAGE_ALL_TASKS |
VMUSAGE_RUSERS | VMUSAGE_ALL_RUSERS | VMUSAGE_EUSERS |
VMUSAGE_ALL_EUSERS)) {
ret = i_mod_hash_find_nosync(vmu_data.vmu_zones_hash,
@@ -1594,8 +1640,7 @@ vmu_free_extra()
mod_hash_destroy_hash(te->vme_vnode_hash);
if (te->vme_amp_hash != NULL)
mod_hash_destroy_hash(te->vme_amp_hash);
- if (te->vme_anon_hash != NULL)
- mod_hash_destroy_hash(te->vme_anon_hash);
+ VERIFY(avl_first(&te->vme_anon) == NULL);
kmem_free(te, sizeof (vmu_entity_t));
}
while (vmu_data.vmu_free_zones != NULL) {
@@ -1739,12 +1784,34 @@ vmu_cache_rele(vmu_cache_t *cache)
}
/*
+ * When new data is calculated, update the phys_mem rctl usage value in the
+ * zones.
+ */
+static void
+vmu_update_zone_rctls(vmu_cache_t *cache)
+{
+ vmusage_t *rp;
+ size_t i = 0;
+ zone_t *zp;
+
+ for (rp = cache->vmc_results; i < cache->vmc_nresults; rp++, i++) {
+ if (rp->vmu_type == VMUSAGE_ZONE &&
+ rp->vmu_zoneid != ALL_ZONES) {
+ if ((zp = zone_find_by_id(rp->vmu_zoneid)) != NULL) {
+ zp->zone_phys_mem = rp->vmu_rss_all;
+ zone_rele(zp);
+ }
+ }
+ }
+}
+
+/*
* Copy out the cached results to a caller. Inspect the callers flags
* and zone to determine which cached results should be copied.
*/
static int
vmu_copyout_results(vmu_cache_t *cache, vmusage_t *buf, size_t *nres,
- uint_t flags, int cpflg)
+ uint_t flags, id_t req_zone_id, int cpflg)
{
vmusage_t *result, *out_result;
vmusage_t dummy;
@@ -1763,7 +1830,7 @@ vmu_copyout_results(vmu_cache_t *cache, vmusage_t *buf, size_t *nres,
/* figure out what results the caller is interested in. */
if ((flags & VMUSAGE_SYSTEM) && curproc->p_zone == global_zone)
types |= VMUSAGE_SYSTEM;
- if (flags & (VMUSAGE_ZONE | VMUSAGE_ALL_ZONES))
+ if (flags & (VMUSAGE_ZONE | VMUSAGE_ALL_ZONES | VMUSAGE_A_ZONE))
types |= VMUSAGE_ZONE;
if (flags & (VMUSAGE_PROJECTS | VMUSAGE_ALL_PROJECTS |
VMUSAGE_COL_PROJECTS))
@@ -1826,26 +1893,33 @@ vmu_copyout_results(vmu_cache_t *cache, vmusage_t *buf, size_t *nres,
continue;
}
- /* Skip "other zone" results if not requested */
- if (result->vmu_zoneid != curproc->p_zone->zone_id) {
- if (result->vmu_type == VMUSAGE_ZONE &&
- (flags & VMUSAGE_ALL_ZONES) == 0)
- continue;
- if (result->vmu_type == VMUSAGE_PROJECTS &&
- (flags & (VMUSAGE_ALL_PROJECTS |
- VMUSAGE_COL_PROJECTS)) == 0)
- continue;
- if (result->vmu_type == VMUSAGE_TASKS &&
- (flags & VMUSAGE_ALL_TASKS) == 0)
- continue;
- if (result->vmu_type == VMUSAGE_RUSERS &&
- (flags & (VMUSAGE_ALL_RUSERS |
- VMUSAGE_COL_RUSERS)) == 0)
- continue;
- if (result->vmu_type == VMUSAGE_EUSERS &&
- (flags & (VMUSAGE_ALL_EUSERS |
- VMUSAGE_COL_EUSERS)) == 0)
+ if (result->vmu_type == VMUSAGE_ZONE &&
+ flags & VMUSAGE_A_ZONE) {
+ /* Skip non-requested zone results */
+ if (result->vmu_zoneid != req_zone_id)
continue;
+ } else {
+ /* Skip "other zone" results if not requested */
+ if (result->vmu_zoneid != curproc->p_zone->zone_id) {
+ if (result->vmu_type == VMUSAGE_ZONE &&
+ (flags & VMUSAGE_ALL_ZONES) == 0)
+ continue;
+ if (result->vmu_type == VMUSAGE_PROJECTS &&
+ (flags & (VMUSAGE_ALL_PROJECTS |
+ VMUSAGE_COL_PROJECTS)) == 0)
+ continue;
+ if (result->vmu_type == VMUSAGE_TASKS &&
+ (flags & VMUSAGE_ALL_TASKS) == 0)
+ continue;
+ if (result->vmu_type == VMUSAGE_RUSERS &&
+ (flags & (VMUSAGE_ALL_RUSERS |
+ VMUSAGE_COL_RUSERS)) == 0)
+ continue;
+ if (result->vmu_type == VMUSAGE_EUSERS &&
+ (flags & (VMUSAGE_ALL_EUSERS |
+ VMUSAGE_COL_EUSERS)) == 0)
+ continue;
+ }
}
count++;
if (out_result != NULL) {
@@ -1901,10 +1975,12 @@ vm_getusage(uint_t flags, time_t age, vmusage_t *buf, size_t *nres, int cpflg)
int cacherecent = 0;
hrtime_t now;
uint_t flags_orig;
+ id_t req_zone_id;
/*
* Non-global zones cannot request system wide and/or collated
- * results, or the system result, so munge the flags accordingly.
+ * results, or the system result, or usage of another zone, so munge
+ * the flags accordingly.
*/
flags_orig = flags;
if (curproc->p_zone != global_zone) {
@@ -1924,6 +2000,10 @@ vm_getusage(uint_t flags, time_t age, vmusage_t *buf, size_t *nres, int cpflg)
flags &= ~VMUSAGE_SYSTEM;
flags |= VMUSAGE_ZONE;
}
+ if (flags & VMUSAGE_A_ZONE) {
+ flags &= ~VMUSAGE_A_ZONE;
+ flags |= VMUSAGE_ZONE;
+ }
}
/* Check for unknown flags */
@@ -1934,6 +2014,21 @@ vm_getusage(uint_t flags, time_t age, vmusage_t *buf, size_t *nres, int cpflg)
if ((flags & VMUSAGE_MASK) == 0)
return (set_errno(EINVAL));
+ /* If requesting results for a specific zone, get the zone ID */
+ if (flags & VMUSAGE_A_ZONE) {
+ size_t bufsize;
+ vmusage_t zreq;
+
+ if (ddi_copyin((caddr_t)nres, &bufsize, sizeof (size_t), cpflg))
+ return (set_errno(EFAULT));
+ /* Requested zone ID is passed in buf, so 0 len not allowed */
+ if (bufsize == 0)
+ return (set_errno(EINVAL));
+ if (ddi_copyin((caddr_t)buf, &zreq, sizeof (vmusage_t), cpflg))
+ return (set_errno(EFAULT));
+ req_zone_id = zreq.vmu_id;
+ }
+
mutex_enter(&vmu_data.vmu_lock);
now = gethrtime();
@@ -1953,7 +2048,7 @@ start:
mutex_exit(&vmu_data.vmu_lock);
ret = vmu_copyout_results(cache, buf, nres, flags_orig,
- cpflg);
+ req_zone_id, cpflg);
mutex_enter(&vmu_data.vmu_lock);
vmu_cache_rele(cache);
if (vmu_data.vmu_pending_waiters > 0)
@@ -2009,8 +2104,11 @@ start:
mutex_exit(&vmu_data.vmu_lock);
+ /* update zone's phys. mem. rctl usage */
+ vmu_update_zone_rctls(cache);
/* copy cache */
- ret = vmu_copyout_results(cache, buf, nres, flags_orig, cpflg);
+ ret = vmu_copyout_results(cache, buf, nres, flags_orig,
+ req_zone_id, cpflg);
mutex_enter(&vmu_data.vmu_lock);
vmu_cache_rele(cache);
mutex_exit(&vmu_data.vmu_lock);
diff --git a/usr/src/uts/i86pc/dboot/dboot_startkern.c b/usr/src/uts/i86pc/dboot/dboot_startkern.c
index f5f8f95682..a51f12e9cc 100644
--- a/usr/src/uts/i86pc/dboot/dboot_startkern.c
+++ b/usr/src/uts/i86pc/dboot/dboot_startkern.c
@@ -61,6 +61,15 @@ extern int have_cpuid(void);
#define SHA1_ASCII_LENGTH (SHA1_DIGEST_LENGTH * 2)
/*
+ * Region of memory that may be corrupted by external actors. This can go away
+ * once the firmware bug RICHMOND-16 is fixed and all systems with the bug are
+ * upgraded.
+ */
+#define CORRUPT_REGION_START 0xc700000
+#define CORRUPT_REGION_SIZE 0x100000
+#define CORRUPT_REGION_END (CORRUPT_REGION_START + CORRUPT_REGION_SIZE)
+
+/*
* This file contains code that runs to transition us from either a multiboot
* compliant loader (32 bit non-paging) or a XPV domain loader to
* regular kernel execution. Its task is to setup the kernel memory image
@@ -1004,6 +1013,38 @@ init_mem_alloc(void)
case 1:
if (end > max_mem)
max_mem = end;
+
+ /*
+ * Well, this is sad. One some systems, there
+ * is a region of memory that can be corrupted
+ * until some number of seconds after we have
+ * booted. And the BIOS doesn't tell us that
+ * this memory is unsafe to use. And we don't
+ * know how long it's dangerous. So we'll
+ * chop out this range from any memory list
+ * that would otherwise be usable. Note that
+ * any system of this type will give us the
+ * new-style (0x40) memlist, so we need not
+ * fix up the other path below.
+ */
+ if (start < CORRUPT_REGION_START &&
+ end > CORRUPT_REGION_START) {
+ memlists[memlists_used].addr = start;
+ memlists[memlists_used].size =
+ CORRUPT_REGION_START - start;
+ ++memlists_used;
+ if (end > CORRUPT_REGION_END)
+ start = CORRUPT_REGION_END;
+ else
+ continue;
+ }
+ if (start >= CORRUPT_REGION_START &&
+ start < CORRUPT_REGION_END) {
+ if (end <= CORRUPT_REGION_END)
+ continue;
+ start = CORRUPT_REGION_END;
+ }
+
memlists[memlists_used].addr = start;
memlists[memlists_used].size = end - start;
++memlists_used;
diff --git a/usr/src/uts/i86pc/io/ppm/acpisleep.c b/usr/src/uts/i86pc/io/ppm/acpisleep.c
index b86f3ad963..8d9e8d42ba 100644
--- a/usr/src/uts/i86pc/io/ppm/acpisleep.c
+++ b/usr/src/uts/i86pc/io/ppm/acpisleep.c
@@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -56,6 +57,19 @@
int acpi_rtc_wake = 0x0; /* wake in N seconds */
+/*
+ * Execute optional ACPI methods for suspend/resume.
+ * The value can be ACPI_EXECUTE_GTS and/or ACPI_EXECUTE_BFS.
+ * Global so it can be set in /etc/system.
+ * From usr/src/uts/intel/io/acpica/changes.txt:
+ * It has been seen on some systems where the execution of these
+ * methods causes errors and also prevents the machine from entering S5.
+ * It is therefore suggested that host operating systems do not execute
+ * these methods by default. In the future, perhaps these methods can be
+ * optionally executed based on the age of the system...
+ */
+int acpi_sleep_flags = ACPI_NO_OPTIONAL_METHODS;
+
#if 0 /* debug */
static uint8_t branchbuf[64 * 1024]; /* for the HDT branch trace stuff */
#endif /* debug */
@@ -144,8 +158,9 @@ acpi_enter_sleepstate(s3a_t *s3ap)
* Tell the hardware to sleep.
*/
PT(PT_SXE);
- PMD(PMD_SX, ("Calling AcpiEnterSleepState(%d) ...\n", Sx))
- if (AcpiEnterSleepState(Sx) != AE_OK) {
+ PMD(PMD_SX, ("Calling AcpiEnterSleepState(%d, %d) ...\n", Sx,
+ acpi_sleep_flags))
+ if (AcpiEnterSleepState(Sx, acpi_sleep_flags) != AE_OK) {
PT(PT_SXE_FAIL);
PMD(PMD_SX, ("... failed!\n"))
}
@@ -165,6 +180,11 @@ acpi_exit_sleepstate(s3a_t *s3ap)
PMD(PMD_SX, ("!We woke up!\n"))
PT(PT_LSS);
+ if (AcpiLeaveSleepStatePrep(Sx, acpi_sleep_flags) != AE_OK) {
+ PT(PT_LSS_FAIL);
+ PMD(PMD_SX, ("Problem with LeaveSleepState!\n"))
+ }
+
if (AcpiLeaveSleepState(Sx) != AE_OK) {
PT(PT_LSS_FAIL);
PMD(PMD_SX, ("Problem with LeaveSleepState!\n"))
diff --git a/usr/src/uts/i86pc/io/psm/psm_common.c b/usr/src/uts/i86pc/io/psm/psm_common.c
index 7a3dd8a733..9c17d85228 100644
--- a/usr/src/uts/i86pc/io/psm/psm_common.c
+++ b/usr/src/uts/i86pc/io/psm/psm_common.c
@@ -20,6 +20,7 @@
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -979,7 +980,7 @@ acpi_poweroff(void)
return (1);
}
ACPI_DISABLE_IRQS();
- status = AcpiEnterSleepState(5);
+ status = AcpiEnterSleepState(5, ACPI_NO_OPTIONAL_METHODS);
ACPI_ENABLE_IRQS();
/* we should be off; if we get here it's an error */
diff --git a/usr/src/uts/i86pc/os/cpr_impl.c b/usr/src/uts/i86pc/os/cpr_impl.c
index acc78eaa14..0e5261eb1f 100644
--- a/usr/src/uts/i86pc/os/cpr_impl.c
+++ b/usr/src/uts/i86pc/os/cpr_impl.c
@@ -753,6 +753,20 @@ i_cpr_is_supported(int sleeptype)
if (sleeptype != CPR_TORAM)
return (0);
+ /*
+ * Unfortunately, the x86 resume code was never implemented for GAS.
+ * The only obvious problem is that a trick necessary to appease Sun
+ * Studio does the wrong thing for GAS. Doubley unfortunate is that
+ * the condition used to detect GAS is incorrect, so we do in fact
+ * compile the Studio path, it just immediately fails in resume.
+ *
+ * Given that, if we were built using GCC, never allow CPR to be
+ * attempted.
+ */
+#ifdef __GNUC__
+ return (0);
+#endif
+
/*
* The next statement tests if a specific platform has turned off
* cpr support.
diff --git a/usr/src/uts/i86pc/os/ibft.c b/usr/src/uts/i86pc/os/ibft.c
index 43ffad5e81..bcb8c06d58 100644
--- a/usr/src/uts/i86pc/os/ibft.c
+++ b/usr/src/uts/i86pc/os/ibft.c
@@ -38,6 +38,7 @@
#include <sys/kmem.h>
#include <sys/psm.h>
#include <sys/bootconf.h>
+#include <sys/reboot.h>
#ifndef NULL
#define NULL 0
@@ -209,6 +210,7 @@ static ibft_status_t iscsi_parse_ibft_NIC(iscsi_ibft_nic_t *nicp);
static ibft_status_t iscsi_parse_ibft_target(char *begin_of_ibft,
iscsi_ibft_tgt_t *tgtp);
+extern int boothowto;
/*
* Return value:
@@ -762,7 +764,9 @@ ld_ib_prop()
* 1) pass "-B ibft-noprobe=1" on kernel command line
* 2) add line "set ibft_noprobe=1" in /etc/system
*/
- cmn_err(CE_NOTE, IBFT_NOPROBE_MSG);
+ if (boothowto & RB_VERBOSE) {
+ cmn_err(CE_NOTE, IBFT_NOPROBE_MSG);
+ }
return;
}
diff --git a/usr/src/uts/i86pc/os/lgrpplat.c b/usr/src/uts/i86pc/os/lgrpplat.c
index ac647bea16..2d7c253204 100644
--- a/usr/src/uts/i86pc/os/lgrpplat.c
+++ b/usr/src/uts/i86pc/os/lgrpplat.c
@@ -2792,7 +2792,11 @@ lgrp_plat_process_sli(uint32_t domain_id, uchar_t *sli_info,
/*
* Read ACPI System Resource Affinity Table (SRAT) to determine which CPUs
* and memory are local to each other in the same NUMA node and return number
- * of nodes
+ * of nodes.
+ *
+ * The SRAT table pointer is populated during bootup by
+ * build_firmware_properties() in fakebop.c. Several motherboard and BIOS
+ * manufacturers are guilty of not having a SRAT table.
*/
static int
lgrp_plat_process_srat(struct srat *tp, struct msct *mp,
@@ -2810,9 +2814,15 @@ lgrp_plat_process_srat(struct srat *tp, struct msct *mp,
/*
* Nothing to do when no SRAT or disabled
*/
- if (tp == NULL || !lgrp_plat_srat_enable)
+ if (!lgrp_plat_srat_enable)
return (-1);
+ if (tp == NULL) {
+ cmn_err(CE_WARN, "Couldn't read ACPI SRAT table from BIOS. "
+ "lgrp support will be limited to one group.\n");
+ return (-1);
+ }
+
/*
* Try to get domain information from MSCT table.
* ACPI4.0: OSPM will use information provided by the MSCT only
diff --git a/usr/src/uts/i86pc/sys/acpidev.h b/usr/src/uts/i86pc/sys/acpidev.h
index 6d11277aaf..a3bd54d4e3 100644
--- a/usr/src/uts/i86pc/sys/acpidev.h
+++ b/usr/src/uts/i86pc/sys/acpidev.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2009-2010, Intel Corporation.
* All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_ACPIDEV_H
@@ -128,7 +129,7 @@ typedef enum acpidev_class_id {
#ifdef _KERNEL
/* Common ACPI object names. */
-#define ACPIDEV_OBJECT_NAME_SB ACPI_NS_SYSTEM_BUS
+#define ACPIDEV_OBJECT_NAME_SB METHOD_NAME__SB_
#define ACPIDEV_OBJECT_NAME_PR "_PR_"
/* Common ACPI method names. */
diff --git a/usr/src/uts/i86pc/vm/hat_i86.c b/usr/src/uts/i86pc/vm/hat_i86.c
index 8da02a4c36..40b033d0e4 100644
--- a/usr/src/uts/i86pc/vm/hat_i86.c
+++ b/usr/src/uts/i86pc/vm/hat_i86.c
@@ -27,6 +27,7 @@
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/*
@@ -3350,15 +3351,13 @@ hati_page_unmap(page_t *pp, htable_t *ht, uint_t entry)
extern int vpm_enable;
/*
- * Unload all translations to a page. If the page is a subpage of a large
+ * Unload translations to a page. If the page is a subpage of a large
* page, the large page mappings are also removed.
- *
- * The forceflags are unused.
+ * If unloadflag is HAT_CURPROC_PGUNLOAD, then we only unload the translation
+ * for the current process, otherwise all translations are unloaded.
*/
-
-/*ARGSUSED*/
static int
-hati_pageunload(struct page *pp, uint_t pg_szcd, uint_t forceflag)
+hati_pageunload(struct page *pp, uint_t pg_szcd, uint_t unloadflag)
{
page_t *cur_pp = pp;
hment_t *hm;
@@ -3366,6 +3365,8 @@ hati_pageunload(struct page *pp, uint_t pg_szcd, uint_t forceflag)
htable_t *ht;
uint_t entry;
level_t level;
+ struct hat *curhat;
+ ulong_t cnt;
XPV_DISALLOW_MIGRATE();
@@ -3375,6 +3376,9 @@ hati_pageunload(struct page *pp, uint_t pg_szcd, uint_t forceflag)
++curthread->t_hatdepth;
ASSERT(curthread->t_hatdepth < 16);
+ if (unloadflag == HAT_CURPROC_PGUNLOAD)
+ curhat = curthread->t_procp->p_as->a_hat;
+
#if defined(__amd64)
/*
* clear the vpm ref.
@@ -3387,6 +3391,8 @@ hati_pageunload(struct page *pp, uint_t pg_szcd, uint_t forceflag)
* The loop with next_size handles pages with multiple pagesize mappings
*/
next_size:
+ if (unloadflag == HAT_CURPROC_PGUNLOAD)
+ cnt = hat_page_getshare(cur_pp);
for (;;) {
/*
@@ -3398,6 +3404,7 @@ next_size:
if (hm == NULL) {
x86_hm_exit(cur_pp);
+curproc_done:
/*
* If not part of a larger page, we're done.
*/
@@ -3424,8 +3431,21 @@ next_size:
* If this mapping size matches, remove it.
*/
level = ht->ht_level;
- if (level == pg_szcd)
- break;
+ if (level == pg_szcd) {
+ if (unloadflag != HAT_CURPROC_PGUNLOAD ||
+ ht->ht_hat == curhat)
+ break;
+ /*
+ * unloadflag == HAT_CURPROC_PGUNLOAD but it's
+ * not the hat for the current process. Leave
+ * entry in place. Also do a safety check to
+ * ensure we don't get in an infinite loop
+ */
+ if (cnt-- == 0) {
+ x86_hm_exit(cur_pp);
+ goto curproc_done;
+ }
+ }
}
/*
@@ -3435,14 +3455,18 @@ next_size:
hm = hati_page_unmap(cur_pp, ht, entry);
if (hm != NULL)
hment_free(hm);
+
+ /* Perform check above for being part of a larger page. */
+ if (unloadflag == HAT_CURPROC_PGUNLOAD)
+ goto curproc_done;
}
}
int
-hat_pageunload(struct page *pp, uint_t forceflag)
+hat_pageunload(struct page *pp, uint_t unloadflag)
{
ASSERT(PAGE_EXCL(pp));
- return (hati_pageunload(pp, 0, forceflag));
+ return (hati_pageunload(pp, 0, unloadflag));
}
/*
diff --git a/usr/src/uts/intel/Makefile.files b/usr/src/uts/intel/Makefile.files
index 082c4eefb3..61a19a928f 100644
--- a/usr/src/uts/intel/Makefile.files
+++ b/usr/src/uts/intel/Makefile.files
@@ -184,8 +184,9 @@ ACPICA_OBJS += dbcmds.o dbdisply.o \
dbexec.o dbfileio.o dbhistry.o dbinput.o dbstats.o \
dbutils.o dbxface.o evevent.o evgpe.o evgpeblk.o \
evmisc.o evregion.o evrgnini.o evsci.o evxface.o \
- evxfevnt.o evxfregn.o hwacpi.o hwgpe.o hwregs.o \
- hwsleep.o hwtimer.o dsfield.o dsinit.o dsmethod.o \
+ evxfevnt.o evxfregn.o hwacpi.o hwesleep.o hwgpe.o \
+ hwregs.o hwsleep.o hwtimer.o hwxfsleep.o dsfield.o \
+ dsinit.o dsmethod.o \
dsmthdat.o dsobject.o dsopcode.o dsutils.o dswexec.o \
dswload.o dswscope.o dswstate.o exconfig.o exconvrt.o \
excreate.o exdump.o exfield.o exfldio.o exmisc.o \
@@ -197,16 +198,18 @@ ACPICA_OBJS += dbcmds.o dbdisply.o \
nsalloc.o nsdump.o nsdumpdv.o nseval.o nsinit.o \
nsload.o nsnames.o nsobject.o nsparse.o nssearch.o \
nsutils.o nswalk.o nsxfeval.o nsxfname.o nsxfobj.o \
- rsaddr.o rscalc.o rscreate.o rsdump.o \
+ rsaddr.o rscalc.o rscreate.o rsdump.o rsserial.o \
rsinfo.o rsio.o rsirq.o rslist.o rsmemory.o rsmisc.o \
rsutils.o rsxface.o tbfadt.o tbfind.o tbinstal.o \
- tbutils.o tbxface.o tbxfroot.o \
+ tbutils.o tbxface.o tbxfroot.o utaddress.o \
utalloc.o utclib.o utcopy.o utdebug.o utdelete.o \
uteval.o utglobal.o utinit.o utmath.o utmisc.o \
- utobject.o utresrc.o utxface.o acpica.o acpi_enum.o \
+ utobject.o utresrc.o utxface.o utxfmutex.o acpica.o \
+ acpi_enum.o \
master_ops.o osl.o osl_ml.o acpica_ec.o utcache.o \
utmutex.o utstate.o dmbuffer.o dmnames.o dmobject.o \
- dmopcode.o dmresrc.o dmresrcl.o dmresrcs.o dmutils.o \
+ dmopcode.o dmresrc.o dmresrcl.o dmresrcl2.o dmresrcs.o \
+ dmutils.o \
dmwalk.o psloop.o nspredef.o hwxface.o hwvalid.o \
utlock.o utids.o nsrepair.o nsrepair2.o \
dbmethod.o dbnames.o dsargs.o dscontrol.o dswload2.o \
@@ -261,6 +264,7 @@ IOMMULIB_OBJS = iommulib.o
# Brand modules
#
SN1_BRAND_OBJS = sn1_brand.o sn1_brand_asm.o
+SNGL_BRAND_OBJS = sngl_brand.o sngl_brand_asm.o
S10_BRAND_OBJS = s10_brand.o s10_brand_asm.o
#
diff --git a/usr/src/uts/intel/Makefile.intel.shared b/usr/src/uts/intel/Makefile.intel.shared
index 37ad2ec8a3..a4d3b4d674 100644
--- a/usr/src/uts/intel/Makefile.intel.shared
+++ b/usr/src/uts/intel/Makefile.intel.shared
@@ -19,6 +19,7 @@
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012 Joyent, Inc. All rights reserved.
# Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
#
@@ -232,6 +233,7 @@ DRV_KMODS += devinfo
DRV_KMODS += dld
DRV_KMODS += dlpistub
DRV_KMODS_32 += dnet
+DRV_KMODS += dr_sas
DRV_KMODS += dump
DRV_KMODS += ecpp
DRV_KMODS += emlxs
@@ -248,6 +250,7 @@ DRV_KMODS += intel_nb5000
DRV_KMODS += intel_nhm
DRV_KMODS += ip
DRV_KMODS += ip6
+DRV_KMODS += ipd
DRV_KMODS += ipf
DRV_KMODS += ipnet
DRV_KMODS += ippctl
@@ -344,6 +347,7 @@ DRV_KMODS += uath
DRV_KMODS += urtw
DRV_KMODS += vgatext
DRV_KMODS += heci
+DRV_KMODS += vmxnet
DRV_KMODS += vnic
DRV_KMODS += vscan
DRV_KMODS += wc
@@ -515,7 +519,7 @@ MISC_KMODS += md_sp
#
# Brand modules
#
-BRAND_KMODS += sn1_brand s10_brand
+BRAND_KMODS += sn1_brand sngl_brand s10_brand
#
# Exec Class Modules (/kernel/exec):
@@ -530,8 +534,8 @@ SCHED_KMODS += IA RT TS RT_DPTBL TS_DPTBL FSS FX FX_DPTBL SDC
#
# File System Modules (/kernel/fs):
#
-FS_KMODS += autofs cachefs ctfs dcfs dev devfs fdfs fifofs hsfs lofs
-FS_KMODS += mntfs namefs nfs objfs zfs zut
+FS_KMODS += autofs cachefs ctfs dcfs dev devfs fdfs fifofs hsfs hyprlofs
+FS_KMODS += lofs lxprocfs mntfs namefs nfs objfs zfs zut
FS_KMODS += pcfs procfs sockfs specfs tmpfs udfs ufs sharefs
FS_KMODS += smbfs
diff --git a/usr/src/uts/intel/Makefile.rules b/usr/src/uts/intel/Makefile.rules
index b246e8fcca..65c31ba168 100644
--- a/usr/src/uts/intel/Makefile.rules
+++ b/usr/src/uts/intel/Makefile.rules
@@ -61,6 +61,9 @@ $(OBJS_DIR)/%.o: $(SRC)/common/util/i386/%.s
$(OBJS_DIR)/%.o: $(UTSBASE)/intel/brand/sn1/%.s
$(COMPILE.s) -o $@ $<
+$(OBJS_DIR)/%.o: $(UTSBASE)/intel/brand/sngl/%.s
+ $(COMPILE.s) -o $@ $<
+
$(OBJS_DIR)/%.o: $(UTSBASE)/intel/brand/solaris10/%.s
$(COMPILE.s) -o $@ $<
@@ -177,6 +180,10 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/intel/io/intel_nb5000/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(UTSBASE)/intel/io/vmxnet/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
$(OBJS_DIR)/%.o: $(UTSBASE)/intel/io/intel_nhm/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
@@ -319,6 +326,9 @@ $(LINTS_DIR)/%.ln: $(SRC)/common/util/i386/%.s
$(LINTS_DIR)/%.ln: $(UTSBASE)/intel/brand/sn1/%.s
@($(LHEAD) $(LINT.s) $< $(LTAIL))
+$(LINTS_DIR)/%.ln: $(UTSBASE)/intel/brand/sngl/%.s
+ @($(LHEAD) $(LINT.s) $< $(LTAIL))
+
$(LINTS_DIR)/%.ln: $(UTSBASE)/intel/brand/solaris10/%.s
@($(LHEAD) $(LINT.s) $< $(LTAIL))
@@ -457,6 +467,9 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/intel/io/scsi/targets/%.c
$(LINTS_DIR)/%.ln: $(UTSBASE)/intel/io/vgatext/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
+$(LINTS_DIR)/%.ln: $(UTSBASE)/intel/io/vmxnet/%.c
+ @($(LHEAD) $(LINT.c) $< $(LTAIL))
+
$(LINTS_DIR)/%.ln: $(UTSBASE)/intel/io/heci/%.c
@($(LHEAD) $(LINT.c) $< $(LTAIL))
diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDeleteFailedException.java b/usr/src/uts/intel/brand/sngl/sngl_brand_asm.s
index 88237fd948..90932a9d6d 100644
--- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/client/pmDeleteFailedException.java
+++ b/usr/src/uts/intel/brand/sngl/sngl_brand_asm.s
@@ -19,25 +19,13 @@
* CDDL HEADER END
*/
/*
- *
- * ident "%Z%%M% %I% %E% SMI"
- *
- * Copyright (c) 1999 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * pmDeleteFailedException.java
- *
+ * Copyright 2012, Joyent, Inc. All rights reserved.
*/
-package com.sun.admin.pm.client;
-
-import java.lang.*;
+#define XXX_emulation_table sngl_emulation_table
+#define XXX_brand_syscall32_callback sngl_brand_syscall32_callback
+#define XXX_brand_syscall_callback sngl_brand_syscall_callback
+#define XXX_brand_sysenter_callback sngl_brand_sysenter_callback
+#define XXX_brand_int91_callback sngl_brand_int91_callback
-class pmDeleteFailedException extends pmGuiException {
- public pmDeleteFailedException(String s) {
- super(s);
- }
- public pmDeleteFailedException() {
- super();
- }
-}
+#include "../common/brand_solaris.s"
diff --git a/usr/src/uts/intel/core_pcbe/Makefile b/usr/src/uts/intel/core_pcbe/Makefile
index d9d9b02de0..7f2d1ad8e5 100644
--- a/usr/src/uts/intel/core_pcbe/Makefile
+++ b/usr/src/uts/intel/core_pcbe/Makefile
@@ -34,7 +34,7 @@ UTSBASE = ../..
MODULE = pcbe.GenuineIntel.6.15
OBJECTS = $(CORE_PCBE_OBJS:%=$(OBJS_DIR)/%)
LINTS = $(CORE_PCBE_OBJS:%.o=$(LINTS_DIR)/%.ln)
-ROOTMODULE = $(USR_PCBE_DIR)/$(MODULE)
+ROOTMODULE = $(ROOT_PSM_PCBE_DIR)/$(MODULE)
SOFTLINKS = pcbe.GenuineIntel.6.23 \
pcbe.GenuineIntel.6.26 \
pcbe.GenuineIntel.6.28 \
@@ -45,7 +45,7 @@ SOFTLINKS = pcbe.GenuineIntel.6.23 \
pcbe.GenuineIntel.6.44 \
pcbe.GenuineIntel.6.46 \
pcbe.GenuineIntel.6.47
-ROOTSOFTLINKS = $(SOFTLINKS:%=$(USR_PCBE_DIR)/%)
+ROOTSOFTLINKS = $(SOFTLINKS:%=$(ROOT_PSM_PCBE_DIR)/%)
#
# Include common rules.
diff --git a/usr/src/uts/intel/dr_sas/Makefile b/usr/src/uts/intel/dr_sas/Makefile
new file mode 100644
index 0000000000..f4871b694a
--- /dev/null
+++ b/usr/src/uts/intel/dr_sas/Makefile
@@ -0,0 +1,90 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# uts/intel/dr_sas/Makefile
+#
+# This makefile drives the production of the dr_sas driver kernel module.
+#
+# intel implementation architecture dependent
+#
+
+#
+# Path to the base of the uts directory tree (usually /usr/src/uts).
+#
+UTSBASE = ../..
+
+#
+# Define the module and object file sets.
+#
+MODULE = dr_sas
+OBJECTS = $(DR_SAS_OBJS:%=$(OBJS_DIR)/%)
+LINTS = $(DR_SAS_OBJS:%.o=$(LINTS_DIR)/%.ln)
+ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
+CONF_SRCDIR = $(UTSBASE)/common/io/dr_sas
+
+#
+# Include common rules.
+#
+include $(UTSBASE)/intel/Makefile.intel
+
+#
+# Define targets
+#
+ALL_TARGET = $(BINARY) $(CONFMOD)
+LINT_TARGET = $(MODULE).lint
+INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
+
+#
+# Kernel Module Dependencies
+#
+LDFLAGS += -dy -Nmisc/scsi
+
+CERRWARN += -_gcc=-Wno-unused-label
+CERRWARN += -_gcc=-Wno-switch
+CERRWARN += -_gcc=-Wno-uninitialized
+
+#
+# Default build targets.
+#
+.KEEP_STATE:
+
+def: $(DEF_DEPS)
+
+all: $(ALL_DEPS)
+
+clean: $(CLEAN_DEPS)
+
+clobber: $(CLOBBER_DEPS)
+
+lint: $(LINT_DEPS)
+
+modlintlib: $(MODLINTLIB_DEPS)
+
+clean.lint: $(CLEAN_LINT_DEPS)
+
+install: $(INSTALL_DEPS)
+
+#
+# Include common targets.
+#
+include $(UTSBASE)/intel/Makefile.targ
diff --git a/usr/src/uts/intel/dtrace/Makefile b/usr/src/uts/intel/dtrace/Makefile
index ba914bcbaa..aeabf4a7e3 100644
--- a/usr/src/uts/intel/dtrace/Makefile
+++ b/usr/src/uts/intel/dtrace/Makefile
@@ -49,6 +49,8 @@ CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-type-limits
CERRWARN += -_gcc=-Wno-uninitialized
+CPPFLAGS += -I$(SRC)/common/util
+
ALL_TARGET = $(BINARY) $(SRC_CONFILE)
LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
diff --git a/usr/src/uts/intel/dtrace/sdt.c b/usr/src/uts/intel/dtrace/sdt.c
index 38be2233b1..27cb19e06c 100644
--- a/usr/src/uts/intel/dtrace/sdt.c
+++ b/usr/src/uts/intel/dtrace/sdt.c
@@ -23,6 +23,9 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#include <sys/modctl.h>
#include <sys/sunddi.h>
@@ -419,9 +422,19 @@ sdt_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
dtrace_invop_add(sdt_invop);
for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) {
+ uint32_t priv;
+
+ if (prov->sdtp_priv == DTRACE_PRIV_NONE) {
+ priv = DTRACE_PRIV_KERNEL;
+ sdt_pops.dtps_mode = NULL;
+ } else {
+ priv = prov->sdtp_priv;
+ ASSERT(priv == DTRACE_PRIV_USER);
+ sdt_pops.dtps_mode = sdt_mode;
+ }
+
if (dtrace_register(prov->sdtp_name, prov->sdtp_attr,
- DTRACE_PRIV_KERNEL, NULL,
- &sdt_pops, prov, &prov->sdtp_id) != 0) {
+ priv, NULL, &sdt_pops, prov, &prov->sdtp_id) != 0) {
cmn_err(CE_WARN, "failed to register sdt provider %s",
prov->sdtp_name);
}
diff --git a/usr/src/cmd/lp/lib/requests/Makefile b/usr/src/uts/intel/hyprlofs/Makefile
index 06cabd5cb3..919b045617 100644
--- a/usr/src/cmd/lp/lib/requests/Makefile
+++ b/usr/src/uts/intel/hyprlofs/Makefile
@@ -20,49 +20,64 @@
# CDDL HEADER END
#
#
+# uts/intel/hyprlofs/Makefile
+#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
+# This makefile drives the production of the hyprlofs file system
+# kernel module.
#
-# cmd/lp/lib/requests/Makefile
+# intel architecture dependent
#
-LIBRARY = liblpreq.a
+#
+# Path to the base of the uts directory tree (usually /usr/src/uts).
+#
+UTSBASE = ../..
-OBJECTS = anyrequests.o \
- freerequest.o \
- getrequest.o \
- r_head.o \
- putrequest.o
+#
+# Define the module and object file sets.
+#
+MODULE = hyprlofs
+OBJECTS = $(HYPRLOFS_OBJS:%=$(OBJS_DIR)/%)
+LINTS = $(HYPRLOFS_OBJS:%.o=$(LINTS_DIR)/%.ln)
+ROOTMODULE = $(ROOT_FS_DIR)/$(MODULE)
+#
+# Include common rules.
+#
+include $(UTSBASE)/intel/Makefile.intel
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
+#
+# Define targets
+#
+ALL_TARGET = $(BINARY)
+LINT_TARGET = $(MODULE).lint
+INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
+#
+# Default build targets.
+#
+.KEEP_STATE:
-CPPFLAGS = -I../../include $(CPPFLAGS.master) $(C_PICFLAGS)
+def: $(DEF_DEPS)
-POFILE = lp_lib_requests.po
+all: $(ALL_DEPS)
-.KEEP_STATE:
+clean: $(CLEAN_DEPS)
-all install : $(LIBS)
+clobber: $(CLOBBER_DEPS)
-include ../../../../lib/Makefile.targ
+lint: $(LINT_DEPS)
-CLEANFILES += llib-llpreq.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-LINT_CPPFLAGS = -I../../include $(CPPFLAGS.master)
+modlintlib: $(MODLINTLIB_DEPS)
-lint: lintlib
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) $(SRCS)
+clean.lint: $(CLEAN_LINT_DEPS)
-lintlib:
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) -o lpreq llib-llpreq
+install: $(INSTALL_DEPS)
-include ../Makefile.msg
+#
+# Include common targets.
+#
+include $(UTSBASE)/intel/Makefile.targ
diff --git a/usr/src/uts/intel/io/acpica/changes.txt b/usr/src/uts/intel/io/acpica/changes.txt
index f53fd426da..69dcdf708c 100644
--- a/usr/src/uts/intel/io/acpica/changes.txt
+++ b/usr/src/uts/intel/io/acpica/changes.txt
@@ -1,7 +1,588 @@
----------------------------------------
-27 May 2011. Summary of changes for version 20110527:
+20 March 2012. Summary of changes for version 20120320:
+
+This release is available at www.acpica.org/downloads.
+The ACPI 5.0 specification is available at www.acpi.info.
+
+1) ACPICA Core Subsystem:
+
+Enhanced the sleep/wake interfaces to optionally execute the _GTS method
+(Going To Sleep) and the _BFS method (Back From Sleep). Windows apparently
+does not execute these methods, and therefore these methods are often
+untested. It has been seen on some systems where the execution of these
+methods causes errors and also prevents the machine from entering S5. It is
+therefore suggested that host operating systems do not execute these methods
+by default. In the future, perhaps these methods can be optionally executed
+based on the age of the system and/or what is the newest version of Windows
+that the BIOS asks for via _OSI. Changed interfaces: AcpiEnterSleepState and
+AcpileaveSleepStatePrep. See the ACPICA reference and Linux BZ 13041. Lin
+Ming.
+
+Fixed a problem where the length of the local/common FADT was set too early.
+The local FADT table length cannot be set to the common length until the
+original length has been examined. There is code that checks the table length
+and sets various fields appropriately. This can affect older machines with
+early FADT versions. For example, this can cause inadvertent writes to the
+CST_CNT register. Julian Anastasov.
+
+Fixed a mapping issue related to a physical table override. Use the deferred
+mapping mechanism for tables loaded via the physical override OSL interface.
+This allows for early mapping before the virtual memory manager is available.
+Thomas Renninger, Bob Moore.
+
+Enhanced the automatic return-object repair code: Repair a common problem with
+predefined methods that are defined to return a variable-length Package of
+sub-objects. If there is only one sub-object, some BIOS ASL code mistakenly
+simply returns the single object instead of a Package with one sub-object.
+This new support will repair this error by wrapping a Package object around
+the original object, creating the correct and expected Package with one sub-
+object. Names that can be repaired in this manner include: _ALR, _CSD, _HPX,
+_MLS, _PLD, _PRT, _PSS, _TRT, _TSS, _BCL, _DOD, _FIX, and _Sx. ACPICA BZ 939.
+
+Changed the exception code returned for invalid ACPI paths passed as
+parameters to external interfaces such as AcpiEvaluateObject. Was
+AE_BAD_PARAMETER, now is the more sensible AE_BAD_PATHNAME.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug
+version of the code includes the debug output trace mechanism and has a much
+larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 93.0K Code, 25.0K Data, 118.0K Total
+ Debug Version: 172.5K Code, 73.2K Data, 245.7K Total
+ Current Release:
+ Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total
+ Debug Version: 172.5K Code, 73.2K Data, 245.7K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Added the infrastructure and initial implementation of a integrated C-
+like preprocessor. This will simplify BIOS development process by eliminating
+the need for a separate preprocessing step during builds. On Windows, it also
+eliminates the need to install a separate C compiler. ACPICA BZ 761. Some
+features including full #define() macro support are still under development.
+These preprocessor directives are supported:
+ #define
+ #elif
+ #else
+ #endif
+ #error
+ #if
+ #ifdef
+ #ifndef
+ #include
+ #pragma message
+ #undef
+ #warning
+In addition, these new command line options are supported:
+ -D <symbol> Define symbol for preprocessor use
+ -li Create preprocessed output file (*.i)
+ -P Preprocess only and create preprocessor output file (*.i)
+
+Table Compiler: Fixed a problem where the equals operator within an expression
+did not work properly.
+
+Updated iASL to use the current versions of Bison/Flex. Updated the Windows
+project file to invoke these tools from the standard location. ACPICA BZ 904.
+Versions supported:
+ Flex for Windows: V2.5.4
+ Bison for Windows: V2.4.1
+
+----------------------------------------
+15 February 2012. Summary of changes for version 20120215:
+
+This release is available at www.acpica.org/downloads.
+The ACPI 5.0 specification is available at www.acpi.info.
+
+1) ACPICA Core Subsystem:
+
+There have been some major changes to the sleep/wake support code, as
+described below (a - e).
+
+a) The AcpiLeaveSleepState has been split into two interfaces, similar to
+AcpiEnterSleepStatePrep and AcpiEnterSleepState. The new interface is
+AcpiLeaveSleepStatePrep. This allows the host to perform actions between the
+time the _BFS method is called and the _WAK method is called. NOTE: all hosts
+must update their wake/resume code or else sleep/wake will not work properly.
+Rafael Wysocki.
+
+b) In AcpiLeaveSleepState, now enable all runtime GPEs before calling the _WAK
+method. Some machines require that the GPEs are enabled before the _WAK method
+is executed. Thomas Renninger.
+
+c) In AcpiLeaveSleepState, now always clear the WAK_STS (wake status) bit.
+Some BIOS code assumes that WAK_STS will be cleared on resume and use it to
+determine whether the system is rebooting or resuming. Matthew Garrett.
+
+d) Move the invocations of _GTS (Going To Sleep) and _BFS (Back From Sleep) to
+match the ACPI specification requirement. Rafael Wysocki.
+
+e) Implemented full support for the ACPI 5.0 SleepStatus and SleepControl
+registers within the V5 FADT. This support adds two new files:
+hardware/hwesleep.c implements the support for the new registers. Moved all
+sleep/wake external interfaces to hardware/hwxfsleep.c.
+
+
+Added a new OSL interface for ACPI table overrides,
+AcpiOsPhysicalTableOverride. This interface allows the host to override a
+table via a physical address, instead of the logical address required by
+AcpiOsTableOverride. This simplifies the host implementation. Initial
+implementation by Thomas Renninger. The ACPICA implementation creates a single
+shared function for table overrides that attempts both a logical and a
+physical override.
+
+Expanded the OSL memory read/write interfaces to 64-bit data
+(AcpiOsReadMemory, AcpiOsWriteMemory.) This enables full 64-bit memory
+transfer support for GAS register structures passed to AcpiRead and AcpiWrite.
+
+Implemented the ACPI_REDUCED_HARDWARE option to allow the creation of a custom
+build of ACPICA that supports only the ACPI 5.0 reduced hardware (SoC) model.
+See the ACPICA reference for details. ACPICA BZ 942. This option removes about
+10% of the code and 5% of the static data, and the following hardware ACPI
+features become unavailable:
+ PM Event and Control registers
+ SCI interrupt (and handler)
+ Fixed Events
+ General Purpose Events (GPEs)
+ Global Lock
+ ACPI PM timer
+ FACS table (Waking vectors and Global Lock)
+
+Updated the unix tarball directory structure to match the ACPICA git source
+tree. This ensures that the generic unix makefiles work properly (in
+generate/unix). Also updated the Linux makefiles to match. ACPICA BZ 867.
+
+Updated the return value of the _REV predefined method to integer value 5 to
+reflect ACPI 5.0 support.
+
+Moved the external ACPI PM timer interface prototypes to the public acpixf.h
+file where they belong.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug
+version of the code includes the debug output trace mechanism and has a much
+larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 92.8K Code, 24.9K Data, 117.7K Total
+ Debug Version: 171.7K Code, 72.9K Data, 244.5K Total
+ Current Release:
+ Non-Debug Version: 93.0K Code, 25.0K Data, 118.0K Total
+ Debug Version: 172.5K Code, 73.2K Data, 245.7K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Fixed a problem with the new ACPI 5.0 serial resource
+descriptors (I2C, SPI, UART) where the resource produce/consumer bit was
+incorrectly displayed.
+
+AcpiHelp: Add display of ACPI/PNP device IDs that are defined in the ACPI
+specification.
+
+----------------------------------------
+11 January 2012. Summary of changes for version 20120111:
+
+This release is available at www.acpica.org/downloads.
+The ACPI 5.0 specification is available at www.acpi.info.
+
+1) ACPICA Core Subsystem:
+
+Implemented a new mechanism to allow host device drivers to check for address
+range conflicts with ACPI Operation Regions. Both SystemMemory and SystemIO
+address spaces are supported. A new external interface, AcpiCheckAddressRange,
+allows drivers to check an address range against the ACPI namespace. See the
+ACPICA reference for additional details. Adds one new file,
+utilities/utaddress.c. Lin Ming, Bob Moore.
+
+Fixed several issues with the ACPI 5.0 FADT support: Add the sleep Control and
+Status registers, update the ACPI 5.0 flags, and update internal data
+structures to handle an FADT larger than 256 bytes. The size of the ACPI 5.0
+FADT is 268 bytes.
+
+Updated all ACPICA copyrights and signons to 2012. Added the 2012 copyright to
+all module headers and signons, including the standard Linux header. This
+affects virtually every file in the ACPICA core subsystem, iASL compiler, and
+all ACPICA utilities.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug
+version of the code includes the debug output trace mechanism and has a much
+larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 92.3K Code, 24.9K Data, 117.2K Total
+ Debug Version: 170.8K Code, 72.6K Data, 243.4K Total
+ Current Release:
+ Non-Debug Version: 92.8K Code, 24.9K Data, 117.7K Total
+ Debug Version: 171.7K Code, 72.9K Data, 244.5K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: fixed a problem with the automatic resource tag generation
+support. Fixes a problem where the resource tags are inadvertently not
+constructed if the table being disassembled contains external references to
+control methods. Moved the actual construction of the tags to after the final
+namespace is constructed (after 2nd parse is invoked due to external control
+method references.) ACPICA BZ 941.
+
+Table Compiler: Make all "generic" operators caseless. These are the operators
+like UINT8, String, etc. Making these caseless improves ease-of-use. ACPICA BZ
+934.
+
+----------------------------------------
+23 November 2011. Summary of changes for version 20111123:
+
+0) ACPI 5.0 Support:
+
+This release contains full support for the ACPI 5.0 specification, as
+summarized below.
+
+Reduced Hardware Support:
+-------------------------
+
+This support allows for ACPI systems without the usual ACPI hardware. This
+support is enabled by a flag in the revision 5 FADT. If it is set, ACPICA will
+not attempt to initialize or use any of the usual ACPI hardware. Note, when
+this flag is set, all of the following ACPI hardware is assumed to be not
+present and is not initialized or accessed:
+
+ General Purpose Events (GPEs)
+ Fixed Events (PM1a/PM1b and PM Control)
+ Power Management Timer and Console Buttons (power/sleep)
+ Real-time Clock Alarm
+ Global Lock
+ System Control Interrupt (SCI)
+ The FACS is assumed to be non-existent
+
+ACPI Tables:
+------------
+
+All new tables and updates to existing tables are fully supported in the
+ACPICA headers (for use by device drivers), the disassembler, and the iASL
+Data Table Compiler. ACPI 5.0 defines these new tables:
+
+ BGRT /* Boot Graphics Resource Table */
+ DRTM /* Dynamic Root of Trust for Measurement table */
+ FPDT /* Firmware Performance Data Table */
+ GTDT /* Generic Timer Description Table */
+ MPST /* Memory Power State Table */
+ PCCT /* Platform Communications Channel Table */
+ PMTT /* Platform Memory Topology Table */
+ RASF /* RAS Feature table */
+
+Operation Regions/SpaceIDs:
+---------------------------
+
+All new operation regions are fully supported by the iASL compiler, the
+disassembler, and the ACPICA runtime code (for dispatch to region handlers.)
+The new operation region Space IDs are:
+
+ GeneralPurposeIo
+ GenericSerialBus
+
+Resource Descriptors:
+---------------------
+
+All new ASL resource descriptors are fully supported by the iASL compiler, the
+ASL/AML disassembler, and the ACPICA runtime Resource Manager code (including
+all new predefined resource tags). New descriptors are:
+
+ FixedDma
+ GpioIo
+ GpioInt
+ I2cSerialBus
+ SpiSerialBus
+ UartSerialBus
+
+ASL/AML Operators, New and Modified:
+------------------------------------
+
+One new operator is added, the Connection operator, which is used to associate
+a GeneralPurposeIo or GenericSerialBus resource descriptor with individual
+field objects within an operation region. Several new protocols are associated
+with the AccessAs operator. All are fully supported by the iASL compiler,
+disassembler, and runtime ACPICA AML interpreter:
+
+ Connection // Declare Field Connection attributes
+ AccessAs: AttribBytes (n) // Read/Write N-Bytes Protocol
+ AccessAs: AttribRawBytes (n) // Raw Read/Write N-Bytes Protocol
+ AccessAs: AttribRawProcessBytes (n) // Raw Process Call Protocol
+ RawDataBuffer // Data type for Vendor Data fields
+
+Predefined ASL/AML Objects:
+---------------------------
+
+All new predefined objects/control-methods are supported by the iASL compiler
+and the ACPICA runtime validation/repair (arguments and return values.) New
+predefined names include the following:
+
+Standard Predefined Names (Objects or Control Methods):
+ _AEI, _CLS, _CPC, _CWS, _DEP,
+ _DLM, _EVT, _GCP, _CRT, _GWS,
+ _HRV, _PRE, _PSE, _SRT, _SUB.
+
+Resource Tags (Names used to access individual fields within resource
+descriptors):
+ _DBT, _DPL, _DRS, _END, _FLC,
+ _IOR, _LIN, _MOD, _PAR, _PHA,
+ _PIN, _PPI, _POL, _RXL, _SLV,
+ _SPE, _STB, _TXL, _VEN.
+
+ACPICA External Interfaces:
+---------------------------
+
+Several new interfaces have been defined for use by ACPI-related device
+drivers and other host OS services:
+
+AcpiAcquireMutex and AcpiReleaseMutex: These interfaces allow the host OS to
+acquire and release AML mutexes that are defined in the DSDT/SSDT tables
+provided by the BIOS. They are intended to be used in conjunction with the
+ACPI 5.0 _DLM (Device Lock Method) in order to provide transaction-level
+mutual exclusion with the AML code/interpreter.
+
+AcpiGetEventResources: Returns the (formatted) resource descriptors as defined
+by the ACPI 5.0 _AEI object (ACPI Event Information). This object provides
+resource descriptors associated with hardware-reduced platform events, similar
+to the AcpiGetCurrentResources interface.
+
+Operation Region Handlers: For General Purpose IO and Generic Serial Bus
+operation regions, information about the Connection() object and any optional
+length information is passed to the region handler within the Context
+parameter.
+
+AcpiBufferToResource: This interface converts a raw AML buffer containing a
+resource template or resource descriptor to the ACPI_RESOURCE internal format
+suitable for use by device drivers. Can be used by an operation region handler
+to convert the Connection() buffer object into a ACPI_RESOURCE.
+
+Miscellaneous/Tools/TestSuites:
+-------------------------------
+
+Support for extended _HID names (Four alpha characters instead of three).
+Support for ACPI 5.0 features in the AcpiExec and AcpiHelp utilities.
+Support for ACPI 5.0 features in the ASLTS test suite.
+Fully updated documentation (ACPICA and iASL reference documents.)
+
+ACPI Table Definition Language:
+-------------------------------
+
+Support for this language was implemented and released as a subsystem of the
+iASL compiler in 2010. (See the iASL compiler User Guide.)
+
+
+Non-ACPI 5.0 changes for this release:
+--------------------------------------
+
+1) ACPICA Core Subsystem:
+
+Fix a problem with operation region declarations where a failure can occur if
+the region name and an argument that evaluates to an object (such as the
+region address) are in different namespace scopes. Lin Ming, ACPICA BZ 937.
+
+Do not abort an ACPI table load if an invalid space ID is found within. This
+will be caught later if the offending method is executed. ACPICA BZ 925.
+
+Fixed an issue with the FFixedHW space ID where the ID was not always
+recognized properly (Both ACPICA and iASL). ACPICA BZ 926.
+
+Fixed a problem with the 32-bit generation of the unix-specific OSL
+(osunixxf.c). Lin Ming, ACPICA BZ 936.
+
+Several changes made to enable generation with the GCC 4.6 compiler. ACPICA BZ
+935.
+
+New error messages: Unsupported I/O requests (not 8/16/32 bit), and Index/Bank
+field registers out-of-range.
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Implemented the __PATH__ operator, which returns the full pathname of
+the current source file.
-This release is available at www.acpica.org/downloads
+AcpiHelp: Automatically display expanded keyword information for all ASL
+operators.
+
+Debugger: Add "Template" command to disassemble/dump resource template
+buffers.
+
+Added a new master script to generate and execute the ASLTS test suite.
+Automatically handles 32- and 64-bit generation. See tests/aslts.sh
+
+iASL: Fix problem with listing generation during processing of the Switch()
+operator where AML listing was disabled until the entire Switch block was
+completed.
+
+iASL: Improve support for semicolon statement terminators. Fix "invalid
+character" message for some cases when the semicolon is used. Semicolons are
+now allowed after every <Term> grammar element. ACPICA BZ 927.
+
+iASL: Fixed some possible aliasing warnings during generation. ACPICA BZ 923.
+
+Disassembler: Fix problem with disassembly of the DataTableRegion operator
+where an inadvertent "Unhandled deferred opcode" message could be generated.
+
+3) Example Code and Data Size
+
+These are the sizes for the OS-independent acpica.lib produced by the
+Microsoft Visual C++ 9.0 32-bit compiler. The debug version of the code
+includes the debug output trace mechanism and has a much larger code and data
+size.
+
+ Previous Release:
+ Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total
+ Debug Version: 165.6K Code, 68.4K Data, 234.0K Total
+ Current Release:
+ Non-Debug Version: 92.3K Code, 24.9K Data, 117.2K Total
+ Debug Version: 170.8K Code, 72.6K Data, 243.4K Total
+
+----------------------------------------
+22 September 2011. Summary of changes for version 20110922:
+
+0) ACPI 5.0 News:
+
+Support for ACPI 5.0 in ACPICA has been underway for several months and will
+be released at the same time that ACPI 5.0 is officially released.
+
+The ACPI 5.0 specification is on track for release in the next few months.
+
+1) ACPICA Core Subsystem:
+
+Fixed a problem where the maximum sleep time for the Sleep() operator was
+intended to be limited to two seconds, but was inadvertently limited to 20
+seconds instead.
+
+Linux and Unix makefiles: Added header file dependencies to ensure correct
+generation of ACPICA core code and utilities. Also simplified the makefiles
+considerably through the use of the vpath variable to specify search paths.
+ACPICA BZ 924.
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Implemented support to check the access length for all fields created to
+access named Resource Descriptor fields. For example, if a resource field is
+defined to be two bits, a warning is issued if a CreateXxxxField() is used
+with an incorrect bit length. This is implemented for all current resource
+descriptor names. ACPICA BZ 930.
+
+Disassembler: Fixed a byte ordering problem with the output of 24-bit and 56-
+bit integers.
+
+iASL: Fixed a couple of issues associated with variable-length package
+objects. 1) properly handle constants like One, Ones, Zero -- do not make a
+VAR_PACKAGE when these are used as a package length. 2) Allow the VAR_PACKAGE
+opcode (in addition to PACKAGE) when validating object types for predefined
+names.
+
+iASL: Emit statistics for all output files (instead of just the ASL input and
+AML output). Includes listings, hex files, etc.
+
+iASL: Added -G option to the table compiler to allow the compilation of custom
+ACPI tables. The only part of a table that is required is the standard 36-byte
+ACPI header.
+
+AcpiXtract: Ported to the standard ACPICA environment (with ACPICA headers),
+which also adds correct 64-bit support. Also, now all output filenames are
+completely lower case.
+
+AcpiExec: Ignore any non-AML tables (tables other than DSDT or SSDT) when
+loading table files. A warning is issued for any such tables. The only
+exception is an FADT. This also fixes a possible fault when attempting to load
+non-AML tables. ACPICA BZ 932.
+
+AcpiHelp: Added the AccessAs and Offset operators. Fixed a problem where a
+missing table terminator could cause a fault when using the -p option.
+
+AcpiSrc: Fixed a possible divide-by-zero fault when generating file
+statistics.
+
+3) Example Code and Data Size
+
+These are the sizes for the OS-independent acpica.lib produced by the
+Microsoft Visual C++ 9.0 32-bit compiler. The debug version of the code
+includes the debug output trace mechanism and has a much larger code and data
+size.
+
+ Previous Release (VC 9.0):
+ Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total
+ Debug Version: 165.6K Code, 68.4K Data, 234.0K Total
+ Current Release (VC 9.0):
+ Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total
+ Debug Version: 165.6K Code, 68.4K Data, 234.0K Total
+
+
+----------------------------------------
+23 June 2011. Summary of changes for version 20110623:
+
+1) ACPI CA Core Subsystem:
+
+Updated the predefined name repair mechanism to not attempt repair of a _TSS
+return object if a _PSS object is present. We can only sort the _TSS return
+package if there is no _PSS within the same scope. This is because if _PSS is
+present, the ACPI specification dictates that the _TSS Power Dissipation field
+is to be ignored, and therefore some BIOSs leave garbage values in the _TSS
+Power field(s). In this case, it is best to just return the _TSS package as-
+is. Reported by, and fixed with assistance from Fenghua Yu.
+
+Added an option to globally disable the control method return value validation
+and repair. This runtime option can be used to disable return value repair if
+this is causing a problem on a particular machine. Also added an option to
+AcpiExec (-dr) to set this disable flag.
+
+All makefiles and project files: Major changes to improve generation of ACPICA
+tools. ACPICA BZ 912:
+ Reduce default optimization levels to improve compatibility
+ For Linux, add strict-aliasing=0 for gcc 4
+ Cleanup and simplify use of command line defines
+ Cleanup multithread library support
+ Improve usage messages
+
+Linux-specific header: update handling of THREAD_ID and pthread. For the 32-
+bit case, improve casting to eliminate possible warnings, especially with the
+acpica tools.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug
+version of the code includes the debug output trace mechanism and has a much
+larger code and data size.
+
+ Previous Release (VC 9.0):
+ Non-Debug Version: 90.1K Code, 23.9K Data, 114.0K Total
+ Debug Version: 165.6K Code, 68.4K Data, 234.0K Total
+ Current Release (VC 9.0):
+ Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total
+ Debug Version: 165.6K Code, 68.4K Data, 234.0K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+With this release, a new utility named "acpihelp" has been added to the ACPICA
+package. This utility summarizes the ACPI specification chapters for the ASL
+and AML languages. It generates under Linux/Unix as well as Windows, and
+provides the following functionality:
+ Find/display ASL operator(s) -- with description and syntax.
+ Find/display ASL keyword(s) -- with exact spelling and descriptions.
+ Find/display ACPI predefined name(s) -- with description, number
+ of arguments, and the return value data type.
+ Find/display AML opcode name(s) -- with opcode, arguments, and grammar.
+ Decode/display AML opcode -- with opcode name, arguments, and grammar.
+
+Service Layers: Make multi-thread support configurable. Conditionally compile
+the multi-thread support so that threading libraries will not be linked if not
+necessary. The only tool that requires multi-thread support is AcpiExec.
+
+iASL: Update yyerrror/AslCompilerError for "const" errors. Newer versions of
+Bison appear to want the interface to yyerror to be a const char * (or at
+least this is a problem when generating iASL on some systems.) ACPICA BZ 923
+Pierre Lejeune.
+
+Tools: Fix for systems where O_BINARY is not defined. Only used for Windows
+versions of the tools.
+
+----------------------------------------
+27 May 2011. Summary of changes for version 20110527:
1) ACPI CA Core Subsystem:
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbcmds.c b/usr/src/uts/intel/io/acpica/debugger/dbcmds.c
index 73387b872c..459cd916ee 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbcmds.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbcmds.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,6 +46,7 @@
#include "accommon.h"
#include "acevents.h"
#include "acdebug.h"
+#include "acnamesp.h"
#include "acresrc.h"
#include "actables.h"
@@ -69,6 +70,18 @@ AcpiDmTestResourceConversion (
ACPI_NAMESPACE_NODE *Node,
char *Name);
+static ACPI_STATUS
+AcpiDbResourceCallback (
+ ACPI_RESOURCE *Resource,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDbDeviceResources (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
/*******************************************************************************
*
@@ -148,28 +161,49 @@ AcpiDbSleep (
UINT8 SleepState;
+ ACPI_FUNCTION_TRACE (AcpiDbSleep);
+
+
SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0);
AcpiOsPrintf ("**** Prepare to sleep ****\n");
Status = AcpiEnterSleepStatePrep (SleepState);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ goto ErrorExit;
}
AcpiOsPrintf ("**** Going to sleep ****\n");
- Status = AcpiEnterSleepState (SleepState);
+ Status = AcpiEnterSleepState (SleepState, ACPI_NO_OPTIONAL_METHODS);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ goto ErrorExit;
}
- AcpiOsPrintf ("**** returning from sleep ****\n");
+ AcpiOsPrintf ("**** Prepare to return from sleep ****\n");
+ Status = AcpiLeaveSleepStatePrep (SleepState, ACPI_NO_OPTIONAL_METHODS);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ AcpiOsPrintf ("**** Returning from sleep ****\n");
Status = AcpiLeaveSleepState (SleepState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
return (Status);
+
+
+ErrorExit:
+
+ ACPI_EXCEPTION ((AE_INFO, Status, "During sleep test"));
+ return (Status);
}
+
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayLocks
@@ -339,25 +373,20 @@ AcpiDbSendNotify (
return;
}
- /* Decode Named object type */
+ /* Dispatch the notify if legal */
- switch (Node->Type)
+ if (AcpiEvIsNotifyObject (Node))
{
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
-
- /* Send the notify */
-
Status = AcpiEvQueueNotifyRequest (Node, Value);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not queue notify\n");
}
- break;
-
- default:
- AcpiOsPrintf ("Named object is not a device or a thermal object\n");
- break;
+ }
+ else
+ {
+ AcpiOsPrintf ("Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type));
}
}
@@ -456,6 +485,78 @@ AcpiDbDisplayInterfaces (
/*******************************************************************************
*
+ * FUNCTION: AcpiDbDisplayTemplate
+ *
+ * PARAMETERS: BufferArg - Buffer name or addrss
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump a buffer that contains a resource template
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayTemplate (
+ char *BufferArg)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_BUFFER ReturnObj;
+
+
+ /* Translate BufferArg to an Named object */
+
+ Node = AcpiDbConvertToNode (BufferArg);
+ if (!Node || (Node == AcpiGbl_RootNode))
+ {
+ AcpiOsPrintf ("Invalid argument: %s\n", BufferArg);
+ return;
+ }
+
+ /* We must have a buffer object */
+
+ if (Node->Type != ACPI_TYPE_BUFFER)
+ {
+ AcpiOsPrintf ("Not a Buffer object, cannot be a template: %s\n",
+ BufferArg);
+ return;
+ }
+
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+
+ /* Attempt to convert the raw buffer to a resource list */
+
+ Status = AcpiRsCreateResourceList (Node->Object, &ReturnObj);
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiDbgLevel |= ACPI_LV_RESOURCES;
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not convert Buffer to a resource list: %s, %s\n",
+ BufferArg, AcpiFormatException (Status));
+ goto DumpBuffer;
+ }
+
+ /* Now we can dump the resource list */
+
+ AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
+ ReturnObj.Pointer));
+
+DumpBuffer:
+ AcpiOsPrintf ("\nRaw data buffer:\n");
+ AcpiUtDumpBuffer ((UINT8 *) Node->Object->Buffer.Pointer,
+ Node->Object->Buffer.Length,
+ DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+ return;
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDmCompareAmlResources
*
* PARAMETERS: Aml1Buffer - Contains first resource list
@@ -479,11 +580,14 @@ AcpiDmCompareAmlResources (
{
UINT8 *Aml1;
UINT8 *Aml2;
+ UINT8 *Aml1End;
+ UINT8 *Aml2End;
ACPI_RSDESC_SIZE Aml1Length;
ACPI_RSDESC_SIZE Aml2Length;
ACPI_RSDESC_SIZE Offset = 0;
UINT8 ResourceType;
UINT32 Count = 0;
+ UINT32 i;
/* Compare overall buffer sizes (may be different due to size rounding) */
@@ -491,16 +595,18 @@ AcpiDmCompareAmlResources (
if (Aml1BufferLength != Aml2BufferLength)
{
AcpiOsPrintf (
- "**** Buffer length mismatch in converted AML: original %X new %X ****\n",
+ "**** Buffer length mismatch in converted AML: Original %X, New %X ****\n",
Aml1BufferLength, Aml2BufferLength);
}
Aml1 = Aml1Buffer;
Aml2 = Aml2Buffer;
+ Aml1End = Aml1Buffer + Aml1BufferLength;
+ Aml2End = Aml2Buffer + Aml2BufferLength;
/* Walk the descriptor lists, comparing each descriptor */
- while (Aml1 < (Aml1Buffer + Aml1BufferLength))
+ while ((Aml1 < Aml1End) && (Aml2 < Aml2End))
{
/* Get the lengths of each descriptor */
@@ -513,7 +619,7 @@ AcpiDmCompareAmlResources (
if (Aml1Length != Aml2Length)
{
AcpiOsPrintf (
- "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n",
+ "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X Len1 %X, Len2 %X ****\n",
Count, ResourceType, Offset, Aml1Length, Aml2Length);
}
@@ -524,6 +630,15 @@ AcpiDmCompareAmlResources (
AcpiOsPrintf (
"**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n",
Count, ResourceType, Offset);
+
+ for (i = 0; i < Aml1Length; i++)
+ {
+ if (Aml1[i] != Aml2[i])
+ {
+ AcpiOsPrintf ("Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n",
+ i, Aml2[i], Aml1[i]);
+ }
+ }
}
/* Exit on EndTag descriptor */
@@ -626,160 +741,301 @@ Exit1:
/*******************************************************************************
*
- * FUNCTION: AcpiDbDisplayResources
+ * FUNCTION: AcpiDbResourceCallback
*
- * PARAMETERS: ObjectArg - String with hex value of the object
+ * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK
*
- * RETURN: None
+ * RETURN: Status
*
- * DESCRIPTION: Display the resource objects associated with a device.
+ * DESCRIPTION: Simple callback to exercise AcpiWalkResources
*
******************************************************************************/
-void
-AcpiDbDisplayResources (
- char *ObjectArg)
+static ACPI_STATUS
+AcpiDbResourceCallback (
+ ACPI_RESOURCE *Resource,
+ void *Context)
+{
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDeviceResources
+ *
+ * PARAMETERS: ACPI_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display the _PRT/_CRS/_PRS resources for a device object.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbDeviceResources (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *PrtNode = NULL;
+ ACPI_NAMESPACE_NODE *CrsNode = NULL;
+ ACPI_NAMESPACE_NODE *PrsNode = NULL;
+ ACPI_NAMESPACE_NODE *AeiNode = NULL;
+ char *ParentPath;
ACPI_BUFFER ReturnObj;
+ ACPI_STATUS Status;
- AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
- AcpiDbgLevel |= ACPI_LV_RESOURCES;
+ Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
+ ParentPath = AcpiNsGetExternalPathname (Node);
+ if (!ParentPath)
+ {
+ return (AE_NO_MEMORY);
+ }
- /* Convert string to object pointer */
+ /* Get handles to the resource methods for this device */
- Node = AcpiDbConvertToNode (ObjectArg);
- if (!Node)
+ (void) AcpiGetHandle (Node, METHOD_NAME__PRT, ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode));
+ (void) AcpiGetHandle (Node, METHOD_NAME__CRS, ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode));
+ (void) AcpiGetHandle (Node, METHOD_NAME__PRS, ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode));
+ (void) AcpiGetHandle (Node, METHOD_NAME__AEI, ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode));
+ if (!PrtNode && !CrsNode && !PrsNode && !AeiNode)
{
- return;
+ goto Cleanup; /* Nothing to do */
}
+ AcpiOsPrintf ("\nDevice: %s\n", ParentPath);
+
/* Prepare for a return object of arbitrary size */
ReturnObj.Pointer = AcpiGbl_DbBuffer;
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
/* _PRT */
- AcpiOsPrintf ("Evaluating _PRT\n");
+ if (PrtNode)
+ {
+ AcpiOsPrintf ("Evaluating _PRT\n");
- /* Check if _PRT exists */
+ Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not evaluate _PRT: %s\n",
+ AcpiFormatException (Status));
+ goto GetCrs;
+ }
- Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not obtain _PRT: %s\n",
- AcpiFormatException (Status));
- goto GetCrs;
- }
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ Status = AcpiGetIrqRoutingTable (Node, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
+ AcpiFormatException (Status));
+ goto GetCrs;
+ }
- Status = AcpiGetIrqRoutingTable (Node, &ReturnObj);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
- AcpiFormatException (Status));
- goto GetCrs;
+ AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
}
- AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
-
/* _CRS */
GetCrs:
- AcpiOsPrintf ("Evaluating _CRS\n");
+ if (CrsNode)
+ {
+ AcpiOsPrintf ("Evaluating _CRS\n");
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- /* Check if _CRS exists */
+ Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not evaluate _CRS: %s\n",
+ AcpiFormatException (Status));
+ goto GetPrs;
+ }
- Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not obtain _CRS: %s\n",
- AcpiFormatException (Status));
- goto GetPrs;
- }
+ /* This code is here to exercise the AcpiWalkResources interface */
- /* Get the _CRS resource list */
+ Status = AcpiWalkResources (Node, METHOD_NAME__CRS,
+ AcpiDbResourceCallback, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiWalkResources failed: %s\n",
+ AcpiFormatException (Status));
+ goto GetPrs;
+ }
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ /* Get the _CRS resource list */
- Status = AcpiGetCurrentResources (Node, &ReturnObj);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
- AcpiFormatException (Status));
- goto GetPrs;
- }
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- /* Dump the _CRS resource list */
+ Status = AcpiGetCurrentResources (Node, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
+ AcpiFormatException (Status));
+ goto GetPrs;
+ }
- AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
- ReturnObj.Pointer));
+ /* Dump the _CRS resource list */
- /*
- * Perform comparison of original AML to newly created AML. This tests both
- * the AML->Resource conversion and the Resource->Aml conversion.
- */
- Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
+ AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
+ ReturnObj.Pointer));
- /* Execute _SRS with the resource list */
+ /*
+ * Perform comparison of original AML to newly created AML. This tests both
+ * the AML->Resource conversion and the Resource->Aml conversion.
+ */
+ Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
- Status = AcpiSetCurrentResources (Node, &ReturnObj);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
- AcpiFormatException (Status));
- goto GetPrs;
+ /* Execute _SRS with the resource list */
+
+ Status = AcpiSetCurrentResources (Node, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
+ AcpiFormatException (Status));
+ goto GetPrs;
+ }
}
/* _PRS */
GetPrs:
- AcpiOsPrintf ("Evaluating _PRS\n");
+ if (PrsNode)
+ {
+ AcpiOsPrintf ("Evaluating _PRS\n");
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not evaluate _PRS: %s\n",
+ AcpiFormatException (Status));
+ goto GetAei;
+ }
- /* Check if _PRS exists */
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not obtain _PRS: %s\n",
- AcpiFormatException (Status));
- goto Cleanup;
+ Status = AcpiGetPossibleResources (Node, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
+ AcpiFormatException (Status));
+ goto GetAei;
+ }
+
+ AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
}
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiGetPossibleResources (Node, &ReturnObj);
- if (ACPI_FAILURE (Status))
+ /* _AEI */
+
+GetAei:
+ if (AeiNode)
{
- AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
- AcpiFormatException (Status));
- goto Cleanup;
+ AcpiOsPrintf ("Evaluating _AEI\n");
+
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not evaluate _AEI: %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
+
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiGetEventResources (Node, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiGetEventResources failed: %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
+
+ AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
}
- AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
Cleanup:
+ ACPI_FREE (ParentPath);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayResources
+ *
+ * PARAMETERS: ObjectArg - String object name or object pointer.
+ * "*" means "display resources for all devices"
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display the resource objects associated with a device.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayResources (
+ char *ObjectArg)
+{
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiDbgLevel |= ACPI_LV_RESOURCES;
+
+ /* Asterisk means "display resources for all devices" */
+
+ if (!ACPI_STRCMP (ObjectArg, "*"))
+ {
+ (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL);
+ }
+ else
+ {
+ /* Convert string to object pointer */
+
+ Node = AcpiDbConvertToNode (ObjectArg);
+ if (Node)
+ {
+ if (Node->Type != ACPI_TYPE_DEVICE)
+ {
+ AcpiOsPrintf ("%4.4s: Name is not a device object (%s)\n",
+ Node->Name.Ascii, AcpiUtGetTypeName (Node->Type));
+ }
+ else
+ {
+ (void) AcpiDbDeviceResources (Node, 0, NULL, NULL);
+ }
+ }
+ }
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
- return;
}
+#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: AcpiDbGenerateGpe
@@ -818,5 +1074,6 @@ AcpiDbGenerateGpe (
(void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
#endif /* ACPI_DEBUGGER */
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbdisply.c b/usr/src/uts/intel/io/acpica/debugger/dbdisply.c
index 61e837e751..7facc8dd08 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbdisply.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbdisply.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -90,6 +90,8 @@ static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] =
ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
+ ACPI_ADR_SPACE_GPIO,
+ ACPI_ADR_SPACE_GSBUS,
ACPI_ADR_SPACE_DATA_TABLE,
ACPI_ADR_SPACE_FIXED_HARDWARE
};
@@ -105,8 +107,8 @@ typedef struct acpi_handler_info
static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] =
{
- {&AcpiGbl_SystemNotify.Handler, "System Notifications"},
- {&AcpiGbl_DeviceNotify.Handler, "Device Notifications"},
+ {&AcpiGbl_GlobalNotify[0].Handler, "System Notifications"},
+ {&AcpiGbl_GlobalNotify[1].Handler, "Device Notifications"},
{&AcpiGbl_TableHandler, "ACPI Table Events"},
{&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
{&AcpiGbl_InterfaceHandler, "OSI Invocations"}
@@ -768,6 +770,7 @@ AcpiDbDisplayArgumentObject (
}
+#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayGpes
@@ -930,6 +933,7 @@ AcpiDbDisplayGpes (
GpeXruptInfo = GpeXruptInfo->Next;
}
}
+#endif /* !ACPI_REDUCED_HARDWARE */
/*******************************************************************************
@@ -971,7 +975,7 @@ AcpiDbDisplayHandlers (
while (HandlerObj)
{
- if (i == HandlerObj->AddressSpace.SpaceId)
+ if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId)
{
AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
(HandlerObj->AddressSpace.HandlerFlags &
@@ -989,8 +993,28 @@ AcpiDbDisplayHandlers (
FoundHandler:;
}
+
+ /* Find all handlers for user-defined SpaceIDs */
+
+ HandlerObj = ObjDesc->Device.Handler;
+ while (HandlerObj)
+ {
+ if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN)
+ {
+ AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
+ "User-defined ID", HandlerObj->AddressSpace.SpaceId);
+ AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
+ (HandlerObj->AddressSpace.HandlerFlags &
+ ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
+ HandlerObj->AddressSpace.Handler);
+ }
+
+ HandlerObj = HandlerObj->AddressSpace.Next;
+ }
}
+#if (!ACPI_REDUCED_HARDWARE)
+
/* Fixed event handlers */
AcpiOsPrintf ("\nFixed Event Handlers:\n");
@@ -1009,6 +1033,8 @@ AcpiDbDisplayHandlers (
}
}
+#endif /* !ACPI_REDUCED_HARDWARE */
+
/* Miscellaneous global handlers */
AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbexec.c b/usr/src/uts/intel/io/acpica/debugger/dbexec.c
index bcbc7a8daf..7818c9ddbe 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbexec.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbexec.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbfileio.c b/usr/src/uts/intel/io/acpica/debugger/dbfileio.c
index 8d0ef0aaa8..ef9b7fef53 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbfileio.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbfileio.c
@@ -6,7 +6,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -271,10 +271,11 @@ AcpiDbReadTable (
fseek (fp, 0, SEEK_SET);
- /* The RSDT and FACS tables do not have standard ACPI headers */
+ /* The RSDT, FACS and S3PT tables do not have standard ACPI headers */
if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") ||
- ACPI_COMPARE_NAME (TableHeader.Signature, "FACS"))
+ ACPI_COMPARE_NAME (TableHeader.Signature, "FACS") ||
+ ACPI_COMPARE_NAME (TableHeader.Signature, "S3PT"))
{
*TableLength = FileSize;
StandardHeader = FALSE;
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbhistry.c b/usr/src/uts/intel/io/acpica/debugger/dbhistry.c
index 855d6b956f..536b69cdfa 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbhistry.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbhistry.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbinput.c b/usr/src/uts/intel/io/acpica/debugger/dbinput.c
index 1d716cfb1b..0ae313934b 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbinput.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbinput.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -131,6 +131,7 @@ enum AcpiExDebuggerCommands
CMD_STATS,
CMD_STOP,
CMD_TABLES,
+ CMD_TEMPLATE,
CMD_TERMINATE,
CMD_THREADS,
CMD_TRACE,
@@ -199,6 +200,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"STATS", 0},
{"STOP", 0},
{"TABLES", 0},
+ {"TEMPLATE", 1},
{"TERMINATE", 0},
{"THREADS", 3},
{"TRACE", 1},
@@ -268,9 +270,10 @@ AcpiDbDisplayHelp (
AcpiOsPrintf (" Predefined Check all predefined names\n");
AcpiOsPrintf (" Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf (" References <Addr> Find all references to object at addr\n");
- AcpiOsPrintf (" Resources <Device> Get and display Device resources\n");
+ AcpiOsPrintf (" Resources <DeviceName | *> Display Device resources (* = all devices)\n");
AcpiOsPrintf (" Set N <NamedObject> <Value> Set value for named integer\n");
AcpiOsPrintf (" Sleep <SleepState> Simulate sleep/wake sequence\n");
+ AcpiOsPrintf (" Template <Object> Format/dump a Buffer/ResourceTemplate\n");
AcpiOsPrintf (" Terminate Delete namespace and all internal objects\n");
AcpiOsPrintf (" Type <Object> Display object type\n");
@@ -659,12 +662,15 @@ AcpiDbCommandDispatch (
break;
case CMD_ENABLEACPI:
+#if (!ACPI_REDUCED_HARDWARE)
+
Status = AcpiEnable();
if (ACPI_FAILURE(Status))
{
AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
return (Status);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
break;
case CMD_EVENT:
@@ -854,6 +860,10 @@ AcpiDbCommandDispatch (
AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
break;
+ case CMD_TEMPLATE:
+ AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]);
+ break;
+
case CMD_TERMINATE:
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiUtSubsystemShutdown ();
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbmethod.c b/usr/src/uts/intel/io/acpica/debugger/dbmethod.c
index f0b88ebdb3..0d45d68150 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbmethod.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbmethod.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbnames.c b/usr/src/uts/intel/io/acpica/debugger/dbnames.c
index e4e4280f29..be326c5390 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbnames.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbnames.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbstats.c b/usr/src/uts/intel/io/acpica/debugger/dbstats.c
index bf17c63932..fcc4998ede 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbstats.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbstats.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -227,8 +227,8 @@ AcpiDbEnumerateObject (
case ACPI_TYPE_DEVICE:
- AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify);
- AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[0]);
+ AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[1]);
AcpiDbEnumerateObject (ObjDesc->Device.Handler);
break;
@@ -248,21 +248,21 @@ AcpiDbEnumerateObject (
case ACPI_TYPE_POWER:
- AcpiDbEnumerateObject (ObjDesc->PowerResource.SystemNotify);
- AcpiDbEnumerateObject (ObjDesc->PowerResource.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[0]);
+ AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[1]);
break;
case ACPI_TYPE_PROCESSOR:
- AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify);
- AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[0]);
+ AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[1]);
AcpiDbEnumerateObject (ObjDesc->Processor.Handler);
break;
case ACPI_TYPE_THERMAL:
- AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify);
- AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[0]);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[1]);
AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler);
break;
@@ -522,6 +522,18 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE));
AcpiOsPrintf ("AcpiObject %3d\n", sizeof (ACPI_OBJECT));
+ AcpiOsPrintf ("\n");
+
+ AcpiOsPrintf ("Generic State %3d\n", sizeof (ACPI_GENERIC_STATE));
+ AcpiOsPrintf ("Common State %3d\n", sizeof (ACPI_COMMON_STATE));
+ AcpiOsPrintf ("Control State %3d\n", sizeof (ACPI_CONTROL_STATE));
+ AcpiOsPrintf ("Update State %3d\n", sizeof (ACPI_UPDATE_STATE));
+ AcpiOsPrintf ("Scope State %3d\n", sizeof (ACPI_SCOPE_STATE));
+ AcpiOsPrintf ("Parse Scope %3d\n", sizeof (ACPI_PSCOPE_STATE));
+ AcpiOsPrintf ("Package State %3d\n", sizeof (ACPI_PKG_STATE));
+ AcpiOsPrintf ("Thread State %3d\n", sizeof (ACPI_THREAD_STATE));
+ AcpiOsPrintf ("Result Values %3d\n", sizeof (ACPI_RESULT_VALUES));
+ AcpiOsPrintf ("Notify Info %3d\n", sizeof (ACPI_NOTIFY_INFO));
break;
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbutils.c b/usr/src/uts/intel/io/acpica/debugger/dbutils.c
index 5b071e87b6..cf29b225de 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbutils.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbutils.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -190,10 +190,7 @@ AcpiDbDumpExternalObject (
case ACPI_TYPE_STRING:
AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length);
- for (i = 0; i < ObjDesc->String.Length; i++)
- {
- AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
- }
+ AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
AcpiOsPrintf ("\n");
break;
@@ -208,7 +205,7 @@ AcpiDbDumpExternalObject (
AcpiOsPrintf ("\n");
}
AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
- ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
+ ObjDesc->Buffer.Length, DB_BYTE_DISPLAY, _COMPONENT);
}
else
{
diff --git a/usr/src/uts/intel/io/acpica/debugger/dbxface.c b/usr/src/uts/intel/io/acpica/debugger/dbxface.c
index e638733c22..cd30273434 100644
--- a/usr/src/uts/intel/io/acpica/debugger/dbxface.c
+++ b/usr/src/uts/intel/io/acpica/debugger/dbxface.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmbuffer.c b/usr/src/uts/intel/io/acpica/disassembler/dmbuffer.c
index f223f89f43..9f49f92e47 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmbuffer.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmbuffer.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -108,19 +108,19 @@ AcpiDmDisasmByteList (
}
AcpiDmIndent (Level);
- if (ByteCount > 7)
+ if (ByteCount > 8)
{
- AcpiOsPrintf ("/* %04X */ ", i);
+ AcpiOsPrintf ("/* %04X */ ", i);
}
}
- AcpiOsPrintf ("0x%2.2X", (UINT32) ByteData[i]);
+ AcpiOsPrintf (" 0x%2.2X", (UINT32) ByteData[i]);
/* Add comma if there are more bytes to display */
if (i < (ByteCount -1))
{
- AcpiOsPrintf (", ");
+ AcpiOsPrintf (",");
}
}
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmnames.c b/usr/src/uts/intel/io/acpica/disassembler/dmnames.c
index b00bca8e86..92e67c2e0a 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmnames.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmnames.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmobject.c b/usr/src/uts/intel/io/acpica/disassembler/dmobject.c
index 9d5d7dd92c..cb515e9427 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmobject.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmobject.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmopcode.c b/usr/src/uts/intel/io/acpica/disassembler/dmopcode.c
index 5da3847714..6d2c3e1ecf 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmopcode.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmopcode.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -303,6 +303,7 @@ AcpiDmDisassembleOneOp (
UINT32 Length;
ACPI_PARSE_OBJECT *Child;
ACPI_STATUS Status;
+ UINT8 *Aml;
if (!Op)
@@ -426,16 +427,19 @@ AcpiDmDisassembleOneOp (
* types of buffers, we have to closely look at the data in the
* buffer to determine the type.
*/
- Status = AcpiDmIsResourceTemplate (Op);
- if (ACPI_SUCCESS (Status))
+ if (!AcpiGbl_NoResourceDisassembly)
{
- Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
- AcpiOsPrintf ("ResourceTemplate");
- break;
- }
- else if (Status == AE_AML_NO_RESOURCE_END_TAG)
- {
- AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
+ Status = AcpiDmIsResourceTemplate (Op);
+ if (ACPI_SUCCESS (Status))
+ {
+ Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
+ AcpiOsPrintf ("ResourceTemplate");
+ break;
+ }
+ else if (Status == AE_AML_NO_RESOURCE_END_TAG)
+ {
+ AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
+ }
}
if (AcpiDmIsUnicodeBuffer (Op))
@@ -495,7 +499,7 @@ AcpiDmDisassembleOneOp (
if (Info->BitOffset % 8 == 0)
{
- AcpiOsPrintf (" Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
+ AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
}
else
{
@@ -507,16 +511,59 @@ AcpiDmDisassembleOneOp (
case AML_INT_ACCESSFIELD_OP:
+ case AML_INT_EXTACCESSFIELD_OP:
- AcpiOsPrintf (" AccessAs (%s, ",
- AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer >> 8) & 0x7]);
+ AcpiOsPrintf ("AccessAs (%s, ",
+ AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer & 0x7)]);
+
+ AcpiDmDecodeAttribute ((UINT8) (Op->Common.Value.Integer >> 8));
+
+ if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP)
+ {
+ AcpiOsPrintf (" (0x%2.2X)", (unsigned) ((Op->Common.Value.Integer >> 16) & 0xFF));
+ }
- AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer);
AcpiOsPrintf (")");
AcpiDmCommaIfFieldMember (Op);
break;
+ case AML_INT_CONNECTION_OP:
+
+ /*
+ * Two types of Connection() - one with a buffer object, the
+ * other with a namestring that points to a buffer object.
+ */
+ AcpiOsPrintf ("Connection (");
+ Child = Op->Common.Value.Arg;
+
+ if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
+ {
+ AcpiOsPrintf ("\n");
+
+ Aml = Child->Named.Data;
+ Length = (UINT32) Child->Common.Value.Integer;
+
+ Info->Level += 1;
+ Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
+ AcpiDmResourceTemplate (Info, Op->Common.Parent, Aml, Length);
+
+ Info->Level -= 1;
+ AcpiDmIndent (Info->Level);
+ }
+ else
+ {
+ AcpiDmNamestring (Child->Common.Value.Name);
+ }
+
+ AcpiOsPrintf (")");
+ AcpiDmCommaIfFieldMember (Op);
+ AcpiOsPrintf ("\n");
+
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; /* for now, ignore in AcpiDmAscendingOp */
+ Child->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ break;
+
case AML_INT_BYTELIST_OP:
AcpiDmByteList (Info, Op);
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmresrc.c b/usr/src/uts/intel/io/acpica/disassembler/dmresrc.c
index fe208d5260..9c07bf7e94 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmresrc.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmresrc.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,12 +55,6 @@
/* Dispatch tables for Resource disassembly functions */
-typedef
-void (*ACPI_RESOURCE_HANDLER) (
- AML_RESOURCE *Resource,
- UINT32 Length,
- UINT32 Level);
-
static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] =
{
/* Small descriptors */
@@ -75,7 +69,7 @@ static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] =
AcpiDmEndDependentDescriptor, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
AcpiDmIoDescriptor, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */
AcpiDmFixedIoDescriptor, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */
- NULL, /* 0x0A, Reserved */
+ AcpiDmFixedDmaDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */
NULL, /* 0x0B, Reserved */
NULL, /* 0x0C, Reserved */
NULL, /* 0x0D, Reserved */
@@ -95,7 +89,10 @@ static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] =
AcpiDmWordDescriptor, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */
AcpiDmInterruptDescriptor, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */
AcpiDmQwordDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */
- AcpiDmExtendedDescriptor /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
+ AcpiDmExtendedDescriptor, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
+ AcpiDmGpioDescriptor, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */
+ NULL, /* 0x0D, Reserved */
+ AcpiDmSerialBusDescriptor /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS */
};
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c b/usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c
index 2284928752..ed78b31c70 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1050,4 +1050,3 @@ AcpiDmVendorLargeDescriptor (
}
#endif
-
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmresrcl2.c b/usr/src/uts/intel/io/acpica/disassembler/dmresrcl2.c
new file mode 100644
index 0000000000..e79307ee72
--- /dev/null
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmresrcl2.c
@@ -0,0 +1,700 @@
+/*******************************************************************************
+ *
+ * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2)
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbresrcl2")
+
+/* Local prototypes */
+
+static void
+AcpiDmI2cSerialBusDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+static void
+AcpiDmSpiSerialBusDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+static void
+AcpiDmUartSerialBusDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+static void
+AcpiDmGpioCommon (
+ AML_RESOURCE *Resource,
+ UINT32 Level);
+
+static void
+AcpiDmDumpRawDataBuffer (
+ UINT8 *Buffer,
+ UINT32 Length,
+ UINT32 Level);
+
+
+/* Dispatch table for the serial bus descriptors */
+
+static ACPI_RESOURCE_HANDLER SerialBusResourceDispatch [] =
+{
+ NULL,
+ AcpiDmI2cSerialBusDescriptor,
+ AcpiDmSpiSerialBusDescriptor,
+ AcpiDmUartSerialBusDescriptor
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpRawDataBuffer
+ *
+ * PARAMETERS: Buffer - Pointer to the data bytes
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for
+ * vendor data bytes.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmDumpRawDataBuffer (
+ UINT8 *Buffer,
+ UINT32 Length,
+ UINT32 Level)
+{
+ UINT32 Index;
+ UINT32 i;
+ UINT32 j;
+
+
+ if (!Length)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("RawDataBuffer (0x%.2X) // Vendor Data", Length);
+
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("{\n");
+ AcpiDmIndent (Level + 2);
+
+ for (i = 0; i < Length;)
+ {
+ for (j = 0; j < 8; j++)
+ {
+ Index = i + j;
+ if (Index >= Length)
+ {
+ goto Finish;
+ }
+
+ AcpiOsPrintf ("0x%2.2X", Buffer[Index]);
+ if ((Index + 1) >= Length)
+ {
+ goto Finish;
+ }
+
+ AcpiOsPrintf (", ");
+ }
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level + 2);
+
+ i += 8;
+ }
+
+Finish:
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("}");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGpioCommon
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmGpioCommon (
+ AML_RESOURCE *Resource,
+ UINT32 Level)
+{
+ UINT32 PinCount;
+ UINT16 *PinList;
+ UINT8 *VendorData;
+ UINT32 i;
+
+
+ /* ResourceSource, ResourceSourceIndex, ResourceType */
+
+ AcpiDmIndent (Level + 1);
+ if (Resource->Gpio.ResSourceOffset)
+ {
+ AcpiUtPrintString (
+ ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset),
+ ACPI_UINT8_MAX);
+ }
+
+ AcpiOsPrintf (", ");
+ AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_ConsumeDecode [(Resource->Gpio.Flags & 1)]);
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (",");
+
+ /* Dump the vendor data */
+
+ if (Resource->Gpio.VendorOffset)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Level + 1);
+ VendorData = ACPI_ADD_PTR (UINT8, Resource,
+ Resource->Gpio.VendorOffset);
+
+ AcpiDmDumpRawDataBuffer (VendorData,
+ Resource->Gpio.VendorLength, Level);
+ }
+
+ AcpiOsPrintf (")\n");
+
+ /* Dump the interrupt list */
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("{ // Pin list\n");
+
+ PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
+ Resource->Gpio.PinTableOffset)) /
+ sizeof (UINT16);
+
+ PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
+ Resource->Gpio.PinTableOffset);
+
+ for (i = 0; i < PinCount; i++)
+ {
+ AcpiDmIndent (Level + 2);
+ AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], ((i + 1) < PinCount) ? "," : "");
+ }
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("}\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGpioIntDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a GPIO Interrupt descriptor
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmGpioIntDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ /* Dump the GpioInt-specific portion of the descriptor */
+
+ /* EdgeLevel, ActiveLevel, Shared */
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
+ AcpiGbl_HeDecode [(Resource->Gpio.IntFlags & 1)],
+ AcpiGbl_LlDecode [(Resource->Gpio.IntFlags >> 1) & 1],
+ AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]);
+
+ /* PinConfig, DebounceTimeout */
+
+ if (Resource->Gpio.PinConfig <= 3)
+ {
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
+ }
+ else
+ {
+ AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
+ }
+ AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
+
+ /* Dump the GpioInt/GpioIo common portion of the descriptor */
+
+ AcpiDmGpioCommon (Resource, Level);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGpioIoDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a GPIO Interrupt descriptor
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmGpioIoDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ /* Dump the GpioIo-specific portion of the descriptor */
+
+ /* Shared, PinConfig */
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("GpioIo (%s, ",
+ AcpiGbl_ShrDecode [(Resource->Gpio.IntFlags >> 3) & 1]);
+
+ if (Resource->Gpio.PinConfig <= 3)
+ {
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]);
+ }
+ else
+ {
+ AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
+ }
+
+ /* DebounceTimeout, DriveStrength, IoRestriction */
+
+ AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
+ AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
+ AcpiOsPrintf ("%s,\n",
+ AcpiGbl_IorDecode [Resource->Gpio.IntFlags & 3]);
+
+ /* Dump the GpioInt/GpioIo common portion of the descriptor */
+
+ AcpiDmGpioCommon (Resource, Level);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGpioDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmGpioDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+ UINT8 ConnectionType;
+
+
+ ConnectionType = Resource->Gpio.ConnectionType;
+
+ switch (ConnectionType)
+ {
+ case AML_RESOURCE_GPIO_TYPE_INT:
+ AcpiDmGpioIntDescriptor (Resource, Length, Level);
+ break;
+
+ case AML_RESOURCE_GPIO_TYPE_IO:
+ AcpiDmGpioIoDescriptor (Resource, Length, Level);
+ break;
+
+ default:
+ AcpiOsPrintf ("Unknown GPIO type\n");
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpSerialBusVendorData
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump optional serial bus vendor data
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmDumpSerialBusVendorData (
+ AML_RESOURCE *Resource,
+ UINT32 Level)
+{
+ UINT8 *VendorData;
+ UINT32 VendorLength;
+
+
+ /* Get the (optional) vendor data and length */
+
+ switch (Resource->CommonSerialBus.Type)
+ {
+ case AML_RESOURCE_I2C_SERIALBUSTYPE:
+
+ VendorLength = Resource->CommonSerialBus.TypeDataLength -
+ AML_RESOURCE_I2C_MIN_DATA_LEN;
+
+ VendorData = ACPI_ADD_PTR (UINT8, Resource,
+ sizeof (AML_RESOURCE_I2C_SERIALBUS));
+ break;
+
+ case AML_RESOURCE_SPI_SERIALBUSTYPE:
+
+ VendorLength = Resource->CommonSerialBus.TypeDataLength -
+ AML_RESOURCE_SPI_MIN_DATA_LEN;
+
+ VendorData = ACPI_ADD_PTR (UINT8, Resource,
+ sizeof (AML_RESOURCE_SPI_SERIALBUS));
+ break;
+
+ case AML_RESOURCE_UART_SERIALBUSTYPE:
+
+ VendorLength = Resource->CommonSerialBus.TypeDataLength -
+ AML_RESOURCE_UART_MIN_DATA_LEN;
+
+ VendorData = ACPI_ADD_PTR (UINT8, Resource,
+ sizeof (AML_RESOURCE_UART_SERIALBUS));
+ break;
+
+ default:
+ return;
+ }
+
+ /* Dump the vendor bytes as a RawDataBuffer object */
+
+ AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmI2cSerialBusDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a I2C serial bus descriptor
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmI2cSerialBusDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+ UINT32 ResourceSourceOffset;
+
+
+ /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("I2cSerialBus (0x%4.4X, %s, 0x%8.8X,\n",
+ Resource->I2cSerialBus.SlaveAddress,
+ AcpiGbl_SmDecode [(Resource->I2cSerialBus.Flags & 1)],
+ Resource->I2cSerialBus.ConnectionSpeed);
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_AmDecode [(Resource->I2cSerialBus.TypeSpecificFlags & 1)]);
+
+ /* ResourceSource is a required field */
+
+ ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
+ Resource->CommonSerialBus.TypeDataLength;
+
+ AcpiUtPrintString (
+ ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+ ACPI_UINT8_MAX);
+
+ /* ResourceSourceIndex, ResourceUsage */
+
+ AcpiOsPrintf (",\n");
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex);
+
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_ConsumeDecode [(Resource->I2cSerialBus.Flags >> 1) & 1]);
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (",\n");
+
+ /* Dump the vendor data */
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpSerialBusVendorData (Resource, Level);
+ AcpiOsPrintf (")\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmSpiSerialBusDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a SPI serial bus descriptor
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmSpiSerialBusDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+ UINT32 ResourceSourceOffset;
+
+
+ /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("SpiSerialBus (0x%4.4X, %s, %s, 0x%2.2X,\n",
+ Resource->SpiSerialBus.DeviceSelection,
+ AcpiGbl_DpDecode [(Resource->SpiSerialBus.TypeSpecificFlags >> 1) & 1],
+ AcpiGbl_WmDecode [(Resource->SpiSerialBus.TypeSpecificFlags & 1)],
+ Resource->SpiSerialBus.DataBitLength);
+
+ /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
+ AcpiGbl_SmDecode [(Resource->SpiSerialBus.Flags & 1)],
+ Resource->SpiSerialBus.ConnectionSpeed,
+ AcpiGbl_CpoDecode [(Resource->SpiSerialBus.ClockPolarity & 1)]);
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_CphDecode [(Resource->SpiSerialBus.ClockPhase & 1)]);
+
+ /* ResourceSource is a required field */
+
+ ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
+ Resource->CommonSerialBus.TypeDataLength;
+
+ AcpiUtPrintString (
+ ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+ ACPI_UINT8_MAX);
+
+ /* ResourceSourceIndex, ResourceUsage */
+
+ AcpiOsPrintf (",\n");
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex);
+
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_ConsumeDecode [(Resource->SpiSerialBus.Flags >> 1) & 1]);
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (",\n");
+
+ /* Dump the vendor data */
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpSerialBusVendorData (Resource, Level);
+ AcpiOsPrintf (")\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmUartSerialBusDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a UART serial bus descriptor
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmUartSerialBusDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+ UINT32 ResourceSourceOffset;
+
+
+ /* ConnectionSpeed, BitsPerByte, StopBits */
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("UartSerialBus (0x%8.8X, %s, %s,\n",
+ Resource->UartSerialBus.DefaultBaudRate,
+ AcpiGbl_BpbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 4) & 3],
+ AcpiGbl_SbDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 2) & 3]);
+
+ /* LinesInUse, IsBigEndian, Parity, FlowControl */
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n",
+ Resource->UartSerialBus.LinesEnabled,
+ AcpiGbl_EdDecode [(Resource->UartSerialBus.TypeSpecificFlags >> 7) & 1],
+ AcpiGbl_PtDecode [Resource->UartSerialBus.Parity & 7],
+ AcpiGbl_FcDecode [Resource->UartSerialBus.TypeSpecificFlags & 3]);
+
+ /* ReceiveBufferSize, TransmitBufferSize */
+
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
+ Resource->UartSerialBus.RxFifoSize,
+ Resource->UartSerialBus.TxFifoSize);
+
+ /* ResourceSource is a required field */
+
+ ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
+ Resource->CommonSerialBus.TypeDataLength;
+
+ AcpiUtPrintString (
+ ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+ ACPI_UINT8_MAX);
+
+ /* ResourceSourceIndex, ResourceUsage */
+
+ AcpiOsPrintf (",\n");
+ AcpiDmIndent (Level + 1);
+ AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex);
+
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_ConsumeDecode [(Resource->UartSerialBus.Flags >> 1) & 1]);
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (",\n");
+
+ /* Dump the vendor data */
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpSerialBusVendorData (Resource, Level);
+ AcpiOsPrintf (")\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmSerialBusDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmSerialBusDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ SerialBusResourceDispatch [Resource->CommonSerialBus.Type] (
+ Resource, Length, Level);
+}
+
+#endif
+
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c b/usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c
index 52b0fa3ea3..32759d991b 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,9 +121,9 @@ AcpiDmDmaDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("DMA (%s, %s, %s, ",
- AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3],
- AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1],
- AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]);
+ AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3],
+ AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1],
+ AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]);
/* Insert a descriptor name */
@@ -137,6 +137,49 @@ AcpiDmDmaDescriptor (
/*******************************************************************************
*
+ * FUNCTION: AcpiDmFixedDmaDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a FixedDMA descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFixedDmaDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ",
+ Resource->FixedDma.RequestLines,
+ Resource->FixedDma.Channels);
+
+ if (Resource->FixedDma.Width <= 5)
+ {
+ AcpiOsPrintf ("%s, ",
+ AcpiGbl_DtsDecode [Resource->FixedDma.Width]);
+ }
+ else
+ {
+ AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ", Resource->FixedDma.Width);
+ }
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDmIoDescriptor
*
* PARAMETERS: Resource - Pointer to the resource descriptor
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmutils.c b/usr/src/uts/intel/io/acpica/disassembler/dmutils.c
index b3db9312d5..ce3443ec3f 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmutils.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmutils.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -135,7 +135,8 @@ const char *AcpiGbl_IrqDecode[] =
*
* RETURN: None
*
- * DESCRIPTION: Decode the AccessAs attribute byte. (Mostly SMBus stuff)
+ * DESCRIPTION: Decode the AccessAs attribute byte. (Mostly SMBus and
+ * GenericSerialBus stuff.)
*
******************************************************************************/
@@ -146,44 +147,61 @@ AcpiDmDecodeAttribute (
switch (Attribute)
{
- case AML_FIELD_ATTRIB_SMB_QUICK:
+ case AML_FIELD_ATTRIB_QUICK:
- AcpiOsPrintf ("SMBQuick");
+ AcpiOsPrintf ("AttribQuick");
break;
- case AML_FIELD_ATTRIB_SMB_SEND_RCV:
+ case AML_FIELD_ATTRIB_SEND_RCV:
- AcpiOsPrintf ("SMBSendReceive");
+ AcpiOsPrintf ("AttribSendReceive");
break;
- case AML_FIELD_ATTRIB_SMB_BYTE:
+ case AML_FIELD_ATTRIB_BYTE:
- AcpiOsPrintf ("SMBByte");
+ AcpiOsPrintf ("AttribByte");
break;
- case AML_FIELD_ATTRIB_SMB_WORD:
+ case AML_FIELD_ATTRIB_WORD:
- AcpiOsPrintf ("SMBWord");
+ AcpiOsPrintf ("AttribWord");
break;
- case AML_FIELD_ATTRIB_SMB_WORD_CALL:
+ case AML_FIELD_ATTRIB_BLOCK:
- AcpiOsPrintf ("SMBProcessCall");
+ AcpiOsPrintf ("AttribBlock");
break;
- case AML_FIELD_ATTRIB_SMB_BLOCK:
+ case AML_FIELD_ATTRIB_MULTIBYTE:
- AcpiOsPrintf ("SMBBlock");
+ AcpiOsPrintf ("AttribBytes");
break;
- case AML_FIELD_ATTRIB_SMB_BLOCK_CALL:
+ case AML_FIELD_ATTRIB_WORD_CALL:
- AcpiOsPrintf ("SMBBlockProcessCall");
+ AcpiOsPrintf ("AttribProcessCall");
+ break;
+
+ case AML_FIELD_ATTRIB_BLOCK_CALL:
+
+ AcpiOsPrintf ("AttribBlockProcessCall");
+ break;
+
+ case AML_FIELD_ATTRIB_RAW_BYTES:
+
+ AcpiOsPrintf ("AttribRawBytes");
+ break;
+
+ case AML_FIELD_ATTRIB_RAW_PROCESS:
+
+ AcpiOsPrintf ("AttribRawProcessBytes");
break;
default:
- AcpiOsPrintf ("0x%.2X", Attribute);
+ /* A ByteConst is allowed by the grammar */
+
+ AcpiOsPrintf ("0x%2.2X", Attribute);
break;
}
}
diff --git a/usr/src/uts/intel/io/acpica/disassembler/dmwalk.c b/usr/src/uts/intel/io/acpica/disassembler/dmwalk.c
index 2a4b5e545f..dd3ee00255 100644
--- a/usr/src/uts/intel/io/acpica/disassembler/dmwalk.c
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmwalk.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -464,7 +464,8 @@ AcpiDmDescendingOp (
AcpiDmDisassembleOneOp (NULL, Info, Op);
- if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX)
+ if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) ||
+ (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP))
{
return (AE_OK);
}
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dsargs.c b/usr/src/uts/intel/io/acpica/dispatcher/dsargs.c
index 87def86051..ea0d7bee88 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsargs.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsargs.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -424,7 +424,15 @@ AcpiDsGetRegionArguments (
/* Execute the argument AML */
- Status = AcpiDsExecuteArguments (Node, Node->Parent,
+ Status = AcpiDsExecuteArguments (Node, ExtraDesc->Extra.ScopeNode,
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId,
+ ObjDesc->Region.Address, ObjDesc->Region.Length,
+ Node);
return_ACPI_STATUS (Status);
}
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dscontrol.c b/usr/src/uts/intel/io/acpica/dispatcher/dscontrol.c
index 41a44951c2..5c5c51a573 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dscontrol.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dscontrol.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dsfield.c b/usr/src/uts/intel/io/acpica/dispatcher/dsfield.c
index 886b6c24c5..1c3c523720 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsfield.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsfield.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -243,6 +243,7 @@ AcpiDsGetFieldNames (
{
ACPI_STATUS Status;
UINT64 Position;
+ ACPI_PARSE_OBJECT *Child;
ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
@@ -257,10 +258,11 @@ AcpiDsGetFieldNames (
while (Arg)
{
/*
- * Three types of field elements are handled:
- * 1) Offset - specifies a bit offset
- * 2) AccessAs - changes the access mode
- * 3) Name - Enters a new named field into the namespace
+ * Four types of field elements are handled:
+ * 1) Name - Enters a new named field into the namespace
+ * 2) Offset - specifies a bit offset
+ * 3) AccessAs - changes the access mode/attributes
+ * 4) Connection - Associate a resource template with the field
*/
switch (Arg->Common.AmlOpcode)
{
@@ -279,24 +281,67 @@ AcpiDsGetFieldNames (
Info->FieldBitPosition = (UINT32) Position;
break;
-
case AML_INT_ACCESSFIELD_OP:
-
+ case AML_INT_EXTACCESSFIELD_OP:
/*
- * Get a new AccessType and AccessAttribute -- to be used for all
- * field units that follow, until field end or another AccessAs
- * keyword.
+ * Get new AccessType, AccessAttribute, and AccessLength fields
+ * -- to be used for all field units that follow, until the
+ * end-of-field or another AccessAs keyword is encountered.
+ * NOTE. These three bytes are encoded in the integer value
+ * of the parseop for convenience.
*
* In FieldFlags, preserve the flag bits other than the
- * ACCESS_TYPE bits
+ * ACCESS_TYPE bits.
*/
+
+ /* AccessType (ByteAcc, WordAcc, etc.) */
+
Info->FieldFlags = (UINT8)
((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
- ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8)));
+ ((UINT8) ((UINT32) (Arg->Common.Value.Integer & 0x07))));
+
+ /* AccessAttribute (AttribQuick, AttribByte, etc.) */
+
+ Info->Attribute = (UINT8) ((Arg->Common.Value.Integer >> 8) & 0xFF);
+
+ /* AccessLength (for serial/buffer protocols) */
- Info->Attribute = (UINT8) (Arg->Common.Value.Integer);
+ Info->AccessLength = (UINT8) ((Arg->Common.Value.Integer >> 16) & 0xFF);
break;
+ case AML_INT_CONNECTION_OP:
+ /*
+ * Clear any previous connection. New connection is used for all
+ * fields that follow, similar to AccessAs
+ */
+ Info->ResourceBuffer = NULL;
+ Info->ConnectionNode = NULL;
+
+ /*
+ * A Connection() is either an actual resource descriptor (buffer)
+ * or a named reference to a resource template
+ */
+ Child = Arg->Common.Value.Arg;
+ if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
+ {
+ Info->ResourceBuffer = Child->Named.Data;
+ Info->ResourceLength = (UINT16) Child->Named.Value.Integer;
+ }
+ else
+ {
+ /* Lookup the Connection() namepath, it should already exist */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ Child->Common.Value.Name, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Info->ConnectionNode);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR_NAMESPACE (Child->Common.Value.Name, Status);
+ return_ACPI_STATUS (Status);
+ }
+ }
+ break;
case AML_INT_NAMEDFIELD_OP:
@@ -348,7 +393,6 @@ AcpiDsGetFieldNames (
Info->FieldBitPosition += Info->FieldBitLength;
break;
-
default:
ACPI_ERROR ((AE_INFO,
@@ -406,6 +450,8 @@ AcpiDsCreateField (
}
}
+ ACPI_MEMSET (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO));
+
/* Second arg is the field flags */
Arg = Arg->Common.Next;
@@ -418,7 +464,6 @@ AcpiDsCreateField (
Info.RegionNode = RegionNode;
Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
-
return_ACPI_STATUS (Status);
}
@@ -514,8 +559,8 @@ AcpiDsInitFieldObjects (
while (Arg)
{
/*
- * Ignore OFFSET and ACCESSAS terms here; we are only interested in the
- * field names in order to enter them into the namespace.
+ * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
+ * in the field names in order to enter them into the namespace.
*/
if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
{
@@ -697,7 +742,6 @@ AcpiDsCreateIndexField (
Info.RegionNode = RegionNode;
Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
-
return_ACPI_STATUS (Status);
}
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dsinit.c b/usr/src/uts/intel/io/acpica/dispatcher/dsinit.c
index 154e5de34f..1c7ad88492 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsinit.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsinit.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dsmethod.c b/usr/src/uts/intel/io/acpica/dispatcher/dsmethod.c
index 1cfa1c6853..670382ac9b 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsmethod.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsmethod.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dsmthdat.c b/usr/src/uts/intel/io/acpica/dispatcher/dsmthdat.c
index 74ee4bdf31..b4509e7710 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsmthdat.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsmthdat.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dsobject.c b/usr/src/uts/intel/io/acpica/dispatcher/dsobject.c
index 69888505c6..b3567766a2 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsobject.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsobject.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c b/usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c
index 45fbed1e62..7569236f2e 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dsutils.c b/usr/src/uts/intel/io/acpica/dispatcher/dsutils.c
index 278009795c..66431aad53 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsutils.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsutils.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dswexec.c b/usr/src/uts/intel/io/acpica/dispatcher/dswexec.c
index 7983787958..5732855bbe 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswexec.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswexec.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dswload.c b/usr/src/uts/intel/io/acpica/dispatcher/dswload.c
index d8e77a6538..d40f911f41 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswload.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswload.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dswload2.c b/usr/src/uts/intel/io/acpica/dispatcher/dswload2.c
index 608d525b36..27e3176209 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswload2.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswload2.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dswscope.c b/usr/src/uts/intel/io/acpica/dispatcher/dswscope.c
index 9842b85b21..a59fdc9dca 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswscope.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswscope.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/dispatcher/dswstate.c b/usr/src/uts/intel/io/acpica/dispatcher/dswstate.c
index f97ccadb60..dd11a18130 100644
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswstate.c
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswstate.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/events/evevent.c b/usr/src/uts/intel/io/acpica/events/evevent.c
index 0f5785a634..b5a7acde72 100644
--- a/usr/src/uts/intel/io/acpica/events/evevent.c
+++ b/usr/src/uts/intel/io/acpica/events/evevent.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,8 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evevent")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
+
/* Local prototypes */
static ACPI_STATUS
@@ -81,6 +83,13 @@ AcpiEvInitializeEvents (
ACPI_FUNCTION_TRACE (EvInitializeEvents);
+ /* If Hardware Reduced flag is set, there are no fixed events */
+
+ if (AcpiGbl_ReducedHardware)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
/*
* Initialize the Fixed and General Purpose Events. This is done prior to
* enabling SCIs to prevent interrupts from occurring before the handlers
@@ -128,6 +137,13 @@ AcpiEvInstallXruptHandlers (
ACPI_FUNCTION_TRACE (EvInstallXruptHandlers);
+ /* If Hardware Reduced flag is set, there is no ACPI h/w */
+
+ if (AcpiGbl_ReducedHardware)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
/* Install the SCI handler */
Status = AcpiEvInstallSciHandler ();
@@ -315,4 +331,6 @@ AcpiEvFixedEventDispatch (
AcpiGbl_FixedEventHandlers[Event].Context));
}
+#endif /* !ACPI_REDUCED_HARDWARE */
+
diff --git a/usr/src/uts/intel/io/acpica/events/evglock.c b/usr/src/uts/intel/io/acpica/events/evglock.c
index cab444d06d..f40d129508 100644
--- a/usr/src/uts/intel/io/acpica/events/evglock.c
+++ b/usr/src/uts/intel/io/acpica/events/evglock.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,7 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evglock")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/* Local prototypes */
@@ -79,6 +80,13 @@ AcpiEvInitGlobalLockHandler (
ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
+ /* If Hardware Reduced flag is set, there is no global lock */
+
+ if (AcpiGbl_ReducedHardware)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
/* Attempt installation of the global lock handler */
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
@@ -365,3 +373,5 @@ AcpiEvReleaseGlobalLock (
AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex);
return_ACPI_STATUS (Status);
}
+
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evgpe.c b/usr/src/uts/intel/io/acpica/events/evgpe.c
index c4326c721b..a3781a55c6 100644
--- a/usr/src/uts/intel/io/acpica/events/evgpe.c
+++ b/usr/src/uts/intel/io/acpica/events/evgpe.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,8 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpe")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
+
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
@@ -826,3 +828,4 @@ AcpiEvGpeDispatch (
return_UINT32 (ACPI_INTERRUPT_HANDLED);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evgpeblk.c b/usr/src/uts/intel/io/acpica/events/evgpeblk.c
index b8b7af254e..c281855c2c 100644
--- a/usr/src/uts/intel/io/acpica/events/evgpeblk.c
+++ b/usr/src/uts/intel/io/acpica/events/evgpeblk.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,8 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpeblk")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
+
/* Local prototypes */
static ACPI_STATUS
@@ -545,3 +547,4 @@ AcpiEvInitializeGpeBlock (
return_ACPI_STATUS (AE_OK);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evgpeinit.c b/usr/src/uts/intel/io/acpica/events/evgpeinit.c
index f1d38ed853..f8962e947f 100644
--- a/usr/src/uts/intel/io/acpica/events/evgpeinit.c
+++ b/usr/src/uts/intel/io/acpica/events/evgpeinit.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,7 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpeinit")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/*
* Note: History of _PRW support in ACPICA
@@ -457,3 +458,5 @@ AcpiEvMatchGpeMethod (
Name, GpeNumber));
return_ACPI_STATUS (AE_OK);
}
+
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evgpeutil.c b/usr/src/uts/intel/io/acpica/events/evgpeutil.c
index e706fbb7c7..70580cd853 100644
--- a/usr/src/uts/intel/io/acpica/events/evgpeutil.c
+++ b/usr/src/uts/intel/io/acpica/events/evgpeutil.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
@@ -50,6 +49,7 @@
ACPI_MODULE_NAME ("evgpeutil")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/*******************************************************************************
*
* FUNCTION: AcpiEvWalkGpeList
@@ -422,3 +422,4 @@ AcpiEvDeleteGpeHandlers (
return_ACPI_STATUS (AE_OK);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evmisc.c b/usr/src/uts/intel/io/acpica/events/evmisc.c
index 1667f075db..68f751aca3 100644
--- a/usr/src/uts/intel/io/acpica/events/evmisc.c
+++ b/usr/src/uts/intel/io/acpica/events/evmisc.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -111,105 +111,82 @@ AcpiEvQueueNotifyRequest (
UINT32 NotifyValue)
{
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *HandlerObj = NULL;
- ACPI_GENERIC_STATE *NotifyInfo;
+ ACPI_OPERAND_OBJECT *HandlerListHead = NULL;
+ ACPI_GENERIC_STATE *Info;
+ UINT8 HandlerListId = 0;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_NAME (EvQueueNotifyRequest);
- /*
- * For value 3 (Ejection Request), some device method may need to be run.
- * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need
- * to be run.
- * For value 0x80 (Status Change) on the power button or sleep button,
- * initiate soft-off or sleep operation?
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n",
- AcpiUtGetNodeName (Node), Node, NotifyValue,
- AcpiUtGetNotifyName (NotifyValue)));
-
- /* Get the notify object attached to the NS Node */
+ /* Are Notifies allowed on this object? */
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (ObjDesc)
+ if (!AcpiEvIsNotifyObject (Node))
{
- /* We have the notify object, Get the right handler */
-
- switch (Node->Type)
- {
- /* Notify allowed only on these types */
+ return (AE_TYPE);
+ }
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
- case ACPI_TYPE_PROCESSOR:
+ /* Get the correct notify list type (System or Device) */
- if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
- {
- HandlerObj = ObjDesc->CommonNotify.SystemNotify;
- }
- else
- {
- HandlerObj = ObjDesc->CommonNotify.DeviceNotify;
- }
- break;
+ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
+ {
+ HandlerListId = ACPI_SYSTEM_HANDLER_LIST;
+ }
+ else
+ {
+ HandlerListId = ACPI_DEVICE_HANDLER_LIST;
+ }
- default:
+ /* Get the notify object attached to the namespace Node */
- /* All other types are not supported */
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (ObjDesc)
+ {
+ /* We have an attached object, Get the correct handler list */
- return (AE_TYPE);
- }
+ HandlerListHead = ObjDesc->CommonNotify.NotifyList[HandlerListId];
}
/*
- * If there is any handler to run, schedule the dispatcher.
- * Check for:
- * 1) Global system notify handler
- * 2) Global device notify handler
- * 3) Per-device notify handler
+ * If there is no notify handler (Global or Local)
+ * for this object, just ignore the notify
*/
- if ((AcpiGbl_SystemNotify.Handler &&
- (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
- (AcpiGbl_DeviceNotify.Handler &&
- (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
- HandlerObj)
+ if (!AcpiGbl_GlobalNotify[HandlerListId].Handler && !HandlerListHead)
{
- NotifyInfo = AcpiUtCreateGenericState ();
- if (!NotifyInfo)
- {
- return (AE_NO_MEMORY);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "No notify handler for Notify, ignoring (%4.4s, %X) node %p\n",
+ AcpiUtGetNodeName (Node), NotifyValue, Node));
- if (!HandlerObj)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Executing system notify handler for Notify (%4.4s, %X) "
- "node %p\n",
- AcpiUtGetNodeName (Node), NotifyValue, Node));
- }
+ return (AE_OK);
+ }
- NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
- NotifyInfo->Notify.Node = Node;
- NotifyInfo->Notify.Value = (UINT16) NotifyValue;
- NotifyInfo->Notify.HandlerObj = HandlerObj;
+ /* Setup notify info and schedule the notify dispatcher */
- Status = AcpiOsExecute (
- OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, NotifyInfo);
- if (ACPI_FAILURE (Status))
- {
- AcpiUtDeleteGenericState (NotifyInfo);
- }
- }
- else
+ Info = AcpiUtCreateGenericState ();
+ if (!Info)
{
- /* There is no notify handler (per-device or system) for this device */
+ return (AE_NO_MEMORY);
+ }
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "No notify handler for Notify (%4.4s, %X) node %p\n",
- AcpiUtGetNodeName (Node), NotifyValue, Node));
+ Info->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
+
+ Info->Notify.Node = Node;
+ Info->Notify.Value = (UINT16) NotifyValue;
+ Info->Notify.HandlerListId = HandlerListId;
+ Info->Notify.HandlerListHead = HandlerListHead;
+ Info->Notify.Global = &AcpiGbl_GlobalNotify[HandlerListId];
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type),
+ NotifyValue, AcpiUtGetNotifyName (NotifyValue), Node));
+
+ Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch,
+ Info);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtDeleteGenericState (Info);
}
return (Status);
@@ -233,64 +210,41 @@ static void ACPI_SYSTEM_XFACE
AcpiEvNotifyDispatch (
void *Context)
{
- ACPI_GENERIC_STATE *NotifyInfo = (ACPI_GENERIC_STATE *) Context;
- ACPI_NOTIFY_HANDLER GlobalHandler = NULL;
- void *GlobalContext = NULL;
+ ACPI_GENERIC_STATE *Info = (ACPI_GENERIC_STATE *) Context;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_FUNCTION_ENTRY ();
- /*
- * We will invoke a global notify handler if installed. This is done
- * _before_ we invoke the per-device handler attached to the device.
- */
- if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
- {
- /* Global system notification handler */
-
- if (AcpiGbl_SystemNotify.Handler)
- {
- GlobalHandler = AcpiGbl_SystemNotify.Handler;
- GlobalContext = AcpiGbl_SystemNotify.Context;
- }
- }
- else
- {
- /* Global driver notification handler */
+ /* Invoke a global notify handler if installed */
- if (AcpiGbl_DeviceNotify.Handler)
- {
- GlobalHandler = AcpiGbl_DeviceNotify.Handler;
- GlobalContext = AcpiGbl_DeviceNotify.Context;
- }
- }
-
- /* Invoke the system handler first, if present */
-
- if (GlobalHandler)
+ if (Info->Notify.Global->Handler)
{
- GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
- GlobalContext);
+ Info->Notify.Global->Handler (Info->Notify.Node,
+ Info->Notify.Value,
+ Info->Notify.Global->Context);
}
- /* Now invoke the per-device handler, if present */
+ /* Now invoke the local notify handler(s) if any are installed */
- HandlerObj = NotifyInfo->Notify.HandlerObj;
- if (HandlerObj)
+ HandlerObj = Info->Notify.HandlerListHead;
+ while (HandlerObj)
{
- HandlerObj->Notify.Handler (NotifyInfo->Notify.Node,
- NotifyInfo->Notify.Value,
+ HandlerObj->Notify.Handler (Info->Notify.Node,
+ Info->Notify.Value,
HandlerObj->Notify.Context);
+
+ HandlerObj = HandlerObj->Notify.Next[Info->Notify.HandlerListId];
}
/* All done with the info object */
- AcpiUtDeleteGenericState (NotifyInfo);
+ AcpiUtDeleteGenericState (Info);
}
+#if (!ACPI_REDUCED_HARDWARE)
/******************************************************************************
*
* FUNCTION: AcpiEvTerminate
@@ -370,3 +324,5 @@ AcpiEvTerminate (
}
return_VOID;
}
+
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evregion.c b/usr/src/uts/intel/io/acpica/events/evregion.c
index 193eb07b92..8c1a8ebbae 100644
--- a/usr/src/uts/intel/io/acpica/events/evregion.c
+++ b/usr/src/uts/intel/io/acpica/events/evregion.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -372,6 +372,7 @@ Cleanup1:
* FUNCTION: AcpiEvAddressSpaceDispatch
*
* PARAMETERS: RegionObj - Internal region object
+ * FieldObj - Corresponding field. Can be NULL.
* Function - Read or Write operation
* RegionOffset - Where in the region to read or write
* BitWidth - Field width in bits (8, 16, 32, or 64)
@@ -388,6 +389,7 @@ Cleanup1:
ACPI_STATUS
AcpiEvAddressSpaceDispatch (
ACPI_OPERAND_OBJECT *RegionObj,
+ ACPI_OPERAND_OBJECT *FieldObj,
UINT32 Function,
UINT32 RegionOffset,
UINT32 BitWidth,
@@ -399,6 +401,7 @@ AcpiEvAddressSpaceDispatch (
ACPI_OPERAND_OBJECT *HandlerDesc;
ACPI_OPERAND_OBJECT *RegionObj2;
void *RegionContext = NULL;
+ ACPI_CONNECTION_INFO *Context;
ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch);
@@ -423,6 +426,8 @@ AcpiEvAddressSpaceDispatch (
return_ACPI_STATUS (AE_NOT_EXIST);
}
+ Context = HandlerDesc->AddressSpace.Context;
+
/*
* It may be the case that the region has never been initialized.
* Some types of regions require special init code
@@ -450,7 +455,7 @@ AcpiEvAddressSpaceDispatch (
AcpiExExitInterpreter ();
Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
- HandlerDesc->AddressSpace.Context, &RegionContext);
+ Context, &RegionContext);
/* Re-enter the interpreter */
@@ -499,6 +504,27 @@ AcpiEvAddressSpaceDispatch (
ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+
+ /*
+ * Special handling for GenericSerialBus and GeneralPurposeIo:
+ * There are three extra parameters that must be passed to the
+ * handler via the context:
+ * 1) Connection buffer, a resource template from Connection() op.
+ * 2) Length of the above buffer.
+ * 3) Actual access length from the AccessAs() op.
+ */
+ if (((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) ||
+ (RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) &&
+ Context &&
+ FieldObj)
+ {
+ /* Get the Connection (ResourceTemplate) buffer */
+
+ Context->Connection = FieldObj->Field.ResourceBuffer;
+ Context->Length = FieldObj->Field.ResourceLength;
+ Context->AccessLength = FieldObj->Field.AccessLength;
+ }
+
if (!(HandlerDesc->AddressSpace.HandlerFlags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
@@ -514,7 +540,7 @@ AcpiEvAddressSpaceDispatch (
Status = Handler (Function,
(RegionObj->Region.Address + RegionOffset), BitWidth, Value,
- HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext);
+ Context, RegionObj2->Extra.RegionContext);
if (ACPI_FAILURE (Status))
{
diff --git a/usr/src/uts/intel/io/acpica/events/evrgnini.c b/usr/src/uts/intel/io/acpica/events/evrgnini.c
index 496e40e1aa..92946b5aaa 100644
--- a/usr/src/uts/intel/io/acpica/events/evrgnini.c
+++ b/usr/src/uts/intel/io/acpica/events/evrgnini.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/events/evsci.c b/usr/src/uts/intel/io/acpica/events/evsci.c
index 157c184f2b..c47cccc8db 100644
--- a/usr/src/uts/intel/io/acpica/events/evsci.c
+++ b/usr/src/uts/intel/io/acpica/events/evsci.c
@@ -6,7 +6,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,8 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evsci")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
+
/* Local prototypes */
static UINT32 ACPI_SYSTEM_XFACE
@@ -204,4 +206,4 @@ AcpiEvRemoveSciHandler (
return_ACPI_STATUS (Status);
}
-
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evxface.c b/usr/src/uts/intel/io/acpica/events/evxface.c
index 8a903a6b47..1b709a5787 100644
--- a/usr/src/uts/intel/io/acpica/events/evxface.c
+++ b/usr/src/uts/intel/io/acpica/events/evxface.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,337 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiInstallNotifyHandler
+ *
+ * PARAMETERS: Device - The device for which notifies will be handled
+ * HandlerType - The type of handler:
+ * ACPI_SYSTEM_NOTIFY: System Handler (00-7F)
+ * ACPI_DEVICE_NOTIFY: Device Handler (80-FF)
+ * ACPI_ALL_NOTIFY: Both System and Device
+ * Handler - Address of the handler
+ * Context - Value passed to the handler on each GPE
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install a handler for notifications on an ACPI Device,
+ * ThermalZone, or Processor object.
+ *
+ * NOTES: The Root namespace object may have only one handler for each
+ * type of notify (System/Device). Device/Thermal/Processor objects
+ * may have one device notify handler, and multiple system notify
+ * handlers.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInstallNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 HandlerType,
+ ACPI_NOTIFY_HANDLER Handler,
+ void *Context)
+{
+ ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Device);
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_STATUS Status;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE (AcpiInstallNotifyHandler);
+
+
+ /* Parameter validation */
+
+ if ((!Device) || (!Handler) || (!HandlerType) ||
+ (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Root Object:
+ * Registering a notify handler on the root object indicates that the
+ * caller wishes to receive notifications for all objects. Note that
+ * only one global handler can be registered per notify type.
+ * Ensure that a handler is not already installed.
+ */
+ if (Device == ACPI_ROOT_OBJECT)
+ {
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ if (HandlerType & (i+1))
+ {
+ if (AcpiGbl_GlobalNotify[i].Handler)
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto UnlockAndExit;
+ }
+
+ AcpiGbl_GlobalNotify[i].Handler = Handler;
+ AcpiGbl_GlobalNotify[i].Context = Context;
+ }
+ }
+
+ goto UnlockAndExit; /* Global notify handler installed, all done */
+ }
+
+ /*
+ * All Other Objects:
+ * Caller will only receive notifications specific to the target
+ * object. Note that only certain object types are allowed to
+ * receive notifications.
+ */
+
+ /* Are Notifies allowed on this object? */
+
+ if (!AcpiEvIsNotifyObject (Node))
+ {
+ Status = AE_TYPE;
+ goto UnlockAndExit;
+ }
+
+ /* Check for an existing internal object, might not exist */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ /* Create a new object */
+
+ ObjDesc = AcpiUtCreateInternalObject (Node->Type);
+ if (!ObjDesc)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ /* Attach new object to the Node, remove local reference */
+
+ Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
+ AcpiUtRemoveReference (ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+ }
+
+ /* Ensure that the handler is not already installed in the lists */
+
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ if (HandlerType & (i+1))
+ {
+ HandlerObj = ObjDesc->CommonNotify.NotifyList[i];
+ while (HandlerObj)
+ {
+ if (HandlerObj->Notify.Handler == Handler)
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto UnlockAndExit;
+ }
+
+ HandlerObj = HandlerObj->Notify.Next[i];
+ }
+ }
+ }
+
+ /* Create and populate a new notify handler object */
+
+ HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY);
+ if (!HandlerObj)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
+ }
+
+ HandlerObj->Notify.Node = Node;
+ HandlerObj->Notify.HandlerType = HandlerType;
+ HandlerObj->Notify.Handler = Handler;
+ HandlerObj->Notify.Context = Context;
+
+ /* Install the handler at the list head(s) */
+
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ if (HandlerType & (i+1))
+ {
+ HandlerObj->Notify.Next[i] =
+ ObjDesc->CommonNotify.NotifyList[i];
+
+ ObjDesc->CommonNotify.NotifyList[i] = HandlerObj;
+ }
+ }
+
+ /* Add an extra reference if handler was installed in both lists */
+
+ if (HandlerType == ACPI_ALL_NOTIFY)
+ {
+ AcpiUtAddReference (HandlerObj);
+ }
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiInstallNotifyHandler)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRemoveNotifyHandler
+ *
+ * PARAMETERS: Device - The device for which the handler is installed
+ * HandlerType - The type of handler:
+ * ACPI_SYSTEM_NOTIFY: System Handler (00-7F)
+ * ACPI_DEVICE_NOTIFY: Device Handler (80-FF)
+ * ACPI_ALL_NOTIFY: Both System and Device
+ * Handler - Address of the handler
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove a handler for notifies on an ACPI device
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 HandlerType,
+ ACPI_NOTIFY_HANDLER Handler)
+{
+ ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Device);
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_OPERAND_OBJECT *PreviousHandlerObj;
+ ACPI_STATUS Status;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE (AcpiRemoveNotifyHandler);
+
+
+ /* Parameter validation */
+
+ if ((!Device) || (!Handler) || (!HandlerType) ||
+ (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+#ifdef _UNDER_DEVELOPMENT
+ /* Make sure all deferred tasks are completed */
+
+ AcpiOsWaitEventsComplete (NULL);
+#endif
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Root Object. Global handlers are removed here */
+
+ if (Device == ACPI_ROOT_OBJECT)
+ {
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ if (HandlerType & (i+1))
+ {
+ if (!AcpiGbl_GlobalNotify[i].Handler ||
+ (AcpiGbl_GlobalNotify[i].Handler != Handler))
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Removing global notify handler\n"));
+
+ AcpiGbl_GlobalNotify[i].Handler = NULL;
+ AcpiGbl_GlobalNotify[i].Context = NULL;
+ }
+ }
+
+ goto UnlockAndExit;
+ }
+
+ /* All other objects: Are Notifies allowed on this object? */
+
+ if (!AcpiEvIsNotifyObject (Node))
+ {
+ Status = AE_TYPE;
+ goto UnlockAndExit;
+ }
+
+ /* Must have an existing internal object */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ /* Internal object exists. Find the handler and remove it */
+
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ if (HandlerType & (i+1))
+ {
+ HandlerObj = ObjDesc->CommonNotify.NotifyList[i];
+ PreviousHandlerObj = NULL;
+
+ /* Attempt to find the handler in the handler list */
+
+ while (HandlerObj &&
+ (HandlerObj->Notify.Handler != Handler))
+ {
+ PreviousHandlerObj = HandlerObj;
+ HandlerObj = HandlerObj->Notify.Next[i];
+ }
+
+ if (!HandlerObj)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ /* Remove the handler object from the list */
+
+ if (PreviousHandlerObj) /* Handler is not at the list head */
+ {
+ PreviousHandlerObj->Notify.Next[i] =
+ HandlerObj->Notify.Next[i];
+ }
+ else /* Handler is at the list head */
+ {
+ ObjDesc->CommonNotify.NotifyList[i] =
+ HandlerObj->Notify.Next[i];
+ }
+
+ AcpiUtRemoveReference (HandlerObj);
+ }
+ }
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiRemoveNotifyHandler)
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiInstallExceptionHandler
*
* PARAMETERS: Handler - Pointer to the handler function for the
@@ -103,6 +434,7 @@ Cleanup:
ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler)
+#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: AcpiInstallGlobalEventHandler
@@ -307,357 +639,6 @@ ACPI_EXPORT_SYMBOL (AcpiRemoveFixedEventHandler)
/*******************************************************************************
*
- * FUNCTION: AcpiInstallNotifyHandler
- *
- * PARAMETERS: Device - The device for which notifies will be handled
- * HandlerType - The type of handler:
- * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
- * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
- * ACPI_ALL_NOTIFY: both system and device
- * Handler - Address of the handler
- * Context - Value passed to the handler on each GPE
- *
- * RETURN: Status
- *
- * DESCRIPTION: Install a handler for notifies on an ACPI device
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiInstallNotifyHandler (
- ACPI_HANDLE Device,
- UINT32 HandlerType,
- ACPI_NOTIFY_HANDLER Handler,
- void *Context)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *NotifyObj;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiInstallNotifyHandler);
-
-
- /* Parameter validation */
-
- if ((!Device) ||
- (!Handler) ||
- (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Convert and validate the device handle */
-
- Node = AcpiNsValidateHandle (Device);
- if (!Node)
- {
- Status = AE_BAD_PARAMETER;
- goto UnlockAndExit;
- }
-
- /*
- * Root Object:
- * Registering a notify handler on the root object indicates that the
- * caller wishes to receive notifications for all objects. Note that
- * only one <external> global handler can be regsitered (per notify type).
- */
- if (Device == ACPI_ROOT_OBJECT)
- {
- /* Make sure the handler is not already installed */
-
- if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
- AcpiGbl_SystemNotify.Handler) ||
- ((HandlerType & ACPI_DEVICE_NOTIFY) &&
- AcpiGbl_DeviceNotify.Handler))
- {
- Status = AE_ALREADY_EXISTS;
- goto UnlockAndExit;
- }
-
- if (HandlerType & ACPI_SYSTEM_NOTIFY)
- {
- AcpiGbl_SystemNotify.Node = Node;
- AcpiGbl_SystemNotify.Handler = Handler;
- AcpiGbl_SystemNotify.Context = Context;
- }
-
- if (HandlerType & ACPI_DEVICE_NOTIFY)
- {
- AcpiGbl_DeviceNotify.Node = Node;
- AcpiGbl_DeviceNotify.Handler = Handler;
- AcpiGbl_DeviceNotify.Context = Context;
- }
-
- /* Global notify handler installed */
- }
-
- /*
- * All Other Objects:
- * Caller will only receive notifications specific to the target object.
- * Note that only certain object types can receive notifications.
- */
- else
- {
- /* Notifies allowed on this object? */
-
- if (!AcpiEvIsNotifyObject (Node))
- {
- Status = AE_TYPE;
- goto UnlockAndExit;
- }
-
- /* Check for an existing internal object */
-
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (ObjDesc)
- {
- /* Object exists - make sure there's no handler */
-
- if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
- ObjDesc->CommonNotify.SystemNotify) ||
- ((HandlerType & ACPI_DEVICE_NOTIFY) &&
- ObjDesc->CommonNotify.DeviceNotify))
- {
- Status = AE_ALREADY_EXISTS;
- goto UnlockAndExit;
- }
- }
- else
- {
- /* Create a new object */
-
- ObjDesc = AcpiUtCreateInternalObject (Node->Type);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- goto UnlockAndExit;
- }
-
- /* Attach new object to the Node */
-
- Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
-
- /* Remove local reference to the object */
-
- AcpiUtRemoveReference (ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- goto UnlockAndExit;
- }
- }
-
- /* Install the handler */
-
- NotifyObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY);
- if (!NotifyObj)
- {
- Status = AE_NO_MEMORY;
- goto UnlockAndExit;
- }
-
- NotifyObj->Notify.Node = Node;
- NotifyObj->Notify.Handler = Handler;
- NotifyObj->Notify.Context = Context;
-
- if (HandlerType & ACPI_SYSTEM_NOTIFY)
- {
- ObjDesc->CommonNotify.SystemNotify = NotifyObj;
- }
-
- if (HandlerType & ACPI_DEVICE_NOTIFY)
- {
- ObjDesc->CommonNotify.DeviceNotify = NotifyObj;
- }
-
- if (HandlerType == ACPI_ALL_NOTIFY)
- {
- /* Extra ref if installed in both */
-
- AcpiUtAddReference (NotifyObj);
- }
- }
-
-
-UnlockAndExit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiInstallNotifyHandler)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiRemoveNotifyHandler
- *
- * PARAMETERS: Device - The device for which notifies will be handled
- * HandlerType - The type of handler:
- * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f)
- * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff)
- * ACPI_ALL_NOTIFY: both system and device
- * Handler - Address of the handler
- *
- * RETURN: Status
- *
- * DESCRIPTION: Remove a handler for notifies on an ACPI device
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiRemoveNotifyHandler (
- ACPI_HANDLE Device,
- UINT32 HandlerType,
- ACPI_NOTIFY_HANDLER Handler)
-{
- ACPI_OPERAND_OBJECT *NotifyObj;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiRemoveNotifyHandler);
-
-
- /* Parameter validation */
-
- if ((!Device) ||
- (!Handler) ||
- (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE))
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Convert and validate the device handle */
-
- Node = AcpiNsValidateHandle (Device);
- if (!Node)
- {
- Status = AE_BAD_PARAMETER;
- goto UnlockAndExit;
- }
-
- /* Root Object */
-
- if (Device == ACPI_ROOT_OBJECT)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Removing notify handler for namespace root object\n"));
-
- if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
- !AcpiGbl_SystemNotify.Handler) ||
- ((HandlerType & ACPI_DEVICE_NOTIFY) &&
- !AcpiGbl_DeviceNotify.Handler))
- {
- Status = AE_NOT_EXIST;
- goto UnlockAndExit;
- }
-
- if (HandlerType & ACPI_SYSTEM_NOTIFY)
- {
- AcpiGbl_SystemNotify.Node = NULL;
- AcpiGbl_SystemNotify.Handler = NULL;
- AcpiGbl_SystemNotify.Context = NULL;
- }
-
- if (HandlerType & ACPI_DEVICE_NOTIFY)
- {
- AcpiGbl_DeviceNotify.Node = NULL;
- AcpiGbl_DeviceNotify.Handler = NULL;
- AcpiGbl_DeviceNotify.Context = NULL;
- }
- }
-
- /* All Other Objects */
-
- else
- {
- /* Notifies allowed on this object? */
-
- if (!AcpiEvIsNotifyObject (Node))
- {
- Status = AE_TYPE;
- goto UnlockAndExit;
- }
-
- /* Check for an existing internal object */
-
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (!ObjDesc)
- {
- Status = AE_NOT_EXIST;
- goto UnlockAndExit;
- }
-
- /* Object exists - make sure there's an existing handler */
-
- if (HandlerType & ACPI_SYSTEM_NOTIFY)
- {
- NotifyObj = ObjDesc->CommonNotify.SystemNotify;
- if (!NotifyObj)
- {
- Status = AE_NOT_EXIST;
- goto UnlockAndExit;
- }
-
- if (NotifyObj->Notify.Handler != Handler)
- {
- Status = AE_BAD_PARAMETER;
- goto UnlockAndExit;
- }
-
- /* Remove the handler */
-
- ObjDesc->CommonNotify.SystemNotify = NULL;
- AcpiUtRemoveReference (NotifyObj);
- }
-
- if (HandlerType & ACPI_DEVICE_NOTIFY)
- {
- NotifyObj = ObjDesc->CommonNotify.DeviceNotify;
- if (!NotifyObj)
- {
- Status = AE_NOT_EXIST;
- goto UnlockAndExit;
- }
-
- if (NotifyObj->Notify.Handler != Handler)
- {
- Status = AE_BAD_PARAMETER;
- goto UnlockAndExit;
- }
-
- /* Remove the handler */
-
- ObjDesc->CommonNotify.DeviceNotify = NULL;
- AcpiUtRemoveReference (NotifyObj);
- }
- }
-
-
-UnlockAndExit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiRemoveNotifyHandler)
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiInstallGpeHandler
*
* PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT
@@ -975,3 +956,4 @@ AcpiReleaseGlobalLock (
ACPI_EXPORT_SYMBOL (AcpiReleaseGlobalLock)
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evxfevnt.c b/usr/src/uts/intel/io/acpica/events/evxfevnt.c
index a813dd3c96..254214af19 100644
--- a/usr/src/uts/intel/io/acpica/events/evxfevnt.c
+++ b/usr/src/uts/intel/io/acpica/events/evxfevnt.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,6 +52,7 @@
ACPI_MODULE_NAME ("evxfevnt")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/*******************************************************************************
*
* FUNCTION: AcpiEnable
@@ -377,4 +378,4 @@ AcpiGetEventStatus (
ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)
-
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evxfgpe.c b/usr/src/uts/intel/io/acpica/events/evxfgpe.c
index 76019969ec..c0dd88c777 100644
--- a/usr/src/uts/intel/io/acpica/events/evxfgpe.c
+++ b/usr/src/uts/intel/io/acpica/events/evxfgpe.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,7 @@
ACPI_MODULE_NAME ("evxfgpe")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/*******************************************************************************
*
* FUNCTION: AcpiUpdateAllGpes
@@ -898,3 +899,5 @@ AcpiGetGpeDevice (
}
ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice)
+
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/events/evxfregn.c b/usr/src/uts/intel/io/acpica/events/evxfregn.c
index 4fd637e31f..493df9217d 100644
--- a/usr/src/uts/intel/io/acpica/events/evxfregn.c
+++ b/usr/src/uts/intel/io/acpica/events/evxfregn.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exconfig.c b/usr/src/uts/intel/io/acpica/executer/exconfig.c
index d7677e99ce..9e05497b9f 100644
--- a/usr/src/uts/intel/io/acpica/executer/exconfig.c
+++ b/usr/src/uts/intel/io/acpica/executer/exconfig.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -334,7 +334,7 @@ AcpiExRegionRead (
for (i = 0; i < Length; i++)
{
- Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
+ Status = AcpiEvAddressSpaceDispatch (ObjDesc, NULL, ACPI_READ,
RegionOffset, 8, &Value);
if (ACPI_FAILURE (Status))
{
diff --git a/usr/src/uts/intel/io/acpica/executer/exconvrt.c b/usr/src/uts/intel/io/acpica/executer/exconvrt.c
index 6894acdec7..e79cbc96e9 100644
--- a/usr/src/uts/intel/io/acpica/executer/exconvrt.c
+++ b/usr/src/uts/intel/io/acpica/executer/exconvrt.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/excreate.c b/usr/src/uts/intel/io/acpica/executer/excreate.c
index fe93e0e940..888ff7d7c4 100644
--- a/usr/src/uts/intel/io/acpica/executer/excreate.c
+++ b/usr/src/uts/intel/io/acpica/executer/excreate.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -284,7 +284,7 @@ Cleanup:
*
* PARAMETERS: AmlStart - Pointer to the region declaration AML
* AmlLength - Max length of the declaration AML
- * RegionSpace - SpaceID for the region
+ * SpaceId - Address space ID for the region
* WalkState - Current state
*
* RETURN: Status
@@ -297,7 +297,7 @@ ACPI_STATUS
AcpiExCreateRegion (
UINT8 *AmlStart,
UINT32 AmlLength,
- UINT8 RegionSpace,
+ UINT8 SpaceId,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
@@ -326,16 +326,18 @@ AcpiExCreateRegion (
* Space ID must be one of the predefined IDs, or in the user-defined
* range
*/
- if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
- (RegionSpace < ACPI_USER_REGION_BEGIN) &&
- (RegionSpace != ACPI_ADR_SPACE_DATA_TABLE))
+ if (!AcpiIsValidSpaceId (SpaceId))
{
- ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace));
- return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
+ /*
+ * Print an error message, but continue. We don't want to abort
+ * a table load for this exception. Instead, if the region is
+ * actually used at runtime, abort the executing method.
+ */
+ ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId));
}
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
- AcpiUtGetRegionName (RegionSpace), RegionSpace));
+ AcpiUtGetRegionName (SpaceId), SpaceId));
/* Create the region descriptor */
@@ -353,10 +355,18 @@ AcpiExCreateRegion (
RegionObj2 = ObjDesc->Common.NextObject;
RegionObj2->Extra.AmlStart = AmlStart;
RegionObj2->Extra.AmlLength = AmlLength;
+ if (WalkState->ScopeInfo)
+ {
+ RegionObj2->Extra.ScopeNode = WalkState->ScopeInfo->Scope.Node;
+ }
+ else
+ {
+ RegionObj2->Extra.ScopeNode = Node;
+ }
/* Init the region from the operands */
- ObjDesc->Region.SpaceId = RegionSpace;
+ ObjDesc->Region.SpaceId = SpaceId;
ObjDesc->Region.Address = 0;
ObjDesc->Region.Length = 0;
ObjDesc->Region.Node = Node;
diff --git a/usr/src/uts/intel/io/acpica/executer/exdebug.c b/usr/src/uts/intel/io/acpica/executer/exdebug.c
index 62bf810c79..166b2af170 100644
--- a/usr/src/uts/intel/io/acpica/executer/exdebug.c
+++ b/usr/src/uts/intel/io/acpica/executer/exdebug.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exdump.c b/usr/src/uts/intel/io/acpica/executer/exdump.c
index 60003e6154..0943e668c1 100644
--- a/usr/src/uts/intel/io/acpica/executer/exdump.c
+++ b/usr/src/uts/intel/io/acpica/executer/exdump.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -131,8 +131,8 @@ static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.SystemNotify), "System Notify"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.DeviceNotify), "Device Notify"}
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[0]), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"}
};
static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
@@ -179,8 +179,8 @@ static ACPI_EXDUMP_INFO AcpiExDumpPower[5] =
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.SystemNotify), "System Notify"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.DeviceNotify), "Device Notify"}
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[0]), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"}
};
static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
@@ -189,16 +189,16 @@ static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"},
{ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"},
{ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.SystemNotify), "System Notify"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.DeviceNotify), "Device Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[0]), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[1]), "Device Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"}
};
static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.SystemNotify), "System Notify"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.DeviceNotify), "Device Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[0]), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[1]), "Device Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"}
};
@@ -209,11 +209,13 @@ static ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] =
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"}
};
-static ACPI_EXDUMP_INFO AcpiExDumpRegionField[3] =
+static ACPI_EXDUMP_INFO AcpiExDumpRegionField[5] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL},
{ACPI_EXD_FIELD, 0, NULL},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"}
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Field.AccessLength), "AccessLength"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.ResourceBuffer), "ResourceBuffer"}
};
static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] =
@@ -256,11 +258,15 @@ static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] =
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"}
};
-static ACPI_EXDUMP_INFO AcpiExDumpNotify[3] =
+static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"},
- {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Notify.HandlerType), "Handler Type"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Handler), "Handler"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[0]), "Next System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[1]), "Next Device Notify"}
};
@@ -999,10 +1005,7 @@ AcpiExDumpPackageObj (
case ACPI_TYPE_STRING:
AcpiOsPrintf ("[String] Value: ");
- for (i = 0; i < ObjDesc->String.Length; i++)
- {
- AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
- }
+ AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
AcpiOsPrintf ("\n");
break;
diff --git a/usr/src/uts/intel/io/acpica/executer/exfield.c b/usr/src/uts/intel/io/acpica/executer/exfield.c
index 098a18650e..a682406826 100644
--- a/usr/src/uts/intel/io/acpica/executer/exfield.c
+++ b/usr/src/uts/intel/io/acpica/executer/exfield.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -113,19 +113,25 @@ AcpiExReadDataFromField (
}
else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
+ ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI))
{
/*
- * This is an SMBus or IPMI read. We must create a buffer to hold
+ * This is an SMBus, GSBus or IPMI read. We must create a buffer to hold
* the data and then directly access the region handler.
*
- * Note: Smbus protocol value is passed in upper 16-bits of Function
+ * Note: SMBus and GSBus protocol value is passed in upper 16-bits of Function
*/
if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
{
Length = ACPI_SMBUS_BUFFER_SIZE;
Function = ACPI_READ | (ObjDesc->Field.Attribute << 16);
}
+ else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS)
+ {
+ Length = ACPI_GSBUS_BUFFER_SIZE;
+ Function = ACPI_READ | (ObjDesc->Field.Attribute << 16);
+ }
else /* IPMI */
{
Length = ACPI_IPMI_BUFFER_SIZE;
@@ -274,23 +280,24 @@ AcpiExWriteDataToField (
}
else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
+ ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS ||
ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI))
{
/*
- * This is an SMBus or IPMI write. We will bypass the entire field
+ * This is an SMBus, GSBus or IPMI write. We will bypass the entire field
* mechanism and handoff the buffer directly to the handler. For
* these address spaces, the buffer is bi-directional; on a write,
* return data is returned in the same buffer.
*
* Source must be a buffer of sufficient size:
- * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE.
+ * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or ACPI_IPMI_BUFFER_SIZE.
*
- * Note: SMBus protocol type is passed in upper 16-bits of Function
+ * Note: SMBus and GSBus protocol type is passed in upper 16-bits of Function
*/
if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO,
- "SMBus or IPMI write requires Buffer, found type %s",
+ "SMBus/IPMI/GenericSerialBus write requires Buffer, found type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -301,6 +308,11 @@ AcpiExWriteDataToField (
Length = ACPI_SMBUS_BUFFER_SIZE;
Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16);
}
+ else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS)
+ {
+ Length = ACPI_GSBUS_BUFFER_SIZE;
+ Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16);
+ }
else /* IPMI */
{
Length = ACPI_IPMI_BUFFER_SIZE;
@@ -310,7 +322,7 @@ AcpiExWriteDataToField (
if (SourceDesc->Buffer.Length < Length)
{
ACPI_ERROR ((AE_INFO,
- "SMBus or IPMI write requires Buffer of length %u, found length %u",
+ "SMBus/IPMI/GenericSerialBus write requires Buffer of length %u, found length %u",
Length, SourceDesc->Buffer.Length));
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
diff --git a/usr/src/uts/intel/io/acpica/executer/exfldio.c b/usr/src/uts/intel/io/acpica/executer/exfldio.c
index bf663a2f5e..e138e9a13c 100644
--- a/usr/src/uts/intel/io/acpica/executer/exfldio.c
+++ b/usr/src/uts/intel/io/acpica/executer/exfldio.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -98,6 +98,7 @@ AcpiExSetupRegion (
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *RgnDesc;
+ UINT8 SpaceId;
ACPI_FUNCTION_TRACE_U32 (ExSetupRegion, FieldDatumByteOffset);
@@ -116,6 +117,16 @@ AcpiExSetupRegion (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
+ SpaceId = RgnDesc->Region.SpaceId;
+
+ /* Validate the Space ID */
+
+ if (!AcpiIsValidSpaceId (SpaceId))
+ {
+ ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId));
+ return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
+ }
+
/*
* If the Region Address and Length have not been previously evaluated,
* evaluate them now and save the results.
@@ -130,11 +141,12 @@ AcpiExSetupRegion (
}
/*
- * Exit now for SMBus or IPMI address space, it has a non-linear
+ * Exit now for SMBus, GSBus or IPMI address space, it has a non-linear
* address space and the request cannot be directly validated
*/
- if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
- RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI)
+ if (SpaceId == ACPI_ADR_SPACE_SMBUS ||
+ SpaceId == ACPI_ADR_SPACE_GSBUS ||
+ SpaceId == ACPI_ADR_SPACE_IPMI)
{
/* SMBus or IPMI has a non-linear address space */
@@ -290,7 +302,8 @@ AcpiExAccessRegion (
/* Invoke the appropriate AddressSpace/OpRegion handler */
- Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, RegionOffset,
+ Status = AcpiEvAddressSpaceDispatch (RgnDesc, ObjDesc,
+ Function, RegionOffset,
ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
if (ACPI_FAILURE (Status))
@@ -353,6 +366,11 @@ AcpiExRegisterOverflow (
* The Value is larger than the maximum value that can fit into
* the register.
*/
+ ACPI_ERROR ((AE_INFO,
+ "Index value 0x%8.8X%8.8X overflows field width 0x%X",
+ ACPI_FORMAT_UINT64 (Value),
+ ObjDesc->CommonField.BitLength));
+
return (TRUE);
}
diff --git a/usr/src/uts/intel/io/acpica/executer/exmisc.c b/usr/src/uts/intel/io/acpica/executer/exmisc.c
index c5dd280fe4..63114f5584 100644
--- a/usr/src/uts/intel/io/acpica/executer/exmisc.c
+++ b/usr/src/uts/intel/io/acpica/executer/exmisc.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exmutex.c b/usr/src/uts/intel/io/acpica/executer/exmutex.c
index 6a893f0e90..4c702b8baa 100644
--- a/usr/src/uts/intel/io/acpica/executer/exmutex.c
+++ b/usr/src/uts/intel/io/acpica/executer/exmutex.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exnames.c b/usr/src/uts/intel/io/acpica/executer/exnames.c
index 2188ec0a2f..c3cb6b0b4c 100644
--- a/usr/src/uts/intel/io/acpica/executer/exnames.c
+++ b/usr/src/uts/intel/io/acpica/executer/exnames.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exoparg1.c b/usr/src/uts/intel/io/acpica/executer/exoparg1.c
index 6ac685c82b..9a6cd9fcab 100644
--- a/usr/src/uts/intel/io/acpica/executer/exoparg1.c
+++ b/usr/src/uts/intel/io/acpica/executer/exoparg1.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exoparg2.c b/usr/src/uts/intel/io/acpica/executer/exoparg2.c
index d131277aae..b76da75c49 100644
--- a/usr/src/uts/intel/io/acpica/executer/exoparg2.c
+++ b/usr/src/uts/intel/io/acpica/executer/exoparg2.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exoparg3.c b/usr/src/uts/intel/io/acpica/executer/exoparg3.c
index 6adb1afac2..0edac68e60 100644
--- a/usr/src/uts/intel/io/acpica/executer/exoparg3.c
+++ b/usr/src/uts/intel/io/acpica/executer/exoparg3.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exoparg6.c b/usr/src/uts/intel/io/acpica/executer/exoparg6.c
index fd6e039c01..bfc6585301 100644
--- a/usr/src/uts/intel/io/acpica/executer/exoparg6.c
+++ b/usr/src/uts/intel/io/acpica/executer/exoparg6.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exprep.c b/usr/src/uts/intel/io/acpica/executer/exprep.c
index ee96a6a090..9ec78275bd 100644
--- a/usr/src/uts/intel/io/acpica/executer/exprep.c
+++ b/usr/src/uts/intel/io/acpica/executer/exprep.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,7 @@
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
+#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER
@@ -484,6 +485,32 @@ AcpiExPrepFieldValue (
ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
+ /* Fields specific to GenericSerialBus fields */
+
+ ObjDesc->Field.AccessLength = Info->AccessLength;
+
+ if (Info->ConnectionNode)
+ {
+ SecondDesc = Info->ConnectionNode->Object;
+ if (!(SecondDesc->Common.Flags & AOPOBJ_DATA_VALID))
+ {
+ Status = AcpiDsGetBufferArguments (SecondDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtDeleteObjectDesc (ObjDesc);
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ ObjDesc->Field.ResourceBuffer = SecondDesc->Buffer.Pointer;
+ ObjDesc->Field.ResourceLength = (UINT16) SecondDesc->Buffer.Length;
+ }
+ else if (Info->ResourceBuffer)
+ {
+ ObjDesc->Field.ResourceBuffer = Info->ResourceBuffer;
+ ObjDesc->Field.ResourceLength = Info->ResourceLength;
+ }
+
/* Allow full data read from EC address space */
if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
diff --git a/usr/src/uts/intel/io/acpica/executer/exregion.c b/usr/src/uts/intel/io/acpica/executer/exregion.c
index b3b9aa6e66..8a40250794 100644
--- a/usr/src/uts/intel/io/acpica/executer/exregion.c
+++ b/usr/src/uts/intel/io/acpica/executer/exregion.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exresnte.c b/usr/src/uts/intel/io/acpica/executer/exresnte.c
index cf8a55531f..03962edf97 100644
--- a/usr/src/uts/intel/io/acpica/executer/exresnte.c
+++ b/usr/src/uts/intel/io/acpica/executer/exresnte.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exresolv.c b/usr/src/uts/intel/io/acpica/executer/exresolv.c
index 652d95dd54..e92fb2468e 100644
--- a/usr/src/uts/intel/io/acpica/executer/exresolv.c
+++ b/usr/src/uts/intel/io/acpica/executer/exresolv.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exresop.c b/usr/src/uts/intel/io/acpica/executer/exresop.c
index 12c872f99a..1bcba69033 100644
--- a/usr/src/uts/intel/io/acpica/executer/exresop.c
+++ b/usr/src/uts/intel/io/acpica/executer/exresop.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exstore.c b/usr/src/uts/intel/io/acpica/executer/exstore.c
index 8679e790b8..656b649478 100644
--- a/usr/src/uts/intel/io/acpica/executer/exstore.c
+++ b/usr/src/uts/intel/io/acpica/executer/exstore.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exstoren.c b/usr/src/uts/intel/io/acpica/executer/exstoren.c
index 71d8809a2d..464d6b1065 100644
--- a/usr/src/uts/intel/io/acpica/executer/exstoren.c
+++ b/usr/src/uts/intel/io/acpica/executer/exstoren.c
@@ -7,7 +7,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exstorob.c b/usr/src/uts/intel/io/acpica/executer/exstorob.c
index 4dfcf15fe3..e74d5b3485 100644
--- a/usr/src/uts/intel/io/acpica/executer/exstorob.c
+++ b/usr/src/uts/intel/io/acpica/executer/exstorob.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exsystem.c b/usr/src/uts/intel/io/acpica/executer/exsystem.c
index 10d6edc951..37f5b234a3 100644
--- a/usr/src/uts/intel/io/acpica/executer/exsystem.c
+++ b/usr/src/uts/intel/io/acpica/executer/exsystem.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/executer/exutils.c b/usr/src/uts/intel/io/acpica/executer/exutils.c
index 4daa44f527..b5eca064a2 100644
--- a/usr/src/uts/intel/io/acpica/executer/exutils.c
+++ b/usr/src/uts/intel/io/acpica/executer/exutils.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -499,4 +499,34 @@ AcpiExIntegerToString (
}
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiIsValidSpaceId
+ *
+ * PARAMETERS: SpaceId - ID to be validated
+ *
+ * RETURN: TRUE if valid/supported ID.
+ *
+ * DESCRIPTION: Validate an operation region SpaceID.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiIsValidSpaceId (
+ UINT8 SpaceId)
+{
+
+ if ((SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) &&
+ (SpaceId < ACPI_USER_REGION_BEGIN) &&
+ (SpaceId != ACPI_ADR_SPACE_DATA_TABLE) &&
+ (SpaceId != ACPI_ADR_SPACE_FIXED_HARDWARE))
+ {
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
+
+
#endif
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwacpi.c b/usr/src/uts/intel/io/acpica/hardware/hwacpi.c
index 577666100e..d9f16ef9d7 100644
--- a/usr/src/uts/intel/io/acpica/hardware/hwacpi.c
+++ b/usr/src/uts/intel/io/acpica/hardware/hwacpi.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,6 +52,7 @@
ACPI_MODULE_NAME ("hwacpi")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/******************************************************************************
*
* FUNCTION: AcpiHwSetMode
@@ -204,3 +205,5 @@ AcpiHwGetMode (
return_UINT32 (ACPI_SYS_MODE_LEGACY);
}
}
+
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwesleep.c b/usr/src/uts/intel/io/acpica/hardware/hwesleep.c
new file mode 100644
index 0000000000..1587af019c
--- /dev/null
+++ b/usr/src/uts/intel/io/acpica/hardware/hwesleep.c
@@ -0,0 +1,277 @@
+/******************************************************************************
+ *
+ * Name: hwesleep.c - ACPI Hardware Sleep/Wake Support functions for the
+ * extended FADT-V5 sleep registers.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+
+#define _COMPONENT ACPI_HARDWARE
+ ACPI_MODULE_NAME ("hwesleep")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwExecuteSleepMethod
+ *
+ * PARAMETERS: MethodPathname - Pathname of method to execute
+ * IntegerArgument - Argument to pass to the method
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Execute a sleep/wake related method with one integer argument
+ * and no return value.
+ *
+ ******************************************************************************/
+
+void
+AcpiHwExecuteSleepMethod (
+ char *MethodPathname,
+ UINT32 IntegerArgument)
+{
+ ACPI_OBJECT_LIST ArgList;
+ ACPI_OBJECT Arg;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (HwExecuteSleepMethod);
+
+
+ /* One argument, IntegerArgument; No return value expected */
+
+ ArgList.Count = 1;
+ ArgList.Pointer = &Arg;
+ Arg.Type = ACPI_TYPE_INTEGER;
+ Arg.Integer.Value = (UINT64) IntegerArgument;
+
+ Status = AcpiEvaluateObject (NULL, MethodPathname, &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status, "While executing method %s",
+ MethodPathname));
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwExtendedSleep
+ *
+ * PARAMETERS: SleepState - Which sleep state to enter
+ * Flags - ACPI_EXECUTE_GTS to run optional method
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enter a system sleep state via the extended FADT sleep
+ * registers (V5 FADT).
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwExtendedSleep (
+ UINT8 SleepState,
+ UINT8 Flags)
+{
+ ACPI_STATUS Status;
+ UINT8 SleepTypeValue;
+ UINT64 SleepStatus;
+
+
+ ACPI_FUNCTION_TRACE (HwExtendedSleep);
+
+
+ /* Extended sleep registers must be valid */
+
+ if (!AcpiGbl_FADT.SleepControl.Address ||
+ !AcpiGbl_FADT.SleepStatus.Address)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /* Clear wake status (WAK_STS) */
+
+ Status = AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ AcpiGbl_SystemAwakeAndRunning = FALSE;
+
+ /* Optionally execute _GTS (Going To Sleep) */
+
+ if (Flags & ACPI_EXECUTE_GTS)
+ {
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__GTS, SleepState);
+ }
+
+ /* Flush caches, as per ACPI specification */
+
+ ACPI_FLUSH_CPU_CACHE ();
+
+ /*
+ * Set the SLP_TYP and SLP_EN bits.
+ *
+ * Note: We only use the first value returned by the \_Sx method
+ * (AcpiGbl_SleepTypeA) - As per ACPI specification.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
+ "Entering sleep state [S%u]\n", SleepState));
+
+ SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
+ ACPI_X_SLEEP_TYPE_MASK);
+
+ Status = AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
+ &AcpiGbl_FADT.SleepControl);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Wait for transition back to Working State */
+
+ do
+ {
+ Status = AcpiRead (&SleepStatus, &AcpiGbl_FADT.SleepStatus);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ } while (!(((UINT8) SleepStatus) & ACPI_X_WAKE_STATUS));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwExtendedWakePrep
+ *
+ * PARAMETERS: SleepState - Which sleep state we just exited
+ * Flags - ACPI_EXECUTE_BFS to run optional method
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform first part of OS-independent ACPI cleanup after
+ * a sleep. Called with interrupts ENABLED.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwExtendedWakePrep (
+ UINT8 SleepState,
+ UINT8 Flags)
+{
+ ACPI_STATUS Status;
+ UINT8 SleepTypeValue;
+
+
+ ACPI_FUNCTION_TRACE (HwExtendedWakePrep);
+
+
+ Status = AcpiGetSleepTypeData (ACPI_STATE_S0,
+ &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
+ if (ACPI_SUCCESS (Status))
+ {
+ SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
+ ACPI_X_SLEEP_TYPE_MASK);
+
+ (void) AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
+ &AcpiGbl_FADT.SleepControl);
+ }
+
+ /* Optionally execute _BFS (Back From Sleep) */
+
+ if (Flags & ACPI_EXECUTE_BFS)
+ {
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__BFS, SleepState);
+ }
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwExtendedWake
+ *
+ * PARAMETERS: SleepState - Which sleep state we just exited
+ * Flags - Reserved, set to zero
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ * Called with interrupts ENABLED.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwExtendedWake (
+ UINT8 SleepState,
+ UINT8 Flags)
+{
+ ACPI_FUNCTION_TRACE (HwExtendedWake);
+
+
+ /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */
+
+ AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
+
+ /* Execute the wake methods */
+
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WAKING);
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__WAK, SleepState);
+
+ /*
+ * Some BIOS code assumes that WAK_STS will be cleared on resume
+ * and use it to determine whether the system is rebooting or
+ * resuming. Clear WAK_STS for compatibility.
+ */
+ (void) AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus);
+ AcpiGbl_SystemAwakeAndRunning = TRUE;
+
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING);
+ return_ACPI_STATUS (AE_OK);
+}
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwgpe.c b/usr/src/uts/intel/io/acpica/hardware/hwgpe.c
index 335814f942..c94f17be26 100644
--- a/usr/src/uts/intel/io/acpica/hardware/hwgpe.c
+++ b/usr/src/uts/intel/io/acpica/hardware/hwgpe.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,8 @@
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwgpe")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
+
/* Local prototypes */
static ACPI_STATUS
@@ -538,3 +540,4 @@ AcpiHwEnableAllWakeupGpes (
return_ACPI_STATUS (Status);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwpci.c b/usr/src/uts/intel/io/acpica/hardware/hwpci.c
index 96a2dfcdbe..065e42d95e 100644
--- a/usr/src/uts/intel/io/acpica/hardware/hwpci.c
+++ b/usr/src/uts/intel/io/acpica/hardware/hwpci.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwregs.c b/usr/src/uts/intel/io/acpica/hardware/hwregs.c
index 61e61a1e6b..6d89883179 100644
--- a/usr/src/uts/intel/io/acpica/hardware/hwregs.c
+++ b/usr/src/uts/intel/io/acpica/hardware/hwregs.c
@@ -7,7 +7,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,8 @@
ACPI_MODULE_NAME ("hwregs")
+#if (!ACPI_REDUCED_HARDWARE)
+
/* Local Prototypes */
static ACPI_STATUS
@@ -67,6 +69,7 @@ AcpiHwWriteMultiple (
ACPI_GENERIC_ADDRESS *RegisterA,
ACPI_GENERIC_ADDRESS *RegisterB);
+#endif /* !ACPI_REDUCED_HARDWARE */
/******************************************************************************
*
@@ -170,6 +173,7 @@ AcpiHwRead (
ACPI_GENERIC_ADDRESS *Reg)
{
UINT64 Address;
+ UINT64 Value64;
ACPI_STATUS Status;
@@ -195,7 +199,9 @@ AcpiHwRead (
if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
{
Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
- Address, Value, Reg->BitWidth);
+ Address, &Value64, Reg->BitWidth);
+
+ *Value = (UINT32) Value64;
}
else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
{
@@ -254,7 +260,7 @@ AcpiHwWrite (
if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
{
Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
- Address, Value, Reg->BitWidth);
+ Address, (UINT64) Value, Reg->BitWidth);
}
else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
{
@@ -271,6 +277,7 @@ AcpiHwWrite (
}
+#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: AcpiHwClearAcpiStatus
@@ -321,7 +328,7 @@ UnlockAndExit:
/*******************************************************************************
*
- * FUNCTION: AcpiHwGetRegisterBitMask
+ * FUNCTION: AcpiHwGetBitRegisterInfo
*
* PARAMETERS: RegisterId - Index of ACPI Register to access
*
@@ -731,3 +738,4 @@ AcpiHwWriteMultiple (
return (Status);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwsleep.c b/usr/src/uts/intel/io/acpica/hardware/hwsleep.c
index 1c8ca2440f..1953ff846e 100644
--- a/usr/src/uts/intel/io/acpica/hardware/hwsleep.c
+++ b/usr/src/uts/intel/io/acpica/hardware/hwsleep.c
@@ -1,12 +1,12 @@
-
/******************************************************************************
*
- * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
+ * Name: hwsleep.c - ACPI Hardware Sleep/Wake Support functions for the
+ * original/legacy sleep/PM registers.
*
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,210 +49,38 @@
ACPI_MODULE_NAME ("hwsleep")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/*******************************************************************************
*
- * FUNCTION: AcpiSetFirmwareWakingVector
- *
- * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode
- * entry point.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Sets the 32-bit FirmwareWakingVector field of the FACS
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiSetFirmwareWakingVector (
- UINT32 PhysicalAddress)
-{
- ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
-
-
- /* Set the 32-bit vector */
-
- AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;
-
- /* Clear the 64-bit vector if it exists */
-
- if ((AcpiGbl_FACS->Length > 32) && (AcpiGbl_FACS->Version >= 1))
- {
- AcpiGbl_FACS->XFirmwareWakingVector = 0;
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
-
-
-#if ACPI_MACHINE_WIDTH == 64
-/*******************************************************************************
- *
- * FUNCTION: AcpiSetFirmwareWakingVector64
- *
- * PARAMETERS: PhysicalAddress - 64-bit physical address of ACPI protected
- * mode entry point.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Sets the 64-bit X_FirmwareWakingVector field of the FACS, if
- * it exists in the table. This function is intended for use with
- * 64-bit host operating systems.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiSetFirmwareWakingVector64 (
- UINT64 PhysicalAddress)
-{
- ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector64);
-
-
- /* Determine if the 64-bit vector actually exists */
-
- if ((AcpiGbl_FACS->Length <= 32) || (AcpiGbl_FACS->Version < 1))
- {
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
-
- /* Clear 32-bit vector, set the 64-bit X_ vector */
-
- AcpiGbl_FACS->FirmwareWakingVector = 0;
- AcpiGbl_FACS->XFirmwareWakingVector = PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector64)
-#endif
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEnterSleepStatePrep
+ * FUNCTION: AcpiHwLegacySleep
*
* PARAMETERS: SleepState - Which sleep state to enter
+ * Flags - ACPI_EXECUTE_GTS to run optional method
*
* RETURN: Status
*
- * DESCRIPTION: Prepare to enter a system sleep state (see ACPI 2.0 spec p 231)
- * This function must execute with interrupts enabled.
- * We break sleeping into 2 stages so that OSPM can handle
- * various OS-specific tasks between the two steps.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEnterSleepStatePrep (
- UINT8 SleepState)
-{
- ACPI_STATUS Status;
- ACPI_OBJECT_LIST ArgList;
- ACPI_OBJECT Arg;
-
-
- ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep);
-
-
- /* _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */
-
- Status = AcpiGetSleepTypeData (SleepState,
- &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Execute the _PTS method (Prepare To Sleep) */
-
- ArgList.Count = 1;
- ArgList.Pointer = &Arg;
- Arg.Type = ACPI_TYPE_INTEGER;
- Arg.Integer.Value = SleepState;
-
- Status = AcpiEvaluateObject (NULL, METHOD_NAME__PTS, &ArgList, NULL);
- if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Setup the argument to the _SST method (System STatus) */
-
- switch (SleepState)
- {
- case ACPI_STATE_S0:
- Arg.Integer.Value = ACPI_SST_WORKING;
- break;
-
- case ACPI_STATE_S1:
- case ACPI_STATE_S2:
- case ACPI_STATE_S3:
- Arg.Integer.Value = ACPI_SST_SLEEPING;
- break;
-
- case ACPI_STATE_S4:
- Arg.Integer.Value = ACPI_SST_SLEEP_CONTEXT;
- break;
-
- default:
- Arg.Integer.Value = ACPI_SST_INDICATOR_OFF; /* Default is off */
- break;
- }
-
- /*
- * Set the system indicators to show the desired sleep state.
- * _SST is an optional method (return no error if not found)
- */
- Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
- if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "While executing method _SST"));
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEnterSleepState
- *
- * PARAMETERS: SleepState - Which sleep state to enter
- *
- * RETURN: Status
- *
- * DESCRIPTION: Enter a system sleep state
+ * DESCRIPTION: Enter a system sleep state via the legacy FADT PM registers
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
*
******************************************************************************/
ACPI_STATUS
-AcpiEnterSleepState (
- UINT8 SleepState)
+AcpiHwLegacySleep (
+ UINT8 SleepState,
+ UINT8 Flags)
{
- UINT32 Pm1aControl;
- UINT32 Pm1bControl;
ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo;
ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo;
+ UINT32 Pm1aControl;
+ UINT32 Pm1bControl;
UINT32 InValue;
- ACPI_OBJECT_LIST ArgList;
- ACPI_OBJECT Arg;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE (AcpiEnterSleepState);
+ ACPI_FUNCTION_TRACE (HwLegacySleep);
- if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
- (AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
- {
- ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X",
- AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
- return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
- }
-
- SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE);
+ SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE);
SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE);
/* Clear wake status */
@@ -302,17 +130,11 @@ AcpiEnterSleepState (
return_ACPI_STATUS (Status);
}
- /* Execute the _GTS method (Going To Sleep) */
-
- ArgList.Count = 1;
- ArgList.Pointer = &Arg;
- Arg.Type = ACPI_TYPE_INTEGER;
- Arg.Integer.Value = SleepState;
+ /* Optionally execute _GTS (Going To Sleep) */
- Status = AcpiEvaluateObject (NULL, METHOD_NAME__GTS, &ArgList, NULL);
- if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ if (Flags & ACPI_EXECUTE_GTS)
{
- return_ACPI_STATUS (Status);
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__GTS, SleepState);
}
/* Get current value of PM1A control */
@@ -390,7 +212,7 @@ AcpiEnterSleepState (
}
}
- /* Wait until we enter sleep state */
+ /* Wait for transition back to Working State */
do
{
@@ -400,110 +222,32 @@ AcpiEnterSleepState (
return_ACPI_STATUS (Status);
}
- /* Spin until we wake */
-
} while (!InValue);
return_ACPI_STATUS (AE_OK);
}
-ACPI_EXPORT_SYMBOL (AcpiEnterSleepState)
-
/*******************************************************************************
*
- * FUNCTION: AcpiEnterSleepStateS4bios
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Perform a S4 bios request.
- * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEnterSleepStateS4bios (
- void)
-{
- UINT32 InValue;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiEnterSleepStateS4bios);
-
-
- /* Clear the wake status bit (PM1) */
-
- Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiHwClearAcpiStatus ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * 1) Disable/Clear all GPEs
- * 2) Enable all wakeup GPEs
- */
- Status = AcpiHwDisableAllGpes ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- AcpiGbl_SystemAwakeAndRunning = FALSE;
-
- Status = AcpiHwEnableAllWakeupGpes ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- ACPI_FLUSH_CPU_CACHE ();
-
- Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
- (UINT32) AcpiGbl_FADT.S4BiosRequest, 8);
-
- do {
- AcpiOsStall(1000);
- Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- } while (!InValue);
-
- return_ACPI_STATUS (AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiEnterSleepStateS4bios)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiLeaveSleepState
+ * FUNCTION: AcpiHwLegacyWakePrep
*
* PARAMETERS: SleepState - Which sleep state we just exited
+ * Flags - ACPI_EXECUTE_BFS to run optional method
*
* RETURN: Status
*
- * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
+ * sleep.
* Called with interrupts ENABLED.
*
******************************************************************************/
ACPI_STATUS
-AcpiLeaveSleepState (
- UINT8 SleepState)
+AcpiHwLegacyWakePrep (
+ UINT8 SleepState,
+ UINT8 Flags)
{
- ACPI_OBJECT_LIST ArgList;
- ACPI_OBJECT Arg;
ACPI_STATUS Status;
ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo;
ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo;
@@ -511,8 +255,7 @@ AcpiLeaveSleepState (
UINT32 Pm1bControl;
- ACPI_FUNCTION_TRACE (AcpiLeaveSleepState);
-
+ ACPI_FUNCTION_TRACE (HwLegacyWakePrep);
/*
* Set SLP_TYPE and SLP_EN to state S0.
@@ -553,40 +296,50 @@ AcpiLeaveSleepState (
}
}
- /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */
+ /* Optionally execute _BFS (Back From Sleep) */
- AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
+ if (Flags & ACPI_EXECUTE_BFS)
+ {
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__BFS, SleepState);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwLegacyWake
+ *
+ * PARAMETERS: SleepState - Which sleep state we just exited
+ * Flags - Reserved, set to zero
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ * Called with interrupts ENABLED.
+ *
+ ******************************************************************************/
- /* Setup parameter object */
+ACPI_STATUS
+AcpiHwLegacyWake (
+ UINT8 SleepState,
+ UINT8 Flags)
+{
+ ACPI_STATUS Status;
- ArgList.Count = 1;
- ArgList.Pointer = &Arg;
- Arg.Type = ACPI_TYPE_INTEGER;
- /* Ignore any errors from these methods */
+ ACPI_FUNCTION_TRACE (HwLegacyWake);
- Arg.Integer.Value = ACPI_SST_WAKING;
- Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
- if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "During Method _SST"));
- }
- Arg.Integer.Value = SleepState;
- Status = AcpiEvaluateObject (NULL, METHOD_NAME__BFS, &ArgList, NULL);
- if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "During Method _BFS"));
- }
+ /* Ensure EnterSleepStatePrep -> EnterSleepState ordering */
- Status = AcpiEvaluateObject (NULL, METHOD_NAME__WAK, &ArgList, NULL);
- if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "During Method _WAK"));
- }
- /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
+ AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WAKING);
/*
+ * GPEs must be enabled before _WAK is called as GPEs
+ * might get fired there
+ *
* Restore the GPEs:
* 1) Disable/Clear all GPEs
* 2) Enable all runtime GPEs
@@ -596,7 +349,6 @@ AcpiLeaveSleepState (
{
return_ACPI_STATUS (Status);
}
- AcpiGbl_SystemAwakeAndRunning = TRUE;
Status = AcpiHwEnableAllRuntimeGpes ();
if (ACPI_FAILURE (Status))
@@ -604,6 +356,20 @@ AcpiLeaveSleepState (
return_ACPI_STATUS (Status);
}
+ /*
+ * Now we can execute _WAK, etc. Some machines require that the GPEs
+ * are enabled before the wake methods are executed.
+ */
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__WAK, SleepState);
+
+ /*
+ * Some BIOS code assumes that WAK_STS will be cleared on resume
+ * and use it to determine whether the system is rebooting or
+ * resuming. Clear WAK_STS for compatibility.
+ */
+ (void) AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
+ AcpiGbl_SystemAwakeAndRunning = TRUE;
+
/* Enable power button */
(void) AcpiWriteBitRegister(
@@ -625,15 +391,8 @@ AcpiLeaveSleepState (
return_ACPI_STATUS (Status);
}
- Arg.Integer.Value = ACPI_SST_WORKING;
- Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
- if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "During Method _SST"));
- }
-
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING);
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiLeaveSleepState)
-
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwtimer.c b/usr/src/uts/intel/io/acpica/hardware/hwtimer.c
index faf6770283..15dc58f0bf 100644
--- a/usr/src/uts/intel/io/acpica/hardware/hwtimer.c
+++ b/usr/src/uts/intel/io/acpica/hardware/hwtimer.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,7 @@
ACPI_MODULE_NAME ("hwtimer")
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/******************************************************************************
*
* FUNCTION: AcpiGetTimerResolution
@@ -214,3 +215,4 @@ AcpiGetTimerDuration (
ACPI_EXPORT_SYMBOL (AcpiGetTimerDuration)
+#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwvalid.c b/usr/src/uts/intel/io/acpica/hardware/hwvalid.c
index 869c9f18fd..4462434bbf 100644
--- a/usr/src/uts/intel/io/acpica/hardware/hwvalid.c
+++ b/usr/src/uts/intel/io/acpica/hardware/hwvalid.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -149,6 +149,8 @@ AcpiHwValidateIoRequest (
(BitWidth != 16) &&
(BitWidth != 32))
{
+ ACPI_ERROR ((AE_INFO,
+ "Bad BitWidth parameter: %8.8X", BitWidth));
return (AE_BAD_PARAMETER);
}
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwxface.c b/usr/src/uts/intel/io/acpica/hardware/hwxface.c
index f26c511ec8..3fec9b566f 100644
--- a/usr/src/uts/intel/io/acpica/hardware/hwxface.c
+++ b/usr/src/uts/intel/io/acpica/hardware/hwxface.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -154,12 +154,6 @@ AcpiRead (
return (Status);
}
- Width = Reg->BitWidth;
- if (Width == 64)
- {
- Width = 32; /* Break into two 32-bit transfers */
- }
-
/* Initialize entire 64-bit return value to zero */
*ReturnValue = 0;
@@ -172,28 +166,20 @@ AcpiRead (
if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
{
Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
- Address, &Value, Width);
+ Address, ReturnValue, Reg->BitWidth);
if (ACPI_FAILURE (Status))
{
return (Status);
}
- *ReturnValue = Value;
-
- if (Reg->BitWidth == 64)
- {
- /* Read the top 32 bits */
-
- Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
- (Address + 4), &Value, 32);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- *ReturnValue |= ((UINT64) Value << 32);
- }
}
else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
{
+ Width = Reg->BitWidth;
+ if (Width == 64)
+ {
+ Width = 32; /* Break into two 32-bit transfers */
+ }
+
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
Address, &Value, Width);
if (ACPI_FAILURE (Status))
@@ -262,12 +248,6 @@ AcpiWrite (
return (Status);
}
- Width = Reg->BitWidth;
- if (Width == 64)
- {
- Width = 32; /* Break into two 32-bit transfers */
- }
-
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
@@ -275,24 +255,20 @@ AcpiWrite (
if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
{
Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
- Address, ACPI_LODWORD (Value), Width);
+ Address, Value, Reg->BitWidth);
if (ACPI_FAILURE (Status))
{
return (Status);
}
-
- if (Reg->BitWidth == 64)
- {
- Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
- (Address + 4), ACPI_HIDWORD (Value), 32);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
}
else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
{
+ Width = Reg->BitWidth;
+ if (Width == 64)
+ {
+ Width = 32; /* Break into two 32-bit transfers */
+ }
+
Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
Address, ACPI_LODWORD (Value), Width);
if (ACPI_FAILURE (Status))
@@ -323,6 +299,7 @@ AcpiWrite (
ACPI_EXPORT_SYMBOL (AcpiWrite)
+#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: AcpiReadBitRegister
@@ -505,6 +482,8 @@ UnlockAndExit:
ACPI_EXPORT_SYMBOL (AcpiWriteBitRegister)
+#endif /* !ACPI_REDUCED_HARDWARE */
+
/*******************************************************************************
*
diff --git a/usr/src/uts/intel/io/acpica/hardware/hwxfsleep.c b/usr/src/uts/intel/io/acpica/hardware/hwxfsleep.c
new file mode 100644
index 0000000000..b7cbbc813e
--- /dev/null
+++ b/usr/src/uts/intel/io/acpica/hardware/hwxfsleep.c
@@ -0,0 +1,478 @@
+/******************************************************************************
+ *
+ * Name: hwxfsleep.c - ACPI Hardware Sleep/Wake External Interfaces
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+
+#define _COMPONENT ACPI_HARDWARE
+ ACPI_MODULE_NAME ("hwxfsleep")
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiHwSleepDispatch (
+ UINT8 SleepState,
+ UINT8 Flags,
+ UINT32 FunctionId);
+
+/*
+ * Dispatch table used to efficiently branch to the various sleep
+ * functions.
+ */
+#define ACPI_SLEEP_FUNCTION_ID 0
+#define ACPI_WAKE_PREP_FUNCTION_ID 1
+#define ACPI_WAKE_FUNCTION_ID 2
+
+/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */
+
+static ACPI_SLEEP_FUNCTIONS AcpiSleepDispatch[] =
+{
+ {ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacySleep), AcpiHwExtendedSleep},
+ {ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWakePrep), AcpiHwExtendedWakePrep},
+ {ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWake), AcpiHwExtendedWake}
+};
+
+
+/*
+ * These functions are removed for the ACPI_REDUCED_HARDWARE case:
+ * AcpiSetFirmwareWakingVector
+ * AcpiSetFirmwareWakingVector64
+ * AcpiEnterSleepStateS4bios
+ */
+
+#if (!ACPI_REDUCED_HARDWARE)
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiSetFirmwareWakingVector
+ *
+ * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode
+ * entry point.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Sets the 32-bit FirmwareWakingVector field of the FACS
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiSetFirmwareWakingVector (
+ UINT32 PhysicalAddress)
+{
+ ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
+
+
+ /* Set the 32-bit vector */
+
+ AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;
+
+ /* Clear the 64-bit vector if it exists */
+
+ if ((AcpiGbl_FACS->Length > 32) && (AcpiGbl_FACS->Version >= 1))
+ {
+ AcpiGbl_FACS->XFirmwareWakingVector = 0;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
+
+
+#if ACPI_MACHINE_WIDTH == 64
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiSetFirmwareWakingVector64
+ *
+ * PARAMETERS: PhysicalAddress - 64-bit physical address of ACPI protected
+ * mode entry point.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Sets the 64-bit X_FirmwareWakingVector field of the FACS, if
+ * it exists in the table. This function is intended for use with
+ * 64-bit host operating systems.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiSetFirmwareWakingVector64 (
+ UINT64 PhysicalAddress)
+{
+ ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector64);
+
+
+ /* Determine if the 64-bit vector actually exists */
+
+ if ((AcpiGbl_FACS->Length <= 32) || (AcpiGbl_FACS->Version < 1))
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /* Clear 32-bit vector, set the 64-bit X_ vector */
+
+ AcpiGbl_FACS->FirmwareWakingVector = 0;
+ AcpiGbl_FACS->XFirmwareWakingVector = PhysicalAddress;
+ return_ACPI_STATUS (AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector64)
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEnterSleepStateS4bios
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform a S4 bios request.
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnterSleepStateS4bios (
+ void)
+{
+ UINT32 InValue;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepStateS4bios);
+
+
+ /* Clear the wake status bit (PM1) */
+
+ Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiHwClearAcpiStatus ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * 1) Disable/Clear all GPEs
+ * 2) Enable all wakeup GPEs
+ */
+ Status = AcpiHwDisableAllGpes ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ AcpiGbl_SystemAwakeAndRunning = FALSE;
+
+ Status = AcpiHwEnableAllWakeupGpes ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_FLUSH_CPU_CACHE ();
+
+ Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
+ (UINT32) AcpiGbl_FADT.S4BiosRequest, 8);
+
+ do {
+ AcpiOsStall(1000);
+ Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ } while (!InValue);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepStateS4bios)
+
+#endif /* !ACPI_REDUCED_HARDWARE */
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiHwSleepDispatch
+ *
+ * PARAMETERS: SleepState - Which sleep state to enter/exit
+ * FunctionId - Sleep, WakePrep, or Wake
+ *
+ * RETURN: Status from the invoked sleep handling function.
+ *
+ * DESCRIPTION: Dispatch a sleep/wake request to the appropriate handling
+ * function.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwSleepDispatch (
+ UINT8 SleepState,
+ UINT8 Flags,
+ UINT32 FunctionId)
+{
+ ACPI_STATUS Status;
+ ACPI_SLEEP_FUNCTIONS *SleepFunctions = &AcpiSleepDispatch[FunctionId];
+
+
+#if (!ACPI_REDUCED_HARDWARE)
+
+ /*
+ * If the Hardware Reduced flag is set (from the FADT), we must
+ * use the extended sleep registers
+ */
+ if (AcpiGbl_ReducedHardware ||
+ AcpiGbl_FADT.SleepControl.Address)
+ {
+ Status = SleepFunctions->ExtendedFunction (SleepState, Flags);
+ }
+ else
+ {
+ /* Legacy sleep */
+
+ Status = SleepFunctions->LegacyFunction (SleepState, Flags);
+ }
+
+ return (Status);
+
+#else
+ /*
+ * For the case where reduced-hardware-only code is being generated,
+ * we know that only the extended sleep registers are available
+ */
+ Status = SleepFunctions->ExtendedFunction (SleepState, Flags);
+ return (Status);
+
+#endif /* !ACPI_REDUCED_HARDWARE */
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEnterSleepStatePrep
+ *
+ * PARAMETERS: SleepState - Which sleep state to enter
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Prepare to enter a system sleep state.
+ * This function must execute with interrupts enabled.
+ * We break sleeping into 2 stages so that OSPM can handle
+ * various OS-specific tasks between the two steps.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnterSleepStatePrep (
+ UINT8 SleepState)
+{
+ ACPI_STATUS Status;
+ ACPI_OBJECT_LIST ArgList;
+ ACPI_OBJECT Arg;
+ UINT32 SstValue;
+
+
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep);
+
+
+ Status = AcpiGetSleepTypeData (SleepState,
+ &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Execute the _PTS method (Prepare To Sleep) */
+
+ ArgList.Count = 1;
+ ArgList.Pointer = &Arg;
+ Arg.Type = ACPI_TYPE_INTEGER;
+ Arg.Integer.Value = SleepState;
+
+ Status = AcpiEvaluateObject (NULL, METHOD_PATHNAME__PTS, &ArgList, NULL);
+ if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Setup the argument to the _SST method (System STatus) */
+
+ switch (SleepState)
+ {
+ case ACPI_STATE_S0:
+ SstValue = ACPI_SST_WORKING;
+ break;
+
+ case ACPI_STATE_S1:
+ case ACPI_STATE_S2:
+ case ACPI_STATE_S3:
+ SstValue = ACPI_SST_SLEEPING;
+ break;
+
+ case ACPI_STATE_S4:
+ SstValue = ACPI_SST_SLEEP_CONTEXT;
+ break;
+
+ default:
+ SstValue = ACPI_SST_INDICATOR_OFF; /* Default is off */
+ break;
+ }
+
+ /*
+ * Set the system indicators to show the desired sleep state.
+ * _SST is an optional method (return no error if not found)
+ */
+ AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, SstValue);
+ return_ACPI_STATUS (AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEnterSleepState
+ *
+ * PARAMETERS: SleepState - Which sleep state to enter
+ * Flags - ACPI_EXECUTE_GTS to run optional method
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enter a system sleep state
+ * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnterSleepState (
+ UINT8 SleepState,
+ UINT8 Flags)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepState);
+
+
+ if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
+ (AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
+ {
+ ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X",
+ AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
+ return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+ }
+
+ Status = AcpiHwSleepDispatch (SleepState, Flags, ACPI_SLEEP_FUNCTION_ID);
+ return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepState)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiLeaveSleepStatePrep
+ *
+ * PARAMETERS: SleepState - Which sleep state we are exiting
+ * Flags - ACPI_EXECUTE_BFS to run optional method
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
+ * sleep. Called with interrupts DISABLED.
+ * We break wake/resume into 2 stages so that OSPM can handle
+ * various OS-specific tasks between the two steps.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiLeaveSleepStatePrep (
+ UINT8 SleepState,
+ UINT8 Flags)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (AcpiLeaveSleepStatePrep);
+
+
+ Status = AcpiHwSleepDispatch (SleepState, Flags, ACPI_WAKE_PREP_FUNCTION_ID);
+ return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiLeaveSleepStatePrep)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiLeaveSleepState
+ *
+ * PARAMETERS: SleepState - Which sleep state we are exiting
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ * Called with interrupts ENABLED.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiLeaveSleepState (
+ UINT8 SleepState)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (AcpiLeaveSleepState);
+
+
+ Status = AcpiHwSleepDispatch (SleepState, 0, ACPI_WAKE_FUNCTION_ID);
+ return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiLeaveSleepState)
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsaccess.c b/usr/src/uts/intel/io/acpica/namespace/nsaccess.c
index 1bb2b4b6e6..9dfa76fb08 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsaccess.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsaccess.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsalloc.c b/usr/src/uts/intel/io/acpica/namespace/nsalloc.c
index ac12ba4faf..c7e83e0eb4 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsalloc.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsalloc.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsdump.c b/usr/src/uts/intel/io/acpica/namespace/nsdump.c
index 58137abbc5..6b7c505779 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsdump.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsdump.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -270,7 +270,21 @@ AcpiNsDumpOneObject (
if (!ObjDesc)
{
- /* No attached object, we are done */
+ /* No attached object. Some types should always have an object */
+
+ switch (Type)
+ {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_BUFFER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_METHOD:
+ AcpiOsPrintf ("<No attached object>");
+ break;
+
+ default:
+ break;
+ }
AcpiOsPrintf ("\n");
return (AE_OK);
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsdumpdv.c b/usr/src/uts/intel/io/acpica/namespace/nsdumpdv.c
index 11aab7a3a9..9d30886608 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsdumpdv.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsdumpdv.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -141,7 +141,7 @@ AcpiNsDumpRootDevices (
return;
}
- Status = AcpiGetHandle (NULL, ACPI_NS_SYSTEM_BUS, &SysBusHandle);
+ Status = AcpiGetHandle (NULL, METHOD_NAME__SB_, &SysBusHandle);
if (ACPI_FAILURE (Status))
{
return;
diff --git a/usr/src/uts/intel/io/acpica/namespace/nseval.c b/usr/src/uts/intel/io/acpica/namespace/nseval.c
index c376ac7213..0183f7e774 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nseval.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nseval.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsinit.c b/usr/src/uts/intel/io/acpica/namespace/nsinit.c
index 1822bf519f..f3907aafb3 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsinit.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsinit.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsload.c b/usr/src/uts/intel/io/acpica/namespace/nsload.c
index 5825f6bc9d..3ef33f9ce9 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsload.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsload.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsnames.c b/usr/src/uts/intel/io/acpica/namespace/nsnames.c
index e59b2e9569..f70900da1d 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsnames.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsnames.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsobject.c b/usr/src/uts/intel/io/acpica/namespace/nsobject.c
index dadd2e8d98..9b219a5624 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsobject.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsobject.c
@@ -6,7 +6,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsparse.c b/usr/src/uts/intel/io/acpica/namespace/nsparse.c
index 983697eaaf..2c768c0b69 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsparse.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsparse.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nspredef.c b/usr/src/uts/intel/io/acpica/namespace/nspredef.c
index 95c3edf04d..3a61aa3666 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nspredef.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nspredef.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -216,14 +216,20 @@ AcpiNsCheckPredefinedNames (
}
/*
- * 1) We have a return value, but if one wasn't expected, just exit, this is
- * not a problem. For example, if the "Implicit Return" feature is
- * enabled, methods will always return a value.
+ * Return value validation and possible repair.
*
- * 2) If the return value can be of any type, then we cannot perform any
- * validation, exit.
+ * 1) Don't perform return value validation/repair if this feature
+ * has been disabled via a global option.
+ *
+ * 2) We have a return value, but if one wasn't expected, just exit,
+ * this is not a problem. For example, if the "Implicit Return"
+ * feature is enabled, methods will always return a value.
+ *
+ * 3) If the return value can be of any type, then we cannot perform
+ * any validation, just exit.
*/
- if ((!Predefined->Info.ExpectedBtypes) ||
+ if (AcpiGbl_DisableAutoRepair ||
+ (!Predefined->Info.ExpectedBtypes) ||
(Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL))
{
goto Cleanup;
@@ -237,6 +243,7 @@ AcpiNsCheckPredefinedNames (
goto Cleanup;
}
Data->Predefined = Predefined;
+ Data->Node = Node;
Data->NodeFlags = Node->Flags;
Data->Pathname = Pathname;
@@ -658,6 +665,7 @@ AcpiNsCheckPackage (
case ACPI_PTYPE2_FIXED:
case ACPI_PTYPE2_MIN:
case ACPI_PTYPE2_COUNT:
+ case ACPI_PTYPE2_FIX_VAR:
/*
* These types all return a single Package that consists of a
@@ -673,7 +681,7 @@ AcpiNsCheckPackage (
{
/* Create the new outer package and populate it */
- Status = AcpiNsRepairPackageList (Data, ReturnObjectPtr);
+ Status = AcpiNsWrapWithPackage (Data, *Elements, ReturnObjectPtr);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -800,6 +808,29 @@ AcpiNsCheckPackageList (
break;
+ case ACPI_PTYPE2_FIX_VAR:
+ /*
+ * Each subpackage has a fixed number of elements and an
+ * optional element
+ */
+ ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
+ if (SubPackage->Package.Count < ExpectedCount)
+ {
+ goto PackageTooSmall;
+ }
+
+ Status = AcpiNsCheckPackageElements (Data, SubElements,
+ Package->RetInfo.ObjectType1,
+ Package->RetInfo.Count1,
+ Package->RetInfo.ObjectType2,
+ SubPackage->Package.Count - Package->RetInfo.Count1, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ break;
+
+
case ACPI_PTYPE2_FIXED:
/* Each sub-package has a fixed length */
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsrepair.c b/usr/src/uts/intel/io/acpica/namespace/nsrepair.c
index be73953ded..be9d3e889d 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsrepair.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsrepair.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -74,11 +74,10 @@
* Buffer -> String
* Buffer -> Package of Integers
* Package -> Package of one Package
+ * An incorrect standalone object is wrapped with required outer package
*
* Additional possible repairs:
- *
* Required package elements that are NULL replaced by Integer/String/Buffer
- * Incorrect standalone package wrapped with required outer package
*
******************************************************************************/
@@ -100,11 +99,6 @@ AcpiNsConvertToBuffer (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject);
-static ACPI_STATUS
-AcpiNsConvertToPackage (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject);
-
/*******************************************************************************
*
@@ -172,10 +166,24 @@ AcpiNsRepairObject (
}
if (ExpectedBtypes & ACPI_RTYPE_PACKAGE)
{
- Status = AcpiNsConvertToPackage (ReturnObject, &NewObject);
+ /*
+ * A package is expected. We will wrap the existing object with a
+ * new package object. It is often the case that if a variable-length
+ * package is required, but there is only a single object needed, the
+ * BIOS will return that object instead of wrapping it with a Package
+ * object. Note: after the wrapping, the package will be validated
+ * for correct contents (expected object type or types).
+ */
+ Status = AcpiNsWrapWithPackage (Data, ReturnObject, &NewObject);
if (ACPI_SUCCESS (Status))
{
- goto ObjectRepaired;
+ /*
+ * The original object just had its reference count
+ * incremented for being inserted into the new package.
+ */
+ *ReturnObjectPtr = NewObject; /* New Package object */
+ Data->Flags |= ACPI_OBJECT_REPAIRED;
+ return (AE_OK);
}
}
@@ -188,24 +196,30 @@ ObjectRepaired:
/* Object was successfully repaired */
- /*
- * If the original object is a package element, we need to:
- * 1. Set the reference count of the new object to match the
- * reference count of the old object.
- * 2. Decrement the reference count of the original object.
- */
if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
{
- NewObject->Common.ReferenceCount =
- ReturnObject->Common.ReferenceCount;
-
- if (ReturnObject->Common.ReferenceCount > 1)
+ /*
+ * The original object is a package element. We need to
+ * decrement the reference count of the original object,
+ * for removing it from the package.
+ *
+ * However, if the original object was just wrapped with a
+ * package object as part of the repair, we don't need to
+ * change the reference count.
+ */
+ if (!(Data->Flags & ACPI_OBJECT_WRAPPED))
{
- ReturnObject->Common.ReferenceCount--;
+ NewObject->Common.ReferenceCount =
+ ReturnObject->Common.ReferenceCount;
+
+ if (ReturnObject->Common.ReferenceCount > 1)
+ {
+ ReturnObject->Common.ReferenceCount--;
+ }
}
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
- "%s: Converted %s to expected %s at index %u\n",
+ "%s: Converted %s to expected %s at Package index %u\n",
Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
AcpiUtGetObjectTypeName (NewObject), PackageIndex));
}
@@ -498,71 +512,6 @@ AcpiNsConvertToBuffer (
/*******************************************************************************
*
- * FUNCTION: AcpiNsConvertToPackage
- *
- * PARAMETERS: OriginalObject - Object to be converted
- * ReturnObject - Where the new converted object is returned
- *
- * RETURN: Status. AE_OK if conversion was successful.
- *
- * DESCRIPTION: Attempt to convert a Buffer object to a Package. Each byte of
- * the buffer is converted to a single integer package element.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiNsConvertToPackage (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject)
-{
- ACPI_OPERAND_OBJECT *NewObject;
- ACPI_OPERAND_OBJECT **Elements;
- UINT32 Length;
- UINT8 *Buffer;
-
-
- switch (OriginalObject->Common.Type)
- {
- case ACPI_TYPE_BUFFER:
-
- /* Buffer-to-Package conversion */
-
- Length = OriginalObject->Buffer.Length;
- NewObject = AcpiUtCreatePackageObject (Length);
- if (!NewObject)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Convert each buffer byte to an integer package element */
-
- Elements = NewObject->Package.Elements;
- Buffer = OriginalObject->Buffer.Pointer;
-
- while (Length--)
- {
- *Elements = AcpiUtCreateIntegerObject ((UINT64) *Buffer);
- if (!*Elements)
- {
- AcpiUtRemoveReference (NewObject);
- return (AE_NO_MEMORY);
- }
- Elements++;
- Buffer++;
- }
- break;
-
- default:
- return (AE_AML_OPERAND_TYPE);
- }
-
- *ReturnObject = NewObject;
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiNsRepairNullElement
*
* PARAMETERS: Data - Pointer to validation data structure
@@ -696,6 +645,7 @@ AcpiNsRemoveNullElements (
case ACPI_PTYPE2_FIXED:
case ACPI_PTYPE2_MIN:
case ACPI_PTYPE2_REV_FIXED:
+ case ACPI_PTYPE2_FIX_VAR:
break;
default:
@@ -744,42 +694,43 @@ AcpiNsRemoveNullElements (
/*******************************************************************************
*
- * FUNCTION: AcpiNsRepairPackageList
+ * FUNCTION: AcpiNsWrapWithPackage
*
* PARAMETERS: Data - Pointer to validation data structure
- * ObjDescPtr - Pointer to the object to repair. The new
- * package object is returned here,
- * overwriting the old object.
+ * OriginalObject - Pointer to the object to repair.
+ * ObjDescPtr - The new package object is returned here
*
* RETURN: Status, new object in *ObjDescPtr
*
- * DESCRIPTION: Repair a common problem with objects that are defined to return
- * a variable-length Package of Packages. If the variable-length
- * is one, some BIOS code mistakenly simply declares a single
- * Package instead of a Package with one sub-Package. This
- * function attempts to repair this error by wrapping a Package
- * object around the original Package, creating the correct
- * Package with one sub-Package.
+ * DESCRIPTION: Repair a common problem with objects that are defined to
+ * return a variable-length Package of sub-objects. If there is
+ * only one sub-object, some BIOS code mistakenly simply declares
+ * the single object instead of a Package with one sub-object.
+ * This function attempts to repair this error by wrapping a
+ * Package object around the original object, creating the
+ * correct and expected Package with one sub-object.
*
* Names that can be repaired in this manner include:
- * _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS
+ * _ALR, _CSD, _HPX, _MLS, _PLD, _PRT, _PSS, _TRT, _TSS,
+ * _BCL, _DOD, _FIX, _Sx
*
******************************************************************************/
ACPI_STATUS
-AcpiNsRepairPackageList (
+AcpiNsWrapWithPackage (
ACPI_PREDEFINED_DATA *Data,
+ ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_OPERAND_OBJECT *PkgObjDesc;
- ACPI_FUNCTION_NAME (NsRepairPackageList);
+ ACPI_FUNCTION_NAME (NsWrapWithPackage);
/*
* Create the new outer package and populate it. The new package will
- * have a single element, the lone subpackage.
+ * have a single element, the lone sub-object.
*/
PkgObjDesc = AcpiUtCreatePackageObject (1);
if (!PkgObjDesc)
@@ -787,15 +738,15 @@ AcpiNsRepairPackageList (
return (AE_NO_MEMORY);
}
- PkgObjDesc->Package.Elements[0] = *ObjDescPtr;
+ PkgObjDesc->Package.Elements[0] = OriginalObject;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
+ "%s: Wrapped %s with expected Package object\n",
+ Data->Pathname, AcpiUtGetObjectTypeName (OriginalObject)));
/* Return the new object in the object pointer */
*ObjDescPtr = PkgObjDesc;
- Data->Flags |= ACPI_OBJECT_REPAIRED;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
- "%s: Repaired incorrectly formed Package\n", Data->Pathname));
-
+ Data->Flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
return (AE_OK);
}
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsrepair2.c b/usr/src/uts/intel/io/acpica/namespace/nsrepair2.c
index 4c9c6d7825..a6a4d6874d 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsrepair2.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsrepair2.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -516,11 +516,12 @@ AcpiNsRepair_HID (
}
/*
- * Copy and uppercase the string. From the ACPI specification:
+ * Copy and uppercase the string. From the ACPI 5.0 specification:
*
* A valid PNP ID must be of the form "AAA####" where A is an uppercase
* letter and # is a hex digit. A valid ACPI ID must be of the form
- * "ACPI####" where # is a hex digit.
+ * "NNNN####" where N is an uppercase letter or decimal digit, and
+ * # is a hex digit.
*/
for (Dest = NewString->String.Pointer; *Source; Dest++, Source++)
{
@@ -555,8 +556,23 @@ AcpiNsRepair_TSS (
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ /*
+ * We can only sort the _TSS return package if there is no _PSS in the
+ * same scope. This is because if _PSS is present, the ACPI specification
+ * dictates that the _TSS Power Dissipation field is to be ignored, and
+ * therefore some BIOSs leave garbage values in the _TSS Power field(s).
+ * In this case, it is best to just return the _TSS package as-is.
+ * (May, 2011)
+ */
+ Status = AcpiNsGetNode (Data->Node, "^_PSS", ACPI_NS_NO_UPSEARCH, &Node);
+ if (ACPI_SUCCESS (Status))
+ {
+ return (AE_OK);
+ }
+
Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1,
ACPI_SORT_DESCENDING, "PowerDissipation");
diff --git a/usr/src/uts/intel/io/acpica/namespace/nssearch.c b/usr/src/uts/intel/io/acpica/namespace/nssearch.c
index 1951c2548b..d6f59ccbd1 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nssearch.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nssearch.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsutils.c b/usr/src/uts/intel/io/acpica/namespace/nsutils.c
index fad2a57c5e..43f734e819 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsutils.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsutils.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -405,7 +405,7 @@ AcpiNsBuildInternalName (
if (!AcpiNsValidPathSeparator (*ExternalName) &&
(*ExternalName != 0))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_BAD_PATHNAME);
}
/* Move on the next segment */
diff --git a/usr/src/uts/intel/io/acpica/namespace/nswalk.c b/usr/src/uts/intel/io/acpica/namespace/nswalk.c
index d44775212a..35c3e17896 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nswalk.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nswalk.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsxfeval.c b/usr/src/uts/intel/io/acpica/namespace/nsxfeval.c
index 0854cac9e9..5006588e85 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsxfeval.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsxfeval.c
@@ -6,7 +6,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsxfname.c b/usr/src/uts/intel/io/acpica/namespace/nsxfname.c
index b0ccff5bdc..4690d09e90 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsxfname.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsxfname.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/namespace/nsxfobj.c b/usr/src/uts/intel/io/acpica/namespace/nsxfobj.c
index 9910248220..02f7777a39 100644
--- a/usr/src/uts/intel/io/acpica/namespace/nsxfobj.c
+++ b/usr/src/uts/intel/io/acpica/namespace/nsxfobj.c
@@ -6,7 +6,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/osl.c b/usr/src/uts/intel/io/acpica/osl.c
index d5bfab754f..44f8d2f48f 100644
--- a/usr/src/uts/intel/io/acpica/osl.c
+++ b/usr/src/uts/intel/io/acpica/osl.c
@@ -22,7 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2011 Joyent, Inc. All rights reserved.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/*
* Copyright (c) 2009-2010, Intel Corporation.
@@ -315,6 +315,12 @@ AcpiOsTableOverride(ACPI_TABLE_HEADER *ExistingTable,
return (AE_OK);
}
+ACPI_STATUS
+AcpiOsPhysicalTableOverride(ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_PHYSICAL_ADDRESS *NewAddress, UINT32 *NewTableLength)
+{
+ return (AE_SUPPORT);
+}
/*
* ACPI semaphore implementation
@@ -883,7 +889,7 @@ AcpiOsWritePort(ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width)
static void
-osl_rw_memory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value,
+osl_rw_memory(ACPI_PHYSICAL_ADDRESS Address, UINT64 *Value,
UINT32 Width, int write)
{
size_t maplen = Width / 8;
@@ -902,6 +908,9 @@ osl_rw_memory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value,
case 4:
OSL_RW(ptr, Value, uint32_t, write);
break;
+ case 8:
+ OSL_RW(ptr, Value, uint64_t, write);
+ break;
default:
cmn_err(CE_WARN, "!osl_rw_memory: invalid size %d",
Width);
@@ -913,7 +922,7 @@ osl_rw_memory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value,
ACPI_STATUS
AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address,
- UINT32 *Value, UINT32 Width)
+ UINT64 *Value, UINT32 Width)
{
osl_rw_memory(Address, Value, Width, 0);
return (AE_OK);
@@ -921,7 +930,7 @@ AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address,
ACPI_STATUS
AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address,
- UINT32 Value, UINT32 Width)
+ UINT64 Value, UINT32 Width)
{
osl_rw_memory(Address, &Value, Width, 1);
return (AE_OK);
diff --git a/usr/src/uts/intel/io/acpica/parser/psargs.c b/usr/src/uts/intel/io/acpica/parser/psargs.c
index e383def11e..8140fdbb9d 100644
--- a/usr/src/uts/intel/io/acpica/parser/psargs.c
+++ b/usr/src/uts/intel/io/acpica/parser/psargs.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -531,37 +531,57 @@ static ACPI_PARSE_OBJECT *
AcpiPsGetNextField (
ACPI_PARSE_STATE *ParserState)
{
- UINT32 AmlOffset = (UINT32)
- ACPI_PTR_DIFF (ParserState->Aml,
- ParserState->AmlStart);
+ UINT32 AmlOffset;
ACPI_PARSE_OBJECT *Field;
+ ACPI_PARSE_OBJECT *Arg = NULL;
UINT16 Opcode;
UINT32 Name;
+ UINT8 AccessType;
+ UINT8 AccessAttribute;
+ UINT8 AccessLength;
+ UINT32 PkgLength;
+ UINT8 *PkgEnd;
+ UINT32 BufferLength;
ACPI_FUNCTION_TRACE (PsGetNextField);
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (
+ ParserState->Aml, ParserState->AmlStart);
+
/* Determine field type */
switch (ACPI_GET8 (ParserState->Aml))
{
- default:
+ case AML_FIELD_OFFSET_OP:
- Opcode = AML_INT_NAMEDFIELD_OP;
+ Opcode = AML_INT_RESERVEDFIELD_OP;
+ ParserState->Aml++;
break;
- case 0x00:
+ case AML_FIELD_ACCESS_OP:
- Opcode = AML_INT_RESERVEDFIELD_OP;
+ Opcode = AML_INT_ACCESSFIELD_OP;
ParserState->Aml++;
break;
- case 0x01:
+ case AML_FIELD_CONNECTION_OP:
- Opcode = AML_INT_ACCESSFIELD_OP;
+ Opcode = AML_INT_CONNECTION_OP;
+ ParserState->Aml++;
+ break;
+
+ case AML_FIELD_EXT_ACCESS_OP:
+
+ Opcode = AML_INT_EXTACCESSFIELD_OP;
ParserState->Aml++;
break;
+
+ default:
+
+ Opcode = AML_INT_NAMEDFIELD_OP;
+ break;
}
/* Allocate a new field op */
@@ -601,17 +621,118 @@ AcpiPsGetNextField (
case AML_INT_ACCESSFIELD_OP:
+ case AML_INT_EXTACCESSFIELD_OP:
/*
* Get AccessType and AccessAttrib and merge into the field Op
- * AccessType is first operand, AccessAttribute is second
+ * AccessType is first operand, AccessAttribute is second. stuff
+ * these bytes into the node integer value for convenience.
*/
- Field->Common.Value.Integer = (((UINT32) ACPI_GET8 (ParserState->Aml) << 8));
+
+ /* Get the two bytes (Type/Attribute) */
+
+ AccessType = ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
- Field->Common.Value.Integer |= ACPI_GET8 (ParserState->Aml);
+ AccessAttribute = ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
+
+ Field->Common.Value.Integer = (UINT8) AccessType;
+ Field->Common.Value.Integer |= (UINT16) (AccessAttribute << 8);
+
+ /* This opcode has a third byte, AccessLength */
+
+ if (Opcode == AML_INT_EXTACCESSFIELD_OP)
+ {
+ AccessLength = ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml++;
+
+ Field->Common.Value.Integer |= (UINT32) (AccessLength << 16);
+ }
break;
+
+ case AML_INT_CONNECTION_OP:
+
+ /*
+ * Argument for Connection operator can be either a Buffer
+ * (resource descriptor), or a NameString.
+ */
+ if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP)
+ {
+ ParserState->Aml++;
+
+ PkgEnd = ParserState->Aml;
+ PkgLength = AcpiPsGetNextPackageLength (ParserState);
+ PkgEnd += PkgLength;
+
+ if (ParserState->Aml < PkgEnd)
+ {
+ /* Non-empty list */
+
+ Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
+ if (!Arg)
+ {
+ AcpiPsFreeOp (Field);
+ return_PTR (NULL);
+ }
+
+ /* Get the actual buffer length argument */
+
+ Opcode = ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml++;
+
+ switch (Opcode)
+ {
+ case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
+ BufferLength = ACPI_GET8 (ParserState->Aml);
+ ParserState->Aml += 1;
+ break;
+
+ case AML_WORD_OP: /* AML_WORDDATA_ARG */
+ BufferLength = ACPI_GET16 (ParserState->Aml);
+ ParserState->Aml += 2;
+ break;
+
+ case AML_DWORD_OP: /* AML_DWORDATA_ARG */
+ BufferLength = ACPI_GET32 (ParserState->Aml);
+ ParserState->Aml += 4;
+ break;
+
+ default:
+ BufferLength = 0;
+ break;
+ }
+
+ /* Fill in bytelist data */
+
+ Arg->Named.Value.Size = BufferLength;
+ Arg->Named.Data = ParserState->Aml;
+ }
+
+ /* Skip to End of byte data */
+
+ ParserState->Aml = PkgEnd;
+ }
+ else
+ {
+ Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ if (!Arg)
+ {
+ AcpiPsFreeOp (Field);
+ return_PTR (NULL);
+ }
+
+ /* Get the Namestring argument */
+
+ Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
+ }
+
+ /* Link the buffer/namestring to parent (CONNECTION_OP) */
+
+ AcpiPsAppendArg (Field, Arg);
+ break;
+
+
default:
/* Opcode was set in previous switch */
diff --git a/usr/src/uts/intel/io/acpica/parser/psloop.c b/usr/src/uts/intel/io/acpica/parser/psloop.c
index a98989e099..d578c7e36b 100644
--- a/usr/src/uts/intel/io/acpica/parser/psloop.c
+++ b/usr/src/uts/intel/io/acpica/parser/psloop.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/parser/psopcode.c b/usr/src/uts/intel/io/acpica/parser/psopcode.c
index 0d82976d7f..ef2257e86f 100644
--- a/usr/src/uts/intel/io/acpica/parser/psopcode.c
+++ b/usr/src/uts/intel/io/acpica/parser/psopcode.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -328,12 +328,17 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
-/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE),
/* ACPI 3.0 opcodes */
-/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R)
+/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R),
+
+/* ACPI 5.0 opcodes */
+
+/* 7F */ ACPI_OP ("-ConnectField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 80 */ ACPI_OP ("-ExtAccessField-", ARGP_CONNECTFIELD_OP, ARGI_CONNECTFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0)
/*! [End] no source code translation !*/
};
@@ -353,7 +358,7 @@ static const UINT8 AcpiGbl_ShortOpIndex[256] =
/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
-/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
diff --git a/usr/src/uts/intel/io/acpica/parser/psparse.c b/usr/src/uts/intel/io/acpica/parser/psparse.c
index f817749b75..bcf46adfe5 100644
--- a/usr/src/uts/intel/io/acpica/parser/psparse.c
+++ b/usr/src/uts/intel/io/acpica/parser/psparse.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/parser/psscope.c b/usr/src/uts/intel/io/acpica/parser/psscope.c
index 827531d460..1df5a33af3 100644
--- a/usr/src/uts/intel/io/acpica/parser/psscope.c
+++ b/usr/src/uts/intel/io/acpica/parser/psscope.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/parser/pstree.c b/usr/src/uts/intel/io/acpica/parser/pstree.c
index d62bc7b9db..8271314e16 100644
--- a/usr/src/uts/intel/io/acpica/parser/pstree.c
+++ b/usr/src/uts/intel/io/acpica/parser/pstree.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -85,7 +85,12 @@ AcpiPsGetArg (
ACPI_FUNCTION_ENTRY ();
-
+/*
+ if (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP)
+ {
+ return (Op->Common.Value.Arg);
+ }
+*/
/* Get the info structure for this opcode */
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
diff --git a/usr/src/uts/intel/io/acpica/parser/psutils.c b/usr/src/uts/intel/io/acpica/parser/psutils.c
index 426d2ccdd7..e28b75cc8f 100644
--- a/usr/src/uts/intel/io/acpica/parser/psutils.c
+++ b/usr/src/uts/intel/io/acpica/parser/psutils.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/parser/pswalk.c b/usr/src/uts/intel/io/acpica/parser/pswalk.c
index dbb4a17fe9..9734c4d177 100644
--- a/usr/src/uts/intel/io/acpica/parser/pswalk.c
+++ b/usr/src/uts/intel/io/acpica/parser/pswalk.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/parser/psxface.c b/usr/src/uts/intel/io/acpica/parser/psxface.c
index e7a5d9fe9a..2a012c2915 100644
--- a/usr/src/uts/intel/io/acpica/parser/psxface.c
+++ b/usr/src/uts/intel/io/acpica/parser/psxface.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/resources/rsaddr.c b/usr/src/uts/intel/io/acpica/resources/rsaddr.c
index c11e8ca128..90e7d43b6e 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsaddr.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsaddr.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/resources/rscalc.c b/usr/src/uts/intel/io/acpica/resources/rscalc.c
index 15cf685857..845ed69c7d 100644
--- a/usr/src/uts/intel/io/acpica/resources/rscalc.c
+++ b/usr/src/uts/intel/io/acpica/resources/rscalc.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -345,6 +345,26 @@ AcpiRsGetAmlLength (
break;
+ case ACPI_RESOURCE_TYPE_GPIO:
+
+ TotalSize = (ACPI_RS_LENGTH) (TotalSize + (Resource->Data.Gpio.PinTableLength * 2) +
+ Resource->Data.Gpio.ResourceSource.StringLength +
+ Resource->Data.Gpio.VendorLength);
+
+ break;
+
+
+ case ACPI_RESOURCE_TYPE_SERIAL_BUS:
+
+ TotalSize = AcpiGbl_AmlResourceSerialBusSizes [Resource->Data.CommonSerialBus.Type];
+
+ TotalSize = (ACPI_RS_LENGTH) (TotalSize +
+ Resource->Data.I2cSerialBus.ResourceSource.StringLength +
+ Resource->Data.I2cSerialBus.VendorLength);
+
+ break;
+
+
default:
break;
}
@@ -395,12 +415,13 @@ AcpiRsGetListLength (
UINT32 ExtraStructBytes;
UINT8 ResourceIndex;
UINT8 MinimumAmlResourceLength;
+ AML_RESOURCE *AmlResource;
ACPI_FUNCTION_TRACE (RsGetListLength);
- *SizeNeeded = 0;
+ *SizeNeeded = ACPI_RS_SIZE_MIN; /* Minimum size is one EndTag */
EndAml = AmlBuffer + AmlBufferLength;
/* Walk the list of AML resource descriptors */
@@ -412,9 +433,15 @@ AcpiRsGetListLength (
Status = AcpiUtValidateResource (AmlBuffer, &ResourceIndex);
if (ACPI_FAILURE (Status))
{
+ /*
+ * Exit on failure. Cannot continue because the descriptor length
+ * may be bogus also.
+ */
return_ACPI_STATUS (Status);
}
+ AmlResource = (void *) AmlBuffer;
+
/* Get the resource length and base (minimum) AML size */
ResourceLength = AcpiUtGetResourceLength (AmlBuffer);
@@ -460,10 +487,8 @@ AcpiRsGetListLength (
case ACPI_RESOURCE_NAME_END_TAG:
/*
- * End Tag:
- * This is the normal exit, add size of EndTag
+ * End Tag: This is the normal exit
*/
- *SizeNeeded += ACPI_RS_SIZE_MIN;
return_ACPI_STATUS (AE_OK);
@@ -494,6 +519,30 @@ AcpiRsGetListLength (
ResourceLength - ExtraStructBytes, MinimumAmlResourceLength);
break;
+ case ACPI_RESOURCE_NAME_GPIO:
+
+ /* Vendor data is optional */
+
+ if (AmlResource->Gpio.VendorLength)
+ {
+ ExtraStructBytes += AmlResource->Gpio.VendorOffset -
+ AmlResource->Gpio.PinTableOffset + AmlResource->Gpio.VendorLength;
+ }
+ else
+ {
+ ExtraStructBytes += AmlResource->LargeHeader.ResourceLength +
+ sizeof (AML_RESOURCE_LARGE_HEADER) -
+ AmlResource->Gpio.PinTableOffset;
+ }
+ break;
+
+ case ACPI_RESOURCE_NAME_SERIAL_BUS:
+
+ MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[
+ AmlResource->CommonSerialBus.Type];
+ ExtraStructBytes += AmlResource->CommonSerialBus.ResourceLength -
+ MinimumAmlResourceLength;
+ break;
default:
break;
@@ -505,8 +554,16 @@ AcpiRsGetListLength (
* Important: Round the size up for the appropriate alignment. This
* is a requirement on IA64.
*/
- BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] +
+ if (AcpiUtGetResourceType (AmlBuffer) == ACPI_RESOURCE_NAME_SERIAL_BUS)
+ {
+ BufferSize = AcpiGbl_ResourceStructSerialBusSizes[
+ AmlResource->CommonSerialBus.Type] + ExtraStructBytes;
+ }
+ else
+ {
+ BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] +
ExtraStructBytes;
+ }
BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize);
*SizeNeeded += BufferSize;
diff --git a/usr/src/uts/intel/io/acpica/resources/rscreate.c b/usr/src/uts/intel/io/acpica/resources/rscreate.c
index 40cf447c29..f06ea0cb4d 100644
--- a/usr/src/uts/intel/io/acpica/resources/rscreate.c
+++ b/usr/src/uts/intel/io/acpica/resources/rscreate.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,79 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiBufferToResource
+ *
+ * PARAMETERS: AmlBuffer - Pointer to the resource byte stream
+ * AmlBufferLength - Length of the AmlBuffer
+ * ResourcePtr - Where the converted resource is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert a raw AML buffer to a resource list
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiBufferToResource (
+ UINT8 *AmlBuffer,
+ UINT16 AmlBufferLength,
+ ACPI_RESOURCE **ResourcePtr)
+{
+ ACPI_STATUS Status;
+ ACPI_SIZE ListSizeNeeded;
+ void *Resource;
+ void *CurrentResourcePtr;
+
+ /*
+ * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag
+ * is not required here.
+ */
+
+ /* Get the required length for the converted resource */
+
+ Status = AcpiRsGetListLength (AmlBuffer, AmlBufferLength,
+ &ListSizeNeeded);
+ if (Status == AE_AML_NO_RESOURCE_END_TAG)
+ {
+ Status = AE_OK;
+ }
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Allocate a buffer for the converted resource */
+
+ Resource = ACPI_ALLOCATE_ZEROED (ListSizeNeeded);
+ CurrentResourcePtr = Resource;
+ if (!Resource)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Perform the AML-to-Resource conversion */
+
+ Status = AcpiUtWalkAmlResources (AmlBuffer, AmlBufferLength,
+ AcpiRsConvertAmlToResources, &CurrentResourcePtr);
+ if (Status == AE_AML_NO_RESOURCE_END_TAG)
+ {
+ Status = AE_OK;
+ }
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_FREE (Resource);
+ }
+ else
+ {
+ *ResourcePtr = Resource;
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiRsCreateResourceList
*
* PARAMETERS: AmlBuffer - Pointer to the resource byte stream
diff --git a/usr/src/uts/intel/io/acpica/resources/rsdump.c b/usr/src/uts/intel/io/acpica/resources/rsdump.c
index 5470677447..68564739eb 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsdump.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsdump.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -91,6 +91,11 @@ AcpiRsDumpByteList (
UINT8 *Data);
static void
+AcpiRsDumpWordList (
+ UINT16 Length,
+ UINT16 *Data);
+
+static void
AcpiRsDumpDwordList (
UINT8 Length,
UINT32 *Data);
@@ -289,6 +294,87 @@ ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] =
{ACPI_RSD_UINT64, ACPI_RSD_OFFSET (GenericReg.Address), "Address", NULL}
};
+ACPI_RSDUMP_INFO AcpiRsDumpGpio[16] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGpio), "GPIO", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.RevisionId), "RevisionId", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.ConnectionType), "ConnectionType", AcpiGbl_CtDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.PinConfig), "PinConfig", AcpiGbl_PpcDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Sharable), "Sharable", AcpiGbl_ShrDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.IoRestriction), "IoRestriction", AcpiGbl_IorDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.Triggering), "Triggering", AcpiGbl_HeDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Polarity), "Polarity", AcpiGbl_LlDecode},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.DriveStrength), "DriveStrength", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.DebounceTimeout), "DebounceTimeout", NULL},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Gpio.ResourceSource), "ResourceSource", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.PinTableLength), "PinTableLength", NULL},
+ {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (Gpio.PinTable), "PinTable", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.VendorLength), "VendorLength", NULL},
+ {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (Gpio.VendorData), "VendorData", NULL},
+};
+
+ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[4] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedDma), "FixedDma", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedDma.RequestLines), "RequestLines", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedDma.Channels), "Channels", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedDma.Width), "TransferWidth", AcpiGbl_DtsDecode},
+};
+
+#define ACPI_RS_DUMP_COMMON_SERIAL_BUS \
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.RevisionId), "RevisionId", NULL}, \
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.Type), "Type", AcpiGbl_SbtDecode}, \
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, \
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.SlaveMode), "SlaveMode", AcpiGbl_SmDecode}, \
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.TypeRevisionId), "TypeRevisionId", NULL}, \
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.TypeDataLength), "TypeDataLength", NULL}, \
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (CommonSerialBus.ResourceSource), "ResourceSource", NULL}, \
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.VendorLength), "VendorLength", NULL}, \
+ {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (CommonSerialBus.VendorData), "VendorData", NULL},
+
+ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[10] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpCommonSerialBus), "Common Serial Bus", NULL},
+ ACPI_RS_DUMP_COMMON_SERIAL_BUS
+};
+
+ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[13] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpI2cSerialBus), "I2C Serial Bus", NULL},
+ ACPI_RS_DUMP_COMMON_SERIAL_BUS
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (I2cSerialBus.AccessMode), "AccessMode", AcpiGbl_AmDecode},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (I2cSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (I2cSerialBus.SlaveAddress), "SlaveAddress", NULL},
+};
+
+ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[17] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpSpiSerialBus), "Spi Serial Bus", NULL},
+ ACPI_RS_DUMP_COMMON_SERIAL_BUS
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (SpiSerialBus.WireMode), "WireMode", AcpiGbl_WmDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (SpiSerialBus.DevicePolarity), "DevicePolarity", AcpiGbl_DpDecode},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.DataBitLength), "DataBitLength", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.ClockPhase), "ClockPhase", AcpiGbl_CphDecode},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.ClockPolarity), "ClockPolarity", AcpiGbl_CpoDecode},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (SpiSerialBus.DeviceSelection), "DeviceSelection", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (SpiSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL},
+};
+
+ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[19] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpUartSerialBus), "Uart Serial Bus", NULL},
+ ACPI_RS_DUMP_COMMON_SERIAL_BUS
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.FlowControl), "FlowControl", AcpiGbl_FcDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.StopBits), "StopBits", AcpiGbl_SbDecode},
+ {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.DataBits), "DataBits", AcpiGbl_BpbDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.Endian), "Endian", AcpiGbl_EdDecode},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (UartSerialBus.Parity), "Parity", AcpiGbl_PtDecode},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (UartSerialBus.LinesEnabled), "LinesEnabled", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (UartSerialBus.RxFifoSize), "RxFifoSize", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (UartSerialBus.TxFifoSize), "TxFifoSize", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (UartSerialBus.DefaultBaudRate), "ConnectionSpeed", NULL},
+};
/*
* Tables used for common address descriptor flag fields
@@ -391,7 +477,15 @@ AcpiRsDumpDescriptor (
/* Data items, 8/16/32/64 bit */
case ACPI_RSD_UINT8:
- AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
+ if (Table->Pointer)
+ {
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char,
+ Table->Pointer [*Target]));
+ }
+ else
+ {
+ AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
+ }
break;
case ACPI_RSD_UINT16:
@@ -418,6 +512,11 @@ AcpiRsDumpDescriptor (
Table->Pointer [*Target & 0x03]));
break;
+ case ACPI_RSD_3BITFLAG:
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char,
+ Table->Pointer [*Target & 0x07]));
+ break;
+
case ACPI_RSD_SHORTLIST:
/*
* Short byte list (single line output) for DMA and IRQ resources
@@ -430,6 +529,19 @@ AcpiRsDumpDescriptor (
}
break;
+ case ACPI_RSD_SHORTLISTX:
+ /*
+ * Short byte list (single line output) for GPIO vendor data
+ * Note: The list length is obtained from the previous table entry
+ */
+ if (PreviousTarget)
+ {
+ AcpiRsOutTitle (Name);
+ AcpiRsDumpShortByteList (*PreviousTarget,
+ *(ACPI_CAST_INDIRECT_PTR (UINT8, Target)));
+ }
+ break;
+
case ACPI_RSD_LONGLIST:
/*
* Long byte list for Vendor resource data
@@ -453,6 +565,18 @@ AcpiRsDumpDescriptor (
}
break;
+ case ACPI_RSD_WORDLIST:
+ /*
+ * Word list for GPIO Pin Table
+ * Note: The list length is obtained from the previous table entry
+ */
+ if (PreviousTarget)
+ {
+ AcpiRsDumpWordList (*PreviousTarget,
+ *(ACPI_CAST_INDIRECT_PTR (UINT16, Target)));
+ }
+ break;
+
case ACPI_RSD_ADDRESS:
/*
* Common flags for all Address resources
@@ -613,13 +737,20 @@ AcpiRsDumpResourceList (
/* Dump the resource descriptor */
- AcpiRsDumpDescriptor (&ResourceList->Data,
- AcpiGbl_DumpResourceDispatch[Type]);
+ if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS)
+ {
+ AcpiRsDumpDescriptor (&ResourceList->Data,
+ AcpiGbl_DumpSerialBusDispatch[ResourceList->Data.CommonSerialBus.Type]);
+ }
+ else
+ {
+ AcpiRsDumpDescriptor (&ResourceList->Data,
+ AcpiGbl_DumpResourceDispatch[Type]);
+ }
/* Point to the next resource structure */
- ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,
- ResourceList->Length);
+ ResourceList = ACPI_NEXT_RESOURCE (ResourceList);
/* Exit when END_TAG descriptor is reached */
@@ -796,5 +927,20 @@ AcpiRsDumpDwordList (
}
}
+static void
+AcpiRsDumpWordList (
+ UINT16 Length,
+ UINT16 *Data)
+{
+ UINT16 i;
+
+
+ for (i = 0; i < Length; i++)
+ {
+ AcpiOsPrintf ("%25s%2.2X : %4.4X\n",
+ "Word", i, Data[i]);
+ }
+}
+
#endif
diff --git a/usr/src/uts/intel/io/acpica/resources/rsinfo.c b/usr/src/uts/intel/io/acpica/resources/rsinfo.c
index 5753667806..e7287d5455 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsinfo.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsinfo.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -82,7 +82,10 @@ ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[] =
AcpiRsConvertAddress64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
AcpiRsConvertExtAddress64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
AcpiRsConvertExtIrq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
- AcpiRsConvertGenericReg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
+ AcpiRsConvertGenericReg, /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
+ AcpiRsConvertGpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */
+ AcpiRsConvertFixedDma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */
+ NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */
};
/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
@@ -101,7 +104,7 @@ ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] =
AcpiRsConvertEndDpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
AcpiRsConvertIo, /* 0x08, ACPI_RESOURCE_NAME_IO */
AcpiRsConvertFixedIo, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
- NULL, /* 0x0A, Reserved */
+ AcpiRsConvertFixedDma, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */
NULL, /* 0x0B, Reserved */
NULL, /* 0x0C, Reserved */
NULL, /* 0x0D, Reserved */
@@ -121,7 +124,20 @@ ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] =
AcpiRsConvertAddress16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
AcpiRsConvertExtIrq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
AcpiRsConvertAddress64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
- AcpiRsConvertExtAddress64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
+ AcpiRsConvertExtAddress64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
+ AcpiRsConvertGpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */
+ NULL, /* 0x0D, Reserved */
+ NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */
+};
+
+/* Subtype table for SerialBus -- I2C, SPI, and UART */
+
+ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[] =
+{
+ NULL,
+ AcpiRsConvertI2cSerialBus,
+ AcpiRsConvertSpiSerialBus,
+ AcpiRsConvertUartSerialBus,
};
@@ -148,6 +164,17 @@ ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] =
AcpiRsDumpExtAddress64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
AcpiRsDumpExtIrq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
AcpiRsDumpGenericReg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
+ AcpiRsDumpGpio, /* ACPI_RESOURCE_TYPE_GPIO */
+ AcpiRsDumpFixedDma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */
+ NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */
+};
+
+ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[] =
+{
+ NULL,
+ AcpiRsDumpI2cSerialBus, /* AML_RESOURCE_I2C_BUS_TYPE */
+ AcpiRsDumpSpiSerialBus, /* AML_RESOURCE_SPI_BUS_TYPE */
+ AcpiRsDumpUartSerialBus, /* AML_RESOURCE_UART_BUS_TYPE */
};
#endif
@@ -175,7 +202,10 @@ const UINT8 AcpiGbl_AmlResourceSizes[] =
sizeof (AML_RESOURCE_ADDRESS64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
sizeof (AML_RESOURCE_EXTENDED_IRQ), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
- sizeof (AML_RESOURCE_GENERIC_REGISTER) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
+ sizeof (AML_RESOURCE_GENERIC_REGISTER), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
+ sizeof (AML_RESOURCE_GPIO), /* ACPI_RESOURCE_TYPE_GPIO */
+ sizeof (AML_RESOURCE_FIXED_DMA), /* ACPI_RESOURCE_TYPE_FIXED_DMA */
+ sizeof (AML_RESOURCE_COMMON_SERIALBUS), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */
};
@@ -193,7 +223,7 @@ const UINT8 AcpiGbl_ResourceStructSizes[] =
ACPI_RS_SIZE_MIN,
ACPI_RS_SIZE (ACPI_RESOURCE_IO),
ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO),
- 0,
+ ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA),
0,
0,
0,
@@ -213,6 +243,23 @@ const UINT8 AcpiGbl_ResourceStructSizes[] =
ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16),
ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ),
ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64),
- ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64)
+ ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64),
+ ACPI_RS_SIZE (ACPI_RESOURCE_GPIO),
+ ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS)
+};
+
+const UINT8 AcpiGbl_AmlResourceSerialBusSizes[] =
+{
+ 0,
+ sizeof (AML_RESOURCE_I2C_SERIALBUS),
+ sizeof (AML_RESOURCE_SPI_SERIALBUS),
+ sizeof (AML_RESOURCE_UART_SERIALBUS),
};
+const UINT8 AcpiGbl_ResourceStructSerialBusSizes[] =
+{
+ 0,
+ ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS),
+ ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS),
+ ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS),
+};
diff --git a/usr/src/uts/intel/io/acpica/resources/rsio.c b/usr/src/uts/intel/io/acpica/resources/rsio.c
index 2d0f9f7baa..065108cfa1 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsio.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsio.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/resources/rsirq.c b/usr/src/uts/intel/io/acpica/resources/rsirq.c
index ff952f96ff..c2a88ee89a 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsirq.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsirq.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -274,3 +274,35 @@ ACPI_RSCONVERT_INFO AcpiRsConvertDma[6] =
ACPI_RS_OFFSET (Data.Dma.ChannelCount)}
};
+
+/*******************************************************************************
+ *
+ * AcpiRsConvertFixedDma
+ *
+ ******************************************************************************/
+
+ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[4] =
+{
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_DMA,
+ ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedDma)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_DMA,
+ sizeof (AML_RESOURCE_FIXED_DMA),
+ 0},
+
+ /*
+ * These fields are contiguous in both the source and destination:
+ * RequestLines
+ * Channels
+ */
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.FixedDma.RequestLines),
+ AML_OFFSET (FixedDma.RequestLines),
+ 2},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.FixedDma.Width),
+ AML_OFFSET (FixedDma.Width),
+ 1},
+
+};
diff --git a/usr/src/uts/intel/io/acpica/resources/rslist.c b/usr/src/uts/intel/io/acpica/resources/rslist.c
index c64065f2ca..187d56cd42 100644
--- a/usr/src/uts/intel/io/acpica/resources/rslist.c
+++ b/usr/src/uts/intel/io/acpica/resources/rslist.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -77,6 +77,8 @@ AcpiRsConvertAmlToResources (
ACPI_RESOURCE **ResourcePtr = ACPI_CAST_INDIRECT_PTR (
ACPI_RESOURCE, Context);
ACPI_RESOURCE *Resource;
+ AML_RESOURCE *AmlResource;
+ ACPI_RSCONVERT_INFO *ConversionTable;
ACPI_STATUS Status;
@@ -94,11 +96,42 @@ AcpiRsConvertAmlToResources (
"Misaligned resource pointer %p", Resource));
}
- /* Convert the AML byte stream resource to a local resource struct */
+ /* Get the appropriate conversion info table */
+
+ AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml);
+ if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_SERIAL_BUS)
+ {
+ if (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE)
+ {
+ ConversionTable = NULL;
+ }
+ else
+ {
+ /* This is an I2C, SPI, or UART SerialBus descriptor */
+
+ ConversionTable =
+ AcpiGbl_ConvertResourceSerialBusDispatch[
+ AmlResource->CommonSerialBus.Type];
+ }
+ }
+ else
+ {
+ ConversionTable =
+ AcpiGbl_GetResourceDispatch[ResourceIndex];
+ }
+
+ if (!ConversionTable)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid/unsupported resource descriptor: Type 0x%2.2X",
+ ResourceIndex));
+ return (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ /* Convert the AML byte stream resource to a local resource struct */
Status = AcpiRsConvertAmlToResource (
- Resource, ACPI_CAST_PTR (AML_RESOURCE, Aml),
- AcpiGbl_GetResourceDispatch[ResourceIndex]);
+ Resource, AmlResource, ConversionTable);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
@@ -113,7 +146,7 @@ AcpiRsConvertAmlToResources (
/* Point to the next structure in the output buffer */
- *ResourcePtr = ACPI_ADD_PTR (void, Resource, Resource->Length);
+ *ResourcePtr = ACPI_NEXT_RESOURCE (Resource);
return_ACPI_STATUS (AE_OK);
}
@@ -145,6 +178,7 @@ AcpiRsConvertResourcesToAml (
{
UINT8 *Aml = OutputBuffer;
UINT8 *EndAml = OutputBuffer + AmlSizeNeeded;
+ ACPI_RSCONVERT_INFO *ConversionTable;
ACPI_STATUS Status;
@@ -167,9 +201,36 @@ AcpiRsConvertResourcesToAml (
/* Perform the conversion */
+ if (Resource->Type == ACPI_RESOURCE_TYPE_SERIAL_BUS)
+ {
+ if (Resource->Data.CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE)
+ {
+ ConversionTable = NULL;
+ }
+ else
+ {
+ /* This is an I2C, SPI, or UART SerialBus descriptor */
+
+ ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch[
+ Resource->Data.CommonSerialBus.Type];
+ }
+ }
+ else
+ {
+ ConversionTable = AcpiGbl_SetResourceDispatch[Resource->Type];
+ }
+
+ if (!ConversionTable)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid/unsupported resource descriptor: Type 0x%2.2X",
+ Resource->Type));
+ return (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
Status = AcpiRsConvertResourceToAml (Resource,
- ACPI_CAST_PTR (AML_RESOURCE, Aml),
- AcpiGbl_SetResourceDispatch[Resource->Type]);
+ ACPI_CAST_PTR (AML_RESOURCE, Aml),
+ ConversionTable);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
@@ -204,7 +265,7 @@ AcpiRsConvertResourcesToAml (
/* Point to the next input resource descriptor */
- Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
+ Resource = ACPI_NEXT_RESOURCE (Resource);
}
/* Completed buffer, but did not find an EndTag resource descriptor */
diff --git a/usr/src/uts/intel/io/acpica/resources/rsmemory.c b/usr/src/uts/intel/io/acpica/resources/rsmemory.c
index 06262fa64b..83d131956f 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsmemory.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsmemory.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/resources/rsmisc.c b/usr/src/uts/intel/io/acpica/resources/rsmisc.c
index 45415faacc..dfad696ca1 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsmisc.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsmisc.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -94,6 +94,11 @@ AcpiRsConvertAmlToResource (
ACPI_FUNCTION_TRACE (RsConvertAmlToResource);
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
if (((ACPI_SIZE) Resource) & 0x3)
{
/* Each internal resource struct is expected to be 32-bit aligned */
@@ -112,7 +117,6 @@ AcpiRsConvertAmlToResource (
* table length (# of table entries)
*/
Count = INIT_TABLE_LENGTH (Info);
-
while (Count)
{
/*
@@ -162,6 +166,15 @@ AcpiRsConvertAmlToResource (
break;
+ case ACPI_RSC_3BITFLAG:
+ /*
+ * Mask and shift the flag bits
+ */
+ ACPI_SET8 (Destination) = (UINT8)
+ ((ACPI_GET8 (Source) >> Info->Value) & 0x07);
+ break;
+
+
case ACPI_RSC_COUNT:
ItemCount = ACPI_GET8 (Source);
@@ -182,6 +195,75 @@ AcpiRsConvertAmlToResource (
break;
+ case ACPI_RSC_COUNT_GPIO_PIN:
+
+ Target = ACPI_ADD_PTR (void, Aml, Info->Value);
+ ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source);
+
+ Resource->Length = Resource->Length + ItemCount;
+ ItemCount = ItemCount / 2;
+ ACPI_SET16 (Destination) = ItemCount;
+ break;
+
+
+ case ACPI_RSC_COUNT_GPIO_VEN:
+
+ ItemCount = ACPI_GET8 (Source);
+ ACPI_SET8 (Destination) = (UINT8) ItemCount;
+
+ Resource->Length = Resource->Length +
+ (Info->Value * ItemCount);
+ break;
+
+
+ case ACPI_RSC_COUNT_GPIO_RES:
+
+ /*
+ * Vendor data is optional (length/offset may both be zero)
+ * Examine vendor data length field first
+ */
+ Target = ACPI_ADD_PTR (void, Aml, (Info->Value + 2));
+ if (ACPI_GET16 (Target))
+ {
+ /* Use vendor offset to get resource source length */
+
+ Target = ACPI_ADD_PTR (void, Aml, Info->Value);
+ ItemCount = ACPI_GET16 (Target) - ACPI_GET16 (Source);
+ }
+ else
+ {
+ /* No vendor data to worry about */
+
+ ItemCount = Aml->LargeHeader.ResourceLength +
+ sizeof (AML_RESOURCE_LARGE_HEADER) -
+ ACPI_GET16 (Source);
+ }
+
+ Resource->Length = Resource->Length + ItemCount;
+ ACPI_SET16 (Destination) = ItemCount;
+ break;
+
+
+ case ACPI_RSC_COUNT_SERIAL_VEN:
+
+ ItemCount = ACPI_GET16 (Source) - Info->Value;
+
+ Resource->Length = Resource->Length + ItemCount;
+ ACPI_SET16 (Destination) = ItemCount;
+ break;
+
+
+ case ACPI_RSC_COUNT_SERIAL_RES:
+
+ ItemCount = (AmlResourceLength +
+ sizeof (AML_RESOURCE_LARGE_HEADER)) -
+ ACPI_GET16 (Source) - Info->Value;
+
+ Resource->Length = Resource->Length + ItemCount;
+ ACPI_SET16 (Destination) = ItemCount;
+ break;
+
+
case ACPI_RSC_LENGTH:
Resource->Length = Resource->Length + Info->Value;
@@ -204,6 +286,66 @@ AcpiRsConvertAmlToResource (
break;
+ case ACPI_RSC_MOVE_GPIO_PIN:
+
+ /* Generate and set the PIN data pointer */
+
+ Target = (char *) ACPI_ADD_PTR (void, Resource,
+ (Resource->Length - ItemCount * 2));
+ *(UINT16 **) Destination = ACPI_CAST_PTR (UINT16, Target);
+
+ /* Copy the PIN data */
+
+ Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source));
+ AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
+ break;
+
+
+ case ACPI_RSC_MOVE_GPIO_RES:
+
+ /* Generate and set the ResourceSource string pointer */
+
+ Target = (char *) ACPI_ADD_PTR (void, Resource,
+ (Resource->Length - ItemCount));
+ *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target);
+
+ /* Copy the ResourceSource string */
+
+ Source = ACPI_ADD_PTR (void, Aml, ACPI_GET16 (Source));
+ AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
+ break;
+
+
+ case ACPI_RSC_MOVE_SERIAL_VEN:
+
+ /* Generate and set the Vendor Data pointer */
+
+ Target = (char *) ACPI_ADD_PTR (void, Resource,
+ (Resource->Length - ItemCount));
+ *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target);
+
+ /* Copy the Vendor Data */
+
+ Source = ACPI_ADD_PTR (void, Aml, Info->Value);
+ AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
+ break;
+
+
+ case ACPI_RSC_MOVE_SERIAL_RES:
+
+ /* Generate and set the ResourceSource string pointer */
+
+ Target = (char *) ACPI_ADD_PTR (void, Resource,
+ (Resource->Length - ItemCount));
+ *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target);
+
+ /* Copy the ResourceSource string */
+
+ Source = ACPI_ADD_PTR (void, Aml, (ACPI_GET16 (Source) + Info->Value));
+ AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode);
+ break;
+
+
case ACPI_RSC_SET8:
ACPI_MEMSET (Destination, Info->AmlOffset, Info->Value);
@@ -243,11 +385,12 @@ AcpiRsConvertAmlToResource (
* Optional ResourceSource (Index and String). This is the more
* complicated case used by the Interrupt() macro
*/
- Target = ACPI_ADD_PTR (char, Resource, Info->AmlOffset + (ItemCount * 4));
+ Target = ACPI_ADD_PTR (char, Resource,
+ Info->AmlOffset + (ItemCount * 4));
Resource->Length +=
- AcpiRsGetResourceSource (AmlResourceLength,
- (ACPI_RS_LENGTH) (((ItemCount - 1) * sizeof (UINT32)) + Info->Value),
+ AcpiRsGetResourceSource (AmlResourceLength, (ACPI_RS_LENGTH)
+ (((ItemCount - 1) * sizeof (UINT32)) + Info->Value),
Destination, Aml, Target);
break;
@@ -356,6 +499,7 @@ AcpiRsConvertResourceToAml (
{
void *Source = NULL;
void *Destination;
+ char *Target;
ACPI_RSDESC_SIZE AmlLength = 0;
UINT8 Count;
UINT16 Temp16 = 0;
@@ -365,6 +509,11 @@ AcpiRsConvertResourceToAml (
ACPI_FUNCTION_TRACE (RsConvertResourceToAml);
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
/*
* First table entry must be ACPI_RSC_INITxxx and must contain the
* table length (# of table entries)
@@ -420,6 +569,15 @@ AcpiRsConvertResourceToAml (
break;
+ case ACPI_RSC_3BITFLAG:
+ /*
+ * Mask and shift the flag bits
+ */
+ ACPI_SET8 (Destination) |= (UINT8)
+ ((ACPI_GET8 (Source) & 0x07) << Info->Value);
+ break;
+
+
case ACPI_RSC_COUNT:
ItemCount = ACPI_GET8 (Source);
@@ -437,6 +595,68 @@ AcpiRsConvertResourceToAml (
break;
+ case ACPI_RSC_COUNT_GPIO_PIN:
+
+ ItemCount = ACPI_GET16 (Source);
+ ACPI_SET16 (Destination) = (UINT16) AmlLength;
+
+ AmlLength = (UINT16) (AmlLength + ItemCount * 2);
+ Target = ACPI_ADD_PTR (void, Aml, Info->Value);
+ ACPI_SET16 (Target) = (UINT16) AmlLength;
+ AcpiRsSetResourceLength (AmlLength, Aml);
+ break;
+
+
+ case ACPI_RSC_COUNT_GPIO_VEN:
+
+ ItemCount = ACPI_GET16 (Source);
+ ACPI_SET16 (Destination) = (UINT16) ItemCount;
+
+ AmlLength = (UINT16) (AmlLength + (Info->Value * ItemCount));
+ AcpiRsSetResourceLength (AmlLength, Aml);
+ break;
+
+
+ case ACPI_RSC_COUNT_GPIO_RES:
+
+ /* Set resource source string length */
+
+ ItemCount = ACPI_GET16 (Source);
+ ACPI_SET16 (Destination) = (UINT16) AmlLength;
+
+ /* Compute offset for the Vendor Data */
+
+ AmlLength = (UINT16) (AmlLength + ItemCount);
+ Target = ACPI_ADD_PTR (void, Aml, Info->Value);
+
+ /* Set vendor offset only if there is vendor data */
+
+ if (Resource->Data.Gpio.VendorLength)
+ {
+ ACPI_SET16 (Target) = (UINT16) AmlLength;
+ }
+
+ AcpiRsSetResourceLength (AmlLength, Aml);
+ break;
+
+
+ case ACPI_RSC_COUNT_SERIAL_VEN:
+
+ ItemCount = ACPI_GET16 (Source);
+ ACPI_SET16 (Destination) = ItemCount + Info->Value;
+ AmlLength = (UINT16) (AmlLength + ItemCount);
+ AcpiRsSetResourceLength (AmlLength, Aml);
+ break;
+
+
+ case ACPI_RSC_COUNT_SERIAL_RES:
+
+ ItemCount = ACPI_GET16 (Source);
+ AmlLength = (UINT16) (AmlLength + ItemCount);
+ AcpiRsSetResourceLength (AmlLength, Aml);
+ break;
+
+
case ACPI_RSC_LENGTH:
AcpiRsSetResourceLength (Info->Value, Aml);
@@ -456,6 +676,44 @@ AcpiRsConvertResourceToAml (
break;
+ case ACPI_RSC_MOVE_GPIO_PIN:
+
+ Destination = (char *) ACPI_ADD_PTR (void, Aml,
+ ACPI_GET16 (Destination));
+ Source = * (UINT16 **) Source;
+ AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
+ break;
+
+
+ case ACPI_RSC_MOVE_GPIO_RES:
+
+ /* Used for both ResourceSource string and VendorData */
+
+ Destination = (char *) ACPI_ADD_PTR (void, Aml,
+ ACPI_GET16 (Destination));
+ Source = * (UINT8 **) Source;
+ AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
+ break;
+
+
+ case ACPI_RSC_MOVE_SERIAL_VEN:
+
+ Destination = (char *) ACPI_ADD_PTR (void, Aml,
+ (AmlLength - ItemCount));
+ Source = * (UINT8 **) Source;
+ AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
+ break;
+
+
+ case ACPI_RSC_MOVE_SERIAL_RES:
+
+ Destination = (char *) ACPI_ADD_PTR (void, Aml,
+ (AmlLength - ItemCount));
+ Source = * (UINT8 **) Source;
+ AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
+ break;
+
+
case ACPI_RSC_ADDRESS:
/* Set the Resource Type, General Flags, and Type-Specific Flags */
diff --git a/usr/src/uts/intel/io/acpica/resources/rsserial.c b/usr/src/uts/intel/io/acpica/resources/rsserial.c
new file mode 100644
index 0000000000..3a7784e96c
--- /dev/null
+++ b/usr/src/uts/intel/io/acpica/resources/rsserial.c
@@ -0,0 +1,425 @@
+/*******************************************************************************
+ *
+ * Module Name: rsserial - GPIO/SerialBus resource descriptors
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#define __RSIRQ_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acresrc.h"
+
+#define _COMPONENT ACPI_RESOURCES
+ ACPI_MODULE_NAME ("rsserial")
+
+
+/*******************************************************************************
+ *
+ * AcpiRsConvertGpio
+ *
+ ******************************************************************************/
+
+ACPI_RSCONVERT_INFO AcpiRsConvertGpio[17] =
+{
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO,
+ ACPI_RS_SIZE (ACPI_RESOURCE_GPIO),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertGpio)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GPIO,
+ sizeof (AML_RESOURCE_GPIO),
+ 0},
+
+ /*
+ * These fields are contiguous in both the source and destination:
+ * RevisionId
+ * ConnectionType
+ */
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.RevisionId),
+ AML_OFFSET (Gpio.RevisionId),
+ 2},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Gpio.ProducerConsumer),
+ AML_OFFSET (Gpio.Flags),
+ 0},
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Sharable),
+ AML_OFFSET (Gpio.IntFlags),
+ 3},
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Gpio.IoRestriction),
+ AML_OFFSET (Gpio.IntFlags),
+ 0},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Triggering),
+ AML_OFFSET (Gpio.IntFlags),
+ 0},
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Gpio.Polarity),
+ AML_OFFSET (Gpio.IntFlags),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.PinConfig),
+ AML_OFFSET (Gpio.PinConfig),
+ 1},
+
+ /*
+ * These fields are contiguous in both the source and destination:
+ * DriveStrength
+ * DebounceTimeout
+ */
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Gpio.DriveStrength),
+ AML_OFFSET (Gpio.DriveStrength),
+ 2},
+
+ /* Pin Table */
+
+ {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.Gpio.PinTableLength),
+ AML_OFFSET (Gpio.PinTableOffset),
+ AML_OFFSET (Gpio.ResSourceOffset)},
+
+ {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.Gpio.PinTable),
+ AML_OFFSET (Gpio.PinTableOffset),
+ 0},
+
+ /* Resource Source */
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.Index),
+ AML_OFFSET (Gpio.ResSourceIndex),
+ 1},
+
+ {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.StringLength),
+ AML_OFFSET (Gpio.ResSourceOffset),
+ AML_OFFSET (Gpio.VendorOffset)},
+
+ {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.ResourceSource.StringPtr),
+ AML_OFFSET (Gpio.ResSourceOffset),
+ 0},
+
+ /* Vendor Data */
+
+ {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.Gpio.VendorLength),
+ AML_OFFSET (Gpio.VendorLength),
+ 1},
+
+ {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.Gpio.VendorData),
+ AML_OFFSET (Gpio.VendorOffset),
+ 0},
+};
+
+
+/*******************************************************************************
+ *
+ * AcpiRsConvertI2cSerialBus
+ *
+ ******************************************************************************/
+
+ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[16] =
+{
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
+ ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertI2cSerialBus)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
+ sizeof (AML_RESOURCE_I2C_SERIALBUS),
+ 0},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId),
+ AML_OFFSET (CommonSerialBus.RevisionId),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type),
+ AML_OFFSET (CommonSerialBus.Type),
+ 1},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode),
+ AML_OFFSET (CommonSerialBus.Flags),
+ 0},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer),
+ AML_OFFSET (CommonSerialBus.Flags),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId),
+ AML_OFFSET (CommonSerialBus.TypeRevisionId),
+ 1},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ 1},
+
+ /* Vendor data */
+
+ {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ AML_RESOURCE_I2C_MIN_DATA_LEN},
+
+ {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData),
+ 0,
+ sizeof (AML_RESOURCE_I2C_SERIALBUS)},
+
+ /* Resource Source */
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index),
+ AML_OFFSET (CommonSerialBus.ResSourceIndex),
+ 1},
+
+ {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ sizeof (AML_RESOURCE_COMMON_SERIALBUS)},
+
+ {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ sizeof (AML_RESOURCE_COMMON_SERIALBUS)},
+
+ /* I2C bus type specific */
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.I2cSerialBus.AccessMode),
+ AML_OFFSET (I2cSerialBus.TypeSpecificFlags),
+ 0},
+
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.I2cSerialBus.ConnectionSpeed),
+ AML_OFFSET (I2cSerialBus.ConnectionSpeed),
+ 1},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.I2cSerialBus.SlaveAddress),
+ AML_OFFSET (I2cSerialBus.SlaveAddress),
+ 1},
+};
+
+
+/*******************************************************************************
+ *
+ * AcpiRsConvertSpiSerialBus
+ *
+ ******************************************************************************/
+
+ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[20] =
+{
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
+ ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertSpiSerialBus)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
+ sizeof (AML_RESOURCE_SPI_SERIALBUS),
+ 0},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId),
+ AML_OFFSET (CommonSerialBus.RevisionId),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type),
+ AML_OFFSET (CommonSerialBus.Type),
+ 1},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode),
+ AML_OFFSET (CommonSerialBus.Flags),
+ 0},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer),
+ AML_OFFSET (CommonSerialBus.Flags),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId),
+ AML_OFFSET (CommonSerialBus.TypeRevisionId),
+ 1},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ 1},
+
+ /* Vendor data */
+
+ {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ AML_RESOURCE_SPI_MIN_DATA_LEN},
+
+ {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData),
+ 0,
+ sizeof (AML_RESOURCE_SPI_SERIALBUS)},
+
+ /* Resource Source */
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index),
+ AML_OFFSET (CommonSerialBus.ResSourceIndex),
+ 1},
+
+ {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ sizeof (AML_RESOURCE_COMMON_SERIALBUS)},
+
+ {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ sizeof (AML_RESOURCE_COMMON_SERIALBUS)},
+
+ /* Spi bus type specific */
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.SpiSerialBus.WireMode),
+ AML_OFFSET (SpiSerialBus.TypeSpecificFlags),
+ 0},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.SpiSerialBus.DevicePolarity),
+ AML_OFFSET (SpiSerialBus.TypeSpecificFlags),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.DataBitLength),
+ AML_OFFSET (SpiSerialBus.DataBitLength),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.ClockPhase),
+ AML_OFFSET (SpiSerialBus.ClockPhase),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.SpiSerialBus.ClockPolarity),
+ AML_OFFSET (SpiSerialBus.ClockPolarity),
+ 1},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.SpiSerialBus.DeviceSelection),
+ AML_OFFSET (SpiSerialBus.DeviceSelection),
+ 1},
+
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.SpiSerialBus.ConnectionSpeed),
+ AML_OFFSET (SpiSerialBus.ConnectionSpeed),
+ 1},
+};
+
+
+/*******************************************************************************
+ *
+ * AcpiRsConvertUartSerialBus
+ *
+ ******************************************************************************/
+
+ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[22] =
+{
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
+ ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertUartSerialBus)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS,
+ sizeof (AML_RESOURCE_UART_SERIALBUS),
+ 0},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.RevisionId),
+ AML_OFFSET (CommonSerialBus.RevisionId),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.Type),
+ AML_OFFSET (CommonSerialBus.Type),
+ 1},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.SlaveMode),
+ AML_OFFSET (CommonSerialBus.Flags),
+ 0},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.CommonSerialBus.ProducerConsumer),
+ AML_OFFSET (CommonSerialBus.Flags),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeRevisionId),
+ AML_OFFSET (CommonSerialBus.TypeRevisionId),
+ 1},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.CommonSerialBus.TypeDataLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ 1},
+
+ /* Vendor data */
+
+ {ACPI_RSC_COUNT_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ AML_RESOURCE_UART_MIN_DATA_LEN},
+
+ {ACPI_RSC_MOVE_SERIAL_VEN, ACPI_RS_OFFSET (Data.CommonSerialBus.VendorData),
+ 0,
+ sizeof (AML_RESOURCE_UART_SERIALBUS)},
+
+ /* Resource Source */
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.Index),
+ AML_OFFSET (CommonSerialBus.ResSourceIndex),
+ 1},
+
+ {ACPI_RSC_COUNT_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringLength),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ sizeof (AML_RESOURCE_COMMON_SERIALBUS)},
+
+ {ACPI_RSC_MOVE_SERIAL_RES, ACPI_RS_OFFSET (Data.CommonSerialBus.ResourceSource.StringPtr),
+ AML_OFFSET (CommonSerialBus.TypeDataLength),
+ sizeof (AML_RESOURCE_COMMON_SERIALBUS)},
+
+ /* Uart bus type specific */
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.FlowControl),
+ AML_OFFSET (UartSerialBus.TypeSpecificFlags),
+ 0},
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.StopBits),
+ AML_OFFSET (UartSerialBus.TypeSpecificFlags),
+ 2},
+
+ {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.DataBits),
+ AML_OFFSET (UartSerialBus.TypeSpecificFlags),
+ 4},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.UartSerialBus.Endian),
+ AML_OFFSET (UartSerialBus.TypeSpecificFlags),
+ 7},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.UartSerialBus.Parity),
+ AML_OFFSET (UartSerialBus.Parity),
+ 1},
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.UartSerialBus.LinesEnabled),
+ AML_OFFSET (UartSerialBus.LinesEnabled),
+ 1},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.UartSerialBus.RxFifoSize),
+ AML_OFFSET (UartSerialBus.RxFifoSize),
+ 1},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.UartSerialBus.TxFifoSize),
+ AML_OFFSET (UartSerialBus.TxFifoSize),
+ 1},
+
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.UartSerialBus.DefaultBaudRate),
+ AML_OFFSET (UartSerialBus.DefaultBaudRate),
+ 1},
+};
diff --git a/usr/src/uts/intel/io/acpica/resources/rsutils.c b/usr/src/uts/intel/io/acpica/resources/rsutils.c
index 400bbcd91f..062678651e 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsutils.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsutils.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -173,6 +173,9 @@ AcpiRsMoveData (
* since there are no alignment or endian issues
*/
case ACPI_RSC_MOVE8:
+ case ACPI_RSC_MOVE_GPIO_RES:
+ case ACPI_RSC_MOVE_SERIAL_VEN:
+ case ACPI_RSC_MOVE_SERIAL_RES:
ACPI_MEMCPY (Destination, Source, ItemCount);
return;
@@ -182,6 +185,7 @@ AcpiRsMoveData (
* misaligned memory transfers
*/
case ACPI_RSC_MOVE16:
+ case ACPI_RSC_MOVE_GPIO_PIN:
ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i],
&ACPI_CAST_PTR (UINT16, Source)[i]);
break;
@@ -653,6 +657,61 @@ AcpiRsGetPrsMethodData (
/*******************************************************************************
*
+ * FUNCTION: AcpiRsGetAeiMethodData
+ *
+ * PARAMETERS: Node - Device node
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the _AEI value of an object
+ * contained in an object specified by the handle passed in
+ *
+ * If the function fails an appropriate status will be returned
+ * and the contents of the callers buffer is undefined.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRsGetAeiMethodData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (RsGetAeiMethodData);
+
+
+ /* Parameters guaranteed valid by caller */
+
+ /* Execute the method, no parameters */
+
+ Status = AcpiUtEvaluateObject (Node, METHOD_NAME__AEI,
+ ACPI_BTYPE_BUFFER, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Make the call to create a resource linked list from the
+ * byte stream buffer that comes back from the _CRS method
+ * execution.
+ */
+ Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
+
+ /* On exit, we must delete the object returned by evaluateObject */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiRsGetMethodData
*
* PARAMETERS: Handle - Handle to the containing object
diff --git a/usr/src/uts/intel/io/acpica/resources/rsxface.c b/usr/src/uts/intel/io/acpica/resources/rsxface.c
index 0aea206b73..d8c3938b31 100644
--- a/usr/src/uts/intel/io/acpica/resources/rsxface.c
+++ b/usr/src/uts/intel/io/acpica/resources/rsxface.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -351,6 +351,52 @@ AcpiSetCurrentResources (
ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources)
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetEventResources
+ *
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
+ * device we are getting resources
+ * InBuffer - Pointer to a buffer containing the
+ * resources to be set for the device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the event resources for a
+ * specific device. The caller must first acquire a handle for
+ * the desired device. The resource data is passed to the routine
+ * the buffer pointed to by the InBuffer variable. Uses the
+ * _AEI method.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetEventResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ACPI_FUNCTION_TRACE (AcpiGetEventResources);
+
+
+ /* Validate parameters then dispatch to internal routine */
+
+ Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiRsGetAeiMethodData (Node, RetBuffer);
+ return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiGetEventResources)
+
+
/******************************************************************************
*
* FUNCTION: AcpiResourceToAddress64
@@ -544,8 +590,9 @@ AcpiRsMatchVendorResource (
*
* PARAMETERS: DeviceHandle - Handle to the device object for the
* device we are querying
- * Name - Method name of the resources we want
- * (METHOD_NAME__CRS or METHOD_NAME__PRS)
+ * Name - Method name of the resources we want.
+ * (METHOD_NAME__CRS, METHOD_NAME__PRS, or
+ * METHOD_NAME__AEI)
* UserFunction - Called for each resource
* Context - Passed to UserFunction
*
@@ -577,12 +624,13 @@ AcpiWalkResources (
if (!DeviceHandle || !UserFunction || !Name ||
(!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) &&
- !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS)))
+ !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS) &&
+ !ACPI_COMPARE_NAME (Name, METHOD_NAME__AEI)))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Get the _CRS or _PRS resource list */
+ /* Get the _CRS/_PRS/_AEI resource list */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer);
diff --git a/usr/src/uts/intel/io/acpica/tables/tbfadt.c b/usr/src/uts/intel/io/acpica/tables/tbfadt.c
index f8c63408b9..e877320447 100644
--- a/usr/src/uts/intel/io/acpica/tables/tbfadt.c
+++ b/usr/src/uts/intel/io/acpica/tables/tbfadt.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -77,14 +77,15 @@ AcpiTbSetupFadtRegisters (
typedef struct acpi_fadt_info
{
char *Name;
- UINT8 Address64;
- UINT8 Address32;
- UINT8 Length;
+ UINT16 Address64;
+ UINT16 Address32;
+ UINT16 Length;
UINT8 DefaultLength;
UINT8 Type;
} ACPI_FADT_INFO;
+#define ACPI_FADT_OPTIONAL 0
#define ACPI_FADT_REQUIRED 1
#define ACPI_FADT_SEPARATE_LENGTH 2
@@ -102,7 +103,7 @@ static ACPI_FADT_INFO FadtInfoTable[] =
ACPI_FADT_OFFSET (Pm1bEventBlock),
ACPI_FADT_OFFSET (Pm1EventLength),
ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */
- 0},
+ ACPI_FADT_OPTIONAL},
{"Pm1aControlBlock",
ACPI_FADT_OFFSET (XPm1aControlBlock),
@@ -116,7 +117,7 @@ static ACPI_FADT_INFO FadtInfoTable[] =
ACPI_FADT_OFFSET (Pm1bControlBlock),
ACPI_FADT_OFFSET (Pm1ControlLength),
ACPI_PM1_REGISTER_WIDTH,
- 0},
+ ACPI_FADT_OPTIONAL},
{"Pm2ControlBlock",
ACPI_FADT_OFFSET (XPm2ControlBlock),
@@ -156,7 +157,7 @@ static ACPI_FADT_INFO FadtInfoTable[] =
typedef struct acpi_fadt_pm_info
{
ACPI_GENERIC_ADDRESS *Target;
- UINT8 Source;
+ UINT16 Source;
UINT8 RegisterNum;
} ACPI_FADT_PM_INFO;
@@ -280,8 +281,13 @@ AcpiTbParseFadt (
AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
- AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
- ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
+ /* If Hardware Reduced flag is set, there is no FACS */
+
+ if (!AcpiGbl_ReducedHardware)
+ {
+ AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
+ ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
+ }
}
@@ -309,13 +315,13 @@ AcpiTbCreateLocalFadt (
/*
* Check if the FADT is larger than the largest table that we expect
- * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue
+ * (the ACPI 5.0 version). If so, truncate the table, and issue
* a warning.
*/
if (Length > sizeof (ACPI_TABLE_FADT))
{
ACPI_WARNING ((AE_INFO,
- "FADT (revision %u) is longer than ACPI 2.0 version, "
+ "FADT (revision %u) is longer than ACPI 5.0 version, "
"truncating length %u to %u",
Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT)));
}
@@ -329,6 +335,14 @@ AcpiTbCreateLocalFadt (
ACPI_MEMCPY (&AcpiGbl_FADT, Table,
ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
+ /* Take a copy of the Hardware Reduced flag */
+
+ AcpiGbl_ReducedHardware = FALSE;
+ if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED)
+ {
+ AcpiGbl_ReducedHardware = TRUE;
+ }
+
/* Convert the local copy of the FADT to the common internal format */
AcpiTbConvertFadt ();
@@ -386,10 +400,6 @@ AcpiTbConvertFadt (
UINT32 i;
- /* Update the local FADT table header length */
-
- AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
-
/*
* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
* Later code will always use the X 64-bit field.
@@ -423,6 +433,13 @@ AcpiTbConvertFadt (
}
/*
+ * Now we can update the local FADT length to the length of the
+ * current FADT version as defined by the ACPI specification.
+ * Thus, we will have a common FADT internally.
+ */
+ AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
+
+ /*
* Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"
* generic address structures as necessary. Later code will always use
* the 64-bit address structures.
@@ -530,6 +547,13 @@ AcpiTbValidateFadt (
AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;
}
+ /* If Hardware Reduced flag is set, we are all done */
+
+ if (AcpiGbl_ReducedHardware)
+ {
+ return;
+ }
+
/* Examine all of the 64-bit extended address fields (X fields) */
for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
diff --git a/usr/src/uts/intel/io/acpica/tables/tbfind.c b/usr/src/uts/intel/io/acpica/tables/tbfind.c
index 3b7c420f01..d7e2440b32 100644
--- a/usr/src/uts/intel/io/acpica/tables/tbfind.c
+++ b/usr/src/uts/intel/io/acpica/tables/tbfind.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/tables/tbinstal.c b/usr/src/uts/intel/io/acpica/tables/tbinstal.c
index ab69691a1e..f100ab43f7 100644
--- a/usr/src/uts/intel/io/acpica/tables/tbinstal.c
+++ b/usr/src/uts/intel/io/acpica/tables/tbinstal.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -128,7 +128,6 @@ AcpiTbAddTable (
{
UINT32 i;
ACPI_STATUS Status = AE_OK;
- ACPI_TABLE_HEADER *OverrideTable = NULL;
ACPI_FUNCTION_TRACE (TbAddTable);
@@ -242,26 +241,10 @@ AcpiTbAddTable (
/*
* ACPI Table Override:
* Allow the host to override dynamically loaded tables.
+ * NOTE: the table is fully mapped at this point, and the mapping will
+ * be deleted by TbTableOverride if the table is actually overridden.
*/
- Status = AcpiOsTableOverride (TableDesc->Pointer, &OverrideTable);
- if (ACPI_SUCCESS (Status) && OverrideTable)
- {
- ACPI_INFO ((AE_INFO,
- "%4.4s @ 0x%p Table override, replaced with:",
- TableDesc->Pointer->Signature,
- ACPI_CAST_PTR (void, TableDesc->Address)));
-
- /* We can delete the table that was passed as a parameter */
-
- AcpiTbDeleteTable (TableDesc);
-
- /* Setup descriptor for the new table */
-
- TableDesc->Address = ACPI_PTR_TO_PHYSADDR (OverrideTable);
- TableDesc->Pointer = OverrideTable;
- TableDesc->Length = OverrideTable->Length;
- TableDesc->Flags = ACPI_TABLE_ORIGIN_OVERRIDE;
- }
+ (void) AcpiTbTableOverride (TableDesc->Pointer, TableDesc);
/* Add the table to the global root table list */
@@ -283,6 +266,98 @@ Release:
/*******************************************************************************
*
+ * FUNCTION: AcpiTbTableOverride
+ *
+ * PARAMETERS: TableHeader - Header for the original table
+ * TableDesc - Table descriptor initialized for the
+ * original table. May or may not be mapped.
+ *
+ * RETURN: Pointer to the entire new table. NULL if table not overridden.
+ * If overridden, installs the new table within the input table
+ * descriptor.
+ *
+ * DESCRIPTION: Attempt table override by calling the OSL override functions.
+ * Note: If the table is overridden, then the entire new table
+ * is mapped and returned by this function.
+ *
+ ******************************************************************************/
+
+ACPI_TABLE_HEADER *
+AcpiTbTableOverride (
+ ACPI_TABLE_HEADER *TableHeader,
+ ACPI_TABLE_DESC *TableDesc)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER *NewTable = NULL;
+ ACPI_PHYSICAL_ADDRESS NewAddress = 0;
+ UINT32 NewTableLength = 0;
+ UINT8 NewFlags;
+ char *OverrideType;
+
+
+ /* (1) Attempt logical override (returns a logical address) */
+
+ Status = AcpiOsTableOverride (TableHeader, &NewTable);
+ if (ACPI_SUCCESS (Status) && NewTable)
+ {
+ NewAddress = ACPI_PTR_TO_PHYSADDR (NewTable);
+ NewTableLength = NewTable->Length;
+ NewFlags = ACPI_TABLE_ORIGIN_OVERRIDE;
+ OverrideType = "Logical";
+ goto FinishOverride;
+ }
+
+ /* (2) Attempt physical override (returns a physical address) */
+
+ Status = AcpiOsPhysicalTableOverride (TableHeader,
+ &NewAddress, &NewTableLength);
+ if (ACPI_SUCCESS (Status) && NewAddress && NewTableLength)
+ {
+ /* Map the entire new table */
+
+ NewTable = AcpiOsMapMemory (NewAddress, NewTableLength);
+ if (!NewTable)
+ {
+ ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
+ "%4.4s %p Attempted physical table override failed",
+ TableHeader->Signature,
+ ACPI_CAST_PTR (void, TableDesc->Address)));
+ return (NULL);
+ }
+
+ OverrideType = "Physical";
+ NewFlags = ACPI_TABLE_ORIGIN_MAPPED;
+ goto FinishOverride;
+ }
+
+ return (NULL); /* There was no override */
+
+
+FinishOverride:
+
+ ACPI_INFO ((AE_INFO,
+ "%4.4s %p %s table override, new table: %p",
+ TableHeader->Signature,
+ ACPI_CAST_PTR (void, TableDesc->Address),
+ OverrideType, NewTable));
+
+ /* We can now unmap/delete the original table (if fully mapped) */
+
+ AcpiTbDeleteTable (TableDesc);
+
+ /* Setup descriptor for the new table */
+
+ TableDesc->Address = NewAddress;
+ TableDesc->Pointer = NewTable;
+ TableDesc->Length = NewTableLength;
+ TableDesc->Flags = NewFlags;
+
+ return (NewTable);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiTbResizeRootTableList
*
* PARAMETERS: None
@@ -435,8 +510,10 @@ AcpiTbDeleteTable (
ACPI_FREE (TableDesc->Pointer);
break;
+ /* Not mapped or allocated, there is nothing we can do */
+
default:
- break;
+ return;
}
TableDesc->Pointer = NULL;
diff --git a/usr/src/uts/intel/io/acpica/tables/tbutils.c b/usr/src/uts/intel/io/acpica/tables/tbutils.c
index bff6540e07..e8b5705e96 100644
--- a/usr/src/uts/intel/io/acpica/tables/tbutils.c
+++ b/usr/src/uts/intel/io/acpica/tables/tbutils.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,7 @@
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbutils")
+
/* Local prototypes */
static void
@@ -68,6 +69,7 @@ AcpiTbGetRootTableEntry (
UINT32 TableEntrySize);
+#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: AcpiTbInitializeFacs
@@ -88,10 +90,19 @@ AcpiTbInitializeFacs (
ACPI_STATUS Status;
+ /* If Hardware Reduced flag is set, there is no FACS */
+
+ if (AcpiGbl_ReducedHardware)
+ {
+ AcpiGbl_FACS = NULL;
+ return (AE_OK);
+ }
+
Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS));
return (Status);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
/*******************************************************************************
@@ -415,7 +426,7 @@ AcpiTbCopyDsdt (
* RETURN: None
*
* DESCRIPTION: Install an ACPI table into the global data structure. The
- * table override mechanism is implemented here to allow the host
+ * table override mechanism is called to allow the host
* OS to replace any table before it is installed in the root
* table array.
*
@@ -427,11 +438,9 @@ AcpiTbInstallTable (
char *Signature,
UINT32 TableIndex)
{
- UINT8 Flags;
- ACPI_STATUS Status;
- ACPI_TABLE_HEADER *TableToInstall;
- ACPI_TABLE_HEADER *MappedTable;
- ACPI_TABLE_HEADER *OverrideTable = NULL;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_TABLE_HEADER *FinalTable;
+ ACPI_TABLE_DESC *TableDesc;
if (!Address)
@@ -443,70 +452,84 @@ AcpiTbInstallTable (
/* Map just the table header */
- MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
- if (!MappedTable)
+ Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
+ if (!Table)
{
+ ACPI_ERROR ((AE_INFO, "Could not map memory for table [%s] at %p",
+ Signature, ACPI_CAST_PTR (void, Address)));
return;
}
/* If a particular signature is expected (DSDT/FACS), it must match */
if (Signature &&
- !ACPI_COMPARE_NAME (MappedTable->Signature, Signature))
+ !ACPI_COMPARE_NAME (Table->Signature, Signature))
{
ACPI_ERROR ((AE_INFO,
"Invalid signature 0x%X for ACPI table, expected [%s]",
- *ACPI_CAST_PTR (UINT32, MappedTable->Signature), Signature));
+ *ACPI_CAST_PTR (UINT32, Table->Signature), Signature));
goto UnmapAndExit;
}
/*
+ * Initialize the table entry. Set the pointer to NULL, since the
+ * table is not fully mapped at this time.
+ */
+ TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex];
+
+ TableDesc->Address = Address;
+ TableDesc->Pointer = NULL;
+ TableDesc->Length = Table->Length;
+ TableDesc->Flags = ACPI_TABLE_ORIGIN_MAPPED;
+ ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature);
+
+ /*
* ACPI Table Override:
*
* Before we install the table, let the host OS override it with a new
* one if desired. Any table within the RSDT/XSDT can be replaced,
* including the DSDT which is pointed to by the FADT.
+ *
+ * NOTE: If the table is overridden, then FinalTable will contain a
+ * mapped pointer to the full new table. If the table is not overridden,
+ * or if there has been a physical override, then the table will be
+ * fully mapped later (in verify table). In any case, we must
+ * unmap the header that was mapped above.
*/
- Status = AcpiOsTableOverride (MappedTable, &OverrideTable);
- if (ACPI_SUCCESS (Status) && OverrideTable)
+ FinalTable = AcpiTbTableOverride (Table, TableDesc);
+ if (!FinalTable)
{
- ACPI_INFO ((AE_INFO,
- "%4.4s @ 0x%p Table override, replaced with:",
- MappedTable->Signature, ACPI_CAST_PTR (void, Address)));
-
- AcpiGbl_RootTableList.Tables[TableIndex].Pointer = OverrideTable;
- Address = ACPI_PTR_TO_PHYSADDR (OverrideTable);
-
- TableToInstall = OverrideTable;
- Flags = ACPI_TABLE_ORIGIN_OVERRIDE;
- }
- else
- {
- TableToInstall = MappedTable;
- Flags = ACPI_TABLE_ORIGIN_MAPPED;
+ FinalTable = Table; /* There was no override */
}
- /* Initialize the table entry */
-
- AcpiGbl_RootTableList.Tables[TableIndex].Address = Address;
- AcpiGbl_RootTableList.Tables[TableIndex].Length = TableToInstall->Length;
- AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags;
-
- ACPI_MOVE_32_TO_32 (
- &(AcpiGbl_RootTableList.Tables[TableIndex].Signature),
- TableToInstall->Signature);
+ AcpiTbPrintTableHeader (TableDesc->Address, FinalTable);
- AcpiTbPrintTableHeader (Address, TableToInstall);
+ /* Set the global integer width (based upon revision of the DSDT) */
if (TableIndex == ACPI_TABLE_INDEX_DSDT)
{
- /* Global integer width is based upon revision of the DSDT */
+ AcpiUtSetIntegerWidth (FinalTable->Revision);
+ }
- AcpiUtSetIntegerWidth (TableToInstall->Revision);
+ /*
+ * If we have a physical override during this early loading of the ACPI
+ * tables, unmap the table for now. It will be mapped again later when
+ * it is actually used. This supports very early loading of ACPI tables,
+ * before virtual memory is fully initialized and running within the
+ * host OS. Note: A logical override has the ACPI_TABLE_ORIGIN_OVERRIDE
+ * flag set and will not be deleted below.
+ */
+ if (FinalTable != Table)
+ {
+ AcpiTbDeleteTable (TableDesc);
}
+
UnmapAndExit:
- AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER));
+
+ /* Always unmap the table header that we mapped above */
+
+ AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
}
diff --git a/usr/src/uts/intel/io/acpica/tables/tbxface.c b/usr/src/uts/intel/io/acpica/tables/tbxface.c
index 465bf95c64..58dae6935d 100644
--- a/usr/src/uts/intel/io/acpica/tables/tbxface.c
+++ b/usr/src/uts/intel/io/acpica/tables/tbxface.c
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/tables/tbxfroot.c b/usr/src/uts/intel/io/acpica/tables/tbxfroot.c
index e447108ebe..17e52ef7f4 100644
--- a/usr/src/uts/intel/io/acpica/tables/tbxfroot.c
+++ b/usr/src/uts/intel/io/acpica/tables/tbxfroot.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utaddress.c b/usr/src/uts/intel/io/acpica/utilities/utaddress.c
new file mode 100644
index 0000000000..0b357b681b
--- /dev/null
+++ b/usr/src/uts/intel/io/acpica/utilities/utaddress.c
@@ -0,0 +1,322 @@
+/******************************************************************************
+ *
+ * Module Name: utaddress - OpRegion address range check
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#define __UTADDRESS_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utaddress")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAddAddressRange
+ *
+ * PARAMETERS: SpaceId - Address space ID
+ * Address - OpRegion start address
+ * Length - OpRegion length
+ * RegionNode - OpRegion namespace node
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Add the Operation Region address range to the global list.
+ * The only supported Space IDs are Memory and I/O. Called when
+ * the OpRegion address/length operands are fully evaluated.
+ *
+ * MUTEX: Locks the namespace
+ *
+ * NOTE: Because this interface is only called when an OpRegion argument
+ * list is evaluated, there cannot be any duplicate RegionNodes.
+ * Duplicate Address/Length values are allowed, however, so that multiple
+ * address conflicts can be detected.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtAddAddressRange (
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 Length,
+ ACPI_NAMESPACE_NODE *RegionNode)
+{
+ ACPI_ADDRESS_RANGE *RangeInfo;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (UtAddAddressRange);
+
+
+ if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
+ (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Allocate/init a new info block, add it to the appropriate list */
+
+ RangeInfo = ACPI_ALLOCATE (sizeof (ACPI_ADDRESS_RANGE));
+ if (!RangeInfo)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ RangeInfo->StartAddress = Address;
+ RangeInfo->EndAddress = (Address + Length - 1);
+ RangeInfo->RegionNode = RegionNode;
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_FREE (RangeInfo);
+ return_ACPI_STATUS (Status);
+ }
+
+ RangeInfo->Next = AcpiGbl_AddressRangeList[SpaceId];
+ AcpiGbl_AddressRangeList[SpaceId] = RangeInfo;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "\nAdded [%4.4s] address range: 0x%p-0x%p\n",
+ AcpiUtGetNodeName (RangeInfo->RegionNode),
+ ACPI_CAST_PTR (void, Address),
+ ACPI_CAST_PTR (void, RangeInfo->EndAddress)));
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtRemoveAddressRange
+ *
+ * PARAMETERS: SpaceId - Address space ID
+ * RegionNode - OpRegion namespace node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Remove the Operation Region from the global list. The only
+ * supported Space IDs are Memory and I/O. Called when an
+ * OpRegion is deleted.
+ *
+ * MUTEX: Assumes the namespace is locked
+ *
+ ******************************************************************************/
+
+void
+AcpiUtRemoveAddressRange (
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_NAMESPACE_NODE *RegionNode)
+{
+ ACPI_ADDRESS_RANGE *RangeInfo;
+ ACPI_ADDRESS_RANGE *Prev;
+
+
+ ACPI_FUNCTION_TRACE (UtRemoveAddressRange);
+
+
+ if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
+ (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO))
+ {
+ return_VOID;
+ }
+
+ /* Get the appropriate list head and check the list */
+
+ RangeInfo = Prev = AcpiGbl_AddressRangeList[SpaceId];
+ while (RangeInfo)
+ {
+ if (RangeInfo->RegionNode == RegionNode)
+ {
+ if (RangeInfo == Prev) /* Found at list head */
+ {
+ AcpiGbl_AddressRangeList[SpaceId] = RangeInfo->Next;
+ }
+ else
+ {
+ Prev->Next = RangeInfo->Next;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "\nRemoved [%4.4s] address range: 0x%p-0x%p\n",
+ AcpiUtGetNodeName (RangeInfo->RegionNode),
+ ACPI_CAST_PTR (void, RangeInfo->StartAddress),
+ ACPI_CAST_PTR (void, RangeInfo->EndAddress)));
+
+ ACPI_FREE (RangeInfo);
+ return_VOID;
+ }
+
+ Prev = RangeInfo;
+ RangeInfo = RangeInfo->Next;
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCheckAddressRange
+ *
+ * PARAMETERS: SpaceId - Address space ID
+ * Address - Start address
+ * Length - Length of address range
+ * Warn - TRUE if warning on overlap desired
+ *
+ * RETURN: Count of the number of conflicts detected. Zero is always
+ * returned for Space IDs other than Memory or I/O.
+ *
+ * DESCRIPTION: Check if the input address range overlaps any of the
+ * ASL operation region address ranges. The only supported
+ * Space IDs are Memory and I/O.
+ *
+ * MUTEX: Assumes the namespace is locked.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiUtCheckAddressRange (
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 Length,
+ BOOLEAN Warn)
+{
+ ACPI_ADDRESS_RANGE *RangeInfo;
+ ACPI_PHYSICAL_ADDRESS EndAddress;
+ char *Pathname;
+ UINT32 OverlapCount = 0;
+
+
+ ACPI_FUNCTION_TRACE (UtCheckAddressRange);
+
+
+ if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
+ (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO))
+ {
+ return_UINT32 (0);
+ }
+
+ RangeInfo = AcpiGbl_AddressRangeList[SpaceId];
+ EndAddress = Address + Length - 1;
+
+ /* Check entire list for all possible conflicts */
+
+ while (RangeInfo)
+ {
+ /*
+ * Check if the requested Address/Length overlaps this AddressRange.
+ * Four cases to consider:
+ *
+ * 1) Input address/length is contained completely in the address range
+ * 2) Input address/length overlaps range at the range start
+ * 3) Input address/length overlaps range at the range end
+ * 4) Input address/length completely encompasses the range
+ */
+ if ((Address <= RangeInfo->EndAddress) &&
+ (EndAddress >= RangeInfo->StartAddress))
+ {
+ /* Found an address range overlap */
+
+ OverlapCount++;
+ if (Warn) /* Optional warning message */
+ {
+ Pathname = AcpiNsGetExternalPathname (RangeInfo->RegionNode);
+
+ ACPI_WARNING ((AE_INFO,
+ "0x%p-0x%p %s conflicts with Region %s %d",
+ ACPI_CAST_PTR (void, Address),
+ ACPI_CAST_PTR (void, EndAddress),
+ AcpiUtGetRegionName (SpaceId), Pathname, OverlapCount));
+ ACPI_FREE (Pathname);
+ }
+ }
+
+ RangeInfo = RangeInfo->Next;
+ }
+
+ return_UINT32 (OverlapCount);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteAddressLists
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Delete all global address range lists (called during
+ * subsystem shutdown).
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteAddressLists (
+ void)
+{
+ ACPI_ADDRESS_RANGE *Next;
+ ACPI_ADDRESS_RANGE *RangeInfo;
+ int i;
+
+
+ /* Delete all elements in all address range lists */
+
+ for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
+ {
+ Next = AcpiGbl_AddressRangeList[i];
+
+ while (Next)
+ {
+ RangeInfo = Next;
+ Next = RangeInfo->Next;
+ ACPI_FREE (RangeInfo);
+ }
+
+ AcpiGbl_AddressRangeList[i] = NULL;
+ }
+}
diff --git a/usr/src/uts/intel/io/acpica/utilities/utalloc.c b/usr/src/uts/intel/io/acpica/utilities/utalloc.c
index 4c024f1a30..d2eb11edcb 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utalloc.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utalloc.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utcache.c b/usr/src/uts/intel/io/acpica/utilities/utcache.c
index 96d64b05a5..7b3abe2894 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utcache.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utcache.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utclib.c b/usr/src/uts/intel/io/acpica/utilities/utclib.c
index 70d17bb1be..d0153ec5d2 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utclib.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utclib.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utcopy.c b/usr/src/uts/intel/io/acpica/utilities/utcopy.c
index 907f272f7e..ab04a7a7aa 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utcopy.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utcopy.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utdebug.c b/usr/src/uts/intel/io/acpica/utilities/utdebug.c
index 24d2eb5cfa..051d47b443 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utdebug.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utdebug.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utdecode.c b/usr/src/uts/intel/io/acpica/utilities/utdecode.c
index feca6c725c..718d73db4e 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utdecode.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utdecode.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -187,7 +187,9 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
"SMBus",
"SystemCMOS",
"PCIBARTarget",
- "IPMI"
+ "IPMI",
+ "GeneralPurposeIo",
+ "GenericSerialBus"
};
@@ -565,20 +567,21 @@ AcpiUtGetMutexName (
/* Names for Notify() values, used for debug output */
-static const char *AcpiGbl_NotifyValueNames[] =
+static const char *AcpiGbl_NotifyValueNames[ACPI_NOTIFY_MAX + 1] =
{
- "Bus Check",
- "Device Check",
- "Device Wake",
- "Eject Request",
- "Device Check Light",
- "Frequency Mismatch",
- "Bus Mode Mismatch",
- "Power Fault",
- "Capabilities Check",
- "Device PLD Check",
- "Reserved",
- "System Locality Update"
+ /* 00 */ "Bus Check",
+ /* 01 */ "Device Check",
+ /* 02 */ "Device Wake",
+ /* 03 */ "Eject Request",
+ /* 04 */ "Device Check Light",
+ /* 05 */ "Frequency Mismatch",
+ /* 06 */ "Bus Mode Mismatch",
+ /* 07 */ "Power Fault",
+ /* 08 */ "Capabilities Check",
+ /* 09 */ "Device PLD Check",
+ /* 10 */ "Reserved",
+ /* 11 */ "System Locality Update",
+ /* 12 */ "Shutdown Request"
};
const char *
@@ -594,9 +597,13 @@ AcpiUtGetNotifyName (
{
return ("Reserved");
}
- else /* Greater or equal to 0x80 */
+ else if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY)
{
- return ("**Device Specific**");
+ return ("Device Specific");
+ }
+ else
+ {
+ return ("Hardware Specific");
}
}
#endif
diff --git a/usr/src/uts/intel/io/acpica/utilities/utdelete.c b/usr/src/uts/intel/io/acpica/utilities/utdelete.c
index b87d2f0d59..fb32611121 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utdelete.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utdelete.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -167,7 +167,7 @@ AcpiUtDeleteInternalObj (
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL:
- /* Walk the notify handler list for this object */
+ /* Walk the address handler list for this object */
HandlerDesc = Object->CommonNotify.Handler;
while (HandlerDesc)
@@ -235,6 +235,16 @@ AcpiUtDeleteInternalObj (
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
"***** Region %p\n", Object));
+ /*
+ * Update AddressRange list. However, only permanent regions
+ * are installed in this list. (Not created within a method)
+ */
+ if (!(Object->Region.Node->Flags & ANOBJ_TEMPORARY))
+ {
+ AcpiUtRemoveAddressRange (Object->Region.SpaceId,
+ Object->Region.Node);
+ }
+
SecondDesc = AcpiNsGetSecondaryObject (Object);
if (SecondDesc)
{
@@ -513,6 +523,7 @@ AcpiUtUpdateObjectReference (
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *StateList = NULL;
ACPI_OPERAND_OBJECT *NextObject = NULL;
+ ACPI_OPERAND_OBJECT *PrevObject;
ACPI_GENERIC_STATE *State;
UINT32 i;
@@ -542,10 +553,20 @@ AcpiUtUpdateObjectReference (
case ACPI_TYPE_POWER:
case ACPI_TYPE_THERMAL:
- /* Update the notify objects for these types (if present) */
-
- AcpiUtUpdateRefCount (Object->CommonNotify.SystemNotify, Action);
- AcpiUtUpdateRefCount (Object->CommonNotify.DeviceNotify, Action);
+ /*
+ * Update the notify objects for these types (if present)
+ * Two lists, system and device notify handlers.
+ */
+ for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
+ {
+ PrevObject = Object->CommonNotify.NotifyList[i];
+ while (PrevObject)
+ {
+ NextObject = PrevObject->Notify.Next[i];
+ AcpiUtUpdateRefCount (PrevObject, Action);
+ PrevObject = NextObject;
+ }
+ }
break;
case ACPI_TYPE_PACKAGE:
diff --git a/usr/src/uts/intel/io/acpica/utilities/uteval.c b/usr/src/uts/intel/io/acpica/utilities/uteval.c
index 0042f411ff..0bcb894b58 100644
--- a/usr/src/uts/intel/io/acpica/utilities/uteval.c
+++ b/usr/src/uts/intel/io/acpica/utilities/uteval.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utglobal.c b/usr/src/uts/intel/io/acpica/utilities/utglobal.c
index 336f6706c1..f913e32228 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utglobal.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utglobal.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -155,6 +155,7 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
};
+#if (!ACPI_REDUCED_HARDWARE)
/******************************************************************************
*
* Event and Hardware globals
@@ -199,6 +200,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
/* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
/* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE},
};
+#endif /* !ACPI_REDUCED_HARDWARE */
/*******************************************************************************
@@ -233,6 +235,13 @@ AcpiUtInitGlobals (
return_ACPI_STATUS (Status);
}
+ /* Address Range lists */
+
+ for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
+ {
+ AcpiGbl_AddressRangeList[i] = NULL;
+ }
+
/* Mutex locked flags */
for (i = 0; i < ACPI_NUM_MUTEX; i++)
@@ -262,6 +271,8 @@ AcpiUtInitGlobals (
AcpiFixedEventCount[i] = 0;
}
+#if (!ACPI_REDUCED_HARDWARE)
+
/* GPE support */
AcpiGbl_AllGpesInitialized = FALSE;
@@ -270,15 +281,18 @@ AcpiUtInitGlobals (
AcpiGbl_GpeFadtBlocks[1] = NULL;
AcpiCurrentGpeCount = 0;
+ AcpiGbl_GlobalEventHandler = NULL;
+
+#endif /* !ACPI_REDUCED_HARDWARE */
+
/* Global handlers */
- AcpiGbl_SystemNotify.Handler = NULL;
- AcpiGbl_DeviceNotify.Handler = NULL;
+ AcpiGbl_GlobalNotify[0].Handler = NULL;
+ AcpiGbl_GlobalNotify[1].Handler = NULL;
AcpiGbl_ExceptionHandler = NULL;
AcpiGbl_InitHandler = NULL;
AcpiGbl_TableHandler = NULL;
AcpiGbl_InterfaceHandler = NULL;
- AcpiGbl_GlobalEventHandler = NULL;
/* Global Lock support */
diff --git a/usr/src/uts/intel/io/acpica/utilities/utids.c b/usr/src/uts/intel/io/acpica/utilities/utids.c
index 36dc3afce6..226d8c1631 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utids.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utids.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utinit.c b/usr/src/uts/intel/io/acpica/utilities/utinit.c
index 9e253f01d3..6831595e68 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utinit.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utinit.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -58,21 +58,33 @@
static void AcpiUtTerminate (
void);
+#if (!ACPI_REDUCED_HARDWARE)
+static void
+AcpiUtFreeGpeLists (
+ void);
+
+#else
+
+#define AcpiUtFreeGpeLists()
+#endif /* !ACPI_REDUCED_HARDWARE */
+
+
+#if (!ACPI_REDUCED_HARDWARE)
/******************************************************************************
*
- * FUNCTION: AcpiUtTerminate
+ * FUNCTION: AcpiUtFreeGpeLists
*
* PARAMETERS: none
*
* RETURN: none
*
- * DESCRIPTION: Free global memory
+ * DESCRIPTION: Free global GPE lists
*
******************************************************************************/
static void
-AcpiUtTerminate (
+AcpiUtFreeGpeLists (
void)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
@@ -81,9 +93,6 @@ AcpiUtTerminate (
ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo;
- ACPI_FUNCTION_TRACE (UtTerminate);
-
-
/* Free global GPE blocks and related info structures */
GpeXruptInfo = AcpiGbl_GpeXruptListHead;
@@ -103,7 +112,30 @@ AcpiUtTerminate (
ACPI_FREE (GpeXruptInfo);
GpeXruptInfo = NextGpeXruptInfo;
}
+}
+#endif /* !ACPI_REDUCED_HARDWARE */
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiUtTerminate
+ *
+ * PARAMETERS: none
+ *
+ * RETURN: none
+ *
+ * DESCRIPTION: Free global memory
+ *
+ ******************************************************************************/
+
+static void
+AcpiUtTerminate (
+ void)
+{
+ ACPI_FUNCTION_TRACE (UtTerminate);
+ AcpiUtFreeGpeLists ();
+ AcpiUtDeleteAddressLists ();
return_VOID;
}
diff --git a/usr/src/uts/intel/io/acpica/utilities/utlock.c b/usr/src/uts/intel/io/acpica/utilities/utlock.c
index fd2fb2bb1d..61585ad499 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utlock.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utlock.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utmath.c b/usr/src/uts/intel/io/acpica/utilities/utmath.c
index 032b72d074..d0fad7cb6c 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utmath.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utmath.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utmisc.c b/usr/src/uts/intel/io/acpica/utilities/utmisc.c
index d20ad7e3a1..062c768e72 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utmisc.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utmisc.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -466,6 +466,44 @@ AcpiUtStrlwr (
return;
}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiUtStricmp
+ *
+ * PARAMETERS: String1 - first string to compare
+ * String2 - second string to compare
+ *
+ * RETURN: int that signifies string relationship. Zero means strings
+ * are equal.
+ *
+ * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare
+ * strings with no case sensitivity)
+ *
+ ******************************************************************************/
+
+int
+AcpiUtStricmp (
+ char *String1,
+ char *String2)
+{
+ int c1;
+ int c2;
+
+
+ do
+ {
+ c1 = tolower ((int) *String1);
+ c2 = tolower ((int) *String2);
+
+ String1++;
+ String2++;
+ }
+ while ((c1 == c2) && (c1));
+
+ return (c1 - c2);
+}
#endif
diff --git a/usr/src/uts/intel/io/acpica/utilities/utmutex.c b/usr/src/uts/intel/io/acpica/utilities/utmutex.c
index f7af803de1..f1cdb01804 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utmutex.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utmutex.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -335,15 +335,10 @@ ACPI_STATUS
AcpiUtReleaseMutex (
ACPI_MUTEX_HANDLE MutexId)
{
- ACPI_THREAD_ID ThisThreadId;
-
-
ACPI_FUNCTION_NAME (UtReleaseMutex);
-
- ThisThreadId = AcpiOsGetThreadId ();
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n",
- (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId)));
+ (UINT32) AcpiOsGetThreadId (), AcpiUtGetMutexName (MutexId)));
if (MutexId > ACPI_MAX_MUTEX)
{
@@ -374,7 +369,7 @@ AcpiUtReleaseMutex (
*/
for (i = MutexId; i < ACPI_NUM_MUTEX; i++)
{
- if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId)
+ if (AcpiGbl_MutexInfo[i].ThreadId == AcpiOsGetThreadId ())
{
if (i == MutexId)
{
diff --git a/usr/src/uts/intel/io/acpica/utilities/utobject.c b/usr/src/uts/intel/io/acpica/utilities/utobject.c
index ea621c741e..fea140946c 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utobject.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utobject.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utosi.c b/usr/src/uts/intel/io/acpica/utilities/utosi.c
index 053d6adc9b..dcce8a99e1 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utosi.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utosi.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utresrc.c b/usr/src/uts/intel/io/acpica/utilities/utresrc.c
index 468ffd6a1a..c2c135b7d2 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utresrc.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utresrc.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@
#include "acpi.h"
#include "accommon.h"
-#include "amlresrc.h"
+#include "acresrc.h"
#define _COMPONENT ACPI_UTILITIES
@@ -179,6 +179,154 @@ const char *AcpiGbl_TypDecode[] =
"TypeF"
};
+const char *AcpiGbl_PpcDecode[] =
+{
+ "PullDefault",
+ "PullUp",
+ "PullDown",
+ "PullNone"
+};
+
+const char *AcpiGbl_IorDecode[] =
+{
+ "IoRestrictionNone",
+ "IoRestrictionInputOnly",
+ "IoRestrictionOutputOnly",
+ "IoRestrictionNoneAndPreserve"
+};
+
+const char *AcpiGbl_DtsDecode[] =
+{
+ "Width8bit",
+ "Width16bit",
+ "Width32bit",
+ "Width64bit",
+ "Width128bit",
+ "Width256bit",
+};
+
+/* GPIO connection type */
+
+const char *AcpiGbl_CtDecode[] =
+{
+ "Interrupt",
+ "I/O"
+};
+
+/* Serial bus type */
+
+const char *AcpiGbl_SbtDecode[] =
+{
+ "/* UNKNOWN serial bus type */",
+ "I2C",
+ "SPI",
+ "UART"
+};
+
+/* I2C serial bus access mode */
+
+const char *AcpiGbl_AmDecode[] =
+{
+ "AddressingMode7Bit",
+ "AddressingMode10Bit"
+};
+
+/* I2C serial bus slave mode */
+
+const char *AcpiGbl_SmDecode[] =
+{
+ "ControllerInitiated",
+ "DeviceInitiated"
+};
+
+/* SPI serial bus wire mode */
+
+const char *AcpiGbl_WmDecode[] =
+{
+ "FourWireMode",
+ "ThreeWireMode"
+};
+
+/* SPI serial clock phase */
+
+const char *AcpiGbl_CphDecode[] =
+{
+ "ClockPhaseFirst",
+ "ClockPhaseSecond"
+};
+
+/* SPI serial bus clock polarity */
+
+const char *AcpiGbl_CpoDecode[] =
+{
+ "ClockPolarityLow",
+ "ClockPolarityHigh"
+};
+
+/* SPI serial bus device polarity */
+
+const char *AcpiGbl_DpDecode[] =
+{
+ "PolarityLow",
+ "PolarityHigh"
+};
+
+/* UART serial bus endian */
+
+const char *AcpiGbl_EdDecode[] =
+{
+ "LittleEndian",
+ "BigEndian"
+};
+
+/* UART serial bus bits per byte */
+
+const char *AcpiGbl_BpbDecode[] =
+{
+ "DataBitsFive",
+ "DataBitsSix",
+ "DataBitsSeven",
+ "DataBitsEight",
+ "DataBitsNine",
+ "/* UNKNOWN Bits per byte */",
+ "/* UNKNOWN Bits per byte */",
+ "/* UNKNOWN Bits per byte */"
+};
+
+/* UART serial bus stop bits */
+
+const char *AcpiGbl_SbDecode[] =
+{
+ "StopBitsNone",
+ "StopBitsOne",
+ "StopBitsOnePlusHalf",
+ "StopBitsTwo"
+};
+
+/* UART serial bus flow control */
+
+const char *AcpiGbl_FcDecode[] =
+{
+ "FlowControlNone",
+ "FlowControlHardware",
+ "FlowControlXON",
+ "/* UNKNOWN flow control keyword */"
+};
+
+/* UART serial bus parity type */
+
+const char *AcpiGbl_PtDecode[] =
+{
+ "ParityTypeNone",
+ "ParityTypeEven",
+ "ParityTypeOdd",
+ "ParityTypeMark",
+ "ParityTypeSpace",
+ "/* UNKNOWN parity keyword */",
+ "/* UNKNOWN parity keyword */",
+ "/* UNKNOWN parity keyword */"
+};
+
#endif
@@ -200,7 +348,7 @@ const UINT8 AcpiGbl_ResourceAmlSizes[] =
ACPI_AML_SIZE_SMALL (AML_RESOURCE_END_DEPENDENT),
ACPI_AML_SIZE_SMALL (AML_RESOURCE_IO),
ACPI_AML_SIZE_SMALL (AML_RESOURCE_FIXED_IO),
- 0,
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_FIXED_DMA),
0,
0,
0,
@@ -220,7 +368,18 @@ const UINT8 AcpiGbl_ResourceAmlSizes[] =
ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS16),
ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_IRQ),
ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS64),
- ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_ADDRESS64)
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_ADDRESS64),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO),
+ 0,
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_COMMON_SERIALBUS),
+};
+
+const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[] =
+{
+ 0,
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_I2C_SERIALBUS),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_SPI_SERIALBUS),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_UART_SERIALBUS),
};
@@ -238,35 +397,49 @@ static const UINT8 AcpiGbl_ResourceTypes[] =
0,
0,
0,
- ACPI_SMALL_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_SMALL_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_FIXED_LENGTH,
- 0,
+ ACPI_SMALL_VARIABLE_LENGTH, /* 04 IRQ */
+ ACPI_FIXED_LENGTH, /* 05 DMA */
+ ACPI_SMALL_VARIABLE_LENGTH, /* 06 StartDependentFunctions */
+ ACPI_FIXED_LENGTH, /* 07 EndDependentFunctions */
+ ACPI_FIXED_LENGTH, /* 08 IO */
+ ACPI_FIXED_LENGTH, /* 09 FixedIO */
+ ACPI_FIXED_LENGTH, /* 0A FixedDMA */
0,
0,
0,
- ACPI_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH,
+ ACPI_VARIABLE_LENGTH, /* 0E VendorShort */
+ ACPI_FIXED_LENGTH, /* 0F EndTag */
/* Large descriptors */
0,
- ACPI_FIXED_LENGTH,
- ACPI_FIXED_LENGTH,
+ ACPI_FIXED_LENGTH, /* 01 Memory24 */
+ ACPI_FIXED_LENGTH, /* 02 GenericRegister */
+ 0,
+ ACPI_VARIABLE_LENGTH, /* 04 VendorLong */
+ ACPI_FIXED_LENGTH, /* 05 Memory32 */
+ ACPI_FIXED_LENGTH, /* 06 Memory32Fixed */
+ ACPI_VARIABLE_LENGTH, /* 07 Dword* address */
+ ACPI_VARIABLE_LENGTH, /* 08 Word* address */
+ ACPI_VARIABLE_LENGTH, /* 09 ExtendedIRQ */
+ ACPI_VARIABLE_LENGTH, /* 0A Qword* address */
+ ACPI_FIXED_LENGTH, /* 0B Extended* address */
+ ACPI_VARIABLE_LENGTH, /* 0C Gpio* */
0,
- ACPI_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_FIXED_LENGTH,
- ACPI_VARIABLE_LENGTH,
- ACPI_VARIABLE_LENGTH,
- ACPI_VARIABLE_LENGTH,
- ACPI_VARIABLE_LENGTH,
- ACPI_FIXED_LENGTH
+ ACPI_VARIABLE_LENGTH /* 0E *SerialBus */
};
+/*
+ * For the iASL compiler/disassembler, we don't want any error messages
+ * because the disassembler uses the resource validation code to determine
+ * if Buffer objects are actually Resource Templates.
+ */
+#ifdef ACPI_ASL_COMPILER
+#define ACPI_RESOURCE_ERROR(plist)
+#else
+#define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist)
+#endif
+
/*******************************************************************************
*
@@ -297,6 +470,7 @@ AcpiUtWalkAmlResources (
UINT8 ResourceIndex;
UINT32 Length;
UINT32 Offset = 0;
+ UINT8 EndTag[2] = {0x79, 0x00};
ACPI_FUNCTION_TRACE (UtWalkAmlResources);
@@ -322,6 +496,10 @@ AcpiUtWalkAmlResources (
Status = AcpiUtValidateResource (Aml, &ResourceIndex);
if (ACPI_FAILURE (Status))
{
+ /*
+ * Exit on failure. Cannot continue because the descriptor length
+ * may be bogus also.
+ */
return_ACPI_STATUS (Status);
}
@@ -336,7 +514,7 @@ AcpiUtWalkAmlResources (
Status = UserFunction (Aml, Length, Offset, ResourceIndex, Context);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ return_ACPI_STATUS (Status);
}
}
@@ -371,7 +549,19 @@ AcpiUtWalkAmlResources (
/* Did not find an EndTag descriptor */
- return (AE_AML_NO_RESOURCE_END_TAG);
+ if (UserFunction)
+ {
+ /* Insert an EndTag anyway. AcpiRsGetListLength always leaves room */
+
+ (void) AcpiUtValidateResource (EndTag, &ResourceIndex);
+ Status = UserFunction (EndTag, 2, Offset, ResourceIndex, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
@@ -396,6 +586,7 @@ AcpiUtValidateResource (
void *Aml,
UINT8 *ReturnIndex)
{
+ AML_RESOURCE *AmlResource;
UINT8 ResourceType;
UINT8 ResourceIndex;
ACPI_RS_LENGTH ResourceLength;
@@ -420,7 +611,7 @@ AcpiUtValidateResource (
if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX)
{
- return (AE_AML_INVALID_RESOURCE_TYPE);
+ goto InvalidResource;
}
/*
@@ -439,17 +630,18 @@ AcpiUtValidateResource (
((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3);
}
- /* Check validity of the resource type, zero indicates name is invalid */
-
+ /*
+ * Check validity of the resource type, via AcpiGbl_ResourceTypes. Zero
+ * indicates an invalid resource.
+ */
if (!AcpiGbl_ResourceTypes[ResourceIndex])
{
- return (AE_AML_INVALID_RESOURCE_TYPE);
+ goto InvalidResource;
}
-
/*
- * 2) Validate the ResourceLength field. This ensures that the length
- * is at least reasonable, and guarantees that it is non-zero.
+ * Validate the ResourceLength field. This ensures that the length
+ * is at least reasonable, and guarantees that it is non-zero.
*/
ResourceLength = AcpiUtGetResourceLength (Aml);
MinimumResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex];
@@ -464,7 +656,7 @@ AcpiUtValidateResource (
if (ResourceLength != MinimumResourceLength)
{
- return (AE_AML_BAD_RESOURCE_LENGTH);
+ goto BadResourceLength;
}
break;
@@ -474,7 +666,7 @@ AcpiUtValidateResource (
if (ResourceLength < MinimumResourceLength)
{
- return (AE_AML_BAD_RESOURCE_LENGTH);
+ goto BadResourceLength;
}
break;
@@ -485,7 +677,7 @@ AcpiUtValidateResource (
if ((ResourceLength > MinimumResourceLength) ||
(ResourceLength < (MinimumResourceLength - 1)))
{
- return (AE_AML_BAD_RESOURCE_LENGTH);
+ goto BadResourceLength;
}
break;
@@ -493,7 +685,22 @@ AcpiUtValidateResource (
/* Shouldn't happen (because of validation earlier), but be sure */
- return (AE_AML_INVALID_RESOURCE_TYPE);
+ goto InvalidResource;
+ }
+
+ AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml);
+ if (ResourceType == ACPI_RESOURCE_NAME_SERIAL_BUS)
+ {
+ /* Validate the BusType field */
+
+ if ((AmlResource->CommonSerialBus.Type == 0) ||
+ (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE))
+ {
+ ACPI_RESOURCE_ERROR ((AE_INFO,
+ "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X",
+ AmlResource->CommonSerialBus.Type));
+ return (AE_AML_INVALID_RESOURCE_TYPE);
+ }
}
/* Optionally return the resource table index */
@@ -504,6 +711,22 @@ AcpiUtValidateResource (
}
return (AE_OK);
+
+
+InvalidResource:
+
+ ACPI_RESOURCE_ERROR ((AE_INFO,
+ "Invalid/unsupported resource descriptor: Type 0x%2.2X",
+ ResourceType));
+ return (AE_AML_INVALID_RESOURCE_TYPE);
+
+BadResourceLength:
+
+ ACPI_RESOURCE_ERROR ((AE_INFO,
+ "Invalid resource descriptor length: Type "
+ "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X",
+ ResourceType, ResourceLength, MinimumResourceLength));
+ return (AE_AML_BAD_RESOURCE_LENGTH);
}
diff --git a/usr/src/uts/intel/io/acpica/utilities/utstate.c b/usr/src/uts/intel/io/acpica/utilities/utstate.c
index bc84915ab0..62a1aefec7 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utstate.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utstate.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/uttrack.c b/usr/src/uts/intel/io/acpica/utilities/uttrack.c
index 6ecec63f31..7d58f5c8a8 100644
--- a/usr/src/uts/intel/io/acpica/utilities/uttrack.c
+++ b/usr/src/uts/intel/io/acpica/utilities/uttrack.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -633,21 +633,21 @@ AcpiUtDumpAllocations (
switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
{
case ACPI_DESC_TYPE_OPERAND:
- if (Element->Size == sizeof (ACPI_DESC_TYPE_OPERAND))
+ if (Element->Size == sizeof (ACPI_OPERAND_OBJECT))
{
DescriptorType = ACPI_DESC_TYPE_OPERAND;
}
break;
case ACPI_DESC_TYPE_PARSER:
- if (Element->Size == sizeof (ACPI_DESC_TYPE_PARSER))
+ if (Element->Size == sizeof (ACPI_PARSE_OBJECT))
{
DescriptorType = ACPI_DESC_TYPE_PARSER;
}
break;
case ACPI_DESC_TYPE_NAMED:
- if (Element->Size == sizeof (ACPI_DESC_TYPE_NAMED))
+ if (Element->Size == sizeof (ACPI_NAMESPACE_NODE))
{
DescriptorType = ACPI_DESC_TYPE_NAMED;
}
diff --git a/usr/src/uts/intel/io/acpica/utilities/utxface.c b/usr/src/uts/intel/io/acpica/utilities/utxface.c
index 63b081b758..3e858c9b0f 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utxface.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utxface.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,7 +56,6 @@
#ifndef ACPI_ASL_COMPILER
-
/*******************************************************************************
*
* FUNCTION: AcpiInitializeSubsystem
@@ -162,6 +161,8 @@ AcpiEnableSubsystem (
ACPI_FUNCTION_TRACE (AcpiEnableSubsystem);
+#if (!ACPI_REDUCED_HARDWARE)
+
/* Enable ACPI mode */
if (!(Flags & ACPI_NO_ACPI_ENABLE))
@@ -189,6 +190,8 @@ AcpiEnableSubsystem (
return_ACPI_STATUS (Status);
}
+#endif /* !ACPI_REDUCED_HARDWARE */
+
/*
* Install the default OpRegion handlers. These are installed unless
* other handlers have already been installed via the
@@ -206,6 +209,7 @@ AcpiEnableSubsystem (
}
}
+#if (!ACPI_REDUCED_HARDWARE)
/*
* Initialize ACPI Event handling (Fixed and General Purpose)
*
@@ -248,6 +252,8 @@ AcpiEnableSubsystem (
}
}
+#endif /* !ACPI_REDUCED_HARDWARE */
+
return_ACPI_STATUS (Status);
}
@@ -785,5 +791,47 @@ AcpiInstallInterfaceHandler (
ACPI_EXPORT_SYMBOL (AcpiInstallInterfaceHandler)
-#endif /* !ACPI_ASL_COMPILER */
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiCheckAddressRange
+ *
+ * PARAMETERS: SpaceId - Address space ID
+ * Address - Start address
+ * Length - Length
+ * Warn - TRUE if warning on overlap desired
+ *
+ * RETURN: Count of the number of conflicts detected.
+ *
+ * DESCRIPTION: Check if the input address range overlaps any of the
+ * ASL operation region address ranges.
+ *
+ ****************************************************************************/
+
+UINT32
+AcpiCheckAddressRange (
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_SIZE Length,
+ BOOLEAN Warn)
+{
+ UINT32 Overlaps;
+ ACPI_STATUS Status;
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (0);
+ }
+
+ Overlaps = AcpiUtCheckAddressRange (SpaceId, Address,
+ (UINT32) Length, Warn);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (Overlaps);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiCheckAddressRange)
+
+#endif /* !ACPI_ASL_COMPILER */
diff --git a/usr/src/uts/intel/io/acpica/utilities/utxferror.c b/usr/src/uts/intel/io/acpica/utilities/utxferror.c
index a371308d6b..8ffb274894 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utxferror.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utxferror.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/io/acpica/utilities/utxfmutex.c b/usr/src/uts/intel/io/acpica/utilities/utxfmutex.c
new file mode 100644
index 0000000000..c4784310d3
--- /dev/null
+++ b/usr/src/uts/intel/io/acpica/utilities/utxfmutex.c
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ *
+ * Module Name: utxfmutex - external AML mutex access functions
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#define __UTXFMUTEX_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acnamesp.h"
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utxfmutex")
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiUtGetMutexObject (
+ ACPI_HANDLE Handle,
+ ACPI_STRING Pathname,
+ ACPI_OPERAND_OBJECT **RetObj);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetMutexObject
+ *
+ * PARAMETERS: Handle - Mutex or prefix handle (optional)
+ * Pathname - Mutex pathname (optional)
+ * RetObj - Where the mutex object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get an AML mutex object. The mutex node is pointed to by
+ * Handle:Pathname. Either Handle or Pathname can be NULL, but
+ * not both.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtGetMutexObject (
+ ACPI_HANDLE Handle,
+ ACPI_STRING Pathname,
+ ACPI_OPERAND_OBJECT **RetObj)
+{
+ ACPI_NAMESPACE_NODE *MutexNode;
+ ACPI_OPERAND_OBJECT *MutexObj;
+ ACPI_STATUS Status;
+
+
+ /* Parameter validation */
+
+ if (!RetObj || (!Handle && !Pathname))
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Get a the namespace node for the mutex */
+
+ MutexNode = Handle;
+ if (Pathname != NULL)
+ {
+ Status = AcpiGetHandle (Handle, Pathname,
+ ACPI_CAST_PTR (ACPI_HANDLE, &MutexNode));
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ /* Ensure that we actually have a Mutex object */
+
+ if (!MutexNode ||
+ (MutexNode->Type != ACPI_TYPE_MUTEX))
+ {
+ return (AE_TYPE);
+ }
+
+ /* Get the low-level mutex object */
+
+ MutexObj = AcpiNsGetAttachedObject (MutexNode);
+ if (!MutexObj)
+ {
+ return (AE_NULL_OBJECT);
+ }
+
+ *RetObj = MutexObj;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiAcquireMutex
+ *
+ * PARAMETERS: Handle - Mutex or prefix handle (optional)
+ * Pathname - Mutex pathname (optional)
+ * Timeout - Max time to wait for the lock (millisec)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Acquire an AML mutex. This is a device driver interface to
+ * AML mutex objects, and allows for transaction locking between
+ * drivers and AML code. The mutex node is pointed to by
+ * Handle:Pathname. Either Handle or Pathname can be NULL, but
+ * not both.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiAcquireMutex (
+ ACPI_HANDLE Handle,
+ ACPI_STRING Pathname,
+ UINT16 Timeout)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *MutexObj;
+
+
+ /* Get the low-level mutex associated with Handle:Pathname */
+
+ Status = AcpiUtGetMutexObject (Handle, Pathname, &MutexObj);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Acquire the OS mutex */
+
+ Status = AcpiOsAcquireMutex (MutexObj->Mutex.OsMutex, Timeout);
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiReleaseMutex
+ *
+ * PARAMETERS: Handle - Mutex or prefix handle (optional)
+ * Pathname - Mutex pathname (optional)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release an AML mutex. This is a device driver interface to
+ * AML mutex objects, and allows for transaction locking between
+ * drivers and AML code. The mutex node is pointed to by
+ * Handle:Pathname. Either Handle or Pathname can be NULL, but
+ * not both.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiReleaseMutex (
+ ACPI_HANDLE Handle,
+ ACPI_STRING Pathname)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *MutexObj;
+
+
+ /* Get the low-level mutex associated with Handle:Pathname */
+
+ Status = AcpiUtGetMutexObject (Handle, Pathname, &MutexObj);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Release the OS mutex */
+
+ AcpiOsReleaseMutex (MutexObj->Mutex.OsMutex);
+ return (AE_OK);
+}
diff --git a/usr/src/uts/intel/io/dktp/dcdev/dadk.c b/usr/src/uts/intel/io/dktp/dcdev/dadk.c
index 3fd4477fd1..a496c3aba7 100644
--- a/usr/src/uts/intel/io/dktp/dcdev/dadk.c
+++ b/usr/src/uts/intel/io/dktp/dcdev/dadk.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
/*
@@ -170,6 +171,8 @@ static int dadk_debug = DGEOM;
#endif /* DADK_DEBUG */
+#define ONE_MIN ((longlong_t)60 * NANOSEC)
+
static int dadk_check_media_time = 3000000; /* 3 Second State Check */
static int dadk_dk_maxphys = 0x80000;
@@ -1378,6 +1381,47 @@ static struct dadkio_derr dadk_errtab[] = {
{COMMAND_DONE_ERROR, GDA_FATAL}, /* 23 DERR_RESV */
};
+/*
+ * A bad disk can result in a large number of errors spewed to the log.
+ * This can in turn lead to /var/adm/messages filling up the file system on
+ * a machine with a small root or /var file system.
+ *
+ * Instead of logging every error, if we're seeing repeated errors on a disk
+ * only log them periodically.
+ */
+static void
+dadk_logerr(struct dadk *dadkp, struct cmpkt *pktp, char *label,
+ int severity, daddr_t blkno, daddr_t err_blkno,
+ char **cmdvec, char **senvec)
+{
+ hrtime_t now;
+
+ now = gethrtime();
+ if ((now - dadkp->dad_last_log) < ONE_MIN) {
+ atomic_add_32(&dadkp->dad_err_cnt, 1);
+ return;
+ }
+
+ if (dadkp->dad_err_cnt > 0) {
+ dev_info_t *dev = dadkp->dad_sd->sd_dev;
+ char name[256], buf[256];
+
+ if (dev)
+ (void) snprintf(name, sizeof (name), "%s (%s%d)",
+ ddi_pathname(dev, buf), label,
+ ddi_get_instance(dev));
+ else
+ (void) strlcpy(name, label, sizeof (name));
+ cmn_err(CE_WARN, "%s: %d additional unlogged errors\n",
+ name, dadkp->dad_err_cnt);
+ }
+
+ gda_errmsg(dadkp->dad_sd, pktp, label, severity, blkno, err_blkno,
+ cmdvec, senvec);
+ dadkp->dad_err_cnt = 0;
+ dadkp->dad_last_log = now;
+}
+
static int
dadk_chkerr(struct cmpkt *pktp)
{
@@ -1464,7 +1508,7 @@ dadk_chkerr(struct cmpkt *pktp)
return (COMMAND_DONE);
}
if (pktp->cp_passthru == NULL) {
- gda_errmsg(dadkp->dad_sd, pktp, dadk_name,
+ dadk_logerr(dadkp, pktp, dadk_name,
dadk_errtab[scb].d_severity, pktp->cp_srtsec,
err_blkno, dadk_cmds, dadk_sense);
}
@@ -1521,7 +1565,7 @@ dadk_recorderr(struct cmpkt *pktp, struct dadkio_rwcmd *rwcmdp)
if (rwcmdp->flags & DADKIO_FLAG_SILENT)
return;
- gda_errmsg(dadkp->dad_sd, pktp, dadk_name, dadk_errtab[scb].d_severity,
+ dadk_logerr(dadkp, pktp, dadk_name, dadk_errtab[scb].d_severity,
rwcmdp->blkaddr, rwcmdp->status.failed_blk,
dadk_cmds, dadk_sense);
}
diff --git a/usr/src/uts/intel/io/ipmi/ipmivars.h b/usr/src/uts/intel/io/ipmi/ipmivars.h
index 2943fd1574..c63d500e97 100644
--- a/usr/src/uts/intel/io/ipmi/ipmivars.h
+++ b/usr/src/uts/intel/io/ipmi/ipmivars.h
@@ -66,6 +66,8 @@ struct ipmi_request {
#define SMIC_CTL_STS 1
#define SMIC_FLAGS 2
+struct ipmi_softc;
+
/* Per file descriptor data. */
typedef struct ipmi_device {
TAILQ_HEAD(, ipmi_request) ipmi_completed_requests;
diff --git a/usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.c b/usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.c
index 01da6c0ed0..8aa0546c6b 100644
--- a/usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.c
+++ b/usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.c
@@ -2532,6 +2532,7 @@ arcmsr_initialize(struct ACB *acb)
realccb_size = P2ROUNDUP(sizeof (struct CCB), 32);
switch (wval) {
case PCI_DEVICE_ID_ARECA_1880:
+ case PCI_DEVICE_ID_ARECA_1882:
{
uint32_t *iop_mu_regs_map0;
diff --git a/usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.h b/usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.h
index 8a86827e8d..8d419d92ae 100644
--- a/usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.h
+++ b/usr/src/uts/intel/io/scsi/adapters/arcmsr/arcmsr.h
@@ -145,6 +145,7 @@ typedef struct ACB *PACB;
#define PCI_DEVICE_ID_ARECA_1681 0x1681 /* Device ID */
#define PCI_DEVICE_ID_ARECA_1201 0x1201 /* Device ID */
#define PCI_DEVICE_ID_ARECA_1880 0x1880 /* Device ID */
+#define PCI_DEVICE_ID_ARECA_1882 0x1882 /* Device ID */
#define dma_addr_hi32(addr) (uint32_t)((addr>>16)>>16)
#define dma_addr_lo32(addr) (uint32_t)(addr & 0xffffffff)
diff --git a/usr/src/uts/intel/io/vmxnet/buildNumber.h b/usr/src/uts/intel/io/vmxnet/buildNumber.h
new file mode 100644
index 0000000000..97f18a3cbc
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/buildNumber.h
@@ -0,0 +1,12 @@
+#define BUILD_NUMBER \
+ "build-425873"
+#define BUILD_NUMBER_NUMERIC \
+ 425873
+#define BUILD_NUMBER_NUMERIC_STRING \
+ "425873"
+#define PRODUCT_BUILD_NUMBER \
+ "product-build-6261"
+#define PRODUCT_BUILD_NUMBER_NUMERIC \
+ 6261
+#define PRODUCT_BUILD_NUMBER_NUMERIC_STRING \
+ "6261"
diff --git a/usr/src/uts/intel/io/vmxnet/includeCheck.h b/usr/src/uts/intel/io/vmxnet/includeCheck.h
new file mode 100644
index 0000000000..c414d6daf5
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/includeCheck.h
@@ -0,0 +1,159 @@
+/*********************************************************
+ * Copyright (C) 1998 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+/*********************************************************
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of VMware Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission of VMware Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *********************************************************/
+
+/*********************************************************
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version. You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+/*
+ * includeCheck.h --
+ *
+ * Restrict include file use.
+ *
+ * In every .h file, define one or more of these
+ *
+ * INCLUDE_ALLOW_VMX
+ * INCLUDE_ALLOW_USERLEVEL
+ * INCLUDE_ALLOW_VMCORE
+ * INCLUDE_ALLOW_MODULE
+ * INCLUDE_ALLOW_VMKERNEL
+ * INCLUDE_ALLOW_DISTRIBUTE
+ * INCLUDE_ALLOW_VMK_MODULE
+ * INCLUDE_ALLOW_VMKDRIVERS
+ * INCLUDE_ALLOW_VMIROM
+ *
+ * Then include this file.
+ *
+ * Any file that has INCLUDE_ALLOW_DISTRIBUTE defined will potentially
+ * be distributed in source form along with GPLed code. Ensure
+ * that this is acceptable.
+ */
+
+
+/*
+ * Declare a VMCORE-only variable to help classify object
+ * files. The variable goes in the common block and does
+ * not create multiple definition link-time conflicts.
+ */
+
+#if defined VMCORE && defined VMX86_DEVEL && defined VMX86_DEBUG && \
+ defined linux && !defined MODULE && \
+ !defined COMPILED_WITH_VMCORE
+#define COMPILED_WITH_VMCORE compiled_with_vmcore
+#ifdef ASM
+ .comm compiled_with_vmcore, 0
+#else
+ asm(".comm compiled_with_vmcore, 0");
+#endif /* ASM */
+#endif
+
+
+#if defined VMCORE && \
+ !(defined VMX86_VMX || defined VMM || \
+ defined MONITOR_APP || defined VMMON)
+#error "Makefile problem: VMCORE without VMX86_VMX or \
+ VMM or MONITOR_APP or MODULE."
+#endif
+
+#if defined VMCORE && !defined INCLUDE_ALLOW_VMCORE
+#error "The surrounding include file is not allowed in vmcore."
+#endif
+#undef INCLUDE_ALLOW_VMCORE
+
+#if defined VMX86_VMX && !defined VMCORE && \
+ !(defined INCLUDE_ALLOW_VMX || defined INCLUDE_ALLOW_USERLEVEL)
+#error "The surrounding include file is not allowed in the VMX."
+#endif
+#undef INCLUDE_ALLOW_VMX
+
+#if defined USERLEVEL && !defined VMX86_VMX && !defined VMCORE && \
+ !defined INCLUDE_ALLOW_USERLEVEL
+#error "The surrounding include file is not allowed at userlevel."
+#endif
+#undef INCLUDE_ALLOW_USERLEVEL
+
+#if defined MODULE && !defined VMKERNEL_MODULE && \
+ !defined VMMON && !defined INCLUDE_ALLOW_MODULE
+#error "The surrounding include file is not allowed in driver modules."
+#endif
+#undef INCLUDE_ALLOW_MODULE
+
+#if defined VMMON && !defined INCLUDE_ALLOW_VMMON
+#error "The surrounding include file is not allowed in vmmon."
+#endif
+#undef INCLUDE_ALLOW_VMMON
+
+#if defined VMKERNEL && !defined INCLUDE_ALLOW_VMKERNEL
+#error "The surrounding include file is not allowed in the vmkernel."
+#endif
+#undef INCLUDE_ALLOW_VMKERNEL
+
+#if defined GPLED_CODE && !defined INCLUDE_ALLOW_DISTRIBUTE
+#error "The surrounding include file is not allowed in GPL code."
+#endif
+#undef INCLUDE_ALLOW_DISTRIBUTE
+
+#if defined VMKERNEL_MODULE && !defined VMKERNEL && \
+ !defined INCLUDE_ALLOW_VMK_MODULE && !defined INCLUDE_ALLOW_VMKDRIVERS
+#error "The surrounding include file is not allowed in vmkernel modules."
+#endif
+#undef INCLUDE_ALLOW_VMK_MODULE
+#undef INCLUDE_ALLOW_VMKDRIVERS
+
+#if defined VMIROM && ! defined INCLUDE_ALLOW_VMIROM
+#error "The surrounding include file is not allowed in vmirom."
+#endif
+#undef INCLUDE_ALLOW_VMIROM
diff --git a/usr/src/uts/intel/io/vmxnet/net.h b/usr/src/uts/intel/io/vmxnet/net.h
new file mode 100644
index 0000000000..41b6eb1d14
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/net.h
@@ -0,0 +1,220 @@
+/*********************************************************
+ * Copyright (C) 1998 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *********************************************************/
+
+/*********************************************************
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version. You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+/************************************************************
+ *
+ * net.h
+ *
+ * This file should contain all network global defines.
+ * No vlance/vmxnet/vnet/vmknet specific stuff should be
+ * put here only defines used/usable by all network code.
+ * --gustav
+ *
+ ************************************************************/
+
+#ifndef VMWARE_DEVICES_NET_H
+#define VMWARE_DEVICES_NET_H
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMCORE
+
+#include "includeCheck.h"
+#include "vm_device_version.h"
+
+#ifdef VMCORE
+#include "config.h"
+#include "str.h"
+#include "strutil.h"
+#endif
+
+#define ETHERNET_MTU 1518
+#define ETH_MIN_FRAME_LEN 60
+
+#ifndef ETHER_ADDR_LEN
+#define ETHER_ADDR_LEN 6 /* length of MAC address */
+#endif
+#define ETH_HEADER_LEN 14 /* length of Ethernet header */
+#define IP_ADDR_LEN 4 /* length of IPv4 address */
+#define IP_HEADER_LEN 20 /* minimum length of IPv4 header */
+
+#define ETHER_MAX_QUEUED_PACKET 1600
+
+
+/*
+ * State's that a NIC can be in currently we only use this
+ * in VLance but if we implement/emulate new adapters that
+ * we also want to be able to morph a new corresponding
+ * state should be added.
+ */
+
+#define LANCE_CHIP 0x2934
+#define VMXNET_CHIP 0x4392
+
+/*
+ * Size of reserved IO space needed by the LANCE adapter and
+ * the VMXNET adapter. If you add more ports to Vmxnet than
+ * there is reserved space you must bump VMXNET_CHIP_IO_RESV_SIZE.
+ * The sizes must be powers of 2.
+ */
+
+#define LANCE_CHIP_IO_RESV_SIZE 0x20
+#define VMXNET_CHIP_IO_RESV_SIZE 0x40
+
+#define MORPH_PORT_SIZE 4
+
+#ifdef VMCORE
+typedef struct Net_AdapterCount {
+ uint8 vlance;
+ uint8 vmxnet2;
+ uint8 vmxnet3;
+ uint8 e1000;
+ uint8 e1000e;
+} Net_AdapterCount;
+#endif
+
+#ifdef USERLEVEL
+
+/*
+ *----------------------------------------------------------------------------
+ *
+ * Net_AddAddrToLADRF --
+ *
+ * Given a MAC address, sets the corresponding bit in the LANCE style
+ * Logical Address Filter 'ladrf'.
+ * The caller should have initialized the ladrf to all 0's, as this
+ * function only ORs on a bit in the array.
+ * 'addr' is presumed to be ETHER_ADDR_LEN in size;
+ * 'ladrf' is presumed to point to a 64-bit vector.
+ *
+ * Derived from a long history of derivations, originally inspired by
+ * sample code from the AMD "Network Products: Ethernet Controllers 1998
+ * Data Book, Book 2", pages 1-53..1-55.
+ *
+ * Returns:
+ * None.
+ *
+ * Side effects:
+ * Updates 'ladrf'.
+ *
+ *----------------------------------------------------------------------------
+ */
+
+static INLINE void
+Net_AddAddrToLadrf(const uint8 *addr, // IN: pointer to MAC address
+ uint8 *ladrf) // IN/OUT: pointer to ladrf
+{
+#define CRC_POLYNOMIAL_BE 0x04c11db7UL /* Ethernet CRC, big endian */
+
+ uint16 hashcode;
+ int32 crc = 0xffffffff; /* init CRC for each address */
+ int32 j;
+ int32 bit;
+ int32 byte;
+
+ ASSERT(addr);
+ ASSERT(ladrf);
+
+ for (byte = 0; byte < ETHER_ADDR_LEN; byte++) { /* for each address byte */
+ /* process each address bit */
+ for (bit = *addr++, j = 0;
+ j < 8;
+ j++, bit >>= 1) {
+ crc = (crc << 1) ^ ((((crc < 0 ? 1 : 0) ^ bit) & 0x01) ?
+ CRC_POLYNOMIAL_BE : 0);
+ }
+ }
+ hashcode = (crc & 1); /* hashcode is 6 LSb of CRC ... */
+ for (j = 0; j < 5; j++) { /* ... in reverse order. */
+ hashcode = (hashcode << 1) | ((crc>>=1) & 1);
+ }
+
+ ladrf[hashcode >> 3] |= 1 << (hashcode & 0x07);
+}
+#endif // USERLEVEL
+
+#ifdef VMCORE
+/*
+ *----------------------------------------------------------------------
+ *
+ * Net_GetNumAdapters --
+ *
+ * Returns the number of each type of network adapter configured in this
+ * VM.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static INLINE void
+Net_GetNumAdapters(Net_AdapterCount *counts)
+{
+ uint32 i;
+
+ counts->vlance = 0;
+ counts->vmxnet2 = 0;
+ counts->vmxnet3 = 0;
+ counts->e1000 = 0;
+ counts->e1000e = 0;
+
+ for (i = 0; i < MAX_ETHERNET_CARDS; i++) {
+ char* adapterStr;
+
+ if (!Config_GetBool(FALSE, "ethernet%d.present", i)) {
+ continue;
+ }
+ adapterStr = Config_GetString("vlance", "ethernet%d.virtualDev", i);
+ if (Str_Strcasecmp(adapterStr, "vmxnet3") == 0) {
+ counts->vmxnet3++;
+ } else if (Str_Strcasecmp(adapterStr, "vlance") == 0) {
+ counts->vlance++;
+ } else if (Str_Strcasecmp(adapterStr, "vmxnet") == 0) {
+ counts->vmxnet2++;
+ } else if (Str_Strcasecmp(adapterStr, "e1000") == 0) {
+ counts->e1000++;
+ } else if (Str_Strcasecmp(adapterStr, "e1000e") == 0) {
+ counts->e1000e++;
+ } else {
+ LOG_ONCE(("%s: unknown adapter: %s\n", __FUNCTION__, adapterStr));
+ }
+ free(adapterStr);
+ }
+}
+
+#endif // VMCORE
+
+#endif // VMWARE_DEVICES_NET_H
diff --git a/usr/src/uts/intel/io/vmxnet/net_sg.h b/usr/src/uts/intel/io/vmxnet/net_sg.h
new file mode 100644
index 0000000000..f6c30fb2b5
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/net_sg.h
@@ -0,0 +1,84 @@
+/*********************************************************
+ * Copyright (C) 2000 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *********************************************************/
+
+/*********************************************************
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version. You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+/*
+ * net_sg.h --
+ *
+ * Network packet scatter gather structure.
+ */
+
+
+#ifndef _NET_SG_H
+#define _NET_SG_H
+
+#define INCLUDE_ALLOW_USERLEVEL
+
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMK_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#define INCLUDE_ALLOW_DISTRIBUTE
+#include "includeCheck.h"
+
+#define NET_SG_DEFAULT_LENGTH 16
+
+/*
+ * A single scatter-gather element for a network packet.
+ * The address is split into low and high to save space.
+ * If we make it 64 bits then Windows pads things out such that
+ * we lose a lot of space for each scatter gather array.
+ * This adds up when you have embedded scatter-gather
+ * arrays for transmit and receive ring buffers.
+ */
+typedef struct NetSG_Elem {
+ uint32 addrLow;
+ uint16 addrHi;
+ uint16 length;
+} NetSG_Elem;
+
+typedef enum NetSG_AddrType {
+ NET_SG_MACH_ADDR,
+ NET_SG_PHYS_ADDR,
+ NET_SG_VIRT_ADDR,
+} NetSG_AddrType;
+
+typedef struct NetSG_Array {
+ uint16 addrType;
+ uint16 length;
+ NetSG_Elem sg[NET_SG_DEFAULT_LENGTH];
+} NetSG_Array;
+
+#define NET_SG_SIZE(len) (sizeof(NetSG_Array) + (len - NET_SG_DEFAULT_LENGTH) * sizeof(NetSG_Elem))
+
+#define NET_SG_MAKE_PA(elem) (PA)QWORD(elem.addrHi, elem.addrLow)
+#define NET_SG_MAKE_PTR(elem) (char *)(uintptr_t)QWORD(elem.addrHi, elem.addrLow)
+
+#endif
diff --git a/usr/src/uts/intel/io/vmxnet/vm_basic_types.h b/usr/src/uts/intel/io/vmxnet/vm_basic_types.h
new file mode 100644
index 0000000000..adeac1b708
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/vm_basic_types.h
@@ -0,0 +1,1037 @@
+/*********************************************************
+ * Copyright (C) 1998-2009 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+/*********************************************************
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of VMware Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission of VMware Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *********************************************************/
+
+/*********************************************************
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version. You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+/*
+ *
+ * vm_basic_types.h --
+ *
+ * basic data types.
+ */
+
+
+#ifndef _VM_BASIC_TYPES_H_
+#define _VM_BASIC_TYPES_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMMON
+#define INCLUDE_ALLOW_VMKERNEL
+#define INCLUDE_ALLOW_VMKDRIVERS
+#define INCLUDE_ALLOW_VMK_MODULE
+#define INCLUDE_ALLOW_DISTRIBUTE
+#define INCLUDE_ALLOW_VMCORE
+#define INCLUDE_ALLOW_VMIROM
+#include "includeCheck.h"
+
+/* STRICT ANSI means the Xserver build and X defines Bool differently. */
+#if !defined(_XTYPEDEF_BOOL) && \
+ (!defined(__STRICT_ANSI__) || defined(__FreeBSD__) || defined(__MINGW32__))
+#define _XTYPEDEF_BOOL
+typedef char Bool;
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#define IsBool(x) (((x) & ~1) == 0)
+#define IsBool2(x, y) ((((x) | (y)) & ~1) == 0)
+
+/*
+ * Macros __i386__ and __ia64 are intrinsically defined by GCC
+ */
+#if defined _MSC_VER && defined _M_X64
+# define __x86_64__
+#elif defined _MSC_VER && defined _M_IX86
+# define __i386__
+#endif
+
+#ifdef __i386__
+#define VM_I386
+#endif
+
+#ifdef __x86_64__
+#define VM_X86_64
+#define VM_I386
+#define vm_x86_64 (1)
+#else
+#define vm_x86_64 (0)
+#endif
+
+
+#ifdef _MSC_VER
+
+#pragma warning (3 :4505) // unreferenced local function
+#pragma warning (disable :4018) // signed/unsigned mismatch
+#pragma warning (disable :4761) // integral size mismatch in argument; conversion supplied
+#pragma warning (disable :4305) // truncation from 'const int' to 'short'
+#pragma warning (disable :4244) // conversion from 'unsigned short' to 'unsigned char'
+#pragma warning (disable :4267) // truncation of 'size_t'
+#pragma warning (disable :4146) // unary minus operator applied to unsigned type, result still unsigned
+#pragma warning (disable :4142) // benign redefinition of type
+
+#endif
+
+#if defined(__APPLE__) || defined(HAVE_STDINT_H)
+
+/*
+ * TODO: This is a C99 standard header. We should be able to test for
+ * #if __STDC_VERSION__ >= 199901L, but that breaks the Netware build
+ * (which doesn't have stdint.h).
+ */
+
+#include <stdint.h>
+
+typedef uint64_t uint64;
+typedef int64_t int64;
+typedef uint32_t uint32;
+typedef int32_t int32;
+typedef uint16_t uint16;
+typedef int16_t int16;
+typedef uint8_t uint8;
+typedef int8_t int8;
+
+/*
+ * Note: C does not specify whether char is signed or unsigned, and
+ * both gcc and msvc implement processor-specific signedness. With
+ * three types:
+ * typeof(char) != typeof(signed char) != typeof(unsigned char)
+ *
+ * Be careful here, because gcc (4.0.1 and others) likes to warn about
+ * conversions between signed char * and char *.
+ */
+
+#else /* !HAVE_STDINT_H */
+
+#ifdef _MSC_VER
+
+typedef unsigned __int64 uint64;
+typedef signed __int64 int64;
+
+#elif defined(__GNUC__) || defined(__SUNPRO_C)
+/* The Xserver source compiles with -ansi -pendantic */
+# if !defined(__STRICT_ANSI__) || defined(__FreeBSD__)
+# if defined(VM_X86_64)
+typedef unsigned long uint64;
+typedef long int64;
+# else
+typedef unsigned long long uint64;
+typedef long long int64;
+# endif
+# endif
+#else
+# error - Need compiler define for int64/uint64
+#endif /* _MSC_VER */
+
+typedef unsigned int uint32;
+typedef unsigned short uint16;
+typedef unsigned char uint8;
+
+typedef int int32;
+typedef short int16;
+typedef signed char int8;
+
+#endif /* HAVE_STDINT_H */
+
+/*
+ * FreeBSD (for the tools build) unconditionally defines these in
+ * sys/inttypes.h so don't redefine them if this file has already
+ * been included. [greg]
+ *
+ * This applies to Solaris as well.
+ */
+
+/*
+ * Before trying to do the includes based on OS defines, see if we can use
+ * feature-based defines to get as much functionality as possible
+ */
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_INTTYPES_H
+#include <sys/inttypes.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef __FreeBSD__
+#include <sys/param.h> /* For __FreeBSD_version */
+#endif
+
+#if !defined(USING_AUTOCONF)
+# if defined(__FreeBSD__) || defined(sun)
+# ifdef KLD_MODULE
+# include <sys/types.h>
+# else
+# if __FreeBSD_version >= 500043
+# if !defined(VMKERNEL)
+# include <inttypes.h>
+# endif
+# include <sys/types.h>
+# else
+# include <sys/inttypes.h>
+# endif
+# endif
+# elif defined __APPLE__
+# if KERNEL
+# include <sys/unistd.h>
+# include <sys/types.h> /* mostly for size_t */
+# include <stdint.h>
+# else
+# include <unistd.h>
+# include <inttypes.h>
+# include <stdlib.h>
+# include <stdint.h>
+# endif
+# else
+# if !defined(__intptr_t_defined) && !defined(intptr_t)
+# ifdef VM_I386
+# define __intptr_t_defined
+# ifdef VM_X86_64
+typedef int64 intptr_t;
+# else
+typedef int32 intptr_t;
+# endif
+# elif defined(__arm__)
+typedef int32 intptr_t;
+# endif
+# endif
+
+# ifndef _STDINT_H
+# ifdef VM_I386
+# ifdef VM_X86_64
+typedef uint64 uintptr_t;
+# else
+typedef uint32 uintptr_t;
+# endif
+# elif defined(__arm__)
+typedef uint32 uintptr_t;
+# endif
+# endif
+# endif
+#endif
+
+
+/*
+ * Time
+ * XXX These should be cleaned up. -- edward
+ */
+
+typedef int64 VmTimeType; /* Time in microseconds */
+typedef int64 VmTimeRealClock; /* Real clock kept in microseconds */
+typedef int64 VmTimeVirtualClock; /* Virtual Clock kept in CPU cycles */
+
+/*
+ * Printf format specifiers for size_t and 64-bit number.
+ * Use them like this:
+ * printf("%"FMT64"d\n", big);
+ *
+ * FMTH is for handles/fds.
+ */
+
+#ifdef _MSC_VER
+ #define FMT64 "I64"
+ #ifdef VM_X86_64
+ #define FMTSZ "I64"
+ #define FMTPD "I64"
+ #define FMTH "I64"
+ #else
+ #define FMTSZ "I"
+ #define FMTPD "I"
+ #define FMTH "I"
+ #endif
+#elif defined __APPLE__
+ /* Mac OS hosts use the same formatters for 32- and 64-bit. */
+ #define FMT64 "ll"
+ #if KERNEL
+ #define FMTSZ "l"
+ #else
+ #define FMTSZ "z"
+ #endif
+ #define FMTPD "l"
+ #define FMTH ""
+#elif defined(__GNUC__) || defined(__SUNPRO_C)
+ #define FMTH ""
+ #if defined(N_PLAT_NLM) || defined(sun) || \
+ (defined(__FreeBSD__) && (__FreeBSD__ + 0) && ((__FreeBSD__ + 0) < 5))
+ /*
+ * Why (__FreeBSD__ + 0)? See bug 141008.
+ * Yes, we really need to test both (__FreeBSD__ + 0) and
+ * ((__FreeBSD__ + 0) < 5). No, we can't remove "+ 0" from
+ * ((__FreeBSD__ + 0) < 5).
+ */
+ #ifdef VM_X86_64
+ #define FMTSZ "l"
+ #define FMTPD "l"
+ #else
+ #define FMTSZ ""
+ #define FMTPD ""
+ #endif
+ #elif defined(__linux__) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) \
+ || (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
+ || (defined(_POSIX2_VERSION) && _POSIX2_VERSION >= 200112L)
+ /* BSD, Linux */
+ #define FMTSZ "z"
+
+ #if defined(VM_X86_64)
+ #define FMTPD "l"
+ #else
+ #define FMTPD ""
+ #endif
+ #else
+ /* Systems with a pre-C99 libc */
+ #define FMTSZ "Z"
+ #ifdef VM_X86_64
+ #define FMTPD "l"
+ #else
+ #define FMTPD ""
+ #endif
+ #endif
+ #ifdef VM_X86_64
+ #define FMT64 "l"
+ #elif defined(sun) || defined(__FreeBSD__)
+ #define FMT64 "ll"
+ #else
+ #define FMT64 "L"
+ #endif
+#else
+ #error - Need compiler define for FMT64 and FMTSZ
+#endif
+
+/*
+ * Suffix for 64-bit constants. Use it like this:
+ * CONST64(0x7fffffffffffffff) for signed or
+ * CONST64U(0x7fffffffffffffff) for unsigned.
+ *
+ * 2004.08.30(thutt):
+ * The vmcore/asm64/gen* programs are compiled as 32-bit
+ * applications, but must handle 64 bit constants. If the
+ * 64-bit-constant defining macros are already defined, the
+ * definition will not be overwritten.
+ */
+
+#if !defined(CONST64) || !defined(CONST64U)
+#ifdef _MSC_VER
+#define CONST64(c) c##I64
+#define CONST64U(c) c##uI64
+#elif defined __APPLE__
+#define CONST64(c) c##LL
+#define CONST64U(c) c##uLL
+#elif defined(__GNUC__) || defined(__SUNPRO_C)
+#ifdef VM_X86_64
+#define CONST64(c) c##L
+#define CONST64U(c) c##uL
+#else
+#define CONST64(c) c##LL
+#define CONST64U(c) c##uLL
+#endif
+#else
+#error - Need compiler define for CONST64
+#endif
+#endif
+
+/*
+ * Use CONST3264/CONST3264U if you want a constant to be
+ * treated as a 32-bit number on 32-bit compiles and
+ * a 64-bit number on 64-bit compiles. Useful in the case
+ * of shifts, like (CONST3264U(1) << x), where x could be
+ * more than 31 on a 64-bit compile.
+ */
+
+#ifdef VM_X86_64
+ #define CONST3264(a) CONST64(a)
+ #define CONST3264U(a) CONST64U(a)
+#else
+ #define CONST3264(a) (a)
+ #define CONST3264U(a) (a)
+#endif
+
+#define MIN_INT8 ((int8)0x80)
+#define MAX_INT8 ((int8)0x7f)
+
+#define MIN_UINT8 ((uint8)0)
+#define MAX_UINT8 ((uint8)0xff)
+
+#define MIN_INT16 ((int16)0x8000)
+#define MAX_INT16 ((int16)0x7fff)
+
+#define MIN_UINT16 ((uint16)0)
+#define MAX_UINT16 ((uint16)0xffff)
+
+#define MIN_INT32 ((int32)0x80000000)
+#define MAX_INT32 ((int32)0x7fffffff)
+
+#define MIN_UINT32 ((uint32)0)
+#define MAX_UINT32 ((uint32)0xffffffff)
+
+#define MIN_INT64 (CONST64(0x8000000000000000))
+#define MAX_INT64 (CONST64(0x7fffffffffffffff))
+
+#define MIN_UINT64 (CONST64U(0))
+#define MAX_UINT64 (CONST64U(0xffffffffffffffff))
+
+typedef uint8 *TCA; /* Pointer into TC (usually). */
+
+/*
+ * Type big enough to hold an integer between 0..100
+ */
+typedef uint8 Percent;
+#define AsPercent(v) ((Percent)(v))
+#define CHOOSE_PERCENT AsPercent(101)
+
+
+typedef uintptr_t VA;
+typedef uintptr_t VPN;
+
+typedef uint64 PA;
+typedef uint32 PPN;
+
+typedef uint64 PhysMemOff;
+typedef uint64 PhysMemSize;
+
+/* The Xserver source compiles with -ansi -pendantic */
+#ifndef __STRICT_ANSI__
+typedef uint64 BA;
+#endif
+typedef uint32 BPN;
+typedef uint32 PageNum;
+typedef unsigned MemHandle;
+typedef int32 World_ID;
+
+/* !! do not alter the definition of INVALID_WORLD_ID without ensuring
+ * that the values defined in both bora/public/vm_basic_types.h and
+ * lib/vprobe/vm_basic_types.h are the same. Additionally, the definition
+ * of VMK_INVALID_WORLD_ID in vmkapi_world.h also must be defined with
+ * the same value
+ */
+
+#define INVALID_WORLD_ID ((World_ID)0)
+
+typedef World_ID User_CartelID;
+#define INVALID_CARTEL_ID INVALID_WORLD_ID
+
+typedef User_CartelID User_SessionID;
+#define INVALID_SESSION_ID INVALID_CARTEL_ID
+
+typedef User_CartelID User_CartelGroupID;
+#define INVALID_CARTELGROUP_ID INVALID_CARTEL_ID
+
+typedef uint32 Worldlet_ID;
+#define INVALID_WORLDLET_ID ((Worldlet_ID)-1)
+
+/* The Xserver source compiles with -ansi -pendantic */
+#ifndef __STRICT_ANSI__
+typedef uint64 MA;
+typedef uint32 MPN;
+#endif
+
+/*
+ * This type should be used for variables that contain sector
+ * position/quantity.
+ */
+typedef uint64 SectorType;
+
+/*
+ * Linear address
+ */
+
+typedef uintptr_t LA;
+typedef uintptr_t LPN;
+#define LA_2_LPN(_la) ((_la) >> PAGE_SHIFT)
+#define LPN_2_LA(_lpn) ((_lpn) << PAGE_SHIFT)
+
+#define LAST_LPN ((((LA) 1) << (8 * sizeof(LA) - PAGE_SHIFT)) - 1)
+#define LAST_LPN32 ((((LA32)1) << (8 * sizeof(LA32) - PAGE_SHIFT)) - 1)
+#define LAST_LPN64 ((((LA64)1) << (8 * sizeof(LA64) - PAGE_SHIFT)) - 1)
+
+/* Valid bits in a LPN. */
+#define LPN_MASK LAST_LPN
+#define LPN_MASK32 LAST_LPN32
+#define LPN_MASK64 LAST_LPN64
+
+/*
+ * On 64 bit platform, address and page number types default
+ * to 64 bit. When we need to represent a 32 bit address, we use
+ * types defined below.
+ *
+ * On 32 bit platform, the following types are the same as the
+ * default types.
+ */
+typedef uint32 VA32;
+typedef uint32 VPN32;
+typedef uint32 LA32;
+typedef uint32 LPN32;
+typedef uint32 PA32;
+typedef uint32 PPN32;
+typedef uint32 MA32;
+typedef uint32 MPN32;
+
+/*
+ * On 64 bit platform, the following types are the same as the
+ * default types.
+ */
+typedef uint64 VA64;
+typedef uint64 VPN64;
+typedef uint64 LA64;
+typedef uint64 LPN64;
+typedef uint64 PA64;
+typedef uint64 PPN64;
+typedef uint64 MA64;
+typedef uint64 MPN64;
+
+/*
+ * VA typedefs for user world apps.
+ */
+typedef VA32 UserVA32;
+typedef VA64 UserVA64;
+typedef UserVA64 UserVAConst; /* Userspace ptr to data that we may only read. */
+typedef UserVA32 UserVA32Const; /* Userspace ptr to data that we may only read. */
+typedef UserVA64 UserVA64Const; /* Used by 64-bit syscalls until conversion is finished. */
+#ifdef VMKERNEL
+typedef UserVA64 UserVA;
+#else
+typedef void * UserVA;
+#endif
+
+
+/*
+ * Maximal possible PPN value (errors too) that PhysMem can handle.
+ * Must be at least as large as MAX_PPN which is the maximum PPN
+ * for any region other than buserror.
+ */
+#define PHYSMEM_MAX_PPN ((PPN)0xffffffff)
+#define MAX_PPN ((PPN)0x1fffffff) /* Maximal observable PPN value. */
+#define INVALID_PPN ((PPN)0xffffffff)
+
+#define INVALID_BPN ((BPN)0x1fffffff)
+
+#define RESERVED_MPN ((MPN) 0)
+#define INVALID_MPN ((MPN)-1)
+#define MEMREF_MPN ((MPN)-2)
+#define RELEASED_MPN ((MPN)-3)
+#define MAX_MPN ((MPN)0x7fffffff) /* 43 bits of address space. */
+
+#define INVALID_LPN ((LPN)-1)
+#define INVALID_VPN ((VPN)-1)
+#define INVALID_LPN64 ((LPN64)-1)
+#define INVALID_PAGENUM ((PageNum)-1)
+
+
+/*
+ * Format modifier for printing VA, LA, and VPN.
+ * Use them like this: Log("%#"FMTLA"x\n", laddr)
+ */
+
+#if defined(VMM) || defined(FROBOS64) || vm_x86_64 || defined __APPLE__
+# define FMTLA "l"
+# define FMTVA "l"
+# define FMTVPN "l"
+#else
+# define FMTLA ""
+# define FMTVA ""
+# define FMTVPN ""
+#endif
+
+#ifndef EXTERN
+#define EXTERN extern
+#endif
+#define CONST const
+
+
+#ifndef INLINE
+# ifdef _MSC_VER
+# define INLINE __inline
+# else
+# define INLINE inline
+# endif
+#endif
+
+
+/*
+ * Annotation for data that may be exported into a DLL and used by other
+ * apps that load that DLL and import the data.
+ */
+#if defined(_WIN32) && defined(VMX86_IMPORT_DLLDATA)
+# define VMX86_EXTERN_DATA extern __declspec(dllimport)
+#else // !_WIN32
+# define VMX86_EXTERN_DATA extern
+#endif
+
+#if defined(_WIN32) && !defined(VMX86_NO_THREADS)
+#define THREADSPECIFIC __declspec(thread)
+#else
+#define THREADSPECIFIC
+#endif
+
+/*
+ * Due to the wonderful "registry redirection" feature introduced in
+ * 64-bit Windows, if you access any key under HKLM\Software in 64-bit
+ * code, you need to open/create/delete that key with
+ * VMKEY_WOW64_32KEY if you want a consistent view with 32-bit code.
+ */
+
+#ifdef _WIN32
+#ifdef _WIN64
+#define VMW_KEY_WOW64_32KEY KEY_WOW64_32KEY
+#else
+#define VMW_KEY_WOW64_32KEY 0x0
+#endif
+#endif
+
+
+/*
+ * Consider the following reasons functions are inlined:
+ *
+ * 1) inlined for performance reasons
+ * 2) inlined because it's a single-use function
+ *
+ * Functions which meet only condition 2 should be marked with this
+ * inline macro; It is not critical to be inlined (but there is a
+ * code-space & runtime savings by doing so), so when other callers
+ * are added the inline-ness should be removed.
+ */
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
+/*
+ * Starting at version 3.3, gcc does not always inline functions marked
+ * 'inline' (it depends on their size). To force gcc to do so, one must use the
+ * extra __always_inline__ attribute.
+ */
+# define INLINE_SINGLE_CALLER INLINE __attribute__((__always_inline__))
+#else
+# define INLINE_SINGLE_CALLER INLINE
+#endif
+
+/*
+ * Used when a hard guaranteed of no inlining is needed. Very few
+ * instances need this since the absence of INLINE is a good hint
+ * that gcc will not do inlining.
+ */
+
+#if defined(__GNUC__) && defined(VMM)
+#define ABSOLUTELY_NOINLINE __attribute__((__noinline__))
+#endif
+
+/*
+ * Attributes placed on function declarations to tell the compiler
+ * that the function never returns.
+ */
+
+#ifdef _MSC_VER
+#define NORETURN __declspec(noreturn)
+#elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 9)
+#define NORETURN __attribute__((__noreturn__))
+#else
+#define NORETURN
+#endif
+
+/*
+ * GCC 3.2 inline asm needs the + constraint for input/ouput memory operands.
+ * Older GCCs don't know about it --hpreg
+ */
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
+# define VM_ASM_PLUS 1
+#else
+# define VM_ASM_PLUS 0
+#endif
+
+/*
+ * Branch prediction hints:
+ * LIKELY(exp) - Expression exp is likely TRUE.
+ * UNLIKELY(exp) - Expression exp is likely FALSE.
+ * Usage example:
+ * if (LIKELY(excCode == EXC_NONE)) {
+ * or
+ * if (UNLIKELY(REAL_MODE(vc))) {
+ *
+ * We know how to predict branches on gcc3 and later (hopefully),
+ * all others we don't so we do nothing.
+ */
+
+#if (__GNUC__ >= 3)
+/*
+ * gcc3 uses __builtin_expect() to inform the compiler of an expected value.
+ * We use this to inform the static branch predictor. The '!!' in LIKELY
+ * will convert any !=0 to a 1.
+ */
+#define LIKELY(_exp) __builtin_expect(!!(_exp), 1)
+#define UNLIKELY(_exp) __builtin_expect((_exp), 0)
+#else
+#define LIKELY(_exp) (_exp)
+#define UNLIKELY(_exp) (_exp)
+#endif
+
+/*
+ * GCC's argument checking for printf-like functions
+ * This is conditional until we have replaced all `"%x", void *'
+ * with `"0x%08x", (uint32) void *'. Note that %p prints different things
+ * on different platforms. Argument checking is enabled for the
+ * vmkernel, which has already been cleansed.
+ *
+ * fmtPos is the position of the format string argument, beginning at 1
+ * varPos is the position of the variable argument, beginning at 1
+ */
+
+#if defined(__GNUC__)
+# define PRINTF_DECL(fmtPos, varPos) __attribute__((__format__(__printf__, fmtPos, varPos)))
+#else
+# define PRINTF_DECL(fmtPos, varPos)
+#endif
+
+#if defined(__GNUC__)
+# define SCANF_DECL(fmtPos, varPos) __attribute__((__format__(__scanf__, fmtPos, varPos)))
+#else
+# define SCANF_DECL(fmtPos, varPos)
+#endif
+
+/*
+ * UNUSED_PARAM should surround the parameter name and type declaration,
+ * e.g. "int MyFunction(int var1, UNUSED_PARAM(int var2))"
+ *
+ */
+
+#ifndef UNUSED_PARAM
+# if defined(__GNUC__)
+# define UNUSED_PARAM(_parm) _parm __attribute__((__unused__))
+# else
+# define UNUSED_PARAM(_parm) _parm
+# endif
+#endif
+
+/*
+ * REGPARM defaults to REGPARM3; i.e., a request that gcc
+ * put the first three arguments in registers. (It is fine
+ * if the function has fewer than three arguments.) Gcc only.
+ * Syntactically, put REGPARM where you'd put INLINE or NORETURN.
+ *
+ * Note that 64-bit code already puts the first six arguments in
+ * registers, so these attributes are only useful for 32-bit code.
+ */
+
+#if defined(__GNUC__)
+# define REGPARM0 __attribute__((regparm(0)))
+# define REGPARM1 __attribute__((regparm(1)))
+# define REGPARM2 __attribute__((regparm(2)))
+# define REGPARM3 __attribute__((regparm(3)))
+# define REGPARM REGPARM3
+#else
+# define REGPARM0
+# define REGPARM1
+# define REGPARM2
+# define REGPARM3
+# define REGPARM
+#endif
+
+/*
+ * ALIGNED specifies minimum alignment in "n" bytes.
+ */
+
+#ifdef __GNUC__
+#define ALIGNED(n) __attribute__((__aligned__(n)))
+#else
+#define ALIGNED(n)
+#endif
+
+/*
+ * __func__ is a stringified function name that is part of the C99 standard. The block
+ * below defines __func__ on older systems where the compiler does not support that
+ * macro.
+ */
+#if defined(__GNUC__) \
+ && ((__GNUC__ == 2 && __GNUC_MINOR < 96) \
+ || (__GNUC__ < 2))
+# define __func__ __FUNCTION__
+#endif
+
+/*
+ * Once upon a time, this was used to silence compiler warnings that
+ * get generated when the compiler thinks that a function returns
+ * when it is marked noreturn. Don't do it. Use NOT_REACHED().
+ */
+
+#define INFINITE_LOOP() do { } while (1)
+
+/*
+ * On FreeBSD (for the tools build), size_t is typedef'd if _BSD_SIZE_T_
+ * is defined. Use the same logic here so we don't define it twice. [greg]
+ */
+#ifdef __FreeBSD__
+# ifdef _BSD_SIZE_T_
+# undef _BSD_SIZE_T_
+# ifdef VM_I386
+# ifdef VM_X86_64
+ typedef uint64 size_t;
+# else
+ typedef uint32 size_t;
+# endif
+# endif /* VM_I386 */
+# endif
+
+# ifdef _BSD_SSIZE_T_
+# undef _BSD_SSIZE_T_
+# ifdef VM_I386
+# ifdef VM_X86_64
+ typedef int64 ssize_t;
+# else
+ typedef int32 ssize_t;
+# endif
+# endif /* VM_I386 */
+# endif
+
+#else
+# ifndef _SIZE_T
+# ifdef VM_I386
+# define _SIZE_T
+# ifdef VM_X86_64
+ typedef uint64 size_t;
+# else
+ typedef uint32 size_t;
+# endif
+# elif defined(__arm__)
+# define _SIZE_T
+ typedef uint32 size_t;
+# endif
+# endif
+
+# if !defined(FROBOS) && !defined(_SSIZE_T) && !defined(_SSIZE_T_) && \
+ !defined(ssize_t) && !defined(__ssize_t_defined) && \
+ !defined(_SSIZE_T_DECLARED)
+# ifdef VM_I386
+# define _SSIZE_T
+# define __ssize_t_defined
+# define _SSIZE_T_DECLARED
+# ifdef VM_X86_64
+ typedef int64 ssize_t;
+# else
+ typedef int32 ssize_t;
+# endif
+# elif defined(__arm__)
+# define _SSIZE_T
+# define __ssize_t_defined
+# define _SSIZE_T_DECLARED
+ typedef int32 ssize_t;
+# endif
+# endif
+
+#endif
+
+/*
+ * Format modifier for printing pid_t. On sun the pid_t is a ulong, but on
+ * Linux it's an int.
+ * Use this like this: printf("The pid is %"FMTPID".\n", pid);
+ */
+#ifdef sun
+# ifdef VM_X86_64
+# define FMTPID "d"
+# else
+# define FMTPID "lu"
+# endif
+#else
+# define FMTPID "d"
+#endif
+
+/*
+ * Format modifier for printing uid_t. On Solaris 10 and earlier, uid_t
+ * is a ulong, but on other platforms it's an unsigned int.
+ * Use this like this: printf("The uid is %"FMTUID".\n", uid);
+ */
+#if defined(sun) && !defined(SOL11)
+# ifdef VM_X86_64
+# define FMTUID "u"
+# else
+# define FMTUID "lu"
+# endif
+#else
+# define FMTUID "u"
+#endif
+
+/*
+ * Format modifier for printing mode_t. On sun the mode_t is a ulong, but on
+ * Linux it's an int.
+ * Use this like this: printf("The mode is %"FMTMODE".\n", mode);
+ */
+#ifdef sun
+# ifdef VM_X86_64
+# define FMTMODE "o"
+# else
+# define FMTMODE "lo"
+# endif
+#else
+# define FMTMODE "o"
+#endif
+
+/*
+ * Format modifier for printing time_t. Most platforms define a time_t to be
+ * a long int, but on FreeBSD (as of 5.0, it seems), the time_t is a signed
+ * size quantity. Refer to the definition of FMTSZ to see why we need silly
+ * preprocessor arithmetic.
+ * Use this like this: printf("The mode is %"FMTTIME".\n", time);
+ */
+#if defined(__FreeBSD__) && (__FreeBSD__ + 0) && ((__FreeBSD__ + 0) >= 5)
+# define FMTTIME FMTSZ"d"
+#else
+# if defined(_MSC_VER)
+# ifndef _SAFETIME_H_
+# if (_MSC_VER < 1400) || defined(_USE_32BIT_TIME_T)
+# define FMTTIME "ld"
+# else
+# define FMTTIME FMT64"d"
+# endif
+# else
+# ifndef FMTTIME
+# error "safetime.h did not define FMTTIME"
+# endif
+# endif
+# else
+# define FMTTIME "ld"
+# endif
+#endif
+
+#ifdef __APPLE__
+/*
+ * Format specifier for all these annoying types such as {S,U}Int32
+ * which are 'long' in 32-bit builds
+ * and 'int' in 64-bit builds.
+ */
+# ifdef __LP64__
+# define FMTLI ""
+# else
+# define FMTLI "l"
+# endif
+
+/*
+ * Format specifier for all these annoying types such as NS[U]Integer
+ * which are 'int' in 32-bit builds
+ * and 'long' in 64-bit builds.
+ */
+# ifdef __LP64__
+# define FMTIL "l"
+# else
+# define FMTIL ""
+# endif
+#endif
+
+
+/*
+ * Define MXSemaHandle here so both vmmon and vmx see this definition.
+ */
+
+#ifdef _WIN32
+typedef uintptr_t MXSemaHandle;
+#else
+typedef int MXSemaHandle;
+#endif
+
+/*
+ * Define type for poll device handles.
+ */
+
+typedef int64 PollDevHandle;
+
+/*
+ * Define the utf16_t type.
+ */
+
+#if defined(_WIN32) && defined(_NATIVE_WCHAR_T_DEFINED)
+typedef wchar_t utf16_t;
+#else
+typedef uint16 utf16_t;
+#endif
+
+/*
+ * Define for point and rectangle types. Defined here so they
+ * can be used by other externally facing headers in bora/public.
+ */
+
+typedef struct VMPoint {
+ int x, y;
+} VMPoint;
+
+#if defined _WIN32 && defined USERLEVEL
+struct tagRECT;
+typedef struct tagRECT VMRect;
+#else
+typedef struct VMRect {
+ int left;
+ int top;
+ int right;
+ int bottom;
+} VMRect;
+#endif
+
+/*
+ * ranked locks "everywhere"
+ */
+
+typedef uint32 MX_Rank;
+
+#endif /* _VM_BASIC_TYPES_H_ */
diff --git a/usr/src/uts/intel/io/vmxnet/vm_device_version.h b/usr/src/uts/intel/io/vmxnet/vm_device_version.h
new file mode 100644
index 0000000000..7046594a6c
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/vm_device_version.h
@@ -0,0 +1,246 @@
+/*********************************************************
+ * Copyright (C) 1998 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+#ifndef VM_DEVICE_VERSION_H
+#define VM_DEVICE_VERSION_H
+
+#define INCLUDE_ALLOW_USERLEVEL
+
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#define INCLUDE_ALLOW_VMCORE
+#include "includeCheck.h"
+
+#ifdef _WIN32
+#ifdef __MINGW32__
+#include "initguid.h"
+#else
+#include "guiddef.h"
+#endif
+#endif
+
+/* LSILogic 53C1030 Parallel SCSI controller
+ * LSILogic SAS1068 SAS controller
+ */
+#define PCI_VENDOR_ID_LSILOGIC 0x1000
+#define PCI_DEVICE_ID_LSI53C1030 0x0030
+#define PCI_DEVICE_ID_LSISAS1068 0x0054
+
+/* Our own PCI IDs
+ * VMware SVGA II (Unified VGA)
+ * VMware SVGA (PCI Accelerator)
+ * VMware vmxnet (Idealized NIC)
+ * VMware vmxscsi (Abortive idealized SCSI controller)
+ * VMware chipset (Subsystem ID for our motherboards)
+ * VMware e1000 (Subsystem ID)
+ * VMware vmxnet3 (Uniform Pass Through NIC)
+ * VMware HD Audio codec
+ * VMware HD Audio controller
+ */
+#define PCI_VENDOR_ID_VMWARE 0x15AD
+#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
+#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
+#define PCI_DEVICE_ID_VMWARE_NET 0x0720
+#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730
+#define PCI_DEVICE_ID_VMWARE_VMCI 0x0740
+#define PCI_DEVICE_ID_VMWARE_CHIPSET 0x1976
+#define PCI_DEVICE_ID_VMWARE_82545EM 0x0750 /* single port */
+#define PCI_DEVICE_ID_VMWARE_82546EB 0x0760 /* dual port */
+#define PCI_DEVICE_ID_VMWARE_EHCI 0x0770
+#define PCI_DEVICE_ID_VMWARE_UHCI 0x0774
+#define PCI_DEVICE_ID_VMWARE_XHCI 0x0778
+#define PCI_DEVICE_ID_VMWARE_1394 0x0780
+#define PCI_DEVICE_ID_VMWARE_BRIDGE 0x0790
+#define PCI_DEVICE_ID_VMWARE_ROOTPORT 0x07A0
+#define PCI_DEVICE_ID_VMWARE_VMXNET3 0x07B0
+#define PCI_DEVICE_ID_VMWARE_VMXWIFI 0x07B8
+#define PCI_DEVICE_ID_VMWARE_PVSCSI 0x07C0
+#define PCI_DEVICE_ID_VMWARE_82574 0x07D0
+#define PCI_DEVICE_ID_VMWARE_HDAUDIO_CODEC 0x1975
+#define PCI_DEVICE_ID_VMWARE_HDAUDIO_CONTROLLER 0x1977
+
+/* The hypervisor device might grow. Please leave room
+ * for 7 more subfunctions.
+ */
+#define PCI_DEVICE_ID_VMWARE_HYPER 0x0800
+#define PCI_DEVICE_ID_VMWARE_VMI 0x0801
+
+#define PCI_DEVICE_VMI_CLASS 0x05
+#define PCI_DEVICE_VMI_SUBCLASS 0x80
+#define PCI_DEVICE_VMI_INTERFACE 0x00
+#define PCI_DEVICE_VMI_REVISION 0x01
+
+/* From linux/pci_ids.h:
+ * AMD Lance Ethernet controller
+ * BusLogic SCSI controller
+ * Ensoniq ES1371 sound controller
+ */
+#define PCI_VENDOR_ID_AMD 0x1022
+#define PCI_DEVICE_ID_AMD_VLANCE 0x2000
+#define PCI_VENDOR_ID_BUSLOGIC 0x104B
+#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
+#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040
+#define PCI_VENDOR_ID_ENSONIQ 0x1274
+#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371
+
+/* From linux/pci_ids.h:
+ * Intel 82439TX (430 HX North Bridge)
+ * Intel 82371AB (PIIX4 South Bridge)
+ * Intel 82443BX (440 BX North Bridge and AGP Bridge)
+ * Intel 82545EM (e1000, server adapter, single port)
+ * Intel 82546EB (e1000, server adapter, dual port)
+ * Intel HECI (as embedded in ich9m)
+ */
+#define PCI_VENDOR_ID_INTEL 0x8086
+#define PCI_DEVICE_ID_INTEL_82439TX 0x7100
+#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110
+#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112
+#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
+#define PCI_DEVICE_ID_INTEL_82371AB 0x7111
+#define PCI_DEVICE_ID_INTEL_82443BX 0x7190
+#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191
+#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 /* Used when no AGP support */
+#define PCI_DEVICE_ID_INTEL_82545EM 0x100f
+#define PCI_DEVICE_ID_INTEL_82546EB 0x1010
+#define PCI_DEVICE_ID_INTEL_82574 0x10d3
+#define PCI_DEVICE_ID_INTEL_82574_APPLE 0x10f6
+#define PCI_DEVICE_ID_INTEL_HECI 0x2a74
+
+#define E1000E_PCI_DEVICE_ID_CONFIG_STR "e1000e.pci.deviceID"
+#define E1000E_PCI_SUB_VENDOR_ID_CONFIG_STR "e1000e.pci.subVendorID"
+#define E1000E_PCI_SUB_DEVICE_ID_CONFIG_STR "e1000e.pci.subDeviceID"
+
+/*
+ * Intel HD Audio controller and Realtek ALC885 codec.
+ */
+#define PCI_DEVICE_ID_INTEL_631XESB_632XESB 0x269a
+#define PCI_VENDOR_ID_REALTEK 0x10ec
+#define PCI_DEVICE_ID_REALTEK_ALC885 0x0885
+
+
+/*
+ * Fresco Logic xHCI (USB 3.0) Controller
+ */
+#define PCI_VENDOR_ID_FRESCO 0x1B73
+#define PCI_DEVICE_ID_FRESCO_FL1000 0x1000 // Original 1-port chip
+#define PCI_DEVICE_ID_FRESCO_FL1009 0x1009 // New 2-port chip (Driver 3.0.98+)
+#define PCI_DEVICE_ID_FRESCO_FL1400 0x1400 // Unknown (4-port? Dev hardware?)
+
+/*
+ * NEC/Renesas xHCI (USB 3.0) Controller
+ */
+#define PCI_VENDOR_ID_NEC 0x1033
+#define PCI_DEVICE_ID_NEC_UPD720200 0x0194
+#define PCI_REVISION_NEC_UPD720200 0x03
+#define PCI_FIRMWARE_NEC_UPD720200 0x3015
+
+
+/************* Strings for IDE Identity Fields **************************/
+#define VIDE_ID_SERIAL_STR "00000000000000000001" /* Must be 20 Bytes */
+#define VIDE_ID_FIRMWARE_STR "00000001" /* Must be 8 Bytes */
+
+/* No longer than 40 Bytes */
+#define VIDE_ATA_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE Hard Drive"
+#define VIDE_ATAPI_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE CDROM Drive"
+
+#define ATAPI_VENDOR_ID "NECVMWar" /* Must be 8 Bytes */
+#define ATAPI_PRODUCT_ID PRODUCT_GENERIC_NAME " IDE CDROM" /* Must be 16 Bytes */
+#define ATAPI_REV_LEVEL "1.00" /* Must be 4 Bytes */
+
+#define IDE_NUM_INTERFACES 2 /* support for two interfaces */
+#define IDE_DRIVES_PER_IF 2
+
+/************* Strings for SCSI Identity Fields **************************/
+#define SCSI_DISK_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI Hard Drive"
+#define SCSI_DISK_VENDOR_NAME COMPANY_NAME
+#define SCSI_DISK_REV_LEVEL "1.0"
+#define SCSI_CDROM_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI CDROM Drive"
+#define SCSI_CDROM_VENDOR_NAME COMPANY_NAME
+#define SCSI_CDROM_REV_LEVEL "1.0"
+
+/************* SCSI implementation limits ********************************/
+#define SCSI_MAX_CONTROLLERS 4 // Need more than 1 for MSCS clustering
+#define SCSI_MAX_DEVICES 16 // BT-958 emulates only 16
+#define PVSCSI_MAX_DEVICES 255 // 255 (including the controller)
+/*
+ * VSCSI_BV_INTS is the number of uint32's needed for a bit vector
+ * to cover all scsi devices per target.
+ */
+#define VSCSI_BV_INTS CEILING(PVSCSI_MAX_DEVICES, 8 * sizeof (uint32))
+#define SCSI_IDE_CHANNEL SCSI_MAX_CONTROLLERS
+#define SCSI_IDE_HOSTED_CHANNEL (SCSI_MAX_CONTROLLERS + 1)
+#define SCSI_MAX_CHANNELS (SCSI_MAX_CONTROLLERS + 2)
+
+/************* Strings for the VESA BIOS Identity Fields *****************/
+#define VBE_OEM_STRING COMPANY_NAME " SVGA"
+#define VBE_VENDOR_NAME COMPANY_NAME
+#define VBE_PRODUCT_NAME PRODUCT_GENERIC_NAME
+
+/************* PCI implementation limits ********************************/
+#define PCI_MAX_BRIDGES 15
+
+/************* Ethernet implementation limits ***************************/
+#define MAX_ETHERNET_CARDS 10
+
+/********************** Floppy limits ***********************************/
+#define MAX_FLOPPY_DRIVES 2
+
+/************* PCI Passthrough implementation limits ********************/
+#define MAX_PCI_PASSTHRU_DEVICES 6
+
+/************* USB implementation limits ********************************/
+#define MAX_USB_DEVICES_PER_HOST_CONTROLLER 127
+
+/************* Strings for Host USB Driver *******************************/
+
+#ifdef _WIN32
+
+/*
+ * Globally unique ID for the VMware device interface. Define INITGUID before including
+ * this header file to instantiate the variable.
+ */
+DEFINE_GUID(GUID_DEVICE_INTERFACE_VMWARE_USB_DEVICES,
+0x2da1fe75, 0xaab3, 0x4d2c, 0xac, 0xdf, 0x39, 0x8, 0x8c, 0xad, 0xa6, 0x65);
+
+/*
+ * Globally unique ID for the VMware device setup class.
+ */
+DEFINE_GUID(GUID_CLASS_VMWARE_USB_DEVICES,
+0x3b3e62a5, 0x3556, 0x4d7e, 0xad, 0xad, 0xf5, 0xfa, 0x3a, 0x71, 0x2b, 0x56);
+
+/*
+ * This string defines the device ID string of a VMware USB device.
+ * The format is USB\Vid_XXXX&Pid_YYYY, where XXXX and YYYY are the
+ * hexadecimal representations of the vendor and product ids, respectively.
+ *
+ * The official vendor ID for VMware, Inc. is 0x0E0F.
+ * The product id for USB generic devices is 0x0001.
+ */
+#define USB_VMWARE_DEVICE_ID_WIDE L"USB\\Vid_0E0F&Pid_0001"
+#define USB_DEVICE_ID_LENGTH (sizeof(USB_VMWARE_DEVICE_ID_WIDE) / sizeof(WCHAR))
+
+#ifdef UNICODE
+#define USB_PNP_SETUP_CLASS_NAME L"VMwareUSBDevices"
+#define USB_PNP_DRIVER_NAME L"vmusb"
+#else
+#define USB_PNP_SETUP_CLASS_NAME "VMwareUSBDevices"
+#define USB_PNP_DRIVER_NAME "vmusb"
+#endif
+#endif
+
+#endif /* VM_DEVICE_VERSION_H */
diff --git a/usr/src/uts/intel/io/vmxnet/vmnet_def.h b/usr/src/uts/intel/io/vmxnet/vmnet_def.h
new file mode 100644
index 0000000000..6e44aea2bb
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/vmnet_def.h
@@ -0,0 +1,91 @@
+/*********************************************************
+ * Copyright (C) 2004 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *********************************************************/
+
+/*********************************************************
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version. You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+/*
+ * vmnet_def.h
+ *
+ * - definitions which are (mostly) not vmxnet or vlance specific
+ */
+
+#ifndef _VMNET_DEF_H_
+#define _VMNET_DEF_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_VMCORE
+
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMK_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#define INCLUDE_ALLOW_DISTRIBUTE
+#include "includeCheck.h"
+
+#define VMNET_NAME_BUFFER_LEN 128 /* Increased for i18n. */
+#define VMNET_COAL_SCHEME_NAME_LEN 16
+
+
+/*
+ * capabilities - not all of these are implemented in the virtual HW
+ * (eg VLAN support is in the virtual switch) so even vlance
+ * can use them
+ */
+#define VMNET_CAP_SG 0x0001 /* Can do scatter-gather transmits. */
+#define VMNET_CAP_IP4_CSUM 0x0002 /* Can checksum only TCP/UDP over IPv4. */
+#define VMNET_CAP_HW_CSUM 0x0004 /* Can checksum all packets. */
+#define VMNET_CAP_HIGH_DMA 0x0008 /* Can DMA to high memory. */
+#define VMNET_CAP_TOE 0x0010 /* Supports TCP/IP offload. */
+#define VMNET_CAP_TSO 0x0020 /* Supports TCP Segmentation offload */
+#define VMNET_CAP_SW_TSO 0x0040 /* Supports SW TCP Segmentation */
+#define VMNET_CAP_VMXNET_APROM 0x0080 /* Vmxnet APROM support */
+#define VMNET_CAP_HW_TX_VLAN 0x0100 /* Can we do VLAN tagging in HW */
+#define VMNET_CAP_HW_RX_VLAN 0x0200 /* Can we do VLAN untagging in HW */
+#define VMNET_CAP_SW_VLAN 0x0400 /* Can we do VLAN tagging/untagging in SW */
+#define VMNET_CAP_WAKE_PCKT_RCV 0x0800 /* Can wake on network packet recv? */
+#define VMNET_CAP_ENABLE_INT_INLINE 0x1000 /* Enable Interrupt Inline */
+#define VMNET_CAP_ENABLE_HEADER_COPY 0x2000 /* copy header for vmkernel */
+#define VMNET_CAP_TX_CHAIN 0x4000 /* Guest can use multiple tx entries for a pkt */
+#define VMNET_CAP_RX_CHAIN 0x8000 /* a pkt can span multiple rx entries */
+#define VMNET_CAP_LPD 0x10000 /* large pkt delivery */
+#define VMNET_CAP_BPF 0x20000 /* BPF Support in VMXNET Virtual Hardware */
+#define VMNET_CAP_SG_SPAN_PAGES 0x40000 /* Can do scatter-gather span multiple pages transmits. */
+#define VMNET_CAP_IP6_CSUM 0x80000 /* Can do IPv6 csum offload. */
+#define VMNET_CAP_TSO6 0x100000 /* Can do TSO segmentation offload for IPv6 pkts. */
+#define VMNET_CAP_TSO256k 0x200000 /* Can do TSO segmentation offload for pkts up to 256kB. */
+#define VMNET_CAP_UPT 0x400000 /* Support UPT */
+#define VMNET_CAP_RDONLY_INETHDRS 0x800000 /* Modifies inet headers for TSO/CSUm */
+#define VMNET_CAP_NPA 0x1000000 /* Support NPA */
+#define VMNET_CAP_DCB 0x2000000 /* Support DCB */
+#define VMNET_CAP_OFFLOAD_8OFFSET 0x4000000 /* supports 8bit parameterized offsets */
+#define VMNET_CAP_OFFLOAD_16OFFSET 0x8000000 /* supports 16bit parameterized offsets */
+#define VMNET_CAP_IP6_CSUM_EXT_HDRS 0x10000000 /* support csum of ip6 ext hdrs */
+#define VMNET_CAP_TSO6_EXT_HDRS 0x20000000 /* support TSO for ip6 ext hdrs */
+#define VMNET_CAP_SCHED 0x40000000 /* compliant with network scheduling */
+#endif // _VMNET_DEF_H_
diff --git a/usr/src/uts/intel/io/vmxnet/vmxnet.c b/usr/src/uts/intel/io/vmxnet/vmxnet.c
new file mode 100644
index 0000000000..e0046d8deb
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/vmxnet.c
@@ -0,0 +1,2438 @@
+/*********************************************************
+ * Copyright (C) 2004 VMware, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version. You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+#include <sys/types.h>
+#include <sys/conf.h>
+#include <sys/debug.h>
+#include <sys/stropts.h>
+#include <sys/stream.h>
+#include <sys/strlog.h>
+#include <sys/kmem.h>
+#include <sys/stat.h>
+#include <sys/kstat.h>
+#include <sys/vtrace.h>
+#include <sys/dlpi.h>
+#include <sys/strsun.h>
+#include <sys/ethernet.h>
+#include <sys/modctl.h>
+#include <sys/errno.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/ddi_impldefs.h>
+#include <sys/gld.h>
+#include <sys/pci.h>
+#include <sys/strsubr.h>
+
+/*
+ * This used to be defined in sys/gld.h, but was flagged as private,
+ * and we used it anyway. Now it no longer exists, and we're stuck
+ * with it for the time being.
+ */
+#ifndef GLD_MAX_MULTICAST
+#define GLD_MAX_MULTICAST 64
+#endif
+
+#define __intptr_t_defined
+#define _STDINT_H
+#include "vm_basic_types.h"
+#include "vmxnet2_def.h"
+#include "vm_device_version.h"
+#include "net.h"
+#include "buildNumber.h"
+
+#define SOLVMXNET_SUCCESS 1
+#define SOLVMXNET_FAILURE 0
+
+#ifdef SOLVMXNET_DEBUG_LEVEL
+static int vxn_debug = SOLVMXNET_DEBUG_LEVEL;
+#define DPRINTF(n, args) if (vxn_debug>(n)) cmn_err args
+#else
+#define DPRINTF(n, args)
+#endif
+
+static char ident[] = "VMware Ethernet Adapter b" BUILD_NUMBER_NUMERIC_STRING;
+char _depends_on[] = {"misc/gld"};
+
+#define MAX_NUM_RECV_BUFFERS 128
+#define DEFAULT_NUM_RECV_BUFFERS 100
+#define MAX_NUM_XMIT_BUFFERS 128
+#define DEFAULT_NUM_XMIT_BUFFERS 100
+#define CRC_POLYNOMIAL_LE 0xedb88320UL
+#define SOLVMXNET_MAXNAME 20
+#define MAX_TX_WAIT_ON_STOP 2000
+
+#define ETHERALIGN 2
+#define SLACKBYTES 4
+#define MAXPKTBUF (14 + ETHERALIGN + ETHERMTU + SLACKBYTES)
+
+
+#define QHIWATER (MAX_NUM_RECV_BUFFERS*ETHERMTU)
+
+#define OUTB(dp, p, v) \
+ ddi_put8((dp)->vxnIOHdl, \
+ (uint8_t *)((caddr_t)((dp)->vxnIOp) + (p)), v)
+#define OUTW(dp, p, v) \
+ ddi_put16((dp)->vxnIOHdl, \
+ (uint16_t *)((caddr_t)((dp)->vxnIOp) + (p)), v)
+#define OUTL(dp, p, v) \
+ ddi_put32((dp)->vxnIOHdl, \
+ (uint32_t *)((caddr_t)((dp)->vxnIOp) + (p)), v)
+#define INB(dp, p) \
+ ddi_get8((dp)->vxnIOHdl, \
+ (uint8_t *)(((caddr_t)(dp)->vxnIOp) + (p)))
+#define INW(dp, p) \
+ ddi_get16((dp)->vxnIOHdl, \
+ (uint16_t *)(((caddr_t)(dp)->vxnIOp) + (p)))
+#define INL(dp, p) \
+ ddi_get32((dp)->vxnIOHdl, \
+ (uint32_t *)(((caddr_t)(dp)->vxnIOp) + (p)))
+
+#define VMXNET_INC(val, max) \
+ val++; \
+ if (UNLIKELY(val == max)) { \
+ val = 0; \
+ }
+
+#define TX_RINGBUF_MBLK(dp, idx) (dp->txRingBuf[idx].mblk)
+#define TX_RINGBUF_DMAMEM(dp, idx) (dp->txRingBuf[idx].dmaMem)
+
+typedef struct {
+ caddr_t buf; /* Virtual address */
+ uint32_t phyBuf; /* Physical address */
+ size_t bufLen; /* Buffer length */
+ ddi_dma_cookie_t cookie; /* Dma cookie */
+ uint_t cookieCount; /* Cookie count */
+ ddi_dma_handle_t dmaHdl; /* Dma handle */
+ ddi_acc_handle_t dataAccHdl; /* Dada access handle */
+} dma_buf_t;
+
+typedef struct rx_dma_buf {
+ dma_buf_t dmaDesc; /* Dma descriptor */
+ mblk_t *mblk; /* Streams message block */
+ frtn_t freeCB; /* Free callback */
+ struct vxn_softc *softc; /* Back pointer to softc */
+ struct rx_dma_buf *next; /* Next one in list */
+} rx_dma_buf_t;
+
+typedef struct vxn_stats {
+ uint32_t errxmt; /* Transmit errors */
+ uint32_t errrcv; /* Receive errors */
+ uint32_t runt; /* Runt packets */
+ uint32_t norcvbuf; /* Buffer alloc errors */
+ uint32_t interrupts; /* Interrupts */
+ uint32_t defer; /* Deferred transmits */
+} vxn_stats_t;
+
+typedef struct tx_ring_buf {
+ mblk_t *mblk;
+ dma_buf_t dmaMem;
+} tx_ring_buf_t;
+
+typedef struct vxn_softc {
+ char drvName[SOLVMXNET_MAXNAME]; /* Driver name string */
+ int unit; /* Driver instance */
+ vxn_stats_t stats; /* Stats */
+
+ dev_info_t *dip; /* Info pointer */
+ ddi_iblock_cookie_t iblockCookie; /* Interrupt block cookie */
+ gld_mac_info_t *macInfo; /* GLD mac info */
+ ddi_acc_handle_t confHdl; /* Configuration space handle */
+ ddi_acc_handle_t vxnIOHdl; /* I/O space handle */
+ caddr_t vxnIOp; /* I/O space pointer */
+ boolean_t morphed; /* Adapter morphed ? */
+
+ kmutex_t intrlock; /* Interrupt lock */
+ kmutex_t xmitlock; /* Transmit lock */
+ kmutex_t rxlistlock; /* Rx free pool lock */
+
+ boolean_t nicActive; /* NIC active flag */
+ boolean_t inIntr; /* Interrupt processing flag */
+
+ struct ether_addr devAddr; /* MAC address */
+
+ uint32_t vxnNumRxBufs; /* Number of reveice buffers */
+ uint32_t vxnNumTxBufs; /* Number of transmit buffers */
+
+ dma_buf_t driverDataDmaMem; /* Driver Data (dma handle) */
+ Vmxnet2_DriverData *driverData; /* Driver Data */
+ void *driverDataPhy; /* Driver Data busaddr pointer */
+ Vmxnet2_RxRingEntry *rxRing; /* Receive ring */
+ Vmxnet2_TxRingEntry *txRing; /* Transmit ring */
+ ddi_dma_handle_t txDmaHdl; /* Tx buffers dma handle */
+ rx_dma_buf_t *rxRingBuffPtr[MAX_NUM_RECV_BUFFERS];
+ /* DMA buffers associated with rxRing */
+ tx_ring_buf_t txRingBuf[MAX_NUM_XMIT_BUFFERS]; /* tx Ring buffers */
+
+ rx_dma_buf_t *rxFreeBufList;
+ uint32_t rxNumFreeBufs; /* current # of buffers in pool */
+ uint32_t rxMaxFreeBufs; /* max # of buffers in pool */
+
+ uint32_t txPending; /* Pending transmits */
+ uint32_t maxTxFrags; /* Max Tx fragments */
+
+ int multiCount; /* Multicast address count */
+ struct ether_addr multicastList[GLD_MAX_MULTICAST]; /* Multicast list */
+
+ struct vxn_softc *next; /* Circular list of instances */
+ struct vxn_softc *prev;
+} vxn_softc_t;
+
+/* used for rx buffers or buffers allocated by ddi_dma_mem_alloc() */
+static ddi_dma_attr_t vxn_dma_attrs = {
+ DMA_ATTR_V0, /* dma_attr version */
+ 0, /* dma_attr_addr_lo */
+ (uint64_t)0xFFFFFFFF, /* dma_attr_addr_hi */
+ 0x7FFFFFFF, /* dma_attr_count_max */
+ 4, /* dma_attr_align */
+ 0x3F, /* dma_attr_burstsizes */
+ 1, /* dma_attr_minxfer */
+ (uint64_t)0xFFFFFFFF, /* dma_attr_maxxfer */
+ (uint64_t)0xFFFFFFFF, /* dma_attr_seg */
+ 1, /* dma_attr_sgllen */
+ 1, /* dma_attr_granular */
+ 0, /* dma_attr_flags */
+};
+
+/* used for tx buffers */
+static ddi_dma_attr_t vxn_dma_attrs_tx = {
+ DMA_ATTR_V0, /* dma_attr version */
+ 0, /* dma_attr_addr_lo */
+ (uint64_t)0xFFFFFFFF, /* dma_attr_addr_hi */
+ 0x7FFFFFFF, /* dma_attr_count_max */
+ 1, /* dma_attr_align */
+ 0x3F, /* dma_attr_burstsizes */
+ 1, /* dma_attr_minxfer */
+ (uint64_t)0xFFFFFFFF, /* dma_attr_maxxfer */
+ (uint64_t)0xFFFFFFFF, /* dma_attr_seg */
+ 1, /* dma_attr_sgllen */
+ 1, /* dma_attr_granular */
+ 0, /* dma_attr_flags */
+};
+
+
+static struct ether_addr etherbroadcastaddr = {
+ {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
+};
+
+static struct ddi_device_acc_attr vxn_buf_attrs = {
+ DDI_DEVICE_ATTR_V0,
+ DDI_STRUCTURE_LE_ACC,
+ DDI_STRICTORDER_ACC
+};
+
+static struct ddi_device_acc_attr dev_attr = {
+ DDI_DEVICE_ATTR_V0,
+ DDI_STRUCTURE_LE_ACC,
+ DDI_STRICTORDER_ACC
+};
+
+static vxn_softc_t vxnList; /* for debugging */
+static kmutex_t vxnListLock;
+
+static void *Vxn_Memset(void *s, int c, size_t n);
+static int Vxn_Reset(gld_mac_info_t *macInfo);
+static int Vxn_SetPromiscuous(gld_mac_info_t *macInfo, int flag);
+static int Vxn_GetStats(gld_mac_info_t *macInfo, struct gld_stats *gs);
+static void Vxn_ApplyAddressFilter(vxn_softc_t *dp);
+static int Vxn_SetMulticast(gld_mac_info_t *macinfo, uint8_t *ep, int flag);
+static int Vxn_SetMacAddress(gld_mac_info_t *macInfo, uint8_t *mac);
+static int Vxn_Start(gld_mac_info_t *macInfo);
+static int Vxn_Stop(gld_mac_info_t *macInfo);
+static void Vxn_FreeTxBuf(vxn_softc_t *dp, int idx);
+static int Vxn_EncapTxBuf(vxn_softc_t *dp, mblk_t *mp, Vmxnet2_TxRingEntry *xre,
+ tx_ring_buf_t *txBuf);
+static int Vxn_Send(gld_mac_info_t *macinfo, mblk_t *mp);
+static boolean_t Vxn_TxComplete(vxn_softc_t *dp, boolean_t *reschedp);
+static boolean_t Vxn_Receive(vxn_softc_t *dp);
+static u_int Vxn_Interrupt(gld_mac_info_t *macInfo);
+static void Vxn_ReclaimRxBuf(rx_dma_buf_t *rxDesc);
+static void Vxn_FreeRxBuf(rx_dma_buf_t *rxDesc);
+static rx_dma_buf_t *Vxn_AllocRxBuf(vxn_softc_t *dp, int cansleep);
+static void Vxn_FreeInitBuffers(vxn_softc_t *dp);
+static int Vxn_AllocInitBuffers(vxn_softc_t *dp);
+static void Vxn_FreeDmaMem(dma_buf_t *dma);
+static int Vxn_AllocDmaMem(vxn_softc_t *dp, int size, int cansleep, dma_buf_t *dma);
+static void Vxn_FreeDriverData(vxn_softc_t *dp);
+static int Vxn_AllocDriverData(vxn_softc_t *dp);
+static int Vxn_Attach(dev_info_t *dip, ddi_attach_cmd_t cmd);
+static int Vxn_Detach(dev_info_t *dip, ddi_detach_cmd_t cmd);
+static int Vxn_AllocRxBufPool(vxn_softc_t *dp);
+static void Vxn_FreeRxBufPool(vxn_softc_t *dp);
+static rx_dma_buf_t * Vxn_AllocRxBufFromPool(vxn_softc_t *dp);
+static void Vxn_FreeRxBufToPool(rx_dma_buf_t *rxDesc);
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Memset --
+ * memset() (Because bzero does not get resolved by module loader)
+ *
+ * Results:
+ * pointer to the memory area s
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void *
+Vxn_Memset(void *s, int c, size_t n)
+{
+ while (n--) {
+ ((uint8_t *)s)[n] = c;
+ }
+
+ return s;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Reset --
+ * Stub routine to reset hardware. Presently does nothing. Start/Stop should
+ * take care of resets.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_Reset(gld_mac_info_t *macInfo)
+{
+ return GLD_SUCCESS;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_SetPromiscuous --
+ * Set/Reset NIC to/from promiscuous mode
+ *
+ * Results:
+ * GLD_SUCCESS
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_SetPromiscuous(gld_mac_info_t *macInfo, int flag)
+{
+ vxn_softc_t *dp = (vxn_softc_t *)macInfo->gldm_private;
+ Vmxnet2_DriverData *dd = dp->driverData;
+
+ mutex_enter(&dp->intrlock);
+ if (flag == GLD_MAC_PROMISC_PHYS) {
+ dd->ifflags |= VMXNET_IFF_PROMISC;
+ } else if (flag == GLD_MAC_PROMISC_MULTI) {
+ /*
+ * This should really set VMXNET_IFF_ALLMULTI,
+ * but unfortunately it doesn't exist. The next
+ * best thing would be to set the LADRFs to all
+ * 0xFFs and set VMXNET_IFF_MULTICAST, but that
+ * opens up a whole new set of potential pitfalls,
+ * so this is a reasonable temporary solution.
+ */
+ dd->ifflags |= VMXNET_IFF_PROMISC;
+ } else if (flag == GLD_MAC_PROMISC_NONE) {
+ dd->ifflags &= ~VMXNET_IFF_PROMISC;
+ } else {
+ /* This could be GLD_MAC_PROMISC_NOOP? */
+ mutex_exit(&dp->intrlock);
+ cmn_err(CE_WARN, "%s%d: Vxn_SetPromiscuous: Unexpected mode flag: 0x%x",
+ dp->drvName, dp->unit, flag);
+
+ return GLD_FAILURE;
+ }
+
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_UPDATE_IFF);
+ mutex_exit(&dp->intrlock);
+
+ return GLD_SUCCESS;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_GetStats --
+ * Get driver specific stats
+ *
+ * Results:
+ * GLD_SUCCESS
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_GetStats(gld_mac_info_t *macInfo, struct gld_stats *gs)
+{
+ vxn_softc_t *dp = (vxn_softc_t *)macInfo->gldm_private;
+
+ gs->glds_errxmt = dp->stats.errxmt;
+ gs->glds_errrcv = dp->stats.errrcv;
+ gs->glds_short = dp->stats.runt;
+ gs->glds_norcvbuf = dp->stats.norcvbuf;
+ gs->glds_intr = dp->stats.interrupts;
+ gs->glds_defer = dp->stats.defer;
+
+ return GLD_SUCCESS;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_ApplyAddressFilter --
+ * Go over multicast list and compute/apply address filter
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_ApplyAddressFilter(vxn_softc_t *dp)
+{
+ uint8_t *ep;
+ int i, j, bit, byte;
+ uint32_t crc, poly = CRC_POLYNOMIAL_LE;
+ Vmxnet2_DriverData *dd = dp->driverData;
+ volatile uint16_t *mcastTable = (uint16_t *)dd->LADRF;
+
+ ASSERT(MUTEX_HELD(&dp->intrlock));
+
+ /* clear the multicast filter */
+ dd->LADRF[0] = 0;
+ dd->LADRF[1] = 0;
+
+ for (i = 0; i < dp->multiCount; i++) {
+ crc = 0xffffffff;
+ ep = (uint8_t *)&dp->multicastList[i].ether_addr_octet;
+
+ for (byte = 0; byte < 6; byte++) {
+ for (bit = *ep++, j = 0; j < 8; j++, bit >>= 1) {
+ int test;
+
+ test = ((bit ^ crc) & 0x01);
+ crc >>= 1;
+
+ if (test) {
+ crc = crc ^ poly;
+ }
+ }
+ }
+
+ crc = crc >> 26;
+ mcastTable[crc >> 4] |= 1 << (crc & 0xf);
+ }
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_SetMulticast --
+ * Add delete entry from multicast list
+ *
+ * Results:
+ * GLD_FAILURE on failure
+ * GLD_SUCCESS on success
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_SetMulticast(gld_mac_info_t *macinfo, uint8_t *ep, int flag)
+{
+ int i;
+ int copyLen;
+ vxn_softc_t *dp = (vxn_softc_t *)macinfo->gldm_private;
+ Vmxnet2_DriverData *dd = dp->driverData;
+
+ if (flag == GLD_MULTI_ENABLE) {
+ /*
+ * Exceeded multicast address limit
+ */
+ if (dp->multiCount >= GLD_MAX_MULTICAST) {
+ return GLD_FAILURE;
+ }
+
+ /*
+ * Add mac address to multicast list
+ */
+ bcopy(ep, dp->multicastList[dp->multiCount].ether_addr_octet,
+ ETHERADDRL);
+ dp->multiCount++;
+ }
+ else {
+ for (i=0; i<dp->multiCount; i++) {
+ if (bcmp(ep, dp->multicastList[i].ether_addr_octet, ETHERADDRL) == 0) {
+ goto found;
+ }
+ }
+ return GLD_FAILURE;
+
+ found:
+ /*
+ * Delete mac address from multicast list
+ */
+ copyLen = (dp->multiCount - (i+1)) * sizeof(struct ether_addr);
+ if (copyLen > 0) {
+ bcopy(&dp->multicastList[i+1], &dp->multicastList[i], copyLen);
+ }
+ dp->multiCount--;
+ }
+
+ /*
+ * Compute address filter from list of addressed and apply it
+ */
+ mutex_enter(&dp->intrlock);
+ Vxn_ApplyAddressFilter(dp);
+
+ if (dp->multiCount) {
+ ASSERT(dd->LADRF[0] || dd->LADRF[1]);
+ dd->ifflags |= VMXNET_IFF_MULTICAST;
+ } else {
+ ASSERT(!(dd->LADRF[0] || dd->LADRF[1]));
+ dd->ifflags &= ~VMXNET_IFF_MULTICAST;
+ }
+
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_UPDATE_IFF);
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_UPDATE_LADRF);
+ mutex_exit(&dp->intrlock);
+
+ return GLD_SUCCESS;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_SetMacAddress --
+ * Change device MAC address
+ *
+ * Results:
+ * GLD_SUCCESS
+ * GLD_FAILURE
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_SetMacAddress(gld_mac_info_t *macInfo, uint8_t *mac)
+{
+ int i;
+ int err = GLD_SUCCESS;
+ vxn_softc_t * dp = (vxn_softc_t *)macInfo->gldm_private;
+
+ mutex_enter(&dp->intrlock);
+ mutex_enter(&dp->xmitlock);
+
+ /*
+ * Don't change MAC address on a running NIC
+ */
+ if (dp->nicActive) {
+ err = GLD_FAILURE;
+ goto out;
+ }
+
+ /*
+ * Save new MAC address
+ */
+ for (i = 0; i < 6; i++) {
+ dp->devAddr.ether_addr_octet[i] = mac[i];
+ }
+
+ /*
+ * Push new MAC address down into hardware
+ */
+ for (i = 0; i < 6; i++) {
+ OUTB(dp, VMXNET_MAC_ADDR + i, mac[i]);
+ }
+
+out:
+ mutex_exit(&dp->xmitlock);
+ mutex_exit(&dp->intrlock);
+ return err;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Start --
+ * Device start routine. Called on "ifconfig plumb"
+ *
+ * Results:
+ * GLD_SUCCESS
+ * GLD_FAILURE
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_Start(gld_mac_info_t *macInfo)
+{
+ int err = GLD_SUCCESS;
+ uint32_t r, capabilities, features;
+ vxn_softc_t * dp = (vxn_softc_t *)macInfo->gldm_private;
+
+ mutex_enter(&dp->intrlock);
+ mutex_enter(&dp->xmitlock);
+
+ if (!dp->nicActive) {
+ /*
+ * Register ring structure with hardware
+ *
+ * This downcast is OK because we requested a 32-bit physical address
+ */
+ OUTL(dp, VMXNET_INIT_ADDR, (uint32_t)(uintptr_t)dp->driverDataPhy);
+ OUTL(dp, VMXNET_INIT_LENGTH, dp->driverData->length);
+
+ /*
+ * Make sure registeration succeded
+ */
+ r = INL(dp, VMXNET_INIT_LENGTH);
+ if (!r) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Start: failed to register ring",
+ dp->drvName, dp->unit);
+ err = GLD_FAILURE;
+ goto out;
+ }
+
+ /*
+ * Get maximum tx fragments supported
+ */
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_GET_CAPABILITIES);
+ capabilities = INL(dp, VMXNET_COMMAND_ADDR);
+
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_GET_FEATURES);
+ features = INL(dp, VMXNET_COMMAND_ADDR);
+
+ DPRINTF(3, (CE_CONT, "%s%d: chip capabilities=0x%x features=0x%x\n",
+ dp->drvName, dp->unit, capabilities, features));
+
+ if ((capabilities & VMNET_CAP_SG) &&
+ (features & VMXNET_FEATURE_ZERO_COPY_TX)) {
+ dp->maxTxFrags = VMXNET2_SG_DEFAULT_LENGTH;
+ } else {
+ dp->maxTxFrags = 1;
+ }
+ ASSERT(dp->maxTxFrags >= 1);
+
+ /*
+ * Alloc Tx DMA handle
+ */
+ vxn_dma_attrs_tx.dma_attr_sgllen = dp->maxTxFrags;
+ if (ddi_dma_alloc_handle(dp->dip, &vxn_dma_attrs_tx, DDI_DMA_SLEEP,
+ NULL, &dp->txDmaHdl) != DDI_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Start: failed to alloc tx dma handle",
+ dp->drvName, dp->unit);
+ err = GLD_FAILURE;
+ goto out;
+ }
+
+ /*
+ * Enable interrupts on the card
+ */
+ dp->driverData->ifflags |= VMXNET_IFF_BROADCAST | VMXNET_IFF_DIRECTED;
+
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_INTR_ENABLE);
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_UPDATE_IFF);
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_UPDATE_LADRF);
+
+ dp->nicActive = TRUE;
+ }
+
+out:
+ mutex_exit(&dp->xmitlock);
+ mutex_exit(&dp->intrlock);
+ return err;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Stop --
+ * Device stop routine. Called on "ifconfig unplumb"
+ *
+ * Results:
+ * GLD_SUCCESS
+ * GLD_FAILURE
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_Stop(gld_mac_info_t *macInfo)
+{
+ int i;
+ int err = GLD_SUCCESS;
+ vxn_softc_t * dp = (vxn_softc_t *)macInfo->gldm_private;
+ boolean_t resched;
+
+ mutex_enter(&dp->intrlock);
+ mutex_enter(&dp->xmitlock);
+
+ if (!dp->nicActive) {
+ goto out;
+ }
+
+ /*
+ * Disable interrupts
+ */
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_INTR_DISABLE);
+
+ /*
+ * Wait for pending transmits
+ */
+ if (dp->txPending) {
+ for (i=0; i < MAX_TX_WAIT_ON_STOP && dp->txPending; i++) {
+ delay(drv_usectohz(1000));
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_CHECK_TX_DONE);
+ (void) Vxn_TxComplete(dp, &resched);
+ /*
+ * Don't worry about rescheduling transmits - GLD handles
+ * this automatically.
+ */
+ }
+ }
+ if (dp->txPending) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Stop: giving up on %d pending transmits",
+ dp->drvName, dp->unit, dp->txPending);
+ }
+
+ OUTL(dp, VMXNET_INIT_ADDR, 0);
+ dp->nicActive = FALSE;
+
+ /*
+ * Free Tx DMA handle
+ *
+ * The ddi_dma_free_handle() man page says that ddi_dma_unbind_handle() must be called
+ * prior to calling ddi_dma_free_handle().
+ * However, call to ddi_dma_unbind_handle() is not required here, because
+ * ddi_dma_addr_bind_handle() and matching ddi_dma_unbind_handle() are called from
+ * Vxn_EncapTxBuf().
+ * xmitlock is held in Vxn_EncapTxBuf() as well as acquired above in Vxn_Stop().
+ */
+ ddi_dma_free_handle(&dp->txDmaHdl);
+ dp->txDmaHdl = NULL;
+
+out:
+ mutex_exit(&dp->xmitlock);
+ mutex_exit(&dp->intrlock);
+ return err;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_FreeTxBuf --
+ * Free transmit buffer
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_FreeTxBuf(vxn_softc_t *dp, int idx)
+{
+ mblk_t **txMblkp = &TX_RINGBUF_MBLK(dp, idx);
+ dma_buf_t *dmaMem = &TX_RINGBUF_DMAMEM(dp, idx);
+
+ if (*txMblkp) {
+ freemsg(*txMblkp);
+ *txMblkp = NULL;
+ }
+
+ if (dmaMem->buf) {
+ Vxn_FreeDmaMem(dmaMem);
+ ASSERT(dmaMem->buf == NULL);
+ }
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_EncapTxBuf --
+ * Go over dma mappings of Tx buffers and drop buffer physical address
+ * into ring entry
+ *
+ * Results:
+ * SOLVMXNET_SUCCESS on success
+ * SOLVMXNET_FAILURE on failure
+ *
+ * Side effects:
+ * None
+ *---------------- -------------------------------------------------------------
+ */
+static int
+Vxn_EncapTxBuf(vxn_softc_t *dp,
+ mblk_t *mp,
+ Vmxnet2_TxRingEntry *xre,
+ tx_ring_buf_t *txBuf)
+{
+ int frag;
+ int fragcount;
+ int rval;
+ mblk_t *tp;
+ mblk_t *mblk;
+ boolean_t needPullup = FALSE;
+ boolean_t dmaMemAlloced = FALSE;
+
+ ASSERT(txBuf);
+ ASSERT(txBuf->mblk == NULL);
+ ASSERT(MUTEX_HELD(&dp->xmitlock));
+
+ xre->sg.length = 0;
+ xre->flags = 0;
+
+ fragcount = 0;
+ for (tp = mp; tp != NULL; tp = tp->b_cont) {
+ fragcount++;
+ }
+ if (fragcount > dp->maxTxFrags) {
+ needPullup = TRUE;
+ }
+
+pullup:
+ frag = 0;
+ if (needPullup) {
+ if (!(mblk = msgpullup(mp, -1))) {
+ cmn_err(CE_WARN, "%s%d: Vxn_EncapTxBuf: msgpullup failed",
+ dp->drvName, dp->unit);
+ goto err;
+ }
+ } else {
+ mblk = mp;
+ }
+
+ /*
+ * Go through message chain and drop packet pointers into ring
+ * scatter/gather array
+ */
+ for (tp = mblk; tp != NULL; tp = tp->b_cont) {
+
+ uint_t nCookies;
+ ddi_dma_cookie_t dmaCookie;
+ int len = tp->b_wptr - tp->b_rptr;
+
+ if (len) {
+ /*
+ * Associate tx buffer with dma handle
+ */
+ ASSERT(dp->txDmaHdl);
+ if ((rval = ddi_dma_addr_bind_handle(dp->txDmaHdl, NULL, (caddr_t)tp->b_rptr,
+ len, DDI_DMA_RDWR | DDI_DMA_STREAMING,
+ DDI_DMA_DONTWAIT, NULL,
+ &dmaCookie, &nCookies))
+ != DDI_DMA_MAPPED) {
+
+ /*
+ * Try to handle bind failure caused by a page boundary spill
+ * by allocating a private dma buffer and copying data into it
+ */
+ if ((rval == DDI_DMA_TOOBIG) && !dmaMemAlloced ) {
+ /*
+ * Force pullup
+ */
+ if (!needPullup && (dp->maxTxFrags > 1)) {
+ needPullup = TRUE;
+ goto pullup;
+ }
+
+ if (Vxn_AllocDmaMem(dp, len, FALSE, &txBuf->dmaMem)
+ != SOLVMXNET_SUCCESS) {
+ goto err;
+ }
+
+ dmaMemAlloced = TRUE;
+
+ /*
+ * Copy data into DMA capable buffer
+ */
+ bcopy(tp->b_rptr, txBuf->dmaMem.buf, len);
+
+ /*
+ * Stick buffer physical addr in the ring
+ */
+ xre->sg.sg[frag].addrLow = txBuf->dmaMem.phyBuf;
+ xre->sg.sg[frag].length = len;
+ frag++;
+
+ continue;
+
+ } else {
+ cmn_err(CE_WARN, "%s%d: Vxn_EncapTxBuf: failed (%d) to bind dma "
+ "handle for len %d. [dmaMemAlloced=%d]",
+ dp->drvName, dp->unit, rval, len, dmaMemAlloced);
+ goto err;
+ }
+ }
+
+ /*
+ * Extract tx buffer physical addresses from cookie
+ */
+ while (nCookies) {
+ if (UNLIKELY(frag == dp->maxTxFrags)) {
+ (void)ddi_dma_unbind_handle(dp->txDmaHdl);
+
+ if (!needPullup) {
+ ASSERT(!dmaMemAlloced);
+ needPullup = TRUE;
+ goto pullup;
+ } else {
+ cmn_err(CE_WARN, "%s%d: Vxn_EncapTxBuf: "
+ "exceeded max (%d) fragments in message",
+ dp->drvName, dp->unit, dp->maxTxFrags);
+ goto err;
+ }
+ }
+
+ /*
+ * Stick it in the ring
+ */
+ xre->sg.sg[frag].addrLow = dmaCookie.dmac_address;
+ xre->sg.sg[frag].length = dmaCookie.dmac_size;
+ frag++;
+
+ if (--nCookies) {
+ ddi_dma_nextcookie(dp->txDmaHdl, &dmaCookie);
+ }
+ }
+
+ (void)ddi_dma_unbind_handle(dp->txDmaHdl);
+ }
+ }
+
+ if (frag > 0) {
+ xre->sg.length = frag;
+
+ /* Give ownership to NIC */
+ xre->sg.addrType = NET_SG_PHYS_ADDR;
+ xre->ownership = VMXNET2_OWNERSHIP_NIC;
+ xre->flags |= VMXNET2_TX_CAN_KEEP;
+ txBuf->mblk = mblk;
+
+ /*
+ * If we called msgpullup to concatenate fragments, free
+ * original mblk now since we're going to return success.
+ */
+ if (mblk != mp) {
+ freemsg(mp);
+ }
+
+ return SOLVMXNET_SUCCESS;
+ }
+
+err:
+ if (mblk != NULL && mblk != mp) {
+ /*
+ * Free mblk allocated by msgpullup.
+ */
+ freemsg(mblk);
+ }
+
+ if (dmaMemAlloced) {
+ ASSERT(txBuf->dmaMem.buf);
+ Vxn_FreeDmaMem(&txBuf->dmaMem);
+ }
+
+ return SOLVMXNET_FAILURE;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Send --
+ * GLD Transmit routine. Starts packet hard tx.
+ *
+ * Results:
+ * GLD_SUCCESS on success
+ * GLD_FAILURE on failure
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_Send(gld_mac_info_t *macinfo, mblk_t *mp)
+{
+ Vmxnet2_TxRingEntry *xre;
+ int err = GLD_SUCCESS;
+ vxn_softc_t *dp = (vxn_softc_t *)macinfo->gldm_private;
+ Vmxnet2_DriverData *dd = dp->driverData;
+ boolean_t resched = FALSE;
+
+ mutex_enter(&dp->xmitlock);
+
+ /*
+ * Check if ring entry at drop pointer is available
+ */
+ if (TX_RINGBUF_MBLK(dp, dd->txDriverNext) != NULL) {
+ DPRINTF(3, (CE_NOTE, "%s%d: Vxn_Send: tx ring full",
+ dp->drvName, dp->unit));
+ err = GLD_NORESOURCES;
+ dd->txStopped = TRUE;
+ dp->stats.defer++;
+ goto out;
+ }
+
+ xre = &dp->txRing[dd->txDriverNext];
+
+ /*
+ * Drop packet into ring entry
+ */
+ if (Vxn_EncapTxBuf(dp, mp, xre, &dp->txRingBuf[dd->txDriverNext])
+ != SOLVMXNET_SUCCESS) {
+ err = GLD_FAILURE;
+ dp->stats.errxmt++;
+ goto out;
+ }
+
+ /*
+ * Increment drop pointer
+ */
+ VMXNET_INC(dd->txDriverNext, dd->txRingLength);
+ dd->txNumDeferred++;
+ dp->txPending++;
+
+ /*
+ * Transmit, if number of pending packets > tx cluster length
+ */
+ if (dd->txNumDeferred >= dd->txClusterLength) {
+ dd->txNumDeferred = 0;
+
+ /*
+ * Call hardware transmit
+ */
+ INL(dp, VMXNET_TX_ADDR);
+ }
+
+ /*
+ * Clean up transmit ring. TX completion interrupts are not guaranteed
+ */
+ (void) Vxn_TxComplete(dp, &resched);
+
+out:
+ mutex_exit(&dp->xmitlock);
+ if (resched) {
+ /* Tell GLD to retry any deferred packets */
+ gld_sched(dp->macInfo);
+ }
+ return err;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_TxComplete --
+ * Scan Tx ring for completed transmits. Reclaim Tx buffers.
+ *
+ * Results:
+ * Returns TRUE if it found a completed transmit, FALSE otherwise.
+ * Also sets *reschedp to TRUE if the caller should call gld_sched
+ * to reschedule transmits (once all locks are dropped).
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static boolean_t
+Vxn_TxComplete(vxn_softc_t *dp, boolean_t *reschedp)
+{
+ Vmxnet2_DriverData *dd = dp->driverData;
+ boolean_t found = FALSE;
+ boolean_t needresched = FALSE;
+
+ ASSERT(MUTEX_HELD(&dp->xmitlock));
+
+ while (1) {
+ Vmxnet2_TxRingEntry *xre = &dp->txRing[dd->txDriverCur];
+
+ if (xre->ownership != VMXNET2_OWNERSHIP_DRIVER ||
+ (TX_RINGBUF_MBLK(dp, dd->txDriverCur) == NULL)) {
+ break;
+ }
+
+ found = TRUE;
+ Vxn_FreeTxBuf(dp, dd->txDriverCur);
+
+ dp->txPending--;
+ VMXNET_INC(dd->txDriverCur, dd->txRingLength);
+ if (dd->txStopped) {
+ needresched = TRUE;
+ dd->txStopped = FALSE;
+ }
+ }
+
+ *reschedp = needresched;
+ return found;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Receive --
+ * Rx handler. First assembles the packets into a chain of mblks,
+ * then drops locks and passes them up the stack to GLD.
+ *
+ * Results:
+ * Returns TRUE if it find a packet ready for processing, FALSE
+ * otherwise.
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static boolean_t
+Vxn_Receive(vxn_softc_t *dp)
+{
+ int ringnext;
+ short pktlen;
+ Vmxnet2_DriverData *dd = dp->driverData;
+ rx_dma_buf_t *rxDesc;
+ rx_dma_buf_t *newRxDesc;
+ mblk_t *mblk;
+ mblk_t *head = NULL;
+ mblk_t **tail = &head;
+ mblk_t *next;
+ boolean_t found = FALSE; /* Did we find at least one packet? */
+
+ ASSERT(MUTEX_HELD(&dp->intrlock));
+
+ /*
+ * Walk receive ring looking for entries with ownership
+ * reverted back to driver
+ */
+ while (1) {
+ Vmxnet2_RxRingEntry *rre;
+ rx_dma_buf_t **rbuf;
+
+ ringnext = dd->rxDriverNext;
+ rre = &dp->rxRing[ringnext];
+ rbuf = &dp->rxRingBuffPtr[ringnext];
+
+ if (rre->ownership != VMXNET2_OWNERSHIP_DRIVER) {
+ break;
+ }
+
+ found = TRUE;
+
+ pktlen = rre->actualLength;
+
+ if (pktlen < (60 - 4)) {
+ /*
+ * Ethernet header vlan tags are 4 bytes. Some vendors generate
+ * 60byte frames including vlan tags. When vlan tag
+ * is stripped, such frames become 60 - 4. (PR106153)
+ */
+ dp->stats.errrcv++;
+ if (pktlen != 0) {
+ DPRINTF(3, (CE_CONT, "%s%d: runt packet\n", dp->drvName, dp->unit));
+ dp->stats.runt++;
+ }
+ } else {
+ /*
+ * Alloc new Rx buffer to replace current one
+ */
+ newRxDesc = Vxn_AllocRxBufFromPool(dp);
+
+ if (newRxDesc) {
+ rxDesc = *rbuf;
+ mblk = rxDesc->mblk;
+
+ *rbuf = newRxDesc;
+ rre->paddr = newRxDesc->dmaDesc.phyBuf + ETHERALIGN;
+ rre->bufferLength = MAXPKTBUF - ETHERALIGN;
+ rre->actualLength = 0;
+
+ /*
+ * Advance write pointer past packet length
+ */
+ mblk->b_wptr = mblk->b_rptr + pktlen;
+
+ /*
+ * Add to end of chain.
+ */
+ mblk->b_next = NULL;
+ *tail = mblk;
+ tail = &mblk->b_next;
+ } else {
+ dp->stats.errrcv++;
+ dp->stats.norcvbuf++;
+ }
+ }
+
+ /* Give the descriptor back to NIC */
+ rre->ownership = VMXNET2_OWNERSHIP_NIC;
+ VMXNET_INC(dd->rxDriverNext, dd->rxRingLength);
+ }
+
+ /*
+ * Walk chain and pass mblks up to gld_recv one by one.
+ */
+ mutex_exit(&dp->intrlock);
+ for (mblk = head; mblk != NULL; mblk = next) {
+ next = mblk->b_next;
+ mblk->b_next = NULL;
+ gld_recv(dp->macInfo, mblk);
+ }
+ mutex_enter(&dp->intrlock);
+
+ return (found);
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Interrupt --
+ * GLD interrupt handler. Scan: Rx ring for received packets, Tx ring for
+ * completed transmits
+ *
+ * Results:
+ * - DDI_INTR_CLAIMED (if we found something to do)
+ * - DDI_INTR_UNCLAIMED (if not)
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static u_int
+Vxn_Interrupt(gld_mac_info_t *macInfo)
+{
+ u_int ret = DDI_INTR_UNCLAIMED;
+ vxn_softc_t *dp = (vxn_softc_t *)macInfo->gldm_private;
+ boolean_t foundRx, foundTx;
+ boolean_t resched = FALSE;
+
+ mutex_enter(&dp->intrlock);
+ dp->inIntr = TRUE;
+
+ if (!dp->nicActive) {
+ goto out;
+ }
+
+ /*
+ * Ack interrupt
+ */
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_INTR_ACK);
+
+ foundRx = Vxn_Receive(dp);
+
+ mutex_enter(&dp->xmitlock);
+ foundTx = Vxn_TxComplete(dp, &resched);
+ mutex_exit(&dp->xmitlock);
+
+ if (foundRx || foundTx) {
+ ret = DDI_INTR_CLAIMED;
+ dp->stats.interrupts++;
+ }
+
+out:
+ dp->inIntr = FALSE;
+ mutex_exit(&dp->intrlock);
+
+ if (resched) {
+ gld_sched(dp->macInfo);
+ }
+
+ return ret;
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_ReclaimRxBuf --
+ * Callback handler invoked by freemsg(). Frees Rx buffer memory and mappings
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_ReclaimRxBuf(rx_dma_buf_t *rxDesc)
+{
+ Vxn_FreeRxBufToPool(rxDesc);
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_FreeRxBuf --
+ * Free allocated Rx buffer
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_FreeRxBuf(rx_dma_buf_t *rxDesc)
+{
+ ASSERT(rxDesc);
+
+ if (rxDesc->mblk) {
+ freemsg(rxDesc->mblk);
+ } else {
+ Vxn_FreeDmaMem(&rxDesc->dmaDesc);
+ kmem_free(rxDesc, sizeof(rx_dma_buf_t));
+ }
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_AllocRxBuf --
+ * Allocate Rx buffer
+ *
+ * Results:
+ * Pointer to Rx buffer descriptor - on success
+ * NULL - on failure
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static rx_dma_buf_t *
+Vxn_AllocRxBuf(vxn_softc_t *dp, int cansleep)
+{
+ rx_dma_buf_t *rxDesc;
+
+ rxDesc = (rx_dma_buf_t *)kmem_zalloc(sizeof(rx_dma_buf_t),
+ cansleep ? KM_SLEEP : KM_NOSLEEP);
+ if (!rxDesc) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocRxBuf: kmem_zalloc failed",
+ dp->drvName, dp->unit);
+ return NULL;
+ }
+
+ rxDesc->softc = dp;
+
+ /*
+ * Alloc dma-able packet memory
+ */
+ if (Vxn_AllocDmaMem(dp, MAXPKTBUF, cansleep, &rxDesc->dmaDesc)
+ != SOLVMXNET_SUCCESS) {
+ kmem_free(rxDesc, sizeof(rx_dma_buf_t));
+ return NULL;
+ }
+
+ /*
+ * Fill in free callback; fired by freemsg()
+ */
+ rxDesc->freeCB.free_func = &Vxn_ReclaimRxBuf;
+ rxDesc->freeCB.free_arg = (caddr_t) rxDesc;
+
+ rxDesc->mblk = NULL;
+ return rxDesc;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_FreeInitBuffers --
+ * Free allocated Tx and Rx buffers
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_FreeInitBuffers(vxn_softc_t *dp)
+{
+ int i;
+
+ for (i=0; i<dp->vxnNumRxBufs; i++) {
+ if (dp->rxRingBuffPtr[i]) {
+ Vxn_FreeRxBuf(dp->rxRingBuffPtr[i]);
+ dp->rxRingBuffPtr[i] = NULL;
+ }
+ }
+
+ for (i=0; i<dp->vxnNumTxBufs; i++) {
+ if (TX_RINGBUF_MBLK(dp, i)) {
+ Vxn_FreeTxBuf(dp, i);
+ }
+ }
+
+ /*
+ * Rx pool must get freed last. Rx buffers above will
+ * show up on the pool when freemsg callback fires.
+ */
+ Vxn_FreeRxBufPool(dp);
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_AllocRxBufPool --
+ * Allocate pool of rx buffers - 3 * configured Rx buffers
+ *
+ * Results:
+ * SOLVMXNET_SUCCESS/SOLVMXNET_FAILURE
+ *
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_AllocRxBufPool(vxn_softc_t *dp)
+{
+ int i;
+
+ dp->rxFreeBufList = NULL;
+
+ // Allow list to double in size if needed. Any additional buffers
+ // that are allocated on the fly will be freed back to main memory.
+ dp->rxMaxFreeBufs = dp->vxnNumRxBufs * 6;
+
+ for (i = 0; i < dp->vxnNumRxBufs * 3; i++) {
+ rx_dma_buf_t *rxDesc;
+
+ /*
+ * Alloc rx buffer
+ */
+ if (!(rxDesc = Vxn_AllocRxBuf(dp, TRUE))) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocRxBufPool: failed to allocate memory",
+ dp->drvName, dp->unit);
+ dp->rxNumFreeBufs = i;
+ return SOLVMXNET_FAILURE;
+ }
+ /*
+ * Add to free list
+ */
+ rxDesc->next = dp->rxFreeBufList;
+ dp->rxFreeBufList = rxDesc;
+ }
+
+ dp->rxNumFreeBufs = i;
+ return SOLVMXNET_SUCCESS;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_FreeRxBufPool --
+ * Free rx buffers pool
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_FreeRxBufPool(vxn_softc_t *dp)
+{
+ while (dp->rxFreeBufList) {
+ rx_dma_buf_t *rxDesc = dp->rxFreeBufList;
+
+ /* unlink */
+ dp->rxFreeBufList = rxDesc->next;
+
+ ASSERT(rxDesc->mblk == NULL);
+ Vxn_FreeDmaMem(&rxDesc->dmaDesc);
+ kmem_free(rxDesc, sizeof(rx_dma_buf_t));
+ }
+ dp->rxNumFreeBufs = 0;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_AllocRxBufFromPool --
+ * Allocate Rx buffer from free pool
+ *
+ * Results:
+ * Pointer to Rx buffer descriptor - on success
+ * NULL - on failure
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static rx_dma_buf_t *
+Vxn_AllocRxBufFromPool(vxn_softc_t *dp)
+{
+ rx_dma_buf_t *rxDesc = NULL;
+
+ mutex_enter(&dp->rxlistlock);
+ if (dp->rxFreeBufList) {
+ rxDesc = dp->rxFreeBufList;
+ dp->rxFreeBufList = rxDesc->next;
+ ASSERT(dp->rxNumFreeBufs >= 1);
+ dp->rxNumFreeBufs--;
+ }
+ mutex_exit(&dp->rxlistlock);
+
+ if (!rxDesc) {
+ /*
+ * Try to allocate new descriptor from memory. Can't block here
+ * since we could be being called from interrupt context.
+ */
+ DPRINTF(5, (CE_NOTE, "%s%d: allocating rx buf from memory",
+ dp->drvName, dp->unit));
+ if (!(rxDesc = Vxn_AllocRxBuf(dp, FALSE))) {
+ cmn_err(CE_WARN,
+ "%s%d: Vxn_AllocRxBufFromPool : pool rx alloc failed",
+ dp->drvName, dp->unit);
+ return NULL;
+ }
+ }
+
+ /*
+ * Allocate new message block for this buffer
+ */
+ rxDesc->mblk = desballoc((uchar_t *)rxDesc->dmaDesc.buf + ETHERALIGN,
+ rxDesc->dmaDesc.bufLen - ETHERALIGN,
+ BPRI_MED, &rxDesc->freeCB);
+ if (!rxDesc->mblk) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocRxBufFromPool : desballoc failed",
+ dp->drvName, dp->unit);
+
+ /* put back on free list */
+ Vxn_FreeRxBufToPool(rxDesc);
+ return NULL;
+ }
+
+ return rxDesc;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_FreeRxBufToPool --
+ * Return rx buffer to free pool
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_FreeRxBufToPool(rx_dma_buf_t *rxDesc)
+{
+ vxn_softc_t *dp = rxDesc->softc;
+
+ rxDesc->mblk = NULL;
+
+ /*
+ * Insert on free list, or free if the list is full
+ */
+ mutex_enter(&dp->rxlistlock);
+ if (dp->rxNumFreeBufs >= dp->rxMaxFreeBufs) {
+ DPRINTF(5, (CE_NOTE, "%s%d: freeing rx buf to memory",
+ dp->drvName, dp->unit));
+ Vxn_FreeRxBuf(rxDesc);
+ } else {
+ rxDesc->next = dp->rxFreeBufList;
+ dp->rxFreeBufList = rxDesc;
+ dp->rxNumFreeBufs++;
+ }
+ mutex_exit(&dp->rxlistlock);
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_AllocInitBuffers --
+ * Allocated Rx buffers and init ring entries
+ *
+ * Results:
+ * SOLVMXNET_SUCCESS - on success
+ * SOLVMXNET_FAILURE - on failure
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_AllocInitBuffers(vxn_softc_t *dp)
+{
+ Vmxnet2_DriverData *dd;
+ uint32_t i, offset;
+
+ dd = dp->driverData;
+ offset = sizeof(*dd);
+
+ /*
+ * Init shared structures
+ */
+ dd->rxRingLength = dp->vxnNumRxBufs;
+ dd->rxRingOffset = offset;
+ dp->rxRing = (Vmxnet2_RxRingEntry *)((uintptr_t)dd + offset);
+ offset += dp->vxnNumRxBufs * sizeof(Vmxnet2_RxRingEntry);
+
+ dd->rxRingLength2 = 1;
+ dd->rxRingOffset2 = offset;
+ offset += sizeof(Vmxnet2_RxRingEntry);
+
+ dd->txRingLength = dp->vxnNumTxBufs;
+ dd->txRingOffset = offset;
+ dp->txRing = (Vmxnet2_TxRingEntry *)((uintptr_t)dd + offset);
+ offset += dp->vxnNumTxBufs * sizeof(Vmxnet2_TxRingEntry);
+
+ /*
+ * Alloc Rx buffers pool
+ */
+ if ( Vxn_AllocRxBufPool(dp) != SOLVMXNET_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocInitBuffers: failed to alloc buf pool",
+ dp->drvName, dp->unit);
+ return SOLVMXNET_FAILURE;
+ }
+
+ /*
+ * Allocate receive buffers
+ */
+ for (i = 0; i < dp->vxnNumRxBufs; i++) {
+ rx_dma_buf_t *rxDesc;
+ Vmxnet2_RxRingEntry *rre = &dp->rxRing[i];
+
+ if (!(rxDesc = Vxn_AllocRxBufFromPool(dp))) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocInitBuffers: "
+ "failed to alloc buf from pool", dp->drvName, dp->unit);
+ goto err;
+ }
+
+ /*
+ * Init ring entries
+ */
+ rre->paddr = rxDesc->dmaDesc.phyBuf + ETHERALIGN;
+ rre->bufferLength = MAXPKTBUF - ETHERALIGN;
+ rre->actualLength = 0;
+ dp->rxRingBuffPtr[i] = rxDesc;
+ rre->ownership = VMXNET2_OWNERSHIP_NIC;
+ }
+
+ dp->txDmaHdl = NULL;
+
+ /*
+ * Dummy recvRing2 tacked on to the end, with a single unusable entry
+ */
+ dp->rxRing[i].paddr = 0;
+ dp->rxRing[i].bufferLength = 0;
+ dp->rxRing[i].actualLength = 0;
+ dp->rxRingBuffPtr[i] = NULL;
+ dp->rxRing[i].ownership = VMXNET2_OWNERSHIP_DRIVER;
+
+ dd->rxDriverNext = 0;
+
+ /*
+ * Give xmit ring ownership to DRIVER
+ */
+ for (i = 0; i < dp->vxnNumTxBufs; i++) {
+ dp->txRing[i].ownership = VMXNET2_OWNERSHIP_DRIVER;
+ dp->txRingBuf[i].mblk = NULL;
+ dp->txRingBuf[i].dmaMem.buf = NULL;
+ dp->txRing[i].sg.sg[0].addrHi = 0;
+ }
+
+ dd->txDriverCur = dd->txDriverNext = 0;
+ dd->txStopped = FALSE;
+
+ return SOLVMXNET_SUCCESS;
+
+err:
+ for (i=0; i<dp->vxnNumRxBufs; i++) {
+ if (dp->rxRingBuffPtr[i]) {
+ Vxn_FreeRxBuf(dp->rxRingBuffPtr[i]);
+ dp->rxRingBuffPtr[i] = NULL;
+ }
+ }
+
+ Vxn_FreeRxBufPool(dp);
+ return SOLVMXNET_FAILURE;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_FreeDmaMem --
+ * Free allocated dma memory
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_FreeDmaMem(dma_buf_t *dma)
+{
+ ddi_dma_unbind_handle(dma->dmaHdl);
+ ddi_dma_mem_free(&dma->dataAccHdl);
+ ddi_dma_free_handle(&dma->dmaHdl);
+
+ dma->buf = NULL;
+ dma->phyBuf = NULL;
+ dma->bufLen = 0;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_AllocDmaMem --
+ * Allocate dma-able memory and fill passed in dma descriptor pointer
+ * if successful
+ *
+ * Results:
+ * SOLVMXNET_SUCCESS on success
+ * SOLVMXNET_FAILURE on failure
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_AllocDmaMem(vxn_softc_t *dp, int size, int cansleep, dma_buf_t *dma)
+{
+ /*
+ * Allocate handle
+ */
+ if (ddi_dma_alloc_handle(dp->dip, &vxn_dma_attrs,
+ cansleep ? DDI_DMA_SLEEP : DDI_DMA_DONTWAIT,
+ NULL, &dma->dmaHdl) != DDI_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocDmaMem: failed to allocate handle",
+ dp->drvName, dp->unit);
+ return SOLVMXNET_FAILURE;
+ }
+
+ /*
+ * Allocate memory
+ */
+ if (ddi_dma_mem_alloc(dma->dmaHdl, size, &vxn_buf_attrs, DDI_DMA_CONSISTENT,
+ cansleep ? DDI_DMA_SLEEP : DDI_DMA_DONTWAIT, NULL,
+ &dma->buf, &dma->bufLen, &dma->dataAccHdl)
+ != DDI_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocDmaMem: "
+ "ddi_dma_mem_alloc %d bytes failed",
+ dp->drvName, dp->unit, size);
+ ddi_dma_free_handle(&dma->dmaHdl);
+ return SOLVMXNET_FAILURE;
+ }
+
+ /*
+ * Mapin memory
+ */
+ if (ddi_dma_addr_bind_handle(dma->dmaHdl, NULL, dma->buf, dma->bufLen,
+ DDI_DMA_RDWR | DDI_DMA_STREAMING,
+ cansleep ? DDI_DMA_SLEEP : DDI_DMA_DONTWAIT,
+ NULL, &dma->cookie, &dma->cookieCount)
+ != DDI_DMA_MAPPED) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocDmaMem: failed to bind handle",
+ dp->drvName, dp->unit);
+ ddi_dma_mem_free(&dma->dataAccHdl);
+ ddi_dma_free_handle(&dma->dmaHdl);
+ return SOLVMXNET_FAILURE;
+ }
+
+ if (dma->cookieCount != 1) {
+ cmn_err(CE_WARN, "%s%d: Vxn_AllocDmaMem: too many DMA cookies",
+ dp->drvName, dp->unit);
+ Vxn_FreeDmaMem(dma);
+ return SOLVMXNET_FAILURE;
+ }
+
+ /*
+ * Save physical address (for easy use)
+ */
+ dma->phyBuf = dma->cookie.dmac_address;
+
+ return SOLVMXNET_SUCCESS;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_FreeDriverData --
+ * Free driver data structures and Tx Rx buffers
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static void
+Vxn_FreeDriverData(vxn_softc_t *dp)
+{
+ Vxn_FreeInitBuffers(dp);
+ Vxn_FreeDmaMem(&dp->driverDataDmaMem);
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_AllocDriverData --
+ * Allocate driver data structures and Tx Rx buffers on init
+ *
+ * Results:
+ * SOLVMXNET_SUCCESS on success
+ * SOLVMXNET_FAILURE on failure
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_AllocDriverData(vxn_softc_t *dp)
+{
+ uint32_t r, driverDataSize;
+
+ /*
+ * Get configured receive buffers
+ */
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_GET_NUM_RX_BUFFERS);
+ r = INL(dp, VMXNET_COMMAND_ADDR);
+ if (r == 0 || r > MAX_NUM_RECV_BUFFERS) {
+ r = DEFAULT_NUM_RECV_BUFFERS;
+ }
+ dp->vxnNumRxBufs = r;
+
+ /*
+ * Get configured transmit buffers
+ */
+ OUTL(dp, VMXNET_COMMAND_ADDR, VMXNET_CMD_GET_NUM_TX_BUFFERS);
+ r = INL(dp, VMXNET_COMMAND_ADDR);
+ if (r == 0 || r > MAX_NUM_XMIT_BUFFERS) {
+ r = DEFAULT_NUM_XMIT_BUFFERS;
+ }
+ dp->vxnNumTxBufs = r;
+
+ /*
+ * Calculate shared data size and allocate memory for it
+ */
+ driverDataSize =
+ sizeof(Vmxnet2_DriverData) +
+ /* numRecvBuffers + 1 for the dummy recvRing2 (used only by Windows) */
+ (dp->vxnNumRxBufs + 1) * sizeof(Vmxnet2_RxRingEntry) +
+ dp->vxnNumTxBufs * sizeof(Vmxnet2_TxRingEntry);
+
+ if (Vxn_AllocDmaMem(dp, driverDataSize, TRUE, &dp->driverDataDmaMem)
+ != SOLVMXNET_SUCCESS) {
+ return SOLVMXNET_FAILURE;
+ }
+
+ /*
+ * Clear memory (bzero isn't resolved by module loader for some reason)
+ */
+ ASSERT(dp->driverDataDmaMem.buf && dp->driverDataDmaMem.bufLen);
+ Vxn_Memset(dp->driverDataDmaMem.buf, 0, dp->driverDataDmaMem.bufLen);
+
+ dp->driverData = (Vmxnet2_DriverData *)dp->driverDataDmaMem.buf;
+ dp->driverDataPhy = (void *)(uintptr_t)dp->driverDataDmaMem.phyBuf;
+
+ /* So that the vmkernel can check it is compatible */
+ dp->driverData->magic = VMXNET2_MAGIC;
+ dp->driverData->length = driverDataSize;
+
+ /*
+ * Alloc rx/tx buffers, init ring, register with hardware etc.
+ */
+ if (Vxn_AllocInitBuffers(dp) != SOLVMXNET_SUCCESS) {
+ Vxn_FreeDmaMem(&dp->driverDataDmaMem);
+ return SOLVMXNET_FAILURE;
+ }
+
+ DPRINTF(3, (CE_CONT, "%s%d: numRxBufs=(%d*%"FMT64"d) numTxBufs=(%d*%"FMT64"d)"
+ " driverDataSize=%d driverDataPhy=0x%p\n",
+ dp->drvName, dp->unit,
+ dp->vxnNumRxBufs, (uint64_t)sizeof(Vmxnet2_RxRingEntry),
+ dp->vxnNumTxBufs, (uint64_t)sizeof(Vmxnet2_TxRingEntry),
+ driverDataSize, dp->driverDataPhy));
+
+ return SOLVMXNET_SUCCESS;
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Attach --
+ * Probe and attach driver to stack
+ *
+ * Results:
+ * DDI_SUCCESS
+ * DDI_FAILURE
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_Attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
+{
+ int i, ret, len, unit;
+ const char *drvName;
+ ddi_acc_handle_t confHdl;
+ uint16_t vid, did;
+ uint8_t revid;
+ struct pci_phys_spec *regs;
+ caddr_t vxnIOp;
+ ddi_acc_handle_t vxnIOHdl;
+ uint32_t vLow, vHigh;
+ gld_mac_info_t *macInfo;
+ vxn_softc_t *dp;
+ boolean_t morphed = FALSE;
+ uint_t regSpaceSize;
+ uint_t chip;
+ uint_t vxnIOSize;
+
+ if (cmd != DDI_ATTACH) {
+ return DDI_FAILURE;
+ }
+
+ unit = ddi_get_instance(dip);
+ drvName = ddi_driver_name(dip);
+
+ /*
+ * Check if chip is supported.
+ */
+ if (pci_config_setup(dip, &confHdl) != DDI_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: pci_config_setup() failed", drvName, unit);
+ return DDI_FAILURE;
+ }
+
+ vid = pci_config_get16(confHdl, PCI_CONF_VENID);
+ did = pci_config_get16(confHdl, PCI_CONF_DEVID);
+ revid = pci_config_get8(confHdl, PCI_CONF_REVID);
+
+ if (vid == PCI_VENDOR_ID_VMWARE && did == PCI_DEVICE_ID_VMWARE_NET) {
+ /* Found vmxnet */
+ chip = VMXNET_CHIP;
+ }
+ else if (vid == PCI_VENDOR_ID_AMD && did == PCI_DEVICE_ID_AMD_VLANCE) {
+ /* Found vlance (maybe a vmxnet disguise) */
+ chip = LANCE_CHIP;
+ }
+ else {
+ /* Not Found */
+ DPRINTF(3, (CE_WARN, "%s: Vxn_Attach: wrong PCI venid/devid (0x%x, 0x%x)",
+ drvName, vid, did));
+ goto err;
+ }
+
+ DPRINTF(3, (CE_CONT, "%s%d: (vid: 0x%04x, did: 0x%04x, revid: 0x%02x)\n",
+ drvName, unit, vid, did, revid));
+
+ /*
+ * Get device properties
+ */
+ regs = NULL;
+ len = 0;
+ if (ddi_getlongprop(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
+ "reg", (caddr_t)&regs, &len) != DDI_PROP_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: failed to get reg property",
+ drvName, unit);
+ goto err;
+ }
+
+ ASSERT(regs != NULL && len > 0);
+
+ /*
+ * Search device properties for IO-space
+ */
+ for (i = 0; i <len / sizeof(struct pci_phys_spec); i++) {
+ if ((regs[i].pci_phys_hi & PCI_REG_ADDR_M) == PCI_ADDR_IO) {
+ regSpaceSize = regs[i].pci_size_low;
+ DPRINTF(5, (CE_CONT, "%s%d: Vxn_Attach: regSpaceSize=%d\n",
+ drvName, unit, regSpaceSize));
+ kmem_free(regs, len);
+ goto map_space_found;
+ }
+ }
+
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: failed to find IO space", drvName, unit);
+ kmem_free(regs, len);
+ goto err;
+
+map_space_found:
+
+ /*
+ * Ensure we can access registers through IO space.
+ */
+ ret = pci_config_get16(confHdl, PCI_CONF_COMM);
+ ret |= PCI_COMM_IO | PCI_COMM_ME;
+ pci_config_put16(confHdl, PCI_CONF_COMM, ret);
+
+ if (ddi_regs_map_setup(dip, i, (caddr_t *)&vxnIOp, 0, 0, &dev_attr,
+ &vxnIOHdl) != DDI_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: ddi_regs_map_setup failed",
+ drvName, unit);
+ goto err;
+ }
+
+ if (chip == VMXNET_CHIP) {
+ vxnIOSize = VMXNET_CHIP_IO_RESV_SIZE;
+ }
+ else {
+ /*
+ * Since this is a vlance adapter we can only use it if
+ * its I/0 space is big enough for the adapter to be
+ * capable of morphing. This is the first requirement
+ * for this adapter to potentially be morphable. The
+ * layout of a morphable LANCE adapter is
+ *
+ * I/O space:
+ *
+ * |------------------|
+ * | LANCE IO PORTS |
+ * |------------------|
+ * | MORPH PORT |
+ * |------------------|
+ * | VMXNET IO PORTS |
+ * |------------------|
+ *
+ * VLance has 8 ports of size 4 bytes, the morph port is 4 bytes, and
+ * Vmxnet has 10 ports of size 4 bytes.
+ *
+ * We shift up the ioaddr with the size of the LANCE I/O space since
+ * we want to access the vmxnet ports. We also shift the ioaddr up by
+ * the MORPH_PORT_SIZE so other port access can be independent of
+ * whether we are Vmxnet or a morphed VLance. This means that when
+ * we want to access the MORPH port we need to subtract the size
+ * from ioaddr to get to it.
+ */
+ vxnIOp += LANCE_CHIP_IO_RESV_SIZE + MORPH_PORT_SIZE;
+ vxnIOSize = LANCE_CHIP_IO_RESV_SIZE + MORPH_PORT_SIZE +
+ VMXNET_CHIP_IO_RESV_SIZE;
+ }
+
+ /*
+ * Do not attempt to morph non-morphable AMD PCnet
+ */
+ if (vxnIOSize > regSpaceSize) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: "
+ "vlance device is not supported by this driver", drvName, unit);
+ goto err_free_regs_map;
+ }
+
+ /*
+ * Morph, if we found a vlance adapter
+ */
+ if (chip == LANCE_CHIP) {
+ uint16_t magic;
+
+ /* Read morph port to verify that we can morph the adapter */
+ magic = ddi_get16(vxnIOHdl, (uint16_t *)(vxnIOp - MORPH_PORT_SIZE));
+ if (magic != LANCE_CHIP && magic != VMXNET_CHIP) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: Invalid magic, read: 0x%08X",
+ drvName, unit, magic);
+ goto err_free_regs_map;
+ }
+
+ /* Morph */
+ ddi_put16(vxnIOHdl, (uint16_t *)(vxnIOp - MORPH_PORT_SIZE), VMXNET_CHIP);
+ morphed = TRUE;
+
+ /* Verify that we morphed correctly */
+ magic = ddi_get16(vxnIOHdl, (uint16_t *)(vxnIOp - MORPH_PORT_SIZE));
+ if (magic != VMXNET_CHIP) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: Couldn't morph adapter."
+ " Invalid magic, read:: 0x%08X", drvName, unit, magic);
+ goto err_morph_back;
+ }
+ }
+
+ /*
+ * Check the version number of the device implementation
+ */
+ vLow = (uint32_t)ddi_get32(vxnIOHdl,
+ (uint32_t *)(vxnIOp+VMXNET_LOW_VERSION));
+ vHigh = (uint32_t)ddi_get32(vxnIOHdl,
+ (uint32_t *)(vxnIOp+VMXNET_HIGH_VERSION));
+
+ if ((vLow & 0xffff0000) != (VMXNET2_MAGIC & 0xffff0000) ||
+ ((VMXNET2_MAGIC < vLow) || (VMXNET2_MAGIC > vHigh))) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: driver version 0x%08X doesn't "
+ "match device 0x%08X:0x%08X",
+ drvName, unit, VMXNET2_MAGIC, vLow, vHigh);
+ goto err_version_mismatch;
+ }
+
+ /*
+ * Alloc soft state
+ */
+ macInfo = gld_mac_alloc(dip);
+ if (!macInfo) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: gld_mac_alloc failed",
+ drvName, unit);
+ goto err_gld_mac_alloc;
+ }
+
+ dp = (vxn_softc_t *) kmem_zalloc(sizeof(vxn_softc_t), KM_SLEEP);
+ ASSERT(dp);
+
+ /*
+ * Get interrupt cookie
+ */
+ if (ddi_get_iblock_cookie(dip, 0, &dp->iblockCookie) != DDI_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Attach: ddi_get_iblock_cookie failed",
+ drvName, unit);
+ goto err_get_iblock_cookie;
+ }
+
+ strncpy(dp->drvName, drvName, SOLVMXNET_MAXNAME);
+ dp->unit = unit;
+ dp->dip = dip;
+ dp->macInfo = macInfo;
+ dp->confHdl = confHdl;
+ dp->vxnIOHdl = vxnIOHdl;
+ dp->vxnIOp = vxnIOp;
+ dp->morphed = morphed;
+ dp->nicActive = FALSE;
+ dp->txPending = 0;
+ dp->maxTxFrags = 1;
+
+ /*
+ * Initialize mutexes
+ */
+ mutex_init(&dp->intrlock, NULL, MUTEX_DRIVER, (void *)dp->iblockCookie);
+ mutex_init(&dp->xmitlock, NULL, MUTEX_DRIVER, (void *)dp->iblockCookie);
+ mutex_init(&dp->rxlistlock, NULL, MUTEX_DRIVER, (void *)dp->iblockCookie);
+
+ /*
+ * Allocate and initialize our private and shared data structures
+ */
+ if (Vxn_AllocDriverData(dp) != SOLVMXNET_SUCCESS) {
+ goto err_alloc_driverdata;
+ }
+
+ /*
+ * Read the MAC address from the device
+ */
+ for (i = 0; i < 6; i++) {
+ dp->devAddr.ether_addr_octet[i] =
+ (uint8_t)ddi_get8(vxnIOHdl, (uint8_t *)(vxnIOp + VMXNET_MAC_ADDR + i));
+ }
+ macInfo->gldm_vendor_addr = dp->devAddr.ether_addr_octet;
+ macInfo->gldm_broadcast_addr = etherbroadcastaddr.ether_addr_octet;
+
+ DPRINTF(3, (CE_CONT,
+ "MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ dp->devAddr.ether_addr_octet[0],
+ dp->devAddr.ether_addr_octet[1],
+ dp->devAddr.ether_addr_octet[2],
+ dp->devAddr.ether_addr_octet[3],
+ dp->devAddr.ether_addr_octet[4],
+ dp->devAddr.ether_addr_octet[5]));
+
+ /*
+ * Configure GLD entry points
+ */
+ macInfo->gldm_devinfo = dip;
+ macInfo->gldm_private = (caddr_t)dp;
+ macInfo->gldm_cookie = dp->iblockCookie;
+ macInfo->gldm_reset = Vxn_Reset;
+ macInfo->gldm_start = Vxn_Start;
+ macInfo->gldm_stop = Vxn_Stop;
+ macInfo->gldm_set_mac_addr = Vxn_SetMacAddress;
+ macInfo->gldm_send = Vxn_Send;
+ macInfo->gldm_set_promiscuous = Vxn_SetPromiscuous;
+ macInfo->gldm_get_stats = Vxn_GetStats;
+ macInfo->gldm_ioctl = NULL;
+ macInfo->gldm_set_multicast= Vxn_SetMulticast;
+ macInfo->gldm_intr = Vxn_Interrupt;
+ macInfo->gldm_mctl = NULL;
+
+ macInfo->gldm_ident = (char *)ddi_driver_name(dip);
+ macInfo->gldm_type = DL_ETHER;
+ macInfo->gldm_minpkt = 0;
+ macInfo->gldm_maxpkt = ETHERMTU;
+ macInfo->gldm_addrlen = ETHERADDRL;
+ macInfo->gldm_saplen = -2;
+ macInfo->gldm_ppa = unit;
+
+ /*
+ * Register with GLD (Generic Lan Driver) framework
+ */
+ if (gld_register(dip,
+ (char *)ddi_driver_name(dip), macInfo) != DDI_SUCCESS) {
+ goto err_gld_register;
+ }
+
+ /*
+ * Add interrupt to system.
+ */
+ if (ddi_add_intr(dip, 0, NULL, NULL, gld_intr,
+ (caddr_t)macInfo) != DDI_SUCCESS) {
+ cmn_err(CE_WARN, "%s%d: ddi_add_intr failed", drvName, unit);
+ goto err_ddi_add_intr;
+ }
+
+ /*
+ * Add to list of interfaces.
+ */
+ mutex_enter(&vxnListLock);
+ dp->next = &vxnList;
+ dp->prev = vxnList.prev;
+ vxnList.prev->next = dp;
+ vxnList.prev = dp;
+ mutex_exit(&vxnListLock);
+
+ /*
+ * Success
+ */
+ return DDI_SUCCESS;
+
+err_ddi_add_intr:
+ gld_unregister(macInfo);
+
+err_gld_register:
+ Vxn_FreeDriverData(dp);
+
+err_alloc_driverdata:
+ mutex_destroy(&dp->intrlock);
+ mutex_destroy(&dp->xmitlock);
+
+err_get_iblock_cookie:
+ kmem_free(dp, sizeof(*dp));
+ gld_mac_free(macInfo);
+
+err_gld_mac_alloc:
+err_version_mismatch:
+err_morph_back:
+ if (morphed) {
+ ddi_put16(vxnIOHdl, (uint16_t *)(vxnIOp - MORPH_PORT_SIZE), LANCE_CHIP);
+ }
+
+err_free_regs_map:
+ ddi_regs_map_free(&vxnIOHdl);
+
+err:
+ pci_config_teardown(&confHdl);
+ return DDI_FAILURE;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ * Vxn_Detach --
+ * Called on module unload
+ *
+ * Results:
+ * DDI_SUCCESS
+ * DDI_FAILURE
+ *
+ * Side effects:
+ * None
+ *-----------------------------------------------------------------------------
+ */
+static int
+Vxn_Detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
+{
+ gld_mac_info_t *macInfo;
+ vxn_softc_t *dp;
+
+ macInfo = (gld_mac_info_t *)ddi_get_driver_private(dip);
+ dp = (vxn_softc_t *)macInfo->gldm_private;
+
+ if (cmd == DDI_DETACH) {
+ /*
+ * Tear down interrupt
+ */
+ ddi_remove_intr(dip, 0, macInfo->gldm_cookie);
+ gld_unregister(macInfo);
+
+ /*
+ * Quiesce hardware
+ */
+ Vxn_Stop(macInfo);
+
+ /*
+ * Free driver-data, tx/rx buffers etc
+ */
+ Vxn_FreeDriverData(dp);
+
+ /*
+ * Destroy locks
+ */
+ mutex_destroy(&dp->intrlock);
+ mutex_destroy(&dp->xmitlock);
+
+ /*
+ * Unmorph
+ */
+ if (dp->morphed) {
+ uint16_t magic;
+
+ /* Verify that we had morphed earlier */
+ magic = ddi_get16(dp->vxnIOHdl,
+ (uint16_t *)(dp->vxnIOp - MORPH_PORT_SIZE));
+ if (magic != VMXNET_CHIP) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Detach: Adapter not morphed"
+ " magic=0x%08X", dp->drvName, dp->unit, magic);
+ }
+ else {
+ /* Unmorph */
+ ddi_put16(dp->vxnIOHdl,
+ (uint16_t *)(dp->vxnIOp - MORPH_PORT_SIZE), LANCE_CHIP);
+
+ /* Verify */
+ magic = ddi_get16(dp->vxnIOHdl,
+ (uint16_t *)(dp->vxnIOp - MORPH_PORT_SIZE));
+ if (magic != LANCE_CHIP) {
+ cmn_err(CE_WARN, "%s%d: Vxn_Detach: Unable to unmorph adapter"
+ " magic=0x%08X", dp->drvName, dp->unit, magic);
+ }
+ }
+ }
+
+ /*
+ * Release resister mappings
+ */
+ ddi_regs_map_free(&dp->vxnIOHdl);
+ pci_config_teardown(&dp->confHdl);
+
+ /*
+ * Remove from list of interfaces.
+ */
+ mutex_enter(&vxnListLock);
+ ASSERT(dp != &vxnList);
+ dp->prev->next = dp->next;
+ dp->next->prev = dp->prev;
+ mutex_exit(&vxnListLock);
+
+ /*
+ * Release memory
+ */
+ kmem_free(dp, sizeof(*dp));
+ gld_mac_free(macInfo);
+
+ return DDI_SUCCESS;
+ }
+ else {
+ return DDI_FAILURE;
+ }
+}
+
+static struct module_info vxnminfo = {
+ 0, /* mi_idnum */
+ "vmxnet", /* mi_idname */
+ 0, /* mi_minpsz */
+ ETHERMTU, /* mi_maxpsz */
+ QHIWATER, /* mi_hiwat */
+ 1, /* mi_lowat */
+};
+
+static struct qinit vxnrinit = {
+ NULL, /* qi_putp */
+ gld_rsrv, /* qi_srvp */
+ gld_open, /* qi_qopen */
+ gld_close, /* qi_qclose */
+ NULL, /* qi_qadmin */
+ &vxnminfo, /* qi_minfo */
+ NULL /* qi_mstat */
+};
+
+static struct qinit vxnwinit = {
+ gld_wput, /* qi_putp */
+ gld_wsrv, /* qi_srvp */
+ NULL, /* qi_qopen */
+ NULL, /* qi_qclose */
+ NULL, /* qi_qadmin */
+ &vxnminfo, /* qi_minfo */
+ NULL /* qi_mstat */
+};
+
+static struct streamtab vxn_info = {
+ &vxnrinit, /* st_rdinit */
+ &vxnwinit, /* st_wrinit */
+ NULL, /* st_muxrinit */
+ NULL /* st_muxwrinit */
+};
+
+static struct cb_ops cb_vxn_ops = {
+ nulldev, /* cb_open */
+ nulldev, /* cb_close */
+ nodev, /* cb_strategy */
+ nodev, /* cb_print */
+ nodev, /* cb_dump */
+ nodev, /* cb_read */
+ nodev, /* cb_write */
+ nodev, /* cb_ioctl */
+ nodev, /* cb_devmap */
+ nodev, /* cb_mmap */
+ nodev, /* cb_segmap */
+ nochpoll, /* cb_chpoll */
+ ddi_prop_op, /* cb_prop_op */
+ &vxn_info, /* cb_stream */
+ D_NEW|D_MP /* cb_flag */
+};
+
+static struct dev_ops vxn_ops = {
+ DEVO_REV, /* devo_rev */
+ 0, /* devo_refcnt */
+ gld_getinfo, /* devo_getinfo */
+ nulldev, /* devo_identify */
+ nulldev, /* devo_probe */
+ Vxn_Attach, /* devo_attach */
+ Vxn_Detach, /* devo_detach */
+ nodev, /* devo_reset */
+ &cb_vxn_ops, /* devo_cb_ops */
+ NULL, /* devo_bus_ops */
+ ddi_power /* devo_power */
+};
+
+static struct modldrv modldrv = {
+ &mod_driverops,
+ ident,
+ &vxn_ops,
+};
+
+static struct modlinkage modlinkage = {
+ MODREV_1, {&modldrv, NULL,}
+};
+
+
+/*
+ * Module load entry point
+ */
+int
+_init(void)
+{
+ int err;
+
+ DPRINTF(5, (CE_CONT, "vxn: _init:\n"));
+ /* Initialize interface list */
+ vxnList.next = vxnList.prev = &vxnList;
+ mutex_init(&vxnListLock, NULL, MUTEX_DRIVER, NULL);
+ if ((err = mod_install(&modlinkage)) != 0) {
+ mutex_destroy(&vxnListLock);
+ }
+ return err;
+}
+
+/*
+ * Module unload entry point
+ */
+int
+_fini(void)
+{
+ int err;
+
+ DPRINTF(5, (CE_CONT, "vxn: _fini:\n"));
+ if ((err = mod_remove(&modlinkage)) == 0) {
+ mutex_destroy(&vxnListLock);
+ }
+ return err;
+}
+
+/*
+ * Module info entry point
+ */
+int
+_info(struct modinfo *modinfop)
+{
+ return (mod_info(&modlinkage, modinfop));
+}
+
diff --git a/usr/src/uts/intel/io/vmxnet/vmxnet.conf b/usr/src/uts/intel/io/vmxnet/vmxnet.conf
new file mode 100644
index 0000000000..eb3b160412
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/vmxnet.conf
@@ -0,0 +1,24 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
diff --git a/usr/src/uts/intel/io/vmxnet/vmxnet2_def.h b/usr/src/uts/intel/io/vmxnet/vmxnet2_def.h
new file mode 100644
index 0000000000..5ea437df72
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/vmxnet2_def.h
@@ -0,0 +1,436 @@
+/*********************************************************
+ * Copyright (C) 2004 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *********************************************************/
+
+/*********************************************************
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version. You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+#ifndef _VMXNET2_DEF_H_
+#define _VMXNET2_DEF_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMK_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#define INCLUDE_ALLOW_DISTRIBUTE
+#include "includeCheck.h"
+
+#include "net_sg.h"
+#include "vmxnet_def.h"
+
+
+/*
+ * Magic number that identifies this version of the vmxnet protocol.
+ */
+#define VMXNET2_MAGIC 0xbabe864f
+
+/* size of the rx ring */
+#define VMXNET2_MAX_NUM_RX_BUFFERS 128
+#define VMXNET2_DEFAULT_NUM_RX_BUFFERS 100
+
+
+/* size of the rx ring when enhanced vmxnet is used */
+#define ENHANCED_VMXNET2_MAX_NUM_RX_BUFFERS 512
+#define ENHANCED_VMXNET2_DEFAULT_NUM_RX_BUFFERS 150
+
+/* size of the 2nd rx ring */
+#define VMXNET2_MAX_NUM_RX_BUFFERS2 2048
+#define VMXNET2_DEFAULT_NUM_RX_BUFFERS2 512
+
+/* size of the tx ring */
+#define VMXNET2_MAX_NUM_TX_BUFFERS 128
+#define VMXNET2_DEFAULT_NUM_TX_BUFFERS 100
+
+/* size of the tx ring when tso/jf is used */
+#define VMXNET2_MAX_NUM_TX_BUFFERS_TSO 512
+#define VMXNET2_DEFAULT_NUM_TX_BUFFERS_TSO 256
+
+enum {
+ VMXNET2_OWNERSHIP_DRIVER,
+ VMXNET2_OWNERSHIP_DRIVER_PENDING,
+ VMXNET2_OWNERSHIP_NIC,
+ VMXNET2_OWNERSHIP_NIC_PENDING,
+ VMXNET2_OWNERSHIP_NIC_FRAG,
+ VMXNET2_OWNERSHIP_DRIVER_FRAG,
+};
+
+#define VMXNET2_SG_DEFAULT_LENGTH 6
+
+typedef struct Vmxnet2_SG_Array {
+ uint16 addrType;
+ uint16 length;
+ NetSG_Elem sg[VMXNET2_SG_DEFAULT_LENGTH];
+} Vmxnet2_SG_Array;
+
+typedef struct Vmxnet2_RxRingEntry {
+ uint64 paddr; /* Physical address of the packet data. */
+ uint32 bufferLength; /* The length of the data at paddr. */
+ uint32 actualLength; /* The actual length of the received data. */
+ uint16 ownership; /* Who owns the packet. */
+ uint16 flags; /* Flags as defined below. */
+ uint32 index; /*
+ * Currently:
+ *
+ * This is being used as an packet index to
+ * rx buffers.
+ *
+ * Originally:
+ *
+ * was void* driverData ("Driver specific data.")
+ * which was used for sk_buf**s in Linux and
+ * VmxnetRxBuff*s in Windows. It could not be
+ * here because the structure needs to be the
+ * same size between architectures, and it was
+ * not used on the device side, anyway. Look
+ * for its replacement in
+ * Vmxnet_Private.rxRingBuffPtr on Linux and
+ * VmxnetAdapter.rxRingBuffPtr on Windows.
+ */
+} Vmxnet2_RxRingEntry;
+
+/*
+ * Vmxnet2_RxRingEntry flags:
+ *
+ * VMXNET2_RX_HW_XSUM_OK The hardware verified the TCP/UDP checksum.
+ * VMXNET2_RX_WITH_FRAG More data is in the 2nd ring
+ * VMXNET2_RX_FRAG_EOP This is the last frag, the only valid flag for
+ * 2nd ring entry
+ *
+ */
+#define VMXNET2_RX_HW_XSUM_OK 0x01
+#define VMXNET2_RX_WITH_FRAG 0x02
+#define VMXNET2_RX_FRAG_EOP 0x04
+
+typedef struct Vmxnet2_TxRingEntry {
+ uint16 flags; /* Flags as defined below. */
+ uint16 ownership; /* Who owns this packet. */
+ uint32 extra; /*
+ * was void* driverData ("Driver specific data.")
+ * which was used for sk_buf*s in Linux and
+ * VmxnetTxInfo*s in Windows. It could not be
+ * here because the structure needs to be the
+ * same size between architectures, and it was
+ * not used on the device side, anyway. Look
+ * for its replacement in
+ * Vmxnet_Private.txRingBuffPtr on Linux and
+ * VmxnetAdapter.txRingBuffPtr on Windows.
+ */
+ uint32 tsoMss; /* TSO pkt MSS */
+ Vmxnet2_SG_Array sg; /* Packet data. */
+} Vmxnet2_TxRingEntry;
+
+/*
+ * Vmxnet2_TxRingEntry flags:
+ *
+ * VMXNET2_TX_CAN_KEEP The implementation can return the tx ring entry
+ * to the driver when it is ready as opposed to
+ * before the transmit call from the driver completes.
+ * VMXNET2_TX_RING_LOW The driver's transmit ring buffer is low on free
+ * slots.
+ * VMXNET2_TX_HW_XSUM The hardware should perform the TCP/UDP checksum
+ * VMXNET2_TX_TSO The hardware should do TCP segmentation.
+ * VMXNET2_TX_PINNED_BUFFER The driver used one of the preallocated vmkernel
+ * buffers *and* it has been pinned with Net_PinTxBuffers.
+ * VMXNET2_TX_MORE This is *not* the last tx entry for the pkt.
+ * All flags except VMXNET2_TX_MORE are ignored
+ * for the subsequent tx entries.
+ */
+#define VMXNET2_TX_CAN_KEEP 0x0001
+#define VMXNET2_TX_RING_LOW 0x0002
+#define VMXNET2_TX_HW_XSUM 0x0004
+#define VMXNET2_TX_TSO 0x0008
+#define VMXNET2_TX_PINNED_BUFFER 0x0010
+#define VMXNET2_TX_MORE 0x0020
+
+/*
+ * Structure used by implementations. This structure allows the inline
+ * functions below to be used.
+ */
+typedef struct Vmxnet2_RxRingInfo {
+ Vmxnet2_RxRingEntry *base; /* starting addr of the ring */
+ uint32 nicNext; /* next entry to use in the ring */
+ uint32 ringLength; /* # of entries in the ring */
+ PA startPA; /* PA of the starting addr of the ring */
+#ifdef VMX86_DEBUG
+ const char *name;
+#endif
+} Vmxnet2_RxRingInfo;
+
+typedef struct Vmxnet2_TxRingInfo {
+ Vmxnet2_TxRingEntry *base; /* starting addr of the ring */
+ uint32 nicNext; /* next entry to use in the ring */
+ uint32 ringLength; /* # of entries in the ring */
+ PA startPA; /* PA of the starting addr of the ring */
+#ifdef VMX86_DEBUG
+ const char *name;
+#endif
+} Vmxnet2_TxRingInfo;
+
+typedef struct Vmxnet2_ImplData {
+ Vmxnet2_RxRingInfo rxRing;
+ Vmxnet2_RxRingInfo rxRing2;
+ Vmxnet2_TxRingInfo txRing;
+
+ struct PhysMem_Token *ddPhysMemToken;
+} Vmxnet2_ImplData;
+
+/*
+ * Used internally for performance studies. By default this will be off so there
+ * should be no compatibilty or other interferences.
+ */
+
+/* #define ENABLE_VMXNET2_PROFILING */
+
+
+#ifdef ENABLE_VMXNET2_PROFILING
+typedef struct Vmxnet2_VmmStats {
+ uint64 vIntTSC; /* the time that virtual int was posted */
+ uint64 actionsCount; /* Number of actions received */
+ uint64 numWasteActions; /* Number of non-productive actions */
+} Vmxnet2_VmmStats;
+#endif
+
+typedef struct Vmxnet2_DriverStats {
+ uint32 transmits; /* # of times that the drivers transmit function */
+ /* is called. The driver could transmit more */
+ /* than one packet per call. */
+ uint32 pktsTransmitted; /* # of packets transmitted. */
+ uint32 noCopyTransmits; /* # of packets that are transmitted without */
+ /* copying any data. */
+ uint32 copyTransmits; /* # of packets that are transmittted by copying */
+ /* the data into a buffer. */
+ uint32 maxTxsPending; /* Max # of transmits outstanding. */
+ uint32 txStopped; /* # of times that transmits got stopped because */
+ /* the tx ring was full. */
+ uint32 txRingOverflow; /* # of times that transmits got deferred bc */
+ /* the tx ring was full. This must be >= */
+ /* txStopped since there will be one */
+ /* txStopped when the ring fills up and then */
+ /* one txsRingOverflow for each packet that */
+ /* that gets deferred until there is space. */
+ uint32 interrupts; /* # of times interrupted. */
+ uint32 pktsReceived; /* # of packets received. */
+ uint32 rxBuffersLow; /* # of times that the driver was low on */
+ /* receive buffers. */
+#ifdef ENABLE_VMXNET2_PROFILING
+ Vmxnet2_VmmStats vmmStats; /* vmm related stats for perf study */
+#endif
+} Vmxnet2_DriverStats;
+
+/*
+ * Shared data structure between the vm, the vmm, and the vmkernel.
+ * This structure was originally arranged to try to group common data
+ * on 32-byte cache lines, but bit rot and the fact that we no longer
+ * run on many CPUs with that cacheline size killed that optimization.
+ * vmxnet3 should target 128 byte sizes and alignments to optimize for
+ * the 64 byte cacheline pairs on P4.
+ */
+typedef struct Vmxnet2_DriverData {
+ /*
+ * Magic must be first.
+ */
+ Vmxnet_DDMagic magic;
+
+ /*
+ * Receive fields.
+ */
+ uint32 rxRingLength; /* Length of the receive ring. */
+ uint32 rxDriverNext; /* Index of the next packet that will */
+ /* be filled in by the impl */
+
+ uint32 rxRingLength2; /* Length of the 2nd receive ring. */
+ uint32 rxDriverNext2; /* Index of the next packet that will */
+ /* be filled in by the impl */
+
+ uint32 notUsed1; /* was "irq" */
+
+ /*
+ * Interface flags and multicast filter.
+ */
+ uint32 ifflags;
+ uint32 LADRF[VMXNET_MAX_LADRF];
+
+ /*
+ * Transmit fields
+ */
+ uint32 txDontClusterSize; /* All packets <= this will be transmitted */
+ /* immediately, regardless of clustering */
+ /* settings [was fill[1]] */
+ uint32 txRingLength; /* Length of the transmit ring. */
+ uint32 txDriverCur; /* Index of the next packet to be */
+ /* returned by the implementation.*/
+ uint32 txDriverNext; /* Index of the entry in the ring */
+ /* buffer to use for the next packet.*/
+ uint32 txStopped; /* The driver has stopped transmitting */
+ /* because its ring buffer is full.*/
+ uint32 txClusterLength; /* Maximum number of packets to */
+ /* put in the ring buffer before */
+ /* asking the implementation to */
+ /* transmit the packets in the buffer.*/
+ uint32 txNumDeferred; /* Number of packets that have been */
+ /* queued in the ring buffer since */
+ /* the last time the implementation */
+ /* was asked to transmit. */
+ uint32 notUsed3; /* This field is deprecated but still used */
+ /* as minXmitPhysLength on the escher branch. */
+ /* It cannot be used for other purposes */
+ /* until escher vms no longer are allowed */
+ /* to install this driver. */
+
+ uint32 totalRxBuffers; /* used by esx for max rx buffers */
+ uint64 rxBufferPhysStart; /* used by esx for pinng rx buffers */
+ /*
+ * Extra fields for future expansion.
+ */
+ uint32 extra[2];
+
+ uint16 maxFrags; /* # of frags the driver can handle */
+ uint16 featureCtl; /* for driver to enable some feature */
+
+ /*
+ * The following fields are used to save the nicNext indexes part
+ * of implData in the vmkernel when disconnecting the adapter, we
+ * need them when we reconnect. This mechanism is used for
+ * checkpointing as well.
+ */
+ uint32 savedRxNICNext;
+ uint32 savedRxNICNext2;
+ uint32 savedTxNICNext;
+
+ /*
+ * Fields used during initialization or debugging.
+ */
+ uint32 length;
+ uint32 rxRingOffset;
+ uint32 rxRingOffset2;
+ uint32 txRingOffset;
+ uint32 debugLevel;
+ uint32 txBufferPhysStart;
+ uint32 txBufferPhysLength;
+ uint32 txPktMaxSize;
+
+ /*
+ * Driver statistics.
+ */
+ Vmxnet2_DriverStats stats;
+} Vmxnet2_DriverData;
+
+/*
+ * Shared between VMM and Vmkernel part of vmxnet2 to optimize action posting
+ * VMM writes 1 (don't post) or 0 (okay to post) and vmk reads this.
+ */
+typedef struct VmxnetVMKShared {
+ uint32 dontPostActions;
+} VmxnetVMKShared;
+
+#if defined VMX86_VMX || defined VMKERNEL
+
+/*
+ * Inline functions used to assist the implementation of the vmxnet interface.
+ */
+
+/*
+ * Get the next empty packet out of the receive ring and move to
+ * the next packet.
+ */
+static INLINE Vmxnet2_RxRingEntry *
+Vmxnet2_GetNextRx(Vmxnet2_RxRingInfo *ri, uint16 ownership)
+{
+ Vmxnet2_RxRingEntry *rre = ri->base + ri->nicNext;
+ if (rre->ownership == ownership) {
+ VMXNET_INC(ri->nicNext, ri->ringLength);
+ } else {
+ rre = NULL;
+ }
+
+ return rre;
+}
+
+/*
+ * Return ownership of a packet in the receive ring to the driver.
+ */
+static INLINE void
+Vmxnet2_PutRx(Vmxnet2_RxRingEntry *rre, uint32 pktLength, uint16 ownership)
+{
+ rre->actualLength = pktLength;
+ COMPILER_MEM_BARRIER();
+ rre->ownership = ownership;
+}
+
+/*
+ * Get the next pending packet out of the transmit ring.
+ */
+static INLINE Vmxnet2_TxRingEntry *
+Vmxnet2_GetNextTx(Vmxnet2_TxRingInfo *ri)
+{
+ Vmxnet2_TxRingEntry *txre = ri->base + ri->nicNext;
+ if (txre->ownership == VMXNET2_OWNERSHIP_NIC) {
+ return txre;
+ } else {
+ return NULL;
+ }
+}
+
+/*
+ * Move to the next entry in the transmit ring.
+ */
+static INLINE unsigned int
+Vmxnet2_IncNextTx(Vmxnet2_TxRingInfo *ri)
+{
+ unsigned int prev = ri->nicNext;
+ Vmxnet2_TxRingEntry *txre = ri->base + ri->nicNext;
+
+ txre->ownership = VMXNET2_OWNERSHIP_NIC_PENDING;
+
+ VMXNET_INC(ri->nicNext, ri->ringLength);
+ return prev;
+}
+
+/*
+ * Get the indicated entry from transmit ring.
+ */
+static INLINE Vmxnet2_TxRingEntry *
+Vmxnet2_GetTxEntry(Vmxnet2_TxRingInfo *ri, unsigned int idx)
+{
+ return ri->base + idx;
+}
+
+/*
+ * Get the indicated entry from the given rx ring
+ */
+static INLINE Vmxnet2_RxRingEntry *
+Vmxnet2_GetRxEntry(Vmxnet2_RxRingInfo *ri, unsigned int idx)
+{
+ return ri->base + idx;
+}
+
+#endif /* defined VMX86_VMX || defined VMKERNEL */
+
+#endif
+
diff --git a/usr/src/uts/intel/io/vmxnet/vmxnet_def.h b/usr/src/uts/intel/io/vmxnet/vmxnet_def.h
new file mode 100644
index 0000000000..703466c995
--- /dev/null
+++ b/usr/src/uts/intel/io/vmxnet/vmxnet_def.h
@@ -0,0 +1,184 @@
+/*********************************************************
+ * Copyright (C) 1999 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *********************************************************/
+
+/*********************************************************
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version. You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+#ifndef _VMXNET_DEF_H_
+#define _VMXNET_DEF_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMK_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#define INCLUDE_ALLOW_DISTRIBUTE
+#include "includeCheck.h"
+
+#include "net_sg.h"
+#include "vmnet_def.h"
+
+
+/*
+ * Vmxnet I/O ports, used by both the vmxnet driver and
+ * the device emulation code.
+ */
+
+#define VMXNET_INIT_ADDR 0x00
+#define VMXNET_INIT_LENGTH 0x04
+#define VMXNET_TX_ADDR 0x08
+#define VMXNET_COMMAND_ADDR 0x0c
+#define VMXNET_MAC_ADDR 0x10
+#define VMXNET_LOW_VERSION 0x18
+#define VMXNET_HIGH_VERSION 0x1c
+#define VMXNET_STATUS_ADDR 0x20
+#define VMXNET_TOE_INIT_ADDR 0x24
+#define VMXNET_APROM_ADDR 0x28
+#define VMXNET_INT_ENABLE_ADDR 0x30
+#define VMXNET_WAKE_PKT_PATTERNS 0x34
+
+/*
+ * Vmxnet command register values.
+ */
+#define VMXNET_CMD_INTR_ACK 0x0001
+#define VMXNET_CMD_UPDATE_LADRF 0x0002
+#define VMXNET_CMD_UPDATE_IFF 0x0004
+#define VMXNET_CMD_UNUSED 1 0x0008
+#define VMXNET_CMD_UNUSED_2 0x0010
+#define VMXNET_CMD_INTR_DISABLE 0x0020
+#define VMXNET_CMD_INTR_ENABLE 0x0040
+#define VMXNET_CMD_UNUSED_3 0x0080
+#define VMXNET_CMD_CHECK_TX_DONE 0x0100
+#define VMXNET_CMD_GET_NUM_RX_BUFFERS 0x0200
+#define VMXNET_CMD_GET_NUM_TX_BUFFERS 0x0400
+#define VMXNET_CMD_PIN_TX_BUFFERS 0x0800
+#define VMXNET_CMD_GET_CAPABILITIES 0x1000
+#define VMXNET_CMD_GET_FEATURES 0x2000
+#define VMXNET_CMD_SET_POWER_FULL 0x4000
+#define VMXNET_CMD_SET_POWER_LOW 0x8000
+
+/*
+ * Vmxnet status register values.
+ */
+#define VMXNET_STATUS_CONNECTED 0x0001
+#define VMXNET_STATUS_ENABLED 0x0002
+#define VMXNET_STATUS_TX_PINNED 0x0004
+
+/*
+ * Values for the interface flags.
+ */
+#define VMXNET_IFF_PROMISC 0x01
+#define VMXNET_IFF_BROADCAST 0x02
+#define VMXNET_IFF_MULTICAST 0x04
+#define VMXNET_IFF_DIRECTED 0x08
+
+/*
+ * Length of the multicast address filter.
+ */
+#define VMXNET_MAX_LADRF 2
+
+/*
+ * Size of Vmxnet APROM.
+ */
+#define VMXNET_APROM_SIZE 6
+
+/*
+ * An invalid ring index.
+ */
+#define VMXNET_INVALID_RING_INDEX (-1)
+
+/*
+ * Features that are implemented by the driver. These are driver
+ * specific so not all features will be listed here. In addition not all
+ * drivers have to pay attention to these feature flags.
+ *
+ * VMXNET_FEATURE_ZERO_COPY_TX The driver won't do any copies as long as
+ * the packet length is >
+ * Vmxnet_DriverData.minTxPhysLength.
+ *
+ * VMXNET_FEATURE_TSO The driver will use the TSO capabilities
+ * of the underlying hardware if available
+ * and enabled.
+ *
+ * VMXNET_FEATURE_JUMBO_FRAME The driver can send/rcv jumbo frame
+ *
+ * VMXNET_FEATURE_LPD The backend can deliver large pkts
+ */
+#define VMXNET_FEATURE_ZERO_COPY_TX 0x01
+#define VMXNET_FEATURE_TSO 0x02
+#define VMXNET_FEATURE_JUMBO_FRAME 0x04
+#define VMXNET_FEATURE_LPD 0x08
+
+/*
+ * Define the set of capabilities required by each feature above
+ */
+#define VMXNET_FEATURE_ZERO_COPY_TX_CAPS VMXNET_CAP_SG
+#define VMXNET_FEATURE_TSO_CAPS VMXNET_CAP_TSO
+#define VMXNET_HIGHEST_FEATURE_BIT VMXNET_FEATURE_TSO
+
+#define VMXNET_INC(val, max) \
+ val++; \
+ if (UNLIKELY(val == max)) { \
+ val = 0; \
+ }
+
+/*
+ * code that just wants to switch on the different versions of the
+ * guest<->implementation protocol can cast driver data to this.
+ */
+typedef uint32 Vmxnet_DDMagic;
+
+/*
+ * Wake packet pattern commands sent through VMXNET_WAKE_PKT_PATTERNS port
+ */
+
+#define VMXNET_PM_OPCODE_START 3 /* args: cnt of wake packet patterns */
+#define VMXNET_PM_OPCODE_LEN 2 /* args: index of wake packet pattern */
+ /* number of pattern byte values */
+#define VMXNET_PM_OPCODE_DATA 1 /* args: index of wake packet pattern */
+ /* offset in pattern byte values list */
+ /* packet byte offset */
+ /* packet byte value */
+#define VMXNET_PM_OPCODE_END 0 /* args: <none> */
+
+typedef union Vmxnet_WakePktCmd {
+ uint32 pktData : 32;
+ struct {
+ unsigned cmd : 2; /* wake packet pattern cmd [from list above] */
+ unsigned cnt : 3; /* cnt wk pkt pttrns 1..MAX_NUM_FILTER_PTTRNS */
+ unsigned ind : 3; /* ind wk pkt pttrn 0..MAX_NUM_FILTER_PTTRNS-1 */
+ unsigned lenOff : 8; /* num pttrn byte vals 1..MAX_PKT_FILTER_SIZE */
+ /* OR offset in pattern byte values list */
+ /* 0..MAX_PKT_FILTER_SIZE-1 */
+ unsigned byteOff : 8; /* pkt byte offset 0..MAX_PKT_FILTER_SIZE-1 */
+ unsigned byteVal : 8; /* packet byte value 0..255 */
+ } pktPttrn;
+} Vmxnet_WakePktCmd;
+
+#endif /* _VMXNET_DEF_H_ */
diff --git a/usr/src/uts/intel/ip/ip.global-objs.debug64 b/usr/src/uts/intel/ip/ip.global-objs.debug64
index 40d5bd498b..b05d399caf 100644
--- a/usr/src/uts/intel/ip/ip.global-objs.debug64
+++ b/usr/src/uts/intel/ip/ip.global-objs.debug64
@@ -21,6 +21,7 @@
#
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2011 Nexenta Systems, Inc. All rights reserved
+# Copyright 2012 Joyent, Inc. All rights reserved
#
arp_m_tbl
@@ -49,6 +50,10 @@ cl_sctp_listen
cl_sctp_unlisten
conn_drain_nthreads
dce_cache
+dce_reclaim_cv
+dce_reclaim_lock
+dce_reclaim_shutdown
+dce_reclaim_thread
default_ip6_asp_table
do_tcp_fusion
do_tcpzcopy
@@ -107,6 +112,9 @@ ip6_ftable_hash_size
ip6opt_ls
ip_cgtp_filter_rev
ip_conn_cache
+ip_dce_hash_size
+ip_dce_reclaim_interval
+ip_dce_reclaim_threshold_hard
ip_debug
ip_g_all_ones
ip_helper_stream_info
@@ -246,6 +254,8 @@ sqset_lock
squeue_cache
squeue_drain_ms
squeue_drain_ns
+squeue_drain_stack_needed
+squeue_drain_stack_toodeep
squeue_workerwait_ms
squeue_workerwait_tick
tcp_acceptor_rinit
diff --git a/usr/src/uts/intel/ip/ip.global-objs.obj64 b/usr/src/uts/intel/ip/ip.global-objs.obj64
index 5c56fe7efd..7dd30502a0 100644
--- a/usr/src/uts/intel/ip/ip.global-objs.obj64
+++ b/usr/src/uts/intel/ip/ip.global-objs.obj64
@@ -21,6 +21,7 @@
#
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2011 Nexenta Systems, Inc. All rights reserved
+# Copyright 2012 Joyent, Inc. All rights reserved
#
arp_m_tbl
@@ -49,6 +50,10 @@ cl_sctp_listen
cl_sctp_unlisten
conn_drain_nthreads
dce_cache
+dce_reclaim_cv
+dce_reclaim_lock
+dce_reclaim_shutdown
+dce_reclaim_thread
default_ip6_asp_table
do_tcp_fusion
do_tcpzcopy
@@ -107,6 +112,9 @@ ip6_ftable_hash_size
ip6opt_ls
ip_cgtp_filter_rev
ip_conn_cache
+ip_dce_hash_size
+ip_dce_reclaim_interval
+ip_dce_reclaim_threshold_hard
ip_debug
ip_g_all_ones
ip_helper_stream_info
@@ -243,6 +251,8 @@ sqset_lock
squeue_cache
squeue_drain_ms
squeue_drain_ns
+squeue_drain_stack_needed
+squeue_drain_stack_toodeep
squeue_workerwait_ms
squeue_workerwait_tick
tcp_acceptor_rinit
diff --git a/usr/src/cmd/lp/filter/postscript/postcomm/Makefile b/usr/src/uts/intel/ipd/Makefile
index 0e8985d2e5..1bb76d0728 100644
--- a/usr/src/cmd/lp/filter/postscript/postcomm/Makefile
+++ b/usr/src/uts/intel/ipd/Makefile
@@ -20,42 +20,42 @@
# CDDL HEADER END
#
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 1989-2002 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2012 Joyent, Inc. All rights reserved.
# Use is subject to license terms.
#
-# cmd/lp/filter/postscript/postcomm/Makefile
-#
-include ../../../Makefile.lp
+UTSBASE = ../..
-PROG= postcomm
+MODULE = ipd
+OBJECTS = $(IPD_OBJS:%=$(OBJS_DIR)/%)
+LINTS = $(IPD_OBJS:%.o=$(LINTS_DIR)/%.ln)
+ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
+CONF_SRCDIR = $(UTSBASE)/common/inet/ipd
-SRCS= postcomm.c
+include $(UTSBASE)/intel/Makefile.intel
-OBJS= $(SRCS:.c=.o)
+ALL_TARGET = $(BINARY) $(SRC_CONFILE)
+LINT_TARGET = $(MODULE).lint
+INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
+LDFLAGS += -dy -Nmisc/neti -Nmisch/hook
-COMMONDIR = ../common
-CPPFLAGS = -I. -I$(COMMONDIR) $(CPPFLAGS.master)
+.KEEP_STATE:
-POFILE = lp_filter_postscript_postcomm.po
+def: $(DEF_DEPS)
-.KEEP_STATE:
+all: $(ALL_DEPS)
-all: $(PROG)
+clean: $(CLEAN_DEPS)
-install: all .WAIT $(ROOTLIBLPPOSTPROG)
+clobber: $(CLOBBER_DEPS)
-clean:
- $(RM) $(OBJS)
+lint: $(LINT_DEPS)
-strip:
- $(STRIP) $(PROG)
+modlintlib: $(MODLINTLIB_DEPS)
-lint: lint_PROG
+clean.lint: $(CLEAN_LINT_DEPS)
-include ../../../../Makefile.targ
+install: $(INSTALL_DEPS)
-include ../Makefile.msg
+include $(UTSBASE)/intel/Makefile.targ
diff --git a/usr/src/uts/intel/ipf/ipf.global-objs.debug64 b/usr/src/uts/intel/ipf/ipf.global-objs.debug64
index 203dd14416..e381d01a09 100644
--- a/usr/src/uts/intel/ipf/ipf.global-objs.debug64
+++ b/usr/src/uts/intel/ipf/ipf.global-objs.debug64
@@ -37,10 +37,12 @@ ipf_cb_ops
ipf_dev_info
ipf_devfiles
ipf_kstat_tmp
+ipf_minor
ipf_ops
ipf_proxy_debug
ipf_stack_lock
ipf_stacks
+ipf_state
ipfilter_version
ipfncb
ipl_magic
diff --git a/usr/src/uts/intel/kdi/kdi_idt.c b/usr/src/uts/intel/kdi/kdi_idt.c
index 4bd6ca73e1..73d9628e62 100644
--- a/usr/src/uts/intel/kdi/kdi_idt.c
+++ b/usr/src/uts/intel/kdi/kdi_idt.c
@@ -217,7 +217,8 @@ kdi_idt_patch(caddr_t code, size_t sz)
continue; /* uses kernel's handler */
gd = &kdi_idt[i];
- patch = (uchar_t *)GATESEG_GETOFFSET(gd) + KDI_MSR_PATCHOFF;
+ patch = ((uchar_t *)(uintptr_t)GATESEG_GETOFFSET(gd)) +
+ KDI_MSR_PATCHOFF;
/*
* We can't ASSERT that there's a nop here, because this may be
diff --git a/usr/src/cmd/lp/lib/class/Makefile b/usr/src/uts/intel/lxprocfs/Makefile
index c6003dd8b6..c6ffec0199 100644
--- a/usr/src/cmd/lp/lib/class/Makefile
+++ b/usr/src/uts/intel/lxprocfs/Makefile
@@ -20,48 +20,69 @@
# CDDL HEADER END
#
#
+# uts/intel/lxprocfs/Makefile
+#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
+# This makefile drives the production of the lxprocfs file system
+# kernel module.
#
-# cmd/lp/lib/class/Makefile
+# intel architecture dependent
#
-LIBRARY = liblpcls.a
+#
+# Path to the base of the uts directory tree (usually /usr/src/uts).
+#
+UTSBASE = ../..
-OBJECTS = delclass.o \
- freeclass.o \
- getclass.o \
- putclass.o
+#
+# Define the module and object file sets.
+#
+MODULE = lxprocfs
+OBJECTS = $(LXPROC_OBJS:%=$(OBJS_DIR)/%)
+LINTS = $(LXPROC_OBJS:%.o=$(LINTS_DIR)/%.ln)
+ROOTMODULE = $(ROOT_FS_DIR)/$(MODULE)
+#
+# Include common rules.
+#
+include $(UTSBASE)/intel/Makefile.intel
+
+#
+# Define targets
+#
+ALL_TARGET = $(BINARY)
+LINT_TARGET = $(MODULE).lint
+INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
-include ../../../../lib/Makefile.lib
-include ../../Makefile.lp
+#
+# Depends on procfs
+#
+LDFLAGS += -dy -Nfs/procfs
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
+#
+# Default build targets.
+#
+.KEEP_STATE:
-CPPFLAGS = -I../../include $(CPPFLAGS.master) $(C_PICFLAGS)
+def: $(DEF_DEPS)
-POFILE = lp_lib_class.po
+all: $(ALL_DEPS)
-.KEEP_STATE:
+clean: $(CLEAN_DEPS)
-all install : $(LIBS)
+clobber: $(CLOBBER_DEPS)
-include ../../../../lib/Makefile.targ
+lint: $(LINT_DEPS)
-CLEANFILES += llib-llpcls.ln
-LINTFLAGS = -nvx
-SRCS= $(OBJECTS:%.o=%.c)
-LINT_CPPFLAGS = -I../../include $(CPPFLAGS.master)
+modlintlib: $(MODLINTLIB_DEPS)
-lint: lintlib
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) $(SRCS)
+clean.lint: $(CLEAN_LINT_DEPS)
-lintlib:
- $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) -o lpcls llib-llpcls
+install: $(INSTALL_DEPS)
-include ../Makefile.msg
+#
+# Include common targets.
+#
+include $(UTSBASE)/intel/Makefile.targ
diff --git a/usr/src/uts/intel/opteron_pcbe/Makefile b/usr/src/uts/intel/opteron_pcbe/Makefile
index aea8e89fbe..7431f50329 100644
--- a/usr/src/uts/intel/opteron_pcbe/Makefile
+++ b/usr/src/uts/intel/opteron_pcbe/Makefile
@@ -34,7 +34,7 @@ UTSBASE = ../..
MODULE = pcbe.AuthenticAMD
OBJECTS = $(OPTERON_PCBE_OBJS:%=$(OBJS_DIR)/%)
LINTS = $(OPTERON_PCBE_OBJS:%.o=$(LINTS_DIR)/%.ln)
-ROOTMODULE = $(USR_PCBE_DIR)/$(MODULE)
+ROOTMODULE = $(ROOT_PSM_PCBE_DIR)/$(MODULE)
#
# Include common rules.
diff --git a/usr/src/uts/intel/os/driver_aliases b/usr/src/uts/intel/os/driver_aliases
index 3116819932..1cea287121 100644
--- a/usr/src/uts/intel/os/driver_aliases
+++ b/usr/src/uts/intel/os/driver_aliases
@@ -1 +1,2 @@
asy "pci11c1,480"
+vmxnet "pci15ad,720"
diff --git a/usr/src/uts/intel/os/name_to_major b/usr/src/uts/intel/os/name_to_major
index c5ad4c9bf0..1fb86f9a50 100644
--- a/usr/src/uts/intel/os/name_to_major
+++ b/usr/src/uts/intel/os/name_to_major
@@ -2,3 +2,4 @@ md 85
devinfo 88
asy 106
did 239
+vmxnet 270
diff --git a/usr/src/uts/intel/p123_pcbe/Makefile b/usr/src/uts/intel/p123_pcbe/Makefile
index 71b7d9bcec..d591d52e62 100644
--- a/usr/src/uts/intel/p123_pcbe/Makefile
+++ b/usr/src/uts/intel/p123_pcbe/Makefile
@@ -35,8 +35,8 @@ UTSBASE = ../..
MODULE = pcbe.GenuineIntel.6
OBJECTS = $(P123_PCBE_OBJS:%=$(OBJS_DIR)/%)
LINTS = $(P123_PCBE_OBJS:%.o=$(LINTS_DIR)/%.ln)
-ROOTMODULE = $(USR_PCBE_DIR)/$(MODULE)
-ROOTLINK = $(USR_PCBE_DIR)/pcbe.GenuineIntel.5
+ROOTMODULE = $(ROOT_PSM_PCBE_DIR)/$(MODULE)
+ROOTLINK = $(ROOT_PSM_PCBE_DIR)/pcbe.GenuineIntel.5
#
# Include common rules.
diff --git a/usr/src/uts/intel/p4_pcbe/Makefile b/usr/src/uts/intel/p4_pcbe/Makefile
index 07689646c1..42dc040eee 100644
--- a/usr/src/uts/intel/p4_pcbe/Makefile
+++ b/usr/src/uts/intel/p4_pcbe/Makefile
@@ -35,7 +35,7 @@ UTSBASE = ../..
MODULE = pcbe.GenuineIntel.15
OBJECTS = $(P4_PCBE_OBJS:%=$(OBJS_DIR)/%)
LINTS = $(P4_PCBE_OBJS:%.o=$(LINTS_DIR)/%.ln)
-ROOTMODULE = $(USR_PCBE_DIR)/$(MODULE)
+ROOTMODULE = $(ROOT_PSM_PCBE_DIR)/$(MODULE)
#
# Include common rules.
diff --git a/usr/src/uts/intel/sngl_brand/Makefile b/usr/src/uts/intel/sngl_brand/Makefile
new file mode 100644
index 0000000000..cec2141e89
--- /dev/null
+++ b/usr/src/uts/intel/sngl_brand/Makefile
@@ -0,0 +1,98 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2012, Joyent, Inc. All rights reserved.
+#
+# This makefile drives the production of the kernel component of
+# the SNGL brand
+#
+
+#
+# Path to the base of the uts directory tree (usually /usr/src/uts).
+#
+UTSBASE = ../..
+SNGL_BASE = $(UTSBASE)/common/brand/sngl
+
+#
+# Define the module and object file sets.
+#
+MODULE = sngl_brand
+OBJECTS = $(SNGL_BRAND_OBJS:%=$(OBJS_DIR)/%)
+LINTS = $(SNGL_BRAND_OBJS:%.o=$(LINTS_DIR)/%.ln)
+ROOTMODULE = $(USR_BRAND_DIR)/$(MODULE)
+
+#
+# Include common rules.
+#
+include $(UTSBASE)/intel/Makefile.intel
+
+#
+# Define targets
+#
+ALL_TARGET = $(BINARY)
+LINT_TARGET = $(MODULE).lint
+INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
+
+
+#
+# Update compiler variables.
+#
+INC_PATH += -I$(SNGL_BASE) -I$(OBJS_DIR)
+AS_INC_PATH += -I$(UTSBASE)/i86pc/genassym/$(OBJS_DIR)
+LDFLAGS += -dy -Nexec/elfexec
+
+#
+# Ugh, this is a gross hack. sngl_brand_asm.s uses lots of defines
+# to simplify variable access. All these defines work fine for amd64
+# compiles because when compiling for amd64 we use the GNU assembler,
+# gas. For 32-bit code we use the Sun assembler, as. Unfortunatly
+# as does not handle certian constructs that gas does. So rather than
+# make our code less readable, we'll just use gas to compile our 32-bit
+# code as well.
+#
+i386_AS = $(amd64_AS)
+
+#
+# Default build targets.
+#
+.KEEP_STATE:
+
+def: $(DEF_DEPS)
+
+all: $(ALL_DEPS)
+
+clean: $(CLEAN_DEPS)
+
+clobber: $(CLOBBER_DEPS)
+
+lint: $(LINT_DEPS)
+
+modlintlib: $(MODLINTLIB_DEPS)
+
+clean.lint: $(CLEAN_LINT_DEPS)
+
+install: $(INSTALL_DEPS)
+
+#
+# Include common targets.
+#
+include $(UTSBASE)/intel/Makefile.targ
diff --git a/usr/src/uts/intel/sys/acpi/acapps.h b/usr/src/uts/intel/sys/acpi/acapps.h
index 2d3f84186e..0382ca8547 100644
--- a/usr/src/uts/intel/sys/acpi/acapps.h
+++ b/usr/src/uts/intel/sys/acpi/acapps.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,7 @@
/* Common info for tool signons */
#define ACPICA_NAME "Intel ACPI Component Architecture"
-#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2011 Intel Corporation"
+#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2012 Intel Corporation"
#if ACPI_MACHINE_WIDTH == 64
#define ACPI_WIDTH "-64"
@@ -81,6 +81,15 @@
Prefix, ACPICA_COPYRIGHT, \
Prefix
+/* Macros for usage messages */
+
+#define ACPI_USAGE_HEADER(Usage) \
+ printf ("Usage: %s\nOptions:\n", Usage);
+
+#define ACPI_OPTION(Name, Description) \
+ printf (" %-18s%s\n", Name, Description);
+
+
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define ACPI_TABLE_FILE_SUFFIX ".dat"
diff --git a/usr/src/uts/intel/sys/acpi/accommon.h b/usr/src/uts/intel/sys/acpi/accommon.h
index 58bb83ddb6..7e6d05aa8d 100644
--- a/usr/src/uts/intel/sys/acpi/accommon.h
+++ b/usr/src/uts/intel/sys/acpi/accommon.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/acconfig.h b/usr/src/uts/intel/sys/acpi/acconfig.h
index 7a2107aa76..7880516e47 100644
--- a/usr/src/uts/intel/sys/acpi/acconfig.h
+++ b/usr/src/uts/intel/sys/acpi/acconfig.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -86,6 +86,23 @@
*/
#define ACPI_CHECKSUM_ABORT FALSE
+/*
+ * Generate a version of ACPICA that only supports "reduced hardware"
+ * platforms (as defined in ACPI 5.0). Set to TRUE to generate a specialized
+ * version of ACPICA that ONLY supports the ACPI 5.0 "reduced hardware"
+ * model. In other words, no ACPI hardware is supported.
+ *
+ * If TRUE, this means no support for the following:
+ * PM Event and Control registers
+ * SCI interrupt (and handler)
+ * Fixed Events
+ * General Purpose Events (GPEs)
+ * Global Lock
+ * ACPI PM timer
+ * FACS table (Waking vectors and Global Lock)
+ */
+#define ACPI_REDUCED_HARDWARE FALSE
+
/******************************************************************************
*
@@ -95,7 +112,7 @@
/* Version of ACPI supported */
-#define ACPI_CA_SUPPORT_LEVEL 3
+#define ACPI_CA_SUPPORT_LEVEL 5
/* Maximum count for a semaphore object */
@@ -123,7 +140,11 @@
/* Maximum sleep allowed via Sleep() operator */
-#define ACPI_MAX_SLEEP 20000 /* Two seconds */
+#define ACPI_MAX_SLEEP 2000 /* 2000 millisec == two seconds */
+
+/* Address Range lists are per-SpaceId (Memory and I/O only) */
+
+#define ACPI_ADDRESS_RANGE_MAX 2
/******************************************************************************
@@ -183,9 +204,10 @@
#define ACPI_RSDP_CHECKSUM_LENGTH 20
#define ACPI_RSDP_XCHECKSUM_LENGTH 36
-/* SMBus and IPMI bidirectional buffer size */
+/* SMBus, GSBus and IPMI bidirectional buffer size */
#define ACPI_SMBUS_BUFFER_SIZE 34
+#define ACPI_GSBUS_BUFFER_SIZE 34
#define ACPI_IPMI_BUFFER_SIZE 66
/* _SxD and _SxW control methods */
diff --git a/usr/src/uts/intel/sys/acpi/acdebug.h b/usr/src/uts/intel/sys/acpi/acdebug.h
index 2c1fe73429..bcc505c8d5 100644
--- a/usr/src/uts/intel/sys/acpi/acdebug.h
+++ b/usr/src/uts/intel/sys/acpi/acdebug.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -107,6 +107,10 @@ AcpiDbDisplayTableInfo (
char *TableArg);
void
+AcpiDbDisplayTemplate (
+ char *BufferArg);
+
+void
AcpiDbUnloadAcpiTable (
char *TableArg,
char *InstanceArg);
@@ -133,18 +137,20 @@ void
AcpiDbDisplayResources (
char *ObjectArg);
+ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiDbDisplayGpes (
- void);
+ void))
void
AcpiDbDisplayHandlers (
void);
+ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiDbGenerateGpe (
char *GpeArg,
- char *BlockArg);
+ char *BlockArg))
/*
diff --git a/usr/src/uts/intel/sys/acpi/acdisasm.h b/usr/src/uts/intel/sys/acpi/acdisasm.h
index aaaac11d86..9ec12713b4 100644
--- a/usr/src/uts/intel/sys/acpi/acdisasm.h
+++ b/usr/src/uts/intel/sys/acpi/acdisasm.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -63,7 +63,7 @@
typedef const struct acpi_dmtable_info
{
UINT8 Opcode;
- UINT8 Offset;
+ UINT16 Offset;
char *Name;
UINT8 Flags;
@@ -80,57 +80,82 @@ typedef const struct acpi_dmtable_info
/*
* Values for Opcode above.
- * Note: 0-7 must not change, used as a flag shift value
+ * Note: 0-7 must not change, they are used as a flag shift value. Other
+ * than those, new values can be added wherever appropriate.
*/
-#define ACPI_DMT_FLAG0 0
-#define ACPI_DMT_FLAG1 1
-#define ACPI_DMT_FLAG2 2
-#define ACPI_DMT_FLAG3 3
-#define ACPI_DMT_FLAG4 4
-#define ACPI_DMT_FLAG5 5
-#define ACPI_DMT_FLAG6 6
-#define ACPI_DMT_FLAG7 7
-#define ACPI_DMT_FLAGS0 8
-#define ACPI_DMT_FLAGS2 9
-#define ACPI_DMT_UINT8 10
-#define ACPI_DMT_UINT16 11
-#define ACPI_DMT_UINT24 12
-#define ACPI_DMT_UINT32 13
-#define ACPI_DMT_UINT56 14
-#define ACPI_DMT_UINT64 15
-#define ACPI_DMT_STRING 16
-#define ACPI_DMT_NAME4 17
-#define ACPI_DMT_NAME6 18
-#define ACPI_DMT_NAME8 19
-#define ACPI_DMT_CHKSUM 20
-#define ACPI_DMT_SPACEID 21
-#define ACPI_DMT_GAS 22
-#define ACPI_DMT_ASF 23
-#define ACPI_DMT_DMAR 24
-#define ACPI_DMT_HEST 25
-#define ACPI_DMT_HESTNTFY 26
-#define ACPI_DMT_HESTNTYP 27
-#define ACPI_DMT_MADT 28
-#define ACPI_DMT_SRAT 29
-#define ACPI_DMT_EXIT 30
-#define ACPI_DMT_SIG 31
-#define ACPI_DMT_FADTPM 32
-#define ACPI_DMT_BUF16 33
-#define ACPI_DMT_IVRS 34
-#define ACPI_DMT_BUFFER 35
-#define ACPI_DMT_PCI_PATH 36
-#define ACPI_DMT_EINJACT 37
-#define ACPI_DMT_EINJINST 38
-#define ACPI_DMT_ERSTACT 39
-#define ACPI_DMT_ERSTINST 40
-#define ACPI_DMT_ACCWIDTH 41
-#define ACPI_DMT_UNICODE 42
-#define ACPI_DMT_UUID 43
-#define ACPI_DMT_DEVICE_PATH 44
-#define ACPI_DMT_LABEL 45
-#define ACPI_DMT_BUF7 46
-#define ACPI_DMT_BUF128 47
-#define ACPI_DMT_SLIC 48
+typedef enum
+{
+ /* Simple Data Types */
+
+ ACPI_DMT_FLAG0 = 0,
+ ACPI_DMT_FLAG1 = 1,
+ ACPI_DMT_FLAG2 = 2,
+ ACPI_DMT_FLAG3 = 3,
+ ACPI_DMT_FLAG4 = 4,
+ ACPI_DMT_FLAG5 = 5,
+ ACPI_DMT_FLAG6 = 6,
+ ACPI_DMT_FLAG7 = 7,
+ ACPI_DMT_FLAGS0,
+ ACPI_DMT_FLAGS1,
+ ACPI_DMT_FLAGS2,
+ ACPI_DMT_FLAGS4,
+ ACPI_DMT_UINT8,
+ ACPI_DMT_UINT16,
+ ACPI_DMT_UINT24,
+ ACPI_DMT_UINT32,
+ ACPI_DMT_UINT40,
+ ACPI_DMT_UINT48,
+ ACPI_DMT_UINT56,
+ ACPI_DMT_UINT64,
+ ACPI_DMT_BUF7,
+ ACPI_DMT_BUF16,
+ ACPI_DMT_BUF128,
+ ACPI_DMT_SIG,
+ ACPI_DMT_STRING,
+ ACPI_DMT_NAME4,
+ ACPI_DMT_NAME6,
+ ACPI_DMT_NAME8,
+
+ /* Types that are decoded to strings and miscellaneous */
+
+ ACPI_DMT_ACCWIDTH,
+ ACPI_DMT_CHKSUM,
+ ACPI_DMT_GAS,
+ ACPI_DMT_SPACEID,
+ ACPI_DMT_UNICODE,
+ ACPI_DMT_UUID,
+
+ /* Types used only for the Data Table Compiler */
+
+ ACPI_DMT_BUFFER,
+ ACPI_DMT_DEVICE_PATH,
+ ACPI_DMT_LABEL,
+ ACPI_DMT_PCI_PATH,
+
+ /* Types that are specific to particular ACPI tables */
+
+ ACPI_DMT_ASF,
+ ACPI_DMT_DMAR,
+ ACPI_DMT_EINJACT,
+ ACPI_DMT_EINJINST,
+ ACPI_DMT_ERSTACT,
+ ACPI_DMT_ERSTINST,
+ ACPI_DMT_FADTPM,
+ ACPI_DMT_HEST,
+ ACPI_DMT_HESTNTFY,
+ ACPI_DMT_HESTNTYP,
+ ACPI_DMT_IVRS,
+ ACPI_DMT_MADT,
+ ACPI_DMT_PMTT,
+ ACPI_DMT_SLIC,
+ ACPI_DMT_SRAT,
+
+ /* Special opcodes */
+
+ ACPI_DMT_EXTRA_TEXT,
+ ACPI_DMT_EXIT
+
+} ACPI_ENTRY_TYPES;
typedef
void (*ACPI_DMTABLE_HANDLER) (
@@ -175,6 +200,11 @@ ACPI_STATUS (*ASL_WALK_CALLBACK) (
#define ASL_WALK_CALLBACK_DEFINED
#endif
+typedef
+void (*ACPI_RESOURCE_HANDLER) (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
typedef struct acpi_resource_tag
{
@@ -202,6 +232,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoBert[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoBgrt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[];
@@ -212,6 +243,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[];
@@ -221,7 +253,13 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdtHdr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[];
@@ -254,14 +292,34 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0A[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst0B[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMpst2[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1a[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmttHdr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3ptHdr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt1[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[];
@@ -354,6 +412,10 @@ AcpiDmDumpFadt (
ACPI_TABLE_HEADER *Table);
void
+AcpiDmDumpFpdt (
+ ACPI_TABLE_HEADER *Table);
+
+void
AcpiDmDumpHest (
ACPI_TABLE_HEADER *Table);
@@ -362,17 +424,29 @@ AcpiDmDumpIvrs (
ACPI_TABLE_HEADER *Table);
void
+AcpiDmDumpMadt (
+ ACPI_TABLE_HEADER *Table);
+
+void
AcpiDmDumpMcfg (
ACPI_TABLE_HEADER *Table);
void
-AcpiDmDumpMadt (
+AcpiDmDumpMpst (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpMsct (
ACPI_TABLE_HEADER *Table);
+void
+AcpiDmDumpPcct (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpPmtt (
+ ACPI_TABLE_HEADER *Table);
+
UINT32
AcpiDmDumpRsdp (
ACPI_TABLE_HEADER *Table);
@@ -381,6 +455,10 @@ void
AcpiDmDumpRsdt (
ACPI_TABLE_HEADER *Table);
+UINT32
+AcpiDmDumpS3pt (
+ ACPI_TABLE_HEADER *Table);
+
void
AcpiDmDumpSlic (
ACPI_TABLE_HEADER *Table);
@@ -671,6 +749,18 @@ AcpiDmVendorLargeDescriptor (
UINT32 Level);
void
+AcpiDmGpioDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmSerialBusDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
AcpiDmVendorCommon (
char *Name,
UINT8 *ByteData,
@@ -694,6 +784,12 @@ AcpiDmDmaDescriptor (
UINT32 Level);
void
+AcpiDmFixedDmaDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
AcpiDmIoDescriptor (
AML_RESOURCE *Resource,
UINT32 Length,
diff --git a/usr/src/uts/intel/sys/acpi/acdispat.h b/usr/src/uts/intel/sys/acpi/acdispat.h
index ae8dd93154..0699ee77a1 100644
--- a/usr/src/uts/intel/sys/acpi/acdispat.h
+++ b/usr/src/uts/intel/sys/acpi/acdispat.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/acevents.h b/usr/src/uts/intel/sys/acpi/acevents.h
index 8681ed5f38..3b874f1075 100644
--- a/usr/src/uts/intel/sys/acpi/acevents.h
+++ b/usr/src/uts/intel/sys/acpi/acevents.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -85,13 +85,15 @@ ACPI_STATUS
AcpiEvInitGlobalLockHandler (
void);
+ACPI_HW_DEPENDENT_RETURN_OK (
ACPI_STATUS
AcpiEvAcquireGlobalLock(
- UINT16 Timeout);
+ UINT16 Timeout))
+ACPI_HW_DEPENDENT_RETURN_OK (
ACPI_STATUS
AcpiEvReleaseGlobalLock(
- void);
+ void))
ACPI_STATUS
AcpiEvRemoveGlobalLockHandler (
@@ -154,9 +156,10 @@ AcpiEvInitializeGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context);
+ACPI_HW_DEPENDENT_RETURN_OK (
ACPI_STATUS
AcpiEvDeleteGpeBlock (
- ACPI_GPE_BLOCK_INFO *GpeBlock);
+ ACPI_GPE_BLOCK_INFO *GpeBlock))
UINT32
AcpiEvGpeDispatch (
@@ -171,9 +174,10 @@ ACPI_STATUS
AcpiEvGpeInitialize (
void);
+ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiEvUpdateGpes (
- ACPI_OWNER_ID TableOwnerId);
+ ACPI_OWNER_ID TableOwnerId))
ACPI_STATUS
AcpiEvMatchGpeMethod (
@@ -228,7 +232,8 @@ AcpiEvInitializeOpRegions (
ACPI_STATUS
AcpiEvAddressSpaceDispatch (
- ACPI_OPERAND_OBJECT *RegionObj,
+ ACPI_OPERAND_OBJECT *RegionObj,
+ ACPI_OPERAND_OBJECT *FieldObj,
UINT32 Function,
UINT32 RegionOffset,
UINT32 BitWidth,
@@ -334,9 +339,9 @@ UINT32
AcpiEvInitializeSCI (
UINT32 ProgramSCI);
+ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiEvTerminate (
- void);
-
+ void))
#endif /* __ACEVENTS_H__ */
diff --git a/usr/src/uts/intel/sys/acpi/acexcep.h b/usr/src/uts/intel/sys/acpi/acexcep.h
index 7d426d0f26..10f5a113da 100644
--- a/usr/src/uts/intel/sys/acpi/acexcep.h
+++ b/usr/src/uts/intel/sys/acpi/acexcep.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -92,8 +92,9 @@
#define AE_SAME_HANDLER (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL)
#define AE_NO_HANDLER (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_OWNER_ID_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_CONFIGURED (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL)
-#define AE_CODE_ENV_MAX 0x001B
+#define AE_CODE_ENV_MAX 0x001C
/*
@@ -222,7 +223,8 @@ char const *AcpiGbl_ExceptionNames_Env[] =
"AE_ABORT_METHOD",
"AE_SAME_HANDLER",
"AE_NO_HANDLER",
- "AE_OWNER_ID_LIMIT"
+ "AE_OWNER_ID_LIMIT",
+ "AE_NOT_CONFIGURED"
};
char const *AcpiGbl_ExceptionNames_Pgm[] =
diff --git a/usr/src/uts/intel/sys/acpi/acglobal.h b/usr/src/uts/intel/sys/acpi/acglobal.h
index ebbae0f595..79e53d07e2 100644
--- a/usr/src/uts/intel/sys/acpi/acglobal.h
+++ b/usr/src/uts/intel/sys/acpi/acglobal.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -128,6 +128,12 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE);
*/
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE);
+/*
+ * Disable runtime checking and repair of values returned by control methods.
+ * Use only if the repair is causing a problem on a particular machine.
+ */
+UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableAutoRepair, FALSE);
+
/* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */
@@ -137,7 +143,18 @@ UINT32 AcpiGbl_TraceFlags;
ACPI_NAME AcpiGbl_TraceMethodName;
BOOLEAN AcpiGbl_SystemAwakeAndRunning;
-#endif
+/*
+ * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning
+ * that the ACPI hardware is no longer required. A flag in the FADT indicates
+ * a reduced HW machine, and that flag is duplicated here for convenience.
+ */
+BOOLEAN AcpiGbl_ReducedHardware;
+
+#endif /* DEFINE_ACPI_GLOBALS */
+
+/* Do not disassemble buffers to resource descriptors */
+
+ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_NoResourceDisassembly, FALSE);
/*****************************************************************************
*
@@ -150,8 +167,12 @@ BOOLEAN AcpiGbl_SystemAwakeAndRunning;
* found in the RSDT/XSDT.
*/
ACPI_EXTERN ACPI_TABLE_LIST AcpiGbl_RootTableList;
+
+#if (!ACPI_REDUCED_HARDWARE)
ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS;
+#endif /* !ACPI_REDUCED_HARDWARE */
+
/* These addresses are calculated from the FADT Event Block addresses */
ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aStatus;
@@ -177,7 +198,7 @@ ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth;
/*****************************************************************************
*
- * Mutual exlusion within ACPICA subsystem
+ * Mutual exclusion within ACPICA subsystem
*
****************************************************************************/
@@ -233,8 +254,7 @@ ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_OperandCache;
/* Global handlers */
-ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify;
-ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify;
+ACPI_EXTERN ACPI_GLOBAL_NOTIFY_HANDLER AcpiGbl_GlobalNotify[2];
ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler;
ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler;
ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler;
@@ -265,6 +285,7 @@ ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized;
ACPI_EXTERN UINT8 AcpiGbl_OsiData;
ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces;
+ACPI_EXTERN ACPI_ADDRESS_RANGE *AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX];
#ifndef DEFINE_ACPI_GLOBALS
@@ -362,6 +383,8 @@ ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB;
*
****************************************************************************/
+#if (!ACPI_REDUCED_HARDWARE)
+
ACPI_EXTERN UINT8 AcpiGbl_AllGpesInitialized;
ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead;
ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS];
@@ -370,6 +393,7 @@ ACPI_EXTERN void *AcpiGbl_GlobalEventHandlerContext;
ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS];
+#endif /* !ACPI_REDUCED_HARDWARE */
/*****************************************************************************
*
diff --git a/usr/src/uts/intel/sys/acpi/achware.h b/usr/src/uts/intel/sys/acpi/achware.h
index ae4a77a9f2..f607d1702a 100644
--- a/usr/src/uts/intel/sys/acpi/achware.h
+++ b/usr/src/uts/intel/sys/acpi/achware.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -110,6 +110,49 @@ AcpiHwClearAcpiStatus (
/*
+ * hwsleep - sleep/wake support (Legacy sleep registers)
+ */
+ACPI_STATUS
+AcpiHwLegacySleep (
+ UINT8 SleepState,
+ UINT8 Flags);
+
+ACPI_STATUS
+AcpiHwLegacyWakePrep (
+ UINT8 SleepState,
+ UINT8 Flags);
+
+ACPI_STATUS
+AcpiHwLegacyWake (
+ UINT8 SleepState,
+ UINT8 Flags);
+
+
+/*
+ * hwesleep - sleep/wake support (Extended FADT-V5 sleep registers)
+ */
+void
+AcpiHwExecuteSleepMethod (
+ char *MethodName,
+ UINT32 IntegerArgument);
+
+ACPI_STATUS
+AcpiHwExtendedSleep (
+ UINT8 SleepState,
+ UINT8 Flags);
+
+ACPI_STATUS
+AcpiHwExtendedWakePrep (
+ UINT8 SleepState,
+ UINT8 Flags);
+
+ACPI_STATUS
+AcpiHwExtendedWake (
+ UINT8 SleepState,
+ UINT8 Flags);
+
+
+/*
* hwvalid - Port I/O with validation
*/
ACPI_STATUS
@@ -188,22 +231,4 @@ AcpiHwDerivePciId (
ACPI_HANDLE PciRegion);
-/*
- * hwtimer - ACPI Timer prototypes
- */
-ACPI_STATUS
-AcpiGetTimerResolution (
- UINT32 *Resolution);
-
-ACPI_STATUS
-AcpiGetTimer (
- UINT32 *Ticks);
-
-ACPI_STATUS
-AcpiGetTimerDuration (
- UINT32 StartTicks,
- UINT32 EndTicks,
- UINT32 *TimeElapsed);
-
-
#endif /* __ACHWARE_H__ */
diff --git a/usr/src/uts/intel/sys/acpi/acinterp.h b/usr/src/uts/intel/sys/acpi/acinterp.h
index 8ac828c59c..45e9814f79 100644
--- a/usr/src/uts/intel/sys/acpi/acinterp.h
+++ b/usr/src/uts/intel/sys/acpi/acinterp.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -642,6 +642,10 @@ AcpiExIntegerToString (
char *Dest,
UINT64 Value);
+BOOLEAN
+AcpiIsValidSpaceId (
+ UINT8 SpaceId);
+
/*
* exregion - default OpRegion handlers
diff --git a/usr/src/uts/intel/sys/acpi/aclocal.h b/usr/src/uts/intel/sys/acpi/aclocal.h
index 2eb6fc21d4..68ea95b7c8 100644
--- a/usr/src/uts/intel/sys/acpi/aclocal.h
+++ b/usr/src/uts/intel/sys/acpi/aclocal.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,7 @@ typedef UINT32 ACPI_MUTEX_HANDLE;
/* Total number of aml opcodes defined */
-#define AML_NUM_OPCODES 0x7F
+#define AML_NUM_OPCODES 0x81
/* Forward declarations */
@@ -213,7 +213,6 @@ typedef struct acpi_namespace_node
#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
-#define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */
#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
@@ -286,12 +285,16 @@ typedef struct acpi_create_field_info
ACPI_NAMESPACE_NODE *FieldNode;
ACPI_NAMESPACE_NODE *RegisterNode;
ACPI_NAMESPACE_NODE *DataRegisterNode;
+ ACPI_NAMESPACE_NODE *ConnectionNode;
+ UINT8 *ResourceBuffer;
UINT32 BankValue;
UINT32 FieldBitPosition;
UINT32 FieldBitLength;
+ UINT16 ResourceLength;
UINT8 FieldFlags;
UINT8 Attribute;
UINT8 FieldType;
+ UINT8 AccessLength;
} ACPI_CREATE_FIELD_INFO;
@@ -359,7 +362,8 @@ typedef struct acpi_name_info
/*
* Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
- * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
+ * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
+ * ACPI_PTYPE2_FIX_VAR
*/
typedef struct acpi_package_info
{
@@ -411,6 +415,7 @@ typedef struct acpi_predefined_data
char *Pathname;
const ACPI_PREDEFINED_INFO *Predefined;
union acpi_operand_object *ParentPackage;
+ ACPI_NAMESPACE_NODE *Node;
UINT32 Flags;
UINT8 NodeFlags;
@@ -419,6 +424,7 @@ typedef struct acpi_predefined_data
/* Defines for Flags field above */
#define ACPI_OBJECT_REPAIRED 1
+#define ACPI_OBJECT_WRAPPED 2
/*
@@ -710,6 +716,15 @@ ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
struct acpi_walk_state *WalkState);
+/* Global handlers for AML Notifies */
+
+typedef struct acpi_global_notify_handler
+{
+ ACPI_NOTIFY_HANDLER Handler;
+ void *Context;
+
+} ACPI_GLOBAL_NOTIFY_HANDLER;
+
/*
* Notify info - used to pass info to the deferred notify
* handler/dispatcher.
@@ -717,8 +732,10 @@ ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
typedef struct acpi_notify_info
{
ACPI_STATE_COMMON
+ UINT8 HandlerListId;
ACPI_NAMESPACE_NODE *Node;
- union acpi_operand_object *HandlerObj;
+ union acpi_operand_object *HandlerListHead;
+ ACPI_GLOBAL_NOTIFY_HANDLER *Global;
} ACPI_NOTIFY_INFO;
@@ -750,6 +767,17 @@ typedef
ACPI_STATUS (*ACPI_EXECUTE_OP) (
struct acpi_walk_state *WalkState);
+/* Address Range info block */
+
+typedef struct acpi_address_range
+{
+ struct acpi_address_range *Next;
+ ACPI_NAMESPACE_NODE *RegionNode;
+ ACPI_PHYSICAL_ADDRESS StartAddress;
+ ACPI_PHYSICAL_ADDRESS EndAddress;
+
+} ACPI_ADDRESS_RANGE;
+
/*****************************************************************************
*
@@ -774,6 +802,17 @@ typedef struct acpi_opcode_info
} ACPI_OPCODE_INFO;
+/* Structure for Resource Tag information */
+
+typedef struct acpi_tag_info
+{
+ UINT32 BitOffset;
+ UINT32 BitLength;
+
+} ACPI_TAG_INFO;
+
+/* Value associated with the parse object */
+
typedef union acpi_parse_value
{
UINT64 Integer; /* Integer constant (Up to 64 bits) */
@@ -782,6 +821,7 @@ typedef union acpi_parse_value
UINT8 *Buffer; /* buffer or string */
char *Name; /* NULL terminated string */
union acpi_parse_object *Arg; /* arguments and contained ops */
+ ACPI_TAG_INFO Tag; /* Resource descriptor tag info */
} ACPI_PARSE_VALUE;
@@ -1112,7 +1152,7 @@ typedef struct acpi_port_info
#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
#define ACPI_RESOURCE_NAME_IO 0x40
#define ACPI_RESOURCE_NAME_FIXED_IO 0x48
-#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50
+#define ACPI_RESOURCE_NAME_FIXED_DMA 0x50
#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
@@ -1134,7 +1174,9 @@ typedef struct acpi_port_info
#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
-#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B
+#define ACPI_RESOURCE_NAME_GPIO 0x8C
+#define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E
+#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E
/*****************************************************************************
diff --git a/usr/src/uts/intel/sys/acpi/acmacros.h b/usr/src/uts/intel/sys/acpi/acmacros.h
index 6581d111c9..cdb9cb109e 100644
--- a/usr/src/uts/intel/sys/acpi/acmacros.h
+++ b/usr/src/uts/intel/sys/acpi/acmacros.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -428,7 +428,6 @@
#endif /* ACPI_SIMPLE_RETURN_MACROS */
-
/* Conditional execution */
#define ACPI_DEBUG_EXEC(a) a
@@ -477,6 +476,14 @@
#endif /* ACPI_DEBUG_OUTPUT */
+
+#if (!ACPI_REDUCED_HARDWARE)
+#define ACPI_HW_OPTIONAL_FUNCTION(addr) addr
+#else
+#define ACPI_HW_OPTIONAL_FUNCTION(addr) NULL
+#endif
+
+
/*
* Some code only gets executed when the debugger is built in.
* Note that this is entirely independent of whether the
diff --git a/usr/src/uts/intel/sys/acpi/acnames.h b/usr/src/uts/intel/sys/acpi/acnames.h
index e08302dd30..4c5fab696f 100644
--- a/usr/src/uts/intel/sys/acpi/acnames.h
+++ b/usr/src/uts/intel/sys/acpi/acnames.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,6 +46,7 @@
/* Method names - these methods can appear anywhere in the namespace */
+#define METHOD_NAME__SB_ "_SB_"
#define METHOD_NAME__HID "_HID"
#define METHOD_NAME__CID "_CID"
#define METHOD_NAME__UID "_UID"
@@ -58,16 +59,17 @@
#define METHOD_NAME__PRT "_PRT"
#define METHOD_NAME__CRS "_CRS"
#define METHOD_NAME__PRS "_PRS"
+#define METHOD_NAME__AEI "_AEI"
#define METHOD_NAME__PRW "_PRW"
#define METHOD_NAME__SRS "_SRS"
/* Method names - these methods must appear at the namespace root */
-#define METHOD_NAME__BFS "\\_BFS"
-#define METHOD_NAME__GTS "\\_GTS"
-#define METHOD_NAME__PTS "\\_PTS"
-#define METHOD_NAME__SST "\\_SI._SST"
-#define METHOD_NAME__WAK "\\_WAK"
+#define METHOD_PATHNAME__BFS "\\_BFS"
+#define METHOD_PATHNAME__GTS "\\_GTS"
+#define METHOD_PATHNAME__PTS "\\_PTS"
+#define METHOD_PATHNAME__SST "\\_SI._SST"
+#define METHOD_PATHNAME__WAK "\\_WAK"
/* Definitions of the predefined namespace names */
@@ -78,7 +80,6 @@
#define ACPI_PREFIX_LOWER (UINT32) 0x69706361 /* "acpi" */
#define ACPI_NS_ROOT_PATH "\\"
-#define ACPI_NS_SYSTEM_BUS "_SB_"
#endif /* __ACNAMES_H__ */
diff --git a/usr/src/uts/intel/sys/acpi/acnamesp.h b/usr/src/uts/intel/sys/acpi/acnamesp.h
index 77f65d0ae4..4a91108eae 100644
--- a/usr/src/uts/intel/sys/acpi/acnamesp.h
+++ b/usr/src/uts/intel/sys/acpi/acnamesp.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -368,8 +368,9 @@ AcpiNsRepairObject (
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
ACPI_STATUS
-AcpiNsRepairPackageList (
+AcpiNsWrapWithPackage (
ACPI_PREDEFINED_DATA *Data,
+ ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ObjDescPtr);
ACPI_STATUS
diff --git a/usr/src/uts/intel/sys/acpi/acobject.h b/usr/src/uts/intel/sys/acpi/acobject.h
index 27a21e6858..f2f8a1cfb1 100644
--- a/usr/src/uts/intel/sys/acpi/acobject.h
+++ b/usr/src/uts/intel/sys/acpi/acobject.h
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -246,8 +246,7 @@ typedef struct acpi_object_method
* Common fields for objects that support ASL notifications
*/
#define ACPI_COMMON_NOTIFY_INFO \
- union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
- union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
+ union acpi_operand_object *NotifyList[2]; /* Handlers for system/device notifies */\
union acpi_operand_object *Handler; /* Handler for Address space */
@@ -320,6 +319,7 @@ typedef struct acpi_object_thermal_zone
UINT32 BaseByteOffset; /* Byte offset within containing object */\
UINT32 Value; /* Value to store into the Bank or Index register */\
UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
+ UINT8 AccessLength; /* For serial regions/fields */
typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
@@ -335,7 +335,9 @@ typedef struct acpi_object_region_field
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
+ UINT16 ResourceLength;
union acpi_operand_object *RegionObj; /* Containing OpRegion object */
+ UINT8 *ResourceBuffer; /* ResourceTemplate for serial regions/fields */
} ACPI_OBJECT_REGION_FIELD;
@@ -386,8 +388,10 @@ typedef struct acpi_object_notify_handler
{
ACPI_OBJECT_COMMON_HEADER
ACPI_NAMESPACE_NODE *Node; /* Parent device */
- ACPI_NOTIFY_HANDLER Handler;
+ UINT32 HandlerType; /* Type: Device/System/Both */
+ ACPI_NOTIFY_HANDLER Handler; /* Handler addess */
void *Context;
+ union acpi_operand_object *Next[2]; /* Device and System handler lists */
} ACPI_OBJECT_NOTIFY_HANDLER;
@@ -463,6 +467,7 @@ typedef struct acpi_object_extra
{
ACPI_OBJECT_COMMON_HEADER
ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */
+ ACPI_NAMESPACE_NODE *ScopeNode;
void *RegionContext; /* Region-specific data */
UINT8 *AmlStart;
UINT32 AmlLength;
diff --git a/usr/src/uts/intel/sys/acpi/acopcode.h b/usr/src/uts/intel/sys/acpi/acopcode.h
index d8e1c75a7b..e182a07e61 100644
--- a/usr/src/uts/intel/sys/acpi/acopcode.h
+++ b/usr/src/uts/intel/sys/acpi/acopcode.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -94,6 +94,7 @@
#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
+#define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_CONTINUE_OP ARG_NONE
#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
@@ -165,6 +166,7 @@
#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_REVISION_OP ARG_NONE
#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
+#define ARGP_SERIALFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
@@ -225,6 +227,7 @@
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
+#define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
@@ -296,6 +299,7 @@
#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
#define ARGI_REVISION_OP ARG_NONE
#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
+#define ARGI_SERIALFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
diff --git a/usr/src/uts/intel/sys/acpi/acoutput.h b/usr/src/uts/intel/sys/acpi/acoutput.h
index c8007e21fb..a1d89d408c 100644
--- a/usr/src/uts/intel/sys/acpi/acoutput.h
+++ b/usr/src/uts/intel/sys/acpi/acoutput.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -72,6 +72,7 @@
#define ACPI_EXAMPLE 0x00004000
#define ACPI_DRIVER 0x00008000
#define DT_COMPILER 0x00010000
+#define ASL_PREPROCESSOR 0x00020000
#define ACPI_ALL_COMPONENTS 0x0001FFFF
#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
diff --git a/usr/src/uts/intel/sys/acpi/acparser.h b/usr/src/uts/intel/sys/acpi/acparser.h
index 83b3c4fc06..f46d3cbc2c 100644
--- a/usr/src/uts/intel/sys/acpi/acparser.h
+++ b/usr/src/uts/intel/sys/acpi/acparser.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/acpi.h b/usr/src/uts/intel/sys/acpi/acpi.h
index 0f4f607120..aa40219112 100644
--- a/usr/src/uts/intel/sys/acpi/acpi.h
+++ b/usr/src/uts/intel/sys/acpi/acpi.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/acpiosxf.h b/usr/src/uts/intel/sys/acpi/acpiosxf.h
index 85b0ff6108..b79d0e6ade 100644
--- a/usr/src/uts/intel/sys/acpi/acpiosxf.h
+++ b/usr/src/uts/intel/sys/acpi/acpiosxf.h
@@ -9,7 +9,7 @@
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -112,6 +112,12 @@ AcpiOsTableOverride (
ACPI_TABLE_HEADER *ExistingTable,
ACPI_TABLE_HEADER **NewTable);
+ACPI_STATUS
+AcpiOsPhysicalTableOverride (
+ ACPI_TABLE_HEADER *ExistingTable,
+ ACPI_PHYSICAL_ADDRESS *NewAddress,
+ UINT32 *NewTableLength);
+
/*
* Spinlock primitives
@@ -302,13 +308,13 @@ AcpiOsWritePort (
ACPI_STATUS
AcpiOsReadMemory (
ACPI_PHYSICAL_ADDRESS Address,
- UINT32 *Value,
+ UINT64 *Value,
UINT32 Width);
ACPI_STATUS
AcpiOsWriteMemory (
ACPI_PHYSICAL_ADDRESS Address,
- UINT32 Value,
+ UINT64 Value,
UINT32 Width);
diff --git a/usr/src/uts/intel/sys/acpi/acpixf.h b/usr/src/uts/intel/sys/acpi/acpixf.h
index 82b677e615..7478c78940 100644
--- a/usr/src/uts/intel/sys/acpi/acpixf.h
+++ b/usr/src/uts/intel/sys/acpi/acpixf.h
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,8 +48,9 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20110527
+#define ACPI_CA_VERSION 0x20120420
+#include "acconfig.h"
#include "actypes.h"
#include "actbl.h"
@@ -59,6 +60,7 @@
extern UINT32 AcpiCurrentGpeCount;
extern ACPI_TABLE_FADT AcpiGbl_FADT;
extern BOOLEAN AcpiGbl_SystemAwakeAndRunning;
+extern BOOLEAN AcpiGbl_ReducedHardware; /* ACPI 5.0 */
/* Runtime configuration of debug print levels */
@@ -76,6 +78,35 @@ extern UINT32 AcpiGbl_TraceFlags;
extern UINT8 AcpiGbl_EnableAmlDebugObject;
extern UINT8 AcpiGbl_CopyDsdtLocally;
extern UINT8 AcpiGbl_TruncateIoAddresses;
+extern UINT8 AcpiGbl_DisableAutoRepair;
+
+
+/*
+ * Hardware-reduced prototypes. All interfaces that use these macros will
+ * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
+ * is set to TRUE.
+ */
+#if (!ACPI_REDUCED_HARDWARE)
+#define ACPI_HW_DEPENDENT_RETURN_STATUS(Prototype) \
+ Prototype;
+
+#define ACPI_HW_DEPENDENT_RETURN_OK(Prototype) \
+ Prototype;
+
+#define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \
+ Prototype;
+
+#else
+#define ACPI_HW_DEPENDENT_RETURN_STATUS(Prototype) \
+ static ACPI_INLINE Prototype {return(AE_NOT_CONFIGURED);}
+
+#define ACPI_HW_DEPENDENT_RETURN_OK(Prototype) \
+ static ACPI_INLINE Prototype {return(AE_OK);}
+
+#define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \
+ static ACPI_INLINE Prototype {}
+
+#endif /* !ACPI_REDUCED_HARDWARE */
/*
@@ -107,13 +138,15 @@ AcpiTerminate (
/*
* Miscellaneous global interfaces
*/
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiEnable (
- void);
+ void))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiDisable (
- void);
+ void))
ACPI_STATUS
AcpiSubsystemStatus (
@@ -143,6 +176,13 @@ ACPI_STATUS
AcpiRemoveInterface (
ACPI_STRING InterfaceName);
+UINT32
+AcpiCheckAddressRange (
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_SIZE Length,
+ BOOLEAN Warn);
+
/*
* ACPI Memory management
@@ -312,35 +352,40 @@ AcpiInstallInitializationHandler (
ACPI_INIT_HANDLER Handler,
UINT32 Function);
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiInstallGlobalEventHandler (
ACPI_GBL_EVENT_HANDLER Handler,
- void *Context);
+ void *Context))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiInstallFixedEventHandler (
UINT32 AcpiEvent,
ACPI_EVENT_HANDLER Handler,
- void *Context);
+ void *Context))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiRemoveFixedEventHandler (
UINT32 AcpiEvent,
- ACPI_EVENT_HANDLER Handler);
+ ACPI_EVENT_HANDLER Handler))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiInstallGpeHandler (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Type,
ACPI_GPE_HANDLER Address,
- void *Context);
+ void *Context))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiRemoveGpeHandler (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
- ACPI_GPE_HANDLER Address);
+ ACPI_GPE_HANDLER Address))
ACPI_STATUS
AcpiInstallNotifyHandler (
@@ -381,113 +426,148 @@ AcpiInstallInterfaceHandler (
/*
* Global Lock interfaces
*/
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiAcquireGlobalLock (
UINT16 Timeout,
- UINT32 *Handle);
+ UINT32 *Handle))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiReleaseGlobalLock (
- UINT32 Handle);
+ UINT32 Handle))
+
+
+/*
+ * Interfaces to AML mutex objects
+ */
+ACPI_STATUS
+AcpiAcquireMutex (
+ ACPI_HANDLE Handle,
+ ACPI_STRING Pathname,
+ UINT16 Timeout);
+
+ACPI_STATUS
+AcpiReleaseMutex (
+ ACPI_HANDLE Handle,
+ ACPI_STRING Pathname);
/*
* Fixed Event interfaces
*/
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiEnableEvent (
UINT32 Event,
- UINT32 Flags);
+ UINT32 Flags))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiDisableEvent (
UINT32 Event,
- UINT32 Flags);
+ UINT32 Flags))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiClearEvent (
- UINT32 Event);
+ UINT32 Event))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiGetEventStatus (
UINT32 Event,
- ACPI_EVENT_STATUS *EventStatus);
+ ACPI_EVENT_STATUS *EventStatus))
/*
* General Purpose Event (GPE) Interfaces
*/
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiUpdateAllGpes (
- void);
+ void))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiEnableGpe (
ACPI_HANDLE GpeDevice,
- UINT32 GpeNumber);
+ UINT32 GpeNumber))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiDisableGpe (
ACPI_HANDLE GpeDevice,
- UINT32 GpeNumber);
+ UINT32 GpeNumber))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiClearGpe (
ACPI_HANDLE GpeDevice,
- UINT32 GpeNumber);
+ UINT32 GpeNumber))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiSetGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
- UINT8 Action);
+ UINT8 Action))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiFinishGpe (
ACPI_HANDLE GpeDevice,
- UINT32 GpeNumber);
+ UINT32 GpeNumber))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiSetupGpeForWake (
ACPI_HANDLE ParentDevice,
ACPI_HANDLE GpeDevice,
- UINT32 GpeNumber);
+ UINT32 GpeNumber))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiSetGpeWakeMask (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
- UINT8 Action);
+ UINT8 Action))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiGetGpeStatus (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
- ACPI_EVENT_STATUS *EventStatus);
+ ACPI_EVENT_STATUS *EventStatus))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiDisableAllGpes (
- void);
+ void))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiEnableAllRuntimeGpes (
- void);
+ void))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiGetGpeDevice (
UINT32 GpeIndex,
- ACPI_HANDLE *GpeDevice);
+ ACPI_HANDLE *GpeDevice))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiInstallGpeBlock (
ACPI_HANDLE GpeDevice,
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
- UINT32 InterruptNumber);
+ UINT32 InterruptNumber))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiRemoveGpeBlock (
- ACPI_HANDLE GpeDevice);
+ ACPI_HANDLE GpeDevice))
/*
@@ -516,6 +596,11 @@ AcpiGetPossibleResources (
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
+AcpiGetEventResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *RetBuffer);
+
+ACPI_STATUS
AcpiWalkResources (
ACPI_HANDLE Device,
char *Name,
@@ -537,6 +622,12 @@ AcpiResourceToAddress64 (
ACPI_RESOURCE *Resource,
ACPI_RESOURCE_ADDRESS64 *Out);
+ACPI_STATUS
+AcpiBufferToResource (
+ UINT8 *AmlBuffer,
+ UINT16 AmlBufferLength,
+ ACPI_RESOURCE **ResourcePtr);
+
/*
* Hardware (ACPI device) interfaces
@@ -555,16 +646,22 @@ AcpiWrite (
UINT64 Value,
ACPI_GENERIC_ADDRESS *Reg);
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiReadBitRegister (
UINT32 RegisterId,
- UINT32 *ReturnValue);
+ UINT32 *ReturnValue))
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiWriteBitRegister (
UINT32 RegisterId,
- UINT32 Value);
+ UINT32 Value))
+
+/*
+ * Sleep/Wake interfaces
+ */
ACPI_STATUS
AcpiGetSleepTypeData (
UINT8 SleepState,
@@ -577,28 +674,58 @@ AcpiEnterSleepStatePrep (
ACPI_STATUS
AcpiEnterSleepState (
- UINT8 SleepState);
+ UINT8 SleepState,
+ UINT8 Flags);
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiEnterSleepStateS4bios (
- void);
+ void))
+
+ACPI_STATUS
+AcpiLeaveSleepStatePrep (
+ UINT8 SleepState,
+ UINT8 Flags);
ACPI_STATUS
AcpiLeaveSleepState (
- UINT8 SleepState)
- ;
+ UINT8 SleepState);
+
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiSetFirmwareWakingVector (
- UINT32 PhysicalAddress);
+ UINT32 PhysicalAddress))
#if ACPI_MACHINE_WIDTH == 64
+ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiSetFirmwareWakingVector64 (
- UINT64 PhysicalAddress);
+ UINT64 PhysicalAddress))
#endif
/*
+ * ACPI Timer interfaces
+ */
+ACPI_HW_DEPENDENT_RETURN_STATUS (
+ACPI_STATUS
+AcpiGetTimerResolution (
+ UINT32 *Resolution))
+
+ACPI_HW_DEPENDENT_RETURN_STATUS (
+ACPI_STATUS
+AcpiGetTimer (
+ UINT32 *Ticks))
+
+ACPI_HW_DEPENDENT_RETURN_STATUS (
+ACPI_STATUS
+AcpiGetTimerDuration (
+ UINT32 StartTicks,
+ UINT32 EndTicks,
+ UINT32 *TimeElapsed))
+
+
+/*
* Error/Warning output
*/
void ACPI_INTERNAL_VAR_XFACE
diff --git a/usr/src/uts/intel/sys/acpi/acpredef.h b/usr/src/uts/intel/sys/acpi/acpredef.h
index 0496767a86..c17a6d9145 100644
--- a/usr/src/uts/intel/sys/acpi/acpredef.h
+++ b/usr/src/uts/intel/sys/acpi/acpredef.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -94,6 +94,14 @@
* ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length
* (Used for _ART, _FPS)
*
+ * ACPI_PTYPE2_FIX_VAR: Each subpackage consists of some fixed-length elements
+ * followed by an optional element
+ * object type
+ * count
+ * object type
+ * count = 0 (optional)
+ * (Used for _DLM)
+ *
*****************************************************************************/
enum AcpiReturnPackageTypes
@@ -106,7 +114,8 @@ enum AcpiReturnPackageTypes
ACPI_PTYPE2_PKG_COUNT = 6,
ACPI_PTYPE2_FIXED = 7,
ACPI_PTYPE2_MIN = 8,
- ACPI_PTYPE2_REV_FIXED = 9
+ ACPI_PTYPE2_REV_FIXED = 9,
+ ACPI_PTYPE2_FIX_VAR = 10
};
@@ -159,6 +168,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_AC8", 0, ACPI_RTYPE_INTEGER}},
{{"_AC9", 0, ACPI_RTYPE_INTEGER}},
{{"_ADR", 0, ACPI_RTYPE_INTEGER}},
+ {{"_AEI", 0, ACPI_RTYPE_BUFFER}},
{{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
{{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
@@ -231,6 +241,12 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */
{{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}},
+ {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */
+ {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0}, 0,0}},
+
+ {{"_CPC", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Bufs) */
+ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,0}, 0,0}},
+
{{"_CRS", 0, ACPI_RTYPE_BUFFER}},
{{"_CRT", 0, ACPI_RTYPE_INTEGER}},
{{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */
@@ -239,12 +255,20 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */
{{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}},
+ {{"_CWS", 1, ACPI_RTYPE_INTEGER}},
{{"_DCK", 1, ACPI_RTYPE_INTEGER}},
{{"_DCS", 0, ACPI_RTYPE_INTEGER}},
{{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
{{"_DDN", 0, ACPI_RTYPE_STRING}},
+ {{"_DEP", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
{{"_DGS", 0, ACPI_RTYPE_INTEGER}},
{{"_DIS", 0, 0}},
+
+ {{"_DLM", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */
+ {{{ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1, ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER}, 0,0}},
+
{{"_DMA", 0, ACPI_RTYPE_BUFFER}},
{{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
{{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
@@ -264,6 +288,8 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_EJ3", 1, 0}},
{{"_EJ4", 1, 0}},
{{"_EJD", 0, ACPI_RTYPE_STRING}},
+ {{"_ERR", 3, ACPI_RTYPE_INTEGER}}, /* Internal use only, used by ACPICA test suites */
+ {{"_EVT", 1, 0}},
{{"_FDE", 0, ACPI_RTYPE_BUFFER}},
{{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */
{{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}},
@@ -284,14 +310,17 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_GAI", 0, ACPI_RTYPE_INTEGER}},
+ {{"_GCP", 0, ACPI_RTYPE_INTEGER}},
{{"_GHL", 0, ACPI_RTYPE_INTEGER}},
{{"_GLK", 0, ACPI_RTYPE_INTEGER}},
{{"_GPD", 0, ACPI_RTYPE_INTEGER}},
{{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */
+ {{"_GRT", 0, ACPI_RTYPE_BUFFER}},
{{"_GSB", 0, ACPI_RTYPE_INTEGER}},
{{"_GTF", 0, ACPI_RTYPE_BUFFER}},
{{"_GTM", 0, ACPI_RTYPE_BUFFER}},
{{"_GTS", 1, 0}},
+ {{"_GWS", 1, ACPI_RTYPE_INTEGER}},
{{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
{{"_HOT", 0, ACPI_RTYPE_INTEGER}},
{{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
@@ -306,6 +335,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */
{{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+ {{"_HRV", 0, ACPI_RTYPE_INTEGER}},
{{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
{{"_INI", 0, 0}},
{{"_IRC", 0, 0}},
@@ -363,6 +393,9 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
{{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+ {{"_PRE", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
{{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
{{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
@@ -393,6 +426,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */
{{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}},
+ {{"_PSE", 1, 0}},
{{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
{{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
@@ -459,6 +493,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_SLI", 0, ACPI_RTYPE_BUFFER}},
{{"_SPD", 1, ACPI_RTYPE_INTEGER}},
{{"_SRS", 1, 0}},
+ {{"_SRT", 1, ACPI_RTYPE_INTEGER}},
{{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
{{"_SST", 1, 0}},
{{"_STA", 0, ACPI_RTYPE_INTEGER}},
@@ -466,6 +501,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_STP", 2, ACPI_RTYPE_INTEGER}},
{{"_STR", 0, ACPI_RTYPE_BUFFER}},
{{"_STV", 2, ACPI_RTYPE_INTEGER}},
+ {{"_SUB", 0, ACPI_RTYPE_STRING}},
{{"_SUN", 0, ACPI_RTYPE_INTEGER}},
{{"_SWS", 0, ACPI_RTYPE_INTEGER}},
{{"_TC1", 0, ACPI_RTYPE_INTEGER}},
diff --git a/usr/src/uts/intel/sys/acpi/acresrc.h b/usr/src/uts/intel/sys/acpi/acresrc.h
index 00c4bb2530..c879fdc4a3 100644
--- a/usr/src/uts/intel/sys/acpi/acresrc.h
+++ b/usr/src/uts/intel/sys/acpi/acresrc.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -75,28 +75,42 @@ typedef const struct acpi_rsconvert_info
/* Resource conversion opcodes */
-#define ACPI_RSC_INITGET 0
-#define ACPI_RSC_INITSET 1
-#define ACPI_RSC_FLAGINIT 2
-#define ACPI_RSC_1BITFLAG 3
-#define ACPI_RSC_2BITFLAG 4
-#define ACPI_RSC_COUNT 5
-#define ACPI_RSC_COUNT16 6
-#define ACPI_RSC_LENGTH 7
-#define ACPI_RSC_MOVE8 8
-#define ACPI_RSC_MOVE16 9
-#define ACPI_RSC_MOVE32 10
-#define ACPI_RSC_MOVE64 11
-#define ACPI_RSC_SET8 12
-#define ACPI_RSC_DATA8 13
-#define ACPI_RSC_ADDRESS 14
-#define ACPI_RSC_SOURCE 15
-#define ACPI_RSC_SOURCEX 16
-#define ACPI_RSC_BITMASK 17
-#define ACPI_RSC_BITMASK16 18
-#define ACPI_RSC_EXIT_NE 19
-#define ACPI_RSC_EXIT_LE 20
-#define ACPI_RSC_EXIT_EQ 21
+typedef enum
+{
+ ACPI_RSC_INITGET = 0,
+ ACPI_RSC_INITSET,
+ ACPI_RSC_FLAGINIT,
+ ACPI_RSC_1BITFLAG,
+ ACPI_RSC_2BITFLAG,
+ ACPI_RSC_3BITFLAG,
+ ACPI_RSC_ADDRESS,
+ ACPI_RSC_BITMASK,
+ ACPI_RSC_BITMASK16,
+ ACPI_RSC_COUNT,
+ ACPI_RSC_COUNT16,
+ ACPI_RSC_COUNT_GPIO_PIN,
+ ACPI_RSC_COUNT_GPIO_RES,
+ ACPI_RSC_COUNT_GPIO_VEN,
+ ACPI_RSC_COUNT_SERIAL_RES,
+ ACPI_RSC_COUNT_SERIAL_VEN,
+ ACPI_RSC_DATA8,
+ ACPI_RSC_EXIT_EQ,
+ ACPI_RSC_EXIT_LE,
+ ACPI_RSC_EXIT_NE,
+ ACPI_RSC_LENGTH,
+ ACPI_RSC_MOVE_GPIO_PIN,
+ ACPI_RSC_MOVE_GPIO_RES,
+ ACPI_RSC_MOVE_SERIAL_RES,
+ ACPI_RSC_MOVE_SERIAL_VEN,
+ ACPI_RSC_MOVE8,
+ ACPI_RSC_MOVE16,
+ ACPI_RSC_MOVE32,
+ ACPI_RSC_MOVE64,
+ ACPI_RSC_SET8,
+ ACPI_RSC_SOURCE,
+ ACPI_RSC_SOURCEX
+
+} ACPI_RSCONVERT_OPCODES;
/* Resource Conversion sub-opcodes */
@@ -109,6 +123,9 @@ typedef const struct acpi_rsconvert_info
#define AML_OFFSET(f) (UINT8) ACPI_OFFSET (AML_RESOURCE,f)
+/*
+ * Individual entry for the resource dump tables
+ */
typedef const struct acpi_rsdump_info
{
UINT8 Opcode;
@@ -120,20 +137,27 @@ typedef const struct acpi_rsdump_info
/* Values for the Opcode field above */
-#define ACPI_RSD_TITLE 0
-#define ACPI_RSD_LITERAL 1
-#define ACPI_RSD_STRING 2
-#define ACPI_RSD_UINT8 3
-#define ACPI_RSD_UINT16 4
-#define ACPI_RSD_UINT32 5
-#define ACPI_RSD_UINT64 6
-#define ACPI_RSD_1BITFLAG 7
-#define ACPI_RSD_2BITFLAG 8
-#define ACPI_RSD_SHORTLIST 9
-#define ACPI_RSD_LONGLIST 10
-#define ACPI_RSD_DWORDLIST 11
-#define ACPI_RSD_ADDRESS 12
-#define ACPI_RSD_SOURCE 13
+typedef enum
+{
+ ACPI_RSD_TITLE = 0,
+ ACPI_RSD_1BITFLAG,
+ ACPI_RSD_2BITFLAG,
+ ACPI_RSD_3BITFLAG,
+ ACPI_RSD_ADDRESS,
+ ACPI_RSD_DWORDLIST,
+ ACPI_RSD_LITERAL,
+ ACPI_RSD_LONGLIST,
+ ACPI_RSD_SHORTLIST,
+ ACPI_RSD_SHORTLISTX,
+ ACPI_RSD_SOURCE,
+ ACPI_RSD_STRING,
+ ACPI_RSD_UINT8,
+ ACPI_RSD_UINT16,
+ ACPI_RSD_UINT32,
+ ACPI_RSD_UINT64,
+ ACPI_RSD_WORDLIST
+
+} ACPI_RSDUMP_OPCODES;
/* restore default alignment */
@@ -143,13 +167,16 @@ typedef const struct acpi_rsdump_info
/* Resource tables indexed by internal resource type */
extern const UINT8 AcpiGbl_AmlResourceSizes[];
+extern const UINT8 AcpiGbl_AmlResourceSerialBusSizes[];
extern ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[];
/* Resource tables indexed by raw AML resource descriptor type */
extern const UINT8 AcpiGbl_ResourceStructSizes[];
+extern const UINT8 AcpiGbl_ResourceStructSerialBusSizes[];
extern ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[];
+extern ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[];
typedef struct acpi_vendor_walk_info
{
@@ -208,6 +235,10 @@ AcpiRsSetSrsMethodData (
ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer);
+ACPI_STATUS
+AcpiRsGetAeiMethodData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_BUFFER *RetBuffer);
/*
* rscalc
@@ -348,6 +379,11 @@ extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[];
extern ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[];
extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[];
extern ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertGpio[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[];
/* These resources require separate get/set tables */
@@ -366,6 +402,7 @@ extern ACPI_RSCONVERT_INFO AcpiRsSetVendor[];
* rsinfo
*/
extern ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[];
+extern ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[];
/*
* rsdump
@@ -387,6 +424,12 @@ extern ACPI_RSDUMP_INFO AcpiRsDumpAddress64[];
extern ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[];
extern ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[];
extern ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpGpio[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[];
#endif
#endif /* __ACRESRC_H__ */
diff --git a/usr/src/uts/intel/sys/acpi/acrestyp.h b/usr/src/uts/intel/sys/acpi/acrestyp.h
index 03e7e2ce08..b927c9c58e 100644
--- a/usr/src/uts/intel/sys/acpi/acrestyp.h
+++ b/usr/src/uts/intel/sys/acpi/acrestyp.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -62,11 +62,14 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr
#define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02
#define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03
+/*! [Begin] no source code translation */
/*
* IO Attributes
* The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
* The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
*/
+/*! [End] no source code translation !*/
+
#define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01
#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02
#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
@@ -82,16 +85,26 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr
#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
/*
- * IRQ Attributes
+ * Interrupt attributes - used in multiple descriptors
*/
+
+/* Triggering */
+
#define ACPI_LEVEL_SENSITIVE (UINT8) 0x00
#define ACPI_EDGE_SENSITIVE (UINT8) 0x01
+/* Polarity */
+
#define ACPI_ACTIVE_HIGH (UINT8) 0x00
#define ACPI_ACTIVE_LOW (UINT8) 0x01
+#define ACPI_ACTIVE_BOTH (UINT8) 0x02
+
+/* Sharing */
#define ACPI_EXCLUSIVE (UINT8) 0x00
#define ACPI_SHARED (UINT8) 0x01
+#define ACPI_EXCLUSIVE_AND_WAKE (UINT8) 0x02
+#define ACPI_SHARED_AND_WAKE (UINT8) 0x03
/*
* DMA Attributes
@@ -128,6 +141,8 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr
#define ACPI_POS_DECODE (UINT8) 0x00
#define ACPI_SUB_DECODE (UINT8) 0x01
+/* Producer/Consumer */
+
#define ACPI_PRODUCER (UINT8) 0x00
#define ACPI_CONSUMER (UINT8) 0x01
@@ -167,7 +182,7 @@ typedef struct acpi_resource_irq
} ACPI_RESOURCE_IRQ;
-typedef struct ACPI_RESOURCE_DMA
+typedef struct acpi_resource_dma
{
UINT8 Type;
UINT8 BusMaster;
@@ -209,6 +224,24 @@ typedef struct acpi_resource_fixed_io
} ACPI_RESOURCE_FIXED_IO;
+typedef struct acpi_resource_fixed_dma
+{
+ UINT16 RequestLines;
+ UINT16 Channels;
+ UINT8 Width;
+
+} ACPI_RESOURCE_FIXED_DMA;
+
+/* Values for Width field above */
+
+#define ACPI_DMA_WIDTH8 0
+#define ACPI_DMA_WIDTH16 1
+#define ACPI_DMA_WIDTH32 2
+#define ACPI_DMA_WIDTH64 3
+#define ACPI_DMA_WIDTH128 4
+#define ACPI_DMA_WIDTH256 5
+
+
typedef struct acpi_resource_vendor
{
UINT16 ByteLength;
@@ -385,6 +418,184 @@ typedef struct acpi_resource_generic_register
} ACPI_RESOURCE_GENERIC_REGISTER;
+typedef struct acpi_resource_gpio
+{
+ UINT8 RevisionId;
+ UINT8 ConnectionType;
+ UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */
+ UINT8 PinConfig;
+ UINT8 Sharable; /* For values, see Interrupt Attributes above */
+ UINT8 IoRestriction;
+ UINT8 Triggering; /* For values, see Interrupt Attributes above */
+ UINT8 Polarity; /* For values, see Interrupt Attributes above */
+ UINT16 DriveStrength;
+ UINT16 DebounceTimeout;
+ UINT16 PinTableLength;
+ UINT16 VendorLength;
+ ACPI_RESOURCE_SOURCE ResourceSource;
+ UINT16 *PinTable;
+ UINT8 *VendorData;
+
+} ACPI_RESOURCE_GPIO;
+
+/* Values for GPIO ConnectionType field above */
+
+#define ACPI_RESOURCE_GPIO_TYPE_INT 0
+#define ACPI_RESOURCE_GPIO_TYPE_IO 1
+
+/* Values for PinConfig field above */
+
+#define ACPI_PIN_CONFIG_DEFAULT 0
+#define ACPI_PIN_CONFIG_PULLUP 1
+#define ACPI_PIN_CONFIG_PULLDOWN 2
+#define ACPI_PIN_CONFIG_NOPULL 3
+
+/* Values for IoRestriction field above */
+
+#define ACPI_IO_RESTRICT_NONE 0
+#define ACPI_IO_RESTRICT_INPUT 1
+#define ACPI_IO_RESTRICT_OUTPUT 2
+#define ACPI_IO_RESTRICT_NONE_PRESERVE 3
+
+
+/* Common structure for I2C, SPI, and UART serial descriptors */
+
+#define ACPI_RESOURCE_SERIAL_COMMON \
+ UINT8 RevisionId; \
+ UINT8 Type; \
+ UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */\
+ UINT8 SlaveMode; \
+ UINT8 TypeRevisionId; \
+ UINT16 TypeDataLength; \
+ UINT16 VendorLength; \
+ ACPI_RESOURCE_SOURCE ResourceSource; \
+ UINT8 *VendorData;
+
+typedef struct acpi_resource_common_serialbus
+{
+ ACPI_RESOURCE_SERIAL_COMMON
+
+} ACPI_RESOURCE_COMMON_SERIALBUS;
+
+/* Values for the Type field above */
+
+#define ACPI_RESOURCE_SERIAL_TYPE_I2C 1
+#define ACPI_RESOURCE_SERIAL_TYPE_SPI 2
+#define ACPI_RESOURCE_SERIAL_TYPE_UART 3
+
+/* Values for SlaveMode field above */
+
+#define ACPI_CONTROLLER_INITIATED 0
+#define ACPI_DEVICE_INITIATED 1
+
+
+typedef struct acpi_resource_i2c_serialbus
+{
+ ACPI_RESOURCE_SERIAL_COMMON
+ UINT8 AccessMode;
+ UINT16 SlaveAddress;
+ UINT32 ConnectionSpeed;
+
+} ACPI_RESOURCE_I2C_SERIALBUS;
+
+/* Values for AccessMode field above */
+
+#define ACPI_I2C_7BIT_MODE 0
+#define ACPI_I2C_10BIT_MODE 1
+
+
+typedef struct acpi_resource_spi_serialbus
+{
+ ACPI_RESOURCE_SERIAL_COMMON
+ UINT8 WireMode;
+ UINT8 DevicePolarity;
+ UINT8 DataBitLength;
+ UINT8 ClockPhase;
+ UINT8 ClockPolarity;
+ UINT16 DeviceSelection;
+ UINT32 ConnectionSpeed;
+
+} ACPI_RESOURCE_SPI_SERIALBUS;
+
+/* Values for WireMode field above */
+
+#define ACPI_SPI_4WIRE_MODE 0
+#define ACPI_SPI_3WIRE_MODE 1
+
+/* Values for DevicePolarity field above */
+
+#define ACPI_SPI_ACTIVE_LOW 0
+#define ACPI_SPI_ACTIVE_HIGH 1
+
+/* Values for ClockPhase field above */
+
+#define ACPI_SPI_FIRST_PHASE 0
+#define ACPI_SPI_SECOND_PHASE 1
+
+/* Values for ClockPolarity field above */
+
+#define ACPI_SPI_START_LOW 0
+#define ACPI_SPI_START_HIGH 1
+
+
+typedef struct acpi_resource_uart_serialbus
+{
+ ACPI_RESOURCE_SERIAL_COMMON
+ UINT8 Endian;
+ UINT8 DataBits;
+ UINT8 StopBits;
+ UINT8 FlowControl;
+ UINT8 Parity;
+ UINT8 LinesEnabled;
+ UINT16 RxFifoSize;
+ UINT16 TxFifoSize;
+ UINT32 DefaultBaudRate;
+
+} ACPI_RESOURCE_UART_SERIALBUS;
+
+/* Values for Endian field above */
+
+#define ACPI_UART_LITTLE_ENDIAN 0
+#define ACPI_UART_BIG_ENDIAN 1
+
+/* Values for DataBits field above */
+
+#define ACPI_UART_5_DATA_BITS 0
+#define ACPI_UART_6_DATA_BITS 1
+#define ACPI_UART_7_DATA_BITS 2
+#define ACPI_UART_8_DATA_BITS 3
+#define ACPI_UART_9_DATA_BITS 4
+
+/* Values for StopBits field above */
+
+#define ACPI_UART_NO_STOP_BITS 0
+#define ACPI_UART_1_STOP_BIT 1
+#define ACPI_UART_1P5_STOP_BITS 2
+#define ACPI_UART_2_STOP_BITS 3
+
+/* Values for FlowControl field above */
+
+#define ACPI_UART_FLOW_CONTROL_NONE 0
+#define ACPI_UART_FLOW_CONTROL_HW 1
+#define ACPI_UART_FLOW_CONTROL_XON_XOFF 2
+
+/* Values for Parity field above */
+
+#define ACPI_UART_PARITY_NONE 0
+#define ACPI_UART_PARITY_EVEN 1
+#define ACPI_UART_PARITY_ODD 2
+#define ACPI_UART_PARITY_MARK 3
+#define ACPI_UART_PARITY_SPACE 4
+
+/* Values for LinesEnabled bitfield above */
+
+#define ACPI_UART_CARRIER_DETECT (1<<2)
+#define ACPI_UART_RING_INDICATOR (1<<3)
+#define ACPI_UART_DATA_SET_READY (1<<4)
+#define ACPI_UART_DATA_TERMINAL_READY (1<<5)
+#define ACPI_UART_CLEAR_TO_SEND (1<<6)
+#define ACPI_UART_REQUEST_TO_SEND (1<<7)
+
/* ACPI_RESOURCE_TYPEs */
@@ -405,7 +616,10 @@ typedef struct acpi_resource_generic_register
#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
-#define ACPI_RESOURCE_TYPE_MAX 16
+#define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */
+#define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */
+#define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */
+#define ACPI_RESOURCE_TYPE_MAX 19
/* Master union for resource descriptors */
@@ -416,6 +630,7 @@ typedef union acpi_resource_data
ACPI_RESOURCE_START_DEPENDENT StartDpf;
ACPI_RESOURCE_IO Io;
ACPI_RESOURCE_FIXED_IO FixedIo;
+ ACPI_RESOURCE_FIXED_DMA FixedDma;
ACPI_RESOURCE_VENDOR Vendor;
ACPI_RESOURCE_VENDOR_TYPED VendorTyped;
ACPI_RESOURCE_END_TAG EndTag;
@@ -428,6 +643,11 @@ typedef union acpi_resource_data
ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq;
ACPI_RESOURCE_GENERIC_REGISTER GenericReg;
+ ACPI_RESOURCE_GPIO Gpio;
+ ACPI_RESOURCE_I2C_SERIALBUS I2cSerialBus;
+ ACPI_RESOURCE_SPI_SERIALBUS SpiSerialBus;
+ ACPI_RESOURCE_UART_SERIALBUS UartSerialBus;
+ ACPI_RESOURCE_COMMON_SERIALBUS CommonSerialBus;
/* Common fields */
diff --git a/usr/src/uts/intel/sys/acpi/acstruct.h b/usr/src/uts/intel/sys/acpi/acstruct.h
index ff588f5234..b3927caa41 100644
--- a/usr/src/uts/intel/sys/acpi/acstruct.h
+++ b/usr/src/uts/intel/sys/acpi/acstruct.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/actables.h b/usr/src/uts/intel/sys/acpi/actables.h
index 6aad862bc9..26a7947dc9 100644
--- a/usr/src/uts/intel/sys/acpi/actables.h
+++ b/usr/src/uts/intel/sys/acpi/actables.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -84,6 +84,11 @@ ACPI_STATUS
AcpiTbVerifyTable (
ACPI_TABLE_DESC *TableDesc);
+ACPI_TABLE_HEADER *
+AcpiTbTableOverride (
+ ACPI_TABLE_HEADER *TableHeader,
+ ACPI_TABLE_DESC *TableDesc);
+
ACPI_STATUS
AcpiTbAddTable (
ACPI_TABLE_DESC *TableDesc,
diff --git a/usr/src/uts/intel/sys/acpi/actbl.h b/usr/src/uts/intel/sys/acpi/actbl.h
index e632291cd0..7da7378d14 100644
--- a/usr/src/uts/intel/sys/acpi/actbl.h
+++ b/usr/src/uts/intel/sys/acpi/actbl.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -298,6 +298,8 @@ typedef struct acpi_table_fadt
ACPI_GENERIC_ADDRESS XPmTimerBlock; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
ACPI_GENERIC_ADDRESS XGpe0Block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
+ ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register */
+ ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register */
} ACPI_TABLE_FADT;
@@ -309,6 +311,7 @@ typedef struct acpi_table_fadt
#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */
#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */
#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */
+#define ACPI_FADT_NO_CMOS_RTC (1<<5) /* 05: [V5] No CMOS real-time clock present */
/* Masks for FADT flags */
@@ -332,6 +335,8 @@ typedef struct acpi_table_fadt
#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */
#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local xAPICs must use physical dest mode (ACPI 3.0) */
+#define ACPI_FADT_HW_REDUCED (1<<20) /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */
+#define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */
/* Values for PreferredProfile (Prefered Power Management Profiles) */
@@ -344,9 +349,18 @@ enum AcpiPreferedPmProfiles
PM_WORKSTATION = 3,
PM_ENTERPRISE_SERVER = 4,
PM_SOHO_SERVER = 5,
- PM_APPLIANCE_PC = 6
+ PM_APPLIANCE_PC = 6,
+ PM_PERFORMANCE_SERVER = 7,
+ PM_TABLET = 8
};
+/* Values for SleepStatus and SleepControl registers (V5 FADT) */
+
+#define ACPI_X_WAKE_STATUS 0x80
+#define ACPI_X_SLEEP_TYPE_MASK 0x1C
+#define ACPI_X_SLEEP_TYPE_POSITION 0x02
+#define ACPI_X_SLEEP_ENABLE 0x20
+
/* Reset to default packing */
@@ -392,10 +406,11 @@ typedef struct acpi_table_desc
*/
#include "actbl1.h"
#include "actbl2.h"
+#include "actbl3.h"
/* Macros used to generate offsets to specific table fields */
-#define ACPI_FADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FADT, f)
+#define ACPI_FADT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_FADT, f)
/*
* Sizes of the various flavors of FADT. We need to look closely
@@ -405,12 +420,15 @@ typedef struct acpi_table_desc
* FADT is the bottom line as to what the version really is.
*
* For reference, the values below are as follows:
- * FADT V1 size: 0x74
- * FADT V2 size: 0x84
- * FADT V3+ size: 0xF4
+ * FADT V1 size: 0x074
+ * FADT V2 size: 0x084
+ * FADT V3 size: 0x0F4
+ * FADT V4 size: 0x0F4
+ * FADT V5 size: 0x10C
*/
#define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4)
#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (Reserved4[0]) + 3)
-#define ACPI_FADT_V3_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT))
+#define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl))
+#define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT))
#endif /* __ACTBL_H__ */
diff --git a/usr/src/uts/intel/sys/acpi/actbl1.h b/usr/src/uts/intel/sys/acpi/actbl1.h
index ad6c82fc3c..824135d3dd 100644
--- a/usr/src/uts/intel/sys/acpi/actbl1.h
+++ b/usr/src/uts/intel/sys/acpi/actbl1.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -252,16 +252,17 @@ typedef struct acpi_einj_entry
enum AcpiEinjActions
{
- ACPI_EINJ_BEGIN_OPERATION = 0,
- ACPI_EINJ_GET_TRIGGER_TABLE = 1,
- ACPI_EINJ_SET_ERROR_TYPE = 2,
- ACPI_EINJ_GET_ERROR_TYPE = 3,
- ACPI_EINJ_END_OPERATION = 4,
- ACPI_EINJ_EXECUTE_OPERATION = 5,
- ACPI_EINJ_CHECK_BUSY_STATUS = 6,
- ACPI_EINJ_GET_COMMAND_STATUS = 7,
- ACPI_EINJ_ACTION_RESERVED = 8, /* 8 and greater are reserved */
- ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */
+ ACPI_EINJ_BEGIN_OPERATION = 0,
+ ACPI_EINJ_GET_TRIGGER_TABLE = 1,
+ ACPI_EINJ_SET_ERROR_TYPE = 2,
+ ACPI_EINJ_GET_ERROR_TYPE = 3,
+ ACPI_EINJ_END_OPERATION = 4,
+ ACPI_EINJ_EXECUTE_OPERATION = 5,
+ ACPI_EINJ_CHECK_BUSY_STATUS = 6,
+ ACPI_EINJ_GET_COMMAND_STATUS = 7,
+ ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8,
+ ACPI_EINJ_ACTION_RESERVED = 9, /* 9 and greater are reserved */
+ ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */
};
/* Values for Instruction field above */
@@ -273,9 +274,33 @@ enum AcpiEinjInstructions
ACPI_EINJ_WRITE_REGISTER = 2,
ACPI_EINJ_WRITE_REGISTER_VALUE = 3,
ACPI_EINJ_NOOP = 4,
- ACPI_EINJ_INSTRUCTION_RESERVED = 5 /* 5 and greater are reserved */
+ ACPI_EINJ_FLUSH_CACHELINE = 5,
+ ACPI_EINJ_INSTRUCTION_RESERVED = 6 /* 6 and greater are reserved */
};
+typedef struct acpi_einj_error_type_with_addr
+{
+ UINT32 ErrorType;
+ UINT32 VendorStructOffset;
+ UINT32 Flags;
+ UINT32 ApicId;
+ UINT64 Address;
+ UINT64 Range;
+ UINT32 PcieId;
+
+} ACPI_EINJ_ERROR_TYPE_WITH_ADDR;
+
+typedef struct acpi_einj_vendor
+{
+ UINT32 Length;
+ UINT32 PcieId;
+ UINT16 VendorId;
+ UINT16 DeviceId;
+ UINT8 RevisionId;
+ UINT8 Reserved[3];
+
+} ACPI_EINJ_VENDOR;
+
/* EINJ Trigger Error Action Table */
@@ -313,6 +338,7 @@ enum AcpiEinjCommandStatus
#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9)
#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10)
#define ACPI_EINJ_PLATFORM_FATAL (1<<11)
+#define ACPI_EINJ_VENDOR_DEFINED (1<<31)
/*******************************************************************************
@@ -731,7 +757,9 @@ enum AcpiMadtType
ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
- ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */
+ ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
+ ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
+ ACPI_MADT_TYPE_RESERVED = 13 /* 13 and greater are reserved */
};
@@ -886,11 +914,42 @@ typedef struct acpi_madt_local_x2apic_nmi
} ACPI_MADT_LOCAL_X2APIC_NMI;
+/* 11: Generic Interrupt (ACPI 5.0) */
+
+typedef struct acpi_madt_generic_interrupt
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT16 Reserved; /* Reserved - must be zero */
+ UINT32 GicId;
+ UINT32 Uid;
+ UINT32 Flags;
+ UINT32 ParkingVersion;
+ UINT32 PerformanceInterrupt;
+ UINT64 ParkedAddress;
+ UINT64 BaseAddress;
+
+} ACPI_MADT_GENERIC_INTERRUPT;
+
+
+/* 12: Generic Distributor (ACPI 5.0) */
+
+typedef struct acpi_madt_generic_distributor
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT16 Reserved; /* Reserved - must be zero */
+ UINT32 GicId;
+ UINT64 BaseAddress;
+ UINT32 GlobalIrqBase;
+ UINT32 Reserved2; /* Reserved - must be zero */
+
+} ACPI_MADT_GENERIC_DISTRIBUTOR;
+
+
/*
* Common flags fields for MADT subtables
*/
-/* MADT Local APIC flags (LapicFlags) */
+/* MADT Local APIC flags (LapicFlags) and GIC flags */
#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
diff --git a/usr/src/uts/intel/sys/acpi/actbl2.h b/usr/src/uts/intel/sys/acpi/actbl2.h
index e4f01e3f6b..70c6a09a3c 100644
--- a/usr/src/uts/intel/sys/acpi/actbl2.h
+++ b/usr/src/uts/intel/sys/acpi/actbl2.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/actbl3.h b/usr/src/uts/intel/sys/acpi/actbl3.h
new file mode 100644
index 0000000000..c5dd4184dd
--- /dev/null
+++ b/usr/src/uts/intel/sys/acpi/actbl3.h
@@ -0,0 +1,650 @@
+/******************************************************************************
+ *
+ * Name: actbl3.h - ACPI Table Definitions
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2012, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACTBL3_H__
+#define __ACTBL3_H__
+
+
+/*******************************************************************************
+ *
+ * Additional ACPI Tables (3)
+ *
+ * These tables are not consumed directly by the ACPICA subsystem, but are
+ * included here to support device drivers and the AML disassembler.
+ *
+ * The tables in this file are fully defined within the ACPI specification.
+ *
+ ******************************************************************************/
+
+
+/*
+ * Values for description table header signatures for tables defined in this
+ * file. Useful because they make it more difficult to inadvertently type in
+ * the wrong signature.
+ */
+#define ACPI_SIG_BGRT "BGRT" /* Boot Graphics Resource Table */
+#define ACPI_SIG_DRTM "DRTM" /* Dynamic Root of Trust for Measurement table */
+#define ACPI_SIG_FPDT "FPDT" /* Firmware Performance Data Table */
+#define ACPI_SIG_GTDT "GTDT" /* Generic Timer Description Table */
+#define ACPI_SIG_MPST "MPST" /* Memory Power State Table */
+#define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */
+#define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */
+#define ACPI_SIG_RASF "RASF" /* RAS Feature table */
+
+#define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */
+#define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */
+
+/* Reserved table signatures */
+
+#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */
+#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */
+#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */
+#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
+#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */
+
+/*
+ * All tables must be byte-packed to match the ACPI specification, since
+ * the tables are provided by the system BIOS.
+ */
+#pragma pack(1)
+
+/*
+ * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
+ * This is the only type that is even remotely portable. Anything else is not
+ * portable, so do not use any other bitfield types.
+ */
+
+
+/*******************************************************************************
+ *
+ * BGRT - Boot Graphics Resource Table (ACPI 5.0)
+ * Version 1
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_bgrt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT16 Version;
+ UINT8 Status;
+ UINT8 ImageType;
+ UINT64 ImageAddress;
+ UINT32 ImageOffsetX;
+ UINT32 ImageOffsetY;
+
+} ACPI_TABLE_BGRT;
+
+
+/*******************************************************************************
+ *
+ * DRTM - Dynamic Root of Trust for Measurement table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_drtm
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT64 EntryBaseAddress;
+ UINT64 EntryLength;
+ UINT32 EntryAddress32;
+ UINT64 EntryAddress64;
+ UINT64 ExitAddress;
+ UINT64 LogAreaAddress;
+ UINT32 LogAreaLength;
+ UINT64 ArchDependentAddress;
+ UINT32 Flags;
+
+} ACPI_TABLE_DRTM;
+
+/* 1) Validated Tables List */
+
+typedef struct acpi_drtm_vtl_list
+{
+ UINT32 ValidatedTableListCount;
+
+} ACPI_DRTM_VTL_LIST;
+
+/* 2) Resources List */
+
+typedef struct acpi_drtm_resource_list
+{
+ UINT32 ResourceListCount;
+
+} ACPI_DRTM_RESOURCE_LIST;
+
+/* 3) Platform-specific Identifiers List */
+
+typedef struct acpi_drtm_id_list
+{
+ UINT32 IdListCount;
+
+} ACPI_DRTM_ID_LIST;
+
+
+/*******************************************************************************
+ *
+ * FPDT - Firmware Performance Data Table (ACPI 5.0)
+ * Version 1
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_fpdt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+
+} ACPI_TABLE_FPDT;
+
+
+/* FPDT subtable header */
+
+typedef struct acpi_fpdt_header
+{
+ UINT16 Type;
+ UINT8 Length;
+ UINT8 Revision;
+
+} ACPI_FPDT_HEADER;
+
+/* Values for Type field above */
+
+enum AcpiFpdtType
+{
+ ACPI_FPDT_TYPE_BOOT = 0,
+ ACPI_FPDT_TYPE_S3PERF = 1,
+};
+
+
+/*
+ * FPDT subtables
+ */
+
+/* 0: Firmware Basic Boot Performance Record */
+
+typedef struct acpi_fpdt_boot
+{
+ ACPI_FPDT_HEADER Header;
+ UINT8 Reserved[4];
+ UINT64 ResetEnd;
+ UINT64 LoadStart;
+ UINT64 StartupStart;
+ UINT64 ExitServicesEntry;
+ UINT64 ExitServicesExit;
+
+} ACPI_FPDT_BOOT;
+
+
+/* 1: S3 Performance Table Pointer Record */
+
+typedef struct acpi_fpdt_s3pt_ptr
+{
+ ACPI_FPDT_HEADER Header;
+ UINT8 Reserved[4];
+ UINT64 Address;
+
+} ACPI_FPDT_S3PT_PTR;
+
+
+/*
+ * S3PT - S3 Performance Table. This table is pointed to by the
+ * FPDT S3 Pointer Record above.
+ */
+typedef struct acpi_table_s3pt
+{
+ UINT8 Signature[4]; /* "S3PT" */
+ UINT32 Length;
+
+} ACPI_TABLE_S3PT;
+
+
+/*
+ * S3PT Subtables
+ */
+typedef struct acpi_s3pt_header
+{
+ UINT16 Type;
+ UINT8 Length;
+ UINT8 Revision;
+
+} ACPI_S3PT_HEADER;
+
+/* Values for Type field above */
+
+enum AcpiS3ptType
+{
+ ACPI_S3PT_TYPE_RESUME = 0,
+ ACPI_S3PT_TYPE_SUSPEND = 1,
+};
+
+typedef struct acpi_s3pt_resume
+{
+ ACPI_S3PT_HEADER Header;
+ UINT32 ResumeCount;
+ UINT64 FullResume;
+ UINT64 AverageResume;
+
+} ACPI_S3PT_RESUME;
+
+typedef struct acpi_s3pt_suspend
+{
+ ACPI_S3PT_HEADER Header;
+ UINT64 SuspendStart;
+ UINT64 SuspendEnd;
+
+} ACPI_S3PT_SUSPEND;
+
+
+/*******************************************************************************
+ *
+ * GTDT - Generic Timer Description Table (ACPI 5.0)
+ * Version 1
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_gtdt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT64 Address;
+ UINT32 Flags;
+ UINT32 SecurePl1Interrupt;
+ UINT32 SecurePl1Flags;
+ UINT32 NonSecurePl1Interrupt;
+ UINT32 NonSecurePl1Flags;
+ UINT32 VirtualTimerInterrupt;
+ UINT32 VirtualTimerFlags;
+ UINT32 NonSecurePl2Interrupt;
+ UINT32 NonSecurePl2Flags;
+
+} ACPI_TABLE_GTDT;
+
+/* Values for Flags field above */
+
+#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1
+
+/* Values for all "TimerFlags" fields above */
+
+#define ACPI_GTDT_INTERRUPT_MODE 1
+#define ACPI_GTDT_INTERRUPT_POLARITY 2
+
+
+/*******************************************************************************
+ *
+ * MPST - Memory Power State Table (ACPI 5.0)
+ * Version 1
+ *
+ ******************************************************************************/
+
+#define ACPI_MPST_CHANNEL_INFO \
+ UINT16 Reserved1; \
+ UINT8 ChannelId; \
+ UINT8 Reserved2; \
+ UINT16 PowerNodeCount;
+
+/* Main table */
+
+typedef struct acpi_table_mpst
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
+
+} ACPI_TABLE_MPST;
+
+
+/* Memory Platform Communication Channel Info */
+
+typedef struct acpi_mpst_channel
+{
+ ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
+
+} ACPI_MPST_CHANNEL;
+
+
+/* Memory Power Node Structure */
+
+typedef struct acpi_mpst_power_node
+{
+ UINT8 Flags;
+ UINT8 Reserved1;
+ UINT16 NodeId;
+ UINT32 Length;
+ UINT64 RangeAddress;
+ UINT64 RangeLength;
+ UINT8 NumPowerStates;
+ UINT8 NumPhysicalComponents;
+ UINT16 Reserved2;
+
+} ACPI_MPST_POWER_NODE;
+
+/* Values for Flags field above */
+
+#define ACPI_MPST_ENABLED 1
+#define ACPI_MPST_POWER_MANAGED 2
+#define ACPI_MPST_HOT_PLUG_CAPABLE 4
+
+
+/* Memory Power State Structure (follows POWER_NODE above) */
+
+typedef struct acpi_mpst_power_state
+{
+ UINT8 PowerState;
+ UINT8 InfoIndex;
+
+} ACPI_MPST_POWER_STATE;
+
+
+/* Physical Component ID Structure (follows POWER_STATE above) */
+
+typedef struct acpi_mpst_component
+{
+ UINT16 ComponentId;
+
+} ACPI_MPST_COMPONENT;
+
+
+/* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
+
+typedef struct acpi_mpst_data_hdr
+{
+ UINT16 CharacteristicsCount;
+
+} ACPI_MPST_DATA_HDR;
+
+typedef struct acpi_mpst_power_data
+{
+ UINT8 Revision;
+ UINT8 Flags;
+ UINT16 Reserved1;
+ UINT32 AveragePower;
+ UINT32 PowerSaving;
+ UINT64 ExitLatency;
+ UINT64 Reserved2;
+
+} ACPI_MPST_POWER_DATA;
+
+/* Values for Flags field above */
+
+#define ACPI_MPST_PRESERVE 1
+#define ACPI_MPST_AUTOENTRY 2
+#define ACPI_MPST_AUTOEXIT 4
+
+
+/* Shared Memory Region (not part of an ACPI table) */
+
+typedef struct acpi_mpst_shared
+{
+ UINT32 Signature;
+ UINT16 PccCommand;
+ UINT16 PccStatus;
+ UINT16 CommandRegister;
+ UINT16 StatusRegister;
+ UINT16 PowerStateId;
+ UINT16 PowerNodeId;
+ UINT64 EnergyConsumed;
+ UINT64 AveragePower;
+
+} ACPI_MPST_SHARED;
+
+
+/*******************************************************************************
+ *
+ * PCCT - Platform Communications Channel Table (ACPI 5.0)
+ * Version 1
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_pcct
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 Flags;
+ UINT32 Latency;
+ UINT32 Reserved;
+
+} ACPI_TABLE_PCCT;
+
+/* Values for Flags field above */
+
+#define ACPI_PCCT_DOORBELL 1
+
+/*
+ * PCCT subtables
+ */
+
+/* 0: Generic Communications Subspace */
+
+typedef struct acpi_pcct_subspace
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 Reserved[6];
+ UINT64 BaseAddress;
+ UINT64 Length;
+ ACPI_GENERIC_ADDRESS DoorbellRegister;
+ UINT64 PreserveMask;
+ UINT64 WriteMask;
+
+} ACPI_PCCT_SUBSPACE;
+
+
+/*
+ * PCC memory structures (not part of the ACPI table)
+ */
+
+/* Shared Memory Region */
+
+typedef struct acpi_pcct_shared_memory
+{
+ UINT32 Signature;
+ UINT16 Command;
+ UINT16 Status;
+
+} ACPI_PCCT_SHARED_MEMORY;
+
+
+/*******************************************************************************
+ *
+ * PMTT - Platform Memory Topology Table (ACPI 5.0)
+ * Version 1
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_pmtt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 Reserved;
+
+} ACPI_TABLE_PMTT;
+
+
+/* Common header for PMTT subtables that follow main table */
+
+typedef struct acpi_pmtt_header
+{
+ UINT8 Type;
+ UINT8 Reserved1;
+ UINT16 Length;
+ UINT16 Flags;
+ UINT16 Reserved2;
+
+} ACPI_PMTT_HEADER;
+
+/* Values for Type field above */
+
+#define ACPI_PMTT_TYPE_SOCKET 0
+#define ACPI_PMTT_TYPE_CONTROLLER 1
+#define ACPI_PMTT_TYPE_DIMM 2
+#define ACPI_PMTT_TYPE_RESERVED 3 /* 0x03-0xFF are reserved */
+
+/* Values for Flags field above */
+
+#define ACPI_PMTT_TOP_LEVEL 0x0001
+#define ACPI_PMTT_PHYSICAL 0x0002
+#define ACPI_PMTT_MEMORY_TYPE 0x000C
+
+
+/*
+ * PMTT subtables, correspond to Type in acpi_pmtt_header
+ */
+
+
+/* 0: Socket Structure */
+
+typedef struct acpi_pmtt_socket
+{
+ ACPI_PMTT_HEADER Header;
+ UINT16 SocketId;
+ UINT16 Reserved;
+
+} ACPI_PMTT_SOCKET;
+
+
+/* 1: Memory Controller subtable */
+
+typedef struct acpi_pmtt_controller
+{
+ ACPI_PMTT_HEADER Header;
+ UINT32 ReadLatency;
+ UINT32 WriteLatency;
+ UINT32 ReadBandwidth;
+ UINT32 WriteBandwidth;
+ UINT16 AccessWidth;
+ UINT16 Alignment;
+ UINT16 Reserved;
+ UINT16 DomainCount;
+
+} ACPI_PMTT_CONTROLLER;
+
+/* 1a: Proximity Domain substructure */
+
+typedef struct acpi_pmtt_domain
+{
+ UINT32 ProximityDomain;
+
+} ACPI_PMTT_DOMAIN;
+
+
+/* 2: Physical Component Identifier (DIMM) */
+
+typedef struct acpi_pmtt_physical_component
+{
+ ACPI_PMTT_HEADER Header;
+ UINT16 ComponentId;
+ UINT16 Reserved;
+ UINT32 MemorySize;
+ UINT32 BiosHandle;
+
+} ACPI_PMTT_PHYSICAL_COMPONENT;
+
+
+/*******************************************************************************
+ *
+ * RASF - RAS Feature Table (ACPI 5.0)
+ * Version 1
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_rasf
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 ChannelId[12];
+
+} ACPI_TABLE_RASF;
+
+/* RASF Platform Communication Channel Shared Memory Region */
+
+typedef struct acpi_rasf_shared_memory
+{
+ UINT32 Signature;
+ UINT16 Command;
+ UINT16 Status;
+ UINT64 RequestedAddress;
+ UINT64 RequestedLength;
+ UINT64 ActualAddress;
+ UINT64 ActualLength;
+ UINT16 Flags;
+ UINT8 Speed;
+
+} ACPI_RASF_SHARED_MEMORY;
+
+/* Masks for Flags and Speed fields above */
+
+#define ACPI_RASF_SCRUBBER_RUNNING 1
+#define ACPI_RASF_SPEED (7<<1)
+
+/* Channel Commands */
+
+enum AcpiRasfCommands
+{
+ ACPI_RASF_GET_RAS_CAPABILITIES = 1,
+ ACPI_RASF_GET_PATROL_PARAMETERS = 2,
+ ACPI_RASF_START_PATROL_SCRUBBER = 3,
+ ACPI_RASF_STOP_PATROL_SCRUBBER = 4
+};
+
+/* Channel Command flags */
+
+#define ACPI_RASF_GENERATE_SCI (1<<15)
+
+/* Status values */
+
+enum AcpiRasfStatus
+{
+ ACPI_RASF_SUCCESS = 0,
+ ACPI_RASF_NOT_VALID = 1,
+ ACPI_RASF_NOT_SUPPORTED = 2,
+ ACPI_RASF_BUSY = 3,
+ ACPI_RASF_FAILED = 4,
+ ACPI_RASF_ABORTED = 5,
+ ACPI_RASF_INVALID_DATA = 6
+};
+
+/* Status flags */
+
+#define ACPI_RASF_COMMAND_COMPLETE (1)
+#define ACPI_RASF_SCI_DOORBELL (1<<1)
+#define ACPI_RASF_ERROR (1<<2)
+#define ACPI_RASF_STATUS (0x1F<<3)
+
+
+/* Reset to default packing */
+
+#pragma pack()
+
+#endif /* __ACTBL3_H__ */
diff --git a/usr/src/uts/intel/sys/acpi/actypes.h b/usr/src/uts/intel/sys/acpi/actypes.h
index 095e589607..4a5188544e 100644
--- a/usr/src/uts/intel/sys/acpi/actypes.h
+++ b/usr/src/uts/intel/sys/acpi/actypes.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -520,6 +520,13 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_SLEEP_TYPE_INVALID 0xFF
/*
+ * Sleep/Wake flags
+ */
+#define ACPI_NO_OPTIONAL_METHODS 0x00 /* Do not execute any optional methods */
+#define ACPI_EXECUTE_GTS 0x01 /* For enter sleep interface */
+#define ACPI_EXECUTE_BFS 0x02 /* For leave sleep prep interface */
+
+/*
* Standard notify values
*/
#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0x00
@@ -534,8 +541,9 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_NOTIFY_DEVICE_PLD_CHECK (UINT8) 0x09
#define ACPI_NOTIFY_RESERVED (UINT8) 0x0A
#define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B
+#define ACPI_NOTIFY_SHUTDOWN_REQUEST (UINT8) 0x0C
-#define ACPI_NOTIFY_MAX 0x0B
+#define ACPI_NOTIFY_MAX 0x0C
/*
* Types associated with ACPI names and objects. The first group of
@@ -700,8 +708,13 @@ typedef UINT32 ACPI_EVENT_STATUS;
#define ACPI_DEVICE_NOTIFY 0x2
#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
+#define ACPI_NUM_NOTIFY_TYPES 2
+
+#define ACPI_MAX_SYS_NOTIFY 0x7F
+#define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF
-#define ACPI_MAX_SYS_NOTIFY 0x7f
+#define ACPI_SYSTEM_HANDLER_LIST 0 /* Used as index, must be SYSTEM_NOTIFY -1 */
+#define ACPI_DEVICE_HANDLER_LIST 1 /* Used as index, must be DEVICE_NOTIFY -1 */
/* Address Space (Operation Region) Types */
@@ -716,8 +729,10 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE;
#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5
#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6
#define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7
+#define ACPI_ADR_SPACE_GPIO (ACPI_ADR_SPACE_TYPE) 8
+#define ACPI_ADR_SPACE_GSBUS (ACPI_ADR_SPACE_TYPE) 9
-#define ACPI_NUM_PREDEFINED_REGIONS 8
+#define ACPI_NUM_PREDEFINED_REGIONS 10
/*
* Special Address Spaces
@@ -790,6 +805,20 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE;
#define ACPI_DISABLE_EVENT 0
+/* Sleep function dispatch */
+
+typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) (
+ UINT8 SleepState,
+ UINT8 Flags);
+
+typedef struct acpi_sleep_functions
+{
+ ACPI_SLEEP_FUNCTION LegacyFunction;
+ ACPI_SLEEP_FUNCTION ExtendedFunction;
+
+} ACPI_SLEEP_FUNCTIONS;
+
+
/*
* External ACPI object definition
*/
@@ -1030,6 +1059,17 @@ ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
#define ACPI_DEFAULT_HANDLER NULL
+/* Special Context data for GenericSerialBus/GeneralPurposeIo (ACPI 5.0) */
+
+typedef struct acpi_connection_info
+{
+ UINT8 *Connection;
+ UINT16 Length;
+ UINT8 AccessLength;
+
+} ACPI_CONNECTION_INFO;
+
+
typedef
ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
ACPI_HANDLE RegionHandle,
diff --git a/usr/src/uts/intel/sys/acpi/acutils.h b/usr/src/uts/intel/sys/acpi/acutils.h
index 489f195eb9..e9c9b95dda 100644
--- a/usr/src/uts/intel/sys/acpi/acutils.h
+++ b/usr/src/uts/intel/sys/acpi/acutils.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,6 +46,7 @@
extern const UINT8 AcpiGbl_ResourceAmlSizes[];
+extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[];
/* Strings used by the disassembler and debugger resource dump routines */
@@ -69,6 +70,22 @@ extern const char *AcpiGbl_SizDecode[];
extern const char *AcpiGbl_TrsDecode[];
extern const char *AcpiGbl_TtpDecode[];
extern const char *AcpiGbl_TypDecode[];
+extern const char *AcpiGbl_PpcDecode[];
+extern const char *AcpiGbl_IorDecode[];
+extern const char *AcpiGbl_DtsDecode[];
+extern const char *AcpiGbl_CtDecode[];
+extern const char *AcpiGbl_SbtDecode[];
+extern const char *AcpiGbl_AmDecode[];
+extern const char *AcpiGbl_SmDecode[];
+extern const char *AcpiGbl_WmDecode[];
+extern const char *AcpiGbl_CphDecode[];
+extern const char *AcpiGbl_CpoDecode[];
+extern const char *AcpiGbl_DpDecode[];
+extern const char *AcpiGbl_EdDecode[];
+extern const char *AcpiGbl_BpbDecode[];
+extern const char *AcpiGbl_SbDecode[];
+extern const char *AcpiGbl_FcDecode[];
+extern const char *AcpiGbl_PtDecode[];
#endif
/* Types for Resource descriptor entries */
@@ -113,7 +130,6 @@ typedef struct acpi_pkg_info
#define DB_DWORD_DISPLAY 4
#define DB_QWORD_DISPLAY 8
-
/*
* utglobal - Global data structures and procedures
*/
@@ -722,6 +738,11 @@ void
AcpiUtStrlwr (
char *SrcString);
+int
+AcpiUtStricmp (
+ char *String1,
+ char *String2);
+
void
AcpiUtPrintString (
char *String,
@@ -897,6 +918,31 @@ AcpiUtCreateList (
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+/*
+ * utaddress - address range check
+ */
+ACPI_STATUS
+AcpiUtAddAddressRange (
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 Length,
+ ACPI_NAMESPACE_NODE *RegionNode);
+
+void
+AcpiUtRemoveAddressRange (
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_NAMESPACE_NODE *RegionNode);
+
+UINT32
+AcpiUtCheckAddressRange (
+ ACPI_ADR_SPACE_TYPE SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 Length,
+ BOOLEAN Warn);
+
+void
+AcpiUtDeleteAddressLists (
+ void);
/*
* utxferror - various error/warning output functions
diff --git a/usr/src/uts/intel/sys/acpi/amlcode.h b/usr/src/uts/intel/sys/acpi/amlcode.h
index f6e0de3b35..f778bb0780 100644
--- a/usr/src/uts/intel/sys/acpi/amlcode.h
+++ b/usr/src/uts/intel/sys/acpi/amlcode.h
@@ -7,7 +7,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -191,6 +191,15 @@
/*
+ * Opcodes for "Field" operators
+ */
+#define AML_FIELD_OFFSET_OP (UINT8) 0x00
+#define AML_FIELD_ACCESS_OP (UINT8) 0x01
+#define AML_FIELD_CONNECTION_OP (UINT8) 0x02 /* ACPI 5.0 */
+#define AML_FIELD_EXT_ACCESS_OP (UINT8) 0x03 /* ACPI 5.0 */
+
+
+/*
* Internal opcodes
* Use only "Unknown" AML opcodes, don't attempt to use
* any valid ACPI ASCII values (A-Z, 0-9, '-')
@@ -204,7 +213,8 @@
#define AML_INT_METHODCALL_OP (UINT16) 0x0035
#define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036
#define AML_INT_EVAL_SUBTREE_OP (UINT16) 0x0037
-
+#define AML_INT_CONNECTION_OP (UINT16) 0x0038
+#define AML_INT_EXTACCESSFIELD_OP (UINT16) 0x0039
#define ARG_NONE 0x0
@@ -478,13 +488,16 @@ typedef enum
*/
typedef enum
{
- AML_FIELD_ATTRIB_SMB_QUICK = 0x02,
- AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04,
- AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
- AML_FIELD_ATTRIB_SMB_WORD = 0x08,
- AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
- AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
- AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
+ AML_FIELD_ATTRIB_QUICK = 0x02,
+ AML_FIELD_ATTRIB_SEND_RCV = 0x04,
+ AML_FIELD_ATTRIB_BYTE = 0x06,
+ AML_FIELD_ATTRIB_WORD = 0x08,
+ AML_FIELD_ATTRIB_BLOCK = 0x0A,
+ AML_FIELD_ATTRIB_MULTIBYTE = 0x0B,
+ AML_FIELD_ATTRIB_WORD_CALL = 0x0C,
+ AML_FIELD_ATTRIB_BLOCK_CALL = 0x0D,
+ AML_FIELD_ATTRIB_RAW_BYTES = 0x0E,
+ AML_FIELD_ATTRIB_RAW_PROCESS = 0x0F
} AML_ACCESS_ATTRIBUTE;
diff --git a/usr/src/uts/intel/sys/acpi/amlresrc.h b/usr/src/uts/intel/sys/acpi/amlresrc.h
index 1375d96cf8..6d85b8a2d0 100644
--- a/usr/src/uts/intel/sys/acpi/amlresrc.h
+++ b/usr/src/uts/intel/sys/acpi/amlresrc.h
@@ -6,7 +6,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -59,29 +59,48 @@
#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
#define ACPI_RESTAG_BASEADDRESS "_BAS"
#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
+#define ACPI_RESTAG_DEBOUNCETIME "_DBT"
#define ACPI_RESTAG_DECODE "_DEC"
+#define ACPI_RESTAG_DEVICEPOLARITY "_DPL"
#define ACPI_RESTAG_DMA "_DMA"
#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
+#define ACPI_RESTAG_DRIVESTRENGTH "_DRS"
+#define ACPI_RESTAG_ENDIANNESS "_END"
+#define ACPI_RESTAG_FLOWCONTROL "_FLC"
#define ACPI_RESTAG_GRANULARITY "_GRA"
#define ACPI_RESTAG_INTERRUPT "_INT"
#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
+#define ACPI_RESTAG_IORESTRICTION "_IOR"
#define ACPI_RESTAG_LENGTH "_LEN"
+#define ACPI_RESTAG_LINE "_LIN"
#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
#define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
#define ACPI_RESTAG_MAXADDR "_MAX"
#define ACPI_RESTAG_MINADDR "_MIN"
#define ACPI_RESTAG_MAXTYPE "_MAF"
#define ACPI_RESTAG_MINTYPE "_MIF"
+#define ACPI_RESTAG_MODE "_MOD"
+#define ACPI_RESTAG_PARITY "_PAR"
+#define ACPI_RESTAG_PHASE "_PHA"
+#define ACPI_RESTAG_PIN "_PIN"
+#define ACPI_RESTAG_PINCONFIG "_PPI"
+#define ACPI_RESTAG_POLARITY "_POL"
#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
#define ACPI_RESTAG_RANGETYPE "_RNG"
#define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
+#define ACPI_RESTAG_LENGTH_RX "_RXL"
+#define ACPI_RESTAG_LENGTH_TX "_TXL"
+#define ACPI_RESTAG_SLAVEMODE "_SLV"
+#define ACPI_RESTAG_SPEED "_SPE"
+#define ACPI_RESTAG_STOPBITS "_STB"
#define ACPI_RESTAG_TRANSLATION "_TRA"
#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
+#define ACPI_RESTAG_VENDORDATA "_VEN"
/* Default sizes for "small" resource descriptors */
@@ -92,6 +111,7 @@
#define ASL_RDESC_END_DEPEND_SIZE 0x00
#define ASL_RDESC_IO_SIZE 0x07
#define ASL_RDESC_FIXED_IO_SIZE 0x03
+#define ASL_RDESC_FIXED_DMA_SIZE 0x05
#define ASL_RDESC_END_TAG_SIZE 0x01
@@ -214,6 +234,16 @@ typedef struct aml_resource_end_tag
} AML_RESOURCE_END_TAG;
+typedef struct aml_resource_fixed_dma
+{
+ AML_RESOURCE_SMALL_HEADER_COMMON
+ UINT16 RequestLines;
+ UINT16 Channels;
+ UINT8 Width;
+
+} AML_RESOURCE_FIXED_DMA;
+
+
/*
* LARGE descriptors
*/
@@ -368,6 +398,130 @@ typedef struct aml_resource_generic_register
} AML_RESOURCE_GENERIC_REGISTER;
+
+/* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */
+
+typedef struct aml_resource_gpio
+{
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ UINT8 RevisionId;
+ UINT8 ConnectionType;
+ UINT16 Flags;
+ UINT16 IntFlags;
+ UINT8 PinConfig;
+ UINT16 DriveStrength;
+ UINT16 DebounceTimeout;
+ UINT16 PinTableOffset;
+ UINT8 ResSourceIndex;
+ UINT16 ResSourceOffset;
+ UINT16 VendorOffset;
+ UINT16 VendorLength;
+ /*
+ * Optional fields follow immediately:
+ * 1) PIN list (Words)
+ * 2) Resource Source String
+ * 3) Vendor Data bytes
+ */
+
+} AML_RESOURCE_GPIO;
+
+#define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */
+
+/* Values for ConnectionType above */
+
+#define AML_RESOURCE_GPIO_TYPE_INT 0
+#define AML_RESOURCE_GPIO_TYPE_IO 1
+#define AML_RESOURCE_MAX_GPIOTYPE 1
+
+
+/* Common preamble for all serial descriptors (ACPI 5.0) */
+
+#define AML_RESOURCE_SERIAL_COMMON \
+ UINT8 RevisionId; \
+ UINT8 ResSourceIndex; \
+ UINT8 Type; \
+ UINT8 Flags; \
+ UINT16 TypeSpecificFlags; \
+ UINT8 TypeRevisionId; \
+ UINT16 TypeDataLength; \
+
+/* Values for the type field above */
+
+#define AML_RESOURCE_I2C_SERIALBUSTYPE 1
+#define AML_RESOURCE_SPI_SERIALBUSTYPE 2
+#define AML_RESOURCE_UART_SERIALBUSTYPE 3
+#define AML_RESOURCE_MAX_SERIALBUSTYPE 3
+#define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
+
+typedef struct aml_resource_common_serialbus
+{
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_SERIAL_COMMON
+
+} AML_RESOURCE_COMMON_SERIALBUS;
+
+typedef struct aml_resource_i2c_serialbus
+{
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_SERIAL_COMMON
+ UINT32 ConnectionSpeed;
+ UINT16 SlaveAddress;
+ /*
+ * Optional fields follow immediately:
+ * 1) Vendor Data bytes
+ * 2) Resource Source String
+ */
+
+} AML_RESOURCE_I2C_SERIALBUS;
+
+#define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */
+#define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */
+#define AML_RESOURCE_I2C_MIN_DATA_LEN 6
+
+typedef struct aml_resource_spi_serialbus
+{
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_SERIAL_COMMON
+ UINT32 ConnectionSpeed;
+ UINT8 DataBitLength;
+ UINT8 ClockPhase;
+ UINT8 ClockPolarity;
+ UINT16 DeviceSelection;
+ /*
+ * Optional fields follow immediately:
+ * 1) Vendor Data bytes
+ * 2) Resource Source String
+ */
+
+} AML_RESOURCE_SPI_SERIALBUS;
+
+#define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */
+#define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */
+#define AML_RESOURCE_SPI_MIN_DATA_LEN 9
+
+
+typedef struct aml_resource_uart_serialbus
+{
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_SERIAL_COMMON
+ UINT32 DefaultBaudRate;
+ UINT16 RxFifoSize;
+ UINT16 TxFifoSize;
+ UINT8 Parity;
+ UINT8 LinesEnabled;
+ /*
+ * Optional fields follow immediately:
+ * 1) Vendor Data bytes
+ * 2) Resource Source String
+ */
+
+} AML_RESOURCE_UART_SERIALBUS;
+
+#define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */
+#define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */
+#define AML_RESOURCE_UART_MIN_DATA_LEN 10
+
+
/* restore default alignment */
#pragma pack()
@@ -390,6 +544,7 @@ typedef union aml_resource
AML_RESOURCE_END_DEPENDENT EndDpf;
AML_RESOURCE_IO Io;
AML_RESOURCE_FIXED_IO FixedIo;
+ AML_RESOURCE_FIXED_DMA FixedDma;
AML_RESOURCE_VENDOR_SMALL VendorSmall;
AML_RESOURCE_END_TAG EndTag;
@@ -405,6 +560,11 @@ typedef union aml_resource
AML_RESOURCE_ADDRESS64 Address64;
AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
AML_RESOURCE_EXTENDED_IRQ ExtendedIrq;
+ AML_RESOURCE_GPIO Gpio;
+ AML_RESOURCE_I2C_SERIALBUS I2cSerialBus;
+ AML_RESOURCE_SPI_SERIALBUS SpiSerialBus;
+ AML_RESOURCE_UART_SERIALBUS UartSerialBus;
+ AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus;
/* Utility overlays */
diff --git a/usr/src/uts/intel/sys/acpi/platform/accygwin.h b/usr/src/uts/intel/sys/acpi/platform/accygwin.h
index 10ae3e83b7..831f313987 100644
--- a/usr/src/uts/intel/sys/acpi/platform/accygwin.h
+++ b/usr/src/uts/intel/sys/acpi/platform/accygwin.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/platform/acefi.h b/usr/src/uts/intel/sys/acpi/platform/acefi.h
index 9249ae8d24..bab6159381 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acefi.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acefi.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/platform/acenv.h b/usr/src/uts/intel/sys/acpi/platform/acenv.h
index 7f893c13ff..19ca03baac 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acenv.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acenv.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -79,7 +79,7 @@
#define ACPI_SINGLE_THREADED
#endif
-/* AcpiExec and AcpiBin configuration */
+/* AcpiExec configuration. Multithreaded with full AML debugger */
#ifdef ACPI_EXEC_APP
#define ACPI_APPLICATION
@@ -88,7 +88,27 @@
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
-#ifdef ACPI_BIN_APP
+/* AcpiNames configuration. Single threaded with debugger output enabled. */
+
+#ifdef ACPI_NAMES_APP
+#define ACPI_DEBUGGER
+#define ACPI_APPLICATION
+#define ACPI_SINGLE_THREADED
+#endif
+
+/*
+ * AcpiBin/AcpiHelp/AcpiSrc configuration. All single threaded, with
+ * no debug output.
+ */
+#if (defined ACPI_BIN_APP) || \
+ (defined ACPI_SRC_APP) || \
+ (defined ACPI_XTRACT_APP)
+#define ACPI_APPLICATION
+#define ACPI_SINGLE_THREADED
+#endif
+
+#ifdef ACPI_HELP_APP
+#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
#endif
diff --git a/usr/src/uts/intel/sys/acpi/platform/acfreebsd.h b/usr/src/uts/intel/sys/acpi/platform/acfreebsd.h
index ad106ecf5e..98f972f373 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acfreebsd.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acfreebsd.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/platform/acgcc.h b/usr/src/uts/intel/sys/acpi/platform/acgcc.h
index 4b197ff63a..d2eafff395 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acgcc.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acgcc.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/platform/acintel.h b/usr/src/uts/intel/sys/acpi/platform/acintel.h
index cf7e0bc224..46d238bedb 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acintel.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acintel.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/platform/aclinux.h b/usr/src/uts/intel/sys/acpi/platform/aclinux.h
index 3fc3d97cb8..edfff150ed 100644
--- a/usr/src/uts/intel/sys/acpi/platform/aclinux.h
+++ b/usr/src/uts/intel/sys/acpi/platform/aclinux.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -87,17 +87,18 @@
/* Host-dependent types and defines for user-space ACPICA */
#define ACPI_FLUSH_CPU_CACHE()
-#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread))
#if defined(__ia64__) || defined(__x86_64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
+#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread))
#else
#define ACPI_MACHINE_WIDTH 32
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_USE_NATIVE_DIVIDE
+#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (UINT32) (void *) (pthread))
#endif
#ifndef __cdecl
diff --git a/usr/src/uts/intel/sys/acpi/platform/acmsvc.h b/usr/src/uts/intel/sys/acpi/platform/acmsvc.h
index 8590d95fd0..b73a62caf1 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acmsvc.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acmsvc.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,28 @@
#ifndef __ACMSVC_H__
#define __ACMSVC_H__
+
+/*
+ * Map low I/O functions for MS. This allows us to disable MS language
+ * extensions for maximum portability.
+ */
+#define open _open
+#define read _read
+#define write _write
+#define close _close
+#define stat _stat
+#define fstat _fstat
+#define mkdir _mkdir
+#define strlwr _strlwr
+#define O_RDONLY _O_RDONLY
+#define O_BINARY _O_BINARY
+#define O_CREAT _O_CREAT
+#define O_WRONLY _O_WRONLY
+#define O_TRUNC _O_TRUNC
+#define S_IREAD _S_IREAD
+#define S_IWRITE _S_IWRITE
+#define S_IFDIR _S_IFDIR
+
/* Eliminate warnings for "old" (non-secure) versions of clib functions */
#ifndef _CRT_SECURE_NO_WARNINGS
diff --git a/usr/src/uts/intel/sys/acpi/platform/acnetbsd.h b/usr/src/uts/intel/sys/acpi/platform/acnetbsd.h
index 7c7a63ec94..23b0e8c4c3 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acnetbsd.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acnetbsd.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/platform/acos2.h b/usr/src/uts/intel/sys/acpi/platform/acos2.h
index f01d697e31..0704c50161 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acos2.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acos2.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/platform/acwin.h b/usr/src/uts/intel/sys/acpi/platform/acwin.h
index 1355827ccb..c7d4bcd386 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acwin.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acwin.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/acpi/platform/acwin64.h b/usr/src/uts/intel/sys/acpi/platform/acwin64.h
index b4d184294c..022baf050e 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acwin64.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acwin64.h
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2012, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/usr/src/uts/intel/sys/x86_archext.h b/usr/src/uts/intel/sys/x86_archext.h
index ffc4014db9..f2754a1431 100644
--- a/usr/src/uts/intel/sys/x86_archext.h
+++ b/usr/src/uts/intel/sys/x86_archext.h
@@ -96,7 +96,7 @@ extern "C" {
#define CPUID_INTC_ECX_SSE3 0x00000001 /* Yet more SSE extensions */
#define CPUID_INTC_ECX_PCLMULQDQ 0x00000002 /* PCLMULQDQ insn */
- /* 0x00000004 - reserved */
+#define CPUID_INTC_ECX_DTES64 0x00000004 /* 64-bit DS area */
#define CPUID_INTC_ECX_MON 0x00000008 /* MONITOR/MWAIT */
#define CPUID_INTC_ECX_DSCPL 0x00000010 /* CPL-qualified debug store */
#define CPUID_INTC_ECX_VMX 0x00000020 /* Hardware VM extensions */
@@ -106,17 +106,19 @@ extern "C" {
#define CPUID_INTC_ECX_SSSE3 0x00000200 /* Supplemental SSE3 insns */
#define CPUID_INTC_ECX_CID 0x00000400 /* L1 context ID */
/* 0x00000800 - reserved */
- /* 0x00001000 - reserved */
+#define CPUID_INTC_ECX_FMA 0x00001000 /* Fused Multiply Add */
#define CPUID_INTC_ECX_CX16 0x00002000 /* cmpxchg16 */
#define CPUID_INTC_ECX_ETPRD 0x00004000 /* extended task pri messages */
- /* 0x00008000 - reserved */
+#define CPUID_INTC_ECX_PDCM 0x00008000 /* Perf/Debug Capability MSR */
/* 0x00010000 - reserved */
- /* 0x00020000 - reserved */
+#define CPUID_INTC_ECX_PCID 0x00020000 /* process-context ids */
#define CPUID_INTC_ECX_DCA 0x00040000 /* direct cache access */
#define CPUID_INTC_ECX_SSE4_1 0x00080000 /* SSE4.1 insns */
#define CPUID_INTC_ECX_SSE4_2 0x00100000 /* SSE4.2 insns */
+#define CPUID_INTC_ECX_X2APIC 0x00200000 /* x2apic support */
#define CPUID_INTC_ECX_MOVBE 0x00400000 /* MOVBE insn */
#define CPUID_INTC_ECX_POPCNT 0x00800000 /* POPCNT insn */
+#define CPUID_INTC_ECX_TSCDL 0x01000000 /* Deadline TSC */
#define CPUID_INTC_ECX_AES 0x02000000 /* AES insns */
#define CPUID_INTC_ECX_XSAVE 0x04000000 /* XSAVE/XRESTOR insns */
#define CPUID_INTC_ECX_OSXSAVE 0x08000000 /* OS supports XSAVE insns */
@@ -127,10 +129,10 @@ extern "C" {
#define FMT_CPUID_INTC_ECX \
"\20" \
"\37rdrand\36f16c\35avx\34osxsav\33xsave" \
- "\32aes" \
- "\30popcnt\27movbe\25sse4.2\24sse4.1\23dca" \
- "\20\17etprd\16cx16\13cid\12ssse3\11tm2" \
- "\10est\7smx\6vmx\5dscpl\4mon\2pclmulqdq\1sse3"
+ "\32aes\31tscdl" \
+ "\30popcnt\27movbe\26x2apic\25sse4.2\24sse4.1\23dca" \
+ "\20\18pdcm\17etprd\16cx16\13cid\12ssse3\11tm2" \
+ "\10est\7smx\6vmx\5dscpl\4mon\3dtes64\2pclmulqdq\1sse3"
/*
* cpuid instruction feature flags in %edx (extended function 0x80000001)
@@ -188,16 +190,25 @@ extern "C" {
#define CPUID_AMD_ECX_3DNP 0x00000100 /* AMD: 3DNowPrefectch */
#define CPUID_AMD_ECX_OSVW 0x00000200 /* AMD: OSVW */
#define CPUID_AMD_ECX_IBS 0x00000400 /* AMD: IBS */
-#define CPUID_AMD_ECX_SSE5 0x00000800 /* AMD: SSE5 */
+#define CPUID_AMD_ECX_SSE5 0x00000800 /* AMD: Extended AVX */
#define CPUID_AMD_ECX_SKINIT 0x00001000 /* AMD: SKINIT */
#define CPUID_AMD_ECX_WDT 0x00002000 /* AMD: WDT */
+ /* 0x00004000 - reserved */
+#define CPUID_AMD_ECX_LWP 0x00008000 /* AMD: Lightweight profiling */
+#define CPUID_AMD_ECX_FMA4 0x00010000 /* AMD: 4-operand FMA support */
+ /* 0x00020000 - reserved */
+ /* 0x00040000 - reserved */
+#define CPUID_AMD_ECX_NIDMSR 0x00080000 /* AMD: Node ID MSR */
+ /* 0x00100000 - reserved */
+#define CPUID_AMD_ECX_TBM 0x00200000 /* AMD: trailing bit manips. */
#define CPUID_AMD_ECX_TOPOEXT 0x00400000 /* AMD: Topology Extensions */
+
#define FMT_CPUID_AMD_ECX \
"\20" \
- "\22topoext" \
+ "\23topoext\22tbm\20nimdsr\17fma4\16lwp" \
"\14wdt\13skinit\12sse5\11ibs\10osvw\93dnp\8mas" \
- "\7sse4a\6lzcnt\5cr8d\3svm\2lcmplgcy\1ahf64"
+ "\7sse4a\6lzcnt\5cr8d\4eas\3svm\2lcmplgcy\1ahf64"
/*
* Intel now seems to have claimed part of the "extended" function
diff --git a/usr/src/uts/intel/tpm/Makefile b/usr/src/uts/intel/tpm/Makefile
index 96e810cd4f..c87048cceb 100644
--- a/usr/src/uts/intel/tpm/Makefile
+++ b/usr/src/uts/intel/tpm/Makefile
@@ -61,7 +61,7 @@ CFLAGS += -xCC
CPPFLAGS += -I$(ROOT)/usr/include
# This is for /usr/include/tss/, which is not built in the ON consolidation
-CPPFLAGS += -I/usr/include
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include
CERRWARN += -_gcc=-Wno-parentheses
diff --git a/usr/src/uts/intel/vmxnet/Makefile b/usr/src/uts/intel/vmxnet/Makefile
new file mode 100644
index 0000000000..4f3ebcf5af
--- /dev/null
+++ b/usr/src/uts/intel/vmxnet/Makefile
@@ -0,0 +1,93 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# VMware Ethernet Adapter b module
+#
+
+#
+# Path to the base of the uts directory tree (usually /usr/src/uts).
+#
+UTSBASE = ../..
+UTSCLOSED = ../../../../closed/uts
+
+#
+# Define the module and object file sets.
+#
+MODULE = vmxnet
+#
+ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
+CONF_SRCDIR = $(UTSBASE)/intel/io/vmxnet
+
+#
+# Include common rules.
+#
+include $(UTSBASE)/intel/Makefile.intel
+
+#
+# The list of object files is defined here, rather than in Makefile.files,
+# because the "$(CLOSED_BUILD)" macro has not been defined at the time
+# Makefile.files is processed.
+#
+VMXNET_OBJS += vmxnet.o
+
+OBJECTS = $(VMXNET_OBJS:%=$(OBJS_DIR)/%)
+LINTS = $(VMXNET_OBJS:%.o=$(LINTS_DIR)/%.ln)
+
+#
+# Define targets
+#
+ALL_TARGET = $(BINARY) $(SRC_CONFFILE)
+LINT_TARGET = $(LINT_MODULE).lint
+INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
+
+CPPFLAGS += -I$(UTSBASE)/i86pc
+LDFLAGS += -dy -N misc/gld
+
+#
+# Default build targets.
+#
+.KEEP_STATE:
+
+def: $(DEF_DEPS)
+
+all: $(ALL_DEPS)
+
+clean: $(CLEAN_DEPS)
+
+clobber: $(CLOBBER_DEPS)
+
+#
+# Intentionally don't build lint libraries to minimize divergence with
+# the upstream source.
+#
+lint:
+modlintlib:
+clean.lint:
+
+install: $(INSTALL_DEPS)
+
+#
+# Include common targets.
+#
+include ../Makefile.targ
diff --git a/usr/src/uts/sparc/Makefile.sparc.shared b/usr/src/uts/sparc/Makefile.sparc.shared
index cd8f6b9e4b..96f6960750 100644
--- a/usr/src/uts/sparc/Makefile.sparc.shared
+++ b/usr/src/uts/sparc/Makefile.sparc.shared
@@ -116,6 +116,8 @@ XARCH = $(XARCH_$(CLASS))
COPTIMIZE_32 = -xO3
COPTIMIZE_64 = -xO3
COPTIMIZE = $(COPTIMIZE_$(CLASS))
+$(__GNUC4)COPTIMIZE += -_gcc=-fno-inline-small-functions \
+ -_gcc=-fno-inline-functions-called-once
CCMODE = -Xa
diff --git a/usr/src/uts/sparc/dtrace/Makefile b/usr/src/uts/sparc/dtrace/Makefile
index 3a2d5341b1..7fbedc8cbe 100644
--- a/usr/src/uts/sparc/dtrace/Makefile
+++ b/usr/src/uts/sparc/dtrace/Makefile
@@ -52,6 +52,7 @@ DTRACE_INC_64 = -I$(UTSBASE)/sparc/v9
CFLAGS += $(CCVERBOSE)
CPPFLAGS += $(DTRACE_INC_$(CLASS))
+CPPFLAGS += -I$(SRC)/common/util
DTRACE_XAS_32 = -xarch=v8plus
DTRACE_XAS_64 = -xarch=v9
diff --git a/usr/src/uts/sparc/dtrace/sdt.c b/usr/src/uts/sparc/dtrace/sdt.c
index af9ea8e155..8fbdf24fee 100644
--- a/usr/src/uts/sparc/dtrace/sdt.c
+++ b/usr/src/uts/sparc/dtrace/sdt.c
@@ -23,6 +23,9 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#include <sys/modctl.h>
#include <sys/sunddi.h>
@@ -373,9 +376,19 @@ sdt_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
sdt_devi = devi;
for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) {
+ uint32_t priv;
+
+ if (prov->sdtp_priv == DTRACE_PRIV_NONE) {
+ priv = DTRACE_PRIV_KERNEL;
+ sdt_pops.dtps_mode = NULL;
+ } else {
+ priv = prov->sdtp_priv;
+ ASSERT(priv == DTRACE_PRIV_USER);
+ sdt_pops.dtps_mode = sdt_mode;
+ }
+
if (dtrace_register(prov->sdtp_name, prov->sdtp_attr,
- DTRACE_PRIV_KERNEL, NULL,
- &sdt_pops, prov, &prov->sdtp_id) != 0) {
+ priv, NULL, &sdt_pops, prov, &prov->sdtp_id) != 0) {
cmn_err(CE_WARN, "failed to register sdt provider %s",
prov->sdtp_name);
}
diff --git a/usr/src/uts/sparc/ip/ip.global-objs.debug64 b/usr/src/uts/sparc/ip/ip.global-objs.debug64
index 40d5bd498b..8766fae5e0 100644
--- a/usr/src/uts/sparc/ip/ip.global-objs.debug64
+++ b/usr/src/uts/sparc/ip/ip.global-objs.debug64
@@ -246,6 +246,8 @@ sqset_lock
squeue_cache
squeue_drain_ms
squeue_drain_ns
+squeue_drain_stack_needed
+squeue_drain_stack_toodeep
squeue_workerwait_ms
squeue_workerwait_tick
tcp_acceptor_rinit
diff --git a/usr/src/uts/sparc/ip/ip.global-objs.obj64 b/usr/src/uts/sparc/ip/ip.global-objs.obj64
index 5c56fe7efd..b1199eaf38 100644
--- a/usr/src/uts/sparc/ip/ip.global-objs.obj64
+++ b/usr/src/uts/sparc/ip/ip.global-objs.obj64
@@ -243,6 +243,8 @@ sqset_lock
squeue_cache
squeue_drain_ms
squeue_drain_ns
+squeue_drain_stack_needed
+squeue_drain_stack_toodeep
squeue_workerwait_ms
squeue_workerwait_tick
tcp_acceptor_rinit
diff --git a/usr/src/uts/sun4u/io/pci/pcisch.c b/usr/src/uts/sun4u/io/pci/pcisch.c
index 27916bcc74..2a2bd05970 100644
--- a/usr/src/uts/sun4u/io/pci/pcisch.c
+++ b/usr/src/uts/sun4u/io/pci/pcisch.c
@@ -2973,11 +2973,12 @@ iommu_tlb_scrub(iommu_t *iommu_p, int scrub)
"\tContext=%lx %sWritable %sStreamable\n"
"\tPCI Page Size=%sk Address in page %lx\n",
ddi_driver_name(dip), ddi_get_instance(dip), errstat, i,
- (tag & TLBTAG_CONTEXT_BITS) >> TLBTAG_CONTEXT_SHIFT,
+ (uint64_t)(tag & TLBTAG_CONTEXT_BITS) >>
+ TLBTAG_CONTEXT_SHIFT,
(tag & TLBTAG_WRITABLE_BIT) ? "" : neg,
(tag & TLBTAG_STREAM_BIT) ? "" : neg,
(tag & TLBTAG_PGSIZE_BIT) ? "64" : "8",
- (tag & TLBTAG_PCIVPN_BITS) << 13);
+ (uint64_t)(tag & TLBTAG_PCIVPN_BITS) << 13);
cmn_err(CE_CONT, "Memory: %sValid %sCacheable Page Frame=%lx\n",
(data & TLBDATA_VALID_BIT) ? "" : neg,
(data & TLBDATA_CACHE_BIT) ? "" : neg, pfn);
diff --git a/usr/src/uts/sun4v/tpm/Makefile b/usr/src/uts/sun4v/tpm/Makefile
index e36ed558a5..7a44ba61db 100644
--- a/usr/src/uts/sun4v/tpm/Makefile
+++ b/usr/src/uts/sun4v/tpm/Makefile
@@ -71,7 +71,7 @@ CFLAGS += -xCC
CPPFLAGS += -I$(ROOT)/usr/include
# This is for /usr/include/tss/, which is not built in the ON consolidation
-CPPFLAGS += -I/usr/include
+CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include
LDFLAGS += -dy -Nmisc/kcf